@postnord/web-components
Version:
PostNord Web Components
114 lines (113 loc) • 3.95 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 {
constructor() {
this.value = undefined;
this.href = undefined;
this.icon = undefined;
}
hostElement;
/** 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: '09fd2817fa1e7fa2d8afd430385ddce493da610d' }, h("li", { key: '1392d69840c4f2c122a8282b9d06c585f15c163c' }, h("a", { key: 'ec5d7f017ad7b385ab7f8baf61b6b277a1ae04aa', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && h("pn-icon", { key: 'af7275cc72c11374f354b3801adbdd16befed340', icon: this.icon, color: "white" }), h("slot", { key: '3a2df1ae8be8e80be22d52428c5fe725d07794ac' })))));
}
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."
},
"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."
},
"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."
},
"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