@spear-ai/spectral 1.11.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +4 -0
  2. package/dist/.js +124 -121
  3. package/dist/{Accordion-CDXdSAST.js → Accordion-Cyrb2byI.js} +1 -1
  4. package/dist/Accordion.js +1 -1
  5. package/dist/Alert/AlertBase.js +1 -1
  6. package/dist/Alert.js +3 -3
  7. package/dist/{AnimatePresence-D-9jXfgI.js → AnimatePresence-D9FLxIGV.js} +1 -1
  8. package/dist/Avatar.js +46 -48
  9. package/dist/Badge.js +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/ButtonGroup/ButtonGroupButton.js +1 -1
  12. package/dist/ButtonGroup.js +1 -1
  13. package/dist/ButtonIcon.js +1 -1
  14. package/dist/{Calendar-s4lyijkn.js → Calendar-Cnh_PTbQ.js} +4 -4
  15. package/dist/Checkbox/CheckboxBase.js +1 -1
  16. package/dist/Checkbox.d.ts +10 -3
  17. package/dist/Checkbox.js +55 -35
  18. package/dist/Combobox/ComboboxBase.js +1 -1
  19. package/dist/Combobox.d.ts +5 -3
  20. package/dist/Combobox.js +91 -92
  21. package/dist/{ComboboxBase-qX-mQhT6.js → ComboboxBase-BzDGK36x.js} +1 -1
  22. package/dist/ControlGroup/ControlGroupSelect.d.ts +5 -2
  23. package/dist/ControlGroup/ControlGroupSelect.js +33 -30
  24. package/dist/ControlGroup.d.ts +3 -2
  25. package/dist/ControlGroup.js +41 -33
  26. package/dist/DataCard/Card.js +1 -1
  27. package/dist/DataCard.js +1 -1
  28. package/dist/DateTimePicker/Calendar.js +1 -1
  29. package/dist/DateTimePicker/DateTimeDisplayInput.js +84 -83
  30. package/dist/DateTimePicker/DateTimeInput.js +2 -2
  31. package/dist/DateTimePicker/DateTimeUtils.js +1 -1
  32. package/dist/DateTimePicker/TimePeriodSelect.js +32 -35
  33. package/dist/DateTimePicker/TimePicker.js +2 -2
  34. package/dist/DateTimePicker.d.ts +1 -1
  35. package/dist/DateTimePicker.js +55 -52
  36. package/dist/{DateTimeUtils-DVvG6H-p.js → DateTimeUtils-BJUAMuot.js} +1 -1
  37. package/dist/Dialog.js +1 -1
  38. package/dist/DropdownMenu.d.ts +61 -0
  39. package/dist/DropdownMenu.js +869 -0
  40. package/dist/{HoverCard-CYDsIiVK.js → HoverCard-DERasp0v.js} +1 -1
  41. package/dist/HoverCard.js +1 -1
  42. package/dist/Icons/AdjustmentsIcon.d.ts +5 -0
  43. package/dist/Icons/AdjustmentsIcon.js +78 -0
  44. package/dist/Icons/MenuDotsIcon.d.ts +5 -0
  45. package/dist/Icons/MenuDotsIcon.js +36 -0
  46. package/dist/Icons/MenuIcon.d.ts +5 -0
  47. package/dist/Icons/MenuIcon.js +36 -0
  48. package/dist/Icons/index.d.ts +3 -0
  49. package/dist/Icons.js +81 -78
  50. package/dist/IconsAnimated/PanelLeftCloseIcon.js +3 -3
  51. package/dist/IconsAnimated/PanelLeftOpenIcon.js +3 -3
  52. package/dist/Input.js +1 -1
  53. package/dist/InputNumeric.js +1 -1
  54. package/dist/{InputOTP-cVn5Bzyp.js → InputOTP-BkSw_KIB.js} +12 -10
  55. package/dist/InputOTP.js +1 -1
  56. package/dist/Kbd.js +1 -1
  57. package/dist/Label.js +1 -1
  58. package/dist/MultiSelect/MultiSelectBase.d.ts +6 -4
  59. package/dist/MultiSelect/MultiSelectBase.js +235 -209
  60. package/dist/MultiSelect.d.ts +2 -1
  61. package/dist/MultiSelect.js +14 -12
  62. package/dist/Popover.js +1 -1
  63. package/dist/RadioButton.js +1 -1
  64. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
  65. package/dist/RadioButtonGroup.js +1 -1
  66. package/dist/RadioGroup-DqKggFnI.js +328 -0
  67. package/dist/RadioGroup.d.ts +7 -0
  68. package/dist/RadioGroup.js +1 -1
  69. package/dist/Select.d.ts +5 -2
  70. package/dist/Select.js +100 -85
  71. package/dist/Separator.js +1 -1
  72. package/dist/Skeleton.js +1 -1
  73. package/dist/{Slider-BzzZT3Zm.js → Slider-CfUFkWU4.js} +1 -1
  74. package/dist/Slider.js +1 -1
  75. package/dist/Switch-Wj_zov--.js +144 -0
  76. package/dist/Switch.d.ts +12 -3
  77. package/dist/Switch.js +1 -1
  78. package/dist/Tabs/TabsBase.js +4 -4
  79. package/dist/Tabs.js +1 -1
  80. package/dist/Textarea.d.ts +3 -2
  81. package/dist/Textarea.js +50 -45
  82. package/dist/{Toast-9zqXxKKO.js → Toast-CJvzLlMD.js} +1 -1
  83. package/dist/Toast.js +1 -1
  84. package/dist/Toggle.js +1 -1
  85. package/dist/ToggleGroup.js +1 -1
  86. package/dist/{Tooltip-D1K8kY1y.js → Tooltip-BR0tdif4.js} +2 -2
  87. package/dist/Tooltip.js +1 -1
  88. package/dist/Tray.js +4 -4
  89. package/dist/{chunk-h9knIhTc.js → chunk-C4rFPcKS.js} +1 -1
  90. package/dist/dist-DcUGLq_y.js +149 -0
  91. package/dist/main.js +1 -1
  92. package/dist/primitives/button.js +1 -1
  93. package/dist/primitives/input-group.js +1 -1
  94. package/dist/primitives/input.js +1 -1
  95. package/dist/primitives/popover.js +1 -1
  96. package/dist/primitives/select.d.ts.map +1 -1
  97. package/dist/primitives/select.js +56 -53
  98. package/dist/primitives/textarea.js +1 -1
  99. package/dist/{proxy-Dn10Pl_g.js → proxy-CCB7C4Pu.js} +10 -10
  100. package/dist/styles/spectral.css +1 -1
  101. package/dist/{twUtils-VNWgstKL.js → twUtils-D_qzdiwM.js} +1 -1
  102. package/dist/{use-animation-CBUDycyW.js → use-animation-C-qL83hj.js} +1 -1
  103. package/dist/utils/dropdownPositioning.d.ts +13 -0
  104. package/dist/utils/dropdownPositioning.d.ts.map +1 -0
  105. package/dist/utils/dropdownPositioning.js +43 -0
  106. package/dist/utils/dropdownPositioning.test.d.ts +2 -0
  107. package/dist/utils/dropdownPositioning.test.d.ts.map +1 -0
  108. package/dist/utils/dropdownPositioning.test.js +21 -0
  109. package/dist/utils/formFieldUtils.d.ts +15 -1
  110. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  111. package/dist/utils/formFieldUtils.js +35 -19
  112. package/dist/utils/twUtils.js +1 -1
  113. package/package.json +26 -22
  114. package/dist/RadioGroup-w_q6RGEK.js +0 -447
  115. package/dist/Switch-CVzRJ-0n.js +0 -126
  116. /package/dist/{dist-B4FgboI8.js → dist-Cujfuel1.js} +0 -0
package/dist/Separator.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./styles/main.css";
2
- import { t as e } from "./twUtils-VNWgstKL.js";
2
+ import { t as e } from "./twUtils-D_qzdiwM.js";
3
3
  import "react";
4
4
  import { jsx as t } from "react/jsx-runtime";
5
5
  //#region src/components/Separator/Separator.tsx
package/dist/Skeleton.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./styles/main.css";
2
- import { t as e } from "./twUtils-VNWgstKL.js";
2
+ import { t as e } from "./twUtils-D_qzdiwM.js";
3
3
  import "react";
4
4
  import { jsx as t } from "react/jsx-runtime";
5
5
  //#region src/components/Skeleton/Skeleton.tsx
@@ -1,7 +1,7 @@
1
1
  import "./styles/main.css";
2
2
  import { a as e, d as t, l as n, r, t as i } from "./dist-7HRQ5IKN.js";
3
3
  import { n as a, t as o } from "./dist-CGzgmYB9.js";
4
- import { t as s } from "./twUtils-VNWgstKL.js";
4
+ import { t as s } from "./twUtils-D_qzdiwM.js";
5
5
  import { Input as c } from "./primitives/input.js";
6
6
  import { t as l } from "./dist-D8Wb_MX9.js";
7
7
  import { t as u } from "./dist-BK1K0g9W.js";
package/dist/Slider.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./Slider-BzzZT3Zm.js";
1
+ import { t as e } from "./Slider-CfUFkWU4.js";
2
2
  export { e as Slider };
@@ -0,0 +1,144 @@
1
+ import "./styles/main.css";
2
+ import { t as e } from "./twUtils-D_qzdiwM.js";
3
+ import { ErrorMessage as t, WarningMessage as n, useFormFieldId as r } from "./utils/formFieldUtils.js";
4
+ import { Label as i } from "./Label.js";
5
+ import { Switch as a, SwitchThumb as o } from "./Switch/SwitchBase.js";
6
+ import { createElement as s, forwardRef as c } from "react";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ //#region node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/shared/src/utils.js
9
+ var d = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), f = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), p = (e) => {
10
+ let t = f(e);
11
+ return t.charAt(0).toUpperCase() + t.slice(1);
12
+ }, m = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), h = (e) => {
13
+ for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
14
+ }, g = {
15
+ xmlns: "http://www.w3.org/2000/svg",
16
+ width: 24,
17
+ height: 24,
18
+ viewBox: "0 0 24 24",
19
+ fill: "none",
20
+ stroke: "currentColor",
21
+ strokeWidth: 2,
22
+ strokeLinecap: "round",
23
+ strokeLinejoin: "round"
24
+ }, _ = c(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...c }, l) => s("svg", {
25
+ ref: l,
26
+ ...g,
27
+ width: t,
28
+ height: t,
29
+ stroke: e,
30
+ strokeWidth: r ? Number(n) * 24 / Number(t) : n,
31
+ className: m("lucide", i),
32
+ ...!a && !h(c) && { "aria-hidden": "true" },
33
+ ...c
34
+ }, [...o.map(([e, t]) => s(e, t)), ...Array.isArray(a) ? a : [a]])), v = (e, t) => {
35
+ let n = c(({ className: n, ...r }, i) => s(_, {
36
+ ref: i,
37
+ iconNode: t,
38
+ className: m(`lucide-${d(p(e))}`, `lucide-${e}`, n),
39
+ ...r
40
+ }));
41
+ return n.displayName = p(e), n;
42
+ }, y = v("check", [["path", {
43
+ d: "M20 6 9 17l-5-5",
44
+ key: "1gmf2c"
45
+ }]]), b = v("x", [["path", {
46
+ d: "M18 6 6 18",
47
+ key: "1bl5f8"
48
+ }], ["path", {
49
+ d: "m6 6 12 12",
50
+ key: "d8bk6v"
51
+ }]]), x = "bg-switch-thumb--checked data-[state=checked]:bg-switch-thumb pointer-events-none block rounded-full ring-0 transition-transform motion-reduce:transition-none", S = ({ className: s, disabled: c, errorMessage: d, hideLabel: f = !1, id: p, label: m, labelPosition: h = "right", labelText: g, name: _, onChange: v, ref: S, required: C, state: w = "default", value: T, variant: E, warningMessage: D, "aria-describedby": O, "aria-label": k, ...A }) => {
52
+ let j = r(p, _), M = w === "disabled" ? "default" : w, N = !!c, P = g ?? m, F = `${j}-error`, I = `${j}-warning`, L = M === "error" && d && F ? F : M === "warning" && D && I ? I : void 0, R = E === "squared";
53
+ return /* @__PURE__ */ u("div", {
54
+ className: "flex items-center",
55
+ "data-testid": "spectral-switch-container",
56
+ "data-state": N ? "disabled" : M,
57
+ children: [
58
+ h === "left" && !f && P && /* @__PURE__ */ l(i, {
59
+ className: "mr-2",
60
+ "data-testid": "spectral-switch-label-left",
61
+ htmlFor: j,
62
+ children: P
63
+ }),
64
+ E === "permanent-indicator" ? /* @__PURE__ */ u("div", {
65
+ className: "h-7 text-sm font-medium relative inline-grid grid-cols-[1fr_1fr] items-center",
66
+ children: [
67
+ /* @__PURE__ */ l(a, {
68
+ "aria-required": C,
69
+ "aria-describedby": [L, O].filter(Boolean).join(" ") || void 0,
70
+ "aria-invalid": M === "error" ? !0 : void 0,
71
+ "aria-label": k ?? (f ? P : void 0),
72
+ className: e("peer inset-0 w-14 focus-visible:ring-ring absolute inline-flex h-[inherit] items-center focus-visible:ring-offset-background data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg/50", "shadow-2xs cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", "disabled:cursor-not-allowed disabled:opacity-50", s),
73
+ "data-testid": "spectral-switch",
74
+ disabled: N,
75
+ id: j,
76
+ name: _,
77
+ onCheckedChange: v,
78
+ ref: S,
79
+ required: C,
80
+ value: T,
81
+ ...A,
82
+ children: /* @__PURE__ */ l(o, { className: e(x, "size-6.5 shadow-xs relative z-10 duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] data-[state=checked]:translate-x-[26px] motion-reduce:duration-0 data-[state=checked]:rtl:translate-x-[-26px]") })
83
+ }),
84
+ /* @__PURE__ */ l("span", {
85
+ className: "ml-0.5 min-w-8 peer-data-[state=unchecked]:translate-x-6 peer-data-[state=unchecked]:rtl:-translate-x-6 motion-reduce:translate-x-0 pointer-events-none relative flex items-center justify-center text-center transition-transform duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:invisible motion-reduce:transition-none motion-reduce:duration-0",
86
+ children: /* @__PURE__ */ l(b, {
87
+ "aria-hidden": "true",
88
+ className: "size-4"
89
+ })
90
+ }),
91
+ /* @__PURE__ */ l("span", {
92
+ className: "min-w-8 motion-reduce:translate-x-0 pointer-events-none relative flex items-center justify-center text-center transition-transform duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:-translate-x-full peer-data-[state=checked]:text-background peer-data-[state=unchecked]:invisible motion-reduce:transition-none motion-reduce:duration-0 peer-data-[state=checked]:rtl:translate-x-full",
93
+ children: /* @__PURE__ */ l(y, {
94
+ "aria-hidden": "true",
95
+ className: "size-4"
96
+ })
97
+ })
98
+ ]
99
+ }) : /* @__PURE__ */ l(a, {
100
+ "aria-required": C,
101
+ "aria-describedby": [L, O].filter(Boolean).join(" ") || void 0,
102
+ "aria-invalid": M === "error" ? !0 : void 0,
103
+ "aria-label": k ?? (f ? P : void 0),
104
+ className: e(R ? "peer h-6 w-10 rounded-sm focus-visible:ring-black inline-flex shrink-0 items-center border-2 border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg [&_span]:rounded-[4px]" : "focus-visible:ring-ring peer h-6 w-10 shadow-2xs inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg", s),
105
+ "data-testid": "spectral-switch",
106
+ disabled: N,
107
+ id: j,
108
+ name: _,
109
+ onCheckedChange: v,
110
+ ref: S,
111
+ required: C,
112
+ value: T,
113
+ ...A,
114
+ children: /* @__PURE__ */ l(o, { className: e(x, R ? "size-5 shadow-xs data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4" : "h-5 w-5 shadow-lg data-[state=checked]:translate-x-4") })
115
+ }),
116
+ h === "right" && !f && P && /* @__PURE__ */ l(i, {
117
+ className: "ml-2",
118
+ "data-testid": "spectral-switch-label-right",
119
+ htmlFor: j,
120
+ id: `${j}-label`,
121
+ children: P
122
+ }),
123
+ f && P && /* @__PURE__ */ l(i, {
124
+ className: "sr-only",
125
+ "data-testid": "spectral-switch-label-hidden",
126
+ htmlFor: j,
127
+ children: P
128
+ }),
129
+ M === "error" && d && F && /* @__PURE__ */ l(t, {
130
+ dataTestId: "spectral-switch-error-message",
131
+ id: F,
132
+ message: d
133
+ }),
134
+ M === "warning" && D && I && /* @__PURE__ */ l(n, {
135
+ dataTestId: "spectral-switch-warning-message",
136
+ id: I,
137
+ message: D
138
+ })
139
+ ]
140
+ });
141
+ };
142
+ S.displayName = "Switch";
143
+ //#endregion
144
+ export { S as t };
package/dist/Switch.d.ts CHANGED
@@ -1,18 +1,27 @@
1
+ import { BaseFormFieldProps, FormFieldState } from './utils/formFieldUtils';
1
2
  import { Ref } from 'react';
2
3
  import { SwitchProps as SwitchBaseProps } from './SwitchBase';
4
+ type SwitchVisualState = Exclude<FormFieldState, 'disabled'>;
3
5
  export type SwitchProps = Omit<SwitchBaseProps, 'onCheckedChange'> & {
6
+ 'aria-describedby'?: string;
7
+ 'aria-label'?: string;
8
+ errorMessage?: BaseFormFieldProps['errorMessage'];
4
9
  hideLabel?: boolean;
5
- id: string;
10
+ id?: string;
11
+ label?: string;
6
12
  labelPosition?: 'left' | 'right';
7
- labelText: string;
13
+ labelText?: string;
8
14
  onChange?: (checked: boolean) => void;
9
15
  ref?: Ref<HTMLButtonElement>;
10
16
  required?: boolean;
17
+ state?: SwitchVisualState;
11
18
  value?: string;
12
19
  variant?: 'default' | 'squared' | 'permanent-indicator';
20
+ warningMessage?: BaseFormFieldProps['errorMessage'];
13
21
  };
14
22
  export declare const Switch: {
15
- ({ className, disabled, hideLabel, id, labelPosition, labelText, name, onChange, ref, required, value, variant, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
23
+ ({ className, disabled, errorMessage, hideLabel, id, label, labelPosition, labelText, name, onChange, ref, required, state, value, variant, warningMessage, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
16
24
  displayName: string;
17
25
  };
26
+ export {};
18
27
  //# sourceMappingURL=Switch.d.ts.map
package/dist/Switch.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./Switch-CVzRJ-0n.js";
1
+ import { t as e } from "./Switch-Wj_zov--.js";
2
2
  export { e as Switch };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { t as e } from "../twUtils-VNWgstKL.js";
4
- import { t } from "../proxy-Dn10Pl_g.js";
5
- import { t as n } from "../AnimatePresence-D-9jXfgI.js";
6
- import { t as r } from "../dist-B4FgboI8.js";
3
+ import { t as e } from "../twUtils-D_qzdiwM.js";
4
+ import { t } from "../proxy-CCB7C4Pu.js";
5
+ import { t as n } from "../AnimatePresence-D9FLxIGV.js";
6
+ import { t as r } from "../dist-Cujfuel1.js";
7
7
  import { calculateIndicatorStyle as i, debounce as a, generateId as o, prefersReducedMotion as s } from "./tabsUtils.js";
8
8
  import { createContext as c, useCallback as l, useContext as u, useEffect as d, useId as f, useMemo as p, useRef as m, useState as h } from "react";
9
9
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
package/dist/Tabs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./styles/main.css";
2
- import { t as e } from "./twUtils-VNWgstKL.js";
2
+ import { t as e } from "./twUtils-D_qzdiwM.js";
3
3
  import { getTabKeys as t, validateTabValues as n } from "./Tabs/tabsUtils.js";
4
4
  import { TabsBase as r, TabsContent as i, TabsContentContainer as a, TabsList as o, TabsTrigger as s } from "./Tabs/TabsBase.js";
5
5
  import "react";
@@ -1,9 +1,9 @@
1
- import { FormFieldState } from './utils/formFieldUtils';
1
+ import { BaseFormFieldProps, FormFieldState } from './utils/formFieldUtils';
2
2
  import { ComponentProps, FocusEvent, Ref } from 'react';
3
3
  export type TextareaState = FormFieldState;
4
4
  export type TextareaProps = Omit<ComponentProps<'textarea'>, 'onChange'> & {
5
5
  className?: string | undefined;
6
- errorMessage?: string | undefined;
6
+ errorMessage?: BaseFormFieldProps['errorMessage'];
7
7
  id?: string | undefined;
8
8
  label: string;
9
9
  labelClassName?: string;
@@ -16,6 +16,7 @@ export type TextareaProps = Omit<ComponentProps<'textarea'>, 'onChange'> & {
16
16
  required?: boolean;
17
17
  state?: TextareaState;
18
18
  value?: string | undefined;
19
+ warningMessage?: BaseFormFieldProps['errorMessage'];
19
20
  };
20
21
  export declare const Textarea: {
21
22
  (allProps: TextareaProps & {
package/dist/Textarea.js CHANGED
@@ -1,87 +1,92 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
3
  import { LoaderIcon as e } from "./Icons/LoaderIcon.js";
4
- import { t } from "./twUtils-VNWgstKL.js";
5
- import { ErrorMessage as n, getAriaProps as r, getErrorMessageId as i, getTextareaClasses as a, useFormFieldId as o, useFormFieldState as s } from "./utils/formFieldUtils.js";
6
- import { useUncontrolledState as c } from "./hooks/useUncontrolledState.js";
7
- import { Label as l } from "./Label.js";
8
- import { useTextarea as u } from "./Textarea/TextareaUtils.js";
9
- import { useRef as d } from "react";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
4
+ import { t } from "./twUtils-D_qzdiwM.js";
5
+ import { ErrorMessage as n, WarningMessage as r, getAriaProps as i, getErrorMessageId as a, getTextareaClasses as o, useFormFieldId as s, useFormFieldState as c } from "./utils/formFieldUtils.js";
6
+ import { useUncontrolledState as l } from "./hooks/useUncontrolledState.js";
7
+ import { Label as u } from "./Label.js";
8
+ import { useTextarea as d } from "./Textarea/TextareaUtils.js";
9
+ import { useRef as f } from "react";
10
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
11
11
  //#region src/components/Textarea/Textarea.tsx
12
- var m = "absolute right-4 top-4", h = (e) => e || "off", g = (e, n) => t("absolute bottom-2 right-3 text-xs pointer-events-none z-10 tabular-nums", e >= n ? "text-danger-400" : "text-text-secondary"), _ = (_) => {
13
- let { ref: v, autoComplete: y, className: b, defaultValue: x, disabled: S, errorMessage: C, id: w, label: T, labelClassName: E, maxLength: D = 280, name: O, onBlur: k, onChange: A, onFocus: j, placeholder: M, required: N, state: P = "default", value: F, ...I } = _, L = o(w, O), R = i(L), z = d(null), B = v ?? z, [V, H] = c({
12
+ var h = "absolute right-4 top-4", ee = (e) => e || "off", g = (e, n) => t("absolute bottom-2 right-3 text-xs pointer-events-none z-10 tabular-nums", e >= n ? "text-danger-400" : "text-text-secondary"), _ = (_) => {
13
+ let { ref: v, autoComplete: y, className: b, defaultValue: x, disabled: S, errorMessage: C, id: w, label: T, labelClassName: E, maxLength: D = 280, name: O, onBlur: k, onChange: A, onFocus: j, placeholder: M, required: N, state: P = "default", value: F, warningMessage: I, ...L } = _, R = s(w, O), z = a(R), B = `${R}-warning`, V = P === "error" ? z : P === "warning" && I ? B : void 0, H = f(null), U = v ?? H, [W, G] = l({
14
14
  value: F,
15
15
  defaultValue: typeof x == "string" ? x : x == null ? "" : String(x),
16
16
  onChange: A
17
- }), { handleFocus: U, handleBlur: W, handleChange: G, handlePaste: K } = u({
17
+ }), { handleFocus: K, handleBlur: q, handleChange: J, handlePaste: Y } = d({
18
18
  maxLength: D,
19
- value: V,
20
- onChange: H,
19
+ value: W,
20
+ onChange: G,
21
21
  onFocus: j,
22
22
  onBlur: k
23
- }), { isDisabled: q, isLoading: J } = s(S, P), Y = r(P, I["aria-describedby"], N, R), X = V?.length || 0, Z = a(P, b), Q = () => ({
24
- "--textarea-min-height": "6rem",
25
- "--textarea-max-height": "12rem",
26
- "--textarea-border-radius": "0.5rem"
27
- });
28
- return /* @__PURE__ */ p("div", {
23
+ }), { isDisabled: X, isLoading: Z } = c(S, P), Q = i(P, L["aria-describedby"], N, V), $ = W?.length || 0, te = o(P, b);
24
+ return /* @__PURE__ */ m("div", {
29
25
  className: "w-full",
30
26
  children: [
31
- T && /* @__PURE__ */ f(l, {
27
+ T && /* @__PURE__ */ p(u, {
32
28
  "data-testid": "spectral-textarea-label",
33
- htmlFor: L,
34
- className: t("mb-2 block", q && "cursor-not-allowed opacity-50", E),
29
+ htmlFor: R,
30
+ className: t("mb-2 block", X && "cursor-not-allowed opacity-50", E),
35
31
  children: T
36
32
  }),
37
- /* @__PURE__ */ p("div", {
33
+ /* @__PURE__ */ m("div", {
38
34
  className: "relative",
39
35
  children: [
40
- /* @__PURE__ */ f("textarea", {
36
+ /* @__PURE__ */ p("textarea", {
41
37
  "aria-multiline": "true",
42
- autoComplete: h(y),
43
- className: Z,
38
+ autoComplete: ee(y),
39
+ className: te,
44
40
  "data-state": P,
45
41
  "data-testid": "spectral-textarea",
46
- disabled: q,
47
- id: L,
42
+ disabled: X,
43
+ id: R,
48
44
  name: O,
49
- onBlur: W,
50
- onChange: G,
51
- onFocus: U,
52
- onPaste: K,
45
+ onBlur: q,
46
+ onChange: J,
47
+ onFocus: K,
48
+ onPaste: Y,
53
49
  placeholder: M,
54
- ref: B,
50
+ ref: U,
55
51
  required: N,
56
52
  spellCheck: "true",
57
- style: Q(),
58
- value: V,
59
- ...Y,
60
- ...I
53
+ style: {
54
+ "--textarea-min-height": "6rem",
55
+ "--textarea-max-height": "12rem",
56
+ "--textarea-border-radius": "0.5rem"
57
+ },
58
+ value: W,
59
+ ...Q,
60
+ ...L
61
61
  }),
62
- J && /* @__PURE__ */ f("div", {
63
- className: m,
62
+ Z && /* @__PURE__ */ p("div", {
63
+ className: h,
64
64
  "data-testid": "spectral-textarea-loading-icon",
65
- children: /* @__PURE__ */ f(e, { size: 24 })
65
+ children: /* @__PURE__ */ p(e, { size: 24 })
66
66
  }),
67
- /* @__PURE__ */ p("div", {
68
- "aria-label": X + " of " + D + " characters used",
67
+ /* @__PURE__ */ m("div", {
68
+ "aria-label": $ + " of " + D + " characters used",
69
69
  "aria-live": "polite",
70
- className: g(X, D),
70
+ className: g($, D),
71
71
  "data-testid": "spectral-textarea-counter",
72
72
  role: "status",
73
73
  children: [
74
- X,
74
+ $,
75
75
  "/",
76
76
  D
77
77
  ]
78
78
  })
79
79
  ]
80
80
  }),
81
- P === "error" && C && /* @__PURE__ */ f(n, {
81
+ P === "error" && C && /* @__PURE__ */ p(n, {
82
82
  dataTestId: "spectral-textarea-error-message",
83
- id: R,
83
+ id: z,
84
84
  message: C
85
+ }),
86
+ P === "warning" && I && /* @__PURE__ */ p(r, {
87
+ dataTestId: "spectral-textarea-warning-message",
88
+ id: B,
89
+ message: I
85
90
  })
86
91
  ]
87
92
  });
@@ -3,7 +3,7 @@ import { CheckSquareIcon as e } from "./Icons/CheckSquareIcon.js";
3
3
  import { CloseCircleIcon as t } from "./Icons/CloseCircleIcon.js";
4
4
  import { InfoIcon as n } from "./Icons/InfoIcon.js";
5
5
  import { WarningIcon as r } from "./Icons/WarningIcon.js";
6
- import { t as i } from "./twUtils-VNWgstKL.js";
6
+ import { t as i } from "./twUtils-D_qzdiwM.js";
7
7
  import { t as a } from "./dist-B4g6zpUF.js";
8
8
  import o from "react";
9
9
  import s from "react-dom";
package/dist/Toast.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./Toast-9zqXxKKO.js";
1
+ import { n as e, t } from "./Toast-CJvzLlMD.js";
2
2
  export { t as Toast, e as toast };
package/dist/Toggle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./styles/main.css";
2
- import { t as e } from "./twUtils-VNWgstKL.js";
2
+ import { t as e } from "./twUtils-D_qzdiwM.js";
3
3
  import { t } from "./dist-B4g6zpUF.js";
4
4
  import { ToggleBase as n } from "./Toggle/ToggleBase.js";
5
5
  import "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { t as e } from "./twUtils-VNWgstKL.js";
3
+ import { t as e } from "./twUtils-D_qzdiwM.js";
4
4
  import { getActiveColorStyle as t, toggleVariants as n } from "./Toggle.js";
5
5
  import { ToggleGroupBase as r, ToggleGroupItemBase as i } from "./ToggleGroup/ToggleGroupBase.js";
6
6
  import { createContext as a, useContext as o } from "react";
@@ -2,7 +2,7 @@ import "./styles/main.css";
2
2
  import { a as e, d as t, l as n, r, s as i, t as a } from "./dist-7HRQ5IKN.js";
3
3
  import { t as o } from "./dist-Bft31cJh.js";
4
4
  import { t as s } from "./dist-Dtvmk11N.js";
5
- import { t as c } from "./twUtils-VNWgstKL.js";
5
+ import { t as c } from "./twUtils-D_qzdiwM.js";
6
6
  import { t as l } from "./dist-B4g6zpUF.js";
7
7
  import { n as u, t as d } from "./dist-B2k1iWFp.js";
8
8
  import { a as f, i as p, n as m, r as h, t as g } from "./dist-C0Hifjgh.js";
@@ -315,7 +315,7 @@ function X(e, t) {
315
315
  }
316
316
  function Z(e) {
317
317
  let t = e.slice();
318
- return t.sort((e, t) => e.x < t.x ? -1 : e.x > t.x ? 1 : e.y < t.y ? -1 : e.y > t.y ? 1 : 0), ne(t);
318
+ return t.sort((e, t) => e.x < t.x ? -1 : e.x > t.x ? 1 : e.y < t.y ? -1 : +(e.y > t.y)), ne(t);
319
319
  }
320
320
  function ne(e) {
321
321
  if (e.length <= 1) return e.slice();
package/dist/Tooltip.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "./Tooltip-D1K8kY1y.js";
1
+ import { i as e, n as t, r as n, t as r } from "./Tooltip-BR0tdif4.js";
2
2
  export { r as Tooltip, t as TooltipContent, n as TooltipProvider, e as TooltipTrigger };
package/dist/Tray.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
3
  import { CloseIcon as e } from "./Icons/CloseIcon.js";
4
- import { t } from "./twUtils-VNWgstKL.js";
4
+ import { t } from "./twUtils-D_qzdiwM.js";
5
5
  import { t as n } from "./dist-B4g6zpUF.js";
6
6
  import { ButtonIcon as r } from "./ButtonIcon.js";
7
7
  import { t as i } from "./dist-3Af8168y.js";
8
- import { t as a } from "./proxy-Dn10Pl_g.js";
9
- import { t as o } from "./AnimatePresence-D-9jXfgI.js";
10
- import { t as s } from "./dist-B4FgboI8.js";
8
+ import { t as a } from "./proxy-CCB7C4Pu.js";
9
+ import { t as o } from "./AnimatePresence-D9FLxIGV.js";
10
+ import { t as s } from "./dist-Cujfuel1.js";
11
11
  import { createContext as c, useContext as l, useMemo as u, useRef as d } from "react";
12
12
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
13
  //#region src/components/Tray/Tray.tsx
@@ -1,5 +1,5 @@
1
1
  //#region \0rolldown/runtime.js
2
- var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, r = Object.prototype.hasOwnProperty, i = (e, t) => () => (e && (t = e(e = 0)), t), a = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), o = (t, n) => {
2
+ var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, r = Object.prototype.hasOwnProperty, i = (e, t) => () => (e && (t = e(e = 0)), t), a = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), o = (t, n) => {
3
3
  let r = {};
4
4
  for (var i in t) e(r, i, {
5
5
  get: t[i],
@@ -0,0 +1,149 @@
1
+ import "./styles/main.css";
2
+ import { a as e, d as t, l as n, r, t as i } from "./dist-7HRQ5IKN.js";
3
+ import { n as a, t as o } from "./dist-CGzgmYB9.js";
4
+ import { t as s } from "./dist-Dtvmk11N.js";
5
+ import { t as c } from "./dist-ClmepHp4.js";
6
+ import * as l from "react";
7
+ import { jsx as u } from "react/jsx-runtime";
8
+ //#region node_modules/.pnpm/@radix-ui+react-roving-focus@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14__@type_201cfa283d5b26fb84e6cfb74449149c/node_modules/@radix-ui/react-roving-focus/dist/index.mjs
9
+ var d = "rovingFocusGroup.onEntryFocus", f = {
10
+ bubbles: !1,
11
+ cancelable: !0
12
+ }, p = "RovingFocusGroup", [m, h, g] = a(p), [_, v] = t(p, [g]), [y, b] = _(p), x = l.forwardRef((e, t) => /* @__PURE__ */ u(m.Provider, {
13
+ scope: e.__scopeRovingFocusGroup,
14
+ children: /* @__PURE__ */ u(m.Slot, {
15
+ scope: e.__scopeRovingFocusGroup,
16
+ children: /* @__PURE__ */ u(S, {
17
+ ...e,
18
+ ref: t
19
+ })
20
+ })
21
+ }));
22
+ x.displayName = p;
23
+ var S = l.forwardRef((t, a) => {
24
+ let { __scopeRovingFocusGroup: s, orientation: m, loop: g = !1, dir: _, currentTabStopId: v, defaultCurrentTabStopId: b, onCurrentTabStopIdChange: x, onEntryFocus: S, preventScrollOnEntryFocus: C = !1, ...w } = t, T = l.useRef(null), E = n(a, T), D = o(_), [k, A] = r({
25
+ prop: v,
26
+ defaultProp: b ?? null,
27
+ onChange: x,
28
+ caller: p
29
+ }), [j, M] = l.useState(!1), N = c(S), P = h(s), F = l.useRef(!1), [I, L] = l.useState(0);
30
+ return l.useEffect(() => {
31
+ let e = T.current;
32
+ if (e) return e.addEventListener(d, N), () => e.removeEventListener(d, N);
33
+ }, [N]), /* @__PURE__ */ u(y, {
34
+ scope: s,
35
+ orientation: m,
36
+ dir: D,
37
+ loop: g,
38
+ currentTabStopId: k,
39
+ onItemFocus: l.useCallback((e) => A(e), [A]),
40
+ onItemShiftTab: l.useCallback(() => M(!0), []),
41
+ onFocusableItemAdd: l.useCallback(() => L((e) => e + 1), []),
42
+ onFocusableItemRemove: l.useCallback(() => L((e) => e - 1), []),
43
+ children: /* @__PURE__ */ u(i.div, {
44
+ tabIndex: j || I === 0 ? -1 : 0,
45
+ "data-orientation": m,
46
+ ...w,
47
+ ref: E,
48
+ style: {
49
+ outline: "none",
50
+ ...t.style
51
+ },
52
+ onMouseDown: e(t.onMouseDown, () => {
53
+ F.current = !0;
54
+ }),
55
+ onFocus: e(t.onFocus, (e) => {
56
+ let t = !F.current;
57
+ if (e.target === e.currentTarget && t && !j) {
58
+ let t = new CustomEvent(d, f);
59
+ if (e.currentTarget.dispatchEvent(t), !t.defaultPrevented) {
60
+ let e = P().filter((e) => e.focusable);
61
+ O([
62
+ e.find((e) => e.active),
63
+ e.find((e) => e.id === k),
64
+ ...e
65
+ ].filter(Boolean).map((e) => e.ref.current), C);
66
+ }
67
+ }
68
+ F.current = !1;
69
+ }),
70
+ onBlur: e(t.onBlur, () => M(!1))
71
+ })
72
+ });
73
+ }), C = "RovingFocusGroupItem", w = l.forwardRef((t, n) => {
74
+ let { __scopeRovingFocusGroup: r, focusable: a = !0, active: o = !1, tabStopId: c, children: d, ...f } = t, p = s(), g = c || p, _ = b(C, r), v = _.currentTabStopId === g, y = h(r), { onFocusableItemAdd: x, onFocusableItemRemove: S, currentTabStopId: w } = _;
75
+ return l.useEffect(() => {
76
+ if (a) return x(), () => S();
77
+ }, [
78
+ a,
79
+ x,
80
+ S
81
+ ]), /* @__PURE__ */ u(m.ItemSlot, {
82
+ scope: r,
83
+ id: g,
84
+ focusable: a,
85
+ active: o,
86
+ children: /* @__PURE__ */ u(i.span, {
87
+ tabIndex: v ? 0 : -1,
88
+ "data-orientation": _.orientation,
89
+ ...f,
90
+ ref: n,
91
+ onMouseDown: e(t.onMouseDown, (e) => {
92
+ a ? _.onItemFocus(g) : e.preventDefault();
93
+ }),
94
+ onFocus: e(t.onFocus, () => _.onItemFocus(g)),
95
+ onKeyDown: e(t.onKeyDown, (e) => {
96
+ if (e.key === "Tab" && e.shiftKey) {
97
+ _.onItemShiftTab();
98
+ return;
99
+ }
100
+ if (e.target !== e.currentTarget) return;
101
+ let t = D(e, _.orientation, _.dir);
102
+ if (t !== void 0) {
103
+ if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
104
+ e.preventDefault();
105
+ let n = y().filter((e) => e.focusable).map((e) => e.ref.current);
106
+ if (t === "last") n.reverse();
107
+ else if (t === "prev" || t === "next") {
108
+ t === "prev" && n.reverse();
109
+ let r = n.indexOf(e.currentTarget);
110
+ n = _.loop ? k(n, r + 1) : n.slice(r + 1);
111
+ }
112
+ setTimeout(() => O(n));
113
+ }
114
+ }),
115
+ children: typeof d == "function" ? d({
116
+ isCurrentTabStop: v,
117
+ hasTabStop: w != null
118
+ }) : d
119
+ })
120
+ });
121
+ });
122
+ w.displayName = C;
123
+ var T = {
124
+ ArrowLeft: "prev",
125
+ ArrowUp: "prev",
126
+ ArrowRight: "next",
127
+ ArrowDown: "next",
128
+ PageUp: "first",
129
+ Home: "first",
130
+ PageDown: "last",
131
+ End: "last"
132
+ };
133
+ function E(e, t) {
134
+ return t === "rtl" ? e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e : e;
135
+ }
136
+ function D(e, t, n) {
137
+ let r = E(e.key, n);
138
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r))) return T[r];
139
+ }
140
+ function O(e, t = !1) {
141
+ let n = document.activeElement;
142
+ for (let r of e) if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return;
143
+ }
144
+ function k(e, t) {
145
+ return e.map((n, r) => e[(t + r) % e.length]);
146
+ }
147
+ var A = x, j = w;
148
+ //#endregion
149
+ export { A as n, v as r, j as t };
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { i as e, t } from "./chunk-h9knIhTc.js";
3
+ import { i as e, t } from "./chunk-C4rFPcKS.js";
4
4
  import n from "./App.js";
5
5
  import { StrictMode as r } from "react";
6
6
  import { jsx as i } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { t as e } from "../twUtils-VNWgstKL.js";
1
+ import { t as e } from "../twUtils-D_qzdiwM.js";
2
2
  import { t } from "../dist-B4g6zpUF.js";
3
3
  import { Slot as n } from "./slot.js";
4
4
  import "react";