@postnord/web-components
Version:
PostNord Web Components
66 lines (61 loc) • 3.07 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { d as defineCustomElement$2 } from './pn-icon2.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 PnPageNavItem$1 = /*@__PURE__*/ proxyCustomElement(class PnPageNavItem extends HTMLElement {
constructor(registerHost) {
super();
if (registerHost !== false) {
this.__registerHost();
}
this.itemselection = createEvent(this, "itemselection", 7);
}
get hostElement() { return 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: 'dc31607344bf00dc0e0c57ebe30a764988b779cf' }, h("li", { key: '2db91112fbba754285f3518c270704ed5fd92927' }, h("a", { key: '4b92fb84dddf4efda593f1595dce4df3284756ed', href: this.href || '#', class: "pn-page-nav-item", onClick: e => this.select(e) }, this.icon && h("pn-icon", { key: '0effe3b19480a7a6a06ce60b7e24b4acf8ba0ba6', icon: this.icon, color: "white" }), h("slot", { key: '6d237a63497c7deea8ac23cde2e51ce2cbe69bfc' })))));
}
static get style() { return pnPageNavItemCss; }
}, [260, "pn-page-nav-item", {
"value": [1],
"href": [1],
"icon": [1]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["pn-page-nav-item", "pn-icon"];
components.forEach(tagName => { switch (tagName) {
case "pn-page-nav-item":
if (!customElements.get(tagName)) {
customElements.define(tagName, PnPageNavItem$1);
}
break;
case "pn-icon":
if (!customElements.get(tagName)) {
defineCustomElement$2();
}
break;
} });
}
const PnPageNavItem = PnPageNavItem$1;
const defineCustomElement = defineCustomElement$1;
export { PnPageNavItem, defineCustomElement };
//# sourceMappingURL=pn-page-nav-item.js.map
//# sourceMappingURL=pn-page-nav-item.js.map