@spear-ai/spectral 1.12.6 → 1.13.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 (53) hide show
  1. package/dist/.js +41 -38
  2. package/dist/Button.d.ts +1 -1
  3. package/dist/Button.js +46 -45
  4. package/dist/Checkbox.js +6 -5
  5. package/dist/{Combobox-DCCcIDgq.js → Combobox-DRQqx0os.js} +9 -8
  6. package/dist/Combobox.js +1 -1
  7. package/dist/ControlGroup/ControlGroupSelect.d.ts +5 -1
  8. package/dist/ControlGroup/ControlGroupSelect.js +73 -67
  9. package/dist/ControlGroup.js +29 -24
  10. package/dist/DateTimePicker/TimePeriodSelect.js +1 -1
  11. package/dist/DateTimePicker.js +8 -7
  12. package/dist/DropdownMenu-BO_RPCVU.js +870 -0
  13. package/dist/DropdownMenu.d.ts +3 -2
  14. package/dist/DropdownMenu.js +2 -868
  15. package/dist/FormFieldMessage.d.ts +11 -0
  16. package/dist/FormFieldMessage.js +55 -0
  17. package/dist/Input.d.ts +1 -0
  18. package/dist/Input.js +68 -67
  19. package/dist/InputNumeric.js +3 -14
  20. package/dist/{InputOTP-DyhesOLs.js → InputOTP-DLn7ja7J.js} +5 -4
  21. package/dist/InputOTP.js +1 -1
  22. package/dist/MultiSelect/MultiSelectBase.js +105 -104
  23. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +2 -2
  24. package/dist/{RadioGroup-BsBK247l.js → RadioGroup-D-XjCU4Q.js} +33 -28
  25. package/dist/RadioGroup.js +1 -1
  26. package/dist/Select.js +21 -20
  27. package/dist/{Switch-Vep4hsq4.js → Switch-CSmXtkia.js} +26 -25
  28. package/dist/Switch.js +1 -1
  29. package/dist/Textarea/TextareaUtils.js +4 -8
  30. package/dist/Textarea.js +23 -22
  31. package/dist/Toggle.js +1 -1
  32. package/dist/ToggleGroup/ToggleGroup.context.d.ts +9 -0
  33. package/dist/ToggleGroup/ToggleGroup.context.js +11 -0
  34. package/dist/ToggleGroup/ToggleGroupItem.d.ts +15 -0
  35. package/dist/ToggleGroup/ToggleGroupItem.js +35 -0
  36. package/dist/ToggleGroup/ToggleGroupSplitMenuItem.d.ts +22 -0
  37. package/dist/ToggleGroup/ToggleGroupSplitMenuItem.js +114 -0
  38. package/dist/ToggleGroup.d.ts +6 -14
  39. package/dist/ToggleGroup.js +24 -46
  40. package/dist/Tooltip.js +1 -1
  41. package/dist/index.d.ts +2 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/primitives/select.d.ts +1 -1
  44. package/dist/primitives/select.d.ts.map +1 -1
  45. package/dist/primitives/select.js +1 -1
  46. package/dist/primitives/textarea.js +1 -1
  47. package/dist/{select-oAOoVl5g.js → select-DFE8xm1L.js} +230 -259
  48. package/dist/styles/spectral.css +1 -1
  49. package/dist/utils/formFieldUtils.d.ts +1 -13
  50. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  51. package/dist/utils/formFieldUtils.js +48 -69
  52. package/package.json +1 -1
  53. /package/dist/{Tooltip-vEdD4f2U.js → Tooltip-CTjKOfvC.js} +0 -0
@@ -5,15 +5,16 @@ import { ChevronDownIcon as t } from "../Icons/ChevronDownIcon.js";
5
5
  import { CloseIcon as n } from "../Icons/CloseIcon.js";
6
6
  import { SearchIcon as r } from "../Icons/SearchIcon.js";
7
7
  import { t as i } from "../twUtils-BpqlKSeB.js";
8
- import { EmptyState as a, ErrorMessage as o, LoadingState as s, WarningMessage as c, getAriaProps as l, getDropdownSurfaceClasses as u, getDropdownWidthStyles as d, getErrorMessageId as f, getTriggerClasses as ee, useFormFieldId as te } from "../utils/formFieldUtils.js";
8
+ import { ErrorMessage as a, WarningMessage as o } from "../FormFieldMessage.js";
9
+ import { EmptyState as s, LoadingState as c, getAriaProps as l, getDropdownSurfaceClasses as u, getDropdownWidthStyles as d, getErrorMessageId as f, getTriggerClasses as ee, useFormFieldId as te } from "../utils/formFieldUtils.js";
9
10
  import { useUncontrolledState as ne } from "../hooks/useUncontrolledState.js";
10
11
  import { Label as re } from "../Label.js";
11
12
  import { useAutoDropdownHorizontalShift as ie } from "../utils/dropdownPositioning.js";
12
13
  import { a as ae, i as oe, n as se, r as ce } from "../dist-B9w6c9RC.js";
13
14
  import { useCallback as p, useEffect as le, useId as ue, useMemo as m, useRef as de, useState as h } from "react";
14
- import { Fragment as fe, jsx as g, jsxs as _ } from "react/jsx-runtime";
15
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
15
16
  //#region src/components/MultiSelect/MultiSelectBase.tsx
16
- var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "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)"), he = (e, t, n, r, i, a, o, s, c) => {
17
+ var fe = "h-4 w-4", pe = () => i("max-h-80 z-50 overflow-hidden", u(), "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)"), me = (e, t, n, r, i, a, o, s, c) => {
17
18
  let [l, u] = h(-1), d = m(() => {
18
19
  let t = [];
19
20
  return o && t.push({ type: "search" }), s && t.push({ type: "select-all" }), e.forEach((e, n) => {
@@ -102,21 +103,21 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
102
103
  return e.type === "option" ? e.value : null;
103
104
  }, [l, d])
104
105
  };
105
- }, v = ({ className: u, clearAllLabel: v = "Clear all", closeOnSelect: y = !1, dropdownWidth: b = "trigger", emptyMessage: ge = "No options found", errorMessage: x, defaultValue: _e = [], disabled: ve, id: ye, label: S, loadingMessage: be = "Loading options…", maxCount: C = 3, name: w, onChange: xe, options: T = [], placeholder: Se = "Select options", ref: Ce, searchPlaceholder: we = "Search options…", selectAllLabel: Te = "Select all", showClearAll: Ee = !0, showSearch: E = !0, showSelectAll: D = !0, sortAlphabetically: O = !1, state: k = "default", value: De, warningMessage: A, "aria-label": Oe, "aria-describedby": ke, ...j }) => {
106
- let Ae = ue(), M = te(ye, w ?? `multiselect-${Ae}`), N = `${M}-listbox`, P = f(M), F = `${M}-warning`, je = k === "error" ? P : k === "warning" && A ? F : void 0, [I, L] = h(!1), { dropdownShiftStyle: Me, setDropdownElement: Ne } = ie(I), [R, z] = h(""), [B, V] = ne({
107
- value: De,
106
+ }, y = ({ className: u, clearAllLabel: y = "Clear all", closeOnSelect: b = !1, dropdownWidth: x = "trigger", emptyMessage: he = "No options found", errorMessage: ge, defaultValue: _e = [], disabled: ve, id: S, label: C, loadingMessage: ye = "Loading options…", maxCount: w = 3, name: T, onChange: be, options: E = [], placeholder: xe = "Select options", ref: Se, searchPlaceholder: Ce = "Search options…", selectAllLabel: we = "Select all", showClearAll: Te = !0, showSearch: D = !0, showSelectAll: O = !0, sortAlphabetically: k = !1, state: A = "default", value: Ee, warningMessage: j, "aria-label": De, "aria-describedby": Oe, ...M }) => {
107
+ let ke = ue(), N = te(S, T ?? `multiselect-${ke}`), P = `${N}-listbox`, F = f(N), I = `${N}-warning`, Ae = A === "error" ? F : A === "warning" && j ? I : void 0, [L, R] = h(!1), { dropdownShiftStyle: je, setDropdownElement: Me } = ie(L), [z, Ne] = h(""), [B, V] = ne({
108
+ value: Ee,
108
109
  defaultValue: _e,
109
- onChange: xe
110
- }), H = de(null), U = !!ve, Pe = k === "loading", Fe = l(k, ke, j.required, je), { dropdownOverflowStyle: Ie, dropdownWidthMode: W, resolvedDropdownWidth: Le } = d({
111
- dropdownWidth: b,
110
+ onChange: be
111
+ }), H = de(null), U = !!ve, Pe = A === "loading", Fe = l(A, Oe, M.required, Ae), { dropdownOverflowStyle: Ie, dropdownWidthMode: W, resolvedDropdownWidth: Le } = d({
112
+ dropdownWidth: x,
112
113
  triggerWidth: "var(--radix-popover-trigger-width)"
113
114
  }), G = m(() => {
114
- let e = T.filter((e) => e.label.toLowerCase().includes(R.toLowerCase()));
115
- return O && (e = [...e].sort((e, t) => e.label.localeCompare(t.label))), e;
115
+ let e = E.filter((e) => e.label.toLowerCase().includes(z.toLowerCase()));
116
+ return k && (e = [...e].sort((e, t) => e.label.localeCompare(t.label))), e;
116
117
  }, [
117
- T,
118
- R,
119
- O
118
+ E,
119
+ z,
120
+ k
120
121
  ]), K = m(() => {
121
122
  let e = {}, t = [];
122
123
  return G.forEach((n) => {
@@ -127,43 +128,43 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
127
128
  hasGroups: Object.keys(e).length > 0
128
129
  };
129
130
  }, [G]), q = p((e) => {
130
- T.find((t) => t.value === e)?.disabled || (V(B.includes(e) ? B.filter((t) => t !== e) : [...B, e]), y && L(!1));
131
+ E.find((t) => t.value === e)?.disabled || (V(B.includes(e) ? B.filter((t) => t !== e) : [...B, e]), b && R(!1));
131
132
  }, [
132
- y,
133
- T,
133
+ b,
134
+ E,
134
135
  V,
135
136
  B
136
137
  ]), J = p(() => {
137
- let e = T.filter((e) => !e.disabled).map((e) => e.value);
138
+ let e = E.filter((e) => !e.disabled).map((e) => e.value);
138
139
  e.every((e) => B.includes(e)) ? V([]) : V(e);
139
140
  }, [
140
- T,
141
+ E,
141
142
  V,
142
143
  B
143
144
  ]), Y = p(() => {
144
145
  V([]);
145
- }, [V]), X = m(() => T.filter((e) => !e.disabled).map((e) => e.value), [T]), Re = X.length > 0 && X.every((e) => B.includes(e)), { focusedOptionValue: Z, getOptionFocusIndex: ze, handleKeyDown: Be, isSelectAllFocused: Ve, setFocusedIndex: Q } = he(G, Y, () => L(!1), q, J, H, E, D, !1);
146
+ }, [V]), X = m(() => E.filter((e) => !e.disabled).map((e) => e.value), [E]), Re = X.length > 0 && X.every((e) => B.includes(e)), { focusedOptionValue: Z, getOptionFocusIndex: ze, handleKeyDown: Be, isSelectAllFocused: Ve, setFocusedIndex: Q } = me(G, Y, () => R(!1), q, J, H, D, O, !1);
146
147
  le(() => {
147
- Q(I ? 0 : -1);
148
- }, [I, Q]);
148
+ Q(L ? 0 : -1);
149
+ }, [L, Q]);
149
150
  let He = p((e) => {
150
- z(e.target.value);
151
+ Ne(e.target.value);
151
152
  }, []), Ue = () => {
152
- if (B.length === 0) return /* @__PURE__ */ g("span", {
153
+ if (B.length === 0) return /* @__PURE__ */ _("span", {
153
154
  className: "min-h-8 flex items-center text-input-text-placeholder",
154
- children: Se
155
+ children: xe
155
156
  });
156
- let e = B.slice(0, C), t = B.length - C;
157
- return /* @__PURE__ */ _("div", {
157
+ let e = B.slice(0, w), t = B.length - w;
158
+ return /* @__PURE__ */ v("div", {
158
159
  className: "gap-1 flex flex-wrap items-center overflow-hidden",
159
160
  children: [e.map((e) => {
160
- let t = T.find((t) => t.value === e);
161
- return t ? /* @__PURE__ */ _("span", {
161
+ let t = E.find((t) => t.value === e);
162
+ return t ? /* @__PURE__ */ v("span", {
162
163
  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",
163
- children: [/* @__PURE__ */ g("span", {
164
+ children: [/* @__PURE__ */ _("span", {
164
165
  className: "truncate",
165
166
  children: t.label
166
- }), /* @__PURE__ */ g("span", {
167
+ }), /* @__PURE__ */ _("span", {
167
168
  "aria-hidden": "true",
168
169
  className: "hover:text-danger rounded-sm cursor-pointer",
169
170
  "data-testid": "spectral-multiselect-remove-item-button",
@@ -173,11 +174,11 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
173
174
  onPointerDown: (e) => {
174
175
  e.stopPropagation();
175
176
  },
176
- children: /* @__PURE__ */ g(n, { size: 12 })
177
+ children: /* @__PURE__ */ _(n, { size: 12 })
177
178
  })]
178
179
  }, e) : null;
179
- }), t > 0 && /* @__PURE__ */ _("span", {
180
- className: "text-input-text-secondary text-xs py-1 flex items-center",
180
+ }), t > 0 && /* @__PURE__ */ v("span", {
181
+ className: "text-input-text-secondary text-xs py-1 flex items-center tabular-nums",
181
182
  children: [
182
183
  "+",
183
184
  t,
@@ -186,55 +187,55 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
186
187
  })]
187
188
  });
188
189
  }, $ = (t, n) => {
189
- let r = B.includes(t.value), a = ze(n), o = `${N}-option-${t.value}`;
190
- return /* @__PURE__ */ _("button", {
190
+ let r = B.includes(t.value), a = ze(n), o = `${P}-option-${t.value}`;
191
+ return /* @__PURE__ */ v("button", {
191
192
  "aria-selected": r,
192
- className: i("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", a && "bg-input-bg--hover", r && "font-medium text-input-text"),
193
+ className: i("my-0.5 first:mt-0 last:mb-0 gap-3 rounded-sm 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", a && "bg-input-bg--hover", r && "font-medium text-input-text"),
193
194
  disabled: t.disabled,
194
195
  id: o,
195
196
  onClick: () => q(t.value),
196
197
  role: "option",
197
198
  type: "button",
198
- children: [/* @__PURE__ */ g("div", {
199
+ children: [/* @__PURE__ */ _("div", {
199
200
  "data-testid": "spectral-multiselect-selected-indicator",
200
201
  className: i("w-4 h-4 rounded flex items-center justify-center border border-input-border", r && "bg-primary border-primary"),
201
- children: r && /* @__PURE__ */ g(e, { size: 12 })
202
- }), /* @__PURE__ */ g("span", { children: t.label })]
202
+ children: r && /* @__PURE__ */ _(e, { size: 12 })
203
+ }), /* @__PURE__ */ _("span", { children: t.label })]
203
204
  }, t.value);
204
205
  };
205
- return /* @__PURE__ */ _("div", {
206
+ return /* @__PURE__ */ v("div", {
206
207
  className: "w-full",
207
208
  "data-testid": "spectral-multiselect-root",
208
209
  children: [
209
- S && /* @__PURE__ */ g(re, {
210
+ C && /* @__PURE__ */ _(re, {
210
211
  className: i("mb-2 block text-text-primary", U && "text-text-secondary"),
211
212
  "data-testid": "spectral-multiselect-label",
212
- htmlFor: M,
213
- children: S
213
+ htmlFor: N,
214
+ children: C
214
215
  }),
215
- /* @__PURE__ */ g(oe, {
216
- open: I,
217
- onOpenChange: L,
218
- children: /* @__PURE__ */ _("div", {
216
+ /* @__PURE__ */ _(oe, {
217
+ open: L,
218
+ onOpenChange: R,
219
+ children: /* @__PURE__ */ v("div", {
219
220
  className: "relative",
220
221
  "data-testid": "spectral-multiselect-wrapper",
221
- onKeyDown: I ? Be : void 0,
222
+ onKeyDown: L ? Be : void 0,
222
223
  role: "none",
223
224
  children: [
224
- /* @__PURE__ */ g(ae, {
225
+ /* @__PURE__ */ _(ae, {
225
226
  asChild: !0,
226
- children: /* @__PURE__ */ _("button", {
227
- "aria-activedescendant": I && Z ? `${N}-option-${Z}` : void 0,
228
- "aria-controls": I ? N : void 0,
229
- "aria-expanded": I,
230
- "aria-label": Oe ?? S,
231
- className: i(ee(I, k, u), "max-h-22 py-2 text-sm"),
232
- "data-state": k,
227
+ children: /* @__PURE__ */ v("button", {
228
+ "aria-activedescendant": L && Z ? `${P}-option-${Z}` : void 0,
229
+ "aria-controls": L ? P : void 0,
230
+ "aria-expanded": L,
231
+ "aria-label": De ?? C,
232
+ className: i(ee(L, A, u), "max-h-22 py-2 text-sm"),
233
+ "data-state": A,
233
234
  "data-testid": "spectral-multiselect-trigger",
234
235
  disabled: U,
235
- id: M,
236
- name: w,
237
- ref: Ce,
236
+ id: N,
237
+ name: T,
238
+ ref: Se,
238
239
  role: "combobox",
239
240
  style: {
240
241
  "--multiselect-border-radius": "0.5rem",
@@ -243,98 +244,98 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
243
244
  },
244
245
  type: "button",
245
246
  ...Fe,
246
- ...j,
247
- children: [/* @__PURE__ */ g("div", {
247
+ ...M,
248
+ children: [/* @__PURE__ */ _("div", {
248
249
  className: "min-w-0 flex-1 overflow-hidden",
249
250
  "data-testid": "spectral-multiselect-selected-items",
250
251
  children: Ue()
251
- }), /* @__PURE__ */ g("div", {
252
+ }), /* @__PURE__ */ _("div", {
252
253
  className: "gap-2 ml-2 flex shrink-0 items-center",
253
- children: /* @__PURE__ */ g(t, {
254
- className: i("text-input-icon transition-transform duration-200", I && "rotate-180"),
254
+ children: /* @__PURE__ */ _(t, {
255
+ className: i("text-input-icon transition-transform duration-200", L && "rotate-180"),
255
256
  size: 20
256
257
  })
257
258
  })]
258
259
  })
259
260
  }),
260
- Ee && B.length > 0 && /* @__PURE__ */ g("button", {
261
+ Te && B.length > 0 && /* @__PURE__ */ _("button", {
261
262
  "aria-label": "Clear all selections",
262
263
  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",
263
264
  "data-testid": "spectral-multiselect-clear-all-button",
264
265
  disabled: U,
265
266
  onClick: (e) => {
266
- e.stopPropagation(), Y(), document.getElementById(M)?.focus();
267
+ e.stopPropagation(), Y(), document.getElementById(N)?.focus();
267
268
  },
268
269
  type: "button",
269
- children: /* @__PURE__ */ g(n, { size: 12 })
270
+ children: /* @__PURE__ */ _(n, { size: 12 })
270
271
  }),
271
- /* @__PURE__ */ g(ce, { children: /* @__PURE__ */ g(se, {
272
+ /* @__PURE__ */ _(ce, { children: /* @__PURE__ */ _(se, {
272
273
  align: "start",
273
274
  avoidCollisions: !0,
274
- className: me(),
275
+ className: pe(),
275
276
  collisionPadding: 10,
276
277
  "data-dropdown-width-mode": W,
277
- "data-dropdown-width-value": W === "custom" ? b : void 0,
278
+ "data-dropdown-width-value": W === "custom" ? x : void 0,
278
279
  "data-testid": "spectral-multiselect-dropdown",
279
280
  onOpenAutoFocus: (e) => {
280
- e.preventDefault(), E && H.current?.focus();
281
+ e.preventDefault(), D && H.current?.focus();
281
282
  },
282
283
  side: "bottom",
283
284
  sideOffset: 4,
284
- ref: Ne,
285
+ ref: Me,
285
286
  style: {
286
287
  width: Le,
287
- ...b === "trigger" ? {} : Ie,
288
- ...Me
288
+ ...x === "trigger" ? {} : Ie,
289
+ ...je
289
290
  },
290
- children: /* @__PURE__ */ _("div", {
291
+ children: /* @__PURE__ */ v("div", {
291
292
  className: "p-1",
292
- children: [E && /* @__PURE__ */ _("div", {
293
+ children: [D && /* @__PURE__ */ v("div", {
293
294
  className: "mb-2 relative",
294
- children: [/* @__PURE__ */ g(r, { className: i(pe, "left-3 text-input-icon absolute top-1/2 -translate-y-1/2") }), /* @__PURE__ */ g("input", {
295
+ children: [/* @__PURE__ */ _(r, { className: i(fe, "left-3 text-input-icon absolute top-1/2 -translate-y-1/2") }), /* @__PURE__ */ _("input", {
295
296
  "aria-label": "Search options",
296
297
  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",
297
298
  "data-testid": "spectral-multiselect-search-input",
298
299
  onChange: He,
299
- placeholder: we,
300
+ placeholder: Ce,
300
301
  ref: H,
301
302
  type: "text",
302
- value: R
303
+ value: z
303
304
  })]
304
- }), /* @__PURE__ */ g("div", {
305
+ }), /* @__PURE__ */ _("div", {
305
306
  className: "max-h-64 overflow-y-auto",
306
- id: N,
307
+ id: P,
307
308
  role: "listbox",
308
309
  "aria-multiselectable": "true",
309
- children: Pe ? /* @__PURE__ */ g(s, {
310
+ children: Pe ? /* @__PURE__ */ _(c, {
310
311
  className: "text-sm",
311
- message: be,
312
+ message: ye,
312
313
  "data-testid": "spectral-multiselect-loading"
313
- }) : G.length === 0 ? /* @__PURE__ */ g(a, {
314
+ }) : G.length === 0 ? /* @__PURE__ */ _(s, {
314
315
  className: "text-sm",
315
316
  "data-testid": "spectral-multiselect-empty-message",
316
- message: ge
317
- }) : /* @__PURE__ */ _(fe, { children: [
318
- D && /* @__PURE__ */ _("div", {
317
+ message: he
318
+ }) : /* @__PURE__ */ v(g, { children: [
319
+ O && /* @__PURE__ */ v("div", {
319
320
  className: "mb-1",
320
- children: [/* @__PURE__ */ g("button", {
321
- className: i("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", Ve && "bg-input-bg--hover"),
321
+ children: [/* @__PURE__ */ _("button", {
322
+ className: i("my-0.5 first:mt-0 last:mb-0 gap-3 rounded-sm px-3 py-2 text-sm font-medium text-input-text-secondary flex w-full items-center hover:bg-input-bg--hover focus-visible:bg-input-bg--hover focus-visible:outline-none", Ve && "bg-input-bg--hover"),
322
323
  "data-testid": "spectral-multiselect-select-all-button",
323
324
  onClick: J,
324
325
  type: "button",
325
- children: Re ? v : Te
326
- }), /* @__PURE__ */ g("div", { className: "mx-3 my-1 h-px bg-input-border" })]
326
+ children: Re ? y : we
327
+ }), /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" })]
327
328
  }),
328
- K.ungrouped.length > 0 && /* @__PURE__ */ g("div", {
329
+ K.ungrouped.length > 0 && /* @__PURE__ */ _("div", {
329
330
  className: "mb-1",
330
331
  children: K.ungrouped.map((e, t) => $(e, t))
331
332
  }),
332
- Object.entries(K.groups).map(([e, t]) => /* @__PURE__ */ _("div", {
333
+ Object.entries(K.groups).map(([e, t]) => /* @__PURE__ */ v("div", {
333
334
  className: "mb-1",
334
335
  "data-testid": "spectral-multiselect-group",
335
336
  children: [
336
- (K.ungrouped.length > 0 || Object.keys(K.groups).indexOf(e) > 0) && /* @__PURE__ */ g("div", { className: "mx-3 my-1 h-px bg-input-border" }),
337
- /* @__PURE__ */ g("div", {
337
+ (K.ungrouped.length > 0 || Object.keys(K.groups).indexOf(e) > 0) && /* @__PURE__ */ _("div", { className: "mx-3 my-1 h-px bg-input-border" }),
338
+ /* @__PURE__ */ _("div", {
338
339
  "data-testid": "spectral-multiselect-group-name",
339
340
  className: "px-3 py-1 text-xs font-semibold text-input-text-secondary tracking-wide uppercase",
340
341
  children: e
@@ -349,19 +350,19 @@ var pe = "h-4 w-4", me = () => i("max-h-80 z-50 overflow-hidden", u(), "motion-s
349
350
  ]
350
351
  })
351
352
  }),
352
- k === "error" && x && /* @__PURE__ */ g(o, {
353
+ /* @__PURE__ */ _(a, {
353
354
  dataTestId: "spectral-multiselect-error-message",
354
- id: P,
355
- message: x
355
+ id: F,
356
+ message: A === "error" ? ge : null
356
357
  }),
357
- k === "warning" && A && /* @__PURE__ */ g(c, {
358
+ /* @__PURE__ */ _(o, {
358
359
  dataTestId: "spectral-multiselect-warning-message",
359
- id: F,
360
- message: A
360
+ id: I,
361
+ message: A === "warning" ? j : null
361
362
  })
362
363
  ]
363
364
  });
364
365
  };
365
- v.displayName = "MultiSelectBase";
366
+ y.displayName = "MultiSelectBase";
366
367
  //#endregion
367
- export { v as MultiSelectBase };
368
+ export { y as MultiSelectBase };
@@ -1,8 +1,6 @@
1
1
  import { AsChildProp } from '../primitives/slot';
2
2
  import { ButtonHTMLAttributes, ReactNode, Ref } from 'react';
3
3
  export interface RadioButtonGroupProps {
4
- 'aria-label'?: string;
5
- 'aria-labelledby'?: string;
6
4
  asChild?: boolean;
7
5
  children: ReactNode;
8
6
  className?: string;
@@ -10,6 +8,8 @@ export interface RadioButtonGroupProps {
10
8
  isKeptActive?: boolean;
11
9
  onValueChange?: (value: string) => void;
12
10
  value?: string;
11
+ 'aria-label'?: string;
12
+ 'aria-labelledby'?: string;
13
13
  }
14
14
  export interface RadioButtonGroupItemProps extends AsChildProp, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onSelect' | 'type'> {
15
15
  children: ReactNode;
@@ -3,7 +3,8 @@ import { a as e, d as t, l as n, r, t as i } from "./dist-DEkDg4Sk.js";
3
3
  import { t as a } from "./dist-CcsVPym2.js";
4
4
  import { t as o } from "./dist-D9FsQh8P.js";
5
5
  import { t as s } from "./twUtils-BpqlKSeB.js";
6
- import { ErrorMessage as c, WarningMessage as l, useFormFieldId as u } from "./utils/formFieldUtils.js";
6
+ import { ErrorMessage as c, WarningMessage as l } from "./FormFieldMessage.js";
7
+ import { useFormFieldId as u } from "./utils/formFieldUtils.js";
7
8
  import { Label as d } from "./Label.js";
8
9
  import { t as f } from "./dist-PfrTYHr_.js";
9
10
  import { t as p } from "./dist-s1uWaZYZ.js";
@@ -207,34 +208,38 @@ var J = w({
207
208
  a,
208
209
  x
209
210
  ]);
210
- return /* @__PURE__ */ A(J.Provider, {
211
+ return /* @__PURE__ */ k(J.Provider, {
211
212
  value: D,
212
- children: [
213
- /* @__PURE__ */ k(ue, {
214
- className: s("flex w-full text-text-primary", p === "vertical" ? "gap-4 flex-col" : "gap-5 flex-row", _ === "unstyled" && "gap-2.5 w-fit", n),
215
- "data-state": g,
216
- "data-testid": "spectral-radio-group",
217
- id: S,
218
- "aria-invalid": g === "error" ? !0 : void 0,
219
- "aria-describedby": [T, y].filter(Boolean).join(" ") || void 0,
220
- disabled: D.groupDisabled,
221
- name: o,
222
- onValueChange: E,
223
- ref: m,
224
- value: x,
225
- ...b
226
- }),
227
- g === "error" && i && /* @__PURE__ */ k(c, {
228
- dataTestId: "spectral-radio-group-error-message",
229
- id: C,
230
- message: i
231
- }),
232
- g === "warning" && v && /* @__PURE__ */ k(l, {
233
- dataTestId: "spectral-radio-group-warning-message",
234
- id: w,
235
- message: v
236
- })
237
- ]
213
+ children: /* @__PURE__ */ A("div", {
214
+ "data-slot": "radio-group-field",
215
+ className: "space-y-1.5 w-full",
216
+ children: [
217
+ /* @__PURE__ */ k(ue, {
218
+ className: s("flex w-full text-text-primary", p === "vertical" ? "gap-4 flex-col" : "gap-5 flex-row", _ === "unstyled" && "gap-2.5 w-fit", n),
219
+ "data-state": g,
220
+ "data-testid": "spectral-radio-group",
221
+ id: S,
222
+ "aria-invalid": g === "error" ? !0 : void 0,
223
+ "aria-describedby": [T, y].filter(Boolean).join(" ") || void 0,
224
+ disabled: D.groupDisabled,
225
+ name: o,
226
+ onValueChange: E,
227
+ ref: m,
228
+ value: x,
229
+ ...b
230
+ }),
231
+ /* @__PURE__ */ k(c, {
232
+ dataTestId: "spectral-radio-group-error-message",
233
+ id: C,
234
+ message: g === "error" ? i : null
235
+ }),
236
+ /* @__PURE__ */ k(l, {
237
+ dataTestId: "spectral-radio-group-warning-message",
238
+ id: w,
239
+ message: g === "warning" ? v : null
240
+ })
241
+ ]
242
+ })
238
243
  });
239
244
  };
240
245
  X.displayName = "RadioGroup";
@@ -1,3 +1,3 @@
1
1
  'use client'
2
- import { n as e, r as t, t as n } from "./RadioGroup-BsBK247l.js";
2
+ import { n as e, r as t, t as n } from "./RadioGroup-D-XjCU4Q.js";
3
3
  export { n as RadioGroup, e as RadioGroupItem, t as RadioGroupLabel };
package/dist/Select.js CHANGED
@@ -4,30 +4,31 @@ import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
4
4
  import { ChevronDownIcon as t } from "./Icons/ChevronDownIcon.js";
5
5
  import { LoaderIcon as n } from "./Icons/LoaderIcon.js";
6
6
  import { t as r } from "./twUtils-BpqlKSeB.js";
7
- import { EmptyState as i, ErrorMessage as a, LoadingState as o, WarningMessage as s, getAriaProps as c, getDropdownSurfaceClasses as l, getDropdownWidthStyles as ee, getErrorMessageId as te, getFormFieldCSSProperties as ne, getOptionClasses as re, getTriggerClasses as ie, groupOptions as ae, useFormFieldId as oe } from "./utils/formFieldUtils.js";
7
+ import { ErrorMessage as i, WarningMessage as a } from "./FormFieldMessage.js";
8
+ import { EmptyState as o, LoadingState as s, getAriaProps as c, getDropdownSurfaceClasses as l, getDropdownWidthStyles as ee, getErrorMessageId as te, getFormFieldCSSProperties as ne, getOptionClasses as re, getTriggerClasses as ie, groupOptions as ae, useFormFieldId as oe } from "./utils/formFieldUtils.js";
8
9
  import { Label as u } from "./Label.js";
9
- import { C as se, S as ce, _ as le, b as ue, d, f, g as de, h as fe, m as pe, p as me, u as he, v as ge, x as p, y as _e } from "./select-oAOoVl5g.js";
10
+ import { C as se, S as ce, _ as le, b as d, d as f, f as ue, g as de, h as fe, m as pe, p as me, u as he, v as ge, x as p, y as _e } from "./select-DFE8xm1L.js";
10
11
  import { useAutoDropdownHorizontalShift as ve } from "./utils/dropdownPositioning.js";
11
12
  import { useState as ye } from "react";
12
13
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
13
14
  //#region src/components/Select/Select.tsx
14
15
  var _ = (_) => {
15
- let v = "value" in _, { align: y = "start", alignOffset: b = 0, avoidCollisions: x = !0, className: S, collisionBoundary: C, collisionPadding: w = 10, defaultValue: T, dropdownWidth: E = "trigger", emptyMessage: D = "No options found", errorMessage: O, disabled: k, id: A, label: j, labelClassName: M, loadingMessage: N = "Loading…", name: P, onChange: be, onValueChange: xe, options: F = [], placeholder: Se = "Select an option", position: I = "popper", ref: L, required: R, side: Ce = "bottom", sideOffset: we = 4, state: z = "default", value: B, warningMessage: V, "aria-label": Te, "aria-describedby": Ee, ...De } = _, H = v ? B ?? "" : B, [U, Oe] = ye(!1), { dropdownShiftStyle: ke, setDropdownElement: Ae } = ve(U), W = oe(A, P), G = `${W}-listbox`, K = te(W), q = `${W}-warning`, je = z === "error" && O ? K : z === "warning" && V ? q : void 0, { dropdownWidthMode: J, dropdownWidthStyle: Me, resolvedDropdownWidth: Y } = ee({
16
+ let v = "value" in _, { align: y = "start", alignOffset: b = 0, avoidCollisions: x = !0, className: S, collisionBoundary: C, collisionPadding: w = 10, defaultValue: T, dropdownWidth: E = "trigger", emptyMessage: D = "No options found", errorMessage: O, disabled: k, id: A, label: j, labelClassName: M, loadingMessage: N = "Loading…", name: P, onChange: F, onValueChange: be, options: I = [], placeholder: xe = "Select an option", position: L = "popper", ref: Se, required: R, side: Ce = "bottom", sideOffset: we = 4, state: z = "default", value: B, warningMessage: V, "aria-label": Te, "aria-describedby": Ee, ...De } = _, H = v ? B ?? "" : B, [U, Oe] = ye(!1), { dropdownShiftStyle: ke, setDropdownElement: Ae } = ve(U), W = oe(A, P), G = `${W}-listbox`, K = te(W), q = `${W}-warning`, je = z === "error" && O ? K : z === "warning" && V ? q : void 0, { dropdownWidthMode: J, dropdownWidthStyle: Me, resolvedDropdownWidth: Y } = ee({
16
17
  dropdownWidth: E,
17
18
  triggerWidth: "var(--radix-select-trigger-width)"
18
19
  }), Ne = {
19
20
  "--spectral-select-content-width": Y,
20
- ...I === "item-aligned" ? { width: Y } : {},
21
+ ...L === "item-aligned" ? { width: Y } : {},
21
22
  ...Me,
22
23
  ...ke
23
- }, X = !!k, Z = z === "loading", Pe = z === "error", Fe = c(z, Ee, R, je), { groups: Q, ungrouped: $ } = ae(F), Ie = (e) => {
24
- be?.(e), xe?.(e);
24
+ }, X = !!k, Z = z === "loading", Pe = z === "error", Fe = c(z, Ee, R, je), { groups: Q, ungrouped: $ } = ae(I), Ie = (e) => {
25
+ F?.(e), be?.(e);
25
26
  }, Le = () => {
26
- if (Z) return /* @__PURE__ */ h(o, {
27
+ if (Z) return /* @__PURE__ */ h(s, {
27
28
  "data-testid": "spectral-select-loading",
28
29
  message: N
29
30
  });
30
- if (F.length === 0) return /* @__PURE__ */ h(i, {
31
+ if (I.length === 0) return /* @__PURE__ */ h(o, {
31
32
  "data-testid": "spectral-select-empty",
32
33
  message: D
33
34
  });
@@ -55,7 +56,7 @@ var _ = (_) => {
55
56
  return /* @__PURE__ */ g(m, { children: [$.length > 0 && /* @__PURE__ */ g(m, { children: [$.map(t), Object.keys(Q).length > 0 && /* @__PURE__ */ h(p, {
56
57
  className: "-mx-1 my-1 h-px bg-border-secondary",
57
58
  "data-testid": "spectral-select-separator"
58
- })] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ g(f, {
59
+ })] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ g(ue, {
59
60
  "data-testid": "spectral-select-group",
60
61
  children: [
61
62
  i > 0 && /* @__PURE__ */ h(p, {
@@ -100,7 +101,7 @@ var _ = (_) => {
100
101
  "data-state": z,
101
102
  "data-testid": "spectral-select-trigger",
102
103
  id: W,
103
- ref: L,
104
+ ref: Se,
104
105
  role: "combobox",
105
106
  style: ne(),
106
107
  ...Fe,
@@ -111,7 +112,7 @@ var _ = (_) => {
111
112
  disabled: X,
112
113
  children: [/* @__PURE__ */ h(he, {
113
114
  "data-testid": "spectral-select-value",
114
- placeholder: Se
115
+ placeholder: xe
115
116
  }), /* @__PURE__ */ h(me, {
116
117
  asChild: !0,
117
118
  children: /* @__PURE__ */ h("div", {
@@ -123,11 +124,11 @@ var _ = (_) => {
123
124
  })
124
125
  })]
125
126
  })
126
- }), /* @__PURE__ */ h(le, { children: /* @__PURE__ */ g(d, {
127
+ }), /* @__PURE__ */ h(le, { children: /* @__PURE__ */ g(f, {
127
128
  align: y,
128
129
  alignOffset: b,
129
130
  avoidCollisions: x,
130
- className: r("relative z-50 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", l(), "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", "max-h-[min(var(--radix-select-content-available-height),300px)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", I === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1"),
131
+ className: r("relative z-50 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", l(), "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", "max-h-[min(var(--radix-select-content-available-height),300px)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--radix-select-content-transform-origin) overflow-hidden", L === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1"),
131
132
  collisionBoundary: C,
132
133
  collisionPadding: w,
133
134
  "data-dropdown-width-mode": J,
@@ -135,13 +136,13 @@ var _ = (_) => {
135
136
  id: G,
136
137
  "data-slot": "select-content",
137
138
  "data-testid": "spectral-select-content",
138
- position: I,
139
+ position: L,
139
140
  ref: Ae,
140
141
  side: Ce,
141
142
  sideOffset: we,
142
143
  style: Ne,
143
144
  children: [
144
- /* @__PURE__ */ h(ue, {
145
+ /* @__PURE__ */ h(d, {
145
146
  className: "py-1 flex cursor-default items-center justify-center",
146
147
  "data-testid": "spectral-select-scroll-up-button",
147
148
  children: /* @__PURE__ */ h(t, {
@@ -153,7 +154,7 @@ var _ = (_) => {
153
154
  /* @__PURE__ */ h(se, {
154
155
  asChild: !0,
155
156
  children: /* @__PURE__ */ h("div", {
156
- className: r("p-1", I === "popper" && (E === "trigger" ? "scroll-my-1 h-(--radix-select-trigger-height) w-(--spectral-select-content-width) min-w-(--spectral-select-content-width)" : "scroll-my-1 h-(--radix-select-trigger-height)")),
157
+ className: r("p-1 overflow-x-hidden overflow-y-auto", L === "popper" && (E === "trigger" ? "scroll-my-1 h-(--radix-select-trigger-height) w-(--spectral-select-content-width) min-w-(--spectral-select-content-width)" : "scroll-my-1 h-(--radix-select-trigger-height)")),
157
158
  "data-testid": "spectral-select-items",
158
159
  children: Le()
159
160
  })
@@ -169,15 +170,15 @@ var _ = (_) => {
169
170
  ]
170
171
  }) })]
171
172
  }),
172
- Pe && O && /* @__PURE__ */ h(a, {
173
+ /* @__PURE__ */ h(i, {
173
174
  dataTestId: "spectral-select-error-message",
174
175
  id: K,
175
- message: O
176
+ message: Pe ? O ?? null : null
176
177
  }),
177
- z === "warning" && V && /* @__PURE__ */ h(s, {
178
+ /* @__PURE__ */ h(a, {
178
179
  dataTestId: "spectral-select-warning-message",
179
180
  id: q,
180
- message: V
181
+ message: z === "warning" ? V ?? null : null
181
182
  })
182
183
  ]
183
184
  });