import * as React from 'react'; import type { IconElement } from '../../icons/icons'; /** * The click event for a button. */ export type TouchOrMouseEvent = React.SyntheticEvent & Partial, 'nativeEvent'>> & Partial, 'nativeEvent'>>; /** * The appearance of a button, indicating its priority. */ export type Variant = 'primary' | 'secondary' | 'tertiary' | 'contrast'; /** * The position of the icon within the button. */ export type IconPosition = 'start' | 'end'; /** * * The alignment of button content. */ export type Alignment = 'start' | 'center' | 'end'; /** * The base props for the `Button` component. */ type BaseButtonProps = { /** * A label that describes what the button does. * This must be supplied if the button doesn't have any text content (i.e. an icon-only button). */ ariaLabel?: string; /** * A human readable label that appears in a tooltip when the user's cursor hovers over the button. */ tooltipLabel?: string; /** * A human readable label for the button. */ children?: string; /** * If `true`, the user can't interact with the button. * @defaultValue false */ disabled?: boolean; /** * If `true`, the Button will show selected styles. * Use to mark an effect being applied. * Do not use if the button cannot be unselected. * @defaultValue false */ selected?: boolean; /** * The icon to render inside the button. * This must be one of the icons provided by the App UI Kit. */ icon?: () => IconElement; /** * The position of the icon within the button. * @defaultValue 'start' */ iconPosition?: IconPosition; /** * The alignment of button content. * @defaultValue `center` */ alignment?: Alignment; /** * The type of button. * @defaultValue "button" */ type?: 'submit' | 'button' | 'reset'; /** * If `true`, the button is rendered in a loading state. */ loading?: boolean; /** * A callback that runs when the button is clicked. * @param event - The click event for the button. */ onClick?: (event: TouchOrMouseEvent) => void; /** * If `true`, the button expands to fill the width of its container. * If the button is a child of a `Rows` component, it automatically expands to fill the width of its container and this prop has no effect. * @defaultValue false */ stretch?: boolean; /** * The appearance of the button, indicating its priority. */ variant: Variant; /** * If `true`, the button is rendered in a pressed state. */ pressed?: boolean; }; /** * The props for the `Button` component when `pressed` is allowed. */ type ButtonPropsWithPressed = BaseButtonProps & { /** * If `true`, the button is rendered in a pressed state. */ pressed?: boolean; variant?: 'tertiary' | 'secondary' | 'contrast'; }; /** * The props for the `Button` component when `pressed` is not allowed. */ type ButtonPropsWithoutPressed = BaseButtonProps & { pressed?: never; variant?: 'primary'; }; type ButtonPropsPressedOrNot = ButtonPropsWithPressed | ButtonPropsWithoutPressed; /** * The props for the `Button` component when size is allowed. */ type ButtonPropsWithSize = ButtonPropsPressedOrNot & { /** * The size of the `Button`. * Can only be used with a `tertiary` variant icon button. * @defaultValue: 'medium' */ size?: 'small' | 'medium'; children?: never; variant?: 'tertiary' | 'contrast'; icon: () => IconElement; }; /** * The props for the `Button` component when size is not allowed. */ type ButtonPropsWithoutSize = ButtonPropsPressedOrNot & { size?: never; }; /** * The props for the `Button` component. */ export type ButtonProps = ButtonPropsWithSize | ButtonPropsWithoutSize; /** * Triggers an action, such as the submission of a form. */ export declare function Button(props: ButtonProps): React.JSX.Element; export {};