@blocklet/list 0.14.3 → 0.14.4
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/lib/index.es.js +471 -452
- package/package.json +5 -4
package/lib/index.es.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as F } from "react/jsx-runtime";
|
|
2
2
|
import { styled as D, useTheme as xe } from "@arcblock/ux/lib/Theme";
|
|
3
3
|
import { Global as we, css as ke } from "@emotion/react";
|
|
4
4
|
import { ErrorFallback as Z } from "@arcblock/ux/lib/ErrorBoundary";
|
|
5
|
-
import { Button as ee, useTheme as
|
|
6
|
-
import { ErrorBoundary as
|
|
7
|
-
import
|
|
8
|
-
import { Icon as
|
|
9
|
-
import
|
|
10
|
-
import { createContext as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
5
|
+
import { Button as ee, useTheme as ve, useMediaQuery as M, Drawer as Je, Box as v, CircularProgress as te, MenuList as Ke, SvgIcon as Ze, Popper as et, Grow as tt, Paper as rt, ClickAwayListener as ot, MenuItem as nt, Stack as I, FormControlLabel as Ce, Checkbox as Se, Typography as L, Link as lt, Grid as me, OutlinedInput as at, InputAdornment as he } from "@mui/material";
|
|
6
|
+
import { ErrorBoundary as it } from "react-error-boundary";
|
|
7
|
+
import st from "@iconify-icons/tabler/compass";
|
|
8
|
+
import { Icon as Be } from "@iconify/react";
|
|
9
|
+
import Re from "@mui/icons-material/Close";
|
|
10
|
+
import { createContext as Pe, useState as j, useMemo as E, useContext as Te, useCallback as K, useEffect as q, forwardRef as ct, useRef as U, memo as dt, createElement as ut, Fragment as pt } from "react";
|
|
11
|
+
import { createAxios as Ie } from "@blocklet/js-sdk";
|
|
12
|
+
import mt from "lodash/orderBy";
|
|
13
13
|
import i from "prop-types";
|
|
14
|
-
import { useInfiniteScroll as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
14
|
+
import { useInfiniteScroll as ht, useRequest as re, useReactive as ft, useDebounceFn as gt } from "ahooks";
|
|
15
|
+
import yt from "lodash/omitBy";
|
|
16
|
+
import bt from "json-stable-stringify";
|
|
17
17
|
import "lodash/cloneDeep";
|
|
18
|
-
import
|
|
18
|
+
import xt from "color";
|
|
19
|
+
import { withQuery as Le, joinURL as wt } from "ufo";
|
|
19
20
|
import fe from "flat";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
21
|
+
import kt from "@mui/icons-material/KeyboardArrowDown";
|
|
22
|
+
import vt from "lodash/isEmpty";
|
|
23
|
+
import $e from "@mui/material/Box";
|
|
24
|
+
import Ct from "@arcblock/ux/lib/Avatar";
|
|
25
|
+
import St from "@arcblock/ux/lib/Img";
|
|
26
|
+
import Bt from "@iconify-icons/tabler/cloud-download";
|
|
27
|
+
import Rt from "@mui/icons-material/ChevronLeft";
|
|
28
|
+
import Pt from "@mui/icons-material/ChevronRight";
|
|
29
|
+
import Tt from "react-image-gallery";
|
|
29
30
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { createRoot as
|
|
35
|
-
import { autocomplete as
|
|
36
|
-
import { useHotkeys as
|
|
37
|
-
import
|
|
38
|
-
import At from "@mui/icons-material/Search";
|
|
31
|
+
import It from "@arcblock/ux/lib/Empty";
|
|
32
|
+
import Lt from "react-infinite-scroll-hook";
|
|
33
|
+
import _e from "@mui/material/Typography";
|
|
34
|
+
import $t from "@mui/icons-material/Menu";
|
|
35
|
+
import { createRoot as _t } from "react-dom/client";
|
|
36
|
+
import { autocomplete as zt } from "@algolia/autocomplete-js";
|
|
37
|
+
import { useHotkeys as At } from "react-hotkeys-hook";
|
|
38
|
+
import Ft from "@mui/icons-material/Search";
|
|
39
39
|
import "@algolia/autocomplete-theme-classic/dist/theme.css";
|
|
40
|
-
const
|
|
40
|
+
const ze = Pe({
|
|
41
41
|
open: !1,
|
|
42
42
|
toggleOpen: (e) => {
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
function
|
|
46
|
-
const [
|
|
47
|
-
|
|
48
|
-
}, a = E(() => ({ open:
|
|
49
|
-
return /* @__PURE__ */ t(
|
|
45
|
+
function Dt({ children: e }) {
|
|
46
|
+
const [r, o] = j(!1), n = (l) => {
|
|
47
|
+
o(l ?? !l);
|
|
48
|
+
}, a = E(() => ({ open: r, toggleOpen: n }), [r]);
|
|
49
|
+
return /* @__PURE__ */ t(ze.Provider, { value: a, children: e });
|
|
50
50
|
}
|
|
51
51
|
function oe() {
|
|
52
|
-
return
|
|
52
|
+
return Te(ze);
|
|
53
53
|
}
|
|
54
54
|
const T = {
|
|
55
55
|
nameAsc: "title",
|
|
@@ -65,32 +65,32 @@ const T = {
|
|
|
65
65
|
explorePath: "/api/blocklets/explore",
|
|
66
66
|
exploreDidsPath: "/api/blocklets/dids",
|
|
67
67
|
cacheSize: 100
|
|
68
|
-
},
|
|
68
|
+
}, Mt = (e, r, o, n) => ht(
|
|
69
69
|
async (a) => {
|
|
70
|
-
a || (
|
|
71
|
-
const { currentPage: l, pageSize:
|
|
72
|
-
...
|
|
73
|
-
category:
|
|
74
|
-
sortBy: T[
|
|
70
|
+
a || (o.currentPage = o.defaultCurrentPage);
|
|
71
|
+
const { currentPage: l, pageSize: c } = o, p = {
|
|
72
|
+
...r,
|
|
73
|
+
category: r.category === "All" ? "" : r.category,
|
|
74
|
+
sortBy: T[r.sortBy],
|
|
75
75
|
page: l,
|
|
76
|
-
pageSize:
|
|
76
|
+
pageSize: c
|
|
77
77
|
};
|
|
78
78
|
n(null);
|
|
79
|
-
const { data:
|
|
80
|
-
return
|
|
79
|
+
const { data: d = {} } = await e.get(T.blockletsPath, { params: p });
|
|
80
|
+
return o.currentPage++, { page: l, pageSize: c, list: (d == null ? void 0 : d.dataList) || [], total: (d == null ? void 0 : d.total) || 0 };
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
isNoMore: (a) => a ? a.page * a.pageSize >= a.total : !1,
|
|
84
|
-
reloadDeps: [e,
|
|
84
|
+
reloadDeps: [e, bt(r)],
|
|
85
85
|
onError: n
|
|
86
86
|
}
|
|
87
87
|
), Et = (e) => re(
|
|
88
88
|
async () => {
|
|
89
|
-
const { data:
|
|
90
|
-
return Array.isArray(
|
|
89
|
+
const { data: r } = await e.get(T.categoriesPath);
|
|
90
|
+
return Array.isArray(r) ? r : [];
|
|
91
91
|
},
|
|
92
92
|
{ manual: !0 }
|
|
93
|
-
),
|
|
93
|
+
), Ae = {
|
|
94
94
|
filters: i.shape({
|
|
95
95
|
keyword: i.string,
|
|
96
96
|
sortBy: i.string,
|
|
@@ -114,7 +114,7 @@ const T = {
|
|
|
114
114
|
showResourcesSwitch: i.bool,
|
|
115
115
|
showCategory: i.bool,
|
|
116
116
|
tagFilters: i.array
|
|
117
|
-
},
|
|
117
|
+
}, Fe = {
|
|
118
118
|
locale: "zh",
|
|
119
119
|
filters: {},
|
|
120
120
|
serverVersion: "",
|
|
@@ -130,7 +130,7 @@ const T = {
|
|
|
130
130
|
showResourcesSwitch: !1,
|
|
131
131
|
showCategory: !0,
|
|
132
132
|
tagFilters: []
|
|
133
|
-
},
|
|
133
|
+
}, De = (e) => [
|
|
134
134
|
{
|
|
135
135
|
name: e("sort.popularity"),
|
|
136
136
|
value: "popularity"
|
|
@@ -143,22 +143,29 @@ const T = {
|
|
|
143
143
|
// name: t('sort.rating'),
|
|
144
144
|
// value: 'rating',
|
|
145
145
|
// },
|
|
146
|
-
],
|
|
146
|
+
], Nt = (e, r, o) => {
|
|
147
|
+
var c;
|
|
148
|
+
const n = (c = window.blocklet) == null ? void 0 : c.version, { w: a, h: l } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
149
|
+
return Le(e, {
|
|
150
|
+
...a || l ? { imageFilter: "resize", w: a, h: l } : {},
|
|
151
|
+
v: n
|
|
152
|
+
});
|
|
153
|
+
}, Ot = (e) => [
|
|
147
154
|
{ name: e("blocklet.free"), value: "free" },
|
|
148
155
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
149
|
-
],
|
|
156
|
+
], jt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), qt = (e, r) => (
|
|
150
157
|
// eslint-disable-next-line no-prototype-builtins
|
|
151
|
-
e == null ? void 0 : e.replace(/{(\w*)}/g, (
|
|
152
|
-
),
|
|
153
|
-
function
|
|
154
|
-
let
|
|
158
|
+
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
159
|
+
), Vt = () => window.innerWidth <= 600, Wt = (e) => xt(e).rgb().object();
|
|
160
|
+
function Ut(e, r) {
|
|
161
|
+
let o;
|
|
155
162
|
return function(...a) {
|
|
156
|
-
return
|
|
157
|
-
|
|
163
|
+
return o && clearTimeout(o), new Promise((l) => {
|
|
164
|
+
o = setTimeout(() => l(e(...a)), r);
|
|
158
165
|
});
|
|
159
166
|
};
|
|
160
167
|
}
|
|
161
|
-
const
|
|
168
|
+
const Ht = Ut((e) => Promise.resolve(e), 300), Gt = {
|
|
162
169
|
common: {
|
|
163
170
|
title: "Blocklet Store",
|
|
164
171
|
searchStore: "Search Blocklet",
|
|
@@ -206,7 +213,7 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
206
213
|
autocomplete: {
|
|
207
214
|
expandResult: 'View all search results for "{name}"'
|
|
208
215
|
}
|
|
209
|
-
},
|
|
216
|
+
}, Qt = {
|
|
210
217
|
common: {
|
|
211
218
|
title: "Blocklet 商店",
|
|
212
219
|
searchStore: "搜索 Blocklet",
|
|
@@ -255,15 +262,15 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
255
262
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
256
263
|
}
|
|
257
264
|
}, J = {
|
|
258
|
-
en: fe(
|
|
259
|
-
zh: fe(
|
|
260
|
-
},
|
|
261
|
-
const
|
|
262
|
-
return e && (
|
|
263
|
-
},
|
|
264
|
-
const n = J[e] ? J[e][
|
|
265
|
-
return
|
|
266
|
-
},
|
|
265
|
+
en: fe(Gt),
|
|
266
|
+
zh: fe(Qt)
|
|
267
|
+
}, Me = (e, r) => {
|
|
268
|
+
const o = {};
|
|
269
|
+
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
270
|
+
}, Xt = (e) => (r, o) => {
|
|
271
|
+
const n = J[e] ? J[e][r] : J.en[r];
|
|
272
|
+
return qt(n, o) || r;
|
|
273
|
+
}, Ee = {
|
|
267
274
|
errors: {
|
|
268
275
|
fetchBlockletsError: null,
|
|
269
276
|
fetchCategoriesError: null
|
|
@@ -317,143 +324,143 @@ const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
|
317
324
|
developerName: "",
|
|
318
325
|
handleSearchSelect: () => {
|
|
319
326
|
}
|
|
320
|
-
},
|
|
327
|
+
}, Ne = Pe(Ee), { Provider: Yt, Consumer: Kr } = Ne;
|
|
321
328
|
function ne({
|
|
322
329
|
filters: e,
|
|
323
|
-
children:
|
|
324
|
-
endpoint:
|
|
330
|
+
children: r,
|
|
331
|
+
endpoint: o,
|
|
325
332
|
locale: n,
|
|
326
333
|
blockletRender: a,
|
|
327
334
|
onFilterChange: l,
|
|
328
|
-
onSearchSelect:
|
|
329
|
-
extraFilter:
|
|
330
|
-
wrapChildren:
|
|
331
|
-
baseSearch:
|
|
332
|
-
serverVersion:
|
|
333
|
-
storeVersion:
|
|
334
|
-
fetchCategoryDelay:
|
|
335
|
-
showResourcesSwitch:
|
|
336
|
-
showCategory:
|
|
337
|
-
tagFilters:
|
|
335
|
+
onSearchSelect: c,
|
|
336
|
+
extraFilter: p,
|
|
337
|
+
wrapChildren: d,
|
|
338
|
+
baseSearch: w,
|
|
339
|
+
serverVersion: y,
|
|
340
|
+
storeVersion: b,
|
|
341
|
+
fetchCategoryDelay: $,
|
|
342
|
+
showResourcesSwitch: B,
|
|
343
|
+
showCategory: S,
|
|
344
|
+
tagFilters: s
|
|
338
345
|
}) {
|
|
339
346
|
var ue;
|
|
340
|
-
const
|
|
347
|
+
const k = Me(y, b), h = E(() => Ie({ baseURL: o, headers: k }), [o]), u = { sortBy: "popularity", sortDirection: "desc", ...e }, x = u.category, z = ft({
|
|
341
348
|
currentPage: T.currentPage,
|
|
342
|
-
pageSize:
|
|
349
|
+
pageSize: Vt() ? T.mobilePageSize : T.pageSize,
|
|
343
350
|
defaultCurrentPage: T.defaultCurrentPage
|
|
344
|
-
}), [A,
|
|
351
|
+
}), [A, _] = j(null), R = Mt(h, u, z, _), {
|
|
345
352
|
data: X = [],
|
|
346
|
-
error:
|
|
347
|
-
loading:
|
|
353
|
+
error: He,
|
|
354
|
+
loading: Ge,
|
|
348
355
|
run: se
|
|
349
|
-
} = Et(
|
|
350
|
-
const
|
|
351
|
-
return g > -1 ? [{ ...
|
|
356
|
+
} = Et(h), Y = E(() => {
|
|
357
|
+
const m = mt(X, [(P) => P.name], ["asc"]), g = m.findIndex((P) => P.name === "All" || P.locales.en === "All");
|
|
358
|
+
return g > -1 ? [{ ...m[g], _id: "All" }, ...m.slice(0, g), ...m.slice(g + 1)] : m;
|
|
352
359
|
}, [X]), ce = E(() => {
|
|
353
|
-
var
|
|
354
|
-
return
|
|
355
|
-
}, [R.data,
|
|
356
|
-
errors: { fetchBlockletsError: A, fetchCategoriesError:
|
|
360
|
+
var m;
|
|
361
|
+
return p(((m = R.data) == null ? void 0 : m.list) || []);
|
|
362
|
+
}, [R.data, p]), de = K(Xt(n), [n]), Qe = E(() => jt(Y, n), [Y, n]), Xe = Ot(de), Ye = {
|
|
363
|
+
errors: { fetchBlockletsError: A, fetchCategoriesError: He },
|
|
357
364
|
loadings: {
|
|
358
365
|
fetchBlockletsLoading: R.loading,
|
|
359
|
-
fetchCategoriesLoading:
|
|
366
|
+
fetchCategoriesLoading: Ge,
|
|
360
367
|
loadingMore: R.loadingMore
|
|
361
368
|
},
|
|
362
|
-
endpoint:
|
|
369
|
+
endpoint: o,
|
|
363
370
|
blockletList: ce,
|
|
364
371
|
total: ((ue = R.data) == null ? void 0 : ue.total) || 0,
|
|
365
|
-
wrapChildren:
|
|
372
|
+
wrapChildren: d,
|
|
366
373
|
t: de,
|
|
367
|
-
storeVersion:
|
|
368
|
-
serverVersion:
|
|
369
|
-
filters:
|
|
370
|
-
selectedCategory:
|
|
374
|
+
storeVersion: b,
|
|
375
|
+
serverVersion: y,
|
|
376
|
+
filters: u,
|
|
377
|
+
selectedCategory: x,
|
|
371
378
|
categoryList: Y,
|
|
372
379
|
blockletRender: a,
|
|
373
380
|
locale: n,
|
|
374
|
-
categoryOptions:
|
|
375
|
-
priceOptions:
|
|
376
|
-
storeApi:
|
|
377
|
-
baseSearch:
|
|
378
|
-
showResourcesSwitch:
|
|
379
|
-
showCategory:
|
|
380
|
-
tagFilters:
|
|
381
|
+
categoryOptions: Qe,
|
|
382
|
+
priceOptions: Xe,
|
|
383
|
+
storeApi: h,
|
|
384
|
+
baseSearch: w,
|
|
385
|
+
showResourcesSwitch: B,
|
|
386
|
+
showCategory: S,
|
|
387
|
+
tagFilters: s,
|
|
381
388
|
hasNextPage: !R.noMore,
|
|
382
389
|
onFilterChange: l,
|
|
383
|
-
cleanFilter: (
|
|
384
|
-
const g =
|
|
390
|
+
cleanFilter: (m) => {
|
|
391
|
+
const g = m ? yt(u, (P, N) => m == null ? void 0 : m.includes(N)) : {};
|
|
385
392
|
l(g);
|
|
386
393
|
},
|
|
387
|
-
handleSort: (
|
|
388
|
-
const g = { ...
|
|
394
|
+
handleSort: (m) => {
|
|
395
|
+
const g = { ...u, sortBy: m, sortDirection: m === "nameAsc" ? "asc" : "desc" };
|
|
389
396
|
l(g);
|
|
390
397
|
},
|
|
391
|
-
handleKeyword: (
|
|
392
|
-
const g = { ...
|
|
398
|
+
handleKeyword: (m) => {
|
|
399
|
+
const g = { ...u, category: void 0, keyword: m || void 0 };
|
|
393
400
|
l(g);
|
|
394
401
|
},
|
|
395
|
-
handlePrice: (
|
|
396
|
-
const g = { ...
|
|
402
|
+
handlePrice: (m) => {
|
|
403
|
+
const g = { ...u, price: m === u.price ? void 0 : m };
|
|
397
404
|
l(g);
|
|
398
405
|
},
|
|
399
|
-
handleCategory: (
|
|
400
|
-
const g =
|
|
406
|
+
handleCategory: (m) => {
|
|
407
|
+
const g = m === "all" || m === u.category ? "" : m, P = { ...u, category: g };
|
|
401
408
|
l(P);
|
|
402
409
|
},
|
|
403
|
-
handleDeveloper: (
|
|
404
|
-
const g = { ...
|
|
410
|
+
handleDeveloper: (m) => {
|
|
411
|
+
const g = { ...u, owner: m || void 0 };
|
|
405
412
|
l(g);
|
|
406
413
|
},
|
|
407
|
-
handlePage: (
|
|
408
|
-
const g = { ...
|
|
414
|
+
handlePage: (m) => {
|
|
415
|
+
const g = { ...u, currentPage: m };
|
|
409
416
|
l(g);
|
|
410
417
|
},
|
|
411
418
|
handleSwitchShowResources: () => {
|
|
412
|
-
const
|
|
413
|
-
l(
|
|
419
|
+
const m = { ...u };
|
|
420
|
+
l(m);
|
|
414
421
|
},
|
|
415
422
|
loadMore: R.loadMore,
|
|
416
|
-
getCategoryLocale: (
|
|
417
|
-
if (!
|
|
423
|
+
getCategoryLocale: (m) => {
|
|
424
|
+
if (!m)
|
|
418
425
|
return null;
|
|
419
|
-
const g = X.find((P) => P._id ===
|
|
426
|
+
const g = X.find((P) => P._id === m);
|
|
420
427
|
return g ? g.locales[n] || g.locales.en : null;
|
|
421
428
|
},
|
|
422
429
|
get developerName() {
|
|
423
430
|
var g, P;
|
|
424
|
-
return ((P = (g = ce.find((
|
|
431
|
+
return ((P = (g = ce.find((N) => {
|
|
425
432
|
var pe;
|
|
426
|
-
return ((pe =
|
|
433
|
+
return ((pe = N == null ? void 0 : N.owner) == null ? void 0 : pe.did) === u.owner;
|
|
427
434
|
})) == null ? void 0 : g.owner) == null ? void 0 : P.name) || "";
|
|
428
435
|
},
|
|
429
|
-
handleSearchSelect:
|
|
436
|
+
handleSearchSelect: c
|
|
430
437
|
};
|
|
431
|
-
return
|
|
432
|
-
setTimeout(se,
|
|
433
|
-
}, [
|
|
438
|
+
return q(() => {
|
|
439
|
+
setTimeout(se, $ || 0);
|
|
440
|
+
}, [o, se, $]), /* @__PURE__ */ t(Yt, { value: Ye, children: r });
|
|
434
441
|
}
|
|
435
442
|
ne.propTypes = {
|
|
436
|
-
...
|
|
443
|
+
...Ae,
|
|
437
444
|
children: i.any.isRequired
|
|
438
445
|
};
|
|
439
|
-
ne.defaultProps =
|
|
440
|
-
function
|
|
441
|
-
const e =
|
|
442
|
-
return e ||
|
|
446
|
+
ne.defaultProps = Fe;
|
|
447
|
+
function C() {
|
|
448
|
+
const e = Te(Ne);
|
|
449
|
+
return e || Ee;
|
|
443
450
|
}
|
|
444
|
-
function
|
|
451
|
+
function Oe({
|
|
445
452
|
children: e,
|
|
446
|
-
onClick:
|
|
447
|
-
size:
|
|
453
|
+
onClick: r,
|
|
454
|
+
size: o = 32
|
|
448
455
|
}) {
|
|
449
456
|
return /* @__PURE__ */ t(
|
|
450
457
|
ee,
|
|
451
458
|
{
|
|
452
|
-
onClick:
|
|
459
|
+
onClick: r,
|
|
453
460
|
variant: "outlined",
|
|
454
461
|
sx: {
|
|
455
|
-
minWidth:
|
|
456
|
-
height:
|
|
462
|
+
minWidth: o,
|
|
463
|
+
height: o,
|
|
457
464
|
p: 0,
|
|
458
465
|
borderColor: "divider",
|
|
459
466
|
"&:hover": {
|
|
@@ -466,43 +473,43 @@ function Me({
|
|
|
466
473
|
}
|
|
467
474
|
);
|
|
468
475
|
}
|
|
469
|
-
function V(e,
|
|
470
|
-
return e === void 0 ?
|
|
476
|
+
function V(e, r) {
|
|
477
|
+
return e === void 0 ? r : e;
|
|
471
478
|
}
|
|
472
479
|
function G({
|
|
473
480
|
xs: e,
|
|
474
|
-
sm:
|
|
475
|
-
md:
|
|
481
|
+
sm: r,
|
|
482
|
+
md: o,
|
|
476
483
|
lg: n,
|
|
477
484
|
xl: a,
|
|
478
485
|
exact: l
|
|
479
486
|
}) {
|
|
480
|
-
const
|
|
487
|
+
const c = ve(), p = M(c.breakpoints.down("sm")), d = M(c.breakpoints.between("sm", "md")), w = M(c.breakpoints.between("md", "lg")), y = M(c.breakpoints.between("lg", "xl"));
|
|
481
488
|
if (l)
|
|
482
|
-
return
|
|
483
|
-
let
|
|
484
|
-
return
|
|
489
|
+
return p ? e || null : d ? r || null : w ? o || null : y ? n || null : a || null;
|
|
490
|
+
let b = e;
|
|
491
|
+
return p || (b = V(r, b), d) || (b = V(o, b), w) || (b = V(n, b), y) ? b : V(a, b);
|
|
485
492
|
}
|
|
486
|
-
function
|
|
487
|
-
const { open:
|
|
493
|
+
function Jt({ children: e }) {
|
|
494
|
+
const { open: r, toggleOpen: o } = oe();
|
|
488
495
|
return /* @__PURE__ */ t(
|
|
489
496
|
G,
|
|
490
497
|
{
|
|
491
|
-
xs: /* @__PURE__ */ t(
|
|
492
|
-
md: /* @__PURE__ */ t(
|
|
498
|
+
xs: /* @__PURE__ */ t(Je, { open: r, onClose: () => o(!1), children: e }),
|
|
499
|
+
md: /* @__PURE__ */ t(v, { children: e })
|
|
493
500
|
}
|
|
494
501
|
);
|
|
495
502
|
}
|
|
496
|
-
const
|
|
503
|
+
const Kt = D(ee)`
|
|
497
504
|
border-radius: 4px;
|
|
498
|
-
`, le =
|
|
499
|
-
|
|
505
|
+
`, le = ct(({ children: e, rounded: r, loading: o, disabled: n, ...a }, l) => /* @__PURE__ */ t(
|
|
506
|
+
Kt,
|
|
500
507
|
{
|
|
501
508
|
ref: l,
|
|
502
509
|
disableElevation: !0,
|
|
503
|
-
disabled: n ||
|
|
510
|
+
disabled: n || o,
|
|
504
511
|
...a,
|
|
505
|
-
startIcon:
|
|
512
|
+
startIcon: o && /* @__PURE__ */ t(te, { size: "1em" }),
|
|
506
513
|
children: e
|
|
507
514
|
}
|
|
508
515
|
));
|
|
@@ -518,49 +525,49 @@ le.defaultProps = {
|
|
|
518
525
|
loading: !1,
|
|
519
526
|
disabled: !1
|
|
520
527
|
};
|
|
521
|
-
function Q({ title: e, value:
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}, [
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
}, []),
|
|
529
|
-
|
|
528
|
+
function Q({ title: e, value: r, icon: o, prepend: n, options: a, onChange: l, itemRender: c, ...p }) {
|
|
529
|
+
const d = U(null), w = xe(), [y, b] = j(!1), [$, B] = j(r !== null ? r : ""), S = M(w.breakpoints.down("sm"));
|
|
530
|
+
q(() => {
|
|
531
|
+
B(r !== null ? r : "");
|
|
532
|
+
}, [r]);
|
|
533
|
+
const s = K(() => {
|
|
534
|
+
b(!1);
|
|
535
|
+
}, []), k = K(() => {
|
|
536
|
+
b(!0);
|
|
530
537
|
}, []);
|
|
531
|
-
function
|
|
532
|
-
|
|
538
|
+
function h(x) {
|
|
539
|
+
B(x.value), l(x.value), S && s();
|
|
533
540
|
}
|
|
534
|
-
function
|
|
535
|
-
return
|
|
541
|
+
function u(x) {
|
|
542
|
+
return x === $;
|
|
536
543
|
}
|
|
537
|
-
return /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
|
|
544
|
+
return /* @__PURE__ */ f(F, { children: [
|
|
545
|
+
/* @__PURE__ */ f(
|
|
546
|
+
Zt,
|
|
540
547
|
{
|
|
541
|
-
ref:
|
|
542
|
-
onClick:
|
|
548
|
+
ref: d,
|
|
549
|
+
onClick: k,
|
|
543
550
|
variant: "outlined",
|
|
544
551
|
size: "small",
|
|
545
|
-
className: ["my-select__selector",
|
|
552
|
+
className: ["my-select__selector", vt($) ? "" : "my-select__selector--active"].join(" "),
|
|
546
553
|
sx: { minWidth: "auto" },
|
|
547
|
-
...
|
|
554
|
+
...p,
|
|
548
555
|
children: [
|
|
549
|
-
/* @__PURE__ */ t("div", { className: "my-select__icon", children:
|
|
556
|
+
/* @__PURE__ */ t("div", { className: "my-select__icon", children: o }),
|
|
550
557
|
e,
|
|
551
|
-
/* @__PURE__ */ t(
|
|
558
|
+
/* @__PURE__ */ t(Ze, { className: "my-select__arrowdown", component: kt, fontSize: "small" })
|
|
552
559
|
]
|
|
553
560
|
}
|
|
554
561
|
),
|
|
555
|
-
/* @__PURE__ */ t(
|
|
562
|
+
/* @__PURE__ */ t(et, { open: y, anchorEl: d.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: x, placement: z }) => /* @__PURE__ */ t(tt, { ...x, sx: { transformOrigin: z === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t(ot, { onClickAway: s, children: /* @__PURE__ */ f(er, { autoFocusItem: y, onMouseEnter: k, onMouseLeave: s, children: [
|
|
556
563
|
n,
|
|
557
|
-
a.map((A) =>
|
|
558
|
-
|
|
564
|
+
a.map((A) => c ? c(A) : /* @__PURE__ */ t(
|
|
565
|
+
nt,
|
|
559
566
|
{
|
|
560
|
-
onClick: () =>
|
|
567
|
+
onClick: () => h(A),
|
|
561
568
|
className: [
|
|
562
569
|
"my-select__option",
|
|
563
|
-
|
|
570
|
+
u(A.value) ? "my-select__option--active" : ""
|
|
564
571
|
].join(" "),
|
|
565
572
|
children: A.name
|
|
566
573
|
},
|
|
@@ -586,7 +593,7 @@ Q.defaultProps = {
|
|
|
586
593
|
onChange: () => {
|
|
587
594
|
}
|
|
588
595
|
};
|
|
589
|
-
const
|
|
596
|
+
const Zt = D(le)`
|
|
590
597
|
border: 1px solid #f0f0f0;
|
|
591
598
|
padding: 6px 8px 6px 12px;
|
|
592
599
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -617,7 +624,7 @@ const Jt = D(le)`
|
|
|
617
624
|
margin-right: 3px;
|
|
618
625
|
}
|
|
619
626
|
}
|
|
620
|
-
`,
|
|
627
|
+
`, er = D(Ke)`
|
|
621
628
|
.my-select__option__icon {
|
|
622
629
|
color: transparent;
|
|
623
630
|
font-size: 14px;
|
|
@@ -634,10 +641,10 @@ const Jt = D(le)`
|
|
|
634
641
|
}
|
|
635
642
|
}
|
|
636
643
|
`;
|
|
637
|
-
function
|
|
638
|
-
var
|
|
639
|
-
const { filters: e, handleSort:
|
|
640
|
-
return /* @__PURE__ */
|
|
644
|
+
function je() {
|
|
645
|
+
var c;
|
|
646
|
+
const { filters: e, handleSort: r, handlePrice: o, t: n } = C(), a = De(n), l = ((c = a.find((p) => p.value === e.sortBy)) == null ? void 0 : c.name) || n("sort.sort");
|
|
647
|
+
return /* @__PURE__ */ f(
|
|
641
648
|
I,
|
|
642
649
|
{
|
|
643
650
|
direction: { xs: "row", md: "column" },
|
|
@@ -647,15 +654,15 @@ function Ne() {
|
|
|
647
654
|
justifyContent: "space-between",
|
|
648
655
|
children: [
|
|
649
656
|
/* @__PURE__ */ t(
|
|
650
|
-
|
|
657
|
+
Ce,
|
|
651
658
|
{
|
|
652
659
|
control: /* @__PURE__ */ t(
|
|
653
|
-
|
|
660
|
+
Se,
|
|
654
661
|
{
|
|
655
662
|
checked: e.price === "free",
|
|
656
663
|
size: "small",
|
|
657
664
|
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
658
|
-
onChange: (
|
|
665
|
+
onChange: (p) => o(p.target.checked ? "free" : "")
|
|
659
666
|
}
|
|
660
667
|
),
|
|
661
668
|
label: n("blocklet.free")
|
|
@@ -667,7 +674,7 @@ function Ne() {
|
|
|
667
674
|
value: e.sortBy,
|
|
668
675
|
options: a,
|
|
669
676
|
title: l,
|
|
670
|
-
onChange:
|
|
677
|
+
onChange: r,
|
|
671
678
|
icon: null,
|
|
672
679
|
prepend: null,
|
|
673
680
|
itemRender: null
|
|
@@ -677,13 +684,13 @@ function Ne() {
|
|
|
677
684
|
}
|
|
678
685
|
);
|
|
679
686
|
}
|
|
680
|
-
function
|
|
681
|
-
const { selectedCategory: e, handleCategory:
|
|
682
|
-
return /* @__PURE__ */
|
|
687
|
+
function tr() {
|
|
688
|
+
const { selectedCategory: e, handleCategory: r, t: o, categoryOptions: n, filters: a, cleanFilter: l, loadings: c } = C(), { toggleOpen: p } = oe();
|
|
689
|
+
return /* @__PURE__ */ f(Jt, { children: [
|
|
683
690
|
/* @__PURE__ */ t(
|
|
684
691
|
G,
|
|
685
692
|
{
|
|
686
|
-
xs: /* @__PURE__ */
|
|
693
|
+
xs: /* @__PURE__ */ f(
|
|
687
694
|
I,
|
|
688
695
|
{
|
|
689
696
|
direction: "row",
|
|
@@ -695,7 +702,7 @@ function Zt() {
|
|
|
695
702
|
borderBottom: 1,
|
|
696
703
|
borderColor: "divider",
|
|
697
704
|
children: [
|
|
698
|
-
/* @__PURE__ */ t(
|
|
705
|
+
/* @__PURE__ */ t(Oe, { onClick: () => p(!1), children: /* @__PURE__ */ t(Re, {}) }),
|
|
699
706
|
/* @__PURE__ */ t(L, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: "Categories" })
|
|
700
707
|
]
|
|
701
708
|
}
|
|
@@ -706,14 +713,14 @@ function Zt() {
|
|
|
706
713
|
/* @__PURE__ */ t(
|
|
707
714
|
I,
|
|
708
715
|
{
|
|
709
|
-
visibility:
|
|
716
|
+
visibility: c.fetchCategoriesLoading ? "hidden" : "visible",
|
|
710
717
|
width: { xs: 268, md: 200 },
|
|
711
718
|
boxSizing: "content-box",
|
|
712
719
|
p: { xs: 2, md: 0 },
|
|
713
720
|
pr: { md: 6 },
|
|
714
|
-
children: a.keyword ? /* @__PURE__ */ t(
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */ t(
|
|
721
|
+
children: a.keyword ? /* @__PURE__ */ t(je, {}) : /* @__PURE__ */ f(F, { children: [
|
|
722
|
+
/* @__PURE__ */ f(v, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
723
|
+
/* @__PURE__ */ t(Be, { icon: st }),
|
|
717
724
|
/* @__PURE__ */ t(
|
|
718
725
|
L,
|
|
719
726
|
{
|
|
@@ -722,59 +729,59 @@ function Zt() {
|
|
|
722
729
|
fontWeight: e ? void 0 : "fontWeightMedium",
|
|
723
730
|
sx: { cursor: "pointer" },
|
|
724
731
|
onClick: () => {
|
|
725
|
-
|
|
732
|
+
p(!1), l();
|
|
726
733
|
},
|
|
727
|
-
children:
|
|
734
|
+
children: o("explore.title")
|
|
728
735
|
}
|
|
729
736
|
)
|
|
730
737
|
] }),
|
|
731
|
-
!!n.length && /* @__PURE__ */ t(I, { pt: 3, mt: 3, borderTop: 1, borderColor: "divider", gap: 2, children: n.map((
|
|
738
|
+
!!n.length && /* @__PURE__ */ t(I, { pt: 3, mt: 3, borderTop: 1, borderColor: "divider", gap: 2, children: n.map((d) => /* @__PURE__ */ t(
|
|
732
739
|
L,
|
|
733
740
|
{
|
|
734
741
|
variant: "body1",
|
|
735
|
-
title:
|
|
742
|
+
title: d.name,
|
|
736
743
|
sx: { cursor: "pointer" },
|
|
737
744
|
"data-cy": "filter",
|
|
738
|
-
color: e ===
|
|
745
|
+
color: e === d.value ? "text.primary" : "text.lighter",
|
|
739
746
|
textTransform: "capitalize",
|
|
740
747
|
onClick: () => {
|
|
741
|
-
e ===
|
|
748
|
+
e === d.value ? l() : r(d.value), p(!1);
|
|
742
749
|
},
|
|
743
|
-
children:
|
|
750
|
+
children: d.name
|
|
744
751
|
},
|
|
745
|
-
|
|
752
|
+
d.value
|
|
746
753
|
)) })
|
|
747
754
|
] })
|
|
748
755
|
}
|
|
749
756
|
)
|
|
750
757
|
] });
|
|
751
758
|
}
|
|
752
|
-
function
|
|
753
|
-
const { endpoint: e, serverVersion:
|
|
759
|
+
function qe() {
|
|
760
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = C(), n = Me(r, o), a = E(() => Ie({
|
|
754
761
|
baseURL: e,
|
|
755
762
|
headers: n
|
|
756
763
|
}), [e]);
|
|
757
764
|
return {
|
|
758
765
|
get: async (l) => {
|
|
759
|
-
const { data:
|
|
760
|
-
return
|
|
766
|
+
const { data: c } = await a.get(l);
|
|
767
|
+
return c;
|
|
761
768
|
},
|
|
762
|
-
post: async (l,
|
|
763
|
-
const { data:
|
|
764
|
-
return
|
|
769
|
+
post: async (l, c) => {
|
|
770
|
+
const { data: p } = await a.post(l, c);
|
|
771
|
+
return p;
|
|
765
772
|
}
|
|
766
773
|
};
|
|
767
774
|
}
|
|
768
|
-
const
|
|
769
|
-
return /* @__PURE__ */ t(
|
|
775
|
+
const Ve = dt(function(r) {
|
|
776
|
+
return /* @__PURE__ */ t($e, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(te, {}) });
|
|
770
777
|
});
|
|
771
778
|
function ge({
|
|
772
779
|
icon: e,
|
|
773
|
-
children:
|
|
774
|
-
maxWidth:
|
|
780
|
+
children: r,
|
|
781
|
+
maxWidth: o = 100,
|
|
775
782
|
title: n
|
|
776
783
|
}) {
|
|
777
|
-
return (
|
|
784
|
+
return (r === 0 || r) && /* @__PURE__ */ f(I, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
778
785
|
e,
|
|
779
786
|
/* @__PURE__ */ t(
|
|
780
787
|
L,
|
|
@@ -782,19 +789,23 @@ function ge({
|
|
|
782
789
|
flex: 1,
|
|
783
790
|
variant: "body2",
|
|
784
791
|
sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
785
|
-
title: n || (typeof
|
|
786
|
-
children:
|
|
792
|
+
title: n || (typeof r == "string" ? r : void 0),
|
|
793
|
+
children: r
|
|
787
794
|
}
|
|
788
795
|
)
|
|
789
796
|
] });
|
|
790
797
|
}
|
|
791
798
|
const ye = 292;
|
|
792
|
-
function
|
|
793
|
-
var
|
|
794
|
-
const { t: e } =
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
799
|
+
function rr() {
|
|
800
|
+
var B, S;
|
|
801
|
+
const { t: e } = C(), { get: r } = qe(), o = ve(), n = M(o.breakpoints.down("md")), a = ((S = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : S.homeBanner) || [], { data: l = [], error: c } = re(async () => {
|
|
802
|
+
const s = await r(
|
|
803
|
+
Le(T.blockletsPath, { didList: a.map((k) => k.did).join(",") })
|
|
804
|
+
);
|
|
805
|
+
return s != null && s.dataList ? a.map((k) => s.dataList.find((h) => h.did === k.did)) : [];
|
|
806
|
+
});
|
|
807
|
+
c && console.error("Get Banner Blocklets error:", c);
|
|
808
|
+
const p = {
|
|
798
809
|
position: "absolute",
|
|
799
810
|
top: "50%",
|
|
800
811
|
transform: "translateY(-50%)",
|
|
@@ -802,13 +813,12 @@ function er() {
|
|
|
802
813
|
cursor: "pointer",
|
|
803
814
|
color: "text.lighter"
|
|
804
815
|
};
|
|
805
|
-
return
|
|
816
|
+
return !c && a.length > 0 ? /* @__PURE__ */ f(F, { children: [
|
|
806
817
|
/* @__PURE__ */ t(L, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
807
|
-
/* @__PURE__ */ t(
|
|
808
|
-
|
|
818
|
+
/* @__PURE__ */ t(v, { height: { xs: "auto", md: ye }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
|
|
819
|
+
Tt,
|
|
809
820
|
{
|
|
810
821
|
showNav: !0,
|
|
811
|
-
autoPlay: !0,
|
|
812
822
|
slideDuration: 1e3,
|
|
813
823
|
slideInterval: 5e3,
|
|
814
824
|
showPlayButton: !1,
|
|
@@ -816,14 +826,14 @@ function er() {
|
|
|
816
826
|
showBullets: !1,
|
|
817
827
|
showThumbnails: !1,
|
|
818
828
|
showFullscreenButton: !1,
|
|
819
|
-
renderLeftNav: (
|
|
820
|
-
renderRightNav: (
|
|
821
|
-
items:
|
|
822
|
-
original:
|
|
829
|
+
renderLeftNav: (s) => /* @__PURE__ */ t(v, { onClick: s, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Rt, { sx: { ...p, left: 5 } }) }),
|
|
830
|
+
renderRightNav: (s) => /* @__PURE__ */ t(v, { onClick: s, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Pt, { sx: { ...p, right: 5 } }) }),
|
|
831
|
+
items: a.map((s, k) => ({
|
|
832
|
+
original: s.did,
|
|
823
833
|
renderItem: () => {
|
|
824
|
-
var
|
|
825
|
-
const
|
|
826
|
-
return /* @__PURE__ */
|
|
834
|
+
var u;
|
|
835
|
+
const h = l[k] || {};
|
|
836
|
+
return /* @__PURE__ */ f(
|
|
827
837
|
I,
|
|
828
838
|
{
|
|
829
839
|
height: { xs: "auto", md: ye },
|
|
@@ -834,14 +844,14 @@ function er() {
|
|
|
834
844
|
p: { xs: 2, md: 5 },
|
|
835
845
|
gap: { xs: 2, md: 5 },
|
|
836
846
|
children: [
|
|
837
|
-
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
|
|
841
|
-
|
|
847
|
+
d(s.cover || nr(s.did, (u = h.screenshots) == null ? void 0 : u[0])),
|
|
848
|
+
/* @__PURE__ */ f(I, { flex: 1, height: "100%", gap: 3, children: [
|
|
849
|
+
/* @__PURE__ */ f(v, { flex: 1, children: [
|
|
850
|
+
w(s.name || h.title || s.name),
|
|
851
|
+
y(s.desc || h.description)
|
|
842
852
|
] }),
|
|
843
|
-
|
|
844
|
-
|
|
853
|
+
h.did && b(h, s.baseNum),
|
|
854
|
+
$(s.link, s.did)
|
|
845
855
|
] })
|
|
846
856
|
]
|
|
847
857
|
}
|
|
@@ -851,13 +861,22 @@ function er() {
|
|
|
851
861
|
}
|
|
852
862
|
) })
|
|
853
863
|
] }) : null;
|
|
854
|
-
function
|
|
855
|
-
return /* @__PURE__ */ t(
|
|
864
|
+
function d(s) {
|
|
865
|
+
return /* @__PURE__ */ t(v, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
|
|
866
|
+
St,
|
|
867
|
+
{
|
|
868
|
+
src: Nt(s, { h: 400, w: 700 }),
|
|
869
|
+
alt: "",
|
|
870
|
+
width: n ? void 0 : 338,
|
|
871
|
+
height: 210,
|
|
872
|
+
style: { objectFit: "cover" }
|
|
873
|
+
}
|
|
874
|
+
) });
|
|
856
875
|
}
|
|
857
|
-
function
|
|
858
|
-
return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children:
|
|
876
|
+
function w(s) {
|
|
877
|
+
return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children: s });
|
|
859
878
|
}
|
|
860
|
-
function
|
|
879
|
+
function y(s) {
|
|
861
880
|
return /* @__PURE__ */ t(
|
|
862
881
|
L,
|
|
863
882
|
{
|
|
@@ -875,19 +894,19 @@ function er() {
|
|
|
875
894
|
overflow: "hidden",
|
|
876
895
|
WebkitBoxOrient: "vertical"
|
|
877
896
|
},
|
|
878
|
-
children:
|
|
897
|
+
children: s
|
|
879
898
|
}
|
|
880
899
|
);
|
|
881
900
|
}
|
|
882
|
-
function s
|
|
883
|
-
const { did:
|
|
884
|
-
return /* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(
|
|
886
|
-
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(
|
|
901
|
+
function b(s, k = 0) {
|
|
902
|
+
const { did: h, owner: u, stats: x } = s;
|
|
903
|
+
return /* @__PURE__ */ f(v, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
904
|
+
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Ct, { src: u.avatar, did: h, size: 20, variant: "circle" }), children: u.fullName }),
|
|
905
|
+
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Be, { icon: Bt }), title: `${x.downloads + k}`, children: or(x.downloads + k) })
|
|
887
906
|
] });
|
|
888
907
|
}
|
|
889
|
-
function
|
|
890
|
-
return /* @__PURE__ */ t(
|
|
908
|
+
function $(s, k) {
|
|
909
|
+
return /* @__PURE__ */ t(lt, { href: s || `/blocklets/${k}`, align: "left", width: 100, children: /* @__PURE__ */ t(
|
|
891
910
|
ee,
|
|
892
911
|
{
|
|
893
912
|
variant: "outlined",
|
|
@@ -903,34 +922,34 @@ function er() {
|
|
|
903
922
|
) });
|
|
904
923
|
}
|
|
905
924
|
}
|
|
906
|
-
const
|
|
907
|
-
function
|
|
908
|
-
const { blockletRender:
|
|
909
|
-
return /* @__PURE__ */
|
|
925
|
+
const or = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, nr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
926
|
+
function lr({ title: e, blocklets: r }) {
|
|
927
|
+
const { blockletRender: o, serverVersion: n } = C();
|
|
928
|
+
return /* @__PURE__ */ f(v, { mt: 3, children: [
|
|
910
929
|
/* @__PURE__ */ t(L, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
911
|
-
/* @__PURE__ */ t(me, { container: !0, spacing: 2, children:
|
|
930
|
+
/* @__PURE__ */ t(me, { container: !0, spacing: 2, children: r.map((a) => /* @__PURE__ */ t(me, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": a.did, children: /* @__PURE__ */ t(v, { padding: "1px", children: o({ blocklet: a, blocklets: r, serverVersion: n }) }) }, a.did)) })
|
|
912
931
|
] });
|
|
913
932
|
}
|
|
914
|
-
function
|
|
915
|
-
const { get: e } =
|
|
916
|
-
data:
|
|
933
|
+
function ar() {
|
|
934
|
+
const { get: e } = qe(), { t: r } = C(), {
|
|
935
|
+
data: o = [],
|
|
917
936
|
error: n,
|
|
918
937
|
loading: a
|
|
919
938
|
} = re(async () => {
|
|
920
939
|
const l = await e(T.explorePath);
|
|
921
940
|
return Array.isArray(l) ? l : [];
|
|
922
941
|
});
|
|
923
|
-
return n ? /* @__PURE__ */ t(Z, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : a ? /* @__PURE__ */ t(
|
|
924
|
-
/* @__PURE__ */ t(
|
|
925
|
-
|
|
926
|
-
(l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
942
|
+
return n ? /* @__PURE__ */ t(Z, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : a ? /* @__PURE__ */ t(Ve, { mt: 15 }) : /* @__PURE__ */ f(F, { children: [
|
|
943
|
+
/* @__PURE__ */ t(rr, {}),
|
|
944
|
+
o.map(
|
|
945
|
+
(l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(lr, { title: r(`explore.${l.type}`), blocklets: l.blocklets }, l.type) : null
|
|
927
946
|
)
|
|
928
947
|
] });
|
|
929
948
|
}
|
|
930
|
-
function
|
|
931
|
-
var
|
|
932
|
-
const { filters: e, handleSort:
|
|
933
|
-
return /* @__PURE__ */
|
|
949
|
+
function ir() {
|
|
950
|
+
var p;
|
|
951
|
+
const { filters: e, handleSort: r, handlePrice: o, t: n, getCategoryLocale: a } = C(), l = De(n), c = ((p = l.find((d) => d.value === e.sortBy)) == null ? void 0 : p.name) || n("sort.sort");
|
|
952
|
+
return /* @__PURE__ */ f(
|
|
934
953
|
I,
|
|
935
954
|
{
|
|
936
955
|
direction: { xs: "column", md: "row" },
|
|
@@ -942,17 +961,17 @@ function lr() {
|
|
|
942
961
|
pb: 3,
|
|
943
962
|
children: [
|
|
944
963
|
/* @__PURE__ */ t(L, { variant: "h2", textTransform: "capitalize", children: a(e.category) }),
|
|
945
|
-
/* @__PURE__ */
|
|
964
|
+
/* @__PURE__ */ f(I, { direction: "row", alignItems: "center", width: { xs: "100%", md: "auto" }, justifyContent: "space-between", children: [
|
|
946
965
|
/* @__PURE__ */ t(
|
|
947
|
-
|
|
966
|
+
Ce,
|
|
948
967
|
{
|
|
949
968
|
control: /* @__PURE__ */ t(
|
|
950
|
-
|
|
969
|
+
Se,
|
|
951
970
|
{
|
|
952
971
|
checked: e.price === "free",
|
|
953
972
|
size: "small",
|
|
954
973
|
sx: { "& .MuiSvgIcon-fontSizeSmall": { fontSize: 16, color: "text.lighter" } },
|
|
955
|
-
onChange: (
|
|
974
|
+
onChange: (d) => o(d.target.checked ? "free" : "")
|
|
956
975
|
}
|
|
957
976
|
),
|
|
958
977
|
label: n("blocklet.free")
|
|
@@ -963,8 +982,8 @@ function lr() {
|
|
|
963
982
|
{
|
|
964
983
|
value: e.sortBy,
|
|
965
984
|
options: l,
|
|
966
|
-
title:
|
|
967
|
-
onChange:
|
|
985
|
+
title: c,
|
|
986
|
+
onChange: r,
|
|
968
987
|
icon: null,
|
|
969
988
|
prepend: null,
|
|
970
989
|
itemRender: null
|
|
@@ -976,16 +995,16 @@ function lr() {
|
|
|
976
995
|
);
|
|
977
996
|
}
|
|
978
997
|
function be() {
|
|
979
|
-
const { t: e } =
|
|
980
|
-
return /* @__PURE__ */ t(
|
|
998
|
+
const { t: e } = C();
|
|
999
|
+
return /* @__PURE__ */ t(_e, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
981
1000
|
}
|
|
982
|
-
function O({ filterTip: e, keywordTip:
|
|
983
|
-
const { t:
|
|
984
|
-
return /* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children:
|
|
986
|
-
e && /* @__PURE__ */ t("span", { children:
|
|
987
|
-
e &&
|
|
988
|
-
|
|
1001
|
+
function O({ filterTip: e, keywordTip: r }) {
|
|
1002
|
+
const { t: o, locale: n } = C(), a = () => n === "zh" ? "、" : " , ";
|
|
1003
|
+
return /* @__PURE__ */ f($e, { className: "tips", children: [
|
|
1004
|
+
/* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1005
|
+
e && /* @__PURE__ */ t("span", { children: o("blocklet.filterTip") }),
|
|
1006
|
+
e && r && a(),
|
|
1007
|
+
r && /* @__PURE__ */ t("span", { children: o("blocklet.keywordTip") })
|
|
989
1008
|
] });
|
|
990
1009
|
}
|
|
991
1010
|
O.propTypes = {
|
|
@@ -996,16 +1015,16 @@ O.defaultProps = {
|
|
|
996
1015
|
filterTip: !1,
|
|
997
1016
|
keywordTip: !1
|
|
998
1017
|
};
|
|
999
|
-
function H({ primaryStart: e, primaryEnd:
|
|
1000
|
-
return /* @__PURE__ */
|
|
1018
|
+
function H({ primaryStart: e, primaryEnd: r, filter: o }) {
|
|
1019
|
+
return /* @__PURE__ */ f(_e, { variant: "subtitle2", children: [
|
|
1001
1020
|
/* @__PURE__ */ t("span", { children: e }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ f("span", { className: "primary", children: [
|
|
1003
1022
|
" ",
|
|
1004
|
-
|
|
1023
|
+
o,
|
|
1005
1024
|
" "
|
|
1006
1025
|
] }),
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
|
|
1026
|
+
/* @__PURE__ */ f("span", { children: [
|
|
1027
|
+
r,
|
|
1009
1028
|
" "
|
|
1010
1029
|
] })
|
|
1011
1030
|
] });
|
|
@@ -1015,80 +1034,80 @@ H.propTypes = {
|
|
|
1015
1034
|
primaryEnd: i.string.isRequired,
|
|
1016
1035
|
filter: i.string.isRequired
|
|
1017
1036
|
};
|
|
1018
|
-
function
|
|
1037
|
+
function We({ blocklets: e, ...r }) {
|
|
1019
1038
|
const {
|
|
1020
|
-
blockletRender:
|
|
1039
|
+
blockletRender: o,
|
|
1021
1040
|
errors: n,
|
|
1022
1041
|
loadings: a,
|
|
1023
1042
|
selectedCategory: l,
|
|
1024
|
-
getCategoryLocale:
|
|
1025
|
-
filters:
|
|
1026
|
-
t:
|
|
1027
|
-
serverVersion:
|
|
1028
|
-
hasNextPage:
|
|
1029
|
-
loadMore:
|
|
1030
|
-
endpoint:
|
|
1031
|
-
} =
|
|
1043
|
+
getCategoryLocale: c,
|
|
1044
|
+
filters: p,
|
|
1045
|
+
t: d,
|
|
1046
|
+
serverVersion: w,
|
|
1047
|
+
hasNextPage: y,
|
|
1048
|
+
loadMore: b,
|
|
1049
|
+
endpoint: $
|
|
1050
|
+
} = C(), B = !!l || !!p.price, [S] = Lt({
|
|
1032
1051
|
loading: a.fetchBlockletsLoading || a.loadingMore,
|
|
1033
|
-
hasNextPage:
|
|
1034
|
-
onLoadMore:
|
|
1052
|
+
hasNextPage: y,
|
|
1053
|
+
onLoadMore: b
|
|
1035
1054
|
});
|
|
1036
1055
|
if (n.fetchBlockletsError)
|
|
1037
1056
|
return /* @__PURE__ */ t(
|
|
1038
1057
|
Z,
|
|
1039
1058
|
{
|
|
1040
|
-
error: new Error(`Failed to fetch blocklets from ${
|
|
1059
|
+
error: new Error(`Failed to fetch blocklets from ${$}: ${n.fetchBlockletsError.message}`)
|
|
1041
1060
|
}
|
|
1042
1061
|
);
|
|
1043
1062
|
if (a.fetchBlockletsLoading)
|
|
1044
|
-
return /* @__PURE__ */ t(
|
|
1045
|
-
if (
|
|
1046
|
-
return /* @__PURE__ */
|
|
1063
|
+
return /* @__PURE__ */ t(Ve, { mt: 15 });
|
|
1064
|
+
if (p.keyword && B && e.length === 0)
|
|
1065
|
+
return /* @__PURE__ */ f(W, { children: [
|
|
1047
1066
|
/* @__PURE__ */ t(
|
|
1048
1067
|
H,
|
|
1049
1068
|
{
|
|
1050
|
-
primaryStart:
|
|
1051
|
-
primaryEnd:
|
|
1052
|
-
filter:
|
|
1069
|
+
primaryStart: d("blocklet.noBlockletPart1"),
|
|
1070
|
+
primaryEnd: d("blocklet.noBlockletPart2"),
|
|
1071
|
+
filter: p.keyword
|
|
1053
1072
|
}
|
|
1054
1073
|
),
|
|
1055
1074
|
/* @__PURE__ */ t(O, { keywordTip: !0, filterTip: !0 })
|
|
1056
1075
|
] });
|
|
1057
|
-
if (
|
|
1058
|
-
return /* @__PURE__ */
|
|
1076
|
+
if (p.keyword && e.length === 0)
|
|
1077
|
+
return /* @__PURE__ */ f(W, { children: [
|
|
1059
1078
|
/* @__PURE__ */ t(
|
|
1060
1079
|
H,
|
|
1061
1080
|
{
|
|
1062
|
-
primaryStart:
|
|
1063
|
-
primaryEnd:
|
|
1064
|
-
filter:
|
|
1081
|
+
primaryStart: d("blocklet.noBlockletPart1"),
|
|
1082
|
+
primaryEnd: d("blocklet.noBlockletPart2"),
|
|
1083
|
+
filter: p.keyword
|
|
1065
1084
|
}
|
|
1066
1085
|
),
|
|
1067
1086
|
/* @__PURE__ */ t(O, { keywordTip: !0 })
|
|
1068
1087
|
] });
|
|
1069
|
-
if (
|
|
1070
|
-
const
|
|
1071
|
-
return /* @__PURE__ */
|
|
1072
|
-
|
|
1088
|
+
if (B && e.length === 0) {
|
|
1089
|
+
const s = c(l);
|
|
1090
|
+
return /* @__PURE__ */ f(W, { children: [
|
|
1091
|
+
s ? /* @__PURE__ */ t(
|
|
1073
1092
|
H,
|
|
1074
1093
|
{
|
|
1075
|
-
primaryStart:
|
|
1076
|
-
primaryEnd:
|
|
1077
|
-
filter:
|
|
1094
|
+
primaryStart: d("blocklet.noCategoryResults1"),
|
|
1095
|
+
primaryEnd: d("blocklet.noCategoryResults2"),
|
|
1096
|
+
filter: s
|
|
1078
1097
|
}
|
|
1079
1098
|
) : /* @__PURE__ */ t(be, {}),
|
|
1080
1099
|
/* @__PURE__ */ t(O, { filterTip: !0 })
|
|
1081
1100
|
] });
|
|
1082
1101
|
}
|
|
1083
|
-
return e.length === 0 ? /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */ t(
|
|
1085
|
-
|
|
1102
|
+
return e.length === 0 ? /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ f(F, { children: [
|
|
1103
|
+
/* @__PURE__ */ t(v, { display: "grid", gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }, p: "2px", ...r, gap: 2, children: e.map((s) => /* @__PURE__ */ t(v, { "data-blocklet-did": s.did, children: o({ blocklet: s, blocklets: e, serverVersion: w }) }, s.did)) }),
|
|
1104
|
+
y && /* @__PURE__ */ t(v, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: S, children: /* @__PURE__ */ t(te, {}) })
|
|
1086
1105
|
] });
|
|
1087
1106
|
}
|
|
1088
|
-
|
|
1107
|
+
We.propTypes = {
|
|
1089
1108
|
blocklets: i.array.isRequired
|
|
1090
1109
|
};
|
|
1091
|
-
const W = D(
|
|
1110
|
+
const W = D(It)`
|
|
1092
1111
|
text-align: center;
|
|
1093
1112
|
margin-top: 100px;
|
|
1094
1113
|
.primary {
|
|
@@ -1098,38 +1117,38 @@ const W = D(Pt)`
|
|
|
1098
1117
|
margin-top: ${(e) => e.theme.spacing(1)};
|
|
1099
1118
|
}
|
|
1100
1119
|
`;
|
|
1101
|
-
function ae({ onSelect: e, wrapChildren:
|
|
1102
|
-
const
|
|
1103
|
-
const { data:
|
|
1104
|
-
return
|
|
1105
|
-
},
|
|
1106
|
-
|
|
1107
|
-
},
|
|
1108
|
-
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1120
|
+
function ae({ onSelect: e, wrapChildren: r }) {
|
|
1121
|
+
const o = U(null), n = U(null), a = U(null), { storeApi: l, blockletRender: c, filters: p, endpoint: d, handleKeyword: w, t: y, serverVersion: b } = C(), $ = async (h) => {
|
|
1122
|
+
const { data: u } = await l.get(T.blockletsPath, { params: h }), x = u.dataList || [];
|
|
1123
|
+
return x.length > 0 && x.unshift({ type: "more-result", total: u.total || 0 }), x;
|
|
1124
|
+
}, B = (h) => {
|
|
1125
|
+
w(h.state.query), h.setIsOpen(!1);
|
|
1126
|
+
}, S = () => {
|
|
1127
|
+
o.current && setTimeout(() => {
|
|
1128
|
+
const h = o.current.querySelector("input.bl-autocomplete-input");
|
|
1129
|
+
h && h.focus();
|
|
1111
1130
|
});
|
|
1112
|
-
},
|
|
1113
|
-
|
|
1114
|
-
},
|
|
1115
|
-
|
|
1131
|
+
}, s = (h) => {
|
|
1132
|
+
h.setIsOpen(!1), S();
|
|
1133
|
+
}, k = ({ prevState: h, state: u }) => {
|
|
1134
|
+
h.query !== u.query && (u.query || (w(), S()));
|
|
1116
1135
|
};
|
|
1117
|
-
return
|
|
1136
|
+
return At(
|
|
1118
1137
|
"ctrl + k, command + k",
|
|
1119
|
-
(
|
|
1138
|
+
(h) => (h.stopPropagation(), h.preventDefault(), S(), !1),
|
|
1120
1139
|
{ enableOnTags: ["INPUT"] }
|
|
1121
|
-
),
|
|
1122
|
-
|
|
1123
|
-
}, [
|
|
1124
|
-
if (!
|
|
1140
|
+
), q(() => {
|
|
1141
|
+
S();
|
|
1142
|
+
}, [d]), q(() => {
|
|
1143
|
+
if (!o.current)
|
|
1125
1144
|
return;
|
|
1126
|
-
const
|
|
1127
|
-
container:
|
|
1128
|
-
renderer: { createElement:
|
|
1145
|
+
const h = zt({
|
|
1146
|
+
container: o.current,
|
|
1147
|
+
renderer: { createElement: ut, Fragment: pt, render: () => {
|
|
1129
1148
|
} },
|
|
1130
|
-
render({ children:
|
|
1131
|
-
var
|
|
1132
|
-
(!n.current || a.current !==
|
|
1149
|
+
render({ children: u }, x) {
|
|
1150
|
+
var z;
|
|
1151
|
+
(!n.current || a.current !== x) && (a.current = x, (z = n.current) == null || z.unmount(), n.current = _t(x)), n.current.render(r(u));
|
|
1133
1152
|
},
|
|
1134
1153
|
autoFocus: !0,
|
|
1135
1154
|
openOnFocus: !1,
|
|
@@ -1143,53 +1162,53 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1143
1162
|
detachedContainer: "bl-autocomplete-detached-container"
|
|
1144
1163
|
},
|
|
1145
1164
|
translations: {
|
|
1146
|
-
clearButtonTitle:
|
|
1147
|
-
detachedCancelButtonText:
|
|
1148
|
-
submitButtonTitle:
|
|
1149
|
-
detachedSearchButtonTitle:
|
|
1165
|
+
clearButtonTitle: y("common.clear"),
|
|
1166
|
+
detachedCancelButtonText: y("common.cancel"),
|
|
1167
|
+
submitButtonTitle: y("common.search"),
|
|
1168
|
+
detachedSearchButtonTitle: y("common.search")
|
|
1150
1169
|
},
|
|
1151
|
-
placeholder:
|
|
1170
|
+
placeholder: y("common.searchStore"),
|
|
1152
1171
|
initialState: {
|
|
1153
|
-
query:
|
|
1172
|
+
query: p.keyword
|
|
1154
1173
|
},
|
|
1155
|
-
onStateChange(
|
|
1156
|
-
|
|
1174
|
+
onStateChange(u) {
|
|
1175
|
+
k(u);
|
|
1157
1176
|
},
|
|
1158
|
-
onSubmit:
|
|
1159
|
-
onReset(
|
|
1160
|
-
|
|
1177
|
+
onSubmit: B,
|
|
1178
|
+
onReset(u) {
|
|
1179
|
+
s(u);
|
|
1161
1180
|
},
|
|
1162
|
-
getSources({ query:
|
|
1181
|
+
getSources({ query: u, state: x, ...z }) {
|
|
1163
1182
|
const A = {
|
|
1164
1183
|
sortBy: T.nameDesc,
|
|
1165
1184
|
page: 1,
|
|
1166
1185
|
pageSize: 10,
|
|
1167
|
-
keyword:
|
|
1186
|
+
keyword: u
|
|
1168
1187
|
};
|
|
1169
|
-
return
|
|
1188
|
+
return Ht([
|
|
1170
1189
|
{
|
|
1171
1190
|
sourceId: "blocklets",
|
|
1172
1191
|
getItems() {
|
|
1173
|
-
return
|
|
1192
|
+
return $(A);
|
|
1174
1193
|
},
|
|
1175
1194
|
// 选中后填充 搜索框中值
|
|
1176
|
-
getItemInputValue({ item:
|
|
1177
|
-
return
|
|
1195
|
+
getItemInputValue({ item: _ }) {
|
|
1196
|
+
return _.type === "more-result" ? u : _.title;
|
|
1178
1197
|
},
|
|
1179
1198
|
// 选中或者点击自动完成列表中的 item 时触发
|
|
1180
|
-
onSelect({ event:
|
|
1181
|
-
return R.type === "more-result" ? (
|
|
1199
|
+
onSelect({ event: _, item: R }) {
|
|
1200
|
+
return R.type === "more-result" ? (z.setIsOpen(!1), w(u)) : _.type === "keydown" ? w(R.title) : e({
|
|
1182
1201
|
blocklet: R,
|
|
1183
|
-
detailUrl:
|
|
1184
|
-
storeUrl:
|
|
1202
|
+
detailUrl: wt(d, "/blocklets", R.did),
|
|
1203
|
+
storeUrl: d
|
|
1185
1204
|
});
|
|
1186
1205
|
},
|
|
1187
1206
|
templates: {
|
|
1188
|
-
item({ item:
|
|
1189
|
-
return
|
|
1207
|
+
item({ item: _ }) {
|
|
1208
|
+
return _.type === "more-result" ? /* @__PURE__ */ t("div", { children: y("autocomplete.expandResult", { name: u, number: _.total.toLocaleString() }) }) : c({ blocklet: _, autocompleteSetters: z, serverVersion: b });
|
|
1190
1209
|
},
|
|
1191
1210
|
noResults() {
|
|
1192
|
-
return
|
|
1211
|
+
return y("blocklet.noResults");
|
|
1193
1212
|
}
|
|
1194
1213
|
}
|
|
1195
1214
|
}
|
|
@@ -1197,20 +1216,20 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1197
1216
|
}
|
|
1198
1217
|
});
|
|
1199
1218
|
return () => {
|
|
1200
|
-
|
|
1219
|
+
h.destroy();
|
|
1201
1220
|
};
|
|
1202
|
-
}, [
|
|
1221
|
+
}, [p, c]), /* @__PURE__ */ f(F, { children: [
|
|
1203
1222
|
/* @__PURE__ */ t(
|
|
1204
1223
|
we,
|
|
1205
1224
|
{
|
|
1206
|
-
styles: (
|
|
1225
|
+
styles: (h) => ke`
|
|
1207
1226
|
.bl-autocomplete-detached-container {
|
|
1208
1227
|
.bl-autocomplete-detached-cancel {
|
|
1209
1228
|
white-space: nowrap;
|
|
1210
1229
|
}
|
|
1211
1230
|
}
|
|
1212
1231
|
.bl-autocomplete-panel {
|
|
1213
|
-
@media (min-width: ${
|
|
1232
|
+
@media (min-width: ${h.breakpoints.values.md}px) {
|
|
1214
1233
|
min-width: 450px;
|
|
1215
1234
|
left: unset !important;
|
|
1216
1235
|
}
|
|
@@ -1218,7 +1237,7 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1218
1237
|
`
|
|
1219
1238
|
}
|
|
1220
1239
|
),
|
|
1221
|
-
/* @__PURE__ */ t("div", { className: "bl-search-container", ref:
|
|
1240
|
+
/* @__PURE__ */ t("div", { className: "bl-search-container", ref: o })
|
|
1222
1241
|
] });
|
|
1223
1242
|
}
|
|
1224
1243
|
ae.propTypes = {
|
|
@@ -1228,29 +1247,29 @@ ae.propTypes = {
|
|
|
1228
1247
|
ae.defaultProps = {
|
|
1229
1248
|
wrapChildren: (e) => e
|
|
1230
1249
|
};
|
|
1231
|
-
function ie({ placeholder: e, ...
|
|
1232
|
-
const { filters:
|
|
1233
|
-
const { value:
|
|
1234
|
-
l(
|
|
1235
|
-
},
|
|
1250
|
+
function ie({ placeholder: e, ...r }) {
|
|
1251
|
+
const { filters: o, handleKeyword: n } = C(), [a, l] = j(o.keyword || ""), c = gt(n, { wait: 300 }), p = (w) => {
|
|
1252
|
+
const { value: y } = w.target;
|
|
1253
|
+
l(y), c.run(y);
|
|
1254
|
+
}, d = () => {
|
|
1236
1255
|
l(""), n();
|
|
1237
1256
|
};
|
|
1238
|
-
return
|
|
1239
|
-
l(
|
|
1240
|
-
}, [
|
|
1241
|
-
|
|
1257
|
+
return q(() => {
|
|
1258
|
+
l(o.keyword || "");
|
|
1259
|
+
}, [o.keyword]), /* @__PURE__ */ t(
|
|
1260
|
+
sr,
|
|
1242
1261
|
{
|
|
1243
1262
|
inputProps: {
|
|
1244
1263
|
"data-cy": "search-blocklet"
|
|
1245
1264
|
},
|
|
1246
|
-
startAdornment: /* @__PURE__ */ t(he, { position: "start", children: /* @__PURE__ */ t(
|
|
1247
|
-
onChange:
|
|
1265
|
+
startAdornment: /* @__PURE__ */ t(he, { position: "start", children: /* @__PURE__ */ t(cr, {}) }),
|
|
1266
|
+
onChange: p,
|
|
1248
1267
|
placeholder: e,
|
|
1249
1268
|
value: a,
|
|
1250
1269
|
title: e,
|
|
1251
1270
|
"data-cy": "search",
|
|
1252
|
-
endAdornment: a && /* @__PURE__ */ t(he, { position: "end", children: /* @__PURE__ */ t(
|
|
1253
|
-
...
|
|
1271
|
+
endAdornment: a && /* @__PURE__ */ t(he, { position: "end", children: /* @__PURE__ */ t(dr, { "data-cy": "search-delete", onClick: d }) }),
|
|
1272
|
+
...r
|
|
1254
1273
|
}
|
|
1255
1274
|
);
|
|
1256
1275
|
}
|
|
@@ -1260,7 +1279,7 @@ ie.propTypes = {
|
|
|
1260
1279
|
ie.defaultProps = {
|
|
1261
1280
|
placeholder: "Type to search..."
|
|
1262
1281
|
};
|
|
1263
|
-
const
|
|
1282
|
+
const sr = D(at)`
|
|
1264
1283
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1265
1284
|
font-size: 14px;
|
|
1266
1285
|
border-radius: 6px;
|
|
@@ -1277,20 +1296,20 @@ const ar = D(lt)`
|
|
|
1277
1296
|
color: transparent;
|
|
1278
1297
|
}
|
|
1279
1298
|
}
|
|
1280
|
-
`,
|
|
1299
|
+
`, cr = D(Ft)`
|
|
1281
1300
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1282
1301
|
font-size: 28px;
|
|
1283
1302
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1284
1303
|
font-size: 24px;
|
|
1285
1304
|
}
|
|
1286
|
-
`,
|
|
1305
|
+
`, dr = D(Re)`
|
|
1287
1306
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1288
1307
|
font-size: 16px;
|
|
1289
1308
|
cursor: pointer;
|
|
1290
1309
|
`;
|
|
1291
|
-
function
|
|
1292
|
-
const { filters: e, handleSearchSelect:
|
|
1293
|
-
return /* @__PURE__ */
|
|
1310
|
+
function ur() {
|
|
1311
|
+
const { filters: e, handleSearchSelect: r, t: o, wrapChildren: n, baseSearch: a } = C(), { toggleOpen: l } = oe(), c = !!e.keyword;
|
|
1312
|
+
return /* @__PURE__ */ f(
|
|
1294
1313
|
I,
|
|
1295
1314
|
{
|
|
1296
1315
|
direction: "row",
|
|
@@ -1305,66 +1324,66 @@ function cr() {
|
|
|
1305
1324
|
/* @__PURE__ */ t(
|
|
1306
1325
|
G,
|
|
1307
1326
|
{
|
|
1308
|
-
xs: !
|
|
1309
|
-
md: /* @__PURE__ */ t(L, { variant: "h1", children:
|
|
1327
|
+
xs: !c && /* @__PURE__ */ t(Oe, { onClick: () => l(!0), children: /* @__PURE__ */ t($t, {}) }),
|
|
1328
|
+
md: /* @__PURE__ */ t(L, { variant: "h1", children: o("common.title") })
|
|
1310
1329
|
}
|
|
1311
1330
|
),
|
|
1312
1331
|
/* @__PURE__ */ t(
|
|
1313
|
-
|
|
1332
|
+
v,
|
|
1314
1333
|
{
|
|
1315
|
-
width: { xs:
|
|
1334
|
+
width: { xs: c ? "100%" : 300, md: 300 },
|
|
1316
1335
|
className: "filter-bar",
|
|
1317
1336
|
sx: {
|
|
1318
1337
|
"& .bl-autocomplete-form": { borderRadius: 2 },
|
|
1319
1338
|
"& .aa-SubmitButton, & .aa-LoadingIndicator": { width: "auto", pl: 1.5, pr: 1 },
|
|
1320
1339
|
"& .aa-SubmitIcon, & .aa-LoadingIcon": { height: 16, width: 16 }
|
|
1321
1340
|
},
|
|
1322
|
-
children: a ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder:
|
|
1341
|
+
children: a ? /* @__PURE__ */ t(ie, { className: "bl-search-container", placeholder: o("common.searchStore"), sx: { pl: 1.5 } }) : /* @__PURE__ */ t(ae, { onSelect: r, wrapChildren: n })
|
|
1323
1342
|
}
|
|
1324
1343
|
)
|
|
1325
1344
|
]
|
|
1326
1345
|
}
|
|
1327
1346
|
);
|
|
1328
1347
|
}
|
|
1329
|
-
function
|
|
1330
|
-
const { blockletList: e, total:
|
|
1331
|
-
return /* @__PURE__ */ t(
|
|
1332
|
-
/* @__PURE__ */ t(
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */ t(
|
|
1335
|
-
/* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: a ? /* @__PURE__ */
|
|
1336
|
-
|
|
1337
|
-
/* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(
|
|
1348
|
+
function pr() {
|
|
1349
|
+
const { blockletList: e, total: r, filters: o, t: n } = C(), a = o.category || o.keyword || o.price;
|
|
1350
|
+
return /* @__PURE__ */ t(Dt, { children: /* @__PURE__ */ f(it, { FallbackComponent: Z, children: [
|
|
1351
|
+
/* @__PURE__ */ t(ur, {}),
|
|
1352
|
+
/* @__PURE__ */ f(v, { display: "flex", height: "100%", children: [
|
|
1353
|
+
/* @__PURE__ */ t(tr, {}),
|
|
1354
|
+
/* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: a ? /* @__PURE__ */ f(F, { children: [
|
|
1355
|
+
o.keyword ? /* @__PURE__ */ f(F, { children: [
|
|
1356
|
+
/* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(je, {}), md: null }),
|
|
1338
1357
|
l()
|
|
1339
|
-
] }) : /* @__PURE__ */ t(
|
|
1340
|
-
/* @__PURE__ */ t(
|
|
1341
|
-
] }) : /* @__PURE__ */ t(
|
|
1358
|
+
] }) : /* @__PURE__ */ t(ir, {}),
|
|
1359
|
+
/* @__PURE__ */ t(We, { blocklets: e, height: "100%" })
|
|
1360
|
+
] }) : /* @__PURE__ */ t(ar, {}) })
|
|
1342
1361
|
] })
|
|
1343
1362
|
] }) });
|
|
1344
1363
|
function l() {
|
|
1345
|
-
return /* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */ t(L, { variant: "h3", children: n("blocklet.search", { keyword:
|
|
1347
|
-
/* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children: n("blocklet.resultCount", { count:
|
|
1364
|
+
return /* @__PURE__ */ f(I, { direction: "row", alignItems: "center", justifyContent: "space-between", mb: 2, mt: { xs: 2, md: 0 }, children: [
|
|
1365
|
+
/* @__PURE__ */ t(L, { variant: "h3", children: n("blocklet.search", { keyword: o.keyword }) }),
|
|
1366
|
+
/* @__PURE__ */ t(L, { variant: "body1", color: "text.lighter", fontSize: 13, children: n("blocklet.resultCount", { count: r }) })
|
|
1348
1367
|
] });
|
|
1349
1368
|
}
|
|
1350
1369
|
}
|
|
1351
|
-
function
|
|
1352
|
-
const
|
|
1370
|
+
function Ue(e) {
|
|
1371
|
+
const r = xe(), o = Wt(r.palette.primary.main), n = {
|
|
1353
1372
|
autocomplete: ke`
|
|
1354
1373
|
:root {
|
|
1355
|
-
--aa-detached-media-query: (max-width: ${
|
|
1356
|
-
--aa-detached-modal-media-query: (min-width: ${
|
|
1357
|
-
--aa-detached-modal-max-width: ${
|
|
1358
|
-
--aa-selected-color-rgb: ${
|
|
1359
|
-
--aa-primary-color-rgb: ${
|
|
1374
|
+
--aa-detached-media-query: (max-width: ${r.breakpoints.values.md}px) !important;
|
|
1375
|
+
--aa-detached-modal-media-query: (min-width: ${r.breakpoints.values.md}px) !important;
|
|
1376
|
+
--aa-detached-modal-max-width: ${r.breakpoints.values.md}px !important;
|
|
1377
|
+
--aa-selected-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1378
|
+
--aa-primary-color-rgb: ${o.r}, ${o.g}, ${o.b} !important;
|
|
1360
1379
|
--aa-input-background-color-rgb: 250, 250, 250 !important;
|
|
1361
1380
|
}
|
|
1362
1381
|
.bl-autocomplete-panel {
|
|
1363
|
-
z-index: ${
|
|
1382
|
+
z-index: ${r.zIndex.modal};
|
|
1364
1383
|
}
|
|
1365
1384
|
.bl-autocomplete-label {
|
|
1366
1385
|
.aa-SubmitIcon {
|
|
1367
|
-
color: ${
|
|
1386
|
+
color: ${r.palette.grey[500]} !important;
|
|
1368
1387
|
}
|
|
1369
1388
|
}
|
|
1370
1389
|
.bl-autocomplete-form {
|
|
@@ -1380,21 +1399,21 @@ function Ve(e) {
|
|
|
1380
1399
|
box-shadow: none !important;
|
|
1381
1400
|
}
|
|
1382
1401
|
.aa-SubmitIcon {
|
|
1383
|
-
color: ${
|
|
1402
|
+
color: ${r.palette.grey[500]} !important;
|
|
1384
1403
|
}
|
|
1385
1404
|
}
|
|
1386
1405
|
.aa-Panel .arcblock-blocklet button {
|
|
1387
|
-
border: 1px solid rgba(${
|
|
1406
|
+
border: 1px solid rgba(${o.r}, ${o.g}, ${o.b}, 0.5);
|
|
1388
1407
|
}
|
|
1389
1408
|
`
|
|
1390
1409
|
};
|
|
1391
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ f(ne, { ...e, children: [
|
|
1392
1411
|
/* @__PURE__ */ t(we, { styles: n.autocomplete }),
|
|
1393
|
-
/* @__PURE__ */ t(
|
|
1412
|
+
/* @__PURE__ */ t(pr, {})
|
|
1394
1413
|
] });
|
|
1395
1414
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1415
|
+
Ue.propTypes = Ae;
|
|
1416
|
+
Ue.defaultProps = Fe;
|
|
1398
1417
|
export {
|
|
1399
|
-
|
|
1418
|
+
Ue as default
|
|
1400
1419
|
};
|