@spear-ai/spectral 1.9.1 → 1.10.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 (241) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +113 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -141
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -66
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputNumeric.d.ts +14 -0
  128. package/dist/InputNumeric.js +137 -0
  129. package/dist/InputOTP-cVn5Bzyp.js +461 -0
  130. package/dist/InputOTP.js +2 -382
  131. package/dist/Kbd.d.ts +1 -1
  132. package/dist/Kbd.js +182 -86
  133. package/dist/Label.js +12 -14
  134. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  135. package/dist/MultiSelect.d.ts +1 -1
  136. package/dist/MultiSelect.js +23 -23
  137. package/dist/Popover.js +28 -32
  138. package/dist/RadioButton.d.ts +17 -0
  139. package/dist/RadioButton.js +33 -0
  140. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  141. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  142. package/dist/RadioButtonGroup.d.ts +1 -1
  143. package/dist/RadioButtonGroup.js +11 -8
  144. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  145. package/dist/RadioGroup.js +2 -505
  146. package/dist/Select.js +163 -186
  147. package/dist/Separator.js +16 -19
  148. package/dist/Skeleton.js +10 -6
  149. package/dist/Slider-BzzZT3Zm.js +490 -0
  150. package/dist/Slider.js +2 -562
  151. package/dist/SpectralProvider.js +8 -5
  152. package/dist/Switch/SwitchBase.js +91 -95
  153. package/dist/Switch-CVzRJ-0n.js +126 -0
  154. package/dist/Switch.d.ts +1 -1
  155. package/dist/Switch.js +2 -134
  156. package/dist/Tabs/TabsBase.js +242 -250
  157. package/dist/Tabs/tabsUtils.js +65 -73
  158. package/dist/Tabs.d.ts +1 -1
  159. package/dist/Tabs.js +73 -103
  160. package/dist/Textarea/TextareaUtils.js +35 -46
  161. package/dist/Textarea.js +83 -160
  162. package/dist/Toast-9zqXxKKO.js +711 -0
  163. package/dist/Toast.js +2 -885
  164. package/dist/Toggle/ToggleBase.js +46 -56
  165. package/dist/Toggle.d.ts +1 -1
  166. package/dist/Toggle.js +52 -62
  167. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  168. package/dist/ToggleGroup.d.ts +1 -1
  169. package/dist/ToggleGroup.js +52 -63
  170. package/dist/Tooltip-D1K8kY1y.js +389 -0
  171. package/dist/Tooltip.js +2 -365
  172. package/dist/Tray.js +174 -217
  173. package/dist/chunk-h9knIhTc.js +20 -0
  174. package/dist/clsx-jM1GlMvB.js +16 -0
  175. package/dist/dist-3Af8168y.js +913 -0
  176. package/dist/dist-7HRQ5IKN.js +249 -0
  177. package/dist/dist-B2k1iWFp.js +129 -0
  178. package/dist/dist-B4FgboI8.js +122 -0
  179. package/dist/dist-B4g6zpUF.js +33 -0
  180. package/dist/dist-B9tup-4O.js +216 -0
  181. package/dist/dist-BK1K0g9W.js +29 -0
  182. package/dist/dist-Bfjk-jx9.js +28 -0
  183. package/dist/dist-Bft31cJh.js +65 -0
  184. package/dist/dist-BtdmHAzK.js +190 -0
  185. package/dist/dist-C0Hifjgh.js +1287 -0
  186. package/dist/dist-CGzgmYB9.js +68 -0
  187. package/dist/dist-ClmepHp4.js +10 -0
  188. package/dist/dist-D8Wb_MX9.js +6 -0
  189. package/dist/dist-Dtvmk11N.js +12 -0
  190. package/dist/dist-fW81qjVl.js +677 -0
  191. package/dist/dist-s1uWaZYZ.js +11 -0
  192. package/dist/es2015-YHaMV-St.js +701 -0
  193. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  194. package/dist/hooks/useControllableState.js +14 -13
  195. package/dist/hooks/useConvertToOklch.d.ts +3 -0
  196. package/dist/hooks/useConvertToOklch.d.ts.map +1 -0
  197. package/dist/hooks/useConvertToOklch.js +51 -0
  198. package/dist/hooks/useTheme.js +21 -17
  199. package/dist/index.d.ts +3 -1
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/main.js +18954 -27224
  202. package/dist/primitives/button.js +39 -41
  203. package/dist/primitives/input-group.js +57 -73
  204. package/dist/primitives/input.js +11 -20
  205. package/dist/primitives/popover.js +34 -28
  206. package/dist/primitives/select.js +70 -138
  207. package/dist/primitives/slot.js +32 -31
  208. package/dist/primitives/textarea.js +10 -16
  209. package/dist/proxy-Dn10Pl_g.js +4920 -0
  210. package/dist/styles/main.css +2 -1
  211. package/dist/styles/spectral.css +1 -1
  212. package/dist/twUtils-VNWgstKL.js +1673 -0
  213. package/dist/use-animation-CBUDycyW.js +57 -0
  214. package/dist/utils/constants.js +4 -4
  215. package/dist/utils/formFieldUtils.js +136 -148
  216. package/dist/utils/sharedUtils.js +26 -7
  217. package/dist/utils/twUtils.js +2 -2919
  218. package/package.json +24 -28
  219. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  220. package/dist/clsx-OuTLNxxd.js +0 -16
  221. package/dist/index-0ioNhtNM.js +0 -10
  222. package/dist/index-6oYKCvIn.js +0 -677
  223. package/dist/index-BFOf48AQ.js +0 -69
  224. package/dist/index-BZPx6jYI.js +0 -8
  225. package/dist/index-BlHU_t18.js +0 -142
  226. package/dist/index-Bm1RbF6w.js +0 -1037
  227. package/dist/index-Bv2OIg5P.js +0 -225
  228. package/dist/index-CKEI0pDv.js +0 -56
  229. package/dist/index-CM_hWgfC.js +0 -32
  230. package/dist/index-C_YVr64u.js +0 -1538
  231. package/dist/index-Cl8VeY0o.js +0 -149
  232. package/dist/index-CwSyIPrv.js +0 -13
  233. package/dist/index-D29mdTf5.js +0 -34
  234. package/dist/index-DEYs15GP.js +0 -66
  235. package/dist/index-Dc0No4pV.js +0 -233
  236. package/dist/index-T6XEa11q.js +0 -822
  237. package/dist/index-pBCLb6Gr.js +0 -240
  238. package/dist/index-psiVrsnE.js +0 -27
  239. package/dist/index-rKs9bXHr.js +0 -6
  240. package/dist/proxy-CO_-Vget.js +0 -4975
  241. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -1,406 +1,334 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsxs as c, jsx as s, Fragment as ce } from "react/jsx-runtime";
4
- import "../Icons/AnalyzeIcon.js";
5
- import "../Icons/AnnotationsIcon.js";
6
- import "../Icons/ApprovedIcon.js";
7
- import "../Icons/ArrowDownIcon.js";
8
- import "../Icons/ArrowUpIcon.js";
9
- import "../Icons/BoxToolIcon.js";
10
- import "../Icons/CalendarIcon.js";
11
- import "../Icons/CheckCircleIcon.js";
12
- import "../Icons/CheckSquareIcon.js";
13
- import { CheckmarkIcon as pe } from "../Icons/CheckmarkIcon.js";
14
- import { ChevronDownIcon as ue } from "../Icons/ChevronDownIcon.js";
15
- import "../Icons/ChevronUpIcon.js";
16
- import "../Icons/ClockIcon.js";
17
- import "../Icons/CloseCircleIcon.js";
18
- import { CloseIcon as W } from "../Icons/CloseIcon.js";
19
- import "../Icons/DashboardIcon.js";
20
- import "../Icons/DatabaseIcon.js";
21
- import "../Icons/DeleteIcon.js";
22
- import "../Icons/DurationIcon.js";
23
- import "../Icons/EditIcon.js";
24
- import "../Icons/EmailIcon.js";
25
- import "../Icons/EraserIcon.js";
26
- import "../Icons/ErrorIcon.js";
27
- import "../Icons/EyeClosedIcon.js";
28
- import "../Icons/EyeClosedIcon2.js";
29
- import "../Icons/EyeOpenIcon.js";
30
- import "../Icons/FileDownloadIcon.js";
31
- import "../Icons/GoToFirstIcon.js";
32
- import "../Icons/GoToLastIcon.js";
33
- import "../Icons/HarmonicCursorsIcon.js";
34
- import "../Icons/InfoIcon.js";
35
- import "../Icons/KeyboardIcon.js";
36
- import "../Icons/LabelIcon.js";
37
- import "../Icons/LassoIcon.js";
38
- import "../Icons/LineToolIcon.js";
39
- import "../Icons/LiveViewIcon.js";
40
- import { LoaderIcon as me } from "../Icons/LoaderIcon.js";
41
- import "../Icons/LocationIcon.js";
42
- import "../Icons/LogoutIcon.js";
43
- import "../Icons/MeasureIcon.js";
44
- import "../Icons/MessagesIcon.js";
45
- import "../Icons/MetadataIcon.js";
46
- import "../Icons/MinusIcon.js";
47
- import "../Icons/OntologyIcon.js";
48
- import "../Icons/PanelIconClose.js";
49
- import "../Icons/PanelIconOpen.js";
50
- import "../Icons/PlayIcon.js";
51
- import "../Icons/PlusIcon.js";
52
- import "../Icons/PolygonIcon.js";
53
- import "../Icons/ResetIcon.js";
54
- import "../Icons/ReviewedIcon.js";
55
- import "../Icons/ScissorsIcon.js";
56
- import { SearchIcon as fe } from "../Icons/SearchIcon.js";
57
- import "../Icons/SettingsIcon.js";
58
- import "../Icons/SortAscendingIcon.js";
59
- import "../Icons/SortAtoZIcon.js";
60
- import "../Icons/SortDescendingIcon.js";
61
- import "../Icons/SortZtoAIcon.js";
62
- import "../Icons/StackIcon.js";
63
- import "../Icons/StarIcon.js";
64
- import "../Icons/TrashIcon.js";
65
- import "../Icons/UndoIcon.js";
66
- import "../Icons/User2Icon.js";
67
- import "../Icons/UserIcon.js";
68
- import "../Icons/WarningIcon.js";
69
- import "../Icons/ZoomAllIcon.js";
70
- import "../Icons/ZoomXIcon.js";
71
- import "../Icons/ZoomYIcon.js";
72
- import { R as be, T as ge, P as he, C as xe } from "../index-Bv2OIg5P.js";
73
- import { ErrorMessage as ye } from "../utils/formFieldUtils.js";
74
- import { cn as y } from "../utils/twUtils.js";
75
- import { useId as ve, useState as V, useRef as we, useMemo as v, useCallback as w, useEffect as Ne } from "react";
76
- const Ie = "h-4 w-4", Ce = (b) => ({
77
- error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
78
- loading: "cursor-wait border-input-border--disabled",
79
- disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
80
- default: ""
81
- })[b], ke = (b, g, m) => y(
82
- "flex min-h-12 max-h-[5.5rem] w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-2 text-sm",
83
- "hover:border-input-border--hover focus-visible:border-input-border--focus",
84
- "focus-visible:outline focus-visible:outline-accent focus-visible:outline-offset-2 focus:outline-none",
85
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
86
- "transition duration-200 text-input-text overflow-hidden",
87
- g && "border-input-border--focus",
88
- Ce(b),
89
- m
90
- ), De = () => y(
91
- "z-50 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
92
- "motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out",
93
- "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0",
94
- "motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95",
95
- "motion-safe:data-[side=bottom]:slide-in-from-top-2",
96
- "motion-safe:data-[side=top]:slide-in-from-bottom-2",
97
- "origin-(--radix-popover-content-transform-origin)"
98
- ), Oe = (b, g, m, C, N, S, F, j, E) => {
99
- const [t, d] = V(-1), r = v(() => {
100
- const o = [];
101
- return F && o.push({ type: "search" }), j && o.push({ type: "select-all" }), b.forEach((p, f) => {
102
- p.disabled || o.push({ type: "option", index: f, value: p.value });
103
- }), o;
104
- }, [b, F, j, E]), x = w(
105
- (o) => {
106
- if (o < 0 || o >= r.length) return;
107
- r[o].type === "search" && S.current?.focus();
108
- },
109
- [r, S]
110
- ), M = w(
111
- (o) => {
112
- const p = t >= 0 && t < r.length ? r[t] : null;
113
- if (o.key === " " && p?.type === "search" || o.key === "Enter" && p?.type === "search")
114
- return;
115
- const n = {
116
- ArrowDown: () => {
117
- o.preventDefault();
118
- const l = Math.min(t + 1, r.length - 1);
119
- d(l), x(l);
120
- },
121
- ArrowUp: () => {
122
- o.preventDefault();
123
- const l = Math.max(t - 1, 0);
124
- d(l), x(l);
125
- },
126
- Tab: () => {
127
- if (o.shiftKey)
128
- if (t <= 0)
129
- m();
130
- else {
131
- o.preventDefault();
132
- const l = t - 1;
133
- d(l), x(l);
134
- }
135
- else if (t >= r.length - 1)
136
- m();
137
- else {
138
- o.preventDefault();
139
- const l = t + 1;
140
- d(l), x(l);
141
- }
142
- },
143
- Enter: () => {
144
- if (o.preventDefault(), t >= 0 && t < r.length) {
145
- const l = r[t];
146
- l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" && C(l.value);
147
- }
148
- },
149
- " ": () => {
150
- if (o.preventDefault(), t >= 0 && t < r.length) {
151
- const l = r[t];
152
- l.type === "select-all" ? N() : l.type === "clear-all" ? g() : l.type === "option" && C(l.value);
153
- }
154
- },
155
- Escape: () => {
156
- o.preventDefault(), m();
157
- }
158
- }[o.key];
159
- n && n();
160
- },
161
- [r, t, C, N, g, m, x]
162
- ), P = w(
163
- (o) => {
164
- if (t < 0 || t >= r.length) return !1;
165
- const p = r[t];
166
- return p.type === "option" && p.index === o;
167
- },
168
- [t, r]
169
- ), K = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "search", [t, r]), L = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "select-all", [t, r]), k = v(() => t < 0 || t >= r.length ? !1 : r[t].type === "clear-all", [t, r]);
170
- return {
171
- focusedIndex: t,
172
- setFocusedIndex: d,
173
- handleKeyDown: M,
174
- getOptionFocusIndex: P,
175
- isSearchFocused: K,
176
- isSelectAllFocused: L,
177
- isClearAllFocused: k
178
- };
179
- }, Se = ({
180
- className: b,
181
- clearAllLabel: g = "Clear all",
182
- closeOnSelect: m = !1,
183
- emptyMessage: C = "No options found",
184
- errorMessage: N,
185
- id: S,
186
- label: F,
187
- loadingMessage: j = "Loading options…",
188
- maxCount: E = 3,
189
- name: t,
190
- onChange: d,
191
- options: r = [],
192
- placeholder: x = "Select options",
193
- ref: M,
194
- searchPlaceholder: P = "Search options…",
195
- selectAllLabel: K = "Select all",
196
- showClearAll: L = !0,
197
- showSearch: k = !0,
198
- showSelectAll: o = !0,
199
- sortAlphabetically: p = !1,
200
- state: f = "default",
201
- value: n = [],
202
- "aria-label": l,
203
- "aria-describedby": X,
204
- ...H
205
- }) => {
206
- const Y = ve(), z = S ?? `${t}-${Y}`, _ = `${z}-listbox`, G = `${z}-error`, [h, T] = V(!1), [$, ee] = V(""), B = we(null), U = H.disabled ?? f === "disabled", te = f === "loading", re = f === "error", D = v(() => {
207
- let e = r.filter((a) => a.label.toLowerCase().includes($.toLowerCase()));
208
- return p && (e = [...e].sort((a, i) => a.label.localeCompare(i.label))), e;
209
- }, [r, $, p]), O = v(() => {
210
- const e = {}, a = [];
211
- return D.forEach((i) => {
212
- i.group ? (e[i.group] || (e[i.group] = []), e[i.group].push(i)) : a.push(i);
213
- }), { groups: e, ungrouped: a, hasGroups: Object.keys(e).length > 0 };
214
- }, [D]), R = w(
215
- (e) => {
216
- if (r.find((u) => u.value === e)?.disabled) return;
217
- const i = n.includes(e) ? n.filter((u) => u !== e) : [...n, e];
218
- d(i), m && T(!1);
219
- },
220
- [r, n, d, m]
221
- ), Z = w(() => {
222
- const e = r.filter((i) => !i.disabled).map((i) => i.value), a = e.every((i) => n.includes(i));
223
- d(a ? [] : e);
224
- }, [r, n, d]), q = w(() => {
225
- d([]);
226
- }, [d]), J = v(() => r.filter((e) => !e.disabled).map((e) => e.value), [r]), ie = J.length > 0 && J.every((e) => n.includes(e)), { getOptionFocusIndex: se, handleKeyDown: oe, isSelectAllFocused: le, setFocusedIndex: A } = Oe(
227
- D,
228
- q,
229
- () => T(!1),
230
- R,
231
- Z,
232
- B,
233
- k,
234
- o,
235
- !1
236
- // No separate clear-all button in dropdown
237
- );
238
- Ne(() => {
239
- A(h ? 0 : -1);
240
- }, [h, A]);
241
- const ae = w((e) => {
242
- ee(e.target.value);
243
- }, []), ne = () => {
244
- if (n.length === 0)
245
- return /* @__PURE__ */ s("span", { className: "text-input-text-placeholder flex min-h-8 items-center", children: x });
246
- const e = n.slice(0, E), a = n.length - E;
247
- return /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1 overflow-hidden", children: [
248
- e.map((i) => {
249
- const u = r.find((I) => I.value === i);
250
- return u ? /* @__PURE__ */ c("span", { className: "bg-input-bg--selected text-input-text inline-flex max-w-48 items-center gap-1 rounded-md px-2 py-1 text-xs", children: [
251
- /* @__PURE__ */ s("span", { className: "truncate", children: u.label }),
252
- /* @__PURE__ */ s(
253
- "button",
254
- {
255
- "aria-label": `Remove ${u.label}`,
256
- className: "hover:text-danger cursor-pointer rounded-sm",
257
- "data-testid": "spectral-multiselect-remove-item-button",
258
- onClick: (I) => {
259
- I.preventDefault(), I.stopPropagation(), R(i);
260
- },
261
- onPointerDown: (I) => {
262
- I.stopPropagation();
263
- },
264
- type: "button",
265
- children: /* @__PURE__ */ s(W, { size: 12 })
266
- }
267
- )
268
- ] }, i) : null;
269
- }),
270
- a > 0 && /* @__PURE__ */ c("span", { className: "text-input-text-secondary flex items-center py-1 text-xs", children: [
271
- "+",
272
- a,
273
- " more"
274
- ] })
275
- ] });
276
- }, Q = (e, a) => {
277
- const i = n.includes(e.value), u = se(a);
278
- return /* @__PURE__ */ c(
279
- "button",
280
- {
281
- className: y(
282
- "hover:bg-input-bg--hover focus-visible:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-left text-sm focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
283
- u && "bg-input-bg--hover",
284
- i && "text-input-text font-medium"
285
- ),
286
- disabled: e.disabled,
287
- onClick: () => R(e.value),
288
- type: "button",
289
- children: [
290
- /* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-selected-indicator", className: y("border-input-border flex h-4 w-4 items-center justify-center rounded border", i && "bg-primary border-primary"), children: i && /* @__PURE__ */ s(pe, { size: 12 }) }),
291
- /* @__PURE__ */ s("span", { children: e.label })
292
- ]
293
- },
294
- e.value
295
- );
296
- }, de = () => ({
297
- "--multiselect-border-radius": "0.5rem",
298
- "--multiselect-trigger-height": "3rem",
299
- "--multiselect-dropdown-max-height": "20rem"
300
- });
301
- return /* @__PURE__ */ c("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
302
- /* @__PURE__ */ s(be, { open: h, onOpenChange: T, children: /* @__PURE__ */ c("div", { className: "relative", "data-testid": "spectral-multiselect-wrapper", onKeyDown: h ? oe : void 0, role: "none", children: [
303
- /* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */ c(
304
- "button",
305
- {
306
- "aria-controls": h ? _ : void 0,
307
- "aria-describedby": [re ? G : null, X].filter(Boolean).join(" ") || void 0,
308
- "aria-expanded": h,
309
- "aria-label": l ?? F,
310
- className: ke(f, h, b),
311
- "data-state": f,
312
- "data-testid": "spectral-multiselect-trigger",
313
- disabled: U,
314
- id: z,
315
- name: t,
316
- ref: M,
317
- role: "combobox",
318
- style: de(),
319
- type: "button",
320
- ...H,
321
- children: [
322
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 overflow-hidden", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
323
- /* @__PURE__ */ s("div", { className: "ml-2 flex shrink-0 items-center gap-2", children: /* @__PURE__ */ s(ue, { className: y("text-input-icon transition-transform duration-200", h && "rotate-180"), size: 20 }) })
324
- ]
325
- }
326
- ) }),
327
- L && n.length > 0 && /* @__PURE__ */ s(
328
- "button",
329
- {
330
- "aria-label": "Clear all selections",
331
- className: "text-input-icon hover:text-input-icon--hover focus-visible:ring-accent absolute top-1/2 right-10 z-10 -translate-y-1/2 cursor-pointer rounded-sm focus-visible:ring-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50",
332
- "data-testid": "spectral-multiselect-clear-all-button",
333
- disabled: U,
334
- onClick: (e) => {
335
- e.stopPropagation(), q(), document.getElementById(z)?.focus();
336
- },
337
- type: "button",
338
- children: /* @__PURE__ */ s(W, { size: 12 })
339
- }
340
- ),
341
- /* @__PURE__ */ s(he, { children: /* @__PURE__ */ s(
342
- xe,
343
- {
344
- align: "start",
345
- avoidCollisions: !0,
346
- className: De(),
347
- collisionPadding: 10,
348
- "data-testid": "spectral-multiselect-dropdown",
349
- onOpenAutoFocus: (e) => {
350
- e.preventDefault(), k && B.current?.focus();
351
- },
352
- side: "bottom",
353
- sideOffset: 4,
354
- style: { width: "var(--radix-popover-trigger-width)" },
355
- children: /* @__PURE__ */ c("div", { className: "p-1", children: [
356
- k && /* @__PURE__ */ c("div", { className: "relative mb-2", children: [
357
- /* @__PURE__ */ s(fe, { className: y(Ie, "text-input-icon absolute top-1/2 left-3 -translate-y-1/2") }),
358
- /* @__PURE__ */ s(
359
- "input",
360
- {
361
- "aria-label": "Search options",
362
- className: "border-input-border bg-input-bg focus-visible:border-input-border--focus w-full rounded-md border py-2 pr-3 pl-9 text-sm focus-visible:ring-1 focus-visible:ring-black focus-visible:outline-none",
363
- "data-testid": "spectral-multiselect-search-input",
364
- onChange: ae,
365
- placeholder: P,
366
- ref: B,
367
- type: "text",
368
- value: $
369
- }
370
- )
371
- ] }),
372
- /* @__PURE__ */ s("div", { className: "max-h-64 overflow-y-auto", id: _, role: "listbox", "aria-multiselectable": "true", children: te ? /* @__PURE__ */ c("div", { "data-testid": "spectral-multiselect-loading", className: "text-input-text-secondary flex items-center justify-center gap-2 py-6 text-sm", children: [
373
- /* @__PURE__ */ s(me, {}),
374
- j
375
- ] }) : D.length === 0 ? /* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-empty-message", className: "text-input-text-secondary py-6 text-center text-sm", children: C }) : /* @__PURE__ */ c(ce, { children: [
376
- o && /* @__PURE__ */ c("div", { className: "mb-1", children: [
377
- /* @__PURE__ */ s(
378
- "button",
379
- {
380
- className: y("text-input-text-secondary hover:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none", le && "bg-input-bg--hover"),
381
- "data-testid": "spectral-multiselect-select-all-button",
382
- onClick: Z,
383
- type: "button",
384
- children: ie ? g : K
385
- }
386
- ),
387
- /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" })
388
- ] }),
389
- O.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: O.ungrouped.map((e, a) => Q(e, a)) }),
390
- Object.entries(O.groups).map(([e, a]) => /* @__PURE__ */ c("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
391
- (O.ungrouped.length > 0 || Object.keys(O.groups).indexOf(e) > 0) && /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" }),
392
- /* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-group-name", className: "text-input-text-secondary px-3 py-1 text-xs font-semibold tracking-wide uppercase", children: e }),
393
- a.map((i, u) => Q(i, D.indexOf(i)))
394
- ] }, e))
395
- ] }) })
396
- ] })
397
- }
398
- ) })
399
- ] }) }),
400
- f === "error" && N && /* @__PURE__ */ s(ye, { dataTestId: "spectral-multiselect-error-message", id: G, message: N })
401
- ] });
402
- };
403
- Se.displayName = "MultiSelectBase";
404
- export {
405
- Se as MultiSelectBase
3
+ import { CheckmarkIcon as e } from "../Icons/CheckmarkIcon.js";
4
+ import { ChevronDownIcon as t } from "../Icons/ChevronDownIcon.js";
5
+ import { CloseIcon as n } from "../Icons/CloseIcon.js";
6
+ import { LoaderIcon as r } from "../Icons/LoaderIcon.js";
7
+ import { SearchIcon as i } from "../Icons/SearchIcon.js";
8
+ import { t as a } from "../twUtils-VNWgstKL.js";
9
+ import { ErrorMessage as o } from "../utils/formFieldUtils.js";
10
+ import { a as s, i as c, n as l, r as u } from "../dist-BtdmHAzK.js";
11
+ import { useCallback as d, useEffect as f, useId as p, useMemo as m, useRef as ee, useState as h } from "react";
12
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ //#region src/components/MultiSelect/MultiSelectBase.tsx
14
+ var te = "h-4 w-4", y = (e) => ({
15
+ error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
16
+ loading: "cursor-wait border-input-border--disabled",
17
+ disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
18
+ default: ""
19
+ })[e], b = (e, t, n) => a("min-h-12 rounded-lg px-4 py-2 text-sm flex max-h-[5.5rem] w-full items-center justify-between border border-input-border bg-input-bg", "hover:border-input-border--hover focus-visible:border-input-border--focus", "focus:outline-none focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-accent", "disabled:cursor-not-allowed disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:opacity-50", "overflow-hidden text-input-text transition duration-200", t && "border-input-border--focus", y(e), n), x = () => a("max-h-80 rounded-lg shadow-lg z-50 overflow-hidden border border-input-border bg-input-bg", "motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0", "motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95", "motion-safe:data-[side=bottom]:slide-in-from-top-2", "motion-safe:data-[side=top]:slide-in-from-bottom-2", "origin-(--radix-popover-content-transform-origin)"), S = (e, t, n, r, i, a, o, s, c) => {
20
+ let [l, u] = h(-1), f = m(() => {
21
+ let t = [];
22
+ return o && t.push({ type: "search" }), s && t.push({ type: "select-all" }), e.forEach((e, n) => {
23
+ e.disabled || t.push({
24
+ type: "option",
25
+ index: n,
26
+ value: e.value
27
+ });
28
+ }), c && t.push({ type: "clear-all" }), t;
29
+ }, [
30
+ e,
31
+ o,
32
+ s,
33
+ c
34
+ ]), p = d((e) => {
35
+ e < 0 || e >= f.length || f[e].type === "search" && a.current?.focus();
36
+ }, [f, a]);
37
+ return {
38
+ focusedIndex: l,
39
+ setFocusedIndex: u,
40
+ handleKeyDown: d((e) => {
41
+ let a = l >= 0 && l < f.length ? f[l] : null;
42
+ if (e.key === " " && a?.type === "search" || e.key === "Enter" && a?.type === "search") return;
43
+ let o = {
44
+ ArrowDown: () => {
45
+ e.preventDefault();
46
+ let t = Math.min(l + 1, f.length - 1);
47
+ u(t), p(t);
48
+ },
49
+ ArrowUp: () => {
50
+ e.preventDefault();
51
+ let t = Math.max(l - 1, 0);
52
+ u(t), p(t);
53
+ },
54
+ Tab: () => {
55
+ if (e.shiftKey) if (l <= 0) n();
56
+ else {
57
+ e.preventDefault();
58
+ let t = l - 1;
59
+ u(t), p(t);
60
+ }
61
+ else if (l >= f.length - 1) n();
62
+ else {
63
+ e.preventDefault();
64
+ let t = l + 1;
65
+ u(t), p(t);
66
+ }
67
+ },
68
+ Enter: () => {
69
+ if (e.preventDefault(), l >= 0 && l < f.length) {
70
+ let e = f[l];
71
+ e.type === "select-all" ? i() : e.type === "clear-all" ? t() : e.type === "option" && r(e.value);
72
+ }
73
+ },
74
+ " ": () => {
75
+ if (e.preventDefault(), l >= 0 && l < f.length) {
76
+ let e = f[l];
77
+ e.type === "select-all" ? i() : e.type === "clear-all" ? t() : e.type === "option" && r(e.value);
78
+ }
79
+ },
80
+ Escape: () => {
81
+ e.preventDefault(), n();
82
+ }
83
+ }[e.key];
84
+ o && o();
85
+ }, [
86
+ f,
87
+ l,
88
+ r,
89
+ i,
90
+ t,
91
+ n,
92
+ p
93
+ ]),
94
+ getOptionFocusIndex: d((e) => {
95
+ if (l < 0 || l >= f.length) return !1;
96
+ let t = f[l];
97
+ return t.type === "option" && t.index === e;
98
+ }, [l, f]),
99
+ isSearchFocused: m(() => l < 0 || l >= f.length ? !1 : f[l].type === "search", [l, f]),
100
+ isSelectAllFocused: m(() => l < 0 || l >= f.length ? !1 : f[l].type === "select-all", [l, f]),
101
+ isClearAllFocused: m(() => l < 0 || l >= f.length ? !1 : f[l].type === "clear-all", [l, f])
102
+ };
103
+ }, C = ({ className: y, clearAllLabel: C = "Clear all", closeOnSelect: w = !1, emptyMessage: ne = "No options found", errorMessage: T, id: re, label: ie, loadingMessage: ae = "Loading options…", maxCount: E = 3, name: D, onChange: O, options: k = [], placeholder: oe = "Select options", ref: se, searchPlaceholder: ce = "Search options…", selectAllLabel: le = "Select all", showClearAll: ue = !0, showSearch: A = !0, showSelectAll: j = !0, sortAlphabetically: M = !1, state: N = "default", value: P = [], "aria-label": de, "aria-describedby": fe, ...F }) => {
104
+ let I = p(), L = re ?? `${D}-${I}`, R = `${L}-listbox`, z = `${L}-error`, [B, V] = h(!1), [H, pe] = h(""), U = ee(null), W = F.disabled ?? N === "disabled", me = N === "loading", he = N === "error", G = m(() => {
105
+ let e = k.filter((e) => e.label.toLowerCase().includes(H.toLowerCase()));
106
+ return M && (e = [...e].sort((e, t) => e.label.localeCompare(t.label))), e;
107
+ }, [
108
+ k,
109
+ H,
110
+ M
111
+ ]), K = m(() => {
112
+ let e = {}, t = [];
113
+ return G.forEach((n) => {
114
+ n.group ? (e[n.group] || (e[n.group] = []), e[n.group].push(n)) : t.push(n);
115
+ }), {
116
+ groups: e,
117
+ ungrouped: t,
118
+ hasGroups: Object.keys(e).length > 0
119
+ };
120
+ }, [G]), q = d((e) => {
121
+ k.find((t) => t.value === e)?.disabled || (O(P.includes(e) ? P.filter((t) => t !== e) : [...P, e]), w && V(!1));
122
+ }, [
123
+ k,
124
+ P,
125
+ O,
126
+ w
127
+ ]), J = d(() => {
128
+ let e = k.filter((e) => !e.disabled).map((e) => e.value);
129
+ e.every((e) => P.includes(e)) ? O([]) : O(e);
130
+ }, [
131
+ k,
132
+ P,
133
+ O
134
+ ]), Y = d(() => {
135
+ O([]);
136
+ }, [O]), X = m(() => k.filter((e) => !e.disabled).map((e) => e.value), [k]), ge = X.length > 0 && X.every((e) => P.includes(e)), { getOptionFocusIndex: _e, handleKeyDown: ve, isSelectAllFocused: Z, setFocusedIndex: Q } = S(G, Y, () => V(!1), q, J, U, A, j, !1);
137
+ f(() => {
138
+ Q(B ? 0 : -1);
139
+ }, [B, Q]);
140
+ let ye = d((e) => {
141
+ pe(e.target.value);
142
+ }, []), be = () => {
143
+ if (P.length === 0) return /* @__PURE__ */ _("span", {
144
+ className: "min-h-8 flex items-center text-input-text-placeholder",
145
+ children: oe
146
+ });
147
+ let e = P.slice(0, E), t = P.length - E;
148
+ return /* @__PURE__ */ v("div", {
149
+ className: "gap-1 flex flex-wrap items-center overflow-hidden",
150
+ children: [e.map((e) => {
151
+ let t = k.find((t) => t.value === e);
152
+ return t ? /* @__PURE__ */ v("span", {
153
+ className: "gap-1 px-2 py-1 rounded-md text-xs max-w-48 inline-flex items-center bg-input-bg--selected text-input-text",
154
+ children: [/* @__PURE__ */ _("span", {
155
+ className: "truncate",
156
+ children: t.label
157
+ }), /* @__PURE__ */ _("button", {
158
+ "aria-label": `Remove ${t.label}`,
159
+ className: "hover:text-danger rounded-sm cursor-pointer",
160
+ "data-testid": "spectral-multiselect-remove-item-button",
161
+ onClick: (t) => {
162
+ t.preventDefault(), t.stopPropagation(), q(e);
163
+ },
164
+ onPointerDown: (e) => {
165
+ e.stopPropagation();
166
+ },
167
+ type: "button",
168
+ children: /* @__PURE__ */ _(n, { size: 12 })
169
+ })]
170
+ }, e) : null;
171
+ }), t > 0 && /* @__PURE__ */ v("span", {
172
+ className: "text-input-text-secondary text-xs py-1 flex items-center",
173
+ children: [
174
+ "+",
175
+ t,
176
+ " more"
177
+ ]
178
+ })]
179
+ });
180
+ }, $ = (t, n) => {
181
+ let r = P.includes(t.value);
182
+ return /* @__PURE__ */ v("button", {
183
+ className: a("gap-3 px-3 py-2 text-sm flex w-full items-center text-left hover:bg-input-bg--hover focus-visible:bg-input-bg--hover focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", _e(n) && "bg-input-bg--hover", r && "font-medium text-input-text"),
184
+ disabled: t.disabled,
185
+ onClick: () => q(t.value),
186
+ type: "button",
187
+ children: [/* @__PURE__ */ _("div", {
188
+ "data-testid": "spectral-multiselect-selected-indicator",
189
+ className: a("w-4 h-4 rounded flex items-center justify-center border border-input-border", r && "bg-primary border-primary"),
190
+ children: r && /* @__PURE__ */ _(e, { size: 12 })
191
+ }), /* @__PURE__ */ _("span", { children: t.label })]
192
+ }, t.value);
193
+ }, xe = () => ({
194
+ "--multiselect-border-radius": "0.5rem",
195
+ "--multiselect-trigger-height": "3rem",
196
+ "--multiselect-dropdown-max-height": "20rem"
197
+ });
198
+ return /* @__PURE__ */ v("div", {
199
+ className: "w-full",
200
+ "data-testid": "spectral-multiselect-root",
201
+ children: [/* @__PURE__ */ _(c, {
202
+ open: B,
203
+ onOpenChange: V,
204
+ children: /* @__PURE__ */ v("div", {
205
+ className: "relative",
206
+ "data-testid": "spectral-multiselect-wrapper",
207
+ onKeyDown: B ? ve : void 0,
208
+ role: "none",
209
+ children: [
210
+ /* @__PURE__ */ _(s, {
211
+ asChild: !0,
212
+ children: /* @__PURE__ */ v("button", {
213
+ "aria-controls": B ? R : void 0,
214
+ "aria-describedby": [he ? z : null, fe].filter(Boolean).join(" ") || void 0,
215
+ "aria-expanded": B,
216
+ "aria-label": de ?? ie,
217
+ className: b(N, B, y),
218
+ "data-state": N,
219
+ "data-testid": "spectral-multiselect-trigger",
220
+ disabled: W,
221
+ id: L,
222
+ name: D,
223
+ ref: se,
224
+ role: "combobox",
225
+ style: xe(),
226
+ type: "button",
227
+ ...F,
228
+ children: [/* @__PURE__ */ _("div", {
229
+ className: "min-w-0 flex-1 overflow-hidden",
230
+ "data-testid": "spectral-multiselect-selected-items",
231
+ children: be()
232
+ }), /* @__PURE__ */ _("div", {
233
+ className: "gap-2 ml-2 flex shrink-0 items-center",
234
+ children: /* @__PURE__ */ _(t, {
235
+ className: a("text-input-icon transition-transform duration-200", B && "rotate-180"),
236
+ size: 20
237
+ })
238
+ })]
239
+ })
240
+ }),
241
+ ue && P.length > 0 && /* @__PURE__ */ _("button", {
242
+ "aria-label": "Clear all selections",
243
+ className: "right-10 text-input-icon hover:text-input-icon--hover rounded-sm absolute top-1/2 z-10 -translate-y-1/2 cursor-pointer focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50",
244
+ "data-testid": "spectral-multiselect-clear-all-button",
245
+ disabled: W,
246
+ onClick: (e) => {
247
+ e.stopPropagation(), Y(), document.getElementById(L)?.focus();
248
+ },
249
+ type: "button",
250
+ children: /* @__PURE__ */ _(n, { size: 12 })
251
+ }),
252
+ /* @__PURE__ */ _(u, { children: /* @__PURE__ */ _(l, {
253
+ align: "start",
254
+ avoidCollisions: !0,
255
+ className: x(),
256
+ collisionPadding: 10,
257
+ "data-testid": "spectral-multiselect-dropdown",
258
+ onOpenAutoFocus: (e) => {
259
+ e.preventDefault(), A && U.current?.focus();
260
+ },
261
+ side: "bottom",
262
+ sideOffset: 4,
263
+ style: { width: "var(--radix-popover-trigger-width)" },
264
+ children: /* @__PURE__ */ v("div", {
265
+ className: "p-1",
266
+ children: [A && /* @__PURE__ */ v("div", {
267
+ className: "mb-2 relative",
268
+ children: [/* @__PURE__ */ _(i, { className: a(te, "left-3 text-input-icon absolute top-1/2 -translate-y-1/2") }), /* @__PURE__ */ _("input", {
269
+ "aria-label": "Search options",
270
+ className: "pl-9 pr-3 py-2 text-sm rounded-md focus-visible:ring-black w-full border border-input-border bg-input-bg focus-visible:border-input-border--focus focus-visible:ring-1 focus-visible:outline-none",
271
+ "data-testid": "spectral-multiselect-search-input",
272
+ onChange: ye,
273
+ placeholder: ce,
274
+ ref: U,
275
+ type: "text",
276
+ value: H
277
+ })]
278
+ }), /* @__PURE__ */ _("div", {
279
+ className: "max-h-64 overflow-y-auto",
280
+ id: R,
281
+ role: "listbox",
282
+ "aria-multiselectable": "true",
283
+ children: me ? /* @__PURE__ */ v("div", {
284
+ "data-testid": "spectral-multiselect-loading",
285
+ className: "gap-2 py-6 text-sm text-input-text-secondary flex items-center justify-center",
286
+ children: [/* @__PURE__ */ _(r, {}), ae]
287
+ }) : G.length === 0 ? /* @__PURE__ */ _("div", {
288
+ "data-testid": "spectral-multiselect-empty-message",
289
+ className: "py-6 text-sm text-input-text-secondary text-center",
290
+ children: ne
291
+ }) : /* @__PURE__ */ v(g, { children: [
292
+ j && /* @__PURE__ */ v("div", {
293
+ className: "mb-1",
294
+ children: [/* @__PURE__ */ _("button", {
295
+ className: a("gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary flex w-full items-center hover:bg-input-bg--hover focus:outline-none", Z && "bg-input-bg--hover"),
296
+ "data-testid": "spectral-multiselect-select-all-button",
297
+ onClick: J,
298
+ type: "button",
299
+ children: ge ? C : le
300
+ }), /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" })]
301
+ }),
302
+ K.ungrouped.length > 0 && /* @__PURE__ */ _("div", {
303
+ className: "mb-1",
304
+ children: K.ungrouped.map((e, t) => $(e, t))
305
+ }),
306
+ Object.entries(K.groups).map(([e, t]) => /* @__PURE__ */ v("div", {
307
+ className: "mb-1",
308
+ "data-testid": "spectral-multiselect-group",
309
+ children: [
310
+ (K.ungrouped.length > 0 || Object.keys(K.groups).indexOf(e) > 0) && /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" }),
311
+ /* @__PURE__ */ _("div", {
312
+ "data-testid": "spectral-multiselect-group-name",
313
+ className: "px-3 py-1 text-xs font-semibold text-input-text-secondary tracking-wide uppercase",
314
+ children: e
315
+ }),
316
+ t.map((e, t) => $(e, G.indexOf(e)))
317
+ ]
318
+ }, e))
319
+ ] })
320
+ })]
321
+ })
322
+ }) })
323
+ ]
324
+ })
325
+ }), N === "error" && T && /* @__PURE__ */ _(o, {
326
+ dataTestId: "spectral-multiselect-error-message",
327
+ id: z,
328
+ message: T
329
+ })]
330
+ });
406
331
  };
332
+ C.displayName = "MultiSelectBase";
333
+ //#endregion
334
+ export { C as MultiSelectBase };