@blocklet/list 0.14.14 → 0.14.15
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 +99 -104
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -31,13 +31,13 @@ import mt from "@mui/icons-material/KeyboardArrowDown";
|
|
|
31
31
|
import ft from "@mui/material/ClickAwayListener";
|
|
32
32
|
import gt from "@mui/material/Grow";
|
|
33
33
|
import Me from "@mui/material/MenuItem";
|
|
34
|
-
import
|
|
34
|
+
import Ne from "@mui/material/MenuList";
|
|
35
35
|
import xt from "@mui/material/Paper";
|
|
36
36
|
import yt from "@mui/material/Popper";
|
|
37
37
|
import wt from "@mui/material/SvgIcon";
|
|
38
38
|
import bt from "lodash/isEmpty";
|
|
39
39
|
import re from "@mui/material/CircularProgress";
|
|
40
|
-
import
|
|
40
|
+
import De from "@arcblock/ux/lib/Avatar";
|
|
41
41
|
import kt from "@iconify-icons/tabler/cloud-download";
|
|
42
42
|
import vt from "@mui/icons-material/ChevronLeft";
|
|
43
43
|
import Ct from "@mui/icons-material/ChevronRight";
|
|
@@ -49,23 +49,22 @@ import Ce from "@mui/material/Grid";
|
|
|
49
49
|
import Bt from "react-infinite-scroll-hook";
|
|
50
50
|
import Se from "@mui/material/Chip";
|
|
51
51
|
import J from "@mui/icons-material/Search";
|
|
52
|
-
import Rt from "@mui/
|
|
53
|
-
import Tt from "@mui/material/
|
|
54
|
-
import Pt from "@mui/material/Dialog";
|
|
52
|
+
import Rt from "@mui/material/Autocomplete";
|
|
53
|
+
import Tt from "@mui/material/Dialog";
|
|
55
54
|
import We from "@mui/material/OutlinedInput";
|
|
56
|
-
import
|
|
57
|
-
import { useHotkeys as
|
|
55
|
+
import Pt from "@mui/material/TextField";
|
|
56
|
+
import { useHotkeys as At } from "react-hotkeys-hook";
|
|
58
57
|
import Ie from "@mui/material/InputAdornment";
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import { Card as
|
|
58
|
+
import Ft from "@arcblock/ux/lib/Empty";
|
|
59
|
+
import Et from "json-stable-stringify";
|
|
60
|
+
import Lt from "@mui/icons-material/Menu";
|
|
61
|
+
import { Card as Ot, Box as le, Skeleton as O } from "@mui/material";
|
|
63
62
|
const $e = Fe({
|
|
64
63
|
open: !1,
|
|
65
64
|
toggleOpen: (e) => {
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
|
-
function
|
|
67
|
+
function _t({ children: e }) {
|
|
69
68
|
const [r, o] = E(!1), n = (a) => {
|
|
70
69
|
o(a ?? !a);
|
|
71
70
|
}, i = H(() => ({ open: r, toggleOpen: n }), [r]);
|
|
@@ -88,14 +87,14 @@ const T = {
|
|
|
88
87
|
explorePath: "/api/blocklets/explore",
|
|
89
88
|
exploreDidsPath: "/api/blocklets/dids",
|
|
90
89
|
cacheSize: 100
|
|
91
|
-
},
|
|
90
|
+
}, zt = (e) => ee(
|
|
92
91
|
async () => {
|
|
93
92
|
const { data: r } = await e.get(T.categoriesPath);
|
|
94
93
|
return Array.isArray(r) ? r : [];
|
|
95
94
|
},
|
|
96
95
|
{ manual: !0 }
|
|
97
96
|
);
|
|
98
|
-
function
|
|
97
|
+
function Mt(e, r) {
|
|
99
98
|
const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
|
|
100
99
|
onFilterChange: n,
|
|
101
100
|
onSearchSelect: i = (l) => {
|
|
@@ -165,13 +164,13 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
165
164
|
...l || p ? { imageFilter: "resize", w: l, h: p } : {},
|
|
166
165
|
v: c
|
|
167
166
|
});
|
|
168
|
-
},
|
|
167
|
+
}, Dt = (e) => [
|
|
169
168
|
{ name: e("blocklet.free"), value: "free" },
|
|
170
169
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
171
|
-
],
|
|
170
|
+
], Wt = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), $t = (e, r) => (
|
|
172
171
|
// eslint-disable-next-line no-prototype-builtins
|
|
173
172
|
e == null ? void 0 : e.replace(/{(\w*)}/g, (o, n) => r.hasOwnProperty(n) ? r[n] : "")
|
|
174
|
-
),
|
|
173
|
+
), jt = () => window.innerWidth <= 600, Ht = {
|
|
175
174
|
common: {
|
|
176
175
|
title: "Blocklet Store",
|
|
177
176
|
searchStore: "Search Blocklet",
|
|
@@ -222,7 +221,7 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
222
221
|
autocomplete: {
|
|
223
222
|
expandResult: 'View all search results for "{name}"'
|
|
224
223
|
}
|
|
225
|
-
},
|
|
224
|
+
}, Ut = {
|
|
226
225
|
common: {
|
|
227
226
|
title: "Blocklet 商店",
|
|
228
227
|
searchStore: "搜索 Blocklet",
|
|
@@ -274,14 +273,14 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
274
273
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
275
274
|
}
|
|
276
275
|
}, ie = {
|
|
277
|
-
en: ve(
|
|
278
|
-
zh: ve(
|
|
276
|
+
en: ve(Ht),
|
|
277
|
+
zh: ve(Ut)
|
|
279
278
|
}, Ue = (e, r) => {
|
|
280
279
|
const o = {};
|
|
281
280
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
282
|
-
},
|
|
281
|
+
}, Vt = (e) => (r, o) => {
|
|
283
282
|
const n = ie[e] ? ie[e][r] : ie.en[r];
|
|
284
|
-
return
|
|
283
|
+
return $t(n, o) || r;
|
|
285
284
|
}, Ve = {
|
|
286
285
|
errors: {
|
|
287
286
|
fetchCategoriesError: null
|
|
@@ -334,8 +333,8 @@ const Nt = (e, r, o) => e && r || !o, je = (e) => [
|
|
|
334
333
|
handlePage: () => {
|
|
335
334
|
}
|
|
336
335
|
}
|
|
337
|
-
}, Ge = Fe(Ve), { Provider:
|
|
338
|
-
function
|
|
336
|
+
}, Ge = Fe(Ve), { Provider: Gt, Consumer: Ro } = Ge;
|
|
337
|
+
function qt(e) {
|
|
339
338
|
const {
|
|
340
339
|
locale: r = "zh",
|
|
341
340
|
filters: o = {},
|
|
@@ -358,15 +357,15 @@ function Kt(e) {
|
|
|
358
357
|
},
|
|
359
358
|
endpoint: C,
|
|
360
359
|
blockletRender: x
|
|
361
|
-
} = e, A = Ue(n, v), F = H(() => Le({ baseURL: C, headers: A }), [C]), L =
|
|
360
|
+
} = e, A = Ue(n, v), F = H(() => Le({ baseURL: C, headers: A }), [C]), L = Mt(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: u }), [M, V] = E(""), {
|
|
362
361
|
data: G = [],
|
|
363
362
|
error: oe,
|
|
364
363
|
loading: X,
|
|
365
364
|
run: Q
|
|
366
|
-
} =
|
|
367
|
-
const R = nt(G, [(
|
|
365
|
+
} = zt(F), $ = H(() => {
|
|
366
|
+
const R = nt(G, [(D) => D.name], ["asc"]), _ = R.findIndex((D) => D.name === "All" || D.locales.en === "All");
|
|
368
367
|
return _ > -1 ? [{ ...R[_], _id: "All" }, ...R.slice(0, _), ...R.slice(_ + 1)] : R;
|
|
369
|
-
}, [G]), q = he(
|
|
368
|
+
}, [G]), q = he(Vt(r), [r]), s = H(() => Wt($, r), [$, r]), b = Dt(q), N = {
|
|
370
369
|
search: L,
|
|
371
370
|
errors: { fetchCategoriesError: oe },
|
|
372
371
|
loadings: {
|
|
@@ -401,7 +400,7 @@ function Kt(e) {
|
|
|
401
400
|
getCategoryLocale: (R) => {
|
|
402
401
|
if (!R)
|
|
403
402
|
return null;
|
|
404
|
-
const _ = G.find((
|
|
403
|
+
const _ = G.find((D) => D._id === R || D.locales.en === "All");
|
|
405
404
|
return _ ? _.locales[r] || _.locales.en : null;
|
|
406
405
|
},
|
|
407
406
|
get developerName() {
|
|
@@ -411,7 +410,7 @@ function Kt(e) {
|
|
|
411
410
|
};
|
|
412
411
|
return U(() => {
|
|
413
412
|
setTimeout(Q, m || 0);
|
|
414
|
-
}, [C, Q, m]), /* @__PURE__ */ t(
|
|
413
|
+
}, [C, Q, m]), /* @__PURE__ */ t(Gt, { value: N, children: B });
|
|
415
414
|
}
|
|
416
415
|
function I() {
|
|
417
416
|
const e = Ee(Ge);
|
|
@@ -464,7 +463,7 @@ function we({
|
|
|
464
463
|
let m = e;
|
|
465
464
|
return l || (m = Y(r, m), p) || (m = Y(o, m), d) || (m = Y(n, m), g) ? m : Y(i, m);
|
|
466
465
|
}
|
|
467
|
-
function
|
|
466
|
+
function Kt({ children: e }) {
|
|
468
467
|
const { open: r, toggleOpen: o } = ye();
|
|
469
468
|
return /* @__PURE__ */ t(
|
|
470
469
|
we,
|
|
@@ -474,7 +473,7 @@ function Xt({ children: e }) {
|
|
|
474
473
|
}
|
|
475
474
|
);
|
|
476
475
|
}
|
|
477
|
-
const
|
|
476
|
+
const Xt = rt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
478
477
|
te,
|
|
479
478
|
{
|
|
480
479
|
ref: n,
|
|
@@ -504,7 +503,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
|
504
503
|
}
|
|
505
504
|
return /* @__PURE__ */ h(W, { children: [
|
|
506
505
|
/* @__PURE__ */ h(
|
|
507
|
-
|
|
506
|
+
Qt,
|
|
508
507
|
{
|
|
509
508
|
ref: a,
|
|
510
509
|
onClick: k,
|
|
@@ -524,7 +523,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
|
524
523
|
{
|
|
525
524
|
...u,
|
|
526
525
|
style: { transformOrigin: C === "bottom" ? "center top" : "center bottom" },
|
|
527
|
-
children: /* @__PURE__ */ t(xt, { children: /* @__PURE__ */ t(ft, { onClickAway: f, children: /* @__PURE__ */ t(
|
|
526
|
+
children: /* @__PURE__ */ t(xt, { children: /* @__PURE__ */ t(ft, { onClickAway: f, children: /* @__PURE__ */ t(Yt, { autoFocusItem: l, onMouseEnter: k, onMouseLeave: f, children: r.map((x) => /* @__PURE__ */ h(Me, { onClick: () => S(x), children: [
|
|
528
527
|
/* @__PURE__ */ t(
|
|
529
528
|
pt,
|
|
530
529
|
{
|
|
@@ -537,7 +536,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
|
537
536
|
) })
|
|
538
537
|
] });
|
|
539
538
|
}
|
|
540
|
-
const
|
|
539
|
+
const Qt = K(Xt)`
|
|
541
540
|
border: 1px solid #f0f0f0;
|
|
542
541
|
padding: 6px 8px 6px 12px;
|
|
543
542
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -565,7 +564,7 @@ const Yt = K(Qt)`
|
|
|
565
564
|
margin-right: 3px;
|
|
566
565
|
}
|
|
567
566
|
}
|
|
568
|
-
`,
|
|
567
|
+
`, Yt = K(Ne)`
|
|
569
568
|
.my-select__option__icon {
|
|
570
569
|
color: transparent;
|
|
571
570
|
font-size: 14px;
|
|
@@ -621,13 +620,13 @@ function Xe() {
|
|
|
621
620
|
}
|
|
622
621
|
);
|
|
623
622
|
}
|
|
624
|
-
function
|
|
623
|
+
function Zt() {
|
|
625
624
|
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: a, baseSearch: c } = I(), { filters: l, handleCategory: p, cleanFilter: d } = r, { toggleOpen: g } = ye();
|
|
626
625
|
U(() => {
|
|
627
626
|
g(!1);
|
|
628
627
|
}, [Object.values(l).join("")]);
|
|
629
628
|
const m = Nt(c, a.showSearch, l.keyword);
|
|
630
|
-
return a.showCategory ? /* @__PURE__ */ h(
|
|
629
|
+
return a.showCategory ? /* @__PURE__ */ h(Kt, { children: [
|
|
631
630
|
/* @__PURE__ */ t(
|
|
632
631
|
we,
|
|
633
632
|
{
|
|
@@ -716,7 +715,7 @@ function be() {
|
|
|
716
715
|
const Qe = ot(function(r) {
|
|
717
716
|
return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
|
|
718
717
|
});
|
|
719
|
-
function
|
|
718
|
+
function Jt({ showSkeleton: e, ...r }) {
|
|
720
719
|
return e ? /* @__PURE__ */ t(z, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(It, { ...r });
|
|
721
720
|
}
|
|
722
721
|
function Be({
|
|
@@ -739,8 +738,8 @@ function Be({
|
|
|
739
738
|
)
|
|
740
739
|
] });
|
|
741
740
|
}
|
|
742
|
-
const ae = 292,
|
|
743
|
-
function
|
|
741
|
+
const ae = 292, er = 210, tr = 338;
|
|
742
|
+
function rr() {
|
|
744
743
|
var B, v;
|
|
745
744
|
const { t: e, search: r } = I(), { get: o } = be(), n = me(), i = j(n.breakpoints.down("md")), a = ((v = (B = window.blocklet) == null ? void 0 : B.preferences) == null ? void 0 : v.homeBanner) || [], {
|
|
746
745
|
data: c = [],
|
|
@@ -773,7 +772,7 @@ function or() {
|
|
|
773
772
|
borderRadius: 3,
|
|
774
773
|
overflow: "hidden",
|
|
775
774
|
children: p ? /* @__PURE__ */ h(y, { p: 5, display: "flex", gap: 5, height: ae, alignItems: "center", justifyContent: "center", children: [
|
|
776
|
-
/* @__PURE__ */ t(z, { variant: "rounded", height:
|
|
775
|
+
/* @__PURE__ */ t(z, { variant: "rounded", height: er, width: tr }),
|
|
777
776
|
/* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
|
|
778
777
|
/* @__PURE__ */ t(z, { variant: "text", height: 50, width: 100 }),
|
|
779
778
|
/* @__PURE__ */ t(z, { variant: "text", height: 40, width: "100%" }),
|
|
@@ -802,7 +801,7 @@ function or() {
|
|
|
802
801
|
original: u.did,
|
|
803
802
|
renderItem: () => {
|
|
804
803
|
var L;
|
|
805
|
-
const x = c[C] || {}, A = u.cover ||
|
|
804
|
+
const x = c[C] || {}, A = u.cover || nr(u.did, (L = x.screenshots) == null ? void 0 : L[0]), F = He(A, { h: 400, w: 700 });
|
|
806
805
|
return /* @__PURE__ */ h(
|
|
807
806
|
P,
|
|
808
807
|
{
|
|
@@ -852,7 +851,7 @@ function or() {
|
|
|
852
851
|
] }) : null;
|
|
853
852
|
function g(u) {
|
|
854
853
|
return /* @__PURE__ */ t(y, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
|
|
855
|
-
|
|
854
|
+
Jt,
|
|
856
855
|
{
|
|
857
856
|
showSkeleton: p,
|
|
858
857
|
src: u,
|
|
@@ -893,8 +892,8 @@ function or() {
|
|
|
893
892
|
function k(u, C = 0) {
|
|
894
893
|
const { did: x, owner: A, stats: F } = u;
|
|
895
894
|
return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
896
|
-
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(
|
|
897
|
-
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ae, { icon: kt }), title: `${F.downloads + C}`, children:
|
|
895
|
+
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(De, { src: A.avatar, did: x, size: 20, variant: "circle" }), children: A.fullName }),
|
|
896
|
+
/* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ae, { icon: kt }), title: `${F.downloads + C}`, children: or(F.downloads + C) })
|
|
898
897
|
] });
|
|
899
898
|
}
|
|
900
899
|
function S(u) {
|
|
@@ -917,15 +916,15 @@ function or() {
|
|
|
917
916
|
);
|
|
918
917
|
}
|
|
919
918
|
}
|
|
920
|
-
const
|
|
921
|
-
function
|
|
919
|
+
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}` : "";
|
|
920
|
+
function lr({ title: e, blocklets: r }) {
|
|
922
921
|
const { blockletRender: o, serverVersion: n } = I();
|
|
923
922
|
return /* @__PURE__ */ h(y, { mt: 3, children: [
|
|
924
923
|
/* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
925
924
|
/* @__PURE__ */ t(Ce, { container: !0, spacing: 2, children: r.map((i) => /* @__PURE__ */ t(Ce, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": i.did, children: /* @__PURE__ */ t(y, { padding: "1px", children: o({ blocklet: i, blocklets: r, serverVersion: n }) }) }, i.did)) })
|
|
926
925
|
] });
|
|
927
926
|
}
|
|
928
|
-
function
|
|
927
|
+
function ir() {
|
|
929
928
|
const { get: e } = be(), { t: r } = I(), {
|
|
930
929
|
data: o = [],
|
|
931
930
|
error: n,
|
|
@@ -935,14 +934,14 @@ function ar() {
|
|
|
935
934
|
return Array.isArray(a) ? a : [];
|
|
936
935
|
});
|
|
937
936
|
return n ? /* @__PURE__ */ t(fe, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : i ? /* @__PURE__ */ t(Qe, { mt: 15 }) : /* @__PURE__ */ h(W, { children: [
|
|
938
|
-
/* @__PURE__ */ t(
|
|
937
|
+
/* @__PURE__ */ t(rr, {}),
|
|
939
938
|
o.map(
|
|
940
|
-
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
939
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(lr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
941
940
|
)
|
|
942
941
|
] });
|
|
943
942
|
}
|
|
944
943
|
const se = "__FREE_TEXT__", Re = "__NO_RESULT__", ce = 40;
|
|
945
|
-
function
|
|
944
|
+
function ar({
|
|
946
945
|
endpoint: e,
|
|
947
946
|
t: r,
|
|
948
947
|
locale: o,
|
|
@@ -969,18 +968,18 @@ function sr({
|
|
|
969
968
|
);
|
|
970
969
|
U(() => {
|
|
971
970
|
u(!0), A(n.keyword), f(n.keyword || "");
|
|
972
|
-
}, [n.keyword, A]),
|
|
971
|
+
}, [n.keyword, A]), At(
|
|
973
972
|
"ctrl + k, command + k",
|
|
974
973
|
(s) => {
|
|
975
|
-
var b,
|
|
976
|
-
return s.stopPropagation(), s.preventDefault(), (
|
|
974
|
+
var b, N;
|
|
975
|
+
return s.stopPropagation(), s.preventDefault(), (N = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || N.focus(), !1;
|
|
977
976
|
},
|
|
978
977
|
{ enableOnTags: ["INPUT"] }
|
|
979
978
|
);
|
|
980
979
|
const F = Oe((s) => A(s), { wait: 300 }), L = { name: se, title: m, did: "" };
|
|
981
980
|
let M = [];
|
|
982
981
|
return m && (v ? M = [L] : x != null && x.length ? M = [L, ...x] : M = [{ name: Re, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ h(W, { children: [
|
|
983
|
-
/* @__PURE__ */ h(
|
|
982
|
+
/* @__PURE__ */ h(Tt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
984
983
|
/* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
985
984
|
/* @__PURE__ */ t(
|
|
986
985
|
We,
|
|
@@ -1020,7 +1019,7 @@ function sr({
|
|
|
1020
1019
|
}
|
|
1021
1020
|
)
|
|
1022
1021
|
] }),
|
|
1023
|
-
/* @__PURE__ */ t(
|
|
1022
|
+
/* @__PURE__ */ t(Ne, { sx: { p: 0.5 }, children: M.map((s) => X(s)) })
|
|
1024
1023
|
] }),
|
|
1025
1024
|
/* @__PURE__ */ t(
|
|
1026
1025
|
J,
|
|
@@ -1030,7 +1029,7 @@ function sr({
|
|
|
1030
1029
|
}
|
|
1031
1030
|
),
|
|
1032
1031
|
/* @__PURE__ */ t(
|
|
1033
|
-
|
|
1032
|
+
Rt,
|
|
1034
1033
|
{
|
|
1035
1034
|
ref: l,
|
|
1036
1035
|
open: !!m && d,
|
|
@@ -1059,7 +1058,7 @@ function sr({
|
|
|
1059
1058
|
}
|
|
1060
1059
|
},
|
|
1061
1060
|
renderInput: (s) => /* @__PURE__ */ t(
|
|
1062
|
-
|
|
1061
|
+
Pt,
|
|
1063
1062
|
{
|
|
1064
1063
|
...s,
|
|
1065
1064
|
InputProps: {
|
|
@@ -1107,7 +1106,7 @@ function sr({
|
|
|
1107
1106
|
s != null && s.did ? (S(!1), p.current = !0, f(""), a(s)) : s.name === se && (S(!1), i(m));
|
|
1108
1107
|
}
|
|
1109
1108
|
function X(s) {
|
|
1110
|
-
var b,
|
|
1109
|
+
var b, N;
|
|
1111
1110
|
return /* @__PURE__ */ h(
|
|
1112
1111
|
Me,
|
|
1113
1112
|
{
|
|
@@ -1116,12 +1115,8 @@ function sr({
|
|
|
1116
1115
|
children: [
|
|
1117
1116
|
Q(s),
|
|
1118
1117
|
/* @__PURE__ */ h(w, { variant: "body1", children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
|
|
1121
|
-
" ",
|
|
1122
|
-
/* @__PURE__ */ t(Rt, { sx: { color: "#D97706", fontSize: 16, display: "none" } })
|
|
1123
|
-
] }),
|
|
1124
|
-
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((D = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : D[o || "en"]) || "" })
|
|
1118
|
+
/* @__PURE__ */ t(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: s.title }),
|
|
1119
|
+
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((N = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : N[o || "en"]) || "" })
|
|
1125
1120
|
] })
|
|
1126
1121
|
]
|
|
1127
1122
|
},
|
|
@@ -1145,7 +1140,7 @@ function sr({
|
|
|
1145
1140
|
}
|
|
1146
1141
|
);
|
|
1147
1142
|
let b = "";
|
|
1148
|
-
return s.logo && (b = ke(e, "assets", s.did, He(s.logo, ce, s.version))), /* @__PURE__ */ t(
|
|
1143
|
+
return s.logo && (b = ke(e, "assets", s.did, He(s.logo, ce, s.version))), /* @__PURE__ */ t(De, { src: b, size: ce, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1149
1144
|
}
|
|
1150
1145
|
function $(s = !0) {
|
|
1151
1146
|
return /* @__PURE__ */ t(y, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && m && v ? /* @__PURE__ */ t(re, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(J, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
@@ -1154,7 +1149,7 @@ function sr({
|
|
|
1154
1149
|
return m ? /* @__PURE__ */ t(y, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(ge, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => G() }) }) : null;
|
|
1155
1150
|
}
|
|
1156
1151
|
}
|
|
1157
|
-
function
|
|
1152
|
+
function sr({ placeholder: e = "Type to search...", ...r }) {
|
|
1158
1153
|
const { search: o } = I(), { filters: n, handleKeyword: i } = o, [a, c] = E(n.keyword || ""), l = Oe(i, { wait: 300 }), p = (g) => {
|
|
1159
1154
|
const { value: m } = g.target;
|
|
1160
1155
|
c(m), l.run(m);
|
|
@@ -1164,23 +1159,23 @@ function cr({ placeholder: e = "Type to search...", ...r }) {
|
|
|
1164
1159
|
return U(() => {
|
|
1165
1160
|
c(n.keyword || "");
|
|
1166
1161
|
}, [n.keyword]), /* @__PURE__ */ t(
|
|
1167
|
-
|
|
1162
|
+
cr,
|
|
1168
1163
|
{
|
|
1169
1164
|
inputProps: {
|
|
1170
1165
|
"data-cy": "search-blocklet"
|
|
1171
1166
|
},
|
|
1172
|
-
startAdornment: /* @__PURE__ */ t(Ie, { position: "start", children: /* @__PURE__ */ t(
|
|
1167
|
+
startAdornment: /* @__PURE__ */ t(Ie, { position: "start", children: /* @__PURE__ */ t(dr, {}) }),
|
|
1173
1168
|
onChange: p,
|
|
1174
1169
|
placeholder: e,
|
|
1175
1170
|
value: a,
|
|
1176
1171
|
title: e,
|
|
1177
1172
|
"data-cy": "search",
|
|
1178
|
-
endAdornment: a && /* @__PURE__ */ t(Ie, { position: "end", children: /* @__PURE__ */ t(
|
|
1173
|
+
endAdornment: a && /* @__PURE__ */ t(Ie, { position: "end", children: /* @__PURE__ */ t(ur, { "data-cy": "search-delete", onClick: d }) }),
|
|
1179
1174
|
...r
|
|
1180
1175
|
}
|
|
1181
1176
|
);
|
|
1182
1177
|
}
|
|
1183
|
-
const
|
|
1178
|
+
const cr = K(We)`
|
|
1184
1179
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1185
1180
|
font-size: 14px;
|
|
1186
1181
|
border-radius: 6px;
|
|
@@ -1197,18 +1192,18 @@ const dr = K(We)`
|
|
|
1197
1192
|
color: transparent;
|
|
1198
1193
|
}
|
|
1199
1194
|
}
|
|
1200
|
-
`,
|
|
1195
|
+
`, dr = K(J)`
|
|
1201
1196
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1202
1197
|
font-size: 28px;
|
|
1203
1198
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1204
1199
|
font-size: 24px;
|
|
1205
1200
|
}
|
|
1206
|
-
`,
|
|
1201
|
+
`, ur = K(ge)`
|
|
1207
1202
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1208
1203
|
font-size: 16px;
|
|
1209
1204
|
cursor: pointer;
|
|
1210
1205
|
`;
|
|
1211
|
-
function
|
|
1206
|
+
function hr() {
|
|
1212
1207
|
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: a, showResourcesSwitch: c, layout: l, baseSearch: p } = I(), { filters: d, handleSort: g, handlePrice: m, handleDeveloper: f, handleSwitchShowResources: k, cleanFilter: S } = e, B = je(r);
|
|
1213
1208
|
return /* @__PURE__ */ h(
|
|
1214
1209
|
P,
|
|
@@ -1234,8 +1229,8 @@ function pr() {
|
|
|
1234
1229
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1235
1230
|
gap: 2,
|
|
1236
1231
|
children: [
|
|
1237
|
-
l.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: p ? /* @__PURE__ */ t(
|
|
1238
|
-
|
|
1232
|
+
l.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: p ? /* @__PURE__ */ t(sr, {}) : /* @__PURE__ */ t(
|
|
1233
|
+
ar,
|
|
1239
1234
|
{
|
|
1240
1235
|
locale: n,
|
|
1241
1236
|
endpoint: o,
|
|
@@ -1323,7 +1318,7 @@ function Te({
|
|
|
1323
1318
|
}
|
|
1324
1319
|
function Z({ children: e }) {
|
|
1325
1320
|
return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1326
|
-
/* @__PURE__ */ t(
|
|
1321
|
+
/* @__PURE__ */ t(Ft, {}),
|
|
1327
1322
|
e
|
|
1328
1323
|
] });
|
|
1329
1324
|
}
|
|
@@ -1354,7 +1349,7 @@ function ue({
|
|
|
1354
1349
|
] })
|
|
1355
1350
|
] });
|
|
1356
1351
|
}
|
|
1357
|
-
function
|
|
1352
|
+
function pr() {
|
|
1358
1353
|
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r, a = !!n || !!i.price;
|
|
1359
1354
|
if (i.keyword && a)
|
|
1360
1355
|
return /* @__PURE__ */ h(Z, { children: [
|
|
@@ -1396,7 +1391,7 @@ function mr() {
|
|
|
1396
1391
|
}
|
|
1397
1392
|
return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(Pe, {}) });
|
|
1398
1393
|
}
|
|
1399
|
-
const
|
|
1394
|
+
const mr = (e, r, o, n) => lt(
|
|
1400
1395
|
async (i) => {
|
|
1401
1396
|
i || (o.currentPage = o.defaultCurrentPage);
|
|
1402
1397
|
const { currentPage: a, pageSize: c } = o, l = {
|
|
@@ -1412,17 +1407,17 @@ const fr = (e, r, o, n) => lt(
|
|
|
1412
1407
|
},
|
|
1413
1408
|
{
|
|
1414
1409
|
isNoMore: (i) => i ? i.page * i.pageSize >= i.total : !1,
|
|
1415
|
-
reloadDeps: [e,
|
|
1410
|
+
reloadDeps: [e, Et(r)],
|
|
1416
1411
|
onError: n
|
|
1417
1412
|
}
|
|
1418
1413
|
);
|
|
1419
|
-
function
|
|
1414
|
+
function fr() {
|
|
1420
1415
|
var m;
|
|
1421
1416
|
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: a } = r, c = it({
|
|
1422
1417
|
currentPage: T.currentPage,
|
|
1423
|
-
pageSize:
|
|
1418
|
+
pageSize: jt() ? T.mobilePageSize : T.pageSize,
|
|
1424
1419
|
defaultCurrentPage: T.defaultCurrentPage
|
|
1425
|
-
}), [l, p] = E(null), d =
|
|
1420
|
+
}), [l, p] = E(null), d = mr(e, a, c, p), g = H(
|
|
1426
1421
|
() => {
|
|
1427
1422
|
var f, k;
|
|
1428
1423
|
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
@@ -1448,8 +1443,8 @@ function gr() {
|
|
|
1448
1443
|
}
|
|
1449
1444
|
};
|
|
1450
1445
|
}
|
|
1451
|
-
function
|
|
1452
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: a, layout: c, baseSearch: l } = I(), { filters: p } = r, { blocklets: d, errors: g, loadMore: m, loadings: f, hasNextPage: k, total: S } =
|
|
1446
|
+
function gr() {
|
|
1447
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: a, layout: c, baseSearch: l } = I(), { filters: p } = r, { blocklets: d, errors: g, loadMore: m, loadings: f, hasNextPage: k, total: S } = fr(), [B] = Bt({
|
|
1453
1448
|
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1454
1449
|
hasNextPage: k,
|
|
1455
1450
|
onLoadMore: m
|
|
@@ -1460,7 +1455,7 @@ function xr() {
|
|
|
1460
1455
|
}
|
|
1461
1456
|
const v = l && c.showSearch || !p.keyword;
|
|
1462
1457
|
return /* @__PURE__ */ h(W, { children: [
|
|
1463
|
-
v ? /* @__PURE__ */ t(
|
|
1458
|
+
v ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ h(W, { children: [
|
|
1464
1459
|
/* @__PURE__ */ t(we, { xs: /* @__PURE__ */ t(Xe, {}), md: null }),
|
|
1465
1460
|
C()
|
|
1466
1461
|
] }),
|
|
@@ -1478,7 +1473,7 @@ function xr() {
|
|
|
1478
1473
|
gap: 2,
|
|
1479
1474
|
children: d.map((x) => /* @__PURE__ */ t(y, { "data-blocklet-did": x.did, sx: { minWidth: a }, children: n({ blocklet: x, blocklets: d, serverVersion: i }) }, x.did))
|
|
1480
1475
|
}
|
|
1481
|
-
) : /* @__PURE__ */ t(
|
|
1476
|
+
) : /* @__PURE__ */ t(pr, {});
|
|
1482
1477
|
}
|
|
1483
1478
|
function C() {
|
|
1484
1479
|
return /* @__PURE__ */ h(
|
|
@@ -1498,7 +1493,7 @@ function xr() {
|
|
|
1498
1493
|
);
|
|
1499
1494
|
}
|
|
1500
1495
|
}
|
|
1501
|
-
function
|
|
1496
|
+
function xr() {
|
|
1502
1497
|
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = ye();
|
|
1503
1498
|
return /* @__PURE__ */ h(
|
|
1504
1499
|
w,
|
|
@@ -1510,24 +1505,24 @@ function yr() {
|
|
|
1510
1505
|
py: 2,
|
|
1511
1506
|
fontWeight: "fontWeightMedium",
|
|
1512
1507
|
children: [
|
|
1513
|
-
/* @__PURE__ */ t(qe, { onClick: () => n(!0), children: /* @__PURE__ */ t(
|
|
1508
|
+
/* @__PURE__ */ t(qe, { onClick: () => n(!0), children: /* @__PURE__ */ t(Lt, {}) }),
|
|
1514
1509
|
o(r) || e("common.category")
|
|
1515
1510
|
]
|
|
1516
1511
|
}
|
|
1517
1512
|
);
|
|
1518
1513
|
}
|
|
1519
|
-
function
|
|
1514
|
+
function yr() {
|
|
1520
1515
|
const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
|
|
1521
|
-
return /* @__PURE__ */ t(
|
|
1522
|
-
/* @__PURE__ */ t(
|
|
1516
|
+
return /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ h(et, { FallbackComponent: fe, children: [
|
|
1517
|
+
/* @__PURE__ */ t(xr, {}),
|
|
1523
1518
|
/* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1524
|
-
/* @__PURE__ */ t(
|
|
1525
|
-
/* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(
|
|
1519
|
+
/* @__PURE__ */ t(Zt, {}),
|
|
1520
|
+
/* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(ir, {}) : /* @__PURE__ */ t(gr, {}) })
|
|
1526
1521
|
] })
|
|
1527
1522
|
] }) });
|
|
1528
1523
|
}
|
|
1529
|
-
function
|
|
1530
|
-
return /* @__PURE__ */ h(
|
|
1524
|
+
function To(e) {
|
|
1525
|
+
return /* @__PURE__ */ h(Ot, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
|
|
1531
1526
|
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
|
|
1532
1527
|
/* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
|
|
1533
1528
|
/* @__PURE__ */ t(O, { variant: "rounded", width: 48, height: 48 }),
|
|
@@ -1545,7 +1540,7 @@ function Ao(e) {
|
|
|
1545
1540
|
] })
|
|
1546
1541
|
] });
|
|
1547
1542
|
}
|
|
1548
|
-
function
|
|
1543
|
+
function Po(e) {
|
|
1549
1544
|
const r = me(), o = Ye(
|
|
1550
1545
|
Je({
|
|
1551
1546
|
...r,
|
|
@@ -1575,12 +1570,12 @@ function Fo(e) {
|
|
|
1575
1570
|
}
|
|
1576
1571
|
})
|
|
1577
1572
|
);
|
|
1578
|
-
return /* @__PURE__ */ t(Ze, { theme: o, children: /* @__PURE__ */ t(
|
|
1573
|
+
return /* @__PURE__ */ t(Ze, { theme: o, children: /* @__PURE__ */ t(qt, { ...e, children: /* @__PURE__ */ t(yr, {}) }) });
|
|
1579
1574
|
}
|
|
1580
1575
|
export {
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1576
|
+
ar as Autocomplete,
|
|
1577
|
+
To as CardSkeleton,
|
|
1578
|
+
Jt as Image,
|
|
1579
|
+
Po as default,
|
|
1580
|
+
Mt as useSearch
|
|
1586
1581
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.15",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@blocklet/js-sdk": "^1.16.32",
|
|
56
|
-
"@blocklet/util": "0.14.
|
|
56
|
+
"@blocklet/util": "0.14.15",
|
|
57
57
|
"@emotion/react": "^11.10.0",
|
|
58
58
|
"@emotion/styled": "^11.10.0",
|
|
59
59
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"prettier": "^3.3.2",
|
|
91
91
|
"vite": "^5.2.12"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "5f4287f65e77e75b3c6064246bee37d54fa1a074"
|
|
94
94
|
}
|