@fluentui/react-button 0.0.0-nightly-20230317-0436.1 → 0.0.0-nightly-20230317-1454.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/.swcrc +39 -0
- 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 +3 -9
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +13 -12
- 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 +3 -13
- 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 +3 -9
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +8 -9
- 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 +3 -9
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +14 -13
- 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 +3 -2
- 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 +2 -5
- 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 +5 -4
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js +5 -4
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js +5 -4
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js +5 -4
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js +5 -4
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js +19 -21
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js +3 -2
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +17 -19
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js +14 -26
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +40 -52
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +1135 -477
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +19 -21
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +3 -2
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +18 -20
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +14 -30
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +30 -36
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +315 -184
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +19 -22
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js +3 -2
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +18 -20
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +14 -26
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +33 -37
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +166 -106
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +19 -22
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +3 -2
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +18 -20
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +13 -22
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +66 -79
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +263 -106
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +19 -21
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +3 -2
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +18 -20
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +6 -8
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +14 -16
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +897 -380
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/contexts/ButtonContext.js +17 -19
- package/lib-commonjs/contexts/ButtonContext.js.map +1 -1
- package/lib-commonjs/contexts/index.js +5 -4
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/index.js +47 -179
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +5 -4
- 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 +10 -10
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./components/SplitButton/index"), exports);
|
7
|
+
//# sourceMappingURL=SplitButton.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=SplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/SplitButton.js"],"sourcesContent":["export * from \"./components/SplitButton/index\";\n//# sourceMappingURL=SplitButton.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,uCAAuC"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./components/ToggleButton/index"), exports);
|
7
|
+
//# sourceMappingURL=ToggleButton.js.map
|
8
|
+
|
8
9
|
//# sourceMappingURL=ToggleButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/ToggleButton.js"],"sourcesContent":["export * from \"./components/ToggleButton/index\";\n//# sourceMappingURL=ToggleButton.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,wCAAwC"}
|
@@ -1,27 +1,25 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "Button", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>Button
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
useButtonStyles_unstable: useCustomStyles
|
20
|
-
} = react_shared_contexts_1.useCustomStyleHooks_unstable();
|
21
|
-
useCustomStyles(state);
|
22
|
-
return renderButton_1.renderButton_unstable(state);
|
23
|
-
// Casting is required due to lack of distributive union to support unions on @types/react
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _renderButton = require("./renderButton");
|
12
|
+
const _useButton = require("./useButton");
|
13
|
+
const _useButtonStyles = require("./useButtonStyles");
|
14
|
+
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
15
|
+
const Button = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
16
|
+
const state = (0, _useButton.useButton_unstable)(props, ref);
|
17
|
+
(0, _useButtonStyles.useButtonStyles_unstable)(state);
|
18
|
+
const { useButtonStyles_unstable: useCustomStyles } = (0, _reactSharedContexts.useCustomStyleHooks_unstable)();
|
19
|
+
useCustomStyles(state);
|
20
|
+
return (0, _renderButton.renderButton_unstable)(state);
|
21
|
+
// Casting is required due to lack of distributive union to support unions on @types/react
|
24
22
|
});
|
23
|
+
Button.displayName = "Button"; //# sourceMappingURL=Button.js.map
|
25
24
|
|
26
|
-
exports.Button.displayName = 'Button';
|
27
25
|
//# sourceMappingURL=Button.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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\";\nimport { useCustomStyleHooks_unstable } from \"@fluentui/react-shared-contexts\";\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 const {\n useButtonStyles_unstable: useCustomStyles\n } = useCustomStyleHooks_unstable();\n useCustomStyles(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","useCustomStyles","useCustomStyleHooks_unstable","renderButton_unstable","displayName"],"mappings":";;;;+BAQaA;;aAAAA;;;6DARU;8BACe;2BACH;iCACM;qCACI;AAItC,MAAMA,SAAS,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IAClE,MAAMC,QAAQC,IAAAA,6BAAkB,EAACH,OAAOC;IACxCG,IAAAA,yCAAwB,EAACF;IACzB,MAAM,EACJE,0BAA0BC,gBAAe,EAC1C,GAAGC,IAAAA,iDAA4B;IAChCD,gBAAgBH;IAChB,OAAOK,IAAAA,mCAAqB,EAACL;AAC7B,0FAA0F;AAC5F;AAEAL,OAAOW,WAAW,GAAG,UACrB,kCAAkC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Button/Button.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=Button.types.js.map"],"names":[],"mappings":";;;;CACA,wCAAwC"}
|
@@ -1,24 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
5
|
-
});
|
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
|
-
}
|
3
|
+
value: true
|
17
4
|
});
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
23
14
|
});
|
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
|
+
|
24
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,30 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "renderButton_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>renderButton_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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;
|
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 renderButton_unstable = (state)=>{
|
13
|
+
const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
|
14
|
+
const { iconOnly , iconPosition } = state;
|
15
|
+
return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, iconPosition !== "after" && slots.icon && /*#__PURE__*/ _react.createElement(slots.icon, slotProps.icon), !iconOnly && state.root.children, iconPosition === "after" && slots.icon && /*#__PURE__*/ _react.createElement(slots.icon, slotProps.icon));
|
16
|
+
}; //# sourceMappingURL=renderButton.js.map
|
17
|
+
|
30
18
|
//# sourceMappingURL=renderButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Button/renderButton.js"],"sourcesContent":["import * 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, slotProps.root, iconPosition !== \"after\" && slots.icon && /*#__PURE__*/React.createElement(slots.icon, slotProps.icon), !iconOnly && state.root.children, iconPosition === \"after\" && slots.icon && /*#__PURE__*/React.createElement(slots.icon, slotProps.icon));\n};\n//# sourceMappingURL=renderButton.js.map"],"names":["renderButton_unstable","state","slots","slotProps","getSlots","iconOnly","iconPosition","React","createElement","root","icon","children"],"mappings":";;;;+BAKaA;;aAAAA;;;6DALU;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,EAAEN,UAAUM,IAAI,EAAEH,iBAAiB,WAAWJ,MAAMQ,IAAI,IAAI,WAAW,GAAEH,OAAMC,aAAa,CAACN,MAAMQ,IAAI,EAAEP,UAAUO,IAAI,GAAG,CAACL,YAAYJ,MAAMQ,IAAI,CAACE,QAAQ,EAAEL,iBAAiB,WAAWJ,MAAMQ,IAAI,IAAI,WAAW,GAAEH,OAAMC,aAAa,CAACN,MAAMQ,IAAI,EAAEP,UAAUO,IAAI;AACrT,GACA,wCAAwC"}
|
@@ -1,56 +1,44 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "useButton_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useButton_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
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;
|
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?.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
|
+
|
56
44
|
//# sourceMappingURL=useButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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?.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,QAAQH,eAAeI,YAAY,CAAChB,MAAMgB,QAAQ;QAC5D,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"}
|