@chaibuilder/sdk 1.2.90 → 1.2.92
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-awVVPqel.cjs +1 -0
- package/dist/{CodeEditor-t2oVfSyK.js → CodeEditor-orTEdw7a.js} +31 -28
- package/dist/Topbar--KOfsR94.cjs +1 -0
- package/dist/{Topbar-x0tjZaWC.js → Topbar-OPlOc1Ha.js} +22 -19
- package/dist/{UnsplashImages-965l8pGL.js → UnsplashImages-WaGyNL1z.js} +36 -33
- package/dist/UnsplashImages-g-8MvB9W.cjs +1 -0
- package/dist/{UploadImages-glp4ZyQm.js → UploadImages-GiKofaXX.js} +37 -61
- package/dist/UploadImages-Ic_iZgWY.cjs +1 -0
- package/dist/_commonjsHelpers-f3sTPFkQ.js +8 -0
- package/dist/_commonjsHelpers-f52AuuUj.cjs +1 -0
- package/dist/button-9Duvj2dH.js +42 -0
- package/dist/button-oQgWN0j0.cjs +1 -0
- package/dist/context-menu-8MWP_Ikf.cjs +1 -0
- package/dist/context-menu-yLeOsx9j.js +943 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +34 -11
- package/dist/core.js +81 -76
- package/dist/iconBase-BnEC5_qG.js +1583 -0
- package/dist/iconBase-_bgMuxa5.cjs +1 -0
- package/dist/index-Hj8wMhx_.cjs +223 -0
- package/dist/{index-qptv-vi2.js → index-yJ1H6b2C.js} +9771 -10776
- package/dist/plugin-02QsHeBE.cjs +1 -0
- package/dist/{plugin-P0tpo_XZ.cjs → plugin-BXpjdQxx.cjs} +1 -1
- package/dist/{plugin-f5uJtdXY.js → plugin-DdKuAR7p.js} +1 -1
- package/dist/plugin-VDzc8jUO.js +52 -0
- package/dist/render.cjs +2 -2
- package/dist/render.js +7 -6
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +7 -6
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +242 -301
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +344 -289
- package/package.json +2 -2
- package/dist/CodeEditor-gqhS0hpB.cjs +0 -1
- package/dist/Topbar-s9YVXp9Z.cjs +0 -1
- package/dist/UnsplashImages-DRQaQoM-.cjs +0 -1
- package/dist/UploadImages-CumBJ3oE.cjs +0 -1
- package/dist/context-menu--DZnHfxj.cjs +0 -1
- package/dist/context-menu-DeUUflYX.js +0 -910
- package/dist/iconBase-vJD0OXxU.cjs +0 -1
- package/dist/iconBase-zweRWSz0.js +0 -323
- package/dist/index-BuZrwlQG.cjs +0 -223
- package/dist/plugin-_F-KZp1i.cjs +0 -1
- package/dist/plugin-sJ3Hzvpv.js +0 -57
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),h=require("@monaco-editor/react"),k=require("./button-oQgWN0j0.cjs"),C=require("react-i18next"),u=require("react"),o=require("./iconBase-_bgMuxa5.cjs"),E=require("./index-Hj8wMhx_.cjs"),R=require("@radix-ui/react-icons"),g=require("@react-hookz/web");require("@radix-ui/react-slot");require("class-variance-authority");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./_commonjsHelpers-f52AuuUj.cjs");require("@chaibuilder/runtime");require("tree-model");require("./context-menu-8MWP_Ikf.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");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 a=s=>{const t=document.createElement("div");return t.innerHTML=s,t.innerHTML};function v(){const{t:s}=C.useTranslation(),[t,q]=u.useState(!1),[l,d]=u.useState(""),[r,n]=E.useCodeEditor(),[c]=o.useSelectedBlockIds(),x=o.useUpdateBlocksProps(),m=o.useUpdateBlocksPropsRealtime(),p=g.useThrottledCallback(i=>{const f=a(i);m([r.blockId],{[r.blockProp]:f})},[],300),j=u.useCallback(()=>{if(t){const i=a(l);x([r.blockId],{[r.blockProp]:i})}},[t,l]);u.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),n(null))},[c]);const b=()=>{n(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:b,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:()=>n(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(R.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(h,{onMount:i=>{i.setValue(r.initialCode)},onChange:i=>{q(!0),d(i),p(i)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=v;
|
|
@@ -1,36 +1,38 @@
|
|
|
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 "./
|
|
3
|
+
import { B as C } from "./button-9Duvj2dH.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 {
|
|
6
|
+
import { a as y, n as N, D as T } from "./iconBase-BnEC5_qG.js";
|
|
7
|
+
import { u as E } from "./index-yJ1H6b2C.js";
|
|
7
8
|
import { Cross2Icon as w } from "@radix-ui/react-icons";
|
|
8
9
|
import { useThrottledCallback as B } from "@react-hookz/web";
|
|
10
|
+
import "@radix-ui/react-slot";
|
|
11
|
+
import "class-variance-authority";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "tailwind-merge";
|
|
14
|
+
import "lodash-es";
|
|
15
|
+
import "jotai";
|
|
16
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
17
|
+
import "@chaibuilder/runtime";
|
|
18
|
+
import "tree-model";
|
|
19
|
+
import "./context-menu-yLeOsx9j.js";
|
|
9
20
|
import "@radix-ui/react-switch";
|
|
10
21
|
import "@radix-ui/react-accordion";
|
|
11
|
-
import "class-variance-authority";
|
|
12
22
|
import "@radix-ui/react-alert-dialog";
|
|
13
|
-
import "@radix-ui/react-slot";
|
|
14
23
|
import "@radix-ui/react-label";
|
|
15
24
|
import "@radix-ui/react-scroll-area";
|
|
16
25
|
import "@radix-ui/react-tabs";
|
|
17
26
|
import "@radix-ui/react-tooltip";
|
|
18
27
|
import "@radix-ui/react-popover";
|
|
19
28
|
import "@radix-ui/react-hover-card";
|
|
29
|
+
import "@radix-ui/react-select";
|
|
20
30
|
import "@radix-ui/react-dropdown-menu";
|
|
21
31
|
import "@radix-ui/react-separator";
|
|
22
32
|
import "@radix-ui/react-toast";
|
|
23
33
|
import "cmdk";
|
|
24
34
|
import "@radix-ui/react-dialog";
|
|
25
35
|
import "@radix-ui/react-context-menu";
|
|
26
|
-
import "clsx";
|
|
27
|
-
import "tailwind-merge";
|
|
28
|
-
import "lodash-es";
|
|
29
|
-
import "jotai";
|
|
30
|
-
import "./iconBase-zweRWSz0.js";
|
|
31
|
-
import "@chaibuilder/runtime";
|
|
32
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
33
|
-
import "tree-model";
|
|
34
36
|
import "react-quill";
|
|
35
37
|
import "./STRINGS-TDN5UhWi.js";
|
|
36
38
|
import "flagged";
|
|
@@ -42,6 +44,7 @@ import "@tailwindcss/typography";
|
|
|
42
44
|
import "@tailwindcss/forms";
|
|
43
45
|
import "@tailwindcss/aspect-ratio";
|
|
44
46
|
import "tailwindcss-palette-generator";
|
|
47
|
+
import "./plugin-VDzc8jUO.js";
|
|
45
48
|
import "react-wrap-balancer";
|
|
46
49
|
import "react-dom";
|
|
47
50
|
import "prop-types";
|
|
@@ -57,24 +60,24 @@ import "react-autosuggest";
|
|
|
57
60
|
import "fuse.js";
|
|
58
61
|
import "i18next";
|
|
59
62
|
import "framer-motion";
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
return
|
|
63
|
+
const n = (r) => {
|
|
64
|
+
const e = document.createElement("div");
|
|
65
|
+
return e.innerHTML = r, e.innerHTML;
|
|
63
66
|
};
|
|
64
|
-
function
|
|
65
|
-
const { t: r } = j(), [
|
|
66
|
-
(
|
|
67
|
-
const b =
|
|
67
|
+
function Dt() {
|
|
68
|
+
const { t: r } = j(), [e, a] = l(!1), [m, c] = l(""), [o, s] = E(), [p] = y(), d = N(), u = T(), f = B(
|
|
69
|
+
(i) => {
|
|
70
|
+
const b = n(i);
|
|
68
71
|
u([o.blockId], { [o.blockProp]: b });
|
|
69
72
|
},
|
|
70
73
|
[],
|
|
71
74
|
300
|
|
72
75
|
), x = v(() => {
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
d([o.blockId], { [o.blockProp]:
|
|
76
|
+
if (e) {
|
|
77
|
+
const i = n(m);
|
|
78
|
+
d([o.blockId], { [o.blockProp]: i });
|
|
76
79
|
}
|
|
77
|
-
}, [
|
|
80
|
+
}, [e, m]);
|
|
78
81
|
g(() => {
|
|
79
82
|
p.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
|
|
80
83
|
}, [p]);
|
|
@@ -103,11 +106,11 @@ function Ht() {
|
|
|
103
106
|
/* @__PURE__ */ t.jsx(
|
|
104
107
|
k,
|
|
105
108
|
{
|
|
106
|
-
onMount: (
|
|
107
|
-
|
|
109
|
+
onMount: (i) => {
|
|
110
|
+
i.setValue(o.initialCode);
|
|
108
111
|
},
|
|
109
|
-
onChange: (
|
|
110
|
-
|
|
112
|
+
onChange: (i) => {
|
|
113
|
+
a(!0), c(i), f(i);
|
|
111
114
|
},
|
|
112
115
|
height: "100%",
|
|
113
116
|
defaultLanguage: "html",
|
|
@@ -124,5 +127,5 @@ function Ht() {
|
|
|
124
127
|
] });
|
|
125
128
|
}
|
|
126
129
|
export {
|
|
127
|
-
|
|
130
|
+
Dt as default
|
|
128
131
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),a=require("./context-menu-8MWP_Ikf.cjs"),x=require("./button-oQgWN0j0.cjs"),i=require("./iconBase-_bgMuxa5.cjs"),c=require("react-i18next"),l=require("./index-Hj8wMhx_.cjs"),p=require("@radix-ui/react-icons");require("@radix-ui/react-switch");require("@radix-ui/react-accordion");require("class-variance-authority");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("clsx");require("tailwind-merge");require("lodash-es");require("jotai");require("./_commonjsHelpers-f52AuuUj.cjs");require("@react-hookz/web");require("@chaibuilder/runtime");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");require("re-resizable");require("lucide-react");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 m=()=>{const{savePage:o,saveState:r}=i.useSavePage(),{t:s}=c.useTranslation(),u=e.jsxRuntimeExports.jsxs(x.Button,{disabled:r==="SAVING",onClick:t=>{t.preventDefault(),o()},className:i.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":r==="SAVING","bg-green-500 text-white hover:bg-green-600 hover:text-white dark:bg-green-600 dark:text-white":r==="SAVED"}),size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(l.FaCheck,{className:"text-sm text-white"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:s(r==="SAVING"?"saving":r==="SAVED"?"saved":"unsaved")})]});return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:u})},q=function(){const r=i.useBuilderProp("previewComponent"),[,s]=l.usePreviewMode(),{t:u}=c.useTranslation();return r?e.jsxRuntimeExports.jsxs(x.Button,{onClick:t=>{t.preventDefault(),s(!0)},className:"flex h-auto w-fit items-center gap-x-2 p-1 px-2",size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx(p.EyeOpenIcon,{className:"text-xs"}),e.jsxRuntimeExports.jsx("span",{className:"text-sm",children:u("preview")})]}):null},j=()=>{const o=i.useBuilderProp("topBarComponents.left",[]),r=i.useBuilderProp("topBarComponents.center",[]),s=i.useBuilderProp("topBarComponents.right",[]),u=i.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(o.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:n.Children.toArray(r.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxRuntimeExports.jsx(q,{}),e.jsxRuntimeExports.jsx(a.Separator,{orientation:"vertical"}),u?e.jsxRuntimeExports.jsx(m,{}):null,n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(a.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))]})]})};exports.default=j;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
2
|
import m, { Suspense as p } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { S as n, ab as x } from "./context-menu-yLeOsx9j.js";
|
|
4
|
+
import { B as l } from "./button-9Duvj2dH.js";
|
|
5
|
+
import { T as d, B as h, m as s } from "./iconBase-BnEC5_qG.js";
|
|
6
|
+
import { useTranslation as c } from "react-i18next";
|
|
7
|
+
import { F as f, a as u } from "./index-yJ1H6b2C.js";
|
|
7
8
|
import { EyeOpenIcon as v } from "@radix-ui/react-icons";
|
|
8
9
|
import "@radix-ui/react-switch";
|
|
9
10
|
import "@radix-ui/react-accordion";
|
|
10
11
|
import "class-variance-authority";
|
|
11
12
|
import "@radix-ui/react-alert-dialog";
|
|
12
|
-
import "@radix-ui/react-slot";
|
|
13
13
|
import "@radix-ui/react-label";
|
|
14
14
|
import "@radix-ui/react-scroll-area";
|
|
15
15
|
import "@radix-ui/react-tabs";
|
|
16
16
|
import "@radix-ui/react-tooltip";
|
|
17
17
|
import "@radix-ui/react-popover";
|
|
18
18
|
import "@radix-ui/react-hover-card";
|
|
19
|
+
import "@radix-ui/react-select";
|
|
19
20
|
import "@radix-ui/react-dropdown-menu";
|
|
20
21
|
import "@radix-ui/react-separator";
|
|
21
22
|
import "@radix-ui/react-toast";
|
|
22
23
|
import "cmdk";
|
|
23
24
|
import "@radix-ui/react-dialog";
|
|
24
25
|
import "@radix-ui/react-context-menu";
|
|
26
|
+
import "@radix-ui/react-slot";
|
|
25
27
|
import "clsx";
|
|
26
28
|
import "tailwind-merge";
|
|
27
29
|
import "lodash-es";
|
|
28
30
|
import "jotai";
|
|
29
|
-
import "
|
|
30
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
31
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
31
32
|
import "@react-hookz/web";
|
|
33
|
+
import "@chaibuilder/runtime";
|
|
32
34
|
import "tree-model";
|
|
33
35
|
import "react-quill";
|
|
34
36
|
import "./STRINGS-TDN5UhWi.js";
|
|
@@ -41,6 +43,7 @@ import "@tailwindcss/typography";
|
|
|
41
43
|
import "@tailwindcss/forms";
|
|
42
44
|
import "@tailwindcss/aspect-ratio";
|
|
43
45
|
import "tailwindcss-palette-generator";
|
|
46
|
+
import "./plugin-VDzc8jUO.js";
|
|
44
47
|
import "react-wrap-balancer";
|
|
45
48
|
import "react-dom";
|
|
46
49
|
import "prop-types";
|
|
@@ -57,14 +60,14 @@ import "fuse.js";
|
|
|
57
60
|
import "i18next";
|
|
58
61
|
import "framer-motion";
|
|
59
62
|
const j = () => {
|
|
60
|
-
const { savePage: a, saveState: e } = d(), { t:
|
|
61
|
-
|
|
63
|
+
const { savePage: a, saveState: e } = d(), { t: o } = c(), i = /* @__PURE__ */ t.jsxs(
|
|
64
|
+
l,
|
|
62
65
|
{
|
|
63
66
|
disabled: e === "SAVING",
|
|
64
67
|
onClick: (r) => {
|
|
65
68
|
r.preventDefault(), a();
|
|
66
69
|
},
|
|
67
|
-
className:
|
|
70
|
+
className: h(
|
|
68
71
|
"flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
69
72
|
// UNSAVED sate
|
|
70
73
|
"bg-gray-200 text-gray-500 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400",
|
|
@@ -76,19 +79,19 @@ const j = () => {
|
|
|
76
79
|
size: "sm",
|
|
77
80
|
variant: "outline",
|
|
78
81
|
children: [
|
|
79
|
-
/* @__PURE__ */ t.jsx(
|
|
80
|
-
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children:
|
|
82
|
+
/* @__PURE__ */ t.jsx(f, { className: "text-sm text-white" }),
|
|
83
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm", children: o(e === "SAVING" ? "saving" : e === "SAVED" ? "saved" : "unsaved") })
|
|
81
84
|
]
|
|
82
85
|
}
|
|
83
86
|
);
|
|
84
87
|
return /* @__PURE__ */ t.jsx("div", { className: "flex items-center", children: i });
|
|
85
88
|
}, g = function() {
|
|
86
|
-
const e =
|
|
89
|
+
const e = s("previewComponent"), [, o] = u(), { t: i } = c();
|
|
87
90
|
return e ? /* @__PURE__ */ t.jsxs(
|
|
88
|
-
|
|
91
|
+
l,
|
|
89
92
|
{
|
|
90
93
|
onClick: (r) => {
|
|
91
|
-
r.preventDefault(),
|
|
94
|
+
r.preventDefault(), o(!0);
|
|
92
95
|
},
|
|
93
96
|
className: "flex h-auto w-fit items-center gap-x-2 p-1 px-2",
|
|
94
97
|
size: "sm",
|
|
@@ -99,8 +102,8 @@ const j = () => {
|
|
|
99
102
|
]
|
|
100
103
|
}
|
|
101
104
|
) : null;
|
|
102
|
-
},
|
|
103
|
-
const a =
|
|
105
|
+
}, At = () => {
|
|
106
|
+
const a = s("topBarComponents.left", []), e = s("topBarComponents.center", []), o = s("topBarComponents.right", []), i = s("editable", !0);
|
|
104
107
|
return /* @__PURE__ */ t.jsxs("div", { className: "flex h-14 items-center justify-between px-2", children: [
|
|
105
108
|
/* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ t.jsx("div", { className: "flex items-center space-x-2 font-bold", children: m.Children.toArray(
|
|
106
109
|
a.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
|
|
@@ -113,11 +116,11 @@ const j = () => {
|
|
|
113
116
|
/* @__PURE__ */ t.jsx(x, { orientation: "vertical" }),
|
|
114
117
|
i ? /* @__PURE__ */ t.jsx(j, {}) : null,
|
|
115
118
|
m.Children.toArray(
|
|
116
|
-
|
|
119
|
+
o.map((r) => /* @__PURE__ */ t.jsx(p, { fallback: /* @__PURE__ */ t.jsx(n, { className: "h-10" }), children: /* @__PURE__ */ t.jsx(r, {}) }))
|
|
117
120
|
)
|
|
118
121
|
] })
|
|
119
122
|
] });
|
|
120
123
|
};
|
|
121
124
|
export {
|
|
122
|
-
|
|
125
|
+
At as default
|
|
123
126
|
};
|
|
@@ -2,35 +2,37 @@ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
|
2
2
|
import { useState as c, useEffect as S } from "react";
|
|
3
3
|
import { isEmpty as d } from "lodash-es";
|
|
4
4
|
import { createApi as B } from "unsplash-js";
|
|
5
|
-
import {
|
|
5
|
+
import { B as D } from "./button-9Duvj2dH.js";
|
|
6
|
+
import { M as E, U as L } from "./context-menu-yLeOsx9j.js";
|
|
6
7
|
import { useTranslation as T } from "react-i18next";
|
|
7
|
-
import {
|
|
8
|
+
import { m as U } from "./iconBase-BnEC5_qG.js";
|
|
8
9
|
import { useDebouncedState as F } from "@react-hookz/web";
|
|
9
10
|
import { Loader as K } from "lucide-react";
|
|
11
|
+
import { C as k } from "./index-yJ1H6b2C.js";
|
|
12
|
+
import "@radix-ui/react-slot";
|
|
13
|
+
import "class-variance-authority";
|
|
14
|
+
import "clsx";
|
|
15
|
+
import "tailwind-merge";
|
|
10
16
|
import "@radix-ui/react-switch";
|
|
11
17
|
import "@radix-ui/react-accordion";
|
|
12
18
|
import "@radix-ui/react-icons";
|
|
13
|
-
import "class-variance-authority";
|
|
14
19
|
import "@radix-ui/react-alert-dialog";
|
|
15
|
-
import "@radix-ui/react-slot";
|
|
16
20
|
import "@radix-ui/react-label";
|
|
17
21
|
import "@radix-ui/react-scroll-area";
|
|
18
22
|
import "@radix-ui/react-tabs";
|
|
19
23
|
import "@radix-ui/react-tooltip";
|
|
20
24
|
import "@radix-ui/react-popover";
|
|
21
25
|
import "@radix-ui/react-hover-card";
|
|
26
|
+
import "@radix-ui/react-select";
|
|
22
27
|
import "@radix-ui/react-dropdown-menu";
|
|
23
28
|
import "@radix-ui/react-separator";
|
|
24
29
|
import "@radix-ui/react-toast";
|
|
25
30
|
import "cmdk";
|
|
26
31
|
import "@radix-ui/react-dialog";
|
|
27
32
|
import "@radix-ui/react-context-menu";
|
|
28
|
-
import "clsx";
|
|
29
|
-
import "tailwind-merge";
|
|
30
33
|
import "jotai";
|
|
31
|
-
import "./
|
|
34
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
32
35
|
import "@chaibuilder/runtime";
|
|
33
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
34
36
|
import "tree-model";
|
|
35
37
|
import "react-quill";
|
|
36
38
|
import "./STRINGS-TDN5UhWi.js";
|
|
@@ -43,6 +45,7 @@ import "@tailwindcss/typography";
|
|
|
43
45
|
import "@tailwindcss/forms";
|
|
44
46
|
import "@tailwindcss/aspect-ratio";
|
|
45
47
|
import "tailwindcss-palette-generator";
|
|
48
|
+
import "./plugin-VDzc8jUO.js";
|
|
46
49
|
import "react-wrap-balancer";
|
|
47
50
|
import "react-dom";
|
|
48
51
|
import "prop-types";
|
|
@@ -61,16 +64,16 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
61
64
|
B({ accessKey: g }).search.getPhotos(f).then((i) => {
|
|
62
65
|
s(i);
|
|
63
66
|
}).catch((i) => r(i));
|
|
64
|
-
}),
|
|
65
|
-
const s =
|
|
67
|
+
}), Ge = ({ isModalView: f, onSelect: g }) => {
|
|
68
|
+
const s = U("unsplashAccessKey", ""), [r, x] = c([]), [i, v] = c(0), [l, P] = c(), [n, A] = c(), [_, b] = c(0), [h, q] = F("", 1e3), [u, m] = c(!1), { t: j } = T(), I = async (o) => {
|
|
66
69
|
if (d(h))
|
|
67
70
|
return;
|
|
68
71
|
let t = i + 1;
|
|
69
|
-
|
|
72
|
+
o && (o.preventDefault(), t = 1), m(!0), v(t);
|
|
70
73
|
const p = { query: h, page: t };
|
|
71
|
-
l && (p.orientation = l), n && (p.color = n), C(p, s).then((
|
|
74
|
+
l && (p.orientation = l), n && (p.color = n), C(p, s).then((a) => {
|
|
72
75
|
var y, N, w;
|
|
73
|
-
x(t === 1 ? ((y =
|
|
76
|
+
x(t === 1 ? ((y = a == null ? void 0 : a.response) == null ? void 0 : y.results) || [] : [...r, ...((N = a == null ? void 0 : a.response) == null ? void 0 : N.results) || []]), b((w = a == null ? void 0 : a.response) == null ? void 0 : w.total_pages), m(!1);
|
|
74
77
|
}).catch(() => {
|
|
75
78
|
m(!1);
|
|
76
79
|
});
|
|
@@ -78,10 +81,10 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
78
81
|
return S(() => {
|
|
79
82
|
if (!d(h) && s) {
|
|
80
83
|
m(!0);
|
|
81
|
-
const
|
|
82
|
-
l && (
|
|
83
|
-
var p,
|
|
84
|
-
x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((
|
|
84
|
+
const o = { query: h, page: 1 };
|
|
85
|
+
l && (o.orientation = l), n && (o.color = n), v(1), C(o, s).then((t) => {
|
|
86
|
+
var p, a;
|
|
87
|
+
x(((p = t == null ? void 0 : t.response) == null ? void 0 : p.results) || []), b((a = t == null ? void 0 : t.response) == null ? void 0 : a.total_pages), m(!1);
|
|
85
88
|
}).catch(() => {
|
|
86
89
|
m(!1);
|
|
87
90
|
});
|
|
@@ -101,13 +104,13 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
101
104
|
] }) }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
102
105
|
/* @__PURE__ */ e.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
|
|
103
106
|
/* @__PURE__ */ e.jsx(
|
|
104
|
-
|
|
107
|
+
E,
|
|
105
108
|
{
|
|
106
109
|
type: "text",
|
|
107
110
|
name: "query",
|
|
108
111
|
className: "text-foreground",
|
|
109
112
|
placeholder: 'Try "dog" or "apple"',
|
|
110
|
-
onChange: (
|
|
113
|
+
onChange: (o) => q(o.target.value)
|
|
111
114
|
}
|
|
112
115
|
),
|
|
113
116
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
@@ -134,7 +137,7 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
134
137
|
}
|
|
135
138
|
],
|
|
136
139
|
defaultValue: l,
|
|
137
|
-
onValueChange: (
|
|
140
|
+
onValueChange: (o) => P(o)
|
|
138
141
|
}
|
|
139
142
|
) }),
|
|
140
143
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
@@ -176,12 +179,12 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
176
179
|
}
|
|
177
180
|
],
|
|
178
181
|
defaultValue: n,
|
|
179
|
-
onValueChange: (
|
|
182
|
+
onValueChange: (o) => A(o)
|
|
180
183
|
}
|
|
181
184
|
) })
|
|
182
185
|
] }),
|
|
183
186
|
/* @__PURE__ */ e.jsxs(
|
|
184
|
-
|
|
187
|
+
L,
|
|
185
188
|
{
|
|
186
189
|
className: `h-full ${f && !d(r) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
187
190
|
children: [
|
|
@@ -189,40 +192,40 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
189
192
|
/* @__PURE__ */ e.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
190
193
|
/* @__PURE__ */ e.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
191
194
|
] }),
|
|
192
|
-
f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((
|
|
195
|
+
f ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: r.map((o) => /* @__PURE__ */ e.jsx(
|
|
193
196
|
"div",
|
|
194
197
|
{
|
|
195
198
|
role: "button",
|
|
196
199
|
tabIndex: 0,
|
|
197
200
|
className: "my-1 flex",
|
|
198
|
-
onClick: () => g(
|
|
201
|
+
onClick: () => g(o.urls.regular),
|
|
199
202
|
children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
200
203
|
"img",
|
|
201
204
|
{
|
|
202
205
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
203
|
-
alt:
|
|
204
|
-
src:
|
|
206
|
+
alt: o.alt_description,
|
|
207
|
+
src: o.urls.small
|
|
205
208
|
}
|
|
206
209
|
) })
|
|
207
210
|
},
|
|
208
|
-
|
|
209
|
-
)) }) : r.map((
|
|
211
|
+
o.id
|
|
212
|
+
)) }) : r.map((o) => (
|
|
210
213
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.urls.[small, regular, full]` for image quality
|
|
211
214
|
/* @__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(
|
|
212
215
|
"img",
|
|
213
216
|
{
|
|
214
217
|
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
215
|
-
alt:
|
|
216
|
-
src:
|
|
218
|
+
alt: o.alt_description,
|
|
219
|
+
src: o.urls.small
|
|
217
220
|
}
|
|
218
|
-
) }) },
|
|
221
|
+
) }) }, o.id)
|
|
219
222
|
)),
|
|
220
223
|
u && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
221
224
|
/* @__PURE__ */ e.jsx(K, { className: "h-6 w-6 animate-spin" }),
|
|
222
225
|
" Loading..."
|
|
223
226
|
] }),
|
|
224
227
|
!d(r) && i < _ && !u && /* @__PURE__ */ e.jsx(
|
|
225
|
-
|
|
228
|
+
D,
|
|
226
229
|
{
|
|
227
230
|
size: "sm",
|
|
228
231
|
variant: "link",
|
|
@@ -238,6 +241,6 @@ const C = async (f, g) => new Promise((s, r) => {
|
|
|
238
241
|
] });
|
|
239
242
|
};
|
|
240
243
|
export {
|
|
241
|
-
|
|
244
|
+
Ge as default,
|
|
242
245
|
C as fetchImage
|
|
243
246
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),n=require("react"),p=require("lodash-es"),A=require("unsplash-js"),_=require("./button-oQgWN0j0.cjs"),N=require("./context-menu-8MWP_Ikf.cjs"),B=require("react-i18next"),T=require("./iconBase-_bgMuxa5.cjs"),D=require("@react-hookz/web"),L=require("lucide-react"),S=require("./index-Hj8wMhx_.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("clsx");require("tailwind-merge");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-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-select");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("jotai");require("./_commonjsHelpers-f52AuuUj.cjs");require("@chaibuilder/runtime");require("tree-model");require("react-quill");require("./STRINGS-Yl7cSWDc.cjs");require("flagged");require("react-hotkeys-hook");require("@floating-ui/dom");require("@floating-ui/react-dom");require("react-event-hook");require("@tailwindcss/typography");require("@tailwindcss/forms");require("@tailwindcss/aspect-ratio");require("tailwindcss-palette-generator");require("./plugin-02QsHeBE.cjs");require("react-wrap-balancer");require("react-dom");require("prop-types");require("react-error-boundary");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 f=async(h,j)=>new Promise((i,a)=>{A.createApi({accessKey:j}).search.getPhotos(h).then(o=>{i(o)}).catch(o=>a(o))}),F=({isModalView:h,onSelect:j})=>{const i=T.useBuilderProp("unsplashAccessKey",""),[a,q]=n.useState([]),[o,g]=n.useState(0),[l,w]=n.useState(),[u,k]=n.useState(),[C,b]=n.useState(0),[d,P]=D.useDebouncedState("",1e3),[m,c]=n.useState(!1),{t:v}=B.useTranslation(),I=async r=>{if(p.isEmpty(d))return;let t=o+1;r&&(r.preventDefault(),t=1),c(!0),g(t);const x={query:d,page:t};l&&(x.orientation=l),u&&(x.color=u),f(x,i).then(s=>{var y,E,R;q(t===1?((y=s==null?void 0:s.response)==null?void 0:y.results)||[]:[...a,...((E=s==null?void 0:s.response)==null?void 0:E.results)||[]]),b((R=s==null?void 0:s.response)==null?void 0:R.total_pages),c(!1)}).catch(()=>{c(!1)})};return n.useEffect(()=>{if(!p.isEmpty(d)&&i){c(!0);const r={query:d,page:1};l&&(r.orientation=l),u&&(r.color=u),g(1),f(r,i).then(t=>{var x,s;q(((x=t==null?void 0:t.response)==null?void 0:x.results)||[]),b((s=t==null?void 0:t.response)==null?void 0:s.total_pages),c(!1)}).catch(()=>{c(!1)})}},[l,u,d,i]),p.isEmpty(i)?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(N.Input,{type:"text",name:"query",className:"text-foreground",placeholder:'Try "dog" or "apple"',onChange:r=>P(r.target.value)}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(S.ChaiSelect,{className:"w-40",placeholder:v("Orientation"),options:[{value:"",label:"All"},{value:"landscape",label:"Landscape"},{value:"portrait",label:"Portrait"},{value:"squarish",label:"Square"}],defaultValue:l,onValueChange:r=>w(r)})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(S.ChaiSelect,{placeholder:v("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:u,onValueChange:r=>k(r)})})]}),e.jsxRuntimeExports.jsxs(N.ScrollArea,{className:`h-full ${h&&!p.isEmpty(a)?"-mx-2 flex flex-wrap px-2":"-mx-2 flex flex-col pb-8 pt-2"}`,children:[p.isEmpty(a)&&!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:a.map(r=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>j(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))}):a.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)),m&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"h-6 w-6 animate-spin"})," Loading..."]}),!p.isEmpty(a)&&o<C&&!m&&e.jsxRuntimeExports.jsx(_.Button,{size:"sm",variant:"link",className:"w-full",onClick:()=>I(void 0),disabled:m,children:m?"":"Load More"})]})]})};exports.default=F;exports.fetchImage=f;
|
|
@@ -1,63 +1,39 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-Sp0orL4X.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as i, useEffect as k } from "react";
|
|
3
3
|
import { isEmpty as j, map as b } from "lodash-es";
|
|
4
|
-
import { atom as
|
|
5
|
-
import {
|
|
4
|
+
import { atom as U, useAtom as F } from "jotai";
|
|
5
|
+
import { U as C } from "./context-menu-yLeOsx9j.js";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { m as N } from "./iconBase-BnEC5_qG.js";
|
|
8
8
|
import { Upload as G, Loader as P } from "lucide-react";
|
|
9
9
|
import "@radix-ui/react-switch";
|
|
10
|
+
import "./button-9Duvj2dH.js";
|
|
11
|
+
import "@radix-ui/react-slot";
|
|
12
|
+
import "class-variance-authority";
|
|
13
|
+
import "clsx";
|
|
14
|
+
import "tailwind-merge";
|
|
10
15
|
import "@radix-ui/react-accordion";
|
|
11
16
|
import "@radix-ui/react-icons";
|
|
12
|
-
import "class-variance-authority";
|
|
13
17
|
import "@radix-ui/react-alert-dialog";
|
|
14
|
-
import "@radix-ui/react-slot";
|
|
15
18
|
import "@radix-ui/react-label";
|
|
16
19
|
import "@radix-ui/react-scroll-area";
|
|
17
20
|
import "@radix-ui/react-tabs";
|
|
18
21
|
import "@radix-ui/react-tooltip";
|
|
19
22
|
import "@radix-ui/react-popover";
|
|
20
23
|
import "@radix-ui/react-hover-card";
|
|
24
|
+
import "@radix-ui/react-select";
|
|
21
25
|
import "@radix-ui/react-dropdown-menu";
|
|
22
26
|
import "@radix-ui/react-separator";
|
|
23
27
|
import "@radix-ui/react-toast";
|
|
24
28
|
import "cmdk";
|
|
25
29
|
import "@radix-ui/react-dialog";
|
|
26
30
|
import "@radix-ui/react-context-menu";
|
|
27
|
-
import "
|
|
28
|
-
import "tailwind-merge";
|
|
29
|
-
import "./iconBase-zweRWSz0.js";
|
|
30
|
-
import "@chaibuilder/runtime";
|
|
31
|
-
import "./plugin-sJ3Hzvpv.js";
|
|
31
|
+
import "./_commonjsHelpers-f3sTPFkQ.js";
|
|
32
32
|
import "@react-hookz/web";
|
|
33
|
+
import "@chaibuilder/runtime";
|
|
33
34
|
import "tree-model";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import "flagged";
|
|
37
|
-
import "react-hotkeys-hook";
|
|
38
|
-
import "@floating-ui/dom";
|
|
39
|
-
import "@floating-ui/react-dom";
|
|
40
|
-
import "react-event-hook";
|
|
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 "react-error-boundary";
|
|
49
|
-
import "re-resizable";
|
|
50
|
-
import "@rjsf/validator-ajv8";
|
|
51
|
-
import "@rjsf/core";
|
|
52
|
-
import "react-arborist";
|
|
53
|
-
import "himalaya";
|
|
54
|
-
import "react-icons-picker";
|
|
55
|
-
import "react-autosuggest";
|
|
56
|
-
import "fuse.js";
|
|
57
|
-
import "i18next";
|
|
58
|
-
import "framer-motion";
|
|
59
|
-
const S = F([]), Me = ({ isModalView: s, onSelect: m }) => {
|
|
60
|
-
const { t: r } = E(), c = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [i, d] = U(S), [y, u] = l(!1), [x, f] = l(!1), [, v] = l(), [h, p] = l("");
|
|
35
|
+
const S = U([]), ue = ({ isModalView: r, onSelect: m }) => {
|
|
36
|
+
const { t: s } = E(), p = N("uploadMediaCallback"), n = N("fetchMediaCallback"), [l, d] = F(S), [y, u] = i(!1), [x, f] = i(!1), [, v] = i(), [h, c] = i("");
|
|
61
37
|
k(() => {
|
|
62
38
|
(async () => {
|
|
63
39
|
if (!n)
|
|
@@ -68,27 +44,27 @@ const S = F([]), Me = ({ isModalView: s, onSelect: m }) => {
|
|
|
68
44
|
})();
|
|
69
45
|
}, []);
|
|
70
46
|
const w = (t) => {
|
|
71
|
-
var
|
|
72
|
-
if (
|
|
47
|
+
var a, o;
|
|
48
|
+
if (c(""), t && ((o = (a = t == null ? void 0 : t.target) == null ? void 0 : a.files) == null ? void 0 : o.length) > 0) {
|
|
73
49
|
const g = t.target.files[0];
|
|
74
|
-
g.type.startsWith("image") ? I(g) :
|
|
50
|
+
g.type.startsWith("image") ? I(g) : c(s("Please select an image"));
|
|
75
51
|
}
|
|
76
52
|
}, I = async (t) => {
|
|
77
|
-
if (
|
|
53
|
+
if (p) {
|
|
78
54
|
u(!0);
|
|
79
55
|
try {
|
|
80
|
-
const { url:
|
|
81
|
-
m(
|
|
82
|
-
const
|
|
83
|
-
d(
|
|
84
|
-
} catch (
|
|
85
|
-
d([]),
|
|
56
|
+
const { url: a } = await p(t);
|
|
57
|
+
m(a), v(void 0);
|
|
58
|
+
const o = await n();
|
|
59
|
+
d(o);
|
|
60
|
+
} catch (a) {
|
|
61
|
+
d([]), c((a == null ? void 0 : a.message) || "Something went wrong.");
|
|
86
62
|
}
|
|
87
63
|
u(!1);
|
|
88
64
|
}
|
|
89
65
|
};
|
|
90
66
|
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
91
|
-
/* @__PURE__ */ e.jsxs("label", { htmlFor:
|
|
67
|
+
/* @__PURE__ */ e.jsxs("label", { htmlFor: r ? "upload-in-modal" : "upload-in-panel", children: [
|
|
92
68
|
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ e.jsxs(
|
|
93
69
|
"label",
|
|
94
70
|
{
|
|
@@ -97,14 +73,14 @@ const S = F([]), Me = ({ isModalView: s, onSelect: m }) => {
|
|
|
97
73
|
children: [
|
|
98
74
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
|
|
99
75
|
/* @__PURE__ */ e.jsx(G, { className: "mb-3 h-10 w-10 text-gray-400" }),
|
|
100
|
-
/* @__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:
|
|
101
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children:
|
|
76
|
+
/* @__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: s("Click to upload") }) }),
|
|
77
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: s("SVG, PNG, JPG or GIF (Max. 2mb)") })
|
|
102
78
|
] }),
|
|
103
79
|
y ? /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
|
|
104
80
|
/* @__PURE__ */ e.jsx(P, { className: "h-6 w-6 animate-spin" }),
|
|
105
|
-
/* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children:
|
|
81
|
+
/* @__PURE__ */ e.jsx("span", { className: "ml-2 text-sm text-gray-500", children: s("Uploading...") })
|
|
106
82
|
] }) : null,
|
|
107
|
-
h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h ||
|
|
83
|
+
h && /* @__PURE__ */ e.jsx("p", { className: "pb-2 text-xs text-red-500", children: h || s("Something went wrong") })
|
|
108
84
|
]
|
|
109
85
|
}
|
|
110
86
|
) }),
|
|
@@ -119,21 +95,21 @@ const S = F([]), Me = ({ isModalView: s, onSelect: m }) => {
|
|
|
119
95
|
}
|
|
120
96
|
)
|
|
121
97
|
] }),
|
|
122
|
-
/* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${
|
|
123
|
-
j(
|
|
124
|
-
j(
|
|
98
|
+
/* @__PURE__ */ e.jsxs(C, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${r ? "px-2" : ""} pt-2`, children: [
|
|
99
|
+
j(l) && x && /* @__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: s("Fetching...") }) }),
|
|
100
|
+
j(l) && !x && /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
|
|
125
101
|
/* @__PURE__ */ e.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
|
|
126
|
-
/* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children:
|
|
127
|
-
/* @__PURE__ */ e.jsx("p", { className: "mb-4 max-w-sm text-muted-foreground", children:
|
|
102
|
+
/* @__PURE__ */ e.jsx("h3", { className: "mb-2 text-sm font-semibold", children: s("No images found") }),
|
|
103
|
+
/* @__PURE__ */ e.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.") })
|
|
128
104
|
] }),
|
|
129
|
-
|
|
105
|
+
r ? /* @__PURE__ */ e.jsx("div", { className: "h-full columns-5 py-2", children: b(l, (t) => /* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
130
106
|
"img",
|
|
131
107
|
{
|
|
132
108
|
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
133
109
|
alt: t.name,
|
|
134
110
|
src: t.thumbUrl
|
|
135
111
|
}
|
|
136
|
-
) }) }, t.id)) }) : b(
|
|
112
|
+
) }) }, t.id)) }) : b(l, (t) => (
|
|
137
113
|
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
138
114
|
/* @__PURE__ */ e.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => m(t.url), children: /* @__PURE__ */ e.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ e.jsx(
|
|
139
115
|
"img",
|
|
@@ -148,5 +124,5 @@ const S = F([]), Me = ({ isModalView: s, onSelect: m }) => {
|
|
|
148
124
|
] });
|
|
149
125
|
};
|
|
150
126
|
export {
|
|
151
|
-
|
|
127
|
+
ue as default
|
|
152
128
|
};
|