@blocklet/list 0.14.14 → 0.14.16

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.
Files changed (2) hide show
  1. package/lib/index.es.js +100 -106
  2. package/package.json +7 -7
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 De from "@mui/material/MenuList";
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 Ne from "@arcblock/ux/lib/Avatar";
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/icons-material/Verified";
53
- import Tt from "@mui/material/Autocomplete";
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 At from "@mui/material/TextField";
57
- import { useHotkeys as Ft } from "react-hotkeys-hook";
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 Et from "@arcblock/ux/lib/Empty";
60
- import Lt from "json-stable-stringify";
61
- import Ot from "@mui/icons-material/Menu";
62
- import { Card as _t, Box as le, Skeleton as O } from "@mui/material";
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 zt({ children: e }) {
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
- }, Mt = (e) => ee(
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 Dt(e, r) {
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
- }, Wt = (e) => [
167
+ }, Dt = (e) => [
169
168
  { name: e("blocklet.free"), value: "free" },
170
169
  { name: e("blocklet.payment"), value: "payment" }
171
- ], $t = (e = [], r = "en") => e.map((o) => ({ name: o.locales[r] || o.locales.en, value: o._id })), jt = (e, r) => (
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
- ), Ht = () => window.innerWidth <= 600, Ut = {
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
- }, Vt = {
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(Ut),
278
- zh: ve(Vt)
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
- }, Gt = (e) => (r, o) => {
281
+ }, Vt = (e) => (r, o) => {
283
282
  const n = ie[e] ? ie[e][r] : ie.en[r];
284
- return jt(n, o) || r;
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: qt, Consumer: Po } = Ge;
338
- function Kt(e) {
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 = Dt(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: u }), [M, V] = E(""), {
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
- } = Mt(F), $ = H(() => {
367
- const R = nt(G, [(N) => N.name], ["asc"]), _ = R.findIndex((N) => N.name === "All" || N.locales.en === "All");
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(Gt(r), [r]), s = H(() => $t($, r), [$, r]), b = Wt(q), D = {
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: {
@@ -399,9 +398,8 @@ function Kt(e) {
399
398
  tagFilters: S,
400
399
  onFilterChange: i,
401
400
  getCategoryLocale: (R) => {
402
- if (!R)
403
- return null;
404
- const _ = G.find((N) => N._id === R || N.locales.en === "All");
401
+ if (!R) return null;
402
+ const _ = G.find((D) => D._id === R || D.locales.en === "All");
405
403
  return _ ? _.locales[r] || _.locales.en : null;
406
404
  },
407
405
  get developerName() {
@@ -411,7 +409,7 @@ function Kt(e) {
411
409
  };
412
410
  return U(() => {
413
411
  setTimeout(Q, m || 0);
414
- }, [C, Q, m]), /* @__PURE__ */ t(qt, { value: D, children: B });
412
+ }, [C, Q, m]), /* @__PURE__ */ t(Gt, { value: N, children: B });
415
413
  }
416
414
  function I() {
417
415
  const e = Ee(Ge);
@@ -464,7 +462,7 @@ function we({
464
462
  let m = e;
465
463
  return l || (m = Y(r, m), p) || (m = Y(o, m), d) || (m = Y(n, m), g) ? m : Y(i, m);
466
464
  }
467
- function Xt({ children: e }) {
465
+ function Kt({ children: e }) {
468
466
  const { open: r, toggleOpen: o } = ye();
469
467
  return /* @__PURE__ */ t(
470
468
  we,
@@ -474,7 +472,7 @@ function Xt({ children: e }) {
474
472
  }
475
473
  );
476
474
  }
477
- const Qt = rt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
475
+ const Xt = rt(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
478
476
  te,
479
477
  {
480
478
  ref: n,
@@ -504,7 +502,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
504
502
  }
505
503
  return /* @__PURE__ */ h(W, { children: [
506
504
  /* @__PURE__ */ h(
507
- Yt,
505
+ Qt,
508
506
  {
509
507
  ref: a,
510
508
  onClick: k,
@@ -524,7 +522,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
524
522
  {
525
523
  ...u,
526
524
  style: { transformOrigin: C === "bottom" ? "center top" : "center bottom" },
527
- children: /* @__PURE__ */ t(xt, { children: /* @__PURE__ */ t(ft, { onClickAway: f, children: /* @__PURE__ */ t(Zt, { autoFocusItem: l, onMouseEnter: k, onMouseLeave: f, children: r.map((x) => /* @__PURE__ */ h(Me, { onClick: () => S(x), children: [
525
+ 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
526
  /* @__PURE__ */ t(
529
527
  pt,
530
528
  {
@@ -537,7 +535,7 @@ function Ke({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
537
535
  ) })
538
536
  ] });
539
537
  }
540
- const Yt = K(Qt)`
538
+ const Qt = K(Xt)`
541
539
  border: 1px solid #f0f0f0;
542
540
  padding: 6px 8px 6px 12px;
543
541
  font-weight: ${(e) => e.theme.typography.fontWeightRegular};
@@ -565,7 +563,7 @@ const Yt = K(Qt)`
565
563
  margin-right: 3px;
566
564
  }
567
565
  }
568
- `, Zt = K(De)`
566
+ `, Yt = K(Ne)`
569
567
  .my-select__option__icon {
570
568
  color: transparent;
571
569
  font-size: 14px;
@@ -621,13 +619,13 @@ function Xe() {
621
619
  }
622
620
  );
623
621
  }
624
- function Jt() {
622
+ function Zt() {
625
623
  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
624
  U(() => {
627
625
  g(!1);
628
626
  }, [Object.values(l).join("")]);
629
627
  const m = Nt(c, a.showSearch, l.keyword);
630
- return a.showCategory ? /* @__PURE__ */ h(Xt, { children: [
628
+ return a.showCategory ? /* @__PURE__ */ h(Kt, { children: [
631
629
  /* @__PURE__ */ t(
632
630
  we,
633
631
  {
@@ -716,7 +714,7 @@ function be() {
716
714
  const Qe = ot(function(r) {
717
715
  return /* @__PURE__ */ t(y, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(re, {}) });
718
716
  });
719
- function er({ showSkeleton: e, ...r }) {
717
+ function Jt({ showSkeleton: e, ...r }) {
720
718
  return e ? /* @__PURE__ */ t(z, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(It, { ...r });
721
719
  }
722
720
  function Be({
@@ -739,8 +737,8 @@ function Be({
739
737
  )
740
738
  ] });
741
739
  }
742
- const ae = 292, tr = 210, rr = 338;
743
- function or() {
740
+ const ae = 292, er = 210, tr = 338;
741
+ function rr() {
744
742
  var B, v;
745
743
  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
744
  data: c = [],
@@ -773,7 +771,7 @@ function or() {
773
771
  borderRadius: 3,
774
772
  overflow: "hidden",
775
773
  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: tr, width: rr }),
774
+ /* @__PURE__ */ t(z, { variant: "rounded", height: er, width: tr }),
777
775
  /* @__PURE__ */ h(y, { flex: 1, height: "100%", children: [
778
776
  /* @__PURE__ */ t(z, { variant: "text", height: 50, width: 100 }),
779
777
  /* @__PURE__ */ t(z, { variant: "text", height: 40, width: "100%" }),
@@ -802,7 +800,7 @@ function or() {
802
800
  original: u.did,
803
801
  renderItem: () => {
804
802
  var L;
805
- const x = c[C] || {}, A = u.cover || lr(u.did, (L = x.screenshots) == null ? void 0 : L[0]), F = He(A, { h: 400, w: 700 });
803
+ 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
804
  return /* @__PURE__ */ h(
807
805
  P,
808
806
  {
@@ -852,7 +850,7 @@ function or() {
852
850
  ] }) : null;
853
851
  function g(u) {
854
852
  return /* @__PURE__ */ t(y, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
855
- er,
853
+ Jt,
856
854
  {
857
855
  showSkeleton: p,
858
856
  src: u,
@@ -893,8 +891,8 @@ function or() {
893
891
  function k(u, C = 0) {
894
892
  const { did: x, owner: A, stats: F } = u;
895
893
  return /* @__PURE__ */ h(y, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
896
- /* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ne, { src: A.avatar, did: x, size: 20, variant: "circle" }), children: A.fullName }),
897
- /* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ae, { icon: kt }), title: `${F.downloads + C}`, children: nr(F.downloads + C) })
894
+ /* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(De, { src: A.avatar, did: x, size: 20, variant: "circle" }), children: A.fullName }),
895
+ /* @__PURE__ */ t(Be, { icon: /* @__PURE__ */ t(Ae, { icon: kt }), title: `${F.downloads + C}`, children: or(F.downloads + C) })
898
896
  ] });
899
897
  }
900
898
  function S(u) {
@@ -917,15 +915,15 @@ function or() {
917
915
  );
918
916
  }
919
917
  }
920
- const nr = (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`, lr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
921
- function ir({ title: e, blocklets: r }) {
918
+ 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}` : "";
919
+ function lr({ title: e, blocklets: r }) {
922
920
  const { blockletRender: o, serverVersion: n } = I();
923
921
  return /* @__PURE__ */ h(y, { mt: 3, children: [
924
922
  /* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
925
923
  /* @__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
924
  ] });
927
925
  }
928
- function ar() {
926
+ function ir() {
929
927
  const { get: e } = be(), { t: r } = I(), {
930
928
  data: o = [],
931
929
  error: n,
@@ -935,14 +933,14 @@ function ar() {
935
933
  return Array.isArray(a) ? a : [];
936
934
  });
937
935
  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(or, {}),
936
+ /* @__PURE__ */ t(rr, {}),
939
937
  o.map(
940
- (a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(ir, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
938
+ (a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(lr, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
941
939
  )
942
940
  ] });
943
941
  }
944
942
  const se = "__FREE_TEXT__", Re = "__NO_RESULT__", ce = 40;
945
- function sr({
943
+ function ar({
946
944
  endpoint: e,
947
945
  t: r,
948
946
  locale: o,
@@ -969,18 +967,18 @@ function sr({
969
967
  );
970
968
  U(() => {
971
969
  u(!0), A(n.keyword), f(n.keyword || "");
972
- }, [n.keyword, A]), Ft(
970
+ }, [n.keyword, A]), At(
973
971
  "ctrl + k, command + k",
974
972
  (s) => {
975
- var b, D;
976
- return s.stopPropagation(), s.preventDefault(), (D = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || D.focus(), !1;
973
+ var b, N;
974
+ return s.stopPropagation(), s.preventDefault(), (N = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || N.focus(), !1;
977
975
  },
978
976
  { enableOnTags: ["INPUT"] }
979
977
  );
980
978
  const F = Oe((s) => A(s), { wait: 300 }), L = { name: se, title: m, did: "" };
981
979
  let M = [];
982
980
  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(Pt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
981
+ /* @__PURE__ */ h(Tt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
984
982
  /* @__PURE__ */ h(y, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
985
983
  /* @__PURE__ */ t(
986
984
  We,
@@ -1020,7 +1018,7 @@ function sr({
1020
1018
  }
1021
1019
  )
1022
1020
  ] }),
1023
- /* @__PURE__ */ t(De, { sx: { p: 0.5 }, children: M.map((s) => X(s)) })
1021
+ /* @__PURE__ */ t(Ne, { sx: { p: 0.5 }, children: M.map((s) => X(s)) })
1024
1022
  ] }),
1025
1023
  /* @__PURE__ */ t(
1026
1024
  J,
@@ -1030,7 +1028,7 @@ function sr({
1030
1028
  }
1031
1029
  ),
1032
1030
  /* @__PURE__ */ t(
1033
- Tt,
1031
+ Rt,
1034
1032
  {
1035
1033
  ref: l,
1036
1034
  open: !!m && d,
@@ -1059,7 +1057,7 @@ function sr({
1059
1057
  }
1060
1058
  },
1061
1059
  renderInput: (s) => /* @__PURE__ */ t(
1062
- At,
1060
+ Pt,
1063
1061
  {
1064
1062
  ...s,
1065
1063
  InputProps: {
@@ -1107,7 +1105,7 @@ function sr({
1107
1105
  s != null && s.did ? (S(!1), p.current = !0, f(""), a(s)) : s.name === se && (S(!1), i(m));
1108
1106
  }
1109
1107
  function X(s) {
1110
- var b, D;
1108
+ var b, N;
1111
1109
  return /* @__PURE__ */ h(
1112
1110
  Me,
1113
1111
  {
@@ -1116,12 +1114,8 @@ function sr({
1116
1114
  children: [
1117
1115
  Q(s),
1118
1116
  /* @__PURE__ */ h(w, { variant: "body1", children: [
1119
- /* @__PURE__ */ h(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: [
1120
- s.title,
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"]) || "" })
1117
+ /* @__PURE__ */ t(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: s.title }),
1118
+ /* @__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
1119
  ] })
1126
1120
  ]
1127
1121
  },
@@ -1145,7 +1139,7 @@ function sr({
1145
1139
  }
1146
1140
  );
1147
1141
  let b = "";
1148
- return s.logo && (b = ke(e, "assets", s.did, He(s.logo, ce, s.version))), /* @__PURE__ */ t(Ne, { src: b, size: ce, style: { borderRadius: "8px", overflow: "hidden" } });
1142
+ 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
1143
  }
1150
1144
  function $(s = !0) {
1151
1145
  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 +1148,7 @@ function sr({
1154
1148
  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
1149
  }
1156
1150
  }
1157
- function cr({ placeholder: e = "Type to search...", ...r }) {
1151
+ function sr({ placeholder: e = "Type to search...", ...r }) {
1158
1152
  const { search: o } = I(), { filters: n, handleKeyword: i } = o, [a, c] = E(n.keyword || ""), l = Oe(i, { wait: 300 }), p = (g) => {
1159
1153
  const { value: m } = g.target;
1160
1154
  c(m), l.run(m);
@@ -1164,23 +1158,23 @@ function cr({ placeholder: e = "Type to search...", ...r }) {
1164
1158
  return U(() => {
1165
1159
  c(n.keyword || "");
1166
1160
  }, [n.keyword]), /* @__PURE__ */ t(
1167
- dr,
1161
+ cr,
1168
1162
  {
1169
1163
  inputProps: {
1170
1164
  "data-cy": "search-blocklet"
1171
1165
  },
1172
- startAdornment: /* @__PURE__ */ t(Ie, { position: "start", children: /* @__PURE__ */ t(ur, {}) }),
1166
+ startAdornment: /* @__PURE__ */ t(Ie, { position: "start", children: /* @__PURE__ */ t(dr, {}) }),
1173
1167
  onChange: p,
1174
1168
  placeholder: e,
1175
1169
  value: a,
1176
1170
  title: e,
1177
1171
  "data-cy": "search",
1178
- endAdornment: a && /* @__PURE__ */ t(Ie, { position: "end", children: /* @__PURE__ */ t(hr, { "data-cy": "search-delete", onClick: d }) }),
1172
+ endAdornment: a && /* @__PURE__ */ t(Ie, { position: "end", children: /* @__PURE__ */ t(ur, { "data-cy": "search-delete", onClick: d }) }),
1179
1173
  ...r
1180
1174
  }
1181
1175
  );
1182
1176
  }
1183
- const dr = K(We)`
1177
+ const cr = K(We)`
1184
1178
  background-color: ${(e) => e.theme.palette.grey[50]};
1185
1179
  font-size: 14px;
1186
1180
  border-radius: 6px;
@@ -1197,18 +1191,18 @@ const dr = K(We)`
1197
1191
  color: transparent;
1198
1192
  }
1199
1193
  }
1200
- `, ur = K(J)`
1194
+ `, dr = K(J)`
1201
1195
  color: ${(e) => e.theme.palette.grey[500]};
1202
1196
  font-size: 28px;
1203
1197
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
1204
1198
  font-size: 24px;
1205
1199
  }
1206
- `, hr = K(ge)`
1200
+ `, ur = K(ge)`
1207
1201
  color: ${(e) => e.theme.palette.grey[500]};
1208
1202
  font-size: 16px;
1209
1203
  cursor: pointer;
1210
1204
  `;
1211
- function pr() {
1205
+ function hr() {
1212
1206
  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
1207
  return /* @__PURE__ */ h(
1214
1208
  P,
@@ -1234,8 +1228,8 @@ function pr() {
1234
1228
  justifyContent: { xs: "space-between", md: "flex-end" },
1235
1229
  gap: 2,
1236
1230
  children: [
1237
- l.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: p ? /* @__PURE__ */ t(cr, {}) : /* @__PURE__ */ t(
1238
- sr,
1231
+ l.showSearch ? /* @__PURE__ */ t(y, { flex: 1, children: p ? /* @__PURE__ */ t(sr, {}) : /* @__PURE__ */ t(
1232
+ ar,
1239
1233
  {
1240
1234
  locale: n,
1241
1235
  endpoint: o,
@@ -1323,7 +1317,7 @@ function Te({
1323
1317
  }
1324
1318
  function Z({ children: e }) {
1325
1319
  return /* @__PURE__ */ h(y, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
1326
- /* @__PURE__ */ t(Et, {}),
1320
+ /* @__PURE__ */ t(Ft, {}),
1327
1321
  e
1328
1322
  ] });
1329
1323
  }
@@ -1354,7 +1348,7 @@ function ue({
1354
1348
  ] })
1355
1349
  ] });
1356
1350
  }
1357
- function mr() {
1351
+ function pr() {
1358
1352
  const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r, a = !!n || !!i.price;
1359
1353
  if (i.keyword && a)
1360
1354
  return /* @__PURE__ */ h(Z, { children: [
@@ -1396,7 +1390,7 @@ function mr() {
1396
1390
  }
1397
1391
  return /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(Pe, {}) });
1398
1392
  }
1399
- const fr = (e, r, o, n) => lt(
1393
+ const mr = (e, r, o, n) => lt(
1400
1394
  async (i) => {
1401
1395
  i || (o.currentPage = o.defaultCurrentPage);
1402
1396
  const { currentPage: a, pageSize: c } = o, l = {
@@ -1412,17 +1406,17 @@ const fr = (e, r, o, n) => lt(
1412
1406
  },
1413
1407
  {
1414
1408
  isNoMore: (i) => i ? i.page * i.pageSize >= i.total : !1,
1415
- reloadDeps: [e, Lt(r)],
1409
+ reloadDeps: [e, Et(r)],
1416
1410
  onError: n
1417
1411
  }
1418
1412
  );
1419
- function gr() {
1413
+ function fr() {
1420
1414
  var m;
1421
1415
  const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: a } = r, c = it({
1422
1416
  currentPage: T.currentPage,
1423
- pageSize: Ht() ? T.mobilePageSize : T.pageSize,
1417
+ pageSize: jt() ? T.mobilePageSize : T.pageSize,
1424
1418
  defaultCurrentPage: T.defaultCurrentPage
1425
- }), [l, p] = E(null), d = fr(e, a, c, p), g = H(
1419
+ }), [l, p] = E(null), d = mr(e, a, c, p), g = H(
1426
1420
  () => {
1427
1421
  var f, k;
1428
1422
  return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
@@ -1448,8 +1442,8 @@ function gr() {
1448
1442
  }
1449
1443
  };
1450
1444
  }
1451
- function xr() {
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 } = gr(), [B] = Bt({
1445
+ function gr() {
1446
+ 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
1447
  loading: f.fetchBlockletsLoading || f.loadingMore,
1454
1448
  hasNextPage: k,
1455
1449
  onLoadMore: m
@@ -1460,7 +1454,7 @@ function xr() {
1460
1454
  }
1461
1455
  const v = l && c.showSearch || !p.keyword;
1462
1456
  return /* @__PURE__ */ h(W, { children: [
1463
- v ? /* @__PURE__ */ t(pr, {}) : /* @__PURE__ */ h(W, { children: [
1457
+ v ? /* @__PURE__ */ t(hr, {}) : /* @__PURE__ */ h(W, { children: [
1464
1458
  /* @__PURE__ */ t(we, { xs: /* @__PURE__ */ t(Xe, {}), md: null }),
1465
1459
  C()
1466
1460
  ] }),
@@ -1478,7 +1472,7 @@ function xr() {
1478
1472
  gap: 2,
1479
1473
  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
1474
  }
1481
- ) : /* @__PURE__ */ t(mr, {});
1475
+ ) : /* @__PURE__ */ t(pr, {});
1482
1476
  }
1483
1477
  function C() {
1484
1478
  return /* @__PURE__ */ h(
@@ -1498,7 +1492,7 @@ function xr() {
1498
1492
  );
1499
1493
  }
1500
1494
  }
1501
- function yr() {
1495
+ function xr() {
1502
1496
  const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = ye();
1503
1497
  return /* @__PURE__ */ h(
1504
1498
  w,
@@ -1510,24 +1504,24 @@ function yr() {
1510
1504
  py: 2,
1511
1505
  fontWeight: "fontWeightMedium",
1512
1506
  children: [
1513
- /* @__PURE__ */ t(qe, { onClick: () => n(!0), children: /* @__PURE__ */ t(Ot, {}) }),
1507
+ /* @__PURE__ */ t(qe, { onClick: () => n(!0), children: /* @__PURE__ */ t(Lt, {}) }),
1514
1508
  o(r) || e("common.category")
1515
1509
  ]
1516
1510
  }
1517
1511
  );
1518
1512
  }
1519
- function wr() {
1513
+ function yr() {
1520
1514
  const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
1521
- return /* @__PURE__ */ t(zt, { children: /* @__PURE__ */ h(et, { FallbackComponent: fe, children: [
1522
- /* @__PURE__ */ t(yr, {}),
1515
+ return /* @__PURE__ */ t(_t, { children: /* @__PURE__ */ h(et, { FallbackComponent: fe, children: [
1516
+ /* @__PURE__ */ t(xr, {}),
1523
1517
  /* @__PURE__ */ h(y, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
1524
- /* @__PURE__ */ t(Jt, {}),
1525
- /* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(ar, {}) : /* @__PURE__ */ t(xr, {}) })
1518
+ /* @__PURE__ */ t(Zt, {}),
1519
+ /* @__PURE__ */ t(P, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(ir, {}) : /* @__PURE__ */ t(gr, {}) })
1526
1520
  ] })
1527
1521
  ] }) });
1528
1522
  }
1529
- function Ao(e) {
1530
- return /* @__PURE__ */ h(_t, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
1523
+ function To(e) {
1524
+ return /* @__PURE__ */ h(Ot, { variant: "outlined", ...e, sx: { maxWidth: 400, borderRadius: "8px", p: { xs: 2, md: 3 }, ...e.sx }, children: [
1531
1525
  /* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, pb: 1, children: [
1532
1526
  /* @__PURE__ */ h(le, { display: "flex", alignItems: "center", gap: 2, flex: 1, children: [
1533
1527
  /* @__PURE__ */ t(O, { variant: "rounded", width: 48, height: 48 }),
@@ -1545,7 +1539,7 @@ function Ao(e) {
1545
1539
  ] })
1546
1540
  ] });
1547
1541
  }
1548
- function Fo(e) {
1542
+ function Po(e) {
1549
1543
  const r = me(), o = Ye(
1550
1544
  Je({
1551
1545
  ...r,
@@ -1575,12 +1569,12 @@ function Fo(e) {
1575
1569
  }
1576
1570
  })
1577
1571
  );
1578
- return /* @__PURE__ */ t(Ze, { theme: o, children: /* @__PURE__ */ t(Kt, { ...e, children: /* @__PURE__ */ t(wr, {}) }) });
1572
+ return /* @__PURE__ */ t(Ze, { theme: o, children: /* @__PURE__ */ t(qt, { ...e, children: /* @__PURE__ */ t(yr, {}) }) });
1579
1573
  }
1580
1574
  export {
1581
- sr as Autocomplete,
1582
- Ao as CardSkeleton,
1583
- er as Image,
1584
- Fo as default,
1585
- Dt as useSearch
1575
+ ar as Autocomplete,
1576
+ To as CardSkeleton,
1577
+ Jt as Image,
1578
+ Po as default,
1579
+ Mt as useSearch
1586
1580
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/list",
3
- "version": "0.14.14",
3
+ "version": "0.14.16",
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.14",
56
+ "@blocklet/util": "0.14.16",
57
57
  "@emotion/react": "^11.10.0",
58
58
  "@emotion/styled": "^11.10.0",
59
59
  "@iconify-icons/tabler": "^1.2.95",
@@ -73,7 +73,7 @@
73
73
  "ufo": "^1.5.3"
74
74
  },
75
75
  "devDependencies": {
76
- "@arcblock/eslint-config-ts": "0.3.0",
76
+ "@arcblock/eslint-config-ts": "0.3.3",
77
77
  "@babel/cli": "^7.18.10",
78
78
  "@babel/core": "^7.18.10",
79
79
  "@babel/preset-env": "^7.18.10",
@@ -82,13 +82,13 @@
82
82
  "@storybook/jest": "^0.0.10",
83
83
  "@storybook/testing-library": "^0.0.13",
84
84
  "@types/react-image-gallery": "^1.2.4",
85
- "@vitejs/plugin-react": "^4.3.0",
85
+ "@vitejs/plugin-react": "^4.3.3",
86
86
  "babel-plugin-inline-react-svg": "^2.0.1",
87
- "eslint": "^8.22.0",
87
+ "eslint": "^8.57.0",
88
88
  "eslint-config-prettier": "^9.1.0",
89
89
  "eslint-plugin-prettier": "^5.2.1",
90
90
  "prettier": "^3.3.2",
91
- "vite": "^5.2.12"
91
+ "vite": "^5.4.10"
92
92
  },
93
- "gitHead": "e9c8b5d358ca2b98fdf52260612d05f19fbfee61"
93
+ "gitHead": "1ddb444a4584f7c790b07133c0115bf5780482c7"
94
94
  }