@spear-ai/spectral 1.4.26 → 1.4.27

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 (203) hide show
  1. package/dist/Accordion.d.ts +28 -9
  2. package/dist/Accordion.js +203 -183
  3. package/dist/Alert/AlertBase.d.ts +24 -16
  4. package/dist/Alert/AlertBase.js +33 -18
  5. package/dist/Alert.js +1 -1
  6. package/dist/Avatar.js +11 -11
  7. package/dist/Button.d.ts +7 -2
  8. package/dist/Button.js +25 -12
  9. package/dist/ButtonIcon.d.ts +7 -2
  10. package/dist/ButtonIcon.js +25 -16
  11. package/dist/Card.js +1 -1
  12. package/dist/Checkbox/CheckboxBase.d.ts +13 -13
  13. package/dist/Checkbox/CheckboxBase.js +128 -125
  14. package/dist/Checkbox.d.ts +7 -2
  15. package/dist/Checkbox.js +29 -22
  16. package/dist/DataCard.js +3 -3
  17. package/dist/Dialog.js +2 -2
  18. package/dist/Drawer.js +2 -2
  19. package/dist/HoverCard.js +1 -1
  20. package/dist/Icons/AnalyzeIcon.d.ts +3 -1
  21. package/dist/Icons/AnalyzeIcon.js +3 -6
  22. package/dist/Icons/AnnotationsIcon.d.ts +3 -1
  23. package/dist/Icons/AnnotationsIcon.js +3 -6
  24. package/dist/Icons/ApprovedIcon.d.ts +3 -1
  25. package/dist/Icons/ApprovedIcon.js +3 -6
  26. package/dist/Icons/ArrowDownIcon.d.ts +3 -1
  27. package/dist/Icons/ArrowDownIcon.js +3 -6
  28. package/dist/Icons/ArrowUpIcon.d.ts +3 -1
  29. package/dist/Icons/ArrowUpIcon.js +4 -7
  30. package/dist/Icons/CalendarIcon.d.ts +3 -1
  31. package/dist/Icons/CalendarIcon.js +9 -12
  32. package/dist/Icons/CheckCircleIcon.d.ts +3 -1
  33. package/dist/Icons/CheckCircleIcon.js +2 -5
  34. package/dist/Icons/CheckSquareIcon.d.ts +3 -1
  35. package/dist/Icons/CheckSquareIcon.js +4 -7
  36. package/dist/Icons/CheckmarkIcon.d.ts +3 -1
  37. package/dist/Icons/CheckmarkIcon.js +5 -8
  38. package/dist/Icons/ChevronDownIcon.d.ts +3 -1
  39. package/dist/Icons/ChevronDownIcon.js +5 -8
  40. package/dist/Icons/ChevronUpIcon.d.ts +3 -1
  41. package/dist/Icons/ChevronUpIcon.js +5 -8
  42. package/dist/Icons/ClockIcon.d.ts +3 -1
  43. package/dist/Icons/ClockIcon.js +5 -8
  44. package/dist/Icons/CloseCircleIcon.d.ts +3 -1
  45. package/dist/Icons/CloseCircleIcon.js +4 -7
  46. package/dist/Icons/CloseIcon.d.ts +3 -1
  47. package/dist/Icons/CloseIcon.js +5 -8
  48. package/dist/Icons/DashboardIcon.d.ts +3 -1
  49. package/dist/Icons/DashboardIcon.js +3 -6
  50. package/dist/Icons/DatabaseIcon.d.ts +3 -1
  51. package/dist/Icons/DatabaseIcon.js +4 -7
  52. package/dist/Icons/DeleteIcon.d.ts +3 -1
  53. package/dist/Icons/DeleteIcon.js +4 -7
  54. package/dist/Icons/DurationIcon.d.ts +3 -1
  55. package/dist/Icons/DurationIcon.js +3 -6
  56. package/dist/Icons/EditIcon.d.ts +3 -1
  57. package/dist/Icons/EditIcon.js +3 -6
  58. package/dist/Icons/EmailIcon.d.ts +3 -1
  59. package/dist/Icons/EmailIcon.js +4 -7
  60. package/dist/Icons/EraserIcon.d.ts +3 -1
  61. package/dist/Icons/EraserIcon.js +9 -10
  62. package/dist/Icons/ErrorIcon.d.ts +3 -1
  63. package/dist/Icons/ErrorIcon.js +4 -7
  64. package/dist/Icons/EyeClosedIcon.d.ts +3 -1
  65. package/dist/Icons/EyeClosedIcon.js +4 -7
  66. package/dist/Icons/EyeClosedIcon2.d.ts +3 -1
  67. package/dist/Icons/EyeClosedIcon2.js +3 -6
  68. package/dist/Icons/EyeOpenIcon.d.ts +3 -1
  69. package/dist/Icons/EyeOpenIcon.js +6 -9
  70. package/dist/Icons/GoToFirstIcon.d.ts +3 -1
  71. package/dist/Icons/GoToFirstIcon.js +4 -7
  72. package/dist/Icons/GoToLastIcon.d.ts +3 -1
  73. package/dist/Icons/GoToLastIcon.js +4 -7
  74. package/dist/Icons/HarmonicCursorsIcon.d.ts +3 -1
  75. package/dist/Icons/HarmonicCursorsIcon.js +4 -7
  76. package/dist/Icons/IconBase.d.ts +4 -2
  77. package/dist/Icons/IconBase.js +17 -8
  78. package/dist/Icons/InfoIcon.d.ts +3 -1
  79. package/dist/Icons/InfoIcon.js +4 -7
  80. package/dist/Icons/LabelIcon.d.ts +3 -1
  81. package/dist/Icons/LabelIcon.js +3 -6
  82. package/dist/Icons/LassoIcon.d.ts +3 -1
  83. package/dist/Icons/LassoIcon.js +5 -8
  84. package/dist/Icons/LineToolIcon.d.ts +3 -1
  85. package/dist/Icons/LineToolIcon.js +3 -6
  86. package/dist/Icons/LineToolIcon2.d.ts +3 -1
  87. package/dist/Icons/LineToolIcon2.js +3 -6
  88. package/dist/Icons/LiveViewIcon.d.ts +3 -1
  89. package/dist/Icons/LiveViewIcon.js +2 -5
  90. package/dist/Icons/LoaderIcon.d.ts +3 -1
  91. package/dist/Icons/LoaderIcon.js +6 -7
  92. package/dist/Icons/LocationIcon.d.ts +3 -1
  93. package/dist/Icons/LocationIcon.js +3 -6
  94. package/dist/Icons/LogoutIcon.d.ts +3 -1
  95. package/dist/Icons/LogoutIcon.js +4 -7
  96. package/dist/Icons/MessagesIcon.d.ts +3 -1
  97. package/dist/Icons/MessagesIcon.js +5 -8
  98. package/dist/Icons/MetadataIcon.d.ts +3 -1
  99. package/dist/Icons/MetadataIcon.js +4 -7
  100. package/dist/Icons/MinusIcon.d.ts +3 -1
  101. package/dist/Icons/MinusIcon.js +3 -6
  102. package/dist/Icons/OntologyIcon.d.ts +3 -1
  103. package/dist/Icons/OntologyIcon.js +2 -5
  104. package/dist/Icons/PanelIconClose.d.ts +3 -1
  105. package/dist/Icons/PanelIconClose.js +4 -7
  106. package/dist/Icons/PanelIconOpen.d.ts +3 -1
  107. package/dist/Icons/PanelIconOpen.js +8 -11
  108. package/dist/Icons/PlayIcon.d.ts +3 -1
  109. package/dist/Icons/PlayIcon.js +3 -6
  110. package/dist/Icons/PlusIcon.d.ts +3 -1
  111. package/dist/Icons/PlusIcon.js +4 -7
  112. package/dist/Icons/ResetIcon.d.ts +3 -1
  113. package/dist/Icons/ResetIcon.js +4 -7
  114. package/dist/Icons/ReviewedIcon.d.ts +3 -1
  115. package/dist/Icons/ReviewedIcon.js +3 -6
  116. package/dist/Icons/ScissorsIcon.d.ts +3 -1
  117. package/dist/Icons/ScissorsIcon.js +6 -9
  118. package/dist/Icons/SettingsIcon.d.ts +3 -1
  119. package/dist/Icons/SettingsIcon.js +3 -6
  120. package/dist/Icons/SortAscendingIcon.d.ts +3 -1
  121. package/dist/Icons/SortAscendingIcon.js +3 -6
  122. package/dist/Icons/SortAtoZIcon.d.ts +3 -1
  123. package/dist/Icons/SortAtoZIcon.js +3 -6
  124. package/dist/Icons/SortDescendingIcon.d.ts +3 -1
  125. package/dist/Icons/SortDescendingIcon.js +3 -6
  126. package/dist/Icons/SortZtoAIcon.d.ts +3 -1
  127. package/dist/Icons/SortZtoAIcon.js +3 -6
  128. package/dist/Icons/StackIcon.d.ts +3 -1
  129. package/dist/Icons/StackIcon.js +4 -7
  130. package/dist/Icons/StarIcon.d.ts +3 -1
  131. package/dist/Icons/StarIcon.js +3 -6
  132. package/dist/Icons/TrashIcon.d.ts +3 -1
  133. package/dist/Icons/TrashIcon.js +3 -6
  134. package/dist/Icons/UndoIcon.d.ts +3 -1
  135. package/dist/Icons/UndoIcon.js +4 -7
  136. package/dist/Icons/UserIcon.d.ts +3 -1
  137. package/dist/Icons/UserIcon.js +3 -6
  138. package/dist/Icons/WarningIcon.d.ts +3 -1
  139. package/dist/Icons/WarningIcon.js +5 -8
  140. package/dist/Icons/ZoomAllIcon.d.ts +3 -1
  141. package/dist/Icons/ZoomAllIcon.js +3 -6
  142. package/dist/Icons/ZoomXIcon.d.ts +3 -1
  143. package/dist/Icons/ZoomXIcon.js +4 -7
  144. package/dist/Icons/ZoomYIcon.d.ts +3 -1
  145. package/dist/Icons/ZoomYIcon.js +4 -7
  146. package/dist/Input/InputUtils.d.ts +4 -4
  147. package/dist/Input/InputUtils.js +1 -1
  148. package/dist/Input.d.ts +7 -17
  149. package/dist/Input.js +105 -101
  150. package/dist/InputOTP.d.ts +27 -7
  151. package/dist/InputOTP.js +171 -146
  152. package/dist/Label.d.ts +7 -2
  153. package/dist/Label.js +12 -9
  154. package/dist/MultiSelect/MultiSelectBase.d.ts +7 -2
  155. package/dist/MultiSelect/MultiSelectBase.js +212 -213
  156. package/dist/{MultiSelect/MutiSelect.d.ts → MultiSelect.d.ts} +8 -2
  157. package/dist/MultiSelect.js +27 -0
  158. package/dist/Popover.js +1 -1
  159. package/dist/RadioButtonGroup.js +1 -1
  160. package/dist/RadioGroup.d.ts +20 -14
  161. package/dist/RadioGroup.js +177 -148
  162. package/dist/Select.d.ts +7 -2
  163. package/dist/Select.js +108 -109
  164. package/dist/Separator.d.ts +8 -8
  165. package/dist/Separator.js +14 -15
  166. package/dist/Switch/SwitchBase.d.ts +13 -11
  167. package/dist/Switch/SwitchBase.js +84 -61
  168. package/dist/Switch.d.ts +11 -4
  169. package/dist/Switch.js +19 -20
  170. package/dist/Tabs/TabsBase.d.ts +16 -6
  171. package/dist/Tabs/TabsBase.js +133 -96
  172. package/dist/Tabs/tabsUtils.d.ts +6 -2
  173. package/dist/Tabs/tabsUtils.js +5 -2
  174. package/dist/Tabs.js +18 -18
  175. package/dist/Textarea.d.ts +7 -2
  176. package/dist/Textarea.js +78 -61
  177. package/dist/Toggle/ToggleBase.d.ts +4 -8
  178. package/dist/Toggle/ToggleBase.js +29 -16
  179. package/dist/Toggle.d.ts +4 -2
  180. package/dist/Toggle.js +23 -13
  181. package/dist/ToggleGroup/ToggleGroupBase.d.ts +4 -7
  182. package/dist/ToggleGroup/ToggleGroupBase.js +82 -73
  183. package/dist/ToggleGroup.d.ts +7 -2
  184. package/dist/ToggleGroup.js +31 -19
  185. package/dist/Tray.d.ts +47 -15
  186. package/dist/Tray.js +98 -60
  187. package/dist/hooks/useAccordionAutoScroll.d.ts +1 -1
  188. package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
  189. package/dist/hooks/useAccordionAutoScroll.js +35 -34
  190. package/dist/{index-BSCg4Mei.js → index-B0Kp8R0j.js} +3 -3
  191. package/dist/{index-jgQ7sgLl.js → index-D4jMMaAi.js} +5 -5
  192. package/dist/primitives/input.d.ts.map +1 -1
  193. package/dist/primitives/input.js +1 -4
  194. package/dist/primitives/select.d.ts.map +1 -1
  195. package/dist/primitives/select.js +4 -11
  196. package/dist/primitives/slot.d.ts +11 -4
  197. package/dist/primitives/slot.d.ts.map +1 -1
  198. package/dist/primitives/slot.js +32 -28
  199. package/dist/primitives/textarea.d.ts.map +1 -1
  200. package/dist/primitives/textarea.js +1 -3
  201. package/dist/utils/formFieldUtils.js +2 -2
  202. package/package.json +1 -1
  203. package/dist/MultiSelect/MutiSelect.js +0 -19
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from 'react';
1
+ import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
2
2
  export interface TabsContextValue {
3
3
  activationMode: 'automatic' | 'manual';
4
4
  baseId: string;
@@ -22,26 +22,36 @@ export interface TabsBaseProps extends Omit<ComponentPropsWithoutRef<'div'>, 'di
22
22
  rightSlot?: ReactNode | undefined;
23
23
  value?: string;
24
24
  }
25
- export declare const TabsBase: import('react').ForwardRefExoticComponent<TabsBaseProps & import('react').RefAttributes<HTMLElement>>;
25
+ export declare const TabsBase: ({ ref, activationMode, children, defaultValue, dir, disabled, onValueChange, orientation, rightSlot, value: controlledValue, ...props }: TabsBaseProps & {
26
+ ref?: Ref<HTMLElement>;
27
+ }) => import("react/jsx-runtime").JSX.Element;
26
28
  export interface TabsListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
27
29
  children?: ReactNode;
28
30
  loop?: boolean;
29
31
  rightSlot?: ReactNode | undefined;
30
32
  }
31
- export declare const TabsList: import('react').ForwardRefExoticComponent<TabsListProps & import('react').RefAttributes<HTMLElement>>;
33
+ export declare const TabsList: ({ ref, children, className, loop, rightSlot, ...props }: TabsListProps & {
34
+ ref?: Ref<HTMLElement>;
35
+ }) => import("react/jsx-runtime").JSX.Element;
32
36
  export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
33
37
  value: string;
34
38
  disabled?: boolean;
35
39
  }
36
- export declare const TabsTrigger: import('react').ForwardRefExoticComponent<TabsTriggerProps & import('react').RefAttributes<HTMLElement>>;
40
+ export declare const TabsTrigger: ({ ref, className, value: triggerValue, onClick, onKeyDown, disabled: triggerDisabled, ...props }: TabsTriggerProps & {
41
+ ref?: Ref<HTMLElement>;
42
+ }) => import("react/jsx-runtime").JSX.Element;
37
43
  export interface TabsContentContainerProps {
38
44
  children: ReactNode;
39
45
  className?: string;
40
46
  }
41
- export declare const TabsContentContainer: import('react').ForwardRefExoticComponent<TabsContentContainerProps & import('react').RefAttributes<HTMLDivElement>>;
47
+ export declare const TabsContentContainer: ({ ref, children, className, }: TabsContentContainerProps & {
48
+ ref?: Ref<HTMLDivElement>;
49
+ }) => import("react/jsx-runtime").JSX.Element;
42
50
  export interface TabsContentProps extends ComponentPropsWithoutRef<'div'> {
43
51
  value: string;
44
52
  forceMount?: boolean;
45
53
  }
46
- export declare const TabsContent: import('react').ForwardRefExoticComponent<TabsContentProps & import('react').RefAttributes<HTMLElement>>;
54
+ export declare const TabsContent: ({ ref, className, value: contentValue, forceMount, ...props }: TabsContentProps & {
55
+ ref?: Ref<HTMLElement>;
56
+ }) => import("react/jsx-runtime").JSX.Element | null;
47
57
  //# sourceMappingURL=TabsBase.d.ts.map
@@ -1,87 +1,106 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as m, jsxs as E } from "react/jsx-runtime";
4
- import { generateId as M, prefersReducedMotion as $, debounce as K, getIndicatorPosition as P, calculateIndicatorStyle as S } from "./tabsUtils.js";
3
+ import { jsx as m, jsxs as D } from "react/jsx-runtime";
4
+ import { generateId as L, prefersReducedMotion as R, debounce as M, getIndicatorPosition as K, calculateIndicatorStyle as P } from "./tabsUtils.js";
5
5
  import { cn as y } from "../utils/twUtils.js";
6
- import { createContext as j, forwardRef as I, useState as N, useId as k, useCallback as T, useRef as O, useEffect as U, useContext as F } from "react";
7
- import { j as q, m as R, A as B } from "../index-BvRlXSJj.js";
8
- const _ = j(null), D = (x = "Tabs") => {
9
- const l = F(_);
6
+ import { createContext as S, useContext as j, useState as $, useId as k, useCallback as C, useRef as O, useMemo as U, useEffect as F } from "react";
7
+ import { j as q, m as E, A as B } from "../index-BvRlXSJj.js";
8
+ const N = S(null), A = (x = "Tabs") => {
9
+ const l = j(N);
10
10
  if (l === null)
11
11
  throw new Error(`${x} components must be used within a Tabs.Root`);
12
12
  return l;
13
- }, X = I(function({ activationMode: l = "automatic", children: a, defaultValue: r, dir: d = "ltr", disabled: u = !1, onValueChange: f, orientation: o = "horizontal", rightSlot: v, value: t, ...b }, p) {
14
- const [g, w] = N(r ?? ""), C = k() ?? M("tabs"), i = t !== void 0, e = i ? t : g, n = T(
13
+ }, X = function({
14
+ ref: l,
15
+ activationMode: v = "automatic",
16
+ children: a,
17
+ defaultValue: r,
18
+ dir: d = "ltr",
19
+ disabled: u = !1,
20
+ onValueChange: o,
21
+ orientation: b = "horizontal",
22
+ rightSlot: e,
23
+ value: f,
24
+ ...g
25
+ }) {
26
+ const [w, p] = $(r ?? ""), T = k() ?? L("tabs"), i = f !== void 0, t = i ? f : w, n = C(
15
27
  (s) => {
16
- u || (i || w(s), f?.(s));
28
+ u || (i || p(s), o?.(s));
17
29
  },
18
- [i, f, u]
30
+ [i, o, u]
19
31
  ), c = {
20
- activationMode: l,
21
- baseId: C,
32
+ activationMode: v,
33
+ baseId: T,
22
34
  dir: d,
23
35
  disabled: u,
24
36
  onValueChange: n,
25
- orientation: o,
26
- rightSlot: v,
27
- value: e
37
+ orientation: b,
38
+ rightSlot: e,
39
+ value: t
28
40
  };
29
- return /* @__PURE__ */ m(_.Provider, { value: c, children: /* @__PURE__ */ m("div", { ref: p, "data-testid": "spectral-tabs", "data-orientation": o, "data-disabled": u ? "" : void 0, dir: d, ...b, children: a }) });
30
- }), Y = I(function({ children: l, className: a, loop: r = !0, rightSlot: d, ...u }, f) {
31
- const { orientation: o, disabled: v } = D("TabsList"), [t, b] = N(() => ({
41
+ return /* @__PURE__ */ m(N.Provider, { value: c, children: /* @__PURE__ */ m("div", { ref: l, "data-testid": "spectral-tabs", "data-orientation": b, "data-disabled": u ? "" : void 0, dir: d, ...g, children: a }) });
42
+ }, Y = function({
43
+ ref: l,
44
+ children: v,
45
+ className: a,
46
+ loop: r = !0,
47
+ rightSlot: d,
48
+ ...u
49
+ }) {
50
+ const { orientation: o, disabled: b } = A("TabsList"), [e, f] = $(() => ({
32
51
  height: 0,
33
52
  isEnclosed: !1,
34
53
  left: 0,
35
54
  orientation: "horizontal",
36
55
  top: 0,
37
56
  width: 0
38
- })), p = O(null), g = $(), w = T(
39
- K(() => {
40
- const i = S(p);
41
- b(i);
57
+ })), g = O(null), w = R(), p = U(
58
+ () => M(() => {
59
+ const i = P(g);
60
+ f(i);
42
61
  }, 16),
43
62
  // ~60fps
44
63
  []
45
64
  );
46
- U(() => {
47
- w();
48
- const i = new ResizeObserver(w), e = new MutationObserver(w), n = p.current;
49
- return n && (i.observe(n), e.observe(n, {
65
+ F(() => {
66
+ p();
67
+ const i = new ResizeObserver(p), t = new MutationObserver(p), n = g.current;
68
+ return n && (i.observe(n), t.observe(n, {
50
69
  attributes: !0,
51
70
  childList: !0,
52
71
  subtree: !0
53
72
  })), () => {
54
- i.disconnect(), e.disconnect();
73
+ i.disconnect(), t.disconnect(), p.cancel();
55
74
  };
56
- }, [w]);
57
- const C = T(
75
+ }, [p]);
76
+ const T = C(
58
77
  (i) => {
59
- if (v) return;
60
- const e = Array.from(p.current?.querySelectorAll("[role='tab']:not([disabled]):not([aria-disabled='true'])") ?? []);
61
- if (e.length === 0) return;
62
- const n = e.findIndex((L) => L === document.activeElement);
78
+ if (b) return;
79
+ const t = Array.from(g.current?.querySelectorAll("[role='tab']:not([disabled]):not([aria-disabled='true'])") ?? []);
80
+ if (t.length === 0) return;
81
+ const n = t.findIndex((_) => _ === document.activeElement);
63
82
  if (n === -1) return;
64
83
  let c = null;
65
- const { key: s, ctrlKey: h, metaKey: z } = i, A = h || z;
66
- o === "horizontal" ? s === "ArrowLeft" || s === "ArrowUp" && A ? c = n > 0 ? n - 1 : r ? e.length - 1 : n : (s === "ArrowRight" || s === "ArrowDown" && A) && (c = n < e.length - 1 ? n + 1 : r ? 0 : n) : s === "ArrowUp" || s === "ArrowLeft" && A ? c = n > 0 ? n - 1 : r ? e.length - 1 : n : (s === "ArrowDown" || s === "ArrowRight" && A) && (c = n < e.length - 1 ? n + 1 : r ? 0 : n), s === "Home" ? c = 0 : s === "End" && (c = e.length - 1), c !== null && c !== n && (i.preventDefault(), i.stopPropagation(), e[c]?.focus());
84
+ const { key: s, ctrlKey: h, metaKey: I } = i, z = h || I;
85
+ o === "horizontal" ? s === "ArrowLeft" || s === "ArrowUp" && z ? c = n > 0 ? n - 1 : r ? t.length - 1 : n : (s === "ArrowRight" || s === "ArrowDown" && z) && (c = n < t.length - 1 ? n + 1 : r ? 0 : n) : s === "ArrowUp" || s === "ArrowLeft" && z ? c = n > 0 ? n - 1 : r ? t.length - 1 : n : (s === "ArrowDown" || s === "ArrowRight" && z) && (c = n < t.length - 1 ? n + 1 : r ? 0 : n), s === "Home" ? c = 0 : s === "End" && (c = t.length - 1), c !== null && c !== n && (i.preventDefault(), i.stopPropagation(), t[c]?.focus());
67
86
  },
68
- [v, o, r]
87
+ [b, o, r]
69
88
  );
70
- return /* @__PURE__ */ E("div", { className: "relative", ref: p, children: [
71
- /* @__PURE__ */ E(
89
+ return /* @__PURE__ */ D("div", { className: "relative", ref: g, children: [
90
+ /* @__PURE__ */ D(
72
91
  "div",
73
92
  {
74
- ref: f,
93
+ ref: l,
75
94
  role: "tablist",
76
95
  "data-testid": "spectral-tabs-list",
77
96
  "aria-orientation": o,
78
- "aria-disabled": v,
97
+ "aria-disabled": b,
79
98
  className: y("tabs-list flex", o === "horizontal" && "items-center justify-between", o === "vertical" && "flex-col", a),
80
- onKeyDown: C,
99
+ onKeyDown: T,
81
100
  ...u,
82
101
  children: [
83
- /* @__PURE__ */ m("div", { className: y("flex", o === "horizontal" && "items-center", o === "vertical" && "flex-col"), children: l }),
84
- d && /* @__PURE__ */ m("div", { className: "flex items-center z-10", children: d })
102
+ /* @__PURE__ */ m("div", { className: y("flex", o === "horizontal" && "items-center", o === "vertical" && "flex-col"), children: v }),
103
+ d && /* @__PURE__ */ m("div", { className: "z-10 flex items-center", children: d })
85
104
  ]
86
105
  }
87
106
  ),
@@ -89,90 +108,102 @@ const _ = j(null), D = (x = "Tabs") => {
89
108
  "div",
90
109
  {
91
110
  className: y(
92
- "absolute pointer-events-none select-none",
93
- !g && "transition-all duration-300 ease-out",
94
- t.orientation === "horizontal" && !t.isEnclosed && ["bottom-[1px] after:content-[''] after:absolute after:bottom-0 after:left-0 after:w-full", "after:border-b-[0.3rem] after:border-tabs-indicator after:rounded-t-[0.3rem] z-10"],
95
- t.orientation === "vertical" && !t.isEnclosed && [
111
+ "pointer-events-none absolute select-none",
112
+ !w && "transition-all duration-300 ease-out",
113
+ e.orientation === "horizontal" && !e.isEnclosed && ["bottom-[1px] after:absolute after:bottom-0 after:left-0 after:w-full after:content-['']", "after:border-tabs-indicator z-10 after:rounded-t-[0.3rem] after:border-b-[0.3rem]"],
114
+ e.orientation === "vertical" && !e.isEnclosed && [
96
115
  "right-[1px]",
97
- !g && "transition-[top_300ms_ease,height_300ms_ease]",
98
- "after:content-[''] after:absolute after:right-0 after:top-0 after:h-full after:w-1",
99
- "after:border-r-[0.3rem] after:border-tabs-indicator after:rounded-l-[0.3rem] z-10"
116
+ !w && "transition-[top_300ms_ease,height_300ms_ease]",
117
+ "after:absolute after:top-0 after:right-0 after:h-full after:w-1 after:content-['']",
118
+ "after:border-tabs-indicator z-10 after:rounded-l-[0.3rem] after:border-r-[0.3rem]"
100
119
  ],
101
- t.orientation === "horizontal" && t.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg top-[10%] bottom-[10%] z-0", !g && "transition-[left_300ms_ease,width_300ms_ease]"],
102
- t.orientation === "vertical" && t.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg left-1 right-1 z-0 max-h-10 w-auto"]
120
+ e.orientation === "horizontal" && e.isEnclosed && ["bg-tabs-enclosed-indicator top-[10%] bottom-[10%] z-0 rounded-lg shadow-lg", !w && "transition-[left_300ms_ease,width_300ms_ease]"],
121
+ e.orientation === "vertical" && e.isEnclosed && ["bg-tabs-enclosed-indicator right-1 left-1 z-0 max-h-10 w-auto rounded-lg shadow-lg"]
103
122
  ),
104
123
  style: {
105
- ...P(t),
106
- ...t.isEnclosed && t.orientation === "vertical" ? { height: "40px" } : {}
124
+ ...K(e),
125
+ ...e.isEnclosed && e.orientation === "vertical" ? { height: "40px" } : {}
107
126
  },
108
127
  "aria-hidden": "true"
109
128
  }
110
129
  )
111
130
  ] });
112
- }), Z = I(function({ className: l, value: a, onClick: r, onKeyDown: d, disabled: u = !1, ...f }, o) {
113
- const { value: v, onValueChange: t, activationMode: b, disabled: p, baseId: g } = D("TabsTrigger"), w = `${g}-trigger-${a}`, C = `${g}-content-${a}`, i = v === a, e = p || u, n = T(
131
+ }, Z = function({
132
+ ref: l,
133
+ className: v,
134
+ value: a,
135
+ onClick: r,
136
+ onKeyDown: d,
137
+ disabled: u = !1,
138
+ ...o
139
+ }) {
140
+ const { value: b, onValueChange: e, activationMode: f, disabled: g, baseId: w } = A("TabsTrigger"), p = `${w}-trigger-${a}`, T = `${w}-content-${a}`, i = b === a, t = g || u, n = C(
114
141
  (h) => {
115
- if (e) {
142
+ if (t) {
116
143
  h.preventDefault();
117
144
  return;
118
145
  }
119
- t(a), r?.(h);
146
+ e(a), r?.(h);
120
147
  },
121
- [a, t, r, e]
122
- ), c = T(
148
+ [a, e, r, t]
149
+ ), c = C(
123
150
  (h) => {
124
- if (e) {
151
+ if (t) {
125
152
  h.preventDefault();
126
153
  return;
127
154
  }
128
- const { key: z } = h;
129
- (z === "Enter" || z === " ") && (h.preventDefault(), h.stopPropagation(), t(a)), d?.(h);
155
+ const { key: I } = h;
156
+ (I === "Enter" || I === " ") && (h.preventDefault(), h.stopPropagation(), e(a)), d?.(h);
130
157
  },
131
- [a, t, d, e]
132
- ), s = T(() => {
133
- e || b === "automatic" && t(a);
134
- }, [b, t, a, e]);
158
+ [a, e, d, t]
159
+ ), s = C(() => {
160
+ t || f === "automatic" && e(a);
161
+ }, [f, e, a, t]);
135
162
  return /* @__PURE__ */ m(
136
163
  "button",
137
164
  {
138
- "aria-controls": C,
139
- "aria-disabled": e,
165
+ "aria-controls": T,
166
+ "aria-disabled": t,
140
167
  "aria-selected": i,
141
- className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", l),
142
- "data-disabled": e ? "" : void 0,
168
+ className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", v),
169
+ "data-disabled": t ? "" : void 0,
143
170
  "data-state": i ? "active" : "inactive",
144
171
  "data-testid": "spectral-tabs-trigger",
145
- disabled: e,
146
- id: w,
172
+ disabled: t,
173
+ id: p,
147
174
  onClick: n,
148
175
  onFocus: s,
149
176
  onKeyDown: c,
150
- ref: o,
177
+ ref: l,
151
178
  role: "tab",
152
179
  tabIndex: i ? 0 : -1,
153
180
  type: "button",
154
- ...f
181
+ ...o
155
182
  }
156
183
  );
157
- }), V = I(function({ children: l, className: a }, r) {
158
- const { value: d } = D("TabsContentContainer"), [u, f] = q(), o = $();
184
+ }, V = function({
185
+ ref: l,
186
+ children: v,
187
+ className: a
188
+ }) {
189
+ const { value: r } = A("TabsContentContainer"), [d, u] = q(), o = R();
159
190
  return /* @__PURE__ */ m(
160
- R.div,
191
+ E.div,
161
192
  {
162
- ref: r,
193
+ ref: l,
163
194
  className: y("overflow-hidden", a),
164
195
  "data-testid": "spectral-tabs-content-container",
165
196
  animate: {
166
- height: f.height || "auto"
197
+ height: u.height || "auto"
167
198
  },
168
199
  transition: o ? { duration: 0 } : {
169
200
  duration: 0.3,
170
201
  ease: [0.25, 1, 0.5, 1]
171
202
  },
172
203
  children: /* @__PURE__ */ m(B, { mode: "wait", initial: !1, children: /* @__PURE__ */ m(
173
- R.div,
204
+ E.div,
174
205
  {
175
- ref: u,
206
+ ref: d,
176
207
  initial: o ? !1 : { opacity: 0, y: 8 },
177
208
  animate: { opacity: 1, y: 0 },
178
209
  exit: o ? void 0 : { opacity: 0, y: -8 },
@@ -180,36 +211,42 @@ const _ = j(null), D = (x = "Tabs") => {
180
211
  duration: 0.2,
181
212
  ease: [0.25, 1, 0.5, 1]
182
213
  },
183
- children: l
214
+ children: v
184
215
  },
185
- d
216
+ r
186
217
  ) })
187
218
  }
188
219
  );
189
- }), tt = I(function({ className: l, value: a, forceMount: r = !1, ...d }, u) {
190
- const { value: f, baseId: o } = D("TabsContent"), v = `${o}-content-${a}`, t = `${o}-trigger-${a}`, b = f === a;
191
- return !r && !b ? null : /* @__PURE__ */ m(
220
+ }, tt = function({
221
+ ref: l,
222
+ className: v,
223
+ value: a,
224
+ forceMount: r = !1,
225
+ ...d
226
+ }) {
227
+ const { value: u, baseId: o } = A("TabsContent"), b = `${o}-content-${a}`, e = `${o}-trigger-${a}`, f = u === a;
228
+ return !r && !f ? null : /* @__PURE__ */ m(
192
229
  "div",
193
230
  {
194
- "aria-labelledby": t,
195
- className: y("tabs-content focus:outline-none focus-visible:outline-none", l),
196
- "data-state": b ? "active" : "inactive",
231
+ "aria-labelledby": e,
232
+ className: y("tabs-content focus:outline-none focus-visible:outline-none", v),
233
+ "data-state": f ? "active" : "inactive",
197
234
  "data-testid": "spectral-tabs-content",
198
- hidden: !b,
199
- id: v,
200
- ref: u,
235
+ hidden: !f,
236
+ id: b,
237
+ ref: l,
201
238
  role: "tabpanel",
202
239
  tabIndex: 0,
203
240
  ...d
204
241
  }
205
242
  );
206
- });
243
+ };
207
244
  export {
208
245
  X as TabsBase,
209
246
  tt as TabsContent,
210
247
  V as TabsContentContainer,
211
- _ as TabsContext,
248
+ N as TabsContext,
212
249
  Y as TabsList,
213
250
  Z as TabsTrigger,
214
- D as useTabsContext
251
+ A as useTabsContext
215
252
  };
@@ -16,7 +16,7 @@ export interface IndicatorPosition {
16
16
  /**
17
17
  * Calculates the position and dimensions of the active tab indicator
18
18
  */
19
- export declare const calculateIndicatorStyle: (tabsListRef: RefObject<HTMLDivElement>) => IndicatorStyle;
19
+ export declare const calculateIndicatorStyle: (tabsListRef: RefObject<HTMLDivElement | null>) => IndicatorStyle;
20
20
  /**
21
21
  * Gets CSS positioning styles for the indicator based on orientation
22
22
  */
@@ -24,7 +24,11 @@ export declare const getIndicatorPosition: (style: IndicatorStyle) => IndicatorP
24
24
  /**
25
25
  * Debounce utility for performance optimization with proper cleanup
26
26
  */
27
- export declare const debounce: <TArgs extends unknown[]>(func: (...args: TArgs) => void, wait: number) => ((...args: TArgs) => void);
27
+ export interface DebouncedFunction<TArgs extends unknown[]> {
28
+ (...args: TArgs): void;
29
+ cancel: () => void;
30
+ }
31
+ export declare const debounce: <TArgs extends unknown[]>(func: (...args: TArgs) => void, wait: number) => DebouncedFunction<TArgs>;
28
32
  /**
29
33
  * Checks if user prefers reduced motion (SSR safe)
30
34
  */
@@ -28,11 +28,14 @@ const s = (e) => {
28
28
  height: `${e.height}px`
29
29
  }, d = (e, n) => {
30
30
  let t = null;
31
- return (...r) => {
31
+ const r = (...o) => {
32
32
  t !== null && clearTimeout(t), t = setTimeout(() => {
33
- e(...r);
33
+ e(...o);
34
34
  }, n);
35
35
  };
36
+ return r.cancel = () => {
37
+ t !== null && (clearTimeout(t), t = null);
38
+ }, r;
36
39
  }, f = () => {
37
40
  if (typeof window > "u") return !1;
38
41
  try {
package/dist/Tabs.js CHANGED
@@ -4,15 +4,15 @@ import { TabsBase as T, TabsList as z, TabsTrigger as k, TabsContentContainer as
4
4
  import { validateTabValues as V, getTabKeys as E } from "./Tabs/tabsUtils.js";
5
5
  import { cn as r } from "./utils/twUtils.js";
6
6
  import "react";
7
- const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { className: "flex flex-col relative w-full", role: "status", children: [
8
- /* @__PURE__ */ l("div", { className: r("inline-flex items-center justify-start w-full", s === "horizontal" && "border-b border-neutral-600", s === "vertical" && "flex-col items-stretch border-r border-neutral-600"), children: Array.from({ length: Math.min(d, 5) }, (h, n) => /* @__PURE__ */ l("div", { className: r("animate-pulse bg-neutral-600 rounded", s === "horizontal" ? "h-6 w-16 mx-2 my-2" : "h-6 w-full mx-2 my-1"), "aria-hidden": "true" }, n)) }),
9
- /* @__PURE__ */ l("div", { className: "animate-pulse bg-neutral-600 h-32 w-full mt-4 rounded", "aria-hidden": "true" }),
7
+ const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { className: "relative flex w-full flex-col", role: "status", children: [
8
+ /* @__PURE__ */ l("div", { className: r("inline-flex w-full items-center justify-start", s === "horizontal" && "border-b border-neutral-600", s === "vertical" && "flex-col items-stretch border-r border-neutral-600"), children: Array.from({ length: Math.min(d, 5) }, (h, n) => /* @__PURE__ */ l("div", { className: r("animate-pulse rounded bg-neutral-600", s === "horizontal" ? "mx-2 my-2 h-6 w-16" : "mx-2 my-1 h-6 w-full"), "aria-hidden": "true" }, n)) }),
9
+ /* @__PURE__ */ l("div", { className: "mt-4 h-32 w-full animate-pulse rounded bg-neutral-600", "aria-hidden": "true" }),
10
10
  /* @__PURE__ */ l("span", { className: "sr-only", children: "Loading tabs…" })
11
11
  ] }), R = ({ activationMode: d = "automatic", ariaLabel: s, className: h, loading: n = !1, onBeforeChange: v, onError: b, onValueChange: x, openOnLoad: i, orientation: t = "horizontal", rightSlot: y, tabValues: m = [], variant: a = "default", ...g }) => {
12
12
  const c = m.filter((e) => e.key !== void 0);
13
13
  if (!V(c)) {
14
14
  const e = new Error("Invalid tabValues provided to Tabs component");
15
- return b?.(e), /* @__PURE__ */ l("div", { className: "flex flex-col relative w-full p-4 text-center text-gray-500", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ l("p", { children: "No valid tabs provided" }) });
15
+ return b?.(e), /* @__PURE__ */ l("div", { className: "relative flex w-full flex-col p-4 text-center text-gray-500", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ l("p", { children: "No valid tabs provided" }) });
16
16
  }
17
17
  if (n)
18
18
  return /* @__PURE__ */ l(K, { tabCount: m.length || 3, orientation: t });
@@ -20,7 +20,7 @@ const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { classN
20
20
  let o = i ?? u[0];
21
21
  if (i && !u.includes(i) && (console.warn(`Tabs: openOnLoad value '${i}' is not a valid tab key`), o = u[0]), !o) {
22
22
  const e = new Error("No valid default tab available");
23
- return b?.(e), /* @__PURE__ */ l("div", { className: "flex flex-col relative w-full p-4 text-center text-text-secondary", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ l("p", { children: "Unable to render tabs" }) });
23
+ return b?.(e), /* @__PURE__ */ l("div", { className: "text-text-secondary relative flex w-full flex-col p-4 text-center", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ l("p", { children: "Unable to render tabs" }) });
24
24
  }
25
25
  const w = async (e) => {
26
26
  if (v && x) {
@@ -34,16 +34,16 @@ const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { classN
34
34
  }
35
35
  x?.(e);
36
36
  };
37
- return /* @__PURE__ */ l("div", { className: "flex flex-col relative w-full", children: /* @__PURE__ */ p(T, { "aria-label": s, className: r("relative w-full data-[orientation=vertical]:flex", a, h), defaultValue: o, orientation: t, activationMode: d, onValueChange: w, ...g, children: [
37
+ return /* @__PURE__ */ l("div", { className: "relative flex w-full flex-col", children: /* @__PURE__ */ p(T, { "aria-label": s, className: r("relative w-full data-[orientation=vertical]:flex", a, h), defaultValue: o, orientation: t, activationMode: d, onValueChange: w, ...g, children: [
38
38
  /* @__PURE__ */ l(
39
39
  z,
40
40
  {
41
41
  className: r(
42
- "inline-flex items-center justify-between w-full",
43
- t === "horizontal" && a === "default" && ["border-b border-tabs-border"],
44
- t === "vertical" && a === "default" && ["flex-col items-stretch border-r border-tabs-border h-auto m-0 py-1 w-auto relative"],
45
- t === "horizontal" && a === "enclosed" && ["bg-tabs-group-bg border-0 rounded-lg p-1 relative"],
46
- t === "vertical" && a === "enclosed" && ["bg-tabs-group-bg rounded-lg border-0 p-1 w-auto flex-col"]
42
+ "inline-flex w-full items-center justify-between",
43
+ t === "horizontal" && a === "default" && ["border-tabs-border border-b"],
44
+ t === "vertical" && a === "default" && ["border-tabs-border relative m-0 h-auto w-auto flex-col items-stretch border-r py-1"],
45
+ t === "horizontal" && a === "enclosed" && ["bg-tabs-group-bg relative rounded-lg border-0 p-1"],
46
+ t === "vertical" && a === "enclosed" && ["bg-tabs-group-bg w-auto flex-col rounded-lg border-0 p-1"]
47
47
  ),
48
48
  rightSlot: y,
49
49
  children: c.map((e) => /* @__PURE__ */ l(
@@ -54,12 +54,12 @@ const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { classN
54
54
  "aria-label": e["aria-label"],
55
55
  "aria-describedby": e["aria-describedby"],
56
56
  className: r(
57
- "relative whitespace-nowrap font-semibold transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
58
- t === "horizontal" && a === "default" && ["text-text-primary hover:text-accent py-2 px-4 hover:bg-tabs-bg--hover"],
59
- t === "vertical" && a === "default" && ["text-text-primary flex items-center h-10 px-4 py-2 data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover"],
60
- t === "horizontal" && a === "enclosed" && ["text-text-primary inline-flex items-center justify-center px-4 py-2 data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1]"],
61
- t === "vertical" && a === "enclosed" && ["text-text-primary px-4 py-2 z-[1] data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover"],
62
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:text-text-primary disabled:hover:bg-transparent"
57
+ "relative font-semibold whitespace-nowrap transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
58
+ t === "horizontal" && a === "default" && ["text-text-primary hover:text-accent hover:bg-tabs-bg--hover px-4 py-2"],
59
+ t === "vertical" && a === "default" && ["text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover flex h-10 items-center px-4 py-2"],
60
+ t === "horizontal" && a === "enclosed" && ["text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1] inline-flex items-center justify-center px-4 py-2"],
61
+ t === "vertical" && a === "enclosed" && ["text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1] px-4 py-2"],
62
+ "disabled:hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent"
63
63
  ),
64
64
  children: e.label
65
65
  },
@@ -67,7 +67,7 @@ const K = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ p("div", { classN
67
67
  ))
68
68
  }
69
69
  ),
70
- /* @__PURE__ */ l(C, { className: r(t === "vertical" && "flex-1"), children: c.map((e) => /* @__PURE__ */ l(j, { value: e.key, className: r("focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent text-text-primary", t === "horizontal" && "pb-4", t === "vertical" && "py-2 px-4"), children: e.children }, e.key)) })
70
+ /* @__PURE__ */ l(C, { className: r(t === "vertical" && "flex-1"), children: c.map((e) => /* @__PURE__ */ l(j, { value: e.key, className: r("focus-visible:outline-accent text-text-primary focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2", t === "horizontal" && "pb-4", t === "vertical" && "px-4 py-2"), children: e.children }, e.key)) })
71
71
  ] }) });
72
72
  };
73
73
  export {
@@ -1,5 +1,5 @@
1
1
  import { FormFieldState } from './utils/formFieldUtils';
2
- import { ComponentProps, FocusEvent } from 'react';
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;
@@ -17,5 +17,10 @@ export type TextareaProps = Omit<ComponentProps<'textarea'>, 'onChange'> & {
17
17
  state?: TextareaState;
18
18
  value?: string | undefined;
19
19
  };
20
- export declare const Textarea: import('react').ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
20
+ export declare const Textarea: {
21
+ ({ ref, autoComplete, className, disabled, errorMessage, id, label, labelClassName, maxLength, name, onBlur, onChange, onFocus, placeholder, required, state, value, ...props }: TextareaProps & {
22
+ ref?: Ref<HTMLTextAreaElement>;
23
+ }): import("react/jsx-runtime").JSX.Element;
24
+ displayName: string;
25
+ };
21
26
  //# sourceMappingURL=Textarea.d.ts.map