import * as React from 'react';
import { TouchRippleProps } from './TouchRipple';
import { OverrideProps, OverridableComponent, OverridableTypeMap } from '../OverridableComponent';
export interface ButtonBaseTypeMap
{
props: P & {
/**
* A ref for imperative actions.
* It currently only supports `focusVisible()` action.
*/
action?: React.Ref;
/**
* @ignore
*
* Use that prop to pass a ref to the native button component.
* @deprecated Use `ref` instead.
*/
buttonRef?: React.Ref;
/**
* If `true`, the ripples will be centered.
* They won't start at the cursor interaction position.
* @default false
*/
centerRipple?: boolean;
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: {
/** Styles applied to the root element. */
root?: string;
/** Pseudo-class applied to the root element if `disabled={true}`. */
disabled?: string;
/** Pseudo-class applied to the root element if keyboard focused. */
focusVisible?: string;
};
/**
* If `true`, the base button will be disabled.
* @default false
*/
disabled?: boolean;
/**
* If `true`, the ripple effect will be disabled.
*
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
* to highlight the element by applying separate styles with the `focusVisibleClassName`.
* @default false
*/
disableRipple?: boolean;
/**
* If `true`, the touch ripple effect will be disabled.
* @default false
*/
disableTouchRipple?: boolean;
/**
* If `true`, the base button will have a keyboard focus ripple.
* @default false
*/
focusRipple?: boolean;
/**
* This prop can help a person know which element has the keyboard focus.
* The class name will be applied when the element gain the focus through a keyboard interaction.
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/master/explainer.md).
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
* if needed.
*/
focusVisibleClassName?: string;
/**
* Callback fired when the component is focused with a keyboard.
* We trigger a `onFocus` callback too.
*/
onFocusVisible?: React.FocusEventHandler;
// @types/react is stricter
/**
* @default 0
*/
tabIndex?: string | number;
/**
* Props applied to the `TouchRipple` element.
*/
TouchRippleProps?: Partial;
};
defaultComponent: D;
}
/**
* utility to create component types that inherit props from ButtonBase.
* This component has an additional overload if the `href` prop is set which
* can make extension quite tricky
*/
export interface ExtendButtonBaseTypeMap {
props: M['props'] & Omit;
defaultComponent: M['defaultComponent'];
}
export type ExtendButtonBase = ((
props: { href: string } & OverrideProps, 'a'>
) => JSX.Element) &
OverridableComponent>;
/**
* `ButtonBase` contains as few styles as possible.
* It aims to be a simple building block for creating a button.
* It contains a load of style reset and some focus/ripple logic.
* Demos:
*
* - [Buttons](https://material-ui.com/components/buttons/)
*
* API:
*
* - [ButtonBase API](https://material-ui.com/api/button-base/)
*/
declare const ButtonBase: ExtendButtonBase;
export type ButtonBaseProps<
D extends React.ElementType = ButtonBaseTypeMap['defaultComponent'],
P = {}
> = OverrideProps, D>;
export type ButtonBaseClassKey = keyof NonNullable;
export interface ButtonBaseActions {
focusVisible(): void;
}
export default ButtonBase;