@fluentui/react-button 9.0.0-rc.4 → 9.0.0-rc.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +200 -1
- package/CHANGELOG.md +50 -2
- package/dist/react-button.d.ts +38 -8
- package/lib/components/Button/Button.types.d.ts +3 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.d.ts +1 -1
- package/lib/components/Button/index.js +3 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/useButton.js +1 -0
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.d.ts +7 -2
- package/lib/components/Button/useButtonStyles.js +110 -59
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +1 -1
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/index.d.ts +1 -1
- package/lib/components/CompoundButton/index.js +3 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +7 -2
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +7 -2
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +43 -28
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/index.d.ts +1 -1
- package/lib/components/MenuButton/index.js +3 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +7 -2
- package/lib/components/MenuButton/useMenuButtonStyles.js +16 -3
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.d.ts +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.d.ts +1 -1
- package/lib/components/SplitButton/index.js +3 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +1 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +7 -2
- package/lib/components/SplitButton/useSplitButtonStyles.js +38 -27
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/index.d.ts +1 -1
- package/lib/components/ToggleButton/index.js +3 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +3 -41
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +9 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +83 -60
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.d.ts +11 -5
- package/lib/index.js +11 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/useToggleState.d.ts +3 -0
- package/lib/utils/useToggleState.js +37 -0
- package/lib/utils/useToggleState.js.map +1 -0
- package/lib-commonjs/components/Button/Button.types.d.ts +3 -1
- package/lib-commonjs/components/Button/index.d.ts +1 -1
- package/lib-commonjs/components/Button/index.js +9 -1
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +1 -0
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +7 -2
- package/lib-commonjs/components/Button/useButtonStyles.js +112 -60
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.d.ts +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +9 -1
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +7 -2
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +7 -2
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +44 -29
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.d.ts +1 -1
- package/lib-commonjs/components/MenuButton/index.js +9 -1
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +7 -2
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +17 -4
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +1 -1
- package/lib-commonjs/components/SplitButton/index.d.ts +1 -1
- package/lib-commonjs/components/SplitButton/index.js +9 -1
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +7 -2
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +39 -28
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.d.ts +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +9 -1
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +3 -42
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +9 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +87 -62
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +11 -5
- package/lib-commonjs/index.js +204 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.d.ts +1 -0
- package/lib-commonjs/utils/index.js +10 -0
- package/lib-commonjs/utils/index.js.map +1 -0
- package/lib-commonjs/utils/useToggleState.d.ts +3 -0
- package/lib-commonjs/utils/useToggleState.js +48 -0
- package/lib-commonjs/utils/useToggleState.js.map +1 -0
- package/package.json +17 -20
- package/dist/demo/index.html +0 -71
- package/dist/demo/react-dom.development.js +0 -21413
- package/dist/demo/react.development.js +0 -3155
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,wBAAT,QAAyC,2BAAzC;
|
1
|
+
{"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,wBAAT,QAAyC,2BAAzC;AAIA,OAAO,MAAM,wBAAwB,GAAwC;AAC3E,EAAA,IAAI,EAAE,oBADqE;AAE3E,EAAA,IAAI,EAAE,0BAFqE;AAG3E,EAAA,gBAAgB,EAAE,sCAHyD;AAI3E,EAAA,gBAAgB,EAAE;AAJyD,CAAtE;AAOP;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAG,wBAAwB,CAAC,IAAzD;;AAEP,MAAM,aAAa,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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D,CAPuB,EASjC;AACA,GAAC,QAAQ,IAAI,iBAAb,KAAmC,UAAU,CAAC,QAVb,EAWjC,CAAC,QAAQ,IAAI,iBAAb,KAAmC,UAAU,CAAC,oBAXb,EAajC;AACA,EAAA,QAAQ,IAAI,kBAAkB,CAAC,IAAD,CAdG,EAgBjC;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAjBsB,CAAnC;AAoBA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,wBAAwB,CAAC,gBADoB,EAE7C,sBAAsB,CAAC,IAFsB,EAG7C,KAAK,CAAC,gBAAN,CAAuB,SAHsB,CAA/C;;AAMA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,wBAAwB,CAAC,IAA1B,EAAgC,UAAU,CAAC,IAA3C,EAAiD,KAAK,CAAC,IAAN,CAAW,SAA5D,CAAnC;AACD;;AAED,MAAI,KAAK,CAAC,gBAAV,EAA4B;AAC1B,IAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,wBAAwB,CAAC,gBADoB,EAE7C,sBAAsB,CAAC,IAFsB,EAG7C,sBAAsB,CAAC,IAAD,CAHuB,EAI7C,KAAK,CAAC,gBAAN,CAAuB,SAJsB,CAA/C;AAMD;;AAED,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AAEA,SAAO,KAAP;AACD,CAnDM","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\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\n/**\n * @deprecated Use `compoundButtonClassName.root` instead.\n */\nexport const compoundButtonClassName = compoundButtonClassNames.root;\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n ...shorthands.gap('12px'),\n\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 subtle: {\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 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 ...shorthands.padding('8px', '8px', '10px', '8px'),\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n medium: {\n ...shorthands.padding('14px', '12px', '16px', '12px'),\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n large: {\n ...shorthands.padding('18px', '16px', '20px', '16px'),\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 ...shorthands.padding('4px'),\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n ...shorthands.padding('6px'),\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n ...shorthands.padding('8px'),\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\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 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, 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(compoundButtonClassNames.icon, iconStyles.base, state.icon.className);\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"],"sourceRoot":"../src/"}
|
@@ -2,4 +2,4 @@ export * from './MenuButton.types';
|
|
2
2
|
export * from './MenuButton';
|
3
3
|
export * from './renderMenuButton';
|
4
4
|
export * from './useMenuButton';
|
5
|
-
export { menuButtonClassName, useMenuButtonStyles_unstable } from './useMenuButtonStyles';
|
5
|
+
export { menuButtonClassName, menuButtonClassNames, useMenuButtonStyles_unstable, } from './useMenuButtonStyles';
|
@@ -2,5 +2,7 @@ export * from './MenuButton.types';
|
|
2
2
|
export * from './MenuButton';
|
3
3
|
export * from './renderMenuButton';
|
4
4
|
export * from './useMenuButton';
|
5
|
-
export {
|
5
|
+
export {
|
6
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
7
|
+
menuButtonClassName, menuButtonClassNames, useMenuButtonStyles_unstable } from './useMenuButtonStyles';
|
6
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["components/MenuButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAd;AACA,cAAc,cAAd;AACA,cAAc,oBAAd;AACA,cAAc,iBAAd;AACA;AACE;AACA,mBAFF,EAGE,oBAHF,EAIE,4BAJF,QAKO,uBALP","sourcesContent":["export * from './MenuButton.types';\nexport * from './MenuButton';\nexport * from './renderMenuButton';\nexport * from './useMenuButton';\nexport {\n /* eslint-disable-next-line deprecation/deprecation */\n menuButtonClassName,\n menuButtonClassNames,\n useMenuButtonStyles_unstable,\n} from './useMenuButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -1,3 +1,8 @@
|
|
1
|
-
import type {
|
2
|
-
|
1
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
2
|
+
import type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';
|
3
|
+
export declare const menuButtonClassNames: SlotClassNames<MenuButtonSlots>;
|
4
|
+
/**
|
5
|
+
* @deprecated Use `menuButtonClassName.root` instead.
|
6
|
+
*/
|
7
|
+
export declare const menuButtonClassName: string;
|
3
8
|
export declare const useMenuButtonStyles_unstable: (state: MenuButtonState) => MenuButtonState;
|
@@ -1,6 +1,15 @@
|
|
1
1
|
import { mergeClasses, __styles } from '@griffel/react';
|
2
2
|
import { useButtonStyles_unstable } from '../Button/useButtonStyles';
|
3
|
-
export const
|
3
|
+
export const menuButtonClassNames = {
|
4
|
+
root: 'fui-MenuButton',
|
5
|
+
icon: 'fui-MenuButton__icon',
|
6
|
+
menuIcon: 'fui-MenuButton__menuIcon'
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* @deprecated Use `menuButtonClassName.root` instead.
|
10
|
+
*/
|
11
|
+
|
12
|
+
export const menuButtonClassName = menuButtonClassNames.root;
|
4
13
|
|
5
14
|
const useMenuIconStyles = /*#__PURE__*/__styles({
|
6
15
|
"small": {
|
@@ -24,10 +33,14 @@ const useMenuIconStyles = /*#__PURE__*/__styles({
|
|
24
33
|
|
25
34
|
export const useMenuButtonStyles_unstable = state => {
|
26
35
|
const menuIconStyles = useMenuIconStyles();
|
27
|
-
state.root.className = mergeClasses(
|
36
|
+
state.root.className = mergeClasses(menuButtonClassNames.root, state.root.className);
|
37
|
+
|
38
|
+
if (state.icon) {
|
39
|
+
state.icon.className = mergeClasses(menuButtonClassNames.icon, state.icon.className);
|
40
|
+
}
|
28
41
|
|
29
42
|
if (state.menuIcon) {
|
30
|
-
state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);
|
43
|
+
state.menuIcon.className = mergeClasses(menuButtonClassNames.menuIcon, menuIconStyles[state.size], state.menuIcon.className);
|
31
44
|
}
|
32
45
|
|
33
46
|
useButtonStyles_unstable(state);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,gBAAzC;AAEA,SAAS,wBAAT,QAAyC,2BAAzC;
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,gBAAzC;AAEA,SAAS,wBAAT,QAAyC,2BAAzC;AAIA,OAAO,MAAM,oBAAoB,GAAoC;AACnE,EAAA,IAAI,EAAE,gBAD6D;AAEnE,EAAA,IAAI,EAAE,sBAF6D;AAGnE,EAAA,QAAQ,EAAE;AAHyD,CAA9D;AAMP;;AAEG;;AACH,OAAO,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,IAAjD;;AAEP,MAAM,iBAAiB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAmBA,OAAO,MAAM,4BAA4B,GAAI,KAAD,IAA4C;AACtF,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAoB,CAAC,IAAtB,EAA4B,KAAK,CAAC,IAAN,CAAW,SAAvC,CAAnC;;AAEA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAoB,CAAC,IAAtB,EAA4B,KAAK,CAAC,IAAN,CAAW,SAAvC,CAAnC;AACD;;AAED,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CACrC,oBAAoB,CAAC,QADgB,EAErC,cAAc,CAAC,KAAK,CAAC,IAAP,CAFuB,EAGrC,KAAK,CAAC,QAAN,CAAe,SAHsB,CAAvC;AAKD;;AAED,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AAEA,SAAO,KAAP;AACD,CApBM","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport { ButtonState } from '../Button/Button.types';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\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\n/**\n * @deprecated Use `menuButtonClassName.root` instead.\n */\nexport const menuButtonClassName = menuButtonClassNames.root;\n\nconst useMenuIconStyles = makeStyles({\n // Size appearance\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.root.className = mergeClasses(menuButtonClassNames.root, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuButtonClassNames.icon, state.icon.className);\n }\n\n if (state.menuIcon) {\n state.menuIcon.className = mergeClasses(\n menuButtonClassNames.menuIcon,\n menuIconStyles[state.size],\n state.menuIcon.className,\n );\n }\n\n useButtonStyles_unstable(state as ButtonState);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -7,7 +7,7 @@ export declare type SplitButtonSlots = {
|
|
7
7
|
/**
|
8
8
|
* Root of the component that wraps the primary action button and menu button.
|
9
9
|
*/
|
10
|
-
root: Slot<'div'
|
10
|
+
root: NonNullable<Slot<'div'>>;
|
11
11
|
/**
|
12
12
|
* Button that opens menu with secondary actions in SplitButton.
|
13
13
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SplitButton.types.js","sourceRoot":"../src/","sources":["components/SplitButton/SplitButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';\n\nexport type SplitButtonSlots = {\n /**\n * Root of the component that wraps the primary action button and menu button.\n */\n root: Slot<'div'
|
1
|
+
{"version":3,"file":"SplitButton.types.js","sourceRoot":"../src/","sources":["components/SplitButton/SplitButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';\n\nexport type SplitButtonSlots = {\n /**\n * Root of the component that wraps the primary action button and menu button.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Button that opens menu with secondary actions in SplitButton.\n */\n menuButton?: Slot<typeof MenuButton>;\n /**\n * Button to perform primary action in SplitButton.\n */\n primaryActionButton?: Slot<typeof Button>;\n};\n\nexport type SplitButtonProps = ComponentProps<SplitButtonSlots> &\n Omit<ButtonProps, 'root'> &\n Omit<MenuButtonProps, 'root'>;\n\nexport type SplitButtonState = ComponentState<SplitButtonSlots> &\n Omit<ButtonState, 'components' | 'iconOnly' | 'root'> &\n Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;\n"]}
|
@@ -2,4 +2,4 @@ export * from './SplitButton';
|
|
2
2
|
export * from './SplitButton.types';
|
3
3
|
export * from './renderSplitButton';
|
4
4
|
export * from './useSplitButton';
|
5
|
-
export { splitButtonClassName, useSplitButtonStyles_unstable } from './useSplitButtonStyles';
|
5
|
+
export { splitButtonClassName, splitButtonClassNames, useSplitButtonStyles_unstable, } from './useSplitButtonStyles';
|
@@ -2,5 +2,7 @@ export * from './SplitButton';
|
|
2
2
|
export * from './SplitButton.types';
|
3
3
|
export * from './renderSplitButton';
|
4
4
|
export * from './useSplitButton';
|
5
|
-
export {
|
5
|
+
export {
|
6
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
7
|
+
splitButtonClassName, splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';
|
6
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["components/SplitButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAd;AACA,cAAc,qBAAd;AACA,cAAc,qBAAd;AACA,cAAc,kBAAd;AACA;AACE;AACA,oBAFF,EAGE,qBAHF,EAIE,6BAJF,QAKO,wBALP","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport {\n /* eslint-disable-next-line deprecation/deprecation */\n splitButtonClassName,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n} from './useSplitButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AACA,SAAS,MAAT,QAAuB,kBAAvB;AACA,SAAS,UAAT,QAA2B,0BAA3B;AAGA;;;;AAIG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CACrC,KADqC,EAErC,GAFqC,KAGjB;AACpB,QAAM;AACJ,IAAA,UADI;AAEJ,IAAA,KAAK,GAAG,
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AACA,SAAS,MAAT,QAAuB,kBAAvB;AACA,SAAS,UAAT,QAA2B,0BAA3B;AAGA;;;;AAIG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CACrC,KADqC,EAErC,GAFqC,KAGjB;AACpB,QAAM;AACJ,IAAA,UADI;AAEJ;AACA,IAAA,KAAK,GAAG,KAHJ;AAIJ,IAAA,QAJI;AAKJ,IAAA,QAAQ,GAAG,KALP;AAMJ,IAAA,iBAAiB,GAAG,KANhB;AAOJ,IAAA,IAPI;AAQJ,IAAA,YAAY,GAAG,QARX;AASJ,IAAA,UATI;AAUJ,IAAA,QAVI;AAWJ,IAAA,mBAXI;AA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AQ;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAAR,CAjBtB;AAkBL,IAAA,UAAU,EAAE,mBAlBP;AAmBL,IAAA,mBAAmB,EAAE;AAnBhB,GAAP;AAqBD,CAlFM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { SplitButtonProps, SplitButtonState } from './SplitButton.types';\n\n/**\n * Given user props, defines default props for the SplitButton and returns processed state.\n * @param props - User provided props to the SplitButton component.\n * @param ref - User provided ref to be passed to the SplitButton component.\n */\nexport const useSplitButton_unstable = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): SplitButtonState => {\n const {\n appearance,\n // eslint-disable-next-line deprecation/deprecation\n block = false,\n children,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n menuButton,\n menuIcon,\n primaryActionButton,\n shape = 'rounded',\n size = 'medium',\n } = props;\n\n const baseId = useId('splitButton-');\n\n const menuButtonShorthand = resolveShorthand(menuButton, {\n defaultProps: {\n appearance,\n disabled,\n disabledFocusable,\n menuIcon,\n shape,\n size,\n },\n required: true,\n });\n\n const primaryActionButtonShorthand = resolveShorthand(primaryActionButton, {\n defaultProps: {\n appearance,\n block,\n children,\n disabled,\n disabledFocusable,\n icon,\n iconPosition,\n id: baseId + '__primaryActionButton',\n shape,\n size,\n },\n required: true,\n });\n\n // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided\n // by the user.\n if (\n menuButtonShorthand &&\n primaryActionButtonShorthand &&\n !menuButtonShorthand['aria-label'] &&\n !menuButtonShorthand['aria-labelledby']\n ) {\n menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;\n }\n\n return {\n // Props passed at the top-level\n appearance,\n block,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // Slots definition\n components: {\n root: 'div',\n menuButton: MenuButton,\n primaryActionButton: Button,\n },\n\n root: getNativeElementProps('div', { ref, ...props }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,3 +1,8 @@
|
|
1
|
-
import type {
|
2
|
-
|
1
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
2
|
+
import type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';
|
3
|
+
export declare const splitButtonClassNames: SlotClassNames<SplitButtonSlots>;
|
4
|
+
/**
|
5
|
+
* @deprecated Use `splitButtonClassName.root` instead.
|
6
|
+
*/
|
7
|
+
export declare const splitButtonClassName: string;
|
3
8
|
export declare const useSplitButtonStyles_unstable: (state: SplitButtonState) => SplitButtonState;
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import { __styles, mergeClasses } from '@griffel/react';
|
2
2
|
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
3
3
|
import { tokens } from '@fluentui/react-theme';
|
4
|
-
export const
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
export const splitButtonClassNames = {
|
5
|
+
root: 'fui-SplitButton',
|
6
|
+
menuButton: 'fui-SplitButton__menuButton',
|
7
|
+
primaryActionButton: 'fui-SplitButton__primaryActionButton'
|
8
8
|
};
|
9
|
+
/**
|
10
|
+
* @deprecated Use `splitButtonClassName.root` instead.
|
11
|
+
*/
|
12
|
+
|
13
|
+
export const splitButtonClassName = splitButtonClassNames.root;
|
9
14
|
|
10
15
|
const useFocusStyles = /*#__PURE__*/__styles({
|
11
16
|
"primaryActionButton": {
|
@@ -30,43 +35,48 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
30
35
|
"Brf1p80": "fsxf2b5",
|
31
36
|
"qhf8xq": "f10pi13n",
|
32
37
|
"ha4doy": "fmrv4ls",
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
+
"kn2xc0": ["f14uur2j", "fc1btbj"],
|
39
|
+
"Bs76p8a": ["fye5tvs", "fc597qq"],
|
40
|
+
"cuxpm9": ["f1e8brtx", "fr36rk3"],
|
41
|
+
"Biffepf": ["fxp12j1", "f1m6nt2y"],
|
42
|
+
"Defnvf": ["fr7y8no", "f1dn0c6m"]
|
38
43
|
},
|
39
44
|
"block": {
|
40
45
|
"a9b677": "fly5x3f"
|
41
46
|
},
|
42
47
|
"outline": {},
|
43
48
|
"primary": {
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
49
|
+
"B1l9wao": ["f12j1tfo", "f1ufkr8r"],
|
50
|
+
"lcnrd8": ["f17lyyco", "f151o42i"],
|
51
|
+
"Brbpp8k": ["f1nb07eg", "fg8a8qi"]
|
47
52
|
},
|
48
53
|
"subtle": {
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
54
|
+
"B1l9wao": ["f1ysqkm5", "f10nbrj"],
|
55
|
+
"lcnrd8": ["fn44ryq", "fwhhltr"],
|
56
|
+
"Brbpp8k": ["fg8lp5p", "f1p6hj0a"]
|
52
57
|
},
|
53
58
|
"transparent": {
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
59
|
+
"B1l9wao": ["f1ysqkm5", "f10nbrj"],
|
60
|
+
"lcnrd8": ["fn44ryq", "fwhhltr"],
|
61
|
+
"Brbpp8k": ["fg8lp5p", "f1p6hj0a"]
|
57
62
|
},
|
58
63
|
"circular": {},
|
59
64
|
"rounded": {},
|
60
65
|
"square": {},
|
61
66
|
"disabled": {
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
67
|
+
"B1l9wao": ["f10xrnr8", "f15nylwb"],
|
68
|
+
"lcnrd8": ["f11fwhjz", "f18vtcsx"],
|
69
|
+
"Brbpp8k": ["f31btwb", "fzgm9gq"]
|
70
|
+
},
|
71
|
+
"disabledHighContrast": {
|
72
|
+
"Bcsxniv": ["fj2q5vi", "f13tct40"],
|
73
|
+
"tl7e51": ["fb2mzc7", "f179dhpp"],
|
74
|
+
"mba178": ["f1ma39qa", "f1nzpdru"]
|
65
75
|
}
|
66
76
|
}, {
|
67
|
-
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fsxf2b5{-webkit-box-pack:stretch;-ms-flex-pack:stretch;-webkit-justify-content:stretch;justify-content:stretch;}", ".f10pi13n{position:relative;}", ".fmrv4ls{vertical-align:middle;}", ".
|
68
|
-
"h": [".
|
69
|
-
"
|
77
|
+
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fsxf2b5{-webkit-box-pack:stretch;-ms-flex-pack:stretch;-webkit-justify-content:stretch;justify-content:stretch;}", ".f10pi13n{position:relative;}", ".fmrv4ls{vertical-align:middle;}", ".f14uur2j .fui-SplitButton__primaryActionButton{border-top-right-radius:0;}", ".fc1btbj .fui-SplitButton__primaryActionButton{border-top-left-radius:0;}", ".fye5tvs .fui-SplitButton__primaryActionButton{border-bottom-right-radius:0;}", ".fc597qq .fui-SplitButton__primaryActionButton{border-bottom-left-radius:0;}", ".f1e8brtx .fui-SplitButton__menuButton{border-left-width:0;}", ".fr36rk3 .fui-SplitButton__menuButton{border-right-width:0;}", ".fxp12j1 .fui-SplitButton__menuButton{border-top-left-radius:0;}", ".f1m6nt2y .fui-SplitButton__menuButton{border-top-right-radius:0;}", ".fr7y8no .fui-SplitButton__menuButton{border-bottom-left-radius:0;}", ".f1dn0c6m .fui-SplitButton__menuButton{border-bottom-right-radius:0;}", ".fly5x3f{width:100%;}", ".f12j1tfo .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".f1ufkr8r .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".f1ysqkm5 .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".f10nbrj .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".f10xrnr8 .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f15nylwb .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}"],
|
78
|
+
"h": [".f17lyyco:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".f151o42i:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".f1nb07eg:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".fg8a8qi:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".fn44ryq:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".fwhhltr:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".fg8lp5p:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1p6hj0a:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".f11fwhjz:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f18vtcsx:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f31btwb:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fzgm9gq:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}"],
|
79
|
+
"t": ["@media (forced-colors: active){.fj2q5vi .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f13tct40 .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}", "@media (forced-colors: active){.fb2mzc7:hover .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f179dhpp:hover .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}", "@media (forced-colors: active){.f1ma39qa:hover:active .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f1nzpdru:hover:active .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}"]
|
70
80
|
});
|
71
81
|
|
72
82
|
export const useSplitButtonStyles_unstable = state => {
|
@@ -74,18 +84,19 @@ export const useSplitButtonStyles_unstable = state => {
|
|
74
84
|
const focusStyles = useFocusStyles();
|
75
85
|
const {
|
76
86
|
appearance,
|
87
|
+
// eslint-disable-next-line deprecation/deprecation
|
77
88
|
block,
|
78
89
|
disabled,
|
79
90
|
disabledFocusable
|
80
91
|
} = state;
|
81
|
-
state.root.className = mergeClasses(
|
92
|
+
state.root.className = mergeClasses(splitButtonClassNames.root, rootStyles.base, block && rootStyles.block, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast, state.root.className);
|
82
93
|
|
83
94
|
if (state.menuButton) {
|
84
|
-
state.menuButton.className = mergeClasses(
|
95
|
+
state.menuButton.className = mergeClasses(splitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
|
85
96
|
}
|
86
97
|
|
87
98
|
if (state.primaryActionButton) {
|
88
|
-
state.primaryActionButton.className = mergeClasses(
|
99
|
+
state.primaryActionButton.className = mergeClasses(splitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
|
89
100
|
}
|
90
101
|
|
91
102
|
return state;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,qBAAq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AV,EAAsB;AACpB,IAAA,KAAK,CAAC,UAAN,CAAiB,SAAjB,GAA6B,YAAY,CACvC,qBAAqB,CAAC,UADiB,EAEvC,WAAW,CAAC,UAF2B,EAGvC,KAAK,CAAC,UAAN,CAAiB,SAHsB,CAAzC;AAKD;;AAED,MAAI,KAAK,CAAC,mBAAV,EAA+B;AAC7B,IAAA,KAAK,CAAC,mBAAN,CAA0B,SAA1B,GAAsC,YAAY,CAChD,qBAAqB,CAAC,mBAD0B,EAEhD,WAAW,CAAC,mBAFoC,EAGhD,KAAK,CAAC,mBAAN,CAA0B,SAHsB,CAAlD;AAKD;;AAED,SAAO,KAAP;AACD,CAvCM","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/**\n * @deprecated Use `splitButtonClassName.root` instead.\n */\nexport const splitButtonClassName = splitButtonClassNames.root;\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 },\n },\n\n // Block styles\n block: {\n width: '100%',\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\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 const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const {\n appearance,\n // eslint-disable-next-line deprecation/deprecation\n block,\n disabled,\n disabledFocusable,\n } = state;\n\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n block && rootStyles.block,\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"],"sourceRoot":"../src/"}
|
@@ -2,4 +2,4 @@ export * from './ToggleButton';
|
|
2
2
|
export * from './ToggleButton.types';
|
3
3
|
export * from './renderToggleButton';
|
4
4
|
export * from './useToggleButton';
|
5
|
-
export { toggleButtonClassName, useToggleButtonStyles_unstable } from './useToggleButtonStyles';
|
5
|
+
export { toggleButtonClassName, toggleButtonClassNames, useToggleButtonStyles_unstable, } from './useToggleButtonStyles';
|
@@ -2,5 +2,7 @@ export * from './ToggleButton';
|
|
2
2
|
export * from './ToggleButton.types';
|
3
3
|
export * from './renderToggleButton';
|
4
4
|
export * from './useToggleButton';
|
5
|
-
export {
|
5
|
+
export {
|
6
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
7
|
+
toggleButtonClassName, toggleButtonClassNames, useToggleButtonStyles_unstable } from './useToggleButtonStyles';
|
6
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["components/ToggleButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAd;AACA,cAAc,sBAAd;AACA,cAAc,sBAAd;AACA,cAAc,mBAAd;AACA;AACE;AACA,qBAFF,EAGE,sBAHF,EAIE,8BAJF,QAKO,yBALP","sourcesContent":["export * from './ToggleButton';\nexport * from './ToggleButton.types';\nexport * from './renderToggleButton';\nexport * from './useToggleButton';\nexport {\n /* eslint-disable-next-line deprecation/deprecation */\n toggleButtonClassName,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n} from './useToggleButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -6,4 +6,4 @@ import type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types'
|
|
6
6
|
* @param props - User provided props to the ToggleButton component.
|
7
7
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
8
8
|
*/
|
9
|
-
export declare const useToggleButton_unstable: (
|
9
|
+
export declare const useToggleButton_unstable: (props: ToggleButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import * as React from 'react';
|
1
|
+
import { useToggleState } from '../../utils/useToggleState';
|
3
2
|
import { useButton_unstable } from '../Button/useButton';
|
4
3
|
/**
|
5
4
|
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
@@ -8,45 +7,8 @@ import { useButton_unstable } from '../Button/useButton';
|
|
8
7
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
9
8
|
*/
|
10
9
|
|
11
|
-
export const useToggleButton_unstable = ({
|
12
|
-
checked,
|
13
|
-
defaultChecked,
|
14
|
-
...props
|
15
|
-
}, ref) => {
|
16
|
-
const {
|
17
|
-
disabled,
|
18
|
-
disabledFocusable
|
19
|
-
} = props;
|
10
|
+
export const useToggleButton_unstable = (props, ref) => {
|
20
11
|
const buttonState = useButton_unstable(props, ref);
|
21
|
-
|
22
|
-
role,
|
23
|
-
onClick
|
24
|
-
} = buttonState.root;
|
25
|
-
const [checkedValue, setCheckedValue] = useControllableState({
|
26
|
-
state: checked,
|
27
|
-
defaultState: defaultChecked,
|
28
|
-
initialState: false
|
29
|
-
});
|
30
|
-
const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
|
31
|
-
return { // Button state
|
32
|
-
...buttonState,
|
33
|
-
// State calculated from a set of props
|
34
|
-
checked: checkedValue,
|
35
|
-
// Slots definition
|
36
|
-
root: { ...buttonState.root,
|
37
|
-
[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
|
38
|
-
onClick: React.useCallback(ev => {
|
39
|
-
if (!disabled && !disabledFocusable) {
|
40
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
41
|
-
|
42
|
-
if (ev.defaultPrevented) {
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
|
46
|
-
setCheckedValue(!checkedValue);
|
47
|
-
}
|
48
|
-
}, [checkedValue, disabled, disabledFocusable, setCheckedValue, onClick])
|
49
|
-
}
|
50
|
-
};
|
12
|
+
return useToggleState(props, buttonState);
|
51
13
|
};
|
52
14
|
//# sourceMappingURL=useToggleButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,4BAA/B;AACA,SAAS,kBAAT,QAAmC,qBAAnC;AAGA;;;;;AAKG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CACtC,KADsC,EAEtC,GAFsC,KAGjB;AACrB,QAAM,WAAW,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAtC;AAEA,SAAO,cAAc,CAAC,KAAD,EAAQ,WAAR,CAArB;AACD,CAPM","sourcesContent":["import * as React from 'react';\nimport { useToggleState } from '../../utils/useToggleState';\nimport { useButton_unstable } from '../Button/useButton';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToggleButton_unstable = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n const buttonState = useButton_unstable(props, ref);\n\n return useToggleState(props, buttonState);\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,3 +1,11 @@
|
|
1
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
2
|
+
import type { ButtonSlots } from '../Button/Button.types';
|
1
3
|
import type { ToggleButtonState } from './ToggleButton.types';
|
2
|
-
export declare const
|
4
|
+
export declare const toggleButtonClassNames: SlotClassNames<ButtonSlots>;
|
5
|
+
/**
|
6
|
+
* @deprecated Use `toggleButtonClassName.root` instead.
|
7
|
+
*/
|
8
|
+
export declare const toggleButtonClassName: string;
|
9
|
+
export declare const useCheckedStyles: () => Record<"base" | "primary" | "outline" | "subtle" | "transparent" | "highContrast", string>;
|
10
|
+
export declare const useDisabledStyles: () => Record<"base" | "primary" | "outline" | "subtle" | "transparent", string>;
|
3
11
|
export declare const useToggleButtonStyles_unstable: (state: ToggleButtonState) => ToggleButtonState;
|