@spear-ai/spectral 1.6.16 → 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 -191
- package/dist/Accordion.d.ts +13 -15
- package/dist/Accordion.js +172 -165
- package/dist/Alert/AlertBase.d.ts +7 -7
- package/dist/Alert/AlertBase.js +23 -21
- package/dist/Alert.d.ts +2 -2
- package/dist/Alert.js +32 -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 +31 -30
- package/dist/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/Checkbox/CheckboxBase.js +50 -57
- package/dist/Checkbox.js +16 -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 +4 -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 +96 -74
- 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/Icons/LineToolIcon.js +37 -10
- package/dist/Icons/MeasureIcon.d.ts +5 -0
- package/dist/Icons/MeasureIcon.js +26 -0
- package/dist/Icons/SearchIcon.d.ts +5 -0
- package/dist/Icons/SearchIcon.js +10 -0
- package/dist/Icons/index.d.ts +2 -0
- package/dist/Icons.js +76 -72
- 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 +31 -29
- package/dist/InputOTP.d.ts +10 -10
- package/dist/InputOTP.js +125 -123
- 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 +278 -200
- 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 +92 -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 +34 -22
- 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 +77 -74
- 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 +68 -95
- 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/Input.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import { usePasswordVisibility as tt, usePrefixWidth as
|
|
4
|
+
import { usePasswordVisibility as tt, usePrefixWidth as rt, useClearOnFocus as et } from "./Input/InputUtils.js";
|
|
5
5
|
import "./Icons/AnalyzeIcon.js";
|
|
6
6
|
import "./Icons/AnnotationsIcon.js";
|
|
7
7
|
import "./Icons/ApprovedIcon.js";
|
|
@@ -40,6 +40,7 @@ import "./Icons/LiveViewIcon.js";
|
|
|
40
40
|
import { LoaderIcon as nt } from "./Icons/LoaderIcon.js";
|
|
41
41
|
import "./Icons/LocationIcon.js";
|
|
42
42
|
import "./Icons/LogoutIcon.js";
|
|
43
|
+
import "./Icons/MeasureIcon.js";
|
|
43
44
|
import "./Icons/MessagesIcon.js";
|
|
44
45
|
import "./Icons/MetadataIcon.js";
|
|
45
46
|
import "./Icons/MinusIcon.js";
|
|
@@ -51,6 +52,7 @@ import "./Icons/PlusIcon.js";
|
|
|
51
52
|
import "./Icons/ResetIcon.js";
|
|
52
53
|
import "./Icons/ReviewedIcon.js";
|
|
53
54
|
import "./Icons/ScissorsIcon.js";
|
|
55
|
+
import "./Icons/SearchIcon.js";
|
|
54
56
|
import "./Icons/SettingsIcon.js";
|
|
55
57
|
import "./Icons/SortAscendingIcon.js";
|
|
56
58
|
import "./Icons/SortAtoZIcon.js";
|
|
@@ -75,30 +77,30 @@ const gt = (...a) => (p) => {
|
|
|
75
77
|
i && (typeof i == "function" ? i(p) : i.current = p);
|
|
76
78
|
});
|
|
77
79
|
}, xt = (a) => ({
|
|
80
|
+
date: "off",
|
|
78
81
|
email: "email",
|
|
82
|
+
number: "off",
|
|
79
83
|
password: "current-password",
|
|
80
84
|
tel: "tel",
|
|
81
|
-
url: "url",
|
|
82
85
|
text: "off",
|
|
83
|
-
|
|
84
|
-
date: "off",
|
|
86
|
+
url: "url",
|
|
85
87
|
"datetime-local": "off"
|
|
86
88
|
})[a] || "off", Ct = ({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
disabled: k,
|
|
89
|
+
className: a,
|
|
90
|
+
clearOnFocus: p = !1,
|
|
91
|
+
disabled: i,
|
|
91
92
|
endIcon: b,
|
|
92
93
|
errorMessage: g,
|
|
93
|
-
id:
|
|
94
|
-
label:
|
|
95
|
-
labelClassName:
|
|
94
|
+
id: k,
|
|
95
|
+
label: e,
|
|
96
|
+
labelClassName: P,
|
|
96
97
|
name: x,
|
|
97
98
|
onBlur: C,
|
|
98
99
|
onChange: n,
|
|
99
100
|
onFocus: w,
|
|
100
|
-
placeholder:
|
|
101
|
+
placeholder: R,
|
|
101
102
|
prefix: l,
|
|
103
|
+
ref: V,
|
|
102
104
|
required: v,
|
|
103
105
|
showClearButton: $ = !1,
|
|
104
106
|
startIcon: y,
|
|
@@ -110,37 +112,37 @@ const gt = (...a) => (p) => {
|
|
|
110
112
|
"aria-describedby": O,
|
|
111
113
|
...j
|
|
112
114
|
}) => {
|
|
113
|
-
const m = ct(
|
|
114
|
-
(
|
|
115
|
-
C?.(
|
|
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
|
+
(r) => {
|
|
117
|
+
C?.(r);
|
|
116
118
|
},
|
|
117
119
|
[C]
|
|
118
120
|
), Q = d(
|
|
119
|
-
(
|
|
120
|
-
z(
|
|
121
|
+
(r) => {
|
|
122
|
+
z(r, w);
|
|
121
123
|
},
|
|
122
124
|
[z, w]
|
|
123
125
|
), U = d(
|
|
124
|
-
(
|
|
125
|
-
const o =
|
|
126
|
+
(r) => {
|
|
127
|
+
const o = r.target.value;
|
|
126
128
|
n?.(o);
|
|
127
129
|
},
|
|
128
130
|
[n]
|
|
129
131
|
), X = d(() => {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
+
const r = E.current;
|
|
133
|
+
r && (r.value = "", r.dispatchEvent(new Event("input", { bubbles: !0 })), r.focus());
|
|
132
134
|
}, []), S = $ && I.length > 0, Y = () => {
|
|
133
|
-
const
|
|
134
|
-
password: () => /* @__PURE__ */ t("button", { "aria-controls": m, "aria-label": u ? `Hide ${
|
|
135
|
-
clear: () => /* @__PURE__ */ t("button", { "aria-label": `Clear ${
|
|
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 ?? "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 }) }),
|
|
136
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 }) }),
|
|
137
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 }) }),
|
|
138
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 }) })
|
|
139
141
|
};
|
|
140
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;
|
|
141
|
-
}, 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");
|
|
142
144
|
return /* @__PURE__ */ f("div", { className: "w-full space-y-1.5", "data-testid": "spectral-input-container", children: [
|
|
143
|
-
|
|
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 }),
|
|
144
146
|
/* @__PURE__ */ f("div", { className: "relative", "data-testid": "spectral-input-wrapper", children: [
|
|
145
147
|
/* @__PURE__ */ f("div", { className: "relative", children: [
|
|
146
148
|
Z(),
|
|
@@ -148,7 +150,7 @@ const gt = (...a) => (p) => {
|
|
|
148
150
|
/* @__PURE__ */ t(
|
|
149
151
|
"input",
|
|
150
152
|
{
|
|
151
|
-
"aria-label": M
|
|
153
|
+
"aria-label": M ?? e,
|
|
152
154
|
autoComplete: xt(c),
|
|
153
155
|
className: _,
|
|
154
156
|
"data-state": s,
|
|
@@ -159,11 +161,11 @@ const gt = (...a) => (p) => {
|
|
|
159
161
|
onBlur: K,
|
|
160
162
|
onChange: U,
|
|
161
163
|
onFocus: Q,
|
|
162
|
-
placeholder:
|
|
164
|
+
placeholder: R ?? e,
|
|
163
165
|
ref: T,
|
|
164
166
|
required: v,
|
|
165
167
|
style: ft({
|
|
166
|
-
"--prefix-width": l ? `${G}px` : "
|
|
168
|
+
"--prefix-width": l ? `${G}px` : "0"
|
|
167
169
|
}),
|
|
168
170
|
suppressHydrationWarning: L,
|
|
169
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
|
};
|
package/dist/InputOTP.js
CHANGED
|
@@ -39,6 +39,7 @@ import "./Icons/LiveViewIcon.js";
|
|
|
39
39
|
import "./Icons/LoaderIcon.js";
|
|
40
40
|
import "./Icons/LocationIcon.js";
|
|
41
41
|
import "./Icons/LogoutIcon.js";
|
|
42
|
+
import "./Icons/MeasureIcon.js";
|
|
42
43
|
import "./Icons/MessagesIcon.js";
|
|
43
44
|
import "./Icons/MetadataIcon.js";
|
|
44
45
|
import { MinusIcon as Ht } from "./Icons/MinusIcon.js";
|
|
@@ -50,6 +51,7 @@ import "./Icons/PlusIcon.js";
|
|
|
50
51
|
import "./Icons/ResetIcon.js";
|
|
51
52
|
import "./Icons/ReviewedIcon.js";
|
|
52
53
|
import "./Icons/ScissorsIcon.js";
|
|
54
|
+
import "./Icons/SearchIcon.js";
|
|
53
55
|
import "./Icons/SettingsIcon.js";
|
|
54
56
|
import "./Icons/SortAscendingIcon.js";
|
|
55
57
|
import "./Icons/SortAtoZIcon.js";
|
|
@@ -75,13 +77,13 @@ var Vt = Object.defineProperty, qt = Object.defineProperties, Kt = Object.getOwn
|
|
|
75
77
|
return t;
|
|
76
78
|
}, Jt = (t, e) => qt(t, Kt(e)), Qt = (t, e) => {
|
|
77
79
|
var o = {};
|
|
78
|
-
for (var
|
|
79
|
-
if (t != null && X) for (var
|
|
80
|
+
for (var l in t) Pt.call(t, l) && e.indexOf(l) < 0 && (o[l] = t[l]);
|
|
81
|
+
if (t != null && X) for (var l of X(t)) e.indexOf(l) < 0 && xt.call(t, l) && (o[l] = t[l]);
|
|
80
82
|
return o;
|
|
81
83
|
};
|
|
82
84
|
function Ut(t) {
|
|
83
|
-
let e = setTimeout(t, 0), o = setTimeout(t, 10),
|
|
84
|
-
return [e, o,
|
|
85
|
+
let e = setTimeout(t, 0), o = setTimeout(t, 10), l = setTimeout(t, 50);
|
|
86
|
+
return [e, o, l];
|
|
85
87
|
}
|
|
86
88
|
function Xt(t) {
|
|
87
89
|
let e = n.useRef();
|
|
@@ -90,77 +92,77 @@ function Xt(t) {
|
|
|
90
92
|
}), e.current;
|
|
91
93
|
}
|
|
92
94
|
var Yt = 18, Et = 40, te = `${Et}px`, ee = ["[data-lastpass-icon-root]", "com-1password-button", "[data-dashlanecreated]", '[style$="2147483647 !important;"]'].join(",");
|
|
93
|
-
function re({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: o, isFocused:
|
|
94
|
-
let [
|
|
95
|
-
let g = t.current,
|
|
96
|
-
if (!g || !
|
|
97
|
-
let h = g, P = h.getBoundingClientRect().left + h.offsetWidth,
|
|
98
|
-
document.querySelectorAll(ee).length === 0 && document.elementFromPoint(
|
|
99
|
-
}, [t, e,
|
|
95
|
+
function re({ containerRef: t, inputRef: e, pushPasswordManagerStrategy: o, isFocused: l }) {
|
|
96
|
+
let [v, i] = n.useState(!1), [d, m] = n.useState(!1), [E, D] = n.useState(!1), j = n.useMemo(() => o === "none" ? !1 : (o === "increase-width" || o === "experimental-no-flickering") && v && d, [v, d, o]), I = n.useCallback(() => {
|
|
97
|
+
let g = t.current, C = e.current;
|
|
98
|
+
if (!g || !C || E || o === "none") return;
|
|
99
|
+
let h = g, P = h.getBoundingClientRect().left + h.offsetWidth, T = h.getBoundingClientRect().top + h.offsetHeight / 2, s = P - Yt, F = T;
|
|
100
|
+
document.querySelectorAll(ee).length === 0 && document.elementFromPoint(s, F) === g || (i(!0), D(!0));
|
|
101
|
+
}, [t, e, E, o]);
|
|
100
102
|
return n.useEffect(() => {
|
|
101
103
|
let g = t.current;
|
|
102
104
|
if (!g || o === "none") return;
|
|
103
|
-
function
|
|
105
|
+
function C() {
|
|
104
106
|
let P = window.innerWidth - g.getBoundingClientRect().right;
|
|
105
107
|
m(P >= Et);
|
|
106
108
|
}
|
|
107
|
-
|
|
108
|
-
let h = setInterval(
|
|
109
|
+
C();
|
|
110
|
+
let h = setInterval(C, 1e3);
|
|
109
111
|
return () => {
|
|
110
112
|
clearInterval(h);
|
|
111
113
|
};
|
|
112
114
|
}, [t, o]), n.useEffect(() => {
|
|
113
|
-
let g =
|
|
115
|
+
let g = l || document.activeElement === e.current;
|
|
114
116
|
if (o === "none" || !g) return;
|
|
115
|
-
let
|
|
116
|
-
|
|
117
|
+
let C = setTimeout(I, 0), h = setTimeout(I, 2e3), P = setTimeout(I, 5e3), T = setTimeout(() => {
|
|
118
|
+
D(!0);
|
|
117
119
|
}, 6e3);
|
|
118
120
|
return () => {
|
|
119
|
-
clearTimeout(
|
|
121
|
+
clearTimeout(C), clearTimeout(h), clearTimeout(P), clearTimeout(T);
|
|
120
122
|
};
|
|
121
|
-
}, [e,
|
|
123
|
+
}, [e, l, o, I]), { hasPWMBadge: v, willPushPWMBadge: j, PWM_BADGE_SPACE_WIDTH: te };
|
|
122
124
|
}
|
|
123
125
|
var ne = n.createContext({}), Ct = n.forwardRef((t, e) => {
|
|
124
|
-
var o = t, { value:
|
|
125
|
-
let [Ot, Rt] = n.useState(typeof
|
|
126
|
-
|
|
127
|
-
}, [
|
|
128
|
-
n.useImperativeHandle(e, () =>
|
|
129
|
-
let r =
|
|
126
|
+
var o = t, { value: l, onChange: v, maxLength: i, textAlign: d = "left", pattern: m, placeholder: E, inputMode: D = "numeric", onComplete: j, pushPasswordManagerStrategy: I = "increase-width", pasteTransformer: g, containerClassName: C, noScriptCSSFallback: h = oe, render: P, children: T } = o, s = Qt(o, ["value", "onChange", "maxLength", "textAlign", "pattern", "placeholder", "inputMode", "onComplete", "pushPasswordManagerStrategy", "pasteTransformer", "containerClassName", "noScriptCSSFallback", "render", "children"]), F, J, O, W, st;
|
|
127
|
+
let [Ot, Rt] = n.useState(typeof s.defaultValue == "string" ? s.defaultValue : ""), p = l ?? Ot, B = Xt(p), z = n.useCallback((r) => {
|
|
128
|
+
v?.(r), Rt(r);
|
|
129
|
+
}, [v]), M = n.useMemo(() => m ? typeof m == "string" ? new RegExp(m) : m : null, [m]), c = n.useRef(null), Y = n.useRef(null), tt = n.useRef({ value: p, onChange: z, isIOS: typeof window < "u" && ((J = (F = window?.CSS) == null ? void 0 : F.supports) == null ? void 0 : J.call(F, "-webkit-touch-callout", "none")) }), Q = n.useRef({ prev: [(O = c.current) == null ? void 0 : O.selectionStart, (W = c.current) == null ? void 0 : W.selectionEnd, (st = c.current) == null ? void 0 : st.selectionDirection] });
|
|
130
|
+
n.useImperativeHandle(e, () => c.current, []), n.useEffect(() => {
|
|
131
|
+
let r = c.current, a = Y.current;
|
|
130
132
|
if (!r || !a) return;
|
|
131
133
|
tt.current.value !== r.value && tt.current.onChange(r.value), Q.current.prev = [r.selectionStart, r.selectionEnd, r.selectionDirection];
|
|
132
|
-
function
|
|
134
|
+
function f() {
|
|
133
135
|
if (document.activeElement !== r) {
|
|
134
136
|
q(null), K(null);
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
|
-
let
|
|
138
|
-
if (_.length !== 0 &&
|
|
139
|
-
let Wt =
|
|
139
|
+
let u = r.selectionStart, b = r.selectionEnd, U = r.selectionDirection, x = r.maxLength, _ = r.value, k = Q.current.prev, R = -1, A = -1, H;
|
|
140
|
+
if (_.length !== 0 && u !== null && b !== null) {
|
|
141
|
+
let Wt = u === b, Bt = u === _.length && _.length < x;
|
|
140
142
|
if (Wt && !Bt) {
|
|
141
|
-
let G =
|
|
142
|
-
if (G === 0)
|
|
143
|
-
else if (G === x)
|
|
143
|
+
let G = u;
|
|
144
|
+
if (G === 0) R = 0, A = 1, H = "forward";
|
|
145
|
+
else if (G === x) R = G - 1, A = G, H = "backward";
|
|
144
146
|
else if (x > 1 && _.length > 1) {
|
|
145
147
|
let nt = 0;
|
|
146
|
-
if (
|
|
147
|
-
H = G <
|
|
148
|
-
let Nt =
|
|
148
|
+
if (k[0] !== null && k[1] !== null) {
|
|
149
|
+
H = G < k[1] ? "backward" : "forward";
|
|
150
|
+
let Nt = k[0] === k[1] && k[0] < x;
|
|
149
151
|
H === "backward" && !Nt && (nt = -1);
|
|
150
152
|
}
|
|
151
|
-
|
|
153
|
+
R = nt + G, A = nt + G + 1;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
|
-
|
|
156
|
+
R !== -1 && A !== -1 && R !== A && c.current.setSelectionRange(R, A, H);
|
|
155
157
|
}
|
|
156
|
-
let vt =
|
|
158
|
+
let vt = R !== -1 ? R : u, gt = A !== -1 ? A : b, Ft = H ?? U;
|
|
157
159
|
q(vt), K(gt), Q.current.prev = [vt, gt, Ft];
|
|
158
160
|
}
|
|
159
|
-
if (document.addEventListener("selectionchange",
|
|
160
|
-
let
|
|
161
|
-
if (
|
|
161
|
+
if (document.addEventListener("selectionchange", f, { capture: !0 }), f(), document.activeElement === r && et(!0), !document.getElementById("input-otp-style")) {
|
|
162
|
+
let u = document.createElement("style");
|
|
163
|
+
if (u.id = "input-otp-style", document.head.appendChild(u), u.sheet) {
|
|
162
164
|
let b = "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;";
|
|
163
|
-
Z(
|
|
165
|
+
Z(u.sheet, "[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"), Z(u.sheet, `[data-input-otp]:autofill { ${b} }`), Z(u.sheet, `[data-input-otp]:-webkit-autofill { ${b} }`), Z(u.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; } }"), Z(u.sheet, "[data-input-otp] + * { pointer-events: all !important; }");
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
let S = () => {
|
|
@@ -169,66 +171,66 @@ var ne = n.createContext({}), Ct = n.forwardRef((t, e) => {
|
|
|
169
171
|
S();
|
|
170
172
|
let y = new ResizeObserver(S);
|
|
171
173
|
return y.observe(r), () => {
|
|
172
|
-
document.removeEventListener("selectionchange",
|
|
174
|
+
document.removeEventListener("selectionchange", f, { capture: !0 }), y.disconnect();
|
|
173
175
|
};
|
|
174
176
|
}, []);
|
|
175
|
-
let [ut,
|
|
177
|
+
let [ut, pt] = n.useState(!1), [V, et] = n.useState(!1), [N, q] = n.useState(null), [L, K] = n.useState(null);
|
|
176
178
|
n.useEffect(() => {
|
|
177
179
|
Ut(() => {
|
|
178
|
-
var r, a,
|
|
179
|
-
(r =
|
|
180
|
-
let y = (a =
|
|
181
|
-
y !== null &&
|
|
180
|
+
var r, a, f, S;
|
|
181
|
+
(r = c.current) == null || r.dispatchEvent(new Event("input"));
|
|
182
|
+
let y = (a = c.current) == null ? void 0 : a.selectionStart, u = (f = c.current) == null ? void 0 : f.selectionEnd, b = (S = c.current) == null ? void 0 : S.selectionDirection;
|
|
183
|
+
y !== null && u !== null && (q(y), K(u), Q.current.prev = [y, u, b]);
|
|
182
184
|
});
|
|
183
|
-
}, [
|
|
184
|
-
B !== void 0 &&
|
|
185
|
-
}, [
|
|
186
|
-
let $ = re({ containerRef: Y, inputRef:
|
|
187
|
-
let a = r.currentTarget.value.slice(0,
|
|
188
|
-
if (a.length > 0 &&
|
|
185
|
+
}, [p, V]), n.useEffect(() => {
|
|
186
|
+
B !== void 0 && p !== B && B.length < i && p.length === i && j?.(p);
|
|
187
|
+
}, [i, j, B, p]);
|
|
188
|
+
let $ = re({ containerRef: Y, inputRef: c, pushPasswordManagerStrategy: I, isFocused: V }), ct = n.useCallback((r) => {
|
|
189
|
+
let a = r.currentTarget.value.slice(0, i);
|
|
190
|
+
if (a.length > 0 && M && !M.test(a)) {
|
|
189
191
|
r.preventDefault();
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
194
|
typeof B == "string" && a.length < B.length && document.dispatchEvent(new Event("selectionchange")), z(a);
|
|
193
|
-
}, [
|
|
195
|
+
}, [i, z, B, M]), dt = n.useCallback(() => {
|
|
194
196
|
var r;
|
|
195
|
-
if (
|
|
196
|
-
let a = Math.min(
|
|
197
|
-
(r =
|
|
197
|
+
if (c.current) {
|
|
198
|
+
let a = Math.min(c.current.value.length, i - 1), f = c.current.value.length;
|
|
199
|
+
(r = c.current) == null || r.setSelectionRange(a, f), q(a), K(f);
|
|
198
200
|
}
|
|
199
201
|
et(!0);
|
|
200
|
-
}, [
|
|
201
|
-
var a,
|
|
202
|
-
let S =
|
|
202
|
+
}, [i]), mt = n.useCallback((r) => {
|
|
203
|
+
var a, f;
|
|
204
|
+
let S = c.current;
|
|
203
205
|
if (!g && (!tt.current.isIOS || !r.clipboardData || !S)) return;
|
|
204
|
-
let y = r.clipboardData.getData("text/plain"),
|
|
206
|
+
let y = r.clipboardData.getData("text/plain"), u = g ? g(y) : y;
|
|
205
207
|
r.preventDefault();
|
|
206
|
-
let b = (a =
|
|
207
|
-
if (x.length > 0 &&
|
|
208
|
+
let b = (a = c.current) == null ? void 0 : a.selectionStart, U = (f = c.current) == null ? void 0 : f.selectionEnd, x = (b !== U ? p.slice(0, b) + u + p.slice(U) : p.slice(0, b) + u + p.slice(b)).slice(0, i);
|
|
209
|
+
if (x.length > 0 && M && !M.test(x)) return;
|
|
208
210
|
S.value = x, z(x);
|
|
209
|
-
let _ = Math.min(x.length,
|
|
210
|
-
S.setSelectionRange(_,
|
|
211
|
-
}, [
|
|
211
|
+
let _ = Math.min(x.length, i - 1), k = x.length;
|
|
212
|
+
S.setSelectionRange(_, k), q(_), K(k);
|
|
213
|
+
}, [i, z, M, p]), At = n.useMemo(() => ({ position: "relative", cursor: s.disabled ? "default" : "text", userSelect: "none", WebkitUserSelect: "none", pointerEvents: "none" }), [s.disabled]), ft = n.useMemo(() => ({ position: "absolute", inset: 0, width: $.willPushPWMBadge ? `calc(100% + ${$.PWM_BADGE_SPACE_WIDTH})` : "100%", clipPath: $.willPushPWMBadge ? `inset(0 ${$.PWM_BADGE_SPACE_WIDTH} 0 0)` : void 0, height: "100%", display: "flex", textAlign: d, 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" }), [$.PWM_BADGE_SPACE_WIDTH, $.willPushPWMBadge, d]), Dt = n.useMemo(() => n.createElement("input", Jt(Zt({ autoComplete: s.autoComplete || "one-time-code" }, s), { "data-input-otp": !0, "data-input-otp-placeholder-shown": p.length === 0 || void 0, "data-input-otp-mss": N, "data-input-otp-mse": L, inputMode: D, pattern: M?.source, "aria-placeholder": E, style: ft, maxLength: i, value: p, ref: c, onPaste: (r) => {
|
|
212
214
|
var a;
|
|
213
|
-
mt(r), (a =
|
|
214
|
-
}, onChange:
|
|
215
|
+
mt(r), (a = s.onPaste) == null || a.call(s, r);
|
|
216
|
+
}, onChange: ct, onMouseOver: (r) => {
|
|
215
217
|
var a;
|
|
216
|
-
|
|
218
|
+
pt(!0), (a = s.onMouseOver) == null || a.call(s, r);
|
|
217
219
|
}, onMouseLeave: (r) => {
|
|
218
220
|
var a;
|
|
219
|
-
|
|
221
|
+
pt(!1), (a = s.onMouseLeave) == null || a.call(s, r);
|
|
220
222
|
}, onFocus: (r) => {
|
|
221
223
|
var a;
|
|
222
|
-
dt(), (a =
|
|
224
|
+
dt(), (a = s.onFocus) == null || a.call(s, r);
|
|
223
225
|
}, onBlur: (r) => {
|
|
224
226
|
var a;
|
|
225
|
-
et(!1), (a =
|
|
226
|
-
} })), [
|
|
227
|
-
var
|
|
228
|
-
let S = V && N !== null && L !== null && (N === L && a === N || a >= N && a < L), y =
|
|
229
|
-
return { char: y, placeholderChar:
|
|
230
|
-
}), isFocused: V, isHovering: !
|
|
231
|
-
return n.createElement(n.Fragment, null, h !== null && n.createElement("noscript", null, n.createElement("style", null, h)), n.createElement("div", { ref: Y, "data-input-otp-container": !0, style: At, className:
|
|
227
|
+
et(!1), (a = s.onBlur) == null || a.call(s, r);
|
|
228
|
+
} })), [ct, dt, mt, D, ft, i, L, N, s, M?.source, p]), rt = n.useMemo(() => ({ slots: Array.from({ length: i }).map((r, a) => {
|
|
229
|
+
var f;
|
|
230
|
+
let S = V && N !== null && L !== null && (N === L && a === N || a >= N && a < L), y = p[a] !== void 0 ? p[a] : null, u = p[0] !== void 0 ? null : (f = E?.[a]) != null ? f : null;
|
|
231
|
+
return { char: y, placeholderChar: u, isActive: S, hasFakeCaret: S && y === null };
|
|
232
|
+
}), isFocused: V, isHovering: !s.disabled && ut }), [V, ut, i, L, N, s.disabled, p]), jt = n.useMemo(() => P ? P(rt) : n.createElement(ne.Provider, { value: rt }, T), [T, rt, P]);
|
|
233
|
+
return n.createElement(n.Fragment, null, h !== null && n.createElement("noscript", null, n.createElement("style", null, h)), n.createElement("div", { ref: Y, "data-input-otp-container": !0, style: At, className: C }, jt, n.createElement("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" } }, Dt)));
|
|
232
234
|
});
|
|
233
235
|
Ct.displayName = "Input";
|
|
234
236
|
function Z(t, e) {
|
|
@@ -264,56 +266,56 @@ const Mt = St({}), Tt = St(null), ot = () => {
|
|
|
264
266
|
throw new Error("useRoot must be used within an InputOTP");
|
|
265
267
|
return t;
|
|
266
268
|
}, kt = ({
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
269
|
+
autoFocus: t = !1,
|
|
270
|
+
children: e,
|
|
271
|
+
className: o,
|
|
272
|
+
errorMessage: l,
|
|
273
|
+
id: v,
|
|
274
|
+
inputMode: i = "numeric",
|
|
275
|
+
maxLength: d,
|
|
276
|
+
name: m,
|
|
277
|
+
onChange: E,
|
|
278
|
+
onComplete: D,
|
|
279
|
+
pattern: j,
|
|
280
|
+
ref: I,
|
|
279
281
|
state: g = "default",
|
|
280
|
-
value:
|
|
282
|
+
value: C,
|
|
281
283
|
variant: h = "outlined",
|
|
282
284
|
...P
|
|
283
285
|
}) => {
|
|
284
|
-
const
|
|
285
|
-
let W =
|
|
286
|
-
|
|
286
|
+
const T = Gt(v, m), { isInvalid: s } = Lt(!1, g), F = j ?? (i === "numeric" ? ae : void 0), J = (O) => {
|
|
287
|
+
let W = O.clipboardData.getData("text/plain").trim().replaceAll("-", "");
|
|
288
|
+
i === "numeric" && (W = W.replace(/\D/g, "")), W.length === d && typeof E == "function" && E(W);
|
|
287
289
|
};
|
|
288
|
-
return /* @__PURE__ */ w(Mt.Provider, { value: { isInvalid:
|
|
290
|
+
return /* @__PURE__ */ w(Mt.Provider, { value: { isInvalid: s }, children: /* @__PURE__ */ bt("div", { className: "flex w-max flex-col gap-y-1", children: [
|
|
289
291
|
/* @__PURE__ */ w(
|
|
290
292
|
Ct,
|
|
291
293
|
{
|
|
292
|
-
autoFocus:
|
|
293
|
-
containerClassName: wt("flex items-center gap-2 has-
|
|
294
|
+
autoFocus: t,
|
|
295
|
+
containerClassName: wt("flex items-center gap-2 has-disabled]:opacity-50 disabled:cursor-not-allowed", o),
|
|
294
296
|
"data-1p-ignore": "true",
|
|
295
297
|
"data-dashlane-disabled-on-field": "true",
|
|
296
298
|
"data-lpignore": "true",
|
|
297
299
|
"data-protonpass-ignore": "true",
|
|
298
300
|
"data-testid": "spectral-input-otp",
|
|
299
|
-
id:
|
|
300
|
-
inputMode:
|
|
301
|
-
maxLength:
|
|
302
|
-
onChange:
|
|
303
|
-
onComplete:
|
|
301
|
+
id: T,
|
|
302
|
+
inputMode: i,
|
|
303
|
+
maxLength: d,
|
|
304
|
+
onChange: E,
|
|
305
|
+
onComplete: D,
|
|
304
306
|
onPaste: J,
|
|
305
|
-
pasteTransformer: (
|
|
307
|
+
pasteTransformer: (O) => O.replaceAll("-", ""),
|
|
306
308
|
pattern: F,
|
|
307
309
|
pushPasswordManagerStrategy: "none",
|
|
308
|
-
ref:
|
|
310
|
+
ref: I,
|
|
309
311
|
role: "textbox",
|
|
310
312
|
textAlign: "center",
|
|
311
|
-
value:
|
|
313
|
+
value: C,
|
|
312
314
|
...P,
|
|
313
|
-
render: ({ slots:
|
|
315
|
+
render: ({ slots: O }) => /* @__PURE__ */ w(Tt.Provider, { value: { slots: O, variant: h, maxLength: d }, children: e ?? /* @__PURE__ */ w(at, { children: /* @__PURE__ */ w(it, {}) }) })
|
|
314
316
|
}
|
|
315
317
|
),
|
|
316
|
-
|
|
318
|
+
s && l && /* @__PURE__ */ w($t, { dataTestId: "spectral-input-otp-error-message", id: zt(T), message: l })
|
|
317
319
|
] }) });
|
|
318
320
|
};
|
|
319
321
|
kt.displayName = "InputOTP";
|
|
@@ -323,40 +325,40 @@ const at = ({
|
|
|
323
325
|
}) => /* @__PURE__ */ w("div", { className: "flex items-center justify-center gap-x-2", "data-testid": "spectral-input-otp-group", ref: t, ...e });
|
|
324
326
|
at.displayName = "InputOTP.Group";
|
|
325
327
|
const lt = ({
|
|
326
|
-
|
|
328
|
+
className: t,
|
|
327
329
|
index: e,
|
|
328
|
-
|
|
329
|
-
...
|
|
330
|
+
ref: o,
|
|
331
|
+
...l
|
|
330
332
|
}) => {
|
|
331
|
-
const { variant:
|
|
333
|
+
const { variant: v = "outlined", slots: i = [] } = ot(), { isInvalid: d } = yt(Mt), m = i[e] || { char: "", hasFakeCaret: !0, isActive: !1 };
|
|
332
334
|
return /* @__PURE__ */ bt(
|
|
333
335
|
"div",
|
|
334
336
|
{
|
|
335
337
|
className: wt(
|
|
336
|
-
"relative z-10 flex h-12 w-10 items-center justify-center rounded-[8px] border
|
|
337
|
-
|
|
338
|
+
"relative z-10 flex h-12 w-10 items-center justify-center rounded-[8px] border transition duration-200 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
339
|
+
v === "filled" ? "bg-level-one border-level-one" : "border-input-otp-border bg-transparent",
|
|
338
340
|
!d && "border",
|
|
339
341
|
d && "border-danger-400 focus-visible:outline-danger-400 border-2",
|
|
340
342
|
m.isActive && !d && "outline-input-otp-border--focus z-10 outline-2 outline-offset-2",
|
|
341
343
|
m.isActive && d && "outline-danger-400 outline-2 outline-offset-2",
|
|
342
|
-
|
|
344
|
+
t
|
|
343
345
|
),
|
|
344
346
|
"data-index": e,
|
|
345
347
|
"data-testid": "spectral-input-otp-slot",
|
|
346
|
-
"data-variant":
|
|
347
|
-
ref:
|
|
348
|
-
...
|
|
348
|
+
"data-variant": v,
|
|
349
|
+
ref: o,
|
|
350
|
+
...l,
|
|
349
351
|
children: [
|
|
350
352
|
m.char,
|
|
351
|
-
m.hasFakeCaret && /* @__PURE__ */ w("div", { className: "animate-caret-blink pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ w("div", { className: "bg-input-otp-caret h-8 w-px" }) })
|
|
353
|
+
m.hasFakeCaret && /* @__PURE__ */ w("div", { className: "motion-safe:animate-caret-blink pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ w("div", { className: "bg-input-otp-caret h-8 w-px" }) })
|
|
352
354
|
]
|
|
353
355
|
}
|
|
354
356
|
);
|
|
355
357
|
};
|
|
356
358
|
lt.displayName = "InputOTP.Slot";
|
|
357
359
|
const it = ({ start: t = 0, count: e, className: o }) => {
|
|
358
|
-
const { maxLength:
|
|
359
|
-
return /* @__PURE__ */ w(_t, { children:
|
|
360
|
+
const { maxLength: l = 0 } = ot(), v = e !== void 0 ? t + e : l, i = Array.from({ length: v - t }, (d, m) => t + m);
|
|
361
|
+
return /* @__PURE__ */ w(_t, { children: i.map((d) => /* @__PURE__ */ w(lt, { index: d, className: o }, d)) });
|
|
360
362
|
};
|
|
361
363
|
it.displayName = "InputOTP.Slots";
|
|
362
364
|
const It = ({
|
|
@@ -367,12 +369,12 @@ const It = ({
|
|
|
367
369
|
return /* @__PURE__ */ w("div", { ref: t, role: "separator", ...e, "data-testid": "spectral-input-otp-separator", "data-variant": o, children: /* @__PURE__ */ w(Ht, { size: 24, color: o === "filled" ? "var(--color-input-otp-filled-separator)" : "var(--color-input-otp-border)" }) });
|
|
368
370
|
};
|
|
369
371
|
It.displayName = "InputOTP.Separator";
|
|
370
|
-
const
|
|
372
|
+
const Pr = Object.assign(kt, {
|
|
371
373
|
Group: at,
|
|
372
374
|
Slot: lt,
|
|
373
375
|
Slots: it,
|
|
374
376
|
Separator: It
|
|
375
377
|
});
|
|
376
378
|
export {
|
|
377
|
-
|
|
379
|
+
Pr as InputOTP
|
|
378
380
|
};
|