import { ComponentPropsWithRef, forwardRef, Ref } from 'react'; import { PiSpinnerBold } from 'react-icons/pi'; import { colorLookup, fieldSize2XlLookup, fieldSizeLgLookup, fieldSizeLookup, fieldSizeMdLookup, fieldSizeXlLookup, fontFamilyLookup, fontSize2xlLookup, fontSizeLgLookup, fontSizeLookup, fontSizeMdLookup, fontSizeXlLookup, fontWeight2xlLookup, fontWeightLgLookup, fontWeightLookup, fontWeightMdLookup, fontWeightXlLookup, radiusLgLookup, radiusLookup, radiusMdLookup, radiusXlLookup, } from '../theme'; import { getClassName, memo } from '../utils'; import { cn } from '../libs'; import { Responsive } from '../types/ui'; const variantLookup = { primary: 'text-primary-foreground bg-primary hover:bg-primary/90 disabled:text-primary-foreground/70 disabled:bg-primary/50', outline: 'border text-primary bg-primary-foreground hover:bg-neutral-50 disabled:text-primary/70 disabled:bg-neutral-50/50', pill: 'text-primary-foreground bg-primary hover:bg-primary/90 disabled:text-primary-foreground/70 disabled:bg-primary/50', }; export type Variant = keyof typeof variantLookup; export type ButtonSize = keyof typeof fieldSizeLookup; export type Font = keyof typeof fontFamilyLookup; export type ButtonColor = keyof typeof colorLookup; export type Radius = keyof typeof radiusLookup; export type Weight = keyof typeof fontWeightLookup; export type FontSize = keyof typeof fontSizeLookup; export interface ButtonProps extends ComponentPropsWithRef<'button'> { variant?: Variant; radius?: Radius | Responsive; size?: ButtonSize | Responsive; font?: Font | Responsive; fontSize?: FontSize | Responsive; weight?: Weight | Responsive; isLoading?: boolean; color?: ButtonColor; } const Component = ( { variant = 'primary', radius = 'lg', size = 'lg', font = 'inter', fontSize = 'base', weight = 'semibold', color, isLoading, className, type = 'button', children, ...rest }: ButtonProps, ref: Ref ) => { const fs = fontSize as any; const w = weight as any; const s = size as any; const r = radius as any; return ( ); }; export const Button = memo(forwardRef(Component));