import { BaseSlots } from '@fluentui/react-compose'; import { ColorTokenSet } from '@fluentui/react-theme-provider'; import { ComponentProps } from '@fluentui/react-compose/lib/next/index'; import * as React from 'react'; import { ShorthandProps } from '@fluentui/react-compose/lib/next/index'; import { SlotProps } from '@fluentui/react-compose'; /** * Define a styled Button, using the `useButton` hook. */ export declare const Button: React.ForwardRefExoticComponent & React.RefAttributes>; export declare type ButtonProps = ComponentProps & React.HTMLAttributes & { /** * Shorthand icon. A shorthand prop can be a literal, object, or * JSX. The `children` prop of the object can be a render function, * taking in the original slot component and props. */ icon?: ShorthandProps; /** * Shorthand loader content within the button. */ loader?: ShorthandProps; /** * Shorthand children content within the button. */ children?: ShorthandProps; /** * Defines the href to navigate to. If applied, will render the button as an anchor * element by default, unless `as` specifies otherwise. Note that specifying an href * and a non-anchor as the render type will prevent the Button from behaving like a * hyperlink and opening the href on click. */ href?: string; /** * Defines the target window to open the href in. Only is applied if the button renders * as an anchor tag, which is the default behavior if href is provided. */ target?: string; /** A button can appear circular. */ circular?: boolean; /** A button can show that it cannot be interacted with. */ disabled?: boolean; /** A button can fill the width of its container. */ fluid?: boolean; /** A button can contain only an icon. */ iconOnly?: boolean; /** An icon button can format its icon to appear before or after its content. */ iconPosition?: 'before' | 'after'; /** A button that inherits its background and has a subtle appearance. */ inverted?: boolean; /** A button can show a loading indicator. */ loading?: boolean; /** * Called after a user clicks the button. * @param event - React's original SyntheticEvent. * @param data - All props. */ /** * Called after a user focuses the button. * @param event - React's original SyntheticEvent. * @param data - All props. */ /** A button can emphasize that it represents the primary action. */ primary?: boolean; /** A button can emphasize that it represents an alternative action. */ secondary?: boolean; /** A button can be sized. */ size?: SizeValue; /** A button can be formatted to show only text in order to indicate a less-pronounced action. */ tokens?: RecursivePartial; }; /** * Consts listing which props are shorthand props. */ export declare const buttonShorthandProps: string[]; export declare type ButtonSlotProps = SlotProps>; export declare interface ButtonSlots extends BaseSlots { icon: React.ElementType; loader: React.ElementType; } export declare interface ButtonState extends ButtonProps { buttonRef?: React.RefObject; } export declare type ButtonTokenSet = ColorTokenSet & { padding: string; margin: string; height: string; minWidth: string; maxWidth: string; minHeight: string; contentGap: string; iconSize: string; borderRadius: string; borderWidth: string; boxShadow: string; width: string; size: { smallest: string; smaller: string; small: string; regular: string; large: string; larger: string; largest: string; }; transform: string; transition: string; fontFamily: string; fontSize: string; fontWeight: string; pressed: { transform: string; transition: string; }; }; export declare interface CheckedState { checked?: boolean; defaultChecked?: boolean; onClick?: React.DOMAttributes['onClick']; role?: string; 'aria-checked'?: React.AriaAttributes['aria-pressed']; 'aria-pressed'?: React.AriaAttributes['aria-pressed']; } export declare type ExpandedState = { ref?: React.Ref; expanded?: boolean; defaultExpanded?: boolean; onClick?: (ev: React.MouseEvent) => void; onMenuDismiss?: () => void; onKeyDown?: (ev: React.KeyboardEvent) => void; 'aria-expanded'?: boolean; 'aria-haspopup'?: boolean; menu: { target?: React.Ref; onDismiss?: () => void; }; }; export declare const MenuButton: React.ForwardRefExoticComponent & React.RefAttributes>; export declare type MenuButtonProps = Omit & { /** * Menu that is displayed when the button is pressed. */ menu?: ShorthandProps; /** * Menu icon that indicates that this button has a menu that can be expanded. */ menuIcon?: ShorthandProps; /** * Defines the inital expanded state of the MenuButton. Use this if you want the MenuButton to maintain its own state. * Mutually exclusive with `expanded`. * @defaultvalue false */ defaultExpanded?: boolean; /** * Defines whether the MenuButton is in an expanded state. Use this if you wish to have the expanded state of the * MenuButton be controlled. Mutually exclusive with `defaultExpanded`. * @defaultvalue defaultExpanded */ expanded?: boolean; /** * Defines a callback that runs after the MenuButton's contextual menu has been dismissed. */ onMenuDismiss?: () => void; }; export declare const menuButtonShorthandProps: string[]; export declare interface MenuButtonState extends MenuButtonProps, Omit { menu: ExpandedState['menu']; } export declare type MenuButtonTokens = ButtonTokenSet; declare type RecursivePartial = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial[] : T[P] extends object ? RecursivePartial : T[P]; }; export declare type SizeValue = 'smallest' | 'smaller' | 'small' | 'medium' | 'large' | 'larger' | 'largest'; export declare const SplitButton: React.ForwardRefExoticComponent & React.RefAttributes>; export declare interface SplitButtonProps extends ButtonProps, MenuButtonProps { /** * Button to perform primary action in SplitButton. */ button?: ShorthandProps; /** * Divider that separates the primary action button and the menu button parts of the SplitButton */ divider?: ShorthandProps; /** * Button that opens menu with secondary actions in SplitButton. */ menuButton?: ShorthandProps; } export declare const splitButtonShorthandProps: string[]; export declare interface SplitButtonState extends Omit, MenuButtonState { menuButtonRef?: React.RefObject; } export declare type SplitButtonTokens = MenuButtonTokens; /** * Define a styled Button, using the `createButton` factory. */ export declare const ToggleButton: React.ForwardRefExoticComponent & React.RefAttributes>; export declare interface ToggleButtonProps extends ButtonProps { /** * Defines the controlled checked state of the `ToggleButton`. * Mutually exclusive to `defaultChecked`. * 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 * correct value based on handling `onClick` events and re-rendering. */ checked?: boolean; /** * Defines whether the `ToggleButton` is inititally in a checked state or not when rendered. * Mutually exclusive to `checked`. */ defaultChecked?: boolean; } export declare type ToggleButtonSlotProps = SlotProps>; export declare interface ToggleButtonSlots extends ButtonSlots { } export declare interface ToggleButtonState extends ToggleButtonProps { } /** * Given user props, returns state and render function for a Button. */ export declare const useButton: (props: ButtonProps, ref: React.Ref, defaultProps?: ButtonProps | undefined) => { state: Record; render: (state: import("./Button.types").ButtonState) => JSX.Element; }; export declare const useButtonClasses: (state: Record) => void; /** * The useButton hook processes the Button draft state. * @param draftState - Button draft state to mutate. */ export declare const useButtonState: (draftState: ButtonState) => void; /** * The useToggle hook processes adds the correct toggled state and acccessibility as needed. * @param draftState - state to read and augment. */ export declare const useChecked: (draftState: TDraftState) => void; /** * @param draftState - mutable state object to update to add expanded behavior. */ export declare const useExpanded: (draftState: TDraftState) => void; /** * Redefine the component factory, reusing button factory. */ export declare const useMenuButton: (props: MenuButtonProps, ref: React.Ref, defaultProps?: MenuButtonProps | undefined) => { state: MenuButtonState; render: (state: MenuButtonState) => JSX.Element; }; export declare const useMenuButtonClasses: (state: Record) => void; export declare const useMenuButtonState: (state: MenuButtonState) => void; /** * Redefine the component factory, reusing button factory. */ export declare const useSplitButton: (props: SplitButtonProps, ref: React.Ref, defaultProps?: SplitButtonProps | undefined) => { state: SplitButtonState; render: (state: SplitButtonState) => JSX.Element; }; export declare const useSplitButtonClasses: (state: Record) => void; export declare const useSplitButtonState: (state: SplitButtonState) => void; export declare const useToggleButton: (props: ToggleButtonProps, ref: import("react").Ref, defaultProps?: ToggleButtonProps | undefined) => { state: Record; render: (state: import("../Button").ButtonState) => JSX.Element; }; export declare const useToggleButtonClasses: (state: Record) => void; export { }