import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ComponentType, MouseEvent, ReactNode } from 'react'; import React from 'react'; export type ButtonType = 'submit' | 'button' | 'reset'; export type Props = ButtonProps & AnchorProps & CommonProps; export interface CommonProps { /** * Unique ID for the component */ id?: string; /** * Content of Button component */ children?: ReactNode; /** * On Button click callback */ onClick?: (e: MouseEvent) => void; /** * On Button mouse down callback */ onMouseDown?: (e: MouseEvent) => void; /** * Allows to change version of Button component to small */ small?: boolean; /** * Allows to change styling of Button component to for dark backgrounds */ darkBg?: boolean; /** * Allows to change width of Button component to size of its wrapper */ fullWidth?: boolean; /** * Displays loading indicator (PixelLoader) instead of children * * @default false */ loading?: boolean; /** * Allows to pass a custom className */ className?: string; /** * Adds data attribute `data-track-value` to button */ 'data-track-value'?: string; /** * Allows to pass testid string for testing purposes */ 'data-testid'?: string; /** * Allows to pass a screen reader label for the button */ 'aria-label'?: string; /** * Allows to pass an id of the element that labels the button for screen readers */ 'aria-labelledby'?: string; /** * Allows to pass any data-* attribute */ dataAttributes?: Record<`data-${string}`, string>; /** * Allows to pass a screen reader label for the loading indicator */ loadingLabel?: string; } type ButtonProps = CommonProps & Omit, keyof CommonProps | 'href' | 'nextLink' | 'target'> & { /** * Name of the button element */ name?: string; /** * Allows to change the HTML type of button element. Ignored when `href` is defined * * @param {ButtonType} submit Button submits the form data * @param {ButtonType} button No functionality when pressed * @param {ButtonType} reset Button resets all the controls to their initial values * * @default 'button' */ type?: ButtonType; /** * Allows disabling the component functionality. * When `href` is defined, disables the link functionality. * * @default false */ disabled?: boolean; }; type AnchorProps = CommonProps & Omit, keyof CommonProps | 'name' | 'disabled' | 'type'> & { /** * Allows to change the type of resulting HTML element from button (``) to anchor (``) */ href?: string; /** * Allows to use a custom link component instead of anchor element when `href` is defined */ nextLink?: ComponentType<{ href: string; children: ReactNode; }>; /** * Allows to set the target attribute for the link */ target?: '_self' | '_blank' | '_parent' | '_top'; }; export declare const shade: { pink: { darker: string; lighter: string; }; plum: { darker: string; lighter: string; }; sand: { E02: { darker: string; lighter: string; }; }; }; /** @visibleName Button */ declare const Button: React.ForwardRefExoticComponent<(ButtonProps | AnchorProps) & React.RefAttributes>; /** @component */ export default Button;