@adam-milo/ui 1.0.20 → 1.0.22
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/index.cjs +1 -1
- package/dist/index.js +53 -53
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +38 -36
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +82 -76
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +50 -49
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +30 -30
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +348 -209
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +92 -82
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +32 -31
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +10 -7
- package/dist/index19.cjs +1 -0
- package/dist/index19.js +22 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +26 -26
- package/dist/index20.cjs +1 -0
- package/dist/index20.js +301 -0
- package/dist/index21.cjs +1 -0
- package/dist/index21.js +16 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +37 -95
- package/dist/index30.cjs +1 -0
- package/dist/index30.js +9 -0
- package/dist/index33.cjs +1 -0
- package/dist/index33.js +21 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +18 -174
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +51 -155
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +102 -159
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +76 -61
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +68 -54
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +47 -43
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts +23 -38
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts +17 -20
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/input/Input.component.d.ts +105 -0
- package/dist/src/components/forms/input/Input.component.d.ts.map +1 -0
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts +30 -48
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts +19 -16
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts.map +1 -1
- package/dist/src/lib/debounce.d.ts +12 -0
- package/dist/src/lib/debounce.d.ts.map +1 -0
- package/dist/src/lib/debounce.spec.d.ts +2 -0
- package/dist/src/lib/debounce.spec.d.ts.map +1 -0
- package/dist/src/lib/dev-utils.d.ts +41 -0
- package/dist/src/lib/dev-utils.d.ts.map +1 -0
- package/dist/src/lib/index.d.ts +15 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/useMergedRef.d.ts +19 -0
- package/dist/src/lib/useMergedRef.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +5 -2
package/dist/index4.js
CHANGED
|
@@ -1,178 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, y) => {
|
|
18
|
-
const [d, $] = I(!1), b = N(), a = m || b, p = `${a}-error`, c = `${a}-helper`, r = f || "password-input", s = g || "password-input", v = () => {
|
|
19
|
-
$((C) => !C);
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ i("div", { className: "password-input-wrapper", children: [
|
|
22
|
-
/* @__PURE__ */ i(
|
|
23
|
-
"div",
|
|
24
|
-
{
|
|
25
|
-
className: u("input-wrapper", l && "input-wrapper--full-width"),
|
|
26
|
-
"data-cy": `${r}-wrapper`,
|
|
27
|
-
"data-testid": `${s}-wrapper`,
|
|
28
|
-
children: [
|
|
29
|
-
n && /* @__PURE__ */ t(
|
|
30
|
-
"label",
|
|
31
|
-
{
|
|
32
|
-
htmlFor: a,
|
|
33
|
-
className: "input__label",
|
|
34
|
-
"data-cy": `${r}-label`,
|
|
35
|
-
"data-testid": `${s}-label`,
|
|
36
|
-
children: n
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
/* @__PURE__ */ t(
|
|
40
|
-
"input",
|
|
41
|
-
{
|
|
42
|
-
ref: y,
|
|
43
|
-
id: a,
|
|
44
|
-
type: d ? "text" : "password",
|
|
45
|
-
className: u(
|
|
46
|
-
"input",
|
|
47
|
-
"password-input",
|
|
48
|
-
e && "input--error",
|
|
49
|
-
l && "input--full-width",
|
|
50
|
-
h
|
|
51
|
-
),
|
|
52
|
-
"aria-invalid": e ? "true" : "false",
|
|
53
|
-
"aria-describedby": e ? p : o ? c : void 0,
|
|
54
|
-
"data-cy": r,
|
|
55
|
-
"data-testid": s,
|
|
56
|
-
...k
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
e && /* @__PURE__ */ t(
|
|
60
|
-
"span",
|
|
61
|
-
{
|
|
62
|
-
id: p,
|
|
63
|
-
className: "input__error",
|
|
64
|
-
role: "alert",
|
|
65
|
-
"data-cy": `${r}-error`,
|
|
66
|
-
"data-testid": `${s}-error`,
|
|
67
|
-
children: e
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
o && !e && /* @__PURE__ */ t(
|
|
71
|
-
"span",
|
|
72
|
-
{
|
|
73
|
-
id: c,
|
|
74
|
-
className: "input__helper",
|
|
75
|
-
"data-cy": `${r}-helper`,
|
|
76
|
-
"data-testid": `${s}-helper`,
|
|
77
|
-
children: o
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
w && /* @__PURE__ */ t(
|
|
84
|
-
"button",
|
|
85
|
-
{
|
|
86
|
-
type: "button",
|
|
87
|
-
className: "password-input__toggle",
|
|
88
|
-
onClick: v,
|
|
89
|
-
"aria-label": d ? "Hide password" : "Show password",
|
|
90
|
-
"data-cy": `${r}-toggle`,
|
|
91
|
-
"data-testid": `${s}-toggle`,
|
|
92
|
-
children: d ? /* @__PURE__ */ i(
|
|
93
|
-
"svg",
|
|
94
|
-
{
|
|
95
|
-
width: "20",
|
|
96
|
-
height: "20",
|
|
97
|
-
viewBox: "0 0 20 20",
|
|
98
|
-
fill: "none",
|
|
99
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
100
|
-
"aria-hidden": "true",
|
|
101
|
-
children: [
|
|
102
|
-
/* @__PURE__ */ t(
|
|
103
|
-
"path",
|
|
104
|
-
{
|
|
105
|
-
d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
|
|
106
|
-
stroke: "currentColor",
|
|
107
|
-
strokeWidth: "1.5",
|
|
108
|
-
strokeLinecap: "round",
|
|
109
|
-
strokeLinejoin: "round",
|
|
110
|
-
fill: "none"
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ t(
|
|
114
|
-
"circle",
|
|
115
|
-
{
|
|
116
|
-
cx: "10",
|
|
117
|
-
cy: "10",
|
|
118
|
-
r: "2.5",
|
|
119
|
-
stroke: "currentColor",
|
|
120
|
-
strokeWidth: "1.5",
|
|
121
|
-
fill: "none"
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
) : /* @__PURE__ */ i(
|
|
127
|
-
"svg",
|
|
128
|
-
{
|
|
129
|
-
width: "20",
|
|
130
|
-
height: "20",
|
|
131
|
-
viewBox: "0 0 20 20",
|
|
132
|
-
fill: "none",
|
|
133
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
134
|
-
"aria-hidden": "true",
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ t(
|
|
137
|
-
"path",
|
|
138
|
-
{
|
|
139
|
-
d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
|
|
140
|
-
stroke: "currentColor",
|
|
141
|
-
strokeWidth: "1.5",
|
|
142
|
-
strokeLinecap: "round",
|
|
143
|
-
strokeLinejoin: "round",
|
|
144
|
-
fill: "none"
|
|
145
|
-
}
|
|
146
|
-
),
|
|
147
|
-
/* @__PURE__ */ t(
|
|
148
|
-
"circle",
|
|
149
|
-
{
|
|
150
|
-
cx: "10",
|
|
151
|
-
cy: "10",
|
|
152
|
-
r: "2.5",
|
|
153
|
-
stroke: "currentColor",
|
|
154
|
-
strokeWidth: "1.5",
|
|
155
|
-
fill: "none"
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
/* @__PURE__ */ t(
|
|
159
|
-
"path",
|
|
160
|
-
{
|
|
161
|
-
d: "M3 3l14 14",
|
|
162
|
-
stroke: "currentColor",
|
|
163
|
-
strokeWidth: "1.5",
|
|
164
|
-
strokeLinecap: "round"
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
] });
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Input } from "./index20.js";
|
|
4
|
+
const PasswordInput = forwardRef(
|
|
5
|
+
({ showToggle = true, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
Input,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
type: "password",
|
|
11
|
+
showPasswordToggle: showToggle,
|
|
12
|
+
"data-cy": dataCy || "password-input",
|
|
13
|
+
"data-testid": dataTestId || "password-input",
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
173
17
|
}
|
|
174
18
|
);
|
|
175
|
-
|
|
19
|
+
PasswordInput.displayName = "PasswordInput";
|
|
176
20
|
export {
|
|
177
|
-
|
|
21
|
+
PasswordInput
|
|
178
22
|
};
|
package/dist/index5.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("./index20.cjs"),r=t.forwardRef(({min:r,max:i,step:s=1,allowDecimals:u=!1,validate:n,"data-cy":l,"data-testid":c,...d},o)=>{const m=t.useCallback(e=>{if(!e)return;const t=parseFloat(e);return isNaN(t)?"Please enter a valid number":u||Number.isInteger(t)?void 0!==r&&t<r?`Must be at least ${r}`:void 0!==i&&t>i?`Must be at most ${i}`:void 0:"Decimals are not allowed"},[r,i,u]),p=t.useCallback(e=>n?m(e)||n(e):m(e),[m,n]);return e.jsx(a.Input,{ref:o,type:"number",min:r,max:i,validate:p,"data-cy":l||"numeric-input","data-testid":c||"numeric-input",...d,step:u?"any":s})});r.displayName="NumericInput",exports.NumericInput=r;
|
package/dist/index5.js
CHANGED
|
@@ -1,165 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const W = Z(
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback } from "react";
|
|
3
|
+
import { Input } from "./index20.js";
|
|
4
|
+
const NumericInput = forwardRef(
|
|
6
5
|
({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
className: P,
|
|
23
|
-
id: H,
|
|
24
|
-
"data-cy": L,
|
|
25
|
-
"data-testid": M,
|
|
26
|
-
...c
|
|
27
|
-
}, V) => {
|
|
28
|
-
const [q, E] = S(), [z, G] = S(!1), J = g(), d = H || J, k = `${d}-error`, _ = `${d}-helper`, l = L || "numeric-input", u = M || "numeric-input", h = (r) => {
|
|
29
|
-
if (!r) return { isValid: !0 };
|
|
30
|
-
const a = b ? "-?" : "", e = $ ? `(\\.\\d{0,${x}})?` : "";
|
|
31
|
-
if (!new RegExp(`^${a}\\d+${e}$`).test(r))
|
|
32
|
-
return { isValid: !1, error: A };
|
|
33
|
-
const B = parseFloat(r);
|
|
34
|
-
return p !== void 0 && B < p ? {
|
|
35
|
-
isValid: !1,
|
|
36
|
-
error: R || `Value must be at least ${p}`
|
|
37
|
-
} : m !== void 0 && B > m ? {
|
|
38
|
-
isValid: !1,
|
|
39
|
-
error: j || `Value must be at most ${m}`
|
|
40
|
-
} : { isValid: !0 };
|
|
41
|
-
}, O = (r) => {
|
|
42
|
-
const a = [
|
|
43
|
-
"Backspace",
|
|
44
|
-
"Delete",
|
|
45
|
-
"Tab",
|
|
46
|
-
"Escape",
|
|
47
|
-
"Enter",
|
|
48
|
-
"ArrowLeft",
|
|
49
|
-
"ArrowRight",
|
|
50
|
-
"Home",
|
|
51
|
-
"End"
|
|
52
|
-
];
|
|
53
|
-
if (r.ctrlKey || r.metaKey) {
|
|
54
|
-
t == null || t(r);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (a.includes(r.key)) {
|
|
58
|
-
t == null || t(r);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if ($ && r.key === ".") {
|
|
62
|
-
if (r.currentTarget.value.includes(".")) {
|
|
63
|
-
r.preventDefault();
|
|
64
|
-
return;
|
|
6
|
+
min,
|
|
7
|
+
max,
|
|
8
|
+
step = 1,
|
|
9
|
+
allowDecimals = false,
|
|
10
|
+
validate,
|
|
11
|
+
"data-cy": dataCy,
|
|
12
|
+
"data-testid": dataTestId,
|
|
13
|
+
...props
|
|
14
|
+
}, ref) => {
|
|
15
|
+
const numericValidation = useCallback(
|
|
16
|
+
(value) => {
|
|
17
|
+
if (!value) return void 0;
|
|
18
|
+
const numValue = parseFloat(value);
|
|
19
|
+
if (isNaN(numValue)) {
|
|
20
|
+
return "Please enter a valid number";
|
|
65
21
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
if (b && r.key === "-") {
|
|
70
|
-
const e = r.currentTarget.value;
|
|
71
|
-
if ((r.currentTarget.selectionStart || 0) !== 0 || e.includes("-")) {
|
|
72
|
-
r.preventDefault();
|
|
73
|
-
return;
|
|
22
|
+
if (!allowDecimals && !Number.isInteger(numValue)) {
|
|
23
|
+
return "Decimals are not allowed";
|
|
74
24
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
E(a.error), s == null || s(a.isValid), (e = c.onBlur) == null || e.call(c, r);
|
|
95
|
-
}, i = F || q;
|
|
96
|
-
return /* @__PURE__ */ Y(
|
|
97
|
-
"div",
|
|
25
|
+
if (min !== void 0 && numValue < min) {
|
|
26
|
+
return `Must be at least ${min}`;
|
|
27
|
+
}
|
|
28
|
+
if (max !== void 0 && numValue > max) {
|
|
29
|
+
return `Must be at most ${max}`;
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
},
|
|
33
|
+
[min, max, allowDecimals]
|
|
34
|
+
);
|
|
35
|
+
const combinedValidation = useCallback(
|
|
36
|
+
(value) => {
|
|
37
|
+
if (!validate) return numericValidation(value);
|
|
38
|
+
return numericValidation(value) || validate(value);
|
|
39
|
+
},
|
|
40
|
+
[numericValidation, validate]
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Input,
|
|
98
44
|
{
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"data-cy": `${l}-label`,
|
|
109
|
-
"data-testid": `${u}-label`,
|
|
110
|
-
children: N
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ f(
|
|
114
|
-
"input",
|
|
115
|
-
{
|
|
116
|
-
ref: V,
|
|
117
|
-
id: d,
|
|
118
|
-
type: "text",
|
|
119
|
-
inputMode: "numeric",
|
|
120
|
-
className: T(
|
|
121
|
-
"input",
|
|
122
|
-
i && "input--error",
|
|
123
|
-
I && "input--full-width",
|
|
124
|
-
P
|
|
125
|
-
),
|
|
126
|
-
"aria-invalid": i ? "true" : "false",
|
|
127
|
-
"aria-describedby": i ? k : n ? _ : void 0,
|
|
128
|
-
"data-cy": l,
|
|
129
|
-
"data-testid": u,
|
|
130
|
-
onChange: Q,
|
|
131
|
-
onBlur: U,
|
|
132
|
-
onKeyDown: O,
|
|
133
|
-
...c
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
i && /* @__PURE__ */ f(
|
|
137
|
-
"span",
|
|
138
|
-
{
|
|
139
|
-
id: k,
|
|
140
|
-
className: "input__error",
|
|
141
|
-
role: "alert",
|
|
142
|
-
"data-cy": `${l}-error`,
|
|
143
|
-
"data-testid": `${u}-error`,
|
|
144
|
-
children: i
|
|
145
|
-
}
|
|
146
|
-
),
|
|
147
|
-
n && !i && /* @__PURE__ */ f(
|
|
148
|
-
"span",
|
|
149
|
-
{
|
|
150
|
-
id: _,
|
|
151
|
-
className: "input__helper",
|
|
152
|
-
"data-cy": `${l}-helper`,
|
|
153
|
-
"data-testid": `${u}-helper`,
|
|
154
|
-
children: n
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
]
|
|
45
|
+
ref,
|
|
46
|
+
type: "number",
|
|
47
|
+
min,
|
|
48
|
+
max,
|
|
49
|
+
validate: combinedValidation,
|
|
50
|
+
"data-cy": dataCy || "numeric-input",
|
|
51
|
+
"data-testid": dataTestId || "numeric-input",
|
|
52
|
+
...props,
|
|
53
|
+
step: allowDecimals ? "any" : step
|
|
158
54
|
}
|
|
159
55
|
);
|
|
160
56
|
}
|
|
161
57
|
);
|
|
162
|
-
|
|
58
|
+
NumericInput.displayName = "NumericInput";
|
|
163
59
|
export {
|
|
164
|
-
|
|
60
|
+
NumericInput
|
|
165
61
|
};
|
package/dist/index6.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),a=require("./index20.cjs"),n=require("./index21.cjs"),l=t.forwardRef(({allowHyphen:l=!1,allowUnderscore:r=!1,allowSpace:s=!1,minLength:u,maxLength:i,validate:c,onChange:o,"data-cy":p,"data-testid":d,...h},g)=>{const m=t.useRef(null),f=n.useMergedRef(g,m),v=t.useMemo(()=>{let e="^[a-zA-Z0-9";return l&&(e+="\\-"),r&&(e+="_"),s&&(e+=" "),e+="]*$",new RegExp(e)},[l,r,s]),x=t.useMemo(()=>{let e="[a-zA-Z0-9";return l&&(e+="\\-"),r&&(e+="_"),s&&(e+=" "),e+="]",new RegExp(e)},[l,r,s]),y=t.useCallback(e=>{if(e){if(!v.test(e)){let e="letters and numbers";const t=[];return l&&t.push("hyphens"),r&&t.push("underscores"),s&&t.push("spaces"),t.length>0&&(e+=`, ${t.join(", ")}`),`Only ${e} are allowed`}return void 0!==u&&e.length<u?`Must be at least ${u} characters`:void 0!==i&&e.length>i?`Must be at most ${i} characters`:void 0}},[v,u,i,l,r,s]),b=t.useCallback(e=>c?y(e)||c(e):y(e),[y,c]),[j,w]=t.useState(null);t.useEffect(()=>{null!==j&&m.current&&(m.current.setSelectionRange(j,j),w(null))},[h.value,j]);const R=t.useCallback(e=>{const t=e.target,a=t.value,n=t.selectionStart||0,l=a.split("").filter(e=>x.test(e)).join(""),r=n-a.slice(0,n).split("").filter(e=>!x.test(e)).length;t.value=l;void 0!==h.value?w(r):t.setSelectionRange(r,r),null==o||o(e)},[x,o,h.value]);return e.jsx(a.Input,{ref:f,type:"text",minLength:u,maxLength:i,validate:b,onChange:R,"data-cy":p||"alphanumeric-input","data-testid":d||"alphanumeric-input",...h})});l.displayName="AlphanumericInput",exports.AlphanumericInput=l;
|