@khanacademy/wonder-blocks-form 4.3.0 → 4.3.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/CHANGELOG.md +12 -0
- package/dist/es/index.js +8 -8
- package/dist/index.js +8 -8
- package/package.json +6 -6
- package/src/components/checkbox-core.tsx +70 -76
- package/src/components/checkbox-group.tsx +71 -79
- package/src/components/checkbox.tsx +15 -17
- package/src/components/choice-internal.tsx +94 -93
- package/src/components/choice.tsx +34 -33
- package/src/components/radio-core.tsx +41 -47
- package/src/components/radio-group.tsx +56 -61
- package/src/components/radio.tsx +15 -17
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-form
|
|
2
2
|
|
|
3
|
+
## 4.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9f3752d4: Used named functions in componenets with forwarded refs
|
|
8
|
+
- Updated dependencies [9f3752d4]
|
|
9
|
+
- @khanacademy/wonder-blocks-typography@2.1.1
|
|
10
|
+
- @khanacademy/wonder-blocks-core@5.3.1
|
|
11
|
+
- @khanacademy/wonder-blocks-clickable@3.1.2
|
|
12
|
+
- @khanacademy/wonder-blocks-icon@2.0.15
|
|
13
|
+
- @khanacademy/wonder-blocks-layout@2.0.15
|
|
14
|
+
|
|
3
15
|
## 4.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/es/index.js
CHANGED
|
@@ -62,7 +62,7 @@ const checkPath = {
|
|
|
62
62
|
const indeterminatePath = {
|
|
63
63
|
small: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z"
|
|
64
64
|
};
|
|
65
|
-
const CheckboxCore = React.forwardRef((props, ref)
|
|
65
|
+
const CheckboxCore = React.forwardRef(function CheckboxCore(props, ref) {
|
|
66
66
|
const {
|
|
67
67
|
checked,
|
|
68
68
|
disabled,
|
|
@@ -220,7 +220,7 @@ const {
|
|
|
220
220
|
offBlack50
|
|
221
221
|
} = Color;
|
|
222
222
|
const StyledInput$1 = addStyle("input");
|
|
223
|
-
const RadioCore = React.forwardRef((props, ref)
|
|
223
|
+
const RadioCore = React.forwardRef(function RadioCore(props, ref) {
|
|
224
224
|
const handleChange = () => {
|
|
225
225
|
return;
|
|
226
226
|
};
|
|
@@ -354,7 +354,7 @@ const _generateStyles = (checked, error) => {
|
|
|
354
354
|
return styles$4[styleKey];
|
|
355
355
|
};
|
|
356
356
|
|
|
357
|
-
const ChoiceInternal = React.forwardRef((props, ref)
|
|
357
|
+
const ChoiceInternal = React.forwardRef(function ChoiceInternal(props, ref) {
|
|
358
358
|
const {
|
|
359
359
|
checked,
|
|
360
360
|
description,
|
|
@@ -437,7 +437,7 @@ const styles$3 = StyleSheet.create({
|
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
|
|
440
|
-
const Checkbox = React.forwardRef((props, ref)
|
|
440
|
+
const Checkbox = React.forwardRef(function Checkbox(props, ref) {
|
|
441
441
|
const {
|
|
442
442
|
disabled = false,
|
|
443
443
|
error = false
|
|
@@ -451,7 +451,7 @@ const Checkbox = React.forwardRef((props, ref) => {
|
|
|
451
451
|
});
|
|
452
452
|
|
|
453
453
|
const _excluded$2 = ["disabled", "error"];
|
|
454
|
-
const Radio = React.forwardRef((props, ref)
|
|
454
|
+
const Radio = React.forwardRef(function Radio(props, ref) {
|
|
455
455
|
const {
|
|
456
456
|
disabled = false,
|
|
457
457
|
error = false
|
|
@@ -466,7 +466,7 @@ const Radio = React.forwardRef((props, ref) => {
|
|
|
466
466
|
});
|
|
467
467
|
|
|
468
468
|
const _excluded$1 = ["checked", "disabled", "onChange", "value", "variant"];
|
|
469
|
-
const Choice = React.forwardRef((props, ref)
|
|
469
|
+
const Choice = React.forwardRef(function Choice(props, ref) {
|
|
470
470
|
const {
|
|
471
471
|
checked = false,
|
|
472
472
|
disabled = false,
|
|
@@ -514,7 +514,7 @@ const styles$2 = StyleSheet.create({
|
|
|
514
514
|
|
|
515
515
|
const StyledFieldset$1 = addStyle("fieldset");
|
|
516
516
|
const StyledLegend$1 = addStyle("legend");
|
|
517
|
-
const CheckboxGroup = React.forwardRef((props, ref)
|
|
517
|
+
const CheckboxGroup = React.forwardRef(function CheckboxGroup(props, ref) {
|
|
518
518
|
const {
|
|
519
519
|
children,
|
|
520
520
|
label,
|
|
@@ -571,7 +571,7 @@ const CheckboxGroup = React.forwardRef((props, ref) => {
|
|
|
571
571
|
|
|
572
572
|
const StyledFieldset = addStyle("fieldset");
|
|
573
573
|
const StyledLegend = addStyle("legend");
|
|
574
|
-
const RadioGroup = React.forwardRef((props, ref)
|
|
574
|
+
const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
|
|
575
575
|
const {
|
|
576
576
|
children,
|
|
577
577
|
label,
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ const checkPath = {
|
|
|
91
91
|
const indeterminatePath = {
|
|
92
92
|
small: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z"
|
|
93
93
|
};
|
|
94
|
-
const CheckboxCore = React__namespace.forwardRef((props, ref)
|
|
94
|
+
const CheckboxCore = React__namespace.forwardRef(function CheckboxCore(props, ref) {
|
|
95
95
|
const {
|
|
96
96
|
checked,
|
|
97
97
|
disabled,
|
|
@@ -249,7 +249,7 @@ const {
|
|
|
249
249
|
offBlack50
|
|
250
250
|
} = Color__default["default"];
|
|
251
251
|
const StyledInput$1 = wonderBlocksCore.addStyle("input");
|
|
252
|
-
const RadioCore = React__namespace.forwardRef((props, ref)
|
|
252
|
+
const RadioCore = React__namespace.forwardRef(function RadioCore(props, ref) {
|
|
253
253
|
const handleChange = () => {
|
|
254
254
|
return;
|
|
255
255
|
};
|
|
@@ -383,7 +383,7 @@ const _generateStyles = (checked, error) => {
|
|
|
383
383
|
return styles$4[styleKey];
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
-
const ChoiceInternal = React__namespace.forwardRef((props, ref)
|
|
386
|
+
const ChoiceInternal = React__namespace.forwardRef(function ChoiceInternal(props, ref) {
|
|
387
387
|
const {
|
|
388
388
|
checked,
|
|
389
389
|
description,
|
|
@@ -466,7 +466,7 @@ const styles$3 = aphrodite.StyleSheet.create({
|
|
|
466
466
|
}
|
|
467
467
|
});
|
|
468
468
|
|
|
469
|
-
const Checkbox = React__namespace.forwardRef((props, ref)
|
|
469
|
+
const Checkbox = React__namespace.forwardRef(function Checkbox(props, ref) {
|
|
470
470
|
const {
|
|
471
471
|
disabled = false,
|
|
472
472
|
error = false
|
|
@@ -480,7 +480,7 @@ const Checkbox = React__namespace.forwardRef((props, ref) => {
|
|
|
480
480
|
});
|
|
481
481
|
|
|
482
482
|
const _excluded$2 = ["disabled", "error"];
|
|
483
|
-
const Radio = React__namespace.forwardRef((props, ref)
|
|
483
|
+
const Radio = React__namespace.forwardRef(function Radio(props, ref) {
|
|
484
484
|
const {
|
|
485
485
|
disabled = false,
|
|
486
486
|
error = false
|
|
@@ -495,7 +495,7 @@ const Radio = React__namespace.forwardRef((props, ref) => {
|
|
|
495
495
|
});
|
|
496
496
|
|
|
497
497
|
const _excluded$1 = ["checked", "disabled", "onChange", "value", "variant"];
|
|
498
|
-
const Choice = React__namespace.forwardRef((props, ref)
|
|
498
|
+
const Choice = React__namespace.forwardRef(function Choice(props, ref) {
|
|
499
499
|
const {
|
|
500
500
|
checked = false,
|
|
501
501
|
disabled = false,
|
|
@@ -543,7 +543,7 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
543
543
|
|
|
544
544
|
const StyledFieldset$1 = wonderBlocksCore.addStyle("fieldset");
|
|
545
545
|
const StyledLegend$1 = wonderBlocksCore.addStyle("legend");
|
|
546
|
-
const CheckboxGroup = React__namespace.forwardRef((props, ref)
|
|
546
|
+
const CheckboxGroup = React__namespace.forwardRef(function CheckboxGroup(props, ref) {
|
|
547
547
|
const {
|
|
548
548
|
children,
|
|
549
549
|
label,
|
|
@@ -600,7 +600,7 @@ const CheckboxGroup = React__namespace.forwardRef((props, ref) => {
|
|
|
600
600
|
|
|
601
601
|
const StyledFieldset = wonderBlocksCore.addStyle("fieldset");
|
|
602
602
|
const StyledLegend = wonderBlocksCore.addStyle("legend");
|
|
603
|
-
const RadioGroup = React__namespace.forwardRef((props, ref)
|
|
603
|
+
const RadioGroup = React__namespace.forwardRef(function RadioGroup(props, ref) {
|
|
604
604
|
const {
|
|
605
605
|
children,
|
|
606
606
|
label,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-form",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Form components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^3.1.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^3.1.2",
|
|
20
20
|
"@khanacademy/wonder-blocks-color": "^2.0.1",
|
|
21
|
-
"@khanacademy/wonder-blocks-core": "^5.3.
|
|
22
|
-
"@khanacademy/wonder-blocks-icon": "^2.0.
|
|
23
|
-
"@khanacademy/wonder-blocks-layout": "^2.0.
|
|
21
|
+
"@khanacademy/wonder-blocks-core": "^5.3.1",
|
|
22
|
+
"@khanacademy/wonder-blocks-icon": "^2.0.15",
|
|
23
|
+
"@khanacademy/wonder-blocks-layout": "^2.0.15",
|
|
24
24
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
|
|
25
|
-
"@khanacademy/wonder-blocks-typography": "^2.1.
|
|
25
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"aphrodite": "^1.2.5",
|
|
@@ -39,83 +39,77 @@ const indeterminatePath: IconAsset = {
|
|
|
39
39
|
/**
|
|
40
40
|
* The internal stateless ☑️ Checkbox
|
|
41
41
|
*/
|
|
42
|
-
const CheckboxCore = React.forwardRef(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
disabled
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
42
|
+
const CheckboxCore = React.forwardRef(function CheckboxCore(
|
|
43
|
+
props: ChoiceCoreProps,
|
|
44
|
+
ref: React.ForwardedRef<HTMLInputElement>,
|
|
45
|
+
) {
|
|
46
|
+
const {checked, disabled, error, groupName, id, testId, ...sharedProps} =
|
|
47
|
+
props;
|
|
48
|
+
|
|
49
|
+
const innerRef = React.useRef<HTMLInputElement>(null);
|
|
50
|
+
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
// Keep the indeterminate state in sync with the checked prop
|
|
53
|
+
if (innerRef.current != null) {
|
|
54
|
+
innerRef.current.indeterminate = checked == null;
|
|
55
|
+
}
|
|
56
|
+
}, [checked, innerRef]);
|
|
57
|
+
|
|
58
|
+
const handleChange: () => void = () => {
|
|
59
|
+
// Empty because change is handled by ClickableBehavior
|
|
60
|
+
return;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const stateStyles = _generateStyles(checked, error);
|
|
64
|
+
|
|
65
|
+
const defaultStyle = [
|
|
66
|
+
sharedStyles.inputReset,
|
|
67
|
+
sharedStyles.default,
|
|
68
|
+
!disabled && stateStyles.default,
|
|
69
|
+
disabled && sharedStyles.disabled,
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const checkboxIcon = (
|
|
73
|
+
<Icon
|
|
74
|
+
color={disabled ? offBlack32 : white}
|
|
75
|
+
icon={checked ? checkPath : indeterminatePath}
|
|
76
|
+
size="small"
|
|
77
|
+
style={sharedStyles.checkboxIcon}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const ariaChecked = mapCheckedToAriaChecked(checked);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<React.Fragment>
|
|
85
|
+
<StyledInput
|
|
86
|
+
{...sharedProps}
|
|
87
|
+
ref={(node) => {
|
|
88
|
+
// @ts-expect-error: current is not actually read-only
|
|
89
|
+
innerRef.current = node;
|
|
90
|
+
if (typeof ref === "function") {
|
|
91
|
+
ref(node);
|
|
92
|
+
} else if (ref != null) {
|
|
93
|
+
ref.current = node;
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
type="checkbox"
|
|
97
|
+
aria-checked={ariaChecked}
|
|
98
|
+
aria-invalid={error}
|
|
99
|
+
checked={checked ?? undefined}
|
|
100
|
+
disabled={disabled}
|
|
101
|
+
id={id}
|
|
102
|
+
name={groupName}
|
|
103
|
+
// Need to specify because this is a controlled React form
|
|
104
|
+
// component, but we handle the click via ClickableBehavior
|
|
105
|
+
onChange={handleChange}
|
|
106
|
+
style={defaultStyle}
|
|
107
|
+
data-test-id={testId}
|
|
83
108
|
/>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<React.Fragment>
|
|
90
|
-
<StyledInput
|
|
91
|
-
{...sharedProps}
|
|
92
|
-
ref={(node) => {
|
|
93
|
-
// @ts-expect-error: current is not actually read-only
|
|
94
|
-
innerRef.current = node;
|
|
95
|
-
if (typeof ref === "function") {
|
|
96
|
-
ref(node);
|
|
97
|
-
} else if (ref != null) {
|
|
98
|
-
ref.current = node;
|
|
99
|
-
}
|
|
100
|
-
}}
|
|
101
|
-
type="checkbox"
|
|
102
|
-
aria-checked={ariaChecked}
|
|
103
|
-
aria-invalid={error}
|
|
104
|
-
checked={checked ?? undefined}
|
|
105
|
-
disabled={disabled}
|
|
106
|
-
id={id}
|
|
107
|
-
name={groupName}
|
|
108
|
-
// Need to specify because this is a controlled React form
|
|
109
|
-
// component, but we handle the click via ClickableBehavior
|
|
110
|
-
onChange={handleChange}
|
|
111
|
-
style={defaultStyle}
|
|
112
|
-
data-test-id={testId}
|
|
113
|
-
/>
|
|
114
|
-
{checked || checked == null ? checkboxIcon : <></>}
|
|
115
|
-
</React.Fragment>
|
|
116
|
-
);
|
|
117
|
-
},
|
|
118
|
-
);
|
|
109
|
+
{checked || checked == null ? checkboxIcon : <></>}
|
|
110
|
+
</React.Fragment>
|
|
111
|
+
);
|
|
112
|
+
});
|
|
119
113
|
|
|
120
114
|
const size = 16;
|
|
121
115
|
|
|
@@ -95,88 +95,80 @@ const StyledLegend = addStyle("legend");
|
|
|
95
95
|
* </CheckboxGroup>
|
|
96
96
|
* ```
|
|
97
97
|
*/
|
|
98
|
-
const CheckboxGroup = React.forwardRef(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} = props;
|
|
98
|
+
const CheckboxGroup = React.forwardRef(function CheckboxGroup(
|
|
99
|
+
props: CheckboxGroupProps,
|
|
100
|
+
ref: React.ForwardedRef<HTMLFieldSetElement>,
|
|
101
|
+
) {
|
|
102
|
+
const {
|
|
103
|
+
children,
|
|
104
|
+
label,
|
|
105
|
+
description,
|
|
106
|
+
errorMessage,
|
|
107
|
+
groupName,
|
|
108
|
+
onChange,
|
|
109
|
+
selectedValues,
|
|
110
|
+
style,
|
|
111
|
+
testId,
|
|
112
|
+
} = props;
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
const handleChange = (
|
|
115
|
+
changedValue: string,
|
|
116
|
+
originalCheckedState: boolean,
|
|
117
|
+
) => {
|
|
118
|
+
if (originalCheckedState) {
|
|
119
|
+
const index = selectedValues.indexOf(changedValue);
|
|
120
|
+
const updatedSelection = [
|
|
121
|
+
...selectedValues.slice(0, index),
|
|
122
|
+
...selectedValues.slice(index + 1),
|
|
123
|
+
];
|
|
124
|
+
onChange(updatedSelection);
|
|
125
|
+
} else {
|
|
126
|
+
onChange([...selectedValues, changedValue]);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
const allChildren = React.Children.toArray(children).filter(Boolean);
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
{errorMessage}
|
|
154
|
-
</LabelSmall>
|
|
155
|
-
)}
|
|
156
|
-
{(label || description || errorMessage) && (
|
|
157
|
-
<Strut size={Spacing.small_12} />
|
|
158
|
-
)}
|
|
132
|
+
return (
|
|
133
|
+
<StyledFieldset data-test-id={testId} style={styles.fieldset} ref={ref}>
|
|
134
|
+
{/* We have a View here because fieldset cannot be used with flexbox*/}
|
|
135
|
+
<View style={style}>
|
|
136
|
+
{label && (
|
|
137
|
+
<StyledLegend style={styles.legend}>
|
|
138
|
+
<LabelMedium>{label}</LabelMedium>
|
|
139
|
+
</StyledLegend>
|
|
140
|
+
)}
|
|
141
|
+
{description && (
|
|
142
|
+
<LabelSmall style={styles.description}>
|
|
143
|
+
{description}
|
|
144
|
+
</LabelSmall>
|
|
145
|
+
)}
|
|
146
|
+
{errorMessage && (
|
|
147
|
+
<LabelSmall style={styles.error}>{errorMessage}</LabelSmall>
|
|
148
|
+
)}
|
|
149
|
+
{(label || description || errorMessage) && (
|
|
150
|
+
<Strut size={Spacing.small_12} />
|
|
151
|
+
)}
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
153
|
+
{allChildren.map((child, index) => {
|
|
154
|
+
// @ts-expect-error [FEI-5019] - TS2339 - Property 'props' does not exist on type 'ReactChild | ReactFragment | ReactPortal'.
|
|
155
|
+
const {style, value} = child.props;
|
|
156
|
+
const checked = selectedValues.includes(value);
|
|
157
|
+
// @ts-expect-error [FEI-5019] - TS2769 - No overload matches this call.
|
|
158
|
+
return React.cloneElement(child, {
|
|
159
|
+
checked: checked,
|
|
160
|
+
error: !!errorMessage,
|
|
161
|
+
groupName: groupName,
|
|
162
|
+
id: `${groupName}-${value}`,
|
|
163
|
+
key: value,
|
|
164
|
+
onChange: () => handleChange(value, checked),
|
|
165
|
+
style: [index > 0 && styles.defaultLineGap, style],
|
|
166
|
+
variant: "checkbox",
|
|
167
|
+
});
|
|
168
|
+
})}
|
|
169
|
+
</View>
|
|
170
|
+
</StyledFieldset>
|
|
171
|
+
);
|
|
172
|
+
});
|
|
181
173
|
|
|
182
174
|
export default CheckboxGroup;
|
|
@@ -79,23 +79,21 @@ type ChoiceComponentProps = AriaProps & {
|
|
|
79
79
|
* <Checkbox checked={checked} onChange={setChecked} />
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
const Checkbox = React.forwardRef(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const {disabled = false, error = false} = props;
|
|
82
|
+
const Checkbox = React.forwardRef(function Checkbox(
|
|
83
|
+
props: ChoiceComponentProps,
|
|
84
|
+
ref: React.ForwardedRef<HTMLInputElement>,
|
|
85
|
+
) {
|
|
86
|
+
const {disabled = false, error = false} = props;
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
88
|
+
return (
|
|
89
|
+
<ChoiceInternal
|
|
90
|
+
{...props}
|
|
91
|
+
variant="checkbox"
|
|
92
|
+
disabled={disabled}
|
|
93
|
+
error={error}
|
|
94
|
+
ref={ref}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
});
|
|
100
98
|
|
|
101
99
|
export default Checkbox;
|