@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
package/dist/.js CHANGED
@@ -86,41 +86,44 @@ import { t as Ae } from "./twUtils-BpqlKSeB.js";
86
86
  import { Alert as je } from "./Alert.js";
87
87
  import { Avatar as Me } from "./Avatar.js";
88
88
  import { Badge as Ne } from "./Badge.js";
89
- import { Button as Pe } from "./Button.js";
90
- import { Separator as Fe } from "./Separator.js";
91
- import { ButtonGroup as Ie, ButtonGroupItem as Le, ButtonGroupSeparator as Re } from "./ButtonGroup.js";
92
- import { ButtonIcon as ze } from "./ButtonIcon.js";
93
- import { useUncontrolledState as Be } from "./hooks/useUncontrolledState.js";
94
- import { Checkbox as Ve } from "./Checkbox.js";
95
- import { t as He } from "./Combobox-DCCcIDgq.js";
96
- import { Label as Ue } from "./Label.js";
97
- import { InputGroup as We, InputGroupAddon as Ge, InputGroupButton as Ke, InputGroupInput as qe, InputGroupText as Je, InputGroupTextarea as Ye } from "./primitives/input-group.js";
98
- import { ControlGroupSelect as Xe } from "./ControlGroup/ControlGroupSelect.js";
99
- import { DataCard as Ze } from "./DataCard.js";
100
- import { Popover as Qe, PopoverContent as $e, PopoverTrigger as et } from "./Popover.js";
101
- import { DateTimePicker as tt } from "./DateTimePicker.js";
102
- import { Dialog as nt } from "./Dialog.js";
103
- import { SpectralProvider as rt } from "./SpectralProvider.js";
104
- import { Drawer as it } from "./Drawer.js";
105
- import { n as at, r as ot, t as st } from "./HoverCard-BhxgELKP.js";
106
- import { Input as ct } from "./Input.js";
107
- import { InputNumeric as lt } from "./InputNumeric.js";
108
- import { t as ut } from "./InputOTP-DyhesOLs.js";
109
- import { Kbd as dt, KbdGroup as ft } from "./Kbd.js";
110
- import { MultiSelect as pt } from "./MultiSelect.js";
111
- import { RadioButtonGroup as mt, RadioButtonGroupItem as ht } from "./RadioButtonGroup.js";
112
- import { RadioButton as gt } from "./RadioButton.js";
113
- import { n as _t, t as vt } from "./RadioGroup-BsBK247l.js";
114
- import { Select as yt } from "./Select.js";
115
- import { Skeleton as bt } from "./Skeleton.js";
116
- import { t as xt } from "./Slider-CPYW_VYu.js";
117
- import { t as St } from "./Switch-Vep4hsq4.js";
118
- import { Tabs as Ct } from "./Tabs.js";
119
- import { Textarea as wt } from "./Textarea.js";
120
- import { n as Tt, t as Et } from "./Toast-BuaZxqlt.js";
121
- import { Toggle as Dt } from "./Toggle.js";
122
- import { ToggleGroup as Ot, ToggleGroupItem as kt } from "./ToggleGroup.js";
123
- import { i as At, n as jt, t as Mt } from "./Tooltip-vEdD4f2U.js";
124
- import { Tray as Nt } from "./Tray.js";
125
- import { useControllableState as Pt } from "./hooks/useControllableState.js";
126
- export { ke as Accordion, n as AdjustmentsIcon, je as Alert, r as AnalyzeIcon, i as AnnotationsIcon, a as ApprovedIcon, o as ArrowDownIcon, s as ArrowUpIcon, Me as Avatar, Ne as Badge, c as BoxToolIcon, Pe as Button, Ie as ButtonGroup, Le as ButtonGroupItem, Re as ButtonGroupSeparator, ze as ButtonIcon, l as CalendarIcon, u as CheckCircleIcon, d as CheckSquareIcon, Ve as Checkbox, f as CheckmarkIcon, p as ChevronDownIcon, m as ChevronUpIcon, h as ClockIcon, g as CloseCircleIcon, _ as CloseIcon, He as Combobox, Xe as ControlGroupSelect, v as Crosshairs2Icon, y as CrosshairsIcon, b as DashboardIcon, Ze as DataCard, x as DatabaseIcon, tt as DateTimePicker, S as DeleteIcon, nt as Dialog, it as Drawer, C as DurationIcon, w as EditIcon, T as EmailIcon, E as EraserIcon, D as ErrorIcon, O as EyeClosedIcon, k as EyeClosedIcon2, A as EyeOpenIcon, j as FileDownloadIcon, M as GoToFirstIcon, N as GoToLastIcon, P as HarmonicCursorsIcon, st as HoverCard, at as HoverCardContent, ot as HoverCardTrigger, e as IconBase, F as InfoIcon, ct as Input, We as InputGroup, Ge as InputGroupAddon, Ke as InputGroupButton, qe as InputGroupInput, Je as InputGroupText, Ye as InputGroupTextarea, lt as InputNumeric, ut as InputOTP, dt as Kbd, ft as KbdGroup, I as KeyboardIcon, Ue as Label, L as LabelIcon, R as LassoIcon, z as LineToolIcon, B as LiveViewIcon, V as LoaderIcon, H as LocationIcon, U as LogoutIcon, W as MaximizeIcon, G as MeasureIcon, K as MenuDotsIcon, q as MenuIcon, J as MessagesIcon, Y as MetadataIcon, X as MinimizeIcon, Z as MinusIcon, pt as MultiSelect, Q as OntologyIcon, $ as PanelIconClose, ee as PanelIconOpen, te as PauseIcon, ne as PlayIcon, re as PlusIcon, ie as PolygonIcon, Qe as Popover, $e as PopoverContent, et as PopoverTrigger, ae as PrinterIcon, oe as ProgressCheckIcon, gt as RadioButton, mt as RadioButtonGroup, ht as RadioButtonGroupItem, vt as RadioGroup, _t as RadioGroupItem, se as ResetIcon, ce as ReviewedIcon, le as ScissorsIcon, ue as SearchIcon, yt as Select, Fe as Separator, de as SettingsIcon, bt as Skeleton, xt as Slider, fe as SortAscendingIcon, pe as SortAtoZIcon, me as SortDescendingIcon, he as SortZtoAIcon, ge as SparklesIcon, rt as SpectralProvider, _e as StackIcon, ve as StarIcon, t as SvgIdContext, St as Switch, Ct as Tabs, wt as Textarea, Et as Toast, Dt as Toggle, Ot as ToggleGroup, kt as ToggleGroupItem, Mt as Tooltip, jt as TooltipContent, At as TooltipTrigger, ye as TrashIcon, Nt as Tray, be as UndoIcon, xe as UploadIcon, Se as User2Icon, Ce as UserIcon, we as WarningIcon, Te as ZoomAllIcon, Ee as ZoomXIcon, De as ZoomYIcon, Ae as cn, Tt as toast, Oe as useAccordionAutoScroll, Pt as useControllableState, Be as useUncontrolledState };
89
+ import { ErrorMessage as Pe, WarningMessage as Fe } from "./FormFieldMessage.js";
90
+ import { Button as Ie } from "./Button.js";
91
+ import { Separator as Le } from "./Separator.js";
92
+ import { ButtonGroup as Re, ButtonGroupItem as ze, ButtonGroupSeparator as Be } from "./ButtonGroup.js";
93
+ import { ButtonIcon as Ve } from "./ButtonIcon.js";
94
+ import { useUncontrolledState as He } from "./hooks/useUncontrolledState.js";
95
+ import { Checkbox as Ue } from "./Checkbox.js";
96
+ import { t as We } from "./Combobox-DRQqx0os.js";
97
+ import { Label as Ge } from "./Label.js";
98
+ import { InputGroup as Ke, InputGroupAddon as qe, InputGroupButton as Je, InputGroupInput as Ye, InputGroupText as Xe, InputGroupTextarea as Ze } from "./primitives/input-group.js";
99
+ import { ControlGroupSelect as Qe } from "./ControlGroup/ControlGroupSelect.js";
100
+ import { DataCard as $e } from "./DataCard.js";
101
+ import { Popover as et, PopoverContent as tt, PopoverTrigger as nt } from "./Popover.js";
102
+ import { DateTimePicker as rt } from "./DateTimePicker.js";
103
+ import { Dialog as it } from "./Dialog.js";
104
+ import { SpectralProvider as at } from "./SpectralProvider.js";
105
+ import { Drawer as ot } from "./Drawer.js";
106
+ import { n as st, r as ct, t as lt } from "./HoverCard-BhxgELKP.js";
107
+ import { Input as ut } from "./Input.js";
108
+ import { InputNumeric as dt } from "./InputNumeric.js";
109
+ import { t as ft } from "./InputOTP-DLn7ja7J.js";
110
+ import { Kbd as pt, KbdGroup as mt } from "./Kbd.js";
111
+ import { MultiSelect as ht } from "./MultiSelect.js";
112
+ import { RadioButtonGroup as gt, RadioButtonGroupItem as _t } from "./RadioButtonGroup.js";
113
+ import { RadioButton as vt } from "./RadioButton.js";
114
+ import { n as yt, t as bt } from "./RadioGroup-D-XjCU4Q.js";
115
+ import { Select as xt } from "./Select.js";
116
+ import { Skeleton as St } from "./Skeleton.js";
117
+ import { t as Ct } from "./Slider-CPYW_VYu.js";
118
+ import { t as wt } from "./Switch-CSmXtkia.js";
119
+ import { Tabs as Tt } from "./Tabs.js";
120
+ import { Textarea as Et } from "./Textarea.js";
121
+ import { n as Dt, t as Ot } from "./Toast-BuaZxqlt.js";
122
+ import { Toggle as kt } from "./Toggle.js";
123
+ import { ToggleGroupItem as At } from "./ToggleGroup/ToggleGroupItem.js";
124
+ import { ToggleGroupSplitMenuItem as jt } from "./ToggleGroup/ToggleGroupSplitMenuItem.js";
125
+ import { ToggleGroup as Mt } from "./ToggleGroup.js";
126
+ import { i as Nt, n as Pt, t as Ft } from "./Tooltip-CTjKOfvC.js";
127
+ import { Tray as It } from "./Tray.js";
128
+ import { useControllableState as Lt } from "./hooks/useControllableState.js";
129
+ export { ke as Accordion, n as AdjustmentsIcon, je as Alert, r as AnalyzeIcon, i as AnnotationsIcon, a as ApprovedIcon, o as ArrowDownIcon, s as ArrowUpIcon, Me as Avatar, Ne as Badge, c as BoxToolIcon, Ie as Button, Re as ButtonGroup, ze as ButtonGroupItem, Be as ButtonGroupSeparator, Ve as ButtonIcon, l as CalendarIcon, u as CheckCircleIcon, d as CheckSquareIcon, Ue as Checkbox, f as CheckmarkIcon, p as ChevronDownIcon, m as ChevronUpIcon, h as ClockIcon, g as CloseCircleIcon, _ as CloseIcon, We as Combobox, Qe as ControlGroupSelect, v as Crosshairs2Icon, y as CrosshairsIcon, b as DashboardIcon, $e as DataCard, x as DatabaseIcon, rt as DateTimePicker, S as DeleteIcon, it as Dialog, ot as Drawer, C as DurationIcon, w as EditIcon, T as EmailIcon, E as EraserIcon, D as ErrorIcon, Pe as ErrorMessage, O as EyeClosedIcon, k as EyeClosedIcon2, A as EyeOpenIcon, j as FileDownloadIcon, M as GoToFirstIcon, N as GoToLastIcon, P as HarmonicCursorsIcon, lt as HoverCard, st as HoverCardContent, ct as HoverCardTrigger, e as IconBase, F as InfoIcon, ut as Input, Ke as InputGroup, qe as InputGroupAddon, Je as InputGroupButton, Ye as InputGroupInput, Xe as InputGroupText, Ze as InputGroupTextarea, dt as InputNumeric, ft as InputOTP, pt as Kbd, mt as KbdGroup, I as KeyboardIcon, Ge as Label, L as LabelIcon, R as LassoIcon, z as LineToolIcon, B as LiveViewIcon, V as LoaderIcon, H as LocationIcon, U as LogoutIcon, W as MaximizeIcon, G as MeasureIcon, K as MenuDotsIcon, q as MenuIcon, J as MessagesIcon, Y as MetadataIcon, X as MinimizeIcon, Z as MinusIcon, ht as MultiSelect, Q as OntologyIcon, $ as PanelIconClose, ee as PanelIconOpen, te as PauseIcon, ne as PlayIcon, re as PlusIcon, ie as PolygonIcon, et as Popover, tt as PopoverContent, nt as PopoverTrigger, ae as PrinterIcon, oe as ProgressCheckIcon, vt as RadioButton, gt as RadioButtonGroup, _t as RadioButtonGroupItem, bt as RadioGroup, yt as RadioGroupItem, se as ResetIcon, ce as ReviewedIcon, le as ScissorsIcon, ue as SearchIcon, xt as Select, Le as Separator, de as SettingsIcon, St as Skeleton, Ct as Slider, fe as SortAscendingIcon, pe as SortAtoZIcon, me as SortDescendingIcon, he as SortZtoAIcon, ge as SparklesIcon, at as SpectralProvider, _e as StackIcon, ve as StarIcon, t as SvgIdContext, wt as Switch, Tt as Tabs, Et as Textarea, Ot as Toast, kt as Toggle, Mt as ToggleGroup, At as ToggleGroupItem, jt as ToggleGroupSplitMenuItem, Ft as Tooltip, Pt as TooltipContent, Nt as TooltipTrigger, ye as TrashIcon, It as Tray, be as UndoIcon, xe as UploadIcon, Se as User2Icon, Ce as UserIcon, we as WarningIcon, Fe as WarningMessage, Te as ZoomAllIcon, Ee as ZoomXIcon, De as ZoomYIcon, Ae as cn, Dt as toast, Oe as useAccordionAutoScroll, Lt as useControllableState, He as useUncontrolledState };
package/dist/Button.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface ButtonProps extends AsChildProp, Omit<ButtonHTMLAttributes<HTML
20
20
  variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'unstyled';
21
21
  }
22
22
  export declare const Button: {
23
- ({ asChild, children, className, dataTestId, disabled, endIcon, errorMessage, label, onClick, ref, size, startIcon, state, type, variant, ...props }: ButtonProps & {
23
+ ({ asChild, children, className, dataTestId, disabled, endIcon, errorMessage, id, label, onClick, ref, size, startIcon, state, type, variant, ...props }: ButtonProps & {
24
24
  ref?: Ref<HTMLButtonElement>;
25
25
  }): import("react/jsx-runtime").JSX.Element;
26
26
  displayName: string;
package/dist/Button.js CHANGED
@@ -4,11 +4,11 @@ import { LoaderIcon as e } from "./Icons/LoaderIcon.js";
4
4
  import { t } from "./twUtils-BpqlKSeB.js";
5
5
  import { t as n } from "./dist-tMzzRwxG.js";
6
6
  import { Slot as r } from "./primitives/slot.js";
7
- import { ErrorMessage as i } from "./utils/formFieldUtils.js";
8
- import { Children as a, isValidElement as o } from "react";
9
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { ErrorMessage as i } from "./FormFieldMessage.js";
8
+ import { Children as a, isValidElement as o, useId as s } from "react";
9
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
10
10
  //#region src/components/Button/Button.tsx
11
- var u = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-pointer items-center justify-center border font-sans! whitespace-nowrap transition-colors focus:outline-none focus-visible:outline-1 focus-visible:outline-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", {
11
+ var d = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-pointer items-center justify-center border font-sans! whitespace-nowrap transition-colors focus:outline-none focus-visible:outline-1 focus-visible:outline-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", {
12
12
  variants: {
13
13
  variant: {
14
14
  primary: "border-button-primary-border bg-button-primary-bg text-button-primary-text hover:border-button-primary-border--hover hover:bg-button-primary-bg--hover hover:text-button-primary-text--hover focus-visible:outline-button-primary-border disabled:border-button-primary-border--disabled disabled:bg-button-primary-bg--disabled disabled:text-button-primary-text--disabled",
@@ -33,8 +33,8 @@ var u = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-po
33
33
  state: "default",
34
34
  size: "default"
35
35
  }
36
- }), d = ({ asChild: n = !1, children: d, className: f, dataTestId: p, disabled: m, endIcon: h, errorMessage: g, label: _, onClick: v, ref: y, size: b, startIcon: x, state: S, type: C = "button", variant: w = "primary", ...T }) => {
37
- let E = {
36
+ }), f = ({ asChild: n = !1, children: f, className: p, dataTestId: m, disabled: h, endIcon: g, errorMessage: _, id: v, label: y, onClick: b, ref: x, size: S, startIcon: C, state: w, type: T = "button", variant: E = "primary", ...D }) => {
37
+ let O = {
38
38
  error: {
39
39
  primary: "bg-button-danger border-button-danger text-text-primary hover:bg-button-danger--hover hover:text-text-primary",
40
40
  secondary: "bg-button-danger border-button-danger text-text-primary hover:bg-button-danger--hover hover:text-text-primary",
@@ -49,57 +49,58 @@ var u = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-po
49
49
  ghost: "bg-transparent text-button-ghost-text--disabled pointer-events-none",
50
50
  unstyled: "bg-transparent opacity-50 pointer-events-none"
51
51
  }
52
- }, D = t(u({
53
- variant: w,
54
- state: S,
55
- size: b
56
- }), S === "error" && E.error[w], S === "loading" && E.loading[w], f), O = n && o(d) && a.count(d) === 1, k = O ? void 0 : d ?? _;
57
- if (!O && !k) throw Error("Button requires either `label` or `children`");
58
- let A = (e) => {
59
- m && (e.preventDefault(), e.stopPropagation());
60
- }, j = O ? r : "button";
61
- return /* @__PURE__ */ l("div", {
62
- className: t("flex flex-col justify-items-center", b),
63
- children: [/* @__PURE__ */ c(j, {
64
- "aria-disabled": m,
65
- className: t(D, O && "no-underline! before:content-none after:content-none", O && m && "pointer-events-none opacity-50"),
66
- "data-as-child": O ? "true" : void 0,
67
- "data-state": S,
68
- "data-testid": p ?? `spectral-button-${w}`,
69
- "data-variant": w,
70
- disabled: O ? void 0 : m,
71
- onClick: v,
72
- onClickCapture: O ? A : void 0,
73
- ref: y,
74
- tabIndex: O && m ? -1 : void 0,
75
- type: O ? void 0 : C,
76
- ...T,
77
- children: O ? d : /* @__PURE__ */ l(s, { children: [
78
- x && /* @__PURE__ */ c("span", {
79
- className: t("flex", w !== "unstyled" && "pr-1"),
52
+ }, k = t(d({
53
+ variant: E,
54
+ state: w,
55
+ size: S
56
+ }), w === "error" && O.error[E], w === "loading" && O.loading[E], p), A = s(), j = v ? `${v}-error` : `${A}-error`, M = n && o(f) && a.count(f) === 1, N = M ? void 0 : f ?? y, P = w === "error" && typeof _ == "string" ? _ : null, F = w === "error" && o(_) ? _ : null;
57
+ if (!M && !N) throw Error("Button requires either `label` or `children`");
58
+ let I = (e) => {
59
+ h && (e.preventDefault(), e.stopPropagation());
60
+ }, L = M ? r : "button";
61
+ return /* @__PURE__ */ u("div", {
62
+ className: t("flex flex-col justify-items-center", S),
63
+ children: [/* @__PURE__ */ l(L, {
64
+ "aria-disabled": h,
65
+ className: t(k, M && "no-underline! before:content-none after:content-none", M && h && "pointer-events-none opacity-50"),
66
+ "data-as-child": M ? "true" : void 0,
67
+ "data-state": w,
68
+ "data-testid": m ?? `spectral-button-${E}`,
69
+ "data-variant": E,
70
+ disabled: M ? void 0 : h,
71
+ id: v,
72
+ onClick: b,
73
+ onClickCapture: M ? I : void 0,
74
+ ref: x,
75
+ tabIndex: M && h ? -1 : void 0,
76
+ type: M ? void 0 : T,
77
+ ...D,
78
+ children: M ? f : /* @__PURE__ */ u(c, { children: [
79
+ C && /* @__PURE__ */ l("span", {
80
+ className: t("flex", E !== "unstyled" && "pr-1"),
80
81
  "aria-hidden": !0,
81
82
  "data-testid": "spectral-button-start-icon",
82
- children: x
83
+ children: C
83
84
  }),
84
- S === "loading" && /* @__PURE__ */ c(e, {
85
+ w === "loading" && /* @__PURE__ */ l(e, {
85
86
  className: "ml-2 motion-safe:animate-spin",
86
87
  size: 16
87
88
  }),
88
- k,
89
- h && S !== "loading" && /* @__PURE__ */ c("span", {
90
- className: t("flex", w !== "unstyled" && "pl-2"),
89
+ N,
90
+ g && w !== "loading" && /* @__PURE__ */ l("span", {
91
+ className: t("flex", E !== "unstyled" && "pl-2"),
91
92
  "aria-hidden": !0,
92
93
  "data-testid": "spectral-button-end-icon",
93
- children: h
94
+ children: g
94
95
  })
95
96
  ] })
96
- }), S === "error" && g && /* @__PURE__ */ c(i, {
97
- message: g,
97
+ }), F ?? /* @__PURE__ */ l(i, {
98
98
  dataTestId: "spectral-button-error-message",
99
- id: "button-error"
99
+ id: j,
100
+ message: P
100
101
  })]
101
102
  });
102
103
  };
103
- d.displayName = "Button";
104
+ f.displayName = "Button";
104
105
  //#endregion
105
- export { d as Button };
106
+ export { f as Button };
package/dist/Checkbox.js CHANGED
@@ -3,7 +3,8 @@ import './styles/main.css'
3
3
  import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
4
4
  import { MinusIcon as t } from "./Icons/MinusIcon.js";
5
5
  import { t as n } from "./twUtils-BpqlKSeB.js";
6
- import { ErrorMessage as r, WarningMessage as i, useFormFieldId as a } from "./utils/formFieldUtils.js";
6
+ import { ErrorMessage as r, WarningMessage as i } from "./FormFieldMessage.js";
7
+ import { useFormFieldId as a } from "./utils/formFieldUtils.js";
7
8
  import { CheckboxBase as o, CheckboxIndicator as s } from "./Checkbox/CheckboxBase.js";
8
9
  import "react";
9
10
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
@@ -46,15 +47,15 @@ var u = ({ checked: u, className: d, errorMessage: f, id: p, label: m, labelText
46
47
  children: T
47
48
  })]
48
49
  }),
49
- y === "error" && f && E && /* @__PURE__ */ c(r, {
50
+ /* @__PURE__ */ c(r, {
50
51
  dataTestId: "spectral-checkbox-error-message",
51
52
  id: E,
52
- message: f
53
+ message: y === "error" ? f : null
53
54
  }),
54
- y === "warning" && b && D && /* @__PURE__ */ c(i, {
55
+ /* @__PURE__ */ c(i, {
55
56
  dataTestId: "spectral-checkbox-warning-message",
56
57
  id: D,
57
- message: b
58
+ message: y === "warning" ? b : null
58
59
  })
59
60
  ] });
60
61
  };
@@ -5,7 +5,8 @@ import { CheckmarkIcon as n } from "./Icons/CheckmarkIcon.js";
5
5
  import { ChevronDownIcon as r } from "./Icons/ChevronDownIcon.js";
6
6
  import { LoaderIcon as i } from "./Icons/LoaderIcon.js";
7
7
  import { t as a } from "./twUtils-BpqlKSeB.js";
8
- import { EmptyState as o, ErrorMessage as s, LoadingState as c, WarningMessage as l, getAriaProps as u, getDropdownSurfaceClasses as d, getDropdownWidthStyles as f, getErrorMessageId as p, getFormFieldCSSProperties as m, getOptionClasses as h, getTriggerClasses as g, useFormFieldId as _ } from "./utils/formFieldUtils.js";
8
+ import { ErrorMessage as o, WarningMessage as s } from "./FormFieldMessage.js";
9
+ import { EmptyState as c, LoadingState as l, getAriaProps as u, getDropdownSurfaceClasses as d, getDropdownWidthStyles as f, getErrorMessageId as p, getFormFieldCSSProperties as m, getOptionClasses as h, getTriggerClasses as g, useFormFieldId as _ } from "./utils/formFieldUtils.js";
9
10
  import { useUncontrolledState as v } from "./hooks/useUncontrolledState.js";
10
11
  import { Label as y } from "./Label.js";
11
12
  import { InputGroup as b, InputGroupAddon as x } from "./primitives/input-group.js";
@@ -6286,7 +6287,7 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
6286
6287
  onClick: (e) => {
6287
6288
  if (fe || pe) return;
6288
6289
  let t = e.target;
6289
- t !== ve.current && (t.closest("[data-slot=combobox-trigger-button]") || V((e) => !e));
6290
+ t !== ve.current && (t.closest("[data-slot=combobox-trigger-button]") || (ve.current?.focus(), V(!0)));
6290
6291
  },
6291
6292
  style: m()
6292
6293
  }),
@@ -6335,12 +6336,12 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
6335
6336
  className: "isolate z-50",
6336
6337
  sideOffset: 4,
6337
6338
  children: /* @__PURE__ */ O(Dc, {
6338
- className: a("p-1 z-50 motion-safe:data-closed:animate-out motion-safe:data-open:animate-in", d(), "motion-safe:data-closed:fade-out-0 motion-safe:data-closed:zoom-out-95 motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95", "max-h-[min(var(--available-height),18rem)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto"),
6339
+ className: a("p-1 z-50 motion-safe:data-closed:animate-out motion-safe:data-open:animate-in", d(), "motion-safe:data-closed:fade-out-0 motion-safe:data-closed:zoom-out-95 motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95", "max-h-[min(var(--available-height),18rem)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--transform-origin) overflow-hidden"),
6339
6340
  "data-dropdown-width-mode": Te,
6340
6341
  "data-dropdown-width-value": Te === "custom" ? C : void 0,
6341
6342
  "data-testid": "spectral-combobox-content",
6342
6343
  style: Ee,
6343
- children: pe ? /* @__PURE__ */ O(c, { message: N }) : Ce.length === 0 ? /* @__PURE__ */ O(o, { message: w }) : /* @__PURE__ */ O(lc, {
6344
+ children: pe ? /* @__PURE__ */ O(l, { message: N }) : Ce.length === 0 ? /* @__PURE__ */ O(c, { message: w }) : /* @__PURE__ */ O(lc, {
6344
6345
  className: "max-h-[min(var(--available-height),18rem)] overflow-y-auto",
6345
6346
  id: le,
6346
6347
  children: Ce.map((e) => /* @__PURE__ */ k(Mc, {
@@ -6360,15 +6361,15 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
6360
6361
  })
6361
6362
  }) })]
6362
6363
  }),
6363
- B && D && /* @__PURE__ */ O(s, {
6364
+ /* @__PURE__ */ O(o, {
6364
6365
  dataTestId: "spectral-combobox-error-message",
6365
6366
  id: z,
6366
- message: D
6367
+ message: B ? D ?? null : null
6367
6368
  }),
6368
- R === "warning" && ae && /* @__PURE__ */ O(l, {
6369
+ /* @__PURE__ */ O(s, {
6369
6370
  dataTestId: "spectral-combobox-warning-message",
6370
6371
  id: ue,
6371
- message: ae
6372
+ message: R === "warning" ? ae ?? null : null
6372
6373
  })
6373
6374
  ]
6374
6375
  });
package/dist/Combobox.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- import { t as e } from "./Combobox-DCCcIDgq.js";
2
+ import { t as e } from "./Combobox-DRQqx0os.js";
3
3
  import "./primitives/input-group.js";
4
4
  export { e as Combobox };
@@ -28,6 +28,8 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
28
28
  dropdownWidth?: DropdownWidth;
29
29
  errorMessage?: string | string[] | Record<string, unknown> | null;
30
30
  id?: string;
31
+ /** Class applied to the input `ControlGroupItem` segment for width/split composition. */
32
+ inputItemClassName?: string;
31
33
  /** When `captionLayout` is `inline`, overrides the input's accessible name (defaults to `inputPlaceholder` when set). */
32
34
  inputAriaLabel?: string;
33
35
  inputPlaceholder?: string;
@@ -36,12 +38,14 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
36
38
  selectPlaceholder?: string;
37
39
  /** When `captionLayout` is `inline` and `selectPlaceholder` is empty, sets the select trigger's accessible name. */
38
40
  selectAriaLabel?: string;
41
+ /** Class applied to the select `ControlGroupItem` segment for width/split composition. */
42
+ selectItemClassName?: string;
39
43
  selectOptions: SelectOptionType[];
40
44
  state?: Exclude<FormFieldState, 'disabled'>;
41
45
  type?: 'number' | 'text';
42
46
  warningMessage?: string | string[] | Record<string, unknown> | null;
43
47
  };
44
48
  export type ControlGroupSelectProps = ControlGroupSelectBaseProps & ControlGroupSelectInputControlProps;
45
- export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, id, dropdownWidth, inputAriaLabel, inputPlaceholder, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectOptions, selectPlaceholder, state, type, warningMessage, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
49
+ export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, id, dropdownWidth, inputAriaLabel, inputPlaceholder, inputItemClassName, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectItemClassName, selectOptions, selectPlaceholder, state, type, warningMessage, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
46
50
  export {};
47
51
  //# sourceMappingURL=ControlGroupSelect.d.ts.map
@@ -4,119 +4,125 @@ import { t as e } from "../twUtils-BpqlKSeB.js";
4
4
  import { getStateClasses as t } from "../utils/formFieldUtils.js";
5
5
  import { Label as n } from "../Label.js";
6
6
  import { Input as r } from "../primitives/input.js";
7
- import { i, l as a, n as o, t as s, u as c } from "../select-oAOoVl5g.js";
7
+ import { i, l as a, n as o, t as s, u as c } from "../select-DFE8xm1L.js";
8
8
  import { ControlGroup as l, ControlGroupItem as u, useControlGroup as d } from "../ControlGroup.js";
9
9
  import { useId as f } from "react";
10
10
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
11
11
  //#region src/components/ControlGroup/ControlGroupSelect.tsx
12
- var g = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", _ = "Amount", v = "Select an option", y = "flex w-full min-w-0 flex-col gap-1.5", b = "!h-12 min-h-12 !border-2 border-input-border bg-input-bg text-base text-input-text transition duration-200 placeholder:text-input-text-placeholder hover:border-input-border--hover focus:border-input-border--focus focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled", x = (e, t = 0) => {
12
+ var g = "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", _ = "Amount", v = "Select an option", y = "flex w-full min-w-0 flex-col gap-1.5", b = "h-12! min-h-12! border-2! border-input-border bg-input-bg text-base text-input-text transition duration-200 placeholder:text-input-text-placeholder hover:border-input-border--hover focus-visible:border-input-border--focus focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled", x = (e, t = 0) => {
13
13
  let n = e?.trim();
14
14
  if (n) return `${Math.max(n.length + t, 8)}ch`;
15
15
  }, S = (e, t) => {
16
16
  let n = e?.trim();
17
17
  return n && n.length > 0 ? n : t;
18
- }, C = ({ amountStep: e, ariaLabel: t, captionLayout: n = "inline", className: r, dataTestId: i = "spectral-control-group-select", disabled: a, errorMessage: o, id: s, dropdownWidth: c = "trigger", inputAriaLabel: u, inputPlaceholder: d, inputValue: p, maxAmount: h = 1e6, minAmount: g = 0, onInputChange: y, orientation: b = "horizontal", selectAriaLabel: C, selectOptions: T, selectPlaceholder: E, state: D = "default", type: O = "number", warningMessage: k, ...A }) => {
19
- let j = f(), M = s ?? j, N = `${M}-amount`, P = `${M}-select`, F = `${N}-label`, I = `${P}-label`, L = n === "above", R = L ? void 0 : d, z = L ? void 0 : E, B = S(d, _), V = S(E, v), H = u ?? (L ? void 0 : B), U = C ?? (L ? void 0 : V), W = x(d, 3), G = x(E, 5), K = t ?? `${B} and ${V}`, q = !!a, J = p !== void 0 && y !== void 0;
18
+ }, C = ({ amountStep: e, ariaLabel: t, captionLayout: n = "inline", className: r, dataTestId: i = "spectral-control-group-select", disabled: a, errorMessage: o, id: s, dropdownWidth: c = "trigger", inputAriaLabel: u, inputPlaceholder: d, inputItemClassName: p, inputValue: h, maxAmount: g = 1e6, minAmount: y = 0, onInputChange: b, orientation: C = "horizontal", selectAriaLabel: T, selectItemClassName: E, selectOptions: D, selectPlaceholder: O, state: k = "default", type: A = "number", warningMessage: j, ...M }) => {
19
+ let N = f(), P = s ?? N, F = `${P}-amount`, I = `${P}-select`, L = `${F}-label`, R = `${I}-label`, z = n === "above", B = z ? void 0 : d, V = z ? void 0 : O, H = S(d, _), U = S(O, v), W = u ?? (z ? void 0 : H), G = T ?? (z ? void 0 : U), K = x(d, 3), q = x(O, 5), J = t ?? `${H} and ${U}`, Y = !!a, X = h !== void 0 && b !== void 0;
20
20
  return /* @__PURE__ */ m(l, {
21
- "aria-label": K,
21
+ "aria-label": J,
22
22
  className: r,
23
23
  "data-testid": i,
24
24
  disabled: a,
25
25
  errorMessage: o,
26
- id: M,
27
- orientation: b,
28
- state: D,
29
- warningMessage: k,
26
+ id: P,
27
+ orientation: C,
28
+ state: k,
29
+ warningMessage: j,
30
30
  children: /* @__PURE__ */ m(w, {
31
31
  amountStep: e,
32
32
  dataTestId: i,
33
- inputAccessibleName: H,
34
- inputCaption: R,
35
- inputId: N,
36
- inputLabelId: F,
37
- inputLabelText: B,
38
- inputMinWidth: W,
39
- inputValue: J ? p : void 0,
40
- isDisabled: q,
41
- maxAmount: h,
42
- minAmount: g,
43
- onInputChange: J ? y : void 0,
33
+ inputAccessibleName: W,
34
+ inputCaption: B,
35
+ inputId: F,
36
+ inputLabelId: L,
37
+ inputLabelText: H,
38
+ inputItemClassName: p,
39
+ inputMinWidth: K,
40
+ inputValue: X ? h : void 0,
41
+ isDisabled: Y,
42
+ maxAmount: g,
43
+ minAmount: y,
44
+ onInputChange: X ? b : void 0,
44
45
  dropdownWidth: c,
45
- selectCaption: z,
46
- selectOptions: T,
47
- selectLabelId: I,
48
- selectLabelText: V,
49
- selectProps: A,
50
- selectTriggerAriaLabel: U,
51
- selectTriggerId: P,
52
- selectTriggerMinWidth: G,
53
- type: O,
54
- useAboveLabels: L
46
+ selectCaption: V,
47
+ selectOptions: D,
48
+ selectLabelId: R,
49
+ selectLabelText: U,
50
+ selectItemClassName: E,
51
+ selectProps: M,
52
+ selectTriggerAriaLabel: G,
53
+ selectTriggerId: I,
54
+ selectTriggerMinWidth: q,
55
+ type: A,
56
+ useAboveLabels: z
55
57
  })
56
58
  });
57
- }, w = ({ amountStep: l, dataTestId: f, dropdownWidth: _, inputAccessibleName: v, inputCaption: x, inputId: S, inputLabelId: C, inputLabelText: w, inputMinWidth: T, inputValue: E, isDisabled: D, maxAmount: O, minAmount: k, onInputChange: A, selectCaption: j, selectLabelId: M, selectLabelText: N, selectOptions: P, selectProps: F, selectTriggerAriaLabel: I, selectTriggerId: L, selectTriggerMinWidth: R, type: z, useAboveLabels: B }) => {
58
- let { messageId: V, orientation: H, state: U } = d(), W = H === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", G = H === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", K = H === "horizontal" ? "me-0" : "mbe-0", q = H === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", J = /* @__PURE__ */ m(r, {
59
- "aria-describedby": V,
59
+ }, w = ({ amountStep: l, dataTestId: f, dropdownWidth: _, inputAccessibleName: v, inputCaption: x, inputId: S, inputLabelId: C, inputLabelText: w, inputItemClassName: T, inputMinWidth: E, inputValue: D, isDisabled: O, maxAmount: k, minAmount: A, onInputChange: j, selectCaption: M, selectLabelId: N, selectLabelText: P, selectItemClassName: F, selectOptions: I, selectProps: L, selectTriggerAriaLabel: R, selectTriggerId: z, selectTriggerMinWidth: B, type: V, useAboveLabels: H }) => {
60
+ let { messageId: U, orientation: W, state: G } = d(), K = L.open !== void 0, q = (e) => {
61
+ L.onOpenChange?.(e);
62
+ }, J = W === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", Y = W === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", X = W === "horizontal" ? "me-0" : "mbe-0", Z = W === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", Q = /* @__PURE__ */ m(r, {
63
+ "aria-describedby": U,
60
64
  "aria-label": v,
61
- "aria-labelledby": B ? C : void 0,
62
- className: e(b, W, t(U), z === "number" && g, z === "number" && "tabular-nums"),
65
+ "aria-labelledby": H ? C : void 0,
66
+ className: e(b, J, t(G), V === "number" && g, V === "number" && "tabular-nums"),
63
67
  "data-testid": `${f}-input`,
64
- disabled: D,
65
- id: B ? S : void 0,
66
- type: z === "number" ? "number" : "text",
68
+ disabled: O,
69
+ id: H ? S : void 0,
70
+ type: V === "number" ? "number" : "text",
67
71
  placeholder: x,
68
- style: T ? { minWidth: T } : void 0,
69
- min: k ?? 0,
70
- max: O ?? 1e6,
71
- ...E !== void 0 && A !== void 0 ? {
72
- value: E,
73
- onChange: A
72
+ style: E ? { minWidth: E } : void 0,
73
+ min: A ?? 0,
74
+ max: k ?? 1e6,
75
+ ...D !== void 0 && j !== void 0 ? {
76
+ value: D,
77
+ onChange: j
74
78
  } : {},
75
79
  step: l ?? 1
76
- }), Y = /* @__PURE__ */ m(a, {
77
- "aria-describedby": V,
78
- "aria-label": I,
79
- "aria-labelledby": B ? M : void 0,
80
- className: e(b, G, "px-4 w-full justify-between focus-visible:ring-0", t(U)),
80
+ }), $ = /* @__PURE__ */ m(a, {
81
+ "aria-describedby": U,
82
+ "aria-label": R,
83
+ "aria-labelledby": H ? N : void 0,
84
+ className: e("text-input-text data-placeholder:text-input-text-placeholder!", Y, "px-4 w-full justify-between focus-visible:border-input-border--focus focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus", t(G)),
81
85
  "data-testid": `${f}-select-trigger`,
82
- disabled: D,
83
- id: B ? L : void 0,
84
- style: R ? { minWidth: R } : void 0,
86
+ disabled: O,
87
+ id: H ? z : void 0,
88
+ style: B ? { minWidth: B } : void 0,
85
89
  children: /* @__PURE__ */ m(c, {
86
90
  className: "min-w-0 block max-w-full truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder!",
87
- placeholder: j
91
+ placeholder: M
88
92
  })
89
93
  });
90
94
  return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(u, {
91
- className: B ? K : void 0,
92
- children: B ? /* @__PURE__ */ h("div", {
95
+ className: e(H ? X : void 0, T),
96
+ children: H ? /* @__PURE__ */ h("div", {
93
97
  className: y,
94
98
  children: [/* @__PURE__ */ m(n, {
95
99
  className: "text-text-primary",
96
100
  htmlFor: S,
97
101
  id: C,
98
102
  children: w
99
- }), J]
100
- }) : J
103
+ }), Q]
104
+ }) : Q
101
105
  }), /* @__PURE__ */ h(s, {
106
+ ...L,
102
107
  "data-testid": `${f}-select-root`,
103
- disabled: D,
104
- ...F,
108
+ disabled: O,
109
+ ...K ? { open: L.open } : {},
110
+ onOpenChange: q,
105
111
  children: [/* @__PURE__ */ m(u, {
106
- className: B ? q : void 0,
107
- children: B ? /* @__PURE__ */ h("div", {
112
+ className: e(H ? Z : void 0, F),
113
+ children: H ? /* @__PURE__ */ h("div", {
108
114
  className: y,
109
115
  children: [/* @__PURE__ */ m(n, {
110
116
  className: "text-text-primary",
111
- htmlFor: L,
112
- id: M,
113
- children: N
114
- }), Y]
115
- }) : Y
117
+ htmlFor: z,
118
+ id: N,
119
+ children: P
120
+ }), $]
121
+ }) : $
116
122
  }), /* @__PURE__ */ m(o, {
117
123
  "data-testid": `${f}-select-content`,
118
124
  dropdownWidth: _,
119
- children: P.map((e) => /* @__PURE__ */ m(i, {
125
+ children: I.map((e) => /* @__PURE__ */ m(i, {
120
126
  disabled: e.disabled,
121
127
  value: e.value,
122
128
  children: e.label