@chaibuilder/sdk 1.2.10 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -12
- package/dist/AddBlocks-ByeMUUzE.js +218 -0
- package/dist/AddBlocks-nMUkm4og.cjs +1 -0
- package/dist/{BrandingOptions-10jJO8mG.js → BrandingOptions--poS5shs.js} +18 -21
- package/dist/BrandingOptions-eeDfvB0R.cjs +1 -0
- package/dist/{CanvasArea-jgBDM5Qd.js → CanvasArea--TKubnIM.js} +184 -185
- package/dist/{CanvasArea-6O8dMPug.cjs → CanvasArea-h4lA4oqP.cjs} +4 -4
- package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
- package/dist/Class-5ARpH_Tu.cjs +1 -0
- package/dist/CurrentPage-B3YumhrX.cjs +1 -0
- package/dist/{CurrentPage-lakeZviD.js → CurrentPage-Gw9LJ40j.js} +24 -25
- package/dist/Layers-4r_4F6ST.cjs +1 -0
- package/dist/{Layers-R7TfREUd.js → Layers-d-xge4On.js} +77 -78
- package/dist/{PagesPanel-4mqxCFHq.js → PagesPanel-E4wSgVcE.js} +14 -15
- package/dist/PagesPanel-iZLDBwXQ.cjs +1 -0
- package/dist/ProjectPanel-2TcqGnfN.cjs +1 -0
- package/dist/{ProjectPanel-Wy2nw-1w.js → ProjectPanel-q7upaf7h.js} +17 -18
- package/dist/Settings-NuDNH2dR.cjs +1 -0
- package/dist/{Settings-_K28Ontt.js → Settings-y3DHsT88.js} +163 -164
- package/dist/SidePanels-91l1CjYv.cjs +1 -0
- package/dist/{SidePanels-6slnxdSj.js → SidePanels-BK_QnEh9.js} +40 -41
- package/dist/{Topbar-bwt6HjlL.js → Topbar-b7jnOD57.js} +16 -17
- package/dist/Topbar-rEO5z57t.cjs +1 -0
- package/dist/{UnsplashImages-V29UE-57.js → UnsplashImages-Lb78FYx7.js} +27 -28
- package/dist/UnsplashImages-p-WdKs3b.cjs +1 -0
- package/dist/{UploadImages-E0mi_qn8.js → UploadImages-aWG_1r7N.js} +23 -24
- package/dist/UploadImages-zk-IYDx8.cjs +1 -0
- package/dist/{add-page-modal-FJEAqfD3.js → add-page-modal-7djj9GZj.js} +28 -29
- package/dist/add-page-modal-iUffBbAe.cjs +1 -0
- package/dist/{confirm-alert-5hfE116f.js → confirm-alert-QuqMrpWn.js} +12 -13
- package/dist/confirm-alert-i3FRAgP4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +9 -50
- package/dist/core.js +47 -56
- package/dist/defaultTheme-IH19g4fv.cjs +1 -0
- package/dist/defaultTheme-YY8mlQS3.js +1055 -0
- package/dist/{delete-page-modal-wH0yLiQI.js → delete-page-modal-DEBiprds.js} +14 -15
- package/dist/delete-page-modal-RllDrgxs.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +100 -81
- package/dist/email.cjs +1 -0
- package/dist/email.d.ts +116 -0
- package/dist/email.js +79 -0
- package/dist/{controls-XPXGHKht.js → empty-slot-MWycClTb.js} +61 -50
- package/dist/empty-slot-TF2kd-0X.cjs +1 -0
- package/dist/{form-UVHCD9N3.js → form-94xR0NG8.js} +1 -1
- package/dist/{form-1j01gADS.cjs → form-yz7h2msc.cjs} +1 -1
- package/dist/{index-B4sL0YTN.js → index-0m8Zuv5X.js} +1434 -1552
- package/dist/{index-c2VLKuhY.js → index-19nTm_cE.js} +2069 -2059
- package/dist/index-TEfD-2ti.cjs +1 -0
- package/dist/{index-xbQL0wpz.cjs → index-XVud0HL8.cjs} +33 -33
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +95 -1125
- package/dist/page-viewer-_ktv1pgX.cjs +1 -0
- package/dist/{page-viewer-TcK0I240.js → page-viewer-xPLhXv6k.js} +16 -17
- package/dist/{project-general-setting-4ruKl033.js → project-general-setting-XlORLtqJ.js} +15 -16
- package/dist/project-general-setting-nULU3Tzw.cjs +1 -0
- package/dist/project-seo-setting-9QkARPhg.cjs +1 -0
- package/dist/{project-seo-setting-d1EZlacB.js → project-seo-setting-KQkeHwny.js} +14 -15
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +111 -70
- package/dist/single-page-detail-Gb6O3Yyw.cjs +1 -0
- package/dist/{single-page-detail-PihQi-dP.js → single-page-detail-gtVN9hxR.js} +44 -45
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +13 -14
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +138 -139
- package/dist/{useAddBlockByDrop-nLzs79He.cjs → useAddBlockByDrop-GU5QLPtz.cjs} +1 -1
- package/dist/{useAddBlockByDrop-rcDR-z9_.js → useAddBlockByDrop-b5KJh_7w.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +313 -322
- package/package.json +8 -2
- package/dist/AddBlocks-GiMnBMeQ.js +0 -224
- package/dist/AddBlocks-SzURo9Bj.cjs +0 -1
- package/dist/BrandingOptions-yK-54R-c.cjs +0 -1
- package/dist/CurrentPage-1y62Ne77.cjs +0 -1
- package/dist/Layers-Z4nmm9xK.cjs +0 -1
- package/dist/PagesPanel-ouHdxyOH.cjs +0 -1
- package/dist/ProjectPanel-hHolYZjt.cjs +0 -1
- package/dist/Settings-EYOw02iE.cjs +0 -1
- package/dist/SidePanels-U-_O1QN8.cjs +0 -1
- package/dist/Topbar-dQEoY2P8.cjs +0 -1
- package/dist/UnsplashImages-pGgaUPQy.cjs +0 -1
- package/dist/UploadImages-7oLycdSh.cjs +0 -1
- package/dist/add-page-modal-In6XI-vZ.cjs +0 -1
- package/dist/confirm-alert-Vwd3OzL9.cjs +0 -1
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-tl7FLK9J.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/index-7ogwGh39.cjs +0 -1
- package/dist/page-viewer-SfQUe0SI.cjs +0 -1
- package/dist/project-general-setting-t7E2Y_w9.cjs +0 -1
- package/dist/project-seo-setting-4b_BJZDF.cjs +0 -1
- package/dist/single-page-detail-KuXd9Mur.cjs +0 -1
- package/dist/utils-PTxFk6qT.cjs +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Chai Builder -
|
|
1
|
+
# Chai Builder - Open Source Visual Builder
|
|
2
2
|
|
|
3
|
-
Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
|
|
3
|
+
Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
|
|
4
|
+
It allows you to create web pages & email templates visually by dragging and dropping elements onto the canvas.
|
|
5
|
+
It is a simple React component that renders a full-fledged visual builder into any React application.
|
|
4
6
|
|
|
5
|
-
### Try Chai Builder
|
|
6
|
-
[Demo Link](https://chaibuilder-demo.vercel.app)
|
|
7
|
-
| [GitHub](https://github.com/surajair/demo)
|
|
7
|
+
### [Try Chai Builder](https://chaibuilder.com/demo)
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Manual installation:
|
|
12
12
|
|
|
13
13
|
Step 1: Install the packages
|
|
14
14
|
```bash
|
|
@@ -50,16 +50,14 @@ const BuilderFullPage = () => {
|
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
Step 5: Render the blocks on your page.
|
|
53
|
+
|
|
53
54
|
```tsx
|
|
54
|
-
export default
|
|
55
|
-
|
|
56
|
-
return <>
|
|
57
|
-
<style>{styles}</style>
|
|
58
|
-
<RenderChaiBlocks blocks={blocks} />
|
|
59
|
-
</>
|
|
55
|
+
export default () => {
|
|
56
|
+
return <RenderChaiBlocks blocks={blocks}/>
|
|
60
57
|
}
|
|
61
58
|
```
|
|
62
59
|
|
|
60
|
+
---
|
|
63
61
|
## Support
|
|
64
62
|
If you like the project, you can assist us in expanding. ChaiBuilder is a collaborative endeavor crafted by developers in their free time. We value every contribution, no matter how modest, as each one represents a significant step forward in various ways, particularly in fueling our drive to enhance this tool continually.
|
|
65
63
|
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import y, { createElement as z, useState as f, useCallback as G, useMemo as M, useEffect as q, Suspense as V } from "react";
|
|
3
|
+
import { has as S, first as x, omit as K, isEmpty as g, filter as j, values as b, groupBy as N, mergeWith as O, isArray as T, keys as R, get as U, map as B, uniq as W, includes as J, find as X, reject as _ } from "lodash-es";
|
|
4
|
+
import { useAtom as v } from "jotai";
|
|
5
|
+
import { useTranslation as L } from "react-i18next";
|
|
6
|
+
import { K as w, j as C, X as Q, ao as A, av as Y, aw as Z, ax as $, i as I, a2 as F, aj as ee, ak as se, al as re, am as te, an as P, bg as oe, bh as ae, bi as le, bj as ce, az as ie, bk as ne, bl as de, B as me, bm as pe, bn as ue, bo as xe, ap as he, aq as fe, ar as k, bf as ge, b8 as je, b9 as be, ba as ye, bb as ve, S as ke } from "./index-0m8Zuv5X.js";
|
|
7
|
+
import { BoxIcon as Ne } from "@radix-ui/react-icons";
|
|
8
|
+
import { syncBlocksWithDefaults as H, useChaiBlocks as E } from "@chaibuilder/runtime";
|
|
9
|
+
import { useFeature as Be } from "flagged";
|
|
10
|
+
import { Loader as we } from "lucide-react";
|
|
11
|
+
import { useDrag as Ce, DragPreviewImage as Ae } from "react-dnd";
|
|
12
|
+
import { g as Te } from "./html-to-json-57841sEK.js";
|
|
13
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
+
import "./Functions-7jnEwJyw.js";
|
|
15
|
+
import "clsx";
|
|
16
|
+
import "tailwind-merge";
|
|
17
|
+
import "flat-to-nested";
|
|
18
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
19
|
+
import "@react-hookz/web";
|
|
20
|
+
import "@radix-ui/react-toggle";
|
|
21
|
+
import "class-variance-authority";
|
|
22
|
+
import "./Class-17XFhL48.js";
|
|
23
|
+
import "@radix-ui/react-switch";
|
|
24
|
+
import "@radix-ui/react-slot";
|
|
25
|
+
import "@radix-ui/react-accordion";
|
|
26
|
+
import "@radix-ui/react-alert-dialog";
|
|
27
|
+
import "@radix-ui/react-dialog";
|
|
28
|
+
import "@radix-ui/react-label";
|
|
29
|
+
import "@radix-ui/react-scroll-area";
|
|
30
|
+
import "@radix-ui/react-tabs";
|
|
31
|
+
import "@radix-ui/react-tooltip";
|
|
32
|
+
import "@radix-ui/react-popover";
|
|
33
|
+
import "@radix-ui/react-menubar";
|
|
34
|
+
import "@radix-ui/react-hover-card";
|
|
35
|
+
import "@radix-ui/react-select";
|
|
36
|
+
import "@radix-ui/react-dropdown-menu";
|
|
37
|
+
import "@radix-ui/react-separator";
|
|
38
|
+
import "@radix-ui/react-toast";
|
|
39
|
+
import "cmdk";
|
|
40
|
+
import "@radix-ui/react-context-menu";
|
|
41
|
+
import "react-icons-picker";
|
|
42
|
+
import "react-dom";
|
|
43
|
+
import "react-quill";
|
|
44
|
+
import "himalaya";
|
|
45
|
+
const _e = ({ block: s }) => {
|
|
46
|
+
const { type: t, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = w(), [n, o] = C(), [, u] = Q(), [, p] = v(A), a = () => {
|
|
47
|
+
S(s, "blocks") ? c(H(s.blocks), x(n)) : d(s, x(n)), p("layers");
|
|
48
|
+
}, r = Be("dnd");
|
|
49
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(Y, { children: [
|
|
50
|
+
/* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
onClick: a,
|
|
54
|
+
type: "button",
|
|
55
|
+
onDragStart: (h) => {
|
|
56
|
+
h.dataTransfer.setData("text/plain", JSON.stringify(K(s, ["component", "icon"]))), setTimeout(() => {
|
|
57
|
+
o([]), u(null), p("layers");
|
|
58
|
+
}, 200);
|
|
59
|
+
},
|
|
60
|
+
draggable: r ? "true" : "false",
|
|
61
|
+
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (r ? "cursor-grab" : "cursor-pointer"),
|
|
62
|
+
children: [
|
|
63
|
+
z(i || Ne, { className: "w-4 h-4 mx-auto" }),
|
|
64
|
+
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || t })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
) }),
|
|
68
|
+
/* @__PURE__ */ e.jsx($, { children: /* @__PURE__ */ e.jsx("p", { children: l || t }) })
|
|
69
|
+
] }) });
|
|
70
|
+
}, Pe = ({ block: s, closePopover: t }) => {
|
|
71
|
+
var r;
|
|
72
|
+
const [i, l] = f(!1), d = I("getExternalPredefinedBlock"), { addCoreBlock: c, addPredefinedBlock: n } = w(), [o] = C(), [, u, p] = Ce(
|
|
73
|
+
() => ({
|
|
74
|
+
type: "CHAI_BLOCK",
|
|
75
|
+
item: s
|
|
76
|
+
}),
|
|
77
|
+
[s]
|
|
78
|
+
), a = G(
|
|
79
|
+
async (h) => {
|
|
80
|
+
if (h.stopPropagation(), S(s, "component")) {
|
|
81
|
+
c(s, x(o)), t();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
l(!0);
|
|
85
|
+
const m = await d(s);
|
|
86
|
+
g(m) || n(H(m), x(o)), t();
|
|
87
|
+
},
|
|
88
|
+
[s]
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
91
|
+
/* @__PURE__ */ e.jsx(
|
|
92
|
+
Ae,
|
|
93
|
+
{
|
|
94
|
+
connect: p,
|
|
95
|
+
src: "https://placehold.co/100x30/000000/FFF?text=" + ((r = s.name || s.label) == null ? void 0 : r.replace(" ", "+"))
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ e.jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
ref: u,
|
|
102
|
+
onClick: i ? () => {
|
|
103
|
+
} : a,
|
|
104
|
+
className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
|
|
105
|
+
children: [
|
|
106
|
+
i && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
|
|
107
|
+
/* @__PURE__ */ e.jsx(we, { className: "animate-spin", size: 15, color: "white" }),
|
|
108
|
+
" ",
|
|
109
|
+
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
110
|
+
] }),
|
|
111
|
+
s.preview ? /* @__PURE__ */ e.jsx(
|
|
112
|
+
"img",
|
|
113
|
+
{
|
|
114
|
+
src: s.preview,
|
|
115
|
+
className: "min-h-[50px] w-full rounded-md border border-gray-300",
|
|
116
|
+
alt: s.label
|
|
117
|
+
}
|
|
118
|
+
) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] });
|
|
123
|
+
}, Se = () => {
|
|
124
|
+
const { data: s } = F(), t = E(), i = j(b(t), { category: "custom" }), l = N(i, "group"), d = N(s, "group"), c = M(() => O(l, d, (a, r) => {
|
|
125
|
+
if (T(a) && T(r))
|
|
126
|
+
return [...a, ...r];
|
|
127
|
+
}), [l, d]), [n, o] = f(x(R(c)) || ""), [, u] = v(A), p = U(c, n, []);
|
|
128
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
|
|
129
|
+
/* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(ee, { value: n, onValueChange: (a) => o(a), children: [
|
|
130
|
+
/* @__PURE__ */ e.jsx(se, { className: "w-full", children: /* @__PURE__ */ e.jsx(re, { placeholder: "Select a provider" }) }),
|
|
131
|
+
/* @__PURE__ */ e.jsxs(te, { children: [
|
|
132
|
+
/* @__PURE__ */ e.jsx(P, { value: "", children: "Choose" }),
|
|
133
|
+
y.Children.toArray(
|
|
134
|
+
B(c, (a, r) => /* @__PURE__ */ e.jsx(P, { value: r, children: r }, r))
|
|
135
|
+
)
|
|
136
|
+
] })
|
|
137
|
+
] }) }),
|
|
138
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: y.Children.toArray(
|
|
139
|
+
p.map((a) => /* @__PURE__ */ e.jsx(Pe, { block: a, closePopover: () => u("layers") }))
|
|
140
|
+
) })
|
|
141
|
+
] });
|
|
142
|
+
}, Le = () => {
|
|
143
|
+
const { t: s } = L(), [t, i] = f(""), { addPredefinedBlock: l } = w(), [d] = C(), [, c] = v(A), n = () => {
|
|
144
|
+
const o = Te(t);
|
|
145
|
+
l([...o], x(d) || null), i(""), c("layers");
|
|
146
|
+
};
|
|
147
|
+
return /* @__PURE__ */ e.jsxs(oe, { className: "border-border/0 p-0 shadow-none", children: [
|
|
148
|
+
/* @__PURE__ */ e.jsx(ae, { className: "p-3", children: /* @__PURE__ */ e.jsx(le, { children: s("html_snippet_description") }) }),
|
|
149
|
+
/* @__PURE__ */ e.jsx(ce, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
150
|
+
/* @__PURE__ */ e.jsx(ie, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
151
|
+
/* @__PURE__ */ e.jsx(
|
|
152
|
+
ne,
|
|
153
|
+
{
|
|
154
|
+
autoFocus: !0,
|
|
155
|
+
tabIndex: 1,
|
|
156
|
+
ref: (o) => o && o.focus(),
|
|
157
|
+
onChange: (o) => i(o.target.value),
|
|
158
|
+
rows: 12,
|
|
159
|
+
value: t,
|
|
160
|
+
placeholder: s("enter_code_snippet"),
|
|
161
|
+
className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }) }),
|
|
165
|
+
/* @__PURE__ */ e.jsxs(de, { className: "flex flex-col justify-end p-3", children: [
|
|
166
|
+
/* @__PURE__ */ e.jsx(me, { disabled: t.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
|
|
167
|
+
/* @__PURE__ */ e.jsx(pe, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(ue, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
168
|
+
] })
|
|
169
|
+
] });
|
|
170
|
+
}, Ie = () => !0, Bs = () => {
|
|
171
|
+
const { t: s } = L(), [t, i] = f("core"), [l, d] = f("basic"), c = E(), [, n] = v(xe), o = I("importHTMLSupport", !0), { data: u, isLoading: p } = F(), a = N(
|
|
172
|
+
j(c, () => Ie()),
|
|
173
|
+
"category"
|
|
174
|
+
), r = W(B(a.core, "group"));
|
|
175
|
+
q(() => {
|
|
176
|
+
!J(r, l) && !g(r) && !g(l) && d(x(r));
|
|
177
|
+
}, [r, l]);
|
|
178
|
+
const h = !p && !g(u) || X(b(c), { category: "custom" }) !== void 0;
|
|
179
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
180
|
+
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
181
|
+
/* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
|
|
182
|
+
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(t === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ e.jsx(
|
|
185
|
+
he,
|
|
186
|
+
{
|
|
187
|
+
onValueChange: (m) => {
|
|
188
|
+
n(""), i(m);
|
|
189
|
+
},
|
|
190
|
+
value: t,
|
|
191
|
+
className: "h-max",
|
|
192
|
+
children: /* @__PURE__ */ e.jsxs(fe, { className: "grid w-full " + (h && o ? "grid-cols-3" : "grid-cols-2"), children: [
|
|
193
|
+
/* @__PURE__ */ e.jsx(k, { value: "core", children: s("core") }),
|
|
194
|
+
h ? /* @__PURE__ */ e.jsx(k, { value: "ui-blocks", children: s("custom_blocks") }) : null,
|
|
195
|
+
o ? /* @__PURE__ */ e.jsx(k, { value: "html", children: s("import") }) : null
|
|
196
|
+
] })
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
t === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
|
|
200
|
+
B(
|
|
201
|
+
r,
|
|
202
|
+
(m) => _(j(b(a.core), { group: m }), {
|
|
203
|
+
hidden: !0
|
|
204
|
+
}).length ? /* @__PURE__ */ e.jsx(je, { type: "single", value: m, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(be, { value: m, children: [
|
|
205
|
+
/* @__PURE__ */ e.jsx(ye, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: m }),
|
|
206
|
+
/* @__PURE__ */ e.jsx(ve, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: y.Children.toArray(
|
|
207
|
+
_(j(b(a.core), { group: m }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(_e, { block: D }))
|
|
208
|
+
) }) })
|
|
209
|
+
] }) }) : null
|
|
210
|
+
)
|
|
211
|
+
) }) }),
|
|
212
|
+
t === "ui-blocks" && /* @__PURE__ */ e.jsx(V, { fallback: /* @__PURE__ */ e.jsx(ke, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Se, {}) }),
|
|
213
|
+
t === "html" && o ? /* @__PURE__ */ e.jsx(Le, {}) : null
|
|
214
|
+
] });
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
Bs as default
|
|
218
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),t=require("lodash-es"),g=require("jotai"),y=require("react-i18next"),s=require("./index-TEfD-2ti.cjs"),b=require("@radix-ui/react-icons"),E=require("@chaibuilder/runtime"),q=require("flagged"),B=require("lucide-react"),R=require("react-dnd"),k=require("./html-to-json-2PeOCVey.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("himalaya");const N=({block:r})=>{const{type:i,icon:d,label:a}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[x,l]=s.useSelectedBlockIds(),[,h]=s.useHighlightBlockId(),[,j]=g.useAtom(s.activePanelAtom),n=()=>{t.has(r,"blocks")?u(E.syncBlocksWithDefaults(r.blocks),t.first(x)):m(r,t.first(x)),j("layers")},o=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:n,type:"button",onDragStart:f=>{f.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{l([]),h(null),j("layers")},200)},draggable:o?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(o?"cursor-grab":"cursor-pointer"),children:[c.createElement(d||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:a||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||i})})]})})},A=({block:r,closePopover:i})=>{var o;const[d,a]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:u,addPredefinedBlock:x}=s.useAddBlock(),[l]=s.useSelectedBlockIds(),[,h,j]=R.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),n=c.useCallback(async f=>{if(f.stopPropagation(),t.has(r,"component")){u(r,t.first(l)),i();return}a(!0);const p=await m(r);t.isEmpty(p)||x(E.syncBlocksWithDefaults(p),t.first(l)),i()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(R.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((o=r.name||r.label)==null?void 0:o.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:h,onClick:d?()=>{}:n,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[d&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},C=()=>{const{data:r}=s.useUILibraryBlocks(),i=E.useChaiBlocks(),d=t.filter(t.values(i),{category:"custom"}),a=t.groupBy(d,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(a,m,(n,o)=>{if(t.isArray(n)&&t.isArray(o))return[...n,...o]}),[a,m]),[x,l]=c.useState(t.first(t.keys(u))||""),[,h]=g.useAtom(s.activePanelAtom),j=t.get(u,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:n=>l(n),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(u,(n,o)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:o,children:o},o)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(j.map(n=>e.jsxRuntimeExports.jsx(A,{block:n,closePopover:()=>h("layers")})))})]})},w=()=>{const{t:r}=y.useTranslation(),[i,d]=c.useState(""),{addPredefinedBlock:a}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=g.useAtom(s.activePanelAtom),x=()=>{const l=k.getBlocksFromHTML(i);a([...l],t.first(m)||null),d(""),u("layers")};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:l=>l&&l.focus(),onChange:l=>d(l.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},T=()=>!0,S=()=>{const{t:r}=y.useTranslation(),[i,d]=c.useState("core"),[a,m]=c.useState("basic"),u=E.useChaiBlocks(),[,x]=g.useAtom(s.showPredefinedBlockCategoryAtom),l=s.useBuilderProp("importHTMLSupport",!0),{data:h,isLoading:j}=s.useUILibraryBlocks(),n=t.groupBy(t.filter(u,()=>T()),"category"),o=t.uniq(t.map(n.core,"group"));c.useEffect(()=>{!t.includes(o,a)&&!t.isEmpty(o)&&!t.isEmpty(a)&&m(t.first(o))},[o,a]);const f=!j&&!t.isEmpty(h)||t.find(t.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:p=>{x(""),d(p)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(f&&l?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),f?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,l?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:c.Children.toArray(t.map(o,p=>t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:p,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:p,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:p}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).map(v=>e.jsxRuntimeExports.jsx(N,{block:v})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(C,{})}),i==="html"&&l?e.jsxRuntimeExports.jsx(w,{}):null]})};exports.default=S;
|
|
@@ -2,16 +2,21 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import N from "@rjsf/validator-ajv8";
|
|
4
4
|
import j from "@rjsf/core";
|
|
5
|
-
import { i as k, t as D,
|
|
6
|
-
import { f, c as R, y as a } from "./
|
|
5
|
+
import { i as k, t as D, bt as P } from "./index-0m8Zuv5X.js";
|
|
6
|
+
import { f, c as R, y as a } from "./empty-slot-MWycClTb.js";
|
|
7
7
|
import { debounce as w, isEqual as L } from "lodash-es";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
|
-
import "
|
|
10
|
-
import "class-variance-authority";
|
|
11
|
-
import "./utils-AvyFzbPC.js";
|
|
12
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
9
|
+
import "./Functions-7jnEwJyw.js";
|
|
13
10
|
import "clsx";
|
|
14
11
|
import "tailwind-merge";
|
|
12
|
+
import "@chaibuilder/runtime";
|
|
13
|
+
import "jotai";
|
|
14
|
+
import "flat-to-nested";
|
|
15
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
16
|
+
import "@react-hookz/web";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
15
20
|
import "@radix-ui/react-switch";
|
|
16
21
|
import "@radix-ui/react-slot";
|
|
17
22
|
import "@radix-ui/react-accordion";
|
|
@@ -34,12 +39,6 @@ import "@radix-ui/react-context-menu";
|
|
|
34
39
|
import "react-icons-picker";
|
|
35
40
|
import "react-dom";
|
|
36
41
|
import "react-quill";
|
|
37
|
-
import "jotai";
|
|
38
|
-
import "flat-to-nested";
|
|
39
|
-
import "./Functions-7jnEwJyw.js";
|
|
40
|
-
import "redux-undo";
|
|
41
|
-
import "@chaibuilder/runtime";
|
|
42
|
-
import "@react-hookz/web";
|
|
43
42
|
import "react-i18next";
|
|
44
43
|
const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
45
44
|
const i = w(e, 200), m = (l) => i(l.target.value);
|
|
@@ -103,7 +102,7 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
103
102
|
{ title: "Lustria", value: "Lustria" },
|
|
104
103
|
{ title: "Ovo", value: "Ovo" },
|
|
105
104
|
{ title: "Suranna", value: "Suranna" }
|
|
106
|
-
],
|
|
105
|
+
], Ct = () => {
|
|
107
106
|
const u = k("onSaveBrandingOptions", async () => {
|
|
108
107
|
}), [e, p] = D(), [d] = P(), i = c.useRef(e);
|
|
109
108
|
c.useEffect(() => () => {
|
|
@@ -146,14 +145,14 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
146
145
|
title: "Body Background (Light)",
|
|
147
146
|
default: B
|
|
148
147
|
}),
|
|
149
|
-
bodyBgDarkColor: a({
|
|
150
|
-
title: "Body Background (Dark)",
|
|
151
|
-
default: C
|
|
152
|
-
}),
|
|
153
148
|
bodyTextLightColor: a({
|
|
154
149
|
title: "Body Text (Light)",
|
|
155
150
|
default: x
|
|
156
151
|
}),
|
|
152
|
+
bodyBgDarkColor: a({
|
|
153
|
+
title: "Body Background (Dark)",
|
|
154
|
+
default: C
|
|
155
|
+
}),
|
|
157
156
|
bodyTextDarkColor: a({
|
|
158
157
|
title: "Body Text (Dark)",
|
|
159
158
|
default: b
|
|
@@ -171,9 +170,7 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
171
170
|
/* @__PURE__ */ t.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ t.jsx(
|
|
172
171
|
j,
|
|
173
172
|
{
|
|
174
|
-
widgets: {
|
|
175
|
-
color: F
|
|
176
|
-
},
|
|
173
|
+
widgets: { color: F },
|
|
177
174
|
idSeparator: ".",
|
|
178
175
|
autoComplete: "off",
|
|
179
176
|
omitExtraData: !0,
|
|
@@ -189,5 +186,5 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
189
186
|
] });
|
|
190
187
|
};
|
|
191
188
|
export {
|
|
192
|
-
|
|
189
|
+
Ct as default
|
|
193
190
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-TEfD-2ti.cjs"),r=require("./empty-slot-TF2kd-0X.cjs"),m=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:y,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.f({title:"Heading font",default:y,options:f}),bodyFont:r.f({title:"Body font",default:u,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.y({title:"Primary",default:q}),secondaryColor:r.y({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.y({title:"Body Background (Light)",default:O}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:b}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:S}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:h})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
|