@fluentui/react-button 9.1.7 → 9.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +113 -1
- package/CHANGELOG.md +31 -2
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js.map +1 -1
- 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.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +9 -12
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +63 -3
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +16 -15
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-amd/Button.js +6 -0
- package/lib-amd/Button.js.map +1 -0
- package/lib-amd/CompoundButton.js +6 -0
- package/lib-amd/CompoundButton.js.map +1 -0
- package/lib-amd/MenuButton.js +6 -0
- package/lib-amd/MenuButton.js.map +1 -0
- package/lib-amd/SplitButton.js +6 -0
- package/lib-amd/SplitButton.js.map +1 -0
- package/lib-amd/ToggleButton.js +6 -0
- package/lib-amd/ToggleButton.js.map +1 -0
- package/lib-amd/components/Button/Button.js +16 -0
- package/lib-amd/components/Button/Button.js.map +1 -0
- package/lib-amd/components/Button/Button.types.js +5 -0
- package/lib-amd/components/Button/Button.types.js.map +1 -0
- package/lib-amd/components/Button/index.js +11 -0
- package/lib-amd/components/Button/index.js.map +1 -0
- package/lib-amd/components/Button/renderButton.js +18 -0
- package/lib-amd/components/Button/renderButton.js.map +1 -0
- package/lib-amd/components/Button/useButton.js +40 -0
- package/lib-amd/components/Button/useButton.js.map +1 -0
- package/lib-amd/components/Button/useButtonStyles.js +187 -0
- package/lib-amd/components/Button/useButtonStyles.js.map +1 -0
- package/lib-amd/components/CompoundButton/CompoundButton.js +16 -0
- package/lib-amd/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/CompoundButton.types.js +5 -0
- package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib-amd/components/CompoundButton/index.js +12 -0
- package/lib-amd/components/CompoundButton/index.js.map +1 -0
- package/lib-amd/components/CompoundButton/renderCompoundButton.js +20 -0
- package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/useCompoundButton.js +27 -0
- package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js +211 -0
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib-amd/components/MenuButton/MenuButton.js +17 -0
- package/lib-amd/components/MenuButton/MenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/MenuButton.types.js +5 -0
- package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib-amd/components/MenuButton/index.js +12 -0
- package/lib-amd/components/MenuButton/index.js.map +1 -0
- package/lib-amd/components/MenuButton/renderMenuButton.js +18 -0
- package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/useMenuButton.js +30 -0
- package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js +97 -0
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.js +17 -0
- package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-amd/components/SplitButton/index.js +12 -0
- package/lib-amd/components/SplitButton/index.js.map +1 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButton.js +67 -0
- package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js +147 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.js +16 -0
- package/lib-amd/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.types.js +5 -0
- package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib-amd/components/ToggleButton/index.js +12 -0
- package/lib-amd/components/ToggleButton/index.js.map +1 -0
- package/lib-amd/components/ToggleButton/renderToggleButton.js +7 -0
- package/lib-amd/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/useToggleButton.js +17 -0
- package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js +75 -0
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-amd/index.js +32 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/utils/index.js +6 -0
- package/lib-amd/utils/index.js.map +1 -0
- package/lib-amd/utils/useToggleState.js +27 -0
- package/lib-amd/utils/useToggleState.js.map +1 -0
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +9 -12
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +64 -3
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +16 -15
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useToggleState.js.map +1 -1
- package/package.json +13 -13
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/renderButton.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,qBAAqB,GAAG,UAAC,KAAkB;QAChD,IAAA,KAAuB,0BAAQ,CAAc,KAAK,CAAC,EAAjD,KAAK,WAAA,EAAE,SAAS,eAAiC,CAAC;QAClD,IAAA,QAAQ,GAAmB,KAAK,SAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QAEzC,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,YAAY,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAC5E,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ;YAChC,YAAY,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CAClE,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,qBAAqB,yBAWhC","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"]}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
define(["require", "exports", "@fluentui/react-aria", "@fluentui/react-utilities"], function (require, exports, react_aria_1, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
7
|
+
* @param props - User provided props to the Button component.
|
8
|
+
* @param ref - User provided ref to be passed to the Button component.
|
9
|
+
*/
|
10
|
+
var useButton_unstable = function (props, ref) {
|
11
|
+
var _a = props.appearance, appearance = _a === void 0 ? 'secondary' : _a, _b = props.as, as = _b === void 0 ? 'button' : _b, _c = props.disabled, disabled = _c === void 0 ? false : _c, _d = props.disabledFocusable, disabledFocusable = _d === void 0 ? false : _d, icon = props.icon, _e = props.iconPosition, iconPosition = _e === void 0 ? 'before' : _e, _f = props.shape, shape = _f === void 0 ? 'rounded' : _f, _g = props.size, size = _g === void 0 ? 'medium' : _g;
|
12
|
+
var iconShorthand = react_utilities_1.resolveShorthand(icon);
|
13
|
+
return {
|
14
|
+
// Props passed at the top-level
|
15
|
+
appearance: appearance,
|
16
|
+
disabled: disabled,
|
17
|
+
disabledFocusable: disabledFocusable,
|
18
|
+
iconPosition: iconPosition,
|
19
|
+
shape: shape,
|
20
|
+
size: size,
|
21
|
+
// State calculated from a set of props
|
22
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
|
23
|
+
// Slots definition
|
24
|
+
components: {
|
25
|
+
root: 'button',
|
26
|
+
icon: 'span',
|
27
|
+
},
|
28
|
+
root: react_utilities_1.getNativeElementProps(as, react_aria_1.useARIAButtonShorthand(props, {
|
29
|
+
required: true,
|
30
|
+
defaultProps: {
|
31
|
+
ref: ref,
|
32
|
+
type: 'button',
|
33
|
+
},
|
34
|
+
})),
|
35
|
+
icon: iconShorthand,
|
36
|
+
};
|
37
|
+
};
|
38
|
+
exports.useButton_unstable = useButton_unstable;
|
39
|
+
});
|
40
|
+
//# sourceMappingURL=useButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/useButton.ts"],"names":[],"mappings":";;;;IAKA;;;;OAIG;IACI,IAAM,kBAAkB,GAAG,UAChC,KAAkB,EAClB,GAAqD;QAGnD,IAAA,KAQE,KAAK,WARiB,EAAxB,UAAU,mBAAG,WAAW,KAAA,EACxB,KAOE,KAAK,GAPM,EAAb,EAAE,mBAAG,QAAQ,KAAA,EACb,KAME,KAAK,SANS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,KAKE,KAAK,kBALkB,EAAzB,iBAAiB,mBAAG,KAAK,KAAA,EACzB,IAAI,GAIF,KAAK,KAJH,EACJ,KAGE,KAAK,aAHgB,EAAvB,YAAY,mBAAG,QAAQ,KAAA,EACvB,KAEE,KAAK,MAFU,EAAjB,KAAK,mBAAG,SAAS,KAAA,EACjB,KACE,KAAK,KADQ,EAAf,IAAI,mBAAG,QAAQ,KAAA,CACP;QACV,IAAM,aAAa,GAAG,kCAAgB,CAAC,IAAI,CAAC,CAAC;QAE7C,OAAO;YACL,gCAAgC;YAChC,UAAU,YAAA;YACV,QAAQ,UAAA;YACR,iBAAiB,mBAAA;YACjB,YAAY,cAAA;YACZ,KAAK,OAAA;YACL,IAAI,MAAA;YAEJ,uCAAuC;YACvC,QAAQ,EAAE,OAAO,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAE7D,mBAAmB;YACnB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM;aACb;YAED,IAAI,EAAE,uCAAqB,CACzB,EAAE,EACF,mCAAsB,CAA2B,KAAK,EAAE;gBACtD,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE;oBACZ,GAAG,EAAE,GAAuD;oBAC5D,IAAI,EAAE,QAAQ;iBACf;aACF,CAAC,CACH;YACD,IAAI,EAAE,aAAa;SACpB,CAAC;IACJ,CAAC,CAAC;IA9CW,QAAA,kBAAkB,sBA8C7B","sourcesContent":["import * as React from 'react';\nimport { ARIAButtonSlotProps, useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\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 {\n appearance = 'secondary',\n as = 'button',\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = '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"]}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-icons", "@fluentui/react-tabster", "@fluentui/react-theme", "@griffel/react"], function (require, exports, tslib_1, react_icons_1, react_tabster_1, react_theme_1, react_1) {
|
2
|
+
"use strict";
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.useButtonStyles_unstable = exports.buttonClassNames = void 0;
|
6
|
+
exports.buttonClassNames = {
|
7
|
+
root: 'fui-Button',
|
8
|
+
icon: 'fui-Button__icon',
|
9
|
+
};
|
10
|
+
var iconSpacingVar = '--fui-Button__icon--spacing';
|
11
|
+
var buttonSpacingSmall = '3px';
|
12
|
+
var buttonSpacingMedium = '5px';
|
13
|
+
var useRootStyles = react_1.makeStyles({
|
14
|
+
// Base styles
|
15
|
+
base: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ alignItems: 'center', boxSizing: 'border-box', display: 'inline-flex', justifyContent: 'center', textDecorationLine: 'none', verticalAlign: 'middle' }, react_1.shorthands.margin(0)), react_1.shorthands.overflow('hidden')), { backgroundColor: react_theme_1.tokens.colorNeutralBackground1, color: react_theme_1.tokens.colorNeutralForeground1 }), react_1.shorthands.border(react_theme_1.tokens.strokeWidthThin, 'solid', react_theme_1.tokens.colorNeutralStroke1)), { fontFamily: react_theme_1.tokens.fontFamilyBase, outlineStyle: 'none', ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Hover }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)), (_a = { color: react_theme_1.tokens.colorNeutralForeground1Hover, cursor: 'pointer' }, _a["& ." + react_icons_1.iconFilledClassName] = {
|
16
|
+
display: 'inline',
|
17
|
+
}, _a["& ." + react_icons_1.iconRegularClassName] = {
|
18
|
+
display: 'none',
|
19
|
+
}, _a)), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Pressed }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)), (_b = { color: react_theme_1.tokens.colorNeutralForeground1Pressed, outlineStyle: 'none' }, _b["& ." + react_icons_1.iconFilledClassName] = {
|
20
|
+
display: 'inline',
|
21
|
+
}, _b["& ." + react_icons_1.iconRegularClassName] = {
|
22
|
+
display: 'none',
|
23
|
+
}, _b)) }),
|
24
|
+
// Transition styles
|
25
|
+
transition: {
|
26
|
+
transitionDuration: react_theme_1.tokens.durationFaster,
|
27
|
+
transitionProperty: 'background, border, color',
|
28
|
+
transitionTimingFunction: react_theme_1.tokens.curveEasyEase,
|
29
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
30
|
+
transitionDuration: '0.01ms',
|
31
|
+
},
|
32
|
+
},
|
33
|
+
// High contrast styles
|
34
|
+
highContrast: {
|
35
|
+
'@media (forced-colors: active)': {
|
36
|
+
':focus': tslib_1.__assign({}, react_1.shorthands.borderColor('ButtonText')),
|
37
|
+
':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'HighlightText' }, react_1.shorthands.borderColor('Highlight')), { color: 'Highlight', forcedColorAdjust: 'none' }),
|
38
|
+
':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'HighlightText' }, react_1.shorthands.borderColor('Highlight')), { color: 'Highlight', forcedColorAdjust: 'none' }),
|
39
|
+
},
|
40
|
+
},
|
41
|
+
// Appearance variations
|
42
|
+
outline: {
|
43
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
44
|
+
':hover': {
|
45
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover,
|
46
|
+
},
|
47
|
+
':hover:active': {
|
48
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
primary: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackground }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackgroundHover }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorBrandBackgroundPressed }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForegroundOnBrand }) }),
|
52
|
+
secondary: {
|
53
|
+
/* The secondary styles are exactly the same as the base styles. */
|
54
|
+
},
|
55
|
+
subtle: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackground }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundHover }, react_1.shorthands.borderColor('transparent')), (_c = { color: react_theme_1.tokens.colorNeutralForeground2Hover }, _c["& ." + exports.buttonClassNames.icon] = {
|
56
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandHover,
|
57
|
+
}, _c)), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed }, react_1.shorthands.borderColor('transparent')), (_d = { color: react_theme_1.tokens.colorNeutralForeground2Pressed }, _d["& ." + exports.buttonClassNames.icon] = {
|
58
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandPressed,
|
59
|
+
}, _d)) }),
|
60
|
+
transparent: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2, ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2BrandHover }), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed }, react_1.shorthands.borderColor('transparent')), { color: react_theme_1.tokens.colorNeutralForeground2BrandPressed }) }),
|
61
|
+
// Shape variations
|
62
|
+
circular: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular)),
|
63
|
+
rounded: {
|
64
|
+
/* The borderRadius rounded styles are handled in the size variations */
|
65
|
+
},
|
66
|
+
square: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusNone)),
|
67
|
+
// Size variations
|
68
|
+
small: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(buttonSpacingSmall, react_theme_1.tokens.spacingHorizontalS)), { minWidth: '64px' }), react_1.shorthands.borderRadius(buttonSpacingSmall)), { fontSize: react_theme_1.tokens.fontSizeBase200, fontWeight: react_theme_1.tokens.fontWeightRegular, lineHeight: react_theme_1.tokens.lineHeightBase200 }),
|
69
|
+
medium: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(buttonSpacingMedium, react_theme_1.tokens.spacingHorizontalM)), { minWidth: '96px' }), react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { fontSize: react_theme_1.tokens.fontSizeBase300, fontWeight: react_theme_1.tokens.fontWeightSemibold, lineHeight: react_theme_1.tokens.lineHeightBase300 }),
|
70
|
+
large: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingVerticalS, react_theme_1.tokens.spacingHorizontalL)), { minWidth: '96px' }), react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)), { fontSize: react_theme_1.tokens.fontSizeBase400, fontWeight: react_theme_1.tokens.fontWeightSemibold, lineHeight: react_theme_1.tokens.lineHeightBase400 }),
|
71
|
+
});
|
72
|
+
var useRootDisabledStyles = react_1.makeStyles({
|
73
|
+
// Base styles
|
74
|
+
base: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed', ':hover': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), (_e = { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed' }, _e["& ." + react_icons_1.iconFilledClassName] = {
|
75
|
+
display: 'none',
|
76
|
+
}, _e["& ." + react_icons_1.iconRegularClassName] = {
|
77
|
+
display: 'inline',
|
78
|
+
}, _e)), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), (_f = { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed' }, _f["& ." + react_icons_1.iconFilledClassName] = {
|
79
|
+
display: 'none',
|
80
|
+
}, _f["& ." + react_icons_1.iconRegularClassName] = {
|
81
|
+
display: 'inline',
|
82
|
+
}, _f)) }),
|
83
|
+
// High contrast styles
|
84
|
+
highContrast: {
|
85
|
+
'@media (forced-colors: active)': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')), { color: 'GrayText', ':focus': tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')), ':hover': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')), { color: 'GrayText' }), ':hover:active': tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor('GrayText')), { color: 'GrayText' }) }),
|
86
|
+
},
|
87
|
+
// Appearance variations
|
88
|
+
outline: {
|
89
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
90
|
+
':hover': {
|
91
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
92
|
+
},
|
93
|
+
':hover:active': {
|
94
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
95
|
+
},
|
96
|
+
},
|
97
|
+
primary: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({}, react_1.shorthands.borderColor('transparent')) }),
|
98
|
+
secondary: {
|
99
|
+
/* The secondary styles are exactly the same as the base styles. */
|
100
|
+
},
|
101
|
+
subtle: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')) }),
|
102
|
+
transparent: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), { ':hover': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')), ':hover:active': tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorTransparentBackground }, react_1.shorthands.borderColor('transparent')) }),
|
103
|
+
});
|
104
|
+
var useRootFocusStyles = react_1.makeStyles({
|
105
|
+
base: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)), { outlineColor: react_theme_1.tokens.colorTransparentStroke, outlineWidth: react_theme_1.tokens.strokeWidthThick, outlineStyle: 'solid', boxShadow: "\n " + react_theme_1.tokens.shadow4 + ",\n 0 0 0 2px " + react_theme_1.tokens.colorStrokeFocus2 + "\n ", zIndex: 1 })),
|
106
|
+
// Shape variations
|
107
|
+
circular: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular))),
|
108
|
+
rounded: {
|
109
|
+
/* The rounded styles are exactly the same as the base styles. */
|
110
|
+
},
|
111
|
+
square: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusNone))),
|
112
|
+
// Primary styles
|
113
|
+
primary: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralForegroundOnBrand)), { boxShadow: react_theme_1.tokens.shadow2 + ", 0 0 0 2px " + react_theme_1.tokens.colorStrokeFocus2 })),
|
114
|
+
// Size variations
|
115
|
+
small: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusSmall))),
|
116
|
+
medium: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium))),
|
117
|
+
large: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusLarge))),
|
118
|
+
});
|
119
|
+
var useRootIconOnlyStyles = react_1.makeStyles({
|
120
|
+
// Size variations
|
121
|
+
small: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalXS)), { minWidth: '28px', maxWidth: '28px' }),
|
122
|
+
medium: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalXS)), { minWidth: '32px', maxWidth: '32px' }),
|
123
|
+
large: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalSNudge)), { minWidth: '40px', maxWidth: '40px' }),
|
124
|
+
});
|
125
|
+
var useIconStyles = react_1.makeStyles({
|
126
|
+
// Base styles
|
127
|
+
base: {
|
128
|
+
alignItems: 'center',
|
129
|
+
display: 'inline-flex',
|
130
|
+
justifyContent: 'center',
|
131
|
+
},
|
132
|
+
// Size variations
|
133
|
+
small: (_g = {
|
134
|
+
fontSize: '20px',
|
135
|
+
height: '20px',
|
136
|
+
width: '20px'
|
137
|
+
},
|
138
|
+
_g[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalXS,
|
139
|
+
_g),
|
140
|
+
medium: (_h = {
|
141
|
+
fontSize: '20px',
|
142
|
+
height: '20px',
|
143
|
+
width: '20px'
|
144
|
+
},
|
145
|
+
_h[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalSNudge,
|
146
|
+
_h),
|
147
|
+
large: (_j = {
|
148
|
+
fontSize: '24px',
|
149
|
+
height: '24px',
|
150
|
+
width: '24px'
|
151
|
+
},
|
152
|
+
_j[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalSNudge,
|
153
|
+
_j),
|
154
|
+
// Icon position variations
|
155
|
+
before: {
|
156
|
+
marginRight: "var(" + iconSpacingVar + ")",
|
157
|
+
},
|
158
|
+
after: {
|
159
|
+
marginLeft: "var(" + iconSpacingVar + ")",
|
160
|
+
},
|
161
|
+
});
|
162
|
+
var useButtonStyles_unstable = function (state) {
|
163
|
+
var rootStyles = useRootStyles();
|
164
|
+
var rootDisabledStyles = useRootDisabledStyles();
|
165
|
+
var rootFocusStyles = useRootFocusStyles();
|
166
|
+
var rootIconOnlyStyles = useRootIconOnlyStyles();
|
167
|
+
var iconStyles = useIconStyles();
|
168
|
+
var appearance = state.appearance, disabled = state.disabled, disabledFocusable = state.disabledFocusable, iconOnly = state.iconOnly, iconPosition = state.iconPosition, shape = state.shape, size = state.size;
|
169
|
+
state.root.className = react_1.mergeClasses(exports.buttonClassNames.root,
|
170
|
+
// Root styles
|
171
|
+
rootStyles.base, rootStyles.transition, rootStyles.highContrast, appearance && rootStyles[appearance], rootStyles[size], rootStyles[shape],
|
172
|
+
// Disabled styles
|
173
|
+
(disabled || disabledFocusable) && rootDisabledStyles.base, (disabled || disabledFocusable) && rootDisabledStyles.highContrast, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],
|
174
|
+
// Focus styles
|
175
|
+
rootFocusStyles.base, appearance === 'primary' && rootFocusStyles.primary, rootFocusStyles[size], rootFocusStyles[shape],
|
176
|
+
// Icon-only styles
|
177
|
+
iconOnly && rootIconOnlyStyles[size],
|
178
|
+
// User provided class name
|
179
|
+
state.root.className);
|
180
|
+
if (state.icon) {
|
181
|
+
state.icon.className = react_1.mergeClasses(exports.buttonClassNames.icon, iconStyles.base, state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition], iconStyles[size], state.icon.className);
|
182
|
+
}
|
183
|
+
return state;
|
184
|
+
};
|
185
|
+
exports.useButtonStyles_unstable = useButtonStyles_unstable;
|
186
|
+
});
|
187
|
+
//# sourceMappingURL=useButtonStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/Button/useButtonStyles.ts"],"names":[],"mappings":";;;;;IAOa,QAAA,gBAAgB,GAAgC;QAC3D,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,kBAAkB;KACzB,CAAC;IAEF,IAAM,cAAc,GAAG,6BAA6B,CAAC;IAErD,IAAM,kBA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kB,CAAC,IAAI,EAC1D,CAAC,QAAQ,IAAI,iBAAiB,CAAC,IAAI,kBAAkB,CAAC,YAAY,EAClE,UAAU,IAAI,CAAC,QAAQ,IAAI,iBAAiB,CAAC,IAAI,kBAAkB,CAAC,UAAU,CAAC;QAE/E,eAAe;QACf,eAAe,CAAC,IAAI,EACpB,UAAU,KAAK,SAAS,IAAI,eAAe,CAAC,OAAO,EACnD,eAAe,CAAC,IAAI,CAAC,EACrB,eAAe,CAAC,KAAK,CAAC;QAEtB,mBAAmB;QACnB,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC;QAEpC,2BAA2B;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,IAAI,KAAK,CAAC,IAAI,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,wBAAgB,CAAC,IAAI,EACrB,UAAU,CAAC,IAAI,EACf,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,UAAU,CAAC,YAAY,CAAC,EAC7F,UAAU,CAAC,IAAI,CAAC,EAChB,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;SACH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAjDW,QAAA,wBAAwB,4BAiDnC","sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots, ButtonState } from './Button.types';\n\nexport const buttonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-Button',\n icon: 'fui-Button__icon',\n};\n\nconst iconSpacingVar = '--fui-Button__icon--spacing';\n\nconst buttonSpacingSmall = '3px';\nconst buttonSpacingMedium = '5px';\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n alignItems: 'center',\n boxSizing: 'border-box',\n display: 'inline-flex',\n justifyContent: 'center',\n textDecorationLine: 'none',\n verticalAlign: 'middle',\n\n ...shorthands.margin(0),\n\n ...shorthands.overflow('hidden'),\n\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),\n\n fontFamily: tokens.fontFamilyBase,\n\n outlineStyle: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n\n cursor: 'pointer',\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n\n outlineStyle: 'none',\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n },\n },\n\n // Transition styles\n transition: {\n transitionDuration: tokens.durationFaster,\n transitionProperty: 'background, border, color',\n transitionTimingFunction: tokens.curveEasyEase,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n ':focus': {\n ...shorthands.borderColor('ButtonText'),\n },\n\n ':hover': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n forcedColorAdjust: 'none',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n forcedColorAdjust: 'none',\n },\n },\n },\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n primary: {\n backgroundColor: tokens.colorBrandBackground,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandHover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n\n // Shape variations\n circular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n rounded: {\n /* The borderRadius rounded styles are handled in the size variations */\n },\n square: {\n ...shorthands.borderRadius(tokens.borderRadiusNone),\n },\n\n // Size variations\n small: {\n ...shorthands.padding(buttonSpacingSmall, tokens.spacingHorizontalS),\n\n minWidth: '64px',\n\n ...shorthands.borderRadius(buttonSpacingSmall),\n\n fontSize: tokens.fontSizeBase200,\n fontWeight: tokens.fontWeightRegular,\n lineHeight: tokens.lineHeightBase200,\n },\n medium: {\n ...shorthands.padding(buttonSpacingMedium, tokens.spacingHorizontalM),\n\n minWidth: '96px',\n\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightSemibold,\n lineHeight: tokens.lineHeightBase300,\n },\n large: {\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalL),\n\n minWidth: '96px',\n\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n\n fontSize: tokens.fontSizeBase400,\n fontWeight: tokens.fontWeightSemibold,\n lineHeight: tokens.lineHeightBase400,\n },\n});\n\nconst useRootDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n cursor: 'not-allowed',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n cursor: 'not-allowed',\n\n [`& .${iconFilledClassName}`]: {\n display: 'none',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'inline',\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n cursor: 'not-allowed',\n\n [`& .${iconFilledClassName}`]: {\n display: 'none',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'inline',\n },\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n\n ':focus': {\n ...shorthands.borderColor('GrayText'),\n },\n\n ':hover': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n },\n\n ':hover:active': {\n ...shorthands.borderColor('GrayText'),\n color: 'GrayText',\n },\n },\n },\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackground,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackground,\n },\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackground,\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nconst useRootFocusStyles = makeStyles({\n base: createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n outlineColor: tokens.colorTransparentStroke,\n outlineWidth: tokens.strokeWidthThick,\n outlineStyle: 'solid',\n boxShadow: `\n ${tokens.shadow4},\n 0 0 0 2px ${tokens.colorStrokeFocus2}\n `,\n zIndex: 1,\n }),\n\n // Shape variations\n circular: createCustomFocusIndicatorStyle({\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n }),\n rounded: {\n /* The rounded styles are exactly the same as the base styles. */\n },\n square: createCustomFocusIndicatorStyle({\n ...shorthands.borderRadius(tokens.borderRadiusNone),\n }),\n\n // Primary styles\n primary: createCustomFocusIndicatorStyle({\n ...shorthands.borderColor(tokens.colorNeutralForegroundOnBrand),\n boxShadow: `${tokens.shadow2}, 0 0 0 2px ${tokens.colorStrokeFocus2}`,\n }),\n\n // Size variations\n small: createCustomFocusIndicatorStyle({\n ...shorthands.borderRadius(tokens.borderRadiusSmall),\n }),\n medium: createCustomFocusIndicatorStyle({\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n }),\n large: createCustomFocusIndicatorStyle({\n ...shorthands.borderRadius(tokens.borderRadiusLarge),\n }),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n // Size variations\n small: {\n ...shorthands.padding(tokens.spacingHorizontalXS),\n\n minWidth: '28px',\n maxWidth: '28px',\n },\n medium: {\n ...shorthands.padding(tokens.spacingHorizontalXS),\n\n minWidth: '32px',\n maxWidth: '32px',\n },\n large: {\n ...shorthands.padding(tokens.spacingHorizontalSNudge),\n\n minWidth: '40px',\n maxWidth: '40px',\n },\n});\n\nconst useIconStyles = makeStyles({\n // Base styles\n base: {\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n },\n\n // Size variations\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n\n [iconSpacingVar]: tokens.spacingHorizontalXS,\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n\n [iconSpacingVar]: tokens.spacingHorizontalSNudge,\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n\n [iconSpacingVar]: tokens.spacingHorizontalSNudge,\n },\n\n // Icon position variations\n before: {\n marginRight: `var(${iconSpacingVar})`,\n },\n after: {\n marginLeft: `var(${iconSpacingVar})`,\n },\n});\n\nexport const useButtonStyles_unstable = (state: ButtonState): ButtonState => {\n const rootStyles = useRootStyles();\n const rootDisabledStyles = useRootDisabledStyles();\n const rootFocusStyles = useRootFocusStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n\n const { appearance, disabled, disabledFocusable, iconOnly, iconPosition, shape, size } = state;\n\n state.root.className = mergeClasses(\n buttonClassNames.root,\n\n // Root styles\n rootStyles.base,\n rootStyles.transition,\n rootStyles.highContrast,\n appearance && rootStyles[appearance],\n rootStyles[size],\n rootStyles[shape],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootDisabledStyles.base,\n (disabled || disabledFocusable) && rootDisabledStyles.highContrast,\n appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],\n\n // Focus styles\n rootFocusStyles.base,\n appearance === 'primary' && rootFocusStyles.primary,\n rootFocusStyles[size],\n rootFocusStyles[shape],\n\n // Icon-only styles\n iconOnly && rootIconOnlyStyles[size],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n buttonClassNames.icon,\n iconStyles.base,\n state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition],\n iconStyles[size],\n state.icon.className,\n );\n }\n\n return state;\n};\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
define(["require", "exports", "react", "./renderCompoundButton", "./useCompoundButton", "./useCompoundButtonStyles"], function (require, exports, React, renderCompoundButton_1, useCompoundButton_1, useCompoundButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.CompoundButton = void 0;
|
5
|
+
/**
|
6
|
+
* CompoundButtons are buttons that can have secondary content that adds extra information to the user.
|
7
|
+
*/
|
8
|
+
exports.CompoundButton = React.forwardRef(function (props, ref) {
|
9
|
+
var state = useCompoundButton_1.useCompoundButton_unstable(props, ref);
|
10
|
+
useCompoundButtonStyles_1.useCompoundButtonStyles_unstable(state);
|
11
|
+
return renderCompoundButton_1.renderCompoundButton_unstable(state);
|
12
|
+
// Casting is required due to lack of distributive union to support unions on @types/react
|
13
|
+
});
|
14
|
+
exports.CompoundButton.displayName = 'CompoundButton';
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=CompoundButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CompoundButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IACU,QAAA,cAAc,GAA6C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAClG,IAAM,KAAK,GAAG,8CAA0B,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAErD,0DAAgC,CAAC,KAAK,CAAC,CAAC;QAExC,OAAO,oDAA6B,CAAC,KAAK,CAAC,CAAC;QAC5C,0FAA0F;IAC5F,CAAC,CAA6C,CAAC;IAE/C,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\nimport { renderCompoundButton_unstable } from './renderCompoundButton';\nimport { useCompoundButton_unstable } from './useCompoundButton';\nimport { useCompoundButtonStyles_unstable } from './useCompoundButtonStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { CompoundButtonProps } from './CompoundButton.types';\n\n/**\n * CompoundButtons are buttons that can have secondary content that adds extra information to the user.\n */\nexport const CompoundButton: ForwardRefComponent<CompoundButtonProps> = React.forwardRef((props, ref) => {\n const state = useCompoundButton_unstable(props, ref);\n\n useCompoundButtonStyles_unstable(state);\n\n return renderCompoundButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<CompoundButtonProps>;\n\nCompoundButton.displayName = 'CompoundButton';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CompoundButton.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/CompoundButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonSlots, ButtonState } from '../Button/Button.types';\n\nexport type CompoundButtonSlots = ButtonSlots & {\n /**\n * Second line of text that describes the action this button takes.\n */\n secondaryContent?: Slot<'span'>;\n\n /**\n * Container that wraps the children and the secondaryContent slot.\n */\n contentContainer: NonNullable<Slot<'span'>>;\n};\n\nexport type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> &\n Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>;\n\nexport type CompoundButtonState = ComponentState<CompoundButtonSlots> &\n Omit<ButtonState, keyof ButtonSlots | 'components'>;\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./CompoundButton", "./CompoundButton.types", "./renderCompoundButton", "./useCompoundButton", "./useCompoundButtonStyles"], function (require, exports, tslib_1, CompoundButton_1, CompoundButton_types_1, renderCompoundButton_1, useCompoundButton_1, useCompoundButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useCompoundButtonStyles_unstable = exports.compoundButtonClassNames = void 0;
|
5
|
+
tslib_1.__exportStar(CompoundButton_1, exports);
|
6
|
+
tslib_1.__exportStar(CompoundButton_types_1, exports);
|
7
|
+
tslib_1.__exportStar(renderCompoundButton_1, exports);
|
8
|
+
tslib_1.__exportStar(useCompoundButton_1, exports);
|
9
|
+
Object.defineProperty(exports, "compoundButtonClassNames", { enumerable: true, get: function () { return useCompoundButtonStyles_1.compoundButtonClassNames; } });
|
10
|
+
Object.defineProperty(exports, "useCompoundButtonStyles_unstable", { enumerable: true, get: function () { return useCompoundButtonStyles_1.useCompoundButtonStyles_unstable; } });
|
11
|
+
});
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/index.ts"],"names":[],"mappings":";;;;IAAA,gDAAiC;IACjC,sDAAuC;IACvC,sDAAuC;IACvC,mDAAoC;IAC3B,mIAAA,wBAAwB,OAAA;IAAE,2IAAA,gCAAgC,OAAA","sourcesContent":["export * from './CompoundButton';\nexport * from './CompoundButton.types';\nexport * from './renderCompoundButton';\nexport * from './useCompoundButton';\nexport { compoundButtonClassNames, useCompoundButtonStyles_unstable } from './useCompoundButtonStyles';\n"]}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderCompoundButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Renders a CompoundButton component by passing the state defined props to the appropriate slots.
|
7
|
+
*/
|
8
|
+
var renderCompoundButton_unstable = function (state) {
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
+
var iconOnly = state.iconOnly, iconPosition = state.iconPosition;
|
11
|
+
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
12
|
+
iconPosition !== 'after' && slots.icon && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
|
13
|
+
!iconOnly && (React.createElement(slots.contentContainer, tslib_1.__assign({}, slotProps.contentContainer),
|
14
|
+
slotProps.root.children,
|
15
|
+
slots.secondaryContent && React.createElement(slots.secondaryContent, tslib_1.__assign({}, slotProps.secondaryContent)))),
|
16
|
+
iconPosition === 'after' && slots.icon && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon))));
|
17
|
+
};
|
18
|
+
exports.renderCompoundButton_unstable = renderCompoundButton_unstable;
|
19
|
+
});
|
20
|
+
//# sourceMappingURL=renderCompoundButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderCompoundButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,6BAA6B,GAAG,UAAC,KAA0B;QAChE,IAAA,KAAuB,0BAAQ,CAAsB,KAAK,CAAC,EAAzD,KAAK,WAAA,EAAE,SAAS,eAAyC,CAAC;QAC1D,IAAA,QAAQ,GAAmB,KAAK,SAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QAEzC,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,YAAY,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAC5E,CAAC,QAAQ,IAAI,CACZ,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB;gBACnD,SAAS,CAAC,IAAI,CAAC,QAAQ;gBACvB,KAAK,CAAC,gBAAgB,IAAI,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB,EAAI,CAC9D,CAC1B;YACA,YAAY,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CAClE,CACd,CAAC;IACJ,CAAC,CAAC;IAhBW,QAAA,6BAA6B,iCAgBxC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\n\n/**\n * Renders a CompoundButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderCompoundButton_unstable = (state: CompoundButtonState) => {\n const { slots, slotProps } = getSlots<CompoundButtonSlots>(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 && (\n <slots.contentContainer {...slotProps.contentContainer}>\n {slotProps.root.children}\n {slots.secondaryContent && <slots.secondaryContent {...slotProps.secondaryContent} />}\n </slots.contentContainer>\n )}\n {iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"]}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-utilities", "../Button/index"], function (require, exports, tslib_1, react_utilities_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useCompoundButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
7
|
+
* @param props - User provided props to the CompoundButton component.
|
8
|
+
* @param ref - User provided ref to be passed to the CompoundButton component.
|
9
|
+
*/
|
10
|
+
var useCompoundButton_unstable = function (_a, ref) {
|
11
|
+
var _b, _c;
|
12
|
+
var contentContainer = _a.contentContainer, secondaryContent = _a.secondaryContent, props = tslib_1.__rest(_a, ["contentContainer", "secondaryContent"]);
|
13
|
+
var state = tslib_1.__assign(tslib_1.__assign({}, index_1.useButton_unstable(props, ref)), {
|
14
|
+
// Slots definition
|
15
|
+
components: {
|
16
|
+
root: 'button',
|
17
|
+
icon: 'span',
|
18
|
+
contentContainer: 'span',
|
19
|
+
secondaryContent: 'span',
|
20
|
+
}, contentContainer: react_utilities_1.resolveShorthand(contentContainer, { required: true }), secondaryContent: react_utilities_1.resolveShorthand(secondaryContent) });
|
21
|
+
// Recalculate iconOnly to take into account secondaryContent.
|
22
|
+
state.iconOnly = Boolean(((_b = state.icon) === null || _b === void 0 ? void 0 : _b.children) && !props.children && !((_c = state.secondaryContent) === null || _c === void 0 ? void 0 : _c.children));
|
23
|
+
return state;
|
24
|
+
};
|
25
|
+
exports.useCompoundButton_unstable = useCompoundButton_unstable;
|
26
|
+
});
|
27
|
+
//# sourceMappingURL=useCompoundButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCompoundButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;IAKA;;;;OAIG;IACI,IAAM,0BAA0B,GAAG,UACxC,EAAqE,EACrE,GAAqD;;QADnD,IAAA,gBAAgB,sBAAA,EAAE,gBAAgB,sBAAA,EAAK,KAAK,sBAA9C,wCAAgD,CAAF;QAG9C,IAAM,KAAK,yCAEN,0BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC;YAEjC,mBAAmB;YACnB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM;gBACZ,gBAAgB,EAAE,MAAM;gBACxB,gBAAgB,EAAE,MAAM;aACzB,EACD,gBAAgB,EAAE,kCAAgB,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EACxE,gBAAgB,EAAE,kCAAgB,CAAC,gBAAgB,CAAC,GACrD,CAAC;QAEF,8DAA8D;QAC9D,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,QAAQ,KAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,gBAAgB,0CAAE,QAAQ,CAAA,CAAC,CAAC;QAEvG,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAvBW,QAAA,0BAA0B,8BAuBrC","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useButton_unstable } from '../Button/index';\nimport type { CompoundButtonProps, CompoundButtonState } from './CompoundButton.types';\n\n/**\n * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the CompoundButton component.\n * @param ref - User provided ref to be passed to the CompoundButton component.\n */\nexport const useCompoundButton_unstable = (\n { contentContainer, secondaryContent, ...props }: CompoundButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): CompoundButtonState => {\n const state: CompoundButtonState = {\n // Button state\n ...useButton_unstable(props, ref),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n contentContainer: 'span',\n secondaryContent: 'span',\n },\n contentContainer: resolveShorthand(contentContainer, { required: true }),\n secondaryContent: resolveShorthand(secondaryContent),\n };\n\n // Recalculate iconOnly to take into account secondaryContent.\n state.iconOnly = Boolean(state.icon?.children && !props.children && !state.secondaryContent?.children);\n\n return state;\n};\n"]}
|