@postnord/web-components
Version:
PostNord Web Components
121 lines (120 loc) • 4.28 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { h, Host } from "@stencil/core";
/**
* @deprecated This component will be removed in v8. Please use the `pn-tablist` instead.
* @see {@link https://portal.postnord.com/web-components/?path=/docs/components-navigation-tablist--docs} Use `pn-tablist` instead.
*/
export class PnPageNavItem {
hostElement;
/** The item value. Used by `pn-page-nav` to determine pre-selected item. */
value;
/** Pass an href to the items if you want to have links that lead outside of your app. */
href;
/** The SVG content of the icon you want. */
icon;
/** Event is emitted when you select an item. */
itemselection;
select(e) {
if (this.value && !this.href)
e.preventDefault();
this.itemselection.emit(this.value);
}
render() {
return (h(Host, { key: '58820ffb6a1c6c5652dd723a84b85ec3b85c765e' }, h("li", { key: 'f975ad4b34a5e6c944ee6b0fec8797daa543d971' }, h("a", { key: 'c09cd1463a7b86147bb22a01830c0639010c2623', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && h("pn-icon", { key: 'ad49696a2fb32e58e720da57f1f96de3db83593d', icon: this.icon, color: "white" }), h("slot", { key: '10957dc62b2273e666a5ef2a5b03d41a160c324a' })))));
}
static get is() { return "pn-page-nav-item"; }
static get originalStyleUrls() {
return {
"$": ["pn-page-nav-item.scss"]
};
}
static get styleUrls() {
return {
"$": ["pn-page-nav-item.css"]
};
}
static get properties() {
return {
"value": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": "The item value. Used by `pn-page-nav` to determine pre-selected item."
},
"getter": false,
"setter": false,
"attribute": "value",
"reflect": false
},
"href": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Pass an href to the items if you want to have links that lead outside of your app."
},
"getter": false,
"setter": false,
"attribute": "href",
"reflect": false
},
"icon": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The SVG content of the icon you want."
},
"getter": false,
"setter": false,
"attribute": "icon",
"reflect": false
}
};
}
static get events() {
return [{
"method": "itemselection",
"name": "itemselection",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": "Event is emitted when you select an item."
},
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
}
}];
}
static get elementRef() { return "hostElement"; }
}
//# sourceMappingURL=pn-page-nav-item.js.map