@fluentui/react-button 0.0.0-nightly-20230223-2115.1 → 0.0.0-nightly-20230227-0424.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/CHANGELOG.json +15 -15
  2. package/CHANGELOG.md +10 -10
  3. package/lib/Button.js.map +1 -1
  4. package/lib/CompoundButton.js.map +1 -1
  5. package/lib/MenuButton.js.map +1 -1
  6. package/lib/SplitButton.js.map +1 -1
  7. package/lib/ToggleButton.js.map +1 -1
  8. package/lib/components/Button/Button.js.map +1 -1
  9. package/lib/components/Button/Button.types.js.map +1 -1
  10. package/lib/components/Button/index.js.map +1 -1
  11. package/lib/components/Button/renderButton.js +7 -2
  12. package/lib/components/Button/renderButton.js.map +1 -1
  13. package/lib/components/Button/useButton.js +1 -2
  14. package/lib/components/Button/useButton.js.map +1 -1
  15. package/lib/components/Button/useButtonStyles.js.map +1 -1
  16. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  17. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  18. package/lib/components/CompoundButton/index.js.map +1 -1
  19. package/lib/components/CompoundButton/renderCompoundButton.js +11 -2
  20. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  21. package/lib/components/CompoundButton/useCompoundButton.js +7 -9
  22. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  23. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  24. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  26. package/lib/components/MenuButton/index.js.map +1 -1
  27. package/lib/components/MenuButton/renderMenuButton.js +7 -2
  28. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  29. package/lib/components/MenuButton/useMenuButton.js +6 -6
  30. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  31. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  32. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  33. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  34. package/lib/components/SplitButton/index.js.map +1 -1
  35. package/lib/components/SplitButton/renderSplitButton.js +7 -2
  36. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  37. package/lib/components/SplitButton/useSplitButton.js +0 -1
  38. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  39. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  40. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  41. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  42. package/lib/components/ToggleButton/index.js.map +1 -1
  43. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  44. package/lib/components/ToggleButton/useToggleButton.js +0 -1
  45. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  46. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  47. package/lib/contexts/ButtonContext.js +4 -1
  48. package/lib/contexts/ButtonContext.js.map +1 -1
  49. package/lib/contexts/index.js.map +1 -1
  50. package/lib/index.js.map +1 -1
  51. package/lib/utils/index.js.map +1 -1
  52. package/lib/utils/useToggleState.js.map +1 -1
  53. package/lib-commonjs/Button.js +4 -5
  54. package/lib-commonjs/Button.js.map +1 -1
  55. package/lib-commonjs/CompoundButton.js +4 -5
  56. package/lib-commonjs/CompoundButton.js.map +1 -1
  57. package/lib-commonjs/MenuButton.js +4 -5
  58. package/lib-commonjs/MenuButton.js.map +1 -1
  59. package/lib-commonjs/SplitButton.js +4 -5
  60. package/lib-commonjs/SplitButton.js.map +1 -1
  61. package/lib-commonjs/ToggleButton.js +4 -5
  62. package/lib-commonjs/ToggleButton.js.map +1 -1
  63. package/lib-commonjs/components/Button/Button.js +16 -16
  64. package/lib-commonjs/components/Button/Button.js.map +1 -1
  65. package/lib-commonjs/components/Button/Button.types.js +2 -3
  66. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  67. package/lib-commonjs/components/Button/index.js +19 -17
  68. package/lib-commonjs/components/Button/index.js.map +1 -1
  69. package/lib-commonjs/components/Button/renderButton.js +26 -16
  70. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  71. package/lib-commonjs/components/Button/useButton.js +52 -40
  72. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  73. package/lib-commonjs/components/Button/useButtonStyles.js +471 -1129
  74. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  75. package/lib-commonjs/components/CompoundButton/CompoundButton.js +16 -16
  76. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  77. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +2 -3
  78. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  79. package/lib-commonjs/components/CompoundButton/index.js +20 -18
  80. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  81. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +30 -16
  82. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  83. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +36 -32
  84. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  85. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +184 -315
  86. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  87. package/lib-commonjs/components/MenuButton/MenuButton.js +17 -16
  88. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  89. package/lib-commonjs/components/MenuButton/MenuButton.types.js +2 -3
  90. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  91. package/lib-commonjs/components/MenuButton/index.js +20 -18
  92. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  93. package/lib-commonjs/components/MenuButton/renderMenuButton.js +26 -16
  94. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  95. package/lib-commonjs/components/MenuButton/useMenuButton.js +37 -34
  96. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  97. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +106 -166
  98. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  99. package/lib-commonjs/components/SplitButton/SplitButton.js +17 -16
  100. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  101. package/lib-commonjs/components/SplitButton/SplitButton.types.js +2 -3
  102. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  103. package/lib-commonjs/components/SplitButton/index.js +20 -18
  104. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  105. package/lib-commonjs/components/SplitButton/renderSplitButton.js +22 -15
  106. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  107. package/lib-commonjs/components/SplitButton/useSplitButton.js +79 -66
  108. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  109. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +106 -263
  110. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  111. package/lib-commonjs/components/ToggleButton/ToggleButton.js +16 -16
  112. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  113. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +2 -3
  114. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  115. package/lib-commonjs/components/ToggleButton/index.js +20 -18
  116. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  117. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +8 -6
  118. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  119. package/lib-commonjs/components/ToggleButton/useToggleButton.js +16 -14
  120. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  121. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +380 -897
  122. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  123. package/lib-commonjs/contexts/ButtonContext.js +19 -17
  124. package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
  125. package/lib-commonjs/contexts/index.js +4 -5
  126. package/lib-commonjs/contexts/index.js.map +1 -1
  127. package/lib-commonjs/index.js +179 -47
  128. package/lib-commonjs/index.js.map +1 -1
  129. package/lib-commonjs/utils/index.js +4 -5
  130. package/lib-commonjs/utils/index.js.map +1 -1
  131. package/lib-commonjs/utils/useToggleState.js +40 -40
  132. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  133. package/package.json +9 -9
  134. package/.swcrc +0 -33
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Button/Button.js"],"sourcesContent":["import * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles';\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n useButtonStyles_unstable(state);\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n});\n\nButton.displayName = 'Button';\n//# sourceMappingURL=Button.js.map"],"names":["Button","React","forwardRef","props","ref","state","useButton_unstable","useButtonStyles_unstable","renderButton_unstable","displayName"],"mappings":";;;;+BAOaA;;aAAAA;;;6DAPU;8BACe;2BACH;iCACM;AAIlC,MAAMA,SAAS,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAClE,MAAMC,QAAQC,IAAAA,6BAAkB,EAACH,OAAOC;IACxCG,IAAAA,yCAAwB,EAACF;IACzB,OAAOG,IAAAA,mCAAqB,EAACH;AAC7B,0FAA0F;AAC5F;AAEAL,OAAOS,WAAW,GAAG,UACrB,kCAAkC"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,cAAM,gBAAqCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACtF,MAAMC,KAAK,GAAGC,8BAAkB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAE5CG,0CAAwB,CAACF,KAAK,CAAC;EAE/B,OAAOG,oCAAqB,CAACH,KAAK,CAAC;EACnC;AACF,CAAC,CAAqC;;AAEtCL,cAAM,CAACS,WAAW,GAAG,QAAQ","names":["exports","React","forwardRef","props","ref","state","useButton_1","useButtonStyles_1","renderButton_1","displayName"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button: ForwardRefComponent<ButtonProps> = React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n\n useButtonStyles_unstable(state);\n\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ButtonProps>;\n\nButton.displayName = 'Button';\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
5
- //# sourceMappingURL=Button.types.js.map
6
-
7
6
  //# sourceMappingURL=Button.types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Button/Button.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=Button.types.js.map"],"names":[],"mappings":";;;;CACA,wCAAwC"}
1
+ {"version":3,"mappings":"","names":[],"sourceRoot":"","sources":[],"sourcesContent":[]}
@@ -1,22 +1,24 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
+ value: true
4
5
  });
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
- buttonClassNames: ()=>_useButtonStyles.buttonClassNames,
13
- useButtonStyles_unstable: ()=>_useButtonStyles.useButtonStyles_unstable
6
+ exports.useButtonStyles_unstable = exports.buttonClassNames = void 0;
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+ tslib_1.__exportStar(require("./Button"), exports);
9
+ tslib_1.__exportStar(require("./renderButton"), exports);
10
+ tslib_1.__exportStar(require("./useButton"), exports);
11
+ var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
12
+ Object.defineProperty(exports, "buttonClassNames", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return useButtonStyles_1.buttonClassNames;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useButtonStyles_unstable", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return useButtonStyles_1.useButtonStyles_unstable;
22
+ }
14
23
  });
15
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
16
- _exportStar(require("./Button"), exports);
17
- _exportStar(require("./renderButton"), exports);
18
- _exportStar(require("./useButton"), exports);
19
- const _useButtonStyles = require("./useButtonStyles");
20
- //# sourceMappingURL=index.js.map
21
-
22
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Button/index.js"],"sourcesContent":["export * from './Button';\nexport * from './renderButton';\nexport * from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';\n//# sourceMappingURL=index.js.map"],"names":["buttonClassNames","useButtonStyles_unstable"],"mappings":";;;;;;;;;;;IAGSA,gBAAgB,MAAhBA,iCAAgB;IAAEC,wBAAwB,MAAxBA,yCAAwB;;;oBAHrC;oBACA;oBACA;iCAC6C;CAC3D,iCAAiC"}
1
+ {"version":3,"mappings":";;;;;;;AAAAA;AAGAA;AACAA;AACA;AAASC;EAAAC;EAAAC;IAAA,yCAAgB;EAAA;AAAA;AAAEF;EAAAC;EAAAC;IAAA,iDAAwB;EAAA;AAAA","names":["tslib_1","Object","enumerable","get"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/index.ts"],"sourcesContent":["export * from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport * from './renderButton';\nexport * from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';\n"]}
@@ -1,20 +1,30 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "renderButton_unstable", {
6
- enumerable: true,
7
- get: ()=>renderButton_unstable
4
+ value: true
8
5
  });
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 renderButton_unstable = (state)=>{
15
- const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
16
- const { iconOnly , iconPosition } = state;
17
- return /*#__PURE__*/ _react.createElement(slots.root, _extends({}, slotProps.root), iconPosition !== 'after' && slots.icon && /*#__PURE__*/ _react.createElement(slots.icon, _extends({}, slotProps.icon)), !iconOnly && state.root.children, iconPosition === 'after' && slots.icon && /*#__PURE__*/ _react.createElement(slots.icon, _extends({}, slotProps.icon)));
18
- }; //# sourceMappingURL=renderButton.js.map
19
-
6
+ exports.renderButton_unstable = void 0;
7
+ const React = /*#__PURE__*/require("react");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ /**
10
+ * Renders a Button component by passing the state defined props to the appropriate slots.
11
+ */
12
+ const renderButton_unstable = state => {
13
+ const {
14
+ slots,
15
+ slotProps
16
+ } = react_utilities_1.getSlots(state);
17
+ const {
18
+ iconOnly,
19
+ iconPosition
20
+ } = state;
21
+ return React.createElement(slots.root, {
22
+ ...slotProps.root
23
+ }, iconPosition !== 'after' && slots.icon && React.createElement(slots.icon, {
24
+ ...slotProps.icon
25
+ }), !iconOnly && state.root.children, iconPosition === 'after' && slots.icon && React.createElement(slots.icon, {
26
+ ...slotProps.icon
27
+ }));
28
+ };
29
+ exports.renderButton_unstable = renderButton_unstable;
20
30
  //# sourceMappingURL=renderButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Button/renderButton.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 Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n const {\n iconOnly,\n iconPosition\n } = state;\n return /*#__PURE__*/React.createElement(slots.root, _extends({}, slotProps.root), iconPosition !== 'after' && slots.icon && /*#__PURE__*/React.createElement(slots.icon, _extends({}, slotProps.icon)), !iconOnly && state.root.children, iconPosition === 'after' && slots.icon && /*#__PURE__*/React.createElement(slots.icon, _extends({}, slotProps.icon)));\n};\n//# sourceMappingURL=renderButton.js.map"],"names":["renderButton_unstable","state","slots","slotProps","getSlots","iconOnly","iconPosition","React","createElement","root","_extends","icon","children"],"mappings":";;;;+BAMaA;;aAAAA;;;;yBANQ;6DACE;gCACE;AAIlB,MAAMA,wBAAwBC,CAAAA,QAAS;IAC5C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,MAAM,EACJI,SAAQ,EACRC,aAAY,EACb,GAAGL;IACJ,OAAO,WAAW,GAAEM,OAAMC,aAAa,CAACN,MAAMO,IAAI,EAAEC,SAAS,CAAC,GAAGP,UAAUM,IAAI,GAAGH,iBAAiB,WAAWJ,MAAMS,IAAI,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACN,MAAMS,IAAI,EAAED,SAAS,CAAC,GAAGP,UAAUQ,IAAI,IAAI,CAACN,YAAYJ,MAAMQ,IAAI,CAACG,QAAQ,EAAEN,iBAAiB,WAAWJ,MAAMS,IAAI,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACN,MAAMS,IAAI,EAAED,SAAS,CAAC,GAAGP,UAAUQ,IAAI;AAC9V,GACA,wCAAwC"}
1
+ {"version":3,"mappings":";;;;;;AAAA;AACA;AAGA;;;AAGO,MAAMA,qBAAqB,GAAIC,KAAkB,IAAI;EAC1D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAcH,KAAK,CAAC;EACzD,MAAM;IAAEI,QAAQ;IAAEC;EAAY,CAAE,GAAGL,KAAK;EAExC,OACEM,oBAACL,KAAK,CAACM,IAAI;IAAA,GAAKL,SAAS,CAACK;EAAI,GAC3BF,YAAY,KAAK,OAAO,IAAIJ,KAAK,CAACO,IAAI,IAAIF,oBAACL,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,EAAI,EAC5E,CAACJ,QAAQ,IAAIJ,KAAK,CAACO,IAAI,CAACE,QAAQ,EAChCJ,YAAY,KAAK,OAAO,IAAIJ,KAAK,CAACO,IAAI,IAAIF,oBAACL,KAAK,CAACO,IAAI;IAAA,GAAKN,SAAS,CAACM;EAAI,EAAI,CAClE;AAEjB,CAAC;AAXYE,6BAAqB","names":["renderButton_unstable","state","slots","slotProps","react_utilities_1","iconOnly","iconPosition","React","root","icon","children","exports"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/renderButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ButtonSlots, ButtonState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton_unstable = (state: ButtonState) => {\n const { slots, slotProps } = getSlots<ButtonSlots>(state);\n const { iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n {!iconOnly && state.root.children}\n {iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"]}
@@ -1,44 +1,56 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useButton_unstable", {
6
- enumerable: true,
7
- get: ()=>useButton_unstable
4
+ value: true
8
5
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _reactAria = require("@fluentui/react-aria");
12
- const _reactUtilities = require("@fluentui/react-utilities");
13
- const _buttonContext = require("../../contexts/ButtonContext");
14
- const useButton_unstable = (props, ref)=>{
15
- const { size: contextSize } = (0, _buttonContext.useButtonContext)();
16
- const { appearance ='secondary' , as ='button' , disabled =false , disabledFocusable =false , icon , iconPosition ='before' , shape ='rounded' , size =contextSize ?? 'medium' } = props;
17
- const iconShorthand = (0, _reactUtilities.resolveShorthand)(icon);
18
- return {
19
- // Props passed at the top-level
20
- appearance,
21
- disabled,
22
- disabledFocusable,
23
- iconPosition,
24
- shape,
25
- size,
26
- // State calculated from a set of props
27
- iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
28
- // Slots definition
29
- components: {
30
- root: 'button',
31
- icon: 'span'
32
- },
33
- root: (0, _reactUtilities.getNativeElementProps)(as, (0, _reactAria.useARIAButtonShorthand)(props, {
34
- required: true,
35
- defaultProps: {
36
- ref: ref,
37
- type: 'button'
38
- }
39
- })),
40
- icon: iconShorthand
41
- };
42
- }; //# sourceMappingURL=useButton.js.map
43
-
6
+ exports.useButton_unstable = void 0;
7
+ const react_aria_1 = /*#__PURE__*/require("@fluentui/react-aria");
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ const ButtonContext_1 = /*#__PURE__*/require("../../contexts/ButtonContext");
10
+ /**
11
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
12
+ * @param props - User provided props to the Button component.
13
+ * @param ref - User provided ref to be passed to the Button component.
14
+ */
15
+ const useButton_unstable = (props, ref) => {
16
+ const {
17
+ size: contextSize
18
+ } = ButtonContext_1.useButtonContext();
19
+ const {
20
+ appearance = 'secondary',
21
+ as = 'button',
22
+ disabled = false,
23
+ disabledFocusable = false,
24
+ icon,
25
+ iconPosition = 'before',
26
+ shape = 'rounded',
27
+ size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium'
28
+ } = props;
29
+ const iconShorthand = react_utilities_1.resolveShorthand(icon);
30
+ return {
31
+ // Props passed at the top-level
32
+ appearance,
33
+ disabled,
34
+ disabledFocusable,
35
+ iconPosition,
36
+ shape,
37
+ size,
38
+ // State calculated from a set of props
39
+ iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
40
+ // Slots definition
41
+ components: {
42
+ root: 'button',
43
+ icon: 'span'
44
+ },
45
+ root: react_utilities_1.getNativeElementProps(as, react_aria_1.useARIAButtonShorthand(props, {
46
+ required: true,
47
+ defaultProps: {
48
+ ref: ref,
49
+ type: 'button'
50
+ }
51
+ })),
52
+ icon: iconShorthand
53
+ };
54
+ };
55
+ exports.useButton_unstable = useButton_unstable;
44
56
  //# sourceMappingURL=useButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Button/useButton.js"],"sourcesContent":["import * as React from 'react';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { useButtonContext } from '../../contexts/ButtonContext';\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (props, ref) => {\n const {\n size: contextSize\n } = useButtonContext();\n const {\n appearance = 'secondary',\n as = 'button',\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = contextSize ?? 'medium'\n } = props;\n const iconShorthand = resolveShorthand(icon);\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n // State calculated from a set of props\n iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),\n // Slots definition\n components: {\n root: 'button',\n icon: 'span'\n },\n root: getNativeElementProps(as, useARIAButtonShorthand(props, {\n required: true,\n defaultProps: {\n ref: ref,\n type: 'button'\n }\n })),\n icon: iconShorthand\n };\n};\n//# sourceMappingURL=useButton.js.map"],"names":["useButton_unstable","props","ref","size","contextSize","useButtonContext","appearance","as","disabled","disabledFocusable","icon","iconPosition","shape","iconShorthand","resolveShorthand","iconOnly","Boolean","children","components","root","getNativeElementProps","useARIAButtonShorthand","required","defaultProps","type"],"mappings":";;;;+BASaA;;aAAAA;;;6DATU;2BACgB;gCACiB;+BACvB;AAM1B,MAAMA,qBAAqB,CAACC,OAAOC,MAAQ;IAChD,MAAM,EACJC,MAAMC,YAAW,EAClB,GAAGC,IAAAA,+BAAgB;IACpB,MAAM,EACJC,YAAa,YAAW,EACxBC,IAAK,SAAQ,EACbC,UAAW,KAAK,CAAA,EAChBC,mBAAoB,KAAK,CAAA,EACzBC,KAAI,EACJC,cAAe,SAAQ,EACvBC,OAAQ,UAAS,EACjBT,MAAOC,eAAe,SAAQ,EAC/B,GAAGH;IACJ,MAAMY,gBAAgBC,IAAAA,gCAAgB,EAACJ;IACvC,OAAO;QACL,gCAAgC;QAChCJ;QACAE;QACAC;QACAE;QACAC;QACAT;QACA,uCAAuC;QACvCY,UAAUC,QAAQ,AAACH,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcI,QAAQ,AAAD,KAAM,CAAChB,MAAMgB,QAAQ;QAC3H,mBAAmB;QACnBC,YAAY;YACVC,MAAM;YACNT,MAAM;QACR;QACAS,MAAMC,IAAAA,qCAAqB,EAACb,IAAIc,IAAAA,iCAAsB,EAACpB,OAAO;YAC5DqB,UAAU,IAAI;YACdC,cAAc;gBACZrB,KAAKA;gBACLsB,MAAM;YACR;QACF;QACAd,MAAMG;IACR;AACF,GACA,qCAAqC"}
1
+ {"version":3,"mappings":";;;;;;AACA;AACA;AACA;AAGA;;;;;AAKO,MAAMA,kBAAkB,GAAG,CAChCC,KAAkB,EAClBC,GAAqD,KACtC;EACf,MAAM;IAAEC,IAAI,EAAEC;EAAW,CAAE,GAAGC,gCAAgB,EAAE;EAChD,MAAM;IACJC,UAAU,GAAG,WAAW;IACxBC,EAAE,GAAG,QAAQ;IACbC,QAAQ,GAAG,KAAK;IAChBC,iBAAiB,GAAG,KAAK;IACzBC,IAAI;IACJC,YAAY,GAAG,QAAQ;IACvBC,KAAK,GAAG,SAAS;IACjBT,IAAI,GAAGC,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI;EAAQ,CAC/B,GAAGH,KAAK;EACT,MAAMY,aAAa,GAAGC,kCAAgB,CAACJ,IAAI,CAAC;EAE5C,OAAO;IACL;IACAJ,UAAU;IACVE,QAAQ;IACRC,iBAAiB;IACjBE,YAAY;IACZC,KAAK;IACLT,IAAI;IAEJ;IACAY,QAAQ,EAAEC,OAAO,CAAC,cAAa,aAAbH,aAAa,uBAAbA,aAAa,CAAEI,QAAQ,KAAI,CAAChB,KAAK,CAACgB,QAAQ,CAAC;IAE7D;IACAC,UAAU,EAAE;MACVC,IAAI,EAAE,QAAQ;MACdT,IAAI,EAAE;KACP;IAEDS,IAAI,EAAEL,uCAAqB,CACzBP,EAAE,EACFa,mCAAsB,CAA2BnB,KAAK,EAAE;MACtDoB,QAAQ,EAAE,IAAI;MACdC,YAAY,EAAE;QACZpB,GAAG,EAAEA,GAAuD;QAC5DqB,IAAI,EAAE;;KAET,CAAC,CACH;IACDb,IAAI,EAAEG;GACP;AACH,CAAC;AA/CYW,0BAAkB","names":["useButton_unstable","props","ref","size","contextSize","ButtonContext_1","appearance","as","disabled","disabledFocusable","icon","iconPosition","shape","iconShorthand","react_utilities_1","iconOnly","Boolean","children","components","root","react_aria_1","required","defaultProps","type","exports"],"sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/useButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { ARIAButtonSlotProps, useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type { ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const { size: contextSize } = useButtonContext();\n const {\n appearance = 'secondary',\n as = 'button',\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = contextSize ?? 'medium',\n } = props;\n const iconShorthand = resolveShorthand(icon);\n\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n },\n\n root: getNativeElementProps(\n as,\n useARIAButtonShorthand<ARIAButtonSlotProps<'a'>>(props, {\n required: true,\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: 'button',\n },\n }),\n ),\n icon: iconShorthand,\n };\n};\n"]}