@adamosuiteservices/ui 2.18.6 → 2.19.1

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 (194) hide show
  1. package/README.md +1 -1
  2. package/dist/accordion-rounded.cjs +8 -8
  3. package/dist/accordion-rounded.js +12 -12
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.js +1 -1
  6. package/dist/alert.cjs +32 -23
  7. package/dist/alert.js +53 -43
  8. package/dist/amount-input.cjs +8 -0
  9. package/dist/amount-input.js +191 -0
  10. package/dist/avatar.cjs +7 -7
  11. package/dist/avatar.js +18 -18
  12. package/dist/badge.cjs +24 -28
  13. package/dist/badge.js +45 -42
  14. package/dist/breadcrumb.cjs +3 -4
  15. package/dist/breadcrumb.js +17 -18
  16. package/dist/button-CPm4-98H.cjs +87 -0
  17. package/dist/button-D4ddrxyp.js +156 -0
  18. package/dist/button-group.cjs +1 -1
  19. package/dist/button-group.js +1 -1
  20. package/dist/button.cjs +1 -1
  21. package/dist/button.js +1 -1
  22. package/dist/{calendar-Dorq3-wv.cjs → calendar-DXq90PYV.cjs} +20 -22
  23. package/dist/{calendar-xBaFu2sB.js → calendar-DgfO9zab.js} +239 -240
  24. package/dist/calendar.cjs +1 -1
  25. package/dist/calendar.js +1 -1
  26. package/dist/card.cjs +3 -3
  27. package/dist/card.js +4 -4
  28. package/dist/checkbox-CIzBdqN7.cjs +24 -0
  29. package/dist/{checkbox-DL_jFvgl.js → checkbox-DPlUjwLi.js} +54 -52
  30. package/dist/checkbox.cjs +1 -1
  31. package/dist/checkbox.js +1 -1
  32. package/dist/colors.css +1 -1
  33. package/dist/combobox-DG9u4g84.js +692 -0
  34. package/dist/combobox-DylTjGrw.cjs +57 -0
  35. package/dist/combobox.cjs +1 -1
  36. package/dist/combobox.js +1 -1
  37. package/dist/components/layout/sidebar/sidebar.d.ts +2 -1
  38. package/dist/components/layout/toaster/toaster.d.ts +1 -1
  39. package/dist/components/ui/alert/alert.d.ts +1 -1
  40. package/dist/components/ui/amount-input/amount-input.d.ts +32 -0
  41. package/dist/components/ui/amount-input/index.d.ts +1 -0
  42. package/dist/components/ui/badge/badge.d.ts +3 -2
  43. package/dist/components/ui/calendar/calendar.d.ts +1 -1
  44. package/dist/components/ui/combobox/combobox.d.ts +3 -1
  45. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +3 -1
  46. package/dist/components/ui/selectable-card/index.d.ts +1 -0
  47. package/dist/components/ui/selectable-card/selectable-card.d.ts +22 -0
  48. package/dist/components/ui/timeline/index.d.ts +1 -0
  49. package/dist/components/ui/timeline/timeline.d.ts +30 -0
  50. package/dist/components/ui/typography/typography.d.ts +1 -1
  51. package/dist/context-menu.cjs +18 -19
  52. package/dist/context-menu.js +37 -38
  53. package/dist/date-picker-selector.cjs +1 -1
  54. package/dist/date-picker-selector.js +3 -3
  55. package/dist/dialog.cjs +7 -9
  56. package/dist/dialog.js +36 -38
  57. package/dist/dropdown-menu.cjs +57 -36
  58. package/dist/dropdown-menu.js +206 -173
  59. package/dist/field.cjs +12 -7
  60. package/dist/field.js +51 -45
  61. package/dist/file-upload-v2.cjs +11 -5
  62. package/dist/file-upload-v2.js +75 -60
  63. package/dist/file-upload.cjs +11 -5
  64. package/dist/file-upload.js +118 -110
  65. package/dist/full-screen-loader.cjs +1 -1
  66. package/dist/full-screen-loader.js +1 -1
  67. package/dist/{icon-B7joBr0A.cjs → icon-C5Q2b1Am.cjs} +1 -1
  68. package/dist/{icon-BFQz1tQC.js → icon-t4jt1Z2h.js} +1 -1
  69. package/dist/icon.cjs +1 -1
  70. package/dist/icon.js +1 -1
  71. package/dist/index-BBT2EGq8.js +18 -0
  72. package/dist/index-DCsgSkBj.cjs +1 -0
  73. package/dist/input-8sEO5zwD.js +44 -0
  74. package/dist/input-AONeSXcs.cjs +22 -0
  75. package/dist/input-group-BLffLxyg.cjs +86 -0
  76. package/dist/input-group-DmevJAqa.js +240 -0
  77. package/dist/input-group.cjs +1 -84
  78. package/dist/input-group.js +7 -234
  79. package/dist/input-otp.cjs +5 -7
  80. package/dist/input-otp.js +58 -60
  81. package/dist/input.cjs +1 -1
  82. package/dist/input.js +1 -1
  83. package/dist/kbd.cjs +6 -7
  84. package/dist/kbd.js +14 -15
  85. package/dist/{label-DqfX9cHc.cjs → label-B7Z1D5-Q.cjs} +5 -4
  86. package/dist/{label-C6zVnc3d.js → label-_BWRIH7C.js} +14 -13
  87. package/dist/label.cjs +1 -1
  88. package/dist/label.js +1 -1
  89. package/dist/pagination.cjs +5 -5
  90. package/dist/pagination.js +18 -18
  91. package/dist/radio-group.cjs +12 -9
  92. package/dist/radio-group.js +66 -63
  93. package/dist/select.cjs +18 -16
  94. package/dist/select.js +18 -16
  95. package/dist/selectable-card.cjs +29 -0
  96. package/dist/selectable-card.js +129 -0
  97. package/dist/separator-DXdc7LcC.cjs +7 -0
  98. package/dist/{separator-CsaqP20m.js → separator-DZfXXbNt.js} +1 -1
  99. package/dist/separator.cjs +1 -1
  100. package/dist/separator.js +1 -1
  101. package/dist/{sheet-Cnq7TCzu.cjs → sheet-Cp6JGhWC.cjs} +10 -10
  102. package/dist/{sheet-C9vce0ut.js → sheet-hWerE8S1.js} +9 -6
  103. package/dist/sheet.cjs +1 -1
  104. package/dist/sheet.js +1 -1
  105. package/dist/sidebar.cjs +10 -10
  106. package/dist/sidebar.js +83 -92
  107. package/dist/slider.cjs +1 -1
  108. package/dist/slider.js +1 -1
  109. package/dist/{spinner-C7q7NthY.cjs → spinner-DUZ2vcus.cjs} +1 -1
  110. package/dist/{spinner-DQ5JLL3U.js → spinner-_-J3zJ_g.js} +1 -1
  111. package/dist/spinner.cjs +1 -1
  112. package/dist/spinner.js +1 -1
  113. package/dist/styles.css +1 -1
  114. package/dist/switch.cjs +2 -4
  115. package/dist/switch.js +71 -73
  116. package/dist/table.cjs +14 -14
  117. package/dist/table.js +12 -12
  118. package/dist/tabs-underline.cjs +11 -15
  119. package/dist/tabs-underline.js +20 -24
  120. package/dist/tabs.cjs +10 -14
  121. package/dist/tabs.js +20 -24
  122. package/dist/tailwind-colors.css +1 -1
  123. package/dist/tailwind-theme.css +1 -1
  124. package/dist/textarea-BSooGyp-.cjs +18 -0
  125. package/dist/textarea-D_sj6ivo.js +39 -0
  126. package/dist/textarea.cjs +1 -1
  127. package/dist/textarea.js +1 -1
  128. package/dist/themes.css +1 -1
  129. package/dist/timeline.cjs +4 -0
  130. package/dist/timeline.js +189 -0
  131. package/dist/toaster.cjs +5 -4
  132. package/dist/toaster.js +33 -32
  133. package/dist/toggle.cjs +4 -4
  134. package/dist/toggle.js +17 -17
  135. package/dist/tooltip.cjs +5 -6
  136. package/dist/tooltip.js +4 -5
  137. package/docs/components/layout/sidebar.md +81 -53
  138. package/docs/components/layout/toaster.md +35 -55
  139. package/docs/components/ui/accordion-rounded.md +12 -11
  140. package/docs/components/ui/alert.md +66 -36
  141. package/docs/components/ui/amount-input.md +229 -0
  142. package/docs/components/ui/avatar.md +28 -32
  143. package/docs/components/ui/badge.md +85 -32
  144. package/docs/components/ui/breadcrumb.md +5 -7
  145. package/docs/components/ui/button-group.md +16 -16
  146. package/docs/components/ui/button.md +23 -36
  147. package/docs/components/ui/calendar.md +54 -27
  148. package/docs/components/ui/card.md +5 -4
  149. package/docs/components/ui/checkbox.md +3 -3
  150. package/docs/components/ui/combobox.md +35 -1
  151. package/docs/components/ui/command.md +7 -7
  152. package/docs/components/ui/context-menu.md +14 -15
  153. package/docs/components/ui/date-picker-selector.md +31 -31
  154. package/docs/components/ui/dialog.md +47 -49
  155. package/docs/components/ui/dropdown-menu.md +34 -37
  156. package/docs/components/ui/field.md +25 -31
  157. package/docs/components/ui/file-upload-v2.md +11 -0
  158. package/docs/components/ui/file-upload.md +105 -108
  159. package/docs/components/ui/hover-card.md +28 -6
  160. package/docs/components/ui/icon.md +10 -9
  161. package/docs/components/ui/input-group.md +9 -9
  162. package/docs/components/ui/input.md +30 -33
  163. package/docs/components/ui/kbd.md +10 -9
  164. package/docs/components/ui/label.md +6 -6
  165. package/docs/components/ui/pagination.md +3 -3
  166. package/docs/components/ui/popover.md +1 -0
  167. package/docs/components/ui/progress.md +3 -3
  168. package/docs/components/ui/radio-group.md +18 -6
  169. package/docs/components/ui/scroll-area.md +4 -4
  170. package/docs/components/ui/select.md +14 -12
  171. package/docs/components/ui/selectable-card.md +204 -0
  172. package/docs/components/ui/separator.md +4 -4
  173. package/docs/components/ui/sheet.md +21 -3
  174. package/docs/components/ui/slider.md +3 -3
  175. package/docs/components/ui/switch.md +7 -7
  176. package/docs/components/ui/table.md +7 -4
  177. package/docs/components/ui/tabs-underline.md +36 -36
  178. package/docs/components/ui/tabs.md +6 -4
  179. package/docs/components/ui/textarea.md +6 -4
  180. package/docs/components/ui/timeline.md +214 -0
  181. package/docs/components/ui/toggle.md +1 -1
  182. package/docs/components/ui/tooltip.md +3 -3
  183. package/llm.txt +7 -4
  184. package/package.json +13 -1
  185. package/dist/button-BnUlAtuD.js +0 -132
  186. package/dist/button-CFJs0esR.cjs +0 -63
  187. package/dist/checkbox-3RIZX2HF.cjs +0 -22
  188. package/dist/combobox-MkeJiTXj.js +0 -637
  189. package/dist/combobox-jJRxvUsB.cjs +0 -40
  190. package/dist/input-BCiOr4Fy.js +0 -44
  191. package/dist/input-Bz5k4w94.cjs +0 -22
  192. package/dist/separator-CCGaTo09.cjs +0 -7
  193. package/dist/textarea-BRCnIxdB.js +0 -33
  194. package/dist/textarea-DkFUS_oS.cjs +0 -14
@@ -0,0 +1,692 @@
1
+ "use client";
2
+ import { j as s } from "./jsx-runtime-BzflLqGi.js";
3
+ import { B as Ne } from "./button-D4ddrxyp.js";
4
+ import { C as Le } from "./checkbox-DPlUjwLi.js";
5
+ import { I as ne } from "./icon-t4jt1Z2h.js";
6
+ import { c as $ } from "./index-CRiPKpXj.js";
7
+ import * as l from "react";
8
+ import { useRef as $e, useState as ge, useCallback as Me, useEffect as Pe } from "react";
9
+ import { R as De, P as ze, O as Fe, a as Te } from "./index-BIydBVaH.js";
10
+ import { P as T } from "./index-BMWt1NBG.js";
11
+ import { u as X } from "./index-Cv867SGx.js";
12
+ import { c as le } from "./index-DLcqcWxM.js";
13
+ import { P as Ve, a as Ke, b as qe } from "./popover-DcQ18EVl.js";
14
+ var be = 1, _e = 0.9, Be = 0.8, Oe = 0.17, se = 0.1, me = 0.999, We = 0.9999, Ge = 0.99, Ue = /[\\\/_+.#"@\[\(\{&]/, He = /[\\\/_+.#"@\[\(\{&]/g, Je = /[\s-]/, we = /[\s-]/g;
15
+ function pe(e, a, r, v, d, m, f) {
16
+ if (m === a.length) return d === e.length ? be : Ge;
17
+ var h = `${d},${m}`;
18
+ if (f[h] !== void 0) return f[h];
19
+ for (var x = v.charAt(m), o = r.indexOf(x, d), w = 0, c, S, I, N; o >= 0; ) c = pe(e, a, r, v, o + 1, m + 1, f), c > w && (o === d ? c *= be : Ue.test(e.charAt(o - 1)) ? (c *= Be, I = e.slice(d, o - 1).match(He), I && d > 0 && (c *= Math.pow(me, I.length))) : Je.test(e.charAt(o - 1)) ? (c *= _e, N = e.slice(d, o - 1).match(we), N && d > 0 && (c *= Math.pow(me, N.length))) : (c *= Oe, d > 0 && (c *= Math.pow(me, o - d))), e.charAt(o) !== a.charAt(m) && (c *= We)), (c < se && r.charAt(o - 1) === v.charAt(m + 1) || v.charAt(m + 1) === v.charAt(m) && r.charAt(o - 1) !== v.charAt(m)) && (S = pe(e, a, r, v, o + 1, m + 2, f), S * se > c && (c = S * se)), c > w && (w = c), o = r.indexOf(x, o + 1);
20
+ return f[h] = w, w;
21
+ }
22
+ function xe(e) {
23
+ return e.toLowerCase().replace(we, " ");
24
+ }
25
+ function Xe(e, a, r) {
26
+ return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, pe(e, a, xe(e), xe(a), 0, 0, {});
27
+ }
28
+ var ae = '[cmdk-group=""]', fe = '[cmdk-group-items=""]', Ye = '[cmdk-group-heading=""]', Ee = '[cmdk-item=""]', ye = `${Ee}:not([aria-disabled="true"])`, he = "cmdk-item-select", H = "data-value", Qe = (e, a, r) => Xe(e, a, r), ke = l.createContext(void 0), ie = () => l.useContext(ke), Se = l.createContext(void 0), ve = () => l.useContext(Se), Ce = l.createContext(void 0), Ie = l.forwardRef((e, a) => {
29
+ let r = J(() => {
30
+ var t, u;
31
+ return { search: "", value: (u = (t = e.value) != null ? t : e.defaultValue) != null ? u : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
32
+ }), v = J(() => /* @__PURE__ */ new Set()), d = J(() => /* @__PURE__ */ new Map()), m = J(() => /* @__PURE__ */ new Map()), f = J(() => /* @__PURE__ */ new Set()), h = je(e), { label: x, children: o, value: w, onValueChange: c, filter: S, shouldFilter: I, loop: N, disablePointerSelection: V = !1, vimBindings: L = !0, ...j } = e, B = X(), K = X(), O = X(), M = l.useRef(null), k = ut();
33
+ _(() => {
34
+ if (w !== void 0) {
35
+ let t = w.trim();
36
+ r.current.value = t, p.emit();
37
+ }
38
+ }, [w]), _(() => {
39
+ k(6, G);
40
+ }, []);
41
+ let p = l.useMemo(() => ({ subscribe: (t) => (f.current.add(t), () => f.current.delete(t)), snapshot: () => r.current, setState: (t, u, g) => {
42
+ var i, b, E, n;
43
+ if (!Object.is(r.current[t], u)) {
44
+ if (r.current[t] = u, t === "search") Q(), de(), k(1, R);
45
+ else if (t === "value") {
46
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
47
+ let y = document.getElementById(O);
48
+ y ? y.focus() : (i = document.getElementById(B)) == null || i.focus();
49
+ }
50
+ if (k(7, () => {
51
+ var y;
52
+ r.current.selectedItemId = (y = A()) == null ? void 0 : y.id, p.emit();
53
+ }), g || k(5, G), ((b = h.current) == null ? void 0 : b.value) !== void 0) {
54
+ let y = u ?? "";
55
+ (n = (E = h.current).onValueChange) == null || n.call(E, y);
56
+ return;
57
+ }
58
+ }
59
+ p.emit();
60
+ }
61
+ }, emit: () => {
62
+ f.current.forEach((t) => t());
63
+ } }), []), W = l.useMemo(() => ({ value: (t, u, g) => {
64
+ var i;
65
+ u !== ((i = m.current.get(t)) == null ? void 0 : i.value) && (m.current.set(t, { value: u, keywords: g }), r.current.filtered.items.set(t, P(u, g)), k(2, () => {
66
+ de(), p.emit();
67
+ }));
68
+ }, item: (t, u) => (v.current.add(t), u && (d.current.has(u) ? d.current.get(u).add(t) : d.current.set(u, /* @__PURE__ */ new Set([t]))), k(3, () => {
69
+ Q(), de(), r.current.value || R(), p.emit();
70
+ }), () => {
71
+ m.current.delete(t), v.current.delete(t), r.current.filtered.items.delete(t);
72
+ let g = A();
73
+ k(4, () => {
74
+ Q(), g?.getAttribute("id") === t && R(), p.emit();
75
+ });
76
+ }), group: (t) => (d.current.has(t) || d.current.set(t, /* @__PURE__ */ new Set()), () => {
77
+ m.current.delete(t), d.current.delete(t);
78
+ }), filter: () => h.current.shouldFilter, label: x || e["aria-label"], getDisablePointerSelection: () => h.current.disablePointerSelection, listId: B, inputId: O, labelId: K, listInnerRef: M }), []);
79
+ function P(t, u) {
80
+ var g, i;
81
+ let b = (i = (g = h.current) == null ? void 0 : g.filter) != null ? i : Qe;
82
+ return t ? b(t, r.current.search, u) : 0;
83
+ }
84
+ function de() {
85
+ if (!r.current.search || h.current.shouldFilter === !1) return;
86
+ let t = r.current.filtered.items, u = [];
87
+ r.current.filtered.groups.forEach((i) => {
88
+ let b = d.current.get(i), E = 0;
89
+ b.forEach((n) => {
90
+ let y = t.get(n);
91
+ E = Math.max(y, E);
92
+ }), u.push([i, E]);
93
+ });
94
+ let g = M.current;
95
+ D().sort((i, b) => {
96
+ var E, n;
97
+ let y = i.getAttribute("id"), C = b.getAttribute("id");
98
+ return ((E = t.get(C)) != null ? E : 0) - ((n = t.get(y)) != null ? n : 0);
99
+ }).forEach((i) => {
100
+ let b = i.closest(fe);
101
+ b ? b.appendChild(i.parentElement === b ? i : i.closest(`${fe} > *`)) : g.appendChild(i.parentElement === g ? i : i.closest(`${fe} > *`));
102
+ }), u.sort((i, b) => b[1] - i[1]).forEach((i) => {
103
+ var b;
104
+ let E = (b = M.current) == null ? void 0 : b.querySelector(`${ae}[${H}="${encodeURIComponent(i[0])}"]`);
105
+ E?.parentElement.appendChild(E);
106
+ });
107
+ }
108
+ function R() {
109
+ let t = D().find((g) => g.getAttribute("aria-disabled") !== "true"), u = t?.getAttribute(H);
110
+ p.setState("value", u || void 0);
111
+ }
112
+ function Q() {
113
+ var t, u, g, i;
114
+ if (!r.current.search || h.current.shouldFilter === !1) {
115
+ r.current.filtered.count = v.current.size;
116
+ return;
117
+ }
118
+ r.current.filtered.groups = /* @__PURE__ */ new Set();
119
+ let b = 0;
120
+ for (let E of v.current) {
121
+ let n = (u = (t = m.current.get(E)) == null ? void 0 : t.value) != null ? u : "", y = (i = (g = m.current.get(E)) == null ? void 0 : g.keywords) != null ? i : [], C = P(n, y);
122
+ r.current.filtered.items.set(E, C), C > 0 && b++;
123
+ }
124
+ for (let [E, n] of d.current) for (let y of n) if (r.current.filtered.items.get(y) > 0) {
125
+ r.current.filtered.groups.add(E);
126
+ break;
127
+ }
128
+ r.current.filtered.count = b;
129
+ }
130
+ function G() {
131
+ var t, u, g;
132
+ let i = A();
133
+ i && (((t = i.parentElement) == null ? void 0 : t.firstChild) === i && ((g = (u = i.closest(ae)) == null ? void 0 : u.querySelector(Ye)) == null || g.scrollIntoView({ block: "nearest" })), i.scrollIntoView({ block: "nearest" }));
134
+ }
135
+ function A() {
136
+ var t;
137
+ return (t = M.current) == null ? void 0 : t.querySelector(`${Ee}[aria-selected="true"]`);
138
+ }
139
+ function D() {
140
+ var t;
141
+ return Array.from(((t = M.current) == null ? void 0 : t.querySelectorAll(ye)) || []);
142
+ }
143
+ function Z(t) {
144
+ let u = D()[t];
145
+ u && p.setState("value", u.getAttribute(H));
146
+ }
147
+ function z(t) {
148
+ var u;
149
+ let g = A(), i = D(), b = i.findIndex((n) => n === g), E = i[b + t];
150
+ (u = h.current) != null && u.loop && (E = b + t < 0 ? i[i.length - 1] : b + t === i.length ? i[0] : i[b + t]), E && p.setState("value", E.getAttribute(H));
151
+ }
152
+ function ee(t) {
153
+ let u = A(), g = u?.closest(ae), i;
154
+ for (; g && !i; ) g = t > 0 ? dt(g, ae) : ot(g, ae), i = g?.querySelector(ye);
155
+ i ? p.setState("value", i.getAttribute(H)) : z(t);
156
+ }
157
+ let U = () => Z(D().length - 1), oe = (t) => {
158
+ t.preventDefault(), t.metaKey ? U() : t.altKey ? ee(1) : z(1);
159
+ }, te = (t) => {
160
+ t.preventDefault(), t.metaKey ? Z(0) : t.altKey ? ee(-1) : z(-1);
161
+ };
162
+ return l.createElement(T.div, { ref: a, tabIndex: -1, ...j, "cmdk-root": "", onKeyDown: (t) => {
163
+ var u;
164
+ (u = j.onKeyDown) == null || u.call(j, t);
165
+ let g = t.nativeEvent.isComposing || t.keyCode === 229;
166
+ if (!(t.defaultPrevented || g)) switch (t.key) {
167
+ case "n":
168
+ case "j": {
169
+ L && t.ctrlKey && oe(t);
170
+ break;
171
+ }
172
+ case "ArrowDown": {
173
+ oe(t);
174
+ break;
175
+ }
176
+ case "p":
177
+ case "k": {
178
+ L && t.ctrlKey && te(t);
179
+ break;
180
+ }
181
+ case "ArrowUp": {
182
+ te(t);
183
+ break;
184
+ }
185
+ case "Home": {
186
+ t.preventDefault(), Z(0);
187
+ break;
188
+ }
189
+ case "End": {
190
+ t.preventDefault(), U();
191
+ break;
192
+ }
193
+ case "Enter": {
194
+ t.preventDefault();
195
+ let i = A();
196
+ if (i) {
197
+ let b = new Event(he);
198
+ i.dispatchEvent(b);
199
+ }
200
+ }
201
+ }
202
+ } }, l.createElement("label", { "cmdk-label": "", htmlFor: W.inputId, id: W.labelId, style: st }, x), ce(e, (t) => l.createElement(Se.Provider, { value: p }, l.createElement(ke.Provider, { value: W }, t))));
203
+ }), Ze = l.forwardRef((e, a) => {
204
+ var r, v;
205
+ let d = X(), m = l.useRef(null), f = l.useContext(Ce), h = ie(), x = je(e), o = (v = (r = x.current) == null ? void 0 : r.forceMount) != null ? v : f?.forceMount;
206
+ _(() => {
207
+ if (!o) return h.item(d, f?.id);
208
+ }, [o]);
209
+ let w = Re(d, m, [e.value, e.children, m], e.keywords), c = ve(), S = F((k) => k.value && k.value === w.current), I = F((k) => o || h.filter() === !1 ? !0 : k.search ? k.filtered.items.get(d) > 0 : !0);
210
+ l.useEffect(() => {
211
+ let k = m.current;
212
+ if (!(!k || e.disabled)) return k.addEventListener(he, N), () => k.removeEventListener(he, N);
213
+ }, [I, e.onSelect, e.disabled]);
214
+ function N() {
215
+ var k, p;
216
+ V(), (p = (k = x.current).onSelect) == null || p.call(k, w.current);
217
+ }
218
+ function V() {
219
+ c.setState("value", w.current, !0);
220
+ }
221
+ if (!I) return null;
222
+ let { disabled: L, value: j, onSelect: B, forceMount: K, keywords: O, ...M } = e;
223
+ return l.createElement(T.div, { ref: le(m, a), ...M, id: d, "cmdk-item": "", role: "option", "aria-disabled": !!L, "aria-selected": !!S, "data-disabled": !!L, "data-selected": !!S, onPointerMove: L || h.getDisablePointerSelection() ? void 0 : V, onClick: L ? void 0 : N }, e.children);
224
+ }), et = l.forwardRef((e, a) => {
225
+ let { heading: r, children: v, forceMount: d, ...m } = e, f = X(), h = l.useRef(null), x = l.useRef(null), o = X(), w = ie(), c = F((I) => d || w.filter() === !1 ? !0 : I.search ? I.filtered.groups.has(f) : !0);
226
+ _(() => w.group(f), []), Re(f, h, [e.value, e.heading, x]);
227
+ let S = l.useMemo(() => ({ id: f, forceMount: d }), [d]);
228
+ return l.createElement(T.div, { ref: le(h, a), ...m, "cmdk-group": "", role: "presentation", hidden: c ? void 0 : !0 }, r && l.createElement("div", { ref: x, "cmdk-group-heading": "", "aria-hidden": !0, id: o }, r), ce(e, (I) => l.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? o : void 0 }, l.createElement(Ce.Provider, { value: S }, I))));
229
+ }), tt = l.forwardRef((e, a) => {
230
+ let { alwaysRender: r, ...v } = e, d = l.useRef(null), m = F((f) => !f.search);
231
+ return !r && !m ? null : l.createElement(T.div, { ref: le(d, a), ...v, "cmdk-separator": "", role: "separator" });
232
+ }), rt = l.forwardRef((e, a) => {
233
+ let { onValueChange: r, ...v } = e, d = e.value != null, m = ve(), f = F((o) => o.search), h = F((o) => o.selectedItemId), x = ie();
234
+ return l.useEffect(() => {
235
+ e.value != null && m.setState("search", e.value);
236
+ }, [e.value]), l.createElement(T.input, { ref: a, ...v, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": x.listId, "aria-labelledby": x.labelId, "aria-activedescendant": h, id: x.inputId, type: "text", value: d ? e.value : f, onChange: (o) => {
237
+ d || m.setState("search", o.target.value), r?.(o.target.value);
238
+ } });
239
+ }), at = l.forwardRef((e, a) => {
240
+ let { children: r, label: v = "Suggestions", ...d } = e, m = l.useRef(null), f = l.useRef(null), h = F((o) => o.selectedItemId), x = ie();
241
+ return l.useEffect(() => {
242
+ if (f.current && m.current) {
243
+ let o = f.current, w = m.current, c, S = new ResizeObserver(() => {
244
+ c = requestAnimationFrame(() => {
245
+ let I = o.offsetHeight;
246
+ w.style.setProperty("--cmdk-list-height", I.toFixed(1) + "px");
247
+ });
248
+ });
249
+ return S.observe(o), () => {
250
+ cancelAnimationFrame(c), S.unobserve(o);
251
+ };
252
+ }
253
+ }, []), l.createElement(T.div, { ref: le(m, a), ...d, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": h, "aria-label": v, id: x.listId }, ce(e, (o) => l.createElement("div", { ref: le(f, x.listInnerRef), "cmdk-list-sizer": "" }, o)));
254
+ }), nt = l.forwardRef((e, a) => {
255
+ let { open: r, onOpenChange: v, overlayClassName: d, contentClassName: m, container: f, ...h } = e;
256
+ return l.createElement(De, { open: r, onOpenChange: v }, l.createElement(ze, { container: f }, l.createElement(Fe, { "cmdk-overlay": "", className: d }), l.createElement(Te, { "aria-label": e.label, "cmdk-dialog": "", className: m }, l.createElement(Ie, { ref: a, ...h }))));
257
+ }), lt = l.forwardRef((e, a) => F((r) => r.filtered.count === 0) ? l.createElement(T.div, { ref: a, ...e, "cmdk-empty": "", role: "presentation" }) : null), it = l.forwardRef((e, a) => {
258
+ let { progress: r, children: v, label: d = "Loading...", ...m } = e;
259
+ return l.createElement(T.div, { ref: a, ...m, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": d }, ce(e, (f) => l.createElement("div", { "aria-hidden": !0 }, f)));
260
+ }), Y = Object.assign(Ie, { List: at, Item: Ze, Input: rt, Group: et, Separator: tt, Dialog: nt, Empty: lt, Loading: it });
261
+ function dt(e, a) {
262
+ let r = e.nextElementSibling;
263
+ for (; r; ) {
264
+ if (r.matches(a)) return r;
265
+ r = r.nextElementSibling;
266
+ }
267
+ }
268
+ function ot(e, a) {
269
+ let r = e.previousElementSibling;
270
+ for (; r; ) {
271
+ if (r.matches(a)) return r;
272
+ r = r.previousElementSibling;
273
+ }
274
+ }
275
+ function je(e) {
276
+ let a = l.useRef(e);
277
+ return _(() => {
278
+ a.current = e;
279
+ }), a;
280
+ }
281
+ var _ = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
282
+ function J(e) {
283
+ let a = l.useRef();
284
+ return a.current === void 0 && (a.current = e()), a;
285
+ }
286
+ function F(e) {
287
+ let a = ve(), r = () => e(a.snapshot());
288
+ return l.useSyncExternalStore(a.subscribe, r, r);
289
+ }
290
+ function Re(e, a, r, v = []) {
291
+ let d = l.useRef(), m = ie();
292
+ return _(() => {
293
+ var f;
294
+ let h = (() => {
295
+ var o;
296
+ for (let w of r) {
297
+ if (typeof w == "string") return w.trim();
298
+ if (typeof w == "object" && "current" in w) return w.current ? (o = w.current.textContent) == null ? void 0 : o.trim() : d.current;
299
+ }
300
+ })(), x = v.map((o) => o.trim());
301
+ m.value(e, h, x), (f = a.current) == null || f.setAttribute(H, h), d.current = h;
302
+ }), d;
303
+ }
304
+ var ut = () => {
305
+ let [e, a] = l.useState(), r = J(() => /* @__PURE__ */ new Map());
306
+ return _(() => {
307
+ r.current.forEach((v) => v()), r.current = /* @__PURE__ */ new Map();
308
+ }, [e]), (v, d) => {
309
+ r.current.set(v, d), a({});
310
+ };
311
+ };
312
+ function ct(e) {
313
+ let a = e.type;
314
+ return typeof a == "function" ? a(e.props) : "render" in a ? a.render(e.props) : e;
315
+ }
316
+ function ce({ asChild: e, children: a }, r) {
317
+ return e && l.isValidElement(a) ? l.cloneElement(ct(a), { ref: a.ref }, r(a.props.children)) : r(a);
318
+ }
319
+ var st = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
320
+ function mt({
321
+ className: e,
322
+ ...a
323
+ }) {
324
+ return /* @__PURE__ */ s.jsx(
325
+ Y,
326
+ {
327
+ "data-slot": "command",
328
+ className: $(
329
+ `
330
+ adm:flex adm:h-full adm:w-full adm:flex-col adm:overflow-hidden
331
+ adm:rounded-md adm:bg-popover adm:text-popover-foreground
332
+ `,
333
+ e
334
+ ),
335
+ ...a
336
+ }
337
+ );
338
+ }
339
+ function ft({
340
+ className: e,
341
+ ...a
342
+ }) {
343
+ return /* @__PURE__ */ s.jsxs(
344
+ "div",
345
+ {
346
+ "data-slot": "command-input-wrapper",
347
+ className: `
348
+ adm:flex adm:h-10 adm:items-center adm:gap-2
349
+ adm:rounded-t-[calc(var(--radius)-1px)] adm:border-b adm:px-3
350
+ adm:*:data-[slot=icon]:shrink-0 adm:*:data-[slot=icon]:text-2xl
351
+ adm:*:data-[slot=icon]:opacity-50
352
+ `,
353
+ children: [
354
+ /* @__PURE__ */ s.jsx(ne, { symbol: "search" }),
355
+ /* @__PURE__ */ s.jsx(
356
+ Y.Input,
357
+ {
358
+ "data-slot": "command-input",
359
+ className: $(
360
+ `
361
+ adm:flex adm:h-10 adm:w-full adm:rounded-md adm:bg-transparent
362
+ adm:py-3 adm:text-sm adm:outline-hidden
363
+ adm:placeholder:text-muted-foreground
364
+ adm:disabled:cursor-not-allowed adm:disabled:opacity-50
365
+ `,
366
+ e
367
+ ),
368
+ ...a
369
+ }
370
+ )
371
+ ]
372
+ }
373
+ );
374
+ }
375
+ function pt({
376
+ className: e,
377
+ ...a
378
+ }) {
379
+ return /* @__PURE__ */ s.jsx(
380
+ Y.List,
381
+ {
382
+ "data-slot": "command-list",
383
+ className: $(
384
+ `
385
+ adm:max-h-[300px] adm:scroll-py-1 adm:overflow-x-hidden
386
+ adm:overflow-y-auto
387
+ `,
388
+ e
389
+ ),
390
+ ...a
391
+ }
392
+ );
393
+ }
394
+ function ht({
395
+ className: e,
396
+ ...a
397
+ }) {
398
+ return /* @__PURE__ */ s.jsx(
399
+ Y.Empty,
400
+ {
401
+ "data-slot": "command-empty",
402
+ className: $("adm:py-6 adm:text-center adm:text-sm", e),
403
+ ...a
404
+ }
405
+ );
406
+ }
407
+ function vt({
408
+ className: e,
409
+ ...a
410
+ }) {
411
+ return /* @__PURE__ */ s.jsx(
412
+ Y.Group,
413
+ {
414
+ "data-slot": "command-group",
415
+ className: $(
416
+ `
417
+ adm:overflow-hidden adm:text-foreground
418
+ adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
419
+ adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
420
+ adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
421
+ adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
422
+ adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-muted-foreground
423
+ adm:[&_[data-slot=command-item]:last-of-type]:rounded-b-[calc(var(--radius)-1px)]
424
+ adm:[&_[data-slot=command-item]:last-of-type]:border-b-0
425
+ `,
426
+ e
427
+ ),
428
+ ...a
429
+ }
430
+ );
431
+ }
432
+ function gt({
433
+ className: e,
434
+ ...a
435
+ }) {
436
+ return /* @__PURE__ */ s.jsx(
437
+ Y.Item,
438
+ {
439
+ "data-slot": "command-item",
440
+ className: $(
441
+ `
442
+ adm:relative adm:flex adm:min-h-11 adm:cursor-default adm:items-center
443
+ adm:gap-3 adm:border-b adm:border-divider adm:px-4 adm:text-sm
444
+ adm:outline-hidden adm:select-none
445
+ adm:data-[disabled=true]:pointer-events-none
446
+ adm:data-[disabled=true]:opacity-50
447
+ adm:data-[selected=true]:bg-muted
448
+ adm:data-[selected=true]:text-foreground
449
+ adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
450
+ adm:[&_svg:not([class*=size-])]:size-4
451
+ adm:[&_svg:not([class*=text-])]:text-muted-foreground
452
+ `,
453
+ e
454
+ ),
455
+ ...a
456
+ }
457
+ );
458
+ }
459
+ function At({
460
+ searchable: e,
461
+ multiple: a,
462
+ icon: r,
463
+ value: v,
464
+ onValueChange: d,
465
+ labels: m,
466
+ options: f,
467
+ classNames: h,
468
+ selectedFeedback: x = "checkbox",
469
+ alwaysShowPlaceholder: o = !1,
470
+ valuePosition: w = "right",
471
+ renders: c,
472
+ ref: S,
473
+ "aria-invalid": I,
474
+ disabled: N,
475
+ searchBy: V = "both",
476
+ filter: L,
477
+ exclusiveOption: j
478
+ }) {
479
+ const B = $e(null), [K, O] = ge(!1), [M, k] = ge(a ? [] : ""), p = v !== void 0 ? v : M, W = (n) => j === n, P = Me((n) => {
480
+ d ? d(n) : k(n);
481
+ }, [d]);
482
+ Pe(() => {
483
+ if (a && j && Array.isArray(p) && p.length > 1) {
484
+ const n = p.includes(j), y = p.filter((C) => C !== j);
485
+ n && y.length > 0 && (console.warn(
486
+ `Combobox: Initial value contains exclusive option "${j}" mixed with others. Auto-correcting to only exclusive option.`
487
+ ), P([j]));
488
+ }
489
+ j && !f.find((n) => n.value === j) && console.warn(
490
+ `Combobox: exclusiveOption "${j}" not found in options. Exclusive behavior will be disabled.`
491
+ );
492
+ }, [p, j, a, f, P]);
493
+ const R = { ...{
494
+ placeholder: "Select options...",
495
+ searchPlaceholder: "Search options...",
496
+ noItemsFound: "No options found.",
497
+ multipleSelected: (n) => `${n} options selected`
498
+ }, ...m }, Q = (n, y, C) => {
499
+ const q = y.toLowerCase().trim(), ue = n.toLowerCase().trim();
500
+ return L ? L(n, y, C) : V === "label" && C && C.length > 0 ? C[0].toLowerCase().trim().includes(q) ? 1 : 0 : V === "value" ? ue.includes(q) ? 1 : 0 : V === "both" && (C && C.length > 0 && C[0].toLowerCase().trim().includes(q) || ue.includes(q)) ? 1 : 0;
501
+ }, G = () => a && Array.isArray(p) ? p.length === 0 ? null : p.length === 1 ? f.find((n) => n.value === p[0])?.label : R.multipleSelected?.(p.length) || `${p.length} options selected` : !a && typeof p == "string" && p ? f.find((n) => n.value === p)?.label : null, A = () => a && Array.isArray(p) ? p.length > 0 : typeof p == "string" && p !== "", D = (n) => a && Array.isArray(p) ? p.includes(n) : p === n, Z = (n) => {
502
+ if (a) {
503
+ const y = Array.isArray(p) ? p : [];
504
+ if (y.includes(n)) {
505
+ const re = y.filter((Ae) => Ae !== n);
506
+ P(re);
507
+ return;
508
+ }
509
+ if (W(n)) {
510
+ P([n]);
511
+ return;
512
+ }
513
+ const ue = [...y.filter((re) => !W(re)), n];
514
+ P(ue);
515
+ } else
516
+ P(n === p ? "" : n), O(!1);
517
+ }, z = (n) => {
518
+ const y = D(n), C = f.find((q) => q.value === n);
519
+ return c?.selectedFeedback ? c.selectedFeedback({
520
+ option: C,
521
+ isSelected: y,
522
+ type: x
523
+ }) : x === "check" ? /* @__PURE__ */ s.jsx(
524
+ "span",
525
+ {
526
+ className: $(`
527
+ adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
528
+ adm:justify-center
529
+ `, h?.check),
530
+ children: y && /* @__PURE__ */ s.jsx(
531
+ ne,
532
+ {
533
+ symbol: "check",
534
+ className: "adm:text-xl adm:text-success"
535
+ }
536
+ )
537
+ }
538
+ ) : /* @__PURE__ */ s.jsx(
539
+ Le,
540
+ {
541
+ checked: y,
542
+ className: h?.checkbox
543
+ }
544
+ );
545
+ }, ee = () => c?.placeholder ? c.placeholder({
546
+ text: R.placeholder || "",
547
+ hasValue: A()
548
+ }) : /* @__PURE__ */ s.jsx(
549
+ "span",
550
+ {
551
+ className: `
552
+ adm:opacity-70
553
+ adm:group-disabled:opacity-100
554
+ `,
555
+ children: R.placeholder
556
+ }
557
+ ), U = () => c?.displayValue ? c.displayValue({
558
+ text: G() ?? null,
559
+ value: p
560
+ }) : /* @__PURE__ */ s.jsx("span", { children: G() }), oe = () => o ? /* @__PURE__ */ s.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
561
+ r && /* @__PURE__ */ s.jsx(
562
+ ne,
563
+ {
564
+ symbol: r,
565
+ className: `
566
+ adm:opacity-50
567
+ adm:group-disabled:opacity-100
568
+ `
569
+ }
570
+ ),
571
+ ee(),
572
+ A() && w === "left" && U()
573
+ ] }) : /* @__PURE__ */ s.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
574
+ r && /* @__PURE__ */ s.jsx(
575
+ ne,
576
+ {
577
+ symbol: r,
578
+ className: `
579
+ adm:opacity-50
580
+ adm:group-disabled:opacity-100
581
+ `
582
+ }
583
+ ),
584
+ A() ? U() : ee()
585
+ ] }), te = () => c?.triggerIcon ? c.triggerIcon({
586
+ open: K
587
+ }) : /* @__PURE__ */ s.jsx(
588
+ ne,
589
+ {
590
+ symbol: "expand_more",
591
+ className: `
592
+ adm:opacity-50
593
+ adm:group-disabled:opacity-100
594
+ `
595
+ }
596
+ ), t = () => o && A() && w === "right" ? /* @__PURE__ */ s.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
597
+ U(),
598
+ te()
599
+ ] }) : /* @__PURE__ */ s.jsx("span", { className: "adm:flex adm:items-center adm:gap-2", children: te() }), u = () => c?.trigger ? c.trigger({
600
+ open: K,
601
+ value: p,
602
+ displayText: G() || "",
603
+ placeholder: R.placeholder || "",
604
+ hasValue: A(),
605
+ icon: r
606
+ }) : /* @__PURE__ */ s.jsxs(
607
+ Ne,
608
+ {
609
+ ref: (n) => {
610
+ B.current = n, S && (typeof S == "function" ? S(n) : S.current = n);
611
+ },
612
+ variant: "outline",
613
+ role: "combobox",
614
+ "aria-expanded": K,
615
+ "aria-invalid": I,
616
+ disabled: N,
617
+ className: $(`
618
+ adm:group adm:justify-between adm:rounded-md adm:font-normal
619
+ adm:hover:bg-muted
620
+ `, h?.trigger),
621
+ children: [
622
+ oe(),
623
+ t()
624
+ ]
625
+ }
626
+ ), g = () => e ? c?.searchInput ? c.searchInput({
627
+ placeholder: R.searchPlaceholder || ""
628
+ }) : /* @__PURE__ */ s.jsx(
629
+ ft,
630
+ {
631
+ placeholder: R.searchPlaceholder,
632
+ className: h?.input
633
+ }
634
+ ) : null, i = () => c?.empty ? c.empty({
635
+ text: R.noItemsFound || ""
636
+ }) : /* @__PURE__ */ s.jsx(s.Fragment, { children: R.noItemsFound }), b = (n) => c?.optionLabel ? c.optionLabel({
637
+ option: n
638
+ }) : /* @__PURE__ */ s.jsx(s.Fragment, { children: n.label }), E = (n) => c?.option ? /* @__PURE__ */ s.jsx("div", { children: c.option({
639
+ option: n,
640
+ isSelected: D(n.value),
641
+ selectedFeedback: x
642
+ }) }, n.value) : /* @__PURE__ */ s.jsx(
643
+ gt,
644
+ {
645
+ value: n.value,
646
+ keywords: [n.label],
647
+ onSelect: Z,
648
+ disabled: n.disabled,
649
+ className: $(
650
+ h?.item,
651
+ x === "check" && "adm:pr-10",
652
+ n.supportiveText && `
653
+ adm:flex-col adm:items-start adm:gap-2 adm:py-3
654
+ `
655
+ ),
656
+ children: n.supportiveText ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
657
+ /* @__PURE__ */ s.jsxs("div", { className: "adm:flex adm:w-full adm:items-center adm:gap-3", children: [
658
+ x === "checkbox" && z(n.value),
659
+ /* @__PURE__ */ s.jsx("span", { className: "adm:flex-1", children: b(n) }),
660
+ x === "check" && z(n.value)
661
+ ] }),
662
+ /* @__PURE__ */ s.jsx("p", { className: "adm:w-full adm:text-sm adm:text-muted-foreground", children: n.supportiveText })
663
+ ] }) : /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
664
+ x === "checkbox" && z(n.value),
665
+ b(n),
666
+ x === "check" && z(n.value)
667
+ ] })
668
+ },
669
+ n.value
670
+ );
671
+ return /* @__PURE__ */ s.jsxs(Ve, { open: K, onOpenChange: O, children: [
672
+ /* @__PURE__ */ s.jsx(Ke, { asChild: !0, children: u() }),
673
+ /* @__PURE__ */ s.jsx(
674
+ qe,
675
+ {
676
+ align: "start",
677
+ className: $("adm:p-0", h?.popover),
678
+ style: { minWidth: B.current?.offsetWidth },
679
+ children: /* @__PURE__ */ s.jsxs(mt, { filter: Q, className: h?.command, children: [
680
+ g(),
681
+ /* @__PURE__ */ s.jsxs(pt, { className: h?.list, children: [
682
+ /* @__PURE__ */ s.jsx(ht, { className: h?.empty, children: i() }),
683
+ /* @__PURE__ */ s.jsx(vt, { className: h?.group, children: f.map((n) => E(n)) })
684
+ ] })
685
+ ] })
686
+ }
687
+ )
688
+ ] });
689
+ }
690
+ export {
691
+ At as C
692
+ };