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.3 kB
{"version":3,"sources":["components/dropdown/dropdown-item.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK3C;;;GAGG;AACH,cACM,cAAe,SAAQ,UAAU;IACrC;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,WAAW,UAAS;IAEpB;;;OAGG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,IAAI,gBAAyB;IAE7B;;OAEG;IAEH,KAAK,SAAM;IAEX,MAAM;IAUN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,cAAc,CAAC","file":"dropdown-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 Checkmark16 from '@carbon/icons/lib/checkmark/16';\nimport { DROPDOWN_SIZE } from './dropdown';\nimport styles from './dropdown.scss';\n\nconst { prefix } = settings;\n\n/**\n * Dropdown item.\n * @element bx-dropdown-item\n */\n@customElement(`${prefix}-dropdown-item`)\nclass BXDropdownItem extends LitElement {\n /**\n * `true` if this dropdown item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` if this dropdown item should be highlighted.\n * If `true`, parent `<dropdown>` selects/deselects this dropdown item upon keyboard interaction.\n * @private\n */\n @property({ type: Boolean, reflect: true })\n highlighted = false;\n\n /**\n * `true` if this dropdown item should be selected.\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * Dropdown size.\n */\n @property({ reflect: true })\n size = DROPDOWN_SIZE.REGULAR;\n\n /**\n * The `value` attribute that is set to the parent `<bx-dropdown>` when this dropdown item is selected.\n */\n @property()\n value = '';\n\n render() {\n const { selected } = this;\n return html`\n <div class=\"${prefix}--list-box__menu-item__option\">\n <slot></slot>\n ${!selected ? undefined : Checkmark16({ class: `${prefix}--list-box__menu-item__selected-icon` })}\n </div>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXDropdownItem;\n"]}