UNPKG

@dndbuilder.com/react

Version:

Drag and drop builder for React

22 lines (21 loc) 1.18 kB
import { jsx as t, jsxs as a } from "react/jsx-runtime"; import { generateBlockProps as l } from "../../utils/block.js"; import { Suspense as u } from "react"; import B from "./block-wrapper.js"; import "../../config/theme.config.js"; import { BuilderConfiguration as f } from "../../config/builder.config.js"; import { LicenseManager as s } from "../../licensing/index.js"; const y = ({ block: e, index: p, meta: i }) => { const m = e.id, o = l({ block: e, index: p, meta: i }), r = f.getBlock(e.type), n = (r == null ? void 0 : r.previewComponent) || (r == null ? void 0 : r.component), d = s.isBlockPremium(e.type), c = s.canUseBlock(e.type); return n ? d && !c ? null : /* @__PURE__ */ t(u, { children: /* @__PURE__ */ t(B, { blockId: m, attributes: o.attributes, children: /* @__PURE__ */ t(n, { ...o }) }) }) : /* @__PURE__ */ t("div", { className: "border-danger-500 text-danger-500 rounded-sm border border-dashed px-4 py-2 text-center", children: /* @__PURE__ */ a("p", { children: [ 'Block type "', e.type, '" not found' ] }) }); }; y.displayName = "RenderBlock"; export { y as RenderBlock, y as default }; //# sourceMappingURL=render-block.js.map