@postnord/web-components
Version:
PostNord Web Components
41 lines (35 loc) • 2.21 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-78a59ba0.js');
const pnPageNavItemCss = "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)}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}pn-page-nav-item a:focus{box-shadow:0 0 0 0.1em #d3cecb}pn-page-nav-item a>pn-icon{margin-right:0.5em}pn-page-nav-item:last-of-type{margin-right:0}";
const PnPageNavItemStyle0 = pnPageNavItemCss;
const PnPageNavItem = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.itemselection = index.createEvent(this, "itemselection", 7);
}
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: '58820ffb6a1c6c5652dd723a84b85ec3b85c765e' }, index.h("li", { key: 'f975ad4b34a5e6c944ee6b0fec8797daa543d971' }, index.h("a", { key: 'c09cd1463a7b86147bb22a01830c0639010c2623', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && index.h("pn-icon", { key: 'ad49696a2fb32e58e720da57f1f96de3db83593d', icon: this.icon, color: "white" }), index.h("slot", { key: '10957dc62b2273e666a5ef2a5b03d41a160c324a' })))));
}
};
PnPageNavItem.style = PnPageNavItemStyle0;
exports.pn_page_nav_item = PnPageNavItem;
//# sourceMappingURL=pn-page-nav-item.cjs.entry.js.map