@spear-ai/spectral 1.6.17 → 1.7.0
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 +196 -195
- package/dist/Accordion.d.ts +13 -15
- package/dist/Accordion.js +183 -178
- package/dist/Alert/AlertBase.d.ts +7 -7
- package/dist/Alert/AlertBase.js +20 -20
- package/dist/Alert.d.ts +2 -2
- package/dist/Alert.js +30 -30
- package/dist/Avatar.d.ts +2 -2
- package/dist/Avatar.js +30 -22
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +3 -2
- package/dist/Button.d.ts +3 -3
- package/dist/Button.js +108 -46
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroupButton.js +5 -5
- package/dist/ButtonGroup.d.ts +5 -5
- package/dist/ButtonGroup.js +21 -21
- package/dist/ButtonIcon.d.ts +2 -2
- package/dist/ButtonIcon.js +29 -30
- package/dist/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/Checkbox/CheckboxBase.js +50 -57
- package/dist/Checkbox.js +14 -18
- package/dist/DataCard/Card.d.ts +1 -1
- package/dist/DataCard/Card.js +1 -1
- package/dist/DataCard.js +1 -1
- package/dist/DateTimePicker/Calendar.d.ts +4 -4
- package/dist/DateTimePicker/Calendar.js +2 -2
- package/dist/DateTimePicker/DateTimeDisplayInput.js +126 -136
- package/dist/DateTimePicker/DateTimeInput.js +4 -4
- package/dist/DateTimePicker/DateTimeUtils.d.ts +31 -31
- package/dist/DateTimePicker/DateTimeUtils.js +139 -197
- package/dist/DateTimePicker/TimePicker.d.ts +4 -4
- package/dist/DateTimePicker/TimePicker.js +3 -3
- package/dist/DateTimePicker.d.ts +5 -5
- package/dist/DateTimePicker.js +89 -69
- package/dist/Dialog.d.ts +13 -13
- package/dist/Dialog.js +57 -84
- package/dist/Drawer.d.ts +2 -2
- package/dist/Drawer.js +8 -8
- package/dist/HoverCard.d.ts +6 -5
- package/dist/HoverCard.js +64 -64
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +2 -2
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
- package/dist/Input/InputUtils.d.ts +2 -2
- package/dist/Input/InputUtils.js +4 -4
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +18 -18
- package/dist/InputOTP.d.ts +10 -10
- package/dist/InputOTP.js +113 -113
- package/dist/Kbd.d.ts +8 -5
- package/dist/Kbd.js +85 -20
- package/dist/Label.d.ts +4 -2
- package/dist/Label.js +3 -3
- package/dist/MultiSelect/MultiSelectBase.d.ts +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +277 -201
- package/dist/MultiSelect.d.ts +6 -6
- package/dist/MultiSelect.js +9 -9
- package/dist/Popover.js +22 -237
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +11 -11
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +28 -28
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts +15 -15
- package/dist/RadioGroup.js +253 -236
- package/dist/Select.d.ts +3 -1
- package/dist/Select.js +90 -87
- package/dist/Separator.js +4 -4
- package/dist/Skeleton.d.ts +1 -2
- package/dist/Skeleton.js +2 -4
- package/dist/Slider.d.ts +6 -6
- package/dist/Slider.js +78 -78
- package/dist/Switch/SwitchBase.d.ts +4 -4
- package/dist/Switch/SwitchBase.js +68 -68
- package/dist/Switch.d.ts +3 -3
- package/dist/Switch.js +9 -9
- package/dist/Tabs/TabsBase.js +39 -38
- package/dist/Tabs/tabsUtils.js +7 -7
- package/dist/Tabs.d.ts +0 -4
- package/dist/Tabs.js +62 -66
- package/dist/Textarea/TextareaUtils.d.ts +7 -7
- package/dist/Textarea/TextareaUtils.js +13 -13
- package/dist/Textarea.js +27 -17
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.js +883 -0
- package/dist/Toggle/ToggleBase.d.ts +4 -4
- package/dist/Toggle/ToggleBase.js +32 -33
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +7 -12
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +5 -5
- package/dist/ToggleGroup/ToggleGroupBase.js +30 -30
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +27 -30
- package/dist/Tooltip.d.ts +1 -1
- package/dist/Tooltip.js +97 -97
- package/dist/Tray.d.ts +9 -9
- package/dist/Tray.js +70 -69
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +42 -39
- package/dist/hooks/useControllableState.d.ts +2 -2
- package/dist/hooks/useControllableState.d.ts.map +1 -1
- package/dist/hooks/useControllableState.js +2 -2
- package/dist/index-C12FUuIW.js +13 -0
- package/dist/{index-yU8jOTzS.js → index-CpovUAO-.js} +1 -1
- package/dist/{index-BdS7Ix8W.js → index-CqbPiOid.js} +1 -1
- package/dist/{index-B3UpsZ2x.js → index-CrjD9cAD.js} +1 -1
- package/dist/index-DEYs15GP.js +66 -0
- package/dist/index-DdFoGvON.js +146 -0
- package/dist/index-Q3N6lgwg.js +225 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.js +4 -4
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +8 -5
- package/dist/primitives/select.d.ts +12 -13
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +58 -87
- package/dist/primitives/slot.d.ts +5 -5
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +24 -33
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +4 -3
- package/dist/{proxy-Cukf-VVj.js → proxy-CgaCj1WQ.js} +7 -3
- package/dist/styles/base-colors.css +30 -30
- package/dist/styles/horizon/base-colors.css +30 -30
- package/dist/styles/horizon/colors.css +40 -11
- package/dist/styles/horizon/utilities.css +26 -3
- package/dist/styles/main.css +1 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/styles/theme.css +96 -44
- package/dist/{use-animation-zNd5Nq85.js → use-animation-CR-SdV2l.js} +1 -1
- package/dist/utils/formFieldUtils.d.ts +2 -2
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +14 -11
- package/dist/utils/sharedUtils.d.ts +3 -3
- package/dist/utils/sharedUtils.d.ts.map +1 -1
- package/dist/utils/sharedUtils.js +1 -4
- package/dist/utils/twUtils.d.ts +1 -1
- package/dist/utils/twUtils.d.ts.map +1 -1
- package/dist/utils/twUtils.js +1 -4
- package/package.json +5 -1
- package/dist/createLucideIcon-D4r5Phnh.js +0 -70
- package/dist/index-CeP1E2kK.js +0 -209
- package/dist/index-Dy-Hzr7y.js +0 -13
package/dist/HoverCard.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
import * as s from "react";
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { e as
|
|
7
|
-
import { c as O, R as
|
|
8
|
-
import { P as
|
|
5
|
+
import { createContext as I, useContext as B } from "react";
|
|
6
|
+
import { e as U, c as $, b as m, P as W, u as z } from "./index-OnYbwQjk.js";
|
|
7
|
+
import { c as O, R as G, A as K, C as j, a as V } from "./index-B3FZpM60.js";
|
|
8
|
+
import { P as q, D as J } from "./index-u1k2AYWy.js";
|
|
9
9
|
import { P as T } from "./index-D6HcSXrq.js";
|
|
10
|
-
import { cn as
|
|
11
|
-
var H,
|
|
10
|
+
import { cn as E } from "./utils/twUtils.js";
|
|
11
|
+
var H, b = "HoverCard", [N] = $(b, [
|
|
12
12
|
O
|
|
13
|
-
]),
|
|
13
|
+
]), x = O(), [Q, R] = N(b), _ = (e) => {
|
|
14
14
|
const {
|
|
15
15
|
__scopeHoverCard: o,
|
|
16
16
|
children: r,
|
|
@@ -18,77 +18,77 @@ var H, x = "HoverCard", [E] = U(x, [
|
|
|
18
18
|
defaultOpen: n,
|
|
19
19
|
onOpenChange: c,
|
|
20
20
|
openDelay: u = 700,
|
|
21
|
-
closeDelay:
|
|
22
|
-
} = e, d =
|
|
21
|
+
closeDelay: f = 300
|
|
22
|
+
} = e, d = x(o), l = s.useRef(0), p = s.useRef(0), C = s.useRef(!1), v = s.useRef(!1), [h, t] = U({
|
|
23
23
|
prop: a,
|
|
24
24
|
defaultProp: n ?? !1,
|
|
25
25
|
onChange: c,
|
|
26
|
-
caller:
|
|
26
|
+
caller: b
|
|
27
27
|
}), g = s.useCallback(() => {
|
|
28
|
-
clearTimeout(
|
|
28
|
+
clearTimeout(p.current), l.current = window.setTimeout(() => t(!0), u);
|
|
29
29
|
}, [u, t]), S = s.useCallback(() => {
|
|
30
|
-
clearTimeout(l.current), !
|
|
31
|
-
}, [
|
|
30
|
+
clearTimeout(l.current), !C.current && !v.current && (p.current = window.setTimeout(() => t(!1), f));
|
|
31
|
+
}, [f, t]), F = s.useCallback(() => t(!1), [t]);
|
|
32
32
|
return s.useEffect(() => () => {
|
|
33
|
-
clearTimeout(l.current), clearTimeout(
|
|
33
|
+
clearTimeout(l.current), clearTimeout(p.current);
|
|
34
34
|
}, []), /* @__PURE__ */ i(
|
|
35
35
|
Q,
|
|
36
36
|
{
|
|
37
37
|
scope: o,
|
|
38
|
-
open:
|
|
38
|
+
open: h,
|
|
39
39
|
onOpenChange: t,
|
|
40
40
|
onOpen: g,
|
|
41
41
|
onClose: S,
|
|
42
|
-
onDismiss:
|
|
43
|
-
hasSelectionRef:
|
|
42
|
+
onDismiss: F,
|
|
43
|
+
hasSelectionRef: C,
|
|
44
44
|
isPointerDownOnContentRef: v,
|
|
45
|
-
children: /* @__PURE__ */ i(
|
|
45
|
+
children: /* @__PURE__ */ i(G, { ...d, children: r })
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
var
|
|
49
|
+
_.displayName = b;
|
|
50
|
+
var D = "HoverCardTrigger", A = s.forwardRef(
|
|
51
51
|
(e, o) => {
|
|
52
|
-
const { __scopeHoverCard: r, ...a } = e, n =
|
|
53
|
-
return /* @__PURE__ */ i(
|
|
54
|
-
|
|
52
|
+
const { __scopeHoverCard: r, ...a } = e, n = R(D, r), c = x(r);
|
|
53
|
+
return /* @__PURE__ */ i(K, { asChild: !0, ...c, children: /* @__PURE__ */ i(
|
|
54
|
+
W.a,
|
|
55
55
|
{
|
|
56
56
|
"data-state": n.open ? "open" : "closed",
|
|
57
57
|
...a,
|
|
58
58
|
ref: o,
|
|
59
|
-
onPointerEnter:
|
|
60
|
-
onPointerLeave:
|
|
61
|
-
onFocus:
|
|
62
|
-
onBlur:
|
|
63
|
-
onTouchStart:
|
|
59
|
+
onPointerEnter: m(e.onPointerEnter, w(n.onOpen)),
|
|
60
|
+
onPointerLeave: m(e.onPointerLeave, w(n.onClose)),
|
|
61
|
+
onFocus: m(e.onFocus, n.onOpen),
|
|
62
|
+
onBlur: m(e.onBlur, n.onClose),
|
|
63
|
+
onTouchStart: m(e.onTouchStart, (u) => u.preventDefault())
|
|
64
64
|
}
|
|
65
65
|
) });
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
|
-
|
|
69
|
-
var y = "HoverCardPortal", [X, Y] =
|
|
68
|
+
A.displayName = D;
|
|
69
|
+
var y = "HoverCardPortal", [X, Y] = N(y, {
|
|
70
70
|
forceMount: void 0
|
|
71
|
-
}),
|
|
72
|
-
const { __scopeHoverCard: o, forceMount: r, children: a, container: n } = e, c =
|
|
73
|
-
return /* @__PURE__ */ i(X, { scope: o, forceMount: r, children: /* @__PURE__ */ i(T, { present: r || c.open, children: /* @__PURE__ */ i(
|
|
71
|
+
}), L = (e) => {
|
|
72
|
+
const { __scopeHoverCard: o, forceMount: r, children: a, container: n } = e, c = R(y, o);
|
|
73
|
+
return /* @__PURE__ */ i(X, { scope: o, forceMount: r, children: /* @__PURE__ */ i(T, { present: r || c.open, children: /* @__PURE__ */ i(q, { asChild: !0, container: n, children: a }) }) });
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
var P = "HoverCardContent",
|
|
75
|
+
L.displayName = y;
|
|
76
|
+
var P = "HoverCardContent", M = s.forwardRef(
|
|
77
77
|
(e, o) => {
|
|
78
|
-
const r = Y(P, e.__scopeHoverCard), { forceMount: a = r.forceMount, ...n } = e, c =
|
|
78
|
+
const r = Y(P, e.__scopeHoverCard), { forceMount: a = r.forceMount, ...n } = e, c = R(P, e.__scopeHoverCard);
|
|
79
79
|
return /* @__PURE__ */ i(T, { present: a || c.open, children: /* @__PURE__ */ i(
|
|
80
80
|
Z,
|
|
81
81
|
{
|
|
82
82
|
"data-state": c.open ? "open" : "closed",
|
|
83
83
|
...n,
|
|
84
|
-
onPointerEnter:
|
|
85
|
-
onPointerLeave:
|
|
84
|
+
onPointerEnter: m(e.onPointerEnter, w(c.onOpen)),
|
|
85
|
+
onPointerLeave: m(e.onPointerLeave, w(c.onClose)),
|
|
86
86
|
ref: o
|
|
87
87
|
}
|
|
88
88
|
) });
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
-
|
|
91
|
+
M.displayName = P;
|
|
92
92
|
var Z = s.forwardRef((e, o) => {
|
|
93
93
|
const {
|
|
94
94
|
__scopeHoverCard: r,
|
|
@@ -96,8 +96,8 @@ var Z = s.forwardRef((e, o) => {
|
|
|
96
96
|
onPointerDownOutside: n,
|
|
97
97
|
onFocusOutside: c,
|
|
98
98
|
onInteractOutside: u,
|
|
99
|
-
...
|
|
100
|
-
} = e, d =
|
|
99
|
+
...f
|
|
100
|
+
} = e, d = R(P, r), l = x(r), p = s.useRef(null), C = z(o, p), [v, h] = s.useState(!1);
|
|
101
101
|
return s.useEffect(() => {
|
|
102
102
|
if (v) {
|
|
103
103
|
const t = document.body;
|
|
@@ -106,9 +106,9 @@ var Z = s.forwardRef((e, o) => {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
}, [v]), s.useEffect(() => {
|
|
109
|
-
if (
|
|
109
|
+
if (p.current) {
|
|
110
110
|
const t = () => {
|
|
111
|
-
|
|
111
|
+
h(!1), d.isPointerDownOnContentRef.current = !1, setTimeout(() => {
|
|
112
112
|
document.getSelection()?.toString() !== "" && (d.hasSelectionRef.current = !0);
|
|
113
113
|
});
|
|
114
114
|
};
|
|
@@ -117,30 +117,30 @@ var Z = s.forwardRef((e, o) => {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
}, [d.isPointerDownOnContentRef, d.hasSelectionRef]), s.useEffect(() => {
|
|
120
|
-
|
|
120
|
+
p.current && oe(p.current).forEach((g) => g.setAttribute("tabindex", "-1"));
|
|
121
121
|
}), /* @__PURE__ */ i(
|
|
122
|
-
|
|
122
|
+
J,
|
|
123
123
|
{
|
|
124
124
|
asChild: !0,
|
|
125
125
|
disableOutsidePointerEvents: !1,
|
|
126
126
|
onInteractOutside: u,
|
|
127
127
|
onEscapeKeyDown: a,
|
|
128
128
|
onPointerDownOutside: n,
|
|
129
|
-
onFocusOutside:
|
|
129
|
+
onFocusOutside: m(c, (t) => {
|
|
130
130
|
t.preventDefault();
|
|
131
131
|
}),
|
|
132
132
|
onDismiss: d.onDismiss,
|
|
133
133
|
children: /* @__PURE__ */ i(
|
|
134
|
-
|
|
134
|
+
j,
|
|
135
135
|
{
|
|
136
136
|
...l,
|
|
137
|
-
...
|
|
138
|
-
onPointerDown:
|
|
139
|
-
t.currentTarget.contains(t.target) &&
|
|
137
|
+
...f,
|
|
138
|
+
onPointerDown: m(f.onPointerDown, (t) => {
|
|
139
|
+
t.currentTarget.contains(t.target) && h(!0), d.hasSelectionRef.current = !1, d.isPointerDownOnContentRef.current = !0;
|
|
140
140
|
}),
|
|
141
|
-
ref:
|
|
141
|
+
ref: C,
|
|
142
142
|
style: {
|
|
143
|
-
...
|
|
143
|
+
...f.style,
|
|
144
144
|
userSelect: v ? "text" : void 0,
|
|
145
145
|
// Safari requires prefix
|
|
146
146
|
WebkitUserSelect: v ? "text" : void 0,
|
|
@@ -156,8 +156,8 @@ var Z = s.forwardRef((e, o) => {
|
|
|
156
156
|
);
|
|
157
157
|
}), ee = "HoverCardArrow", te = s.forwardRef(
|
|
158
158
|
(e, o) => {
|
|
159
|
-
const { __scopeHoverCard: r, ...a } = e, n =
|
|
160
|
-
return /* @__PURE__ */ i(
|
|
159
|
+
const { __scopeHoverCard: r, ...a } = e, n = x(r);
|
|
160
|
+
return /* @__PURE__ */ i(V, { ...n, ...a, ref: o });
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
te.displayName = ee;
|
|
@@ -171,10 +171,10 @@ function oe(e) {
|
|
|
171
171
|
for (; r.nextNode(); ) o.push(r.currentNode);
|
|
172
172
|
return o;
|
|
173
173
|
}
|
|
174
|
-
var re =
|
|
175
|
-
const
|
|
174
|
+
var re = _, ne = A, ae = L, se = M;
|
|
175
|
+
const k = I({}), ie = ({ align: e, alignOffset: o, collisionBoundary: r, collisionPadding: a, side: n, sideOffset: c, width: u, ...f }) => /* @__PURE__ */ i(k.Provider, { value: { side: n, sideOffset: c, align: e, alignOffset: o, collisionBoundary: r, collisionPadding: a, width: u }, children: /* @__PURE__ */ i(re, { "data-slot": "hover-card", "data-testid": "spectral-hover-card", ...f }) });
|
|
176
176
|
ie.displayName = "HoverCard";
|
|
177
|
-
const ce = ({
|
|
177
|
+
const ce = ({ className: e, ...o }) => /* @__PURE__ */ i(ne, { className: E("font-base", e), "data-slot": "hover-card-trigger", "data-testid": "spectral-hover-card-trigger", ...o });
|
|
178
178
|
ce.displayName = "HoverCardTrigger";
|
|
179
179
|
const de = ({
|
|
180
180
|
align: e,
|
|
@@ -184,17 +184,17 @@ const de = ({
|
|
|
184
184
|
collisionPadding: n,
|
|
185
185
|
side: c,
|
|
186
186
|
sideOffset: u,
|
|
187
|
-
width:
|
|
187
|
+
width: f,
|
|
188
188
|
...d
|
|
189
189
|
}) => {
|
|
190
|
-
const l =
|
|
190
|
+
const l = B(k), p = e ?? l.align ?? "center", C = u ?? l.sideOffset ?? 4, v = c ?? l.side ?? "bottom", h = f ?? l.width ?? 380, t = o ?? l.alignOffset, g = a ?? l.collisionBoundary, S = n ?? l.collisionPadding;
|
|
191
191
|
return /* @__PURE__ */ i(ae, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ i(
|
|
192
192
|
se,
|
|
193
193
|
{
|
|
194
|
-
align:
|
|
194
|
+
align: p,
|
|
195
195
|
alignOffset: t,
|
|
196
|
-
className:
|
|
197
|
-
"bg-popover-bg text-text-primary data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 origin-[--radix-hover-card-content-transform-origin] rounded-lg p-5 shadow-lg outline-none",
|
|
196
|
+
className: E(
|
|
197
|
+
"bg-popover-bg text-text-primary motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out 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 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 z-50 origin-[--radix-hover-card-content-transform-origin] rounded-lg p-5 shadow-lg outline-none",
|
|
198
198
|
r
|
|
199
199
|
),
|
|
200
200
|
collisionBoundary: g,
|
|
@@ -202,9 +202,9 @@ const de = ({
|
|
|
202
202
|
"data-slot": "hover-card-content",
|
|
203
203
|
"data-testid": "spectral-hover-card-content",
|
|
204
204
|
side: v,
|
|
205
|
-
sideOffset:
|
|
205
|
+
sideOffset: C,
|
|
206
206
|
style: {
|
|
207
|
-
width: typeof
|
|
207
|
+
width: typeof h == "number" ? `${h}px` : h === "trigger-width" ? "var(--radix-hover-card-trigger-width)" : "fit-content"
|
|
208
208
|
},
|
|
209
209
|
...d
|
|
210
210
|
}
|
|
@@ -3,8 +3,8 @@ import "../styles/main.css";
|
|
|
3
3
|
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
4
4
|
import { cn as f } from "../utils/twUtils.js";
|
|
5
5
|
import { useRef as p, useImperativeHandle as x, useCallback as i } from "react";
|
|
6
|
-
import { u as v } from "../use-animation-
|
|
7
|
-
import { m as A } from "../proxy-
|
|
6
|
+
import { u as v } from "../use-animation-CR-SdV2l.js";
|
|
7
|
+
import { m as A } from "../proxy-CgaCj1WQ.js";
|
|
8
8
|
const w = {
|
|
9
9
|
times: [0, 0.4, 1],
|
|
10
10
|
duration: 0.5
|
|
@@ -3,8 +3,8 @@ import "../styles/main.css";
|
|
|
3
3
|
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
4
4
|
import { cn as p } from "../utils/twUtils.js";
|
|
5
5
|
import { useRef as f, useImperativeHandle as x, useCallback as i } from "react";
|
|
6
|
-
import { u as v } from "../use-animation-
|
|
7
|
-
import { m as A } from "../proxy-
|
|
6
|
+
import { u as v } from "../use-animation-CR-SdV2l.js";
|
|
7
|
+
import { m as A } from "../proxy-CgaCj1WQ.js";
|
|
8
8
|
const w = {
|
|
9
9
|
times: [0, 0.4, 1],
|
|
10
10
|
duration: 0.5
|
|
@@ -4,12 +4,12 @@ export declare const usePrefixWidth: (prefix?: string) => {
|
|
|
4
4
|
prefixRef: Ref<HTMLSpanElement | null>;
|
|
5
5
|
};
|
|
6
6
|
export declare const usePasswordVisibility: () => {
|
|
7
|
+
inputType: "text" | "password";
|
|
7
8
|
isVisible: boolean;
|
|
8
9
|
toggleVisibility: () => void;
|
|
9
|
-
inputType: "text" | "password";
|
|
10
10
|
};
|
|
11
11
|
export declare const useClearOnFocus: (clearOnFocus: boolean, onChange?: (e: ChangeEvent<HTMLInputElement>) => void) => {
|
|
12
|
-
hasBeenFocused: boolean;
|
|
13
12
|
handleFocus: (e: FocusEvent<HTMLInputElement>, originalOnFocus?: (e: FocusEvent<HTMLInputElement>) => void) => void;
|
|
13
|
+
hasBeenFocused: boolean;
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=InputUtils.d.ts.map
|
package/dist/Input/InputUtils.js
CHANGED
|
@@ -12,17 +12,17 @@ const h = (t) => {
|
|
|
12
12
|
return i.observe(e.current), () => {
|
|
13
13
|
i.disconnect();
|
|
14
14
|
};
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
}
|
|
16
|
+
s(0);
|
|
17
17
|
}, [t]), { prefixWidth: r, prefixRef: e };
|
|
18
18
|
}, p = () => {
|
|
19
19
|
const [t, r] = u(!1), s = f(() => {
|
|
20
20
|
r((e) => !e);
|
|
21
21
|
}, []);
|
|
22
22
|
return {
|
|
23
|
+
inputType: t ? "text" : "password",
|
|
23
24
|
isVisible: t,
|
|
24
|
-
toggleVisibility: s
|
|
25
|
-
inputType: t ? "text" : "password"
|
|
25
|
+
toggleVisibility: s
|
|
26
26
|
};
|
|
27
27
|
}, v = (t, r) => {
|
|
28
28
|
const [s, e] = u(!1), n = f(
|
package/dist/Input.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'onC
|
|
|
18
18
|
value?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const Input: {
|
|
21
|
-
({
|
|
21
|
+
({ className, clearOnFocus, disabled, endIcon, errorMessage, id, label, labelClassName, name, onBlur, onChange, onFocus, placeholder, prefix, ref, required, showClearButton, startIcon, state, suppressHydrationWarning, type, value, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, ...props }: InputProps & {
|
|
22
22
|
ref?: Ref<HTMLInputElement>;
|
|
23
23
|
}): ReactElement;
|
|
24
24
|
displayName: string;
|
package/dist/Input.js
CHANGED
|
@@ -77,30 +77,30 @@ const gt = (...a) => (p) => {
|
|
|
77
77
|
i && (typeof i == "function" ? i(p) : i.current = p);
|
|
78
78
|
});
|
|
79
79
|
}, xt = (a) => ({
|
|
80
|
+
date: "off",
|
|
80
81
|
email: "email",
|
|
82
|
+
number: "off",
|
|
81
83
|
password: "current-password",
|
|
82
84
|
tel: "tel",
|
|
83
|
-
url: "url",
|
|
84
85
|
text: "off",
|
|
85
|
-
|
|
86
|
-
date: "off",
|
|
86
|
+
url: "url",
|
|
87
87
|
"datetime-local": "off"
|
|
88
88
|
})[a] || "off", Ct = ({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
disabled: k,
|
|
89
|
+
className: a,
|
|
90
|
+
clearOnFocus: p = !1,
|
|
91
|
+
disabled: i,
|
|
93
92
|
endIcon: b,
|
|
94
93
|
errorMessage: g,
|
|
95
|
-
id:
|
|
94
|
+
id: k,
|
|
96
95
|
label: e,
|
|
97
|
-
labelClassName:
|
|
96
|
+
labelClassName: P,
|
|
98
97
|
name: x,
|
|
99
98
|
onBlur: C,
|
|
100
99
|
onChange: n,
|
|
101
100
|
onFocus: w,
|
|
102
|
-
placeholder:
|
|
101
|
+
placeholder: R,
|
|
103
102
|
prefix: l,
|
|
103
|
+
ref: V,
|
|
104
104
|
required: v,
|
|
105
105
|
showClearButton: $ = !1,
|
|
106
106
|
startIcon: y,
|
|
@@ -112,7 +112,7 @@ const gt = (...a) => (p) => {
|
|
|
112
112
|
"aria-describedby": O,
|
|
113
113
|
...j
|
|
114
114
|
}) => {
|
|
115
|
-
const m = ct(
|
|
115
|
+
const m = ct(k, x), N = `${m}-error`, { isDisabled: F, isLoading: A, isInvalid: B } = mt(i, s), H = dt(s, O, v, N), E = bt(null), T = gt(V, E), { isVisible: u, toggleVisibility: W, inputType: D } = tt(), { prefixWidth: G, prefixRef: J } = rt(l), { handleFocus: z } = et(p, n ? (r) => n(r.target.value) : void 0), K = d(
|
|
116
116
|
(r) => {
|
|
117
117
|
C?.(r);
|
|
118
118
|
},
|
|
@@ -133,16 +133,16 @@ const gt = (...a) => (p) => {
|
|
|
133
133
|
r && (r.value = "", r.dispatchEvent(new Event("input", { bubbles: !0 })), r.focus());
|
|
134
134
|
}, []), S = $ && I.length > 0, Y = () => {
|
|
135
135
|
const r = "absolute right-4 top-1/2 -translate-y-1/2 text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer", o = {
|
|
136
|
-
password: () => /* @__PURE__ */ t("button", { "aria-controls": m, "aria-label": u ? `Hide ${e
|
|
137
|
-
clear: () => /* @__PURE__ */ t("button", { "aria-label": `Clear ${e
|
|
136
|
+
password: () => /* @__PURE__ */ t("button", { "aria-controls": m, "aria-label": u ? `Hide ${e ?? "password"}` : `Show ${e ?? "password"}`, "aria-pressed": u, className: r, "data-testid": "spectral-input-password-toggle", onClick: W, type: "button", children: u ? /* @__PURE__ */ t(at, { size: 22 }) : /* @__PURE__ */ t(pt, { size: 22 }) }),
|
|
137
|
+
clear: () => /* @__PURE__ */ t("button", { "aria-label": `Clear ${e ?? "input"}`, className: r, "data-testid": "spectral-input-clear-button", onClick: X, type: "button", children: /* @__PURE__ */ t(it, { size: 24 }) }),
|
|
138
138
|
loading: () => /* @__PURE__ */ t("div", { className: "text-input-icon absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "spectral-input-loading-icon", children: /* @__PURE__ */ t(nt, { size: 24 }) }),
|
|
139
139
|
error: () => /* @__PURE__ */ t("div", { className: "text-danger-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "spectral-input-error-icon", children: /* @__PURE__ */ t(st, { size: 24 }) }),
|
|
140
140
|
success: () => /* @__PURE__ */ t("div", { className: "text-success-400 absolute top-1/2 right-4 -translate-y-1/2", "data-testid": "spectral-input-success-icon", children: /* @__PURE__ */ t(ot, { size: 24 }) })
|
|
141
141
|
};
|
|
142
142
|
return b ? /* @__PURE__ */ t("div", { className: "text-input-icon absolute top-1/2 right-4 -translate-y-1/2", children: b }) : c === "password" ? o.password() : S ? o.clear() : A ? o.loading() : s === "success" ? o.success() : s === "error" ? o.error() : null;
|
|
143
|
-
}, Z = () => y || null, _ = h(ut(s,
|
|
143
|
+
}, Z = () => y || null, _ = h(ut(s, a), "[text-indent:var(--prefix-width)]", S && "pr-10"), q = h("pointer-events-none absolute inset-y-0 left-4 flex items-center text-base text-input-text-prefix opacity-100 peer-disabled:opacity-50");
|
|
144
144
|
return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5", "data-testid": "spectral-input-container", children: [
|
|
145
|
-
e && /* @__PURE__ */ t(lt, { className: h("mb-2 block",
|
|
145
|
+
e && /* @__PURE__ */ t(lt, { className: h("mb-2 block", P, F && "text-input-text--disabled placeholder:text-input-text-placeholder cursor-not-allowed"), "data-testid": "spectral-input-label", htmlFor: m, children: e }),
|
|
146
146
|
/* @__PURE__ */ f("div", { className: "relative", "data-testid": "spectral-input-wrapper", children: [
|
|
147
147
|
/* @__PURE__ */ f("div", { className: "relative", children: [
|
|
148
148
|
Z(),
|
|
@@ -150,7 +150,7 @@ const gt = (...a) => (p) => {
|
|
|
150
150
|
/* @__PURE__ */ t(
|
|
151
151
|
"input",
|
|
152
152
|
{
|
|
153
|
-
"aria-label": M
|
|
153
|
+
"aria-label": M ?? e,
|
|
154
154
|
autoComplete: xt(c),
|
|
155
155
|
className: _,
|
|
156
156
|
"data-state": s,
|
|
@@ -161,11 +161,11 @@ const gt = (...a) => (p) => {
|
|
|
161
161
|
onBlur: K,
|
|
162
162
|
onChange: U,
|
|
163
163
|
onFocus: Q,
|
|
164
|
-
placeholder:
|
|
164
|
+
placeholder: R ?? e,
|
|
165
165
|
ref: T,
|
|
166
166
|
required: v,
|
|
167
167
|
style: ft({
|
|
168
|
-
"--prefix-width": l ? `${G}px` : "
|
|
168
|
+
"--prefix-width": l ? `${G}px` : "0"
|
|
169
169
|
}),
|
|
170
170
|
suppressHydrationWarning: L,
|
|
171
171
|
type: c === "password" ? D : c,
|
package/dist/InputOTP.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormFieldState } from './utils/formFieldUtils';
|
|
2
2
|
import { OTPInput, OTPInputProps } from 'input-otp';
|
|
3
3
|
import { ComponentPropsWithoutRef, ComponentRef, Ref } from 'react';
|
|
4
|
-
|
|
4
|
+
export interface InputOTPBaseProps extends Omit<OTPInputProps, 'textAlign' | 'pushPasswordManagerStrategy' | 'pasteTransformer' | 'noScriptCSSFallback' | 'placeholder' | 'containerClassName' | 'render' | 'pattern'> {
|
|
5
5
|
onComplete?: (...args: unknown[]) => void;
|
|
6
6
|
className?: string;
|
|
7
7
|
errorMessage?: string | undefined;
|
|
@@ -15,21 +15,21 @@ type InputOTPRootProps = Omit<OTPInputProps, 'textAlign' | 'pushPasswordManagerS
|
|
|
15
15
|
separator?: boolean;
|
|
16
16
|
state?: FormFieldState;
|
|
17
17
|
variant?: 'outlined' | 'filled';
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
type InputOTPProps = InputOTPBaseProps & ({
|
|
20
20
|
value: number | string;
|
|
21
21
|
onChange: (newValue: number | string) => void;
|
|
22
22
|
} | {
|
|
23
23
|
value?: never;
|
|
24
24
|
onChange?: never;
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
start?: number;
|
|
28
|
-
count?: number;
|
|
26
|
+
interface SlotsProps {
|
|
29
27
|
className?: string;
|
|
30
|
-
|
|
28
|
+
count?: number;
|
|
29
|
+
start?: number;
|
|
30
|
+
}
|
|
31
31
|
export declare const InputOTP: {
|
|
32
|
-
({
|
|
32
|
+
({ autoFocus, children, className, errorMessage, id, inputMode, maxLength, name, onChange, onComplete, pattern, ref, state, value, variant, ...props }: InputOTPProps & {
|
|
33
33
|
ref?: Ref<ComponentRef<typeof OTPInput>>;
|
|
34
34
|
}): import("react/jsx-runtime").JSX.Element;
|
|
35
35
|
displayName: string;
|
|
@@ -41,9 +41,9 @@ export declare const InputOTP: {
|
|
|
41
41
|
displayName: string;
|
|
42
42
|
};
|
|
43
43
|
Slot: {
|
|
44
|
-
({
|
|
45
|
-
ref?: Ref<ComponentRef<"div">>;
|
|
44
|
+
({ className, index, ref, ...props }: ComponentPropsWithoutRef<"div"> & {
|
|
46
45
|
index: number;
|
|
46
|
+
ref?: Ref<ComponentRef<"div">>;
|
|
47
47
|
}): import("react/jsx-runtime").JSX.Element;
|
|
48
48
|
displayName: string;
|
|
49
49
|
};
|