@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.
- package/dist/Accordion.d.ts +28 -9
- package/dist/Accordion.js +203 -183
- package/dist/Alert/AlertBase.d.ts +24 -16
- package/dist/Alert/AlertBase.js +33 -18
- package/dist/Alert.js +1 -1
- package/dist/Avatar.js +11 -11
- package/dist/Button.d.ts +7 -2
- package/dist/Button.js +25 -12
- package/dist/ButtonIcon.d.ts +7 -2
- package/dist/ButtonIcon.js +25 -16
- package/dist/Card.js +1 -1
- package/dist/Checkbox/CheckboxBase.d.ts +13 -13
- package/dist/Checkbox/CheckboxBase.js +128 -125
- package/dist/Checkbox.d.ts +7 -2
- package/dist/Checkbox.js +29 -22
- package/dist/DataCard.js +3 -3
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +2 -2
- package/dist/HoverCard.js +1 -1
- package/dist/Icons/AnalyzeIcon.d.ts +3 -1
- package/dist/Icons/AnalyzeIcon.js +3 -6
- package/dist/Icons/AnnotationsIcon.d.ts +3 -1
- package/dist/Icons/AnnotationsIcon.js +3 -6
- package/dist/Icons/ApprovedIcon.d.ts +3 -1
- package/dist/Icons/ApprovedIcon.js +3 -6
- package/dist/Icons/ArrowDownIcon.d.ts +3 -1
- package/dist/Icons/ArrowDownIcon.js +3 -6
- package/dist/Icons/ArrowUpIcon.d.ts +3 -1
- package/dist/Icons/ArrowUpIcon.js +4 -7
- package/dist/Icons/CalendarIcon.d.ts +3 -1
- package/dist/Icons/CalendarIcon.js +9 -12
- package/dist/Icons/CheckCircleIcon.d.ts +3 -1
- package/dist/Icons/CheckCircleIcon.js +2 -5
- package/dist/Icons/CheckSquareIcon.d.ts +3 -1
- package/dist/Icons/CheckSquareIcon.js +4 -7
- package/dist/Icons/CheckmarkIcon.d.ts +3 -1
- package/dist/Icons/CheckmarkIcon.js +5 -8
- package/dist/Icons/ChevronDownIcon.d.ts +3 -1
- package/dist/Icons/ChevronDownIcon.js +5 -8
- package/dist/Icons/ChevronUpIcon.d.ts +3 -1
- package/dist/Icons/ChevronUpIcon.js +5 -8
- package/dist/Icons/ClockIcon.d.ts +3 -1
- package/dist/Icons/ClockIcon.js +5 -8
- package/dist/Icons/CloseCircleIcon.d.ts +3 -1
- package/dist/Icons/CloseCircleIcon.js +4 -7
- package/dist/Icons/CloseIcon.d.ts +3 -1
- package/dist/Icons/CloseIcon.js +5 -8
- package/dist/Icons/DashboardIcon.d.ts +3 -1
- package/dist/Icons/DashboardIcon.js +3 -6
- package/dist/Icons/DatabaseIcon.d.ts +3 -1
- package/dist/Icons/DatabaseIcon.js +4 -7
- package/dist/Icons/DeleteIcon.d.ts +3 -1
- package/dist/Icons/DeleteIcon.js +4 -7
- package/dist/Icons/DurationIcon.d.ts +3 -1
- package/dist/Icons/DurationIcon.js +3 -6
- package/dist/Icons/EditIcon.d.ts +3 -1
- package/dist/Icons/EditIcon.js +3 -6
- package/dist/Icons/EmailIcon.d.ts +3 -1
- package/dist/Icons/EmailIcon.js +4 -7
- package/dist/Icons/EraserIcon.d.ts +3 -1
- package/dist/Icons/EraserIcon.js +9 -10
- package/dist/Icons/ErrorIcon.d.ts +3 -1
- package/dist/Icons/ErrorIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon2.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon2.js +3 -6
- package/dist/Icons/EyeOpenIcon.d.ts +3 -1
- package/dist/Icons/EyeOpenIcon.js +6 -9
- package/dist/Icons/GoToFirstIcon.d.ts +3 -1
- package/dist/Icons/GoToFirstIcon.js +4 -7
- package/dist/Icons/GoToLastIcon.d.ts +3 -1
- package/dist/Icons/GoToLastIcon.js +4 -7
- package/dist/Icons/HarmonicCursorsIcon.d.ts +3 -1
- package/dist/Icons/HarmonicCursorsIcon.js +4 -7
- package/dist/Icons/IconBase.d.ts +4 -2
- package/dist/Icons/IconBase.js +17 -8
- package/dist/Icons/InfoIcon.d.ts +3 -1
- package/dist/Icons/InfoIcon.js +4 -7
- package/dist/Icons/LabelIcon.d.ts +3 -1
- package/dist/Icons/LabelIcon.js +3 -6
- package/dist/Icons/LassoIcon.d.ts +3 -1
- package/dist/Icons/LassoIcon.js +5 -8
- package/dist/Icons/LineToolIcon.d.ts +3 -1
- package/dist/Icons/LineToolIcon.js +3 -6
- package/dist/Icons/LineToolIcon2.d.ts +3 -1
- package/dist/Icons/LineToolIcon2.js +3 -6
- package/dist/Icons/LiveViewIcon.d.ts +3 -1
- package/dist/Icons/LiveViewIcon.js +2 -5
- package/dist/Icons/LoaderIcon.d.ts +3 -1
- package/dist/Icons/LoaderIcon.js +6 -7
- package/dist/Icons/LocationIcon.d.ts +3 -1
- package/dist/Icons/LocationIcon.js +3 -6
- package/dist/Icons/LogoutIcon.d.ts +3 -1
- package/dist/Icons/LogoutIcon.js +4 -7
- package/dist/Icons/MessagesIcon.d.ts +3 -1
- package/dist/Icons/MessagesIcon.js +5 -8
- package/dist/Icons/MetadataIcon.d.ts +3 -1
- package/dist/Icons/MetadataIcon.js +4 -7
- package/dist/Icons/MinusIcon.d.ts +3 -1
- package/dist/Icons/MinusIcon.js +3 -6
- package/dist/Icons/OntologyIcon.d.ts +3 -1
- package/dist/Icons/OntologyIcon.js +2 -5
- package/dist/Icons/PanelIconClose.d.ts +3 -1
- package/dist/Icons/PanelIconClose.js +4 -7
- package/dist/Icons/PanelIconOpen.d.ts +3 -1
- package/dist/Icons/PanelIconOpen.js +8 -11
- package/dist/Icons/PlayIcon.d.ts +3 -1
- package/dist/Icons/PlayIcon.js +3 -6
- package/dist/Icons/PlusIcon.d.ts +3 -1
- package/dist/Icons/PlusIcon.js +4 -7
- package/dist/Icons/ResetIcon.d.ts +3 -1
- package/dist/Icons/ResetIcon.js +4 -7
- package/dist/Icons/ReviewedIcon.d.ts +3 -1
- package/dist/Icons/ReviewedIcon.js +3 -6
- package/dist/Icons/ScissorsIcon.d.ts +3 -1
- package/dist/Icons/ScissorsIcon.js +6 -9
- package/dist/Icons/SettingsIcon.d.ts +3 -1
- package/dist/Icons/SettingsIcon.js +3 -6
- package/dist/Icons/SortAscendingIcon.d.ts +3 -1
- package/dist/Icons/SortAscendingIcon.js +3 -6
- package/dist/Icons/SortAtoZIcon.d.ts +3 -1
- package/dist/Icons/SortAtoZIcon.js +3 -6
- package/dist/Icons/SortDescendingIcon.d.ts +3 -1
- package/dist/Icons/SortDescendingIcon.js +3 -6
- package/dist/Icons/SortZtoAIcon.d.ts +3 -1
- package/dist/Icons/SortZtoAIcon.js +3 -6
- package/dist/Icons/StackIcon.d.ts +3 -1
- package/dist/Icons/StackIcon.js +4 -7
- package/dist/Icons/StarIcon.d.ts +3 -1
- package/dist/Icons/StarIcon.js +3 -6
- package/dist/Icons/TrashIcon.d.ts +3 -1
- package/dist/Icons/TrashIcon.js +3 -6
- package/dist/Icons/UndoIcon.d.ts +3 -1
- package/dist/Icons/UndoIcon.js +4 -7
- package/dist/Icons/UserIcon.d.ts +3 -1
- package/dist/Icons/UserIcon.js +3 -6
- package/dist/Icons/WarningIcon.d.ts +3 -1
- package/dist/Icons/WarningIcon.js +5 -8
- package/dist/Icons/ZoomAllIcon.d.ts +3 -1
- package/dist/Icons/ZoomAllIcon.js +3 -6
- package/dist/Icons/ZoomXIcon.d.ts +3 -1
- package/dist/Icons/ZoomXIcon.js +4 -7
- package/dist/Icons/ZoomYIcon.d.ts +3 -1
- package/dist/Icons/ZoomYIcon.js +4 -7
- package/dist/Input/InputUtils.d.ts +4 -4
- package/dist/Input/InputUtils.js +1 -1
- package/dist/Input.d.ts +7 -17
- package/dist/Input.js +105 -101
- package/dist/InputOTP.d.ts +27 -7
- package/dist/InputOTP.js +171 -146
- package/dist/Label.d.ts +7 -2
- package/dist/Label.js +12 -9
- package/dist/MultiSelect/MultiSelectBase.d.ts +7 -2
- package/dist/MultiSelect/MultiSelectBase.js +212 -213
- package/dist/{MultiSelect/MutiSelect.d.ts → MultiSelect.d.ts} +8 -2
- package/dist/MultiSelect.js +27 -0
- package/dist/Popover.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +20 -14
- package/dist/RadioGroup.js +177 -148
- package/dist/Select.d.ts +7 -2
- package/dist/Select.js +108 -109
- package/dist/Separator.d.ts +8 -8
- package/dist/Separator.js +14 -15
- package/dist/Switch/SwitchBase.d.ts +13 -11
- package/dist/Switch/SwitchBase.js +84 -61
- package/dist/Switch.d.ts +11 -4
- package/dist/Switch.js +19 -20
- package/dist/Tabs/TabsBase.d.ts +16 -6
- package/dist/Tabs/TabsBase.js +133 -96
- package/dist/Tabs/tabsUtils.d.ts +6 -2
- package/dist/Tabs/tabsUtils.js +5 -2
- package/dist/Tabs.js +18 -18
- package/dist/Textarea.d.ts +7 -2
- package/dist/Textarea.js +78 -61
- package/dist/Toggle/ToggleBase.d.ts +4 -8
- package/dist/Toggle/ToggleBase.js +29 -16
- package/dist/Toggle.d.ts +4 -2
- package/dist/Toggle.js +23 -13
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +4 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +82 -73
- package/dist/ToggleGroup.d.ts +7 -2
- package/dist/ToggleGroup.js +31 -19
- package/dist/Tray.d.ts +47 -15
- package/dist/Tray.js +98 -60
- package/dist/hooks/useAccordionAutoScroll.d.ts +1 -1
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +35 -34
- package/dist/{index-BSCg4Mei.js → index-B0Kp8R0j.js} +3 -3
- package/dist/{index-jgQ7sgLl.js → index-D4jMMaAi.js} +5 -5
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -4
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +4 -11
- package/dist/primitives/slot.d.ts +11 -4
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +32 -28
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +1 -3
- package/dist/utils/formFieldUtils.js +2 -2
- package/package.json +1 -1
- package/dist/MultiSelect/MutiSelect.js +0 -19
package/dist/Tabs/TabsBase.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -1,87 +1,106 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as m, jsxs as
|
|
4
|
-
import { generateId as
|
|
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
|
|
7
|
-
import { j as q, m as
|
|
8
|
-
const
|
|
9
|
-
const l =
|
|
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 =
|
|
14
|
-
|
|
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 ||
|
|
28
|
+
u || (i || p(s), o?.(s));
|
|
17
29
|
},
|
|
18
|
-
[i,
|
|
30
|
+
[i, o, u]
|
|
19
31
|
), c = {
|
|
20
|
-
activationMode:
|
|
21
|
-
baseId:
|
|
32
|
+
activationMode: v,
|
|
33
|
+
baseId: T,
|
|
22
34
|
dir: d,
|
|
23
35
|
disabled: u,
|
|
24
36
|
onValueChange: n,
|
|
25
|
-
orientation:
|
|
26
|
-
rightSlot:
|
|
27
|
-
value:
|
|
37
|
+
orientation: b,
|
|
38
|
+
rightSlot: e,
|
|
39
|
+
value: t
|
|
28
40
|
};
|
|
29
|
-
return /* @__PURE__ */ m(
|
|
30
|
-
}
|
|
31
|
-
|
|
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
|
-
})),
|
|
39
|
-
|
|
40
|
-
const i =
|
|
41
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
const i = new ResizeObserver(
|
|
49
|
-
return n && (i.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(),
|
|
73
|
+
i.disconnect(), t.disconnect(), p.cancel();
|
|
55
74
|
};
|
|
56
|
-
}, [
|
|
57
|
-
const
|
|
75
|
+
}, [p]);
|
|
76
|
+
const T = C(
|
|
58
77
|
(i) => {
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const n =
|
|
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:
|
|
66
|
-
o === "horizontal" ? s === "ArrowLeft" || s === "ArrowUp" &&
|
|
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
|
-
[
|
|
87
|
+
[b, o, r]
|
|
69
88
|
);
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ D("div", { className: "relative", ref: g, children: [
|
|
90
|
+
/* @__PURE__ */ D(
|
|
72
91
|
"div",
|
|
73
92
|
{
|
|
74
|
-
ref:
|
|
93
|
+
ref: l,
|
|
75
94
|
role: "tablist",
|
|
76
95
|
"data-testid": "spectral-tabs-list",
|
|
77
96
|
"aria-orientation": o,
|
|
78
|
-
"aria-disabled":
|
|
97
|
+
"aria-disabled": b,
|
|
79
98
|
className: y("tabs-list flex", o === "horizontal" && "items-center justify-between", o === "vertical" && "flex-col", a),
|
|
80
|
-
onKeyDown:
|
|
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:
|
|
84
|
-
d && /* @__PURE__ */ m("div", { className: "flex items-center
|
|
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
|
-
"
|
|
93
|
-
!
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
!
|
|
98
|
-
"after:
|
|
99
|
-
"after:border-
|
|
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
|
-
|
|
102
|
-
|
|
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
|
-
...
|
|
106
|
-
...
|
|
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
|
-
}
|
|
113
|
-
|
|
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 (
|
|
142
|
+
if (t) {
|
|
116
143
|
h.preventDefault();
|
|
117
144
|
return;
|
|
118
145
|
}
|
|
119
|
-
|
|
146
|
+
e(a), r?.(h);
|
|
120
147
|
},
|
|
121
|
-
[a,
|
|
122
|
-
), c =
|
|
148
|
+
[a, e, r, t]
|
|
149
|
+
), c = C(
|
|
123
150
|
(h) => {
|
|
124
|
-
if (
|
|
151
|
+
if (t) {
|
|
125
152
|
h.preventDefault();
|
|
126
153
|
return;
|
|
127
154
|
}
|
|
128
|
-
const { key:
|
|
129
|
-
(
|
|
155
|
+
const { key: I } = h;
|
|
156
|
+
(I === "Enter" || I === " ") && (h.preventDefault(), h.stopPropagation(), e(a)), d?.(h);
|
|
130
157
|
},
|
|
131
|
-
[a,
|
|
132
|
-
), s =
|
|
133
|
-
|
|
134
|
-
}, [
|
|
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":
|
|
139
|
-
"aria-disabled":
|
|
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",
|
|
142
|
-
"data-disabled":
|
|
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:
|
|
146
|
-
id:
|
|
172
|
+
disabled: t,
|
|
173
|
+
id: p,
|
|
147
174
|
onClick: n,
|
|
148
175
|
onFocus: s,
|
|
149
176
|
onKeyDown: c,
|
|
150
|
-
ref:
|
|
177
|
+
ref: l,
|
|
151
178
|
role: "tab",
|
|
152
179
|
tabIndex: i ? 0 : -1,
|
|
153
180
|
type: "button",
|
|
154
|
-
...
|
|
181
|
+
...o
|
|
155
182
|
}
|
|
156
183
|
);
|
|
157
|
-
}
|
|
158
|
-
|
|
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
|
-
|
|
191
|
+
E.div,
|
|
161
192
|
{
|
|
162
|
-
ref:
|
|
193
|
+
ref: l,
|
|
163
194
|
className: y("overflow-hidden", a),
|
|
164
195
|
"data-testid": "spectral-tabs-content-container",
|
|
165
196
|
animate: {
|
|
166
|
-
height:
|
|
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
|
-
|
|
204
|
+
E.div,
|
|
174
205
|
{
|
|
175
|
-
ref:
|
|
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:
|
|
214
|
+
children: v
|
|
184
215
|
},
|
|
185
|
-
|
|
216
|
+
r
|
|
186
217
|
) })
|
|
187
218
|
}
|
|
188
219
|
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
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":
|
|
195
|
-
className: y("tabs-content focus:outline-none focus-visible:outline-none",
|
|
196
|
-
"data-state":
|
|
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: !
|
|
199
|
-
id:
|
|
200
|
-
ref:
|
|
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
|
-
|
|
248
|
+
N as TabsContext,
|
|
212
249
|
Y as TabsList,
|
|
213
250
|
Z as TabsTrigger,
|
|
214
|
-
|
|
251
|
+
A as useTabsContext
|
|
215
252
|
};
|
package/dist/Tabs/tabsUtils.d.ts
CHANGED
|
@@ -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
|
|
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
|
*/
|
package/dist/Tabs/tabsUtils.js
CHANGED
|
@@ -28,11 +28,14 @@ const s = (e) => {
|
|
|
28
28
|
height: `${e.height}px`
|
|
29
29
|
}, d = (e, n) => {
|
|
30
30
|
let t = null;
|
|
31
|
-
|
|
31
|
+
const r = (...o) => {
|
|
32
32
|
t !== null && clearTimeout(t), t = setTimeout(() => {
|
|
33
|
-
e(...
|
|
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: "
|
|
8
|
-
/* @__PURE__ */ l("div", { className: r("inline-flex items-center justify-start
|
|
9
|
-
/* @__PURE__ */ l("div", { className: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
43
|
-
t === "horizontal" && a === "default" && ["border-
|
|
44
|
-
t === "vertical" && a === "default" && ["
|
|
45
|
-
t === "horizontal" && a === "enclosed" && ["bg-tabs-group-bg
|
|
46
|
-
t === "vertical" && a === "enclosed" && ["bg-tabs-group-bg rounded-lg border-0 p-1
|
|
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
|
|
58
|
-
t === "horizontal" && a === "default" && ["text-text-primary hover:text-accent
|
|
59
|
-
t === "vertical" && a === "default" && ["text-text-primary
|
|
60
|
-
t === "horizontal" && a === "enclosed" && ["text-text-primary
|
|
61
|
-
t === "vertical" && a === "enclosed" && ["text-text-primary
|
|
62
|
-
"disabled:
|
|
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-
|
|
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 {
|
package/dist/Textarea.d.ts
CHANGED
|
@@ -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:
|
|
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
|