@fluentui/react-button 9.0.0-alpha.10 → 9.0.0-alpha.100
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +2418 -1
- package/CHANGELOG.md +920 -2
- package/README.md +19 -108
- package/dist/demo/index.html +71 -0
- package/dist/demo/react-dom.development.js +21413 -0
- package/dist/demo/react.development.js +3155 -0
- package/dist/react-button.d.ts +204 -82
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.d.ts +1 -0
- package/lib/CompoundButton.js +2 -0
- package/lib/CompoundButton.js.map +1 -0
- package/lib/MenuButton.d.ts +1 -0
- package/lib/MenuButton.js +2 -0
- package/lib/MenuButton.js.map +1 -0
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/ToggleButton.d.ts +1 -0
- package/lib/ToggleButton.js +2 -0
- package/lib/ToggleButton.js.map +1 -0
- package/lib/common/isConformant.d.ts +4 -2
- package/lib/common/isConformant.js +9 -6
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Button/Button.d.ts +4 -11
- package/lib/components/Button/Button.js +7 -16
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.d.ts +57 -60
- package/lib/components/Button/Button.types.js +1 -0
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.d.ts +1 -2
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.d.ts +2 -2
- package/lib/components/Button/renderButton.js +9 -8
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +5 -7
- package/lib/components/Button/useButton.js +49 -23
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.d.ts +10 -4
- package/lib/components/Button/useButtonStyles.js +350 -378
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib/components/CompoundButton/CompoundButton.js +15 -0
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib/components/CompoundButton/CompoundButton.types.js +2 -0
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib/components/CompoundButton/index.d.ts +5 -0
- package/lib/components/CompoundButton/index.js +6 -0
- package/lib/components/CompoundButton/index.js.map +1 -0
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib/components/CompoundButton/renderCompoundButton.js +17 -0
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib/components/CompoundButton/useCompoundButton.js +29 -0
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +164 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib/components/MenuButton/MenuButton.js +15 -0
- package/lib/components/MenuButton/MenuButton.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib/components/MenuButton/MenuButton.types.js +2 -0
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib/components/MenuButton/index.d.ts +5 -0
- package/lib/components/MenuButton/index.js +6 -0
- package/lib/components/MenuButton/index.js.map +1 -0
- package/lib/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib/components/MenuButton/renderMenuButton.js +17 -0
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib/components/MenuButton/useMenuButton.js +32 -0
- package/lib/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js +34 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +16 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +15 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib/components/SplitButton/useSplitButton.js +73 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +77 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib/components/ToggleButton/ToggleButton.js +15 -0
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib/components/ToggleButton/ToggleButton.types.js +2 -0
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib/components/ToggleButton/index.d.ts +5 -0
- package/lib/components/ToggleButton/index.js +6 -0
- package/lib/components/ToggleButton/index.js.map +1 -0
- package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib/components/ToggleButton/renderToggleButton.js +2 -0
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib/components/ToggleButton/useToggleButton.js +50 -0
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js +190 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Button.js +7 -2
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.d.ts +1 -0
- package/lib-commonjs/CompoundButton.js +10 -0
- package/lib-commonjs/CompoundButton.js.map +1 -0
- package/lib-commonjs/MenuButton.d.ts +1 -0
- package/lib-commonjs/MenuButton.js +10 -0
- package/lib-commonjs/MenuButton.js.map +1 -0
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/ToggleButton.d.ts +1 -0
- package/lib-commonjs/ToggleButton.js +10 -0
- package/lib-commonjs/ToggleButton.js.map +1 -0
- package/lib-commonjs/common/isConformant.d.ts +4 -2
- package/lib-commonjs/common/isConformant.js +19 -8
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Button/Button.d.ts +4 -11
- package/lib-commonjs/components/Button/Button.js +20 -20
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.d.ts +57 -60
- package/lib-commonjs/components/Button/Button.types.js +4 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.d.ts +1 -2
- package/lib-commonjs/components/Button/index.js +21 -5
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.d.ts +2 -2
- package/lib-commonjs/components/Button/renderButton.js +24 -13
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +5 -7
- package/lib-commonjs/components/Button/useButton.js +59 -24
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +10 -4
- package/lib-commonjs/components/Button/useButtonStyles.js +360 -379
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +26 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/index.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/index.js +26 -0
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +29 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +41 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +175 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js +26 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib-commonjs/components/MenuButton/index.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/index.js +26 -0
- package/lib-commonjs/components/MenuButton/index.js.map +1 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +29 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js +46 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +44 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +86 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +88 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +26 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/index.d.ts +5 -0
- package/lib-commonjs/components/ToggleButton/index.js +26 -0
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +16 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +63 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +200 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -0
- package/lib-commonjs/index.js +15 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +21 -14
- package/config/api-extractor.json +0 -3
- package/config/pre-copy.json +0 -9
- package/config/tests.js +0 -6
- package/etc/react-button.api.md +0 -104
- package/just.config.ts +0 -3
- package/lib/components/Button/useButtonState.d.ts +0 -6
- package/lib/components/Button/useButtonState.js +0 -45
- package/lib/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/Button.d.ts +0 -1
- package/lib-amd/Button.js +0 -6
- package/lib-amd/Button.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Button/Button.d.ts +0 -13
- package/lib-amd/components/Button/Button.js +0 -24
- package/lib-amd/components/Button/Button.js.map +0 -1
- package/lib-amd/components/Button/Button.types.d.ts +0 -65
- package/lib-amd/components/Button/Button.types.js +0 -5
- package/lib-amd/components/Button/Button.types.js.map +0 -1
- package/lib-amd/components/Button/index.d.ts +0 -6
- package/lib-amd/components/Button/index.js +0 -10
- package/lib-amd/components/Button/index.js.map +0 -1
- package/lib-amd/components/Button/renderButton.d.ts +0 -5
- package/lib-amd/components/Button/renderButton.js +0 -16
- package/lib-amd/components/Button/renderButton.js.map +0 -1
- package/lib-amd/components/Button/useButton.d.ts +0 -10
- package/lib-amd/components/Button/useButton.js +0 -28
- package/lib-amd/components/Button/useButton.js.map +0 -1
- package/lib-amd/components/Button/useButtonState.d.ts +0 -6
- package/lib-amd/components/Button/useButtonState.js +0 -48
- package/lib-amd/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/components/Button/useButtonStyles.d.ts +0 -4
- package/lib-amd/components/Button/useButtonStyles.js +0 -385
- package/lib-amd/components/Button/useButtonStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +0 -6
- package/lib-commonjs/components/Button/useButtonState.js +0 -47
- package/lib-commonjs/components/Button/useButtonState.js.map +0 -1
- package/src/components/Button/Button.types.ts +0 -120
package/dist/react-button.d.ts
CHANGED
@@ -1,110 +1,232 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import {
|
1
|
+
import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
|
2
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
3
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
4
|
+
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
5
|
+
import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
6
|
+
import type { MenuTriggerChildProps } from '@fluentui/react-menu';
|
7
|
+
import type { ObjectShorthandProps } from '@fluentui/react-utilities';
|
8
|
+
import * as React_2 from 'react';
|
5
9
|
|
6
10
|
/**
|
7
|
-
*
|
8
|
-
* {@docCategory Button}
|
11
|
+
* Buttons give people a way to trigger an action.
|
9
12
|
*/
|
10
|
-
export declare const Button:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*/
|
25
|
-
|
26
|
-
/**
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
13
|
+
export declare const Button: ForwardRefComponent<ButtonProps>;
|
14
|
+
|
15
|
+
export declare type ButtonCommons = {
|
16
|
+
/**
|
17
|
+
* A button can have its content and borders styled for greater emphasis or to be subtle.
|
18
|
+
* - 'primary': Emphasizes the button as a primary action.
|
19
|
+
* - 'outline': Removes background styling.
|
20
|
+
* - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
21
|
+
* - 'transparent': Removes background and border styling.
|
22
|
+
*/
|
23
|
+
appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
|
24
|
+
/**
|
25
|
+
* A button can fill the width of its container.
|
26
|
+
* @default false
|
27
|
+
*/
|
28
|
+
block: boolean;
|
29
|
+
/**
|
30
|
+
* When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
|
31
|
+
* is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
|
32
|
+
* pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
|
33
|
+
* @default false
|
34
|
+
*/
|
35
|
+
disabledFocusable: boolean;
|
36
|
+
/**
|
37
|
+
* A button can show that it cannot be interacted with.
|
38
|
+
* @default false
|
39
|
+
*/
|
40
|
+
disabled: boolean;
|
41
|
+
/**
|
42
|
+
* A button can format its icon to appear before or after its content.
|
43
|
+
* @default 'before'
|
44
|
+
*/
|
45
|
+
iconPosition: 'before' | 'after';
|
46
|
+
/**
|
47
|
+
* A button can be rounded, circular, or square.
|
48
|
+
* @default 'rounded'
|
49
|
+
*/
|
50
|
+
shape: 'rounded' | 'circular' | 'square';
|
51
|
+
/**
|
52
|
+
* A button supports different sizes.
|
53
|
+
* @default 'medium'
|
54
|
+
*/
|
55
|
+
size: 'small' | 'medium' | 'large';
|
56
|
+
};
|
57
|
+
|
58
|
+
export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
|
59
|
+
|
60
|
+
export declare type ButtonSlots = {
|
61
|
+
/**
|
62
|
+
* Root of the component that renders as either a <button> tag.
|
63
|
+
*/
|
64
|
+
root: ARIAButtonShorthandProps;
|
65
|
+
/**
|
66
|
+
* Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
|
67
|
+
*/
|
68
|
+
icon?: IntrinsicShorthandProps<'span'>;
|
69
|
+
};
|
70
|
+
|
71
|
+
export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
|
72
|
+
/**
|
73
|
+
* A button can contain only an icon.
|
74
|
+
* @default false
|
75
|
+
*/
|
76
|
+
iconOnly: boolean;
|
36
77
|
};
|
37
78
|
|
38
79
|
/**
|
39
|
-
*
|
80
|
+
* CompoundButtons are buttons that can have secondary content that adds extra information to the user.
|
40
81
|
*/
|
41
|
-
export declare const
|
82
|
+
export declare const CompoundButton: ForwardRefComponent<CompoundButtonProps>;
|
83
|
+
|
84
|
+
export declare type CompoundButtonProps = ComponentProps<CompoundButtonSlots> & Partial<ButtonCommons>;
|
85
|
+
|
86
|
+
export declare type CompoundButtonSlots = ButtonSlots & {
|
87
|
+
/**
|
88
|
+
* Second line of text that describes the action this button takes.
|
89
|
+
*/
|
90
|
+
secondaryContent?: IntrinsicShorthandProps<'span'>;
|
91
|
+
/**
|
92
|
+
* Container that wraps the children and the secondaryContent slot.
|
93
|
+
*/
|
94
|
+
contentContainer: IntrinsicShorthandProps<'span'>;
|
95
|
+
};
|
96
|
+
|
97
|
+
export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components'>;
|
42
98
|
|
43
99
|
/**
|
44
|
-
*
|
100
|
+
* MenuButtons are buttons that handle opening and closing a menu when they are triggered.
|
45
101
|
*/
|
46
|
-
export declare
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
primary?: boolean;
|
56
|
-
size?: string;
|
102
|
+
export declare const MenuButton: ForwardRefComponent<MenuButtonProps>;
|
103
|
+
|
104
|
+
export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Partial<Omit<ButtonCommons, 'iconPosition'>> & Partial<MenuTriggerChildProps>;
|
105
|
+
|
106
|
+
export declare type MenuButtonSlots = ButtonSlots & {
|
107
|
+
/**
|
108
|
+
* Menu icon that indicates that this button has a menu that can be expanded.
|
109
|
+
*/
|
110
|
+
menuIcon?: IntrinsicShorthandProps<'span'>;
|
57
111
|
};
|
58
112
|
|
59
|
-
export declare type
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
113
|
+
export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Renders a Button component by passing the state defined props to the appropriate slots.
|
117
|
+
*/
|
118
|
+
declare const renderButton: (state: ButtonState) => JSX.Element;
|
119
|
+
export { renderButton }
|
120
|
+
export { renderButton as renderToggleButton }
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Renders a CompoundButton component by passing the state defined props to the appropriate slots.
|
124
|
+
*/
|
125
|
+
export declare const renderCompoundButton: (state: CompoundButtonState) => JSX.Element;
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Renders a MenuButton component by passing the state defined props to the appropriate slots.
|
129
|
+
*/
|
130
|
+
export declare const renderMenuButton: (state: MenuButtonState) => JSX.Element;
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
134
|
+
*/
|
135
|
+
export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
|
136
|
+
|
137
|
+
/**
|
138
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
139
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
140
|
+
*/
|
141
|
+
export declare const SplitButton: ForwardRefComponent<SplitButtonProps>;
|
142
|
+
|
143
|
+
export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root'> & Omit<MenuButtonProps, 'root'>;
|
144
|
+
|
145
|
+
export declare type SplitButtonSlots = {
|
146
|
+
/**
|
147
|
+
* Root of the component that wraps the primary action button and menu button.
|
148
|
+
*/
|
149
|
+
root: IntrinsicShorthandProps<'div'>;
|
150
|
+
/**
|
151
|
+
* Button that opens menu with secondary actions in SplitButton.
|
152
|
+
*/
|
153
|
+
menuButton?: ObjectShorthandProps<MenuButtonProps>;
|
154
|
+
/**
|
155
|
+
* Button to perform primary action in SplitButton.
|
156
|
+
*/
|
157
|
+
primaryActionButton?: ObjectShorthandProps<ButtonProps>;
|
84
158
|
};
|
85
159
|
|
86
|
-
export declare type
|
160
|
+
export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<ButtonState, 'components' | 'iconOnly' | 'root'> & Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;
|
87
161
|
|
88
|
-
|
89
|
-
|
162
|
+
/**
|
163
|
+
* ToggleButtons are buttons that toggle between two defined states when triggered.
|
164
|
+
*/
|
165
|
+
export declare const ToggleButton: ForwardRefComponent<ToggleButtonProps>;
|
166
|
+
|
167
|
+
export declare type ToggleButtonCommons = {
|
168
|
+
/**
|
169
|
+
* Defines the controlled checked state of the `ToggleButton`.
|
170
|
+
* If passed, `ToggleButton` ignores the `defaultChecked` property.
|
171
|
+
* This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the
|
172
|
+
* correct value based on handling `onClick` events and re-rendering.
|
173
|
+
* @default false
|
174
|
+
*/
|
175
|
+
checked: boolean;
|
90
176
|
};
|
91
177
|
|
178
|
+
export declare type ToggleButtonProps = ButtonProps & Partial<ToggleButtonCommons> & {
|
179
|
+
/**
|
180
|
+
* Defines whether the `ToggleButton` is initially in a checked state or not when rendered.
|
181
|
+
* @default false
|
182
|
+
*/
|
183
|
+
defaultChecked?: boolean;
|
184
|
+
};
|
185
|
+
|
186
|
+
export declare type ToggleButtonState = ButtonState & ToggleButtonCommons;
|
187
|
+
|
92
188
|
/**
|
93
|
-
*
|
189
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
190
|
+
* @param props - User provided props to the Button component.
|
191
|
+
* @param ref - User provided ref to be passed to the Button component.
|
94
192
|
*/
|
95
|
-
export declare const
|
193
|
+
export declare const useButton: (props: ButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
|
194
|
+
|
195
|
+
export declare const useButtonStyles: (state: ButtonState) => ButtonState;
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
199
|
+
* @param props - User provided props to the CompoundButton component.
|
200
|
+
* @param ref - User provided ref to be passed to the CompoundButton component.
|
201
|
+
*/
|
202
|
+
export declare const useCompoundButton: ({ contentContainer, secondaryContent, ...props }: CompoundButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonState;
|
203
|
+
|
204
|
+
export declare const useCompoundButtonStyles: (state: CompoundButtonState) => CompoundButtonState;
|
96
205
|
|
97
206
|
/**
|
98
|
-
* Given user props, returns
|
207
|
+
* Given user props, returns the final state for a MenuButton.
|
99
208
|
*/
|
100
|
-
export declare const
|
209
|
+
export declare const useMenuButton: ({ menuIcon, ...props }: MenuButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonState;
|
210
|
+
|
211
|
+
export declare const useMenuButtonStyles: (state: MenuButtonState) => MenuButtonState;
|
212
|
+
|
213
|
+
/**
|
214
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
215
|
+
* @param props - User provided props to the SplitButton component.
|
216
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
217
|
+
*/
|
218
|
+
export declare const useSplitButton: (props: SplitButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
|
219
|
+
|
220
|
+
export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
|
101
221
|
|
102
222
|
/**
|
103
|
-
*
|
104
|
-
*
|
223
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
224
|
+
* processed state.
|
225
|
+
* @param props - User provided props to the ToggleButton component.
|
226
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
105
227
|
*/
|
106
|
-
export declare const
|
228
|
+
export declare const useToggleButton: ({ checked, defaultChecked, ...props }: ToggleButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
|
107
229
|
|
108
|
-
export declare const
|
230
|
+
export declare const useToggleButtonStyles: (state: ToggleButtonState) => ToggleButtonState;
|
109
231
|
|
110
232
|
export { }
|
package/lib/Button.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/CompoundButton/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CompoundButton.js","sourceRoot":"","sources":["../src/CompoundButton.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/MenuButton/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../src/MenuButton.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/SplitButton/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SplitButton.js","sourceRoot":"","sources":["../src/SplitButton.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './components/ToggleButton/index';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../src/ToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|
@@ -1,2 +1,4 @@
|
|
1
|
-
import { IsConformantOptions } from '@fluentui/react-conformance';
|
2
|
-
export declare function isConformant(testInfo: Omit<IsConformantOptions
|
1
|
+
import type { IsConformantOptions } from '@fluentui/react-conformance';
|
2
|
+
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
3
|
+
componentPath?: string;
|
4
|
+
}): void;
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
|
2
|
+
import makeStylesTests from '@fluentui/react-conformance-make-styles';
|
2
3
|
export function isConformant(testInfo) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
var defaultOptions = {
|
5
|
+
asPropHandlesRef: true,
|
6
|
+
componentPath: module.parent.filename.replace('.test', ''),
|
7
|
+
disabledTests: ['has-docblock', 'kebab-aria-attributes'],
|
8
|
+
extraTests: makeStylesTests,
|
9
|
+
skipAsPropTests: true
|
10
|
+
};
|
11
|
+
baseIsConformant(defaultOptions, testInfo);
|
9
12
|
}
|
10
13
|
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D,IAAA,aAAa,EAAE,CAAC,cAAD,EAAiB,uBAAjB,CAH4C;AAI3D,IAAA,UAAU,EAAE,eAJ+C;AAK3D,IAAA,eAAe,EAAE;AAL0C,GAA7D;AAQA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
|
@@ -1,13 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import type { ButtonProps } from './Button.types';
|
2
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
2
3
|
/**
|
3
|
-
*
|
4
|
-
* {@docCategory Button}
|
4
|
+
* Buttons give people a way to trigger an action.
|
5
5
|
*/
|
6
|
-
export declare const Button:
|
7
|
-
icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
8
|
-
disabled?: boolean | undefined;
|
9
|
-
iconOnly?: boolean | undefined;
|
10
|
-
iconPosition?: "after" | "before" | undefined;
|
11
|
-
primary?: boolean | undefined;
|
12
|
-
size?: "small" | "large" | undefined;
|
13
|
-
} & React.RefAttributes<HTMLElement>>;
|
6
|
+
export declare const Button: ForwardRefComponent<ButtonProps>;
|
@@ -1,24 +1,15 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { useButton } from './useButton';
|
3
2
|
import { renderButton } from './renderButton';
|
3
|
+
import { useButton } from './useButton';
|
4
4
|
import { useButtonStyles } from './useButtonStyles';
|
5
5
|
/**
|
6
|
-
*
|
7
|
-
* {@docCategory Button}
|
6
|
+
* Buttons give people a way to trigger an action.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var styleSelectors = {
|
15
|
-
disabled: state.disabled,
|
16
|
-
primary: state.primary,
|
17
|
-
iconOnly: receivedIcon && !receivedChildren,
|
18
|
-
size: state.size,
|
19
|
-
};
|
20
|
-
useButtonStyles(state, styleSelectors);
|
21
|
-
return renderButton(state);
|
8
|
+
|
9
|
+
export var Button = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
10
|
+
var state = useButton(props, ref);
|
11
|
+
useButtonStyles(state);
|
12
|
+
return renderButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
22
13
|
});
|
23
14
|
Button.displayName = 'Button';
|
24
15
|
//# sourceMappingURL=Button.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,gBAA7B;AACA,SAAS,SAAT,QAA0B,aAA1B;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAIA;;AAEG;;AACH,OAAO,IAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClF,MAAM,KAAK,GAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,CAAvB;AAEA,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,YAAY,CAAC,KAAD,CAAnB,CALkF,CAMlF;AACD,CAPuD,CAAjD;AASP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourceRoot":""}
|
@@ -1,65 +1,62 @@
|
|
1
|
-
import
|
2
|
-
import { ComponentProps,
|
3
|
-
|
4
|
-
export declare type ButtonProps = ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
|
1
|
+
import { ARIAButtonShorthandProps } from '@fluentui/react-aria';
|
2
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
3
|
+
export declare type ButtonSlots = {
|
5
4
|
/**
|
6
|
-
*
|
7
|
-
* JSX. The `children` prop of the object can be a render function,
|
8
|
-
* taking in the original slot component and props.
|
5
|
+
* Root of the component that renders as either a <button> tag.
|
9
6
|
*/
|
10
|
-
|
11
|
-
/**
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
/** An icon button can format its icon to appear before or after its content. */
|
16
|
-
iconPosition?: 'before' | 'after';
|
17
|
-
/** A button can emphasize that it represents the primary action. */
|
18
|
-
primary?: boolean;
|
19
|
-
/** A button can be sized. */
|
20
|
-
size?: 'small' | 'large';
|
21
|
-
};
|
22
|
-
/**
|
23
|
-
* {@docCategory Button}
|
24
|
-
*/
|
25
|
-
export interface ButtonState extends ButtonProps {
|
26
|
-
ref: React.RefObject<HTMLButtonElement>;
|
27
|
-
icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
28
|
-
children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
29
|
-
}
|
30
|
-
export declare type ButtonStyleSelectors = {
|
31
|
-
disabled?: boolean;
|
32
|
-
iconOnly?: boolean;
|
33
|
-
primary?: boolean;
|
34
|
-
size?: string;
|
7
|
+
root: ARIAButtonShorthandProps;
|
8
|
+
/**
|
9
|
+
* Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
|
10
|
+
*/
|
11
|
+
icon?: IntrinsicShorthandProps<'span'>;
|
35
12
|
};
|
36
|
-
export declare type
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
13
|
+
export declare type ButtonCommons = {
|
14
|
+
/**
|
15
|
+
* A button can have its content and borders styled for greater emphasis or to be subtle.
|
16
|
+
* - 'primary': Emphasizes the button as a primary action.
|
17
|
+
* - 'outline': Removes background styling.
|
18
|
+
* - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
19
|
+
* - 'transparent': Removes background and border styling.
|
20
|
+
*/
|
21
|
+
appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
|
22
|
+
/**
|
23
|
+
* A button can fill the width of its container.
|
24
|
+
* @default false
|
25
|
+
*/
|
26
|
+
block: boolean;
|
27
|
+
/**
|
28
|
+
* When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
|
29
|
+
* is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
|
30
|
+
* pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
|
31
|
+
* @default false
|
32
|
+
*/
|
33
|
+
disabledFocusable: boolean;
|
34
|
+
/**
|
35
|
+
* A button can show that it cannot be interacted with.
|
36
|
+
* @default false
|
37
|
+
*/
|
38
|
+
disabled: boolean;
|
39
|
+
/**
|
40
|
+
* A button can format its icon to appear before or after its content.
|
41
|
+
* @default 'before'
|
42
|
+
*/
|
43
|
+
iconPosition: 'before' | 'after';
|
44
|
+
/**
|
45
|
+
* A button can be rounded, circular, or square.
|
46
|
+
* @default 'rounded'
|
47
|
+
*/
|
48
|
+
shape: 'rounded' | 'circular' | 'square';
|
49
|
+
/**
|
50
|
+
* A button supports different sizes.
|
51
|
+
* @default 'medium'
|
52
|
+
*/
|
53
|
+
size: 'small' | 'medium' | 'large';
|
62
54
|
};
|
63
|
-
export declare type
|
64
|
-
|
55
|
+
export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
|
56
|
+
export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
|
57
|
+
/**
|
58
|
+
* A button can contain only an icon.
|
59
|
+
* @default false
|
60
|
+
*/
|
61
|
+
iconOnly: boolean;
|
65
62
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Button.types.js","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":""}
|