@fluentui/react-switch 9.3.7 → 9.4.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.md +14 -2
- package/lib/components/Switch/useSwitchStyles.styles.raw.js +247 -0
- package/lib/components/Switch/useSwitchStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.js +264 -0
- package/lib-commonjs/components/Switch/useSwitchStyles.styles.raw.js.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
# Change Log - @fluentui/react-switch
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 17 Jul 2025 13:45:47 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.4.0)
|
8
|
+
|
9
|
+
Thu, 17 Jul 2025 13:45:47 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.3.7..@fluentui/react-switch_v9.4.0)
|
11
|
+
|
12
|
+
### Minor changes
|
13
|
+
|
14
|
+
- feat: enable griffel raw styles ([PR #34853](https://github.com/microsoft/fluentui/pull/34853) by martinhochel@microsoft.com)
|
15
|
+
- Bump @fluentui/react-field to v9.4.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
16
|
+
- Bump @fluentui/react-label to v9.3.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
17
|
+
- Bump @fluentui/react-tabster to v9.26.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
|
18
|
+
|
7
19
|
## [9.3.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-switch_v9.3.7)
|
8
20
|
|
9
|
-
Fri, 11 Jul 2025 15:
|
21
|
+
Fri, 11 Jul 2025 15:59:24 GMT
|
10
22
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-switch_v9.3.6..@fluentui/react-switch_v9.3.7)
|
11
23
|
|
12
24
|
### Patches
|
@@ -0,0 +1,247 @@
|
|
1
|
+
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
3
|
+
import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';
|
4
|
+
export const switchClassNames = {
|
5
|
+
root: 'fui-Switch',
|
6
|
+
indicator: 'fui-Switch__indicator',
|
7
|
+
input: 'fui-Switch__input',
|
8
|
+
label: 'fui-Switch__label'
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* @deprecated Use `switchClassNames.root` instead.
|
12
|
+
*/ export const switchClassName = switchClassNames.root;
|
13
|
+
// Thumb and track sizes used by the component.
|
14
|
+
const spaceBetweenThumbAndTrack = 2;
|
15
|
+
const trackHeight = 20;
|
16
|
+
const trackWidth = 40;
|
17
|
+
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
18
|
+
const useRootBaseClassName = makeResetStyles({
|
19
|
+
alignItems: 'flex-start',
|
20
|
+
boxSizing: 'border-box',
|
21
|
+
display: 'inline-flex',
|
22
|
+
position: 'relative',
|
23
|
+
...createFocusOutlineStyle({
|
24
|
+
style: {},
|
25
|
+
selector: 'focus-within'
|
26
|
+
})
|
27
|
+
});
|
28
|
+
const useRootStyles = makeStyles({
|
29
|
+
vertical: {
|
30
|
+
flexDirection: 'column'
|
31
|
+
}
|
32
|
+
});
|
33
|
+
const useIndicatorBaseClassName = makeResetStyles({
|
34
|
+
borderRadius: tokens.borderRadiusCircular,
|
35
|
+
border: '1px solid',
|
36
|
+
lineHeight: 0,
|
37
|
+
boxSizing: 'border-box',
|
38
|
+
fill: 'currentColor',
|
39
|
+
flexShrink: 0,
|
40
|
+
fontSize: `${thumbSize}px`,
|
41
|
+
height: `${trackHeight}px`,
|
42
|
+
margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,
|
43
|
+
pointerEvents: 'none',
|
44
|
+
transitionDuration: tokens.durationNormal,
|
45
|
+
transitionTimingFunction: tokens.curveEasyEase,
|
46
|
+
transitionProperty: 'background, border, color',
|
47
|
+
width: `${trackWidth}px`,
|
48
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
49
|
+
transitionDuration: '0.01ms'
|
50
|
+
},
|
51
|
+
'@media (forced-colors: active)': {
|
52
|
+
color: 'CanvasText',
|
53
|
+
'> i': {
|
54
|
+
forcedColorAdjust: 'none'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
'> *': {
|
58
|
+
transitionDuration: tokens.durationNormal,
|
59
|
+
transitionTimingFunction: tokens.curveEasyEase,
|
60
|
+
transitionProperty: 'transform',
|
61
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
62
|
+
transitionDuration: '0.01ms'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
});
|
66
|
+
const useIndicatorStyles = makeStyles({
|
67
|
+
labelAbove: {
|
68
|
+
marginTop: 0
|
69
|
+
}
|
70
|
+
});
|
71
|
+
const useInputBaseClassName = makeResetStyles({
|
72
|
+
boxSizing: 'border-box',
|
73
|
+
cursor: 'pointer',
|
74
|
+
height: '100%',
|
75
|
+
margin: 0,
|
76
|
+
opacity: 0,
|
77
|
+
position: 'absolute',
|
78
|
+
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
79
|
+
// This is done so that clicking on that "empty space" still toggles the switch.
|
80
|
+
width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,
|
81
|
+
// Checked (both enabled and disabled)
|
82
|
+
':checked': {
|
83
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
84
|
+
'> *': {
|
85
|
+
transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`
|
86
|
+
}
|
87
|
+
}
|
88
|
+
},
|
89
|
+
// Disabled (both checked and unchecked)
|
90
|
+
':disabled': {
|
91
|
+
cursor: 'default',
|
92
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
93
|
+
color: tokens.colorNeutralForegroundDisabled
|
94
|
+
},
|
95
|
+
[`& ~ .${switchClassNames.label}`]: {
|
96
|
+
cursor: 'default',
|
97
|
+
color: tokens.colorNeutralForegroundDisabled
|
98
|
+
}
|
99
|
+
},
|
100
|
+
// Enabled and unchecked
|
101
|
+
':enabled:not(:checked)': {
|
102
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
103
|
+
color: tokens.colorNeutralStrokeAccessible,
|
104
|
+
borderColor: tokens.colorNeutralStrokeAccessible
|
105
|
+
},
|
106
|
+
[`& ~ .${switchClassNames.label}`]: {
|
107
|
+
color: tokens.colorNeutralForeground1
|
108
|
+
},
|
109
|
+
':hover': {
|
110
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
111
|
+
color: tokens.colorNeutralStrokeAccessibleHover,
|
112
|
+
borderColor: tokens.colorNeutralStrokeAccessibleHover
|
113
|
+
}
|
114
|
+
},
|
115
|
+
':hover:active': {
|
116
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
117
|
+
color: tokens.colorNeutralStrokeAccessiblePressed,
|
118
|
+
borderColor: tokens.colorNeutralStrokeAccessiblePressed
|
119
|
+
}
|
120
|
+
}
|
121
|
+
},
|
122
|
+
// Enabled and checked
|
123
|
+
':enabled:checked': {
|
124
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
125
|
+
backgroundColor: tokens.colorCompoundBrandBackground,
|
126
|
+
color: tokens.colorNeutralForegroundInverted,
|
127
|
+
borderColor: tokens.colorTransparentStroke
|
128
|
+
},
|
129
|
+
':hover': {
|
130
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
131
|
+
backgroundColor: tokens.colorCompoundBrandBackgroundHover,
|
132
|
+
borderColor: tokens.colorTransparentStrokeInteractive
|
133
|
+
}
|
134
|
+
},
|
135
|
+
':hover:active': {
|
136
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
137
|
+
backgroundColor: tokens.colorCompoundBrandBackgroundPressed,
|
138
|
+
borderColor: tokens.colorTransparentStrokeInteractive
|
139
|
+
}
|
140
|
+
}
|
141
|
+
},
|
142
|
+
// Disabled and unchecked
|
143
|
+
':disabled:not(:checked)': {
|
144
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
145
|
+
borderColor: tokens.colorNeutralStrokeDisabled
|
146
|
+
}
|
147
|
+
},
|
148
|
+
// Disabled and checked
|
149
|
+
':disabled:checked': {
|
150
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
151
|
+
backgroundColor: tokens.colorNeutralBackgroundDisabled,
|
152
|
+
borderColor: tokens.colorTransparentStrokeDisabled
|
153
|
+
}
|
154
|
+
},
|
155
|
+
'@media (forced-colors: active)': {
|
156
|
+
':disabled': {
|
157
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
158
|
+
color: 'GrayText',
|
159
|
+
borderColor: 'GrayText'
|
160
|
+
},
|
161
|
+
[`& ~ .${switchClassNames.label}`]: {
|
162
|
+
color: 'GrayText'
|
163
|
+
}
|
164
|
+
},
|
165
|
+
':hover': {
|
166
|
+
color: 'CanvasText'
|
167
|
+
},
|
168
|
+
':hover:active': {
|
169
|
+
color: 'CanvasText'
|
170
|
+
},
|
171
|
+
':enabled:checked': {
|
172
|
+
':hover': {
|
173
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
174
|
+
backgroundColor: 'Highlight',
|
175
|
+
color: 'Canvas'
|
176
|
+
}
|
177
|
+
},
|
178
|
+
':hover:active': {
|
179
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
180
|
+
backgroundColor: 'Highlight',
|
181
|
+
color: 'Canvas'
|
182
|
+
}
|
183
|
+
},
|
184
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
185
|
+
backgroundColor: 'Highlight',
|
186
|
+
color: 'Canvas'
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
});
|
191
|
+
const useInputStyles = makeStyles({
|
192
|
+
before: {
|
193
|
+
right: 0,
|
194
|
+
top: 0
|
195
|
+
},
|
196
|
+
after: {
|
197
|
+
left: 0,
|
198
|
+
top: 0
|
199
|
+
},
|
200
|
+
above: {
|
201
|
+
bottom: 0,
|
202
|
+
height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,
|
203
|
+
width: '100%'
|
204
|
+
}
|
205
|
+
});
|
206
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
207
|
+
const useLabelStyles = makeStyles({
|
208
|
+
base: {
|
209
|
+
cursor: 'pointer',
|
210
|
+
// Use a (negative) margin to account for the difference between the track's height and the label's line height.
|
211
|
+
// This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.
|
212
|
+
marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,
|
213
|
+
marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,
|
214
|
+
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`
|
215
|
+
},
|
216
|
+
above: {
|
217
|
+
paddingTop: tokens.spacingVerticalXS,
|
218
|
+
paddingBottom: tokens.spacingVerticalXS,
|
219
|
+
width: '100%'
|
220
|
+
},
|
221
|
+
after: {
|
222
|
+
paddingLeft: tokens.spacingHorizontalXS
|
223
|
+
},
|
224
|
+
before: {
|
225
|
+
paddingRight: tokens.spacingHorizontalXS
|
226
|
+
}
|
227
|
+
});
|
228
|
+
/**
|
229
|
+
* Apply styling to the Switch slots based on the state
|
230
|
+
*/ export const useSwitchStyles_unstable = (state)=>{
|
231
|
+
'use no memo';
|
232
|
+
const rootBaseClassName = useRootBaseClassName();
|
233
|
+
const rootStyles = useRootStyles();
|
234
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
235
|
+
const indicatorStyles = useIndicatorStyles();
|
236
|
+
const inputBaseClassName = useInputBaseClassName();
|
237
|
+
const inputStyles = useInputStyles();
|
238
|
+
const labelStyles = useLabelStyles();
|
239
|
+
const { label, labelPosition } = state;
|
240
|
+
state.root.className = mergeClasses(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
|
241
|
+
state.indicator.className = mergeClasses(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
|
242
|
+
state.input.className = mergeClasses(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
|
243
|
+
if (state.label) {
|
244
|
+
state.label.className = mergeClasses(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
|
245
|
+
}
|
246
|
+
return state;
|
247
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/Switch/useSwitchStyles.styles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '@media (forced-colors: active)': {\n color: 'CanvasText',\n '> i': {\n forcedColorAdjust: 'none',\n },\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n ':hover': {\n color: 'CanvasText',\n },\n ':hover:active': {\n color: 'CanvasText',\n },\n ':enabled:checked': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["createFocusOutlineStyle","tokens","makeResetStyles","makeStyles","mergeClasses","switchClassNames","root","indicator","input","label","switchClassName","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","alignItems","boxSizing","display","position","style","selector","useRootStyles","vertical","flexDirection","useIndicatorBaseClassName","borderRadius","borderRadiusCircular","border","lineHeight","fill","flexShrink","fontSize","height","margin","spacingVerticalS","spacingHorizontalS","pointerEvents","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","color","forcedColorAdjust","useIndicatorStyles","labelAbove","marginTop","useInputBaseClassName","cursor","opacity","transform","colorNeutralForegroundDisabled","colorNeutralStrokeAccessible","borderColor","colorNeutralForeground1","colorNeutralStrokeAccessibleHover","colorNeutralStrokeAccessiblePressed","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","colorNeutralStrokeDisabled","colorNeutralBackgroundDisabled","colorTransparentStrokeDisabled","useInputStyles","before","right","top","after","left","above","bottom","useLabelStyles","base","marginBottom","lineHeightBase300","padding","paddingTop","spacingVerticalXS","paddingBottom","paddingLeft","spacingHorizontalXS","paddingRight","useSwitchStyles_unstable","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
switchClassName: function() {
|
13
|
+
return switchClassName;
|
14
|
+
},
|
15
|
+
switchClassNames: function() {
|
16
|
+
return switchClassNames;
|
17
|
+
},
|
18
|
+
useSwitchStyles_unstable: function() {
|
19
|
+
return useSwitchStyles_unstable;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
23
|
+
const _reacttheme = require("@fluentui/react-theme");
|
24
|
+
const _react = require("@griffel/react");
|
25
|
+
const switchClassNames = {
|
26
|
+
root: 'fui-Switch',
|
27
|
+
indicator: 'fui-Switch__indicator',
|
28
|
+
input: 'fui-Switch__input',
|
29
|
+
label: 'fui-Switch__label'
|
30
|
+
};
|
31
|
+
const switchClassName = switchClassNames.root;
|
32
|
+
// Thumb and track sizes used by the component.
|
33
|
+
const spaceBetweenThumbAndTrack = 2;
|
34
|
+
const trackHeight = 20;
|
35
|
+
const trackWidth = 40;
|
36
|
+
const thumbSize = trackHeight - spaceBetweenThumbAndTrack;
|
37
|
+
const useRootBaseClassName = (0, _react.makeResetStyles)({
|
38
|
+
alignItems: 'flex-start',
|
39
|
+
boxSizing: 'border-box',
|
40
|
+
display: 'inline-flex',
|
41
|
+
position: 'relative',
|
42
|
+
...(0, _reacttabster.createFocusOutlineStyle)({
|
43
|
+
style: {},
|
44
|
+
selector: 'focus-within'
|
45
|
+
})
|
46
|
+
});
|
47
|
+
const useRootStyles = (0, _react.makeStyles)({
|
48
|
+
vertical: {
|
49
|
+
flexDirection: 'column'
|
50
|
+
}
|
51
|
+
});
|
52
|
+
const useIndicatorBaseClassName = (0, _react.makeResetStyles)({
|
53
|
+
borderRadius: _reacttheme.tokens.borderRadiusCircular,
|
54
|
+
border: '1px solid',
|
55
|
+
lineHeight: 0,
|
56
|
+
boxSizing: 'border-box',
|
57
|
+
fill: 'currentColor',
|
58
|
+
flexShrink: 0,
|
59
|
+
fontSize: `${thumbSize}px`,
|
60
|
+
height: `${trackHeight}px`,
|
61
|
+
margin: _reacttheme.tokens.spacingVerticalS + ' ' + _reacttheme.tokens.spacingHorizontalS,
|
62
|
+
pointerEvents: 'none',
|
63
|
+
transitionDuration: _reacttheme.tokens.durationNormal,
|
64
|
+
transitionTimingFunction: _reacttheme.tokens.curveEasyEase,
|
65
|
+
transitionProperty: 'background, border, color',
|
66
|
+
width: `${trackWidth}px`,
|
67
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
68
|
+
transitionDuration: '0.01ms'
|
69
|
+
},
|
70
|
+
'@media (forced-colors: active)': {
|
71
|
+
color: 'CanvasText',
|
72
|
+
'> i': {
|
73
|
+
forcedColorAdjust: 'none'
|
74
|
+
}
|
75
|
+
},
|
76
|
+
'> *': {
|
77
|
+
transitionDuration: _reacttheme.tokens.durationNormal,
|
78
|
+
transitionTimingFunction: _reacttheme.tokens.curveEasyEase,
|
79
|
+
transitionProperty: 'transform',
|
80
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
81
|
+
transitionDuration: '0.01ms'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
});
|
85
|
+
const useIndicatorStyles = (0, _react.makeStyles)({
|
86
|
+
labelAbove: {
|
87
|
+
marginTop: 0
|
88
|
+
}
|
89
|
+
});
|
90
|
+
const useInputBaseClassName = (0, _react.makeResetStyles)({
|
91
|
+
boxSizing: 'border-box',
|
92
|
+
cursor: 'pointer',
|
93
|
+
height: '100%',
|
94
|
+
margin: 0,
|
95
|
+
opacity: 0,
|
96
|
+
position: 'absolute',
|
97
|
+
// Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.
|
98
|
+
// This is done so that clicking on that "empty space" still toggles the switch.
|
99
|
+
width: `calc(${trackWidth}px + 2 * ${_reacttheme.tokens.spacingHorizontalS})`,
|
100
|
+
// Checked (both enabled and disabled)
|
101
|
+
':checked': {
|
102
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
103
|
+
'> *': {
|
104
|
+
transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`
|
105
|
+
}
|
106
|
+
}
|
107
|
+
},
|
108
|
+
// Disabled (both checked and unchecked)
|
109
|
+
':disabled': {
|
110
|
+
cursor: 'default',
|
111
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
112
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
113
|
+
},
|
114
|
+
[`& ~ .${switchClassNames.label}`]: {
|
115
|
+
cursor: 'default',
|
116
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
117
|
+
}
|
118
|
+
},
|
119
|
+
// Enabled and unchecked
|
120
|
+
':enabled:not(:checked)': {
|
121
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
122
|
+
color: _reacttheme.tokens.colorNeutralStrokeAccessible,
|
123
|
+
borderColor: _reacttheme.tokens.colorNeutralStrokeAccessible
|
124
|
+
},
|
125
|
+
[`& ~ .${switchClassNames.label}`]: {
|
126
|
+
color: _reacttheme.tokens.colorNeutralForeground1
|
127
|
+
},
|
128
|
+
':hover': {
|
129
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
130
|
+
color: _reacttheme.tokens.colorNeutralStrokeAccessibleHover,
|
131
|
+
borderColor: _reacttheme.tokens.colorNeutralStrokeAccessibleHover
|
132
|
+
}
|
133
|
+
},
|
134
|
+
':hover:active': {
|
135
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
136
|
+
color: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed,
|
137
|
+
borderColor: _reacttheme.tokens.colorNeutralStrokeAccessiblePressed
|
138
|
+
}
|
139
|
+
}
|
140
|
+
},
|
141
|
+
// Enabled and checked
|
142
|
+
':enabled:checked': {
|
143
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
144
|
+
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackground,
|
145
|
+
color: _reacttheme.tokens.colorNeutralForegroundInverted,
|
146
|
+
borderColor: _reacttheme.tokens.colorTransparentStroke
|
147
|
+
},
|
148
|
+
':hover': {
|
149
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
150
|
+
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackgroundHover,
|
151
|
+
borderColor: _reacttheme.tokens.colorTransparentStrokeInteractive
|
152
|
+
}
|
153
|
+
},
|
154
|
+
':hover:active': {
|
155
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
156
|
+
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackgroundPressed,
|
157
|
+
borderColor: _reacttheme.tokens.colorTransparentStrokeInteractive
|
158
|
+
}
|
159
|
+
}
|
160
|
+
},
|
161
|
+
// Disabled and unchecked
|
162
|
+
':disabled:not(:checked)': {
|
163
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
164
|
+
borderColor: _reacttheme.tokens.colorNeutralStrokeDisabled
|
165
|
+
}
|
166
|
+
},
|
167
|
+
// Disabled and checked
|
168
|
+
':disabled:checked': {
|
169
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
170
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackgroundDisabled,
|
171
|
+
borderColor: _reacttheme.tokens.colorTransparentStrokeDisabled
|
172
|
+
}
|
173
|
+
},
|
174
|
+
'@media (forced-colors: active)': {
|
175
|
+
':disabled': {
|
176
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
177
|
+
color: 'GrayText',
|
178
|
+
borderColor: 'GrayText'
|
179
|
+
},
|
180
|
+
[`& ~ .${switchClassNames.label}`]: {
|
181
|
+
color: 'GrayText'
|
182
|
+
}
|
183
|
+
},
|
184
|
+
':hover': {
|
185
|
+
color: 'CanvasText'
|
186
|
+
},
|
187
|
+
':hover:active': {
|
188
|
+
color: 'CanvasText'
|
189
|
+
},
|
190
|
+
':enabled:checked': {
|
191
|
+
':hover': {
|
192
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
193
|
+
backgroundColor: 'Highlight',
|
194
|
+
color: 'Canvas'
|
195
|
+
}
|
196
|
+
},
|
197
|
+
':hover:active': {
|
198
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
199
|
+
backgroundColor: 'Highlight',
|
200
|
+
color: 'Canvas'
|
201
|
+
}
|
202
|
+
},
|
203
|
+
[`& ~ .${switchClassNames.indicator}`]: {
|
204
|
+
backgroundColor: 'Highlight',
|
205
|
+
color: 'Canvas'
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
});
|
210
|
+
const useInputStyles = (0, _react.makeStyles)({
|
211
|
+
before: {
|
212
|
+
right: 0,
|
213
|
+
top: 0
|
214
|
+
},
|
215
|
+
after: {
|
216
|
+
left: 0,
|
217
|
+
top: 0
|
218
|
+
},
|
219
|
+
above: {
|
220
|
+
bottom: 0,
|
221
|
+
height: `calc(${trackHeight}px + ${_reacttheme.tokens.spacingVerticalS})`,
|
222
|
+
width: '100%'
|
223
|
+
}
|
224
|
+
});
|
225
|
+
// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.
|
226
|
+
const useLabelStyles = (0, _react.makeStyles)({
|
227
|
+
base: {
|
228
|
+
cursor: 'pointer',
|
229
|
+
// Use a (negative) margin to account for the difference between the track's height and the label's line height.
|
230
|
+
// This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.
|
231
|
+
marginBottom: `calc((${trackHeight}px - ${_reacttheme.tokens.lineHeightBase300}) / 2)`,
|
232
|
+
marginTop: `calc((${trackHeight}px - ${_reacttheme.tokens.lineHeightBase300}) / 2)`,
|
233
|
+
padding: `${_reacttheme.tokens.spacingVerticalS} ${_reacttheme.tokens.spacingHorizontalS}`
|
234
|
+
},
|
235
|
+
above: {
|
236
|
+
paddingTop: _reacttheme.tokens.spacingVerticalXS,
|
237
|
+
paddingBottom: _reacttheme.tokens.spacingVerticalXS,
|
238
|
+
width: '100%'
|
239
|
+
},
|
240
|
+
after: {
|
241
|
+
paddingLeft: _reacttheme.tokens.spacingHorizontalXS
|
242
|
+
},
|
243
|
+
before: {
|
244
|
+
paddingRight: _reacttheme.tokens.spacingHorizontalXS
|
245
|
+
}
|
246
|
+
});
|
247
|
+
const useSwitchStyles_unstable = (state)=>{
|
248
|
+
'use no memo';
|
249
|
+
const rootBaseClassName = useRootBaseClassName();
|
250
|
+
const rootStyles = useRootStyles();
|
251
|
+
const indicatorBaseClassName = useIndicatorBaseClassName();
|
252
|
+
const indicatorStyles = useIndicatorStyles();
|
253
|
+
const inputBaseClassName = useInputBaseClassName();
|
254
|
+
const inputStyles = useInputStyles();
|
255
|
+
const labelStyles = useLabelStyles();
|
256
|
+
const { label, labelPosition } = state;
|
257
|
+
state.root.className = (0, _react.mergeClasses)(switchClassNames.root, rootBaseClassName, labelPosition === 'above' && rootStyles.vertical, state.root.className);
|
258
|
+
state.indicator.className = (0, _react.mergeClasses)(switchClassNames.indicator, indicatorBaseClassName, label && labelPosition === 'above' && indicatorStyles.labelAbove, state.indicator.className);
|
259
|
+
state.input.className = (0, _react.mergeClasses)(switchClassNames.input, inputBaseClassName, label && inputStyles[labelPosition], state.input.className);
|
260
|
+
if (state.label) {
|
261
|
+
state.label.className = (0, _react.mergeClasses)(switchClassNames.label, labelStyles.base, labelStyles[labelPosition], state.label.className);
|
262
|
+
}
|
263
|
+
return state;
|
264
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/Switch/useSwitchStyles.styles.ts"],"sourcesContent":["import { createFocusOutlineStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SwitchSlots, SwitchState } from './Switch.types';\n\nexport const switchClassNames: SlotClassNames<SwitchSlots> = {\n root: 'fui-Switch',\n indicator: 'fui-Switch__indicator',\n input: 'fui-Switch__input',\n label: 'fui-Switch__label',\n};\n\n/**\n * @deprecated Use `switchClassNames.root` instead.\n */\nexport const switchClassName = switchClassNames.root;\n\n// Thumb and track sizes used by the component.\nconst spaceBetweenThumbAndTrack = 2;\nconst trackHeight = 20;\nconst trackWidth = 40;\nconst thumbSize = trackHeight - spaceBetweenThumbAndTrack;\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'flex-start',\n boxSizing: 'border-box',\n display: 'inline-flex',\n position: 'relative',\n\n ...createFocusOutlineStyle({ style: {}, selector: 'focus-within' }),\n});\n\nconst useRootStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n});\n\nconst useIndicatorBaseClassName = makeResetStyles({\n borderRadius: tokens.borderRadiusCircular,\n border: '1px solid',\n lineHeight: 0,\n boxSizing: 'border-box',\n fill: 'currentColor',\n flexShrink: 0,\n fontSize: `${thumbSize}px`,\n height: `${trackHeight}px`,\n margin: tokens.spacingVerticalS + ' ' + tokens.spacingHorizontalS,\n pointerEvents: 'none',\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'background, border, color',\n width: `${trackWidth}px`,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n\n '@media (forced-colors: active)': {\n color: 'CanvasText',\n '> i': {\n forcedColorAdjust: 'none',\n },\n },\n\n '> *': {\n transitionDuration: tokens.durationNormal,\n transitionTimingFunction: tokens.curveEasyEase,\n transitionProperty: 'transform',\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n});\n\nconst useIndicatorStyles = makeStyles({\n labelAbove: {\n marginTop: 0,\n },\n});\n\nconst useInputBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n cursor: 'pointer',\n height: '100%',\n margin: 0,\n opacity: 0,\n position: 'absolute',\n\n // Calculate the width of the hidden input by taking into account the size of the indicator + the padding around it.\n // This is done so that clicking on that \"empty space\" still toggles the switch.\n width: `calc(${trackWidth}px + 2 * ${tokens.spacingHorizontalS})`,\n\n // Checked (both enabled and disabled)\n ':checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n '> *': {\n transform: `translateX(${trackWidth - thumbSize - spaceBetweenThumbAndTrack}px)`,\n },\n },\n },\n\n // Disabled (both checked and unchecked)\n ':disabled': {\n cursor: 'default',\n\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n cursor: 'default',\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Enabled and unchecked\n ':enabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessible,\n borderColor: tokens.colorNeutralStrokeAccessible,\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: tokens.colorNeutralForeground1,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessibleHover,\n borderColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: tokens.colorNeutralStrokeAccessiblePressed,\n borderColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n // Enabled and checked\n ':enabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n color: tokens.colorNeutralForegroundInverted,\n borderColor: tokens.colorTransparentStroke,\n },\n\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundHover,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorCompoundBrandBackgroundPressed,\n borderColor: tokens.colorTransparentStrokeInteractive,\n },\n },\n },\n\n // Disabled and unchecked\n ':disabled:not(:checked)': {\n [`& ~ .${switchClassNames.indicator}`]: {\n borderColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n // Disabled and checked\n ':disabled:checked': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n borderColor: tokens.colorTransparentStrokeDisabled,\n },\n },\n\n '@media (forced-colors: active)': {\n ':disabled': {\n [`& ~ .${switchClassNames.indicator}`]: {\n color: 'GrayText',\n borderColor: 'GrayText',\n },\n\n [`& ~ .${switchClassNames.label}`]: {\n color: 'GrayText',\n },\n },\n ':hover': {\n color: 'CanvasText',\n },\n ':hover:active': {\n color: 'CanvasText',\n },\n ':enabled:checked': {\n ':hover': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n ':hover:active': {\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n [`& ~ .${switchClassNames.indicator}`]: {\n backgroundColor: 'Highlight',\n color: 'Canvas',\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n before: {\n right: 0,\n top: 0,\n },\n after: {\n left: 0,\n top: 0,\n },\n above: {\n bottom: 0,\n height: `calc(${trackHeight}px + ${tokens.spacingVerticalS})`,\n width: '100%',\n },\n});\n\n// Can't use makeResetStyles here because Label is a component that may itself use makeResetStyles.\nconst useLabelStyles = makeStyles({\n base: {\n cursor: 'pointer',\n\n // Use a (negative) margin to account for the difference between the track's height and the label's line height.\n // This prevents the label from expanding the height of the switch, but preserves line height if the label wraps.\n marginBottom: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n marginTop: `calc((${trackHeight}px - ${tokens.lineHeightBase300}) / 2)`,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n },\n above: {\n paddingTop: tokens.spacingVerticalXS,\n paddingBottom: tokens.spacingVerticalXS,\n width: '100%',\n },\n after: {\n paddingLeft: tokens.spacingHorizontalXS,\n },\n before: {\n paddingRight: tokens.spacingHorizontalXS,\n },\n});\n\n/**\n * Apply styling to the Switch slots based on the state\n */\nexport const useSwitchStyles_unstable = (state: SwitchState): SwitchState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const indicatorBaseClassName = useIndicatorBaseClassName();\n const indicatorStyles = useIndicatorStyles();\n const inputBaseClassName = useInputBaseClassName();\n const inputStyles = useInputStyles();\n const labelStyles = useLabelStyles();\n\n const { label, labelPosition } = state;\n\n state.root.className = mergeClasses(\n switchClassNames.root,\n rootBaseClassName,\n labelPosition === 'above' && rootStyles.vertical,\n state.root.className,\n );\n\n state.indicator.className = mergeClasses(\n switchClassNames.indicator,\n indicatorBaseClassName,\n label && labelPosition === 'above' && indicatorStyles.labelAbove,\n state.indicator.className,\n );\n\n state.input.className = mergeClasses(\n switchClassNames.input,\n inputBaseClassName,\n label && inputStyles[labelPosition],\n state.input.className,\n );\n\n if (state.label) {\n state.label.className = mergeClasses(\n switchClassNames.label,\n labelStyles.base,\n labelStyles[labelPosition],\n state.label.className,\n );\n }\n\n return state;\n};\n"],"names":["switchClassName","switchClassNames","useSwitchStyles_unstable","root","indicator","input","label","spaceBetweenThumbAndTrack","trackHeight","trackWidth","thumbSize","useRootBaseClassName","makeResetStyles","alignItems","boxSizing","display","position","createFocusOutlineStyle","style","selector","useRootStyles","makeStyles","vertical","flexDirection","useIndicatorBaseClassName","borderRadius","tokens","borderRadiusCircular","border","lineHeight","fill","flexShrink","fontSize","height","margin","spacingVerticalS","spacingHorizontalS","pointerEvents","transitionDuration","durationNormal","transitionTimingFunction","curveEasyEase","transitionProperty","width","color","forcedColorAdjust","useIndicatorStyles","labelAbove","marginTop","useInputBaseClassName","cursor","opacity","transform","colorNeutralForegroundDisabled","colorNeutralStrokeAccessible","borderColor","colorNeutralForeground1","colorNeutralStrokeAccessibleHover","colorNeutralStrokeAccessiblePressed","backgroundColor","colorCompoundBrandBackground","colorNeutralForegroundInverted","colorTransparentStroke","colorCompoundBrandBackgroundHover","colorTransparentStrokeInteractive","colorCompoundBrandBackgroundPressed","colorNeutralStrokeDisabled","colorNeutralBackgroundDisabled","colorTransparentStrokeDisabled","useInputStyles","before","right","top","after","left","above","bottom","useLabelStyles","base","marginBottom","lineHeightBase300","padding","paddingTop","spacingVerticalXS","paddingBottom","paddingLeft","spacingHorizontalXS","paddingRight","state","rootBaseClassName","rootStyles","indicatorBaseClassName","indicatorStyles","inputBaseClassName","inputStyles","labelStyles","labelPosition","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAgBaA,eAAAA;eAAAA;;IAVAC,gBAAAA;eAAAA;;IAiQAC,wBAAAA;eAAAA;;;8BAvQ2B;4BACjB;uBACmC;AAInD,MAAMD,mBAAgD;IAC3DE,MAAM;IACNC,WAAW;IACXC,OAAO;IACPC,OAAO;AACT;AAKO,MAAMN,kBAAkBC,iBAAiBE,IAAI;AAEpD,+CAA+C;AAC/C,MAAMI,4BAA4B;AAClC,MAAMC,cAAc;AACpB,MAAMC,aAAa;AACnB,MAAMC,YAAYF,cAAcD;AAEhC,MAAMI,uBAAuBC,IAAAA,sBAAAA,EAAgB;IAC3CC,YAAY;IACZC,WAAW;IACXC,SAAS;IACTC,UAAU;IAEV,GAAGC,IAAAA,qCAAAA,EAAwB;QAAEC,OAAO,CAAC;QAAGC,UAAU;IAAe,EAAE;AACrE;AAEA,MAAMC,gBAAgBC,IAAAA,iBAAAA,EAAW;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AC1B,MAAM+E,aAAatE;IACnB,MAAMuE,yBAAyBnE;IAC/B,MAAMoE,kBAAkB9C;IACxB,MAAM+C,qBAAqB5C;IAC3B,MAAM6C,cAAczB;IACpB,MAAM0B,cAAclB;IAEpB,MAAM,EAAEvE,KAAK,EAAE0F,aAAa,EAAE,GAAGR;IAEjCA,MAAMrF,IAAI,CAAC8F,SAAS,GAAGC,IAAAA,mBAAAA,EACrBjG,iBAAiBE,IAAI,EACrBsF,mBACAO,kBAAkB,WAAWN,WAAWpE,QAAQ,EAChDkE,MAAMrF,IAAI,CAAC8F,SAAS;IAGtBT,MAAMpF,SAAS,CAAC6F,SAAS,GAAGC,IAAAA,mBAAAA,EAC1BjG,iBAAiBG,SAAS,EAC1BuF,wBACArF,SAAS0F,kBAAkB,WAAWJ,gBAAgB7C,UAAU,EAChEyC,MAAMpF,SAAS,CAAC6F,SAAS;IAG3BT,MAAMnF,KAAK,CAAC4F,SAAS,GAAGC,IAAAA,mBAAAA,EACtBjG,iBAAiBI,KAAK,EACtBwF,oBACAvF,SAASwF,WAAW,CAACE,cAAc,EACnCR,MAAMnF,KAAK,CAAC4F,SAAS;IAGvB,IAAIT,MAAMlF,KAAK,EAAE;QACfkF,MAAMlF,KAAK,CAAC2F,SAAS,GAAGC,IAAAA,mBAAAA,EACtBjG,iBAAiBK,KAAK,EACtByF,YAAYjB,IAAI,EAChBiB,WAAW,CAACC,cAAc,EAC1BR,MAAMlF,KAAK,CAAC2F,SAAS;IAEzB;IAEA,OAAOT;AACT"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-switch",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.4.0",
|
4
4
|
"description": "Fluent UI React Switch component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -18,12 +18,12 @@
|
|
18
18
|
"@fluentui/scripts-api-extractor": "*"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@fluentui/react-field": "^9.
|
21
|
+
"@fluentui/react-field": "^9.4.0",
|
22
22
|
"@fluentui/react-icons": "^2.0.245",
|
23
23
|
"@fluentui/react-jsx-runtime": "^9.1.2",
|
24
|
-
"@fluentui/react-label": "^9.
|
24
|
+
"@fluentui/react-label": "^9.3.0",
|
25
25
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
26
|
-
"@fluentui/react-tabster": "^9.
|
26
|
+
"@fluentui/react-tabster": "^9.26.0",
|
27
27
|
"@fluentui/react-theme": "^9.1.24",
|
28
28
|
"@fluentui/react-utilities": "^9.22.0",
|
29
29
|
"@griffel/react": "^1.5.22",
|