@chaibuilder/sdk 1.2.16 → 1.2.17
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 +6 -4
- package/dist/{AddBlocks-TBFBvBvo.js → AddBlocks--SllKzEG.js} +81 -81
- package/dist/AddBlocks-7TF41ISQ.cjs +1 -0
- package/dist/{BrandingOptions-t_MjeHSM.js → BrandingOptions-IqtZrxqX.js} +14 -15
- package/dist/BrandingOptions-uKE1vuWd.cjs +1 -0
- package/dist/{CanvasArea-ZYC8QbQB.js → CanvasArea-T1XNnB7d.js} +89 -95
- package/dist/{CanvasArea-oTylYgH9.cjs → CanvasArea-iLUw-tom.cjs} +3 -3
- package/dist/{Class-17XFhL48.js → Class-3k8xjeiM.js} +1 -1
- package/dist/{Class-5ARpH_Tu.cjs → Class-MmCxz2Ay.cjs} +1 -1
- package/dist/CurrentPage-N5hSL1xB.cjs +1 -0
- package/dist/{CurrentPage-4vC6olJo.js → CurrentPage-TCduhO-X.js} +16 -16
- package/dist/MODIFIERS-9EwxLM8V.cjs +1 -0
- package/dist/{MODIFIERS-RiXS5Mn1.js → MODIFIERS-WQdaNvb8.js} +5 -4
- package/dist/{Layers-m61dThGR.js → Outline-3IPrK7F-.js} +153 -145
- package/dist/Outline-g4TXJ-hK.cjs +1 -0
- package/dist/{PagesPanel-v3KV_vfG.js → PagesPanel-7goyNL8t.js} +10 -10
- package/dist/PagesPanel-qI3sijis.cjs +1 -0
- package/dist/{ProjectPanel-xsUuVX64.js → ProjectPanel-CdPFwsXg.js} +8 -8
- package/dist/ProjectPanel-bMllQ4_a.cjs +1 -0
- package/dist/Settings-8f4ivm4-.cjs +1 -0
- package/dist/{Settings-ZNxfF14G.js → Settings-pva9XRUC.js} +293 -293
- package/dist/SidePanels-7HqZM4-j.cjs +1 -0
- package/dist/SidePanels-u5QXQrWL.js +389 -0
- package/dist/Topbar-S3zgo3N8.js +129 -0
- package/dist/Topbar-poeqjjZb.cjs +1 -0
- package/dist/{UnsplashImages-ppQXZ28F.js → UnsplashImages-132gZ842.js} +13 -13
- package/dist/{UnsplashImages-SrxA-yNu.cjs → UnsplashImages-BOypn-e5.cjs} +1 -1
- package/dist/UploadImages-giiNNHKq.cjs +1 -0
- package/dist/{UploadImages-IKR4oX2k.js → UploadImages-tr54Ik1I.js} +35 -31
- package/dist/{add-page-modal-pc5-Yw4C.js → add-page-modal-AsP5g0Fp.js} +13 -12
- package/dist/add-page-modal-ajpd-Gmw.cjs +1 -0
- package/dist/{confirm-alert-uV_PtYc3.cjs → confirm-alert-bw0VBgoG.cjs} +1 -1
- package/dist/{confirm-alert-QKtbNbWz.js → confirm-alert-dYoU1ln_.js} +5 -5
- package/dist/controls-Dy1qa8Dc.cjs +1 -0
- package/dist/{empty-slot-5FRrRq1E.js → controls-XPXGHKht.js} +50 -61
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +16 -1
- package/dist/core.js +47 -53
- package/dist/{defaultTheme-IH19g4fv.cjs → defaultTheme-1XwPZT2b.cjs} +1 -1
- package/dist/{defaultTheme-YY8mlQS3.js → defaultTheme-s0cpA5Oy.js} +1 -1
- package/dist/delete-page-modal-H4JOWYZe.cjs +1 -0
- package/dist/{delete-page-modal-Zf3-4wLg.js → delete-page-modal-_Hy6ls6b.js} +12 -12
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +11 -10
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +13 -0
- package/dist/email.js +7 -12
- package/dist/empty-slot-ZBlsQi6m.js +15 -0
- package/dist/empty-slot-nzYOgZuS.cjs +1 -0
- package/dist/{form-faX0Yn4Q.js → form-f13cs-An.js} +1 -1
- package/dist/{form-KkP1F7h1.cjs → form-jzX2YXUO.cjs} +1 -1
- package/dist/{html-to-json-57841sEK.js → html-to-json-C5sExaSD.js} +1 -1
- package/dist/{html-to-json-2PeOCVey.cjs → html-to-json-FGufPv9R.cjs} +1 -1
- package/dist/index-0JU8vPT_.cjs +206 -0
- package/dist/index-4xyhDki2.cjs +1 -0
- package/dist/index-MQH3blB-.cjs +1 -0
- package/dist/{index-QGA4ayU7.js → index-MaXiXghQ.js} +246 -246
- package/dist/index-YpnaudSM.js +63 -0
- package/dist/index-ecnGWzh9.cjs +1 -0
- package/dist/{index-rktN6W1Y.js → index-eyVVbA05.js} +22845 -25123
- package/dist/index-ugsWasKp.js +2202 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +5 -5
- package/dist/{page-viewer-Cv_WZY-t.js → page-viewer-P5Im9RfR.js} +11 -11
- package/dist/page-viewer-Xj9v8mji.cjs +1 -0
- package/dist/project-general-setting--5DT1RoW.cjs +1 -0
- package/dist/{project-general-setting-x6qqF0T8.js → project-general-setting-R3pVVXmY.js} +11 -10
- package/dist/project-seo-setting-3DzzF83_.cjs +1 -0
- package/dist/{project-seo-setting-Sl6AE-Q7.js → project-seo-setting-pGpm3-6U.js} +7 -7
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{single-page-detail-sGbwXXs1.js → single-page-detail-m-THVQnz.js} +43 -42
- package/dist/single-page-detail-nJzGUDym.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +13 -0
- package/dist/studio.js +7 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +50 -50
- package/dist/useAddBlockByDrop-6qaL4Ufz.cjs +1 -0
- package/dist/useAddBlockByDrop-vGme3brY.js +20 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +4 -3
- package/package.json +1 -1
- package/dist/AddBlocks-FUKuRbn6.cjs +0 -1
- package/dist/BrandingOptions-tBWzqas5.cjs +0 -1
- package/dist/CurrentPage-g8aT56B2.cjs +0 -1
- package/dist/Layers-fEb6biiU.cjs +0 -1
- package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
- package/dist/PagesPanel-ewHplHej.cjs +0 -1
- package/dist/ProjectPanel-pgpe3fyR.cjs +0 -1
- package/dist/Settings-zk2jUrHc.cjs +0 -1
- package/dist/SidePanels-MbJufIbe.js +0 -352
- package/dist/SidePanels-zXHw8T3P.cjs +0 -1
- package/dist/Topbar-iH2L4pe0.cjs +0 -1
- package/dist/Topbar-ryFhl-PC.js +0 -114
- package/dist/UploadImages-VBiO6lqp.cjs +0 -1
- package/dist/add-page-modal-myA0a2nW.cjs +0 -1
- package/dist/delete-page-modal-q4G_-zBl.cjs +0 -1
- package/dist/empty-slot-2LSrWJaY.cjs +0 -1
- package/dist/index-DT71IahS.cjs +0 -206
- package/dist/index-ERorPL9q.cjs +0 -1
- package/dist/page-viewer-z9Kn4i1K.cjs +0 -1
- package/dist/project-general-setting-ZiLidijs.cjs +0 -1
- package/dist/project-seo-setting-8oJUrOqk.cjs +0 -1
- package/dist/single-page-detail-cnwttu4D.cjs +0 -1
- package/dist/useAddBlockByDrop-LBgi6GL7.cjs +0 -1
- package/dist/useAddBlockByDrop-Y-g4O8UC.js +0 -20
package/README.md
CHANGED
|
@@ -36,20 +36,22 @@ Step 4: Add the builder to your page.
|
|
|
36
36
|
```tsx
|
|
37
37
|
import "./chaibuilder.tailwind.css";
|
|
38
38
|
import "@chaibuilder/sdk/styles";
|
|
39
|
-
import {ChaiBuilderEditor} from "@chaibuilder/sdk";
|
|
39
|
+
import { ChaiBuilderEditor } from "@chaibuilder/sdk";
|
|
40
|
+
import { loadWebBlocks } from "@chaibuilder/sdk/web-blocks";
|
|
41
|
+
loadWebBlocks();
|
|
40
42
|
|
|
41
43
|
const BuilderFullPage = () => {
|
|
42
44
|
return (
|
|
43
45
|
<ChaiBuilderEditor
|
|
44
46
|
blocks={[]}
|
|
45
|
-
onSavePage={async (blocks) =>
|
|
46
|
-
onSaveBrandingOptions={async (branding) =>
|
|
47
|
+
onSavePage={async (blocks) => { console.log(blocks); return true }}
|
|
48
|
+
onSaveBrandingOptions={async (branding) => { console.log(blocks); return true }}
|
|
47
49
|
/>
|
|
48
50
|
);
|
|
49
51
|
}
|
|
50
52
|
```
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
### Render the blocks on your page.
|
|
53
55
|
|
|
54
56
|
```tsx
|
|
55
57
|
export default () => {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import { has as
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import {
|
|
7
|
-
import { BoxIcon as
|
|
8
|
-
import { syncBlocksWithDefaults as H, useChaiBlocks as
|
|
9
|
-
import { useFeature as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import v, { createElement as M, useState as f, useCallback as z, useMemo as O, useEffect as q, Suspense as U } from "react";
|
|
3
|
+
import { has as L, first as h, omit as V, noop as K, isEmpty as g, filter as j, values as b, groupBy as k, mergeWith as R, isArray as _, keys as W, get as Y, map as w, uniq as J, includes as Q, find as X, reject as P } from "lodash-es";
|
|
4
|
+
import { useAtom as B } from "jotai";
|
|
5
|
+
import { useTranslation as I } from "react-i18next";
|
|
6
|
+
import { L as C, r as A, Y as Z, at as T, ap as $, aq as ee, ar as se, h as F, a3 as E, aj as re, ak as te, al as oe, am as ae, an as S, bh as le, bi as ie, bj as ce, bk as ne, aB as de, bl as me, bm as pe, B as ue, bn as xe, bo as he, bp as fe, au as ge, av as je, aw as N, bg as be, b9 as ve, ba as ye, bb as Be, bc as Ne, S as ke } from "./index-MaXiXghQ.js";
|
|
7
|
+
import { BoxIcon as we } from "@radix-ui/react-icons";
|
|
8
|
+
import { syncBlocksWithDefaults as H, useChaiBlocks as D } from "@chaibuilder/runtime";
|
|
9
|
+
import { useFeature as Ce } from "flagged";
|
|
10
|
+
import { O as y } from "./MODIFIERS-WQdaNvb8.js";
|
|
11
|
+
import { Loader as Ae } from "lucide-react";
|
|
12
|
+
import { useDrag as Te, DragPreviewImage as _e } from "react-dnd";
|
|
13
|
+
import { g as Pe } from "./html-to-json-C5sExaSD.js";
|
|
13
14
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
15
|
import "./Functions-7jnEwJyw.js";
|
|
15
16
|
import "clsx";
|
|
16
17
|
import "tailwind-merge";
|
|
17
18
|
import "flat-to-nested";
|
|
18
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
19
19
|
import "@react-hookz/web";
|
|
20
20
|
import "@radix-ui/react-toggle";
|
|
21
21
|
import "class-variance-authority";
|
|
22
|
-
import "./Class-
|
|
22
|
+
import "./Class-3k8xjeiM.js";
|
|
23
23
|
import "@radix-ui/react-switch";
|
|
24
24
|
import "@radix-ui/react-slot";
|
|
25
25
|
import "@radix-ui/react-accordion";
|
|
@@ -42,46 +42,46 @@ import "react-icons-picker";
|
|
|
42
42
|
import "react-dom";
|
|
43
43
|
import "react-quill";
|
|
44
44
|
import "himalaya";
|
|
45
|
-
const
|
|
46
|
-
const { type: o, icon: c, label:
|
|
47
|
-
|
|
48
|
-
}, t =
|
|
49
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
50
|
-
/* @__PURE__ */ e.jsx(
|
|
45
|
+
const Se = ({ block: s }) => {
|
|
46
|
+
const { type: o, icon: c, label: l } = s, { addCoreBlock: d, addPredefinedBlock: i } = C(), [n, r] = A(), [, x] = Z(), [, p] = B(T), a = () => {
|
|
47
|
+
L(s, "blocks") ? i(H(s.blocks), h(n)) : d(s, h(n)), p(y);
|
|
48
|
+
}, t = Ce("dnd");
|
|
49
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs($, { children: [
|
|
50
|
+
/* @__PURE__ */ e.jsx(ee, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
51
51
|
"button",
|
|
52
52
|
{
|
|
53
|
-
onClick:
|
|
53
|
+
onClick: a,
|
|
54
54
|
type: "button",
|
|
55
55
|
onDragStart: (u) => {
|
|
56
|
-
u.dataTransfer.setData("text/plain", JSON.stringify(
|
|
57
|
-
r([]), x(null), p(
|
|
56
|
+
u.dataTransfer.setData("text/plain", JSON.stringify(V(s, ["component", "icon"]))), setTimeout(() => {
|
|
57
|
+
r([]), x(null), p(y);
|
|
58
58
|
}, 200);
|
|
59
59
|
},
|
|
60
60
|
draggable: t ? "true" : "false",
|
|
61
61
|
className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (t ? "cursor-grab" : "cursor-pointer"),
|
|
62
62
|
children: [
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children:
|
|
63
|
+
M(c || we, { className: "w-4 h-4 mx-auto" }),
|
|
64
|
+
/* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || o })
|
|
65
65
|
]
|
|
66
66
|
}
|
|
67
67
|
) }),
|
|
68
|
-
/* @__PURE__ */ e.jsx(
|
|
68
|
+
/* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("p", { children: l || o }) })
|
|
69
69
|
] }) });
|
|
70
|
-
},
|
|
70
|
+
}, Le = ({ block: s, closePopover: o }) => {
|
|
71
71
|
var t;
|
|
72
|
-
const [c,
|
|
72
|
+
const [c, l] = f(!1), d = F("getExternalPredefinedBlock", K()), { addCoreBlock: i, addPredefinedBlock: n } = C(), [r] = A(), [, x, p] = Te(
|
|
73
73
|
() => ({
|
|
74
74
|
type: "CHAI_BLOCK",
|
|
75
75
|
item: s
|
|
76
76
|
}),
|
|
77
77
|
[s]
|
|
78
|
-
),
|
|
78
|
+
), a = z(
|
|
79
79
|
async (u) => {
|
|
80
|
-
if (u.stopPropagation(),
|
|
80
|
+
if (u.stopPropagation(), L(s, "component")) {
|
|
81
81
|
i(s, h(r)), o();
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
l(!0);
|
|
85
85
|
const m = await d(s);
|
|
86
86
|
g(m) || n(H(m), h(r)), o();
|
|
87
87
|
},
|
|
@@ -89,7 +89,7 @@ const _e = ({ block: s }) => {
|
|
|
89
89
|
);
|
|
90
90
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
91
91
|
/* @__PURE__ */ e.jsx(
|
|
92
|
-
|
|
92
|
+
_e,
|
|
93
93
|
{
|
|
94
94
|
connect: p,
|
|
95
95
|
src: "https://placehold.co/100x30/000000/FFF?text=" + ((t = s.name || s.label) == null ? void 0 : t.replace(" ", "+"))
|
|
@@ -100,11 +100,11 @@ const _e = ({ block: s }) => {
|
|
|
100
100
|
{
|
|
101
101
|
ref: x,
|
|
102
102
|
onClick: c ? () => {
|
|
103
|
-
} :
|
|
103
|
+
} : a,
|
|
104
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
105
|
children: [
|
|
106
106
|
c && /* @__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(
|
|
107
|
+
/* @__PURE__ */ e.jsx(Ae, { className: "animate-spin", size: 15, color: "white" }),
|
|
108
108
|
" ",
|
|
109
109
|
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
110
110
|
] }),
|
|
@@ -120,36 +120,36 @@ const _e = ({ block: s }) => {
|
|
|
120
120
|
}
|
|
121
121
|
)
|
|
122
122
|
] });
|
|
123
|
-
},
|
|
124
|
-
const { data: s } =
|
|
125
|
-
if (
|
|
126
|
-
return [...
|
|
127
|
-
}), [
|
|
128
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex
|
|
129
|
-
/* @__PURE__ */ e.jsx("div", { className: "
|
|
130
|
-
/* @__PURE__ */ e.jsx(
|
|
131
|
-
/* @__PURE__ */ e.jsxs(
|
|
132
|
-
/* @__PURE__ */ e.jsx(
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
}, Ie = () => {
|
|
124
|
+
const { data: s } = E(), o = D(), c = j(b(o), { category: "custom" }), l = k(c, "group"), d = k(s, "group"), i = O(() => R(l, d, (a, t) => {
|
|
125
|
+
if (_(a) && _(t))
|
|
126
|
+
return [...a, ...t];
|
|
127
|
+
}), [l, d]), [n, r] = f(h(W(i)) || ""), [, x] = B(T), p = Y(i, n, []);
|
|
128
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
|
|
129
|
+
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(re, { value: n, onValueChange: (a) => r(a), children: [
|
|
130
|
+
/* @__PURE__ */ e.jsx(te, { className: "w-full", children: /* @__PURE__ */ e.jsx(oe, { placeholder: "Select a provider" }) }),
|
|
131
|
+
/* @__PURE__ */ e.jsxs(ae, { children: [
|
|
132
|
+
/* @__PURE__ */ e.jsx(S, { value: "", children: "Choose" }),
|
|
133
|
+
v.Children.toArray(
|
|
134
|
+
w(i, (a, t) => /* @__PURE__ */ e.jsx(S, { value: t, children: t }, t))
|
|
135
135
|
)
|
|
136
136
|
] })
|
|
137
137
|
] }) }),
|
|
138
|
-
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children:
|
|
139
|
-
p.map((
|
|
138
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: v.Children.toArray(
|
|
139
|
+
p.map((a) => /* @__PURE__ */ e.jsx(Le, { block: a, closePopover: () => x(y) }))
|
|
140
140
|
) })
|
|
141
141
|
] });
|
|
142
|
-
},
|
|
143
|
-
const { t: s } =
|
|
144
|
-
const r =
|
|
145
|
-
|
|
142
|
+
}, Fe = () => {
|
|
143
|
+
const { t: s } = I(), [o, c] = f(""), { addPredefinedBlock: l } = C(), [d] = A(), [, i] = B(T), n = () => {
|
|
144
|
+
const r = Pe(o);
|
|
145
|
+
l([...r], h(d) || null), c(""), i(y);
|
|
146
146
|
};
|
|
147
|
-
return /* @__PURE__ */ e.jsxs(
|
|
148
|
-
/* @__PURE__ */ e.jsx(
|
|
149
|
-
/* @__PURE__ */ e.jsx(
|
|
150
|
-
/* @__PURE__ */ e.jsx(
|
|
147
|
+
return /* @__PURE__ */ e.jsxs(le, { className: "border-border/0 p-0 shadow-none", children: [
|
|
148
|
+
/* @__PURE__ */ e.jsx(ie, { className: "p-3", children: /* @__PURE__ */ e.jsx(ce, { children: s("html_snippet_description") }) }),
|
|
149
|
+
/* @__PURE__ */ e.jsx(ne, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
|
|
150
|
+
/* @__PURE__ */ e.jsx(de, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
|
|
151
151
|
/* @__PURE__ */ e.jsx(
|
|
152
|
-
|
|
152
|
+
me,
|
|
153
153
|
{
|
|
154
154
|
autoFocus: !0,
|
|
155
155
|
tabIndex: 1,
|
|
@@ -158,23 +158,23 @@ const _e = ({ block: s }) => {
|
|
|
158
158
|
rows: 12,
|
|
159
159
|
value: o,
|
|
160
160
|
placeholder: s("enter_code_snippet"),
|
|
161
|
-
className: "resize-none
|
|
161
|
+
className: "resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"
|
|
162
162
|
}
|
|
163
163
|
)
|
|
164
164
|
] }) }),
|
|
165
|
-
/* @__PURE__ */ e.jsxs(
|
|
166
|
-
/* @__PURE__ */ e.jsx(
|
|
167
|
-
/* @__PURE__ */ e.jsx(
|
|
165
|
+
/* @__PURE__ */ e.jsxs(pe, { className: "flex flex-col justify-end p-3", children: [
|
|
166
|
+
/* @__PURE__ */ e.jsx(ue, { disabled: o.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
|
|
167
|
+
/* @__PURE__ */ e.jsx(xe, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(he, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
|
|
168
168
|
] })
|
|
169
169
|
] });
|
|
170
|
-
},
|
|
171
|
-
const { t: s } =
|
|
172
|
-
j(i, () =>
|
|
170
|
+
}, Ee = () => !0, Cs = () => {
|
|
171
|
+
const { t: s } = I(), [o, c] = f("core"), [l, d] = f("basic"), i = D(), [, n] = B(fe), r = F("importHTMLSupport", !0), { data: x, isLoading: p } = E(), a = k(
|
|
172
|
+
j(i, () => Ee()),
|
|
173
173
|
"category"
|
|
174
|
-
), t =
|
|
174
|
+
), t = J(w(a.core, "group"));
|
|
175
175
|
q(() => {
|
|
176
|
-
!
|
|
177
|
-
}, [t,
|
|
176
|
+
!Q(t, l) && !g(t) && !g(l) && d(h(t));
|
|
177
|
+
}, [t, l]);
|
|
178
178
|
const u = !p && !g(x) || X(b(i), { category: "custom" }) !== void 0;
|
|
179
179
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
180
180
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
|
|
@@ -182,7 +182,7 @@ const _e = ({ block: s }) => {
|
|
|
182
182
|
/* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(o === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
|
|
183
183
|
] }),
|
|
184
184
|
/* @__PURE__ */ e.jsx(
|
|
185
|
-
|
|
185
|
+
ge,
|
|
186
186
|
{
|
|
187
187
|
onValueChange: (m) => {
|
|
188
188
|
n(""), c(m);
|
|
@@ -190,35 +190,35 @@ const _e = ({ block: s }) => {
|
|
|
190
190
|
value: o,
|
|
191
191
|
className: "h-max",
|
|
192
192
|
children: /* @__PURE__ */ e.jsxs(
|
|
193
|
-
|
|
193
|
+
je,
|
|
194
194
|
{
|
|
195
195
|
className: "grid w-full " + (u && r ? "grid-cols-3" : u && !r || !u && r ? "grid-cols-2" : "grid-cols-1"),
|
|
196
196
|
children: [
|
|
197
|
-
/* @__PURE__ */ e.jsx(
|
|
198
|
-
u ? /* @__PURE__ */ e.jsx(
|
|
199
|
-
r ? /* @__PURE__ */ e.jsx(
|
|
197
|
+
/* @__PURE__ */ e.jsx(N, { value: "core", children: s("Blocks") }),
|
|
198
|
+
u ? /* @__PURE__ */ e.jsx(N, { value: "ui-blocks", children: s("ui_library") }) : null,
|
|
199
|
+
r ? /* @__PURE__ */ e.jsx(N, { value: "html", children: s("import") }) : null
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
203
|
}
|
|
204
204
|
),
|
|
205
|
-
o === "core" && /* @__PURE__ */ e.jsx(
|
|
206
|
-
|
|
205
|
+
o === "core" && /* @__PURE__ */ e.jsx(be, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: v.Children.toArray(
|
|
206
|
+
w(
|
|
207
207
|
t,
|
|
208
|
-
(m) =>
|
|
208
|
+
(m) => P(j(b(a.core), { group: m }), {
|
|
209
209
|
hidden: !0
|
|
210
|
-
}).length ? /* @__PURE__ */ e.jsx(
|
|
211
|
-
/* @__PURE__ */ e.jsx(
|
|
212
|
-
/* @__PURE__ */ e.jsx(
|
|
213
|
-
|
|
210
|
+
}).length ? /* @__PURE__ */ e.jsx(ve, { type: "single", value: m, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(ye, { value: m, children: [
|
|
211
|
+
/* @__PURE__ */ e.jsx(Be, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: m }),
|
|
212
|
+
/* @__PURE__ */ e.jsx(Ne, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: v.Children.toArray(
|
|
213
|
+
P(j(b(a.core), { group: m }), { hidden: !0 }).map((G) => /* @__PURE__ */ e.jsx(Se, { block: G }))
|
|
214
214
|
) }) })
|
|
215
215
|
] }) }) : null
|
|
216
216
|
)
|
|
217
217
|
) }) }),
|
|
218
|
-
o === "ui-blocks" && /* @__PURE__ */ e.jsx(
|
|
219
|
-
o === "html" && r ? /* @__PURE__ */ e.jsx(
|
|
218
|
+
o === "ui-blocks" && /* @__PURE__ */ e.jsx(U, { fallback: /* @__PURE__ */ e.jsx(ke, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Ie, {}) }),
|
|
219
|
+
o === "html" && r ? /* @__PURE__ */ e.jsx(Fe, {}) : null
|
|
220
220
|
] });
|
|
221
221
|
};
|
|
222
222
|
export {
|
|
223
|
-
|
|
223
|
+
Cs as default
|
|
224
224
|
};
|
|
@@ -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"),E=require("jotai"),v=require("react-i18next"),s=require("./index-MQH3blB-.cjs"),B=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),q=require("flagged"),g=require("./MODIFIERS-9EwxLM8V.cjs"),k=require("lucide-react"),y=require("react-dnd"),N=require("./html-to-json-FGufPv9R.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("flat-to-nested");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.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 A=({block:r})=>{const{type:n,icon:d,label:a}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,j]=E.useAtom(s.activePanelAtom),l=()=>{t.has(r,"blocks")?u(R.syncBlocksWithDefaults(r.blocks),t.first(x)):m(r,t.first(x)),j(g.OUTLINE_KEY)},i=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:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),f(null),j(g.OUTLINE_KEY)},200)},draggable:i?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(i?"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||n})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||n})})]})})},C=({block:r,closePopover:n})=>{var i;const[d,a]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:u,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),l=c.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){u(r,t.first(o)),n();return}a(!0);const p=await m(r);t.isEmpty(p)||x(R.syncBlocksWithDefaults(p),t.first(o)),n()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:f,onClick:d?()=>{}:l,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(k.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})})]})]})},T=()=>{const{data:r}=s.useUILibraryBlocks(),n=R.useChaiBlocks(),d=t.filter(t.values(n),{category:"custom"}),a=t.groupBy(d,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(a,m,(l,i)=>{if(t.isArray(l)&&t.isArray(i))return[...l,...i]}),[a,m]),[x,o]=c.useState(t.first(t.keys(u))||""),[,f]=E.useAtom(s.activePanelAtom),j=t.get(u,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),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,(l,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(j.map(l=>e.jsxRuntimeExports.jsx(C,{block:l,closePopover:()=>f(g.OUTLINE_KEY)})))})]})},w=()=>{const{t:r}=v.useTranslation(),[n,d]=c.useState(""),{addPredefinedBlock:a}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=E.useAtom(s.activePanelAtom),x=()=>{const o=N.getBlocksFromHTML(n);a([...o],t.first(m)||null),d(""),u(g.OUTLINE_KEY)};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:o=>o&&o.focus(),onChange:o=>d(o.target.value),rows:12,value:n,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:n.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},S=()=>!0,I=()=>{const{t:r}=v.useTranslation(),[n,d]=c.useState("core"),[a,m]=c.useState("basic"),u=R.useChaiBlocks(),[,x]=E.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),{data:f,isLoading:j}=s.useUILibraryBlocks(),l=t.groupBy(t.filter(u,()=>S()),"category"),i=t.uniq(t.map(l.core,"group"));c.useEffect(()=>{!t.includes(i,a)&&!t.isEmpty(i)&&!t.isEmpty(a)&&m(t.first(i))},[i,a]);const h=!j&&!t.isEmpty(f)||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(n==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:p=>{x(""),d(p)},value:n,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(h&&o?"grid-cols-3":h&&!o||!h&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),h?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),n==="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(i,p=>t.reject(t.filter(t.values(l.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(l.core),{group:p}),{hidden:!0}).map(b=>e.jsxRuntimeExports.jsx(A,{block:b})))})})]})}):null))})}),n==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(T,{})}),n==="html"&&o?e.jsxRuntimeExports.jsx(w,{}):null]})};exports.default=I;
|
|
@@ -2,9 +2,9 @@ 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 {
|
|
6
|
-
import { f, c as R, y as a } from "./
|
|
7
|
-
import { debounce as w, isEqual as L } from "lodash-es";
|
|
5
|
+
import { h as k, F as D, bu as P } from "./index-MaXiXghQ.js";
|
|
6
|
+
import { f, c as R, y as a } from "./controls-XPXGHKht.js";
|
|
7
|
+
import { debounce as w, noop as F, isEqual as L } from "lodash-es";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "./Functions-7jnEwJyw.js";
|
|
10
10
|
import "clsx";
|
|
@@ -12,11 +12,11 @@ import "tailwind-merge";
|
|
|
12
12
|
import "@chaibuilder/runtime";
|
|
13
13
|
import "jotai";
|
|
14
14
|
import "flat-to-nested";
|
|
15
|
-
import "./MODIFIERS-
|
|
15
|
+
import "./MODIFIERS-WQdaNvb8.js";
|
|
16
16
|
import "@react-hookz/web";
|
|
17
17
|
import "@radix-ui/react-toggle";
|
|
18
18
|
import "class-variance-authority";
|
|
19
|
-
import "./Class-
|
|
19
|
+
import "./Class-3k8xjeiM.js";
|
|
20
20
|
import "@radix-ui/react-switch";
|
|
21
21
|
import "@radix-ui/react-slot";
|
|
22
22
|
import "@radix-ui/react-accordion";
|
|
@@ -40,7 +40,7 @@ import "react-icons-picker";
|
|
|
40
40
|
import "react-dom";
|
|
41
41
|
import "react-quill";
|
|
42
42
|
import "react-i18next";
|
|
43
|
-
const
|
|
43
|
+
const T = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
44
44
|
const i = w(e, 200), m = (l) => i(l.target.value);
|
|
45
45
|
return /* @__PURE__ */ t.jsx("div", { className: "mt-1.5 flex items-center gap-x-3", children: /* @__PURE__ */ t.jsx("div", { className: "flex w-3/5 flex-col", children: /* @__PURE__ */ t.jsx(
|
|
46
46
|
"input",
|
|
@@ -102,9 +102,8 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
102
102
|
{ title: "Lustria", value: "Lustria" },
|
|
103
103
|
{ title: "Ovo", value: "Ovo" },
|
|
104
104
|
{ title: "Suranna", value: "Suranna" }
|
|
105
|
-
],
|
|
106
|
-
const u = k("onSaveBrandingOptions",
|
|
107
|
-
}), [e, p] = D(), [d] = P(), i = c.useRef(e);
|
|
105
|
+
], St = () => {
|
|
106
|
+
const u = k("onSaveBrandingOptions", F), [e, p] = D(), [d] = P(), i = c.useRef(e);
|
|
108
107
|
c.useEffect(() => () => {
|
|
109
108
|
L(e, i.current) || u(i.current);
|
|
110
109
|
}, []);
|
|
@@ -113,8 +112,8 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
113
112
|
}, {
|
|
114
113
|
bodyFont: l,
|
|
115
114
|
headingFont: h,
|
|
116
|
-
primaryColor:
|
|
117
|
-
bodyTextDarkColor:
|
|
115
|
+
primaryColor: x,
|
|
116
|
+
bodyTextDarkColor: y,
|
|
118
117
|
bodyTextLightColor: b,
|
|
119
118
|
bodyBgDarkColor: C,
|
|
120
119
|
secondaryColor: S,
|
|
@@ -136,7 +135,7 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
136
135
|
title: "Rounded Corner",
|
|
137
136
|
default: parseInt(O || 5, 10)
|
|
138
137
|
}),
|
|
139
|
-
primaryColor: a({ title: "Primary", default:
|
|
138
|
+
primaryColor: a({ title: "Primary", default: x }),
|
|
140
139
|
secondaryColor: a({ title: "Secondary", default: S })
|
|
141
140
|
};
|
|
142
141
|
d || (r = {
|
|
@@ -147,7 +146,7 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
147
146
|
}),
|
|
148
147
|
bodyTextLightColor: a({
|
|
149
148
|
title: "Body Text (Light)",
|
|
150
|
-
default:
|
|
149
|
+
default: y
|
|
151
150
|
}),
|
|
152
151
|
bodyBgDarkColor: a({
|
|
153
152
|
title: "Body Background (Dark)",
|
|
@@ -170,7 +169,7 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
170
169
|
/* @__PURE__ */ t.jsx("div", { className: "-mx-2", children: /* @__PURE__ */ t.jsx(
|
|
171
170
|
j,
|
|
172
171
|
{
|
|
173
|
-
widgets: { color:
|
|
172
|
+
widgets: { color: T },
|
|
174
173
|
idSeparator: ".",
|
|
175
174
|
autoComplete: "off",
|
|
176
175
|
omitExtraData: !0,
|
|
@@ -186,5 +185,5 @@ const F = ({ value: u, onChange: e, id: p, onBlur: d }) => {
|
|
|
186
185
|
] });
|
|
187
186
|
};
|
|
188
187
|
export {
|
|
189
|
-
|
|
188
|
+
St as default
|
|
190
189
|
};
|
|
@@ -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-MQH3blB-.cjs"),r=require("./controls-Dy1qa8Dc.cjs"),g=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-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.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 f=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=g.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})})})},m=[{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",g.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=f.useRef(e);f.useEffect(()=>()=>{g.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:m}),bodyFont:r.f({title:"Body font",default:u,options:m}),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:{}},x={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,x[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:x,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
|