@fluentui/react-switch 9.0.0-rc.1 → 9.0.0-rc.5

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.
Files changed (44) hide show
  1. package/CHANGELOG.json +130 -1
  2. package/CHANGELOG.md +43 -2
  3. package/dist/react-switch.d.ts +56 -40
  4. package/lib/Switch.js.map +1 -1
  5. package/lib/components/Switch/Switch.d.ts +1 -1
  6. package/lib/components/Switch/Switch.js +1 -1
  7. package/lib/components/Switch/Switch.js.map +1 -1
  8. package/lib/components/Switch/Switch.types.d.ts +41 -35
  9. package/lib/components/Switch/Switch.types.js.map +1 -1
  10. package/lib/components/Switch/index.js.map +1 -1
  11. package/lib/components/Switch/renderSwitch.d.ts +1 -1
  12. package/lib/components/Switch/renderSwitch.js +8 -6
  13. package/lib/components/Switch/renderSwitch.js.map +1 -1
  14. package/lib/components/Switch/useSwitch.d.ts +8 -2
  15. package/lib/components/Switch/useSwitch.js +63 -43
  16. package/lib/components/Switch/useSwitch.js.map +1 -1
  17. package/lib/components/Switch/useSwitchStyles.d.ts +4 -2
  18. package/lib/components/Switch/useSwitchStyles.js +144 -262
  19. package/lib/components/Switch/useSwitchStyles.js.map +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib-commonjs/Switch.js.map +1 -1
  22. package/lib-commonjs/components/Switch/Switch.d.ts +1 -1
  23. package/lib-commonjs/components/Switch/Switch.js +1 -1
  24. package/lib-commonjs/components/Switch/Switch.js.map +1 -1
  25. package/lib-commonjs/components/Switch/Switch.types.d.ts +41 -35
  26. package/lib-commonjs/components/Switch/Switch.types.js.map +1 -1
  27. package/lib-commonjs/components/Switch/index.js.map +1 -1
  28. package/lib-commonjs/components/Switch/renderSwitch.d.ts +1 -1
  29. package/lib-commonjs/components/Switch/renderSwitch.js +8 -6
  30. package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
  31. package/lib-commonjs/components/Switch/useSwitch.d.ts +8 -2
  32. package/lib-commonjs/components/Switch/useSwitch.js +65 -43
  33. package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
  34. package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +4 -2
  35. package/lib-commonjs/components/Switch/useSwitchStyles.js +146 -264
  36. package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
  37. package/lib-commonjs/index.js.map +1 -1
  38. package/package.json +14 -5
  39. package/lib/components/Switch/useSwitchState.d.ts +0 -2
  40. package/lib/components/Switch/useSwitchState.js +0 -144
  41. package/lib/components/Switch/useSwitchState.js.map +0 -1
  42. package/lib-commonjs/components/Switch/useSwitchState.d.ts +0 -2
  43. package/lib-commonjs/components/Switch/useSwitchState.js +0 -156
  44. package/lib-commonjs/components/Switch/useSwitchState.js.map +0 -1
@@ -1,45 +1,34 @@
1
- import { shorthands, __styles, mergeClasses } from '@griffel/react';
2
1
  import { createFocusOutlineStyle } from '@fluentui/react-tabster';
3
2
  import { tokens } from '@fluentui/react-theme';
4
- export const switchClassName = 'fui-Switch';
5
- const trackClassName = `${switchClassName}-track`;
6
- const thumbClassName = `${switchClassName}-thumb`;
7
- /**
8
- * Styles for the root slot
9
- */
3
+ import { __styles, mergeClasses, shorthands } from '@griffel/react';
4
+ export const switchClassNames = {
5
+ root: 'fui-Switch',
6
+ indicator: 'fui-Switch__indicator',
7
+ input: 'fui-Switch__input',
8
+ label: 'fui-Switch__label'
9
+ }; // TODO temporary export to pass conformance test.
10
+
11
+ export const switchClassName = switchClassNames.root; // TODO replace these spacing constants with theme values once they're on the theme.
12
+
13
+ const spacingXS = 4;
14
+ const spacingS = 8;
15
+ const spacingM = 12; // Thumb and track sizes used by the component.
16
+
17
+ const spaceBetweenThumbAndTrack = 2;
18
+ const thumbSize = 14;
19
+ const trackHeight = 20;
20
+ const trackWidth = 40;
10
21
 
11
22
  const useRootStyles = /*#__PURE__*/__styles({
12
- "root": {
13
- "B64q66w": "frxo1y7",
14
- "yvbau0": "fe5s2ct",
15
- "k3w5al": "f1n6k660",
16
- "mt6sm6": "f17m95gg",
17
- "Bjtifd4": "fp7zjh8",
23
+ "base": {
24
+ "B7ck84d": "f1ewtqcl",
25
+ "i8kkvl": "f4akndk",
26
+ "mc9l5x": "ftuwxu6",
27
+ "z8tnut": "fp9bwmr",
28
+ "z189sj": ["f19lj068", "f177v4lu"],
29
+ "Byoj8tv": "f150uoa4",
30
+ "uwmqm3": ["f177v4lu", "f19lj068"],
18
31
  "qhf8xq": "f10pi13n",
19
- "a9b677": "fnceurk",
20
- "Bqenvij": "f15da5dy",
21
- "mc9l5x": "f14t3ns0",
22
- "famaaq": "f1xqy1su",
23
- "lpbzjs": "f1sdsnyy",
24
- "ha4doy": "f1qdqbpl"
25
- },
26
- "unchecked": {
27
- "d48c0s": "frinyyk",
28
- "Bc6qnd8": "f1g8lwx2"
29
- },
30
- "checked": {
31
- "Banj4pq": "fpfyfb6",
32
- "Brktkwq": "f3vtzeg"
33
- },
34
- "enabled": {
35
- "H36rlo": "felqjlh",
36
- "Bceei9c": "f1k6fduh"
37
- },
38
- "disabled": {
39
- "Bceei9c": "fdrzuqr",
40
- "Bkecrkj": "f1aehjj5"
41
- },
42
- "focusIndicator": {
43
32
  "B486eqv": "f2hkw1w",
44
33
  "c2y4jd": "fsofd9k",
45
34
  "B8vm7ur": "f12sql3b",
@@ -51,239 +40,133 @@ const useRootStyles = /*#__PURE__*/__styles({
51
40
  "sfhsbh": "f1pke3uf",
52
41
  "Bugh3ej": "f18xdlq9",
53
42
  "hpanx6": "f1114nks",
54
- "Bjkpy09": "f1rh66yx",
55
- "Jxg1p8": "f19ibq92",
56
- "Bc94xmo": ["fc3tncn", "f1veb610"],
57
- "Bj23z95": ["f1veb610", "fc3tncn"]
58
- }
59
- }, {
60
- "d": [".frxo1y7{--switch-width:40px;}", ".fe5s2ct{--switch-height:20px;}", ".f1n6k660{--switch-thumb-size:14px;}", ".f17m95gg{--switch-checked-opacity:0;}", ".fp7zjh8{--switch-unchecked-opacity:0;}", ".f10pi13n{position:relative;}", ".fnceurk{width:var(--switch-width);}", ".f15da5dy{height:var(--switch-height);}", ".f14t3ns0{display:inline-block;}", ".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", ".f1sdsnyy{touch-action:none;}", ".f1qdqbpl{vertical-align:bottom;}", ".felqjlh{-webkit-tap-highlight-color:rgba(0,0,0,0);}", ".f1k6fduh{cursor:pointer;}", ".fdrzuqr{cursor:not-allowed;}", ".f1aehjj5{pointer-events:none;}", "[data-keyboard-nav] .fsofd9k:focus-within{border-color:transparent;}", "[data-keyboard-nav] .f12sql3b:focus-within:after{content:\"\";}", "[data-keyboard-nav] .f1i4q40k:focus-within:after{position:absolute;}", "[data-keyboard-nav] .fcrbge9:focus-within:after{pointer-events:none;}", "[data-keyboard-nav] .ft464mn:focus-within:after{box-sizing:outline-box;}", "[data-keyboard-nav] .fskqmiq:focus-within:after{z-index:1;}", "[data-keyboard-nav] .f2gy8jn:focus-within:after{border-style:solid;}", "[data-keyboard-nav] .f1pke3uf:focus-within:after{border-width:2px;}", "[data-keyboard-nav] .f18xdlq9:focus-within:after{border-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f1114nks:focus-within:after{border-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1rh66yx:focus-within:after{top:calc(0px - 2px - 8px);}", "[data-keyboard-nav] .f19ibq92:focus-within:after{bottom:calc(0px - 2px - 8px);}", "[data-keyboard-nav] .fc3tncn:focus-within:after{left:calc(0px - 2px - 8px);}", "[data-keyboard-nav] .f1veb610:focus-within:after{right:calc(0px - 2px - 8px);}"],
61
- "h": [".frinyyk:hover .fui-Switch-thumb:before{background-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1g8lwx2:hover .fui-Switch-track:before{border-color:var(--colorNeutralStrokeAccessibleHover);}", ".fpfyfb6:hover .fui-Switch-track:after{background-color:var(--colorBrandBackgroundHover);}"],
62
- "a": [".f3vtzeg:active .fui-Switch-track:after{background-color:var(--colorBrandBackgroundPressed);}"],
63
- "i": [".f2hkw1w:focus-visible{outline-style:none;}"]
64
- });
65
- /**
66
- * Styles for the track slot
67
- */
68
-
69
-
70
- const useTrackStyles = /*#__PURE__*/__styles({
71
- "track": {
72
- "qhf8xq": "f1euv43f",
73
- "a9b677": "fly5x3f",
74
- "Bqenvij": "f1l02sjl",
75
- "Bmy1vo4": "fmslzlq",
76
- "B3o57yi": "f15vu5tu",
77
- "Bkqvd7p": "f1e1a42z",
78
- "lpbzjs": "f1sdsnyy",
79
- "Bkecrkj": "f1aehjj5",
80
- "xx9plb": "fxf9f1y",
81
- "Bf8kmfk": "frdto5n",
82
- "Byque4d": ["f8g0ba1", "ff0gctb"],
83
- "Bj2wrql": "f3zr33r",
84
- "qd6xl9": ["ff0gctb", "f8g0ba1"],
85
- "Bmqnesq": "f170vdtw",
86
- "px8gyy": ["f7lyffi", "fmk9c8u"],
87
- "B5c9fhp": ["fmk9c8u", "f7lyffi"],
88
- "Bhe99jt": ["f1nat4im", "fw5qzmy"],
89
- "B2r1szc": ["fw5qzmy", "f1nat4im"],
90
- "rurcny": "f99sooz",
91
- "ngabwx": "f1uhpfti",
92
- "Hdbjpj": "f11ef69",
93
- "u6d25": "f1yuyem3",
94
- "jc51t6": ["f1bp8q63", "f1oarbwq"],
95
- "Bj55yzk": "f13gddrr",
96
- "cnmfks": ["f1oarbwq", "f1bp8q63"],
97
- "oqd9ik": "ffdc0f3",
98
- "frdscb": ["f1xuwyw0", "f12j4hro"],
99
- "B9nohqn": ["f12j4hro", "f1xuwyw0"],
100
- "B1dhsta": ["f1mf29j", "f1nzm45q"],
101
- "Bjdmjzx": ["f1nzm45q", "f1mf29j"],
102
- "Bs6t6z0": "f77y9vx",
103
- "Bmyypfa": "frd86tk"
43
+ "Bjkpy09": "f1unftzx",
44
+ "Jxg1p8": "f8rjbh6",
45
+ "Bc94xmo": ["fxfgh6q", "f8l10fm"],
46
+ "Bj23z95": ["f8l10fm", "fxfgh6q"]
104
47
  },
105
- "unchecked": {
106
- "dj0dih": "f199l62q",
107
- "D4ky5z": ["f1pa2qi2", "f1ooiv2t"],
108
- "k1i1uq": "fyqop9u",
109
- "Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
110
- "Bdixowu": "f1bwkb58",
111
- "cqycoz": ["fiio4mc", "fc8z0qo"],
112
- "Epwjcz": "f1m5ya7j",
113
- "Bwdktmn": ["fc8z0qo", "fiio4mc"],
114
- "ijj6k": "f1gqzwee",
115
- "I89eb": ["f149mt9j", "fs3bzhx"],
116
- "Bp1vogq": "f14z72z2",
117
- "Bohd3ja": ["fs3bzhx", "f149mt9j"],
118
- "B1dvbpk": "f1k1dzc6"
48
+ "above": {
49
+ "Beiy3e4": "f1vx9l62",
50
+ "z8tnut": "f10ra9hq",
51
+ "Belr9w4": "f1ma2n7n"
119
52
  },
120
- "checked": {
121
- "Bkbwdz4": "f8mks4l",
122
- "rskduk": "f1so6udy",
123
- "Dctjco": ["f1faxgr0", "f1wf3et7"],
124
- "J4s2b0": "f124kgxn",
125
- "svcy3r": ["f1wf3et7", "f1faxgr0"]
53
+ "after": {
54
+ "Bt984gj": "f6jr5hl",
55
+ "i8kkvl": "f4akndk",
56
+ "Beiy3e4": "f1063pyq"
126
57
  },
127
- "disabledUnchecked": {
128
- "dj0dih": "f199l62q",
129
- "D4ky5z": ["f1pa2qi2", "f1ooiv2t"],
130
- "k1i1uq": "fyqop9u",
131
- "Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
132
- "Bdixowu": "f1bwkb58",
133
- "cqycoz": ["fiio4mc", "fc8z0qo"],
134
- "Epwjcz": "f1m5ya7j",
135
- "Bwdktmn": ["fc8z0qo", "fiio4mc"],
136
- "ijj6k": "fntj282",
137
- "I89eb": ["fzta9nb", "f17m9iy5"],
138
- "Bp1vogq": "f1k4exvn",
139
- "Bohd3ja": ["f17m9iy5", "fzta9nb"]
140
- },
141
- "disabledChecked": {
142
- "Bouo9z4": "f1l5cenb",
143
- "Bjz4wo8": ["f1jvubu3", "f1q1uvzd"],
144
- "B3zxwmv": "f2fxry3",
145
- "exdlgl": ["f1q1uvzd", "f1jvubu3"],
146
- "rskduk": "f1iq3fds",
147
- "Dctjco": ["f1r2jemi", "f11olovk"],
148
- "J4s2b0": "fd0py6g",
149
- "svcy3r": ["f11olovk", "f1r2jemi"],
150
- "F7kzw7": "f2uxs13",
151
- "B13j16c": ["f11zx3qq", "fqewq1t"],
152
- "Bk8j60v": "fmewjpk",
153
- "Bpbi4o9": ["fqewq1t", "f11zx3qq"],
154
- "Bkbwdz4": "f132yvl5"
58
+ "before": {
59
+ "Bt984gj": "f6jr5hl",
60
+ "i8kkvl": "f4akndk",
61
+ "Beiy3e4": "f1063pyq"
155
62
  }
156
63
  }, {
157
- "d": [".f1euv43f{position:absolute;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".fmslzlq{transition-property:backgroundColor;}", ".f15vu5tu{transition-duration:0.1s;}", ".f1e1a42z{transition-timing-function:cubic-bezier(0.33, 0, 0.67, 1);}", ".f1sdsnyy{touch-action:none;}", ".f1aehjj5{pointer-events:none;}", ".fxf9f1y:before{position:absolute;}", ".frdto5n:before{top:0px;}", ".f8g0ba1:before{left:0px;}", ".ff0gctb:before{right:0px;}", ".f3zr33r:before{bottom:0px;}", ".f170vdtw:before{box-sizing:border-box;}", ".f7lyffi:before{border-bottom-right-radius:999px;}", ".fmk9c8u:before{border-bottom-left-radius:999px;}", ".f1nat4im:before{border-top-right-radius:999px;}", ".fw5qzmy:before{border-top-left-radius:999px;}", ".f99sooz:before{content:'';}", ".f1uhpfti:before{opacity:var(--switch-unchecked-opacity);}", ".f11ef69:after{position:absolute;}", ".f1yuyem3:after{top:0px;}", ".f1bp8q63:after{left:0px;}", ".f1oarbwq:after{right:0px;}", ".f13gddrr:after{bottom:0px;}", ".ffdc0f3:after{box-sizing:border-box;}", ".f1xuwyw0:after{border-bottom-right-radius:999px;}", ".f12j4hro:after{border-bottom-left-radius:999px;}", ".f1mf29j:after{border-top-right-radius:999px;}", ".f1nzm45q:after{border-top-left-radius:999px;}", ".f77y9vx:after{content:'';}", ".frd86tk:after{opacity:var(--switch-checked-opacity);}", ".f199l62q:before{border-top-width:1px;}", ".f1pa2qi2:before{border-right-width:1px;}", ".f1ooiv2t:before{border-left-width:1px;}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1bwkb58:before{border-top-style:solid;}", ".fiio4mc:before{border-right-style:solid;}", ".fc8z0qo:before{border-left-style:solid;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f1gqzwee:before{border-top-color:var(--colorNeutralStrokeAccessible);}", ".f149mt9j:before{border-right-color:var(--colorNeutralStrokeAccessible);}", ".fs3bzhx:before{border-left-color:var(--colorNeutralStrokeAccessible);}", ".f14z72z2:before{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".f1k1dzc6:before{background-color:transparent;}", ".f8mks4l:after{background-color:var(--colorBrandBackground);}", ".f1so6udy:after{border-top-style:none;}", ".f1faxgr0:after{border-right-style:none;}", ".f1wf3et7:after{border-left-style:none;}", ".f124kgxn:after{border-bottom-style:none;}", ".fntj282:before{border-top-color:var(--colorNeutralStrokeDisabled);}", ".fzta9nb:before{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f17m9iy5:before{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f1k4exvn:before{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f1l5cenb:after{border-top-width:1px;}", ".f1jvubu3:after{border-right-width:1px;}", ".f1q1uvzd:after{border-left-width:1px;}", ".f2fxry3:after{border-bottom-width:1px;}", ".f1iq3fds:after{border-top-style:solid;}", ".f1r2jemi:after{border-right-style:solid;}", ".f11olovk:after{border-left-style:solid;}", ".fd0py6g:after{border-bottom-style:solid;}", ".f2uxs13:after{border-top-color:var(--colorTransparentStrokeDisabled);}", ".f11zx3qq:after{border-right-color:var(--colorTransparentStrokeDisabled);}", ".fqewq1t:after{border-left-color:var(--colorTransparentStrokeDisabled);}", ".fmewjpk:after{border-bottom-color:var(--colorTransparentStrokeDisabled);}", ".f132yvl5:after{background-color:var(--colorNeutralBackgroundDisabled);}"]
158
- });
159
- /**
160
- * Styles for the thumb wrapper slot
161
- */
162
-
163
-
164
- const useThumbWrapperStyles = /*#__PURE__*/__styles({
165
- "thumbWrapper": {
166
- "qhf8xq": "f1euv43f",
167
- "Bhzewxz": "f15twtuk",
168
- "B5kzvoi": "f1yab3r1",
169
- "oyh7mz": ["fhpx7ww", "f1kctpth"],
170
- "j35jbq": ["f1kctpth", "fhpx7ww"],
171
- "lpbzjs": "f1sdsnyy",
172
- "Bkecrkj": "f1aehjj5"
173
- }
174
- }, {
175
- "d": [".f1euv43f{position:absolute;}", ".f15twtuk{top:0;}", ".f1yab3r1{bottom:0;}", ".fhpx7ww{left:calc(var(--switch-thumb-size) * .7);}", ".f1kctpth{right:calc(var(--switch-thumb-size) * .7);}", ".f1sdsnyy{touch-action:none;}", ".f1aehjj5{pointer-events:none;}"]
64
+ "d": [".f1ewtqcl{box-sizing:border-box;}", ".f4akndk{-webkit-column-gap:12px;column-gap:12px;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fp9bwmr{padding-top:8px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f150uoa4{padding-bottom:8px;}", ".f10pi13n{position:relative;}", "[data-keyboard-nav] .fsofd9k:focus-within{border-color:transparent;}", "[data-keyboard-nav] .f12sql3b:focus-within:after{content:\"\";}", "[data-keyboard-nav] .f1i4q40k:focus-within:after{position:absolute;}", "[data-keyboard-nav] .fcrbge9:focus-within:after{pointer-events:none;}", "[data-keyboard-nav] .ft464mn:focus-within:after{box-sizing:outline-box;}", "[data-keyboard-nav] .fskqmiq:focus-within:after{z-index:1;}", "[data-keyboard-nav] .f2gy8jn:focus-within:after{border-style:solid;}", "[data-keyboard-nav] .f1pke3uf:focus-within:after{border-width:2px;}", "[data-keyboard-nav] .f18xdlq9:focus-within:after{border-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f1114nks:focus-within:after{border-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1unftzx:focus-within:after{top:-2px;}", "[data-keyboard-nav] .f8rjbh6:focus-within:after{bottom:-2px;}", "[data-keyboard-nav] .fxfgh6q:focus-within:after{left:-2px;}", "[data-keyboard-nav] .f8l10fm:focus-within:after{right:-2px;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f10ra9hq{padding-top:4px;}", ".f1ma2n7n{row-gap:4px;}", ".f6jr5hl{-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}"],
65
+ "i": [".f2hkw1w:focus-visible{outline-style:none;}"]
176
66
  });
177
- /**
178
- * Styles for the thumb slot
179
- */
180
-
181
67
 
182
- const useThumbStyles = /*#__PURE__*/__styles({
183
- "thumb": {
184
- "qhf8xq": "f1euv43f",
185
- "a9b677": "fcjrtee",
186
- "Bqenvij": "fili5n9",
187
- "B7ck84d": "f1ewtqcl",
68
+ const useIndicatorStyles = /*#__PURE__*/__styles({
69
+ "base": {
188
70
  "Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
189
71
  "Beyfa6y": ["f1nfllo7", "f8fbkgy"],
190
72
  "B7oj6ja": ["f1djnp8u", "f1s8kh49"],
191
73
  "Btl43ni": ["f1s8kh49", "f1djnp8u"],
192
- "Bhzewxz": "f1i1t8d1",
193
- "Bz10aip": ["foouk8k", "fd9rb4b"],
194
- "Bmy1vo4": "fmslzlq",
195
- "B3o57yi": "f15vu5tu",
196
- "Bkqvd7p": "f1e1a42z",
197
- "lpbzjs": "f1sdsnyy",
74
+ "icvyot": "fzkkow9",
75
+ "vrafjx": ["fcdblym", "fjik90z"],
76
+ "oivjwe": "fg706s2",
77
+ "wvpqe5": ["fjik90z", "fcdblym"],
78
+ "B4j52fo": "f5ogflp",
79
+ "Bekrc4i": ["f1hqa2wf", "finvdd3"],
80
+ "Bn0qgzm": "f1f09k3d",
81
+ "ibv6hh": ["finvdd3", "f1hqa2wf"],
82
+ "B7ck84d": "f1ewtqcl",
83
+ "Bkfmm31": "f1w9h62z",
84
+ "Bnnss6s": "fi64zpg",
85
+ "Be2twd7": "f4ybsrx",
86
+ "Bqenvij": "fjamq6b",
198
87
  "Bkecrkj": "f1aehjj5",
199
- "xx9plb": "fxf9f1y",
200
- "Bf8kmfk": "frdto5n",
201
- "Byque4d": ["f8g0ba1", "ff0gctb"],
202
- "Bj2wrql": "f3zr33r",
203
- "qd6xl9": ["ff0gctb", "f8g0ba1"],
204
- "px8gyy": ["fu724ry", "f1ufhb3r"],
205
- "B5c9fhp": ["f1ufhb3r", "fu724ry"],
206
- "Bhe99jt": ["fiow2ne", "f13lz1i8"],
207
- "B2r1szc": ["f13lz1i8", "fiow2ne"],
208
- "rurcny": "f99sooz",
209
- "ngabwx": "f1uhpfti",
210
- "Hdbjpj": "f11ef69",
211
- "u6d25": "f1yuyem3",
212
- "jc51t6": ["f1bp8q63", "f1oarbwq"],
213
- "Bj55yzk": "f13gddrr",
214
- "cnmfks": ["f1oarbwq", "f1bp8q63"],
215
- "frdscb": ["fc4gh2t", "flndy84"],
216
- "B9nohqn": ["flndy84", "fc4gh2t"],
217
- "B1dhsta": ["fxgx2h0", "fh20ihy"],
218
- "Bjdmjzx": ["fh20ihy", "fxgx2h0"],
219
- "Bs6t6z0": "f77y9vx",
220
- "Bmyypfa": "frd86tk"
221
- },
222
- "unchecked": {
223
- "B1dvbpk": "f1n7m28n"
224
- },
225
- "checked": {
226
- "Bkbwdz4": "f1261hx1"
227
- },
228
- "disabledUnchecked": {
229
- "dj0dih": "f199l62q",
230
- "D4ky5z": ["f1pa2qi2", "f1ooiv2t"],
231
- "k1i1uq": "fyqop9u",
232
- "Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
233
- "Bdixowu": "f1bwkb58",
234
- "cqycoz": ["fiio4mc", "fc8z0qo"],
235
- "Epwjcz": "f1m5ya7j",
236
- "Bwdktmn": ["fc8z0qo", "fiio4mc"],
237
- "ijj6k": "f1k21dld",
238
- "I89eb": ["f1yueqd5", "f16ep8jm"],
239
- "Bp1vogq": "flh92r5",
240
- "Bohd3ja": ["f16ep8jm", "f1yueqd5"],
241
- "B1dvbpk": "fj528n6"
242
- },
243
- "disabledChecked": {
244
- "Bkbwdz4": "f18jltdj"
245
- }
246
- }, {
247
- "d": [".f1euv43f{position:absolute;}", ".fcjrtee{width:var(--switch-thumb-size);}", ".fili5n9{height:var(--switch-thumb-size);}", ".f1ewtqcl{box-sizing:border-box;}", ".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);}", ".f1i1t8d1{top:50%;}", ".foouk8k{-webkit-transform:translate(-50%, -50%);-moz-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);}", ".fd9rb4b{-webkit-transform:translate(50%, -50%);-moz-transform:translate(50%, -50%);-ms-transform:translate(50%, -50%);transform:translate(50%, -50%);}", ".fmslzlq{transition-property:backgroundColor;}", ".f15vu5tu{transition-duration:0.1s;}", ".f1e1a42z{transition-timing-function:cubic-bezier(0.33, 0, 0.67, 1);}", ".f1sdsnyy{touch-action:none;}", ".f1aehjj5{pointer-events:none;}", ".fxf9f1y:before{position:absolute;}", ".frdto5n:before{top:0px;}", ".f8g0ba1:before{left:0px;}", ".ff0gctb:before{right:0px;}", ".f3zr33r:before{bottom:0px;}", ".fu724ry:before{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1ufhb3r:before{border-bottom-left-radius:var(--borderRadiusCircular);}", ".fiow2ne:before{border-top-right-radius:var(--borderRadiusCircular);}", ".f13lz1i8:before{border-top-left-radius:var(--borderRadiusCircular);}", ".f99sooz:before{content:'';}", ".f1uhpfti:before{opacity:var(--switch-unchecked-opacity);}", ".f11ef69:after{position:absolute;}", ".f1yuyem3:after{top:0px;}", ".f1bp8q63:after{left:0px;}", ".f1oarbwq:after{right:0px;}", ".f13gddrr:after{bottom:0px;}", ".fc4gh2t:after{border-bottom-right-radius:var(--borderRadiusCircular);}", ".flndy84:after{border-bottom-left-radius:var(--borderRadiusCircular);}", ".fxgx2h0:after{border-top-right-radius:var(--borderRadiusCircular);}", ".fh20ihy:after{border-top-left-radius:var(--borderRadiusCircular);}", ".f77y9vx:after{content:'';}", ".frd86tk:after{opacity:var(--switch-checked-opacity);}", ".f1n7m28n:before{background-color:var(--colorNeutralStrokeAccessible);}", ".f1261hx1:after{background-color:var(--colorNeutralForegroundOnBrand);}", ".f199l62q:before{border-top-width:1px;}", ".f1pa2qi2:before{border-right-width:1px;}", ".f1ooiv2t:before{border-left-width:1px;}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1bwkb58:before{border-top-style:solid;}", ".fiio4mc:before{border-right-style:solid;}", ".fc8z0qo:before{border-left-style:solid;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f1k21dld:before{border-top-color:var(--colorNeutralForegroundDisabled);}", ".f1yueqd5:before{border-right-color:var(--colorNeutralForegroundDisabled);}", ".f16ep8jm:before{border-left-color:var(--colorNeutralForegroundDisabled);}", ".flh92r5:before{border-bottom-color:var(--colorNeutralForegroundDisabled);}", ".fj528n6:before{background-color:var(--colorNeutralBackground1);}", ".f18jltdj:after{background-color:var(--colorNeutralForegroundDisabled);}"]
248
- });
249
- /**
250
- * Styles for the activeRail slot
251
- */
252
-
253
-
254
- const useActiveRailStyles = /*#__PURE__*/__styles({
255
- "activeRail": {
256
- "qhf8xq": "f1euv43f",
257
- "oyh7mz": ["fhpx7ww", "f1kctpth"],
258
- "j35jbq": ["f1kctpth", "fhpx7ww"]
88
+ "B3o57yi": "f1bnoopa",
89
+ "Bkqvd7p": "f1e1a42z",
90
+ "Bmy1vo4": "fo99fu7",
91
+ "a9b677": "feqmc2u",
92
+ "Hkqiji": "f1wkgtgk",
93
+ "Bgrs90m": "f17f8g0y",
94
+ "B0zx559": "f1uwej41"
259
95
  }
260
96
  }, {
261
- "d": [".f1euv43f{position:absolute;}", ".fhpx7ww{left:calc(var(--switch-thumb-size) * .7);}", ".f1kctpth{right:calc(var(--switch-thumb-size) * .7);}"]
97
+ "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;}", ".f1ewtqcl{box-sizing:border-box;}", ".f1w9h62z{fill:currentColor;}", ".fi64zpg{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".f4ybsrx{font-size:16px;}", ".fjamq6b{height:20px;}", ".f1aehjj5{pointer-events:none;}", ".f1bnoopa{transition-duration:200ms;}", ".f1e1a42z{transition-timing-function:cubic-bezier(0.33, 0, 0.67, 1);}", ".fo99fu7{transition-property:background,border,color;}", ".feqmc2u{width:40px;}", ".f1wkgtgk>*{transition-duration:200ms;}", ".f17f8g0y>*{transition-timing-function:cubic-bezier(0.33, 0, 0.67, 1);}", ".f1uwej41>*{transition-property:transform;}"]
262
98
  });
263
- /**
264
- * Styles for the hidden input slot
265
- */
266
99
 
267
-
268
- const useInputStyle = /*#__PURE__*/__styles({
269
- "input": {
270
- "abs64n": "fk73vx1",
271
- "qhf8xq": "f1euv43f",
272
- "z8tnut": "f1g0x7ka",
273
- "z189sj": ["fhxju0i", "f1cnd47f"],
274
- "Byoj8tv": "f1qch9an",
275
- "uwmqm3": ["f1cnd47f", "fhxju0i"],
100
+ const useInputStyles = /*#__PURE__*/__styles({
101
+ "base": {
102
+ "B7ck84d": "f1ewtqcl",
103
+ "Bceei9c": "f1k6fduh",
104
+ "Bqenvij": "f1l02sjl",
105
+ "oyh7mz": ["f1vgc2s3", "f1e31b4d"],
276
106
  "B6of3ja": "f1hu3pq6",
277
107
  "t21cq0": ["f11qmguv", "f1tyq0we"],
278
108
  "jrapky": "f19f4twv",
279
109
  "Frg6f3": ["f1tyq0we", "f11qmguv"],
110
+ "abs64n": "fk73vx1",
111
+ "qhf8xq": "f1euv43f",
112
+ "Bhzewxz": "f15twtuk",
280
113
  "a9b677": "fly5x3f",
281
- "Bqenvij": "f1l02sjl",
282
- "lpbzjs": "f1sdsnyy",
283
- "Bkecrkj": "f1aehjj5"
114
+ "fv8x6k": ["f1owqbgs", "f1a7g3i4"],
115
+ "ezr58z": "fvxnmui",
116
+ "Blezdol": "f1cxq9o1",
117
+ "B8f96ig": "f1ks1zsm",
118
+ "po7uxr": "fiqfi0i",
119
+ "inq7wv": "f9aagkg",
120
+ "Cdugon": ["fgv8l18", "f1p3jmxb"],
121
+ "ptsei1": "f11yi64e",
122
+ "bl04ud": ["f1p3jmxb", "fgv8l18"],
123
+ "Bu7dm46": "fthrly9",
124
+ "Gwwlnz": "fhdp2ht",
125
+ "wb1her": "f1rzj6jj",
126
+ "Bmieemq": ["f1jywl1l", "f13d626x"],
127
+ "Bdgjgzg": "f1ivtmze",
128
+ "B05cvx7": ["f13d626x", "f1jywl1l"],
129
+ "Bx4eqiv": "f1uvnr57",
130
+ "xhnoxe": "frhcydi",
131
+ "Hnmc4c": ["f1pvt3n7", "f14i0clv"],
132
+ "By8gkvz": "fq9gcw4",
133
+ "lekrm4": ["f14i0clv", "f1pvt3n7"],
134
+ "Bei91sp": "fft44l1",
135
+ "Bksztz9": "fwlrvmy",
136
+ "h3gz1v": "f1c4gun2",
137
+ "Cw6427": ["flhgtcm", "fx1zdd8"],
138
+ "Bpbd9g9": "fayrp2e",
139
+ "ssulyh": ["fx1zdd8", "flhgtcm"],
140
+ "vq7rp1": "f1vk2knj",
141
+ "ynrfiu": "firogjh",
142
+ "Bf5tpyt": ["f1crd6p1", "for8100"],
143
+ "Brhic7g": "f1v5j4zb",
144
+ "Cqvc5u": ["for8100", "f1crd6p1"],
145
+ "B4e80u0": "f1rt7qcq",
146
+ "Bwj41i9": "fxvotg6",
147
+ "B2iiaa1": ["fk9ur30", "f3u5smv"],
148
+ "Bejmxmv": "fdtj07x",
149
+ "rqauf5": ["f3u5smv", "fk9ur30"],
150
+ "wo5z87": "fv5mb1o",
151
+ "B50joxe": ["f1i2l8ou", "fxj1kmv"],
152
+ "Bmuizf1": "fku528b",
153
+ "f4urji": ["fxj1kmv", "f1i2l8ou"],
154
+ "Bxiq1ly": "fabcpc0",
155
+ "vbmdq8": "f17xwy6w",
156
+ "u4vbwo": ["fipwscc", "fab39iv"],
157
+ "Bfjga03": "f1th5z1l",
158
+ "F0s3py": ["fab39iv", "fipwscc"]
284
159
  }
285
160
  }, {
286
- "d": [".fk73vx1{opacity:0;}", ".f1euv43f{position:absolute;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1sdsnyy{touch-action:none;}", ".f1aehjj5{pointer-events:none;}"]
161
+ "d": [".f1ewtqcl{box-sizing:border-box;}", ".f1k6fduh{cursor:pointer;}", ".f1l02sjl{height:100%;}", ".f1vgc2s3{left:0;}", ".f1e31b4d{right:0;}", ".f1hu3pq6{margin-top:0;}", ".f11qmguv{margin-right:0;}", ".f1tyq0we{margin-left:0;}", ".f19f4twv{margin-bottom:0;}", ".fk73vx1{opacity:0;}", ".f1euv43f{position:absolute;}", ".f15twtuk{top:0;}", ".fly5x3f{width:100%;}", ".f1owqbgs:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(22px);-moz-transform:translateX(22px);-ms-transform:translateX(22px);transform:translateX(22px);}", ".f1a7g3i4:checked~.fui-Switch__indicator>*{-webkit-transform:translateX(-22px);-moz-transform:translateX(-22px);-ms-transform:translateX(-22px);transform:translateX(-22px);}", ".fvxnmui:disabled{cursor:default;}", ".f1cxq9o1:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}", ".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);}", ".fft44l1:enabled:checked~.fui-Switch__indicator{background-color:var(--colorBrandBackground);}", ".fwlrvmy:enabled:checked~.fui-Switch__indicator{color:var(--colorNeutralForegroundOnBrand);}", ".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);}", ".f1vk2knj:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorBrandBackgroundHover);}", ".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);}", ".f1rt7qcq:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorBrandBackgroundPressed);}", ".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);}"]
162
+ });
163
+
164
+ const useLabelStyles = /*#__PURE__*/__styles({
165
+ "base": {
166
+ "famaaq": "f1xqy1su"
167
+ }
168
+ }, {
169
+ "d": [".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"]
287
170
  });
288
171
  /**
289
172
  * Apply styling to the Switch slots based on the state
@@ -291,22 +174,21 @@ const useInputStyle = /*#__PURE__*/__styles({
291
174
 
292
175
 
293
176
  export const useSwitchStyles_unstable = state => {
294
- const {
295
- checked,
296
- disabled
297
- } = state.input;
298
177
  const rootStyles = useRootStyles();
299
- const trackStyles = useTrackStyles();
300
- const thumbWrapperStyles = useThumbWrapperStyles();
301
- const thumbStyles = useThumbStyles();
302
- const activeRailStyles = useActiveRailStyles();
303
- const inputStyles = useInputStyle();
304
- state.root.className = mergeClasses(switchClassName + (checked ? ' checked' : ''), rootStyles.root, rootStyles.focusIndicator, !disabled && rootStyles.checked, !disabled && rootStyles.unchecked, disabled ? rootStyles.disabled : rootStyles.enabled, state.root.className);
305
- state.track.className = mergeClasses(trackClassName, trackStyles.track, !disabled && trackStyles.checked, !disabled && trackStyles.unchecked, disabled && trackStyles.disabledChecked, disabled && trackStyles.disabledUnchecked, state.track.className);
306
- state.thumbWrapper.className = mergeClasses(thumbWrapperStyles.thumbWrapper, state.thumbWrapper.className);
307
- state.thumb.className = mergeClasses(thumbClassName, thumbStyles.thumb, !disabled && thumbStyles.checked, !disabled && thumbStyles.unchecked, disabled && thumbStyles.disabledChecked, disabled && thumbStyles.disabledUnchecked, state.thumb.className);
308
- state.activeRail.className = mergeClasses(activeRailStyles.activeRail, state.activeRail.className);
309
- state.input.className = mergeClasses(inputStyles.input, state.input.className);
178
+ const indicatorStyles = useIndicatorStyles();
179
+ const inputStyles = useInputStyles();
180
+ const labelStyles = useLabelStyles();
181
+ const {
182
+ labelPosition
183
+ } = state;
184
+ state.root.className = mergeClasses(switchClassNames.root, rootStyles.base, rootStyles[labelPosition], state.root.className);
185
+ state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorStyles.base, state.indicator.className);
186
+ state.input.className = mergeClasses(switchClassNames.input, inputStyles.base, state.input.className);
187
+
188
+ if (state.label) {
189
+ state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, state.label.className);
190
+ }
191
+
310
192
  return state;
311
193
  };
312
194
  //# sourceMappingURL=useSwitchStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Switch/useSwitchStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,MAAT,QAA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AAyB,WAAW,CAAC,IAArC,EAA2C,KAAK,CAAC,KAAN,CAAY,SAAvD,CAApC;AACD;;AAED,SAAO,KAAP;AACD,CAxBM","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// TODO temporary export to pass conformance test.\nexport const switchClassName = switchClassNames.root;\n\n// TODO replace these spacing constants with theme values once they're on the theme.\nconst spacingXS = 4;\nconst spacingS = 8;\nconst spacingM = 12;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst thumbSize = 14;\nconst trackHeight = 20;\nconst trackWidth = 40;\n\nconst useRootStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n columnGap: `${spacingM}px`,\n display: 'inline-flex',\n ...shorthands.padding(`${spacingS}px`),\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n },\n\n // Label position variations\n above: {\n flexDirection: 'column',\n paddingTop: `${spacingXS}px`,\n rowGap: `${spacingXS}px`,\n },\n after: {\n alignItems: 'flex-start',\n columnGap: `${spacingM}px`,\n flexDirection: 'row',\n },\n before: {\n alignItems: 'flex-start',\n columnGap: `${spacingM}px`,\n flexDirection: 'row',\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n base: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth('1px'),\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize + spaceBetweenThumbAndTrack}px`,\n height: `${trackHeight}px`,\n pointerEvents: 'none',\n transitionDuration: '200ms',\n transitionTimingFunction: 'cubic-bezier(0.33, 0, 0.67, 1)',\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '> *': {\n transitionDuration: '200ms',\n transitionTimingFunction: 'cubic-bezier(0.33, 0, 0.67, 1)',\n transitionProperty: 'transform',\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n left: 0,\n ...shorthands.margin(0),\n opacity: 0,\n position: 'absolute',\n top: 0,\n width: '100%',\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack * 2}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 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.colorBrandBackground,\n color: tokens.colorNeutralForegroundOnBrand,\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorBrandBackgroundPressed,\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\nconst useLabelStyles = makeStyles({\n base: {\n userSelect: 'none',\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 { labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootStyles.base,\n rootStyles[labelPosition],\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorStyles.base, state.indicator.className);\n\n state.input.className = mergeClasses(switchClassNames.input, inputStyles.base, state.input.className);\n\n if (state.label) {\n state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, state.label.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC","sourcesContent":["export {};\nexport * from './Switch';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Switch.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["Switch.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Switch/index';\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,6 @@
1
1
  import type { SwitchProps } from './Switch.types';
2
2
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
3
  /**
4
- * The Switch control enables users to trigger an option on or off through pressing on the component.
4
+ * Switches enable users to trigger an option on or off through pressing the component.
5
5
  */
6
6
  export declare const Switch: ForwardRefComponent<SwitchProps>;
@@ -13,7 +13,7 @@ const renderSwitch_1 = /*#__PURE__*/require("./renderSwitch");
13
13
 
14
14
  const useSwitchStyles_1 = /*#__PURE__*/require("./useSwitchStyles");
15
15
  /**
16
- * The Switch control enables users to trigger an option on or off through pressing on the component.
16
+ * Switches enable users to trigger an option on or off through pressing the component.
17
17
  */
18
18
 
19
19
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;AAEA,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CANuD,CAA3C;AAQb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Switch/Switch.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;AAEA,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP;AACD,CANuD,CAA3C;AAQb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { useSwitch_unstable } from './useSwitch';\nimport { renderSwitch_unstable } from './renderSwitch';\nimport { useSwitchStyles_unstable } from './useSwitchStyles';\nimport type { SwitchProps } from './Switch.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Switches enable users to trigger an option on or off through pressing the component.\n */\nexport const Switch: ForwardRefComponent<SwitchProps> = React.forwardRef((props, ref) => {\n const state = useSwitch_unstable(props, ref);\n\n useSwitchStyles_unstable(state);\n\n return renderSwitch_unstable(state);\n});\n\nSwitch.displayName = 'Switch';\n"],"sourceRoot":"../src/"}