import {classMap} from "lit/directives/class-map.js"; import {type CSSResultGroup, html, unsafeCSS} from 'lit'; import {property} from 'lit/decorators.js'; import ZincElement from '../../internal/zinc-element'; import styles from './alert.scss'; /** * @summary Short summary of the component's intended use. * @documentation https://zinc.style/components/alert * @status experimental * @since 1.0 * * @dependency zn-example * * @event zn-event-name - Emitted as an example. * * @slot - The default slot. * @slot example - An example slot. * * @csspart base - The component's base wrapper. * * @cssproperty --example - An example CSS custom property. */ export default class ZnAlert extends ZincElement { static styles: CSSResultGroup = unsafeCSS(styles); @property({type: String}) icon: string = ''; @property({type: String}) caption: string = ''; @property({type: Boolean}) collapse: boolean = false; @property({type: String}) level: 'primary' | 'error' | 'info' | 'success' | 'warning' | 'note' | 'cosmic' = 'info'; @property({type: String}) size: 'small' | 'medium' | 'large' = 'medium'; render() { let icon; if (this.icon) { if (this.collapse) { icon = this.icon ? html` ` : ""; } else { icon = this.icon ? html` ` : ''; } } const caption = this.caption ? html`
${this.caption}
` : ''; return html`
${icon}
${caption}
`; } public hideAlert() { this.style.display = "none"; } }