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.19 kB
{"version":3,"sources":["components/tile/clickable-tile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMvE;;;GAGG;AACH,cACM,eAAgB,SAAQ,oBAAsB;IAClD;;OAEG;IAEH,WAAW,4BAAqC;IAEhD;;OAEG;IAEH,IAAI,SAAM;IAEV,gBAAgB;IAIhB,MAAM;IAeN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,eAAe,CAAC","file":"clickable-tile.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 { classMap } from 'lit-html/directives/class-map';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport { FORM_ELEMENT_COLOR_SCHEME } from '../../globals/shared-enums';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './tile.scss';\n\nconst { prefix } = settings;\n\n/**\n * Clickable tile.\n * @element bx-clickable-tile\n */\n@customElement(`${prefix}-clickable-tile`)\nclass BXClickableTile extends FocusMixin(LitElement) {\n /**\n * The color scheme.\n */\n @property({ attribute: 'color-scheme', reflect: true })\n colorScheme = FORM_ELEMENT_COLOR_SCHEME.REGULAR;\n\n /**\n * Link `href`.\n */\n @property()\n href = '';\n\n createRenderRoot() {\n return this.attachShadow({ mode: 'open', delegatesFocus: true });\n }\n\n render() {\n const { colorScheme, href } = this;\n const classes = classMap({\n [`${prefix}--link`]: true,\n [`${prefix}--tile`]: true,\n [`${prefix}--tile--clickable`]: true,\n [`${prefix}--tile--${colorScheme}`]: colorScheme,\n });\n return html`\n <a class=\"${classes}\" href=\"${href}\">\n <slot></slot>\n </a>\n `;\n }\n\n static styles = styles;\n}\n\nexport default BXClickableTile;\n"]}