{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "adminlte-modal", "title": "AdminLTE Modal", "description": "Modal dialog with colored header variants (primary/info/success/warning/danger), three sizes, and header/body/footer sections.", "registryDependencies": [ "https://raw.githubusercontent.com/dnachavez/adminlte-next/master/public/r/adminlte-theme.json", "https://raw.githubusercontent.com/dnachavez/adminlte-next/master/public/r/adminlte-button.json" ], "files": [ { "path": "registry/new-york/adminlte-modal/ui/adminlte-modal.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/registry/new-york/adminlte-theme/lib/cn\"\n\ntype ModalVariant = \"default\" | \"primary\" | \"info\" | \"success\" | \"warning\" | \"danger\"\n\nconst modalHeaderStyles: Record = {\n default: \"bg-white border-b border-b-[#e5e5e5]\",\n primary: \"bg-[#3c8dbc] text-white border-b-0\",\n info: \"bg-[#00c0ef] text-white border-b-0\",\n success: \"bg-[#00a65a] text-white border-b-0\",\n warning: \"bg-[#f39c12] text-white border-b-0\",\n danger: \"bg-[#dd4b39] text-white border-b-0\",\n}\n\ninterface AdminLTEModalProps extends React.HTMLAttributes {\n open: boolean\n onClose: () => void\n variant?: ModalVariant\n size?: \"sm\" | \"md\" | \"lg\"\n}\n\nconst AdminLTEModal = React.forwardRef(\n (\n { className, open, onClose, variant = \"default\", size = \"md\", children, ...props },\n ref\n ) => {\n React.useEffect(() => {\n const handleEsc = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose()\n }\n if (open) {\n document.addEventListener(\"keydown\", handleEsc)\n document.body.style.overflow = \"hidden\"\n }\n return () => {\n document.removeEventListener(\"keydown\", handleEsc)\n document.body.style.overflow = \"\"\n }\n }, [open, onClose])\n\n if (!open) return null\n\n const sizeClass = {\n sm: \"max-w-[300px]\",\n md: \"max-w-[600px]\",\n lg: \"max-w-[900px]\",\n }[size]\n\n return (\n <>\n \n {\n if (e.target === e.currentTarget) onClose()\n }}\n {...props}\n >\n \n
\n {children}\n
\n \n \n \n )\n }\n)\nAdminLTEModal.displayName = \"AdminLTEModal\"\n\ninterface ModalHeaderProps extends React.HTMLAttributes {\n variant?: ModalVariant\n onClose?: () => void\n}\n\nconst ModalHeader = React.forwardRef(\n ({ className, variant = \"default\", onClose, children, ...props }, ref) => {\n return (\n \n {onClose && (\n \n ×\n \n )}\n

\n {children}\n

\n \n )\n }\n)\nModalHeader.displayName = \"ModalHeader\"\n\ninterface ModalBodyProps extends React.HTMLAttributes {}\n\nconst ModalBody = React.forwardRef(\n ({ className, children, ...props }, ref) => {\n return (\n \n {children}\n \n )\n }\n)\nModalBody.displayName = \"ModalBody\"\n\ninterface ModalFooterProps extends React.HTMLAttributes {}\n\nconst ModalFooter = React.forwardRef(\n ({ className, children, ...props }, ref) => {\n return (\n \n {children}\n \n )\n }\n)\nModalFooter.displayName = \"ModalFooter\"\n\nexport { AdminLTEModal, ModalHeader, ModalBody, ModalFooter }\nexport type { AdminLTEModalProps, ModalHeaderProps, ModalBodyProps, ModalFooterProps, ModalVariant }\n", "type": "registry:ui" } ], "type": "registry:ui" }