@spark-ui/components 16.0.0 → 16.0.2
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/form-field/index.js +1 -1
- package/dist/form-field/index.js.map +1 -1
- package/dist/form-field/index.mjs +1 -1
- package/dist/form-field/index.mjs.map +1 -1
- package/dist/input-otp/InputOTP.d.ts +6 -1
- package/dist/input-otp/InputOTPContext.d.ts +1 -0
- package/dist/input-otp/index.js +1 -1
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs +267 -248
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/input-otp/useInputOTP.d.ts +4 -1
- package/dist/rating-display/index.js +1 -1
- package/dist/rating-display/index.js.map +1 -1
- package/dist/rating-display/index.mjs +75 -53
- package/dist/rating-display/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/input-otp/index.mjs
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cva as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { useFormFieldControl as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const ae = me(null), ge = () => {
|
|
8
|
-
const e = be(ae);
|
|
1
|
+
import { jsxs as se, jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import { cva as ae, cx as ve } from "class-variance-authority";
|
|
3
|
+
import { createContext as he, useContext as ye, useId as xe, useRef as te, useState as ne, useEffect as J, useMemo as L, Children as oe, isValidElement as ie, cloneElement as re } from "react";
|
|
4
|
+
import { useFormFieldControl as Ie } from "@spark-ui/components/form-field";
|
|
5
|
+
const ce = he(null), ge = () => {
|
|
6
|
+
const e = ye(ce);
|
|
9
7
|
if (!e)
|
|
10
8
|
throw new Error("InputOTP components must be used within InputOTP");
|
|
11
9
|
return e;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
|
-
const
|
|
11
|
+
ae(["relative", "inline-flex", "items-center", "gap-sm"]);
|
|
12
|
+
const le = ae(
|
|
15
13
|
[
|
|
16
14
|
// Base slot styles
|
|
17
|
-
"relative",
|
|
18
|
-
"border-sm
|
|
19
|
-
"
|
|
20
|
-
"text-center text-body-1",
|
|
21
|
-
"text-on-surface",
|
|
15
|
+
"relative h-[50px] w-sz-40",
|
|
16
|
+
"border-sm rounded-md",
|
|
17
|
+
"text-center text-display-3 text-on-surface",
|
|
22
18
|
"outline-hidden",
|
|
23
19
|
"transition-colors",
|
|
24
20
|
"flex items-center justify-center",
|
|
21
|
+
// Slot that receives focus when clicking the group (first empty or last slot)
|
|
22
|
+
// Use data-[focus-target=true]:... for distinct styles
|
|
25
23
|
// Active state (when focused)
|
|
26
24
|
"data-[active=true]:ring-1",
|
|
27
25
|
"data-[active=true]:ring-inset",
|
|
28
26
|
"data-[active=true]:ring-l-2",
|
|
29
27
|
"data-[active=true]:border-focus",
|
|
30
|
-
// 'data-[active=true]:ring-focus',
|
|
31
|
-
// 'data-[active=true]:border-focus',
|
|
32
28
|
"data-[active=true]:z-raised ring-focus",
|
|
33
29
|
// Disabled state
|
|
34
30
|
"data-[disabled=true]:cursor-not-allowed",
|
|
35
31
|
"data-[disabled=true]:border-outline",
|
|
36
32
|
"data-[disabled=true]:bg-on-surface/dim-5",
|
|
37
|
-
"data-[disabled=true]:text-on-surface/dim-3"
|
|
33
|
+
"data-[disabled=true]:text-on-surface/dim-3",
|
|
34
|
+
// Read-only state (same as disabled but text stays normal)
|
|
35
|
+
"data-[readonly=true]:cursor-default",
|
|
36
|
+
"data-[readonly=true]:data-[active=false]:border-outline",
|
|
37
|
+
"data-[readonly=true]:bg-on-surface/dim-5",
|
|
38
|
+
"group-hover:data-[focus-target=true]:data-[disabled=false]:border-outline-high"
|
|
38
39
|
],
|
|
39
40
|
{
|
|
40
41
|
variants: {
|
|
@@ -42,7 +43,7 @@ const ie = ne(
|
|
|
42
43
|
* Color scheme of the slot
|
|
43
44
|
*/
|
|
44
45
|
intent: {
|
|
45
|
-
neutral: ["bg-surface border-outline"],
|
|
46
|
+
neutral: ["data-[filled=true]:bg-neutral-container bg-surface border-outline"],
|
|
46
47
|
success: ["border-success bg-success-container text-on-success-container"],
|
|
47
48
|
alert: ["border-alert bg-alert-container text-on-alert-container"],
|
|
48
49
|
error: ["border-error bg-error-container text-on-error-container"]
|
|
@@ -52,30 +53,33 @@ const ie = ne(
|
|
|
52
53
|
intent: "neutral"
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
),
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
56
|
+
), Fe = le, E = ({ index: e, className: o, ...t }) => {
|
|
57
|
+
const i = ge(), r = e ?? 0, d = i.slots[r];
|
|
58
|
+
if (!d)
|
|
58
59
|
return null;
|
|
59
|
-
const { char: p, isActive:
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
const { char: p, isActive: g, hasFakeCaret: v } = d, O = !p, T = O && !v && i.placeholder, h = r === i.activeIndex;
|
|
61
|
+
return /* @__PURE__ */ se(
|
|
61
62
|
"div",
|
|
62
63
|
{
|
|
63
|
-
className:
|
|
64
|
-
intent:
|
|
65
|
-
className:
|
|
64
|
+
className: le({
|
|
65
|
+
intent: i.intent,
|
|
66
|
+
className: o
|
|
66
67
|
}),
|
|
67
|
-
"data-active":
|
|
68
|
-
"data-disabled":
|
|
69
|
-
"data-
|
|
68
|
+
"data-active": g,
|
|
69
|
+
"data-disabled": i.disabled,
|
|
70
|
+
"data-readonly": i.readOnly,
|
|
71
|
+
"data-filled": !O,
|
|
72
|
+
"data-focus-target": h,
|
|
73
|
+
"data-valid": i.intent !== "error",
|
|
70
74
|
...t,
|
|
71
75
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
76
|
+
/* @__PURE__ */ I("span", { className: T ? "text-on-surface/dim-3" : "", children: i.type === "password" && p ? "•" : p || (!v && i.placeholder ? i.placeholder : "") }),
|
|
77
|
+
v && /* @__PURE__ */ I(
|
|
74
78
|
"span",
|
|
75
79
|
{
|
|
76
80
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
77
81
|
"aria-hidden": "true",
|
|
78
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ I("span", { className: "bg-on-surface animate-standalone-caret-blink h-sz-24 w-sz-2" })
|
|
79
83
|
}
|
|
80
84
|
)
|
|
81
85
|
]
|
|
@@ -83,160 +87,166 @@ const ie = ne(
|
|
|
83
87
|
);
|
|
84
88
|
};
|
|
85
89
|
E.displayName = "InputOTP.Slot";
|
|
86
|
-
const
|
|
90
|
+
const Oe = "Backspace", Pe = "ArrowLeft", Te = "ArrowUp", we = "ArrowRight", Ne = "ArrowDown", Re = "e", Se = ({
|
|
87
91
|
maxLength: e,
|
|
88
|
-
type:
|
|
92
|
+
type: o,
|
|
89
93
|
value: t,
|
|
90
|
-
defaultValue:
|
|
94
|
+
defaultValue: i,
|
|
91
95
|
onValueChange: r,
|
|
92
|
-
isValid:
|
|
96
|
+
isValid: d,
|
|
93
97
|
disabledProp: p,
|
|
98
|
+
readOnlyProp: g,
|
|
94
99
|
autoFocus: v,
|
|
95
|
-
forceUppercase:
|
|
96
|
-
filterKeys:
|
|
97
|
-
pattern:
|
|
98
|
-
placeholder:
|
|
99
|
-
nameProp:
|
|
100
|
+
forceUppercase: O,
|
|
101
|
+
filterKeys: T,
|
|
102
|
+
pattern: h,
|
|
103
|
+
placeholder: D,
|
|
104
|
+
nameProp: V
|
|
100
105
|
}) => {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
s.current && s.current.setSelectionRange(
|
|
104
|
-
}, [
|
|
105
|
-
const
|
|
106
|
-
() => Array.from({ length: e }, (
|
|
107
|
-
char:
|
|
108
|
-
isActive:
|
|
109
|
-
hasFakeCaret:
|
|
106
|
+
const W = xe(), s = te(null), Y = te(null), c = Ie(), w = c.id ?? W, k = V ?? c.name, f = c.disabled ?? p, y = c.readOnly ?? g, _ = c.isInvalid ?? !d, q = c.isRequired ?? !1, F = c.labelId, K = c.description, N = c.state, R = ["success", "alert", "error"].includes(N ?? "") ? N : _ ? "error" : "neutral", P = t !== void 0 ? t : i, M = O ? P.toUpperCase() : P, [$, S] = ne(M), [A, j] = ne(!1), l = t !== void 0 ? t : $, b = Math.min(l.length, e - 1);
|
|
107
|
+
J(() => {
|
|
108
|
+
s.current && s.current.setSelectionRange(b, b);
|
|
109
|
+
}, [b, l.length, e]);
|
|
110
|
+
const z = L(
|
|
111
|
+
() => Array.from({ length: e }, (n, a) => ({
|
|
112
|
+
char: l[a] || "",
|
|
113
|
+
isActive: a === b && A,
|
|
114
|
+
hasFakeCaret: a === b && !l[a] && !f && !y && A
|
|
110
115
|
})),
|
|
111
|
-
[e,
|
|
116
|
+
[e, l, b, A, f, y]
|
|
112
117
|
);
|
|
113
|
-
|
|
118
|
+
J(() => {
|
|
114
119
|
s.current && t !== void 0 && (s.current.value = t);
|
|
115
|
-
}, [t]),
|
|
120
|
+
}, [t]), J(() => {
|
|
116
121
|
v && s.current && s.current.focus();
|
|
117
122
|
}, [v]);
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
if (
|
|
123
|
+
const G = (n) => {
|
|
124
|
+
let a = n;
|
|
125
|
+
if (O && (a = a.toUpperCase()), o === "number" && (a = a.replace(/[^\d]/g, "")), h)
|
|
121
126
|
try {
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
} catch (
|
|
127
|
-
console.error("Invalid pattern provided to InputOTP:",
|
|
127
|
+
let x = h;
|
|
128
|
+
h.startsWith("^") || (x = `^${h}$`);
|
|
129
|
+
const u = new RegExp(x);
|
|
130
|
+
a = a.split("").filter((m) => u.test(m)).join("");
|
|
131
|
+
} catch (x) {
|
|
132
|
+
console.error("Invalid pattern provided to InputOTP:", h, x);
|
|
128
133
|
}
|
|
129
|
-
return
|
|
134
|
+
return a;
|
|
130
135
|
};
|
|
131
136
|
return {
|
|
132
|
-
uuid:
|
|
137
|
+
uuid: w,
|
|
133
138
|
inputRef: s,
|
|
134
|
-
containerRef:
|
|
135
|
-
name:
|
|
136
|
-
disabled:
|
|
139
|
+
containerRef: Y,
|
|
140
|
+
name: k,
|
|
141
|
+
disabled: f,
|
|
142
|
+
readOnly: y,
|
|
137
143
|
isInvalid: _,
|
|
138
|
-
isRequired:
|
|
139
|
-
description:
|
|
144
|
+
isRequired: q,
|
|
145
|
+
description: K,
|
|
140
146
|
maxLength: e,
|
|
141
|
-
intent:
|
|
142
|
-
currentValue:
|
|
143
|
-
activeIndex:
|
|
144
|
-
slots:
|
|
147
|
+
intent: R,
|
|
148
|
+
currentValue: l,
|
|
149
|
+
activeIndex: b,
|
|
150
|
+
slots: z,
|
|
145
151
|
contextValue: {
|
|
146
|
-
value:
|
|
152
|
+
value: l,
|
|
147
153
|
maxLength: e,
|
|
148
|
-
slots:
|
|
149
|
-
activeIndex:
|
|
150
|
-
intent:
|
|
151
|
-
disabled:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
slots: z,
|
|
155
|
+
activeIndex: b,
|
|
156
|
+
intent: R,
|
|
157
|
+
disabled: f,
|
|
158
|
+
readOnly: y,
|
|
159
|
+
placeholder: D,
|
|
160
|
+
type: o
|
|
154
161
|
},
|
|
155
|
-
handleChange: (
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
r && r(
|
|
159
|
-
const
|
|
160
|
-
s.current && s.current.setSelectionRange(
|
|
162
|
+
handleChange: (n) => {
|
|
163
|
+
if (f || y) return;
|
|
164
|
+
const a = n.target.value, u = G(a).slice(0, e);
|
|
165
|
+
r && r(u), t === void 0 && S(u);
|
|
166
|
+
const m = Math.min(u.length, e - 1);
|
|
167
|
+
s.current && s.current.setSelectionRange(m, m);
|
|
161
168
|
},
|
|
162
|
-
handleKeyDown: (
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
169
|
+
handleKeyDown: (n) => {
|
|
170
|
+
if (f || y) return;
|
|
171
|
+
const a = (n.ctrlKey || n.metaKey) && ["a", "c", "v", "x"].includes(n.key.toLowerCase());
|
|
172
|
+
if (T.length > 0 && T.includes(n.key) && !a) {
|
|
173
|
+
n.preventDefault();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
switch (n.key) {
|
|
177
|
+
case Oe:
|
|
178
|
+
n.preventDefault();
|
|
179
|
+
const x = l.length;
|
|
180
|
+
if (x > 0) {
|
|
181
|
+
const u = l.slice(0, x - 1);
|
|
182
|
+
r && r(u), t === void 0 && S(u);
|
|
183
|
+
const m = Math.max(0, u.length);
|
|
184
|
+
s.current && s.current.setSelectionRange(m, m);
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case Pe:
|
|
188
|
+
case we:
|
|
189
|
+
n.preventDefault();
|
|
190
|
+
break;
|
|
191
|
+
case Te:
|
|
192
|
+
case Ne:
|
|
193
|
+
n.preventDefault();
|
|
194
|
+
break;
|
|
195
|
+
case Re:
|
|
196
|
+
case "E":
|
|
197
|
+
o === "number" && n.preventDefault();
|
|
198
|
+
break;
|
|
192
199
|
}
|
|
193
200
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
handleCopy: (n) => {
|
|
202
|
+
f || (n.preventDefault(), l.length > 0 && n.clipboardData.setData("text/plain", l));
|
|
203
|
+
},
|
|
204
|
+
handlePaste: (n) => {
|
|
205
|
+
if (f || y) return;
|
|
206
|
+
n.preventDefault();
|
|
207
|
+
const a = n.clipboardData.getData("text");
|
|
208
|
+
if (!a) return;
|
|
209
|
+
const u = G(a).slice(0, e);
|
|
210
|
+
r && r(u), t === void 0 && S(u);
|
|
211
|
+
const m = Math.min(u.length, e - 1);
|
|
212
|
+
s.current && s.current.setSelectionRange(m, m);
|
|
203
213
|
},
|
|
204
214
|
handleFocus: () => {
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
s.current.setSelectionRange(
|
|
215
|
+
if (j(!0), s.current) {
|
|
216
|
+
const n = Math.min(l.length, e - 1);
|
|
217
|
+
s.current.setSelectionRange(n, n);
|
|
208
218
|
}
|
|
209
219
|
},
|
|
210
220
|
handleBlur: () => {
|
|
211
|
-
|
|
221
|
+
j(!1);
|
|
212
222
|
},
|
|
213
223
|
handleClick: () => {
|
|
214
224
|
s.current && s.current.focus();
|
|
215
225
|
},
|
|
216
|
-
labelId:
|
|
226
|
+
labelId: F
|
|
217
227
|
};
|
|
218
|
-
},
|
|
219
|
-
let
|
|
220
|
-
return
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
t.type === E || t.type?.displayName === "InputOTP.Slot" ?
|
|
228
|
+
}, ue = (e) => {
|
|
229
|
+
let o = 0;
|
|
230
|
+
return oe.forEach(e, (t) => {
|
|
231
|
+
if (ie(t)) {
|
|
232
|
+
const i = t.props;
|
|
233
|
+
t.type === E || t.type?.displayName === "InputOTP.Slot" ? o++ : i.children && (o += ue(i.children));
|
|
224
234
|
}
|
|
225
|
-
}),
|
|
226
|
-
},
|
|
227
|
-
let t =
|
|
228
|
-
return [
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
235
|
+
}), o;
|
|
236
|
+
}, de = (e, o = 0) => {
|
|
237
|
+
let t = o;
|
|
238
|
+
return [oe.map(e, (r) => {
|
|
239
|
+
if (ie(r)) {
|
|
240
|
+
const d = r.props;
|
|
231
241
|
if (r.type === E || r.type?.displayName === "InputOTP.Slot") {
|
|
232
|
-
const p = typeof
|
|
233
|
-
return
|
|
234
|
-
...
|
|
242
|
+
const p = typeof d.index == "number" ? d.index : t++;
|
|
243
|
+
return re(r, {
|
|
244
|
+
...d,
|
|
235
245
|
index: p
|
|
236
246
|
});
|
|
237
|
-
} else if (
|
|
238
|
-
const [p,
|
|
239
|
-
return t =
|
|
247
|
+
} else if (d.children) {
|
|
248
|
+
const [p, g] = de(d.children, t);
|
|
249
|
+
return t = g, re(r, {
|
|
240
250
|
...r.props,
|
|
241
251
|
children: p
|
|
242
252
|
});
|
|
@@ -244,149 +254,158 @@ const ye = "Backspace", Pe = "ArrowLeft", Te = "ArrowUp", Oe = "ArrowRight", we
|
|
|
244
254
|
}
|
|
245
255
|
return r;
|
|
246
256
|
}), t];
|
|
247
|
-
},
|
|
257
|
+
}, pe = ({
|
|
248
258
|
maxLength: e,
|
|
249
|
-
type:
|
|
259
|
+
type: o = "text",
|
|
250
260
|
value: t,
|
|
251
|
-
defaultValue:
|
|
261
|
+
defaultValue: i = "",
|
|
252
262
|
onValueChange: r,
|
|
253
|
-
isValid:
|
|
263
|
+
isValid: d = !0,
|
|
254
264
|
disabled: p = !1,
|
|
265
|
+
readOnly: g = !1,
|
|
255
266
|
autoFocus: v = !1,
|
|
256
|
-
autoComplete:
|
|
257
|
-
forceUppercase:
|
|
258
|
-
filterKeys:
|
|
259
|
-
pattern:
|
|
260
|
-
inputMode:
|
|
261
|
-
placeholder:
|
|
267
|
+
autoComplete: O = "off",
|
|
268
|
+
forceUppercase: T = !1,
|
|
269
|
+
filterKeys: h = ["-", "."],
|
|
270
|
+
pattern: D,
|
|
271
|
+
inputMode: V,
|
|
272
|
+
placeholder: W = "-",
|
|
262
273
|
name: s,
|
|
263
|
-
className:
|
|
274
|
+
className: Y,
|
|
264
275
|
children: c,
|
|
265
|
-
...
|
|
276
|
+
...w
|
|
266
277
|
}) => {
|
|
267
|
-
const
|
|
278
|
+
const k = L(() => {
|
|
268
279
|
if (e !== void 0)
|
|
269
280
|
return e;
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
}, [e, c]),
|
|
273
|
-
const [
|
|
274
|
-
return
|
|
281
|
+
const C = ue(c);
|
|
282
|
+
return C > 0 ? C : 4;
|
|
283
|
+
}, [e, c]), f = L(() => {
|
|
284
|
+
const [C] = de(c);
|
|
285
|
+
return C;
|
|
275
286
|
}, [c]), {
|
|
276
|
-
uuid:
|
|
277
|
-
inputRef:
|
|
278
|
-
containerRef:
|
|
279
|
-
name:
|
|
280
|
-
disabled:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
287
|
+
uuid: y,
|
|
288
|
+
inputRef: _,
|
|
289
|
+
containerRef: q,
|
|
290
|
+
name: F,
|
|
291
|
+
disabled: K,
|
|
292
|
+
readOnly: N,
|
|
293
|
+
isInvalid: U,
|
|
294
|
+
isRequired: R,
|
|
295
|
+
description: P,
|
|
296
|
+
currentValue: M,
|
|
297
|
+
contextValue: $,
|
|
298
|
+
handleChange: S,
|
|
299
|
+
handleKeyDown: A,
|
|
300
|
+
handleCopy: j,
|
|
301
|
+
handlePaste: l,
|
|
302
|
+
handleFocus: b,
|
|
303
|
+
handleBlur: z,
|
|
304
|
+
handleClick: G,
|
|
305
|
+
labelId: H
|
|
306
|
+
} = Se({
|
|
307
|
+
maxLength: k,
|
|
308
|
+
type: o,
|
|
296
309
|
value: t,
|
|
297
|
-
defaultValue:
|
|
310
|
+
defaultValue: i,
|
|
298
311
|
onValueChange: r,
|
|
299
|
-
isValid:
|
|
312
|
+
isValid: d,
|
|
300
313
|
disabledProp: p,
|
|
314
|
+
readOnlyProp: g,
|
|
301
315
|
autoFocus: v,
|
|
302
|
-
forceUppercase:
|
|
303
|
-
filterKeys:
|
|
304
|
-
pattern:
|
|
305
|
-
placeholder:
|
|
316
|
+
forceUppercase: T,
|
|
317
|
+
filterKeys: h,
|
|
318
|
+
pattern: D,
|
|
319
|
+
placeholder: W,
|
|
306
320
|
nameProp: s
|
|
307
|
-
}),
|
|
308
|
-
return /* @__PURE__ */
|
|
321
|
+
}), X = "aria-label" in w ? w["aria-label"] : void 0, { "aria-label": fe, ...ee } = w, B = H ? { "aria-labelledby": H } : X ? { "aria-label": X } : {};
|
|
322
|
+
return /* @__PURE__ */ I(ce.Provider, { value: $, children: /* @__PURE__ */ se(
|
|
309
323
|
"div",
|
|
310
324
|
{
|
|
311
|
-
ref:
|
|
325
|
+
ref: q,
|
|
312
326
|
"data-spark-component": "input-otp",
|
|
313
327
|
role: "group",
|
|
314
|
-
...
|
|
315
|
-
...
|
|
316
|
-
className:
|
|
317
|
-
"gap-md relative inline-flex items-center",
|
|
318
|
-
|
|
319
|
-
|
|
328
|
+
...B,
|
|
329
|
+
...P ? { "aria-describedby": P } : {},
|
|
330
|
+
className: ve(
|
|
331
|
+
"group gap-md relative inline-flex w-fit items-center default:cursor-text",
|
|
332
|
+
{
|
|
333
|
+
"cursor-not-allowed": K,
|
|
334
|
+
"cursor-default": N
|
|
335
|
+
},
|
|
336
|
+
Y
|
|
320
337
|
),
|
|
321
|
-
onClick:
|
|
322
|
-
...
|
|
338
|
+
onClick: G,
|
|
339
|
+
...ee,
|
|
323
340
|
children: [
|
|
324
|
-
|
|
341
|
+
F && /* @__PURE__ */ I(
|
|
325
342
|
"input",
|
|
326
343
|
{
|
|
327
344
|
type: "hidden",
|
|
328
|
-
name:
|
|
329
|
-
value:
|
|
330
|
-
required:
|
|
331
|
-
"aria-required":
|
|
332
|
-
"aria-invalid":
|
|
333
|
-
...
|
|
345
|
+
name: F,
|
|
346
|
+
value: M,
|
|
347
|
+
required: R,
|
|
348
|
+
"aria-required": R,
|
|
349
|
+
"aria-invalid": U,
|
|
350
|
+
...B
|
|
334
351
|
}
|
|
335
352
|
),
|
|
336
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ I(
|
|
337
354
|
"input",
|
|
338
355
|
{
|
|
339
|
-
ref:
|
|
340
|
-
id:
|
|
341
|
-
type:
|
|
342
|
-
value:
|
|
343
|
-
maxLength:
|
|
356
|
+
ref: _,
|
|
357
|
+
id: y,
|
|
358
|
+
type: o === "password" ? "password" : "text",
|
|
359
|
+
value: M,
|
|
360
|
+
maxLength: k,
|
|
344
361
|
autoFocus: v,
|
|
345
|
-
autoComplete:
|
|
346
|
-
disabled:
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
...
|
|
351
|
-
"aria-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
362
|
+
autoComplete: O,
|
|
363
|
+
disabled: K,
|
|
364
|
+
readOnly: N,
|
|
365
|
+
pattern: D,
|
|
366
|
+
inputMode: V,
|
|
367
|
+
...B,
|
|
368
|
+
...P ? { "aria-describedby": P } : {},
|
|
369
|
+
"aria-invalid": U,
|
|
370
|
+
onChange: S,
|
|
371
|
+
onKeyDown: A,
|
|
372
|
+
onCopy: j,
|
|
373
|
+
onPaste: l,
|
|
374
|
+
onFocus: b,
|
|
375
|
+
onBlur: z,
|
|
376
|
+
className: "bg-success z-raised absolute inset-0 m-0 p-0 opacity-0 read-only:cursor-default disabled:cursor-not-allowed",
|
|
358
377
|
tabIndex: 0
|
|
359
378
|
}
|
|
360
379
|
),
|
|
361
|
-
|
|
380
|
+
f
|
|
362
381
|
]
|
|
363
382
|
}
|
|
364
383
|
) });
|
|
365
384
|
};
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const
|
|
385
|
+
pe.displayName = "InputOTP";
|
|
386
|
+
const Q = ({ children: e, className: o, ...t }) => /* @__PURE__ */ I("div", { className: `gap-md flex ${o}`, ...t, children: e });
|
|
387
|
+
Q.displayName = "InputOTP.Group";
|
|
388
|
+
const Z = ({ className: e, ...o }) => /* @__PURE__ */ I(
|
|
370
389
|
"div",
|
|
371
390
|
{
|
|
372
|
-
className: `text-on-surface flex items-center justify-center ${e || ""}`,
|
|
373
|
-
...
|
|
374
|
-
children: /* @__PURE__ */
|
|
391
|
+
className: `text-on-surface/dim-3 flex items-center justify-center ${e || ""}`,
|
|
392
|
+
...o,
|
|
393
|
+
children: /* @__PURE__ */ I("div", { className: "h-sz-4 w-sz-8 bg-outline rounded-full" })
|
|
375
394
|
}
|
|
376
395
|
);
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
Group:
|
|
396
|
+
Z.displayName = "InputOTP.Separator";
|
|
397
|
+
const Ae = Object.assign(pe, {
|
|
398
|
+
Group: Q,
|
|
380
399
|
Slot: E,
|
|
381
|
-
Separator:
|
|
400
|
+
Separator: Z
|
|
382
401
|
});
|
|
383
|
-
|
|
384
|
-
|
|
402
|
+
Ae.displayName = "InputOTP";
|
|
403
|
+
Q.displayName = "InputOTP.Group";
|
|
385
404
|
E.displayName = "InputOTP.Slot";
|
|
386
|
-
|
|
405
|
+
Z.displayName = "InputOTP.Separator";
|
|
387
406
|
export {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
407
|
+
Ae as InputOTP,
|
|
408
|
+
le as inputOTPSlotStyles,
|
|
409
|
+
Fe as inputOTPStyles
|
|
391
410
|
};
|
|
392
411
|
//# sourceMappingURL=index.mjs.map
|