@fluentui/react-button 0.0.0-nightly-20250702-0405.1 → 0.0.0-nightly-20250703-1103.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.
Files changed (22) hide show
  1. package/CHANGELOG.md +13 -13
  2. package/lib/components/Button/useButtonStyles.styles.raw.js +488 -0
  3. package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -0
  4. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +241 -0
  5. package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
  6. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js +112 -0
  7. package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
  8. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js +158 -0
  9. package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
  10. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +226 -0
  11. package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
  12. package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js +495 -0
  13. package/lib-commonjs/components/Button/useButtonStyles.styles.raw.js.map +1 -0
  14. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +253 -0
  15. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -0
  16. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js +129 -0
  17. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -0
  18. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js +174 -0
  19. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -0
  20. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js +237 -0
  21. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -0
  22. package/package.json +10 -10
@@ -0,0 +1,241 @@
1
+ import { tokens } from '@fluentui/react-theme';
2
+ import { mergeClasses, makeStyles } from '@griffel/react';
3
+ import { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';
4
+ export const compoundButtonClassNames = {
5
+ root: 'fui-CompoundButton',
6
+ icon: 'fui-CompoundButton__icon',
7
+ contentContainer: 'fui-CompoundButton__contentContainer',
8
+ secondaryContent: 'fui-CompoundButton__secondaryContent'
9
+ };
10
+ const useRootStyles = makeStyles({
11
+ // Base styles
12
+ base: {
13
+ height: 'auto',
14
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
15
+ color: tokens.colorNeutralForeground2
16
+ },
17
+ ':hover': {
18
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
19
+ color: tokens.colorNeutralForeground2Hover
20
+ }
21
+ },
22
+ ':hover:active': {
23
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
24
+ color: tokens.colorNeutralForeground2Pressed
25
+ }
26
+ }
27
+ },
28
+ // High contrast styles
29
+ highContrast: {
30
+ '@media (forced-colors: active)': {
31
+ ':hover': {
32
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
33
+ color: 'Highlight'
34
+ }
35
+ },
36
+ ':hover:active': {
37
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
38
+ color: 'Highlight'
39
+ }
40
+ }
41
+ }
42
+ },
43
+ // Appearance variations
44
+ outline: {
45
+ },
46
+ primary: {
47
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
48
+ color: tokens.colorNeutralForegroundOnBrand
49
+ },
50
+ ':hover': {
51
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
52
+ color: tokens.colorNeutralForegroundOnBrand
53
+ }
54
+ },
55
+ ':hover:active': {
56
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
57
+ color: tokens.colorNeutralForegroundOnBrand
58
+ }
59
+ },
60
+ '@media (forced-colors: active)': {
61
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
62
+ color: 'HighlightText'
63
+ }
64
+ }
65
+ },
66
+ secondary: {
67
+ },
68
+ subtle: {
69
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
70
+ color: tokens.colorNeutralForeground2
71
+ },
72
+ ':hover': {
73
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
74
+ color: tokens.colorNeutralForeground2Hover
75
+ }
76
+ },
77
+ ':hover:active': {
78
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
79
+ color: tokens.colorNeutralForeground2Pressed
80
+ }
81
+ },
82
+ '@media (forced-colors: active)': {
83
+ ':hover': {
84
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
85
+ color: 'Canvas'
86
+ }
87
+ },
88
+ ':hover:active': {
89
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
90
+ color: 'Canvas'
91
+ }
92
+ }
93
+ }
94
+ },
95
+ transparent: {
96
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
97
+ color: tokens.colorNeutralForeground2
98
+ },
99
+ ':hover': {
100
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
101
+ color: tokens.colorNeutralForeground2BrandHover
102
+ }
103
+ },
104
+ ':hover:active': {
105
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
106
+ color: tokens.colorNeutralForeground2BrandPressed
107
+ }
108
+ }
109
+ },
110
+ // Size variations
111
+ small: {
112
+ padding: `${tokens.spacingHorizontalS} ${tokens.spacingHorizontalS} ${tokens.spacingHorizontalMNudge} ${tokens.spacingHorizontalS}`,
113
+ fontSize: tokens.fontSizeBase300,
114
+ lineHeight: tokens.lineHeightBase300
115
+ },
116
+ medium: {
117
+ padding: `14px ${tokens.spacingHorizontalM} ${tokens.spacingHorizontalL} ${tokens.spacingHorizontalM}`,
118
+ fontSize: tokens.fontSizeBase300,
119
+ lineHeight: tokens.lineHeightBase300
120
+ },
121
+ large: {
122
+ padding: `18px ${tokens.spacingHorizontalL} ${tokens.spacingHorizontalXL} ${tokens.spacingHorizontalL}`,
123
+ fontSize: tokens.fontSizeBase400,
124
+ lineHeight: tokens.lineHeightBase400
125
+ },
126
+ // Disabled styles
127
+ disabled: {
128
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
129
+ color: tokens.colorNeutralForegroundDisabled
130
+ },
131
+ ':hover': {
132
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
133
+ color: tokens.colorNeutralForegroundDisabled
134
+ }
135
+ },
136
+ ':hover:active': {
137
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
138
+ color: tokens.colorNeutralForegroundDisabled
139
+ }
140
+ }
141
+ },
142
+ // Disabled high contrast styles
143
+ disabledHighContrast: {
144
+ '@media (forced-colors: active)': {
145
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
146
+ color: 'GrayText'
147
+ },
148
+ ':hover': {
149
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
150
+ color: 'GrayText'
151
+ }
152
+ },
153
+ ':hover:active': {
154
+ [`& .${compoundButtonClassNames.secondaryContent}`]: {
155
+ color: 'GrayText'
156
+ }
157
+ }
158
+ }
159
+ }
160
+ });
161
+ const useRootIconOnlyStyles = makeStyles({
162
+ // Size variations
163
+ small: {
164
+ padding: tokens.spacingHorizontalXS,
165
+ maxWidth: '48px',
166
+ minWidth: '48px'
167
+ },
168
+ medium: {
169
+ padding: tokens.spacingHorizontalSNudge,
170
+ maxWidth: '52px',
171
+ minWidth: '52px'
172
+ },
173
+ large: {
174
+ padding: tokens.spacingHorizontalS,
175
+ maxWidth: '56px',
176
+ minWidth: '56px'
177
+ }
178
+ });
179
+ const useIconStyles = makeStyles({
180
+ // Base styles
181
+ base: {
182
+ fontSize: '40px',
183
+ height: '40px',
184
+ width: '40px'
185
+ },
186
+ // Icon position variations
187
+ before: {
188
+ marginRight: tokens.spacingHorizontalM
189
+ },
190
+ after: {
191
+ marginLeft: tokens.spacingHorizontalM
192
+ }
193
+ });
194
+ const useContentContainerStyles = makeStyles({
195
+ // Base styles
196
+ base: {
197
+ display: 'flex',
198
+ flexDirection: 'column',
199
+ textAlign: 'left'
200
+ }
201
+ });
202
+ const useSecondaryContentStyles = makeStyles({
203
+ // Base styles
204
+ base: {
205
+ lineHeight: '100%',
206
+ fontWeight: tokens.fontWeightRegular
207
+ },
208
+ // Size variations
209
+ small: {
210
+ fontSize: tokens.fontSizeBase200
211
+ },
212
+ medium: {
213
+ fontSize: tokens.fontSizeBase200
214
+ },
215
+ large: {
216
+ fontSize: tokens.fontSizeBase300
217
+ }
218
+ });
219
+ export const useCompoundButtonStyles_unstable = (state)=>{
220
+ 'use no memo';
221
+ const rootStyles = useRootStyles();
222
+ const rootIconOnlyStyles = useRootIconOnlyStyles();
223
+ const iconStyles = useIconStyles();
224
+ const contentContainerStyles = useContentContainerStyles();
225
+ const secondaryContentStyles = useSecondaryContentStyles();
226
+ const { appearance, disabled, disabledFocusable, iconOnly, iconPosition, size } = state;
227
+ state.root.className = mergeClasses(compoundButtonClassNames.root, // Root styles
228
+ rootStyles.base, rootStyles.highContrast, appearance && rootStyles[appearance], rootStyles[size], // Disabled styles
229
+ (disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast, // Icon-only styles
230
+ iconOnly && rootIconOnlyStyles[size], // User provided class name
231
+ state.root.className);
232
+ state.contentContainer.className = mergeClasses(compoundButtonClassNames.contentContainer, contentContainerStyles.base, state.contentContainer.className);
233
+ if (state.icon) {
234
+ state.icon.className = mergeClasses(compoundButtonClassNames.icon, iconStyles.base, state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition], state.icon.className);
235
+ }
236
+ if (state.secondaryContent) {
237
+ state.secondaryContent.className = mergeClasses(compoundButtonClassNames.secondaryContent, secondaryContentStyles.base, secondaryContentStyles[size], state.secondaryContent.className);
238
+ }
239
+ useButtonStyles_unstable(state);
240
+ return state;
241
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/CompoundButton/useCompoundButtonStyles.styles.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\n\nexport const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots> = {\n root: 'fui-CompoundButton',\n icon: 'fui-CompoundButton__icon',\n contentContainer: 'fui-CompoundButton__contentContainer',\n secondaryContent: 'fui-CompoundButton__secondaryContent',\n};\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n height: 'auto',\n\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Highlight',\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Highlight',\n },\n },\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n '@media (forced-colors: active)': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'HighlightText',\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n\n '@media (forced-colors: active)': {\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Canvas',\n },\n },\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Canvas',\n },\n },\n },\n },\n transparent: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2BrandHover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n },\n\n // Size variations\n small: {\n padding: `${tokens.spacingHorizontalS} ${tokens.spacingHorizontalS} ${tokens.spacingHorizontalMNudge} ${tokens.spacingHorizontalS}`,\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n medium: {\n padding: `14px ${tokens.spacingHorizontalM} ${tokens.spacingHorizontalL} ${tokens.spacingHorizontalM}`,\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n large: {\n padding: `18px ${tokens.spacingHorizontalL} ${tokens.spacingHorizontalXL} ${tokens.spacingHorizontalL}`,\n\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n },\n\n // Disabled styles\n disabled: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n },\n },\n },\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n // Size variations\n small: {\n padding: tokens.spacingHorizontalXS,\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n padding: tokens.spacingHorizontalSNudge,\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n padding: tokens.spacingHorizontalS,\n\n maxWidth: '56px',\n minWidth: '56px',\n },\n});\n\nconst useIconStyles = makeStyles({\n // Base styles\n base: {\n fontSize: '40px',\n height: '40px',\n width: '40px',\n },\n\n // Icon position variations\n before: {\n marginRight: tokens.spacingHorizontalM,\n },\n after: {\n marginLeft: tokens.spacingHorizontalM,\n },\n});\n\nconst useContentContainerStyles = makeStyles({\n // Base styles\n base: {\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'left',\n },\n});\n\nconst useSecondaryContentStyles = makeStyles({\n // Base styles\n base: {\n lineHeight: '100%',\n fontWeight: tokens.fontWeightRegular,\n },\n\n // Size variations\n small: {\n fontSize: tokens.fontSizeBase200,\n },\n medium: {\n fontSize: tokens.fontSizeBase200,\n },\n large: {\n fontSize: tokens.fontSizeBase300,\n },\n});\n\nexport const useCompoundButtonStyles_unstable = (state: CompoundButtonState): CompoundButtonState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n const contentContainerStyles = useContentContainerStyles();\n const secondaryContentStyles = useSecondaryContentStyles();\n\n const { appearance, disabled, disabledFocusable, iconOnly, iconPosition, size } = state;\n\n state.root.className = mergeClasses(\n compoundButtonClassNames.root,\n\n // Root styles\n rootStyles.base,\n rootStyles.highContrast,\n appearance && rootStyles[appearance],\n rootStyles[size],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n\n // Icon-only styles\n iconOnly && rootIconOnlyStyles[size],\n\n // User provided class name\n state.root.className,\n );\n\n state.contentContainer.className = mergeClasses(\n compoundButtonClassNames.contentContainer,\n contentContainerStyles.base,\n state.contentContainer.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n compoundButtonClassNames.icon,\n iconStyles.base,\n state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition],\n state.icon.className,\n );\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n compoundButtonClassNames.secondaryContent,\n secondaryContentStyles.base,\n secondaryContentStyles[size],\n state.secondaryContent.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"names":["tokens","mergeClasses","makeStyles","useButtonStyles_unstable","compoundButtonClassNames","root","icon","contentContainer","secondaryContent","useRootStyles","base","height","color","colorNeutralForeground2","colorNeutralForeground2Hover","colorNeutralForeground2Pressed","highContrast","outline","primary","colorNeutralForegroundOnBrand","secondary","subtle","transparent","colorNeutralForeground2BrandHover","colorNeutralForeground2BrandPressed","small","padding","spacingHorizontalS","spacingHorizontalMNudge","fontSize","fontSizeBase300","lineHeight","lineHeightBase300","medium","spacingHorizontalM","spacingHorizontalL","large","spacingHorizontalXL","fontSizeBase400","lineHeightBase400","disabled","colorNeutralForegroundDisabled","disabledHighContrast","useRootIconOnlyStyles","spacingHorizontalXS","maxWidth","minWidth","spacingHorizontalSNudge","useIconStyles","width","before","marginRight","after","marginLeft","useContentContainerStyles","display","flexDirection","textAlign","useSecondaryContentStyles","fontWeight","fontWeightRegular","fontSizeBase200","useCompoundButtonStyles_unstable","state","rootStyles","rootIconOnlyStyles","iconStyles","contentContainerStyles","secondaryContentStyles","appearance","disabledFocusable","iconOnly","iconPosition","size","className","children","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,wBAAwB,QAAQ,mCAAmC;AAI5E,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;IACNC,MAAM;IACNC,kBAAkB;IAClBC,kBAAkB;AACpB,EAAE;AAEF,MAAMC,gBAAgBP,WAAW;IAC/B,cAAc;IACdQ,MAAM;QACJC,QAAQ;QAER,CAAC,CAAC,GAAG,EAAEP,yBAAyBI,gBAAgB,CAAC,CAAC,CAAC,EAAE;YACnDI,OAAOZ,OAAOa,uBAAuB;QACvC;QAEA,UAAU;YACR,CAAC,CAAC,GAAG,EAAET,yBAAyBI,gBAAgB,CAAC,CAAC,CAAC,EAAE;gBACnDI,OAAOZ,OAAOc,4BAA4B;YAC5C;QACF;QAEA,iBAAiB;YACf,CAAC,CAAC,GAAG,EAAEV,yBAAyBI,gBAAgB,CAAC,CAAC,CAAC,EAAE;gBACnDI,OAAOZ,OAAOe,8BAA8B;YAC9C;QACF;IACF;IAEA,uBAAuB;IACvBC,cAAc;QACZ,kCAAkC;YAChC,UAAU;gBACR,CAAC,CAAC,GAAG,EAAEZ,yBAAyBI,gBAAgB,CAAC,CAAC,CAAC,EAAE;oBACnDI,OAAO;gBACT;YACF;YAEA,iBAAiB;gBACf,CAAC,CAAC,GAAG,EAAER,yBAAyBI,gBAAgB,CAA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B4D,WAAWxD,IAAI,EACfqD,MAAM1D,IAAI,CAACsE,QAAQ,KAAKC,aAAab,MAAM1D,IAAI,CAACsE,QAAQ,KAAK,QAAQT,UAAU,CAACM,aAAa,EAC7FT,MAAMzD,IAAI,CAACoE,SAAS;IAExB;IAEA,IAAIX,MAAMvD,gBAAgB,EAAE;QAC1BuD,MAAMvD,gBAAgB,CAACkE,SAAS,GAAGzE,aACjCG,yBAAyBI,gBAAgB,EACzC4D,uBAAuB1D,IAAI,EAC3B0D,sBAAsB,CAACK,KAAK,EAC5BV,MAAMvD,gBAAgB,CAACkE,SAAS;IAEpC;IAEAvE,yBAAyB4D;IAEzB,OAAOA;AACT,EAAE"}
@@ -0,0 +1,112 @@
1
+ import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ import { mergeClasses, makeStyles, shorthands } from '@griffel/react';
4
+ import { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';
5
+ export const menuButtonClassNames = {
6
+ root: 'fui-MenuButton',
7
+ icon: 'fui-MenuButton__icon',
8
+ menuIcon: 'fui-MenuButton__menuIcon'
9
+ };
10
+ const useRootExpandedStyles = makeStyles({
11
+ base: {
12
+ [`& .${iconFilledClassName}`]: {
13
+ display: 'inline'
14
+ },
15
+ [`& .${iconRegularClassName}`]: {
16
+ display: 'none'
17
+ }
18
+ },
19
+ // Appearance variations
20
+ outline: {
21
+ ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),
22
+ ...shorthands.borderWidth(tokens.strokeWidthThicker),
23
+ color: tokens.colorNeutralForeground1Selected
24
+ },
25
+ primary: {
26
+ backgroundColor: tokens.colorBrandBackgroundSelected
27
+ },
28
+ secondary: {
29
+ backgroundColor: tokens.colorNeutralBackground1Selected,
30
+ ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),
31
+ color: tokens.colorNeutralForeground1Selected
32
+ },
33
+ subtle: {
34
+ backgroundColor: tokens.colorSubtleBackgroundSelected,
35
+ color: tokens.colorNeutralForeground2Selected
36
+ },
37
+ transparent: {
38
+ backgroundColor: tokens.colorTransparentBackgroundSelected,
39
+ color: tokens.colorNeutralForeground2BrandSelected
40
+ }
41
+ });
42
+ const useIconExpandedStyles = makeStyles({
43
+ // Appearance variations
44
+ outline: {
45
+ color: tokens.colorNeutralForeground1Selected
46
+ },
47
+ primary: {
48
+ },
49
+ secondary: {
50
+ color: tokens.colorNeutralForeground1Selected
51
+ },
52
+ subtle: {
53
+ color: tokens.colorNeutralForeground2BrandSelected
54
+ },
55
+ transparent: {
56
+ color: tokens.colorNeutralForeground2BrandSelected
57
+ },
58
+ highContrast: {
59
+ // High contrast styles
60
+ '@media (forced-colors: active)': {
61
+ ':hover': {
62
+ color: 'Highlight'
63
+ }
64
+ }
65
+ }
66
+ });
67
+ const useMenuIconStyles = makeStyles({
68
+ base: {
69
+ lineHeight: 0
70
+ },
71
+ // Size appearance
72
+ small: {
73
+ fontSize: '12px',
74
+ height: '12px',
75
+ lineHeight: tokens.lineHeightBase200,
76
+ width: '12px'
77
+ },
78
+ medium: {
79
+ fontSize: '12px',
80
+ height: '12px',
81
+ lineHeight: tokens.lineHeightBase200,
82
+ width: '12px'
83
+ },
84
+ large: {
85
+ fontSize: '16px',
86
+ height: '16px',
87
+ lineHeight: tokens.lineHeightBase400,
88
+ width: '16px'
89
+ },
90
+ // Not-icon only
91
+ notIconOnly: {
92
+ marginLeft: tokens.spacingHorizontalXS
93
+ }
94
+ });
95
+ export const useMenuButtonStyles_unstable = (state)=>{
96
+ 'use no memo';
97
+ const rootExpandedStyles = useRootExpandedStyles();
98
+ const iconExpandedStyles = useIconExpandedStyles();
99
+ const menuIconStyles = useMenuIconStyles();
100
+ state.root.className = mergeClasses(menuButtonClassNames.root, state.root['aria-expanded'] && rootExpandedStyles.base, state.root['aria-expanded'] && rootExpandedStyles[state.appearance], state.root.className);
101
+ if (state.icon) {
102
+ state.icon.className = mergeClasses(menuButtonClassNames.icon, state.root['aria-expanded'] && iconExpandedStyles[state.appearance] && iconExpandedStyles.highContrast, state.icon.className);
103
+ }
104
+ if (state.menuIcon) {
105
+ state.menuIcon.className = mergeClasses(menuButtonClassNames.menuIcon, menuIconStyles.base, menuIconStyles[state.size], !state.iconOnly && menuIconStyles.notIconOnly, state.menuIcon.className);
106
+ }
107
+ useButtonStyles_unstable({
108
+ ...state,
109
+ iconPosition: 'before'
110
+ });
111
+ return state;
112
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/MenuButton/useMenuButtonStyles.styles.ts"],"sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nconst useRootExpandedStyles = makeStyles({\n base: {\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n },\n\n // Appearance variations\n outline: {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n },\n secondary: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nconst useIconExpandedStyles = makeStyles({\n // Appearance variations\n outline: {\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n /* The primary styles are exactly the same as the base styles. */\n },\n secondary: {\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n transparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n highContrast: {\n // High contrast styles\n '@media (forced-colors: active)': {\n ':hover': {\n color: 'Highlight',\n },\n },\n },\n});\n\nconst useMenuIconStyles = makeStyles({\n base: {\n lineHeight: 0,\n },\n\n // Size appearance\n small: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n medium: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n large: {\n fontSize: '16px',\n height: '16px',\n lineHeight: tokens.lineHeightBase400,\n width: '16px',\n },\n\n // Not-icon only\n notIconOnly: {\n marginLeft: tokens.spacingHorizontalXS,\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n 'use no memo';\n\n const rootExpandedStyles = useRootExpandedStyles();\n const iconExpandedStyles = useIconExpandedStyles();\n const menuIconStyles = useMenuIconStyles();\n\n state.root.className = mergeClasses(\n menuButtonClassNames.root,\n state.root['aria-expanded'] && rootExpandedStyles.base,\n state.root['aria-expanded'] && rootExpandedStyles[state.appearance],\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n menuButtonClassNames.icon,\n state.root['aria-expanded'] && iconExpandedStyles[state.appearance] && iconExpandedStyles.highContrast,\n state.icon.className,\n );\n }\n\n if (state.menuIcon) {\n state.menuIcon.className = mergeClasses(\n menuButtonClassNames.menuIcon,\n menuIconStyles.base,\n menuIconStyles[state.size],\n !state.iconOnly && menuIconStyles.notIconOnly,\n state.menuIcon.className,\n );\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n\n return state;\n};\n"],"names":["iconFilledClassName","iconRegularClassName","tokens","mergeClasses","makeStyles","shorthands","useButtonStyles_unstable","menuButtonClassNames","root","icon","menuIcon","useRootExpandedStyles","base","display","outline","borderColor","colorNeutralStroke1Selected","borderWidth","strokeWidthThicker","color","colorNeutralForeground1Selected","primary","backgroundColor","colorBrandBackgroundSelected","secondary","colorNeutralBackground1Selected","subtle","colorSubtleBackgroundSelected","colorNeutralForeground2Selected","transparent","colorTransparentBackgroundSelected","colorNeutralForeground2BrandSelected","useIconExpandedStyles","highContrast","useMenuIconStyles","lineHeight","small","fontSize","height","lineHeightBase200","width","medium","large","lineHeightBase400","notIconOnly","marginLeft","spacingHorizontalXS","useMenuButtonStyles_unstable","state","rootExpandedStyles","iconExpandedStyles","menuIconStyles","className","appearance","size","iconOnly","iconPosition"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAClF,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,SAASC,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAQ,iBAAiB;AACtE,SAASC,wBAAwB,QAAQ,mCAAmC;AAG5E,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,MAAMC,wBAAwBP,WAAW;IACvCQ,MAAM;QACJ,CAAC,CAAC,GAAG,EAAEZ,oBAAoB,CAAC,CAAC,EAAE;YAC7Ba,SAAS;QACX;QACA,CAAC,CAAC,GAAG,EAAEZ,qBAAqB,CAAC,CAAC,EAAE;YAC9BY,SAAS;QACX;IACF;IAEA,wBAAwB;IACxBC,SAAS;QACP,GAAGT,WAAWU,WAAW,CAACb,OAAOc,2BAA2B,CAAC;QAC7D,GAAGX,WAAWY,WAAW,CAACf,OAAOg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A,MAAMC,qBAAqBtC;IAC3B,MAAMuC,qBAAqBlB;IAC3B,MAAMmB,iBAAiBjB;IAEvBc,MAAMxC,IAAI,CAAC4C,SAAS,GAAGjD,aACrBI,qBAAqBC,IAAI,EACzBwC,MAAMxC,IAAI,CAAC,gBAAgB,IAAIyC,mBAAmBrC,IAAI,EACtDoC,MAAMxC,IAAI,CAAC,gBAAgB,IAAIyC,kBAAkB,CAACD,MAAMK,UAAU,CAAC,EACnEL,MAAMxC,IAAI,CAAC4C,SAAS;IAGtB,IAAIJ,MAAMvC,IAAI,EAAE;QACduC,MAAMvC,IAAI,CAAC2C,SAAS,GAAGjD,aACrBI,qBAAqBE,IAAI,EACzBuC,MAAMxC,IAAI,CAAC,gBAAgB,IAAI0C,kBAAkB,CAACF,MAAMK,UAAU,CAAC,IAAIH,mBAAmBjB,YAAY,EACtGe,MAAMvC,IAAI,CAAC2C,SAAS;IAExB;IAEA,IAAIJ,MAAMtC,QAAQ,EAAE;QAClBsC,MAAMtC,QAAQ,CAAC0C,SAAS,GAAGjD,aACzBI,qBAAqBG,QAAQ,EAC7ByC,eAAevC,IAAI,EACnBuC,cAAc,CAACH,MAAMM,IAAI,CAAC,EAC1B,CAACN,MAAMO,QAAQ,IAAIJ,eAAeP,WAAW,EAC7CI,MAAMtC,QAAQ,CAAC0C,SAAS;IAE5B;IAEA9C,yBAAyB;QAAE,GAAG0C,KAAK;QAAEQ,cAAc;IAAS;IAE5D,OAAOR;AACT,EAAE"}
@@ -0,0 +1,158 @@
1
+ import { makeStyles, mergeClasses } from '@griffel/react';
2
+ import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ export const splitButtonClassNames = {
5
+ root: 'fui-SplitButton',
6
+ menuButton: 'fui-SplitButton__menuButton',
7
+ primaryActionButton: 'fui-SplitButton__primaryActionButton'
8
+ };
9
+ // WCAG minimum target size for pointer targets that are immediately adjacent to other targets:
10
+ // https://w3c.github.io/wcag/guidelines/22/#target-size-minimum
11
+ const MIN_TARGET_SIZE = '24px';
12
+ const useFocusStyles = makeStyles({
13
+ primaryActionButton: createCustomFocusIndicatorStyle({
14
+ borderTopRightRadius: 0,
15
+ borderBottomRightRadius: 0
16
+ }),
17
+ menuButton: createCustomFocusIndicatorStyle({
18
+ borderLeftWidth: 0,
19
+ borderTopLeftRadius: 0,
20
+ borderBottomLeftRadius: 0
21
+ })
22
+ });
23
+ const useRootStyles = makeStyles({
24
+ // Base styles
25
+ base: {
26
+ display: 'inline-flex',
27
+ justifyContent: 'stretch',
28
+ position: 'relative',
29
+ verticalAlign: 'middle',
30
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
31
+ borderTopRightRadius: 0,
32
+ borderBottomRightRadius: 0
33
+ },
34
+ [`& .${splitButtonClassNames.menuButton}`]: {
35
+ borderLeftWidth: 0,
36
+ borderTopLeftRadius: 0,
37
+ borderBottomLeftRadius: 0,
38
+ minWidth: MIN_TARGET_SIZE
39
+ }
40
+ },
41
+ // Appearance variations
42
+ outline: {
43
+ },
44
+ primary: {
45
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
46
+ borderRightColor: tokens.colorNeutralStrokeOnBrand
47
+ },
48
+ ':hover': {
49
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
50
+ borderRightColor: tokens.colorNeutralStrokeOnBrand
51
+ }
52
+ },
53
+ ':hover:active': {
54
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
55
+ borderRightColor: tokens.colorNeutralStrokeOnBrand
56
+ }
57
+ },
58
+ '@media (forced-colors: active)': {
59
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
60
+ borderRightColor: 'HighlightText'
61
+ },
62
+ ':hover': {
63
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
64
+ borderRightColor: 'Highlight'
65
+ }
66
+ },
67
+ ':hover:active': {
68
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
69
+ borderRightColor: 'Highlight'
70
+ }
71
+ }
72
+ }
73
+ },
74
+ secondary: {
75
+ },
76
+ subtle: {
77
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
78
+ borderRightColor: tokens.colorTransparentBackground
79
+ },
80
+ ':hover': {
81
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
82
+ borderRightColor: tokens.colorTransparentBackgroundHover
83
+ }
84
+ },
85
+ ':hover:active': {
86
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
87
+ borderRightColor: tokens.colorTransparentBackgroundPressed
88
+ }
89
+ }
90
+ },
91
+ transparent: {
92
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
93
+ borderRightColor: tokens.colorTransparentBackground
94
+ },
95
+ ':hover': {
96
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
97
+ borderRightColor: tokens.colorTransparentBackgroundHover
98
+ }
99
+ },
100
+ ':hover:active': {
101
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
102
+ borderRightColor: tokens.colorTransparentBackgroundPressed
103
+ }
104
+ }
105
+ },
106
+ // Shape variations
107
+ circular: {},
108
+ rounded: {},
109
+ square: {},
110
+ // Disabled styles
111
+ disabled: {
112
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
113
+ borderRightColor: tokens.colorNeutralStrokeDisabled
114
+ },
115
+ ':hover': {
116
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
117
+ borderRightColor: tokens.colorNeutralStrokeDisabled
118
+ }
119
+ },
120
+ ':hover:active': {
121
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
122
+ borderRightColor: tokens.colorNeutralStrokeDisabled
123
+ }
124
+ }
125
+ },
126
+ // Disabled high contrast styles
127
+ disabledHighContrast: {
128
+ '@media (forced-colors: active)': {
129
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
130
+ borderRightColor: 'GrayText'
131
+ },
132
+ ':hover': {
133
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
134
+ borderRightColor: 'GrayText'
135
+ }
136
+ },
137
+ ':hover:active': {
138
+ [`& .${splitButtonClassNames.primaryActionButton}`]: {
139
+ borderRightColor: 'GrayText'
140
+ }
141
+ }
142
+ }
143
+ }
144
+ });
145
+ export const useSplitButtonStyles_unstable = (state)=>{
146
+ 'use no memo';
147
+ const rootStyles = useRootStyles();
148
+ const focusStyles = useFocusStyles();
149
+ const { appearance, disabled, disabledFocusable } = state;
150
+ state.root.className = mergeClasses(splitButtonClassNames.root, rootStyles.base, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast, state.root.className);
151
+ if (state.menuButton) {
152
+ state.menuButton.className = mergeClasses(splitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
153
+ }
154
+ if (state.primaryActionButton) {
155
+ state.primaryActionButton.className = mergeClasses(splitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
156
+ }
157
+ return state;
158
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/SplitButton/useSplitButtonStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\n// WCAG minimum target size for pointer targets that are immediately adjacent to other targets:\n// https://w3c.github.io/wcag/guidelines/22/#target-size-minimum\nconst MIN_TARGET_SIZE = '24px';\n\nconst useFocusStyles = makeStyles({\n primaryActionButton: createCustomFocusIndicatorStyle({\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n }),\n\n menuButton: createCustomFocusIndicatorStyle({\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }),\n});\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n [`& .${splitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n minWidth: MIN_TARGET_SIZE,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'HighlightText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled styles\n disabled: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n state.root.className,\n );\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(\n splitButtonClassNames.menuButton,\n focusStyles.menuButton,\n state.menuButton.className,\n );\n }\n\n if (state.primaryActionButton) {\n state.primaryActionButton.className = mergeClasses(\n splitButtonClassNames.primaryActionButton,\n focusStyles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","createCustomFocusIndicatorStyle","tokens","splitButtonClassNames","root","menuButton","primaryActionButton","MIN_TARGET_SIZE","useFocusStyles","borderTopRightRadius","borderBottomRightRadius","borderLeftWidth","borderTopLeftRadius","borderBottomLeftRadius","useRootStyles","base","display","justifyContent","position","verticalAlign","minWidth","outline","primary","borderRightColor","colorNeutralStrokeOnBrand","secondary","subtle","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","transparent","circular","rounded","square","disabled","colorNeutralStrokeDisabled","disabledHighContrast","useSplitButtonStyles_unstable","state","rootStyles","focusStyles","appearance","disabledFocusable","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,+BAA+B,QAAQ,0BAA0B;AAC1E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,YAAY;IACZC,qBAAqB;AACvB,EAAE;AAEF,+FAA+F;AAC/F,gEAAgE;AAChE,MAAMC,kBAAkB;AAExB,MAAMC,iBAAiBT,WAAW;IAChCO,qBAAqBL,gCAAgC;QACnDQ,sBAAsB;QACtBC,yBAAyB;IAC3B;IAEAL,YAAYJ,gCAAgC;QAC1CU,iBAAiB;QACjBC,qBAAqB;QACrBC,wBAAwB;IAC1B;AACF;AAEA,MAAMC,gBAAgBf,WAAW;IAC/B,cAAc;IACdgB,MAAM;QACJC,SAAS;QACTC,gBAAgB;QAChBC,UAAU;QACVC,eAAe;QAEf,CAAC,CAAC,GAAG,EAAEhB,sBAAsBG,mBAAmB,CAAC,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