@chaibuilder/sdk 1.2.55 → 1.2.57
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-HeYXoex4.js → AddBlocks-05ZH2Suu.js} +46 -50
- package/dist/AddBlocks-MH_fqSRf.cjs +1 -0
- package/dist/{CanvasArea-CqILE5PR.js → CanvasArea-8f_Ki3B7.js} +361 -361
- package/dist/CanvasArea-UisRL54b.cjs +56 -0
- package/dist/CodeEditor-vECReGwz.cjs +1 -0
- package/dist/{CodeEditor-kxV5RCpd.js → CodeEditor-zYBqhBv3.js} +33 -39
- package/dist/CurrentPage-7aEIhzQ0.cjs +1 -0
- package/dist/{CurrentPage-IrFGAb7n.js → CurrentPage-nzo4lszx.js} +26 -25
- package/dist/ListTree-A-097CZ-.cjs +1 -0
- package/dist/{ListTree-0n_G8NJx.js → ListTree-KUGhFsb_.js} +9 -13
- package/dist/PagesPanel-L1mI3y_6.cjs +1 -0
- package/dist/{PagesPanel-RYBf0Yct.js → PagesPanel-hleqqZBo.js} +20 -19
- package/dist/ProjectPanel-HTxa1kHv.cjs +1 -0
- package/dist/{ProjectPanel-Zagx6l3Q.js → ProjectPanel-RXEhYr0a.js} +25 -24
- package/dist/Settings-7EMwx6zL.cjs +1 -0
- package/dist/{Settings-RLDTFFf8.js → Settings-b1ZuIn4y.js} +404 -395
- package/dist/{SidePanels-ao969pMV.js → SidePanels-6hZeCR5Z.js} +89 -88
- package/dist/SidePanels-_6WlMWq_.cjs +1 -0
- package/dist/ThemeConfiguration-PvMN3j6h.cjs +1 -0
- package/dist/{ThemeConfiguration-S7yArRMp.js → ThemeConfiguration-ab7lbA2y.js} +18 -24
- package/dist/Topbar-WdGZIIZp.cjs +1 -0
- package/dist/{Topbar-B8u0whpc.js → Topbar-YfsC1DZ2.js} +39 -38
- package/dist/{UILibrariesPanel-tcfz2ELp.js → UILibrariesPanel-5QxxXYg2.js} +56 -61
- package/dist/UILibrariesPanel-r8nQzXQ-.cjs +1 -0
- package/dist/{UnsplashImages-wWRifkCp.js → UnsplashImages-alt_doTy.js} +42 -47
- package/dist/UnsplashImages-cah1BRL_.cjs +1 -0
- package/dist/UploadImages-5dRETWCo.cjs +1 -0
- package/dist/{UploadImages-lUvZhW_j.js → UploadImages-JqVL_aQd.js} +32 -38
- package/dist/{add-page-modal-04b4l2zu.js → add-page-modal-CtMwNEsW.js} +29 -28
- package/dist/add-page-modal-DA5P4pVu.cjs +1 -0
- package/dist/{confirm-alert-FX5030eR.js → confirm-alert-m85JJlQi.js} +15 -21
- package/dist/confirm-alert-rYsxlfR4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +44 -43
- package/dist/delete-page-modal-AvUZI9Tk.cjs +1 -0
- package/dist/{delete-page-modal-1u9CyAIP.js → delete-page-modal-TMpN1Dvm.js} +22 -21
- package/dist/email.cjs +1 -1
- package/dist/email.js +19 -19
- package/dist/form-G3PqS2Gc.cjs +1 -0
- package/dist/{form-HRdEJjVq.js → form-MSL4CDff.js} +3 -3
- package/dist/{html-to-json-OnIZDDXw.js → html-to-json-_01DXd-a.js} +37 -36
- package/dist/html-to-json-ndxaXRT8.cjs +1 -0
- package/dist/{index-vfmO3y2d.js → index--hN9ZQsP.js} +19 -19
- package/dist/index-0FIxW0gR.cjs +1 -0
- package/dist/{ChaiBuilderEditor-tkzS851D.js → index-IgLSTkN6.js} +14660 -17763
- package/dist/index-sspgZwTk.cjs +206 -0
- package/dist/index-uLn8W3eR.js +3145 -0
- package/dist/index-zaKhyTQ6.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +17 -16
- package/dist/page-viewer-2BMSxxfd.cjs +1 -0
- package/dist/{page-viewer-dcb3u4OV.js → page-viewer-D8nsi13f.js} +27 -26
- package/dist/project-general-setting--0hX9Otn.cjs +1 -0
- package/dist/{project-general-setting--sS34seu.js → project-general-setting-HGjTNFRx.js} +23 -22
- package/dist/{project-seo-setting-8tc3I-0M.js → project-seo-setting-3kFJ77jY.js} +20 -26
- package/dist/project-seo-setting-C3ilIIeM.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +104 -102
- package/dist/single-page-detail-7BpYAyMO.cjs +1 -0
- package/dist/{single-page-detail-tP2pfgBp.js → single-page-detail-eMnjt_Ih.js} +26 -25
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +19 -18
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +144 -150
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +168 -111
- package/package.json +1 -1
- package/dist/AddBlocks-VHoZezjj.cjs +0 -1
- package/dist/CanvasArea-137WY3Wx.cjs +0 -56
- package/dist/ChaiBuilderEditor-aY8flOgX.cjs +0 -206
- package/dist/CodeEditor-R2jKe97T.cjs +0 -1
- package/dist/CurrentPage-PjrVzHXR.cjs +0 -1
- package/dist/ListTree-C6oCXZDV.cjs +0 -1
- package/dist/PagesPanel-lIC3kYmS.cjs +0 -1
- package/dist/ProjectPanel-0Siyi5YS.cjs +0 -1
- package/dist/Settings-6QRVcl16.cjs +0 -1
- package/dist/SidePanels-j1EFsBlK.cjs +0 -1
- package/dist/ThemeConfiguration-q1471P7b.cjs +0 -1
- package/dist/Topbar-ogFKKDbx.cjs +0 -1
- package/dist/UILibrariesPanel-cm9CFWxc.cjs +0 -1
- package/dist/UnsplashImages-E2L3YDJI.cjs +0 -1
- package/dist/UploadImages-s-eeaGiS.cjs +0 -1
- package/dist/add-page-modal-eroF20lO.cjs +0 -1
- package/dist/confirm-alert-XuxEzG-V.cjs +0 -1
- package/dist/delete-page-modal-pgh7sdfg.cjs +0 -1
- package/dist/form-Z4IRWj0o.cjs +0 -1
- package/dist/html-to-json-rauxDBi6.cjs +0 -1
- package/dist/index-bt7EhwLh.cjs +0 -1
- package/dist/page-viewer-O960kM2x.cjs +0 -1
- package/dist/project-general-setting-lIvNs-Vq.cjs +0 -1
- package/dist/project-seo-setting-MIlAuqcc.cjs +0 -1
- package/dist/single-page-detail-0Z_hvd_j.cjs +0 -1
- package/dist/useCanvasSettings-R0h03UfD.cjs +0 -1
- package/dist/useCanvasSettings-rEZHbw3s.js +0 -6
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import { FontFamilyIcon as j, EyeOpenIcon as
|
|
4
|
-
import { h as r,
|
|
2
|
+
import l, { useMemo as h, Suspense as c } from "react";
|
|
3
|
+
import { FontFamilyIcon as j, EyeOpenIcon as f } from "@radix-ui/react-icons";
|
|
4
|
+
import { h as r, az as g, aA as v, aB as S, aC as b, aO as N, aP as C, aD as o, Q as w, B as p, q as y, S as m, aQ as B } from "./index-uLn8W3eR.js";
|
|
5
|
+
import { F as A } from "./index-IgLSTkN6.js";
|
|
5
6
|
import { useTranslation as x } from "react-i18next";
|
|
6
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "@floating-ui/react-dom";
|
|
11
|
-
import "jotai";
|
|
12
|
-
import "i18next";
|
|
13
|
-
import "flagged";
|
|
8
|
+
import "@radix-ui/react-toggle";
|
|
9
|
+
import "class-variance-authority";
|
|
10
|
+
import "./utils-VpVqnC9m.js";
|
|
14
11
|
import "lodash-es";
|
|
15
12
|
import "./MODIFIERS-fd5XOmum.js";
|
|
16
|
-
import "
|
|
13
|
+
import "clsx";
|
|
17
14
|
import "tailwind-merge";
|
|
18
|
-
import "@chaibuilder/runtime";
|
|
19
|
-
import "@react-hookz/web";
|
|
20
|
-
import "tree-model";
|
|
21
|
-
import "./utils-VpVqnC9m.js";
|
|
22
|
-
import "@radix-ui/react-toggle";
|
|
23
|
-
import "class-variance-authority";
|
|
24
15
|
import "@radix-ui/react-switch";
|
|
25
16
|
import "@radix-ui/react-slot";
|
|
26
17
|
import "@radix-ui/react-accordion";
|
|
27
18
|
import "@radix-ui/react-alert-dialog";
|
|
28
19
|
import "@radix-ui/react-dialog";
|
|
29
20
|
import "@radix-ui/react-label";
|
|
21
|
+
import "@radix-ui/react-scroll-area";
|
|
30
22
|
import "@radix-ui/react-tabs";
|
|
31
23
|
import "@radix-ui/react-tooltip";
|
|
32
24
|
import "@radix-ui/react-popover";
|
|
@@ -39,13 +31,22 @@ import "@radix-ui/react-toast";
|
|
|
39
31
|
import "cmdk";
|
|
40
32
|
import "@radix-ui/react-context-menu";
|
|
41
33
|
import "react-icons-picker";
|
|
34
|
+
import "react-dom";
|
|
42
35
|
import "react-quill";
|
|
36
|
+
import "./Functions-7jnEwJyw.js";
|
|
37
|
+
import "@chaibuilder/runtime";
|
|
38
|
+
import "jotai";
|
|
39
|
+
import "@react-hookz/web";
|
|
40
|
+
import "tree-model";
|
|
41
|
+
import "i18next";
|
|
42
|
+
import "@floating-ui/react-dom";
|
|
43
|
+
import "flagged";
|
|
43
44
|
import "react-hotkeys-hook";
|
|
44
45
|
import "lucide-react";
|
|
45
46
|
import "./index-VBXQixVm.js";
|
|
46
|
-
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(
|
|
47
|
+
const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ e.jsxs(g, { children: [
|
|
47
48
|
/* @__PURE__ */ e.jsx(v, { className: "w-[150px] border-0", children: /* @__PURE__ */ e.jsx(
|
|
48
|
-
|
|
49
|
+
S,
|
|
49
50
|
{
|
|
50
51
|
placeholder: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
51
52
|
/* @__PURE__ */ e.jsx(j, { className: "h-4 w-4" }),
|
|
@@ -53,16 +54,16 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
53
54
|
] })
|
|
54
55
|
}
|
|
55
56
|
) }),
|
|
56
|
-
/* @__PURE__ */ e.jsx(
|
|
57
|
-
/* @__PURE__ */ e.jsx(
|
|
58
|
-
/* @__PURE__ */ e.jsx(
|
|
59
|
-
/* @__PURE__ */ e.jsx(
|
|
60
|
-
/* @__PURE__ */ e.jsx(
|
|
61
|
-
/* @__PURE__ */ e.jsx(
|
|
62
|
-
/* @__PURE__ */ e.jsx(
|
|
57
|
+
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
58
|
+
/* @__PURE__ */ e.jsx(C, { children: "Fruits" }),
|
|
59
|
+
/* @__PURE__ */ e.jsx(o, { value: "apple", children: "Apple" }),
|
|
60
|
+
/* @__PURE__ */ e.jsx(o, { value: "banana", children: "Banana" }),
|
|
61
|
+
/* @__PURE__ */ e.jsx(o, { value: "blueberry", children: "Blueberry" }),
|
|
62
|
+
/* @__PURE__ */ e.jsx(o, { value: "grapes", children: "Grapes" }),
|
|
63
|
+
/* @__PURE__ */ e.jsx(o, { value: "pineapple", children: "Pineapple" })
|
|
63
64
|
] }) })
|
|
64
|
-
] }) }),
|
|
65
|
-
const { savePage: n, saveState: t } =
|
|
65
|
+
] }) }), I = () => {
|
|
66
|
+
const { savePage: n, saveState: t } = w(), { t: a } = x(), i = r("hideSaveButton", !1), s = h(() => {
|
|
66
67
|
switch (t) {
|
|
67
68
|
case "SAVING":
|
|
68
69
|
return "animate-pulse bg-gray-300 text-gray-900";
|
|
@@ -85,14 +86,14 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
85
86
|
size: "sm",
|
|
86
87
|
variant: "outline",
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */ e.jsx(
|
|
89
|
+
/* @__PURE__ */ e.jsx(A, { className: "text-lg" }),
|
|
89
90
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : a(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
90
91
|
]
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
94
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
94
|
-
},
|
|
95
|
-
const t = r("previewComponent"), [, a] =
|
|
95
|
+
}, V = function() {
|
|
96
|
+
const t = r("previewComponent"), [, a] = y(), { t: i } = x();
|
|
96
97
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
97
98
|
p,
|
|
98
99
|
{
|
|
@@ -103,7 +104,7 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
103
104
|
size: "sm",
|
|
104
105
|
variant: "outline",
|
|
105
106
|
children: [
|
|
106
|
-
/* @__PURE__ */ e.jsx(
|
|
107
|
+
/* @__PURE__ */ e.jsx(f, { className: "text-xs" }),
|
|
107
108
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: i("Preview") })
|
|
108
109
|
]
|
|
109
110
|
}
|
|
@@ -111,18 +112,18 @@ const P = () => r("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
111
112
|
}, we = () => {
|
|
112
113
|
const n = r("topBarComponents.left", []), t = r("topBarComponents.center", []), a = r("topBarComponents.right", []), i = r("editable", !0);
|
|
113
114
|
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:
|
|
115
|
+
/* @__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: l.Children.toArray(
|
|
115
116
|
n.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
116
117
|
) }) }),
|
|
117
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children:
|
|
118
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: l.Children.toArray(
|
|
118
119
|
t.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
119
120
|
) }),
|
|
120
121
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
121
122
|
/* @__PURE__ */ e.jsx(k, {}),
|
|
122
|
-
/* @__PURE__ */ e.jsx(
|
|
123
|
-
/* @__PURE__ */ e.jsx(
|
|
124
|
-
i ? /* @__PURE__ */ e.jsx(
|
|
125
|
-
|
|
123
|
+
/* @__PURE__ */ e.jsx(V, {}),
|
|
124
|
+
/* @__PURE__ */ e.jsx(B, { orientation: "vertical" }),
|
|
125
|
+
i ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
126
|
+
l.Children.toArray(
|
|
126
127
|
a.map((s) => /* @__PURE__ */ e.jsx(c, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
|
|
127
128
|
)
|
|
128
129
|
] })
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import { noop as N, has as w, first as j, isEmpty as I, get as b, values as A, groupBy as P, map as E, capitalize as T } from "lodash-es";
|
|
3
3
|
import * as U from "react";
|
|
4
|
-
import B, { useState as C, useCallback as
|
|
5
|
-
import {
|
|
6
|
-
import { syncBlocksWithDefaults as ee, useChaiBlocks as
|
|
7
|
-
import { Loader as
|
|
4
|
+
import B, { useState as C, useCallback as _, useEffect as R, useRef as z } from "react";
|
|
5
|
+
import { b8 as G, b9 as M, B as O, ba as F, bb as W, bc as $, bd as D, be as H, bf as J, bg as K, h as v, a2 as Y, r as q, o as Q, aJ as V, S as X, br as Z } from "./index-uLn8W3eR.js";
|
|
6
|
+
import { syncBlocksWithDefaults as ee, useChaiBlocks as se } from "@chaibuilder/runtime";
|
|
7
|
+
import { Loader as te } from "lucide-react";
|
|
8
8
|
import { atom as oe, useAtom as k } from "jotai";
|
|
9
9
|
import { c as y } from "./Functions-7jnEwJyw.js";
|
|
10
10
|
import { CaretSortIcon as re, CheckIcon as ae, CaretRightIcon as ne } from "@radix-ui/react-icons";
|
|
11
|
-
import { O as
|
|
11
|
+
import { O as le } from "./MODIFIERS-fd5XOmum.js";
|
|
12
12
|
import { useTranslation as L } from "react-i18next";
|
|
13
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";
|
|
20
|
-
import "@react-hookz/web";
|
|
21
|
-
import "tree-model";
|
|
22
|
-
import "./utils-VpVqnC9m.js";
|
|
23
|
-
import "tailwind-merge";
|
|
24
14
|
import "@radix-ui/react-toggle";
|
|
25
15
|
import "class-variance-authority";
|
|
16
|
+
import "./utils-VpVqnC9m.js";
|
|
17
|
+
import "clsx";
|
|
18
|
+
import "tailwind-merge";
|
|
26
19
|
import "@radix-ui/react-switch";
|
|
27
20
|
import "@radix-ui/react-slot";
|
|
28
21
|
import "@radix-ui/react-accordion";
|
|
29
22
|
import "@radix-ui/react-alert-dialog";
|
|
30
23
|
import "@radix-ui/react-dialog";
|
|
31
24
|
import "@radix-ui/react-label";
|
|
25
|
+
import "@radix-ui/react-scroll-area";
|
|
32
26
|
import "@radix-ui/react-tabs";
|
|
33
27
|
import "@radix-ui/react-tooltip";
|
|
34
28
|
import "@radix-ui/react-popover";
|
|
@@ -41,44 +35,45 @@ import "@radix-ui/react-toast";
|
|
|
41
35
|
import "cmdk";
|
|
42
36
|
import "@radix-ui/react-context-menu";
|
|
43
37
|
import "react-icons-picker";
|
|
38
|
+
import "react-dom";
|
|
44
39
|
import "react-quill";
|
|
45
|
-
import "react-
|
|
46
|
-
import "
|
|
47
|
-
function
|
|
48
|
-
uiLibraries:
|
|
40
|
+
import "@react-hookz/web";
|
|
41
|
+
import "tree-model";
|
|
42
|
+
function ie({
|
|
43
|
+
uiLibraries: s,
|
|
49
44
|
library: r,
|
|
50
45
|
setLibrary: a
|
|
51
46
|
}) {
|
|
52
|
-
var
|
|
53
|
-
const [
|
|
54
|
-
return r ? /* @__PURE__ */ e.jsxs(G, { open:
|
|
47
|
+
var i;
|
|
48
|
+
const [l, n] = U.useState(!1), { t } = L();
|
|
49
|
+
return r ? /* @__PURE__ */ e.jsxs(G, { open: l, onOpenChange: n, children: [
|
|
55
50
|
/* @__PURE__ */ e.jsx(M, { asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
56
|
-
/* @__PURE__ */ e.jsx("span", { children:
|
|
51
|
+
/* @__PURE__ */ e.jsx("span", { children: t("Choose Library") }),
|
|
57
52
|
/* @__PURE__ */ e.jsxs(
|
|
58
53
|
O,
|
|
59
54
|
{
|
|
60
55
|
variant: "outline",
|
|
61
56
|
size: "sm",
|
|
62
57
|
role: "combobox",
|
|
63
|
-
"aria-expanded":
|
|
58
|
+
"aria-expanded": l,
|
|
64
59
|
className: "w-[200px] justify-between",
|
|
65
60
|
children: [
|
|
66
|
-
r ? (
|
|
61
|
+
r ? (i = s.find((o) => o.uuid === r)) == null ? void 0 : i.name : t("Select library"),
|
|
67
62
|
/* @__PURE__ */ e.jsx(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
68
63
|
]
|
|
69
64
|
}
|
|
70
65
|
)
|
|
71
66
|
] }) }),
|
|
72
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
74
|
-
/* @__PURE__ */ e.jsxs(
|
|
75
|
-
/* @__PURE__ */ e.jsx(
|
|
76
|
-
/* @__PURE__ */ e.jsx(
|
|
67
|
+
/* @__PURE__ */ e.jsx(F, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(W, { children: [
|
|
68
|
+
/* @__PURE__ */ e.jsx($, { placeholder: "Search library...", className: "h-9" }),
|
|
69
|
+
/* @__PURE__ */ e.jsxs(D, { children: [
|
|
70
|
+
/* @__PURE__ */ e.jsx(H, { children: "No library found." }),
|
|
71
|
+
/* @__PURE__ */ e.jsx(J, { children: s.map((o) => /* @__PURE__ */ e.jsxs(
|
|
77
72
|
K,
|
|
78
73
|
{
|
|
79
74
|
value: o.uuid,
|
|
80
|
-
onSelect: (
|
|
81
|
-
a(
|
|
75
|
+
onSelect: (m) => {
|
|
76
|
+
a(m), n(!1);
|
|
82
77
|
},
|
|
83
78
|
children: [
|
|
84
79
|
o.name,
|
|
@@ -97,64 +92,64 @@ function le({
|
|
|
97
92
|
] }) : null;
|
|
98
93
|
}
|
|
99
94
|
const ce = ({
|
|
100
|
-
block:
|
|
95
|
+
block: s,
|
|
101
96
|
closePopover: r,
|
|
102
97
|
library: a
|
|
103
98
|
}) => {
|
|
104
|
-
const [
|
|
99
|
+
const [l, n] = C(!1), t = v("getUILibraryBlock", N), { addCoreBlock: i, addPredefinedBlock: o } = Y(), [m] = q(), f = (p) => {
|
|
105
100
|
const u = w(p, "styles_attrs.data-page-section");
|
|
106
101
|
return p._type === "Box" && u;
|
|
107
|
-
}, h =
|
|
102
|
+
}, h = _(
|
|
108
103
|
async (p) => {
|
|
109
|
-
if (p.stopPropagation(), w(
|
|
110
|
-
|
|
104
|
+
if (p.stopPropagation(), w(s, "component")) {
|
|
105
|
+
i(s, j(m)), r();
|
|
111
106
|
return;
|
|
112
107
|
}
|
|
113
108
|
n(!0);
|
|
114
|
-
const u = await
|
|
115
|
-
let g = j(
|
|
109
|
+
const u = await t(a, s);
|
|
110
|
+
let g = j(m);
|
|
116
111
|
f(j(u)) && (g = null), I(u) || o(ee(u), g), r();
|
|
117
112
|
},
|
|
118
|
-
[
|
|
113
|
+
[s]
|
|
119
114
|
);
|
|
120
115
|
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
121
116
|
"div",
|
|
122
117
|
{
|
|
123
|
-
onClick:
|
|
118
|
+
onClick: l ? () => {
|
|
124
119
|
} : h,
|
|
125
120
|
className: "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",
|
|
126
121
|
children: [
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */ e.jsx(
|
|
122
|
+
l && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
|
|
123
|
+
/* @__PURE__ */ e.jsx(te, { className: "animate-spin", size: 15, color: "white" }),
|
|
129
124
|
" ",
|
|
130
125
|
/* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
|
|
131
126
|
] }),
|
|
132
|
-
|
|
127
|
+
s.preview ? /* @__PURE__ */ e.jsx("img", { src: s.preview, className: "min-h-[25px] w-full rounded-md", alt: s.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.name }) })
|
|
133
128
|
]
|
|
134
129
|
}
|
|
135
130
|
) });
|
|
136
|
-
},
|
|
137
|
-
const [r, a] = k(
|
|
138
|
-
return
|
|
131
|
+
}, de = oe({}), me = (s) => {
|
|
132
|
+
const [r, a] = k(de), l = v("getUILibraryBlocks", N), n = b(r, `${s == null ? void 0 : s.uuid}.blocks`, []), t = b(r, `${s == null ? void 0 : s.uuid}.loading`, !1);
|
|
133
|
+
return R(() => {
|
|
139
134
|
(async () => {
|
|
140
|
-
if (
|
|
135
|
+
if (t || n.length > 0)
|
|
141
136
|
return;
|
|
142
|
-
a((o) => ({ ...o, [
|
|
143
|
-
const
|
|
144
|
-
a((o) => ({ ...o, [
|
|
137
|
+
a((o) => ({ ...o, [s == null ? void 0 : s.uuid]: { loading: !0, blocks: [] } }));
|
|
138
|
+
const i = await l(s);
|
|
139
|
+
a((o) => ({ ...o, [s == null ? void 0 : s.uuid]: { loading: !1, blocks: i || [] } }));
|
|
145
140
|
})();
|
|
146
|
-
}, [
|
|
147
|
-
}, ue =
|
|
148
|
-
const [
|
|
141
|
+
}, [s, n, t]), { data: n, isLoading: t };
|
|
142
|
+
}, ue = Q("_selectedLibrary", null), pe = () => {
|
|
143
|
+
const [s, r] = k(ue), a = v("uiLibraries", []), l = se(), n = A(l).filter((d) => d.category === "custom"), t = a.find((d) => d.uuid === s) || j(a), { data: i, isLoading: o } = me(t), m = P([...i, ...n], "group"), [f, h] = C("Hero"), [, p] = k(V), u = b(m, f, []), { t: g } = L(), c = z(null), S = (d) => {
|
|
149
144
|
c.current && (clearTimeout(c.current), c.current = null), c.current = setTimeout(() => {
|
|
150
|
-
c.current && h(
|
|
145
|
+
c.current && h(d);
|
|
151
146
|
}, 300);
|
|
152
147
|
};
|
|
153
|
-
return o ? /* @__PURE__ */ e.jsx(
|
|
154
|
-
|
|
148
|
+
return o ? /* @__PURE__ */ e.jsx(X, { className: "h-full w-full" }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background", children: [
|
|
149
|
+
t != null && t.uuid ? /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex h-fit flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col", children: /* @__PURE__ */ e.jsx(ie, { library: t == null ? void 0 : t.uuid, setLibrary: r, uiLibraries: a }) }) }) }) : null,
|
|
155
150
|
/* @__PURE__ */ e.jsxs("div", { className: "flex h-[95%] border-t border-gray-300 pt-2", children: [
|
|
156
151
|
/* @__PURE__ */ e.jsx("div", { className: "flex h-full w-40 flex-col gap-1 px-1", children: B.Children.toArray(
|
|
157
|
-
E(
|
|
152
|
+
E(m, (d, x) => /* @__PURE__ */ e.jsxs(
|
|
158
153
|
"div",
|
|
159
154
|
{
|
|
160
155
|
onMouseEnter: () => S(x),
|
|
@@ -180,7 +175,7 @@ const ce = ({
|
|
|
180
175
|
children: [
|
|
181
176
|
/* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500", children: g("Click on a block to add it to the page") }),
|
|
182
177
|
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2 px-2", children: B.Children.toArray(
|
|
183
|
-
u.map((
|
|
178
|
+
u.map((d) => /* @__PURE__ */ e.jsx(ce, { block: d, library: t, closePopover: () => p(le) }))
|
|
184
179
|
) }),
|
|
185
180
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
186
181
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -190,7 +185,7 @@ const ce = ({
|
|
|
190
185
|
)
|
|
191
186
|
] })
|
|
192
187
|
] }) });
|
|
193
|
-
},
|
|
188
|
+
}, es = () => /* @__PURE__ */ e.jsx(pe, {});
|
|
194
189
|
export {
|
|
195
|
-
|
|
190
|
+
es as default
|
|
196
191
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("lodash-es"),m=require("react"),t=require("./index-0FIxW0gR.cjs"),v=require("@chaibuilder/runtime"),N=require("lucide-react"),b=require("jotai"),k=require("./Functions-N3yhPYKY.cjs"),q=require("@radix-ui/react-icons"),y=require("./MODIFIERS-mVmfEGgo.cjs"),w=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.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("@react-hookz/web");require("tree-model");function C(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const i in s)if(i!=="default"){const c=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(n,i,c.get?c:{enumerable:!0,get:()=>s[i]})}}return n.default=s,Object.freeze(n)}const S=C(m);function I({uiLibraries:s,library:n,setLibrary:i}){var a;const[c,l]=S.useState(!1),{t:r}=w.useTranslation();return n?e.jsxRuntimeExports.jsxs(t.Popover,{open:c,onOpenChange:l,children:[e.jsxRuntimeExports.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Choose Library")}),e.jsxRuntimeExports.jsxs(t.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":c,className:"w-[200px] justify-between",children:[n?(a=s.find(u=>u.uuid===n))==null?void 0:a.name:r("Select library"),e.jsxRuntimeExports.jsx(q.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(t.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(t.Command,{children:[e.jsxRuntimeExports.jsx(t.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(t.CommandList,{children:[e.jsxRuntimeExports.jsx(t.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(t.CommandGroup,{children:s.map(u=>e.jsxRuntimeExports.jsxs(t.CommandItem,{value:u.uuid,onSelect:p=>{i(p),l(!1)},children:[u.name,e.jsxRuntimeExports.jsx(q.CheckIcon,{className:k.cn("ml-auto h-4 w-4",n===u.uuid?"opacity-100":"opacity-0")})]},u.uuid))})]})]})})]}):null}const L=({block:s,closePopover:n,library:i})=>{const[c,l]=m.useState(!1),r=t.useBuilderProp("getUILibraryBlock",o.noop),{addCoreBlock:a,addPredefinedBlock:u}=t.useAddBlock(),[p]=t.useSelectedBlockIds(),g=f=>{const j=o.has(f,"styles_attrs.data-page-section");return f._type==="Box"&&j},E=m.useCallback(async f=>{if(f.stopPropagation(),o.has(s,"component")){a(s,o.first(p)),n();return}l(!0);const j=await r(i,s);let R=o.first(p);g(o.first(j))&&(R=null),o.isEmpty(j)||u(v.syncBlocksWithDefaults(j),R),n()},[s]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:c?()=>{}:E,className:"relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",children:[c&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),s.preview?e.jsxRuntimeExports.jsx("img",{src:s.preview,className:"min-h-[25px] w-full rounded-md",alt:s.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:s.name})})]})})},P=b.atom({}),A=s=>{const[n,i]=b.useAtom(P),c=t.useBuilderProp("getUILibraryBlocks",o.noop),l=o.get(n,`${s==null?void 0:s.uuid}.blocks`,[]),r=o.get(n,`${s==null?void 0:s.uuid}.loading`,!1);return m.useEffect(()=>{(async()=>{if(r||l.length>0)return;i(u=>({...u,[s==null?void 0:s.uuid]:{loading:!0,blocks:[]}}));const a=await c(s);i(u=>({...u,[s==null?void 0:s.uuid]:{loading:!1,blocks:a||[]}}))})()},[s,l,r]),{data:l,isLoading:r}},T=t.atomWithStorage("_selectedLibrary",null),O=()=>{const[s,n]=b.useAtom(T),i=t.useBuilderProp("uiLibraries",[]),c=v.useChaiBlocks(),l=o.values(c).filter(d=>d.category==="custom"),r=i.find(d=>d.uuid===s)||o.first(i),{data:a,isLoading:u}=A(r),p=o.groupBy([...a,...l],"group"),[g,E]=m.useState("Hero"),[,f]=b.useAtom(t.activePanelAtom),j=o.get(p,g,[]),{t:R}=w.useTranslation(),x=m.useRef(null),B=d=>{x.current&&(clearTimeout(x.current),x.current=null),x.current=setTimeout(()=>{x.current&&E(d)},300)};return u?e.jsxRuntimeExports.jsx(t.Skeleton,{className:"h-full w-full"}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background",children:[r!=null&&r.uuid?e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex h-fit flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col",children:e.jsxRuntimeExports.jsx(I,{library:r==null?void 0:r.uuid,setLibrary:n,uiLibraries:i})})})}):null,e.jsxRuntimeExports.jsxs("div",{className:"flex h-[95%] border-t border-gray-300 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-40 flex-col gap-1 px-1",children:m.Children.toArray(o.map(p,(d,h)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>B(h),onMouseLeave:()=>clearTimeout(x.current),onClick:()=>E(h),className:k.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",h===g?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:o.capitalize(h)}),e.jsxRuntimeExports.jsx(q.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},h)))}),e.jsxRuntimeExports.jsxs(t.ScrollArea,{onMouseEnter:()=>x.current?clearTimeout(x.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500",children:R("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:m.Children.toArray(j.map(d=>e.jsxRuntimeExports.jsx(L,{block:d,library:r,closePopover:()=>f(y.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},_=()=>e.jsxRuntimeExports.jsx(O,{});exports.default=_;
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { useState as p, useEffect as
|
|
3
|
-
import { isEmpty as d, startCase as
|
|
4
|
-
import { MixerHorizontalIcon as
|
|
5
|
-
import { createApi as
|
|
6
|
-
import { h as F,
|
|
7
|
-
import { useDebouncedState as
|
|
2
|
+
import { useState as p, useEffect as _ } from "react";
|
|
3
|
+
import { isEmpty as d, startCase as B } from "lodash-es";
|
|
4
|
+
import { MixerHorizontalIcon as E } from "@radix-ui/react-icons";
|
|
5
|
+
import { createApi as L } from "unsplash-js";
|
|
6
|
+
import { h as F, bp as K, b8 as U, b9 as V, ba as O, az as C, aA as P, aB as S, aC as A, aD as h, br as Q, B as H } from "./index-uLn8W3eR.js";
|
|
7
|
+
import { useDebouncedState as R } from "@react-hookz/web";
|
|
8
8
|
import { Loader as $ } from "lucide-react";
|
|
9
9
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
import "clsx";
|
|
11
|
-
import "react-dom";
|
|
12
|
-
import "@radix-ui/react-scroll-area";
|
|
13
|
-
import "@floating-ui/react-dom";
|
|
14
|
-
import "jotai";
|
|
15
|
-
import "i18next";
|
|
16
|
-
import "react-i18next";
|
|
17
|
-
import "flagged";
|
|
18
|
-
import "./MODIFIERS-fd5XOmum.js";
|
|
19
|
-
import "./Functions-7jnEwJyw.js";
|
|
20
|
-
import "tailwind-merge";
|
|
21
|
-
import "@chaibuilder/runtime";
|
|
22
|
-
import "tree-model";
|
|
23
|
-
import "./utils-VpVqnC9m.js";
|
|
24
10
|
import "@radix-ui/react-toggle";
|
|
25
11
|
import "class-variance-authority";
|
|
12
|
+
import "./utils-VpVqnC9m.js";
|
|
13
|
+
import "./MODIFIERS-fd5XOmum.js";
|
|
14
|
+
import "clsx";
|
|
15
|
+
import "tailwind-merge";
|
|
26
16
|
import "@radix-ui/react-switch";
|
|
27
17
|
import "@radix-ui/react-slot";
|
|
28
18
|
import "@radix-ui/react-accordion";
|
|
29
19
|
import "@radix-ui/react-alert-dialog";
|
|
30
20
|
import "@radix-ui/react-dialog";
|
|
31
21
|
import "@radix-ui/react-label";
|
|
22
|
+
import "@radix-ui/react-scroll-area";
|
|
32
23
|
import "@radix-ui/react-tabs";
|
|
33
24
|
import "@radix-ui/react-tooltip";
|
|
34
25
|
import "@radix-ui/react-popover";
|
|
@@ -41,32 +32,36 @@ import "@radix-ui/react-toast";
|
|
|
41
32
|
import "cmdk";
|
|
42
33
|
import "@radix-ui/react-context-menu";
|
|
43
34
|
import "react-icons-picker";
|
|
35
|
+
import "react-dom";
|
|
44
36
|
import "react-quill";
|
|
45
|
-
import "
|
|
46
|
-
import "
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
import "./Functions-7jnEwJyw.js";
|
|
38
|
+
import "@chaibuilder/runtime";
|
|
39
|
+
import "jotai";
|
|
40
|
+
import "tree-model";
|
|
41
|
+
import "react-i18next";
|
|
42
|
+
const I = async (x, g) => new Promise((o, r) => {
|
|
43
|
+
L({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
49
44
|
o(i);
|
|
50
45
|
}).catch((i) => r(i));
|
|
51
|
-
}),
|
|
52
|
-
const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l,
|
|
46
|
+
}), _e = ({ isModalView: x, onSelect: g }) => {
|
|
47
|
+
const o = F("unsplashAccessKey", ""), [r, j] = p([]), [i, v] = p(0), [l, k] = p(), [n, q] = p(), [z, y] = p(0), [u, D] = R("", 1e3), [f, c] = p(!1), T = async (s) => {
|
|
53
48
|
if (d(u))
|
|
54
49
|
return;
|
|
55
50
|
let t = i + 1;
|
|
56
51
|
s && (s.preventDefault(), t = 1), c(!0), v(t);
|
|
57
52
|
const m = { query: u, page: t };
|
|
58
|
-
l && (m.orientation = l), n && (m.color = n),
|
|
59
|
-
var
|
|
60
|
-
j(t === 1 ? ((
|
|
53
|
+
l && (m.orientation = l), n && (m.color = n), I(m, o).then((a) => {
|
|
54
|
+
var b, N, w;
|
|
55
|
+
j(t === 1 ? ((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || [] : [...r, ...((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || []]), y((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), c(!1);
|
|
61
56
|
}).catch(() => {
|
|
62
57
|
c(!1);
|
|
63
58
|
});
|
|
64
59
|
};
|
|
65
|
-
return
|
|
60
|
+
return _(() => {
|
|
66
61
|
if (!d(u) && o) {
|
|
67
62
|
c(!0);
|
|
68
63
|
const s = { query: u, page: 1 };
|
|
69
|
-
l && (s.orientation = l), n && (s.color = n), v(1),
|
|
64
|
+
l && (s.orientation = l), n && (s.color = n), v(1), I(s, o).then((t) => {
|
|
70
65
|
var m, a;
|
|
71
66
|
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);
|
|
72
67
|
}).catch(() => {
|
|
@@ -94,21 +89,21 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
94
89
|
name: "query",
|
|
95
90
|
className: "input",
|
|
96
91
|
placeholder: 'Try "dog" or "apple"',
|
|
97
|
-
onChange: (s) =>
|
|
92
|
+
onChange: (s) => D(s.target.value)
|
|
98
93
|
}
|
|
99
94
|
),
|
|
100
|
-
/* @__PURE__ */ e.jsxs(
|
|
101
|
-
/* @__PURE__ */ e.jsx(
|
|
95
|
+
/* @__PURE__ */ e.jsxs(U, { children: [
|
|
96
|
+
/* @__PURE__ */ e.jsx(V, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(E, {}) }),
|
|
102
97
|
/* @__PURE__ */ e.jsx(
|
|
103
|
-
|
|
98
|
+
O,
|
|
104
99
|
{
|
|
105
100
|
side: x ? "bottom" : "right",
|
|
106
101
|
className: "z-[9999] flex w-max items-center justify-center",
|
|
107
102
|
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
108
103
|
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
109
|
-
/* @__PURE__ */ e.jsxs(
|
|
110
|
-
/* @__PURE__ */ e.jsx(
|
|
111
|
-
/* @__PURE__ */ e.jsxs(
|
|
104
|
+
/* @__PURE__ */ e.jsxs(C, { defaultValue: l, onValueChange: (s) => k(s), children: [
|
|
105
|
+
/* @__PURE__ */ e.jsx(P, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
106
|
+
/* @__PURE__ */ e.jsxs(A, { className: "z-[9999]", children: [
|
|
112
107
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
113
108
|
/* @__PURE__ */ e.jsx(h, { value: "landscape", children: "Landscape" }),
|
|
114
109
|
/* @__PURE__ */ e.jsx(h, { value: "portrait", children: "Portrait" }),
|
|
@@ -116,9 +111,9 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
116
111
|
] })
|
|
117
112
|
] }),
|
|
118
113
|
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
119
|
-
/* @__PURE__ */ e.jsxs(
|
|
120
|
-
/* @__PURE__ */ e.jsx(
|
|
121
|
-
/* @__PURE__ */ e.jsxs(
|
|
114
|
+
/* @__PURE__ */ e.jsxs(C, { defaultValue: n, onValueChange: (s) => q(s), children: [
|
|
115
|
+
/* @__PURE__ */ e.jsx(P, { className: "h-auto w-40 p-1 px-3", children: /* @__PURE__ */ e.jsx(S, { placeholder: "Select" }) }),
|
|
116
|
+
/* @__PURE__ */ e.jsxs(A, { className: "z-[9999]", children: [
|
|
122
117
|
/* @__PURE__ */ e.jsx(h, { value: "", children: "All" }),
|
|
123
118
|
[
|
|
124
119
|
"black_and_white",
|
|
@@ -132,7 +127,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
132
127
|
"green",
|
|
133
128
|
"teal",
|
|
134
129
|
"blue"
|
|
135
|
-
].map((s) => /* @__PURE__ */ e.jsx(h, { value: s, children:
|
|
130
|
+
].map((s) => /* @__PURE__ */ e.jsx(h, { value: s, children: B(s) }, s))
|
|
136
131
|
] })
|
|
137
132
|
] })
|
|
138
133
|
] })
|
|
@@ -141,7 +136,7 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
141
136
|
] })
|
|
142
137
|
] }),
|
|
143
138
|
/* @__PURE__ */ e.jsxs(
|
|
144
|
-
|
|
139
|
+
Q,
|
|
145
140
|
{
|
|
146
141
|
className: `h-full ${x && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
147
142
|
children: [
|
|
@@ -182,12 +177,12 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
182
177
|
" Loading..."
|
|
183
178
|
] }),
|
|
184
179
|
!d(r) && i < z && !f && /* @__PURE__ */ e.jsx(
|
|
185
|
-
|
|
180
|
+
H,
|
|
186
181
|
{
|
|
187
182
|
size: "sm",
|
|
188
183
|
variant: "link",
|
|
189
184
|
className: "w-full",
|
|
190
|
-
onClick: () =>
|
|
185
|
+
onClick: () => T(void 0),
|
|
191
186
|
disabled: f,
|
|
192
187
|
children: f ? "" : "Load More"
|
|
193
188
|
}
|
|
@@ -198,6 +193,6 @@ const k = async (x, g) => new Promise((o, r) => {
|
|
|
198
193
|
] });
|
|
199
194
|
};
|
|
200
195
|
export {
|
|
201
|
-
|
|
202
|
-
|
|
196
|
+
_e as default,
|
|
197
|
+
I as fetchImage
|
|
203
198
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),o=require("react"),l=require("lodash-es"),C=require("@radix-ui/react-icons"),k=require("unsplash-js"),t=require("./index-0FIxW0gR.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-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("tree-model");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"),m=require("@radix-ui/react-icons"),E=require("jotai"),p=require("./index-0FIxW0gR.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("react-i18next");const N=E.atom([]),I=({isModalView:t,onSelect:a})=>{const j=p.useBuilderProp("uploadMediaCallback"),u=p.useBuilderProp("fetchMediaCallback"),[i,x]=E.useAtom(N),[n,f]=s.useState(!1),[h,g]=s.useState(!1),[c,d]=s.useState(),[b,R]=s.useState("");s.useEffect(()=>{(async()=>{if(!u)return;g(!0);const r=await u();x(r||[]),g(!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&&d(r.target.files[0])},y=async()=>{if(j){f(!0);try{const{url:r}=await j(c);a(r),d(void 0);const o=await u();x(o)}catch(r){x([]),R((r==null?void 0:r.message)||"Something went wrong.")}f(!1)}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?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(c),alt:"",className:"h-auto max-h-96 w-full max-w-sm rounded-md object-contain"}),b&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:b}),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(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.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:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.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(p.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;
|