@spear-ai/spectral 1.4.4 → 1.4.6
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.d.ts +5 -3
- package/dist/Alert/AlertBase.js +31 -31
- package/dist/Alert.js +11 -11
- package/dist/Avatar.js +14 -14
- package/dist/Button.js +1 -7
- package/dist/ButtonGroup/ButtonGroupButton.js +1 -1
- package/dist/Dialog.js +11 -11
- package/dist/Drawer.d.ts +6 -3
- package/dist/Drawer.js +10 -10
- package/dist/InputOTP.js +1 -0
- package/dist/MultiSelect/MultiSelectBase.js +1 -7
- package/dist/RadioGroup.js +1 -1
- 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/Toggle/ToggleBase.d.ts +1 -1
- package/dist/Toggle/ToggleBase.js +36 -18
- package/dist/Toggle.js +10 -10
- package/dist/Tooltip.d.ts +7 -2
- package/dist/Tooltip.js +156 -143
- package/dist/{createLucideIcon-B_8CJpcQ.js → createLucideIcon-D4r5Phnh.js} +0 -24
- package/dist/main.js +0 -36
- package/dist/styles/base-colors.css +13 -13
- package/dist/styles/main.css +1 -1
- package/package.json +20 -20
- 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/Slider.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx as m, jsxs as j } from "react/jsx-runtime";
|
|
|
4
4
|
import * as c from "react";
|
|
5
5
|
import { useMemo as de } from "react";
|
|
6
6
|
import { c as X } from "./index-rKs9bXHr.js";
|
|
7
|
-
import { u as ue, c as fe, b as _, P as
|
|
7
|
+
import { u as ue, c as fe, b as _, P as k, a as C } from "./index-BhufZRa2.js";
|
|
8
8
|
import { c as me, u as he } from "./index-UEFPWH8U.js";
|
|
9
9
|
import { u as pe } from "./index-BZPx6jYI.js";
|
|
10
10
|
import { u as Se } from "./index-y6Br5T4h.js";
|
|
@@ -16,7 +16,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
16
16
|
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
17
17
|
}, M = "Slider", [L, ge, ve] = me(M), [J] = fe(M, [
|
|
18
18
|
ve
|
|
19
|
-
]), [be,
|
|
19
|
+
]), [be, B] = J(M), Q = c.forwardRef(
|
|
20
20
|
(e, t) => {
|
|
21
21
|
const {
|
|
22
22
|
name: o,
|
|
@@ -41,7 +41,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
41
41
|
onChange: (y) => {
|
|
42
42
|
[...g.current][f.current]?.focus(), r(y);
|
|
43
43
|
}
|
|
44
|
-
}),
|
|
44
|
+
}), T = c.useRef(v);
|
|
45
45
|
function z(y) {
|
|
46
46
|
const P = Ee(v, y);
|
|
47
47
|
K(y, P);
|
|
@@ -50,7 +50,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
50
50
|
K(y, f.current);
|
|
51
51
|
}
|
|
52
52
|
function ce() {
|
|
53
|
-
const y =
|
|
53
|
+
const y = T.current[f.current];
|
|
54
54
|
v[f.current] !== y && d(v);
|
|
55
55
|
}
|
|
56
56
|
function K(y, P, { commit: V } = { commit: !1 }) {
|
|
@@ -86,7 +86,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
86
86
|
...S,
|
|
87
87
|
ref: t,
|
|
88
88
|
onPointerDown: _(S.onPointerDown, () => {
|
|
89
|
-
s || (
|
|
89
|
+
s || (T.current = v);
|
|
90
90
|
}),
|
|
91
91
|
min: n,
|
|
92
92
|
max: i,
|
|
@@ -235,9 +235,9 @@ var [Z, ee] = J(M, {
|
|
|
235
235
|
onEndKeyDown: s,
|
|
236
236
|
onStepKeyDown: u,
|
|
237
237
|
...b
|
|
238
|
-
} = e, h =
|
|
238
|
+
} = e, h = B(M, o);
|
|
239
239
|
return /* @__PURE__ */ m(
|
|
240
|
-
|
|
240
|
+
k.span,
|
|
241
241
|
{
|
|
242
242
|
...b,
|
|
243
243
|
ref: t,
|
|
@@ -260,9 +260,9 @@ var [Z, ee] = J(M, {
|
|
|
260
260
|
}
|
|
261
261
|
), ne = "SliderTrack", oe = c.forwardRef(
|
|
262
262
|
(e, t) => {
|
|
263
|
-
const { __scopeSlider: o, ...n } = e, i =
|
|
263
|
+
const { __scopeSlider: o, ...n } = e, i = B(ne, o);
|
|
264
264
|
return /* @__PURE__ */ m(
|
|
265
|
-
|
|
265
|
+
k.span,
|
|
266
266
|
{
|
|
267
267
|
"data-disabled": i.disabled ? "" : void 0,
|
|
268
268
|
"data-orientation": i.orientation,
|
|
@@ -275,11 +275,11 @@ var [Z, ee] = J(M, {
|
|
|
275
275
|
oe.displayName = ne;
|
|
276
276
|
var O = "SliderRange", re = c.forwardRef(
|
|
277
277
|
(e, t) => {
|
|
278
|
-
const { __scopeSlider: o, ...n } = e, i =
|
|
278
|
+
const { __scopeSlider: o, ...n } = e, i = B(O, o), l = ee(O, o), a = c.useRef(null), s = C(t, a), u = i.values.length, b = i.values.map(
|
|
279
279
|
(d) => se(d, i.min, i.max)
|
|
280
280
|
), h = u > 1 ? Math.min(...b) : 0, r = 100 - Math.max(...b);
|
|
281
281
|
return /* @__PURE__ */ m(
|
|
282
|
-
|
|
282
|
+
k.span,
|
|
283
283
|
{
|
|
284
284
|
"data-orientation": i.orientation,
|
|
285
285
|
"data-disabled": i.disabled ? "" : void 0,
|
|
@@ -305,7 +305,7 @@ var U = "SliderThumb", ie = c.forwardRef(
|
|
|
305
305
|
}
|
|
306
306
|
), Re = c.forwardRef(
|
|
307
307
|
(e, t) => {
|
|
308
|
-
const { __scopeSlider: o, index: n, name: i, ...l } = e, a =
|
|
308
|
+
const { __scopeSlider: o, index: n, name: i, ...l } = e, a = B(U, o), s = ee(U, o), [u, b] = c.useState(null), h = C(t, (D) => b(D)), r = u ? a.form || !!u.closest("form") : !0, d = Se(u), p = a.values[n], R = p === void 0 ? 0 : se(p, a.min, a.max), S = De(n, a.values.length), g = d?.[s.size], f = g ? _e(g, R, s.direction) : 0;
|
|
309
309
|
return c.useEffect(() => {
|
|
310
310
|
if (u)
|
|
311
311
|
return a.thumbs.add(u), () => {
|
|
@@ -321,7 +321,7 @@ var U = "SliderThumb", ie = c.forwardRef(
|
|
|
321
321
|
},
|
|
322
322
|
children: [
|
|
323
323
|
/* @__PURE__ */ m(L.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
|
|
324
|
-
|
|
324
|
+
k.span,
|
|
325
325
|
{
|
|
326
326
|
role: "slider",
|
|
327
327
|
"aria-label": e["aria-label"] || S,
|
|
@@ -367,7 +367,7 @@ var Pe = "RadioBubbleInput", ae = c.forwardRef(
|
|
|
367
367
|
h.call(s, t), s.dispatchEvent(r);
|
|
368
368
|
}
|
|
369
369
|
}, [a, t]), /* @__PURE__ */ m(
|
|
370
|
-
|
|
370
|
+
k.input,
|
|
371
371
|
{
|
|
372
372
|
style: { display: "none" },
|
|
373
373
|
...o,
|
|
@@ -422,7 +422,7 @@ function Ke(e, t) {
|
|
|
422
422
|
const o = Math.pow(10, t);
|
|
423
423
|
return Math.round(e * o) / o;
|
|
424
424
|
}
|
|
425
|
-
var Ie = Q,
|
|
425
|
+
var Ie = Q, ke = oe, Be = re, Te = ie;
|
|
426
426
|
const Ye = ({ className: e, defaultValue: t, disabled: o, max: n = 100, min: i = 0, minStepsBetweenThumbs: l = 1, name: a, onValueChange: s, onValueCommit: u, orientation: b = "horizontal", step: h = 1, value: r, ...d }) => {
|
|
427
427
|
const p = de(() => Array.isArray(r) ? r : Array.isArray(t) ? t : [i, n], [r, t, i, n]);
|
|
428
428
|
return /* @__PURE__ */ j(
|
|
@@ -447,11 +447,20 @@ const Ye = ({ className: e, defaultValue: t, disabled: o, max: n = 100, min: i =
|
|
|
447
447
|
className: H("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", e),
|
|
448
448
|
...d,
|
|
449
449
|
children: [
|
|
450
|
-
/* @__PURE__ */ m(
|
|
451
|
-
Array.from({ length: p.length }, (R, S) => /* @__PURE__ */ m(
|
|
450
|
+
/* @__PURE__ */ m(
|
|
452
451
|
ke,
|
|
452
|
+
{
|
|
453
|
+
"data-slot": "slider-track",
|
|
454
|
+
"data-testid": "spectral-slider-track",
|
|
455
|
+
className: H("bg-slider-track relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),
|
|
456
|
+
children: /* @__PURE__ */ m(Be, { "data-slot": "slider-range", "data-testid": "spectral-slider-range", className: H("bg-slider-range absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full") })
|
|
457
|
+
}
|
|
458
|
+
),
|
|
459
|
+
Array.from({ length: p.length }, (R, S) => /* @__PURE__ */ m(
|
|
460
|
+
Te,
|
|
453
461
|
{
|
|
454
462
|
"data-slot": "slider-thumb",
|
|
463
|
+
"data-testid": "spectral-slider-thumb",
|
|
455
464
|
className: "border-slider-thumb-border bg-slider-thumb-bg ring-slider-thumb-ring/50 block size-5 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
|
|
456
465
|
},
|
|
457
466
|
S
|
package/dist/Switch.js
CHANGED
|
@@ -5,39 +5,39 @@ import { Switch as p, SwitchThumb as k } from "./Switch/SwitchBase.js";
|
|
|
5
5
|
import { Label as r } from "./Label.js";
|
|
6
6
|
import { cn as o } from "./utils/twUtils.js";
|
|
7
7
|
import { forwardRef as x } from "react";
|
|
8
|
-
const v = x(({ className: l, disabled: d, id: e, labelPosition: i = "right", labelText: s, name: h, onChange: b, required:
|
|
9
|
-
const
|
|
8
|
+
const v = x(({ className: l, disabled: d, id: e, labelPosition: i = "right", labelText: s, name: h, onChange: b, required: c, value: m, hideLabel: a = !1, variant: u, ...f }, g) => {
|
|
9
|
+
const n = u === "squared";
|
|
10
10
|
return /* @__PURE__ */ w("div", { className: "flex items-center", "data-testid": "spectral-switch-container", children: [
|
|
11
11
|
i === "left" && !a && /* @__PURE__ */ t(r, { htmlFor: e, className: "mr-2", "data-testid": "spectral-switch-label-left", children: s }),
|
|
12
12
|
/* @__PURE__ */ t(
|
|
13
13
|
p,
|
|
14
14
|
{
|
|
15
|
-
"aria-required":
|
|
15
|
+
"aria-required": c,
|
|
16
16
|
className: o(
|
|
17
|
-
|
|
17
|
+
n ? "peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 items-center rounded-sm border-2 border-transparent transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-black disabled:cursor-not-allowed disabled:opacity-50 [&_span]:rounded-[4px]" : "focus-visible:ring-ring focus-visible:ring-offset-background peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-2xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
18
|
l
|
|
19
19
|
),
|
|
20
|
-
"data-testid": "spectral-switch
|
|
20
|
+
"data-testid": "spectral-switch",
|
|
21
21
|
disabled: d,
|
|
22
22
|
id: e,
|
|
23
23
|
name: h,
|
|
24
24
|
onCheckedChange: b,
|
|
25
25
|
ref: g,
|
|
26
|
-
required:
|
|
26
|
+
required: c,
|
|
27
27
|
value: m,
|
|
28
28
|
...f,
|
|
29
29
|
children: /* @__PURE__ */ t(
|
|
30
30
|
k,
|
|
31
31
|
{
|
|
32
32
|
className: o(
|
|
33
|
-
|
|
33
|
+
n ? "bg-switch-thumb pointer-events-none block size-5 rounded-full shadow-xs ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 data-[state=checked]:rtl:-translate-x-4" : "bg-switch-thumb pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "spectral-switch-label-right", children: s }),
|
|
40
|
-
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", children: s })
|
|
40
|
+
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", "data-testid": "spectral-switch-label-hidden", children: s })
|
|
41
41
|
] });
|
|
42
42
|
});
|
|
43
43
|
v.displayName = "Switch";
|
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
|
|
@@ -13,5 +13,5 @@ export declare const ToggleBase: import('react').ForwardRefExoticComponent<Omit<
|
|
|
13
13
|
onPressedChange?: (pressed: boolean) => void;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
asChild?: boolean;
|
|
16
|
-
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
} & import('react').RefAttributes<HTMLButtonElement | HTMLDivElement>>;
|
|
17
17
|
//# sourceMappingURL=ToggleBase.d.ts.map
|
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
3
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
4
4
|
import { useControllableState as k } from "../hooks/useControllableState.js";
|
|
5
|
-
import { Slot as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
const B =
|
|
8
|
-
const [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}),
|
|
13
|
-
t ||
|
|
14
|
-
}, [t,
|
|
5
|
+
import { Slot as C } from "../primitives/slot.js";
|
|
6
|
+
import { forwardRef as T, useCallback as s } from "react";
|
|
7
|
+
const B = T(function({ pressed: c, defaultPressed: m = !1, onPressedChange: g, disabled: t, className: v, onKeyDown: a, onClick: n, type: h = "button", asChild: b = !1, children: l, ...u }, d) {
|
|
8
|
+
const [r, i] = k({
|
|
9
|
+
defaultValue: m,
|
|
10
|
+
onChange: g,
|
|
11
|
+
value: c
|
|
12
|
+
}), o = s(() => {
|
|
13
|
+
t || i(!r);
|
|
14
|
+
}, [t, r, i]), x = s(
|
|
15
15
|
(e) => {
|
|
16
|
-
|
|
16
|
+
a && a(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), o());
|
|
17
17
|
},
|
|
18
|
-
[
|
|
19
|
-
),
|
|
18
|
+
[o, a]
|
|
19
|
+
), P = s(
|
|
20
20
|
(e) => {
|
|
21
|
-
|
|
21
|
+
n && n(e), !e.defaultPrevented && o();
|
|
22
22
|
},
|
|
23
|
-
[
|
|
24
|
-
)
|
|
25
|
-
|
|
23
|
+
[o, n]
|
|
24
|
+
), p = {
|
|
25
|
+
"aria-disabled": t || void 0,
|
|
26
|
+
"aria-pressed": r,
|
|
27
|
+
"data-state": r ? "on" : "off",
|
|
28
|
+
"data-disabled": t || void 0,
|
|
29
|
+
className: v,
|
|
30
|
+
onClick: P,
|
|
31
|
+
onKeyDown: x
|
|
32
|
+
};
|
|
33
|
+
return b ? /* @__PURE__ */ f(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: d,
|
|
37
|
+
role: "button",
|
|
38
|
+
tabIndex: t ? -1 : 0,
|
|
39
|
+
...u,
|
|
40
|
+
...p,
|
|
41
|
+
children: /* @__PURE__ */ f(C, { children: l })
|
|
42
|
+
}
|
|
43
|
+
) : /* @__PURE__ */ f("button", { ref: d, tabIndex: t ? -1 : 0, type: h, ...u, ...p, children: l });
|
|
26
44
|
});
|
|
27
45
|
export {
|
|
28
46
|
B as ToggleBase
|
package/dist/Toggle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { ToggleBase as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { c as
|
|
7
|
-
import { forwardRef as
|
|
8
|
-
const
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { ToggleBase as s } from "./Toggle/ToggleBase.js";
|
|
5
|
+
import { cn as d } from "./utils/twUtils.js";
|
|
6
|
+
import { c as l } from "./index-D29mdTf5.js";
|
|
7
|
+
import { forwardRef as v } from "react";
|
|
8
|
+
const b = l(
|
|
9
9
|
`
|
|
10
|
-
bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed
|
|
10
|
+
bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed
|
|
11
11
|
hover:cursor-pointer data-[state=on]:text-toggle-text--active text-toggle-text hover:bg-toggle-bg--hover hover:border-toggle-border--hover data-[state=on]:bg-toggle-bg--active
|
|
12
12
|
data-[state=on]:border-toggle-border--active hover:text-toggle-text--hover data-[state=on]:bg-toggle-bg--active data-[state=on]:text-toggle-text--active data-[state=on]:border-toggle-border--active
|
|
13
13
|
transition-[colors] [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus:outline-none outline-none
|
|
@@ -35,8 +35,8 @@ const v = d(
|
|
|
35
35
|
layout: "default"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
),
|
|
38
|
+
), p = v(({ className: e, variant: t, size: o, layout: r, disabled: a, ...i }, g) => /* @__PURE__ */ n(s, { ref: g, disabled: a, "data-slot": "toggle", "data-testid": "spectral-toggle", className: d(b({ variant: t, size: o, layout: r }), e), ...i }));
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
p as Toggle,
|
|
41
|
+
b as toggleVariants
|
|
42
42
|
};
|
package/dist/Tooltip.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
1
2
|
import { ComponentProps } from 'react';
|
|
2
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
4
|
export declare const TooltipProvider: ({ delayDuration, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>) => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export declare const Tooltip: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare const TooltipTrigger: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
|
|
6
|
+
export declare const TooltipTrigger: ({ asChild, children, ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const tooltipVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "outline" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export declare const TooltipContent: ({ children, className, showArrow, sideOffset, variant, side, ...props }: ComponentProps<typeof TooltipPrimitive.Content> & VariantProps<typeof tooltipVariants> & {
|
|
7
11
|
showArrow?: boolean;
|
|
8
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
9
14
|
//# sourceMappingURL=Tooltip.d.ts.map
|