@cosxai/ui 0.8.0 → 0.8.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/package.json
CHANGED
|
@@ -13,6 +13,13 @@ export interface CheckboxProps {
|
|
|
13
13
|
suffix?: React.ReactNode;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Test hook forwarded to the visual button. Consumers with
|
|
18
|
+
* getByTestId('…') queries can keep them working across the swap
|
|
19
|
+
* from native <input type="checkbox"> to this primitive without
|
|
20
|
+
* touching each test file.
|
|
21
|
+
*/
|
|
22
|
+
"data-testid"?: string;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
export function Checkbox({
|
|
@@ -22,6 +29,7 @@ export function Checkbox({
|
|
|
22
29
|
suffix,
|
|
23
30
|
disabled,
|
|
24
31
|
className,
|
|
32
|
+
"data-testid": testId,
|
|
25
33
|
}: CheckboxProps) {
|
|
26
34
|
return (
|
|
27
35
|
<label
|
|
@@ -43,6 +51,7 @@ export function Checkbox({
|
|
|
43
51
|
aria-checked={checked}
|
|
44
52
|
disabled={disabled}
|
|
45
53
|
onClick={() => !disabled && onChange(!checked)}
|
|
54
|
+
data-testid={testId}
|
|
46
55
|
style={{
|
|
47
56
|
width: 16,
|
|
48
57
|
height: 16,
|
package/src/primitives/Radio.tsx
CHANGED
|
@@ -34,6 +34,8 @@ export interface RadioProps {
|
|
|
34
34
|
*/
|
|
35
35
|
value?: string;
|
|
36
36
|
className?: string;
|
|
37
|
+
/** Test hook forwarded to the visual button — see Checkbox. */
|
|
38
|
+
"data-testid"?: string;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export function Radio({
|
|
@@ -45,6 +47,7 @@ export function Radio({
|
|
|
45
47
|
name,
|
|
46
48
|
value,
|
|
47
49
|
className,
|
|
50
|
+
"data-testid": testId,
|
|
48
51
|
}: RadioProps) {
|
|
49
52
|
return (
|
|
50
53
|
<label
|
|
@@ -66,6 +69,7 @@ export function Radio({
|
|
|
66
69
|
aria-checked={checked}
|
|
67
70
|
disabled={disabled}
|
|
68
71
|
onClick={() => !disabled && !checked && onChange(true)}
|
|
72
|
+
data-testid={testId}
|
|
69
73
|
style={{
|
|
70
74
|
width: 16,
|
|
71
75
|
height: 16,
|