UNPKG

@postnord/web-components

Version:
37 lines (32 loc) 2.2 kB
/*! * Built with Stencil * By PostNord. */ 'use strict'; var index = require('./index-CfUQZtlH.js'); const pnPageNavItemCss = () => `${index.transformTag("pn-page-nav-item")}{position:relative;color:#ffffff;margin-right:0.5em;z-index:2;white-space:nowrap;scroll-snap-align:center;outline:none;-webkit-tap-highlight-color:transparent;transform:translateZ(0)}${index.transformTag("pn-page-nav-item")} a{text-decoration:none;color:#ffffff;height:100%;width:100%;padding:0.5em;font-weight:500;border-radius:3em;border:0.0625em solid transparent;display:inline-flex;align-items:center;cursor:pointer;outline:none;transition:box-shadow 0.15s}${index.transformTag("pn-page-nav-item")} a:focus{box-shadow:0 0 0 0.1em #d3cecb}${index.transformTag("pn-page-nav-item")} a>${index.transformTag("pn-icon")}{margin-right:0.5em}${index.transformTag("pn-page-nav-item")}:last-of-type{margin-right:0}`; const PnPageNavItem = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.itemselection = index.createEvent(this, "itemselection"); } get hostElement() { return index.getElement(this); } /** 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 (index.h(index.Host, { key: '43346d6ed6211b3e6c4ee7c6dfd261112028445f' }, index.h("li", { key: '8a191825d21ae79f3c8bf69381151b8d258a7c64' }, index.h("a", { key: '3dab24d14cb027916343ae3b1f86ded224907ab6', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && index.h("pn-icon", { key: 'fa382f49cb1602908dd53af48044826f934679cd', icon: this.icon, color: "white" }), index.h("slot", { key: '576b22e87a530ac0a8a19eaf8a094937ab227b67' }))))); } }; PnPageNavItem.style = pnPageNavItemCss(); exports.pn_page_nav_item = PnPageNavItem;