@mhmo91/schmancy 0.2.72 → 0.2.75

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.
Files changed (44) hide show
  1. package/dist/card.cjs +1 -1
  2. package/dist/card.js +1 -1
  3. package/dist/content-drawer.cjs +1 -1
  4. package/dist/content-drawer.js +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +4 -4
  7. package/dist/{list-CwampsMO.cjs → list-CL31MEpb.cjs} +7 -7
  8. package/dist/list-CL31MEpb.cjs.map +1 -0
  9. package/dist/{list-CGCKKnfk.js → list-R_GzuzkY.js} +21 -18
  10. package/dist/list-R_GzuzkY.js.map +1 -0
  11. package/dist/list.cjs +1 -1
  12. package/dist/list.js +1 -1
  13. package/dist/nav-drawer.cjs +1 -1
  14. package/dist/nav-drawer.js +1 -1
  15. package/dist/select-Ba3A3DS4.js +181 -0
  16. package/dist/select-Ba3A3DS4.js.map +1 -0
  17. package/dist/select-DtJckUTa.cjs +54 -0
  18. package/dist/select-DtJckUTa.cjs.map +1 -0
  19. package/dist/select.cjs +1 -1
  20. package/dist/select.js +1 -1
  21. package/dist/{surface-CfAH2c9U.cjs → surface-BA2_6-th.cjs} +18 -18
  22. package/dist/surface-BA2_6-th.cjs.map +1 -0
  23. package/dist/{surface-Ci1xR_sr.js → surface-TFjCUP_C.js} +18 -18
  24. package/dist/surface-TFjCUP_C.js.map +1 -0
  25. package/dist/surface.cjs +1 -1
  26. package/dist/surface.js +1 -1
  27. package/dist/teleport.cjs +1 -1
  28. package/dist/{teleport.component-D2o6a-Yh.js → teleport.component-5h9nuQcu.js} +4 -4
  29. package/dist/{teleport.component-D2o6a-Yh.js.map → teleport.component-5h9nuQcu.js.map} +1 -1
  30. package/dist/{teleport.component-14_ksDPx.cjs → teleport.component-T4UtckWn.cjs} +2 -2
  31. package/dist/{teleport.component-14_ksDPx.cjs.map → teleport.component-T4UtckWn.cjs.map} +1 -1
  32. package/dist/teleport.js +1 -1
  33. package/package.json +1 -1
  34. package/types/src/list/list.d.ts +2 -0
  35. package/types/src/select/select.d.ts +1 -8
  36. package/types/src/surface/surface.d.ts +2 -1
  37. package/dist/list-CGCKKnfk.js.map +0 -1
  38. package/dist/list-CwampsMO.cjs.map +0 -1
  39. package/dist/select-BTSVFloo.cjs +0 -55
  40. package/dist/select-BTSVFloo.cjs.map +0 -1
  41. package/dist/select-Iem1gGwb.js +0 -176
  42. package/dist/select-Iem1gGwb.js.map +0 -1
  43. package/dist/surface-CfAH2c9U.cjs.map +0 -1
  44. package/dist/surface-Ci1xR_sr.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"select-BTSVFloo.cjs","sources":["../src/select/select.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { color } from '@schmancy/directives'\nimport SchmancyInput from '@schmancy/input/input'\nimport SchmancyOption from '@schmancy/option/option'\nimport { SchmancyTheme } from '@schmancy/theme/theme.interface'\nimport { css, html, TemplateResult } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nexport type SchmancySelectChangeEvent = CustomEvent<{\n\tvalue: string | string[]\n}>\n\n@customElement('schmancy-select')\nexport class SchmancySelect extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t}\n\n\t[role='listbox'] {\n\t\t/* max-height: 25vh; */ /* Remove the fixed max-height */\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t}\n`) {\n\t// API\n\t@property({ type: String }) name: string | undefined\n\t@property({ type: Boolean }) required = false\n\t@property({ type: String }) placeholder = ''\n\t@property({ type: String }) value = '' // for single-select\n\t@property({ type: Array }) selectedValues: string[] = [] // for multi-select\n\t@property({ type: Boolean }) multi = false\n\t@property({ type: String }) label = ''\n\n\t// Internal states\n\t@state() private isOpen = false\n\t@state() private valueLabel = ''\n\t@state() private isValid = true\n\t@property({ type: String }) validationMessage = ''\n\n\t@query('ul') private ul!: HTMLUListElement\n\n\t@query('schmancy-input') private inputRef!: SchmancyInput\n\t@queryAssignedElements({ flatten: true }) private options!: SchmancyOption[]\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-select-${Math.random().toString(36).substr(2, 9)}`\n\t\t}\n\t\tthis.addEventListener('keydown', this.handleKeyDown)\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.removeEventListener('keydown', this.handleKeyDown)\n\t\tthis.cleanupPositioner?.()\n\t}\n\n\tfirstUpdated() {\n\t\tthis.syncSelection()\n\t\tthis.setupOptionsAccessibility()\n\t}\n\n\tprivate syncSelection() {\n\t\tif (this.multi) {\n\t\t\tthis.selectedValues = this.options.filter(o => o.selected).map(o => o.value)\n\t\t\tthis.valueLabel =\n\t\t\t\tthis.selectedValues.length > 0\n\t\t\t\t\t? this.options\n\t\t\t\t\t\t\t.filter(o => this.selectedValues.includes(o.value))\n\t\t\t\t\t\t\t.map(o => o.label)\n\t\t\t\t\t\t\t.join(', ')\n\t\t\t\t\t: this.placeholder\n\t\t} else {\n\t\t\tconst selectedOption = this.options.find(o => o.value === this.value)\n\t\t\tthis.valueLabel = selectedOption?.label || this.placeholder\n\t\t}\n\t}\n\n\tprivate setupOptionsAccessibility() {\n\t\tthis.options.forEach((option, index) => {\n\t\t\toption.setAttribute('role', 'option')\n\t\t\tif (!option.id) {\n\t\t\t\toption.id = `${this.id}-option-${index}`\n\t\t\t}\n\t\t\toption.tabIndex = -1\n\t\t\toption.setAttribute(\n\t\t\t\t'aria-selected',\n\t\t\t\tString(this.multi ? this.selectedValues.includes(option.value) : option.value === this.value),\n\t\t\t)\n\t\t})\n\t}\n\n\tprivate async positionDropdown() {\n\t\tconst reference = this.renderRoot.querySelector('.trigger') as HTMLElement\n\t\tif (!reference || !this.ul) return\n\n\t\t// Get the available height\n\t\tconst availableHeight = window.innerHeight - reference.getBoundingClientRect().bottom - 10 // 10px buffer\n\t\tthis.ul.style.maxHeight = `${availableHeight}px` // Set max height\n\n\t\tthis.cleanupPositioner = autoUpdate(reference, this.ul, async () => {\n\t\t\tconst { x, y } = await computePosition(reference, this.ul, {\n\t\t\t\tplacement: 'bottom-start',\n\t\t\t\tmiddleware: [offset(5), flip(), shift({ padding: 5 })],\n\t\t\t})\n\n\t\t\tObject.assign(this.ul.style, {\n\t\t\t\tleft: `${x}px`,\n\t\t\t\ttop: `${y}px`,\n\t\t\t\tposition: 'absolute',\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate handleKeyDown(e: KeyboardEvent) {\n\t\tif (!this.isOpen) {\n\t\t\tif (['Enter', ' ', 'ArrowDown'].includes(e.key)) {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.openDropdown(false) // Modified: Call openDropdown directly\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst current = this.options.findIndex(o => o.matches(':focus')) ?? -1\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape':\n\t\t\t\tthis.closeDropdown()\n\t\t\t\tbreak\n\t\t\tcase 'ArrowDown':\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.focusOption(this.options, Math.min(current + 1, this.options.length - 1))\n\t\t\t\tbreak\n\t\t\tcase 'ArrowUp':\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.focusOption(this.options, Math.max(current - 1, 0))\n\t\t\t\tbreak\n\t\t\tcase 'Enter':\n\t\t\tcase ' ':\n\t\t\t\te.preventDefault()\n\t\t\t\tif (current >= 0) this.handleOptionSelect(this.options[current].value)\n\t\t\t\tbreak\n\t\t\tcase 'Tab':\n\t\t\t\tthis.closeDropdown()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate focusOption(options: HTMLElement[], index: number) {\n\t\tconst option = options[index]\n\t\tif (option) {\n\t\t\toption.focus()\n\t\t\tconst combobox = this.renderRoot.querySelector('.trigger')\n\t\t\tcombobox?.setAttribute('aria-activedescendant', option.id)\n\t\t}\n\t}\n\n\tprivate async openDropdown(report = false) {\n\t\t// Add a report flag\n\t\tthis.isOpen = true\n\t\tawait this.updateComplete\n\n\t\tthis.positionDropdown()\n\t\tthis.setupOptionsAccessibility()\n\n\t\tconst options = Array.from(this.ul.querySelectorAll('[role=\"option\"]')) as HTMLElement[]\n\t\tconst selectedIndex = this.multi ? 0 : options.findIndex(o => o.getAttribute('value') === this.value)\n\t\tthis.focusOption(options, Math.max(selectedIndex, 0))\n\t\t//Check if this needs to be reported\n\t\tif (report) this.reportValidity()\n\t}\n\n\tprivate closeDropdown() {\n\t\tthis.isOpen = false\n\t\tthis.cleanupPositioner?.()\n\t\tconst combobox = this.renderRoot.querySelector<HTMLElement>('.trigger')\n\t\tcombobox?.removeAttribute('aria-activedescendant')\n\t\tcombobox?.focus()\n\t}\n\n\tprivate handleOptionSelect(value: string) {\n\t\tif (this.multi) {\n\t\t\tconst option = this.options.find(o => o.value === value)\n\t\t\tif (!option) return\n\n\t\t\toption.selected = !option.selected\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectedValues = [...this.selectedValues, value]\n\t\t\t} else {\n\t\t\t\tthis.selectedValues = this.selectedValues.filter(v => v !== value)\n\t\t\t}\n\n\t\t\tthis.valueLabel =\n\t\t\t\tthis.selectedValues.length > 0\n\t\t\t\t\t? this.options\n\t\t\t\t\t\t\t.filter(o => this.selectedValues.includes(o.value))\n\t\t\t\t\t\t\t.map(o => o.label)\n\t\t\t\t\t\t\t.join(', ')\n\t\t\t\t\t: this.placeholder\n\n\t\t\tthis.dispatchChange(this.selectedValues)\n\t\t} else {\n\t\t\tthis.options.forEach(o => (o.selected = o.value === value))\n\t\t\tthis.value = value\n\t\t\tthis.valueLabel = this.options.find(o => o.value === value)?.label || this.placeholder\n\t\t\tthis.dispatchChange(value)\n\t\t\tthis.closeDropdown()\n\t\t}\n\n\t\tthis.setupOptionsAccessibility()\n\t}\n\n\tprivate dispatchChange(value: string | string[]) {\n\t\tthis.isValid = true // Reset validation on change\n\t\tthis.validationMessage = ''\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<SchmancySelectChangeEvent['detail']>('change', {\n\t\t\t\tdetail: { value },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Native form methods:\n\t * - checkValidity()\n\t * - reportValidity()\n\t * - setCustomValidity()\n\t */\n\tpublic checkValidity(): boolean {\n\t\t//Check if there is a value\n\t\tthis.isValid = this.multi ? this.options.some(o => o.selected) : Boolean(this.value)\n\t\tthis.validationMessage = this.isValid ? '' : 'Please select an option.'\n\t\treturn this.isValid\n\t}\n\n\tpublic reportValidity(): boolean {\n\t\tif (this.required) {\n\t\t\tthis.checkValidity()\n\t\t\tthis.inputRef.required = true // Ensure the inner input knows it's required.\n\t\t\tif (!this.isValid) {\n\t\t\t\tthis.openDropdown()\n\t\t\t\tthis.inputRef.reportValidity()\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\tthis.inputRef.reportValidity()\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn true // Always return true if not required\n\t}\n\n\tpublic setCustomValidity(message: string) {\n\t\tthis.validationMessage = message\n\t}\n\n\trender(): TemplateResult {\n\t\treturn html`\n\t\t\t<div class=\"relative\">\n\t\t\t\t<schmancy-input\n\t\t\t\t\t.name=${this.name}\n\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\tclass=\"trigger\"\n\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\taria-expanded=${this.isOpen}\n\t\t\t\t\taria-controls=\"options\"\n\t\t\t\t\taria-autocomplete=\"none\"\n\t\t\t\t\taria-required=${this.required}\n\t\t\t\t\t.label=${this.label}\n\t\t\t\t\t.placeholder=${this.placeholder}\n\t\t\t\t\t.value=${this.valueLabel}\n\t\t\t\t\t.required=${this.required}\n\t\t\t\t\treadonly\n\t\t\t\t\t@click=${() => (this.isOpen ? this.closeDropdown() : this.openDropdown(true))}\n\t\t\t\t></schmancy-input>\n\n\t\t\t\t<div\n\t\t\t\t\tid=\"overlay\"\n\t\t\t\t\tclass=\"fixed inset-0\"\n\t\t\t\t\t?hidden=${!this.isOpen}\n\t\t\t\t\t@click=${this.closeDropdown}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t></div>\n\n\t\t\t\t<ul\n\t\t\t\t\tid=\"options\"\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\taria-multiselectable=${this.multi}\n\t\t\t\t\tclass=${classMap({\n\t\t\t\t\t\t'absolute z-[1000] mt-1 w-full rounded-md shadow-sm': true,\n\t\t\t\t\t\thidden: !this.isOpen,\n\t\t\t\t\t})}\n\t\t\t\t\t${color({ bgColor: SchmancyTheme.sys.color.surface.container })}\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\tconst customEvt = e as CustomEvent\n\t\t\t\t\t\tconst detailVal = customEvt.detail?.value\n\t\t\t\t\t\tif (detailVal) {\n\t\t\t\t\t\t\tthis.handleOptionSelect(detailVal)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<slot\n\t\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\t\tthis.syncSelection()\n\t\t\t\t\t\t\tthis.setupOptionsAccessibility()\n\t\t\t\t\t\t}}\n\t\t\t\t\t></slot>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-select': SchmancySelect\n\t}\n}\n"],"names":["SchmancySelect","$LitElement","css","super","arguments","this","required","placeholder","value","selectedValues","multi","label","isOpen","valueLabel","isValid","validationMessage","connectedCallback","id","Math","random","toString","substr","addEventListener","handleKeyDown","disconnectedCallback","removeEventListener","cleanupPositioner","syncSelection","setupOptionsAccessibility","options","filter","o","selected","map","length","includes","join","selectedOption","find","forEach","option","index","setAttribute","tabIndex","String","reference","renderRoot","querySelector","ul","availableHeight","window","innerHeight","getBoundingClientRect","bottom","style","maxHeight","autoUpdate","async","x","y","computePosition","placement","middleware","offset","flip","shift","padding","Object","assign","left","top","position","e","key","preventDefault","openDropdown","current","findIndex","matches","closeDropdown","focusOption","min","max","handleOptionSelect","focus","combobox","report","updateComplete","positionDropdown","Array","from","querySelectorAll","selectedIndex","getAttribute","reportValidity","removeAttribute","v","dispatchChange","dispatchEvent","CustomEvent","detail","bubbles","composed","some","Boolean","checkValidity","inputRef","message","html","name","classMap","hidden","color","bgColor","SchmancyTheme","sys","surface","container","customEvt","detailVal","__decorateClass","property","type","prototype","state","query","queryAssignedElements","flatten","customElement"],"mappings":"wjBAeaA,QAAAA,eAAN,cAA6BC,EAAAA,YAAYC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAAzC,CAAA,CAAA,aAAAC,CAAAA,MAAAA,GAAAC,SAckCC,EAAAA,KAAAC,YACED,KAAAE,YAAA,GACNF,KAAAG,MAAA,GACTH,KAAAI,eAA2B,GACjBJ,KAAAK,MAAAA,GACDL,KAAAM,MAAA,GAG3BN,KAAQO,OAAAA,GACRP,KAAQQ,WAAa,GACrBR,KAAQS,WAC+BT,KAAAU,kBAAA,EAAA,CAQhD,mBAAAC,CACCb,MAAMa,kBAAAA,EACDX,KAAKY,KACJZ,KAAAY,GAAK,mBAAmBC,KAAKC,OAAAA,EAASC,SAAS,EAAA,EAAIC,OAAO,EAAG,CAAA,CAAA,IAE9DhB,KAAAiB,iBAAiB,UAAWjB,KAAKkB,aAAAA,CAAa,CAGpD,sBACCpB,OAAAA,MAAMqB,qBACDnB,EAAAA,KAAAoB,oBAAoB,UAAWpB,KAAKkB,aACzClB,GAAAA,EAAAA,KAAKqB,oBAALrB,MAAAA,EAA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uBAkBiB2H,UAAA,QAAA,CAAA,EACDH,EAAA,CAA3BC,WAAS,CAAEC,KAAM9E,UAnBN5C,uBAmBgB2H,UAAA,QAAA,GAGXH,EAAA,CAAhBI,EAAMA,MAAAA,CAAAA,EAtBK5H,uBAsBK2H,UAAA,SAAA,CAAA,EACAH,EAAA,CAAhBI,EAAMA,MAvBK5H,CAAAA,EAAAA,uBAuBK2H,UAAA,aAAA,CACAH,EAAAA,EAAA,CAAhBI,EAAMA,MAAAA,CAAAA,EAxBK5H,uBAwBK2H,UAAA,UAAA,CAAA,EACWH,EAAA,CAA3BC,WAAS,CAAEC,KAAM9E,MAzBN5C,CAAAA,CAAAA,EAAAA,uBAyBgB2H,UAAA,oBAAA,CAEPH,EAAAA,EAAA,CAApBK,EAAAA,MAAM,IA3BK7H,CAAAA,EAAAA,uBA2BS2H,UAAA,KAAA,CAEYH,EAAAA,EAAA,CAAhCK,EAAAA,MAAM,mBA7BK7H,uBA6BqB2H,UAAA,WAAA,CAAA,EACiBH,EAAA,CAAjDM,wBAAsB,CAAEC,QAAS,EAAA,CAAA,CAAA,EA9BtB/H,uBA8BsC2H,UAAA,UAAA,CAAA,EA9BtC3H,QAANA,eAAAwH,EAAA,CADNQ,EAAAA,cAAc,oBACFhI"}
@@ -1,176 +0,0 @@
1
- import { autoUpdate as d, computePosition as u, offset as y, flip as m, shift as v } from "@floating-ui/dom";
2
- import "rxjs";
3
- import { classMap as b } from "lit/directives/class-map.js";
4
- import "lit/directives/style-map.js";
5
- import { $ as f } from "./litElement.mixin-vAR9BIyD.js";
6
- import "./tailwind.mixin-DxmWMnBQ.js";
7
- import { c as g } from "./ripple-BumgqsDT.js";
8
- import { S as w } from "./theme.interface-C5Kj6WjD.js";
9
- import { css as V, html as O } from "lit";
10
- import { property as a, state as p, query as c, queryAssignedElements as x, customElement as $ } from "lit/decorators.js";
11
- var D = Object.defineProperty, S = Object.getOwnPropertyDescriptor, l = (e, t, i, s) => {
12
- for (var r, n = s > 1 ? void 0 : s ? S(t, i) : t, h = e.length - 1; h >= 0; h--) (r = e[h]) && (n = (s ? r(t, i, n) : r(n)) || n);
13
- return s && n && D(t, i, n), n;
14
- };
15
- let o = class extends f(V`
16
- :host {
17
- display: block;
18
- position: relative;
19
- }
20
-
21
- [role='listbox'] {
22
- /* max-height: 25vh; */ /* Remove the fixed max-height */
23
- overflow-y: auto;
24
- outline: none;
25
- }
26
- `) {
27
- constructor() {
28
- super(...arguments), this.required = !1, this.placeholder = "", this.value = "", this.selectedValues = [], this.multi = !1, this.label = "", this.isOpen = !1, this.valueLabel = "", this.isValid = !0, this.validationMessage = "";
29
- }
30
- connectedCallback() {
31
- super.connectedCallback(), this.id || (this.id = `schmancy-select-${Math.random().toString(36).substr(2, 9)}`), this.addEventListener("keydown", this.handleKeyDown);
32
- }
33
- disconnectedCallback() {
34
- var e;
35
- super.disconnectedCallback(), this.removeEventListener("keydown", this.handleKeyDown), (e = this.cleanupPositioner) == null || e.call(this);
36
- }
37
- firstUpdated() {
38
- this.syncSelection(), this.setupOptionsAccessibility();
39
- }
40
- syncSelection() {
41
- if (this.multi) this.selectedValues = this.options.filter((e) => e.selected).map((e) => e.value), this.valueLabel = this.selectedValues.length > 0 ? this.options.filter((e) => this.selectedValues.includes(e.value)).map((e) => e.label).join(", ") : this.placeholder;
42
- else {
43
- const e = this.options.find((t) => t.value === this.value);
44
- this.valueLabel = (e == null ? void 0 : e.label) || this.placeholder;
45
- }
46
- }
47
- setupOptionsAccessibility() {
48
- this.options.forEach((e, t) => {
49
- e.setAttribute("role", "option"), e.id || (e.id = `${this.id}-option-${t}`), e.tabIndex = -1, e.setAttribute("aria-selected", String(this.multi ? this.selectedValues.includes(e.value) : e.value === this.value));
50
- });
51
- }
52
- async positionDropdown() {
53
- const e = this.renderRoot.querySelector(".trigger");
54
- if (!e || !this.ul) return;
55
- const t = window.innerHeight - e.getBoundingClientRect().bottom - 10;
56
- this.ul.style.maxHeight = `${t}px`, this.cleanupPositioner = d(e, this.ul, async () => {
57
- const { x: i, y: s } = await u(e, this.ul, { placement: "bottom-start", middleware: [y(5), m(), v({ padding: 5 })] });
58
- Object.assign(this.ul.style, { left: `${i}px`, top: `${s}px`, position: "absolute" });
59
- });
60
- }
61
- handleKeyDown(e) {
62
- if (!this.isOpen) return void (["Enter", " ", "ArrowDown"].includes(e.key) && (e.preventDefault(), this.openDropdown(!1)));
63
- const t = this.options.findIndex((i) => i.matches(":focus")) ?? -1;
64
- switch (e.key) {
65
- case "Escape":
66
- case "Tab":
67
- this.closeDropdown();
68
- break;
69
- case "ArrowDown":
70
- e.preventDefault(), this.focusOption(this.options, Math.min(t + 1, this.options.length - 1));
71
- break;
72
- case "ArrowUp":
73
- e.preventDefault(), this.focusOption(this.options, Math.max(t - 1, 0));
74
- break;
75
- case "Enter":
76
- case " ":
77
- e.preventDefault(), t >= 0 && this.handleOptionSelect(this.options[t].value);
78
- }
79
- }
80
- focusOption(e, t) {
81
- const i = e[t];
82
- if (i) {
83
- i.focus();
84
- const s = this.renderRoot.querySelector(".trigger");
85
- s == null || s.setAttribute("aria-activedescendant", i.id);
86
- }
87
- }
88
- async openDropdown(e = !1) {
89
- this.isOpen = !0, await this.updateComplete, this.positionDropdown(), this.setupOptionsAccessibility();
90
- const t = Array.from(this.ul.querySelectorAll('[role="option"]')), i = this.multi ? 0 : t.findIndex((s) => s.getAttribute("value") === this.value);
91
- this.focusOption(t, Math.max(i, 0)), e && this.reportValidity();
92
- }
93
- closeDropdown() {
94
- var t;
95
- this.isOpen = !1, (t = this.cleanupPositioner) == null || t.call(this);
96
- const e = this.renderRoot.querySelector(".trigger");
97
- e == null || e.removeAttribute("aria-activedescendant"), e == null || e.focus();
98
- }
99
- handleOptionSelect(e) {
100
- var t;
101
- if (this.multi) {
102
- const i = this.options.find((s) => s.value === e);
103
- if (!i) return;
104
- i.selected = !i.selected, i.selected ? this.selectedValues = [...this.selectedValues, e] : this.selectedValues = this.selectedValues.filter((s) => s !== e), this.valueLabel = this.selectedValues.length > 0 ? this.options.filter((s) => this.selectedValues.includes(s.value)).map((s) => s.label).join(", ") : this.placeholder, this.dispatchChange(this.selectedValues);
105
- } else this.options.forEach((i) => i.selected = i.value === e), this.value = e, this.valueLabel = ((t = this.options.find((i) => i.value === e)) == null ? void 0 : t.label) || this.placeholder, this.dispatchChange(e), this.closeDropdown();
106
- this.setupOptionsAccessibility();
107
- }
108
- dispatchChange(e) {
109
- this.isValid = !0, this.validationMessage = "", this.dispatchEvent(new CustomEvent("change", { detail: { value: e }, bubbles: !0, composed: !0 }));
110
- }
111
- checkValidity() {
112
- return this.isValid = this.multi ? this.options.some((e) => e.selected) : !!this.value, this.validationMessage = this.isValid ? "" : "Please select an option.", this.isValid;
113
- }
114
- reportValidity() {
115
- return !this.required || (this.checkValidity(), this.inputRef.required = !0, this.isValid ? (this.inputRef.reportValidity(), !0) : (this.openDropdown(), this.inputRef.reportValidity(), !1));
116
- }
117
- setCustomValidity(e) {
118
- this.validationMessage = e;
119
- }
120
- render() {
121
- return O`
122
- <div class="relative">
123
- <schmancy-input
124
- .name=${this.name}
125
- tabIndex="0"
126
- class="trigger"
127
- role="combobox"
128
- aria-haspopup="listbox"
129
- aria-expanded=${this.isOpen}
130
- aria-controls="options"
131
- aria-autocomplete="none"
132
- aria-required=${this.required}
133
- .label=${this.label}
134
- .placeholder=${this.placeholder}
135
- .value=${this.valueLabel}
136
- .required=${this.required}
137
- readonly
138
- @click=${() => this.isOpen ? this.closeDropdown() : this.openDropdown(!0)}
139
- ></schmancy-input>
140
-
141
- <div
142
- id="overlay"
143
- class="fixed inset-0"
144
- ?hidden=${!this.isOpen}
145
- @click=${this.closeDropdown}
146
- tabindex="-1"
147
- aria-hidden="true"
148
- ></div>
149
-
150
- <ul
151
- id="options"
152
- role="listbox"
153
- aria-multiselectable=${this.multi}
154
- class=${b({ "absolute z-[1000] mt-1 w-full rounded-md shadow-sm": !0, hidden: !this.isOpen })}
155
- ${g({ bgColor: w.sys.color.surface.container })}
156
- @click=${(e) => {
157
- var s;
158
- const t = e, i = (s = t.detail) == null ? void 0 : s.value;
159
- i && this.handleOptionSelect(i);
160
- }}
161
- >
162
- <slot
163
- @slotchange=${() => {
164
- this.syncSelection(), this.setupOptionsAccessibility();
165
- }}
166
- ></slot>
167
- </ul>
168
- </div>
169
- `;
170
- }
171
- };
172
- l([a({ type: String })], o.prototype, "name", 2), l([a({ type: Boolean })], o.prototype, "required", 2), l([a({ type: String })], o.prototype, "placeholder", 2), l([a({ type: String })], o.prototype, "value", 2), l([a({ type: Array })], o.prototype, "selectedValues", 2), l([a({ type: Boolean })], o.prototype, "multi", 2), l([a({ type: String })], o.prototype, "label", 2), l([p()], o.prototype, "isOpen", 2), l([p()], o.prototype, "valueLabel", 2), l([p()], o.prototype, "isValid", 2), l([a({ type: String })], o.prototype, "validationMessage", 2), l([c("ul")], o.prototype, "ul", 2), l([c("schmancy-input")], o.prototype, "inputRef", 2), l([x({ flatten: !0 })], o.prototype, "options", 2), o = l([$("schmancy-select")], o);
173
- export {
174
- o as S
175
- };
176
- //# sourceMappingURL=select-Iem1gGwb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select-Iem1gGwb.js","sources":["../src/select/select.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { color } from '@schmancy/directives'\nimport SchmancyInput from '@schmancy/input/input'\nimport SchmancyOption from '@schmancy/option/option'\nimport { SchmancyTheme } from '@schmancy/theme/theme.interface'\nimport { css, html, TemplateResult } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nexport type SchmancySelectChangeEvent = CustomEvent<{\n\tvalue: string | string[]\n}>\n\n@customElement('schmancy-select')\nexport class SchmancySelect extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t}\n\n\t[role='listbox'] {\n\t\t/* max-height: 25vh; */ /* Remove the fixed max-height */\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t}\n`) {\n\t// API\n\t@property({ type: String }) name: string | undefined\n\t@property({ type: Boolean }) required = false\n\t@property({ type: String }) placeholder = ''\n\t@property({ type: String }) value = '' // for single-select\n\t@property({ type: Array }) selectedValues: string[] = [] // for multi-select\n\t@property({ type: Boolean }) multi = false\n\t@property({ type: String }) label = ''\n\n\t// Internal states\n\t@state() private isOpen = false\n\t@state() private valueLabel = ''\n\t@state() private isValid = true\n\t@property({ type: String }) validationMessage = ''\n\n\t@query('ul') private ul!: HTMLUListElement\n\n\t@query('schmancy-input') private inputRef!: SchmancyInput\n\t@queryAssignedElements({ flatten: true }) private options!: SchmancyOption[]\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-select-${Math.random().toString(36).substr(2, 9)}`\n\t\t}\n\t\tthis.addEventListener('keydown', this.handleKeyDown)\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.removeEventListener('keydown', this.handleKeyDown)\n\t\tthis.cleanupPositioner?.()\n\t}\n\n\tfirstUpdated() {\n\t\tthis.syncSelection()\n\t\tthis.setupOptionsAccessibility()\n\t}\n\n\tprivate syncSelection() {\n\t\tif (this.multi) {\n\t\t\tthis.selectedValues = this.options.filter(o => o.selected).map(o => o.value)\n\t\t\tthis.valueLabel =\n\t\t\t\tthis.selectedValues.length > 0\n\t\t\t\t\t? this.options\n\t\t\t\t\t\t\t.filter(o => this.selectedValues.includes(o.value))\n\t\t\t\t\t\t\t.map(o => o.label)\n\t\t\t\t\t\t\t.join(', ')\n\t\t\t\t\t: this.placeholder\n\t\t} else {\n\t\t\tconst selectedOption = this.options.find(o => o.value === this.value)\n\t\t\tthis.valueLabel = selectedOption?.label || this.placeholder\n\t\t}\n\t}\n\n\tprivate setupOptionsAccessibility() {\n\t\tthis.options.forEach((option, index) => {\n\t\t\toption.setAttribute('role', 'option')\n\t\t\tif (!option.id) {\n\t\t\t\toption.id = `${this.id}-option-${index}`\n\t\t\t}\n\t\t\toption.tabIndex = -1\n\t\t\toption.setAttribute(\n\t\t\t\t'aria-selected',\n\t\t\t\tString(this.multi ? this.selectedValues.includes(option.value) : option.value === this.value),\n\t\t\t)\n\t\t})\n\t}\n\n\tprivate async positionDropdown() {\n\t\tconst reference = this.renderRoot.querySelector('.trigger') as HTMLElement\n\t\tif (!reference || !this.ul) return\n\n\t\t// Get the available height\n\t\tconst availableHeight = window.innerHeight - reference.getBoundingClientRect().bottom - 10 // 10px buffer\n\t\tthis.ul.style.maxHeight = `${availableHeight}px` // Set max height\n\n\t\tthis.cleanupPositioner = autoUpdate(reference, this.ul, async () => {\n\t\t\tconst { x, y } = await computePosition(reference, this.ul, {\n\t\t\t\tplacement: 'bottom-start',\n\t\t\t\tmiddleware: [offset(5), flip(), shift({ padding: 5 })],\n\t\t\t})\n\n\t\t\tObject.assign(this.ul.style, {\n\t\t\t\tleft: `${x}px`,\n\t\t\t\ttop: `${y}px`,\n\t\t\t\tposition: 'absolute',\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate handleKeyDown(e: KeyboardEvent) {\n\t\tif (!this.isOpen) {\n\t\t\tif (['Enter', ' ', 'ArrowDown'].includes(e.key)) {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.openDropdown(false) // Modified: Call openDropdown directly\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst current = this.options.findIndex(o => o.matches(':focus')) ?? -1\n\n\t\tswitch (e.key) {\n\t\t\tcase 'Escape':\n\t\t\t\tthis.closeDropdown()\n\t\t\t\tbreak\n\t\t\tcase 'ArrowDown':\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.focusOption(this.options, Math.min(current + 1, this.options.length - 1))\n\t\t\t\tbreak\n\t\t\tcase 'ArrowUp':\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.focusOption(this.options, Math.max(current - 1, 0))\n\t\t\t\tbreak\n\t\t\tcase 'Enter':\n\t\t\tcase ' ':\n\t\t\t\te.preventDefault()\n\t\t\t\tif (current >= 0) this.handleOptionSelect(this.options[current].value)\n\t\t\t\tbreak\n\t\t\tcase 'Tab':\n\t\t\t\tthis.closeDropdown()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate focusOption(options: HTMLElement[], index: number) {\n\t\tconst option = options[index]\n\t\tif (option) {\n\t\t\toption.focus()\n\t\t\tconst combobox = this.renderRoot.querySelector('.trigger')\n\t\t\tcombobox?.setAttribute('aria-activedescendant', option.id)\n\t\t}\n\t}\n\n\tprivate async openDropdown(report = false) {\n\t\t// Add a report flag\n\t\tthis.isOpen = true\n\t\tawait this.updateComplete\n\n\t\tthis.positionDropdown()\n\t\tthis.setupOptionsAccessibility()\n\n\t\tconst options = Array.from(this.ul.querySelectorAll('[role=\"option\"]')) as HTMLElement[]\n\t\tconst selectedIndex = this.multi ? 0 : options.findIndex(o => o.getAttribute('value') === this.value)\n\t\tthis.focusOption(options, Math.max(selectedIndex, 0))\n\t\t//Check if this needs to be reported\n\t\tif (report) this.reportValidity()\n\t}\n\n\tprivate closeDropdown() {\n\t\tthis.isOpen = false\n\t\tthis.cleanupPositioner?.()\n\t\tconst combobox = this.renderRoot.querySelector<HTMLElement>('.trigger')\n\t\tcombobox?.removeAttribute('aria-activedescendant')\n\t\tcombobox?.focus()\n\t}\n\n\tprivate handleOptionSelect(value: string) {\n\t\tif (this.multi) {\n\t\t\tconst option = this.options.find(o => o.value === value)\n\t\t\tif (!option) return\n\n\t\t\toption.selected = !option.selected\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectedValues = [...this.selectedValues, value]\n\t\t\t} else {\n\t\t\t\tthis.selectedValues = this.selectedValues.filter(v => v !== value)\n\t\t\t}\n\n\t\t\tthis.valueLabel =\n\t\t\t\tthis.selectedValues.length > 0\n\t\t\t\t\t? this.options\n\t\t\t\t\t\t\t.filter(o => this.selectedValues.includes(o.value))\n\t\t\t\t\t\t\t.map(o => o.label)\n\t\t\t\t\t\t\t.join(', ')\n\t\t\t\t\t: this.placeholder\n\n\t\t\tthis.dispatchChange(this.selectedValues)\n\t\t} else {\n\t\t\tthis.options.forEach(o => (o.selected = o.value === value))\n\t\t\tthis.value = value\n\t\t\tthis.valueLabel = this.options.find(o => o.value === value)?.label || this.placeholder\n\t\t\tthis.dispatchChange(value)\n\t\t\tthis.closeDropdown()\n\t\t}\n\n\t\tthis.setupOptionsAccessibility()\n\t}\n\n\tprivate dispatchChange(value: string | string[]) {\n\t\tthis.isValid = true // Reset validation on change\n\t\tthis.validationMessage = ''\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<SchmancySelectChangeEvent['detail']>('change', {\n\t\t\t\tdetail: { value },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Native form methods:\n\t * - checkValidity()\n\t * - reportValidity()\n\t * - setCustomValidity()\n\t */\n\tpublic checkValidity(): boolean {\n\t\t//Check if there is a value\n\t\tthis.isValid = this.multi ? this.options.some(o => o.selected) : Boolean(this.value)\n\t\tthis.validationMessage = this.isValid ? '' : 'Please select an option.'\n\t\treturn this.isValid\n\t}\n\n\tpublic reportValidity(): boolean {\n\t\tif (this.required) {\n\t\t\tthis.checkValidity()\n\t\t\tthis.inputRef.required = true // Ensure the inner input knows it's required.\n\t\t\tif (!this.isValid) {\n\t\t\t\tthis.openDropdown()\n\t\t\t\tthis.inputRef.reportValidity()\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\tthis.inputRef.reportValidity()\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn true // Always return true if not required\n\t}\n\n\tpublic setCustomValidity(message: string) {\n\t\tthis.validationMessage = message\n\t}\n\n\trender(): TemplateResult {\n\t\treturn html`\n\t\t\t<div class=\"relative\">\n\t\t\t\t<schmancy-input\n\t\t\t\t\t.name=${this.name}\n\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\tclass=\"trigger\"\n\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\taria-expanded=${this.isOpen}\n\t\t\t\t\taria-controls=\"options\"\n\t\t\t\t\taria-autocomplete=\"none\"\n\t\t\t\t\taria-required=${this.required}\n\t\t\t\t\t.label=${this.label}\n\t\t\t\t\t.placeholder=${this.placeholder}\n\t\t\t\t\t.value=${this.valueLabel}\n\t\t\t\t\t.required=${this.required}\n\t\t\t\t\treadonly\n\t\t\t\t\t@click=${() => (this.isOpen ? this.closeDropdown() : this.openDropdown(true))}\n\t\t\t\t></schmancy-input>\n\n\t\t\t\t<div\n\t\t\t\t\tid=\"overlay\"\n\t\t\t\t\tclass=\"fixed inset-0\"\n\t\t\t\t\t?hidden=${!this.isOpen}\n\t\t\t\t\t@click=${this.closeDropdown}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t></div>\n\n\t\t\t\t<ul\n\t\t\t\t\tid=\"options\"\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\taria-multiselectable=${this.multi}\n\t\t\t\t\tclass=${classMap({\n\t\t\t\t\t\t'absolute z-[1000] mt-1 w-full rounded-md shadow-sm': true,\n\t\t\t\t\t\thidden: !this.isOpen,\n\t\t\t\t\t})}\n\t\t\t\t\t${color({ bgColor: SchmancyTheme.sys.color.surface.container })}\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\tconst customEvt = e as CustomEvent\n\t\t\t\t\t\tconst detailVal = customEvt.detail?.value\n\t\t\t\t\t\tif (detailVal) {\n\t\t\t\t\t\t\tthis.handleOptionSelect(detailVal)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<slot\n\t\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\t\tthis.syncSelection()\n\t\t\t\t\t\t\tthis.setupOptionsAccessibility()\n\t\t\t\t\t\t}}\n\t\t\t\t\t></slot>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-select': SchmancySelect\n\t}\n}\n"],"names":["SchmancySelect","$LitElement","css","super","arguments","this","required","placeholder","value","selectedValues","multi","label","isOpen","valueLabel","isValid","validationMessage","connectedCallback","id","Math","random","toString","substr","addEventListener","handleKeyDown","disconnectedCallback","removeEventListener","cleanupPositioner","firstUpdated","syncSelection","setupOptionsAccessibility","options","filter","o","selected","map","length","includes","join","selectedOption","find","forEach","option","index","setAttribute","tabIndex","String","positionDropdown","reference","renderRoot","querySelector","ul","availableHeight","window","innerHeight","getBoundingClientRect","bottom","style","maxHeight","autoUpdate","async","x","y","computePosition","placement","middleware","offset","flip","shift","padding","Object","assign","left","top","position","e","key","preventDefault","openDropdown","current","findIndex","matches","closeDropdown","focusOption","min","max","handleOptionSelect","focus","combobox","report","updateComplete","Array","from","querySelectorAll","selectedIndex","getAttribute","reportValidity","removeAttribute","v","dispatchChange","dispatchEvent","CustomEvent","detail","bubbles","composed","some","Boolean","checkValidity","inputRef","message","render","html","name","classMap","hidden","color","bgColor","SchmancyTheme","sys","surface","container","customEvt","detailVal","__decorateClass","property","type","prototype","state","query","queryAssignedElements","flatten","customElement"],"mappings":";;;;;;;;;;;;;;AAea,IAAAA,IAAN,cAA6BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAAzC,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAckCC,GAAAA,KAAAC,eACED,KAAAE,cAAA,IACNF,KAAAG,QAAA,IACTH,KAAAI,iBAA2B,CACjBJ,GAAAA,KAAAK,QAAA,IACDL,KAAAM,QAAA,IAG3BN,KAAQO,aACRP,KAAQQ,aAAa,IACrBR,KAAQS,UAAU,IACqBT,KAAAU,oBAAA;AAAA,EAAA;AAAA,EAQhD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M,IA3BK/H,CAAAA,GAAAA,EA2BS6H,WAAA,MAAA,CAEYH,GAAAA,EAAA,CAAhCK,EAAM,gBA7BK/H,CAAAA,GAAAA,EA6BqB6H,WAAA,YAAA,CAAA,GACiBH,EAAA,CAAjDM,EAAsB,EAAEC,SAAS,GAAA,CAAA,CAAA,GA9BtBjI,EA8BsC6H,WAAA,WAAA,CAAA,GA9BtC7H,IAAN0H,EAAA,CADNQ,EAAc,qBACFlI;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"surface-CfAH2c9U.cjs","sources":["../src/surface/surface.ts"],"sourcesContent":["import { provide } from '@lit/context';\nimport { TailwindElement } from '@mixins/tailwind.mixin';\nimport { css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js'; // Import classMap\nimport { SchmancySurfaceTypeContext } from './context';\n\n/**\n * @element schmancy-surface\n * @slot - default content\n */\n@customElement('schmancy-surface')\nexport class SchmancySurface extends TailwindElement(css`\n :host([fill='all']) {\n height: 100%;\n width: 100%;\n }\n :host([fill='width']) {\n width: 100%;\n }\n :host([fill='height']) {\n height: 100%;\n }\n :host {\n display: block;\n }\n`) {\n /**\n * Fill the width and/or height of the parent container.\n * @default 'auto'\n *\n */\n @property({ type: String, reflect: true }) fill: 'all' | 'width' | 'height' | 'auto' = 'auto';\n @property() rounded: 'none' | 'top' | 'left' | 'right' | 'bottom' | 'all' = 'none';\n\n @provide({ context: SchmancySurfaceTypeContext })\n @property()\n type:\n | 'surface'\n | 'surfaceDim'\n | 'surfaceBright'\n | 'containerLowest'\n | 'containerLow'\n | 'container'\n | 'containerHigh'\n | 'containerHighest' = 'surface';\n\n @property({ type: Number }) elevation: 0 | 1 | 2 | 3 | 4 | 5 = 0;\n\n protected render(): unknown {\n const classes = {\n 'relative': true,\n 'inset-0': true,\n 'block': true,\n 'box-border': true,\n 'rounded-none': this.rounded === 'none',\n 'rounded-t-[8px]': this.rounded === 'top',\n 'rounded-l-[8px]': this.rounded === 'left',\n 'rounded-r-[8px]': this.rounded === 'right',\n 'rounded-b-[8px]': this.rounded === 'bottom',\n 'rounded-[8px]': this.rounded === 'all',\n\n 'w-full': this.fill === 'width' || this.fill === 'all',\n 'h-full': this.fill === 'height' || this.fill === 'all',\n 'shadow-xs': this.elevation === 1,\n 'shadow-sm': this.elevation === 2,\n 'shadow-md': this.elevation === 3,\n 'shadow-lg': this.elevation === 4,\n 'text-surface-on':\n this.type === 'surface' ||\n this.type === 'surfaceDim' ||\n this.type === 'surfaceBright' ||\n this.type === 'containerLowest' ||\n this.type === 'containerLow' ||\n this.type === 'container' ||\n this.type === 'containerHigh' ||\n this.type === 'containerHighest',\n 'bg-surface-default': this.type === 'surface',\n 'bg-surface-dim': this.type === 'surfaceDim',\n 'bg-surface-bright': this.type === 'surfaceBright',\n 'bg-surface-lowest': this.type === 'containerLowest',\n 'bg-surface-low': this.type === 'containerLow',\n 'bg-surface-container': this.type === 'container',\n 'bg-surface-high': this.type === 'containerHigh',\n 'bg-surface-highest': this.type === 'containerHighest',\n };\n\n return html`\n <section class=${classMap(classes)}>\n <slot></slot>\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-surface': SchmancySurface;\n }\n}\n"],"names":["SchmancySurface","TailwindElement","css","super","arguments","this","fill","rounded","type","elevation","render","classes","relative","block","html","classMap","__decorateClass","property","String","reflect","prototype","provide","context","SchmancySurfaceTypeContext","Number","customElement"],"mappings":"+ZAYaA,QAAAA,gBAAN,cAA8BC,EAAAA,gBAAgBC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA9C,CAAA,CAAA,aAAAC,CAAAA,MAAAA,GAAAC,SAoBkFC,EAAAA,KAAAC,KAAA,OACXD,KAAAE,QAAA,OAYnDF,KAAAG,KAAA,UAEsCH,KAAAI,UAAA,CAAA,CAErD,QAAAC,CACR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AA,EAxBCjB,wBAyBXoB,UAAA,OAAA,CAU4BJ,EAAAA,EAAA,CAA3BC,WAAS,CAAET,KAAMgB,MAAAA,CAAAA,CAAAA,EAnCPxB,wBAmCiBoB,UAAA,YAAA,CAnCjBpB,EAAAA,QAANA,gBAAAgB,EAAA,CADNS,EAAAA,cAAc,kBAAA,CAAA,EACFzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"surface-Ci1xR_sr.js","sources":["../src/surface/surface.ts"],"sourcesContent":["import { provide } from '@lit/context';\nimport { TailwindElement } from '@mixins/tailwind.mixin';\nimport { css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js'; // Import classMap\nimport { SchmancySurfaceTypeContext } from './context';\n\n/**\n * @element schmancy-surface\n * @slot - default content\n */\n@customElement('schmancy-surface')\nexport class SchmancySurface extends TailwindElement(css`\n :host([fill='all']) {\n height: 100%;\n width: 100%;\n }\n :host([fill='width']) {\n width: 100%;\n }\n :host([fill='height']) {\n height: 100%;\n }\n :host {\n display: block;\n }\n`) {\n /**\n * Fill the width and/or height of the parent container.\n * @default 'auto'\n *\n */\n @property({ type: String, reflect: true }) fill: 'all' | 'width' | 'height' | 'auto' = 'auto';\n @property() rounded: 'none' | 'top' | 'left' | 'right' | 'bottom' | 'all' = 'none';\n\n @provide({ context: SchmancySurfaceTypeContext })\n @property()\n type:\n | 'surface'\n | 'surfaceDim'\n | 'surfaceBright'\n | 'containerLowest'\n | 'containerLow'\n | 'container'\n | 'containerHigh'\n | 'containerHighest' = 'surface';\n\n @property({ type: Number }) elevation: 0 | 1 | 2 | 3 | 4 | 5 = 0;\n\n protected render(): unknown {\n const classes = {\n 'relative': true,\n 'inset-0': true,\n 'block': true,\n 'box-border': true,\n 'rounded-none': this.rounded === 'none',\n 'rounded-t-[8px]': this.rounded === 'top',\n 'rounded-l-[8px]': this.rounded === 'left',\n 'rounded-r-[8px]': this.rounded === 'right',\n 'rounded-b-[8px]': this.rounded === 'bottom',\n 'rounded-[8px]': this.rounded === 'all',\n\n 'w-full': this.fill === 'width' || this.fill === 'all',\n 'h-full': this.fill === 'height' || this.fill === 'all',\n 'shadow-xs': this.elevation === 1,\n 'shadow-sm': this.elevation === 2,\n 'shadow-md': this.elevation === 3,\n 'shadow-lg': this.elevation === 4,\n 'text-surface-on':\n this.type === 'surface' ||\n this.type === 'surfaceDim' ||\n this.type === 'surfaceBright' ||\n this.type === 'containerLowest' ||\n this.type === 'containerLow' ||\n this.type === 'container' ||\n this.type === 'containerHigh' ||\n this.type === 'containerHighest',\n 'bg-surface-default': this.type === 'surface',\n 'bg-surface-dim': this.type === 'surfaceDim',\n 'bg-surface-bright': this.type === 'surfaceBright',\n 'bg-surface-lowest': this.type === 'containerLowest',\n 'bg-surface-low': this.type === 'containerLow',\n 'bg-surface-container': this.type === 'container',\n 'bg-surface-high': this.type === 'containerHigh',\n 'bg-surface-highest': this.type === 'containerHighest',\n };\n\n return html`\n <section class=${classMap(classes)}>\n <slot></slot>\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-surface': SchmancySurface;\n }\n}\n"],"names":["SchmancySurface","TailwindElement","css","super","arguments","this","fill","rounded","type","elevation","render","classes","relative","block","html","classMap","__decorateClass","property","String","reflect","prototype","provide","context","SchmancySurfaceTypeContext","Number","customElement"],"mappings":";;;;;;;;;;AAYa,IAAAA,IAAN,cAA8BC,EAAgBC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA9C,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAoBkFC,GAAAA,KAAAC,OAAA,QACXD,KAAAE,UAAA,QAYnDF,KAAAG,OAAA,WAEsCH,KAAAI,YAAA;AAAA,EAAA;AAAA,EAErD,SAAAC;AACR,UAAMC,IAAU,EACdC,UAAAA,IACA,WAAW,IACXC,OAAS,IACT,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