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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/CHANGELOG.json +475 -1
  2. package/CHANGELOG.md +297 -172
  3. package/dist/{react-button.d.ts → index.d.ts} +67 -31
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/Button.js.map +1 -1
  6. package/lib/CompoundButton.js.map +1 -1
  7. package/lib/MenuButton.js.map +1 -1
  8. package/lib/SplitButton.js.map +1 -1
  9. package/lib/ToggleButton.js.map +1 -1
  10. package/lib/components/Button/Button.js.map +1 -1
  11. package/lib/components/Button/Button.types.js.map +1 -1
  12. package/lib/components/Button/index.js +3 -1
  13. package/lib/components/Button/index.js.map +1 -1
  14. package/lib/components/Button/renderButton.js.map +1 -1
  15. package/lib/components/Button/useButton.js +2 -1
  16. package/lib/components/Button/useButton.js.map +1 -1
  17. package/lib/components/Button/useButtonStyles.js +155 -97
  18. package/lib/components/Button/useButtonStyles.js.map +1 -1
  19. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  20. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  21. package/lib/components/CompoundButton/index.js +3 -1
  22. package/lib/components/CompoundButton/index.js.map +1 -1
  23. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  24. package/lib/components/CompoundButton/useCompoundButton.js +7 -2
  25. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  26. package/lib/components/CompoundButton/useCompoundButtonStyles.js +77 -55
  27. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  28. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  29. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  30. package/lib/components/MenuButton/index.js +3 -1
  31. package/lib/components/MenuButton/index.js.map +1 -1
  32. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  33. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  34. package/lib/components/MenuButton/useMenuButtonStyles.js +39 -14
  35. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  36. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  37. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  38. package/lib/components/SplitButton/index.js +3 -1
  39. package/lib/components/SplitButton/index.js.map +1 -1
  40. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  41. package/lib/components/SplitButton/useSplitButton.js +18 -5
  42. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  43. package/lib/components/SplitButton/useSplitButtonStyles.js +40 -27
  44. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  45. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  46. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  47. package/lib/components/ToggleButton/index.js +3 -1
  48. package/lib/components/ToggleButton/index.js.map +1 -1
  49. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  50. package/lib/components/ToggleButton/useToggleButton.js +3 -41
  51. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  52. package/lib/components/ToggleButton/useToggleButtonStyles.js +85 -60
  53. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  54. package/lib/index.js +11 -5
  55. package/lib/index.js.map +1 -1
  56. package/lib/utils/index.js +2 -0
  57. package/lib/utils/index.js.map +1 -0
  58. package/lib/utils/useToggleState.js +37 -0
  59. package/lib/utils/useToggleState.js.map +1 -0
  60. package/lib-commonjs/Button.js.map +1 -1
  61. package/lib-commonjs/CompoundButton.js.map +1 -1
  62. package/lib-commonjs/MenuButton.js.map +1 -1
  63. package/lib-commonjs/SplitButton.js.map +1 -1
  64. package/lib-commonjs/ToggleButton.js.map +1 -1
  65. package/lib-commonjs/components/Button/Button.js.map +1 -1
  66. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  67. package/lib-commonjs/components/Button/index.js +9 -1
  68. package/lib-commonjs/components/Button/index.js.map +1 -1
  69. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  70. package/lib-commonjs/components/Button/useButton.js +2 -1
  71. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  72. package/lib-commonjs/components/Button/useButtonStyles.js +157 -98
  73. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  74. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  75. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  76. package/lib-commonjs/components/CompoundButton/index.js +9 -1
  77. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  78. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  79. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +7 -2
  80. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  81. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +79 -57
  82. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  83. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  84. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  85. package/lib-commonjs/components/MenuButton/index.js +9 -1
  86. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  87. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  88. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  89. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +41 -15
  90. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  91. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  92. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  93. package/lib-commonjs/components/SplitButton/index.js +9 -1
  94. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  95. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  96. package/lib-commonjs/components/SplitButton/useSplitButton.js +17 -4
  97. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  98. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +41 -28
  99. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  100. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  101. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  102. package/lib-commonjs/components/ToggleButton/index.js +9 -1
  103. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  104. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  105. package/lib-commonjs/components/ToggleButton/useToggleButton.js +3 -42
  106. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  107. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +89 -62
  108. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  109. package/lib-commonjs/index.js +204 -6
  110. package/lib-commonjs/index.js.map +1 -1
  111. package/lib-commonjs/utils/index.js +10 -0
  112. package/lib-commonjs/utils/index.js.map +1 -0
  113. package/lib-commonjs/utils/useToggleState.js +48 -0
  114. package/lib-commonjs/utils/useToggleState.js.map +1 -0
  115. package/package.json +20 -22
  116. package/dist/demo/index.html +0 -71
  117. package/dist/demo/react-dom.development.js +0 -21413
  118. package/dist/demo/react.development.js +0 -3155
  119. package/lib/Button.d.ts +0 -1
  120. package/lib/CompoundButton.d.ts +0 -1
  121. package/lib/MenuButton.d.ts +0 -1
  122. package/lib/SplitButton.d.ts +0 -1
  123. package/lib/ToggleButton.d.ts +0 -1
  124. package/lib/components/Button/Button.d.ts +0 -6
  125. package/lib/components/Button/Button.types.d.ts +0 -62
  126. package/lib/components/Button/index.d.ts +0 -5
  127. package/lib/components/Button/renderButton.d.ts +0 -5
  128. package/lib/components/Button/useButton.d.ts +0 -8
  129. package/lib/components/Button/useButtonStyles.d.ts +0 -3
  130. package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
  131. package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  132. package/lib/components/CompoundButton/index.d.ts +0 -5
  133. package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  134. package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
  135. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -3
  136. package/lib/components/MenuButton/MenuButton.d.ts +0 -6
  137. package/lib/components/MenuButton/MenuButton.types.d.ts +0 -10
  138. package/lib/components/MenuButton/index.d.ts +0 -5
  139. package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
  140. package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
  141. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -3
  142. package/lib/components/SplitButton/SplitButton.d.ts +0 -7
  143. package/lib/components/SplitButton/SplitButton.types.d.ts +0 -21
  144. package/lib/components/SplitButton/index.d.ts +0 -5
  145. package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
  146. package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
  147. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -3
  148. package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
  149. package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  150. package/lib/components/ToggleButton/index.d.ts +0 -5
  151. package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
  152. package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
  153. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -3
  154. package/lib/index.d.ts +0 -5
  155. package/lib-commonjs/Button.d.ts +0 -1
  156. package/lib-commonjs/CompoundButton.d.ts +0 -1
  157. package/lib-commonjs/MenuButton.d.ts +0 -1
  158. package/lib-commonjs/SplitButton.d.ts +0 -1
  159. package/lib-commonjs/ToggleButton.d.ts +0 -1
  160. package/lib-commonjs/components/Button/Button.d.ts +0 -6
  161. package/lib-commonjs/components/Button/Button.types.d.ts +0 -62
  162. package/lib-commonjs/components/Button/index.d.ts +0 -5
  163. package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
  164. package/lib-commonjs/components/Button/useButton.d.ts +0 -8
  165. package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -3
  166. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
  167. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  168. package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
  169. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  170. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
  171. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -3
  172. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
  173. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -10
  174. package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
  175. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
  176. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
  177. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -3
  178. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
  179. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -21
  180. package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
  181. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
  182. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
  183. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -3
  184. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
  185. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  186. package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
  187. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
  188. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
  189. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -3
  190. package/lib-commonjs/index.d.ts +0 -5
@@ -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 = exports.buttonClassName = void 0;
7
7
 
8
8
  const tslib_1 = /*#__PURE__*/require("tslib");
9
9
 
@@ -14,6 +14,8 @@ tslib_1.__exportStar(require("./renderButton"), exports);
14
14
  tslib_1.__exportStar(require("./useButton"), exports);
15
15
 
16
16
  var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
17
+ /* eslint-disable-next-line deprecation/deprecation */
18
+
17
19
 
18
20
  Object.defineProperty(exports, "buttonClassName", {
19
21
  enumerable: true,
@@ -21,6 +23,12 @@ Object.defineProperty(exports, "buttonClassName", {
21
23
  return useButtonStyles_1.buttonClassName;
22
24
  }
23
25
  });
26
+ Object.defineProperty(exports, "buttonClassNames", {
27
+ enumerable: true,
28
+ get: function () {
29
+ return useButtonStyles_1.buttonClassNames;
30
+ }
31
+ });
24
32
  Object.defineProperty(exports, "useButtonStyles_unstable", {
25
33
  enumerable: true,
26
34
  get: function () {
@@ -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;AACE;;;AACA,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;AACA,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;AACA,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 {\n /* eslint-disable-next-line deprecation/deprecation */\n buttonClassName,\n buttonClassNames,\n useButtonStyles_unstable,\n} from './useButtonStyles';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA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AAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,IAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAD7C,EAEG,CAAC,QAAD,IAAa,KAAK,CAAC,IAAN,CAAW,QAF3B,EAGG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,IAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAH7C,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from '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,8 +17,9 @@ 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
+ // eslint-disable-next-line deprecation/deprecation
22
23
  block = false,
23
24
  disabled = false,
24
25
  disabledFocusable = false,
@@ -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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;;AAHJ;AAF0B,KAA1C,CAFI,CAnBD;AA8BL,IAAA,IAAI,EAAE;AA9BD,GAAP;AAgCD,CAlDM;;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 // eslint-disable-next-line deprecation/deprecation\n block = false,\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 block,\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/"}