@adam-milo/ui 1.0.19 → 1.0.21
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/index2.cjs +1 -1
- package/dist/index2.js +26 -26
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +84 -66
- package/dist/index31.cjs +1 -0
- package/dist/index31.js +9 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +71 -64
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +130 -104
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +136 -107
- 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/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 +13 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/index6.js
CHANGED
|
@@ -1,50 +1,73 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useId } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const AlphanumericInput = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
allowHyphen
|
|
8
|
-
allowUnderscore
|
|
9
|
-
allowSpace
|
|
10
|
-
minLength
|
|
11
|
-
maxLength
|
|
12
|
-
invalidFormatMessage
|
|
13
|
-
minLengthMessage
|
|
14
|
-
maxLengthMessage
|
|
15
|
-
onValidationChange
|
|
16
|
-
error:
|
|
17
|
-
onChange
|
|
18
|
-
onKeyDown
|
|
19
|
-
label
|
|
20
|
-
helperText
|
|
21
|
-
fullWidth
|
|
22
|
-
className
|
|
23
|
-
id:
|
|
24
|
-
"data-cy":
|
|
25
|
-
"data-testid":
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
allowHyphen = false,
|
|
8
|
+
allowUnderscore = false,
|
|
9
|
+
allowSpace = false,
|
|
10
|
+
minLength,
|
|
11
|
+
maxLength,
|
|
12
|
+
invalidFormatMessage = "Only letters and numbers are allowed",
|
|
13
|
+
minLengthMessage,
|
|
14
|
+
maxLengthMessage,
|
|
15
|
+
onValidationChange,
|
|
16
|
+
error: externalError,
|
|
17
|
+
onChange,
|
|
18
|
+
onKeyDown,
|
|
19
|
+
label,
|
|
20
|
+
helperText,
|
|
21
|
+
fullWidth = false,
|
|
22
|
+
className,
|
|
23
|
+
id: providedId,
|
|
24
|
+
"data-cy": dataCy,
|
|
25
|
+
"data-testid": dataTestId,
|
|
26
|
+
...props
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const [internalError, setInternalError] = useState();
|
|
29
|
+
const [touched, setTouched] = useState(false);
|
|
30
|
+
const generatedId = useId();
|
|
31
|
+
const id = providedId || generatedId;
|
|
32
|
+
const errorId = `${id}-error`;
|
|
33
|
+
const helperId = `${id}-helper`;
|
|
34
|
+
const finalDataCy = dataCy || "alphanumeric-input";
|
|
35
|
+
const finalTestId = dataTestId || "alphanumeric-input";
|
|
36
|
+
const validateFormat = (value) => {
|
|
37
|
+
if (!value) return { isValid: true };
|
|
38
|
+
let pattern = "^[a-zA-Z0-9";
|
|
39
|
+
if (allowHyphen) pattern += "\\-";
|
|
40
|
+
if (allowUnderscore) pattern += "_";
|
|
41
|
+
if (allowSpace) pattern += " ";
|
|
42
|
+
pattern += "]+$";
|
|
43
|
+
const regex = new RegExp(pattern);
|
|
44
|
+
if (!regex.test(value)) {
|
|
45
|
+
let message = invalidFormatMessage;
|
|
46
|
+
if (allowHyphen || allowUnderscore || allowSpace) {
|
|
47
|
+
const allowed = ["letters", "numbers"];
|
|
48
|
+
if (allowHyphen) allowed.push("hyphens");
|
|
49
|
+
if (allowUnderscore) allowed.push("underscores");
|
|
50
|
+
if (allowSpace) allowed.push("spaces");
|
|
51
|
+
message = `Only ${allowed.join(", ")} are allowed`;
|
|
36
52
|
}
|
|
37
|
-
return { isValid:
|
|
53
|
+
return { isValid: false, error: message };
|
|
38
54
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
56
|
+
return {
|
|
57
|
+
isValid: false,
|
|
58
|
+
error: minLengthMessage || `Must be at least ${minLength} characters`
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
62
|
+
return {
|
|
63
|
+
isValid: false,
|
|
64
|
+
error: maxLengthMessage || `Must be at most ${maxLength} characters`
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return { isValid: true };
|
|
68
|
+
};
|
|
69
|
+
const handleKeyDown = (e) => {
|
|
70
|
+
const allowedKeys = [
|
|
48
71
|
"Backspace",
|
|
49
72
|
"Delete",
|
|
50
73
|
"Tab",
|
|
@@ -55,107 +78,113 @@ const y = L(
|
|
|
55
78
|
"Home",
|
|
56
79
|
"End"
|
|
57
80
|
];
|
|
58
|
-
if (
|
|
59
|
-
|
|
81
|
+
if (e.ctrlKey || e.metaKey) {
|
|
82
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
60
83
|
return;
|
|
61
84
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
85
|
+
if (allowedKeys.includes(e.key)) {
|
|
86
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
64
87
|
return;
|
|
65
88
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
89
|
+
if (allowSpace && e.key === " ") {
|
|
90
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
68
91
|
return;
|
|
69
92
|
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
93
|
+
if (allowHyphen && e.key === "-") {
|
|
94
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
72
95
|
return;
|
|
73
96
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
97
|
+
if (allowUnderscore && e.key === "_") {
|
|
98
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
76
99
|
return;
|
|
77
100
|
}
|
|
78
|
-
if (
|
|
79
|
-
|
|
101
|
+
if (e.key >= "a" && e.key <= "z" || e.key >= "A" && e.key <= "Z") {
|
|
102
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
80
103
|
return;
|
|
81
104
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
105
|
+
if (e.key >= "0" && e.key <= "9") {
|
|
106
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
84
107
|
return;
|
|
85
108
|
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
};
|
|
111
|
+
const handleChange = (e) => {
|
|
112
|
+
const value = e.target.value;
|
|
113
|
+
if (touched) {
|
|
114
|
+
const validation = validateFormat(value);
|
|
115
|
+
setInternalError(validation.error);
|
|
116
|
+
onValidationChange == null ? void 0 : onValidationChange(validation.isValid);
|
|
92
117
|
}
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
onChange == null ? void 0 : onChange(e);
|
|
119
|
+
};
|
|
120
|
+
const handleBlur = (e) => {
|
|
121
|
+
var _a;
|
|
122
|
+
setTouched(true);
|
|
123
|
+
const validation = validateFormat(e.target.value);
|
|
124
|
+
setInternalError(validation.error);
|
|
125
|
+
onValidationChange == null ? void 0 : onValidationChange(validation.isValid);
|
|
126
|
+
(_a = props.onBlur) == null ? void 0 : _a.call(props, e);
|
|
127
|
+
};
|
|
128
|
+
const displayError = externalError || internalError;
|
|
129
|
+
return /* @__PURE__ */ jsxs(
|
|
101
130
|
"div",
|
|
102
131
|
{
|
|
103
|
-
className:
|
|
104
|
-
"data-cy": `${
|
|
105
|
-
"data-testid": `${
|
|
132
|
+
className: cn("input-wrapper", fullWidth && "input-wrapper--full-width"),
|
|
133
|
+
"data-cy": `${finalDataCy}-wrapper`,
|
|
134
|
+
"data-testid": `${finalTestId}-wrapper`,
|
|
106
135
|
children: [
|
|
107
|
-
|
|
136
|
+
label && /* @__PURE__ */ jsx(
|
|
108
137
|
"label",
|
|
109
138
|
{
|
|
110
|
-
htmlFor:
|
|
139
|
+
htmlFor: id,
|
|
111
140
|
className: "input__label",
|
|
112
|
-
"data-cy": `${
|
|
113
|
-
"data-testid": `${
|
|
114
|
-
children:
|
|
141
|
+
"data-cy": `${finalDataCy}-label`,
|
|
142
|
+
"data-testid": `${finalTestId}-label`,
|
|
143
|
+
children: label
|
|
115
144
|
}
|
|
116
145
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
118
147
|
"input",
|
|
119
148
|
{
|
|
120
|
-
ref
|
|
121
|
-
id
|
|
149
|
+
ref,
|
|
150
|
+
id,
|
|
122
151
|
type: "text",
|
|
123
|
-
className:
|
|
152
|
+
className: cn(
|
|
124
153
|
"input",
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
154
|
+
displayError && "input--error",
|
|
155
|
+
fullWidth && "input--full-width",
|
|
156
|
+
className
|
|
128
157
|
),
|
|
129
|
-
"aria-invalid":
|
|
130
|
-
"aria-describedby":
|
|
131
|
-
"data-cy":
|
|
132
|
-
"data-testid":
|
|
133
|
-
onChange:
|
|
134
|
-
onBlur:
|
|
135
|
-
onKeyDown:
|
|
136
|
-
maxLength
|
|
137
|
-
...
|
|
158
|
+
"aria-invalid": displayError ? "true" : "false",
|
|
159
|
+
"aria-describedby": displayError ? errorId : helperText ? helperId : void 0,
|
|
160
|
+
"data-cy": finalDataCy,
|
|
161
|
+
"data-testid": finalTestId,
|
|
162
|
+
onChange: handleChange,
|
|
163
|
+
onBlur: handleBlur,
|
|
164
|
+
onKeyDown: handleKeyDown,
|
|
165
|
+
maxLength,
|
|
166
|
+
...props
|
|
138
167
|
}
|
|
139
168
|
),
|
|
140
|
-
|
|
169
|
+
displayError && /* @__PURE__ */ jsx(
|
|
141
170
|
"span",
|
|
142
171
|
{
|
|
143
|
-
id:
|
|
172
|
+
id: errorId,
|
|
144
173
|
className: "input__error",
|
|
145
174
|
role: "alert",
|
|
146
|
-
"data-cy": `${
|
|
147
|
-
"data-testid": `${
|
|
148
|
-
children:
|
|
175
|
+
"data-cy": `${finalDataCy}-error`,
|
|
176
|
+
"data-testid": `${finalTestId}-error`,
|
|
177
|
+
children: displayError
|
|
149
178
|
}
|
|
150
179
|
),
|
|
151
|
-
|
|
180
|
+
helperText && !displayError && /* @__PURE__ */ jsx(
|
|
152
181
|
"span",
|
|
153
182
|
{
|
|
154
|
-
id:
|
|
183
|
+
id: helperId,
|
|
155
184
|
className: "input__helper",
|
|
156
|
-
"data-cy": `${
|
|
157
|
-
"data-testid": `${
|
|
158
|
-
children:
|
|
185
|
+
"data-cy": `${finalDataCy}-helper`,
|
|
186
|
+
"data-testid": `${finalTestId}-helper`,
|
|
187
|
+
children: helperText
|
|
159
188
|
}
|
|
160
189
|
)
|
|
161
190
|
]
|
|
@@ -163,7 +192,7 @@ const y = L(
|
|
|
163
192
|
);
|
|
164
193
|
}
|
|
165
194
|
);
|
|
166
|
-
|
|
195
|
+
AlphanumericInput.displayName = "AlphanumericInput";
|
|
167
196
|
export {
|
|
168
|
-
|
|
197
|
+
AlphanumericInput
|
|
169
198
|
};
|
package/dist/index7.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"),r=require("react"),a=require("./index17.cjs");;/* empty css */const c=r.forwardRef(({label:c,error:t,helperText:d,indeterminate:i=!1,className:s,id:l,required:n,disabled:o,checked:u,"data-cy":b,"data-testid":h,...x},p)=>{const k=r.useId(),m=l||k,y=`${m}-error`,_=`${m}-helper`,$=b||"checkbox",f=h||"checkbox",j=r.useRef(null),N=r.useCallback(e=>{j.current=e,p&&("function"==typeof p?p(e):"current"in p&&(p.current=e))},[p]);r.useEffect(()=>{j.current&&(j.current.indeterminate=i)},[i]);const q=c&&n&&!c.includes("*")?`${c} *`:c;return e.jsxs("div",{className:a.cn("checkbox-wrapper",o&&"checkbox-wrapper--disabled"),"data-cy":`${$}-wrapper`,"data-testid":`${f}-wrapper`,children:[e.jsxs("div",{className:"checkbox__container",children:[e.jsx("input",{ref:N,id:m,type:"checkbox",checked:u,className:a.cn("checkbox__input",t&&"checkbox__input--error",s),"aria-invalid":t?"true":"false","aria-required":n?"true":void 0,"aria-describedby":t?y:d?_:void 0,"data-cy":$,"data-testid":f,"data-indeterminate":i?"true":void 0,disabled:o,required:n,...x}),c&&e.jsx("label",{htmlFor:m,className:"checkbox__label","data-cy":`${$}-label`,"data-testid":`${f}-label`,children:q})]}),t&&e.jsx("span",{id:y,className:"checkbox__error",role:"alert","data-cy":`${$}-error`,"data-testid":`${f}-error`,children:t}),d&&!t&&e.jsx("span",{id:_,className:"checkbox__helper","data-cy":`${$}-helper`,"data-testid":`${f}-helper`,children:d})]})});c.displayName="Checkbox",exports.Checkbox=c;
|
package/dist/index7.js
CHANGED
|
@@ -1,89 +1,104 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId, useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const Checkbox = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
label
|
|
8
|
-
error
|
|
9
|
-
helperText
|
|
10
|
-
indeterminate
|
|
11
|
-
className
|
|
12
|
-
id:
|
|
13
|
-
required
|
|
14
|
-
disabled
|
|
15
|
-
checked
|
|
16
|
-
"data-cy":
|
|
17
|
-
"data-testid":
|
|
18
|
-
...
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
label,
|
|
8
|
+
error,
|
|
9
|
+
helperText,
|
|
10
|
+
indeterminate = false,
|
|
11
|
+
className,
|
|
12
|
+
id: providedId,
|
|
13
|
+
required,
|
|
14
|
+
disabled,
|
|
15
|
+
checked,
|
|
16
|
+
"data-cy": dataCy,
|
|
17
|
+
"data-testid": dataTestId,
|
|
18
|
+
...props
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const generatedId = useId();
|
|
21
|
+
const id = providedId || generatedId;
|
|
22
|
+
const errorId = `${id}-error`;
|
|
23
|
+
const helperId = `${id}-helper`;
|
|
24
|
+
const finalDataCy = dataCy || "checkbox";
|
|
25
|
+
const finalTestId = dataTestId || "checkbox";
|
|
26
|
+
const internalRef = useRef(null);
|
|
27
|
+
const combinedRef = useCallback(
|
|
28
|
+
(element) => {
|
|
29
|
+
internalRef.current = element;
|
|
30
|
+
if (!ref) return;
|
|
31
|
+
if (typeof ref === "function") {
|
|
32
|
+
ref(element);
|
|
33
|
+
} else if ("current" in ref) {
|
|
34
|
+
ref.current = element;
|
|
35
|
+
}
|
|
23
36
|
},
|
|
24
|
-
[
|
|
37
|
+
[ref]
|
|
25
38
|
);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (internalRef.current) {
|
|
41
|
+
internalRef.current.indeterminate = indeterminate;
|
|
42
|
+
}
|
|
43
|
+
}, [indeterminate]);
|
|
44
|
+
const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
31
46
|
"div",
|
|
32
47
|
{
|
|
33
|
-
className:
|
|
34
|
-
"data-cy": `${
|
|
35
|
-
"data-testid": `${
|
|
48
|
+
className: cn("checkbox-wrapper", disabled && "checkbox-wrapper--disabled"),
|
|
49
|
+
"data-cy": `${finalDataCy}-wrapper`,
|
|
50
|
+
"data-testid": `${finalTestId}-wrapper`,
|
|
36
51
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ jsxs("div", { className: "checkbox__container", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
39
54
|
"input",
|
|
40
55
|
{
|
|
41
|
-
ref:
|
|
42
|
-
id
|
|
56
|
+
ref: combinedRef,
|
|
57
|
+
id,
|
|
43
58
|
type: "checkbox",
|
|
44
|
-
checked
|
|
45
|
-
className:
|
|
46
|
-
"aria-invalid":
|
|
47
|
-
"aria-required":
|
|
48
|
-
"aria-describedby":
|
|
49
|
-
"data-cy":
|
|
50
|
-
"data-testid":
|
|
51
|
-
"data-indeterminate":
|
|
52
|
-
disabled
|
|
53
|
-
required
|
|
54
|
-
...
|
|
59
|
+
checked,
|
|
60
|
+
className: cn("checkbox__input", error && "checkbox__input--error", className),
|
|
61
|
+
"aria-invalid": error ? "true" : "false",
|
|
62
|
+
"aria-required": required ? "true" : void 0,
|
|
63
|
+
"aria-describedby": error ? errorId : helperText ? helperId : void 0,
|
|
64
|
+
"data-cy": finalDataCy,
|
|
65
|
+
"data-testid": finalTestId,
|
|
66
|
+
"data-indeterminate": indeterminate ? "true" : void 0,
|
|
67
|
+
disabled,
|
|
68
|
+
required,
|
|
69
|
+
...props
|
|
55
70
|
}
|
|
56
71
|
),
|
|
57
|
-
|
|
72
|
+
label && /* @__PURE__ */ jsx(
|
|
58
73
|
"label",
|
|
59
74
|
{
|
|
60
|
-
htmlFor:
|
|
75
|
+
htmlFor: id,
|
|
61
76
|
className: "checkbox__label",
|
|
62
|
-
"data-cy": `${
|
|
63
|
-
"data-testid": `${
|
|
64
|
-
children:
|
|
77
|
+
"data-cy": `${finalDataCy}-label`,
|
|
78
|
+
"data-testid": `${finalTestId}-label`,
|
|
79
|
+
children: displayLabel
|
|
65
80
|
}
|
|
66
81
|
)
|
|
67
82
|
] }),
|
|
68
|
-
|
|
83
|
+
error && /* @__PURE__ */ jsx(
|
|
69
84
|
"span",
|
|
70
85
|
{
|
|
71
|
-
id:
|
|
86
|
+
id: errorId,
|
|
72
87
|
className: "checkbox__error",
|
|
73
88
|
role: "alert",
|
|
74
|
-
"data-cy": `${
|
|
75
|
-
"data-testid": `${
|
|
76
|
-
children:
|
|
89
|
+
"data-cy": `${finalDataCy}-error`,
|
|
90
|
+
"data-testid": `${finalTestId}-error`,
|
|
91
|
+
children: error
|
|
77
92
|
}
|
|
78
93
|
),
|
|
79
|
-
|
|
94
|
+
helperText && !error && /* @__PURE__ */ jsx(
|
|
80
95
|
"span",
|
|
81
96
|
{
|
|
82
|
-
id:
|
|
97
|
+
id: helperId,
|
|
83
98
|
className: "checkbox__helper",
|
|
84
|
-
"data-cy": `${
|
|
85
|
-
"data-testid": `${
|
|
86
|
-
children:
|
|
99
|
+
"data-cy": `${finalDataCy}-helper`,
|
|
100
|
+
"data-testid": `${finalTestId}-helper`,
|
|
101
|
+
children: helperText
|
|
87
102
|
}
|
|
88
103
|
)
|
|
89
104
|
]
|
|
@@ -91,7 +106,7 @@ const E = C(
|
|
|
91
106
|
);
|
|
92
107
|
}
|
|
93
108
|
);
|
|
94
|
-
|
|
109
|
+
Checkbox.displayName = "Checkbox";
|
|
95
110
|
export {
|
|
96
|
-
|
|
111
|
+
Checkbox
|
|
97
112
|
};
|
package/dist/index8.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),a=require("./index17.cjs");;/* empty css */const d=r.forwardRef(({label:d,error:i,helperText:t,className:s,id:l,required:c,disabled:o,checked:n,"data-cy":p,"data-testid":u,...b},h)=>{const x=r.useId(),y=l||x,_=`${y}-error`,m=`${y}-helper`,$=p||"radio",j=u||"radio",N=r.useRef(null),f=r.useCallback(e=>{N.current=e,h&&("function"==typeof h?h(e):"current"in h&&(h.current=e))},[h]),q=d&&c&&!d.includes("*")?`${d} *`:d;return e.jsxs("div",{className:a.cn("radio-wrapper",o&&"radio-wrapper--disabled"),"data-cy":`${$}-wrapper`,"data-testid":`${j}-wrapper`,children:[e.jsxs("div",{className:"radio__container",children:[e.jsx("input",{ref:f,id:y,type:"radio",checked:n,className:a.cn("radio__input",i&&"radio__input--error",s),"aria-describedby":i?_:t?m:void 0,"data-cy":$,"data-testid":j,disabled:o,required:c,...b}),d&&e.jsx("label",{htmlFor:y,className:"radio__label","data-cy":`${$}-label`,"data-testid":`${j}-label`,children:q})]}),i&&e.jsx("span",{id:_,className:"radio__error",role:"alert","data-cy":`${$}-error`,"data-testid":`${j}-error`,children:i}),t&&!i&&e.jsx("span",{id:m,className:"radio__helper","data-cy":`${$}-helper`,"data-testid":`${j}-helper`,children:t})]})});d.displayName="Radio",exports.Radio=d;
|