@fluentui/react-button 9.0.0-alpha.84 → 9.0.0-alpha.88

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. package/CHANGELOG.json +87 -1
  2. package/CHANGELOG.md +41 -2
  3. package/dist/react-button.d.ts +73 -7
  4. package/lib/SplitButton.d.ts +1 -0
  5. package/lib/SplitButton.js +2 -0
  6. package/lib/SplitButton.js.map +1 -0
  7. package/lib/components/Button/renderButton.js.map +1 -1
  8. package/lib/components/Button/useButton.d.ts +3 -1
  9. package/lib/components/Button/useButton.js +3 -1
  10. package/lib/components/Button/useButton.js.map +1 -1
  11. package/lib/components/Button/useButtonState.d.ts +2 -2
  12. package/lib/components/Button/useButtonState.js +2 -2
  13. package/lib/components/Button/useButtonState.js.map +1 -1
  14. package/lib/components/Button/useButtonStyles.js.map +1 -1
  15. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  16. package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
  17. package/lib/components/CompoundButton/useCompoundButton.js +3 -1
  18. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  19. package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
  20. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.types.d.ts +1 -1
  22. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  23. package/lib/components/MenuButton/renderMenuButton.js +2 -1
  24. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
  26. package/lib/components/MenuButton/useMenuButton.js +3 -3
  27. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  28. package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
  29. package/lib/components/MenuButton/useMenuButtonState.js +9 -1
  30. package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
  31. package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
  32. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  33. package/lib/components/SplitButton/SplitButton.d.ts +7 -0
  34. package/lib/components/SplitButton/SplitButton.js +25 -0
  35. package/lib/components/SplitButton/SplitButton.js.map +1 -0
  36. package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
  37. package/lib/components/SplitButton/SplitButton.types.js +2 -0
  38. package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
  39. package/lib/components/SplitButton/index.d.ts +5 -0
  40. package/lib/components/SplitButton/index.js +6 -0
  41. package/lib/components/SplitButton/index.js.map +1 -0
  42. package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
  43. package/lib/components/SplitButton/renderSplitButton.js +16 -0
  44. package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
  45. package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
  46. package/lib/components/SplitButton/useSplitButton.js +72 -0
  47. package/lib/components/SplitButton/useSplitButton.js.map +1 -0
  48. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  49. package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
  50. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  51. package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
  52. package/lib/components/ToggleButton/useToggleButton.js +4 -1
  53. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  54. package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
  55. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  56. package/lib/index.d.ts +1 -0
  57. package/lib/index.js +1 -0
  58. package/lib/index.js.map +1 -1
  59. package/lib-amd/SplitButton.d.ts +1 -0
  60. package/lib-amd/SplitButton.js +6 -0
  61. package/lib-amd/SplitButton.js.map +1 -0
  62. package/lib-amd/components/Button/renderButton.js.map +1 -1
  63. package/lib-amd/components/Button/useButton.d.ts +3 -1
  64. package/lib-amd/components/Button/useButton.js +3 -1
  65. package/lib-amd/components/Button/useButton.js.map +1 -1
  66. package/lib-amd/components/Button/useButtonState.d.ts +2 -2
  67. package/lib-amd/components/Button/useButtonState.js +2 -2
  68. package/lib-amd/components/Button/useButtonState.js.map +1 -1
  69. package/lib-amd/components/Button/useButtonStyles.js +1 -0
  70. package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
  71. package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
  72. package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
  73. package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
  74. package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
  75. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  76. package/lib-amd/components/MenuButton/MenuButton.types.d.ts +1 -1
  77. package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
  78. package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
  79. package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
  80. package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
  81. package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
  82. package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
  83. package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
  84. package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
  85. package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
  86. package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  87. package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
  88. package/lib-amd/components/SplitButton/SplitButton.js +19 -0
  89. package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
  90. package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
  91. package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
  92. package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
  93. package/lib-amd/components/SplitButton/index.d.ts +5 -0
  94. package/lib-amd/components/SplitButton/index.js +11 -0
  95. package/lib-amd/components/SplitButton/index.js.map +1 -0
  96. package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
  97. package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
  98. package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
  99. package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
  100. package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
  101. package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
  102. package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  103. package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
  104. package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  105. package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
  106. package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
  107. package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
  108. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  109. package/lib-amd/index.d.ts +1 -0
  110. package/lib-amd/index.js +2 -1
  111. package/lib-amd/index.js.map +1 -1
  112. package/lib-commonjs/SplitButton.d.ts +1 -0
  113. package/lib-commonjs/SplitButton.js +10 -0
  114. package/lib-commonjs/SplitButton.js.map +1 -0
  115. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  116. package/lib-commonjs/components/Button/useButton.d.ts +3 -1
  117. package/lib-commonjs/components/Button/useButton.js +3 -1
  118. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  119. package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
  120. package/lib-commonjs/components/Button/useButtonState.js +2 -2
  121. package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
  122. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  123. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  124. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
  125. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
  126. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  127. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  128. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +1 -1
  129. package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
  130. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  131. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
  132. package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
  133. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  134. package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
  135. package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
  136. package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
  137. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  138. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
  139. package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
  140. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
  141. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
  142. package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
  143. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
  144. package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
  145. package/lib-commonjs/components/SplitButton/index.js +26 -0
  146. package/lib-commonjs/components/SplitButton/index.js.map +1 -0
  147. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
  148. package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
  149. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
  150. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
  151. package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
  152. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
  153. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  154. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
  155. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  156. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
  157. package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
  158. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  159. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  160. package/lib-commonjs/index.d.ts +1 -0
  161. package/lib-commonjs/index.js +2 -0
  162. package/lib-commonjs/index.js.map +1 -1
  163. package/package.json +10 -10
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSplitButton.js","sourceRoot":"../src/","sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;IAIa,QAAA,yBAAyB,GAAsC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAErG,IAAM,UAAU,GAAG,gCAAc,CAAmB,EAAE,SAAS,EAAE,iCAAyB,EAAE,CAAC,CAAC;IAE9F;;;;OAIG;IACI,IAAM,cAAc,GAAG,UAC5B,KAAuB,EACvB,GAA2B,EAC3B,YAA+B;QAE/B,IAAM,sBAAsB,GAAG,uCAAqB,CAAC,KAAK,EAAE,iCAAyB,CAAC,CAAC;QAC/E,IAAA,SAAS,GAAK,KAAK,UAAV,CAAW;QAE1B,IAAA,MAAM,GAaJ,sBAAsB,OAblB,EACN,SAAS,GAYP,sBAAsB,UAZf,EACT,QAAQ,GAWN,sBAAsB,SAXhB,EACR,QAAQ,GAUN,sBAAsB,SAVhB,EACR,iBAAiB,GASf,sBAAsB,kBATP,EACjB,UAAU,GAQR,sBAAsB,WARd,EACV,aAAa,GAOX,sBAAsB,cAPX,EACb,OAAO,GAML,sBAAsB,QANjB,EACP,OAAO,GAKL,sBAAsB,QALjB,EACP,KAIE,sBAAsB,KAJT,EAAf,IAAI,mBAAG,QAAQ,KAAA,EACf,MAAM,GAGJ,sBAAsB,OAHlB,EACN,WAAW,GAET,sBAAsB,YAFb,EACR,SAAS,kBACV,sBAAsB,EAdpB,0JAcL,CADa,CACa;QAE3B,8DAA8D;QAC9D,oEAAoE;QACpE,wEAAwE;QAExE,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,eAAe,EAAE,QAAQ;YACzB,EAAE,EAAE,KAAK;YACT,SAAS,WAAA;YACT,GAAG,KAAA;YACH,IAAI,MAAA;YAEJ,MAAM,sCACJ,EAAE,EAAE,QAAQ;gBACZ,8DAA8D;gBAC9D,oDAAoD;gBACpD,QAAQ,UAAA;gBACR,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,OAAO,SAAA;gBACP,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,MAAM,QAAA;gBACN,WAAW,aAAA,IACR,SAAS,GACT,MAAM,CACV;YAED,UAAU,qBACR,EAAE,EAAE,QAAQ;gBACZ,8DAA8D;gBAC9D,4DAA4D;gBAC5D,QAAQ,UAAA;gBACR,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,OAAO,SAAA;gBACP,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,MAAM,QAAA;gBACN,WAAW,aAAA,IACR,UAAU,CACd;SACF;QACD,8DAA8D;QAC9D,8DAA8D;QAC9D,YAAmB,EACnB,sBAAsB,CACvB,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAzEW,QAAA,cAAc,kBAyEzB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[] = ['button', 'menuButton'];\n\nconst mergeProps = makeMergeProps<SplitButtonState>({ deepMerge: splitButtonShorthandProps });\n\n/**\n * Given user props, defines default props for the SplitButton and returns processed state.\n * @param props - User provided props to the SplitButton component.\n * @param ref - User provided ref to be passed to the SplitButton component.\n */\nexport const useSplitButton = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: SplitButtonProps,\n): SplitButtonState => {\n const resolvedShorthandProps = resolveShorthandProps(props, splitButtonShorthandProps);\n const { className } = props;\n const {\n button,\n buttonRef,\n circular,\n disabled,\n disabledFocusable,\n menuButton,\n menuButtonRef,\n outline,\n primary,\n size = 'medium',\n subtle,\n transparent,\n ...userProps\n } = resolvedShorthandProps;\n\n // TODO: To be resolved when moving to simplified prop merging\n // const buttonInternalRef = React.useRef<HTMLElement | null>(null);\n // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);\n\n const state = mergeProps(\n {\n 'aria-disabled': disabled,\n as: 'div',\n className,\n ref,\n size,\n\n button: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(buttonRef, buttonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...userProps,\n ...button,\n },\n\n menuButton: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...menuButton,\n },\n },\n // TODO: To be resolved when moving to simplified prop merging\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any,\n resolvedShorthandProps,\n );\n\n return state;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import type { SplitButtonState } from './SplitButton.types';
2
+ export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
@@ -0,0 +1,123 @@
1
+ define(["require", "exports", "@fluentui/react-make-styles"], function (require, exports, react_make_styles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSplitButtonStyles = void 0;
5
+ var SplitButtonClassNames = {
6
+ button: 'SplitButton-button',
7
+ menuButton: 'SplitButton-menuButton',
8
+ };
9
+ var useStyles = react_make_styles_1.makeStyles({
10
+ root: function (theme) {
11
+ var _a;
12
+ return (_a = {
13
+ display: 'inline-flex',
14
+ justifyContent: 'stretch',
15
+ position: 'relative'
16
+ },
17
+ // Use classnames to increase specificy of styles and avoid collisions.
18
+ _a["& ." + SplitButtonClassNames.button] = {
19
+ borderTopRightRadius: 0,
20
+ borderBottomRightRadius: 0,
21
+ },
22
+ // Use classnames to increase specificy of styles and avoid collisions.
23
+ _a["& ." + SplitButtonClassNames.menuButton] = {
24
+ borderLeftWidth: 0,
25
+ borderTopLeftRadius: 0,
26
+ borderBottomLeftRadius: 0,
27
+ },
28
+ _a);
29
+ },
30
+ rootBlock: {
31
+ width: '100%',
32
+ },
33
+ rootPrimary: function (theme) {
34
+ var _a, _b, _c;
35
+ return (_a = {},
36
+ // Use classnames to increase specificy of styles and avoid collisions.
37
+ _a["& ." + SplitButtonClassNames.button] = {
38
+ borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,
39
+ },
40
+ _a[':hover'] = (_b = {},
41
+ _b["& ." + SplitButtonClassNames.button] = {
42
+ borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,
43
+ },
44
+ _b),
45
+ _a[':active'] = (_c = {},
46
+ _c["& ." + SplitButtonClassNames.button] = {
47
+ borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,
48
+ },
49
+ _c),
50
+ _a);
51
+ },
52
+ rootSubtle: function (theme) {
53
+ var _a, _b, _c;
54
+ return (_a = {},
55
+ // Use classnames to increase specificy of styles and avoid collisions.
56
+ _a["& ." + SplitButtonClassNames.button] = {
57
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
58
+ },
59
+ _a[':hover'] = (_b = {},
60
+ _b["& ." + SplitButtonClassNames.button] = {
61
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
62
+ },
63
+ _b),
64
+ _a[':active'] = (_c = {},
65
+ _c["& ." + SplitButtonClassNames.button] = {
66
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
67
+ },
68
+ _c),
69
+ _a);
70
+ },
71
+ rootTransparent: function (theme) {
72
+ var _a, _b, _c;
73
+ return (_a = {},
74
+ // Use classnames to increase specificy of styles and avoid collisions.
75
+ _a["& ." + SplitButtonClassNames.button] = {
76
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
77
+ },
78
+ _a[':hover'] = (_b = {},
79
+ _b["& ." + SplitButtonClassNames.button] = {
80
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
81
+ },
82
+ _b),
83
+ _a[':active'] = (_c = {},
84
+ _c["& ." + SplitButtonClassNames.button] = {
85
+ borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,
86
+ },
87
+ _c),
88
+ _a);
89
+ },
90
+ rootDisabled: function (theme) {
91
+ var _a, _b, _c;
92
+ return (_a = {},
93
+ // Use classnames to increase specificy of styles and avoid collisions.
94
+ _a["& ." + SplitButtonClassNames.button] = {
95
+ borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,
96
+ },
97
+ _a[':hover'] = (_b = {},
98
+ _b["& ." + SplitButtonClassNames.button] = {
99
+ borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,
100
+ },
101
+ _b),
102
+ _a[':active'] = (_c = {},
103
+ _c["& ." + SplitButtonClassNames.button] = {
104
+ borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,
105
+ },
106
+ _c),
107
+ _a);
108
+ },
109
+ });
110
+ var useSplitButtonStyles = function (state) {
111
+ var styles = useStyles();
112
+ state.className = react_make_styles_1.mergeClasses(styles.root, state.block && styles.rootBlock, state.primary && styles.rootPrimary, state.subtle && styles.rootSubtle, state.transparent && styles.rootTransparent, state.disabled && styles.rootDisabled, state.className);
113
+ if (state.button) {
114
+ state.button.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.button, state.button.className);
115
+ }
116
+ if (state.menuButton) {
117
+ state.menuButton.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);
118
+ }
119
+ return state;
120
+ };
121
+ exports.useSplitButtonStyles = useSplitButtonStyles;
122
+ });
123
+ //# sourceMappingURL=useSplitButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSplitButtonStyles.js","sourceRoot":"../src/","sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":";;;;IAGA,IAAM,qBAAqB,GAAG;QAC5B,MAAM,EAAE,oBAAoB;QAC5B,UAAU,EAAE,wBAAwB;KACrC,CAAC;IAEF,IAAM,SAAS,GAAG,8BAAU,CAAC;QAC3B,IAAI,EAAE,UAAA,KAAK;;YAAI,OAAA;oBACb,OAAO,EAAE,aAAa;oBACtB,cAAc,EAAE,SAAS;oBACzB,QAAQ,EAAE,UAAU;;gBAEpB,uEAAuE;gBACvE,GAAC,QAAM,qBAAqB,CAAC,MAAQ,IAAG;oBACtC,oBAAoB,EAAE,CAAC;oBACvB,uBAAuB,EAAE,CAAC;iBAC3B;gBAED,uEAAuE;gBACvE,GAAC,QAAM,qBAAqB,CAAC,UAAY,IAAG;oBAC1C,eAAe,EAAE,CAAC;oBAClB,mBAAmB,EAAE,CAAC;oBACtB,sBAAsB,EAAE,CAAC;iBAC1B;mBACD;QAjBa,CAiBb;QACF,SAAS,EAAE;YACT,KAAK,EAAE,MAAM;SACd;QACD,WAAW,EAAE,UAAA,KAAK;;YAAI,OAAA;gBACpB,uEAAuE;gBACvE,GAAC,QAAM,qBAAqB,CAAC,MAAQ,IAAG;oBACtC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;iBACtE;gBAED,YAAQ;oBACN,GAAC,QAAM,qBAAqB,CAAC,MAAQ,IAAG;wBACtC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;qBACtE;uBACF;gBAED,aAAS;oBACP,GAAC,QAAM,qBAAqB,CAAC,MAAQ,IAAG;wBACtC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;qBACtE;uBACF;mBACD;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'./SplitButton.types';\n\nconst SplitButtonClassNames = {\n button: 'SplitButton-button',\n menuButton: 'SplitButton-menuButton',\n};\n\nconst useStyles = makeStyles({\n root: theme => ({\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n }),\n rootBlock: {\n width: '100%',\n },\n rootPrimary: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n }),\n rootSubtle: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootTransparent: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootDisabled: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n }),\n});\n\nexport const useSplitButtonStyles = (state: SplitButtonState): SplitButtonState => {\n const styles = useStyles();\n\n state.className = mergeClasses(\n styles.root,\n state.block && styles.rootBlock,\n state.primary && styles.rootPrimary,\n state.subtle && styles.rootSubtle,\n state.transparent && styles.rootTransparent,\n state.disabled && styles.rootDisabled,\n state.className,\n );\n\n if (state.button) {\n state.button.className = mergeClasses(SplitButtonClassNames.button, state.button.className);\n }\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);\n }\n\n return state;\n};\n"]}
@@ -1,6 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';
3
3
  /**
4
- * Given user props, returns the final state for a ToggleButton.
4
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
5
+ * processed state.
6
+ * @param props - User provided props to the ToggleButton component.
7
+ * @param ref - User provided ref to be passed to the ToggleButton component.
5
8
  */
6
9
  export declare const useToggleButton: (props: ToggleButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ToggleButtonProps | undefined) => ToggleButtonState;
@@ -3,7 +3,10 @@ define(["require", "exports", "../Button/useButton", "./useChecked"], function (
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useToggleButton = void 0;
5
5
  /**
6
- * Given user props, returns the final state for a ToggleButton.
6
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
7
+ * processed state.
8
+ * @param props - User provided props to the ToggleButton component.
9
+ * @param ref - User provided ref to be passed to the ToggleButton component.
7
10
  */
8
11
  var useToggleButton = function (props, ref, defaultProps) {
9
12
  var state = useButton_1.useButton(props, ref, defaultProps);
@@ -1 +1 @@
1
- {"version":3,"file":"useToggleButton.js","sourceRoot":"../src/","sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,eAAe,GAAG,UAC7B,KAAwB,EACxB,GAA2B,EAC3B,YAAgC;QAEhC,IAAM,KAAK,GAAG,qBAAS,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;QAElD,uBAAU,CAAC,KAA0B,CAAC,CAAC;QAEvC,OAAO,KAA0B,CAAC;IACpC,CAAC,CAAC;IAVW,QAAA,eAAe,mBAU1B","sourcesContent":["import * as React from 'react';\nimport { useButton } from '../Button/useButton';\nimport { useChecked } from './useChecked';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, returns the final state for a ToggleButton.\n */\nexport const useToggleButton = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: ToggleButtonProps,\n) => {\n const state = useButton(props, ref, defaultProps);\n\n useChecked(state as ToggleButtonProps);\n\n return state as ToggleButtonState;\n};\n"]}
1
+ {"version":3,"file":"useToggleButton.js","sourceRoot":"../src/","sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;IAKA;;;;;OAKG;IACI,IAAM,eAAe,GAAG,UAC7B,KAAwB,EACxB,GAA2B,EAC3B,YAAgC;QAEhC,IAAM,KAAK,GAAG,qBAAS,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;QAElD,uBAAU,CAAC,KAA0B,CAAC,CAAC;QAEvC,OAAO,KAA0B,CAAC;IACpC,CAAC,CAAC;IAVW,QAAA,eAAe,mBAU1B","sourcesContent":["import * as React from 'react';\nimport { useButton } from '../Button/useButton';\nimport { useChecked } from './useChecked';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToggleButton = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: ToggleButtonProps,\n) => {\n const state = useButton(props, ref, defaultProps);\n\n useChecked(state as ToggleButtonProps);\n\n return state as ToggleButtonState;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useToggleButtonStyles.js","sourceRoot":"../src/","sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,aAAa,GAAG,8BAAU,CAAC;QAC/B,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACjB,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,0BAA0B;YAChE,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc;YACrD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;YAEnD,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI;YAE1C,QAAQ,EAAE;gBACR,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB;gBAC7D,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB;gBAC1D,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;aACpD;YAED,SAAS,EAAE;gBACT,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;gBAC/D,WAAW,EAAE,KAAK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BhC","sourcesContent":["import { mergeClasses, makeStyles } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nconst useRootStyles = makeStyles({\n checked: theme => ({\n background: theme.alias.color.neutral.neutralBackground1Selected,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderWidth: theme.global.strokeWidth.thin,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n }),\n checkedOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n checkedPrimary: theme => ({\n background: theme.alias.color.neutral.brandBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n checkedSubtle: theme => ({\n background: theme.alias.color.neutral.subtleBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n checkedTransparent: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nexport const useToggleButtonStyles = (state: ToggleButtonState): ToggleButtonState => {\n const rootStyles = useRootStyles();\n\n state.className = mergeClasses(\n state.checked && rootStyles.checked,\n state.checked && state.outline && rootStyles.checkedOutline,\n state.checked && state.primary && rootStyles.checkedPrimary,\n state.checked && state.subtle && rootStyles.checkedSubtle,\n state.checked && state.transparent && rootStyles.checkedTransparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"]}
1
+ {"version":3,"file":"useToggleButtonStyles.js","sourceRoot":"../src/","sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,aAAa,GAAG,8BAAU,CAAC;QAC/B,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACjB,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,0BAA0B;YAChE,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc;YACrD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;YAEnD,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI;YAE1C,QAAQ,EAAE;gBACR,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB;gBAC7D,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB;gBAC1D,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;aACpD;YAED,SAAS,EAAE;gBACT,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;gBAC/D,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,qBAAqB;gBAC5D,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,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BACT,UAAU,EAAE,MAAM;gBAClB,WAAW,EAAE,aAAa;aAC3B;SACF;KACF,CAAC,CAAC;IAEI,IAAM,qBAAqB,GAAG,UAAC,KAAwB;QAC5D,IAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QAEnC,KAAK,CAAC,SAAS,GAAG,gCAAY,CAC5B,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,EACnC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,cAAc,EAC3D,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,cAAc,EAC3D,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,aAAa,EACzD,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,kBAAkB,EACnE,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,UAAU,CAAC,QAAQ,EAClE,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,eAAe,EAC1F,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,cAAc,EACxF,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,mBAAmB,EAClG,KAAK,CAAC,SAAS,CAChB,CAAC;QAEF,iCAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAnBW,QAAA,qBAAqB,yBAmBhC","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nconst useRootStyles = makeStyles({\n checked: theme => ({\n background: theme.alias.color.neutral.neutralBackground1Selected,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderWidth: theme.global.strokeWidth.thin,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n }),\n checkedOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n checkedPrimary: theme => ({\n background: theme.alias.color.neutral.brandBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n checkedSubtle: theme => ({\n background: theme.alias.color.neutral.subtleBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n checkedTransparent: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nexport const useToggleButtonStyles = (state: ToggleButtonState): ToggleButtonState => {\n const rootStyles = useRootStyles();\n\n state.className = mergeClasses(\n state.checked && rootStyles.checked,\n state.checked && state.outline && rootStyles.checkedOutline,\n state.checked && state.primary && rootStyles.checkedPrimary,\n state.checked && state.subtle && rootStyles.checkedSubtle,\n state.checked && state.transparent && rootStyles.checkedTransparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  export * from './Button';
2
2
  export * from './CompoundButton';
3
3
  export * from './MenuButton';
4
+ export * from './SplitButton';
4
5
  export * from './ToggleButton';
package/lib-amd/index.js CHANGED
@@ -1,9 +1,10 @@
1
- define(["require", "exports", "tslib", "./Button", "./CompoundButton", "./MenuButton", "./ToggleButton"], function (require, exports, tslib_1, Button_1, CompoundButton_1, MenuButton_1, ToggleButton_1) {
1
+ define(["require", "exports", "tslib", "./Button", "./CompoundButton", "./MenuButton", "./SplitButton", "./ToggleButton"], function (require, exports, tslib_1, Button_1, CompoundButton_1, MenuButton_1, SplitButton_1, ToggleButton_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  tslib_1.__exportStar(Button_1, exports);
5
5
  tslib_1.__exportStar(CompoundButton_1, exports);
6
6
  tslib_1.__exportStar(MenuButton_1, exports);
7
+ tslib_1.__exportStar(SplitButton_1, exports);
7
8
  tslib_1.__exportStar(ToggleButton_1, exports);
8
9
  });
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB;IACzB,gDAAiC;IACjC,4CAA6B;IAC7B,8CAA+B","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './ToggleButton';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB;IACzB,gDAAiC;IACjC,4CAA6B;IAC7B,6CAA8B;IAC9B,8CAA+B","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './SplitButton';\nexport * from './ToggleButton';\n"]}
@@ -0,0 +1 @@
1
+ export * from './components/SplitButton/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/SplitButton/index"), exports);
10
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SplitButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/SplitButton/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,WAAA,CAAA,0BAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EAEG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAF/B,EAGG,CAAC,QAAD,IAAa,QAHhB,EAIG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAJ/B,CADF;AAQD,CAZM;;AAAM,OAAA,CAAA,YAAA,GAAY,YAAZ","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { buttonShorthandPropsCompat } from './useButton';\nimport type { 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 = (state: ButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, buttonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {/*{loading && <slots.loader {...slotProps.loader} />}*/}\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && children}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,WAAA,CAAA,0BAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAH/B,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,YAAA,GAAY,YAAZ","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { buttonShorthandPropsCompat } from './useButton';\nimport type { 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 = (state: ButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, buttonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && children}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -5,6 +5,8 @@ import type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './But
5
5
  */
6
6
  export declare const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[];
7
7
  /**
8
- * Given user props, returns the final state for a Button.
8
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
9
+ * @param props - User provided props to the Button component.
10
+ * @param ref - User provided ref to be passed to the Button component.
9
11
  */
10
12
  export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
@@ -18,7 +18,9 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
18
18
  deepMerge: exports.buttonShorthandPropsCompat
19
19
  });
20
20
  /**
21
- * Given user props, returns the final state for a Button.
21
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
22
+ * @param props - User provided props to the Button component.
23
+ * @param ref - User provided ref to be passed to the Button component.
22
24
  */
23
25
 
24
26
  var useButton = function (props, ref, defaultProps) {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,0BAAA,GAA2D,CAAC,MAAD,CAA3D;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAA4B;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAA5B,CAAnB;AAEA;;AAEG;;AACI,IAAM,SAAS,GAAG,UAAC,KAAD,EAAqB,GAArB,EAAkD,YAAlD,EAA4E;AACnG,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,IAAI,EAAE,QANR;AAOE,IAAA,IAAI,EAAE;AAPR,GADsB,EAUtB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,0BAApC,CAVM,EAWtB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,0BAA7B,CAXsB,CAAxB;AAcA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEA,SAAO,KAAP;AACD,CAlBM;;AAAM,OAAA,CAAA,SAAA,GAAS,SAAT","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from './useButtonState';\nimport type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './Button.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[] = ['icon'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandPropsCompat });\n\n/**\n * Given user props, returns the final state for a Button.\n */\nexport const useButton = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots\n icon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, buttonShorthandPropsCompat),\n resolveShorthandProps(props, buttonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,0BAAA,GAA2D,CAAC,MAAD,CAA3D;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAA4B;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAA5B,CAAnB;AAEA;;;;AAIG;;AACI,IAAM,SAAS,GAAG,UAAC,KAAD,EAAqB,GAArB,EAAkD,YAAlD,EAA4E;AACnG,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,IAAI,EAAE,QANR;AAOE,IAAA,IAAI,EAAE;AAPR,GADsB,EAUtB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,0BAApC,CAVM,EAWtB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,0BAA7B,CAXsB,CAAxB;AAcA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEA,SAAO,KAAP;AACD,CAlBM;;AAAM,OAAA,CAAA,SAAA,GAAS,SAAT","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from './useButtonState';\nimport type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './Button.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[] = ['icon'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandPropsCompat });\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 = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots\n icon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, buttonShorthandPropsCompat),\n resolveShorthandProps(props, buttonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,6 @@
1
1
  import type { ButtonState } from './Button.types';
2
2
  /**
3
- * The useButton hook processes the Button draft state.
4
- * @param state - Button draft state to mutate.
3
+ * The useButton hook processes the Button state.
4
+ * @param state - Button state to mutate.
5
5
  */
6
6
  export declare const useButtonState: (state: ButtonState) => ButtonState;
@@ -7,8 +7,8 @@ exports.useButtonState = void 0;
7
7
 
8
8
  var keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
9
9
  /**
10
- * The useButton hook processes the Button draft state.
11
- * @param state - Button draft state to mutate.
10
+ * The useButton hook processes the Button state.
11
+ * @param state - Button state to mutate.
12
12
  */
13
13
 
14
14
 
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/useButtonState.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;AAGG;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAE,GAAyF,KAAK,CAA9F,EAAF;AAAA,MAAI,QAAQ,GAA+E,KAAK,CAApF,QAAZ;AAAA,MAAc,QAAQ,GAAqE,KAAK,CAA1E,QAAtB;AAAA,MAAwB,iBAAiB,GAAkD,KAAK,CAAvD,iBAAzC;AAAA,MAA2C,IAAI,GAA4C,KAAK,CAAjD,IAA/C;AAAA,MAAiD,OAAO,GAAmC,KAAK,CAAxC,OAAxD;AAAA,MAAqE,iBAAiB,GAAK,KAAK,CAAV,SAAtF;AAER,MAAM,gBAAgB,GAAG,CAAC,CAAC,QAA3B;AACA,MAAM,YAAY,GAAG,CAAC,EAAC,IAAI,KAAA,IAAJ,IAAA,IAAI,KAAA,KAAA,CAAJ,GAAI,KAAA,CAAJ,GAAA,IAAI,CAAE,QAAP,CAAtB;AACA,EAAA,KAAK,CAAC,QAAN,GAAiB,YAAY,IAAI,CAAC,gBAAlC;;AAEA,MAAM,0BAA0B,GAAG,UAAC,EAAD,EAAqC;AACtE,IAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,EAAH,CAAjB;AAEA,QAAM,GAAG,GAAG,EAAE,CAAC,GAAf;;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AAG,EAAE,CAAC,GAAf;;AACA,QAAI,CAAC,QAAQ,IAAI,iBAAb,MAAoC,GAAG,KAAK,eAAA,CAAA,KAAR,IAAiB,GAAG,KAAK,eAAA,CAAA,KAA7D,CAAJ,EAAyE;AACvE,MAAA,EAAE,CAAC,cAAH;AACA,MAAA,EAAE,CAAC,eAAH;AACD,KAHD,MAGO;AACL,MAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;AACD;AACF,GARD,CAnD+C,CA6D/C;;;AACA,EAAA,KAAK,CAAC,QAAN,GAAiB,EAAE,KAAK,QAAP,GAAkB,QAAQ,IAAI,CAAC,iBAA/B,GAAmD,SAApE;AACA,EAAA,KAAK,CAAC,eAAD,CAAL,GAAyB,QAAQ,IAAI,CAAC,KAAK,CAAC,QAA5C;AAEA,SAAO,KAAP;AACD,CAlEM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button draft state.\n * @param state - Button draft state to mutate.\n */\nexport const useButtonState = (state: ButtonState): ButtonState => {\n const { as, children, disabled, disabledFocusable, icon, onClick, onKeyDown: onKeyDownCallback } = state;\n\n const receivedChildren = !!children;\n const receivedIcon = !!icon?.children;\n state.iconOnly = receivedIcon && !receivedChildren;\n\n const onNonAnchorOrButtonKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n onKeyDownCallback?.(ev);\n\n const key = ev.key;\n if (!ev.defaultPrevented && onClick && (key === Enter || key === Space)) {\n // Translate the keydown enter/space to a click.\n ev.preventDefault();\n ev.stopPropagation();\n\n onClick((ev as unknown) as React.MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLElement>);\n }\n };\n\n // Adjust props depending on the root type.\n if (typeof as === 'string') {\n // Add 'role=button' and 'tabIndex=0' for all non-button elements.\n if (as !== 'button') {\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n\n // Add keydown event handler for all other non-anchor elements.\n if (as !== 'a') {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n }\n }\n }\n // Add keydown event handler, 'role=button' and 'tabIndex=0' for all other elements.\n else {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n }\n\n // Disallow click event when component is disabled and eat events when disabledFocusable is set to true.\n state.onClick = (ev: React.MouseEvent<HTMLElement>) => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n } else {\n onClick?.(ev);\n }\n };\n\n // Disallow keydown event when component is disabled and eat events when disabledFocusable is set to true.\n const { onKeyDown } = state;\n state.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n const key = ev.key;\n if ((disabled || disabledFocusable) && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n // Set the aria-disabled and disabled props correctly.\n state.disabled = as === 'button' ? disabled && !disabledFocusable : undefined;\n state['aria-disabled'] = disabled && !state.disabled;\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Button/useButtonState.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;AAGG;;;AACI,IAAM,cAAc,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAE,GAAyF,KAAK,CAA9F,EAAF;AAAA,MAAI,QAAQ,GAA+E,KAAK,CAApF,QAAZ;AAAA,MAAc,QAAQ,GAAqE,KAAK,CAA1E,QAAtB;AAAA,MAAwB,iBAAiB,GAAkD,KAAK,CAAvD,iBAAzC;AAAA,MAA2C,IAAI,GAA4C,KAAK,CAAjD,IAA/C;AAAA,MAAiD,OAAO,GAAmC,KAAK,CAAxC,OAAxD;AAAA,MAAqE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,GAAiB,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,CAA9D;AACD,GAtC8C,CAwC/C;;;AACA,EAAA,KAAK,CAAC,OAAN,GAAgB,UAAC,EAAD,EAAkC;AAChD,QAAI,QAAQ,IAAI,iBAAhB,EAAmC;AACjC,MAAA,EAAE,CAAC,cAAH;AACD,KAFD,MAEO;AACL,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;AACD;AACF,GAND,CAzC+C,CAiD/C;;;AACQ,MAAA,SAAS,GAAK,KAAK,CAAV,SAAT;;AACR,EAAA,KAAK,CAAC,SAAN,GAAkB,UAAC,EAAD,EAAqC;AACrD,QAAM,GAAG,GAAG,EAAE,CAAC,GAAf;;AACA,QAAI,CAAC,QAAQ,IAAI,iBAAb,MAAoC,GAAG,KAAK,eAAA,CAAA,KAAR,IAAiB,GAAG,KAAK,eAAA,CAAA,KAA7D,CAAJ,EAAyE;AACvE,MAAA,EAAE,CAAC,cAAH;AACA,MAAA,EAAE,CAAC,eAAH;AACD,KAHD,MAGO;AACL,MAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;AACD;AACF,GARD,CAnD+C,CA6D/C;;;AACA,EAAA,KAAK,CAAC,QAAN,GAAiB,EAAE,KAAK,QAAP,GAAkB,QAAQ,IAAI,CAAC,iBAA/B,GAAmD,SAApE;AACA,EAAA,KAAK,CAAC,eAAD,CAAL,GAAyB,QAAQ,IAAI,CAAC,KAAK,CAAC,QAA5C;AAEA,SAAO,KAAP;AACD,CAlEM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button state.\n * @param state - Button state to mutate.\n */\nexport const useButtonState = (state: ButtonState): ButtonState => {\n const { as, children, disabled, disabledFocusable, icon, onClick, onKeyDown: onKeyDownCallback } = state;\n\n const receivedChildren = !!children;\n const receivedIcon = !!icon?.children;\n state.iconOnly = receivedIcon && !receivedChildren;\n\n const onNonAnchorOrButtonKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n onKeyDownCallback?.(ev);\n\n const key = ev.key;\n if (!ev.defaultPrevented && onClick && (key === Enter || key === Space)) {\n // Translate the keydown enter/space to a click.\n ev.preventDefault();\n ev.stopPropagation();\n\n onClick((ev as unknown) as React.MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLElement>);\n }\n };\n\n // Adjust props depending on the root type.\n if (typeof as === 'string') {\n // Add 'role=button' and 'tabIndex=0' for all non-button elements.\n if (as !== 'button') {\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n\n // Add keydown event handler for all other non-anchor elements.\n if (as !== 'a') {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n }\n }\n }\n // Add keydown event handler, 'role=button' and 'tabIndex=0' for all other elements.\n else {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n }\n\n // Disallow click event when component is disabled and eat events when disabledFocusable is set to true.\n state.onClick = (ev: React.MouseEvent<HTMLElement>) => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n } else {\n onClick?.(ev);\n }\n };\n\n // Disallow keydown event when component is disabled and eat events when disabledFocusable is set to true.\n const { onKeyDown } = state;\n state.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n const key = ev.key;\n if ((disabled || disabledFocusable) && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n // Set the aria-disabled and disabled props correctly.\n state.disabled = as === 'button' ? disabled && !disabledFocusable : undefined;\n state['aria-disabled'] = disabled && !state.disabled;\n\n return state;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B,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAjBpB,EAkBhB,KAAK,CAAC,SAlBU,CAAlB;AAqBA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,KAAK,CAAC,IAAP,CAAxC,EAAsD,KAAK,CAAC,IAAN,CAAW,SAAjE,CAAvB;AAEA,SAAO,KAAP;AACD,CA9BM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { createFocusIndicatorStyleRule } from '@fluentui/react-tabster';\nimport type { ButtonState } from './Button.types';\n\n// TODO: These are named in design specs but not hoisted to global/alias yet.\n// We're tracking these here to determine how we can hoist them.\nexport const buttonSpacing = {\n smallest: '2px',\n smaller: '4px',\n small: '6px',\n medium: '8px',\n large: '12px',\n larger: '16px',\n};\n\nconst useRootStyles = makeStyles({\n base: theme => ({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n verticalAlign: 'middle',\n\n margin: 0,\n\n maxWidth: '280px',\n\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n background: theme.alias.color.neutral.neutralBackground1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderColor: theme.alias.color.neutral.neutralStroke1,\n borderStyle: 'solid',\n borderWidth: theme.global.strokeWidth.thin,\n\n fontFamily: theme.global.type.fontFamilies.base,\n\n outline: 'none',\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n\n cursor: 'pointer',\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n\n outline: 'none',\n },\n }),\n small: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.smaller,\n padding: `0 ${buttonSpacing.medium}`,\n\n height: '24px',\n minWidth: '64px',\n\n borderRadius: theme.global.borderRadius.small,\n\n fontSize: theme.global.type.fontSizes.base[200],\n fontWeight: theme.global.type.fontWeights.regular,\n lineHeight: theme.global.type.lineHeights.base[200],\n }),\n medium: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.small,\n padding: `0 ${buttonSpacing.large}`,\n\n height: '32px',\n minWidth: '96px',\n\n borderRadius: theme.global.borderRadius.medium,\n\n fontSize: theme.global.type.fontSizes.base[300],\n fontWeight: theme.global.type.fontWeights.semibold,\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n large: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.small,\n padding: `0 ${buttonSpacing.larger}`,\n\n height: '40px',\n minWidth: '96px',\n\n borderRadius: theme.global.borderRadius.medium,\n\n fontSize: theme.global.type.fontSizes.base[400],\n fontWeight: theme.global.type.fontWeights.semibold,\n lineHeight: theme.global.type.lineHeights.base[400],\n }),\n block: {\n maxWidth: '100%',\n width: '100%',\n },\n circular: theme => ({\n borderRadius: theme.global.borderRadius.circular,\n }),\n outline: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n primary: theme => ({\n background: theme.alias.color.neutral.brandBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n subtle: theme => ({\n background: theme.alias.color.neutral.subtleBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n transparent: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n },\n }),\n disabledOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nconst useRootFocusStyles = makeStyles({\n base: createFocusIndicatorStyleRule(theme => ({\n borderColor: 'transparent',\n boxShadow: `\n ${theme.alias.shadow.shadow4},\n 0 0 0 2px ${theme.alias.color.neutral.strokeFocus2}\n `,\n })),\n circular: createFocusIndicatorStyleRule(theme => ({\n borderRadius: theme.global.borderRadius.circular,\n })),\n primary: createFocusIndicatorStyleRule(theme => ({\n borderColor: theme.alias.color.neutral.neutralForegroundOnBrand,\n boxShadow: `${theme.alias.shadow.shadow2}, 0 0 0 2px ${theme.alias.color.neutral.strokeFocus2}`,\n })),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n small: {\n padding: buttonSpacing.smaller,\n\n minWidth: '28px',\n maxWidth: '28px',\n },\n medium: {\n padding: buttonSpacing.smaller,\n\n minWidth: '32px',\n maxWidth: '32px',\n },\n large: {\n padding: buttonSpacing.small,\n\n minWidth: '40px',\n maxWidth: '40px',\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n },\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n});\n\nexport const useButtonStyles = (state: ButtonState): ButtonState => {\n const rootStyles = useRootStyles();\n const rootFocusStyles = useRootFocusStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n\n state.className = mergeClasses(\n rootStyles.base,\n rootFocusStyles.base,\n rootStyles[state.size],\n state.block && rootStyles.block,\n state.circular && rootStyles.circular,\n state.circular && rootFocusStyles.circular,\n state.outline && rootStyles.outline,\n state.primary && rootStyles.primary,\n state.primary && rootFocusStyles.primary,\n state.subtle && rootStyles.subtle,\n state.transparent && rootStyles.transparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.outline && rootStyles.disabledOutline,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.iconOnly && rootIconOnlyStyles[state.size],\n state.className,\n );\n\n state.icon.className = mergeClasses(iconStyles.base, iconStyles[state.size], state.icon.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Button/useButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA,C,CAGA;AACA;;;AACa,OAAA,CAAA,aAAA,GAAgB;AAC3B,EAAA,QAAQ,EAAE,KADiB;AAE3B,EAAA,OAAO,EAAE,KAFkB;AAG3B,EAAA,KAAK,EAAE,KAHoB;AAI3B,EAAA,MAAM,EAAE,KAJmB;AAK3B,EAAA,KAAK,EAAE,MALoB;AAM3B,EAAA,MAAM,EAAE;AANmB,CAAhB;;AASb,IAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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K,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAb3D,EAchB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAd3D,EAehB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,MAArD,IAA+D,UAAU,CAAC,cAf1D,EAgBhB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBAhB/D,EAiBhB,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAjBpB,EAkBhB,KAAK,CAAC,SAlBU,CAAlB;AAqBA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,UAAU,CAAC,KAAK,CAAC,IAAP,CAAxC,EAAsD,KAAK,CAAC,IAAN,CAAW,SAAjE,CAAvB;AAEA,SAAO,KAAP;AACD,CA9BM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { createFocusIndicatorStyleRule } from '@fluentui/react-tabster';\nimport type { ButtonState } from './Button.types';\n\n// TODO: These are named in design specs but not hoisted to global/alias yet.\n// We're tracking these here to determine how we can hoist them.\nexport const buttonSpacing = {\n smallest: '2px',\n smaller: '4px',\n small: '6px',\n medium: '8px',\n large: '12px',\n larger: '16px',\n};\n\nconst useRootStyles = makeStyles({\n base: theme => ({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n verticalAlign: 'middle',\n\n margin: 0,\n\n maxWidth: '280px',\n\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n\n background: theme.alias.color.neutral.neutralBackground1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderColor: theme.alias.color.neutral.neutralStroke1,\n borderStyle: 'solid',\n borderWidth: theme.global.strokeWidth.thin,\n\n fontFamily: theme.global.type.fontFamilies.base,\n\n outline: 'none',\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n\n cursor: 'pointer',\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n\n outline: 'none',\n },\n }),\n small: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.smaller,\n padding: `0 ${buttonSpacing.medium}`,\n\n height: '24px',\n minWidth: '64px',\n\n borderRadius: theme.global.borderRadius.small,\n\n fontSize: theme.global.type.fontSizes.base[200],\n fontWeight: theme.global.type.fontWeights.regular,\n lineHeight: theme.global.type.lineHeights.base[200],\n }),\n medium: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.small,\n padding: `0 ${buttonSpacing.large}`,\n\n height: '32px',\n minWidth: '96px',\n\n borderRadius: theme.global.borderRadius.medium,\n\n fontSize: theme.global.type.fontSizes.base[300],\n fontWeight: theme.global.type.fontWeights.semibold,\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n large: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.small,\n padding: `0 ${buttonSpacing.larger}`,\n\n height: '40px',\n minWidth: '96px',\n\n borderRadius: theme.global.borderRadius.medium,\n\n fontSize: theme.global.type.fontSizes.base[400],\n fontWeight: theme.global.type.fontWeights.semibold,\n lineHeight: theme.global.type.lineHeights.base[400],\n }),\n block: {\n maxWidth: '100%',\n width: '100%',\n },\n circular: theme => ({\n borderRadius: theme.global.borderRadius.circular,\n }),\n outline: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n primary: theme => ({\n background: theme.alias.color.neutral.brandBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n subtle: theme => ({\n background: theme.alias.color.neutral.subtleBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n transparent: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n cursor: 'not-allowed',\n },\n }),\n disabledOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackground,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nconst useRootFocusStyles = makeStyles({\n base: createFocusIndicatorStyleRule(theme => ({\n borderColor: 'transparent',\n boxShadow: `\n ${theme.alias.shadow.shadow4},\n 0 0 0 2px ${theme.alias.color.neutral.strokeFocus2}\n `,\n zIndex: 1,\n })),\n circular: createFocusIndicatorStyleRule(theme => ({\n borderRadius: theme.global.borderRadius.circular,\n })),\n primary: createFocusIndicatorStyleRule(theme => ({\n borderColor: theme.alias.color.neutral.neutralForegroundOnBrand,\n boxShadow: `${theme.alias.shadow.shadow2}, 0 0 0 2px ${theme.alias.color.neutral.strokeFocus2}`,\n })),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n small: {\n padding: buttonSpacing.smaller,\n\n minWidth: '28px',\n maxWidth: '28px',\n },\n medium: {\n padding: buttonSpacing.smaller,\n\n minWidth: '32px',\n maxWidth: '32px',\n },\n large: {\n padding: buttonSpacing.small,\n\n minWidth: '40px',\n maxWidth: '40px',\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'center',\n },\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n});\n\nexport const useButtonStyles = (state: ButtonState): ButtonState => {\n const rootStyles = useRootStyles();\n const rootFocusStyles = useRootFocusStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n\n state.className = mergeClasses(\n rootStyles.base,\n rootFocusStyles.base,\n rootStyles[state.size],\n state.block && rootStyles.block,\n state.circular && rootStyles.circular,\n state.circular && rootFocusStyles.circular,\n state.outline && rootStyles.outline,\n state.primary && rootStyles.primary,\n state.primary && rootFocusStyles.primary,\n state.subtle && rootStyles.subtle,\n state.transparent && rootStyles.transparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.outline && rootStyles.disabledOutline,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.iconOnly && rootIconOnlyStyles[state.size],\n state.className,\n );\n\n state.icon.className = mergeClasses(iconStyles.base, iconStyles[state.size], state.icon.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,mBAAA,CAAA,kCAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EAEG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAF/B,EAGG,CAAC,QAAD,IACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,QADH,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAJJ,EASG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAT/B,CADF;AAaD,CAjBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { compoundButtonShorthandPropsCompat } from './useCompoundButton';\nimport type { 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 = (state: CompoundButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, compoundButtonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {/*loading && <slots.loader {...slotProps.loader} />*/}\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && (\n <slots.contentContainer {...slotProps.contentContainer}>\n {children}\n <slots.secondaryContent {...slotProps.secondaryContent} />\n </slots.contentContainer>\n )}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,mBAAA,CAAA,kCAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,QADH,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAHJ,EAQG,YAAY,KAAK,OAAjB,IAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAR/B,CADF;AAYD,CAhBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { compoundButtonShorthandPropsCompat } from './useCompoundButton';\nimport type { 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 = (state: CompoundButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, compoundButtonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && (\n <slots.contentContainer {...slotProps.contentContainer}>\n {children}\n <slots.secondaryContent {...slotProps.secondaryContent} />\n </slots.contentContainer>\n )}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -5,6 +5,8 @@ import type { CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundB
5
5
  */
6
6
  export declare const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[];
7
7
  /**
8
- * Given user props, returns the final state for a CompoundButton.
8
+ * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
9
+ * @param props - User provided props to the CompoundButton component.
10
+ * @param ref - User provided ref to be passed to the CompoundButton component.
9
11
  */
10
12
  export declare const useCompoundButton: (props: CompoundButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: CompoundButtonProps | undefined) => CompoundButtonState;
@@ -18,7 +18,9 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
18
18
  deepMerge: exports.compoundButtonShorthandPropsCompat
19
19
  });
20
20
  /**
21
- * Given user props, returns the final state for a CompoundButton.
21
+ * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
22
+ * @param props - User provided props to the CompoundButton component.
23
+ * @param ref - User provided ref to be passed to the CompoundButton component.
22
24
  */
23
25
 
24
26
  var useCompoundButton = function (props, ref, defaultProps) {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAOA;;AAEG;;;AACU,OAAA,CAAA,kCAAA,GAA2E,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAA3E;AAMb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAoC;AACrD,EAAA,SAAS,EAAE,OAAA,CAAA;AAD0C,CAApC,CAAnB;AAIA;;AAEG;;AACI,IAAM,iBAAiB,GAAG,UAC/B,KAD+B,EAE/B,GAF+B,EAG/B,YAH+B,EAGG;AAElC,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE,MAAN;AAAc,MAAA,QAAQ,EAAE;AAAxB,KANpB;AAOE,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAPpB;AAQE;AACA,IAAA,IAAI,EAAE,QATR;AAUE,IAAA,IAAI,EAAE;AAVR,GADsB,EAatB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,kCAApC,CAbM,EActB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,kCAA7B,CAdsB,CAAxB;AAiBA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEA,SAAO,KAAP;AACD,CAzBM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from '../Button/useButtonState';\nimport type {\n CompoundButtonProps,\n CompoundButtonShorthandPropsCompat,\n CompoundButtonState,\n} from './CompoundButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[] = [\n 'contentContainer',\n 'icon',\n 'secondaryContent',\n];\n\nconst mergeProps = makeMergeProps<CompoundButtonState>({\n deepMerge: compoundButtonShorthandPropsCompat,\n});\n\n/**\n * Given user props, returns the final state for a CompoundButton.\n */\nexport const useCompoundButton = (\n props: CompoundButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: CompoundButtonProps,\n): CompoundButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots inherited from Button\n icon: { as: 'span' },\n // Slots exclusive to CompoundButton\n contentContainer: { as: 'span', children: null },\n secondaryContent: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, compoundButtonShorthandPropsCompat),\n resolveShorthandProps(props, compoundButtonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAOA;;AAEG;;;AACU,OAAA,CAAA,kCAAA,GAA2E,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAA3E;AAMb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAoC;AACrD,EAAA,SAAS,EAAE,OAAA,CAAA;AAD0C,CAApC,CAAnB;AAIA;;;;AAIG;;AACI,IAAM,iBAAiB,GAAG,UAC/B,KAD+B,EAE/B,GAF+B,EAG/B,YAH+B,EAGG;AAElC,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE,MAAN;AAAc,MAAA,QAAQ,EAAE;AAAxB,KANpB;AAOE,IAAA,gBAAgB,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAPpB;AAQE;AACA,IAAA,IAAI,EAAE,QATR;AAUE,IAAA,IAAI,EAAE;AAVR,GADsB,EAatB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,kCAApC,CAbM,EActB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,kCAA7B,CAdsB,CAAxB;AAiBA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEA,SAAO,KAAP;AACD,CAzBM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from '../Button/useButtonState';\nimport type {\n CompoundButtonProps,\n CompoundButtonShorthandPropsCompat,\n CompoundButtonState,\n} from './CompoundButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[] = [\n 'contentContainer',\n 'icon',\n 'secondaryContent',\n];\n\nconst mergeProps = makeMergeProps<CompoundButtonState>({\n deepMerge: compoundButtonShorthandPropsCompat,\n});\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 = (\n props: CompoundButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: CompoundButtonProps,\n): CompoundButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots inherited from Button\n icon: { as: 'span' },\n // Slots exclusive to CompoundButton\n contentContainer: { as: 'span', children: null },\n secondaryContent: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, compoundButtonShorthandPropsCompat),\n resolveShorthandProps(props, compoundButtonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,wBAAwB,GAAG;AAC/B,EAAA,gBAAgB,EAAE;AADa,CAAjC;;AAIA,IAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AC,MAJX,EAKhB,KAAK,CAAC,WAAN,IAAqB,UAAU,CAAC,WALhB,EAMhB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN1C,EAOhB,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAPpB,EAQhB,KAAK,CAAC,SARU,CAAlB;AAWA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,CAAa,UAAU,CAAC,IAAxB,EAA8B,KAAK,CAAC,IAAN,CAAW,SAAzC,CAAvB;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,mBAAA,CAAA,YAAA,CAAa,sBAAsB,CAAC,IAApC,EAA0C,KAAK,CAAC,gBAAN,CAAuB,SAAjE,CAAnC;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,mBAAA,CAAA,YAAA,CACjC,wBAAwB,CAAC,gBADQ,EAEjC,sBAAsB,CAAC,IAFU,EAGjC,sBAAsB,CAAC,KAAK,CAAC,IAAP,CAHW,EAIjC,KAAK,CAAC,gBAAN,CAAuB,SAJU,CAAnC;AAOA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { mergeClasses, makeStyles } from '@fluentui/react-make-styles';\nimport { buttonSpacing, useButtonStyles } from '../Button/useButtonStyles';\nimport type { CompoundButtonState } from './CompoundButton.types';\n\nconst CompoundButtonClassNames = {\n secondaryContent: 'CompoundButton-secondaryContent',\n};\n\nconst useRootStyles = makeStyles({\n base: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.large,\n\n height: 'auto',\n\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Hover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Pressed,\n },\n },\n }),\n small: theme => ({\n padding: buttonSpacing.medium,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n medium: theme => ({\n padding: buttonSpacing.large,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n large: theme => ({\n padding: buttonSpacing.larger,\n\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n }),\n primary: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n }),\n subtle: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n transparent: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n disabled: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n }),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n small: {\n padding: buttonSpacing.smaller,\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n padding: buttonSpacing.small,\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n padding: buttonSpacing.medium,\n\n maxWidth: '56px',\n minWidth: '56px',\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n fontSize: '40px',\n height: '40px',\n width: '40px',\n },\n});\n\nconst useContentContainerStyles = makeStyles({\n base: {\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'left',\n },\n});\n\nconst useSecondaryContentStyles = makeStyles({\n base: theme => ({\n lineHeight: '100%',\n marginTop: '4px',\n fontWeight: theme.global.type.fontWeights.regular,\n }),\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n }),\n});\n\nexport const useCompoundButtonStyles = (state: CompoundButtonState): CompoundButtonState => {\n const rootStyles = useRootStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n const contentContainerStyles = useContentContainerStyles();\n const secondaryContentStyles = useSecondaryContentStyles();\n\n state.className = mergeClasses(\n rootStyles.base,\n rootStyles[state.size],\n state.primary && rootStyles.primary,\n state.subtle && rootStyles.subtle,\n state.transparent && rootStyles.transparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n state.iconOnly && rootIconOnlyStyles[state.size],\n state.className,\n );\n\n state.icon.className = mergeClasses(iconStyles.base, state.icon.className);\n\n state.contentContainer.className = mergeClasses(contentContainerStyles.base, state.contentContainer.className);\n\n state.secondaryContent.className = mergeClasses(\n CompoundButtonClassNames.secondaryContent,\n secondaryContentStyles.base,\n secondaryContentStyles[state.size],\n state.secondaryContent.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,wBAAwB,GAAG;AAC/B,EAAA,gBAAgB,EAAE;AADa,CAAjC;;AAIA,IAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AA+GA,IAAM,qBAAqB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA9B;;AAqBA,IAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AAQA,IAAM,yBAAy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AAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,mBAAA,CAAA,YAAA,CACjC,wBAAwB,CAAC,gBADQ,EAEjC,sBAAsB,CAAC,IAFU,EAGjC,sBAAsB,CAAC,KAAK,CAAC,IAAP,CAHW,EAIjC,KAAK,CAAC,gBAAN,CAAuB,SAJU,CAAnC;AAOA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CAhCM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { buttonSpacing, useButtonStyles } from '../Button/useButtonStyles';\nimport type { CompoundButtonState } from './CompoundButton.types';\n\nconst CompoundButtonClassNames = {\n secondaryContent: 'CompoundButton-secondaryContent',\n};\n\nconst useRootStyles = makeStyles({\n base: theme => ({\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonSpacing.large,\n\n height: 'auto',\n\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Hover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2Pressed,\n },\n },\n }),\n small: theme => ({\n padding: buttonSpacing.medium,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n medium: theme => ({\n padding: buttonSpacing.large,\n\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n }),\n large: theme => ({\n padding: buttonSpacing.larger,\n\n fontSize: theme.global.type.fontSizes.base[400],\n lineHeight: theme.global.type.lineHeights.base[400],\n }),\n primary: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n },\n }),\n subtle: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n transparent: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n },\n }),\n disabled: theme => ({\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':hover': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n\n ':active': {\n [`& .${CompoundButtonClassNames.secondaryContent}`]: {\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n },\n }),\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n small: {\n padding: buttonSpacing.smaller,\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n padding: buttonSpacing.small,\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n padding: buttonSpacing.medium,\n\n maxWidth: '56px',\n minWidth: '56px',\n },\n});\n\nconst useIconStyles = makeStyles({\n base: {\n fontSize: '40px',\n height: '40px',\n width: '40px',\n },\n});\n\nconst useContentContainerStyles = makeStyles({\n base: {\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'left',\n },\n});\n\nconst useSecondaryContentStyles = makeStyles({\n base: theme => ({\n lineHeight: '100%',\n marginTop: '4px',\n fontWeight: theme.global.type.fontWeights.regular,\n }),\n small: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n medium: theme => ({\n fontSize: theme.global.type.fontSizes.base[200],\n }),\n large: theme => ({\n fontSize: theme.global.type.fontSizes.base[300],\n }),\n});\n\nexport const useCompoundButtonStyles = (state: CompoundButtonState): CompoundButtonState => {\n const rootStyles = useRootStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n const contentContainerStyles = useContentContainerStyles();\n const secondaryContentStyles = useSecondaryContentStyles();\n\n state.className = mergeClasses(\n rootStyles.base,\n rootStyles[state.size],\n state.primary && rootStyles.primary,\n state.subtle && rootStyles.subtle,\n state.transparent && rootStyles.transparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n state.iconOnly && rootIconOnlyStyles[state.size],\n state.className,\n );\n\n state.icon.className = mergeClasses(iconStyles.base, state.icon.className);\n\n state.contentContainer.className = mergeClasses(contentContainerStyles.base, state.contentContainer.className);\n\n state.secondaryContent.className = mergeClasses(\n CompoundButtonClassNames.secondaryContent,\n secondaryContentStyles.base,\n secondaryContentStyles[state.size],\n state.secondaryContent.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import type { MenuTriggerChildProps } from '@fluentui/react-menu';
3
3
  import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
4
4
  import type { ButtonDefaultedProps, ButtonProps, ButtonShorthandPropsCompat, ButtonState } from '../Button/Button.types';
5
- export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<MenuTriggerChildProps> & {
5
+ export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<Omit<MenuTriggerChildProps, 'ref'>> & {
6
6
  /**
7
7
  * Menu icon that indicates that this button has a menu that can be expanded.
8
8
  */
@@ -23,8 +23,9 @@ var renderMenuButton = function (state) {
23
23
  slotProps = _a.slotProps;
24
24
 
25
25
  var children = state.children,
26
+ icon = state.icon,
26
27
  iconOnly = state.iconOnly;
27
- return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)), !iconOnly && children, !iconOnly && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon)));
28
+ return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)), !iconOnly && children, (!iconOnly || !icon.children) && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon)));
28
29
  };
29
30
 
30
31
  exports.renderMenuButton = renderMenuButton;