@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
package/dist/Tabs.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { TabsBase as
|
|
4
|
-
import { validateTabValues as
|
|
2
|
+
import { jsx as l, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
import { TabsBase as T, TabsList as z, TabsTrigger as k, TabsContentContainer as C, TabsContent as j } from "./Tabs/TabsBase.js";
|
|
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
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
] }),
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
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" }),
|
|
10
|
+
/* @__PURE__ */ l("span", { className: "sr-only", children: "Loading tabs…" })
|
|
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
|
+
const c = m.filter((e) => e.key !== void 0);
|
|
13
|
+
if (!V(c)) {
|
|
14
14
|
const e = new Error("Invalid tabValues provided to Tabs component");
|
|
15
|
-
return
|
|
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" }) });
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
const
|
|
20
|
-
let
|
|
21
|
-
if (i && !
|
|
17
|
+
if (n)
|
|
18
|
+
return /* @__PURE__ */ l(K, { tabCount: m.length || 3, orientation: t });
|
|
19
|
+
const u = E(c);
|
|
20
|
+
let o = i ?? u[0];
|
|
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
|
|
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" }) });
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
25
|
+
const w = async (e) => {
|
|
26
|
+
if (v && x) {
|
|
27
|
+
const N = o;
|
|
28
28
|
try {
|
|
29
|
-
if (await
|
|
30
|
-
} catch (
|
|
31
|
-
|
|
29
|
+
if (await v(e, N) === !1) return;
|
|
30
|
+
} catch (f) {
|
|
31
|
+
b?.(f instanceof Error ? f : new Error("Before change callback failed"));
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
x?.(e);
|
|
36
36
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
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: [
|
|
38
|
+
/* @__PURE__ */ l(
|
|
39
|
+
z,
|
|
40
40
|
{
|
|
41
41
|
className: r(
|
|
42
|
-
"inline-flex items-center justify-
|
|
43
|
-
t === "horizontal" &&
|
|
44
|
-
t === "vertical" &&
|
|
45
|
-
t === "horizontal" &&
|
|
46
|
-
t === "vertical" &&
|
|
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"]
|
|
47
47
|
),
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
rightSlot: y,
|
|
49
|
+
children: c.map((e) => /* @__PURE__ */ l(
|
|
50
|
+
k,
|
|
50
51
|
{
|
|
51
52
|
value: e.key,
|
|
52
53
|
disabled: e.disabled,
|
|
@@ -54,10 +55,10 @@ const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ m("div", { classN
|
|
|
54
55
|
"aria-describedby": e["aria-describedby"],
|
|
55
56
|
className: r(
|
|
56
57
|
"relative whitespace-nowrap font-semibold transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
|
|
57
|
-
t === "horizontal" &&
|
|
58
|
-
t === "vertical" &&
|
|
59
|
-
t === "horizontal" &&
|
|
60
|
-
t === "vertical" &&
|
|
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"],
|
|
61
62
|
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:text-text-primary disabled:hover:bg-transparent"
|
|
62
63
|
),
|
|
63
64
|
children: e.label
|
|
@@ -66,21 +67,14 @@ const V = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ m("div", { classN
|
|
|
66
67
|
))
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
|
|
70
|
-
k,
|
|
71
|
-
{
|
|
72
|
-
value: e.key,
|
|
73
|
-
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-8", "data-[state=active]:animate-fade-in-tabs"),
|
|
74
|
-
children: e.children
|
|
75
|
-
},
|
|
76
|
-
e.key
|
|
77
|
-
))
|
|
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)) })
|
|
78
71
|
] }) });
|
|
79
72
|
};
|
|
80
73
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
R as Tabs,
|
|
75
|
+
j as TabsContent,
|
|
76
|
+
C as TabsContentContainer,
|
|
77
|
+
z as TabsList,
|
|
78
|
+
T as TabsRoot,
|
|
79
|
+
k as TabsTrigger
|
|
86
80
|
};
|
package/dist/ToggleGroup.js
CHANGED
|
@@ -18,18 +18,18 @@ const m = w({
|
|
|
18
18
|
"data-size": e,
|
|
19
19
|
"data-layout": a,
|
|
20
20
|
className: c(
|
|
21
|
-
"group/toggle-group [&[data-variant='outline']]:bg-toggle-group-bg flex h-fit w-fit [&[data-layout='expanded']]:w-full items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md [&[data-variant='outline']]:gap-0.25",
|
|
21
|
+
"group/toggle-group [&[data-variant='outline']]:bg-toggle-group-bg flex h-fit w-fit [&[data-layout='expanded']]:w-full items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md [&[data-variant='outline']]:gap-0.25 px-2",
|
|
22
22
|
r
|
|
23
23
|
),
|
|
24
24
|
...i,
|
|
25
25
|
children: /* @__PURE__ */ s(m.Provider, { value: { variant: o, size: e, layout: a, activeColor: l, activeTextColor: d }, children: n })
|
|
26
26
|
}
|
|
27
|
-
), I = h(({ className: r, children: o, variant: e, size: a, value: l, layout: d, activeColor: n, activeTextColor: i, style: v, ...f },
|
|
28
|
-
const t = A(m), g = t.variant ?? e, u = t.size ?? a, p = t.layout ?? d,
|
|
27
|
+
), I = h(({ className: r, children: o, variant: e, size: a, value: l, layout: d, activeColor: n, activeTextColor: i, style: v, ...f }, x) => {
|
|
28
|
+
const t = A(m), g = t.variant ?? e, u = t.size ?? a, p = t.layout ?? d, y = n ?? t.activeColor, b = i ?? t.activeTextColor;
|
|
29
29
|
return /* @__PURE__ */ s(
|
|
30
30
|
C,
|
|
31
31
|
{
|
|
32
|
-
ref:
|
|
32
|
+
ref: x,
|
|
33
33
|
"data-slot": "toggle-group-item",
|
|
34
34
|
"data-testid": "spectral-toggle-group-item",
|
|
35
35
|
"data-variant": g,
|
|
@@ -45,7 +45,7 @@ const m = w({
|
|
|
45
45
|
"group data-[variant=outline]:border-togglegroup-border rounded-none shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0",
|
|
46
46
|
r
|
|
47
47
|
),
|
|
48
|
-
style: { ...z(
|
|
48
|
+
style: { ...z(y, b), ...v },
|
|
49
49
|
...f,
|
|
50
50
|
children: o
|
|
51
51
|
}
|