{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "panel",
  "title": "Panel",
  "description": "A surface container with an optional header (icon, title, description, actions), body and footer, with outline, filled and elevated variants and an animated collapse.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/panel/panel.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type PanelVariant = \"outline\" | \"filled\" | \"elevated\";\nexport type PanelPadding = \"sm\" | \"md\" | \"lg\";\n\nexport interface PanelProps {\n  title?: React.ReactNode;\n  description?: React.ReactNode;\n  /** Small leading element next to the title, e.g. an icon. */\n  icon?: React.ReactNode;\n  /** Rendered on the right of the header (buttons, badges…). Stays clickable when collapsible. */\n  actions?: React.ReactNode;\n  children?: React.ReactNode;\n  footer?: React.ReactNode;\n  collapsible?: boolean;\n  defaultCollapsed?: boolean;\n  collapsed?: boolean;\n  onCollapsedChange?: (collapsed: boolean) => void;\n  variant?: PanelVariant;\n  padding?: PanelPadding;\n  /** Draw hairlines between header, body and footer. */\n  dividers?: boolean;\n  /** A thin accent line along the top edge. */\n  accentBar?: boolean;\n  /** Cap the body height and scroll its content. */\n  maxBodyHeight?: number;\n  radius?: number;\n  theme?: \"dark\" | \"light\";\n  accentColor?: string;\n  width?: number | string;\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0E0E0E\", filled: \"#151515\", border: \"rgba(255,255,255,0.1)\", title: \"#F5F4F1\", text: \"rgba(245,244,241,0.62)\", hover: \"rgba(255,255,255,0.06)\", shadow: \"0 24px 60px rgba(0,0,0,0.5)\" },\n  light: { bg: \"#FFFFFF\", filled: \"#F4F4F2\", border: \"rgba(10,10,10,0.1)\", title: \"#0A0A0A\", text: \"rgba(10,10,10,0.6)\", hover: \"rgba(10,10,10,0.05)\", shadow: \"0 24px 60px rgba(10,10,10,0.12)\" },\n};\n\nconst PADDING: Record<PanelPadding, { x: number; y: number; title: number; desc: number }> = {\n  sm: { x: 14, y: 12, title: 14, desc: 12 },\n  md: { x: 20, y: 16, title: 15, desc: 13 },\n  lg: { x: 28, y: 22, title: 17, desc: 14 },\n};\n\nfunction Chevron({ open, color }: { open: boolean; color: string }) {\n  return (\n    <motion.svg\n      width=\"16\"\n      height=\"16\"\n      viewBox=\"0 0 16 16\"\n      fill=\"none\"\n      stroke={color}\n      strokeWidth=\"1.7\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      animate={{ rotate: open ? 180 : 0 }}\n      transition={{ type: \"spring\", stiffness: 420, damping: 30 }}\n      className=\"shrink-0\"\n    >\n      <path d=\"M4 6.5 8 10.5 12 6.5\" />\n    </motion.svg>\n  );\n}\n\nexport function Panel({\n  title,\n  description,\n  icon,\n  actions,\n  children,\n  footer,\n  collapsible = false,\n  defaultCollapsed = false,\n  collapsed,\n  onCollapsedChange,\n  variant = \"outline\",\n  padding = \"md\",\n  dividers = true,\n  accentBar = false,\n  maxBodyHeight,\n  radius = 16,\n  theme = \"dark\",\n  accentColor = \"#F2A841\",\n  width,\n  className,\n}: PanelProps) {\n  const p = PALETTES[theme];\n  const pad = PADDING[padding];\n  const uid = React.useId();\n  const reduce = useReducedMotion();\n  const [innerCollapsed, setInnerCollapsed] = React.useState(defaultCollapsed);\n  const isCollapsed = collapsible && (collapsed ?? innerCollapsed);\n  const open = !isCollapsed;\n  const hasHeader = title != null || description != null || icon != null || actions != null;\n\n  const toggle = () => {\n    const next = !isCollapsed;\n    if (collapsed === undefined) setInnerCollapsed(next);\n    onCollapsedChange?.(next);\n  };\n\n  const surface: React.CSSProperties =\n    variant === \"filled\"\n      ? { background: p.filled, border: \"1px solid transparent\" }\n      : variant === \"elevated\"\n        ? { background: p.bg, border: `1px solid ${p.border}`, boxShadow: p.shadow }\n        : { background: p.bg, border: `1px solid ${p.border}` };\n\n  const heading = (\n    <>\n      {icon && (\n        <span className=\"flex shrink-0 items-center justify-center\" style={{ width: 32, height: 32, borderRadius: 9, background: p.hover, color: p.title }}>\n          {icon}\n        </span>\n      )}\n      <span className=\"flex min-w-0 flex-col\" style={{ gap: 2 }}>\n        {title != null && (\n          <span className=\"truncate font-semibold\" style={{ color: p.title, fontSize: pad.title, letterSpacing: \"-0.01em\" }}>\n            {title}\n          </span>\n        )}\n        {description != null && (\n          <span style={{ color: p.text, fontSize: pad.desc, lineHeight: 1.45 }}>{description}</span>\n        )}\n      </span>\n    </>\n  );\n\n  return (\n    <section\n      className={cn(\"relative overflow-hidden\", className)}\n      style={{ width, maxWidth: \"100%\", borderRadius: radius, fontFamily: \"Inter, sans-serif\", ...surface }}\n    >\n      {accentBar && <div aria-hidden=\"true\" className=\"absolute inset-x-0 top-0\" style={{ height: 2, background: accentColor }} />}\n\n      {hasHeader && (\n        <div className=\"flex items-center\" style={{ gap: 12, padding: `${pad.y}px ${pad.x}px`, borderBottom: dividers && open && children != null ? `1px solid ${p.border}` : \"1px solid transparent\", transition: \"border-color 0.2s\" }}>\n          {collapsible ? (\n            <button\n              type=\"button\"\n              onClick={toggle}\n              aria-expanded={open}\n              aria-controls={`${uid}-body`}\n              className=\"-m-1.5 flex min-w-0 flex-1 cursor-pointer items-center border-none bg-transparent p-1.5 text-left outline-none transition-colors focus-visible:ring-2\"\n              style={{ gap: 12, borderRadius: Math.max(6, radius - 6), fontFamily: \"inherit\", [\"--tw-ring-color\" as string]: accentColor }}\n              onMouseEnter={(e) => (e.currentTarget.style.background = p.hover)}\n              onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n            >\n              {heading}\n              <span className=\"ml-auto flex shrink-0 items-center pl-2\">\n                <Chevron open={open} color={p.text} />\n              </span>\n            </button>\n          ) : (\n            <div className=\"flex min-w-0 flex-1 items-center\" style={{ gap: 12 }}>\n              {heading}\n            </div>\n          )}\n          {actions != null && <div className=\"flex shrink-0 items-center\" style={{ gap: 8 }}>{actions}</div>}\n        </div>\n      )}\n\n      <AnimatePresence initial={false}>\n        {open && (\n          <motion.div\n            id={`${uid}-body`}\n            key=\"body\"\n            initial={{ height: 0, opacity: 0 }}\n            animate={{ height: \"auto\", opacity: 1 }}\n            exit={{ height: 0, opacity: 0 }}\n            transition={reduce ? { duration: 0 } : { height: { type: \"spring\", stiffness: 380, damping: 38 }, opacity: { duration: 0.18 } }}\n            style={{ overflow: \"hidden\" }}\n          >\n            {children != null && (\n              <div style={{ padding: `${pad.y}px ${pad.x}px`, color: p.text, fontSize: pad.desc + 1, lineHeight: 1.55, maxHeight: maxBodyHeight, overflowY: maxBodyHeight ? \"auto\" : undefined }}>\n                {children}\n              </div>\n            )}\n            {footer != null && (\n              <div className=\"flex items-center\" style={{ gap: 8, padding: `${pad.y - 2}px ${pad.x}px`, borderTop: dividers ? `1px solid ${p.border}` : \"1px solid transparent\", color: p.text, fontSize: pad.desc }}>\n                {footer}\n              </div>\n            )}\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}