@fluentui/react-button 9.0.0-alpha.10 → 9.0.0-alpha.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/CHANGELOG.json +2418 -1
  2. package/CHANGELOG.md +920 -2
  3. package/README.md +19 -108
  4. package/dist/demo/index.html +71 -0
  5. package/dist/demo/react-dom.development.js +21413 -0
  6. package/dist/demo/react.development.js +3155 -0
  7. package/dist/react-button.d.ts +204 -82
  8. package/lib/Button.js.map +1 -1
  9. package/lib/CompoundButton.d.ts +1 -0
  10. package/lib/CompoundButton.js +2 -0
  11. package/lib/CompoundButton.js.map +1 -0
  12. package/lib/MenuButton.d.ts +1 -0
  13. package/lib/MenuButton.js +2 -0
  14. package/lib/MenuButton.js.map +1 -0
  15. package/lib/SplitButton.d.ts +1 -0
  16. package/lib/SplitButton.js +2 -0
  17. package/lib/SplitButton.js.map +1 -0
  18. package/lib/ToggleButton.d.ts +1 -0
  19. package/lib/ToggleButton.js +2 -0
  20. package/lib/ToggleButton.js.map +1 -0
  21. package/lib/common/isConformant.d.ts +4 -2
  22. package/lib/common/isConformant.js +9 -6
  23. package/lib/common/isConformant.js.map +1 -1
  24. package/lib/components/Button/Button.d.ts +4 -11
  25. package/lib/components/Button/Button.js +7 -16
  26. package/lib/components/Button/Button.js.map +1 -1
  27. package/lib/components/Button/Button.types.d.ts +57 -60
  28. package/lib/components/Button/Button.types.js +1 -0
  29. package/lib/components/Button/Button.types.js.map +1 -1
  30. package/lib/components/Button/index.d.ts +1 -2
  31. package/lib/components/Button/index.js +1 -1
  32. package/lib/components/Button/index.js.map +1 -1
  33. package/lib/components/Button/renderButton.d.ts +2 -2
  34. package/lib/components/Button/renderButton.js +9 -8
  35. package/lib/components/Button/renderButton.js.map +1 -1
  36. package/lib/components/Button/useButton.d.ts +5 -7
  37. package/lib/components/Button/useButton.js +49 -23
  38. package/lib/components/Button/useButton.js.map +1 -1
  39. package/lib/components/Button/useButtonStyles.d.ts +10 -4
  40. package/lib/components/Button/useButtonStyles.js +350 -378
  41. package/lib/components/Button/useButtonStyles.js.map +1 -1
  42. package/lib/components/CompoundButton/CompoundButton.d.ts +6 -0
  43. package/lib/components/CompoundButton/CompoundButton.js +15 -0
  44. package/lib/components/CompoundButton/CompoundButton.js.map +1 -0
  45. package/lib/components/CompoundButton/CompoundButton.types.d.ts +14 -0
  46. package/lib/components/CompoundButton/CompoundButton.types.js +2 -0
  47. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -0
  48. package/lib/components/CompoundButton/index.d.ts +5 -0
  49. package/lib/components/CompoundButton/index.js +6 -0
  50. package/lib/components/CompoundButton/index.js.map +1 -0
  51. package/lib/components/CompoundButton/renderCompoundButton.d.ts +5 -0
  52. package/lib/components/CompoundButton/renderCompoundButton.js +17 -0
  53. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -0
  54. package/lib/components/CompoundButton/useCompoundButton.d.ts +8 -0
  55. package/lib/components/CompoundButton/useCompoundButton.js +29 -0
  56. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -0
  57. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
  58. package/lib/components/CompoundButton/useCompoundButtonStyles.js +164 -0
  59. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  60. package/lib/components/MenuButton/MenuButton.d.ts +6 -0
  61. package/lib/components/MenuButton/MenuButton.js +15 -0
  62. package/lib/components/MenuButton/MenuButton.js.map +1 -0
  63. package/lib/components/MenuButton/MenuButton.types.d.ts +11 -0
  64. package/lib/components/MenuButton/MenuButton.types.js +2 -0
  65. package/lib/components/MenuButton/MenuButton.types.js.map +1 -0
  66. package/lib/components/MenuButton/index.d.ts +5 -0
  67. package/lib/components/MenuButton/index.js +6 -0
  68. package/lib/components/MenuButton/index.js.map +1 -0
  69. package/lib/components/MenuButton/renderMenuButton.d.ts +5 -0
  70. package/lib/components/MenuButton/renderMenuButton.js +17 -0
  71. package/lib/components/MenuButton/renderMenuButton.js.map +1 -0
  72. package/lib/components/MenuButton/useMenuButton.d.ts +6 -0
  73. package/lib/components/MenuButton/useMenuButton.js +32 -0
  74. package/lib/components/MenuButton/useMenuButton.js.map +1 -0
  75. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
  76. package/lib/components/MenuButton/useMenuButtonStyles.js +34 -0
  77. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  78. package/lib/components/SplitButton/SplitButton.d.ts +7 -0
  79. package/lib/components/SplitButton/SplitButton.js +16 -0
  80. package/lib/components/SplitButton/SplitButton.js.map +1 -0
  81. package/lib/components/SplitButton/SplitButton.types.d.ts +19 -0
  82. package/lib/components/SplitButton/SplitButton.types.js +2 -0
  83. package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
  84. package/lib/components/SplitButton/index.d.ts +5 -0
  85. package/lib/components/SplitButton/index.js +6 -0
  86. package/lib/components/SplitButton/index.js.map +1 -0
  87. package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
  88. package/lib/components/SplitButton/renderSplitButton.js +15 -0
  89. package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
  90. package/lib/components/SplitButton/useSplitButton.d.ts +8 -0
  91. package/lib/components/SplitButton/useSplitButton.js +73 -0
  92. package/lib/components/SplitButton/useSplitButton.js.map +1 -0
  93. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  94. package/lib/components/SplitButton/useSplitButtonStyles.js +77 -0
  95. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  96. package/lib/components/ToggleButton/ToggleButton.d.ts +6 -0
  97. package/lib/components/ToggleButton/ToggleButton.js +15 -0
  98. package/lib/components/ToggleButton/ToggleButton.js.map +1 -0
  99. package/lib/components/ToggleButton/ToggleButton.types.d.ts +19 -0
  100. package/lib/components/ToggleButton/ToggleButton.types.js +2 -0
  101. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -0
  102. package/lib/components/ToggleButton/index.d.ts +5 -0
  103. package/lib/components/ToggleButton/index.js +6 -0
  104. package/lib/components/ToggleButton/index.js.map +1 -0
  105. package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -0
  106. package/lib/components/ToggleButton/renderToggleButton.js +2 -0
  107. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -0
  108. package/lib/components/ToggleButton/useToggleButton.d.ts +9 -0
  109. package/lib/components/ToggleButton/useToggleButton.js +50 -0
  110. package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
  111. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
  112. package/lib/components/ToggleButton/useToggleButtonStyles.js +190 -0
  113. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  114. package/lib/index.d.ts +4 -0
  115. package/lib/index.js +4 -0
  116. package/lib/index.js.map +1 -1
  117. package/lib/tsdoc-metadata.json +1 -1
  118. package/lib-commonjs/Button.js +7 -2
  119. package/lib-commonjs/Button.js.map +1 -1
  120. package/lib-commonjs/CompoundButton.d.ts +1 -0
  121. package/lib-commonjs/CompoundButton.js +10 -0
  122. package/lib-commonjs/CompoundButton.js.map +1 -0
  123. package/lib-commonjs/MenuButton.d.ts +1 -0
  124. package/lib-commonjs/MenuButton.js +10 -0
  125. package/lib-commonjs/MenuButton.js.map +1 -0
  126. package/lib-commonjs/SplitButton.d.ts +1 -0
  127. package/lib-commonjs/SplitButton.js +10 -0
  128. package/lib-commonjs/SplitButton.js.map +1 -0
  129. package/lib-commonjs/ToggleButton.d.ts +1 -0
  130. package/lib-commonjs/ToggleButton.js +10 -0
  131. package/lib-commonjs/ToggleButton.js.map +1 -0
  132. package/lib-commonjs/common/isConformant.d.ts +4 -2
  133. package/lib-commonjs/common/isConformant.js +19 -8
  134. package/lib-commonjs/common/isConformant.js.map +1 -1
  135. package/lib-commonjs/components/Button/Button.d.ts +4 -11
  136. package/lib-commonjs/components/Button/Button.js +20 -20
  137. package/lib-commonjs/components/Button/Button.js.map +1 -1
  138. package/lib-commonjs/components/Button/Button.types.d.ts +57 -60
  139. package/lib-commonjs/components/Button/Button.types.js +4 -1
  140. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  141. package/lib-commonjs/components/Button/index.d.ts +1 -2
  142. package/lib-commonjs/components/Button/index.js +21 -5
  143. package/lib-commonjs/components/Button/index.js.map +1 -1
  144. package/lib-commonjs/components/Button/renderButton.d.ts +2 -2
  145. package/lib-commonjs/components/Button/renderButton.js +24 -13
  146. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  147. package/lib-commonjs/components/Button/useButton.d.ts +5 -7
  148. package/lib-commonjs/components/Button/useButton.js +59 -24
  149. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  150. package/lib-commonjs/components/Button/useButtonStyles.d.ts +10 -4
  151. package/lib-commonjs/components/Button/useButtonStyles.js +360 -379
  152. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  153. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +6 -0
  154. package/lib-commonjs/components/CompoundButton/CompoundButton.js +26 -0
  155. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -0
  156. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +14 -0
  157. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +6 -0
  158. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -0
  159. package/lib-commonjs/components/CompoundButton/index.d.ts +5 -0
  160. package/lib-commonjs/components/CompoundButton/index.js +26 -0
  161. package/lib-commonjs/components/CompoundButton/index.js.map +1 -0
  162. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +5 -0
  163. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +29 -0
  164. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -0
  165. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +8 -0
  166. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +41 -0
  167. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
  168. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
  169. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +175 -0
  170. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
  171. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +6 -0
  172. package/lib-commonjs/components/MenuButton/MenuButton.js +26 -0
  173. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -0
  174. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +11 -0
  175. package/lib-commonjs/components/MenuButton/MenuButton.types.js +6 -0
  176. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -0
  177. package/lib-commonjs/components/MenuButton/index.d.ts +5 -0
  178. package/lib-commonjs/components/MenuButton/index.js +26 -0
  179. package/lib-commonjs/components/MenuButton/index.js.map +1 -0
  180. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +5 -0
  181. package/lib-commonjs/components/MenuButton/renderMenuButton.js +29 -0
  182. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -0
  183. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +6 -0
  184. package/lib-commonjs/components/MenuButton/useMenuButton.js +46 -0
  185. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
  186. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
  187. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +44 -0
  188. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -0
  189. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
  190. package/lib-commonjs/components/SplitButton/SplitButton.js +27 -0
  191. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
  192. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +19 -0
  193. package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
  194. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
  195. package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
  196. package/lib-commonjs/components/SplitButton/index.js +26 -0
  197. package/lib-commonjs/components/SplitButton/index.js.map +1 -0
  198. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
  199. package/lib-commonjs/components/SplitButton/renderSplitButton.js +27 -0
  200. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
  201. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +8 -0
  202. package/lib-commonjs/components/SplitButton/useSplitButton.js +86 -0
  203. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
  204. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
  205. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +88 -0
  206. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
  207. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +6 -0
  208. package/lib-commonjs/components/ToggleButton/ToggleButton.js +26 -0
  209. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -0
  210. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +19 -0
  211. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +6 -0
  212. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -0
  213. package/lib-commonjs/components/ToggleButton/index.d.ts +5 -0
  214. package/lib-commonjs/components/ToggleButton/index.js +26 -0
  215. package/lib-commonjs/components/ToggleButton/index.js.map +1 -0
  216. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -0
  217. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +16 -0
  218. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -0
  219. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +9 -0
  220. package/lib-commonjs/components/ToggleButton/useToggleButton.js +63 -0
  221. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
  222. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
  223. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +200 -0
  224. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
  225. package/lib-commonjs/index.d.ts +4 -0
  226. package/lib-commonjs/index.js +15 -2
  227. package/lib-commonjs/index.js.map +1 -1
  228. package/package.json +21 -14
  229. package/config/api-extractor.json +0 -3
  230. package/config/pre-copy.json +0 -9
  231. package/config/tests.js +0 -6
  232. package/etc/react-button.api.md +0 -104
  233. package/just.config.ts +0 -3
  234. package/lib/components/Button/useButtonState.d.ts +0 -6
  235. package/lib/components/Button/useButtonState.js +0 -45
  236. package/lib/components/Button/useButtonState.js.map +0 -1
  237. package/lib-amd/Button.d.ts +0 -1
  238. package/lib-amd/Button.js +0 -6
  239. package/lib-amd/Button.js.map +0 -1
  240. package/lib-amd/common/isConformant.d.ts +0 -2
  241. package/lib-amd/common/isConformant.js +0 -14
  242. package/lib-amd/common/isConformant.js.map +0 -1
  243. package/lib-amd/components/Button/Button.d.ts +0 -13
  244. package/lib-amd/components/Button/Button.js +0 -24
  245. package/lib-amd/components/Button/Button.js.map +0 -1
  246. package/lib-amd/components/Button/Button.types.d.ts +0 -65
  247. package/lib-amd/components/Button/Button.types.js +0 -5
  248. package/lib-amd/components/Button/Button.types.js.map +0 -1
  249. package/lib-amd/components/Button/index.d.ts +0 -6
  250. package/lib-amd/components/Button/index.js +0 -10
  251. package/lib-amd/components/Button/index.js.map +0 -1
  252. package/lib-amd/components/Button/renderButton.d.ts +0 -5
  253. package/lib-amd/components/Button/renderButton.js +0 -16
  254. package/lib-amd/components/Button/renderButton.js.map +0 -1
  255. package/lib-amd/components/Button/useButton.d.ts +0 -10
  256. package/lib-amd/components/Button/useButton.js +0 -28
  257. package/lib-amd/components/Button/useButton.js.map +0 -1
  258. package/lib-amd/components/Button/useButtonState.d.ts +0 -6
  259. package/lib-amd/components/Button/useButtonState.js +0 -48
  260. package/lib-amd/components/Button/useButtonState.js.map +0 -1
  261. package/lib-amd/components/Button/useButtonStyles.d.ts +0 -4
  262. package/lib-amd/components/Button/useButtonStyles.js +0 -385
  263. package/lib-amd/components/Button/useButtonStyles.js.map +0 -1
  264. package/lib-amd/index.d.ts +0 -1
  265. package/lib-amd/index.js +0 -6
  266. package/lib-amd/index.js.map +0 -1
  267. package/lib-commonjs/components/Button/useButtonState.d.ts +0 -6
  268. package/lib-commonjs/components/Button/useButtonState.js +0 -47
  269. package/lib-commonjs/components/Button/useButtonState.js.map +0 -1
  270. package/src/components/Button/Button.types.ts +0 -120
@@ -1,110 +1,232 @@
1
- import { ComponentProps } from '@fluentui/react-utilities';
2
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
3
- import * as React from 'react';
4
- import { ShorthandProps } from '@fluentui/react-utilities';
1
+ import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
2
+ import type { ComponentProps } from '@fluentui/react-utilities';
3
+ import type { ComponentState } from '@fluentui/react-utilities';
4
+ import { ForwardRefComponent } from '@fluentui/react-utilities';
5
+ import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
6
+ import type { MenuTriggerChildProps } from '@fluentui/react-menu';
7
+ import type { ObjectShorthandProps } from '@fluentui/react-utilities';
8
+ import * as React_2 from 'react';
5
9
 
6
10
  /**
7
- * Define a styled Button, using the `useButton` hook.
8
- * {@docCategory Button}
11
+ * Buttons give people a way to trigger an action.
9
12
  */
10
- export declare const Button: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
11
- icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
12
- disabled?: boolean | undefined;
13
- iconOnly?: boolean | undefined;
14
- iconPosition?: "after" | "before" | undefined;
15
- primary?: boolean | undefined;
16
- size?: "small" | "large" | undefined;
17
- } & React.RefAttributes<HTMLElement>>;
18
-
19
- export declare type ButtonProps = ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
20
- /**
21
- * Shorthand icon. A shorthand prop can be a literal, object, or
22
- * JSX. The `children` prop of the object can be a render function,
23
- * taking in the original slot component and props.
24
- */
25
- icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
26
- /** A button can show that it cannot be interacted with. */
27
- disabled?: boolean;
28
- /** A button can contain only an icon. */
29
- iconOnly?: boolean;
30
- /** An icon button can format its icon to appear before or after its content. */
31
- iconPosition?: 'before' | 'after';
32
- /** A button can emphasize that it represents the primary action. */
33
- primary?: boolean;
34
- /** A button can be sized. */
35
- size?: 'small' | 'large';
13
+ export declare const Button: ForwardRefComponent<ButtonProps>;
14
+
15
+ export declare type ButtonCommons = {
16
+ /**
17
+ * A button can have its content and borders styled for greater emphasis or to be subtle.
18
+ * - 'primary': Emphasizes the button as a primary action.
19
+ * - 'outline': Removes background styling.
20
+ * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
21
+ * - 'transparent': Removes background and border styling.
22
+ */
23
+ appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
24
+ /**
25
+ * A button can fill the width of its container.
26
+ * @default false
27
+ */
28
+ block: boolean;
29
+ /**
30
+ * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
31
+ * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
32
+ * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
33
+ * @default false
34
+ */
35
+ disabledFocusable: boolean;
36
+ /**
37
+ * A button can show that it cannot be interacted with.
38
+ * @default false
39
+ */
40
+ disabled: boolean;
41
+ /**
42
+ * A button can format its icon to appear before or after its content.
43
+ * @default 'before'
44
+ */
45
+ iconPosition: 'before' | 'after';
46
+ /**
47
+ * A button can be rounded, circular, or square.
48
+ * @default 'rounded'
49
+ */
50
+ shape: 'rounded' | 'circular' | 'square';
51
+ /**
52
+ * A button supports different sizes.
53
+ * @default 'medium'
54
+ */
55
+ size: 'small' | 'medium' | 'large';
56
+ };
57
+
58
+ export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
59
+
60
+ export declare type ButtonSlots = {
61
+ /**
62
+ * Root of the component that renders as either a <button> tag.
63
+ */
64
+ root: ARIAButtonShorthandProps;
65
+ /**
66
+ * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
67
+ */
68
+ icon?: IntrinsicShorthandProps<'span'>;
69
+ };
70
+
71
+ export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
72
+ /**
73
+ * A button can contain only an icon.
74
+ * @default false
75
+ */
76
+ iconOnly: boolean;
36
77
  };
37
78
 
38
79
  /**
39
- * Consts listing which props are shorthand props.
80
+ * CompoundButtons are buttons that can have secondary content that adds extra information to the user.
40
81
  */
41
- export declare const buttonShorthandProps: string[];
82
+ export declare const CompoundButton: ForwardRefComponent<CompoundButtonProps>;
83
+
84
+ export declare type CompoundButtonProps = ComponentProps<CompoundButtonSlots> & Partial<ButtonCommons>;
85
+
86
+ export declare type CompoundButtonSlots = ButtonSlots & {
87
+ /**
88
+ * Second line of text that describes the action this button takes.
89
+ */
90
+ secondaryContent?: IntrinsicShorthandProps<'span'>;
91
+ /**
92
+ * Container that wraps the children and the secondaryContent slot.
93
+ */
94
+ contentContainer: IntrinsicShorthandProps<'span'>;
95
+ };
96
+
97
+ export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components'>;
42
98
 
43
99
  /**
44
- * {@docCategory Button}
100
+ * MenuButtons are buttons that handle opening and closing a menu when they are triggered.
45
101
  */
46
- export declare interface ButtonState extends ButtonProps {
47
- ref: React.RefObject<HTMLButtonElement>;
48
- icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
49
- children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
50
- }
51
-
52
- export declare type ButtonStyleSelectors = {
53
- disabled?: boolean;
54
- iconOnly?: boolean;
55
- primary?: boolean;
56
- size?: string;
102
+ export declare const MenuButton: ForwardRefComponent<MenuButtonProps>;
103
+
104
+ export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Partial<Omit<ButtonCommons, 'iconPosition'>> & Partial<MenuTriggerChildProps>;
105
+
106
+ export declare type MenuButtonSlots = ButtonSlots & {
107
+ /**
108
+ * Menu icon that indicates that this button has a menu that can be expanded.
109
+ */
110
+ menuIcon?: IntrinsicShorthandProps<'span'>;
57
111
  };
58
112
 
59
- export declare type ButtonTokens = {
60
- height: string;
61
- paddingX: string;
62
- paddingY: string;
63
- minWidth: string;
64
- maxWidth: string;
65
- fontSize: string;
66
- fontWeight: number;
67
- lineHeight: string;
68
- iconWidth: string;
69
- iconHeight: string;
70
- iconSpacing: string;
71
- color: string;
72
- content2Color: string;
73
- background: string;
74
- backgroundHover: string;
75
- backgroundPressed: string;
76
- backgroundActive: string;
77
- borderColor: string;
78
- borderColorHover: string;
79
- borderColorActive: string;
80
- borderWidth: string;
81
- borderRadius: string;
82
- shadow: string;
83
- shadowPressed: string;
113
+ export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;
114
+
115
+ /**
116
+ * Renders a Button component by passing the state defined props to the appropriate slots.
117
+ */
118
+ declare const renderButton: (state: ButtonState) => JSX.Element;
119
+ export { renderButton }
120
+ export { renderButton as renderToggleButton }
121
+
122
+ /**
123
+ * Renders a CompoundButton component by passing the state defined props to the appropriate slots.
124
+ */
125
+ export declare const renderCompoundButton: (state: CompoundButtonState) => JSX.Element;
126
+
127
+ /**
128
+ * Renders a MenuButton component by passing the state defined props to the appropriate slots.
129
+ */
130
+ export declare const renderMenuButton: (state: MenuButtonState) => JSX.Element;
131
+
132
+ /**
133
+ * Renders a SplitButton component by passing the state defined props to the appropriate slots.
134
+ */
135
+ export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
136
+
137
+ /**
138
+ * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
139
+ * action, while interacting with the second one opens a menu with secondary actions.
140
+ */
141
+ export declare const SplitButton: ForwardRefComponent<SplitButtonProps>;
142
+
143
+ export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root'> & Omit<MenuButtonProps, 'root'>;
144
+
145
+ export declare type SplitButtonSlots = {
146
+ /**
147
+ * Root of the component that wraps the primary action button and menu button.
148
+ */
149
+ root: IntrinsicShorthandProps<'div'>;
150
+ /**
151
+ * Button that opens menu with secondary actions in SplitButton.
152
+ */
153
+ menuButton?: ObjectShorthandProps<MenuButtonProps>;
154
+ /**
155
+ * Button to perform primary action in SplitButton.
156
+ */
157
+ primaryActionButton?: ObjectShorthandProps<ButtonProps>;
84
158
  };
85
159
 
86
- export declare type ButtonVariants = 'base' | 'disabled' | 'iconOnly' | 'primary' | 'small' | 'large' | 'primaryDisabled' | 'iconOnlySmall' | 'iconOnlyLarge';
160
+ export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<ButtonState, 'components' | 'iconOnly' | 'root'> & Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;
87
161
 
88
- export declare type ButtonVariantTokens = {
89
- [variant in ButtonVariants]: Partial<ButtonTokens>;
162
+ /**
163
+ * ToggleButtons are buttons that toggle between two defined states when triggered.
164
+ */
165
+ export declare const ToggleButton: ForwardRefComponent<ToggleButtonProps>;
166
+
167
+ export declare type ToggleButtonCommons = {
168
+ /**
169
+ * Defines the controlled checked state of the `ToggleButton`.
170
+ * If passed, `ToggleButton` ignores the `defaultChecked` property.
171
+ * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
172
+ * correct value based on handling `onClick` events and re-rendering.
173
+ * @default false
174
+ */
175
+ checked: boolean;
90
176
  };
91
177
 
178
+ export declare type ToggleButtonProps = ButtonProps & Partial<ToggleButtonCommons> & {
179
+ /**
180
+ * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.
181
+ * @default false
182
+ */
183
+ defaultChecked?: boolean;
184
+ };
185
+
186
+ export declare type ToggleButtonState = ButtonState & ToggleButtonCommons;
187
+
92
188
  /**
93
- * Define the render function. Given the state of a button, renders it.
189
+ * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
190
+ * @param props - User provided props to the Button component.
191
+ * @param ref - User provided ref to be passed to the Button component.
94
192
  */
95
- export declare const renderButton: (state: ButtonState) => JSX.Element;
193
+ export declare const useButton: (props: ButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
194
+
195
+ export declare const useButtonStyles: (state: ButtonState) => ButtonState;
196
+
197
+ /**
198
+ * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
199
+ * @param props - User provided props to the CompoundButton component.
200
+ * @param ref - User provided ref to be passed to the CompoundButton component.
201
+ */
202
+ export declare const useCompoundButton: ({ contentContainer, secondaryContent, ...props }: CompoundButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonState;
203
+
204
+ export declare const useCompoundButtonStyles: (state: CompoundButtonState) => CompoundButtonState;
96
205
 
97
206
  /**
98
- * Given user props, returns state and render function for a Button.
207
+ * Given user props, returns the final state for a MenuButton.
99
208
  */
100
- export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
209
+ export declare const useMenuButton: ({ menuIcon, ...props }: MenuButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonState;
210
+
211
+ export declare const useMenuButtonStyles: (state: MenuButtonState) => MenuButtonState;
212
+
213
+ /**
214
+ * Given user props, defines default props for the SplitButton and returns processed state.
215
+ * @param props - User provided props to the SplitButton component.
216
+ * @param ref - User provided ref to be passed to the SplitButton component.
217
+ */
218
+ export declare const useSplitButton: (props: SplitButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
219
+
220
+ export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
101
221
 
102
222
  /**
103
- * The useButton hook processes the Button draft state.
104
- * @param draftState - Button draft state to mutate.
223
+ * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
224
+ * processed state.
225
+ * @param props - User provided props to the ToggleButton component.
226
+ * @param ref - User provided ref to be passed to the ToggleButton component.
105
227
  */
106
- export declare const useButtonState: (draftState: ButtonState) => void;
228
+ export declare const useToggleButton: ({ checked, defaultChecked, ...props }: ToggleButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
107
229
 
108
- export declare const useButtonStyles: (state: ButtonState, selectors: ButtonStyleSelectors) => void;
230
+ export declare const useToggleButtonStyles: (state: ToggleButtonState) => ToggleButtonState;
109
231
 
110
232
  export { }
package/lib/Button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["Button.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './components/Button/index';\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/CompoundButton/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/CompoundButton/index';
2
+ //# sourceMappingURL=CompoundButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompoundButton.js","sourceRoot":"","sources":["../src/CompoundButton.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/MenuButton/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/MenuButton/index';
2
+ //# sourceMappingURL=MenuButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../src/MenuButton.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/SplitButton/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/SplitButton/index';
2
+ //# sourceMappingURL=SplitButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitButton.js","sourceRoot":"","sources":["../src/SplitButton.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './components/ToggleButton/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/ToggleButton/index';
2
+ //# sourceMappingURL=ToggleButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../src/ToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1,2 +1,4 @@
1
- import { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant(testInfo: Omit<IsConformantOptions, 'componentPath'>): void;
1
+ import type { IsConformantOptions } from '@fluentui/react-conformance';
2
+ export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
+ componentPath?: string;
4
+ }): void;
@@ -1,10 +1,13 @@
1
1
  import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
2
+ import makeStylesTests from '@fluentui/react-conformance-make-styles';
2
3
  export function isConformant(testInfo) {
3
- var defaultOptions = {
4
- asPropHandlesRef: true,
5
- componentPath: module.parent.filename.replace('.test', ''),
6
- disabledTests: ['has-docblock', 'kebab-aria-attributes'],
7
- };
8
- baseIsConformant(defaultOptions, testInfo);
4
+ var defaultOptions = {
5
+ asPropHandlesRef: true,
6
+ componentPath: module.parent.filename.replace('.test', ''),
7
+ disabledTests: ['has-docblock', 'kebab-aria-attributes'],
8
+ extraTests: makeStylesTests,
9
+ skipAsPropTests: true
10
+ };
11
+ baseIsConformant(defaultOptions, testInfo);
9
12
  }
10
13
  //# sourceMappingURL=isConformant.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAuB,MAAM,6BAA6B,CAAC;AAEpG,MAAM,UAAU,YAAY,CAAC,QAAoD;IAC/E,IAAM,cAAc,GAAG;QACrB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5D,aAAa,EAAE,CAAC,cAAc,EAAE,uBAAuB,CAAC;KACzD,CAAC;IAEF,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import { isConformant as baseIsConformant, IsConformantOptions } from '@fluentui/react-conformance';\n\nexport function isConformant(testInfo: Omit<IsConformantOptions, 'componentPath'>) {\n const defaultOptions = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n disabledTests: ['has-docblock', 'kebab-aria-attributes'],\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
1
+ {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,aAAa,EAAE,CAAC,cAAD,EAAiB,uBAAjB,CAH4C;AAI3D,IAAA,UAAU,EAAE,eAJ+C;AAK3D,IAAA,eAAe,EAAE;AAL0C,GAA7D;AAQA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
@@ -1,13 +1,6 @@
1
- import * as React from 'react';
1
+ import type { ButtonProps } from './Button.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
2
3
  /**
3
- * Define a styled Button, using the `useButton` hook.
4
- * {@docCategory Button}
4
+ * Buttons give people a way to trigger an action.
5
5
  */
6
- export declare const Button: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
7
- icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
8
- disabled?: boolean | undefined;
9
- iconOnly?: boolean | undefined;
10
- iconPosition?: "after" | "before" | undefined;
11
- primary?: boolean | undefined;
12
- size?: "small" | "large" | undefined;
13
- } & React.RefAttributes<HTMLElement>>;
6
+ export declare const Button: ForwardRefComponent<ButtonProps>;
@@ -1,24 +1,15 @@
1
1
  import * as React from 'react';
2
- import { useButton } from './useButton';
3
2
  import { renderButton } from './renderButton';
3
+ import { useButton } from './useButton';
4
4
  import { useButtonStyles } from './useButtonStyles';
5
5
  /**
6
- * Define a styled Button, using the `useButton` hook.
7
- * {@docCategory Button}
6
+ * Buttons give people a way to trigger an action.
8
7
  */
9
- export var Button = React.forwardRef(function (props, ref) {
10
- var _a, _b;
11
- var state = useButton(props, ref);
12
- var receivedChildren = !!((_a = state.children) === null || _a === void 0 ? void 0 : _a.children);
13
- var receivedIcon = !!((_b = state.icon) === null || _b === void 0 ? void 0 : _b.children);
14
- var styleSelectors = {
15
- disabled: state.disabled,
16
- primary: state.primary,
17
- iconOnly: receivedIcon && !receivedChildren,
18
- size: state.size,
19
- };
20
- useButtonStyles(state, styleSelectors);
21
- return renderButton(state);
8
+
9
+ export var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
+ var state = useButton(props, ref);
11
+ useButtonStyles(state);
12
+ return renderButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
22
13
  });
23
14
  Button.displayName = 'Button';
24
15
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,IAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAA2B,UAAC,KAAK,EAAE,GAAG;;IAC1E,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEpC,IAAM,gBAAgB,GAAG,CAAC,QAAC,KAAK,CAAC,QAAQ,0CAAE,QAAQ,CAAA,CAAC;IACpD,IAAM,YAAY,GAAG,CAAC,QAAC,KAAK,CAAC,IAAI,0CAAE,QAAQ,CAAA,CAAC;IAE5C,IAAM,cAAc,GAAyB;QAC3C,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,YAAY,IAAI,CAAC,gBAAgB;QAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IAEF,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAEvC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { useButton } from './useButton';\nimport { ButtonProps, ButtonStyleSelectors } from './Button.types';\nimport { renderButton } from './renderButton';\nimport { useButtonStyles } from './useButtonStyles';\n\n/**\n * Define a styled Button, using the `useButton` hook.\n * {@docCategory Button}\n */\nexport const Button = React.forwardRef<HTMLElement, ButtonProps>((props, ref) => {\n const state = useButton(props, ref);\n\n const receivedChildren = !!state.children?.children;\n const receivedIcon = !!state.icon?.children;\n\n const styleSelectors: ButtonStyleSelectors = {\n disabled: state.disabled,\n primary: state.primary,\n iconOnly: receivedIcon && !receivedChildren,\n size: state.size,\n };\n\n useButtonStyles(state, styleSelectors);\n\n return renderButton(state);\n});\n\nButton.displayName = 'Button';\n"]}
1
+ {"version":3,"sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,gBAA7B;AACA,SAAS,SAAT,QAA0B,aAA1B;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAIA;;AAEG;;AACH,OAAO,IAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClF,MAAM,KAAK,GAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,CAAvB;AAEA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,YAAY,CAAC,KAAD,CAAnB,CALkF,CAMlF;AACD,CAPuD,CAAjD;AASP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourceRoot":""}
@@ -1,65 +1,62 @@
1
- import * as React from 'react';
2
- import { ComponentProps, ShorthandProps } from '@fluentui/react-utilities';
3
- import { ObjectShorthandProps } from '@fluentui/react-utilities';
4
- export declare type ButtonProps = ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
1
+ import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
2
+ import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
3
+ export declare type ButtonSlots = {
5
4
  /**
6
- * Shorthand icon. A shorthand prop can be a literal, object, or
7
- * JSX. The `children` prop of the object can be a render function,
8
- * taking in the original slot component and props.
5
+ * Root of the component that renders as either a <button> tag.
9
6
  */
10
- icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
11
- /** A button can show that it cannot be interacted with. */
12
- disabled?: boolean;
13
- /** A button can contain only an icon. */
14
- iconOnly?: boolean;
15
- /** An icon button can format its icon to appear before or after its content. */
16
- iconPosition?: 'before' | 'after';
17
- /** A button can emphasize that it represents the primary action. */
18
- primary?: boolean;
19
- /** A button can be sized. */
20
- size?: 'small' | 'large';
21
- };
22
- /**
23
- * {@docCategory Button}
24
- */
25
- export interface ButtonState extends ButtonProps {
26
- ref: React.RefObject<HTMLButtonElement>;
27
- icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
28
- children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
29
- }
30
- export declare type ButtonStyleSelectors = {
31
- disabled?: boolean;
32
- iconOnly?: boolean;
33
- primary?: boolean;
34
- size?: string;
7
+ root: ARIAButtonShorthandProps;
8
+ /**
9
+ * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
10
+ */
11
+ icon?: IntrinsicShorthandProps<'span'>;
35
12
  };
36
- export declare type ButtonVariants = 'base' | 'disabled' | 'iconOnly' | 'primary' | 'small' | 'large' | 'primaryDisabled' | 'iconOnlySmall' | 'iconOnlyLarge';
37
- export declare type ButtonTokens = {
38
- height: string;
39
- paddingX: string;
40
- paddingY: string;
41
- minWidth: string;
42
- maxWidth: string;
43
- fontSize: string;
44
- fontWeight: number;
45
- lineHeight: string;
46
- iconWidth: string;
47
- iconHeight: string;
48
- iconSpacing: string;
49
- color: string;
50
- content2Color: string;
51
- background: string;
52
- backgroundHover: string;
53
- backgroundPressed: string;
54
- backgroundActive: string;
55
- borderColor: string;
56
- borderColorHover: string;
57
- borderColorActive: string;
58
- borderWidth: string;
59
- borderRadius: string;
60
- shadow: string;
61
- shadowPressed: string;
13
+ export declare type ButtonCommons = {
14
+ /**
15
+ * A button can have its content and borders styled for greater emphasis or to be subtle.
16
+ * - 'primary': Emphasizes the button as a primary action.
17
+ * - 'outline': Removes background styling.
18
+ * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
19
+ * - 'transparent': Removes background and border styling.
20
+ */
21
+ appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
22
+ /**
23
+ * A button can fill the width of its container.
24
+ * @default false
25
+ */
26
+ block: boolean;
27
+ /**
28
+ * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
29
+ * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
30
+ * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
31
+ * @default false
32
+ */
33
+ disabledFocusable: boolean;
34
+ /**
35
+ * A button can show that it cannot be interacted with.
36
+ * @default false
37
+ */
38
+ disabled: boolean;
39
+ /**
40
+ * A button can format its icon to appear before or after its content.
41
+ * @default 'before'
42
+ */
43
+ iconPosition: 'before' | 'after';
44
+ /**
45
+ * A button can be rounded, circular, or square.
46
+ * @default 'rounded'
47
+ */
48
+ shape: 'rounded' | 'circular' | 'square';
49
+ /**
50
+ * A button supports different sizes.
51
+ * @default 'medium'
52
+ */
53
+ size: 'small' | 'medium' | 'large';
62
54
  };
63
- export declare type ButtonVariantTokens = {
64
- [variant in ButtonVariants]: Partial<ButtonTokens>;
55
+ export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
56
+ export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
57
+ /**
58
+ * A button can contain only an icon.
59
+ * @default false
60
+ */
61
+ iconOnly: boolean;
65
62
  };
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=Button.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ComponentProps, ShorthandProps } from '@fluentui/react-utilities';\nimport { ObjectShorthandProps } from '@fluentui/react-utilities';\n\nexport type ButtonProps = ComponentProps &\n React.ButtonHTMLAttributes<HTMLElement> & {\n /**\n * Shorthand icon. A shorthand prop can be a literal, object, or\n * JSX. The `children` prop of the object can be a render function,\n * taking in the original slot component and props.\n */\n icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n\n // TODO: children needs a new typing to handle render functions along with hook updates for children functionality\n // children?: ???;\n\n // /** A button can appear circular. */\n // circular?: boolean;\n\n /** A button can show that it cannot be interacted with. */\n disabled?: boolean;\n\n // /**\n // eslint-disable-next-line @fluentui/max-len\n // * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it is\n // * important to keep a consistent tab order for screen reader and keyboard users.\n // * @defaultvalue false\n // */\n // disabledFocusable?: boolean;\n\n // /** A button can fill the width of its container. */\n // block?: boolean;\n\n /** A button can contain only an icon. */\n iconOnly?: boolean;\n\n /** An icon button can format its icon to appear before or after its content. */\n iconPosition?: 'before' | 'after';\n\n // /** A button can show a loading indicator. */\n // loading?: boolean;\n\n /** A button can emphasize that it represents the primary action. */\n primary?: boolean;\n\n // /** A button can blend into its background to become less emphasized. */\n // subtle?: boolean;\n\n // /** A button can have no background styling and just be emphasized through its content styling. */\n // transparent?: boolean;\n\n /** A button can be sized. */\n size?: 'small' | 'large';\n };\n\n/**\n * {@docCategory Button}\n */\nexport interface ButtonState extends ButtonProps {\n ref: React.RefObject<HTMLButtonElement>;\n\n icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;\n}\n\nexport type ButtonStyleSelectors = {\n disabled?: boolean;\n iconOnly?: boolean;\n primary?: boolean;\n size?: string;\n};\n\nexport type ButtonVariants =\n | 'base'\n | 'disabled'\n | 'iconOnly'\n | 'primary'\n | 'small'\n | 'large'\n // TODO: get rid of these combinations, use individual variants in matchers\n | 'primaryDisabled'\n | 'iconOnlySmall'\n | 'iconOnlyLarge';\n\nexport type ButtonTokens = {\n height: string;\n paddingX: string;\n paddingY: string;\n minWidth: string;\n maxWidth: string;\n\n fontSize: string;\n fontWeight: number;\n lineHeight: string;\n\n iconWidth: string;\n iconHeight: string;\n iconSpacing: string;\n\n color: string;\n content2Color: string;\n\n background: string;\n backgroundHover: string;\n backgroundPressed: string;\n backgroundActive: string;\n\n borderColor: string;\n borderColorHover: string;\n borderColorActive: string;\n borderWidth: string;\n borderRadius: string;\n\n shadow: string;\n shadowPressed: string;\n};\n\nexport type ButtonVariantTokens = {\n [variant in ButtonVariants]: Partial<ButtonTokens>;\n};\n"]}
1
+ {"version":3,"file":"Button.types.js","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
- export * from './Button.types';
2
1
  export * from './Button';
2
+ export * from './Button.types';
3
3
  export * from './renderButton';
4
4
  export * from './useButton';
5
5
  export { useButtonStyles } from './useButtonStyles';
6
- export * from './useButtonState';
@@ -1,6 +1,6 @@
1
1
  export * from './Button';
2
+ export * from './Button.types';
2
3
  export * from './renderButton';
3
4
  export * from './useButton';
4
5
  export { useButtonStyles } from './useButtonStyles';
5
- export * from './useButtonState';
6
6
  //# sourceMappingURL=index.js.map