@postnord/web-components
Version:
PostNord Web Components
120 lines (119 loc) • 4.24 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: '3bceeadfd2b66e184d7c287e0d720d8093e571fa' }, h("li", { key: '58eb5671306d42c653113838c1a1ba9c96312c2d' }, h("a", { key: '438609540a2a64ac3aabf8030b68056574e68551', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && h("pn-icon", { key: '945dd1e63943e2854290b010f088caa08f684cc4', icon: this.icon, color: "white" }), h("slot", { key: 'f3a9032f5373651349135b101a23ef2dc52a52a9' })))));
}
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,
"reflect": false,
"attribute": "value"
},
"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,
"reflect": false,
"attribute": "href"
},
"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,
"reflect": false,
"attribute": "icon"
}
};
}
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"; }
}