@fluentui/react-checkbox 9.0.14 → 9.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +95 -1
- package/CHANGELOG.md +28 -2
- package/lib/components/Checkbox/useCheckboxStyles.js +17 -165
- package/lib/components/Checkbox/useCheckboxStyles.js.map +1 -1
- package/lib-amd/components/Checkbox/useCheckboxStyles.js +88 -37
- package/lib-amd/components/Checkbox/useCheckboxStyles.js.map +1 -1
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.js +16 -164
- package/lib-commonjs/components/Checkbox/useCheckboxStyles.js.map +1 -1
- package/package.json +7 -6
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,101 @@
|
|
|
2
2
|
"name": "@fluentui/react-checkbox",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 21 Dec 2022 10:17:10 GMT",
|
|
6
|
+
"tag": "@fluentui/react-checkbox_v9.0.16",
|
|
7
|
+
"version": "9.0.16",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"author": "behowell@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-checkbox",
|
|
13
|
+
"commit": "68505ab8eb1b05f45ab09c21b9d66c177d1e50f5",
|
|
14
|
+
"comment": "chore: Add bundle size tests for Fields"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"patch": [
|
|
18
|
+
{
|
|
19
|
+
"author": "beachball",
|
|
20
|
+
"package": "@fluentui/react-checkbox",
|
|
21
|
+
"comment": "Bump @fluentui/react-field to v9.0.0-alpha.12",
|
|
22
|
+
"commit": "66bf89f634cad4a275e957d7a2214c7e73ff8c2e"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"author": "beachball",
|
|
26
|
+
"package": "@fluentui/react-checkbox",
|
|
27
|
+
"comment": "Bump @fluentui/react-label to v9.0.14",
|
|
28
|
+
"commit": "66bf89f634cad4a275e957d7a2214c7e73ff8c2e"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"author": "beachball",
|
|
32
|
+
"package": "@fluentui/react-checkbox",
|
|
33
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.4",
|
|
34
|
+
"commit": "66bf89f634cad4a275e957d7a2214c7e73ff8c2e"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"author": "beachball",
|
|
38
|
+
"package": "@fluentui/react-checkbox",
|
|
39
|
+
"comment": "Bump @fluentui/react-theme to v9.1.5",
|
|
40
|
+
"commit": "66bf89f634cad4a275e957d7a2214c7e73ff8c2e"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"date": "Tue, 20 Dec 2022 14:59:22 GMT",
|
|
47
|
+
"tag": "@fluentui/react-checkbox_v9.0.15",
|
|
48
|
+
"version": "9.0.15",
|
|
49
|
+
"comments": {
|
|
50
|
+
"patch": [
|
|
51
|
+
{
|
|
52
|
+
"author": "behowell@microsoft.com",
|
|
53
|
+
"package": "@fluentui/react-checkbox",
|
|
54
|
+
"commit": "9c6efea1aea75e3e0d7355a729785ade9af638c5",
|
|
55
|
+
"comment": "chore: Update Checkbox to use griffel reset styles"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"author": "beachball",
|
|
59
|
+
"package": "@fluentui/react-checkbox",
|
|
60
|
+
"comment": "Bump @fluentui/react-field to v9.0.0-alpha.11",
|
|
61
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"author": "beachball",
|
|
65
|
+
"package": "@fluentui/react-checkbox",
|
|
66
|
+
"comment": "Bump @fluentui/react-label to v9.0.13",
|
|
67
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"author": "beachball",
|
|
71
|
+
"package": "@fluentui/react-checkbox",
|
|
72
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.3",
|
|
73
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"author": "beachball",
|
|
77
|
+
"package": "@fluentui/react-checkbox",
|
|
78
|
+
"comment": "Bump @fluentui/react-theme to v9.1.4",
|
|
79
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"author": "beachball",
|
|
83
|
+
"package": "@fluentui/react-checkbox",
|
|
84
|
+
"comment": "Bump @fluentui/react-utilities to v9.3.0",
|
|
85
|
+
"commit": "e7530bc179fd0e303448083c76a4af41a0e15322"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"none": [
|
|
89
|
+
{
|
|
90
|
+
"author": "behowell@microsoft.com",
|
|
91
|
+
"package": "@fluentui/react-checkbox",
|
|
92
|
+
"commit": "9693ad97624e44786c6fa0418c7f5e8fa407af2a",
|
|
93
|
+
"comment": "chore: Add Checkbox bundle size test"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"date": "Mon, 05 Dec 2022 18:29:39 GMT",
|
|
6
100
|
"tag": "@fluentui/react-checkbox_v9.0.14",
|
|
7
101
|
"version": "9.0.14",
|
|
8
102
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-checkbox
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 21 Dec 2022 10:17:10 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.16)
|
|
8
|
+
|
|
9
|
+
Wed, 21 Dec 2022 10:17:10 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.0.15..@fluentui/react-checkbox_v9.0.16)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-field to v9.0.0-alpha.12 ([commit](https://github.com/microsoft/fluentui/commit/66bf89f634cad4a275e957d7a2214c7e73ff8c2e) by beachball)
|
|
15
|
+
- Bump @fluentui/react-label to v9.0.14 ([commit](https://github.com/microsoft/fluentui/commit/66bf89f634cad4a275e957d7a2214c7e73ff8c2e) by beachball)
|
|
16
|
+
- Bump @fluentui/react-tabster to v9.3.4 ([commit](https://github.com/microsoft/fluentui/commit/66bf89f634cad4a275e957d7a2214c7e73ff8c2e) by beachball)
|
|
17
|
+
- Bump @fluentui/react-theme to v9.1.5 ([commit](https://github.com/microsoft/fluentui/commit/66bf89f634cad4a275e957d7a2214c7e73ff8c2e) by beachball)
|
|
18
|
+
|
|
19
|
+
## [9.0.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.15)
|
|
20
|
+
|
|
21
|
+
Tue, 20 Dec 2022 14:59:22 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.0.14..@fluentui/react-checkbox_v9.0.15)
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- chore: Update Checkbox to use griffel reset styles ([PR #25984](https://github.com/microsoft/fluentui/pull/25984) by behowell@microsoft.com)
|
|
27
|
+
- Bump @fluentui/react-field to v9.0.0-alpha.11 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
28
|
+
- Bump @fluentui/react-label to v9.0.13 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
29
|
+
- Bump @fluentui/react-tabster to v9.3.3 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
30
|
+
- Bump @fluentui/react-theme to v9.1.4 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
31
|
+
- Bump @fluentui/react-utilities to v9.3.0 ([PR #26047](https://github.com/microsoft/fluentui/pull/26047) by beachball)
|
|
32
|
+
|
|
7
33
|
## [9.0.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-checkbox_v9.0.14)
|
|
8
34
|
|
|
9
|
-
Mon, 05 Dec 2022 18:
|
|
35
|
+
Mon, 05 Dec 2022 18:29:39 GMT
|
|
10
36
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-checkbox_v9.0.13..@fluentui/react-checkbox_v9.0.14)
|
|
11
37
|
|
|
12
38
|
### Patches
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
2
|
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
|
3
3
|
import { tokens } from '@fluentui/react-theme';
|
|
4
4
|
export const checkboxClassNames = {
|
|
@@ -11,177 +11,27 @@ export const checkboxClassNames = {
|
|
|
11
11
|
const indicatorSizeMedium = '16px';
|
|
12
12
|
const indicatorSizeLarge = '20px';
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"mc9l5x": "ftuwxu6",
|
|
18
|
-
"Brovlpu": "ftqa4ok",
|
|
19
|
-
"B486eqv": "f2hkw1w",
|
|
20
|
-
"Bssx7fj": "f1b1k54r",
|
|
21
|
-
"uh7if5": ["f4ne723", "fqqcjud"],
|
|
22
|
-
"clntm0": "fh7aioi",
|
|
23
|
-
"Dlk2r6": ["fqqcjud", "f4ne723"],
|
|
24
|
-
"B2j2mmj": "ffht0p2",
|
|
25
|
-
"wigs8": "f1p0ul1q",
|
|
26
|
-
"pbfy6t": "f1c901ms",
|
|
27
|
-
"B0v4ure": "f1alokd7",
|
|
28
|
-
"ghq09": "f78i1la",
|
|
29
|
-
"B24cy0v": ["f1kvsw7t", "f1bw8brt"],
|
|
30
|
-
"Bwckmig": "f8k7e5g",
|
|
31
|
-
"Bvwlmkc": ["f1bw8brt", "f1kvsw7t"],
|
|
32
|
-
"Bbgo44z": "f1pmxfrl",
|
|
33
|
-
"Bil7v7r": ["fszkfcr", "f1ap5ily"],
|
|
34
|
-
"skfxo0": "f57dp0y",
|
|
35
|
-
"jo1ztg": ["f1ap5ily", "fszkfcr"],
|
|
36
|
-
"Ba3ybja": ["f11dm2qb", "f136rfnd"],
|
|
37
|
-
"az1dzo": ["f136rfnd", "f11dm2qb"],
|
|
38
|
-
"vppk2z": ["fdsq1qd", "f1khssms"],
|
|
39
|
-
"B6352mv": ["f1khssms", "fdsq1qd"],
|
|
40
|
-
"nr063g": "fq4eyks",
|
|
41
|
-
"Blmvk6g": ["f1ya6x16", "ftuszwa"],
|
|
42
|
-
"Bsiemmq": "f1e2iu44",
|
|
43
|
-
"B98u21t": ["ftuszwa", "f1ya6x16"],
|
|
44
|
-
"B2pnrqr": "f1xkdug0",
|
|
45
|
-
"Bhhzhcn": "f1m1ywml",
|
|
46
|
-
"Bec0n69": ["f7u4kgv", "f1a36mvi"],
|
|
47
|
-
"B29w5g4": ["f1a36mvi", "f7u4kgv"]
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
"d": [".f10pi13n{position:relative;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".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;}"],
|
|
51
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
52
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
53
|
-
});
|
|
14
|
+
const useRootBaseClassName = /*#__PURE__*/__resetStyles("r1o1qdo1", "r1niodl4", [".r1o1qdo1{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".r1o1qdo1:focus{outline-style:none;}", ".r1o1qdo1:focus-visible{outline-style:none;}", ".r1o1qdo1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1o1qdo1[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;}", ".r1niodl4{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".r1niodl4:focus{outline-style:none;}", ".r1niodl4:focus-visible{outline-style:none;}", ".r1niodl4[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r1niodl4[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
|
+
|
|
16
|
+
const useInputBaseClassName = /*#__PURE__*/__resetStyles("rfcvz6l", null, [".rfcvz6l{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));}", ".rfcvz6l:not(:checked):not(:indeterminate)~.fui-Checkbox__indicator>*{opacity:0;}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate)~.fui-Checkbox__label{color:var(--colorNeutralForeground3);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate)~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):hover~.fui-Checkbox__label{color:var(--colorNeutralForeground2);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):hover~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):active:hover~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):active:hover~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".rfcvz6l:enabled:checked:not(:indeterminate)~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:checked:not(:indeterminate)~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorCompoundBrandBackground);}", ".rfcvz6l:enabled:checked:not(:indeterminate):hover~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorCompoundBrandBackgroundHover);}", ".rfcvz6l:enabled:checked:not(:indeterminate):active:hover~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorCompoundBrandBackgroundPressed);}", ".rfcvz6l:enabled:indeterminate~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:indeterminate~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".rfcvz6l:enabled:indeterminate:hover~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".rfcvz6l:enabled:indeterminate:active:hover~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".rfcvz6l:disabled{cursor:default;}", ".rfcvz6l:disabled~.fui-Checkbox__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__label{color:GrayText;}}", ".rfcvz6l:disabled~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__indicator{color:GrayText;}}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__indicator svg{color:GrayText;}}"]);
|
|
54
17
|
|
|
55
18
|
const useInputStyles = /*#__PURE__*/__styles({
|
|
56
|
-
"base": {
|
|
57
|
-
"B7ck84d": "f1ewtqcl",
|
|
58
|
-
"Bceei9c": "f1k6fduh",
|
|
59
|
-
"Bqenvij": "f1l02sjl",
|
|
60
|
-
"B6of3ja": "f1hu3pq6",
|
|
61
|
-
"t21cq0": ["f11qmguv", "f1tyq0we"],
|
|
62
|
-
"jrapky": "f19f4twv",
|
|
63
|
-
"Frg6f3": ["f1tyq0we", "f11qmguv"],
|
|
64
|
-
"abs64n": "fk73vx1",
|
|
65
|
-
"qhf8xq": "f1euv43f",
|
|
66
|
-
"Bhzewxz": "f15twtuk",
|
|
67
|
-
"B26k0as": "f1yrrd5t",
|
|
68
|
-
"k0xvi9": "fvfr0er",
|
|
69
|
-
"Bqb28oy": "fcwiijr",
|
|
70
|
-
"Fszymg": ["f11s8ldy", "f37mzfx"],
|
|
71
|
-
"s5xoki": "forfpyi",
|
|
72
|
-
"cfw8t2": ["f37mzfx", "f11s8ldy"],
|
|
73
|
-
"b9fajx": "f1vd61pd",
|
|
74
|
-
"pff03s": "f1mzgjal",
|
|
75
|
-
"Bk0s23q": ["f1iwu0i3", "f6umev3"],
|
|
76
|
-
"Bfc5gcl": "femu9zt",
|
|
77
|
-
"a4vgqw": ["f6umev3", "f1iwu0i3"],
|
|
78
|
-
"Fum7gy": "f1s8s9qo",
|
|
79
|
-
"B5tev9i": "fuvx3by",
|
|
80
|
-
"ecjak0": ["fuqx993", "f1akce7s"],
|
|
81
|
-
"B006ete": "feccz1o",
|
|
82
|
-
"Bxlzfhf": ["f1akce7s", "fuqx993"],
|
|
83
|
-
"qzqrip": "fqgvcms",
|
|
84
|
-
"xmoia3": "f1wvbx6q",
|
|
85
|
-
"i1phtq": "fxmj0gd",
|
|
86
|
-
"Bi8r3f5": "fkf9h0q",
|
|
87
|
-
"yvncz7": ["faeo8p5", "f4rpdul"],
|
|
88
|
-
"D2mvea": "fsk3itm",
|
|
89
|
-
"Bjmkmyo": ["f4rpdul", "faeo8p5"],
|
|
90
|
-
"B525uqd": "f4wqdms",
|
|
91
|
-
"B5z3g6i": "ftufdon",
|
|
92
|
-
"Bwnzx1a": ["f1ni78ii", "f1pe82pw"],
|
|
93
|
-
"w3j1jp": "fxl8eb7",
|
|
94
|
-
"n2zbqb": ["f1pe82pw", "f1ni78ii"],
|
|
95
|
-
"Bek439x": "f12pgwe7",
|
|
96
|
-
"Bgt4g9q": "f1c5u0pt",
|
|
97
|
-
"Bkzkukt": ["fyfn4nz", "f1aaeu2t"],
|
|
98
|
-
"wg1kw8": "ffzx9q8",
|
|
99
|
-
"Bh7u92y": ["f1aaeu2t", "fyfn4nz"],
|
|
100
|
-
"B40413r": "f1rm0htn",
|
|
101
|
-
"B9f5amx": "fpb7n6l",
|
|
102
|
-
"gbnyp0": ["f1uwkm0d", "fakdbj6"],
|
|
103
|
-
"ilwfws": "f180qsza",
|
|
104
|
-
"Fk4w3x": ["fakdbj6", "f1uwkm0d"],
|
|
105
|
-
"tfmijd": "f3nyagc",
|
|
106
|
-
"Bketd8w": "f1eh922j",
|
|
107
|
-
"s1clob": ["f1f3l6lh", "faa1us6"],
|
|
108
|
-
"B8s8lrk": "f1g6jlfz",
|
|
109
|
-
"Bp3qae9": ["faa1us6", "f1f3l6lh"],
|
|
110
|
-
"c4h28b": "f1d2ycii",
|
|
111
|
-
"Bvff7ki": "f18ruat1",
|
|
112
|
-
"B0usqpl": ["f18b6ltw", "fd6ao2z"],
|
|
113
|
-
"ckdfsi": "fdz9k82",
|
|
114
|
-
"B2hfjzz": ["fd6ao2z", "f18b6ltw"],
|
|
115
|
-
"B0rx68v": "f8c3d4w",
|
|
116
|
-
"ezr58z": "fvxnmui",
|
|
117
|
-
"B8h3e3j": "fds6yy4",
|
|
118
|
-
"Bdfu378": "f1ceq7vh",
|
|
119
|
-
"Bhmh25c": "f2zvonr",
|
|
120
|
-
"fvfg5q": "f4ohyq5",
|
|
121
|
-
"Bbnnodr": ["f1kakd2g", "f3ulah5"],
|
|
122
|
-
"B7y28oj": "f5fda5m",
|
|
123
|
-
"Dpxclb": ["f3ulah5", "f1kakd2g"],
|
|
124
|
-
"E1kcat": "f1c3drxw",
|
|
125
|
-
"Bt6osj6": "f8cdtmm",
|
|
126
|
-
"Jop56w": "f8701xt"
|
|
127
|
-
},
|
|
128
19
|
"before": {
|
|
129
20
|
"j35jbq": ["f1e31b4d", "f1vgc2s3"]
|
|
130
21
|
},
|
|
131
22
|
"after": {
|
|
132
23
|
"oyh7mz": ["f1vgc2s3", "f1e31b4d"]
|
|
133
24
|
},
|
|
134
|
-
"medium": {
|
|
135
|
-
"a9b677": "fwr58v7"
|
|
136
|
-
},
|
|
137
25
|
"large": {
|
|
138
26
|
"a9b677": "f1mq5jt6"
|
|
139
27
|
}
|
|
140
28
|
}, {
|
|
141
|
-
"d": [".
|
|
142
|
-
"m": [["@media (forced-colors: active){.f2zvonr:disabled~.fui-Checkbox__label{color:GrayText;}}", {
|
|
143
|
-
"m": "(forced-colors: active)"
|
|
144
|
-
}], ["@media (forced-colors: active){.f8cdtmm:disabled~.fui-Checkbox__indicator{color:GrayText;}}", {
|
|
145
|
-
"m": "(forced-colors: active)"
|
|
146
|
-
}], ["@media (forced-colors: active){.f8701xt:disabled~.fui-Checkbox__indicator svg{color:GrayText;}}", {
|
|
147
|
-
"m": "(forced-colors: active)"
|
|
148
|
-
}]]
|
|
29
|
+
"d": [".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f1mq5jt6{width:calc(20px + 2 * var(--spacingHorizontalS));}"]
|
|
149
30
|
});
|
|
150
31
|
|
|
32
|
+
const useIndicatorBaseClassName = /*#__PURE__*/__resetStyles("r1jvlehe", null, [".r1jvlehe{-webkit-align-self:flex-start;-ms-flex-item-align:flex-start;align-self:flex-start;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(--borderRadiusSmall);margin:var(--spacingVerticalS) var(--spacingHorizontalS);fill:currentColor;pointer-events:none;font-size:12px;height:16px;width:16px;}"]);
|
|
33
|
+
|
|
151
34
|
const useIndicatorStyles = /*#__PURE__*/__styles({
|
|
152
|
-
"base": {
|
|
153
|
-
"qb2dma": "fjgzulp",
|
|
154
|
-
"B7ck84d": "f1ewtqcl",
|
|
155
|
-
"Bnnss6s": "fi64zpg",
|
|
156
|
-
"mc9l5x": "f22iagw",
|
|
157
|
-
"Bt984gj": "f122n59",
|
|
158
|
-
"Brf1p80": "f4d9j23",
|
|
159
|
-
"B68tc82": "f1p9o1ba",
|
|
160
|
-
"Bmxbyg5": "f1sil6mw",
|
|
161
|
-
"B4j52fo": "f192inf7",
|
|
162
|
-
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
|
163
|
-
"Bn0qgzm": "f1vxd6vx",
|
|
164
|
-
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
|
165
|
-
"icvyot": "fzkkow9",
|
|
166
|
-
"vrafjx": ["fcdblym", "fjik90z"],
|
|
167
|
-
"oivjwe": "fg706s2",
|
|
168
|
-
"wvpqe5": ["fjik90z", "fcdblym"],
|
|
169
|
-
"Bbmb7ep": ["f1g3puop", "fi2rrw2"],
|
|
170
|
-
"Beyfa6y": ["fi2rrw2", "f1g3puop"],
|
|
171
|
-
"B7oj6ja": ["f1rstyi9", "f1s4nn1u"],
|
|
172
|
-
"Btl43ni": ["f1s4nn1u", "f1rstyi9"],
|
|
173
|
-
"B6of3ja": "frnwi6n",
|
|
174
|
-
"t21cq0": ["f1vcna3q", "foyynoy"],
|
|
175
|
-
"jrapky": "fqcjy3b",
|
|
176
|
-
"Frg6f3": ["foyynoy", "f1vcna3q"],
|
|
177
|
-
"Bkfmm31": "f1w9h62z",
|
|
178
|
-
"Bkecrkj": "f1aehjj5"
|
|
179
|
-
},
|
|
180
|
-
"medium": {
|
|
181
|
-
"Be2twd7": "f1ugzwwg",
|
|
182
|
-
"Bqenvij": "fd461yt",
|
|
183
|
-
"a9b677": "fjw5fx7"
|
|
184
|
-
},
|
|
185
35
|
"large": {
|
|
186
36
|
"Be2twd7": "f4ybsrx",
|
|
187
37
|
"Bqenvij": "fjamq6b",
|
|
@@ -194,13 +44,13 @@ const useIndicatorStyles = /*#__PURE__*/__styles({
|
|
|
194
44
|
"Btl43ni": ["f1s8kh49", "f1djnp8u"]
|
|
195
45
|
}
|
|
196
46
|
}, {
|
|
197
|
-
"d": [".
|
|
198
|
-
});
|
|
47
|
+
"d": [".f4ybsrx{font-size:16px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}", ".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);}"]
|
|
48
|
+
}); // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
49
|
+
|
|
199
50
|
|
|
200
51
|
const useLabelStyles = /*#__PURE__*/__styles({
|
|
201
52
|
"base": {
|
|
202
53
|
"qb2dma": "f7nlbp4",
|
|
203
|
-
"sj55zd": "f1ym3bx4",
|
|
204
54
|
"Bceei9c": "f1k6fduh",
|
|
205
55
|
"z8tnut": "f1kwiid1",
|
|
206
56
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
@@ -222,7 +72,7 @@ const useLabelStyles = /*#__PURE__*/__styles({
|
|
|
222
72
|
"jrapky": "f49ad5g"
|
|
223
73
|
}
|
|
224
74
|
}, {
|
|
225
|
-
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".
|
|
75
|
+
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1k6fduh{cursor:pointer;}", ".f1kwiid1{padding-top:var(--spacingVerticalS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f5b47ha{padding-bottom:var(--spacingVerticalS);}", ".f7x41pl{padding-right:var(--spacingHorizontalXS);}", ".fruq291{padding-left:var(--spacingHorizontalXS);}", ".fjzwpt6{margin-top:calc((16px - var(--lineHeightBase300)) / 2);}", ".fh6j2fo{margin-bottom:calc((16px - var(--lineHeightBase300)) / 2);}", ".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}", ".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}"]
|
|
226
76
|
});
|
|
227
77
|
/**
|
|
228
78
|
* Apply styling to the Checkbox slots based on the state
|
|
@@ -230,19 +80,21 @@ const useLabelStyles = /*#__PURE__*/__styles({
|
|
|
230
80
|
|
|
231
81
|
|
|
232
82
|
export const useCheckboxStyles_unstable = state => {
|
|
233
|
-
const rootStyles = useRootStyles();
|
|
234
|
-
state.root.className = mergeClasses(checkboxClassNames.root, rootStyles.base, state.root.className);
|
|
235
83
|
const {
|
|
236
84
|
labelPosition,
|
|
237
85
|
shape,
|
|
238
86
|
size
|
|
239
87
|
} = state;
|
|
88
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
89
|
+
state.root.className = mergeClasses(checkboxClassNames.root, rootBaseClassName, state.root.className);
|
|
90
|
+
const inputBaseClassName = useInputBaseClassName();
|
|
240
91
|
const inputStyles = useInputStyles();
|
|
241
|
-
state.input.className = mergeClasses(checkboxClassNames.input,
|
|
92
|
+
state.input.className = mergeClasses(checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
93
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
|
242
94
|
const indicatorStyles = useIndicatorStyles();
|
|
243
95
|
|
|
244
96
|
if (state.indicator) {
|
|
245
|
-
state.indicator.className = mergeClasses(checkboxClassNames.indicator,
|
|
97
|
+
state.indicator.className = mergeClasses(checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
246
98
|
}
|
|
247
99
|
|
|
248
100
|
const labelStyles = useLabelStyles();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-checkbox/src/components/Checkbox/useCheckboxStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,kBAAkB,GAAkC;EAC/D,IAAI,EAAE,cADyD;EAE/D,KAAK,EAAE,qBAFwD;EAG/D,KAAK,EAAE,qBAHwD;EAI/D,SAAS,EAAE;AA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ClC,kBAAkB,CAAC,KADe,EAElC,WAAW,CAAC,IAFsB,EAGlC,WAAW,CAAC,IAAD,CAHuB,EAIlC,WAAW,CAAC,aAAD,CAJuB,EAKlC,KAAK,CAAC,KAAN,CAAY,SALsB,CAApC;EAOD;;EAED,OAAO,KAAP;AACD,CAtCM","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootStyles = makeStyles({\n base: {\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n ...shorthands.margin(0),\n opacity: 0,\n position: 'absolute',\n top: 0,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackground),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundPressed),\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStroke),\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokeHover),\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokePressed),\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n medium: {\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n },\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n alignSelf: 'flex-start',\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.borderRadiusSmall),\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n\n medium: {\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n },\n\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n color: 'inherit',\n cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(checkboxClassNames.root, rootStyles.base, state.root.className);\n\n const { labelPosition, shape, size } = state;\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputStyles.base,\n inputStyles[size],\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorStyles.base,\n indicatorStyles[size],\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-checkbox/src/components/Checkbox/useCheckboxStyles.ts"],"names":[],"mappings":"AAAA,kCAAsC,YAAtC,EAAoD,UAApD,QAAsE,gBAAtE;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,kBAAkB,GAAkC;EAC/D,IAAI,EAAE,cADyD;EAE/D,KAAK,EAAE,qBAFwD;EAG/D,KAAK,EAAE,qBAHwD;EAI/D,SAAS,EAAE;AAJoD,CAA1D,C,CAOP;;AACA,MAAM,mBAAmB,GAAG,MAA5B;AACA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BAAkB,EAA1C;;EACA,IAAI,KAAK,CAAC,SAAV,EAAqB;IACnB,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CACtC,kBAAkB,CAAC,SADmB,EAEtC,sBAFsC,EAGtC,IAAI,KAAK,OAAT,IAAoB,eAAe,CAAC,KAHE,EAItC,KAAK,KAAK,UAAV,IAAwB,eAAe,CAAC,QAJF,EAKtC,KAAK,CAAC,SAAN,CAAgB,SALsB,CAAxC;EAOD;;EAED,MAAM,WAAW,GAAG,cAAc,EAAlC;;EACA,IAAI,KAAK,CAAC,KAAV,EAAiB;IACf,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,YAAY,CAClC,kBAAkB,CAAC,KADe,EAElC,WAAW,CAAC,IAFsB,EAGlC,WAAW,CAAC,IAAD,CAHuB,EAIlC,WAAW,CAAC,aAAD,CAJuB,EAKlC,KAAK,CAAC,KAAN,CAAY,SALsB,CAApC;EAOD;;EAED,OAAO,KAAP;AACD,CAxCM","sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootBaseClassName = makeResetStyles({\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n top: 0,\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorCompoundBrandBackground,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorCompoundBrandBackgroundHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorCompoundBrandBackgroundPressed,\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokePressed,\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n alignSelf: 'flex-start',\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.borderRadiusSmall,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n});\n\nconst useIndicatorStyles = makeStyles({\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\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 cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const { labelPosition, shape, size } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(checkboxClassNames.root, rootBaseClassName, state.root.className);\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputBaseClassName,\n size === 'large' && inputStyles.large,\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorBaseClassName,\n size === 'large' && indicatorStyles.large,\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -12,58 +12,94 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-tabste
|
|
|
12
12
|
// The indicator size is used by the indicator and label styles
|
|
13
13
|
var indicatorSizeMedium = '16px';
|
|
14
14
|
var indicatorSizeLarge = '20px';
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
var useRootBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ position: 'relative', display: 'inline-flex' }, react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' })));
|
|
16
|
+
var useInputBaseClassName = react_1.makeResetStyles((_a = {
|
|
17
|
+
boxSizing: 'border-box',
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
height: '100%',
|
|
20
|
+
margin: 0,
|
|
21
|
+
opacity: 0,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: 0,
|
|
24
|
+
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
|
25
|
+
// This is done so that clicking on that "empty space" still toggles the checkbox.
|
|
26
|
+
width: "calc(" + indicatorSizeMedium + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")"
|
|
27
|
+
},
|
|
28
|
+
// When unchecked, hide the the checkmark icon (child of the indicator slot)
|
|
29
|
+
_a[":not(:checked):not(:indeterminate) ~ ." + exports.checkboxClassNames.indicator + " > *"] = {
|
|
20
30
|
opacity: 0,
|
|
21
|
-
},
|
|
31
|
+
},
|
|
22
32
|
// Colors for the unchecked state
|
|
23
33
|
_a[':enabled:not(:checked):not(:indeterminate)'] = (_b = {},
|
|
24
34
|
_b["& ~ ." + exports.checkboxClassNames.label] = {
|
|
25
35
|
color: react_theme_1.tokens.colorNeutralForeground3,
|
|
26
36
|
},
|
|
27
|
-
_b["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
37
|
+
_b["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
38
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessible,
|
|
39
|
+
},
|
|
28
40
|
_b[':hover'] = (_c = {},
|
|
29
41
|
_c["& ~ ." + exports.checkboxClassNames.label] = {
|
|
30
42
|
color: react_theme_1.tokens.colorNeutralForeground2,
|
|
31
43
|
},
|
|
32
|
-
_c["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
44
|
+
_c["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
45
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
|
|
46
|
+
},
|
|
33
47
|
_c),
|
|
34
48
|
_b[':active:hover'] = (_d = {},
|
|
35
49
|
_d["& ~ ." + exports.checkboxClassNames.label] = {
|
|
36
50
|
color: react_theme_1.tokens.colorNeutralForeground1,
|
|
37
51
|
},
|
|
38
|
-
_d["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
52
|
+
_d["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
53
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed,
|
|
54
|
+
},
|
|
39
55
|
_d),
|
|
40
|
-
_b),
|
|
56
|
+
_b),
|
|
41
57
|
// Colors for the checked state
|
|
42
58
|
_a[':enabled:checked:not(:indeterminate)'] = (_e = {},
|
|
43
59
|
_e["& ~ ." + exports.checkboxClassNames.label] = {
|
|
44
60
|
color: react_theme_1.tokens.colorNeutralForeground1,
|
|
45
61
|
},
|
|
46
|
-
_e["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
62
|
+
_e["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
63
|
+
backgroundColor: react_theme_1.tokens.colorCompoundBrandBackground,
|
|
64
|
+
color: react_theme_1.tokens.colorNeutralForegroundInverted,
|
|
65
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandBackground,
|
|
66
|
+
},
|
|
47
67
|
_e[':hover'] = (_f = {},
|
|
48
|
-
_f["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
68
|
+
_f["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
69
|
+
backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundHover,
|
|
70
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandBackgroundHover,
|
|
71
|
+
},
|
|
49
72
|
_f),
|
|
50
73
|
_e[':active:hover'] = (_g = {},
|
|
51
|
-
_g["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
74
|
+
_g["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
75
|
+
backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundPressed,
|
|
76
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandBackgroundPressed,
|
|
77
|
+
},
|
|
52
78
|
_g),
|
|
53
|
-
_e),
|
|
79
|
+
_e),
|
|
54
80
|
// Colors for the mixed state
|
|
55
81
|
_a[':enabled:indeterminate'] = (_h = {},
|
|
56
82
|
_h["& ~ ." + exports.checkboxClassNames.label] = {
|
|
57
83
|
color: react_theme_1.tokens.colorNeutralForeground1,
|
|
58
84
|
},
|
|
59
|
-
_h["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
85
|
+
_h["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
86
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStroke,
|
|
87
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1,
|
|
88
|
+
},
|
|
60
89
|
_h[':hover'] = (_j = {},
|
|
61
|
-
_j["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
90
|
+
_j["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
91
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStrokeHover,
|
|
92
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1Hover,
|
|
93
|
+
},
|
|
62
94
|
_j),
|
|
63
95
|
_h[':active:hover'] = (_k = {},
|
|
64
|
-
_k["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
96
|
+
_k["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
97
|
+
borderColor: react_theme_1.tokens.colorCompoundBrandStrokePressed,
|
|
98
|
+
color: react_theme_1.tokens.colorCompoundBrandForeground1Pressed,
|
|
99
|
+
},
|
|
65
100
|
_k),
|
|
66
|
-
_h),
|
|
101
|
+
_h),
|
|
102
|
+
_a[':disabled'] = (_l = {
|
|
67
103
|
cursor: 'default'
|
|
68
104
|
},
|
|
69
105
|
_l["& ~ ." + exports.checkboxClassNames.label] = {
|
|
@@ -73,37 +109,49 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-tabste
|
|
|
73
109
|
color: 'GrayText',
|
|
74
110
|
},
|
|
75
111
|
},
|
|
76
|
-
_l["& ~ ." + exports.checkboxClassNames.indicator] =
|
|
112
|
+
_l["& ~ ." + exports.checkboxClassNames.indicator] = {
|
|
113
|
+
borderColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
|
|
114
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
|
115
|
+
'@media (forced-colors: active)': {
|
|
77
116
|
color: 'GrayText',
|
|
78
|
-
}
|
|
117
|
+
},
|
|
118
|
+
},
|
|
79
119
|
_l["& ~ ." + exports.checkboxClassNames.indicator + " svg"] = {
|
|
80
120
|
'@media (forced-colors: active)': {
|
|
81
121
|
color: 'GrayText',
|
|
82
122
|
},
|
|
83
123
|
},
|
|
84
|
-
_l),
|
|
124
|
+
_l),
|
|
125
|
+
_a));
|
|
126
|
+
var useInputStyles = react_1.makeStyles({
|
|
85
127
|
before: {
|
|
86
128
|
right: 0,
|
|
87
129
|
},
|
|
88
130
|
after: {
|
|
89
131
|
left: 0,
|
|
90
132
|
},
|
|
91
|
-
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
|
92
|
-
// This is done so that clicking on that "empty space" still toggles the checkbox.
|
|
93
|
-
medium: {
|
|
94
|
-
width: "calc(" + indicatorSizeMedium + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
|
|
95
|
-
},
|
|
96
133
|
large: {
|
|
97
134
|
width: "calc(" + indicatorSizeLarge + " + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
|
|
98
135
|
},
|
|
99
136
|
});
|
|
137
|
+
var useIndicatorBaseClassName = react_1.makeResetStyles({
|
|
138
|
+
alignSelf: 'flex-start',
|
|
139
|
+
boxSizing: 'border-box',
|
|
140
|
+
flexShrink: 0,
|
|
141
|
+
display: 'flex',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
justifyContent: 'center',
|
|
144
|
+
overflow: 'hidden',
|
|
145
|
+
border: react_theme_1.tokens.strokeWidthThin + ' solid',
|
|
146
|
+
borderRadius: react_theme_1.tokens.borderRadiusSmall,
|
|
147
|
+
margin: react_theme_1.tokens.spacingVerticalS + ' ' + react_theme_1.tokens.spacingHorizontalS,
|
|
148
|
+
fill: 'currentColor',
|
|
149
|
+
pointerEvents: 'none',
|
|
150
|
+
fontSize: '12px',
|
|
151
|
+
height: indicatorSizeMedium,
|
|
152
|
+
width: indicatorSizeMedium,
|
|
153
|
+
});
|
|
100
154
|
var useIndicatorStyles = react_1.makeStyles({
|
|
101
|
-
base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ alignSelf: 'flex-start', boxSizing: 'border-box', flexShrink: 0, display: 'flex', alignItems: 'center', justifyContent: 'center' }, react_1.shorthands.overflow('hidden')), react_1.shorthands.border(react_theme_1.tokens.strokeWidthThin, 'solid')), react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusSmall)), react_1.shorthands.margin(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalS)), { fill: 'currentColor', pointerEvents: 'none' }),
|
|
102
|
-
medium: {
|
|
103
|
-
fontSize: '12px',
|
|
104
|
-
height: indicatorSizeMedium,
|
|
105
|
-
width: indicatorSizeMedium,
|
|
106
|
-
},
|
|
107
155
|
large: {
|
|
108
156
|
fontSize: '16px',
|
|
109
157
|
height: indicatorSizeLarge,
|
|
@@ -111,8 +159,9 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-tabste
|
|
|
111
159
|
},
|
|
112
160
|
circular: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular)),
|
|
113
161
|
});
|
|
162
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
114
163
|
var useLabelStyles = react_1.makeStyles({
|
|
115
|
-
base: tslib_1.__assign({ alignSelf: 'center',
|
|
164
|
+
base: tslib_1.__assign({ alignSelf: 'center', cursor: 'pointer' }, react_1.shorthands.padding(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalS)),
|
|
116
165
|
before: {
|
|
117
166
|
paddingRight: react_theme_1.tokens.spacingHorizontalXS,
|
|
118
167
|
},
|
|
@@ -134,14 +183,16 @@ define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-tabste
|
|
|
134
183
|
* Apply styling to the Checkbox slots based on the state
|
|
135
184
|
*/
|
|
136
185
|
var useCheckboxStyles_unstable = function (state) {
|
|
137
|
-
var rootStyles = useRootStyles();
|
|
138
|
-
state.root.className = react_1.mergeClasses(exports.checkboxClassNames.root, rootStyles.base, state.root.className);
|
|
139
186
|
var labelPosition = state.labelPosition, shape = state.shape, size = state.size;
|
|
187
|
+
var rootBaseClassName = useRootBaseClassName();
|
|
188
|
+
state.root.className = react_1.mergeClasses(exports.checkboxClassNames.root, rootBaseClassName, state.root.className);
|
|
189
|
+
var inputBaseClassName = useInputBaseClassName();
|
|
140
190
|
var inputStyles = useInputStyles();
|
|
141
|
-
state.input.className = react_1.mergeClasses(exports.checkboxClassNames.input,
|
|
191
|
+
state.input.className = react_1.mergeClasses(exports.checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
192
|
+
var indicatorBaseClassName = useIndicatorBaseClassName();
|
|
142
193
|
var indicatorStyles = useIndicatorStyles();
|
|
143
194
|
if (state.indicator) {
|
|
144
|
-
state.indicator.className = react_1.mergeClasses(exports.checkboxClassNames.indicator,
|
|
195
|
+
state.indicator.className = react_1.mergeClasses(exports.checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
145
196
|
}
|
|
146
197
|
var labelStyles = useLabelStyles();
|
|
147
198
|
if (state.label) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckboxStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/useCheckboxStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,kBAAkB,GAAkC;QAC/D,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAE,qBAAqB;QAC5B,SAAS,EAAE,yBAAyB;KACrC,CAAC;IAEF,+DAA+D;IAC/D,IAAM,mBAAmB,GAAG,MAAM,CAAC;IACnC,IAAM,kBAAkB,GAAG,MAAM,CAAC;IAElC,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,IAAI,qBACF,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,aAAa,IACnB,uCAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,CACpE;KACF,CAAC,CAAC;IAEH,IAAM,cAAc,GAAG,kBAAU,CAAC;QAChC,IAAI,sCACF,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,IACX,kBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,WACvB,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,CAAC,OAGL,2CAAyC,0BAAkB,CAAC,SAAS,SAAM,IAAG;YAC7E,OAAO,EAAE,CAAC;SACX;QAED,iCAAiC;QACjC,gDAA4C;YAC1C,GAAC,UAAQ,0BAAkB,CAAC,KAAO,IAAG;gBACpC,KAAK,EAAE,o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,CAAC,IAAI,EACpB,eAAe,CAAC,IAAI,CAAC,EACrB,KAAK,KAAK,UAAU,IAAI,eAAe,CAAC,QAAQ,EAChD,KAAK,CAAC,SAAS,CAAC,SAAS,CAC1B,CAAC;SACH;QAED,IAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,0BAAkB,CAAC,KAAK,EACxB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,IAAI,CAAC,EACjB,WAAW,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAtCW,QAAA,0BAA0B,8BAsCrC","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootStyles = makeStyles({\n base: {\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n ...shorthands.margin(0),\n opacity: 0,\n position: 'absolute',\n top: 0,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackground),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundPressed),\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStroke),\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokeHover),\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokePressed),\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n medium: {\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n },\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n alignSelf: 'flex-start',\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.borderRadiusSmall),\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n\n medium: {\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n },\n\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n color: 'inherit',\n cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(checkboxClassNames.root, rootStyles.base, state.root.className);\n\n const { labelPosition, shape, size } = state;\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputStyles.base,\n inputStyles[size],\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorStyles.base,\n indicatorStyles[size],\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"useCheckboxStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-checkbox/src/components/Checkbox/use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,CACtB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAxCW,QAAA,0BAA0B,8BAwCrC","sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootBaseClassName = makeResetStyles({\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n top: 0,\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorCompoundBrandBackground,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorCompoundBrandBackgroundHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorCompoundBrandBackgroundPressed,\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokePressed,\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n alignSelf: 'flex-start',\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.borderRadiusSmall,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n});\n\nconst useIndicatorStyles = makeStyles({\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\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 cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const { labelPosition, shape, size } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(checkboxClassNames.root, rootBaseClassName, state.root.className);\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputBaseClassName,\n size === 'large' && inputStyles.large,\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorBaseClassName,\n size === 'large' && indicatorStyles.large,\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
|
|
@@ -21,177 +21,27 @@ exports.checkboxClassNames = {
|
|
|
21
21
|
const indicatorSizeMedium = '16px';
|
|
22
22
|
const indicatorSizeLarge = '20px';
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"mc9l5x": "ftuwxu6",
|
|
28
|
-
"Brovlpu": "ftqa4ok",
|
|
29
|
-
"B486eqv": "f2hkw1w",
|
|
30
|
-
"Bssx7fj": "f1b1k54r",
|
|
31
|
-
"uh7if5": ["f4ne723", "fqqcjud"],
|
|
32
|
-
"clntm0": "fh7aioi",
|
|
33
|
-
"Dlk2r6": ["fqqcjud", "f4ne723"],
|
|
34
|
-
"B2j2mmj": "ffht0p2",
|
|
35
|
-
"wigs8": "f1p0ul1q",
|
|
36
|
-
"pbfy6t": "f1c901ms",
|
|
37
|
-
"B0v4ure": "f1alokd7",
|
|
38
|
-
"ghq09": "f78i1la",
|
|
39
|
-
"B24cy0v": ["f1kvsw7t", "f1bw8brt"],
|
|
40
|
-
"Bwckmig": "f8k7e5g",
|
|
41
|
-
"Bvwlmkc": ["f1bw8brt", "f1kvsw7t"],
|
|
42
|
-
"Bbgo44z": "f1pmxfrl",
|
|
43
|
-
"Bil7v7r": ["fszkfcr", "f1ap5ily"],
|
|
44
|
-
"skfxo0": "f57dp0y",
|
|
45
|
-
"jo1ztg": ["f1ap5ily", "fszkfcr"],
|
|
46
|
-
"Ba3ybja": ["f11dm2qb", "f136rfnd"],
|
|
47
|
-
"az1dzo": ["f136rfnd", "f11dm2qb"],
|
|
48
|
-
"vppk2z": ["fdsq1qd", "f1khssms"],
|
|
49
|
-
"B6352mv": ["f1khssms", "fdsq1qd"],
|
|
50
|
-
"nr063g": "fq4eyks",
|
|
51
|
-
"Blmvk6g": ["f1ya6x16", "ftuszwa"],
|
|
52
|
-
"Bsiemmq": "f1e2iu44",
|
|
53
|
-
"B98u21t": ["ftuszwa", "f1ya6x16"],
|
|
54
|
-
"B2pnrqr": "f1xkdug0",
|
|
55
|
-
"Bhhzhcn": "f1m1ywml",
|
|
56
|
-
"Bec0n69": ["f7u4kgv", "f1a36mvi"],
|
|
57
|
-
"B29w5g4": ["f1a36mvi", "f7u4kgv"]
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
"d": [".f10pi13n{position:relative;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".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;}"],
|
|
61
|
-
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
62
|
-
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
63
|
-
});
|
|
24
|
+
const useRootBaseClassName = /*#__PURE__*/react_1.__resetStyles("r1o1qdo1", "r1niodl4", [".r1o1qdo1{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".r1o1qdo1:focus{outline-style:none;}", ".r1o1qdo1:focus-visible{outline-style:none;}", ".r1o1qdo1[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1o1qdo1[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;}", ".r1niodl4{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".r1niodl4:focus{outline-style:none;}", ".r1niodl4:focus-visible{outline-style:none;}", ".r1niodl4[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".r1niodl4[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
|
+
|
|
26
|
+
const useInputBaseClassName = /*#__PURE__*/react_1.__resetStyles("rfcvz6l", null, [".rfcvz6l{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;top:0;width:calc(16px + 2 * var(--spacingHorizontalS));}", ".rfcvz6l:not(:checked):not(:indeterminate)~.fui-Checkbox__indicator>*{opacity:0;}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate)~.fui-Checkbox__label{color:var(--colorNeutralForeground3);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate)~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessible);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):hover~.fui-Checkbox__label{color:var(--colorNeutralForeground2);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):hover~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):active:hover~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:not(:checked):not(:indeterminate):active:hover~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".rfcvz6l:enabled:checked:not(:indeterminate)~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:checked:not(:indeterminate)~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorCompoundBrandBackground);}", ".rfcvz6l:enabled:checked:not(:indeterminate):hover~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorCompoundBrandBackgroundHover);}", ".rfcvz6l:enabled:checked:not(:indeterminate):active:hover~.fui-Checkbox__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorCompoundBrandBackgroundPressed);}", ".rfcvz6l:enabled:indeterminate~.fui-Checkbox__label{color:var(--colorNeutralForeground1);}", ".rfcvz6l:enabled:indeterminate~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStroke);color:var(--colorCompoundBrandForeground1);}", ".rfcvz6l:enabled:indeterminate:hover~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStrokeHover);color:var(--colorCompoundBrandForeground1Hover);}", ".rfcvz6l:enabled:indeterminate:active:hover~.fui-Checkbox__indicator{border-color:var(--colorCompoundBrandStrokePressed);color:var(--colorCompoundBrandForeground1Pressed);}", ".rfcvz6l:disabled{cursor:default;}", ".rfcvz6l:disabled~.fui-Checkbox__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__label{color:GrayText;}}", ".rfcvz6l:disabled~.fui-Checkbox__indicator{border-color:var(--colorNeutralStrokeDisabled);color:var(--colorNeutralForegroundDisabled);}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__indicator{color:GrayText;}}", "@media (forced-colors: active){.rfcvz6l:disabled~.fui-Checkbox__indicator svg{color:GrayText;}}"]);
|
|
64
27
|
|
|
65
28
|
const useInputStyles = /*#__PURE__*/react_1.__styles({
|
|
66
|
-
"base": {
|
|
67
|
-
"B7ck84d": "f1ewtqcl",
|
|
68
|
-
"Bceei9c": "f1k6fduh",
|
|
69
|
-
"Bqenvij": "f1l02sjl",
|
|
70
|
-
"B6of3ja": "f1hu3pq6",
|
|
71
|
-
"t21cq0": ["f11qmguv", "f1tyq0we"],
|
|
72
|
-
"jrapky": "f19f4twv",
|
|
73
|
-
"Frg6f3": ["f1tyq0we", "f11qmguv"],
|
|
74
|
-
"abs64n": "fk73vx1",
|
|
75
|
-
"qhf8xq": "f1euv43f",
|
|
76
|
-
"Bhzewxz": "f15twtuk",
|
|
77
|
-
"B26k0as": "f1yrrd5t",
|
|
78
|
-
"k0xvi9": "fvfr0er",
|
|
79
|
-
"Bqb28oy": "fcwiijr",
|
|
80
|
-
"Fszymg": ["f11s8ldy", "f37mzfx"],
|
|
81
|
-
"s5xoki": "forfpyi",
|
|
82
|
-
"cfw8t2": ["f37mzfx", "f11s8ldy"],
|
|
83
|
-
"b9fajx": "f1vd61pd",
|
|
84
|
-
"pff03s": "f1mzgjal",
|
|
85
|
-
"Bk0s23q": ["f1iwu0i3", "f6umev3"],
|
|
86
|
-
"Bfc5gcl": "femu9zt",
|
|
87
|
-
"a4vgqw": ["f6umev3", "f1iwu0i3"],
|
|
88
|
-
"Fum7gy": "f1s8s9qo",
|
|
89
|
-
"B5tev9i": "fuvx3by",
|
|
90
|
-
"ecjak0": ["fuqx993", "f1akce7s"],
|
|
91
|
-
"B006ete": "feccz1o",
|
|
92
|
-
"Bxlzfhf": ["f1akce7s", "fuqx993"],
|
|
93
|
-
"qzqrip": "fqgvcms",
|
|
94
|
-
"xmoia3": "f1wvbx6q",
|
|
95
|
-
"i1phtq": "fxmj0gd",
|
|
96
|
-
"Bi8r3f5": "fkf9h0q",
|
|
97
|
-
"yvncz7": ["faeo8p5", "f4rpdul"],
|
|
98
|
-
"D2mvea": "fsk3itm",
|
|
99
|
-
"Bjmkmyo": ["f4rpdul", "faeo8p5"],
|
|
100
|
-
"B525uqd": "f4wqdms",
|
|
101
|
-
"B5z3g6i": "ftufdon",
|
|
102
|
-
"Bwnzx1a": ["f1ni78ii", "f1pe82pw"],
|
|
103
|
-
"w3j1jp": "fxl8eb7",
|
|
104
|
-
"n2zbqb": ["f1pe82pw", "f1ni78ii"],
|
|
105
|
-
"Bek439x": "f12pgwe7",
|
|
106
|
-
"Bgt4g9q": "f1c5u0pt",
|
|
107
|
-
"Bkzkukt": ["fyfn4nz", "f1aaeu2t"],
|
|
108
|
-
"wg1kw8": "ffzx9q8",
|
|
109
|
-
"Bh7u92y": ["f1aaeu2t", "fyfn4nz"],
|
|
110
|
-
"B40413r": "f1rm0htn",
|
|
111
|
-
"B9f5amx": "fpb7n6l",
|
|
112
|
-
"gbnyp0": ["f1uwkm0d", "fakdbj6"],
|
|
113
|
-
"ilwfws": "f180qsza",
|
|
114
|
-
"Fk4w3x": ["fakdbj6", "f1uwkm0d"],
|
|
115
|
-
"tfmijd": "f3nyagc",
|
|
116
|
-
"Bketd8w": "f1eh922j",
|
|
117
|
-
"s1clob": ["f1f3l6lh", "faa1us6"],
|
|
118
|
-
"B8s8lrk": "f1g6jlfz",
|
|
119
|
-
"Bp3qae9": ["faa1us6", "f1f3l6lh"],
|
|
120
|
-
"c4h28b": "f1d2ycii",
|
|
121
|
-
"Bvff7ki": "f18ruat1",
|
|
122
|
-
"B0usqpl": ["f18b6ltw", "fd6ao2z"],
|
|
123
|
-
"ckdfsi": "fdz9k82",
|
|
124
|
-
"B2hfjzz": ["fd6ao2z", "f18b6ltw"],
|
|
125
|
-
"B0rx68v": "f8c3d4w",
|
|
126
|
-
"ezr58z": "fvxnmui",
|
|
127
|
-
"B8h3e3j": "fds6yy4",
|
|
128
|
-
"Bdfu378": "f1ceq7vh",
|
|
129
|
-
"Bhmh25c": "f2zvonr",
|
|
130
|
-
"fvfg5q": "f4ohyq5",
|
|
131
|
-
"Bbnnodr": ["f1kakd2g", "f3ulah5"],
|
|
132
|
-
"B7y28oj": "f5fda5m",
|
|
133
|
-
"Dpxclb": ["f3ulah5", "f1kakd2g"],
|
|
134
|
-
"E1kcat": "f1c3drxw",
|
|
135
|
-
"Bt6osj6": "f8cdtmm",
|
|
136
|
-
"Jop56w": "f8701xt"
|
|
137
|
-
},
|
|
138
29
|
"before": {
|
|
139
30
|
"j35jbq": ["f1e31b4d", "f1vgc2s3"]
|
|
140
31
|
},
|
|
141
32
|
"after": {
|
|
142
33
|
"oyh7mz": ["f1vgc2s3", "f1e31b4d"]
|
|
143
34
|
},
|
|
144
|
-
"medium": {
|
|
145
|
-
"a9b677": "fwr58v7"
|
|
146
|
-
},
|
|
147
35
|
"large": {
|
|
148
36
|
"a9b677": "f1mq5jt6"
|
|
149
37
|
}
|
|
150
38
|
}, {
|
|
151
|
-
"d": [".
|
|
152
|
-
"m": [["@media (forced-colors: active){.f2zvonr:disabled~.fui-Checkbox__label{color:GrayText;}}", {
|
|
153
|
-
"m": "(forced-colors: active)"
|
|
154
|
-
}], ["@media (forced-colors: active){.f8cdtmm:disabled~.fui-Checkbox__indicator{color:GrayText;}}", {
|
|
155
|
-
"m": "(forced-colors: active)"
|
|
156
|
-
}], ["@media (forced-colors: active){.f8701xt:disabled~.fui-Checkbox__indicator svg{color:GrayText;}}", {
|
|
157
|
-
"m": "(forced-colors: active)"
|
|
158
|
-
}]]
|
|
39
|
+
"d": [".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f1mq5jt6{width:calc(20px + 2 * var(--spacingHorizontalS));}"]
|
|
159
40
|
});
|
|
160
41
|
|
|
42
|
+
const useIndicatorBaseClassName = /*#__PURE__*/react_1.__resetStyles("r1jvlehe", null, [".r1jvlehe{-webkit-align-self:flex-start;-ms-flex-item-align:flex-start;align-self:flex-start;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(--borderRadiusSmall);margin:var(--spacingVerticalS) var(--spacingHorizontalS);fill:currentColor;pointer-events:none;font-size:12px;height:16px;width:16px;}"]);
|
|
43
|
+
|
|
161
44
|
const useIndicatorStyles = /*#__PURE__*/react_1.__styles({
|
|
162
|
-
"base": {
|
|
163
|
-
"qb2dma": "fjgzulp",
|
|
164
|
-
"B7ck84d": "f1ewtqcl",
|
|
165
|
-
"Bnnss6s": "fi64zpg",
|
|
166
|
-
"mc9l5x": "f22iagw",
|
|
167
|
-
"Bt984gj": "f122n59",
|
|
168
|
-
"Brf1p80": "f4d9j23",
|
|
169
|
-
"B68tc82": "f1p9o1ba",
|
|
170
|
-
"Bmxbyg5": "f1sil6mw",
|
|
171
|
-
"B4j52fo": "f192inf7",
|
|
172
|
-
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
|
173
|
-
"Bn0qgzm": "f1vxd6vx",
|
|
174
|
-
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
|
175
|
-
"icvyot": "fzkkow9",
|
|
176
|
-
"vrafjx": ["fcdblym", "fjik90z"],
|
|
177
|
-
"oivjwe": "fg706s2",
|
|
178
|
-
"wvpqe5": ["fjik90z", "fcdblym"],
|
|
179
|
-
"Bbmb7ep": ["f1g3puop", "fi2rrw2"],
|
|
180
|
-
"Beyfa6y": ["fi2rrw2", "f1g3puop"],
|
|
181
|
-
"B7oj6ja": ["f1rstyi9", "f1s4nn1u"],
|
|
182
|
-
"Btl43ni": ["f1s4nn1u", "f1rstyi9"],
|
|
183
|
-
"B6of3ja": "frnwi6n",
|
|
184
|
-
"t21cq0": ["f1vcna3q", "foyynoy"],
|
|
185
|
-
"jrapky": "fqcjy3b",
|
|
186
|
-
"Frg6f3": ["foyynoy", "f1vcna3q"],
|
|
187
|
-
"Bkfmm31": "f1w9h62z",
|
|
188
|
-
"Bkecrkj": "f1aehjj5"
|
|
189
|
-
},
|
|
190
|
-
"medium": {
|
|
191
|
-
"Be2twd7": "f1ugzwwg",
|
|
192
|
-
"Bqenvij": "fd461yt",
|
|
193
|
-
"a9b677": "fjw5fx7"
|
|
194
|
-
},
|
|
195
45
|
"large": {
|
|
196
46
|
"Be2twd7": "f4ybsrx",
|
|
197
47
|
"Bqenvij": "fjamq6b",
|
|
@@ -204,13 +54,13 @@ const useIndicatorStyles = /*#__PURE__*/react_1.__styles({
|
|
|
204
54
|
"Btl43ni": ["f1s8kh49", "f1djnp8u"]
|
|
205
55
|
}
|
|
206
56
|
}, {
|
|
207
|
-
"d": [".
|
|
208
|
-
});
|
|
57
|
+
"d": [".f4ybsrx{font-size:16px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}", ".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);}"]
|
|
58
|
+
}); // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
|
59
|
+
|
|
209
60
|
|
|
210
61
|
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
|
211
62
|
"base": {
|
|
212
63
|
"qb2dma": "f7nlbp4",
|
|
213
|
-
"sj55zd": "f1ym3bx4",
|
|
214
64
|
"Bceei9c": "f1k6fduh",
|
|
215
65
|
"z8tnut": "f1kwiid1",
|
|
216
66
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
@@ -232,7 +82,7 @@ const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
|
|
232
82
|
"jrapky": "f49ad5g"
|
|
233
83
|
}
|
|
234
84
|
}, {
|
|
235
|
-
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".
|
|
85
|
+
"d": [".f7nlbp4{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".f1k6fduh{cursor:pointer;}", ".f1kwiid1{padding-top:var(--spacingVerticalS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f5b47ha{padding-bottom:var(--spacingVerticalS);}", ".f7x41pl{padding-right:var(--spacingHorizontalXS);}", ".fruq291{padding-left:var(--spacingHorizontalXS);}", ".fjzwpt6{margin-top:calc((16px - var(--lineHeightBase300)) / 2);}", ".fh6j2fo{margin-bottom:calc((16px - var(--lineHeightBase300)) / 2);}", ".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}", ".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}"]
|
|
236
86
|
});
|
|
237
87
|
/**
|
|
238
88
|
* Apply styling to the Checkbox slots based on the state
|
|
@@ -240,19 +90,21 @@ const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
|
|
240
90
|
|
|
241
91
|
|
|
242
92
|
const useCheckboxStyles_unstable = state => {
|
|
243
|
-
const rootStyles = useRootStyles();
|
|
244
|
-
state.root.className = react_1.mergeClasses(exports.checkboxClassNames.root, rootStyles.base, state.root.className);
|
|
245
93
|
const {
|
|
246
94
|
labelPosition,
|
|
247
95
|
shape,
|
|
248
96
|
size
|
|
249
97
|
} = state;
|
|
98
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
99
|
+
state.root.className = react_1.mergeClasses(exports.checkboxClassNames.root, rootBaseClassName, state.root.className);
|
|
100
|
+
const inputBaseClassName = useInputBaseClassName();
|
|
250
101
|
const inputStyles = useInputStyles();
|
|
251
|
-
state.input.className = react_1.mergeClasses(exports.checkboxClassNames.input,
|
|
102
|
+
state.input.className = react_1.mergeClasses(exports.checkboxClassNames.input, inputBaseClassName, size === 'large' && inputStyles.large, inputStyles[labelPosition], state.input.className);
|
|
103
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
|
252
104
|
const indicatorStyles = useIndicatorStyles();
|
|
253
105
|
|
|
254
106
|
if (state.indicator) {
|
|
255
|
-
state.indicator.className = react_1.mergeClasses(exports.checkboxClassNames.indicator,
|
|
107
|
+
state.indicator.className = react_1.mergeClasses(exports.checkboxClassNames.indicator, indicatorBaseClassName, size === 'large' && indicatorStyles.large, shape === 'circular' && indicatorStyles.circular, state.indicator.className);
|
|
256
108
|
}
|
|
257
109
|
|
|
258
110
|
const labelStyles = useLabelStyles();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-checkbox/src/components/Checkbox/useCheckboxStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MA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AA,CAAA,YAAA,CAC1B,OAAA,CAAA,kBAAA,CAAmB,SADO,EAE1B,eAAe,CAAC,IAFU,EAG1B,eAAe,CAAC,IAAD,CAHW,EAI1B,KAAK,KAAK,UAAV,IAAwB,eAAe,CAAC,QAJd,EAK1B,KAAK,CAAC,SAAN,CAAgB,SALU,CAA5B;EAOD;;EAED,MAAM,WAAW,GAAG,cAAc,EAAlC;;EACA,IAAI,KAAK,CAAC,KAAV,EAAiB;IACf,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,OAAA,CAAA,YAAA,CACtB,OAAA,CAAA,kBAAA,CAAmB,KADG,EAEtB,WAAW,CAAC,IAFU,EAGtB,WAAW,CAAC,IAAD,CAHW,EAItB,WAAW,CAAC,aAAD,CAJW,EAKtB,KAAK,CAAC,KAAN,CAAY,SALU,CAAxB;EAOD;;EAED,OAAO,KAAP;AACD,CAtCM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootStyles = makeStyles({\n base: {\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n ...shorthands.margin(0),\n opacity: 0,\n position: 'absolute',\n top: 0,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackground),\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundHover),\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorCompoundBrandBackgroundPressed),\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStroke),\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokeHover),\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorCompoundBrandStrokePressed),\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n medium: {\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n },\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n alignSelf: 'flex-start',\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.borderRadiusSmall),\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n fill: 'currentColor',\n pointerEvents: 'none',\n },\n\n medium: {\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n },\n\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n alignSelf: 'center',\n color: 'inherit',\n cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(checkboxClassNames.root, rootStyles.base, state.root.className);\n\n const { labelPosition, shape, size } = state;\n\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputStyles.base,\n inputStyles[size],\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorStyles.base,\n indicatorStyles[size],\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../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,0BAAA,GAA0B,0BAA1B","sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { CheckboxSlots, CheckboxState } from './Checkbox.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const checkboxClassNames: SlotClassNames<CheckboxSlots> = {\n root: 'fui-Checkbox',\n label: 'fui-Checkbox__label',\n input: 'fui-Checkbox__input',\n indicator: 'fui-Checkbox__indicator',\n};\n\n// The indicator size is used by the indicator and label styles\nconst indicatorSizeMedium = '16px';\nconst indicatorSizeLarge = '20px';\n\nconst useRootBaseClassName = makeResetStyles({\n position: 'relative',\n display: 'inline-flex',\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n top: 0,\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the checkbox.\n width: `calc(${indicatorSizeMedium} + 2 * ${tokens.spacingHorizontalS})`,\n\n // When unchecked, hide the the checkmark icon (child of the indicator slot)\n [`:not(:checked):not(:indeterminate) ~ .${checkboxClassNames.indicator} > *`]: {\n opacity: 0,\n },\n\n // Colors for the unchecked state\n ':enabled:not(:checked):not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground3,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground2,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Colors for the checked state\n ':enabled:checked:not(:indeterminate)': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorCompoundBrandBackground,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorCompoundBrandBackgroundHover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorCompoundBrandBackgroundPressed,\n },\n },\n },\n\n // Colors for the mixed state\n ':enabled:indeterminate': {\n [`& ~ .${checkboxClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStroke,\n color: tokens.colorCompoundBrandForeground1,\n },\n\n ':hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokeHover,\n color: tokens.colorCompoundBrandForeground1Hover,\n },\n },\n\n ':active:hover': {\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorCompoundBrandStrokePressed,\n color: tokens.colorCompoundBrandForeground1Pressed,\n },\n },\n },\n\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${checkboxClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n color: tokens.colorNeutralForegroundDisabled,\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n [`& ~ .${checkboxClassNames.indicator} svg`]: {\n '@media (forced-colors: active)': {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n },\n after: {\n left: 0,\n },\n\n large: {\n width: `calc(${indicatorSizeLarge} + 2 * ${tokens.spacingHorizontalS})`,\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n alignSelf: 'flex-start',\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.borderRadiusSmall,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n fill: 'currentColor',\n pointerEvents: 'none',\n\n fontSize: '12px',\n height: indicatorSizeMedium,\n width: indicatorSizeMedium,\n});\n\nconst useIndicatorStyles = makeStyles({\n large: {\n fontSize: '16px',\n height: indicatorSizeLarge,\n width: indicatorSizeLarge,\n },\n\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\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 cursor: 'pointer',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\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 checkbox, but preserves line height if the label wraps.\n medium: {\n marginTop: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeMedium} - ${tokens.lineHeightBase300}) / 2)`,\n },\n large: {\n marginTop: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n marginBottom: `calc((${indicatorSizeLarge} - ${tokens.lineHeightBase300}) / 2)`,\n },\n});\n\n/**\n * Apply styling to the Checkbox slots based on the state\n */\nexport const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState => {\n const { labelPosition, shape, size } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(checkboxClassNames.root, rootBaseClassName, state.root.className);\n\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n state.input.className = mergeClasses(\n checkboxClassNames.input,\n inputBaseClassName,\n size === 'large' && inputStyles.large,\n inputStyles[labelPosition],\n state.input.className,\n );\n\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n if (state.indicator) {\n state.indicator.className = mergeClasses(\n checkboxClassNames.indicator,\n indicatorBaseClassName,\n size === 'large' && indicatorStyles.large,\n shape === 'circular' && indicatorStyles.circular,\n state.indicator.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n checkboxClassNames.label,\n labelStyles.base,\n labelStyles[size],\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-checkbox",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.16",
|
|
4
4
|
"description": "Fluent UI checkbox component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "just-scripts build",
|
|
16
|
+
"bundle-size": "bundle-size measure",
|
|
16
17
|
"clean": "just-scripts clean",
|
|
17
18
|
"code-style": "just-scripts code-style",
|
|
18
19
|
"just": "just-scripts",
|
|
@@ -30,12 +31,12 @@
|
|
|
30
31
|
"@fluentui/scripts": "^1.0.0"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@fluentui/react-field": "9.0.0-alpha.
|
|
34
|
+
"@fluentui/react-field": "9.0.0-alpha.12",
|
|
34
35
|
"@fluentui/react-icons": "^2.0.175",
|
|
35
|
-
"@fluentui/react-label": "^9.0.
|
|
36
|
-
"@fluentui/react-tabster": "^9.3.
|
|
37
|
-
"@fluentui/react-theme": "^9.1.
|
|
38
|
-
"@fluentui/react-utilities": "^9.
|
|
36
|
+
"@fluentui/react-label": "^9.0.14",
|
|
37
|
+
"@fluentui/react-tabster": "^9.3.4",
|
|
38
|
+
"@fluentui/react-theme": "^9.1.5",
|
|
39
|
+
"@fluentui/react-utilities": "^9.3.0",
|
|
39
40
|
"@griffel/react": "^1.4.2",
|
|
40
41
|
"tslib": "^2.1.0"
|
|
41
42
|
},
|