@fluentui/react-switch 9.0.0-rc.3 → 9.0.0-rc.6
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 +168 -1
- package/CHANGELOG.md +47 -2
- package/MIGRATION.md +89 -22
- package/Spec.md +179 -84
- package/dist/react-switch.d.ts +59 -40
- package/lib/components/Switch/Switch.d.ts +1 -1
- package/lib/components/Switch/Switch.js +1 -1
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Switch/Switch.types.d.ts +41 -35
- package/lib/components/Switch/Switch.types.js.map +1 -1
- package/lib/components/Switch/renderSwitch.d.ts +1 -1
- package/lib/components/Switch/renderSwitch.js +8 -6
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.d.ts +8 -2
- package/lib/components/Switch/useSwitch.js +63 -43
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitchStyles.d.ts +7 -2
- package/lib/components/Switch/useSwitchStyles.js +165 -266
- package/lib/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.d.ts +1 -1
- package/lib-commonjs/components/Switch/Switch.js +1 -1
- package/lib-commonjs/components/Switch/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.types.d.ts +41 -35
- package/lib-commonjs/components/Switch/renderSwitch.d.ts +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js +8 -6
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.d.ts +8 -2
- package/lib-commonjs/components/Switch/useSwitch.js +65 -43
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +7 -2
- package/lib-commonjs/components/Switch/useSwitchStyles.js +167 -268
- package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -2
- package/lib-commonjs/index.js +39 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +16 -17
- package/lib/components/Switch/useSwitchState.d.ts +0 -2
- package/lib/components/Switch/useSwitchState.js +0 -144
- package/lib/components/Switch/useSwitchState.js.map +0 -1
- package/lib-commonjs/components/Switch/useSwitchState.d.ts +0 -2
- package/lib-commonjs/components/Switch/useSwitchState.js +0 -156
- package/lib-commonjs/components/Switch/useSwitchState.js.map +0 -1
@@ -3,297 +3,197 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useSwitchStyles_unstable = exports.switchClassName = void 0;
|
7
|
-
|
8
|
-
const react_1 = /*#__PURE__*/require("@griffel/react");
|
6
|
+
exports.useSwitchStyles_unstable = exports.switchClassName = exports.switchClassNames = void 0;
|
9
7
|
|
10
8
|
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
11
9
|
|
12
10
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
13
|
+
|
14
|
+
exports.switchClassNames = {
|
15
|
+
root: 'fui-Switch',
|
16
|
+
indicator: 'fui-Switch__indicator',
|
17
|
+
input: 'fui-Switch__input',
|
18
|
+
label: 'fui-Switch__label'
|
19
|
+
};
|
17
20
|
/**
|
18
|
-
*
|
21
|
+
* @deprecated Use `switchClassNames.root` instead.
|
19
22
|
*/
|
20
23
|
|
24
|
+
exports.switchClassName = exports.switchClassNames.root; // TODO replace these spacing constants with theme values once they're on the theme.
|
25
|
+
|
26
|
+
const spacingXS = 4;
|
27
|
+
const spacingS = 8;
|
28
|
+
const spacingM = 12; // Thumb and track sizes used by the component.
|
29
|
+
|
30
|
+
const spaceBetweenThumbAndTrack = 2;
|
31
|
+
const thumbSize = 14;
|
32
|
+
const trackHeight = 20;
|
33
|
+
const trackWidth = 40;
|
34
|
+
|
21
35
|
const useRootStyles = /*#__PURE__*/react_1.__styles({
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
36
|
+
"base": {
|
37
|
+
"B7ck84d": "f1ewtqcl",
|
38
|
+
"i8kkvl": "f4akndk",
|
39
|
+
"mc9l5x": "ftuwxu6",
|
40
|
+
"z8tnut": "fp9bwmr",
|
41
|
+
"z189sj": ["f19lj068", "f177v4lu"],
|
42
|
+
"Byoj8tv": "f150uoa4",
|
43
|
+
"uwmqm3": ["f177v4lu", "f19lj068"],
|
28
44
|
"qhf8xq": "f10pi13n",
|
29
|
-
"a9b677": "fnceurk",
|
30
|
-
"Bqenvij": "f15da5dy",
|
31
|
-
"mc9l5x": "f14t3ns0",
|
32
|
-
"famaaq": "f1xqy1su",
|
33
|
-
"lpbzjs": "f1sdsnyy",
|
34
|
-
"ha4doy": "f1qdqbpl"
|
35
|
-
},
|
36
|
-
"unchecked": {
|
37
|
-
"d48c0s": "frinyyk",
|
38
|
-
"Bc6qnd8": "f1g8lwx2"
|
39
|
-
},
|
40
|
-
"checked": {
|
41
|
-
"Banj4pq": "fpfyfb6",
|
42
|
-
"Brktkwq": "f3vtzeg"
|
43
|
-
},
|
44
|
-
"enabled": {
|
45
|
-
"H36rlo": "felqjlh",
|
46
|
-
"Bceei9c": "f1k6fduh"
|
47
|
-
},
|
48
|
-
"disabled": {
|
49
|
-
"Bceei9c": "fdrzuqr",
|
50
|
-
"Bkecrkj": "f1aehjj5"
|
51
|
-
},
|
52
|
-
"focusIndicator": {
|
53
45
|
"B486eqv": "f2hkw1w",
|
54
|
-
"
|
46
|
+
"vchsgm": "fbiesyy",
|
47
|
+
"ozrjjd": ["fq2kn9", "f1jxwnad"],
|
48
|
+
"B7lelfh": "f1il7mou",
|
49
|
+
"Bp3tz3o": ["f1jxwnad", "fq2kn9"],
|
55
50
|
"B8vm7ur": "f12sql3b",
|
56
51
|
"f4hv8x": "f1i4q40k",
|
57
52
|
"Gpan81": "fcrbge9",
|
58
|
-
"z7afg": "ft464mn",
|
59
53
|
"rsjj6t": "fskqmiq",
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
const useTrackStyles = /*#__PURE__*/react_1.__styles({
|
81
|
-
"track": {
|
82
|
-
"qhf8xq": "f1euv43f",
|
83
|
-
"a9b677": "fly5x3f",
|
84
|
-
"Bqenvij": "f1l02sjl",
|
85
|
-
"Bmy1vo4": "fmslzlq",
|
86
|
-
"B3o57yi": "f15vu5tu",
|
87
|
-
"Bkqvd7p": "f1e1a42z",
|
88
|
-
"lpbzjs": "f1sdsnyy",
|
89
|
-
"Bkecrkj": "f1aehjj5",
|
90
|
-
"xx9plb": "fxf9f1y",
|
91
|
-
"Bf8kmfk": "frdto5n",
|
92
|
-
"Byque4d": ["f8g0ba1", "ff0gctb"],
|
93
|
-
"Bj2wrql": "f3zr33r",
|
94
|
-
"qd6xl9": ["ff0gctb", "f8g0ba1"],
|
95
|
-
"Bmqnesq": "f170vdtw",
|
96
|
-
"px8gyy": ["f7lyffi", "fmk9c8u"],
|
97
|
-
"B5c9fhp": ["fmk9c8u", "f7lyffi"],
|
98
|
-
"Bhe99jt": ["f1nat4im", "fw5qzmy"],
|
99
|
-
"B2r1szc": ["fw5qzmy", "f1nat4im"],
|
100
|
-
"rurcny": "f99sooz",
|
101
|
-
"ngabwx": "f1uhpfti",
|
102
|
-
"Hdbjpj": "f11ef69",
|
103
|
-
"u6d25": "f1yuyem3",
|
104
|
-
"jc51t6": ["f1bp8q63", "f1oarbwq"],
|
105
|
-
"Bj55yzk": "f13gddrr",
|
106
|
-
"cnmfks": ["f1oarbwq", "f1bp8q63"],
|
107
|
-
"oqd9ik": "ffdc0f3",
|
108
|
-
"frdscb": ["f1xuwyw0", "f12j4hro"],
|
109
|
-
"B9nohqn": ["f12j4hro", "f1xuwyw0"],
|
110
|
-
"B1dhsta": ["f1mf29j", "f1nzm45q"],
|
111
|
-
"Bjdmjzx": ["f1nzm45q", "f1mf29j"],
|
112
|
-
"Bs6t6z0": "f77y9vx",
|
113
|
-
"Bmyypfa": "frd86tk"
|
114
|
-
},
|
115
|
-
"unchecked": {
|
116
|
-
"dj0dih": "f199l62q",
|
117
|
-
"D4ky5z": ["f1pa2qi2", "f1ooiv2t"],
|
118
|
-
"k1i1uq": "fyqop9u",
|
119
|
-
"Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
|
120
|
-
"Bdixowu": "f1bwkb58",
|
121
|
-
"cqycoz": ["fiio4mc", "fc8z0qo"],
|
122
|
-
"Epwjcz": "f1m5ya7j",
|
123
|
-
"Bwdktmn": ["fc8z0qo", "fiio4mc"],
|
124
|
-
"ijj6k": "f1gqzwee",
|
125
|
-
"I89eb": ["f149mt9j", "fs3bzhx"],
|
126
|
-
"Bp1vogq": "f14z72z2",
|
127
|
-
"Bohd3ja": ["fs3bzhx", "f149mt9j"],
|
128
|
-
"B1dvbpk": "f1k1dzc6"
|
54
|
+
"E86f5s": "f1kbdjx9",
|
55
|
+
"f5nhos": ["fw1d893", "fpuz8dn"],
|
56
|
+
"Bhtq6h7": "f14hlsw1",
|
57
|
+
"Bubk9yy": ["fpuz8dn", "fw1d893"],
|
58
|
+
"dzajus": "f1bkt4b4",
|
59
|
+
"B8gmrwi": ["f16hf5f2", "f1qhqcal"],
|
60
|
+
"Byq6oy9": "fyyqeim",
|
61
|
+
"Bdy2j38": ["f1qhqcal", "f16hf5f2"],
|
62
|
+
"Bi8bqab": ["f1aneyfs", "f15nmyc0"],
|
63
|
+
"kq6z4e": ["f15nmyc0", "f1aneyfs"],
|
64
|
+
"l5tc3q": ["f3cpy5b", "f13v6kgv"],
|
65
|
+
"d1z3ck": ["f13v6kgv", "f3cpy5b"],
|
66
|
+
"epcuuz": "filx0we",
|
67
|
+
"Ba33l6n": ["f1horip2", "fgnx9ah"],
|
68
|
+
"va7z1g": "fkii2tb",
|
69
|
+
"Bmi6mq9": ["fgnx9ah", "f1horip2"],
|
70
|
+
"Bjkpy09": "f1unftzx",
|
71
|
+
"Jxg1p8": "f8rjbh6",
|
72
|
+
"Bc94xmo": ["fxfgh6q", "f8l10fm"],
|
73
|
+
"Bj23z95": ["f8l10fm", "fxfgh6q"]
|
129
74
|
},
|
130
|
-
"
|
131
|
-
"
|
132
|
-
"
|
133
|
-
"
|
134
|
-
"J4s2b0": "f124kgxn",
|
135
|
-
"svcy3r": ["f1wf3et7", "f1faxgr0"]
|
75
|
+
"above": {
|
76
|
+
"Beiy3e4": "f1vx9l62",
|
77
|
+
"z8tnut": "f10ra9hq",
|
78
|
+
"Belr9w4": "f1ma2n7n"
|
136
79
|
},
|
137
|
-
"
|
138
|
-
"
|
139
|
-
"
|
140
|
-
"
|
141
|
-
"Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
|
142
|
-
"Bdixowu": "f1bwkb58",
|
143
|
-
"cqycoz": ["fiio4mc", "fc8z0qo"],
|
144
|
-
"Epwjcz": "f1m5ya7j",
|
145
|
-
"Bwdktmn": ["fc8z0qo", "fiio4mc"],
|
146
|
-
"ijj6k": "fntj282",
|
147
|
-
"I89eb": ["fzta9nb", "f17m9iy5"],
|
148
|
-
"Bp1vogq": "f1k4exvn",
|
149
|
-
"Bohd3ja": ["f17m9iy5", "fzta9nb"]
|
80
|
+
"after": {
|
81
|
+
"Bt984gj": "f6jr5hl",
|
82
|
+
"i8kkvl": "f4akndk",
|
83
|
+
"Beiy3e4": "f1063pyq"
|
150
84
|
},
|
151
|
-
"
|
152
|
-
"
|
153
|
-
"
|
154
|
-
"
|
155
|
-
"exdlgl": ["f1q1uvzd", "f1jvubu3"],
|
156
|
-
"rskduk": "f1iq3fds",
|
157
|
-
"Dctjco": ["f1r2jemi", "f11olovk"],
|
158
|
-
"J4s2b0": "fd0py6g",
|
159
|
-
"svcy3r": ["f11olovk", "f1r2jemi"],
|
160
|
-
"F7kzw7": "f2uxs13",
|
161
|
-
"B13j16c": ["f11zx3qq", "fqewq1t"],
|
162
|
-
"Bk8j60v": "fmewjpk",
|
163
|
-
"Bpbi4o9": ["fqewq1t", "f11zx3qq"],
|
164
|
-
"Bkbwdz4": "f132yvl5"
|
85
|
+
"before": {
|
86
|
+
"Bt984gj": "f6jr5hl",
|
87
|
+
"i8kkvl": "f4akndk",
|
88
|
+
"Beiy3e4": "f1063pyq"
|
165
89
|
}
|
166
90
|
}, {
|
167
|
-
"d": [".
|
91
|
+
"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] .fbiesyy:focus-within{border-top-color:transparent;}", "[data-keyboard-nav] .fq2kn9:focus-within{border-right-color:transparent;}", "[data-keyboard-nav] .f1jxwnad:focus-within{border-left-color:transparent;}", "[data-keyboard-nav] .f1il7mou:focus-within{border-bottom-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] .fskqmiq:focus-within:after{z-index:1;}", "[data-keyboard-nav] .f1kbdjx9:focus-within:after{border-top-style:solid;}", "[data-keyboard-nav] .fw1d893:focus-within:after{border-right-style:solid;}", "[data-keyboard-nav] .fpuz8dn:focus-within:after{border-left-style:solid;}", "[data-keyboard-nav] .f14hlsw1:focus-within:after{border-bottom-style:solid;}", "[data-keyboard-nav] .f1bkt4b4:focus-within:after{border-top-width:2px;}", "[data-keyboard-nav] .f16hf5f2:focus-within:after{border-right-width:2px;}", "[data-keyboard-nav] .f1qhqcal:focus-within:after{border-left-width:2px;}", "[data-keyboard-nav] .fyyqeim:focus-within:after{border-bottom-width:2px;}", "[data-keyboard-nav] .f1aneyfs:focus-within:after{border-bottom-right-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f15nmyc0:focus-within:after{border-bottom-left-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f3cpy5b:focus-within:after{border-top-right-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .f13v6kgv:focus-within:after{border-top-left-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .filx0we:focus-within:after{border-top-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1horip2:focus-within:after{border-right-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fgnx9ah:focus-within:after{border-left-color:var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fkii2tb:focus-within:after{border-bottom-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;}"],
|
92
|
+
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
168
93
|
});
|
169
|
-
/**
|
170
|
-
* Styles for the thumb wrapper slot
|
171
|
-
*/
|
172
|
-
|
173
94
|
|
174
|
-
const
|
175
|
-
"
|
176
|
-
"qhf8xq": "f1euv43f",
|
177
|
-
"Bhzewxz": "f15twtuk",
|
178
|
-
"B5kzvoi": "f1yab3r1",
|
179
|
-
"oyh7mz": ["fhpx7ww", "f1kctpth"],
|
180
|
-
"j35jbq": ["f1kctpth", "fhpx7ww"],
|
181
|
-
"lpbzjs": "f1sdsnyy",
|
182
|
-
"Bkecrkj": "f1aehjj5"
|
183
|
-
}
|
184
|
-
}, {
|
185
|
-
"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;}"]
|
186
|
-
});
|
187
|
-
/**
|
188
|
-
* Styles for the thumb slot
|
189
|
-
*/
|
190
|
-
|
191
|
-
|
192
|
-
const useThumbStyles = /*#__PURE__*/react_1.__styles({
|
193
|
-
"thumb": {
|
194
|
-
"qhf8xq": "f1euv43f",
|
195
|
-
"a9b677": "fcjrtee",
|
196
|
-
"Bqenvij": "fili5n9",
|
197
|
-
"B7ck84d": "f1ewtqcl",
|
95
|
+
const useIndicatorStyles = /*#__PURE__*/react_1.__styles({
|
96
|
+
"base": {
|
198
97
|
"Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
|
199
98
|
"Beyfa6y": ["f1nfllo7", "f8fbkgy"],
|
200
99
|
"B7oj6ja": ["f1djnp8u", "f1s8kh49"],
|
201
100
|
"Btl43ni": ["f1s8kh49", "f1djnp8u"],
|
202
|
-
"
|
203
|
-
"
|
204
|
-
"
|
205
|
-
"
|
206
|
-
"
|
207
|
-
"
|
101
|
+
"icvyot": "fzkkow9",
|
102
|
+
"vrafjx": ["fcdblym", "fjik90z"],
|
103
|
+
"oivjwe": "fg706s2",
|
104
|
+
"wvpqe5": ["fjik90z", "fcdblym"],
|
105
|
+
"B4j52fo": "f5ogflp",
|
106
|
+
"Bekrc4i": ["f1hqa2wf", "finvdd3"],
|
107
|
+
"Bn0qgzm": "f1f09k3d",
|
108
|
+
"ibv6hh": ["finvdd3", "f1hqa2wf"],
|
109
|
+
"B7ck84d": "f1ewtqcl",
|
110
|
+
"Bkfmm31": "f1w9h62z",
|
111
|
+
"Bnnss6s": "fi64zpg",
|
112
|
+
"Be2twd7": "f4ybsrx",
|
113
|
+
"Bqenvij": "fjamq6b",
|
208
114
|
"Bkecrkj": "f1aehjj5",
|
209
|
-
"
|
210
|
-
"
|
211
|
-
"
|
212
|
-
"
|
213
|
-
"
|
214
|
-
"
|
215
|
-
"
|
216
|
-
"Bhe99jt": ["fiow2ne", "f13lz1i8"],
|
217
|
-
"B2r1szc": ["f13lz1i8", "fiow2ne"],
|
218
|
-
"rurcny": "f99sooz",
|
219
|
-
"ngabwx": "f1uhpfti",
|
220
|
-
"Hdbjpj": "f11ef69",
|
221
|
-
"u6d25": "f1yuyem3",
|
222
|
-
"jc51t6": ["f1bp8q63", "f1oarbwq"],
|
223
|
-
"Bj55yzk": "f13gddrr",
|
224
|
-
"cnmfks": ["f1oarbwq", "f1bp8q63"],
|
225
|
-
"frdscb": ["fc4gh2t", "flndy84"],
|
226
|
-
"B9nohqn": ["flndy84", "fc4gh2t"],
|
227
|
-
"B1dhsta": ["fxgx2h0", "fh20ihy"],
|
228
|
-
"Bjdmjzx": ["fh20ihy", "fxgx2h0"],
|
229
|
-
"Bs6t6z0": "f77y9vx",
|
230
|
-
"Bmyypfa": "frd86tk"
|
231
|
-
},
|
232
|
-
"unchecked": {
|
233
|
-
"B1dvbpk": "f1n7m28n"
|
234
|
-
},
|
235
|
-
"checked": {
|
236
|
-
"Bkbwdz4": "f1261hx1"
|
237
|
-
},
|
238
|
-
"disabledUnchecked": {
|
239
|
-
"dj0dih": "f199l62q",
|
240
|
-
"D4ky5z": ["f1pa2qi2", "f1ooiv2t"],
|
241
|
-
"k1i1uq": "fyqop9u",
|
242
|
-
"Bcasopp": ["f1ooiv2t", "f1pa2qi2"],
|
243
|
-
"Bdixowu": "f1bwkb58",
|
244
|
-
"cqycoz": ["fiio4mc", "fc8z0qo"],
|
245
|
-
"Epwjcz": "f1m5ya7j",
|
246
|
-
"Bwdktmn": ["fc8z0qo", "fiio4mc"],
|
247
|
-
"ijj6k": "f1k21dld",
|
248
|
-
"I89eb": ["f1yueqd5", "f16ep8jm"],
|
249
|
-
"Bp1vogq": "flh92r5",
|
250
|
-
"Bohd3ja": ["f16ep8jm", "f1yueqd5"],
|
251
|
-
"B1dvbpk": "fj528n6"
|
252
|
-
},
|
253
|
-
"disabledChecked": {
|
254
|
-
"Bkbwdz4": "f18jltdj"
|
255
|
-
}
|
256
|
-
}, {
|
257
|
-
"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);}"]
|
258
|
-
});
|
259
|
-
/**
|
260
|
-
* Styles for the activeRail slot
|
261
|
-
*/
|
262
|
-
|
263
|
-
|
264
|
-
const useActiveRailStyles = /*#__PURE__*/react_1.__styles({
|
265
|
-
"activeRail": {
|
266
|
-
"qhf8xq": "f1euv43f",
|
267
|
-
"oyh7mz": ["fhpx7ww", "f1kctpth"],
|
268
|
-
"j35jbq": ["f1kctpth", "fhpx7ww"]
|
115
|
+
"B3o57yi": "f1bnoopa",
|
116
|
+
"Bkqvd7p": "f1e1a42z",
|
117
|
+
"Bmy1vo4": "fo99fu7",
|
118
|
+
"a9b677": "feqmc2u",
|
119
|
+
"Hkqiji": "f1wkgtgk",
|
120
|
+
"Bgrs90m": "f17f8g0y",
|
121
|
+
"B0zx559": "f1uwej41"
|
269
122
|
}
|
270
123
|
}, {
|
271
|
-
"d": [".
|
124
|
+
"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;}"]
|
272
125
|
});
|
273
|
-
/**
|
274
|
-
* Styles for the hidden input slot
|
275
|
-
*/
|
276
|
-
|
277
126
|
|
278
|
-
const
|
279
|
-
"
|
280
|
-
"
|
281
|
-
"
|
282
|
-
"
|
283
|
-
"
|
284
|
-
"Byoj8tv": "f1qch9an",
|
285
|
-
"uwmqm3": ["f1cnd47f", "fhxju0i"],
|
127
|
+
const useInputStyles = /*#__PURE__*/react_1.__styles({
|
128
|
+
"base": {
|
129
|
+
"B7ck84d": "f1ewtqcl",
|
130
|
+
"Bceei9c": "f1k6fduh",
|
131
|
+
"Bqenvij": "f1l02sjl",
|
132
|
+
"oyh7mz": ["f1vgc2s3", "f1e31b4d"],
|
286
133
|
"B6of3ja": "f1hu3pq6",
|
287
134
|
"t21cq0": ["f11qmguv", "f1tyq0we"],
|
288
135
|
"jrapky": "f19f4twv",
|
289
136
|
"Frg6f3": ["f1tyq0we", "f11qmguv"],
|
137
|
+
"abs64n": "fk73vx1",
|
138
|
+
"qhf8xq": "f1euv43f",
|
139
|
+
"Bhzewxz": "f15twtuk",
|
290
140
|
"a9b677": "fly5x3f",
|
291
|
-
"
|
292
|
-
"
|
293
|
-
"
|
141
|
+
"fv8x6k": ["f1owqbgs", "f1a7g3i4"],
|
142
|
+
"ezr58z": "fvxnmui",
|
143
|
+
"Blezdol": "f1cxq9o1",
|
144
|
+
"B8f96ig": "f1ks1zsm",
|
145
|
+
"po7uxr": "fiqfi0i",
|
146
|
+
"inq7wv": "f9aagkg",
|
147
|
+
"Cdugon": ["fgv8l18", "f1p3jmxb"],
|
148
|
+
"ptsei1": "f11yi64e",
|
149
|
+
"bl04ud": ["f1p3jmxb", "fgv8l18"],
|
150
|
+
"Bu7dm46": "fthrly9",
|
151
|
+
"Gwwlnz": "fhdp2ht",
|
152
|
+
"wb1her": "f1rzj6jj",
|
153
|
+
"Bmieemq": ["f1jywl1l", "f13d626x"],
|
154
|
+
"Bdgjgzg": "f1ivtmze",
|
155
|
+
"B05cvx7": ["f13d626x", "f1jywl1l"],
|
156
|
+
"Bx4eqiv": "f1uvnr57",
|
157
|
+
"xhnoxe": "frhcydi",
|
158
|
+
"Hnmc4c": ["f1pvt3n7", "f14i0clv"],
|
159
|
+
"By8gkvz": "fq9gcw4",
|
160
|
+
"lekrm4": ["f14i0clv", "f1pvt3n7"],
|
161
|
+
"Bei91sp": "fft44l1",
|
162
|
+
"Bksztz9": "fwlrvmy",
|
163
|
+
"h3gz1v": "f1c4gun2",
|
164
|
+
"Cw6427": ["flhgtcm", "fx1zdd8"],
|
165
|
+
"Bpbd9g9": "fayrp2e",
|
166
|
+
"ssulyh": ["fx1zdd8", "flhgtcm"],
|
167
|
+
"vq7rp1": "f1vk2knj",
|
168
|
+
"ynrfiu": "firogjh",
|
169
|
+
"Bf5tpyt": ["f1crd6p1", "for8100"],
|
170
|
+
"Brhic7g": "f1v5j4zb",
|
171
|
+
"Cqvc5u": ["for8100", "f1crd6p1"],
|
172
|
+
"B4e80u0": "f1rt7qcq",
|
173
|
+
"Bwj41i9": "fxvotg6",
|
174
|
+
"B2iiaa1": ["fk9ur30", "f3u5smv"],
|
175
|
+
"Bejmxmv": "fdtj07x",
|
176
|
+
"rqauf5": ["f3u5smv", "fk9ur30"],
|
177
|
+
"wo5z87": "fv5mb1o",
|
178
|
+
"B50joxe": ["f1i2l8ou", "fxj1kmv"],
|
179
|
+
"Bmuizf1": "fku528b",
|
180
|
+
"f4urji": ["fxj1kmv", "f1i2l8ou"],
|
181
|
+
"Bxiq1ly": "fabcpc0",
|
182
|
+
"vbmdq8": "f17xwy6w",
|
183
|
+
"u4vbwo": ["fipwscc", "fab39iv"],
|
184
|
+
"Bfjga03": "f1th5z1l",
|
185
|
+
"F0s3py": ["fab39iv", "fipwscc"]
|
186
|
+
}
|
187
|
+
}, {
|
188
|
+
"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);}"]
|
189
|
+
});
|
190
|
+
|
191
|
+
const useLabelStyles = /*#__PURE__*/react_1.__styles({
|
192
|
+
"base": {
|
193
|
+
"famaaq": "f1xqy1su"
|
294
194
|
}
|
295
195
|
}, {
|
296
|
-
"d": [".
|
196
|
+
"d": [".f1xqy1su{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"]
|
297
197
|
});
|
298
198
|
/**
|
299
199
|
* Apply styling to the Switch slots based on the state
|
@@ -301,22 +201,21 @@ const useInputStyle = /*#__PURE__*/react_1.__styles({
|
|
301
201
|
|
302
202
|
|
303
203
|
const useSwitchStyles_unstable = state => {
|
304
|
-
const {
|
305
|
-
checked,
|
306
|
-
disabled
|
307
|
-
} = state.input;
|
308
204
|
const rootStyles = useRootStyles();
|
309
|
-
const
|
310
|
-
const
|
311
|
-
const
|
312
|
-
const
|
313
|
-
|
314
|
-
|
315
|
-
state.
|
316
|
-
state.
|
317
|
-
state.
|
318
|
-
|
319
|
-
|
205
|
+
const indicatorStyles = useIndicatorStyles();
|
206
|
+
const inputStyles = useInputStyles();
|
207
|
+
const labelStyles = useLabelStyles();
|
208
|
+
const {
|
209
|
+
labelPosition
|
210
|
+
} = state;
|
211
|
+
state.root.className = react_1.mergeClasses(exports.switchClassNames.root, rootStyles.base, rootStyles[labelPosition], state.root.className);
|
212
|
+
state.indicator.className = react_1.mergeClasses(exports.switchClassNames.indicator, indicatorStyles.base, state.indicator.className);
|
213
|
+
state.input.className = react_1.mergeClasses(exports.switchClassNames.input, inputStyles.base, state.input.className);
|
214
|
+
|
215
|
+
if (state.label) {
|
216
|
+
state.label.className = react_1.mergeClasses(exports.switchClassNames.label, labelStyles.base, state.label.className);
|
217
|
+
}
|
218
|
+
|
320
219
|
return state;
|
321
220
|
};
|
322
221
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Switch/useSwitchStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAGa,OAAA,CAAA,eAAA,GAAkB,YAAlB;AACb,MAAM,cAAc,GAAG,GAAG,OAAA,CAAA,eAAe,QAAzC;AACA,MAAM,cAAc,GAAG,GAAG,OAAA,CAAA,eAAe,QAAzC;AAEA;;AAEG;;AACH,MAAM,aAAa,gBAAG,OAAA,SAAA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\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SwitchState } from './Switch.types';\n\nexport const switchClassName = 'fui-Switch';\nconst trackClassName = `${switchClassName}-track`;\nconst thumbClassName = `${switchClassName}-thumb`;\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n '--switch-width': '40px',\n '--switch-height': '20px',\n '--switch-thumb-size': '14px',\n '--switch-checked-opacity': '0',\n '--switch-unchecked-opacity': '0',\n\n position: 'relative',\n width: 'var(--switch-width)',\n height: 'var(--switch-height)',\n display: 'inline-block',\n userSelect: 'none',\n touchAction: 'none',\n verticalAlign: 'bottom',\n },\n\n unchecked: {\n [`:hover .${thumbClassName}`]: {\n ':before': {\n backgroundColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n [`:hover .${trackClassName}`]: {\n ':before': {\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n },\n\n checked: {\n [`:hover .${trackClassName}`]: {\n ':after': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n },\n },\n\n [`:active .${trackClassName}`]: {\n ':after': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n },\n },\n },\n\n enabled: {\n '-webkit-tap-highlight-color': 'rgba(0,0,0,0)',\n cursor: 'pointer',\n },\n\n disabled: {\n cursor: 'not-allowed',\n pointerEvents: 'none',\n },\n\n focusIndicator: createFocusOutlineStyle({ selector: 'focus-within', style: { outlineOffset: '8px' } }),\n});\n\n/**\n * Styles for the track slot\n */\nconst useTrackStyles = makeStyles({\n track: {\n position: 'absolute',\n width: '100%',\n height: '100%',\n transitionProperty: 'backgroundColor',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'cubic-bezier(0.33, 0, 0.67, 1)',\n touchAction: 'none',\n pointerEvents: 'none',\n\n ':before': {\n position: 'absolute',\n top: '0px',\n left: '0px',\n bottom: '0px',\n right: '0px',\n boxSizing: 'border-box',\n ...shorthands.borderRadius('999px'),\n content: \"''\",\n opacity: 'var(--switch-unchecked-opacity)',\n },\n\n ':after': {\n position: 'absolute',\n top: '0px',\n left: '0px',\n bottom: '0px',\n right: '0px',\n boxSizing: 'border-box',\n ...shorthands.borderRadius('999px'),\n content: \"''\",\n opacity: 'var(--switch-checked-opacity)',\n },\n },\n\n unchecked: {\n ':before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStrokeAccessible),\n backgroundColor: 'transparent',\n },\n },\n\n checked: {\n ':after': {\n backgroundColor: tokens.colorBrandBackground,\n ...shorthands.borderStyle('none'),\n },\n },\n\n disabledUnchecked: {\n ':before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStrokeDisabled),\n },\n },\n\n disabledChecked: {\n ':after': {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStrokeDisabled),\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n },\n },\n});\n\n/**\n * Styles for the thumb wrapper slot\n */\nconst useThumbWrapperStyles = makeStyles({\n thumbWrapper: {\n position: 'absolute',\n top: '0',\n bottom: '0',\n left: 'calc(var(--switch-thumb-size) * .7)',\n right: 'calc(var(--switch-thumb-size) * .7)',\n touchAction: 'none',\n pointerEvents: 'none',\n },\n});\n\n/**\n * Styles for the thumb slot\n */\nconst useThumbStyles = makeStyles({\n thumb: {\n position: 'absolute',\n width: 'var(--switch-thumb-size)',\n height: 'var(--switch-thumb-size)',\n boxSizing: 'border-box',\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n top: '50%',\n transform: 'translate(-50%, -50%)',\n transitionProperty: 'backgroundColor',\n transitionDuration: '0.1s',\n transitionTimingFunction: 'cubic-bezier(0.33, 0, 0.67, 1)',\n touchAction: 'none',\n pointerEvents: 'none',\n\n ':before': {\n position: 'absolute',\n top: '0px',\n left: '0px',\n bottom: '0px',\n right: '0px',\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n content: \"''\",\n opacity: 'var(--switch-unchecked-opacity)',\n },\n\n ':after': {\n position: 'absolute',\n top: '0px',\n left: '0px',\n bottom: '0px',\n right: '0px',\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n content: \"''\",\n opacity: 'var(--switch-checked-opacity)',\n },\n },\n\n unchecked: {\n ':before': {\n backgroundColor: tokens.colorNeutralStrokeAccessible,\n },\n },\n\n checked: {\n ':after': {\n backgroundColor: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n disabledUnchecked: {\n ':before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralForegroundDisabled),\n backgroundColor: tokens.colorNeutralBackground1,\n },\n },\n\n disabledChecked: {\n ':after': {\n backgroundColor: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\n/**\n * Styles for the activeRail slot\n */\nconst useActiveRailStyles = makeStyles({\n activeRail: {\n position: 'absolute',\n left: 'calc(var(--switch-thumb-size) * .7)',\n right: 'calc(var(--switch-thumb-size) * .7)',\n },\n});\n\n/**\n * Styles for the hidden input slot\n */\nconst useInputStyle = makeStyles({\n input: {\n opacity: 0,\n position: 'absolute',\n ...shorthands.padding(0),\n ...shorthands.margin(0),\n width: '100%',\n height: '100%',\n touchAction: 'none',\n pointerEvents: '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 { checked, disabled } = state.input;\n\n const rootStyles = useRootStyles();\n const trackStyles = useTrackStyles();\n const thumbWrapperStyles = useThumbWrapperStyles();\n const thumbStyles = useThumbStyles();\n const activeRailStyles = useActiveRailStyles();\n const inputStyles = useInputStyle();\n\n state.root.className = mergeClasses(\n switchClassName + (checked ? ' checked' : ''),\n rootStyles.root,\n rootStyles.focusIndicator,\n !disabled && rootStyles.checked,\n !disabled && rootStyles.unchecked,\n disabled ? rootStyles.disabled : rootStyles.enabled,\n state.root.className,\n );\n\n state.track.className = mergeClasses(\n trackClassName,\n trackStyles.track,\n !disabled && trackStyles.checked,\n !disabled && trackStyles.unchecked,\n disabled && trackStyles.disabledChecked,\n disabled && trackStyles.disabledUnchecked,\n state.track.className,\n );\n\n state.thumbWrapper.className = mergeClasses(thumbWrapperStyles.thumbWrapper, state.thumbWrapper.className);\n\n state.thumb.className = mergeClasses(\n thumbClassName,\n thumbStyles.thumb,\n !disabled && thumbStyles.checked,\n !disabled && thumbStyles.unchecked,\n disabled && thumbStyles.disabledChecked,\n disabled && thumbStyles.disabledUnchecked,\n state.thumb.className,\n );\n\n state.activeRail.className = mergeClasses(activeRailStyles.activeRail, state.activeRail.className);\n\n state.input.className = mergeClasses(inputStyles.input, state.input.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["components/Switch/useSwitchStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,gBAAA,GAAgD;AAC3D,EAAA,IAAI,EAAE,YADqD;AAE3D,EAAA,SAAS,EAAE,uBAFgD;AAG3D,EAAA,KAAK,EAAE,mBAHoD;AAI3D,EAAA,KAAK,EAAE;AAJoD,CAAhD;AAOb;;AAEG;;AACU,OAAA,CAAA,eAAA,GAAkB,OAAA,CAAA,gBAAA,CAAiB,IAAnC,C,CAEb;;AACA,MAAM,SAAS,GAAG,CAAlB;AACA,MAAM,QAAQ,GAAG,CAAjB;AACA,MAAM,QAAQ,GAAG,EAAjB,C,CAEA;;AACA,MAAM,yBAAyB,GAAG,CAAlC;AACA,MAAM,SAAS,GAAG,EAAlB;AACA,MAAM,WAAW,GAAG,EAApB;AACA,MAAM,UAAU,GAAG,EAAnB;;AAEA,MAAM,aAAa,gBAAG,OAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,gBAAA,CAAiB,IADI,EAErB,UAAU,CAAC,IAFU,EAGrB,UAAU,CAAC,aAAD,CAHW,EAIrB,KAAK,CAAC,IAAN,CAAW,SAJU,CAAvB;AAOA,EAAA,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,gBAAA,CAAiB,SAA9B,EAAyC,eAAe,CAAC,IAAzD,EAA+D,KAAK,CAAC,SAAN,CAAgB,SAA/E,CAA5B;AAEA,EAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,gBAAA,CAAiB,KAA9B,EAAqC,WAAW,CAAC,IAAjD,EAAuD,KAAK,CAAC,KAAN,CAAY,SAAnE,CAAxB;;AAEA,MAAI,KAAK,CAAC,KAAV,EAAiB;AACf,IAAA,KAAK,CAAC,KAAN,CAAY,SAAZ,GAAwB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,gBAAA,CAAiB,KAA9B,EAAqC,WAAW,CAAC,IAAjD,EAAuD,KAAK,CAAC,KAAN,CAAY,SAAnE,CAAxB;AACD;;AAED,SAAO,KAAP;AACD,CAxBM;;AAAM,OAAA,CAAA,wBAAA,GAAwB,wBAAxB","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// 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-commonjs/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export {};
|
2
|
-
export
|
1
|
+
export { Switch, renderSwitch_unstable, switchClassName, switchClassNames, useSwitchStyles_unstable, useSwitch_unstable, } from './Switch';
|
2
|
+
export type { SwitchOnChangeData, SwitchProps, SwitchSlots, SwitchState } from './Switch';
|