@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,"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,"file":"renderCompoundButton.js","sourceRoot":"../src/","sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAA0B;QACvD,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,sDAAkC,CAAC,EAA9E,KAAK,WAAA,EAAE,SAAS,eAA8D,CAAC;QAC/E,IAAA,QAAQ,GAA6B,KAAK,SAAlC,EAAE,QAAQ,GAAmB,KAAK,SAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QAEnD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAE3B,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAC9D,CAAC,QAAQ,IAAI,CACZ,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB;gBACnD,QAAQ;gBACT,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB,EAAI,CACnC,CAC1B;YACA,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;IACJ,CAAC,CAAC;IAjBW,QAAA,oBAAoB,wBAiB/B","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"]}
1
+ {"version":3,"file":"renderCompoundButton.js","sourceRoot":"../src/","sources":["components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAA0B;QACvD,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,sDAAkC,CAAC,EAA9E,KAAK,WAAA,EAAE,SAAS,eAA8D,CAAC;QAC/E,IAAA,QAAQ,GAA6B,KAAK,SAAlC,EAAE,QAAQ,GAAmB,KAAK,SAAxB,EAAE,YAAY,GAAK,KAAK,aAAV,CAAW;QAEnD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAC9D,CAAC,QAAQ,IAAI,CACZ,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB;gBACnD,QAAQ;gBACT,oBAAC,KAAK,CAAC,gBAAgB,uBAAK,SAAS,CAAC,gBAAgB,EAAI,CACnC,CAC1B;YACA,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;IACJ,CAAC,CAAC;IAhBW,QAAA,oBAAoB,wBAgB/B","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"]}
@@ -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;
@@ -14,7 +14,9 @@ define(["require", "exports", "@fluentui/react-utilities", "../Button/useButtonS
14
14
  deepMerge: exports.compoundButtonShorthandPropsCompat,
15
15
  });
16
16
  /**
17
- * Given user props, returns the final state for a CompoundButton.
17
+ * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
18
+ * @param props - User provided props to the CompoundButton component.
19
+ * @param ref - User provided ref to be passed to the CompoundButton component.
18
20
  */
19
21
  var useCompoundButton = function (props, ref, defaultProps) {
20
22
  var state = mergeProps({
@@ -1 +1 @@
1
- {"version":3,"file":"useCompoundButton.js","sourceRoot":"../src/","sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;IASA;;OAEG;IACU,QAAA,kCAAkC,GAAyC;QACtF,kBAAkB;QAClB,MAAM;QACN,kBAAkB;KACnB,CAAC;IAEF,IAAM,UAAU,GAAG,gCAAc,CAAsB;QACrD,SAAS,EAAE,0CAAkC;KAC9C,CAAC,CAAC;IAEH;;OAEG;IACI,IAAM,iBAAiB,GAAG,UAC/B,KAA0B,EAC1B,GAA2B,EAC3B,YAAkC;QAElC,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,8BAA8B;YAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,oCAAoC;YACpC,gBAAgB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAChD,gBAAgB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YAChC,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,0CAAkC,CAAC,EACvF,uCAAqB,CAAC,KAAK,EAAE,0CAAkC,CAAC,CACjE,CAAC;QAEF,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAzBW,QAAA,iBAAiB,qBAyB5B","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"]}
1
+ {"version":3,"file":"useCompoundButton.js","sourceRoot":"../src/","sources":["components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":";;;;IASA;;OAEG;IACU,QAAA,kCAAkC,GAAyC;QACtF,kBAAkB;QAClB,MAAM;QACN,kBAAkB;KACnB,CAAC;IAEF,IAAM,UAAU,GAAG,gCAAc,CAAsB;QACrD,SAAS,EAAE,0CAAkC;KAC9C,CAAC,CAAC;IAEH;;;;OAIG;IACI,IAAM,iBAAiB,GAAG,UAC/B,KAA0B,EAC1B,GAA2B,EAC3B,YAAkC;QAElC,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,8BAA8B;YAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,oCAAoC;YACpC,gBAAgB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAChD,gBAAgB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YAChC,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,0CAAkC,CAAC,EACvF,uCAAqB,CAAC,KAAK,EAAE,0CAAkC,CAAC,CACjE,CAAC;QAEF,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAzBW,QAAA,iBAAiB,qBAyB5B","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useCompoundButtonStyles.js","sourceRoot":"../src/","sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,wBAAwB,GAAG;QAC/B,gBAAgB,EAAE,iCAAiC;KACpD,CAAC;IAEF,IAAM,aAAa,GAAG,8BAAU,CAAC;QAC/B,IAAI,EAAE,UAAA,KAAK;;YAAI,OAAA;oBACb,gEAAgE;oBAChE,GAAG,EAAE,+BAAa,CAAC,KAAK;oBAExB,MAAM,EAAE,MAAM;;gBAEd,GAAC,QAAM,wBAAwB,CAAC,gBAAkB,IAAG;oBACnD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;iBACpD;gBAED,YAAQ;oBACN,GAAC,QAAM,wBAAwB,CAAC,gBAAkB,IAAG;wBACnD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB;qBACzD;uBACF;gBAED,aAAS;oBACP,GAAC,QAAM,wBAAwB,CAAC,gBAAkB,IAAG;wBACnD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;qBAC3D;uBACF;mBACD;QArBa,CAqBb;QACF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACf,OAAO,EAAE,+BAAa,CAAC,MAAM;YAE7B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YAC/C,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;SACpD,CAAC,EALc,CAKd;QACF,MAAM,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAChB,OAAO,EAAE,+BAAa,CAAC,KAAK;YAE5B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAA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IAAI,EAC3B,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,EAClC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CACjC,CAAC;QAEF,iCAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhCW,QAAA,uBAAuB,2BAgClC","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"]}
1
+ {"version":3,"file":"useCompoundButtonStyles.js","sourceRoot":"../src/","sources":["components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,wBAAwB,GAAG;QAC/B,gBAAgB,EAAE,iCAAiC;KACpD,CAAC;IAEF,IAAM,aAAa,GAAG,8BAAU,CAAC;QAC/B,IAAI,EAAE,UAAA,KAAK;;YAAI,OAAA;oBACb,gEAAgE;oBAChE,GAAG,EAAE,+BAAa,CAAC,KAAK;oBAExB,MAAM,EAAE,MAAM;;gBAEd,GAAC,QAAM,wBAAwB,CAAC,gBAAkB,IAAG;oBACnD,KAAK,EAAE,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yB,EAAE,CAAC;QAE3D,KAAK,CAAC,SAAS,GAAG,gCAAY,CAC5B,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EACtB,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,EACnC,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,EACjC,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,EAC3C,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,UAAU,CAAC,QAAQ,EAClE,KAAK,CAAC,QAAQ,IAAI,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,EAChD,KAAK,CAAC,SAAS,CAChB,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,gCAAY,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3E,KAAK,CAAC,gBAAgB,CAAC,SAAS,GAAG,gCAAY,CAAC,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAE/G,KAAK,CAAC,gBAAgB,CAAC,SAAS,GAAG,gCAAY,CAC7C,wBAAwB,CAAC,gBAAgB,EACzC,sBAAsB,CAAC,IAAI,EAC3B,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,EAClC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CACjC,CAAC;QAEF,iCAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhCW,QAAA,uBAAuB,2BAgClC","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"]}
@@ -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"]}
@@ -7,11 +7,11 @@ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./
7
7
  */
8
8
  var renderMenuButton = function (state) {
9
9
  var _a = react_utilities_1.getSlotsCompat(state, useMenuButton_1.menuButtonShorthandPropsCompat), slots = _a.slots, slotProps = _a.slotProps;
10
- var children = state.children, iconOnly = state.iconOnly;
10
+ var children = state.children, icon = state.icon, iconOnly = state.iconOnly;
11
11
  return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
12
12
  React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
13
13
  !iconOnly && children,
14
- !iconOnly && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon))));
14
+ (!iconOnly || !icon.children) && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon))));
15
15
  };
16
16
  exports.renderMenuButton = renderMenuButton;
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"renderMenuButton.js","sourceRoot":"../src/","sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,gBAAgB,GAAG,UAAC,KAAsB;QAC/C,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,8CAA8B,CAAC,EAA1E,KAAK,WAAA,EAAE,SAAS,eAA0D,CAAC;QAC3E,IAAA,QAAQ,GAAe,KAAK,SAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;QAErC,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YACjC,CAAC,QAAQ,IAAI,QAAQ;YACrB,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CAC7C,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,gBAAgB,oBAW3B","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"]}
1
+ {"version":3,"file":"renderMenuButton.js","sourceRoot":"../src/","sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,gBAAgB,GAAG,UAAC,KAAsB;QAC/C,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,8CAA8B,CAAC,EAA1E,KAAK,WAAA,EAAE,SAAS,eAA0D,CAAC;QAC3E,IAAA,QAAQ,GAAqB,KAAK,SAA1B,EAAE,IAAI,GAAe,KAAK,KAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;QAE3C,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YACjC,CAAC,QAAQ,IAAI,QAAQ;YACrB,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CACjE,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,gBAAgB,oBAW3B","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"]}
@@ -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;
@@ -8,11 +8,11 @@ define(["require", "exports", "@fluentui/react-utilities", "./useMenuButtonState
8
8
  exports.menuButtonShorthandPropsCompat = ['icon', 'menuIcon'];
9
9
  var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.menuButtonShorthandPropsCompat });
10
10
  /**
11
- * Given user props, returns the final state for a MenuButton.
11
+ * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
12
+ * @param props - User provided props to the MenuButton component.
13
+ * @param ref - User provided ref to be passed to the MenuButton component.
12
14
  */
13
15
  var useMenuButton = function (props, ref, defaultProps) {
14
- // Note: because menu button's template and slots are different, we can't reuse
15
- // those, but the useMenuButtonState hook can reuse useButtonState.
16
16
  var state = mergeProps({
17
17
  ref: ref,
18
18
  as: 'button',
@@ -1 +1 @@
1
- {"version":3,"file":"useMenuButton.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,8BAA8B,GAAqC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAErG,IAAM,UAAU,GAAG,gCAAc,CAAkB,EAAE,SAAS,EAAE,sCAA8B,EAAE,CAAC,CAAC;IAElG;;OAEG;IACI,IAAM,aAAa,GAAG,UAAC,KAAsB,EAAE,GAA2B,EAAE,YAA8B;QAC/G,+EAA+E;QAC/E,mEAAmE;QACnE,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,eAAe;YACf,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,mBAAmB;YACnB,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACxB,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,sCAA8B,CAAC,EACnF,uCAAqB,CAAC,KAAK,EAAE,sCAA8B,CAAC,CAC1C,CAAC;QAErB,uCAAkB,CAAC,KAAK,CAAC,CAAC;QAE1B,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAtBW,QAAA,aAAa,iBAsBxB","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"]}
1
+ {"version":3,"file":"useMenuButton.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,8BAA8B,GAAqC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAErG,IAAM,UAAU,GAAG,gCAAc,CAAkB,EAAE,SAAS,EAAE,sCAA8B,EAAE,CAAC,CAAC;IAElG;;;;OAIG;IACI,IAAM,aAAa,GAAG,UAAC,KAAsB,EAAE,GAA2B,EAAE,YAA8B;QAC/G,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,eAAe;YACf,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,mBAAmB;YACnB,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACxB,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,sCAA8B,CAAC,EACnF,uCAAqB,CAAC,KAAK,EAAE,sCAA8B,CAAC,CAC7D,CAAC;QAEF,uCAAkB,CAAC,KAAK,CAAC,CAAC;QAE1B,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IApBW,QAAA,aAAa,iBAoBxB","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"]}
@@ -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;
@@ -2,10 +2,16 @@ define(["require", "exports", "react", "@fluentui/react-icons", "../Button/useBu
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useMenuButtonState = void 0;
5
+ /**
6
+ * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
7
+ * additional MenuButton specific processing.
8
+ * @param state - MenuButtonButton state to mutate.
9
+ */
5
10
  var useMenuButtonState = function (state) {
6
11
  // It behaves like a button.
7
12
  useButtonState_1.useButtonState(state);
8
- var menuIcon = state.menuIcon, size = state.size;
13
+ var children = state.children, menuIcon = state.menuIcon, size = state.size;
14
+ state.iconOnly = !children;
9
15
  if (!menuIcon.children) {
10
16
  if (size === 'large') {
11
17
  menuIcon.children = React.createElement(react_icons_1.ChevronDown24Regular, null);
@@ -1 +1 @@
1
- {"version":3,"file":"useMenuButtonState.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;IAKO,IAAM,kBAAkB,GAAG,UAAC,KAAsB;QACvD,4BAA4B;QAC5B,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEd,IAAA,QAAQ,GAAW,KAAK,SAAhB,EAAE,IAAI,GAAK,KAAK,KAAV,CAAW;QACjC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,IAAI,IAAI,KAAK,OAAO,EAAE;gBACpB,QAAQ,CAAC,QAAQ,GAAG,oBAAC,kCAAoB,OAAG,CAAC;aAC9C;iBAAM;gBACL,QAAQ,CAAC,QAAQ,GAAG,oBAAC,kCAAoB,OAAG,CAAC;aAC9C;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAdW,QAAA,kBAAkB,sBAc7B","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"]}
1
+ {"version":3,"file":"useMenuButtonState.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;IAKA;;;;OAIG;IACI,IAAM,kBAAkB,GAAG,UAAC,KAAsB;QACvD,4BAA4B;QAC5B,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEd,IAAA,QAAQ,GAAqB,KAAK,SAA1B,EAAE,QAAQ,GAAW,KAAK,SAAhB,EAAE,IAAI,GAAK,KAAK,KAAV,CAAW;QAC3C,KAAK,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,IAAI,IAAI,KAAK,OAAO,EAAE;gBACpB,QAAQ,CAAC,QAAQ,GAAG,oBAAC,kCAAoB,OAAG,CAAC;aAC9C;iBAAM;gBACL,QAAQ,CAAC,QAAQ,GAAG,oBAAC,kCAAoB,OAAG,CAAC;aAC9C;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAfW,QAAA,kBAAkB,sBAe7B","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useMenuButtonStyles.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,iBAAiB,GAAG,8BAAU,CAAC;QACnC,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;KACF,CAAC,CAAC;IAEI,IAAM,mBAAmB,GAAG,UAAC,KAAsB;QACxD,IAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;QAE3C,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,gCAAY,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAE9F,iCAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IARW,QAAA,mBAAmB,uBAQ9B","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"]}
1
+ {"version":3,"file":"useMenuButtonStyles.js","sourceRoot":"../src/","sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,iBAAiB,GAAG,8BAAU,CAAC;QACnC,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;QACD,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;SACd;KACF,CAAC,CAAC;IAEI,IAAM,mBAAmB,GAAG,UAAC,KAAsB;QACxD,IAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;QAE3C,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,gCAAY,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAE9F,iCAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IARW,QAAA,mBAAmB,uBAQ9B","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"]}
@@ -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,19 @@
1
+ define(["require", "exports", "react", "../Button/index", "../MenuButton/index", "./renderSplitButton", "./useSplitButton", "./useSplitButtonStyles"], function (require, exports, React, index_1, index_2, renderSplitButton_1, useSplitButton_1, useSplitButtonStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SplitButton = void 0;
5
+ /**
6
+ * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
7
+ * action, while interacting with the second one opens a menu with secondary actions.
8
+ */
9
+ exports.SplitButton = React.forwardRef(function (props, ref) {
10
+ var state = useSplitButton_1.useSplitButton(props, ref, {
11
+ button: { as: index_1.Button },
12
+ menuButton: { as: index_2.MenuButton },
13
+ });
14
+ useSplitButtonStyles_1.useSplitButtonStyles(state);
15
+ return renderSplitButton_1.renderSplitButton(state);
16
+ });
17
+ exports.SplitButton.displayName = 'SplitButton';
18
+ });
19
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitButton.js","sourceRoot":"../src/","sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;IAQA;;;OAGG;IACU,QAAA,WAAW,GAAG,KAAK,CAAC,UAAU,CAAgC,UAAC,KAAK,EAAE,GAAG;QACpF,IAAM,KAAK,GAAG,+BAAc,CAAC,KAAK,EAAE,GAAG,EAAE;YACvC,MAAM,EAAE,EAAE,EAAE,EAAE,cAAM,EAAE;YACtB,UAAU,EAAE,EAAE,EAAE,EAAE,kBAAU,EAAE;SAC/B,CAAC,CAAC;QAEH,2CAAoB,CAAC,KAAK,CAAC,CAAC;QAE5B,OAAO,qCAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","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"]}
@@ -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,5 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
5
+ //# 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,11 @@
1
+ define(["require", "exports", "tslib", "./SplitButton", "./SplitButton.types", "./renderSplitButton", "./useSplitButton", "./useSplitButtonStyles"], function (require, exports, tslib_1, SplitButton_1, SplitButton_types_1, renderSplitButton_1, useSplitButton_1, useSplitButtonStyles_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSplitButtonStyles = void 0;
5
+ tslib_1.__exportStar(SplitButton_1, exports);
6
+ tslib_1.__exportStar(SplitButton_types_1, exports);
7
+ tslib_1.__exportStar(renderSplitButton_1, exports);
8
+ tslib_1.__exportStar(useSplitButton_1, exports);
9
+ Object.defineProperty(exports, "useSplitButtonStyles", { enumerable: true, get: function () { return useSplitButtonStyles_1.useSplitButtonStyles; } });
10
+ });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/SplitButton/index.ts"],"names":[],"mappings":";;;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC;IACxB,4HAAA,oBAAoB,OAAA","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
+ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./useSplitButton"], function (require, exports, tslib_1, React, react_utilities_1, useSplitButton_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.renderSplitButton = void 0;
5
+ /**
6
+ * Renders a SplitButton component by passing the state defined props to the appropriate slots.
7
+ */
8
+ var renderSplitButton = function (state) {
9
+ var _a = react_utilities_1.getSlotsCompat(state, useSplitButton_1.splitButtonShorthandProps), slots = _a.slots, slotProps = _a.slotProps;
10
+ return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
11
+ React.createElement(slots.button, tslib_1.__assign({}, slotProps.button)),
12
+ React.createElement(slots.menuButton, tslib_1.__assign({}, slotProps.menuButton))));
13
+ };
14
+ exports.renderSplitButton = renderSplitButton;
15
+ });
16
+ //# sourceMappingURL=renderSplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderSplitButton.js","sourceRoot":"../src/","sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,iBAAiB,GAAG,UAAC,KAAuB;QACjD,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,0CAAyB,CAAC,EAArE,KAAK,WAAA,EAAE,SAAS,eAAqD,CAAC;QAE9E,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,KAAK,CAAC,MAAM,uBAAK,SAAS,CAAC,MAAM,EAAI;YACtC,oBAAC,KAAK,CAAC,UAAU,uBAAK,SAAS,CAAC,UAAU,EAAI,CACnC,CACd,CAAC;IACJ,CAAC,CAAC;IATW,QAAA,iBAAiB,qBAS5B","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"]}
@@ -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,55 @@
1
+ define(["require", "exports", "tslib", "@fluentui/react-utilities"], function (require, exports, tslib_1, react_utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSplitButton = exports.splitButtonShorthandProps = void 0;
5
+ exports.splitButtonShorthandProps = ['button', 'menuButton'];
6
+ var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.splitButtonShorthandProps });
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
+ var useSplitButton = function (props, ref, defaultProps) {
13
+ var resolvedShorthandProps = react_utilities_1.resolveShorthandProps(props, exports.splitButtonShorthandProps);
14
+ var className = props.className;
15
+ var button = resolvedShorthandProps.button, buttonRef = resolvedShorthandProps.buttonRef, circular = resolvedShorthandProps.circular, disabled = resolvedShorthandProps.disabled, disabledFocusable = resolvedShorthandProps.disabledFocusable, menuButton = resolvedShorthandProps.menuButton, menuButtonRef = resolvedShorthandProps.menuButtonRef, outline = resolvedShorthandProps.outline, primary = resolvedShorthandProps.primary, _a = resolvedShorthandProps.size, size = _a === void 0 ? 'medium' : _a, subtle = resolvedShorthandProps.subtle, transparent = resolvedShorthandProps.transparent, userProps = tslib_1.__rest(resolvedShorthandProps, ["button", "buttonRef", "circular", "disabled", "disabledFocusable", "menuButton", "menuButtonRef", "outline", "primary", "size", "subtle", "transparent"]);
16
+ // TODO: To be resolved when moving to simplified prop merging
17
+ // const buttonInternalRef = React.useRef<HTMLElement | null>(null);
18
+ // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);
19
+ var state = mergeProps({
20
+ 'aria-disabled': disabled,
21
+ as: 'div',
22
+ className: className,
23
+ ref: ref,
24
+ size: size,
25
+ button: tslib_1.__assign(tslib_1.__assign({ as: 'button',
26
+ // TODO: To be resolved when moving to simplified prop merging
27
+ // ref: useMergedRefs(buttonRef, buttonInternalRef),
28
+ circular: circular,
29
+ disabled: disabled,
30
+ disabledFocusable: disabledFocusable,
31
+ outline: outline,
32
+ primary: primary,
33
+ size: size,
34
+ subtle: subtle,
35
+ transparent: transparent }, userProps), button),
36
+ menuButton: tslib_1.__assign({ as: 'button',
37
+ // TODO: To be resolved when moving to simplified prop merging
38
+ // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),
39
+ circular: circular,
40
+ disabled: disabled,
41
+ disabledFocusable: disabledFocusable,
42
+ outline: outline,
43
+ primary: primary,
44
+ size: size,
45
+ subtle: subtle,
46
+ transparent: transparent }, menuButton),
47
+ },
48
+ // TODO: To be resolved when moving to simplified prop merging
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ defaultProps, resolvedShorthandProps);
51
+ return state;
52
+ };
53
+ exports.useSplitButton = useSplitButton;
54
+ });
55
+ //# sourceMappingURL=useSplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSplitButton.js","sourceRoot":"../src/","sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;IAIa,QAAA,yBAAyB,GAAsC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAErG,IAAM,UAAU,GAAG,gCAAc,CAAmB,EAAE,SAAS,EAAE,iCAAyB,EAAE,CAAC,CAAC;IAE9F;;;;OAIG;IACI,IAAM,cAAc,GAAG,UAC5B,KAAuB,EACvB,GAA2B,EAC3B,YAA+B;QAE/B,IAAM,sBAAsB,GAAG,uCAAqB,CAAC,KAAK,EAAE,iCAAyB,CAAC,CAAC;QAC/E,IAAA,SAAS,GAAK,KAAK,UAAV,CAAW;QAE1B,IAAA,MAAM,GAaJ,sBAAsB,OAblB,EACN,SAAS,GAYP,sBAAsB,UAZf,EACT,QAAQ,GAWN,sBAAsB,SAXhB,EACR,QAAQ,GAUN,sBAAsB,SAVhB,EACR,iBAAiB,GASf,sBAAsB,kBATP,EACjB,UAAU,GAQR,sBAAsB,WARd,EACV,aAAa,GAOX,sBAAsB,cAPX,EACb,OAAO,GAML,sBAAsB,QANjB,EACP,OAAO,GAKL,sBAAsB,QALjB,EACP,KAIE,sBAAsB,KAJT,EAAf,IAAI,mBAAG,QAAQ,KAAA,EACf,MAAM,GAGJ,sBAAsB,OAHlB,EACN,WAAW,GAET,sBAAsB,YAFb,EACR,SAAS,kBACV,sBAAsB,EAdpB,0JAcL,CADa,CACa;QAE3B,8DAA8D;QAC9D,oEAAoE;QACpE,wEAAwE;QAExE,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,eAAe,EAAE,QAAQ;YACzB,EAAE,EAAE,KAAK;YACT,SAAS,WAAA;YACT,GAAG,KAAA;YACH,IAAI,MAAA;YAEJ,MAAM,sCACJ,EAAE,EAAE,QAAQ;gBACZ,8DAA8D;gBAC9D,oDAAoD;gBACpD,QAAQ,UAAA;gBACR,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,OAAO,SAAA;gBACP,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,MAAM,QAAA;gBACN,WAAW,aAAA,IACR,SAAS,GACT,MAAM,CACV;YAED,UAAU,qBACR,EAAE,EAAE,QAAQ;gBACZ,8DAA8D;gBAC9D,4DAA4D;gBAC5D,QAAQ,UAAA;gBACR,QAAQ,UAAA;gBACR,iBAAiB,mBAAA;gBACjB,OAAO,SAAA;gBACP,OAAO,SAAA;gBACP,IAAI,MAAA;gBACJ,MAAM,QAAA;gBACN,WAAW,aAAA,IACR,UAAU,CACd;SACF;QACD,8DAA8D;QAC9D,8DAA8D;QAC9D,YAAmB,EACnB,sBAAsB,CACvB,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAzEW,QAAA,cAAc,kBAyEzB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[] = ['button', 'menuButton'];\n\nconst mergeProps = makeMergeProps<SplitButtonState>({ deepMerge: splitButtonShorthandProps });\n\n/**\n * Given user props, defines default props for the SplitButton and returns processed state.\n * @param props - User provided props to the SplitButton component.\n * @param ref - User provided ref to be passed to the SplitButton component.\n */\nexport const useSplitButton = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: SplitButtonProps,\n): SplitButtonState => {\n const resolvedShorthandProps = resolveShorthandProps(props, splitButtonShorthandProps);\n const { className } = props;\n const {\n button,\n buttonRef,\n circular,\n disabled,\n disabledFocusable,\n menuButton,\n menuButtonRef,\n outline,\n primary,\n size = 'medium',\n subtle,\n transparent,\n ...userProps\n } = resolvedShorthandProps;\n\n // TODO: To be resolved when moving to simplified prop merging\n // const buttonInternalRef = React.useRef<HTMLElement | null>(null);\n // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);\n\n const state = mergeProps(\n {\n 'aria-disabled': disabled,\n as: 'div',\n className,\n ref,\n size,\n\n button: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(buttonRef, buttonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...userProps,\n ...button,\n },\n\n menuButton: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...menuButton,\n },\n },\n // TODO: To be resolved when moving to simplified prop merging\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any,\n resolvedShorthandProps,\n );\n\n return state;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import type { SplitButtonState } from './SplitButton.types';
2
+ export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;