@progress/kendo-react-inputs 15.0.1-develop.9 → 15.1.0-develop.1
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/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +8 -1
- package/index.d.ts +8 -1
- package/index.js +1 -1
- package/index.mjs +79 -76
- package/messages/index.d.ts +10 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +60 -56
- package/otpinput/OTPInput.d.ts +14 -0
- package/otpinput/OTPInput.js +8 -0
- package/otpinput/OTPInput.mjs +301 -0
- package/otpinput/OTPInputCell.d.ts +32 -0
- package/otpinput/OTPInputCell.js +8 -0
- package/otpinput/OTPInputCell.mjs +96 -0
- package/otpinput/OTPInputSeparator.d.ts +15 -0
- package/otpinput/OTPInputSeparator.js +8 -0
- package/otpinput/OTPInputSeparator.mjs +17 -0
- package/otpinput/interfaces/OTPInputBlurEvent.d.ts +23 -0
- package/otpinput/interfaces/OTPInputChangeEvent.d.ts +19 -0
- package/otpinput/interfaces/OTPInputFocusEvent.d.ts +27 -0
- package/otpinput/interfaces/OTPInputHandle.d.ts +33 -0
- package/otpinput/interfaces/OTPInputProps.d.ts +314 -0
- package/otpinput/interfaces/OTPSeparatorIcon.d.ts +27 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as r from "react";
|
|
9
|
+
import { useAsyncFocusBlur as de, useWebMcpRegister as me, classNames as he, kendoThemeMaps as be } from "@progress/kendo-react-common";
|
|
10
|
+
import { OTPInputCell as Ce } from "./OTPInputCell.mjs";
|
|
11
|
+
import { OTPInputSeparator as ge } from "./OTPInputSeparator.mjs";
|
|
12
|
+
import { useLocalization as ve } from "@progress/kendo-react-intl";
|
|
13
|
+
import { otpInputAriaLabel as j, messages as ke } from "../messages/index.mjs";
|
|
14
|
+
const ye = 4;
|
|
15
|
+
function Ee(f, d) {
|
|
16
|
+
if (Array.isArray(d)) {
|
|
17
|
+
const C = d.reduce((_, w) => _ + w, 0);
|
|
18
|
+
return C !== f && console.warn(`[OTPInput] The sum of groupLength values (${C}) must equal length (${f}).`), d;
|
|
19
|
+
}
|
|
20
|
+
const y = [];
|
|
21
|
+
let m = f;
|
|
22
|
+
for (; m > 0; )
|
|
23
|
+
y.push(Math.min(d, m)), m -= d;
|
|
24
|
+
return y;
|
|
25
|
+
}
|
|
26
|
+
const _e = r.forwardRef((f, d) => {
|
|
27
|
+
const {
|
|
28
|
+
value: y,
|
|
29
|
+
defaultValue: m,
|
|
30
|
+
length: C,
|
|
31
|
+
groupLength: _,
|
|
32
|
+
separator: w,
|
|
33
|
+
type: h,
|
|
34
|
+
placeholder: H,
|
|
35
|
+
spacing: L,
|
|
36
|
+
disabled: z,
|
|
37
|
+
readOnly: E,
|
|
38
|
+
inputAttributes: q,
|
|
39
|
+
name: R,
|
|
40
|
+
required: G,
|
|
41
|
+
valid: A,
|
|
42
|
+
size: D,
|
|
43
|
+
fillMode: U,
|
|
44
|
+
rounded: W,
|
|
45
|
+
onChange: M,
|
|
46
|
+
onFocus: B,
|
|
47
|
+
onBlur: N,
|
|
48
|
+
ariaLabel: J,
|
|
49
|
+
ariaLabelledBy: Q,
|
|
50
|
+
ariaDescribedBy: X,
|
|
51
|
+
id: I,
|
|
52
|
+
style: Y,
|
|
53
|
+
dir: V,
|
|
54
|
+
className: Z,
|
|
55
|
+
// Form
|
|
56
|
+
touched: we,
|
|
57
|
+
visited: Re,
|
|
58
|
+
modified: De,
|
|
59
|
+
validationMessage: Te,
|
|
60
|
+
...x
|
|
61
|
+
} = f, o = C != null ? C : ye, F = y !== void 0, [ee, te] = r.useState(() => (m != null ? m : "").padEnd(o, " ").slice(0, o)), n = (F ? y : ee).padEnd(o, " ").slice(0, o), O = r.useRef(n);
|
|
62
|
+
O.current = n;
|
|
63
|
+
const [ae, P] = r.useState(null), g = r.useRef(null), v = r.useCallback((e) => {
|
|
64
|
+
g.current !== null && clearTimeout(g.current), P(e), g.current = setTimeout(() => {
|
|
65
|
+
P(null), g.current = null;
|
|
66
|
+
}, 300);
|
|
67
|
+
}, []);
|
|
68
|
+
r.useEffect(() => () => {
|
|
69
|
+
g.current !== null && clearTimeout(g.current);
|
|
70
|
+
}, []);
|
|
71
|
+
const S = r.useRef(null), T = r.useRef([]), k = r.useRef(null), c = r.useCallback(
|
|
72
|
+
(e) => {
|
|
73
|
+
var l;
|
|
74
|
+
const t = Math.max(0, Math.min(e, o - 1));
|
|
75
|
+
(l = T.current[t]) == null || l.focus();
|
|
76
|
+
},
|
|
77
|
+
[o]
|
|
78
|
+
), p = r.useCallback(
|
|
79
|
+
(e, t) => {
|
|
80
|
+
const l = e.padEnd(o, " ").slice(0, o);
|
|
81
|
+
l !== n && (O.current = l, F || te(l), M && M({
|
|
82
|
+
syntheticEvent: t,
|
|
83
|
+
nativeEvent: t.nativeEvent,
|
|
84
|
+
target: k.current,
|
|
85
|
+
value: l
|
|
86
|
+
}));
|
|
87
|
+
},
|
|
88
|
+
[F, o, M, n]
|
|
89
|
+
), re = r.useCallback(
|
|
90
|
+
(e, t, l) => {
|
|
91
|
+
const a = l.target.value.slice(-1);
|
|
92
|
+
if (!a)
|
|
93
|
+
return;
|
|
94
|
+
if (h === "number" && !/^\d$/.test(a)) {
|
|
95
|
+
v(e);
|
|
96
|
+
const b = n[e] === " " ? "" : n[e];
|
|
97
|
+
l.target.value = b, l.target.select();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const i = O.current.split("");
|
|
101
|
+
i[e] = a;
|
|
102
|
+
const s = i.join("");
|
|
103
|
+
p(s, l), c(e + 1);
|
|
104
|
+
},
|
|
105
|
+
[n, p, c, h, v]
|
|
106
|
+
), K = r.useCallback(
|
|
107
|
+
(e, t, l) => {
|
|
108
|
+
if (l.preventDefault(), h === "number" && !/^\d$/.test(t)) {
|
|
109
|
+
v(e), l.target.select();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const u = n.split("");
|
|
113
|
+
u[e] = t, p(u.join(""), l), c(e + 1);
|
|
114
|
+
},
|
|
115
|
+
[h, v, n, p, c]
|
|
116
|
+
), le = r.useCallback(
|
|
117
|
+
(e, t) => {
|
|
118
|
+
var u;
|
|
119
|
+
if (E)
|
|
120
|
+
return;
|
|
121
|
+
const l = V === "rtl";
|
|
122
|
+
switch (t.key) {
|
|
123
|
+
case "ArrowLeft": {
|
|
124
|
+
t.preventDefault(), c(l ? e + 1 : e - 1);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "ArrowRight": {
|
|
128
|
+
t.preventDefault(), c(l ? e - 1 : e + 1);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case "ArrowUp":
|
|
132
|
+
case "ArrowDown": {
|
|
133
|
+
t.preventDefault();
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case "Backspace": {
|
|
137
|
+
t.preventDefault();
|
|
138
|
+
const a = n.split("");
|
|
139
|
+
a[e] = " ", p(a.join(""), t), c(e - 1);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case "Delete": {
|
|
143
|
+
t.preventDefault();
|
|
144
|
+
const a = n.split("");
|
|
145
|
+
a[e] = " ", p(a.join(""), t);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
default: {
|
|
149
|
+
const { key: a, ctrlKey: i, altKey: s, metaKey: b } = t, $ = (u = n[e]) != null ? u : " ";
|
|
150
|
+
a.length === 1 && !i && !s && !b && $ !== " " && K(e, a, t);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
[n, p, c, V, E, K]
|
|
156
|
+
), ne = r.useCallback(
|
|
157
|
+
(e, t) => {
|
|
158
|
+
B && B({
|
|
159
|
+
syntheticEvent: t,
|
|
160
|
+
nativeEvent: t.nativeEvent,
|
|
161
|
+
target: k.current,
|
|
162
|
+
cellIndex: e
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
[B]
|
|
166
|
+
), se = r.useCallback((e, t) => {
|
|
167
|
+
}, []), { onFocus: oe, onBlur: ue } = de({
|
|
168
|
+
onFocus: (e) => {
|
|
169
|
+
},
|
|
170
|
+
onBlur: (e) => {
|
|
171
|
+
N && N({
|
|
172
|
+
syntheticEvent: e,
|
|
173
|
+
nativeEvent: e.nativeEvent,
|
|
174
|
+
target: k.current
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}), ce = r.useCallback(
|
|
178
|
+
(e) => {
|
|
179
|
+
if (e.preventDefault(), E)
|
|
180
|
+
return;
|
|
181
|
+
const t = e.clipboardData.getData("text");
|
|
182
|
+
if (!t)
|
|
183
|
+
return;
|
|
184
|
+
const l = T.current.findIndex((s) => s === document.activeElement), u = l >= 0 ? l : 0;
|
|
185
|
+
if (h === "number" && !/^\d+$/.test(t.trim())) {
|
|
186
|
+
v(u);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const a = n.split("");
|
|
190
|
+
for (let s = 0; s < t.length && u + s < o; s++)
|
|
191
|
+
a[u + s] = t[s];
|
|
192
|
+
p(a.join(""), e);
|
|
193
|
+
const i = Math.min(u + t.length, o - 1);
|
|
194
|
+
c(i);
|
|
195
|
+
},
|
|
196
|
+
[n, p, c, o, h, v, E]
|
|
197
|
+
);
|
|
198
|
+
r.useImperativeHandle(k, () => ({
|
|
199
|
+
get element() {
|
|
200
|
+
return S.current;
|
|
201
|
+
},
|
|
202
|
+
get value() {
|
|
203
|
+
return n;
|
|
204
|
+
},
|
|
205
|
+
focus(e) {
|
|
206
|
+
if (e !== void 0)
|
|
207
|
+
c(e);
|
|
208
|
+
else {
|
|
209
|
+
const t = n.indexOf(" ");
|
|
210
|
+
c(t >= 0 ? t : o - 1);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
blur() {
|
|
214
|
+
T.current.forEach((e) => e == null ? void 0 : e.blur());
|
|
215
|
+
}
|
|
216
|
+
})), r.useImperativeHandle(d, () => k.current), me("otpinput", k, f, f.webMcp);
|
|
217
|
+
const ie = () => {
|
|
218
|
+
const e = (a) => {
|
|
219
|
+
var i;
|
|
220
|
+
return /* @__PURE__ */ r.createElement(
|
|
221
|
+
Ce,
|
|
222
|
+
{
|
|
223
|
+
key: a,
|
|
224
|
+
ref: (s) => {
|
|
225
|
+
T.current[a] = s;
|
|
226
|
+
},
|
|
227
|
+
index: a,
|
|
228
|
+
totalLength: o,
|
|
229
|
+
char: (i = n[a]) != null ? i : " ",
|
|
230
|
+
type: h,
|
|
231
|
+
placeholder: H,
|
|
232
|
+
disabled: z,
|
|
233
|
+
readOnly: E,
|
|
234
|
+
required: G,
|
|
235
|
+
size: D,
|
|
236
|
+
fillMode: U,
|
|
237
|
+
rounded: W,
|
|
238
|
+
inputAttributes: q,
|
|
239
|
+
valid: A === !1 || ae === a ? !1 : A,
|
|
240
|
+
onCellChange: re,
|
|
241
|
+
onCellKeyDown: le,
|
|
242
|
+
onCellFocus: ne,
|
|
243
|
+
onCellBlur: se,
|
|
244
|
+
name: R ? `${R}-cell-${a}` : `otp-cell-${a}`,
|
|
245
|
+
id: I ? `${I}-cell-${a}` : `otp-cell-${a}`
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
if (!_) {
|
|
250
|
+
const a = Array.from({ length: o }, (i, s) => e(s));
|
|
251
|
+
return L === !1 ? [
|
|
252
|
+
/* @__PURE__ */ r.createElement("div", { key: "group", className: "k-input-group" }, a)
|
|
253
|
+
] : a;
|
|
254
|
+
}
|
|
255
|
+
const t = Ee(o, _);
|
|
256
|
+
let l = 0;
|
|
257
|
+
const u = [];
|
|
258
|
+
return t.forEach((a, i) => {
|
|
259
|
+
const s = l;
|
|
260
|
+
i > 0 && w !== void 0 && u.push(/* @__PURE__ */ r.createElement(ge, { key: `sep-${s}`, separator: w }));
|
|
261
|
+
const b = [];
|
|
262
|
+
for (let $ = 0; $ < a; $++)
|
|
263
|
+
b.push(e(l++));
|
|
264
|
+
L === !1 ? u.push(
|
|
265
|
+
/* @__PURE__ */ r.createElement("div", { key: `group-${s}`, className: "k-input-group" }, b)
|
|
266
|
+
) : u.push(...b);
|
|
267
|
+
}), u;
|
|
268
|
+
}, pe = he(
|
|
269
|
+
"k-otp",
|
|
270
|
+
{
|
|
271
|
+
"k-disabled": z,
|
|
272
|
+
"k-invalid": A === !1,
|
|
273
|
+
[`k-otp-${be.sizeMap[D] || D}`]: D
|
|
274
|
+
},
|
|
275
|
+
Z
|
|
276
|
+
), fe = ve().toLanguageString(j, ke[j]);
|
|
277
|
+
return /* @__PURE__ */ r.createElement(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
ref: S,
|
|
281
|
+
className: pe,
|
|
282
|
+
role: "group",
|
|
283
|
+
"aria-label": J || fe,
|
|
284
|
+
"aria-labelledby": Q,
|
|
285
|
+
"aria-describedby": X,
|
|
286
|
+
id: I,
|
|
287
|
+
style: Y,
|
|
288
|
+
dir: V,
|
|
289
|
+
onFocus: oe,
|
|
290
|
+
onBlur: ue,
|
|
291
|
+
onPaste: ce,
|
|
292
|
+
...x
|
|
293
|
+
},
|
|
294
|
+
R && /* @__PURE__ */ r.createElement("input", { "aria-hidden": !0, type: "hidden", name: R, value: n.replace(/ /g, "") }),
|
|
295
|
+
ie()
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
_e.displayName = "KendoReactOTPInput";
|
|
299
|
+
export {
|
|
300
|
+
_e as OTPInput
|
|
301
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
/** @hidden */
|
|
10
|
+
export interface OTPInputCellProps {
|
|
11
|
+
index: number;
|
|
12
|
+
totalLength: number;
|
|
13
|
+
char: string;
|
|
14
|
+
type?: 'text' | 'password' | 'number';
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
size?: 'small' | 'medium' | 'large';
|
|
20
|
+
fillMode?: 'solid' | 'flat' | 'outline';
|
|
21
|
+
rounded?: 'small' | 'medium' | 'large' | 'full' | 'none';
|
|
22
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
23
|
+
valid?: boolean;
|
|
24
|
+
onCellChange?: (index: number, char: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
25
|
+
onCellKeyDown?: (index: number, event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
26
|
+
onCellFocus?: (index: number, event: React.FocusEvent<HTMLInputElement>) => void;
|
|
27
|
+
onCellBlur?: (index: number, event: React.FocusEvent<HTMLInputElement>) => void;
|
|
28
|
+
id?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
}
|
|
31
|
+
/** @hidden */
|
|
32
|
+
export declare const OTPInputCell: React.NamedExoticComponent<OTPInputCellProps & React.RefAttributes<HTMLInputElement | null>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),w=require("@progress/kendo-react-common"),z=require("@progress/kendo-react-intl"),D=require("../textbox/Textbox.js"),d=require("../messages/index.js");function E(l){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>l[e]})}}return a.default=l,Object.freeze(a)}const n=E(B),x=n.forwardRef((l,a)=>{const{index:e,totalLength:r,char:p,type:f,placeholder:y,disabled:v,readOnly:b,required:h,size:O,fillMode:I,rounded:T,inputAttributes:k,id:L,name:S,valid:m,onCellChange:i,onCellKeyDown:g,onCellFocus:u,onCellBlur:c}=l,s=n.useRef(null),P=z.useLocalization();n.useImperativeHandle(a,()=>{var t,o;return(o=(t=s.current)==null?void 0:t.element)!=null?o:null});const R={autoComplete:"off","aria-label":P.toLanguageString(d.otpInputCellAriaLabel,d.messages[d.otpInputCellAriaLabel]).replace("{index}",String(e+1)).replace("{total}",String(r)),...k,maxLength:1,...m===!1&&{"aria-invalid":!0},onKeyDown:g?t=>g(e,t):void 0},q=n.useCallback(t=>{i&&i(e,t.syntheticEvent.target.value,t.syntheticEvent)},[e,i]),j=n.useCallback(t=>{var C;const o=(C=s.current)==null?void 0:C.element;o&&o.select(),u&&u(e,t)},[e,u]),A=n.useCallback(t=>{c&&c(e,t)},[e,c]);return n.createElement(D.TextBox,{id:L,name:S,ref:s,className:w.classNames("k-otp-input",{"k-readonly":b}),value:p===" "?"":p,size:O,fillMode:I,rounded:T,disabled:v,readOnly:b,required:h,valid:m,placeholder:y,onChange:i?q:void 0,onFocus:j,onBlur:c?A:void 0,inputAttributes:R,type:f==="number"?"text":f})});x.displayName="OTPInputCell";const N=n.memo(x);exports.OTPInputCell=N;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as l from "react";
|
|
9
|
+
import { classNames as z } from "@progress/kendo-react-common";
|
|
10
|
+
import { useLocalization as F } from "@progress/kendo-react-intl";
|
|
11
|
+
import { TextBox as N } from "../textbox/Textbox.mjs";
|
|
12
|
+
import { otpInputCellAriaLabel as f, messages as P } from "../messages/index.mjs";
|
|
13
|
+
const C = l.forwardRef((b, g) => {
|
|
14
|
+
const {
|
|
15
|
+
index: t,
|
|
16
|
+
totalLength: h,
|
|
17
|
+
char: s,
|
|
18
|
+
type: u,
|
|
19
|
+
placeholder: v,
|
|
20
|
+
disabled: x,
|
|
21
|
+
readOnly: c,
|
|
22
|
+
required: y,
|
|
23
|
+
size: I,
|
|
24
|
+
fillMode: L,
|
|
25
|
+
rounded: T,
|
|
26
|
+
inputAttributes: k,
|
|
27
|
+
id: B,
|
|
28
|
+
name: A,
|
|
29
|
+
valid: p,
|
|
30
|
+
onCellChange: a,
|
|
31
|
+
onCellKeyDown: m,
|
|
32
|
+
onCellFocus: r,
|
|
33
|
+
onCellBlur: o
|
|
34
|
+
} = b, i = l.useRef(null), E = F();
|
|
35
|
+
l.useImperativeHandle(
|
|
36
|
+
g,
|
|
37
|
+
() => {
|
|
38
|
+
var e, n;
|
|
39
|
+
return (n = (e = i.current) == null ? void 0 : e.element) != null ? n : null;
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
const O = {
|
|
43
|
+
autoComplete: "off",
|
|
44
|
+
"aria-label": E.toLanguageString(f, P[f]).replace("{index}", String(t + 1)).replace("{total}", String(h)),
|
|
45
|
+
...k,
|
|
46
|
+
// Protected attrs — cannot be overridden by user's inputAttributes:
|
|
47
|
+
maxLength: 1,
|
|
48
|
+
...p === !1 && { "aria-invalid": !0 },
|
|
49
|
+
onKeyDown: m ? (e) => m(t, e) : void 0
|
|
50
|
+
}, R = l.useCallback(
|
|
51
|
+
(e) => {
|
|
52
|
+
a && a(t, e.syntheticEvent.target.value, e.syntheticEvent);
|
|
53
|
+
},
|
|
54
|
+
[t, a]
|
|
55
|
+
), S = l.useCallback(
|
|
56
|
+
(e) => {
|
|
57
|
+
var d;
|
|
58
|
+
const n = (d = i.current) == null ? void 0 : d.element;
|
|
59
|
+
n && n.select(), r && r(t, e);
|
|
60
|
+
},
|
|
61
|
+
[t, r]
|
|
62
|
+
), w = l.useCallback(
|
|
63
|
+
(e) => {
|
|
64
|
+
o && o(t, e);
|
|
65
|
+
},
|
|
66
|
+
[t, o]
|
|
67
|
+
);
|
|
68
|
+
return /* @__PURE__ */ l.createElement(
|
|
69
|
+
N,
|
|
70
|
+
{
|
|
71
|
+
id: B,
|
|
72
|
+
name: A,
|
|
73
|
+
ref: i,
|
|
74
|
+
className: z("k-otp-input", { "k-readonly": c }),
|
|
75
|
+
value: s === " " ? "" : s,
|
|
76
|
+
size: I,
|
|
77
|
+
fillMode: L,
|
|
78
|
+
rounded: T,
|
|
79
|
+
disabled: x,
|
|
80
|
+
readOnly: c,
|
|
81
|
+
required: y,
|
|
82
|
+
valid: p,
|
|
83
|
+
placeholder: v,
|
|
84
|
+
onChange: a ? R : void 0,
|
|
85
|
+
onFocus: S,
|
|
86
|
+
onBlur: o ? w : void 0,
|
|
87
|
+
inputAttributes: O,
|
|
88
|
+
type: u === "number" ? "text" : u
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
C.displayName = "OTPInputCell";
|
|
93
|
+
const j = l.memo(C);
|
|
94
|
+
export {
|
|
95
|
+
j as OTPInputCell
|
|
96
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { OTPSeparatorIcon } from './interfaces/OTPSeparatorIcon';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/** @hidden */
|
|
11
|
+
export interface OTPInputSeparatorProps {
|
|
12
|
+
separator: string | OTPSeparatorIcon;
|
|
13
|
+
}
|
|
14
|
+
/** @hidden */
|
|
15
|
+
export declare const OTPInputSeparator: (props: OTPInputSeparatorProps) => React.ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),o=require("@progress/kendo-react-common");function s(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const a=s(c),l=n=>{const{separator:e}=n;let t;return typeof e=="string"?t=e:e.type==="svgIcon"?t=a.createElement(o.IconWrap,{icon:e.value}):e.type==="iconClass"?t=a.createElement("span",{className:e.value}):t=a.createElement(o.IconWrap,{name:e.value}),a.createElement("div",{className:"k-otp-separator"},t)};exports.OTPInputSeparator=l;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as a from "react";
|
|
9
|
+
import { IconWrap as r } from "@progress/kendo-react-common";
|
|
10
|
+
const s = (n) => {
|
|
11
|
+
const { separator: e } = n;
|
|
12
|
+
let t;
|
|
13
|
+
return typeof e == "string" ? t = e : e.type === "svgIcon" ? t = /* @__PURE__ */ a.createElement(r, { icon: e.value }) : e.type === "iconClass" ? t = /* @__PURE__ */ a.createElement("span", { className: e.value }) : t = /* @__PURE__ */ a.createElement(r, { name: e.value }), /* @__PURE__ */ a.createElement("div", { className: "k-otp-separator" }, t);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
s as OTPInputSeparator
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { OTPInputHandle } from './OTPInputHandle';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Event object fired by `OTPInput.onBlur`.
|
|
13
|
+
*/
|
|
14
|
+
export interface OTPInputBlurEvent extends BaseEvent<OTPInputHandle> {
|
|
15
|
+
/**
|
|
16
|
+
* The underlying native blur event.
|
|
17
|
+
*/
|
|
18
|
+
nativeEvent: FocusEvent;
|
|
19
|
+
/**
|
|
20
|
+
* The underlying React synthetic event.
|
|
21
|
+
*/
|
|
22
|
+
syntheticEvent: React.FocusEvent<HTMLInputElement>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { OTPInputHandle } from './OTPInputHandle';
|
|
10
|
+
/**
|
|
11
|
+
* Event object fired by `OTPInput.onChange`.
|
|
12
|
+
*/
|
|
13
|
+
export interface OTPInputChangeEvent extends BaseEvent<OTPInputHandle> {
|
|
14
|
+
/**
|
|
15
|
+
* The new full string value of the OTPInput after the change.
|
|
16
|
+
* Unfilled cells are represented as a space (`' '`).
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { OTPInputHandle } from './OTPInputHandle';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Event object fired by `OTPInput.onFocus`.
|
|
13
|
+
*/
|
|
14
|
+
export interface OTPInputFocusEvent extends BaseEvent<OTPInputHandle> {
|
|
15
|
+
/**
|
|
16
|
+
* The zero-based index of the cell that received focus.
|
|
17
|
+
*/
|
|
18
|
+
cellIndex: number;
|
|
19
|
+
/**
|
|
20
|
+
* The underlying native focus event.
|
|
21
|
+
*/
|
|
22
|
+
nativeEvent: FocusEvent;
|
|
23
|
+
/**
|
|
24
|
+
* The underlying React synthetic event.
|
|
25
|
+
*/
|
|
26
|
+
syntheticEvent: React.FocusEvent<HTMLInputElement>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Represents the `ref` of the KendoReact OTPInput component.
|
|
10
|
+
*/
|
|
11
|
+
export interface OTPInputHandle {
|
|
12
|
+
/**
|
|
13
|
+
* The root wrapper DOM element.
|
|
14
|
+
*/
|
|
15
|
+
element: HTMLDivElement | null;
|
|
16
|
+
/**
|
|
17
|
+
* The current string value of the OTPInput.
|
|
18
|
+
* Unfilled cells are represented with a space (`' '`).
|
|
19
|
+
*/
|
|
20
|
+
value: string;
|
|
21
|
+
/**
|
|
22
|
+
* Focuses the input cell at `index`.
|
|
23
|
+
* When `index` is omitted, focuses the first unfilled cell or
|
|
24
|
+
* the last cell if all are filled.
|
|
25
|
+
*
|
|
26
|
+
* @param index - Zero-based index of the cell to focus.
|
|
27
|
+
*/
|
|
28
|
+
focus: (index?: number) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Programmatically blurs the OTPInput.
|
|
31
|
+
*/
|
|
32
|
+
blur: () => void;
|
|
33
|
+
}
|