UNPKG

@patternfly/elements

Version:
1 lines 1.86 kB
{"version":3,"file":"pf-thead.js","sourceRoot":"","sources":["pf-thead.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;;;AAG7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOhC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;;QAGwC,iBAAY,GAAG,WAAW,CAAC;;IAExE,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;0BACW,uBAAA,IAAI,iDAAc;KACvC,CAAC;IACJ,CAAC;;;;IAGC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACzD,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAnBe,cAAM,GAAoB,CAAC,MAAM,CAAC,AAA5B,CAA6B;;AAEN;IAA5C,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;6CAAoC;AAH7D,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO","sourcesContent":["import { LitElement, html, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport { thRoleContext } from './context.js';\n\nimport styles from './pf-thead.css';\nimport { provide } from '@lit/context';\n\n/**\n * Table head\n * @slot - Place element content here\n */\n@customElement('pf-thead')\nexport class PfThead extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n @provide({ context: thRoleContext }) private thRowContext = 'colheader';\n\n connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'rowgroup');\n }\n\n render(): TemplateResult<1> {\n return html`\n <slot @slotchange=${this.#onSlotchange}></slot>\n `;\n }\n\n #onSlotchange() {\n for (const th of this.querySelectorAll(':scope > pf-th')) {\n th.setAttribute('role', 'columnheader');\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-thead': PfThead;\n }\n}\n"]}