@chaibuilder/sdk 1.2.9 → 1.2.11
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-TSt8uJY4.js +218 -0
- package/dist/AddBlocks-k2p8Hy1n.cjs +1 -0
- package/dist/BrandingOptions-WyVWfFVz.cjs +1 -0
- package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-uFTyYJZj.js} +18 -22
- package/dist/CanvasArea-5erOZYLy.cjs +60 -0
- package/dist/{CanvasArea-mlNKmCOh.js → CanvasArea-iRQqpOak.js} +465 -481
- package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
- package/dist/Class-5ARpH_Tu.cjs +1 -0
- package/dist/CurrentPage-NzmJloN7.cjs +1 -0
- package/dist/{CurrentPage-lBy25sZn.js → CurrentPage-RCxTz9Mc.js} +24 -26
- package/dist/{Layers-3Xs4A5i8.js → Layers-tXB5Pwid.js} +124 -158
- package/dist/Layers-xDG7oltg.cjs +1 -0
- package/dist/PagesPanel-72nzYB1k.cjs +1 -0
- package/dist/{PagesPanel--BZhafnt.js → PagesPanel-Jaz9jvye.js} +14 -16
- package/dist/{ProjectPanel-YcLkM-DW.js → ProjectPanel--S014Xx3.js} +22 -24
- package/dist/ProjectPanel-RU0QvH6e.cjs +1 -0
- package/dist/Settings-5EuwaVb3.cjs +1 -0
- package/dist/{Settings-TAgX4hov.js → Settings-gjvl5V1k.js} +556 -579
- package/dist/{SidePanels-btVQQkVK.js → SidePanels-Fq3kRwR0.js} +54 -51
- package/dist/SidePanels-uNCxnGte.cjs +1 -0
- package/dist/Topbar-JqW89xI5.cjs +1 -0
- package/dist/{Topbar-j4t4AgCq.js → Topbar-m5dbbI1f.js} +15 -17
- package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-GhBD6owT.js} +24 -26
- package/dist/UnsplashImages-vACw5hbK.cjs +1 -0
- package/dist/UploadImages-PzHdEKHT.cjs +1 -0
- package/dist/{UploadImages-xBg-kbKv.js → UploadImages-S1HgxeGb.js} +23 -25
- package/dist/{add-page-modal-cm8damU2.js → add-page-modal-2P5hGXOQ.js} +15 -17
- package/dist/add-page-modal-GAizM2Jw.cjs +1 -0
- package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-57Xq5foA.js} +12 -14
- package/dist/confirm-alert-Uf84DpdR.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +13 -58
- package/dist/core.js +47 -58
- package/dist/defaultTheme-IH19g4fv.cjs +1 -0
- package/dist/defaultTheme-YY8mlQS3.js +1055 -0
- package/dist/delete-page-modal-MG42FdnU.cjs +1 -0
- package/dist/{delete-page-modal-YrIBvfFA.js → delete-page-modal-ix5IjaFW.js} +27 -29
- 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-VbouZlAW.cjs → form-KBb3kA8g.cjs} +1 -1
- package/dist/{form-OVmsLOrc.js → form-SYcFyACJ.js} +18 -18
- package/dist/{index-pZhGT8uT.js → index-Fj3ead-J.js} +4886 -4884
- package/dist/index-aiHDvS5v.cjs +1 -0
- package/dist/{index-N50dZnlC.cjs → index-cM3eKmlx.cjs} +25 -25
- package/dist/index-pNYv0oAF.js +2994 -0
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +95 -1125
- package/dist/page-viewer-Sh99FGYk.cjs +1 -0
- package/dist/{page-viewer-feqJr1QI.js → page-viewer-VxqOevr4.js} +15 -17
- package/dist/project-general-setting-VTLHa-Ik.cjs +1 -0
- package/dist/{project-general-setting-SgagORzW.js → project-general-setting-nWOjPiin.js} +15 -17
- package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-70bWTwsB.js} +17 -19
- package/dist/project-seo-setting-ENAKc2Dl.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +111 -70
- package/dist/{single-page-detail-dnWMyg6P.js → single-page-detail-3z7TF-Yy.js} +44 -46
- package/dist/single-page-detail-6L38HJC4.cjs +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +13 -15
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +149 -151
- package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-7mUMwNSG.cjs} +1 -1
- package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-tjQ5DgiO.js} +1 -1
- package/dist/web-blocks.cjs +1 -9
- package/dist/web-blocks.js +431 -442
- package/package.json +8 -2
- package/dist/AddBlocks-tMxKPoen.js +0 -225
- package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
- package/dist/CanvasArea-xs4wM64L.cjs +0 -60
- package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
- package/dist/Layers-eaHy5PK9.cjs +0 -1
- package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
- package/dist/PagesPanel-gGKCV394.cjs +0 -1
- package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
- package/dist/Settings-7wlLcvoh.cjs +0 -1
- package/dist/SidePanels-5H4j0mIs.cjs +0 -1
- package/dist/Topbar-V8xCetWF.cjs +0 -1
- package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
- package/dist/UploadImages-DnQ95_NW.cjs +0 -1
- package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
- package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/index-H6vIwGfD.cjs +0 -1
- package/dist/index-niHREMmR.js +0 -2938
- package/dist/page-viewer-SLt8XgYv.cjs +0 -1
- package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
- package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
- package/dist/single-page-detail-IPod1o5P.cjs +0 -1
- package/dist/utils-PTxFk6qT.cjs +0 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { PlusIcon as V, Half2Icon as
|
|
3
|
-
import h, { useState as x, useEffect as
|
|
2
|
+
import { PlusIcon as V, Half2Icon as M } from "@radix-ui/react-icons";
|
|
3
|
+
import h, { useState as x, useEffect as H, useMemo as I, lazy as y, Suspense as j } from "react";
|
|
4
4
|
import { useAtom as z } from "jotai";
|
|
5
|
-
import { filter as g, map as
|
|
6
|
-
import {
|
|
5
|
+
import { filter as g, map as _, isNull as L, find as F, isEmpty as R, each as J, get as O } from "lodash-es";
|
|
6
|
+
import { ac as q, ad as U, ae as $, af as G, ag as Z, A as Q, z as W, C as X, D as Y, E as ee, F as se, G as re, H as ae, ah as le, o as te, q as ie, ai as oe, aj as ne, ak as ce, al as de, am as P, i as k, an as me, B as b, S, ao as xe, ap as pe, aq as T, ar as E } from "./index-pNYv0oAF.js";
|
|
7
7
|
import { ListTreeIcon as C, DatabaseIcon as ue } from "lucide-react";
|
|
8
8
|
import { getChaiDataProviders as he } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as A } from "react-i18next";
|
|
10
10
|
import { J as fe, a as ve, d as je } from "./index-e0c8PmRQ.js";
|
|
11
|
-
import { E as ge } from "./index-
|
|
11
|
+
import { E as ge } from "./index-Fj3ead-J.js";
|
|
12
12
|
import { c as be } from "./Functions-7jnEwJyw.js";
|
|
13
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
+
import "flat-to-nested";
|
|
15
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
16
|
+
import "@react-hookz/web";
|
|
14
17
|
import "@radix-ui/react-toggle";
|
|
15
18
|
import "class-variance-authority";
|
|
16
|
-
import "./
|
|
17
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
18
20
|
import "clsx";
|
|
19
21
|
import "tailwind-merge";
|
|
20
22
|
import "@radix-ui/react-switch";
|
|
@@ -38,10 +40,6 @@ import "@radix-ui/react-context-menu";
|
|
|
38
40
|
import "react-icons-picker";
|
|
39
41
|
import "react-dom";
|
|
40
42
|
import "react-quill";
|
|
41
|
-
import "flat-to-nested";
|
|
42
|
-
import "redux-undo";
|
|
43
|
-
import "lodash";
|
|
44
|
-
import "@react-hookz/web";
|
|
45
43
|
import "i18next";
|
|
46
44
|
import "@floating-ui/react-dom";
|
|
47
45
|
import "react-textarea-autosize";
|
|
@@ -53,13 +51,13 @@ import "sonner";
|
|
|
53
51
|
import "./html-to-json-57841sEK.js";
|
|
54
52
|
import "himalaya";
|
|
55
53
|
import "./web-blocks.js";
|
|
56
|
-
import "./
|
|
57
|
-
const ye = ({ provider: r, onClose:
|
|
58
|
-
const { t: a } = A(), [
|
|
59
|
-
return
|
|
54
|
+
import "./empty-slot-MWycClTb.js";
|
|
55
|
+
const ye = ({ provider: r, onClose: i }) => {
|
|
56
|
+
const { t: a } = A(), [t, p] = x(null);
|
|
57
|
+
return H(() => {
|
|
60
58
|
r && (r.mockFn ? r.mockFn : r.dataFn)().then((o) => p(o));
|
|
61
|
-
}, [r]), r ? /* @__PURE__ */ e.jsx(
|
|
62
|
-
/* @__PURE__ */ e.jsxs(
|
|
59
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(q, { onOpenChange: (n) => n ? "" : i(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(U, { children: [
|
|
60
|
+
/* @__PURE__ */ e.jsxs($, { children: [
|
|
63
61
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
64
62
|
a("data_provider"),
|
|
65
63
|
": ",
|
|
@@ -70,7 +68,7 @@ const ye = ({ provider: r, onClose: l }) => {
|
|
|
70
68
|
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(
|
|
71
69
|
fe,
|
|
72
70
|
{
|
|
73
|
-
data:
|
|
71
|
+
data: t,
|
|
74
72
|
shouldExpandNode: ve,
|
|
75
73
|
style: {
|
|
76
74
|
...je,
|
|
@@ -84,48 +82,53 @@ const ye = ({ provider: r, onClose: l }) => {
|
|
|
84
82
|
};
|
|
85
83
|
function we({
|
|
86
84
|
children: r,
|
|
87
|
-
name:
|
|
85
|
+
name: i,
|
|
88
86
|
onRemove: a
|
|
89
87
|
}) {
|
|
90
|
-
const { t
|
|
88
|
+
const { t } = A();
|
|
91
89
|
return /* @__PURE__ */ e.jsxs(Q, { children: [
|
|
92
90
|
/* @__PURE__ */ e.jsx(W, { asChild: !0, children: r }),
|
|
93
91
|
/* @__PURE__ */ e.jsxs(X, { children: [
|
|
94
92
|
/* @__PURE__ */ e.jsxs(Y, { children: [
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
96
|
-
|
|
93
|
+
/* @__PURE__ */ e.jsx(
|
|
94
|
+
ee,
|
|
95
|
+
{
|
|
96
|
+
dangerouslySetInnerHTML: { __html: t("remove_provider_confirmation").replace("{name}", i) }
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ e.jsx(se, { children: t("remove_provider_warning") })
|
|
97
100
|
] }),
|
|
98
101
|
/* @__PURE__ */ e.jsxs(re, { children: [
|
|
99
|
-
/* @__PURE__ */ e.jsx(ae, { children:
|
|
100
|
-
/* @__PURE__ */ e.jsx(
|
|
102
|
+
/* @__PURE__ */ e.jsx(ae, { children: t("cancel") }),
|
|
103
|
+
/* @__PURE__ */ e.jsx(le, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: t("remove") })
|
|
101
104
|
] })
|
|
102
105
|
] })
|
|
103
106
|
] });
|
|
104
107
|
}
|
|
105
108
|
const Ne = () => {
|
|
106
|
-
const { t: r } = A(),
|
|
107
|
-
g(
|
|
109
|
+
const { t: r } = A(), i = I(() => he(), []), [a, t] = te(), [, p] = z(ie), [n, o] = x(
|
|
110
|
+
g(i, (s) => _(a, "providerKey").includes(s.providerKey))
|
|
108
111
|
), [w, f] = x(""), [c, v] = x(null), N = g(
|
|
109
|
-
|
|
110
|
-
(s) => !
|
|
111
|
-
),
|
|
112
|
-
const m =
|
|
113
|
-
o((d) => [...d, m]),
|
|
112
|
+
i.map((s) => _(n, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
113
|
+
(s) => !L(s)
|
|
114
|
+
), l = (s) => {
|
|
115
|
+
const m = F(i, { providerKey: s });
|
|
116
|
+
o((d) => [...d, m]), t((d) => [...d, { providerKey: m.providerKey, args: {} }]), f(""), p("UNSAVED");
|
|
114
117
|
}, u = (s) => {
|
|
115
|
-
o((m) => g(m, (d) => d.providerKey !== s.providerKey)),
|
|
118
|
+
o((m) => g(m, (d) => d.providerKey !== s.providerKey)), t((m) => g(m, (d) => d.providerKey !== s.providerKey)), p("UNSAVED");
|
|
116
119
|
}, B = (s) => v(s);
|
|
117
|
-
return
|
|
120
|
+
return R(i) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
118
121
|
r("no_data_providers"),
|
|
119
122
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
120
123
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: r("learn_more") })
|
|
121
124
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
122
125
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
123
126
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: r("add_data_providers") }) }),
|
|
124
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) =>
|
|
127
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) => l(s), children: [
|
|
125
128
|
/* @__PURE__ */ e.jsx(ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: r("select_provider") }) }),
|
|
126
129
|
/* @__PURE__ */ e.jsxs(de, { children: [
|
|
127
|
-
/* @__PURE__ */ e.jsx(
|
|
128
|
-
N.map((s) => /* @__PURE__ */ e.jsx(
|
|
130
|
+
/* @__PURE__ */ e.jsx(P, { value: "", children: r("choose") }),
|
|
131
|
+
N.map((s) => /* @__PURE__ */ e.jsx(P, { value: s.value, children: s.label }, s.value))
|
|
129
132
|
] })
|
|
130
133
|
] }) }),
|
|
131
134
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -205,26 +208,26 @@ const Ne = () => {
|
|
|
205
208
|
/* @__PURE__ */ e.jsx(ye, { onClose: () => v(null), provider: c })
|
|
206
209
|
] })
|
|
207
210
|
] });
|
|
208
|
-
}, ke = y(() => import("./AddBlocks-
|
|
211
|
+
}, ke = y(() => import("./AddBlocks-TSt8uJY4.js")), D = y(() => import("./Layers-tXB5Pwid.js")), Ce = y(() => import("./BrandingOptions-uFTyYJZj.js")), De = y(() => import("./index-pNYv0oAF.js").then((r) => r.cp));
|
|
209
212
|
let K = null;
|
|
210
|
-
const
|
|
211
|
-
const r = k("sideBarComponents.top", []),
|
|
213
|
+
const As = () => {
|
|
214
|
+
const r = k("sideBarComponents.top", []), i = k("sideBarComponents.bottom", []), [a, t] = z(me), [p, n] = x(a), [o, w] = x(null), f = {
|
|
212
215
|
"add-blocks": ke,
|
|
213
216
|
layers: D,
|
|
214
217
|
"branding-options": Ce,
|
|
215
218
|
images: De
|
|
216
219
|
};
|
|
217
|
-
|
|
218
|
-
f[
|
|
220
|
+
J(r, ({ name: l, panel: u }) => {
|
|
221
|
+
f[l] = u;
|
|
219
222
|
});
|
|
220
|
-
const c = (
|
|
221
|
-
clearTimeout(K), a !== "layers" &&
|
|
223
|
+
const c = (l) => {
|
|
224
|
+
clearTimeout(K), a !== "layers" && l === "layers" ? K = setTimeout(() => t("layers"), 500) : n(l), t(l);
|
|
222
225
|
}, v = k("dataBindingSupport", !1);
|
|
223
226
|
function N() {
|
|
224
|
-
const
|
|
227
|
+
const l = setTimeout(() => {
|
|
225
228
|
o && (c("layers"), clearTimeout(o));
|
|
226
229
|
}, 500);
|
|
227
|
-
w(
|
|
230
|
+
w(l);
|
|
228
231
|
}
|
|
229
232
|
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
230
233
|
a !== "layers" ? /* @__PURE__ */ e.jsx(
|
|
@@ -263,24 +266,24 @@ const Ss = () => {
|
|
|
263
266
|
onClick: () => c("branding-options"),
|
|
264
267
|
size: "sm",
|
|
265
268
|
variant: a === "branding-options" ? "default" : "outline",
|
|
266
|
-
children: /* @__PURE__ */ e.jsx(
|
|
269
|
+
children: /* @__PURE__ */ e.jsx(M, { className: "w-4 max-w-[40px] text-xs" })
|
|
267
270
|
}
|
|
268
271
|
),
|
|
269
272
|
h.Children.toArray(
|
|
270
|
-
r.map(({ name:
|
|
273
|
+
r.map(({ name: l, icon: u }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(S, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
271
274
|
b,
|
|
272
275
|
{
|
|
273
|
-
onClick: () => c(
|
|
276
|
+
onClick: () => c(l),
|
|
274
277
|
size: "sm",
|
|
275
278
|
className: "w-10",
|
|
276
|
-
variant: a ===
|
|
279
|
+
variant: a === l ? "default" : "outline",
|
|
277
280
|
children: /* @__PURE__ */ e.jsx(u, {})
|
|
278
281
|
}
|
|
279
282
|
) }))
|
|
280
283
|
)
|
|
281
284
|
] }),
|
|
282
285
|
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: h.Children.toArray(
|
|
283
|
-
|
|
286
|
+
i.map((l) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(S, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(l, {}) }))
|
|
284
287
|
) })
|
|
285
288
|
] }),
|
|
286
289
|
/* @__PURE__ */ e.jsx(
|
|
@@ -345,5 +348,5 @@ const Ss = () => {
|
|
|
345
348
|
] });
|
|
346
349
|
};
|
|
347
350
|
export {
|
|
348
|
-
|
|
351
|
+
As as default
|
|
349
352
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),w=require("@radix-ui/react-icons"),i=require("react"),k=require("jotai"),a=require("lodash-es"),s=require("./index-aiHDvS5v.cjs"),g=require("lucide-react"),C=require("@chaibuilder/runtime"),q=require("react-i18next"),b=require("./index-gi1LIOCw.cjs"),P=require("./index-cM3eKmlx.cjs"),T=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");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("clsx");require("tailwind-merge");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("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("./web-blocks.cjs");require("./empty-slot-TF2kd-0X.cjs");const D=({provider:t,onClose:x})=>{const{t:n}=q.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(u=>p(u))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:c=>c?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[n("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(P.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(b.JsonView,{data:l,shouldExpandNode:b.allExpanded,style:{...b.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function A({children:t,name:x,onRemove:n}){const{t:l}=q.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:n,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const _=()=>{const{t}=q.useTranslation(),x=i.useMemo(()=>C.getChaiDataProviders(),[]),[n,l]=s.usePageDataProviders(),[,p]=k.useAtom(s.pageSyncStateAtom),[c,u]=i.useState(a.filter(x,r=>a.map(n,"providerKey").includes(r.providerKey))),[E,v]=i.useState(""),[d,f]=i.useState(null),R=a.filter(x.map(r=>a.map(c,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!a.isNull(r)),o=r=>{const j=a.find(x,{providerKey:r});u(m=>[...m,j]),l(m=>[...m,{providerKey:j.providerKey,args:{}}]),v(""),p("UNSAVED")},h=r=>{u(j=>a.filter(j,m=>m.providerKey!==r.providerKey)),l(j=>a.filter(j,m=>m.providerKey!==r.providerKey)),p("UNSAVED")},S=r=>f(r);return a.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:E,onValueChange:r=>o(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),R.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${c.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:c.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>S(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(A,{onRemove:()=>h(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(D,{onClose:()=>f(null),provider:d})]})]})},B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-k2p8Hy1n.cjs"))),y=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-xDG7oltg.cjs"))),z=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-WyVWfFVz.cjs"))),I=i.lazy(()=>Promise.resolve().then(()=>require("./index-aiHDvS5v.cjs")).then(t=>t.ImagesPanel));let N=null;const K=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[n,l]=k.useAtom(s.activePanelAtom),[p,c]=i.useState(n),[u,E]=i.useState(null),v={"add-blocks":B,layers:y,"branding-options":z,images:I};a.each(t,({name:o,panel:h})=>{v[o]=h});const d=o=>{clearTimeout(N),n!=="layers"&&o==="layers"?N=setTimeout(()=>l("layers"),500):c(o),l(o)},f=s.useBuilderProp("dataBindingSupport",!1);function R(){const o=setTimeout(()=>{u&&(d("layers"),clearTimeout(u))},500);E(o)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[n!=="layers"?e.jsxRuntimeExports.jsx("div",{onMouseEnter:R,onClick:()=>d("layers"),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{d("add-blocks")},size:"sm",variant:n==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("layers"),size:"sm",variant:n==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(g.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("branding-options"),size:"sm",variant:n==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(w.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:o,icon:h})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(o),size:"sm",className:"w-10",variant:n===o?"default":"outline",children:e.jsxRuntimeExports.jsx(h,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:i.Children.toArray(x.map(o=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(o,{})})))})]}),e.jsxRuntimeExports.jsx("div",{className:`absolute left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${n!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:T.cn("relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",n==="layers"?"":"z-[100]"),onMouseEnter:()=>{u&&clearTimeout(u)},children:i.createElement(a.get(v,n,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:f?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:"layers",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"layers",children:[e.jsxRuntimeExports.jsx(g.ListTreeIcon,{className:"mr-2 h-3"})," Layers"]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(g.DatabaseIcon,{className:"mr-2 w-3"}),"Data"]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"layers",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(y)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(_,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md bg-gray-200 py-1",children:[e.jsxRuntimeExports.jsx(g.ListTreeIcon,{className:"ml-2 mr-2 h-4"})," Layers"]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(y)})]})})})]})};exports.default=K;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),l=require("@radix-ui/react-icons"),r=require("./index-aiHDvS5v.cjs"),a=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");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-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");const o=()=>r.useBuilderProp("languages",["en"]),c=()=>o().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Select,{children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(l.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(r.SelectContent,{children:e.jsxRuntimeExports.jsxs(r.SelectGroup,{children:[e.jsxRuntimeExports.jsx(r.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),p=()=>{const{savePage:i,syncState:s}=r.useSavePage(),{t:x}=a.useTranslation(),u=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[s]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i()},className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${u}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),s==="SAVING"?"Saving...":s==="SAVED"?x("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:s==="SAVING"?"Saving...":s==="SAVED"?"Saved":"Save changes"})})]})})},m=()=>{const i=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),x=r.useBuilderProp("topBarComponents.right",[]),u=r.useBuilderProp("editable",!0);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:n.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(c,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(p,{}):null,n.Children.toArray(x.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=m;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import o, { useMemo as m, Suspense as c } from "react";
|
|
3
3
|
import { FontFamilyIcon as x } from "@radix-ui/react-icons";
|
|
4
|
-
import { i as a,
|
|
4
|
+
import { i as a, ai as d, aj as h, ak as u, al as j, as as g, at as v, am as r, a8 as f, au as S, av as b, B as N, aw as w, S as p, ax as C } from "./index-pNYv0oAF.js";
|
|
5
5
|
import { useTranslation as y } from "react-i18next";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
-
import "@radix-ui/react-toggle";
|
|
8
|
-
import "class-variance-authority";
|
|
9
|
-
import "./utils-AvyFzbPC.js";
|
|
10
7
|
import "lodash-es";
|
|
11
|
-
import "./
|
|
8
|
+
import "./Functions-7jnEwJyw.js";
|
|
12
9
|
import "clsx";
|
|
13
10
|
import "tailwind-merge";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
|
+
import "jotai";
|
|
13
|
+
import "flat-to-nested";
|
|
14
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
15
|
+
import "@react-hookz/web";
|
|
16
|
+
import "@radix-ui/react-toggle";
|
|
17
|
+
import "class-variance-authority";
|
|
18
|
+
import "./Class-17XFhL48.js";
|
|
14
19
|
import "@radix-ui/react-switch";
|
|
15
20
|
import "@radix-ui/react-slot";
|
|
16
21
|
import "@radix-ui/react-accordion";
|
|
@@ -32,13 +37,6 @@ import "@radix-ui/react-context-menu";
|
|
|
32
37
|
import "react-icons-picker";
|
|
33
38
|
import "react-dom";
|
|
34
39
|
import "react-quill";
|
|
35
|
-
import "jotai";
|
|
36
|
-
import "flat-to-nested";
|
|
37
|
-
import "./Functions-7jnEwJyw.js";
|
|
38
|
-
import "redux-undo";
|
|
39
|
-
import "@chaibuilder/runtime";
|
|
40
|
-
import "lodash";
|
|
41
|
-
import "@react-hookz/web";
|
|
42
40
|
const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
43
41
|
/* @__PURE__ */ e.jsx(h, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
44
42
|
u,
|
|
@@ -49,7 +47,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
49
47
|
] })
|
|
50
48
|
}
|
|
51
49
|
) }),
|
|
52
|
-
/* @__PURE__ */ e.jsx(
|
|
50
|
+
/* @__PURE__ */ e.jsx(j, { children: /* @__PURE__ */ e.jsxs(g, { children: [
|
|
53
51
|
/* @__PURE__ */ e.jsx(v, { children: "Fruits" }),
|
|
54
52
|
/* @__PURE__ */ e.jsx(r, { value: "apple", children: "Apple" }),
|
|
55
53
|
/* @__PURE__ */ e.jsx(r, { value: "banana", children: "Banana" }),
|
|
@@ -90,9 +88,9 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
90
88
|
]
|
|
91
89
|
}
|
|
92
90
|
) }),
|
|
93
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(w, { children: /* @__PURE__ */ e.jsx("p", { children: t === "SAVING" ? "Saving..." : t === "SAVED" ? "Saved" : "Save changes" }) })
|
|
94
92
|
] }) });
|
|
95
|
-
},
|
|
93
|
+
}, he = () => {
|
|
96
94
|
const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []), l = a("topBarComponents.right", []), n = a("editable", !0);
|
|
97
95
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
98
96
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 font-bold", children: o.Children.toArray(
|
|
@@ -103,7 +101,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
103
101
|
) }),
|
|
104
102
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
105
103
|
/* @__PURE__ */ e.jsx(B, {}),
|
|
106
|
-
/* @__PURE__ */ e.jsx(
|
|
104
|
+
/* @__PURE__ */ e.jsx(C, { orientation: "vertical" }),
|
|
107
105
|
n ? /* @__PURE__ */ e.jsx(T, {}) : null,
|
|
108
106
|
o.Children.toArray(
|
|
109
107
|
l.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
@@ -112,5 +110,5 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
112
110
|
] });
|
|
113
111
|
};
|
|
114
112
|
export {
|
|
115
|
-
|
|
113
|
+
he as default
|
|
116
114
|
};
|
|
@@ -2,17 +2,21 @@ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import { useState as p, useEffect as D } from "react";
|
|
3
3
|
import { isEmpty as d, startCase as E } from "lodash-es";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
|
-
import { createApi as
|
|
6
|
-
import { i as
|
|
7
|
-
import { useDebouncedState as
|
|
8
|
-
import { Loader as
|
|
5
|
+
import { createApi as U } from "unsplash-js";
|
|
6
|
+
import { i as B, bb as F, aS as K, aT as V, aU as O, ai as P, aj as S, ak as C, al as k, am as h, be as Q, B as H } from "./index-pNYv0oAF.js";
|
|
7
|
+
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
|
+
import { Loader as $ } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
import "
|
|
11
|
-
import "class-variance-authority";
|
|
12
|
-
import "./utils-AvyFzbPC.js";
|
|
13
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
10
|
+
import "./Functions-7jnEwJyw.js";
|
|
14
11
|
import "clsx";
|
|
15
12
|
import "tailwind-merge";
|
|
13
|
+
import "@chaibuilder/runtime";
|
|
14
|
+
import "jotai";
|
|
15
|
+
import "flat-to-nested";
|
|
16
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
16
20
|
import "@radix-ui/react-switch";
|
|
17
21
|
import "@radix-ui/react-slot";
|
|
18
22
|
import "@radix-ui/react-accordion";
|
|
@@ -34,19 +38,13 @@ import "@radix-ui/react-context-menu";
|
|
|
34
38
|
import "react-icons-picker";
|
|
35
39
|
import "react-dom";
|
|
36
40
|
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 "lodash";
|
|
43
41
|
import "react-i18next";
|
|
44
42
|
const I = async (x, g) => new Promise((o, r) => {
|
|
45
|
-
|
|
43
|
+
U({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
46
44
|
o(i);
|
|
47
45
|
}).catch((i) => r(i));
|
|
48
|
-
}),
|
|
49
|
-
const o =
|
|
46
|
+
}), De = ({ isModalView: x, onSelect: g }) => {
|
|
47
|
+
const o = B("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [T, y] = p(0), [u, z] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
50
48
|
if (d(u))
|
|
51
49
|
return;
|
|
52
50
|
let t = i + 1;
|
|
@@ -85,16 +83,16 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
85
83
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
86
84
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
87
85
|
/* @__PURE__ */ e.jsx(
|
|
88
|
-
|
|
86
|
+
F,
|
|
89
87
|
{
|
|
90
88
|
type: "text",
|
|
91
89
|
name: "query",
|
|
92
90
|
className: "input",
|
|
93
91
|
placeholder: 'Try "dog" or "apple"',
|
|
94
|
-
onChange: (s) =>
|
|
92
|
+
onChange: (s) => z(s.target.value)
|
|
95
93
|
}
|
|
96
94
|
),
|
|
97
|
-
/* @__PURE__ */ e.jsxs(
|
|
95
|
+
/* @__PURE__ */ e.jsxs(K, { children: [
|
|
98
96
|
/* @__PURE__ */ e.jsx(V, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
99
97
|
/* @__PURE__ */ e.jsx(
|
|
100
98
|
O,
|
|
@@ -104,7 +102,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
104
102
|
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
105
103
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
106
104
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
107
|
-
/* @__PURE__ */ e.jsx(
|
|
105
|
+
/* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
|
|
108
106
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
109
107
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
110
108
|
/* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
|
|
@@ -114,7 +112,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
114
112
|
] }),
|
|
115
113
|
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
116
114
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
|
|
117
|
-
/* @__PURE__ */ e.jsx(
|
|
115
|
+
/* @__PURE__ */ e.jsx(S, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(C, { placeholder: "Select" }) }),
|
|
118
116
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
119
117
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
120
118
|
[
|
|
@@ -175,11 +173,11 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
175
173
|
) }) }, s.id)
|
|
176
174
|
)),
|
|
177
175
|
f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
178
|
-
/* @__PURE__ */ e.jsx(
|
|
176
|
+
/* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
|
|
179
177
|
" Loading..."
|
|
180
178
|
] }),
|
|
181
|
-
!d(r) && i <
|
|
182
|
-
|
|
179
|
+
!d(r) && i < T && !f && /* @__PURE__ */ e.jsx(
|
|
180
|
+
H,
|
|
183
181
|
{
|
|
184
182
|
size: "sm",
|
|
185
183
|
variant: "link",
|
|
@@ -195,6 +193,6 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
195
193
|
] });
|
|
196
194
|
};
|
|
197
195
|
export {
|
|
198
|
-
|
|
196
|
+
De as default,
|
|
199
197
|
I as fetchImage
|
|
200
198
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-aiHDvS5v.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");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("@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("react-i18next");const g=async(d,E)=>new Promise((a,n)=>{k.createApi({accessKey:E}).search.getPhotos(d).then(c=>{a(c)}).catch(c=>n(c))}),z=({isModalView:d,onSelect:E})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[c,q]=o.useState(0),[u,S]=o.useState(),[x,b]=o.useState(),[I,R]=o.useState(0),[j,w]=A.useDebouncedState("",1e3),[h,m]=o.useState(!1),P=async s=>{if(l.isEmpty(j))return;let i=c+1;s&&(s.preventDefault(),i=1),m(!0),q(i);const p={query:j,page:i};u&&(p.orientation=u),x&&(p.color=x),g(p,a).then(r=>{var y,v,N;f(i===1?((y=r==null?void 0:r.response)==null?void 0:y.results)||[]:[...n,...((v=r==null?void 0:r.response)==null?void 0:v.results)||[]]),R((N=r==null?void 0:r.response)==null?void 0:N.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(j)&&a){m(!0);const s={query:j,page:1};u&&(s.orientation=u),x&&(s.color=x),q(1),g(s,a).then(i=>{var p,r;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),R((r=i==null?void 0:i.response)==null?void 0:r.total_pages),m(!1)}).catch(()=>{m(!1)})}},[u,x,j,a]),l.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"h-full flex flex-col items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"max-w-3xl text-center text-gray-500",children:["To enable Unsplash, kindly provide your",e.jsxRuntimeExports.jsx("a",{href:"https://unsplash.com/documentation#public-authentication",className:"underline px-1 hover:text-blue-400",target:"_blank",rel:"noopener noreferrer",children:"Unsplash Access Key"})]})}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("form",{className:"flex items-center rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(t.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>w(s.target.value)}),e.jsxRuntimeExports.jsxs(t.Popover,{children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(C.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{side:d?"bottom":"right",className:"z-[9999] flex w-max items-center justify-center",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"py-1 text-sm font-medium",children:"Orientation"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:u,onValueChange:s=>S(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(t.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(t.Select,{defaultValue:x,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(t.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(t.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(t.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(t.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{className:`h-full ${d&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!h&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Data"}),e.jsxRuntimeExports.jsx("div",{className:"text-sm text-gray-500",children:"Enter query and press enter"})]}),d?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>E(s.urls.regular),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id))}):n.map(s=>e.jsxRuntimeExports.jsx("div",{className:"w-full px-2 py-1",children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.alt_description,src:s.urls.small})})},s.id)),h&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!l.isEmpty(n)&&c<I&&!h&&e.jsxRuntimeExports.jsx(t.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>P(void 0),disabled:h,children:h?"":"Load More"})]})]})};exports.default=z;exports.fetchImage=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),l=require("lodash-es"),d=require("@radix-ui/react-icons"),q=require("jotai"),m=require("./index-aiHDvS5v.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");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("react-i18next");const N=q.atom([]),I=({isModalView:t,onSelect:a})=>{const E=m.useBuilderProp("uploadMediaCallback",()=>""),p=m.useBuilderProp("fetchMediaCallback",()=>[]),[i,u]=q.useAtom(N),[n,j]=r.useState(!1),[h,f]=r.useState(!1),[x,c]=r.useState(),[g,R]=r.useState("");r.useEffect(()=>{(async()=>{f(!0);const s=await p();u(s||[]),f(!1)})()},[]);const v=s=>{var o,b;s&&((b=(o=s==null?void 0:s.target)==null?void 0:o.files)==null?void 0:b.length)>0&&c(s.target.files[0])},y=async()=>{j(!0);try{const{url:s}=await E(x);a(s),c(void 0);const o=await p();u(o)}catch(s){u([]),R((s==null?void 0:s.message)||"Something went wrong.")}j(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(x),alt:"",className:"h-auto w-full max-w-sm rounded-md max-h-96 object-contain"}),g&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:g}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:y,disabled:n,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[n?e.jsxRuntimeExports.jsx(d.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(d.UploadIcon,{className:"animate-bounce"})," ",n?"Uploading...":"Upload"]}),!n&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>c(void 0),children:[e.jsxRuntimeExports.jsx(d.Cross1Icon,{})," Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:t?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:t?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(m.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${t?"px-2":""} pt-2`,children:[l.isEmpty(i)&&h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),l.isEmpty(i)&&!h&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),t?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:l.map(i,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):l.map(i,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=I;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as a, useEffect as w } from "react";
|
|
3
3
|
import { isEmpty as g, map as b } from "lodash-es";
|
|
4
4
|
import { GearIcon as C, UploadIcon as U, Cross1Icon as k } from "@radix-ui/react-icons";
|
|
5
5
|
import { atom as F, useAtom as E } from "jotai";
|
|
6
|
-
import { i as j,
|
|
6
|
+
import { i as j, be as A } from "./index-pNYv0oAF.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
|
-
import "
|
|
9
|
-
import "class-variance-authority";
|
|
10
|
-
import "./utils-AvyFzbPC.js";
|
|
11
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
8
|
+
import "./Functions-7jnEwJyw.js";
|
|
12
9
|
import "clsx";
|
|
13
10
|
import "tailwind-merge";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
|
+
import "flat-to-nested";
|
|
13
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
14
|
+
import "@react-hookz/web";
|
|
15
|
+
import "@radix-ui/react-toggle";
|
|
16
|
+
import "class-variance-authority";
|
|
17
|
+
import "./Class-17XFhL48.js";
|
|
14
18
|
import "@radix-ui/react-switch";
|
|
15
19
|
import "@radix-ui/react-slot";
|
|
16
20
|
import "@radix-ui/react-accordion";
|
|
@@ -32,15 +36,9 @@ import "@radix-ui/react-context-menu";
|
|
|
32
36
|
import "react-icons-picker";
|
|
33
37
|
import "react-dom";
|
|
34
38
|
import "react-quill";
|
|
35
|
-
import "flat-to-nested";
|
|
36
|
-
import "./Functions-7jnEwJyw.js";
|
|
37
|
-
import "redux-undo";
|
|
38
|
-
import "@chaibuilder/runtime";
|
|
39
|
-
import "lodash";
|
|
40
|
-
import "@react-hookz/web";
|
|
41
39
|
import "react-i18next";
|
|
42
|
-
const R = F([]),
|
|
43
|
-
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [
|
|
40
|
+
const R = F([]), ge = ({ isModalView: r, onSelect: i }) => {
|
|
41
|
+
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [s, m] = E(R), [o, p] = a(!1), [u, x] = a(!1), [n, d] = a(), [f, y] = a("");
|
|
44
42
|
w(() => {
|
|
45
43
|
(async () => {
|
|
46
44
|
x(!0);
|
|
@@ -55,7 +53,7 @@ const R = F([]), je = ({ isModalView: r, onSelect: a }) => {
|
|
|
55
53
|
p(!0);
|
|
56
54
|
try {
|
|
57
55
|
const { url: t } = await v(n);
|
|
58
|
-
|
|
56
|
+
i(t), d(void 0);
|
|
59
57
|
const l = await c();
|
|
60
58
|
m(l);
|
|
61
59
|
} catch (t) {
|
|
@@ -80,16 +78,16 @@ const R = F([]), je = ({ isModalView: r, onSelect: a }) => {
|
|
|
80
78
|
{
|
|
81
79
|
type: "button",
|
|
82
80
|
onClick: I,
|
|
83
|
-
disabled:
|
|
81
|
+
disabled: o,
|
|
84
82
|
className: "flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",
|
|
85
83
|
children: [
|
|
86
|
-
|
|
84
|
+
o ? /* @__PURE__ */ e.jsx(C, { className: "animate-spin" }) : /* @__PURE__ */ e.jsx(U, { className: "animate-bounce" }),
|
|
87
85
|
" ",
|
|
88
|
-
|
|
86
|
+
o ? "Uploading..." : "Upload"
|
|
89
87
|
]
|
|
90
88
|
}
|
|
91
89
|
),
|
|
92
|
-
!
|
|
90
|
+
!o && /* @__PURE__ */ e.jsxs(
|
|
93
91
|
"button",
|
|
94
92
|
{
|
|
95
93
|
type: "button",
|
|
@@ -110,18 +108,18 @@ const R = F([]), je = ({ isModalView: r, onSelect: a }) => {
|
|
|
110
108
|
/* @__PURE__ */ e.jsx("input", { type: "file", id: r ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
|
|
111
109
|
] }),
|
|
112
110
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
113
|
-
g(
|
|
114
|
-
g(
|
|
115
|
-
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(
|
|
111
|
+
g(s) && u && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: "Fetching..." }) }),
|
|
112
|
+
g(s) && !u && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Images" }) }),
|
|
113
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(s, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
116
114
|
"img",
|
|
117
115
|
{
|
|
118
116
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
119
117
|
alt: t.name,
|
|
120
118
|
src: t.thumbUrl
|
|
121
119
|
}
|
|
122
|
-
) }) }, t.id)) }) : b(
|
|
120
|
+
) }) }, t.id)) }) : b(s, (t) => (
|
|
123
121
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
124
|
-
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () =>
|
|
122
|
+
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => i(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
125
123
|
"img",
|
|
126
124
|
{
|
|
127
125
|
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
@@ -134,5 +132,5 @@ const R = F([]), je = ({ isModalView: r, onSelect: a }) => {
|
|
|
134
132
|
] });
|
|
135
133
|
};
|
|
136
134
|
export {
|
|
137
|
-
|
|
135
|
+
ge as default
|
|
138
136
|
};
|