@spear-ai/spectral 1.4.25 → 1.4.27
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/Accordion.d.ts +28 -9
- package/dist/Accordion.js +203 -183
- package/dist/Alert/AlertBase.d.ts +24 -16
- package/dist/Alert/AlertBase.js +33 -18
- package/dist/Alert.js +1 -1
- package/dist/Avatar.js +11 -11
- package/dist/Button.d.ts +7 -2
- package/dist/Button.js +25 -12
- package/dist/ButtonIcon.d.ts +7 -2
- package/dist/ButtonIcon.js +25 -16
- package/dist/Card.js +1 -1
- package/dist/Checkbox/CheckboxBase.d.ts +13 -13
- package/dist/Checkbox/CheckboxBase.js +128 -125
- package/dist/Checkbox.d.ts +7 -2
- package/dist/Checkbox.js +29 -22
- package/dist/DataCard.js +3 -3
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +2 -2
- package/dist/HoverCard.js +1 -1
- package/dist/Icons/AnalyzeIcon.d.ts +3 -1
- package/dist/Icons/AnalyzeIcon.js +3 -6
- package/dist/Icons/AnnotationsIcon.d.ts +3 -1
- package/dist/Icons/AnnotationsIcon.js +3 -6
- package/dist/Icons/ApprovedIcon.d.ts +3 -1
- package/dist/Icons/ApprovedIcon.js +3 -6
- package/dist/Icons/ArrowDownIcon.d.ts +3 -1
- package/dist/Icons/ArrowDownIcon.js +3 -6
- package/dist/Icons/ArrowUpIcon.d.ts +3 -1
- package/dist/Icons/ArrowUpIcon.js +4 -7
- package/dist/Icons/CalendarIcon.d.ts +3 -1
- package/dist/Icons/CalendarIcon.js +9 -12
- package/dist/Icons/CheckCircleIcon.d.ts +3 -1
- package/dist/Icons/CheckCircleIcon.js +2 -5
- package/dist/Icons/CheckSquareIcon.d.ts +3 -1
- package/dist/Icons/CheckSquareIcon.js +4 -7
- package/dist/Icons/CheckmarkIcon.d.ts +3 -1
- package/dist/Icons/CheckmarkIcon.js +5 -8
- package/dist/Icons/ChevronDownIcon.d.ts +3 -1
- package/dist/Icons/ChevronDownIcon.js +5 -8
- package/dist/Icons/ChevronUpIcon.d.ts +3 -1
- package/dist/Icons/ChevronUpIcon.js +5 -8
- package/dist/Icons/ClockIcon.d.ts +3 -1
- package/dist/Icons/ClockIcon.js +5 -8
- package/dist/Icons/CloseCircleIcon.d.ts +3 -1
- package/dist/Icons/CloseCircleIcon.js +4 -7
- package/dist/Icons/CloseIcon.d.ts +3 -1
- package/dist/Icons/CloseIcon.js +5 -8
- package/dist/Icons/DashboardIcon.d.ts +3 -1
- package/dist/Icons/DashboardIcon.js +3 -6
- package/dist/Icons/DatabaseIcon.d.ts +3 -1
- package/dist/Icons/DatabaseIcon.js +4 -7
- package/dist/Icons/DeleteIcon.d.ts +3 -1
- package/dist/Icons/DeleteIcon.js +4 -7
- package/dist/Icons/DurationIcon.d.ts +3 -1
- package/dist/Icons/DurationIcon.js +3 -6
- package/dist/Icons/EditIcon.d.ts +3 -1
- package/dist/Icons/EditIcon.js +3 -6
- package/dist/Icons/EmailIcon.d.ts +3 -1
- package/dist/Icons/EmailIcon.js +4 -7
- package/dist/Icons/EraserIcon.d.ts +3 -1
- package/dist/Icons/EraserIcon.js +9 -10
- package/dist/Icons/ErrorIcon.d.ts +3 -1
- package/dist/Icons/ErrorIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon2.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon2.js +3 -6
- package/dist/Icons/EyeOpenIcon.d.ts +3 -1
- package/dist/Icons/EyeOpenIcon.js +6 -9
- package/dist/Icons/GoToFirstIcon.d.ts +3 -1
- package/dist/Icons/GoToFirstIcon.js +4 -7
- package/dist/Icons/GoToLastIcon.d.ts +3 -1
- package/dist/Icons/GoToLastIcon.js +4 -7
- package/dist/Icons/HarmonicCursorsIcon.d.ts +3 -1
- package/dist/Icons/HarmonicCursorsIcon.js +4 -7
- package/dist/Icons/IconBase.d.ts +4 -2
- package/dist/Icons/IconBase.js +17 -8
- package/dist/Icons/InfoIcon.d.ts +3 -1
- package/dist/Icons/InfoIcon.js +4 -7
- package/dist/Icons/LabelIcon.d.ts +3 -1
- package/dist/Icons/LabelIcon.js +3 -6
- package/dist/Icons/LassoIcon.d.ts +3 -1
- package/dist/Icons/LassoIcon.js +5 -8
- package/dist/Icons/LineToolIcon.d.ts +3 -1
- package/dist/Icons/LineToolIcon.js +3 -6
- package/dist/Icons/LineToolIcon2.d.ts +3 -1
- package/dist/Icons/LineToolIcon2.js +3 -6
- package/dist/Icons/LiveViewIcon.d.ts +3 -1
- package/dist/Icons/LiveViewIcon.js +2 -5
- package/dist/Icons/LoaderIcon.d.ts +3 -1
- package/dist/Icons/LoaderIcon.js +6 -7
- package/dist/Icons/LocationIcon.d.ts +3 -1
- package/dist/Icons/LocationIcon.js +3 -6
- package/dist/Icons/LogoutIcon.d.ts +3 -1
- package/dist/Icons/LogoutIcon.js +4 -7
- package/dist/Icons/MessagesIcon.d.ts +3 -1
- package/dist/Icons/MessagesIcon.js +5 -8
- package/dist/Icons/MetadataIcon.d.ts +3 -1
- package/dist/Icons/MetadataIcon.js +4 -7
- package/dist/Icons/MinusIcon.d.ts +3 -1
- package/dist/Icons/MinusIcon.js +3 -6
- package/dist/Icons/OntologyIcon.d.ts +3 -1
- package/dist/Icons/OntologyIcon.js +2 -5
- package/dist/Icons/PanelIconClose.d.ts +3 -1
- package/dist/Icons/PanelIconClose.js +4 -7
- package/dist/Icons/PanelIconOpen.d.ts +3 -1
- package/dist/Icons/PanelIconOpen.js +8 -11
- package/dist/Icons/PlayIcon.d.ts +3 -1
- package/dist/Icons/PlayIcon.js +3 -6
- package/dist/Icons/PlusIcon.d.ts +3 -1
- package/dist/Icons/PlusIcon.js +4 -7
- package/dist/Icons/ResetIcon.d.ts +3 -1
- package/dist/Icons/ResetIcon.js +4 -7
- package/dist/Icons/ReviewedIcon.d.ts +3 -1
- package/dist/Icons/ReviewedIcon.js +3 -6
- package/dist/Icons/ScissorsIcon.d.ts +3 -1
- package/dist/Icons/ScissorsIcon.js +6 -9
- package/dist/Icons/SettingsIcon.d.ts +3 -1
- package/dist/Icons/SettingsIcon.js +3 -6
- package/dist/Icons/SortAscendingIcon.d.ts +3 -1
- package/dist/Icons/SortAscendingIcon.js +3 -6
- package/dist/Icons/SortAtoZIcon.d.ts +3 -1
- package/dist/Icons/SortAtoZIcon.js +3 -6
- package/dist/Icons/SortDescendingIcon.d.ts +3 -1
- package/dist/Icons/SortDescendingIcon.js +3 -6
- package/dist/Icons/SortZtoAIcon.d.ts +3 -1
- package/dist/Icons/SortZtoAIcon.js +3 -6
- package/dist/Icons/StackIcon.d.ts +3 -1
- package/dist/Icons/StackIcon.js +4 -7
- package/dist/Icons/StarIcon.d.ts +3 -1
- package/dist/Icons/StarIcon.js +3 -6
- package/dist/Icons/TrashIcon.d.ts +3 -1
- package/dist/Icons/TrashIcon.js +3 -6
- package/dist/Icons/UndoIcon.d.ts +3 -1
- package/dist/Icons/UndoIcon.js +4 -7
- package/dist/Icons/UserIcon.d.ts +3 -1
- package/dist/Icons/UserIcon.js +3 -6
- package/dist/Icons/WarningIcon.d.ts +3 -1
- package/dist/Icons/WarningIcon.js +5 -8
- package/dist/Icons/ZoomAllIcon.d.ts +3 -1
- package/dist/Icons/ZoomAllIcon.js +3 -6
- package/dist/Icons/ZoomXIcon.d.ts +3 -1
- package/dist/Icons/ZoomXIcon.js +4 -7
- package/dist/Icons/ZoomYIcon.d.ts +3 -1
- package/dist/Icons/ZoomYIcon.js +4 -7
- package/dist/Input/InputUtils.d.ts +4 -4
- package/dist/Input/InputUtils.js +1 -1
- package/dist/Input.d.ts +7 -17
- package/dist/Input.js +105 -101
- package/dist/InputOTP.d.ts +27 -7
- package/dist/InputOTP.js +171 -146
- package/dist/Label.d.ts +7 -2
- package/dist/Label.js +12 -9
- package/dist/MultiSelect/MultiSelectBase.d.ts +7 -2
- package/dist/MultiSelect/MultiSelectBase.js +212 -213
- package/dist/{MultiSelect/MutiSelect.d.ts → MultiSelect.d.ts} +8 -2
- package/dist/MultiSelect.js +27 -0
- package/dist/Popover.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +20 -14
- package/dist/RadioGroup.js +177 -148
- package/dist/Select.d.ts +7 -2
- package/dist/Select.js +108 -109
- package/dist/Separator.d.ts +8 -8
- package/dist/Separator.js +14 -15
- package/dist/Switch/SwitchBase.d.ts +13 -11
- package/dist/Switch/SwitchBase.js +84 -61
- package/dist/Switch.d.ts +11 -4
- package/dist/Switch.js +19 -20
- package/dist/Tabs/TabsBase.d.ts +16 -6
- package/dist/Tabs/TabsBase.js +133 -96
- package/dist/Tabs/tabsUtils.d.ts +6 -2
- package/dist/Tabs/tabsUtils.js +5 -2
- package/dist/Tabs.js +18 -18
- package/dist/Textarea.d.ts +7 -2
- package/dist/Textarea.js +78 -61
- package/dist/Toggle/ToggleBase.d.ts +4 -8
- package/dist/Toggle/ToggleBase.js +29 -16
- package/dist/Toggle.d.ts +4 -2
- package/dist/Toggle.js +23 -13
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +4 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +82 -73
- package/dist/ToggleGroup.d.ts +7 -2
- package/dist/ToggleGroup.js +31 -19
- package/dist/Tray.d.ts +47 -15
- package/dist/Tray.js +98 -60
- package/dist/hooks/useAccordionAutoScroll.d.ts +1 -1
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +35 -34
- package/dist/{index-BSCg4Mei.js → index-B0Kp8R0j.js} +3 -3
- package/dist/{index-jgQ7sgLl.js → index-D4jMMaAi.js} +5 -5
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -4
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +4 -11
- package/dist/primitives/slot.d.ts +11 -4
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +32 -28
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +1 -3
- package/dist/utils/formFieldUtils.js +2 -2
- package/package.json +1 -1
- package/dist/MultiSelect/MutiSelect.js +0 -19
package/dist/InputOTP.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
3
|
+
import { jsx as k, jsxs as ft } from "react/jsx-runtime";
|
|
4
4
|
import "./Icons/AnalyzeIcon.js";
|
|
5
5
|
import "./Icons/AnnotationsIcon.js";
|
|
6
6
|
import "./Icons/ApprovedIcon.js";
|
|
@@ -40,7 +40,7 @@ import "./Icons/LocationIcon.js";
|
|
|
40
40
|
import "./Icons/LogoutIcon.js";
|
|
41
41
|
import "./Icons/MessagesIcon.js";
|
|
42
42
|
import "./Icons/MetadataIcon.js";
|
|
43
|
-
import { MinusIcon as
|
|
43
|
+
import { MinusIcon as Nt } from "./Icons/MinusIcon.js";
|
|
44
44
|
import "./Icons/OntologyIcon.js";
|
|
45
45
|
import "./Icons/PanelIconClose.js";
|
|
46
46
|
import "./Icons/PanelIconOpen.js";
|
|
@@ -63,170 +63,170 @@ import "./Icons/WarningIcon.js";
|
|
|
63
63
|
import "./Icons/ZoomAllIcon.js";
|
|
64
64
|
import "./Icons/ZoomXIcon.js";
|
|
65
65
|
import "./Icons/ZoomYIcon.js";
|
|
66
|
-
import { useFormFieldId as
|
|
67
|
-
import { cn as
|
|
66
|
+
import { useFormFieldId as _t, ErrorMessage as Ht, getErrorMessageId as Gt } from "./utils/formFieldUtils.js";
|
|
67
|
+
import { cn as vt } from "./utils/twUtils.js";
|
|
68
68
|
import * as r from "react";
|
|
69
|
-
import { createContext as
|
|
70
|
-
var
|
|
71
|
-
for (var a in n || (n = {}))
|
|
72
|
-
if (K) for (var a of K(n))
|
|
69
|
+
import { createContext as gt, useContext as ht } from "react";
|
|
70
|
+
var Lt = Object.defineProperty, zt = Object.defineProperties, $t = Object.getOwnPropertyDescriptors, K = Object.getOwnPropertySymbols, bt = Object.prototype.hasOwnProperty, wt = Object.prototype.propertyIsEnumerable, mt = (t, n, a) => n in t ? Lt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[n] = a, Vt = (t, n) => {
|
|
71
|
+
for (var a in n || (n = {})) bt.call(n, a) && mt(t, a, n[a]);
|
|
72
|
+
if (K) for (var a of K(n)) wt.call(n, a) && mt(t, a, n[a]);
|
|
73
73
|
return t;
|
|
74
|
-
},
|
|
74
|
+
}, qt = (t, n) => zt(t, $t(n)), Zt = (t, n) => {
|
|
75
75
|
var a = {};
|
|
76
|
-
for (var u in t)
|
|
77
|
-
if (t != null && K) for (var u of K(t)) n.indexOf(u) < 0 &&
|
|
76
|
+
for (var u in t) bt.call(t, u) && n.indexOf(u) < 0 && (a[u] = t[u]);
|
|
77
|
+
if (t != null && K) for (var u of K(t)) n.indexOf(u) < 0 && wt.call(t, u) && (a[u] = t[u]);
|
|
78
78
|
return a;
|
|
79
79
|
};
|
|
80
|
-
function
|
|
80
|
+
function Jt(t) {
|
|
81
81
|
let n = setTimeout(t, 0), a = setTimeout(t, 10), u = setTimeout(t, 50);
|
|
82
82
|
return [n, a, u];
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Kt(t) {
|
|
85
85
|
let n = r.useRef();
|
|
86
86
|
return r.useEffect(() => {
|
|
87
87
|
n.current = t;
|
|
88
88
|
}), n.current;
|
|
89
89
|
}
|
|
90
|
-
var
|
|
91
|
-
function
|
|
92
|
-
let [v, s] = r.useState(!1), [b,
|
|
93
|
-
let f = t.current,
|
|
94
|
-
if (!f || !
|
|
95
|
-
let g = f, w = g.getBoundingClientRect().left + g.offsetWidth, I = g.getBoundingClientRect().top + g.offsetHeight / 2, l = w -
|
|
96
|
-
document.querySelectorAll(
|
|
97
|
-
}, [t, n,
|
|
90
|
+
var Qt = 18, xt = 40, Ut = `${xt}px`, Xt = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
91
|
+
function Yt({ containerRef: t, inputRef: n, pushPasswordManagerStrategy: a, isFocused: u }) {
|
|
92
|
+
let [v, s] = r.useState(!1), [b, m] = r.useState(!1), [C, j] = r.useState(!1), M = r.useMemo(() => a === "none" ? !1 : (a === "increase-width" || a === "experimental-no-flickering") && v && b, [v, b, a]), R = r.useCallback(() => {
|
|
93
|
+
let f = t.current, y = n.current;
|
|
94
|
+
if (!f || !y || C || a === "none") return;
|
|
95
|
+
let g = f, w = g.getBoundingClientRect().left + g.offsetWidth, I = g.getBoundingClientRect().top + g.offsetHeight / 2, l = w - Qt, O = I;
|
|
96
|
+
document.querySelectorAll(Xt).length === 0 && document.elementFromPoint(l, O) === f || (s(!0), j(!0));
|
|
97
|
+
}, [t, n, C, a]);
|
|
98
98
|
return r.useEffect(() => {
|
|
99
99
|
let f = t.current;
|
|
100
100
|
if (!f || a === "none") return;
|
|
101
|
-
function
|
|
101
|
+
function y() {
|
|
102
102
|
let w = window.innerWidth - f.getBoundingClientRect().right;
|
|
103
|
-
|
|
103
|
+
m(w >= xt);
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
let g = setInterval(
|
|
105
|
+
y();
|
|
106
|
+
let g = setInterval(y, 1e3);
|
|
107
107
|
return () => {
|
|
108
108
|
clearInterval(g);
|
|
109
109
|
};
|
|
110
110
|
}, [t, a]), r.useEffect(() => {
|
|
111
111
|
let f = u || document.activeElement === n.current;
|
|
112
112
|
if (a === "none" || !f) return;
|
|
113
|
-
let
|
|
114
|
-
|
|
113
|
+
let y = setTimeout(R, 0), g = setTimeout(R, 2e3), w = setTimeout(R, 5e3), I = setTimeout(() => {
|
|
114
|
+
j(!0);
|
|
115
115
|
}, 6e3);
|
|
116
116
|
return () => {
|
|
117
|
-
clearTimeout(
|
|
117
|
+
clearTimeout(y), clearTimeout(g), clearTimeout(w), clearTimeout(I);
|
|
118
118
|
};
|
|
119
|
-
}, [n, u, a, R]), { hasPWMBadge: v, willPushPWMBadge:
|
|
119
|
+
}, [n, u, a, R]), { hasPWMBadge: v, willPushPWMBadge: M, PWM_BADGE_SPACE_WIDTH: Ut };
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
var a = t, { value: u, onChange: v, maxLength: s, textAlign: b = "left", pattern:
|
|
123
|
-
let [
|
|
124
|
-
v?.(e),
|
|
125
|
-
}, [v]),
|
|
121
|
+
var te = r.createContext({}), Et = r.forwardRef((t, n) => {
|
|
122
|
+
var a = t, { value: u, onChange: v, maxLength: s, textAlign: b = "left", pattern: m, placeholder: C, inputMode: j = "numeric", onComplete: M, pushPasswordManagerStrategy: R = "increase-width", pasteTransformer: f, containerClassName: y, noScriptCSSFallback: g = ee, render: w, children: I } = a, l = Zt(a, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), O, et, rt, nt, ot;
|
|
123
|
+
let [Rt, It] = r.useState(typeof l.defaultValue == "string" ? l.defaultValue : ""), p = u ?? Rt, W = Kt(p), L = r.useCallback((e) => {
|
|
124
|
+
v?.(e), It(e);
|
|
125
|
+
}, [v]), P = r.useMemo(() => m ? typeof m == "string" ? new RegExp(m) : m : null, [m]), c = r.useRef(null), Q = r.useRef(null), U = r.useRef({ value: p, onChange: L, isIOS: typeof window < "u" && ((et = (O = window?.CSS) == null ? void 0 : O.supports) == null ? void 0 : et.call(O, "-webkit-touch-callout", "none")) }), Z = r.useRef({ prev: [(rt = c.current) == null ? void 0 : rt.selectionStart, (nt = c.current) == null ? void 0 : nt.selectionEnd, (ot = c.current) == null ? void 0 : ot.selectionDirection] });
|
|
126
126
|
r.useImperativeHandle(n, () => c.current, []), r.useEffect(() => {
|
|
127
|
-
let e = c.current, o =
|
|
127
|
+
let e = c.current, o = Q.current;
|
|
128
128
|
if (!e || !o) return;
|
|
129
|
-
|
|
130
|
-
function
|
|
129
|
+
U.current.value !== e.value && U.current.onChange(e.value), Z.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
|
|
130
|
+
function d() {
|
|
131
131
|
if (document.activeElement !== e) {
|
|
132
132
|
$(null), V(null);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
let i = e.selectionStart, h = e.selectionEnd, J = e.selectionDirection, S = e.maxLength, F = e.value,
|
|
135
|
+
let i = e.selectionStart, h = e.selectionEnd, J = e.selectionDirection, S = e.maxLength, F = e.value, T = Z.current.prev, A = -1, D = -1, N;
|
|
136
136
|
if (F.length !== 0 && i !== null && h !== null) {
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
137
|
+
let Wt = i === h, Bt = i === F.length && F.length < S;
|
|
138
|
+
if (Wt && !Bt) {
|
|
139
139
|
let _ = i;
|
|
140
|
-
if (_ === 0)
|
|
141
|
-
else if (_ === S)
|
|
140
|
+
if (_ === 0) A = 0, D = 1, N = "forward";
|
|
141
|
+
else if (_ === S) A = _ - 1, D = _, N = "backward";
|
|
142
142
|
else if (S > 1 && F.length > 1) {
|
|
143
|
-
let
|
|
144
|
-
if (
|
|
145
|
-
N = _ <
|
|
146
|
-
let
|
|
147
|
-
N === "backward" && !
|
|
143
|
+
let tt = 0;
|
|
144
|
+
if (T[0] !== null && T[1] !== null) {
|
|
145
|
+
N = _ < T[1] ? "backward" : "forward";
|
|
146
|
+
let Ft = T[0] === T[1] && T[0] < S;
|
|
147
|
+
N === "backward" && !Ft && (tt = -1);
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
A = tt + _, D = tt + _ + 1;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
A !== -1 && D !== -1 && A !== D && c.current.setSelectionRange(A, D, N);
|
|
153
153
|
}
|
|
154
|
-
let
|
|
155
|
-
$(
|
|
154
|
+
let ct = A !== -1 ? A : i, dt = D !== -1 ? D : h, jt = N ?? J;
|
|
155
|
+
$(ct), V(dt), Z.current.prev = [ct, dt, jt];
|
|
156
156
|
}
|
|
157
|
-
if (document.addEventListener("selectionchange",
|
|
157
|
+
if (document.addEventListener("selectionchange", d, { capture: !0 }), d(), document.activeElement === e && X(!0), !document.getElementById("input-otp-style")) {
|
|
158
158
|
let i = document.createElement("style");
|
|
159
159
|
if (i.id = "input-otp-style", document.head.appendChild(i), i.sheet) {
|
|
160
160
|
let h = "background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";
|
|
161
161
|
q(i.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), q(i.sheet, `[data-input-otp]:autofill { ${h} }`), q(i.sheet, `[data-input-otp]:-webkit-autofill { ${h} }`), q(i.sheet, "@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"), q(i.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
let
|
|
164
|
+
let x = () => {
|
|
165
165
|
o && o.style.setProperty("--root-height", `${e.clientHeight}px`);
|
|
166
166
|
};
|
|
167
|
-
|
|
168
|
-
let
|
|
169
|
-
return
|
|
170
|
-
document.removeEventListener("selectionchange",
|
|
167
|
+
x();
|
|
168
|
+
let E = new ResizeObserver(x);
|
|
169
|
+
return E.observe(e), () => {
|
|
170
|
+
document.removeEventListener("selectionchange", d, { capture: !0 }), E.disconnect();
|
|
171
171
|
};
|
|
172
172
|
}, []);
|
|
173
|
-
let [
|
|
173
|
+
let [at, lt] = r.useState(!1), [z, X] = r.useState(!1), [B, $] = r.useState(null), [H, V] = r.useState(null);
|
|
174
174
|
r.useEffect(() => {
|
|
175
|
-
|
|
176
|
-
var e, o,
|
|
175
|
+
Jt(() => {
|
|
176
|
+
var e, o, d, x;
|
|
177
177
|
(e = c.current) == null || e.dispatchEvent(new Event("input"));
|
|
178
|
-
let
|
|
179
|
-
|
|
178
|
+
let E = (o = c.current) == null ? void 0 : o.selectionStart, i = (d = c.current) == null ? void 0 : d.selectionEnd, h = (x = c.current) == null ? void 0 : x.selectionDirection;
|
|
179
|
+
E !== null && i !== null && ($(E), V(i), Z.current.prev = [E, i, h]);
|
|
180
180
|
});
|
|
181
181
|
}, [p, z]), r.useEffect(() => {
|
|
182
|
-
W !== void 0 && p !== W && W.length < s && p.length === s &&
|
|
183
|
-
}, [s,
|
|
184
|
-
let G =
|
|
182
|
+
W !== void 0 && p !== W && W.length < s && p.length === s && M?.(p);
|
|
183
|
+
}, [s, M, W, p]);
|
|
184
|
+
let G = Yt({ containerRef: Q, inputRef: c, pushPasswordManagerStrategy: R, isFocused: z }), it = r.useCallback((e) => {
|
|
185
185
|
let o = e.currentTarget.value.slice(0, s);
|
|
186
|
-
if (o.length > 0 &&
|
|
186
|
+
if (o.length > 0 && P && !P.test(o)) {
|
|
187
187
|
e.preventDefault();
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
typeof W == "string" && o.length < W.length && document.dispatchEvent(new Event("selectionchange")), L(o);
|
|
191
|
-
}, [s, L, W,
|
|
191
|
+
}, [s, L, W, P]), ut = r.useCallback(() => {
|
|
192
192
|
var e;
|
|
193
193
|
if (c.current) {
|
|
194
|
-
let o = Math.min(c.current.value.length, s - 1),
|
|
195
|
-
(e = c.current) == null || e.setSelectionRange(o,
|
|
194
|
+
let o = Math.min(c.current.value.length, s - 1), d = c.current.value.length;
|
|
195
|
+
(e = c.current) == null || e.setSelectionRange(o, d), $(o), V(d);
|
|
196
196
|
}
|
|
197
|
-
|
|
198
|
-
}, [s]),
|
|
199
|
-
var o,
|
|
200
|
-
let
|
|
201
|
-
if (!f && (!
|
|
202
|
-
let
|
|
197
|
+
X(!0);
|
|
198
|
+
}, [s]), st = r.useCallback((e) => {
|
|
199
|
+
var o, d;
|
|
200
|
+
let x = c.current;
|
|
201
|
+
if (!f && (!U.current.isIOS || !e.clipboardData || !x)) return;
|
|
202
|
+
let E = e.clipboardData.getData("text/plain"), i = f ? f(E) : E;
|
|
203
203
|
e.preventDefault();
|
|
204
|
-
let h = (o = c.current) == null ? void 0 : o.selectionStart, J = (
|
|
205
|
-
if (S.length > 0 &&
|
|
206
|
-
|
|
207
|
-
let F = Math.min(S.length, s - 1),
|
|
208
|
-
|
|
209
|
-
}, [s, L,
|
|
204
|
+
let h = (o = c.current) == null ? void 0 : o.selectionStart, J = (d = c.current) == null ? void 0 : d.selectionEnd, S = (h !== J ? p.slice(0, h) + i + p.slice(J) : p.slice(0, h) + i + p.slice(h)).slice(0, s);
|
|
205
|
+
if (S.length > 0 && P && !P.test(S)) return;
|
|
206
|
+
x.value = S, L(S);
|
|
207
|
+
let F = Math.min(S.length, s - 1), T = S.length;
|
|
208
|
+
x.setSelectionRange(F, T), $(F), V(T);
|
|
209
|
+
}, [s, L, P, p]), Ot = r.useMemo(() => ({ position: "relative", cursor: l.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [l.disabled]), pt = r.useMemo(() => ({ position: "absolute", inset: 0, width: G.willPushPWMBadge ? `calc(100% + ${G.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: G.willPushPWMBadge ? `inset(0 ${G.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: b, opacity: "1", color: "transparent", pointerEvents: "all", background: "transparent", caretColor: "transparent", border: "0 solid transparent", outline: "0 solid transparent", boxShadow: "none", lineHeight: "1", letterSpacing: "-.5em", fontSize: "var(--root-height)", fontFamily: "monospace", fontVariantNumeric: "tabular-nums" }), [G.PWM_BADGE_SPACE_WIDTH, G.willPushPWMBadge, b]), At = r.useMemo(() => r.createElement("input", qt(Vt({ autoComplete: l.autoComplete || "one-time-code" }, l), { "data-input-otp": !0, "data-input-otp-placeholder-shown": p.length === 0 || void 0, "data-input-otp-mss": B, "data-input-otp-mse": H, inputMode: j, pattern: P?.source, "aria-placeholder": C, style: pt, maxLength: s, value: p, ref: c, onPaste: (e) => {
|
|
210
210
|
var o;
|
|
211
|
-
|
|
212
|
-
}, onChange:
|
|
211
|
+
st(e), (o = l.onPaste) == null || o.call(l, e);
|
|
212
|
+
}, onChange: it, onMouseOver: (e) => {
|
|
213
213
|
var o;
|
|
214
|
-
|
|
214
|
+
lt(!0), (o = l.onMouseOver) == null || o.call(l, e);
|
|
215
215
|
}, onMouseLeave: (e) => {
|
|
216
216
|
var o;
|
|
217
|
-
|
|
217
|
+
lt(!1), (o = l.onMouseLeave) == null || o.call(l, e);
|
|
218
218
|
}, onFocus: (e) => {
|
|
219
219
|
var o;
|
|
220
|
-
|
|
220
|
+
ut(), (o = l.onFocus) == null || o.call(l, e);
|
|
221
221
|
}, onBlur: (e) => {
|
|
222
222
|
var o;
|
|
223
|
-
|
|
224
|
-
} })), [ut, st,
|
|
225
|
-
var
|
|
226
|
-
let
|
|
227
|
-
return { char:
|
|
228
|
-
}), isFocused: z, isHovering: !l.disabled &&
|
|
229
|
-
return r.createElement(r.Fragment, null, g !== null && r.createElement("noscript", null, r.createElement("style", null, g)), r.createElement("div", { ref:
|
|
223
|
+
X(!1), (o = l.onBlur) == null || o.call(l, e);
|
|
224
|
+
} })), [it, ut, st, j, pt, s, H, B, l, P?.source, p]), Y = r.useMemo(() => ({ slots: Array.from({ length: s }).map((e, o) => {
|
|
225
|
+
var d;
|
|
226
|
+
let x = z && B !== null && H !== null && (B === H && o === B || o >= B && o < H), E = p[o] !== void 0 ? p[o] : null, i = p[0] !== void 0 ? null : (d = C?.[o]) != null ? d : null;
|
|
227
|
+
return { char: E, placeholderChar: i, isActive: x, hasFakeCaret: x && E === null };
|
|
228
|
+
}), isFocused: z, isHovering: !l.disabled && at }), [z, at, s, H, B, l.disabled, p]), Dt = r.useMemo(() => w ? w(Y) : r.createElement(te.Provider, { value: Y }, I), [I, Y, w]);
|
|
229
|
+
return r.createElement(r.Fragment, null, g !== null && r.createElement("noscript", null, r.createElement("style", null, g)), r.createElement("div", { ref: Q, "data-input-otp-container": !0, style: Ot, className: y }, Dt, r.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, At)));
|
|
230
230
|
});
|
|
231
231
|
Et.displayName = "Input";
|
|
232
232
|
function q(t, n) {
|
|
@@ -236,7 +236,7 @@ function q(t, n) {
|
|
|
236
236
|
console.error("input-otp could not insert CSS rule:", n);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
var
|
|
239
|
+
var ee = `
|
|
240
240
|
[data-input-otp] {
|
|
241
241
|
--nojs-bg: white !important;
|
|
242
242
|
--nojs-fg: black !important;
|
|
@@ -256,88 +256,113 @@ var re = `
|
|
|
256
256
|
--nojs-fg: white !important;
|
|
257
257
|
}
|
|
258
258
|
}`;
|
|
259
|
-
const St =
|
|
260
|
-
const t =
|
|
259
|
+
const St = gt({}), yt = gt(null), Pt = () => {
|
|
260
|
+
const t = ht(yt);
|
|
261
261
|
if (!t)
|
|
262
262
|
throw new Error("useRoot must be used within an InputOTP");
|
|
263
263
|
return t;
|
|
264
|
-
},
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
}, Ct = ({
|
|
265
|
+
ref: t,
|
|
266
|
+
autoFocus: n = !1,
|
|
267
|
+
children: a,
|
|
268
|
+
className: u,
|
|
269
|
+
errorMessage: v,
|
|
270
|
+
hasError: s,
|
|
271
|
+
id: b,
|
|
272
|
+
inputMode: m = "numeric",
|
|
273
|
+
maxLength: C,
|
|
274
|
+
name: j,
|
|
275
|
+
onChange: M,
|
|
276
|
+
onComplete: R,
|
|
277
|
+
value: f,
|
|
278
|
+
variant: y = "outlined",
|
|
279
|
+
...g
|
|
280
|
+
}) => {
|
|
281
|
+
const w = _t(b, j), I = (l) => {
|
|
282
|
+
const O = l.clipboardData.getData("text/plain").trim().replaceAll("-", "");
|
|
283
|
+
O.length === C && typeof M == "function" && M(O);
|
|
270
284
|
};
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ k(St.Provider, { value: { hasError: s }, children: /* @__PURE__ */ ft("div", { className: "flex w-max flex-col gap-y-1", children: [
|
|
286
|
+
/* @__PURE__ */ k(
|
|
273
287
|
Et,
|
|
274
288
|
{
|
|
275
|
-
autoFocus:
|
|
276
|
-
containerClassName:
|
|
289
|
+
autoFocus: n,
|
|
290
|
+
containerClassName: vt("flex items-center gap-2 has-[:disabled]:opacity-50 disabled:cursor-not-allowed", u),
|
|
277
291
|
"data-1p-ignore": "true",
|
|
278
292
|
"data-dashlane-disabled-on-field": "true",
|
|
279
293
|
"data-lpignore": "true",
|
|
280
294
|
"data-protonpass-ignore": "true",
|
|
281
295
|
"data-testid": "spectral-input-otp",
|
|
282
296
|
id: w,
|
|
283
|
-
inputMode:
|
|
284
|
-
maxLength:
|
|
285
|
-
onChange:
|
|
286
|
-
onComplete:
|
|
297
|
+
inputMode: m,
|
|
298
|
+
maxLength: C,
|
|
299
|
+
onChange: M,
|
|
300
|
+
onComplete: R,
|
|
287
301
|
onPaste: I,
|
|
288
302
|
pasteTransformer: (l) => l.replaceAll("-", ""),
|
|
289
303
|
pushPasswordManagerStrategy: "none",
|
|
290
|
-
ref:
|
|
304
|
+
ref: t,
|
|
291
305
|
role: "textbox",
|
|
292
306
|
textAlign: "center",
|
|
293
|
-
value:
|
|
294
|
-
...
|
|
295
|
-
render: ({ slots: l }) => /* @__PURE__ */
|
|
307
|
+
value: f,
|
|
308
|
+
...g,
|
|
309
|
+
render: ({ slots: l }) => /* @__PURE__ */ k(yt.Provider, { value: { slots: l, variant: y }, children: a })
|
|
296
310
|
}
|
|
297
311
|
),
|
|
298
|
-
|
|
312
|
+
s && v && /* @__PURE__ */ k(Ht, { dataTestId: "spectral-input-otp-error-message", id: Gt(w), message: v })
|
|
299
313
|
] }) });
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
314
|
+
};
|
|
315
|
+
Ct.displayName = "InputOTP";
|
|
316
|
+
const Mt = ({
|
|
317
|
+
ref: t,
|
|
318
|
+
...n
|
|
319
|
+
}) => /* @__PURE__ */ k("div", { className: "flex items-center justify-center gap-x-2", "data-testid": "spectral-input-otp-group", ref: t, ...n });
|
|
320
|
+
Mt.displayName = "InputOTP.Group";
|
|
321
|
+
const Tt = ({
|
|
322
|
+
ref: t,
|
|
323
|
+
index: n,
|
|
324
|
+
className: a,
|
|
325
|
+
...u
|
|
326
|
+
}) => {
|
|
327
|
+
const { variant: v = "outlined", slots: s = [] } = Pt(), { hasError: b } = ht(St), m = s[n] || { char: "", hasFakeCaret: !0, isActive: !1 };
|
|
328
|
+
return /* @__PURE__ */ ft(
|
|
307
329
|
"div",
|
|
308
330
|
{
|
|
309
|
-
className:
|
|
310
|
-
"relative flex h-12 w-10 items-center justify-center rounded-[8px] border-1 transition duration-200
|
|
311
|
-
v === "filled" ? "bg-level-one border-level-one" : "
|
|
331
|
+
className: vt(
|
|
332
|
+
"relative z-10 flex h-12 w-10 items-center justify-center rounded-[8px] border-1 transition duration-200 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
333
|
+
v === "filled" ? "bg-level-one border-level-one" : "border-input-otp-border bg-transparent",
|
|
312
334
|
!b && "border",
|
|
313
|
-
b && "border-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
335
|
+
b && "border-danger-400 focus-visible:outline-danger-400 border-2",
|
|
336
|
+
m.isActive && !b && "outline-input-otp-border--focus z-10 outline-2 outline-offset-2",
|
|
337
|
+
m.isActive && b && "outline-danger-400 outline-2 outline-offset-2",
|
|
338
|
+
a
|
|
317
339
|
),
|
|
318
|
-
"data-index":
|
|
340
|
+
"data-index": n,
|
|
319
341
|
"data-testid": "spectral-input-otp-slot",
|
|
320
342
|
"data-variant": v,
|
|
321
|
-
ref:
|
|
322
|
-
...
|
|
343
|
+
ref: t,
|
|
344
|
+
...u,
|
|
323
345
|
children: [
|
|
324
|
-
|
|
325
|
-
|
|
346
|
+
m.char,
|
|
347
|
+
m.hasFakeCaret && /* @__PURE__ */ k("div", { className: "animate-caret-blink pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ k("div", { className: "bg-input-otp-caret h-8 w-px" }) })
|
|
326
348
|
]
|
|
327
349
|
}
|
|
328
350
|
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
351
|
+
};
|
|
352
|
+
Tt.displayName = "InputOTP.Slot";
|
|
353
|
+
const kt = ({
|
|
354
|
+
ref: t,
|
|
355
|
+
...n
|
|
356
|
+
}) => {
|
|
357
|
+
const { variant: a = "outlined" } = Pt();
|
|
358
|
+
return /* @__PURE__ */ k("div", { ref: t, role: "separator", ...n, "data-testid": "spectral-input-otp-separator", "data-variant": a, children: /* @__PURE__ */ k(Nt, { size: 24, color: a === "filled" ? "var(--color-input-otp-filled-separator)" : "var(--color-input-otp-border)" }) });
|
|
359
|
+
};
|
|
360
|
+
kt.displayName = "InputOTP.Separator";
|
|
361
|
+
const fr = Object.assign(Ct, {
|
|
362
|
+
Group: Mt,
|
|
363
|
+
Slot: Tt,
|
|
364
|
+
Separator: kt
|
|
340
365
|
});
|
|
341
366
|
export {
|
|
342
|
-
|
|
367
|
+
fr as InputOTP
|
|
343
368
|
};
|
package/dist/Label.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
2
|
export type LabelProps = ComponentPropsWithoutRef<'label'>;
|
|
3
|
-
export declare const Label:
|
|
3
|
+
export declare const Label: {
|
|
4
|
+
({ ref, className, ...props }: LabelProps & {
|
|
5
|
+
ref?: Ref<HTMLLabelElement>;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
4
9
|
//# sourceMappingURL=Label.d.ts.map
|
package/dist/Label.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { cn as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { cn as t } from "./utils/twUtils.js";
|
|
4
|
+
import "react";
|
|
5
|
+
const r = ({
|
|
6
|
+
ref: e,
|
|
7
|
+
className: a,
|
|
8
|
+
...l
|
|
9
|
+
}) => (
|
|
7
10
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
+
/* @__PURE__ */ o("label", { ref: e, "data-slot": "label", className: t("text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70", a), ...l })
|
|
12
|
+
);
|
|
13
|
+
r.displayName = "Label";
|
|
11
14
|
export {
|
|
12
|
-
|
|
15
|
+
r as Label
|
|
13
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
1
|
+
import { ButtonHTMLAttributes, Ref } from 'react';
|
|
2
2
|
export type MultiSelectState = 'default' | 'error' | 'disabled' | 'loading';
|
|
3
3
|
export interface MultiSelectOption {
|
|
4
4
|
disabled?: boolean;
|
|
@@ -30,5 +30,10 @@ export interface MultiSelectBaseProps extends Omit<ButtonHTMLAttributes<HTMLButt
|
|
|
30
30
|
'aria-label'?: string;
|
|
31
31
|
'aria-describedby'?: string;
|
|
32
32
|
}
|
|
33
|
-
export declare const MultiSelectBase:
|
|
33
|
+
export declare const MultiSelectBase: {
|
|
34
|
+
({ ref, className, clearAllLabel, closeOnSelect, emptyMessage, errorMessage, id, label, loadingMessage, maxCount, name, onChange, options, placeholder, searchPlaceholder, selectAllLabel, showClearAll, showSearch, showSelectAll, sortAlphabetically, state, value, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, ...props }: MultiSelectBaseProps & {
|
|
35
|
+
ref?: Ref<HTMLButtonElement>;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
34
39
|
//# sourceMappingURL=MultiSelectBase.d.ts.map
|