'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { cn } from '../../utils/cn.js';
export function FieldAccordion({ label, default_open = false, children }) {
    const [is_open, set_is_open] = useState(default_open);
    return (_jsxs("div", { className: "cls_field_accordion col-span-full", children: [_jsxs("button", { type: "button", className: "flex items-center gap-2 py-1.5 px-2 cursor-pointer select-none w-full text-left", onClick: () => set_is_open(!is_open), children: [_jsx("svg", { className: cn('w-3.5 h-3.5 shrink-0 transition-transform', !is_open && '-rotate-90'), fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }), _jsx("span", { className: "font-semibold text-sm text-gray-700", children: label })] }), is_open && children] }));
}
//# sourceMappingURL=field_accordion.js.map