UNPKG

dap-design-system

Version:

Official design system for the DÁP (dap.gov.hu)

64 lines (63 loc) 2.12 kB
import "../../node_modules/@lit/reactive-element/reactive-element.js"; import "../../node_modules/lit-html/lit-html.js"; import "../../node_modules/lit-element/lit-element.js"; import { property as n } from "../../node_modules/@lit/reactive-element/decorators/property.js"; import { state as p } from "../../node_modules/@lit/reactive-element/decorators/state.js"; import { html as d } from "../../node_modules/lit-html/static.js"; import { DdsElement as u } from "../../internal/dds-hu-element.js"; import h from "./command-group.scss.js"; import { unsafeCSS as v } from "../../node_modules/@lit/reactive-element/css-tag.js"; var f = Object.defineProperty, a = (m, s, l, r) => { for (var e = void 0, c = m.length - 1, o; c >= 0; c--) (o = m[c]) && (e = o(s, l, e) || e); return e && f(s, l, e), e; }; const i = class i extends u { constructor() { super(...arguments), this.exclusive = !1, this._selectedItem = null; } connectedCallback() { super.connectedCallback(), this.addEventListener( "dds-command-item-click", this._handleItemClick ); } disconnectedCallback() { super.disconnectedCallback(), this.removeEventListener( "dds-command-item-click", this._handleItemClick ); } _handleItemClick(s) { if (!this.exclusive) return; const r = s.target; r !== this._selectedItem && (this._selectedItem && this._selectedItem.removeAttribute("selected"), this._selectedItem = r, this._selectedItem.setAttribute("selected", "")); } render() { return d` <div class="command-group" part="base"> ${this.label ? d`<div class="command-group__label" part="label"> ${this.label} </div>` : ""} <div class="command-group__items" part="items"> <slot></slot> </div> </div> `; } }; i.tagName = "dap-ds-command-group", i.styles = v(h); let t = i; a([ n({ type: String }) ], t.prototype, "label"); a([ n({ type: Boolean }) ], t.prototype, "exclusive"); a([ p() ], t.prototype, "_selectedItem"); export { t as default }; //# sourceMappingURL=command-group.component.js.map