@ionic/core
Version:
Base components for Ionic
102 lines (101 loc) • 4.61 kB
JavaScript
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/
import { Host, h } from "@stencil/core";
import { createColorClasses } from "../../utils/theme";
import { getIonMode } from "../../global/ionic-global";
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*
* @slot - Content is placed between the named slots if provided without a slot.
* @slot start - Content is placed to the left of the divider text in LTR, and to the right in RTL.
* @slot end - Content is placed to the right of the divider text in LTR, and to the left in RTL.
*
* @part inner - The inner wrapper element that arranges the divider content.
* @part container - The wrapper element that contains the default slot.
*/
export class ItemDivider {
constructor() {
/**
* When it's set to `true`, the item-divider will stay visible when it reaches the top
* of the viewport until the next `ion-item-divider` replaces it.
*
* This feature relies in `position:sticky`:
* https://caniuse.com/#feat=css-sticky
*/
this.sticky = false;
}
render() {
const mode = getIonMode(this);
return (h(Host, { key: 'b191727cc26c600287fd856e49216bf1ae1d5aad', class: createColorClasses(this.color, {
[mode]: true,
'item-divider-sticky': this.sticky,
item: true,
}) }, h("slot", { key: 'a8e2eb48ca858b64da8ad018fa8d1667030b7143', name: "start" }), h("div", { key: '3219e0b76ac4a96db50a67f1f2794a235111c613', class: "item-divider-inner", part: "inner" }, h("div", { key: '31a64775153cd8704458e0e2a4a512096585deb4', class: "item-divider-wrapper", part: "container" }, h("slot", { key: 'd46dfb578028790eb6ccaac5e6009a5d96aa831a' })), h("slot", { key: 'a5fc7ac27e418ea82d9dcc913a8dae7e35493760', name: "end" }))));
}
static get is() { return "ion-item-divider"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"ios": ["item-divider.ios.scss"],
"md": ["item-divider.md.scss"]
};
}
static get styleUrls() {
return {
"ios": ["item-divider.ios.css"],
"md": ["item-divider.md.css"]
};
}
static get properties() {
return {
"color": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Color",
"resolved": "\"danger\" | \"dark\" | \"light\" | \"medium\" | \"primary\" | \"secondary\" | \"success\" | \"tertiary\" | \"warning\" | string & Record<never, never> | undefined",
"references": {
"Color": {
"location": "import",
"path": "../../interface",
"id": "src/interface.d.ts::Color",
"referenceLocation": "Color"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The color to use from your application's color palette.\nDefault options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\nFor more information on colors, see [theming](/docs/theming/basics)."
},
"getter": false,
"setter": false,
"reflect": true,
"attribute": "color"
},
"sticky": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "When it's set to `true`, the item-divider will stay visible when it reaches the top\nof the viewport until the next `ion-item-divider` replaces it.\n\nThis feature relies in `position:sticky`:\nhttps://caniuse.com/#feat=css-sticky"
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "sticky",
"defaultValue": "false"
}
};
}
static get elementRef() { return "el"; }
}