UNPKG

@postnord/web-components

Version:
35 lines (31 loc) 2.19 kB
/*! * Built with Stencil * By PostNord. */ import { t as transformTag, r as registerInstance, c as createEvent, g as getElement, h, a as Host } from './index-XKg-ydzH.js'; const pnPageNavItemCss = () => `${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)}${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}${transformTag("pn-page-nav-item")} a:focus{box-shadow:0 0 0 0.1em #d3cecb}${transformTag("pn-page-nav-item")} a>${transformTag("pn-icon")}{margin-right:0.5em}${transformTag("pn-page-nav-item")}:last-of-type{margin-right:0}`; const PnPageNavItem = class { constructor(hostRef) { registerInstance(this, hostRef); this.itemselection = createEvent(this, "itemselection", 7); } get hostElement() { return 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 (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' }))))); } }; PnPageNavItem.style = pnPageNavItemCss(); export { PnPageNavItem as pn_page_nav_item };