@blocklet/list 0.12.97 → 0.12.99

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 CHANGED
@@ -1,39 +1,38 @@
1
- import { jsx as t, jsxs as h, Fragment as he } from "react/jsx-runtime";
2
- import { useTheme as fe } from "@mui/material/styles";
3
- import { Global as ge, css as ye } from "@emotion/react";
4
- import { styled as v } from "@arcblock/ux/lib/Theme";
5
- import De from "@mui/icons-material/Sort";
6
- import { Button as _e, CircularProgress as Q, MenuList as Ne, useMediaQuery as be, SvgIcon as Le, Popper as Me, Grow as Ae, Paper as Fe, ClickAwayListener as Oe, MenuItem as qe, Chip as Ee, Grid as we, Box as N, OutlinedInput as je, InputAdornment as ce, Typography as Ge, Hidden as pe } from "@mui/material";
7
- import Ue from "@mui/icons-material/Face";
8
- import { ErrorBoundary as Ke } from "react-error-boundary";
9
- import { ErrorFallback as xe } from "@arcblock/ux/lib/ErrorBoundary";
10
- import { createContext as We, useMemo as q, useState as L, useCallback as J, useEffect as F, useContext as He, forwardRef as Ve, useRef as E, createElement as Qe, Fragment as Je } from "react";
1
+ import { jsx as t, jsxs as h, Fragment as oe } from "react/jsx-runtime";
2
+ import { styled as C, useTheme as ne } from "@arcblock/ux/lib/Theme";
3
+ import { Global as xe, css as ke } from "@emotion/react";
4
+ import Me from "@mui/icons-material/Sort";
5
+ import { Button as Ae, CircularProgress as te, MenuList as Oe, useMediaQuery as Se, SvgIcon as Ee, Popper as qe, Grow as je, Paper as Ge, ClickAwayListener as Ke, MenuItem as Ue, Chip as Ce, Grid as ve, Box as I, OutlinedInput as We, InputAdornment as fe, Typography as Te, Hidden as ge, Stack as He } from "@mui/material";
6
+ import Ve from "@mui/icons-material/Face";
7
+ import { ErrorBoundary as Qe } from "react-error-boundary";
8
+ import { ErrorFallback as Pe } from "@arcblock/ux/lib/ErrorBoundary";
9
+ import { createContext as Je, useMemo as K, useState as A, useCallback as re, useEffect as q, useContext as Xe, forwardRef as Ye, useRef as U, createElement as Ze, Fragment as et } from "react";
10
+ import { useReactive as Re, useInfiniteScroll as tt, useRequest as rt, useSize as ot, useDebounceFn as nt, useMemoizedFn as lt, useCreation as at, useMount as it } from "ahooks";
11
11
  import n from "prop-types";
12
- import { useReactive as Xe, useInfiniteScroll as Ye, useRequest as Ze, useSize as et, useDebounceFn as tt } from "ahooks";
13
- import rt from "lodash/orderBy";
14
- import ot from "axios";
15
- import nt from "json-stable-stringify";
12
+ import st from "lodash/orderBy";
13
+ import ct from "axios";
14
+ import pt from "json-stable-stringify";
16
15
  import "lodash/cloneDeep";
17
- import lt from "color";
18
- import ue from "flat";
19
- import at from "@mui/icons-material/KeyboardArrowDown";
20
- import it from "lodash/isEmpty";
21
- import st from "@mui/icons-material/FilterAltOutlined";
22
- import ct from "@arcblock/ux/lib/Dialog";
23
- import pt from "@mui/material/Button";
24
- import ut from "@arcblock/ux/lib/Empty";
25
- import dt from "react-infinite-scroll-hook";
26
- import mt from "@mui/material/Box";
27
- import ke from "@mui/material/Typography";
28
- import ht from "@mui/icons-material/Search";
29
- import ft from "@mui/icons-material/Close";
30
- import { createRoot as gt } from "react-dom/client";
31
- import { autocomplete as yt } from "@algolia/autocomplete-js";
32
- import { useHotkeys as bt } from "react-hotkeys-hook";
33
- import wt from "url-join";
34
- import xt from "@arcblock/ux/lib/Switch";
16
+ import ut from "color";
17
+ import ye from "flat";
18
+ import dt from "@mui/icons-material/KeyboardArrowDown";
19
+ import mt from "lodash/isEmpty";
20
+ import ht from "@mui/icons-material/FilterAltOutlined";
21
+ import ft from "@arcblock/ux/lib/Dialog";
22
+ import gt from "@mui/material/Button";
23
+ import yt from "@arcblock/ux/lib/Empty";
24
+ import bt from "react-infinite-scroll-hook";
25
+ import wt from "@mui/material/Box";
26
+ import Be from "@mui/material/Typography";
27
+ import xt from "@mui/icons-material/Search";
28
+ import kt from "@mui/icons-material/Close";
29
+ import { createRoot as St } from "react-dom/client";
30
+ import { autocomplete as Ct } from "@algolia/autocomplete-js";
31
+ import { useHotkeys as vt } from "react-hotkeys-hook";
32
+ import { joinURL as Tt } from "ufo";
33
+ import Pt from "@arcblock/ux/lib/Switch";
35
34
  import "@algolia/autocomplete-theme-classic/dist/theme.css";
36
- const kt = (e) => [
35
+ const Rt = (e) => [
37
36
  {
38
37
  name: e("sort.popularity"),
39
38
  value: "popularity"
@@ -50,17 +49,17 @@ const kt = (e) => [
50
49
  name: e("sort.nameDescend"),
51
50
  value: "nameDesc"
52
51
  }
53
- ], St = (e) => [
52
+ ], Bt = (e) => [
54
53
  { name: e("blocklet.free"), value: "free" },
55
54
  { name: e("blocklet.payment"), value: "payment" }
56
- ], vt = (e = [], o = "en") => e.map((r) => ({ name: r.locales[o] || `Category.${o}`, value: r._id })), Ct = (e, o) => (
55
+ ], $t = (e = [], o = "en") => e.map((r) => ({ name: r.locales[o] || `Category.${o}`, value: r._id })), It = (e, o) => (
57
56
  // eslint-disable-next-line no-prototype-builtins
58
57
  e.replace(/{(\w*)}/g, (r, l) => o.hasOwnProperty(l) ? o[l] : "")
59
- ), Pt = () => window.innerWidth <= 600, Tt = (e, o) => {
58
+ ), zt = () => window.innerWidth <= 600, Dt = (e, o) => {
60
59
  const r = (e + o) / o;
61
60
  return r > 1 ? r.toFixed() : 1;
62
- }, Rt = (e) => lt(e).rgb().object();
63
- function Bt(e, o) {
61
+ }, _t = (e) => ut(e).rgb().object();
62
+ function Nt(e, o) {
64
63
  let r;
65
64
  return function(...s) {
66
65
  return r && clearTimeout(r), new Promise((c) => {
@@ -68,7 +67,7 @@ function Bt(e, o) {
68
67
  });
69
68
  };
70
69
  }
71
- const $t = Bt((e) => Promise.resolve(e), 300), zt = {
70
+ const Ft = Nt((e) => Promise.resolve(e), 300), Lt = {
72
71
  common: {
73
72
  searchStore: "Search the store",
74
73
  showResources: "Show resources",
@@ -107,7 +106,7 @@ const $t = Bt((e) => Promise.resolve(e), 300), zt = {
107
106
  autocomplete: {
108
107
  expandResult: 'Show {number} search results for "{name}" '
109
108
  }
110
- }, It = {
109
+ }, Mt = {
111
110
  common: {
112
111
  searchStore: "搜索商店内应用",
113
112
  showResources: "显示资源型应用",
@@ -146,10 +145,10 @@ const $t = Bt((e) => Promise.resolve(e), 300), zt = {
146
145
  autocomplete: {
147
146
  expandResult: "显示 {number} 条 “{name}” 的搜索结果 "
148
147
  }
149
- }, V = {
150
- en: ue(zt),
151
- zh: ue(It)
152
- }, Se = {
148
+ }, ee = {
149
+ en: ye(Lt),
150
+ zh: ye(Mt)
151
+ }, $e = {
153
152
  filters: n.shape({
154
153
  keyword: n.string,
155
154
  sortBy: n.string,
@@ -168,8 +167,11 @@ const $t = Bt((e) => Promise.resolve(e), 300), zt = {
168
167
  locale: n.oneOf(["zh", "en"]),
169
168
  baseSearch: n.bool,
170
169
  // sometimes blocklet list can be rendered only before the category is fetched
171
- fetchCategoryDelay: n.number
172
- }, ve = {
170
+ fetchCategoryDelay: n.number,
171
+ showResourcesSwitch: n.bool,
172
+ showCategory: n.bool,
173
+ tagFilters: n.array
174
+ }, Ie = {
173
175
  locale: "zh",
174
176
  filters: {},
175
177
  onFilterChange: () => {
@@ -180,7 +182,10 @@ const $t = Bt((e) => Promise.resolve(e), 300), zt = {
180
182
  wrapChildren: (e) => e,
181
183
  extraFilter: (e) => e,
182
184
  baseSearch: !1,
183
- fetchCategoryDelay: 0
185
+ fetchCategoryDelay: 0,
186
+ showResourcesSwitch: !1,
187
+ showCategory: !0,
188
+ tagFilters: []
184
189
  }, z = {
185
190
  nameAsc: "title",
186
191
  nameDesc: "title",
@@ -192,255 +197,252 @@ const $t = Bt((e) => Promise.resolve(e), 300), zt = {
192
197
  blockletsPath: "/api/v2/blocklets.json",
193
198
  categoriesPath: "/api/blocklets/categories",
194
199
  cacheSize: 100
195
- }, Ce = We({}), { Provider: Dt, Consumer: $r } = Ce;
196
- function X({
200
+ }, ze = Je({}), { Provider: At, Consumer: Nr } = ze;
201
+ function le({
197
202
  filters: e,
198
203
  children: o,
199
204
  endpoint: r,
200
205
  locale: l,
201
206
  blockletRender: s,
202
207
  onFilterChange: c,
203
- onSearchSelect: b,
204
- extraFilter: g,
208
+ onSearchSelect: x,
209
+ extraFilter: y,
205
210
  wrapChildren: p,
206
- baseSearch: y,
211
+ baseSearch: b,
207
212
  serverVersion: u,
208
- storeVersion: C,
209
- fetchCategoryDelay: B,
210
- showResourcesSwitch: P
213
+ storeVersion: v,
214
+ fetchCategoryDelay: P,
215
+ showResourcesSwitch: T,
216
+ showCategory: R,
217
+ tagFilters: B
211
218
  }) {
212
- const k = {};
213
- u && (k["x-blocklet-server-version"] = u), C && (k["x-blocklet-store-version"] = C);
214
- const T = q(() => ot.create({
219
+ const i = {};
220
+ u && (i["x-blocklet-server-version"] = u), v && (i["x-blocklet-store-version"] = v);
221
+ const m = K(() => ct.create({
215
222
  baseURL: r,
216
- headers: k
217
- }), [r]), i = q(() => ({
223
+ headers: i
224
+ }), [r]), d = K(() => ({
218
225
  sortBy: "popularity",
219
226
  sortDirection: "desc",
220
227
  ...e
221
- }), [e]), m = i.category, S = Xe({
228
+ }), [e]), k = d.category, $ = Re({
222
229
  currentPage: z.currentPage,
223
- pageSize: Pt() ? z.mobilePageSize : z.pageSize,
230
+ pageSize: zt() ? z.mobilePageSize : z.pageSize,
224
231
  defaultCurrentPage: z.defaultCurrentPage
225
- }), [w, $] = L(null), {
226
- data: f = { list: [], total: 0 },
227
- loading: D,
228
- loadMore: G,
229
- loadingMore: U
230
- } = Ye(
232
+ }), [w, _] = A(null), {
233
+ data: F = { list: [], total: 0 },
234
+ loading: X,
235
+ loadMore: Y,
236
+ loadingMore: L
237
+ } = tt(
231
238
  async (a) => {
232
- var _;
233
- const d = {
234
- ...i,
235
- sortBy: z[i.sortBy],
236
- page: Tt(((_ = a == null ? void 0 : a.list) == null ? void 0 : _.length) || 0, S.pageSize),
237
- pageSize: S.pageSize
239
+ var N;
240
+ const g = {
241
+ ...d,
242
+ sortBy: z[d.sortBy],
243
+ page: Dt(((N = a == null ? void 0 : a.list) == null ? void 0 : N.length) || 0, $.pageSize),
244
+ pageSize: $.pageSize
238
245
  };
239
- $(null);
240
- const { data: x = {} } = await T.get(z.blockletsPath, {
241
- params: d
246
+ _(null);
247
+ const { data: S = {} } = await m.get(z.blockletsPath, {
248
+ params: g
242
249
  });
243
- return { list: (x == null ? void 0 : x.dataList) || [], total: (x == null ? void 0 : x.total) || 0 };
250
+ return { list: (S == null ? void 0 : S.dataList) || [], total: (S == null ? void 0 : S.total) || 0 };
244
251
  },
245
252
  {
246
253
  isNoMore: (a) => a ? a.list.length >= a.total : !1,
247
- reloadDeps: [r, nt(e)],
254
+ reloadDeps: [r, pt(e)],
248
255
  onError: (a) => {
249
- $(a);
256
+ _(a);
250
257
  }
251
258
  }
252
259
  ), {
253
- data: M = [],
254
- error: R,
255
- loading: Re,
256
- run: Be
257
- } = Ze(
260
+ data: O = [],
261
+ error: G,
262
+ loading: H,
263
+ run: V
264
+ } = rt(
258
265
  async () => {
259
- const { data: a } = await T.get(z.categoriesPath);
266
+ const { data: a } = await m.get(z.categoriesPath);
260
267
  return Array.isArray(a) ? a : [];
261
268
  },
262
269
  { manual: !0 }
263
- ), H = q(() => rt(M || [], [(d) => d.name], ["asc"]), [M]), ae = J(
264
- (a, d) => {
265
- const x = V[l] ? V[l][a] : V.en[a];
266
- return Ct(x, d);
270
+ ), f = K(() => st(O || [], [(g) => g.name], ["asc"]), [O]), Z = re(
271
+ (a, g) => {
272
+ const S = ee[l] ? ee[l][a] : ee.en[a];
273
+ return It(S, g);
267
274
  },
268
275
  [l]
269
- ), ie = q(() => {
270
- let a = f.list || [];
271
- return a = g(a), a;
272
- }, [f, g]), $e = q(() => vt(H, l), [H, l]), ze = St(ae), Ie = {
273
- errors: { fetchBlockletsError: w, fetchCategoriesError: R },
274
- loadings: { fetchBlockletsLoading: D, fetchCategoriesLoading: Re, loadingMore: U },
276
+ ), M = K(() => {
277
+ let a = F.list || [];
278
+ return a = y(a), a;
279
+ }, [F, y]), Ne = K(() => $t(f, l), [f, l]), Fe = Bt(Z), Le = {
280
+ errors: { fetchBlockletsError: w, fetchCategoriesError: G },
281
+ loadings: { fetchBlockletsLoading: X, fetchCategoriesLoading: H, loadingMore: L },
275
282
  endpoint: r,
276
- blockletList: ie,
283
+ blockletList: M,
277
284
  wrapChildren: p,
278
- t: ae,
279
- filters: i,
280
- selectedCategory: m,
281
- categoryList: H,
285
+ t: Z,
286
+ filters: d,
287
+ selectedCategory: k,
288
+ categoryList: f,
282
289
  blockletRender: s,
283
290
  locale: l,
284
- categoryOptions: $e,
285
- priceOptions: ze,
286
- storeApi: T,
287
- baseSearch: y,
288
- showResourcesSwitch: P,
289
- hasNextPage: f.list.length < f.total,
291
+ categoryOptions: Ne,
292
+ priceOptions: Fe,
293
+ storeApi: m,
294
+ baseSearch: b,
295
+ showResourcesSwitch: T,
296
+ showCategory: R,
297
+ tagFilters: B,
298
+ hasNextPage: F.list.length < F.total,
299
+ onFilterChange: c,
290
300
  handleSort: (a) => {
291
- const d = {
292
- ...i,
301
+ const g = {
302
+ ...d,
293
303
  sortBy: a,
294
304
  sortDirection: a === "nameAsc" ? "asc" : "desc"
295
305
  };
296
- c(d);
306
+ c(g);
297
307
  },
298
308
  handleKeyword: (a) => {
299
- const d = { ...i, keyword: a || void 0 };
300
- c(d);
309
+ const g = { ...d, keyword: a || void 0 };
310
+ c(g);
301
311
  },
302
312
  handlePrice: (a) => {
303
- const d = {
304
- ...i,
305
- price: a === i.price ? void 0 : a
313
+ const g = {
314
+ ...d,
315
+ price: a === d.price ? void 0 : a
306
316
  };
307
- c(d);
317
+ c(g);
308
318
  },
309
319
  handleCategory: (a) => {
310
- let d = a;
311
- (a === "all" || a === i.category) && (d = void 0);
312
- const x = { ...i, category: d };
313
- c(x);
320
+ let g = a;
321
+ (a === "all" || a === d.category) && (g = void 0);
322
+ const S = { ...d, category: g };
323
+ c(S);
314
324
  },
315
325
  handleDeveloper: (a) => {
316
- const d = { ...i, owner: a || void 0 };
317
- c(d);
326
+ const g = { ...d, owner: a || void 0 };
327
+ c(g);
318
328
  },
319
329
  handlePage: (a) => {
320
- const d = { ...i, currentPage: a };
321
- c(d);
330
+ const g = { ...d, currentPage: a };
331
+ c(g);
322
332
  },
323
333
  handleSwitchShowResources: () => {
324
- const a = { ...i };
334
+ const a = { ...d };
325
335
  c(a);
326
336
  },
327
- loadMore: () => {
328
- G();
329
- },
337
+ loadMore: Y,
330
338
  getCategoryLocale: (a) => {
331
339
  if (!a)
332
340
  return null;
333
- let d = null;
334
- const x = M.find((_) => _._id === a);
335
- return x && (d = x.locales[l]), d;
341
+ let g = null;
342
+ const S = O.find((N) => N._id === a);
343
+ return S && (g = S.locales[l]), g;
336
344
  },
337
345
  get developerName() {
338
- var d, x;
339
- return ((x = (d = ie.find((_) => {
340
- var se;
341
- return ((se = _ == null ? void 0 : _.owner) == null ? void 0 : se.did) === i.owner;
342
- })) == null ? void 0 : d.owner) == null ? void 0 : x.name) || "";
346
+ var g, S;
347
+ return ((S = (g = M.find((N) => {
348
+ var he;
349
+ return ((he = N == null ? void 0 : N.owner) == null ? void 0 : he.did) === d.owner;
350
+ })) == null ? void 0 : g.owner) == null ? void 0 : S.name) || "";
343
351
  },
344
- handleSearchSelect: b
352
+ handleSearchSelect: x
345
353
  };
346
- return F(() => {
354
+ return q(() => {
347
355
  setTimeout(() => {
348
- Be();
349
- }, B || 0);
350
- }, [r]), /* @__PURE__ */ t(Dt, { value: Ie, children: o });
356
+ V();
357
+ }, P || 0);
358
+ }, [r]), /* @__PURE__ */ t(At, { value: Le, children: o });
351
359
  }
352
- X.propTypes = {
353
- ...Se,
360
+ le.propTypes = {
361
+ ...$e,
354
362
  children: n.any.isRequired
355
363
  };
356
- X.defaultProps = ve;
357
- function I() {
358
- const e = He(Ce);
364
+ le.defaultProps = Ie;
365
+ function D() {
366
+ const e = Xe(ze);
359
367
  return e || {};
360
368
  }
361
- const _t = v(_e)`
369
+ const Ot = C(Ae)`
362
370
  border-radius: 4px;
363
- `, Y = Ve(({ children: e, rounded: o, loading: r, disabled: l, ...s }, c) => /* @__PURE__ */ t(
364
- _t,
371
+ `, ae = Ye(({ children: e, rounded: o, loading: r, disabled: l, ...s }, c) => /* @__PURE__ */ t(
372
+ Ot,
365
373
  {
366
374
  ref: c,
367
375
  disableElevation: !0,
368
376
  disabled: l || r,
369
377
  ...s,
370
- startIcon: r && /* @__PURE__ */ t(Q, { size: "1em" }),
378
+ startIcon: r && /* @__PURE__ */ t(te, { size: "1em" }),
371
379
  children: e
372
380
  }
373
381
  ));
374
- Y.propTypes = {
382
+ ae.propTypes = {
375
383
  children: n.any,
376
384
  rounded: n.bool,
377
385
  loading: n.bool,
378
386
  disabled: n.bool
379
387
  };
380
- Y.defaultProps = {
388
+ ae.defaultProps = {
381
389
  children: null,
382
390
  rounded: !1,
383
391
  loading: !1,
384
392
  disabled: !1
385
393
  };
386
- function Z({ title: e, value: o, icon: r, prepend: l, options: s, onChange: c, itemRender: b, ...g }) {
387
- const p = E(null), y = fe(), [u, C] = L(!1), [B, P] = L(o !== null ? o : ""), k = be(y.breakpoints.down("sm"));
388
- F(() => {
389
- P(o !== null ? o : "");
394
+ function ie({ title: e, value: o, icon: r, prepend: l, options: s, onChange: c, itemRender: x, ...y }) {
395
+ const p = U(null), b = ne(), [u, v] = A(!1), [P, T] = A(o !== null ? o : ""), R = Se(b.breakpoints.down("sm"));
396
+ q(() => {
397
+ T(o !== null ? o : "");
390
398
  }, [o]);
391
- const T = J(() => {
392
- C(!1);
393
- }, []), i = J(() => {
394
- C(!0);
399
+ const B = re(() => {
400
+ v(!1);
401
+ }, []), i = re(() => {
402
+ v(!0);
395
403
  }, []);
396
- function m(w) {
397
- P(w.value), c(w.value), k && T();
404
+ function m(k) {
405
+ T(k.value), c(k.value), R && B();
398
406
  }
399
- function S(w) {
400
- return w === B;
407
+ function d(k) {
408
+ return k === P;
401
409
  }
402
- return /* @__PURE__ */ h(he, { children: [
410
+ return /* @__PURE__ */ h(oe, { children: [
403
411
  /* @__PURE__ */ h(
404
- Nt,
412
+ Et,
405
413
  {
406
414
  ref: p,
407
415
  onClick: i,
408
416
  variant: "outlined",
409
417
  size: "small",
410
- className: ["my-select__selector", it(B) ? "" : "my-select__selector--active"].join(" "),
411
- ...g,
418
+ className: ["my-select__selector", mt(P) ? "" : "my-select__selector--active"].join(" "),
419
+ sx: { minWidth: "auto" },
420
+ ...y,
412
421
  children: [
413
422
  /* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
414
423
  e,
415
- /* @__PURE__ */ t(Le, { className: "my-select__arrowdown", component: at, fontSize: "small" })
424
+ /* @__PURE__ */ t(Ee, { className: "my-select__arrowdown", component: dt, fontSize: "small" })
416
425
  ]
417
426
  }
418
427
  ),
419
- /* @__PURE__ */ t(Me, { open: u, anchorEl: p.current, transition: !0, style: { zIndex: "9999" }, children: ({ TransitionProps: w, placement: $ }) => /* @__PURE__ */ t(
420
- Ae,
421
- {
422
- ...w,
423
- style: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" },
424
- children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(Oe, { onClickAway: T, children: /* @__PURE__ */ h(Lt, { autoFocusItem: u, onMouseEnter: i, onMouseLeave: T, children: [
425
- l,
426
- s.map((f) => b ? b(f) : /* @__PURE__ */ t(
427
- qe,
428
- {
429
- onClick: () => m(f),
430
- className: [
431
- "my-select__option",
432
- S(f.value) ? "my-select__option--active" : ""
433
- ].join(" "),
434
- children: f.name
435
- },
436
- f.value
437
- ))
438
- ] }) }) })
439
- }
440
- ) })
428
+ /* @__PURE__ */ t(qe, { open: u, anchorEl: p.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: k, placement: $ }) => /* @__PURE__ */ t(je, { ...k, sx: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(Ge, { children: /* @__PURE__ */ t(Ke, { onClickAway: B, children: /* @__PURE__ */ h(qt, { autoFocusItem: u, onMouseEnter: i, onMouseLeave: B, children: [
429
+ l,
430
+ s.map((w) => x ? x(w) : /* @__PURE__ */ t(
431
+ Ue,
432
+ {
433
+ onClick: () => m(w),
434
+ className: [
435
+ "my-select__option",
436
+ d(w.value) ? "my-select__option--active" : ""
437
+ ].join(" "),
438
+ children: w.name
439
+ },
440
+ w.value
441
+ ))
442
+ ] }) }) }) }) })
441
443
  ] });
442
444
  }
443
- Z.propTypes = {
445
+ ie.propTypes = {
444
446
  options: n.array.isRequired,
445
447
  value: n.oneOfType([n.string, n.number, n.array]),
446
448
  onChange: n.func,
@@ -449,7 +451,7 @@ Z.propTypes = {
449
451
  icon: n.any,
450
452
  prepend: n.any
451
453
  };
452
- Z.defaultProps = {
454
+ ie.defaultProps = {
453
455
  value: null,
454
456
  icon: null,
455
457
  prepend: null,
@@ -457,7 +459,7 @@ Z.defaultProps = {
457
459
  onChange: () => {
458
460
  }
459
461
  };
460
- const Nt = v(Y)`
462
+ const Et = C(ae)`
461
463
  border: 1px solid #f0f0f0;
462
464
  padding: 6px 8px 6px 12px;
463
465
  font-weight: ${(e) => e.theme.typography.fontWeightBold};
@@ -465,7 +467,6 @@ const Nt = v(Y)`
465
467
  color: #666;
466
468
  line-height: 1;
467
469
  text-transform: none;
468
- min-width: 100px;
469
470
  & + & {
470
471
  margin-left: 10px;
471
472
  }
@@ -489,7 +490,7 @@ const Nt = v(Y)`
489
490
  margin-right: 3px;
490
491
  }
491
492
  }
492
- `, Lt = v(Ne)`
493
+ `, qt = C(Oe)`
493
494
  .my-select__option__icon {
494
495
  color: transparent;
495
496
  font-size: 16px;
@@ -506,8 +507,8 @@ const Nt = v(Y)`
506
507
  }
507
508
  }
508
509
  `;
509
- function O({ options: e, onChange: o, title: r, value: l }) {
510
- return /* @__PURE__ */ h(Mt, { children: [
510
+ function j({ options: e, onChange: o, title: r, value: l }) {
511
+ return /* @__PURE__ */ h(jt, { children: [
511
512
  /* @__PURE__ */ t("div", { className: "title", children: r }),
512
513
  /* @__PURE__ */ t("div", { className: "list", children: e.map((s) => /* @__PURE__ */ t(
513
514
  "div",
@@ -522,7 +523,7 @@ function O({ options: e, onChange: o, title: r, value: l }) {
522
523
  )) })
523
524
  ] });
524
525
  }
525
- const Mt = v("div")`
526
+ const jt = C("div")`
526
527
  .title {
527
528
  font-size: 18px;
528
529
  font-weight: bold;
@@ -550,50 +551,49 @@ const Mt = v("div")`
550
551
  font-weight: bold;
551
552
  }
552
553
  `;
553
- O.propTypes = {
554
+ j.propTypes = {
554
555
  title: n.string.isRequired,
555
556
  options: n.array.isRequired,
556
557
  onChange: n.func.isRequired,
557
558
  value: n.oneOfType([n.string, n.number])
558
559
  };
559
- O.defaultProps = {
560
+ j.defaultProps = {
560
561
  value: null
561
562
  };
562
- function ee() {
563
- const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: b } = I(), [g, p] = L(!1), y = (u, C) => {
564
- u === "category" && o(C), u === "price" && l(C), p(!1);
563
+ function se() {
564
+ const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: x } = D(), [y, p] = A(!1), b = (u, v) => {
565
+ u === "category" && o(v), u === "price" && l(v), p(!1);
565
566
  };
566
- return /* @__PURE__ */ h(At, { children: [
567
- /* @__PURE__ */ t(pt, { variant: "outlined", className: "filter-button", onClick: () => p(!0), children: /* @__PURE__ */ t(st, { className: "filter-icon", fontSize: "small" }) }),
568
- /* @__PURE__ */ h(ct, { fullWidth: !0, title: "", open: g, onClose: () => p(!1), children: [
567
+ return /* @__PURE__ */ h(Gt, { children: [
568
+ /* @__PURE__ */ t(gt, { variant: "outlined", className: "filter-button", onClick: () => p(!0), children: /* @__PURE__ */ t(ht, { className: "filter-icon", fontSize: "small" }) }),
569
+ /* @__PURE__ */ h(ft, { fullWidth: !0, title: "", open: y, onClose: () => p(!1), children: [
569
570
  /* @__PURE__ */ t(
570
- O,
571
+ j,
571
572
  {
572
573
  title: r("common.price"),
573
- options: b,
574
+ options: x,
574
575
  value: s.price,
575
576
  onChange: (u) => {
576
- y("price", u);
577
+ b("price", u);
577
578
  }
578
579
  }
579
580
  ),
580
581
  c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
581
- O,
582
+ j,
582
583
  {
583
584
  title: r("common.category"),
584
585
  options: c,
585
586
  value: e,
586
587
  onChange: (u) => {
587
- y("category", u);
588
+ b("category", u);
588
589
  }
589
590
  }
590
591
  ) })
591
592
  ] })
592
593
  ] });
593
594
  }
594
- const At = v("div")`
595
+ const Gt = C("div")`
595
596
  .filter-button {
596
- margin-right: 16px;
597
597
  border-color: rgb(240, 240, 240);
598
598
  padding: 5px 8px;
599
599
  min-width: initial;
@@ -603,9 +603,9 @@ const At = v("div")`
603
603
  color: ${(e) => e.theme.palette.grey[500]};
604
604
  }
605
605
  `;
606
- ee.propTypes = {};
607
- ee.defaultProps = {};
608
- const Ft = v("div")`
606
+ se.propTypes = {};
607
+ se.defaultProps = {};
608
+ const Kt = C("div")`
609
609
  .MuiChip-root {
610
610
  border-radius: 4px;
611
611
  height: initial;
@@ -614,42 +614,42 @@ const Ft = v("div")`
614
614
  padding: 4px 0;
615
615
  }
616
616
  `;
617
- function A({ label: e, icon: o, onDelete: r, ...l }) {
618
- return e ? /* @__PURE__ */ t(Ft, { ...l, children: /* @__PURE__ */ t(Ee, { color: "primary", "data-cy": "filter-tag", icon: o, label: e, onDelete: r }) }) : null;
617
+ function E({ label: e, icon: o, onDelete: r, ...l }) {
618
+ return e ? /* @__PURE__ */ t(Kt, { ...l, children: /* @__PURE__ */ t(Ce, { color: "primary", "data-cy": "filter-tag", icon: o, label: e, onDelete: r }) }) : null;
619
619
  }
620
- A.propTypes = {
620
+ E.propTypes = {
621
621
  label: n.string,
622
622
  onDelete: n.func,
623
623
  icon: n.element
624
624
  };
625
- A.defaultProps = {
625
+ E.defaultProps = {
626
626
  onDelete: null,
627
627
  icon: null,
628
628
  label: null
629
629
  };
630
- function de() {
631
- const { t: e } = I();
632
- return /* @__PURE__ */ t(ke, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
630
+ function be() {
631
+ const { t: e } = D();
632
+ return /* @__PURE__ */ t(Be, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
633
633
  }
634
- function j({ filterTip: e, keywordTip: o }) {
635
- const { t: r, locale: l } = I(), s = () => l === "zh" ? "、" : " , ";
636
- return /* @__PURE__ */ h(mt, { className: "tips", children: [
634
+ function W({ filterTip: e, keywordTip: o }) {
635
+ const { t: r, locale: l } = D(), s = () => l === "zh" ? "、" : " , ";
636
+ return /* @__PURE__ */ h(wt, { className: "tips", children: [
637
637
  /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
638
638
  e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
639
639
  e && o && s(),
640
640
  o && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
641
641
  ] });
642
642
  }
643
- j.propTypes = {
643
+ W.propTypes = {
644
644
  filterTip: n.bool,
645
645
  keywordTip: n.bool
646
646
  };
647
- j.defaultProps = {
647
+ W.defaultProps = {
648
648
  filterTip: !1,
649
649
  keywordTip: !1
650
650
  };
651
- function W({ primaryStart: e, primaryEnd: o, filter: r }) {
652
- return /* @__PURE__ */ h(ke, { variant: "subtitle2", children: [
651
+ function J({ primaryStart: e, primaryEnd: o, filter: r }) {
652
+ return /* @__PURE__ */ h(Be, { variant: "subtitle2", children: [
653
653
  /* @__PURE__ */ t("span", { children: e }),
654
654
  /* @__PURE__ */ h("span", { className: "primary", children: [
655
655
  " ",
@@ -662,103 +662,103 @@ function W({ primaryStart: e, primaryEnd: o, filter: r }) {
662
662
  ] })
663
663
  ] });
664
664
  }
665
- W.propTypes = {
665
+ J.propTypes = {
666
666
  primaryStart: n.string.isRequired,
667
667
  primaryEnd: n.string.isRequired,
668
668
  filter: n.string.isRequired
669
669
  };
670
- function Ot(e) {
670
+ function Ut(e) {
671
671
  return e ? e.width > 900 ? 12 : e.width > 600 ? 8 : 4 : 0;
672
672
  }
673
- function Pe({ children: e }) {
674
- const o = E(null), [r, l] = L(null), s = et(r);
675
- return F(() => {
673
+ function De({ children: e }) {
674
+ const o = U(null), [r, l] = A(null), s = ot(r);
675
+ return q(() => {
676
676
  r || l(o.current);
677
- }, [r]), e(o, Ot(s));
677
+ }, [r]), e(o, Ut(s));
678
678
  }
679
- Pe.propTypes = {
679
+ De.propTypes = {
680
680
  children: n.func.isRequired
681
681
  };
682
- function te({ blocklets: e, ...o }) {
682
+ function ce({ blocklets: e, ...o }) {
683
683
  const {
684
684
  blockletRender: r,
685
685
  errors: l,
686
686
  loadings: s,
687
687
  selectedCategory: c,
688
- getCategoryLocale: b,
689
- filters: g,
688
+ getCategoryLocale: x,
689
+ filters: y,
690
690
  t: p,
691
- hasNextPage: y,
691
+ hasNextPage: b,
692
692
  loadMore: u,
693
- endpoint: C
694
- } = I(), B = !!c || !!g.price, [P] = dt({
693
+ endpoint: v
694
+ } = D(), P = !!c || !!y.price, [T] = bt({
695
695
  loading: s.fetchBlockletsLoading || s.loadingMore,
696
- hasNextPage: y,
696
+ hasNextPage: b,
697
697
  onLoadMore: u
698
698
  });
699
699
  if (l.fetchBlockletsError)
700
700
  return /* @__PURE__ */ t(
701
- xe,
701
+ Pe,
702
702
  {
703
- error: new Error(`Failed to fetch blocklets from ${C}: ${l.fetchBlockletsError.message}`)
703
+ error: new Error(`Failed to fetch blocklets from ${v}: ${l.fetchBlockletsError.message}`)
704
704
  }
705
705
  );
706
706
  if (s.fetchBlockletsLoading)
707
- return /* @__PURE__ */ t(N, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(Q, {}) });
708
- if (g.keyword && B && e.length === 0)
709
- return /* @__PURE__ */ h(K, { children: [
707
+ return /* @__PURE__ */ t(I, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(te, {}) });
708
+ if (y.keyword && P && e.length === 0)
709
+ return /* @__PURE__ */ h(Q, { children: [
710
710
  /* @__PURE__ */ t(
711
- W,
711
+ J,
712
712
  {
713
713
  primaryStart: p("blocklet.noBlockletPart1"),
714
714
  primaryEnd: p("blocklet.noBlockletPart2"),
715
- filter: g.keyword
715
+ filter: y.keyword
716
716
  }
717
717
  ),
718
- /* @__PURE__ */ t(j, { keywordTip: !0, filterTip: !0 })
718
+ /* @__PURE__ */ t(W, { keywordTip: !0, filterTip: !0 })
719
719
  ] });
720
- if (g.keyword && e.length === 0)
721
- return /* @__PURE__ */ h(K, { children: [
720
+ if (y.keyword && e.length === 0)
721
+ return /* @__PURE__ */ h(Q, { children: [
722
722
  /* @__PURE__ */ t(
723
- W,
723
+ J,
724
724
  {
725
725
  primaryStart: p("blocklet.noBlockletPart1"),
726
726
  primaryEnd: p("blocklet.noBlockletPart2"),
727
- filter: g.keyword
727
+ filter: y.keyword
728
728
  }
729
729
  ),
730
- /* @__PURE__ */ t(j, { keywordTip: !0 })
730
+ /* @__PURE__ */ t(W, { keywordTip: !0 })
731
731
  ] });
732
- if (B && e.length === 0) {
733
- const k = b(c);
734
- return /* @__PURE__ */ h(K, { children: [
735
- k ? /* @__PURE__ */ t(
736
- W,
732
+ if (P && e.length === 0) {
733
+ const R = x(c);
734
+ return /* @__PURE__ */ h(Q, { children: [
735
+ R ? /* @__PURE__ */ t(
736
+ J,
737
737
  {
738
738
  primaryStart: p("blocklet.noCategoryResults1"),
739
739
  primaryEnd: p("blocklet.noCategoryResults2"),
740
- filter: k
740
+ filter: R
741
741
  }
742
- ) : /* @__PURE__ */ t(de, {}),
743
- /* @__PURE__ */ t(j, { filterTip: !0 })
742
+ ) : /* @__PURE__ */ t(be, {}),
743
+ /* @__PURE__ */ t(W, { filterTip: !0 })
744
744
  ] });
745
745
  }
746
- return e.length === 0 ? /* @__PURE__ */ t(K, { children: /* @__PURE__ */ t(de, {}) }) : /* @__PURE__ */ t(Pe, { children: (k, T) => /* @__PURE__ */ h(qt, { container: !0, ...o, columns: T, ref: k, children: [
747
- e.map((i) => /* @__PURE__ */ t(me, { item: !0, xs: 4, "data-blocklet-did": i.did, children: r({ blocklet: i, blocklets: e }) }, i.did)),
748
- y && /* @__PURE__ */ t(me, { item: !0, xs: 12, ref: P, children: /* @__PURE__ */ t(N, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(Q, {}) }) })
746
+ return e.length === 0 ? /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(be, {}) }) : /* @__PURE__ */ t(De, { children: (R, B) => /* @__PURE__ */ h(Wt, { container: !0, ...o, columns: B, ref: R, children: [
747
+ e.map((i) => /* @__PURE__ */ t(we, { item: !0, xs: 4, "data-blocklet-did": i.did, children: r({ blocklet: i, blocklets: e }) }, i.did)),
748
+ b && /* @__PURE__ */ t(we, { item: !0, xs: 12, ref: T, children: /* @__PURE__ */ t(I, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(te, {}) }) })
749
749
  ] }) });
750
750
  }
751
- te.propTypes = {
751
+ ce.propTypes = {
752
752
  blocklets: n.array.isRequired
753
753
  };
754
- te.defaultProps = {};
755
- const qt = v(we)`
754
+ ce.defaultProps = {};
755
+ const Wt = C(ve)`
756
756
  opacity: ${(e) => e.columns > 0 ? 1 : 0};
757
757
  &.MuiGrid-root {
758
758
  width: 100%;
759
759
  margin: 0 -16px;
760
760
  }
761
- `, me = v(we)`
761
+ `, we = C(ve)`
762
762
  @media (max-width: ${(e) => e.theme.breakpoints.values.sm}px) {
763
763
  &.MuiGrid-item {
764
764
  padding-bottom: 0px;
@@ -769,7 +769,7 @@ const qt = v(we)`
769
769
  margin-bottom: ${(e) => e.theme.spacing(2)};
770
770
  }
771
771
  }
772
- `, K = v(ut)`
772
+ `, Q = C(yt)`
773
773
  text-align: center;
774
774
  .primary {
775
775
  color: ${(e) => e.theme.palette.primary.main};
@@ -778,12 +778,12 @@ const qt = v(we)`
778
778
  margin-top: ${(e) => e.theme.spacing(1)};
779
779
  }
780
780
  `;
781
- function re() {
782
- const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: b } = I();
783
- return /* @__PURE__ */ h(Et, { children: [
784
- /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(O, { title: r("common.price"), options: b, value: s.price, onChange: l }) }),
781
+ function pe() {
782
+ const { selectedCategory: e, handleCategory: o, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: x } = D();
783
+ return /* @__PURE__ */ h(Ht, { children: [
784
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(j, { title: r("common.price"), options: x, value: s.price, onChange: l }) }),
785
785
  c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
786
- O,
786
+ j,
787
787
  {
788
788
  title: r("common.category"),
789
789
  options: c,
@@ -793,7 +793,7 @@ function re() {
793
793
  ) })
794
794
  ] });
795
795
  }
796
- const Et = v("aside")`
796
+ const Ht = C("aside")`
797
797
  width: 220px;
798
798
  margin-right: ${(e) => e.theme.spacing(2)};
799
799
  height: 100%;
@@ -802,41 +802,41 @@ const Et = v("aside")`
802
802
  overflow-y: auto;
803
803
  z-index: auto;
804
804
  `;
805
- re.propTypes = {};
806
- re.defaultProps = {};
807
- function oe({ placeholder: e, ...o }) {
808
- const { filters: r, handleKeyword: l } = I(), [s, c] = L(r.keyword || ""), b = tt(l, { wait: 300 }), g = (y) => {
809
- const { value: u } = y.target;
810
- c(u), b.run(u);
805
+ pe.propTypes = {};
806
+ pe.defaultProps = {};
807
+ function ue({ placeholder: e, ...o }) {
808
+ const { filters: r, handleKeyword: l } = D(), [s, c] = A(r.keyword || ""), x = nt(l, { wait: 300 }), y = (b) => {
809
+ const { value: u } = b.target;
810
+ c(u), x.run(u);
811
811
  }, p = () => {
812
812
  c(""), l();
813
813
  };
814
- return F(() => {
814
+ return q(() => {
815
815
  c(r.keyword || "");
816
816
  }, [r.keyword]), /* @__PURE__ */ t(
817
- jt,
817
+ Vt,
818
818
  {
819
819
  inputProps: {
820
820
  "data-cy": "search-blocklet"
821
821
  },
822
- startAdornment: /* @__PURE__ */ t(ce, { position: "start", children: /* @__PURE__ */ t(Gt, {}) }),
823
- onChange: g,
822
+ startAdornment: /* @__PURE__ */ t(fe, { position: "start", children: /* @__PURE__ */ t(Qt, {}) }),
823
+ onChange: y,
824
824
  placeholder: e,
825
825
  value: s,
826
826
  title: e,
827
827
  "data-cy": "search",
828
- endAdornment: s && /* @__PURE__ */ t(ce, { position: "end", children: /* @__PURE__ */ t(Ut, { "data-cy": "search-delete", onClick: p }) }),
828
+ endAdornment: s && /* @__PURE__ */ t(fe, { position: "end", children: /* @__PURE__ */ t(Jt, { "data-cy": "search-delete", onClick: p }) }),
829
829
  ...o
830
830
  }
831
831
  );
832
832
  }
833
- oe.propTypes = {
833
+ ue.propTypes = {
834
834
  placeholder: n.string
835
835
  };
836
- oe.defaultProps = {
836
+ ue.defaultProps = {
837
837
  placeholder: "Type to search..."
838
838
  };
839
- const jt = v(je)`
839
+ const Vt = C(We)`
840
840
  background-color: ${(e) => e.theme.palette.grey[50]};
841
841
  font-size: 14px;
842
842
  border-radius: 6px;
@@ -853,49 +853,49 @@ const jt = v(je)`
853
853
  color: transparent;
854
854
  }
855
855
  }
856
- `, Gt = v(ht)`
856
+ `, Qt = C(xt)`
857
857
  color: ${(e) => e.theme.palette.grey[500]};
858
858
  font-size: 28px;
859
859
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
860
860
  font-size: 24px;
861
861
  }
862
- `, Ut = v(ft)`
862
+ `, Jt = C(kt)`
863
863
  color: ${(e) => e.theme.palette.grey[500]};
864
864
  font-size: 16px;
865
865
  cursor: pointer;
866
866
  `;
867
- function ne({ onSelect: e, wrapChildren: o }) {
868
- const r = E(null), l = E(null), s = E(null), { storeApi: c, blockletRender: b, filters: g, endpoint: p, handleKeyword: y, t: u } = I(), C = async (i) => {
869
- const { data: m } = await c.get(z.blockletsPath, { params: i }), S = m.dataList || [];
870
- return S.length > 0 && S.unshift({ type: "more-result", total: m.total || 0 }), S;
871
- }, B = (i) => {
872
- y(i.state.query), i.setIsOpen(!1);
873
- }, P = () => {
867
+ function de({ onSelect: e, wrapChildren: o }) {
868
+ const r = U(null), l = U(null), s = U(null), { storeApi: c, blockletRender: x, filters: y, endpoint: p, handleKeyword: b, t: u } = D(), v = async (i) => {
869
+ const { data: m } = await c.get(z.blockletsPath, { params: i }), d = m.dataList || [];
870
+ return d.length > 0 && d.unshift({ type: "more-result", total: m.total || 0 }), d;
871
+ }, P = (i) => {
872
+ b(i.state.query), i.setIsOpen(!1);
873
+ }, T = () => {
874
874
  r.current && setTimeout(() => {
875
875
  const i = r.current.querySelector("input.bl-autocomplete-input");
876
876
  i && i.focus();
877
877
  });
878
- }, k = (i) => {
879
- i.setIsOpen(!1), P();
880
- }, T = ({ prevState: i, state: m }) => {
881
- i.query !== m.query && (m.query || y());
878
+ }, R = (i) => {
879
+ i.setIsOpen(!1), T();
880
+ }, B = ({ prevState: i, state: m }) => {
881
+ i.query !== m.query && (m.query || b());
882
882
  };
883
- return bt(
883
+ return vt(
884
884
  "ctrl + k, command + k",
885
- (i) => (i.stopPropagation(), i.preventDefault(), P(), !1),
885
+ (i) => (i.stopPropagation(), i.preventDefault(), T(), !1),
886
886
  { enableOnTags: ["INPUT"] }
887
- ), F(() => {
888
- P();
889
- }, [p]), F(() => {
887
+ ), q(() => {
888
+ T();
889
+ }, [p]), q(() => {
890
890
  if (!r.current)
891
891
  return;
892
- const i = yt({
892
+ const i = Ct({
893
893
  container: r.current,
894
- renderer: { createElement: Qe, Fragment: Je, render: () => {
894
+ renderer: { createElement: Ze, Fragment: et, render: () => {
895
895
  } },
896
- render({ children: m }, S) {
897
- var w;
898
- (!l.current || s.current !== S) && (s.current = S, (w = l.current) == null || w.unmount(), l.current = gt(S)), l.current.render(o(m));
896
+ render({ children: m }, d) {
897
+ var k;
898
+ (!l.current || s.current !== d) && (s.current = d, (k = l.current) == null || k.unmount(), l.current = St(d)), l.current.render(o(m));
899
899
  },
900
900
  autoFocus: !0,
901
901
  openOnFocus: !1,
@@ -916,44 +916,44 @@ function ne({ onSelect: e, wrapChildren: o }) {
916
916
  },
917
917
  placeholder: u("common.searchStore"),
918
918
  initialState: {
919
- query: g.keyword
919
+ query: y.keyword
920
920
  },
921
921
  onStateChange(m) {
922
- T(m);
922
+ B(m);
923
923
  },
924
- onSubmit: B,
924
+ onSubmit: P,
925
925
  onReset(m) {
926
- k(m);
926
+ R(m);
927
927
  },
928
- getSources({ query: m, state: S, ...w }) {
928
+ getSources({ query: m, state: d, ...k }) {
929
929
  const $ = {
930
- ...g,
931
- sortBy: z[g.sortBy],
930
+ ...y,
931
+ sortBy: z[y.sortBy],
932
932
  page: 1,
933
933
  pageSize: 10,
934
934
  keyword: m
935
935
  };
936
- return $t([
936
+ return Ft([
937
937
  {
938
938
  sourceId: "blocklets",
939
939
  getItems() {
940
- return C($);
940
+ return v($);
941
941
  },
942
942
  // 选中后填充 搜索框中值
943
- getItemInputValue({ item: f }) {
944
- return f.type === "more-result" ? m : f.title;
943
+ getItemInputValue({ item: w }) {
944
+ return w.type === "more-result" ? m : w.title;
945
945
  },
946
946
  // 选中或者点击自动完成列表中的 item 时触发
947
- onSelect({ event: f, item: D }) {
948
- return D.type === "more-result" ? (w.setIsOpen(!1), y(m)) : f.type === "keydown" ? y(D.title) : e({
949
- blocklet: D,
950
- detailUrl: wt(p, `/blocklets/${D.did}`),
947
+ onSelect({ event: w, item: _ }) {
948
+ return _.type === "more-result" ? (k.setIsOpen(!1), b(m)) : w.type === "keydown" ? b(_.title) : e({
949
+ blocklet: _,
950
+ detailUrl: Tt(p, `/blocklets/${_.did}`),
951
951
  storeUrl: p
952
952
  });
953
953
  },
954
954
  templates: {
955
- item({ item: f }) {
956
- return f.type === "more-result" ? /* @__PURE__ */ t("div", { children: u("autocomplete.expandResult", { name: m, number: f.total.toLocaleString() }) }) : b({ blocklet: f, autocompleteSetters: w });
955
+ item({ item: w }) {
956
+ return w.type === "more-result" ? /* @__PURE__ */ t("div", { children: u("autocomplete.expandResult", { name: m, number: w.total.toLocaleString() }) }) : x({ blocklet: w, autocompleteSetters: k });
957
957
  },
958
958
  noResults() {
959
959
  return u("blocklet.noResults");
@@ -966,11 +966,11 @@ function ne({ onSelect: e, wrapChildren: o }) {
966
966
  return () => {
967
967
  i.destroy();
968
968
  };
969
- }, [g, b]), /* @__PURE__ */ h(he, { children: [
969
+ }, [y, x]), /* @__PURE__ */ h(oe, { children: [
970
970
  /* @__PURE__ */ t(
971
- ge,
971
+ xe,
972
972
  {
973
- styles: ye`
973
+ styles: ke`
974
974
  .bl-autocomplete-detached-container {
975
975
  .bl-autocomplete-detached-cancel {
976
976
  white-space: nowrap;
@@ -982,34 +982,34 @@ function ne({ onSelect: e, wrapChildren: o }) {
982
982
  /* @__PURE__ */ t("div", { className: "bl-search-container", ref: r })
983
983
  ] });
984
984
  }
985
- ne.propTypes = {
985
+ de.propTypes = {
986
986
  onSelect: n.func.isRequired,
987
987
  wrapChildren: n.func
988
988
  };
989
- ne.defaultProps = {
989
+ de.defaultProps = {
990
990
  wrapChildren: (e) => e
991
991
  };
992
- function le({ t: e }) {
993
- const { filters: o, handleSwitchShowResources: r } = I(), l = () => {
992
+ function me({ t: e }) {
993
+ const { filters: o, handleSwitchShowResources: r } = D(), l = () => {
994
994
  o.showResources = !o.showResources, r();
995
995
  };
996
996
  return /* @__PURE__ */ t(
997
- xt,
997
+ Pt,
998
998
  {
999
999
  checked: o.showResources,
1000
1000
  onChange: l,
1001
1001
  labelProps: {
1002
- label: /* @__PURE__ */ t(Ge, { marginLeft: "8px", fontSize: "small", children: /* @__PURE__ */ t("span", { children: e("common.showResources") }) })
1002
+ label: /* @__PURE__ */ t(Te, { marginLeft: "8px", fontSize: "small", children: /* @__PURE__ */ t("span", { children: e("common.showResources") }) })
1003
1003
  }
1004
1004
  }
1005
1005
  );
1006
1006
  }
1007
- le.propTypes = {
1007
+ me.propTypes = {
1008
1008
  t: n.func.isRequired
1009
1009
  };
1010
- le.defaultProps = {};
1011
- function Kt() {
1012
- var G, U, M;
1010
+ me.defaultProps = {};
1011
+ function Xt() {
1012
+ var H, V;
1013
1013
  const {
1014
1014
  handleDeveloper: e,
1015
1015
  blockletList: o,
@@ -1017,91 +1017,139 @@ function Kt() {
1017
1017
  developerName: l,
1018
1018
  handleSort: s,
1019
1019
  handleCategory: c,
1020
- handlePrice: b,
1021
- handleSearchSelect: g,
1020
+ handlePrice: x,
1021
+ handleSearchSelect: y,
1022
1022
  t: p,
1023
- getCategoryLocale: y,
1023
+ getCategoryLocale: b,
1024
1024
  priceOptions: u,
1025
- wrapChildren: C,
1026
- showResourcesSwitch: B,
1027
- baseSearch: P
1028
- } = I(), k = kt(p), T = ((G = k.find((R) => R.value === r.sortBy)) == null ? void 0 : G.name) || p("sort.sort"), i = y(r.category), { resourceType: m } = r || {}, S = (U = u.find((R) => R.value === r.price)) == null ? void 0 : U.name, [w, $] = L(!1), f = be((R) => R.breakpoints.down("md")), D = !P || w || f || ((M = r == null ? void 0 : r.keyword) == null ? void 0 : M.length);
1029
- return /* @__PURE__ */ h(N, { display: "flex", alignItems: "flex-start", height: "100%", children: [
1030
- /* @__PURE__ */ t(pe, { mdDown: !0, children: /* @__PURE__ */ t(re, {}) }),
1031
- /* @__PURE__ */ h(Wt, { children: [
1032
- /* @__PURE__ */ h(Ht, { children: [
1033
- /* @__PURE__ */ h(N, { className: "filter-bar", display: "flex", alignItems: "center", children: [
1034
- /* @__PURE__ */ t(
1035
- "form",
1036
- {
1037
- className: "search-form",
1038
- style: D ? { flex: 1, width: "100%" } : {},
1039
- onSubmit: (R) => {
1040
- R.preventDefault(), R.stopPropagation();
1041
- },
1042
- onFocus: () => {
1043
- $(!0);
1025
+ wrapChildren: v,
1026
+ showResourcesSwitch: P,
1027
+ showCategory: T,
1028
+ baseSearch: R,
1029
+ onFilterChange: B,
1030
+ tagFilters: i
1031
+ } = D(), m = Rt(p), d = ((H = m.find((f) => f.value === r.sortBy)) == null ? void 0 : H.name) || p("sort.sort"), k = b(r.category), { resourceType: $ } = r || {}, w = (V = u.find((f) => f.value === r.price)) == null ? void 0 : V.name, [_, F] = A(!1), X = ne(), Y = Se(() => X.breakpoints.down("md")), L = Re({
1032
+ chooseTagId: ""
1033
+ }), O = lt((f) => {
1034
+ L.chooseTagId = f.id, ["category", "resourceType", "resourceDid"].forEach((M) => {
1035
+ typeof f.params[M] > "u" ? delete r[M] : r[M] = f.params[M];
1036
+ }), B(r);
1037
+ }), G = at(() => i.find((f) => f.id === L.chooseTagId), [L.chooseTagId]);
1038
+ return it(() => {
1039
+ i.length > 0 && O(i[0]);
1040
+ }), /* @__PURE__ */ h(I, { display: "flex", alignItems: "flex-start", height: "100%", children: [
1041
+ T ? /* @__PURE__ */ t(ge, { mdDown: !0, children: /* @__PURE__ */ t(pe, {}) }) : null,
1042
+ /* @__PURE__ */ h(Yt, { children: [
1043
+ /* @__PURE__ */ h(Zt, { children: [
1044
+ /* @__PURE__ */ h(
1045
+ I,
1046
+ {
1047
+ className: "filter-bar",
1048
+ sx: {
1049
+ display: "flex",
1050
+ flexDirection: {
1051
+ lg: "row",
1052
+ md: P ? "column" : "row"
1044
1053
  },
1045
- onBlur: () => {
1046
- $(!1);
1054
+ alignItems: {
1055
+ lg: "center",
1056
+ md: P ? "flex-start" : "center"
1047
1057
  },
1048
- children: P ? /* @__PURE__ */ t(oe, { className: "bl-search-container", placeholder: p("common.searchStore") }) : /* @__PURE__ */ t(ne, { onSelect: g, wrapChildren: C })
1049
- }
1050
- ),
1051
- /* @__PURE__ */ h(N, { mt: 0, ml: "16px", className: "filter-container", display: "flex", alignItems: "center", children: [
1052
- !f && B && /* @__PURE__ */ t(N, { ml: 1, mr: 1, children: /* @__PURE__ */ t(le, { t: p }) }),
1053
- /* @__PURE__ */ t(pe, { mdUp: !0, children: /* @__PURE__ */ t(ee, {}) }),
1054
- /* @__PURE__ */ t(
1055
- Z,
1056
- {
1057
- value: r.sortBy,
1058
- options: k,
1059
- title: T,
1060
- icon: /* @__PURE__ */ t(De, {}),
1061
- onChange: (R) => {
1062
- s(R);
1058
+ gap: 1
1059
+ },
1060
+ children: [
1061
+ T ? /* @__PURE__ */ t(ge, { mdUp: !0, children: /* @__PURE__ */ t(se, {}) }) : null,
1062
+ /* @__PURE__ */ t(
1063
+ "form",
1064
+ {
1065
+ className: "search-form",
1066
+ style: {
1067
+ flex: 1,
1068
+ width: "100%"
1069
+ },
1070
+ onSubmit: (f) => {
1071
+ f.preventDefault(), f.stopPropagation();
1072
+ },
1073
+ onFocus: () => {
1074
+ F(!0);
1075
+ },
1076
+ onBlur: () => {
1077
+ F(!1);
1078
+ },
1079
+ children: R ? /* @__PURE__ */ t(ue, { className: "bl-search-container", placeholder: p("common.searchStore") }) : /* @__PURE__ */ t(de, { onSelect: y, wrapChildren: v })
1063
1080
  }
1064
- }
1065
- )
1066
- ] })
1067
- ] }),
1068
- /* @__PURE__ */ h(N, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
1081
+ ),
1082
+ /* @__PURE__ */ h(I, { className: "filter-container", display: "flex", alignItems: "center", children: [
1083
+ !Y && P && /* @__PURE__ */ t(I, { ml: 1, mr: 1, children: /* @__PURE__ */ t(me, { t: p }) }),
1084
+ /* @__PURE__ */ t(
1085
+ ie,
1086
+ {
1087
+ value: r.sortBy,
1088
+ options: m,
1089
+ title: d,
1090
+ icon: /* @__PURE__ */ t(Me, {}),
1091
+ onChange: (f) => {
1092
+ s(f);
1093
+ }
1094
+ }
1095
+ )
1096
+ ] })
1097
+ ]
1098
+ }
1099
+ ),
1100
+ T ? /* @__PURE__ */ h(I, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
1069
1101
  /* @__PURE__ */ t(
1070
- A,
1102
+ E,
1071
1103
  {
1072
1104
  label: l,
1073
- icon: /* @__PURE__ */ t(Ue, {}),
1105
+ icon: /* @__PURE__ */ t(Ve, {}),
1074
1106
  onDelete: () => {
1075
1107
  e(null);
1076
1108
  }
1077
1109
  }
1078
1110
  ),
1079
1111
  /* @__PURE__ */ t(
1080
- A,
1112
+ E,
1081
1113
  {
1082
- label: i,
1114
+ label: k,
1083
1115
  onDelete: () => {
1084
1116
  c(null);
1085
1117
  }
1086
1118
  }
1087
1119
  ),
1088
1120
  /* @__PURE__ */ t(
1089
- A,
1121
+ E,
1090
1122
  {
1091
- label: S,
1123
+ label: w,
1092
1124
  onDelete: () => {
1093
- b(null);
1125
+ x(null);
1094
1126
  }
1095
1127
  }
1096
1128
  ),
1097
- m && /* @__PURE__ */ t(A, { label: `${p("common.resourceType")}: ${m}` })
1098
- ] })
1129
+ $ && /* @__PURE__ */ t(E, { label: `${p("common.resourceType")}: ${$}` })
1130
+ ] }) : null
1099
1131
  ] }),
1100
- /* @__PURE__ */ t(Ke, { FallbackComponent: xe, children: /* @__PURE__ */ t("div", { style: { position: "relative", flex: 1, overflow: "auto" }, children: /* @__PURE__ */ t(te, { blocklets: o }) }) })
1132
+ /* @__PURE__ */ t(Qe, { FallbackComponent: Pe, children: /* @__PURE__ */ h(I, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
1133
+ (i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */ h(oe, { children: [
1134
+ /* @__PURE__ */ t(He, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: i.map((f) => /* @__PURE__ */ t(
1135
+ Ce,
1136
+ {
1137
+ label: f.title,
1138
+ size: "small",
1139
+ variant: L.chooseTagId === f.id ? "contained" : "outlined",
1140
+ onClick: () => O(f),
1141
+ color: L.chooseTagId === f.id ? "primary" : "default"
1142
+ },
1143
+ f.id
1144
+ )) }),
1145
+ G ? /* @__PURE__ */ t(I, { mb: 2, children: G.description ? /* @__PURE__ */ t(Te, { variant: "body1", children: G.description }) : null }) : null
1146
+ ] }) : null,
1147
+ /* @__PURE__ */ t(ce, { blocklets: o })
1148
+ ] }) })
1101
1149
  ] })
1102
1150
  ] });
1103
1151
  }
1104
- const Wt = v("main")`
1152
+ const Yt = C("main")`
1105
1153
  display: flex;
1106
1154
  flex-direction: column;
1107
1155
  flex: 1;
@@ -1127,33 +1175,27 @@ const Wt = v("main")`
1127
1175
  }
1128
1176
  .bl-search-container {
1129
1177
  width: 100%;
1130
- margin-bottom: ${(e) => e.theme.spacing(2)};
1131
1178
  }
1132
1179
  .filter-container {
1133
1180
  margin-left: 0;
1134
1181
  display: flex;
1135
1182
  justify-content: flex-start;
1136
1183
  }
1137
- .filter-bar {
1138
- display: flex;
1139
- flex-direction: column;
1140
- align-items: flex-start;
1141
- }
1142
1184
  }
1143
1185
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
1144
1186
  .sort-button {
1145
1187
  font-size: 12px;
1146
1188
  }
1147
1189
  }
1148
- `, Ht = v("div")`
1190
+ `, Zt = C("div")`
1149
1191
  position: sticky;
1150
1192
  top: 0;
1151
1193
  z-index: 9;
1152
1194
  background-color: white;
1153
1195
  `;
1154
- function Te(e) {
1155
- const o = fe(), r = Rt(o.palette.primary.main), l = {
1156
- autocomplete: ye`
1196
+ function _e(e) {
1197
+ const o = ne(), r = _t(o.palette.primary.main), l = {
1198
+ autocomplete: ke`
1157
1199
  :root {
1158
1200
  --aa-detached-media-query: (max-width: ${o.breakpoints.values.md}px) !important;
1159
1201
  --aa-detached-modal-media-query: (min-width: ${o.breakpoints.values.md}px) !important;
@@ -1191,13 +1233,13 @@ function Te(e) {
1191
1233
  }
1192
1234
  `
1193
1235
  };
1194
- return /* @__PURE__ */ h(X, { ...e, children: [
1195
- /* @__PURE__ */ t(ge, { styles: l.autocomplete }),
1196
- /* @__PURE__ */ t(Kt, {})
1236
+ return /* @__PURE__ */ h(le, { ...e, children: [
1237
+ /* @__PURE__ */ t(xe, { styles: l.autocomplete }),
1238
+ /* @__PURE__ */ t(Xt, {})
1197
1239
  ] });
1198
1240
  }
1199
- Te.propTypes = Se;
1200
- Te.defaultProps = ve;
1241
+ _e.propTypes = $e;
1242
+ _e.defaultProps = Ie;
1201
1243
  export {
1202
- Te as default
1244
+ _e as default
1203
1245
  };