@fluentui/react-button 9.0.0-alpha.85 → 9.0.0-alpha.89

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/CHANGELOG.json +123 -1
  2. package/CHANGELOG.md +47 -2
  3. package/dist/react-button.d.ts +118 -25
  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/Button.types.d.ts +2 -2
  8. package/lib/components/Button/Button.types.js.map +1 -1
  9. package/lib/components/Button/renderButton.js.map +1 -1
  10. package/lib/components/Button/useButton.d.ts +3 -1
  11. package/lib/components/Button/useButton.js +3 -1
  12. package/lib/components/Button/useButton.js.map +1 -1
  13. package/lib/components/Button/useButtonState.d.ts +2 -2
  14. package/lib/components/Button/useButtonState.js +2 -2
  15. package/lib/components/Button/useButtonState.js.map +1 -1
  16. package/lib/components/Button/useButtonStyles.js.map +1 -1
  17. package/lib/components/CompoundButton/CompoundButton.d.ts +16 -2
  18. package/lib/components/CompoundButton/CompoundButton.types.d.ts +3 -4
  19. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  20. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  21. package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
  22. package/lib/components/CompoundButton/useCompoundButton.js +3 -1
  23. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  24. package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
  25. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  26. package/lib/components/MenuButton/MenuButton.types.d.ts +2 -3
  27. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  28. package/lib/components/MenuButton/renderMenuButton.js +2 -1
  29. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  30. package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
  31. package/lib/components/MenuButton/useMenuButton.js +3 -3
  32. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  33. package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
  34. package/lib/components/MenuButton/useMenuButtonState.js +9 -1
  35. package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
  36. package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
  37. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  38. package/lib/components/SplitButton/SplitButton.d.ts +7 -0
  39. package/lib/components/SplitButton/SplitButton.js +25 -0
  40. package/lib/components/SplitButton/SplitButton.js.map +1 -0
  41. package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
  42. package/lib/components/SplitButton/SplitButton.types.js +2 -0
  43. package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
  44. package/lib/components/SplitButton/index.d.ts +5 -0
  45. package/lib/components/SplitButton/index.js +6 -0
  46. package/lib/components/SplitButton/index.js.map +1 -0
  47. package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
  48. package/lib/components/SplitButton/renderSplitButton.js +16 -0
  49. package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
  50. package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
  51. package/lib/components/SplitButton/useSplitButton.js +72 -0
  52. package/lib/components/SplitButton/useSplitButton.js.map +1 -0
  53. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  54. package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
  55. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  56. package/lib/components/ToggleButton/ToggleButton.d.ts +16 -2
  57. package/lib/components/ToggleButton/ToggleButton.types.d.ts +3 -4
  58. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  59. package/lib/components/ToggleButton/useChecked.d.ts +2 -2
  60. package/lib/components/ToggleButton/useChecked.js.map +1 -1
  61. package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
  62. package/lib/components/ToggleButton/useToggleButton.js +4 -1
  63. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  64. package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
  65. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  66. package/lib/index.d.ts +1 -0
  67. package/lib/index.js +1 -0
  68. package/lib/index.js.map +1 -1
  69. package/lib-amd/SplitButton.d.ts +1 -0
  70. package/lib-amd/SplitButton.js +6 -0
  71. package/lib-amd/SplitButton.js.map +1 -0
  72. package/lib-amd/components/Button/Button.types.d.ts +2 -2
  73. package/lib-amd/components/Button/Button.types.js.map +1 -1
  74. package/lib-amd/components/Button/renderButton.js.map +1 -1
  75. package/lib-amd/components/Button/useButton.d.ts +3 -1
  76. package/lib-amd/components/Button/useButton.js +3 -1
  77. package/lib-amd/components/Button/useButton.js.map +1 -1
  78. package/lib-amd/components/Button/useButtonState.d.ts +2 -2
  79. package/lib-amd/components/Button/useButtonState.js +2 -2
  80. package/lib-amd/components/Button/useButtonState.js.map +1 -1
  81. package/lib-amd/components/Button/useButtonStyles.js +1 -0
  82. package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
  83. package/lib-amd/components/CompoundButton/CompoundButton.d.ts +16 -2
  84. package/lib-amd/components/CompoundButton/CompoundButton.types.d.ts +3 -4
  85. package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -1
  86. package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
  87. package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
  88. package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
  89. package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
  90. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  91. package/lib-amd/components/MenuButton/MenuButton.types.d.ts +2 -3
  92. package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
  93. package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
  94. package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
  95. package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
  96. package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
  97. package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
  98. package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
  99. package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
  100. package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
  101. package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  102. package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
  103. package/lib-amd/components/SplitButton/SplitButton.js +19 -0
  104. package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
  105. package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
  106. package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
  107. package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
  108. package/lib-amd/components/SplitButton/index.d.ts +5 -0
  109. package/lib-amd/components/SplitButton/index.js +11 -0
  110. package/lib-amd/components/SplitButton/index.js.map +1 -0
  111. package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
  112. package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
  113. package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
  114. package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
  115. package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
  116. package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
  117. package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  118. package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
  119. package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  120. package/lib-amd/components/ToggleButton/ToggleButton.d.ts +16 -2
  121. package/lib-amd/components/ToggleButton/ToggleButton.types.d.ts +3 -4
  122. package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -1
  123. package/lib-amd/components/ToggleButton/useChecked.d.ts +2 -2
  124. package/lib-amd/components/ToggleButton/useChecked.js.map +1 -1
  125. package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
  126. package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
  127. package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
  128. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  129. package/lib-amd/index.d.ts +1 -0
  130. package/lib-amd/index.js +2 -1
  131. package/lib-amd/index.js.map +1 -1
  132. package/lib-commonjs/SplitButton.d.ts +1 -0
  133. package/lib-commonjs/SplitButton.js +10 -0
  134. package/lib-commonjs/SplitButton.js.map +1 -0
  135. package/lib-commonjs/components/Button/Button.types.d.ts +2 -2
  136. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  137. package/lib-commonjs/components/Button/useButton.d.ts +3 -1
  138. package/lib-commonjs/components/Button/useButton.js +3 -1
  139. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  140. package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
  141. package/lib-commonjs/components/Button/useButtonState.js +2 -2
  142. package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
  143. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  144. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +16 -2
  145. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +3 -4
  146. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  147. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
  148. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
  149. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  150. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  151. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +2 -3
  152. package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
  153. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  154. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
  155. package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
  156. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  157. package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
  158. package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
  159. package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
  160. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  161. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
  162. package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
  163. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
  164. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
  165. package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
  166. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
  167. package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
  168. package/lib-commonjs/components/SplitButton/index.js +26 -0
  169. package/lib-commonjs/components/SplitButton/index.js.map +1 -0
  170. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
  171. package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
  172. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
  173. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
  174. package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
  175. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
  176. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  177. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
  178. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  179. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +16 -2
  180. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +3 -4
  181. package/lib-commonjs/components/ToggleButton/useChecked.d.ts +2 -2
  182. package/lib-commonjs/components/ToggleButton/useChecked.js.map +1 -1
  183. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
  184. package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
  185. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  186. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  187. package/lib-commonjs/index.d.ts +1 -0
  188. package/lib-commonjs/index.js +2 -0
  189. package/lib-commonjs/index.js.map +1 -1
  190. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/useButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,6BAAT,QAA8C,yBAA9C,C,CAGA;AACA;;AACA,OAAO,IAAM,aAAa,GAAG;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,CAAtB;;AASP,IAAM,aAAa,gBAAG;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;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;AA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CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBAhBnD,EAiB5B,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAjBR,EAkB5B,KAAK,CAAC,SAlBsB,CAA9B;AAqBA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,KAAK,CAAC,IAAP,CAA5B,EAA0C,KAAK,CAAC,IAAN,CAAW,SAArD,CAAnC;AAEA,SAAO,KAAP;AACD,CA9BM","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,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,6BAAT,QAA8C,yBAA9C,C,CAGA;AACA;;AACA,OAAO,IAAM,aAAa,GAAG;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,CAAtB;;AASP,IAAM,aAAa,gBAAG;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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IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAb/C,EAc5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAd/C,EAe5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,MAArD,IAA+D,UAAU,CAAC,cAf9C,EAgB5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBAhBnD,EAiB5B,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAjBR,EAkB5B,KAAK,CAAC,SAlBsB,CAA9B;AAqBA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,KAAK,CAAC,IAAP,CAA5B,EAA0C,KAAK,CAAC,IAAN,CAAW,SAArD,CAAnC;AAEA,SAAO,KAAP;AACD,CA9BM","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,6 +1,20 @@
1
1
  import * as React from 'react';
2
- import type { CompoundButtonProps } from './CompoundButton.types';
3
2
  /**
4
3
  * CompoundButtons are buttons that can have secondary content that adds extra information to the user.
5
4
  */
6
- export declare const CompoundButton: React.ForwardRefExoticComponent<CompoundButtonProps & React.RefAttributes<HTMLElement>>;
5
+ export declare const CompoundButton: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentPropsCompat & React.ButtonHTMLAttributes<HTMLElement> & {
6
+ icon?: import("@fluentui/react-utilities").ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;
7
+ block?: boolean | undefined;
8
+ circular?: boolean | undefined;
9
+ disabled?: boolean | undefined;
10
+ disabledFocusable?: boolean | undefined;
11
+ iconPosition?: "before" | "after" | undefined;
12
+ outline?: boolean | undefined;
13
+ primary?: boolean | undefined;
14
+ size?: "small" | "medium" | "large" | undefined;
15
+ subtle?: boolean | undefined;
16
+ transparent?: boolean | undefined;
17
+ } & {
18
+ secondaryContent?: import("@fluentui/react-utilities").ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;
19
+ contentContainer?: import("@fluentui/react-utilities").ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;
20
+ } & React.RefAttributes<HTMLElement>>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
3
3
  import type { ButtonDefaultedProps, ButtonProps, ButtonShorthandPropsCompat, ButtonState } from '../Button/Button.types';
4
- export interface CompoundButtonProps extends ButtonProps {
4
+ export declare type CompoundButtonProps = ButtonProps & {
5
5
  /**
6
6
  * Second line of text that describes the action this button takes.
7
7
  */
@@ -10,8 +10,7 @@ export interface CompoundButtonProps extends ButtonProps {
10
10
  * Container that wraps the children and secondaryContent slots.
11
11
  */
12
12
  contentContainer?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;
13
- }
13
+ };
14
14
  export declare type CompoundButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'contentContainer' | 'secondaryContent';
15
15
  export declare type CompoundButtonDefaultedProps = ButtonDefaultedProps | 'contentContainer' | 'secondaryContent';
16
- export interface CompoundButtonState extends ButtonState, ComponentStateCompat<CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundButtonDefaultedProps> {
17
- }
16
+ export declare type CompoundButtonState = ButtonState & ComponentStateCompat<CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundButtonDefaultedProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"CompoundButton.types.js","sourceRoot":"../src/","sources":["components/CompoundButton/CompoundButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\nimport type {\n ButtonDefaultedProps,\n ButtonProps,\n ButtonShorthandPropsCompat,\n ButtonState,\n} from '../Button/Button.types';\n\nexport interface CompoundButtonProps extends ButtonProps {\n /**\n * Second line of text that describes the action this button takes.\n */\n secondaryContent?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n\n /**\n * Container that wraps the children and secondaryContent slots.\n */\n contentContainer?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport type CompoundButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'contentContainer' | 'secondaryContent';\n\nexport type CompoundButtonDefaultedProps = ButtonDefaultedProps | 'contentContainer' | 'secondaryContent';\n\nexport interface CompoundButtonState\n extends ButtonState,\n ComponentStateCompat<CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundButtonDefaultedProps> {}\n"]}
1
+ {"version":3,"file":"CompoundButton.types.js","sourceRoot":"../src/","sources":["components/CompoundButton/CompoundButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\nimport type {\n ButtonDefaultedProps,\n ButtonProps,\n ButtonShorthandPropsCompat,\n ButtonState,\n} from '../Button/Button.types';\n\nexport type CompoundButtonProps = ButtonProps & {\n /**\n * Second line of text that describes the action this button takes.\n */\n secondaryContent?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n\n /**\n * Container that wraps the children and secondaryContent slots.\n */\n contentContainer?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n};\n\nexport type CompoundButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'contentContainer' | 'secondaryContent';\n\nexport type CompoundButtonDefaultedProps = ButtonDefaultedProps | 'contentContainer' | 'secondaryContent';\n\nexport type CompoundButtonState = ButtonState &\n ComponentStateCompat<CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundButtonDefaultedProps>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,kCAAT,QAAmD,qBAAnD;AAGA;;AAEG;;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,kCAAR,CAArC;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,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EAEG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAF/B,EAGG,CAAC,QAAD,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,QADH,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAJJ,EASG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAT/B,CADF;AAaD,CAjBM","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,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,kCAAT,QAAmD,qBAAnD;AAGA;;AAEG;;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,kCAAR,CAArC;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,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,QADH,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAHJ,EAQG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAR/B,CADF;AAYD,CAhBM","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;
@@ -9,7 +9,9 @@ var mergeProps = /*#__PURE__*/makeMergeProps({
9
9
  deepMerge: compoundButtonShorthandPropsCompat
10
10
  });
11
11
  /**
12
- * Given user props, returns the final state for a CompoundButton.
12
+ * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
13
+ * @param props - User provided props to the CompoundButton component.
14
+ * @param ref - User provided ref to be passed to the CompoundButton component.
13
15
  */
14
16
 
15
17
  export var useCompoundButton = function (props, ref, defaultProps) {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,cAAT,QAA+B,0BAA/B;AAOA;;AAEG;;AACH,OAAO,IAAM,kCAAkC,GAAyC,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAAjF;AAMP,IAAM,UAAU,gBAAG,cAAc,CAAsB;AACrD,EAAA,SAAS,EAAE;AAD0C,CAAtB,CAAjC;AAIA;;AAEG;;AACH,OAAO,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,qBAAqB,CAAC,YAAD,EAAe,kCAAf,CAbf,EActB,qBAAqB,CAAC,KAAD,EAAQ,kCAAR,CAdC,CAAxB;AAiBA,EAAA,cAAc,CAAC,KAAD,CAAd;AAEA,SAAO,KAAP;AACD,CAzBM","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,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,cAAT,QAA+B,0BAA/B;AAOA;;AAEG;;AACH,OAAO,IAAM,kCAAkC,GAAyC,CACtF,kBADsF,EAEtF,MAFsF,EAGtF,kBAHsF,CAAjF;AAMP,IAAM,UAAU,gBAAG,cAAc,CAAsB;AACrD,EAAA,SAAS,EAAE;AAD0C,CAAtB,CAAjC;AAIA;;;;AAIG;;AACH,OAAO,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,qBAAqB,CAAC,YAAD,EAAe,kCAAf,CAbf,EActB,qBAAqB,CAAC,KAAD,EAAQ,kCAAR,CAdC,CAAxB;AAiBA,EAAA,cAAc,CAAC,KAAD,CAAd;AAEA,SAAO,KAAP;AACD,CAzBM","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,4 +1,4 @@
1
- import { mergeClasses, __styles } from '@fluentui/react-make-styles';
1
+ import { __styles, mergeClasses } from '@fluentui/react-make-styles';
2
2
  import { buttonSpacing, useButtonStyles } from '../Button/useButtonStyles';
3
3
  var CompoundButtonClassNames = {
4
4
  secondaryContent: 'CompoundButton-secondaryContent'
@@ -1 +1 @@
1
- {"version":3,"sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AACA,SAAS,aAAT,EAAwB,eAAxB,QAA+C,2BAA/C;AAGA,IAAM,wBAAwB,GAAG;AAC/B,EAAA,gBAAgB,EAAE;AADa,CAAjC;;AAIA,IAAM,aAAa,gBAAG;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;AAA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K,CAAC,IAAP,CAPR,EAQ5B,KAAK,CAAC,SARsB,CAA9B;AAWA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,KAAK,CAAC,IAAN,CAAW,SAA7B,CAAnC;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAAC,sBAAsB,CAAC,IAAxB,EAA8B,KAAK,CAAC,gBAAN,CAAuB,SAArD,CAA/C;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,wBAAwB,CAAC,gBADoB,EAE7C,sBAAsB,CAAC,IAFsB,EAG7C,sBAAsB,CAAC,KAAK,CAAC,IAAP,CAHuB,EAI7C,KAAK,CAAC,gBAAN,CAAuB,SAJsB,CAA/C;AAOA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CAhCM","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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U,GAAG,aAAa,EAAhC;AACA,MAAM,sBAAsB,GAAG,yBAAyB,EAAxD;AACA,MAAM,sBAAsB,GAAG,yBAAyB,EAAxD;AAEA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,UAAU,CAAC,IADiB,EAE5B,UAAU,CAAC,KAAK,CAAC,IAAP,CAFkB,EAG5B,KAAK,CAAC,OAAN,IAAiB,UAAU,CAAC,OAHA,EAI5B,KAAK,CAAC,MAAN,IAAgB,UAAU,CAAC,MAJC,EAK5B,KAAK,CAAC,WAAN,IAAqB,UAAU,CAAC,WALJ,EAM5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN9B,EAO5B,KAAK,CAAC,QAAN,IAAkB,kBAAkB,CAAC,KAAK,CAAC,IAAP,CAPR,EAQ5B,KAAK,CAAC,SARsB,CAA9B;AAWA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,KAAK,CAAC,IAAN,CAAW,SAA7B,CAAnC;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAAC,sBAAsB,CAAC,IAAxB,EAA8B,KAAK,CAAC,gBAAN,CAAuB,SAArD,CAA/C;AAEA,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,wBAAwB,CAAC,gBADoB,EAE7C,sBAAsB,CAAC,IAFsB,EAG7C,sBAAsB,CAAC,KAAK,CAAC,IAAP,CAHuB,EAI7C,KAAK,CAAC,gBAAN,CAAuB,SAJsB,CAA/C;AAOA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CAhCM","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
  */
@@ -10,5 +10,4 @@ export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partia
10
10
  };
11
11
  export declare type MenuButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'menuIcon';
12
12
  export declare type MenuButtonDefaultedProps = ButtonDefaultedProps | 'menuIcon';
13
- export interface MenuButtonState extends Omit<ButtonState, 'iconPosition'>, ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps> {
14
- }
13
+ export declare type MenuButtonState = Omit<ButtonState, 'iconPosition'> & ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.types.js","sourceRoot":"../src/","sources":["components/MenuButton/MenuButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { MenuTriggerChildProps } from '@fluentui/react-menu';\nimport type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\nimport type {\n ButtonDefaultedProps,\n ButtonProps,\n ButtonShorthandPropsCompat,\n ButtonState,\n} from '../Button/Button.types';\n\nexport type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> &\n Partial<MenuTriggerChildProps> & {\n /**\n * Menu icon that indicates that this button has a menu that can be expanded.\n */\n menuIcon?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n };\n\nexport type MenuButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'menuIcon';\n\nexport type MenuButtonDefaultedProps = ButtonDefaultedProps | 'menuIcon';\n\nexport interface MenuButtonState\n extends Omit<ButtonState, 'iconPosition'>,\n ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps> {}\n"]}
1
+ {"version":3,"file":"MenuButton.types.js","sourceRoot":"../src/","sources":["components/MenuButton/MenuButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { MenuTriggerChildProps } from '@fluentui/react-menu';\nimport type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\nimport type {\n ButtonDefaultedProps,\n ButtonProps,\n ButtonShorthandPropsCompat,\n ButtonState,\n} from '../Button/Button.types';\n\nexport type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> &\n Partial<Omit<MenuTriggerChildProps, 'ref'>> & {\n /**\n * Menu icon that indicates that this button has a menu that can be expanded.\n */\n menuIcon?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n };\n\nexport type MenuButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'menuIcon';\n\nexport type MenuButtonDefaultedProps = ButtonDefaultedProps | 'menuIcon';\n\nexport type MenuButtonState = Omit<ButtonState, 'iconPosition'> &\n ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps>;\n"]}
@@ -12,7 +12,8 @@ export var renderMenuButton = function (state) {
12
12
  slotProps = _a.slotProps;
13
13
 
14
14
  var children = state.children,
15
+ icon = state.icon,
15
16
  iconOnly = state.iconOnly;
16
- return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), /*#__PURE__*/React.createElement(slots.icon, __assign({}, slotProps.icon)), !iconOnly && children, !iconOnly && /*#__PURE__*/React.createElement(slots.menuIcon, __assign({}, slotProps.menuIcon)));
17
+ return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), /*#__PURE__*/React.createElement(slots.icon, __assign({}, slotProps.icon)), !iconOnly && children, (!iconOnly || !icon.children) && /*#__PURE__*/React.createElement(slots.menuIcon, __assign({}, slotProps.menuIcon)));
17
18
  };
18
19
  //# sourceMappingURL=renderMenuButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,8BAAT,QAA+C,iBAA/C;AAGA;;AAEG;;AACH,OAAO,IAAM,gBAAgB,GAAG,UAAC,KAAD,EAAuB;AAC/C,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,8BAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAAe,KAAK,CAApB,QAAR;AAAA,MAAU,QAAQ,GAAK,KAAK,CAAV,QAAlB;AAER,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,CAAC,QAAD,iBAAa,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAHhB,CADF;AAOD,CAXM","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { menuButtonShorthandPropsCompat } from './useMenuButton';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, menuButtonShorthandPropsCompat);\n const { children, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.icon {...slotProps.icon} />\n {!iconOnly && children}\n {!iconOnly && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,8BAAT,QAA+C,iBAA/C;AAGA;;AAEG;;AACH,OAAO,IAAM,gBAAgB,GAAG,UAAC,KAAD,EAAuB;AAC/C,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,8BAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAAqB,KAAK,CAA1B,QAAR;AAAA,MAAU,IAAI,GAAe,KAAK,CAApB,IAAd;AAAA,MAAgB,QAAQ,GAAK,KAAK,CAAV,QAAxB;AAER,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,CAAC,CAAC,QAAD,IAAa,CAAC,IAAI,CAAC,QAApB,kBAAiC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAHpC,CADF;AAOD,CAXM","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { menuButtonShorthandPropsCompat } from './useMenuButton';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, menuButtonShorthandPropsCompat);\n const { children, icon, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.icon {...slotProps.icon} />\n {!iconOnly && children}\n {(!iconOnly || !icon.children) && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -5,6 +5,8 @@ import type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState }
5
5
  */
6
6
  export declare const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[];
7
7
  /**
8
- * Given user props, returns the final state for a MenuButton.
8
+ * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
9
+ * @param props - User provided props to the MenuButton component.
10
+ * @param ref - User provided ref to be passed to the MenuButton component.
9
11
  */
10
12
  export declare const useMenuButton: (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps | undefined) => MenuButtonState;
@@ -9,12 +9,12 @@ var mergeProps = /*#__PURE__*/makeMergeProps({
9
9
  deepMerge: menuButtonShorthandPropsCompat
10
10
  });
11
11
  /**
12
- * Given user props, returns the final state for a MenuButton.
12
+ * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
13
+ * @param props - User provided props to the MenuButton component.
14
+ * @param ref - User provided ref to be passed to the MenuButton component.
13
15
  */
14
16
 
15
17
  export var useMenuButton = function (props, ref, defaultProps) {
16
- // Note: because menu button's template and slots are different, we can't reuse
17
- // those, but the useMenuButtonState hook can reuse useButtonState.
18
18
  var state = mergeProps({
19
19
  ref: ref,
20
20
  as: 'button',
@@ -1 +1 @@
1
- {"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,kBAAT,QAAmC,sBAAnC;AAGA;;AAEG;;AACH,OAAO,IAAM,8BAA8B,GAAqC,CAAC,MAAD,EAAS,UAAT,CAAzE;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAkB;AAAE,EAAA,SAAS,EAAE;AAAb,CAAlB,CAAjC;AAEA;;AAEG;;AACH,OAAO,IAAM,aAAa,GAAG,UAAC,KAAD,EAAyB,GAAzB,EAAsD,YAAtD,EAAoF;AAC/G;AACA;AACA,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,QAAQ,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KANZ;AAOE;AACA,IAAA,IAAI,EAAE,QARR;AASE,IAAA,IAAI,EAAE;AATR,GADsB,EAYtB,YAAY,IAAI,qBAAqB,CAAC,YAAD,EAAe,8BAAf,CAZf,EAatB,qBAAqB,CAAC,KAAD,EAAQ,8BAAR,CAbC,CAAxB;AAgBA,EAAA,kBAAkB,CAAC,KAAD,CAAlB;AAEA,SAAO,KAAP;AACD,CAtBM","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useMenuButtonState } from './useMenuButtonState';\nimport type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState } from './MenuButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[] = ['icon', 'menuIcon'];\n\nconst mergeProps = makeMergeProps<MenuButtonState>({ deepMerge: menuButtonShorthandPropsCompat });\n\n/**\n * Given user props, returns the final state for a MenuButton.\n */\nexport const useMenuButton = (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps) => {\n // Note: because menu button's template and slots are different, we can't reuse\n // those, but the useMenuButtonState hook can reuse useButtonState.\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Button slots\n icon: { as: 'span' },\n // MenuButton slots\n menuIcon: { 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, menuButtonShorthandPropsCompat),\n resolveShorthandProps(props, menuButtonShorthandPropsCompat),\n ) as MenuButtonState;\n\n useMenuButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,kBAAT,QAAmC,sBAAnC;AAGA;;AAEG;;AACH,OAAO,IAAM,8BAA8B,GAAqC,CAAC,MAAD,EAAS,UAAT,CAAzE;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAkB;AAAE,EAAA,SAAS,EAAE;AAAb,CAAlB,CAAjC;AAEA;;;;AAIG;;AACH,OAAO,IAAM,aAAa,GAAG,UAAC,KAAD,EAAyB,GAAzB,EAAsD,YAAtD,EAAoF;AAC/G,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,QAAQ,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KANZ;AAOE;AACA,IAAA,IAAI,EAAE,QARR;AASE,IAAA,IAAI,EAAE;AATR,GADsB,EAYtB,YAAY,IAAI,qBAAqB,CAAC,YAAD,EAAe,8BAAf,CAZf,EAatB,qBAAqB,CAAC,KAAD,EAAQ,8BAAR,CAbC,CAAxB;AAgBA,EAAA,kBAAkB,CAAC,KAAD,CAAlB;AAEA,SAAO,KAAP;AACD,CApBM","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useMenuButtonState } from './useMenuButtonState';\nimport type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState } from './MenuButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[] = ['icon', 'menuIcon'];\n\nconst mergeProps = makeMergeProps<MenuButtonState>({ deepMerge: menuButtonShorthandPropsCompat });\n\n/**\n * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the MenuButton component.\n * @param ref - User provided ref to be passed to the MenuButton component.\n */\nexport const useMenuButton = (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps) => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Button slots\n icon: { as: 'span' },\n // MenuButton slots\n menuIcon: { 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, menuButtonShorthandPropsCompat),\n resolveShorthandProps(props, menuButtonShorthandPropsCompat),\n );\n\n useMenuButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,2 +1,7 @@
1
1
  import type { MenuButtonState } from './MenuButton.types';
2
+ /**
3
+ * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
4
+ * additional MenuButton specific processing.
5
+ * @param state - MenuButtonButton state to mutate.
6
+ */
2
7
  export declare const useMenuButtonState: (state: MenuButtonState) => MenuButtonState;
@@ -1,11 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';
3
3
  import { useButtonState } from '../Button/useButtonState';
4
+ /**
5
+ * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
6
+ * additional MenuButton specific processing.
7
+ * @param state - MenuButtonButton state to mutate.
8
+ */
9
+
4
10
  export var useMenuButtonState = function (state) {
5
11
  // It behaves like a button.
6
12
  useButtonState(state);
7
- var menuIcon = state.menuIcon,
13
+ var children = state.children,
14
+ menuIcon = state.menuIcon,
8
15
  size = state.size;
16
+ state.iconOnly = !children;
9
17
 
10
18
  if (!menuIcon.children) {
11
19
  if (size === 'large') {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,oBAA/B,QAA2D,uBAA3D;AACA,SAAS,cAAT,QAA+B,0BAA/B;AAGA,OAAO,IAAM,kBAAkB,GAAG,UAAC,KAAD,EAAuB;AACvD;AACA,EAAA,cAAc,CAAC,KAAD,CAAd;AAEQ,MAAA,QAAQ,GAAW,KAAK,CAAhB,QAAR;AAAA,MAAU,IAAI,GAAK,KAAK,CAAV,IAAd;;AACR,MAAI,CAAC,QAAQ,CAAC,QAAd,EAAwB;AACtB,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,QAAQ,CAAC,QAAT,gBAAoB,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB,CAApB;AACD,KAFD,MAEO;AACL,MAAA,QAAQ,CAAC,QAAT,gBAAoB,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB,CAApB;AACD;AACF;;AAED,SAAO,KAAP;AACD,CAdM","sourcesContent":["import * as React from 'react';\nimport { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';\nimport { useButtonState } from '../Button/useButtonState';\nimport type { MenuButtonState } from './MenuButton.types';\n\nexport const useMenuButtonState = (state: MenuButtonState): MenuButtonState => {\n // It behaves like a button.\n useButtonState(state);\n\n const { menuIcon, size } = state;\n if (!menuIcon.children) {\n if (size === 'large') {\n menuIcon.children = <ChevronDown24Regular />;\n } else {\n menuIcon.children = <ChevronDown20Regular />;\n }\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,oBAA/B,QAA2D,uBAA3D;AACA,SAAS,cAAT,QAA+B,0BAA/B;AAGA;;;;AAIG;;AACH,OAAO,IAAM,kBAAkB,GAAG,UAAC,KAAD,EAAuB;AACvD;AACA,EAAA,cAAc,CAAC,KAAD,CAAd;AAEQ,MAAA,QAAQ,GAAqB,KAAK,CAA1B,QAAR;AAAA,MAAU,QAAQ,GAAW,KAAK,CAAhB,QAAlB;AAAA,MAAoB,IAAI,GAAK,KAAK,CAAV,IAAxB;AACR,EAAA,KAAK,CAAC,QAAN,GAAiB,CAAC,QAAlB;;AACA,MAAI,CAAC,QAAQ,CAAC,QAAd,EAAwB;AACtB,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,QAAQ,CAAC,QAAT,gBAAoB,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB,CAApB;AACD,KAFD,MAEO;AACL,MAAA,QAAQ,CAAC,QAAT,gBAAoB,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB,CAApB;AACD;AACF;;AAED,SAAO,KAAP;AACD,CAfM","sourcesContent":["import * as React from 'react';\nimport { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';\nimport { useButtonState } from '../Button/useButtonState';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any\n * additional MenuButton specific processing.\n * @param state - MenuButtonButton state to mutate.\n */\nexport const useMenuButtonState = (state: MenuButtonState): MenuButtonState => {\n // It behaves like a button.\n useButtonState(state);\n\n const { children, menuIcon, size } = state;\n state.iconOnly = !children;\n if (!menuIcon.children) {\n if (size === 'large') {\n menuIcon.children = <ChevronDown24Regular />;\n } else {\n menuIcon.children = <ChevronDown20Regular />;\n }\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,4 @@
1
- import { mergeClasses, __styles } from '@fluentui/react-make-styles';
1
+ import { __styles, mergeClasses } from '@fluentui/react-make-styles';
2
2
  import { useButtonStyles } from '../Button/useButtonStyles';
3
3
 
4
4
  var useMenuIconStyles = /*#__PURE__*/__styles({
@@ -1 +1 @@
1
- {"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AACA,SAAS,eAAT,QAAgC,2BAAhC;;AAGA,IAAM,iBAAiB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBA,OAAO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,IAAP,CAAf,EAA6B,KAAK,CAAC,QAAN,CAAe,SAA5C,CAAvC;AAEA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CARM","sourcesContent":["import { mergeClasses, makeStyles } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { MenuButtonState } from './MenuButton.types';\n\nconst useMenuIconStyles = makeStyles({\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 useMenuButtonStyles = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,eAAT,QAAgC,2BAAhC;;AAGA,IAAM,iBAAiB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBA,OAAO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,IAAP,CAAf,EAA6B,KAAK,CAAC,QAAN,CAAe,SAA5C,CAAvC;AAEA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CARM","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { MenuButtonState } from './MenuButton.types';\n\nconst useMenuIconStyles = makeStyles({\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 useMenuButtonStyles = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import type { SplitButtonProps } from './SplitButton.types';
3
+ /**
4
+ * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
5
+ * action, while interacting with the second one opens a menu with secondary actions.
6
+ */
7
+ export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { Button } from '../Button/index';
3
+ import { MenuButton } from '../MenuButton/index';
4
+ import { renderSplitButton } from './renderSplitButton';
5
+ import { useSplitButton } from './useSplitButton';
6
+ import { useSplitButtonStyles } from './useSplitButtonStyles';
7
+ /**
8
+ * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
9
+ * action, while interacting with the second one opens a menu with secondary actions.
10
+ */
11
+
12
+ export var SplitButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
+ var state = useSplitButton(props, ref, {
14
+ button: {
15
+ as: Button
16
+ },
17
+ menuButton: {
18
+ as: MenuButton
19
+ }
20
+ });
21
+ useSplitButtonStyles(state);
22
+ return renderSplitButton(state);
23
+ });
24
+ SplitButton.displayName = 'SplitButton';
25
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,iBAAvB;AACA,SAAS,UAAT,QAA2B,qBAA3B;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,oBAAT,QAAqC,wBAArC;AAGA;;;AAGG;;AACH,OAAO,IAAM,WAAW,gBAAG,KAAK,CAAC,UAAN,CAAgD,UAAC,KAAD,EAAQ,GAAR,EAAW;AACpF,MAAM,KAAK,GAAG,cAAc,CAAC,KAAD,EAAQ,GAAR,EAAa;AACvC,IAAA,MAAM,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAD+B;AAEvC,IAAA,UAAU,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN;AAF2B,GAAb,CAA5B;AAKA,EAAA,oBAAoB,CAAC,KAAD,CAApB;AAEA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CAT0B,CAApB;AAWP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/index';\nimport { MenuButton } from '../MenuButton/index';\nimport { renderSplitButton } from './renderSplitButton';\nimport { useSplitButton } from './useSplitButton';\nimport { useSplitButtonStyles } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton = React.forwardRef<HTMLElement, SplitButtonProps>((props, ref) => {\n const state = useSplitButton(props, ref, {\n button: { as: Button },\n menuButton: { as: MenuButton },\n });\n\n useSplitButtonStyles(state);\n\n return renderSplitButton(state);\n});\n\nSplitButton.displayName = 'SplitButton';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
3
+ import type { ButtonProps, ButtonShorthandPropsCompat } from '../Button/Button.types';
4
+ import type { MenuButtonProps } from '../MenuButton/MenuButton.types';
5
+ export interface SplitButtonProps extends Omit<ButtonProps, ButtonShorthandPropsCompat>, MenuButtonProps {
6
+ /**
7
+ * Button to perform primary action in SplitButton.
8
+ */
9
+ button?: ShorthandPropsCompat<ButtonProps>;
10
+ /**
11
+ * Button that opens menu with secondary actions in SplitButton.
12
+ */
13
+ menuButton?: ShorthandPropsCompat<MenuButtonProps>;
14
+ /**
15
+ * Ref to the Button element.
16
+ */
17
+ buttonRef?: React.Ref<HTMLElement>;
18
+ /**
19
+ * Ref to the MenuButton element.
20
+ */
21
+ menuButtonRef?: React.Ref<HTMLElement>;
22
+ }
23
+ export declare type SplitButtonShorthandPropsCompat = 'button' | 'menuButton';
24
+ export declare type SplitButtonDefaultedProps = 'size';
25
+ export interface SplitButtonState extends ComponentStateCompat<SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonDefaultedProps> {
26
+ /**
27
+ * Ref to the root element
28
+ */
29
+ ref: React.Ref<HTMLElement>;
30
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SplitButton.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitButton.types.js","sourceRoot":"../src/","sources":["components/SplitButton/SplitButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonShorthandPropsCompat } from '../Button/Button.types';\nimport type { MenuButtonProps } from '../MenuButton/MenuButton.types';\n\nexport interface SplitButtonProps extends Omit<ButtonProps, ButtonShorthandPropsCompat>, MenuButtonProps {\n /**\n * Button to perform primary action in SplitButton.\n */\n button?: ShorthandPropsCompat<ButtonProps>;\n\n /**\n * Button that opens menu with secondary actions in SplitButton.\n */\n menuButton?: ShorthandPropsCompat<MenuButtonProps>;\n\n /**\n * Ref to the Button element.\n */\n buttonRef?: React.Ref<HTMLElement>;\n\n /**\n * Ref to the MenuButton element.\n */\n menuButtonRef?: React.Ref<HTMLElement>;\n}\n\nexport type SplitButtonShorthandPropsCompat = 'button' | 'menuButton';\n\nexport type SplitButtonDefaultedProps = 'size';\n\nexport interface SplitButtonState\n extends ComponentStateCompat<SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonDefaultedProps> {\n /**\n * Ref to the root element\n */\n ref: React.Ref<HTMLElement>;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './SplitButton';
2
+ export * from './SplitButton.types';
3
+ export * from './renderSplitButton';
4
+ export * from './useSplitButton';
5
+ export { useSplitButtonStyles } from './useSplitButtonStyles';
@@ -0,0 +1,6 @@
1
+ export * from './SplitButton';
2
+ export * from './SplitButton.types';
3
+ export * from './renderSplitButton';
4
+ export * from './useSplitButton';
5
+ export { useSplitButtonStyles } from './useSplitButtonStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/SplitButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { useSplitButtonStyles } from './useSplitButtonStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { SplitButtonState } from './SplitButton.types';
2
+ /**
3
+ * Renders a SplitButton component by passing the state defined props to the appropriate slots.
4
+ */
5
+ export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { __assign } from "tslib";
2
+ import * as React from 'react';
3
+ import { getSlotsCompat } from '@fluentui/react-utilities';
4
+ import { splitButtonShorthandProps } from './useSplitButton';
5
+ /**
6
+ * Renders a SplitButton component by passing the state defined props to the appropriate slots.
7
+ */
8
+
9
+ export var renderSplitButton = function (state) {
10
+ var _a = getSlotsCompat(state, splitButtonShorthandProps),
11
+ slots = _a.slots,
12
+ slotProps = _a.slotProps;
13
+
14
+ return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), /*#__PURE__*/React.createElement(slots.button, __assign({}, slotProps.button)), /*#__PURE__*/React.createElement(slots.menuButton, __assign({}, slotProps.menuButton)));
15
+ };
16
+ //# sourceMappingURL=renderSplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,yBAAT,QAA0C,kBAA1C;AAGA;;AAEG;;AACH,OAAO,IAAM,iBAAiB,GAAG,UAAC,KAAD,EAAwB;AACjD,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,yBAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,MAAf,CAAb,CADF,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,UAAf,CAAjB,CAFF,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { splitButtonShorthandProps } from './useSplitButton';\nimport type { SplitButtonState } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, splitButtonShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.button {...slotProps.button} />\n <slots.menuButton {...slotProps.menuButton} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';
3
+ export declare const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[];
4
+ /**
5
+ * Given user props, defines default props for the SplitButton and returns processed state.
6
+ * @param props - User provided props to the SplitButton component.
7
+ * @param ref - User provided ref to be passed to the SplitButton component.
8
+ */
9
+ export declare const useSplitButton: (props: SplitButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: SplitButtonProps | undefined) => SplitButtonState;
@@ -0,0 +1,72 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';
3
+ export var splitButtonShorthandProps = ['button', 'menuButton'];
4
+ var mergeProps = /*#__PURE__*/makeMergeProps({
5
+ deepMerge: splitButtonShorthandProps
6
+ });
7
+ /**
8
+ * Given user props, defines default props for the SplitButton and returns processed state.
9
+ * @param props - User provided props to the SplitButton component.
10
+ * @param ref - User provided ref to be passed to the SplitButton component.
11
+ */
12
+
13
+ export var useSplitButton = function (props, ref, defaultProps) {
14
+ var resolvedShorthandProps = resolveShorthandProps(props, splitButtonShorthandProps);
15
+ var className = props.className;
16
+
17
+ var button = resolvedShorthandProps.button,
18
+ buttonRef = resolvedShorthandProps.buttonRef,
19
+ circular = resolvedShorthandProps.circular,
20
+ disabled = resolvedShorthandProps.disabled,
21
+ disabledFocusable = resolvedShorthandProps.disabledFocusable,
22
+ menuButton = resolvedShorthandProps.menuButton,
23
+ menuButtonRef = resolvedShorthandProps.menuButtonRef,
24
+ outline = resolvedShorthandProps.outline,
25
+ primary = resolvedShorthandProps.primary,
26
+ _a = resolvedShorthandProps.size,
27
+ size = _a === void 0 ? 'medium' : _a,
28
+ subtle = resolvedShorthandProps.subtle,
29
+ transparent = resolvedShorthandProps.transparent,
30
+ userProps = __rest(resolvedShorthandProps, ["button", "buttonRef", "circular", "disabled", "disabledFocusable", "menuButton", "menuButtonRef", "outline", "primary", "size", "subtle", "transparent"]); // TODO: To be resolved when moving to simplified prop merging
31
+ // const buttonInternalRef = React.useRef<HTMLElement | null>(null);
32
+ // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);
33
+
34
+
35
+ var state = mergeProps({
36
+ 'aria-disabled': disabled,
37
+ as: 'div',
38
+ className: className,
39
+ ref: ref,
40
+ size: size,
41
+ button: __assign(__assign({
42
+ as: 'button',
43
+ // TODO: To be resolved when moving to simplified prop merging
44
+ // ref: useMergedRefs(buttonRef, buttonInternalRef),
45
+ circular: circular,
46
+ disabled: disabled,
47
+ disabledFocusable: disabledFocusable,
48
+ outline: outline,
49
+ primary: primary,
50
+ size: size,
51
+ subtle: subtle,
52
+ transparent: transparent
53
+ }, userProps), button),
54
+ menuButton: __assign({
55
+ as: 'button',
56
+ // TODO: To be resolved when moving to simplified prop merging
57
+ // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),
58
+ circular: circular,
59
+ disabled: disabled,
60
+ disabledFocusable: disabledFocusable,
61
+ outline: outline,
62
+ primary: primary,
63
+ size: size,
64
+ subtle: subtle,
65
+ transparent: transparent
66
+ }, menuButton)
67
+ }, // TODO: To be resolved when moving to simplified prop merging
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ defaultProps, resolvedShorthandProps);
70
+ return state;
71
+ };
72
+ //# sourceMappingURL=useSplitButton.js.map