{"version":3,"sources":["components/data-table/table.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC;AAI1C;;;GAGG;AACH,cACM,OAAQ,SAAQ,UAAU;IAC9B;;OAEG;IAEH,IAAI,aAAsB;IAE1B;;OAEG;IAEH,IAAI,UAAS;IAEb,iBAAiB;IAOjB,OAAO,CAAC,iBAAiB,KAAA;IASzB,MAAM;IAIN;;OAEG;IACH,MAAM,KAAK,sBAAsB,WAEhC;IAED,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,OAAO,CAAC","file":"table.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2021\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 { forEach } from '../../globals/internal/collection-helpers';\nimport { TABLE_COLOR_SCHEME, TABLE_SIZE } from './defs';\nimport styles from './data-table.scss';\n\nexport { TABLE_COLOR_SCHEME, TABLE_SIZE };\n\nconst { prefix } = settings;\n\n/**\n * Data table.\n * @element bx-table\n */\n@customElement(`${prefix}-table`)\nclass BXTable extends LitElement {\n  /**\n   * The table size.\n   */\n  @property({ reflect: true })\n  size = TABLE_SIZE.REGULAR;\n\n  /**\n   * `true` if this table should support sorting.\n   */\n  @property({ type: Boolean, reflect: true })\n  sort = false;\n\n  connectedCallback() {\n    if (!this.hasAttribute('role')) {\n      this.setAttribute('role', 'table');\n    }\n    super.connectedCallback();\n  }\n\n  updated(changedProperties) {\n    if (changedProperties.has('size')) {\n      // Propagate `size` attribute to descendants until `:host-context()` gets supported in all major browsers\n      forEach(this.querySelectorAll((this.constructor as typeof BXTable).selectorRowsWithHeader), elem => {\n        elem.setAttribute('size', this.size);\n      });\n    }\n  }\n\n  render() {\n    return html`<slot></slot>`;\n  }\n\n  /**\n   * The CSS selector to find the rows, including header rows.\n   */\n  static get selectorRowsWithHeader() {\n    return `${prefix}-table-header-row,${prefix}-table-row`;\n  }\n\n  static styles = styles;\n}\n\nexport default BXTable;\n"]}