@dndbuilder.com/react
Version:
Drag and drop builder for React
51 lines (50 loc) • 3 kB
JavaScript
"use client";
import { jsx as e, jsxs as s } from "react/jsx-runtime";
import { ScrollArea as c } from "../../shared/scroll-area.js";
import { Tabs as a } from "../../shared/tabs.js";
import { BuilderConfiguration as g } from "../../../config/builder.config.js";
import { lazy as p, useState as f, Suspense as i } from "react";
import { CgSpinner as v } from "../../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.0.0/node_modules/react-icons/cg/index.js";
const d = () => /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center p-8", children: [
/* @__PURE__ */ e(v, { size: 24, className: "animate-spin text-gray-600" }),
/* @__PURE__ */ e("span", { className: "mt-2 text-sm text-gray-600", children: "Loading..." })
] }), b = p(
() => import("../../controls/advance-settings.control.js")
), k = ({ type: m }) => {
const [h, u] = f(0), t = g.getBlock(m), n = (t == null ? void 0 : t.controls) ?? [], o = (t == null ? void 0 : t.disableAdvancedSettings) ?? !1;
return n.length === 0 && o ? /* @__PURE__ */ e("div", { className: "flex justify-center py-10 text-gray-400", children: "No controls found" }) : /* @__PURE__ */ e("div", { className: "block-control-panel h-full bg-white", children: /* @__PURE__ */ s(
a,
{
value: String(h),
onValueChange: (r) => u(Number(r)),
className: "w-full",
children: [
/* @__PURE__ */ s(a.List, { className: "w-full rounded-none bg-gray-100 p-0", children: [
n.map((r, l) => /* @__PURE__ */ e(
a.Trigger,
{
value: String(l),
className: "h-full w-full rounded-none border-t-2 border-t-transparent font-medium text-gray-700 data-[state=active]:border-t-gray-800 data-[state=active]:shadow-none",
children: r.label
},
l
)),
!o && /* @__PURE__ */ e(
a.Trigger,
{
value: String(n.length),
className: "h-full w-full rounded-none border-t-2 border-t-transparent font-medium text-gray-700 data-[state=active]:border-t-gray-800 data-[state=active]:shadow-none",
children: "Advanced"
}
)
] }),
n.map((r, l) => /* @__PURE__ */ e(a.Content, { value: String(l), children: /* @__PURE__ */ e(c, { className: "h-[calc(100vh-175px)]", children: /* @__PURE__ */ e("div", { className: "panel-scroll-content", children: /* @__PURE__ */ e(i, { fallback: /* @__PURE__ */ e(d, {}), children: /* @__PURE__ */ e(r.component, {}) }) }) }) }, l)),
!o && /* @__PURE__ */ e(a.Content, { value: String(n.length), children: /* @__PURE__ */ e(c, { className: "h-[calc(100vh-175px)]", children: /* @__PURE__ */ e("div", { className: "panel-scroll-content", children: /* @__PURE__ */ e(i, { fallback: /* @__PURE__ */ e(d, {}), children: /* @__PURE__ */ e(b, {}) }) }) }) })
]
}
) });
};
export {
k as BlockControlPanel
};
//# sourceMappingURL=block-control-panel.js.map