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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. package/CHANGELOG.json +87 -1
  2. package/CHANGELOG.md +41 -2
  3. package/dist/react-button.d.ts +73 -7
  4. package/lib/SplitButton.d.ts +1 -0
  5. package/lib/SplitButton.js +2 -0
  6. package/lib/SplitButton.js.map +1 -0
  7. package/lib/components/Button/renderButton.js.map +1 -1
  8. package/lib/components/Button/useButton.d.ts +3 -1
  9. package/lib/components/Button/useButton.js +3 -1
  10. package/lib/components/Button/useButton.js.map +1 -1
  11. package/lib/components/Button/useButtonState.d.ts +2 -2
  12. package/lib/components/Button/useButtonState.js +2 -2
  13. package/lib/components/Button/useButtonState.js.map +1 -1
  14. package/lib/components/Button/useButtonStyles.js.map +1 -1
  15. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  16. package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
  17. package/lib/components/CompoundButton/useCompoundButton.js +3 -1
  18. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  19. package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
  20. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.types.d.ts +1 -1
  22. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  23. package/lib/components/MenuButton/renderMenuButton.js +2 -1
  24. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
  26. package/lib/components/MenuButton/useMenuButton.js +3 -3
  27. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  28. package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
  29. package/lib/components/MenuButton/useMenuButtonState.js +9 -1
  30. package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
  31. package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
  32. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  33. package/lib/components/SplitButton/SplitButton.d.ts +7 -0
  34. package/lib/components/SplitButton/SplitButton.js +25 -0
  35. package/lib/components/SplitButton/SplitButton.js.map +1 -0
  36. package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
  37. package/lib/components/SplitButton/SplitButton.types.js +2 -0
  38. package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
  39. package/lib/components/SplitButton/index.d.ts +5 -0
  40. package/lib/components/SplitButton/index.js +6 -0
  41. package/lib/components/SplitButton/index.js.map +1 -0
  42. package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
  43. package/lib/components/SplitButton/renderSplitButton.js +16 -0
  44. package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
  45. package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
  46. package/lib/components/SplitButton/useSplitButton.js +72 -0
  47. package/lib/components/SplitButton/useSplitButton.js.map +1 -0
  48. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  49. package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
  50. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  51. package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
  52. package/lib/components/ToggleButton/useToggleButton.js +4 -1
  53. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  54. package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
  55. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  56. package/lib/index.d.ts +1 -0
  57. package/lib/index.js +1 -0
  58. package/lib/index.js.map +1 -1
  59. package/lib-amd/SplitButton.d.ts +1 -0
  60. package/lib-amd/SplitButton.js +6 -0
  61. package/lib-amd/SplitButton.js.map +1 -0
  62. package/lib-amd/components/Button/renderButton.js.map +1 -1
  63. package/lib-amd/components/Button/useButton.d.ts +3 -1
  64. package/lib-amd/components/Button/useButton.js +3 -1
  65. package/lib-amd/components/Button/useButton.js.map +1 -1
  66. package/lib-amd/components/Button/useButtonState.d.ts +2 -2
  67. package/lib-amd/components/Button/useButtonState.js +2 -2
  68. package/lib-amd/components/Button/useButtonState.js.map +1 -1
  69. package/lib-amd/components/Button/useButtonStyles.js +1 -0
  70. package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
  71. package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
  72. package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
  73. package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
  74. package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
  75. package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  76. package/lib-amd/components/MenuButton/MenuButton.types.d.ts +1 -1
  77. package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
  78. package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
  79. package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
  80. package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
  81. package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
  82. package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
  83. package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
  84. package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
  85. package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
  86. package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  87. package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
  88. package/lib-amd/components/SplitButton/SplitButton.js +19 -0
  89. package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
  90. package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
  91. package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
  92. package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
  93. package/lib-amd/components/SplitButton/index.d.ts +5 -0
  94. package/lib-amd/components/SplitButton/index.js +11 -0
  95. package/lib-amd/components/SplitButton/index.js.map +1 -0
  96. package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
  97. package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
  98. package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
  99. package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
  100. package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
  101. package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
  102. package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  103. package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
  104. package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  105. package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
  106. package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
  107. package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
  108. package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  109. package/lib-amd/index.d.ts +1 -0
  110. package/lib-amd/index.js +2 -1
  111. package/lib-amd/index.js.map +1 -1
  112. package/lib-commonjs/SplitButton.d.ts +1 -0
  113. package/lib-commonjs/SplitButton.js +10 -0
  114. package/lib-commonjs/SplitButton.js.map +1 -0
  115. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  116. package/lib-commonjs/components/Button/useButton.d.ts +3 -1
  117. package/lib-commonjs/components/Button/useButton.js +3 -1
  118. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  119. package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
  120. package/lib-commonjs/components/Button/useButtonState.js +2 -2
  121. package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
  122. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  123. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  124. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
  125. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
  126. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  127. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  128. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +1 -1
  129. package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
  130. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  131. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
  132. package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
  133. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  134. package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
  135. package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
  136. package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
  137. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  138. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
  139. package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
  140. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
  141. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
  142. package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
  143. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
  144. package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
  145. package/lib-commonjs/components/SplitButton/index.js +26 -0
  146. package/lib-commonjs/components/SplitButton/index.js.map +1 -0
  147. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
  148. package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
  149. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
  150. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
  151. package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
  152. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
  153. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  154. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
  155. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  156. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
  157. package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
  158. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  159. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  160. package/lib-commonjs/index.d.ts +1 -0
  161. package/lib-commonjs/index.js +2 -0
  162. package/lib-commonjs/index.js.map +1 -1
  163. package/package.json +10 -10
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AAGA,OAAO,IAAM,yBAAyB,GAAsC,CAAC,QAAD,EAAW,YAAX,CAArE;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAmB;AAAE,EAAA,SAAS,EAAE;AAAb,CAAnB,CAAjC;AAEA;;;;AAIG;;AACH,OAAO,IAAM,cAAc,GAAG,UAC5B,KAD4B,EAE5B,GAF4B,EAG5B,YAH4B,EAGG;AAE/B,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,KAAD,EAAQ,yBAAR,CAApD;AACQ,MAAA,SAAS,GAAK,KAAK,CAAV,SAAT;;AAEN,MAAA,MAAM,GAaJ,sBAAsB,CAblB,MAAN;AAAA,MACA,SAAS,GAYP,sBAAsB,CAZf,SADT;AAAA,MAEA,QAAQ,GAWN,sBAAsB,CAXhB,QAFR;AAAA,MAGA,QAAQ,GAUN,sBAAsB,CAVhB,QAHR;AAAA,MAIA,iBAAiB,GASf,sBAAsB,CATP,iBAJjB;AAAA,MAKA,UAAU,GAQR,sBAAsB,CARd,UALV;AAAA,MAMA,aAAa,GAOX,sBAAsB,CAPX,aANb;AAAA,MAOA,OAAO,GAML,sBAAsB,CANjB,OAPP;AAAA,MAQA,OAAO,GAKL,sBAAsB,CALjB,OARP;AAAA,MASA,EAAA,GAIE,sBAAsB,CAJT,IATf;AAAA,MASA,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EATf;AAAA,MAUA,MAAM,GAGJ,sBAAsB,CAHlB,MAVN;AAAA,MAWA,WAAW,GAET,sBAAsB,CAFb,WAXX;AAAA,MAYG,SAAS,GAAA,MAAA,CACV,sBADU,EAbR,CAAA,QAAA,EAAA,WAAA,EAAA,UAAA,EAAA,UAAA,EAAA,mBAAA,EAAA,YAAA,EAAA,eAAA,EAAA,SAAA,EAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,aAAA,CAaQ,CAZZ,CAL6B,CAoB/B;AACA;AACA;;;AAEA,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,qBAAiB,QADnB;AAEE,IAAA,EAAE,EAAE,KAFN;AAGE,IAAA,SAAS,EAAA,SAHX;AAIE,IAAA,GAAG,EAAA,GAJL;AAKE,IAAA,IAAI,EAAA,IALN;AAOE,IAAA,MAAM,EAAA,QAAA,CAAA,QAAA,CAAA;AACJ,MAAA,EAAE,EAAE,QADA;AAEJ;AACA;AACA,MAAA,QAAQ,EAAA,QAJJ;AAKJ,MAAA,QAAQ,EAAA,QALJ;AAMJ,MAAA,iBAAiB,EAAA,iBANb;AAOJ,MAAA,OAAO,EAAA,OAPH;AAQJ,MAAA,OAAO,EAAA,OARH;AASJ,MAAA,IAAI,EAAA,IATA;AAUJ,MAAA,MAAM,EAAA,MAVF;AAWJ,MAAA,WAAW,EAAA;AAXP,KAAA,EAYD,SAZC,CAAA,EAaD,MAbC,CAPR;AAuBE,IAAA,UAAU,EAAA,QAAA,CAAA;AACR,MAAA,EAAE,EAAE,QADI;AAER;AACA;AACA,MAAA,QAAQ,EAAA,QAJA;AAKR,MAAA,QAAQ,EAAA,QALA;AAMR,MAAA,iBAAiB,EAAA,iBANT;AAOR,MAAA,OAAO,EAAA,OAPC;AAQR,MAAA,OAAO,EAAA,OARC;AASR,MAAA,IAAI,EAAA,IATI;AAUR,MAAA,MAAM,EAAA,MAVE;AAWR,MAAA,WAAW,EAAA;AAXH,KAAA,EAYL,UAZK;AAvBZ,GADsB,EAuCtB;AACA;AACA,EAAA,YAzCsB,EA0CtB,sBA1CsB,CAAxB;AA6CA,SAAO,KAAP;AACD,CAzEM","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"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ import type { SplitButtonState } from './SplitButton.types';
2
+ export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
@@ -0,0 +1,61 @@
1
+ import { __styles, mergeClasses } from '@fluentui/react-make-styles';
2
+ var SplitButtonClassNames = {
3
+ button: 'SplitButton-button',
4
+ menuButton: 'SplitButton-menuButton'
5
+ };
6
+
7
+ var useStyles = /*#__PURE__*/__styles({
8
+ "root": {
9
+ "mc9l5x": "ftuwxu6",
10
+ "Brf1p80": "fsxf2b5",
11
+ "qhf8xq": "f10pi13n",
12
+ "x85veo": ["f1ne4dir", "f1ybi2by"],
13
+ "Btvcf1s": ["f1breevy", "f1tvski9"],
14
+ "bajz6s": ["fnux5s6", "f5nfhee"],
15
+ "Bzqncq": ["f19wc9x7", "f5bevrs"],
16
+ "Flt4rd": ["f1wefiyg", "f1leuqsa"]
17
+ },
18
+ "rootBlock": {
19
+ "a9b677": "fly5x3f"
20
+ },
21
+ "rootPrimary": {
22
+ "hr16oo": ["f1l8fiow", "f1lkg7w5"],
23
+ "B5d1tlv": ["f1pm7n2k", "f1xkm9yf"],
24
+ "Bqs20fh": ["f1lzlrrr", "fhewniv"]
25
+ },
26
+ "rootSubtle": {
27
+ "hr16oo": ["ffnz80u", "fubjfjv"],
28
+ "B5d1tlv": ["f1ev4hyt", "fgg37q7"],
29
+ "Bqs20fh": ["f12yns5v", "fo742o6"]
30
+ },
31
+ "rootTransparent": {
32
+ "hr16oo": ["ffnz80u", "fubjfjv"],
33
+ "B5d1tlv": ["f1ev4hyt", "fgg37q7"],
34
+ "Bqs20fh": ["f12yns5v", "fo742o6"]
35
+ },
36
+ "rootDisabled": {
37
+ "hr16oo": ["f11d5dl6", "fdl3b3o"],
38
+ "B5d1tlv": ["f2uuk1a", "f13ik0bv"],
39
+ "Bqs20fh": ["f47hzam", "f1ui3wts"]
40
+ }
41
+ }, {
42
+ "d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fsxf2b5{-webkit-box-pack:stretch;-ms-flex-pack:stretch;-webkit-justify-content:stretch;justify-content:stretch;}", ".f10pi13n{position:relative;}", ".f1ne4dir .SplitButton-button{border-top-right-radius:0;}", ".f1ybi2by .SplitButton-button{border-top-left-radius:0;}", ".f1breevy .SplitButton-button{border-bottom-right-radius:0;}", ".f1tvski9 .SplitButton-button{border-bottom-left-radius:0;}", ".fnux5s6 .SplitButton-menuButton{border-left-width:0;}", ".f5nfhee .SplitButton-menuButton{border-right-width:0;}", ".f19wc9x7 .SplitButton-menuButton{border-top-left-radius:0;}", ".f5bevrs .SplitButton-menuButton{border-top-right-radius:0;}", ".f1wefiyg .SplitButton-menuButton{border-bottom-left-radius:0;}", ".f1leuqsa .SplitButton-menuButton{border-bottom-right-radius:0;}", ".fly5x3f{width:100%;}", ".f1l8fiow .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1lkg7w5 .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".ffnz80u .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fubjfjv .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f11d5dl6 .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".fdl3b3o .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
43
+ "h": [".f1pm7n2k:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1xkm9yf:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1ev4hyt:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fgg37q7:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f2uuk1a:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f13ik0bv:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
44
+ "a": [".f1lzlrrr:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".fhewniv:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f12yns5v:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fo742o6:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f47hzam:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f1ui3wts:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"]
45
+ });
46
+
47
+ export var useSplitButtonStyles = function (state) {
48
+ var styles = useStyles();
49
+ state.className = mergeClasses(styles.root, state.block && styles.rootBlock, state.primary && styles.rootPrimary, state.subtle && styles.rootSubtle, state.transparent && styles.rootTransparent, state.disabled && styles.rootDisabled, state.className);
50
+
51
+ if (state.button) {
52
+ state.button.className = mergeClasses(SplitButtonClassNames.button, state.button.className);
53
+ }
54
+
55
+ if (state.menuButton) {
56
+ state.menuButton.className = mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);
57
+ }
58
+
59
+ return state;
60
+ };
61
+ //# sourceMappingURL=useSplitButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA,IAAM,qBAAqB,GAAG;AAC5B,EAAA,MAAM,EAAE,oBADoB;AAE5B,EAAA,UAAU,EAAE;AAFgB,CAA9B;;AAKA,IAAM,SAAS,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,EAAlB;;AAgGA,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAAwB;AAC1D,MAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,MAAM,CAAC,IADqB,EAE5B,KAAK,CAAC,KAAN,IAAe,MAAM,CAAC,SAFM,EAG5B,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,WAHI,EAI5B,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,UAJK,EAK5B,KAAK,CAAC,WAAN,IAAqB,MAAM,CAAC,eALA,EAM5B,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,YANG,EAO5B,KAAK,CAAC,SAPsB,CAA9B;;AAUA,MAAI,KAAK,CAAC,MAAV,EAAkB;AAChB,IAAA,KAAK,CAAC,MAAN,CAAa,SAAb,GAAyB,YAAY,CAAC,qBAAqB,CAAC,MAAvB,EAA+B,KAAK,CAAC,MAAN,CAAa,SAA5C,CAArC;AACD;;AAED,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,IAAA,KAAK,CAAC,UAAN,CAAiB,SAAjB,GAA6B,YAAY,CAAC,qBAAqB,CAAC,UAAvB,EAAmC,KAAK,CAAC,UAAN,CAAiB,SAApD,CAAzC;AACD;;AAED,SAAO,KAAP;AACD,CAtBM","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { SplitButtonState } from './SplitButton.types';\n\nconst SplitButtonClassNames = {\n button: 'SplitButton-button',\n menuButton: 'SplitButton-menuButton',\n};\n\nconst useStyles = makeStyles({\n root: theme => ({\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n }),\n rootBlock: {\n width: '100%',\n },\n rootPrimary: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n }),\n rootSubtle: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootTransparent: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootDisabled: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n }),\n});\n\nexport const useSplitButtonStyles = (state: SplitButtonState): SplitButtonState => {\n const styles = useStyles();\n\n state.className = mergeClasses(\n styles.root,\n state.block && styles.rootBlock,\n state.primary && styles.rootPrimary,\n state.subtle && styles.rootSubtle,\n state.transparent && styles.rootTransparent,\n state.disabled && styles.rootDisabled,\n state.className,\n );\n\n if (state.button) {\n state.button.className = mergeClasses(SplitButtonClassNames.button, state.button.className);\n }\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';
3
3
  /**
4
- * Given user props, returns the final state for a ToggleButton.
4
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
5
+ * processed state.
6
+ * @param props - User provided props to the ToggleButton component.
7
+ * @param ref - User provided ref to be passed to the ToggleButton component.
5
8
  */
6
9
  export declare const useToggleButton: (props: ToggleButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ToggleButtonProps | undefined) => ToggleButtonState;
@@ -1,7 +1,10 @@
1
1
  import { useButton } from '../Button/useButton';
2
2
  import { useChecked } from './useChecked';
3
3
  /**
4
- * Given user props, returns the final state for a ToggleButton.
4
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
5
+ * processed state.
6
+ * @param props - User provided props to the ToggleButton component.
7
+ * @param ref - User provided ref to be passed to the ToggleButton component.
5
8
  */
6
9
 
7
10
  export var useToggleButton = function (props, ref, defaultProps) {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":"AACA,SAAS,SAAT,QAA0B,qBAA1B;AACA,SAAS,UAAT,QAA2B,cAA3B;AAGA;;AAEG;;AACH,OAAO,IAAM,eAAe,GAAG,UAC7B,KAD6B,EAE7B,GAF6B,EAG7B,YAH6B,EAGG;AAEhC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,EAAa,YAAb,CAAvB;AAEA,EAAA,UAAU,CAAC,KAAD,CAAV;AAEA,SAAO,KAAP;AACD,CAVM","sourcesContent":["import * as React from 'react';\nimport { useButton } from '../Button/useButton';\nimport { useChecked } from './useChecked';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, returns the final state for a ToggleButton.\n */\nexport const useToggleButton = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: ToggleButtonProps,\n) => {\n const state = useButton(props, ref, defaultProps);\n\n useChecked(state as ToggleButtonProps);\n\n return state as ToggleButtonState;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":"AACA,SAAS,SAAT,QAA0B,qBAA1B;AACA,SAAS,UAAT,QAA2B,cAA3B;AAGA;;;;;AAKG;;AACH,OAAO,IAAM,eAAe,GAAG,UAC7B,KAD6B,EAE7B,GAF6B,EAG7B,YAH6B,EAGG;AAEhC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,EAAa,YAAb,CAAvB;AAEA,EAAA,UAAU,CAAC,KAAD,CAAV;AAEA,SAAO,KAAP;AACD,CAVM","sourcesContent":["import * as React from 'react';\nimport { useButton } from '../Button/useButton';\nimport { useChecked } from './useChecked';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToggleButton = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: ToggleButtonProps,\n) => {\n const state = useButton(props, ref, defaultProps);\n\n useChecked(state as ToggleButtonProps);\n\n return state as ToggleButtonState;\n};\n"],"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 useRootStyles = /*#__PURE__*/__styles({
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AACA,SAAS,eAAT,QAAgC,2BAAhC;;AAGA,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;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,EAAtB;;AA4IA,OAAO,IAAM,qBAAqB,GAAG,UAAC,KAAD,EAAyB;AAC5D,MAAM,UAAU,GAAG,aAAa,EAAhC;AAEA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,KAAK,CAAC,OAAN,IAAiB,UAAU,CAAC,OADA,EAE5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,OAAvB,IAAkC,UAAU,CAAC,cAFjB,EAG5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,OAAvB,IAAkC,UAAU,CAAC,cAHjB,EAI5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,MAAvB,IAAiC,UAAU,CAAC,aAJhB,EAK5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,WAAvB,IAAsC,UAAU,CAAC,kBALrB,EAM5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN9B,EAO5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAP/C,EAQ5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,MAArD,IAA+D,UAAU,CAAC,cAR9C,EAS5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBATnD,EAU5B,KAAK,CAAC,SAVsB,CAA9B;AAaA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CAnBM","sourcesContent":["import { mergeClasses, makeStyles } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nconst useRootStyles = makeStyles({\n checked: theme => ({\n background: theme.alias.color.neutral.neutralBackground1Selected,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderWidth: theme.global.strokeWidth.thin,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n }),\n checkedOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n checkedPrimary: theme => ({\n background: theme.alias.color.neutral.brandBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n checkedSubtle: theme => ({\n background: theme.alias.color.neutral.subtleBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n checkedTransparent: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nexport const useToggleButtonStyles = (state: ToggleButtonState): ToggleButtonState => {\n const rootStyles = useRootStyles();\n\n state.className = mergeClasses(\n state.checked && rootStyles.checked,\n state.checked && state.outline && rootStyles.checkedOutline,\n state.checked && state.primary && rootStyles.checkedPrimary,\n state.checked && state.subtle && rootStyles.checkedSubtle,\n state.checked && state.transparent && rootStyles.checkedTransparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,eAAT,QAAgC,2BAAhC;;AAGA,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;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,EAAtB;;AA4IA,OAAO,IAAM,qBAAqB,GAAG,UAAC,KAAD,EAAyB;AAC5D,MAAM,UAAU,GAAG,aAAa,EAAhC;AAEA,EAAA,KAAK,CAAC,SAAN,GAAkB,YAAY,CAC5B,KAAK,CAAC,OAAN,IAAiB,UAAU,CAAC,OADA,EAE5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,OAAvB,IAAkC,UAAU,CAAC,cAFjB,EAG5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,OAAvB,IAAkC,UAAU,CAAC,cAHjB,EAI5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,MAAvB,IAAiC,UAAU,CAAC,aAJhB,EAK5B,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,WAAvB,IAAsC,UAAU,CAAC,kBALrB,EAM5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN9B,EAO5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAP/C,EAQ5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,MAArD,IAA+D,UAAU,CAAC,cAR9C,EAS5B,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBATnD,EAU5B,KAAK,CAAC,SAVsB,CAA9B;AAaA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CAnBM","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nconst useRootStyles = makeStyles({\n checked: theme => ({\n background: theme.alias.color.neutral.neutralBackground1Selected,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderWidth: theme.global.strokeWidth.thin,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n }),\n checkedOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n checkedPrimary: theme => ({\n background: theme.alias.color.neutral.brandBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n checkedSubtle: theme => ({\n background: theme.alias.color.neutral.subtleBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n checkedTransparent: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nexport const useToggleButtonStyles = (state: ToggleButtonState): ToggleButtonState => {\n const rootStyles = useRootStyles();\n\n state.className = mergeClasses(\n state.checked && rootStyles.checked,\n state.checked && state.outline && rootStyles.checkedOutline,\n state.checked && state.primary && rootStyles.checkedPrimary,\n state.checked && state.subtle && rootStyles.checkedSubtle,\n state.checked && state.transparent && rootStyles.checkedTransparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './Button';
2
2
  export * from './CompoundButton';
3
3
  export * from './MenuButton';
4
+ export * from './SplitButton';
4
5
  export * from './ToggleButton';
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './Button';
2
2
  export * from './CompoundButton';
3
3
  export * from './MenuButton';
4
+ export * from './SplitButton';
4
5
  export * from './ToggleButton';
5
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './ToggleButton';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './SplitButton';\nexport * from './ToggleButton';\n"]}
@@ -0,0 +1 @@
1
+ export * from './components/SplitButton/index';
@@ -0,0 +1,6 @@
1
+ define(["require", "exports", "tslib", "./components/SplitButton/index"], function (require, exports, tslib_1, index_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ tslib_1.__exportStar(index_1, exports);
5
+ });
6
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitButton.js","sourceRoot":"../src/","sources":["SplitButton.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/SplitButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"renderButton.js","sourceRoot":"../src/","sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,YAAY,GAAG,UAAC,KAAkB;QACvC,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,sCAA0B,CAAC,EAAtE,KAAK,WAAA,EAAE,SAAS,eAAsD,CAAC;QACvE,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,QAAQ;YACrB,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,YAAY,gBAYvB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { buttonShorthandPropsCompat } from './useButton';\nimport type { ButtonState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton = (state: ButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, buttonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {/*{loading && <slots.loader {...slotProps.loader} />}*/}\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && children}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"]}
1
+ {"version":3,"file":"renderButton.js","sourceRoot":"../src/","sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,YAAY,GAAG,UAAC,KAAkB;QACvC,IAAA,KAAuB,gCAAc,CAAC,KAAK,EAAE,sCAA0B,CAAC,EAAtE,KAAK,WAAA,EAAE,SAAS,eAAsD,CAAC;QACvE,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,QAAQ;YACrB,YAAY,KAAK,OAAO,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI,CACpD,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,YAAY,gBAWvB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { buttonShorthandPropsCompat } from './useButton';\nimport type { ButtonState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton = (state: ButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, buttonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && children}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"]}
@@ -5,6 +5,8 @@ import type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './But
5
5
  */
6
6
  export declare const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[];
7
7
  /**
8
- * Given user props, returns the final state for a Button.
8
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
9
+ * @param props - User provided props to the Button component.
10
+ * @param ref - User provided ref to be passed to the Button component.
9
11
  */
10
12
  export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
@@ -8,7 +8,9 @@ define(["require", "exports", "@fluentui/react-utilities", "./useButtonState"],
8
8
  exports.buttonShorthandPropsCompat = ['icon'];
9
9
  var mergeProps = react_utilities_1.makeMergeProps({ deepMerge: exports.buttonShorthandPropsCompat });
10
10
  /**
11
- * Given user props, returns the final state for a Button.
11
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
12
+ * @param props - User provided props to the Button component.
13
+ * @param ref - User provided ref to be passed to the Button component.
12
14
  */
13
15
  var useButton = function (props, ref, defaultProps) {
14
16
  var state = mergeProps({
@@ -1 +1 @@
1
- {"version":3,"file":"useButton.js","sourceRoot":"../src/","sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,0BAA0B,GAAiC,CAAC,MAAM,CAAC,CAAC;IAEjF,IAAM,UAAU,GAAG,gCAAc,CAAc,EAAE,SAAS,EAAE,kCAA0B,EAAE,CAAC,CAAC;IAE1F;;OAEG;IACI,IAAM,SAAS,GAAG,UAAC,KAAkB,EAAE,GAA2B,EAAE,YAA0B;QACnG,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,QAAQ;YACR,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,kCAA0B,CAAC,EAC/E,uCAAqB,CAAC,KAAK,EAAE,kCAA0B,CAAC,CACzD,CAAC;QAEF,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAlBW,QAAA,SAAS,aAkBpB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from './useButtonState';\nimport type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './Button.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[] = ['icon'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandPropsCompat });\n\n/**\n * Given user props, returns the final state for a Button.\n */\nexport const useButton = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots\n icon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, buttonShorthandPropsCompat),\n resolveShorthandProps(props, buttonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"]}
1
+ {"version":3,"file":"useButton.js","sourceRoot":"../src/","sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;;IAKA;;OAEG;IACU,QAAA,0BAA0B,GAAiC,CAAC,MAAM,CAAC,CAAC;IAEjF,IAAM,UAAU,GAAG,gCAAc,CAAc,EAAE,SAAS,EAAE,kCAA0B,EAAE,CAAC,CAAC;IAE1F;;;;OAIG;IACI,IAAM,SAAS,GAAG,UAAC,KAAkB,EAAE,GAA2B,EAAE,YAA0B;QACnG,IAAM,KAAK,GAAG,UAAU,CACtB;YACE,GAAG,KAAA;YACH,EAAE,EAAE,QAAQ;YACZ,QAAQ;YACR,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;YACpB,iBAAiB;YACjB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACf,EACD,YAAY,IAAI,uCAAqB,CAAC,YAAY,EAAE,kCAA0B,CAAC,EAC/E,uCAAqB,CAAC,KAAK,EAAE,kCAA0B,CAAC,CACzD,CAAC;QAEF,+BAAc,CAAC,KAAK,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAlBW,QAAA,SAAS,aAkBpB","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from './useButtonState';\nimport type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './Button.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[] = ['icon'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandPropsCompat });\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots\n icon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, buttonShorthandPropsCompat),\n resolveShorthandProps(props, buttonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { ButtonState } from './Button.types';
2
2
  /**
3
- * The useButton hook processes the Button draft state.
4
- * @param state - Button draft state to mutate.
3
+ * The useButton hook processes the Button state.
4
+ * @param state - Button state to mutate.
5
5
  */
6
6
  export declare const useButtonState: (state: ButtonState) => ButtonState;
@@ -3,8 +3,8 @@ define(["require", "exports", "@fluentui/keyboard-keys"], function (require, exp
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useButtonState = void 0;
5
5
  /**
6
- * The useButton hook processes the Button draft state.
7
- * @param state - Button draft state to mutate.
6
+ * The useButton hook processes the Button state.
7
+ * @param state - Button state to mutate.
8
8
  */
9
9
  var useButtonState = function (state) {
10
10
  var as = state.as, children = state.children, disabled = state.disabled, disabledFocusable = state.disabledFocusable, icon = state.icon, onClick = state.onClick, onKeyDownCallback = state.onKeyDown;