'use client';

// src/components/Accordion/Accordion.tsx
import * as React from "react";
import { ChevronDownIcon } from "@paalan/react-icons";
import { cn } from "@paalan/react-shared/lib";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { jsx, jsxs } from "react/jsx-runtime";
var AccordionRoot = AccordionPrimitive.Root;
var AccordionItem = React.forwardRef(({ className, ...props }, ref) => {
  return /* @__PURE__ */ jsx(AccordionPrimitive.Item, { ref, className: cn("border-b", className), ...props });
});
AccordionItem.displayName = "AccordionItem";
var AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
  AccordionPrimitive.Trigger,
  {
    ref,
    className: cn(
      "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
      className
    ),
    ...props,
    children: [
      children,
      /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 text-muted-foreground transition-transform duration-200" })
    ]
  }
) }));
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
var AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
  AccordionPrimitive.Content,
  {
    ref,
    className: cn(
      "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
      className
    ),
    ...props,
    children: /* @__PURE__ */ jsx("div", { className: "pb-4 pt-0", children })
  }
));
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
var Accordion = ({ items, ...props }) => {
  return /* @__PURE__ */ jsx(AccordionRoot, { ...props, children: items.map((item) => /* @__PURE__ */ jsxs(AccordionItem, { value: item.value, children: [
    /* @__PURE__ */ jsx(AccordionTrigger, { children: item.title }),
    /* @__PURE__ */ jsx(AccordionContent, { children: item.content })
  ] }, item.value)) });
};
Accordion.displayName = "Accordion";
export {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionRoot,
  AccordionTrigger
};
