@spear-ai/spectral 1.3.61 → 1.3.63
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 +181 -152
- package/dist/Accordion.d.ts +37 -0
- package/dist/Accordion.js +465 -0
- package/dist/Alert/AlertBase.js +2 -2
- package/dist/Alert.js +4 -3
- package/dist/Avatar.d.ts +12 -0
- package/dist/Avatar.js +88 -1
- package/dist/Badge.d.ts +12 -2
- package/dist/Badge.js +28 -4
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/ButtonGroup/ButtonGroupButton.js +51 -0
- package/dist/ButtonGroup.d.ts +29 -0
- package/dist/ButtonGroup.js +89 -0
- package/dist/ButtonIcon.js +2 -1
- package/dist/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/Checkbox/CheckboxBase.js +21 -21
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +98 -0
- package/dist/Dialog/DialogBase.d.ts +1 -1
- package/dist/Dialog/DialogBase.js +2 -2
- package/dist/Dialog.js +4 -4
- package/dist/Drawer.js +24 -1283
- package/dist/HoverCard.d.ts +29 -0
- package/dist/HoverCard.js +207 -0
- package/dist/Icons/CheckmarkIcon.js +9 -9
- package/dist/Icons/MessagesIcon.d.ts +3 -0
- package/dist/Icons/MessagesIcon.js +31 -0
- package/dist/Icons/MinusIcon.js +13 -13
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +50 -48
- package/dist/Input.d.ts +2 -0
- package/dist/Input.js +98 -89
- package/dist/InputGroup.d.ts +16 -0
- package/dist/InputGroup.js +129 -0
- package/dist/InputOTP.d.ts +0 -2
- package/dist/InputOTP.js +138 -142
- package/dist/Label.d.ts +3 -7
- package/dist/Label.js +11 -11
- package/dist/MultiSelect/MultiSelectBase.js +22 -22
- package/dist/Popover.d.ts +6 -7
- package/dist/Popover.js +60 -71
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +141 -134
- package/dist/Select.js +97 -895
- package/dist/Separator.d.ts +12 -0
- package/dist/Separator.js +24 -0
- package/dist/Skeleton.js +3 -3
- package/dist/Slider.d.ts +15 -3
- package/dist/Slider.js +464 -40
- package/dist/Switch/SwitchBase.js +1 -1
- package/dist/Switch.js +2 -2
- package/dist/Tabs/TabsBase.js +1 -1
- package/dist/Tabs.js +16 -16
- package/dist/Textarea.js +41 -42
- package/dist/Toggle.js +2 -2
- package/dist/ToggleGroup.js +1 -1
- package/dist/Tooltip/TooltipBase.js +29 -29
- package/dist/Tooltip.js +15 -15
- package/dist/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/Tray/TrayStoriesData.js +438 -0
- package/dist/Tray.d.ts +28 -0
- package/dist/Tray.js +227 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Accordion/Accordion.d.ts +37 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Badge/Badge.d.ts +12 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +29 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/components/Checkbox/CheckboxBase.d.ts.map +1 -1
- package/dist/components/Dialog/DialogBase.d.ts +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +29 -0
- package/dist/components/HoverCard/HoverCard.d.ts.map +1 -0
- package/dist/components/Icons/MessagesIcon.d.ts +3 -0
- package/dist/components/Icons/MessagesIcon.d.ts.map +1 -0
- package/dist/components/Icons/iconTypes.d.ts +1 -0
- package/dist/components/Icons/iconTypes.d.ts.map +1 -1
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts +16 -0
- package/dist/components/InputGroup/InputGroup.d.ts.map +1 -0
- package/dist/components/InputOTP/InputOTP.d.ts +0 -2
- package/dist/components/InputOTP/InputOTP.d.ts.map +1 -1
- package/dist/components/Label/Label.d.ts +3 -7
- package/dist/components/Label/Label.d.ts.map +1 -1
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/Separator/Separator.d.ts +12 -0
- package/dist/components/Separator/Separator.d.ts.map +1 -0
- package/dist/components/Slider/Slider.d.ts +15 -3
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Tray/Tray.d.ts +28 -0
- package/dist/components/Tray/Tray.d.ts.map +1 -0
- package/dist/components/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/components/Tray/TrayStoriesData.d.ts.map +1 -0
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +4 -3
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +9 -9
- package/dist/features/AuthCard/PasswordInput.js +78 -9
- package/dist/features/AuthCard/SignInForm.js +8 -7
- package/dist/features/AuthCard/SignUpForm.js +8 -7
- package/dist/features/AuthCard.js +2 -2
- package/dist/features/LabelingTools.js +7 -6
- package/dist/features/SensorMetadata.js +3 -2
- package/dist/features/SettingsPopover.js +3 -2
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/{index-CBwRmAsQ.js → index-6Abv_Flm.js} +1 -1
- package/dist/{index-DUK1rxhf.js → index-B-GQStVW.js} +6 -5
- package/dist/index-B2oBi8ng.js +142 -0
- package/dist/index-BIpuW_o8.js +146 -0
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/index-BhufZRa2.js +232 -0
- package/dist/index-CAKA12cC.js +1265 -0
- package/dist/{index-Cfyte2YO.js → index-CGALWSq_.js} +1 -1
- package/dist/index-CVSxKOPp.js +13 -0
- package/dist/index-CevVJ05e.js +822 -0
- package/dist/{index-CRBC94ik.js → index-D29mdTf5.js} +1 -1
- package/dist/{index-FeGk8zep.js → index-NzygPVvJ.js} +10 -9
- package/dist/index-UEFPWH8U.js +54 -0
- package/dist/index-rKs9bXHr.js +6 -0
- package/dist/{index-Cb7rjMhE.js → index-y6Br5T4h.js} +6 -6
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/linear-cursor-small.png +0 -0
- package/dist/list.yml.webp +0 -0
- package/dist/message-alert-matte-glass-gradient.webp +0 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +42 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +18 -0
- package/dist/primitives/select.d.ts +16 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +196 -0
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +21 -20
- package/dist/primitives/textarea.d.ts +3 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +16 -0
- package/dist/{proxy-DD79Ok6n.js → proxy-C9AqCss6.js} +1 -1
- package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
- package/dist/styles/main.css +1 -1
- package/dist/utils/formFieldUtils.js +1 -1
- package/dist/utils/twUtils.js +2728 -2
- package/package.json +13 -8
- package/dist/Accordion/AccordionBase.d.ts +0 -42
- package/dist/Accordion/AccordionBase.js +0 -225
- package/dist/Badge/BadgeBase.d.ts +0 -13
- package/dist/Badge/BadgeBase.js +0 -35
- package/dist/PasswordInput-ClY_hxuN.js +0 -261
- package/dist/components/Accordion/AccordionBase.d.ts +0 -42
- package/dist/components/Accordion/AccordionBase.d.ts.map +0 -1
- package/dist/components/Badge/BadgeBase.d.ts +0 -13
- package/dist/components/Badge/BadgeBase.d.ts.map +0 -1
- package/dist/index-CA7haECj.js +0 -248
- package/dist/index-CbXx14YO.js +0 -59
- package/dist/index-VXXKXen4.js +0 -15
- package/dist/index-cCg4yNa8.js +0 -132
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.d.ts.map +0 -1
- package/dist/primitives/label.js +0 -27
- package/dist/twUtils-CRiPKpXj.js +0 -2743
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 vt } from "react/jsx-runtime";
|
|
4
4
|
import "./Icons/AnnotationsIcon.js";
|
|
5
5
|
import "./Icons/CalendarIcon.js";
|
|
6
6
|
import "./Icons/CheckCircleIcon.js";
|
|
@@ -31,6 +31,7 @@ import "./Icons/LiveViewIcon.js";
|
|
|
31
31
|
import "./Icons/LoaderIcon.js";
|
|
32
32
|
import "./Icons/LocationIcon.js";
|
|
33
33
|
import "./Icons/LogoutIcon.js";
|
|
34
|
+
import "./Icons/MessagesIcon.js";
|
|
34
35
|
import "./Icons/MetadataIcon.js";
|
|
35
36
|
import { MinusIcon as _t } from "./Icons/MinusIcon.js";
|
|
36
37
|
import "./Icons/OntologyIcon.js";
|
|
@@ -48,102 +49,102 @@ import "./Icons/WarningIcon.js";
|
|
|
48
49
|
import "./Icons/ZoomAllIcon.js";
|
|
49
50
|
import "./Icons/ZoomXIcon.js";
|
|
50
51
|
import "./Icons/ZoomYIcon.js";
|
|
51
|
-
import { useFormFieldId as Ht, ErrorMessage as Gt, getErrorMessageId as
|
|
52
|
-
import {
|
|
52
|
+
import { useFormFieldId as Ht, ErrorMessage as Gt, getErrorMessageId as Lt } from "./utils/formFieldUtils.js";
|
|
53
|
+
import { cn as gt } from "./utils/twUtils.js";
|
|
53
54
|
import * as n from "react";
|
|
54
|
-
import { createContext as
|
|
55
|
-
var zt = Object.defineProperty,
|
|
56
|
-
for (var a in r || (r = {}))
|
|
57
|
-
if (
|
|
55
|
+
import { createContext as ht, forwardRef as Q, useContext as bt } from "react";
|
|
56
|
+
var zt = Object.defineProperty, $t = Object.defineProperties, Vt = Object.getOwnPropertyDescriptors, K = Object.getOwnPropertySymbols, wt = Object.prototype.hasOwnProperty, yt = Object.prototype.propertyIsEnumerable, ft = (t, r, a) => r in t ? zt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a, qt = (t, r) => {
|
|
57
|
+
for (var a in r || (r = {})) wt.call(r, a) && ft(t, a, r[a]);
|
|
58
|
+
if (K) for (var a of K(r)) yt.call(r, a) && ft(t, a, r[a]);
|
|
58
59
|
return t;
|
|
59
|
-
},
|
|
60
|
+
}, Zt = (t, r) => $t(t, Vt(r)), Jt = (t, r) => {
|
|
60
61
|
var a = {};
|
|
61
|
-
for (var u in t)
|
|
62
|
-
if (t != null &&
|
|
62
|
+
for (var u in t) wt.call(t, u) && r.indexOf(u) < 0 && (a[u] = t[u]);
|
|
63
|
+
if (t != null && K) for (var u of K(t)) r.indexOf(u) < 0 && yt.call(t, u) && (a[u] = t[u]);
|
|
63
64
|
return a;
|
|
64
65
|
};
|
|
65
|
-
function
|
|
66
|
+
function Kt(t) {
|
|
66
67
|
let r = setTimeout(t, 0), a = setTimeout(t, 10), u = setTimeout(t, 50);
|
|
67
68
|
return [r, a, u];
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function Qt(t) {
|
|
70
71
|
let r = n.useRef();
|
|
71
72
|
return n.useEffect(() => {
|
|
72
73
|
r.current = t;
|
|
73
74
|
}), r.current;
|
|
74
75
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
let [
|
|
78
|
-
let f = t.current,
|
|
79
|
-
if (!f || !
|
|
80
|
-
let
|
|
81
|
-
document.querySelectorAll(
|
|
82
|
-
}, [t, r,
|
|
76
|
+
var Ut = 18, Et = 40, Xt = `${Et}px`, Yt = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
77
|
+
function te({ containerRef: t, inputRef: r, pushPasswordManagerStrategy: a, isFocused: u }) {
|
|
78
|
+
let [v, s] = n.useState(!1), [b, d] = n.useState(!1), [T, S] = n.useState(!1), A = n.useMemo(() => a === "none" ? !1 : (a === "increase-width" || a === "experimental-no-flickering") && v && b, [v, b, a]), R = n.useCallback(() => {
|
|
79
|
+
let f = t.current, x = r.current;
|
|
80
|
+
if (!f || !x || T || a === "none") return;
|
|
81
|
+
let g = f, w = g.getBoundingClientRect().left + g.offsetWidth, O = g.getBoundingClientRect().top + g.offsetHeight / 2, l = w - Ut, I = O;
|
|
82
|
+
document.querySelectorAll(Yt).length === 0 && document.elementFromPoint(l, I) === f || (s(!0), S(!0));
|
|
83
|
+
}, [t, r, T, a]);
|
|
83
84
|
return n.useEffect(() => {
|
|
84
85
|
let f = t.current;
|
|
85
86
|
if (!f || a === "none") return;
|
|
86
|
-
function
|
|
87
|
-
let
|
|
88
|
-
d(
|
|
87
|
+
function x() {
|
|
88
|
+
let w = window.innerWidth - f.getBoundingClientRect().right;
|
|
89
|
+
d(w >= Et);
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
let
|
|
91
|
+
x();
|
|
92
|
+
let g = setInterval(x, 1e3);
|
|
92
93
|
return () => {
|
|
93
|
-
clearInterval(
|
|
94
|
+
clearInterval(g);
|
|
94
95
|
};
|
|
95
96
|
}, [t, a]), n.useEffect(() => {
|
|
96
97
|
let f = u || document.activeElement === r.current;
|
|
97
98
|
if (a === "none" || !f) return;
|
|
98
|
-
let
|
|
99
|
+
let x = setTimeout(R, 0), g = setTimeout(R, 2e3), w = setTimeout(R, 5e3), O = setTimeout(() => {
|
|
99
100
|
S(!0);
|
|
100
101
|
}, 6e3);
|
|
101
102
|
return () => {
|
|
102
|
-
clearTimeout(
|
|
103
|
+
clearTimeout(x), clearTimeout(g), clearTimeout(w), clearTimeout(O);
|
|
103
104
|
};
|
|
104
|
-
}, [r, u, a,
|
|
105
|
+
}, [r, u, a, R]), { hasPWMBadge: v, willPushPWMBadge: A, PWM_BADGE_SPACE_WIDTH: Xt };
|
|
105
106
|
}
|
|
106
|
-
var
|
|
107
|
-
var a = t, { value: u, onChange:
|
|
108
|
-
let [
|
|
109
|
-
|
|
110
|
-
}, [
|
|
107
|
+
var ee = n.createContext({}), St = n.forwardRef((t, r) => {
|
|
108
|
+
var a = t, { value: u, onChange: v, maxLength: s, textAlign: b = "left", pattern: d, placeholder: T, inputMode: S = "numeric", onComplete: A, pushPasswordManagerStrategy: R = "increase-width", pasteTransformer: f, containerClassName: x, noScriptCSSFallback: g = ne, render: w, children: O } = a, l = Jt(a, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), I, nt, rt, ot, at;
|
|
109
|
+
let [Ot, It] = n.useState(typeof l.defaultValue == "string" ? l.defaultValue : ""), c = u ?? Ot, W = Qt(c), L = n.useCallback((e) => {
|
|
110
|
+
v?.(e), It(e);
|
|
111
|
+
}, [v]), C = n.useMemo(() => d ? typeof d == "string" ? new RegExp(d) : d : null, [d]), p = n.useRef(null), U = n.useRef(null), X = n.useRef({ value: c, onChange: L, isIOS: typeof window < "u" && ((nt = (I = window?.CSS) == null ? void 0 : I.supports) == null ? void 0 : nt.call(I, "-webkit-touch-callout", "none")) }), Z = n.useRef({ prev: [(rt = p.current) == null ? void 0 : rt.selectionStart, (ot = p.current) == null ? void 0 : ot.selectionEnd, (at = p.current) == null ? void 0 : at.selectionDirection] });
|
|
111
112
|
n.useImperativeHandle(r, () => p.current, []), n.useEffect(() => {
|
|
112
|
-
let e = p.current, o =
|
|
113
|
+
let e = p.current, o = U.current;
|
|
113
114
|
if (!e || !o) return;
|
|
114
|
-
|
|
115
|
+
X.current.value !== e.value && X.current.onChange(e.value), Z.current.prev = [e.selectionStart, e.selectionEnd, e.selectionDirection];
|
|
115
116
|
function m() {
|
|
116
117
|
if (document.activeElement !== e) {
|
|
117
|
-
|
|
118
|
+
$(null), V(null);
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
let i = e.selectionStart,
|
|
121
|
-
if (
|
|
122
|
-
let Bt = i ===
|
|
121
|
+
let i = e.selectionStart, h = e.selectionEnd, J = e.selectionDirection, P = e.maxLength, F = e.value, M = Z.current.prev, j = -1, D = -1, N;
|
|
122
|
+
if (F.length !== 0 && i !== null && h !== null) {
|
|
123
|
+
let Bt = i === h, Ft = i === F.length && F.length < P;
|
|
123
124
|
if (Bt && !Ft) {
|
|
124
|
-
let
|
|
125
|
-
if (
|
|
126
|
-
else if (
|
|
127
|
-
else if (
|
|
128
|
-
let
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
let Nt =
|
|
132
|
-
|
|
125
|
+
let _ = i;
|
|
126
|
+
if (_ === 0) j = 0, D = 1, N = "forward";
|
|
127
|
+
else if (_ === P) j = _ - 1, D = _, N = "backward";
|
|
128
|
+
else if (P > 1 && F.length > 1) {
|
|
129
|
+
let et = 0;
|
|
130
|
+
if (M[0] !== null && M[1] !== null) {
|
|
131
|
+
N = _ < M[1] ? "backward" : "forward";
|
|
132
|
+
let Nt = M[0] === M[1] && M[0] < P;
|
|
133
|
+
N === "backward" && !Nt && (et = -1);
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
j = et + _, D = et + _ + 1;
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
|
|
138
|
+
j !== -1 && D !== -1 && j !== D && p.current.setSelectionRange(j, D, N);
|
|
138
139
|
}
|
|
139
|
-
let
|
|
140
|
-
|
|
140
|
+
let dt = j !== -1 ? j : i, mt = D !== -1 ? D : h, Wt = N ?? J;
|
|
141
|
+
$(dt), V(mt), Z.current.prev = [dt, mt, Wt];
|
|
141
142
|
}
|
|
142
|
-
if (document.addEventListener("selectionchange", m, { capture: !0 }), m(), document.activeElement === e &&
|
|
143
|
+
if (document.addEventListener("selectionchange", m, { capture: !0 }), m(), document.activeElement === e && Y(!0), !document.getElementById("input-otp-style")) {
|
|
143
144
|
let i = document.createElement("style");
|
|
144
145
|
if (i.id = "input-otp-style", document.head.appendChild(i), i.sheet) {
|
|
145
|
-
let
|
|
146
|
-
|
|
146
|
+
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;";
|
|
147
|
+
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; }");
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
let y = () => {
|
|
@@ -155,73 +156,73 @@ var ne = n.createContext({}), Mt = n.forwardRef((t, r) => {
|
|
|
155
156
|
document.removeEventListener("selectionchange", m, { capture: !0 }), E.disconnect();
|
|
156
157
|
};
|
|
157
158
|
}, []);
|
|
158
|
-
let [
|
|
159
|
+
let [lt, it] = n.useState(!1), [z, Y] = n.useState(!1), [B, $] = n.useState(null), [H, V] = n.useState(null);
|
|
159
160
|
n.useEffect(() => {
|
|
160
|
-
|
|
161
|
+
Kt(() => {
|
|
161
162
|
var e, o, m, y;
|
|
162
163
|
(e = p.current) == null || e.dispatchEvent(new Event("input"));
|
|
163
|
-
let E = (o = p.current) == null ? void 0 : o.selectionStart, i = (m = p.current) == null ? void 0 : m.selectionEnd,
|
|
164
|
-
E !== null && i !== null && (
|
|
164
|
+
let E = (o = p.current) == null ? void 0 : o.selectionStart, i = (m = p.current) == null ? void 0 : m.selectionEnd, h = (y = p.current) == null ? void 0 : y.selectionDirection;
|
|
165
|
+
E !== null && i !== null && ($(E), V(i), Z.current.prev = [E, i, h]);
|
|
165
166
|
});
|
|
166
|
-
}, [c,
|
|
167
|
-
|
|
168
|
-
}, [s,
|
|
169
|
-
let
|
|
167
|
+
}, [c, z]), n.useEffect(() => {
|
|
168
|
+
W !== void 0 && c !== W && W.length < s && c.length === s && A?.(c);
|
|
169
|
+
}, [s, A, W, c]);
|
|
170
|
+
let G = te({ containerRef: U, inputRef: p, pushPasswordManagerStrategy: R, isFocused: z }), ut = n.useCallback((e) => {
|
|
170
171
|
let o = e.currentTarget.value.slice(0, s);
|
|
171
|
-
if (o.length > 0 &&
|
|
172
|
+
if (o.length > 0 && C && !C.test(o)) {
|
|
172
173
|
e.preventDefault();
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
|
-
typeof
|
|
176
|
-
}, [s,
|
|
176
|
+
typeof W == "string" && o.length < W.length && document.dispatchEvent(new Event("selectionchange")), L(o);
|
|
177
|
+
}, [s, L, W, C]), st = n.useCallback(() => {
|
|
177
178
|
var e;
|
|
178
179
|
if (p.current) {
|
|
179
180
|
let o = Math.min(p.current.value.length, s - 1), m = p.current.value.length;
|
|
180
|
-
(e = p.current) == null || e.setSelectionRange(o, m),
|
|
181
|
+
(e = p.current) == null || e.setSelectionRange(o, m), $(o), V(m);
|
|
181
182
|
}
|
|
182
|
-
|
|
183
|
-
}, [s]),
|
|
183
|
+
Y(!0);
|
|
184
|
+
}, [s]), ct = n.useCallback((e) => {
|
|
184
185
|
var o, m;
|
|
185
186
|
let y = p.current;
|
|
186
|
-
if (!f && (!
|
|
187
|
+
if (!f && (!X.current.isIOS || !e.clipboardData || !y)) return;
|
|
187
188
|
let E = e.clipboardData.getData("text/plain"), i = f ? f(E) : E;
|
|
188
189
|
e.preventDefault();
|
|
189
|
-
let
|
|
190
|
-
if (
|
|
191
|
-
y.value =
|
|
192
|
-
let
|
|
193
|
-
y.setSelectionRange(
|
|
194
|
-
}, [s,
|
|
190
|
+
let h = (o = p.current) == null ? void 0 : o.selectionStart, J = (m = p.current) == null ? void 0 : m.selectionEnd, P = (h !== J ? c.slice(0, h) + i + c.slice(J) : c.slice(0, h) + i + c.slice(h)).slice(0, s);
|
|
191
|
+
if (P.length > 0 && C && !C.test(P)) return;
|
|
192
|
+
y.value = P, L(P);
|
|
193
|
+
let F = Math.min(P.length, s - 1), M = P.length;
|
|
194
|
+
y.setSelectionRange(F, M), $(F), V(M);
|
|
195
|
+
}, [s, L, C, c]), jt = n.useMemo(() => ({ position: "relative", cursor: l.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [l.disabled]), pt = n.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]), Dt = n.useMemo(() => n.createElement("input", Zt(qt({ autoComplete: l.autoComplete || "one-time-code" }, l), { "data-input-otp": !0, "data-input-otp-placeholder-shown": c.length === 0 || void 0, "data-input-otp-mss": B, "data-input-otp-mse": H, inputMode: S, pattern: C?.source, "aria-placeholder": T, style: pt, maxLength: s, value: c, ref: p, onPaste: (e) => {
|
|
195
196
|
var o;
|
|
196
|
-
|
|
197
|
-
}, onChange:
|
|
197
|
+
ct(e), (o = l.onPaste) == null || o.call(l, e);
|
|
198
|
+
}, onChange: ut, onMouseOver: (e) => {
|
|
198
199
|
var o;
|
|
199
|
-
|
|
200
|
+
it(!0), (o = l.onMouseOver) == null || o.call(l, e);
|
|
200
201
|
}, onMouseLeave: (e) => {
|
|
201
202
|
var o;
|
|
202
|
-
|
|
203
|
+
it(!1), (o = l.onMouseLeave) == null || o.call(l, e);
|
|
203
204
|
}, onFocus: (e) => {
|
|
204
205
|
var o;
|
|
205
|
-
|
|
206
|
+
st(), (o = l.onFocus) == null || o.call(l, e);
|
|
206
207
|
}, onBlur: (e) => {
|
|
207
208
|
var o;
|
|
208
|
-
|
|
209
|
-
} })), [
|
|
209
|
+
Y(!1), (o = l.onBlur) == null || o.call(l, e);
|
|
210
|
+
} })), [ut, st, ct, S, pt, s, H, B, l, C?.source, c]), tt = n.useMemo(() => ({ slots: Array.from({ length: s }).map((e, o) => {
|
|
210
211
|
var m;
|
|
211
|
-
let y =
|
|
212
|
+
let y = z && B !== null && H !== null && (B === H && o === B || o >= B && o < H), E = c[o] !== void 0 ? c[o] : null, i = c[0] !== void 0 ? null : (m = T?.[o]) != null ? m : null;
|
|
212
213
|
return { char: E, placeholderChar: i, isActive: y, hasFakeCaret: y && E === null };
|
|
213
|
-
}), isFocused:
|
|
214
|
-
return n.createElement(n.Fragment, null,
|
|
214
|
+
}), isFocused: z, isHovering: !l.disabled && lt }), [z, lt, s, H, B, l.disabled, c]), At = n.useMemo(() => w ? w(tt) : n.createElement(ee.Provider, { value: tt }, O), [O, tt, w]);
|
|
215
|
+
return n.createElement(n.Fragment, null, g !== null && n.createElement("noscript", null, n.createElement("style", null, g)), n.createElement("div", { ref: U, "data-input-otp-container": !0, style: jt, className: x }, At, n.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Dt)));
|
|
215
216
|
});
|
|
216
|
-
|
|
217
|
-
function
|
|
217
|
+
St.displayName = "Input";
|
|
218
|
+
function q(t, r) {
|
|
218
219
|
try {
|
|
219
220
|
t.insertRule(r);
|
|
220
221
|
} catch {
|
|
221
222
|
console.error("input-otp could not insert CSS rule:", r);
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
|
-
var
|
|
225
|
+
var ne = `
|
|
225
226
|
[data-input-otp] {
|
|
226
227
|
--nojs-bg: white !important;
|
|
227
228
|
--nojs-fg: black !important;
|
|
@@ -241,42 +242,40 @@ var re = `
|
|
|
241
242
|
--nojs-fg: white !important;
|
|
242
243
|
}
|
|
243
244
|
}`;
|
|
244
|
-
const
|
|
245
|
-
const t =
|
|
245
|
+
const Pt = ht({}), xt = ht(null), Ct = () => {
|
|
246
|
+
const t = bt(xt);
|
|
246
247
|
if (!t)
|
|
247
248
|
throw new Error("useRoot must be used within an InputOTP");
|
|
248
249
|
return t;
|
|
249
|
-
},
|
|
250
|
+
}, Mt = Q(
|
|
250
251
|
({
|
|
251
252
|
autoFocus: t = !1,
|
|
252
253
|
children: r,
|
|
253
254
|
className: a,
|
|
254
255
|
errorMessage: u,
|
|
255
|
-
hasError:
|
|
256
|
+
hasError: v,
|
|
256
257
|
id: s,
|
|
257
|
-
inputMode:
|
|
258
|
+
inputMode: b = "numeric",
|
|
258
259
|
maxLength: d,
|
|
259
|
-
name:
|
|
260
|
+
name: T,
|
|
260
261
|
onChange: S,
|
|
261
|
-
onComplete:
|
|
262
|
-
value:
|
|
262
|
+
onComplete: A,
|
|
263
|
+
value: R,
|
|
263
264
|
variant: f = "outlined",
|
|
264
|
-
groupSize: g,
|
|
265
|
-
separatorPositions: v,
|
|
266
265
|
...x
|
|
267
|
-
},
|
|
268
|
-
const
|
|
269
|
-
const I =
|
|
266
|
+
}, g) => {
|
|
267
|
+
const w = Ht(s, T), O = (l) => {
|
|
268
|
+
const I = l.clipboardData.getData("text/plain").trim();
|
|
270
269
|
I.length === d && typeof S == "function" && (S(""), setTimeout(() => {
|
|
271
270
|
typeof S == "function" && S(I);
|
|
272
271
|
}, 0));
|
|
273
|
-
}
|
|
274
|
-
return /* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ k(Pt.Provider, { value: { hasError: v }, children: /* @__PURE__ */ vt("div", { className: "flex w-max flex-col gap-y-1", children: [
|
|
274
|
+
/* @__PURE__ */ k(
|
|
275
|
+
St,
|
|
277
276
|
{
|
|
278
277
|
autoFocus: t,
|
|
279
|
-
containerClassName:
|
|
278
|
+
containerClassName: gt(
|
|
280
279
|
"flex items-center gap-2 has-[:disabled]:opacity-50 disabled:cursor-not-allowed",
|
|
281
280
|
a
|
|
282
281
|
),
|
|
@@ -285,29 +284,26 @@ const kt = Et({}), Rt = Et(null), Tt = () => {
|
|
|
285
284
|
"data-lpignore": "true",
|
|
286
285
|
"data-protonpass-ignore": "true",
|
|
287
286
|
"data-testid": "input-otp",
|
|
288
|
-
id:
|
|
289
|
-
inputMode:
|
|
287
|
+
id: w,
|
|
288
|
+
inputMode: b,
|
|
290
289
|
maxLength: d,
|
|
291
290
|
onChange: S,
|
|
292
|
-
onComplete:
|
|
293
|
-
onPaste:
|
|
291
|
+
onComplete: A,
|
|
292
|
+
onPaste: O,
|
|
294
293
|
pushPasswordManagerStrategy: "none",
|
|
295
|
-
ref:
|
|
294
|
+
ref: g,
|
|
296
295
|
textAlign: "center",
|
|
297
|
-
value:
|
|
296
|
+
value: R,
|
|
298
297
|
...x,
|
|
299
|
-
render: ({ slots:
|
|
300
|
-
Q.includes(z) && /* @__PURE__ */ P(ct, {}),
|
|
301
|
-
/* @__PURE__ */ P(st, { index: z })
|
|
302
|
-
] }, z)) }) : r })
|
|
298
|
+
render: ({ slots: l }) => /* @__PURE__ */ k(xt.Provider, { value: { slots: l, variant: f }, children: r })
|
|
303
299
|
}
|
|
304
300
|
),
|
|
305
|
-
|
|
301
|
+
v && u && /* @__PURE__ */ k(Gt, { id: Lt(w), message: u })
|
|
306
302
|
] }) });
|
|
307
303
|
}
|
|
308
304
|
);
|
|
309
|
-
|
|
310
|
-
const
|
|
305
|
+
Mt.displayName = "InputOTP";
|
|
306
|
+
const kt = Q(({ ...t }, r) => /* @__PURE__ */ k(
|
|
311
307
|
"div",
|
|
312
308
|
{
|
|
313
309
|
ref: r,
|
|
@@ -316,39 +312,39 @@ const ut = et(({ ...t }, r) => /* @__PURE__ */ P(
|
|
|
316
312
|
"data-testid": "input-otp-group"
|
|
317
313
|
}
|
|
318
314
|
));
|
|
319
|
-
|
|
320
|
-
const
|
|
315
|
+
kt.displayName = "InputOTP.Group";
|
|
316
|
+
const Tt = Q(
|
|
321
317
|
({ index: t, className: r, ...a }, u) => {
|
|
322
|
-
const { variant:
|
|
323
|
-
return /* @__PURE__ */
|
|
318
|
+
const { variant: v = "outlined", slots: s = [] } = Ct(), { hasError: b } = bt(Pt), d = s[t] || { char: "", hasFakeCaret: !0, isActive: !1 };
|
|
319
|
+
return /* @__PURE__ */ vt(
|
|
324
320
|
"div",
|
|
325
321
|
{
|
|
326
322
|
ref: u,
|
|
327
|
-
className:
|
|
323
|
+
className: gt(
|
|
328
324
|
"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",
|
|
329
|
-
|
|
330
|
-
!
|
|
331
|
-
|
|
332
|
-
d.isActive && !
|
|
333
|
-
d.isActive &&
|
|
325
|
+
v === "filled" ? "bg-level-one border-level-one" : "border-input-otp-border bg-transparent",
|
|
326
|
+
!b && "border",
|
|
327
|
+
b && "border-danger-400 focus-visible:outline-danger-400 border-2",
|
|
328
|
+
d.isActive && !b && "outline-input-otp-border--focus z-10 outline-2 outline-offset-2",
|
|
329
|
+
d.isActive && b && "outline-danger-400 outline-2 outline-offset-2",
|
|
334
330
|
r
|
|
335
331
|
),
|
|
336
332
|
"data-index": t,
|
|
337
333
|
"data-testid": "input-otp-slot",
|
|
338
|
-
"data-variant":
|
|
334
|
+
"data-variant": v,
|
|
339
335
|
...a,
|
|
340
336
|
children: [
|
|
341
337
|
d.char,
|
|
342
|
-
d.hasFakeCaret && /* @__PURE__ */
|
|
338
|
+
d.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" }) })
|
|
343
339
|
]
|
|
344
340
|
}
|
|
345
341
|
);
|
|
346
342
|
}
|
|
347
343
|
);
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
const { variant: a = "outlined" } =
|
|
351
|
-
return /* @__PURE__ */
|
|
344
|
+
Tt.displayName = "InputOTP.Slot";
|
|
345
|
+
const Rt = Q(({ ...t }, r) => {
|
|
346
|
+
const { variant: a = "outlined" } = Ct();
|
|
347
|
+
return /* @__PURE__ */ k("div", { ref: r, role: "separator", ...t, "data-testid": "input-otp-separator", "data-variant": a, children: /* @__PURE__ */ k(
|
|
352
348
|
_t,
|
|
353
349
|
{
|
|
354
350
|
size: 24,
|
|
@@ -356,11 +352,11 @@ const ct = et(({ ...t }, r) => {
|
|
|
356
352
|
}
|
|
357
353
|
) });
|
|
358
354
|
});
|
|
359
|
-
|
|
360
|
-
const en = Object.assign(
|
|
361
|
-
Group:
|
|
362
|
-
Slot:
|
|
363
|
-
Separator:
|
|
355
|
+
Rt.displayName = "InputOTP.Separator";
|
|
356
|
+
const en = Object.assign(Mt, {
|
|
357
|
+
Group: kt,
|
|
358
|
+
Slot: Tt,
|
|
359
|
+
Separator: Rt
|
|
364
360
|
});
|
|
365
361
|
export {
|
|
366
362
|
en as InputOTP
|
package/dist/Label.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type LabelProps =
|
|
3
|
-
|
|
4
|
-
className?: string;
|
|
5
|
-
ref?: Ref<HTMLLabelElement>;
|
|
6
|
-
};
|
|
7
|
-
export declare const Label: import('react').ForwardRefExoticComponent<Omit<LabelProps, "ref"> & import('react').RefAttributes<HTMLLabelElement>>;
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type LabelProps = ComponentPropsWithoutRef<'label'>;
|
|
3
|
+
export declare const Label: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & import('react').RefAttributes<HTMLLabelElement>>;
|
|
8
4
|
//# sourceMappingURL=Label.d.ts.map
|
package/dist/Label.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import {
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
const
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
import { cn as l } from "./utils/twUtils.js";
|
|
5
|
+
import { forwardRef as t } from "react";
|
|
6
|
+
const m = t(({ className: e, ...a }, o) => (
|
|
7
7
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
8
|
-
/* @__PURE__ */
|
|
8
|
+
/* @__PURE__ */ r(
|
|
9
9
|
"label",
|
|
10
10
|
{
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
ref: o,
|
|
12
|
+
"data-slot": "label",
|
|
13
13
|
className: l(
|
|
14
|
-
"
|
|
14
|
+
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
15
15
|
e
|
|
16
16
|
),
|
|
17
|
-
...
|
|
17
|
+
...a
|
|
18
18
|
}
|
|
19
19
|
)
|
|
20
20
|
));
|
|
21
|
-
|
|
21
|
+
m.displayName = "Label";
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
m as Label
|
|
24
24
|
};
|