# Shared Components Specification **Version:** 1.0.0 **Fecha:** 2025-12-05 --- ## UI Components ### Button ```tsx interface ButtonProps { variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger'; size?: 'sm' | 'md' | 'lg'; disabled?: boolean; loading?: boolean; leftIcon?: ReactNode; rightIcon?: ReactNode; fullWidth?: boolean; type?: 'button' | 'submit' | 'reset'; onClick?: () => void; children: ReactNode; } // Uso ``` ### Card ```tsx interface CardProps { className?: string; padding?: 'none' | 'sm' | 'md' | 'lg'; shadow?: 'none' | 'sm' | 'md' | 'lg'; border?: boolean; hoverable?: boolean; onClick?: () => void; children: ReactNode; } // Variantes ``` ### Badge ```tsx interface BadgeProps { variant?: 'default' | 'success' | 'warning' | 'danger' | 'info'; size?: 'sm' | 'md'; dot?: boolean; removable?: boolean; onRemove?: () => void; children: ReactNode; } // Uso Activo Pendiente ``` ### Modal ```tsx interface ModalProps { isOpen: boolean; onClose: () => void; title?: string; description?: string; size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'; closeOnOverlayClick?: boolean; closeOnEscape?: boolean; showCloseButton?: boolean; children: ReactNode; footer?: ReactNode; } // Uso ``` ### Tabs ```tsx interface TabsProps { defaultValue?: string; value?: string; onChange?: (value: string) => void; children: ReactNode; } interface TabProps { value: string; label: string; icon?: ReactNode; disabled?: boolean; badge?: number | string; } // Uso ``` ### Dropdown ```tsx interface DropdownProps { trigger: ReactNode; items: DropdownItem[]; align?: 'start' | 'end'; side?: 'top' | 'bottom'; } interface DropdownItem { label: string; value: string; icon?: ReactNode; disabled?: boolean; danger?: boolean; onClick?: () => void; } // Uso } items={[ { label: 'Editar', value: 'edit', icon: }, { label: 'Duplicar', value: 'duplicate', icon: }, { label: 'Eliminar', value: 'delete', icon: , danger: true }, ]} /> ``` ### Progress ```tsx interface ProgressProps { value: number; max?: number; variant?: 'default' | 'success' | 'warning' | 'danger'; size?: 'sm' | 'md' | 'lg'; showLabel?: boolean; labelFormat?: (value: number, max: number) => string; animated?: boolean; } // Uso ``` ### Avatar ```tsx interface AvatarProps { src?: string; name?: string; size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; shape?: 'circle' | 'square'; status?: 'online' | 'offline' | 'busy' | 'away'; fallback?: ReactNode; } // Uso ``` ### Tooltip ```tsx interface TooltipProps { content: ReactNode; position?: 'top' | 'bottom' | 'left' | 'right'; delay?: number; disabled?: boolean; children: ReactNode; } // Uso ``` ### Alert ```tsx interface AlertProps { type: 'info' | 'success' | 'warning' | 'error'; title?: string; message: string; dismissible?: boolean; onDismiss?: () => void; action?: { label: string; onClick: () => void; }; } // Uso {} }} /> ``` --- ## Form Components ### Input ```tsx interface InputProps extends InputHTMLAttributes { label?: string; helper?: string; error?: string; leftAddon?: ReactNode; rightAddon?: ReactNode; leftIcon?: ReactNode; rightIcon?: ReactNode; } // Uso ``` ### Select ```tsx interface SelectProps { label?: string; placeholder?: string; options: SelectOption[]; value?: string | string[]; onChange?: (value: string | string[]) => void; multiple?: boolean; searchable?: boolean; clearable?: boolean; disabled?: boolean; error?: string; loading?: boolean; } interface SelectOption { value: string; label: string; disabled?: boolean; group?: string; } // Uso