import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from "react";
import { createAccentVariables, type RgbTuple } from "@nodedc/ui-core";
import { cn } from "./cn.js";
import { ActivityIndicator } from "./ActivityIndicator.js";
export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "accent";
export type ButtonSize = "default" | "compact" | "dense";
export type ButtonShape = "default" | "pill" | "rounded";
export interface ButtonProps extends ButtonHTMLAttributes {
variant?: ButtonVariant;
/** Neutral primary actions remain white/gray independently of the product accent. */
tone?: "theme" | "neutral";
size?: ButtonSize;
width?: "auto" | "full";
shape?: ButtonShape;
accent?: RgbTuple;
icon?: ReactNode;
/** Pending state belongs to this action; dimensions and accessible name stay unchanged. */
loading?: boolean;
}
export const Button = forwardRef(function Button({
variant = "secondary",
tone = "theme",
size = "default",
width = "auto",
shape = "default",
accent,
icon,
className,
children,
style,
type = "button",
loading = false,
disabled,
...props
}, ref) {
const accentStyle = accent ? createAccentVariables(accent) : undefined;
return (
);
});
export interface IconButtonProps extends ButtonHTMLAttributes {
label: string;
shape?: "circle" | "rounded";
loading?: boolean;
}
export const IconButton = forwardRef(function IconButton({
label,
shape = "circle",
className,
children,
type = "button",
loading = false,
disabled,
...props
}, ref) {
return (
);
});