@fluentui/react-radio 9.0.12 → 9.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +91 -1
- package/CHANGELOG.md +30 -2
- package/lib/components/Radio/useRadioStyles.js +16 -139
- package/lib/components/Radio/useRadioStyles.js.map +1 -1
- package/lib-amd/components/Radio/useRadioStyles.js +74 -36
- package/lib-amd/components/Radio/useRadioStyles.js.map +1 -1
- package/lib-commonjs/components/Radio/useRadioStyles.js +15 -138
- package/lib-commonjs/components/Radio/useRadioStyles.js.map +1 -1
- package/package.json +7 -7
- package/Spec.md +0 -292
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,97 @@
|
|
2
2
|
"name": "@fluentui/react-radio",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 20 Dec 2022 14:55:52 GMT",
|
6
|
+
"tag": "@fluentui/react-radio_v9.0.14",
|
7
|
+
"version": "9.0.14",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "behowell@microsoft.com",
|
12
|
+
"package": "@fluentui/react-radio",
|
13
|
+
"commit": "9c6efea1aea75e3e0d7355a729785ade9af638c5",
|
14
|
+
"comment": "chore: Update Radio to use griffel reset styles"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-radio",
|
19
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.3",
|
20
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-radio",
|
25
|
+
"comment": "Bump @fluentui/react-field to v9.0.0-alpha.11",
|
26
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-radio",
|
31
|
+
"comment": "Bump @fluentui/react-label to v9.0.13",
|
32
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-radio",
|
37
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.3",
|
38
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-radio",
|
43
|
+
"comment": "Bump @fluentui/react-theme to v9.1.4",
|
44
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "beachball",
|
48
|
+
"package": "@fluentui/react-radio",
|
49
|
+
"comment": "Bump @fluentui/react-utilities to v9.3.0",
|
50
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"date": "Mon, 05 Dec 2022 18:29:29 GMT",
|
57
|
+
"tag": "@fluentui/react-radio_v9.0.13",
|
58
|
+
"version": "9.0.13",
|
59
|
+
"comments": {
|
60
|
+
"patch": [
|
61
|
+
{
|
62
|
+
"author": "tristan.watanabe@gmail.com",
|
63
|
+
"package": "@fluentui/react-radio",
|
64
|
+
"commit": "536d01dceb058546fbd97b9118e7248df7d19f88",
|
65
|
+
"comment": "chore: Migrate to new package structure."
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-radio",
|
70
|
+
"comment": "Bump @fluentui/react-field to v9.0.0-alpha.10",
|
71
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-radio",
|
76
|
+
"comment": "Bump @fluentui/react-label to v9.0.12",
|
77
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-radio",
|
82
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.2",
|
83
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-radio",
|
88
|
+
"comment": "Bump @fluentui/react-theme to v9.1.3",
|
89
|
+
"commit": "4c29542a51bf068e171690cc8e59c14489883912"
|
90
|
+
}
|
91
|
+
]
|
92
|
+
}
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"date": "Thu, 17 Nov 2022 23:05:45 GMT",
|
6
96
|
"tag": "@fluentui/react-radio_v9.0.12",
|
7
97
|
"version": "9.0.12",
|
8
98
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,40 @@
|
|
1
1
|
# Change Log - @fluentui/react-radio
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 20 Dec 2022 14:55:52 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.14)
|
8
|
+
|
9
|
+
Tue, 20 Dec 2022 14:55:52 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.13..@fluentui/react-radio_v9.0.14)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: Update Radio to use griffel reset styles ([PR #25984](https://github.com/microsoft/fluentui/pull/25984) by behowell@microsoft.com)
|
15
|
+
- Bump @fluentui/react-context-selector to v9.1.3 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
16
|
+
- Bump @fluentui/react-field to v9.0.0-alpha.11 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
17
|
+
- Bump @fluentui/react-label to v9.0.13 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
18
|
+
- Bump @fluentui/react-tabster to v9.3.3 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
19
|
+
- Bump @fluentui/react-theme to v9.1.4 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
20
|
+
- Bump @fluentui/react-utilities to v9.3.0 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
21
|
+
|
22
|
+
## [9.0.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.13)
|
23
|
+
|
24
|
+
Mon, 05 Dec 2022 18:29:29 GMT
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.12..@fluentui/react-radio_v9.0.13)
|
26
|
+
|
27
|
+
### Patches
|
28
|
+
|
29
|
+
- chore: Migrate to new package structure. ([PR #25810](https://github.com/microsoft/fluentui/pull/25810) by tristan.watanabe@gmail.com)
|
30
|
+
- Bump @fluentui/react-field to v9.0.0-alpha.10 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
31
|
+
- Bump @fluentui/react-label to v9.0.12 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
32
|
+
- Bump @fluentui/react-tabster to v9.3.2 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
33
|
+
- Bump @fluentui/react-theme to v9.1.3 ([PR #25798](https://github.com/microsoft/fluentui/pull/25798) by beachball)
|
34
|
+
|
7
35
|
## [9.0.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-radio_v9.0.12)
|
8
36
|
|
9
|
-
Thu, 17 Nov 2022 23:
|
37
|
+
Thu, 17 Nov 2022 23:05:45 GMT
|
10
38
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-radio_v9.0.11..@fluentui/react-radio_v9.0.12)
|
11
39
|
|
12
40
|
### Patches
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
2
2
|
import { tokens } from '@fluentui/react-theme';
|
3
|
-
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
3
|
+
import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
|
4
4
|
export const radioClassNames = {
|
5
5
|
root: 'fui-Radio',
|
6
6
|
indicator: 'fui-Radio__indicator',
|
@@ -9,156 +9,31 @@ export const radioClassNames = {
|
|
9
9
|
}; // The indicator size is used by the indicator and label styles
|
10
10
|
|
11
11
|
const indicatorSize = '16px';
|
12
|
-
|
13
|
-
|
14
|
-
*/
|
12
|
+
|
13
|
+
const useRootBaseClassName = /*#__PURE__*/__resetStyles("r18vxbm9", "r1631i6s", [".r18vxbm9{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r18vxbm9:focus{outline-style:none;}", ".r18vxbm9:focus-visible{outline-style:none;}", ".r18vxbm9[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r18vxbm9[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;left:-2px;right:-2px;}", ".r1631i6s{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r1631i6s:focus{outline-style:none;}", ".r1631i6s:focus-visible{outline-style:none;}", ".r1631i6s[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r1631i6s[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;right:-2px;left:-2px;}"]);
|
15
14
|
|
16
15
|
const useRootStyles = /*#__PURE__*/__styles({
|
17
|
-
"base": {
|
18
|
-
"mc9l5x": "ftuwxu6",
|
19
|
-
"qhf8xq": "f10pi13n"
|
20
|
-
},
|
21
16
|
"vertical": {
|
22
17
|
"Beiy3e4": "f1vx9l62",
|
23
18
|
"Bt984gj": "f122n59"
|
24
|
-
},
|
25
|
-
"focusIndicator": {
|
26
|
-
"Brovlpu": "ftqa4ok",
|
27
|
-
"B486eqv": "f2hkw1w",
|
28
|
-
"n9p9qa": "f1fu8s9w",
|
29
|
-
"B0otyzi": ["f8rbx7c", "f1jcuzx9"],
|
30
|
-
"r10ruj": "f1c1apvh",
|
31
|
-
"Bk2vswc": ["f1jcuzx9", "f8rbx7c"],
|
32
|
-
"gjlbkn": "fyrlc8h",
|
33
|
-
"B1kt0iq": "f28z38y",
|
34
|
-
"Boi8ppg": "f1edqc4x",
|
35
|
-
"Btfhvw2": "f19bnj08",
|
36
|
-
"B55xfkk": "f17wg1r9",
|
37
|
-
"i1dkbe": ["fgiioun", "fnx45sh"],
|
38
|
-
"Bozs2tv": "f1ljqnps",
|
39
|
-
"snkem8": ["fnx45sh", "fgiioun"],
|
40
|
-
"Bjilewg": "fsacsau",
|
41
|
-
"wht04d": ["flcxmxr", "f138axrn"],
|
42
|
-
"vikdft": "f1f4bc3q",
|
43
|
-
"Bwdhxlo": ["f138axrn", "flcxmxr"],
|
44
|
-
"B167d6d": ["f5m7f7q", "f175edhc"],
|
45
|
-
"Bpdw69r": ["f175edhc", "f5m7f7q"],
|
46
|
-
"Bsdv7io": ["fhfahiz", "fnreirl"],
|
47
|
-
"Bd353ur": ["fnreirl", "fhfahiz"],
|
48
|
-
"Bcnuwmc": "fn9i64i",
|
49
|
-
"dyfsa2": ["f1pylbqb", "f3dy9ja"],
|
50
|
-
"Bdcx1rh": "f1v06qdr",
|
51
|
-
"Bbd0xgj": ["f3dy9ja", "f1pylbqb"],
|
52
|
-
"Bbretkc": "fm1yk70",
|
53
|
-
"rnyfg7": "f1itvegt",
|
54
|
-
"Bg18gms": ["f17e4q3j", "foxjjqz"],
|
55
|
-
"Bym00rn": ["foxjjqz", "f17e4q3j"]
|
56
19
|
}
|
57
20
|
}, {
|
58
|
-
"d": [".
|
59
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
60
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
21
|
+
"d": [".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;}"]
|
61
22
|
});
|
62
23
|
|
24
|
+
const useInputBaseClassName = /*#__PURE__*/__resetStyles("r9gx1vl", "r1uk1i2c", [".r9gx1vl{position:absolute;left:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r9gx1vl:enabled{cursor:pointer;}", ".r9gx1vl:enabled~.fui-Radio__label{cursor:pointer;}", ".r9gx1vl:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r9gx1vl:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r9gx1vl:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r9gx1vl:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r9gx1vl:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r9gx1vl:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}", ".r1uk1i2c{position:absolute;right:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r1uk1i2c:enabled{cursor:pointer;}", ".r1uk1i2c:enabled~.fui-Radio__label{cursor:pointer;}", ".r1uk1i2c:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r1uk1i2c:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r1uk1i2c:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r1uk1i2c:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r1uk1i2c:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r1uk1i2c:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}"]);
|
25
|
+
|
63
26
|
const useInputStyles = /*#__PURE__*/__styles({
|
64
|
-
"base": {
|
65
|
-
"qhf8xq": "f1euv43f",
|
66
|
-
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
67
|
-
"Bhzewxz": "f15twtuk",
|
68
|
-
"a9b677": "fly5x3f",
|
69
|
-
"Bqenvij": "f1l02sjl",
|
70
|
-
"B7ck84d": "f1ewtqcl",
|
71
|
-
"B6of3ja": "f1hu3pq6",
|
72
|
-
"t21cq0": ["f11qmguv", "f1tyq0we"],
|
73
|
-
"jrapky": "f19f4twv",
|
74
|
-
"Frg6f3": ["f1tyq0we", "f11qmguv"],
|
75
|
-
"abs64n": "fk73vx1",
|
76
|
-
"By9lhj9": "fg45n87",
|
77
|
-
"G3n25n": "flqpbns",
|
78
|
-
"Bojc29n": "fhb1dn5",
|
79
|
-
"p8xby4": "fiegpko",
|
80
|
-
"Bmzgt9v": "fdi60kf",
|
81
|
-
"un08vv": ["fz3jc1r", "f1fwo01y"],
|
82
|
-
"Bluxpkm": "f1m2gv5u",
|
83
|
-
"upm9ap": ["f1fwo01y", "fz3jc1r"],
|
84
|
-
"Bv6ccmg": "ft7ju8s",
|
85
|
-
"w6pjei": "f1ofw0le",
|
86
|
-
"drfev3": ["fothmfx", "f13qgzgl"],
|
87
|
-
"ujr3xk": "fp5vmb3",
|
88
|
-
"Bib2mth": ["f13qgzgl", "fothmfx"],
|
89
|
-
"za2ojl": "f1snis2b",
|
90
|
-
"Bu1fve0": "ff9psms",
|
91
|
-
"B42z6en": ["f1fg9ko4", "fqj7xkg"],
|
92
|
-
"mosl6v": "f1vebft2",
|
93
|
-
"e3wlmb": ["fqj7xkg", "f1fg9ko4"],
|
94
|
-
"swj8lc": "f1vtc7ej",
|
95
|
-
"kbzjta": "f1fj62aq",
|
96
|
-
"Bnazurh": ["fc4i2ph", "f137d5x6"],
|
97
|
-
"Enz1qu": "f1v2xs8c",
|
98
|
-
"B4rl0r3": ["f137d5x6", "fc4i2ph"],
|
99
|
-
"oi7lcb": "f14bpgh5",
|
100
|
-
"bwebxt": "f1ariq71",
|
101
|
-
"ax4tcq": ["fu58av6", "f1qj5h2v"],
|
102
|
-
"z2by79": "fptcwjq",
|
103
|
-
"Bpz2hdf": ["f1qj5h2v", "fu58av6"],
|
104
|
-
"Btliz3o": "filss48",
|
105
|
-
"Bre5bwy": "frtrqgn",
|
106
|
-
"Bayw8dt": ["f1v1lrlm", "fapcpph"],
|
107
|
-
"lb5vkw": "f49ptgb",
|
108
|
-
"yhmu5n": ["fapcpph", "f1v1lrlm"],
|
109
|
-
"Blcfbx4": "fgnwcez",
|
110
|
-
"yksgid": "f1l3wt4b",
|
111
|
-
"B59a1ph": "f16lpvpn",
|
112
|
-
"B78hamy": "fdubm5j",
|
113
|
-
"t61w4e": ["f11to73e", "f9u8p8h"],
|
114
|
-
"Dvncu9": "fw62pkm",
|
115
|
-
"qbflri": ["f9u8p8h", "f11to73e"],
|
116
|
-
"Byzt4r9": "fqaqzd4"
|
117
|
-
},
|
118
|
-
"after": {
|
119
|
-
"a9b677": "fwr58v7"
|
120
|
-
},
|
121
27
|
"below": {
|
28
|
+
"a9b677": "fly5x3f",
|
122
29
|
"Bqenvij": "f1je6zif"
|
123
30
|
}
|
124
31
|
}, {
|
125
|
-
"d": [".
|
32
|
+
"d": [".fly5x3f{width:100%;}", ".f1je6zif{height:calc(16px + 2 * var(--spacingVerticalS));}"]
|
126
33
|
});
|
127
34
|
|
128
|
-
const
|
129
|
-
|
130
|
-
"a9b677": "fjw5fx7",
|
131
|
-
"Bqenvij": "fd461yt",
|
132
|
-
"Be2twd7": "f1ugzwwg",
|
133
|
-
"B7ck84d": "f1ewtqcl",
|
134
|
-
"Bnnss6s": "fi64zpg",
|
135
|
-
"mc9l5x": "f22iagw",
|
136
|
-
"Bt984gj": "f122n59",
|
137
|
-
"Brf1p80": "f4d9j23",
|
138
|
-
"B68tc82": "f1p9o1ba",
|
139
|
-
"Bmxbyg5": "f1sil6mw",
|
140
|
-
"B4j52fo": "f192inf7",
|
141
|
-
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
142
|
-
"Bn0qgzm": "f1vxd6vx",
|
143
|
-
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
144
|
-
"icvyot": "fzkkow9",
|
145
|
-
"vrafjx": ["fcdblym", "fjik90z"],
|
146
|
-
"oivjwe": "fg706s2",
|
147
|
-
"wvpqe5": ["fjik90z", "fcdblym"],
|
148
|
-
"Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
|
149
|
-
"Beyfa6y": ["f1nfllo7", "f8fbkgy"],
|
150
|
-
"B7oj6ja": ["f1djnp8u", "f1s8kh49"],
|
151
|
-
"Btl43ni": ["f1s8kh49", "f1djnp8u"],
|
152
|
-
"B6of3ja": "frnwi6n",
|
153
|
-
"t21cq0": ["f1vcna3q", "foyynoy"],
|
154
|
-
"jrapky": "fqcjy3b",
|
155
|
-
"Frg6f3": ["foyynoy", "f1vcna3q"],
|
156
|
-
"Bkfmm31": "f1w9h62z",
|
157
|
-
"Bkecrkj": "f1aehjj5"
|
158
|
-
}
|
159
|
-
}, {
|
160
|
-
"d": [".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".f1ugzwwg{font-size:12px;}", ".f1ewtqcl{box-sizing:border-box;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".frnwi6n{margin-top:var(--spacingVerticalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".foyynoy{margin-left:var(--spacingHorizontalS);}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f1w9h62z{fill:currentColor;}", ".f1aehjj5{pointer-events:none;}"]
|
161
|
-
});
|
35
|
+
const useIndicatorBaseClassName = /*#__PURE__*/__resetStyles("rid4516", null, [".rid4516{width:16px;height:16px;font-size:12px;box-sizing:border-box;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;overflow:hidden;border:var(--strokeWidthThin) solid;border-radius:var(--borderRadiusCircular);margin:var(--spacingVerticalS) var(--spacingHorizontalS);fill:currentColor;pointer-events:none;}"]); // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
36
|
+
|
162
37
|
|
163
38
|
const useLabelStyles = /*#__PURE__*/__styles({
|
164
39
|
"base": {
|
@@ -189,12 +64,14 @@ export const useRadioStyles_unstable = state => {
|
|
189
64
|
const {
|
190
65
|
labelPosition
|
191
66
|
} = state;
|
67
|
+
const rootBaseClassName = useRootBaseClassName();
|
192
68
|
const rootStyles = useRootStyles();
|
193
|
-
state.root.className = mergeClasses(radioClassNames.root,
|
69
|
+
state.root.className = mergeClasses(radioClassNames.root, rootBaseClassName, labelPosition === 'below' && rootStyles.vertical, state.root.className);
|
70
|
+
const inputBaseClassName = useInputBaseClassName();
|
194
71
|
const inputStyles = useInputStyles();
|
195
|
-
state.input.className = mergeClasses(radioClassNames.input,
|
196
|
-
const
|
197
|
-
state.indicator.className = mergeClasses(radioClassNames.indicator,
|
72
|
+
state.input.className = mergeClasses(radioClassNames.input, inputBaseClassName, labelPosition === 'below' && inputStyles.below, state.input.className);
|
73
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
74
|
+
state.indicator.className = mergeClasses(radioClassNames.indicator, indicatorBaseClassName, state.indicator.className);
|
198
75
|
const labelStyles = useLabelStyles();
|
199
76
|
|
200
77
|
if (state.label) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-radio/src/components/Radio/useRadioStyles.ts"],"names":[],"mappings":"AAAA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,
|
1
|
+
{"version":3,"sources":["packages/react-components/react-radio/src/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SAAZ,GAAwB,YAAY,CAClC,eAAe,CAAC,KADkB,EAElC,kBAFkC,EAGlC,aAAa,KAAK,OAAlB,IAA6B,WAAW,CAAC,KAHP,EAIlC,KAAK,CAAC,KAAN,CAAY,SAJsB,CAApC;EAOA,MAAM,sBAAsB,GAAG,yBAAyB,EAAxD;EACA,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CACtC,eAAe,CAAC,SADsB,EAEtC,sBAFsC,EAGtC,KAAK,CAAC,SAAN,CAAgB,SAHsB,CAAxC;EAMA,MAAM,WAAW,GAAG,cAAc,EAAlC;;EACA,IAAI,KAAK,CAAC,KAAV,EAAiB;IACf,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAClC,eAAe,CAAC,KADkB,EAElC,WAAW,CAAC,IAFsB,EAGlC,WAAW,CAAC,aAAD,CAHuB,EAIlC,KAAK,CAAC,KAAN,CAAY,SAJsB,CAApC;EAMD;AACF,CArCM","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, 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\nconst useRootBaseClassName = makeResetStyles({\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n position: 'absolute',\n left: 0,\n top: 0,\n width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n height: '100%',\n boxSizing: 'border-box',\n margin: 0,\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n [`& ~ .${radioClassNames.label}`]: {\n cursor: 'pointer',\n },\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 borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 cursor: 'default',\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n below: {\n width: '100%',\n height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\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 overflow: 'hidden',\n\n border: tokens.strokeWidthThin + ' solid',\n borderRadius: tokens.borderRadiusCircular,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\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 paddingTop: tokens.spacingVerticalXS,\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 { labelPosition } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootBaseClassName,\n labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n radioClassNames.input,\n inputBaseClassName,\n labelPosition === 'below' && inputStyles.below,\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n state.indicator.className = mergeClasses(\n radioClassNames.indicator,\n indicatorBaseClassName,\n state.indicator.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n radioClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
|
@@ -11,80 +11,116 @@ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/rea
|
|
11
11
|
};
|
12
12
|
// The indicator size is used by the indicator and label styles
|
13
13
|
var indicatorSize = '16px';
|
14
|
-
|
15
|
-
* Styles for the root slot
|
16
|
-
*/
|
14
|
+
var useRootBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ display: 'inline-flex', position: 'relative' }, react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' })));
|
17
15
|
var useRootStyles = react_1.makeStyles({
|
18
|
-
base: {
|
19
|
-
display: 'inline-flex',
|
20
|
-
position: 'relative',
|
21
|
-
},
|
22
16
|
vertical: {
|
23
17
|
flexDirection: 'column',
|
24
18
|
alignItems: 'center',
|
25
19
|
},
|
26
|
-
focusIndicator: react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),
|
27
20
|
});
|
28
|
-
var
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
var useInputBaseClassName = react_1.makeResetStyles((_a = {
|
22
|
+
position: 'absolute',
|
23
|
+
left: 0,
|
24
|
+
top: 0,
|
25
|
+
width: "calc(" + indicatorSize + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
|
26
|
+
height: '100%',
|
27
|
+
boxSizing: 'border-box',
|
28
|
+
margin: 0,
|
29
|
+
opacity: 0,
|
30
|
+
':enabled': (_b = {
|
31
|
+
cursor: 'pointer'
|
32
|
+
},
|
33
|
+
_b["& ~ ." + exports.radioClassNames.label] = {
|
34
|
+
cursor: 'pointer',
|
35
|
+
},
|
36
|
+
_b)
|
37
|
+
},
|
38
|
+
// When unchecked, hide the circle icon (child of the indicator)
|
39
|
+
_a[":not(:checked) ~ ." + exports.radioClassNames.indicator + " > *"] = {
|
36
40
|
opacity: '0',
|
37
|
-
},
|
41
|
+
},
|
38
42
|
// Colors for the unchecked state
|
39
43
|
_a[':enabled:not(:checked)'] = (_c = {},
|
40
44
|
_c["& ~ ." + exports.radioClassNames.label] = {
|
41
45
|
color: react_theme_1.tokens.colorNeutralForeground3,
|
42
46
|
},
|
43
|
-
_c["& ~ ." + exports.radioClassNames.indicator] =
|
47
|
+
_c["& ~ ." + exports.radioClassNames.indicator] = {
|
48
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessible,
|
49
|
+
},
|
44
50
|
_c[':hover'] = (_d = {},
|
45
51
|
_d["& ~ ." + exports.radioClassNames.label] = {
|
46
52
|
color: react_theme_1.tokens.colorNeutralForeground2,
|
47
53
|
},
|
48
|
-
_d["& ~ ." + exports.radioClassNames.indicator] =
|
54
|
+
_d["& ~ ." + exports.radioClassNames.indicator] = {
|
55
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
|
56
|
+
},
|
49
57
|
_d),
|
50
58
|
_c[':hover:active'] = (_e = {},
|
51
59
|
_e["& ~ ." + exports.radioClassNames.label] = {
|
52
60
|
color: react_theme_1.tokens.colorNeutralForeground1,
|
53
61
|
},
|
54
|
-
_e["& ~ ." + exports.radioClassNames.indicator] =
|
62
|
+
_e["& ~ ." + exports.radioClassNames.indicator] = {
|
63
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed,
|
64
|
+
},
|
55
65
|
_e),
|
56
|
-
_c),
|
66
|
+
_c),
|
57
67
|
// Colors for the checked state
|
58
68
|
_a[':enabled:checked'] = (_f = {},
|
59
69
|
_f["& ~ ." + exports.radioClassNames.label] = {
|
60
70
|
color: react_theme_1.tokens.colorNeutralForeground1,
|
61
71
|
},
|
62
|
-
_f["& ~ ." + exports.radioClassNames.indicator] =
|
72
|
+
_f["& ~ ." + exports.radioClassNames.indicator] = {
|
73
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStroke,
|
74
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1,
|
75
|
+
},
|
63
76
|
_f[':hover'] = (_g = {},
|
64
|
-
_g["& ~ ." + exports.radioClassNames.indicator] =
|
77
|
+
_g["& ~ ." + exports.radioClassNames.indicator] = {
|
78
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStrokeHover,
|
79
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1Hover,
|
80
|
+
},
|
65
81
|
_g),
|
66
82
|
_f[':hover:active'] = (_h = {},
|
67
|
-
_h["& ~ ." + exports.radioClassNames.indicator] =
|
83
|
+
_h["& ~ ." + exports.radioClassNames.indicator] = {
|
84
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStrokePressed,
|
85
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1Pressed,
|
86
|
+
},
|
68
87
|
_h),
|
69
|
-
_f),
|
88
|
+
_f),
|
70
89
|
// Colors for the disabled state
|
71
90
|
_a[':disabled'] = (_j = {},
|
72
91
|
_j["& ~ ." + exports.radioClassNames.label] = {
|
73
92
|
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
74
93
|
cursor: 'default',
|
75
94
|
},
|
76
|
-
_j["& ~ ." + exports.radioClassNames.indicator] =
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
95
|
+
_j["& ~ ." + exports.radioClassNames.indicator] = {
|
96
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
|
97
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
98
|
+
},
|
99
|
+
_j),
|
100
|
+
_a));
|
101
|
+
var useInputStyles = react_1.makeStyles({
|
81
102
|
below: {
|
103
|
+
width: '100%',
|
82
104
|
height: "calc(" + indicatorSize + " + 2 * " + react_theme_1.tokens.spacingVerticalS + ")",
|
83
105
|
},
|
84
106
|
});
|
85
|
-
var
|
86
|
-
|
107
|
+
var useIndicatorBaseClassName = react_1.makeResetStyles({
|
108
|
+
width: indicatorSize,
|
109
|
+
height: indicatorSize,
|
110
|
+
fontSize: '12px',
|
111
|
+
boxSizing: 'border-box',
|
112
|
+
flexShrink: 0,
|
113
|
+
display: 'flex',
|
114
|
+
alignItems: 'center',
|
115
|
+
justifyContent: 'center',
|
116
|
+
overflow: 'hidden',
|
117
|
+
border: react_theme_1.tokens.strokeWidthThin + ' solid',
|
118
|
+
borderRadius: react_theme_1.tokens.borderRadiusCircular,
|
119
|
+
margin: react_theme_1.tokens.spacingVerticalS + ' ' + react_theme_1.tokens.spacingHorizontalS,
|
120
|
+
fill: 'currentColor',
|
121
|
+
pointerEvents: 'none',
|
87
122
|
});
|
123
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
88
124
|
var useLabelStyles = react_1.makeStyles({
|
89
125
|
base: tslib_1.__assign({ alignSelf: 'center' }, react_1.shorthands.padding(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalS)),
|
90
126
|
after: {
|
@@ -104,12 +140,14 @@ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/rea
|
|
104
140
|
*/
|
105
141
|
var useRadioStyles_unstable = function (state) {
|
106
142
|
var labelPosition = state.labelPosition;
|
143
|
+
var rootBaseClassName = useRootBaseClassName();
|
107
144
|
var rootStyles = useRootStyles();
|
108
|
-
state.root.className = react_1.mergeClasses(exports.radioClassNames.root,
|
145
|
+
state.root.className = react_1.mergeClasses(exports.radioClassNames.root, rootBaseClassName, labelPosition === 'below' && rootStyles.vertical, state.root.className);
|
146
|
+
var inputBaseClassName = useInputBaseClassName();
|
109
147
|
var inputStyles = useInputStyles();
|
110
|
-
state.input.className = react_1.mergeClasses(exports.radioClassNames.input,
|
111
|
-
var
|
112
|
-
state.indicator.className = react_1.mergeClasses(exports.radioClassNames.indicator,
|
148
|
+
state.input.className = react_1.mergeClasses(exports.radioClassNames.input, inputBaseClassName, labelPosition === 'below' && inputStyles.below, state.input.className);
|
149
|
+
var indicatorBaseClassName = useIndicatorBaseClassName();
|
150
|
+
state.indicator.className = react_1.mergeClasses(exports.radioClassNames.indicator, indicatorBaseClassName, state.indicator.className);
|
113
151
|
var labelStyles = useLabelStyles();
|
114
152
|
if (state.label) {
|
115
153
|
state.label.className = react_1.mergeClasses(exports.radioClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useRadioStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-radio/src/components/Radio/useRadioStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,eAAe,GAA+B;QACzD,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,sBAAsB;QACjC,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,kBAAkB;KAC1B,CAAC;IAEF,+DAA+D;IAC/D,IAAM,aAAa,GAAG,MAAM,CAAC;IAE7B;;OAEG;IACH,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,IAAI,EAAE;YACJ,OAAO,EAAE,aAAa;YACtB,QAAQ,EAAE,UAAU;SACrB;QAED,QAAQ,EAAE;YACR,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;SACrB;QAED,cAAc,EAAE,uCAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;KACjF,CAAC,CAAC;IAEH,IAAM,cAAc,GAAG,kBAAU,CAAC;QAChC,IAAI,sCACF,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,YAAY,IACpB,kBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,WACvB,OAAO,EAAE,CAAC,EAEV,UAAU;wBACR,MAAM,EAAE,SAAS;;oBACjB,GAAC,UAAQ,uBAAe,CAAC,KAAO,IAAG;wBACjC,MAAM,EAAE,SAAS;qBACl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c,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,uBAAe,CAAC,KAAK,EACrB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;SACH;IACH,CAAC,CAAC;IAhCW,QAAA,uBAAuB,2BAgClC","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 },\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 [`& ~ .${radioClassNames.label}`]: {\n cursor: 'pointer',\n },\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 cursor: 'default',\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n },\n\n after: {\n width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n },\n below: {\n height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\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 ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\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 paddingTop: tokens.spacingVerticalXS,\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 { labelPosition } = state;\n\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootStyles.base,\n rootStyles.focusIndicator,\n labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n radioClassNames.input,\n inputStyles.base,\n inputStyles[labelPosition],\n state.input.className,\n );\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[labelPosition],\n state.label.className,\n );\n }\n};\n"]}
|
1
|
+
{"version":3,"file":"useRadioStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-radio/src/components/Radio/useRadioStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,eAAe,GAA+B;QACzD,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,sBAAsB;QACjC,KA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AAM,UAAU,GAAG,aAAa,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,uBAAe,CAAC,IAAI,EACpB,iBAAiB,EACjB,aAAa,KAAK,OAAO,IAAI,UAAU,CAAC,QAAQ,EAChD,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,IAAM,kBAAkB,GAAG,qBAAqB,EAAE,CAAC;QACnD,IAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,uBAAe,CAAC,KAAK,EACrB,kBAAkB,EAClB,aAAa,KAAK,OAAO,IAAI,WAAW,CAAC,KAAK,EAC9C,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAM,sBAAsB,GAAG,yBAAyB,EAAE,CAAC;QAC3D,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,oBAAY,CACtC,uBAAe,CAAC,SAAS,EACzB,sBAAsB,EACtB,KAAK,CAAC,SAAS,CAAC,SAAS,CAC1B,CAAC;QAEF,IAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,uBAAe,CAAC,KAAK,EACrB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;SACH;IACH,CAAC,CAAC;IArCW,QAAA,uBAAuB,2BAqClC","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, 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\nconst useRootBaseClassName = makeResetStyles({\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n position: 'absolute',\n left: 0,\n top: 0,\n width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n height: '100%',\n boxSizing: 'border-box',\n margin: 0,\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n [`& ~ .${radioClassNames.label}`]: {\n cursor: 'pointer',\n },\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 borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 cursor: 'default',\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n below: {\n width: '100%',\n height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\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 overflow: 'hidden',\n\n border: tokens.strokeWidthThin + ' solid',\n borderRadius: tokens.borderRadiusCircular,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\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 paddingTop: tokens.spacingVerticalXS,\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 { labelPosition } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootBaseClassName,\n labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n radioClassNames.input,\n inputBaseClassName,\n labelPosition === 'below' && inputStyles.below,\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n state.indicator.className = mergeClasses(\n radioClassNames.indicator,\n indicatorBaseClassName,\n state.indicator.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n radioClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n};\n"]}
|
@@ -19,156 +19,31 @@ exports.radioClassNames = {
|
|
19
19
|
}; // The indicator size is used by the indicator and label styles
|
20
20
|
|
21
21
|
const indicatorSize = '16px';
|
22
|
-
|
23
|
-
|
24
|
-
*/
|
22
|
+
|
23
|
+
const useRootBaseClassName = /*#__PURE__*/react_1.__resetStyles("r18vxbm9", "r1631i6s", [".r18vxbm9{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r18vxbm9:focus{outline-style:none;}", ".r18vxbm9:focus-visible{outline-style:none;}", ".r18vxbm9[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r18vxbm9[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:2px;border-right-width:2px;border-bottom-width:2px;border-left-width:2px;border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;left:-2px;right:-2px;}", ".r1631i6s{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r1631i6s:focus{outline-style:none;}", ".r1631i6s:focus-visible{outline-style:none;}", ".r1631i6s[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r1631i6s[data-fui-focus-within]:focus-within::after{content:\"\";position:absolute;pointer-events:none;z-index:1;border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid;border-top-width:2px;border-left-width:2px;border-bottom-width:2px;border-right-width:2px;border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-top-left-radius:var(--borderRadiusMedium);border-top-right-radius:var(--borderRadiusMedium);border-top-color:var(--colorStrokeFocus2);border-left-color:var(--colorStrokeFocus2);border-bottom-color:var(--colorStrokeFocus2);border-right-color:var(--colorStrokeFocus2);top:-2px;bottom:-2px;right:-2px;left:-2px;}"]);
|
25
24
|
|
26
25
|
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
27
|
-
"base": {
|
28
|
-
"mc9l5x": "ftuwxu6",
|
29
|
-
"qhf8xq": "f10pi13n"
|
30
|
-
},
|
31
26
|
"vertical": {
|
32
27
|
"Beiy3e4": "f1vx9l62",
|
33
28
|
"Bt984gj": "f122n59"
|
34
|
-
},
|
35
|
-
"focusIndicator": {
|
36
|
-
"Brovlpu": "ftqa4ok",
|
37
|
-
"B486eqv": "f2hkw1w",
|
38
|
-
"n9p9qa": "f1fu8s9w",
|
39
|
-
"B0otyzi": ["f8rbx7c", "f1jcuzx9"],
|
40
|
-
"r10ruj": "f1c1apvh",
|
41
|
-
"Bk2vswc": ["f1jcuzx9", "f8rbx7c"],
|
42
|
-
"gjlbkn": "fyrlc8h",
|
43
|
-
"B1kt0iq": "f28z38y",
|
44
|
-
"Boi8ppg": "f1edqc4x",
|
45
|
-
"Btfhvw2": "f19bnj08",
|
46
|
-
"B55xfkk": "f17wg1r9",
|
47
|
-
"i1dkbe": ["fgiioun", "fnx45sh"],
|
48
|
-
"Bozs2tv": "f1ljqnps",
|
49
|
-
"snkem8": ["fnx45sh", "fgiioun"],
|
50
|
-
"Bjilewg": "fsacsau",
|
51
|
-
"wht04d": ["flcxmxr", "f138axrn"],
|
52
|
-
"vikdft": "f1f4bc3q",
|
53
|
-
"Bwdhxlo": ["f138axrn", "flcxmxr"],
|
54
|
-
"B167d6d": ["f5m7f7q", "f175edhc"],
|
55
|
-
"Bpdw69r": ["f175edhc", "f5m7f7q"],
|
56
|
-
"Bsdv7io": ["fhfahiz", "fnreirl"],
|
57
|
-
"Bd353ur": ["fnreirl", "fhfahiz"],
|
58
|
-
"Bcnuwmc": "fn9i64i",
|
59
|
-
"dyfsa2": ["f1pylbqb", "f3dy9ja"],
|
60
|
-
"Bdcx1rh": "f1v06qdr",
|
61
|
-
"Bbd0xgj": ["f3dy9ja", "f1pylbqb"],
|
62
|
-
"Bbretkc": "fm1yk70",
|
63
|
-
"rnyfg7": "f1itvegt",
|
64
|
-
"Bg18gms": ["f17e4q3j", "foxjjqz"],
|
65
|
-
"Bym00rn": ["foxjjqz", "f17e4q3j"]
|
66
29
|
}
|
67
30
|
}, {
|
68
|
-
"d": [".
|
69
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
70
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
31
|
+
"d": [".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;}"]
|
71
32
|
});
|
72
33
|
|
34
|
+
const useInputBaseClassName = /*#__PURE__*/react_1.__resetStyles("r9gx1vl", "r1uk1i2c", [".r9gx1vl{position:absolute;left:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r9gx1vl:enabled{cursor:pointer;}", ".r9gx1vl:enabled~.fui-Radio__label{cursor:pointer;}", ".r9gx1vl:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r9gx1vl:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r9gx1vl:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r9gx1vl:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r9gx1vl:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r9gx1vl:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r9gx1vl:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r9gx1vl:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r9gx1vl:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}", ".r1uk1i2c{position:absolute;right:0;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));height:100%;box-sizing:border-box;margin:0;opacity:0;}", ".r1uk1i2c:enabled{cursor:pointer;}", ".r1uk1i2c:enabled~.fui-Radio__label{cursor:pointer;}", ".r1uk1i2c:not(:checked)~.fui-Radio__indicator>*{opacity:0;}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__label{color:var(--colorNeutralForeground3);}", ".r1uk1i2c:enabled:not(:checked)~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__label{color:var(--colorNeutralForeground2);}", ".r1uk1i2c:enabled:not(:checked):hover~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:not(:checked):hover:active~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r1uk1i2c:enabled:checked~.fui-Radio__label{color:var(--colorNeutralForeground1);}", ".r1uk1i2c:enabled:checked~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".r1uk1i2c:enabled:checked:hover~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".r1uk1i2c:enabled:checked:hover:active~.fui-Radio__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".r1uk1i2c:disabled~.fui-Radio__label{color:var(--colorNeutralForegroundDisabled);cursor:default;}", ".r1uk1i2c:disabled~.fui-Radio__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}"]);
|
35
|
+
|
73
36
|
const useInputStyles = /*#__PURE__*/react_1.__styles({
|
74
|
-
"base": {
|
75
|
-
"qhf8xq": "f1euv43f",
|
76
|
-
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
77
|
-
"Bhzewxz": "f15twtuk",
|
78
|
-
"a9b677": "fly5x3f",
|
79
|
-
"Bqenvij": "f1l02sjl",
|
80
|
-
"B7ck84d": "f1ewtqcl",
|
81
|
-
"B6of3ja": "f1hu3pq6",
|
82
|
-
"t21cq0": ["f11qmguv", "f1tyq0we"],
|
83
|
-
"jrapky": "f19f4twv",
|
84
|
-
"Frg6f3": ["f1tyq0we", "f11qmguv"],
|
85
|
-
"abs64n": "fk73vx1",
|
86
|
-
"By9lhj9": "fg45n87",
|
87
|
-
"G3n25n": "flqpbns",
|
88
|
-
"Bojc29n": "fhb1dn5",
|
89
|
-
"p8xby4": "fiegpko",
|
90
|
-
"Bmzgt9v": "fdi60kf",
|
91
|
-
"un08vv": ["fz3jc1r", "f1fwo01y"],
|
92
|
-
"Bluxpkm": "f1m2gv5u",
|
93
|
-
"upm9ap": ["f1fwo01y", "fz3jc1r"],
|
94
|
-
"Bv6ccmg": "ft7ju8s",
|
95
|
-
"w6pjei": "f1ofw0le",
|
96
|
-
"drfev3": ["fothmfx", "f13qgzgl"],
|
97
|
-
"ujr3xk": "fp5vmb3",
|
98
|
-
"Bib2mth": ["f13qgzgl", "fothmfx"],
|
99
|
-
"za2ojl": "f1snis2b",
|
100
|
-
"Bu1fve0": "ff9psms",
|
101
|
-
"B42z6en": ["f1fg9ko4", "fqj7xkg"],
|
102
|
-
"mosl6v": "f1vebft2",
|
103
|
-
"e3wlmb": ["fqj7xkg", "f1fg9ko4"],
|
104
|
-
"swj8lc": "f1vtc7ej",
|
105
|
-
"kbzjta": "f1fj62aq",
|
106
|
-
"Bnazurh": ["fc4i2ph", "f137d5x6"],
|
107
|
-
"Enz1qu": "f1v2xs8c",
|
108
|
-
"B4rl0r3": ["f137d5x6", "fc4i2ph"],
|
109
|
-
"oi7lcb": "f14bpgh5",
|
110
|
-
"bwebxt": "f1ariq71",
|
111
|
-
"ax4tcq": ["fu58av6", "f1qj5h2v"],
|
112
|
-
"z2by79": "fptcwjq",
|
113
|
-
"Bpz2hdf": ["f1qj5h2v", "fu58av6"],
|
114
|
-
"Btliz3o": "filss48",
|
115
|
-
"Bre5bwy": "frtrqgn",
|
116
|
-
"Bayw8dt": ["f1v1lrlm", "fapcpph"],
|
117
|
-
"lb5vkw": "f49ptgb",
|
118
|
-
"yhmu5n": ["fapcpph", "f1v1lrlm"],
|
119
|
-
"Blcfbx4": "fgnwcez",
|
120
|
-
"yksgid": "f1l3wt4b",
|
121
|
-
"B59a1ph": "f16lpvpn",
|
122
|
-
"B78hamy": "fdubm5j",
|
123
|
-
"t61w4e": ["f11to73e", "f9u8p8h"],
|
124
|
-
"Dvncu9": "fw62pkm",
|
125
|
-
"qbflri": ["f9u8p8h", "f11to73e"],
|
126
|
-
"Byzt4r9": "fqaqzd4"
|
127
|
-
},
|
128
|
-
"after": {
|
129
|
-
"a9b677": "fwr58v7"
|
130
|
-
},
|
131
37
|
"below": {
|
38
|
+
"a9b677": "fly5x3f",
|
132
39
|
"Bqenvij": "f1je6zif"
|
133
40
|
}
|
134
41
|
}, {
|
135
|
-
"d": [".
|
42
|
+
"d": [".fly5x3f{width:100%;}", ".f1je6zif{height:calc(16px + 2 * var(--spacingVerticalS));}"]
|
136
43
|
});
|
137
44
|
|
138
|
-
const
|
139
|
-
|
140
|
-
"a9b677": "fjw5fx7",
|
141
|
-
"Bqenvij": "fd461yt",
|
142
|
-
"Be2twd7": "f1ugzwwg",
|
143
|
-
"B7ck84d": "f1ewtqcl",
|
144
|
-
"Bnnss6s": "fi64zpg",
|
145
|
-
"mc9l5x": "f22iagw",
|
146
|
-
"Bt984gj": "f122n59",
|
147
|
-
"Brf1p80": "f4d9j23",
|
148
|
-
"B68tc82": "f1p9o1ba",
|
149
|
-
"Bmxbyg5": "f1sil6mw",
|
150
|
-
"B4j52fo": "f192inf7",
|
151
|
-
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
152
|
-
"Bn0qgzm": "f1vxd6vx",
|
153
|
-
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
154
|
-
"icvyot": "fzkkow9",
|
155
|
-
"vrafjx": ["fcdblym", "fjik90z"],
|
156
|
-
"oivjwe": "fg706s2",
|
157
|
-
"wvpqe5": ["fjik90z", "fcdblym"],
|
158
|
-
"Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
|
159
|
-
"Beyfa6y": ["f1nfllo7", "f8fbkgy"],
|
160
|
-
"B7oj6ja": ["f1djnp8u", "f1s8kh49"],
|
161
|
-
"Btl43ni": ["f1s8kh49", "f1djnp8u"],
|
162
|
-
"B6of3ja": "frnwi6n",
|
163
|
-
"t21cq0": ["f1vcna3q", "foyynoy"],
|
164
|
-
"jrapky": "fqcjy3b",
|
165
|
-
"Frg6f3": ["foyynoy", "f1vcna3q"],
|
166
|
-
"Bkfmm31": "f1w9h62z",
|
167
|
-
"Bkecrkj": "f1aehjj5"
|
168
|
-
}
|
169
|
-
}, {
|
170
|
-
"d": [".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".f1ugzwwg{font-size:12px;}", ".f1ewtqcl{box-sizing:border-box;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".frnwi6n{margin-top:var(--spacingVerticalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".foyynoy{margin-left:var(--spacingHorizontalS);}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f1w9h62z{fill:currentColor;}", ".f1aehjj5{pointer-events:none;}"]
|
171
|
-
});
|
45
|
+
const useIndicatorBaseClassName = /*#__PURE__*/react_1.__resetStyles("rid4516", null, [".rid4516{width:16px;height:16px;font-size:12px;box-sizing:border-box;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;overflow:hidden;border:var(--strokeWidthThin) solid;border-radius:var(--borderRadiusCircular);margin:var(--spacingVerticalS) var(--spacingHorizontalS);fill:currentColor;pointer-events:none;}"]); // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
46
|
+
|
172
47
|
|
173
48
|
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
174
49
|
"base": {
|
@@ -199,12 +74,14 @@ const useRadioStyles_unstable = state => {
|
|
199
74
|
const {
|
200
75
|
labelPosition
|
201
76
|
} = state;
|
77
|
+
const rootBaseClassName = useRootBaseClassName();
|
202
78
|
const rootStyles = useRootStyles();
|
203
|
-
state.root.className = react_1.mergeClasses(exports.radioClassNames.root,
|
79
|
+
state.root.className = react_1.mergeClasses(exports.radioClassNames.root, rootBaseClassName, labelPosition === 'below' && rootStyles.vertical, state.root.className);
|
80
|
+
const inputBaseClassName = useInputBaseClassName();
|
204
81
|
const inputStyles = useInputStyles();
|
205
|
-
state.input.className = react_1.mergeClasses(exports.radioClassNames.input,
|
206
|
-
const
|
207
|
-
state.indicator.className = react_1.mergeClasses(exports.radioClassNames.indicator,
|
82
|
+
state.input.className = react_1.mergeClasses(exports.radioClassNames.input, inputBaseClassName, labelPosition === 'below' && inputStyles.below, state.input.className);
|
83
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
84
|
+
state.indicator.className = react_1.mergeClasses(exports.radioClassNames.indicator, indicatorBaseClassName, state.indicator.className);
|
208
85
|
const labelStyles = useLabelStyles();
|
209
86
|
|
210
87
|
if (state.label) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-radio/src/components/Radio/useRadioStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,eAAA,GAA8C;EACzD,IAAI,EAAE,WADmD;EAEzD,SAAS,EAAE,sBAF8C;EAGzD,KAAK,EAAE,kBAHkD;EAIzD,KAAK,EAAE;AAJkD,CAA9C,C,CAOb;;AACA,MAAM,aAAa,GAAG,MAAtB
|
1
|
+
{"version":3,"sources":["packages/react-components/react-radio/src/components/Radio/useRadioStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,eAAA,GAA8C;EACzD,IAAI,EAAE,WADmD;EAEzD,SAAS,EAAE,sBAF8C;EAGzD,KAAK,EAAE,kBAHkD;EAIzD,KAAK,EAAE;AAJkD,CAA9C,C,CAOb;;AACA,MAAM,aAAa,GAAG,MAAtB;;AAEA,MAAM,oBAAoB,gBAAG,OAAA,cAAA,guEAA7B;;AAMA,MAAM,aAAa,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;;AAOA,MAAM,qBAAqB,gBAAG,OAAA,cAAA,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,IAAI,KAAK,CAAC,KAAV,EAAiB;IACf,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,OAAA,CAAA,YAAA,CACtB,OAAA,CAAA,eAAA,CAAgB,KADM,EAEtB,WAAW,CAAC,IAFU,EAGtB,WAAW,CAAC,aAAD,CAHW,EAItB,KAAK,CAAC,KAAN,CAAY,SAJU,CAAxB;EAMD;AACF,CArCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, 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\nconst useRootBaseClassName = makeResetStyles({\n display: 'inline-flex',\n position: 'relative',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n alignItems: 'center',\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n position: 'absolute',\n left: 0,\n top: 0,\n width: `calc(${indicatorSize} + 2 * ${tokens.spacingHorizontalS})`,\n height: '100%',\n boxSizing: 'border-box',\n margin: 0,\n opacity: 0,\n\n ':enabled': {\n cursor: 'pointer',\n [`& ~ .${radioClassNames.label}`]: {\n cursor: 'pointer',\n },\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 borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${radioClassNames.indicator}`]: {\n 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 cursor: 'default',\n },\n [`& ~ .${radioClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n below: {\n width: '100%',\n height: `calc(${indicatorSize} + 2 * ${tokens.spacingVerticalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\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 overflow: 'hidden',\n\n border: tokens.strokeWidthThin + ' solid',\n borderRadius: tokens.borderRadiusCircular,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\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 paddingTop: tokens.spacingVerticalXS,\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 { labelPosition } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n radioClassNames.root,\n rootBaseClassName,\n labelPosition === 'below' && rootStyles.vertical,\n state.root.className,\n );\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n radioClassNames.input,\n inputBaseClassName,\n labelPosition === 'below' && inputStyles.below,\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n state.indicator.className = mergeClasses(\n radioClassNames.indicator,\n indicatorBaseClassName,\n state.indicator.className,\n );\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n radioClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-radio",
|
3
|
-
"version": "9.0.
|
3
|
+
"version": "9.0.14",
|
4
4
|
"description": "Fluent UI Radio component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -30,13 +30,13 @@
|
|
30
30
|
"@fluentui/react-conformance-griffel": "9.0.0-beta.18"
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
|
-
"@fluentui/react-context-selector": "^9.1.
|
34
|
-
"@fluentui/react-field": "9.0.0-alpha.
|
33
|
+
"@fluentui/react-context-selector": "^9.1.3",
|
34
|
+
"@fluentui/react-field": "9.0.0-alpha.11",
|
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.
|
39
|
-
"@fluentui/react-utilities": "^9.
|
36
|
+
"@fluentui/react-label": "^9.0.13",
|
37
|
+
"@fluentui/react-tabster": "^9.3.3",
|
38
|
+
"@fluentui/react-theme": "^9.1.4",
|
39
|
+
"@fluentui/react-utilities": "^9.3.0",
|
40
40
|
"@griffel/react": "^1.4.2",
|
41
41
|
"tslib": "^2.1.0"
|
42
42
|
},
|
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 | - |
|