@fluentui/react-switch 9.0.0-rc.7 → 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.
Files changed (36) hide show
  1. package/CHANGELOG.json +393 -1
  2. package/CHANGELOG.md +152 -36
  3. package/MIGRATION.md +1 -5
  4. package/README.md +20 -14
  5. package/Spec.md +2 -2
  6. package/dist/{react-switch.d.ts → index.d.ts} +19 -18
  7. package/{lib → dist}/tsdoc-metadata.json +0 -0
  8. package/lib/components/Switch/Switch.js.map +1 -1
  9. package/lib/components/Switch/Switch.types.js.map +1 -1
  10. package/lib/components/Switch/renderSwitch.js.map +1 -1
  11. package/lib/components/Switch/useSwitch.js.map +1 -1
  12. package/lib/components/Switch/useSwitchStyles.js +73 -61
  13. package/lib/components/Switch/useSwitchStyles.js.map +1 -1
  14. package/lib-commonjs/components/Switch/Switch.js.map +1 -1
  15. package/lib-commonjs/components/Switch/renderSwitch.js.map +1 -1
  16. package/lib-commonjs/components/Switch/useSwitch.js.map +1 -1
  17. package/lib-commonjs/components/Switch/useSwitchStyles.js +73 -61
  18. package/lib-commonjs/components/Switch/useSwitchStyles.js.map +1 -1
  19. package/lib-commonjs/index.js.map +1 -1
  20. package/package.json +12 -14
  21. package/lib/Switch.d.ts +0 -1
  22. package/lib/components/Switch/Switch.d.ts +0 -6
  23. package/lib/components/Switch/Switch.types.d.ts +0 -65
  24. package/lib/components/Switch/index.d.ts +0 -5
  25. package/lib/components/Switch/renderSwitch.d.ts +0 -5
  26. package/lib/components/Switch/useSwitch.d.ts +0 -12
  27. package/lib/components/Switch/useSwitchStyles.d.ts +0 -11
  28. package/lib/index.d.ts +0 -2
  29. package/lib-commonjs/Switch.d.ts +0 -1
  30. package/lib-commonjs/components/Switch/Switch.d.ts +0 -6
  31. package/lib-commonjs/components/Switch/Switch.types.d.ts +0 -65
  32. package/lib-commonjs/components/Switch/index.d.ts +0 -5
  33. package/lib-commonjs/components/Switch/renderSwitch.d.ts +0 -5
  34. package/lib-commonjs/components/Switch/useSwitch.d.ts +0 -12
  35. package/lib-commonjs/components/Switch/useSwitchStyles.d.ts +0 -11
  36. package/lib-commonjs/index.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,12 +1,128 @@
1
1
  # Change Log - @fluentui/react-switch
2
2
 
3
- This log was last generated on Mon, 25 Apr 2022 09:31:20 GMT and should not be manually modified.
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
+
97
+ ## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.9)
98
+
99
+ Thu, 05 May 2022 18:26:26 GMT
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)
101
+
102
+ ### Changes
103
+
104
+ - Bump @fluentui/react-label to v9.0.0-beta.12 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
105
+ - Bump @fluentui/react-tabster to v9.0.0-rc.9 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
106
+ - Bump @fluentui/react-theme to v9.0.0-rc.7 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
107
+ - Bump @fluentui/react-utilities to v9.0.0-rc.8 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
108
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.5 ([PR #22857](https://github.com/microsoft/fluentui/pull/22857) by beachball)
109
+
110
+ ## [9.0.0-rc.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.8)
111
+
112
+ Wed, 04 May 2022 13:26:51 GMT
113
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.7..@fluentui/react-switch_v9.0.0-rc.8)
114
+
115
+ ### Changes
116
+
117
+ - Switch: Fixing disabled styles in high contrast mode. ([PR #22817](https://github.com/microsoft/fluentui/pull/22817) by humberto_makoto@hotmail.com)
118
+ - Bump @fluentui/react-label to v9.0.0-beta.11 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
119
+ - Bump @fluentui/react-tabster to v9.0.0-rc.8 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
120
+ - Bump @fluentui/react-theme to v9.0.0-rc.6 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
121
+ - Bump @fluentui/react-utilities to v9.0.0-rc.7 ([PR #22786](https://github.com/microsoft/fluentui/pull/22786) by beachball)
122
+
7
123
  ## [9.0.0-rc.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.7)
8
124
 
9
- Mon, 25 Apr 2022 09:31:20 GMT
125
+ Mon, 25 Apr 2022 09:32:19 GMT
10
126
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.6..@fluentui/react-switch_v9.0.0-rc.7)
11
127
 
12
128
  ### Changes
@@ -15,7 +131,7 @@ Mon, 25 Apr 2022 09:31:20 GMT
15
131
 
16
132
  ## [9.0.0-rc.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.6)
17
133
 
18
- Tue, 19 Apr 2022 19:16:54 GMT
134
+ Tue, 19 Apr 2022 19:16:54 GMT
19
135
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.5..@fluentui/react-switch_v9.0.0-rc.6)
20
136
 
21
137
  ### Changes
@@ -33,7 +149,7 @@ Tue, 19 Apr 2022 19:16:54 GMT
33
149
 
34
150
  ## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.5)
35
151
 
36
- Fri, 04 Mar 2022 05:17:30 GMT
152
+ Fri, 04 Mar 2022 05:17:30 GMT
37
153
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.4..@fluentui/react-switch_v9.0.0-rc.5)
38
154
 
39
155
  ### Changes
@@ -47,7 +163,7 @@ Fri, 04 Mar 2022 05:17:30 GMT
47
163
 
48
164
  ## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.4)
49
165
 
50
- Tue, 01 Mar 2022 02:17:38 GMT
166
+ Tue, 01 Mar 2022 02:17:38 GMT
51
167
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.3..@fluentui/react-switch_v9.0.0-rc.4)
52
168
 
53
169
  ### Changes
@@ -60,7 +176,7 @@ Tue, 01 Mar 2022 02:17:38 GMT
60
176
 
61
177
  ## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.3)
62
178
 
63
- Fri, 18 Feb 2022 13:35:34 GMT
179
+ Fri, 18 Feb 2022 13:35:34 GMT
64
180
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-rc.1..@fluentui/react-switch_v9.0.0-rc.3)
65
181
 
66
182
  ### Changes
@@ -74,7 +190,7 @@ Fri, 18 Feb 2022 13:35:34 GMT
74
190
 
75
191
  ## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-rc.1)
76
192
 
77
- Thu, 10 Feb 2022 08:50:51 GMT
193
+ Thu, 10 Feb 2022 08:50:51 GMT
78
194
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-beta.5..@fluentui/react-switch_v9.0.0-rc.1)
79
195
 
80
196
  ### Changes
@@ -96,7 +212,7 @@ Thu, 10 Feb 2022 08:50:51 GMT
96
212
 
97
213
  ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-beta.5)
98
214
 
99
- Thu, 25 Nov 2021 08:34:17 GMT
215
+ Thu, 25 Nov 2021 08:34:17 GMT
100
216
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-beta.4..@fluentui/react-switch_v9.0.0-beta.5)
101
217
 
102
218
  ### Changes
@@ -111,7 +227,7 @@ Thu, 25 Nov 2021 08:34:17 GMT
111
227
 
112
228
  ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-beta.4)
113
229
 
114
- Fri, 12 Nov 2021 13:25:33 GMT
230
+ Fri, 12 Nov 2021 13:25:33 GMT
115
231
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-beta.3..@fluentui/react-switch_v9.0.0-beta.4)
116
232
 
117
233
  ### Changes
@@ -127,7 +243,7 @@ Fri, 12 Nov 2021 13:25:33 GMT
127
243
 
128
244
  ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-beta.3)
129
245
 
130
- Wed, 27 Oct 2021 12:14:22 GMT
246
+ Wed, 27 Oct 2021 12:14:22 GMT
131
247
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-beta.2..@fluentui/react-switch_v9.0.0-beta.3)
132
248
 
133
249
  ### Changes
@@ -147,7 +263,7 @@ Wed, 27 Oct 2021 12:14:22 GMT
147
263
 
148
264
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-beta.2)
149
265
 
150
- Tue, 12 Oct 2021 19:45:58 GMT
266
+ Tue, 12 Oct 2021 19:45:58 GMT
151
267
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-beta.1..@fluentui/react-switch_v9.0.0-beta.2)
152
268
 
153
269
  ### Changes
@@ -157,7 +273,7 @@ Tue, 12 Oct 2021 19:45:58 GMT
157
273
 
158
274
  ## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-beta.1)
159
275
 
160
- Wed, 06 Oct 2021 10:37:22 GMT
276
+ Wed, 06 Oct 2021 10:37:22 GMT
161
277
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.17..@fluentui/react-switch_v9.0.0-beta.1)
162
278
 
163
279
  ### Changes
@@ -176,7 +292,7 @@ Wed, 06 Oct 2021 10:37:22 GMT
176
292
 
177
293
  ## [9.0.0-alpha.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.17)
178
294
 
179
- Tue, 05 Oct 2021 12:47:58 GMT
295
+ Tue, 05 Oct 2021 12:47:58 GMT
180
296
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.16..@fluentui/react-switch_v9.0.0-alpha.17)
181
297
 
182
298
  ### Changes
@@ -191,7 +307,7 @@ Tue, 05 Oct 2021 12:47:58 GMT
191
307
 
192
308
  ## [9.0.0-alpha.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.16)
193
309
 
194
- Tue, 05 Oct 2021 09:28:07 GMT
310
+ Tue, 05 Oct 2021 09:28:07 GMT
195
311
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.15..@fluentui/react-switch_v9.0.0-alpha.16)
196
312
 
197
313
  ### Changes
@@ -208,7 +324,7 @@ Tue, 05 Oct 2021 09:28:07 GMT
208
324
 
209
325
  ## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.15)
210
326
 
211
- Fri, 01 Oct 2021 14:13:08 GMT
327
+ Fri, 01 Oct 2021 14:13:08 GMT
212
328
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.13..@fluentui/react-switch_v9.0.0-alpha.15)
213
329
 
214
330
  ### Changes
@@ -227,7 +343,7 @@ Fri, 01 Oct 2021 14:13:08 GMT
227
343
 
228
344
  ## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.13)
229
345
 
230
- Fri, 01 Oct 2021 09:44:56 GMT
346
+ Fri, 01 Oct 2021 09:44:56 GMT
231
347
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.12..@fluentui/react-switch_v9.0.0-alpha.13)
232
348
 
233
349
  ### Changes
@@ -238,7 +354,7 @@ Fri, 01 Oct 2021 09:44:56 GMT
238
354
 
239
355
  ## [9.0.0-alpha.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.12)
240
356
 
241
- Wed, 29 Sep 2021 08:06:11 GMT
357
+ Wed, 29 Sep 2021 08:06:11 GMT
242
358
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.11..@fluentui/react-switch_v9.0.0-alpha.12)
243
359
 
244
360
  ### Changes
@@ -255,7 +371,7 @@ Wed, 29 Sep 2021 08:06:11 GMT
255
371
 
256
372
  ## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.11)
257
373
 
258
- Mon, 27 Sep 2021 08:06:00 GMT
374
+ Mon, 27 Sep 2021 08:06:00 GMT
259
375
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.10..@fluentui/react-switch_v9.0.0-alpha.11)
260
376
 
261
377
  ### Changes
@@ -271,7 +387,7 @@ Mon, 27 Sep 2021 08:06:00 GMT
271
387
 
272
388
  ## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.10)
273
389
 
274
- Fri, 24 Sep 2021 09:17:17 GMT
390
+ Fri, 24 Sep 2021 09:17:17 GMT
275
391
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.9..@fluentui/react-switch_v9.0.0-alpha.10)
276
392
 
277
393
  ### Changes
@@ -287,7 +403,7 @@ Fri, 24 Sep 2021 09:17:17 GMT
287
403
 
288
404
  ## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.9)
289
405
 
290
- Thu, 23 Sep 2021 08:21:34 GMT
406
+ Thu, 23 Sep 2021 08:21:34 GMT
291
407
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.8..@fluentui/react-switch_v9.0.0-alpha.9)
292
408
 
293
409
  ### Changes
@@ -304,7 +420,7 @@ Thu, 23 Sep 2021 08:21:34 GMT
304
420
 
305
421
  ## [9.0.0-alpha.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.8)
306
422
 
307
- Wed, 22 Sep 2021 10:10:07 GMT
423
+ Wed, 22 Sep 2021 10:10:07 GMT
308
424
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.7..@fluentui/react-switch_v9.0.0-alpha.8)
309
425
 
310
426
  ### Changes
@@ -321,7 +437,7 @@ Wed, 22 Sep 2021 10:10:07 GMT
321
437
 
322
438
  ## [9.0.0-alpha.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.7)
323
439
 
324
- Tue, 21 Sep 2021 07:42:34 GMT
440
+ Tue, 21 Sep 2021 07:42:34 GMT
325
441
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.6..@fluentui/react-switch_v9.0.0-alpha.7)
326
442
 
327
443
  ### Changes
@@ -338,7 +454,7 @@ Tue, 21 Sep 2021 07:42:34 GMT
338
454
 
339
455
  ## [9.0.0-alpha.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.6)
340
456
 
341
- Mon, 20 Sep 2021 07:36:26 GMT
457
+ Mon, 20 Sep 2021 07:36:26 GMT
342
458
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.5..@fluentui/react-switch_v9.0.0-alpha.6)
343
459
 
344
460
  ### Changes
@@ -347,7 +463,7 @@ Mon, 20 Sep 2021 07:36:26 GMT
347
463
 
348
464
  ## [9.0.0-alpha.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.5)
349
465
 
350
- Fri, 17 Sep 2021 07:35:26 GMT
466
+ Fri, 17 Sep 2021 07:35:26 GMT
351
467
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.4..@fluentui/react-switch_v9.0.0-alpha.5)
352
468
 
353
469
  ### Changes
@@ -356,7 +472,7 @@ Fri, 17 Sep 2021 07:35:26 GMT
356
472
 
357
473
  ## [9.0.0-alpha.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.4)
358
474
 
359
- Thu, 16 Sep 2021 07:38:39 GMT
475
+ Thu, 16 Sep 2021 07:38:39 GMT
360
476
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.3..@fluentui/react-switch_v9.0.0-alpha.4)
361
477
 
362
478
  ### Changes
@@ -366,7 +482,7 @@ Thu, 16 Sep 2021 07:38:39 GMT
366
482
 
367
483
  ## [9.0.0-alpha.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.3)
368
484
 
369
- Tue, 14 Sep 2021 20:09:02 GMT
485
+ Tue, 14 Sep 2021 20:09:02 GMT
370
486
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.2..@fluentui/react-switch_v9.0.0-alpha.3)
371
487
 
372
488
  ### Changes
@@ -375,7 +491,7 @@ Tue, 14 Sep 2021 20:09:02 GMT
375
491
 
376
492
  ## [9.0.0-alpha.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.2)
377
493
 
378
- Fri, 10 Sep 2021 16:31:53 GMT
494
+ Fri, 10 Sep 2021 16:31:53 GMT
379
495
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.1..@fluentui/react-switch_v9.0.0-alpha.2)
380
496
 
381
497
  ### Changes
@@ -385,7 +501,7 @@ Fri, 10 Sep 2021 16:31:53 GMT
385
501
 
386
502
  ## [9.0.0-alpha.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.1)
387
503
 
388
- Fri, 10 Sep 2021 07:39:51 GMT
504
+ Fri, 10 Sep 2021 07:39:51 GMT
389
505
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.1)
390
506
 
391
507
  ### Changes
@@ -394,7 +510,7 @@ Fri, 10 Sep 2021 07:39:51 GMT
394
510
 
395
511
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
396
512
 
397
- Mon, 06 Sep 2021 07:34:53 GMT
513
+ Mon, 06 Sep 2021 07:34:53 GMT
398
514
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
399
515
 
400
516
  ### Changes
@@ -403,7 +519,7 @@ Mon, 06 Sep 2021 07:34:53 GMT
403
519
 
404
520
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
405
521
 
406
- Thu, 02 Sep 2021 07:36:46 GMT
522
+ Thu, 02 Sep 2021 07:36:46 GMT
407
523
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
408
524
 
409
525
  ### Patches
@@ -416,7 +532,7 @@ Thu, 02 Sep 2021 07:36:46 GMT
416
532
 
417
533
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
418
534
 
419
- Wed, 01 Sep 2021 07:39:56 GMT
535
+ Wed, 01 Sep 2021 07:39:56 GMT
420
536
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
421
537
 
422
538
  ### Changes
@@ -425,7 +541,7 @@ Wed, 01 Sep 2021 07:39:56 GMT
425
541
 
426
542
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
427
543
 
428
- Tue, 31 Aug 2021 07:37:47 GMT
544
+ Tue, 31 Aug 2021 07:37:47 GMT
429
545
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
430
546
 
431
547
  ### Changes
@@ -434,7 +550,7 @@ Tue, 31 Aug 2021 07:37:47 GMT
434
550
 
435
551
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
436
552
 
437
- Fri, 27 Aug 2021 07:33:32 GMT
553
+ Fri, 27 Aug 2021 07:33:32 GMT
438
554
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
439
555
 
440
556
  ### Changes
@@ -443,7 +559,7 @@ Fri, 27 Aug 2021 07:33:32 GMT
443
559
 
444
560
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
445
561
 
446
- Thu, 26 Aug 2021 07:35:43 GMT
562
+ Thu, 26 Aug 2021 07:35:43 GMT
447
563
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
448
564
 
449
565
  ### Changes
@@ -452,7 +568,7 @@ Thu, 26 Aug 2021 07:35:43 GMT
452
568
 
453
569
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
454
570
 
455
- Fri, 20 Aug 2021 07:37:28 GMT
571
+ Fri, 20 Aug 2021 07:37:28 GMT
456
572
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
457
573
 
458
574
  ### Changes
@@ -461,7 +577,7 @@ Fri, 20 Aug 2021 07:37:28 GMT
461
577
 
462
578
  ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.0.0-alpha.0)
463
579
 
464
- Thu, 19 Aug 2021 07:41:35 GMT
580
+ Thu, 19 Aug 2021 07:41:35 GMT
465
581
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.0.0-alpha.0..@fluentui/react-switch_v9.0.0-alpha.0)
466
582
 
467
583
  ### 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
- ## Propery mapping
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
- **React Switch components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
3
+ **Switch components for [Fluent UI React](https://aka.ms/fluentui-storybook)**
4
4
 
5
- The `Switch` control (formerly `Toggle`) enables users to trigger an option on or off through pressing on the component.
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={true} />
30
- <Switch checked={switchValue} onChange={switchOnChange} />
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](https://github.com/microsoft/fluentui/blob/master/packages/react-switch/src/components/Switch/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
 
@@ -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 SwitchCommons = {
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> & SwitchCommons;
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;AACtF,QAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;AAEA,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AAEA,SAAO,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
+ {"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\ntype SwitchCommons = {\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 * @default false\n */\n checked?: 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\nexport type SwitchOnChangeData = {\n checked: boolean;\n};\n\n/**\n * Switch Props\n */\nexport type SwitchProps = Omit<ComponentProps<Partial<SwitchSlots>, 'input'>, 'onChange'> &\n Partial<SwitchCommons> & {\n /**\n * Defines whether the Switch is initially in a checked state or not when rendered.\n * @default false\n */\n defaultChecked?: boolean;\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> & SwitchCommons;\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;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAc,KAAd,CAArC;AACA,QAAM;AAAE,IAAA;AAAF,MAAoB,KAA1B;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CADF,EAEG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,CAF/C,eAGE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,SAAP,EAAgB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAhB,CAHF,EAIG,aAAa,KAAK,OAAlB,IAA6B,KAAK,CAAC,KAAnC,iBAA4C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;AAAf,GAAZ,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
+ {"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/"}