@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/index6.js
CHANGED
|
@@ -1,169 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useMemo, useCallback, useState, useEffect } from "react";
|
|
3
|
+
import { Input } from "./index20.js";
|
|
4
|
+
import { useMergedRef } from "./index21.js";
|
|
5
|
+
const AlphanumericInput = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
allowHyphen
|
|
8
|
-
allowUnderscore
|
|
9
|
-
allowSpace
|
|
10
|
-
minLength
|
|
11
|
-
maxLength
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
allowHyphen = false,
|
|
8
|
+
allowUnderscore = false,
|
|
9
|
+
allowSpace = false,
|
|
10
|
+
minLength,
|
|
11
|
+
maxLength,
|
|
12
|
+
validate,
|
|
13
|
+
onChange,
|
|
14
|
+
"data-cy": dataCy,
|
|
15
|
+
"data-testid": dataTestId,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const inputRef = useRef(null);
|
|
19
|
+
const mergedRef = useMergedRef(ref, inputRef);
|
|
20
|
+
const alphanumericRegex = useMemo(() => {
|
|
21
|
+
let pattern = "^[a-zA-Z0-9";
|
|
22
|
+
if (allowHyphen) pattern += "\\-";
|
|
23
|
+
if (allowUnderscore) pattern += "_";
|
|
24
|
+
if (allowSpace) pattern += " ";
|
|
25
|
+
pattern += "]*$";
|
|
26
|
+
return new RegExp(pattern);
|
|
27
|
+
}, [allowHyphen, allowUnderscore, allowSpace]);
|
|
28
|
+
const characterRegex = useMemo(() => {
|
|
29
|
+
let pattern = "[a-zA-Z0-9";
|
|
30
|
+
if (allowHyphen) pattern += "\\-";
|
|
31
|
+
if (allowUnderscore) pattern += "_";
|
|
32
|
+
if (allowSpace) pattern += " ";
|
|
33
|
+
pattern += "]";
|
|
34
|
+
return new RegExp(pattern);
|
|
35
|
+
}, [allowHyphen, allowUnderscore, allowSpace]);
|
|
36
|
+
const alphanumericValidation = useCallback(
|
|
37
|
+
(value) => {
|
|
38
|
+
if (!value) return void 0;
|
|
39
|
+
if (!alphanumericRegex.test(value)) {
|
|
40
|
+
let allowedChars = "letters and numbers";
|
|
41
|
+
const extras = [];
|
|
42
|
+
if (allowHyphen) extras.push("hyphens");
|
|
43
|
+
if (allowUnderscore) extras.push("underscores");
|
|
44
|
+
if (allowSpace) extras.push("spaces");
|
|
45
|
+
if (extras.length > 0) {
|
|
46
|
+
allowedChars += `, ${extras.join(", ")}`;
|
|
47
|
+
}
|
|
48
|
+
return `Only ${allowedChars} are allowed`;
|
|
36
49
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
t == null || t(r);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (s.includes(r.key)) {
|
|
63
|
-
t == null || t(r);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (f && r.key === " ") {
|
|
67
|
-
t == null || t(r);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (u && r.key === "-") {
|
|
71
|
-
t == null || t(r);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (c && r.key === "_") {
|
|
75
|
-
t == null || t(r);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (r.key >= "a" && r.key <= "z" || r.key >= "A" && r.key <= "Z") {
|
|
79
|
-
t == null || t(r);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (r.key >= "0" && r.key <= "9") {
|
|
83
|
-
t == null || t(r);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
r.preventDefault();
|
|
87
|
-
}, S = (r) => {
|
|
88
|
-
const s = r.target.value;
|
|
89
|
-
if (X) {
|
|
90
|
-
const i = j(s);
|
|
91
|
-
A(i.error), a == null || a(i.isValid);
|
|
50
|
+
if (minLength !== void 0 && value.length < minLength) {
|
|
51
|
+
return `Must be at least ${minLength} characters`;
|
|
52
|
+
}
|
|
53
|
+
if (maxLength !== void 0 && value.length > maxLength) {
|
|
54
|
+
return `Must be at most ${maxLength} characters`;
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
},
|
|
58
|
+
[alphanumericRegex, minLength, maxLength, allowHyphen, allowUnderscore, allowSpace]
|
|
59
|
+
);
|
|
60
|
+
const combinedValidation = useCallback(
|
|
61
|
+
(value) => {
|
|
62
|
+
if (!validate) return alphanumericValidation(value);
|
|
63
|
+
return alphanumericValidation(value) || validate(value);
|
|
64
|
+
},
|
|
65
|
+
[alphanumericValidation, validate]
|
|
66
|
+
);
|
|
67
|
+
const [pendingCursorPosition, setPendingCursorPosition] = useState(null);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (pendingCursorPosition !== null && inputRef.current) {
|
|
70
|
+
inputRef.current.setSelectionRange(pendingCursorPosition, pendingCursorPosition);
|
|
71
|
+
setPendingCursorPosition(null);
|
|
92
72
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
73
|
+
}, [props.value, pendingCursorPosition]);
|
|
74
|
+
const handleChange = useCallback(
|
|
75
|
+
(e) => {
|
|
76
|
+
const input = e.target;
|
|
77
|
+
const value = input.value;
|
|
78
|
+
const cursorPosition = input.selectionStart || 0;
|
|
79
|
+
const filteredValue = value.split("").filter((char) => characterRegex.test(char)).join("");
|
|
80
|
+
const removedBeforeCursor = value.slice(0, cursorPosition).split("").filter((char) => !characterRegex.test(char)).length;
|
|
81
|
+
const newPosition = cursorPosition - removedBeforeCursor;
|
|
82
|
+
input.value = filteredValue;
|
|
83
|
+
const isControlled = props.value !== void 0;
|
|
84
|
+
if (isControlled) {
|
|
85
|
+
setPendingCursorPosition(newPosition);
|
|
86
|
+
} else {
|
|
87
|
+
input.setSelectionRange(newPosition, newPosition);
|
|
88
|
+
}
|
|
89
|
+
onChange == null ? void 0 : onChange(e);
|
|
90
|
+
},
|
|
91
|
+
[characterRegex, onChange, props.value]
|
|
92
|
+
);
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
94
|
+
Input,
|
|
102
95
|
{
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"data-cy": `${d}-label`,
|
|
113
|
-
"data-testid": `${l}-label`,
|
|
114
|
-
children: _
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
/* @__PURE__ */ b(
|
|
118
|
-
"input",
|
|
119
|
-
{
|
|
120
|
-
ref: P,
|
|
121
|
-
id: $,
|
|
122
|
-
type: "text",
|
|
123
|
-
className: z(
|
|
124
|
-
"input",
|
|
125
|
-
e && "input--error",
|
|
126
|
-
E && "input--full-width",
|
|
127
|
-
T
|
|
128
|
-
),
|
|
129
|
-
"aria-invalid": e ? "true" : "false",
|
|
130
|
-
"aria-describedby": e ? N : I ? B : void 0,
|
|
131
|
-
"data-cy": d,
|
|
132
|
-
"data-testid": l,
|
|
133
|
-
onChange: S,
|
|
134
|
-
onBlur: V,
|
|
135
|
-
onKeyDown: H,
|
|
136
|
-
maxLength: p,
|
|
137
|
-
...m
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
e && /* @__PURE__ */ b(
|
|
141
|
-
"span",
|
|
142
|
-
{
|
|
143
|
-
id: N,
|
|
144
|
-
className: "input__error",
|
|
145
|
-
role: "alert",
|
|
146
|
-
"data-cy": `${d}-error`,
|
|
147
|
-
"data-testid": `${l}-error`,
|
|
148
|
-
children: e
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
I && !e && /* @__PURE__ */ b(
|
|
152
|
-
"span",
|
|
153
|
-
{
|
|
154
|
-
id: B,
|
|
155
|
-
className: "input__helper",
|
|
156
|
-
"data-cy": `${d}-helper`,
|
|
157
|
-
"data-testid": `${l}-helper`,
|
|
158
|
-
children: I
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
]
|
|
96
|
+
ref: mergedRef,
|
|
97
|
+
type: "text",
|
|
98
|
+
minLength,
|
|
99
|
+
maxLength,
|
|
100
|
+
validate: combinedValidation,
|
|
101
|
+
onChange: handleChange,
|
|
102
|
+
"data-cy": dataCy || "alphanumeric-input",
|
|
103
|
+
"data-testid": dataTestId || "alphanumeric-input",
|
|
104
|
+
...props
|
|
162
105
|
}
|
|
163
106
|
);
|
|
164
107
|
}
|
|
165
108
|
);
|
|
166
|
-
|
|
109
|
+
AlphanumericInput.displayName = "AlphanumericInput";
|
|
167
110
|
export {
|
|
168
|
-
|
|
111
|
+
AlphanumericInput
|
|
169
112
|
};
|
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;
|
package/dist/index8.js
CHANGED
|
@@ -1,81 +1,95 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId, useRef, useCallback } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const Radio = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
label
|
|
8
|
-
error
|
|
9
|
-
helperText
|
|
10
|
-
className
|
|
11
|
-
id:
|
|
12
|
-
required
|
|
13
|
-
disabled
|
|
14
|
-
checked
|
|
15
|
-
"data-cy":
|
|
16
|
-
"data-testid":
|
|
17
|
-
...
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
label,
|
|
8
|
+
error,
|
|
9
|
+
helperText,
|
|
10
|
+
className,
|
|
11
|
+
id: providedId,
|
|
12
|
+
required,
|
|
13
|
+
disabled,
|
|
14
|
+
checked,
|
|
15
|
+
"data-cy": dataCy,
|
|
16
|
+
"data-testid": dataTestId,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const generatedId = useId();
|
|
20
|
+
const id = providedId || generatedId;
|
|
21
|
+
const errorId = `${id}-error`;
|
|
22
|
+
const helperId = `${id}-helper`;
|
|
23
|
+
const finalDataCy = dataCy || "radio";
|
|
24
|
+
const finalTestId = dataTestId || "radio";
|
|
25
|
+
const internalRef = useRef(null);
|
|
26
|
+
const combinedRef = useCallback(
|
|
27
|
+
(element) => {
|
|
28
|
+
internalRef.current = element;
|
|
29
|
+
if (!ref) return;
|
|
30
|
+
if (typeof ref === "function") {
|
|
31
|
+
ref(element);
|
|
32
|
+
} else if ("current" in ref) {
|
|
33
|
+
ref.current = element;
|
|
34
|
+
}
|
|
22
35
|
},
|
|
23
|
-
[
|
|
24
|
-
)
|
|
25
|
-
|
|
36
|
+
[ref]
|
|
37
|
+
);
|
|
38
|
+
const displayLabel = label && required && !label.includes("*") ? `${label} *` : label;
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
26
40
|
"div",
|
|
27
41
|
{
|
|
28
|
-
className:
|
|
29
|
-
"data-cy": `${
|
|
30
|
-
"data-testid": `${
|
|
42
|
+
className: cn("radio-wrapper", disabled && "radio-wrapper--disabled"),
|
|
43
|
+
"data-cy": `${finalDataCy}-wrapper`,
|
|
44
|
+
"data-testid": `${finalTestId}-wrapper`,
|
|
31
45
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "radio__container", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
34
48
|
"input",
|
|
35
49
|
{
|
|
36
|
-
ref:
|
|
37
|
-
id
|
|
50
|
+
ref: combinedRef,
|
|
51
|
+
id,
|
|
38
52
|
type: "radio",
|
|
39
|
-
checked
|
|
40
|
-
className:
|
|
41
|
-
"aria-describedby":
|
|
42
|
-
"data-cy":
|
|
43
|
-
"data-testid":
|
|
44
|
-
disabled
|
|
45
|
-
required
|
|
46
|
-
...
|
|
53
|
+
checked,
|
|
54
|
+
className: cn("radio__input", error && "radio__input--error", className),
|
|
55
|
+
"aria-describedby": error ? errorId : helperText ? helperId : void 0,
|
|
56
|
+
"data-cy": finalDataCy,
|
|
57
|
+
"data-testid": finalTestId,
|
|
58
|
+
disabled,
|
|
59
|
+
required,
|
|
60
|
+
...props
|
|
47
61
|
}
|
|
48
62
|
),
|
|
49
|
-
|
|
63
|
+
label && /* @__PURE__ */ jsx(
|
|
50
64
|
"label",
|
|
51
65
|
{
|
|
52
|
-
htmlFor:
|
|
66
|
+
htmlFor: id,
|
|
53
67
|
className: "radio__label",
|
|
54
|
-
"data-cy": `${
|
|
55
|
-
"data-testid": `${
|
|
56
|
-
children:
|
|
68
|
+
"data-cy": `${finalDataCy}-label`,
|
|
69
|
+
"data-testid": `${finalTestId}-label`,
|
|
70
|
+
children: displayLabel
|
|
57
71
|
}
|
|
58
72
|
)
|
|
59
73
|
] }),
|
|
60
|
-
|
|
74
|
+
error && /* @__PURE__ */ jsx(
|
|
61
75
|
"span",
|
|
62
76
|
{
|
|
63
|
-
id:
|
|
77
|
+
id: errorId,
|
|
64
78
|
className: "radio__error",
|
|
65
79
|
role: "alert",
|
|
66
|
-
"data-cy": `${
|
|
67
|
-
"data-testid": `${
|
|
68
|
-
children:
|
|
80
|
+
"data-cy": `${finalDataCy}-error`,
|
|
81
|
+
"data-testid": `${finalTestId}-error`,
|
|
82
|
+
children: error
|
|
69
83
|
}
|
|
70
84
|
),
|
|
71
|
-
|
|
85
|
+
helperText && !error && /* @__PURE__ */ jsx(
|
|
72
86
|
"span",
|
|
73
87
|
{
|
|
74
|
-
id:
|
|
88
|
+
id: helperId,
|
|
75
89
|
className: "radio__helper",
|
|
76
|
-
"data-cy": `${
|
|
77
|
-
"data-testid": `${
|
|
78
|
-
children:
|
|
90
|
+
"data-cy": `${finalDataCy}-helper`,
|
|
91
|
+
"data-testid": `${finalTestId}-helper`,
|
|
92
|
+
children: helperText
|
|
79
93
|
}
|
|
80
94
|
)
|
|
81
95
|
]
|
|
@@ -83,7 +97,7 @@ const x = j(
|
|
|
83
97
|
);
|
|
84
98
|
}
|
|
85
99
|
);
|
|
86
|
-
|
|
100
|
+
Radio.displayName = "Radio";
|
|
87
101
|
export {
|
|
88
|
-
|
|
102
|
+
Radio
|
|
89
103
|
};
|
package/dist/index9.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 t=require("react/jsx-runtime"),e=require("react"),a=require("@radix-ui/react-tabs"),s=require("./index17.cjs");function r(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const a in t)if("default"!==a){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>t[a]})}return e.default=t,Object.freeze(e)};/* empty css */const i=r(a),n=i.Root,c=e.forwardRef(({className:e,"data-cy":a,"data-testid":r,...n},c)=>{const o=a||"tabs-list",d=r||"tabs-list";return t.jsx(i.List,{ref:c,className:s.cn("tabs-list",e),"data-cy":o,"data-testid":d,...n})});c.displayName=i.List.displayName;const o=e.forwardRef(({className:e,value:a,"data-cy":r,"data-testid":n,...c},o)=>{const d=r||(a?`tabs-trigger-${a}`:"tabs-trigger"),l=n||(a?`tabs-trigger-${a}`:"tabs-trigger");return t.jsx(i.Trigger,{ref:o,className:s.cn("tabs-trigger",e),value:a,"data-cy":d,"data-testid":l,...c})});o.displayName=i.Trigger.displayName;const d=e.forwardRef(({className:e,value:a,"data-cy":r,"data-testid":n,...c},o)=>{const d=r||(a?`tabs-content-${a}`:"tabs-content"),l=n||(a?`tabs-content-${a}`:"tabs-content");return t.jsx(i.Content,{ref:o,className:s.cn("tabs-content",e),value:a,"data-cy":d,"data-testid":l,...c})});d.displayName=i.Content.displayName,exports.Tabs=n,exports.TabsContent=d,exports.TabsList=c,exports.TabsTrigger=o;
|