@fluentui/react-button 9.0.0-rc.8 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +385 -1
- package/CHANGELOG.md +118 -2
- package/README.md +81 -19
- package/dist/index.d.ts +32 -55
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js +1 -3
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +1 -4
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +146 -68
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js +1 -3
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +47 -35
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +2 -1
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js +1 -3
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +24 -17
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +1 -1
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/index.js +1 -3
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +1 -5
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js +15 -17
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js +1 -3
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +93 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.js +5 -10
- package/lib/index.js.map +1 -1
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +1 -9
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +1 -4
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +147 -69
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +1 -9
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +49 -37
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +2 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +1 -9
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +26 -18
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +1 -9
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +1 -5
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +16 -18
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +1 -9
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +95 -10
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -36
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/useToggleState.js.map +1 -1
- package/package.json +11 -13
- package/lib/Button.d.ts +0 -1
- package/lib/CompoundButton.d.ts +0 -1
- package/lib/MenuButton.d.ts +0 -1
- package/lib/SplitButton.d.ts +0 -1
- package/lib/ToggleButton.d.ts +0 -1
- package/lib/components/Button/Button.d.ts +0 -6
- package/lib/components/Button/Button.types.d.ts +0 -64
- package/lib/components/Button/index.d.ts +0 -5
- package/lib/components/Button/renderButton.d.ts +0 -5
- package/lib/components/Button/useButton.d.ts +0 -8
- package/lib/components/Button/useButtonStyles.d.ts +0 -8
- package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib/components/CompoundButton/index.d.ts +0 -5
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -8
- package/lib/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib/components/MenuButton/MenuButton.types.d.ts +0 -10
- package/lib/components/MenuButton/index.d.ts +0 -5
- package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -8
- package/lib/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib/components/SplitButton/SplitButton.types.d.ts +0 -21
- package/lib/components/SplitButton/index.d.ts +0 -5
- package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -8
- package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -20
- package/lib/components/ToggleButton/index.d.ts +0 -5
- package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -11
- package/lib/index.d.ts +0 -11
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/useToggleState.d.ts +0 -3
- package/lib-commonjs/Button.d.ts +0 -1
- package/lib-commonjs/CompoundButton.d.ts +0 -1
- package/lib-commonjs/MenuButton.d.ts +0 -1
- package/lib-commonjs/SplitButton.d.ts +0 -1
- package/lib-commonjs/ToggleButton.d.ts +0 -1
- package/lib-commonjs/components/Button/Button.d.ts +0 -6
- package/lib-commonjs/components/Button/Button.types.d.ts +0 -64
- package/lib-commonjs/components/Button/index.d.ts +0 -5
- package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
- package/lib-commonjs/components/Button/useButton.d.ts +0 -8
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -8
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -8
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -10
- package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -8
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -21
- package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -8
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -20
- package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -11
- package/lib-commonjs/index.d.ts +0 -11
- package/lib-commonjs/utils/index.d.ts +0 -1
- 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
|
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
|
-
* @
|
27
|
+
* @default 'secondary'
|
35
28
|
*/
|
36
|
-
|
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
|
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
|
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
|
55
|
+
shape?: 'rounded' | 'circular' | 'square';
|
59
56
|
/**
|
60
57
|
* A button supports different sizes.
|
58
|
+
*
|
61
59
|
* @default 'medium'
|
62
60
|
*/
|
63
|
-
size
|
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> &
|
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>> &
|
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
|
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> &
|
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
|
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
|
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
|
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 &
|
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;
|
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
|
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,
|
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;
|
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;
|
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/"}
|