UNPKG

@postnord/web-components

Version:
120 lines (119 loc) 4.24 kB
/*! * 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: 'b4249e533daa9f96259d5379fdfcd90d87f3cc11' }, h("li", { key: '86b933f5d6b4bc827826c679a6ddf04efca08ee9' }, h("a", { key: '217797b771a53db8bbf53272eaafe816fc668ebc', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && h("pn-icon", { key: '8de359aa34e50caa65a66db5620590f24d409dae', icon: this.icon, color: "white" }), h("slot", { key: '5610d030d68f2e7f3f8eac68c02a01c3f9624f5e' }))))); } 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"; } }