@dndbuilder.com/react
Version:
Drag and drop builder for React
53 lines (52 loc) • 2.13 kB
JavaScript
"use client";
import { jsx as r, jsxs as m } from "react/jsx-runtime";
import { useState as N } from "react";
import { AiOutlineMinus as w, AiOutlinePlus as O } from "../../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/ai/index.js";
import { classNames as p } from "../../../../../../utils.js";
const A = ({ settings: s, meta: l }) => {
var c;
const o = (l == null ? void 0 : l.locale) || "en", [t, h] = N(() => {
var e, i;
return s.isOpenFirstItem && ((e = s.items) != null && e.length) ? [(i = s.items) == null ? void 0 : i[0].id] : [];
}), x = (e) => h((i) => s.isAccordion ? i.includes(e) ? [] : [e] : i.includes(e) ? i.filter((n) => n !== e) : [...i, e]);
return /* @__PURE__ */ r("div", { className: "faqs", children: (c = s.items) == null ? void 0 : c.map((e) => {
var i, n, d, u, a, f;
return /* @__PURE__ */ m("div", { className: "item", children: [
/* @__PURE__ */ m(
"div",
{
onClick: () => x(e.id),
className: "flex cursor-pointer items-center justify-between",
children: [
/* @__PURE__ */ r("span", { className: "title", children: ((n = (i = e.title) == null ? void 0 : i.text) == null ? void 0 : n[o]) || ((u = (d = e.title) == null ? void 0 : d.text) == null ? void 0 : u.en) }),
t.includes(e.id) ? /* @__PURE__ */ r(w, {}) : /* @__PURE__ */ r(O, {})
]
}
),
/* @__PURE__ */ r(
"div",
{
className: p(
"grid grid-rows-[0fr] overflow-hidden transition-[grid-template-rows] duration-200",
{
"grid-rows-[1fr]": t.includes(e.id)
}
),
children: /* @__PURE__ */ r(
"div",
{
className: p("description", "min-h-0", {
"h-auto": t.includes(e.id)
}),
children: (f = (a = e.description) == null ? void 0 : a.text) == null ? void 0 : f[o]
}
)
}
)
] }, e.id);
}) });
};
export {
A as default
};
//# sourceMappingURL=faq.block.js.map