@fluentui/react-radio 0.0.0-nightly-20220502-0420.1 → 0.0.0-nightly-20220505-0419.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/CHANGELOG.json +96 -13
  2. package/CHANGELOG.md +37 -18
  3. package/README.md +4 -0
  4. package/dist/index.d.ts +17 -8
  5. package/lib/components/Radio/Radio.types.d.ts +1 -1
  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/RadioGroup/RadioGroup.js +3 -1
  10. package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
  11. package/lib/components/RadioGroup/RadioGroup.types.d.ts +9 -4
  12. package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
  13. package/lib/components/RadioGroup/renderRadioGroup.d.ts +2 -2
  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.d.ts +3 -4
  19. package/lib/contexts/RadioGroupContext.js +2 -2
  20. package/lib/contexts/RadioGroupContext.js.map +1 -1
  21. package/lib/contexts/index.d.ts +2 -0
  22. package/lib/contexts/index.js +3 -0
  23. package/lib/contexts/index.js.map +1 -0
  24. package/lib/contexts/useRadioGroupContextValues.d.ts +2 -0
  25. package/lib/contexts/useRadioGroupContextValues.js +22 -0
  26. package/lib/contexts/useRadioGroupContextValues.js.map +1 -0
  27. package/lib/index.d.ts +2 -3
  28. package/lib/index.js +1 -1
  29. package/lib/index.js.map +1 -1
  30. package/lib-commonjs/components/Radio/Radio.types.d.ts +1 -1
  31. package/lib-commonjs/components/Radio/useRadio.js +16 -9
  32. package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
  33. package/lib-commonjs/components/RadioGroup/RadioGroup.js +4 -1
  34. package/lib-commonjs/components/RadioGroup/RadioGroup.js.map +1 -1
  35. package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +9 -4
  36. package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +2 -2
  37. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js +2 -2
  38. package/lib-commonjs/components/RadioGroup/renderRadioGroup.js.map +1 -1
  39. package/lib-commonjs/components/RadioGroup/useRadioGroup.js +7 -10
  40. package/lib-commonjs/components/RadioGroup/useRadioGroup.js.map +1 -1
  41. package/lib-commonjs/contexts/RadioGroupContext.d.ts +3 -4
  42. package/lib-commonjs/contexts/RadioGroupContext.js +2 -2
  43. package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
  44. package/lib-commonjs/contexts/index.d.ts +2 -0
  45. package/lib-commonjs/contexts/index.js +12 -0
  46. package/lib-commonjs/contexts/index.js.map +1 -0
  47. package/lib-commonjs/contexts/useRadioGroupContextValues.d.ts +2 -0
  48. package/lib-commonjs/contexts/useRadioGroupContextValues.js +31 -0
  49. package/lib-commonjs/contexts/useRadioGroupContextValues.js.map +1 -0
  50. package/lib-commonjs/index.d.ts +2 -3
  51. package/lib-commonjs/index.js +9 -3
  52. package/lib-commonjs/index.js.map +1 -1
  53. package/package.json +9 -8
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-radio",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 02 May 2022 04:31:13 GMT",
6
- "tag": "@fluentui/react-radio_v0.0.0-nightly-20220502-0420.1",
7
- "version": "0.0.0-nightly-20220502-0420.1",
5
+ "date": "Thu, 05 May 2022 04:32:04 GMT",
6
+ "tag": "@fluentui/react-radio_v0.0.0-nightly-20220505-0419.1",
7
+ "version": "0.0.0-nightly-20220505-0419.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -13,47 +13,130 @@
13
13
  "commit": "not available",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
+ {
17
+ "author": "seanmonahan@microsoft.com",
18
+ "package": "@fluentui/react-radio",
19
+ "commit": "f628da463f8a12f39e32785e086ef7a2687275f6",
20
+ "comment": "update README"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-radio",
25
+ "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20220505-0419.1",
26
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-radio",
31
+ "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220505-0419.1",
32
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-radio",
37
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220505-0419.1",
38
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-radio",
43
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220505-0419.1",
44
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-radio",
49
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220505-0419.1",
50
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-radio",
55
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220505-0419.1",
56
+ "commit": "6bbaced7ad19cd9172d1869027f73f1aa967547f"
57
+ }
58
+ ],
59
+ "none": [
60
+ {
61
+ "author": "tristan.watanabe@gmail.com",
62
+ "package": "@fluentui/react-radio",
63
+ "commit": "ad3dfcc6d85a8dba3c183612fe552280cd33c20e",
64
+ "comment": "react-radio: Move to new common folder."
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ {
70
+ "date": "Wed, 04 May 2022 13:26:48 GMT",
71
+ "tag": "@fluentui/react-radio_v9.0.0-beta.5",
72
+ "version": "9.0.0-beta.5",
73
+ "comments": {
74
+ "prerelease": [
75
+ {
76
+ "author": "seanmonahan@microsoft.com",
77
+ "package": "@fluentui/react-radio",
78
+ "commit": "9132814df4b6d40d1f5d93d8324d756c1284b294",
79
+ "comment": "react-radio: update context usage"
80
+ },
16
81
  {
17
82
  "author": "seanmonahan@microsoft.com",
18
83
  "package": "@fluentui/react-radio",
19
84
  "commit": "8d990349b5af2d61057cccda2357412d2f5ab9b9",
20
85
  "comment": "add bundle size fixtures"
21
86
  },
87
+ {
88
+ "author": "seanmonahan@microsoft.com",
89
+ "package": "@fluentui/react-radio",
90
+ "commit": "6a017c3b1f2a282fa86c28b675e5ed34a1bb2aee",
91
+ "comment": "react-radio: add required prop to RadioGroup"
92
+ },
93
+ {
94
+ "author": "seanmonahan@microsoft.com",
95
+ "package": "@fluentui/react-radio",
96
+ "commit": "4bc1c43194cb9f44c5ad40ae43ab26556778157e",
97
+ "comment": "react-radio: remove required indicator from label"
98
+ },
22
99
  {
23
100
  "author": "seanmonahan@microsoft.com",
24
101
  "package": "@fluentui/react-radio",
25
102
  "commit": "5f27c51743f22f08741a75c2c10032a02afdf6fb",
26
103
  "comment": "write readme"
27
104
  },
105
+ {
106
+ "author": "miroslav.stastny@microsoft.com",
107
+ "package": "@fluentui/react-radio",
108
+ "commit": "3be7a89d9e9323780bba5b24d3bcc4342e1f1ec7",
109
+ "comment": "Allow data argument on onChange"
110
+ },
28
111
  {
29
112
  "author": "beachball",
30
113
  "package": "@fluentui/react-radio",
31
- "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220502-0420.1",
32
- "commit": "07bac225f1b18ce4fad5464b46f9cb4f09fcd702"
114
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.7",
115
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
33
116
  },
34
117
  {
35
118
  "author": "beachball",
36
119
  "package": "@fluentui/react-radio",
37
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20220502-0420.1",
38
- "commit": "07bac225f1b18ce4fad5464b46f9cb4f09fcd702"
120
+ "comment": "Bump @fluentui/react-label to v9.0.0-beta.11",
121
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
39
122
  },
40
123
  {
41
124
  "author": "beachball",
42
125
  "package": "@fluentui/react-radio",
43
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220502-0420.1",
44
- "commit": "07bac225f1b18ce4fad5464b46f9cb4f09fcd702"
126
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.8",
127
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
45
128
  },
46
129
  {
47
130
  "author": "beachball",
48
131
  "package": "@fluentui/react-radio",
49
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220502-0420.1",
50
- "commit": "07bac225f1b18ce4fad5464b46f9cb4f09fcd702"
132
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.6",
133
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
51
134
  },
52
135
  {
53
136
  "author": "beachball",
54
137
  "package": "@fluentui/react-radio",
55
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220502-0420.1",
56
- "commit": "07bac225f1b18ce4fad5464b46f9cb4f09fcd702"
138
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.7",
139
+ "commit": "65f94192ed3b2cde7e52b9c7e12d6f38b81965dd"
57
140
  }
58
141
  ]
59
142
  }
package/CHANGELOG.md CHANGED
@@ -1,28 +1,47 @@
1
1
  # Change Log - @fluentui/react-radio
2
2
 
3
- This log was last generated on Mon, 02 May 2022 04:31:13 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 05 May 2022 04:32:04 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20220502-0420.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20220502-0420.1)
7
+ ## [0.0.0-nightly-20220505-0419.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v0.0.0-nightly-20220505-0419.1)
8
8
 
9
- Mon, 02 May 2022 04:31:13 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.4..@fluentui/react-radio_v0.0.0-nightly-20220502-0420.1)
9
+ Thu, 05 May 2022 04:32:04 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.5..@fluentui/react-radio_v0.0.0-nightly-20220505-0419.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined)
15
+ - update README ([PR #22819](https://github.com/microsoft/fluentui/pull/22819) by seanmonahan@microsoft.com)
16
+ - Bump @fluentui/react-context-selector to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
17
+ - Bump @fluentui/react-label to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
18
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
19
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
20
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
21
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220505-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/6bbaced7ad19cd9172d1869027f73f1aa967547f) by beachball)
22
+
23
+ ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.5)
24
+
25
+ Wed, 04 May 2022 13:26:48 GMT
26
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.4..@fluentui/react-radio_v9.0.0-beta.5)
27
+
28
+ ### Changes
29
+
30
+ - react-radio: update context usage ([PR #22803](https://github.com/microsoft/fluentui/pull/22803) by seanmonahan@microsoft.com)
15
31
  - add bundle size fixtures ([PR #22675](https://github.com/microsoft/fluentui/pull/22675) by seanmonahan@microsoft.com)
32
+ - react-radio: add required prop to RadioGroup ([PR #22809](https://github.com/microsoft/fluentui/pull/22809) by seanmonahan@microsoft.com)
33
+ - react-radio: remove required indicator from label ([PR #22782](https://github.com/microsoft/fluentui/pull/22782) by seanmonahan@microsoft.com)
16
34
  - write readme ([PR #22676](https://github.com/microsoft/fluentui/pull/22676) by seanmonahan@microsoft.com)
17
- - Bump @fluentui/react-label to v0.0.0-nightly-20220502-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/07bac225f1b18ce4fad5464b46f9cb4f09fcd702) by beachball)
18
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20220502-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/07bac225f1b18ce4fad5464b46f9cb4f09fcd702) by beachball)
19
- - Bump @fluentui/react-theme to v0.0.0-nightly-20220502-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/07bac225f1b18ce4fad5464b46f9cb4f09fcd702) by beachball)
20
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20220502-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/07bac225f1b18ce4fad5464b46f9cb4f09fcd702) by beachball)
21
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220502-0420.1 ([commit](https://github.com/microsoft/fluentui/commit/07bac225f1b18ce4fad5464b46f9cb4f09fcd702) by beachball)
35
+ - Allow data argument on onChange ([PR #22753](https://github.com/microsoft/fluentui/pull/22753) by miroslav.stastny@microsoft.com)
36
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
37
+ - Bump @fluentui/react-label to v9.0.0-beta.11 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
38
+ - Bump @fluentui/react-tabster to v9.0.0-rc.8 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
39
+ - Bump @fluentui/react-theme to v9.0.0-rc.6 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
40
+ - Bump @fluentui/react-utilities to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
22
41
 
23
42
  ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.4)
24
43
 
25
- Mon, 25 Apr 2022 09:32:19 GMT
44
+ Mon, 25 Apr 2022 09:32:19 GMT
26
45
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.3..@fluentui/react-radio_v9.0.0-beta.4)
27
46
 
28
47
  ### Changes
@@ -31,7 +50,7 @@ Mon, 25 Apr 2022 09:32:19 GMT
31
50
 
32
51
  ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.3)
33
52
 
34
- Tue, 19 Apr 2022 19:16:50 GMT
53
+ Tue, 19 Apr 2022 19:16:50 GMT
35
54
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.2..@fluentui/react-radio_v9.0.0-beta.3)
36
55
 
37
56
  ### Changes
@@ -50,7 +69,7 @@ Tue, 19 Apr 2022 19:16:50 GMT
50
69
 
51
70
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.2)
52
71
 
53
- Fri, 04 Mar 2022 05:17:40 GMT
72
+ Fri, 04 Mar 2022 05:17:40 GMT
54
73
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.1..@fluentui/react-radio_v9.0.0-beta.2)
55
74
 
56
75
  ### Changes
@@ -64,7 +83,7 @@ Fri, 04 Mar 2022 05:17:40 GMT
64
83
 
65
84
  ## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.1)
66
85
 
67
- Tue, 01 Mar 2022 02:17:40 GMT
86
+ Tue, 01 Mar 2022 02:17:40 GMT
68
87
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.1..@fluentui/react-radio_v9.0.0-beta.1)
69
88
 
70
89
  ### Changes
@@ -75,7 +94,7 @@ Tue, 01 Mar 2022 02:17:40 GMT
75
94
 
76
95
  ## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.1)
77
96
 
78
- Fri, 18 Feb 2022 13:35:38 GMT
97
+ Fri, 18 Feb 2022 13:35:38 GMT
79
98
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.1)
80
99
 
81
100
  ### Changes
@@ -87,7 +106,7 @@ Fri, 18 Feb 2022 13:35:38 GMT
87
106
 
88
107
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
89
108
 
90
- Thu, 10 Feb 2022 08:52:26 GMT
109
+ Thu, 10 Feb 2022 08:52:26 GMT
91
110
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
92
111
 
93
112
  ### Changes
@@ -99,7 +118,7 @@ Thu, 10 Feb 2022 08:52:26 GMT
99
118
 
100
119
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
101
120
 
102
- Thu, 25 Nov 2021 08:34:17 GMT
121
+ Thu, 25 Nov 2021 08:34:17 GMT
103
122
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
104
123
 
105
124
  ### Changes
@@ -112,7 +131,7 @@ Thu, 25 Nov 2021 08:34:17 GMT
112
131
 
113
132
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
114
133
 
115
- Fri, 12 Nov 2021 13:25:34 GMT
134
+ Fri, 12 Nov 2021 13:25:34 GMT
116
135
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
117
136
 
118
137
  ### Changes
@@ -125,7 +144,7 @@ Fri, 12 Nov 2021 13:25:34 GMT
125
144
 
126
145
  ## [9.0.0-beta.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-beta.0)
127
146
 
128
- Wed, 27 Oct 2021 12:14:24 GMT
147
+ Wed, 27 Oct 2021 12:14:24 GMT
129
148
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.0..@fluentui/react-radio_v9.0.0-beta.0)
130
149
 
131
150
  ### Changes
package/README.md CHANGED
@@ -11,6 +11,10 @@ A Radio allows a user to select a single value from two or more options. All Rad
11
11
  Import `Radio` and `RadioGroup`:
12
12
 
13
13
  ```js
14
+ // From @fluentui/react-components
15
+ import { Radio, RadioGroup } from '@fluentui/react-components';
16
+
17
+ // Directly from @fluentui/react-radio
14
18
  import { Radio, RadioGroup } from '@fluentui/react-radio';
15
19
  ```
16
20
 
package/dist/index.d.ts CHANGED
@@ -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
  */
@@ -28,7 +28,7 @@ export declare type RadioSlots = {
28
28
  /**
29
29
  * Radio Props
30
30
  */
31
- export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'size'> & {
31
+ export declare type RadioProps = Omit<ComponentProps<Partial<RadioSlots>, 'input'>, 'onChange' | 'size'> & {
32
32
  /**
33
33
  * The value of the RadioGroup when this Radio item is selected.
34
34
  */
@@ -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":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6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* 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/use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AA9B;AAOA,QAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB;AAClD,IAAA,QAAQ,EAAE,IADwC;AAElD,IAAA,YAAY,EAAE;AACZ,qBAAe,IADH;AAEZ,MAAA,QAAQ,eAAE,KAAA,CAAA,aAAA,CAAC,YAAD,EAAa,IAAb;AAFE;AAFoC,GAAlB,CAAlC;AAQA,SAAO;AACL,IAAA,aADK;AAEL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,MADI;AAEV,MAAA,KAAK,EAAE,OAFG;AAGV,MAAA,KAAK,EAAE,KAHG;AAIV,MAAA,SAAS,EAAE;AAJD,KAFP;AAQL,IAAA,IARK;AASL,IAAA,KATK;AAUL,IAAA,KAVK;AAWL,IAAA;AAXK,GAAP;AAaD,CA1EM","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/"}
@@ -2,14 +2,16 @@ import * as React from 'react';
2
2
  import { renderRadioGroup_unstable } from './renderRadioGroup';
3
3
  import { useRadioGroup_unstable } from './useRadioGroup';
4
4
  import { useRadioGroupStyles_unstable } from './useRadioGroupStyles';
5
+ import { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';
5
6
  /**
6
7
  * A RadioGroup component presents a set of options where only one option can be selected.
7
8
  */
8
9
 
9
10
  export const RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
10
11
  const state = useRadioGroup_unstable(props, ref);
12
+ const contextValues = useRadioGroupContextValues(state);
11
13
  useRadioGroupStyles_unstable(state);
12
- return renderRadioGroup_unstable(state);
14
+ return renderRadioGroup_unstable(state, contextValues);
13
15
  });
14
16
  RadioGroup.displayName = 'RadioGroup';
15
17
  //# sourceMappingURL=RadioGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,4BAAT,QAA6C,uBAA7C;AAEA;;AAEG;;AACH,OAAO,MAAM,UAAU,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,sBAAsB,CAAC,KAAD,EAAQ,GAAR,CAApC;AAEA,EAAA,4BAA4B,CAAC,KAAD,CAA5B;AACA,SAAO,yBAAyB,CAAC,KAAD,CAAhC;AACD,CAL+D,CAAzD;AAOP,UAAU,CAAC,WAAX,GAAyB,YAAzB","sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { RadioGroupProps } from './RadioGroup.types';\nimport { renderRadioGroup_unstable } from './renderRadioGroup';\nimport { useRadioGroup_unstable } from './useRadioGroup';\nimport { useRadioGroupStyles_unstable } from './useRadioGroupStyles';\n\n/**\n * A RadioGroup component presents a set of options where only one option can be selected.\n */\nexport const RadioGroup: ForwardRefComponent<RadioGroupProps> = React.forwardRef((props, ref) => {\n const state = useRadioGroup_unstable(props, ref);\n\n useRadioGroupStyles_unstable(state);\n return renderRadioGroup_unstable(state);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,yBAAT,QAA0C,oBAA1C;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,4BAAT,QAA6C,uBAA7C;AACA,SAAS,0BAAT,QAA2C,2CAA3C;AAEA;;AAEG;;AACH,OAAO,MAAM,UAAU,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,sBAAsB,CAAC,KAAD,EAAQ,GAAR,CAApC;AACA,QAAM,aAAa,GAAG,0BAA0B,CAAC,KAAD,CAAhD;AAEA,EAAA,4BAA4B,CAAC,KAAD,CAA5B;AACA,SAAO,yBAAyB,CAAC,KAAD,EAAQ,aAAR,CAAhC;AACD,CAN+D,CAAzD;AAQP,UAAU,CAAC,WAAX,GAAyB,YAAzB","sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { RadioGroupProps } from './RadioGroup.types';\nimport { renderRadioGroup_unstable } from './renderRadioGroup';\nimport { useRadioGroup_unstable } from './useRadioGroup';\nimport { useRadioGroupStyles_unstable } from './useRadioGroupStyles';\nimport { useRadioGroupContextValues } from '../../contexts/useRadioGroupContextValues';\n\n/**\n * A RadioGroup component presents a set of options where only one option can be selected.\n */\nexport const RadioGroup: ForwardRefComponent<RadioGroupProps> = React.forwardRef((props, ref) => {\n const state = useRadioGroup_unstable(props, ref);\n const contextValues = useRadioGroupContextValues(state);\n\n useRadioGroupStyles_unstable(state);\n return renderRadioGroup_unstable(state, contextValues);\n});\n\nRadioGroup.displayName = 'RadioGroup';\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
- import { RadioGroupContextValue } from '../../contexts/RadioGroupContext';
4
3
  export declare type RadioGroupSlots = {
5
4
  /**
6
5
  * The radio group root.
@@ -33,13 +32,17 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
33
32
  /**
34
33
  * How the radio items are laid out in the group.
35
34
  *
36
- * @defaultvalue vertical
35
+ * @default vertical
37
36
  */
38
37
  layout?: 'vertical' | 'horizontal' | 'horizontalStacked';
39
38
  /**
40
39
  * Disable all Radio items in this group.
41
40
  */
42
41
  disabled?: boolean;
42
+ /**
43
+ * Require all Radio items in this group.
44
+ */
45
+ required?: boolean;
43
46
  };
44
47
  /**
45
48
  * Data for the onChange event for RadioGroup.
@@ -53,6 +56,8 @@ export declare type RadioGroupOnChangeData = {
53
56
  /**
54
57
  * State used in rendering RadioGroup
55
58
  */
56
- export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & {
57
- context: RadioGroupContextValue;
59
+ export declare type RadioGroupState = ComponentState<RadioGroupSlots> & Required<Pick<RadioGroupProps, 'layout'>> & Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;
60
+ export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
61
+ export declare type RadioGroupContextValues = {
62
+ radioGroup: RadioGroupContextValue;
58
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.types.js","sourceRoot":"../src/","sources":["components/RadioGroup/RadioGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { RadioGroupContextValue } from '../../contexts/RadioGroupContext';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\nexport type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {\n /**\n * The name of this radio group. This name is applied to all Radio items inside this group.\n *\n * If no name is provided, one will be generated so that all of the Radio items have the same name.\n */\n name?: string;\n\n /**\n * The selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n value?: string;\n\n /**\n * The default selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n defaultValue?: string;\n\n /**\n * Callback when the selected Radio item changes.\n */\n onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;\n\n /**\n * How the radio items are laid out in the group.\n *\n * @defaultvalue vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontalStacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: boolean;\n};\n\n/**\n * Data for the onChange event for RadioGroup.\n */\nexport type RadioGroupOnChangeData = {\n /**\n * The value of the newly selected Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering RadioGroup\n */\nexport type RadioGroupState = ComponentState<RadioGroupSlots> &\n Required<Pick<RadioGroupProps, 'layout'>> & {\n context: RadioGroupContextValue;\n };\n"]}
1
+ {"version":3,"file":"RadioGroup.types.js","sourceRoot":"../src/","sources":["components/RadioGroup/RadioGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type RadioGroupSlots = {\n /**\n * The radio group root.\n */\n root: NonNullable<Slot<'div'>>;\n};\n\nexport type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlots>>, 'onChange'> & {\n /**\n * The name of this radio group. This name is applied to all Radio items inside this group.\n *\n * If no name is provided, one will be generated so that all of the Radio items have the same name.\n */\n name?: string;\n\n /**\n * The selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n value?: string;\n\n /**\n * The default selected Radio item in this group.\n *\n * This should be the `value` prop of one of the Radio items inside this group.\n */\n defaultValue?: string;\n\n /**\n * Callback when the selected Radio item changes.\n */\n onChange?: (ev: React.FormEvent<HTMLDivElement>, data: RadioGroupOnChangeData) => void;\n\n /**\n * How the radio items are laid out in the group.\n *\n * @default vertical\n */\n layout?: 'vertical' | 'horizontal' | 'horizontalStacked';\n\n /**\n * Disable all Radio items in this group.\n */\n disabled?: boolean;\n\n /**\n * Require all Radio items in this group.\n */\n required?: boolean;\n};\n\n/**\n * Data for the onChange event for RadioGroup.\n */\nexport type RadioGroupOnChangeData = {\n /**\n * The value of the newly selected Radio item.\n */\n value: string;\n};\n\n/**\n * State used in rendering RadioGroup\n */\nexport type RadioGroupState = ComponentState<RadioGroupSlots> &\n Required<Pick<RadioGroupProps, 'layout'>> &\n Partial<Exclude<RadioGroupProps, 'onChange' | 'layout'>>;\n\nexport type RadioGroupContextValue = Pick<\n RadioGroupProps,\n 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'\n>;\n\nexport type RadioGroupContextValues = {\n radioGroup: RadioGroupContextValue;\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { RadioGroupState } from './RadioGroup.types';
1
+ import { RadioGroupContextValues, RadioGroupState } from './RadioGroup.types';
2
2
  /**
3
3
  * Render the final JSX of RadioGroup
4
4
  */
5
- export declare const renderRadioGroup_unstable: (state: RadioGroupState) => JSX.Element;
5
+ export declare const renderRadioGroup_unstable: (state: RadioGroupState, contextValues: RadioGroupContextValues) => JSX.Element;
@@ -5,13 +5,13 @@ import { RadioGroupContext } from '../../contexts/RadioGroupContext';
5
5
  * Render the final JSX of RadioGroup
6
6
  */
7
7
 
8
- export const renderRadioGroup_unstable = state => {
8
+ export const renderRadioGroup_unstable = (state, contextValues) => {
9
9
  const {
10
10
  slots,
11
11
  slotProps
12
12
  } = getSlots(state);
13
13
  return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
14
- value: state.context
14
+ value: contextValues.radioGroup
15
15
  }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
16
16
  }));
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["components/RadioGroup/renderRadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,iBAAT,QAAkC,kCAAlC;AAGA;;AAEG;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAA2B;AAClE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAkB,KAAlB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,iBAAiB,CAAC,QAAnB,EAA2B;AAAC,IAAA,KAAK,EAAE,KAAK,CAAC;AAAd,GAA3B,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Render the final JSX of RadioGroup\n */\nexport const renderRadioGroup_unstable = (state: RadioGroupState) => {\n const { slots, slotProps } = getSlots<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={state.context}>\n <slots.root {...slotProps.root} />\n </RadioGroupContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/RadioGroup/renderRadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,iBAAT,QAAkC,kCAAlC;AAGA;;AAEG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CAAC,KAAD,EAAyB,aAAzB,KAAmE;AAC1G,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAkB,KAAlB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,iBAAiB,CAAC,QAAnB,EAA2B;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAA3B,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { RadioGroupContext } from '../../contexts/RadioGroupContext';\nimport { RadioGroupContextValues, RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\n\n/**\n * Render the final JSX of RadioGroup\n */\nexport const renderRadioGroup_unstable = (state: RadioGroupState, contextValues: RadioGroupContextValues) => {\n const { slots, slotProps } = getSlots<RadioGroupSlots>(state);\n\n return (\n <RadioGroupContext.Provider value={contextValues.radioGroup}>\n <slots.root {...slotProps.root} />\n </RadioGroupContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { getNativeElementProps, useEventCallback, useId } from '@fluentui/react-utilities';
3
2
  /**
4
3
  * Create the state required to render RadioGroup.
@@ -18,17 +17,16 @@ export const useRadioGroup_unstable = (props, ref) => {
18
17
  defaultValue,
19
18
  disabled,
20
19
  layout = 'vertical',
21
- onChange
20
+ onChange,
21
+ required
22
22
  } = props;
23
23
  return {
24
24
  layout,
25
- context: React.useMemo(() => ({
26
- name,
27
- value,
28
- defaultValue,
29
- disabled,
30
- layout
31
- }), [name, layout, value, defaultValue, disabled]),
25
+ name,
26
+ value,
27
+ defaultValue,
28
+ disabled,
29
+ required,
32
30
  components: {
33
31
  root: 'div'
34
32
  },