{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drawer-blur",
  "title": "Blur drawer",
  "description": "Styled drawer: the Blur set. 5 decorative drawer variations (SoftBlurDrawer, HeavyBlurDrawer, DarkBlurDrawer, TintBlurDrawer, GradientBlurDrawer) on the ai2 token system, powered by framer-motion, reduced-motion aware and sized sm to xl. Part of the free styled layer.",
  "dependencies": [
    "motion@^12.42.2",
    "lucide-react@^1.23.0"
  ],
  "registryDependencies": [
    "@ai2/tokens"
  ],
  "files": [
    {
      "path": "registry/ai2/styled/drawer-blur.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Blur drawer family: 5 decorative bottom drawers. The panel always stays\n   CLEAR/opaque (bg-card) - unlike the frosted Glass PANEL in essentials. The whole\n   difference is on the BACKDROP: each variant carries a different scrim + blur\n   technique (light blur, strong blur, dark scrim, primary tint, a top-to-bottom\n   gradient). They all slide up from the bottom edge. Self-contained - no radix, no\n   vaul, no portal. A fixed inset-0 backdrop + a fixed panel pinned to the bottom\n   edge (z-50). Internal state (defaultOpen) or controlled (open + onOpenChange). A\n   backdrop click / Escape / the close button closes it. The panel takes focus on\n   open. The slide runs through AnimatePresence; under reduced-motion there is no\n   slide, only a fade. Color comes ONLY from tokens, with transparency via\n   color-mix. */\n\nexport type StyledSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nconst panelHeight: Record<StyledSize, string> = {\n  sm: \"h-[35vh]\",\n  md: \"h-[50vh]\",\n  lg: \"h-[68vh]\",\n  xl: \"h-[82vh]\",\n}\n\ninterface DrawerProps {\n  size?: StyledSize\n  trigger?: React.ReactNode\n  title?: React.ReactNode\n  children?: React.ReactNode\n  className?: string\n  open?: boolean\n  defaultOpen?: boolean\n  onOpenChange?: (o: boolean) => void\n}\n\n/* Controlled/uncontrolled acik durum yonetimi. */\nfunction useControllableOpen(\n  open: boolean | undefined,\n  defaultOpen: boolean | undefined,\n  onOpenChange: ((o: boolean) => void) | undefined\n) {\n  const [uncontrolled, setUncontrolled] = React.useState(defaultOpen ?? false)\n  const isControlled = open !== undefined\n  const value = isControlled ? open : uncontrolled\n  const setValue = React.useCallback(\n    (next: boolean) => {\n      if (!isControlled) setUncontrolled(next)\n      onOpenChange?.(next)\n    },\n    [isControlled, onOpenChange]\n  )\n  return [value, setValue] as const\n}\n\ninterface ShellProps extends DrawerProps {\n  backdropClassName: string\n}\n\n/* Shared shell: trigger plus an AnimatePresence backdrop plus an opaque panel pinned to the bottom edge. The bottom-edge slide and close mechanism is kept from the Essentials drawer. */\nfunction DrawerShell({\n  backdropClassName,\n  size = \"md\",\n  trigger,\n  title,\n  children,\n  className,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: ShellProps) {\n  const reduce = useReducedMotion()\n  const [isOpen, setOpen] = useControllableOpen(open, defaultOpen, onOpenChange)\n  const panelRef = React.useRef<HTMLDivElement>(null)\n\n  React.useEffect(() => {\n    if (!isOpen) return\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") setOpen(false)\n    }\n    window.addEventListener(\"keydown\", onKey)\n    const id = window.requestAnimationFrame(() => panelRef.current?.focus())\n    return () => {\n      window.removeEventListener(\"keydown\", onKey)\n      window.cancelAnimationFrame(id)\n    }\n  }, [isOpen, setOpen])\n\n  /* Bottom edge: the panel slides up from below (y 100%). No slide under reduced. */\n  const enter = { y: \"100%\" }\n\n  return (\n    <div data-slot=\"styled-drawer-trigger\" className=\"inline-flex\">\n      {/* The ARIA state lives on the REAL trigger. There used to be a\n          `<span role=\"button\" tabIndex={-1}>` wrapper, which produced two\n          buttons in the AX tree: one carrying the state (not focusable) and\n          one that took focus (stateless). A screen-reader user never heard\n          \"has dialog\" or \"expanded\" - measured with the CDP AX tree. */}\n      {React.isValidElement<React.ButtonHTMLAttributes<HTMLButtonElement>>(trigger) ? (\n        React.cloneElement(trigger, {\n          \"aria-haspopup\": \"dialog\",\n          \"aria-expanded\": isOpen,\n          onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n            trigger.props.onClick?.(event)\n            setOpen(true)\n          },\n        })\n      ) : (\n        <button\n          type=\"button\"\n          aria-haspopup=\"dialog\"\n          aria-expanded={isOpen}\n          onClick={() => setOpen(true)}\n          className=\"inline-flex h-9 shrink-0 select-none items-center justify-center gap-2 rounded-lg border border-border bg-secondary px-4 text-sm font-medium text-secondary-foreground outline-none whitespace-nowrap transition-[color,background-color] duration-(--motion-fast) ease-(--motion-ease) hover:bg-surface-3 focus-visible:ring-[3px] focus-visible:ring-ring/50 [&_i]:text-base [&_i]:leading-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\"\n        >\n          {trigger ?? \"Open\"}\n        </button>\n      )}\n\n      <AnimatePresence>\n        {isOpen ? (\n          <div className=\"fixed inset-0 z-50\">\n            <motion.div\n              data-slot=\"styled-drawer-backdrop\"\n              onClick={() => setOpen(false)}\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0 }}\n              transition={{ duration: reduce ? 0 : 0.2, ease: [0.4, 0, 0.2, 1] }}\n              className={cn(\"absolute inset-0\", backdropClassName)}\n            />\n            <motion.div\n              ref={panelRef}\n              data-slot=\"styled-drawer\"\n              role=\"dialog\"\n              aria-modal=\"true\"\n              tabIndex={-1}\n              initial={reduce ? { opacity: 0 } : enter}\n              animate={reduce ? { opacity: 1 } : { y: 0 }}\n              exit={reduce ? { opacity: 0 } : enter}\n              transition={\n                reduce\n                  ? { duration: 0 }\n                  : { type: \"spring\", stiffness: 320, damping: 34 }\n              }\n              className={cn(\n                \"fixed inset-x-0 bottom-0 flex flex-col rounded-t-2xl border-t border-border bg-card text-card-foreground shadow-lg outline-none\",\n                panelHeight[size],\n                className\n              )}\n            >\n              {/* Top handle bar: the identity of a bottom drawer (same as Essentials). */}\n              <div className=\"flex w-full shrink-0 items-center justify-center pt-3 pb-1\">\n                <span className=\"h-1.5 w-12 rounded-full bg-[color-mix(in_oklab,var(--color-foreground)_25%,transparent)]\" />\n              </div>\n\n              <div className=\"flex items-start justify-between gap-4 px-6 pt-1 pb-2\">\n                {title ? (\n                  <h2\n                    data-slot=\"styled-drawer-title\"\n                    className=\"text-base font-semibold text-foreground\"\n                  >\n                    {title}\n                  </h2>\n                ) : (\n                  <span />\n                )}\n                <button\n                  type=\"button\"\n                  onClick={() => setOpen(false)}\n                  aria-label=\"Close\"\n                  className=\"relative -m-1 inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none transition-[color,background-color] duration-(--motion-fast) ease-(--motion-ease) hover:bg-surface-3 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 after:absolute after:-inset-2 [&_i]:text-base [&_i]:leading-none [&_svg]:size-4\"\n                >\n                  <X />\n                </button>\n              </div>\n\n              <div className=\"min-h-0 flex-1 overflow-y-auto px-6 pb-6 text-sm text-muted-foreground\">\n                {children}\n              </div>\n            </motion.div>\n          </div>\n        ) : null}\n      </AnimatePresence>\n    </div>\n  )\n}\n\n/* SoftBlur: hafif backdrop-blur-sm + dusuk scrim. */\nexport function SoftBlurDrawer(props: DrawerProps) {\n  return (\n    <DrawerShell\n      {...props}\n      backdropClassName=\"bg-[color-mix(in_oklab,var(--color-foreground)_28%,transparent)] supports-[backdrop-filter]:backdrop-blur-sm\"\n    />\n  )\n}\n\n/* HeavyBlur: guclu backdrop-blur-xl + orta scrim. */\nexport function HeavyBlurDrawer(props: DrawerProps) {\n  return (\n    <DrawerShell\n      {...props}\n      backdropClassName=\"bg-[color-mix(in_oklab,var(--color-foreground)_36%,transparent)] supports-[backdrop-filter]:backdrop-blur-xl\"\n    />\n  )\n}\n\n/* DarkBlur: koyu scrim (foreground yuksek yuzde) + orta blur. */\nexport function DarkBlurDrawer(props: DrawerProps) {\n  return (\n    <DrawerShell\n      {...props}\n      backdropClassName=\"bg-[color-mix(in_oklab,var(--color-foreground)_70%,transparent)] supports-[backdrop-filter]:backdrop-blur-md\"\n    />\n  )\n}\n\n/* TintBlur: primary tonlu transluent scrim + blur. */\nexport function TintBlurDrawer(props: DrawerProps) {\n  return (\n    <DrawerShell\n      {...props}\n      backdropClassName=\"bg-[color-mix(in_oklab,var(--color-primary)_35%,transparent)] supports-[backdrop-filter]:backdrop-blur-md\"\n    />\n  )\n}\n\n/* GradientBlur: ustten alta gradient scrim + blur. */\nexport function GradientBlurDrawer(props: DrawerProps) {\n  return (\n    <DrawerShell\n      {...props}\n      backdropClassName=\"bg-gradient-to-b from-[color-mix(in_oklab,var(--color-foreground)_20%,transparent)] to-[color-mix(in_oklab,var(--color-foreground)_60%,transparent)] supports-[backdrop-filter]:backdrop-blur-md\"\n    />\n  )\n}\n",
      "type": "registry:component",
      "target": "components/ui/drawer-blur.tsx"
    }
  ],
  "categories": [
    "styled",
    "drawer"
  ],
  "type": "registry:component"
}