@spear-ai/spectral 1.4.23 → 1.4.25
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/RadioButtonGroup/RadioButtonGroupBase.d.ts +7 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +15 -14
- package/dist/RadioButtonGroup.d.ts +7 -1
- package/dist/Tabs/TabsBase.d.ts +11 -2
- package/dist/Tabs/TabsBase.js +154 -103
- package/dist/Tabs.d.ts +12 -10
- package/dist/Tabs.js +46 -52
- package/dist/ToggleGroup.js +5 -5
- package/dist/Tray.js +63 -4912
- package/dist/index-BvRlXSJj.js +4859 -0
- package/dist/styles/main.css +1 -1
- package/package.json +2 -2
|
@@ -17,5 +17,11 @@ export type RadioButtonGroupItemProps = AsChildProp & {
|
|
|
17
17
|
onSelect?: (value: string) => void;
|
|
18
18
|
};
|
|
19
19
|
export declare const RadioButtonGroupBase: ({ value, onValueChange, children, className, isKeptActive, expanded }: RadioButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare const RadioButtonGroupItem:
|
|
20
|
+
export declare const RadioButtonGroupItem: import('react').ForwardRefExoticComponent<AsChildProp & {
|
|
21
|
+
value: string;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
onSelect?: (value: string) => void;
|
|
26
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
21
27
|
//# sourceMappingURL=RadioButtonGroupBase.d.ts.map
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
3
|
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { createContext as
|
|
7
|
-
const
|
|
8
|
-
const s =
|
|
4
|
+
import { Slot as h } from "../primitives/slot.js";
|
|
5
|
+
import { cn as u } from "../utils/twUtils.js";
|
|
6
|
+
import { createContext as w, forwardRef as B, useContext as R } from "react";
|
|
7
|
+
const c = w(null), z = ({ value: t, onValueChange: n, children: i, className: o, isKeptActive: r = !1, expanded: e = !1 }) => /* @__PURE__ */ a(c.Provider, { value: { value: t, onValueChange: n, isKeptActive: r, expanded: e }, children: /* @__PURE__ */ a("div", { role: "radiogroup", "data-testid": "spectral-radio-button-group", "data-expanded": e, className: u("flex h-fit w-fit items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md", "data-[expanded=true]:w-full", o), children: i }) }), y = B(({ value: t, children: n, className: i, disabled: o = !1, asChild: r = !1, onSelect: e }, g) => {
|
|
8
|
+
const s = R(c);
|
|
9
9
|
if (!s)
|
|
10
10
|
throw new Error("RadioButtonGroupItem must be used within a RadioButtonGroup");
|
|
11
|
-
const { value:
|
|
11
|
+
const { value: f, onValueChange: d, isKeptActive: b, expanded: p } = s, l = f === t, v = () => {
|
|
12
12
|
o || (d && d(t), e && e(t));
|
|
13
|
-
},
|
|
13
|
+
}, m = r ? h : "button", x = {
|
|
14
14
|
role: "radio",
|
|
15
15
|
"aria-checked": l,
|
|
16
16
|
"data-state": l ? "on" : "off",
|
|
17
17
|
"data-testid": "spectral-radio-button-group-item",
|
|
18
18
|
disabled: o,
|
|
19
|
-
onClick:
|
|
20
|
-
className:
|
|
19
|
+
onClick: v,
|
|
20
|
+
className: u(
|
|
21
21
|
`bg-toggle-bg inline-flex items-center justify-center gap-2 border text-sm font-medium disabled:pointer-events-none disabled:opacity-50
|
|
22
22
|
disabled:cursor-not-allowed hover:cursor-pointer text-toggle-text hover:bg-toggle-bg--hover hover:text-toggle-text--hover transition-[colors]
|
|
23
23
|
[&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus:outline-none
|
|
24
24
|
outline-none border-toggle-border hover:border-toggle-border--hover h-9 px-3 min-w-9 [&_svg:not([class*='size-']):not([width]):not([height])]:size-4
|
|
25
25
|
rounded-none shadow-none focus:z-10 focus-visible:z-10 [&:not(:first-child)]:border-l-0 active:bg-toggle-bg--active active:text-toggle-text--active
|
|
26
26
|
active:border-toggle-border--active`,
|
|
27
|
-
|
|
27
|
+
p && "w-full",
|
|
28
28
|
b && "data-[state=on]:bg-toggle-bg--active data-[state=on]:text-toggle-text--active data-[state=on]:border-toggle-border--active",
|
|
29
29
|
i
|
|
30
30
|
)
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */ a(
|
|
33
|
-
};
|
|
32
|
+
return /* @__PURE__ */ a(m, { ref: g, ...!r && { type: "button" }, ...x, children: n });
|
|
33
|
+
});
|
|
34
|
+
y.displayName = "RadioButtonGroupItem";
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
z as RadioButtonGroupBase,
|
|
37
|
+
y as RadioButtonGroupItem
|
|
37
38
|
};
|
|
@@ -3,5 +3,11 @@ import { ComponentProps } from 'react';
|
|
|
3
3
|
export type RadioButtonGroupProps = ComponentProps<typeof RadioButtonGroupBase>;
|
|
4
4
|
export type RadioButtonGroupItemProps = RadioButtonGroupItemPropsBase;
|
|
5
5
|
export declare const RadioButtonGroup: ({ className, children, ...props }: RadioButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare const RadioButtonGroupItem: (
|
|
6
|
+
export declare const RadioButtonGroupItem: import('react').ForwardRefExoticComponent<import('../../primitives/slot').AsChildProp & {
|
|
7
|
+
value: string;
|
|
8
|
+
children: import('react').ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onSelect?: (value: string) => void;
|
|
12
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
7
13
|
//# sourceMappingURL=RadioButtonGroup.d.ts.map
|
package/dist/Tabs/TabsBase.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
export interface TabsContextValue {
|
|
3
|
-
onValueChange: (value: string) => void;
|
|
4
3
|
activationMode: 'automatic' | 'manual';
|
|
5
4
|
baseId: string;
|
|
6
5
|
dir: 'ltr' | 'rtl';
|
|
7
6
|
disabled: boolean;
|
|
7
|
+
onValueChange: (value: string) => void;
|
|
8
8
|
orientation: 'horizontal' | 'vertical';
|
|
9
|
+
rightSlot?: ReactNode | undefined;
|
|
9
10
|
value: string;
|
|
10
11
|
}
|
|
11
12
|
export declare const TabsContext: import('react').Context<TabsContextValue | null>;
|
|
@@ -18,11 +19,14 @@ export interface TabsBaseProps extends Omit<ComponentPropsWithoutRef<'div'>, 'di
|
|
|
18
19
|
dir?: 'ltr' | 'rtl';
|
|
19
20
|
disabled?: boolean;
|
|
20
21
|
orientation?: 'horizontal' | 'vertical';
|
|
22
|
+
rightSlot?: ReactNode | undefined;
|
|
21
23
|
value?: string;
|
|
22
24
|
}
|
|
23
25
|
export declare const TabsBase: import('react').ForwardRefExoticComponent<TabsBaseProps & import('react').RefAttributes<HTMLElement>>;
|
|
24
|
-
export interface TabsListProps extends ComponentPropsWithoutRef<'div'> {
|
|
26
|
+
export interface TabsListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
27
|
+
children?: ReactNode;
|
|
25
28
|
loop?: boolean;
|
|
29
|
+
rightSlot?: ReactNode | undefined;
|
|
26
30
|
}
|
|
27
31
|
export declare const TabsList: import('react').ForwardRefExoticComponent<TabsListProps & import('react').RefAttributes<HTMLElement>>;
|
|
28
32
|
export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
|
|
@@ -30,6 +34,11 @@ export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
|
|
|
30
34
|
disabled?: boolean;
|
|
31
35
|
}
|
|
32
36
|
export declare const TabsTrigger: import('react').ForwardRefExoticComponent<TabsTriggerProps & import('react').RefAttributes<HTMLElement>>;
|
|
37
|
+
export interface TabsContentContainerProps {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const TabsContentContainer: import('react').ForwardRefExoticComponent<TabsContentContainerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
33
42
|
export interface TabsContentProps extends ComponentPropsWithoutRef<'div'> {
|
|
34
43
|
value: string;
|
|
35
44
|
forceMount?: boolean;
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -1,164 +1,215 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { generateId as
|
|
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";
|
|
5
5
|
import { cn as y } from "../utils/twUtils.js";
|
|
6
|
-
import { createContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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(_);
|
|
10
|
+
if (l === null)
|
|
11
|
+
throw new Error(`${x} components must be used within a Tabs.Root`);
|
|
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(
|
|
15
|
+
(s) => {
|
|
16
|
+
u || (i || w(s), f?.(s));
|
|
16
17
|
},
|
|
17
|
-
[
|
|
18
|
-
),
|
|
19
|
-
|
|
18
|
+
[i, f, u]
|
|
19
|
+
), c = {
|
|
20
|
+
activationMode: l,
|
|
21
|
+
baseId: C,
|
|
22
|
+
dir: d,
|
|
23
|
+
disabled: u,
|
|
20
24
|
onValueChange: n,
|
|
21
25
|
orientation: o,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
disabled: l,
|
|
25
|
-
baseId: d
|
|
26
|
+
rightSlot: v,
|
|
27
|
+
value: e
|
|
26
28
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
}),
|
|
29
|
-
const { orientation:
|
|
30
|
-
left: 0,
|
|
31
|
-
top: 0,
|
|
32
|
-
width: 0,
|
|
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(() => ({
|
|
33
32
|
height: 0,
|
|
33
|
+
isEnclosed: !1,
|
|
34
|
+
left: 0,
|
|
34
35
|
orientation: "horizontal",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
top: 0,
|
|
37
|
+
width: 0
|
|
38
|
+
})), p = O(null), g = $(), w = T(
|
|
39
|
+
K(() => {
|
|
40
|
+
const i = S(p);
|
|
41
|
+
b(i);
|
|
40
42
|
}, 16),
|
|
41
43
|
// ~60fps
|
|
42
44
|
[]
|
|
43
45
|
);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
return
|
|
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, {
|
|
48
50
|
attributes: !0,
|
|
49
51
|
childList: !0,
|
|
50
52
|
subtree: !0
|
|
51
53
|
})), () => {
|
|
52
|
-
|
|
54
|
+
i.disconnect(), e.disconnect();
|
|
53
55
|
};
|
|
54
|
-
}, [
|
|
55
|
-
const
|
|
56
|
-
(
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
let
|
|
63
|
-
const { key:
|
|
64
|
-
|
|
56
|
+
}, [w]);
|
|
57
|
+
const C = T(
|
|
58
|
+
(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);
|
|
63
|
+
if (n === -1) return;
|
|
64
|
+
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());
|
|
65
67
|
},
|
|
66
|
-
[
|
|
68
|
+
[v, o, r]
|
|
67
69
|
);
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
70
|
+
return /* @__PURE__ */ E("div", { className: "relative", ref: p, children: [
|
|
71
|
+
/* @__PURE__ */ E(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
ref: f,
|
|
75
|
+
role: "tablist",
|
|
76
|
+
"data-testid": "spectral-tabs-list",
|
|
77
|
+
"aria-orientation": o,
|
|
78
|
+
"aria-disabled": v,
|
|
79
|
+
className: y("tabs-list flex", o === "horizontal" && "items-center justify-between", o === "vertical" && "flex-col", a),
|
|
80
|
+
onKeyDown: C,
|
|
81
|
+
...u,
|
|
82
|
+
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 })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ m(
|
|
71
89
|
"div",
|
|
72
90
|
{
|
|
73
91
|
className: y(
|
|
74
92
|
"absolute pointer-events-none select-none",
|
|
75
|
-
!
|
|
76
|
-
|
|
77
|
-
|
|
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 && [
|
|
78
96
|
"right-[1px]",
|
|
79
|
-
!
|
|
97
|
+
!g && "transition-[top_300ms_ease,height_300ms_ease]",
|
|
80
98
|
"after:content-[''] after:absolute after:right-0 after:top-0 after:h-full after:w-1",
|
|
81
99
|
"after:border-r-[0.3rem] after:border-tabs-indicator after:rounded-l-[0.3rem] z-10"
|
|
82
100
|
],
|
|
83
|
-
|
|
84
|
-
|
|
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"]
|
|
85
103
|
),
|
|
86
104
|
style: {
|
|
87
|
-
...
|
|
88
|
-
...
|
|
105
|
+
...P(t),
|
|
106
|
+
...t.isEnclosed && t.orientation === "vertical" ? { height: "40px" } : {}
|
|
89
107
|
},
|
|
90
108
|
"aria-hidden": "true"
|
|
91
109
|
}
|
|
92
110
|
)
|
|
93
111
|
] });
|
|
94
|
-
}),
|
|
95
|
-
const { value: v, onValueChange:
|
|
96
|
-
(
|
|
97
|
-
if (
|
|
98
|
-
|
|
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(
|
|
114
|
+
(h) => {
|
|
115
|
+
if (e) {
|
|
116
|
+
h.preventDefault();
|
|
99
117
|
return;
|
|
100
118
|
}
|
|
101
|
-
|
|
119
|
+
t(a), r?.(h);
|
|
102
120
|
},
|
|
103
|
-
[
|
|
104
|
-
),
|
|
105
|
-
(
|
|
106
|
-
if (
|
|
107
|
-
|
|
121
|
+
[a, t, r, e]
|
|
122
|
+
), c = T(
|
|
123
|
+
(h) => {
|
|
124
|
+
if (e) {
|
|
125
|
+
h.preventDefault();
|
|
108
126
|
return;
|
|
109
127
|
}
|
|
110
|
-
const { key:
|
|
111
|
-
(
|
|
128
|
+
const { key: z } = h;
|
|
129
|
+
(z === "Enter" || z === " ") && (h.preventDefault(), h.stopPropagation(), t(a)), d?.(h);
|
|
112
130
|
},
|
|
113
|
-
[
|
|
114
|
-
),
|
|
115
|
-
|
|
116
|
-
}, [
|
|
117
|
-
return /* @__PURE__ */
|
|
131
|
+
[a, t, d, e]
|
|
132
|
+
), s = T(() => {
|
|
133
|
+
e || b === "automatic" && t(a);
|
|
134
|
+
}, [b, t, a, e]);
|
|
135
|
+
return /* @__PURE__ */ m(
|
|
118
136
|
"button",
|
|
119
137
|
{
|
|
120
|
-
"aria-controls":
|
|
121
|
-
"aria-disabled":
|
|
122
|
-
"aria-selected":
|
|
123
|
-
className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",
|
|
124
|
-
"data-disabled":
|
|
125
|
-
"data-state":
|
|
138
|
+
"aria-controls": C,
|
|
139
|
+
"aria-disabled": e,
|
|
140
|
+
"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,
|
|
143
|
+
"data-state": i ? "active" : "inactive",
|
|
126
144
|
"data-testid": "spectral-tabs-trigger",
|
|
127
|
-
disabled:
|
|
128
|
-
id:
|
|
129
|
-
onClick:
|
|
130
|
-
onFocus:
|
|
131
|
-
onKeyDown:
|
|
145
|
+
disabled: e,
|
|
146
|
+
id: w,
|
|
147
|
+
onClick: n,
|
|
148
|
+
onFocus: s,
|
|
149
|
+
onKeyDown: c,
|
|
132
150
|
ref: o,
|
|
133
151
|
role: "tab",
|
|
134
|
-
tabIndex:
|
|
152
|
+
tabIndex: i ? 0 : -1,
|
|
135
153
|
type: "button",
|
|
136
154
|
...f
|
|
137
155
|
}
|
|
138
156
|
);
|
|
139
|
-
}),
|
|
140
|
-
const { value:
|
|
141
|
-
return
|
|
157
|
+
}), V = I(function({ children: l, className: a }, r) {
|
|
158
|
+
const { value: d } = D("TabsContentContainer"), [u, f] = q(), o = $();
|
|
159
|
+
return /* @__PURE__ */ m(
|
|
160
|
+
R.div,
|
|
161
|
+
{
|
|
162
|
+
ref: r,
|
|
163
|
+
className: y("overflow-hidden", a),
|
|
164
|
+
"data-testid": "spectral-tabs-content-container",
|
|
165
|
+
animate: {
|
|
166
|
+
height: f.height || "auto"
|
|
167
|
+
},
|
|
168
|
+
transition: o ? { duration: 0 } : {
|
|
169
|
+
duration: 0.3,
|
|
170
|
+
ease: [0.25, 1, 0.5, 1]
|
|
171
|
+
},
|
|
172
|
+
children: /* @__PURE__ */ m(B, { mode: "wait", initial: !1, children: /* @__PURE__ */ m(
|
|
173
|
+
R.div,
|
|
174
|
+
{
|
|
175
|
+
ref: u,
|
|
176
|
+
initial: o ? !1 : { opacity: 0, y: 8 },
|
|
177
|
+
animate: { opacity: 1, y: 0 },
|
|
178
|
+
exit: o ? void 0 : { opacity: 0, y: -8 },
|
|
179
|
+
transition: o ? { duration: 0 } : {
|
|
180
|
+
duration: 0.2,
|
|
181
|
+
ease: [0.25, 1, 0.5, 1]
|
|
182
|
+
},
|
|
183
|
+
children: l
|
|
184
|
+
},
|
|
185
|
+
d
|
|
186
|
+
) })
|
|
187
|
+
}
|
|
188
|
+
);
|
|
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(
|
|
142
192
|
"div",
|
|
143
193
|
{
|
|
144
|
-
"aria-labelledby":
|
|
145
|
-
className: y("tabs-content focus:outline-none focus-visible:outline-none",
|
|
146
|
-
"data-state":
|
|
194
|
+
"aria-labelledby": t,
|
|
195
|
+
className: y("tabs-content focus:outline-none focus-visible:outline-none", l),
|
|
196
|
+
"data-state": b ? "active" : "inactive",
|
|
147
197
|
"data-testid": "spectral-tabs-content",
|
|
148
|
-
hidden: !
|
|
198
|
+
hidden: !b,
|
|
149
199
|
id: v,
|
|
150
|
-
ref:
|
|
200
|
+
ref: u,
|
|
151
201
|
role: "tabpanel",
|
|
152
202
|
tabIndex: 0,
|
|
153
|
-
...
|
|
203
|
+
...d
|
|
154
204
|
}
|
|
155
205
|
);
|
|
156
206
|
});
|
|
157
207
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
208
|
+
X as TabsBase,
|
|
209
|
+
tt as TabsContent,
|
|
210
|
+
V as TabsContentContainer,
|
|
211
|
+
_ as TabsContext,
|
|
212
|
+
Y as TabsList,
|
|
213
|
+
Z as TabsTrigger,
|
|
214
|
+
D as useTabsContext
|
|
164
215
|
};
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { TabsBase, TabsContent, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
|
|
2
|
-
import {
|
|
1
|
+
import { TabsBase, TabsContent, TabsContentContainer, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
export interface TabValue {
|
|
4
|
-
key: string | undefined;
|
|
5
|
-
label: ReactNode;
|
|
6
4
|
children: ReactNode;
|
|
7
5
|
disabled?: boolean | undefined;
|
|
6
|
+
key: string | undefined;
|
|
7
|
+
label: ReactNode;
|
|
8
8
|
'aria-label'?: string | undefined;
|
|
9
9
|
'aria-describedby'?: string | undefined;
|
|
10
10
|
}
|
|
11
11
|
export interface TabsProps extends Omit<TabsBaseProps, 'children' | 'defaultValue' | 'onError' | 'disabled'> {
|
|
12
|
-
|
|
13
|
-
onError?: (error: Error) => void | ReactEventHandler<HTMLDivElement> | undefined;
|
|
12
|
+
activationMode?: 'automatic' | 'manual' | undefined;
|
|
14
13
|
ariaLabel?: string | undefined;
|
|
15
14
|
className?: string | undefined;
|
|
15
|
+
onBeforeChange?: (newValue: string, oldValue: string) => boolean | Promise<boolean> | undefined;
|
|
16
|
+
onError?: ((error: Error) => void) | undefined;
|
|
17
|
+
loading?: boolean | undefined;
|
|
16
18
|
openOnLoad?: string | undefined;
|
|
19
|
+
rightSlot?: ReactNode | undefined;
|
|
17
20
|
tabValues: TabValue[] | undefined;
|
|
18
21
|
variant?: 'enclosed' | 'default';
|
|
19
|
-
loading?: boolean | undefined;
|
|
20
22
|
}
|
|
21
|
-
export declare const Tabs: ({ ariaLabel, className,
|
|
22
|
-
export { TabsContent, TabsList, TabsBase as TabsRoot, TabsTrigger };
|
|
23
|
-
export type { TabsBaseProps, TabsContentProps, TabsListProps, TabsTriggerProps } from './TabsBase';
|
|
23
|
+
export declare const Tabs: ({ activationMode, ariaLabel, className, loading, onBeforeChange, onError, onValueChange, openOnLoad, orientation, rightSlot, tabValues, variant, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export { TabsContent, TabsContentContainer, TabsList, TabsBase as TabsRoot, TabsTrigger };
|
|
25
|
+
export type { TabsBaseProps, TabsContentContainerProps, TabsContentProps, TabsListProps, TabsTriggerProps } from './TabsBase';
|
|
24
26
|
export type TabKeys<T extends TabValue[]> = T[number]['key'];
|
|
25
27
|
export type TabValueWithKey<TKey extends string> = TabValue & {
|
|
26
28
|
key: TKey;
|