import type { Color } from "@yaakapp-internal/plugins"; import classNames from "classnames"; import type { HTMLAttributes, ReactNode } from "react"; import { forwardRef } from "react"; import { Icon } from "./Icon"; import { LoadingIcon } from "./LoadingIcon"; type ButtonVariant = "border" | "solid"; type ButtonSize = "2xs" | "xs" | "sm" | "md" | "auto"; export type ButtonProps = Omit< HTMLAttributes, "color" | "onChange" > & { innerClassName?: string; color?: Color | "custom" | "default"; tone?: Color | "default"; variant?: ButtonVariant; isLoading?: boolean; size?: ButtonSize; justify?: "start" | "center"; type?: "button" | "submit"; forDropdown?: boolean; disabled?: boolean; title?: string; leftSlot?: ReactNode; rightSlot?: ReactNode; }; export const Button = forwardRef(function Button( { isLoading, className, innerClassName, children, color, tone, forDropdown, type = "button", justify = "center", size = "md", variant = "solid", leftSlot, rightSlot, disabled, title, onClick, ...props }: ButtonProps, ref, ) { const resolvedColor = color ?? tone ?? "default"; const isDisabled = disabled || isLoading; return ( ); });