@fluentui/react-radio 9.0.0-beta.4 → 9.0.0-rc.3

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 (76) hide show
  1. package/CHANGELOG.json +216 -1
  2. package/CHANGELOG.md +64 -10
  3. package/README.md +43 -0
  4. package/dist/{react-radio.d.ts → index.d.ts} +17 -8
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/components/Radio/Radio.types.js.map +1 -1
  7. package/lib/components/Radio/useRadio.js +15 -9
  8. package/lib/components/Radio/useRadio.js.map +1 -1
  9. package/lib/components/Radio/useRadioStyles.js +15 -18
  10. package/lib/components/Radio/useRadioStyles.js.map +1 -1
  11. package/lib/components/RadioGroup/RadioGroup.js +3 -1
  12. package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
  13. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
  14. package/lib/components/RadioGroup/renderRadioGroup.js +2 -2
  15. package/lib/components/RadioGroup/renderRadioGroup.js.map +1 -1
  16. package/lib/components/RadioGroup/useRadioGroup.js +7 -9
  17. package/lib/components/RadioGroup/useRadioGroup.js.map +1 -1
  18. package/lib/contexts/RadioGroupContext.js +2 -2
  19. package/lib/contexts/RadioGroupContext.js.map +1 -1
  20. package/lib/contexts/index.js +3 -0
  21. package/lib/contexts/index.js.map +1 -0
  22. package/lib/contexts/useRadioGroupContextValues.js +22 -0
  23. package/lib/contexts/useRadioGroupContextValues.js.map +1 -0
  24. package/lib/index.js +1 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib-commonjs/components/Radio/useRadio.js +16 -9
  27. package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
  28. package/lib-commonjs/components/Radio/useRadioStyles.js +15 -18
  29. package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -1
  30. package/lib-commonjs/components/RadioGroup/RadioGroup.js +4 -1
  31. package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -1
  32. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js +2 -2
  33. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -1
  34. package/lib-commonjs/components/RadioGroup/useRadioGroup.js +7 -10
  35. package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -1
  36. package/lib-commonjs/contexts/RadioGroupContext.js +2 -2
  37. package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
  38. package/lib-commonjs/contexts/index.js +12 -0
  39. package/lib-commonjs/contexts/index.js.map +1 -0
  40. package/lib-commonjs/contexts/useRadioGroupContextValues.js +31 -0
  41. package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -0
  42. package/lib-commonjs/index.js +9 -3
  43. package/lib-commonjs/index.js.map +1 -1
  44. package/package.json +12 -10
  45. package/lib/Radio.d.ts +0 -1
  46. package/lib/RadioGroup.d.ts +0 -1
  47. package/lib/components/Radio/Radio.d.ts +0 -6
  48. package/lib/components/Radio/Radio.types.d.ts +0 -69
  49. package/lib/components/Radio/index.d.ts +0 -5
  50. package/lib/components/Radio/renderRadio.d.ts +0 -5
  51. package/lib/components/Radio/useRadio.d.ts +0 -12
  52. package/lib/components/Radio/useRadioStyles.d.ts +0 -11
  53. package/lib/components/RadioGroup/RadioGroup.d.ts +0 -6
  54. package/lib/components/RadioGroup/RadioGroup.types.d.ts +0 -58
  55. package/lib/components/RadioGroup/index.d.ts +0 -5
  56. package/lib/components/RadioGroup/renderRadioGroup.d.ts +0 -5
  57. package/lib/components/RadioGroup/useRadioGroup.d.ts +0 -12
  58. package/lib/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
  59. package/lib/contexts/RadioGroupContext.d.ts +0 -7
  60. package/lib/index.d.ts +0 -6
  61. package/lib-commonjs/Radio.d.ts +0 -1
  62. package/lib-commonjs/RadioGroup.d.ts +0 -1
  63. package/lib-commonjs/components/Radio/Radio.d.ts +0 -6
  64. package/lib-commonjs/components/Radio/Radio.types.d.ts +0 -69
  65. package/lib-commonjs/components/Radio/index.d.ts +0 -5
  66. package/lib-commonjs/components/Radio/renderRadio.d.ts +0 -5
  67. package/lib-commonjs/components/Radio/useRadio.d.ts +0 -12
  68. package/lib-commonjs/components/Radio/useRadioStyles.d.ts +0 -11
  69. package/lib-commonjs/components/RadioGroup/RadioGroup.d.ts +0 -6
  70. package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +0 -58
  71. package/lib-commonjs/components/RadioGroup/index.d.ts +0 -5
  72. package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +0 -5
  73. package/lib-commonjs/components/RadioGroup/useRadioGroup.d.ts +0 -12
  74. package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
  75. package/lib-commonjs/contexts/RadioGroupContext.d.ts +0 -7
  76. package/lib-commonjs/index.d.ts +0 -6
package/CHANGELOG.json CHANGED
@@ -2,7 +2,222 @@
2
2
  "name": "@fluentui/react-radio",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 25 Apr 2022 09:31:20 GMT",
5
+ "date": "Mon, 23 May 2022 12:10:01 GMT",
6
+ "tag": "@fluentui/react-radio_v9.0.0-rc.3",
7
+ "version": "9.0.0-rc.3",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-radio",
13
+ "commit": "eb1084fd607c0d1086f9d465168be5822daa5e40",
14
+ "comment": "feat: ship rolluped only dts"
15
+ },
16
+ {
17
+ "author": "olfedias@microsoft.com",
18
+ "package": "@fluentui/react-radio",
19
+ "commit": "60804cec07a495b8a5d1fc66338bf0443b212144",
20
+ "comment": "chore: Update Griffel to latest version"
21
+ },
22
+ {
23
+ "author": "behowell@microsoft.com",
24
+ "package": "@fluentui/react-radio",
25
+ "commit": "c0b27cce0d29122e4488ff431689b966076a728b",
26
+ "comment": "Replace hardcoded padding with spacing tokens"
27
+ },
28
+ {
29
+ "author": "olfedias@microsoft.com",
30
+ "package": "@fluentui/react-radio",
31
+ "commit": "f120fe9160ad7311a87af0cfacd8d2fb26275e34",
32
+ "comment": "chore: Update Griffel to latest version"
33
+ },
34
+ {
35
+ "author": "behowell@microsoft.com",
36
+ "package": "@fluentui/react-radio",
37
+ "commit": "2ea15d322e01dc6055378f4f0f5f3febf7910f80",
38
+ "comment": "Refactor styles to remove usage of flex gap"
39
+ },
40
+ {
41
+ "author": "esteban.230@hotmail.com",
42
+ "package": "@fluentui/react-radio",
43
+ "commit": "0fac2d7a6f35c5fcebaf30da68b9604410fe0eb9",
44
+ "comment": "Updated react-label package version to RC."
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-radio",
49
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.9",
50
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-radio",
55
+ "comment": "Bump @fluentui/react-label to v9.0.0-rc.2",
56
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-radio",
61
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.10",
62
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@fluentui/react-radio",
67
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.8",
68
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "@fluentui/react-radio",
73
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
74
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
75
+ },
76
+ {
77
+ "author": "beachball",
78
+ "package": "@fluentui/react-radio",
79
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6",
80
+ "commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "date": "Thu, 05 May 2022 18:26:25 GMT",
87
+ "tag": "@fluentui/react-radio_v9.0.0-rc.2",
88
+ "version": "9.0.0-rc.2",
89
+ "comments": {
90
+ "none": [
91
+ {
92
+ "author": "tristan.watanabe@gmail.com",
93
+ "package": "@fluentui/react-radio",
94
+ "commit": "ad3dfcc6d85a8dba3c183612fe552280cd33c20e",
95
+ "comment": "react-radio: Move to new common folder."
96
+ }
97
+ ],
98
+ "prerelease": [
99
+ {
100
+ "author": "seanmonahan@microsoft.com",
101
+ "package": "@fluentui/react-radio",
102
+ "commit": "f628da463f8a12f39e32785e086ef7a2687275f6",
103
+ "comment": "update README"
104
+ },
105
+ {
106
+ "author": "beachball",
107
+ "package": "@fluentui/react-radio",
108
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.8",
109
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
110
+ },
111
+ {
112
+ "author": "beachball",
113
+ "package": "@fluentui/react-radio",
114
+ "comment": "Bump @fluentui/react-label to v9.0.0-beta.12",
115
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
116
+ },
117
+ {
118
+ "author": "beachball",
119
+ "package": "@fluentui/react-radio",
120
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.9",
121
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
122
+ },
123
+ {
124
+ "author": "beachball",
125
+ "package": "@fluentui/react-radio",
126
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.7",
127
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
128
+ },
129
+ {
130
+ "author": "beachball",
131
+ "package": "@fluentui/react-radio",
132
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.8",
133
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
134
+ },
135
+ {
136
+ "author": "beachball",
137
+ "package": "@fluentui/react-radio",
138
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.5",
139
+ "commit": "c5abb9c480ac94d12aa644d68d30773d77f2a159"
140
+ }
141
+ ]
142
+ }
143
+ },
144
+ {
145
+ "date": "Wed, 04 May 2022 13:26:48 GMT",
146
+ "tag": "@fluentui/react-radio_v9.0.0-beta.5",
147
+ "version": "9.0.0-beta.5",
148
+ "comments": {
149
+ "prerelease": [
150
+ {
151
+ "author": "seanmonahan@microsoft.com",
152
+ "package": "@fluentui/react-radio",
153
+ "commit": "9132814df4b6d40d1f5d93d8324d756c1284b294",
154
+ "comment": "react-radio: update context usage"
155
+ },
156
+ {
157
+ "author": "seanmonahan@microsoft.com",
158
+ "package": "@fluentui/react-radio",
159
+ "commit": "8d990349b5af2d61057cccda2357412d2f5ab9b9",
160
+ "comment": "add bundle size fixtures"
161
+ },
162
+ {
163
+ "author": "seanmonahan@microsoft.com",
164
+ "package": "@fluentui/react-radio",
165
+ "commit": "6a017c3b1f2a282fa86c28b675e5ed34a1bb2aee",
166
+ "comment": "react-radio: add required prop to RadioGroup"
167
+ },
168
+ {
169
+ "author": "seanmonahan@microsoft.com",
170
+ "package": "@fluentui/react-radio",
171
+ "commit": "4bc1c43194cb9f44c5ad40ae43ab26556778157e",
172
+ "comment": "react-radio: remove required indicator from label"
173
+ },
174
+ {
175
+ "author": "seanmonahan@microsoft.com",
176
+ "package": "@fluentui/react-radio",
177
+ "commit": "5f27c51743f22f08741a75c2c10032a02afdf6fb",
178
+ "comment": "write readme"
179
+ },
180
+ {
181
+ "author": "miroslav.stastny@microsoft.com",
182
+ "package": "@fluentui/react-radio",
183
+ "commit": "3be7a89d9e9323780bba5b24d3bcc4342e1f1ec7",
184
+ "comment": "Allow data argument on onChange"
185
+ },
186
+ {
187
+ "author": "beachball",
188
+ "package": "@fluentui/react-radio",
189
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.7",
190
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
191
+ },
192
+ {
193
+ "author": "beachball",
194
+ "package": "@fluentui/react-radio",
195
+ "comment": "Bump @fluentui/react-label to v9.0.0-beta.11",
196
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
197
+ },
198
+ {
199
+ "author": "beachball",
200
+ "package": "@fluentui/react-radio",
201
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.8",
202
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
203
+ },
204
+ {
205
+ "author": "beachball",
206
+ "package": "@fluentui/react-radio",
207
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.6",
208
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
209
+ },
210
+ {
211
+ "author": "beachball",
212
+ "package": "@fluentui/react-radio",
213
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.7",
214
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
215
+ }
216
+ ]
217
+ }
218
+ },
219
+ {
220
+ "date": "Mon, 25 Apr 2022 09:32:19 GMT",
6
221
  "tag": "@fluentui/react-radio_v9.0.0-beta.4",
7
222
  "version": "9.0.0-beta.4",
8
223
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,66 @@
1
1
  # Change Log - @fluentui/react-radio
2
2
 
3
- This log was last generated on Mon, 25 Apr 2022 09:31:20 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 23 May 2022 12:10:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.3)
8
+
9
+ Mon, 23 May 2022 12:10:01 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-rc.2..@fluentui/react-radio_v9.0.0-rc.3)
11
+
12
+ ### Changes
13
+
14
+ - feat: ship rolluped only dts ([PR #22874](https://github.com/microsoft/fluentui/pull/22874) by martinhochel@microsoft.com)
15
+ - chore: Update Griffel to latest version ([PR #23029](https://github.com/microsoft/fluentui/pull/23029) by olfedias@microsoft.com)
16
+ - Replace hardcoded padding with spacing tokens ([PR #22982](https://github.com/microsoft/fluentui/pull/22982) by behowell@microsoft.com)
17
+ - chore: Update Griffel to latest version ([PR #22894](https://github.com/microsoft/fluentui/pull/22894) by olfedias@microsoft.com)
18
+ - Refactor styles to remove usage of flex gap ([PR #22975](https://github.com/microsoft/fluentui/pull/22975) by behowell@microsoft.com)
19
+ - Updated react-label package version to RC. ([PR #22865](https://github.com/microsoft/fluentui/pull/22865) by esteban.230@hotmail.com)
20
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
21
+ - Bump @fluentui/react-label to v9.0.0-rc.2 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
22
+ - Bump @fluentui/react-tabster to v9.0.0-rc.10 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
23
+ - Bump @fluentui/react-theme to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
24
+ - Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
25
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
26
+
27
+ ## [9.0.0-rc.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.2)
28
+
29
+ Thu, 05 May 2022 18:26:25 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.5..@fluentui/react-radio_v9.0.0-rc.2)
31
+
32
+ ### Changes
33
+
34
+ - update README ([PR #22819](https://github.com/microsoft/fluentui/pull/22819) by seanmonahan@microsoft.com)
35
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
36
+ - Bump @fluentui/react-label to v9.0.0-beta.12 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
37
+ - Bump @fluentui/react-tabster to v9.0.0-rc.9 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
38
+ - Bump @fluentui/react-theme to v9.0.0-rc.7 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
39
+ - Bump @fluentui/react-utilities to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
40
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.5 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
41
+
42
+ ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.5)
43
+
44
+ Wed, 04 May 2022 13:26:48 GMT
45
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.4..@fluentui/react-radio_v9.0.0-beta.5)
46
+
47
+ ### Changes
48
+
49
+ - react-radio: update context usage ([PR #22803](https://github.com/microsoft/fluentui/pull/22803) by seanmonahan@microsoft.com)
50
+ - add bundle size fixtures ([PR #22675](https://github.com/microsoft/fluentui/pull/22675) by seanmonahan@microsoft.com)
51
+ - react-radio: add required prop to RadioGroup ([PR #22809](https://github.com/microsoft/fluentui/pull/22809) by seanmonahan@microsoft.com)
52
+ - react-radio: remove required indicator from label ([PR #22782](https://github.com/microsoft/fluentui/pull/22782) by seanmonahan@microsoft.com)
53
+ - write readme ([PR #22676](https://github.com/microsoft/fluentui/pull/22676) by seanmonahan@microsoft.com)
54
+ - Allow data argument on onChange ([PR #22753](https://github.com/microsoft/fluentui/pull/22753) by miroslav.stastny@microsoft.com)
55
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
56
+ - Bump @fluentui/react-label to v9.0.0-beta.11 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
57
+ - Bump @fluentui/react-tabster to v9.0.0-rc.8 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
58
+ - Bump @fluentui/react-theme to v9.0.0-rc.6 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
59
+ - Bump @fluentui/react-utilities to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
60
+
7
61
  ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.4)
8
62
 
9
- Mon, 25 Apr 2022 09:31:20 GMT
63
+ Mon, 25 Apr 2022 09:32:19 GMT
10
64
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.3..@fluentui/react-radio_v9.0.0-beta.4)
11
65
 
12
66
  ### Changes
@@ -15,7 +69,7 @@ Mon, 25 Apr 2022 09:31:20 GMT
15
69
 
16
70
  ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.3)
17
71
 
18
- Tue, 19 Apr 2022 19:16:50 GMT
72
+ Tue, 19 Apr 2022 19:16:50 GMT
19
73
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.2..@fluentui/react-radio_v9.0.0-beta.3)
20
74
 
21
75
  ### Changes
@@ -34,7 +88,7 @@ Tue, 19 Apr 2022 19:16:50 GMT
34
88
 
35
89
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.2)
36
90
 
37
- Fri, 04 Mar 2022 05:17:40 GMT
91
+ Fri, 04 Mar 2022 05:17:40 GMT
38
92
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.1..@fluentui/react-radio_v9.0.0-beta.2)
39
93
 
40
94
  ### Changes
@@ -48,7 +102,7 @@ Fri, 04 Mar 2022 05:17:40 GMT
48
102
 
49
103
  ## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.1)
50
104
 
51
- Tue, 01 Mar 2022 02:17:40 GMT
105
+ Tue, 01 Mar 2022 02:17:40 GMT
52
106
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.1..@fluentui/react-radio_v9.0.0-beta.1)
53
107
 
54
108
  ### Changes
@@ -59,7 +113,7 @@ Tue, 01 Mar 2022 02:17:40 GMT
59
113
 
60
114
  ## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.1)
61
115
 
62
- Fri, 18 Feb 2022 13:35:38 GMT
116
+ Fri, 18 Feb 2022 13:35:38 GMT
63
117
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.1)
64
118
 
65
119
  ### Changes
@@ -71,7 +125,7 @@ Fri, 18 Feb 2022 13:35:38 GMT
71
125
 
72
126
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
73
127
 
74
- Thu, 10 Feb 2022 08:52:26 GMT
128
+ Thu, 10 Feb 2022 08:52:26 GMT
75
129
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
76
130
 
77
131
  ### Changes
@@ -83,7 +137,7 @@ Thu, 10 Feb 2022 08:52:26 GMT
83
137
 
84
138
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
85
139
 
86
- Thu, 25 Nov 2021 08:34:17 GMT
140
+ Thu, 25 Nov 2021 08:34:17 GMT
87
141
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
88
142
 
89
143
  ### Changes
@@ -96,7 +150,7 @@ Thu, 25 Nov 2021 08:34:17 GMT
96
150
 
97
151
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
98
152
 
99
- Fri, 12 Nov 2021 13:25:34 GMT
153
+ Fri, 12 Nov 2021 13:25:34 GMT
100
154
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
101
155
 
102
156
  ### Changes
@@ -109,7 +163,7 @@ Fri, 12 Nov 2021 13:25:34 GMT
109
163
 
110
164
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
111
165
 
112
- Wed, 27 Oct 2021 12:14:24 GMT
166
+ Wed, 27 Oct 2021 12:14:24 GMT
113
167
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
114
168
 
115
169
  ### Changes
package/README.md CHANGED
@@ -3,3 +3,46 @@
3
3
  **React Radio components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
4
 
5
5
  These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
6
+
7
+ A Radio allows a user to select a single value from two or more options. All Radios with the same `name` are considered to be part of the same group. However, a `RadioGroup` is recommended to add a group label, formatting, and other functionality.
8
+
9
+ ### Usage
10
+
11
+ Import `Radio` and `RadioGroup`:
12
+
13
+ ```js
14
+ // From @fluentui/react-components
15
+ import { Radio, RadioGroup } from '@fluentui/react-components';
16
+
17
+ // Directly from @fluentui/react-radio
18
+ import { Radio, RadioGroup } from '@fluentui/react-radio';
19
+ ```
20
+
21
+ #### Examples
22
+
23
+ ```jsx
24
+ <RadioGroup defaultValue="B">
25
+ <Radio value="A" label="Option A" />
26
+ <Radio value="B" label="Option B" />
27
+ <Radio value="C" label="Option C" />
28
+ <Radio value="D" label="Option D" />
29
+ </RadioGroup>
30
+
31
+ <RadioGroup value={value} onChange={(_, data) => setValue(data.value)}>
32
+ <Radio value="A" label="Option A" />
33
+ <Radio value="B" label="Option B" />
34
+ <Radio value="C" label="Option C" />
35
+ <Radio value="D" label="Option D" />
36
+ </RadioGroup>
37
+ ```
38
+
39
+ See [Fluent UI Storybook](https://aka.ms/fluentui-storybook) for more detailed usage examples.
40
+
41
+ Alternatively, run Storybook locally with:
42
+
43
+ 1. `yarn start`
44
+ 2. Select `react-radio` from the list.
45
+
46
+ ### Specification
47
+
48
+ See [Spec.md](./Spec.md).
@@ -1,5 +1,6 @@
1
1
  import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { Context } from '@fluentui/react-context-selector';
3
4
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
5
  import { Label } from '@fluentui/react-label';
5
6
  import * as React_2 from 'react';
@@ -33,9 +34,13 @@ export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
33
34
  /**
34
35
  * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
35
36
  */
36
- export declare const RadioGroupContext: React_2.Context<RadioGroupContextValue>;
37
+ export declare const RadioGroupContext: Context<RadioGroupContextValue>;
37
38
 
38
- export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'layout' | 'value' | 'defaultValue' | 'disabled'>;
39
+ export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
40
+
41
+ export declare type RadioGroupContextValues = {
42
+ radioGroup: RadioGroupContextValue;
43
+ };
39
44
 
40
45
  /**
41
46
  * Data for the onChange event for RadioGroup.
@@ -73,13 +78,17 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
73
78
  /**
74
79
  * How the radio items are laid out in the group.
75
80
  *
76
- * @defaultvalue vertical
81
+ * @default vertical
77
82
  */
78
83
  layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
79
84
  /**
80
85
  * Disable all Radio items in this group.
81
86
  */
82
87
  disabled?: boolean;
88
+ /**
89
+ * Require all Radio items in this group.
90
+ */
91
+ required?: boolean;
83
92
  };
84
93
 
85
94
  export declare type RadioGroupSlots = {
@@ -92,9 +101,7 @@ export declare type RadioGroupSlots = {
92
101
  /**
93
102
  * State used in rendering RadioGroup
94
103
  */
95
- export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & {
96
- context: RadioGroupContextValue;
97
- };
104
+ export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;
98
105
 
99
106
  /**
100
107
  * Data for the onChange event for Radio.
@@ -109,7 +116,7 @@ export declare type RadioOnChangeData = {
109
116
  /**
110
117
  * Radio Props
111
118
  */
112
- export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & {
119
+ export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {
113
120
  /**
114
121
  * The value of the RadioGroup when this Radio item is selected.
115
122
  */
@@ -174,7 +181,7 @@ export declare const renderRadio_unstable: (state: RadioState) => JSX.Element;
174
181
  /**
175
182
  * Render the final JSX of RadioGroup
176
183
  */
177
- export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element;
184
+ export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
178
185
 
179
186
  /**
180
187
  * Create the state required to render Radio.
@@ -198,6 +205,8 @@ export declare const useRadio_unstable: (props: RadioProps, ref: React_2.Ref<HTM
198
205
  */
199
206
  export declare const useRadioGroup_unstable: (props: RadioGroupProps, ref: React_2.Ref<HTMLDivElement>) => RadioGroupState;
200
207
 
208
+ export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
209
+
201
210
  /**
202
211
  * Apply styling to the RadioGroup slots based on the state
203
212
  */
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.types.js","sourceRoot":"../src/","sources":["components/Radio/Radio.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioSlots = {\n /**\n * The root element of the Radio.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Radio>`.\n * All other native props will be applied to the primary slot: `input`\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Radio's label.\n */\n label: Slot<typeof Label>;\n\n /**\n * Hidden input that handles the radio's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<Radio>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * A circle outline, with a filled circle icon inside when the Radio is checked.\n */\n indicator: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Radio Props\n */\nexport type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & {\n /**\n * The value of the RadioGroup when this Radio item is selected.\n */\n value?: string;\n\n /**\n * The position of the label relative to the radio indicator.\n *\n * This defaults to `after` unless the Radio is inside a RadioGroup with `layout=\"horizontalStacked\"`,\n * in which case it defaults to `below`.\n *\n * @defaultvalue after\n */\n labelPosition?: 'after' | 'below';\n\n /**\n * Disable this Radio item.\n */\n disabled?: boolean;\n\n /**\n * Callback when this Radio is selected in its group.\n *\n * **Note:** `onChange` is NOT called when this Radio is deselected.\n * Use RadioGroup's `onChange` event to determine when the selection in the group changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;\n};\n\n/**\n * Data for the onChange event for Radio.\n */\nexport type RadioOnChangeData = {\n /**\n * The value prop of this Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering Radio\n */\nexport type RadioState = ComponentState<RadioSlots> & Required<Pick<RadioProps, 'labelPosition'>>;\n"]}
1
+ {"version":3,"file":"Radio.types.js","sourceRoot":"../src/","sources":["components/Radio/Radio.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioSlots = {\n /**\n * The root element of the Radio.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Radio>`.\n * All other native props will be applied to the primary slot: `input`\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Radio's label.\n */\n label: Slot<typeof Label>;\n\n /**\n * Hidden input that handles the radio's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<Radio>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * A circle outline, with a filled circle icon inside when the Radio is checked.\n */\n indicator: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Radio Props\n */\nexport type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {\n /**\n * The value of the RadioGroup when this Radio item is selected.\n */\n value?: string;\n\n /**\n * The position of the label relative to the radio indicator.\n *\n * This defaults to `after` unless the Radio is inside a RadioGroup with `layout=\"horizontalStacked\"`,\n * in which case it defaults to `below`.\n *\n * @defaultvalue after\n */\n labelPosition?: 'after' | 'below';\n\n /**\n * Disable this Radio item.\n */\n disabled?: boolean;\n\n /**\n * Callback when this Radio is selected in its group.\n *\n * **Note:** `onChange` is NOT called when this Radio is deselected.\n * Use RadioGroup's `onChange` event to determine when the selection in the group changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: RadioOnChangeData) => void;\n};\n\n/**\n * Data for the onChange event for Radio.\n */\nexport type RadioOnChangeData = {\n /**\n * The value prop of this Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering Radio\n */\nexport type RadioState = ComponentState<RadioSlots> & Required<Pick<RadioProps, 'labelPosition'>>;\n"]}
@@ -3,6 +3,7 @@ import { CircleFilled } from '@fluentui/react-icons';
3
3
  import { Label } from '@fluentui/react-label';
4
4
  import { getPartitionedNativeProps, resolveShorthand, useId, useMergedEventCallbacks } from '@fluentui/react-utilities';
5
5
  import { RadioGroupContext } from '../../contexts/RadioGroupContext';
6
+ import { useContextSelector } from '@fluentui/react-context-selector';
6
7
  /**
7
8
  * Create the state required to render Radio.
8
9
  *
@@ -14,14 +15,19 @@ import { RadioGroupContext } from '../../contexts/RadioGroupContext';
14
15
  */
15
16
 
16
17
  export const useRadio_unstable = (props, ref) => {
17
- const group = React.useContext(RadioGroupContext);
18
+ const nameGroup = useContextSelector(RadioGroupContext, ctx => ctx.name);
19
+ const value = useContextSelector(RadioGroupContext, ctx => ctx.value);
20
+ const defaultValue = useContextSelector(RadioGroupContext, ctx => ctx.defaultValue);
21
+ const disabledGroup = useContextSelector(RadioGroupContext, ctx => ctx.disabled);
22
+ const layout = useContextSelector(RadioGroupContext, ctx => ctx.layout);
23
+ const requiredGroup = useContextSelector(RadioGroupContext, ctx => ctx.required);
18
24
  const {
19
- name = group.name,
20
- checked = group.value !== undefined ? group.value === props.value : undefined,
21
- defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,
22
- labelPosition = group.layout === 'horizontalStacked' ? 'below' : 'after',
23
- disabled = group.disabled,
24
- required,
25
+ name = nameGroup,
26
+ checked = value !== undefined ? value === props.value : undefined,
27
+ defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,
28
+ labelPosition = layout === 'horizontalStacked' ? 'below' : 'after',
29
+ disabled = disabledGroup,
30
+ required = requiredGroup,
25
31
  onChange
26
32
  } = props;
27
33
  const nativeProps = getPartitionedNativeProps({
@@ -43,6 +49,7 @@ export const useRadio_unstable = (props, ref) => {
43
49
  checked,
44
50
  defaultChecked,
45
51
  disabled,
52
+ required,
46
53
  ...nativeProps.primary
47
54
  }
48
55
  });
@@ -52,8 +59,7 @@ export const useRadio_unstable = (props, ref) => {
52
59
  const label = resolveShorthand(props.label, {
53
60
  defaultProps: {
54
61
  htmlFor: input.id,
55
- disabled,
56
- required
62
+ disabled
57
63
  }
58
64
  });
59
65
  const indicator = resolveShorthand(props.indicator, {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, resolveShorthand, useId, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport type { RadioProps, RadioState } from './Radio.types';\n\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props: RadioProps, ref: React.Ref<HTMLInputElement>): RadioState => {\n const group = React.useContext(RadioGroupContext);\n\n const {\n name = group.name,\n checked = group.value !== undefined ? group.value === props.value : undefined,\n defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined,\n labelPosition = group.layout === 'horizontalStacked' ? 'below' : 'after',\n disabled = group.disabled,\n required,\n onChange,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: nativeProps.root,\n });\n\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n ...nativeProps.primary,\n },\n });\n\n input.onChange = useMergedEventCallbacks(input.onChange, ev => onChange?.(ev, { value: ev.currentTarget.value }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled,\n required,\n },\n });\n\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n });\n\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div',\n },\n root,\n input,\n label,\n indicator,\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, resolveShorthand, useId, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { useContextSelector } from '@fluentui/react-context-selector';\nimport type { RadioProps, RadioState } from './Radio.types';\n\n/**\n * Create the state required to render Radio.\n *\n * The returned state can be modified with hooks such as useRadioStyles_unstable,\n * before being passed to renderRadio_unstable.\n *\n * @param props - props from this instance of Radio\n * @param ref - reference to `<input>` element of Radio\n */\nexport const useRadio_unstable = (props: RadioProps, ref: React.Ref<HTMLInputElement>): RadioState => {\n const nameGroup = useContextSelector(RadioGroupContext, ctx => ctx.name);\n const value = useContextSelector(RadioGroupContext, ctx => ctx.value);\n const defaultValue = useContextSelector(RadioGroupContext, ctx => ctx.defaultValue);\n const disabledGroup = useContextSelector(RadioGroupContext, ctx => ctx.disabled);\n const layout = useContextSelector(RadioGroupContext, ctx => ctx.layout);\n const requiredGroup = useContextSelector(RadioGroupContext, ctx => ctx.required);\n\n const {\n name = nameGroup,\n checked = value !== undefined ? value === props.value : undefined,\n defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,\n labelPosition = layout === 'horizontalStacked' ? 'below' : 'after',\n disabled = disabledGroup,\n required = requiredGroup,\n onChange,\n } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const root = resolveShorthand(props.root, {\n required: true,\n defaultProps: nativeProps.root,\n });\n\n const input = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n ref,\n type: 'radio',\n id: useId('radio-', nativeProps.primary.id),\n name,\n checked,\n defaultChecked,\n disabled,\n required,\n ...nativeProps.primary,\n },\n });\n\n input.onChange = useMergedEventCallbacks(input.onChange, ev => onChange?.(ev, { value: ev.currentTarget.value }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n htmlFor: input.id,\n disabled,\n },\n });\n\n const indicator = resolveShorthand(props.indicator, {\n required: true,\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n });\n\n return {\n labelPosition,\n components: {\n root: 'span',\n input: 'input',\n label: Label,\n indicator: 'div',\n },\n root,\n input,\n label,\n indicator,\n };\n};\n"],"sourceRoot":"../src/"}