@adamosuiteservices/ui 2.18.5 → 2.19.0

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