{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "description-list",
  "title": "Description List",
  "description": "A semantic term/value list for specs, order summaries or profile details, with stacked, inline and grid layouts, optional icons and a hover-reveal copy button per row.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/description-list/description-list.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence } 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 DescriptionListLayout = \"stacked\" | \"inline\" | \"grid\";\nexport type DescriptionListSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface DescriptionListItem {\n  id: string;\n  term: string;\n  description: React.ReactNode;\n  icon?: React.ReactNode;\n  /** Plain-text value to copy; defaults to `description` when that's a string. Showing this (or setting copyable) adds a copy button. */\n  copyValue?: string;\n  copyable?: boolean;\n}\n\nexport interface DescriptionListProps {\n  items: DescriptionListItem[];\n  layout?: DescriptionListLayout;\n  title?: string;\n  /** Wraps the list in a bordered card. */\n  bordered?: boolean;\n  dividers?: boolean;\n  /** Column count for \"grid\" layout. */\n  columns?: number;\n  size?: DescriptionListSize;\n  theme?: \"dark\" | \"light\";\n  accentColor?: string;\n  width?: number | string;\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0E0E0E\", border: \"rgba(255,255,255,0.09)\", divider: \"rgba(255,255,255,0.08)\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.55)\", faint: \"rgba(245,244,241,0.3)\", iconBg: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.06)\" },\n  light: { bg: \"#FFFFFF\", border: \"rgba(10,10,10,0.1)\", divider: \"rgba(10,10,10,0.08)\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.55)\", faint: \"rgba(10,10,10,0.3)\", iconBg: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.05)\" },\n};\n\nconst SIZES: Record<DescriptionListSize, { term: number; desc: number; icon: number; padY: number; gap: number }> = {\n  sm: { term: 11.5, desc: 13, icon: 24, padY: 10, gap: 3 },\n  md: { term: 12.5, desc: 14, icon: 28, padY: 12, gap: 4 },\n  lg: { term: 13.5, desc: 15.5, icon: 32, padY: 14, gap: 5 },\n};\n\ntype Palette = (typeof PALETTES)[\"dark\"];\ntype Size = (typeof SIZES)[\"md\"];\n\nfunction CopyGlyph({ copied, size }: { copied: boolean; size: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      {copied ? (\n        <path d=\"M3.5 8.3L6.3 11.2L12.5 4.5\" />\n      ) : (\n        <>\n          <rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" />\n          <path d=\"M3.5 10.5A1.5 1.5 0 0 1 2 9V3.5A1.5 1.5 0 0 1 3.5 2H9a1.5 1.5 0 0 1 1.5 1.5\" />\n        </>\n      )}\n    </svg>\n  );\n}\n\nfunction CopyButton({ value, p, size, onCopied }: { value: string; p: Palette; size: number; onCopied: () => void }) {\n  const [copied, setCopied] = React.useState(false);\n  const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  React.useEffect(() => () => {\n    if (timer.current) clearTimeout(timer.current);\n  }, []);\n\n  const copy = () => {\n    try {\n      const cb = navigator.clipboard;\n      if (cb && typeof cb.writeText === \"function\") {\n        void cb.writeText(value).then(\n          () => {\n            setCopied(true);\n            onCopied();\n            if (timer.current) clearTimeout(timer.current);\n            timer.current = setTimeout(() => setCopied(false), 1400);\n          },\n          () => undefined,\n        );\n      }\n    } catch {\n      // clipboard can be blocked inside an embedded frame\n    }\n  };\n\n  return (\n    <button\n      type=\"button\"\n      onClick={copy}\n      aria-label={copied ? \"Copied\" : \"Copy value\"}\n      className=\"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent align-middle outline-none focus-visible:ring-2\"\n      style={{ width: size, height: size, color: copied ? p.text : p.muted, [\"--tw-ring-color\" as string]: p.text }}\n      onMouseEnter={(e) => (e.currentTarget.style.background = p.hover)}\n      onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n    >\n      <AnimatePresence mode=\"wait\" initial={false}>\n        <motion.span key={String(copied)} initial={{ opacity: 0, scale: 0.7 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.7 }} transition={{ duration: 0.14 }} className=\"flex items-center justify-center\">\n          <CopyGlyph copied={copied} size={size - 12} />\n        </motion.span>\n      </AnimatePresence>\n    </button>\n  );\n}\n\nfunction Row({ item, layout, s, p }: { item: DescriptionListItem; layout: DescriptionListLayout; s: Size; p: Palette }) {\n  const copyValue = item.copyValue ?? (item.copyable && typeof item.description === \"string\" ? item.description : undefined);\n  const inline = layout === \"inline\";\n  // The copy button only fades in on hover/focus (via the CSS group below),\n  // but that would also hide the \"Copied\" confirmation the instant the\n  // pointer leaves right after a click — force it visible for the same\n  // window the button itself shows the checkmark.\n  const [justCopied, setJustCopied] = React.useState(false);\n  const clearTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  React.useEffect(() => () => {\n    if (clearTimer.current) clearTimeout(clearTimer.current);\n  }, []);\n  const handleCopied = () => {\n    setJustCopied(true);\n    if (clearTimer.current) clearTimeout(clearTimer.current);\n    clearTimer.current = setTimeout(() => setJustCopied(false), 1400);\n  };\n\n  return (\n    <div\n      className={cn(\"group/row relative flex\", inline ? \"items-center justify-between\" : \"flex-col\")}\n      style={{ padding: `${s.padY}px 0`, gap: inline ? 12 : s.gap }}\n    >\n      <dt className=\"flex shrink-0 items-center font-medium\" style={{ gap: 8, color: p.muted, fontSize: s.term, letterSpacing: inline ? undefined : \"0.04em\", textTransform: inline ? undefined : \"uppercase\" }}>\n        {item.icon && (\n          <span className=\"flex shrink-0 items-center justify-center rounded-lg\" style={{ width: s.icon, height: s.icon, background: p.iconBg, color: p.text }}>\n            {item.icon}\n          </span>\n        )}\n        {item.term}\n      </dt>\n      <dd className={cn(\"m-0 flex min-w-0 items-center\", inline ? \"justify-end text-right\" : \"justify-start text-left\")} style={{ gap: 6, color: p.text, fontSize: s.desc, fontWeight: 500, lineHeight: 1.5 }}>\n        <span className=\"min-w-0 truncate\">{item.description}</span>\n        {copyValue && (\n          <span\n            className={cn(\"shrink-0 transition-opacity duration-150 group-hover/row:opacity-100 group-focus-within/row:opacity-100\", justCopied ? \"opacity-100\" : \"opacity-0\")}\n          >\n            <CopyButton value={copyValue} p={p} size={s.icon - 4} onCopied={handleCopied} />\n          </span>\n        )}\n      </dd>\n    </div>\n  );\n}\n\nexport function DescriptionList({\n  items,\n  layout = \"stacked\",\n  title,\n  bordered = true,\n  dividers = true,\n  columns = 2,\n  size = \"md\",\n  theme = \"dark\",\n  accentColor,\n  width,\n  className,\n}: DescriptionListProps) {\n  const p = PALETTES[theme];\n  const s = SIZES[size];\n  const uid = React.useId();\n  const isGrid = layout === \"grid\";\n\n  return (\n    <div\n      className={cn(\"flex flex-col\", className)}\n      style={{ width, maxWidth: \"100%\", padding: bordered ? 18 : 0, borderRadius: bordered ? 16 : 0, background: bordered ? p.bg : \"transparent\", border: bordered ? `1px solid ${p.border}` : \"none\", fontFamily: \"Inter, sans-serif\" }}\n    >\n      {title && (\n        <h3 id={`${uid}-title`} className=\"m-0 font-semibold tracking-[-0.01em]\" style={{ color: accentColor ?? p.text, fontSize: s.desc + 1.5, marginBottom: 10 }}>\n          {title}\n        </h3>\n      )}\n      <dl aria-labelledby={title ? `${uid}-title` : undefined} className={cn(\"m-0\", isGrid && \"grid\")} style={isGrid ? { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, columnGap: 24, rowGap: s.padY } : undefined}>\n        {items.map((item, i) => (\n          <div key={item.id} style={!isGrid && dividers && i < items.length - 1 ? { borderBottom: `1px solid ${p.divider}` } : undefined}>\n            <Row item={item} layout={isGrid ? \"stacked\" : layout} s={s} p={p} />\n          </div>\n        ))}\n      </dl>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}