@postnord/web-components
Version:
PostNord Web Components
83 lines (78 loc) • 4.47 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
import { a as arrow_right } from './arrow_right.js';
import { d as defineCustomElement$2 } from './pn-icon2.js';
const pnPageNavDropdownItemCss = "pn-page-nav-dropdown-item:first-of-type li>a,pn-page-nav-dropdown-item:first-of-type li>button{border-radius:0.5em 0.5em 0 0}pn-page-nav-dropdown-item:last-of-type li>a,pn-page-nav-dropdown-item:last-of-type li>button{border-radius:0 0 0.5em 0.5em}pn-page-nav-dropdown-item:last-of-type li>hr{display:none}pn-page-nav-dropdown-item li{font-size:inherit}pn-page-nav-dropdown-item li>*{color:#ffffff;font-size:inherit;border:none;padding:1em;margin:0;display:flex;justify-content:space-between;align-items:center;cursor:pointer;transition:background 0.15s;outline:none;width:100%;font-weight:500}pn-page-nav-dropdown-item li>*>pn-icon{margin-left:1em}pn-page-nav-dropdown-item li>*.pn-page-nav-dropdown-item-active{background:#005d92}pn-page-nav-dropdown-item li>*.pn-page-nav-dropdown-item-active:hover,pn-page-nav-dropdown-item li>*.pn-page-nav-dropdown-item-active:focus{background:#005d92}pn-page-nav-dropdown-item li>*:hover,pn-page-nav-dropdown-item li>*:focus{background:#0d234b}pn-page-nav-dropdown-item li>*:focus{box-shadow:inset 0 0 0 0.1em #005d92, inset 0 0 0 0.2em #d3cecb}pn-page-nav-dropdown-item li>a{text-decoration:none}pn-page-nav-dropdown-item li>button{background:none}pn-page-nav-dropdown-item li>hr{bottom:0;padding:0;margin:0 auto;border-top:0.0625em solid #d3cecb;opacity:0.6;width:85%}";
const PnPageNavDropdownItem$1 = /*@__PURE__*/ proxyCustomElement(class PnPageNavDropdownItem extends HTMLElement {
constructor(registerHost) {
super();
if (registerHost !== false) {
this.__registerHost();
}
this.itemselection = createEvent(this, "itemselection", 7);
}
get hostElement() { return this; }
/**
* The value that will be emitted upon selection, only pass this if the item
* is a link, if you want a button (for quick actions), omit this prop.
*/
value;
/** Pass an href to the items if you want to have links that lead outside of your app */
href;
/** Ignore this, it's internal communication with parent. @hide true */
active = false;
/** Ignore this, it's internal communication with parent */
itemselection;
select(e) {
if (this.value && !this.href)
e.preventDefault();
this.itemselection.emit(this.value);
}
setClassnames() {
let classes = 'pn-page-nav-dropdown-item ';
if (this.active)
classes += 'pn-page-nav-dropdown-item-active ';
return classes;
}
getType() {
return this.value ? null : 'button';
}
getTagName() {
return this.value ? 'a' : 'button';
}
render() {
const TagName = this.getTagName();
return (h("li", { key: 'cf2571557beb41044a92f8f84df541e13cc240e6' }, h(TagName, { key: '24acf5dbc65490f0392fccc76eb6730523d7f453', href: this.href || '#', class: this.setClassnames(), type: this.getType(), onClick: e => this.select(e), tabindex: "-1" }, h("slot", { key: '0266f363cea487e4e4dca1d04cc82ee5e6870eef' }), h("pn-icon", { key: '7b5feaf1abaaa967131f528a58537720a81da075', icon: arrow_right, color: "white" })), h("hr", { key: 'cccb66db8100d0004951ebd012f6530f3f45f10a' })));
}
static get style() { return pnPageNavDropdownItemCss; }
}, [260, "pn-page-nav-dropdown-item", {
"value": [1],
"href": [1],
"active": [4]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["pn-page-nav-dropdown-item", "pn-icon"];
components.forEach(tagName => { switch (tagName) {
case "pn-page-nav-dropdown-item":
if (!customElements.get(tagName)) {
customElements.define(tagName, PnPageNavDropdownItem$1);
}
break;
case "pn-icon":
if (!customElements.get(tagName)) {
defineCustomElement$2();
}
break;
} });
}
const PnPageNavDropdownItem = PnPageNavDropdownItem$1;
const defineCustomElement = defineCustomElement$1;
export { PnPageNavDropdownItem, defineCustomElement };
//# sourceMappingURL=pn-page-nav-dropdown-item.js.map
//# sourceMappingURL=pn-page-nav-dropdown-item.js.map