@blocklet/list 0.14.1 → 0.14.3
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 +77 -76
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -21,27 +21,28 @@ import xt from "@mui/icons-material/KeyboardArrowDown";
|
|
|
21
21
|
import wt from "lodash/isEmpty";
|
|
22
22
|
import Ie from "@mui/material/Box";
|
|
23
23
|
import kt from "@arcblock/ux/lib/Avatar";
|
|
24
|
-
import vt from "@
|
|
25
|
-
import Ct from "@
|
|
26
|
-
import St from "@mui/icons-material/
|
|
27
|
-
import Bt from "
|
|
24
|
+
import vt from "@arcblock/ux/lib/Img";
|
|
25
|
+
import Ct from "@iconify-icons/tabler/cloud-download";
|
|
26
|
+
import St from "@mui/icons-material/ChevronLeft";
|
|
27
|
+
import Bt from "@mui/icons-material/ChevronRight";
|
|
28
|
+
import Rt from "react-image-gallery";
|
|
28
29
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
29
|
-
import
|
|
30
|
-
import
|
|
30
|
+
import Pt from "@arcblock/ux/lib/Empty";
|
|
31
|
+
import Tt from "react-infinite-scroll-hook";
|
|
31
32
|
import Le from "@mui/material/Typography";
|
|
32
|
-
import
|
|
33
|
-
import { createRoot as
|
|
34
|
-
import { autocomplete as
|
|
35
|
-
import { useHotkeys as
|
|
36
|
-
import { joinURL as
|
|
37
|
-
import
|
|
33
|
+
import It from "@mui/icons-material/Menu";
|
|
34
|
+
import { createRoot as Lt } from "react-dom/client";
|
|
35
|
+
import { autocomplete as $t } from "@algolia/autocomplete-js";
|
|
36
|
+
import { useHotkeys as zt } from "react-hotkeys-hook";
|
|
37
|
+
import { joinURL as _t } from "ufo";
|
|
38
|
+
import At from "@mui/icons-material/Search";
|
|
38
39
|
import "@algolia/autocomplete-theme-classic/dist/theme.css";
|
|
39
40
|
const $e = Re({
|
|
40
41
|
open: !1,
|
|
41
42
|
toggleOpen: (e) => {
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
|
-
function
|
|
45
|
+
function Ft({ children: e }) {
|
|
45
46
|
const [o, r] = q(!1), n = (l) => {
|
|
46
47
|
r(l ?? !l);
|
|
47
48
|
}, a = E(() => ({ open: o, toggleOpen: n }), [o]);
|
|
@@ -64,7 +65,7 @@ const T = {
|
|
|
64
65
|
explorePath: "/api/blocklets/explore",
|
|
65
66
|
exploreDidsPath: "/api/blocklets/dids",
|
|
66
67
|
cacheSize: 100
|
|
67
|
-
},
|
|
68
|
+
}, Dt = (e, o, r, n) => mt(
|
|
68
69
|
async (a) => {
|
|
69
70
|
a || (r.currentPage = r.defaultCurrentPage);
|
|
70
71
|
const { currentPage: l, pageSize: d } = r, u = {
|
|
@@ -83,7 +84,7 @@ const T = {
|
|
|
83
84
|
reloadDeps: [e, yt(o)],
|
|
84
85
|
onError: n
|
|
85
86
|
}
|
|
86
|
-
),
|
|
87
|
+
), Et = (e) => re(
|
|
87
88
|
async () => {
|
|
88
89
|
const { data: o } = await e.get(T.categoriesPath);
|
|
89
90
|
return Array.isArray(o) ? o : [];
|
|
@@ -142,14 +143,14 @@ const T = {
|
|
|
142
143
|
// name: t('sort.rating'),
|
|
143
144
|
// value: 'rating',
|
|
144
145
|
// },
|
|
145
|
-
],
|
|
146
|
+
], Mt = (e) => [
|
|
146
147
|
{ name: e("blocklet.free"), value: "free" },
|
|
147
148
|
{ name: e("blocklet.payment"), value: "payment" }
|
|
148
|
-
],
|
|
149
|
+
], Nt = (e = [], o = "en") => e.map((r) => ({ name: r.locales[o] || r.locales.en, value: r._id })), Ot = (e, o) => (
|
|
149
150
|
// eslint-disable-next-line no-prototype-builtins
|
|
150
151
|
e == null ? void 0 : e.replace(/{(\w*)}/g, (r, n) => o.hasOwnProperty(n) ? o[n] : "")
|
|
151
|
-
),
|
|
152
|
-
function
|
|
152
|
+
), qt = () => window.innerWidth <= 600, jt = (e) => bt(e).rgb().object();
|
|
153
|
+
function Vt(e, o) {
|
|
153
154
|
let r;
|
|
154
155
|
return function(...a) {
|
|
155
156
|
return r && clearTimeout(r), new Promise((l) => {
|
|
@@ -157,7 +158,7 @@ function jt(e, o) {
|
|
|
157
158
|
});
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
+
const Wt = Vt((e) => Promise.resolve(e), 300), Ut = {
|
|
161
162
|
common: {
|
|
162
163
|
title: "Blocklet Store",
|
|
163
164
|
searchStore: "Search Blocklet",
|
|
@@ -205,7 +206,7 @@ const Vt = jt((e) => Promise.resolve(e), 300), Wt = {
|
|
|
205
206
|
autocomplete: {
|
|
206
207
|
expandResult: 'View all search results for "{name}"'
|
|
207
208
|
}
|
|
208
|
-
},
|
|
209
|
+
}, Ht = {
|
|
209
210
|
common: {
|
|
210
211
|
title: "Blocklet 商店",
|
|
211
212
|
searchStore: "搜索 Blocklet",
|
|
@@ -254,14 +255,14 @@ const Vt = jt((e) => Promise.resolve(e), 300), Wt = {
|
|
|
254
255
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
255
256
|
}
|
|
256
257
|
}, J = {
|
|
257
|
-
en: fe(
|
|
258
|
-
zh: fe(
|
|
258
|
+
en: fe(Ut),
|
|
259
|
+
zh: fe(Ht)
|
|
259
260
|
}, Fe = (e, o) => {
|
|
260
261
|
const r = {};
|
|
261
262
|
return e && (r["x-blocklet-server-version"] = e), o && (r["x-blocklet-store-version"] = o), r;
|
|
262
|
-
},
|
|
263
|
+
}, Gt = (e) => (o, r) => {
|
|
263
264
|
const n = J[e] ? J[e][o] : J.en[o];
|
|
264
|
-
return
|
|
265
|
+
return Ot(n, r) || o;
|
|
265
266
|
}, De = {
|
|
266
267
|
errors: {
|
|
267
268
|
fetchBlockletsError: null,
|
|
@@ -316,7 +317,7 @@ const Vt = jt((e) => Promise.resolve(e), 300), Wt = {
|
|
|
316
317
|
developerName: "",
|
|
317
318
|
handleSearchSelect: () => {
|
|
318
319
|
}
|
|
319
|
-
}, Ee = Re(De), { Provider:
|
|
320
|
+
}, Ee = Re(De), { Provider: Qt, Consumer: Yr } = Ee;
|
|
320
321
|
function ne({
|
|
321
322
|
filters: e,
|
|
322
323
|
children: o,
|
|
@@ -338,20 +339,20 @@ function ne({
|
|
|
338
339
|
var ue;
|
|
339
340
|
const z = Fe(f, y), b = E(() => Te.create({ baseURL: r, headers: z }), [r]), h = { sortBy: "popularity", sortDirection: "desc", ...e }, C = h.category, _ = ht({
|
|
340
341
|
currentPage: T.currentPage,
|
|
341
|
-
pageSize:
|
|
342
|
+
pageSize: qt() ? T.mobilePageSize : T.pageSize,
|
|
342
343
|
defaultCurrentPage: T.defaultCurrentPage
|
|
343
|
-
}), [A, $] = q(null), R =
|
|
344
|
+
}), [A, $] = q(null), R = Dt(b, h, _, $), {
|
|
344
345
|
data: X = [],
|
|
345
346
|
error: We,
|
|
346
347
|
loading: Ue,
|
|
347
348
|
run: se
|
|
348
|
-
} =
|
|
349
|
+
} = Et(b), Y = E(() => {
|
|
349
350
|
const p = pt(X, [(P) => P.name], ["asc"]), g = p.findIndex((P) => P.name === "All" || P.locales.en === "All");
|
|
350
351
|
return g > -1 ? [{ ...p[g], _id: "All" }, ...p.slice(0, g), ...p.slice(g + 1)] : p;
|
|
351
352
|
}, [X]), ce = E(() => {
|
|
352
353
|
var p;
|
|
353
354
|
return u(((p = R.data) == null ? void 0 : p.list) || []);
|
|
354
|
-
}, [R.data, u]), de = K(
|
|
355
|
+
}, [R.data, u]), de = K(Gt(n), [n]), He = E(() => Nt(Y, n), [Y, n]), Ge = Mt(de), Qe = {
|
|
355
356
|
errors: { fetchBlockletsError: A, fetchCategoriesError: We },
|
|
356
357
|
loadings: {
|
|
357
358
|
fetchBlockletsLoading: R.loading,
|
|
@@ -429,7 +430,7 @@ function ne({
|
|
|
429
430
|
};
|
|
430
431
|
return j(() => {
|
|
431
432
|
setTimeout(se, c || 0);
|
|
432
|
-
}, [r, se, c]), /* @__PURE__ */ t(
|
|
433
|
+
}, [r, se, c]), /* @__PURE__ */ t(Qt, { value: Qe, children: o });
|
|
433
434
|
}
|
|
434
435
|
ne.propTypes = {
|
|
435
436
|
...ze,
|
|
@@ -482,7 +483,7 @@ function G({
|
|
|
482
483
|
let y = e;
|
|
483
484
|
return u || (y = V(o, y), s) || (y = V(r, y), v) || (y = V(n, y), f) ? y : V(a, y);
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
+
function Xt({ children: e }) {
|
|
486
487
|
const { open: o, toggleOpen: r } = oe();
|
|
487
488
|
return /* @__PURE__ */ t(
|
|
488
489
|
G,
|
|
@@ -492,10 +493,10 @@ function Qt({ children: e }) {
|
|
|
492
493
|
}
|
|
493
494
|
);
|
|
494
495
|
}
|
|
495
|
-
const
|
|
496
|
+
const Yt = D(ee)`
|
|
496
497
|
border-radius: 4px;
|
|
497
498
|
`, le = st(({ children: e, rounded: o, loading: r, disabled: n, ...a }, l) => /* @__PURE__ */ t(
|
|
498
|
-
|
|
499
|
+
Yt,
|
|
499
500
|
{
|
|
500
501
|
ref: l,
|
|
501
502
|
disableElevation: !0,
|
|
@@ -535,7 +536,7 @@ function Q({ title: e, value: o, icon: r, prepend: n, options: a, onChange: l, i
|
|
|
535
536
|
}
|
|
536
537
|
return /* @__PURE__ */ m(F, { children: [
|
|
537
538
|
/* @__PURE__ */ m(
|
|
538
|
-
|
|
539
|
+
Jt,
|
|
539
540
|
{
|
|
540
541
|
ref: s,
|
|
541
542
|
onClick: z,
|
|
@@ -551,7 +552,7 @@ function Q({ title: e, value: o, icon: r, prepend: n, options: a, onChange: l, i
|
|
|
551
552
|
]
|
|
552
553
|
}
|
|
553
554
|
),
|
|
554
|
-
/* @__PURE__ */ t(Ze, { open: f, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: C, placement: _ }) => /* @__PURE__ */ t(et, { ...C, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(tt, { children: /* @__PURE__ */ t(rt, { onClickAway: x, children: /* @__PURE__ */ m(
|
|
555
|
+
/* @__PURE__ */ t(Ze, { open: f, anchorEl: s.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: C, placement: _ }) => /* @__PURE__ */ t(et, { ...C, sx: { transformOrigin: _ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(tt, { children: /* @__PURE__ */ t(rt, { onClickAway: x, children: /* @__PURE__ */ m(Kt, { autoFocusItem: f, onMouseEnter: z, onMouseLeave: x, children: [
|
|
555
556
|
n,
|
|
556
557
|
a.map((A) => d ? d(A) : /* @__PURE__ */ t(
|
|
557
558
|
ot,
|
|
@@ -585,7 +586,7 @@ Q.defaultProps = {
|
|
|
585
586
|
onChange: () => {
|
|
586
587
|
}
|
|
587
588
|
};
|
|
588
|
-
const
|
|
589
|
+
const Jt = D(le)`
|
|
589
590
|
border: 1px solid #f0f0f0;
|
|
590
591
|
padding: 6px 8px 6px 12px;
|
|
591
592
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -616,7 +617,7 @@ const Yt = D(le)`
|
|
|
616
617
|
margin-right: 3px;
|
|
617
618
|
}
|
|
618
619
|
}
|
|
619
|
-
`,
|
|
620
|
+
`, Kt = D(Je)`
|
|
620
621
|
.my-select__option__icon {
|
|
621
622
|
color: transparent;
|
|
622
623
|
font-size: 14px;
|
|
@@ -676,9 +677,9 @@ function Ne() {
|
|
|
676
677
|
}
|
|
677
678
|
);
|
|
678
679
|
}
|
|
679
|
-
function
|
|
680
|
+
function Zt() {
|
|
680
681
|
const { selectedCategory: e, handleCategory: o, t: r, categoryOptions: n, filters: a, cleanFilter: l, loadings: d } = B(), { toggleOpen: u } = oe();
|
|
681
|
-
return /* @__PURE__ */ m(
|
|
682
|
+
return /* @__PURE__ */ m(Xt, { children: [
|
|
682
683
|
/* @__PURE__ */ t(
|
|
683
684
|
G,
|
|
684
685
|
{
|
|
@@ -788,7 +789,7 @@ function ge({
|
|
|
788
789
|
] });
|
|
789
790
|
}
|
|
790
791
|
const ye = 292;
|
|
791
|
-
function
|
|
792
|
+
function er() {
|
|
792
793
|
var f, y;
|
|
793
794
|
const { t: e } = B(), { post: o } = Oe(), r = ((y = (f = window.blocklet) == null ? void 0 : f.preferences) == null ? void 0 : y.homeBanner) || [], { data: n = [] } = re(async () => {
|
|
794
795
|
const c = await o(T.exploreDidsPath, { didList: r.map((w) => w.did) });
|
|
@@ -804,7 +805,7 @@ function Zt() {
|
|
|
804
805
|
return r.length > 0 ? /* @__PURE__ */ m(F, { children: [
|
|
805
806
|
/* @__PURE__ */ t(L, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
806
807
|
/* @__PURE__ */ t(S, { height: { xs: "auto", md: ye }, position: "relative", bgcolor: "#F0F7FF", borderRadius: 3, children: /* @__PURE__ */ t(
|
|
807
|
-
|
|
808
|
+
Rt,
|
|
808
809
|
{
|
|
809
810
|
showNav: !0,
|
|
810
811
|
autoPlay: !0,
|
|
@@ -815,8 +816,8 @@ function Zt() {
|
|
|
815
816
|
showBullets: !1,
|
|
816
817
|
showThumbnails: !1,
|
|
817
818
|
showFullscreenButton: !1,
|
|
818
|
-
renderLeftNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(
|
|
819
|
-
renderRightNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(
|
|
819
|
+
renderLeftNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(St, { sx: { ...a, left: 5 } }) }),
|
|
820
|
+
renderRightNav: (c) => /* @__PURE__ */ t(S, { onClick: c, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(Bt, { sx: { ...a, right: 5 } }) }),
|
|
820
821
|
items: r.map((c, w) => ({
|
|
821
822
|
original: c.did,
|
|
822
823
|
renderItem: () => {
|
|
@@ -833,7 +834,7 @@ function Zt() {
|
|
|
833
834
|
p: { xs: 2, md: 5 },
|
|
834
835
|
gap: { xs: 2, md: 5 },
|
|
835
836
|
children: [
|
|
836
|
-
l(c.cover ||
|
|
837
|
+
l(c.cover || rr(c.did, (x = k.screenshots) == null ? void 0 : x[0])),
|
|
837
838
|
/* @__PURE__ */ m(I, { flex: 1, height: "100%", gap: 3, children: [
|
|
838
839
|
/* @__PURE__ */ m(S, { flex: 1, children: [
|
|
839
840
|
d(c.name || k.title || c.name),
|
|
@@ -851,7 +852,7 @@ function Zt() {
|
|
|
851
852
|
) })
|
|
852
853
|
] }) : null;
|
|
853
854
|
function l(c) {
|
|
854
|
-
return /* @__PURE__ */ t(S, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", children: /* @__PURE__ */ t(
|
|
855
|
+
return /* @__PURE__ */ t(S, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", children: /* @__PURE__ */ t(vt, { src: c, alt: "", style: { width: "100%", height: "100%", objectFit: "cover" } }) });
|
|
855
856
|
}
|
|
856
857
|
function d(c) {
|
|
857
858
|
return /* @__PURE__ */ t(L, { variant: "h2", width: "100%", children: c });
|
|
@@ -882,7 +883,7 @@ function Zt() {
|
|
|
882
883
|
const { did: k, owner: x, stats: z } = c;
|
|
883
884
|
return /* @__PURE__ */ m(S, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
884
885
|
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(kt, { src: x.avatar, did: k, size: 20, variant: "circle" }), children: x.fullName }),
|
|
885
|
-
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Se, { icon:
|
|
886
|
+
/* @__PURE__ */ t(ge, { icon: /* @__PURE__ */ t(Se, { icon: Ct }), title: `${z.downloads + w}`, children: tr(z.downloads + w) })
|
|
886
887
|
] });
|
|
887
888
|
}
|
|
888
889
|
function v(c, w) {
|
|
@@ -902,15 +903,15 @@ function Zt() {
|
|
|
902
903
|
) });
|
|
903
904
|
}
|
|
904
905
|
}
|
|
905
|
-
const
|
|
906
|
-
function
|
|
906
|
+
const tr = (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`, rr = (e, o) => e && o ? `/assets/${e}/screenshots/${o}` : "";
|
|
907
|
+
function or({ title: e, blocklets: o }) {
|
|
907
908
|
const { blockletRender: r, serverVersion: n } = B();
|
|
908
909
|
return /* @__PURE__ */ m(S, { mt: 3, children: [
|
|
909
910
|
/* @__PURE__ */ t(L, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
910
911
|
/* @__PURE__ */ t(me, { container: !0, spacing: 2, children: o.map((a) => /* @__PURE__ */ t(me, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": a.did, children: /* @__PURE__ */ t(S, { padding: "1px", children: r({ blocklet: a, blocklets: o, serverVersion: n }) }) }, a.did)) })
|
|
911
912
|
] });
|
|
912
913
|
}
|
|
913
|
-
function
|
|
914
|
+
function nr() {
|
|
914
915
|
const { get: e } = Oe(), { t: o } = B(), {
|
|
915
916
|
data: r = [],
|
|
916
917
|
error: n,
|
|
@@ -920,13 +921,13 @@ function or() {
|
|
|
920
921
|
return Array.isArray(l) ? l : [];
|
|
921
922
|
});
|
|
922
923
|
return n ? /* @__PURE__ */ t(Z, { error: new Error(`Failed to fetch blocklets from ${T.explorePath}`) }) : a ? /* @__PURE__ */ t(qe, { mt: 15 }) : /* @__PURE__ */ m(F, { children: [
|
|
923
|
-
/* @__PURE__ */ t(
|
|
924
|
+
/* @__PURE__ */ t(er, {}),
|
|
924
925
|
r.map(
|
|
925
|
-
(l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(
|
|
926
|
+
(l) => l.blocklets.length > 0 ? /* @__PURE__ */ t(or, { title: o(`explore.${l.type}`), blocklets: l.blocklets }, l.type) : null
|
|
926
927
|
)
|
|
927
928
|
] });
|
|
928
929
|
}
|
|
929
|
-
function
|
|
930
|
+
function lr() {
|
|
930
931
|
var u;
|
|
931
932
|
const { filters: e, handleSort: o, handlePrice: r, t: n, getCategoryLocale: a } = B(), l = Ae(n), d = ((u = l.find((s) => s.value === e.sortBy)) == null ? void 0 : u.name) || n("sort.sort");
|
|
932
933
|
return /* @__PURE__ */ m(
|
|
@@ -1027,7 +1028,7 @@ function je({ blocklets: e, ...o }) {
|
|
|
1027
1028
|
hasNextPage: f,
|
|
1028
1029
|
loadMore: y,
|
|
1029
1030
|
endpoint: c
|
|
1030
|
-
} = B(), w = !!l || !!u.price, [k] =
|
|
1031
|
+
} = B(), w = !!l || !!u.price, [k] = Tt({
|
|
1031
1032
|
loading: a.fetchBlockletsLoading || a.loadingMore,
|
|
1032
1033
|
hasNextPage: f,
|
|
1033
1034
|
onLoadMore: y
|
|
@@ -1087,7 +1088,7 @@ function je({ blocklets: e, ...o }) {
|
|
|
1087
1088
|
je.propTypes = {
|
|
1088
1089
|
blocklets: i.array.isRequired
|
|
1089
1090
|
};
|
|
1090
|
-
const W = D(
|
|
1091
|
+
const W = D(Pt)`
|
|
1091
1092
|
text-align: center;
|
|
1092
1093
|
margin-top: 100px;
|
|
1093
1094
|
.primary {
|
|
@@ -1113,7 +1114,7 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1113
1114
|
}, z = ({ prevState: b, state: h }) => {
|
|
1114
1115
|
b.query !== h.query && (h.query || (v(), k()));
|
|
1115
1116
|
};
|
|
1116
|
-
return
|
|
1117
|
+
return zt(
|
|
1117
1118
|
"ctrl + k, command + k",
|
|
1118
1119
|
(b) => (b.stopPropagation(), b.preventDefault(), k(), !1),
|
|
1119
1120
|
{ enableOnTags: ["INPUT"] }
|
|
@@ -1122,13 +1123,13 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1122
1123
|
}, [s]), j(() => {
|
|
1123
1124
|
if (!r.current)
|
|
1124
1125
|
return;
|
|
1125
|
-
const b =
|
|
1126
|
+
const b = $t({
|
|
1126
1127
|
container: r.current,
|
|
1127
1128
|
renderer: { createElement: dt, Fragment: ut, render: () => {
|
|
1128
1129
|
} },
|
|
1129
1130
|
render({ children: h }, C) {
|
|
1130
1131
|
var _;
|
|
1131
|
-
(!n.current || a.current !== C) && (a.current = C, (_ = n.current) == null || _.unmount(), n.current =
|
|
1132
|
+
(!n.current || a.current !== C) && (a.current = C, (_ = n.current) == null || _.unmount(), n.current = Lt(C)), n.current.render(o(h));
|
|
1132
1133
|
},
|
|
1133
1134
|
autoFocus: !0,
|
|
1134
1135
|
openOnFocus: !1,
|
|
@@ -1165,7 +1166,7 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1165
1166
|
pageSize: 10,
|
|
1166
1167
|
keyword: h
|
|
1167
1168
|
};
|
|
1168
|
-
return
|
|
1169
|
+
return Wt([
|
|
1169
1170
|
{
|
|
1170
1171
|
sourceId: "blocklets",
|
|
1171
1172
|
getItems() {
|
|
@@ -1179,7 +1180,7 @@ function ae({ onSelect: e, wrapChildren: o }) {
|
|
|
1179
1180
|
onSelect({ event: $, item: R }) {
|
|
1180
1181
|
return R.type === "more-result" ? (_.setIsOpen(!1), v(h)) : $.type === "keydown" ? v(R.title) : e({
|
|
1181
1182
|
blocklet: R,
|
|
1182
|
-
detailUrl:
|
|
1183
|
+
detailUrl: _t(s, "/blocklets", R.did),
|
|
1183
1184
|
storeUrl: s
|
|
1184
1185
|
});
|
|
1185
1186
|
},
|
|
@@ -1237,18 +1238,18 @@ function ie({ placeholder: e, ...o }) {
|
|
|
1237
1238
|
return j(() => {
|
|
1238
1239
|
l(r.keyword || "");
|
|
1239
1240
|
}, [r.keyword]), /* @__PURE__ */ t(
|
|
1240
|
-
|
|
1241
|
+
ar,
|
|
1241
1242
|
{
|
|
1242
1243
|
inputProps: {
|
|
1243
1244
|
"data-cy": "search-blocklet"
|
|
1244
1245
|
},
|
|
1245
|
-
startAdornment: /* @__PURE__ */ t(he, { position: "start", children: /* @__PURE__ */ t(
|
|
1246
|
+
startAdornment: /* @__PURE__ */ t(he, { position: "start", children: /* @__PURE__ */ t(ir, {}) }),
|
|
1246
1247
|
onChange: u,
|
|
1247
1248
|
placeholder: e,
|
|
1248
1249
|
value: a,
|
|
1249
1250
|
title: e,
|
|
1250
1251
|
"data-cy": "search",
|
|
1251
|
-
endAdornment: a && /* @__PURE__ */ t(he, { position: "end", children: /* @__PURE__ */ t(
|
|
1252
|
+
endAdornment: a && /* @__PURE__ */ t(he, { position: "end", children: /* @__PURE__ */ t(sr, { "data-cy": "search-delete", onClick: s }) }),
|
|
1252
1253
|
...o
|
|
1253
1254
|
}
|
|
1254
1255
|
);
|
|
@@ -1259,7 +1260,7 @@ ie.propTypes = {
|
|
|
1259
1260
|
ie.defaultProps = {
|
|
1260
1261
|
placeholder: "Type to search..."
|
|
1261
1262
|
};
|
|
1262
|
-
const
|
|
1263
|
+
const ar = D(lt)`
|
|
1263
1264
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1264
1265
|
font-size: 14px;
|
|
1265
1266
|
border-radius: 6px;
|
|
@@ -1276,18 +1277,18 @@ const lr = D(lt)`
|
|
|
1276
1277
|
color: transparent;
|
|
1277
1278
|
}
|
|
1278
1279
|
}
|
|
1279
|
-
`,
|
|
1280
|
+
`, ir = D(At)`
|
|
1280
1281
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1281
1282
|
font-size: 28px;
|
|
1282
1283
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1283
1284
|
font-size: 24px;
|
|
1284
1285
|
}
|
|
1285
|
-
`,
|
|
1286
|
+
`, sr = D(Be)`
|
|
1286
1287
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1287
1288
|
font-size: 16px;
|
|
1288
1289
|
cursor: pointer;
|
|
1289
1290
|
`;
|
|
1290
|
-
function
|
|
1291
|
+
function cr() {
|
|
1291
1292
|
const { filters: e, handleSearchSelect: o, t: r, wrapChildren: n, baseSearch: a } = B(), { toggleOpen: l } = oe(), d = !!e.keyword;
|
|
1292
1293
|
return /* @__PURE__ */ m(
|
|
1293
1294
|
I,
|
|
@@ -1304,7 +1305,7 @@ function sr() {
|
|
|
1304
1305
|
/* @__PURE__ */ t(
|
|
1305
1306
|
G,
|
|
1306
1307
|
{
|
|
1307
|
-
xs: !d && /* @__PURE__ */ t(Me, { onClick: () => l(!0), children: /* @__PURE__ */ t(
|
|
1308
|
+
xs: !d && /* @__PURE__ */ t(Me, { onClick: () => l(!0), children: /* @__PURE__ */ t(It, {}) }),
|
|
1308
1309
|
md: /* @__PURE__ */ t(L, { variant: "h1", children: r("common.title") })
|
|
1309
1310
|
}
|
|
1310
1311
|
),
|
|
@@ -1325,19 +1326,19 @@ function sr() {
|
|
|
1325
1326
|
}
|
|
1326
1327
|
);
|
|
1327
1328
|
}
|
|
1328
|
-
function
|
|
1329
|
+
function dr() {
|
|
1329
1330
|
const { blockletList: e, total: o, filters: r, t: n } = B(), a = r.category || r.keyword || r.price;
|
|
1330
|
-
return /* @__PURE__ */ t(
|
|
1331
|
-
/* @__PURE__ */ t(
|
|
1331
|
+
return /* @__PURE__ */ t(Ft, { children: /* @__PURE__ */ m(at, { FallbackComponent: Z, children: [
|
|
1332
|
+
/* @__PURE__ */ t(cr, {}),
|
|
1332
1333
|
/* @__PURE__ */ m(S, { display: "flex", height: "100%", children: [
|
|
1333
|
-
/* @__PURE__ */ t(
|
|
1334
|
+
/* @__PURE__ */ t(Zt, {}),
|
|
1334
1335
|
/* @__PURE__ */ t(I, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: a ? /* @__PURE__ */ m(F, { children: [
|
|
1335
1336
|
r.keyword ? /* @__PURE__ */ m(F, { children: [
|
|
1336
1337
|
/* @__PURE__ */ t(G, { xs: /* @__PURE__ */ t(Ne, {}), md: null }),
|
|
1337
1338
|
l()
|
|
1338
|
-
] }) : /* @__PURE__ */ t(
|
|
1339
|
+
] }) : /* @__PURE__ */ t(lr, {}),
|
|
1339
1340
|
/* @__PURE__ */ t(je, { blocklets: e, height: "100%" })
|
|
1340
|
-
] }) : /* @__PURE__ */ t(
|
|
1341
|
+
] }) : /* @__PURE__ */ t(nr, {}) })
|
|
1341
1342
|
] })
|
|
1342
1343
|
] }) });
|
|
1343
1344
|
function l() {
|
|
@@ -1348,7 +1349,7 @@ function cr() {
|
|
|
1348
1349
|
}
|
|
1349
1350
|
}
|
|
1350
1351
|
function Ve(e) {
|
|
1351
|
-
const o = xe(), r =
|
|
1352
|
+
const o = xe(), r = jt(o.palette.primary.main), n = {
|
|
1352
1353
|
autocomplete: ke`
|
|
1353
1354
|
:root {
|
|
1354
1355
|
--aa-detached-media-query: (max-width: ${o.breakpoints.values.md}px) !important;
|
|
@@ -1389,7 +1390,7 @@ function Ve(e) {
|
|
|
1389
1390
|
};
|
|
1390
1391
|
return /* @__PURE__ */ m(ne, { ...e, children: [
|
|
1391
1392
|
/* @__PURE__ */ t(we, { styles: n.autocomplete }),
|
|
1392
|
-
/* @__PURE__ */ t(
|
|
1393
|
+
/* @__PURE__ */ t(dr, {})
|
|
1393
1394
|
] });
|
|
1394
1395
|
}
|
|
1395
1396
|
Ve.propTypes = ze;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/list",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Common ux components of blocklet",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@algolia/autocomplete-js": "^1.17.0",
|
|
54
54
|
"@algolia/autocomplete-theme-classic": "^1.17.0",
|
|
55
|
-
"@blocklet/util": "0.14.
|
|
55
|
+
"@blocklet/util": "0.14.3",
|
|
56
56
|
"@emotion/react": "^11.10.0",
|
|
57
57
|
"@emotion/styled": "^11.10.0",
|
|
58
58
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"prettier": "^3.3.2",
|
|
90
90
|
"vite": "^5.2.12"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "d88e1656b0a882d78280e739db4f41958fa2af14"
|
|
93
93
|
}
|