@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/index20.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useRef, useId, useMemo, useEffect } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { useMergedRef } from "./index21.js";
|
|
6
|
+
import { debounce } from "./index33.js";
|
|
7
|
+
const Input = forwardRef(
|
|
8
|
+
({
|
|
9
|
+
type = "text",
|
|
10
|
+
label,
|
|
11
|
+
error: externalError,
|
|
12
|
+
helperText,
|
|
13
|
+
fullWidth = false,
|
|
14
|
+
showPasswordToggle = true,
|
|
15
|
+
showLastChar = true,
|
|
16
|
+
lastCharDelay = 500,
|
|
17
|
+
validate,
|
|
18
|
+
onValidationChange,
|
|
19
|
+
className,
|
|
20
|
+
id: providedId,
|
|
21
|
+
onChange,
|
|
22
|
+
onBlur,
|
|
23
|
+
required,
|
|
24
|
+
value: controlledValue,
|
|
25
|
+
"data-cy": dataCy,
|
|
26
|
+
"data-testid": dataTestId,
|
|
27
|
+
...props
|
|
28
|
+
}, ref) => {
|
|
29
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
30
|
+
const [internalError, setInternalError] = useState();
|
|
31
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
32
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
33
|
+
const touchedRef = useRef(false);
|
|
34
|
+
const [displayPassword, setDisplayPassword] = useState("");
|
|
35
|
+
const actualPasswordRef = useRef("");
|
|
36
|
+
const timeoutRef = useRef(null);
|
|
37
|
+
const inputRef = useRef(null);
|
|
38
|
+
const mergedRef = useMergedRef(ref, inputRef);
|
|
39
|
+
const generatedId = useId();
|
|
40
|
+
const id = providedId || generatedId;
|
|
41
|
+
const errorId = `${id}-error`;
|
|
42
|
+
const helperId = `${id}-helper`;
|
|
43
|
+
const finalDataCy = dataCy || "input";
|
|
44
|
+
const finalTestId = dataTestId || "input";
|
|
45
|
+
const isPasswordType = type === "password";
|
|
46
|
+
const showToggle = isPasswordType && showPasswordToggle;
|
|
47
|
+
const shouldEnableLastCharPreview = isPasswordType && showLastChar && !isPasswordVisible;
|
|
48
|
+
const inputType = isPasswordType && (isPasswordVisible || shouldEnableLastCharPreview && actualPasswordRef.current.length > 0) ? "text" : type;
|
|
49
|
+
const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
|
|
50
|
+
const togglePasswordVisibility = () => {
|
|
51
|
+
setIsPasswordVisible((prev) => !prev);
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
55
|
+
}, 0);
|
|
56
|
+
};
|
|
57
|
+
const debouncedValidate = useMemo(
|
|
58
|
+
() => debounce((value) => {
|
|
59
|
+
if (validate && touchedRef.current) {
|
|
60
|
+
const validationError = validate(value);
|
|
61
|
+
setInternalError(validationError);
|
|
62
|
+
onValidationChange == null ? void 0 : onValidationChange(!validationError);
|
|
63
|
+
}
|
|
64
|
+
}, 300),
|
|
65
|
+
[validate, onValidationChange]
|
|
66
|
+
);
|
|
67
|
+
const debouncedValidateRef = useRef(debouncedValidate);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
debouncedValidateRef.current = debouncedValidate;
|
|
70
|
+
}, [debouncedValidate]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (process.env.NODE_ENV === "development") {
|
|
73
|
+
if (isPasswordType && showLastChar && controlledValue !== void 0) {
|
|
74
|
+
console.warn(
|
|
75
|
+
"[Input] Password last character preview (showLastChar) only works in uncontrolled mode. Remove the value prop to use this feature, or set showLastChar={false}."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, [isPasswordType, showLastChar, controlledValue]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
return () => {
|
|
82
|
+
if (timeoutRef.current) {
|
|
83
|
+
clearTimeout(timeoutRef.current);
|
|
84
|
+
}
|
|
85
|
+
debouncedValidateRef.current.cancel();
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
const inputValue = shouldEnableLastCharPreview && controlledValue === void 0 ? displayPassword : isPasswordVisible && isPasswordType && controlledValue === void 0 ? actualPasswordRef.current || "" : controlledValue;
|
|
89
|
+
const handleChange = (e) => {
|
|
90
|
+
onChange == null ? void 0 : onChange(e);
|
|
91
|
+
let value = e.target.value;
|
|
92
|
+
if (shouldEnableLastCharPreview) {
|
|
93
|
+
const input = e.target;
|
|
94
|
+
const newValue = input.value;
|
|
95
|
+
actualPasswordRef.current = newValue;
|
|
96
|
+
const masked = newValue ? "•".repeat(newValue.length - 1) + newValue.slice(-1) : "";
|
|
97
|
+
setDisplayPassword(masked);
|
|
98
|
+
input.value = masked;
|
|
99
|
+
value = newValue;
|
|
100
|
+
if (timeoutRef.current) {
|
|
101
|
+
clearTimeout(timeoutRef.current);
|
|
102
|
+
}
|
|
103
|
+
timeoutRef.current = setTimeout(() => {
|
|
104
|
+
setDisplayPassword("•".repeat(newValue.length));
|
|
105
|
+
}, lastCharDelay);
|
|
106
|
+
}
|
|
107
|
+
if (touchedRef.current) {
|
|
108
|
+
debouncedValidate(value);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const handleFocus = (e) => {
|
|
112
|
+
var _a;
|
|
113
|
+
setIsFocused(true);
|
|
114
|
+
(_a = props.onFocus) == null ? void 0 : _a.call(props, e);
|
|
115
|
+
};
|
|
116
|
+
const handleBlur = (e) => {
|
|
117
|
+
setIsFocused(false);
|
|
118
|
+
touchedRef.current = true;
|
|
119
|
+
if (validate) {
|
|
120
|
+
const valueToValidate = shouldEnableLastCharPreview ? actualPasswordRef.current : e.target.value;
|
|
121
|
+
const validationError = validate(valueToValidate);
|
|
122
|
+
setInternalError(validationError);
|
|
123
|
+
onValidationChange == null ? void 0 : onValidationChange(!validationError);
|
|
124
|
+
}
|
|
125
|
+
onBlur == null ? void 0 : onBlur(e);
|
|
126
|
+
};
|
|
127
|
+
const handleMouseEnter = () => {
|
|
128
|
+
setIsHovered(true);
|
|
129
|
+
};
|
|
130
|
+
const handleMouseLeave = () => {
|
|
131
|
+
setIsHovered(false);
|
|
132
|
+
};
|
|
133
|
+
const displayError = externalError || internalError;
|
|
134
|
+
const inputState = props.disabled ? "disabled" : displayError ? "error" : isFocused ? "focus" : isHovered ? "hover" : "idle";
|
|
135
|
+
return /* @__PURE__ */ jsxs(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: cn("input-wrapper", fullWidth && "input-wrapper--full-width"),
|
|
139
|
+
"data-cy": `${finalDataCy}-wrapper`,
|
|
140
|
+
"data-testid": `${finalTestId}-wrapper`,
|
|
141
|
+
children: [
|
|
142
|
+
label && /* @__PURE__ */ jsx(
|
|
143
|
+
"label",
|
|
144
|
+
{
|
|
145
|
+
htmlFor: id,
|
|
146
|
+
className: "input__label",
|
|
147
|
+
"data-cy": `${finalDataCy}-label`,
|
|
148
|
+
"data-testid": `${finalTestId}-label`,
|
|
149
|
+
children: displayLabel
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "input__field-container", children: [
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
"input",
|
|
155
|
+
{
|
|
156
|
+
ref: mergedRef,
|
|
157
|
+
id,
|
|
158
|
+
type: inputType,
|
|
159
|
+
value: inputValue,
|
|
160
|
+
className: cn(
|
|
161
|
+
"input",
|
|
162
|
+
displayError && "input--error",
|
|
163
|
+
fullWidth && "input--full-width",
|
|
164
|
+
showToggle && "input--with-toggle",
|
|
165
|
+
className
|
|
166
|
+
),
|
|
167
|
+
"aria-invalid": displayError ? "true" : "false",
|
|
168
|
+
"aria-required": required ? "true" : void 0,
|
|
169
|
+
"aria-describedby": displayError ? errorId : helperText ? helperId : void 0,
|
|
170
|
+
"data-cy": finalDataCy,
|
|
171
|
+
"data-testid": finalTestId,
|
|
172
|
+
"data-state": inputState,
|
|
173
|
+
onChange: handleChange,
|
|
174
|
+
onFocus: handleFocus,
|
|
175
|
+
onBlur: handleBlur,
|
|
176
|
+
onMouseEnter: handleMouseEnter,
|
|
177
|
+
onMouseLeave: handleMouseLeave,
|
|
178
|
+
required,
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
showToggle && /* @__PURE__ */ jsx(
|
|
183
|
+
"button",
|
|
184
|
+
{
|
|
185
|
+
type: "button",
|
|
186
|
+
className: "input__toggle",
|
|
187
|
+
onClick: togglePasswordVisibility,
|
|
188
|
+
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
189
|
+
"data-cy": `${finalDataCy}-toggle`,
|
|
190
|
+
"data-testid": `${finalTestId}-toggle`,
|
|
191
|
+
children: isPasswordVisible ? /* @__PURE__ */ jsxs(
|
|
192
|
+
"svg",
|
|
193
|
+
{
|
|
194
|
+
width: "20",
|
|
195
|
+
height: "20",
|
|
196
|
+
viewBox: "0 0 20 20",
|
|
197
|
+
fill: "none",
|
|
198
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
199
|
+
"aria-hidden": "true",
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
"path",
|
|
203
|
+
{
|
|
204
|
+
d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
|
|
205
|
+
stroke: "currentColor",
|
|
206
|
+
strokeWidth: "1.5",
|
|
207
|
+
strokeLinecap: "round",
|
|
208
|
+
strokeLinejoin: "round",
|
|
209
|
+
fill: "none"
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
"circle",
|
|
214
|
+
{
|
|
215
|
+
cx: "10",
|
|
216
|
+
cy: "10",
|
|
217
|
+
r: "2.5",
|
|
218
|
+
stroke: "currentColor",
|
|
219
|
+
strokeWidth: "1.5",
|
|
220
|
+
fill: "none"
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
) : /* @__PURE__ */ jsxs(
|
|
226
|
+
"svg",
|
|
227
|
+
{
|
|
228
|
+
width: "20",
|
|
229
|
+
height: "20",
|
|
230
|
+
viewBox: "0 0 20 20",
|
|
231
|
+
fill: "none",
|
|
232
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
233
|
+
"aria-hidden": "true",
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
"path",
|
|
237
|
+
{
|
|
238
|
+
d: "M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",
|
|
239
|
+
stroke: "currentColor",
|
|
240
|
+
strokeWidth: "1.5",
|
|
241
|
+
strokeLinecap: "round",
|
|
242
|
+
strokeLinejoin: "round",
|
|
243
|
+
fill: "none"
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
"circle",
|
|
248
|
+
{
|
|
249
|
+
cx: "10",
|
|
250
|
+
cy: "10",
|
|
251
|
+
r: "2.5",
|
|
252
|
+
stroke: "currentColor",
|
|
253
|
+
strokeWidth: "1.5",
|
|
254
|
+
fill: "none"
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ jsx(
|
|
258
|
+
"path",
|
|
259
|
+
{
|
|
260
|
+
d: "M3 3l14 14",
|
|
261
|
+
stroke: "currentColor",
|
|
262
|
+
strokeWidth: "1.5",
|
|
263
|
+
strokeLinecap: "round"
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
] }),
|
|
272
|
+
displayError && /* @__PURE__ */ jsx(
|
|
273
|
+
"span",
|
|
274
|
+
{
|
|
275
|
+
id: errorId,
|
|
276
|
+
className: "input__error",
|
|
277
|
+
role: "alert",
|
|
278
|
+
"data-cy": `${finalDataCy}-error`,
|
|
279
|
+
"data-testid": `${finalTestId}-error`,
|
|
280
|
+
children: displayError
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
helperText && !displayError && /* @__PURE__ */ jsx(
|
|
284
|
+
"span",
|
|
285
|
+
{
|
|
286
|
+
id: helperId,
|
|
287
|
+
className: "input__helper",
|
|
288
|
+
"data-cy": `${finalDataCy}-helper`,
|
|
289
|
+
"data-testid": `${finalTestId}-helper`,
|
|
290
|
+
children: helperText
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
Input.displayName = "Input";
|
|
299
|
+
export {
|
|
300
|
+
Input
|
|
301
|
+
};
|
package/dist/index21.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useMergedRef=function(...r){return e.useCallback(e=>{r.forEach(r=>{r&&("function"==typeof r?r(e):r.current=e)})},r)};
|
package/dist/index21.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
function useMergedRef(...refs) {
|
|
3
|
+
return useCallback((element) => {
|
|
4
|
+
refs.forEach((ref) => {
|
|
5
|
+
if (!ref) return;
|
|
6
|
+
if (typeof ref === "function") {
|
|
7
|
+
ref(element);
|
|
8
|
+
} else {
|
|
9
|
+
ref.current = element;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}, refs);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useMergedRef
|
|
16
|
+
};
|
package/dist/index3.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"),a=require("react"),t=require("./index19.cjs"),i=require("./index20.cjs"),r=a.forwardRef(({validateEmail:r=!0,invalidEmailMessage:l="Not a valid email address",validate:d,"data-cy":s,"data-testid":u,...n},c)=>{const o=a.useCallback(e=>{if(e)return t.validate(e)?void 0:l},[l]),m=a.useCallback(e=>r?d?o(e)||d(e):o(e):null==d?void 0:d(e),[r,d,o]);return e.jsx(i.Input,{ref:c,type:"email",validate:m,"data-cy":s||"email-input","data-testid":u||"email-input",...n})});r.displayName="EmailInput",exports.EmailInput=r;
|
package/dist/index3.js
CHANGED
|
@@ -1,103 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback } from "react";
|
|
3
|
+
import { validate } from "./index19.js";
|
|
4
|
+
import { Input } from "./index20.js";
|
|
5
|
+
const EmailInput = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
validateEmail
|
|
8
|
-
invalidEmailMessage
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const d = w(t.target.value);
|
|
32
|
-
$(d ? void 0 : n), r == null || r(d);
|
|
33
|
-
}
|
|
34
|
-
(c = l.onBlur) == null || c.call(l, t);
|
|
35
|
-
}, e = _ || R;
|
|
36
|
-
return /* @__PURE__ */ S(
|
|
37
|
-
"div",
|
|
7
|
+
validateEmail = true,
|
|
8
|
+
invalidEmailMessage = "Not a valid email address",
|
|
9
|
+
validate: validate$1,
|
|
10
|
+
"data-cy": dataCy,
|
|
11
|
+
"data-testid": dataTestId,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const emailValidation = useCallback(
|
|
15
|
+
(value) => {
|
|
16
|
+
if (!value) return void 0;
|
|
17
|
+
return validate(value) ? void 0 : invalidEmailMessage;
|
|
18
|
+
},
|
|
19
|
+
[invalidEmailMessage]
|
|
20
|
+
);
|
|
21
|
+
const combinedValidation = useCallback(
|
|
22
|
+
(value) => {
|
|
23
|
+
if (!validateEmail) return validate$1 == null ? void 0 : validate$1(value);
|
|
24
|
+
if (!validate$1) return emailValidation(value);
|
|
25
|
+
return emailValidation(value) || validate$1(value);
|
|
26
|
+
},
|
|
27
|
+
[validateEmail, validate$1, emailValidation]
|
|
28
|
+
);
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
Input,
|
|
38
31
|
{
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
htmlFor: i,
|
|
47
|
-
className: "input__label",
|
|
48
|
-
"data-cy": `${a}-label`,
|
|
49
|
-
"data-testid": `${s}-label`,
|
|
50
|
-
children: f
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ u(
|
|
54
|
-
"input",
|
|
55
|
-
{
|
|
56
|
-
ref: F,
|
|
57
|
-
id: i,
|
|
58
|
-
type: "email",
|
|
59
|
-
className: N(
|
|
60
|
-
"input",
|
|
61
|
-
e && "input--error",
|
|
62
|
-
y && "input--full-width",
|
|
63
|
-
b
|
|
64
|
-
),
|
|
65
|
-
"aria-invalid": e ? "true" : "false",
|
|
66
|
-
"aria-describedby": e ? I : o ? v : void 0,
|
|
67
|
-
"data-cy": a,
|
|
68
|
-
"data-testid": s,
|
|
69
|
-
onChange: G,
|
|
70
|
-
onBlur: L,
|
|
71
|
-
...l
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
e && /* @__PURE__ */ u(
|
|
75
|
-
"span",
|
|
76
|
-
{
|
|
77
|
-
id: I,
|
|
78
|
-
className: "input__error",
|
|
79
|
-
role: "alert",
|
|
80
|
-
"data-cy": `${a}-error`,
|
|
81
|
-
"data-testid": `${s}-error`,
|
|
82
|
-
children: e
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
o && !e && /* @__PURE__ */ u(
|
|
86
|
-
"span",
|
|
87
|
-
{
|
|
88
|
-
id: v,
|
|
89
|
-
className: "input__helper",
|
|
90
|
-
"data-cy": `${a}-helper`,
|
|
91
|
-
"data-testid": `${s}-helper`,
|
|
92
|
-
children: o
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
]
|
|
32
|
+
ref,
|
|
33
|
+
type: "email",
|
|
34
|
+
validate: combinedValidation,
|
|
35
|
+
"data-cy": dataCy || "email-input",
|
|
36
|
+
"data-testid": dataTestId || "email-input",
|
|
37
|
+
...props
|
|
96
38
|
}
|
|
97
39
|
);
|
|
98
40
|
}
|
|
99
41
|
);
|
|
100
|
-
|
|
42
|
+
EmailInput.displayName = "EmailInput";
|
|
101
43
|
export {
|
|
102
|
-
|
|
44
|
+
EmailInput
|
|
103
45
|
};
|
package/dist/index30.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});process.env.NODE_ENV;exports.devWarn=e=>{};
|
package/dist/index30.js
ADDED
package/dist/index33.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.debounce=function(e,t){let l=null;const n=function(...n){l&&clearTimeout(l);const o=this;l=setTimeout(()=>{e.apply(o,n),l=null},t)};return n.cancel=()=>{l&&(clearTimeout(l),l=null)},n};
|
package/dist/index33.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function debounce(func, wait) {
|
|
2
|
+
let timeoutId = null;
|
|
3
|
+
const debounced = function(...args) {
|
|
4
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
5
|
+
const context = this;
|
|
6
|
+
timeoutId = setTimeout(() => {
|
|
7
|
+
func.apply(context, args);
|
|
8
|
+
timeoutId = null;
|
|
9
|
+
}, wait);
|
|
10
|
+
};
|
|
11
|
+
debounced.cancel = () => {
|
|
12
|
+
if (timeoutId) {
|
|
13
|
+
clearTimeout(timeoutId);
|
|
14
|
+
timeoutId = null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return debounced;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
debounce
|
|
21
|
+
};
|
package/dist/index4.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"),s=require("./index20.cjs"),r=t.forwardRef(({showToggle:t=!0,"data-cy":r,"data-testid":a,...o},d)=>e.jsx(s.Input,{ref:d,type:"password",showPasswordToggle:t,"data-cy":r||"password-input","data-testid":a||"password-input",...o}));r.displayName="PasswordInput",exports.PasswordInput=r;
|