@fluentui/react-button 9.1.8 → 9.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. package/CHANGELOG.json +63 -1
  2. package/CHANGELOG.md +24 -2
  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.map +1 -1
  12. package/lib/components/Button/useButton.js.map +1 -1
  13. package/lib/components/Button/useButtonStyles.js +17 -168
  14. package/lib/components/Button/useButtonStyles.js.map +1 -1
  15. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  16. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  17. package/lib/components/CompoundButton/index.js.map +1 -1
  18. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  19. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  20. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  22. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  23. package/lib/components/MenuButton/index.js.map +1 -1
  24. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  26. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  27. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  28. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  29. package/lib/components/SplitButton/index.js.map +1 -1
  30. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  31. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  32. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  33. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  34. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  35. package/lib/components/ToggleButton/index.js.map +1 -1
  36. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  37. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  38. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/utils/index.js.map +1 -1
  41. package/lib/utils/useToggleState.js.map +1 -1
  42. package/lib-amd/Button.js +6 -0
  43. package/lib-amd/Button.js.map +1 -0
  44. package/lib-amd/CompoundButton.js +6 -0
  45. package/lib-amd/CompoundButton.js.map +1 -0
  46. package/lib-amd/MenuButton.js +6 -0
  47. package/lib-amd/MenuButton.js.map +1 -0
  48. package/lib-amd/SplitButton.js +6 -0
  49. package/lib-amd/SplitButton.js.map +1 -0
  50. package/lib-amd/ToggleButton.js +6 -0
  51. package/lib-amd/ToggleButton.js.map +1 -0
  52. package/lib-amd/components/Button/Button.js +16 -0
  53. package/lib-amd/components/Button/Button.js.map +1 -0
  54. package/lib-amd/components/Button/Button.types.js +5 -0
  55. package/lib-amd/components/Button/Button.types.js.map +1 -0
  56. package/lib-amd/components/Button/index.js +11 -0
  57. package/lib-amd/components/Button/index.js.map +1 -0
  58. package/lib-amd/components/Button/renderButton.js +18 -0
  59. package/lib-amd/components/Button/renderButton.js.map +1 -0
  60. package/lib-amd/components/Button/useButton.js +40 -0
  61. package/lib-amd/components/Button/useButton.js.map +1 -0
  62. package/lib-amd/components/Button/useButtonStyles.js +216 -0
  63. package/lib-amd/components/Button/useButtonStyles.js.map +1 -0
  64. package/lib-amd/components/CompoundButton/CompoundButton.js +16 -0
  65. package/lib-amd/components/CompoundButton/CompoundButton.js.map +1 -0
  66. package/lib-amd/components/CompoundButton/CompoundButton.types.js +5 -0
  67. package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -0
  68. package/lib-amd/components/CompoundButton/index.js +12 -0
  69. package/lib-amd/components/CompoundButton/index.js.map +1 -0
  70. package/lib-amd/components/CompoundButton/renderCompoundButton.js +20 -0
  71. package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -0
  72. package/lib-amd/components/CompoundButton/useCompoundButton.js +27 -0
  73. package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -0
  74. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js +211 -0
  75. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  76. package/lib-amd/components/MenuButton/MenuButton.js +17 -0
  77. package/lib-amd/components/MenuButton/MenuButton.js.map +1 -0
  78. package/lib-amd/components/MenuButton/MenuButton.types.js +5 -0
  79. package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -0
  80. package/lib-amd/components/MenuButton/index.js +12 -0
  81. package/lib-amd/components/MenuButton/index.js.map +1 -0
  82. package/lib-amd/components/MenuButton/renderMenuButton.js +18 -0
  83. package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -0
  84. package/lib-amd/components/MenuButton/useMenuButton.js +30 -0
  85. package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -0
  86. package/lib-amd/components/MenuButton/useMenuButtonStyles.js +97 -0
  87. package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  88. package/lib-amd/components/SplitButton/SplitButton.js +17 -0
  89. package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
  90. package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
  91. package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
  92. package/lib-amd/components/SplitButton/index.js +12 -0
  93. package/lib-amd/components/SplitButton/index.js.map +1 -0
  94. package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
  95. package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
  96. package/lib-amd/components/SplitButton/useSplitButton.js +67 -0
  97. package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
  98. package/lib-amd/components/SplitButton/useSplitButtonStyles.js +147 -0
  99. package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  100. package/lib-amd/components/ToggleButton/ToggleButton.js +16 -0
  101. package/lib-amd/components/ToggleButton/ToggleButton.js.map +1 -0
  102. package/lib-amd/components/ToggleButton/ToggleButton.types.js +5 -0
  103. package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -0
  104. package/lib-amd/components/ToggleButton/index.js +12 -0
  105. package/lib-amd/components/ToggleButton/index.js.map +1 -0
  106. package/lib-amd/components/ToggleButton/renderToggleButton.js +7 -0
  107. package/lib-amd/components/ToggleButton/renderToggleButton.js.map +1 -0
  108. package/lib-amd/components/ToggleButton/useToggleButton.js +17 -0
  109. package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -0
  110. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js +75 -0
  111. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  112. package/lib-amd/index.js +32 -0
  113. package/lib-amd/index.js.map +1 -0
  114. package/lib-amd/utils/index.js +6 -0
  115. package/lib-amd/utils/index.js.map +1 -0
  116. package/lib-amd/utils/useToggleState.js +27 -0
  117. package/lib-amd/utils/useToggleState.js.map +1 -0
  118. package/lib-commonjs/Button.js.map +1 -1
  119. package/lib-commonjs/CompoundButton.js.map +1 -1
  120. package/lib-commonjs/MenuButton.js.map +1 -1
  121. package/lib-commonjs/SplitButton.js.map +1 -1
  122. package/lib-commonjs/ToggleButton.js.map +1 -1
  123. package/lib-commonjs/components/Button/Button.js.map +1 -1
  124. package/lib-commonjs/components/Button/index.js.map +1 -1
  125. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  126. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  127. package/lib-commonjs/components/Button/useButtonStyles.js +16 -167
  128. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  129. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  130. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  131. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  132. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  133. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  134. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  135. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  136. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  137. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  138. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  139. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  140. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  141. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  142. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  143. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  144. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  145. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  146. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  147. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  148. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  149. package/lib-commonjs/index.js.map +1 -1
  150. package/lib-commonjs/utils/index.js.map +1 -1
  151. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  152. package/package.json +7 -8
@@ -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,216 @@
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 useRootBaseClassName = react_1.makeResetStyles(tslib_1.__assign({ alignItems: 'center', boxSizing: 'border-box', display: 'inline-flex', justifyContent: 'center', textDecorationLine: 'none', verticalAlign: 'middle', margin: 0, overflow: 'hidden', backgroundColor: react_theme_1.tokens.colorNeutralBackground1, color: react_theme_1.tokens.colorNeutralForeground1, border: react_theme_1.tokens.strokeWidthThin + " solid " + react_theme_1.tokens.colorNeutralStroke1, fontFamily: react_theme_1.tokens.fontFamilyBase, outlineStyle: 'none', ':hover': (_a = {
14
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Hover,
15
+ borderColor: react_theme_1.tokens.colorNeutralStroke1Hover,
16
+ color: react_theme_1.tokens.colorNeutralForeground1Hover,
17
+ cursor: 'pointer'
18
+ },
19
+ _a["& ." + react_icons_1.iconFilledClassName] = {
20
+ display: 'inline',
21
+ },
22
+ _a["& ." + react_icons_1.iconRegularClassName] = {
23
+ display: 'none',
24
+ },
25
+ _a), ':hover:active': (_b = {
26
+ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Pressed,
27
+ borderColor: react_theme_1.tokens.colorNeutralStroke1Pressed,
28
+ color: react_theme_1.tokens.colorNeutralForeground1Pressed,
29
+ outlineStyle: 'none'
30
+ },
31
+ _b["& ." + react_icons_1.iconFilledClassName] = {
32
+ display: 'inline',
33
+ },
34
+ _b["& ." + react_icons_1.iconRegularClassName] = {
35
+ display: 'none',
36
+ },
37
+ _b), padding: buttonSpacingMedium + " " + react_theme_1.tokens.spacingHorizontalM, minWidth: '96px', borderRadius: react_theme_1.tokens.borderRadiusMedium, fontSize: react_theme_1.tokens.fontSizeBase300, fontWeight: react_theme_1.tokens.fontWeightSemibold, lineHeight: react_theme_1.tokens.lineHeightBase300,
38
+ // Transition styles
39
+ transitionDuration: react_theme_1.tokens.durationFaster, transitionProperty: 'background, border, color', transitionTimingFunction: react_theme_1.tokens.curveEasyEase, '@media screen and (prefers-reduced-motion: reduce)': {
40
+ transitionDuration: '0.01ms',
41
+ },
42
+ // High contrast styles
43
+ '@media (forced-colors: active)': {
44
+ ':focus': {
45
+ borderColor: 'ButtonText',
46
+ },
47
+ ':hover': {
48
+ backgroundColor: 'HighlightText',
49
+ borderColor: 'Highlight',
50
+ color: 'Highlight',
51
+ forcedColorAdjust: 'none',
52
+ },
53
+ ':hover:active': {
54
+ backgroundColor: 'HighlightText',
55
+ borderColor: 'Highlight',
56
+ color: 'Highlight',
57
+ forcedColorAdjust: 'none',
58
+ },
59
+ } }, react_tabster_1.createCustomFocusIndicatorStyle({
60
+ borderColor: react_theme_1.tokens.colorTransparentStroke,
61
+ borderRadius: react_theme_1.tokens.borderRadiusMedium,
62
+ outline: react_theme_1.tokens.strokeWidthThick + " solid " + react_theme_1.tokens.colorTransparentStroke,
63
+ boxShadow: "\n " + react_theme_1.tokens.shadow4 + ",\n 0 0 0 2px " + react_theme_1.tokens.colorStrokeFocus2 + "\n ",
64
+ zIndex: 1,
65
+ })));
66
+ var useIconBaseClassName = react_1.makeResetStyles((_c = {
67
+ alignItems: 'center',
68
+ display: 'inline-flex',
69
+ justifyContent: 'center',
70
+ fontSize: '20px',
71
+ height: '20px',
72
+ width: '20px'
73
+ },
74
+ _c[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalSNudge,
75
+ _c));
76
+ var useRootStyles = react_1.makeStyles({
77
+ // Appearance variations
78
+ outline: {
79
+ backgroundColor: react_theme_1.tokens.colorTransparentBackground,
80
+ ':hover': {
81
+ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover,
82
+ },
83
+ ':hover:active': {
84
+ backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed,
85
+ },
86
+ },
87
+ 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 }) }),
88
+ secondary: {
89
+ /* The secondary styles are exactly the same as the base styles. */
90
+ },
91
+ 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')), (_d = { color: react_theme_1.tokens.colorNeutralForeground2Hover }, _d["& ." + exports.buttonClassNames.icon] = {
92
+ color: react_theme_1.tokens.colorNeutralForeground2BrandHover,
93
+ }, _d)), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed }, react_1.shorthands.borderColor('transparent')), (_e = { color: react_theme_1.tokens.colorNeutralForeground2Pressed }, _e["& ." + exports.buttonClassNames.icon] = {
94
+ color: react_theme_1.tokens.colorNeutralForeground2BrandPressed,
95
+ }, _e)) }),
96
+ 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 }) }),
97
+ // Shape variations
98
+ circular: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular)),
99
+ rounded: {
100
+ /* The borderRadius rounded styles are handled in the size variations */
101
+ },
102
+ square: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusNone)),
103
+ // Size variations
104
+ 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 }),
105
+ medium: {
106
+ /* defined in base styles */
107
+ },
108
+ 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 }),
109
+ });
110
+ var useRootDisabledStyles = react_1.makeStyles({
111
+ // Base styles
112
+ 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)), (_f = { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed' }, _f["& ." + react_icons_1.iconFilledClassName] = {
113
+ display: 'none',
114
+ }, _f["& ." + react_icons_1.iconRegularClassName] = {
115
+ display: 'inline',
116
+ }, _f)), ':hover:active': tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackgroundDisabled }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStrokeDisabled)), (_g = { color: react_theme_1.tokens.colorNeutralForegroundDisabled, cursor: 'not-allowed' }, _g["& ." + react_icons_1.iconFilledClassName] = {
117
+ display: 'none',
118
+ }, _g["& ." + react_icons_1.iconRegularClassName] = {
119
+ display: 'inline',
120
+ }, _g)) }),
121
+ // High contrast styles
122
+ highContrast: {
123
+ '@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' }) }),
124
+ },
125
+ // Appearance variations
126
+ outline: {
127
+ backgroundColor: react_theme_1.tokens.colorTransparentBackground,
128
+ ':hover': {
129
+ backgroundColor: react_theme_1.tokens.colorTransparentBackground,
130
+ },
131
+ ':hover:active': {
132
+ backgroundColor: react_theme_1.tokens.colorTransparentBackground,
133
+ },
134
+ },
135
+ 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')) }),
136
+ secondary: {
137
+ /* The secondary styles are exactly the same as the base styles. */
138
+ },
139
+ 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')) }),
140
+ 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')) }),
141
+ });
142
+ var useRootFocusStyles = react_1.makeStyles({
143
+ // Shape variations
144
+ circular: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusCircular))),
145
+ rounded: {
146
+ /* The rounded styles are exactly the same as the base styles. */
147
+ },
148
+ square: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusNone))),
149
+ // Primary styles
150
+ 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 })),
151
+ // Size variations
152
+ small: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusSmall))),
153
+ medium: {
154
+ /* defined in base styles */
155
+ },
156
+ large: react_tabster_1.createCustomFocusIndicatorStyle(tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusLarge))),
157
+ });
158
+ var useRootIconOnlyStyles = react_1.makeStyles({
159
+ // Size variations
160
+ small: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalXS)), { minWidth: '28px', maxWidth: '28px' }),
161
+ medium: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalXS)), { minWidth: '32px', maxWidth: '32px' }),
162
+ large: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalSNudge)), { minWidth: '40px', maxWidth: '40px' }),
163
+ });
164
+ var useIconStyles = react_1.makeStyles({
165
+ // Size variations
166
+ small: (_h = {
167
+ fontSize: '20px',
168
+ height: '20px',
169
+ width: '20px'
170
+ },
171
+ _h[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalXS,
172
+ _h),
173
+ medium: {
174
+ /* defined in base styles */
175
+ },
176
+ large: (_j = {
177
+ fontSize: '24px',
178
+ height: '24px',
179
+ width: '24px'
180
+ },
181
+ _j[iconSpacingVar] = react_theme_1.tokens.spacingHorizontalSNudge,
182
+ _j),
183
+ // Icon position variations
184
+ before: {
185
+ marginRight: "var(" + iconSpacingVar + ")",
186
+ },
187
+ after: {
188
+ marginLeft: "var(" + iconSpacingVar + ")",
189
+ },
190
+ });
191
+ var useButtonStyles_unstable = function (state) {
192
+ var rootBaseClassName = useRootBaseClassName();
193
+ var iconBaseClassName = useIconBaseClassName();
194
+ var rootStyles = useRootStyles();
195
+ var rootDisabledStyles = useRootDisabledStyles();
196
+ var rootFocusStyles = useRootFocusStyles();
197
+ var rootIconOnlyStyles = useRootIconOnlyStyles();
198
+ var iconStyles = useIconStyles();
199
+ var appearance = state.appearance, disabled = state.disabled, disabledFocusable = state.disabledFocusable, iconOnly = state.iconOnly, iconPosition = state.iconPosition, shape = state.shape, size = state.size;
200
+ state.root.className = react_1.mergeClasses(exports.buttonClassNames.root, rootBaseClassName, appearance && rootStyles[appearance], rootStyles[size], rootStyles[shape],
201
+ // Disabled styles
202
+ (disabled || disabledFocusable) && rootDisabledStyles.base, (disabled || disabledFocusable) && rootDisabledStyles.highContrast, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],
203
+ // Focus styles
204
+ appearance === 'primary' && rootFocusStyles.primary, rootFocusStyles[size], rootFocusStyles[shape],
205
+ // Icon-only styles
206
+ iconOnly && rootIconOnlyStyles[size],
207
+ // User provided class name
208
+ state.root.className);
209
+ if (state.icon) {
210
+ state.icon.className = react_1.mergeClasses(exports.buttonClassNames.icon, iconBaseClassName, state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition], iconStyles[size], state.icon.className);
211
+ }
212
+ return state;
213
+ };
214
+ exports.useButtonStyles_unstable = useButtonStyles_unstable;
215
+ });
216
+ //# sourceMappingURL=useButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../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AAQ,IAAI,iBAAiB,CAAC,IAAI,kBAAkB,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,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,iBAAiB,EACjB,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, makeResetStyles, 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 useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n boxSizing: 'border-box',\n display: 'inline-flex',\n justifyContent: 'center',\n textDecorationLine: 'none',\n verticalAlign: 'middle',\n\n margin: 0,\n overflow: 'hidden',\n\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n\n fontFamily: tokens.fontFamilyBase,\n outlineStyle: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n 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 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 padding: `${buttonSpacingMedium} ${tokens.spacingHorizontalM}`,\n minWidth: '96px',\n borderRadius: tokens.borderRadiusMedium,\n\n fontSize: tokens.fontSizeBase300,\n fontWeight: tokens.fontWeightSemibold,\n lineHeight: tokens.lineHeightBase300,\n\n // Transition styles\n\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 // High contrast styles\n\n '@media (forced-colors: active)': {\n ':focus': {\n borderColor: 'ButtonText',\n },\n\n ':hover': {\n backgroundColor: 'HighlightText',\n borderColor: 'Highlight',\n color: 'Highlight',\n forcedColorAdjust: 'none',\n },\n\n ':hover:active': {\n backgroundColor: 'HighlightText',\n borderColor: 'Highlight',\n color: 'Highlight',\n forcedColorAdjust: 'none',\n },\n },\n\n // Focus styles\n\n ...createCustomFocusIndicatorStyle({\n borderColor: tokens.colorTransparentStroke,\n borderRadius: tokens.borderRadiusMedium,\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorTransparentStroke}`,\n boxShadow: `\n ${tokens.shadow4},\n 0 0 0 2px ${tokens.colorStrokeFocus2}\n `,\n zIndex: 1,\n }),\n});\n\nconst useIconBaseClassName = makeResetStyles({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n\n fontSize: '20px',\n height: '20px',\n width: '20px',\n\n [iconSpacingVar]: tokens.spacingHorizontalSNudge,\n});\n\nconst useRootStyles = makeStyles({\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 /* defined in base styles */\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 // 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: {\n /* defined in base styles */\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 // Size variations\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n\n [iconSpacingVar]: tokens.spacingHorizontalXS,\n },\n medium: {\n /* defined in base styles */\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 rootBaseClassName = useRootBaseClassName();\n const iconBaseClassName = useIconBaseClassName();\n\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 rootBaseClassName,\n\n appearance && rootStyles[appearance],\n\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 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 iconBaseClassName,\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,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# sourceMappingURL=CompoundButton.types.js.map
@@ -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"]}