@fluentui/react-button 9.0.0-rc.8 → 9.0.1

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 (169) hide show
  1. package/CHANGELOG.json +385 -1
  2. package/CHANGELOG.md +118 -2
  3. package/README.md +81 -19
  4. package/dist/index.d.ts +32 -55
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/components/Button/Button.js.map +1 -1
  7. package/lib/components/Button/Button.types.js.map +1 -1
  8. package/lib/components/Button/index.js +1 -3
  9. package/lib/components/Button/index.js.map +1 -1
  10. package/lib/components/Button/renderButton.js.map +1 -1
  11. package/lib/components/Button/useButton.js +1 -4
  12. package/lib/components/Button/useButton.js.map +1 -1
  13. package/lib/components/Button/useButtonStyles.js +146 -68
  14. package/lib/components/Button/useButtonStyles.js.map +1 -1
  15. package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
  16. package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
  17. package/lib/components/CompoundButton/index.js +1 -3
  18. package/lib/components/CompoundButton/index.js.map +1 -1
  19. package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
  20. package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
  21. package/lib/components/CompoundButton/useCompoundButtonStyles.js +47 -35
  22. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  23. package/lib/components/MenuButton/MenuButton.js +2 -1
  24. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  25. package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
  26. package/lib/components/MenuButton/index.js +1 -3
  27. package/lib/components/MenuButton/index.js.map +1 -1
  28. package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
  29. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  30. package/lib/components/MenuButton/useMenuButtonStyles.js +24 -17
  31. package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  32. package/lib/components/SplitButton/SplitButton.js +1 -1
  33. package/lib/components/SplitButton/SplitButton.js.map +1 -1
  34. package/lib/components/SplitButton/index.js +1 -3
  35. package/lib/components/SplitButton/index.js.map +1 -1
  36. package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
  37. package/lib/components/SplitButton/useSplitButton.js +1 -5
  38. package/lib/components/SplitButton/useSplitButton.js.map +1 -1
  39. package/lib/components/SplitButton/useSplitButtonStyles.js +15 -17
  40. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  41. package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
  42. package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
  43. package/lib/components/ToggleButton/index.js +1 -3
  44. package/lib/components/ToggleButton/index.js.map +1 -1
  45. package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
  46. package/lib/components/ToggleButton/useToggleButtonStyles.js +93 -9
  47. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  48. package/lib/index.js +5 -10
  49. package/lib/index.js.map +1 -1
  50. package/lib/utils/useToggleState.js.map +1 -1
  51. package/lib-commonjs/components/Button/Button.js.map +1 -1
  52. package/lib-commonjs/components/Button/index.js +1 -9
  53. package/lib-commonjs/components/Button/index.js.map +1 -1
  54. package/lib-commonjs/components/Button/renderButton.js.map +1 -1
  55. package/lib-commonjs/components/Button/useButton.js +1 -4
  56. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  57. package/lib-commonjs/components/Button/useButtonStyles.js +147 -69
  58. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  59. package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
  60. package/lib-commonjs/components/CompoundButton/index.js +1 -9
  61. package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
  62. package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
  63. package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
  64. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +49 -37
  65. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  66. package/lib-commonjs/components/MenuButton/MenuButton.js +2 -1
  67. package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
  68. package/lib-commonjs/components/MenuButton/index.js +1 -9
  69. package/lib-commonjs/components/MenuButton/index.js.map +1 -1
  70. package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
  71. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  72. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +26 -18
  73. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
  74. package/lib-commonjs/components/SplitButton/SplitButton.js +1 -1
  75. package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
  76. package/lib-commonjs/components/SplitButton/index.js +1 -9
  77. package/lib-commonjs/components/SplitButton/index.js.map +1 -1
  78. package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
  79. package/lib-commonjs/components/SplitButton/useSplitButton.js +1 -5
  80. package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
  81. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +16 -18
  82. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  83. package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
  84. package/lib-commonjs/components/ToggleButton/index.js +1 -9
  85. package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
  86. package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
  87. package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
  88. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +95 -10
  89. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  90. package/lib-commonjs/index.js +1 -36
  91. package/lib-commonjs/index.js.map +1 -1
  92. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  93. package/package.json +11 -13
  94. package/lib/Button.d.ts +0 -1
  95. package/lib/CompoundButton.d.ts +0 -1
  96. package/lib/MenuButton.d.ts +0 -1
  97. package/lib/SplitButton.d.ts +0 -1
  98. package/lib/ToggleButton.d.ts +0 -1
  99. package/lib/components/Button/Button.d.ts +0 -6
  100. package/lib/components/Button/Button.types.d.ts +0 -64
  101. package/lib/components/Button/index.d.ts +0 -5
  102. package/lib/components/Button/renderButton.d.ts +0 -5
  103. package/lib/components/Button/useButton.d.ts +0 -8
  104. package/lib/components/Button/useButtonStyles.d.ts +0 -8
  105. package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
  106. package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  107. package/lib/components/CompoundButton/index.d.ts +0 -5
  108. package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  109. package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
  110. package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -8
  111. package/lib/components/MenuButton/MenuButton.d.ts +0 -6
  112. package/lib/components/MenuButton/MenuButton.types.d.ts +0 -10
  113. package/lib/components/MenuButton/index.d.ts +0 -5
  114. package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
  115. package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
  116. package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -8
  117. package/lib/components/SplitButton/SplitButton.d.ts +0 -7
  118. package/lib/components/SplitButton/SplitButton.types.d.ts +0 -21
  119. package/lib/components/SplitButton/index.d.ts +0 -5
  120. package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
  121. package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
  122. package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -8
  123. package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
  124. package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  125. package/lib/components/ToggleButton/index.d.ts +0 -5
  126. package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
  127. package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
  128. package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -11
  129. package/lib/index.d.ts +0 -11
  130. package/lib/utils/index.d.ts +0 -1
  131. package/lib/utils/useToggleState.d.ts +0 -3
  132. package/lib-commonjs/Button.d.ts +0 -1
  133. package/lib-commonjs/CompoundButton.d.ts +0 -1
  134. package/lib-commonjs/MenuButton.d.ts +0 -1
  135. package/lib-commonjs/SplitButton.d.ts +0 -1
  136. package/lib-commonjs/ToggleButton.d.ts +0 -1
  137. package/lib-commonjs/components/Button/Button.d.ts +0 -6
  138. package/lib-commonjs/components/Button/Button.types.d.ts +0 -64
  139. package/lib-commonjs/components/Button/index.d.ts +0 -5
  140. package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
  141. package/lib-commonjs/components/Button/useButton.d.ts +0 -8
  142. package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -8
  143. package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
  144. package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
  145. package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
  146. package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
  147. package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
  148. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -8
  149. package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
  150. package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -10
  151. package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
  152. package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
  153. package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
  154. package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -8
  155. package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
  156. package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -21
  157. package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
  158. package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
  159. package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
  160. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -8
  161. package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
  162. package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -20
  163. package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
  164. package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
  165. package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
  166. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -11
  167. package/lib-commonjs/index.d.ts +0 -11
  168. package/lib-commonjs/utils/index.d.ts +0 -1
  169. package/lib-commonjs/utils/useToggleState.d.ts +0 -3
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
2
+
1
3
  import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
2
4
  import type { ComponentProps } from '@fluentui/react-utilities';
3
5
  import type { ComponentState } from '@fluentui/react-utilities';
@@ -11,60 +13,54 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
11
13
  */
12
14
  export declare const Button: ForwardRefComponent<ButtonProps>;
13
15
 
14
- /**
15
- * @deprecated Use `buttonClassNames.root` instead.
16
- */
17
- export declare const buttonClassName: string;
18
-
19
16
  export declare const buttonClassNames: SlotClassNames<ButtonSlots>;
20
17
 
21
- declare type ButtonCommons = {
18
+ export declare type ButtonProps = ComponentProps<ButtonSlots> & {
22
19
  /**
23
20
  * A button can have its content and borders styled for greater emphasis or to be subtle.
21
+ * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.
24
22
  * - 'primary': Emphasizes the button as a primary action.
25
23
  * - 'outline': Removes background styling.
26
24
  * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
27
25
  * - 'transparent': Removes background and border styling.
28
- */
29
- appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
30
- /**
31
- * A button can fill the width of its container.
32
- * @default false
33
26
  *
34
- * @deprecated - Use style overrides instead.
27
+ * @default 'secondary'
35
28
  */
36
- block: boolean;
29
+ appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';
37
30
  /**
38
31
  * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
39
32
  * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
40
33
  * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
34
+ *
41
35
  * @default false
42
36
  */
43
- disabledFocusable: boolean;
37
+ disabledFocusable?: boolean;
44
38
  /**
45
39
  * A button can show that it cannot be interacted with.
40
+ *
46
41
  * @default false
47
42
  */
48
- disabled: boolean;
43
+ disabled?: boolean;
49
44
  /**
50
45
  * A button can format its icon to appear before or after its content.
46
+ *
51
47
  * @default 'before'
52
48
  */
53
49
  iconPosition?: 'before' | 'after';
54
50
  /**
55
51
  * A button can be rounded, circular, or square.
52
+ *
56
53
  * @default 'rounded'
57
54
  */
58
- shape: 'rounded' | 'circular' | 'square';
55
+ shape?: 'rounded' | 'circular' | 'square';
59
56
  /**
60
57
  * A button supports different sizes.
58
+ *
61
59
  * @default 'medium'
62
60
  */
63
- size: 'small' | 'medium' | 'large';
61
+ size?: 'small' | 'medium' | 'large';
64
62
  };
65
63
 
66
- export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
67
-
68
64
  export declare type ButtonSlots = {
69
65
  /**
70
66
  * Root of the component that renders as either a `<button>` tag or an `<a>` tag.
@@ -76,9 +72,10 @@ export declare type ButtonSlots = {
76
72
  icon?: Slot<'span'>;
77
73
  };
78
74
 
79
- export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
75
+ export declare type ButtonState = ComponentState<ButtonSlots> & Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {
80
76
  /**
81
77
  * A button can contain only an icon.
78
+ *
82
79
  * @default false
83
80
  */
84
81
  iconOnly: boolean;
@@ -89,14 +86,9 @@ export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons &
89
86
  */
90
87
  export declare const CompoundButton: ForwardRefComponent<CompoundButtonProps>;
91
88
 
92
- /**
93
- * @deprecated Use `compoundButtonClassName.root` instead.
94
- */
95
- export declare const compoundButtonClassName: string;
96
-
97
89
  export declare const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots>;
98
90
 
99
- export declare type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> & Partial<ButtonCommons>;
91
+ export declare type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> & Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>;
100
92
 
101
93
  export declare type CompoundButtonSlots = ButtonSlots & {
102
94
  /**
@@ -112,18 +104,14 @@ export declare type CompoundButtonSlots = ButtonSlots & {
112
104
  export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components'>;
113
105
 
114
106
  /**
115
- * MenuButtons are buttons that handle opening and closing a menu when they are triggered.
107
+ * MenuButtons are buttons that have a chevron icon after the button contents and are usually clicked to open/close
108
+ * menus.
116
109
  */
117
110
  export declare const MenuButton: ForwardRefComponent<MenuButtonProps>;
118
111
 
119
- /**
120
- * @deprecated Use `menuButtonClassName.root` instead.
121
- */
122
- export declare const menuButtonClassName: string;
123
-
124
112
  export declare const menuButtonClassNames: SlotClassNames<MenuButtonSlots>;
125
113
 
126
- export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Partial<Omit<ButtonCommons, 'iconPosition'>>;
114
+ export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'shape' | 'size'>;
127
115
 
128
116
  export declare type MenuButtonSlots = ButtonSlots & {
129
117
  /**
@@ -157,16 +145,11 @@ export declare const renderMenuButton_unstable: (state: MenuButtonState) => JSX.
157
145
  export declare const renderSplitButton_unstable: (state: SplitButtonState) => JSX.Element;
158
146
 
159
147
  /**
160
- * SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
148
+ * SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary
161
149
  * action, while interacting with the second one opens a menu with secondary actions.
162
150
  */
163
151
  export declare const SplitButton: ForwardRefComponent<SplitButtonProps>;
164
152
 
165
- /**
166
- * @deprecated Use `splitButtonClassName.root` instead.
167
- */
168
- export declare const splitButtonClassName: string;
169
-
170
153
  export declare const splitButtonClassNames: SlotClassNames<SplitButtonSlots>;
171
154
 
172
155
  export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root'> & Omit<MenuButtonProps, 'root'>;
@@ -193,33 +176,27 @@ export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<B
193
176
  */
194
177
  export declare const ToggleButton: ForwardRefComponent<ToggleButtonProps>;
195
178
 
196
- /**
197
- * @deprecated Use `toggleButtonClassName.root` instead.
198
- */
199
- export declare const toggleButtonClassName: string;
200
-
201
179
  export declare const toggleButtonClassNames: SlotClassNames<ButtonSlots>;
202
180
 
203
- declare type ToggleButtonCommons = {
181
+ export declare type ToggleButtonProps = ButtonProps & {
182
+ /**
183
+ * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.
184
+ *
185
+ * @default false
186
+ */
187
+ defaultChecked?: boolean;
204
188
  /**
205
189
  * Defines the controlled checked state of the `ToggleButton`.
206
190
  * If passed, `ToggleButton` ignores the `defaultChecked` property.
207
191
  * 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
208
192
  * correct value based on handling `onClick` events and re-rendering.
193
+ *
209
194
  * @default false
210
195
  */
211
- checked: boolean;
212
- };
213
-
214
- export declare type ToggleButtonProps = ButtonProps & Partial<ToggleButtonCommons> & {
215
- /**
216
- * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.
217
- * @default false
218
- */
219
- defaultChecked?: boolean;
196
+ checked?: boolean;
220
197
  };
221
198
 
222
- export declare type ToggleButtonState = ButtonState & ToggleButtonCommons;
199
+ export declare type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;
223
200
 
224
201
  /**
225
202
  * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
File without changes
@@ -1 +1 @@
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
+ {"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;EACtF,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;EAEA,wBAAwB,CAAC,KAAD,CAAxB;EAEA,OAAO,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":"../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 ButtonCommons = {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\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 appearance?: '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 * @default false\n */\n disabledFocusable: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n * @default false\n */\n disabled: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n * @default 'rounded'\n */\n shape: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n * @default 'medium'\n */\n size: 'small' | 'medium' | 'large';\n};\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n ButtonCommons & {\n /**\n * A button can contain only an icon.\n * @default false\n */\n iconOnly: boolean;\n };\n"]}
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 * 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<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n"]}
@@ -1,7 +1,5 @@
1
1
  export * from './Button';
2
2
  export * from './renderButton';
3
3
  export * from './useButton';
4
- export {
5
- /* eslint-disable-next-line deprecation/deprecation */
6
- buttonClassName, buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';
4
+ export { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';
7
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAGzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export * from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport * from './renderButton';\nexport * from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles';\n"]}
@@ -1 +1 @@
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/"}
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;EAC1D,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAc,KAAd,CAArC;EACA,MAAM;IAAE,QAAF;IAAY;EAAZ,IAA6B,KAAnC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,iBAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,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;EAAf,CAAX,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/"}
@@ -8,10 +8,8 @@ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utiliti
8
8
 
9
9
  export const useButton_unstable = (props, ref) => {
10
10
  const {
11
- appearance,
11
+ appearance = 'secondary',
12
12
  as,
13
- // eslint-disable-next-line deprecation/deprecation
14
- block = false,
15
13
  disabled = false,
16
14
  disabledFocusable = false,
17
15
  icon,
@@ -23,7 +21,6 @@ export const useButton_unstable = (props, ref) => {
23
21
  return {
24
22
  // Props passed at the top-level
25
23
  appearance,
26
- block,
27
24
  disabled,
28
25
  disabledFocusable,
29
26
  iconPosition,
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,QAA8B,sBAA9B;AAEA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;;;AAIG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;AACf,QAAM;AACJ,IAAA,UADI;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 type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\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,\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/"}
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;EACf,MAAM;IACJ,UAAU,GAAG,WADT;IAEJ,EAFI;IAGJ,QAAQ,GAAG,KAHP;IAIJ,iBAAiB,GAAG,KAJhB;IAKJ,IALI;IAMJ,YAAY,GAAG,QANX;IAOJ,KAAK,GAAG,SAPJ;IAQJ,IAAI,GAAG;EARH,IASF,KATJ;EAUA,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;EAEA,OAAO;IACL;IACA,UAFK;IAGL,QAHK;IAIL,iBAJK;IAKL,YALK;IAML,KANK;IAOL,IAPK;IASL;IACA,QAAQ,EAAE,OAAO,CAAC,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,QAAf,KAA2B,CAAC,KAAK,CAAC,QAAnC,CAVZ;IAYL;IACA,UAAU,EAAE;MACV,IAAI,EAAE,QADI;MAEV,IAAI,EAAE;IAFI,CAbP;IAkBL,IAAI,EAAE,qBAAqB,CACzB,EAAE,IAAI,QADmB,EAEzB,aAAa,CAAsB,KAAtB,EAA6B;MACxC,QAAQ,EAAE,IAD8B;MAExC,YAAY,EAAE;QACZ;QACA,GAAG,EAAE,GAFO;QAGZ,IAAI,EAAE,QAHM,CAGI;;MAHJ;IAF0B,CAA7B,CAFY,CAlBtB;IA6BL,IAAI,EAAE;EA7BD,CAAP;AA+BD,CA/CM","sourcesContent":["import * as React from 'react';\nimport { useARIAButton } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const {\n appearance = 'secondary',\n as,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = 'medium',\n } = props;\n const iconShorthand = resolveShorthand(icon);\n\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n },\n\n root: getNativeElementProps(\n as || 'button',\n useARIAButton<ARIAButtonSlotProps>(props, {\n required: true,\n defaultProps: {\n // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>\n ref: ref as React.Ref<HTMLButtonElement>,\n type: 'button', // This is added because the default for type is 'submit'\n },\n }),\n ),\n icon: iconShorthand,\n };\n};\n"],"sourceRoot":"../src/"}