@chaibuilder/sdk 1.2.6 → 1.2.8
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/dist/{AddBlocks-gbfzju1d.js → AddBlocks-tMxKPoen.js} +50 -50
- package/dist/{AddBlocks-wuKI1ieB.cjs → AddBlocks-x2LkOHSj.cjs} +1 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +1 -0
- package/dist/{BrandingOptions-mZXO7thQ.js → BrandingOptions-QJJ1y5ez.js} +55 -50
- package/dist/{CanvasArea-7GpvsKP6.js → CanvasArea-EfZgx-gN.js} +406 -404
- package/dist/CanvasArea-rIDwPHl5.cjs +60 -0
- package/dist/{CurrentPage-tHBommaV.cjs → CurrentPage-QNFPD078.cjs} +1 -1
- package/dist/{CurrentPage-C52wu_r7.js → CurrentPage-ulHTz4MD.js} +7 -7
- package/dist/{Layers-NDtp2-im.js → Layers-rehZkz78.js} +171 -148
- package/dist/Layers-v-7k3W2I.cjs +1 -0
- package/dist/{MarkAsGlobalBlock-SPWd6Flk.js → MarkAsGlobalBlock-BjP-Rqlf.js} +6 -5
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +1 -0
- package/dist/{PagesPanel-qV7yGT-K.js → PagesPanel-acGVGJf-.js} +5 -5
- package/dist/{PagesPanel-qZ_-tybb.cjs → PagesPanel-x5ms_LOD.cjs} +1 -1
- package/dist/{ProjectPanel-vzyFbBNU.cjs → ProjectPanel-5BHQ5ANP.cjs} +1 -1
- package/dist/{ProjectPanel-RJqNz-uq.js → ProjectPanel-aLFJq49M.js} +5 -5
- package/dist/Settings-iOjfw5NQ.cjs +1 -0
- package/dist/{Settings-t0I7LKxe.js → Settings-v-txwlII.js} +172 -171
- package/dist/{SidePanels-rXx-fGjB.js → SidePanels-Vdc-J5wK.js} +96 -93
- package/dist/SidePanels-t0g9ZQFT.cjs +1 -0
- package/dist/Topbar-V8xCetWF.cjs +1 -0
- package/dist/{Topbar-ks1ckGLz.js → Topbar-j4t4AgCq.js} +4 -3
- package/dist/{UnsplashImages-8vJPuqrF.js → UnsplashImages-41Y3q5_Q.js} +7 -6
- package/dist/UnsplashImages-DbHky6cj.cjs +1 -0
- package/dist/UploadImages-DnQ95_NW.cjs +1 -0
- package/dist/{UploadImages-6N6UrjLo.js → UploadImages-xBg-kbKv.js} +13 -12
- package/dist/{add-page-modal-a8r8poMY.cjs → add-page-modal-0YAI9dXr.cjs} +1 -1
- package/dist/{add-page-modal-2VlONTs5.js → add-page-modal-6DlGzdA4.js} +5 -5
- package/dist/{confirm-alert-f3DYO5Hj.cjs → confirm-alert-U7-NcG7G.cjs} +1 -1
- package/dist/{confirm-alert-biqvaLT-.js → confirm-alert-i4pM3mOt.js} +4 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +19 -19
- package/dist/{delete-page-modal-_8O4RCkG.js → delete-page-modal-T_rlQfNd.js} +4 -4
- package/dist/{delete-page-modal-NmwHGjZP.cjs → delete-page-modal-qXpi_2xR.cjs} +1 -1
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +263 -24
- package/dist/{form-Moz_psOw.js → form-OVmsLOrc.js} +1 -1
- package/dist/{form-lJhy9DEC.cjs → form-VbouZlAW.cjs} +1 -1
- package/dist/html-to-json-2PeOCVey.cjs +1 -0
- package/dist/{html-to-json-yjzEN9OX.js → html-to-json-57841sEK.js} +25 -26
- package/dist/{index-482XFRhB.js → index-EGUphg4R.js} +5402 -5366
- package/dist/index-H6vIwGfD.cjs +1 -0
- package/dist/index-e0c8PmRQ.js +205 -0
- package/dist/index-gi1LIOCw.cjs +1 -0
- package/dist/{index-3OU9zl6c.cjs → index-jw8RxsTv.cjs} +33 -33
- package/dist/{index-_OgCuSUz.js → index-niHREMmR.js} +1051 -1043
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +20 -21
- package/dist/mockServiceWorker.js +1 -1
- package/dist/{page-viewer-ajtG_WZC.js → page-viewer-EoYYnA56.js} +5 -5
- package/dist/{page-viewer-k2VlWE3T.cjs → page-viewer-Ou8vDXGV.cjs} +1 -1
- package/dist/{project-general-setting-tAgCjUtR.cjs → project-general-setting-92q4oEYv.cjs} +1 -1
- package/dist/{project-general-setting-TIHLI4Qg.js → project-general-setting-DC_nADG-.js} +5 -5
- package/dist/{project-seo-setting-9JGBPzcA.cjs → project-seo-setting-Snn2nZgS.cjs} +1 -1
- package/dist/{project-seo-setting-dXclexQW.js → project-seo-setting-wxAGEkd_.js} +8 -7
- package/dist/{single-page-detail-6btKDNjs.cjs → single-page-detail-QmmhR_h2.cjs} +1 -1
- package/dist/{single-page-detail-lST7hWvC.js → single-page-detail-xtNZ9YxX.js} +6 -6
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +4 -4
- package/dist/style.css +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +134 -133
- package/dist/{useAddBlockByDrop-uPXvrg4G.js → useAddBlockByDrop-_nwI4W3q.js} +1 -1
- package/dist/{useAddBlockByDrop-_nd8yZBa.cjs → useAddBlockByDrop-inkD7Lck.cjs} +1 -1
- package/dist/web-blocks.cjs +2 -2
- package/dist/web-blocks.js +138 -139
- package/package.json +5 -5
- package/dist/BrandingOptions-arKT1zCy.cjs +0 -1
- package/dist/CanvasArea-jvwkPvtQ.cjs +0 -59
- package/dist/Layers-4G-0aNk9.cjs +0 -1
- package/dist/MarkAsGlobalBlock-S2BhHTsK.cjs +0 -1
- package/dist/Settings-SV08lVcH.cjs +0 -1
- package/dist/SidePanels-TOJotvzn.cjs +0 -1
- package/dist/Topbar-u5XKdWgQ.cjs +0 -1
- package/dist/UnsplashImages-V8oKEHfi.cjs +0 -1
- package/dist/UploadImages-eHYxwWAp.cjs +0 -1
- package/dist/html-to-json-5UoswV2Q.cjs +0 -1
- package/dist/index-IIJ_o44s.cjs +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { PlusIcon as V, Half2Icon as
|
|
3
|
-
import
|
|
4
|
-
import { useAtom as
|
|
5
|
-
import { filter as g, map as P, isNull as
|
|
6
|
-
import {
|
|
2
|
+
import { PlusIcon as V, Half2Icon as I } from "@radix-ui/react-icons";
|
|
3
|
+
import h, { useState as x, useEffect as L, useMemo as M, lazy as y, Suspense as j } from "react";
|
|
4
|
+
import { useAtom as z } from "jotai";
|
|
5
|
+
import { filter as g, map as P, isNull as F, find as H, isEmpty as J, each as R, get as O } from "lodash-es";
|
|
6
|
+
import { al as U, am as $, an as q, ao as G, ap as Z, E as Q, F as W, G as X, H as Y, I as ee, J as se, K as re, L as ae, aq as te, s as ie, t as le, ar as oe, as as ne, at as ce, au as de, av as S, i as k, aw as me, B as b, S as _, ax as xe, ay as pe, az as T, aA as E } from "./index-niHREMmR.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
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { J as fe, a as ve, d as je } from "./index-e0c8PmRQ.js";
|
|
11
|
+
import { E as ge } from "./index-EGUphg4R.js";
|
|
12
|
+
import { c as be } from "./Functions-7jnEwJyw.js";
|
|
12
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
13
14
|
import "@radix-ui/react-toggle";
|
|
14
15
|
import "class-variance-authority";
|
|
@@ -39,6 +40,7 @@ import "react-dom";
|
|
|
39
40
|
import "react-quill";
|
|
40
41
|
import "flat-to-nested";
|
|
41
42
|
import "redux-undo";
|
|
43
|
+
import "lodash";
|
|
42
44
|
import "@react-hookz/web";
|
|
43
45
|
import "i18next";
|
|
44
46
|
import "@floating-ui/react-dom";
|
|
@@ -48,77 +50,78 @@ import "react-dnd";
|
|
|
48
50
|
import "@minoru/react-dnd-treeview";
|
|
49
51
|
import "react-hotkeys-hook";
|
|
50
52
|
import "sonner";
|
|
51
|
-
import "./html-to-json-
|
|
53
|
+
import "./html-to-json-57841sEK.js";
|
|
52
54
|
import "himalaya";
|
|
53
|
-
import "lodash";
|
|
54
55
|
import "./web-blocks.js";
|
|
55
56
|
import "./controls-XPXGHKht.js";
|
|
56
|
-
const
|
|
57
|
-
const { t: a } = A(), [
|
|
58
|
-
return
|
|
59
|
-
r && (r.mockFn ? r.mockFn : r.dataFn)().then((o) =>
|
|
60
|
-
}, [r]), r ? /* @__PURE__ */ e.jsx(U, { onOpenChange: (n) => n ? "" :
|
|
57
|
+
const ye = ({ provider: r, onClose: l }) => {
|
|
58
|
+
const { t: a } = A(), [i, p] = x(null);
|
|
59
|
+
return L(() => {
|
|
60
|
+
r && (r.mockFn ? r.mockFn : r.dataFn)().then((o) => p(o));
|
|
61
|
+
}, [r]), r ? /* @__PURE__ */ e.jsx(U, { onOpenChange: (n) => n ? "" : l(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs($, { children: [
|
|
61
62
|
/* @__PURE__ */ e.jsxs(q, { children: [
|
|
62
63
|
/* @__PURE__ */ e.jsxs(G, { children: [
|
|
63
64
|
a("data_provider"),
|
|
64
65
|
": ",
|
|
65
66
|
r.name
|
|
66
67
|
] }),
|
|
67
|
-
/* @__PURE__ */ e.jsx(
|
|
68
|
+
/* @__PURE__ */ e.jsx(Z, { children: r.description })
|
|
68
69
|
] }),
|
|
69
|
-
/* @__PURE__ */ e.jsx(
|
|
70
|
-
|
|
70
|
+
/* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsx(
|
|
71
|
+
fe,
|
|
71
72
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
data: i,
|
|
74
|
+
shouldExpandNode: ve,
|
|
75
|
+
style: {
|
|
76
|
+
...je,
|
|
77
|
+
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
78
|
+
stringValue: "text-orange-600",
|
|
79
|
+
label: "text-green-900 font-semibold pr-1 tracking-wider"
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
82
|
) })
|
|
80
83
|
] }) }) : null;
|
|
81
84
|
};
|
|
82
|
-
function
|
|
85
|
+
function we({
|
|
83
86
|
children: r,
|
|
84
|
-
name:
|
|
87
|
+
name: l,
|
|
85
88
|
onRemove: a
|
|
86
89
|
}) {
|
|
87
|
-
const { t:
|
|
88
|
-
return /* @__PURE__ */ e.jsxs(
|
|
89
|
-
/* @__PURE__ */ e.jsx(
|
|
90
|
-
/* @__PURE__ */ e.jsxs(
|
|
91
|
-
/* @__PURE__ */ e.jsxs(
|
|
92
|
-
/* @__PURE__ */ e.jsx(ee, { children:
|
|
93
|
-
/* @__PURE__ */ e.jsx(se, { children:
|
|
90
|
+
const { t: i } = A();
|
|
91
|
+
return /* @__PURE__ */ e.jsxs(Q, { children: [
|
|
92
|
+
/* @__PURE__ */ e.jsx(W, { asChild: !0, children: r }),
|
|
93
|
+
/* @__PURE__ */ e.jsxs(X, { children: [
|
|
94
|
+
/* @__PURE__ */ e.jsxs(Y, { children: [
|
|
95
|
+
/* @__PURE__ */ e.jsx(ee, { children: i("remove_provider_confirmation", { name: l }) }),
|
|
96
|
+
/* @__PURE__ */ e.jsx(se, { children: i("remove_provider_warning") })
|
|
94
97
|
] }),
|
|
95
98
|
/* @__PURE__ */ e.jsxs(re, { children: [
|
|
96
|
-
/* @__PURE__ */ e.jsx(ae, { children:
|
|
97
|
-
/* @__PURE__ */ e.jsx(
|
|
99
|
+
/* @__PURE__ */ e.jsx(ae, { children: i("cancel") }),
|
|
100
|
+
/* @__PURE__ */ e.jsx(te, { onClick: a, className: "bg-red-600 hover:bg-red-700", children: i("remove") })
|
|
98
101
|
] })
|
|
99
102
|
] })
|
|
100
103
|
] });
|
|
101
104
|
}
|
|
102
|
-
const
|
|
103
|
-
const { t: r } = A(),
|
|
104
|
-
g(
|
|
105
|
-
), [w, f] =
|
|
106
|
-
|
|
107
|
-
(s) => !
|
|
108
|
-
),
|
|
109
|
-
const m =
|
|
110
|
-
o((d) => [...d, m]),
|
|
111
|
-
},
|
|
112
|
-
o((m) => g(m, (d) => d.providerKey !== s.providerKey)),
|
|
105
|
+
const Ne = () => {
|
|
106
|
+
const { t: r } = A(), l = M(() => he(), []), [a, i] = ie(), [, p] = z(le), [n, o] = x(
|
|
107
|
+
g(l, (s) => P(a, "providerKey").includes(s.providerKey))
|
|
108
|
+
), [w, f] = x(""), [c, v] = x(null), N = g(
|
|
109
|
+
l.map((s) => P(n, "providerKey").includes(s.providerKey) ? null : { value: s.providerKey, label: s.name }),
|
|
110
|
+
(s) => !F(s)
|
|
111
|
+
), t = (s) => {
|
|
112
|
+
const m = H(l, { providerKey: s });
|
|
113
|
+
o((d) => [...d, m]), i((d) => [...d, { providerKey: m.providerKey, args: {} }]), f(""), p("UNSAVED");
|
|
114
|
+
}, u = (s) => {
|
|
115
|
+
o((m) => g(m, (d) => d.providerKey !== s.providerKey)), i((m) => g(m, (d) => d.providerKey !== s.providerKey)), p("UNSAVED");
|
|
113
116
|
}, B = (s) => v(s);
|
|
114
|
-
return
|
|
117
|
+
return J(l) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
115
118
|
r("no_data_providers"),
|
|
116
119
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
117
120
|
/* @__PURE__ */ e.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: r("learn_more") })
|
|
118
121
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
119
122
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
120
|
-
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "
|
|
121
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(oe, { value: w, onValueChange: (s) =>
|
|
123
|
+
/* @__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) => t(s), children: [
|
|
122
125
|
/* @__PURE__ */ e.jsx(ne, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: r("select_provider") }) }),
|
|
123
126
|
/* @__PURE__ */ e.jsxs(de, { children: [
|
|
124
127
|
/* @__PURE__ */ e.jsx(S, { value: "", children: r("choose") }),
|
|
@@ -127,26 +130,26 @@ const ye = () => {
|
|
|
127
130
|
] }) }),
|
|
128
131
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
129
132
|
/* @__PURE__ */ e.jsxs("div", { className: `border-t ${n.length ? "block" : "hidden"}`, children: [
|
|
130
|
-
/* @__PURE__ */ e.jsxs("p", { className: "
|
|
133
|
+
/* @__PURE__ */ e.jsxs("p", { className: "flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500", children: [
|
|
131
134
|
r("page_data_providers"),
|
|
132
135
|
":"
|
|
133
136
|
] }),
|
|
134
137
|
/* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: n.map((s) => /* @__PURE__ */ e.jsxs(
|
|
135
138
|
"div",
|
|
136
139
|
{
|
|
137
|
-
className: "rounded-lg border bg-card text-card-foreground shadow-sm
|
|
140
|
+
className: "w-full rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
138
141
|
"data-v0-t": "card",
|
|
139
142
|
children: [
|
|
140
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-between
|
|
143
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
141
144
|
/* @__PURE__ */ e.jsx("h3", { className: "font-medium leading-4", children: s.name }),
|
|
142
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-400
|
|
145
|
+
/* @__PURE__ */ e.jsx("p", { className: "pt-1 text-xs text-gray-400", children: s.description })
|
|
143
146
|
] }) }) }),
|
|
144
|
-
/* @__PURE__ */ e.jsxs("div", { className: "items-center p-2 py-2
|
|
147
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
|
|
145
148
|
/* @__PURE__ */ e.jsxs(
|
|
146
149
|
"button",
|
|
147
150
|
{
|
|
148
151
|
onClick: () => B(s),
|
|
149
|
-
className: "inline-flex items-center justify-center text-xs font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
|
152
|
+
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",
|
|
150
153
|
children: [
|
|
151
154
|
/* @__PURE__ */ e.jsxs(
|
|
152
155
|
"svg",
|
|
@@ -160,7 +163,7 @@ const ye = () => {
|
|
|
160
163
|
"stroke-width": "2",
|
|
161
164
|
"stroke-linecap": "round",
|
|
162
165
|
"stroke-linejoin": "round",
|
|
163
|
-
className: "
|
|
166
|
+
className: "mr-2 h-4 w-4",
|
|
164
167
|
children: [
|
|
165
168
|
/* @__PURE__ */ e.jsx("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
|
|
166
169
|
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
@@ -171,7 +174,7 @@ const ye = () => {
|
|
|
171
174
|
]
|
|
172
175
|
}
|
|
173
176
|
),
|
|
174
|
-
/* @__PURE__ */ e.jsx(
|
|
177
|
+
/* @__PURE__ */ e.jsx(we, { onRemove: () => u(s), name: s.name, children: /* @__PURE__ */ e.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: [
|
|
175
178
|
/* @__PURE__ */ e.jsxs(
|
|
176
179
|
"svg",
|
|
177
180
|
{
|
|
@@ -184,7 +187,7 @@ const ye = () => {
|
|
|
184
187
|
"stroke-width": "2",
|
|
185
188
|
"stroke-linecap": "round",
|
|
186
189
|
"stroke-linejoin": "round",
|
|
187
|
-
className: "
|
|
190
|
+
className: "mr-2 h-4 w-4",
|
|
188
191
|
children: [
|
|
189
192
|
/* @__PURE__ */ e.jsx("path", { d: "M3 6h18" }),
|
|
190
193
|
/* @__PURE__ */ e.jsx("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
@@ -199,37 +202,37 @@ const ye = () => {
|
|
|
199
202
|
},
|
|
200
203
|
s.providerKey
|
|
201
204
|
)) }),
|
|
202
|
-
/* @__PURE__ */ e.jsx(
|
|
205
|
+
/* @__PURE__ */ e.jsx(ye, { onClose: () => v(null), provider: c })
|
|
203
206
|
] })
|
|
204
207
|
] });
|
|
205
|
-
},
|
|
208
|
+
}, ke = y(() => import("./AddBlocks-tMxKPoen.js")), D = y(() => import("./Layers-rehZkz78.js")), Ce = y(() => import("./BrandingOptions-QJJ1y5ez.js")), De = y(() => import("./index-niHREMmR.js").then((r) => r.cw));
|
|
206
209
|
let K = null;
|
|
207
|
-
const
|
|
208
|
-
const r = k("sideBarComponents.top", []),
|
|
209
|
-
"add-blocks":
|
|
210
|
+
const Ss = () => {
|
|
211
|
+
const r = k("sideBarComponents.top", []), l = k("sideBarComponents.bottom", []), [a, i] = z(me), [p, n] = x(a), [o, w] = x(null), f = {
|
|
212
|
+
"add-blocks": ke,
|
|
210
213
|
layers: D,
|
|
211
|
-
"branding-options":
|
|
212
|
-
images:
|
|
214
|
+
"branding-options": Ce,
|
|
215
|
+
images: De
|
|
213
216
|
};
|
|
214
|
-
R(r, ({ name:
|
|
215
|
-
f[
|
|
217
|
+
R(r, ({ name: t, panel: u }) => {
|
|
218
|
+
f[t] = u;
|
|
216
219
|
});
|
|
217
|
-
const c = (
|
|
218
|
-
clearTimeout(K), a !== "layers" &&
|
|
220
|
+
const c = (t) => {
|
|
221
|
+
clearTimeout(K), a !== "layers" && t === "layers" ? K = setTimeout(() => i("layers"), 500) : n(t), i(t);
|
|
219
222
|
}, v = k("dataBindingSupport", !1);
|
|
220
223
|
function N() {
|
|
221
|
-
const
|
|
224
|
+
const t = setTimeout(() => {
|
|
222
225
|
o && (c("layers"), clearTimeout(o));
|
|
223
226
|
}, 500);
|
|
224
|
-
w(
|
|
227
|
+
w(t);
|
|
225
228
|
}
|
|
226
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex
|
|
229
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex", children: [
|
|
227
230
|
a !== "layers" ? /* @__PURE__ */ e.jsx(
|
|
228
231
|
"div",
|
|
229
232
|
{
|
|
230
233
|
onMouseEnter: N,
|
|
231
234
|
onClick: () => c("layers"),
|
|
232
|
-
className: "fixed inset-0 bg-black/20
|
|
235
|
+
className: "fixed inset-0 z-[50] bg-black/20"
|
|
233
236
|
}
|
|
234
237
|
) : null,
|
|
235
238
|
/* @__PURE__ */ e.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: [
|
|
@@ -260,24 +263,24 @@ const Ds = () => {
|
|
|
260
263
|
onClick: () => c("branding-options"),
|
|
261
264
|
size: "sm",
|
|
262
265
|
variant: a === "branding-options" ? "default" : "outline",
|
|
263
|
-
children: /* @__PURE__ */ e.jsx(
|
|
266
|
+
children: /* @__PURE__ */ e.jsx(I, { className: "w-4 max-w-[40px] text-xs" })
|
|
264
267
|
}
|
|
265
268
|
),
|
|
266
|
-
|
|
267
|
-
r.map(({ name:
|
|
269
|
+
h.Children.toArray(
|
|
270
|
+
r.map(({ name: t, icon: u }) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(_, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(
|
|
268
271
|
b,
|
|
269
272
|
{
|
|
270
|
-
onClick: () => c(
|
|
273
|
+
onClick: () => c(t),
|
|
271
274
|
size: "sm",
|
|
272
275
|
className: "w-10",
|
|
273
|
-
variant: a ===
|
|
274
|
-
children: /* @__PURE__ */ e.jsx(
|
|
276
|
+
variant: a === t ? "default" : "outline",
|
|
277
|
+
children: /* @__PURE__ */ e.jsx(u, {})
|
|
275
278
|
}
|
|
276
279
|
) }))
|
|
277
280
|
)
|
|
278
281
|
] }),
|
|
279
|
-
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children:
|
|
280
|
-
|
|
282
|
+
/* @__PURE__ */ e.jsx("div", { className: "relative z-[100] flex w-14 flex-col items-center space-y-2", children: h.Children.toArray(
|
|
283
|
+
l.map((t) => /* @__PURE__ */ e.jsx(j, { fallback: /* @__PURE__ */ e.jsx(_, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(t, {}) }))
|
|
281
284
|
) })
|
|
282
285
|
] }),
|
|
283
286
|
/* @__PURE__ */ e.jsx(
|
|
@@ -295,14 +298,14 @@ const Ds = () => {
|
|
|
295
298
|
children: /* @__PURE__ */ e.jsx(
|
|
296
299
|
"div",
|
|
297
300
|
{
|
|
298
|
-
className:
|
|
301
|
+
className: be(
|
|
299
302
|
"relative h-full max-h-[93%] overflow-y-auto overflow-x-hidden bg-background p-1",
|
|
300
303
|
a === "layers" ? "" : "z-[100]"
|
|
301
304
|
),
|
|
302
305
|
onMouseEnter: () => {
|
|
303
306
|
o && clearTimeout(o);
|
|
304
307
|
},
|
|
305
|
-
children:
|
|
308
|
+
children: h.createElement(O(f, a, () => /* @__PURE__ */ e.jsx("div", {})))
|
|
306
309
|
}
|
|
307
310
|
)
|
|
308
311
|
}
|
|
@@ -318,29 +321,29 @@ const Ds = () => {
|
|
|
318
321
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
319
322
|
] }),
|
|
320
323
|
children: v ? /* @__PURE__ */ e.jsxs(xe, { defaultValue: "layers", className: "flex h-full w-full flex-col py-1", children: [
|
|
321
|
-
/* @__PURE__ */ e.jsxs(pe, { className: "mx-1 h-10 grid
|
|
322
|
-
/* @__PURE__ */ e.jsxs(
|
|
323
|
-
/* @__PURE__ */ e.jsx(C, { className: "h-3
|
|
324
|
+
/* @__PURE__ */ e.jsxs(pe, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
325
|
+
/* @__PURE__ */ e.jsxs(T, { value: "layers", children: [
|
|
326
|
+
/* @__PURE__ */ e.jsx(C, { className: "mr-2 h-3" }),
|
|
324
327
|
" Layers"
|
|
325
328
|
] }),
|
|
326
|
-
/* @__PURE__ */ e.jsxs(
|
|
327
|
-
/* @__PURE__ */ e.jsx(ue, { className: "w-3
|
|
329
|
+
/* @__PURE__ */ e.jsxs(T, { value: "data-provider", children: [
|
|
330
|
+
/* @__PURE__ */ e.jsx(ue, { className: "mr-2 w-3" }),
|
|
328
331
|
"Data"
|
|
329
332
|
] })
|
|
330
333
|
] }),
|
|
331
|
-
/* @__PURE__ */ e.jsx(
|
|
332
|
-
/* @__PURE__ */ e.jsx(
|
|
334
|
+
/* @__PURE__ */ e.jsx(E, { value: "layers", className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: h.createElement(D) }),
|
|
335
|
+
/* @__PURE__ */ e.jsx(E, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Ne, {}) })
|
|
333
336
|
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
334
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center bg-gray-200
|
|
335
|
-
/* @__PURE__ */ e.jsx(C, { className: "
|
|
337
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center rounded-md bg-gray-200 py-1", children: [
|
|
338
|
+
/* @__PURE__ */ e.jsx(C, { className: "ml-2 mr-2 h-4" }),
|
|
336
339
|
" Layers"
|
|
337
340
|
] }),
|
|
338
|
-
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children:
|
|
341
|
+
/* @__PURE__ */ e.jsx("div", { className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: h.createElement(D) })
|
|
339
342
|
] })
|
|
340
343
|
}
|
|
341
344
|
) })
|
|
342
345
|
] });
|
|
343
346
|
};
|
|
344
347
|
export {
|
|
345
|
-
|
|
348
|
+
Ss as default
|
|
346
349
|
};
|
|
@@ -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-H6vIwGfD.cjs"),E=require("lucide-react"),C=require("@chaibuilder/runtime"),q=require("react-i18next"),b=require("./index-gi1LIOCw.cjs"),P=require("./index-jw8RxsTv.cjs"),T=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("flat-to-nested");require("redux-undo");require("lodash");require("@react-hookz/web");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("./controls-Dy1qa8Dc.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,{children:l("remove_provider_confirmation",{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))),[g,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:g,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-x2LkOHSj.cjs"))),y=i.lazy(()=>Promise.resolve().then(()=>require("./Layers-v-7k3W2I.cjs"))),z=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-EzT9UYd6.cjs"))),K=i.lazy(()=>Promise.resolve().then(()=>require("./index-H6vIwGfD.cjs")).then(t=>t.ImagesPanel));let N=null;const I=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[n,l]=k.useAtom(s.activePanelAtom),[p,c]=i.useState(n),[u,g]=i.useState(null),v={"add-blocks":B,layers:y,"branding-options":z,images:K};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);g(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(E.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(E.ListTreeIcon,{className:"mr-2 h-3"})," Layers"]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.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(E.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=I;
|
|
@@ -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-H6vIwGfD.cjs"),a=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("lodash-es");require("./MODIFIERS-2FeVfZQ9.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("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");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.Toggle,{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,7 +1,7 @@
|
|
|
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, ar as d, as as h, at as u, au as g, aB as j, aC as v, av as r, ah as f, aD as S, aE as b, aF as N, aG as C, S as p, aH as w } from "./index-niHREMmR.js";
|
|
5
5
|
import { useTranslation as y } from "react-i18next";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "@radix-ui/react-toggle";
|
|
@@ -37,6 +37,7 @@ import "flat-to-nested";
|
|
|
37
37
|
import "./Functions-7jnEwJyw.js";
|
|
38
38
|
import "redux-undo";
|
|
39
39
|
import "@chaibuilder/runtime";
|
|
40
|
+
import "lodash";
|
|
40
41
|
import "@react-hookz/web";
|
|
41
42
|
const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(d, { children: [
|
|
42
43
|
/* @__PURE__ */ e.jsx(h, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
@@ -91,7 +92,7 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
91
92
|
) }),
|
|
92
93
|
/* @__PURE__ */ e.jsx(C, { children: /* @__PURE__ */ e.jsx("p", { children: t === "SAVING" ? "Saving..." : t === "SAVED" ? "Saved" : "Save changes" }) })
|
|
93
94
|
] }) });
|
|
94
|
-
},
|
|
95
|
+
}, ge = () => {
|
|
95
96
|
const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []), l = a("topBarComponents.right", []), n = a("editable", !0);
|
|
96
97
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
97
98
|
/* @__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(
|
|
@@ -111,5 +112,5 @@ const A = () => a("languages", ["en"]), B = () => A().length === 1 ? null : /* @
|
|
|
111
112
|
] });
|
|
112
113
|
};
|
|
113
114
|
export {
|
|
114
|
-
|
|
115
|
+
ge as default
|
|
115
116
|
};
|
|
@@ -3,7 +3,7 @@ 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
5
|
import { createApi as B } from "unsplash-js";
|
|
6
|
-
import { i as F, bk as K, a$ as U, b0 as V, b1 as O,
|
|
6
|
+
import { i as F, bk as K, a$ as U, b0 as V, b1 as O, ar as P, as as C, at as S, au as k, av as h, bn as Q, B as $ } from "./index-niHREMmR.js";
|
|
7
7
|
import { useDebouncedState as H } from "@react-hookz/web";
|
|
8
8
|
import { Loader as R } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
@@ -39,13 +39,14 @@ import "flat-to-nested";
|
|
|
39
39
|
import "./Functions-7jnEwJyw.js";
|
|
40
40
|
import "redux-undo";
|
|
41
41
|
import "@chaibuilder/runtime";
|
|
42
|
+
import "lodash";
|
|
42
43
|
import "react-i18next";
|
|
43
44
|
const I = async (x, g) => new Promise((o, r) => {
|
|
44
45
|
B({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
45
46
|
o(i);
|
|
46
47
|
}).catch((i) => r(i));
|
|
47
|
-
}),
|
|
48
|
-
const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l,
|
|
48
|
+
}), Le = ({ isModalView: x, onSelect: g }) => {
|
|
49
|
+
const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = H("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
49
50
|
if (d(u))
|
|
50
51
|
return;
|
|
51
52
|
let t = i + 1;
|
|
@@ -102,7 +103,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
102
103
|
className: "z-[9999] flex w-max items-center justify-center",
|
|
103
104
|
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
104
105
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
105
|
-
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) =>
|
|
106
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
106
107
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
107
108
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
108
109
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
@@ -112,7 +113,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
112
113
|
] })
|
|
113
114
|
] }),
|
|
114
115
|
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
115
|
-
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) =>
|
|
116
|
+
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
|
|
116
117
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
117
118
|
/* @__PURE__ */ e.jsxs(k, { className: "z-[9999]", children: [
|
|
118
119
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
@@ -194,6 +195,6 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
194
195
|
] });
|
|
195
196
|
};
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
Le as default,
|
|
198
199
|
I as fetchImage
|
|
199
200
|
};
|
|
@@ -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-H6vIwGfD.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("jotai");require("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");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"),s=require("react"),l=require("lodash-es"),d=require("@radix-ui/react-icons"),b=require("jotai"),m=require("./index-H6vIwGfD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("flat-to-nested");require("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");require("react-i18next");const N=b.atom([]),I=({isModalView:t,onSelect:a})=>{const E=m.useBuilderProp("uploadMediaCallback",()=>""),p=m.useBuilderProp("fetchMediaCallback",()=>[]),[i,u]=b.useAtom(N),[n,j]=s.useState(!1),[h,f]=s.useState(!1),[x,c]=s.useState(),[g,R]=s.useState("");s.useEffect(()=>{(async()=>{f(!0);const r=await p();u(r||[]),f(!1)})()},[]);const v=r=>{var o,q;r&&((q=(o=r==null?void 0:r.target)==null?void 0:o.files)==null?void 0:q.length)>0&&c(r.target.files[0])},y=async()=>{j(!0);try{const{url:r}=await E(x);a(r),c(void 0);const o=await p();u(o)}catch(r){u([]),R((r==null?void 0:r.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,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>a(r.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:r.name,src:r.thumbUrl})})},r.id))}):l.map(i,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>a(r.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:r.name,src:r.url})})},r.id))]})]})};exports.default=I;
|
|
@@ -3,7 +3,7 @@ import { useState as i, 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, bn as A } from "./index-
|
|
6
|
+
import { i as j, bn as A } from "./index-niHREMmR.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
8
|
import "@radix-ui/react-toggle";
|
|
9
9
|
import "class-variance-authority";
|
|
@@ -36,10 +36,11 @@ import "flat-to-nested";
|
|
|
36
36
|
import "./Functions-7jnEwJyw.js";
|
|
37
37
|
import "redux-undo";
|
|
38
38
|
import "@chaibuilder/runtime";
|
|
39
|
+
import "lodash";
|
|
39
40
|
import "@react-hookz/web";
|
|
40
41
|
import "react-i18next";
|
|
41
|
-
const R = F([]),
|
|
42
|
-
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [
|
|
42
|
+
const R = F([]), je = ({ isModalView: r, onSelect: a }) => {
|
|
43
|
+
const v = j("uploadMediaCallback", () => ""), c = j("fetchMediaCallback", () => []), [o, m] = E(R), [s, p] = i(!1), [u, x] = i(!1), [n, d] = i(), [f, y] = i("");
|
|
43
44
|
w(() => {
|
|
44
45
|
(async () => {
|
|
45
46
|
x(!0);
|
|
@@ -79,16 +80,16 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
79
80
|
{
|
|
80
81
|
type: "button",
|
|
81
82
|
onClick: I,
|
|
82
|
-
disabled:
|
|
83
|
+
disabled: s,
|
|
83
84
|
className: "flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",
|
|
84
85
|
children: [
|
|
85
|
-
|
|
86
|
+
s ? /* @__PURE__ */ e.jsx(C, { className: "animate-spin" }) : /* @__PURE__ */ e.jsx(U, { className: "animate-bounce" }),
|
|
86
87
|
" ",
|
|
87
|
-
|
|
88
|
+
s ? "Uploading..." : "Upload"
|
|
88
89
|
]
|
|
89
90
|
}
|
|
90
91
|
),
|
|
91
|
-
!
|
|
92
|
+
!s && /* @__PURE__ */ e.jsxs(
|
|
92
93
|
"button",
|
|
93
94
|
{
|
|
94
95
|
type: "button",
|
|
@@ -109,16 +110,16 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
109
110
|
/* @__PURE__ */ e.jsx("input", { type: "file", id: r ? "upload-in-modal" : "upload-in-panel", hidden: !0, onChange: N })
|
|
110
111
|
] }),
|
|
111
112
|
/* @__PURE__ */ e.jsxs(A, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
112
|
-
g(
|
|
113
|
-
g(
|
|
114
|
-
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(
|
|
113
|
+
g(o) && 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..." }) }),
|
|
114
|
+
g(o) && !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" }) }),
|
|
115
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(o, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
115
116
|
"img",
|
|
116
117
|
{
|
|
117
118
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
118
119
|
alt: t.name,
|
|
119
120
|
src: t.thumbUrl
|
|
120
121
|
}
|
|
121
|
-
) }) }, t.id)) }) : b(
|
|
122
|
+
) }) }, t.id)) }) : b(o, (t) => (
|
|
122
123
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
123
124
|
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => a(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
124
125
|
"img",
|
|
@@ -133,5 +134,5 @@ const R = F([]), be = ({ isModalView: r, onSelect: a }) => {
|
|
|
133
134
|
] });
|
|
134
135
|
};
|
|
135
136
|
export {
|
|
136
|
-
|
|
137
|
+
je as default
|
|
137
138
|
};
|