{
  "name": "accordion",
  "type": "registry:ui",
  "framework": "react",
  "title": "Accordion",
  "description": "Sections that open and close under their headings, one at a time or independently.",
  "dependencies": [
    "radix-ui"
  ],
  "files": [
    {
      "path": "ui/accordion.tsx",
      "content": "\"use client\"\n\nimport { Accordion as AccordionPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type AccordionProps =\n  | (Omit<AccordionPrimitive.AccordionSingleProps, \"type\"> & {\n      /** `single` closes the open section when another opens. */\n      type?: \"single\"\n    })\n  | AccordionPrimitive.AccordionMultipleProps\n\n/*\n * Radix owns the behaviour: which sections are open, the arrow keys, Home and\n * End between the headings, and the ids that link each heading to its panel.\n * Only the look is newt/ui's. Without a `type` it is `single` and\n * `collapsible`, so the open section also closes on a second press.\n */\nconst Accordion = React.forwardRef<\n  React.ComponentRef<typeof AccordionPrimitive.Root>,\n  AccordionProps\n>(({ className, ...props }, ref) => {\n  const classes = cn(\n    \"flex w-full flex-col overflow-hidden rounded-[var(--newt-radius-md)] border border-newt-border bg-newt-bg-surface\",\n    className\n  )\n  if (props.type === \"multiple\") {\n    return <AccordionPrimitive.Root ref={ref} className={classes} {...props} />\n  }\n  return (\n    <AccordionPrimitive.Root\n      ref={ref}\n      collapsible\n      className={classes}\n      {...props}\n      type=\"single\"\n    />\n  )\n})\nAccordion.displayName = \"Accordion\"\n\nconst AccordionItem = React.forwardRef<\n  React.ComponentRef<typeof AccordionPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n  <AccordionPrimitive.Item\n    ref={ref}\n    className={cn(\n      \"border-newt-border [&:not(:first-child)]:border-t\",\n      className\n    )}\n    {...props}\n  />\n))\nAccordionItem.displayName = \"AccordionItem\"\n\n/*\n * The always-visible line that opens the section. It is a button inside a\n * heading, so a screen reader lists the sections among the page's headings.\n */\nconst AccordionTrigger = React.forwardRef<\n  React.ComponentRef<typeof AccordionPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n  <AccordionPrimitive.Header className=\"m-0 flex\">\n    <AccordionPrimitive.Trigger\n      ref={ref}\n      className={cn(\n        \"group flex flex-1 cursor-pointer items-center justify-between gap-3 border-0 bg-transparent px-4 py-3 text-start text-[15px] font-semibold leading-5 text-newt-text-primary transition-colors duration-fast ease-newt hover:bg-newt-bg-hover\",\n        \"focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-newt-text-link\",\n        \"disabled:pointer-events-none disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <svg\n        viewBox=\"0 0 16 16\"\n        aria-hidden=\"true\"\n        className=\"h-4 w-4 shrink-0 text-newt-text-muted group-data-[state=open]:rotate-90 rtl:-scale-x-100 rtl:group-data-[state=open]:scale-x-100\"\n      >\n        <path\n          fill=\"currentColor\"\n          d=\"M5.3 3.3a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1 0 1.4l-4 4a1 1 0 0 1-1.4-1.4L8.6 8 5.3 4.7a1 1 0 0 1 0-1.4Z\"\n        />\n      </svg>\n    </AccordionPrimitive.Trigger>\n  </AccordionPrimitive.Header>\n))\nAccordionTrigger.displayName = \"AccordionTrigger\"\n\nconst AccordionContent = React.forwardRef<\n  React.ComponentRef<typeof AccordionPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, ...props }, ref) => (\n  <AccordionPrimitive.Content\n    ref={ref}\n    className={cn(\n      \"px-4 pb-3.5 text-sm leading-5 text-newt-text-secondary\",\n      className\n    )}\n    {...props}\n  />\n))\nAccordionContent.displayName = \"AccordionContent\"\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n",
      "type": "registry:ui"
    }
  ]
}