import { forwardRef, InputHTMLAttributes, ReactNode } from 'react' import clsx from 'clsx' export interface CheckboxProps extends Omit, 'type'> { label?: string | ReactNode description?: string error?: string } const Checkbox = forwardRef( ({ className, label, description, error, id, ...props }, ref) => { const checkboxId = id || (typeof label === 'string' ? label.toLowerCase().replace(/\s+/g, '-') : undefined) return (
{(label || description) && (
{label && ( )} {description && (

{description}

)} {error &&

{error}

}
)}
) } ) Checkbox.displayName = 'Checkbox' export default Checkbox // Switch component export interface SwitchProps { checked: boolean onChange: (checked: boolean) => void label?: string description?: string disabled?: boolean size?: 'sm' | 'md' | 'lg' } export function Switch({ checked, onChange, label, description, disabled = false, size = 'md', }: SwitchProps) { const sizeStyles = { sm: { track: 'w-8 h-4', thumb: 'w-3 h-3', translate: 'translate-x-4', }, md: { track: 'w-11 h-6', thumb: 'w-5 h-5', translate: 'translate-x-5', }, lg: { track: 'w-14 h-7', thumb: 'w-6 h-6', translate: 'translate-x-7', }, } return (
{(label || description) && (
{label && ( {label} )} {description && (

{description}

)}
)}
) } // Radio button component export interface RadioProps extends Omit, 'type'> { label?: string } export const Radio = forwardRef( ({ className, label, id, ...props }, ref) => { const radioId = id || label?.toLowerCase().replace(/\s+/g, '-') return (
{label && ( )}
) } ) Radio.displayName = 'Radio'