{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "accordion-styled",
  "title": "Accordion essentials",
  "description": "Styled accordion: the essentials set. 5 decorative accordion variations (BorderedAccordion, SeparatedAccordion, FilledAccordion, GhostAccordion, PlusAccordion) 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-styled.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronDown, Plus } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Accordion family: 5 decorative accordions. Every export is a complete\n   accordion: internal single-open state, a button header with aria-expanded,\n   framer height auto animation. Colour comes ONLY from tokens. Alpha via\n   color-mix. Under reduced-motion opening and closing are instant. Size =\n   padding + text scale. 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: \"px-3 py-2.5 text-sm\",\n  md: \"px-4 py-3 text-sm\",\n  lg: \"px-5 py-4 text-base\",\n  xl: \"px-6 py-5 text-lg\",\n}\n\nconst bodyPad: Record<StyledSize, string> = {\n  sm: \"px-3 pb-2.5 text-sm\",\n  md: \"px-4 pb-3 text-sm\",\n  lg: \"px-5 pb-4 text-base\",\n  xl: \"px-6 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 hoverTint =\n  \"hover:bg-[color-mix(in_oklab,var(--color-foreground)_5%,transparent)]\"\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 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={reduce ? { height: 0, opacity: 0 } : { 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], \"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\nfunction PlusMark({ 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 ? 45 : 0 }}\n      transition={reduce ? { duration: 0 } : { duration: 0.2 }}\n    >\n      <Plus className={iconSize[size]} />\n    </motion.span>\n  )\n}\n\n/* Bordered: tek cerceveli kap, satirlar token cizgiyle bolunur, chevron doner. */\nexport function BorderedAccordion({\n  className,\n  size = \"md\",\n  items = defaultItems,\n  defaultOpen,\n}: StyledAccordionProps) {\n  const { open, toggle } = useSingleOpen(defaultOpen)\n  return (\n    <div\n      data-slot=\"styled-accordion\"\n      className={cn(\n        \"overflow-hidden rounded-xl border border-border bg-background\",\n        className\n      )}\n    >\n      {items.map((item, i) => {\n        const isOpen = open === item.value\n        return (\n          <div key={item.value} className={cn(i > 0 && \"border-t border-border\")}>\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(headerBase, headerPad[size], hoverTint)}\n            >\n              {item.title}\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/* Separated: her item ayri yuvarlak token kart, aralarinda bosluk. */\nexport function SeparatedAccordion({\n  className,\n  size = \"md\",\n  items = defaultItems,\n  defaultOpen,\n}: StyledAccordionProps) {\n  const { open, toggle } = useSingleOpen(defaultOpen)\n  return (\n    <div\n      data-slot=\"styled-accordion\"\n      className={cn(\"flex flex-col gap-2\", className)}\n    >\n      {items.map((item) => {\n        const isOpen = open === item.value\n        return (\n          <div\n            key={item.value}\n            className=\"overflow-hidden rounded-xl border border-border bg-background\"\n          >\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(headerBase, headerPad[size], hoverTint)}\n            >\n              {item.title}\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/* Filled: acik olan item yumusak token dolgu arka plani alir. */\nexport function FilledAccordion({\n  className,\n  size = \"md\",\n  items = defaultItems,\n  defaultOpen,\n}: StyledAccordionProps) {\n  const { open, toggle } = useSingleOpen(defaultOpen)\n  return (\n    <div\n      data-slot=\"styled-accordion\"\n      className={cn(\"flex flex-col gap-1\", className)}\n    >\n      {items.map((item) => {\n        const isOpen = open === item.value\n        return (\n          <div\n            key={item.value}\n            className={cn(\n              \"overflow-hidden rounded-lg transition-colors\",\n              isOpen && \"bg-surface-2\"\n            )}\n          >\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(\n                headerBase,\n                headerPad[size],\n                !isOpen && hoverTint\n              )}\n            >\n              {item.title}\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/* Ghost: no frame, minimal; only a chevron + a hover token tint. */\nexport function GhostAccordion({\n  className,\n  size = \"md\",\n  items = defaultItems,\n  defaultOpen,\n}: StyledAccordionProps) {\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) => {\n        const isOpen = open === item.value\n        return (\n          <div key={item.value}>\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(\n                headerBase,\n                headerPad[size],\n                \"rounded-lg\",\n                hoverTint\n              )}\n            >\n              {item.title}\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/* Plus: token arti ikonu, acikken doner ve x'e donusur. */\nexport function PlusAccordion({\n  className,\n  size = \"md\",\n  items = defaultItems,\n  defaultOpen,\n}: StyledAccordionProps) {\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        return (\n          <div key={item.value} className={cn(i > 0 && \"border-t border-border\")}>\n            <button\n              type=\"button\"\n              aria-expanded={isOpen}\n              onClick={() => toggle(item.value)}\n              className={cn(headerBase, headerPad[size])}\n            >\n              {item.title}\n              <PlusMark 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",
      "type": "registry:component",
      "target": "components/ui/accordion-styled.tsx"
    }
  ],
  "categories": [
    "styled",
    "accordion"
  ],
  "type": "registry:component"
}