@fluentui/react-button 9.72.9-experimental.component-base-hooks.20260122-49fc330360.0 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0
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.
- package/CHANGELOG.md +116 -12
- package/dist/index.d.cts +331 -0
- package/dist/index.d.ts +50 -52
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js +5 -5
- 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 +4 -5
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +35 -6
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.styles.js +6 -6
- package/lib/components/Button/useButtonStyles.styles.js.map +1 -1
- package/lib/components/Button/useButtonStyles.styles.raw.js +6 -5
- package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js +5 -5
- 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 +4 -5
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +23 -11
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.js +7 -5
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js +7 -4
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +5 -5
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js +3 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js +4 -5
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +1 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +52 -14
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.js +7 -6
- package/lib/components/MenuButton/useMenuButtonStyles.styles.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js +7 -5
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +5 -5
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js +4 -5
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js +1 -1
- package/lib/components/SplitButton/useSplitButton.js +53 -17
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.js +6 -5
- package/lib/components/SplitButton/useSplitButtonStyles.styles.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js +6 -4
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +5 -5
- 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 +4 -5
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +16 -14
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.js +65 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +58 -10
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -1
- package/lib/contexts/ButtonContext.js +5 -3
- package/lib/contexts/ButtonContext.js.map +1 -1
- package/lib/contexts/index.js +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/index.js +7 -13
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js +4 -3
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-commonjs/{Button.js → Button.cjs} +1 -1
- package/lib-commonjs/{Button.js.map → Button.cjs.map} +1 -1
- package/lib-commonjs/{CompoundButton.js → CompoundButton.cjs} +1 -4
- package/lib-commonjs/CompoundButton.cjs.map +1 -0
- package/lib-commonjs/{MenuButton.js → MenuButton.cjs} +1 -1
- package/lib-commonjs/{MenuButton.js.map → MenuButton.cjs.map} +1 -1
- package/lib-commonjs/{SplitButton.js → SplitButton.cjs} +1 -4
- package/lib-commonjs/SplitButton.cjs.map +1 -0
- package/lib-commonjs/{ToggleButton.js → ToggleButton.cjs} +1 -1
- package/lib-commonjs/{ToggleButton.js.map → ToggleButton.cjs.map} +1 -1
- package/lib-commonjs/components/Button/{Button.js → Button.cjs} +3 -3
- package/lib-commonjs/components/Button/{Button.js.map → Button.cjs.map} +1 -1
- package/lib-commonjs/components/Button/{Button.types.js.map → Button.types.cjs.map} +1 -1
- package/lib-commonjs/components/Button/{index.js → index.cjs} +5 -6
- package/lib-commonjs/components/Button/index.cjs.map +1 -0
- package/lib-commonjs/components/Button/renderButton.cjs.map +1 -0
- package/lib-commonjs/components/Button/useButton.cjs +58 -0
- package/lib-commonjs/components/Button/useButton.cjs.map +1 -0
- package/lib-commonjs/components/Button/{useButtonStyles.styles.js → useButtonStyles.styles.cjs} +2 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Button/{useButtonStyles.styles.raw.js → useButtonStyles.styles.raw.cjs} +2 -1
- package/lib-commonjs/components/Button/{useButtonStyles.styles.raw.js.map → useButtonStyles.styles.raw.cjs.map} +1 -1
- package/lib-commonjs/components/CompoundButton/{CompoundButton.js → CompoundButton.cjs} +3 -3
- package/lib-commonjs/components/CompoundButton/{CompoundButton.js.map → CompoundButton.cjs.map} +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/{index.js → index.cjs} +4 -8
- package/lib-commonjs/components/CompoundButton/index.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/{useCompoundButtonBase.js → useCompoundButton.cjs} +6 -7
- package/lib-commonjs/components/CompoundButton/useCompoundButton.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/{useCompoundButtonStyles.styles.js → useCompoundButtonStyles.styles.cjs} +5 -2
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/{useCompoundButtonStyles.styles.raw.js → useCompoundButtonStyles.styles.raw.cjs} +5 -2
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/{MenuButton.js → MenuButton.cjs} +3 -3
- package/lib-commonjs/components/MenuButton/{MenuButton.js.map → MenuButton.cjs.map} +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.cjs +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/{index.js → index.cjs} +5 -6
- package/lib-commonjs/components/MenuButton/index.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.cjs +65 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/{useMenuButtonStyles.styles.js → useMenuButtonStyles.styles.cjs} +4 -2
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/{useMenuButtonStyles.styles.raw.js → useMenuButtonStyles.styles.raw.cjs} +4 -2
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/{SplitButton.js → SplitButton.cjs} +3 -3
- package/lib-commonjs/components/SplitButton/SplitButton.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/{index.js → index.cjs} +4 -8
- package/lib-commonjs/components/SplitButton/index.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/{useSplitButtonBase.js → useSplitButton.cjs} +21 -14
- package/lib-commonjs/components/SplitButton/useSplitButton.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/{useSplitButtonStyles.styles.js → useSplitButtonStyles.styles.cjs} +3 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/{useSplitButtonStyles.styles.raw.js → useSplitButtonStyles.styles.raw.cjs} +3 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/{ToggleButton.js → ToggleButton.cjs} +3 -3
- package/lib-commonjs/components/ToggleButton/{ToggleButton.js.map → ToggleButton.cjs.map} +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/{index.js → index.cjs} +5 -6
- package/lib-commonjs/components/ToggleButton/index.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/{renderToggleButton.js → renderToggleButton.cjs} +1 -1
- package/lib-commonjs/components/ToggleButton/{renderToggleButton.js.map → renderToggleButton.cjs.map} +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.cjs +31 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/{useToggleButtonStyles.styles.js → useToggleButtonStyles.styles.cjs} +119 -5
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/{useToggleButtonStyles.styles.raw.js → useToggleButtonStyles.styles.raw.cjs} +51 -6
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.cjs.map +1 -0
- package/lib-commonjs/contexts/ButtonContext.cjs.map +1 -0
- package/lib-commonjs/contexts/{index.js → index.cjs} +1 -1
- package/lib-commonjs/contexts/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/{index.js → index.cjs} +7 -13
- package/lib-commonjs/index.cjs.map +1 -0
- package/lib-commonjs/utils/{index.js → index.cjs} +1 -1
- package/lib-commonjs/utils/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/utils/{useToggleState.js → useToggleState.cjs} +2 -1
- package/lib-commonjs/utils/useToggleState.cjs.map +1 -0
- package/package.json +20 -14
- package/lib/components/Button/useButtonBase.js +0 -34
- package/lib/components/Button/useButtonBase.js.map +0 -1
- package/lib/components/CompoundButton/useCompoundButtonBase.js +0 -31
- package/lib/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
- package/lib/components/MenuButton/useMenuButtonBase.js +0 -27
- package/lib/components/MenuButton/useMenuButtonBase.js.map +0 -1
- package/lib/components/SplitButton/useSplitButtonBase.js +0 -57
- package/lib/components/SplitButton/useSplitButtonBase.js.map +0 -1
- package/lib/components/ToggleButton/useToggleButtonBase.js +0 -13
- package/lib/components/ToggleButton/useToggleButtonBase.js.map +0 -1
- package/lib-commonjs/CompoundButton.js.map +0 -1
- package/lib-commonjs/SplitButton.js.map +0 -1
- package/lib-commonjs/components/Button/index.js.map +0 -1
- package/lib-commonjs/components/Button/renderButton.js.map +0 -1
- package/lib-commonjs/components/Button/useButton.js +0 -27
- package/lib-commonjs/components/Button/useButton.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonBase.js +0 -41
- package/lib-commonjs/components/Button/useButtonBase.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/index.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +0 -26
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +0 -1
- package/lib-commonjs/components/MenuButton/index.js.map +0 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +0 -32
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonBase.js +0 -36
- package/lib-commonjs/components/MenuButton/useMenuButtonBase.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +0 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +0 -1
- package/lib-commonjs/components/SplitButton/index.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +0 -36
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonBase.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +0 -4
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/index.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +0 -27
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js +0 -19
- package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +0 -1
- package/lib-commonjs/contexts/ButtonContext.js.map +0 -1
- package/lib-commonjs/index.js.map +0 -1
- package/lib-commonjs/utils/useToggleState.js.map +0 -1
- /package/lib-commonjs/components/Button/{Button.types.js → Button.types.cjs} +0 -0
- /package/lib-commonjs/components/Button/{renderButton.js → renderButton.cjs} +0 -0
- /package/lib-commonjs/components/CompoundButton/{CompoundButton.types.js → CompoundButton.types.cjs} +0 -0
- /package/lib-commonjs/components/CompoundButton/{renderCompoundButton.js → renderCompoundButton.cjs} +0 -0
- /package/lib-commonjs/components/CompoundButton/{renderCompoundButton.js.map → renderCompoundButton.cjs.map} +0 -0
- /package/lib-commonjs/components/MenuButton/{renderMenuButton.js → renderMenuButton.cjs} +0 -0
- /package/lib-commonjs/components/{MenuButton/MenuButton.types.js → SplitButton/SplitButton.types.cjs} +0 -0
- /package/lib-commonjs/components/SplitButton/{renderSplitButton.js → renderSplitButton.cjs} +0 -0
- /package/lib-commonjs/components/SplitButton/{renderSplitButton.js.map → renderSplitButton.cjs.map} +0 -0
- /package/lib-commonjs/components/{SplitButton/SplitButton.types.js → ToggleButton/ToggleButton.types.cjs} +0 -0
- /package/lib-commonjs/contexts/{ButtonContext.js → ButtonContext.cjs} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
|
|
|
2
2
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
3
3
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
4
4
|
import type { DistributiveOmit } from '@fluentui/react-utilities';
|
|
5
|
-
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
5
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
6
6
|
import type { JSXElement } from '@fluentui/react-utilities';
|
|
7
7
|
import * as React_2 from 'react';
|
|
8
8
|
import type { Slot } from '@fluentui/react-utilities';
|
|
@@ -13,33 +13,28 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const Button: ForwardRefComponent<ButtonProps>;
|
|
15
15
|
|
|
16
|
-
export declare type ButtonBaseProps = DistributiveOmit<ButtonProps,
|
|
16
|
+
export declare type ButtonBaseProps = DistributiveOmit<ButtonProps, 'appearance' | 'size' | 'shape'>;
|
|
17
17
|
|
|
18
|
-
export declare type ButtonBaseState = DistributiveOmit<ButtonState,
|
|
18
|
+
export declare type ButtonBaseState = DistributiveOmit<ButtonState, 'appearance' | 'size' | 'shape'>;
|
|
19
19
|
|
|
20
20
|
export declare const buttonClassNames: SlotClassNames<ButtonSlots>;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @internal
|
|
24
23
|
* Internal context provider used to update default values between internal components
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
25
26
|
*/
|
|
26
27
|
export declare const ButtonContextProvider: React_2.Provider<ButtonContextValue | undefined>;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* @internal
|
|
30
30
|
* Internal context value used to update default values between internal components
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
31
33
|
*/
|
|
32
34
|
export declare interface ButtonContextValue {
|
|
33
35
|
size?: ButtonSize;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
/**
|
|
37
|
-
* Internal use only: lists prop names related to Button design for use within Button components.
|
|
38
|
-
*
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
declare type ButtonDesignPropNames = 'appearance' | 'size' | 'shape';
|
|
42
|
-
|
|
43
38
|
export declare type ButtonProps = ComponentProps<ButtonSlots> & {
|
|
44
39
|
/**
|
|
45
40
|
* A button can have its content and borders styled for greater emphasis or to be subtle.
|
|
@@ -116,10 +111,6 @@ export declare type ButtonState = ComponentState<ButtonSlots> & Required<Pick<Bu
|
|
|
116
111
|
*/
|
|
117
112
|
export declare const CompoundButton: ForwardRefComponent<CompoundButtonProps>;
|
|
118
113
|
|
|
119
|
-
export declare type CompoundButtonBaseProps = DistributiveOmit<CompoundButtonProps, ButtonDesignPropNames>;
|
|
120
|
-
|
|
121
|
-
export declare type CompoundButtonBaseState = DistributiveOmit<CompoundButtonState, ButtonDesignPropNames>;
|
|
122
|
-
|
|
123
114
|
export declare const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots>;
|
|
124
115
|
|
|
125
116
|
export declare type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> & Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>;
|
|
@@ -143,9 +134,15 @@ export declare type CompoundButtonState = ComponentState<CompoundButtonSlots> &
|
|
|
143
134
|
*/
|
|
144
135
|
export declare const MenuButton: ForwardRefComponent<MenuButtonProps>;
|
|
145
136
|
|
|
146
|
-
|
|
137
|
+
/**
|
|
138
|
+
* MenuButton Props without the `appearance`/`size`/`shape` styling props, for headless usage.
|
|
139
|
+
*/
|
|
140
|
+
export declare type MenuButtonBaseProps = ComponentProps<MenuButtonSlots> & Pick<ButtonBaseProps, 'disabled' | 'disabledFocusable'>;
|
|
147
141
|
|
|
148
|
-
|
|
142
|
+
/**
|
|
143
|
+
* MenuButton State without the `appearance`/`size`/`shape` styling props, for headless usage.
|
|
144
|
+
*/
|
|
145
|
+
export declare type MenuButtonBaseState = ComponentState<MenuButtonSlots> & Omit<ButtonBaseState, keyof ButtonSlots | 'components' | 'iconPosition'>;
|
|
149
146
|
|
|
150
147
|
export declare const menuButtonClassNames: SlotClassNames<MenuButtonSlots>;
|
|
151
148
|
|
|
@@ -163,7 +160,7 @@ export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<But
|
|
|
163
160
|
/**
|
|
164
161
|
* Renders a Button component by passing the state defined props to the appropriate slots.
|
|
165
162
|
*/
|
|
166
|
-
declare const renderButton_unstable: (state:
|
|
163
|
+
declare const renderButton_unstable: (state: ButtonBaseState) => JSXElement;
|
|
167
164
|
export { renderButton_unstable }
|
|
168
165
|
export { renderButton_unstable as renderToggleButton_unstable }
|
|
169
166
|
|
|
@@ -175,7 +172,7 @@ export declare const renderCompoundButton_unstable: (state: CompoundButtonState)
|
|
|
175
172
|
/**
|
|
176
173
|
* Renders a MenuButton component by passing the state defined props to the appropriate slots.
|
|
177
174
|
*/
|
|
178
|
-
export declare const renderMenuButton_unstable: (state:
|
|
175
|
+
export declare const renderMenuButton_unstable: (state: MenuButtonBaseState) => JSXElement;
|
|
179
176
|
|
|
180
177
|
/**
|
|
181
178
|
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
|
@@ -188,10 +185,6 @@ export declare const renderSplitButton_unstable: (state: SplitButtonState) => JS
|
|
|
188
185
|
*/
|
|
189
186
|
export declare const SplitButton: ForwardRefComponent<SplitButtonProps>;
|
|
190
187
|
|
|
191
|
-
export declare type SplitButtonBaseProps = DistributiveOmit<SplitButtonProps, ButtonDesignPropNames>;
|
|
192
|
-
|
|
193
|
-
export declare type SplitButtonBaseState = DistributiveOmit<SplitButtonState, ButtonDesignPropNames>;
|
|
194
|
-
|
|
195
188
|
export declare const splitButtonClassNames: SlotClassNames<SplitButtonSlots>;
|
|
196
189
|
|
|
197
190
|
export declare type SplitButtonProps = ComponentProps<SplitButtonSlots> & Omit<ButtonProps, 'root' | 'as'> & Omit<MenuButtonProps, 'root' | 'as'>;
|
|
@@ -218,9 +211,9 @@ export declare type SplitButtonState = ComponentState<SplitButtonSlots> & Omit<B
|
|
|
218
211
|
*/
|
|
219
212
|
export declare const ToggleButton: ForwardRefComponent<ToggleButtonProps>;
|
|
220
213
|
|
|
221
|
-
export declare type ToggleButtonBaseProps =
|
|
214
|
+
export declare type ToggleButtonBaseProps = ButtonBaseProps & Pick<ToggleButtonProps, 'defaultChecked' | 'checked' | 'isAccessible'>;
|
|
222
215
|
|
|
223
|
-
export declare type ToggleButtonBaseState =
|
|
216
|
+
export declare type ToggleButtonBaseState = ButtonBaseState & Required<Pick<ToggleButtonProps, 'checked' | 'isAccessible'>>;
|
|
224
217
|
|
|
225
218
|
export declare const toggleButtonClassNames: SlotClassNames<ButtonSlots>;
|
|
226
219
|
|
|
@@ -240,9 +233,15 @@ export declare type ToggleButtonProps = ButtonProps & {
|
|
|
240
233
|
* @default false
|
|
241
234
|
*/
|
|
242
235
|
checked?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Defines whether the `ToggleButton` should use the alternate selected styles that have adequate contrast with the rest style
|
|
238
|
+
*
|
|
239
|
+
* @default false
|
|
240
|
+
*/
|
|
241
|
+
isAccessible?: boolean;
|
|
243
242
|
};
|
|
244
243
|
|
|
245
|
-
export declare type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;
|
|
244
|
+
export declare type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked' | 'isAccessible'>>;
|
|
246
245
|
|
|
247
246
|
/**
|
|
248
247
|
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
|
@@ -252,15 +251,17 @@ export declare type ToggleButtonState = ButtonState & Required<Pick<ToggleButton
|
|
|
252
251
|
export declare const useButton_unstable: (props: ButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
|
|
253
252
|
|
|
254
253
|
/**
|
|
255
|
-
*
|
|
254
|
+
* Base hook for Button component, which manages state related to slots structure and ARIA attributes.
|
|
255
|
+
*
|
|
256
256
|
* @param props - User provided props to the Button component.
|
|
257
257
|
* @param ref - User provided ref to be passed to the Button component.
|
|
258
258
|
*/
|
|
259
|
-
export declare const useButtonBase_unstable: (props: ButtonBaseProps, ref
|
|
259
|
+
export declare const useButtonBase_unstable: (props: ButtonBaseProps, ref?: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonBaseState;
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
* @internal
|
|
263
262
|
* Internal context hook used to update default values between internal components
|
|
263
|
+
*
|
|
264
|
+
* @internal
|
|
264
265
|
*/
|
|
265
266
|
export declare const useButtonContext: () => ButtonContextValue;
|
|
266
267
|
|
|
@@ -273,24 +274,28 @@ export declare const useButtonStyles_unstable: (state: ButtonState) => ButtonSta
|
|
|
273
274
|
*/
|
|
274
275
|
export declare const useCompoundButton_unstable: (props: CompoundButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonState;
|
|
275
276
|
|
|
276
|
-
/**
|
|
277
|
-
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
|
278
|
-
* @param props - User provided props to the CompoundButton component.
|
|
279
|
-
* @param ref - User provided ref to be passed to the CompoundButton component.
|
|
280
|
-
*/
|
|
281
|
-
export declare const useCompoundButtonBase_unstable: ({ contentContainer, secondaryContent, ...props }: CompoundButtonBaseProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => CompoundButtonBaseState;
|
|
282
|
-
|
|
283
277
|
export declare const useCompoundButtonStyles_unstable: (state: CompoundButtonState) => CompoundButtonState;
|
|
284
278
|
|
|
285
279
|
/**
|
|
286
|
-
* Given user props, returns the final state for a MenuButton
|
|
280
|
+
* Given user props, returns the final state for a MenuButton by adding the
|
|
281
|
+
* `appearance`/`size`/`shape` styling props on top of the base state.
|
|
282
|
+
*
|
|
283
|
+
* @param props - User provided props to the MenuButton component.
|
|
284
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
|
287
285
|
*/
|
|
288
286
|
export declare const useMenuButton_unstable: (props: MenuButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonState;
|
|
289
287
|
|
|
290
288
|
/**
|
|
291
|
-
*
|
|
289
|
+
* Base hook for MenuButton.
|
|
290
|
+
*
|
|
291
|
+
* The `menuIcon` slot ships no icon of its own and only renders when a consumer
|
|
292
|
+
* provides one, so headless consumers can supply their own visuals. The styled
|
|
293
|
+
* `useMenuButton_unstable` adds the default chevron on top of this.
|
|
294
|
+
*
|
|
295
|
+
* @param props - User provided props to the MenuButton component.
|
|
296
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
|
292
297
|
*/
|
|
293
|
-
export declare const useMenuButtonBase_unstable: (
|
|
298
|
+
export declare const useMenuButtonBase_unstable: (props: MenuButtonBaseProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => MenuButtonBaseState;
|
|
294
299
|
|
|
295
300
|
export declare const useMenuButtonStyles_unstable: (state: MenuButtonState) => MenuButtonState;
|
|
296
301
|
|
|
@@ -301,17 +306,10 @@ export declare const useMenuButtonStyles_unstable: (state: MenuButtonState) => M
|
|
|
301
306
|
*/
|
|
302
307
|
export declare const useSplitButton_unstable: (props: SplitButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonState;
|
|
303
308
|
|
|
304
|
-
/**
|
|
305
|
-
* Given user props, defines default props for the SplitButton and returns processed state.
|
|
306
|
-
* @param props - User provided props to the SplitButton component.
|
|
307
|
-
* @param ref - User provided ref to be passed to the SplitButton component.
|
|
308
|
-
*/
|
|
309
|
-
export declare const useSplitButtonBase_unstable: (props: SplitButtonBaseProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => SplitButtonBaseState;
|
|
310
|
-
|
|
311
309
|
export declare const useSplitButtonStyles_unstable: (state: SplitButtonState) => SplitButtonState;
|
|
312
310
|
|
|
313
311
|
/**
|
|
314
|
-
* Given user props, defines default props for the ToggleButton, calls
|
|
312
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
|
315
313
|
* processed state.
|
|
316
314
|
* @param props - User provided props to the ToggleButton component.
|
|
317
315
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
@@ -319,15 +317,15 @@ export declare const useSplitButtonStyles_unstable: (state: SplitButtonState) =>
|
|
|
319
317
|
export declare const useToggleButton_unstable: (props: ToggleButtonProps, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonState;
|
|
320
318
|
|
|
321
319
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
320
|
+
* Base hook for ToggleButton component, which manages state related to slots structure and ARIA attributes.
|
|
321
|
+
*
|
|
324
322
|
* @param props - User provided props to the ToggleButton component.
|
|
325
323
|
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
326
324
|
*/
|
|
327
|
-
export declare const useToggleButtonBase_unstable: (props:
|
|
325
|
+
export declare const useToggleButtonBase_unstable: (props: ToggleButtonProps, ref?: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ToggleButtonBaseState;
|
|
328
326
|
|
|
329
327
|
export declare const useToggleButtonStyles_unstable: (state: ToggleButtonState) => ToggleButtonState;
|
|
330
328
|
|
|
331
|
-
export declare function useToggleState<TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>, TButtonState extends Pick<ButtonState, 'root'>, TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState;
|
|
329
|
+
export declare function useToggleState<TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable' | 'isAccessible'>, TButtonState extends Pick<ButtonState, 'root'>, TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root' | 'isAccessible'>>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState;
|
|
332
330
|
|
|
333
331
|
export { }
|
package/lib/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Button, buttonClassNames, renderButton_unstable, useButtonStyles_unstable, useButton_unstable, useButtonBase_unstable } from
|
|
1
|
+
export { Button, buttonClassNames, renderButton_unstable, useButtonStyles_unstable, useButton_unstable, useButtonBase_unstable } from "./components/Button/index.js";
|
package/lib/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type {\n ButtonBaseProps,\n ButtonProps,\n ButtonSlots,\n ButtonBaseState,\n ButtonState,\n} from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n useButtonBase_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","useButtonBase_unstable"],"mappings":"AAOA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB
|
|
1
|
+
{"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["export type {\n ButtonBaseProps,\n ButtonProps,\n ButtonSlots,\n ButtonBaseState,\n ButtonState,\n} from './components/Button/index';\nexport {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n useButtonBase_unstable,\n} from './components/Button/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","useButtonBase_unstable"],"mappings":"AAOA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,+BAA4B"}
|
package/lib/CompoundButton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CompoundButton, compoundButtonClassNames, renderCompoundButton_unstable, useCompoundButtonStyles_unstable, useCompoundButton_unstable
|
|
1
|
+
export { CompoundButton, compoundButtonClassNames, renderCompoundButton_unstable, useCompoundButtonStyles_unstable, useCompoundButton_unstable } from "./components/CompoundButton/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/CompoundButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/CompoundButton.ts"],"sourcesContent":["export type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './components/CompoundButton/index';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './components/CompoundButton/index';\n"],"names":["CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable"],"mappings":"AACA,SACEA,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,uCAAoC"}
|
package/lib/MenuButton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MenuButton, menuButtonClassNames, renderMenuButton_unstable, useMenuButtonStyles_unstable, useMenuButton_unstable, useMenuButtonBase_unstable } from
|
|
1
|
+
export { MenuButton, menuButtonClassNames, renderMenuButton_unstable, useMenuButtonStyles_unstable, useMenuButton_unstable, useMenuButtonBase_unstable } from "./components/MenuButton/index.js";
|
package/lib/MenuButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type {\n MenuButtonBaseProps,\n
|
|
1
|
+
{"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type {\n MenuButtonBaseProps,\n MenuButtonBaseState,\n MenuButtonProps,\n MenuButtonSlots,\n MenuButtonState,\n} from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n useMenuButtonBase_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","useMenuButtonBase_unstable"],"mappings":"AAOA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,0BAA0B,QACrB,mCAAgC"}
|
package/lib/SplitButton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SplitButton, renderSplitButton_unstable, splitButtonClassNames, useSplitButtonStyles_unstable, useSplitButton_unstable
|
|
1
|
+
export { SplitButton, renderSplitButton_unstable, splitButtonClassNames, useSplitButtonStyles_unstable, useSplitButton_unstable } from "./components/SplitButton/index.js";
|
package/lib/SplitButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SplitButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/SplitButton.ts"],"sourcesContent":["export type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './components/SplitButton/index';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './components/SplitButton/index';\n"],"names":["SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable"],"mappings":"AACA,SACEA,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,oCAAiC"}
|
package/lib/ToggleButton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ToggleButton, renderToggleButton_unstable, toggleButtonClassNames, useToggleButtonStyles_unstable, useToggleButton_unstable, useToggleButtonBase_unstable } from
|
|
1
|
+
export { ToggleButton, renderToggleButton_unstable, toggleButtonClassNames, useToggleButtonStyles_unstable, useToggleButton_unstable, useToggleButtonBase_unstable } from "./components/ToggleButton/index.js";
|
package/lib/ToggleButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n
|
|
1
|
+
{"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n ToggleButtonState,\n ToggleButtonBaseState,\n} from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n useToggleButtonBase_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleButtonBase_unstable"],"mappings":"AAMA,SACEA,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,4BAA4B,QACvB,qCAAkC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
3
|
-
import { renderButton_unstable } from
|
|
4
|
-
import { useButton_unstable } from
|
|
5
|
-
import { useButtonStyles_unstable } from
|
|
6
|
-
import { useCustomStyleHook_unstable } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { renderButton_unstable } from "./renderButton.js";
|
|
4
|
+
import { useButton_unstable } from "./useButton.js";
|
|
5
|
+
import { useButtonStyles_unstable } from "./useButtonStyles.styles.js";
|
|
6
|
+
import { useCustomStyleHook_unstable } from "@fluentui/react-shared-contexts";
|
|
7
7
|
/**
|
|
8
8
|
* Buttons give people a way to trigger an action.
|
|
9
9
|
*/ export const Button = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles.styles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('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"],"names":["React","renderButton_unstable","useButton_unstable","useButtonStyles_unstable","useCustomStyleHook_unstable","Button","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/Button.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles.styles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('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"],"names":["React","renderButton_unstable","useButton_unstable","useButtonStyles_unstable","useCustomStyleHook_unstable","Button","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,kBAAkB,QAAQ,iBAAc;AACjD,SAASC,wBAAwB,QAAQ,8BAA2B;AAGpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/E,MAAMC,QAAQP,mBAAmBK,OAAOC;IAExCL,yBAAyBM;IAEzBL,4BAA4B,4BAA4BK;IAExD,OAAOR,sBAAsBQ;AAC7B,0FAA0F;AAC5F,GAAuC;AAEvCJ,OAAOK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, 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<'a'>>>;\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\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\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?: ButtonSize;\n};\n\
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, 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<'a'>>>;\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\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\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?: ButtonSize;\n};\n\nexport type ButtonBaseProps = DistributiveOmit<ButtonProps, 'appearance' | 'size' | 'shape'>;\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\nexport type ButtonBaseState = DistributiveOmit<ButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":"AAmFA,WAA6F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { Button } from
|
|
2
|
-
export { renderButton_unstable } from
|
|
3
|
-
export { useButton_unstable } from
|
|
4
|
-
export {
|
|
5
|
-
export { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';
|
|
1
|
+
export { Button } from "./Button.js";
|
|
2
|
+
export { renderButton_unstable } from "./renderButton.js";
|
|
3
|
+
export { useButton_unstable, useButtonBase_unstable } from "./useButton.js";
|
|
4
|
+
export { buttonClassNames, useButtonStyles_unstable } from "./useButtonStyles.styles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonBaseProps, ButtonProps, ButtonSlots, ButtonBaseState, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonBaseProps, ButtonProps, ButtonSlots, ButtonBaseState, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable, useButtonBase_unstable } from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';\n"],"names":["Button","renderButton_unstable","useButton_unstable","useButtonBase_unstable","buttonClassNames","useButtonStyles_unstable"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAW;AAGlC,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,kBAAkB,EAAEC,sBAAsB,QAAQ,iBAAc;AACzE,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,8BAA2B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
-
import { assertSlots } from
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Renders a Button component by passing the state defined props to the appropriate slots.
|
|
5
5
|
*/ export const renderButton_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/renderButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { ButtonSlots,
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/renderButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { ButtonSlots, ButtonBaseState } 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: ButtonBaseState): JSXElement => {\n assertSlots<ButtonSlots>(state);\n const { iconOnly, iconPosition } = state;\n\n return (\n <state.root>\n {iconPosition !== 'after' && state.icon && <state.icon />}\n {!iconOnly && state.root.children}\n {iconPosition === 'after' && state.icon && <state.icon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderButton_unstable","state","iconOnly","iconPosition","root","icon","children"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD;;CAEC,GACD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IACzB,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGF;IAEnC,qBACE,MAACA,MAAMG,IAAI;;YACRD,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;YACrD,CAACH,YAAYD,MAAMG,IAAI,CAACE,QAAQ;YAChCH,iBAAiB,WAAWF,MAAMI,IAAI,kBAAI,KAACJ,MAAMI,IAAI;;;AAG5D,EAAE"}
|
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useButtonContext } from "../../contexts/ButtonContext.js";
|
|
3
|
+
import { useARIAButtonProps } from "@fluentui/react-aria";
|
|
4
|
+
import { slot } from "@fluentui/react-utilities";
|
|
5
5
|
/**
|
|
6
6
|
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
|
7
7
|
* @param props - User provided props to the Button component.
|
|
8
8
|
* @param ref - User provided ref to be passed to the Button component.
|
|
9
9
|
*/ export const useButton_unstable = (props, ref)=>{
|
|
10
10
|
const { size: contextSize } = useButtonContext();
|
|
11
|
-
const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' } = props;
|
|
12
|
-
const state = useButtonBase_unstable(
|
|
11
|
+
const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium', ...buttonProps } = props;
|
|
12
|
+
const state = useButtonBase_unstable(buttonProps, ref);
|
|
13
13
|
return {
|
|
14
|
-
// Props passed at the top-level
|
|
15
14
|
appearance,
|
|
16
15
|
shape,
|
|
17
16
|
size,
|
|
18
17
|
...state
|
|
19
18
|
};
|
|
20
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Base hook for Button component, which manages state related to slots structure and ARIA attributes.
|
|
22
|
+
*
|
|
23
|
+
* @param props - User provided props to the Button component.
|
|
24
|
+
* @param ref - User provided ref to be passed to the Button component.
|
|
25
|
+
*/ export const useButtonBase_unstable = (props, ref)=>{
|
|
26
|
+
const { icon, iconPosition = 'before', ...buttonProps } = props;
|
|
27
|
+
const iconShorthand = slot.optional(icon, {
|
|
28
|
+
elementType: 'span'
|
|
29
|
+
});
|
|
30
|
+
var _props_disabled, _props_disabledFocusable;
|
|
31
|
+
return {
|
|
32
|
+
disabled: (_props_disabled = props.disabled) !== null && _props_disabled !== void 0 ? _props_disabled : false,
|
|
33
|
+
disabledFocusable: (_props_disabledFocusable = props.disabledFocusable) !== null && _props_disabledFocusable !== void 0 ? _props_disabledFocusable : false,
|
|
34
|
+
iconPosition,
|
|
35
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
|
|
36
|
+
components: {
|
|
37
|
+
root: 'button',
|
|
38
|
+
icon: 'span'
|
|
39
|
+
},
|
|
40
|
+
root: slot.always(useARIAButtonProps(buttonProps.as, buttonProps), {
|
|
41
|
+
elementType: 'button',
|
|
42
|
+
defaultProps: {
|
|
43
|
+
ref: ref,
|
|
44
|
+
type: props.as !== 'a' ? 'button' : undefined
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
icon: iconShorthand
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { slot } from '@fluentui/react-utilities';\nimport type { ButtonBaseProps, ButtonBaseState, 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 { size: contextSize } = useButtonContext();\n const { appearance = 'secondary', shape = 'rounded', size = contextSize ?? 'medium', ...buttonProps } = props;\n const state = useButtonBase_unstable(buttonProps, ref);\n\n return {\n appearance,\n shape,\n size,\n ...state,\n };\n};\n\n/**\n * Base hook for Button component, which manages state related to slots structure and ARIA attributes.\n *\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 useButtonBase_unstable = (\n props: ButtonBaseProps,\n ref?: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonBaseState => {\n const { icon, iconPosition = 'before', ...buttonProps } = props;\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n\n return {\n disabled: props.disabled ?? false,\n disabledFocusable: props.disabledFocusable ?? false,\n iconPosition,\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n components: { root: 'button', icon: 'span' },\n root: slot.always<ARIAButtonSlotProps<'a'>>(useARIAButtonProps(buttonProps.as, buttonProps), {\n elementType: 'button',\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: props.as !== 'a' ? 'button' : undefined,\n },\n }),\n icon: iconShorthand,\n };\n};\n"],"names":["useButtonContext","useARIAButtonProps","slot","useButton_unstable","props","ref","size","contextSize","appearance","shape","buttonProps","state","useButtonBase_unstable","icon","iconPosition","iconShorthand","optional","elementType","disabled","disabledFocusable","iconOnly","Boolean","children","components","root","always","as","defaultProps","type","undefined"],"mappings":"AAAA;AAGA,SAASA,gBAAgB,QAAQ,kCAA+B;AAEhE,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,IAAI,QAAQ,4BAA4B;AAGjD;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,OACAC;IAEA,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGP;IAC9B,MAAM,EAAEQ,aAAa,WAAW,EAAEC,QAAQ,SAAS,EAAEH,OAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,EAAE,GAAGG,aAAa,GAAGN;IACxG,MAAMO,QAAQC,uBAAuBF,aAAaL;IAElD,OAAO;QACLG;QACAC;QACAH;QACA,GAAGK,KAAK;IACV;AACF,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMC,yBAAyB,CACpCR,OACAC;IAEA,MAAM,EAAEQ,IAAI,EAAEC,eAAe,QAAQ,EAAE,GAAGJ,aAAa,GAAGN;IAC1D,MAAMW,gBAAgBb,KAAKc,QAAQ,CAACH,MAAM;QAAEI,aAAa;IAAO;QAGpDb,iBACSA;IAFrB,OAAO;QACLc,UAAUd,CAAAA,kBAAAA,MAAMc,QAAQ,cAAdd,6BAAAA,kBAAkB;QAC5Be,mBAAmBf,CAAAA,2BAAAA,MAAMe,iBAAiB,cAAvBf,sCAAAA,2BAA2B;QAC9CU;QACAM,UAAUC,QAAQN,CAAAA,0BAAAA,oCAAAA,cAAeO,QAAQ,KAAI,CAAClB,MAAMkB,QAAQ;QAC5DC,YAAY;YAAEC,MAAM;YAAUX,MAAM;QAAO;QAC3CW,MAAMtB,KAAKuB,MAAM,CAA2BxB,mBAAmBS,YAAYgB,EAAE,EAAEhB,cAAc;YAC3FO,aAAa;YACbU,cAAc;gBACZtB,KAAKA;gBACLuB,MAAMxB,MAAMsB,EAAE,KAAK,MAAM,WAAWG;YACtC;QACF;QACAhB,MAAME;IACR;AACF,EAAE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { iconFilledClassName, iconRegularClassName } from
|
|
4
|
-
import { createCustomFocusIndicatorStyle } from
|
|
5
|
-
import { tokens } from
|
|
6
|
-
import { shorthands, __styles, __resetStyles, mergeClasses } from
|
|
3
|
+
import { iconFilledClassName, iconRegularClassName } from "@fluentui/react-icons";
|
|
4
|
+
import { createCustomFocusIndicatorStyle } from "@fluentui/react-tabster";
|
|
5
|
+
import { tokens } from "@fluentui/react-theme";
|
|
6
|
+
import { shorthands, __styles, __resetStyles, mergeClasses } from "@griffel/react";
|
|
7
7
|
export const buttonClassNames = {
|
|
8
8
|
root: 'fui-Button',
|
|
9
9
|
icon: 'fui-Button__icon'
|
|
@@ -518,8 +518,6 @@ const useIconStyles = /*#__PURE__*/__styles({
|
|
|
518
518
|
d: [".fe5j1ua{font-size:20px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}", ".fbaiahx{--fui-Button__icon--spacing:var(--spacingHorizontalXS);}", ".f1rt2boy{font-size:24px;}", ".frvgh55{height:24px;}", ".fq4mcun{width:24px;}", ".f1exjqw5{--fui-Button__icon--spacing:var(--spacingHorizontalSNudge);}", ".f1nizpg2{margin-right:var(--fui-Button__icon--spacing);}", ".f1a695kz{margin-left:var(--fui-Button__icon--spacing);}"]
|
|
519
519
|
});
|
|
520
520
|
export const useButtonStyles_unstable = state => {
|
|
521
|
-
'use no memo';
|
|
522
|
-
|
|
523
521
|
const rootBaseClassName = useRootBaseClassName();
|
|
524
522
|
const iconBaseClassName = useIconBaseClassName();
|
|
525
523
|
const rootStyles = useRootStyles();
|
|
@@ -537,6 +535,7 @@ export const useButtonStyles_unstable = state => {
|
|
|
537
535
|
shape,
|
|
538
536
|
size
|
|
539
537
|
} = state;
|
|
538
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
540
539
|
state.root.className = mergeClasses(buttonClassNames.root, rootBaseClassName, appearance && rootStyles[appearance], rootStyles[size], icon && size === 'small' && rootStyles.smallWithIcon, icon && size === 'large' && rootStyles.largeWithIcon, rootStyles[shape],
|
|
541
540
|
// Disabled styles
|
|
542
541
|
(disabled || disabledFocusable) && rootDisabledStyles.base, (disabled || disabledFocusable) && rootDisabledStyles.highContrast, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance],
|
|
@@ -547,6 +546,7 @@ export const useButtonStyles_unstable = state => {
|
|
|
547
546
|
// User provided class name
|
|
548
547
|
state.root.className);
|
|
549
548
|
if (state.icon) {
|
|
549
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
550
550
|
state.icon.className = mergeClasses(buttonClassNames.icon, iconBaseClassName, !!state.root.children && iconStyles[iconPosition], iconStyles[size], state.icon.className);
|
|
551
551
|
}
|
|
552
552
|
return state;
|