import { ButtonProps as RACButtonProps } from 'react-aria-components'; import { IconElement } from '@servicetitan/anvil2-icons'; export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger"; export type ButtonSize = "medium" | "small" | "xsmall"; /** * A bare {@link IconElement} makes the button icon-only. The object form pairs * the icon with visible text, placed before or after the label. */ export type ButtonIcon = IconElement | { icon: IconElement; position: "left" | "right"; }; type RACButtonPassthrough = Omit; export type ButtonProps = RACButtonPassthrough & { /** * Required accessible name. Visible text for labelled buttons; `aria-label` + * tooltip content when `icon` is a bare {@link IconElement}. An explicit * `aria-label` wins. Prefer a short imperative over a sentence. */ label: string; /** Visual intent. Defaults to `primary`. */ variant?: ButtonVariant; /** * Defaults to `medium`. `xsmall` is promoted to a larger minimum target on * coarse pointers, per WCAG 2.5.5. */ size?: ButtonSize; /** Icon-only or label-paired; see {@link ButtonIcon}. */ icon?: ButtonIcon; className?: string; }; export {};