import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode, Ref } from 'react';
import { cx } from '../utils/cx';
import type { Size } from '../utils/types';
import { Spinner } from './Spinner';
export type ButtonVariant = 'primary' | 'secondary' | 'subtle' | 'ghost' | 'destructive' | 'link';
export interface ButtonProps extends Omit, 'ref'> {
variant?: ButtonVariant;
size?: Size;
block?: boolean;
pill?: boolean;
loading?: boolean;
startIcon?: ReactNode;
endIcon?: ReactNode;
ref?: Ref;
}
export function Button({
variant = 'primary',
size = 'md',
block = false,
pill = true,
loading = false,
startIcon,
endIcon,
className,
children,
disabled,
type = 'button',
ref,
...rest
}: ButtonProps) {
return (
);
}
export interface IconButtonProps extends Omit {
/** Required: icon-only controls have no visible text to name them. */
label: string;
icon: ReactNode;
}
export function IconButton({
label,
icon,
variant = 'ghost',
size = 'md',
pill = true,
className,
ref,
...rest
}: IconButtonProps) {
return (
);
}
export interface ButtonGroupProps extends HTMLAttributes {
/** `attached` welds buttons into one segmented control; `spaced` keeps a gap. */
variant?: 'attached' | 'spaced';
orientation?: 'horizontal' | 'vertical';
/** Announce the group to assistive tech, e.g. "Text alignment". */
label?: string;
}
export function ButtonGroup({
variant = 'attached',
orientation = 'horizontal',
label,
className,
children,
...rest
}: ButtonGroupProps) {
return (
{children}
);
}