import React from 'react'; import { X } from 'lucide-react'; // Shadcn UI Imports import { Button as ShadcnButton } from './ui/button'; import { Input as ShadcnInput } from './ui/input'; import { Switch as ShadcnSwitch } from './ui/switch'; import { Card as ShadcnCard } from './ui/card'; import { Badge as ShadcnBadge } from './ui/badge'; import { TableHeader as ShadcnTableHeader, TableRow as ShadcnTableRow, TableHead as ShadcnTableHead, TableCell as ShadcnTableCell } from './ui/table'; import { Sheet, SheetContent, SheetHeader, SheetTitle } from './ui/sheet'; import { Dialog as ShadcnDialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './ui/dialog'; // Button Wrapper to match old API interface ButtonProps extends React.ButtonHTMLAttributes { variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive'; size?: 'sm' | 'md' | 'lg' | 'icon'; } export const Button: React.FC = ({ variant = 'primary', size = 'md', className, ...props }) => { const vMap: any = { primary: 'default', secondary: 'secondary', outline: 'outline', ghost: 'ghost', destructive: 'destructive' }; const sMap: any = { sm: 'sm', md: 'default', lg: 'lg', icon: 'icon' }; return ; } // Input and Switch match seamlessly export const Input = ShadcnInput; export const Switch = ShadcnSwitch; // Native Select Wrapper to avoid breaking consumers expecting interface SelectProps extends React.SelectHTMLAttributes { } export const Select: React.FC = ({ className = '', children, ...props }) => { return ( ); }; // Card Wrapper interface CardProps extends React.HTMLAttributes { children: React.ReactNode; } export const Card: React.FC = ({ children, className = '', ...props }) => ( {children} ); // Badge Wrapper for old variants interface BadgeProps { children: React.ReactNode; variant?: 'default' | 'success' | 'warning' | 'outline'; className?: string; } export const Badge: React.FC = ({ children, variant = 'default', className = '' }) => { let cName = className; let shadcnVariant: any = variant === 'outline' ? 'outline' : 'default'; if (variant === 'success') { cName += ' border-transparent bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/30'; } else if (variant === 'warning') { cName += ' border-transparent bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30'; } return {children}; }; // Table Exports export const TableHeader = ShadcnTableHeader; export const TableRow = ShadcnTableRow; export const TableHead = ShadcnTableHead; export const TableCell = ShadcnTableCell; // Drawer (Side Sheet Wrapper) interface DrawerProps { isOpen: boolean; onClose: () => void; title: string; className?: string; children: React.ReactNode; } export const Drawer: React.FC = ({ isOpen, onClose, title, className, children }) => { // Pass `!w-[85vw]` logic directly down from the parent to naturally override Shadcn specificities safely. const containerClasses = className || 'w-full max-w-md sm:max-w-lg'; return ( { if (!open) onClose(); }}> button]:top-5 [&>button]:right-5 ${containerClasses}`}> {title}
{children}
); }; // Dialog (Modal Wrapper) interface DialogProps { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode; footer?: React.ReactNode; contentClassName?: string; } export const Dialog: React.FC = ({ isOpen, onClose, title, children, footer, contentClassName }) => { return ( { if (!open) onClose(); }}> {title}
{children}
{footer && {footer}}
); }; // --------------------------------------------- // Custom Application Layout Components // --------------------------------------------- interface LibraryPageShellProps { title: string; primaryAction: React.ReactNode; filterBar: React.ReactNode; children: React.ReactNode; } export const LibraryPageShell: React.FC = ({ title, primaryAction, filterBar, children }) => (

{title}

{primaryAction}
{filterBar}
{children}
); interface TableStatusRowProps { colSpan: number; text: string; } export const TableStatusRow: React.FC = ({ colSpan, text }) => ( {text} ); interface LibraryActionCellProps { previewAction?: React.ReactNode; editAction: React.ReactNode; deleteAction: React.ReactNode; } export const LibraryActionCell: React.FC = ({ previewAction, editAction, deleteAction }) => ( {previewAction} {editAction} {deleteAction} );