import * as React from 'react'; import { MuiCancellableEventHandler } from '../utils/MuiCancellableEvent'; export interface UseButtonParameters { /** * If `true`, the component is disabled. * @default false */ disabled?: boolean; /** * If `true`, allows a disabled button to receive focus. * @default false */ focusableWhenDisabled?: boolean; href?: string; onFocusVisible?: React.FocusEventHandler; rootRef?: React.Ref; tabIndex?: NonNullable['tabIndex']>; to?: string; /** * Type attribute applied when the `component` is `button`. * @default 'button' */ type?: React.ButtonHTMLAttributes['type']; } export interface UseButtonRootSlotOwnProps { 'aria-disabled'?: React.AriaAttributes['aria-disabled']; disabled?: boolean; tabIndex?: number; type?: React.ButtonHTMLAttributes['type']; role?: React.AriaRole; onBlur: React.FocusEventHandler; onFocus: React.FocusEventHandler; onKeyDown: MuiCancellableEventHandler; onKeyUp: MuiCancellableEventHandler; onMouseDown: React.MouseEventHandler; onMouseLeave: React.MouseEventHandler; ref: React.RefCallback | null; } export type UseButtonRootSlotProps = ExternalProps & UseButtonRootSlotOwnProps; export interface UseButtonReturnValue { /** * Resolver for the root slot's props. * @param externalProps additional props for the root slot * @returns props that should be spread on the root slot */ getRootProps: = {}>(externalProps?: ExternalProps) => UseButtonRootSlotProps; /** * If `true`, the component is being focused using keyboard. */ focusVisible: boolean; /** * Callback for setting the `focusVisible` param. */ setFocusVisible: React.Dispatch>; /** * If `true`, the component is active (pressed). */ active: boolean; /** * A ref to the component's root DOM element. */ rootRef: React.RefCallback | null; }