@fluentui/react-button 0.0.0-nightly-20230222-0421.1 → 0.0.0-nightly-20230223-2115.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.swcrc +33 -0
  2. package/CHANGELOG.json +15 -15
  3. package/CHANGELOG.md +10 -10
  4. package/lib/Button.js.map +1 -1
  5. package/lib/CompoundButton.js.map +1 -1
  6. package/lib/MenuButton.js.map +1 -1
  7. package/lib/SplitButton.js.map +1 -1
  8. package/lib/ToggleButton.js.map +1 -1
  9. package/lib/components/Button/Button.js.map +1 -1
  10. package/lib/components/Button/Button.types.js.map +1 -1
  11. package/lib/components/Button/index.js.map +1 -1
  12. package/lib/components/Button/renderButton.js +2 -7
  13. package/lib/components/Button/renderButton.js.map +1 -1
  14. package/lib/components/Button/useButton.js +2 -1
  15. package/lib/components/Button/useButton.js.map +1 -1
  16. package/lib/components/Button/useButtonStyles.js.map +1 -1
  17. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  18. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  19. package/lib/components/CompoundButton/index.js.map +1 -1
  20. package/lib/components/CompoundButton/renderCompoundButton.js +2 -11
  21. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  22. package/lib/components/CompoundButton/useCompoundButton.js +9 -7
  23. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  24. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  25. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  26. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  27. package/lib/components/MenuButton/index.js.map +1 -1
  28. package/lib/components/MenuButton/renderMenuButton.js +2 -7
  29. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  30. package/lib/components/MenuButton/useMenuButton.js +6 -6
  31. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  32. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  33. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  34. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  35. package/lib/components/SplitButton/index.js.map +1 -1
  36. package/lib/components/SplitButton/renderSplitButton.js +2 -7
  37. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  38. package/lib/components/SplitButton/useSplitButton.js +1 -0
  39. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  40. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  41. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  42. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  43. package/lib/components/ToggleButton/index.js.map +1 -1
  44. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  45. package/lib/components/ToggleButton/useToggleButton.js +1 -0
  46. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  47. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  48. package/lib/contexts/ButtonContext.js +1 -4
  49. package/lib/contexts/ButtonContext.js.map +1 -1
  50. package/lib/contexts/index.js.map +1 -1
  51. package/lib/index.js.map +1 -1
  52. package/lib/utils/index.js.map +1 -1
  53. package/lib/utils/useToggleState.js.map +1 -1
  54. package/lib-commonjs/Button.js +5 -4
  55. package/lib-commonjs/Button.js.map +1 -1
  56. package/lib-commonjs/CompoundButton.js +5 -4
  57. package/lib-commonjs/CompoundButton.js.map +1 -1
  58. package/lib-commonjs/MenuButton.js +5 -4
  59. package/lib-commonjs/MenuButton.js.map +1 -1
  60. package/lib-commonjs/SplitButton.js +5 -4
  61. package/lib-commonjs/SplitButton.js.map +1 -1
  62. package/lib-commonjs/ToggleButton.js +5 -4
  63. package/lib-commonjs/ToggleButton.js.map +1 -1
  64. package/lib-commonjs/components/Button/Button.js +16 -16
  65. package/lib-commonjs/components/Button/Button.js.map +1 -1
  66. package/lib-commonjs/components/Button/Button.types.js +3 -2
  67. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  68. package/lib-commonjs/components/Button/index.js +17 -19
  69. package/lib-commonjs/components/Button/index.js.map +1 -1
  70. package/lib-commonjs/components/Button/renderButton.js +16 -26
  71. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  72. package/lib-commonjs/components/Button/useButton.js +40 -52
  73. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  74. package/lib-commonjs/components/Button/useButtonStyles.js +1129 -471
  75. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  76. package/lib-commonjs/components/CompoundButton/CompoundButton.js +16 -16
  77. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  78. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +3 -2
  79. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  80. package/lib-commonjs/components/CompoundButton/index.js +18 -20
  81. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  82. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +16 -30
  83. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  84. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +32 -36
  85. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  86. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +315 -184
  87. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  88. package/lib-commonjs/components/MenuButton/MenuButton.js +16 -17
  89. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  90. package/lib-commonjs/components/MenuButton/MenuButton.types.js +3 -2
  91. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  92. package/lib-commonjs/components/MenuButton/index.js +18 -20
  93. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  94. package/lib-commonjs/components/MenuButton/renderMenuButton.js +16 -26
  95. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  96. package/lib-commonjs/components/MenuButton/useMenuButton.js +34 -37
  97. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  98. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +166 -106
  99. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  100. package/lib-commonjs/components/SplitButton/SplitButton.js +16 -17
  101. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  102. package/lib-commonjs/components/SplitButton/SplitButton.types.js +3 -2
  103. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  104. package/lib-commonjs/components/SplitButton/index.js +18 -20
  105. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  106. package/lib-commonjs/components/SplitButton/renderSplitButton.js +15 -22
  107. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  108. package/lib-commonjs/components/SplitButton/useSplitButton.js +66 -79
  109. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  110. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +263 -106
  111. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  112. package/lib-commonjs/components/ToggleButton/ToggleButton.js +16 -16
  113. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  114. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +3 -2
  115. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  116. package/lib-commonjs/components/ToggleButton/index.js +18 -20
  117. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  118. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +6 -8
  119. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  120. package/lib-commonjs/components/ToggleButton/useToggleButton.js +14 -16
  121. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  122. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +897 -380
  123. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  124. package/lib-commonjs/contexts/ButtonContext.js +17 -19
  125. package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
  126. package/lib-commonjs/contexts/index.js +5 -4
  127. package/lib-commonjs/contexts/index.js.map +1 -1
  128. package/lib-commonjs/index.js +47 -179
  129. package/lib-commonjs/index.js.map +1 -1
  130. package/lib-commonjs/utils/index.js +5 -4
  131. package/lib-commonjs/utils/index.js.map +1 -1
  132. package/lib-commonjs/utils/useToggleState.js +40 -40
  133. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  134. package/package.json +9 -9
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
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
- }
3
+ value: true
18
4
  });
19
- Object.defineProperty(exports, "useSplitButtonStyles_unstable", {
20
- enumerable: true,
21
- get: function () {
22
- return useSplitButtonStyles_1.useSplitButtonStyles_unstable;
23
- }
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ splitButtonClassNames: ()=>_useSplitButtonStyles.splitButtonClassNames,
13
+ useSplitButtonStyles_unstable: ()=>_useSplitButtonStyles.useSplitButtonStyles_unstable
24
14
  });
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
+
25
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;;AAAAA;AACAA;AACAA;AACAA;AACA;AAASC;EAAAC;EAAAC;IAAA,mDAAqB;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,2DAA6B;EAAA;AAAA","names":["tslib_1","Object","enumerable","get"],"sourceRoot":"","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"]}
1
+ {"version":3,"sources":["../../../lib/components/SplitButton/index.js"],"sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n//# sourceMappingURL=index.js.map"],"names":["splitButtonClassNames","useSplitButtonStyles_unstable"],"mappings":";;;;;;;;;;;IAISA,qBAAqB,MAArBA,2CAAqB;IAAEC,6BAA6B,MAA7BA,mDAA6B;;;oBAJ/C;oBACA;oBACA;oBACA;sCACuD;CACrE,iCAAiC"}
@@ -1,26 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderSplitButton_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderSplitButton_unstable
5
8
  });
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;
9
+ const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
10
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
11
+ const _extends = require("@swc/helpers/lib/_extends.js").default;
12
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
13
+ const _reactUtilities = require("@fluentui/react-utilities");
14
+ const renderSplitButton_unstable = (state)=>{
15
+ const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
16
+ return /*#__PURE__*/ _react.createElement(slots.root, _extends({}, slotProps.root), slots.primaryActionButton && /*#__PURE__*/ _react.createElement(slots.primaryActionButton, _extends({}, slotProps.primaryActionButton)), slots.menuButton && /*#__PURE__*/ _react.createElement(slots.menuButton, _extends({}, slotProps.menuButton)));
17
+ }; //# sourceMappingURL=renderSplitButton.js.map
18
+
26
19
  //# sourceMappingURL=renderSplitButton.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAmBH,KAAK,CAAC;EAE9D,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BJ,KAAK,CAACK,mBAAmB,IAAIF,oBAACH,KAAK,CAACK,mBAAmB;IAAA,GAAKJ,SAAS,CAACI;EAAmB,EAAI,EAC7FL,KAAK,CAACM,UAAU,IAAIH,oBAACH,KAAK,CAACM,UAAU;IAAA,GAAKL,SAAS,CAACK;EAAU,EAAI,CACxD;AAEjB,CAAC;AATYC,kCAA0B","names":["renderSplitButton_unstable","state","slots","slotProps","react_utilities_1","React","root","primaryActionButton","menuButton","exports"],"sourceRoot":"","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"]}
1
+ {"version":3,"sources":["../../../lib/components/SplitButton/renderSplitButton.js"],"sourcesContent":["import _extends from \"@swc/helpers/src/_extends.mjs\";\nimport * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(slots.root, _extends({}, slotProps.root), slots.primaryActionButton && /*#__PURE__*/React.createElement(slots.primaryActionButton, _extends({}, slotProps.primaryActionButton)), slots.menuButton && /*#__PURE__*/React.createElement(slots.menuButton, _extends({}, slotProps.menuButton)));\n};\n//# sourceMappingURL=renderSplitButton.js.map"],"names":["renderSplitButton_unstable","state","slots","slotProps","getSlots","React","createElement","root","_extends","primaryActionButton","menuButton"],"mappings":";;;;+BAMaA;;aAAAA;;;;yBANQ;6DACE;gCACE;AAIlB,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACJ,MAAMK,IAAI,EAAEC,SAAS,CAAC,GAAGL,UAAUI,IAAI,GAAGL,MAAMO,mBAAmB,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACJ,MAAMO,mBAAmB,EAAED,SAAS,CAAC,GAAGL,UAAUM,mBAAmB,IAAIP,MAAMQ,UAAU,IAAI,WAAW,GAAEL,OAAMC,aAAa,CAACJ,MAAMQ,UAAU,EAAEF,SAAS,CAAC,GAAGL,UAAUO,UAAU;AACnU,GACA,6CAA6C"}
@@ -1,83 +1,70 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useSplitButton_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useSplitButton_unstable
5
8
  });
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;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactUtilities = require("@fluentui/react-utilities");
12
+ const _button = require("../Button/Button");
13
+ const _menuButton = require("../MenuButton/MenuButton");
14
+ const useSplitButton_unstable = (props, ref)=>{
15
+ const { appearance ='secondary' , children , disabled =false , disabledFocusable =false , icon , iconPosition ='before' , menuButton , menuIcon , primaryActionButton , shape ='rounded' , size ='medium' } = props;
16
+ const baseId = (0, _reactUtilities.useId)('splitButton-');
17
+ const menuButtonShorthand = (0, _reactUtilities.resolveShorthand)(menuButton, {
18
+ defaultProps: {
19
+ appearance,
20
+ disabled,
21
+ disabledFocusable,
22
+ menuIcon,
23
+ shape,
24
+ size
25
+ },
26
+ required: true
27
+ });
28
+ const primaryActionButtonShorthand = (0, _reactUtilities.resolveShorthand)(primaryActionButton, {
29
+ defaultProps: {
30
+ appearance,
31
+ children,
32
+ disabled,
33
+ disabledFocusable,
34
+ icon,
35
+ iconPosition,
36
+ id: baseId + '__primaryActionButton',
37
+ shape,
38
+ size
39
+ },
40
+ required: true
41
+ });
42
+ // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
43
+ // by the user.
44
+ if (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {
45
+ menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
46
+ }
47
+ return {
48
+ // Props passed at the top-level
49
+ appearance,
50
+ disabled,
51
+ disabledFocusable,
52
+ iconPosition,
53
+ shape,
54
+ size,
55
+ // Slots definition
56
+ components: {
57
+ root: 'div',
58
+ menuButton: _menuButton.MenuButton,
59
+ primaryActionButton: _button.Button
60
+ },
61
+ root: (0, _reactUtilities.getNativeElementProps)('div', {
62
+ ref,
63
+ ...props
64
+ }),
65
+ menuButton: menuButtonShorthand,
66
+ primaryActionButton: primaryActionButtonShorthand
67
+ };
68
+ }; //# sourceMappingURL=useSplitButton.js.map
69
+
83
70
  //# sourceMappingURL=useSplitButton.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AACA;AACA;AACA;AAGA;;;;;AAKO,MAAMA,uBAAuB,GAAG,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,GAAGC,uBAAK,CAAC,cAAc,CAAC;EAEpC,MAAMC,mBAAmB,GAAGD,kCAAgB,CAACN,UAAU,EAAE;IACvDQ,YAAY,EAAE;MACZd,UAAU;MACVE,QAAQ;MACRC,iBAAiB;MACjBI,QAAQ;MACRE,KAAK;MACLC;KACD;IACDK,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMC,4BAA4B,GAAGJ,kCAAgB,CAACJ,mBAAmB,EAAE;IACzEM,YAAY,EAAE;MACZd,UAAU;MACVC,QAAQ;MACRC,QAAQ;MACRC,iBAAiB;MACjBC,IAAI;MACJC,YAAY;MACZY,EAAE,EAAEN,MAAM,GAAG,uBAAuB;MACpCF,KAAK;MACLC;KACD;IACDK,QAAQ,EAAE;GACX,CAAC;EAEF;EACA;EACA,IACEF,mBAAmB,IACnBG,4BAA4B,IAC5B,CAACH,mBAAmB,CAAC,YAAY,CAAC,IAClC,CAACA,mBAAmB,CAAC,iBAAiB,CAAC,EACvC;IACAA,mBAAmB,CAAC,iBAAiB,CAAC,GAAGG,4BAA4B,CAACC,EAAE;;EAG1E,OAAO;IACL;IACAjB,UAAU;IACVE,QAAQ;IACRC,iBAAiB;IACjBE,YAAY;IACZI,KAAK;IACLC,IAAI;IAEJ;IACAQ,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXb,UAAU,EAAEc,uBAAU;MACtBZ,mBAAmB,EAAEa;KACtB;IAEDF,IAAI,EAAEP,uCAAqB,CAAC,KAAK,EAAE;MAAEb,GAAG;MAAE,GAAGD;IAAK,CAAE,CAAC;IACrDQ,UAAU,EAAEO,mBAAmB;IAC/BL,mBAAmB,EAAEQ;GACtB;AACH,CAAC;AA9EYM,+BAAuB","names":["useSplitButton_unstable","props","ref","appearance","children","disabled","disabledFocusable","icon","iconPosition","menuButton","menuIcon","primaryActionButton","shape","size","baseId","react_utilities_1","menuButtonShorthand","defaultProps","required","primaryActionButtonShorthand","id","components","root","MenuButton_1","Button_1","exports"],"sourceRoot":"","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"]}
1
+ {"version":3,"sources":["../../../lib/components/SplitButton/useSplitButton.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\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 = (props, ref) => {\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 const baseId = useId('splitButton-');\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 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 // 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 (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {\n menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;\n }\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n // Slots definition\n components: {\n root: 'div',\n menuButton: MenuButton,\n primaryActionButton: Button\n },\n root: getNativeElementProps('div', {\n ref,\n ...props\n }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand\n };\n};\n//# sourceMappingURL=useSplitButton.js.map"],"names":["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"],"mappings":";;;;+BASaA;;aAAAA;;;6DATU;gCACwC;wBACxC;4BACI;AAMpB,MAAMA,0BAA0B,CAACC,OAAOC,MAAQ;IACrD,MAAM,EACJC,YAAa,YAAW,EACxBC,SAAQ,EACRC,UAAW,KAAK,CAAA,EAChBC,mBAAoB,KAAK,CAAA,EACzBC,KAAI,EACJC,cAAe,SAAQ,EACvBC,WAAU,EACVC,SAAQ,EACRC,oBAAmB,EACnBC,OAAQ,UAAS,EACjBC,MAAO,SAAQ,EAChB,GAAGZ;IACJ,MAAMa,SAASC,IAAAA,qBAAK,EAAC;IACrB,MAAMC,sBAAsBC,IAAAA,gCAAgB,EAACR,YAAY;QACvDS,cAAc;YACZf;YACAE;YACAC;YACAI;YACAE;YACAC;QACF;QACAM,UAAU,IAAI;IAChB;IACA,MAAMC,+BAA+BH,IAAAA,gCAAgB,EAACN,qBAAqB;QACzEO,cAAc;YACZf;YACAC;YACAC;YACAC;YACAC;YACAC;YACAa,IAAIP,SAAS;YACbF;YACAC;QACF;QACAM,UAAU,IAAI;IAChB;IACA,oHAAoH;IACpH,eAAe;IACf,IAAIH,uBAAuBI,gCAAgC,CAACJ,mBAAmB,CAAC,aAAa,IAAI,CAACA,mBAAmB,CAAC,kBAAkB,EAAE;QACxIA,mBAAmB,CAAC,kBAAkB,GAAGI,6BAA6BC,EAAE;IAC1E,CAAC;IACD,OAAO;QACL,gCAAgC;QAChClB;QACAE;QACAC;QACAE;QACAI;QACAC;QACA,mBAAmB;QACnBS,YAAY;YACVC,MAAM;YACNd,YAAYe,sBAAU;YACtBb,qBAAqBc,cAAM;QAC7B;QACAF,MAAMG,IAAAA,qCAAqB,EAAC,OAAO;YACjCxB;YACA,GAAGD,KAAK;QACV;QACAQ,YAAYO;QACZL,qBAAqBS;IACvB;AACF,GACA,0CAA0C"}