@fluentui/react-radio 9.0.0-rc.2 → 9.0.0-rc.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +162 -1
- package/CHANGELOG.md +47 -2
- package/dist/index.d.ts +9 -17
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Radio/useRadio.js +1 -1
- package/lib/components/Radio/useRadio.js.map +1 -1
- package/lib/components/Radio/useRadioStyles.js +17 -25
- package/lib/components/Radio/useRadioStyles.js.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.types.js.map +1 -1
- package/lib/components/RadioGroup/useRadioGroupStyles.js +0 -5
- package/lib/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
- package/lib/contexts/RadioGroupContext.js +3 -1
- package/lib/contexts/RadioGroupContext.js.map +1 -1
- package/lib/index.js +3 -7
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadio.js +1 -1
- package/lib-commonjs/components/Radio/useRadio.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadioStyles.js +18 -26
- package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -1
- package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js +1 -6
- package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.js.map +1 -1
- package/lib-commonjs/contexts/RadioGroupContext.js +6 -1
- package/lib-commonjs/contexts/RadioGroupContext.js.map +1 -1
- package/lib-commonjs/index.js +9 -19
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
- package/lib/Radio.d.ts +0 -1
- package/lib/RadioGroup.d.ts +0 -1
- package/lib/components/Radio/Radio.d.ts +0 -6
- package/lib/components/Radio/Radio.types.d.ts +0 -69
- package/lib/components/Radio/index.d.ts +0 -5
- package/lib/components/Radio/renderRadio.d.ts +0 -5
- package/lib/components/Radio/useRadio.d.ts +0 -12
- package/lib/components/Radio/useRadioStyles.d.ts +0 -11
- package/lib/components/RadioGroup/RadioGroup.d.ts +0 -6
- package/lib/components/RadioGroup/RadioGroup.types.d.ts +0 -63
- package/lib/components/RadioGroup/index.d.ts +0 -5
- package/lib/components/RadioGroup/renderRadioGroup.d.ts +0 -5
- package/lib/components/RadioGroup/useRadioGroup.d.ts +0 -12
- package/lib/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
- package/lib/contexts/RadioGroupContext.d.ts +0 -6
- package/lib/contexts/index.d.ts +0 -2
- package/lib/contexts/useRadioGroupContextValues.d.ts +0 -2
- package/lib/index.d.ts +0 -5
- package/lib-commonjs/Radio.d.ts +0 -1
- package/lib-commonjs/RadioGroup.d.ts +0 -1
- package/lib-commonjs/components/Radio/Radio.d.ts +0 -6
- package/lib-commonjs/components/Radio/Radio.types.d.ts +0 -69
- package/lib-commonjs/components/Radio/index.d.ts +0 -5
- package/lib-commonjs/components/Radio/renderRadio.d.ts +0 -5
- package/lib-commonjs/components/Radio/useRadio.d.ts +0 -12
- package/lib-commonjs/components/Radio/useRadioStyles.d.ts +0 -11
- package/lib-commonjs/components/RadioGroup/RadioGroup.d.ts +0 -6
- package/lib-commonjs/components/RadioGroup/RadioGroup.types.d.ts +0 -63
- package/lib-commonjs/components/RadioGroup/index.d.ts +0 -5
- package/lib-commonjs/components/RadioGroup/renderRadioGroup.d.ts +0 -5
- package/lib-commonjs/components/RadioGroup/useRadioGroup.d.ts +0 -12
- package/lib-commonjs/components/RadioGroup/useRadioGroupStyles.d.ts +0 -11
- package/lib-commonjs/contexts/RadioGroupContext.d.ts +0 -6
- package/lib-commonjs/contexts/index.d.ts +0 -2
- package/lib-commonjs/contexts/useRadioGroupContextValues.d.ts +0 -2
- package/lib-commonjs/index.d.ts +0 -5
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,168 @@
|
|
2
2
|
"name": "@fluentui/react-radio",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Thu,
|
5
|
+
"date": "Thu, 26 May 2022 21:00:04 GMT",
|
6
|
+
"tag": "@fluentui/react-radio_v9.0.0-rc.5",
|
7
|
+
"version": "9.0.0-rc.5",
|
8
|
+
"comments": {
|
9
|
+
"none": [
|
10
|
+
{
|
11
|
+
"author": "olfedias@microsoft.com",
|
12
|
+
"package": "@fluentui/react-radio",
|
13
|
+
"commit": "d5f8088dc5bb51cb0579933456d03b551e5b875d",
|
14
|
+
"comment": "make Best Practices collapsible"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"prerelease": [
|
18
|
+
{
|
19
|
+
"author": "beachball",
|
20
|
+
"package": "@fluentui/react-radio",
|
21
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.4",
|
22
|
+
"commit": "3cf55ce998048554bf6a550de44403843ea8ede0"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"author": "beachball",
|
26
|
+
"package": "@fluentui/react-radio",
|
27
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.12",
|
28
|
+
"commit": "3cf55ce998048554bf6a550de44403843ea8ede0"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
}
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"date": "Mon, 23 May 2022 18:56:48 GMT",
|
35
|
+
"tag": "@fluentui/react-radio_v9.0.0-rc.4",
|
36
|
+
"version": "9.0.0-rc.4",
|
37
|
+
"comments": {
|
38
|
+
"prerelease": [
|
39
|
+
{
|
40
|
+
"author": "esteban.230@hotmail.com",
|
41
|
+
"package": "@fluentui/react-radio",
|
42
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
43
|
+
"comment": "Removing <componentName>ClassName exports."
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"author": "lingfangao@hotmail.com",
|
47
|
+
"package": "@fluentui/react-radio",
|
48
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
49
|
+
"comment": "BREAKING: stop exporting RadioGroupContext"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"author": "seanmonahan@microsoft.com",
|
53
|
+
"package": "@fluentui/react-radio",
|
54
|
+
"commit": "5ed22515a7542b432ed694f22606ac3718d501cb",
|
55
|
+
"comment": "BREAKING: update string unions to use spinal-case"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"author": "beachball",
|
59
|
+
"package": "@fluentui/react-radio",
|
60
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.3",
|
61
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"author": "beachball",
|
65
|
+
"package": "@fluentui/react-radio",
|
66
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.11",
|
67
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"author": "beachball",
|
71
|
+
"package": "@fluentui/react-radio",
|
72
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.9",
|
73
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"author": "beachball",
|
77
|
+
"package": "@fluentui/react-radio",
|
78
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7",
|
79
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
80
|
+
}
|
81
|
+
]
|
82
|
+
}
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"date": "Mon, 23 May 2022 12:13:36 GMT",
|
86
|
+
"tag": "@fluentui/react-radio_v9.0.0-rc.3",
|
87
|
+
"version": "9.0.0-rc.3",
|
88
|
+
"comments": {
|
89
|
+
"prerelease": [
|
90
|
+
{
|
91
|
+
"author": "martinhochel@microsoft.com",
|
92
|
+
"package": "@fluentui/react-radio",
|
93
|
+
"commit": "eb1084fd607c0d1086f9d465168be5822daa5e40",
|
94
|
+
"comment": "feat: ship rolluped only dts"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"author": "olfedias@microsoft.com",
|
98
|
+
"package": "@fluentui/react-radio",
|
99
|
+
"commit": "60804cec07a495b8a5d1fc66338bf0443b212144",
|
100
|
+
"comment": "chore: Update Griffel to latest version"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"author": "behowell@microsoft.com",
|
104
|
+
"package": "@fluentui/react-radio",
|
105
|
+
"commit": "c0b27cce0d29122e4488ff431689b966076a728b",
|
106
|
+
"comment": "Replace hardcoded padding with spacing tokens"
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"author": "olfedias@microsoft.com",
|
110
|
+
"package": "@fluentui/react-radio",
|
111
|
+
"commit": "f120fe9160ad7311a87af0cfacd8d2fb26275e34",
|
112
|
+
"comment": "chore: Update Griffel to latest version"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"author": "behowell@microsoft.com",
|
116
|
+
"package": "@fluentui/react-radio",
|
117
|
+
"commit": "2ea15d322e01dc6055378f4f0f5f3febf7910f80",
|
118
|
+
"comment": "Refactor styles to remove usage of flex gap"
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"author": "esteban.230@hotmail.com",
|
122
|
+
"package": "@fluentui/react-radio",
|
123
|
+
"commit": "0fac2d7a6f35c5fcebaf30da68b9604410fe0eb9",
|
124
|
+
"comment": "Updated react-label package version to RC."
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"author": "beachball",
|
128
|
+
"package": "@fluentui/react-radio",
|
129
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.9",
|
130
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"author": "beachball",
|
134
|
+
"package": "@fluentui/react-radio",
|
135
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.2",
|
136
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"author": "beachball",
|
140
|
+
"package": "@fluentui/react-radio",
|
141
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.10",
|
142
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"author": "beachball",
|
146
|
+
"package": "@fluentui/react-radio",
|
147
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.8",
|
148
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"author": "beachball",
|
152
|
+
"package": "@fluentui/react-radio",
|
153
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
|
154
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"author": "beachball",
|
158
|
+
"package": "@fluentui/react-radio",
|
159
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6",
|
160
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
161
|
+
}
|
162
|
+
]
|
163
|
+
}
|
164
|
+
},
|
165
|
+
{
|
166
|
+
"date": "Thu, 05 May 2022 18:26:25 GMT",
|
6
167
|
"tag": "@fluentui/react-radio_v9.0.0-rc.2",
|
7
168
|
"version": "9.0.0-rc.2",
|
8
169
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,57 @@
|
|
1
1
|
# Change Log - @fluentui/react-radio
|
2
2
|
|
3
|
-
This log was last generated on Thu,
|
3
|
+
This log was last generated on Thu, 26 May 2022 21:00:04 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.5)
|
8
|
+
|
9
|
+
Thu, 26 May 2022 21:00:04 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-rc.4..@fluentui/react-radio_v9.0.0-rc.5)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-label to v9.0.0-rc.4 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
|
15
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
|
16
|
+
|
17
|
+
## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.4)
|
18
|
+
|
19
|
+
Mon, 23 May 2022 18:56:48 GMT
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-rc.3..@fluentui/react-radio_v9.0.0-rc.4)
|
21
|
+
|
22
|
+
### Changes
|
23
|
+
|
24
|
+
- Removing <componentName>ClassName exports. ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by esteban.230@hotmail.com)
|
25
|
+
- BREAKING: stop exporting RadioGroupContext ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by lingfangao@hotmail.com)
|
26
|
+
- BREAKING: update string unions to use spinal-case ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by seanmonahan@microsoft.com)
|
27
|
+
- Bump @fluentui/react-label to v9.0.0-rc.3 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
28
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
29
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
30
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
31
|
+
|
32
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.3)
|
33
|
+
|
34
|
+
Mon, 23 May 2022 12:13:36 GMT
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-rc.2..@fluentui/react-radio_v9.0.0-rc.3)
|
36
|
+
|
37
|
+
### Changes
|
38
|
+
|
39
|
+
- feat: ship rolluped only dts ([PR #22874](https://github.com/microsoft/fluentui/pull/22874) by martinhochel@microsoft.com)
|
40
|
+
- chore: Update Griffel to latest version ([PR #23029](https://github.com/microsoft/fluentui/pull/23029) by olfedias@microsoft.com)
|
41
|
+
- Replace hardcoded padding with spacing tokens ([PR #22982](https://github.com/microsoft/fluentui/pull/22982) by behowell@microsoft.com)
|
42
|
+
- chore: Update Griffel to latest version ([PR #22894](https://github.com/microsoft/fluentui/pull/22894) by olfedias@microsoft.com)
|
43
|
+
- Refactor styles to remove usage of flex gap ([PR #22975](https://github.com/microsoft/fluentui/pull/22975) by behowell@microsoft.com)
|
44
|
+
- Updated react-label package version to RC. ([PR #22865](https://github.com/microsoft/fluentui/pull/22865) by esteban.230@hotmail.com)
|
45
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
46
|
+
- Bump @fluentui/react-label to v9.0.0-rc.2 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
47
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.10 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
48
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
49
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
50
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
51
|
+
|
7
52
|
## [9.0.0-rc.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.0-rc.2)
|
8
53
|
|
9
|
-
Thu, 05 May 2022 18:
|
54
|
+
Thu, 05 May 2022 18:26:25 GMT
|
10
55
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.0-beta.5..@fluentui/react-radio_v9.0.0-rc.2)
|
11
56
|
|
12
57
|
### Changes
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
3
|
-
import
|
3
|
+
import { ContextSelector } from '@fluentui/react-context-selector';
|
4
|
+
import { FC } from 'react';
|
4
5
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
5
6
|
import { Label } from '@fluentui/react-label';
|
7
|
+
import { Provider } from 'react';
|
8
|
+
import { ProviderProps } from 'react';
|
6
9
|
import * as React_2 from 'react';
|
7
10
|
import type { Slot } from '@fluentui/react-utilities';
|
8
11
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
@@ -12,11 +15,6 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
12
15
|
*/
|
13
16
|
export declare const Radio: ForwardRefComponent<RadioProps>;
|
14
17
|
|
15
|
-
/**
|
16
|
-
* @deprecated Use `radioClassNames.root` instead.
|
17
|
-
*/
|
18
|
-
export declare const radioClassName = "fui-Radio";
|
19
|
-
|
20
18
|
export declare const radioClassNames: SlotClassNames<RadioSlots>;
|
21
19
|
|
22
20
|
/**
|
@@ -24,18 +22,8 @@ export declare const radioClassNames: SlotClassNames<RadioSlots>;
|
|
24
22
|
*/
|
25
23
|
export declare const RadioGroup: ForwardRefComponent<RadioGroupProps>;
|
26
24
|
|
27
|
-
/**
|
28
|
-
* @deprecated Use `radioGroupClassNames.root` instead.
|
29
|
-
*/
|
30
|
-
export declare const radioGroupClassName = "fui-RadioGroup";
|
31
|
-
|
32
25
|
export declare const radioGroupClassNames: SlotClassNames<RadioGroupSlots>;
|
33
26
|
|
34
|
-
/**
|
35
|
-
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
36
|
-
*/
|
37
|
-
export declare const RadioGroupContext: Context<RadioGroupContextValue>;
|
38
|
-
|
39
27
|
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
|
40
28
|
|
41
29
|
export declare type RadioGroupContextValues = {
|
@@ -80,7 +68,7 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
|
|
80
68
|
*
|
81
69
|
* @default vertical
|
82
70
|
*/
|
83
|
-
layout?: 'vertical' | 'horizontal' | '
|
71
|
+
layout?: 'vertical' | 'horizontal' | 'horizontal-stacked';
|
84
72
|
/**
|
85
73
|
* Disable all Radio items in this group.
|
86
74
|
*/
|
@@ -91,6 +79,8 @@ export declare type RadioGroupProps = Omit<ComponentProps<Partial<RadioGroupSlot
|
|
91
79
|
required?: boolean;
|
92
80
|
};
|
93
81
|
|
82
|
+
export declare const RadioGroupProvider: Provider<RadioGroupContextValue> & FC<ProviderProps<RadioGroupContextValue>>;
|
83
|
+
|
94
84
|
export declare type RadioGroupSlots = {
|
95
85
|
/**
|
96
86
|
* The radio group root.
|
@@ -205,6 +195,8 @@ export declare const useRadio_unstable: (props: RadioProps, ref: React_2.Ref<HTM
|
|
205
195
|
*/
|
206
196
|
export declare const useRadioGroup_unstable: (props: RadioGroupProps, ref: React_2.Ref<HTMLDivElement>) => RadioGroupState;
|
207
197
|
|
198
|
+
export declare const useRadioGroupContext_unstable: <T>(selector: ContextSelector<RadioGroupContextValue, T>) => T;
|
199
|
+
|
208
200
|
export declare const useRadioGroupContextValues: (state: RadioGroupState) => RadioGroupContextValues;
|
209
201
|
|
210
202
|
/**
|
File without changes
|
@@ -25,7 +25,7 @@ export const useRadio_unstable = (props, ref) => {
|
|
25
25
|
name = nameGroup,
|
26
26
|
checked = value !== undefined ? value === props.value : undefined,
|
27
27
|
defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,
|
28
|
-
labelPosition = layout === '
|
28
|
+
labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',
|
29
29
|
disabled = disabledGroup,
|
30
30
|
required = requiredGroup,
|
31
31
|
onChange
|
@@ -1 +1 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B,GAAd,CAA9B;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 === 'horizontal-stacked' ? '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/"}
|
@@ -1,20 +1,12 @@
|
|
1
1
|
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
2
2
|
import { tokens } from '@fluentui/react-theme';
|
3
3
|
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
4
|
-
/**
|
5
|
-
* @deprecated Use `radioClassNames.root` instead.
|
6
|
-
*/
|
7
|
-
|
8
|
-
export const radioClassName = 'fui-Radio';
|
9
4
|
export const radioClassNames = {
|
10
5
|
root: 'fui-Radio',
|
11
6
|
indicator: 'fui-Radio__indicator',
|
12
7
|
input: 'fui-Radio__input',
|
13
8
|
label: 'fui-Radio__label'
|
14
|
-
}; //
|
15
|
-
|
16
|
-
const spacingHorizontalS = '8px';
|
17
|
-
const spacingHorizontalM = '12px'; // The indicator size is used by the indicator and label styles
|
9
|
+
}; // The indicator size is used by the indicator and label styles
|
18
10
|
|
19
11
|
const indicatorSize = '16px';
|
20
12
|
/**
|
@@ -25,19 +17,17 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
25
17
|
"base": {
|
26
18
|
"mc9l5x": "ftuwxu6",
|
27
19
|
"qhf8xq": "f10pi13n",
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"uwmqm3": ["f177v4lu", "f19lj068"]
|
20
|
+
"z8tnut": "f1kwiid1",
|
21
|
+
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
22
|
+
"Byoj8tv": "f5b47ha",
|
23
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"]
|
33
24
|
},
|
34
25
|
"vertical": {
|
35
26
|
"Beiy3e4": "f1vx9l62",
|
36
|
-
"Bt984gj": "f122n59"
|
37
|
-
"Belr9w4": "fe5j3v"
|
27
|
+
"Bt984gj": "f122n59"
|
38
28
|
},
|
39
29
|
"focusIndicator": {
|
40
|
-
"
|
30
|
+
"Brovlpu": "ftqa4ok",
|
41
31
|
"vchsgm": "fbiesyy",
|
42
32
|
"ozrjjd": ["fq2kn9", "f1jxwnad"],
|
43
33
|
"B7lelfh": "f1il7mou",
|
@@ -68,8 +58,8 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
68
58
|
"Bj23z95": ["f8l10fm", "fxfgh6q"]
|
69
59
|
}
|
70
60
|
}, {
|
71
|
-
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".
|
72
|
-
"
|
61
|
+
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".f1kwiid1{padding-top:var(--spacingVerticalS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f5b47ha{padding-bottom:var(--spacingVerticalS);}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", "[data-keyboard-nav] .fbiesyy:focus-within{border-top-color:transparent;}", "[data-keyboard-nav] .fq2kn9:focus-within{border-right-color:transparent;}", "[data-keyboard-nav] .f1jxwnad:focus-within{border-left-color:transparent;}", "[data-keyboard-nav] .f1il7mou:focus-within{border-bottom-color:transparent;}", "[data-keyboard-nav] .f12sql3b:focus-within:after{content:\"\";}", "[data-keyboard-nav] .f1i4q40k:focus-within:after{position:absolute;}", "[data-keyboard-nav] .fcrbge9:focus-within:after{pointer-events:none;}", "[data-keyboard-nav] .fskqmiq:focus-within:after{z-index:1;}", "[data-keyboard-nav] .f1kbdjx9:focus-within:after{border-top-style:solid;}", "[data-keyboard-nav] .fw1d893:focus-within:after{border-right-style:solid;}", "[data-keyboard-nav] .fpuz8dn:focus-within:after{border-left-style:solid;}", "[data-keyboard-nav] .f14hlsw1:focus-within:after{border-bottom-style:solid;}", "[data-keyboard-nav] .f1bkt4b4:focus-within:after{border-top-width:2px;}", "[data-keyboard-nav] .f16hf5f2:focus-within:after{border-right-width:2px;}", "[data-keyboard-nav] .f1qhqcal:focus-within:after{border-left-width:2px;}", "[data-keyboard-nav] .fyyqeim:focus-within:after{border-bottom-width:2px;}", "[data-keyboard-nav] .f1aneyfs:focus-within:after{border-bottom-right-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f15nmyc0:focus-within:after{border-bottom-left-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f3cpy5b:focus-within:after{border-top-right-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f13v6kgv:focus-within:after{border-top-left-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .filx0we:focus-within:after{border-top-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1horip2:focus-within:after{border-right-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fgnx9ah:focus-within:after{border-left-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fkii2tb:focus-within:after{border-bottom-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1unftzx:focus-within:after{top:-2px;}", "[data-keyboard-nav] .f8rjbh6:focus-within:after{bottom:-2px;}", "[data-keyboard-nav] .fxfgh6q:focus-within:after{left:-2px;}", "[data-keyboard-nav] .f8l10fm:focus-within:after{right:-2px;}"],
|
62
|
+
"f": [".ftqa4ok:focus{outline-style:none;}"]
|
73
63
|
});
|
74
64
|
|
75
65
|
const useInputStyles = /*#__PURE__*/__styles({
|
@@ -163,17 +153,19 @@ const useIndicatorStyles = /*#__PURE__*/__styles({
|
|
163
153
|
const useLabelStyles = /*#__PURE__*/__styles({
|
164
154
|
"base": {
|
165
155
|
"qb2dma": "f7nlbp4",
|
166
|
-
"famaaq": "f1xqy1su"
|
156
|
+
"famaaq": "f1xqy1su"
|
157
|
+
},
|
158
|
+
"after": {
|
159
|
+
"Frg6f3": ["f199hnxi", "fkujibs"],
|
167
160
|
"B6of3ja": "fjzwpt6",
|
168
|
-
"
|
169
|
-
"jrapky": "fh6j2fo",
|
170
|
-
"Frg6f3": ["f1tyq0we", "f11qmguv"]
|
161
|
+
"jrapky": "fh6j2fo"
|
171
162
|
},
|
172
163
|
"below": {
|
164
|
+
"B6of3ja": "f1mevb6",
|
173
165
|
"fsow6f": "f17mccla"
|
174
166
|
}
|
175
167
|
}, {
|
176
|
-
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", ".
|
168
|
+
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", ".f199hnxi{margin-left:var(--spacingHorizontalM);}", ".fkujibs{margin-right:var(--spacingHorizontalM);}", ".fjzwpt6{margin-top:calc((16px - var(--lineHeightBase300)) / 2);}", ".fh6j2fo{margin-bottom:calc((16px - var(--lineHeightBase300)) / 2);}", ".f1mevb6{margin-top:var(--spacingVerticalM);}", ".f17mccla{text-align:center;}"]
|
177
169
|
});
|
178
170
|
/**
|
179
171
|
* Apply styling to the Radio slots based on the state
|
@@ -190,7 +182,7 @@ export const useRadioStyles_unstable = state => {
|
|
190
182
|
const labelStyles = useLabelStyles();
|
191
183
|
|
192
184
|
if (state.label) {
|
193
|
-
state.label.className = mergeClasses(radioClassNames.label, labelStyles.base, state.labelPosition
|
185
|
+
state.label.className = mergeClasses(radioClassNames.label, labelStyles.base, labelStyles[state.labelPosition], state.label.className);
|
194
186
|
}
|
195
187
|
};
|
196
188
|
//# sourceMappingURL=useRadioStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Radio/useRadioStyles.ts"],"names":[],"mappings":"AAAA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAIA
|
1
|
+
{"version":3,"sources":["components/Radio/useRadioStyles.ts"],"names":[],"mappings":"AAAA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAIA,OAAO,MAAM,eAAe,GAA+B;AACzD,EAAA,IAAI,EAAE,WADmD;AAEzD,EAAA,SAAS,EAAE,sBAF8C;AAGzD,EAAA,KAAK,EAAE,kBAHkD;AAIzD,EAAA,KAAK,EAAE;AAJkD,CAApD,C,CAOP;;AACA,MAAM,aAAa,GAAG,MAAtB;AAEA;;AAEG;;AACH,MAAM,aAAa,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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CAAC,IAAN,CAAW,SALsB,CAAnC;AAQA,QAAM,WAAW,GAAG,cAAc,EAAlC;AACA,EAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAAC,eAAe,CAAC,KAAjB,EAAwB,WAAW,CAAC,IAApC,EAA0C,KAAK,CAAC,KAAN,CAAY,SAAtD,CAApC;AAEA,QAAM,eAAe,GAAG,kBAAkB,EAA1C;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CAAC,eAAe,CAAC,SAAjB,EAA4B,eAAe,CAAC,IAA5C,EAAkD,KAAK,CAAC,SAAN,CAAgB,SAAlE,CAAxC;AAEA,QAAM,WAAW,GAAG,cAAc,EAAlC;;AACA,MAAI,KAAK,CAAC,KAAV,EAAiB;AACf,IAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAClC,eAAe,CAAC,KADkB,EAElC,WAAW,CAAC,IAFsB,EAGlC,WAAW,CAAC,KAAK,CAAC,aAAP,CAHuB,EAIlC,KAAK,CAAC,KAAN,CAAY,SAJsB,CAApC;AAMD;AACF,CAzBM","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { RadioSlots, RadioState } from './Radio.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const radioClassNames: SlotClassNames<RadioSlots> = {\n root: 'fui-Radio',\n indicator: 'fui-Radio__indicator',\n input: 'fui-Radio__input',\n label: 'fui-Radio__label',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSize = '16px';\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-flex',\n position: 'relative',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n },\n\n focusIndicator: createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useInputStyles = makeStyles({\n base: {\n position: 'absolute',\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n boxSizing: 'border-box',\n ...shorthands.margin(0),\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n },\n\n // When unchecked, hide the circle icon (child of the indicator)\n [`:not(:checked) ~ .${radioClassNames.indicator} > *`]: {\n opacity: '0',\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked)': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStroke),\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokeHover),\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokePressed),\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n // Colors for the disabled state\n ':disabled': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n width: indicatorSize,\n height: indicatorSize,\n fontSize: '12px',\n boxSizing: 'border-box',\n flexShrink: 0,\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n ...shorthands.overflow('hidden'),\n\n ...shorthands.border(tokens.strokeWidthThin, 'solid'),\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n userSelect: 'none',\n },\n\n after: {\n marginLeft: tokens.spacingHorizontalM,\n\n // Use a (negative) margin to account for the difference between the indicator's height and the label's line height.\n // This prevents the label from expanding the height of the Radio, but preserves line height if the label wraps.\n marginTop: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSize} - ${tokens.lineHeightBase300}) / 2)`,\n },\n\n below: {\n marginTop: tokens.spacingVerticalM,\n textAlign: 'center',\n },\n});\n\n/**\n * Apply styling to the Radio slots based on the state\n */\nexport const useRadioStyles_unstable = (state: RadioState) => {\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootStyles.base,\n rootStyles.focusIndicator,\n state.labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(radioClassNames.input, inputStyles.base, state.input.className);\n\n const indicatorStyles = useIndicatorStyles();\n state.indicator.className = mergeClasses(radioClassNames.indicator, indicatorStyles.base, state.indicator.className);\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n radioClassNames.label,\n labelStyles.base,\n labelStyles[state.labelPosition],\n state.label.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -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';\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' | '
|
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' | 'horizontal-stacked';\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 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/RadioGroup/useRadioGroupStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAIA
|
1
|
+
{"version":3,"sources":["components/RadioGroup/useRadioGroupStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAIA,OAAO,MAAM,oBAAoB,GAAoC;AACnE,EAAA,IAAI,EAAE;AAD6D,CAA9D;;AAIP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAWA;;AAEG;;;AACH,OAAO,MAAM,4BAA4B,GAAI,KAAD,IAA2B;AACrE,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,oBAAoB,CAAC,IADY,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,MAAN,KAAiB,UAAjB,IAA+B,MAAM,CAAC,QAHL,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;AAMD,CARM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { RadioGroupSlots, RadioGroupState } from './RadioGroup.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const radioGroupClassNames: SlotClassNames<RadioGroupSlots> = {\n root: 'fui-RadioGroup',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\n/**\n * Apply styling to the RadioGroup slots based on the state\n */\nexport const useRadioGroupStyles_unstable = (state: RadioGroupState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n radioGroupClassNames.root,\n styles.root,\n state.layout === 'vertical' && styles.vertical,\n state.root.className,\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import { createContext } from '@fluentui/react-context-selector';
|
1
|
+
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
2
|
/**
|
3
3
|
* RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.
|
4
4
|
*/
|
5
5
|
|
6
6
|
export const RadioGroupContext = /*#__PURE__*/createContext({});
|
7
|
+
export const RadioGroupProvider = RadioGroupContext.Provider;
|
8
|
+
export const useRadioGroupContext_unstable = selector => useContextSelector(RadioGroupContext, selector);
|
7
9
|
//# sourceMappingURL=RadioGroupContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,
|
1
|
+
{"version":3,"sources":["contexts/RadioGroupContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAmE,kCAAnE;AAIA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,gBAAoC,aAAa,CAAC,EAAD,CAAxE;AAEP,OAAO,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,QAA7C;AAEP,OAAO,MAAM,6BAA6B,GAAO,QAAJ,IAC3C,kBAAkB,CAAC,iBAAD,EAAoB,QAApB,CADb","sourcesContent":["import { createContext, useContextSelector, ContextSelector } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { RadioGroupContextValue } from '../RadioGroup';\n\n/**\n * RadioGroupContext is provided by RadioGroup, and is consumed by Radio to determine default values of some props.\n */\nexport const RadioGroupContext: Context<RadioGroupContextValue> = createContext({});\n\nexport const RadioGroupProvider = RadioGroupContext.Provider;\n\nexport const useRadioGroupContext_unstable = <T>(selector: ContextSelector<RadioGroupContextValue, T>): T =>\n useContextSelector(RadioGroupContext, selector);\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
export { RadioGroup,
|
2
|
-
|
3
|
-
|
4
|
-
export { Radio,
|
5
|
-
/* eslint-disable-next-line deprecation/deprecation */
|
6
|
-
radioClassName, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';
|
7
|
-
export { RadioGroupContext, useRadioGroupContextValues } from './contexts/index';
|
1
|
+
export { RadioGroup, radioGroupClassNames, renderRadioGroup_unstable, useRadioGroupStyles_unstable, useRadioGroup_unstable } from './RadioGroup';
|
2
|
+
export { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';
|
3
|
+
export { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable } from './contexts/index';
|
8
4
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,UADF
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,UADF,EAEE,oBAFF,EAGE,yBAHF,EAIE,4BAJF,EAKE,sBALF,QAMO,cANP;AAeA,SAAS,KAAT,EAAgB,eAAhB,EAAiC,oBAAjC,EAAuD,uBAAvD,EAAgF,iBAAhF,QAAyG,SAAzG;AAEA,SAAS,kBAAT,EAA6B,0BAA7B,EAAyD,6BAAzD,QAA8F,kBAA9F","sourcesContent":["export {\n RadioGroup,\n radioGroupClassNames,\n renderRadioGroup_unstable,\n useRadioGroupStyles_unstable,\n useRadioGroup_unstable,\n} from './RadioGroup';\nexport type {\n RadioGroupContextValue,\n RadioGroupContextValues,\n RadioGroupOnChangeData,\n RadioGroupProps,\n RadioGroupSlots,\n RadioGroupState,\n} from './RadioGroup';\nexport { Radio, radioClassNames, renderRadio_unstable, useRadioStyles_unstable, useRadio_unstable } from './Radio';\nexport type { RadioProps, RadioSlots, RadioState, RadioOnChangeData } from './Radio';\nexport { RadioGroupProvider, useRadioGroupContextValues, useRadioGroupContext_unstable } from './contexts/index';\n"],"sourceRoot":"../src/"}
|
@@ -38,7 +38,7 @@ const useRadio_unstable = (props, ref) => {
|
|
38
38
|
name = nameGroup,
|
39
39
|
checked = value !== undefined ? value === props.value : undefined,
|
40
40
|
defaultChecked = defaultValue !== undefined ? defaultValue === props.value : undefined,
|
41
|
-
labelPosition = layout === '
|
41
|
+
labelPosition = layout === 'horizontal-stacked' ? 'below' : 'after',
|
42
42
|
disabled = disabledGroup,
|
43
43
|
required = requiredGroup,
|
44
44
|
onChange
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Radio/useRadio.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAA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AM,KAAK,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,KAAvB,EAA8B;AAC1C,IAAA,YAAY,EAAE;AACZ,MAAA,OAAO,EAAE,KAAK,CAAC,EADH;AAEZ,MAAA;AAFY;AAD4B,GAA9B,CAAd;AAOA,QAAM,SAAS,GAAG,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,SAAvB,EAAkC;AAClD,IAAA,QAAQ,EAAE,IADwC;AAElD,IAAA,YAAY,EAAE;AACZ,qBAAe,IADH;AAEZ,MAAA,QAAQ,EAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,YAAD,EAAa,IAAb;AAFE;AAFoC,GAAlC,CAAlB;AAQA,SAAO;AACL,IAAA,aADK;AAEL,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,MADI;AAEV,MAAA,KAAK,EAAE,OAFG;AAGV,MAAA,KAAK,EAAE,aAAA,CAAA,KAHG;AAIV,MAAA,SAAS,EAAE;AAJD,KAFP;AAQL,IAAA,IARK;AASL,IAAA,KATK;AAUL,IAAA,KAVK;AAWL,IAAA;AAXK,GAAP;AAaD,CA1EM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","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 === 'horizontal-stacked' ? '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/"}
|