{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "modal",
  "title": "Modal",
  "author": "AlgorizeTech",
  "description": "A composable overlay handling the portal, backdrop, scroll lock, Escape and backdrop dismissal, with no preset layout of its own. Use it when you hold the open state and want the panel to render your own markup.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/select.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/ModalBlock.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { AlertCircle, Sparkles, X } from \"lucide-react\";\nimport type * as React from \"react\";\nimport {\n  createContext,\n  useCallback,\n  useContext,\n  useEffect,\n  useId,\n  useRef,\n  useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport function LiquidGlassSvgFilter() {\n  return (\n    <>\n      <img\n        src=\"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_1200,c_limit/v1790146209/photo-1470071459604-3b5ec3a7fe05-1790146212205.jpg\"\n        alt=\"\"\n        aria-hidden=\"true\"\n        style={{\n          position: \"fixed\",\n          top: \"-9999px\",\n          left: \"-9999px\",\n          width: \"1px\",\n          height: \"1px\",\n          opacity: 0,\n          pointerEvents: \"none\",\n        }}\n      />\n      <svg\n        style={{\n          position: \"fixed\",\n          top: \"-9999px\",\n          left: \"-9999px\",\n          width: 0,\n          height: 0,\n          pointerEvents: \"none\",\n        }}\n        aria-hidden=\"true\"\n      >\n        <defs>\n          <filter\n            id=\"glass-blur\"\n            x=\"0\"\n            y=\"0\"\n            width=\"100%\"\n            height=\"100%\"\n            filterUnits=\"objectBoundingBox\"\n          >\n            <feTurbulence\n              type=\"fractalNoise\"\n              baseFrequency=\"0.003 0.007\"\n              numOctaves=\"1\"\n              result=\"turbulence\"\n            />\n            <feDisplacementMap\n              in=\"SourceGraphic\"\n              in2=\"turbulence\"\n              scale=\"200\"\n              xChannelSelector=\"R\"\n              yChannelSelector=\"G\"\n            />\n          </filter>\n        </defs>\n      </svg>\n    </>\n  );\n}\n\nconst ModalLabelContext = createContext<string | null>(null);\n\nexport type ModalVariant =\n  | \"standard\"\n  | \"confirmation\"\n  | \"form\"\n  | \"fullscreen\"\n  | \"glass\"\n  | \"liquid-glass\"\n  | \"custom\";\n\nexport type ModalProps = {\n  /** Controlled open state — the modal renders against it, it never owns it. */\n  isOpen: boolean;\n  /** Called after the close transition, on the X, Escape and backdrop clicks. */\n  onClose: () => void;\n  /** Pre-configured design variant. Automatically applies layout, responsive sizing, colors, and button styles. */\n  variant?: ModalVariant;\n  /** Modal headline or title. */\n  title?: React.ReactNode;\n  /** Body copy or description text. */\n  description?: React.ReactNode;\n  /** Status pill or badge in header (e.g. \"v2.4.0 Live\"). */\n  badge?: React.ReactNode;\n  /** Custom icon element to replace the default variant icon. */\n  icon?: React.ReactNode;\n  /** Primary / confirm button label. */\n  confirmText?: string;\n  /** Secondary / cancel button label. */\n  cancelText?: string;\n  /** Destructive / delete button label (useful in fullscreen/settings variant). */\n  deleteText?: string;\n  /** Callback when confirm button is clicked. Defaults to onClose. */\n  onConfirm?: () => void;\n  /** Callback when cancel button is clicked. Defaults to onClose. */\n  onCancel?: () => void;\n  /** Callback when delete button is clicked. Defaults to onClose. */\n  onDelete?: () => void;\n  /** Custom children, form fields, or subcomponent slots. */\n  children?: React.ReactNode;\n  /** Classes for the panel. Merged with variant defaults. */\n  contentClassName?: string;\n  /** Classes for the backdrop. Merged with variant defaults. */\n  overlayClassName?: string;\n  /** Renders the close button as a tinted primary chip instead of a bare icon. */\n  primaryCloseButton?: boolean;\n  /** Drops the built-in X, for flows where a choice has to be made explicitly. */\n  hideCloseButton?: boolean;\n  /**\n   * Labels the dialog directly. Use it whenever the title is not inside\n   * `ModalHeader` — otherwise the panel points `aria-labelledby` at the header.\n   */\n  ariaLabel?: string;\n};\n\nexport function Modal({\n  isOpen,\n  onClose,\n  variant,\n  title,\n  description,\n  badge,\n  icon,\n  confirmText,\n  cancelText,\n  deleteText,\n  onConfirm,\n  onCancel,\n  onDelete,\n  children,\n  contentClassName,\n  overlayClassName,\n  primaryCloseButton = false,\n  hideCloseButton,\n  ariaLabel,\n}: ModalProps) {\n  const [renderLayer, setRenderLayer] = useState(isOpen);\n  const [isVisible, setIsVisible] = useState(false);\n  const [portalTarget, setPortalTarget] = useState<HTMLElement | null>(null);\n  const isClosingRef = useRef(false);\n  const labelId = useId();\n\n  // Resolves the document this modal actually lives in (supports iframe rendering in sandbox preview).\n  const setAnchor = useCallback((node: HTMLSpanElement | null) => {\n    setPortalTarget(node ? node.ownerDocument.body : null);\n  }, []);\n\n  // Sync renderLayer and animation state with isOpen\n  useEffect(() => {\n    if (isOpen) {\n      isClosingRef.current = false;\n      setRenderLayer(true);\n      // Ensure element is in DOM before starting fade-in transition\n      const timer = setTimeout(() => {\n        setIsVisible(true);\n      }, 20);\n      return () => clearTimeout(timer);\n    } else {\n      setIsVisible(false);\n      // Wait for exit transition (300ms) before unmounting\n      const timer = setTimeout(() => {\n        setRenderLayer(false);\n      }, 300);\n      return () => clearTimeout(timer);\n    }\n  }, [isOpen]);\n\n  const handleClose = useCallback(() => {\n    if (isClosingRef.current) return;\n    isClosingRef.current = true;\n    setIsVisible(false);\n    setTimeout(() => {\n      onClose();\n    }, 300);\n  }, [onClose]);\n\n  // Handle Escape key\n  useEffect(() => {\n    if (!isOpen) return;\n    const doc = portalTarget?.ownerDocument ?? document;\n    const handleKeyDown = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") handleClose();\n    };\n    doc.addEventListener(\"keydown\", handleKeyDown);\n    return () => doc.removeEventListener(\"keydown\", handleKeyDown);\n  }, [isOpen, handleClose, portalTarget]);\n\n  // Handle body scroll locking\n  useEffect(() => {\n    if (!isOpen || !portalTarget) return;\n    const doc = portalTarget.ownerDocument;\n    const win = doc.defaultView ?? window;\n    const originalOverflow = win.getComputedStyle(doc.body).overflow;\n    doc.body.style.overflow = \"hidden\";\n    return () => {\n      doc.body.style.overflow = originalOverflow;\n    };\n  }, [isOpen, portalTarget]);\n\n  if (!portalTarget || !renderLayer) {\n    return (\n      <>\n        <span ref={setAnchor} hidden aria-hidden=\"true\" />\n        <LiquidGlassSvgFilter />\n      </>\n    );\n  }\n\n  // Determine active variant\n  const activeVariant: ModalVariant =\n    variant ??\n    (title || description || confirmText || cancelText ? \"standard\" : \"custom\");\n\n  // Variant default classes\n  const variantContentClass: Record<ModalVariant, string> = {\n    standard: \"max-w-md bg-background rounded-2xl shadow-xl border border-border\",\n    confirmation: \"max-w-sm bg-background rounded-2xl shadow-xl border border-border\",\n    form: \"max-w-lg bg-background rounded-2xl shadow-xl border border-border\",\n    fullscreen: \"max-w-5xl max-h-[90dvh] bg-background rounded-2xl shadow-xl border border-border\",\n    glass:\n      \"max-w-md w-full bg-card/80 backdrop-blur-2xl backdrop-saturate-200 rounded-2xl sm:rounded-3xl shadow-[0_25px_60px_rgba(0,0,0,0.35)] border border-white/60 dark:border-white/15 text-foreground\",\n    \"liquid-glass\":\n      \"max-w-md w-full bg-transparent border-0 shadow-none text-white rounded-[22px] sm:rounded-[28px]\",\n    custom: \"max-w-lg bg-background rounded-2xl shadow-xl border border-border\",\n  };\n\n  const variantOverlayClass: Record<ModalVariant, string> = {\n    standard: \"\",\n    confirmation: \"\",\n    form: \"\",\n    fullscreen: \"\",\n    glass: \"bg-black/50 backdrop-blur-md\",\n    \"liquid-glass\": \"bg-black/30 backdrop-blur-[1px]\",\n    custom: \"\",\n  };\n\n  const isHideClose =\n    hideCloseButton !== undefined\n      ? hideCloseButton\n      : activeVariant === \"confirmation\";\n\n  const ariaProps = ariaLabel\n    ? { \"aria-label\": ariaLabel }\n    : typeof title === \"string\"\n    ? { \"aria-label\": title }\n    : { \"aria-labelledby\": labelId };\n\n  // Render variant built-in content\n  const renderVariantContent = () => {\n    if (activeVariant === \"confirmation\") {\n      return (\n        <ModalBody className=\"p-6 sm:p-8 text-center flex flex-col items-center\">\n          <div className=\"w-16 h-16 rounded-2xl flex items-center justify-center mb-5 border shadow-sm transition-colors bg-rose-50 dark:bg-rose-500/10 border-rose-200 dark:border-rose-500/20 text-rose-600 dark:text-rose-400\">\n            {icon ?? <AlertCircle className=\"w-8 h-8\" />}\n          </div>\n          {title && (\n            <h2 className=\"text-xl font-semibold text-foreground mb-2\">\n              {title}\n            </h2>\n          )}\n          {description && (\n            <p className=\"text-sm text-foreground font-medium leading-relaxed mb-8\">\n              {description}\n            </p>\n          )}\n          {children}\n          <div className=\"flex gap-3 w-full\">\n            <button\n              type=\"button\"\n              onClick={onCancel ?? handleClose}\n              className=\"flex-1 py-2.5 rounded-lg font-medium text-muted-foreground border border-border hover:bg-muted transition-colors cursor-pointer\"\n            >\n              {cancelText ?? \"Cancel\"}\n            </button>\n            <button\n              type=\"button\"\n              onClick={onConfirm ?? handleClose}\n              className=\"flex-1 py-2.5 rounded-lg font-semibold bg-red-600 hover:bg-red-700 text-white shadow-sm transition-colors cursor-pointer\"\n            >\n              {confirmText ?? \"Delete\"}\n            </button>\n          </div>\n        </ModalBody>\n      );\n    }\n\n    if (activeVariant === \"form\") {\n      return (\n        <>\n          {title && (\n            <ModalHeader className=\"border-b border-border/60\">\n              {typeof title === \"string\" ? (\n                <h2 className=\"text-lg font-semibold text-foreground\">{title}</h2>\n              ) : (\n                title\n              )}\n            </ModalHeader>\n          )}\n          {children && (\n            <ModalBody className=\"space-y-4 sm:space-y-5\">{children}</ModalBody>\n          )}\n          {(confirmText || cancelText) && (\n            <ModalFooter className=\"border-t border-border bg-muted/50\">\n              {cancelText && (\n                <button\n                  type=\"button\"\n                  onClick={onCancel ?? handleClose}\n                  className=\"px-5 py-2.5 rounded-lg font-medium text-muted-foreground hover:bg-muted/50 transition-colors cursor-pointer\"\n                >\n                  {cancelText}\n                </button>\n              )}\n              {confirmText && (\n                <button\n                  type=\"button\"\n                  onClick={onConfirm ?? handleClose}\n                  className=\"px-5 py-2.5 rounded-lg font-semibold shadow-sm transition-opacity bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer\"\n                >\n                  {confirmText}\n                </button>\n              )}\n            </ModalFooter>\n          )}\n        </>\n      );\n    }\n\n    if (activeVariant === \"fullscreen\") {\n      return (\n        <>\n          {(title || description) && (\n            <ModalHeader className=\"border-b border-border pr-12\">\n              <div className=\"min-w-0\">\n                {typeof title === \"string\" ? (\n                  <h2 className=\"text-xl sm:text-2xl font-bold text-foreground\">\n                    {title}\n                  </h2>\n                ) : (\n                  title\n                )}\n                {description && (\n                  <p className=\"text-sm text-muted-foreground mt-1 font-normal\">\n                    {description}\n                  </p>\n                )}\n              </div>\n            </ModalHeader>\n          )}\n          {children && <ModalBody className=\"max-h-none\">{children}</ModalBody>}\n          {(confirmText || cancelText || deleteText) && (\n            <ModalFooter className=\"border-t border-border bg-muted flex-wrap items-center justify-between gap-2 px-4 py-3 sm:px-6 sm:py-4\">\n              {deleteText ? (\n                <button\n                  type=\"button\"\n                  onClick={onDelete ?? handleClose}\n                  aria-label={deleteText}\n                  className=\"px-3 py-2 rounded-lg text-sm font-semibold text-red-500 hover:text-red-600 hover:bg-red-500/10 transition-colors cursor-pointer\"\n                >\n                  {deleteText}\n                </button>\n              ) : (\n                <div />\n              )}\n              <div className=\"ml-auto flex flex-wrap items-center justify-end gap-2\">\n                {cancelText && (\n                  <button\n                    type=\"button\"\n                    onClick={onCancel ?? handleClose}\n                    aria-label={cancelText}\n                    className=\"px-3 py-2 sm:px-4 rounded-lg text-sm font-medium text-muted-foreground hover:bg-background hover:text-foreground transition-colors cursor-pointer\"\n                  >\n                    {cancelText}\n                  </button>\n                )}\n                {confirmText && (\n                  <button\n                    type=\"button\"\n                    onClick={onConfirm ?? handleClose}\n                    aria-label={confirmText}\n                    className=\"px-4 py-2 sm:px-5 rounded-lg text-sm font-semibold shadow-sm transition-opacity bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer\"\n                  >\n                    {confirmText}\n                  </button>\n                )}\n              </div>\n            </ModalFooter>\n          )}\n        </>\n      );\n    }\n\n    if (activeVariant === \"glass\") {\n      return (\n        <div className=\"p-2 sm:p-4\">\n          {(title || icon || badge) && (\n            <ModalHeader\n              className=\"border-none p-4 pb-2 flex items-start justify-between gap-4\"\n              title={\n                <div className=\"flex items-center gap-3\">\n                  <div className=\"w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 shadow-sm transition-all border bg-white/50 dark:bg-white/10 border-white/40 dark:border-white/20 text-foreground\">\n                    {icon ?? <AlertCircle className=\"w-6 h-6\" />}\n                  </div>\n                  <div className=\"flex flex-col\">\n                    {typeof title === \"string\" ? (\n                      <h2 className=\"text-xl font-semibold tracking-tight text-foreground\">\n                        {title}\n                      </h2>\n                    ) : (\n                      title\n                    )}\n                    {badge && (\n                      <span className=\"text-xs font-semibold text-emerald-600 dark:text-emerald-400\">\n                        {badge}\n                      </span>\n                    )}\n                  </div>\n                </div>\n              }\n            />\n          )}\n          {(description || children) && (\n            <ModalBody className=\"p-4 pt-2 space-y-2\">\n              {description && (\n                <p className=\"text-muted-foreground leading-relaxed text-sm sm:text-base font-normal\">\n                  {description}\n                </p>\n              )}\n              {children}\n            </ModalBody>\n          )}\n          {(confirmText || cancelText) && (\n            <ModalFooter className=\"border-none p-4 pt-4 flex flex-col-reverse sm:flex-row gap-2 sm:justify-end\">\n              {cancelText && (\n                <button\n                  type=\"button\"\n                  onClick={onCancel ?? handleClose}\n                  className=\"px-5 py-2.5 rounded-xl text-sm font-semibold text-muted-foreground hover:bg-muted transition-colors cursor-pointer\"\n                >\n                  {cancelText}\n                </button>\n              )}\n              {confirmText && (\n                <button\n                  type=\"button\"\n                  onClick={onConfirm ?? handleClose}\n                  className=\"px-6 py-2.5 rounded-xl text-sm font-semibold shadow-lg shadow-primary/20 active:scale-95 transition-all bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer\"\n                >\n                  {confirmText}\n                </button>\n              )}\n            </ModalFooter>\n          )}\n        </div>\n      );\n    }\n\n    if (activeVariant === \"liquid-glass\") {\n      return (\n        <div className=\"relative overflow-hidden rounded-[22px] sm:rounded-[28px]\">\n          {/* Layer 0: Liquid SVG Displaced Wave Background */}\n          <div\n            className=\"absolute -inset-10 pointer-events-none\"\n            style={{\n              backgroundImage:\n                'url(\"https://res.cloudinary.com/dodndg7ai/image/upload/f_webp,q_auto,w_1200,c_limit/v1790146209/photo-1470071459604-3b5ec3a7fe05-1790146212205.jpg\")',\n              backgroundSize: \"cover\",\n              backgroundPosition: \"center\",\n              filter: \"url(#glass-blur)\",\n              transform: \"scale(1.1)\",\n            }}\n          />\n\n          {/* Layer 1: Contrast overlay & soft backdrop blur */}\n          <div className=\"absolute inset-0 z-10 pointer-events-none bg-black/30 dark:bg-black/45 backdrop-blur-[2px]\" />\n\n          {/* Layer 2: Ambient Drop Shadow & Subtle Glow */}\n          <div\n            className=\"absolute inset-0 z-20 pointer-events-none rounded-[22px] sm:rounded-[28px]\"\n            style={{\n              boxShadow:\n                \"0 20px 50px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.08)\",\n            }}\n          />\n\n          {/* Layer 3: Specular Inner Border Highlight (Light: bright glass bevel, Dark: sleek darkish rim) */}\n          <div\n            className=\"absolute inset-0 z-30 pointer-events-none rounded-[22px] sm:rounded-[28px] border border-white/40 dark:border-white/15\"\n            style={{\n              boxShadow:\n                \"inset 2px 2px 2px 0 rgba(255, 255, 255, 0.45), inset -2px -2px 2px 0 rgba(255, 255, 255, 0.3)\",\n            }}\n          />\n\n          {/* Layer 4: Modal Dialog Content */}\n          <div className=\"relative z-40 p-3.5 sm:p-5\">\n            {(title || icon || badge) && (\n              <ModalHeader\n                className=\"border-none p-2 sm:p-4 pb-2 flex items-start justify-between gap-3 pr-10 sm:pr-12\"\n                title={\n                  <div className=\"flex items-center gap-2.5 sm:gap-3\">\n                    <div className=\"w-10 h-10 sm:w-12 sm:h-12 rounded-xl sm:rounded-2xl flex items-center justify-center shrink-0 shadow-sm transition-all border bg-white/20 border-white/30 dark:bg-white/10 dark:border-white/15 text-white backdrop-blur-md\">\n                      {icon ?? <Sparkles className=\"w-5 h-5 sm:w-6 sm:h-6 text-white drop-shadow-sm\" />}\n                    </div>\n                    <div className=\"flex flex-col min-w-0\">\n                      {typeof title === \"string\" ? (\n                        <h2 className=\"text-lg sm:text-xl font-semibold tracking-tight text-white drop-shadow-sm truncate\">\n                          {title}\n                        </h2>\n                      ) : (\n                        title\n                      )}\n                      {badge && (\n                        <span className=\"text-[11px] sm:text-xs font-semibold px-2 sm:px-2.5 py-0.5 mt-0.5 rounded-full w-fit bg-white/20 border border-white/30 dark:bg-white/10 dark:border-white/15 text-white backdrop-blur-md\">\n                          {badge}\n                        </span>\n                      )}\n                    </div>\n                  </div>\n                }\n              />\n            )}\n            {(description || children) && (\n              <ModalBody className=\"p-2 sm:p-4 pt-1 sm:pt-2 space-y-2\">\n                {description && (\n                  <p className=\"text-white/85 leading-relaxed text-xs sm:text-sm font-normal\">\n                    {description}\n                  </p>\n                )}\n                {children}\n              </ModalBody>\n            )}\n            {(confirmText || cancelText) && (\n              <ModalFooter className=\"border-none p-2 sm:p-4 pt-3 sm:pt-4 flex flex-col-reverse sm:flex-row gap-2 sm:justify-end\">\n                {cancelText && (\n                  <button\n                    type=\"button\"\n                    onClick={onCancel ?? handleClose}\n                    className=\"w-full sm:w-auto px-4 sm:px-5 py-2 sm:py-2.5 rounded-xl text-xs sm:text-sm font-semibold text-white bg-black/25 hover:bg-black/35 dark:bg-white/10 dark:hover:bg-white/20 border border-white/20 dark:border-white/15 backdrop-blur-md transition-all cursor-pointer text-center justify-center flex items-center\"\n                  >\n                    {cancelText}\n                  </button>\n                )}\n                {confirmText && (\n                  <button\n                    type=\"button\"\n                    onClick={onConfirm ?? handleClose}\n                    className=\"w-full sm:w-auto px-5 sm:px-6 py-2 sm:py-2.5 rounded-xl text-xs sm:text-sm font-semibold bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg shadow-primary/25 active:scale-95 transition-all cursor-pointer text-center justify-center flex items-center\"\n                  >\n                    {confirmText}\n                  </button>\n                )}\n              </ModalFooter>\n            )}\n          </div>\n        </div>\n      );\n    }\n\n    if (activeVariant === \"standard\" && (title || description || confirmText)) {\n      return (\n        <div className=\"p-2 sm:p-4\">\n          {(title || icon || badge) && (\n            <ModalHeader\n              className=\"border-none p-4 pb-2 flex items-start justify-between gap-4\"\n              title={\n                <div className=\"flex items-center gap-3\">\n                  <div className=\"w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 shadow-sm transition-all border bg-primary/10 text-primary border-primary/30\">\n                    {icon ?? <AlertCircle className=\"w-6 h-6\" />}\n                  </div>\n                  <div className=\"flex flex-col\">\n                    {typeof title === \"string\" ? (\n                      <h2 className=\"text-xl font-semibold tracking-tight text-foreground\">\n                        {title}\n                      </h2>\n                    ) : (\n                      title\n                    )}\n                    {badge && (\n                      <span className=\"text-xs font-semibold text-emerald-600 dark:text-emerald-400\">\n                        {badge}\n                      </span>\n                    )}\n                  </div>\n                </div>\n              }\n            />\n          )}\n          {(description || children) && (\n            <ModalBody className=\"p-4 pt-2 space-y-2\">\n              {description && (\n                <p className=\"text-muted-foreground leading-relaxed text-sm sm:text-base font-normal\">\n                  {description}\n                </p>\n              )}\n              {children}\n            </ModalBody>\n          )}\n          {(confirmText || cancelText) && (\n            <ModalFooter className=\"border-none p-4 pt-4 flex flex-col-reverse sm:flex-row gap-2 sm:justify-end\">\n              {cancelText && (\n                <button\n                  type=\"button\"\n                  onClick={onCancel ?? handleClose}\n                  className=\"px-5 py-2.5 rounded-xl text-sm font-semibold text-muted-foreground hover:bg-muted transition-colors cursor-pointer\"\n                >\n                  {cancelText}\n                </button>\n              )}\n              {confirmText && (\n                <button\n                  type=\"button\"\n                  onClick={onConfirm ?? handleClose}\n                  className=\"px-6 py-2.5 rounded-xl text-sm font-semibold shadow-lg shadow-primary/20 active:scale-95 transition-all bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer\"\n                >\n                  {confirmText}\n                </button>\n              )}\n            </ModalFooter>\n          )}\n        </div>\n      );\n    }\n\n    return children;\n  };\n\n  const overlay = (\n    <div\n      className={cn(\n        \"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 transition-all duration-300 ease-in-out\",\n        isVisible ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n        activeVariant !== \"liquid-glass\" && \"backdrop-blur-[3px]\",\n        isVisible ? \"bg-black/50\" : \"bg-black/0\",\n        variantOverlayClass[activeVariant],\n        overlayClassName,\n      )}\n      onClick={handleClose}\n      role=\"presentation\"\n    >\n      <div\n        className={cn(\n          \"relative flex max-h-full w-full max-w-lg flex-col overflow-hidden rounded-2xl transition-all duration-300 ease-in-out\",\n          activeVariant !== \"liquid-glass\" && \"bg-background shadow-xl\",\n          activeVariant === \"liquid-glass\"\n            ? isVisible\n              ? \"opacity-100 scale-100\"\n              : \"opacity-0 scale-95 pointer-events-none\"\n            : isVisible\n              ? \"opacity-100 translate-y-0 scale-100\"\n              : \"opacity-0 -translate-y-8 scale-95\",\n          variantContentClass[activeVariant],\n          contentClassName,\n        )}\n        onClick={(e) => e.stopPropagation()}\n        role=\"dialog\"\n        aria-modal=\"true\"\n        {...ariaProps}\n      >\n        {!isHideClose &&\n          (primaryCloseButton ? (\n            <button\n              onClick={(e) => {\n                e.preventDefault();\n                e.stopPropagation();\n                handleClose();\n              }}\n              data-modal-close\n              type=\"button\"\n              aria-label=\"Close\"\n              className={cn(\n                \"p-1.5 rounded-md absolute top-3.5 right-3.5 sm:top-4 sm:right-4 cursor-pointer transition-colors duration-200 z-50\",\n                activeVariant === \"liquid-glass\"\n                  ? \"text-white/80 hover:text-white bg-white/20 hover:bg-white/30 dark:bg-black/50 dark:hover:bg-black/70 dark:border dark:border-white/15 rounded-full backdrop-blur-md\"\n                  : \"bg-primary/10 text-primary hover:bg-primary/20\"\n              )}\n            >\n              <X className=\"h-5 w-5 ml-[1px]\" />\n            </button>\n          ) : (\n            <button\n              onClick={(e) => {\n                e.preventDefault();\n                e.stopPropagation();\n                handleClose();\n              }}\n              data-modal-close\n              type=\"button\"\n              aria-label=\"Close\"\n              className={cn(\n                \"absolute top-3.5 right-3.5 sm:top-4 sm:right-4 cursor-pointer transition-colors duration-200 z-50\",\n                activeVariant === \"liquid-glass\"\n                  ? \"text-white/80 hover:text-white bg-white/20 hover:bg-white/30 dark:bg-black/50 dark:hover:bg-black/70 dark:border dark:border-white/15 p-1.5 rounded-full backdrop-blur-md\"\n                  : \"text-muted-foreground hover:text-foreground\"\n              )}\n            >\n              <X className=\"h-5 w-5\" />\n            </button>\n          ))}\n        <ModalLabelContext.Provider value={labelId}>\n          {/* min-h-0 lets this shrink below its content so the body can\n              scroll; flex-1 fills a panel given a fixed height. */}\n          <div className=\"flex min-h-0 flex-1 flex-col\">{renderVariantContent()}</div>\n        </ModalLabelContext.Provider>\n      </div>\n    </div>\n  );\n\n  return (\n    <>\n      <span ref={setAnchor} hidden aria-hidden=\"true\" />\n      <LiquidGlassSvgFilter />\n      {createPortal(overlay, portalTarget)}\n    </>\n  );\n}\n\nexport type ModalSectionProps = {\n  title?: React.ReactNode;\n  className?: string;\n  children?: React.ReactNode;\n};\n\nexport function ModalHeader({\n  title,\n  className,\n  children,\n}: ModalSectionProps) {\n  const labelId = useContext(ModalLabelContext);\n  return (\n    <div\n      id={labelId || undefined}\n      className={cn(\n        // shrink-0: in the panel's flex column the explicit min-h would\n        // otherwise let a tall body squeeze a two-line header down to 56px.\n        \"shrink-0 px-6 py-4 text-lg font-semibold border-b border-border/50 flex items-center justify-between min-h-[56px]\",\n        className,\n      )}\n    >\n      <div className=\"flex-1 flex items-center gap-3\">\n        {title && typeof title === \"string\" ? (\n          <h2 className=\"text-lg font-semibold text-foreground\">{title}</h2>\n        ) : (\n          title\n        )}\n        {children}\n      </div>\n    </div>\n  );\n}\n\nexport function ModalFooter({ className, children }: ModalSectionProps) {\n  return (\n    <div className={cn(\"flex shrink-0 justify-end gap-2 p-4\", className)}>\n      {children}\n    </div>\n  );\n}\n\nexport function ModalBody({ className, children }: ModalSectionProps) {\n  return (\n    <div className={cn(\"p-4 max-h-[calc(100vh-150px)] overflow-auto\", className)}>\n      {children}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/custom/blocks/ModalBlock.tsx"
    }
  ],
  "docs": "Named exports: Modal, ModalHeader, ModalBody, ModalFooter, plus the ModalProps and ModalSectionProps types. Modal is controlled — pass `isOpen` and `onClose`; there is no trigger and no `type` or `variant`. Size and skin the panel with `contentClassName` and the backdrop with `overlayClassName`; `hideCloseButton` drops the built-in X and `primaryCloseButton` tints it. Pass `ariaLabel` whenever the heading is not inside ModalHeader. Every slot is optional. The documented form example uses `select`. For a trigger-driven dialog with uncontrolled open state, use `dialog`.",
  "categories": [
    "overlays"
  ],
  "type": "registry:component"
}
