@chaibuilder/sdk 1.2.33 → 1.2.35
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-0eVRNr1d.js → AddBlocks-fpRgZNZT.js} +36 -32
- package/dist/AddBlocks-i2OFXcGZ.cjs +1 -0
- package/dist/BrandingOptions-BuV0XItY.cjs +1 -0
- package/dist/{BrandingOptions-yYAznnw2.js → BrandingOptions-RxIUds41.js} +37 -31
- package/dist/CanvasArea-C1VfoHjl.js +1200 -0
- package/dist/CanvasArea-a-I0uB7y.cjs +55 -0
- package/dist/{index-AJalHhkO.js → ChaiBuilderEditor-ChKigulx.js} +26119 -22752
- package/dist/ChaiBuilderEditor-pWAMhLiq.cjs +206 -0
- package/dist/CurrentPage-JgJ2XITk.cjs +1 -0
- package/dist/{CurrentPage-1v40uk8K.js → CurrentPage-tWXo7zPq.js} +19 -19
- package/dist/{ListTree-0ZrRreCs.js → ListTree-_JJ1Ka3e.js} +86 -81
- package/dist/ListTree-rJ4eHyKn.cjs +1 -0
- package/dist/{PagesPanel-AxQX-BX2.js → PagesPanel-bwRvd7HB.js} +14 -14
- package/dist/PagesPanel-zd48fj10.cjs +1 -0
- package/dist/{ProjectPanel-GYdge5v9.js → ProjectPanel-S7X2GDYk.js} +16 -16
- package/dist/ProjectPanel-sIURK9WR.cjs +1 -0
- package/dist/{Settings-9JAzGHau.js → Settings-59DRCnXh.js} +53 -53
- package/dist/Settings-Lw_UvEWj.cjs +1 -0
- package/dist/SidePanels-FX3WxtRi.cjs +1 -0
- package/dist/{SidePanels-bLwsW29O.js → SidePanels-QwN_fVWJ.js} +70 -70
- package/dist/Topbar-_k5gwR_4.js +133 -0
- package/dist/Topbar-cRmIAzUg.cjs +1 -0
- package/dist/{UnsplashImages-NYwOOgYa.js → UnsplashImages-hI0Zvl2t.js} +27 -22
- package/dist/UnsplashImages-texUmBiW.cjs +1 -0
- package/dist/{UploadImages-vpZeW-YW.js → UploadImages-diXySdpc.js} +33 -27
- package/dist/UploadImages-kRSLsKBv.cjs +1 -0
- package/dist/{add-page-modal-hDyzsEU7.js → add-page-modal-Md_OotSU.js} +22 -22
- package/dist/add-page-modal-R9nsF97c.cjs +1 -0
- package/dist/{confirm-alert-FGQKKQJU.js → confirm-alert-DS8nMVJP.js} +16 -10
- package/dist/confirm-alert-gKJ-H8aH.cjs +1 -0
- package/dist/{controls-OfJWSEqC.js → controls-VTdJhdSz.js} +44 -41
- package/dist/controls-jWJDao88.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +9 -0
- package/dist/core.js +46 -45
- package/dist/{delete-page-modal-KxeyBri2.js → delete-page-modal-PVpCkC06.js} +15 -15
- package/dist/delete-page-modal-ez831xRV.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +9 -0
- package/dist/email.js +18 -16
- package/dist/form-6D7DLOsP.cjs +1 -0
- package/dist/{form-77dY98bF.js → form-BcCd02eY.js} +7 -7
- package/dist/index-F_-wLCKB.cjs +1 -0
- package/dist/{index-5zkCTSAM.js → index-NmcmhDTV.js} +28 -29
- package/dist/{page-viewer-umQaut1j.js → page-viewer-1bDdfbfY.js} +21 -21
- package/dist/page-viewer-MyIBh0H7.cjs +1 -0
- package/dist/project-general-setting-1UvYceGY.cjs +1 -0
- package/dist/{project-general-setting-uuCemMCU.js → project-general-setting-cAuIqXqs.js} +24 -24
- package/dist/{project-seo-setting-asvbPQiI.js → project-seo-setting-DIspBN3U.js} +26 -20
- package/dist/project-seo-setting-ePXNygH3.cjs +1 -0
- package/dist/single-page-detail-6M4by4GP.cjs +1 -0
- package/dist/{single-page-detail-F6pKWyq1.js → single-page-detail-VEdxOlo1.js} +25 -25
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +9 -0
- package/dist/studio.js +13 -13
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +153 -147
- package/dist/useCanvasSettings-YdWIGhpI.js +6 -0
- package/dist/useCanvasSettings-xq3gcMsb.cjs +1 -0
- package/dist/web-blocks.cjs +4 -4
- package/dist/web-blocks.js +137 -113
- package/package.json +9 -3
- package/dist/AddBlocks-t0hKDSud.cjs +0 -1
- package/dist/BrandingOptions-NVmCxZfD.cjs +0 -1
- package/dist/CanvasArea-2b4oSjRx.js +0 -1177
- package/dist/CanvasArea-OzyCq6UU.cjs +0 -55
- package/dist/CurrentPage-YBMhEBZG.cjs +0 -1
- package/dist/ListTree-jPwxgI6R.cjs +0 -1
- package/dist/PagesPanel-ivEL9tIQ.cjs +0 -1
- package/dist/ProjectPanel-shgvg_yT.cjs +0 -1
- package/dist/Settings-MMwEBADN.cjs +0 -1
- package/dist/SidePanels-iaaRCUeQ.cjs +0 -1
- package/dist/Topbar-0Ql8pHVc.js +0 -132
- package/dist/Topbar-CkUhCnSW.cjs +0 -1
- package/dist/UnsplashImages-juwtWvXe.cjs +0 -1
- package/dist/UploadImages-4_jmnoVi.cjs +0 -1
- package/dist/add-page-modal-2ZPjc54F.cjs +0 -1
- package/dist/confirm-alert-QRxOc76t.cjs +0 -1
- package/dist/controls-KK2oLIa8.cjs +0 -1
- package/dist/delete-page-modal--N1nPPIL.cjs +0 -1
- package/dist/form-hT5dGoJH.cjs +0 -1
- package/dist/index-FPBudsRF.cjs +0 -1
- package/dist/index-JIcsKKoG.cjs +0 -1
- package/dist/index-YpnaudSM.js +0 -63
- package/dist/index-ecnGWzh9.cjs +0 -1
- package/dist/index-hH5SIZ29.js +0 -3116
- package/dist/index-sJ9Uc9UY.cjs +0 -206
- package/dist/page-viewer-k-g15j8B.cjs +0 -1
- package/dist/project-general-setting-1leAiCJQ.cjs +0 -1
- package/dist/project-seo-setting-kDBSOzgX.cjs +0 -1
- package/dist/single-page-detail-IFtVxwl5.cjs +0 -1
- package/dist/useCanvasSettings-Am2o80hW.cjs +0 -1
- package/dist/useCanvasSettings-ikt217kv.js +0 -6
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as
|
|
3
|
-
import j, { useState as
|
|
2
|
+
import { KeyboardIcon as U, PlusIcon as J, Half2Icon as Z } from "@radix-ui/react-icons";
|
|
3
|
+
import j, { useState as h, useEffect as W, useMemo as Y, memo as $, lazy as w, Suspense as N } from "react";
|
|
4
4
|
import { useAtom as O } from "jotai";
|
|
5
|
-
import { filter as y, map as K, isNull as
|
|
6
|
-
import {
|
|
7
|
-
import { ListTreeIcon as
|
|
8
|
-
import { getChaiDataProviders as
|
|
5
|
+
import { filter as y, map as K, isNull as q, find as G, isEmpty as Q, each as X, get as ee } from "lodash-es";
|
|
6
|
+
import { Z as M, _ as H, $ as F, a0 as R, a1 as se, a2 as re, A as ae, a as le, b as ie, c as te, d as oe, e as ne, f as ce, g as de, a3 as me, a4 as xe, a5 as he, a6 as pe, a7 as ue, a8 as fe, a9 as je, aa as E, ab as ve, ac as ge, ad as be, B as v, ae as Ne, af as B, h as T, ag as ye, ah as z, ai as V, aj as I, ak as _, al as A } from "./ChaiBuilderEditor-ChKigulx.js";
|
|
7
|
+
import { ListTreeIcon as S, DatabaseIcon as we } from "lucide-react";
|
|
8
|
+
import { getChaiDataProviders as ke } from "@chaibuilder/runtime";
|
|
9
9
|
import { useTranslation as g } from "react-i18next";
|
|
10
|
-
import { J as
|
|
11
|
-
import { E as Te } from "./index-AJalHhkO.js";
|
|
10
|
+
import { J as De, a as Ce, d as Te } from "./index-e0c8PmRQ.js";
|
|
12
11
|
import { O as i } from "./STRINGS--j49GZJP.js";
|
|
13
|
-
import { c as
|
|
12
|
+
import { c as _e } from "./Functions-7jnEwJyw.js";
|
|
14
13
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
14
|
+
import "clsx";
|
|
15
|
+
import "react-dom";
|
|
16
|
+
import "@radix-ui/react-scroll-area";
|
|
17
|
+
import "@floating-ui/react-dom";
|
|
18
|
+
import "i18next";
|
|
19
|
+
import "flagged";
|
|
15
20
|
import "@react-hookz/web";
|
|
16
21
|
import "./MODIFIERS-cBT31iqE.js";
|
|
17
|
-
import "./Class-6Hz2KzYb.js";
|
|
18
|
-
import "clsx";
|
|
19
|
-
import "tailwind-merge";
|
|
20
22
|
import "@radix-ui/react-toggle";
|
|
21
23
|
import "class-variance-authority";
|
|
24
|
+
import "./Class-6Hz2KzYb.js";
|
|
25
|
+
import "tailwind-merge";
|
|
22
26
|
import "@radix-ui/react-switch";
|
|
23
27
|
import "@radix-ui/react-slot";
|
|
24
28
|
import "@radix-ui/react-accordion";
|
|
25
29
|
import "@radix-ui/react-alert-dialog";
|
|
26
30
|
import "@radix-ui/react-dialog";
|
|
27
31
|
import "@radix-ui/react-label";
|
|
28
|
-
import "@radix-ui/react-scroll-area";
|
|
29
32
|
import "@radix-ui/react-tabs";
|
|
30
33
|
import "@radix-ui/react-tooltip";
|
|
31
34
|
import "@radix-ui/react-popover";
|
|
@@ -38,16 +41,13 @@ import "@radix-ui/react-toast";
|
|
|
38
41
|
import "cmdk";
|
|
39
42
|
import "@radix-ui/react-context-menu";
|
|
40
43
|
import "react-icons-picker";
|
|
41
|
-
import "react-dom";
|
|
42
44
|
import "react-quill";
|
|
43
|
-
import "i18next";
|
|
44
|
-
import "@floating-ui/react-dom";
|
|
45
|
-
import "flagged";
|
|
46
45
|
import "react-hotkeys-hook";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
import "lodash";
|
|
47
|
+
const Ae = ({ provider: s, onClose: o }) => {
|
|
48
|
+
const { t: l } = g(), [a, p] = h(null);
|
|
49
|
+
return W(() => {
|
|
50
|
+
s && (s.mockFn ? s.mockFn : s.dataFn)().then((n) => p(n));
|
|
51
51
|
}, [s]), s ? /* @__PURE__ */ e.jsx(M, { onOpenChange: (d) => d ? "" : o(), defaultOpen: !0, children: /* @__PURE__ */ e.jsxs(H, { children: [
|
|
52
52
|
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
53
53
|
/* @__PURE__ */ e.jsxs(R, { children: [
|
|
@@ -57,13 +57,13 @@ const Se = ({ provider: s, onClose: o }) => {
|
|
|
57
57
|
] }),
|
|
58
58
|
/* @__PURE__ */ e.jsx(se, { children: s.description })
|
|
59
59
|
] }),
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
61
|
-
|
|
60
|
+
/* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(
|
|
61
|
+
De,
|
|
62
62
|
{
|
|
63
63
|
data: a,
|
|
64
64
|
shouldExpandNode: Ce,
|
|
65
65
|
style: {
|
|
66
|
-
...
|
|
66
|
+
...Te,
|
|
67
67
|
container: "max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",
|
|
68
68
|
stringValue: "text-orange-600",
|
|
69
69
|
label: "text-green-900 font-semibold pr-1 tracking-wider"
|
|
@@ -72,42 +72,42 @@ const Se = ({ provider: s, onClose: o }) => {
|
|
|
72
72
|
) })
|
|
73
73
|
] }) }) : null;
|
|
74
74
|
};
|
|
75
|
-
function
|
|
75
|
+
function Se({
|
|
76
76
|
children: s,
|
|
77
77
|
name: o,
|
|
78
78
|
onRemove: l
|
|
79
79
|
}) {
|
|
80
80
|
const { t: a } = g();
|
|
81
|
-
return /* @__PURE__ */ e.jsxs(
|
|
82
|
-
/* @__PURE__ */ e.jsx(
|
|
83
|
-
/* @__PURE__ */ e.jsxs(
|
|
84
|
-
/* @__PURE__ */ e.jsxs(
|
|
81
|
+
return /* @__PURE__ */ e.jsxs(ae, { children: [
|
|
82
|
+
/* @__PURE__ */ e.jsx(le, { asChild: !0, children: s }),
|
|
83
|
+
/* @__PURE__ */ e.jsxs(ie, { children: [
|
|
84
|
+
/* @__PURE__ */ e.jsxs(te, { children: [
|
|
85
85
|
/* @__PURE__ */ e.jsx(
|
|
86
|
-
|
|
86
|
+
oe,
|
|
87
87
|
{
|
|
88
88
|
dangerouslySetInnerHTML: { __html: a("remove_provider_confirmation").replace("{name}", o) }
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
|
-
/* @__PURE__ */ e.jsx(
|
|
91
|
+
/* @__PURE__ */ e.jsx(ne, { children: a("remove_provider_warning") })
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */ e.jsxs(
|
|
94
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
-
/* @__PURE__ */ e.jsx(
|
|
93
|
+
/* @__PURE__ */ e.jsxs(ce, { children: [
|
|
94
|
+
/* @__PURE__ */ e.jsx(de, { children: a("cancel") }),
|
|
95
|
+
/* @__PURE__ */ e.jsx(me, { onClick: l, className: "bg-red-600 hover:bg-red-700", children: a("remove") })
|
|
96
96
|
] })
|
|
97
97
|
] })
|
|
98
98
|
] });
|
|
99
99
|
}
|
|
100
100
|
const Pe = () => {
|
|
101
|
-
const { t: s } = g(), o =
|
|
101
|
+
const { t: s } = g(), o = Y(() => ke(), []), [l, a] = xe(), [, p] = O(he), [d, n] = h(
|
|
102
102
|
y(o, (r) => K(l, "providerKey").includes(r.providerKey))
|
|
103
|
-
), [k, u] =
|
|
103
|
+
), [k, u] = h(""), [b, c] = h(null), D = y(
|
|
104
104
|
o.map((r) => K(d, "providerKey").includes(r.providerKey) ? null : { value: r.providerKey, label: r.name }),
|
|
105
|
-
(r) =>
|
|
106
|
-
),
|
|
105
|
+
(r) => !q(r)
|
|
106
|
+
), C = (r) => {
|
|
107
107
|
const x = G(o, { providerKey: r });
|
|
108
|
-
n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""),
|
|
108
|
+
n((m) => [...m, x]), a((m) => [...m, { providerKey: x.providerKey, args: {} }]), u(""), p("UNSAVED");
|
|
109
109
|
}, t = (r) => {
|
|
110
|
-
n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)),
|
|
110
|
+
n((x) => y(x, (m) => m.providerKey !== r.providerKey)), a((x) => y(x, (m) => m.providerKey !== r.providerKey)), p("UNSAVED");
|
|
111
111
|
}, f = (r) => c(r);
|
|
112
112
|
return Q(o) ? /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
|
|
113
113
|
s("no_data_providers"),
|
|
@@ -116,11 +116,11 @@ const Pe = () => {
|
|
|
116
116
|
] }) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
|
|
117
117
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
118
118
|
/* @__PURE__ */ e.jsx("label", { children: /* @__PURE__ */ e.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: s("add_data_providers") }) }),
|
|
119
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) =>
|
|
120
|
-
/* @__PURE__ */ e.jsx(
|
|
121
|
-
/* @__PURE__ */ e.jsxs(
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ e.jsxs(pe, { value: k, onValueChange: (r) => C(r), children: [
|
|
120
|
+
/* @__PURE__ */ e.jsx(ue, { className: "w-full", children: /* @__PURE__ */ e.jsx(fe, { placeholder: s("select_provider") }) }),
|
|
121
|
+
/* @__PURE__ */ e.jsxs(je, { children: [
|
|
122
122
|
/* @__PURE__ */ e.jsx(E, { value: "", children: s("choose") }),
|
|
123
|
-
|
|
123
|
+
D.map((r) => /* @__PURE__ */ e.jsx(E, { value: r.value, children: r.label }, r.value))
|
|
124
124
|
] })
|
|
125
125
|
] }) }),
|
|
126
126
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -169,7 +169,7 @@ const Pe = () => {
|
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
/* @__PURE__ */ e.jsx(
|
|
172
|
+
/* @__PURE__ */ e.jsx(Se, { onRemove: () => t(r), name: r.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: [
|
|
173
173
|
/* @__PURE__ */ e.jsxs(
|
|
174
174
|
"svg",
|
|
175
175
|
{
|
|
@@ -197,10 +197,10 @@ const Pe = () => {
|
|
|
197
197
|
},
|
|
198
198
|
r.providerKey
|
|
199
199
|
)) }),
|
|
200
|
-
/* @__PURE__ */ e.jsx(
|
|
200
|
+
/* @__PURE__ */ e.jsx(Ae, { onClose: () => c(null), provider: b })
|
|
201
201
|
] })
|
|
202
202
|
] });
|
|
203
|
-
}, Ke =
|
|
203
|
+
}, Ke = $(() => {
|
|
204
204
|
const { t: s } = g(), o = {
|
|
205
205
|
"ctrl + Z": "Undo",
|
|
206
206
|
"ctrl + Y": "Redo",
|
|
@@ -212,9 +212,9 @@ const Pe = () => {
|
|
|
212
212
|
del: "Delete block"
|
|
213
213
|
};
|
|
214
214
|
return /* @__PURE__ */ e.jsxs(M, { children: [
|
|
215
|
-
/* @__PURE__ */ e.jsx(
|
|
216
|
-
/* @__PURE__ */ e.jsx(
|
|
217
|
-
/* @__PURE__ */ e.jsx(
|
|
215
|
+
/* @__PURE__ */ e.jsx(ve, { children: /* @__PURE__ */ e.jsxs(ge, { children: [
|
|
216
|
+
/* @__PURE__ */ e.jsx(be, { children: /* @__PURE__ */ e.jsx(v, { size: "sm", className: "w-10", variant: "outline", children: /* @__PURE__ */ e.jsx(U, {}) }) }),
|
|
217
|
+
/* @__PURE__ */ e.jsx(Ne, { children: /* @__PURE__ */ e.jsx("p", { children: s("Keyboard shortcuts") }) })
|
|
218
218
|
] }) }),
|
|
219
219
|
/* @__PURE__ */ e.jsxs(H, { className: "sm:max-w-[525px]", children: [
|
|
220
220
|
/* @__PURE__ */ e.jsx(F, { children: /* @__PURE__ */ e.jsx(R, { children: s("Keyboard shortcuts") }) }),
|
|
@@ -230,10 +230,10 @@ const Pe = () => {
|
|
|
230
230
|
] }) })
|
|
231
231
|
] })
|
|
232
232
|
] });
|
|
233
|
-
}), Ee = w(() => import("./AddBlocks-
|
|
233
|
+
}), Ee = w(() => import("./AddBlocks-fpRgZNZT.js")), P = w(() => import("./ListTree-_JJ1Ka3e.js")), Be = w(() => import("./BrandingOptions-RxIUds41.js")), ze = w(() => import("./ChaiBuilderEditor-ChKigulx.js").then((s) => s.co));
|
|
234
234
|
let L = null;
|
|
235
|
-
const
|
|
236
|
-
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(
|
|
235
|
+
const _s = () => {
|
|
236
|
+
const s = T("sideBarComponents.top", []), o = T("sideBarComponents.bottom", []), [l, a] = O(ye), [p, d] = h(l), [n, k] = h(null), { t: u } = g(), b = {
|
|
237
237
|
"add-blocks": Ee,
|
|
238
238
|
[i]: P,
|
|
239
239
|
"branding-options": Be,
|
|
@@ -244,8 +244,8 @@ const As = () => {
|
|
|
244
244
|
});
|
|
245
245
|
const c = (t) => {
|
|
246
246
|
clearTimeout(L), l !== i && t === i ? L = setTimeout(() => a(i), 500) : d(t), a(t);
|
|
247
|
-
},
|
|
248
|
-
function
|
|
247
|
+
}, D = T("dataBindingSupport", !1);
|
|
248
|
+
function C() {
|
|
249
249
|
const t = setTimeout(() => {
|
|
250
250
|
n && (c(i), clearTimeout(n));
|
|
251
251
|
}, 500);
|
|
@@ -255,7 +255,7 @@ const As = () => {
|
|
|
255
255
|
l !== i ? /* @__PURE__ */ e.jsx(
|
|
256
256
|
"div",
|
|
257
257
|
{
|
|
258
|
-
onMouseEnter:
|
|
258
|
+
onMouseEnter: C,
|
|
259
259
|
onClick: () => c(i),
|
|
260
260
|
className: "fixed inset-0 z-[50] bg-black/20"
|
|
261
261
|
}
|
|
@@ -279,7 +279,7 @@ const As = () => {
|
|
|
279
279
|
onClick: () => c(i),
|
|
280
280
|
size: "sm",
|
|
281
281
|
variant: l === i ? "default" : "outline",
|
|
282
|
-
children: /* @__PURE__ */ e.jsx(
|
|
282
|
+
children: /* @__PURE__ */ e.jsx(S, { className: "w-4" })
|
|
283
283
|
}
|
|
284
284
|
),
|
|
285
285
|
/* @__PURE__ */ e.jsx(
|
|
@@ -288,7 +288,7 @@ const As = () => {
|
|
|
288
288
|
onClick: () => c("branding-options"),
|
|
289
289
|
size: "sm",
|
|
290
290
|
variant: l === "branding-options" ? "default" : "outline",
|
|
291
|
-
children: /* @__PURE__ */ e.jsx(
|
|
291
|
+
children: /* @__PURE__ */ e.jsx(Z, { className: "w-4 max-w-[40px] text-xs" })
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
294
|
j.Children.toArray(
|
|
@@ -326,7 +326,7 @@ const As = () => {
|
|
|
326
326
|
children: /* @__PURE__ */ e.jsx(
|
|
327
327
|
"div",
|
|
328
328
|
{
|
|
329
|
-
className:
|
|
329
|
+
className: _e("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),
|
|
330
330
|
onMouseEnter: () => {
|
|
331
331
|
n && clearTimeout(n);
|
|
332
332
|
},
|
|
@@ -345,28 +345,28 @@ const As = () => {
|
|
|
345
345
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" }),
|
|
346
346
|
/* @__PURE__ */ e.jsx("div", { className: "h-16 w-full bg-gray-200" })
|
|
347
347
|
] }),
|
|
348
|
-
children:
|
|
348
|
+
children: D ? /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
349
349
|
/* @__PURE__ */ e.jsxs(I, { className: "mx-1 grid h-10 grid-cols-2", children: [
|
|
350
|
-
/* @__PURE__ */ e.jsxs(
|
|
351
|
-
/* @__PURE__ */ e.jsx(
|
|
350
|
+
/* @__PURE__ */ e.jsxs(_, { value: i, children: [
|
|
351
|
+
/* @__PURE__ */ e.jsx(S, { className: "mr-2 h-3" }),
|
|
352
352
|
" ",
|
|
353
353
|
u("Outline")
|
|
354
354
|
] }),
|
|
355
|
-
/* @__PURE__ */ e.jsxs(
|
|
356
|
-
/* @__PURE__ */ e.jsx(
|
|
355
|
+
/* @__PURE__ */ e.jsxs(_, { value: "data-provider", children: [
|
|
356
|
+
/* @__PURE__ */ e.jsx(we, { className: "mr-2 w-3" }),
|
|
357
357
|
u("Data")
|
|
358
358
|
] })
|
|
359
359
|
] }),
|
|
360
|
-
/* @__PURE__ */ e.jsx(
|
|
361
|
-
/* @__PURE__ */ e.jsx(
|
|
360
|
+
/* @__PURE__ */ e.jsx(A, { value: i, className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden", children: j.createElement(P) }),
|
|
361
|
+
/* @__PURE__ */ e.jsx(A, { value: "data-provider", className: "flex-1 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ e.jsx(Pe, {}) })
|
|
362
362
|
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { defaultValue: i, className: "flex h-full w-full flex-col py-1", children: [
|
|
363
|
-
/* @__PURE__ */ e.jsx(I, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(
|
|
364
|
-
/* @__PURE__ */ e.jsx(
|
|
363
|
+
/* @__PURE__ */ e.jsx(I, { className: "mx-1 grid h-10 grid-cols-1", children: /* @__PURE__ */ e.jsxs(_, { value: i, children: [
|
|
364
|
+
/* @__PURE__ */ e.jsx(S, { className: "mr-2 h-3" }),
|
|
365
365
|
" ",
|
|
366
366
|
u("Outline")
|
|
367
367
|
] }) }),
|
|
368
368
|
/* @__PURE__ */ e.jsx(
|
|
369
|
-
|
|
369
|
+
A,
|
|
370
370
|
{
|
|
371
371
|
value: i,
|
|
372
372
|
className: "no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",
|
|
@@ -379,5 +379,5 @@ const As = () => {
|
|
|
379
379
|
] });
|
|
380
380
|
};
|
|
381
381
|
export {
|
|
382
|
-
|
|
382
|
+
_s as default
|
|
383
383
|
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import o, { useMemo as h, Suspense as c } from "react";
|
|
3
|
+
import { FontFamilyIcon as j, EyeOpenIcon as g } from "@radix-ui/react-icons";
|
|
4
|
+
import { h as r, a6 as f, a7 as v, a8 as b, a9 as N, am as S, an as w, aa as l, V as y, B as p, ao as C, E as B, ah as m, ap as A } from "./ChaiBuilderEditor-ChKigulx.js";
|
|
5
|
+
import { useTranslation as x } from "react-i18next";
|
|
6
|
+
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
+
import "clsx";
|
|
8
|
+
import "react-dom";
|
|
9
|
+
import "@radix-ui/react-scroll-area";
|
|
10
|
+
import "@floating-ui/react-dom";
|
|
11
|
+
import "jotai";
|
|
12
|
+
import "i18next";
|
|
13
|
+
import "flagged";
|
|
14
|
+
import "lodash-es";
|
|
15
|
+
import "./STRINGS--j49GZJP.js";
|
|
16
|
+
import "./Functions-7jnEwJyw.js";
|
|
17
|
+
import "tailwind-merge";
|
|
18
|
+
import "@chaibuilder/runtime";
|
|
19
|
+
import "@react-hookz/web";
|
|
20
|
+
import "./MODIFIERS-cBT31iqE.js";
|
|
21
|
+
import "@radix-ui/react-toggle";
|
|
22
|
+
import "class-variance-authority";
|
|
23
|
+
import "./Class-6Hz2KzYb.js";
|
|
24
|
+
import "@radix-ui/react-switch";
|
|
25
|
+
import "@radix-ui/react-slot";
|
|
26
|
+
import "@radix-ui/react-accordion";
|
|
27
|
+
import "@radix-ui/react-alert-dialog";
|
|
28
|
+
import "@radix-ui/react-dialog";
|
|
29
|
+
import "@radix-ui/react-label";
|
|
30
|
+
import "@radix-ui/react-tabs";
|
|
31
|
+
import "@radix-ui/react-tooltip";
|
|
32
|
+
import "@radix-ui/react-popover";
|
|
33
|
+
import "@radix-ui/react-menubar";
|
|
34
|
+
import "@radix-ui/react-hover-card";
|
|
35
|
+
import "@radix-ui/react-select";
|
|
36
|
+
import "@radix-ui/react-dropdown-menu";
|
|
37
|
+
import "@radix-ui/react-separator";
|
|
38
|
+
import "@radix-ui/react-toast";
|
|
39
|
+
import "cmdk";
|
|
40
|
+
import "@radix-ui/react-context-menu";
|
|
41
|
+
import "react-icons-picker";
|
|
42
|
+
import "react-quill";
|
|
43
|
+
import "react-hotkeys-hook";
|
|
44
|
+
import "lodash";
|
|
45
|
+
import "lucide-react";
|
|
46
|
+
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(f, { children: [
|
|
47
|
+
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
48
|
+
b,
|
|
49
|
+
{
|
|
50
|
+
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
51
|
+
/* @__PURE__ */ e.jsx(j, { className: "h-4 w-4" }),
|
|
52
|
+
" English(US)"
|
|
53
|
+
] })
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ e.jsx(N, { children: /* @__PURE__ */ e.jsxs(S, { children: [
|
|
57
|
+
/* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
|
|
58
|
+
/* @__PURE__ */ e.jsx(l, { value: "apple", children: "Apple" }),
|
|
59
|
+
/* @__PURE__ */ e.jsx(l, { value: "banana", children: "Banana" }),
|
|
60
|
+
/* @__PURE__ */ e.jsx(l, { value: "blueberry", children: "Blueberry" }),
|
|
61
|
+
/* @__PURE__ */ e.jsx(l, { value: "grapes", children: "Grapes" }),
|
|
62
|
+
/* @__PURE__ */ e.jsx(l, { value: "pineapple", children: "Pineapple" })
|
|
63
|
+
] }) })
|
|
64
|
+
] }) }), V = () => {
|
|
65
|
+
const { savePage: n, saveState: t } = y(), { t: a } = x(), i = r("hideSaveButton", !1), s = h(() => {
|
|
66
|
+
switch (t) {
|
|
67
|
+
case "SAVING":
|
|
68
|
+
return "animate-pulse bg-gray-300 text-gray-900";
|
|
69
|
+
case "SAVED":
|
|
70
|
+
return "bg-green-500 text-white hover:bg-green-600 hover:text-white";
|
|
71
|
+
default:
|
|
72
|
+
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
73
|
+
}
|
|
74
|
+
}, [t]);
|
|
75
|
+
if (i)
|
|
76
|
+
return null;
|
|
77
|
+
const u = /* @__PURE__ */ e.jsxs(
|
|
78
|
+
p,
|
|
79
|
+
{
|
|
80
|
+
disabled: t === "SAVING",
|
|
81
|
+
onClick: (d) => {
|
|
82
|
+
d.preventDefault(), n();
|
|
83
|
+
},
|
|
84
|
+
className: `flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${s}`,
|
|
85
|
+
size: "sm",
|
|
86
|
+
variant: "outline",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ e.jsx(C, { className: "text-lg" }),
|
|
89
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : a(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
94
|
+
}, E = function() {
|
|
95
|
+
const t = r("previewComponent"), [, a] = B(), { t: i } = x();
|
|
96
|
+
return t ? /* @__PURE__ */ e.jsxs(
|
|
97
|
+
p,
|
|
98
|
+
{
|
|
99
|
+
onClick: (s) => {
|
|
100
|
+
s.preventDefault(), a(!0);
|
|
101
|
+
},
|
|
102
|
+
className: "flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",
|
|
103
|
+
size: "sm",
|
|
104
|
+
variant: "outline",
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ e.jsx(g, { className: "text-xs" }),
|
|
107
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: i("Preview") })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
) : null;
|
|
111
|
+
}, we = () => {
|
|
112
|
+
const n = r("topBarComponents.left", []), t = r("topBarComponents.center", []), a = r("topBarComponents.right", []), i = r("editable", !0);
|
|
113
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
114
|
+
/* @__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(
|
|
115
|
+
n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
116
|
+
) }) }),
|
|
117
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: o.Children.toArray(
|
|
118
|
+
t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
119
|
+
) }),
|
|
120
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
121
|
+
/* @__PURE__ */ e.jsx(k, {}),
|
|
122
|
+
/* @__PURE__ */ e.jsx(E, {}),
|
|
123
|
+
/* @__PURE__ */ e.jsx(A, { orientation: "vertical" }),
|
|
124
|
+
i ? /* @__PURE__ */ e.jsx(V, {}) : null,
|
|
125
|
+
o.Children.toArray(
|
|
126
|
+
a.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] });
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
we as default
|
|
133
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),a=require("@radix-ui/react-icons"),r=require("./ChaiBuilderEditor-pWAMhLiq.cjs"),l=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("lodash-es");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.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-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-quill");require("react-hotkeys-hook");require("lodash");require("lucide-react");const p=()=>r.useBuilderProp("languages",["en"]),m=()=>p().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(a.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"})]})})]})}),j=()=>{const{savePage:u,saveState:s}=r.useSavePage(),{t:i}=l.useTranslation(),x=r.useBuilderProp("hideSaveButton",!1),t=n.useMemo(()=>{switch(s){case"SAVING":return"animate-pulse bg-gray-300 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]);if(x)return null;const o=e.jsxRuntimeExports.jsxs(r.Button,{disabled:s==="SAVING",onClick:c=>{c.preventDefault(),u()},className:`flex h-auto w-fit items-center gap-x-2 rounded-full p-1.5 px-3 ${t}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(r.FaCircleCheck,{className:"text-lg"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s==="SAVING"?"Saving...":i(s==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},d=function(){const s=r.useBuilderProp("previewComponent"),[,i]=r.usePreviewMode(),{t:x}=l.useTranslation();return s?e.jsxRuntimeExports.jsxs(r.Button,{onClick:t=>{t.preventDefault(),i(!0)},className:"flex h-auto w-fit items-center gap-x-2 rounded-full bg-gray-200 px-3 py-1",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(a.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:x("Preview")})]}):null},h=()=>{const u=r.useBuilderProp("topBarComponents.left",[]),s=r.useBuilderProp("topBarComponents.center",[]),i=r.useBuilderProp("topBarComponents.right",[]),x=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(u.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(m,{}),e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),x?e.jsxRuntimeExports.jsx(j,{}):null,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,{})})))]})]})};exports.default=h;
|
|
@@ -3,28 +3,32 @@ 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 { h as F,
|
|
6
|
+
import { h as F, b8 as K, aO as O, aP as Q, aQ as U, a6 as P, a7 as C, a8 as S, a9 as I, aa as h, ba as V, B as H } from "./ChaiBuilderEditor-ChKigulx.js";
|
|
7
7
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
|
-
import { Loader as
|
|
8
|
+
import { Loader as $ } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
import "./Functions-7jnEwJyw.js";
|
|
11
10
|
import "clsx";
|
|
12
|
-
import "
|
|
13
|
-
import "@
|
|
11
|
+
import "react-dom";
|
|
12
|
+
import "@radix-ui/react-scroll-area";
|
|
13
|
+
import "@floating-ui/react-dom";
|
|
14
14
|
import "jotai";
|
|
15
|
+
import "i18next";
|
|
16
|
+
import "react-i18next";
|
|
17
|
+
import "flagged";
|
|
15
18
|
import "./STRINGS--j49GZJP.js";
|
|
19
|
+
import "./Functions-7jnEwJyw.js";
|
|
20
|
+
import "tailwind-merge";
|
|
21
|
+
import "@chaibuilder/runtime";
|
|
16
22
|
import "./MODIFIERS-cBT31iqE.js";
|
|
17
|
-
import "./Class-6Hz2KzYb.js";
|
|
18
|
-
import "react-i18next";
|
|
19
23
|
import "@radix-ui/react-toggle";
|
|
20
24
|
import "class-variance-authority";
|
|
25
|
+
import "./Class-6Hz2KzYb.js";
|
|
21
26
|
import "@radix-ui/react-switch";
|
|
22
27
|
import "@radix-ui/react-slot";
|
|
23
28
|
import "@radix-ui/react-accordion";
|
|
24
29
|
import "@radix-ui/react-alert-dialog";
|
|
25
30
|
import "@radix-ui/react-dialog";
|
|
26
31
|
import "@radix-ui/react-label";
|
|
27
|
-
import "@radix-ui/react-scroll-area";
|
|
28
32
|
import "@radix-ui/react-tabs";
|
|
29
33
|
import "@radix-ui/react-tooltip";
|
|
30
34
|
import "@radix-ui/react-popover";
|
|
@@ -37,20 +41,21 @@ import "@radix-ui/react-toast";
|
|
|
37
41
|
import "cmdk";
|
|
38
42
|
import "@radix-ui/react-context-menu";
|
|
39
43
|
import "react-icons-picker";
|
|
40
|
-
import "react-dom";
|
|
41
44
|
import "react-quill";
|
|
42
|
-
|
|
45
|
+
import "react-hotkeys-hook";
|
|
46
|
+
import "lodash";
|
|
47
|
+
const k = async (x, g) => new Promise((o, r) => {
|
|
43
48
|
B({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
44
49
|
o(i);
|
|
45
50
|
}).catch((i) => r(i));
|
|
46
|
-
}),
|
|
51
|
+
}), Ke = ({ isModalView: x, onSelect: g }) => {
|
|
47
52
|
const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, c] = p(!1), _ = async (s) => {
|
|
48
53
|
if (d(u))
|
|
49
54
|
return;
|
|
50
55
|
let t = i + 1;
|
|
51
56
|
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
52
57
|
const m = { query: u, page: t };
|
|
53
|
-
l && (m.orientation = l), n && (m.color = n),
|
|
58
|
+
l && (m.orientation = l), n && (m.color = n), k(m, o).then((a) => {
|
|
54
59
|
var N, b, w;
|
|
55
60
|
j(t === 1 ? ((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || [] : [...r, ...((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
|
|
56
61
|
}).catch(() => {
|
|
@@ -61,7 +66,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
61
66
|
if (!d(u) && o) {
|
|
62
67
|
c(!0);
|
|
63
68
|
const s = { query: u, page: 1 };
|
|
64
|
-
l && (s.orientation = l), n && (s.color = n), v(1),
|
|
69
|
+
l && (s.orientation = l), n && (s.color = n), v(1), k(s, o).then((t) => {
|
|
65
70
|
var m, a;
|
|
66
71
|
j(((m = t == null ? void 0 : t.response) == null ? void 0 : m.results) || []), y((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), c(!1);
|
|
67
72
|
}).catch(() => {
|
|
@@ -92,10 +97,10 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
92
97
|
onChange: (s) => T(s.target.value)
|
|
93
98
|
}
|
|
94
99
|
),
|
|
95
|
-
/* @__PURE__ */ e.jsxs(
|
|
96
|
-
/* @__PURE__ */ e.jsx(
|
|
100
|
+
/* @__PURE__ */ e.jsxs(O, { children: [
|
|
101
|
+
/* @__PURE__ */ e.jsx(Q, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
97
102
|
/* @__PURE__ */ e.jsx(
|
|
98
|
-
|
|
103
|
+
U,
|
|
99
104
|
{
|
|
100
105
|
side: x ? "bottom" : "right",
|
|
101
106
|
className: "z-[9999] flex w-max items-center justify-center",
|
|
@@ -103,7 +108,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
103
108
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
104
109
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: l, onValueChange: (s) => A(s), children: [
|
|
105
110
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
106
|
-
/* @__PURE__ */ e.jsxs(
|
|
111
|
+
/* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
|
|
107
112
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
108
113
|
/* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
|
|
109
114
|
/* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
|
|
@@ -113,7 +118,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
113
118
|
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
114
119
|
/* @__PURE__ */ e.jsxs(P, { defaultValue: n, onValueChange: (s) => q(s), children: [
|
|
115
120
|
/* @__PURE__ */ e.jsx(C, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
116
|
-
/* @__PURE__ */ e.jsxs(
|
|
121
|
+
/* @__PURE__ */ e.jsxs(I, { className: "z-[9999]", children: [
|
|
117
122
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
118
123
|
[
|
|
119
124
|
"black_and_white",
|
|
@@ -136,7 +141,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
136
141
|
] })
|
|
137
142
|
] }),
|
|
138
143
|
/* @__PURE__ */ e.jsxs(
|
|
139
|
-
|
|
144
|
+
V,
|
|
140
145
|
{
|
|
141
146
|
className: `h-full ${x && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
142
147
|
children: [
|
|
@@ -173,7 +178,7 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
173
178
|
) }) }, s.id)
|
|
174
179
|
)),
|
|
175
180
|
f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
176
|
-
/* @__PURE__ */ e.jsx(
|
|
181
|
+
/* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
|
|
177
182
|
" Loading..."
|
|
178
183
|
] }),
|
|
179
184
|
!d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
|
|
@@ -193,6 +198,6 @@ const I = async (x, g) => new Promise((o, r) => {
|
|
|
193
198
|
] });
|
|
194
199
|
};
|
|
195
200
|
export {
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
Ke as default,
|
|
202
|
+
k as fetchImage
|
|
198
203
|
};
|
|
@@ -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("./ChaiBuilderEditor-pWAMhLiq.cjs"),A=require("@react-hookz/web"),T=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./STRINGS-gPz7CUOk.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.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-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-quill");require("react-hotkeys-hook");require("lodash");const E=async(d,q)=>new Promise((a,n)=>{k.createApi({accessKey:q}).search.getPhotos(d).then(u=>{a(u)}).catch(u=>n(u))}),z=({isModalView:d,onSelect:q})=>{const a=t.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[u,g]=o.useState(0),[c,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=u+1;s&&(s.preventDefault(),i=1),m(!0),g(i);const p={query:j,page:i};c&&(p.orientation=c),x&&(p.color=x),E(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};c&&(s.orientation=c),x&&(s.color=x),g(1),E(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)})}},[c,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:c,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:()=>q(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)&&u<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=E;
|