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.63 kB
Source Map (JSON)
{"version":3,"sources":["components/modal/modal-close-button.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAuB,UAAU,EAAE,MAAM,aAAa,CAAC;AAO9D;;;GAGG;AACH,cACM,kBAAmB,SAAQ,UAAU;IACzC,gBAAgB;IAIhB,MAAM;IAUN,iBAAiB;IAUjB,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,kBAAkB,CAAC","file":"modal-close-button.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, customElement, LitElement } from 'lit-element';\nimport Close20 from '@carbon/icons/lib/close/20';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './modal.scss';\n\nconst { prefix } = settings;\n\n/**\n * Modal close button.\n * @element bx-modal-close-button\n */\n@customElement(`${prefix}-modal-close-button`)\nclass BXModalCloseButton extends LitElement {\n createRenderRoot() {\n return this.attachShadow({ mode: 'open', delegatesFocus: true });\n }\n\n render() {\n return html`\n <button class=\"${prefix}--modal-close\">\n ${Close20({\n class: `${prefix}--modal-close__icon`,\n })}\n </button>\n `;\n }\n\n connectedCallback() {\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n super.connectedCallback();\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXModalCloseButton;\n"]}