|
| 1 | +import {property} from 'lit/decorators.js'; |
| 2 | +import {type CSSResultGroup, html, unsafeCSS} from 'lit'; |
| 3 | +import {LocalizeController} from '../../utilities/localize'; |
| 4 | +import ZincElement from '../../internal/zinc-element'; |
| 5 | + |
| 6 | +import styles from './description-item.scss'; |
| 7 | +import {classMap} from "lit/directives/class-map.js"; |
| 8 | + |
| 9 | +/** |
| 10 | + * @summary Short summary of the component's intended use. |
| 11 | + * @documentation https://zinc.style/components/description-item |
| 12 | + * @status experimental |
| 13 | + * @since 1.0 |
| 14 | + * |
| 15 | + * @dependency zn-example |
| 16 | + * |
| 17 | + * @event zn-event-name - Emitted as an example. |
| 18 | + * |
| 19 | + * @slot - The default slot. |
| 20 | + * @slot example - An example slot. |
| 21 | + * |
| 22 | + * @csspart base - The component's base wrapper. |
| 23 | + * |
| 24 | + * @cssproperty --example - An example CSS custom property. |
| 25 | + */ |
| 26 | +export default class ZnDescriptionItem extends ZincElement { |
| 27 | + static styles: CSSResultGroup = unsafeCSS(styles); |
| 28 | + |
| 29 | + // @ts-expect-error unused property |
| 30 | + private readonly localize = new LocalizeController(this); |
| 31 | + |
| 32 | + @property() label: string; |
| 33 | + |
| 34 | + connectedCallback() { |
| 35 | + super.connectedCallback(); |
| 36 | + this.setAttribute('role', 'listitem'); |
| 37 | + } |
| 38 | + |
| 39 | + render() { |
| 40 | + return html` |
| 41 | + <div class=${classMap({ |
| 42 | + 'description-item': true, |
| 43 | + })}> |
| 44 | + <div class="description-item__label">${this.label}</div> |
| 45 | + <slot></slot> |
| 46 | + </div> |
| 47 | + `; |
| 48 | + } |
| 49 | +} |
0 commit comments