@fluentui/react-button 9.0.0-nightly.d730088d7f.0 → 9.0.0-rc.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. package/CHANGELOG.json +864 -27
  2. package/CHANGELOG.md +375 -181
  3. package/dist/{react-button.d.ts → index.d.ts} +97 -53
  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 +7 -7
  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 +3 -2
  14. package/lib/components/Button/index.js.map +1 -1
  15. package/lib/components/Button/renderButton.js +13 -9
  16. package/lib/components/Button/renderButton.js.map +1 -1
  17. package/lib/components/Button/useButton.js +23 -25
  18. package/lib/components/Button/useButton.js.map +1 -1
  19. package/lib/components/Button/useButtonStyles.js +248 -162
  20. package/lib/components/Button/useButtonStyles.js.map +1 -1
  21. package/lib/components/CompoundButton/CompoundButton.js +7 -7
  22. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  23. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  24. package/lib/components/CompoundButton/index.js +3 -1
  25. package/lib/components/CompoundButton/index.js.map +1 -1
  26. package/lib/components/CompoundButton/renderCompoundButton.js +15 -9
  27. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  28. package/lib/components/CompoundButton/useCompoundButton.js +13 -8
  29. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  30. package/lib/components/CompoundButton/useCompoundButtonStyles.js +101 -75
  31. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  32. package/lib/components/MenuButton/MenuButton.js +7 -7
  33. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  34. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  35. package/lib/components/MenuButton/index.js +3 -1
  36. package/lib/components/MenuButton/index.js.map +1 -1
  37. package/lib/components/MenuButton/renderMenuButton.js +13 -9
  38. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  39. package/lib/components/MenuButton/useMenuButton.js +11 -11
  40. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  41. package/lib/components/MenuButton/useMenuButtonStyles.js +44 -17
  42. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  43. package/lib/components/SplitButton/SplitButton.js +7 -7
  44. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  45. package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
  46. package/lib/components/SplitButton/index.js +3 -1
  47. package/lib/components/SplitButton/index.js.map +1 -1
  48. package/lib/components/SplitButton/renderSplitButton.js +9 -7
  49. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  50. package/lib/components/SplitButton/useSplitButton.js +58 -49
  51. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  52. package/lib/components/SplitButton/useSplitButtonStyles.js +53 -36
  53. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  54. package/lib/components/ToggleButton/ToggleButton.js +7 -7
  55. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  56. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  57. package/lib/components/ToggleButton/index.js +3 -1
  58. package/lib/components/ToggleButton/index.js.map +1 -1
  59. package/lib/components/ToggleButton/renderToggleButton.js +1 -1
  60. package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
  61. package/lib/components/ToggleButton/useToggleButton.js +5 -41
  62. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  63. package/lib/components/ToggleButton/useToggleButtonStyles.js +114 -85
  64. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  65. package/lib/index.js +11 -5
  66. package/lib/index.js.map +1 -1
  67. package/lib/utils/index.js +2 -0
  68. package/lib/utils/index.js.map +1 -0
  69. package/lib/utils/useToggleState.js +37 -0
  70. package/lib/utils/useToggleState.js.map +1 -0
  71. package/lib-commonjs/Button.js +1 -1
  72. package/lib-commonjs/Button.js.map +1 -1
  73. package/lib-commonjs/CompoundButton.js +1 -1
  74. package/lib-commonjs/CompoundButton.js.map +1 -1
  75. package/lib-commonjs/MenuButton.js +1 -1
  76. package/lib-commonjs/MenuButton.js.map +1 -1
  77. package/lib-commonjs/SplitButton.js +1 -1
  78. package/lib-commonjs/SplitButton.js.map +1 -1
  79. package/lib-commonjs/ToggleButton.js +1 -1
  80. package/lib-commonjs/ToggleButton.js.map +1 -1
  81. package/lib-commonjs/components/Button/Button.js +8 -8
  82. package/lib-commonjs/components/Button/Button.js.map +1 -1
  83. package/lib-commonjs/components/Button/Button.types.js.map +1 -1
  84. package/lib-commonjs/components/Button/index.js +18 -6
  85. package/lib-commonjs/components/Button/index.js.map +1 -1
  86. package/lib-commonjs/components/Button/renderButton.js +17 -14
  87. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  88. package/lib-commonjs/components/Button/useButton.js +27 -29
  89. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  90. package/lib-commonjs/components/Button/useButtonStyles.js +251 -163
  91. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  92. package/lib-commonjs/components/CompoundButton/CompoundButton.js +8 -8
  93. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  94. package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
  95. package/lib-commonjs/components/CompoundButton/index.js +18 -4
  96. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  97. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +19 -14
  98. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  99. package/lib-commonjs/components/CompoundButton/useCompoundButton.js +16 -12
  100. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  101. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +104 -77
  102. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  103. package/lib-commonjs/components/MenuButton/MenuButton.js +8 -8
  104. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  105. package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
  106. package/lib-commonjs/components/MenuButton/index.js +18 -4
  107. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  108. package/lib-commonjs/components/MenuButton/renderMenuButton.js +17 -14
  109. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  110. package/lib-commonjs/components/MenuButton/useMenuButton.js +15 -16
  111. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  112. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +48 -19
  113. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  114. package/lib-commonjs/components/SplitButton/SplitButton.js +8 -8
  115. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  116. package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
  117. package/lib-commonjs/components/SplitButton/index.js +18 -4
  118. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  119. package/lib-commonjs/components/SplitButton/renderSplitButton.js +13 -12
  120. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  121. package/lib-commonjs/components/SplitButton/useSplitButton.js +62 -54
  122. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  123. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +57 -39
  124. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  125. package/lib-commonjs/components/ToggleButton/ToggleButton.js +8 -8
  126. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  127. package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
  128. package/lib-commonjs/components/ToggleButton/index.js +18 -4
  129. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  130. package/lib-commonjs/components/ToggleButton/renderToggleButton.js +3 -3
  131. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  132. package/lib-commonjs/components/ToggleButton/useToggleButton.js +7 -45
  133. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  134. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +119 -86
  135. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  136. package/lib-commonjs/index.js +204 -6
  137. package/lib-commonjs/index.js.map +1 -1
  138. package/lib-commonjs/utils/index.js +10 -0
  139. package/lib-commonjs/utils/index.js.map +1 -0
  140. package/lib-commonjs/utils/useToggleState.js +48 -0
  141. package/lib-commonjs/utils/useToggleState.js.map +1 -0
  142. package/package.json +22 -27
  143. package/dist/demo/index.html +0 -71
  144. package/dist/demo/react-dom.development.js +0 -21413
  145. package/dist/demo/react.development.js +0 -3155
  146. package/lib/Button.d.ts +0 -1
  147. package/lib/CompoundButton.d.ts +0 -1
  148. package/lib/MenuButton.d.ts +0 -1
  149. package/lib/SplitButton.d.ts +0 -1
  150. package/lib/ToggleButton.d.ts +0 -1
  151. package/lib/common/isConformant.d.ts +0 -4
  152. package/lib/common/isConformant.js +0 -13
  153. package/lib/common/isConformant.js.map +0 -1
  154. package/lib/components/Button/Button.d.ts +0 -6
  155. package/lib/components/Button/Button.types.d.ts +0 -62
  156. package/lib/components/Button/index.d.ts +0 -5
  157. package/lib/components/Button/renderButton.d.ts +0 -5
  158. package/lib/components/Button/useButton.d.ts +0 -8
  159. package/lib/components/Button/useButtonStyles.d.ts +0 -10
  160. package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
  161. package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  162. package/lib/components/CompoundButton/index.d.ts +0 -5
  163. package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  164. package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
  165. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
  166. package/lib/components/MenuButton/MenuButton.d.ts +0 -6
  167. package/lib/components/MenuButton/MenuButton.types.d.ts +0 -11
  168. package/lib/components/MenuButton/index.d.ts +0 -5
  169. package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
  170. package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
  171. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
  172. package/lib/components/SplitButton/SplitButton.d.ts +0 -7
  173. package/lib/components/SplitButton/SplitButton.types.d.ts +0 -19
  174. package/lib/components/SplitButton/index.d.ts +0 -5
  175. package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
  176. package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
  177. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
  178. package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
  179. package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -19
  180. package/lib/components/ToggleButton/index.d.ts +0 -5
  181. package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
  182. package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
  183. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
  184. package/lib/index.d.ts +0 -5
  185. package/lib-commonjs/Button.d.ts +0 -1
  186. package/lib-commonjs/CompoundButton.d.ts +0 -1
  187. package/lib-commonjs/MenuButton.d.ts +0 -1
  188. package/lib-commonjs/SplitButton.d.ts +0 -1
  189. package/lib-commonjs/ToggleButton.d.ts +0 -1
  190. package/lib-commonjs/common/isConformant.d.ts +0 -4
  191. package/lib-commonjs/common/isConformant.js +0 -24
  192. package/lib-commonjs/common/isConformant.js.map +0 -1
  193. package/lib-commonjs/components/Button/Button.d.ts +0 -6
  194. package/lib-commonjs/components/Button/Button.types.d.ts +0 -62
  195. package/lib-commonjs/components/Button/index.d.ts +0 -5
  196. package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
  197. package/lib-commonjs/components/Button/useButton.d.ts +0 -8
  198. package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -10
  199. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
  200. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  201. package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
  202. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  203. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
  204. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
  205. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
  206. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -11
  207. package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
  208. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
  209. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
  210. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
  211. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
  212. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -19
  213. package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
  214. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
  215. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
  216. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
  217. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
  218. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -19
  219. package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
  220. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
  221. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
  222. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
  223. package/lib-commonjs/index.d.ts +0 -5
@@ -1,76 +1,91 @@
1
- import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
1
+ import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
2
2
  import type { ComponentProps } from '@fluentui/react-utilities';
3
3
  import type { ComponentState } from '@fluentui/react-utilities';
4
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
5
  import * as React_2 from 'react';
6
+ import type { Slot } from '@fluentui/react-utilities';
7
+ import type { SlotClassNames } from '@fluentui/react-utilities';
9
8
 
10
9
  /**
11
10
  * Buttons give people a way to trigger an action.
12
11
  */
13
12
  export declare const Button: ForwardRefComponent<ButtonProps>;
14
13
 
15
- export declare type ButtonCommons = {
14
+ /**
15
+ * @deprecated Use `buttonClassNames.root` instead.
16
+ */
17
+ export declare const buttonClassName: string;
18
+
19
+ export declare const buttonClassNames: SlotClassNames<ButtonSlots>;
20
+
21
+ export declare type ButtonProps = ComponentProps<ButtonSlots> & {
16
22
  /**
17
23
  * A button can have its content and borders styled for greater emphasis or to be subtle.
24
+ * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.
18
25
  * - 'primary': Emphasizes the button as a primary action.
19
26
  * - 'outline': Removes background styling.
20
27
  * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
21
28
  * - 'transparent': Removes background and border styling.
29
+ *
30
+ * @default 'secondary'
22
31
  */
23
- appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
32
+ appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';
24
33
  /**
25
34
  * A button can fill the width of its container.
26
35
  * @default false
36
+ *
37
+ * @deprecated - Use style overrides instead.
27
38
  */
28
- block: boolean;
39
+ block?: boolean;
29
40
  /**
30
41
  * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
31
42
  * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
32
43
  * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
44
+ *
33
45
  * @default false
34
46
  */
35
- disabledFocusable: boolean;
47
+ disabledFocusable?: boolean;
36
48
  /**
37
49
  * A button can show that it cannot be interacted with.
50
+ *
38
51
  * @default false
39
52
  */
40
- disabled: boolean;
53
+ disabled?: boolean;
41
54
  /**
42
55
  * A button can format its icon to appear before or after its content.
56
+ *
43
57
  * @default 'before'
44
58
  */
45
- iconPosition: 'before' | 'after';
59
+ iconPosition?: 'before' | 'after';
46
60
  /**
47
61
  * A button can be rounded, circular, or square.
62
+ *
48
63
  * @default 'rounded'
49
64
  */
50
- shape: 'rounded' | 'circular' | 'square';
65
+ shape?: 'rounded' | 'circular' | 'square';
51
66
  /**
52
67
  * A button supports different sizes.
68
+ *
53
69
  * @default 'medium'
54
70
  */
55
- size: 'small' | 'medium' | 'large';
71
+ size?: 'small' | 'medium' | 'large';
56
72
  };
57
73
 
58
- export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
59
-
60
74
  export declare type ButtonSlots = {
61
75
  /**
62
- * Root of the component that renders as either a <button> tag.
76
+ * Root of the component that renders as either a `<button>` tag or an `<a>` tag.
63
77
  */
64
- root: ARIAButtonShorthandProps;
78
+ root: NonNullable<Slot<ARIAButtonSlotProps>>;
65
79
  /**
66
80
  * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
67
81
  */
68
- icon?: IntrinsicShorthandProps<'span'>;
82
+ icon?: Slot<'span'>;
69
83
  };
70
84
 
71
- export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
85
+ export declare type ButtonState = ComponentState<ButtonSlots> & Required<Pick<ButtonProps, 'appearance' | 'block' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {
72
86
  /**
73
87
  * A button can contain only an icon.
88
+ *
74
89
  * @default false
75
90
  */
76
91
  iconOnly: boolean;
@@ -81,17 +96,24 @@ export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons &
81
96
  */
82
97
  export declare const CompoundButton: ForwardRefComponent<CompoundButtonProps>;
83
98
 
84
- export declare type CompoundButtonProps = ComponentProps<CompoundButtonSlots> & Partial<ButtonCommons>;
99
+ /**
100
+ * @deprecated Use `compoundButtonClassName.root` instead.
101
+ */
102
+ export declare const compoundButtonClassName: string;
103
+
104
+ export declare const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots>;
105
+
106
+ export declare type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> & Pick<ButtonProps, 'appearance' | 'block' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>;
85
107
 
86
108
  export declare type CompoundButtonSlots = ButtonSlots & {
87
109
  /**
88
110
  * Second line of text that describes the action this button takes.
89
111
  */
90
- secondaryContent?: IntrinsicShorthandProps<'span'>;
112
+ secondaryContent?: Slot<'span'>;
91
113
  /**
92
114
  * Container that wraps the children and the secondaryContent slot.
93
115
  */
94
- contentContainer: IntrinsicShorthandProps<'span'>;
116
+ contentContainer: NonNullable<Slot<'span'>>;
95
117
  };
96
118
 
97
119
  export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components'>;
@@ -101,13 +123,20 @@ export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> &
101
123
  */
102
124
  export declare const MenuButton: ForwardRefComponent<MenuButtonProps>;
103
125
 
104
- export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Partial<Omit<ButtonCommons, 'iconPosition'>> & Partial<MenuTriggerChildProps>;
126
+ /**
127
+ * @deprecated Use `menuButtonClassName.root` instead.
128
+ */
129
+ export declare const menuButtonClassName: string;
130
+
131
+ export declare const menuButtonClassNames: SlotClassNames<MenuButtonSlots>;
132
+
133
+ export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Pick<ButtonProps, 'appearance' | 'block' | 'disabledFocusable' | 'disabled' | 'shape' | 'size'>;
105
134
 
106
135
  export declare type MenuButtonSlots = ButtonSlots & {
107
136
  /**
108
137
  * Menu icon that indicates that this button has a menu that can be expanded.
109
138
  */
110
- menuIcon?: IntrinsicShorthandProps<'span'>;
139
+ menuIcon?: Slot<'span'>;
111
140
  };
112
141
 
113
142
  export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;
@@ -115,24 +144,24 @@ export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<But
115
144
  /**
116
145
  * Renders a Button component by passing the state defined props to the appropriate slots.
117
146
  */
118
- declare const renderButton: (state: ButtonState) => JSX.Element;
119
- export { renderButton }
120
- export { renderButton as renderToggleButton }
147
+ declare const renderButton_unstable: (state: ButtonState) => JSX.Element;
148
+ export { renderButton_unstable }
149
+ export { renderButton_unstable as renderToggleButton_unstable }
121
150
 
122
151
  /**
123
152
  * Renders a CompoundButton component by passing the state defined props to the appropriate slots.
124
153
  */
125
- export declare const renderCompoundButton: (state: CompoundButtonState) => JSX.Element;
154
+ export declare const renderCompoundButton_unstable: (state: CompoundButtonState) => JSX.Element;
126
155
 
127
156
  /**
128
157
  * Renders a MenuButton component by passing the state defined props to the appropriate slots.
129
158
  */
130
- export declare const renderMenuButton: (state: MenuButtonState) => JSX.Element;
159
+ export declare const renderMenuButton_unstable: (state: MenuButtonState) => JSX.Element;
131
160
 
132
161
  /**
133
162
  * Renders a SplitButton component by passing the state defined props to the appropriate slots.
134
163
  */
135
- export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
164
+ export declare const renderSplitButton_unstable: (state: SplitButtonState) => JSX.Element;
136
165
 
137
166
  /**
138
167
  * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
@@ -140,21 +169,28 @@ export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element
140
169
  */
141
170
  export declare const SplitButton: ForwardRefComponent<SplitButtonProps>;
142
171
 
172
+ /**
173
+ * @deprecated Use `splitButtonClassName.root` instead.
174
+ */
175
+ export declare const splitButtonClassName: string;
176
+
177
+ export declare const splitButtonClassNames: SlotClassNames<SplitButtonSlots>;
178
+
143
179
  export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root'> & Omit<MenuButtonProps, 'root'>;
144
180
 
145
181
  export declare type SplitButtonSlots = {
146
182
  /**
147
183
  * Root of the component that wraps the primary action button and menu button.
148
184
  */
149
- root: IntrinsicShorthandProps<'div'>;
185
+ root: NonNullable<Slot<'div'>>;
150
186
  /**
151
187
  * Button that opens menu with secondary actions in SplitButton.
152
188
  */
153
- menuButton?: ObjectShorthandProps<MenuButtonProps>;
189
+ menuButton?: Slot<typeof MenuButton>;
154
190
  /**
155
191
  * Button to perform primary action in SplitButton.
156
192
  */
157
- primaryActionButton?: ObjectShorthandProps<ButtonProps>;
193
+ primaryActionButton?: Slot<typeof Button>;
158
194
  };
159
195
 
160
196
  export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<ButtonState, 'components' | 'iconOnly' | 'root'> & Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;
@@ -164,60 +200,66 @@ export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<B
164
200
  */
165
201
  export declare const ToggleButton: ForwardRefComponent<ToggleButtonProps>;
166
202
 
167
- export declare type ToggleButtonCommons = {
203
+ /**
204
+ * @deprecated Use `toggleButtonClassName.root` instead.
205
+ */
206
+ export declare const toggleButtonClassName: string;
207
+
208
+ export declare const toggleButtonClassNames: SlotClassNames<ButtonSlots>;
209
+
210
+ export declare type ToggleButtonProps = ButtonProps & {
211
+ /**
212
+ * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.
213
+ *
214
+ * @default false
215
+ */
216
+ defaultChecked?: boolean;
168
217
  /**
169
218
  * Defines the controlled checked state of the `ToggleButton`.
170
219
  * If passed, `ToggleButton` ignores the `defaultChecked` property.
171
220
  * 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
221
  * correct value based on handling `onClick` events and re-rendering.
222
+ *
173
223
  * @default false
174
224
  */
175
- checked: boolean;
225
+ checked?: boolean;
176
226
  };
177
227
 
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;
228
+ export declare type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;
187
229
 
188
230
  /**
189
231
  * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
190
232
  * @param props - User provided props to the Button component.
191
233
  * @param ref - User provided ref to be passed to the Button component.
192
234
  */
193
- export declare const useButton: (props: ButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
235
+ export declare const useButton_unstable: (props: ButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
194
236
 
195
- export declare const useButtonStyles: (state: ButtonState) => ButtonState;
237
+ export declare const useButtonStyles_unstable: (state: ButtonState) => ButtonState;
196
238
 
197
239
  /**
198
240
  * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
199
241
  * @param props - User provided props to the CompoundButton component.
200
242
  * @param ref - User provided ref to be passed to the CompoundButton component.
201
243
  */
202
- export declare const useCompoundButton: ({ contentContainer, secondaryContent, ...props }: CompoundButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonState;
244
+ export declare const useCompoundButton_unstable: ({ contentContainer, secondaryContent, ...props }: CompoundButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonState;
203
245
 
204
- export declare const useCompoundButtonStyles: (state: CompoundButtonState) => CompoundButtonState;
246
+ export declare const useCompoundButtonStyles_unstable: (state: CompoundButtonState) => CompoundButtonState;
205
247
 
206
248
  /**
207
249
  * Given user props, returns the final state for a MenuButton.
208
250
  */
209
- export declare const useMenuButton: ({ menuIcon, ...props }: MenuButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonState;
251
+ export declare const useMenuButton_unstable: ({ menuIcon, ...props }: MenuButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonState;
210
252
 
211
- export declare const useMenuButtonStyles: (state: MenuButtonState) => MenuButtonState;
253
+ export declare const useMenuButtonStyles_unstable: (state: MenuButtonState) => MenuButtonState;
212
254
 
213
255
  /**
214
256
  * Given user props, defines default props for the SplitButton and returns processed state.
215
257
  * @param props - User provided props to the SplitButton component.
216
258
  * @param ref - User provided ref to be passed to the SplitButton component.
217
259
  */
218
- export declare const useSplitButton: (props: SplitButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
260
+ export declare const useSplitButton_unstable: (props: SplitButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
219
261
 
220
- export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
262
+ export declare const useSplitButtonStyles_unstable: (state: SplitButtonState) => SplitButtonState;
221
263
 
222
264
  /**
223
265
  * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
@@ -225,8 +267,10 @@ export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitBut
225
267
  * @param props - User provided props to the ToggleButton component.
226
268
  * @param ref - User provided ref to be passed to the ToggleButton component.
227
269
  */
228
- export declare const useToggleButton: ({ checked, defaultChecked, ...props }: ToggleButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
270
+ export declare const useToggleButton_unstable: (props: ToggleButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
271
+
272
+ export declare const useToggleButtonStyles_unstable: (state: ToggleButtonState) => ToggleButtonState;
229
273
 
230
- export declare const useToggleButtonStyles: (state: ToggleButtonState) => ToggleButtonState;
274
+ export declare function useToggleState<TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>, TButtonState extends Pick<ButtonState, 'root'>, TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState;
231
275
 
232
276
  export { }
File without changes
package/lib/Button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
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 +1 @@
1
- {"version":3,"file":"CompoundButton.js","sourceRoot":"","sources":["../src/CompoundButton.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"CompoundButton.js","sourceRoot":"../src/","sources":["CompoundButton.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/CompoundButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../src/MenuButton.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"MenuButton.js","sourceRoot":"../src/","sources":["MenuButton.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC","sourcesContent":["export * from './components/MenuButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SplitButton.js","sourceRoot":"","sources":["../src/SplitButton.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"SplitButton.js","sourceRoot":"../src/","sources":["SplitButton.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/SplitButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../src/ToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"ToggleButton.js","sourceRoot":"../src/","sources":["ToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './components/ToggleButton/index';\n"]}
@@ -1,15 +1,15 @@
1
1
  import * as React from 'react';
2
- import { renderButton } from './renderButton';
3
- import { useButton } from './useButton';
4
- import { useButtonStyles } from './useButtonStyles';
2
+ import { renderButton_unstable } from './renderButton';
3
+ import { useButton_unstable } from './useButton';
4
+ import { useButtonStyles_unstable } from './useButtonStyles';
5
5
  /**
6
6
  * Buttons give people a way to trigger an action.
7
7
  */
8
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
9
+ export const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useButton_unstable(props, ref);
11
+ useButtonStyles_unstable(state);
12
+ return renderButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
13
13
  });
14
14
  Button.displayName = 'Button';
15
15
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA;;AAEG;;AACH,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;AAEA,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AAEA,SAAO,qBAAqB,CAAC,KAAD,CAA5B,CALsF,CAMtF;AACD,CAPuD,CAAjD;AASP,MAAM,CAAC,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,"file":"Button.types.js","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * A button can fill the width of its container.\n * @default false\n *\n * @deprecated - Use style overrides instead.\n */\n block?: boolean;\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n};\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<\n Pick<ButtonProps, 'appearance' | 'block' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>\n > & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n"]}
@@ -1,6 +1,7 @@
1
1
  export * from './Button';
2
- export * from './Button.types';
3
2
  export * from './renderButton';
4
3
  export * from './useButton';
5
- export { useButtonStyles } from './useButtonStyles';
4
+ export {
5
+ /* eslint-disable-next-line deprecation/deprecation */
6
+ buttonClassName, buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"sources":["components/Button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAd;AAGA,cAAc,gBAAd;AACA,cAAc,aAAd;AACA;AACE;AACA,eAFF,EAGE,gBAHF,EAIE,wBAJF,QAKO,mBALP","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,17 +1,21 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { getSlots } from '@fluentui/react-utilities';
4
3
  /**
5
4
  * Renders a Button component by passing the state defined props to the appropriate slots.
6
5
  */
7
6
 
8
- export var renderButton = function (state) {
9
- var _a = getSlots(state, ['root', 'icon']),
10
- slots = _a.slots,
11
- slotProps = _a.slotProps;
12
-
13
- var iconOnly = state.iconOnly,
14
- iconPosition = state.iconPosition;
15
- return /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), iconPosition !== 'after' && /*#__PURE__*/React.createElement(slots.icon, __assign({}, slotProps.icon)), !iconOnly && state.root.children, iconPosition === 'after' && /*#__PURE__*/React.createElement(slots.icon, __assign({}, slotProps.icon)));
7
+ export const renderButton_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ const {
13
+ iconOnly,
14
+ iconPosition
15
+ } = state;
16
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
17
+ }, iconPosition !== 'after' && slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
18
+ }), !iconOnly && state.root.children, iconPosition === 'after' && slots.icon && /*#__PURE__*/React.createElement(slots.icon, { ...slotProps.icon
19
+ }));
16
20
  };
17
21
  //# sourceMappingURL=renderButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/renderButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,QAAQ,CAAc,KAAd,EAAqB,CAAC,MAAD,EAAS,MAAT,CAArB,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAAmB,KAAK,CAAxB,QAAR;AAAA,MAAU,YAAY,GAAK,KAAK,CAAV,YAAtB;AAER,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IAAa,KAAK,CAAC,IAAN,CAAW,QAF3B,EAGG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAH/B,CADF;AAOD,CAXM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,qBAAqB,GAAI,KAAD,IAAuB;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAc,KAAd,CAArC;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA6B,KAAnC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,iBAA0C,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,iBAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAH7C,CADF;AAOD,CAXM","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/"}
@@ -6,32 +6,29 @@ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utiliti
6
6
  * @param ref - User provided ref to be passed to the Button component.
7
7
  */
8
8
 
9
- export var useButton = function (props, ref) {
10
- var appearance = props.appearance,
11
- as = props.as,
12
- _a = props.block,
13
- block = _a === void 0 ? false : _a,
14
- _b = props.disabled,
15
- disabled = _b === void 0 ? false : _b,
16
- _c = props.disabledFocusable,
17
- disabledFocusable = _c === void 0 ? false : _c,
18
- icon = props.icon,
19
- _d = props.iconPosition,
20
- iconPosition = _d === void 0 ? 'before' : _d,
21
- _e = props.shape,
22
- shape = _e === void 0 ? 'rounded' : _e,
23
- _f = props.size,
24
- size = _f === void 0 ? 'medium' : _f;
25
- var iconShorthand = resolveShorthand(icon);
9
+ export const useButton_unstable = (props, ref) => {
10
+ const {
11
+ appearance = 'secondary',
12
+ as,
13
+ // eslint-disable-next-line deprecation/deprecation
14
+ block = false,
15
+ disabled = false,
16
+ disabledFocusable = false,
17
+ icon,
18
+ iconPosition = 'before',
19
+ shape = 'rounded',
20
+ size = 'medium'
21
+ } = props;
22
+ const iconShorthand = resolveShorthand(icon);
26
23
  return {
27
24
  // Props passed at the top-level
28
- appearance: appearance,
29
- block: block,
30
- disabled: disabled,
31
- disabledFocusable: disabledFocusable,
32
- iconPosition: iconPosition,
33
- shape: shape,
34
- size: size,
25
+ appearance,
26
+ block,
27
+ disabled,
28
+ disabledFocusable,
29
+ iconPosition,
30
+ shape,
31
+ size,
35
32
  // State calculated from a set of props
36
33
  iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
37
34
  // Slots definition
@@ -44,7 +41,8 @@ export var useButton = function (props, ref) {
44
41
  defaultProps: {
45
42
  // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>
46
43
  ref: ref,
47
- type: 'button'
44
+ type: 'button' // This is added because the default for type is 'submit'
45
+
48
46
  }
49
47
  })),
50
48
  icon: iconShorthand
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,QAA8B,sBAA9B;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;;;AAIG;;AACH,OAAO,IAAM,SAAS,GAAG,UAAC,KAAD,EAAqB,GAArB,EAA0E;AAE/F,MAAA,UAAU,GASR,KAAK,CATG,UAAV;AAAA,MACA,EAAE,GAQA,KAAK,CARL,EADF;AAAA,MAEA,EAAA,GAOE,KAAK,CAPM,KAFb;AAAA,MAEA,KAAK,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAFb;AAAA,MAGA,EAAA,GAME,KAAK,CANS,QAHhB;AAAA,MAGA,QAAQ,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAHhB;AAAA,MAIA,EAAA,GAKE,KAAK,CALkB,iBAJzB;AAAA,MAIA,iBAAiB,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,KAAH,GAAQ,EAJzB;AAAA,MAKA,IAAI,GAIF,KAAK,CAJH,IALJ;AAAA,MAMA,EAAA,GAGE,KAAK,CAHgB,YANvB;AAAA,MAMA,YAAY,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EANvB;AAAA,MAOA,EAAA,GAEE,KAAK,CAFU,KAPjB;AAAA,MAOA,KAAK,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,SAAH,GAAY,EAPjB;AAAA,MAQA,EAAA,GACE,KAAK,CADQ,IARf;AAAA,MAQA,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAH,GAAW,EARf;AAUF,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;AAEA,SAAO;AACL;AACA,IAAA,UAAU,EAAA,UAFL;AAGL,IAAA,KAAK,EAAA,KAHA;AAIL,IAAA,QAAQ,EAAA,QAJH;AAKL,IAAA,iBAAiB,EAAA,iBALZ;AAML,IAAA,YAAY,EAAA,YANP;AAOL,IAAA,KAAK,EAAA,KAPA;AAQL,IAAA,IAAI,EAAA,IARC;AAUL;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,CAXZ;AAaL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE;AAFI,KAdP;AAmBL,IAAA,IAAI,EAAE,qBAAqB,CACzB,EAAE,IAAI,QADmB,EAEzB,aAAa,CAAC,KAAD,EAAQ;AACnB,MAAA,QAAQ,EAAE,IADS;AAEnB,MAAA,YAAY,EAAE;AACZ;AACA,QAAA,GAAG,EAAE,GAFO;AAGZ,QAAA,IAAI,EAAE;AAHM;AAFK,KAAR,CAFY,CAnBtB;AA8BL,IAAA,IAAI,EAAE;AA9BD,GAAP;AAgCD,CA9CM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,QAA8B,sBAA9B;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAIA;;;;AAIG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;AACf,QAAM;AACJ,IAAA,UAAU,GAAG,WADT;AAEJ,IAAA,EAFI;AAGJ;AACA,IAAA,KAAK,GAAG,KAJJ;AAKJ,IAAA,QAAQ,GAAG,KALP;AAMJ,IAAA,iBAAiB,GAAG,KANhB;AAOJ,IAAA,IAPI;AAQJ,IAAA,YAAY,GAAG,QARX;AASJ,IAAA,KAAK,GAAG,SATJ;AAUJ,IAAA,IAAI,GAAG;AAVH,MAWF,KAXJ;AAYA,QAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;AAEA,SAAO;AACL;AACA,IAAA,UAFK;AAGL,IAAA,KAHK;AAIL,IAAA,QAJK;AAKL,IAAA,iBALK;AAML,IAAA,YANK;AAOL,IAAA,KAPK;AAQL,IAAA,IARK;AAUL;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,CAXZ;AAaL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE;AAFI,KAdP;AAmBL,IAAA,IAAI,EAAE,qBAAqB,CACzB,EAAE,IAAI,QADmB,EAEzB,aAAa,CAAsB,KAAtB,EAA6B;AACxC,MAAA,QAAQ,EAAE,IAD8B;AAExC,MAAA,YAAY,EAAE;AACZ;AACA,QAAA,GAAG,EAAE,GAFO;AAGZ,QAAA,IAAI,EAAE,QAHM,CAGI;;AAHJ;AAF0B,KAA7B,CAFY,CAnBtB;AA8BL,IAAA,IAAI,EAAE;AA9BD,GAAP;AAgCD,CAlDM","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/"}