solid-ui 3.1.3-10 → 3.1.3-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.
Files changed (173) hide show
  1. package/dist/_virtual/~icons/svg-spinners/3-dots-fade.cjs.js +2 -0
  2. package/dist/_virtual/~icons/svg-spinners/3-dots-fade.cjs.js.map +1 -0
  3. package/dist/_virtual/~icons/svg-spinners/3-dots-fade.esm.js +11 -0
  4. package/dist/_virtual/~icons/svg-spinners/3-dots-fade.esm.js.map +1 -0
  5. package/dist/chunks/{DialogProvider-CrvbR_fd.js → DialogProvider-ge2aA77F.js} +3 -3
  6. package/dist/chunks/DialogProvider-ge2aA77F.js.map +1 -0
  7. package/dist/chunks/{account-Ma2Ipfjx.js → account-CdqIoTsl.js} +11 -11
  8. package/dist/chunks/{account-Ma2Ipfjx.js.map → account-CdqIoTsl.js.map} +1 -1
  9. package/dist/chunks/{auth-BI22fz6P.js → auth-D8B5yczR.js} +9 -9
  10. package/dist/chunks/{auth-BI22fz6P.js.map → auth-D8B5yczR.js.map} +1 -1
  11. package/dist/chunks/{avatar-DN7FzC2N.js → avatar-DNGFKkhm.js} +4 -4
  12. package/dist/chunks/{avatar-DN7FzC2N.js.map → avatar-DNGFKkhm.js.map} +1 -1
  13. package/dist/chunks/{button-DHahwxqn.js → button-oanBb_ha.js} +2 -2
  14. package/dist/chunks/{button-DHahwxqn.js.map → button-oanBb_ha.js.map} +1 -1
  15. package/dist/chunks/combobox-Dav1bNHS.js +734 -0
  16. package/dist/chunks/combobox-Dav1bNHS.js.map +1 -0
  17. package/dist/chunks/{combobox-option-DB6KGb7o.js → combobox-option-DxJvAZ_Q.js} +2 -2
  18. package/dist/chunks/{combobox-option-DB6KGb7o.js.map → combobox-option-DxJvAZ_Q.js.map} +1 -1
  19. package/dist/chunks/{components-DH1slGZY.js → components-PQfnwrHI.js} +10 -10
  20. package/dist/chunks/components-PQfnwrHI.js.map +1 -0
  21. package/dist/chunks/{context-CA1Kq0FW.js → context-B_xwK-Y_.js} +2 -2
  22. package/dist/chunks/{context-CA1Kq0FW.js.map → context-B_xwK-Y_.js.map} +1 -1
  23. package/dist/chunks/{dialog-YaqTwAtR.js → dialog-Ujvm11_B.js} +5 -5
  24. package/dist/chunks/{dialog-YaqTwAtR.js.map → dialog-Ujvm11_B.js.map} +1 -1
  25. package/dist/chunks/{dialog-content-B3I3H7hj.js → dialog-content-CEITrC59.js} +2 -2
  26. package/dist/chunks/{dialog-content-B3I3H7hj.js.map → dialog-content-CEITrC59.js.map} +1 -1
  27. package/dist/chunks/{dialog-footer-BjcYeVhg.js → dialog-footer-DVLEK5bU.js} +2 -2
  28. package/dist/chunks/{dialog-footer-BjcYeVhg.js.map → dialog-footer-DVLEK5bU.js.map} +1 -1
  29. package/dist/chunks/{dialog-header-BynEzovK.js → dialog-header-kEWl21oD.js} +2 -2
  30. package/dist/chunks/{dialog-header-BynEzovK.js.map → dialog-header-kEWl21oD.js.map} +1 -1
  31. package/dist/chunks/{dialogs-root-B61LtZks.js → dialogs-root-dPGfuzSZ.js} +3 -3
  32. package/dist/chunks/{dialogs-root-B61LtZks.js.map → dialogs-root-dPGfuzSZ.js.map} +1 -1
  33. package/dist/chunks/{guard-YhbCPY-V.js → guard-DZGvf4tS.js} +4 -4
  34. package/dist/chunks/{guard-YhbCPY-V.js.map → guard-DZGvf4tS.js.map} +1 -1
  35. package/dist/chunks/{input-CVKu3XRI.js → input-BjCX2bFe.js} +8 -8
  36. package/dist/chunks/input-BjCX2bFe.js.map +1 -0
  37. package/dist/chunks/{login-button-76PlEs2Y.js → login-button-Ta3tkpn4.js} +5 -5
  38. package/dist/chunks/{login-button-76PlEs2Y.js.map → login-button-Ta3tkpn4.js.map} +1 -1
  39. package/dist/chunks/{logout-button-Dt3Utgj0.js → logout-button-Db6VmUmJ.js} +5 -5
  40. package/dist/chunks/{logout-button-Dt3Utgj0.js.map → logout-button-Db6VmUmJ.js.map} +1 -1
  41. package/dist/chunks/{menu-6ayNsxFG.js → menu-CQEXqNO6.js} +2 -2
  42. package/dist/chunks/{menu-6ayNsxFG.js.map → menu-CQEXqNO6.js.map} +1 -1
  43. package/dist/chunks/{menu-item-Ckl9f1rG.js → menu-item-BHJ4xljI.js} +2 -2
  44. package/dist/chunks/{menu-item-Ckl9f1rG.js.map → menu-item-BHJ4xljI.js.map} +1 -1
  45. package/dist/chunks/{provider-BfO67dzy.js → provider-CoVkCkMs.js} +5 -5
  46. package/dist/chunks/provider-CoVkCkMs.js.map +1 -0
  47. package/dist/chunks/{select-DHFgELMJ.js → select-OM-SgY4K.js} +101 -66
  48. package/dist/chunks/select-OM-SgY4K.js.map +1 -0
  49. package/dist/chunks/{select-option-Duk4S4Sc.js → select-option-pVhYlXrt.js} +2 -2
  50. package/dist/chunks/{select-option-Duk4S4Sc.js.map → select-option-pVhYlXrt.js.map} +1 -1
  51. package/dist/chunks/{signup-button-B10K6b8A.js → signup-button-wO4uoqUi.js} +5 -5
  52. package/dist/chunks/{signup-button-B10K6b8A.js.map → signup-button-wO4uoqUi.js.map} +1 -1
  53. package/dist/chunks/{solid-emblem-DgBJk5Th.js → solid-emblem-D2clBuKZ.js} +2 -2
  54. package/dist/chunks/{solid-emblem-DgBJk5Th.js.map → solid-emblem-D2clBuKZ.js.map} +1 -1
  55. package/dist/chunks/{src-CdZhCYdF.js → src-B9CXYA44.js} +3 -3
  56. package/dist/chunks/{src-CdZhCYdF.js.map → src-B9CXYA44.js.map} +1 -1
  57. package/dist/components/account.js +1 -1
  58. package/dist/components/avatar.js +1 -1
  59. package/dist/components/button.js +1 -1
  60. package/dist/components/combobox/Combobox.cjs.js +21 -21
  61. package/dist/components/combobox/Combobox.cjs.js.map +1 -1
  62. package/dist/components/combobox/Combobox.d.ts +30 -3
  63. package/dist/components/combobox/Combobox.d.ts.map +1 -1
  64. package/dist/components/combobox/Combobox.esm.js +268 -107
  65. package/dist/components/combobox/Combobox.esm.js.map +1 -1
  66. package/dist/components/combobox/Combobox.stories.d.ts +54 -0
  67. package/dist/components/combobox/Combobox.stories.d.ts.map +1 -1
  68. package/dist/components/combobox/Combobox.styles.cjs.js +1 -1
  69. package/dist/components/combobox/Combobox.styles.cjs.js.map +1 -1
  70. package/dist/components/combobox/Combobox.styles.esm.js +1 -1
  71. package/dist/components/combobox/Combobox.styles.esm.js.map +1 -1
  72. package/dist/components/combobox/index.cjs.js +1 -1
  73. package/dist/components/combobox/index.cjs.js.map +1 -1
  74. package/dist/components/combobox/index.d.ts +1 -0
  75. package/dist/components/combobox/index.d.ts.map +1 -1
  76. package/dist/components/combobox/index.esm.js +3 -3
  77. package/dist/components/combobox/index.esm.js.map +1 -1
  78. package/dist/components/combobox-option.js +1 -1
  79. package/dist/components/combobox.js +2 -2
  80. package/dist/components/dialog-content.js +1 -1
  81. package/dist/components/dialog-footer.js +1 -1
  82. package/dist/components/dialog-header.js +1 -1
  83. package/dist/components/dialog-provider/DialogProvider.cjs.js.map +1 -1
  84. package/dist/components/dialog-provider/DialogProvider.d.ts +2 -1
  85. package/dist/components/dialog-provider/DialogProvider.d.ts.map +1 -1
  86. package/dist/components/dialog-provider/DialogProvider.esm.js.map +1 -1
  87. package/dist/components/dialog-provider.js +1 -1
  88. package/dist/components/dialog.js +1 -1
  89. package/dist/components/dialogs-root.js +1 -1
  90. package/dist/components/guard.js +1 -1
  91. package/dist/components/input/Input.cjs.js +5 -5
  92. package/dist/components/input/Input.cjs.js.map +1 -1
  93. package/dist/components/input/Input.d.ts +1 -1
  94. package/dist/components/input/Input.d.ts.map +1 -1
  95. package/dist/components/input/Input.esm.js +7 -7
  96. package/dist/components/input/Input.esm.js.map +1 -1
  97. package/dist/components/input.js +1 -1
  98. package/dist/components/login-button.js +1 -1
  99. package/dist/components/login-modal.js +1 -1
  100. package/dist/components/logout-button.js +1 -1
  101. package/dist/components/menu-item.js +1 -1
  102. package/dist/components/menu.js +1 -1
  103. package/dist/components/provider/Provider.cjs.js.map +1 -1
  104. package/dist/components/provider/Provider.d.ts +2 -1
  105. package/dist/components/provider/Provider.d.ts.map +1 -1
  106. package/dist/components/provider/Provider.esm.js.map +1 -1
  107. package/dist/components/provider.js +1 -1
  108. package/dist/components/select/Select.cjs.js +7 -6
  109. package/dist/components/select/Select.cjs.js.map +1 -1
  110. package/dist/components/select/Select.d.ts +12 -2
  111. package/dist/components/select/Select.d.ts.map +1 -1
  112. package/dist/components/select/Select.esm.js +96 -65
  113. package/dist/components/select/Select.esm.js.map +1 -1
  114. package/dist/components/select/index.cjs.js.map +1 -1
  115. package/dist/components/select/index.d.ts +1 -0
  116. package/dist/components/select/index.d.ts.map +1 -1
  117. package/dist/components/select/index.esm.js.map +1 -1
  118. package/dist/components/select-option.js +1 -1
  119. package/dist/components/select.js +1 -1
  120. package/dist/components/signup-button.js +1 -1
  121. package/dist/components/solid-emblem.js +1 -1
  122. package/dist/components.js +22 -22
  123. package/dist/index.cjs.js +1 -1
  124. package/dist/index.cjs.js.map +1 -1
  125. package/dist/index.esm.js +2 -2
  126. package/dist/index.js +6 -6
  127. package/dist/lib/components/index.cjs.js +1 -1
  128. package/dist/lib/components/index.esm.js +2 -2
  129. package/dist/lib/components/traits/FormControlTrait.cjs.js +2 -0
  130. package/dist/lib/components/traits/FormControlTrait.cjs.js.map +1 -0
  131. package/dist/lib/components/traits/{InputTrait.d.ts → FormControlTrait.d.ts} +10 -11
  132. package/dist/lib/components/traits/FormControlTrait.d.ts.map +1 -0
  133. package/dist/lib/components/traits/FormControlTrait.esm.js +45 -0
  134. package/dist/lib/components/traits/FormControlTrait.esm.js.map +1 -0
  135. package/dist/lib/components/traits/index.cjs.js +1 -1
  136. package/dist/lib/components/traits/index.d.ts +2 -2
  137. package/dist/lib/components/traits/index.d.ts.map +1 -1
  138. package/dist/lib/components/traits/index.esm.js +2 -2
  139. package/dist/lib/components/web-component/WebComponent.cjs.js.map +1 -1
  140. package/dist/lib/components/web-component/WebComponent.d.ts +2 -2
  141. package/dist/lib/components/web-component/WebComponent.d.ts.map +1 -1
  142. package/dist/lib/components/web-component/WebComponent.esm.js.map +1 -1
  143. package/dist/lib/timing.cjs.js +2 -0
  144. package/dist/lib/timing.cjs.js.map +1 -0
  145. package/dist/lib/timing.d.ts +6 -0
  146. package/dist/lib/timing.d.ts.map +1 -0
  147. package/dist/lib/timing.esm.js +13 -0
  148. package/dist/lib/timing.esm.js.map +1 -0
  149. package/dist/lib/values.cjs.js +2 -0
  150. package/dist/lib/values.cjs.js.map +1 -0
  151. package/dist/lib/values.d.ts +2 -0
  152. package/dist/lib/values.d.ts.map +1 -0
  153. package/dist/lib/values.esm.js +8 -0
  154. package/dist/lib/values.esm.js.map +1 -0
  155. package/dist/loader.js +6 -6
  156. package/dist/solid-ui.js +91 -90
  157. package/dist/solid-ui.min.js +91 -90
  158. package/dist/solid-ui.min.js.map +1 -1
  159. package/dist/storybook/components/StorybookProvider.d.ts +2 -1
  160. package/dist/storybook/components/StorybookProvider.d.ts.map +1 -1
  161. package/package.json +2 -1
  162. package/dist/chunks/DialogProvider-CrvbR_fd.js.map +0 -1
  163. package/dist/chunks/combobox-BWOPh9dj.js +0 -474
  164. package/dist/chunks/combobox-BWOPh9dj.js.map +0 -1
  165. package/dist/chunks/components-DH1slGZY.js.map +0 -1
  166. package/dist/chunks/input-CVKu3XRI.js.map +0 -1
  167. package/dist/chunks/provider-BfO67dzy.js.map +0 -1
  168. package/dist/chunks/select-DHFgELMJ.js.map +0 -1
  169. package/dist/lib/components/traits/InputTrait.cjs.js +0 -2
  170. package/dist/lib/components/traits/InputTrait.cjs.js.map +0 -1
  171. package/dist/lib/components/traits/InputTrait.d.ts.map +0 -1
  172. package/dist/lib/components/traits/InputTrait.esm.js +0 -45
  173. package/dist/lib/components/traits/InputTrait.esm.js.map +0 -1
@@ -0,0 +1,734 @@
1
+ import { n as e, r as t, t as n } from "./components-PQfnwrHI.js";
2
+ import { c as r, i, n as a, o } from "./lit-C4H1jI4q.js";
3
+ import "./chunk.7MPIABXH-CEYdxYyt.js";
4
+ import { n as s, t as c } from "./decorators-BqWyWiL9.js";
5
+ import { t as l } from "./query-BYu9q8lA.js";
6
+ import "./chevron-down-ujxRg3MD.js";
7
+ //#region node_modules/@lit/task/task.js
8
+ var u = Symbol(), d = class {
9
+ get taskComplete() {
10
+ return this.t || (this.i === 1 ? this.t = new Promise(((e, t) => {
11
+ this.o = e, this.h = t;
12
+ })) : this.i === 3 ? this.t = Promise.reject(this.l) : this.t = Promise.resolve(this.u)), this.t;
13
+ }
14
+ constructor(e, t, n) {
15
+ this.p = 0, this.i = 0, (this._ = e).addController(this);
16
+ let r = typeof t == "object" ? t : {
17
+ task: t,
18
+ args: n
19
+ };
20
+ this.v = r.task, this.j = r.args, this.m = r.argsEqual ?? f, this.k = r.onComplete, this.A = r.onError, this.autoRun = r.autoRun ?? !0, "initialValue" in r && (this.u = r.initialValue, this.i = 2, this.O = this.T?.());
21
+ }
22
+ hostUpdate() {
23
+ !0 === this.autoRun && this.S();
24
+ }
25
+ hostUpdated() {
26
+ this.autoRun === "afterUpdate" && this.S();
27
+ }
28
+ T() {
29
+ if (this.j === void 0) return;
30
+ let e = this.j();
31
+ if (!Array.isArray(e)) throw Error("The args function must return an array");
32
+ return e;
33
+ }
34
+ async S() {
35
+ let e = this.T(), t = this.O;
36
+ this.O = e, e === t || e === void 0 || t !== void 0 && this.m(t, e) || await this.run(e);
37
+ }
38
+ async run(e) {
39
+ let t, n;
40
+ e ??= this.T(), this.O = e, this.i === 1 ? this.q?.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask((() => this._.requestUpdate())) : this._.requestUpdate();
41
+ let r = ++this.p;
42
+ this.q = new AbortController();
43
+ let i = !1;
44
+ try {
45
+ t = await this.v(e, { signal: this.q.signal });
46
+ } catch (e) {
47
+ i = !0, n = e;
48
+ }
49
+ if (this.p === r) {
50
+ if (t === u) this.i = 0;
51
+ else {
52
+ if (!1 === i) {
53
+ try {
54
+ this.k?.(t);
55
+ } catch {}
56
+ this.i = 2, this.o?.(t);
57
+ } else {
58
+ try {
59
+ this.A?.(n);
60
+ } catch {}
61
+ this.i = 3, this.h?.(n);
62
+ }
63
+ this.u = t, this.l = n;
64
+ }
65
+ this._.requestUpdate();
66
+ }
67
+ }
68
+ abort(e) {
69
+ this.i === 1 && this.q?.abort(e);
70
+ }
71
+ get value() {
72
+ return this.u;
73
+ }
74
+ get error() {
75
+ return this.l;
76
+ }
77
+ get status() {
78
+ return this.i;
79
+ }
80
+ render(e) {
81
+ switch (this.i) {
82
+ case 0: return e.initial?.();
83
+ case 1: return e.pending?.();
84
+ case 2: return e.complete?.(this.value);
85
+ case 3: return e.error?.(this.error);
86
+ default: throw Error("Unexpected status: " + this.i);
87
+ }
88
+ }
89
+ }, f = (e, t) => e === t || e.length === t.length && e.every(((e, n) => !o(e, t[n])));
90
+ //#endregion
91
+ //#region src/lib/timing.ts
92
+ function p(e, t) {
93
+ let n = null, r = (...i) => {
94
+ r.cancel(), n = setTimeout(() => t(...i), e);
95
+ };
96
+ return r.cancel = () => {
97
+ n !== null && (clearTimeout(n), n = null);
98
+ }, r;
99
+ }
100
+ //#endregion
101
+ //#region ~icons/svg-spinners/3-dots-fade
102
+ var m = class extends HTMLElement {
103
+ constructor() {
104
+ super(), this.attachShadow({ mode: "open" }).innerHTML = "<style>:host { display: inline-flex; }</style><svg viewBox=\"0 0 24 24\" width=\"100%\" height=\"100%\" ><circle cx=\"4\" cy=\"12\" r=\"3\" fill=\"currentColor\"><animate id=\"SVG7x14Dcom\" fill=\"freeze\" attributeName=\"opacity\" begin=\"0;SVGqSjG0dUp.end-0.25s\" dur=\"0.75s\" values=\"1;.2\"/></circle><circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\" opacity=\".4\"><animate fill=\"freeze\" attributeName=\"opacity\" begin=\"SVG7x14Dcom.begin+0.15s\" dur=\"0.75s\" values=\"1;.2\"/></circle><circle cx=\"20\" cy=\"12\" r=\"3\" fill=\"currentColor\" opacity=\".3\"><animate id=\"SVGqSjG0dUp\" fill=\"freeze\" attributeName=\"opacity\" begin=\"SVG7x14Dcom.begin+0.3s\" dur=\"0.75s\" values=\"1;.2\"/></circle></svg>";
105
+ }
106
+ };
107
+ customElements.get("icon-svg-spinners-3-dots-fade") || customElements.define("icon-svg-spinners-3-dots-fade", m);
108
+ //#endregion
109
+ //#region src/components/combobox/Combobox.styles.css
110
+ var h = r`:host{flex-direction:column;align-items:flex-start;gap:5px;display:inline-flex;& label{color:var(--solid-ui-color-gray-600);font-size:var(--solid-ui-font-size-sm);font-weight:400}& wa-popup{width:100%;display:block}& wa-popup::part(popup){border:1px solid var(--solid-ui-color-gray-100);background:#fff;border-radius:5px;overflow:hidden;box-shadow:0 4px 16px #00000059}& .input-wrapper{width:100%;position:relative;& input{border:1px solid var(--solid-ui-color-gray-400);border-radius:5px;width:100%;padding:10px 40px 10px 10px}& icon-lucide-chevron-down{color:var(--solid-ui-color-gray-500);width:var(--solid-ui-font-size-lg);height:var(--solid-ui-font-size-lg);pointer-events:none;position:absolute;top:50%;right:15px;transform:translateY(-50%)}}& .listbox{max-height:inherit;flex-direction:column;display:flex;overflow:auto;& [role=option],& .non-selectable-option{color:var(--solid-ui-color-gray-700);padding:12px 8px}& [role=option]{border-bottom:1px solid var(--solid-ui-color-gray-100);cursor:pointer;&:hover,&[data-active]{background:#0000000d}}& .non-selectable-option{justify-content:center;align-items:center;display:flex;& icon-svg-spinners-3-dots-fade{width:2rem}& .message--error{color:var(--solid-ui-color-error)}}}}`, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M, N, P, ee, te, ne, re, ie, ae, oe, se, F, I, L, R, z, B, V, H, U, W, G, K, ce, le, ue, de, fe, pe, me, he, ge, _e, ve, ye, be, xe, Se, Ce, we, Te, Ee;
111
+ function q(e, t, n) {
112
+ De(e, t), t.set(e, n);
113
+ }
114
+ function De(e, t) {
115
+ if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
116
+ }
117
+ function J(e, t, n) {
118
+ return e.set(Oe(e, t), n), n;
119
+ }
120
+ function Y(e, t) {
121
+ return e.get(Oe(e, t));
122
+ }
123
+ function Oe(e, t, n) {
124
+ if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
125
+ throw TypeError("Private element is not present on this object");
126
+ }
127
+ function X(e, t, n) {
128
+ return (t = Z(t)) in e ? Object.defineProperty(e, t, {
129
+ value: n,
130
+ enumerable: !0,
131
+ configurable: !0,
132
+ writable: !0
133
+ }) : e[t] = n, e;
134
+ }
135
+ function ke(e, t, n, r, i, a) {
136
+ function o(e, t, n) {
137
+ return function(r, i) {
138
+ return n && n(r), e[t].call(r, i);
139
+ };
140
+ }
141
+ function s(e, t) {
142
+ for (var n = 0; n < e.length; n++) e[n].call(t);
143
+ return t;
144
+ }
145
+ function c(e, t, n, r) {
146
+ if (typeof e != "function" && (r || e !== void 0)) throw TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
147
+ return e;
148
+ }
149
+ function l(e, t, n, r, i, a, s, l, u, d, f, p, m) {
150
+ function h(e) {
151
+ if (!m(e)) throw TypeError("Attempted to access private element on non-instance");
152
+ }
153
+ var g, _ = t[0], v = t[3], y = !l;
154
+ if (!y) {
155
+ n || Array.isArray(_) || (_ = [_]);
156
+ var b = {}, x = [], S = i === 3 ? "get" : i === 4 || p ? "set" : "value";
157
+ d ? (f || p ? b = {
158
+ get: je(function() {
159
+ return v(this);
160
+ }, r, "get"),
161
+ set: function(e) {
162
+ t[4](this, e);
163
+ }
164
+ } : b[S] = v, f || je(b[S], r, i === 2 ? "" : S)) : f || (b = Object.getOwnPropertyDescriptor(e, r));
165
+ }
166
+ for (var C = e, w = _.length - 1; w >= 0; w -= n ? 2 : 1) {
167
+ var T = _[w], E = n ? _[w - 1] : void 0, D = {}, O = {
168
+ kind: [
169
+ "field",
170
+ "accessor",
171
+ "method",
172
+ "getter",
173
+ "setter",
174
+ "class"
175
+ ][i],
176
+ name: r,
177
+ metadata: a,
178
+ addInitializer: function(e, t) {
179
+ if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
180
+ c(t, "An initializer", "be", !0), s.push(t);
181
+ }.bind(null, D)
182
+ };
183
+ try {
184
+ if (y) (g = c(T.call(E, C, O), "class decorators", "return")) && (C = g);
185
+ else {
186
+ var k, A;
187
+ O.static = u, O.private = d, d ? i === 2 ? k = function(e) {
188
+ return h(e), b.value;
189
+ } : (i < 4 && (k = o(b, "get", h)), i !== 3 && (A = o(b, "set", h))) : (k = function(e) {
190
+ return e[r];
191
+ }, (i < 2 || i === 4) && (A = function(e, t) {
192
+ e[r] = t;
193
+ }));
194
+ var j = O.access = { has: d ? m.bind() : function(e) {
195
+ return r in e;
196
+ } };
197
+ if (k && (j.get = k), A && (j.set = A), C = T.call(E, p ? {
198
+ get: b.get,
199
+ set: b.set
200
+ } : b[S], O), p) {
201
+ if (typeof C == "object" && C) (g = c(C.get, "accessor.get")) && (b.get = g), (g = c(C.set, "accessor.set")) && (b.set = g), (g = c(C.init, "accessor.init")) && x.push(g);
202
+ else if (C !== void 0) throw TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
203
+ } else c(C, (f ? "field" : "method") + " decorators", "return") && (f ? x.push(C) : b[S] = C);
204
+ }
205
+ } finally {
206
+ D.v = !0;
207
+ }
208
+ }
209
+ return (f || p) && l.push(function(e, t) {
210
+ for (var n = x.length - 1; n >= 0; n--) t = x[n].call(e, t);
211
+ return t;
212
+ }), f || y || (d ? p ? l.push(o(b, "get"), o(b, "set")) : l.push(i === 2 ? b[S] : o.call.bind(b[S])) : Object.defineProperty(e, r, b)), C;
213
+ }
214
+ function u(e, t) {
215
+ return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), {
216
+ configurable: !0,
217
+ enumerable: !0,
218
+ value: t
219
+ });
220
+ }
221
+ if (arguments.length >= 6) var d = a[Symbol.metadata || Symbol.for("Symbol.metadata")];
222
+ var f = Object.create(d ?? null), p = function(e, t, n, r) {
223
+ var i, a, o = [], c = function(t) {
224
+ return Me(t) === e;
225
+ }, u = /* @__PURE__ */ new Map();
226
+ function d(e) {
227
+ e && o.push(s.bind(null, e));
228
+ }
229
+ for (var f = 0; f < t.length; f++) {
230
+ var p = t[f];
231
+ if (Array.isArray(p)) {
232
+ var m = p[1], h = p[2], g = p.length > 3, _ = 16 & m, v = !!(8 & m), y = (m &= 7) == 0, b = h + "/" + v;
233
+ if (!y && !g) {
234
+ var x = u.get(b);
235
+ if (!0 === x || x === 3 && m !== 4 || x === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
236
+ u.set(b, !(m > 2) || m);
237
+ }
238
+ l(v ? e : e.prototype, p, _, g ? "#" + h : Z(h), m, r, v ? a ||= [] : i ||= [], o, v, g, y, m === 1, v && g ? c : n);
239
+ }
240
+ }
241
+ return d(i), d(a), o;
242
+ }(e, t, i, f);
243
+ return n.length || u(e, f), {
244
+ e: p,
245
+ get c() {
246
+ var t = [];
247
+ return n.length && [u(l(e, [n], r, e.name, 5, f, t), f), s.bind(null, t, e)];
248
+ }
249
+ };
250
+ }
251
+ function Z(e) {
252
+ var t = Ae(e, "string");
253
+ return typeof t == "symbol" ? t : t + "";
254
+ }
255
+ function Ae(e, t) {
256
+ if (typeof e != "object" || !e) return e;
257
+ var n = e[Symbol.toPrimitive];
258
+ if (n !== void 0) {
259
+ var r = n.call(e, t || "default");
260
+ if (typeof r != "object") return r;
261
+ throw TypeError("@@toPrimitive must return a primitive value.");
262
+ }
263
+ return (t === "string" ? String : Number)(e);
264
+ }
265
+ function je(e, t, n) {
266
+ typeof t == "symbol" && (t = (t = t.description) ? "[" + t + "]" : "");
267
+ try {
268
+ Object.defineProperty(e, "name", {
269
+ configurable: !0,
270
+ value: n ? n + " " + t : t
271
+ });
272
+ } catch {}
273
+ return e;
274
+ }
275
+ function Me(e) {
276
+ if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
277
+ return e;
278
+ }
279
+ function Ne(e) {
280
+ return e;
281
+ }
282
+ var Q = class extends Error {};
283
+ function Pe(e) {
284
+ return e;
285
+ }
286
+ ne = [t("solid-ui-combobox")];
287
+ var $;
288
+ new (Te = (v = /*#__PURE__*/ new WeakMap(), y = /*#__PURE__*/ new WeakMap(), b = /*#__PURE__*/ new WeakMap(), x = /*#__PURE__*/ new WeakMap(), S = /*#__PURE__*/ new WeakMap(), C = /*#__PURE__*/ new WeakMap(), w = /*#__PURE__*/ new WeakMap(), T = /*#__PURE__*/ new WeakMap(), E = /*#__PURE__*/ new WeakMap(), D = /*#__PURE__*/ new WeakMap(), O = /*#__PURE__*/ new WeakMap(), k = /*#__PURE__*/ new WeakMap(), A = /*#__PURE__*/ new WeakMap(), j = /*#__PURE__*/ new WeakMap(), M = /*#__PURE__*/ new WeakMap(), N = /*#__PURE__*/ new WeakMap(), P = /*#__PURE__*/ new WeakMap(), Ee = (re = s({
289
+ type: String,
290
+ reflect: !0
291
+ }), ae = s({
292
+ type: String,
293
+ reflect: !0
294
+ }), se = s(), I = s({
295
+ type: String,
296
+ reflect: !0
297
+ }), R = s({
298
+ type: Boolean,
299
+ reflect: !0
300
+ }), B = s({
301
+ type: Boolean,
302
+ reflect: !0,
303
+ attribute: "select-only"
304
+ }), H = s({
305
+ type: String,
306
+ attribute: "async-options-url"
307
+ }), W = s({
308
+ type: String,
309
+ attribute: "async-options-results-field"
310
+ }), K = s({
311
+ type: String,
312
+ attribute: "async-options-label-field"
313
+ }), le = s({
314
+ type: String,
315
+ attribute: "async-options-value-field"
316
+ }), de = s({ type: Function }), pe = s({ type: Array }), he = l("input"), _e = c(), ye = c(), xe = c(), Ce = c(), "label"), _ = class extends e {
317
+ get [Ee]() {
318
+ return Y(v, this);
319
+ }
320
+ set label(e) {
321
+ J(v, this, e);
322
+ }
323
+ get name() {
324
+ return Y(y, this);
325
+ }
326
+ set name(e) {
327
+ J(y, this, e);
328
+ }
329
+ get value() {
330
+ return Y(b, this);
331
+ }
332
+ set value(e) {
333
+ J(b, this, e);
334
+ }
335
+ get placeholder() {
336
+ return Y(x, this);
337
+ }
338
+ set placeholder(e) {
339
+ J(x, this, e);
340
+ }
341
+ get required() {
342
+ return Y(S, this);
343
+ }
344
+ set required(e) {
345
+ J(S, this, e);
346
+ }
347
+ get selectOnly() {
348
+ return Y(C, this);
349
+ }
350
+ set selectOnly(e) {
351
+ J(C, this, e);
352
+ }
353
+ get asyncOptionsUrl() {
354
+ return Y(w, this);
355
+ }
356
+ set asyncOptionsUrl(e) {
357
+ J(w, this, e);
358
+ }
359
+ get asyncOptionsResultsField() {
360
+ return Y(T, this);
361
+ }
362
+ set asyncOptionsResultsField(e) {
363
+ J(T, this, e);
364
+ }
365
+ get asyncOptionsLabelField() {
366
+ return Y(E, this);
367
+ }
368
+ set asyncOptionsLabelField(e) {
369
+ J(E, this, e);
370
+ }
371
+ get asyncOptionsValueField() {
372
+ return Y(D, this);
373
+ }
374
+ set asyncOptionsValueField(e) {
375
+ J(D, this, e);
376
+ }
377
+ get asyncOptionsProvider() {
378
+ return Y(O, this);
379
+ }
380
+ set asyncOptionsProvider(e) {
381
+ J(O, this, e);
382
+ }
383
+ get optionsFallback() {
384
+ return Y(k, this);
385
+ }
386
+ set optionsFallback(e) {
387
+ J(k, this, e);
388
+ }
389
+ get inputElement() {
390
+ return Y(A, this);
391
+ }
392
+ set inputElement(e) {
393
+ J(A, this, e);
394
+ }
395
+ get filter() {
396
+ return Y(j, this);
397
+ }
398
+ set filter(e) {
399
+ J(j, this, e);
400
+ }
401
+ get displayValue() {
402
+ return Y(M, this);
403
+ }
404
+ set displayValue(e) {
405
+ J(M, this, e);
406
+ }
407
+ get open() {
408
+ return Y(N, this);
409
+ }
410
+ set open(e) {
411
+ J(N, this, e);
412
+ }
413
+ get activeIndex() {
414
+ return Y(P, this);
415
+ }
416
+ set activeIndex(e) {
417
+ J(P, this, e);
418
+ }
419
+ constructor() {
420
+ super(), q(this, v, (ee(this), ie(this, ""))), q(this, y, oe(this, "")), q(this, b, F(this, "")), q(this, x, L(this, "")), q(this, S, z(this, !1)), q(this, C, V(this, !1)), q(this, w, U(this, "")), q(this, T, G(this, "")), q(this, E, ce(this, "")), q(this, D, ue(this, "")), q(this, O, fe(this, null)), q(this, k, me(this, null)), q(this, A, ge(this, null)), q(this, j, ve(this, "")), q(this, M, be(this, "")), q(this, N, Se(this, !1)), q(this, P, we(this, -1)), X(this, "controlTrait", void 0), X(this, "openListenersAttached", !1), X(this, "updateDebouncedFilter", p(300, (e) => this.filter = e)), X(this, "asyncOptionsTask", void 0), X(this, "_selectedOption", void 0), X(this, "listboxId", void 0), X(this, "handleDocumentFocusIn", (e) => {
421
+ e.composedPath().includes(this) || this.hide();
422
+ }), X(this, "handleDocumentMouseDown", (e) => {
423
+ e.composedPath().includes(this) || this.hide();
424
+ }), this.controlTrait = this.addTrait(new n(this, {
425
+ getControlElement: () => this.inputElement,
426
+ getInternals: () => this.getInternals()
427
+ })), this.listboxId = `listbox-${this.controlTrait.controlId}`;
428
+ }
429
+ get selectedOption() {
430
+ return this._selectedOption;
431
+ }
432
+ disconnectedCallback() {
433
+ super.disconnectedCallback(), this.removeOpenListeners();
434
+ }
435
+ willUpdate(e) {
436
+ if (super.willUpdate(e), (e.has("asyncOptionsUrl") || e.has("asyncOptionsProvider")) && this.updateAsyncOptionsTask(), e.has("value")) {
437
+ let e = this.getFilteredOptions(), t = e.find((e) => e.selectable !== !1 && e.value === this.value) ?? this.optionsFallback?.find((e) => e.value === this.value), n = t?.selectable !== !1 && t?.label;
438
+ this.updateDisplayValue(n || this.value), this.open && (this.activeIndex = this.getInitialActiveIndex(e)), this._selectedOption && this._selectedOption.value !== this.value && (this._selectedOption = void 0);
439
+ }
440
+ }
441
+ render() {
442
+ let e = this.getFilteredOptions(), t = (this.open && this.activeIndex >= 0 ? e[this.activeIndex] : void 0) === void 0 ? void 0 : this.getOptionId(this.activeIndex), n = this.placeholder || "Combobox";
443
+ return i`
444
+ ${this.controlTrait.renderLabel()}
445
+ <wa-popup
446
+ placement="bottom"
447
+ flip
448
+ shift
449
+ sync="width"
450
+ auto-size="vertical"
451
+ auto-size-padding="10"
452
+ ?active=${this.open}
453
+ >
454
+ <div class="input-wrapper" slot="anchor" @mousedown=${this.onAnchorMouseDown}>
455
+ <input
456
+ id="${this.controlTrait.controlId}"
457
+ type="text"
458
+ name=${this.name}
459
+ placeholder=${this.placeholder}
460
+ role="combobox"
461
+ aria-autocomplete="list"
462
+ aria-haspopup="listbox"
463
+ aria-expanded=${this.open ? "true" : "false"}
464
+ aria-controls=${this.listboxId}
465
+ aria-activedescendant=${t ?? a}
466
+ aria-labelledby=${this.label ? this.controlTrait.labelId : a}
467
+ aria-label=${this.label ? a : n}
468
+ aria-required=${this.required ? "true" : a}
469
+ autocomplete="off"
470
+ spellcheck="false"
471
+ ?required=${this.required}
472
+ .value=${this.displayValue}
473
+ @keydown=${this.onInputKeyDown}
474
+ @focus=${this.onInputFocus}
475
+ @input=${() => this.selectOnly ? this.updateDisplayValue(this.inputElement?.value ?? "") : this.controlTrait.onInput()}
476
+ />
477
+ <icon-lucide-chevron-down></icon-lucide-chevron-down>
478
+ </div>
479
+ <div
480
+ id=${this.listboxId}
481
+ class="listbox"
482
+ role="listbox"
483
+ aria-orientation="vertical"
484
+ aria-labelledby=${this.label ? this.controlTrait.labelId : a}
485
+ aria-label=${this.label ? a : n}
486
+ ?hidden=${!this.open}
487
+ @mousedown=${this.onListboxMouseDown}
488
+ >
489
+ ${e.map((e, t) => e.selectable === !1 ? i`<div class="non-selectable-option">${e.template ?? e.label}</div>` : i`<div
490
+ id=${this.getOptionId(t)}
491
+ role="option"
492
+ aria-selected=${this.open && t === this.activeIndex ? "true" : "false"}
493
+ data-active=${t === this.activeIndex || a}
494
+ @mousemove=${() => this.setActiveIndex(t)}
495
+ >
496
+ ${e.template ?? e.label}
497
+ </div>`)}
498
+ </div>
499
+ </wa-popup>
500
+ `;
501
+ }
502
+ getFilteredOptions() {
503
+ return this.asyncOptionsTask ? this.asyncOptionsTask.render({
504
+ initial: () => this.optionsFallback ?? [],
505
+ complete: (e) => e,
506
+ pending: () => [{
507
+ value: "",
508
+ label: "Loading...",
509
+ template: i`<icon-svg-spinners-3-dots-fade></icon-svg-spinners-3-dots-fade>`,
510
+ selectable: !1
511
+ }],
512
+ error: (e) => {
513
+ let t = !(e instanceof Q), n = Object(e).message ?? "Something went wrong";
514
+ return [{
515
+ value: "",
516
+ label: n,
517
+ template: i`<span class="message message--${t ? "error" : "info"}">${n}</span>`,
518
+ selectable: !1
519
+ }];
520
+ }
521
+ }) : this.getOptionsFromDOM().filter((e) => String(e.label).toLowerCase().includes(this.filter));
522
+ }
523
+ getOptionsFromDOM() {
524
+ let e = this.querySelectorAll("solid-ui-combobox-option");
525
+ return Array.from(e).map((e) => ({
526
+ value: e.value,
527
+ label: e.textContent ?? ""
528
+ }));
529
+ }
530
+ getOptionId(e) {
531
+ return `${this.listboxId}-option-${e}`;
532
+ }
533
+ getInitialActiveIndex(e) {
534
+ let t = e.findIndex((e) => e.value === this.value);
535
+ return t >= 0 ? t : e.length > 0 ? 0 : -1;
536
+ }
537
+ getNextIndex(e, t, n) {
538
+ return t.length === 0 ? -1 : (e + n + t.length) % t.length;
539
+ }
540
+ setActiveIndex(e) {
541
+ this.activeIndex = e;
542
+ }
543
+ updateDisplayValue(e) {
544
+ if (this.displayValue = String(e), this.open) {
545
+ let e = this.displayValue.toLowerCase();
546
+ this.asyncOptionsTask ? this.updateDebouncedFilter(e) : this.filter = e;
547
+ }
548
+ }
549
+ updateAsyncOptionsTask() {
550
+ if (!this.asyncOptionsUrl && !this.asyncOptionsProvider) {
551
+ this.asyncOptionsTask = void 0;
552
+ return;
553
+ }
554
+ this.asyncOptionsTask ??= new d(this, async ([e]) => {
555
+ if (this.asyncOptionsProvider) {
556
+ let t = await this.asyncOptionsProvider(e);
557
+ if (t.length === 0) throw new Q("No results found");
558
+ return t;
559
+ }
560
+ let t = await (await fetch(this.asyncOptionsUrl.replace("%search%", encodeURIComponent(e)))).json(), n = Array.from(this.asyncOptionsResultsField ? t[this.asyncOptionsResultsField] : t);
561
+ if (n.length === 0) throw new Q("No results found");
562
+ let r = this.asyncOptionsLabelField || "label", i = this.asyncOptionsValueField || "value";
563
+ return n.map((e) => ({
564
+ label: String(Object(e)[r]),
565
+ value: Object(e)[i]
566
+ }));
567
+ }, () => [this.filter]);
568
+ }
569
+ show(e) {
570
+ if (this.open) return;
571
+ let t = this.getFilteredOptions();
572
+ t.length !== 0 && (this.open = !0, this.activeIndex = e?.focusLast ? t.length - 1 : this.getInitialActiveIndex(t), this.addOpenListeners(), requestAnimationFrame(() => this.scrollActiveOptionIntoView()));
573
+ }
574
+ hide() {
575
+ this.open && (this.filter = "", this.open = !1, this.activeIndex = -1, this.removeOpenListeners(), this.updateDebouncedFilter.cancel());
576
+ }
577
+ selectOption(e) {
578
+ let t = this.value;
579
+ this._selectedOption = e, this.hide(), this.controlTrait.setValue(e.value), this.inputElement?.focus({ preventScroll: !0 }), this.dispatchEvent(new CustomEvent("change", {
580
+ bubbles: !0,
581
+ composed: !0,
582
+ detail: { option: e }
583
+ })), t === this.value && this.updateDisplayValue(e.label);
584
+ }
585
+ scrollActiveOptionIntoView() {
586
+ this.activeIndex < 0 || this.shadowRoot?.querySelector(`#${this.getOptionId(this.activeIndex)}`)?.scrollIntoView({ block: "nearest" });
587
+ }
588
+ addOpenListeners() {
589
+ if (this.openListenersAttached) return;
590
+ document.addEventListener("focusin", this.handleDocumentFocusIn), document.addEventListener("mousedown", this.handleDocumentMouseDown);
591
+ let e = this.getRootNode();
592
+ e !== document && e.addEventListener("focusin", this.handleDocumentFocusIn), this.openListenersAttached = !0;
593
+ }
594
+ removeOpenListeners() {
595
+ if (!this.openListenersAttached) return;
596
+ document.removeEventListener("focusin", this.handleDocumentFocusIn), document.removeEventListener("mousedown", this.handleDocumentMouseDown);
597
+ let e = this.getRootNode();
598
+ e !== document && e.removeEventListener("focusin", this.handleDocumentFocusIn), this.openListenersAttached = !1;
599
+ }
600
+ onAnchorMouseDown(e) {
601
+ e.target !== this.inputElement && (e.preventDefault(), this.inputElement?.focus({ preventScroll: !0 }));
602
+ }
603
+ onInputFocus() {
604
+ this.show();
605
+ }
606
+ openPopupFromKey(e) {
607
+ this.open || this.show({ focusLast: e });
608
+ }
609
+ onInputKeyDown(e) {
610
+ let t = this.getFilteredOptions();
611
+ switch (e.key) {
612
+ case "ArrowDown":
613
+ e.preventDefault(), this.open ? (this.activeIndex = this.getNextIndex(this.activeIndex, t, 1), this.scrollActiveOptionIntoView()) : this.openPopupFromKey(!1);
614
+ break;
615
+ case "ArrowUp":
616
+ e.preventDefault(), this.open ? (this.activeIndex = this.getNextIndex(this.activeIndex, t, -1), this.scrollActiveOptionIntoView()) : this.openPopupFromKey(!0);
617
+ break;
618
+ case "Enter":
619
+ this.open && this.activeIndex >= 0 && t[this.activeIndex] ? (e.preventDefault(), this.selectOption(t[this.activeIndex])) : this.open || (e.preventDefault(), this.controlTrait.onSubmit());
620
+ break;
621
+ case "Escape":
622
+ this.open && (e.preventDefault(), e.stopPropagation(), this.hide(), this.inputElement?.focus({ preventScroll: !0 }));
623
+ break;
624
+ case "Tab":
625
+ this.hide();
626
+ break;
627
+ default: this.open || this.show();
628
+ }
629
+ }
630
+ onListboxMouseDown(e) {
631
+ if (e.preventDefault(), !(e.target instanceof HTMLElement)) return;
632
+ let t = e.target.closest("[role=\"option\"]");
633
+ if (!t) return;
634
+ let n = t.id, r = Number.parseInt(n.replace(`${this.listboxId}-option-`, ""), 10), i = this.getFilteredOptions()[r];
635
+ i && this.selectOption(i);
636
+ }
637
+ }, {e: [ie, oe, F, L, z, V, U, G, ce, ue, fe, me, ge, ve, be, Se, we, ee], c: [$, te]} = ke(_, [
638
+ [
639
+ re,
640
+ 1,
641
+ "label"
642
+ ],
643
+ [
644
+ ae,
645
+ 1,
646
+ "name"
647
+ ],
648
+ [
649
+ se,
650
+ 1,
651
+ "value"
652
+ ],
653
+ [
654
+ I,
655
+ 1,
656
+ "placeholder"
657
+ ],
658
+ [
659
+ R,
660
+ 1,
661
+ "required"
662
+ ],
663
+ [
664
+ B,
665
+ 1,
666
+ "selectOnly"
667
+ ],
668
+ [
669
+ H,
670
+ 1,
671
+ "asyncOptionsUrl"
672
+ ],
673
+ [
674
+ W,
675
+ 1,
676
+ "asyncOptionsResultsField"
677
+ ],
678
+ [
679
+ K,
680
+ 1,
681
+ "asyncOptionsLabelField"
682
+ ],
683
+ [
684
+ le,
685
+ 1,
686
+ "asyncOptionsValueField"
687
+ ],
688
+ [
689
+ de,
690
+ 1,
691
+ "asyncOptionsProvider"
692
+ ],
693
+ [
694
+ pe,
695
+ 1,
696
+ "optionsFallback"
697
+ ],
698
+ [
699
+ he,
700
+ 1,
701
+ "inputElement"
702
+ ],
703
+ [
704
+ _e,
705
+ 1,
706
+ "filter"
707
+ ],
708
+ [
709
+ ye,
710
+ 1,
711
+ "displayValue"
712
+ ],
713
+ [
714
+ xe,
715
+ 1,
716
+ "open"
717
+ ],
718
+ [
719
+ Ce,
720
+ 1,
721
+ "activeIndex"
722
+ ]
723
+ ], ne, 0, void 0, e), _), g = class extends Ne {
724
+ constructor() {
725
+ super($), X(this, "styles", h), X(this, "formAssociated", !0), te();
726
+ }
727
+ }, X(g, Te, void 0), g)();
728
+ //#endregion
729
+ //#region src/components/combobox/index.ts
730
+ var Fe = $;
731
+ //#endregion
732
+ export { $ as n, Pe as r, Fe as t };
733
+
734
+ //# sourceMappingURL=combobox-Dav1bNHS.js.map