@spear-ai/spectral 1.7.0 → 1.8.1
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/.js +65 -65
- package/dist/Accordion.js +1 -1
- package/dist/Alert/AlertBase.js +1 -1
- package/dist/Alert.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonIcon.js +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/DateTimePicker/Calendar.js +365 -360
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2
- package/dist/DateTimePicker.js +1 -1
- package/dist/Icons/PolygonIcon.d.ts +5 -0
- package/dist/Icons/PolygonIcon.js +40 -0
- package/dist/Icons/index.d.ts +1 -1
- package/dist/Icons.js +34 -34
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +4 -4
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
- package/dist/Input.js +1 -1
- package/dist/InputOTP.js +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +30 -30
- package/dist/RadioGroup.js +2 -2
- package/dist/Select.js +39 -39
- package/dist/Switch/SwitchBase.js +70 -106
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +122 -33
- package/dist/Tabs/TabsBase.js +2 -2
- package/dist/Textarea.js +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Tray.js +3 -3
- package/dist/index-Cl8VeY0o.js +149 -0
- package/dist/primitives/select.js +1 -1
- package/dist/{proxy-CgaCj1WQ.js → proxy-CO_-Vget.js} +3107 -2803
- package/dist/styles/horizon/colors.css +3 -2
- package/dist/styles/main.css +1 -1
- package/dist/styles/spectral.css +2 -2
- package/dist/styles/theme.css +3 -2
- package/dist/{use-animation-CR-SdV2l.js → use-animation-DhEPRwZ3.js} +1 -1
- package/dist/utils/twUtils.js +528 -369
- package/package.json +33 -32
- package/dist/Icons/LineToolIcon2.d.ts +0 -5
- package/dist/Icons/LineToolIcon2.js +0 -49
- package/dist/index-DdFoGvON.js +0 -146
package/dist/Select.js
CHANGED
|
@@ -34,7 +34,6 @@ import "./Icons/KeyboardIcon.js";
|
|
|
34
34
|
import "./Icons/LabelIcon.js";
|
|
35
35
|
import "./Icons/LassoIcon.js";
|
|
36
36
|
import "./Icons/LineToolIcon.js";
|
|
37
|
-
import "./Icons/LineToolIcon2.js";
|
|
38
37
|
import "./Icons/LiveViewIcon.js";
|
|
39
38
|
import { LoaderIcon as Y } from "./Icons/LoaderIcon.js";
|
|
40
39
|
import "./Icons/LocationIcon.js";
|
|
@@ -48,6 +47,7 @@ import "./Icons/PanelIconClose.js";
|
|
|
48
47
|
import "./Icons/PanelIconOpen.js";
|
|
49
48
|
import "./Icons/PlayIcon.js";
|
|
50
49
|
import "./Icons/PlusIcon.js";
|
|
50
|
+
import "./Icons/PolygonIcon.js";
|
|
51
51
|
import "./Icons/ResetIcon.js";
|
|
52
52
|
import "./Icons/ReviewedIcon.js";
|
|
53
53
|
import "./Icons/ScissorsIcon.js";
|
|
@@ -68,65 +68,65 @@ import "./Icons/ZoomAllIcon.js";
|
|
|
68
68
|
import "./Icons/ZoomXIcon.js";
|
|
69
69
|
import "./Icons/ZoomYIcon.js";
|
|
70
70
|
import { Label as I } from "./Label.js";
|
|
71
|
-
import { R as Z, T as _, V as $, I as tt,
|
|
72
|
-
import { useFormFieldId as
|
|
71
|
+
import { R as Z, T as _, V as $, I as tt, P as et, C as rt, S as at, a as it, b as st, c as C, G as ot, d as lt, e as dt, f as mt } from "./index-CpovUAO-.js";
|
|
72
|
+
import { useFormFieldId as ct, useFormFieldState as pt, getAriaProps as nt, groupOptions as ut, getFormFieldCSSProperties as gt, getStateClasses as ht, getTriggerClasses as ft, ErrorMessage as bt, getErrorMessageId as xt, LoadingState as yt, EmptyState as Nt, getOptionClasses as vt } from "./utils/formFieldUtils.js";
|
|
73
73
|
import { cn as a } from "./utils/twUtils.js";
|
|
74
74
|
import { useState as St } from "react";
|
|
75
|
-
const
|
|
75
|
+
const wt = ({
|
|
76
76
|
align: z = "start",
|
|
77
77
|
alignOffset: F = 0,
|
|
78
78
|
avoidCollisions: O = !0,
|
|
79
79
|
className: j,
|
|
80
80
|
collisionBoundary: k,
|
|
81
81
|
collisionPadding: L = 10,
|
|
82
|
-
defaultValue:
|
|
83
|
-
emptyMessage:
|
|
82
|
+
defaultValue: P,
|
|
83
|
+
emptyMessage: T = "No options found",
|
|
84
84
|
errorMessage: n,
|
|
85
|
-
id:
|
|
85
|
+
id: V,
|
|
86
86
|
label: l,
|
|
87
87
|
labelClassName: u,
|
|
88
|
-
loadingMessage:
|
|
88
|
+
loadingMessage: q = "Loading…",
|
|
89
89
|
name: g,
|
|
90
|
-
onChange:
|
|
91
|
-
options:
|
|
92
|
-
placeholder:
|
|
90
|
+
onChange: D,
|
|
91
|
+
options: h = [],
|
|
92
|
+
placeholder: E = "Select an option",
|
|
93
93
|
position: d = "popper",
|
|
94
94
|
ref: B,
|
|
95
95
|
side: G = "bottom",
|
|
96
96
|
sideOffset: M = 4,
|
|
97
97
|
state: i = "default",
|
|
98
|
-
value:
|
|
98
|
+
value: f,
|
|
99
99
|
"aria-label": R,
|
|
100
100
|
"aria-describedby": A,
|
|
101
101
|
...s
|
|
102
102
|
}) => {
|
|
103
|
-
const [b, U] = St(!1), o =
|
|
103
|
+
const [b, U] = St(!1), o = ct(V, g), x = xt(o), { isDisabled: m, isLoading: y, isInvalid: H } = pt(s.disabled, i), J = nt(i, A, s.required, x), { groups: N, ungrouped: v } = ut(h), K = () => {
|
|
104
104
|
if (y)
|
|
105
|
-
return /* @__PURE__ */ t(
|
|
106
|
-
if (
|
|
107
|
-
return /* @__PURE__ */ t(
|
|
108
|
-
const
|
|
109
|
-
const c =
|
|
110
|
-
return /* @__PURE__ */ r(
|
|
111
|
-
/* @__PURE__ */ t(
|
|
112
|
-
/* @__PURE__ */ t(
|
|
105
|
+
return /* @__PURE__ */ t(yt, { "data-testid": "spectral-select-loading", message: q });
|
|
106
|
+
if (h.length === 0)
|
|
107
|
+
return /* @__PURE__ */ t(Nt, { "data-testid": "spectral-select-empty", message: T });
|
|
108
|
+
const S = (e) => {
|
|
109
|
+
const c = f === e.value;
|
|
110
|
+
return /* @__PURE__ */ r(lt, { className: a(vt(!!e.disabled, !1, c), "relative flex w-full cursor-pointer items-center"), "data-testid": "spectral-select-item", disabled: e.disabled, value: e.value, children: [
|
|
111
|
+
/* @__PURE__ */ t(dt, { "data-testid": "spectral-select-item-text", className: "block truncate", children: e.label }),
|
|
112
|
+
/* @__PURE__ */ t(mt, { "data-testid": "spectral-select-item-selected-indicator", asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ t(X, { size: 16 }) }) })
|
|
113
113
|
] }, e.value);
|
|
114
114
|
};
|
|
115
115
|
return /* @__PURE__ */ r(w, { children: [
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
v.length > 0 && /* @__PURE__ */ r(w, { children: [
|
|
117
|
+
v.map(S),
|
|
118
118
|
Object.keys(N).length > 0 && /* @__PURE__ */ t(C, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-separator" })
|
|
119
119
|
] }),
|
|
120
|
-
Object.entries(N).map(([e, c], Q) => /* @__PURE__ */ r(
|
|
120
|
+
Object.entries(N).map(([e, c], Q) => /* @__PURE__ */ r(ot, { "data-testid": "spectral-select-group", children: [
|
|
121
121
|
Q > 0 && /* @__PURE__ */ t(C, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-group-separator" }),
|
|
122
122
|
/* @__PURE__ */ t(I, { className: a("text-text-primary px-2 py-1.5 text-base font-semibold", u), "data-testid": "spectral-select-group-label", children: e }),
|
|
123
|
-
c.map((W) =>
|
|
123
|
+
c.map((W) => S(W))
|
|
124
124
|
] }, e))
|
|
125
125
|
] });
|
|
126
126
|
};
|
|
127
127
|
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
128
128
|
l && /* @__PURE__ */ t(I, { className: a("text-text-primary mb-2 block", u, m && "text-text-secondary"), "data-testid": "spectral-select-label", htmlFor: o, children: l }),
|
|
129
|
-
/* @__PURE__ */ r(Z, { "data-testid": "spectral-select", defaultValue:
|
|
129
|
+
/* @__PURE__ */ r(Z, { "data-testid": "spectral-select", defaultValue: P, disabled: m, name: g, onOpenChange: U, onValueChange: D, open: b, required: s.required, value: f, children: [
|
|
130
130
|
/* @__PURE__ */ t(
|
|
131
131
|
_,
|
|
132
132
|
{
|
|
@@ -134,24 +134,24 @@ const vt = ({
|
|
|
134
134
|
"aria-expanded": b,
|
|
135
135
|
"aria-label": R ?? l,
|
|
136
136
|
asChild: !0,
|
|
137
|
-
className: a(ft(!1, i),
|
|
137
|
+
className: a(ft(!1, i), ht(i), j),
|
|
138
138
|
"data-slot": "select-trigger",
|
|
139
139
|
"data-state": i,
|
|
140
140
|
"data-testid": "spectral-select-trigger",
|
|
141
141
|
id: o,
|
|
142
142
|
ref: B,
|
|
143
143
|
role: "combobox",
|
|
144
|
-
style:
|
|
144
|
+
style: gt(),
|
|
145
145
|
...J,
|
|
146
146
|
...s,
|
|
147
147
|
children: /* @__PURE__ */ r("button", { type: "button", disabled: m, children: [
|
|
148
|
-
/* @__PURE__ */ t($, { className: "block truncate", "data-testid": "spectral-select-value", placeholder:
|
|
148
|
+
/* @__PURE__ */ t($, { className: "block truncate", "data-testid": "spectral-select-value", placeholder: E }),
|
|
149
149
|
/* @__PURE__ */ t(tt, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "flex items-center", children: y ? /* @__PURE__ */ t(Y, { size: 20 }) : /* @__PURE__ */ t(p, { className: "transition-transform duration-200 data-[state=open]:rotate-180", size: 20 }) }) })
|
|
150
150
|
] })
|
|
151
151
|
}
|
|
152
152
|
),
|
|
153
|
-
/* @__PURE__ */ r(
|
|
154
|
-
|
|
153
|
+
/* @__PURE__ */ t(et, { children: /* @__PURE__ */ r(
|
|
154
|
+
rt,
|
|
155
155
|
{
|
|
156
156
|
align: z,
|
|
157
157
|
alignOffset: F,
|
|
@@ -159,7 +159,7 @@ const vt = ({
|
|
|
159
159
|
className: a(
|
|
160
160
|
"border-input-border bg-input-bg motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out relative z-50 rounded-lg border shadow-md",
|
|
161
161
|
"motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95",
|
|
162
|
-
"motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height)",
|
|
162
|
+
"motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 max-h-[min(var(--radix-select-content-available-height),300px)]",
|
|
163
163
|
"min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",
|
|
164
164
|
d === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1"
|
|
165
165
|
),
|
|
@@ -171,17 +171,17 @@ const vt = ({
|
|
|
171
171
|
side: G,
|
|
172
172
|
sideOffset: M,
|
|
173
173
|
children: [
|
|
174
|
-
/* @__PURE__ */ t(
|
|
175
|
-
/* @__PURE__ */ t(
|
|
176
|
-
/* @__PURE__ */ t(
|
|
174
|
+
/* @__PURE__ */ t(at, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-up-button", children: /* @__PURE__ */ t(p, { "aria-hidden": "true", className: "rotate-180", size: 18 }) }),
|
|
175
|
+
/* @__PURE__ */ t(it, { asChild: !0, children: /* @__PURE__ */ t("div", { className: a("p-1", d === "popper" && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"), "data-testid": "spectral-select-items", children: K() }) }),
|
|
176
|
+
/* @__PURE__ */ t(st, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-down-button", children: /* @__PURE__ */ t(p, { "aria-hidden": "true", size: 18 }) })
|
|
177
177
|
]
|
|
178
178
|
}
|
|
179
|
-
)
|
|
179
|
+
) })
|
|
180
180
|
] }),
|
|
181
|
-
H && n && /* @__PURE__ */ t(
|
|
181
|
+
H && n && /* @__PURE__ */ t(bt, { "data-testid": "spectral-select-error-message", id: x, message: n })
|
|
182
182
|
] });
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
wt.displayName = "Select";
|
|
185
185
|
export {
|
|
186
|
-
|
|
186
|
+
wt as Select
|
|
187
187
|
};
|
|
@@ -1,132 +1,96 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { useControllableState as
|
|
3
|
+
import { jsx as a, jsxs as L, Fragment as N } from "react/jsx-runtime";
|
|
4
|
+
import { useControllableState as q } from "../hooks/useControllableState.js";
|
|
5
5
|
import { Slot as v } from "../primitives/slot.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const g = M(null), z = ({
|
|
6
|
+
import { createContext as K, useRef as M, useId as O, useEffect as V, useCallback as i, useContext as $ } from "react";
|
|
7
|
+
const w = K(null), z = ({
|
|
9
8
|
asChild: u,
|
|
10
9
|
checked: d,
|
|
11
|
-
children:
|
|
12
|
-
className:
|
|
13
|
-
defaultChecked:
|
|
14
|
-
disabled:
|
|
15
|
-
form:
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
onCheckedChange:
|
|
19
|
-
onClick:
|
|
10
|
+
children: h,
|
|
11
|
+
className: l,
|
|
12
|
+
defaultChecked: t = !1,
|
|
13
|
+
disabled: n,
|
|
14
|
+
form: b,
|
|
15
|
+
id: C,
|
|
16
|
+
name: y,
|
|
17
|
+
onCheckedChange: x,
|
|
18
|
+
onClick: f,
|
|
20
19
|
onKeyDown: p,
|
|
21
|
-
ref:
|
|
22
|
-
required:
|
|
23
|
-
value:
|
|
24
|
-
...
|
|
20
|
+
ref: E,
|
|
21
|
+
required: S,
|
|
22
|
+
value: g = "on",
|
|
23
|
+
...I
|
|
25
24
|
}) => {
|
|
26
|
-
const
|
|
25
|
+
const m = M(null), P = O(), R = C ?? `swt-${P}`, [r, c] = q({
|
|
27
26
|
value: d,
|
|
28
|
-
defaultValue:
|
|
29
|
-
onChange:
|
|
27
|
+
defaultValue: t,
|
|
28
|
+
onChange: x
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [n]), k(() => {
|
|
34
|
-
const e = c.current?.form ?? null;
|
|
30
|
+
V(() => {
|
|
31
|
+
const e = m.current?.form ?? null;
|
|
35
32
|
if (!e) return;
|
|
36
|
-
const o = () =>
|
|
33
|
+
const o = () => c(t);
|
|
37
34
|
return e.addEventListener("reset", o), () => e.removeEventListener("reset", o);
|
|
38
|
-
}, [
|
|
39
|
-
const
|
|
40
|
-
const o =
|
|
35
|
+
}, [t, c]);
|
|
36
|
+
const k = i((e) => {
|
|
37
|
+
const o = m.current;
|
|
41
38
|
if (!o) return;
|
|
42
39
|
o.checked = e;
|
|
43
|
-
const
|
|
44
|
-
o.dispatchEvent(
|
|
45
|
-
}, []),
|
|
46
|
-
if (
|
|
47
|
-
const e = !
|
|
48
|
-
|
|
49
|
-
}, [
|
|
40
|
+
const F = new Event("change", { bubbles: !0 });
|
|
41
|
+
o.dispatchEvent(F);
|
|
42
|
+
}, []), s = i(() => {
|
|
43
|
+
if (n) return;
|
|
44
|
+
const e = !r;
|
|
45
|
+
c(e), queueMicrotask(() => k(e));
|
|
46
|
+
}, [n, k, r, c]), T = i(
|
|
50
47
|
(e) => {
|
|
51
|
-
|
|
48
|
+
f?.(e), !e.defaultPrevented && s();
|
|
52
49
|
},
|
|
53
|
-
[
|
|
54
|
-
),
|
|
50
|
+
[f, s]
|
|
51
|
+
), j = i(
|
|
55
52
|
(e) => {
|
|
56
|
-
p?.(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(),
|
|
53
|
+
p?.(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), s());
|
|
57
54
|
},
|
|
58
|
-
[p,
|
|
59
|
-
),
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"aria-hidden": "true",
|
|
87
|
-
checked: n,
|
|
88
|
-
disabled: t,
|
|
89
|
-
form: x,
|
|
90
|
-
name: C,
|
|
91
|
-
readOnly: !0,
|
|
92
|
-
ref: c,
|
|
93
|
-
required: I,
|
|
94
|
-
tabIndex: -1,
|
|
95
|
-
type: "checkbox",
|
|
96
|
-
value: N,
|
|
97
|
-
style: {
|
|
98
|
-
height: 0,
|
|
99
|
-
opacity: 0,
|
|
100
|
-
pointerEvents: "none",
|
|
101
|
-
position: "absolute",
|
|
102
|
-
width: 0
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
l
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
) });
|
|
55
|
+
[p, s]
|
|
56
|
+
), D = u ? v : "button";
|
|
57
|
+
return /* @__PURE__ */ a(w.Provider, { value: { checked: r, disabled: n }, children: /* @__PURE__ */ L(N, { children: [
|
|
58
|
+
/* @__PURE__ */ a(D, { "aria-checked": r, className: l, "data-disabled": n ?? void 0, "data-state": r ? "checked" : "unchecked", disabled: n, id: R, onClick: T, onKeyDown: j, ref: E, role: "switch", type: "button", ...I, children: h }),
|
|
59
|
+
/* @__PURE__ */ a(
|
|
60
|
+
"input",
|
|
61
|
+
{
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
checked: r,
|
|
64
|
+
disabled: n,
|
|
65
|
+
form: b,
|
|
66
|
+
name: y,
|
|
67
|
+
readOnly: !0,
|
|
68
|
+
ref: m,
|
|
69
|
+
required: S,
|
|
70
|
+
tabIndex: -1,
|
|
71
|
+
type: "checkbox",
|
|
72
|
+
value: g,
|
|
73
|
+
style: {
|
|
74
|
+
height: 0,
|
|
75
|
+
opacity: 0,
|
|
76
|
+
pointerEvents: "none",
|
|
77
|
+
position: "absolute",
|
|
78
|
+
width: 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] }) });
|
|
110
83
|
};
|
|
111
84
|
z.displayName = "Switch";
|
|
112
85
|
const A = ({
|
|
113
86
|
asChild: u,
|
|
114
87
|
className: d,
|
|
115
|
-
ref:
|
|
116
|
-
...
|
|
88
|
+
ref: h,
|
|
89
|
+
...l
|
|
117
90
|
}) => {
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
120
|
-
return /* @__PURE__ */
|
|
121
|
-
u ? v : "span",
|
|
122
|
-
{
|
|
123
|
-
className: w("bg-background pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform", "translate-x-0 data-[state=checked]:translate-x-5", d),
|
|
124
|
-
"data-disabled": r.disabled ?? void 0,
|
|
125
|
-
"data-state": r.checked ? "checked" : "unchecked",
|
|
126
|
-
ref: l,
|
|
127
|
-
...h
|
|
128
|
-
}
|
|
129
|
-
);
|
|
91
|
+
const t = $(w);
|
|
92
|
+
if (!t) throw new Error("SwitchThumb must be used within Switch");
|
|
93
|
+
return /* @__PURE__ */ a(u ? v : "span", { className: d, "data-disabled": t.disabled ?? void 0, "data-state": t.checked ? "checked" : "unchecked", ref: h, ...l });
|
|
130
94
|
};
|
|
131
95
|
A.displayName = "SwitchThumb";
|
|
132
96
|
export {
|
package/dist/Switch.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type SwitchProps = Omit<SwitchBaseProps, 'onCheckedChange'> & {
|
|
|
9
9
|
ref?: Ref<HTMLButtonElement>;
|
|
10
10
|
required?: boolean;
|
|
11
11
|
value?: string;
|
|
12
|
-
variant?: 'default' | 'squared';
|
|
12
|
+
variant?: 'default' | 'squared' | 'permanent-indicator';
|
|
13
13
|
};
|
|
14
14
|
export declare const Switch: {
|
|
15
15
|
({ className, disabled, hideLabel, id, labelPosition, labelText, name, onChange, ref, required, value, variant, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/Switch.js
CHANGED
|
@@ -1,45 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import "./styles/main.css";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Switch as
|
|
4
|
-
import { Label as
|
|
5
|
-
import { cn as
|
|
6
|
-
import "react";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { jsxs as w, jsx as s } from "react/jsx-runtime";
|
|
4
|
+
import { Switch as k, SwitchThumb as x } from "./Switch/SwitchBase.js";
|
|
5
|
+
import { Label as m } from "./Label.js";
|
|
6
|
+
import { cn as u } from "./utils/twUtils.js";
|
|
7
|
+
import { forwardRef as N, createElement as b } from "react";
|
|
8
|
+
const A = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _ = (t) => t.replace(
|
|
9
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
10
|
+
(e, r, a) => a ? a.toUpperCase() : r.toLowerCase()
|
|
11
|
+
), v = (t) => {
|
|
12
|
+
const e = _(t);
|
|
13
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
14
|
+
}, y = (...t) => t.filter((e, r, a) => !!e && e.trim() !== "" && a.indexOf(e) === r).join(" ").trim(), $ = (t) => {
|
|
15
|
+
for (const e in t)
|
|
16
|
+
if (e.startsWith("aria-") || e === "role" || e === "title")
|
|
17
|
+
return !0;
|
|
18
|
+
};
|
|
19
|
+
var j = {
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
width: 24,
|
|
22
|
+
height: 24,
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
fill: "none",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: 2,
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round"
|
|
29
|
+
};
|
|
30
|
+
const S = N(
|
|
31
|
+
({
|
|
32
|
+
color: t = "currentColor",
|
|
33
|
+
size: e = 24,
|
|
34
|
+
strokeWidth: r = 2,
|
|
35
|
+
absoluteStrokeWidth: a,
|
|
36
|
+
className: n = "",
|
|
37
|
+
children: i,
|
|
38
|
+
iconNode: d,
|
|
39
|
+
...o
|
|
40
|
+
}, l) => b(
|
|
41
|
+
"svg",
|
|
42
|
+
{
|
|
43
|
+
ref: l,
|
|
44
|
+
...j,
|
|
45
|
+
width: e,
|
|
46
|
+
height: e,
|
|
47
|
+
stroke: t,
|
|
48
|
+
strokeWidth: a ? Number(r) * 24 / Number(e) : r,
|
|
49
|
+
className: y("lucide", n),
|
|
50
|
+
...!i && !$(o) && { "aria-hidden": "true" },
|
|
51
|
+
...o
|
|
52
|
+
},
|
|
53
|
+
[
|
|
54
|
+
...d.map(([c, h]) => b(c, h)),
|
|
55
|
+
...Array.isArray(i) ? i : [i]
|
|
56
|
+
]
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
const z = (t, e) => {
|
|
60
|
+
const r = N(
|
|
61
|
+
({ className: a, ...n }, i) => b(S, {
|
|
62
|
+
ref: i,
|
|
63
|
+
iconNode: e,
|
|
64
|
+
className: y(
|
|
65
|
+
`lucide-${A(v(t))}`,
|
|
66
|
+
`lucide-${t}`,
|
|
67
|
+
a
|
|
68
|
+
),
|
|
69
|
+
...n
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
return r.displayName = v(t), r;
|
|
73
|
+
};
|
|
74
|
+
const I = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], L = z("check", I);
|
|
75
|
+
const B = [
|
|
76
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
77
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
78
|
+
], F = z("x", B), C = "bg-switch-thumb--checked data-[state=checked]:bg-switch-thumb pointer-events-none block rounded-full ring-0 transition-transform motion-reduce:transition-none", P = ({ className: t, disabled: e, hideLabel: r = !1, id: a, labelPosition: n = "right", labelText: i, name: d, onChange: o, ref: l, required: c, value: h, variant: f, ...p }) => {
|
|
79
|
+
const g = f === "squared";
|
|
80
|
+
return /* @__PURE__ */ w("div", { className: "flex items-center", "data-testid": "spectral-switch-container", children: [
|
|
81
|
+
n === "left" && !r && /* @__PURE__ */ s(m, { className: "mr-2", "data-testid": "spectral-switch-label-left", htmlFor: a, children: i }),
|
|
82
|
+
f === "permanent-indicator" ? /* @__PURE__ */ w("div", { className: "relative inline-grid h-7 grid-cols-[1fr_1fr] items-center text-sm font-medium", children: [
|
|
83
|
+
/* @__PURE__ */ s(
|
|
84
|
+
k,
|
|
85
|
+
{
|
|
86
|
+
"aria-required": c,
|
|
87
|
+
className: u(
|
|
88
|
+
"peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg/50 focus-visible:ring-ring focus-visible:ring-offset-background absolute inset-0 inline-flex h-[inherit] w-14 items-center",
|
|
89
|
+
"cursor-pointer rounded-full border-2 border-transparent shadow-2xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
90
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
91
|
+
t
|
|
92
|
+
),
|
|
93
|
+
"data-testid": "spectral-switch",
|
|
94
|
+
disabled: e,
|
|
95
|
+
id: a,
|
|
96
|
+
name: d,
|
|
97
|
+
onCheckedChange: o,
|
|
98
|
+
ref: l,
|
|
99
|
+
required: c,
|
|
100
|
+
value: h,
|
|
101
|
+
...p,
|
|
102
|
+
children: /* @__PURE__ */ s(x, { className: u(C, "relative z-10 size-6.5 shadow-xs duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] data-[state=checked]:translate-x-[26px] motion-reduce:duration-0 data-[state=checked]:rtl:-translate-x-[26px]") })
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ s("span", { className: "pointer-events-none relative ml-0.5 flex min-w-8 items-center justify-center text-center transition-transform duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:invisible peer-data-[state=unchecked]:translate-x-6 motion-reduce:translate-x-0 motion-reduce:transition-none motion-reduce:duration-0 peer-data-[state=unchecked]:rtl:-translate-x-6", children: /* @__PURE__ */ s(F, { "aria-hidden": "true", className: "size-4" }) }),
|
|
106
|
+
/* @__PURE__ */ s("span", { className: "peer-data-[state=checked]:text-background pointer-events-none relative flex min-w-8 items-center justify-center text-center transition-transform duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] peer-data-[state=checked]:-translate-x-full peer-data-[state=unchecked]:invisible motion-reduce:translate-x-0 motion-reduce:transition-none motion-reduce:duration-0 peer-data-[state=checked]:rtl:translate-x-full", children: /* @__PURE__ */ s(L, { "aria-hidden": "true", className: "size-4" }) })
|
|
107
|
+
] }) : /* @__PURE__ */ s(
|
|
108
|
+
k,
|
|
13
109
|
{
|
|
14
110
|
"aria-required": c,
|
|
15
|
-
className:
|
|
16
|
-
|
|
17
|
-
|
|
111
|
+
className: u(
|
|
112
|
+
g ? "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",
|
|
113
|
+
t
|
|
18
114
|
),
|
|
19
115
|
"data-testid": "spectral-switch",
|
|
20
|
-
disabled:
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
onCheckedChange:
|
|
24
|
-
ref:
|
|
116
|
+
disabled: e,
|
|
117
|
+
id: a,
|
|
118
|
+
name: d,
|
|
119
|
+
onCheckedChange: o,
|
|
120
|
+
ref: l,
|
|
25
121
|
required: c,
|
|
26
|
-
value:
|
|
27
|
-
...
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
k,
|
|
30
|
-
{
|
|
31
|
-
className: l(
|
|
32
|
-
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"
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
)
|
|
122
|
+
value: h,
|
|
123
|
+
...p,
|
|
124
|
+
children: /* @__PURE__ */ s(x, { className: u(C, g ? "size-5 shadow-xs data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4" : "h-5 w-5 shadow-lg data-[state=checked]:translate-x-4") })
|
|
36
125
|
}
|
|
37
126
|
),
|
|
38
|
-
|
|
39
|
-
|
|
127
|
+
n === "right" && !r && /* @__PURE__ */ s(m, { className: "ml-2", "data-testid": "spectral-switch-label-right", htmlFor: a, id: `${a}-label`, children: i }),
|
|
128
|
+
r && /* @__PURE__ */ s(m, { className: "sr-only", "data-testid": "spectral-switch-label-hidden", htmlFor: a, children: i })
|
|
40
129
|
] });
|
|
41
130
|
};
|
|
42
|
-
|
|
131
|
+
P.displayName = "Switch";
|
|
43
132
|
export {
|
|
44
|
-
|
|
133
|
+
P as Switch
|
|
45
134
|
};
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -5,8 +5,8 @@ import { generateId as K, prefersReducedMotion as $, calculateIndicatorStyle as
|
|
|
5
5
|
import { cn as x } from "../utils/twUtils.js";
|
|
6
6
|
import { createContext as k, useContext as U, useState as M, useId as F, useCallback as T, useRef as q, useMemo as B, useEffect as R } from "react";
|
|
7
7
|
import { j as H } from "../index-DEYs15GP.js";
|
|
8
|
-
import { m as D } from "../proxy-
|
|
9
|
-
import { A as G } from "../index-
|
|
8
|
+
import { m as D } from "../proxy-CO_-Vget.js";
|
|
9
|
+
import { A as G } from "../index-Cl8VeY0o.js";
|
|
10
10
|
const N = k(null), A = (y = "Tabs") => {
|
|
11
11
|
const d = U(N);
|
|
12
12
|
if (d === null)
|
package/dist/Textarea.js
CHANGED
|
@@ -35,7 +35,6 @@ import "./Icons/KeyboardIcon.js";
|
|
|
35
35
|
import "./Icons/LabelIcon.js";
|
|
36
36
|
import "./Icons/LassoIcon.js";
|
|
37
37
|
import "./Icons/LineToolIcon.js";
|
|
38
|
-
import "./Icons/LineToolIcon2.js";
|
|
39
38
|
import "./Icons/LiveViewIcon.js";
|
|
40
39
|
import { LoaderIcon as B } from "./Icons/LoaderIcon.js";
|
|
41
40
|
import "./Icons/LocationIcon.js";
|
|
@@ -49,6 +48,7 @@ import "./Icons/PanelIconClose.js";
|
|
|
49
48
|
import "./Icons/PanelIconOpen.js";
|
|
50
49
|
import "./Icons/PlayIcon.js";
|
|
51
50
|
import "./Icons/PlusIcon.js";
|
|
51
|
+
import "./Icons/PolygonIcon.js";
|
|
52
52
|
import "./Icons/ResetIcon.js";
|
|
53
53
|
import "./Icons/ReviewedIcon.js";
|
|
54
54
|
import "./Icons/ScissorsIcon.js";
|
package/dist/Toast.js
CHANGED
|
@@ -34,7 +34,6 @@ import "./Icons/KeyboardIcon.js";
|
|
|
34
34
|
import "./Icons/LabelIcon.js";
|
|
35
35
|
import "./Icons/LassoIcon.js";
|
|
36
36
|
import "./Icons/LineToolIcon.js";
|
|
37
|
-
import "./Icons/LineToolIcon2.js";
|
|
38
37
|
import "./Icons/LiveViewIcon.js";
|
|
39
38
|
import "./Icons/LoaderIcon.js";
|
|
40
39
|
import "./Icons/LocationIcon.js";
|
|
@@ -48,6 +47,7 @@ import "./Icons/PanelIconClose.js";
|
|
|
48
47
|
import "./Icons/PanelIconOpen.js";
|
|
49
48
|
import "./Icons/PlayIcon.js";
|
|
50
49
|
import "./Icons/PlusIcon.js";
|
|
50
|
+
import "./Icons/PolygonIcon.js";
|
|
51
51
|
import "./Icons/ResetIcon.js";
|
|
52
52
|
import "./Icons/ReviewedIcon.js";
|
|
53
53
|
import "./Icons/ScissorsIcon.js";
|
package/dist/Tray.js
CHANGED
|
@@ -35,7 +35,6 @@ import "./Icons/KeyboardIcon.js";
|
|
|
35
35
|
import "./Icons/LabelIcon.js";
|
|
36
36
|
import "./Icons/LassoIcon.js";
|
|
37
37
|
import "./Icons/LineToolIcon.js";
|
|
38
|
-
import "./Icons/LineToolIcon2.js";
|
|
39
38
|
import "./Icons/LiveViewIcon.js";
|
|
40
39
|
import "./Icons/LoaderIcon.js";
|
|
41
40
|
import "./Icons/LocationIcon.js";
|
|
@@ -49,6 +48,7 @@ import "./Icons/PanelIconClose.js";
|
|
|
49
48
|
import "./Icons/PanelIconOpen.js";
|
|
50
49
|
import "./Icons/PlayIcon.js";
|
|
51
50
|
import "./Icons/PlusIcon.js";
|
|
51
|
+
import "./Icons/PolygonIcon.js";
|
|
52
52
|
import "./Icons/ResetIcon.js";
|
|
53
53
|
import "./Icons/ReviewedIcon.js";
|
|
54
54
|
import "./Icons/ScissorsIcon.js";
|
|
@@ -73,8 +73,8 @@ import { c as M } from "./index-D29mdTf5.js";
|
|
|
73
73
|
import { createContext as H, useRef as h, useMemo as T, useContext as I } from "react";
|
|
74
74
|
import { j as g } from "./index-DEYs15GP.js";
|
|
75
75
|
import { D as s } from "./index-CrjD9cAD.js";
|
|
76
|
-
import { m as v } from "./proxy-
|
|
77
|
-
import { A as O } from "./index-
|
|
76
|
+
import { m as v } from "./proxy-CO_-Vget.js";
|
|
77
|
+
import { A as O } from "./index-Cl8VeY0o.js";
|
|
78
78
|
const j = M("fixed bottom-4 left-1/2 z-10 -translate-x-1/2 overflow-hidden rounded-2xl bg-drawer-bg outline-none w-full sm:max-md:max-w-full", {
|
|
79
79
|
variants: {
|
|
80
80
|
size: {
|