UNPKG

@scania/tegel

Version:
48 lines (47 loc) 1.66 kB
import { h, Host } from "@stencil/core"; import getPreviousNestedChildOfSiblingsMatching from "../../../utils/getPreviousNestedChildOfSiblingsMatching"; import isHeadingElement from "../../../utils/isHeadingElement"; /** * @slot <default> - <b>Unnamed slot.</b> For a grid item element. */ export class TdsHeaderLauncherGrid { componentWillLoad() { const listRoot = this.host; const headingEl = getPreviousNestedChildOfSiblingsMatching(listRoot, (el) => { const e = el; return isHeadingElement(e); }); if (headingEl) { this.headingElement = headingEl; } else { console.warn('Heading element for list not found'); } } render() { var _a; const listAttributes = { 'class': 'tds-header-launcher-grid', 'role': 'list', 'aria-labelledby': (_a = this.headingElement) === null || _a === void 0 ? void 0 : _a.id, }; return (h(Host, { key: '63be73b3bef81a93dc689754e6f1ecb28d36a29b' }, h("div", Object.assign({ key: 'a5695a2b67adbc9c12165a7440091bd4cc429205' }, listAttributes), h("slot", { key: '626a95ca4adcde69296221782d35f5401d41b7aa' })))); } static get is() { return "tds-header-launcher-grid"; } static get originalStyleUrls() { return { "$": ["header-launcher-grid.scss"] }; } static get styleUrls() { return { "$": ["header-launcher-grid.css"] }; } static get states() { return { "headingElement": {} }; } static get elementRef() { return "host"; } }