@fluentui/react-button 9.0.0-rc.1 → 9.0.0-rc.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/CHANGELOG.json +549 -1
  2. package/CHANGELOG.md +321 -172
  3. package/README.md +80 -18
  4. package/dist/{react-button.d.ts → index.d.ts} +42 -37
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/Button.js.map +1 -1
  7. package/lib/CompoundButton.js.map +1 -1
  8. package/lib/MenuButton.js.map +1 -1
  9. package/lib/SplitButton.js.map +1 -1
  10. package/lib/ToggleButton.js.map +1 -1
  11. package/lib/components/Button/Button.js.map +1 -1
  12. package/lib/components/Button/Button.types.js.map +1 -1
  13. package/lib/components/Button/index.js +1 -1
  14. package/lib/components/Button/index.js.map +1 -1
  15. package/lib/components/Button/renderButton.js.map +1 -1
  16. package/lib/components/Button/useButton.js +1 -3
  17. package/lib/components/Button/useButton.js.map +1 -1
  18. package/lib/components/Button/useButtonStyles.js +162 -115
  19. package/lib/components/Button/useButtonStyles.js.map +1 -1
  20. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  21. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  22. package/lib/components/CompoundButton/index.js +1 -1
  23. package/lib/components/CompoundButton/index.js.map +1 -1
  24. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  25. package/lib/components/CompoundButton/useCompoundButton.js +7 -2
  26. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  27. package/lib/components/CompoundButton/useCompoundButtonStyles.js +72 -55
  28. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  29. package/lib/components/MenuButton/MenuButton.js +2 -1
  30. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  31. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  32. package/lib/components/MenuButton/index.js +1 -1
  33. package/lib/components/MenuButton/index.js.map +1 -1
  34. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  35. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  36. package/lib/components/MenuButton/useMenuButtonStyles.js +34 -14
  37. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  38. package/lib/components/SplitButton/SplitButton.js +1 -1
  39. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  40. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  41. package/lib/components/SplitButton/index.js +1 -1
  42. package/lib/components/SplitButton/index.js.map +1 -1
  43. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  44. package/lib/components/SplitButton/useSplitButton.js +17 -8
  45. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  46. package/lib/components/SplitButton/useSplitButtonStyles.js +37 -34
  47. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  48. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  49. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  50. package/lib/components/ToggleButton/index.js +1 -1
  51. package/lib/components/ToggleButton/index.js.map +1 -1
  52. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  53. package/lib/components/ToggleButton/useToggleButton.js +3 -41
  54. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  55. package/lib/components/ToggleButton/useToggleButtonStyles.js +122 -61
  56. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  57. package/lib/index.js +6 -5
  58. package/lib/index.js.map +1 -1
  59. package/lib/utils/index.js +2 -0
  60. package/lib/utils/index.js.map +1 -0
  61. package/lib/utils/useToggleState.js +37 -0
  62. package/lib/utils/useToggleState.js.map +1 -0
  63. package/lib-commonjs/Button.js.map +1 -1
  64. package/lib-commonjs/CompoundButton.js.map +1 -1
  65. package/lib-commonjs/MenuButton.js.map +1 -1
  66. package/lib-commonjs/SplitButton.js.map +1 -1
  67. package/lib-commonjs/ToggleButton.js.map +1 -1
  68. package/lib-commonjs/components/Button/Button.js.map +1 -1
  69. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  70. package/lib-commonjs/components/Button/index.js +3 -3
  71. package/lib-commonjs/components/Button/index.js.map +1 -1
  72. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  73. package/lib-commonjs/components/Button/useButton.js +1 -3
  74. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  75. package/lib-commonjs/components/Button/useButtonStyles.js +164 -116
  76. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  77. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  78. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  79. package/lib-commonjs/components/CompoundButton/index.js +3 -3
  80. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  81. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  82. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +7 -2
  83. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  84. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +74 -57
  85. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  86. package/lib-commonjs/components/MenuButton/MenuButton.js +2 -1
  87. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  88. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  89. package/lib-commonjs/components/MenuButton/index.js +3 -3
  90. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  91. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  92. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  93. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +36 -15
  94. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  95. package/lib-commonjs/components/SplitButton/SplitButton.js +1 -1
  96. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  97. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  98. package/lib-commonjs/components/SplitButton/index.js +3 -3
  99. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  100. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  101. package/lib-commonjs/components/SplitButton/useSplitButton.js +16 -7
  102. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  103. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +38 -35
  104. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  105. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  106. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  107. package/lib-commonjs/components/ToggleButton/index.js +3 -3
  108. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  109. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  110. package/lib-commonjs/components/ToggleButton/useToggleButton.js +3 -42
  111. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  112. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +127 -63
  113. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  114. package/lib-commonjs/index.js +169 -6
  115. package/lib-commonjs/index.js.map +1 -1
  116. package/lib-commonjs/utils/index.js +10 -0
  117. package/lib-commonjs/utils/index.js.map +1 -0
  118. package/lib-commonjs/utils/useToggleState.js +48 -0
  119. package/lib-commonjs/utils/useToggleState.js.map +1 -0
  120. package/package.json +20 -22
  121. package/dist/demo/index.html +0 -71
  122. package/dist/demo/react-dom.development.js +0 -21413
  123. package/dist/demo/react.development.js +0 -3155
  124. package/lib/Button.d.ts +0 -1
  125. package/lib/CompoundButton.d.ts +0 -1
  126. package/lib/MenuButton.d.ts +0 -1
  127. package/lib/SplitButton.d.ts +0 -1
  128. package/lib/ToggleButton.d.ts +0 -1
  129. package/lib/components/Button/Button.d.ts +0 -6
  130. package/lib/components/Button/Button.types.d.ts +0 -62
  131. package/lib/components/Button/index.d.ts +0 -5
  132. package/lib/components/Button/renderButton.d.ts +0 -5
  133. package/lib/components/Button/useButton.d.ts +0 -8
  134. package/lib/components/Button/useButtonStyles.d.ts +0 -3
  135. package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
  136. package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  137. package/lib/components/CompoundButton/index.d.ts +0 -5
  138. package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  139. package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
  140. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -3
  141. package/lib/components/MenuButton/MenuButton.d.ts +0 -6
  142. package/lib/components/MenuButton/MenuButton.types.d.ts +0 -10
  143. package/lib/components/MenuButton/index.d.ts +0 -5
  144. package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
  145. package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
  146. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -3
  147. package/lib/components/SplitButton/SplitButton.d.ts +0 -7
  148. package/lib/components/SplitButton/SplitButton.types.d.ts +0 -21
  149. package/lib/components/SplitButton/index.d.ts +0 -5
  150. package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
  151. package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
  152. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -3
  153. package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
  154. package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  155. package/lib/components/ToggleButton/index.d.ts +0 -5
  156. package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
  157. package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
  158. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -3
  159. package/lib/index.d.ts +0 -5
  160. package/lib-commonjs/Button.d.ts +0 -1
  161. package/lib-commonjs/CompoundButton.d.ts +0 -1
  162. package/lib-commonjs/MenuButton.d.ts +0 -1
  163. package/lib-commonjs/SplitButton.d.ts +0 -1
  164. package/lib-commonjs/ToggleButton.d.ts +0 -1
  165. package/lib-commonjs/components/Button/Button.d.ts +0 -6
  166. package/lib-commonjs/components/Button/Button.types.d.ts +0 -62
  167. package/lib-commonjs/components/Button/index.d.ts +0 -5
  168. package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
  169. package/lib-commonjs/components/Button/useButton.d.ts +0 -8
  170. package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -3
  171. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
  172. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  173. package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
  174. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  175. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
  176. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -3
  177. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
  178. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -10
  179. package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
  180. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
  181. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
  182. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -3
  183. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
  184. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -21
  185. package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
  186. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
  187. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
  188. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -3
  189. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
  190. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  191. package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
  192. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
  193. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
  194. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -3
  195. package/lib-commonjs/index.d.ts +0 -5
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
- export * from './Button';
2
- export * from './CompoundButton';
3
- export * from './MenuButton';
4
- export * from './SplitButton';
5
- export * from './ToggleButton';
1
+ export { Button, buttonClassNames, renderButton_unstable, useButtonStyles_unstable, useButton_unstable } from './Button';
2
+ export { CompoundButton, compoundButtonClassNames, renderCompoundButton_unstable, useCompoundButtonStyles_unstable, useCompoundButton_unstable } from './CompoundButton';
3
+ export { MenuButton, menuButtonClassNames, renderMenuButton_unstable, useMenuButtonStyles_unstable, useMenuButton_unstable } from './MenuButton';
4
+ export { SplitButton, renderSplitButton_unstable, splitButtonClassNames, useSplitButtonStyles_unstable, useSplitButton_unstable } from './SplitButton';
5
+ export { ToggleButton, renderToggleButton_unstable, toggleButtonClassNames, useToggleButtonStyles_unstable, useToggleButton_unstable } from './ToggleButton';
6
+ export { useToggleState } from './utils/index';
6
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,SACE,MADF,EAEE,gBAFF,EAGE,qBAHF,EAIE,wBAJF,EAKE,kBALF,QAMO,UANP;AAQA,SACE,cADF,EAEE,wBAFF,EAGE,6BAHF,EAIE,gCAJF,EAKE,0BALF,QAMO,kBANP;AAQA,SACE,UADF,EAEE,oBAFF,EAGE,yBAHF,EAIE,4BAJF,EAKE,sBALF,QAMO,cANP;AAQA,SACE,WADF,EAEE,0BAFF,EAGE,qBAHF,EAIE,6BAJF,EAKE,uBALF,QAMO,eANP;AAQA,SACE,YADF,EAEE,2BAFF,EAGE,sBAHF,EAIE,8BAJF,EAKE,wBALF,QAMO,gBANP;AASA,SAAS,cAAT,QAA+B,eAA/B","sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ export * from './useToggleState';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './useToggleState';\n"]}
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { useControllableState, useMergedEventCallbacks } from '@fluentui/react-utilities';
3
+ export function useToggleState(props, state) {
4
+ const {
5
+ checked,
6
+ defaultChecked,
7
+ disabled,
8
+ disabledFocusable
9
+ } = props;
10
+ const {
11
+ onClick,
12
+ role
13
+ } = state.root;
14
+ const [checkedValue, setCheckedValue] = useControllableState({
15
+ state: checked,
16
+ defaultState: defaultChecked,
17
+ initialState: false
18
+ });
19
+ const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
20
+ const onToggleClick = React.useCallback(ev => {
21
+ if (!disabled && !disabledFocusable) {
22
+ if (ev.defaultPrevented) {
23
+ return;
24
+ }
25
+
26
+ setCheckedValue(!checkedValue);
27
+ }
28
+ }, [checkedValue, disabled, disabledFocusable, setCheckedValue]);
29
+ return { ...state,
30
+ checked: checkedValue,
31
+ root: { ...state.root,
32
+ [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
33
+ onClick: useMergedEventCallbacks(onClick, onToggleClick)
34
+ }
35
+ };
36
+ }
37
+ //# sourceMappingURL=useToggleState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/useToggleState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,uBAA/B,QAA8D,2BAA9D;AAIA,OAAM,SAAU,cAAV,CAIJ,KAJI,EAIuB,KAJvB,EAI0C;AAC9C,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,cAAX;AAA2B,IAAA,QAA3B;AAAqC,IAAA;AAArC,MAA2D,KAAjE;AACA,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA;AAAX,MAAoB,KAAK,CAAC,IAAhC;AAEA,QAAM,CAAC,YAAD,EAAe,eAAf,IAAkC,oBAAoB,CAAC;AAC3D,IAAA,KAAK,EAAE,OADoD;AAE3D,IAAA,YAAY,EAAE,cAF6C;AAG3D,IAAA,YAAY,EAAE;AAH6C,GAAD,CAA5D;AAMA,QAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAT,IAA+B,IAAI,KAAK,UAAnE;AAEA,QAAM,aAAa,GAAG,KAAK,CAAC,WAAN,CACpB,EAAE,IAAG;AACH,QAAI,CAAC,QAAD,IAAa,CAAC,iBAAlB,EAAqC;AACnC,UAAI,EAAE,CAAC,gBAAP,EAAyB;AACvB;AACD;;AAED,MAAA,eAAe,CAAC,CAAC,YAAF,CAAf;AACD;AACF,GATmB,EAUpB,CAAC,YAAD,EAAe,QAAf,EAAyB,iBAAzB,EAA4C,eAA5C,CAVoB,CAAtB;AAaA,SAAO,EACL,GAAG,KADE;AAGL,IAAA,OAAO,EAAE,YAHJ;AAKL,IAAA,IAAI,EAAE,EACJ,GAAG,KAAK,CAAC,IADL;AAEJ,OAAC,kBAAkB,GAAG,cAAH,GAAoB,cAAvC,GAAwD,YAFpD;AAGJ,MAAA,OAAO,EAAE,uBAAuB,CAC9B,OAD8B,EAE9B,aAF8B;AAH5B;AALD,GAAP;AAcD","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useMergedEventCallbacks(\n onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>,\n onToggleClick,\n ),\n },\n } as TToggleButtonState;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Button.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["Button.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Button/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/CompoundButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["CompoundButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/CompoundButton/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/MenuButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["MenuButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuButton/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SplitButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["SplitButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/SplitButton/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ToggleButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["ToggleButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/ToggleButton/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;AAEA,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP,CALsF,CAMtF;AACD,CAPuD,CAA3C;AASb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;AAEA,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP,CALsF,CAMtF;AACD,CAPuD,CAA3C;AASb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button: ForwardRefComponent<ButtonProps> = React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n\n useButtonStyles_unstable(state);\n\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ButtonProps>;\n\nButton.displayName = 'Button';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useButtonStyles_unstable = exports.buttonClassName = void 0;
6
+ exports.useButtonStyles_unstable = exports.buttonClassNames = void 0;
7
7
 
8
8
  const tslib_1 = /*#__PURE__*/require("tslib");
9
9
 
@@ -15,10 +15,10 @@ tslib_1.__exportStar(require("./useButton"), exports);
15
15
 
16
16
  var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
17
17
 
18
- Object.defineProperty(exports, "buttonClassName", {
18
+ Object.defineProperty(exports, "buttonClassNames", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return useButtonStyles_1.buttonClassName;
21
+ return useButtonStyles_1.buttonClassNames;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "useButtonStyles_unstable", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AAGA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,wBAAA;AAAwB;AAAxB,CAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/Button/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AAGA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,gBAAA;AAAgB;AAAhB,CAAA;AAAkB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,wBAAA;AAAwB;AAAxB,CAAA","sourcesContent":["export * from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport * from './renderButton';\nexport * from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAAuB;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAsB,KAAtB,CAA7B;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA6B,KAAnC;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,IAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CA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react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ButtonSlots, 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_unstable = (state: ButtonState) => {\n const { slots, slotProps } = getSlots<ButtonSlots>(state);\n const { iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n {!iconOnly && state.root.children}\n {iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -17,9 +17,8 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
17
17
 
18
18
  const useButton_unstable = (props, ref) => {
19
19
  const {
20
- appearance,
20
+ appearance = 'secondary',
21
21
  as,
22
- block = false,
23
22
  disabled = false,
24
23
  disabledFocusable = false,
25
24
  icon,
@@ -31,7 +30,6 @@ const useButton_unstable = (props, ref) => {
31
30
  return {
32
31
  // Props passed at the top-level
33
32
  appearance,
34
- block,
35
33
  disabled,
36
34
  disabledFocusable,
37
35
  iconPosition,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/useButton.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;AAIG;;;AACI,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;AACf,QAAM;AACJ,IAAA,UADI;AAEJ,IAAA,EAFI;AAGJ,IAAA,KAAK,GAAG,KAHJ;AAIJ,IAAA,QAAQ,GAAG,KAJP;AAKJ,IAAA,iBAAiB,GAAG,KALhB;AAMJ,IAAA,IANI;AAOJ,IAAA,YAAY,GAAG,QAPX;AAQJ,IAAA,KAAK,GAAG,SARJ;AASJ,IAAA,IAAI,GAAG;AATH,MAUF,KAVJ;AAWA,Q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AAMJ,IAAA,YAAY,GAAG,QANX;AAOJ,IAAA,KAAK,GAAG,SAPJ;AAQJ,IAAA,IAAI,GAAG;AARH,MASF,KATJ;AAUA,QAAM,aAAa,GAAG,iBAAA,CAAA,gBAAA,CAAiB,IAAjB,CAAtB;AAEA,SAAO;AACL;AACA,IAAA,UAFK;AAGL,IAAA,QAHK;AAIL,IAAA,iBAJK;AAKL,IAAA,YALK;AAML,IAAA,KANK;AAOL,IAAA,IAPK;AASL;AACA,IAAA,QAAQ,EAAE,OAAO,CAAC,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,QAAf,KAA2B,CAAC,KAAK,CAAC,QAAnC,CAVZ;AAYL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE;AAFI,KAbP;AAkBL,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CACJ,EAAE,IAAI,QADF,EAEJ,YAAA,CAAA,aAAA,CAAmC,KAAnC,EAA0C;AACxC,MAAA,QAAQ,EAAE,IAD8B;AAExC,MAAA,YAAY,EAAE;AACZ;AACA,QAAA,GAAG,EAAE,GAFO;AAGZ,QAAA,IAAI,EAAE,QAHM,CAGI;;AAHJ;AAF0B,KAA1C,CAFI,CAlBD;AA6BL,IAAA,IAAI,EAAE;AA7BD,GAAP;AA+BD,CA/CM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useARIAButton } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const {\n appearance = 'secondary',\n as,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = 'medium',\n } = props;\n const iconShorthand = resolveShorthand(icon);\n\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n },\n\n root: getNativeElementProps(\n as || 'button',\n useARIAButton<ARIAButtonSlotProps>(props, {\n required: true,\n defaultProps: {\n // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>\n ref: ref as React.Ref<HTMLButtonElement>,\n type: 'button', // This is added because the default for type is 'submit'\n },\n }),\n ),\n icon: iconShorthand,\n };\n};\n"],"sourceRoot":"../src/"}