import "./icon_button.css"; import type * as React from "react"; import { Button as Base } from "@base-ui/react/button"; import { type IconName } from "./icon"; import { type ButtonColor } from "./button"; import { type StyleProps, type TriggerProps } from "./style_props"; import { type TooltipSide } from "./tooltip"; import { type InkColor } from "./text_ink"; export type IconButtonColor = ButtonColor | "none" | "white"; export type IconButtonSize = "lg" | "md" | "sm"; interface IconButtonBase extends StyleProps, TriggerProps { ref?: React.Ref; testID?: string; icon: IconName; /** Matches `Button`'s palette so an icon-only action migrates 1:1 — a filled * disc for primary/secondary/danger, a ghost for muted/danger-secondary/none. */ color?: IconButtonColor; /** `lg` (40px, 20px glyph) for a circular primary action at the system control * height; `md` (28px, 16px) for toolbars and a register row's action; `sm` * (24px, 14px) for inline affordances next to body/sm text. md/sm keep a 40px * touch target by extending the press area past the disc. */ size?: IconButtonSize; /** A glyph ink ROLE the CALL SITE owns, where the variant's own is not the * meaning — a destructive verb on a neutral disc. */ iconColor?: InkColor; /** Floating variant: a card fill + hairline border + soft shadow, so the button * reads as a target sitting ON TOP of imagery or a colored surface. */ elevated?: boolean; tooltipSide?: TooltipSide; onPress?: (event: React.MouseEvent) => void; disabled?: boolean; /** Show a spinner in place of the icon (and block press). */ loading?: boolean; render?: Base.Props["render"]; } /** * An icon-only button has no visible text, so it must carry an accessible name. * The compiler enforces at least one of `tooltip` (also shown visually on hover) * or `accessibilityLabel`; when both are present, `accessibilityLabel` is the * announced name. */ export type IconButtonProps = IconButtonBase & ({ tooltip: string; accessibilityLabel?: string; } | { tooltip?: string; accessibilityLabel: string; }); export declare function IconButton(props: IconButtonProps): React.JSX.Element; export {};