@mhmo91/schmancy 0.5.10 → 0.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{avatar-CWqrPcmt.js → avatar-BrNa1pz6.js} +2 -2
- package/dist/{avatar-CWqrPcmt.js.map → avatar-BrNa1pz6.js.map} +1 -1
- package/dist/{avatar-DoxGzRgy.cjs → avatar-Lcb94SrU.cjs} +2 -2
- package/dist/{avatar-DoxGzRgy.cjs.map → avatar-Lcb94SrU.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{option-Dolb8CBn.cjs → option-CLHsQQRu.cjs} +4 -4
- package/dist/option-CLHsQQRu.cjs.map +1 -0
- package/dist/{option-BPPKtXwf.js → option-MTri6AjG.js} +12 -11
- package/dist/option-MTri6AjG.js.map +1 -0
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/option/option.d.ts +0 -2
- package/dist/option-BPPKtXwf.js.map +0 -1
- package/dist/option-Dolb8CBn.cjs.map +0 -1
package/dist/nav-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const i=require("lit/decorators.js"),d=require("./tailwind.mixin-BvVlz7hG.cjs"),a=require("lit");var u=Object.defineProperty,y=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";const l=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const i=require("lit/decorators.js"),d=require("./tailwind.mixin-BvVlz7hG.cjs"),a=require("lit");var u=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(e,n,p,r)=>{for(var c,s=r>1?void 0:r?y(n,p):n,h=e.length-1;h>=0;h--)(c=e[h])&&(s=(r?c(n,p,s):c(s))||s);return r&&s&&u(n,p,s),s};let t=class extends d.TailwindElement(a.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
cursor: pointer;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
opacity: 0.5;
|
|
20
20
|
pointer-events: none;
|
|
21
21
|
}
|
|
22
|
-
`){constructor(){super(...arguments),this.value="",this.label="",this.selected=!1,this.disabled=!1,this.group="",this.icon=""}connectedCallback(){super.connectedCallback(),this.id||(this.id=`schmancy-option-${Math.random().toString(36).substring(2,9)}`),this.label||(this.label=this.textContent?.trim()||this.value),!this.value&&this.textContent&&(this.value=this.textContent.trim()),l.fromEvent(this,"click").pipe(l.takeUntil(this.disconnecting)).subscribe(this.
|
|
22
|
+
`){constructor(){super(...arguments),this.value="",this.label="",this.selected=!1,this.disabled=!1,this.group="",this.icon=""}connectedCallback(){super.connectedCallback(),this.id||(this.id=`schmancy-option-${Math.random().toString(36).substring(2,9)}`),this.label||(this.label=this.textContent?.trim()||this.value),!this.value&&this.textContent&&(this.value=this.textContent.trim()),l.fromEvent(this,"click").pipe(l.takeUntil(this.disconnecting)).subscribe(e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new CustomEvent("option-select",{bubbles:!0,composed:!0,detail:{value:this.value}}))}),l.fromEvent(this,"keydown").pipe(l.takeUntil(this.disconnecting)).subscribe(e=>{if(e.key===" "||e.key==="Enter"){if(e.preventDefault(),e.stopPropagation(),this.disabled)return;this.dispatchEvent(new CustomEvent("option-select",{bubbles:!0,composed:!0,detail:{value:this.value}}))}})}disconnectedCallback(){super.disconnectedCallback()}render(){const e={"py-2":!0,"px-3":!0,rounded:!0,"text-sm":!0,"w-full":!0,flex:!0,"items-center":!0,"gap-2":!0,"bg-primary-container":this.selected,"text-primary-onContainer":this.selected,"hover:bg-surface-high":!this.selected,"focus:outline-none":!0};return a.html`
|
|
23
23
|
<div class=${this.classMap(e)} role="option" aria-selected=${this.selected} aria-disabled=${this.disabled}>
|
|
24
24
|
${this.icon?a.html`<span class="icon">${this.icon}</span>`:""}
|
|
25
25
|
<span class="flex-1">${this.label||this.value}</span>
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
</span>
|
|
41
41
|
`:""}
|
|
42
42
|
</div>
|
|
43
|
-
`}};
|
|
44
|
-
//# sourceMappingURL=option-
|
|
43
|
+
`}};o([i.property({type:String})],t.prototype,"value",2),o([i.property({type:String})],t.prototype,"label",2),o([i.property({type:Boolean,reflect:!0})],t.prototype,"selected",2),o([i.property({type:Boolean,reflect:!0})],t.prototype,"disabled",2),o([i.property({type:String})],t.prototype,"group",2),o([i.property({type:String})],t.prototype,"icon",2),t=o([i.customElement("schmancy-option")],t);
|
|
44
|
+
//# sourceMappingURL=option-CLHsQQRu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-CLHsQQRu.cjs","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { fromEvent, takeUntil } from 'rxjs'\n\n/**\n * `schmancy-option` is an option element for schmancy-select and schmancy-autocomplete components.\n *\n * @fires click - When the option is clicked\n */\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\toutline: none;\n\t}\n\n\t:host(:focus-visible) {\n\t\toutline: 2px solid var(--schmancy-sys-color-primary-default);\n\t\toutline-offset: -2px;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([disabled]) {\n\t\topacity: 0.5;\n\t\tpointer-events: none;\n\t}\n`) {\n\t/**\n\t * The value of the option, will be used when selected.\n\t */\n\t@property({ type: String })\n\tvalue: string = ''\n\n\t/**\n\t * The human-readable label for the option.\n\t */\n\t@property({ type: String })\n\tlabel: string = ''\n\n\t/**\n\t * Whether the option is currently selected.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tselected: boolean = false\n\n\t/**\n\t * Whether the option is disabled.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled: boolean = false\n\n\t/**\n\t * Optional group this option belongs to (for option grouping).\n\t */\n\t@property({ type: String })\n\tgroup: string = ''\n\n\t/**\n\t * Optional icon or image to display before the label.\n\t */\n\t@property({ type: String })\n\ticon: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Ensure the option has an ID for accessibility\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`\n\t\t}\n\n\t\t// If no label was provided, use the text content or value\n\t\tif (!this.label) {\n\t\t\tthis.label = this.textContent?.trim() || this.value\n\t\t}\n\n\t\t// If value wasn't set but there's text content, use that as the value\n\t\tif (!this.value && this.textContent) {\n\t\t\tthis.value = this.textContent.trim()\n\t\t}\n\n\t\t// Make the option clickable\n\t\tfromEvent<MouseEvent>(this, 'click')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe((e) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tif (this.disabled) return\n\t\t\t\t// Dispatch a custom event with this option's value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent('option-select', {\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\tdetail: { value: this.value },\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\tfromEvent<KeyboardEvent>(this, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe((e) => {\n\t\t\t\t// Handle space and enter as clicks\n\t\t\t\tif (e.key === ' ' || e.key === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\tif (this.disabled) return\n\t\t\t\t\t// Dispatch a custom event with this option's value\n\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent('option-select', {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\tdetail: { value: this.value },\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\tdisconnectedCallback() {\n\t\t// Event listeners are automatically cleaned up via takeUntil(this.disconnecting)\n\t\tsuper.disconnectedCallback()\n\t}\n\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'py-2': true,\n\t\t\t'px-3': true,\n\t\t\trounded: true,\n\t\t\t'text-sm': true,\n\t\t\t'w-full': true,\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'gap-2': true,\n\t\t\t// Selected state\n\t\t\t'bg-primary-container': this.selected,\n\t\t\t'text-primary-onContainer': this.selected,\n\t\t\t// Hover state (when not selected)\n\t\t\t'hover:bg-surface-high': !this.selected,\n\t\t\t// Focus state\n\t\t\t'focus:outline-none': true,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} role=\"option\" aria-selected=${this.selected} aria-disabled=${this.disabled}>\n\t\t\t\t${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : ''}\n\t\t\t\t<span class=\"flex-1\">${this.label || this.value}</span>\n\t\t\t\t${this.selected\n\t\t\t\t\t? html`\n\t\t\t\t\t\t\t<span class=\"check\">\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<polyline points=\"20 6 9 17 4 12\"></polyline>\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t`\n\t\t\t\t\t: ''}\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","css","super","arguments","this","value","label","selected","disabled","group","icon","connectedCallback","id","Math","random","toString","substring","textContent","trim","fromEvent","pipe","takeUntil","disconnecting","subscribe","e","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","detail","key","preventDefault","disconnectedCallback","render","classes","rounded","flex","html","classMap","__decorateClass","property","type","String","prototype","Boolean","reflect","customElement"],"mappings":"oZAWA,IAAqBA,EAArB,cAA4CC,EAAAA,gBAAgBC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA5D,CAAA,CAAA,cAAAC,MAAAA,GAAAC,SAAAA,EA0BCC,KAAAC,MAAgB,GAMhBD,KAAAE,MAAgB,GAMhBF,KAAAG,YAMAH,KAAAI,YAMAJ,KAAAK,MAAgB,GAMhBL,KAAAM,KAAe,EAAA,CAEf,mBAAAC,CACCT,MAAMS,kBAAAA,EAGDP,KAAKQ,KACTR,KAAKQ,GAAK,mBAAmBC,KAAKC,SAASC,SAAS,EAAA,EAAIC,UAAU,EAAG,CAAA,CAAA,IAIjEZ,KAAKE,QACTF,KAAKE,MAAQF,KAAKa,aAAaC,KAAAA,GAAUd,KAAKC,OAAAA,CAI1CD,KAAKC,OAASD,KAAKa,cACvBb,KAAKC,MAAQD,KAAKa,YAAYC,KAAAA,GAI/BC,EAAAA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;AAAAA;AAAAA;AAAAA;AAAAA,QAgBA,EAAA;AAAA;AAAA,GAGN,CAAA,EAvIAE,EAAA,CADCC,WAAS,CAAEC,KAAMC,MAAAA,CAAAA,CAAAA,EAzBE5C,EA0BpB6C,UAAA,QAAA,CAAA,EAMAJ,EAAA,CADCC,WAAS,CAAEC,KAAMC,MAAAA,CAAAA,CAAAA,EA/BE5C,EAgCpB6C,UAAA,QAAA,CAAA,EAMAJ,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAMG,QAASC,UAAS,CAAA,CAAA,EArChB/C,EAsCpB6C,UAAA,WAAA,GAMAJ,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAMG,QAASC,QAAAA,EAAS,CAAA,CAAA,EA3ChB/C,EA4CpB6C,UAAA,WAAA,CAAA,EAMAJ,EAAA,CADCC,WAAS,CAAEC,KAAMC,UAjDE5C,EAkDpB6C,UAAA,QAAA,CAAA,EAMAJ,EAAA,CADCC,WAAS,CAAEC,KAAMC,MAAAA,CAAAA,CAAAA,EAvDE5C,EAwDpB6C,UAAA,OAAA,GAxDoB7C,EAArByC,EAAA,CADCO,EAAAA,cAAc,iBAAA,CAAA,EACMhD,CAAAA"}
|
|
@@ -2,13 +2,13 @@ import { fromEvent as h, takeUntil as d } from "rxjs";
|
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
4
|
import { property as o, customElement as u } from "lit/decorators.js";
|
|
5
|
-
import { T as
|
|
6
|
-
import { css as
|
|
5
|
+
import { T as b } from "./tailwind.mixin-R2xLfpws.js";
|
|
6
|
+
import { css as y, html as p } from "lit";
|
|
7
7
|
var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (e, n, r, l) => {
|
|
8
8
|
for (var a, s = l > 1 ? void 0 : l ? v(n, r) : n, c = e.length - 1; c >= 0; c--) (a = e[c]) && (s = (l ? a(n, r, s) : a(s)) || s);
|
|
9
9
|
return l && s && m(n, r, s), s;
|
|
10
10
|
};
|
|
11
|
-
let t = class extends y
|
|
11
|
+
let t = class extends b(y`
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
cursor: pointer;
|
|
@@ -34,17 +34,18 @@ let t = class extends y(b`
|
|
|
34
34
|
super(...arguments), this.value = "", this.label = "", this.selected = !1, this.disabled = !1, this.group = "", this.icon = "";
|
|
35
35
|
}
|
|
36
36
|
connectedCallback() {
|
|
37
|
-
super.connectedCallback(), this.id || (this.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`), this.label || (this.label = this.textContent?.trim() || this.value), !this.value && this.textContent && (this.value = this.textContent.trim()), h(this, "click").pipe(d(this.disconnecting)).subscribe(
|
|
37
|
+
super.connectedCallback(), this.id || (this.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`), this.label || (this.label = this.textContent?.trim() || this.value), !this.value && this.textContent && (this.value = this.textContent.trim()), h(this, "click").pipe(d(this.disconnecting)).subscribe((e) => {
|
|
38
|
+
e.stopPropagation(), this.disabled || this.dispatchEvent(new CustomEvent("option-select", { bubbles: !0, composed: !0, detail: { value: this.value } }));
|
|
39
|
+
}), h(this, "keydown").pipe(d(this.disconnecting)).subscribe((e) => {
|
|
40
|
+
if (e.key === " " || e.key === "Enter") {
|
|
41
|
+
if (e.preventDefault(), e.stopPropagation(), this.disabled) return;
|
|
42
|
+
this.dispatchEvent(new CustomEvent("option-select", { bubbles: !0, composed: !0, detail: { value: this.value } }));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
38
45
|
}
|
|
39
46
|
disconnectedCallback() {
|
|
40
47
|
super.disconnectedCallback();
|
|
41
48
|
}
|
|
42
|
-
handleClick(e) {
|
|
43
|
-
e.stopPropagation(), this.disabled || this.dispatchEvent(new CustomEvent("option-select", { bubbles: !0, composed: !0, detail: { value: this.value } }));
|
|
44
|
-
}
|
|
45
|
-
handleKeyDown(e) {
|
|
46
|
-
e.key !== " " && e.key !== "Enter" || (e.preventDefault(), this.handleClick(e));
|
|
47
|
-
}
|
|
48
49
|
render() {
|
|
49
50
|
const e = { "py-2": !0, "px-3": !0, rounded: !0, "text-sm": !0, "w-full": !0, flex: !0, "items-center": !0, "gap-2": !0, "bg-primary-container": this.selected, "text-primary-onContainer": this.selected, "hover:bg-surface-high": !this.selected, "focus:outline-none": !0 };
|
|
50
51
|
return p`
|
|
@@ -72,4 +73,4 @@ let t = class extends y(b`
|
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
i([o({ type: String })], t.prototype, "value", 2), i([o({ type: String })], t.prototype, "label", 2), i([o({ type: Boolean, reflect: !0 })], t.prototype, "selected", 2), i([o({ type: Boolean, reflect: !0 })], t.prototype, "disabled", 2), i([o({ type: String })], t.prototype, "group", 2), i([o({ type: String })], t.prototype, "icon", 2), t = i([u("schmancy-option")], t);
|
|
75
|
-
//# sourceMappingURL=option-
|
|
76
|
+
//# sourceMappingURL=option-MTri6AjG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-MTri6AjG.js","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { fromEvent, takeUntil } from 'rxjs'\n\n/**\n * `schmancy-option` is an option element for schmancy-select and schmancy-autocomplete components.\n *\n * @fires click - When the option is clicked\n */\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\toutline: none;\n\t}\n\n\t:host(:focus-visible) {\n\t\toutline: 2px solid var(--schmancy-sys-color-primary-default);\n\t\toutline-offset: -2px;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([disabled]) {\n\t\topacity: 0.5;\n\t\tpointer-events: none;\n\t}\n`) {\n\t/**\n\t * The value of the option, will be used when selected.\n\t */\n\t@property({ type: String })\n\tvalue: string = ''\n\n\t/**\n\t * The human-readable label for the option.\n\t */\n\t@property({ type: String })\n\tlabel: string = ''\n\n\t/**\n\t * Whether the option is currently selected.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tselected: boolean = false\n\n\t/**\n\t * Whether the option is disabled.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled: boolean = false\n\n\t/**\n\t * Optional group this option belongs to (for option grouping).\n\t */\n\t@property({ type: String })\n\tgroup: string = ''\n\n\t/**\n\t * Optional icon or image to display before the label.\n\t */\n\t@property({ type: String })\n\ticon: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Ensure the option has an ID for accessibility\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`\n\t\t}\n\n\t\t// If no label was provided, use the text content or value\n\t\tif (!this.label) {\n\t\t\tthis.label = this.textContent?.trim() || this.value\n\t\t}\n\n\t\t// If value wasn't set but there's text content, use that as the value\n\t\tif (!this.value && this.textContent) {\n\t\t\tthis.value = this.textContent.trim()\n\t\t}\n\n\t\t// Make the option clickable\n\t\tfromEvent<MouseEvent>(this, 'click')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe((e) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tif (this.disabled) return\n\t\t\t\t// Dispatch a custom event with this option's value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent('option-select', {\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\tdetail: { value: this.value },\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\tfromEvent<KeyboardEvent>(this, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe((e) => {\n\t\t\t\t// Handle space and enter as clicks\n\t\t\t\tif (e.key === ' ' || e.key === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\tif (this.disabled) return\n\t\t\t\t\t// Dispatch a custom event with this option's value\n\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent('option-select', {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\tdetail: { value: this.value },\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\tdisconnectedCallback() {\n\t\t// Event listeners are automatically cleaned up via takeUntil(this.disconnecting)\n\t\tsuper.disconnectedCallback()\n\t}\n\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'py-2': true,\n\t\t\t'px-3': true,\n\t\t\trounded: true,\n\t\t\t'text-sm': true,\n\t\t\t'w-full': true,\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'gap-2': true,\n\t\t\t// Selected state\n\t\t\t'bg-primary-container': this.selected,\n\t\t\t'text-primary-onContainer': this.selected,\n\t\t\t// Hover state (when not selected)\n\t\t\t'hover:bg-surface-high': !this.selected,\n\t\t\t// Focus state\n\t\t\t'focus:outline-none': true,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} role=\"option\" aria-selected=${this.selected} aria-disabled=${this.disabled}>\n\t\t\t\t${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : ''}\n\t\t\t\t<span class=\"flex-1\">${this.label || this.value}</span>\n\t\t\t\t${this.selected\n\t\t\t\t\t? html`\n\t\t\t\t\t\t\t<span class=\"check\">\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<polyline points=\"20 6 9 17 4 12\"></polyline>\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t`\n\t\t\t\t\t: ''}\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","css","super","arguments","this","value","label","selected","disabled","group","icon","connectedCallback","id","Math","random","toString","substring","textContent","trim","fromEvent","pipe","takeUntil","disconnecting","subscribe","e","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","detail","key","preventDefault","disconnectedCallback","render","classes","rounded","flex","html","classMap","__decorateClass","property","type","String","prototype","Boolean","reflect","customElement"],"mappings":";;;;;;;;;;AAWA,IAAqBA,IAArB,cAA4CC,EAAgBC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA5D,EAAA;AAAA,EAAA;AAAAC,UAAAA,GAAAC,SAAAA,GA0BCC,KAAAC,QAAgB,IAMhBD,KAAAE,QAAgB,IAMhBF,KAAAG,eAMAH,KAAAI,eAMAJ,KAAAK,QAAgB,IAMhBL,KAAAM,OAAe;AAAA,EAAA;AAAA,EAEf,oBAAAC;AACCT,UAAMS,kBAAAA,GAGDP,KAAKQ,OACTR,KAAKQ,KAAK,mBAAmBC,KAAKC,OAAAA,EAASC,SAAS,IAAIC,UAAU,GAAG,OAIjEZ,KAAKE,UACTF,KAAKE,QAAQF,KAAKa,aAAaC,KAAAA,KAAUd,KAAKC,QAAAA,CAI1CD,KAAKC,SAASD,KAAKa,gBACvBb,KAAKC,QAAQD,KAAKa,YAAYC,SAI/BC,EAAsBf,MAAM,SAC1BgB,KAAK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AAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,UAgBA,EAAA;AAAA;AAAA;AAAA,EAGN;AAAA;AAvIAE,EAAA,CADCC,EAAS,EAAEC,MAAMC,OAAAA,CAAAA,CAAAA,GAzBE5C,EA0BpB6C,WAAA,SAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMC,OAAAA,CAAAA,CAAAA,GA/BE5C,EAgCpB6C,WAAA,SAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMG,SAASC,SAAAA,GAAS,CAAA,CAAA,GArChB/C,EAsCpB6C,WAAA,YAAA,IAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMG,SAASC,SAAAA,GAAS,CAAA,CAAA,GA3ChB/C,EA4CpB6C,WAAA,YAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMC,YAjDE5C,EAkDpB6C,WAAA,SAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMC,OAAAA,CAAAA,CAAAA,GAvDE5C,EAwDpB6C,WAAA,QAAA,CAAA,GAxDoB7C,IAArByC,EAAA,CADCO,EAAc,iBAAA,CAAA,GACMhD,CAAAA;"}
|
package/dist/option.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./option-
|
|
1
|
+
"use strict";require("./option-CLHsQQRu.cjs");
|
|
2
2
|
//# sourceMappingURL=option.cjs.map
|
package/dist/option.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./option-
|
|
1
|
+
import "./option-MTri6AjG.js";
|
|
2
2
|
//# sourceMappingURL=option.js.map
|
package/dist/teleport.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-Lcb94SrU.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
|
|
2
2
|
//# sourceMappingURL=teleport.cjs.map
|
package/dist/teleport.js
CHANGED
package/package.json
CHANGED
|
@@ -31,8 +31,6 @@ export default class SchmancyOption extends SchmancyOption_base {
|
|
|
31
31
|
icon: string;
|
|
32
32
|
connectedCallback(): void;
|
|
33
33
|
disconnectedCallback(): void;
|
|
34
|
-
private handleClick;
|
|
35
|
-
private handleKeyDown;
|
|
36
34
|
render(): import("lit-html").TemplateResult<1>;
|
|
37
35
|
}
|
|
38
36
|
declare global {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option-BPPKtXwf.js","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { fromEvent, takeUntil } from 'rxjs'\n\n/**\n * `schmancy-option` is an option element for schmancy-select and schmancy-autocomplete components.\n *\n * @fires click - When the option is clicked\n */\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\toutline: none;\n\t}\n\n\t:host(:focus-visible) {\n\t\toutline: 2px solid var(--schmancy-sys-color-primary-default);\n\t\toutline-offset: -2px;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([disabled]) {\n\t\topacity: 0.5;\n\t\tpointer-events: none;\n\t}\n`) {\n\t/**\n\t * The value of the option, will be used when selected.\n\t */\n\t@property({ type: String })\n\tvalue: string = ''\n\n\t/**\n\t * The human-readable label for the option.\n\t */\n\t@property({ type: String })\n\tlabel: string = ''\n\n\t/**\n\t * Whether the option is currently selected.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tselected: boolean = false\n\n\t/**\n\t * Whether the option is disabled.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled: boolean = false\n\n\t/**\n\t * Optional group this option belongs to (for option grouping).\n\t */\n\t@property({ type: String })\n\tgroup: string = ''\n\n\t/**\n\t * Optional icon or image to display before the label.\n\t */\n\t@property({ type: String })\n\ticon: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Ensure the option has an ID for accessibility\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`\n\t\t}\n\n\t\t// If no label was provided, use the text content or value\n\t\tif (!this.label) {\n\t\t\tthis.label = this.textContent?.trim() || this.value\n\t\t}\n\n\t\t// If value wasn't set but there's text content, use that as the value\n\t\tif (!this.value && this.textContent) {\n\t\t\tthis.value = this.textContent.trim()\n\t\t}\n\n\t\t// Make the option clickable\n\t\tfromEvent<MouseEvent>(this, 'click')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(this.handleClick)\n\n\t\tfromEvent<KeyboardEvent>(this, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(this.handleKeyDown)\n\t}\n\n\tdisconnectedCallback() {\n\t\t// Event listeners are automatically cleaned up via takeUntil(this.disconnecting)\n\t\tsuper.disconnectedCallback()\n\t}\n\n\tprivate handleClick(e: Event) {\n\t\te.stopPropagation()\n\t\tif (this.disabled) return\n\t\t// Dispatch a custom event with this option's value\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('option-select', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t\tdetail: { value: this.value },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate handleKeyDown(e: KeyboardEvent) {\n\t\t// Handle space and enter as clicks\n\t\tif (e.key === ' ' || e.key === 'Enter') {\n\t\t\te.preventDefault()\n\t\t\tthis.handleClick(e)\n\t\t}\n\t}\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'py-2': true,\n\t\t\t'px-3': true,\n\t\t\trounded: true,\n\t\t\t'text-sm': true,\n\t\t\t'w-full': true,\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'gap-2': true,\n\t\t\t// Selected state\n\t\t\t'bg-primary-container': this.selected,\n\t\t\t'text-primary-onContainer': this.selected,\n\t\t\t// Hover state (when not selected)\n\t\t\t'hover:bg-surface-high': !this.selected,\n\t\t\t// Focus state\n\t\t\t'focus:outline-none': true,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} role=\"option\" aria-selected=${this.selected} aria-disabled=${this.disabled}>\n\t\t\t\t${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : ''}\n\t\t\t\t<span class=\"flex-1\">${this.label || this.value}</span>\n\t\t\t\t${this.selected\n\t\t\t\t\t? html`\n\t\t\t\t\t\t\t<span class=\"check\">\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<polyline points=\"20 6 9 17 4 12\"></polyline>\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t`\n\t\t\t\t\t: ''}\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","css","constructor","super","arguments","this","value","label","selected","disabled","group","icon","connectedCallback","id","Math","random","toString","substring","textContent","trim","fromEvent","pipe","takeUntil","disconnecting","subscribe","handleClick","handleKeyDown","disconnectedCallback","e","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","detail","key","preventDefault","render","classes","rounded","flex","html","classMap","__decorateClass","property","type","String","prototype","Boolean","reflect","customElement"],"mappings":";;;;;;;;;;AAWA,IAAqBA,IAArB,cAA4CC,EAAgBC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA5D,EAAA;AAAA,EAAA,cAAAC;AAAAC,UAAAA,GAAAC,SAAAA,GA0BCC,KAAAC,QAAgB,IAMhBD,KAAAE,QAAgB,IAMhBF,KAAAG,WAAAA,IAMAH,KAAAI,WAAAA,IAMAJ,KAAAK,QAAgB,IAMhBL,KAAAM,OAAe;AAAA,EAAA;AAAA,EAEf,oBAAAC;AACCT,UAAMS,kBAAAA,GAGDP,KAAKQ,OACTR,KAAKQ,KAAK,mBAAmBC,KAAKC,OAAAA,EAASC,SAAS,IAAIC,UAAU,GAAG,CAAA,CAAA,KAIjEZ,KAAKE,UACTF,KAAKE,QAAQF,KAAKa,aAAaC,KAAAA,KAAUd,KAAKC,QAAAA,CAI1CD,KAAKC,SAASD,KAAKa,gBACvBb,KAAKC,QAAQD,KAAKa,YAAYC,KAAAA,IAI/BC,EAAsBf,MAAM,SAC1BgB,KAAKC,EAAUjB,KAAKkB,aAAAA,CAAAA,EACpBC,UAAUnB,KAAKoB,WAAAA,GAEjBL,EAAyBf,MAAM,WAC7BgB,KAAKC,EAAUjB,KAAKkB,aAAAA,CAAAA,EACpBC,UAAUnB,KAAKqB,aAAAA;AAAAA,EAClB;AAAA,EAEA,uBAAAC;AAECxB,UAAMwB,qBAAAA;AAAAA,EACP;AAAA,EAEQ,YAAYC,GAAAA;AACnBA,IAAAA,EAAEC,gB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AAA,CADCC,EAAS,EAAEC,MAAMG,SAASC,SAAAA,GAAS,CAAA,CAAA,GA3ChBlD,EA4CpBgD,WAAA,YAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMC,YAjDE/C,EAkDpBgD,WAAA,SAAA,CAAA,GAMAJ,EAAA,CADCC,EAAS,EAAEC,MAAMC,OAAAA,CAAAA,CAAAA,GAvDE/C,EAwDpBgD,WAAA,QAAA,CAAA,GAxDoBhD,IAArB4C,EAAA,CADCO,EAAc,iBAAA,CAAA,GACMnD,CAAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option-Dolb8CBn.cjs","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { fromEvent, takeUntil } from 'rxjs'\n\n/**\n * `schmancy-option` is an option element for schmancy-select and schmancy-autocomplete components.\n *\n * @fires click - When the option is clicked\n */\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\toutline: none;\n\t}\n\n\t:host(:focus-visible) {\n\t\toutline: 2px solid var(--schmancy-sys-color-primary-default);\n\t\toutline-offset: -2px;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host([disabled]) {\n\t\topacity: 0.5;\n\t\tpointer-events: none;\n\t}\n`) {\n\t/**\n\t * The value of the option, will be used when selected.\n\t */\n\t@property({ type: String })\n\tvalue: string = ''\n\n\t/**\n\t * The human-readable label for the option.\n\t */\n\t@property({ type: String })\n\tlabel: string = ''\n\n\t/**\n\t * Whether the option is currently selected.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tselected: boolean = false\n\n\t/**\n\t * Whether the option is disabled.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled: boolean = false\n\n\t/**\n\t * Optional group this option belongs to (for option grouping).\n\t */\n\t@property({ type: String })\n\tgroup: string = ''\n\n\t/**\n\t * Optional icon or image to display before the label.\n\t */\n\t@property({ type: String })\n\ticon: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Ensure the option has an ID for accessibility\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-option-${Math.random().toString(36).substring(2, 9)}`\n\t\t}\n\n\t\t// If no label was provided, use the text content or value\n\t\tif (!this.label) {\n\t\t\tthis.label = this.textContent?.trim() || this.value\n\t\t}\n\n\t\t// If value wasn't set but there's text content, use that as the value\n\t\tif (!this.value && this.textContent) {\n\t\t\tthis.value = this.textContent.trim()\n\t\t}\n\n\t\t// Make the option clickable\n\t\tfromEvent<MouseEvent>(this, 'click')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(this.handleClick)\n\n\t\tfromEvent<KeyboardEvent>(this, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(this.handleKeyDown)\n\t}\n\n\tdisconnectedCallback() {\n\t\t// Event listeners are automatically cleaned up via takeUntil(this.disconnecting)\n\t\tsuper.disconnectedCallback()\n\t}\n\n\tprivate handleClick(e: Event) {\n\t\te.stopPropagation()\n\t\tif (this.disabled) return\n\t\t// Dispatch a custom event with this option's value\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('option-select', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t\tdetail: { value: this.value },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate handleKeyDown(e: KeyboardEvent) {\n\t\t// Handle space and enter as clicks\n\t\tif (e.key === ' ' || e.key === 'Enter') {\n\t\t\te.preventDefault()\n\t\t\tthis.handleClick(e)\n\t\t}\n\t}\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'py-2': true,\n\t\t\t'px-3': true,\n\t\t\trounded: true,\n\t\t\t'text-sm': true,\n\t\t\t'w-full': true,\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'gap-2': true,\n\t\t\t// Selected state\n\t\t\t'bg-primary-container': this.selected,\n\t\t\t'text-primary-onContainer': this.selected,\n\t\t\t// Hover state (when not selected)\n\t\t\t'hover:bg-surface-high': !this.selected,\n\t\t\t// Focus state\n\t\t\t'focus:outline-none': true,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} role=\"option\" aria-selected=${this.selected} aria-disabled=${this.disabled}>\n\t\t\t\t${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : ''}\n\t\t\t\t<span class=\"flex-1\">${this.label || this.value}</span>\n\t\t\t\t${this.selected\n\t\t\t\t\t? html`\n\t\t\t\t\t\t\t<span class=\"check\">\n\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<polyline points=\"20 6 9 17 4 12\"></polyline>\n\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t`\n\t\t\t\t\t: ''}\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","css","super","arguments","this","value","label","selected","disabled","group","icon","connectedCallback","id","Math","random","toString","substring","textContent","trim","fromEvent","pipe","takeUntil","disconnecting","subscribe","handleClick","handleKeyDown","disconnectedCallback","e","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","detail","key","preventDefault","render","classes","rounded","flex","html","classMap","__decorateClass","property","type","String","prototype","Boolean","reflect","customElement"],"mappings":"oZAWA,IAAqBA,EAArB,cAA4CC,EAAAA,gBAAgBC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA5D,CAAA,CAAA,cAAAC,MAAAA,GAAAC,SAAAA,EA0BCC,KAAAC,MAAgB,GAMhBD,KAAAE,MAAgB,GAMhBF,KAAAG,YAMAH,KAAAI,SAAAA,GAMAJ,KAAAK,MAAgB,GAMhBL,KAAAM,KAAe,EAAA,CAEf,mBAAAC,CACCT,MAAMS,oBAGDP,KAAKQ,KACTR,KAAKQ,GAAK,mBAAmBC,KAAKC,OAAAA,EAASC,SAAS,EAAA,EAAIC,UAAU,EAAG,CAAA,CAAA,IAIjEZ,KAAKE,QACTF,KAAKE,MAAQF,KAAKa,aAAaC,KAAAA,GAAUd,KAAKC,OAAAA,CAI1CD,KAAKC,OAASD,KAAKa,cACvBb,KAAKC,MAAQD,KAAKa,YAAYC,QAI/BC,EAAAA,UAAsBf,KAAM,OAAA,EAC1BgB,KAAKC,EAAAA,UAAUjB,KAAKkB,aAAAA,CAAAA,EACpBC,UAAUnB,KAAKoB,WAAAA,EAEjBL,EAAAA,UAAyBf,KAAM,SAAA,EAC7BgB,KAAKC,EAAAA,UAAUjB,KAAKkB,gBACpBC,UAAUnB,KAAKqB,aAAAA,CAClB,CAEA,sBAAAC,CAECxB,MAAMwB,qBAAAA,CACP,CAEQ,YAAYC,EAAAA,CACnBA,EAAEC,gBAAAA,EACExB,KAAKI,UAETJ,KAAKyB,cACJ,IAAIC,YAAY,gBAAiB,CAChCC,QAAAA,GACAC,YACAC,OAAQ,CAAE5B,MAAOD,KAAKC,KAAAA,CAAAA,CAAAA,CAAAA,CAGzB,CAEQ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