@fluentui/react-button 9.5.3 → 9.6.1
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 +25 -2
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.styles.raw.js +488 -0
- package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +241 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js +112 -0
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js +158 -0
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +226 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
- package/lib/contexts/ButtonContext.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js +495 -0
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +253 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js +129 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js +174 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js +237 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useToggleState.js.map +1 -1
- package/package.json +5 -5
@@ -0,0 +1,237 @@
|
|
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
|
+
toggleButtonClassNames: function() {
|
13
|
+
return toggleButtonClassNames;
|
14
|
+
},
|
15
|
+
useToggleButtonStyles_unstable: function() {
|
16
|
+
return useToggleButtonStyles_unstable;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
const _reacticons = require("@fluentui/react-icons");
|
20
|
+
const _reacttabster = require("@fluentui/react-tabster");
|
21
|
+
const _reacttheme = require("@fluentui/react-theme");
|
22
|
+
const _react = require("@griffel/react");
|
23
|
+
const _useButtonStylesstyles = require("../Button/useButtonStyles.styles");
|
24
|
+
const toggleButtonClassNames = {
|
25
|
+
root: 'fui-ToggleButton',
|
26
|
+
icon: 'fui-ToggleButton__icon'
|
27
|
+
};
|
28
|
+
const useRootCheckedStyles = (0, _react.makeStyles)({
|
29
|
+
// Base styles
|
30
|
+
base: {
|
31
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Selected,
|
32
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1),
|
33
|
+
color: _reacttheme.tokens.colorNeutralForeground1Selected,
|
34
|
+
..._react.shorthands.borderWidth(_reacttheme.tokens.strokeWidthThin),
|
35
|
+
[`& .${_reacticons.iconFilledClassName}`]: {
|
36
|
+
display: 'inline'
|
37
|
+
},
|
38
|
+
[`& .${_reacticons.iconRegularClassName}`]: {
|
39
|
+
display: 'none'
|
40
|
+
},
|
41
|
+
':hover': {
|
42
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Hover,
|
43
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Hover),
|
44
|
+
color: _reacttheme.tokens.colorNeutralForeground1Hover
|
45
|
+
},
|
46
|
+
':hover:active': {
|
47
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground1Pressed,
|
48
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1Pressed),
|
49
|
+
color: _reacttheme.tokens.colorNeutralForeground1Pressed
|
50
|
+
}
|
51
|
+
},
|
52
|
+
// High contrast styles
|
53
|
+
highContrast: {
|
54
|
+
'@media (forced-colors: active)': {
|
55
|
+
backgroundColor: 'Highlight',
|
56
|
+
..._react.shorthands.borderColor('Highlight'),
|
57
|
+
color: 'HighlightText',
|
58
|
+
forcedColorAdjust: 'none',
|
59
|
+
':hover': {
|
60
|
+
backgroundColor: 'HighlightText',
|
61
|
+
..._react.shorthands.borderColor('Highlight'),
|
62
|
+
color: 'Highlight'
|
63
|
+
},
|
64
|
+
':hover:active': {
|
65
|
+
backgroundColor: 'HighlightText',
|
66
|
+
..._react.shorthands.borderColor('Highlight'),
|
67
|
+
color: 'Highlight'
|
68
|
+
},
|
69
|
+
':focus': {
|
70
|
+
border: '1px solid HighlightText',
|
71
|
+
outlineColor: 'Highlight'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
// Appearance variations
|
76
|
+
outline: {
|
77
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundSelected,
|
78
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1),
|
79
|
+
..._react.shorthands.borderWidth(_reacttheme.tokens.strokeWidthThicker),
|
80
|
+
':hover': {
|
81
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundHover
|
82
|
+
},
|
83
|
+
':hover:active': {
|
84
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundPressed
|
85
|
+
},
|
86
|
+
...(0, _reacttabster.createCustomFocusIndicatorStyle)({
|
87
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStroke1)
|
88
|
+
})
|
89
|
+
},
|
90
|
+
primary: {
|
91
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundSelected,
|
92
|
+
..._react.shorthands.borderColor('transparent'),
|
93
|
+
color: _reacttheme.tokens.colorNeutralForegroundOnBrand,
|
94
|
+
':hover': {
|
95
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundHover,
|
96
|
+
..._react.shorthands.borderColor('transparent'),
|
97
|
+
color: _reacttheme.tokens.colorNeutralForegroundOnBrand
|
98
|
+
},
|
99
|
+
':hover:active': {
|
100
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundPressed,
|
101
|
+
..._react.shorthands.borderColor('transparent'),
|
102
|
+
color: _reacttheme.tokens.colorNeutralForegroundOnBrand
|
103
|
+
}
|
104
|
+
},
|
105
|
+
secondary: {},
|
106
|
+
subtle: {
|
107
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundSelected,
|
108
|
+
..._react.shorthands.borderColor('transparent'),
|
109
|
+
color: _reacttheme.tokens.colorNeutralForeground2Selected,
|
110
|
+
':hover': {
|
111
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundHover,
|
112
|
+
..._react.shorthands.borderColor('transparent'),
|
113
|
+
color: _reacttheme.tokens.colorNeutralForeground2Hover
|
114
|
+
},
|
115
|
+
':hover:active': {
|
116
|
+
backgroundColor: _reacttheme.tokens.colorSubtleBackgroundPressed,
|
117
|
+
..._react.shorthands.borderColor('transparent'),
|
118
|
+
color: _reacttheme.tokens.colorNeutralForeground2Pressed
|
119
|
+
}
|
120
|
+
},
|
121
|
+
transparent: {
|
122
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundSelected,
|
123
|
+
..._react.shorthands.borderColor('transparent'),
|
124
|
+
color: _reacttheme.tokens.colorNeutralForeground2BrandSelected,
|
125
|
+
':hover': {
|
126
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundHover,
|
127
|
+
..._react.shorthands.borderColor('transparent'),
|
128
|
+
color: _reacttheme.tokens.colorNeutralForeground2BrandHover
|
129
|
+
},
|
130
|
+
':hover:active': {
|
131
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundPressed,
|
132
|
+
..._react.shorthands.borderColor('transparent'),
|
133
|
+
color: _reacttheme.tokens.colorNeutralForeground2BrandPressed
|
134
|
+
}
|
135
|
+
}
|
136
|
+
});
|
137
|
+
const useRootDisabledStyles = (0, _react.makeStyles)({
|
138
|
+
// Base styles
|
139
|
+
base: {
|
140
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackgroundDisabled,
|
141
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStrokeDisabled),
|
142
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled,
|
143
|
+
':hover': {
|
144
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackgroundDisabled,
|
145
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStrokeDisabled),
|
146
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
147
|
+
},
|
148
|
+
':hover:active': {
|
149
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackgroundDisabled,
|
150
|
+
..._react.shorthands.borderColor(_reacttheme.tokens.colorNeutralStrokeDisabled),
|
151
|
+
color: _reacttheme.tokens.colorNeutralForegroundDisabled
|
152
|
+
}
|
153
|
+
},
|
154
|
+
// Appearance variations
|
155
|
+
outline: {},
|
156
|
+
primary: {
|
157
|
+
..._react.shorthands.borderColor('transparent'),
|
158
|
+
':hover': {
|
159
|
+
..._react.shorthands.borderColor('transparent')
|
160
|
+
},
|
161
|
+
':hover:active': {
|
162
|
+
..._react.shorthands.borderColor('transparent')
|
163
|
+
}
|
164
|
+
},
|
165
|
+
secondary: {},
|
166
|
+
subtle: {
|
167
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
168
|
+
..._react.shorthands.borderColor('transparent'),
|
169
|
+
':hover': {
|
170
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundHover,
|
171
|
+
..._react.shorthands.borderColor('transparent')
|
172
|
+
},
|
173
|
+
':hover:active': {
|
174
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundPressed,
|
175
|
+
..._react.shorthands.borderColor('transparent')
|
176
|
+
}
|
177
|
+
},
|
178
|
+
transparent: {
|
179
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackground,
|
180
|
+
..._react.shorthands.borderColor('transparent'),
|
181
|
+
':hover': {
|
182
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundHover,
|
183
|
+
..._react.shorthands.borderColor('transparent')
|
184
|
+
},
|
185
|
+
':hover:active': {
|
186
|
+
backgroundColor: _reacttheme.tokens.colorTransparentBackgroundPressed,
|
187
|
+
..._react.shorthands.borderColor('transparent')
|
188
|
+
}
|
189
|
+
}
|
190
|
+
});
|
191
|
+
const useIconCheckedStyles = (0, _react.makeStyles)({
|
192
|
+
// Appearance variations
|
193
|
+
subtleOrTransparent: {
|
194
|
+
color: _reacttheme.tokens.colorNeutralForeground2BrandSelected
|
195
|
+
},
|
196
|
+
// High contrast styles
|
197
|
+
highContrast: {
|
198
|
+
'@media (forced-colors: active)': {
|
199
|
+
forcedColorAdjust: 'auto'
|
200
|
+
}
|
201
|
+
}
|
202
|
+
});
|
203
|
+
const usePrimaryHighContrastStyles = (0, _react.makeStyles)({
|
204
|
+
// Do not use primary variant high contrast styles for toggle buttons
|
205
|
+
// otherwise there isn't enough difference between on/off states
|
206
|
+
base: {
|
207
|
+
'@media (forced-colors: active)': {
|
208
|
+
backgroundColor: 'ButtonFace',
|
209
|
+
..._react.shorthands.borderColor('ButtonBorder'),
|
210
|
+
color: 'ButtonText',
|
211
|
+
forcedColorAdjust: 'auto'
|
212
|
+
}
|
213
|
+
},
|
214
|
+
disabled: {
|
215
|
+
'@media (forced-colors: active)': {
|
216
|
+
..._react.shorthands.borderColor('GrayText'),
|
217
|
+
color: 'GrayText',
|
218
|
+
':focus': {
|
219
|
+
..._react.shorthands.borderColor('GrayText')
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
});
|
224
|
+
const useToggleButtonStyles_unstable = (state)=>{
|
225
|
+
'use no memo';
|
226
|
+
const rootCheckedStyles = useRootCheckedStyles();
|
227
|
+
const rootDisabledStyles = useRootDisabledStyles();
|
228
|
+
const iconCheckedStyles = useIconCheckedStyles();
|
229
|
+
const primaryHighContrastStyles = usePrimaryHighContrastStyles();
|
230
|
+
const { appearance, checked, disabled, disabledFocusable } = state;
|
231
|
+
state.root.className = (0, _react.mergeClasses)(toggleButtonClassNames.root, appearance === 'primary' && primaryHighContrastStyles.base, appearance === 'primary' && (disabled || disabledFocusable) && primaryHighContrastStyles.disabled, checked && rootCheckedStyles.base, checked && rootCheckedStyles.highContrast, appearance && checked && rootCheckedStyles[appearance], (disabled || disabledFocusable) && rootDisabledStyles.base, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance], state.root.className);
|
232
|
+
if (state.icon) {
|
233
|
+
state.icon.className = (0, _react.mergeClasses)(toggleButtonClassNames.icon, checked && (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent, iconCheckedStyles.highContrast, state.icon.className);
|
234
|
+
}
|
235
|
+
(0, _useButtonStylesstyles.useButtonStyles_unstable)(state);
|
236
|
+
return state;
|
237
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/ToggleButton/useToggleButtonStyles.styles.ts"],"sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots } from '../Button/Button.types';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nexport const toggleButtonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-ToggleButton',\n icon: 'fui-ToggleButton__icon',\n};\n\nconst useRootCheckedStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n color: tokens.colorNeutralForeground1Selected,\n\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n backgroundColor: 'Highlight',\n ...shorthands.borderColor('Highlight'),\n color: 'HighlightText',\n forcedColorAdjust: 'none',\n\n ':hover': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n },\n\n ':focus': {\n border: '1px solid HighlightText',\n outlineColor: 'Highlight',\n },\n },\n },\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n\n ...createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n }),\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Selected,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nconst useRootDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useIconCheckedStyles = makeStyles({\n // Appearance variations\n subtleOrTransparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n },\n },\n});\n\nconst usePrimaryHighContrastStyles = makeStyles({\n // Do not use primary variant high contrast styles for toggle buttons\n // otherwise there isn't enough difference between on/off states\n base: {\n '@media (forced-colors: active)': {\n backgroundColor: 'ButtonFace',\n ...shorthands.borderColor('ButtonBorder'),\n color: 'ButtonText',\n forcedColorAdjust: 'auto',\n },\n },\n\n disabled: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n\n ':focus': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n 'use no memo';\n\n const rootCheckedStyles = useRootCheckedStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const iconCheckedStyles = useIconCheckedStyles();\n const primaryHighContrastStyles = usePrimaryHighContrastStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Primary high contrast styles\n appearance === 'primary' && primaryHighContrastStyles.base,\n appearance === 'primary' && (disabled || disabledFocusable) && primaryHighContrastStyles.disabled,\n\n // Checked styles\n checked && rootCheckedStyles.base,\n checked && rootCheckedStyles.highContrast,\n appearance && checked && rootCheckedStyles[appearance],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootDisabledStyles.base,\n appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n toggleButtonClassNames.icon,\n checked && (appearance === 'subtle' || appearance === 'transparent') && iconCheckedStyles.subtleOrTransparent,\n iconCheckedStyles.highContrast,\n state.icon.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["iconFilledClassName","iconRegularClassName","createCustomFocusIndicatorStyle","tokens","shorthands","mergeClasses","makeStyles","useButtonStyles_unstable","toggleButtonClassNames","root","icon","useRootCheckedStyles","base","backgroundColor","colorNeutralBackground1Selected","borderColor","colorNeutralStroke1","color","colorNeutralForeground1Selected","borderWidth","strokeWidthThin","display","colorNeutralBackground1Hover","colorNeutralStroke1Hover","colorNeutralForeground1Hover","colorNeutralBackground1Pressed","colorNeutralStroke1Pressed","colorNeutralForeground1Pressed","highContrast","forcedColorAdjust","border","outlineColor","outline","colorTransparentBackgroundSelected","strokeWidthThicker","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","primary","colorBrandBackgroundSelected","colorNeutralForegroundOnBrand","colorBrandBackgroundHover","colorBrandBackgroundPressed","secondary","subtle","colorSubtleBackgroundSelected","colorNeutralForeground2Selected","colorSubtleBackgroundHover","colorNeutralForeground2Hover","colorSubtleBackgroundPressed","colorNeutralForeground2Pressed","transparent","colorNeutralForeground2BrandSelected","colorNeutralForeground2BrandHover","colorNeutralForeground2BrandPressed","useRootDisabledStyles","colorNeutralBackgroundDisabled","colorNeutralStrokeDisabled","colorNeutralForegroundDisabled","colorTransparentBackground","useIconCheckedStyles","subtleOrTransparent","usePrimaryHighContrastStyles","disabled","useToggleButtonStyles_unstable","state","rootCheckedStyles","rootDisabledStyles","iconCheckedStyles","primaryHighContrastStyles","appearance","checked","disabledFocusable","className"],"mappings":";;;;;;;;;;;IASaQ,sBAAAA;;;kCAgPAuD;eAAAA;;;4BAzP6C,wBAAwB;8BAClC,0BAA0B;4BACnD,wBAAwB;uBACM,iBAAiB;uCAC7B,mCAAmC;AAKrE,+BAA4D;IACjEtD,MAAM;IACNC,MAAM;AACR,EAAE;AAEF,MAAMC,2BAAuBL,iBAAAA,EAAW;IACtC,cAAc;IACdM,MAAM;QACJC,iBAAiBV,kBAAAA,CAAOW,+BAA+B;QACvD,GAAGV,iBAAAA,CAAWW,WAAW,CAACZ,kBAAAA,CAAOa,mBAAmB,CAAC;QACrDC,OAAOd,kBAAAA,CAAOe,+BAA+B;QAE7C,GAAGd,iBAAAA,CAAWe,WAAW,CAAChB,kBAAAA,CAAOiB,eAAe,CAAC;QAEjD,CAAC,CAAC,GAAG,EAAEpB,+BAAAA,EAAqB,CAAC,EAAE;YAC7BqB,SAAS;QACX;QACA,CAAC,CAAC,GAAG,EAAEpB,gCAAAA,EAAsB,CAAC,EAAE;YAC9BoB,SAAS;QACX;QAEA,UAAU;YACRR,iBAAiBV,kBAAAA,CAAOmB,4BAA4B;YACpD,GAAGlB,iBAAAA,CAAWW,WAAW,CAACZ,kBAAAA,CAAOoB,wBAAwB,CAAC;YAC1DN,OAAOd,kBAAAA,CAAOqB,4BAA4B;QAC5C;QAEA,iBAAiB;YACfX,iBAAiBV,kBAAAA,CAAOsB,8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AGtD,AADA,AACCP,CAAAA,YAAYS,KADK,YACLA,CAAgB,IAAML,mBAAmBtD,IAAI,EAC1DyD,cAAeP,CAAAA,YAAYS,iBAAAA,CAAgB,IAAML,kBAAkB,CAACG,WAAW,EAE/E,AACAL,MAAMvD,IAAI,CAAC+D,SAAS,OADO;IAI7B,IAAIR,MAAMtD,IAAI,EAAE;QACdsD,MAAMtD,IAAI,CAAC8D,SAAS,OAAGnE,mBAAAA,EACrBG,uBAAuBE,IAAI,EAC3B4D,WAAYD,CAAAA,eAAe,YAAYA,eAAe,aAAA,CAAY,IAAMF,kBAAkBP,mBAAmB,EAC7GO,kBAAkBvC,YAAY,EAC9BoC,MAAMtD,IAAI,CAAC8D,SAAS;IAExB;QAEAjE,+CAAAA,EAAyByD;IAEzB,OAAOA;AACT,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/contexts/ButtonContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { ButtonSize } from '../components/Button/Button.types';\n\nconst buttonContext = React.createContext<ButtonContextValue | undefined>(undefined);\n\n/**\n * @internal\n * Internal context value used to update default values between internal components\n */\nexport interface ButtonContextValue {\n size?: ButtonSize;\n}\n\nconst buttonContextDefaultValue: ButtonContextValue = {};\n\n/**\n * @internal\n * Internal context provider used to update default values between internal components\n */\nexport const ButtonContextProvider = buttonContext.Provider;\n\n/**\n * @internal\n * Internal context hook used to update default values between internal components\n */\nexport const useButtonContext = () => React.useContext(buttonContext) ?? buttonContextDefaultValue;\n"],"names":["
|
1
|
+
{"version":3,"sources":["../src/contexts/ButtonContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { ButtonSize } from '../components/Button/Button.types';\n\nconst buttonContext = React.createContext<ButtonContextValue | undefined>(undefined);\n\n/**\n * @internal\n * Internal context value used to update default values between internal components\n */\nexport interface ButtonContextValue {\n size?: ButtonSize;\n}\n\nconst buttonContextDefaultValue: ButtonContextValue = {};\n\n/**\n * @internal\n * Internal context provider used to update default values between internal components\n */\nexport const ButtonContextProvider = buttonContext.Provider;\n\n/**\n * @internal\n * Internal context hook used to update default values between internal components\n */\nexport const useButtonContext = () => React.useContext(buttonContext) ?? buttonContextDefaultValue;\n"],"names":["React","buttonContext","createContext","undefined","buttonContextDefaultValue","ButtonContextProvider","Provider","useButtonContext","useContext"],"mappings":";;;;;;;;;;;IAmBaK,qBAAAA;;;oBAMAE;;;;;iEAzBU,QAAQ;AAG/B,MAAMN,8BAAgBD,OAAME,aAAa,CAAiCC;AAU1E,MAAMC,4BAAgD,CAAC;AAMhD,8BAA8BH,cAAcK,QAAQ,CAAC;AAMrD,MAAMC,mBAAmB;QAAMP;WAAAA,CAAAA,oBAAAA,OAAMQ,UAAU,CAACP,cAAAA,MAAAA,QAAjBD,sBAAAA,KAAAA,IAAAA,oBAAmCI;EAA0B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { ButtonContextValue } from './ButtonContext';\nexport { ButtonContextProvider, useButtonContext } from './ButtonContext';\n"],"names":["ButtonContextProvider","useButtonContext"],"
|
1
|
+
{"version":3,"sources":["../src/contexts/index.ts"],"sourcesContent":["export type { ButtonContextValue } from './ButtonContext';\nexport { ButtonContextProvider, useButtonContext } from './ButtonContext';\n"],"names":["ButtonContextProvider","useButtonContext"],"mappings":";;;;;;;;;;;;eACSA,oCAAqB;;;eAAEC,+BAAgB;;;+BAAQ,kBAAkB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n"],"names":["Button","
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable","MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable","ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleState","ButtonContextProvider","useButtonContext"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;;eA0CC0B,6BAAqB;;;eAlC5BrB,8BAAc;;;eAQdK,sBAAU;;eAQC;eAAXK;;gBAQY;eAAZK;;;eA/BAnB,wBAAgB;;;eAQhBK,wCAAwB;;wBAQJ;eAApBK;;;eAfAT,6BAAqB;;iCAQQ;eAA7BK;;6BAQyB;eAAzBK;;;eAOAI,uCAA0B;;;eAQ1BK,yCAA2B;;;eAP3BJ,kCAAqB;;;eAQrBK,oCAAsB;;IAQQK;uCAAgB;;;eAvC9CxB,gCAAwB;;;eACxBC,0BAAkB;;;eAOlBI,gDAAgC;;;eAChCC,0CAA0B;;;eAO1BI,wCAA4B;;;eAC5BC,kCAAsB;;;eAOtBI,0CAA6B;;;eAC7BC,oCAAuB;;IAOvBI;2DAA8B;;;eAC9BC,sCAAwB;;;eAIjBC,qBAAc;;;wBAnChB,WAAW;gCAQX,mBAAmB;4BAQnB,eAAe;6BAQf,gBAAgB;8BAQhB,iBAAiB;uBAGO,gBAAgB;wBAES,mBAAmB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useToggleState } from './useToggleState';\n"],"names":["useToggleState"],"
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { useToggleState } from './useToggleState';\n"],"names":["useToggleState"],"mappings":";;;;;;;eAASA,8BAAc;;;gCAAQ,mBAAmB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/useToggleState.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>,\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n (ev: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useEventCallback(\n mergeCallbacks(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>, onToggleClick),\n ),\n },\n } as TToggleButtonState;\n}\n"],"names":["useToggleState","props","state","checked","defaultChecked","disabled","disabledFocusable","onClick","role","root","checkedValue","setCheckedValue","
|
1
|
+
{"version":3,"sources":["../src/utils/useToggleState.ts"],"sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>,\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n (ev: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useEventCallback(\n mergeCallbacks(onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>, onToggleClick),\n ),\n },\n } as TToggleButtonState;\n}\n"],"names":["React","mergeCallbacks","useControllableState","useEventCallback","useToggleState","props","state","checked","defaultChecked","disabled","disabledFocusable","onClick","role","root","checkedValue","setCheckedValue","defaultState","initialState","isCheckboxTypeRole","onToggleClick","useCallback","ev","defaultPrevented"],"mappings":";;;;+BAKgBI;;;;;;;iEALO,QAAQ;gCACwC,4BAA4B;AAI5F,wBAILC,KAAyB,EAAEC,KAAmB;IAC9C,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE,GAAGL;IACjE,MAAM,EAAEM,OAAO,EAAEC,IAAI,EAAE,GAAGN,MAAMO,IAAI;IAEpC,MAAM,CAACC,cAAcC,gBAAgB,OAAGb,oCAAAA,EAAqB;QAC3DI,OAAOC;QACPS,cAAcR;QACdS,cAAc;IAChB;IAEA,MAAMC,qBAAqBN,SAAS,sBAAsBA,SAAS;IAEnE,MAAMO,gBAAgBnB,OAAMoB,WAAW,CACrC,CAACC;QACC,IAAI,CAACZ,YAAY,CAACC,mBAAmB;YACnC,IAAIW,GAAGC,gBAAgB,EAAE;gBACvB;YACF;YAEAP,gBAAgB,CAACD;QACnB;IACF,GACA;QAACA;QAAcL;QAAUC;QAAmBK;KAAgB;IAG9D,OAAO;QACL,GAAGT,KAAK;QAERC,SAASO;QAETD,MAAM;YACJ,GAAGP,MAAMO,IAAI;YACb,CAACK,qBAAqB,iBAAiB,eAAe,EAAEJ;YACxDH,aAASR,gCAAAA,MACPF,8BAAAA,EAAeU,SAA2EQ;QAE9F;IACF;AACF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-button",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.6.1",
|
4
4
|
"description": "Fluent UI React Button component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -20,13 +20,13 @@
|
|
20
20
|
},
|
21
21
|
"dependencies": {
|
22
22
|
"@fluentui/keyboard-keys": "^9.0.8",
|
23
|
-
"@fluentui/react-aria": "^9.
|
23
|
+
"@fluentui/react-aria": "^9.16.0",
|
24
24
|
"@fluentui/react-icons": "^2.0.245",
|
25
|
-
"@fluentui/react-jsx-runtime": "^9.1.
|
25
|
+
"@fluentui/react-jsx-runtime": "^9.1.3",
|
26
26
|
"@fluentui/react-shared-contexts": "^9.24.0",
|
27
|
-
"@fluentui/react-tabster": "^9.
|
27
|
+
"@fluentui/react-tabster": "^9.26.1",
|
28
28
|
"@fluentui/react-theme": "^9.1.24",
|
29
|
-
"@fluentui/react-utilities": "^9.
|
29
|
+
"@fluentui/react-utilities": "^9.23.0",
|
30
30
|
"@griffel/react": "^1.5.22",
|
31
31
|
"@swc/helpers": "^0.5.1"
|
32
32
|
},
|