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 2.1 kB
{"version":3,"sources":["components/progress-indicator/progress-indicator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAQxE;;;GAGG;AACH,cACM,mBAAoB,SAAQ,UAAU;IAC1C;;OAEG;IAEH,QAAQ,UAAS;IAEjB,iBAAiB;IAOjB,OAAO,CAAC,iBAAiB,KAAA;IASzB,MAAM;IAMN;;OAEG;IACH,MAAM,KAAK,YAAY,WAEtB;IAED,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,mBAAmB,CAAC","file":"progress-indicator.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 { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport { forEach } from '../../globals/internal/collection-helpers';\nimport BXProgressStep from './progress-step';\nimport styles from './progress-indicator.scss';\n\nconst { prefix } = settings;\n\n/**\n * Progress indicator.\n * @element bx-progress-indicator\n */\n@customElement(`${prefix}-progress-indicator`)\nclass BXProgressIndicator extends LitElement {\n /**\n * `true` if the progress indicator should be vertical.\n */\n @property({ type: Boolean, reflect: true })\n vertical = false;\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'list');\n }\n super.connectedCallback();\n }\n\n updated(changedProperties) {\n if (changedProperties.has('vertical')) {\n // Propagate `vertical` attribute to descendants until `:host-context()` gets supported in all major browsers\n forEach(this.querySelectorAll((this.constructor as typeof BXProgressIndicator).selectorStep), item => {\n (item as BXProgressStep).vertical = this.vertical;\n });\n }\n }\n\n render() {\n return html`\n <slot></slot>\n `;\n }\n\n /**\n * A selector that will return progress steps.\n */\n static get selectorStep() {\n return `${prefix}-progress-step`;\n }\n\n static styles = styles;\n}\n\nexport default BXProgressIndicator;\n"]}