{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "accordion-timeline",
  "title": "Timeline accordion",
  "description": "Styled accordion: the Timeline set. 5 decorative accordion variations (LineAccordion, DashedAccordion, NodeAccordion, FilledAccordion, GradientAccordion) 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/accordion-timeline.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronDown } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Timeline accordion family: 5 vertical-line accordions. A vertical connector\n   runs down the left edge with a node dot on every row; the variants change the\n   style of the line and the node. Every export is a complete accordion: internal\n   single-open state, a button header with aria-expanded, framer height auto\n   animation. Colour comes ONLY from tokens. Alpha via color-mix. Under\n   reduced-motion opening and closing are instant. Size = padding + text scale.\n   Renders without props too. */\n\nexport type StyledSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport interface StyledAccordionItem {\n  value: string\n  title: React.ReactNode\n  content: React.ReactNode\n}\n\ninterface StyledAccordionProps {\n  className?: string\n  size?: StyledSize\n  items?: StyledAccordionItem[]\n  defaultOpen?: string\n}\n\nconst headerPad: Record<StyledSize, string> = {\n  sm: \"py-2.5 text-sm\",\n  md: \"py-3 text-sm\",\n  lg: \"py-4 text-base\",\n  xl: \"py-5 text-lg\",\n}\n\nconst bodyPad: Record<StyledSize, string> = {\n  sm: \"pb-2.5 text-sm\",\n  md: \"pb-3 text-sm\",\n  lg: \"pb-4 text-base\",\n  xl: \"pb-5 text-base\",\n}\n\nconst iconSize: Record<StyledSize, string> = {\n  sm: \"size-4\",\n  md: \"size-4\",\n  lg: \"size-5\",\n  xl: \"size-5\",\n}\n\nconst defaultItems: StyledAccordionItem[] = [\n  {\n    value: \"item-1\",\n    title: \"What is included?\",\n    content:\n      \"Every plan ships the full component library, semantic tokens, and lifetime updates for the tier you own.\",\n  },\n  {\n    value: \"item-2\",\n    title: \"How does installation work?\",\n    content:\n      \"Add any component with a single CLI command. Files land in your project and stay fully editable.\",\n  },\n  {\n    value: \"item-3\",\n    title: \"Can I use it in production?\",\n    content:\n      \"Yes. The system is framework agnostic, self contained, and safe to ship to any number of projects.\",\n  },\n]\n\nfunction useSingleOpen(defaultOpen?: string) {\n  const [open, setOpen] = React.useState<string | null>(defaultOpen ?? null)\n  const toggle = React.useCallback(\n    (value: string) => setOpen((cur) => (cur === value ? null : value)),\n    []\n  )\n  return { open, toggle }\n}\n\nconst headerBase =\n  \"flex w-full items-center justify-between gap-3 pr-1 text-left font-medium outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n\nfunction Panel({\n  isOpen,\n  size,\n  children,\n}: {\n  isOpen: boolean\n  size: StyledSize\n  children: React.ReactNode\n}) {\n  const reduce = useReducedMotion()\n  return (\n    <AnimatePresence initial={false}>\n      {isOpen && (\n        <motion.div\n          key=\"panel\"\n          initial={reduce ? false : { height: 0, opacity: 0 }}\n          animate={{ height: \"auto\", opacity: 1 }}\n          exit={{ height: 0, opacity: 0 }}\n          transition={\n            reduce ? { duration: 0 } : { duration: 0.25, ease: [0.4, 0, 0.2, 1] }\n          }\n          className=\"overflow-hidden\"\n        >\n          <div className={cn(bodyPad[size], \"pr-1 text-muted-foreground\")}>\n            {children}\n          </div>\n        </motion.div>\n      )}\n    </AnimatePresence>\n  )\n}\n\nfunction Chevron({ isOpen, size }: { isOpen: boolean; size: StyledSize }) {\n  const reduce = useReducedMotion()\n  return (\n    <motion.span\n      aria-hidden\n      className=\"shrink-0 text-muted-foreground\"\n      animate={{ rotate: isOpen ? 180 : 0 }}\n      transition={reduce ? { duration: 0 } : { duration: 0.2 }}\n    >\n      <ChevronDown className={iconSize[size]} />\n    </motion.span>\n  )\n}\n\n/* Shared timeline shell: a vertical connector on the left edge plus a node dot\n   on every row. lineClass carries the line style, nodeClass the node style. */\nfunction TimelineShell({\n  props,\n  lineClass,\n  nodeClass,\n}: {\n  props: StyledAccordionProps\n  lineClass: string\n  nodeClass: string\n}) {\n  const { className, size = \"md\", items = defaultItems, defaultOpen } = props\n  const { open, toggle } = useSingleOpen(defaultOpen)\n  return (\n    <div\n      data-slot=\"styled-accordion\"\n      className={cn(\"flex flex-col\", className)}\n    >\n      {items.map((item, i) => {\n        const isOpen = open === item.value\n        const isLast = i === items.length - 1\n        return (\n          <div key={item.value} className=\"relative pl-7\">\n            {/* vertical connector line */}\n            {!isLast && (\n              <span\n                aria-hidden\n                className={cn(\n                  \"absolute left-[5px] top-5 bottom-0 w-px\",\n                  lineClass\n                )}\n              />\n            )}\n            {/* node noktasi */}\n            <span\n              aria-hidden\n              className={cn(\n                \"absolute left-0 top-4 size-[11px] rounded-full transition-colors\",\n                nodeClass,\n                isOpen && \"bg-primary\"\n              )}\n            />\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(headerBase, headerPad[size])}\n            >\n              <span className=\"min-w-0\">{item.title}</span>\n              <Chevron isOpen={isOpen} size={size} />\n            </button>\n            <Panel isOpen={isOpen} size={size}>\n              {item.content}\n            </Panel>\n          </div>\n        )\n      })}\n    </div>\n  )\n}\n\n/* Line: a plain thin token line plus a hollow node ring. */\nexport function LineAccordion(props: StyledAccordionProps) {\n  return (\n    <TimelineShell\n      props={props}\n      lineClass=\"bg-border\"\n      nodeClass=\"border-2 border-border bg-background\"\n    />\n  )\n}\n\n/* Dashed: a dashed vertical line plus a hollow node ring. */\nexport function DashedAccordion(props: StyledAccordionProps) {\n  return (\n    <TimelineShell\n      props={props}\n      lineClass=\"w-0 border-l border-dashed border-border bg-transparent\"\n      nodeClass=\"border-2 border-border bg-background\"\n    />\n  )\n}\n\n/* Node: a pronounced ring node plus a token line. */\nexport function NodeAccordion(props: StyledAccordionProps) {\n  return (\n    <TimelineShell\n      props={props}\n      lineClass=\"bg-border\"\n      nodeClass=\"border-2 border-primary bg-background\"\n    />\n  )\n}\n\n/* Filled: a solid primary node plus a token line. */\nexport function FilledAccordion(props: StyledAccordionProps) {\n  return (\n    <TimelineShell\n      props={props}\n      lineClass=\"bg-border\"\n      nodeClass=\"bg-primary\"\n    />\n  )\n}\n\n/* Gradient: a line fading from top to bottom plus a solid node. */\nexport function GradientAccordion(props: StyledAccordionProps) {\n  return (\n    <TimelineShell\n      props={props}\n      lineClass=\"bg-gradient-to-b from-primary to-[color-mix(in_oklab,var(--color-primary)_10%,transparent)]\"\n      nodeClass=\"bg-primary\"\n    />\n  )\n}\n",
      "type": "registry:component",
      "target": "components/ui/accordion-timeline.tsx"
    }
  ],
  "categories": [
    "styled",
    "accordion"
  ],
  "type": "registry:component"
}