@fluentui/react-radio 9.0.12 → 9.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +40 -1
- package/CHANGELOG.md +15 -2
- package/lib/components/Radio/useRadioStyles.js +29 -29
- package/lib-commonjs/components/Radio/useRadioStyles.js +29 -29
- package/package.json +5 -5
- package/Spec.md +0 -292
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,46 @@
|
|
2
2
|
"name": "@fluentui/react-radio",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Mon, 05 Dec 2022 18:25:27 GMT",
|
6
|
+
"tag": "@fluentui/react-radio_v9.0.13",
|
7
|
+
"version": "9.0.13",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "tristan.watanabe@gmail.com",
|
12
|
+
"package": "@fluentui/react-radio",
|
13
|
+
"commit": "536d01dceb058546fbd97b9118e7248df7d19f88",
|
14
|
+
"comment": "chore: Migrate to new package structure."
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-radio",
|
19
|
+
"comment": "Bump @fluentui/react-field to v9.0.0-alpha.10",
|
20
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-radio",
|
25
|
+
"comment": "Bump @fluentui/react-label to v9.0.12",
|
26
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-radio",
|
31
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.2",
|
32
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-radio",
|
37
|
+
"comment": "Bump @fluentui/react-theme to v9.1.3",
|
38
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"date": "Thu, 17 Nov 2022 23:05:45 GMT",
|
6
45
|
"tag": "@fluentui/react-radio_v9.0.12",
|
7
46
|
"version": "9.0.12",
|
8
47
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# Change Log - @fluentui/react-radio
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 05 Dec 2022 18:25:27 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.13)
|
8
|
+
|
9
|
+
Mon, 05 Dec 2022 18:25:27 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.12..@fluentui/react-radio_v9.0.13)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: Migrate to new package structure. ([PR #25810](https://github.com/microsoft/fluentui/pull/25810) by tristan.watanabe@gmail.com)
|
15
|
+
- Bump @fluentui/react-field to v9.0.0-alpha.10 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
16
|
+
- Bump @fluentui/react-label to v9.0.12 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
17
|
+
- Bump @fluentui/react-tabster to v9.3.2 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
18
|
+
- Bump @fluentui/react-theme to v9.1.3 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
19
|
+
|
7
20
|
## [9.0.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.12)
|
8
21
|
|
9
|
-
Thu, 17 Nov 2022 23:
|
22
|
+
Thu, 17 Nov 2022 23:05:45 GMT
|
10
23
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.11..@fluentui/react-radio_v9.0.12)
|
11
24
|
|
12
25
|
### Patches
|
@@ -25,37 +25,37 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
25
25
|
"focusIndicator": {
|
26
26
|
"Brovlpu": "ftqa4ok",
|
27
27
|
"B486eqv": "f2hkw1w",
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
28
|
+
"Bssx7fj": "f1b1k54r",
|
29
|
+
"uh7if5": ["f4ne723", "fqqcjud"],
|
30
|
+
"clntm0": "fh7aioi",
|
31
|
+
"Dlk2r6": ["fqqcjud", "f4ne723"],
|
32
|
+
"B2j2mmj": "ffht0p2",
|
33
|
+
"wigs8": "f1p0ul1q",
|
34
|
+
"pbfy6t": "f1c901ms",
|
35
|
+
"B0v4ure": "f1alokd7",
|
36
|
+
"ghq09": "f78i1la",
|
37
|
+
"B24cy0v": ["f1kvsw7t", "f1bw8brt"],
|
38
|
+
"Bwckmig": "f8k7e5g",
|
39
|
+
"Bvwlmkc": ["f1bw8brt", "f1kvsw7t"],
|
40
|
+
"Bbgo44z": "f1pmxfrl",
|
41
|
+
"Bil7v7r": ["fszkfcr", "f1ap5ily"],
|
42
|
+
"skfxo0": "f57dp0y",
|
43
|
+
"jo1ztg": ["f1ap5ily", "fszkfcr"],
|
44
|
+
"Ba3ybja": ["f11dm2qb", "f136rfnd"],
|
45
|
+
"az1dzo": ["f136rfnd", "f11dm2qb"],
|
46
|
+
"vppk2z": ["fdsq1qd", "f1khssms"],
|
47
|
+
"B6352mv": ["f1khssms", "fdsq1qd"],
|
48
|
+
"nr063g": "fq4eyks",
|
49
|
+
"Blmvk6g": ["f1ya6x16", "ftuszwa"],
|
50
|
+
"Bsiemmq": "f1e2iu44",
|
51
|
+
"B98u21t": ["ftuszwa", "f1ya6x16"],
|
52
|
+
"B2pnrqr": "f1xkdug0",
|
53
|
+
"Bhhzhcn": "f1m1ywml",
|
54
|
+
"Bec0n69": ["f7u4kgv", "f1a36mvi"],
|
55
|
+
"B29w5g4": ["f1a36mvi", "f7u4kgv"]
|
56
56
|
}
|
57
57
|
}, {
|
58
|
-
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".
|
58
|
+
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".f1b1k54r[data-fui-focus-within]:focus-within{border-top-color:transparent;}", ".f4ne723[data-fui-focus-within]:focus-within{border-right-color:transparent;}", ".fqqcjud[data-fui-focus-within]:focus-within{border-left-color:transparent;}", ".fh7aioi[data-fui-focus-within]:focus-within{border-bottom-color:transparent;}", ".ffht0p2[data-fui-focus-within]:focus-within::after{content:\"\";}", ".f1p0ul1q[data-fui-focus-within]:focus-within::after{position:absolute;}", ".f1c901ms[data-fui-focus-within]:focus-within::after{pointer-events:none;}", ".f1alokd7[data-fui-focus-within]:focus-within::after{z-index:1;}", ".f78i1la[data-fui-focus-within]:focus-within::after{border-top-style:solid;}", ".f1kvsw7t[data-fui-focus-within]:focus-within::after{border-right-style:solid;}", ".f1bw8brt[data-fui-focus-within]:focus-within::after{border-left-style:solid;}", ".f8k7e5g[data-fui-focus-within]:focus-within::after{border-bottom-style:solid;}", ".f1pmxfrl[data-fui-focus-within]:focus-within::after{border-top-width:2px;}", ".fszkfcr[data-fui-focus-within]:focus-within::after{border-right-width:2px;}", ".f1ap5ily[data-fui-focus-within]:focus-within::after{border-left-width:2px;}", ".f57dp0y[data-fui-focus-within]:focus-within::after{border-bottom-width:2px;}", ".f11dm2qb[data-fui-focus-within]:focus-within::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f136rfnd[data-fui-focus-within]:focus-within::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fdsq1qd[data-fui-focus-within]:focus-within::after{border-top-right-radius:var(--borderRadiusMedium);}", ".f1khssms[data-fui-focus-within]:focus-within::after{border-top-left-radius:var(--borderRadiusMedium);}", ".fq4eyks[data-fui-focus-within]:focus-within::after{border-top-color:var(--colorStrokeFocus2);}", ".f1ya6x16[data-fui-focus-within]:focus-within::after{border-right-color:var(--colorStrokeFocus2);}", ".ftuszwa[data-fui-focus-within]:focus-within::after{border-left-color:var(--colorStrokeFocus2);}", ".f1e2iu44[data-fui-focus-within]:focus-within::after{border-bottom-color:var(--colorStrokeFocus2);}", ".f1xkdug0[data-fui-focus-within]:focus-within::after{top:-2px;}", ".f1m1ywml[data-fui-focus-within]:focus-within::after{bottom:-2px;}", ".f7u4kgv[data-fui-focus-within]:focus-within::after{left:-2px;}", ".f1a36mvi[data-fui-focus-within]:focus-within::after{right:-2px;}"],
|
59
59
|
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
60
60
|
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
61
61
|
});
|
@@ -35,37 +35,37 @@ const useRootStyles = /*#__PURE__*/react_1.__styles({
|
|
35
35
|
"focusIndicator": {
|
36
36
|
"Brovlpu": "ftqa4ok",
|
37
37
|
"B486eqv": "f2hkw1w",
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
38
|
+
"Bssx7fj": "f1b1k54r",
|
39
|
+
"uh7if5": ["f4ne723", "fqqcjud"],
|
40
|
+
"clntm0": "fh7aioi",
|
41
|
+
"Dlk2r6": ["fqqcjud", "f4ne723"],
|
42
|
+
"B2j2mmj": "ffht0p2",
|
43
|
+
"wigs8": "f1p0ul1q",
|
44
|
+
"pbfy6t": "f1c901ms",
|
45
|
+
"B0v4ure": "f1alokd7",
|
46
|
+
"ghq09": "f78i1la",
|
47
|
+
"B24cy0v": ["f1kvsw7t", "f1bw8brt"],
|
48
|
+
"Bwckmig": "f8k7e5g",
|
49
|
+
"Bvwlmkc": ["f1bw8brt", "f1kvsw7t"],
|
50
|
+
"Bbgo44z": "f1pmxfrl",
|
51
|
+
"Bil7v7r": ["fszkfcr", "f1ap5ily"],
|
52
|
+
"skfxo0": "f57dp0y",
|
53
|
+
"jo1ztg": ["f1ap5ily", "fszkfcr"],
|
54
|
+
"Ba3ybja": ["f11dm2qb", "f136rfnd"],
|
55
|
+
"az1dzo": ["f136rfnd", "f11dm2qb"],
|
56
|
+
"vppk2z": ["fdsq1qd", "f1khssms"],
|
57
|
+
"B6352mv": ["f1khssms", "fdsq1qd"],
|
58
|
+
"nr063g": "fq4eyks",
|
59
|
+
"Blmvk6g": ["f1ya6x16", "ftuszwa"],
|
60
|
+
"Bsiemmq": "f1e2iu44",
|
61
|
+
"B98u21t": ["ftuszwa", "f1ya6x16"],
|
62
|
+
"B2pnrqr": "f1xkdug0",
|
63
|
+
"Bhhzhcn": "f1m1ywml",
|
64
|
+
"Bec0n69": ["f7u4kgv", "f1a36mvi"],
|
65
|
+
"B29w5g4": ["f1a36mvi", "f7u4kgv"]
|
66
66
|
}
|
67
67
|
}, {
|
68
|
-
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".
|
68
|
+
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".f1b1k54r[data-fui-focus-within]:focus-within{border-top-color:transparent;}", ".f4ne723[data-fui-focus-within]:focus-within{border-right-color:transparent;}", ".fqqcjud[data-fui-focus-within]:focus-within{border-left-color:transparent;}", ".fh7aioi[data-fui-focus-within]:focus-within{border-bottom-color:transparent;}", ".ffht0p2[data-fui-focus-within]:focus-within::after{content:\"\";}", ".f1p0ul1q[data-fui-focus-within]:focus-within::after{position:absolute;}", ".f1c901ms[data-fui-focus-within]:focus-within::after{pointer-events:none;}", ".f1alokd7[data-fui-focus-within]:focus-within::after{z-index:1;}", ".f78i1la[data-fui-focus-within]:focus-within::after{border-top-style:solid;}", ".f1kvsw7t[data-fui-focus-within]:focus-within::after{border-right-style:solid;}", ".f1bw8brt[data-fui-focus-within]:focus-within::after{border-left-style:solid;}", ".f8k7e5g[data-fui-focus-within]:focus-within::after{border-bottom-style:solid;}", ".f1pmxfrl[data-fui-focus-within]:focus-within::after{border-top-width:2px;}", ".fszkfcr[data-fui-focus-within]:focus-within::after{border-right-width:2px;}", ".f1ap5ily[data-fui-focus-within]:focus-within::after{border-left-width:2px;}", ".f57dp0y[data-fui-focus-within]:focus-within::after{border-bottom-width:2px;}", ".f11dm2qb[data-fui-focus-within]:focus-within::after{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f136rfnd[data-fui-focus-within]:focus-within::after{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fdsq1qd[data-fui-focus-within]:focus-within::after{border-top-right-radius:var(--borderRadiusMedium);}", ".f1khssms[data-fui-focus-within]:focus-within::after{border-top-left-radius:var(--borderRadiusMedium);}", ".fq4eyks[data-fui-focus-within]:focus-within::after{border-top-color:var(--colorStrokeFocus2);}", ".f1ya6x16[data-fui-focus-within]:focus-within::after{border-right-color:var(--colorStrokeFocus2);}", ".ftuszwa[data-fui-focus-within]:focus-within::after{border-left-color:var(--colorStrokeFocus2);}", ".f1e2iu44[data-fui-focus-within]:focus-within::after{border-bottom-color:var(--colorStrokeFocus2);}", ".f1xkdug0[data-fui-focus-within]:focus-within::after{top:-2px;}", ".f1m1ywml[data-fui-focus-within]:focus-within::after{bottom:-2px;}", ".f7u4kgv[data-fui-focus-within]:focus-within::after{left:-2px;}", ".f1a36mvi[data-fui-focus-within]:focus-within::after{right:-2px;}"],
|
69
69
|
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
70
70
|
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
71
71
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-radio",
|
3
|
-
"version": "9.0.
|
3
|
+
"version": "9.0.13",
|
4
4
|
"description": "Fluent UI Radio component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -31,11 +31,11 @@
|
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
33
|
"@fluentui/react-context-selector": "^9.1.2",
|
34
|
-
"@fluentui/react-field": "9.0.0-alpha.
|
34
|
+
"@fluentui/react-field": "9.0.0-alpha.10",
|
35
35
|
"@fluentui/react-icons": "^2.0.175",
|
36
|
-
"@fluentui/react-label": "^9.0.
|
37
|
-
"@fluentui/react-tabster": "^9.3.
|
38
|
-
"@fluentui/react-theme": "^9.1.
|
36
|
+
"@fluentui/react-label": "^9.0.12",
|
37
|
+
"@fluentui/react-tabster": "^9.3.2",
|
38
|
+
"@fluentui/react-theme": "^9.1.3",
|
39
39
|
"@fluentui/react-utilities": "^9.2.2",
|
40
40
|
"@griffel/react": "^1.4.2",
|
41
41
|
"tslib": "^2.1.0"
|
package/Spec.md
DELETED
@@ -1,292 +0,0 @@
|
|
1
|
-
# @fluentui/react-radio Spec
|
2
|
-
|
3
|
-
A Radio allows a user to select a single value from two or more options. All Radios with the same `name` are considered to be part of the same group. However, a `RadioGroup` is recommended to add a group label, formatting, and other functionality.
|
4
|
-
|
5
|
-
## Background
|
6
|
-
|
7
|
-
### Prior Art
|
8
|
-
|
9
|
-
- [OpenUI research](https://open-ui.org/components/radio-button.research)
|
10
|
-
- [Epic](https://github.com/microsoft/fluentui/issues/19953)
|
11
|
-
|
12
|
-
### Comparison of [Fabric ChoiceGroup](https://developer.microsoft.com/en-us/fluentui#/controls/web/choicegroup) and [Stardust RadioGroup](https://fluentsite.z22.web.core.windows.net/components/radio-group/definition)
|
13
|
-
|
14
|
-
- All mentions of v7 or v8 refer to Fabric - `@fluentui/react` ([docsite](https://developer.microsoft.com/en-us/fluentui#/))
|
15
|
-
- All mentions of v0 refer to Northstar - `@fluentui/react-northstar` ([docsite](https://fluentsite.z22.web.core.windows.net/))
|
16
|
-
|
17
|
-
See Appendix for a detailed comparison of the two components.
|
18
|
-
|
19
|
-
In Fabric the Radio component is represented by the [ChoiceGroup](https://developer.microsoft.com/en-us/fluentui#/controls/web/choicegroup) component.
|
20
|
-
Fabric creates options based on data passed in via the `options` prop.
|
21
|
-
It uses the option's `key` property as the input value and holds the currently selected value in the `selectedKey` prop.
|
22
|
-
Fabric also allows an image to serve as a label for an option.
|
23
|
-
|
24
|
-
```tsx
|
25
|
-
<ChoiceGroup
|
26
|
-
defaultSelectedKey="B"
|
27
|
-
options={[
|
28
|
-
{ key: 'A', text: 'Option A' },
|
29
|
-
{ key: 'B', text: 'Option B' },
|
30
|
-
{ key: 'C', text: 'Option C', disabled: true },
|
31
|
-
{ key: 'D', text: 'Option D' },
|
32
|
-
]}
|
33
|
-
label="Pick one"
|
34
|
-
required={true}
|
35
|
-
/>
|
36
|
-
```
|
37
|
-
|
38
|
-
In Northstar the Radio component is represented by the [RadioGroup](https://fluentsite.z22.web.core.windows.net/components/radio-group/definition) component.
|
39
|
-
Northstar creates options based on data passed in via the `items` prop.
|
40
|
-
It uses the option's `value` property as the input value and holds the currently selected value in the `checkedValue` prop.
|
41
|
-
|
42
|
-
```tsx
|
43
|
-
<RadioGroup
|
44
|
-
onCheckedValueChange={handleChange}
|
45
|
-
items={[
|
46
|
-
{ key: '1', label: 'Make your choice', value: '1' },
|
47
|
-
{ key: '2', label: 'Another option', value: '2' },
|
48
|
-
]}
|
49
|
-
/>
|
50
|
-
```
|
51
|
-
|
52
|
-
## Variants
|
53
|
-
|
54
|
-
### Layout
|
55
|
-
|
56
|
-
#### Horizonal
|
57
|
-
|
58
|
-
Inline positioning of the inputs and labels.
|
59
|
-
|
60
|
-
![Horizontal group](./etc/images/horizontal-group.png)
|
61
|
-
|
62
|
-
#### Horizonal stacked
|
63
|
-
|
64
|
-
Positioning the label at the bottom of the radio inputs.
|
65
|
-
|
66
|
-
![Horizontal group - stacked](./etc/images/horizontal-group-stacked.png)
|
67
|
-
|
68
|
-
#### Vertical
|
69
|
-
|
70
|
-
Default vertical positioning of Radio items.
|
71
|
-
|
72
|
-
![Vertical group](./etc/images/vertical-group.png)
|
73
|
-
|
74
|
-
#### Vertical with input
|
75
|
-
|
76
|
-
Default positioning of Radio items with an input as its last Radio item.
|
77
|
-
|
78
|
-
![Vertical group with input](./etc/images/vertical-group-with-input.png)
|
79
|
-
|
80
|
-
### Vertical with dropdown
|
81
|
-
|
82
|
-
Default positioning of Radio items with a dropdown as its last Radio item.
|
83
|
-
|
84
|
-
![Vertical group with dropdown](./etc/images/vertical-group-with-dropdown.png)
|
85
|
-
|
86
|
-
## API
|
87
|
-
|
88
|
-
### Components
|
89
|
-
|
90
|
-
| Component | Purpose |
|
91
|
-
| ----------------- | ------------------------------------------------------------------------------- |
|
92
|
-
| RadioGroup | Wraps radio inputs. Provides RadioGroupContext and layout for the radio items. |
|
93
|
-
| RadioGroupContext | Provides some props like `name` to Radio items that are children of RadioGroup. |
|
94
|
-
| Radio | Represents a single radio item (input and label). |
|
95
|
-
|
96
|
-
### RadioGroup
|
97
|
-
|
98
|
-
Link to [RadioGroup.types.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-radio/src/components/RadioGroup/RadioGroup.types.ts)
|
99
|
-
|
100
|
-
| Prop | Type | Default value | Purpose |
|
101
|
-
| -------------- | --------------------------------------------------- | ---------------------- | -------------------------------------------------------- |
|
102
|
-
| (root) | slot: `<div role="radiogroup">` | | The root slot has the radiogroup role. |
|
103
|
-
| `name` | `string` | `useId('radiogroup-')` | Name property passed to child radios. |
|
104
|
-
| `value` | `string` | | Currently selected value. Used only for controlled mode. |
|
105
|
-
| `defaultValue` | `string` | | Default selected value. |
|
106
|
-
| `disabled` | `boolean` | `false` | Disables all radio items inside the group. |
|
107
|
-
| `layout` | `"vertical" \| "horizontal" \| "horizontalStacked"` | `vertical` | Specifies the layout of the radio items. |
|
108
|
-
| `onChange` | `(event, data: { value: string }) => void` | | Callback when a radio item is selected. |
|
109
|
-
|
110
|
-
### RadioGroupContext
|
111
|
-
|
112
|
-
This is a context object provided by RadioGroup that allows all of the child Radio items to have the same name, and coordinate the selected item.
|
113
|
-
|
114
|
-
The context contains the following props from RadioGroup:
|
115
|
-
|
116
|
-
- `name`
|
117
|
-
- `layout`
|
118
|
-
- `defaultValue`
|
119
|
-
- `value`
|
120
|
-
- `disabled`
|
121
|
-
|
122
|
-
### Radio
|
123
|
-
|
124
|
-
Link to [Radio.types.ts](https://github.com/microsoft/fluentui/blob/master/packages/react-radio/src/components/Radio/Radio.types.ts)
|
125
|
-
|
126
|
-
| Prop | Type | Purpose |
|
127
|
-
| ----------- | ---------------------------- | ------------------------------------------------------------------- |
|
128
|
-
| (root) | slot: `<span>` | Wrapper for the input, indicator, and label |
|
129
|
-
| `input` | slot: `<input type="radio">` | Hidden input element that handles the radio's behavior. |
|
130
|
-
| `indicator` | slot: `<div>` | The circular indicator to show the radio's checked/unchecked state. |
|
131
|
-
| `label` | slot: `<Label>` | Label that will be rendered next to the radio indicator. |
|
132
|
-
| `value` | `string` | The value of the RadioGroup when this Radio is selected |
|
133
|
-
| `checked` | `boolean` | Whether the input is checked or not. |
|
134
|
-
| `disabled` | `boolean` | Whether the input is disabled or not. |
|
135
|
-
|
136
|
-
## Sample Code
|
137
|
-
|
138
|
-
A simple `RadioGroup`.
|
139
|
-
|
140
|
-
```jsx
|
141
|
-
<RadioGroup defaultValue="one">
|
142
|
-
<Radio value="one" label="Option One" />
|
143
|
-
<Radio value="two" label="Option Two" />
|
144
|
-
<Radio value="three" label="Option Three" />
|
145
|
-
</RadioGroup>
|
146
|
-
```
|
147
|
-
|
148
|
-
`Radio` can be used without a `RadioGroup`, but it is then up to the user to add the same `name` to each item:
|
149
|
-
|
150
|
-
```jsx
|
151
|
-
<>
|
152
|
-
<Radio name="number" value="one" label="Option One" defaultChecked />
|
153
|
-
<Radio name="number" value="two" label="Option Two" />
|
154
|
-
<Radio name="number" value="three" label="Option Three" />
|
155
|
-
</>
|
156
|
-
```
|
157
|
-
|
158
|
-
## Structure
|
159
|
-
|
160
|
-
### Expected DOM structure
|
161
|
-
|
162
|
-
```html
|
163
|
-
<div role="radiogroup" class="fui-RadioGroup" name="radiogroup-0">
|
164
|
-
<span class="fui-Radio">
|
165
|
-
<input type="radio" id="radio-1" name="radiogroup-0" value="one" checked />
|
166
|
-
<div class="fui-Radio__indicator">
|
167
|
-
<svg><circle /></svg>
|
168
|
-
</div>
|
169
|
-
<label class="fui-Label" for="radio-1">Option One</label>
|
170
|
-
</span>
|
171
|
-
|
172
|
-
<span class="fui-Radio">
|
173
|
-
<input type="radio" id="radio-2" name="radiogroup-0" value="two" />
|
174
|
-
<div class="fui-Radio__indicator">
|
175
|
-
<svg><circle /></svg>
|
176
|
-
</div>
|
177
|
-
<label class="fui-Label" for="radio-2">Option Two</label>
|
178
|
-
</span>
|
179
|
-
|
180
|
-
<span class="fui-Radio">
|
181
|
-
<input type="radio" id="radio-3" name="radiogroup-0" value="three" />
|
182
|
-
<div class="fui-Radio__indicator">
|
183
|
-
<svg><circle /></svg>
|
184
|
-
</div>
|
185
|
-
<label class="fui-Label" for="radio-3">Option Three</label>
|
186
|
-
</span>
|
187
|
-
</div>
|
188
|
-
```
|
189
|
-
|
190
|
-
## Behaviors
|
191
|
-
|
192
|
-
### Mouse/Touch
|
193
|
-
|
194
|
-
The Radio's hit target fills the entire space around the indicator and label (including the padding).
|
195
|
-
|
196
|
-
### Keyboard
|
197
|
-
|
198
|
-
RadioGroup inherits all of its mouse and keyboard behaviors from the browser's handling of `<input type="radio">`.
|
199
|
-
|
200
|
-
- It has no special handling of clicks or keypresses for toggling beyond the built-in control.
|
201
|
-
- The browser handles arrow key selection, and creating a single tab stop for the control.
|
202
|
-
|
203
|
-
### Disabled
|
204
|
-
|
205
|
-
- Individual Radio items can be disabled, in which case they are grayed out and can't be selected or focused.
|
206
|
-
- This interaction is built-into the browser by setting `disabled` on the `<input>` control.
|
207
|
-
- The entire RadioGroup can be disabled, which uses RadioGroupContext to disable all of the individual Radio items.
|
208
|
-
|
209
|
-
### Group Name
|
210
|
-
|
211
|
-
- All Radio items in a group must have the same `name` for the browser to handle keyboarding and selection.
|
212
|
-
- The RadioGroup provides its `name` through RadioGroupContext, and each Radio inside applies the `name`.
|
213
|
-
- If a `name` is not provided on RadioGroup, a unique name is automatically generated with `useId`.
|
214
|
-
|
215
|
-
## Accessibility
|
216
|
-
|
217
|
-
### RadioGroup
|
218
|
-
|
219
|
-
This implementation based on the [Grouping Controls](https://www.w3.org/WAI/tutorials/forms/grouping/) examples of Web Accessibility Tutorials (that follow WCAG).
|
220
|
-
|
221
|
-
- The RadioGroup root is a `<div role="radiogroup">` to provide the default accessibility behavior of a radiogroup.
|
222
|
-
- If a group label is added, the RadioGroup needs to have `aria-labelledby` referencing the label.
|
223
|
-
|
224
|
-
### Radio
|
225
|
-
|
226
|
-
- The Radio's primary slot is an `<input type="radio">`, with opacity 0, and covers the root.
|
227
|
-
- This way, the Radio's hit target fills the entire space around the indicator and label (including the padding).
|
228
|
-
- The Radio's label is a `<label>` element with `for={input.id}` to associate it with the input slot.
|
229
|
-
|
230
|
-
<!--
|
231
|
-
## Migration
|
232
|
-
TBD: Link to Migration guide
|
233
|
-
-->
|
234
|
-
|
235
|
-
# Appendix
|
236
|
-
|
237
|
-
## v8 vs v0 comparison
|
238
|
-
|
239
|
-
### RadioGroup (v0) vs ChoiceGroup (v8) prop mapping
|
240
|
-
|
241
|
-
_⚠️ Props not included in this section are marked as deprecated and will not be considered._
|
242
|
-
|
243
|
-
| Purpose | Fabric (v8) | Northstar (v0) | Matching |
|
244
|
-
| ------------------------------------------------------------------------------------------------- | ------------------ | -------------------- | ------------------------------------------ |
|
245
|
-
| Called after radio group value is changed. | onChange | onCheckedValueChange | Matching 🛠️ |
|
246
|
-
| The options/items for the group. | options | items | Matching |
|
247
|
-
| Additional CSS styles to apply to the component instance. | styles | styles | Matching |
|
248
|
-
| Initial checkedValue value. | defaultSelectedKey | defaultCheckedValue | Matching functionality, not implementation |
|
249
|
-
| Value of the currently checked radio item. | selectedKey | checkedValue | Matching functionality, not implementation |
|
250
|
-
| Theme - Override for theme site variables to allow modifications of component styling via themes. | theme | variables | Matching |
|
251
|
-
| ID of an element to use as the aria label for this ChoiceGroup. | ariaLabelledBy | - | - |
|
252
|
-
| Optional callback to access the `IChoiceGroup` interface. | componentRef | - | - |
|
253
|
-
| Descriptive label for the choice group. | label | - | - |
|
254
|
-
| Accessibility behavior if overridden by the user. | - | accessibility | - |
|
255
|
-
| An element type to render as (string or component). | - | as | - |
|
256
|
-
| Additional CSS class name(s) to apply. | - | className | - |
|
257
|
-
| A vertical radio group displays elements vertically. | - | vertical | - |
|
258
|
-
| - | - | design | - |
|
259
|
-
|
260
|
-
### RadioItem (v0) vs ChoiceGroupOption (v8) props mapping
|
261
|
-
|
262
|
-
| Purpose | Fabric (v8) | Northstar (v0) | Matching |
|
263
|
-
| ------------------------------------------------------------------------------- | ------------------ | ---------------- | -------- |
|
264
|
-
| A required key to uniquely identify the option. | key (required) | - | - |
|
265
|
-
| The text string for the option. | text (required) ❓ | label | Matching |
|
266
|
-
| Call to provide customized styling that will layer on top of the variant rules. | styles | styles | Matching |
|
267
|
-
| A radio item can appear disabled and be unable to change states. | disabled | disabled | Matching |
|
268
|
-
| Aria label of the option for the benefit of screen reader users. | ariaLabel | - | - |
|
269
|
-
| Props for an icon to display with this option. | iconProps | - | - |
|
270
|
-
| ID used on the option's input element. | id | - | - |
|
271
|
-
| Alt text if the option is an image. | imageAlt | - | - |
|
272
|
-
| The width and height of the image in px for choice field. | imageSize | - | - |
|
273
|
-
| Image to display with this option. | imageSrc | - | - |
|
274
|
-
| ID used on the option's label. | labelId | - | - |
|
275
|
-
| Used to customize option rendering. | onRenderField | - | - |
|
276
|
-
| Used to customize label rendering. | onRenderLabel | - | - |
|
277
|
-
| The src of image for choice field which is selected. | selectedImageSrc | - | - |
|
278
|
-
| Accessibility behavior if overridden by the user. | - | accessibility | - |
|
279
|
-
| Whether or not radio item is checked. | - | checked | - |
|
280
|
-
| The checked radio item indicator can be customized. | - | checkedIndicator | - |
|
281
|
-
| Initial checked value. | - | defaultChecked | - |
|
282
|
-
| The radio item indicator can be customized. | - | indicator | - |
|
283
|
-
| The HTML input name. | - | name | - |
|
284
|
-
| Called after radio item checked state is changed. | - | onChange | - |
|
285
|
-
| Called after radio item is clicked. | - | onClick | - |
|
286
|
-
| Whether should focus when checked | - | shouldFocus | - |
|
287
|
-
| The HTML input value. | - | value | - |
|
288
|
-
| A vertical radio group displays elements vertically. | - | vertical | - |
|
289
|
-
| - | - | as | - |
|
290
|
-
| - | - | className | - |
|
291
|
-
| - | - | variables | - |
|
292
|
-
| - | - | design | - |
|