@spear-ai/spectral 1.4.3 → 1.4.5
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/Alert/AlertBase.js +5 -5
- package/dist/Button.js +3 -3
- package/dist/ButtonGroup.js +6 -6
- package/dist/Card.d.ts +2 -7
- package/dist/Card.js +7 -18
- package/dist/DataCard.d.ts +11 -0
- package/dist/DataCard.js +18 -0
- package/dist/Select.d.ts +1 -1
- package/dist/Select.js +54 -54
- package/dist/Slider.js +26 -17
- package/dist/Switch.js +8 -8
- package/dist/Tabs/TabsBase.js +18 -18
- package/dist/Tabs/tabsUtils.js +31 -30
- package/dist/Textarea.js +2 -2
- package/dist/styles/base-colors.css +12 -12
- package/dist/styles/main.css +1 -1
- package/package.json +1 -1
- package/dist/Slider/SliderBase.d.ts +0 -54
- package/dist/Slider/SliderBase.js +0 -256
- package/dist/Tooltip/TooltipBase.d.ts +0 -51
- package/dist/Tooltip/TooltipBase.js +0 -186
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -24,7 +24,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
24
24
|
disabled: l,
|
|
25
25
|
baseId: d
|
|
26
26
|
};
|
|
27
|
-
return /* @__PURE__ */ x(E.Provider, { value: r, children: /* @__PURE__ */ x("div", { ref: c, "data-testid": "spectral-tabs
|
|
27
|
+
return /* @__PURE__ */ x(E.Provider, { value: r, children: /* @__PURE__ */ x("div", { ref: c, "data-testid": "spectral-tabs", "data-orientation": o, "data-disabled": l ? "" : void 0, dir: b, ...s, children: e }) });
|
|
28
28
|
}), H = z(function({ className: u, loop: e = !0, ...h }, b) {
|
|
29
29
|
const { orientation: l, disabled: f } = C("TabsList"), [o, v] = D(() => ({
|
|
30
30
|
left: 0,
|
|
@@ -117,22 +117,22 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
117
117
|
return /* @__PURE__ */ x(
|
|
118
118
|
"button",
|
|
119
119
|
{
|
|
120
|
-
ref: o,
|
|
121
|
-
role: "tab",
|
|
122
|
-
type: "button",
|
|
123
|
-
"data-testid": "spectral-tabs-trigger",
|
|
124
|
-
id: d,
|
|
125
120
|
"aria-controls": a,
|
|
126
|
-
"aria-selected": t,
|
|
127
121
|
"aria-disabled": n,
|
|
128
|
-
|
|
129
|
-
"data-state": t ? "active" : "inactive",
|
|
130
|
-
"data-disabled": n ? "" : void 0,
|
|
131
|
-
tabIndex: t ? 0 : -1,
|
|
122
|
+
"aria-selected": t,
|
|
132
123
|
className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", u),
|
|
124
|
+
"data-disabled": n ? "" : void 0,
|
|
125
|
+
"data-state": t ? "active" : "inactive",
|
|
126
|
+
"data-testid": "spectral-tabs-trigger",
|
|
127
|
+
disabled: n,
|
|
128
|
+
id: d,
|
|
133
129
|
onClick: r,
|
|
134
|
-
onKeyDown: p,
|
|
135
130
|
onFocus: A,
|
|
131
|
+
onKeyDown: p,
|
|
132
|
+
ref: o,
|
|
133
|
+
role: "tab",
|
|
134
|
+
tabIndex: t ? 0 : -1,
|
|
135
|
+
type: "button",
|
|
136
136
|
...f
|
|
137
137
|
}
|
|
138
138
|
);
|
|
@@ -141,15 +141,15 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
141
141
|
return !h && !c ? null : /* @__PURE__ */ x(
|
|
142
142
|
"div",
|
|
143
143
|
{
|
|
144
|
-
ref: l,
|
|
145
|
-
role: "tabpanel",
|
|
146
|
-
"data-testid": "spectral-tabs-content",
|
|
147
|
-
id: v,
|
|
148
144
|
"aria-labelledby": s,
|
|
149
|
-
"data-state": c ? "active" : "inactive",
|
|
150
|
-
tabIndex: 0,
|
|
151
145
|
className: y("tabs-content focus:outline-none focus-visible:outline-none", u),
|
|
146
|
+
"data-state": c ? "active" : "inactive",
|
|
147
|
+
"data-testid": "spectral-tabs-content",
|
|
152
148
|
hidden: !c,
|
|
149
|
+
id: v,
|
|
150
|
+
ref: l,
|
|
151
|
+
role: "tabpanel",
|
|
152
|
+
tabIndex: 0,
|
|
153
153
|
...b
|
|
154
154
|
}
|
|
155
155
|
);
|
package/dist/Tabs/tabsUtils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
const
|
|
2
|
+
const s = (e) => {
|
|
3
3
|
const n = {
|
|
4
4
|
left: 0,
|
|
5
5
|
top: 0,
|
|
@@ -9,18 +9,18 @@ const u = (e) => {
|
|
|
9
9
|
isEnclosed: !1
|
|
10
10
|
};
|
|
11
11
|
if (!e.current) return n;
|
|
12
|
-
const t = e.current.querySelector("[data-state='active']"),
|
|
13
|
-
if (!t) return { ...n, orientation:
|
|
14
|
-
const
|
|
12
|
+
const t = e.current.querySelector("[data-state='active']"), r = e.current.closest("[data-orientation]")?.getAttribute("data-orientation") ?? "horizontal", o = e.current.closest(".enclosed") !== null;
|
|
13
|
+
if (!t) return { ...n, orientation: r, isEnclosed: o };
|
|
14
|
+
const a = t.getBoundingClientRect(), i = e.current.getBoundingClientRect();
|
|
15
15
|
return {
|
|
16
|
-
left:
|
|
17
|
-
top:
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
20
|
-
orientation:
|
|
21
|
-
isEnclosed:
|
|
16
|
+
left: a.left - i.left,
|
|
17
|
+
top: a.top - i.top,
|
|
18
|
+
width: a.width,
|
|
19
|
+
height: a.height,
|
|
20
|
+
orientation: r,
|
|
21
|
+
isEnclosed: o
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, u = (e) => e.orientation === "horizontal" ? {
|
|
24
24
|
left: `${e.left}px`,
|
|
25
25
|
width: `${e.width}px`
|
|
26
26
|
} : {
|
|
@@ -28,9 +28,9 @@ const u = (e) => {
|
|
|
28
28
|
height: `${e.height}px`
|
|
29
29
|
}, d = (e, n) => {
|
|
30
30
|
let t = null;
|
|
31
|
-
return (...
|
|
31
|
+
return (...r) => {
|
|
32
32
|
t !== null && clearTimeout(t), t = setTimeout(() => {
|
|
33
|
-
e(...
|
|
33
|
+
e(...r);
|
|
34
34
|
}, n);
|
|
35
35
|
};
|
|
36
36
|
}, f = () => {
|
|
@@ -40,32 +40,33 @@ const u = (e) => {
|
|
|
40
40
|
} catch {
|
|
41
41
|
return !1;
|
|
42
42
|
}
|
|
43
|
-
},
|
|
43
|
+
}, h = (e = "tabs") => typeof crypto < "u" && crypto.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Math.random().toString(36).substring(2, 11)}-${Date.now().toString(36)}`, c = (e, n) => {
|
|
44
44
|
if (typeof e != "object" || e === null)
|
|
45
|
-
return
|
|
45
|
+
return console.warn(`Tabs: Tab at index ${n} must be an object, received: ${typeof e}`), !1;
|
|
46
46
|
const t = e;
|
|
47
|
-
return !("key" in t) || typeof t.key != "string" || t.key.length === 0 ? (
|
|
48
|
-
},
|
|
47
|
+
return !("key" in t) || typeof t.key != "string" || t.key.length === 0 ? (console.warn(`Tabs: Tab at index ${n} must have a non-empty string 'key' property`), !1) : "label" in t ? "children" in t ? !0 : (console.warn(`Tabs: Tab at index ${n} must have a 'children' property`), !1) : (console.warn(`Tabs: Tab at index ${n} must have a 'label' property`), !1);
|
|
48
|
+
}, p = (e) => {
|
|
49
49
|
if (!Array.isArray(e) || e.length === 0)
|
|
50
|
-
return
|
|
50
|
+
return console.warn("Tabs: tabValues must be a non-empty array"), !1;
|
|
51
51
|
const n = /* @__PURE__ */ new Set();
|
|
52
|
-
for (
|
|
53
|
-
|
|
52
|
+
for (let t = 0; t < e.length; t++) {
|
|
53
|
+
const r = e[t];
|
|
54
|
+
if (!c(r, t))
|
|
54
55
|
return !1;
|
|
55
|
-
const
|
|
56
|
-
if (n.has(
|
|
57
|
-
return
|
|
58
|
-
n.add(
|
|
56
|
+
const o = r;
|
|
57
|
+
if (n.has(o.key))
|
|
58
|
+
return console.warn(`Tabs: Duplicate key found: '${o.key}' at index ${t}`), !1;
|
|
59
|
+
n.add(o.key);
|
|
59
60
|
}
|
|
60
61
|
return !0;
|
|
61
|
-
}, y = (e) => e.map((n) => n.key),
|
|
62
|
+
}, y = (e) => e.map((n) => n.key), g = (e, n) => e.find((t) => t.key === n);
|
|
62
63
|
export {
|
|
63
|
-
|
|
64
|
+
s as calculateIndicatorStyle,
|
|
64
65
|
d as debounce,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
g as findTabByKey,
|
|
67
|
+
h as generateId,
|
|
68
|
+
u as getIndicatorPosition,
|
|
68
69
|
y as getTabKeys,
|
|
69
70
|
f as prefersReducedMotion,
|
|
70
|
-
|
|
71
|
+
p as validateTabValues
|
|
71
72
|
};
|
package/dist/Textarea.js
CHANGED
|
@@ -82,7 +82,7 @@ const K = "absolute right-4 top-4", Q = (t) => t || "off", U = (t, a) => {
|
|
|
82
82
|
});
|
|
83
83
|
return /* @__PURE__ */ n("div", { className: "w-full", children: [
|
|
84
84
|
c && /* @__PURE__ */ e(D, { "data-testid": "spectral-textarea-label", htmlFor: p, className: g("block mb-2", f && "opacity-50 cursor-not-allowed", b), children: c }),
|
|
85
|
-
/* @__PURE__ */ n("div", { className: "relative",
|
|
85
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
86
86
|
/* @__PURE__ */ e(
|
|
87
87
|
"textarea",
|
|
88
88
|
{
|
|
@@ -109,7 +109,7 @@ const K = "absolute right-4 top-4", Q = (t) => t || "off", U = (t, a) => {
|
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
111
|
E && /* @__PURE__ */ e("div", { className: K, "data-testid": "spectral-textarea-loading-icon", children: /* @__PURE__ */ e(B, { size: 24 }) }),
|
|
112
|
-
/* @__PURE__ */ n("div", {
|
|
112
|
+
/* @__PURE__ */ n("div", { "aria-label": `${l} of ${i} characters used`, "aria-live": "polite", className: U(l, i), "data-testid": "spectral-textarea-counter", role: "status", children: [
|
|
113
113
|
l,
|
|
114
114
|
"/",
|
|
115
115
|
i
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
--horizon-color-level-four: oklch(35.77% 0.0088 248.07);
|
|
48
48
|
--horizon-color-level-five: oklch(38.75% 0.0073 242.06);
|
|
49
49
|
|
|
50
|
-
--horizon-color-success-50: oklch(
|
|
51
|
-
--horizon-color-success-100: oklch(
|
|
52
|
-
--horizon-color-success-200: oklch(
|
|
53
|
-
--horizon-color-success-300: oklch(
|
|
54
|
-
--horizon-color-success-400: oklch(72
|
|
55
|
-
--horizon-color-success-500: oklch(62
|
|
50
|
+
--horizon-color-success-50: oklch(99% 0.1049 144);
|
|
51
|
+
--horizon-color-success-100: oklch(94% 0.1649 144);
|
|
52
|
+
--horizon-color-success-200: oklch(92% 0.2424 144);
|
|
53
|
+
--horizon-color-success-300: oklch(82% 0.2424 144);
|
|
54
|
+
--horizon-color-success-400: oklch(72% 0.2424 144);
|
|
55
|
+
--horizon-color-success-500: oklch(62% 0.2424 144);
|
|
56
56
|
|
|
57
|
-
--horizon-color-warning-50: oklch(
|
|
58
|
-
--horizon-color-warning-100: oklch(
|
|
59
|
-
--horizon-color-warning-200: oklch(
|
|
60
|
-
--horizon-color-warning-300: oklch(
|
|
61
|
-
--horizon-color-warning-400: oklch(
|
|
62
|
-
--horizon-color-warning-500: oklch(
|
|
57
|
+
--horizon-color-warning-50: oklch(94% 0.0442 56.91);
|
|
58
|
+
--horizon-color-warning-100: oklch(91% 0.095 52.355);
|
|
59
|
+
--horizon-color-warning-200: oklch(84.9% 0.144 52.438);
|
|
60
|
+
--horizon-color-warning-300: oklch(76.9% 0.178 52.325);
|
|
61
|
+
--horizon-color-warning-400: oklch(71.06% 0.19 46.76);
|
|
62
|
+
--horizon-color-warning-500: oklch(70.5% 0.213 47.604);
|
|
63
63
|
|
|
64
64
|
--horizon-color-danger-50: oklch(88.5% 0.062 18.334);
|
|
65
65
|
--horizon-color-danger-100: oklch(80.8% 0.114 19.571);
|