@fluentui/react-switch 9.0.0-rc.9 → 9.0.0
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 +307 -1
- package/CHANGELOG.md +92 -2
- package/MIGRATION.md +1 -5
- package/README.md +20 -14
- package/Spec.md +2 -2
- package/dist/index.d.ts +19 -18
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Switch/Switch.types.js.map +1 -1
- package/lib/components/Switch/renderSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitch.js.map +1 -1
- package/lib/components/Switch/useSwitchStyles.js +64 -61
- package/lib/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/components/Switch/Switch.js.map +1 -1
- package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
- package/lib-commonjs/components/Switch/useSwitchStyles.js +64 -61
- package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -12
- package/lib/Switch.d.ts +0 -1
- package/lib/components/Switch/Switch.d.ts +0 -6
- package/lib/components/Switch/Switch.types.d.ts +0 -65
- package/lib/components/Switch/index.d.ts +0 -5
- package/lib/components/Switch/renderSwitch.d.ts +0 -5
- package/lib/components/Switch/useSwitch.d.ts +0 -12
- package/lib/components/Switch/useSwitchStyles.d.ts +0 -11
- package/lib/index.d.ts +0 -2
- package/lib-commonjs/Switch.d.ts +0 -1
- package/lib-commonjs/components/Switch/Switch.d.ts +0 -6
- package/lib-commonjs/components/Switch/Switch.types.d.ts +0 -65
- package/lib-commonjs/components/Switch/index.d.ts +0 -5
- package/lib-commonjs/components/Switch/renderSwitch.d.ts +0 -5
- package/lib-commonjs/components/Switch/useSwitch.d.ts +0 -12
- package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +0 -11
- package/lib-commonjs/index.d.ts +0 -2
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,313 @@
|
|
2
2
|
"name": "@fluentui/react-switch",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 28 Jun 2022 15:09:15 GMT",
|
6
|
+
"tag": "@fluentui/react-switch_v9.0.0",
|
7
|
+
"version": "9.0.0",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "lingfangao@hotmail.com",
|
12
|
+
"package": "@fluentui/react-switch",
|
13
|
+
"commit": "675acea49c97f10837ddee9b8c4350ca27750125",
|
14
|
+
"comment": "Bump Griffel dependencies"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
18
|
+
"package": "@fluentui/react-switch",
|
19
|
+
"commit": "fd4c88b3915ed3e26d4d39bcb24390343b8299ac",
|
20
|
+
"comment": "fix: Removing user-select: 'none' from label."
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
24
|
+
"package": "@fluentui/react-switch",
|
25
|
+
"commit": "79a3a86436a5194f83cdaf561cd04e24a9a07d78",
|
26
|
+
"comment": "README update."
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "olfedias@microsoft.com",
|
30
|
+
"package": "@fluentui/react-switch",
|
31
|
+
"commit": "82bd30dd41ad58df1f325e9b721200ed15d674a2",
|
32
|
+
"comment": "chore: Update @fluentui/react-icons to latest version"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
36
|
+
"package": "@fluentui/react-switch",
|
37
|
+
"commit": "5e326ed2e7068e8eb75df4a54495c27206ec831b",
|
38
|
+
"comment": "fix: Making thumb be vertically centered in Switch."
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
42
|
+
"package": "@fluentui/react-switch",
|
43
|
+
"commit": "5f06f19e57ffdc265f10ef26db086bf48dc8f610",
|
44
|
+
"comment": "README, spec and migration guide cleanup."
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "lingfangao@hotmail.com",
|
48
|
+
"package": "@fluentui/react-switch",
|
49
|
+
"commit": "e0aabd850b15adf9c151ebd4e332f7c50ad6cfdf",
|
50
|
+
"comment": "Update 9.0.0-rc dependencies to use caret range"
|
51
|
+
}
|
52
|
+
],
|
53
|
+
"patch": [
|
54
|
+
{
|
55
|
+
"author": "lingfangao@hotmail.com",
|
56
|
+
"package": "@fluentui/react-switch",
|
57
|
+
"commit": "c7b1348bdad7aa883c29bfbc96ef2a32e6ebc7dd",
|
58
|
+
"comment": "feat: Initial 9.0.0 release"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"author": "beachball",
|
62
|
+
"package": "@fluentui/react-switch",
|
63
|
+
"comment": "Bump @fluentui/react-label to v9.0.0",
|
64
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"author": "beachball",
|
68
|
+
"package": "@fluentui/react-switch",
|
69
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0",
|
70
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"author": "beachball",
|
74
|
+
"package": "@fluentui/react-switch",
|
75
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0",
|
76
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"author": "beachball",
|
80
|
+
"package": "@fluentui/react-switch",
|
81
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0",
|
82
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"author": "beachball",
|
86
|
+
"package": "@fluentui/react-switch",
|
87
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.9",
|
88
|
+
"commit": "ba6c5d651559b91c815429c9a9357c4d5a390f3e"
|
89
|
+
}
|
90
|
+
],
|
91
|
+
"none": [
|
92
|
+
{
|
93
|
+
"author": "mgodbolt@microsoft.com",
|
94
|
+
"package": "@fluentui/react-switch",
|
95
|
+
"commit": "ef7385bdc0dc640657b18bd2c51a5f3ef91113a5",
|
96
|
+
"comment": "chore: Convert switch to index based stories"
|
97
|
+
}
|
98
|
+
]
|
99
|
+
}
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"date": "Thu, 23 Jun 2022 14:25:31 GMT",
|
103
|
+
"tag": "@fluentui/react-switch_v9.0.0-rc.14",
|
104
|
+
"version": "9.0.0-rc.14",
|
105
|
+
"comments": {
|
106
|
+
"prerelease": [
|
107
|
+
{
|
108
|
+
"author": "beachball",
|
109
|
+
"package": "@fluentui/react-switch",
|
110
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.6",
|
111
|
+
"commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"author": "beachball",
|
115
|
+
"package": "@fluentui/react-switch",
|
116
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.14",
|
117
|
+
"commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"author": "beachball",
|
121
|
+
"package": "@fluentui/react-switch",
|
122
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.10",
|
123
|
+
"commit": "b00790b7a0ea1473d8c3cc49c7ca0088002957ed"
|
124
|
+
}
|
125
|
+
]
|
126
|
+
}
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"date": "Tue, 31 May 2022 21:28:47 GMT",
|
130
|
+
"tag": "@fluentui/react-switch_v9.0.0-rc.13",
|
131
|
+
"version": "9.0.0-rc.13",
|
132
|
+
"comments": {
|
133
|
+
"prerelease": [
|
134
|
+
{
|
135
|
+
"author": "olfedias@microsoft.com",
|
136
|
+
"package": "@fluentui/react-switch",
|
137
|
+
"commit": "0a5e9fa77a72eecafdd07034ccdc0b95fd49877c",
|
138
|
+
"comment": "chore: Update Griffel to latest version"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"author": "beachball",
|
142
|
+
"package": "@fluentui/react-switch",
|
143
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.5",
|
144
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"author": "beachball",
|
148
|
+
"package": "@fluentui/react-switch",
|
149
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.13",
|
150
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"author": "beachball",
|
154
|
+
"package": "@fluentui/react-switch",
|
155
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.10",
|
156
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"author": "beachball",
|
160
|
+
"package": "@fluentui/react-switch",
|
161
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.8",
|
162
|
+
"commit": "335ebfcfd47005003901b5e319782bfe9ccd89fd"
|
163
|
+
}
|
164
|
+
]
|
165
|
+
}
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"date": "Thu, 26 May 2022 21:01:30 GMT",
|
169
|
+
"tag": "@fluentui/react-switch_v9.0.0-rc.12",
|
170
|
+
"version": "9.0.0-rc.12",
|
171
|
+
"comments": {
|
172
|
+
"none": [
|
173
|
+
{
|
174
|
+
"author": "olfedias@microsoft.com",
|
175
|
+
"package": "@fluentui/react-switch",
|
176
|
+
"commit": "8735876a860005ac5bde07c20da265b23341682a",
|
177
|
+
"comment": "cleanup stories & docs"
|
178
|
+
}
|
179
|
+
],
|
180
|
+
"prerelease": [
|
181
|
+
{
|
182
|
+
"author": "beachball",
|
183
|
+
"package": "@fluentui/react-switch",
|
184
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.4",
|
185
|
+
"commit": "3cf55ce998048554bf6a550de44403843ea8ede0"
|
186
|
+
},
|
187
|
+
{
|
188
|
+
"author": "beachball",
|
189
|
+
"package": "@fluentui/react-switch",
|
190
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.12",
|
191
|
+
"commit": "3cf55ce998048554bf6a550de44403843ea8ede0"
|
192
|
+
}
|
193
|
+
]
|
194
|
+
}
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"date": "Mon, 23 May 2022 18:56:51 GMT",
|
198
|
+
"tag": "@fluentui/react-switch_v9.0.0-rc.11",
|
199
|
+
"version": "9.0.0-rc.11",
|
200
|
+
"comments": {
|
201
|
+
"prerelease": [
|
202
|
+
{
|
203
|
+
"author": "beachball",
|
204
|
+
"package": "@fluentui/react-switch",
|
205
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.3",
|
206
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"author": "beachball",
|
210
|
+
"package": "@fluentui/react-switch",
|
211
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.11",
|
212
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"author": "beachball",
|
216
|
+
"package": "@fluentui/react-switch",
|
217
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.9",
|
218
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"author": "beachball",
|
222
|
+
"package": "@fluentui/react-switch",
|
223
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7",
|
224
|
+
"commit": "d4f80b17690e962d6a24e68959608d1ffe84aef6"
|
225
|
+
}
|
226
|
+
]
|
227
|
+
}
|
228
|
+
},
|
229
|
+
{
|
230
|
+
"date": "Mon, 23 May 2022 12:13:46 GMT",
|
231
|
+
"tag": "@fluentui/react-switch_v9.0.0-rc.10",
|
232
|
+
"version": "9.0.0-rc.10",
|
233
|
+
"comments": {
|
234
|
+
"prerelease": [
|
235
|
+
{
|
236
|
+
"author": "olfedias@microsoft.com",
|
237
|
+
"package": "@fluentui/react-switch",
|
238
|
+
"commit": "f120fe9160ad7311a87af0cfacd8d2fb26275e34",
|
239
|
+
"comment": "chore: Update Griffel to latest version"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
"author": "behowell@microsoft.com",
|
243
|
+
"package": "@fluentui/react-switch",
|
244
|
+
"commit": "c0b27cce0d29122e4488ff431689b966076a728b",
|
245
|
+
"comment": "Replace hardcoded padding with spacing tokens"
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"author": "behowell@microsoft.com",
|
249
|
+
"package": "@fluentui/react-switch",
|
250
|
+
"commit": "45ec789399b65b76b80cc8023d977de7d2b8b579",
|
251
|
+
"comment": "Refactor styles to remove usage of flex gap"
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"author": "esteban.230@hotmail.com",
|
255
|
+
"package": "@fluentui/react-switch",
|
256
|
+
"commit": "0fac2d7a6f35c5fcebaf30da68b9604410fe0eb9",
|
257
|
+
"comment": "Updated react-label package version to RC."
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"author": "martinhochel@microsoft.com",
|
261
|
+
"package": "@fluentui/react-switch",
|
262
|
+
"commit": "eb1084fd607c0d1086f9d465168be5822daa5e40",
|
263
|
+
"comment": "feat: ship rolluped only dts"
|
264
|
+
},
|
265
|
+
{
|
266
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
267
|
+
"package": "@fluentui/react-switch",
|
268
|
+
"commit": "ec6c1a33b3c4cec9422d07bcffc48b85928c22d2",
|
269
|
+
"comment": "Removing SwitchCommons type in @fluentui/react-switch."
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"author": "olfedias@microsoft.com",
|
273
|
+
"package": "@fluentui/react-switch",
|
274
|
+
"commit": "60804cec07a495b8a5d1fc66338bf0443b212144",
|
275
|
+
"comment": "chore: Update Griffel to latest version"
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"author": "beachball",
|
279
|
+
"package": "@fluentui/react-switch",
|
280
|
+
"comment": "Bump @fluentui/react-label to v9.0.0-rc.2",
|
281
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
282
|
+
},
|
283
|
+
{
|
284
|
+
"author": "beachball",
|
285
|
+
"package": "@fluentui/react-switch",
|
286
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.10",
|
287
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
288
|
+
},
|
289
|
+
{
|
290
|
+
"author": "beachball",
|
291
|
+
"package": "@fluentui/react-switch",
|
292
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.8",
|
293
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
294
|
+
},
|
295
|
+
{
|
296
|
+
"author": "beachball",
|
297
|
+
"package": "@fluentui/react-switch",
|
298
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.9",
|
299
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
300
|
+
},
|
301
|
+
{
|
302
|
+
"author": "beachball",
|
303
|
+
"package": "@fluentui/react-switch",
|
304
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6",
|
305
|
+
"commit": "8d58f08997acf595e3eb7f628123e7fa7830c394"
|
306
|
+
}
|
307
|
+
]
|
308
|
+
}
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"date": "Thu, 05 May 2022 18:26:26 GMT",
|
6
312
|
"tag": "@fluentui/react-switch_v9.0.0-rc.9",
|
7
313
|
"version": "9.0.0-rc.9",
|
8
314
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,102 @@
|
|
1
1
|
# Change Log - @fluentui/react-switch
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 28 Jun 2022 15:09:15 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0)
|
8
|
+
|
9
|
+
Tue, 28 Jun 2022 15:09:15 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.14..@fluentui/react-switch_v9.0.0)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
|
15
|
+
- Bump @fluentui/react-label to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
16
|
+
- Bump @fluentui/react-tabster to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
17
|
+
- Bump @fluentui/react-theme to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
19
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.9 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
- Bump Griffel dependencies ([PR #23688](https://github.com/microsoft/fluentui/pull/23688) by lingfangao@hotmail.com)
|
24
|
+
- fix: Removing user-select: 'none' from label. ([PR #23590](https://github.com/microsoft/fluentui/pull/23590) by Humberto.Morimoto@microsoft.com)
|
25
|
+
- README update. ([PR #23439](https://github.com/microsoft/fluentui/pull/23439) by Humberto.Morimoto@microsoft.com)
|
26
|
+
- chore: Update @fluentui/react-icons to latest version ([PR #23459](https://github.com/microsoft/fluentui/pull/23459) by olfedias@microsoft.com)
|
27
|
+
- fix: Making thumb be vertically centered in Switch. ([PR #23712](https://github.com/microsoft/fluentui/pull/23712) by Humberto.Morimoto@microsoft.com)
|
28
|
+
- README, spec and migration guide cleanup. ([PR #23396](https://github.com/microsoft/fluentui/pull/23396) by Humberto.Morimoto@microsoft.com)
|
29
|
+
- Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
|
30
|
+
|
31
|
+
## [9.0.0-rc.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.14)
|
32
|
+
|
33
|
+
Thu, 23 Jun 2022 14:25:31 GMT
|
34
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.13..@fluentui/react-switch_v9.0.0-rc.14)
|
35
|
+
|
36
|
+
### Changes
|
37
|
+
|
38
|
+
- Bump @fluentui/react-label to v9.0.0-rc.6 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
|
39
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.14 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
|
40
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.10 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
|
41
|
+
|
42
|
+
## [9.0.0-rc.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.13)
|
43
|
+
|
44
|
+
Tue, 31 May 2022 21:28:47 GMT
|
45
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.12..@fluentui/react-switch_v9.0.0-rc.13)
|
46
|
+
|
47
|
+
### Changes
|
48
|
+
|
49
|
+
- chore: Update Griffel to latest version ([PR #23275](https://github.com/microsoft/fluentui/pull/23275) by olfedias@microsoft.com)
|
50
|
+
- Bump @fluentui/react-label to v9.0.0-rc.5 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
51
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.13 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
52
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
53
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.8 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
|
54
|
+
|
55
|
+
## [9.0.0-rc.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.12)
|
56
|
+
|
57
|
+
Thu, 26 May 2022 21:01:30 GMT
|
58
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.11..@fluentui/react-switch_v9.0.0-rc.12)
|
59
|
+
|
60
|
+
### Changes
|
61
|
+
|
62
|
+
- Bump @fluentui/react-label to v9.0.0-rc.4 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
|
63
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
|
64
|
+
|
65
|
+
## [9.0.0-rc.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.11)
|
66
|
+
|
67
|
+
Mon, 23 May 2022 18:56:51 GMT
|
68
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.10..@fluentui/react-switch_v9.0.0-rc.11)
|
69
|
+
|
70
|
+
### Changes
|
71
|
+
|
72
|
+
- Bump @fluentui/react-label to v9.0.0-rc.3 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
73
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
74
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
75
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
|
76
|
+
|
77
|
+
## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.10)
|
78
|
+
|
79
|
+
Mon, 23 May 2022 12:13:46 GMT
|
80
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.9..@fluentui/react-switch_v9.0.0-rc.10)
|
81
|
+
|
82
|
+
### Changes
|
83
|
+
|
84
|
+
- chore: Update Griffel to latest version ([PR #22894](https://github.com/microsoft/fluentui/pull/22894) by olfedias@microsoft.com)
|
85
|
+
- Replace hardcoded padding with spacing tokens ([PR #22982](https://github.com/microsoft/fluentui/pull/22982) by behowell@microsoft.com)
|
86
|
+
- Refactor styles to remove usage of flex gap ([PR #22976](https://github.com/microsoft/fluentui/pull/22976) by behowell@microsoft.com)
|
87
|
+
- Updated react-label package version to RC. ([PR #22865](https://github.com/microsoft/fluentui/pull/22865) by esteban.230@hotmail.com)
|
88
|
+
- feat: ship rolluped only dts ([PR #22874](https://github.com/microsoft/fluentui/pull/22874) by martinhochel@microsoft.com)
|
89
|
+
- Removing SwitchCommons type in @fluentui/react-switch. ([PR #22943](https://github.com/microsoft/fluentui/pull/22943) by Humberto.Morimoto@microsoft.com)
|
90
|
+
- chore: Update Griffel to latest version ([PR #23029](https://github.com/microsoft/fluentui/pull/23029) by olfedias@microsoft.com)
|
91
|
+
- Bump @fluentui/react-label to v9.0.0-rc.2 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
92
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.10 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
93
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.8 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
94
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.9 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
95
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.6 ([PR #23030](https://github.com/microsoft/fluentui/pull/23030) by beachball)
|
96
|
+
|
7
97
|
## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.9)
|
8
98
|
|
9
|
-
Thu, 05 May 2022 18:
|
99
|
+
Thu, 05 May 2022 18:26:26 GMT
|
10
100
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.8..@fluentui/react-switch_v9.0.0-rc.9)
|
11
101
|
|
12
102
|
### Changes
|
package/MIGRATION.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# Switch Migration
|
2
2
|
|
3
|
-
## STATUS: WIP 🚧
|
4
|
-
|
5
|
-
This Migration guide is a work in progress and is not yet ready for use.
|
6
|
-
|
7
3
|
## Migration from v8's Toggle
|
8
4
|
|
9
5
|
### Props that remain as is
|
@@ -68,7 +64,7 @@ This Migration guide is a work in progress and is not yet ready for use.
|
|
68
64
|
|
69
65
|
- `design`
|
70
66
|
|
71
|
-
##
|
67
|
+
## Property mapping
|
72
68
|
|
73
69
|
| v8 `Toggle` | v0 `Checkbox` | v9 `Switch` |
|
74
70
|
| ---------------- | --------------- | ---------------- |
|
package/README.md
CHANGED
@@ -1,23 +1,13 @@
|
|
1
1
|
# @fluentui/react-switch
|
2
2
|
|
3
|
-
**
|
3
|
+
**Switch components for [Fluent UI React](https://aka.ms/fluentui-storybook)**
|
4
4
|
|
5
|
-
The `Switch` control
|
6
|
-
|
7
|
-
## STATUS: WIP 🚧
|
8
|
-
|
9
|
-
These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
|
5
|
+
The `Switch` control enables users to trigger an option on or off through interacting with the component.
|
10
6
|
|
11
7
|
## Usage
|
12
8
|
|
13
9
|
To import Switch:
|
14
10
|
|
15
|
-
```js
|
16
|
-
import { Switch } from '@fluentui/react-switch';
|
17
|
-
```
|
18
|
-
|
19
|
-
Once the Switch component graduates to a production release, the component will be available at:
|
20
|
-
|
21
11
|
```js
|
22
12
|
import { Switch } from '@fluentui/react-components';
|
23
13
|
```
|
@@ -26,7 +16,23 @@ import { Switch } from '@fluentui/react-components';
|
|
26
16
|
|
27
17
|
```jsx
|
28
18
|
<Switch />
|
29
|
-
<Switch defaultChecked
|
30
|
-
<Switch checked
|
19
|
+
<Switch defaultChecked required />
|
20
|
+
<Switch checked onChange={onChange} />
|
31
21
|
<Switch disabled />
|
22
|
+
<Switch label="Enable dark mode" labelPosition="after" />
|
32
23
|
```
|
24
|
+
|
25
|
+
See [Fluent UI Storybook](https://aka.ms/fluentui-storybook) for more detailed usage examples.
|
26
|
+
|
27
|
+
Alternatively, run Storybook locally with:
|
28
|
+
|
29
|
+
1. `yarn start`
|
30
|
+
2. Select `react-switch` from the list.
|
31
|
+
|
32
|
+
### Specification
|
33
|
+
|
34
|
+
See [SPEC.md](./Spec.md).
|
35
|
+
|
36
|
+
### Migration Guide
|
37
|
+
|
38
|
+
If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest Switch implementation.
|
package/Spec.md
CHANGED
@@ -109,7 +109,7 @@ https://github.com/microsoft/fluentui/blob/master/packages/react-checkbox/src/co
|
|
109
109
|
|
110
110
|
### Switch Props
|
111
111
|
|
112
|
-
See [Switch.types.ts](
|
112
|
+
See API at [Switch.types.ts](./src/components/Switch/Switch.types.ts).
|
113
113
|
|
114
114
|
## Structure
|
115
115
|
|
@@ -165,7 +165,7 @@ _With label after the track thumb indicator:_
|
|
165
165
|
|
166
166
|
## Migration
|
167
167
|
|
168
|
-
See [MIGRATION.md](MIGRATION.md).
|
168
|
+
See [MIGRATION.md](./MIGRATION.md).
|
169
169
|
|
170
170
|
## Behaviors
|
171
171
|
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
|
1
3
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
2
4
|
import type { ComponentState } from '@fluentui/react-utilities';
|
3
5
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
@@ -23,36 +25,35 @@ export declare const switchClassName: string;
|
|
23
25
|
|
24
26
|
export declare const switchClassNames: SlotClassNames<SwitchSlots>;
|
25
27
|
|
26
|
-
declare type
|
28
|
+
export declare type SwitchOnChangeData = {
|
29
|
+
checked: boolean;
|
30
|
+
};
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Switch Props
|
34
|
+
*/
|
35
|
+
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'checked' | 'defaultChecked' | 'onChange'> & {
|
27
36
|
/**
|
28
37
|
* Defines the controlled checked state of the Switch.
|
29
38
|
* If passed, Switch ignores the `defaultChecked` property.
|
30
39
|
* This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
|
31
40
|
* correct value based on handling `onChange` events and re-rendering.
|
41
|
+
*
|
32
42
|
* @default false
|
33
43
|
*/
|
34
44
|
checked?: boolean;
|
35
|
-
/**
|
36
|
-
* The position of the label relative to the Switch.
|
37
|
-
*
|
38
|
-
* @default after
|
39
|
-
*/
|
40
|
-
labelPosition: 'above' | 'after' | 'before';
|
41
|
-
};
|
42
|
-
|
43
|
-
export declare type SwitchOnChangeData = {
|
44
|
-
checked: boolean;
|
45
|
-
};
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Switch Props
|
49
|
-
*/
|
50
|
-
export declare type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> & Partial<SwitchCommons> & {
|
51
45
|
/**
|
52
46
|
* Defines whether the Switch is initially in a checked state or not when rendered.
|
47
|
+
*
|
53
48
|
* @default false
|
54
49
|
*/
|
55
50
|
defaultChecked?: boolean;
|
51
|
+
/**
|
52
|
+
* The position of the label relative to the Switch.
|
53
|
+
*
|
54
|
+
* @default after
|
55
|
+
*/
|
56
|
+
labelPosition?: 'above' | 'after' | 'before';
|
56
57
|
/**
|
57
58
|
* Callback to be called when the checked state value changes.
|
58
59
|
*/
|
@@ -87,7 +88,7 @@ export declare type SwitchSlots = {
|
|
87
88
|
/**
|
88
89
|
* State used in rendering Switch
|
89
90
|
*/
|
90
|
-
export declare type SwitchState = ComponentState<SwitchSlots> &
|
91
|
+
export declare type SwitchState = ComponentState<SwitchSlots> & Required<Pick<SwitchProps, 'labelPosition'>>;
|
91
92
|
|
92
93
|
/**
|
93
94
|
* Create the state required to render Switch.
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA;;AAEG;;AACH,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;
|
1
|
+
{"version":3,"sources":["components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA;;AAEG;;AACH,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtF,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;EAEA,wBAAwB,CAAC,KAAD,CAAxB;EAEA,OAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CANuD,CAAjD;AAQP,MAAM,CAAC,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/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.types.js","sourceRoot":"../src/","sources":["components/Switch/Switch.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SwitchSlots = {\n /**\n * The root element of the Switch.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.\n * All other native props will be applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The track and the thumb sliding over it indicating the on and off status of the Switch.\n */\n indicator: NonNullable<Slot<'div'>>;\n\n /**\n * Hidden input that handles the Switch's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this\n * slot, except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The Switch's label.\n */\n label?: Slot<typeof Label>;\n};\n\
|
1
|
+
{"version":3,"file":"Switch.types.js","sourceRoot":"../src/","sources":["components/Switch/Switch.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type SwitchSlots = {\n /**\n * The root element of the Switch.\n *\n * The root slot receives the `className` and `style` specified directly on the `<Switch>` tag.\n * All other native props will be applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The track and the thumb sliding over it indicating the on and off status of the Switch.\n */\n indicator: NonNullable<Slot<'div'>>;\n\n /**\n * Hidden input that handles the Switch's functionality.\n *\n * This is the PRIMARY slot: all native properties specified directly on the `<Switch>` tag will be applied to this\n * slot, except `className` and `style`, which remain on the root slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * The Switch's label.\n */\n label?: Slot<typeof Label>;\n};\n\nexport type SwitchOnChangeData = {\n checked: boolean;\n};\n\n/**\n * Switch Props\n */\nexport type SwitchProps = Omit<\n ComponentProps<Partial<SwitchSlots>, 'input'>,\n 'checked' | 'defaultChecked' | 'onChange'\n> & {\n /**\n * Defines the controlled checked state of the Switch.\n * If passed, Switch ignores the `defaultChecked` property.\n * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the\n * correct value based on handling `onChange` events and re-rendering.\n *\n * @default false\n */\n checked?: boolean;\n\n /**\n * Defines whether the Switch is initially in a checked state or not when rendered.\n *\n * @default false\n */\n defaultChecked?: boolean;\n\n /**\n * The position of the label relative to the Switch.\n *\n * @default after\n */\n labelPosition?: 'above' | 'after' | 'before';\n\n /**\n * Callback to be called when the checked state value changes.\n */\n onChange?: (ev: React.ChangeEvent<HTMLInputElement>, data: SwitchOnChangeData) => void;\n};\n\n/**\n * State used in rendering Switch\n */\nexport type SwitchState = ComponentState<SwitchSlots> & Required<Pick<SwitchProps, 'labelPosition'>>;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Switch/renderSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;
|
1
|
+
{"version":3,"sources":["components/Switch/renderSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;EAC1D,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAc,KAAd,CAArC;EACA,MAAM;IAAE;EAAF,IAAoB,KAA1B;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADF,EAEG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAF/C,eAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,SAAP,EAAgB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAhB,CAHF,EAIG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CAJ/C,CADF;AAQD,CAZM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SwitchState, SwitchSlots } from './Switch.types';\n\n/**\n * Render a Switch component by passing the state defined props to the appropriate slots.\n */\nexport const renderSwitch_unstable = (state: SwitchState) => {\n const { slots, slotProps } = getSlots<SwitchSlots>(state);\n const { labelPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.input {...slotProps.input} />\n {labelPosition !== 'after' && slots.label && <slots.label {...slotProps.label} />}\n <slots.indicator {...slotProps.indicator} />\n {labelPosition === 'after' && slots.label && <slots.label {...slotProps.label} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Switch/useSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,uBAA7B;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,yBAAT,EAAoC,gBAApC,EAAsD,KAAtD,EAA6D,uBAA7D,QAA4F,2BAA5F;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAAC,KAAD,EAAqB,GAArB,KAAsE;
|
1
|
+
{"version":3,"sources":["components/Switch/useSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,uBAA7B;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,yBAAT,EAAoC,gBAApC,EAAsD,KAAtD,EAA6D,uBAA7D,QAA4F,2BAA5F;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAAC,KAAD,EAAqB,GAArB,KAAsE;EACtG,MAAM;IAAE,OAAF;IAAW,cAAX;IAA2B,QAA3B;IAAqC,aAAa,GAAG,OAArD;IAA8D,QAA9D;IAAwE;EAAxE,IAAqF,KAA3F;EAEA,MAAM,WAAW,GAAG,yBAAyB,CAAC;IAC5C,KAD4C;IAE5C,kBAAkB,EAAE,OAFwB;IAG5C,iBAAiB,EAAE,CAAC,SAAD,EAAY,gBAAZ,EAA8B,UAA9B;EAHyB,CAAD,CAA7C;EAMA,MAAM,EAAE,GAAG,KAAK,CAAC,SAAD,EAAY,WAAW,CAAC,OAAZ,CAAoB,EAAhC,CAAhB;EAEA,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAP,EAAa;IACxC,YAAY,EAAE,WAAW,CAAC,IADc;IAExC,QAAQ,EAAE;EAF8B,CAAb,CAA7B;EAKA,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB;IAClD,YAAY,EAAE;MACZ,eAAe,IADH;MAEZ,QAAQ,eAAE,KAAA,CAAA,aAAA,CAAC,YAAD,EAAa,IAAb;IAFE,CADoC;IAKlD,QAAQ,EAAE;EALwC,CAAlB,CAAlC;EAQA,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAP,EAAc;IAC1C,YAAY,EAAE;MACZ,OADY;MAEZ,cAFY;MAGZ,EAHY;MAIZ,GAJY;MAKZ,IAAI,EAAE,QALM;MAMZ,IAAI,EAAE,UANM;MAOZ,GAAG,WAAW,CAAC;IAPH,CAD4B;IAU1C,QAAQ,EAAE;EAVgC,CAAd,CAA9B;EAYA,KAAK,CAAC,QAAN,GAAiB,uBAAuB,CAAC,KAAK,CAAC,QAAP,EAAiB,EAAE,IAAI,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAQ,KAAA,CAAR,GAAA,QAAQ,CAAG,EAAH,EAAO;IAAE,OAAO,EAAE,EAAE,CAAC,aAAH,CAAiB;EAA5B,CAAP,CAA/B,CAAxC;EAEA,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAP,EAAc;IAC1C,YAAY,EAAE;MACZ,QADY;MAEZ,OAAO,EAAE,EAFG;MAGZ,QAHY;MAIZ,IAAI,EAAE;IAJM;EAD4B,CAAd,CAA9B;EASA,OAAO;IACL,aADK;IAGL;IACA,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,SAAS,EAAE,KAFD;MAGV,KAAK,EAAE,OAHG;MAIV,KAAK,EAAE;IAJG,CAJP;IAWL,IAXK;IAYL,SAZK;IAaL,KAbK;IAcL;EAdK,CAAP;AAgBD,CA/DM","sourcesContent":["import * as React from 'react';\nimport { CircleFilled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getPartitionedNativeProps, resolveShorthand, useId, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport type { SwitchProps, SwitchState } from './Switch.types';\n\n/**\n * Create the state required to render Switch.\n *\n * The returned state can be modified with hooks such as useSwitchStyles_unstable,\n * before being passed to renderSwitch_unstable.\n *\n * @param props - props from this instance of Switch\n * @param ref - reference to `<input>` element of Switch\n */\nexport const useSwitch_unstable = (props: SwitchProps, ref: React.Ref<HTMLInputElement>): SwitchState => {\n const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props;\n\n const nativeProps = getPartitionedNativeProps({\n props,\n primarySlotTagName: 'input',\n excludedPropNames: ['checked', 'defaultChecked', 'onChange'],\n });\n\n const id = useId('switch-', nativeProps.primary.id);\n\n const root = resolveShorthand(props.root, {\n defaultProps: nativeProps.root,\n required: true,\n });\n\n const indicator = resolveShorthand(props.indicator, {\n defaultProps: {\n 'aria-hidden': true,\n children: <CircleFilled />,\n },\n required: true,\n });\n\n const input = resolveShorthand(props.input, {\n defaultProps: {\n checked,\n defaultChecked,\n id,\n ref,\n role: 'switch',\n type: 'checkbox',\n ...nativeProps.primary,\n },\n required: true,\n });\n input.onChange = useMergedEventCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked }));\n\n const label = resolveShorthand(props.label, {\n defaultProps: {\n disabled,\n htmlFor: id,\n required,\n size: 'medium',\n },\n });\n\n return {\n labelPosition,\n\n //Slots definition\n components: {\n root: 'div',\n indicator: 'div',\n input: 'input',\n label: Label,\n },\n\n root,\n indicator,\n input,\n label,\n };\n};\n"],"sourceRoot":"../src/"}
|