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.29 kB
Source Map (JSON)
{"version":3,"sources":["components/overflow-menu/overflow-menu-body.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,cAAc,EAAE,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAKlH;;;GAGG;AACH,cACM,kBAAmB,SAAQ,cAAc;IAC7C;;OAEG;IAEH,SAAS,0BAAiC;IAE1C;;OAEG;IAEH,WAAW,4BAAqC;IAEhD;;OAEG;IAEH,SAAS,0BAAkC;IAE3C;;;OAGG;IAEH,IAAI,UAAS;IAEb,iBAAiB;IAWjB,MAAM;IAMN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,kBAAkB,CAAC","file":"overflow-menu-body.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 } from 'lit-element';\nimport { FORM_ELEMENT_COLOR_SCHEME } from '../../globals/shared-enums';\nimport BXFloatingMenu, { FLOATING_MENU_ALIGNMENT, FLOATING_MENU_DIRECTION } from '../floating-menu/floating-menu';\nimport styles from './overflow-menu.scss';\n\nconst { prefix } = settings;\n\n/**\n * Overflow menu body.\n * @element bx-overflow-menu-body\n */\n@customElement(`${prefix}-overflow-menu-body`)\nclass BXOverflowMenuBody extends BXFloatingMenu {\n /**\n * How the menu is aligned to the trigger button.\n */\n @property()\n alignment = FLOATING_MENU_ALIGNMENT.START;\n\n /**\n * The color scheme.\n */\n @property({ attribute: 'color-scheme', reflect: true })\n colorScheme = FORM_ELEMENT_COLOR_SCHEME.REGULAR;\n\n /**\n * The menu direction.\n */\n @property()\n direction = FLOATING_MENU_DIRECTION.BOTTOM;\n\n /**\n * `true` if the menu should be open.\n * @private\n */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n connectedCallback() {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'menu');\n }\n if (!this.hasAttribute('tabindex')) {\n // TODO: Should we use a property?\n this.setAttribute('tabindex', '-1');\n }\n super.connectedCallback();\n }\n\n render() {\n return html`\n <slot></slot>\n `;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXOverflowMenuBody;\n"]}