@moda/om 17.4.0 → 17.5.0
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.
|
@@ -4,5 +4,6 @@ export declare type ShowCheckedUsing = 'checkmark' | 'circle';
|
|
|
4
4
|
export declare type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
5
5
|
children?: JSX.Element | string;
|
|
6
6
|
checkIcon?: ShowCheckedUsing;
|
|
7
|
+
dataTestId?: string;
|
|
7
8
|
};
|
|
8
9
|
export declare const Checkbox: React.FC<CheckboxProps>;
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ export type ShowCheckedUsing = 'checkmark' | 'circle';
|
|
|
16
16
|
export type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
17
17
|
children?: JSX.Element | string;
|
|
18
18
|
checkIcon?: ShowCheckedUsing;
|
|
19
|
+
dataTestId?: string;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const Checkbox: React.FC<CheckboxProps> = ({
|
|
@@ -27,6 +28,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
27
28
|
onChange,
|
|
28
29
|
disabled,
|
|
29
30
|
checkIcon = 'checkmark',
|
|
31
|
+
dataTestId,
|
|
30
32
|
...rest
|
|
31
33
|
}) => {
|
|
32
34
|
const [isChecked, setIsChecked] = useState(checked ?? defaultChecked ?? false);
|
|
@@ -50,6 +52,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
50
52
|
className={classNames('Checkbox', className, {
|
|
51
53
|
'Checkbox--disabled': disabled
|
|
52
54
|
})}
|
|
55
|
+
data-test-id={`${dataTestId}--label`}
|
|
53
56
|
>
|
|
54
57
|
<span
|
|
55
58
|
tabIndex={-1}
|
|
@@ -74,6 +77,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
74
77
|
value={value}
|
|
75
78
|
onChange={handleChange}
|
|
76
79
|
disabled={disabled}
|
|
80
|
+
data-test-id={`${dataTestId}--input`}
|
|
77
81
|
{...rest}
|
|
78
82
|
/>
|
|
79
83
|
|