@chaibuilder/sdk 1.2.71 → 1.2.73
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-RqSzFkw6.cjs +1 -0
- package/dist/{CodeEditor-aLPRKFR0.js → CodeEditor-YW3qlWKm.js} +3 -4
- package/dist/{Topbar-0kMZdGSR.js → Topbar-AxOo012V.js} +15 -16
- package/dist/Topbar-TSRyoDEI.cjs +1 -0
- package/dist/UnsplashImages-f2MuRrBt.cjs +1 -0
- package/dist/UnsplashImages-gWlRHso5.js +252 -0
- package/dist/{UploadImages-4keVl9aw.js → UploadImages-hwW7jgSV.js} +9 -10
- package/dist/UploadImages-ruoElyd4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +64 -65
- package/dist/{index-ymKNEhC1.js → index-pjWMG6LC.js} +256 -252
- package/dist/{index-6pKr0wez.cjs → index-tHeU8jPk.cjs} +15 -15
- package/package.json +1 -1
- package/dist/CodeEditor-NQTLhsvr.cjs +0 -1
- package/dist/Topbar-vn__LfR9.cjs +0 -1
- package/dist/UnsplashImages-MGBAHsZC.js +0 -217
- package/dist/UnsplashImages-zzDE2aJR.cjs +0 -1
- package/dist/UploadImages-VfpR3RDE.cjs +0 -1
|
@@ -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-tHeU8jPk.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("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;
|
|
@@ -3,7 +3,7 @@ import k from "@monaco-editor/react";
|
|
|
3
3
|
import { B as C } from "./context-menu-zu6r7B6f.js";
|
|
4
4
|
import { useTranslation as j } from "react-i18next";
|
|
5
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-
|
|
6
|
+
import { u as y, a as N, b as T, c as E } from "./index-pjWMG6LC.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";
|
|
@@ -55,12 +55,11 @@ import "react-autosuggest";
|
|
|
55
55
|
import "fuse.js";
|
|
56
56
|
import "i18next";
|
|
57
57
|
import "framer-motion";
|
|
58
|
-
import "lodash";
|
|
59
58
|
const a = (r) => {
|
|
60
59
|
const i = document.createElement("div");
|
|
61
60
|
return i.innerHTML = r, i.innerHTML;
|
|
62
61
|
};
|
|
63
|
-
function
|
|
62
|
+
function Pt() {
|
|
64
63
|
const { t: r } = j(), [i, n] = l(!1), [m, c] = l(""), [o, s] = y(), [p] = N(), d = T(), u = E(), f = B(
|
|
65
64
|
(e) => {
|
|
66
65
|
const b = a(e);
|
|
@@ -123,5 +122,5 @@ function zt() {
|
|
|
123
122
|
] });
|
|
124
123
|
}
|
|
125
124
|
export {
|
|
126
|
-
|
|
125
|
+
Pt as default
|
|
127
126
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
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, d as N, a as S, e as w, f as
|
|
5
|
-
import { d as a, e as y, F as C, f as B } from "./index-
|
|
4
|
+
import { S as g, c as v, b, d as N, a as S, e as w, f as o } from "./select-1WwjQDp6.js";
|
|
5
|
+
import { d as a, e as y, F as C, f as B } from "./index-pjWMG6LC.js";
|
|
6
6
|
import { B as c, S as p, ac as A } from "./context-menu-zu6r7B6f.js";
|
|
7
7
|
import { useTranslation as x } from "react-i18next";
|
|
8
8
|
import "@radix-ui/react-select";
|
|
@@ -40,7 +40,6 @@ import "fuse.js";
|
|
|
40
40
|
import "i18next";
|
|
41
41
|
import "@radix-ui/react-scroll-area";
|
|
42
42
|
import "framer-motion";
|
|
43
|
-
import "lodash";
|
|
44
43
|
import "@radix-ui/react-switch";
|
|
45
44
|
import "@radix-ui/react-accordion";
|
|
46
45
|
import "@radix-ui/react-alert-dialog";
|
|
@@ -69,14 +68,14 @@ const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
69
68
|
) }),
|
|
70
69
|
/* @__PURE__ */ e.jsx(N, { children: /* @__PURE__ */ e.jsxs(S, { children: [
|
|
71
70
|
/* @__PURE__ */ e.jsx(w, { children: "Fruits" }),
|
|
72
|
-
/* @__PURE__ */ e.jsx(
|
|
73
|
-
/* @__PURE__ */ e.jsx(
|
|
74
|
-
/* @__PURE__ */ e.jsx(
|
|
75
|
-
/* @__PURE__ */ e.jsx(
|
|
76
|
-
/* @__PURE__ */ e.jsx(
|
|
71
|
+
/* @__PURE__ */ e.jsx(o, { value: "apple", children: "Apple" }),
|
|
72
|
+
/* @__PURE__ */ e.jsx(o, { value: "banana", children: "Banana" }),
|
|
73
|
+
/* @__PURE__ */ e.jsx(o, { value: "blueberry", children: "Blueberry" }),
|
|
74
|
+
/* @__PURE__ */ e.jsx(o, { value: "grapes", children: "Grapes" }),
|
|
75
|
+
/* @__PURE__ */ e.jsx(o, { value: "pineapple", children: "Pineapple" })
|
|
77
76
|
] }) })
|
|
78
77
|
] }) }), I = () => {
|
|
79
|
-
const { savePage: i, saveState: t } = y(),
|
|
78
|
+
const { savePage: i, saveState: t } = y(), n = a("hideSaveButton", !1), { t: s } = x(), r = h(() => {
|
|
80
79
|
switch (t) {
|
|
81
80
|
case "SAVING":
|
|
82
81
|
return "animate-pulse bg-gray-300 text-gray-900";
|
|
@@ -86,7 +85,7 @@ const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
86
85
|
return "bg-gray-200 text-gray-500 hover:bg-gray-100";
|
|
87
86
|
}
|
|
88
87
|
}, [t]);
|
|
89
|
-
if (
|
|
88
|
+
if (n)
|
|
90
89
|
return null;
|
|
91
90
|
const u = /* @__PURE__ */ e.jsxs(
|
|
92
91
|
c,
|
|
@@ -106,12 +105,12 @@ const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
106
105
|
);
|
|
107
106
|
return /* @__PURE__ */ e.jsx("div", { className: "flex items-center", children: u });
|
|
108
107
|
}, V = function() {
|
|
109
|
-
const t = a("previewComponent"), [,
|
|
108
|
+
const t = a("previewComponent"), [, n] = B(), { t: s } = x();
|
|
110
109
|
return t ? /* @__PURE__ */ e.jsxs(
|
|
111
110
|
c,
|
|
112
111
|
{
|
|
113
112
|
onClick: (r) => {
|
|
114
|
-
r.preventDefault(),
|
|
113
|
+
r.preventDefault(), n(!0);
|
|
115
114
|
},
|
|
116
115
|
className: "flex h-auto w-fit items-center gap-x-2 bg-gray-200 p-1 px-2",
|
|
117
116
|
size: "sm",
|
|
@@ -122,8 +121,8 @@ const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
122
121
|
]
|
|
123
122
|
}
|
|
124
123
|
) : null;
|
|
125
|
-
},
|
|
126
|
-
const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []),
|
|
124
|
+
}, Le = () => {
|
|
125
|
+
const i = a("topBarComponents.left", []), t = a("topBarComponents.center", []), n = a("topBarComponents.right", []), s = a("editable", !0);
|
|
127
126
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
128
127
|
/* @__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(
|
|
129
128
|
i.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
@@ -137,11 +136,11 @@ const P = () => a("languages", ["en"]), k = () => P().length === 1 ? null : /* @
|
|
|
137
136
|
/* @__PURE__ */ e.jsx(A, { orientation: "vertical" }),
|
|
138
137
|
s ? /* @__PURE__ */ e.jsx(I, {}) : null,
|
|
139
138
|
l.Children.toArray(
|
|
140
|
-
|
|
139
|
+
n.map((r) => /* @__PURE__ */ e.jsx(m, { fallback: /* @__PURE__ */ e.jsx(p, { className: "h-10" }), children: /* @__PURE__ */ e.jsx(r, {}) }))
|
|
141
140
|
)
|
|
142
141
|
] })
|
|
143
142
|
] });
|
|
144
143
|
};
|
|
145
144
|
export {
|
|
146
|
-
|
|
145
|
+
Le as default
|
|
147
146
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),u=require("react"),o=require("@radix-ui/react-icons"),r=require("./select-FnytvxNn.cjs"),s=require("./index-tHeU8jPk.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("@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:n}=c.useTranslation(),i=u.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:n(t==="SAVING"?"saving":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:n}=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:n("preview")})]}):null},E=()=>{const a=s.useBuilderProp("topBarComponents.left",[]),t=s.useBuilderProp("topBarComponents.center",[]),l=s.useBuilderProp("topBarComponents.right",[]),n=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(a.map(i=>e.jsxRuntimeExports.jsx(u.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:u.Children.toArray(t.map(i=>e.jsxRuntimeExports.jsx(u.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"}),n?e.jsxRuntimeExports.jsx(q,{}):null,u.Children.toArray(l.map(i=>e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx(x.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i,{})})))]})]})};exports.default=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),m=require("lodash-es"),I=require("@radix-ui/react-icons"),A=require("unsplash-js"),p=require("./context-menu-Lx_MAqsu.cjs");require("react-i18next");const g=require("./index-tHeU8jPk.cjs"),_=require("@react-hookz/web"),T=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("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("framer-motion");const v=async(d,f)=>new Promise((a,i)=>{A.createApi({accessKey:f}).search.getPhotos(d).then(o=>{a(o)}).catch(o=>i(o))}),B=({isModalView:d,onSelect:f})=>{const a=g.useBuilderProp("unsplashAccessKey",""),[i,q]=n.useState([]),[o,E]=n.useState(0),[l,S]=n.useState(),[u,P]=n.useState(),[w,y]=n.useState(0),[h,C]=_.useDebouncedState("",1e3),[j,c]=n.useState(!1),k=async r=>{if(m.isEmpty(h))return;let t=o+1;r&&(r.preventDefault(),t=1),c(!0),E(t);const x={query:h,page:t};l&&(x.orientation=l),u&&(x.color=u),v(x,a).then(s=>{var b,R,N;q(t===1?((b=s==null?void 0:s.response)==null?void 0:b.results)||[]:[...i,...((R=s==null?void 0:s.response)==null?void 0:R.results)||[]]),y((N=s==null?void 0:s.response)==null?void 0:N.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!m.isEmpty(h)&&a){c(!0);const r={query:h,page:1};l&&(r.orientation=l),u&&(r.color=u),E(1),v(r,a).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),y((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[l,u,h,a]),m.isEmpty(a)?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 rounded-md border bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsx(p.Input,{type:"text",name:"query",className:"input",placeholder:'Try "dog" or "apple"',onChange:r=>C(r.target.value)}),e.jsxRuntimeExports.jsxs(p.Popover,{children:[e.jsxRuntimeExports.jsx(p.PopoverTrigger,{asChild:!0,className:"h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200",children:e.jsxRuntimeExports.jsx(I.MixerHorizontalIcon,{})}),e.jsxRuntimeExports.jsx(p.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.jsx(g.ChaiSelect,{options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:l,onValueChange:r=>S(r)}),e.jsxRuntimeExports.jsx("div",{className:"pb-1 pt-2 text-sm font-medium",children:"Color"}),e.jsxRuntimeExports.jsx(g.ChaiSelect,{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:u,onValueChange:r=>P(r)})]})})]})]}),e.jsxRuntimeExports.jsxs(p.ScrollArea,{className:`h-full ${d&&!m.isEmpty(i)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[m.isEmpty(i)&&!j&&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:i.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>f(r.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:r.alt_description,src:r.urls.small})})},r.id))}):i.map(r=>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:r.alt_description,src:r.urls.small})})},r.id)),j&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(T.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!m.isEmpty(i)&&o<w&&!j&&e.jsxRuntimeExports.jsx(p.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>k(void 0),disabled:j,children:j?"":"Load More"})]})]})};exports.default=B;exports.fetchImage=v;
|
|
@@ -0,0 +1,252 @@
|
|
|
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";
|
|
4
|
+
import { MixerHorizontalIcon as S } from "@radix-ui/react-icons";
|
|
5
|
+
import { createApi as B } from "unsplash-js";
|
|
6
|
+
import { N as D, P as E, r as L, s as T, V as z, B as F } from "./context-menu-zu6r7B6f.js";
|
|
7
|
+
import "react-i18next";
|
|
8
|
+
import { d as K, C as P } from "./index-pjWMG6LC.js";
|
|
9
|
+
import { useDebouncedState as U } from "@react-hookz/web";
|
|
10
|
+
import { Loader as V } from "lucide-react";
|
|
11
|
+
import "@radix-ui/react-switch";
|
|
12
|
+
import "@radix-ui/react-accordion";
|
|
13
|
+
import "@radix-ui/react-alert-dialog";
|
|
14
|
+
import "@radix-ui/react-slot";
|
|
15
|
+
import "class-variance-authority";
|
|
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-dropdown-menu";
|
|
23
|
+
import "@radix-ui/react-separator";
|
|
24
|
+
import "@radix-ui/react-toast";
|
|
25
|
+
import "cmdk";
|
|
26
|
+
import "@radix-ui/react-dialog";
|
|
27
|
+
import "@radix-ui/react-context-menu";
|
|
28
|
+
import "clsx";
|
|
29
|
+
import "tailwind-merge";
|
|
30
|
+
import "jotai";
|
|
31
|
+
import "./iconBase-zweRWSz0.js";
|
|
32
|
+
import "@chaibuilder/runtime";
|
|
33
|
+
import "./plugin-sJ3Hzvpv.js";
|
|
34
|
+
import "tree-model";
|
|
35
|
+
import "react-quill";
|
|
36
|
+
import "./STRINGS-rPGH65PW.js";
|
|
37
|
+
import "react-hotkeys-hook";
|
|
38
|
+
import "@floating-ui/dom";
|
|
39
|
+
import "@floating-ui/react-dom";
|
|
40
|
+
import "flagged";
|
|
41
|
+
import "@tailwindcss/typography";
|
|
42
|
+
import "@tailwindcss/forms";
|
|
43
|
+
import "@tailwindcss/aspect-ratio";
|
|
44
|
+
import "tailwindcss-palette-generator";
|
|
45
|
+
import "react-wrap-balancer";
|
|
46
|
+
import "react-dom";
|
|
47
|
+
import "prop-types";
|
|
48
|
+
import "re-resizable";
|
|
49
|
+
import "@rjsf/validator-ajv8";
|
|
50
|
+
import "@rjsf/core";
|
|
51
|
+
import "react-arborist";
|
|
52
|
+
import "himalaya";
|
|
53
|
+
import "react-icons-picker";
|
|
54
|
+
import "react-autosuggest";
|
|
55
|
+
import "fuse.js";
|
|
56
|
+
import "i18next";
|
|
57
|
+
import "framer-motion";
|
|
58
|
+
const C = async (h, v) => new Promise((s, r) => {
|
|
59
|
+
B({ accessKey: v }).search.getPhotos(h).then((i) => {
|
|
60
|
+
s(i);
|
|
61
|
+
}).catch((i) => r(i));
|
|
62
|
+
}), He = ({ isModalView: h, onSelect: v }) => {
|
|
63
|
+
const s = K("unsplashAccessKey", ""), [r, f] = c([]), [i, g] = c(0), [l, w] = c(), [n, k] = c(), [A, j] = c(0), [u, I] = U("", 1e3), [x, m] = c(!1), _ = async (t) => {
|
|
64
|
+
if (d(u))
|
|
65
|
+
return;
|
|
66
|
+
let o = i + 1;
|
|
67
|
+
t && (t.preventDefault(), o = 1), m(!0), g(o);
|
|
68
|
+
const p = { query: u, page: o };
|
|
69
|
+
l && (p.orientation = l), n && (p.color = n), C(p, s).then((a) => {
|
|
70
|
+
var b, y, N;
|
|
71
|
+
f(o === 1 ? ((b = a == null ? void 0 : a.response) == null ? void 0 : b.results) || [] : [...r, ...((y = a == null ? void 0 : a.response) == null ? void 0 : y.results) || []]), j((N = a == null ? void 0 : a.response) == null ? void 0 : N.total_pages), m(!1);
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
m(!1);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
return q(() => {
|
|
77
|
+
if (!d(u) && s) {
|
|
78
|
+
m(!0);
|
|
79
|
+
const t = { query: u, page: 1 };
|
|
80
|
+
l && (t.orientation = l), n && (t.color = n), g(1), C(t, s).then((o) => {
|
|
81
|
+
var p, a;
|
|
82
|
+
f(((p = o == null ? void 0 : o.response) == null ? void 0 : p.results) || []), j((a = o == null ? void 0 : o.response) == null ? void 0 : a.total_pages), m(!1);
|
|
83
|
+
}).catch(() => {
|
|
84
|
+
m(!1);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [l, n, u, 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: [
|
|
88
|
+
"To enable Unsplash, kindly provide your",
|
|
89
|
+
/* @__PURE__ */ e.jsx(
|
|
90
|
+
"a",
|
|
91
|
+
{
|
|
92
|
+
href: "https://unsplash.com/documentation#public-authentication",
|
|
93
|
+
className: "px-1 underline hover:text-blue-400",
|
|
94
|
+
target: "_blank",
|
|
95
|
+
rel: "noopener noreferrer",
|
|
96
|
+
children: "Unsplash Access Key"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
100
|
+
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center rounded-md border bg-gray-100 p-px", children: [
|
|
101
|
+
/* @__PURE__ */ e.jsx(
|
|
102
|
+
D,
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
name: "query",
|
|
106
|
+
className: "input",
|
|
107
|
+
placeholder: 'Try "dog" or "apple"',
|
|
108
|
+
onChange: (t) => I(t.target.value)
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ e.jsxs(E, { children: [
|
|
112
|
+
/* @__PURE__ */ e.jsx(L, { asChild: !0, className: "h-full w-10 cursor-pointer p-2.5 hover:bg-slate-200", children: /* @__PURE__ */ e.jsx(S, {}) }),
|
|
113
|
+
/* @__PURE__ */ e.jsx(
|
|
114
|
+
T,
|
|
115
|
+
{
|
|
116
|
+
side: h ? "bottom" : "right",
|
|
117
|
+
className: "z-[9999] flex w-max items-center justify-center",
|
|
118
|
+
children: /* @__PURE__ */ e.jsxs("div", { children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "py-1 text-sm font-medium", children: "Orientation" }),
|
|
120
|
+
/* @__PURE__ */ e.jsx(
|
|
121
|
+
P,
|
|
122
|
+
{
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
value: "",
|
|
126
|
+
label: "All"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: "landscape",
|
|
130
|
+
label: "Landscape"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: "portrait",
|
|
134
|
+
label: "Portrait"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
value: "squarish",
|
|
138
|
+
label: "Square"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
defaultValue: l,
|
|
142
|
+
onValueChange: (t) => w(t)
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ e.jsx("div", { className: "pb-1 pt-2 text-sm font-medium", children: "Color" }),
|
|
146
|
+
/* @__PURE__ */ e.jsx(
|
|
147
|
+
P,
|
|
148
|
+
{
|
|
149
|
+
options: [
|
|
150
|
+
{
|
|
151
|
+
value: "",
|
|
152
|
+
label: "All"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "black_and_white",
|
|
156
|
+
label: "Black and White"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: "black",
|
|
160
|
+
label: "Black"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "white",
|
|
164
|
+
label: "White"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
value: "night",
|
|
168
|
+
label: "Night"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "warm",
|
|
172
|
+
label: "Warm"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "cool",
|
|
176
|
+
label: "Cool"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "sepia",
|
|
180
|
+
label: "Sepia"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
defaultValue: n,
|
|
184
|
+
onValueChange: (t) => k(t)
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] })
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ e.jsxs(
|
|
193
|
+
z,
|
|
194
|
+
{
|
|
195
|
+
className: `h-full ${h && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
196
|
+
children: [
|
|
197
|
+
d(r) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
|
198
|
+
/* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
199
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
200
|
+
] }),
|
|
201
|
+
h ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((t) => /* @__PURE__ */ e.jsx(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
role: "button",
|
|
205
|
+
tabIndex: 0,
|
|
206
|
+
className: "my-1 flex",
|
|
207
|
+
onClick: () => v(t.urls.regular),
|
|
208
|
+
children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
209
|
+
"img",
|
|
210
|
+
{
|
|
211
|
+
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
212
|
+
alt: t.alt_description,
|
|
213
|
+
src: t.urls.small
|
|
214
|
+
}
|
|
215
|
+
) })
|
|
216
|
+
},
|
|
217
|
+
t.id
|
|
218
|
+
)) }) : r.map((t) => (
|
|
219
|
+
// TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
|
|
220
|
+
/* @__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(
|
|
221
|
+
"img",
|
|
222
|
+
{
|
|
223
|
+
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
224
|
+
alt: t.alt_description,
|
|
225
|
+
src: t.urls.small
|
|
226
|
+
}
|
|
227
|
+
) }) }, t.id)
|
|
228
|
+
)),
|
|
229
|
+
x && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
230
|
+
/* @__PURE__ */ e.jsx(V, { className: "h-6 w-6 animate-spin" }),
|
|
231
|
+
" Loading..."
|
|
232
|
+
] }),
|
|
233
|
+
!d(r) && i < A && !x && /* @__PURE__ */ e.jsx(
|
|
234
|
+
F,
|
|
235
|
+
{
|
|
236
|
+
size: "sm",
|
|
237
|
+
variant: "link",
|
|
238
|
+
className: "w-full",
|
|
239
|
+
onClick: () => _(void 0),
|
|
240
|
+
disabled: x,
|
|
241
|
+
children: x ? "" : "Load More"
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
] });
|
|
248
|
+
};
|
|
249
|
+
export {
|
|
250
|
+
He as default,
|
|
251
|
+
C as fetchImage
|
|
252
|
+
};
|
|
@@ -4,7 +4,7 @@ import { isEmpty as j, map as b } from "lodash-es";
|
|
|
4
4
|
import { atom as F, useAtom as U } from "jotai";
|
|
5
5
|
import { V as C } from "./context-menu-zu6r7B6f.js";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
|
-
import { d as y } from "./index-
|
|
7
|
+
import { d as y } from "./index-pjWMG6LC.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";
|
|
@@ -54,9 +54,8 @@ import "react-autosuggest";
|
|
|
54
54
|
import "fuse.js";
|
|
55
55
|
import "i18next";
|
|
56
56
|
import "framer-motion";
|
|
57
|
-
|
|
58
|
-
const
|
|
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("");
|
|
57
|
+
const S = F([]), Je = ({ isModalView: o, onSelect: m }) => {
|
|
58
|
+
const { t: r } = E(), p = y("uploadMediaCallback"), n = y("fetchMediaCallback"), [a, d] = U(S), [N, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, c] = l("");
|
|
60
59
|
k(() => {
|
|
61
60
|
(async () => {
|
|
62
61
|
if (!n)
|
|
@@ -68,20 +67,20 @@ const S = F([]), Le = ({ isModalView: o, onSelect: m }) => {
|
|
|
68
67
|
}, []);
|
|
69
68
|
const w = (t) => {
|
|
70
69
|
var s, i;
|
|
71
|
-
if (
|
|
70
|
+
if (c(""), t && ((i = (s = t == null ? void 0 : t.target) == null ? void 0 : s.files) == null ? void 0 : i.length) > 0) {
|
|
72
71
|
const g = t.target.files[0];
|
|
73
|
-
g.type.startsWith("image") ? I(g) :
|
|
72
|
+
g.type.startsWith("image") ? I(g) : c(r("Please select an image"));
|
|
74
73
|
}
|
|
75
74
|
}, I = async (t) => {
|
|
76
|
-
if (
|
|
75
|
+
if (p) {
|
|
77
76
|
u(!0);
|
|
78
77
|
try {
|
|
79
|
-
const { url: s } = await
|
|
78
|
+
const { url: s } = await p(t);
|
|
80
79
|
m(s), v(void 0);
|
|
81
80
|
const i = await n();
|
|
82
81
|
d(i);
|
|
83
82
|
} catch (s) {
|
|
84
|
-
d([]),
|
|
83
|
+
d([]), c((s == null ? void 0 : s.message) || "Something went wrong.");
|
|
85
84
|
}
|
|
86
85
|
u(!1);
|
|
87
86
|
}
|
|
@@ -147,5 +146,5 @@ const S = F([]), Le = ({ isModalView: o, onSelect: m }) => {
|
|
|
147
146
|
] });
|
|
148
147
|
};
|
|
149
148
|
export {
|
|
150
|
-
|
|
149
|
+
Je as default
|
|
151
150
|
};
|
|
@@ -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-tHeU8jPk.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("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,h]=i.useState(!1),[,R]=i.useState(),[q,m]=i.useState("");i.useEffect(()=>{(async()=>{if(!x)return;h(!0);const r=await x();c(r||[]),h(!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,q&&e.jsxRuntimeExports.jsx("p",{className:"pb-2 text-xs text-red-500",children:q||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;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-tHeU8jPk.cjs"),r=require("./iconBase-vJD0OXxU.cjs"),s=require("react-i18next"),u=require("i18next");require("./jsx-runtime-JYMCiFoE.cjs");require("react");require("./context-menu-Lx_MAqsu.cjs");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("lodash-es");require("jotai");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("framer-motion");exports.AISetContext=e.AISetContext;exports.AIUserPrompt=e.AIUserPrompt;exports.AddBlocksPanel=e.AddBlocksPanel;exports.BlockAttributesEditor=e.BlockAttributesEditor;exports.BlockPropsEditor=e.BlockSettings;exports.BlockStyleEditor=e.BlockStyling;exports.ChaiBuilderCanvas=e.CanvasArea;exports.ChaiBuilderEditor=e.ChaiBuilderEditor;exports.DarkModeSwitcher=e.DarkMode;exports.ImportHTML=e.ImportHTML;exports.Outline=e.Outline;exports.ScreenSizes=e.Breakpoints;exports.ThemeOptions=e.ThemeOptions;exports.UILibraries=e.UILibraries;exports.UndoRedo=e.UndoRedo;exports.getBlocksFromHTML=e.getBlocksFromHTML;exports.useActiveModal=e.useActiveModal;exports.useActivePanel=e.useActivePanel;exports.useAddBlock=e.useAddBlock;exports.useAddBlockParent=e.useAddBlockParent;exports.useAddClassesToBlocks=e.useAddClassesToBlocks;exports.useAllBlocks=e.useAllBlocks;exports.useBlocksStore=e.useBlocksStore;exports.useBrandingOptions=e.useBrandingOptions;exports.useBuilderProp=e.useBuilderProp;exports.useBuilderReset=e.useBuilderReset;exports.useCanvasWidth=e.useCanvasWidth;exports.useCanvasZoom=e.useCanvasZoom;exports.useCodeEditor=e.useCodeEditor;exports.useCopyBlockIds=e.useCopyBlockIds;exports.useCopyToClipboard=e.useCopyToClipboard;exports.useCurrentPage=e.useCurrentPage;exports.useCutBlockIds=e.useCutBlockIds;exports.useDarkMode=e.useDarkMode;exports.useDuplicateBlocks=e.useDuplicateBlocks;exports.useGetPageData=e.useGetPageData;exports.useHiddenBlockIds=e.useHiddenBlockIds;exports.useHighlightBlockId=e.useHighlightBlockId;exports.usePasteBlocks=e.usePasteBlocks;exports.usePreviewMode=e.usePreviewMode;exports.useReadOnlyMode=e.useReadOnlyMode;exports.useRemoveBlocks=e.useRemoveBlocks;exports.useRemoveClassesFromBlocks=e.useRemoveClassesFromBlocks;exports.useSavePage=e.useSavePage;exports.useSelectedBlock=e.useSelectedBlock;exports.useSelectedBlockAllClasses=e.useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=e.useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=e.useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=e.useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=e.useSelectedBreakpoints;exports.useSelectedStylingBlocks=e.useSelectedStylingBlocks;exports.useStylingBreakpoint=e.useStylingBreakpoint;exports.useStylingState=e.useStylingState;exports.useUILibraryBlocks=e.useUILibraryBlocks;exports.useUndoManager=e.useUndoManager;exports.useUpdateBlocksProps=e.useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=e.useUpdateBlocksPropsRealtime;exports.generateBlockId=r.generateUUID;exports.mergeClasses=r.cn;Object.defineProperty(exports,"useTranslation",{enumerable:!0,get:()=>s.useTranslation});exports.i18n=u;
|
package/dist/core.d.ts
CHANGED
|
@@ -124,9 +124,9 @@ export declare interface ChaiBuilderEditorProps {
|
|
|
124
124
|
sideBarComponents?: {
|
|
125
125
|
bottom?: ReactComponentType[];
|
|
126
126
|
top?: {
|
|
127
|
-
icon:
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
icon: ReactNode;
|
|
128
|
+
label: string;
|
|
129
|
+
component: ReactComponentType;
|
|
130
130
|
}[];
|
|
131
131
|
};
|
|
132
132
|
topBarComponents?: {
|