UNPKG

@scania/tegel

Version:
1 lines 2.08 kB
import{t,p as s,H as e,h as i,a as o}from"./index.js";import{g as n,i as a}from"./p-CuIyaNyT.js";const d=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.slotListeners=new Map,this.size="md"}componentWillLoad(){var t,s;const{children:e}=this.host;for(let t=0;t<e.length;t++){const s=e[t];"size"in s&&(s.size=this.size)}let i=this.host;"tds-header-launcher-list"===(null===(s=null===(t=this.host)||void 0===t?void 0:t.parentElement)||void 0===s?void 0:s.tagName.toLowerCase())&&(i=this.host.parentElement);const o=n(i,a);o?this.headingElement=o:console.warn("Heading element for list not found")}componentDidLoad(){var t;null===(t=this.host.shadowRoot)||void 0===t||t.querySelectorAll("slot").forEach((t=>{const s=t=>{this.processAssignedElements(t.target)};t.addEventListener("slotchange",s),s({target:t}),this.slotListeners.set(t,s)}))}processAssignedElements(t){t.assignedElements().forEach((t=>{"li"!==t.tagName.toLowerCase()&&"slot"!==t.tagName.toLowerCase()&&"listitem"!==t.getAttribute("role")&&t.setAttribute("role","listitem"),"slot"===t.tagName.toLowerCase()&&this.processAssignedElements(t)}))}disconnectedCallback(){this.slotListeners.forEach(((t,s)=>{s.removeEventListener("slotchange",t),this.slotListeners.delete(s)}))}render(){var t;const s={role:"list","aria-labelledby":null===(t=this.headingElement)||void 0===t?void 0:t.id};return i(o,Object.assign({key:"87736a915ab274f1fcd30e6eb3ac2b594c323ba9"},s),i("slot",{key:"61a2332a3da99fa2b0fa51a54547e9d5b66fa804"}))}get host(){return this}static get style(){return":host{display:block;width:190px;padding:0;margin:0;list-style:none;border-radius:unset;background-color:var(--tds-header-app-launcher-menu-bg)}@media all and (max-width: 384px){:host{width:100vw}}:host([size=lg]){width:320px}"}},[257,"tds-header-dropdown-list",{size:[513],headingElement:[32]}]);function l(){"undefined"!=typeof customElements&&["tds-header-dropdown-list"].forEach((s=>{"tds-header-dropdown-list"===s&&(customElements.get(t(s))||customElements.define(t(s),d))}))}l();export{d as T,l as d}