@fluentui/react-button 9.0.0-alpha.85 → 9.0.0-alpha.89
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +123 -1
- package/CHANGELOG.md +47 -2
- package/dist/react-button.d.ts +118 -25
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/components/Button/Button.types.d.ts +2 -2
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +3 -1
- package/lib/components/Button/useButton.js +3 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonState.d.ts +2 -2
- package/lib/components/Button/useButtonState.js +2 -2
- package/lib/components/Button/useButtonState.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +2 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib/components/MenuButton/useMenuButton.js +3 -3
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +25 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +16 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib/components/SplitButton/useSplitButton.js +72 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib/components/ToggleButton/useChecked.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib/components/ToggleButton/useToggleButton.js +4 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-amd/SplitButton.d.ts +1 -0
- package/lib-amd/SplitButton.js +6 -0
- package/lib-amd/SplitButton.js.map +1 -0
- package/lib-amd/components/Button/Button.types.d.ts +2 -2
- package/lib-amd/components/Button/Button.types.js.map +1 -1
- package/lib-amd/components/Button/renderButton.js.map +1 -1
- package/lib-amd/components/Button/useButton.d.ts +3 -1
- package/lib-amd/components/Button/useButton.js +3 -1
- package/lib-amd/components/Button/useButton.js.map +1 -1
- package/lib-amd/components/Button/useButtonState.d.ts +2 -2
- package/lib-amd/components/Button/useButtonState.js +2 -2
- package/lib-amd/components/Button/useButtonState.js.map +1 -1
- package/lib-amd/components/Button/useButtonStyles.js +1 -0
- package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
- package/lib-amd/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib-amd/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-amd/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
- package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
- package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-amd/components/SplitButton/SplitButton.js +19 -0
- package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-amd/components/SplitButton/index.d.ts +5 -0
- package/lib-amd/components/SplitButton/index.js +11 -0
- package/lib-amd/components/SplitButton/index.js.map +1 -0
- package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
- package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib-amd/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-amd/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib-amd/components/ToggleButton/useChecked.js.map +1 -1
- package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +2 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/components/Button/Button.types.d.ts +2 -2
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +3 -1
- package/lib-commonjs/components/Button/useButton.js +3 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
- package/lib-commonjs/components/Button/useButtonState.js +2 -2
- package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib-commonjs/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib-commonjs/components/ToggleButton/useChecked.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,mBAAA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AC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,QADH,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAHJ,EAQG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAR/B,CADF;AAYD,CAhBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { compoundButtonShorthandPropsCompat } from './useCompoundButton';\nimport type { CompoundButtonState } from './CompoundButton.types';\n\n/**\n * Renders a CompoundButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderCompoundButton = (state: CompoundButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, compoundButtonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && (\n <slots.contentContainer {...slotProps.contentContainer}>\n {children}\n <slots.secondaryContent {...slotProps.secondaryContent} />\n </slots.contentContainer>\n )}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -5,6 +5,8 @@ import type { CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundB
|
|
5
5
|
*/
|
6
6
|
export declare const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[];
|
7
7
|
/**
|
8
|
-
* Given user props,
|
8
|
+
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
9
|
+
* @param props - User provided props to the CompoundButton component.
|
10
|
+
* @param ref - User provided ref to be passed to the CompoundButton component.
|
9
11
|
*/
|
10
12
|
export declare const useCompoundButton: (props: CompoundButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: CompoundButtonProps | undefined) => CompoundButtonState;
|
@@ -18,7 +18,9 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
|
18
18
|
deepMerge: exports.compoundButtonShorthandPropsCompat
|
19
19
|
});
|
20
20
|
/**
|
21
|
-
* Given user props,
|
21
|
+
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
22
|
+
* @param props - User provided props to the CompoundButton component.
|
23
|
+
* @param ref - User provided ref to be passed to the CompoundButton component.
|
22
24
|
*/
|
23
25
|
|
24
26
|
var useCompoundButton = function (props, ref, defaultProps) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAOA;;AAEG;;;AACU,OAAA,CAAA,kCAAA,GAA2E,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAA3E;AAMb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAoC;AACrD,EAAA,SAAS,EAAE,OAAA,CAAA;AAD0C,CAApC,CAAnB;AAIA;;
|
1
|
+
{"version":3,"sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAOA;;AAEG;;;AACU,OAAA,CAAA,kCAAA,GAA2E,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAA3E;AAMb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAoC;AACrD,EAAA,SAAS,EAAE,OAAA,CAAA;AAD0C,CAApC,CAAnB;AAIA;;;;AAIG;;AACI,IAAM,iBAAiB,GAAG,UAC/B,KAD+B,EAE/B,GAF+B,EAG/B,YAH+B,EAGG;AAElC,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE,MAAN;AAAc,MAAA,QAAQ,EAAE;AAAxB,KANpB;AAOE,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAPpB;AAQE;AACA,IAAA,IAAI,EAAE,QATR;AAUE,IAAA,IAAI,EAAE;AAVR,GADsB,EAatB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,kCAApC,CAbM,EActB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,kCAA7B,CAdsB,CAAxB;AAiBA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEA,SAAO,KAAP;AACD,CAzBM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from '../Button/useButtonState';\nimport type {\n CompoundButtonProps,\n CompoundButtonShorthandPropsCompat,\n CompoundButtonState,\n} from './CompoundButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[] = [\n 'contentContainer',\n 'icon',\n 'secondaryContent',\n];\n\nconst mergeProps = makeMergeProps<CompoundButtonState>({\n deepMerge: compoundButtonShorthandPropsCompat,\n});\n\n/**\n * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the CompoundButton component.\n * @param ref - User provided ref to be passed to the CompoundButton component.\n */\nexport const useCompoundButton = (\n props: CompoundButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: CompoundButtonProps,\n): CompoundButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots inherited from Button\n icon: { as: 'span' },\n // Slots exclusive to CompoundButton\n contentContainer: { as: 'span', children: null },\n secondaryContent: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, compoundButtonShorthandPropsCompat),\n resolveShorthandProps(props, compoundButtonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,wBAAwB,GAAG;AAC/B,EAAA,gBAAgB,EAAE;AADa,CAAjC;;AAIA,IAAM,aAAa,gBAAG,mBAAA,SAAA;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;AAAA;AAAA;AAAA;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,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN1C,EAOhB,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAPpB,EAQhB,KAAK,CAAC,SARU,CAAlB;AAWA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,KAAK,CAAC,IAAN,CAAW,SAAzC,CAAvB;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,mBAAA,CAAA,YAAA,CAAa,sBAAsB,CAAC,IAApC,EAA0C,KAAK,CAAC,gBAAN,CAAuB,SAAjE,CAAnC;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,mBAAA,CAAA,YAAA,CACjC,wBAAwB,CAAC,gBADQ,EAEjC,sBAAsB,CAAC,IAFU,EAGjC,sBAAsB,CAAC,KAAK,CAAC,IAAP,CAHW,EAIjC,KAAK,CAAC,gBAAN,CAAuB,SAJU,CAAnC;AAOA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { buttonSpacing, useButtonStyles } from '../Button/useButtonStyles';\nimport type { CompoundButtonState } from './CompoundButton.types';\n\nconst CompoundButtonClassNames = {\n secondaryContent: 'CompoundButton-secondaryContent',\n};\n\nconst useRootStyles = makeStyles({\n base: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.large,\n\n height: 'auto',\n\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Hover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Pressed,\n },\n },\n }),\n small: theme => ({\n padding: buttonSpacing.medium,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n medium: theme => ({\n padding: buttonSpacing.large,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n large: theme => ({\n padding: buttonSpacing.larger,\n\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n }),\n primary: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n }),\n subtle: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n transparent: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n disabled: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n }),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n small: {\n padding: buttonSpacing.smaller,\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n padding: buttonSpacing.small,\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n padding: buttonSpacing.medium,\n\n maxWidth: '56px',\n minWidth: '56px',\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n fontSize: '40px',\n height: '40px',\n width: '40px',\n },\n});\n\nconst useContentContainerStyles = makeStyles({\n base: {\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'left',\n },\n});\n\nconst useSecondaryContentStyles = makeStyles({\n base: theme => ({\n lineHeight: '100%',\n marginTop: '4px',\n fontWeight: theme.global.type.fontWeights.regular,\n }),\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n }),\n});\n\nexport const useCompoundButtonStyles = (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 state.className = mergeClasses(\n rootStyles.base,\n rootStyles[state.size],\n state.primary && rootStyles.primary,\n state.subtle && rootStyles.subtle,\n state.transparent && rootStyles.transparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n state.iconOnly && rootIconOnlyStyles[state.size],\n state.className,\n );\n\n state.icon.className = mergeClasses(iconStyles.base, state.icon.className);\n\n state.contentContainer.className = mergeClasses(contentContainerStyles.base, state.contentContainer.className);\n\n state.secondaryContent.className = mergeClasses(\n CompoundButtonClassNames.secondaryContent,\n secondaryContentStyles.base,\n secondaryContentStyles[state.size],\n state.secondaryContent.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import type { MenuTriggerChildProps } from '@fluentui/react-menu';
|
3
3
|
import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
|
4
4
|
import type { ButtonDefaultedProps, ButtonProps, ButtonShorthandPropsCompat, ButtonState } from '../Button/Button.types';
|
5
|
-
export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<MenuTriggerChildProps
|
5
|
+
export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<Omit<MenuTriggerChildProps, 'ref'>> & {
|
6
6
|
/**
|
7
7
|
* Menu icon that indicates that this button has a menu that can be expanded.
|
8
8
|
*/
|
@@ -10,5 +10,4 @@ export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partia
|
|
10
10
|
};
|
11
11
|
export declare type MenuButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'menuIcon';
|
12
12
|
export declare type MenuButtonDefaultedProps = ButtonDefaultedProps | 'menuIcon';
|
13
|
-
export
|
14
|
-
}
|
13
|
+
export declare type MenuButtonState = Omit<ButtonState, 'iconPosition'> & ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps>;
|
@@ -23,8 +23,9 @@ var renderMenuButton = function (state) {
|
|
23
23
|
slotProps = _a.slotProps;
|
24
24
|
|
25
25
|
var children = state.children,
|
26
|
+
icon = state.icon,
|
26
27
|
iconOnly = state.iconOnly;
|
27
|
-
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)), !iconOnly && children, !iconOnly && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon)));
|
28
|
+
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)), !iconOnly && children, (!iconOnly || !icon.children) && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon)));
|
28
29
|
};
|
29
30
|
|
30
31
|
exports.renderMenuButton = renderMenuButton;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,gBAAgB,GAAG,UAAC,KAAD,EAAuB;AAC/C,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,eAAA,CAAA,8BAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,
|
1
|
+
{"version":3,"sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,gBAAgB,GAAG,UAAC,KAAD,EAAuB;AAC/C,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,eAAA,CAAA,8BAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAAqB,KAAK,CAA1B,QAAR;AAAA,MAAU,IAAI,GAAe,KAAK,CAApB,IAAd;AAAA,MAAgB,QAAQ,GAAK,KAAK,CAAV,QAAxB;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,CAAC,CAAC,QAAD,IAAa,CAAC,IAAI,CAAC,QAApB,KAAiC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAHpC,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { menuButtonShorthandPropsCompat } from './useMenuButton';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, menuButtonShorthandPropsCompat);\n const { children, icon, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.icon {...slotProps.icon} />\n {!iconOnly && children}\n {(!iconOnly || !icon.children) && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -5,6 +5,8 @@ import type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState }
|
|
5
5
|
*/
|
6
6
|
export declare const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[];
|
7
7
|
/**
|
8
|
-
* Given user props,
|
8
|
+
* Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
|
9
|
+
* @param props - User provided props to the MenuButton component.
|
10
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
9
11
|
*/
|
10
12
|
export declare const useMenuButton: (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps | undefined) => MenuButtonState;
|
@@ -18,12 +18,12 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
|
18
18
|
deepMerge: exports.menuButtonShorthandPropsCompat
|
19
19
|
});
|
20
20
|
/**
|
21
|
-
* Given user props,
|
21
|
+
* Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
|
22
|
+
* @param props - User provided props to the MenuButton component.
|
23
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
22
24
|
*/
|
23
25
|
|
24
26
|
var useMenuButton = function (props, ref, defaultProps) {
|
25
|
-
// Note: because menu button's template and slots are different, we can't reuse
|
26
|
-
// those, but the useMenuButtonState hook can reuse useButtonState.
|
27
27
|
var state = mergeProps({
|
28
28
|
ref: ref,
|
29
29
|
as: 'button',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,8BAAA,GAAmE,CAAC,MAAD,EAAS,UAAT,CAAnE;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAgC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAhC,CAAnB;AAEA;;
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,8BAAA,GAAmE,CAAC,MAAD,EAAS,UAAT,CAAnE;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAgC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAhC,CAAnB;AAEA;;;;AAIG;;AACI,IAAM,aAAa,GAAG,UAAC,KAAD,EAAyB,GAAzB,EAAsD,YAAtD,EAAoF;AAC/G,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,QAAQ,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KANZ;AAOE;AACA,IAAA,IAAI,EAAE,QARR;AASE,IAAA,IAAI,EAAE;AATR,GADsB,EAYtB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,8BAApC,CAZM,EAatB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,8BAA7B,CAbsB,CAAxB;AAgBA,EAAA,oBAAA,CAAA,kBAAA,CAAmB,KAAnB;AAEA,SAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useMenuButtonState } from './useMenuButtonState';\nimport type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState } from './MenuButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[] = ['icon', 'menuIcon'];\n\nconst mergeProps = makeMergeProps<MenuButtonState>({ deepMerge: menuButtonShorthandPropsCompat });\n\n/**\n * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the MenuButton component.\n * @param ref - User provided ref to be passed to the MenuButton component.\n */\nexport const useMenuButton = (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps) => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Button slots\n icon: { as: 'span' },\n // MenuButton slots\n menuIcon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, menuButtonShorthandPropsCompat),\n resolveShorthandProps(props, menuButtonShorthandPropsCompat),\n );\n\n useMenuButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,2 +1,7 @@
|
|
1
1
|
import type { MenuButtonState } from './MenuButton.types';
|
2
|
+
/**
|
3
|
+
* The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
|
4
|
+
* additional MenuButton specific processing.
|
5
|
+
* @param state - MenuButtonButton state to mutate.
|
6
|
+
*/
|
2
7
|
export declare const useMenuButtonState: (state: MenuButtonState) => MenuButtonState;
|
@@ -10,12 +10,20 @@ var React = /*#__PURE__*/require("react");
|
|
10
10
|
var react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
11
11
|
|
12
12
|
var useButtonState_1 = /*#__PURE__*/require("../Button/useButtonState");
|
13
|
+
/**
|
14
|
+
* The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
|
15
|
+
* additional MenuButton specific processing.
|
16
|
+
* @param state - MenuButtonButton state to mutate.
|
17
|
+
*/
|
18
|
+
|
13
19
|
|
14
20
|
var useMenuButtonState = function (state) {
|
15
21
|
// It behaves like a button.
|
16
22
|
useButtonState_1.useButtonState(state);
|
17
|
-
var
|
23
|
+
var children = state.children,
|
24
|
+
menuIcon = state.menuIcon,
|
18
25
|
size = state.size;
|
26
|
+
state.iconOnly = !children;
|
19
27
|
|
20
28
|
if (!menuIcon.children) {
|
21
29
|
if (size === 'large') {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAGA;;;;AAIG;;;AACI,IAAM,kBAAkB,GAAG,UAAC,KAAD,EAAuB;AACvD;AACA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEQ,MAAA,QAAQ,GAAqB,KAAK,CAA1B,QAAR;AAAA,MAAU,QAAQ,GAAW,KAAK,CAAhB,QAAlB;AAAA,MAAoB,IAAI,GAAK,KAAK,CAAV,IAAxB;AACR,EAAA,KAAK,CAAC,QAAN,GAAiB,CAAC,QAAlB;;AACA,MAAI,CAAC,QAAQ,CAAC,QAAd,EAAwB;AACtB,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,QAAQ,CAAC,QAAT,GAAoB,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,oBAAD,EAAqB,IAArB,CAApB;AACD,KAFD,MAEO;AACL,MAAA,QAAQ,CAAC,QAAT,GAAoB,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,oBAAD,EAAqB,IAArB,CAApB;AACD;AACF;;AAED,SAAO,KAAP;AACD,CAfM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';\nimport { useButtonState } from '../Button/useButtonState';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any\n * additional MenuButton specific processing.\n * @param state - MenuButtonButton state to mutate.\n */\nexport const useMenuButtonState = (state: MenuButtonState): MenuButtonState => {\n // It behaves like a button.\n useButtonState(state);\n\n const { children, menuIcon, size } = state;\n state.iconOnly = !children;\n if (!menuIcon.children) {\n if (size === 'large') {\n menuIcon.children = <ChevronDown24Regular />;\n } else {\n menuIcon.children = <ChevronDown20Regular />;\n }\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,cAAc,CAAC,KAAK,CAAC,IAAP,CAA3B,EAAyC,KAAK,CAAC,QAAN,CAAe,SAAxD,CAA3B;AAEA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,cAAc,CAAC,KAAK,CAAC,IAAP,CAA3B,EAAyC,KAAK,CAAC,QAAN,CAAe,SAAxD,CAA3B;AAEA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { MenuButtonState } from './MenuButton.types';\n\nconst useMenuIconStyles = makeStyles({\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 = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { SplitButtonProps } from './SplitButton.types';
|
3
|
+
/**
|
4
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
5
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
6
|
+
*/
|
7
|
+
export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<HTMLElement>>;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.SplitButton = void 0;
|
7
|
+
|
8
|
+
var React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
var index_1 = /*#__PURE__*/require("../Button/index");
|
11
|
+
|
12
|
+
var index_2 = /*#__PURE__*/require("../MenuButton/index");
|
13
|
+
|
14
|
+
var renderSplitButton_1 = /*#__PURE__*/require("./renderSplitButton");
|
15
|
+
|
16
|
+
var useSplitButton_1 = /*#__PURE__*/require("./useSplitButton");
|
17
|
+
|
18
|
+
var useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
19
|
+
/**
|
20
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
21
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
22
|
+
*/
|
23
|
+
|
24
|
+
|
25
|
+
exports.SplitButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
26
|
+
var state = useSplitButton_1.useSplitButton(props, ref, {
|
27
|
+
button: {
|
28
|
+
as: index_1.Button
|
29
|
+
},
|
30
|
+
menuButton: {
|
31
|
+
as: index_2.MenuButton
|
32
|
+
}
|
33
|
+
});
|
34
|
+
useSplitButtonStyles_1.useSplitButtonStyles(state);
|
35
|
+
return renderSplitButton_1.renderSplitButton(state);
|
36
|
+
});
|
37
|
+
exports.SplitButton.displayName = 'SplitButton';
|
38
|
+
//# sourceMappingURL=SplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAc,KAAK,CAAC,UAAN,CAAgD,UAAC,KAAD,EAAQ,GAAR,EAAW;AACpF,MAAM,KAAK,GAAG,gBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,GAAtB,EAA2B;AACvC,IAAA,MAAM,EAAE;AAAE,MAAA,EAAE,EAAE,OAAA,CAAA;AAAN,KAD+B;AAEvC,IAAA,UAAU,EAAE;AAAE,MAAA,EAAE,EAAE,OAAA,CAAA;AAAN;AAF2B,GAA3B,CAAd;AAKA,EAAA,sBAAA,CAAA,oBAAA,CAAqB,KAArB;AAEA,SAAO,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,CAAP;AACD,CAT0B,CAAd;AAWb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/index';\nimport { MenuButton } from '../MenuButton/index';\nimport { renderSplitButton } from './renderSplitButton';\nimport { useSplitButton } from './useSplitButton';\nimport { useSplitButtonStyles } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton = React.forwardRef<HTMLElement, SplitButtonProps>((props, ref) => {\n const state = useSplitButton(props, ref, {\n button: { as: Button },\n menuButton: { as: MenuButton },\n });\n\n useSplitButtonStyles(state);\n\n return renderSplitButton(state);\n});\n\nSplitButton.displayName = 'SplitButton';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
|
3
|
+
import type { ButtonProps, ButtonShorthandPropsCompat } from '../Button/Button.types';
|
4
|
+
import type { MenuButtonProps } from '../MenuButton/MenuButton.types';
|
5
|
+
export interface SplitButtonProps extends Omit<ButtonProps, ButtonShorthandPropsCompat>, MenuButtonProps {
|
6
|
+
/**
|
7
|
+
* Button to perform primary action in SplitButton.
|
8
|
+
*/
|
9
|
+
button?: ShorthandPropsCompat<ButtonProps>;
|
10
|
+
/**
|
11
|
+
* Button that opens menu with secondary actions in SplitButton.
|
12
|
+
*/
|
13
|
+
menuButton?: ShorthandPropsCompat<MenuButtonProps>;
|
14
|
+
/**
|
15
|
+
* Ref to the Button element.
|
16
|
+
*/
|
17
|
+
buttonRef?: React.Ref<HTMLElement>;
|
18
|
+
/**
|
19
|
+
* Ref to the MenuButton element.
|
20
|
+
*/
|
21
|
+
menuButtonRef?: React.Ref<HTMLElement>;
|
22
|
+
}
|
23
|
+
export declare type SplitButtonShorthandPropsCompat = 'button' | 'menuButton';
|
24
|
+
export declare type SplitButtonDefaultedProps = 'size';
|
25
|
+
export interface SplitButtonState extends ComponentStateCompat<SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonDefaultedProps> {
|
26
|
+
/**
|
27
|
+
* Ref to the root element
|
28
|
+
*/
|
29
|
+
ref: React.Ref<HTMLElement>;
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButtonStyles = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
tslib_1.__exportStar(require("./SplitButton"), exports);
|
11
|
+
|
12
|
+
tslib_1.__exportStar(require("./SplitButton.types"), exports);
|
13
|
+
|
14
|
+
tslib_1.__exportStar(require("./renderSplitButton"), exports);
|
15
|
+
|
16
|
+
tslib_1.__exportStar(require("./useSplitButton"), exports);
|
17
|
+
|
18
|
+
var useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
19
|
+
|
20
|
+
Object.defineProperty(exports, "useSplitButtonStyles", {
|
21
|
+
enumerable: true,
|
22
|
+
get: function () {
|
23
|
+
return useSplitButtonStyles_1.useSplitButtonStyles;
|
24
|
+
}
|
25
|
+
});
|
26
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,sBAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { useSplitButtonStyles } from './useSplitButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.renderSplitButton = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var React = /*#__PURE__*/require("react");
|
11
|
+
|
12
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
13
|
+
|
14
|
+
var useSplitButton_1 = /*#__PURE__*/require("./useSplitButton");
|
15
|
+
/**
|
16
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
var renderSplitButton = function (state) {
|
21
|
+
var _a = react_utilities_1.getSlotsCompat(state, useSplitButton_1.splitButtonShorthandProps),
|
22
|
+
slots = _a.slots,
|
23
|
+
slotProps = _a.slotProps;
|
24
|
+
|
25
|
+
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.button, tslib_1.__assign({}, slotProps.button)), React.createElement(slots.menuButton, tslib_1.__assign({}, slotProps.menuButton)));
|
26
|
+
};
|
27
|
+
|
28
|
+
exports.renderSplitButton = renderSplitButton;
|
29
|
+
//# sourceMappingURL=renderSplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,iBAAiB,GAAG,UAAC,KAAD,EAAwB;AACjD,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAA,CAAA,yBAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,MAAf,CAAb,CADF,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,UAAf,CAAjB,CAFF,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { splitButtonShorthandProps } from './useSplitButton';\nimport type { SplitButtonState } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, splitButtonShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.button {...slotProps.button} />\n <slots.menuButton {...slotProps.menuButton} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';
|
3
|
+
export declare const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[];
|
4
|
+
/**
|
5
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
6
|
+
* @param props - User provided props to the SplitButton component.
|
7
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
8
|
+
*/
|
9
|
+
export declare const useSplitButton: (props: SplitButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: SplitButtonProps | undefined) => SplitButtonState;
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButton = exports.splitButtonShorthandProps = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
exports.splitButtonShorthandProps = ['button', 'menuButton'];
|
13
|
+
var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
14
|
+
deepMerge: exports.splitButtonShorthandProps
|
15
|
+
});
|
16
|
+
/**
|
17
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
18
|
+
* @param props - User provided props to the SplitButton component.
|
19
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
20
|
+
*/
|
21
|
+
|
22
|
+
var useSplitButton = function (props, ref, defaultProps) {
|
23
|
+
var resolvedShorthandProps = react_utilities_1.resolveShorthandProps(props, exports.splitButtonShorthandProps);
|
24
|
+
var className = props.className;
|
25
|
+
|
26
|
+
var button = resolvedShorthandProps.button,
|
27
|
+
buttonRef = resolvedShorthandProps.buttonRef,
|
28
|
+
circular = resolvedShorthandProps.circular,
|
29
|
+
disabled = resolvedShorthandProps.disabled,
|
30
|
+
disabledFocusable = resolvedShorthandProps.disabledFocusable,
|
31
|
+
menuButton = resolvedShorthandProps.menuButton,
|
32
|
+
menuButtonRef = resolvedShorthandProps.menuButtonRef,
|
33
|
+
outline = resolvedShorthandProps.outline,
|
34
|
+
primary = resolvedShorthandProps.primary,
|
35
|
+
_a = resolvedShorthandProps.size,
|
36
|
+
size = _a === void 0 ? 'medium' : _a,
|
37
|
+
subtle = resolvedShorthandProps.subtle,
|
38
|
+
transparent = resolvedShorthandProps.transparent,
|
39
|
+
userProps = tslib_1.__rest(resolvedShorthandProps, ["button", "buttonRef", "circular", "disabled", "disabledFocusable", "menuButton", "menuButtonRef", "outline", "primary", "size", "subtle", "transparent"]); // TODO: To be resolved when moving to simplified prop merging
|
40
|
+
// const buttonInternalRef = React.useRef<HTMLElement | null>(null);
|
41
|
+
// const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);
|
42
|
+
|
43
|
+
|
44
|
+
var state = mergeProps({
|
45
|
+
'aria-disabled': disabled,
|
46
|
+
as: 'div',
|
47
|
+
className: className,
|
48
|
+
ref: ref,
|
49
|
+
size: size,
|
50
|
+
button: tslib_1.__assign(tslib_1.__assign({
|
51
|
+
as: 'button',
|
52
|
+
// TODO: To be resolved when moving to simplified prop merging
|
53
|
+
// ref: useMergedRefs(buttonRef, buttonInternalRef),
|
54
|
+
circular: circular,
|
55
|
+
disabled: disabled,
|
56
|
+
disabledFocusable: disabledFocusable,
|
57
|
+
outline: outline,
|
58
|
+
primary: primary,
|
59
|
+
size: size,
|
60
|
+
subtle: subtle,
|
61
|
+
transparent: transparent
|
62
|
+
}, userProps), button),
|
63
|
+
menuButton: tslib_1.__assign({
|
64
|
+
as: 'button',
|
65
|
+
// TODO: To be resolved when moving to simplified prop merging
|
66
|
+
// ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),
|
67
|
+
circular: circular,
|
68
|
+
disabled: disabled,
|
69
|
+
disabledFocusable: disabledFocusable,
|
70
|
+
outline: outline,
|
71
|
+
primary: primary,
|
72
|
+
size: size,
|
73
|
+
subtle: subtle,
|
74
|
+
transparent: transparent
|
75
|
+
}, menuButton)
|
76
|
+
}, // TODO: To be resolved when moving to simplified prop merging
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
defaultProps, resolvedShorthandProps);
|
79
|
+
return state;
|
80
|
+
};
|
81
|
+
|
82
|
+
exports.useSplitButton = useSplitButton;
|
83
|
+
//# sourceMappingURL=useSplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGa,OAAA,CAAA,yBAAA,GAA+D,CAAC,QAAD,EAAW,YAAX,CAA/D;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAiC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAj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L;AAKE,IAAA,IAAI,EAAA,IALN;AAOE,IAAA,MAAM,EAAA,OAAA,CAAA,QAAA,CAAA,OAAA,CAAA,QAAA,CAAA;AACJ,MAAA,EAAE,EAAE,QADA;AAEJ;AACA;AACA,MAAA,QAAQ,EAAA,QAJJ;AAKJ,MAAA,QAAQ,EAAA,QALJ;AAMJ,MAAA,iBAAiB,EAAA,iBANb;AAOJ,MAAA,OAAO,EAAA,OAPH;AAQJ,MAAA,OAAO,EAAA,OARH;AASJ,MAAA,IAAI,EAAA,IATA;AAUJ,MAAA,MAAM,EAAA,MAVF;AAWJ,MAAA,WAAW,EAAA;AAXP,KAAA,EAYD,SAZC,CAAA,EAaD,MAbC,CAPR;AAuBE,IAAA,UAAU,EAAA,OAAA,CAAA,QAAA,CAAA;AACR,MAAA,EAAE,EAAE,QADI;AAER;AACA;AACA,MAAA,QAAQ,EAAA,QAJA;AAKR,MAAA,QAAQ,EAAA,QALA;AAMR,MAAA,iBAAiB,EAAA,iBANT;AAOR,MAAA,OAAO,EAAA,OAPC;AAQR,MAAA,OAAO,EAAA,OARC;AASR,MAAA,IAAI,EAAA,IATI;AAUR,MAAA,MAAM,EAAA,MAVE;AAWR,MAAA,WAAW,EAAA;AAXH,KAAA,EAYL,UAZK;AAvBZ,GADsB,EAuCtB;AACA;AACA,EAAA,YAzCsB,EA0CtB,sBA1CsB,CAAxB;AA6CA,SAAO,KAAP;AACD,CAzEM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[] = ['button', 'menuButton'];\n\nconst mergeProps = makeMergeProps<SplitButtonState>({ deepMerge: splitButtonShorthandProps });\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 = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: SplitButtonProps,\n): SplitButtonState => {\n const resolvedShorthandProps = resolveShorthandProps(props, splitButtonShorthandProps);\n const { className } = props;\n const {\n button,\n buttonRef,\n circular,\n disabled,\n disabledFocusable,\n menuButton,\n menuButtonRef,\n outline,\n primary,\n size = 'medium',\n subtle,\n transparent,\n ...userProps\n } = resolvedShorthandProps;\n\n // TODO: To be resolved when moving to simplified prop merging\n // const buttonInternalRef = React.useRef<HTMLElement | null>(null);\n // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);\n\n const state = mergeProps(\n {\n 'aria-disabled': disabled,\n as: 'div',\n className,\n ref,\n size,\n\n button: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(buttonRef, buttonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...userProps,\n ...button,\n },\n\n menuButton: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...menuButton,\n },\n },\n // TODO: To be resolved when moving to simplified prop merging\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any,\n resolvedShorthandProps,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButtonStyles = void 0;
|
7
|
+
|
8
|
+
var react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
|
+
|
10
|
+
var SplitButtonClassNames = {
|
11
|
+
button: 'SplitButton-button',
|
12
|
+
menuButton: 'SplitButton-menuButton'
|
13
|
+
};
|
14
|
+
|
15
|
+
var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
16
|
+
"root": {
|
17
|
+
"mc9l5x": "ftuwxu6",
|
18
|
+
"Brf1p80": "fsxf2b5",
|
19
|
+
"qhf8xq": "f10pi13n",
|
20
|
+
"x85veo": ["f1ne4dir", "f1ybi2by"],
|
21
|
+
"Btvcf1s": ["f1breevy", "f1tvski9"],
|
22
|
+
"bajz6s": ["fnux5s6", "f5nfhee"],
|
23
|
+
"Bzqncq": ["f19wc9x7", "f5bevrs"],
|
24
|
+
"Flt4rd": ["f1wefiyg", "f1leuqsa"]
|
25
|
+
},
|
26
|
+
"rootBlock": {
|
27
|
+
"a9b677": "fly5x3f"
|
28
|
+
},
|
29
|
+
"rootPrimary": {
|
30
|
+
"hr16oo": ["f1l8fiow", "f1lkg7w5"],
|
31
|
+
"B5d1tlv": ["f1pm7n2k", "f1xkm9yf"],
|
32
|
+
"Bqs20fh": ["f1lzlrrr", "fhewniv"]
|
33
|
+
},
|
34
|
+
"rootSubtle": {
|
35
|
+
"hr16oo": ["ffnz80u", "fubjfjv"],
|
36
|
+
"B5d1tlv": ["f1ev4hyt", "fgg37q7"],
|
37
|
+
"Bqs20fh": ["f12yns5v", "fo742o6"]
|
38
|
+
},
|
39
|
+
"rootTransparent": {
|
40
|
+
"hr16oo": ["ffnz80u", "fubjfjv"],
|
41
|
+
"B5d1tlv": ["f1ev4hyt", "fgg37q7"],
|
42
|
+
"Bqs20fh": ["f12yns5v", "fo742o6"]
|
43
|
+
},
|
44
|
+
"rootDisabled": {
|
45
|
+
"hr16oo": ["f11d5dl6", "fdl3b3o"],
|
46
|
+
"B5d1tlv": ["f2uuk1a", "f13ik0bv"],
|
47
|
+
"Bqs20fh": ["f47hzam", "f1ui3wts"]
|
48
|
+
}
|
49
|
+
}, {
|
50
|
+
"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;}", ".f1ne4dir .SplitButton-button{border-top-right-radius:0;}", ".f1ybi2by .SplitButton-button{border-top-left-radius:0;}", ".f1breevy .SplitButton-button{border-bottom-right-radius:0;}", ".f1tvski9 .SplitButton-button{border-bottom-left-radius:0;}", ".fnux5s6 .SplitButton-menuButton{border-left-width:0;}", ".f5nfhee .SplitButton-menuButton{border-right-width:0;}", ".f19wc9x7 .SplitButton-menuButton{border-top-left-radius:0;}", ".f5bevrs .SplitButton-menuButton{border-top-right-radius:0;}", ".f1wefiyg .SplitButton-menuButton{border-bottom-left-radius:0;}", ".f1leuqsa .SplitButton-menuButton{border-bottom-right-radius:0;}", ".fly5x3f{width:100%;}", ".f1l8fiow .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1lkg7w5 .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".ffnz80u .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fubjfjv .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f11d5dl6 .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".fdl3b3o .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
|
51
|
+
"h": [".f1pm7n2k:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1xkm9yf:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1ev4hyt:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fgg37q7:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f2uuk1a:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f13ik0bv:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
|
52
|
+
"a": [".f1lzlrrr:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".fhewniv:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f12yns5v:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fo742o6:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f47hzam:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f1ui3wts:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"]
|
53
|
+
});
|
54
|
+
|
55
|
+
var useSplitButtonStyles = function (state) {
|
56
|
+
var styles = useStyles();
|
57
|
+
state.className = react_make_styles_1.mergeClasses(styles.root, state.block && styles.rootBlock, state.primary && styles.rootPrimary, state.subtle && styles.rootSubtle, state.transparent && styles.rootTransparent, state.disabled && styles.rootDisabled, state.className);
|
58
|
+
|
59
|
+
if (state.button) {
|
60
|
+
state.button.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.button, state.button.className);
|
61
|
+
}
|
62
|
+
|
63
|
+
if (state.menuButton) {
|
64
|
+
state.menuButton.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);
|
65
|
+
}
|
66
|
+
|
67
|
+
return state;
|
68
|
+
};
|
69
|
+
|
70
|
+
exports.useSplitButtonStyles = useSplitButtonStyles;
|
71
|
+
//# sourceMappingURL=useSplitButtonStyles.js.map
|