@fluentui/react-checkbox 9.0.0-beta.5 → 9.0.0-beta.6

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.
Files changed (51) hide show
  1. package/CHANGELOG.json +156 -7
  2. package/CHANGELOG.md +35 -8
  3. package/Spec.md +25 -115
  4. package/dist/react-checkbox.d.ts +31 -27
  5. package/lib/components/Checkbox/Checkbox.d.ts +2 -1
  6. package/lib/components/Checkbox/Checkbox.js +10 -8
  7. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  8. package/lib/components/Checkbox/Checkbox.types.d.ts +25 -20
  9. package/lib/components/Checkbox/renderCheckbox.d.ts +1 -1
  10. package/lib/components/Checkbox/renderCheckbox.js +11 -8
  11. package/lib/components/Checkbox/renderCheckbox.js.map +1 -1
  12. package/lib/components/Checkbox/useCheckbox.d.ts +3 -3
  13. package/lib/components/Checkbox/useCheckbox.js +98 -75
  14. package/lib/components/Checkbox/useCheckbox.js.map +1 -1
  15. package/lib/components/Checkbox/useCheckboxStyles.d.ts +1 -1
  16. package/lib/components/Checkbox/useCheckboxStyles.js +215 -157
  17. package/lib/components/Checkbox/useCheckboxStyles.js.map +1 -1
  18. package/lib-commonjs/Checkbox.js +7 -2
  19. package/lib-commonjs/Checkbox.js.map +1 -1
  20. package/lib-commonjs/components/Checkbox/Checkbox.d.ts +2 -1
  21. package/lib-commonjs/components/Checkbox/Checkbox.js +20 -10
  22. package/lib-commonjs/components/Checkbox/Checkbox.js.map +1 -1
  23. package/lib-commonjs/components/Checkbox/Checkbox.types.d.ts +25 -20
  24. package/lib-commonjs/components/Checkbox/Checkbox.types.js +4 -1
  25. package/lib-commonjs/components/Checkbox/Checkbox.types.js.map +1 -1
  26. package/lib-commonjs/components/Checkbox/index.js +11 -2
  27. package/lib-commonjs/components/Checkbox/index.js.map +1 -1
  28. package/lib-commonjs/components/Checkbox/renderCheckbox.d.ts +1 -1
  29. package/lib-commonjs/components/Checkbox/renderCheckbox.js +23 -13
  30. package/lib-commonjs/components/Checkbox/renderCheckbox.js.map +1 -1
  31. package/lib-commonjs/components/Checkbox/useCheckbox.d.ts +3 -3
  32. package/lib-commonjs/components/Checkbox/useCheckbox.js +112 -80
  33. package/lib-commonjs/components/Checkbox/useCheckbox.js.map +1 -1
  34. package/lib-commonjs/components/Checkbox/useCheckboxStyles.d.ts +1 -1
  35. package/lib-commonjs/components/Checkbox/useCheckboxStyles.js +227 -161
  36. package/lib-commonjs/components/Checkbox/useCheckboxStyles.js.map +1 -1
  37. package/lib-commonjs/index.js +7 -2
  38. package/lib-commonjs/index.js.map +1 -1
  39. package/package.json +11 -10
  40. package/lib/common/isConformant.d.ts +0 -4
  41. package/lib/common/isConformant.js +0 -12
  42. package/lib/common/isConformant.js.map +0 -1
  43. package/lib/components/Checkbox/DefaultIcons.d.ts +0 -4
  44. package/lib/components/Checkbox/DefaultIcons.js +0 -10
  45. package/lib/components/Checkbox/DefaultIcons.js.map +0 -1
  46. package/lib-commonjs/common/isConformant.d.ts +0 -4
  47. package/lib-commonjs/common/isConformant.js +0 -16
  48. package/lib-commonjs/common/isConformant.js.map +0 -1
  49. package/lib-commonjs/components/Checkbox/DefaultIcons.d.ts +0 -4
  50. package/lib-commonjs/components/Checkbox/DefaultIcons.js +0 -17
  51. package/lib-commonjs/components/Checkbox/DefaultIcons.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,156 @@
2
2
  "name": "@fluentui/react-checkbox",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 25 Nov 2021 08:31:31 GMT",
5
+ "date": "Thu, 10 Feb 2022 08:45:10 GMT",
6
+ "tag": "@fluentui/react-checkbox_v9.0.0-beta.6",
7
+ "version": "9.0.0-beta.6",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "Humberto.Morimoto@microsoft.com",
12
+ "package": "@fluentui/react-checkbox",
13
+ "commit": "0bc161458eae5ae8d387172430496ce9829b1bb1",
14
+ "comment": "Using ComponentSlotProps instead of ObjectShorthandProps."
15
+ },
16
+ {
17
+ "author": "Humberto.Morimoto@microsoft.com",
18
+ "package": "@fluentui/react-checkbox",
19
+ "commit": "e0b8e1fa6980077e7b311fd1c72c28d3e4305db0",
20
+ "comment": "Updating based on changes to composition types."
21
+ },
22
+ {
23
+ "author": "olfedias@microsoft.com",
24
+ "package": "@fluentui/react-checkbox",
25
+ "commit": "13ac915a4f18e5b9e79e14bdc239204872abf7f3",
26
+ "comment": "update styles to not use CSS shorthands"
27
+ },
28
+ {
29
+ "author": "behowell@microsoft.com",
30
+ "package": "@fluentui/react-checkbox",
31
+ "commit": "7cc28ed8320b00f42d91c63882f10316db2205c5",
32
+ "comment": "Remove component's shorthandProps array"
33
+ },
34
+ {
35
+ "author": "mgodbolt@microsoft.com",
36
+ "package": "@fluentui/react-checkbox",
37
+ "commit": "839ec14849e112b85aa321d034739ec421199141",
38
+ "comment": "remove export of commons types"
39
+ },
40
+ {
41
+ "author": "olfedias@microsoft.com",
42
+ "package": "@fluentui/react-checkbox",
43
+ "commit": "3e5027e2c8c8b54a2f9f140690bb88d03eafde27",
44
+ "comment": "Replace make-styles packages with griffel equivalents."
45
+ },
46
+ {
47
+ "author": "Humberto.Morimoto@microsoft.com",
48
+ "package": "@fluentui/react-checkbox",
49
+ "commit": "38c8bed2c707014688ae2ae689033fa36ef23075",
50
+ "comment": "Updating packages based on changes to focusIndicator functions to remove functions from makeStyles in @fluentui/react-tabster."
51
+ },
52
+ {
53
+ "author": "behowell@microsoft.com",
54
+ "package": "@fluentui/react-checkbox",
55
+ "commit": "d7d472d3564c7c08465743b2517e4f29428b87b4",
56
+ "comment": "Update checkmark icons and color styles to match visual spec"
57
+ },
58
+ {
59
+ "author": "olfedias@microsoft.com",
60
+ "package": "@fluentui/react-checkbox",
61
+ "commit": "39bddb7a1da57bb1e7073c7eacabb706e25587a5",
62
+ "comment": "fix: update styles to match typings"
63
+ },
64
+ {
65
+ "author": "olfedias@microsoft.com",
66
+ "package": "@fluentui/react-checkbox",
67
+ "commit": "b23239743c4f5518bcf7dcad496a36fc16bbd2e5",
68
+ "comment": "update @fluentui/react-icons package"
69
+ },
70
+ {
71
+ "author": "Humberto.Morimoto@microsoft.com",
72
+ "package": "@fluentui/react-checkbox",
73
+ "commit": "ecca467a89869ec2812b160b26a7f68fa69dac10",
74
+ "comment": "Replacing use of functions in makeStyles with direct use of tokens."
75
+ },
76
+ {
77
+ "author": "lingfangao@hotmail.com",
78
+ "package": "@fluentui/react-checkbox",
79
+ "commit": "c00913d50e2dd15bbfbb0757cefe43b192ff1d7f",
80
+ "comment": "Bump Fluent UI dependencies to 9.0.0-rc"
81
+ },
82
+ {
83
+ "author": "behowell@microsoft.com",
84
+ "package": "@fluentui/react-checkbox",
85
+ "commit": "317209bb5cd57c40f35bc42060acb7e3cce5ec95",
86
+ "comment": "BREAKING: Rename component hooks add the suffix _unstable, as their API has not been finalized yet"
87
+ },
88
+ {
89
+ "author": "behowell@microsoft.com",
90
+ "package": "@fluentui/react-checkbox",
91
+ "commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
92
+ "comment": "Refactor component Slot typings"
93
+ },
94
+ {
95
+ "author": "behowell@microsoft.com",
96
+ "package": "@fluentui/react-checkbox",
97
+ "commit": "f1be0a9728e05ca33ad67e77ae7d1cba3384106f",
98
+ "comment": "Refactor Checkbox to use label as a slot instead of being the root"
99
+ },
100
+ {
101
+ "author": "beachball",
102
+ "package": "@fluentui/react-checkbox",
103
+ "comment": "Bump @fluentui/react-label to v9.0.0-beta.5",
104
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
105
+ },
106
+ {
107
+ "author": "beachball",
108
+ "package": "@fluentui/react-checkbox",
109
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.1",
110
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
111
+ },
112
+ {
113
+ "author": "beachball",
114
+ "package": "@fluentui/react-checkbox",
115
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
116
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
117
+ },
118
+ {
119
+ "author": "beachball",
120
+ "package": "@fluentui/react-checkbox",
121
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1",
122
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
123
+ }
124
+ ],
125
+ "none": [
126
+ {
127
+ "author": "tkrasniqi@microsoft.com",
128
+ "package": "@fluentui/react-checkbox",
129
+ "commit": "401cdabeffb7985d88e5789faf75a93de1fb46f2",
130
+ "comment": "Migration to new dx: ts style config"
131
+ },
132
+ {
133
+ "author": "martinhochel@microsoft.com",
134
+ "package": "@fluentui/react-checkbox",
135
+ "commit": "8dfa712156b70414205b87b5b6d099367b0c297d",
136
+ "comment": "chore: use storybook runner for all vNext packages"
137
+ },
138
+ {
139
+ "author": "bsunderhus@microsoft.com",
140
+ "package": "@fluentui/react-checkbox",
141
+ "commit": "c0d4e63ee58e60e2c6674efbacc0783cd520984e",
142
+ "comment": "Updates components with nullRender changes"
143
+ },
144
+ {
145
+ "author": "olfedias@microsoft.com",
146
+ "package": "@fluentui/react-checkbox",
147
+ "commit": "c061e98be4b4a718c72a144a1f60bb5515824612",
148
+ "comment": "remove inline-style-expand-shorthand from tsconfigs"
149
+ }
150
+ ]
151
+ }
152
+ },
153
+ {
154
+ "date": "Thu, 25 Nov 2021 08:34:13 GMT",
6
155
  "tag": "@fluentui/react-checkbox_v9.0.0-beta.5",
7
156
  "version": "9.0.0-beta.5",
8
157
  "comments": {
@@ -17,37 +166,37 @@
17
166
  "author": "beachball",
18
167
  "package": "@fluentui/react-checkbox",
19
168
  "comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.4",
20
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
169
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
21
170
  },
22
171
  {
23
172
  "author": "beachball",
24
173
  "package": "@fluentui/react-checkbox",
25
174
  "comment": "Bump @fluentui/react-utilities to v9.0.0-beta.4",
26
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
175
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
27
176
  },
28
177
  {
29
178
  "author": "beachball",
30
179
  "package": "@fluentui/react-checkbox",
31
180
  "comment": "Bump @fluentui/react-label to v9.0.0-beta.4",
32
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
181
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
33
182
  },
34
183
  {
35
184
  "author": "beachball",
36
185
  "package": "@fluentui/react-checkbox",
37
186
  "comment": "Bump @fluentui/react-tabster to v9.0.0-beta.5",
38
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
187
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
39
188
  },
40
189
  {
41
190
  "author": "beachball",
42
191
  "package": "@fluentui/react-checkbox",
43
192
  "comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4",
44
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
193
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
45
194
  },
46
195
  {
47
196
  "author": "beachball",
48
197
  "package": "@fluentui/react-checkbox",
49
198
  "comment": "Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.4",
50
- "commit": "281e8820669214c1ffb9bc75e9b719a3b27fa9b6"
199
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
51
200
  }
52
201
  ]
53
202
  }
package/CHANGELOG.md CHANGED
@@ -1,23 +1,50 @@
1
1
  # Change Log - @fluentui/react-checkbox
2
2
 
3
- This log was last generated on Thu, 25 Nov 2021 08:31:31 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 10 Feb 2022 08:45:10 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.0-beta.6)
8
+
9
+ Thu, 10 Feb 2022 08:45:10 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.0.0-beta.5..@fluentui/react-checkbox_v9.0.0-beta.6)
11
+
12
+ ### Changes
13
+
14
+ - Using ComponentSlotProps instead of ObjectShorthandProps. ([PR #20890](https://github.com/microsoft/fluentui/pull/20890) by Humberto.Morimoto@microsoft.com)
15
+ - Updating based on changes to composition types. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
16
+ - update styles to not use CSS shorthands ([PR #20816](https://github.com/microsoft/fluentui/pull/20816) by olfedias@microsoft.com)
17
+ - Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
18
+ - remove export of commons types ([PR #21660](https://github.com/microsoft/fluentui/pull/21660) by mgodbolt@microsoft.com)
19
+ - Replace make-styles packages with griffel equivalents. ([PR #21435](https://github.com/microsoft/fluentui/pull/21435) by olfedias@microsoft.com)
20
+ - Updating packages based on changes to focusIndicator functions to remove functions from makeStyles in @fluentui/react-tabster. ([PR #21035](https://github.com/microsoft/fluentui/pull/21035) by Humberto.Morimoto@microsoft.com)
21
+ - Update checkmark icons and color styles to match visual spec ([PR #21011](https://github.com/microsoft/fluentui/pull/21011) by behowell@microsoft.com)
22
+ - fix: update styles to match typings ([PR #20539](https://github.com/microsoft/fluentui/pull/20539) by olfedias@microsoft.com)
23
+ - update @fluentui/react-icons package ([PR #21498](https://github.com/microsoft/fluentui/pull/21498) by olfedias@microsoft.com)
24
+ - Replacing use of functions in makeStyles with direct use of tokens. ([PR #21041](https://github.com/microsoft/fluentui/pull/21041) by Humberto.Morimoto@microsoft.com)
25
+ - Bump Fluent UI dependencies to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
26
+ - BREAKING: Rename component hooks add the suffix _unstable, as their API has not been finalized yet ([PR #21365](https://github.com/microsoft/fluentui/pull/21365) by behowell@microsoft.com)
27
+ - Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
28
+ - Refactor Checkbox to use label as a slot instead of being the root ([PR #20904](https://github.com/microsoft/fluentui/pull/20904) by behowell@microsoft.com)
29
+ - Bump @fluentui/react-label to v9.0.0-beta.5 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
30
+ - Bump @fluentui/react-tabster to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
31
+ - Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
32
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
33
+
7
34
  ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.0-beta.5)
8
35
 
9
- Thu, 25 Nov 2021 08:31:31 GMT
36
+ Thu, 25 Nov 2021 08:34:13 GMT
10
37
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.0.0-beta.4..@fluentui/react-checkbox_v9.0.0-beta.5)
11
38
 
12
39
  ### Changes
13
40
 
14
41
  - Implement primary slot: 'input' is now the primary slot and receives native props passed to Checkbox ([PR #20617](https://github.com/microsoft/fluentui/pull/20617) by behowell@microsoft.com)
15
- - Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
16
- - Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
17
- - Bump @fluentui/react-label to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
18
- - Bump @fluentui/react-tabster to v9.0.0-beta.5 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
19
- - Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
20
- - Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.4 ([PR #20609](https://github.com/microsoft/fluentui/pull/20609) by beachball)
42
+ - Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
43
+ - Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
44
+ - Bump @fluentui/react-label to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
45
+ - Bump @fluentui/react-tabster to v9.0.0-beta.5 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
46
+ - Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
47
+ - Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
21
48
 
22
49
  ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.0-beta.4)
23
50
 
package/Spec.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Background
4
4
 
5
- Checkboxes are used to represent one or more options, giving the user a way to select one or more of these options.
5
+ Checkboxes give people a way to select one or more items from a group, or switch between
6
+ two mutually exclusive options (checked or unchecked).
6
7
 
7
8
  ## Prior Art
8
9
 
@@ -124,98 +125,21 @@ Component props:
124
125
 
125
126
  ### Checkbox Props
126
127
 
127
- ```tsx
128
- /**
129
- * Checkbox Props
130
- */
131
- export interface CheckboxProps
132
- extends Omit<ComponentPropsCompat, 'children'>,
133
- Omit<React.HTMLAttributes<HTMLElement>, 'defaultChecked'> {
134
- /**
135
- * Label that will be rendered next to the input.
136
- */
137
- label?: ShorthandProps<LabelProps>;
138
-
139
- /**
140
- * Indicator to be rendered as the checkbox icon.
141
- */
142
- indicator?: ShorthandProps<ComponentPropsCompat>;
143
-
144
- /**
145
- * Hidden input that handles the checkbox's functionality.
146
- */
147
- input?: ShorthandProps<React.InputHTMLAttributes<HTMLInputElement> & { ref: React.RefObject<HTMLInputElement> }>;
148
-
149
- /**
150
- * Disabled state of the checkbox.
151
- */
152
- disabled?: boolean;
153
-
154
- /**
155
- * Required state of the checkbox.
156
- */
157
- required?: boolean;
158
-
159
- /**
160
- * A checkbox can be rendered with a circular shape.
161
- */
162
- circular?: boolean;
163
-
164
- /**
165
- * A checkbox's state can be controlled.
166
- * @defaultvalue false
167
- */
168
- checked?: 'mixed' | boolean;
169
-
170
- /**
171
- * Whether the checkbox should be rendered as checked by default.
172
- */
173
- defaultChecked?: 'mixed' | boolean;
174
-
175
- /**
176
- * Checkbox supports two different checkbox sizes.
177
- * @defaultvalue 'medium'
178
- */
179
- size?: 'medium' | 'large';
180
-
181
- /**
182
- * Determines whether the label should be positioned before or after the checkbox.
183
- * @defaultvalue 'after'
184
- */
185
- labelPosition?: 'before' | 'after';
186
-
187
- /**
188
- * ID of the root element that wraps the checkbox and label.
189
- */
190
- rootId?: string;
191
-
192
- /**
193
- * ID of the native element that represents the checkbox.
194
- */
195
- id?: string;
196
-
197
- /**
198
- * Callback to be called when the checked state value changes.
199
- */
200
- onChange?: (ev?: React.FormEvent<HTMLElement | HTMLInputElement>, data?: CheckboxOnChangeData) => void;
201
- }
202
-
203
- /**
204
- * Data for the onChange event for checkbox.
205
- */
206
- export interface CheckboxOnChangeData {
207
- checked?: 'mixed' | boolean;
208
- }
209
- ```
128
+ See [Checkbox.types.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-checkbox/src/components/Checkbox/Checkbox.types.ts)
210
129
 
211
130
  ## Structure
212
131
 
213
- - The icon that will be used to represent the Checkbox's state is a slot to allow customization of the icons. This means that if a user were to customize the icons that will appear, the user will have to handle both icons based on the state.
214
- - The input element will be a slot to allow for customization.
132
+ ### Slots
133
+
134
+ - `root`: Outermost `<span>` that contains the rest of the slots
135
+ - `input`: The HTML `<input type="checkbox">`. This is the **primary** slot: it receives all of the native props passed to the
136
+ Checkbox component. It has opacity 0 and overlaps the entire `root` slot, for hit testing.
137
+ - `indicator`: A `<div>` that is the visual representation of the check "box". Its child is the checkmark icon.
138
+ - `label`: (optional) The `<label>` describing this checkbox.
215
139
 
216
140
  ### **Public**
217
141
 
218
- ```html
142
+ ```jsx
219
143
  <Checkbox label="Example Checkbox" />
220
144
  ```
221
145
 
@@ -223,31 +147,23 @@ export interface CheckboxOnChangeData {
223
147
 
224
148
  ```tsx
225
149
  <slots.root {...slotProps.root}>
226
- {state.labelPosition === 'start' && <slots.label {...slotProps.label} />}
227
- <div className={state.checkboxClassName}>
228
- <slots.indicator {...slotProps.indicator} />
229
- <slots.input {...slotProps.input} />
230
- </div>
231
- {state.labelPosition === 'end' && <slots.label {...slotProps.label} />}
150
+ {state.labelPosition === 'before' && <slots.label {...slotProps.label} />}
151
+ <slots.indicator {...slotProps.indicator} />
152
+ <slots.input {...slotProps.input} />
153
+ {state.labelPosition === 'after' && <slots.label {...slotProps.label} />}
232
154
  </slots.root>
233
155
  ```
234
156
 
235
157
  ### **DOM**
236
158
 
237
- In this case, the label position is set to end as per default.
238
-
239
159
  ```html
240
- <div {/* Root Element */}>
241
- <div {/* Checkbox */}>
242
- <div {/* indicator */}>
243
- ...indicator
244
- </div>
245
- <input id="cbox-1" ...props />
160
+ <span class="fui-Checkbox root">
161
+ <div aria-hidden="true" class="indicator">
162
+ <CheckmarkRegular />
246
163
  </div>
247
- <label for="cbox-1" ...props>
248
- Example Checkbox
249
- </label>
250
- </div>
164
+ <input type="checkbox" id="checkbox-1" class="input" />
165
+ <label for="checkbox-1" className="label">Example Checkbox</label>
166
+ </span>
251
167
  ```
252
168
 
253
169
  ## Migration
@@ -256,17 +172,11 @@ See [MIGRATION.md](MIGRATION.md)
256
172
 
257
173
  ## Behaviors
258
174
 
259
- - Keyboard
260
- - When checkbox is focused, if `space` is pressed the checkbox's state is toggled.
261
- - Cursor
262
- - When clicked the checkbox's state is toggled.
263
- - Focus
264
- - A checkbox can be focused to interact with it using `space`.
265
- - In case of a label having a link or information button, items inside the label may be focused.
175
+ - Checkbox inherits all of its mouse and keyboard behaviors from the native `<input type="checkbox">`. It has no special handling of clicks or keypresses for toggling beyond the native control.
176
+ - In case of a label having a link or information button, items inside the label may be focused.
266
177
 
267
178
  ## Accessibility
268
179
 
269
180
  - Aria design pattern: [Checkbox](https://www.w3.org/TR/wai-aria-practices-1.2/#checkbox).
270
- - If a label is used with the checkbox, an `aria-label` will be set on the `input` element.
271
- - Checkbox will have a tri-state `aria-checked`.
272
- - Elements inside the checkbox's label can be focused if there are elements such as links and info buttons.
181
+ - Checkbox uses a standard HTML `<input type="checkbox">` and does not require any additional aria attributes on the input element.
182
+ - The checkmark indicator has `aria-hidden="true"`, as it is purely a visual representation of the state of the underlying input.
@@ -1,23 +1,26 @@
1
1
  import { ComponentProps } from '@fluentui/react-utilities';
2
2
  import { ComponentState } from '@fluentui/react-utilities';
3
3
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
- import { IntrinsicShorthandProps } from '@fluentui/react-utilities';
5
- import { LabelProps } from '@fluentui/react-label';
6
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
4
+ import { Label } from '@fluentui/react-label';
7
5
  import * as React_2 from 'react';
6
+ import { Slot } from '@fluentui/react-utilities';
8
7
 
9
8
  /**
10
- * A Checkbox component provides a way to represent options that can be selected
9
+ * Checkboxes give people a way to select one or more items from a group,
10
+ * or switch between two mutually exclusive options (checked or unchecked).
11
11
  */
12
12
  export declare const Checkbox: ForwardRefComponent<CheckboxProps>;
13
13
 
14
14
  export declare const checkboxClassName = "fui-Checkbox";
15
15
 
16
- export declare interface CheckboxCommons {
16
+ declare interface CheckboxCommons {
17
17
  /**
18
- * A checkbox can be rendered with a circular shape.
18
+ * Whether to render the checkbox in a circular shape instead of square.
19
+ * This variant is only recommended to be used in a tasks-style UI (checklist),
20
+ * since it otherwise could be confused for a `RadioItem`.
21
+ * @defaultvalue false
19
22
  */
20
- circular: boolean | undefined;
23
+ circular: boolean;
21
24
  /**
22
25
  * A checkbox's state can be controlled.
23
26
  * @defaultvalue false
@@ -25,19 +28,14 @@ export declare interface CheckboxCommons {
25
28
  checked: 'mixed' | boolean;
26
29
  /**
27
30
  * Checkbox supports two different checkbox sizes.
28
- * @defaultvalue 'medium'
31
+ * @defaultvalue medium
29
32
  */
30
33
  size: 'medium' | 'large';
31
34
  /**
32
35
  * Determines whether the label should be positioned before or after the checkbox.
33
- * @defaultvalue 'after'
36
+ * @defaultvalue after
34
37
  */
35
38
  labelPosition: 'before' | 'after';
36
- /**
37
- * Field required to pass className to container instead of input
38
- * this will be solved by https://github.com/microsoft/fluentui/pull/18983
39
- */
40
- containerClassName?: string;
41
39
  }
42
40
 
43
41
  /**
@@ -50,7 +48,11 @@ export declare interface CheckboxOnChangeData {
50
48
  /**
51
49
  * Checkbox Props
52
50
  */
53
- export declare type CheckboxProps = Omit<ComponentProps<CheckboxSlots, 'input'>, 'size' | 'checked' | 'defaultChecked'> & Partial<CheckboxCommons> & {
51
+ export declare type CheckboxProps = Omit<ComponentProps<Partial<CheckboxSlots>, 'input'>, 'size' | 'checked' | 'defaultChecked' | 'onChange'> & Partial<CheckboxCommons> & {
52
+ /**
53
+ * Checkboxes don't support children. To add a label, use the `label` prop.
54
+ */
55
+ children?: never;
54
56
  /**
55
57
  * Callback to be called when the checked state value changes.
56
58
  */
@@ -63,48 +65,50 @@ export declare type CheckboxProps = Omit<ComponentProps<CheckboxSlots, 'input'>,
63
65
 
64
66
  export declare type CheckboxSlots = {
65
67
  /**
66
- * The root element of the checkbox is its `<label>`.
68
+ * The root element of the Checkbox.
67
69
  *
68
70
  * The root slot receives the `className` and `style` specified directly on the `<Checkbox>`.
69
71
  * All other native props will be applied to the primary slot: `input`
70
72
  */
71
- root: ObjectShorthandProps<LabelProps> | IntrinsicShorthandProps<'span'>;
73
+ root: NonNullable<Slot<'span'>>;
74
+ /**
75
+ * The Checkbox's label.
76
+ */
77
+ label?: Slot<typeof Label>;
72
78
  /**
73
79
  * Hidden input that handles the checkbox's functionality.
74
80
  *
75
81
  * This is the PRIMARY slot: all native properties specified directly on `<Checkbox>` will be applied to this slot,
76
82
  * except `className` and `style`, which remain on the root slot.
77
83
  */
78
- input: IntrinsicShorthandProps<'input'>;
84
+ input: NonNullable<Slot<'input'>>;
79
85
  /**
80
86
  * Renders the checkbox, with the checkmark icon as its child when checked.
81
87
  */
82
- indicator: IntrinsicShorthandProps<'div'>;
88
+ indicator: Slot<'div'>;
83
89
  };
84
90
 
85
91
  /**
86
92
  * State used in rendering Checkbox
87
93
  */
88
- export declare type CheckboxState = ComponentState<CheckboxSlots> & CheckboxCommons & {
89
- hasLabel: boolean;
90
- };
94
+ export declare type CheckboxState = ComponentState<CheckboxSlots> & CheckboxCommons;
91
95
 
92
- export declare const renderCheckbox: (state: CheckboxState) => JSX.Element;
96
+ export declare const renderCheckbox_unstable: (state: CheckboxState) => JSX.Element;
93
97
 
94
98
  /**
95
99
  * Create the state required to render Checkbox.
96
100
  *
97
- * The returned state can be modified with hooks such as useCheckboxStyles,
98
- * before being passed to renderCheckbox.
101
+ * The returned state can be modified with hooks such as useCheckboxStyles_unstable,
102
+ * before being passed to renderCheckbox_unstable.
99
103
  *
100
104
  * @param props - props from this instance of Checkbox
101
105
  * @param ref - reference to `<input>` element of Checkbox
102
106
  */
103
- export declare const useCheckbox: (props: CheckboxProps, ref: React_2.Ref<HTMLInputElement>) => CheckboxState;
107
+ export declare const useCheckbox_unstable: (props: CheckboxProps, ref: React_2.Ref<HTMLInputElement>) => CheckboxState;
104
108
 
105
109
  /**
106
110
  * Apply styling to the Checkbox slots based on the state
107
111
  */
108
- export declare const useCheckboxStyles: (state: CheckboxState) => CheckboxState;
112
+ export declare const useCheckboxStyles_unstable: (state: CheckboxState) => CheckboxState;
109
113
 
110
114
  export { }
@@ -1,6 +1,7 @@
1
1
  import type { CheckboxProps } from './Checkbox.types';
2
2
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
3
  /**
4
- * A Checkbox component provides a way to represent options that can be selected
4
+ * Checkboxes give people a way to select one or more items from a group,
5
+ * or switch between two mutually exclusive options (checked or unchecked).
5
6
  */
6
7
  export declare const Checkbox: ForwardRefComponent<CheckboxProps>;
@@ -1,14 +1,16 @@
1
1
  import * as React from 'react';
2
- import { useCheckbox } from './useCheckbox';
3
- import { renderCheckbox } from './renderCheckbox';
4
- import { useCheckboxStyles } from './useCheckboxStyles';
2
+ import { useCheckbox_unstable } from './useCheckbox';
3
+ import { renderCheckbox_unstable } from './renderCheckbox';
4
+ import { useCheckboxStyles_unstable } from './useCheckboxStyles';
5
5
  /**
6
- * A Checkbox component provides a way to represent options that can be selected
6
+ * Checkboxes give people a way to select one or more items from a group,
7
+ * or switch between two mutually exclusive options (checked or unchecked).
7
8
  */
8
- export const Checkbox = React.forwardRef((props, ref) => {
9
- const state = useCheckbox(props, ref);
10
- useCheckboxStyles(state);
11
- return renderCheckbox(state);
9
+
10
+ export const Checkbox = /*#__PURE__*/React.forwardRef((props, ref) => {
11
+ const state = useCheckbox_unstable(props, ref);
12
+ useCheckboxStyles_unstable(state);
13
+ return renderCheckbox_unstable(state);
12
14
  });
13
15
  Checkbox.displayName = 'Checkbox';
14
16
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1F,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEtC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,QAAqC,eAArC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;;AAGG;;AACH,OAAO,MAAM,QAAQ,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC1F,QAAM,KAAK,GAAG,oBAAoB,CAAC,KAAD,EAAQ,GAAR,CAAlC;AAEA,EAAA,0BAA0B,CAAC,KAAD,CAA1B;AACA,SAAO,uBAAuB,CAAC,KAAD,CAA9B;AACD,CAL2D,CAArD;AAOP,QAAQ,CAAC,WAAT,GAAuB,UAAvB","sourceRoot":""}