@chaibuilder/sdk 1.2.115 → 1.2.116

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.
Files changed (51) hide show
  1. package/README.md +2 -6
  2. package/dist/CodeEditor-Bl58eelM.cjs +1 -0
  3. package/dist/CodeEditor-C1ImRmIp.js +77 -0
  4. package/dist/Topbar-BpMZTZKz.cjs +1 -0
  5. package/dist/Topbar-tRFEAMbG.js +113 -0
  6. package/dist/UnsplashImages-BXarNGDE.cjs +1 -0
  7. package/dist/{UnsplashImages--HU-110a.js → UnsplashImages-Ds_3IihK.js} +38 -90
  8. package/dist/UploadImages-DPMndPNm.cjs +1 -0
  9. package/dist/UploadImages-VZ7-y0rA.js +101 -0
  10. package/dist/cdn.js +25283 -0
  11. package/dist/{context-menu-FPX89OKr.js → context-menu-BbqLeYFX.js} +1 -1
  12. package/dist/{context-menu-sQn7ryJ6.cjs → context-menu-DfAXjmc8.cjs} +1 -1
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.d.ts +50 -17
  15. package/dist/core.js +74 -127
  16. package/dist/{iconBase-Ief2hJUZ.js → iconBase-DHfFLkem.js} +6 -12
  17. package/dist/index-B_be_Or7.cjs +63 -0
  18. package/dist/{index-suTYVyMn.js → index-Bn53BEJy.js} +1614 -1645
  19. package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
  20. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-DGlMoOmv.js} +241 -242
  21. package/dist/{plugin-UiUFs2fK.js → plugin-BOEoR5jk.js} +1 -1
  22. package/dist/{plugin-xOpS-UNV.cjs → plugin-COMQcYlW.cjs} +1 -1
  23. package/dist/{plugin-f6SDZ_Or.js → plugin-Dw854zFv.js} +7 -8
  24. package/dist/{plugin-jum1MjXp.cjs → plugin-I9XxF65G.cjs} +1 -1
  25. package/dist/render.cjs +1 -1
  26. package/dist/render.js +10 -14
  27. package/dist/runtime.cjs +1 -1
  28. package/dist/runtime.js +12 -13
  29. package/dist/style.css +1 -1
  30. package/dist/tailwind.cjs +1 -1
  31. package/dist/tailwind.js +5 -7
  32. package/dist/ui.cjs +1 -1
  33. package/dist/ui.d.ts +3 -6
  34. package/dist/ui.js +145 -163
  35. package/dist/web-blocks.cjs +19 -2
  36. package/dist/web-blocks.js +116 -102
  37. package/package.json +3 -1
  38. package/dist/CodeEditor-Dl56nrsL.cjs +0 -1
  39. package/dist/CodeEditor-lBqxrWBC.js +0 -129
  40. package/dist/Topbar-55E9bvvx.cjs +0 -1
  41. package/dist/Topbar-W4Ri5E2K.js +0 -163
  42. package/dist/UnsplashImages-UlBSnkVK.cjs +0 -1
  43. package/dist/UploadImages-bc0b7i8I.js +0 -153
  44. package/dist/UploadImages-e8RX7lNs.cjs +0 -1
  45. package/dist/index-UAobRy8V.cjs +0 -63
  46. package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
  47. /package/dist/{STRINGS-Xxstm-7I.js → STRINGS-eiGM83kj.js} +0 -0
  48. /package/dist/{STRINGS-Yl7cSWDc.cjs → STRINGS-ew98weUe.cjs} +0 -0
  49. /package/dist/{controls-p9IwFnPx.cjs → controls-C4n5ycp4.cjs} +0 -0
  50. /package/dist/{controls-lEwMTdPQ.js → controls-Com-zYCq.js} +0 -0
  51. /package/dist/{iconBase-aZzpqff_.cjs → iconBase-Cn2BsTrq.cjs} +0 -0
package/README.md CHANGED
@@ -4,10 +4,6 @@ Chai Builder is an Open Source Low Code React + Tailwind CSS Visual Builder.
4
4
  It allows you to create web pages visually by dragging and dropping elements onto the canvas.
5
5
  It is a simple React component that renders a full-fledged visual builder into any React application.
6
6
 
7
- #### [View Demo](https://chaibuilder.com/demos/web)
8
- #### [Documentation](https://chaibuilder.com/docs/sdk/introduction)
9
- #### [API References](https://api-reference.chaibuilder.com)
10
-
11
7
  ---
12
8
 
13
9
  ### Manual installation:
@@ -47,8 +43,8 @@ const BuilderFullPage = () => {
47
43
  return (
48
44
  <ChaiBuilderEditor
49
45
  blocks={[{_type: 'Heading', _id: 'a', content: 'This is a heading', styles: '#styles:,text-3xl font-bold'}]}
50
- onSave={async ({ blocks, providers, brandingOptions } ) => {
51
- console.log(blocks, providers, brandingOptions );
46
+ onSave={async ({ blocks, theme } ) => {
47
+ console.log(blocks, theme );
52
48
  return true
53
49
  }}
54
50
  />
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),k=require("@monaco-editor/react"),C=require("./context-menu-DfAXjmc8.cjs"),E=require("react-i18next"),i=require("react"),l=require("./index-B_be_Or7.cjs"),R=require("@radix-ui/react-icons"),g=require("@react-hookz/web"),u=o=>{const n=document.createElement("div");return n.innerHTML=o,n.innerHTML};function v(){const{t:o}=E.useTranslation(),[n,d]=i.useState(!1),[c,x]=i.useState(""),[t,r]=l.useCodeEditor(),[a]=l.useSelectedBlockIds(),m=l.useUpdateBlocksProps(),p=l.useUpdateBlocksPropsRealtime(),j=g.useThrottledCallback(s=>{const b=u(s);p([t.blockId],{[t.blockProp]:b})},[],300),f=i.useCallback(()=>{if(n){const s=u(c);m([t.blockId],{[t.blockProp]:s})}},[n,c]);i.useEffect(()=>{a.includes(t==null?void 0:t.blockId)||(f(),r(null))},[a]);const h=()=>{r(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:h,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:o("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(C.Button,{onClick:()=>r(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(R.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(k,{onMount:s=>{s.setValue(t.initialCode)},onChange:s=>{d(!0),x(s),j(s)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=v;
@@ -0,0 +1,77 @@
1
+ import { j as e } from "./jsx-runtime-DGlMoOmv.js";
2
+ import k from "@monaco-editor/react";
3
+ import { B as C } from "./context-menu-BbqLeYFX.js";
4
+ import { useTranslation as j } from "react-i18next";
5
+ import { useState as r, useCallback as v, useEffect as g } from "react";
6
+ import { u as y, a as N, b as T, c as E } from "./index-Bn53BEJy.js";
7
+ import { Cross2Icon as w } from "@radix-ui/react-icons";
8
+ import { useThrottledCallback as B } from "@react-hookz/web";
9
+ const c = (l) => {
10
+ const o = document.createElement("div");
11
+ return o.innerHTML = l, o.innerHTML;
12
+ };
13
+ function U() {
14
+ const { t: l } = j(), [o, d] = r(!1), [n, m] = r(""), [t, a] = y(), [i] = N(), u = T(), p = E(), f = B(
15
+ (s) => {
16
+ const b = c(s);
17
+ p([t.blockId], { [t.blockProp]: b });
18
+ },
19
+ [],
20
+ 300
21
+ ), x = v(() => {
22
+ if (o) {
23
+ const s = c(n);
24
+ u([t.blockId], { [t.blockProp]: s });
25
+ }
26
+ }, [o, n]);
27
+ g(() => {
28
+ i.includes(t == null ? void 0 : t.blockId) || (x(), a(null));
29
+ }, [i]);
30
+ const h = () => {
31
+ a(null);
32
+ };
33
+ return /* @__PURE__ */ e.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
34
+ /* @__PURE__ */ e.jsx("button", { onClick: h, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
35
+ /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
36
+ /* @__PURE__ */ e.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
37
+ /* @__PURE__ */ e.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
38
+ /* @__PURE__ */ e.jsx("span", { children: l("HTML Code Editor |") }),
39
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs text-gray-400", children: l("Scripts will be only executed in preview and live mode.") })
40
+ ] }),
41
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ e.jsx(
42
+ C,
43
+ {
44
+ onClick: () => a(null),
45
+ size: "sm",
46
+ variant: "destructive",
47
+ className: "h-6 w-fit",
48
+ children: /* @__PURE__ */ e.jsx(w, {})
49
+ }
50
+ ) })
51
+ ] }),
52
+ /* @__PURE__ */ e.jsx(
53
+ k,
54
+ {
55
+ onMount: (s) => {
56
+ s.setValue(t.initialCode);
57
+ },
58
+ onChange: (s) => {
59
+ d(!0), m(s), f(s);
60
+ },
61
+ height: "100%",
62
+ defaultLanguage: "html",
63
+ theme: "vs-dark",
64
+ defaultValue: "",
65
+ options: {
66
+ minimap: {
67
+ enabled: !1
68
+ }
69
+ }
70
+ }
71
+ )
72
+ ] })
73
+ ] });
74
+ }
75
+ export {
76
+ U as default
77
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),u=require("react"),x=require("./context-menu-DfAXjmc8.cjs"),s=require("./index-B_be_Or7.cjs"),p=require("react-i18next"),j=require("./iconBase-Cn2BsTrq.cjs"),d=require("@radix-ui/react-icons"),a=require("lodash-es");require("@chaibuilder/runtime");const E=()=>{const{savePage:i,saveState:n}=s.useSavePage(),{t:r}=p.useTranslation(),o=e.jsxRuntimeExports.jsxs(x.Button,{disabled:n==="SAVING",onClick:t=>{t.preventDefault(),i()},className:j.cn("flex h-auto w-fit items-center gap-x-2 p-1 px-2","bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",{"animate-pulse bg-gray-300 text-gray-900":n==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":n==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(s.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:r(n==="SAVING"?"Saving":n==="SAVED"?"Saved":"Unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:o})},g=function(){const n=s.useBuilderProp("previewComponent"),[,r]=s.usePreviewMode(),{t:o}=p.useTranslation();return n?e.jsxRuntimeExports.jsxs(x.Button,{onClick:t=>{t.preventDefault(),r(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(d.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:o("Preview")})]}):null},v=()=>{const{fallbackLang:i,languages:n,selectedLang:r,setSelectedLang:o}=s.useLanguages(),t=(r==null?void 0:r.length)>0?r:i,h=u.useMemo(()=>{const l=[];return a.forEach(a.uniq([i,...n]),c=>{const m=a.get(s.LANGUAGES,c);m&&l.push({key:c,value:m,default:c===i})}),l},[i,n]);return a.isEmpty(n)&&t==="en"?null:a.isEmpty(n)&&t!=="en"?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600",children:[e.jsxRuntimeExports.jsx(s.FaLanguage,{className:"h-4 w-4"}),a.get(s.LANGUAGES,t)]}):e.jsxRuntimeExports.jsxs(x.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(x.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(x.Button,{size:"sm",variant:"outline",className:"flex items-center gap-x-1 text-blue-500 hover:text-blue-600",children:[e.jsxRuntimeExports.jsx(s.FaLanguage,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsxs("div",{children:[" ",a.get(s.LANGUAGES,t)]}),e.jsxRuntimeExports.jsx(d.ChevronDownIcon,{className:"h-4 w-4"})]})]})}),e.jsxRuntimeExports.jsx(x.DropdownMenuContent,{className:"border-border",children:a.map(h,l=>e.jsxRuntimeExports.jsxs(x.DropdownMenuItem,{className:j.cn("flex cursor-pointer items-center text-sm",l.key===t&&"!bg-blue-500 text-white hover:!text-white"),onClick:()=>o(l.key),children:[e.jsxRuntimeExports.jsx("div",{children:l.value}),l.key===i?e.jsxRuntimeExports.jsx(s.FaStar,{className:"ml-2 h-4 w-4 text-yellow-400"}):null]}))})]})},R=()=>{const i=s.useBuilderProp("topBarComponents.left",[]),n=s.useBuilderProp("topBarComponents.center",[]),r=s.useBuilderProp("topBarComponents.right",[]),o=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:u.Children.toArray(i.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:u.Children.toArray(n.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(v,{}),e.jsxRuntimeExports.jsx(x.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(g,{}),e.jsxRuntimeExports.jsx(x.Separator,{orientation:"vertical"}),o?e.jsxRuntimeExports.jsx(E,{}):null,u.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=R;
@@ -0,0 +1,113 @@
1
+ import { j as e } from "./jsx-runtime-DGlMoOmv.js";
2
+ import c, { useMemo as w, Suspense as x } from "react";
3
+ import { B as p, a6 as C, a7 as S, a8 as y, a9 as k, aq as m, al as g } from "./context-menu-BbqLeYFX.js";
4
+ import { e as A, F as D, d as i, f as P, g as B, L as d, h as f, i as E } from "./index-Bn53BEJy.js";
5
+ import { useTranslation as v } from "react-i18next";
6
+ import { c as N } from "./iconBase-DHfFLkem.js";
7
+ import { EyeOpenIcon as L, ChevronDownIcon as M } from "@radix-ui/react-icons";
8
+ import { forEach as I, uniq as G, get as u, isEmpty as j, map as V } from "lodash-es";
9
+ import "@chaibuilder/runtime";
10
+ const F = () => {
11
+ const { savePage: r, saveState: t } = A(), { t: a } = v(), n = /* @__PURE__ */ e.jsxs(
12
+ p,
13
+ {
14
+ disabled: t === "SAVING",
15
+ onClick: (s) => {
16
+ s.preventDefault(), r();
17
+ },
18
+ className: N(
19
+ "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
20
+ // UNSAVED sate
21
+ "bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
22
+ {
23
+ "animate-pulse bg-gray-300 text-gray-900": t === "SAVING",
24
+ "bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white": t === "SAVED"
25
+ }
26
+ ),
27
+ size: "sm",
28
+ variant: "outline",
29
+ children: [
30
+ /* @__PURE__ */ e.jsx(D, { className: "text-sm text-white" }),
31
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: a(t === "SAVING" ? "Saving" : t === "SAVED" ? "Saved" : "Unsaved") })
32
+ ]
33
+ }
34
+ );
35
+ return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: n });
36
+ }, z = function() {
37
+ const t = i("previewComponent"), [, a] = P(), { t: n } = v();
38
+ return t ? /* @__PURE__ */ e.jsxs(
39
+ p,
40
+ {
41
+ onClick: (s) => {
42
+ s.preventDefault(), a(!0);
43
+ },
44
+ className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
45
+ size: "sm",
46
+ variant: "outline",
47
+ children: [
48
+ /* @__PURE__ */ e.jsx(L, { className: "text-xs" }),
49
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm", children: n("Preview") })
50
+ ]
51
+ }
52
+ ) : null;
53
+ }, T = () => {
54
+ const { fallbackLang: r, languages: t, selectedLang: a, setSelectedLang: n } = B(), s = (a == null ? void 0 : a.length) > 0 ? a : r, b = w(() => {
55
+ const l = [];
56
+ return I(G([r, ...t]), (o) => {
57
+ const h = u(d, o);
58
+ h && l.push({ key: o, value: h, default: o === r });
59
+ }), l;
60
+ }, [r, t]);
61
+ return j(t) && s === "en" ? null : j(t) && s !== "en" ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600", children: [
62
+ /* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
63
+ u(d, s)
64
+ ] }) : /* @__PURE__ */ e.jsxs(C, { children: [
65
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsxs(p, { size: "sm", variant: "outline", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
66
+ /* @__PURE__ */ e.jsx(f, { className: "h-4 w-4" }),
67
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
68
+ /* @__PURE__ */ e.jsxs("div", { children: [
69
+ " ",
70
+ u(d, s)
71
+ ] }),
72
+ /* @__PURE__ */ e.jsx(M, { className: "h-4 w-4" })
73
+ ] })
74
+ ] }) }),
75
+ /* @__PURE__ */ e.jsx(y, { className: "border-border", children: V(b, (l) => /* @__PURE__ */ e.jsxs(
76
+ k,
77
+ {
78
+ className: N(
79
+ "flex cursor-pointer items-center text-sm",
80
+ l.key === s && "!bg-blue-500 text-white hover:!text-white"
81
+ ),
82
+ onClick: () => n(l.key),
83
+ children: [
84
+ /* @__PURE__ */ e.jsx("div", { children: l.value }),
85
+ l.key === r ? /* @__PURE__ */ e.jsx(E, { className: "ml-2 h-4 w-4 text-yellow-400" }) : null
86
+ ]
87
+ }
88
+ )) })
89
+ ] });
90
+ }, W = () => {
91
+ const r = i("topBarComponents.left", []), t = i("topBarComponents.center", []), a = i("topBarComponents.right", []), n = i("editable", !0);
92
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
93
+ /* @__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: c.Children.toArray(
94
+ r.map((s) => /* @__PURE__ */ e.jsx(x, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
95
+ ) }) }),
96
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2", children: c.Children.toArray(
97
+ t.map((s) => /* @__PURE__ */ e.jsx(x, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
98
+ ) }),
99
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-1", children: [
100
+ /* @__PURE__ */ e.jsx(T, {}),
101
+ /* @__PURE__ */ e.jsx(g, { orientation: "vertical" }),
102
+ /* @__PURE__ */ e.jsx(z, {}),
103
+ /* @__PURE__ */ e.jsx(g, { orientation: "vertical" }),
104
+ n ? /* @__PURE__ */ e.jsx(F, {}) : null,
105
+ c.Children.toArray(
106
+ a.map((s) => /* @__PURE__ */ e.jsx(x, { fallback: /* @__PURE__ */ e.jsx(m, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(s, {}) }))
107
+ )
108
+ ] })
109
+ ] });
110
+ };
111
+ export {
112
+ W as default
113
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),l=require("react"),p=require("lodash-es"),A=require("unsplash-js"),g=require("./context-menu-DfAXjmc8.cjs"),_=require("react-i18next"),v=require("./index-B_be_Or7.cjs"),T=require("@react-hookz/web"),B=require("lucide-react"),b=async(h,f)=>new Promise((r,n)=>{A.createApi({accessKey:f}).search.getPhotos(h).then(o=>{r(o)}).catch(o=>n(o))}),L=({isModalView:h,onSelect:f})=>{const r=v.useBuilderProp("unsplashAccessKey",""),[n,j]=l.useState([]),[o,y]=l.useState(0),[i,w]=l.useState(),[c,k]=l.useState(),[C,E]=l.useState(0),[d,P]=T.useDebouncedState("",1e3),[m,u]=l.useState(!1),{t:R}=_.useTranslation(),I=async s=>{if(p.isEmpty(d))return;let a=o+1;u(!0),y(a);const x={query:d,page:a};i&&(x.orientation=i),c&&(x.color=c),b(x,r).then(t=>{var N,q,S;j(a===1?((N=t==null?void 0:t.response)==null?void 0:N.results)||[]:[...n,...((q=t==null?void 0:t.response)==null?void 0:q.results)||[]]),E((S=t==null?void 0:t.response)==null?void 0:S.total_pages),u(!1)}).catch(()=>{u(!1)})};return l.useEffect(()=>{if(!p.isEmpty(d)&&r){u(!0);const s={query:d,page:1};i&&(s.orientation=i),c&&(s.color=c),y(1),b(s,r).then(a=>{var x,t;j(((x=a==null?void 0:a.response)==null?void 0:x.results)||[]),E((t=a==null?void 0:a.response)==null?void 0:t.total_pages),u(!1)}).catch(()=>{u(!1)})}},[i,c,d,r]),p.isEmpty(r)?e.jsxRuntimeExports.jsx("div",{className:"flex h-full 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:"px-1 underline 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 gap-x-2 rounded-md border border-border bg-background p-px",children:[e.jsxRuntimeExports.jsx(g.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:s=>P(s.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(v.ChaiSelect,{className:"w-40",placeholder:R("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:i,onValueChange:s=>w(s)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(v.ChaiSelect,{placeholder:R("Color"),options:[{value:"",label:"All"},{value:"black_and_white",label:"Black and White"},{value:"black",label:"Black"},{value:"white",label:"White"},{value:"night",label:"Night"},{value:"warm",label:"Warm"},{value:"cool",label:"Cool"},{value:"sepia",label:"Sepia"}],defaultValue:c,onValueChange:s=>k(s)})})]}),e.jsxRuntimeExports.jsxs(g.ScrollArea,{className:`h-full ${h&&!p.isEmpty(n)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(n)&&!m&&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"})]}),h?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:()=>f(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)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"h-6 w-6 animate-spin"}),"  Loading..."]}),!p.isEmpty(n)&&o<C&&!m&&e.jsxRuntimeExports.jsx(g.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(),disabled:m,children:m?"":"Load More"})]})]})};exports.default=L;exports.fetchImage=b;
@@ -1,93 +1,41 @@
1
- import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import { useState as c, useEffect as q } from "react";
3
- import { isEmpty as d } from "lodash-es";
1
+ import { j as e } from "./jsx-runtime-DGlMoOmv.js";
2
+ import { useState as m, useEffect as q } from "react";
3
+ import { isEmpty as p } from "lodash-es";
4
4
  import { createApi as B } from "unsplash-js";
5
- import { I as D, S as E, B as L } from "./context-menu-FPX89OKr.js";
6
- import { useTranslation as T } from "react-i18next";
7
- import { d as F, C as k } from "./index-suTYVyMn.js";
5
+ import { I as E, S as L, B as T } from "./context-menu-BbqLeYFX.js";
6
+ import { useTranslation as D } from "react-i18next";
7
+ import { d as F, C as k } from "./index-Bn53BEJy.js";
8
8
  import { useDebouncedState as K } from "@react-hookz/web";
9
9
  import { Loader as U } from "lucide-react";
10
- import "@radix-ui/react-switch";
11
- import "@radix-ui/react-accordion";
12
- import "@radix-ui/react-icons";
13
- import "class-variance-authority";
14
- import "@radix-ui/react-alert-dialog";
15
- import "@radix-ui/react-slot";
16
- import "@radix-ui/react-label";
17
- import "@radix-ui/react-scroll-area";
18
- import "@radix-ui/react-tabs";
19
- import "@radix-ui/react-tooltip";
20
- import "@radix-ui/react-popover";
21
- import "@radix-ui/react-hover-card";
22
- import "@radix-ui/react-select";
23
- import "@radix-ui/react-dropdown-menu";
24
- import "@radix-ui/react-separator";
25
- import "@radix-ui/react-toast";
26
- import "cmdk";
27
- import "@radix-ui/react-dialog";
28
- import "@radix-ui/react-context-menu";
29
- import "clsx";
30
- import "tailwind-merge";
31
- import "jotai";
32
- import "./iconBase-Ief2hJUZ.js";
33
- import "@chaibuilder/runtime";
34
- import "./plugin-f6SDZ_Or.js";
35
- import "tree-model";
36
- import "react-quill";
37
- import "./STRINGS-Xxstm-7I.js";
38
- import "flagged";
39
- import "react-hotkeys-hook";
40
- import "@floating-ui/dom";
41
- import "@floating-ui/react-dom";
42
- import "react-event-hook";
43
- import "@tailwindcss/typography";
44
- import "@tailwindcss/forms";
45
- import "@tailwindcss/aspect-ratio";
46
- import "react-wrap-balancer";
47
- import "react-dom";
48
- import "prop-types";
49
- import "react-error-boundary";
50
- import "re-resizable";
51
- import "@rjsf/validator-ajv8";
52
- import "@rjsf/core";
53
- import "./controls-lEwMTdPQ.js";
54
- import "react-arborist";
55
- import "himalaya";
56
- import "react-icons-picker";
57
- import "react-autosuggest";
58
- import "fuse.js";
59
- import "i18next";
60
- import "framer-motion";
61
- const C = async (f, g) => new Promise((s, r) => {
62
- B({ accessKey: g }).search.getPhotos(f).then((i) => {
63
- s(i);
64
- }).catch((i) => r(i));
65
- }), $e = ({ isModalView: f, onSelect: g }) => {
66
- const s = F("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [I, b] = c(0), [h, S] = K("", 1e3), [u, m] = c(!1), { t: j } = T(), _ = async (a) => {
67
- if (d(h))
68
- return;
69
- let t = i + 1;
70
- a && (a.preventDefault(), t = 1), m(!0), v(t);
71
- const p = { query: h, page: t };
72
- l && (p.orientation = l), n && (p.color = n), C(p, s).then((o) => {
10
+ const C = async (x, g) => new Promise((t, o) => {
11
+ B({ accessKey: g }).search.getPhotos(x).then((n) => {
12
+ t(n);
13
+ }).catch((n) => o(n));
14
+ }), J = ({ isModalView: x, onSelect: g }) => {
15
+ const t = F("unsplashAccessKey", ""), [o, f] = m([]), [n, v] = m(0), [r, P] = m(), [i, A] = m(), [I, b] = m(0), [h, S] = K("", 1e3), [u, c] = m(!1), { t: j } = D(), _ = async (a) => {
16
+ if (p(h)) return;
17
+ let l = n + 1;
18
+ c(!0), v(l);
19
+ const d = { query: h, page: l };
20
+ r && (d.orientation = r), i && (d.color = i), C(d, t).then((s) => {
73
21
  var y, N, w;
74
- x(t === 1 ? ((y = o == null ? void 0 : o.response) == null ? void 0 : y.results) || [] : [...r, ...((N = o == null ? void 0 : o.response) == null ? void 0 : N.results) || []]), b((w = o == null ? void 0 : o.response) == null ? void 0 : w.total_pages), m(!1);
22
+ f(l === 1 ? ((y = s == null ? void 0 : s.response) == null ? void 0 : y.results) || [] : [...o, ...((N = s == null ? void 0 : s.response) == null ? void 0 : N.results) || []]), b((w = s == null ? void 0 : s.response) == null ? void 0 : w.total_pages), c(!1);
75
23
  }).catch(() => {
76
- m(!1);
24
+ c(!1);
77
25
  });
78
26
  };
79
27
  return q(() => {
80
- if (!d(h) && s) {
81
- m(!0);
28
+ if (!p(h) && t) {
29
+ c(!0);
82
30
  const a = { query: h, page: 1 };
83
- l && (a.orientation = l), n && (a.color = n), v(1), C(a, s).then((t) => {
84
- var p, o;
85
- x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((o = t == null ? void 0 : t.response) == null ? void 0 : o.total_pages), m(!1);
31
+ r && (a.orientation = r), i && (a.color = i), v(1), C(a, t).then((l) => {
32
+ var d, s;
33
+ f(((d = l == null ? void 0 : l.response) == null ? void 0 : d.results) || []), b((s = l == null ? void 0 : l.response) == null ? void 0 : s.total_pages), c(!1);
86
34
  }).catch(() => {
87
- m(!1);
35
+ c(!1);
88
36
  });
89
37
  }
90
- }, [l, n, h, s]), d(s) ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
38
+ }, [r, i, h, t]), p(t) ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col items-center justify-center", children: /* @__PURE__ */ e.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
91
39
  "To enable Unsplash, kindly provide your",
92
40
  /* @__PURE__ */ e.jsx(
93
41
  "a",
@@ -102,7 +50,7 @@ const C = async (f, g) => new Promise((s, r) => {
102
50
  ] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
103
51
  /* @__PURE__ */ e.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
104
52
  /* @__PURE__ */ e.jsx(
105
- D,
53
+ E,
106
54
  {
107
55
  type: "text",
108
56
  name: "query",
@@ -134,7 +82,7 @@ const C = async (f, g) => new Promise((s, r) => {
134
82
  label: "Square"
135
83
  }
136
84
  ],
137
- defaultValue: l,
85
+ defaultValue: r,
138
86
  onValueChange: (a) => P(a)
139
87
  }
140
88
  ) }),
@@ -176,21 +124,21 @@ const C = async (f, g) => new Promise((s, r) => {
176
124
  label: "Sepia"
177
125
  }
178
126
  ],
179
- defaultValue: n,
127
+ defaultValue: i,
180
128
  onValueChange: (a) => A(a)
181
129
  }
182
130
  ) })
183
131
  ] }),
184
132
  /* @__PURE__ */ e.jsxs(
185
- E,
133
+ L,
186
134
  {
187
- className: `h-full ${f && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
135
+ className: `h-full ${x && !p(o) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
188
136
  children: [
189
- d(r) && !u && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
137
+ p(o) && !u && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
190
138
  /* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
191
139
  /* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
192
140
  ] }),
193
- f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((a) => /* @__PURE__ */ e.jsx(
141
+ x ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: o.map((a) => /* @__PURE__ */ e.jsx(
194
142
  "div",
195
143
  {
196
144
  role: "button",
@@ -207,7 +155,7 @@ const C = async (f, g) => new Promise((s, r) => {
207
155
  ) })
208
156
  },
209
157
  a.id
210
- )) }) : r.map((a) => /* @__PURE__ */ e.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
158
+ )) }) : o.map((a) => /* @__PURE__ */ e.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
211
159
  "img",
212
160
  {
213
161
  className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
@@ -219,13 +167,13 @@ const C = async (f, g) => new Promise((s, r) => {
219
167
  /* @__PURE__ */ e.jsx(U, { className: "h-6 w-6 animate-spin" }),
220
168
  "  Loading..."
221
169
  ] }),
222
- !d(r) && i < I && !u && /* @__PURE__ */ e.jsx(
223
- L,
170
+ !p(o) && n < I && !u && /* @__PURE__ */ e.jsx(
171
+ T,
224
172
  {
225
173
  size: "sm",
226
174
  variant: "link",
227
175
  className: "w-full",
228
- onClick: () => _(void 0),
176
+ onClick: () => _(),
229
177
  disabled: u,
230
178
  children: u ? "" : "Load More"
231
179
  }
@@ -236,6 +184,6 @@ const C = async (f, g) => new Promise((s, r) => {
236
184
  ] });
237
185
  };
238
186
  export {
239
- $e as default,
187
+ J as default,
240
188
  C as fetchImage
241
189
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BYECrxsp.cjs"),r=require("react"),i=require("lodash-es"),R=require("jotai"),w=require("./context-menu-DfAXjmc8.cjs"),k=require("react-i18next"),b=require("./index-B_be_Or7.cjs"),E=require("lucide-react"),S=R.atom([]),q=({isModalView:l,onSelect:x})=>{const{t}=k.useTranslation(),d=b.useBuilderProp("uploadMediaCallback"),c=b.useBuilderProp("fetchMediaCallback"),[n,m]=R.useAtom(S),[y,p]=r.useState(!1),[j,h]=r.useState(!1),[,N]=r.useState(),[f,u]=r.useState("");r.useEffect(()=>{(async()=>{if(!c)return;h(!0);const s=await c();m(s||[]),h(!1)})()},[]);const v=s=>{var a,o;if(u(""),s&&((o=(a=s==null?void 0:s.target)==null?void 0:a.files)==null?void 0:o.length)>0){const g=s.target.files[0];g.type.startsWith("image")?I(g):u(t("Please select an image"))}},I=async s=>{if(d){p(!0);try{const{url:a}=await d(s);x(a),N(void 0);const o=await c();m(o)}catch(a){m([]),u((a==null?void 0:a.message)||"Something went wrong.")}p(!1)}};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("label",{htmlFor:l?"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-border",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsxRuntimeExports.jsx(E.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:t("Click to upload")})}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("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(E.Loader,{className:"h-6 w-6 animate-spin"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2 text-sm text-gray-500",children:t("Uploading...")})]}):null,f&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:f||t("Something went wrong")})]})}),e.jsxRuntimeExports.jsx("input",{type:"file",id:"image-upload",accept:"image/*",hidden:!0,onChange:v})]}),e.jsxRuntimeExports.jsxs(w.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${l?"px-2":""} pt-2`,children:[i.isEmpty(n)&&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:t("Fetching...")})}),i.isEmpty(n)&&!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:t("No images found")}),e.jsxRuntimeExports.jsx("p",{className:"mb-4 max-w-sm text-muted-foreground",children:t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.")})]}),l?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>x(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.thumbUrl})})},s.id))}):i.map(n,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>x(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=q;
@@ -0,0 +1,101 @@
1
+ import { j as e } from "./jsx-runtime-DGlMoOmv.js";
2
+ import { useState as n, useEffect as k } from "react";
3
+ import { isEmpty as j, map as b } from "lodash-es";
4
+ import { atom as F, useAtom as U } from "jotai";
5
+ import { S as C } from "./context-menu-BbqLeYFX.js";
6
+ import { useTranslation as S } from "react-i18next";
7
+ import { d as N } from "./index-Bn53BEJy.js";
8
+ import { Upload as E, Loader as G } from "lucide-react";
9
+ const P = F([]), $ = ({ isModalView: l, onSelect: i }) => {
10
+ const { t } = S(), u = N("uploadMediaCallback"), d = N("fetchMediaCallback"), [r, c] = U(P), [y, x] = n(!1), [f, p] = n(!1), [, v] = n(), [h, m] = n("");
11
+ k(() => {
12
+ (async () => {
13
+ if (!d) return;
14
+ p(!0);
15
+ const s = await d();
16
+ c(s || []), p(!1);
17
+ })();
18
+ }, []);
19
+ const w = (s) => {
20
+ var a, o;
21
+ if (m(""), s && ((o = (a = s == null ? void 0 : s.target) == null ? void 0 : a.files) == null ? void 0 : o.length) > 0) {
22
+ const g = s.target.files[0];
23
+ g.type.startsWith("image") ? I(g) : m(t("Please select an image"));
24
+ }
25
+ }, I = async (s) => {
26
+ if (u) {
27
+ x(!0);
28
+ try {
29
+ const { url: a } = await u(s);
30
+ i(a), v(void 0);
31
+ const o = await d();
32
+ c(o);
33
+ } catch (a) {
34
+ c([]), m((a == null ? void 0 : a.message) || "Something went wrong.");
35
+ }
36
+ x(!1);
37
+ }
38
+ };
39
+ return /* @__PURE__ */ e.jsxs("div", { children: [
40
+ /* @__PURE__ */ e.jsxs("label", { htmlFor: l ? "upload-in-modal" : "upload-in-panel", children: [
41
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ e.jsxs(
42
+ "label",
43
+ {
44
+ htmlFor: "image-upload",
45
+ className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",
46
+ children: [
47
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
48
+ /* @__PURE__ */ e.jsx(E, { className: "mb-3 h-10 w-10 text-gray-400" }),
49
+ /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: t("Click to upload") }) }),
50
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("SVG, PNG, JPG or GIF (Max. 2mb)") })
51
+ ] }),
52
+ y ? /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
53
+ /* @__PURE__ */ e.jsx(G, { className: "h-6 w-6 animate-spin" }),
54
+ /* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: t("Uploading...") })
55
+ ] }) : null,
56
+ h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || t("Something went wrong") })
57
+ ]
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ e.jsx(
61
+ "input",
62
+ {
63
+ type: "file",
64
+ id: "image-upload",
65
+ accept: "image/*",
66
+ hidden: !0,
67
+ onChange: w
68
+ }
69
+ )
70
+ ] }),
71
+ /* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${l ? "px-2" : ""} pt-2`, children: [
72
+ j(r) && f && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ e.jsx("div", { className: "animate-pulse font-medium", children: t("Fetching...") }) }),
73
+ j(r) && !f && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
74
+ /* @__PURE__ */ e.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
75
+ /* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children: t("No images found") }),
76
+ /* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children: t("It looks like you haven't uploaded any images yet. Start by clicking the upload button above.") })
77
+ ] }),
78
+ l ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(r, (s) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => i(s.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
79
+ "img",
80
+ {
81
+ className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
82
+ alt: s.name,
83
+ src: s.thumbUrl
84
+ }
85
+ ) }) }, s.id)) }) : b(r, (s) => (
86
+ // TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
87
+ /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => i(s.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
88
+ "img",
89
+ {
90
+ className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
91
+ alt: s.name,
92
+ src: s.url
93
+ }
94
+ ) }) }, s.id)
95
+ ))
96
+ ] })
97
+ ] });
98
+ };
99
+ export {
100
+ $ as default
101
+ };