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.61 kB
Source Map (JSON)
{"version":3,"sources":["components/overflow-menu/overflow-menu-item.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMxE;;;GAGG;AACH,cACM,kBAAmB,SAAQ,uBAAsB;IACrD;;OAEG;IAEH,MAAM,UAAS;IAEf;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,IAAI,SAAM;IAEV,gBAAgB;IAIhB,iBAAiB;IAOjB,MAAM;IAkBN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,kBAAkB,CAAC","file":"overflow-menu-item.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 FocusMixin from '../../globals/mixins/focus';\nimport styles from './overflow-menu.scss';\n\nconst { prefix } = settings;\n\n/**\n * Overflow menu item.\n * @element bx-overflow-menu-item\n */\n@customElement(`${prefix}-overflow-menu-item`)\nclass BXOverflowMenuItem extends FocusMixin(LitElement) {\n /**\n * `true` if the action is danger.\n */\n @property({ type: Boolean, reflect: true })\n danger = false;\n\n /**\n * `true` if the overflow menu item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The link href of the overflow menu item.\n */\n @property()\n href = '';\n\n createRenderRoot() {\n return this.attachShadow({ mode: 'open', delegatesFocus: true });\n }\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'menuitem');\n }\n super.connectedCallback();\n }\n\n render() {\n return this.href\n ? html`\n <a\n class=\"${prefix}--overflow-menu-options__btn\"\n ?disabled=${this.disabled}\n href=\"${this.href}\"\n tabindex=\"${this.disabled ? -1 : 0}\"\n ><slot></slot\n ></a>\n `\n : html`\n <button class=\"${prefix}--overflow-menu-options__btn\" ?disabled=${this.disabled} tabindex=\"${this.disabled ? -1 : 0}\">\n <slot></slot>\n </button>\n `;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXOverflowMenuItem;\n"]}