@spear-ai/spectral 1.4.1 → 1.4.3

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 (127) hide show
  1. package/dist/Accordion.d.ts +7 -7
  2. package/dist/Accordion.js +53 -51
  3. package/dist/Alert/AlertBase.js +6 -6
  4. package/dist/Alert.js +1 -1
  5. package/dist/Avatar.d.ts +2 -2
  6. package/dist/Avatar.js +46 -46
  7. package/dist/Badge.js +3 -3
  8. package/dist/Button.js +19 -12
  9. package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
  10. package/dist/ButtonGroup/ButtonGroupButton.js +10 -10
  11. package/dist/ButtonGroup.d.ts +8 -5
  12. package/dist/ButtonGroup.js +22 -14
  13. package/dist/ButtonIcon.d.ts +1 -1
  14. package/dist/ButtonIcon.js +5 -5
  15. package/dist/Card.d.ts +1 -1
  16. package/dist/Card.js +10 -10
  17. package/dist/Checkbox/CheckboxBase.d.ts +6 -6
  18. package/dist/Checkbox/CheckboxBase.js +65 -63
  19. package/dist/Checkbox.js +16 -14
  20. package/dist/Dialog/DialogBase.d.ts +37 -25
  21. package/dist/Dialog/DialogBase.js +130 -104
  22. package/dist/Dialog.d.ts +8 -8
  23. package/dist/Dialog.js +46 -36
  24. package/dist/Drawer.js +17 -17
  25. package/dist/HoverCard.d.ts +4 -4
  26. package/dist/HoverCard.js +34 -33
  27. package/dist/Input.js +58 -58
  28. package/dist/InputOTP.d.ts +1 -1
  29. package/dist/InputOTP.js +113 -112
  30. package/dist/MultiSelect/MultiSelectBase.d.ts +16 -16
  31. package/dist/MultiSelect/MultiSelectBase.js +236 -177
  32. package/dist/MultiSelect/MutiSelect.d.ts +6 -4
  33. package/dist/MultiSelect/MutiSelect.js +13 -12
  34. package/dist/Popover.js +2 -1
  35. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +18 -17
  36. package/dist/RadioGroup.js +5 -3
  37. package/dist/Select.js +70 -51
  38. package/dist/Slider.js +8 -4
  39. package/dist/Switch/SwitchBase.d.ts +6 -6
  40. package/dist/Switch/SwitchBase.js +39 -38
  41. package/dist/Switch.js +17 -16
  42. package/dist/Tabs/TabsBase.js +40 -25
  43. package/dist/Tabs.js +18 -21
  44. package/dist/Textarea.d.ts +1 -0
  45. package/dist/Textarea.js +33 -33
  46. package/dist/Toggle.js +4 -4
  47. package/dist/ToggleGroup/ToggleGroupBase.d.ts +7 -7
  48. package/dist/ToggleGroup/ToggleGroupBase.js +64 -64
  49. package/dist/ToggleGroup.js +19 -17
  50. package/dist/Tooltip/TooltipBase.d.ts +8 -8
  51. package/dist/Tooltip/TooltipBase.js +76 -74
  52. package/dist/Tooltip.d.ts +1 -1
  53. package/dist/Tooltip.js +12 -11
  54. package/dist/Tray.d.ts +1 -1
  55. package/dist/Tray.js +4910 -117
  56. package/dist/primitives/input.js +4 -4
  57. package/dist/primitives/select.d.ts +11 -11
  58. package/dist/primitives/select.d.ts.map +1 -1
  59. package/dist/primitives/select.js +28 -21
  60. package/dist/styles/main.css +1 -1
  61. package/dist/utils/{refs.d.ts → createForwardRef.d.ts} +1 -1
  62. package/dist/utils/createForwardRef.d.ts.map +1 -0
  63. package/dist/utils/formFieldUtils.d.ts +22 -18
  64. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  65. package/dist/utils/formFieldUtils.js +46 -46
  66. package/package.json +9 -5
  67. package/dist/analyzer/list.yml.webp +0 -0
  68. package/dist/analyzer/network.webp +0 -0
  69. package/dist/analyzer/sunburst.webp +0 -0
  70. package/dist/analyzer/visual.webp +0 -0
  71. package/dist/auth-background.json +0 -90
  72. package/dist/favicon-invert.svg +0 -5
  73. package/dist/favicon.svg +0 -5
  74. package/dist/features/AuthCard/AuthCard.d.ts +0 -3
  75. package/dist/features/AuthCard/AuthCard.d.ts.map +0 -1
  76. package/dist/features/AuthCard/AuthToggle.d.ts +0 -9
  77. package/dist/features/AuthCard/AuthToggle.d.ts.map +0 -1
  78. package/dist/features/AuthCard/AuthToggle.js +0 -20
  79. package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts +0 -11
  80. package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts.map +0 -1
  81. package/dist/features/AuthCard/ForgotPasswordEmailForm.js +0 -86
  82. package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts +0 -11
  83. package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts.map +0 -1
  84. package/dist/features/AuthCard/ForgotPasswordResetForm.js +0 -21
  85. package/dist/features/AuthCard/OTPInput.d.ts +0 -12
  86. package/dist/features/AuthCard/OTPInput.d.ts.map +0 -1
  87. package/dist/features/AuthCard/OTPInput.js +0 -12
  88. package/dist/features/AuthCard/PasswordInput.d.ts +0 -13
  89. package/dist/features/AuthCard/PasswordInput.d.ts.map +0 -1
  90. package/dist/features/AuthCard/PasswordInput.js +0 -93
  91. package/dist/features/AuthCard/SignInForm.d.ts +0 -9
  92. package/dist/features/AuthCard/SignInForm.d.ts.map +0 -1
  93. package/dist/features/AuthCard/SignInForm.js +0 -86
  94. package/dist/features/AuthCard/SignUpForm.d.ts +0 -8
  95. package/dist/features/AuthCard/SignUpForm.d.ts.map +0 -1
  96. package/dist/features/AuthCard/SignUpForm.js +0 -100
  97. package/dist/features/AuthCard.js +0 -202
  98. package/dist/features/ClearDialog/ClearDialog.d.ts +0 -2
  99. package/dist/features/ClearDialog/ClearDialog.d.ts.map +0 -1
  100. package/dist/features/ClearDialog.js +0 -31
  101. package/dist/features/LabelingToolbar/LabelingToolbar.d.ts +0 -8
  102. package/dist/features/LabelingToolbar/LabelingToolbar.d.ts.map +0 -1
  103. package/dist/features/LabelingToolbar.js +0 -13
  104. package/dist/features/LabelingTools/LabelingTools.d.ts +0 -2
  105. package/dist/features/LabelingTools/LabelingTools.d.ts.map +0 -1
  106. package/dist/features/LabelingTools.js +0 -134
  107. package/dist/features/SensorMetadata/SensorMetadata.d.ts +0 -2
  108. package/dist/features/SensorMetadata/SensorMetadata.d.ts.map +0 -1
  109. package/dist/features/SensorMetadata.js +0 -117
  110. package/dist/features/SettingsPopover/SettingsPopover.d.ts +0 -2
  111. package/dist/features/SettingsPopover/SettingsPopover.d.ts.map +0 -1
  112. package/dist/features/SettingsPopover.js +0 -204
  113. package/dist/index-BIpuW_o8.js +0 -146
  114. package/dist/linear-cursor-small.png +0 -0
  115. package/dist/loader-circle-CdRVlFhN.js +0 -11
  116. package/dist/logo/wordmark-dark-side-by-side.svg +0 -6
  117. package/dist/logo/wordmark-light-side-by-side.svg +0 -6
  118. package/dist/message-alert-matte-glass-gradient.webp +0 -0
  119. package/dist/proxy-C9AqCss6.js +0 -4670
  120. package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
  121. package/dist/themes/grayscale-theme.webp +0 -0
  122. package/dist/themes/green-black-theme.webp +0 -0
  123. package/dist/themes/reverse-grayscale-theme.webp +0 -0
  124. package/dist/themes/viridis-theme.webp +0 -0
  125. package/dist/utils/refs.d.ts.map +0 -1
  126. package/dist/x-Dl66o_vF.js +0 -14
  127. /package/dist/utils/{refs.js → createForwardRef.js} +0 -0
@@ -1,265 +1,324 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsxs as a, jsx as s, Fragment as ue } from "react/jsx-runtime";
4
- import { cn as p } from "../utils/twUtils.js";
5
- import { forwardRef as pe, useId as me, useState as I, useRef as P, useMemo as F, useCallback as b, useEffect as be } from "react";
6
- import { X as K } from "../x-Dl66o_vF.js";
7
- import { c as O } from "../createLucideIcon-B_8CJpcQ.js";
8
- import { L as fe } from "../loader-circle-CdRVlFhN.js";
3
+ import { jsxs as o, jsx as r, Fragment as de } from "react/jsx-runtime";
4
+ import "../Icons/AnalyzeIcon.js";
5
+ import "../Icons/AnnotationsIcon.js";
6
+ import "../Icons/ApprovedIcon.js";
7
+ import "../Icons/CalendarIcon.js";
8
+ import "../Icons/CheckCircleIcon.js";
9
+ import "../Icons/CheckSquareIcon.js";
10
+ import { CheckmarkIcon as ce } from "../Icons/CheckmarkIcon.js";
11
+ import { ChevronDownIcon as ue } from "../Icons/ChevronDownIcon.js";
12
+ import "../Icons/ChevronUpIcon.js";
13
+ import "../Icons/ClockIcon.js";
14
+ import "../Icons/CloseCircleIcon.js";
15
+ import { CloseIcon as P } from "../Icons/CloseIcon.js";
16
+ import "../Icons/DashboardIcon.js";
17
+ import "../Icons/DatabaseIcon.js";
18
+ import "../Icons/DeleteIcon.js";
19
+ import "../Icons/DurationIcon.js";
20
+ import "../Icons/EmailIcon.js";
21
+ import "../Icons/EraserIcon.js";
22
+ import "../Icons/ErrorIcon.js";
23
+ import "../Icons/EyeClosedIcon.js";
24
+ import "../Icons/EyeClosedIcon2.js";
25
+ import "../Icons/EyeOpenIcon.js";
26
+ import "../Icons/GoToFirstIcon.js";
27
+ import "../Icons/GoToLastIcon.js";
28
+ import "../Icons/HarmonicCursorsIcon.js";
29
+ import "../Icons/InfoIcon.js";
30
+ import "../Icons/LabelIcon.js";
31
+ import "../Icons/LassoIcon.js";
32
+ import "../Icons/LineToolIcon.js";
33
+ import "../Icons/LineToolIcon2.js";
34
+ import "../Icons/LiveViewIcon.js";
35
+ import { LoaderIcon as pe } from "../Icons/LoaderIcon.js";
36
+ import "../Icons/LocationIcon.js";
37
+ import "../Icons/LogoutIcon.js";
38
+ import "../Icons/MessagesIcon.js";
39
+ import "../Icons/MetadataIcon.js";
40
+ import "../Icons/MinusIcon.js";
41
+ import "../Icons/OntologyIcon.js";
42
+ import "../Icons/PanelIconClose.js";
43
+ import "../Icons/PanelIconOpen.js";
44
+ import "../Icons/PlayIcon.js";
45
+ import "../Icons/PlusIcon.js";
46
+ import "../Icons/ResetIcon.js";
47
+ import "../Icons/ReviewedIcon.js";
48
+ import "../Icons/ScissorsIcon.js";
49
+ import "../Icons/SettingsIcon.js";
50
+ import "../Icons/SortAscendingIcon.js";
51
+ import "../Icons/SortDescendingIcon.js";
52
+ import "../Icons/StackIcon.js";
53
+ import "../Icons/StarIcon.js";
54
+ import "../Icons/TrashIcon.js";
55
+ import "../Icons/UndoIcon.js";
56
+ import "../Icons/UserIcon.js";
57
+ import "../Icons/WarningIcon.js";
58
+ import "../Icons/ZoomAllIcon.js";
59
+ import "../Icons/ZoomXIcon.js";
60
+ import "../Icons/ZoomYIcon.js";
61
+ import { ErrorMessage as me } from "../utils/formFieldUtils.js";
62
+ import { cn as f } from "../utils/twUtils.js";
63
+ import { forwardRef as be, useId as fe, useState as L, useRef as _, useMemo as T, useCallback as b, useEffect as ge } from "react";
64
+ import { c as he } from "../createLucideIcon-B_8CJpcQ.js";
9
65
  /**
10
66
  * @license lucide-react v0.546.0 - ISC
11
67
  *
12
68
  * This source code is licensed under the ISC license.
13
69
  * See the LICENSE file in the root directory of this source tree.
14
70
  */
15
- const ge = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], he = O("check", ge);
16
- /**
17
- * @license lucide-react v0.546.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */
22
- const xe = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ye = O("chevron-down", xe);
23
- /**
24
- * @license lucide-react v0.546.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- */
29
- const ve = [
71
+ const xe = [
30
72
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
31
73
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
32
- ], Ne = O("search", ve), S = "h-4 w-4", we = "h-5 w-5", ke = (t) => ({
74
+ ], ye = he("search", xe), ve = "h-4 w-4", we = (i) => ({
33
75
  error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
34
76
  loading: "cursor-wait border-input-border--disabled",
35
77
  disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
36
78
  default: ""
37
- })[t], Ce = (t, l, i) => p(
79
+ })[i], Ne = (i, l, d) => f(
38
80
  "flex h-12 w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-3 text-sm",
39
81
  "hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
40
82
  "focus:ring-2 focus:ring-black focus:ring-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",
41
83
  "disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
42
84
  "transition duration-200 text-input-text",
43
85
  l && "border-input-border--focus ring-2 ring-black ring-offset-2",
44
- ke(t),
45
- i
46
- ), Se = (t) => p(
86
+ we(i),
87
+ d
88
+ ), ke = (i) => f(
47
89
  "absolute top-full left-0 right-0 z-50 mt-1 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
48
90
  "transition-all duration-200 origin-top",
49
- t ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
50
- ), Ie = (t) => {
51
- const l = P(null);
52
- return be(() => {
53
- const i = (o) => {
54
- l.current && !l.current.contains(o.target) && t();
91
+ i ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
92
+ ), Ce = (i) => {
93
+ const l = _(null);
94
+ return ge(() => {
95
+ const d = (n) => {
96
+ l.current && !l.current.contains(n.target) && i();
55
97
  };
56
- return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
57
- }, [t]), l;
58
- }, Oe = (t, l, i) => {
59
- const [o, m] = I(-1), u = b(
60
- (d) => {
61
- const y = {
98
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
99
+ }, [i]), l;
100
+ }, Ie = (i, l, d) => {
101
+ const [n, g] = L(-1), I = b(
102
+ (u) => {
103
+ const v = {
62
104
  ArrowDown: () => {
63
- d.preventDefault(), m((f) => Math.min(f + 1, t.length - 1));
105
+ u.preventDefault(), g((h) => Math.min(h + 1, i.length - 1));
64
106
  },
65
107
  ArrowUp: () => {
66
- d.preventDefault(), m((f) => Math.max(f - 1, -1));
108
+ u.preventDefault(), g((h) => Math.max(h - 1, -1));
67
109
  },
68
110
  Enter: () => {
69
- d.preventDefault(), o >= 0 && t[o] && l(t[o].value);
111
+ u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
70
112
  },
71
113
  " ": () => {
72
- d.preventDefault(), o >= 0 && t[o] && l(t[o].value);
114
+ u.preventDefault(), n >= 0 && i[n] && l(i[n].value);
73
115
  },
74
116
  Escape: () => {
75
- d.preventDefault(), i();
117
+ u.preventDefault(), d();
76
118
  }
77
- }[d.key];
78
- y && y();
119
+ }[u.key];
120
+ v && v();
79
121
  },
80
- [t, o, l, i]
122
+ [i, n, l, d]
81
123
  );
82
- return { focusedIndex: o, setFocusedIndex: m, handleKeyDown: u };
83
- }, De = pe(
124
+ return { focusedIndex: n, setFocusedIndex: g, handleKeyDown: I };
125
+ }, Se = be(
84
126
  ({
85
- value: t = [],
86
- onChange: l,
87
- options: i = [],
88
- placeholder: o = "Select options",
89
- maxCount: m = 3,
90
- state: u = "default",
91
- errorMessage: d,
92
- emptyMessage: D = "No options found",
93
- loadingMessage: y = "Loading options...",
94
- searchPlaceholder: f = "Search options...",
95
- selectAllLabel: T = "Select all",
96
- clearAllLabel: B = "Clear all",
97
- sortAlphabetically: j = !1,
98
- showSelectAll: G = !0,
99
- showClearAll: H = !0,
100
- showSearch: V = !0,
101
- closeOnSelect: Z = !1,
102
- name: L,
103
- id: q,
104
- label: z,
105
- className: U,
106
- "aria-label": X,
107
- "aria-describedby": J,
108
- ..._
109
- }, Q) => {
110
- const W = me(), E = q || `${L}-${W}`, M = `${E}-error`, [g, v] = I(!1), [w, Y] = I(""), ee = Ie(() => v(!1)), R = P(null), k = _.disabled || u === "disabled", te = u === "loading", re = u === "error", h = F(() => {
111
- let e = i.filter((n) => n.label.toLowerCase().includes(w.toLowerCase()));
112
- return j && (e = [...e].sort((n, r) => n.label.localeCompare(r.label))), e;
113
- }, [i, w, j]), x = F(() => {
114
- const e = {}, n = [];
115
- return h.forEach((r) => {
116
- r.group ? (e[r.group] || (e[r.group] = []), e[r.group].push(r)) : n.push(r);
117
- }), { groups: e, ungrouped: n, hasGroups: Object.keys(e).length > 0 };
118
- }, [h]), { focusedIndex: se, handleKeyDown: ne } = Oe(h, N, () => v(!1)), le = b(() => {
119
- k || v((e) => (e || setTimeout(() => R.current?.focus(), 0), !e));
120
- }, [k]);
121
- function N(e) {
122
- if (i.find((c) => c.value === e)?.disabled) return;
123
- const r = t.includes(e) ? t.filter((c) => c !== e) : [...t, e];
124
- l(r), Z && v(!1);
125
- }
126
- const ae = b(() => {
127
- const e = i.filter((r) => !r.disabled).map((r) => r.value), n = e.every((r) => t.includes(r));
128
- l(n ? [] : e);
129
- }, [i, t, l]), $ = b(() => {
130
- l([]);
131
- }, [l]), ie = b((e) => {
132
- Y(e.target.value);
133
- }, []), oe = b(
134
- (e, n) => {
135
- n.stopPropagation(), N(e);
127
+ className: i,
128
+ clearAllLabel: l = "Clear all",
129
+ closeOnSelect: d = !1,
130
+ emptyMessage: n = "No options found",
131
+ errorMessage: g,
132
+ id: I,
133
+ label: u,
134
+ loadingMessage: M = "Loading options...",
135
+ maxCount: v = 3,
136
+ name: h,
137
+ onChange: p,
138
+ options: m = [],
139
+ placeholder: $ = "Select options",
140
+ searchPlaceholder: B = "Search options...",
141
+ selectAllLabel: H = "Select all",
142
+ showClearAll: V = !0,
143
+ showSearch: G = !0,
144
+ showSelectAll: U = !0,
145
+ sortAlphabetically: R = !1,
146
+ state: x = "default",
147
+ value: a = [],
148
+ "aria-label": Z,
149
+ "aria-describedby": q,
150
+ ...z
151
+ }, J) => {
152
+ const Q = fe(), S = I || `${h}-${Q}`, K = `${S}-error`, [y, k] = L(!1), [D, W] = L(""), X = Ce(() => k(!1)), A = _(null), O = z.disabled || x === "disabled", Y = x === "loading", ee = x === "error", w = T(() => {
153
+ let e = m.filter((s) => s.label.toLowerCase().includes(D.toLowerCase()));
154
+ return R && (e = [...e].sort((s, t) => s.label.localeCompare(t.label))), e;
155
+ }, [m, D, R]), N = T(() => {
156
+ const e = {}, s = [];
157
+ return w.forEach((t) => {
158
+ t.group ? (e[t.group] || (e[t.group] = []), e[t.group].push(t)) : s.push(t);
159
+ }), { groups: e, ungrouped: s, hasGroups: Object.keys(e).length > 0 };
160
+ }, [w]), C = b(
161
+ (e) => {
162
+ if (m.find((c) => c.value === e)?.disabled) return;
163
+ const t = a.includes(e) ? a.filter((c) => c !== e) : [...a, e];
164
+ p(t), d && k(!1);
165
+ },
166
+ [m, a, p, d]
167
+ ), { focusedIndex: te, handleKeyDown: re } = Ie(w, C, () => k(!1)), se = b(() => {
168
+ O || k((e) => (e || setTimeout(() => A.current?.focus(), 0), !e));
169
+ }, [O]), ie = b(() => {
170
+ const e = m.filter((t) => !t.disabled).map((t) => t.value), s = e.every((t) => a.includes(t));
171
+ p(s ? [] : e);
172
+ }, [m, a, p]), j = b(() => {
173
+ p([]);
174
+ }, [p]), oe = b((e) => {
175
+ W(e.target.value);
176
+ }, []), le = b(
177
+ (e, s) => {
178
+ s.stopPropagation(), C(e);
136
179
  },
137
- [N]
138
- ), de = () => {
139
- if (t.length === 0)
140
- return /* @__PURE__ */ s("span", { className: "text-input-text-placeholder", children: o });
141
- const e = t.slice(0, m), n = t.length - m;
142
- return /* @__PURE__ */ a("div", { className: "flex items-center gap-1 flex-wrap", children: [
143
- e.map((r) => {
144
- const c = i.find((C) => C.value === r);
145
- return c ? /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1 px-2 py-1 bg-input-bg--selected text-input-text rounded-md text-xs", children: [
180
+ [C]
181
+ ), ne = () => {
182
+ if (a.length === 0)
183
+ return /* @__PURE__ */ r("span", { className: "text-input-text-placeholder", children: $ });
184
+ const e = a.slice(0, v), s = a.length - v;
185
+ return /* @__PURE__ */ o("div", { className: "flex items-center gap-1 flex-wrap", children: [
186
+ e.map((t) => {
187
+ const c = m.find((E) => E.value === t);
188
+ return c ? /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1 px-2 py-1 bg-input-bg--selected text-input-text rounded-md text-xs", children: [
146
189
  c.label,
147
- /* @__PURE__ */ s("button", { type: "button", onClick: (C) => oe(r, C), className: "hover:text-danger focus:outline-none", "aria-label": `Remove ${c.label}`, children: /* @__PURE__ */ s(K, { className: "h-3 w-3" }) })
148
- ] }, r) : null;
190
+ /* @__PURE__ */ r("button", { "aria-label": `Remove ${c.label}`, className: "hover:text-danger focus:outline-none", "data-testid": "spectral-multiselect-remove-item-button", onClick: (E) => le(t, E), type: "button", children: /* @__PURE__ */ r(P, { size: 12 }) })
191
+ ] }, t) : null;
149
192
  }),
150
- n > 0 && /* @__PURE__ */ a("span", { className: "text-input-text-secondary text-xs", children: [
193
+ s > 0 && /* @__PURE__ */ o("span", { className: "text-input-text-secondary text-xs", children: [
151
194
  "+",
152
- n,
195
+ s,
153
196
  " more"
154
197
  ] })
155
198
  ] });
156
- }, A = (e, n) => {
157
- const r = t.includes(e.value);
158
- return /* @__PURE__ */ a(
199
+ }, F = (e, s) => {
200
+ const t = a.includes(e.value);
201
+ return /* @__PURE__ */ o(
159
202
  "button",
160
203
  {
161
- type: "button",
162
- className: p(
204
+ className: f(
163
205
  "w-full flex items-center gap-3 px-3 py-2 text-sm text-left hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
164
206
  "disabled:opacity-50 disabled:cursor-not-allowed",
165
- n === se && "bg-input-bg--hover",
166
- r && "text-input-text font-medium"
207
+ s === te && "bg-input-bg--hover",
208
+ t && "text-input-text font-medium"
167
209
  ),
168
- onClick: () => N(e.value),
169
210
  disabled: e.disabled,
211
+ onClick: () => C(e.value),
212
+ type: "button",
170
213
  children: [
171
- /* @__PURE__ */ s("div", { className: p("flex items-center justify-center w-4 h-4 border border-input-border rounded", r && "bg-primary border-primary"), children: r && /* @__PURE__ */ s(he, { className: "h-3 w-3 text-white" }) }),
172
- /* @__PURE__ */ s("span", { children: e.label })
214
+ /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-selected-indicator", className: f("flex items-center justify-center w-4 h-4 border border-input-border rounded", t && "bg-primary border-primary"), children: t && /* @__PURE__ */ r(ce, { size: 12 }) }),
215
+ /* @__PURE__ */ r("span", { children: e.label })
173
216
  ]
174
217
  },
175
218
  e.value
176
219
  );
177
- }, ce = () => ({
220
+ }, ae = () => ({
178
221
  "--multiselect-border-radius": "0.5rem",
179
222
  "--multiselect-trigger-height": "3rem",
180
223
  "--multiselect-dropdown-max-height": "20rem"
181
224
  });
182
- return /* @__PURE__ */ a("div", { className: "w-full", "data-testid": "multiselect-root", children: [
183
- /* @__PURE__ */ a("div", { ref: ee, className: "relative", "data-testid": "multiselect-wrapper", onKeyDown: g ? ne : void 0, children: [
184
- /* @__PURE__ */ a(
225
+ return /* @__PURE__ */ o("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
226
+ /* @__PURE__ */ o("div", { className: "relative", "data-testid": "spectral-multiselect-wrapper", onKeyDown: y ? re : void 0, ref: X, children: [
227
+ /* @__PURE__ */ o(
185
228
  "button",
186
229
  {
187
- ref: Q,
230
+ "aria-controls": y ? S : void 0,
231
+ "aria-describedby": f(ee && K, q),
232
+ "aria-expanded": y,
233
+ "aria-label": Z || u,
234
+ className: Ne(x, y, i),
235
+ "data-state": x,
236
+ "data-testid": "spectral-multiselect-trigger",
237
+ disabled: O,
238
+ id: S,
239
+ name: h,
240
+ onClick: se,
241
+ ref: J,
242
+ role: "combobox",
243
+ style: ae(),
188
244
  type: "button",
189
- id: E,
190
- name: L,
191
- className: Ce(u, g, U),
192
- onClick: le,
193
- disabled: k,
194
- "aria-label": X || z,
195
- "aria-describedby": p(re && M, J),
196
- "aria-expanded": g,
197
- "aria-haspopup": "listbox",
198
- "data-state": u,
199
- style: ce(),
200
- ..._,
245
+ ...z,
201
246
  children: [
202
- /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: de() }),
203
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2 ml-2", children: [
204
- t.length > 0 && /* @__PURE__ */ s(
205
- "button",
247
+ /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", "data-testid": "spectral-multiselect-selected-items", children: ne() }),
248
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 ml-2", children: [
249
+ a.length > 0 && /* @__PURE__ */ r(
250
+ "span",
206
251
  {
207
- type: "button",
252
+ "aria-label": "Clear all selections",
253
+ className: "text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer",
254
+ "data-testid": "spectral-multiselect-clear-all-button",
208
255
  onClick: (e) => {
209
- e.stopPropagation(), $();
256
+ e.stopPropagation(), j();
210
257
  },
211
- className: "text-input-icon hover:text-input-icon--hover focus:outline-none",
212
- "aria-label": "Clear all selections",
213
- children: /* @__PURE__ */ s(K, { className: S })
258
+ onKeyDown: (e) => {
259
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), j());
260
+ },
261
+ tabIndex: 0,
262
+ children: /* @__PURE__ */ r(P, { size: 12 })
214
263
  }
215
264
  ),
216
- /* @__PURE__ */ s(ye, { className: p(we, "text-input-icon transition-transform duration-200", g && "rotate-180") })
265
+ /* @__PURE__ */ r(ue, { className: f("text-input-icon transition-transform duration-200", y && "rotate-180"), size: 20 })
217
266
  ] })
218
267
  ]
219
268
  }
220
269
  ),
221
- /* @__PURE__ */ s("div", { className: Se(g), "data-testid": "multiselect-dropdown", children: /* @__PURE__ */ a("div", { className: "p-1", children: [
222
- V && /* @__PURE__ */ a("div", { className: "relative mb-2", children: [
223
- /* @__PURE__ */ s(Ne, { className: p(S, "absolute left-3 top-1/2 -translate-y-1/2 text-input-icon") }),
224
- /* @__PURE__ */ s(
270
+ /* @__PURE__ */ r("div", { className: ke(y), "data-testid": "spectral-multiselect-dropdown", children: /* @__PURE__ */ o("div", { className: "p-1", children: [
271
+ G && /* @__PURE__ */ o("div", { className: "relative mb-2", children: [
272
+ /* @__PURE__ */ r(ye, { className: f(ve, "absolute left-3 top-1/2 -translate-y-1/2 text-input-icon") }),
273
+ /* @__PURE__ */ r(
225
274
  "input",
226
275
  {
227
- ref: R,
228
- type: "text",
276
+ "aria-label": "Search options",
229
277
  className: "w-full pl-9 pr-3 py-2 text-sm border border-input-border rounded-md bg-input-bg focus:border-input-border--focus focus:outline-none focus:ring-1 focus:ring-black",
230
- placeholder: f,
231
- value: w,
232
- onChange: ie,
233
- "aria-label": "Search options"
278
+ "data-testid": "spectral-multiselect-search-input",
279
+ onChange: oe,
280
+ placeholder: B,
281
+ ref: A,
282
+ type: "text",
283
+ value: D
234
284
  }
235
285
  )
236
286
  ] }),
237
- /* @__PURE__ */ s("div", { className: "max-h-64 overflow-y-auto", role: "listbox", "aria-multiselectable": "true", children: te ? /* @__PURE__ */ a("div", { className: "flex items-center justify-center gap-2 py-6 text-sm text-input-text-secondary", children: [
238
- /* @__PURE__ */ s(fe, { className: p(S, "animate-spin") }),
239
- y
240
- ] }) : h.length === 0 ? /* @__PURE__ */ s("div", { className: "py-6 text-center text-sm text-input-text-secondary", children: D }) : /* @__PURE__ */ a(ue, { children: [
241
- G && /* @__PURE__ */ a("div", { className: "mb-1", children: [
242
- /* @__PURE__ */ s("button", { type: "button", className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none", onClick: ae, children: T }),
243
- /* @__PURE__ */ s("div", { className: "mx-3 my-1 h-px bg-input-border" })
287
+ /* @__PURE__ */ r("div", { className: "max-h-64 overflow-y-auto", role: "listbox", "aria-multiselectable": "true", children: Y ? /* @__PURE__ */ o("div", { "data-testid": "spectral-multiselect-loading", className: "flex items-center justify-center gap-2 py-6 text-sm text-input-text-secondary", children: [
288
+ /* @__PURE__ */ r(pe, {}),
289
+ M
290
+ ] }) : w.length === 0 ? /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-empty-message", className: "py-6 text-center text-sm text-input-text-secondary", children: n }) : /* @__PURE__ */ o(de, { children: [
291
+ U && /* @__PURE__ */ o("div", { className: "mb-1", children: [
292
+ /* @__PURE__ */ r(
293
+ "button",
294
+ {
295
+ className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover focus:outline-none",
296
+ "data-testid": "spectral-multiselect-select-all-button",
297
+ onClick: ie,
298
+ type: "button",
299
+ children: H
300
+ }
301
+ ),
302
+ /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" })
244
303
  ] }),
245
- x.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: x.ungrouped.map((e, n) => A(e, n)) }),
246
- Object.entries(x.groups).map(([e, n]) => /* @__PURE__ */ a("div", { className: "mb-1", children: [
247
- (x.ungrouped.length > 0 || Object.keys(x.groups).indexOf(e) > 0) && /* @__PURE__ */ s("div", { className: "mx-3 my-1 h-px bg-input-border" }),
248
- /* @__PURE__ */ s("div", { className: "px-3 py-1 text-xs font-semibold text-input-text-secondary uppercase tracking-wide", children: e }),
249
- n.map((r, c) => A(r, h.indexOf(r)))
304
+ N.ungrouped.length > 0 && /* @__PURE__ */ r("div", { className: "mb-1", children: N.ungrouped.map((e, s) => F(e, s)) }),
305
+ Object.entries(N.groups).map(([e, s]) => /* @__PURE__ */ o("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
306
+ (N.ungrouped.length > 0 || Object.keys(N.groups).indexOf(e) > 0) && /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
307
+ /* @__PURE__ */ r("div", { "data-testid": "spectral-multiselect-group-name", className: "px-3 py-1 text-xs font-semibold text-input-text-secondary uppercase tracking-wide", children: e }),
308
+ s.map((t, c) => F(t, w.indexOf(t)))
250
309
  ] }, e)),
251
- H && t.length > 0 && /* @__PURE__ */ a("div", { className: "mt-1", children: [
252
- /* @__PURE__ */ s("div", { className: "mx-3 my-1 h-px bg-input-border" }),
253
- /* @__PURE__ */ s("button", { type: "button", className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-danger hover:bg-danger-50 focus:bg-danger-50 focus:outline-none", onClick: $, children: B })
310
+ V && a.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1", children: [
311
+ /* @__PURE__ */ r("div", { className: "mx-3 my-1 h-px bg-input-border" }),
312
+ /* @__PURE__ */ r("button", { className: "w-full flex items-center gap-3 px-3 py-2 text-sm font-medium text-danger hover:bg-danger-50 focus:bg-danger-50 focus:outline-none", "data-testid": "spectral-multiselect-clear-all-button", onClick: j, type: "button", children: l })
254
313
  ] })
255
314
  ] }) })
256
315
  ] }) })
257
316
  ] }),
258
- u === "error" && d && /* @__PURE__ */ s("p", { id: M, className: "mt-1.5 text-sm text-danger-500", "data-testid": "multiselect-error-message", "aria-live": "polite", "aria-atomic": "true", children: d })
317
+ x === "error" && g && /* @__PURE__ */ r(me, { id: K, dataTestId: "spectral-multiselect-error-message", message: g })
259
318
  ] });
260
319
  }
261
320
  );
262
- De.displayName = "MultiSelectBase";
321
+ Se.displayName = "MultiSelectBase";
263
322
  export {
264
- De as MultiSelectBase
323
+ Se as MultiSelectBase
265
324
  };
@@ -1,14 +1,16 @@
1
1
  import { MultiSelectBaseProps } from './MultiSelectBase';
2
- export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options'> {
2
+ export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options' | 'value'> {
3
3
  onSearchChange?: (search: string) => void;
4
- onValueChange: (value: string[]) => void;
4
+ onValueChange?: (value: string[]) => void;
5
+ value?: string[];
5
6
  options: Array<{
7
+ disabled?: boolean;
8
+ group?: string;
6
9
  label: string;
7
10
  value: string;
8
- group?: string;
9
11
  }>;
10
- loading?: boolean;
11
12
  emptyText?: string;
13
+ loading?: boolean;
12
14
  sortAlphabetically?: boolean;
13
15
  }
14
16
  export declare const MultiSelect: import('react').ForwardRefExoticComponent<MultiSelectProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,18 +1,19 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as m } from "react/jsx-runtime";
4
- import { MultiSelectBase as p } from "./MultiSelectBase.js";
5
- import { forwardRef as u } from "react";
6
- const f = u(({ onValueChange: t, options: a, loading: l = !1, emptyText: o = "No matches found.", state: s, ...r }, i) => {
7
- const d = a.map((e) => ({
8
- label: e.label,
9
- value: e.value,
3
+ import { jsx as u } from "react/jsx-runtime";
4
+ import { MultiSelectBase as f } from "./MultiSelectBase.js";
5
+ import { forwardRef as c } from "react";
6
+ const n = c(({ emptyText: l = "No matches found.", loading: t = !1, onValueChange: d, options: s, state: i, value: o = [], ...a }, r) => {
7
+ const m = s.map((e) => ({
8
+ disabled: e.disabled ?? !1,
10
9
  group: e.group,
11
- disabled: !1
12
- }));
13
- return /* @__PURE__ */ m(p, { ref: i, onChange: t, options: d, state: l ? "loading" : s, emptyMessage: o, ...r });
10
+ label: e.label,
11
+ value: e.value
12
+ })), b = t ? "loading" : i;
13
+ return /* @__PURE__ */ u(f, { disabled: a.disabled, "data-disabled": a.disabled, emptyMessage: l, onChange: d ?? (() => {
14
+ }), options: m, ref: r, state: b, value: o, ...a });
14
15
  });
15
- f.displayName = "MultiSelect";
16
+ n.displayName = "MultiSelect";
16
17
  export {
17
- f as MultiSelect
18
+ n as MultiSelect
18
19
  };
package/dist/Popover.js CHANGED
@@ -218,11 +218,12 @@ function $(e) {
218
218
  return e ? "open" : "closed";
219
219
  }
220
220
  var ce = F, pe = y, ie = D, le = M, ue = T;
221
- const Re = ({ ...e }) => /* @__PURE__ */ s(ce, { "data-slot": "popover", ...e }), Ae = ({ ...e }) => /* @__PURE__ */ s(ie, { "data-slot": "popover-trigger", ...e }), xe = ({ align: e = "center", className: n, side: r = "bottom", sideOffset: a = 4, width: o = "w-fit", ...t }) => /* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(
221
+ const Re = ({ ...e }) => /* @__PURE__ */ s(ce, { "data-slot": "popover", "data-testid": "spectral-popover", ...e }), Ae = ({ ...e }) => /* @__PURE__ */ s(ie, { "data-slot": "popover-trigger", "data-testid": "spectral-popover-trigger", ...e }), xe = ({ align: e = "center", className: n, side: r = "bottom", sideOffset: a = 4, width: o = "w-fit", ...t }) => /* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(
222
222
  ue,
223
223
  {
224
224
  align: e,
225
225
  "data-slot": "popover-content",
226
+ "data-testid": "spectral-popover-content",
226
227
  side: r,
227
228
  sideOffset: a,
228
229
  className: Q(