{
  "name": "modal",
  "type": "registry:ui",
  "framework": "react",
  "title": "Modal",
  "description": "A centered dialog over a dimmed overlay that closes on Escape, overlay click or an explicit close control.",
  "dependencies": [
    "radix-ui"
  ],
  "registryDependencies": [
    "@newtui/button"
  ],
  "files": [
    {
      "path": "ui/modal.tsx",
      "content": "\"use client\"\n\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * Radix owns the behaviour: open state, the focus trap, Escape and outside\n * press, scroll lock, hiding the page from screen readers, and giving focus\n * back to the trigger. Only the look is newt/ui's.\n */\nconst Modal = DialogPrimitive.Root\n\n/*\n * It has no look of its own. Pass `asChild` to put the state on your own\n * button: `<ModalTrigger asChild><Button>Open</Button></ModalTrigger>`.\n * Focus returns to the trigger when the modal closes. A modal opened from\n * state alone has no trigger, so pass `onCloseAutoFocus` to `ModalContent`\n * to say where focus goes.\n */\nconst ModalTrigger = DialogPrimitive.Trigger\n\n/**\n * Closes the modal when activated. Wrap a Button with `asChild` to keep its styling:\n * `<ModalClose asChild><Button variant=\"secondary\">Cancel</Button></ModalClose>`\n */\nconst ModalClose = DialogPrimitive.Close\n\nconst ModalContent = React.forwardRef<\n  React.ComponentRef<typeof DialogPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n    /**\n     * The element the overlay and panel are portalled into. Defaults to\n     * `document.body`. A modal opened below a `DirectionProvider` or a themed\n     * wrapper passes that element, so it keeps the direction and the palette.\n     */\n    container?: React.ComponentProps<typeof DialogPrimitive.Portal>[\"container\"]\n  }\n>(({ className, children, container, ...props }, ref) => (\n  <DialogPrimitive.Portal container={container}>\n    <DialogPrimitive.Overlay className=\"fixed inset-0 z-[100] bg-newt-overlay\" />\n    <DialogPrimitive.Content\n      ref={ref}\n      className={cn(\n        \"fixed start-1/2 top-1/2 z-[100] w-[440px] max-w-[90vw] -translate-y-1/2 translate-x-[calc(var(--newt-dir)*-50%)] rounded-[var(--newt-radius-lg)] bg-newt-bg-elevated shadow-elevation-high outline-none\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n    </DialogPrimitive.Content>\n  </DialogPrimitive.Portal>\n))\nModalContent.displayName = \"ModalContent\"\n\nconst ModalHeader = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={cn(\"px-4 pt-4\", className)} {...props} />\n))\nModalHeader.displayName = \"ModalHeader\"\n\n/** The dialog's accessible name. Give it real text. */\nconst ModalTitle = React.forwardRef<\n  React.ComponentRef<typeof DialogPrimitive.Title>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Title\n    ref={ref}\n    className={cn(\"m-0 text-xl font-semibold\", className)}\n    {...props}\n  />\n))\nModalTitle.displayName = \"ModalTitle\"\n\n/**\n * Radix links it to the dialog with `aria-describedby`. A modal without one\n * passes `aria-describedby={undefined}` to `ModalContent` to say so.\n */\nconst ModalDescription = React.forwardRef<\n  React.ComponentRef<typeof DialogPrimitive.Description>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Description\n    ref={ref}\n    className={cn(\"m-0 text-sm leading-5 text-newt-text-secondary\", className)}\n    {...props}\n  />\n))\nModalDescription.displayName = \"ModalDescription\"\n\nconst ModalBody = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n  ({ className, ...props }, ref) => (\n    <div\n      ref={ref}\n      className={cn(\n        \"p-4 text-sm leading-5 text-newt-text-secondary\",\n        className\n      )}\n      {...props}\n    />\n  )\n)\nModalBody.displayName = \"ModalBody\"\n\nconst ModalFooter = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\n      \"flex justify-end gap-2 rounded-b-[var(--newt-radius-lg)] bg-newt-bg-surface p-4\",\n      className\n    )}\n    {...props}\n  />\n))\nModalFooter.displayName = \"ModalFooter\"\n\nexport {\n  Modal,\n  ModalTrigger,\n  ModalContent,\n  ModalHeader,\n  ModalTitle,\n  ModalDescription,\n  ModalBody,\n  ModalFooter,\n  ModalClose,\n}\n",
      "type": "registry:ui"
    }
  ]
}