@fluentui/react-button 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +17 -17
- package/CHANGELOG.md +11 -11
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js +6 -6
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js +4 -4
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +9 -3
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +12 -13
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +14 -14
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js +6 -6
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js +5 -5
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js +13 -3
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +8 -8
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +7 -7
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +6 -6
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +9 -3
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +9 -8
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +10 -10
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +6 -6
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js +5 -5
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js +9 -3
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +13 -14
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js +6 -6
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +6 -6
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js +5 -5
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +2 -3
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +9 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/contexts/ButtonContext.js +5 -2
- package/lib/contexts/ButtonContext.js.map +1 -1
- package/lib/contexts/index.js +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js +4 -4
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-commonjs/Button.js +4 -5
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js +4 -5
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js +4 -5
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js +4 -5
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js +4 -5
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js +21 -19
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js +2 -3
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +19 -17
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js +26 -14
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +52 -40
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +477 -1135
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +21 -19
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +2 -3
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +20 -18
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +30 -14
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +36 -30
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +184 -315
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +22 -19
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js +2 -3
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +20 -18
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +26 -14
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +37 -33
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +106 -166
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +22 -19
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +2 -3
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +20 -18
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +22 -13
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +79 -66
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +106 -263
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +21 -19
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +2 -3
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +20 -18
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +8 -6
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +16 -14
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +380 -897
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/contexts/ButtonContext.js +19 -17
- package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +4 -5
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js +179 -47
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +4 -5
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useToggleState.js +40 -40
- package/lib-commonjs/utils/useToggleState.js.map +1 -1
- package/package.json +12 -11
- package/.swcrc +0 -39
@@ -1,25 +1,28 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "SplitButton", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>SplitButton
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
6
|
+
exports.SplitButton = void 0;
|
7
|
+
const React = /*#__PURE__*/require("react");
|
8
|
+
const renderSplitButton_1 = /*#__PURE__*/require("./renderSplitButton");
|
9
|
+
const useSplitButton_1 = /*#__PURE__*/require("./useSplitButton");
|
10
|
+
const useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
11
|
+
const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
12
|
+
/**
|
13
|
+
* SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary
|
14
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
15
|
+
*/
|
16
|
+
exports.SplitButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
17
|
+
const state = useSplitButton_1.useSplitButton_unstable(props, ref);
|
18
|
+
useSplitButtonStyles_1.useSplitButtonStyles_unstable(state);
|
19
|
+
const {
|
20
|
+
useSplitButtonStyles_unstable: useCustomStyles
|
21
|
+
} = react_shared_contexts_1.useCustomStyleHooks_unstable();
|
22
|
+
useCustomStyles(state);
|
23
|
+
return renderSplitButton_1.renderSplitButton_unstable(state);
|
24
|
+
// Casting is required due to lack of distributive union to support unions on @types/react
|
22
25
|
});
|
23
|
-
SplitButton.displayName = "SplitButton"; //# sourceMappingURL=SplitButton.js.map
|
24
26
|
|
27
|
+
exports.SplitButton.displayName = 'SplitButton';
|
25
28
|
//# sourceMappingURL=SplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"names":["React","require","renderSplitButton_1","useSplitButton_1","useSplitButtonStyles_1","react_shared_contexts_1","exports","SplitButton","forwardRef","props","ref","state","useSplitButton_unstable","useSplitButtonStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderSplitButton_unstable","displayName"],"sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/SplitButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderSplitButton_unstable } from './renderSplitButton';\nimport { useSplitButton_unstable } from './useSplitButton';\nimport { useSplitButtonStyles_unstable } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where 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: ForwardRefComponent<SplitButtonProps> = React.forwardRef((props, ref) => {\n const state = useSplitButton_unstable(props, ref);\n\n useSplitButtonStyles_unstable(state);\n\n const { useSplitButtonStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderSplitButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<SplitButtonProps>;\n\nSplitButton.displayName = 'SplitButton';\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,mBAAA,gBAAAD,OAAA;AACA,MAAAE,gBAAA,gBAAAF,OAAA;AACA,MAAAG,sBAAA,gBAAAH,OAAA;AAGA,MAAAI,uBAAA,gBAAAJ,OAAA;AAEA;;;;AAIaK,OAAA,CAAAC,WAAW,gBAA0CP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAChG,MAAMC,KAAK,GAAGR,gBAAA,CAAAS,uBAAuB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAEjDN,sBAAA,CAAAS,6BAA6B,CAACF,KAAK,CAAC;EAEpC,MAAM;IAAEE,6BAA6B,EAAEC;EAAe,CAAE,GAAGT,uBAAA,CAAAU,4BAA4B,EAAE;EACzFD,eAAe,CAACH,KAAK,CAAC;EAEtB,OAAOT,mBAAA,CAAAc,0BAA0B,CAACL,KAAK,CAAC;EACxC;AACF,CAAC,CAA0C;;AAE3CL,OAAA,CAAAC,WAAW,CAACU,WAAW,GAAG,aAAa"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"names":[],"sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/SplitButton.types.ts"],"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"],"mappings":""}
|
@@ -1,23 +1,25 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
+
value: true
|
4
5
|
});
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = void 0;
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
tslib_1.__exportStar(require("./SplitButton"), exports);
|
9
|
+
tslib_1.__exportStar(require("./SplitButton.types"), exports);
|
10
|
+
tslib_1.__exportStar(require("./renderSplitButton"), exports);
|
11
|
+
tslib_1.__exportStar(require("./useSplitButton"), exports);
|
12
|
+
var useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
13
|
+
Object.defineProperty(exports, "splitButtonClassNames", {
|
14
|
+
enumerable: true,
|
15
|
+
get: function () {
|
16
|
+
return useSplitButtonStyles_1.splitButtonClassNames;
|
17
|
+
}
|
18
|
+
});
|
19
|
+
Object.defineProperty(exports, "useSplitButtonStyles_unstable", {
|
20
|
+
enumerable: true,
|
21
|
+
get: function () {
|
22
|
+
return useSplitButtonStyles_1.useSplitButtonStyles_unstable;
|
23
|
+
}
|
14
24
|
});
|
15
|
-
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
16
|
-
_exportStar(require("./SplitButton"), exports);
|
17
|
-
_exportStar(require("./SplitButton.types"), exports);
|
18
|
-
_exportStar(require("./renderSplitButton"), exports);
|
19
|
-
_exportStar(require("./useSplitButton"), exports);
|
20
|
-
const _useSplitButtonStyles = require("./useSplitButtonStyles");
|
21
|
-
//# sourceMappingURL=index.js.map
|
22
|
-
|
23
25
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"names":["tslib_1","__exportStar","require","exports","useSplitButtonStyles_1","Object","defineProperty","enumerable","get","splitButtonClassNames","useSplitButtonStyles_unstable"],"sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/index.ts"],"sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n"],"mappings":";;;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACA,IAAAC,sBAAA,gBAAAF,OAAA;AAASG,MAAA,CAAAC,cAAA,CAAAH,OAAA;EAAAI,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAJ,sBAAA,CAAAK,qBAAqB;EAAA;AAAA;AAAEJ,MAAA,CAAAC,cAAA,CAAAH,OAAA;EAAAI,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAJ,sBAAA,CAAAM,6BAA6B;EAAA;AAAA"}
|
@@ -1,17 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "renderSplitButton_unstable", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>renderSplitButton_unstable
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
exports.renderSplitButton_unstable = void 0;
|
7
|
+
const React = /*#__PURE__*/require("react");
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
9
|
+
/**
|
10
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
11
|
+
*/
|
12
|
+
const renderSplitButton_unstable = state => {
|
13
|
+
const {
|
14
|
+
slots,
|
15
|
+
slotProps
|
16
|
+
} = react_utilities_1.getSlots(state);
|
17
|
+
return React.createElement(slots.root, {
|
18
|
+
...slotProps.root
|
19
|
+
}, slots.primaryActionButton && React.createElement(slots.primaryActionButton, {
|
20
|
+
...slotProps.primaryActionButton
|
21
|
+
}), slots.menuButton && React.createElement(slots.menuButton, {
|
22
|
+
...slotProps.menuButton
|
23
|
+
}));
|
24
|
+
};
|
25
|
+
exports.renderSplitButton_unstable = renderSplitButton_unstable;
|
17
26
|
//# sourceMappingURL=renderSplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"names":["React","require","react_utilities_1","renderSplitButton_unstable","state","slots","slotProps","getSlots","createElement","root","primaryActionButton","menuButton","exports"],"sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/renderSplitButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, 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_unstable = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlots<SplitButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.primaryActionButton && <slots.primaryActionButton {...slotProps.primaryActionButton} />}\n {slots.menuButton && <slots.menuButton {...slotProps.menuButton} />}\n </slots.root>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;AAGO,MAAME,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,iBAAA,CAAAK,QAAQ,CAAmBH,KAAK,CAAC;EAE9D,OACEJ,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BJ,KAAK,CAACK,mBAAmB,IAAIV,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACK,mBAAmB;IAAA,GAAKJ,SAAS,CAACI;EAAmB,EAAI,EAC7FL,KAAK,CAACM,UAAU,IAAIX,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACM,UAAU;IAAA,GAAKL,SAAS,CAACK;EAAU,EAAI,CACxD;AAEjB,CAAC;AATYC,OAAA,CAAAT,0BAA0B,GAAAA,0BAAA"}
|
@@ -1,70 +1,83 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "useSplitButton_unstable", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>useSplitButton_unstable
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
6
|
+
exports.useSplitButton_unstable = void 0;
|
7
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
8
|
+
const Button_1 = /*#__PURE__*/require("../Button/Button");
|
9
|
+
const MenuButton_1 = /*#__PURE__*/require("../MenuButton/MenuButton");
|
10
|
+
/**
|
11
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
12
|
+
* @param props - User provided props to the SplitButton component.
|
13
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
14
|
+
*/
|
15
|
+
const useSplitButton_unstable = (props, ref) => {
|
16
|
+
const {
|
17
|
+
appearance = 'secondary',
|
18
|
+
children,
|
19
|
+
disabled = false,
|
20
|
+
disabledFocusable = false,
|
21
|
+
icon,
|
22
|
+
iconPosition = 'before',
|
23
|
+
menuButton,
|
24
|
+
menuIcon,
|
25
|
+
primaryActionButton,
|
26
|
+
shape = 'rounded',
|
27
|
+
size = 'medium'
|
28
|
+
} = props;
|
29
|
+
const baseId = react_utilities_1.useId('splitButton-');
|
30
|
+
const menuButtonShorthand = react_utilities_1.resolveShorthand(menuButton, {
|
31
|
+
defaultProps: {
|
32
|
+
appearance,
|
33
|
+
disabled,
|
34
|
+
disabledFocusable,
|
35
|
+
menuIcon,
|
36
|
+
shape,
|
37
|
+
size
|
38
|
+
},
|
39
|
+
required: true
|
40
|
+
});
|
41
|
+
const primaryActionButtonShorthand = react_utilities_1.resolveShorthand(primaryActionButton, {
|
42
|
+
defaultProps: {
|
43
|
+
appearance,
|
44
|
+
children,
|
45
|
+
disabled,
|
46
|
+
disabledFocusable,
|
47
|
+
icon,
|
48
|
+
iconPosition,
|
49
|
+
id: baseId + '__primaryActionButton',
|
50
|
+
shape,
|
51
|
+
size
|
52
|
+
},
|
53
|
+
required: true
|
54
|
+
});
|
55
|
+
// Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
|
56
|
+
// by the user.
|
57
|
+
if (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {
|
58
|
+
menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
|
59
|
+
}
|
60
|
+
return {
|
61
|
+
// Props passed at the top-level
|
62
|
+
appearance,
|
63
|
+
disabled,
|
64
|
+
disabledFocusable,
|
65
|
+
iconPosition,
|
66
|
+
shape,
|
67
|
+
size,
|
68
|
+
// Slots definition
|
69
|
+
components: {
|
70
|
+
root: 'div',
|
71
|
+
menuButton: MenuButton_1.MenuButton,
|
72
|
+
primaryActionButton: Button_1.Button
|
73
|
+
},
|
74
|
+
root: react_utilities_1.getNativeElementProps('div', {
|
75
|
+
ref,
|
76
|
+
...props
|
77
|
+
}),
|
78
|
+
menuButton: menuButtonShorthand,
|
79
|
+
primaryActionButton: primaryActionButtonShorthand
|
80
|
+
};
|
81
|
+
};
|
82
|
+
exports.useSplitButton_unstable = useSplitButton_unstable;
|
70
83
|
//# sourceMappingURL=useSplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"names":["react_utilities_1","require","Button_1","MenuButton_1","useSplitButton_unstable","props","ref","appearance","children","disabled","disabledFocusable","icon","iconPosition","menuButton","menuIcon","primaryActionButton","shape","size","baseId","useId","menuButtonShorthand","resolveShorthand","defaultProps","required","primaryActionButtonShorthand","id","components","root","MenuButton","Button","getNativeElementProps","exports"],"sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/useSplitButton.ts"],"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 = 'secondary',\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 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 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"],"mappings":";;;;;;AACA,MAAAA,iBAAA,gBAAAC,OAAA;AACA,MAAAC,QAAA,gBAAAD,OAAA;AACA,MAAAE,YAAA,gBAAAF,OAAA;AAGA;;;;;AAKO,MAAMG,uBAAuB,GAAGA,CACrCC,KAAuB,EACvBC,GAAqD,KACjC;EACpB,MAAM;IACJC,UAAU,GAAG,WAAW;IACxBC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,iBAAiB,GAAG,KAAK;IACzBC,IAAI;IACJC,YAAY,GAAG,QAAQ;IACvBC,UAAU;IACVC,QAAQ;IACRC,mBAAmB;IACnBC,KAAK,GAAG,SAAS;IACjBC,IAAI,GAAG;EAAQ,CAChB,GAAGZ,KAAK;EAET,MAAMa,MAAM,GAAGlB,iBAAA,CAAAmB,KAAK,CAAC,cAAc,CAAC;EAEpC,MAAMC,mBAAmB,GAAGpB,iBAAA,CAAAqB,gBAAgB,CAACR,UAAU,EAAE;IACvDS,YAAY,EAAE;MACZf,UAAU;MACVE,QAAQ;MACRC,iBAAiB;MACjBI,QAAQ;MACRE,KAAK;MACLC;KACD;IACDM,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMC,4BAA4B,GAAGxB,iBAAA,CAAAqB,gBAAgB,CAACN,mBAAmB,EAAE;IACzEO,YAAY,EAAE;MACZf,UAAU;MACVC,QAAQ;MACRC,QAAQ;MACRC,iBAAiB;MACjBC,IAAI;MACJC,YAAY;MACZa,EAAE,EAAEP,MAAM,GAAG,uBAAuB;MACpCF,KAAK;MACLC;KACD;IACDM,QAAQ,EAAE;GACX,CAAC;EAEF;EACA;EACA,IACEH,mBAAmB,IACnBI,4BAA4B,IAC5B,CAACJ,mBAAmB,CAAC,YAAY,CAAC,IAClC,CAACA,mBAAmB,CAAC,iBAAiB,CAAC,EACvC;IACAA,mBAAmB,CAAC,iBAAiB,CAAC,GAAGI,4BAA4B,CAACC,EAAE;;EAG1E,OAAO;IACL;IACAlB,UAAU;IACVE,QAAQ;IACRC,iBAAiB;IACjBE,YAAY;IACZI,KAAK;IACLC,IAAI;IAEJ;IACAS,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXd,UAAU,EAAEV,YAAA,CAAAyB,UAAU;MACtBb,mBAAmB,EAAEb,QAAA,CAAA2B;KACtB;IAEDF,IAAI,EAAE3B,iBAAA,CAAA8B,qBAAqB,CAAC,KAAK,EAAE;MAAExB,GAAG;MAAE,GAAGD;IAAK,CAAE,CAAC;IACrDQ,UAAU,EAAEO,mBAAmB;IAC/BL,mBAAmB,EAAES;GACtB;AACH,CAAC;AA9EYO,OAAA,CAAA3B,uBAAuB,GAAAA,uBAAA"}
|