@chaibuilder/sdk 1.3.0-beta.8 → 1.3.0
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-C94XQmvL.cjs +1 -0
- package/dist/CodeEditor-D5t7A9Po.js +77 -0
- package/dist/STRINGS-eiGM83kj.js +7 -0
- package/dist/STRINGS-ew98weUe.cjs +1 -0
- package/dist/Topbar-Bnxt9C5B.js +113 -0
- package/dist/Topbar-DFm3YQZi.cjs +1 -0
- package/dist/UnsplashImages-BWT3eyq3.cjs +1 -0
- package/dist/UnsplashImages-D-9aNQGK.js +189 -0
- package/dist/UploadImages-CntfFAoV.cjs +1 -0
- package/dist/UploadImages-CrAaKlC1.js +101 -0
- package/dist/context-menu-BbqLeYFX.js +979 -0
- package/dist/context-menu-DfAXjmc8.cjs +1 -0
- package/dist/controls-C4n5ycp4.cjs +1 -0
- package/dist/controls-Com-zYCq.js +234 -0
- package/dist/core.cjs +1 -82
- package/dist/core.d.ts +10 -5
- package/dist/core.js +74 -74
- package/dist/iconBase-Cn2BsTrq.cjs +1 -0
- package/dist/iconBase-DHfFLkem.js +124 -0
- package/dist/index-C9LOYt3W.cjs +63 -0
- package/dist/index-CcLk7_o6.js +9319 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/plugin-BOEoR5jk.js +44 -0
- package/dist/plugin-COMQcYlW.cjs +1 -0
- package/dist/plugin-Dw854zFv.js +107 -0
- package/dist/plugin-I9XxF65G.cjs +1 -0
- package/dist/render.cjs +2 -208
- package/dist/render.js +125 -171
- package/dist/runtime.cjs +1 -26
- package/dist/runtime.js +16 -16
- package/dist/style.css +2 -1529
- package/dist/tailwind.cjs +1 -78
- package/dist/tailwind.js +19 -21
- package/dist/ui.cjs +1 -392
- package/dist/ui.js +257 -268
- package/dist/web-blocks.cjs +3 -1241
- package/dist/web-blocks.js +555 -764
- package/package.json +1 -1
- package/dist/CodeEditor-1LboGb1I.cjs +0 -91
- package/dist/CodeEditor-BKgZeXwz.js +0 -91
- package/dist/STRINGS-3Sn_NeX1.cjs +0 -9
- package/dist/STRINGS-DdpfVlsV.js +0 -10
- package/dist/Topbar-B8IS6y4H.js +0 -135
- package/dist/Topbar-DXC7DFU1.cjs +0 -135
- package/dist/UnsplashImages-CjJ5szAy.cjs +0 -215
- package/dist/UnsplashImages-Ck9qpKR0.js +0 -215
- package/dist/UploadImages-DW1mj4MB.cjs +0 -117
- package/dist/UploadImages-DgAMZ8GR.js +0 -117
- package/dist/context-menu-BLbuduri.cjs +0 -1073
- package/dist/context-menu-BgtRnByf.js +0 -1042
- package/dist/controls-8EZmm0Ns.js +0 -234
- package/dist/controls-DaW52RjX.cjs +0 -233
- package/dist/iconBase-BSrIcOaG.cjs +0 -146
- package/dist/iconBase-CWgVxu0A.js +0 -147
- package/dist/index-Bjw2sUN2.cjs +0 -12139
- package/dist/index-D8_rAW8B.js +0 -12124
- package/dist/jsx-runtime-B6vEU3CM.cjs +0 -925
- package/dist/jsx-runtime-ClFauRgV.js +0 -926
- package/dist/plugin-BYwesM58.cjs +0 -54
- package/dist/plugin-BiDLHDo3.cjs +0 -114
- package/dist/plugin-BukD7GJR.js +0 -115
- package/dist/plugin-tVAEvXiS.js +0 -55
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("./jsx-runtime-B6vEU3CM.cjs");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const lodashEs = require("lodash-es");
|
|
6
|
-
const unsplashJs = require("unsplash-js");
|
|
7
|
-
const contextMenu = require("./context-menu-BLbuduri.cjs");
|
|
8
|
-
const reactI18next = require("react-i18next");
|
|
9
|
-
const core = require("./index-Bjw2sUN2.cjs");
|
|
10
|
-
const web = require("@react-hookz/web");
|
|
11
|
-
const lucideReact = require("lucide-react");
|
|
12
|
-
const fetchImage = async (payload, accessKey) => new Promise((resolve, reject) => {
|
|
13
|
-
const unsplash = unsplashJs.createApi({ accessKey });
|
|
14
|
-
unsplash.search.getPhotos(payload).then((result) => {
|
|
15
|
-
resolve(result);
|
|
16
|
-
}).catch((error) => reject(error));
|
|
17
|
-
});
|
|
18
|
-
const UnsplashImages = ({ isModalView, onSelect }) => {
|
|
19
|
-
const unsplashAccessKey = core.useBuilderProp("unsplashAccessKey", "");
|
|
20
|
-
const [images, setImages] = React.useState([]);
|
|
21
|
-
const [page, setPage] = React.useState(0);
|
|
22
|
-
const [orientation, setOrientation] = React.useState();
|
|
23
|
-
const [color, setColor] = React.useState();
|
|
24
|
-
const [totalPages, setTotalPages] = React.useState(0);
|
|
25
|
-
const [debouncedQuery, setDebouncedQuery] = web.useDebouncedState("", 1e3);
|
|
26
|
-
const [isFetching, setIsFetching] = React.useState(false);
|
|
27
|
-
const { t } = reactI18next.useTranslation();
|
|
28
|
-
const searchPhotos = async (event) => {
|
|
29
|
-
if (lodashEs.isEmpty(debouncedQuery)) return;
|
|
30
|
-
let currentPage = page + 1;
|
|
31
|
-
setIsFetching(true);
|
|
32
|
-
setPage(currentPage);
|
|
33
|
-
const payload = { query: debouncedQuery, page: currentPage };
|
|
34
|
-
if (orientation) payload.orientation = orientation;
|
|
35
|
-
if (color) payload.color = color;
|
|
36
|
-
fetchImage(payload, unsplashAccessKey).then((result) => {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
if (currentPage === 1) setImages(((_a = result == null ? void 0 : result.response) == null ? void 0 : _a.results) || []);
|
|
39
|
-
else setImages([...images, ...((_b = result == null ? void 0 : result.response) == null ? void 0 : _b.results) || []]);
|
|
40
|
-
setTotalPages((_c = result == null ? void 0 : result.response) == null ? void 0 : _c.total_pages);
|
|
41
|
-
setIsFetching(false);
|
|
42
|
-
}).catch(() => {
|
|
43
|
-
setIsFetching(false);
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
React.useEffect(() => {
|
|
47
|
-
if (!lodashEs.isEmpty(debouncedQuery) && unsplashAccessKey) {
|
|
48
|
-
setIsFetching(true);
|
|
49
|
-
const payload = { query: debouncedQuery, page: 1 };
|
|
50
|
-
if (orientation) payload.orientation = orientation;
|
|
51
|
-
if (color) payload.color = color;
|
|
52
|
-
setPage(1);
|
|
53
|
-
fetchImage(payload, unsplashAccessKey).then((result) => {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
setImages(((_a = result == null ? void 0 : result.response) == null ? void 0 : _a.results) || []);
|
|
56
|
-
setTotalPages((_b = result == null ? void 0 : result.response) == null ? void 0 : _b.total_pages);
|
|
57
|
-
setIsFetching(false);
|
|
58
|
-
}).catch(() => {
|
|
59
|
-
setIsFetching(false);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, [orientation, color, debouncedQuery, unsplashAccessKey]);
|
|
63
|
-
if (lodashEs.isEmpty(unsplashAccessKey)) {
|
|
64
|
-
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex h-full flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
65
|
-
"To enable Unsplash, kindly provide your",
|
|
66
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
67
|
-
"a",
|
|
68
|
-
{
|
|
69
|
-
href: "https://unsplash.com/documentation#public-authentication",
|
|
70
|
-
className: "px-1 underline hover:text-blue-400",
|
|
71
|
-
target: "_blank",
|
|
72
|
-
rel: "noopener noreferrer",
|
|
73
|
-
children: "Unsplash Access Key"
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
] }) });
|
|
77
|
-
}
|
|
78
|
-
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
|
|
79
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
|
|
80
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
81
|
-
contextMenu.Input,
|
|
82
|
-
{
|
|
83
|
-
type: "text",
|
|
84
|
-
name: "query",
|
|
85
|
-
className: "text-foreground",
|
|
86
|
-
placeholder: `Try "dog" or "apple"`,
|
|
87
|
-
onChange: (e) => setDebouncedQuery(e.target.value)
|
|
88
|
-
}
|
|
89
|
-
),
|
|
90
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
91
|
-
core.ChaiSelect,
|
|
92
|
-
{
|
|
93
|
-
className: "w-40",
|
|
94
|
-
placeholder: t("Orientation"),
|
|
95
|
-
options: [
|
|
96
|
-
{
|
|
97
|
-
value: "",
|
|
98
|
-
label: "All"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
value: "landscape",
|
|
102
|
-
label: "Landscape"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
value: "portrait",
|
|
106
|
-
label: "Portrait"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
value: "squarish",
|
|
110
|
-
label: "Square"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
defaultValue: orientation,
|
|
114
|
-
onValueChange: (_v) => setOrientation(_v)
|
|
115
|
-
}
|
|
116
|
-
) }),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
118
|
-
core.ChaiSelect,
|
|
119
|
-
{
|
|
120
|
-
placeholder: t("Color"),
|
|
121
|
-
options: [
|
|
122
|
-
{
|
|
123
|
-
value: "",
|
|
124
|
-
label: "All"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
value: "black_and_white",
|
|
128
|
-
label: "Black and White"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
value: "black",
|
|
132
|
-
label: "Black"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
value: "white",
|
|
136
|
-
label: "White"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
value: "night",
|
|
140
|
-
label: "Night"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
value: "warm",
|
|
144
|
-
label: "Warm"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
value: "cool",
|
|
148
|
-
label: "Cool"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
value: "sepia",
|
|
152
|
-
label: "Sepia"
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
defaultValue: color,
|
|
156
|
-
onValueChange: (_v) => setColor(_v)
|
|
157
|
-
}
|
|
158
|
-
) })
|
|
159
|
-
] }),
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
161
|
-
contextMenu.ScrollArea,
|
|
162
|
-
{
|
|
163
|
-
className: `h-full ${isModalView && !lodashEs.isEmpty(images) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
164
|
-
children: [
|
|
165
|
-
lodashEs.isEmpty(images) && !isFetching && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
|
166
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
168
|
-
] }),
|
|
169
|
-
isModalView ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "h-full columns-5 py-2", children: images.map((pic) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
170
|
-
"div",
|
|
171
|
-
{
|
|
172
|
-
role: "button",
|
|
173
|
-
tabIndex: 0,
|
|
174
|
-
className: "my-1 flex",
|
|
175
|
-
onClick: () => onSelect(pic.urls.regular),
|
|
176
|
-
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
177
|
-
"img",
|
|
178
|
-
{
|
|
179
|
-
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
180
|
-
alt: pic.alt_description,
|
|
181
|
-
src: pic.urls.small
|
|
182
|
-
}
|
|
183
|
-
) })
|
|
184
|
-
},
|
|
185
|
-
pic.id
|
|
186
|
-
)) }) : images.map((pic) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
187
|
-
"img",
|
|
188
|
-
{
|
|
189
|
-
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
190
|
-
alt: pic.alt_description,
|
|
191
|
-
src: pic.urls.small
|
|
192
|
-
}
|
|
193
|
-
) }) }, pic.id)),
|
|
194
|
-
isFetching && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
195
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader, { className: "h-6 w-6 animate-spin" }),
|
|
196
|
-
" Loading..."
|
|
197
|
-
] }),
|
|
198
|
-
!lodashEs.isEmpty(images) && page < totalPages && !isFetching && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
199
|
-
contextMenu.Button,
|
|
200
|
-
{
|
|
201
|
-
size: "sm",
|
|
202
|
-
variant: "link",
|
|
203
|
-
className: "w-full",
|
|
204
|
-
onClick: () => searchPhotos(),
|
|
205
|
-
disabled: isFetching,
|
|
206
|
-
children: isFetching ? "" : "Load More"
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
)
|
|
212
|
-
] });
|
|
213
|
-
};
|
|
214
|
-
exports.default = UnsplashImages;
|
|
215
|
-
exports.fetchImage = fetchImage;
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./jsx-runtime-ClFauRgV.js";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { isEmpty } from "lodash-es";
|
|
4
|
-
import { createApi } from "unsplash-js";
|
|
5
|
-
import { I as Input, S as ScrollArea, B as Button } from "./context-menu-BgtRnByf.js";
|
|
6
|
-
import { useTranslation } from "react-i18next";
|
|
7
|
-
import { d as useBuilderProp, C as ChaiSelect } from "./index-D8_rAW8B.js";
|
|
8
|
-
import { useDebouncedState } from "@react-hookz/web";
|
|
9
|
-
import { Loader } from "lucide-react";
|
|
10
|
-
const fetchImage = async (payload, accessKey) => new Promise((resolve, reject) => {
|
|
11
|
-
const unsplash = createApi({ accessKey });
|
|
12
|
-
unsplash.search.getPhotos(payload).then((result) => {
|
|
13
|
-
resolve(result);
|
|
14
|
-
}).catch((error) => reject(error));
|
|
15
|
-
});
|
|
16
|
-
const UnsplashImages = ({ isModalView, onSelect }) => {
|
|
17
|
-
const unsplashAccessKey = useBuilderProp("unsplashAccessKey", "");
|
|
18
|
-
const [images, setImages] = useState([]);
|
|
19
|
-
const [page, setPage] = useState(0);
|
|
20
|
-
const [orientation, setOrientation] = useState();
|
|
21
|
-
const [color, setColor] = useState();
|
|
22
|
-
const [totalPages, setTotalPages] = useState(0);
|
|
23
|
-
const [debouncedQuery, setDebouncedQuery] = useDebouncedState("", 1e3);
|
|
24
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
25
|
-
const { t } = useTranslation();
|
|
26
|
-
const searchPhotos = async (event) => {
|
|
27
|
-
if (isEmpty(debouncedQuery)) return;
|
|
28
|
-
let currentPage = page + 1;
|
|
29
|
-
setIsFetching(true);
|
|
30
|
-
setPage(currentPage);
|
|
31
|
-
const payload = { query: debouncedQuery, page: currentPage };
|
|
32
|
-
if (orientation) payload.orientation = orientation;
|
|
33
|
-
if (color) payload.color = color;
|
|
34
|
-
fetchImage(payload, unsplashAccessKey).then((result) => {
|
|
35
|
-
var _a, _b, _c;
|
|
36
|
-
if (currentPage === 1) setImages(((_a = result == null ? void 0 : result.response) == null ? void 0 : _a.results) || []);
|
|
37
|
-
else setImages([...images, ...((_b = result == null ? void 0 : result.response) == null ? void 0 : _b.results) || []]);
|
|
38
|
-
setTotalPages((_c = result == null ? void 0 : result.response) == null ? void 0 : _c.total_pages);
|
|
39
|
-
setIsFetching(false);
|
|
40
|
-
}).catch(() => {
|
|
41
|
-
setIsFetching(false);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (!isEmpty(debouncedQuery) && unsplashAccessKey) {
|
|
46
|
-
setIsFetching(true);
|
|
47
|
-
const payload = { query: debouncedQuery, page: 1 };
|
|
48
|
-
if (orientation) payload.orientation = orientation;
|
|
49
|
-
if (color) payload.color = color;
|
|
50
|
-
setPage(1);
|
|
51
|
-
fetchImage(payload, unsplashAccessKey).then((result) => {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
setImages(((_a = result == null ? void 0 : result.response) == null ? void 0 : _a.results) || []);
|
|
54
|
-
setTotalPages((_b = result == null ? void 0 : result.response) == null ? void 0 : _b.total_pages);
|
|
55
|
-
setIsFetching(false);
|
|
56
|
-
}).catch(() => {
|
|
57
|
-
setIsFetching(false);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}, [orientation, color, debouncedQuery, unsplashAccessKey]);
|
|
61
|
-
if (isEmpty(unsplashAccessKey)) {
|
|
62
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "max-w-3xl text-center text-gray-500", children: [
|
|
63
|
-
"To enable Unsplash, kindly provide your",
|
|
64
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
65
|
-
"a",
|
|
66
|
-
{
|
|
67
|
-
href: "https://unsplash.com/documentation#public-authentication",
|
|
68
|
-
className: "px-1 underline hover:text-blue-400",
|
|
69
|
-
target: "_blank",
|
|
70
|
-
rel: "noopener noreferrer",
|
|
71
|
-
children: "Unsplash Access Key"
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] }) });
|
|
75
|
-
}
|
|
76
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
77
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("form", { className: "flex items-center gap-x-2 rounded-md border border-border bg-background p-px", children: [
|
|
78
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
79
|
-
Input,
|
|
80
|
-
{
|
|
81
|
-
type: "text",
|
|
82
|
-
name: "query",
|
|
83
|
-
className: "text-foreground",
|
|
84
|
-
placeholder: `Try "dog" or "apple"`,
|
|
85
|
-
onChange: (e) => setDebouncedQuery(e.target.value)
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89
|
-
ChaiSelect,
|
|
90
|
-
{
|
|
91
|
-
className: "w-40",
|
|
92
|
-
placeholder: t("Orientation"),
|
|
93
|
-
options: [
|
|
94
|
-
{
|
|
95
|
-
value: "",
|
|
96
|
-
label: "All"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
value: "landscape",
|
|
100
|
-
label: "Landscape"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
value: "portrait",
|
|
104
|
-
label: "Portrait"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
value: "squarish",
|
|
108
|
-
label: "Square"
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
defaultValue: orientation,
|
|
112
|
-
onValueChange: (_v) => setOrientation(_v)
|
|
113
|
-
}
|
|
114
|
-
) }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
116
|
-
ChaiSelect,
|
|
117
|
-
{
|
|
118
|
-
placeholder: t("Color"),
|
|
119
|
-
options: [
|
|
120
|
-
{
|
|
121
|
-
value: "",
|
|
122
|
-
label: "All"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
value: "black_and_white",
|
|
126
|
-
label: "Black and White"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
value: "black",
|
|
130
|
-
label: "Black"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
value: "white",
|
|
134
|
-
label: "White"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
value: "night",
|
|
138
|
-
label: "Night"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
value: "warm",
|
|
142
|
-
label: "Warm"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
value: "cool",
|
|
146
|
-
label: "Cool"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
value: "sepia",
|
|
150
|
-
label: "Sepia"
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
defaultValue: color,
|
|
154
|
-
onValueChange: (_v) => setColor(_v)
|
|
155
|
-
}
|
|
156
|
-
) })
|
|
157
|
-
] }),
|
|
158
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
159
|
-
ScrollArea,
|
|
160
|
-
{
|
|
161
|
-
className: `h-full ${isModalView && !isEmpty(images) ? "-mx-2 flex flex-wrap px-2" : "-mx-2 flex flex-col pb-8 pt-2"}`,
|
|
162
|
-
children: [
|
|
163
|
-
isEmpty(images) && !isFetching && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
|
164
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: "No Data" }),
|
|
165
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: "Enter query and press enter" })
|
|
166
|
-
] }),
|
|
167
|
-
isModalView ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full columns-5 py-2", children: images.map((pic) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
168
|
-
"div",
|
|
169
|
-
{
|
|
170
|
-
role: "button",
|
|
171
|
-
tabIndex: 0,
|
|
172
|
-
className: "my-1 flex",
|
|
173
|
-
onClick: () => onSelect(pic.urls.regular),
|
|
174
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
175
|
-
"img",
|
|
176
|
-
{
|
|
177
|
-
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
178
|
-
alt: pic.alt_description,
|
|
179
|
-
src: pic.urls.small
|
|
180
|
-
}
|
|
181
|
-
) })
|
|
182
|
-
},
|
|
183
|
-
pic.id
|
|
184
|
-
)) }) : images.map((pic) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full px-2 py-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
185
|
-
"img",
|
|
186
|
-
{
|
|
187
|
-
className: "h-auto cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
188
|
-
alt: pic.alt_description,
|
|
189
|
-
src: pic.urls.small
|
|
190
|
-
}
|
|
191
|
-
) }) }, pic.id)),
|
|
192
|
-
isFetching && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
193
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "h-6 w-6 animate-spin" }),
|
|
194
|
-
" Loading..."
|
|
195
|
-
] }),
|
|
196
|
-
!isEmpty(images) && page < totalPages && !isFetching && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
197
|
-
Button,
|
|
198
|
-
{
|
|
199
|
-
size: "sm",
|
|
200
|
-
variant: "link",
|
|
201
|
-
className: "w-full",
|
|
202
|
-
onClick: () => searchPhotos(),
|
|
203
|
-
disabled: isFetching,
|
|
204
|
-
children: isFetching ? "" : "Load More"
|
|
205
|
-
}
|
|
206
|
-
)
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
|
-
] });
|
|
211
|
-
};
|
|
212
|
-
export {
|
|
213
|
-
UnsplashImages as default,
|
|
214
|
-
fetchImage
|
|
215
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("./jsx-runtime-B6vEU3CM.cjs");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const lodashEs = require("lodash-es");
|
|
6
|
-
const jotai = require("jotai");
|
|
7
|
-
const contextMenu = require("./context-menu-BLbuduri.cjs");
|
|
8
|
-
const reactI18next = require("react-i18next");
|
|
9
|
-
const core = require("./index-Bjw2sUN2.cjs");
|
|
10
|
-
const lucideReact = require("lucide-react");
|
|
11
|
-
const uploadedMediaAtom = jotai.atom([]);
|
|
12
|
-
const UploadImages = ({ isModalView, onSelect }) => {
|
|
13
|
-
const { t } = reactI18next.useTranslation();
|
|
14
|
-
const uploadImage = core.useBuilderProp("uploadMediaCallback");
|
|
15
|
-
const fetchImages = core.useBuilderProp("fetchMediaCallback");
|
|
16
|
-
const [images, setImages] = jotai.useAtom(uploadedMediaAtom);
|
|
17
|
-
const [isUploading, setIsUploading] = React.useState(false);
|
|
18
|
-
const [isFetching, setIsFetching] = React.useState(false);
|
|
19
|
-
const [, setFile] = React.useState();
|
|
20
|
-
const [error, setError] = React.useState("");
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
(async () => {
|
|
23
|
-
if (!fetchImages) return;
|
|
24
|
-
setIsFetching(true);
|
|
25
|
-
const uploadedImages = await fetchImages();
|
|
26
|
-
setImages(uploadedImages || []);
|
|
27
|
-
setIsFetching(false);
|
|
28
|
-
})();
|
|
29
|
-
}, []);
|
|
30
|
-
const onChange = (e) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
setError("");
|
|
33
|
-
if (e && ((_b = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.files) == null ? void 0 : _b.length) > 0) {
|
|
34
|
-
const file = e.target.files[0];
|
|
35
|
-
if (file.type.startsWith("image")) {
|
|
36
|
-
onUpload(file);
|
|
37
|
-
} else {
|
|
38
|
-
setError(t("Please select an image"));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const onUpload = async (file) => {
|
|
43
|
-
if (!uploadImage) return;
|
|
44
|
-
setIsUploading(true);
|
|
45
|
-
try {
|
|
46
|
-
const { url } = await uploadImage(file);
|
|
47
|
-
onSelect(url);
|
|
48
|
-
setFile(void 0);
|
|
49
|
-
const uploadedImages = await fetchImages();
|
|
50
|
-
setImages(uploadedImages);
|
|
51
|
-
} catch (err) {
|
|
52
|
-
setImages([]);
|
|
53
|
-
setError((err == null ? void 0 : err.message) || "Something went wrong.");
|
|
54
|
-
}
|
|
55
|
-
setIsUploading(false);
|
|
56
|
-
};
|
|
57
|
-
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { children: [
|
|
58
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("label", { htmlFor: isModalView ? "upload-in-modal" : "upload-in-panel", children: [
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
60
|
-
"label",
|
|
61
|
-
{
|
|
62
|
-
htmlFor: "image-upload",
|
|
63
|
-
className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",
|
|
64
|
-
children: [
|
|
65
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
|
|
66
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Upload, { className: "mb-3 h-10 w-10 text-gray-400" }),
|
|
67
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "font-semibold", children: t("Click to upload") }) }),
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("SVG, PNG, JPG or GIF (Max. 2mb)") })
|
|
69
|
-
] }),
|
|
70
|
-
isUploading ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
|
|
71
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader, { className: "h-6 w-6 animate-spin" }),
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { className: "ml-2 text-sm text-gray-500", children: t("Uploading...") })
|
|
73
|
-
] }) : null,
|
|
74
|
-
error && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("p", { className: "pb-2 text-xs text-red-500", children: error || t("Something went wrong") })
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
) }),
|
|
78
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
79
|
-
"input",
|
|
80
|
-
{
|
|
81
|
-
type: "file",
|
|
82
|
-
id: isModalView ? "image-upload" : "image-upload",
|
|
83
|
-
accept: "image/*",
|
|
84
|
-
hidden: true,
|
|
85
|
-
onChange
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
] }),
|
|
89
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ScrollArea, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${isModalView ? "px-2" : ""} pt-2`, children: [
|
|
90
|
-
lodashEs.isEmpty(images) && isFetching && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "animate-pulse font-medium", children: t("Fetching...") }) }),
|
|
91
|
-
lodashEs.isEmpty(images) && !isFetching && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
|
|
92
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("h3", { className: "mb-2 text-sm font-semibold", children: t("No images found") }),
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.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.") })
|
|
95
|
-
] }),
|
|
96
|
-
isModalView ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "h-full columns-5 py-2", children: lodashEs.map(images, (pic) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => onSelect(pic.url), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
97
|
-
"img",
|
|
98
|
-
{
|
|
99
|
-
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
100
|
-
alt: pic.name,
|
|
101
|
-
src: pic.thumbUrl
|
|
102
|
-
}
|
|
103
|
-
) }) }, pic.id)) }) : lodashEs.map(images, (pic) => (
|
|
104
|
-
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => onSelect(pic.url), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
106
|
-
"img",
|
|
107
|
-
{
|
|
108
|
-
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
109
|
-
alt: pic.name,
|
|
110
|
-
src: pic.url
|
|
111
|
-
}
|
|
112
|
-
) }) }, pic.id)
|
|
113
|
-
))
|
|
114
|
-
] })
|
|
115
|
-
] });
|
|
116
|
-
};
|
|
117
|
-
exports.default = UploadImages;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./jsx-runtime-ClFauRgV.js";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { isEmpty, map } from "lodash-es";
|
|
4
|
-
import { atom, useAtom } from "jotai";
|
|
5
|
-
import { S as ScrollArea } from "./context-menu-BgtRnByf.js";
|
|
6
|
-
import { useTranslation } from "react-i18next";
|
|
7
|
-
import { d as useBuilderProp } from "./index-D8_rAW8B.js";
|
|
8
|
-
import { Upload, Loader } from "lucide-react";
|
|
9
|
-
const uploadedMediaAtom = atom([]);
|
|
10
|
-
const UploadImages = ({ isModalView, onSelect }) => {
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const uploadImage = useBuilderProp("uploadMediaCallback");
|
|
13
|
-
const fetchImages = useBuilderProp("fetchMediaCallback");
|
|
14
|
-
const [images, setImages] = useAtom(uploadedMediaAtom);
|
|
15
|
-
const [isUploading, setIsUploading] = useState(false);
|
|
16
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
17
|
-
const [, setFile] = useState();
|
|
18
|
-
const [error, setError] = useState("");
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
(async () => {
|
|
21
|
-
if (!fetchImages) return;
|
|
22
|
-
setIsFetching(true);
|
|
23
|
-
const uploadedImages = await fetchImages();
|
|
24
|
-
setImages(uploadedImages || []);
|
|
25
|
-
setIsFetching(false);
|
|
26
|
-
})();
|
|
27
|
-
}, []);
|
|
28
|
-
const onChange = (e) => {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
setError("");
|
|
31
|
-
if (e && ((_b = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.files) == null ? void 0 : _b.length) > 0) {
|
|
32
|
-
const file = e.target.files[0];
|
|
33
|
-
if (file.type.startsWith("image")) {
|
|
34
|
-
onUpload(file);
|
|
35
|
-
} else {
|
|
36
|
-
setError(t("Please select an image"));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const onUpload = async (file) => {
|
|
41
|
-
if (!uploadImage) return;
|
|
42
|
-
setIsUploading(true);
|
|
43
|
-
try {
|
|
44
|
-
const { url } = await uploadImage(file);
|
|
45
|
-
onSelect(url);
|
|
46
|
-
setFile(void 0);
|
|
47
|
-
const uploadedImages = await fetchImages();
|
|
48
|
-
setImages(uploadedImages);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
setImages([]);
|
|
51
|
-
setError((err == null ? void 0 : err.message) || "Something went wrong.");
|
|
52
|
-
}
|
|
53
|
-
setIsUploading(false);
|
|
54
|
-
};
|
|
55
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
56
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: isModalView ? "upload-in-modal" : "upload-in-panel", children: [
|
|
57
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
58
|
-
"label",
|
|
59
|
-
{
|
|
60
|
-
htmlFor: "image-upload",
|
|
61
|
-
className: "flex w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-border",
|
|
62
|
-
children: [
|
|
63
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center pb-6 pt-5", children: [
|
|
64
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Upload, { className: "mb-3 h-10 w-10 text-gray-400" }),
|
|
65
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-sm text-gray-500 dark:text-gray-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold", children: t("Click to upload") }) }),
|
|
66
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("SVG, PNG, JPG or GIF (Max. 2mb)") })
|
|
67
|
-
] }),
|
|
68
|
-
isUploading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full items-center justify-center", children: [
|
|
69
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "h-6 w-6 animate-spin" }),
|
|
70
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 text-sm text-gray-500", children: t("Uploading...") })
|
|
71
|
-
] }) : null,
|
|
72
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pb-2 text-xs text-red-500", children: error || t("Something went wrong") })
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
) }),
|
|
76
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
77
|
-
"input",
|
|
78
|
-
{
|
|
79
|
-
type: "file",
|
|
80
|
-
id: isModalView ? "image-upload" : "image-upload",
|
|
81
|
-
accept: "image/*",
|
|
82
|
-
hidden: true,
|
|
83
|
-
onChange
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(ScrollArea, { className: `-mx-2 flex h-full flex-col pb-8 pt-2 ${isModalView ? "px-2" : ""} pt-2`, children: [
|
|
88
|
-
isEmpty(images) && isFetching && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center py-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-pulse font-medium", children: t("Fetching...") }) }),
|
|
89
|
-
isEmpty(images) && !isFetching && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col items-center justify-center text-center", children: [
|
|
90
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4 h-12 rounded-full p-6" }),
|
|
91
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "mb-2 text-sm font-semibold", children: t("No images found") }),
|
|
92
|
-
/* @__PURE__ */ 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.") })
|
|
93
|
-
] }),
|
|
94
|
-
isModalView ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full columns-5 py-2", children: map(images, (pic) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "button", tabIndex: 0, className: "my-1 flex", onClick: () => onSelect(pic.url), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
95
|
-
"img",
|
|
96
|
-
{
|
|
97
|
-
className: "h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",
|
|
98
|
-
alt: pic.name,
|
|
99
|
-
src: pic.thumbUrl
|
|
100
|
-
}
|
|
101
|
-
) }) }, pic.id)) }) : map(images, (pic) => (
|
|
102
|
-
// TODO: Drag and Drop Image to Canvas from Here use `pic.url` for image quality
|
|
103
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "button", tabIndex: 0, className: "px-2 py-1", onClick: () => onSelect(pic.url), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative overflow-hidden rounded-md bg-cover bg-no-repeat", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
104
|
-
"img",
|
|
105
|
-
{
|
|
106
|
-
className: "h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",
|
|
107
|
-
alt: pic.name,
|
|
108
|
-
src: pic.url
|
|
109
|
-
}
|
|
110
|
-
) }) }, pic.id)
|
|
111
|
-
))
|
|
112
|
-
] })
|
|
113
|
-
] });
|
|
114
|
-
};
|
|
115
|
-
export {
|
|
116
|
-
UploadImages as default
|
|
117
|
-
};
|