@fluentui/react-switch 9.0.17 → 9.0.19

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 CHANGED
@@ -2,7 +2,63 @@
2
2
  "name": "@fluentui/react-switch",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 09 Jan 2023 14:31:49 GMT",
5
+ "date": "Wed, 18 Jan 2023 16:30:58 GMT",
6
+ "tag": "@fluentui/react-switch_v9.0.19",
7
+ "version": "9.0.19",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-switch",
13
+ "comment": "Bump @fluentui/react-tabster to v9.4.0",
14
+ "commit": "13cf1d07a6df4617106c731ba0379b6102a08104"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 16 Jan 2023 08:38:47 GMT",
21
+ "tag": "@fluentui/react-switch_v9.0.18",
22
+ "version": "9.0.18",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "author": "martinhochel@microsoft.com",
27
+ "package": "@fluentui/react-switch",
28
+ "commit": "64bb45980d68de1219c6b36a7db5363f0a9cff9f",
29
+ "comment": "chore: migrate to packaged scripts"
30
+ }
31
+ ],
32
+ "patch": [
33
+ {
34
+ "author": "behowell@microsoft.com",
35
+ "package": "@fluentui/react-switch",
36
+ "commit": "25e3d5b8f843b51d1bc7e9deb9f5d4da74dec3cd",
37
+ "comment": "chore: Update Switch to use griffel reset styles"
38
+ },
39
+ {
40
+ "author": "beachball",
41
+ "package": "@fluentui/react-switch",
42
+ "comment": "Bump @fluentui/react-field to v9.0.0-alpha.15",
43
+ "commit": "a870d8360e47f3ea03358c4e75e89e08a74845d7"
44
+ },
45
+ {
46
+ "author": "beachball",
47
+ "package": "@fluentui/react-switch",
48
+ "comment": "Bump @fluentui/react-label to v9.0.17",
49
+ "commit": "a870d8360e47f3ea03358c4e75e89e08a74845d7"
50
+ },
51
+ {
52
+ "author": "beachball",
53
+ "package": "@fluentui/react-switch",
54
+ "comment": "Bump @fluentui/react-tabster to v9.3.7",
55
+ "commit": "a870d8360e47f3ea03358c4e75e89e08a74845d7"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "date": "Mon, 09 Jan 2023 14:35:02 GMT",
6
62
  "tag": "@fluentui/react-switch_v9.0.17",
7
63
  "version": "9.0.17",
8
64
  "comments": {
@@ -11,25 +67,25 @@
11
67
  "author": "beachball",
12
68
  "package": "@fluentui/react-switch",
13
69
  "comment": "Bump @fluentui/react-field to v9.0.0-alpha.14",
14
- "commit": "26f0364b3837056ee8e0df42a7932c298c68290e"
70
+ "commit": "d246e70eba59a37ec311dbf933b0745d34cb700d"
15
71
  },
16
72
  {
17
73
  "author": "beachball",
18
74
  "package": "@fluentui/react-switch",
19
75
  "comment": "Bump @fluentui/react-label to v9.0.16",
20
- "commit": "26f0364b3837056ee8e0df42a7932c298c68290e"
76
+ "commit": "d246e70eba59a37ec311dbf933b0745d34cb700d"
21
77
  },
22
78
  {
23
79
  "author": "beachball",
24
80
  "package": "@fluentui/react-switch",
25
81
  "comment": "Bump @fluentui/react-tabster to v9.3.6",
26
- "commit": "26f0364b3837056ee8e0df42a7932c298c68290e"
82
+ "commit": "d246e70eba59a37ec311dbf933b0745d34cb700d"
27
83
  },
28
84
  {
29
85
  "author": "beachball",
30
86
  "package": "@fluentui/react-switch",
31
87
  "comment": "Bump @fluentui/react-utilities to v9.4.0",
32
- "commit": "26f0364b3837056ee8e0df42a7932c298c68290e"
88
+ "commit": "d246e70eba59a37ec311dbf933b0745d34cb700d"
33
89
  }
34
90
  ]
35
91
  }
package/CHANGELOG.md CHANGED
@@ -1,20 +1,41 @@
1
1
  # Change Log - @fluentui/react-switch
2
2
 
3
- This log was last generated on Mon, 09 Jan 2023 14:31:49 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 18 Jan 2023 16:30:58 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.19)
8
+
9
+ Wed, 18 Jan 2023 16:30:58 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.18..@fluentui/react-switch_v9.0.19)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-tabster to v9.4.0 ([PR #26377](https://github.com/microsoft/fluentui/pull/26377) by beachball)
15
+
16
+ ## [9.0.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.18)
17
+
18
+ Mon, 16 Jan 2023 08:38:47 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.17..@fluentui/react-switch_v9.0.18)
20
+
21
+ ### Patches
22
+
23
+ - chore: Update Switch to use griffel reset styles ([PR #26007](https://github.com/microsoft/fluentui/pull/26007) by behowell@microsoft.com)
24
+ - Bump @fluentui/react-field to v9.0.0-alpha.15 ([commit](https://github.com/microsoft/fluentui/commit/a870d8360e47f3ea03358c4e75e89e08a74845d7) by beachball)
25
+ - Bump @fluentui/react-label to v9.0.17 ([commit](https://github.com/microsoft/fluentui/commit/a870d8360e47f3ea03358c4e75e89e08a74845d7) by beachball)
26
+ - Bump @fluentui/react-tabster to v9.3.7 ([commit](https://github.com/microsoft/fluentui/commit/a870d8360e47f3ea03358c4e75e89e08a74845d7) by beachball)
27
+
7
28
  ## [9.0.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.17)
8
29
 
9
- Mon, 09 Jan 2023 14:31:49 GMT
30
+ Mon, 09 Jan 2023 14:35:02 GMT
10
31
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.16..@fluentui/react-switch_v9.0.17)
11
32
 
12
33
  ### Patches
13
34
 
14
- - Bump @fluentui/react-field to v9.0.0-alpha.14 ([PR #26257](https://github.com/microsoft/fluentui/pull/26257) by beachball)
15
- - Bump @fluentui/react-label to v9.0.16 ([PR #26257](https://github.com/microsoft/fluentui/pull/26257) by beachball)
16
- - Bump @fluentui/react-tabster to v9.3.6 ([PR #26257](https://github.com/microsoft/fluentui/pull/26257) by beachball)
17
- - Bump @fluentui/react-utilities to v9.4.0 ([PR #26257](https://github.com/microsoft/fluentui/pull/26257) by beachball)
35
+ - Bump @fluentui/react-field to v9.0.0-alpha.14 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
36
+ - Bump @fluentui/react-label to v9.0.16 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
37
+ - Bump @fluentui/react-tabster to v9.3.6 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
38
+ - Bump @fluentui/react-utilities to v9.4.0 ([PR #26255](https://github.com/microsoft/fluentui/pull/26255) by beachball)
18
39
 
19
40
  ## [9.0.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.16)
20
41
 
@@ -1,6 +1,6 @@
1
1
  import { createFocusOutlineStyle } from '@fluentui/react-tabster';
2
2
  import { tokens } from '@fluentui/react-theme';
3
- import { __styles, mergeClasses, shorthands } from '@griffel/react';
3
+ import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
4
4
  export const switchClassNames = {
5
5
  root: 'fui-Switch',
6
6
  indicator: 'fui-Switch__indicator',
@@ -16,164 +16,24 @@ const spaceBetweenThumbAndTrack = 2;
16
16
  const trackHeight = 20;
17
17
  const trackWidth = 40;
18
18
  const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
19
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("r1u7w45w", "rlzel8d", [".r1u7w45w{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r1u7w45w:focus{outline-style:none;}", ".r1u7w45w:focus-visible{outline-style:none;}", ".r1u7w45w[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1u7w45w[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;}", ".rlzel8d{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".rlzel8d:focus{outline-style:none;}", ".rlzel8d:focus-visible{outline-style:none;}", ".rlzel8d[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".rlzel8d[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;}"]);
19
20
  const useRootStyles = /*#__PURE__*/__styles({
20
- base: {
21
- Bt984gj: "f6jr5hl",
22
- B7ck84d: "f1ewtqcl",
23
- mc9l5x: "ftuwxu6",
24
- qhf8xq: "f10pi13n",
25
- Brovlpu: "ftqa4ok",
26
- B486eqv: "f2hkw1w",
27
- Bssx7fj: "f1b1k54r",
28
- uh7if5: ["f4ne723", "fqqcjud"],
29
- clntm0: "fh7aioi",
30
- Dlk2r6: ["fqqcjud", "f4ne723"],
31
- B2j2mmj: "ffht0p2",
32
- wigs8: "f1p0ul1q",
33
- pbfy6t: "f1c901ms",
34
- B0v4ure: "f1alokd7",
35
- ghq09: "f78i1la",
36
- B24cy0v: ["f1kvsw7t", "f1bw8brt"],
37
- Bwckmig: "f8k7e5g",
38
- Bvwlmkc: ["f1bw8brt", "f1kvsw7t"],
39
- Bbgo44z: "f1pmxfrl",
40
- Bil7v7r: ["fszkfcr", "f1ap5ily"],
41
- skfxo0: "f57dp0y",
42
- jo1ztg: ["f1ap5ily", "fszkfcr"],
43
- Ba3ybja: ["f11dm2qb", "f136rfnd"],
44
- az1dzo: ["f136rfnd", "f11dm2qb"],
45
- vppk2z: ["fdsq1qd", "f1khssms"],
46
- B6352mv: ["f1khssms", "fdsq1qd"],
47
- nr063g: "fq4eyks",
48
- Blmvk6g: ["f1ya6x16", "ftuszwa"],
49
- Bsiemmq: "f1e2iu44",
50
- B98u21t: ["ftuszwa", "f1ya6x16"],
51
- B2pnrqr: "f1xkdug0",
52
- Bhhzhcn: "f1m1ywml",
53
- Bec0n69: ["f7u4kgv", "f1a36mvi"],
54
- B29w5g4: ["f1a36mvi", "f7u4kgv"]
55
- },
56
21
  vertical: {
57
22
  Beiy3e4: "f1vx9l62"
58
23
  }
59
24
  }, {
60
- d: [".f6jr5hl{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;}", ".f1ewtqcl{box-sizing:border-box;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"],
61
- f: [".ftqa4ok:focus{outline-style:none;}"],
62
- i: [".f2hkw1w:focus-visible{outline-style:none;}"]
25
+ d: [".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
63
26
  });
27
+ const useIndicatorBaseClassName = /*#__PURE__*/__resetStyles("r13wlxb8", null, [".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}", "@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}", ".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}", "@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}"]);
64
28
  const useIndicatorStyles = /*#__PURE__*/__styles({
65
- base: {
66
- Bbmb7ep: ["f8fbkgy", "f1nfllo7"],
67
- Beyfa6y: ["f1nfllo7", "f8fbkgy"],
68
- B7oj6ja: ["f1djnp8u", "f1s8kh49"],
69
- Btl43ni: ["f1s8kh49", "f1djnp8u"],
70
- icvyot: "fzkkow9",
71
- vrafjx: ["fcdblym", "fjik90z"],
72
- oivjwe: "fg706s2",
73
- wvpqe5: ["fjik90z", "fcdblym"],
74
- B4j52fo: "f5ogflp",
75
- Bekrc4i: ["f1hqa2wf", "finvdd3"],
76
- Bn0qgzm: "f1f09k3d",
77
- ibv6hh: ["finvdd3", "f1hqa2wf"],
78
- Bg96gwp: "fez10in",
79
- B7ck84d: "f1ewtqcl",
80
- Bkfmm31: "f1w9h62z",
81
- Bnnss6s: "fi64zpg",
82
- Be2twd7: "fg38ndl",
83
- Bqenvij: "fjamq6b",
84
- B6of3ja: "frnwi6n",
85
- t21cq0: ["f1vcna3q", "foyynoy"],
86
- jrapky: "fqcjy3b",
87
- Frg6f3: ["foyynoy", "f1vcna3q"],
88
- Bkecrkj: "f1aehjj5",
89
- B3o57yi: "f1vze9yt",
90
- Bkqvd7p: "f17wnm97",
91
- Bmy1vo4: "fo99fu7",
92
- a9b677: "feqmc2u",
93
- Hwfdqs: "f1onx1g3",
94
- Hkqiji: "f1h74hm9",
95
- Bgrs90m: "f1592id",
96
- B0zx559: "f1uwej41",
97
- c0im90: "fpz7fqq"
98
- },
99
29
  labelAbove: {
100
30
  B6of3ja: "f1hu3pq6"
101
31
  }
102
32
  }, {
103
- d: [".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);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fez10in{line-height:0;}", ".f1ewtqcl{box-sizing:border-box;}", ".f1w9h62z{fill:currentColor;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".fg38ndl{font-size:18px;}", ".fjamq6b{height:20px;}", ".frnwi6n{margin-top:var(--spacingVerticalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".foyynoy{margin-left:var(--spacingHorizontalS);}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f1aehjj5{pointer-events:none;}", ".f1vze9yt{transition-duration:var(--durationNormal);}", ".f17wnm97{transition-timing-function:var(--curveEasyEase);}", ".fo99fu7{transition-property:background,border,color;}", ".feqmc2u{width:40px;}", ".f1h74hm9>*{transition-duration:var(--durationNormal);}", ".f1592id>*{transition-timing-function:var(--curveEasyEase);}", ".f1uwej41>*{transition-property:transform;}", ".f1hu3pq6{margin-top:0;}"],
104
- m: [["@media screen and (prefers-reduced-motion: reduce){.f1onx1g3{transition-duration:0.01ms;}}", {
105
- m: "screen and (prefers-reduced-motion: reduce)"
106
- }], ["@media screen and (prefers-reduced-motion: reduce){.fpz7fqq>*{transition-duration:0.01ms;}}", {
107
- m: "screen and (prefers-reduced-motion: reduce)"
108
- }]]
33
+ d: [".f1hu3pq6{margin-top:0;}"]
109
34
  });
35
+ const useInputBaseClassName = /*#__PURE__*/__resetStyles("r92li9d", "rxjpw57", [".r92li9d{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}", ".r92li9d:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}", ".r92li9d:disabled{cursor:default;}", ".r92li9d:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".r92li9d:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", ".r92li9d:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}", ".r92li9d:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".r92li9d:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r92li9d:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r92li9d:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}", ".r92li9d:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}", ".r92li9d:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}", ".r92li9d:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}", ".r92li9d:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}", "@media (forced-colors: active){.r92li9d:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r92li9d:disabled~.fui-Switch__label{color:GrayText;}}", ".rxjpw57{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}", ".rxjpw57:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}", ".rxjpw57:disabled{cursor:default;}", ".rxjpw57:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".rxjpw57:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", ".rxjpw57:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}", ".rxjpw57:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".rxjpw57:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".rxjpw57:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".rxjpw57:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}", ".rxjpw57:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}", ".rxjpw57:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}", ".rxjpw57:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}", ".rxjpw57:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}", "@media (forced-colors: active){.rxjpw57:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rxjpw57:disabled~.fui-Switch__label{color:GrayText;}}"]);
110
36
  const useInputStyles = /*#__PURE__*/__styles({
111
- base: {
112
- B7ck84d: "f1ewtqcl",
113
- Bceei9c: "f1k6fduh",
114
- Bqenvij: "f1l02sjl",
115
- B6of3ja: "f1hu3pq6",
116
- t21cq0: ["f11qmguv", "f1tyq0we"],
117
- jrapky: "f19f4twv",
118
- Frg6f3: ["f1tyq0we", "f11qmguv"],
119
- abs64n: "fk73vx1",
120
- qhf8xq: "f1euv43f",
121
- a9b677: "f1ry1bn9",
122
- fv8x6k: ["f3l1kk6", "f1kez0x4"],
123
- ezr58z: "fvxnmui",
124
- Blezdol: "f1cxq9o1",
125
- k28iui: "f1q9yyk5",
126
- B8f96ig: "f1ks1zsm",
127
- po7uxr: "fiqfi0i",
128
- inq7wv: "f9aagkg",
129
- Cdugon: ["fgv8l18", "f1p3jmxb"],
130
- ptsei1: "f11yi64e",
131
- bl04ud: ["f1p3jmxb", "fgv8l18"],
132
- Bu7dm46: "fthrly9",
133
- Gwwlnz: "fhdp2ht",
134
- wb1her: "f1rzj6jj",
135
- Bmieemq: ["f1jywl1l", "f13d626x"],
136
- Bdgjgzg: "f1ivtmze",
137
- B05cvx7: ["f13d626x", "f1jywl1l"],
138
- Bx4eqiv: "f1uvnr57",
139
- xhnoxe: "frhcydi",
140
- Hnmc4c: ["f1pvt3n7", "f14i0clv"],
141
- By8gkvz: "fq9gcw4",
142
- lekrm4: ["f14i0clv", "f1pvt3n7"],
143
- Bei91sp: "f1se0d6r",
144
- Bksztz9: "f8l9son",
145
- h3gz1v: "f1c4gun2",
146
- Cw6427: ["flhgtcm", "fx1zdd8"],
147
- Bpbd9g9: "fayrp2e",
148
- ssulyh: ["fx1zdd8", "flhgtcm"],
149
- vq7rp1: "f1p715pa",
150
- ynrfiu: "firogjh",
151
- Bf5tpyt: ["f1crd6p1", "for8100"],
152
- Brhic7g: "f1v5j4zb",
153
- Cqvc5u: ["for8100", "f1crd6p1"],
154
- B4e80u0: "f116zuoq",
155
- Bwj41i9: "fxvotg6",
156
- B2iiaa1: ["fk9ur30", "f3u5smv"],
157
- Bejmxmv: "fdtj07x",
158
- rqauf5: ["f3u5smv", "fk9ur30"],
159
- wo5z87: "fv5mb1o",
160
- B50joxe: ["f1i2l8ou", "fxj1kmv"],
161
- Bmuizf1: "fku528b",
162
- f4urji: ["fxj1kmv", "f1i2l8ou"],
163
- Bxiq1ly: "fabcpc0",
164
- vbmdq8: "f17xwy6w",
165
- u4vbwo: ["fipwscc", "fab39iv"],
166
- Bfjga03: "f1th5z1l",
167
- F0s3py: ["fab39iv", "fipwscc"]
168
- },
169
- highContrast: {
170
- Bskmvfo: "f19h63kc",
171
- zhypoe: "ffutfdj",
172
- Bb6xxwe: ["f72m8yo", "f1ud47z9"],
173
- o89t22: "f15xfkur",
174
- B7qxyha: ["f1ud47z9", "f72m8yo"],
175
- Bhmcd6p: "f1jaqqzs"
176
- },
177
37
  before: {
178
38
  j35jbq: ["f1e31b4d", "f1vgc2s3"],
179
39
  Bhzewxz: "f15twtuk"
@@ -188,21 +48,9 @@ const useInputStyles = /*#__PURE__*/__styles({
188
48
  a9b677: "fly5x3f"
189
49
  }
190
50
  }, {
191
- d: [".f1ewtqcl{box-sizing:border-box;}", ".f1k6fduh{cursor:pointer;}", ".f1l02sjl{height:100%;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".fk73vx1{opacity:0;}", ".f1euv43f{position:absolute;}", ".f1ry1bn9{width:calc(40px + 2 * var(--spacingHorizontalS));}", ".f3l1kk6:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}", ".f1kez0x4:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}", ".fvxnmui:disabled{cursor:default;}", ".f1cxq9o1:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".f1q9yyk5:disabled~.fui-Switch__label{cursor:default;}", ".f1ks1zsm:disabled~.fui-Switch__label{color:var(--colorNeutralForegroundDisabled);}", ".fiqfi0i:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);}", ".f9aagkg:enabled:not(:checked)~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessible);}", ".fgv8l18:enabled:not(:checked)~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessible);}", ".f1p3jmxb:enabled:not(:checked)~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f11yi64e:enabled:not(:checked)~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".fthrly9:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".fhdp2ht:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);}", ".f1rzj6jj:enabled:not(:checked):hover~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1jywl1l:enabled:not(:checked):hover~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessibleHover);}", ".f13d626x:enabled:not(:checked):hover~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1ivtmze:enabled:not(:checked):hover~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1uvnr57:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);}", ".frhcydi:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1pvt3n7:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f14i0clv:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessiblePressed);}", ".fq9gcw4:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1se0d6r:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);}", ".f8l9son:enabled:checked~.fui-Switch__indicator{color:var(--colorNeutralForegroundInverted);}", ".f1c4gun2:enabled:checked~.fui-Switch__indicator{border-top-color:var(--colorTransparentStroke);}", ".flhgtcm:enabled:checked~.fui-Switch__indicator{border-right-color:var(--colorTransparentStroke);}", ".fx1zdd8:enabled:checked~.fui-Switch__indicator{border-left-color:var(--colorTransparentStroke);}", ".fayrp2e:enabled:checked~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStroke);}", ".f1p715pa:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);}", ".firogjh:enabled:checked:hover~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f1crd6p1:enabled:checked:hover~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeInteractive);}", ".for8100:enabled:checked:hover~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeInteractive);}", ".f1v5j4zb:enabled:checked:hover~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".f116zuoq:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);}", ".fxvotg6:enabled:checked:hover:active~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeInteractive);}", ".fk9ur30:enabled:checked:hover:active~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f3u5smv:enabled:checked:hover:active~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fdtj07x:enabled:checked:hover:active~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".fv5mb1o:disabled:not(:checked)~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1i2l8ou:disabled:not(:checked)~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fxj1kmv:disabled:not(:checked)~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fku528b:disabled:not(:checked)~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fabcpc0:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);}", ".f17xwy6w:disabled:checked~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeDisabled);}", ".fipwscc:disabled:checked~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeDisabled);}", ".fab39iv:disabled:checked~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeDisabled);}", ".f1th5z1l:disabled:checked~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeDisabled);}", ".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}", ".fly5x3f{width:100%;}"],
192
- m: [["@media (forced-colors: active){.f19h63kc:disabled~.fui-Switch__indicator{color:GrayText;}}", {
193
- m: "(forced-colors: active)"
194
- }], ["@media (forced-colors: active){.ffutfdj:disabled~.fui-Switch__indicator{border-top-color:GrayText;}}", {
195
- m: "(forced-colors: active)"
196
- }], ["@media (forced-colors: active){.f72m8yo:disabled~.fui-Switch__indicator{border-right-color:GrayText;}.f1ud47z9:disabled~.fui-Switch__indicator{border-left-color:GrayText;}}", {
197
- m: "(forced-colors: active)"
198
- }], ["@media (forced-colors: active){.f15xfkur:disabled~.fui-Switch__indicator{border-bottom-color:GrayText;}}", {
199
- m: "(forced-colors: active)"
200
- }], ["@media (forced-colors: active){.f1ud47z9:disabled~.fui-Switch__indicator{border-left-color:GrayText;}.f72m8yo:disabled~.fui-Switch__indicator{border-right-color:GrayText;}}", {
201
- m: "(forced-colors: active)"
202
- }], ["@media (forced-colors: active){.f1jaqqzs:disabled~.fui-Switch__label{color:GrayText;}}", {
203
- m: "(forced-colors: active)"
204
- }]]
51
+ d: [".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}", ".fly5x3f{width:100%;}"]
205
52
  });
53
+ // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
206
54
  const useLabelStyles = /*#__PURE__*/__styles({
207
55
  base: {
208
56
  Bceei9c: "f1k6fduh",
@@ -231,17 +79,20 @@ const useLabelStyles = /*#__PURE__*/__styles({
231
79
  * Apply styling to the Switch slots based on the state
232
80
  */
233
81
  export const useSwitchStyles_unstable = state => {
82
+ const rootBaseClassName = useRootBaseClassName();
234
83
  const rootStyles = useRootStyles();
84
+ const indicatorBaseClassName = useIndicatorBaseClassName();
235
85
  const indicatorStyles = useIndicatorStyles();
86
+ const inputBaseClassName = useInputBaseClassName();
236
87
  const inputStyles = useInputStyles();
237
88
  const labelStyles = useLabelStyles();
238
89
  const {
239
90
  label,
240
91
  labelPosition
241
92
  } = state;
242
- state.root.className = mergeClasses(switchClassNames.root, rootStyles.base, labelPosition === 'above' && rootStyles.vertical, state.root.className);
243
- state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorStyles.base, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
244
- state.input.className = mergeClasses(switchClassNames.input, inputStyles.base, inputStyles.highContrast, label && inputStyles[labelPosition], state.input.className);
93
+ state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
94
+ state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
95
+ state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
245
96
  if (state.label) {
246
97
  state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
247
98
  }
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,mBAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAIrE,OAAO,MAAMC,gBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGA,OAAO,MAAMC,eAAe,GAAGL,gBAAgB,CAACC,IAAI;AAEpD;AACA,MAAMK,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WAAW,GAAGD,yBAAyB;AAEzD,MAAMI,aAAa,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;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chClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootStyles","useIndicatorStyles","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootStyles","indicatorStyles","inputStyles","labelStyles","labelPosition","className","base","vertical","labelAbove","highContrast"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootStyles = makeStyles({\n base: {\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('1px'),\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n },\n\n labelAbove: {\n marginTop: 0,\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorTransparentStrokeDisabled),\n },\n },\n },\n\n highContrast: {\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n ...shorthands.borderColor('GrayText'),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootStyles = useRootStyles();\n const indicatorStyles = useIndicatorStyles();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootStyles.base,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorStyles.base,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputStyles.base,\n inputStyles.highContrast,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
1
+ {"version":3,"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,kCAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAItF,OAAO,MAAMC,gBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGA,OAAO,MAAMC,eAAe,GAAGL,gBAAgB,CAACC,IAAI;AAEpD;AACA,MAAMK,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GA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CAACyB,SAAS,GAAG7B,YAAY,CACtCE,gBAAgB,CAACE,SAAS,EAC1BmB,sBAAsB,EACtBjB,KAAK,IAAIsB,aAAa,KAAK,OAAO,IAAIJ,eAAe,CAACO,UAAU,EAChEX,KAAK,CAAChB,SAAS,CAACyB,SAAS,CAC1B;EAEDT,KAAK,CAACf,KAAK,CAACwB,SAAS,GAAG7B,YAAY,CAClCE,gBAAgB,CAACG,KAAK,EACtBoB,kBAAkB,EAClBnB,KAAK,IAAIoB,WAAW,CAACE,aAAa,CAAC,EACnCR,KAAK,CAACf,KAAK,CAACwB,SAAS,CACtB;EAED,IAAIT,KAAK,CAACd,KAAK,EAAE;IACfc,KAAK,CAACd,KAAK,CAACuB,SAAS,GAAG7B,YAAY,CAClCE,gBAAgB,CAACI,KAAK,EACtBqB,WAAW,CAACK,IAAI,EAChBL,WAAW,CAACC,aAAa,CAAC,EAC1BR,KAAK,CAACd,KAAK,CAACuB,SAAS,CACtB;;EAGH,OAAOT,KAAK;AACd,CAAC","names":["createFocusOutlineStyle","tokens","mergeClasses","shorthands","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","useRootStyles","useIndicatorBaseClassName","useIndicatorStyles","useInputBaseClassName","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","vertical","labelAbove","base"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\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 cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
@@ -18,93 +18,142 @@ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/rea
18
18
  var trackHeight = 20;
19
19
  var trackWidth = 40;
20
20
  var thumbSize = trackHeight - spaceBetweenThumbAndTrack;
21
+ var useRootBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ alignItems: 'flex-start', boxSizing: 'border-box', display: 'inline-flex', position: 'relative' }, react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' })));
21
22
  var useRootStyles = react_1.makeStyles({
22
- base: tslib_1.__assign({ alignItems: 'flex-start', boxSizing: 'border-box', display: 'inline-flex', position: 'relative' }, react_tabster_1.createFocusOutlineStyle({ style: {}, selector: 'focus-within' })),
23
23
  vertical: {
24
24
  flexDirection: 'column',
25
25
  },
26
26
  });
27
- var useIndicatorStyles = react_1.makeStyles({
28
- base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular)), react_1.shorthands.borderStyle('solid')), react_1.shorthands.borderWidth('1px')), { lineHeight: 0, boxSizing: 'border-box', fill: 'currentColor', flexShrink: 0, fontSize: thumbSize + "px", height: trackHeight + "px" }), react_1.shorthands.margin(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalS)), { pointerEvents: 'none', transitionDuration: react_theme_1.tokens.durationNormal, transitionTimingFunction: react_theme_1.tokens.curveEasyEase, transitionProperty: 'background, border, color', width: trackWidth + "px", '@media screen and (prefers-reduced-motion: reduce)': {
27
+ var useIndicatorBaseClassName = react_1.makeResetStyles({
28
+ borderRadius: react_theme_1.tokens.borderRadiusCircular,
29
+ border: '1px solid',
30
+ lineHeight: 0,
31
+ boxSizing: 'border-box',
32
+ fill: 'currentColor',
33
+ flexShrink: 0,
34
+ fontSize: thumbSize + "px",
35
+ height: trackHeight + "px",
36
+ margin: react_theme_1.tokens.spacingVerticalS + ' ' + react_theme_1.tokens.spacingHorizontalS,
37
+ pointerEvents: 'none',
38
+ transitionDuration: react_theme_1.tokens.durationNormal,
39
+ transitionTimingFunction: react_theme_1.tokens.curveEasyEase,
40
+ transitionProperty: 'background, border, color',
41
+ width: trackWidth + "px",
42
+ '@media screen and (prefers-reduced-motion: reduce)': {
43
+ transitionDuration: '0.01ms',
44
+ },
45
+ '> *': {
46
+ transitionDuration: react_theme_1.tokens.durationNormal,
47
+ transitionTimingFunction: react_theme_1.tokens.curveEasyEase,
48
+ transitionProperty: 'transform',
49
+ '@media screen and (prefers-reduced-motion: reduce)': {
29
50
  transitionDuration: '0.01ms',
30
- }, '> *': {
31
- transitionDuration: react_theme_1.tokens.durationNormal,
32
- transitionTimingFunction: react_theme_1.tokens.curveEasyEase,
33
- transitionProperty: 'transform',
34
- '@media screen and (prefers-reduced-motion: reduce)': {
35
- transitionDuration: '0.01ms',
36
- },
37
- } }),
51
+ },
52
+ },
53
+ });
54
+ var useIndicatorStyles = react_1.makeStyles({
38
55
  labelAbove: {
39
56
  marginTop: 0,
40
57
  },
41
58
  });
42
- var useInputStyles = react_1.makeStyles({
43
- base: tslib_1.__assign(tslib_1.__assign({ boxSizing: 'border-box', cursor: 'pointer', height: '100%' }, react_1.shorthands.margin(0)), { opacity: 0, position: 'absolute',
44
- // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
45
- // This is done so that clicking on that "empty space" still toggles the switch.
46
- width: "calc(" + trackWidth + "px + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
47
- // Checked (both enabled and disabled)
48
- ':checked': (_a = {},
49
- _a["& ~ ." + exports.switchClassNames.indicator] = {
50
- '> *': {
51
- transform: "translateX(" + (trackWidth - thumbSize - spaceBetweenThumbAndTrack) + "px)",
52
- },
59
+ var useInputBaseClassName = react_1.makeResetStyles({
60
+ boxSizing: 'border-box',
61
+ cursor: 'pointer',
62
+ height: '100%',
63
+ margin: 0,
64
+ opacity: 0,
65
+ position: 'absolute',
66
+ // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
67
+ // This is done so that clicking on that "empty space" still toggles the switch.
68
+ width: "calc(" + trackWidth + "px + 2 * " + react_theme_1.tokens.spacingHorizontalS + ")",
69
+ // Checked (both enabled and disabled)
70
+ ':checked': (_a = {},
71
+ _a["& ~ ." + exports.switchClassNames.indicator] = {
72
+ '> *': {
73
+ transform: "translateX(" + (trackWidth - thumbSize - spaceBetweenThumbAndTrack) + "px)",
53
74
  },
54
- _a),
55
- // Disabled (both checked and unchecked)
56
- ':disabled': (_b = {
57
- cursor: 'default'
75
+ },
76
+ _a),
77
+ // Disabled (both checked and unchecked)
78
+ ':disabled': (_b = {
79
+ cursor: 'default'
80
+ },
81
+ _b["& ~ ." + exports.switchClassNames.indicator] = {
82
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
83
+ },
84
+ _b["& ~ ." + exports.switchClassNames.label] = {
85
+ cursor: 'default',
86
+ color: react_theme_1.tokens.colorNeutralForegroundDisabled,
87
+ },
88
+ _b),
89
+ // Enabled and unchecked
90
+ ':enabled:not(:checked)': (_c = {},
91
+ _c["& ~ ." + exports.switchClassNames.indicator] = {
92
+ color: react_theme_1.tokens.colorNeutralStrokeAccessible,
93
+ borderColor: react_theme_1.tokens.colorNeutralStrokeAccessible,
94
+ },
95
+ _c["& ~ ." + exports.switchClassNames.label] = {
96
+ color: react_theme_1.tokens.colorNeutralForeground1,
97
+ },
98
+ _c[':hover'] = (_d = {},
99
+ _d["& ~ ." + exports.switchClassNames.indicator] = {
100
+ color: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
101
+ borderColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover,
58
102
  },
59
- _b["& ~ ." + exports.switchClassNames.indicator] = {
60
- color: react_theme_1.tokens.colorNeutralForegroundDisabled,
103
+ _d),
104
+ _c[':hover:active'] = (_e = {},
105
+ _e["& ~ ." + exports.switchClassNames.indicator] = {
106
+ color: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed,
107
+ borderColor: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed,
61
108
  },
62
- _b["& ~ ." + exports.switchClassNames.label] = {
63
- cursor: 'default',
64
- color: react_theme_1.tokens.colorNeutralForegroundDisabled,
109
+ _e),
110
+ _c),
111
+ // Enabled and checked
112
+ ':enabled:checked': (_f = {},
113
+ _f["& ~ ." + exports.switchClassNames.indicator] = {
114
+ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackground,
115
+ color: react_theme_1.tokens.colorNeutralForegroundInverted,
116
+ borderColor: react_theme_1.tokens.colorTransparentStroke,
117
+ },
118
+ _f[':hover'] = (_g = {},
119
+ _g["& ~ ." + exports.switchClassNames.indicator] = {
120
+ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundHover,
121
+ borderColor: react_theme_1.tokens.colorTransparentStrokeInteractive,
65
122
  },
66
- _b),
67
- // Enabled and unchecked
68
- ':enabled:not(:checked)': (_c = {},
69
- _c["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ color: react_theme_1.tokens.colorNeutralStrokeAccessible }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeAccessible)),
70
- _c["& ~ ." + exports.switchClassNames.label] = {
71
- color: react_theme_1.tokens.colorNeutralForeground1,
123
+ _g),
124
+ _f[':hover:active'] = (_h = {},
125
+ _h["& ~ ." + exports.switchClassNames.indicator] = {
126
+ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundPressed,
127
+ borderColor: react_theme_1.tokens.colorTransparentStrokeInteractive,
72
128
  },
73
- _c[':hover'] = (_d = {},
74
- _d["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ color: react_theme_1.tokens.colorNeutralStrokeAccessibleHover }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeAccessibleHover)),
75
- _d),
76
- _c[':hover:active'] = (_e = {},
77
- _e["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ color: react_theme_1.tokens.colorNeutralStrokeAccessiblePressed }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeAccessiblePressed)),
78
- _e),
79
- _c),
80
- // Enabled and checked
81
- ':enabled:checked': (_f = {},
82
- _f["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackground, color: react_theme_1.tokens.colorNeutralForegroundInverted }, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
83
- _f[':hover'] = (_g = {},
84
- _g["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundHover }, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeInteractive)),
85
- _g),
86
- _f[':hover:active'] = (_h = {},
87
- _h["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorCompoundBrandBackgroundPressed }, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeInteractive)),
88
- _h),
89
- _f),
90
- // Disabled and unchecked
91
- ':disabled:not(:checked)': (_j = {},
92
- _j["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)),
93
- _j),
94
- // Disabled and checked
95
- ':disabled:checked': (_k = {},
96
- _k["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStrokeDisabled)),
97
- _k) }),
98
- highContrast: {
99
- '@media (forced-colors: active)': {
100
- ':disabled': (_l = {},
101
- _l["& ~ ." + exports.switchClassNames.indicator] = tslib_1.__assign({ color: 'GrayText' }, react_1.shorthands.borderColor('GrayText')),
102
- _l["& ~ ." + exports.switchClassNames.label] = {
103
- color: 'GrayText',
104
- },
105
- _l),
129
+ _h),
130
+ _f),
131
+ // Disabled and unchecked
132
+ ':disabled:not(:checked)': (_j = {},
133
+ _j["& ~ ." + exports.switchClassNames.indicator] = {
134
+ borderColor: react_theme_1.tokens.colorNeutralStrokeDisabled,
106
135
  },
136
+ _j),
137
+ // Disabled and checked
138
+ ':disabled:checked': (_k = {},
139
+ _k["& ~ ." + exports.switchClassNames.indicator] = {
140
+ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled,
141
+ borderColor: react_theme_1.tokens.colorTransparentStrokeDisabled,
142
+ },
143
+ _k),
144
+ '@media (forced-colors: active)': {
145
+ ':disabled': (_l = {},
146
+ _l["& ~ ." + exports.switchClassNames.indicator] = {
147
+ color: 'GrayText',
148
+ borderColor: 'GrayText',
149
+ },
150
+ _l["& ~ ." + exports.switchClassNames.label] = {
151
+ color: 'GrayText',
152
+ },
153
+ _l),
107
154
  },
155
+ });
156
+ var useInputStyles = react_1.makeStyles({
108
157
  before: {
109
158
  right: 0,
110
159
  top: 0,
@@ -119,6 +168,7 @@ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/rea
119
168
  width: '100%',
120
169
  },
121
170
  });
171
+ // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
122
172
  var useLabelStyles = react_1.makeStyles({
123
173
  base: tslib_1.__assign({ cursor: 'pointer',
124
174
  // Use a (negative) margin to account for the difference between the track's height and the label's line height.
@@ -140,14 +190,17 @@ define(["require", "exports", "tslib", "@fluentui/react-tabster", "@fluentui/rea
140
190
  * Apply styling to the Switch slots based on the state
141
191
  */
142
192
  var useSwitchStyles_unstable = function (state) {
193
+ var rootBaseClassName = useRootBaseClassName();
143
194
  var rootStyles = useRootStyles();
195
+ var indicatorBaseClassName = useIndicatorBaseClassName();
144
196
  var indicatorStyles = useIndicatorStyles();
197
+ var inputBaseClassName = useInputBaseClassName();
145
198
  var inputStyles = useInputStyles();
146
199
  var labelStyles = useLabelStyles();
147
200
  var label = state.label, labelPosition = state.labelPosition;
148
- state.root.className = react_1.mergeClasses(exports.switchClassNames.root, rootStyles.base, labelPosition === 'above' && rootStyles.vertical, state.root.className);
149
- state.indicator.className = react_1.mergeClasses(exports.switchClassNames.indicator, indicatorStyles.base, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
150
- state.input.className = react_1.mergeClasses(exports.switchClassNames.input, inputStyles.base, inputStyles.highContrast, label && inputStyles[labelPosition], state.input.className);
201
+ state.root.className = react_1.mergeClasses(exports.switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
202
+ state.indicator.className = react_1.mergeClasses(exports.switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
203
+ state.input.className = react_1.mergeClasses(exports.switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
151
204
  if (state.label) {
152
205
  state.label.className = react_1.mergeClasses(exports.switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
153
206
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useSwitchStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,gBAAgB,GAAgC;QAC3D,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,uBAAuB;QAClC,KAAK,EAAE,mBAAmB;QAC1B,KAAK,EAAE,mBAAmB;KAC3B,CAAC;IAEF;;OAEG;IACU,QAAA,eAAe,GAAG,wBAAgB,CAAC,IAAI,CAAC;IAErD,+CAA+C;IAC/C,IA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AM,WAAW,GAAG,cAAc,EAAE,CAAC;QAE7B,IAAA,KAAK,GAAoB,KAAK,MAAzB,EAAE,aAAa,GAAK,KAAK,cAAV,CAAW;QAEvC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,wBAAgB,CAAC,IAAI,EACrB,UAAU,CAAC,IAAI,EACf,aAAa,KAAK,OAAO,IAAI,UAAU,CAAC,QAAQ,EAChD,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,oBAAY,CACtC,wBAAgB,CAAC,SAAS,EAC1B,eAAe,CAAC,IAAI,EACpB,KAAK,IAAI,aAAa,KAAK,OAAO,IAAI,eAAe,CAAC,UAAU,EAChE,KAAK,CAAC,SAAS,CAAC,SAAS,CAC1B,CAAC;QAEF,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,wBAAgB,CAAC,KAAK,EACtB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,YAAY,EACxB,KAAK,IAAI,WAAW,CAAC,aAAa,CAAC,EACnC,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,wBAAgB,CAAC,KAAK,EACtB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAxCW,QAAA,wBAAwB,4BAwCnC","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootStyles = makeStyles({\n base: {\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('1px'),\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n },\n\n labelAbove: {\n marginTop: 0,\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorTransparentStrokeDisabled),\n },\n },\n },\n\n highContrast: {\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n ...shorthands.borderColor('GrayText'),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootStyles = useRootStyles();\n const indicatorStyles = useIndicatorStyles();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootStyles.base,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorStyles.base,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputStyles.base,\n inputStyles.highContrast,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
1
+ {"version":3,"file":"useSwitchStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,gBAAgB,GAAgC;QAC3D,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,uBAAuB;QAClC,KAAK,EAAE,mBAAmB;QAC1B,KAAK,EAAE,mBAAmB;KAC3B,CAAC;IAEF;;OAEG;IACU,QAAA,eAAe,GAAG,wBAAgB,CAAC,IAAI,CAAC;IAErD,+CAA+C;IAC/C,IAAM,yBAAyB,GAAG,CAAC,CAAC;IACpC,IAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAM,UAAU,GAAG,EAAE,CAAC;IACtB,IAAM,SAAS,GAAG,WAAW,GAAG,yBAAyB,CAAC;IAE1D,IAAM,oBAAoB,GAAG,uBAAe,oBAC1C,UAAU,EAAE,YAAY,EACxB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,UAAU,IAEjB,uCAAuB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,EACnE,CAAC;IAEH,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,QAAQ,EAAE;YACR,aAAa,EAAE,QAAQ;SACxB;KACF,CAAC,CAAC;IAEH,IAAM,yBAAyB,GAAG,uBAAe,CAAC;QAChD,YAAY,EAAE,oBAAM,CAAC,oBAAoB;QACzC,MAAM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C,wBAAgB,CAAC,KAAK,EACtB,kBAAkB,EAClB,KAAK,IAAI,WAAW,CAAC,aAAa,CAAC,EACnC,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;QAEF,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,oBAAY,CAClC,wBAAgB,CAAC,KAAK,EACtB,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,SAAS,CACtB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA1CW,QAAA,wBAAwB,4BA0CnC","sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\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 cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
@@ -22,164 +22,24 @@ const spaceBetweenThumbAndTrack = 2;
22
22
  const trackHeight = 20;
23
23
  const trackWidth = 40;
24
24
  const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
25
+ const useRootBaseClassName = /*#__PURE__*/react_1.__resetStyles("r1u7w45w", "rlzel8d", [".r1u7w45w{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".r1u7w45w:focus{outline-style:none;}", ".r1u7w45w:focus-visible{outline-style:none;}", ".r1u7w45w[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}", ".r1u7w45w[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;}", ".rlzel8d{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;box-sizing:border-box;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;position:relative;}", ".rlzel8d:focus{outline-style:none;}", ".rlzel8d:focus-visible{outline-style:none;}", ".rlzel8d[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}", ".rlzel8d[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 useRootStyles = /*#__PURE__*/react_1.__styles({
26
- base: {
27
- Bt984gj: "f6jr5hl",
28
- B7ck84d: "f1ewtqcl",
29
- mc9l5x: "ftuwxu6",
30
- qhf8xq: "f10pi13n",
31
- Brovlpu: "ftqa4ok",
32
- B486eqv: "f2hkw1w",
33
- Bssx7fj: "f1b1k54r",
34
- uh7if5: ["f4ne723", "fqqcjud"],
35
- clntm0: "fh7aioi",
36
- Dlk2r6: ["fqqcjud", "f4ne723"],
37
- B2j2mmj: "ffht0p2",
38
- wigs8: "f1p0ul1q",
39
- pbfy6t: "f1c901ms",
40
- B0v4ure: "f1alokd7",
41
- ghq09: "f78i1la",
42
- B24cy0v: ["f1kvsw7t", "f1bw8brt"],
43
- Bwckmig: "f8k7e5g",
44
- Bvwlmkc: ["f1bw8brt", "f1kvsw7t"],
45
- Bbgo44z: "f1pmxfrl",
46
- Bil7v7r: ["fszkfcr", "f1ap5ily"],
47
- skfxo0: "f57dp0y",
48
- jo1ztg: ["f1ap5ily", "fszkfcr"],
49
- Ba3ybja: ["f11dm2qb", "f136rfnd"],
50
- az1dzo: ["f136rfnd", "f11dm2qb"],
51
- vppk2z: ["fdsq1qd", "f1khssms"],
52
- B6352mv: ["f1khssms", "fdsq1qd"],
53
- nr063g: "fq4eyks",
54
- Blmvk6g: ["f1ya6x16", "ftuszwa"],
55
- Bsiemmq: "f1e2iu44",
56
- B98u21t: ["ftuszwa", "f1ya6x16"],
57
- B2pnrqr: "f1xkdug0",
58
- Bhhzhcn: "f1m1ywml",
59
- Bec0n69: ["f7u4kgv", "f1a36mvi"],
60
- B29w5g4: ["f1a36mvi", "f7u4kgv"]
61
- },
62
27
  vertical: {
63
28
  Beiy3e4: "f1vx9l62"
64
29
  }
65
30
  }, {
66
- d: [".f6jr5hl{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;}", ".f1ewtqcl{box-sizing:border-box;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f10pi13n{position:relative;}", ".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;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"],
67
- f: [".ftqa4ok:focus{outline-style:none;}"],
68
- i: [".f2hkw1w:focus-visible{outline-style:none;}"]
31
+ d: [".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}"]
69
32
  });
33
+ const useIndicatorBaseClassName = /*#__PURE__*/react_1.__resetStyles("r13wlxb8", null, [".r13wlxb8{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}", "@media screen and (prefers-reduced-motion: reduce){.r13wlxb8{transition-duration:0.01ms;}}", ".r13wlxb8>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}", "@media screen and (prefers-reduced-motion: reduce){.r13wlxb8>*{transition-duration:0.01ms;}}"]);
70
34
  const useIndicatorStyles = /*#__PURE__*/react_1.__styles({
71
- base: {
72
- Bbmb7ep: ["f8fbkgy", "f1nfllo7"],
73
- Beyfa6y: ["f1nfllo7", "f8fbkgy"],
74
- B7oj6ja: ["f1djnp8u", "f1s8kh49"],
75
- Btl43ni: ["f1s8kh49", "f1djnp8u"],
76
- icvyot: "fzkkow9",
77
- vrafjx: ["fcdblym", "fjik90z"],
78
- oivjwe: "fg706s2",
79
- wvpqe5: ["fjik90z", "fcdblym"],
80
- B4j52fo: "f5ogflp",
81
- Bekrc4i: ["f1hqa2wf", "finvdd3"],
82
- Bn0qgzm: "f1f09k3d",
83
- ibv6hh: ["finvdd3", "f1hqa2wf"],
84
- Bg96gwp: "fez10in",
85
- B7ck84d: "f1ewtqcl",
86
- Bkfmm31: "f1w9h62z",
87
- Bnnss6s: "fi64zpg",
88
- Be2twd7: "fg38ndl",
89
- Bqenvij: "fjamq6b",
90
- B6of3ja: "frnwi6n",
91
- t21cq0: ["f1vcna3q", "foyynoy"],
92
- jrapky: "fqcjy3b",
93
- Frg6f3: ["foyynoy", "f1vcna3q"],
94
- Bkecrkj: "f1aehjj5",
95
- B3o57yi: "f1vze9yt",
96
- Bkqvd7p: "f17wnm97",
97
- Bmy1vo4: "fo99fu7",
98
- a9b677: "feqmc2u",
99
- Hwfdqs: "f1onx1g3",
100
- Hkqiji: "f1h74hm9",
101
- Bgrs90m: "f1592id",
102
- B0zx559: "f1uwej41",
103
- c0im90: "fpz7fqq"
104
- },
105
35
  labelAbove: {
106
36
  B6of3ja: "f1hu3pq6"
107
37
  }
108
38
  }, {
109
- d: [".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);}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fez10in{line-height:0;}", ".f1ewtqcl{box-sizing:border-box;}", ".f1w9h62z{fill:currentColor;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".fg38ndl{font-size:18px;}", ".fjamq6b{height:20px;}", ".frnwi6n{margin-top:var(--spacingVerticalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".foyynoy{margin-left:var(--spacingHorizontalS);}", ".fqcjy3b{margin-bottom:var(--spacingVerticalS);}", ".f1aehjj5{pointer-events:none;}", ".f1vze9yt{transition-duration:var(--durationNormal);}", ".f17wnm97{transition-timing-function:var(--curveEasyEase);}", ".fo99fu7{transition-property:background,border,color;}", ".feqmc2u{width:40px;}", ".f1h74hm9>*{transition-duration:var(--durationNormal);}", ".f1592id>*{transition-timing-function:var(--curveEasyEase);}", ".f1uwej41>*{transition-property:transform;}", ".f1hu3pq6{margin-top:0;}"],
110
- m: [["@media screen and (prefers-reduced-motion: reduce){.f1onx1g3{transition-duration:0.01ms;}}", {
111
- m: "screen and (prefers-reduced-motion: reduce)"
112
- }], ["@media screen and (prefers-reduced-motion: reduce){.fpz7fqq>*{transition-duration:0.01ms;}}", {
113
- m: "screen and (prefers-reduced-motion: reduce)"
114
- }]]
39
+ d: [".f1hu3pq6{margin-top:0;}"]
115
40
  });
41
+ const useInputBaseClassName = /*#__PURE__*/react_1.__resetStyles("r92li9d", "rxjpw57", [".r92li9d{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}", ".r92li9d:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}", ".r92li9d:disabled{cursor:default;}", ".r92li9d:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".r92li9d:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", ".r92li9d:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}", ".r92li9d:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".r92li9d:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".r92li9d:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".r92li9d:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}", ".r92li9d:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}", ".r92li9d:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}", ".r92li9d:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}", ".r92li9d:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}", "@media (forced-colors: active){.r92li9d:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r92li9d:disabled~.fui-Switch__label{color:GrayText;}}", ".rxjpw57{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}", ".rxjpw57:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}", ".rxjpw57:disabled{cursor:default;}", ".rxjpw57:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".rxjpw57:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}", ".rxjpw57:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}", ".rxjpw57:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".rxjpw57:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}", ".rxjpw57:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}", ".rxjpw57:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}", ".rxjpw57:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}", ".rxjpw57:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}", ".rxjpw57:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}", ".rxjpw57:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}", "@media (forced-colors: active){.rxjpw57:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rxjpw57:disabled~.fui-Switch__label{color:GrayText;}}"]);
116
42
  const useInputStyles = /*#__PURE__*/react_1.__styles({
117
- base: {
118
- B7ck84d: "f1ewtqcl",
119
- Bceei9c: "f1k6fduh",
120
- Bqenvij: "f1l02sjl",
121
- B6of3ja: "f1hu3pq6",
122
- t21cq0: ["f11qmguv", "f1tyq0we"],
123
- jrapky: "f19f4twv",
124
- Frg6f3: ["f1tyq0we", "f11qmguv"],
125
- abs64n: "fk73vx1",
126
- qhf8xq: "f1euv43f",
127
- a9b677: "f1ry1bn9",
128
- fv8x6k: ["f3l1kk6", "f1kez0x4"],
129
- ezr58z: "fvxnmui",
130
- Blezdol: "f1cxq9o1",
131
- k28iui: "f1q9yyk5",
132
- B8f96ig: "f1ks1zsm",
133
- po7uxr: "fiqfi0i",
134
- inq7wv: "f9aagkg",
135
- Cdugon: ["fgv8l18", "f1p3jmxb"],
136
- ptsei1: "f11yi64e",
137
- bl04ud: ["f1p3jmxb", "fgv8l18"],
138
- Bu7dm46: "fthrly9",
139
- Gwwlnz: "fhdp2ht",
140
- wb1her: "f1rzj6jj",
141
- Bmieemq: ["f1jywl1l", "f13d626x"],
142
- Bdgjgzg: "f1ivtmze",
143
- B05cvx7: ["f13d626x", "f1jywl1l"],
144
- Bx4eqiv: "f1uvnr57",
145
- xhnoxe: "frhcydi",
146
- Hnmc4c: ["f1pvt3n7", "f14i0clv"],
147
- By8gkvz: "fq9gcw4",
148
- lekrm4: ["f14i0clv", "f1pvt3n7"],
149
- Bei91sp: "f1se0d6r",
150
- Bksztz9: "f8l9son",
151
- h3gz1v: "f1c4gun2",
152
- Cw6427: ["flhgtcm", "fx1zdd8"],
153
- Bpbd9g9: "fayrp2e",
154
- ssulyh: ["fx1zdd8", "flhgtcm"],
155
- vq7rp1: "f1p715pa",
156
- ynrfiu: "firogjh",
157
- Bf5tpyt: ["f1crd6p1", "for8100"],
158
- Brhic7g: "f1v5j4zb",
159
- Cqvc5u: ["for8100", "f1crd6p1"],
160
- B4e80u0: "f116zuoq",
161
- Bwj41i9: "fxvotg6",
162
- B2iiaa1: ["fk9ur30", "f3u5smv"],
163
- Bejmxmv: "fdtj07x",
164
- rqauf5: ["f3u5smv", "fk9ur30"],
165
- wo5z87: "fv5mb1o",
166
- B50joxe: ["f1i2l8ou", "fxj1kmv"],
167
- Bmuizf1: "fku528b",
168
- f4urji: ["fxj1kmv", "f1i2l8ou"],
169
- Bxiq1ly: "fabcpc0",
170
- vbmdq8: "f17xwy6w",
171
- u4vbwo: ["fipwscc", "fab39iv"],
172
- Bfjga03: "f1th5z1l",
173
- F0s3py: ["fab39iv", "fipwscc"]
174
- },
175
- highContrast: {
176
- Bskmvfo: "f19h63kc",
177
- zhypoe: "ffutfdj",
178
- Bb6xxwe: ["f72m8yo", "f1ud47z9"],
179
- o89t22: "f15xfkur",
180
- B7qxyha: ["f1ud47z9", "f72m8yo"],
181
- Bhmcd6p: "f1jaqqzs"
182
- },
183
43
  before: {
184
44
  j35jbq: ["f1e31b4d", "f1vgc2s3"],
185
45
  Bhzewxz: "f15twtuk"
@@ -194,21 +54,9 @@ const useInputStyles = /*#__PURE__*/react_1.__styles({
194
54
  a9b677: "fly5x3f"
195
55
  }
196
56
  }, {
197
- d: [".f1ewtqcl{box-sizing:border-box;}", ".f1k6fduh{cursor:pointer;}", ".f1l02sjl{height:100%;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".fk73vx1{opacity:0;}", ".f1euv43f{position:absolute;}", ".f1ry1bn9{width:calc(40px + 2 * var(--spacingHorizontalS));}", ".f3l1kk6:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(20px);-moz-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}", ".f1kez0x4:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}", ".fvxnmui:disabled{cursor:default;}", ".f1cxq9o1:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".f1q9yyk5:disabled~.fui-Switch__label{cursor:default;}", ".f1ks1zsm:disabled~.fui-Switch__label{color:var(--colorNeutralForegroundDisabled);}", ".fiqfi0i:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);}", ".f9aagkg:enabled:not(:checked)~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessible);}", ".fgv8l18:enabled:not(:checked)~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessible);}", ".f1p3jmxb:enabled:not(:checked)~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f11yi64e:enabled:not(:checked)~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".fthrly9:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}", ".fhdp2ht:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);}", ".f1rzj6jj:enabled:not(:checked):hover~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1jywl1l:enabled:not(:checked):hover~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessibleHover);}", ".f13d626x:enabled:not(:checked):hover~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1ivtmze:enabled:not(:checked):hover~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1uvnr57:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);}", ".frhcydi:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1pvt3n7:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f14i0clv:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeAccessiblePressed);}", ".fq9gcw4:enabled:not(:checked):hover:active~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f1se0d6r:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);}", ".f8l9son:enabled:checked~.fui-Switch__indicator{color:var(--colorNeutralForegroundInverted);}", ".f1c4gun2:enabled:checked~.fui-Switch__indicator{border-top-color:var(--colorTransparentStroke);}", ".flhgtcm:enabled:checked~.fui-Switch__indicator{border-right-color:var(--colorTransparentStroke);}", ".fx1zdd8:enabled:checked~.fui-Switch__indicator{border-left-color:var(--colorTransparentStroke);}", ".fayrp2e:enabled:checked~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStroke);}", ".f1p715pa:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);}", ".firogjh:enabled:checked:hover~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeInteractive);}", ".f1crd6p1:enabled:checked:hover~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeInteractive);}", ".for8100:enabled:checked:hover~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeInteractive);}", ".f1v5j4zb:enabled:checked:hover~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".f116zuoq:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);}", ".fxvotg6:enabled:checked:hover:active~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeInteractive);}", ".fk9ur30:enabled:checked:hover:active~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f3u5smv:enabled:checked:hover:active~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fdtj07x:enabled:checked:hover:active~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".fv5mb1o:disabled:not(:checked)~.fui-Switch__indicator{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1i2l8ou:disabled:not(:checked)~.fui-Switch__indicator{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fxj1kmv:disabled:not(:checked)~.fui-Switch__indicator{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fku528b:disabled:not(:checked)~.fui-Switch__indicator{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fabcpc0:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);}", ".f17xwy6w:disabled:checked~.fui-Switch__indicator{border-top-color:var(--colorTransparentStrokeDisabled);}", ".fipwscc:disabled:checked~.fui-Switch__indicator{border-right-color:var(--colorTransparentStrokeDisabled);}", ".fab39iv:disabled:checked~.fui-Switch__indicator{border-left-color:var(--colorTransparentStrokeDisabled);}", ".f1th5z1l:disabled:checked~.fui-Switch__indicator{border-bottom-color:var(--colorTransparentStrokeDisabled);}", ".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}", ".fly5x3f{width:100%;}"],
198
- m: [["@media (forced-colors: active){.f19h63kc:disabled~.fui-Switch__indicator{color:GrayText;}}", {
199
- m: "(forced-colors: active)"
200
- }], ["@media (forced-colors: active){.ffutfdj:disabled~.fui-Switch__indicator{border-top-color:GrayText;}}", {
201
- m: "(forced-colors: active)"
202
- }], ["@media (forced-colors: active){.f72m8yo:disabled~.fui-Switch__indicator{border-right-color:GrayText;}.f1ud47z9:disabled~.fui-Switch__indicator{border-left-color:GrayText;}}", {
203
- m: "(forced-colors: active)"
204
- }], ["@media (forced-colors: active){.f15xfkur:disabled~.fui-Switch__indicator{border-bottom-color:GrayText;}}", {
205
- m: "(forced-colors: active)"
206
- }], ["@media (forced-colors: active){.f1ud47z9:disabled~.fui-Switch__indicator{border-left-color:GrayText;}.f72m8yo:disabled~.fui-Switch__indicator{border-right-color:GrayText;}}", {
207
- m: "(forced-colors: active)"
208
- }], ["@media (forced-colors: active){.f1jaqqzs:disabled~.fui-Switch__label{color:GrayText;}}", {
209
- m: "(forced-colors: active)"
210
- }]]
57
+ d: [".f1e31b4d{right:0;}", ".f1vgc2s3{left:0;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}", ".fly5x3f{width:100%;}"]
211
58
  });
59
+ // Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
212
60
  const useLabelStyles = /*#__PURE__*/react_1.__styles({
213
61
  base: {
214
62
  Bceei9c: "f1k6fduh",
@@ -237,17 +85,20 @@ const useLabelStyles = /*#__PURE__*/react_1.__styles({
237
85
  * Apply styling to the Switch slots based on the state
238
86
  */
239
87
  const useSwitchStyles_unstable = state => {
88
+ const rootBaseClassName = useRootBaseClassName();
240
89
  const rootStyles = useRootStyles();
90
+ const indicatorBaseClassName = useIndicatorBaseClassName();
241
91
  const indicatorStyles = useIndicatorStyles();
92
+ const inputBaseClassName = useInputBaseClassName();
242
93
  const inputStyles = useInputStyles();
243
94
  const labelStyles = useLabelStyles();
244
95
  const {
245
96
  label,
246
97
  labelPosition
247
98
  } = state;
248
- state.root.className = react_1.mergeClasses(exports.switchClassNames.root, rootStyles.base, labelPosition === 'above' && rootStyles.vertical, state.root.className);
249
- state.indicator.className = react_1.mergeClasses(exports.switchClassNames.indicator, indicatorStyles.base, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
250
- state.input.className = react_1.mergeClasses(exports.switchClassNames.input, inputStyles.base, inputStyles.highContrast, label && inputStyles[labelPosition], state.input.className);
99
+ state.root.className = react_1.mergeClasses(exports.switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
100
+ state.indicator.className = react_1.mergeClasses(exports.switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
101
+ state.input.className = react_1.mergeClasses(exports.switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
251
102
  if (state.label) {
252
103
  state.label.className = react_1.mergeClasses(exports.switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
253
104
  }
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAIaA,wBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGaJ,uBAAe,GAAGA,wBAAgB,CAACC,IAAI;AAEpD;AACA,MAAMI,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,SAAS,GAAGF,WA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,KAAK,EACtBe,WAAW,CAACG,IAAI,EAChBH,WAAW,CAACC,aAAa,CAAC,EAC1BL,KAAK,CAACX,KAAK,CAACiB,SAAS,CACtB;;EAGH,OAAON,KAAK;AACd,CAAC;AAxCYf,gCAAwB","names":["exports","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootStyles","react_1","useIndicatorStyles","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootStyles","indicatorStyles","inputStyles","labelStyles","labelPosition","className","base","vertical","labelAbove","highContrast"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootStyles = makeStyles({\n base: {\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('1px'),\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n ...shorthands.margin(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n },\n\n labelAbove: {\n marginTop: 0,\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessible),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessibleHover),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n ...shorthands.borderColor(tokens.colorNeutralStrokeAccessiblePressed),\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorTransparentStrokeDisabled),\n },\n },\n },\n\n highContrast: {\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n ...shorthands.borderColor('GrayText'),\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n },\n\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootStyles = useRootStyles();\n const indicatorStyles = useIndicatorStyles();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootStyles.base,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorStyles.base,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputStyles.base,\n inputStyles.highContrast,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAIaA,wBAAgB,GAAgC;EAC3DC,IAAI,EAAE,YAAY;EAClBC,SAAS,EAAE,uBAAuB;EAClCC,KAAK,EAAE,mBAAmB;EAC1BC,KAAK,EAAE;CACR;AAED;;;AAGaJ,uBAAe,GAAGA,wBAAgB,CAACC,IAAI;AAEpD;AACA,MAAMI,yBAAyB,GAAG,CAAC;AACnC,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,G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ACQ,QAAQ,EAChDV,KAAK,CAACjB,IAAI,CAAC0B,SAAS,CACrB;EAEDT,KAAK,CAAChB,SAAS,CAACyB,SAAS,GAAGjB,oBAAY,CACtCV,wBAAgB,CAACE,SAAS,EAC1BmB,sBAAsB,EACtBjB,KAAK,IAAIsB,aAAa,KAAK,OAAO,IAAIJ,eAAe,CAACO,UAAU,EAChEX,KAAK,CAAChB,SAAS,CAACyB,SAAS,CAC1B;EAEDT,KAAK,CAACf,KAAK,CAACwB,SAAS,GAAGjB,oBAAY,CAClCV,wBAAgB,CAACG,KAAK,EACtBoB,kBAAkB,EAClBnB,KAAK,IAAIoB,WAAW,CAACE,aAAa,CAAC,EACnCR,KAAK,CAACf,KAAK,CAACwB,SAAS,CACtB;EAED,IAAIT,KAAK,CAACd,KAAK,EAAE;IACfc,KAAK,CAACd,KAAK,CAACuB,SAAS,GAAGjB,oBAAY,CAClCV,wBAAgB,CAACI,KAAK,EACtBqB,WAAW,CAACK,IAAI,EAChBL,WAAW,CAACC,aAAa,CAAC,EAC1BR,KAAK,CAACd,KAAK,CAACuB,SAAS,CACtB;;EAGH,OAAOT,KAAK;AACd,CAAC;AA1CYlB,gCAAwB","names":["exports","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","react_1","useRootStyles","useIndicatorBaseClassName","useIndicatorStyles","useInputBaseClassName","useInputStyles","useLabelStyles","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","vertical","labelAbove","base"],"sourceRoot":"../src/","sources":["packages/react-components/react-switch/src/components/Switch/useSwitchStyles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\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\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 switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\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 cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-switch",
3
- "version": "9.0.17",
3
+ "version": "9.0.19",
4
4
  "description": "Fluent UI React Switch component.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -28,13 +28,14 @@
28
28
  "@fluentui/eslint-plugin": "*",
29
29
  "@fluentui/react-conformance": "*",
30
30
  "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
31
- "@fluentui/scripts": "*"
31
+ "@fluentui/scripts-api-extractor": "*",
32
+ "@fluentui/scripts-tasks": "*"
32
33
  },
33
34
  "dependencies": {
34
- "@fluentui/react-field": "9.0.0-alpha.14",
35
+ "@fluentui/react-field": "9.0.0-alpha.15",
35
36
  "@fluentui/react-icons": "^2.0.175",
36
- "@fluentui/react-label": "^9.0.16",
37
- "@fluentui/react-tabster": "^9.3.6",
37
+ "@fluentui/react-label": "^9.0.17",
38
+ "@fluentui/react-tabster": "^9.4.0",
38
39
  "@fluentui/react-theme": "^9.1.5",
39
40
  "@fluentui/react-utilities": "^9.4.0",
40
41
  "@griffel/react": "^1.5.2",