UNPKG

carbon-custom-elements

Version:

A Carbon Design System variant that's as easy to use as native HTML elements, with no framework tax, no framework silo.

1 lines 1.82 kB
{"version":3,"sources":["components/structured-list/structured-list-header-row.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAKxE;;;GAGG;AACH,cACM,yBAA0B,SAAQ,UAAU;IAChD;;;OAGG;IAEH,aAAa,SAAM;IAEnB,iBAAiB;IAOjB,MAAM;IAcN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,yBAAyB,CAAC","file":"structured-list-header-row.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2020\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport styles from './structured-list.scss';\n\nconst { prefix } = settings;\n\n/**\n * Structured list header row.\n * @element bx-structured-list-header-row\n */\n@customElement(`${prefix}-structured-list-header-row`)\nclass BXStructuredListHeaderRow extends LitElement {\n /**\n * The `name` attribute for the `<input>` for selection.\n * If present, this structured list header row will show its selectable version of the UI.\n */\n @property({ attribute: 'selection-name' })\n selectionName = '';\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'row');\n }\n super.connectedCallback();\n }\n\n render() {\n // We could look up in DOM for `bx-structured-list[hasSelection]`,\n // but uses `hasSelection` prop to utilize attribute change callback\n if (this.selectionName) {\n return html`\n <slot></slot>\n <div class=\"${prefix}--structured-list-th\"></div>\n `;\n }\n return html`\n <slot></slot>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXStructuredListHeaderRow;\n"]}