@chaibuilder/sdk 1.2.67 → 1.2.69
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/CodeEditor-hWn_HIZX.cjs +1 -0
- package/dist/{CodeEditor-q5unEaUI.js → CodeEditor-j7qNDNkC.js} +18 -14
- package/dist/STRINGS-hZpwIZMT.cjs +1 -0
- package/dist/STRINGS-rPGH65PW.js +8 -0
- package/dist/Topbar-MIYSo6jN.cjs +1 -0
- package/dist/{Topbar-kVBx7pp4.js → Topbar-Mfc4KKxc.js} +28 -26
- package/dist/{UnsplashImages-sotLcz6r.js → UnsplashImages-KIgzZx57.js} +30 -26
- package/dist/UnsplashImages-zco6ruqn.cjs +1 -0
- package/dist/{UploadImages-I0QQ6vj1.js → UploadImages-sygXbTXU.js} +18 -14
- package/dist/UploadImages-znUxJ9OD.cjs +1 -0
- package/dist/context-menu-Lx_MAqsu.cjs +1 -0
- package/dist/{context-menu-sks9vdzC.js → context-menu-zu6r7B6f.js} +298 -311
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -1
- package/dist/core.js +88 -80
- package/dist/{index-5hfuDpYs.cjs → index-FpYnmYj7.cjs} +23 -23
- package/dist/{index-Zu-K_BX7.js → index-T7WZImL0.js} +5639 -4980
- package/dist/render.cjs +1 -1
- package/dist/render.js +1 -1
- package/dist/{select-JW3OMYm-.js → select-1WwjQDp6.js} +1 -1
- package/dist/{select-fXj5tdMX.cjs → select-FnytvxNn.cjs} +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +5 -5
- package/dist/ui.js +251 -215
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +385 -392
- package/package.json +1 -1
- package/dist/AddBlocks-TVOOPK2w.cjs +0 -1
- package/dist/AddBlocks-mbuhydG3.js +0 -123
- package/dist/CanvasArea-KJMcis97.cjs +0 -1
- package/dist/CanvasArea-kg3Rgg9t.js +0 -136
- package/dist/CodeEditor-QP6l0mv4.cjs +0 -1
- package/dist/STRINGS--j49GZJP.js +0 -7
- package/dist/STRINGS-gPz7CUOk.cjs +0 -1
- package/dist/SettingsPanel-MWeQjDWs.cjs +0 -1
- package/dist/SettingsPanel-pomLrOxB.js +0 -81
- package/dist/SidePanels-9sbERNEv.cjs +0 -1
- package/dist/SidePanels-YpRrvfiH.js +0 -406
- package/dist/Topbar-veJ2_blW.cjs +0 -1
- package/dist/UILibrariesPanel-ES8YzN9C.js +0 -226
- package/dist/UILibrariesPanel-H8t36R6M.cjs +0 -1
- package/dist/UnsplashImages--MXx-DYM.cjs +0 -1
- package/dist/UploadImages-xhxeYKkl.cjs +0 -1
- package/dist/badge-7BVT3zxN.cjs +0 -1
- package/dist/badge-pJqQSA13.js +0 -23
- package/dist/context-menu-_8TFbFEJ.cjs +0 -1
- package/dist/separator-hT24N-xp.cjs +0 -1
- package/dist/separator-sgwOa1FE.js +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),b=require("@monaco-editor/react"),k=require("./context-menu-Lx_MAqsu.cjs"),C=require("react-i18next"),u=require("react"),n=require("./index-FpYnmYj7.cjs"),E=require("@radix-ui/react-icons"),R=require("@react-hookz/web");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./iconBase-vJD0OXxU.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("tree-model");require("react-quill");require("./STRINGS-hZpwIZMT.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("lucide-react");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("lodash");require("framer-motion");const a=s=>{const i=document.createElement("div");return i.innerHTML=s,i.innerHTML};function g(){const{t:s}=C.useTranslation(),[i,d]=u.useState(!1),[l,q]=u.useState(""),[r,o]=n.useCodeEditor(),[c]=n.useSelectedBlockIds(),x=n.useUpdateBlocksProps(),m=n.useUpdateBlocksPropsRealtime(),p=R.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=u.useCallback(()=>{if(i){const t=a(l);x([r.blockId],{[r.blockProp]:t})}},[i,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:s("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:s("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(k.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(E.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),q(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=g;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import k from "@monaco-editor/react";
|
|
3
|
-
import { B as C } from "./context-menu-
|
|
3
|
+
import { B as C } from "./context-menu-zu6r7B6f.js";
|
|
4
4
|
import { useTranslation as j } from "react-i18next";
|
|
5
|
-
import { useState as
|
|
6
|
-
import {
|
|
5
|
+
import { useState as l, useCallback as v, useEffect as g } from "react";
|
|
6
|
+
import { u as y, a as N, b as T, c as E } from "./index-T7WZImL0.js";
|
|
7
7
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
8
|
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
9
9
|
import "@radix-ui/react-switch";
|
|
10
10
|
import "@radix-ui/react-accordion";
|
|
11
|
-
import "class-variance-authority";
|
|
12
11
|
import "@radix-ui/react-alert-dialog";
|
|
13
12
|
import "@radix-ui/react-slot";
|
|
13
|
+
import "class-variance-authority";
|
|
14
14
|
import "@radix-ui/react-label";
|
|
15
15
|
import "@radix-ui/react-scroll-area";
|
|
16
16
|
import "@radix-ui/react-tabs";
|
|
@@ -18,6 +18,7 @@ import "@radix-ui/react-tooltip";
|
|
|
18
18
|
import "@radix-ui/react-popover";
|
|
19
19
|
import "@radix-ui/react-hover-card";
|
|
20
20
|
import "@radix-ui/react-dropdown-menu";
|
|
21
|
+
import "@radix-ui/react-separator";
|
|
21
22
|
import "@radix-ui/react-toast";
|
|
22
23
|
import "cmdk";
|
|
23
24
|
import "@radix-ui/react-dialog";
|
|
@@ -31,7 +32,7 @@ import "@chaibuilder/runtime";
|
|
|
31
32
|
import "./plugin-sJ3Hzvpv.js";
|
|
32
33
|
import "tree-model";
|
|
33
34
|
import "react-quill";
|
|
34
|
-
import "./STRINGS
|
|
35
|
+
import "./STRINGS-rPGH65PW.js";
|
|
35
36
|
import "react-hotkeys-hook";
|
|
36
37
|
import "@floating-ui/dom";
|
|
37
38
|
import "@floating-ui/react-dom";
|
|
@@ -43,6 +44,7 @@ import "tailwindcss-palette-generator";
|
|
|
43
44
|
import "react-wrap-balancer";
|
|
44
45
|
import "react-dom";
|
|
45
46
|
import "prop-types";
|
|
47
|
+
import "re-resizable";
|
|
46
48
|
import "@rjsf/validator-ajv8";
|
|
47
49
|
import "@rjsf/core";
|
|
48
50
|
import "react-arborist";
|
|
@@ -52,27 +54,29 @@ import "react-icons-picker";
|
|
|
52
54
|
import "react-autosuggest";
|
|
53
55
|
import "fuse.js";
|
|
54
56
|
import "i18next";
|
|
55
|
-
|
|
57
|
+
import "lodash";
|
|
58
|
+
import "framer-motion";
|
|
59
|
+
const a = (r) => {
|
|
56
60
|
const i = document.createElement("div");
|
|
57
61
|
return i.innerHTML = r, i.innerHTML;
|
|
58
62
|
};
|
|
59
|
-
function
|
|
60
|
-
const { t: r } = j(), [i,
|
|
63
|
+
function zt() {
|
|
64
|
+
const { t: r } = j(), [i, n] = l(!1), [m, c] = l(""), [o, s] = y(), [p] = N(), d = T(), u = E(), f = B(
|
|
61
65
|
(e) => {
|
|
62
|
-
const b =
|
|
66
|
+
const b = a(e);
|
|
63
67
|
u([o.blockId], { [o.blockProp]: b });
|
|
64
68
|
},
|
|
65
69
|
[],
|
|
66
70
|
300
|
|
67
71
|
), x = v(() => {
|
|
68
72
|
if (i) {
|
|
69
|
-
const e =
|
|
73
|
+
const e = a(m);
|
|
70
74
|
d([o.blockId], { [o.blockProp]: e });
|
|
71
75
|
}
|
|
72
76
|
}, [i, m]);
|
|
73
77
|
g(() => {
|
|
74
|
-
|
|
75
|
-
}, [
|
|
78
|
+
p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
|
|
79
|
+
}, [p]);
|
|
76
80
|
const h = () => {
|
|
77
81
|
s(null);
|
|
78
82
|
};
|
|
@@ -102,7 +106,7 @@ function It() {
|
|
|
102
106
|
e.setValue(o.initialCode);
|
|
103
107
|
},
|
|
104
108
|
onChange: (e) => {
|
|
105
|
-
|
|
109
|
+
n(!0), c(e), f(e);
|
|
106
110
|
},
|
|
107
111
|
height: "100%",
|
|
108
112
|
defaultLanguage: "html",
|
|
@@ -119,5 +123,5 @@ function It() {
|
|
|
119
123
|
] });
|
|
120
124
|
}
|
|
121
125
|
export {
|
|
122
|
-
|
|
126
|
+
zt as default
|
|
123
127
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E="#styles:",_="#slots:",T="#i18n",Y="outline",s="__ADD_BLOCK_INTERNAL_ROOT";exports.I18N_KEY=T;exports.OUTLINE_KEY=Y;exports.ROOT_TEMP_KEY=s;exports.SLOT_KEY=_;exports.STYLES_KEY=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-FnytvxNn.cjs"),s=require("./index-FpYnmYj7.cjs"),x=require("./context-menu-Lx_MAqsu.cjs"),c=require("react-i18next");require("@radix-ui/react-select");require("lodash-es");require("jotai");require("./iconBase-vJD0OXxU.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-hZpwIZMT.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("lucide-react");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("lodash");require("@radix-ui/react-scroll-area");require("framer-motion");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");const j=()=>s.useBuilderProp("languages",["en"]),d=()=>j().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(o.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"})]})})]})}),q=()=>{const{savePage:a,saveState:t}=s.useSavePage(),l=s.useBuilderProp("hideSaveButton",!1),{t:u}=c.useTranslation(),i=n.useMemo(()=>{switch(t){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"}},[t]);if(l)return null;const p=e.jsxRuntimeExports.jsxs(x.Button,{disabled:t==="SAVING",onClick:m=>{m.preventDefault(),a()},className:`flex h-auto w-fit items-center gap-x-2 p-1 px-2 ${i}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:t==="SAVING"?"Saving...":u(t==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:p})},h=function(){const t=s.useBuilderProp("previewComponent"),[,l]=s.usePreviewMode(),{t:u}=c.useTranslation();return t?e.jsxRuntimeExports.jsxs(x.Button,{onClick:i=>{i.preventDefault(),l(!0)},className:"flex h-auto w-fit items-center gap-x-2 bg-gray-200 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(o.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:u("Preview")})]}):null},E=()=>{const a=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),l=s.useBuilderProp("topBarComponents.right",[]),u=s.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(a.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(d,{}),e.jsxRuntimeExports.jsx(h,{}),e.jsxRuntimeExports.jsx(x.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(q,{}):null,n.Children.toArray(l.map(i=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))]})]})};exports.default=E;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import l, { useMemo as h, Suspense as m } from "react";
|
|
3
3
|
import { FontFamilyIcon as j, EyeOpenIcon as f } from "@radix-ui/react-icons";
|
|
4
|
-
import { S as g, c as v, b as S, d as b, a as N, e as w, f as
|
|
5
|
-
import {
|
|
6
|
-
import { S as A } from "./
|
|
7
|
-
import { B as c, S as p } from "./context-menu-sks9vdzC.js";
|
|
4
|
+
import { S as g, c as v, b as S, d as b, a as N, e as w, f as n } from "./select-1WwjQDp6.js";
|
|
5
|
+
import { d as s, e as y, F as C, f as B } from "./index-T7WZImL0.js";
|
|
6
|
+
import { B as c, S as p, ac as A } from "./context-menu-zu6r7B6f.js";
|
|
8
7
|
import { useTranslation as x } from "react-i18next";
|
|
9
8
|
import "@radix-ui/react-select";
|
|
10
9
|
import "lodash-es";
|
|
@@ -17,7 +16,7 @@ import "./plugin-sJ3Hzvpv.js";
|
|
|
17
16
|
import "@react-hookz/web";
|
|
18
17
|
import "tree-model";
|
|
19
18
|
import "react-quill";
|
|
20
|
-
import "./STRINGS
|
|
19
|
+
import "./STRINGS-rPGH65PW.js";
|
|
21
20
|
import "react-hotkeys-hook";
|
|
22
21
|
import "@floating-ui/dom";
|
|
23
22
|
import "@floating-ui/react-dom";
|
|
@@ -29,6 +28,7 @@ import "tailwindcss-palette-generator";
|
|
|
29
28
|
import "react-wrap-balancer";
|
|
30
29
|
import "react-dom";
|
|
31
30
|
import "prop-types";
|
|
31
|
+
import "re-resizable";
|
|
32
32
|
import "@rjsf/validator-ajv8";
|
|
33
33
|
import "@rjsf/core";
|
|
34
34
|
import "react-arborist";
|
|
@@ -38,19 +38,21 @@ import "react-icons-picker";
|
|
|
38
38
|
import "react-autosuggest";
|
|
39
39
|
import "fuse.js";
|
|
40
40
|
import "i18next";
|
|
41
|
+
import "lodash";
|
|
41
42
|
import "@radix-ui/react-scroll-area";
|
|
42
|
-
import "
|
|
43
|
+
import "framer-motion";
|
|
43
44
|
import "@radix-ui/react-switch";
|
|
44
45
|
import "@radix-ui/react-accordion";
|
|
45
|
-
import "class-variance-authority";
|
|
46
46
|
import "@radix-ui/react-alert-dialog";
|
|
47
47
|
import "@radix-ui/react-slot";
|
|
48
|
+
import "class-variance-authority";
|
|
48
49
|
import "@radix-ui/react-label";
|
|
49
50
|
import "@radix-ui/react-tabs";
|
|
50
51
|
import "@radix-ui/react-tooltip";
|
|
51
52
|
import "@radix-ui/react-popover";
|
|
52
53
|
import "@radix-ui/react-hover-card";
|
|
53
54
|
import "@radix-ui/react-dropdown-menu";
|
|
55
|
+
import "@radix-ui/react-separator";
|
|
54
56
|
import "@radix-ui/react-toast";
|
|
55
57
|
import "cmdk";
|
|
56
58
|
import "@radix-ui/react-dialog";
|
|
@@ -67,14 +69,14 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
67
69
|
) }),
|
|
68
70
|
/* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsxs(N, { children: [
|
|
69
71
|
/* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
|
|
70
|
-
/* @__PURE__ */ e.jsx(
|
|
71
|
-
/* @__PURE__ */ e.jsx(
|
|
72
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
74
|
-
/* @__PURE__ */ e.jsx(
|
|
72
|
+
/* @__PURE__ */ e.jsx(n, { value: "apple", children: "Apple" }),
|
|
73
|
+
/* @__PURE__ */ e.jsx(n, { value: "banana", children: "Banana" }),
|
|
74
|
+
/* @__PURE__ */ e.jsx(n, { value: "blueberry", children: "Blueberry" }),
|
|
75
|
+
/* @__PURE__ */ e.jsx(n, { value: "grapes", children: "Grapes" }),
|
|
76
|
+
/* @__PURE__ */ e.jsx(n, { value: "pineapple", children: "Pineapple" })
|
|
75
77
|
] }) })
|
|
76
78
|
] }) }), I = () => {
|
|
77
|
-
const { savePage: i, saveState: t } = y(), { t: a } = x(),
|
|
79
|
+
const { savePage: i, saveState: t } = y(), o = s("hideSaveButton", !1), { t: a } = x(), r = h(() => {
|
|
78
80
|
switch (t) {
|
|
79
81
|
case "SAVING":
|
|
80
82
|
return "animate-pulse bg-gray-300 text-gray-900";
|
|
@@ -84,7 +86,7 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
84
86
|
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
85
87
|
}
|
|
86
88
|
}, [t]);
|
|
87
|
-
if (
|
|
89
|
+
if (o)
|
|
88
90
|
return null;
|
|
89
91
|
const u = /* @__PURE__ */ e.jsxs(
|
|
90
92
|
c,
|
|
@@ -93,35 +95,35 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
93
95
|
onClick: (d) => {
|
|
94
96
|
d.preventDefault(), i();
|
|
95
97
|
},
|
|
96
|
-
className: `flex h-auto w-fit items-center gap-x-2
|
|
98
|
+
className: `flex h-auto w-fit items-center gap-x-2 p-1 px-2 ${r}`,
|
|
97
99
|
size: "sm",
|
|
98
100
|
variant: "outline",
|
|
99
101
|
children: [
|
|
100
|
-
/* @__PURE__ */ e.jsx(C, { className: "text-
|
|
102
|
+
/* @__PURE__ */ e.jsx(C, { className: "text-sm text-white" }),
|
|
101
103
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: t === "SAVING" ? "Saving..." : a(t === "SAVED" ? "Saved" : "Unsaved") })
|
|
102
104
|
]
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
106
108
|
}, V = function() {
|
|
107
|
-
const t = s("previewComponent"), [,
|
|
109
|
+
const t = s("previewComponent"), [, o] = B(), { t: a } = x();
|
|
108
110
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
109
111
|
c,
|
|
110
112
|
{
|
|
111
113
|
onClick: (r) => {
|
|
112
|
-
r.preventDefault(),
|
|
114
|
+
r.preventDefault(), o(!0);
|
|
113
115
|
},
|
|
114
|
-
className: "flex h-auto w-fit items-center gap-x-2
|
|
116
|
+
className: "flex h-auto w-fit items-center gap-x-2 bg-gray-200 p-1 px-2",
|
|
115
117
|
size: "sm",
|
|
116
118
|
variant: "outline",
|
|
117
119
|
children: [
|
|
118
120
|
/* @__PURE__ */ e.jsx(f, { className: "text-xs" }),
|
|
119
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children:
|
|
121
|
+
/* @__PURE__ */ e.jsx("span", { className: "text-sm", children: a("Preview") })
|
|
120
122
|
]
|
|
121
123
|
}
|
|
122
124
|
) : null;
|
|
123
|
-
},
|
|
124
|
-
const i = s("topBarComponents.left", []), t = s("topBarComponents.center", []),
|
|
125
|
+
}, Me = () => {
|
|
126
|
+
const i = s("topBarComponents.left", []), t = s("topBarComponents.center", []), o = s("topBarComponents.right", []), a = s("editable", !0);
|
|
125
127
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
126
128
|
/* @__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(
|
|
127
129
|
i.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
@@ -129,17 +131,17 @@ const P = () => s("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
129
131
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: l.Children.toArray(
|
|
130
132
|
t.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
131
133
|
) }),
|
|
132
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-
|
|
134
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
133
135
|
/* @__PURE__ */ e.jsx(k, {}),
|
|
134
136
|
/* @__PURE__ */ e.jsx(V, {}),
|
|
135
137
|
/* @__PURE__ */ e.jsx(A, { orientation: "vertical" }),
|
|
136
|
-
|
|
138
|
+
a ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
137
139
|
l.Children.toArray(
|
|
138
|
-
|
|
140
|
+
o.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
139
141
|
)
|
|
140
142
|
] })
|
|
141
143
|
] });
|
|
142
144
|
};
|
|
143
145
|
export {
|
|
144
|
-
|
|
146
|
+
Me as default
|
|
145
147
|
};
|
|
@@ -2,18 +2,18 @@ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
2
2
|
import { useState as p, useEffect as D } from "react";
|
|
3
3
|
import { isEmpty as d, startCase as E } from "lodash-es";
|
|
4
4
|
import { MixerHorizontalIcon as L } from "@radix-ui/react-icons";
|
|
5
|
-
import { createApi as
|
|
6
|
-
import {
|
|
7
|
-
import { S as P, c as S, b as C, d as I, f as h } from "./select-
|
|
5
|
+
import { createApi as V } from "unsplash-js";
|
|
6
|
+
import { N as B, P as F, r as K, s as U, V as O, B as Q } from "./context-menu-zu6r7B6f.js";
|
|
7
|
+
import { S as P, c as S, b as C, d as I, f as h } from "./select-1WwjQDp6.js";
|
|
8
8
|
import "react-i18next";
|
|
9
|
-
import {
|
|
9
|
+
import { d as H } from "./index-T7WZImL0.js";
|
|
10
10
|
import { useDebouncedState as R } from "@react-hookz/web";
|
|
11
|
-
import { Loader as
|
|
11
|
+
import { Loader as $ } from "lucide-react";
|
|
12
12
|
import "@radix-ui/react-switch";
|
|
13
13
|
import "@radix-ui/react-accordion";
|
|
14
|
-
import "class-variance-authority";
|
|
15
14
|
import "@radix-ui/react-alert-dialog";
|
|
16
15
|
import "@radix-ui/react-slot";
|
|
16
|
+
import "class-variance-authority";
|
|
17
17
|
import "@radix-ui/react-label";
|
|
18
18
|
import "@radix-ui/react-scroll-area";
|
|
19
19
|
import "@radix-ui/react-tabs";
|
|
@@ -21,6 +21,7 @@ import "@radix-ui/react-tooltip";
|
|
|
21
21
|
import "@radix-ui/react-popover";
|
|
22
22
|
import "@radix-ui/react-hover-card";
|
|
23
23
|
import "@radix-ui/react-dropdown-menu";
|
|
24
|
+
import "@radix-ui/react-separator";
|
|
24
25
|
import "@radix-ui/react-toast";
|
|
25
26
|
import "cmdk";
|
|
26
27
|
import "@radix-ui/react-dialog";
|
|
@@ -34,7 +35,7 @@ import "@chaibuilder/runtime";
|
|
|
34
35
|
import "./plugin-sJ3Hzvpv.js";
|
|
35
36
|
import "tree-model";
|
|
36
37
|
import "react-quill";
|
|
37
|
-
import "./STRINGS
|
|
38
|
+
import "./STRINGS-rPGH65PW.js";
|
|
38
39
|
import "react-hotkeys-hook";
|
|
39
40
|
import "@floating-ui/dom";
|
|
40
41
|
import "@floating-ui/react-dom";
|
|
@@ -46,6 +47,7 @@ import "tailwindcss-palette-generator";
|
|
|
46
47
|
import "react-wrap-balancer";
|
|
47
48
|
import "react-dom";
|
|
48
49
|
import "prop-types";
|
|
50
|
+
import "re-resizable";
|
|
49
51
|
import "@rjsf/validator-ajv8";
|
|
50
52
|
import "@rjsf/core";
|
|
51
53
|
import "react-arborist";
|
|
@@ -54,33 +56,35 @@ import "react-icons-picker";
|
|
|
54
56
|
import "react-autosuggest";
|
|
55
57
|
import "fuse.js";
|
|
56
58
|
import "i18next";
|
|
59
|
+
import "lodash";
|
|
60
|
+
import "framer-motion";
|
|
57
61
|
const k = async (x, g) => new Promise((o, a) => {
|
|
58
|
-
|
|
62
|
+
V({ accessKey: g }).search.getPhotos(x).then((i) => {
|
|
59
63
|
o(i);
|
|
60
64
|
}).catch((i) => a(i));
|
|
61
|
-
}),
|
|
62
|
-
const o = H("unsplashAccessKey", ""), [a, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f,
|
|
65
|
+
}), Ze = ({ isModalView: x, onSelect: g }) => {
|
|
66
|
+
const o = H("unsplashAccessKey", ""), [a, j] = p([]), [i, v] = p(0), [l, A] = p(), [n, q] = p(), [z, y] = p(0), [u, T] = R("", 1e3), [f, m] = p(!1), _ = async (s) => {
|
|
63
67
|
if (d(u))
|
|
64
68
|
return;
|
|
65
69
|
let r = i + 1;
|
|
66
|
-
s && (s.preventDefault(), r = 1),
|
|
67
|
-
const
|
|
68
|
-
l && (
|
|
70
|
+
s && (s.preventDefault(), r = 1), m(!0), v(r);
|
|
71
|
+
const c = { query: u, page: r };
|
|
72
|
+
l && (c.orientation = l), n && (c.color = n), k(c, o).then((t) => {
|
|
69
73
|
var N, b, w;
|
|
70
|
-
j(r === 1 ? ((N = t == null ? void 0 : t.response) == null ? void 0 : N.results) || [] : [...a, ...((b = t == null ? void 0 : t.response) == null ? void 0 : b.results) || []]), y((w = t == null ? void 0 : t.response) == null ? void 0 : w.total_pages),
|
|
74
|
+
j(r === 1 ? ((N = t == null ? void 0 : t.response) == null ? void 0 : N.results) || [] : [...a, ...((b = t == null ? void 0 : t.response) == null ? void 0 : b.results) || []]), y((w = t == null ? void 0 : t.response) == null ? void 0 : w.total_pages), m(!1);
|
|
71
75
|
}).catch(() => {
|
|
72
|
-
|
|
76
|
+
m(!1);
|
|
73
77
|
});
|
|
74
78
|
};
|
|
75
79
|
return D(() => {
|
|
76
80
|
if (!d(u) && o) {
|
|
77
|
-
|
|
81
|
+
m(!0);
|
|
78
82
|
const s = { query: u, page: 1 };
|
|
79
83
|
l && (s.orientation = l), n && (s.color = n), v(1), k(s, o).then((r) => {
|
|
80
|
-
var
|
|
81
|
-
j(((
|
|
84
|
+
var c, t;
|
|
85
|
+
j(((c = r == null ? void 0 : r.response) == null ? void 0 : c.results) || []), y((t = r == null ? void 0 : r.response) == null ? void 0 : t.total_pages), m(!1);
|
|
82
86
|
}).catch(() => {
|
|
83
|
-
|
|
87
|
+
m(!1);
|
|
84
88
|
});
|
|
85
89
|
}
|
|
86
90
|
}, [l, n, u, o]), d(o) ? /* @__PURE__ */ e.jsx("div", { className: "h-full flex flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
@@ -98,7 +102,7 @@ const k = async (x, g) => new Promise((o, a) => {
|
|
|
98
102
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
99
103
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
100
104
|
/* @__PURE__ */ e.jsx(
|
|
101
|
-
|
|
105
|
+
B,
|
|
102
106
|
{
|
|
103
107
|
type: "text",
|
|
104
108
|
name: "query",
|
|
@@ -107,8 +111,8 @@ const k = async (x, g) => new Promise((o, a) => {
|
|
|
107
111
|
onChange: (s) => T(s.target.value)
|
|
108
112
|
}
|
|
109
113
|
),
|
|
110
|
-
/* @__PURE__ */ e.jsxs(
|
|
111
|
-
/* @__PURE__ */ e.jsx(
|
|
114
|
+
/* @__PURE__ */ e.jsxs(F, { children: [
|
|
115
|
+
/* @__PURE__ */ e.jsx(K, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(L, {}) }),
|
|
112
116
|
/* @__PURE__ */ e.jsx(
|
|
113
117
|
U,
|
|
114
118
|
{
|
|
@@ -151,7 +155,7 @@ const k = async (x, g) => new Promise((o, a) => {
|
|
|
151
155
|
] })
|
|
152
156
|
] }),
|
|
153
157
|
/* @__PURE__ */ e.jsxs(
|
|
154
|
-
|
|
158
|
+
O,
|
|
155
159
|
{
|
|
156
160
|
className: `h-full ${x && !d(a) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
157
161
|
children: [
|
|
@@ -188,11 +192,11 @@ const k = async (x, g) => new Promise((o, a) => {
|
|
|
188
192
|
) }) }, s.id)
|
|
189
193
|
)),
|
|
190
194
|
f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
191
|
-
/* @__PURE__ */ e.jsx(
|
|
195
|
+
/* @__PURE__ */ e.jsx($, { className: "animate-spin w-6 h-6" }),
|
|
192
196
|
" Loading..."
|
|
193
197
|
] }),
|
|
194
198
|
!d(a) && i < z && !f && /* @__PURE__ */ e.jsx(
|
|
195
|
-
|
|
199
|
+
Q,
|
|
196
200
|
{
|
|
197
201
|
size: "sm",
|
|
198
202
|
variant: "link",
|
|
@@ -208,6 +212,6 @@ const k = async (x, g) => new Promise((o, a) => {
|
|
|
208
212
|
] });
|
|
209
213
|
};
|
|
210
214
|
export {
|
|
211
|
-
|
|
215
|
+
Ze as default,
|
|
212
216
|
k as fetchImage
|
|
213
217
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),o=require("react"),l=require("lodash-es"),k=require("@radix-ui/react-icons"),A=require("unsplash-js"),d=require("./context-menu-Lx_MAqsu.cjs"),r=require("./select-FnytvxNn.cjs");require("react-i18next");const T=require("./index-FpYnmYj7.cjs"),z=require("@react-hookz/web"),_=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("@radix-ui/react-select");require("jotai");require("./iconBase-vJD0OXxU.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("tree-model");require("react-quill");require("./STRINGS-hZpwIZMT.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("lodash");require("framer-motion");const g=async(j,E)=>new Promise((a,n)=>{A.createApi({accessKey:E}).search.getPhotos(j).then(u=>{a(u)}).catch(u=>n(u))}),D=({isModalView:j,onSelect:E})=>{const a=T.useBuilderProp("unsplashAccessKey",""),[n,f]=o.useState([]),[u,R]=o.useState(0),[c,b]=o.useState(),[x,I]=o.useState(),[w,y]=o.useState(0),[h,P]=z.useDebouncedState("",1e3),[q,m]=o.useState(!1),C=async s=>{if(l.isEmpty(h))return;let i=u+1;s&&(s.preventDefault(),i=1),m(!0),R(i);const p={query:h,page:i};c&&(p.orientation=c),x&&(p.color=x),g(p,a).then(t=>{var v,N,S;f(i===1?((v=t==null?void 0:t.response)==null?void 0:v.results)||[]:[...n,...((N=t==null?void 0:t.response)==null?void 0:N.results)||[]]),y((S=t==null?void 0:t.response)==null?void 0:S.total_pages),m(!1)}).catch(()=>{m(!1)})};return o.useEffect(()=>{if(!l.isEmpty(h)&&a){m(!0);const s={query:h,page:1};c&&(s.orientation=c),x&&(s.color=x),R(1),g(s,a).then(i=>{var p,t;f(((p=i==null?void 0:i.response)==null?void 0:p.results)||[]),y((t=i==null?void 0:i.response)==null?void 0:t.total_pages),m(!1)}).catch(()=>{m(!1)})}},[c,x,h,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(d.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:s=>P(s.target.value)}),e.jsxRuntimeExports.jsxs(d.Popover,{children:[e.jsxRuntimeExports.jsx(d.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(k.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(d.PopoverContent,{side:j?"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(r.Select,{defaultValue:c,onValueChange:s=>b(s),children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(r.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(r.SelectItem,{value:"",children:"All"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"landscape",children:"Landscape"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"portrait",children:"Portrait"}),e.jsxRuntimeExports.jsx(r.SelectItem,{value:"squarish",children:"Square"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsxs(r.Select,{defaultValue:x,onValueChange:s=>I(s),children:[e.jsxRuntimeExports.jsx(r.SelectTrigger,{className:"h-auto w-40 p-1 px-3",children:e.jsxRuntimeExports.jsx(r.SelectValue,{placeholder:"Select"})}),e.jsxRuntimeExports.jsxs(r.SelectContent,{className:"z-[9999]",children:[e.jsxRuntimeExports.jsx(r.SelectItem,{value:"",children:"All"}),["black_and_white","black","white","yellow","orange","red","purple","magenta","green","teal","blue"].map(s=>e.jsxRuntimeExports.jsx(r.SelectItem,{value:s,children:l.startCase(s)},s))]})]})]})})]})]}),e.jsxRuntimeExports.jsxs(d.ScrollArea,{className:`h-full ${j&&!l.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[l.isEmpty(n)&&!q&&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"})]}),j?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)),q&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(_.Loader,{className:"animate-spin w-6 h-6"})," Loading..."]}),!l.isEmpty(n)&&u<w&&!q&&e.jsxRuntimeExports.jsx(d.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>C(void 0),disabled:q,children:q?"":"Load More"})]})]})};exports.default=D;exports.fetchImage=g;
|
|
@@ -2,16 +2,16 @@ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
2
2
|
import { useState as l, useEffect as k } from "react";
|
|
3
3
|
import { isEmpty as j, map as b } from "lodash-es";
|
|
4
4
|
import { atom as F, useAtom as U } from "jotai";
|
|
5
|
-
import {
|
|
5
|
+
import { V as C } from "./context-menu-zu6r7B6f.js";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { d as y } from "./index-T7WZImL0.js";
|
|
8
8
|
import { Upload as G, Loader as P } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-switch";
|
|
10
10
|
import "@radix-ui/react-accordion";
|
|
11
11
|
import "@radix-ui/react-icons";
|
|
12
|
-
import "class-variance-authority";
|
|
13
12
|
import "@radix-ui/react-alert-dialog";
|
|
14
13
|
import "@radix-ui/react-slot";
|
|
14
|
+
import "class-variance-authority";
|
|
15
15
|
import "@radix-ui/react-label";
|
|
16
16
|
import "@radix-ui/react-scroll-area";
|
|
17
17
|
import "@radix-ui/react-tabs";
|
|
@@ -19,6 +19,7 @@ import "@radix-ui/react-tooltip";
|
|
|
19
19
|
import "@radix-ui/react-popover";
|
|
20
20
|
import "@radix-ui/react-hover-card";
|
|
21
21
|
import "@radix-ui/react-dropdown-menu";
|
|
22
|
+
import "@radix-ui/react-separator";
|
|
22
23
|
import "@radix-ui/react-toast";
|
|
23
24
|
import "cmdk";
|
|
24
25
|
import "@radix-ui/react-dialog";
|
|
@@ -31,7 +32,7 @@ import "./plugin-sJ3Hzvpv.js";
|
|
|
31
32
|
import "@react-hookz/web";
|
|
32
33
|
import "tree-model";
|
|
33
34
|
import "react-quill";
|
|
34
|
-
import "./STRINGS
|
|
35
|
+
import "./STRINGS-rPGH65PW.js";
|
|
35
36
|
import "react-hotkeys-hook";
|
|
36
37
|
import "@floating-ui/dom";
|
|
37
38
|
import "@floating-ui/react-dom";
|
|
@@ -43,6 +44,7 @@ import "tailwindcss-palette-generator";
|
|
|
43
44
|
import "react-wrap-balancer";
|
|
44
45
|
import "react-dom";
|
|
45
46
|
import "prop-types";
|
|
47
|
+
import "re-resizable";
|
|
46
48
|
import "@rjsf/validator-ajv8";
|
|
47
49
|
import "@rjsf/core";
|
|
48
50
|
import "react-arborist";
|
|
@@ -51,33 +53,35 @@ import "react-icons-picker";
|
|
|
51
53
|
import "react-autosuggest";
|
|
52
54
|
import "fuse.js";
|
|
53
55
|
import "i18next";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
import "lodash";
|
|
57
|
+
import "framer-motion";
|
|
58
|
+
const S = F([]), Le = ({ isModalView: o, onSelect: m }) => {
|
|
59
|
+
const { t: r } = E(), c = y("uploadMediaCallback"), n = y("fetchMediaCallback"), [a, d] = U(S), [N, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, p] = l("");
|
|
56
60
|
k(() => {
|
|
57
61
|
(async () => {
|
|
58
62
|
if (!n)
|
|
59
63
|
return;
|
|
60
64
|
f(!0);
|
|
61
65
|
const t = await n();
|
|
62
|
-
|
|
66
|
+
d(t || []), f(!1);
|
|
63
67
|
})();
|
|
64
68
|
}, []);
|
|
65
69
|
const w = (t) => {
|
|
66
70
|
var s, i;
|
|
67
|
-
if (
|
|
71
|
+
if (p(""), t && ((i = (s = t == null ? void 0 : t.target) == null ? void 0 : s.files) == null ? void 0 : i.length) > 0) {
|
|
68
72
|
const g = t.target.files[0];
|
|
69
|
-
g.type.startsWith("image") ? I(g) :
|
|
73
|
+
g.type.startsWith("image") ? I(g) : p(r("Please select an image"));
|
|
70
74
|
}
|
|
71
75
|
}, I = async (t) => {
|
|
72
|
-
if (
|
|
76
|
+
if (c) {
|
|
73
77
|
u(!0);
|
|
74
78
|
try {
|
|
75
|
-
const { url: s } = await
|
|
79
|
+
const { url: s } = await c(t);
|
|
76
80
|
m(s), v(void 0);
|
|
77
81
|
const i = await n();
|
|
78
|
-
|
|
82
|
+
d(i);
|
|
79
83
|
} catch (s) {
|
|
80
|
-
|
|
84
|
+
d([]), p((s == null ? void 0 : s.message) || "Something went wrong.");
|
|
81
85
|
}
|
|
82
86
|
u(!1);
|
|
83
87
|
}
|
|
@@ -143,5 +147,5 @@ const S = F([]), Se = ({ isModalView: o, onSelect: m }) => {
|
|
|
143
147
|
] });
|
|
144
148
|
};
|
|
145
149
|
export {
|
|
146
|
-
|
|
150
|
+
Le as default
|
|
147
151
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),i=require("react"),n=require("lodash-es"),E=require("jotai"),I=require("./context-menu-Lx_MAqsu.cjs"),w=require("react-i18next"),g=require("./index-FpYnmYj7.cjs"),b=require("lucide-react");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");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-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("clsx");require("tailwind-merge");require("./iconBase-vJD0OXxU.cjs");require("@chaibuilder/runtime");require("./plugin-_F-KZp1i.cjs");require("@react-hookz/web");require("tree-model");require("react-quill");require("./STRINGS-hZpwIZMT.cjs");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("flagged");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("react-wrap-balancer");require("react-dom");require("prop-types");require("re-resizable");require("@rjsf/validator-ajv8");require("@rjsf/core");require("react-arborist");require("himalaya");require("react-icons-picker");require("react-autosuggest");require("fuse.js");require("i18next");require("lodash");require("framer-motion");const k=E.atom([]),S=({isModalView:a,onSelect:o})=>{const{t:s}=w.useTranslation(),d=g.useBuilderProp("uploadMediaCallback"),x=g.useBuilderProp("fetchMediaCallback"),[u,c]=E.useAtom(k),[y,p]=i.useState(!1),[j,q]=i.useState(!1),[,R]=i.useState(),[h,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;q(!0);const r=await x();c(r||[]),q(!1)})()},[]);const N=r=>{var t,l;if(m(""),r&&((l=(t=r==null?void 0:r.target)==null?void 0:t.files)==null?void 0:l.length)>0){const f=r.target.files[0];f.type.startsWith("image")?v(f):m(s("Please select an image"))}},v=async r=>{if(d){p(!0);try{const{url:t}=await d(r);o(t),R(void 0);const l=await x();c(l)}catch(t){c([]),m((t==null?void 0:t.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:a?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center rounded-lg",children:e.jsxRuntimeExports.jsxs("label",{htmlFor:"image-upload",className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-gray-300 bg-gray-50 hover:bg-gray-100",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsxRuntimeExports.jsx(b.Upload,{className:"mb-3 h-10 w-10 text-gray-400"}),e.jsxRuntimeExports.jsx("p",{className:"mb-2 text-sm text-gray-500 dark:text-gray-400",children:e.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:s("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s("SVG, PNG, JPG or GIF (Max. 2mb)")})]}),y?e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full items-center justify-center",children:[e.jsxRuntimeExports.jsx(b.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:s("Uploading...")})]}):null,h&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:h||s("Something went wrong")})]})}),e.jsxRuntimeExports.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:N})]}),e.jsxRuntimeExports.jsxs(I.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${a?"px-2":""} pt-2`,children:[n.isEmpty(u)&&j&&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:s("Fetching...")})}),n.isEmpty(u)&&!j&&e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[e.jsxRuntimeExports.jsx("div",{className:"mb-4 h-12 rounded-full p-6"}),e.jsxRuntimeExports.jsx("h3",{className:"mb-2 text-sm font-semibold",children:s("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:s("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),a?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>o(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))}):n.map(u,r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>o(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=S;
|