{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dialog",
  "title": "Dialog",
  "description": "A panel that grows out of its button and flies home into it.",
  "dependencies": [
    "@base-ui/react@^1.8.0"
  ],
  "registryDependencies": [
    "https://liquikit.dev/r/button.json",
    "https://liquikit.dev/r/core.json",
    "https://liquikit.dev/r/glass.json",
    "https://liquikit.dev/r/popup.json"
  ],
  "files": [
    {
      "path": "src/dialog.tsx",
      "content": "\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { type ReactNode, useMemo, useRef, useState } from \"react\";\nimport { Button, type ButtonProps } from \"./button\";\nimport type { GlassRefraction, GlassTheme } from \"./glass\";\nimport { MorphPane, PopupState, usePopupState } from \"./popup\";\nimport { cx } from \"./types\";\nimport \"./liquikit.css\";\n\nconst DIALOG_RADIUS = 30;\n\nexport type DialogRootProps = Omit<BaseDialog.Root.Props, \"open\"> & {\n\topen?: boolean;\n};\n\nfunction Root({\n\topen: openProp,\n\tdefaultOpen = false,\n\tonOpenChange,\n\t...rootProps\n}: DialogRootProps) {\n\tconst [uncontrolled, setUncontrolled] = useState(defaultOpen);\n\tconst open = openProp ?? uncontrolled;\n\tconst trigger = useRef<HTMLElement | null>(null);\n\tconst state = useMemo(() => ({ open, trigger }), [open]);\n\treturn (\n\t\t<PopupState.Provider value={state}>\n\t\t\t<BaseDialog.Root\n\t\t\t\t{...rootProps}\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={(next, eventDetails) => {\n\t\t\t\t\tif (openProp === undefined) setUncontrolled(next);\n\t\t\t\t\tonOpenChange?.(next, eventDetails);\n\t\t\t\t}}\n\t\t\t/>\n\t\t</PopupState.Provider>\n\t);\n}\n\nfunction Trigger(props: ButtonProps) {\n\tconst { trigger } = usePopupState();\n\treturn (\n\t\t<BaseDialog.Trigger\n\t\t\tref={(element: HTMLElement | null) => {\n\t\t\t\ttrigger.current = element;\n\t\t\t}}\n\t\t\trender={<Button {...props} />}\n\t\t/>\n\t);\n}\n\nexport type DialogPopupProps = Omit<\n\tBaseDialog.Popup.Props,\n\t\"className\" | \"render\"\n> & {\n\ttheme?: GlassTheme;\n\trefraction?: GlassRefraction;\n\tcloseButton?: boolean;\n\tclassName?: string;\n\tchildren?: ReactNode;\n};\n\nfunction Popup({\n\ttheme,\n\trefraction,\n\tcloseButton = true,\n\tclassName,\n\tchildren,\n\t...popupProps\n}: DialogPopupProps) {\n\treturn (\n\t\t<BaseDialog.Portal>\n\t\t\t<BaseDialog.Backdrop className=\"glass-ui-alert__backdrop\" />\n\t\t\t<BaseDialog.Viewport className=\"glass-ui-alert__viewport\">\n\t\t\t\t<BaseDialog.Popup\n\t\t\t\t\t{...popupProps}\n\t\t\t\t\tclassName={cx(\"glass-ui-popup glass-ui-dialog\", className)}\n\t\t\t\t\trender={(props) => (\n\t\t\t\t\t\t<MorphPane\n\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\tpanelRadius={DIALOG_RADIUS}\n\t\t\t\t\t\t\ttheme={theme}\n\t\t\t\t\t\t\trefraction={refraction}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"glass-ui-dialog__body\">\n\t\t\t\t\t\t{closeButton ? (\n\t\t\t\t\t\t\t<BaseDialog.Close\n\t\t\t\t\t\t\t\tclassName=\"glass-ui-dialog__close\"\n\t\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<Button icon size=\"small\">\n\t\t\t\t\t\t\t\t\t\t<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\td=\"m4.5 4.5 7 7m0-7-7 7\"\n\t\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t\t\tstrokeWidth=\"1.8\"\n\t\t\t\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</BaseDialog.Popup>\n\t\t\t</BaseDialog.Viewport>\n\t\t</BaseDialog.Portal>\n\t);\n}\n\nfunction Title({\n\tclassName,\n\t...titleProps\n}: Omit<BaseDialog.Title.Props, \"className\"> & { className?: string }) {\n\treturn (\n\t\t<BaseDialog.Title\n\t\t\t{...titleProps}\n\t\t\tclassName={cx(\"glass-ui-sheet__title\", className)}\n\t\t/>\n\t);\n}\n\nfunction Description({\n\tclassName,\n\t...descriptionProps\n}: Omit<BaseDialog.Description.Props, \"className\"> & { className?: string }) {\n\treturn (\n\t\t<BaseDialog.Description\n\t\t\t{...descriptionProps}\n\t\t\tclassName={cx(\"glass-ui-sheet__description\", className)}\n\t\t/>\n\t);\n}\n\nfunction Close(props: ButtonProps) {\n\treturn <BaseDialog.Close render={<Button {...props} />} />;\n}\n\nexport const Dialog = { Root, Trigger, Popup, Title, Description, Close };\n\nexport const DialogRoot = Dialog.Root;\nexport const DialogTrigger = Dialog.Trigger;\nexport const DialogPopup = Dialog.Popup;\nexport const DialogTitle = Dialog.Title;\nexport const DialogDescription = Dialog.Description;\nexport const DialogClose = Dialog.Close;\n",
      "type": "registry:ui",
      "target": "@components/liquikit/dialog.tsx"
    }
  ],
  "type": "registry:ui"
}