@0xchain/table 1.1.0-beta.14 → 1.1.0-beta.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/dist/index.js +63 -63
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
3
3
  import { Table as ie, TableHeader as ce, TableRow as E, TableHead as de, TableBody as me, TableCell as K } from "@0xchain/ui/table";
4
4
  import * as Z from "react";
5
- import he, { useState as y, useEffect as z } from "react";
5
+ import he, { useState as w, useEffect as z } from "react";
6
6
  import { startOfDay as q, endOfDay as X } from "date-fns";
7
7
  import { twMerge as v } from "tailwind-merge";
8
8
  import { DatePicker as ue } from "antd";
@@ -15,8 +15,8 @@ import "dayjs/locale/ko";
15
15
  import fe from "antd/es/date-picker/locale/en_US";
16
16
  import pe from "antd/es/date-picker/locale/zh_CN";
17
17
  import Ae from "antd/es/date-picker/locale/zh_TW";
18
- import be from "antd/es/date-picker/locale/ja_JP";
19
- import ge from "antd/es/date-picker/locale/ko_KR";
18
+ import ge from "antd/es/date-picker/locale/ja_JP";
19
+ import be from "antd/es/date-picker/locale/ko_KR";
20
20
  import D from "@0xchain/image";
21
21
  import { Popover as O, PopoverTrigger as U, PopoverContent as Q } from "@0xchain/ui/popover";
22
22
  import { useLocale as xe, useTranslations as J } from "next-intl";
@@ -27,21 +27,21 @@ import S from "@0xchain/translation";
27
27
  import _ from "@0xchain/request";
28
28
  import { useParams as ee } from "next/navigation";
29
29
  import { Checkbox as te } from "@0xchain/ui/checkbox";
30
- import { useDebounceFn as ye } from "ahooks";
31
- import ke from "@0xchain/empty";
32
- import we from "@0xchain/loading";
30
+ import { useDebounceFn as we } from "ahooks";
31
+ import ye from "@0xchain/empty";
32
+ import ke from "@0xchain/loading";
33
33
  const Ne = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAZCAYAAAArK+5dAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADWSURBVHgB7ZPhDcIgEIUP0wEcQTdwAxjBERzBDcSJdAPbDdwANznBQnIih6TQP02/hJDmwb274wqwaBDRuDVVd3TksLKbivSd1zRzn9PvQognzeSA7VG0gqPfe7sGksnF71dIk9IljJ1QPt5YonfV9HZIhQme1ONYHeR5Vep5A/tQ+xo9ZSCRn5hSZM5Awe+oVhEb9PA9RVMIU5Q0GGxfNVTgW6zC9yZz0EQ/jinRYliDVrBjmhvBkvEMzF7B+gZ/mb2CD7aHZ2zPiRps7bphOx4uJiyCNyogpaxjuzr+AAAAAElFTkSuQmCC";
34
34
  function ve({
35
35
  className: a,
36
36
  onChange: i,
37
37
  ...c
38
38
  }) {
39
- const m = xe(), [A, k] = Z.useState(!1), w = Z.useRef(null), [g, b] = Z.useState(null), d = {
39
+ const m = xe(), [A, y] = Z.useState(!1), k = Z.useRef(null), [b, g] = Z.useState(null), d = {
40
40
  en: fe,
41
41
  "zh-hans": pe,
42
42
  "zh-hant": Ae,
43
- ja: be,
44
- ko: ge
43
+ ja: ge,
44
+ ko: be
45
45
  }, f = {
46
46
  en: "en",
47
47
  "zh-hans": "zh-cn",
@@ -60,37 +60,37 @@ function ve({
60
60
  const [h, p] = o, x = h ? q(h.toDate()) : void 0, T = p ? X(p.toDate()) : void 0;
61
61
  i(x ? Math.floor(x.getTime() / 1e3) : "", T ? Math.floor(T.getTime() / 1e3) : ""), N();
62
62
  }, N = () => {
63
- k(!1);
63
+ y(!1);
64
64
  }, R = (o) => {
65
- o ? k(!0) : C(g);
65
+ o ? y(!0) : C(b);
66
66
  }, B = (o) => {
67
67
  if (!o) {
68
- b(null);
68
+ g(null);
69
69
  return;
70
70
  }
71
71
  const [h, p] = o;
72
- b([h, p]);
72
+ g([h, p]);
73
73
  }, n = (o) => {
74
74
  if (!o || !o[0] || !o[1]) {
75
- b(null), i("", ""), N();
75
+ g(null), i("", ""), N();
76
76
  return;
77
77
  }
78
78
  const h = q(o[0].toDate()), p = X(o[1].toDate());
79
- i(Math.floor(h.getTime() / 1e3), Math.floor(p.getTime() / 1e3)), b([o[0], o[1]]), N();
79
+ i(Math.floor(h.getTime() / 1e3), Math.floor(p.getTime() / 1e3)), g([o[0], o[1]]), N();
80
80
  };
81
81
  return /* @__PURE__ */ e("div", { className: v(a), ...c, children: /* @__PURE__ */ l(O, { open: A, onOpenChange: R, children: [
82
82
  /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e("i", { className: "w-4 h-4 p-[2px] cursor-pointer flex items-center justify-center bg-[#000] rounded-sm", children: /* @__PURE__ */ e(D, { src: Ne, width: 12, height: 12 }) }) }),
83
- /* @__PURE__ */ e(Q, { className: "w-auto p-0", align: "center", side: "right", children: /* @__PURE__ */ e("div", { ref: w, className: "relative", children: /* @__PURE__ */ e(
83
+ /* @__PURE__ */ e(Q, { className: "w-auto p-0", align: "center", side: "right", children: /* @__PURE__ */ e("div", { ref: k, className: "relative", children: /* @__PURE__ */ e(
84
84
  ue.RangePicker,
85
85
  {
86
86
  open: !0,
87
87
  size: "small",
88
88
  locale: d[m],
89
89
  allowClear: !1,
90
- value: g ?? [M(), M()],
90
+ value: b ?? [M(), M()],
91
91
  onCalendarChange: B,
92
92
  onChange: n,
93
- getPopupContainer: () => w.current,
93
+ getPopupContainer: () => k.current,
94
94
  style: { position: "absolute", opacity: 0, width: 0, height: 0, pointerEvents: "none" },
95
95
  disabledDate: (o) => o && o > M().endOf("day")
96
96
  }
@@ -99,46 +99,46 @@ function ve({
99
99
  }
100
100
  const Ce = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADZSURBVHgB7ZTbDcIwDEVvUAfoCN2AjsAI3YBu0jABGYER2KAjABPABrBBcMARFkjNo/krR7IaWfZ1nDoB/gRQfmGt7enToAw3pdThu4BFQajAS7sSvh3ZwOsj2QVprMk6ofULNWHsmytZg0hcLOc4TCh4FEVqhMVrIT6idELqhnySbHk/ETfkHKlPbsnuLDBMiLuYFjm4u2E/bIW/E/4ecyABLXZa8/H5zjRKQEInFtywxU0MsUIcD2QSWyCb5RVInvcqMs7/ZHerzygNz74Wz0f0mM4pZLAInpppFh6wLb8LAAAAAElFTkSuQmCC";
101
101
  function je({ onChange: a, filterKey: i }) {
102
- const [c, m] = y(!1), A = J("common"), [k, w] = y(""), [g, b] = y(""), [d, f] = y([0.01, 1e10]), C = (p) => {
103
- f(p), w(p[0].toString()), b(p[1].toString());
102
+ const [c, m] = w(!1), A = J("common"), [y, k] = w(""), [b, g] = w(""), [d, f] = w([0.01, 1e10]), C = (p) => {
103
+ f(p), k(p[0].toString()), g(p[1].toString());
104
104
  }, N = (p) => {
105
105
  const x = p.target.value;
106
106
  if (x === "" || /^\d*\.?\d{0,8}$/.test(x) && !x.startsWith(".")) {
107
- w(x);
107
+ k(x);
108
108
  const T = parseFloat(x) || 0;
109
109
  f([T, d[1]]);
110
110
  }
111
111
  }, R = (p) => {
112
112
  const x = p.target.value;
113
113
  if (x === "" || /^\d*\.?\d{0,8}$/.test(x) && !x.startsWith(".")) {
114
- b(x);
114
+ g(x);
115
115
  const T = parseFloat(x);
116
116
  f([d[0], T]);
117
117
  }
118
118
  }, B = () => {
119
- a(k, g), m(!1);
119
+ a(y, b), m(!1);
120
120
  }, n = () => {
121
121
  m(!1);
122
122
  }, o = (p) => {
123
- p.target.value === "0" && w("0.01");
123
+ p.target.value === "0" && k("0.01");
124
124
  }, h = (p) => {
125
- p.target.value === "0" && b("0.01");
125
+ p.target.value === "0" && g("0.01");
126
126
  };
127
127
  return /* @__PURE__ */ l(O, { open: c, onOpenChange: m, children: [
128
128
  /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "w-[16px] h-[16px] flex items-center justify-center bg-[#000] rounded-sm cursor-pointer", children: /* @__PURE__ */ e(D, { src: Ce, width: 12, height: 12, objectFit: "contain" }) }) }),
129
129
  /* @__PURE__ */ e(Q, { className: "bg-card", children: /* @__PURE__ */ l("div", { className: "w-full h-full", children: [
130
130
  /* @__PURE__ */ l("div", { className: "flex flex-row items-center justify-between h-9", children: [
131
131
  /* @__PURE__ */ e("span", { className: "text-sm", children: /* @__PURE__ */ e(S, { value: "label", parentKey: "common.filter.amount" }) }),
132
- /* @__PURE__ */ e("div", { className: "w-4 h-4 text-black text-sm cursor-pointer flex items-center justify-center", onClick: () => n(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4" }) })
132
+ /* @__PURE__ */ e("div", { className: "w-4 h-4 text-foreground text-sm cursor-pointer flex items-center justify-center", onClick: () => n(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4" }) })
133
133
  ] }),
134
134
  /* @__PURE__ */ l("div", { className: "flex flex-row items-center justify-between gap-2 py-3", children: [
135
135
  /* @__PURE__ */ l("fieldset", { className: "w-1/2 h-full", children: [
136
136
  /* @__PURE__ */ e("label", { className: "w-full h-full text-sm", children: /* @__PURE__ */ e(S, { value: "form", parentKey: "common.filter.amount" }) }),
137
- /* @__PURE__ */ e("input", { type: "text", inputMode: "decimal", pattern: "[0-9]*\\.?[0-9]{0,8}", onBlur: o, placeholder: A("filter.amount.min"), className: "w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: k, onChange: N })
137
+ /* @__PURE__ */ e("input", { type: "text", inputMode: "decimal", pattern: "[0-9]*\\.?[0-9]{0,8}", onBlur: o, placeholder: A("filter.amount.min"), className: "w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: y, onChange: N })
138
138
  ] }),
139
139
  /* @__PURE__ */ l("fieldset", { className: "w-1/2 h-full", children: [
140
140
  /* @__PURE__ */ e("label", { className: "w-full h-full text-sm", children: /* @__PURE__ */ e(S, { value: "to", parentKey: "common.filter.amount" }) }),
141
- /* @__PURE__ */ e("input", { type: "text", inputMode: "decimal", pattern: "[0-9]*\\.?[0-9]{0,8}", onBlur: h, placeholder: A("filter.amount.max"), className: "w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: g, onChange: R })
141
+ /* @__PURE__ */ e("input", { type: "text", inputMode: "decimal", pattern: "[0-9]*\\.?[0-9]{0,8}", onBlur: h, placeholder: A("filter.amount.max"), className: "w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: b, onChange: R })
142
142
  ] })
143
143
  ] }),
144
144
  /* @__PURE__ */ l("div", { className: " w-full pb-4", children: [
@@ -164,7 +164,7 @@ function je({ onChange: a, filterKey: i }) {
164
164
  ] })
165
165
  ] }),
166
166
  /* @__PURE__ */ l("div", { className: "flex justify-end items-center", children: [
167
- /* @__PURE__ */ e("button", { className: "bg-card text-black text-sm px-3 py-1 border border-border rounded-lg ml-3 cursor-pointer", onClick: n, children: A("button.cancel") }),
167
+ /* @__PURE__ */ e("button", { className: "bg-card text-foreground text-sm px-3 py-1 border border-border rounded-lg ml-3 cursor-pointer", onClick: n, children: A("button.cancel") }),
168
168
  /* @__PURE__ */ e("button", { className: "bg-primary text-white text-sm px-3 py-1 rounded-lg ml-3 cursor-pointer", onClick: B, children: A("button.confirm") })
169
169
  ] })
170
170
  ] }) })
@@ -172,12 +172,12 @@ function je({ onChange: a, filterKey: i }) {
172
172
  }
173
173
  const H = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFFSURBVHgB5VVRccMwDFV2A+AxCIOZwQyhDGYGC4OGQcegYzAIgZANgcsgY6DJd9Kquk4Te9ef9t3pkpOf/CTFigHuAojoyPZkAY+YyAYyD/8BbdDyRksIVWIU9MrZStY9mSUzvB7fPdmoxLYlAlYFvsvGF/hdsRAee98rn+PWSXWjbhGvC9ySgJc+Z3w57BWvZ9+wJBKYuMkE/7WOhUOSjFGVujmBlglTbi3jM5h8L04kokv5j/xs+fmVEpqmOWR8P3AOiX1OFx4SkQNcASIimT1BPcySiJT6AvWQNn3PMtTpclABFW8vkeS4jlAusF07J0Zls4P1Anri7ZoAq4Zql5uRhP+m+AOsRZx4FRgr63SGPLhx6gc8R9HfuMXTi2oOEyfhq4RYLPb7A0/vjkD2yZsbxa0XKkxKC3m4Fvibxso3cHP4BWMxfN1YKiXJAAAAAElFTkSuQmCC";
174
174
  function Re({ onChange: a }) {
175
- const [i, c] = y(!1), m = J("common"), [A, k] = y(""), w = (d) => {
175
+ const [i, c] = w(!1), m = J("common"), [A, y] = w(""), k = (d) => {
176
176
  const f = d.target.value;
177
- (f === "" || /^[a-zA-Z0-9]*$/.test(f)) && k(f);
178
- }, g = () => {
179
- a(A), c(!1);
177
+ (f === "" || /^[a-zA-Z0-9]*$/.test(f)) && y(f);
180
178
  }, b = () => {
179
+ a(A), c(!1);
180
+ }, g = () => {
181
181
  c(!1);
182
182
  };
183
183
  return /* @__PURE__ */ l(O, { open: i, onOpenChange: c, children: [
@@ -186,16 +186,16 @@ function Re({ onChange: a }) {
186
186
  /* @__PURE__ */ l("fieldset", { className: "w-full h-full", children: [
187
187
  /* @__PURE__ */ l("label", { className: "w-full h-full text-sm flex items-center justify-between", children: [
188
188
  m("filter.address.label"),
189
- /* @__PURE__ */ e("div", { className: "w-4 h-4 text-black text-sm cursor-pointer flex items-center justify-center", onClick: () => b(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4" }) })
189
+ /* @__PURE__ */ e("div", { className: "w-4 h-4 text-f text-sm cursor-pointer flex items-center justify-center", onClick: () => g(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4" }) })
190
190
  ] }),
191
191
  /* @__PURE__ */ l("div", { className: "w-full relative text-sm ", children: [
192
192
  /* @__PURE__ */ e(V, { className: "w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2" }),
193
- /* @__PURE__ */ e("input", { placeholder: m("filter.amount.label"), type: "text", pattern: "[a-zA-Z0-9]*", className: "pl-6 w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: A, onChange: w })
193
+ /* @__PURE__ */ e("input", { placeholder: m("filter.amount.label"), type: "text", pattern: "[a-zA-Z0-9]*", className: "pl-6 w-full h-full bg-card text-sm border-1 border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: A, onChange: k })
194
194
  ] })
195
195
  ] }),
196
196
  /* @__PURE__ */ l("div", { className: "flex justify-end items-center mt-2", children: [
197
- /* @__PURE__ */ e("button", { className: "bg-card text-black text-sm px-3 py-1 border border-gray-300 rounded ml-3 cursor-pointer", onClick: b, children: m("button.cancel") }),
198
- /* @__PURE__ */ e("button", { className: "bg-primary text-white text-sm px-3 py-1 rounded ml-3 cursor-pointer", onClick: g, children: m("button.confirm") })
197
+ /* @__PURE__ */ e("button", { className: "bg-card text-foreground text-sm px-3 py-1 border rounded ml-3 cursor-pointer", onClick: g, children: m("button.cancel") }),
198
+ /* @__PURE__ */ e("button", { className: "bg-primary text-white text-sm px-3 py-1 rounded ml-3 cursor-pointer", onClick: b, children: m("button.confirm") })
199
199
  ] })
200
200
  ] }) })
201
201
  ] });
@@ -208,37 +208,37 @@ const Be = (a) => _.get("/api/v2/tokens/hot-list", { params: { ...a, limit: 100,
208
208
  }
209
209
  });
210
210
  function Te({ onChange: a }) {
211
- const { chain: i } = ee(), c = J("common.filter.amount"), [m, A] = y(!1), [k, w] = y(""), [g, b] = y([]), [d, f] = y([]), C = () => {
211
+ const { chain: i } = ee(), c = J("common.filter.amount"), [m, A] = w(!1), [y, k] = w(""), [b, g] = w([]), [d, f] = w([]), C = () => {
212
212
  A(!1);
213
213
  }, N = () => {
214
214
  a(d), A(!1);
215
215
  }, R = (n) => {
216
216
  d.some((o) => o.tokenAddress === n.tokenAddress) ? f(d.filter((o) => o.tokenAddress !== n.tokenAddress)) : f([...d, n]);
217
- }, B = ye(async () => {
217
+ }, B = we(async () => {
218
218
  const n = await Be({
219
219
  chain: i,
220
- text: k,
220
+ text: y,
221
221
  limit: 100,
222
222
  page: 1
223
223
  });
224
- b((n == null ? void 0 : n.data) || []);
224
+ g((n == null ? void 0 : n.data) || []);
225
225
  }, { wait: 300 });
226
226
  return z(() => {
227
227
  B.run();
228
- }, [i, k]), /* @__PURE__ */ l(O, { open: m, onOpenChange: A, children: [
228
+ }, [i, y]), /* @__PURE__ */ l(O, { open: m, onOpenChange: A, children: [
229
229
  /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "w-[16px] h-[16px] flex items-center justify-center bg-[#000] rounded-sm cursor-pointer", children: /* @__PURE__ */ e(D, { src: H, width: 12, height: 12, objectFit: "contain" }) }) }),
230
230
  /* @__PURE__ */ l(Q, { className: "py-5 bg-card", children: [
231
231
  /* @__PURE__ */ l("div", { className: "w-full h-full", children: [
232
232
  /* @__PURE__ */ l("div", { className: "flex flex-row items-center justify-between h-9", children: [
233
233
  /* @__PURE__ */ e("span", { className: "text-base text-foreground", children: /* @__PURE__ */ e(S, { value: "label", parentKey: "common.filter.token" }) }),
234
- /* @__PURE__ */ e("div", { className: "w-4 h-4 text-black text-sm cursor-pointer flex items-center justify-center", onClick: () => C(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4 text-foreground" }) })
234
+ /* @__PURE__ */ e("div", { className: "w-4 h-4 text-foreground text-sm cursor-pointer flex items-center justify-center", onClick: () => C(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4 text-foreground" }) })
235
235
  ] }),
236
236
  /* @__PURE__ */ l("div", { className: "w-full relative text-sm py-3", children: [
237
237
  /* @__PURE__ */ e(V, { className: "w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2" }),
238
- /* @__PURE__ */ e("input", { type: "text", placeholder: c("label"), className: "pl-6 w-full h-full bg-card text-sm border border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: k, onChange: (n) => w(n.target.value) })
238
+ /* @__PURE__ */ e("input", { type: "text", placeholder: c("label"), className: "pl-6 w-full h-full bg-card text-sm border border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: y, onChange: (n) => k(n.target.value) })
239
239
  ] })
240
240
  ] }),
241
- /* @__PURE__ */ e("ul", { className: "max-h-30 min-h-30 overflow-y-auto overflow-x-hidden w-full", children: g == null ? void 0 : g.map((n, o) => /* @__PURE__ */ l("li", { className: "flex h-10 flex-row items-center gap-3 hover:bg-background hover:rounded-sm p-2 cursor-pointer overflow-hidden", onClick: () => R(n), children: [
241
+ /* @__PURE__ */ e("ul", { className: "max-h-30 min-h-30 overflow-y-auto overflow-x-hidden w-full", children: b == null ? void 0 : b.map((n, o) => /* @__PURE__ */ l("li", { className: "flex h-10 flex-row items-center gap-3 hover:bg-background hover:rounded-sm p-2 cursor-pointer overflow-hidden", onClick: () => R(n), children: [
242
242
  /* @__PURE__ */ e(D, { src: n.iconUrl, objectFit: "contain", alt: n.tokenSymbol, className: "rounded-full w-4 h-4 min-w-4 min-h-4 flex-shrink-0" }),
243
243
  /* @__PURE__ */ l("div", { className: "text-sm text-foreground text-left truncate min-w-0 flex-1 overflow-hidden", children: [
244
244
  /* @__PURE__ */ e("span", { className: "text-foreground", children: n.tokenSymbol }),
@@ -248,46 +248,46 @@ function Te({ onChange: a }) {
248
248
  /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(te, { className: v("w-4 h-4 cursor-pointer border border-gray-300 rounded-sm", d.some((h) => h.tokenAddress === n.tokenAddress) ? "bg-primary" : "bg-card"), checked: d.some((h) => h.tokenAddress === n.tokenAddress) }) })
249
249
  ] }, o)) }),
250
250
  /* @__PURE__ */ l("div", { className: "flex justify-end items-center mt-2", children: [
251
- /* @__PURE__ */ e("button", { className: "bg-card text-black text-sm px-3 py-1 border border-gray-300 rounded ml-3 cursor-pointer", onClick: C, children: /* @__PURE__ */ e(S, { value: "button.cancel", parentKey: "common" }) }),
251
+ /* @__PURE__ */ e("button", { className: "bg-card text-foreground text-sm px-3 py-1 border rounded ml-3 cursor-pointer", onClick: C, children: /* @__PURE__ */ e(S, { value: "button.cancel", parentKey: "common" }) }),
252
252
  /* @__PURE__ */ e("button", { className: "bg-primary text-white text-sm px-3 py-1 rounded ml-3 cursor-pointer", onClick: N, children: /* @__PURE__ */ e(S, { value: "button.confirm", parentKey: "common" }) })
253
253
  ] })
254
254
  ] })
255
255
  ] });
256
256
  }
257
257
  function De({ onChange: a }) {
258
- const { chain: i = "" } = ee(), c = J("common.filter.amount"), [m, A] = y(!1), [k, w] = y(""), [g, b] = y([]), [d, f] = y([]), C = () => {
259
- a([]), w(""), f([]), A(!1);
258
+ const { chain: i = "" } = ee(), c = J("common.filter.amount"), [m, A] = w(!1), [y, k] = w(""), [b, g] = w([]), [d, f] = w([]), C = () => {
259
+ a([]), k(""), f([]), A(!1);
260
260
  }, N = () => {
261
261
  a(d), A(!1);
262
262
  }, R = (n) => {
263
263
  d.some((o) => o.tokenAddress === n.tokenAddress) ? f(d.filter((o) => o.tokenAddress !== n.tokenAddress)) : f([...d, n]);
264
264
  }, B = async () => {
265
265
  var o;
266
- const n = await Se(k);
267
- b(((o = n == null ? void 0 : n.data) == null ? void 0 : o.content) || []);
266
+ const n = await Se(y);
267
+ g(((o = n == null ? void 0 : n.data) == null ? void 0 : o.content) || []);
268
268
  };
269
269
  return z(() => {
270
270
  B();
271
- }, [i, k]), /* @__PURE__ */ l(O, { open: m, onOpenChange: A, children: [
271
+ }, [i, y]), /* @__PURE__ */ l(O, { open: m, onOpenChange: A, children: [
272
272
  /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "w-[16px] h-[16px] flex items-center justify-center bg-[#000] rounded-sm cursor-pointer", children: /* @__PURE__ */ e(D, { src: H, width: 12, height: 12, objectFit: "contain" }) }) }),
273
273
  /* @__PURE__ */ l(Q, { className: "py-5 bg-card", children: [
274
274
  /* @__PURE__ */ l("div", { className: "w-full h-full bg-card", children: [
275
275
  /* @__PURE__ */ l("div", { className: "flex flex-row items-center justify-between h-9", children: [
276
276
  /* @__PURE__ */ e("span", { className: "text-base text-foreground", children: /* @__PURE__ */ e(S, { value: "label", parentKey: "common.filter.token" }) }),
277
- /* @__PURE__ */ e("div", { className: "w-4 h-4 text-black text-sm cursor-pointer flex items-center justify-center", onClick: () => C(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4 text-foreground" }) })
277
+ /* @__PURE__ */ e("div", { className: "w-4 h-4 text-foreground text-sm cursor-pointer flex items-center justify-center", onClick: () => C(), children: /* @__PURE__ */ e(W, { className: "w-4 h-4 text-foreground" }) })
278
278
  ] }),
279
279
  /* @__PURE__ */ l("div", { className: "w-full relative bg-card text-sm py-3", children: [
280
280
  /* @__PURE__ */ e(V, { className: "w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2" }),
281
- /* @__PURE__ */ e("input", { type: "text", placeholder: c("label"), className: "pl-6 w-full h-full bg-card text-sm border border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: k, onChange: (n) => w(n.target.value) })
281
+ /* @__PURE__ */ e("input", { type: "text", placeholder: c("label"), className: "pl-6 w-full h-full bg-card text-sm border border-gray-300 rounded p-2 my-2 focus-visible:outline-primary placeholder:text-gray-400", value: y, onChange: (n) => k(n.target.value) })
282
282
  ] })
283
283
  ] }),
284
- /* @__PURE__ */ e("ul", { className: "max-h-50 min-h-25 overflow-y-auto overflow-x-hidden w-full", children: g == null ? void 0 : g.map((n, o) => /* @__PURE__ */ l("li", { className: "flex h-10 flex-row items-center gap-3 hover:bg-background hover:rounded-sm p-2 cursor-pointer overflow-hidden", onClick: () => R(n), children: [
284
+ /* @__PURE__ */ e("ul", { className: "max-h-50 min-h-25 overflow-y-auto overflow-x-hidden w-full", children: b == null ? void 0 : b.map((n, o) => /* @__PURE__ */ l("li", { className: "flex h-10 flex-row items-center gap-3 hover:bg-background hover:rounded-sm p-2 cursor-pointer overflow-hidden", onClick: () => R(n), children: [
285
285
  /* @__PURE__ */ e(D, { src: n.iconUrl, objectFit: "contain", alt: n.tokenName, className: "rounded-full w-4 h-4 min-w-4 min-h-4 flex-shrink-0" }),
286
286
  /* @__PURE__ */ e("div", { className: "text-sm text-foreground text-left truncate min-w-0 flex-1 overflow-hidden", children: n.tokenName }),
287
287
  /* @__PURE__ */ e("div", { className: "shrink-0", children: /* @__PURE__ */ e(te, { className: v("w-4 h-4 cursor-pointer border border-gray-300 rounded-sm", d.some((h) => h.tokenAddress === n.tokenAddress) ? "bg-primary" : "bg-white"), checked: d.some((h) => h.tokenAddress === n.tokenAddress) }) })
288
288
  ] }, o)) }),
289
289
  /* @__PURE__ */ l("div", { className: "flex justify-end items-center mt-2", children: [
290
- /* @__PURE__ */ e("button", { className: "bg-card text-black text-sm px-3 py-1 border border-gray-300 rounded ml-3 cursor-pointer", onClick: C, children: /* @__PURE__ */ e(S, { value: "button.cancel", parentKey: "common" }) }),
290
+ /* @__PURE__ */ e("button", { className: "bg-card text-foreground text-sm px-3 py-1 border rounded ml-3 cursor-pointer", onClick: C, children: /* @__PURE__ */ e(S, { value: "button.cancel", parentKey: "common" }) }),
291
291
  /* @__PURE__ */ e("button", { className: "bg-primary text-white text-sm px-3 py-1 rounded ml-3 cursor-pointer", onClick: N, children: /* @__PURE__ */ e(S, { value: "button.confirm", parentKey: "common" }) })
292
292
  ] })
293
293
  ] })
@@ -301,8 +301,8 @@ const Pe = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAYAAABX5MJvAA
301
301
  c === "timestamp" ? (i.filters.startTime = a.timestamp.start, i.filters.endTime = a.timestamp.end) : c === "fromAddress" ? i.filters.fromAddress = a.fromAddress.address : c === "toAddress" ? i.filters.toAddress = a.toAddress.address : c === "valueUsd" ? (i.filters.minValueUsd = a.valueUsd.min, i.filters.maxValueUsd = a.valueUsd.max) : c === "amount" ? (i.filters.minAmount = a.amount.min, i.filters.maxAmount = a.amount.max) : c === "token" ? i.filters.tokenList = a.token.map((m) => m.tokenAddress) : c === "tokenSearch" ? i.filters.tokenList = a.tokenSearch.map((m) => m.tokenAddress) : c === "inputAmount" ? (i.filters.minInputAmount = a.inputAmount.min, i.filters.maxInputAmount = a.inputAmount.max) : c === "outputAmount" ? (i.filters.minOutputAmount = a.outputAmount.min, i.filters.maxOutputAmount = a.outputAmount.max) : c === "fee" && (i.filters.minFee = a.fee.min, i.filters.maxFee = a.fee.max);
302
302
  }), i.filters;
303
303
  };
304
- function dt({ data: a, columns: i, headerClassName: c, bodyClassName: m, rowClassName: A, tableClassName: k, showHeader: w = !0, renderChildren: g, onFilterChange: b, loading: d, onSortChange: f, defaultOrder: C, defaultSortKey: N, emptyClassName: R, ...B }) {
305
- const [n, o] = y(null), [h, p] = y({}), [x, T] = y(N || null), [L, re] = y(C || null), I = (t, r) => {
304
+ function dt({ data: a, columns: i, headerClassName: c, bodyClassName: m, rowClassName: A, tableClassName: y, showHeader: k = !0, renderChildren: b, onFilterChange: g, loading: d, onSortChange: f, defaultOrder: C, defaultSortKey: N, emptyClassName: R, ...B }) {
305
+ const [n, o] = w(null), [h, p] = w({}), [x, T] = w(N || null), [L, re] = w(C || null), I = (t, r) => {
306
306
  o((s) => ({
307
307
  ...s,
308
308
  [t]: r
@@ -367,9 +367,9 @@ function dt({ data: a, columns: i, headerClassName: c, bodyClassName: m, rowClas
367
367
  T(t), re(r), f == null || f(t, r);
368
368
  }, F = i.filter((t) => !t.hidden), le = F.some((t) => t.filter);
369
369
  return z(() => {
370
- n !== null && (b == null || b(n));
370
+ n !== null && (g == null || g(n));
371
371
  }, [n]), /* @__PURE__ */ l("div", { className: "overflow-auto min-w-full relative", ...B, children: [
372
- /* @__PURE__ */ e(we, { loading: d }),
372
+ /* @__PURE__ */ e(ke, { loading: d }),
373
373
  le && n && Object.keys(n).length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-row gap-3 flex-nowrap overflow-x-auto scrollbar-hide pb-3", children: F.map((t) => {
374
374
  if (!n) return null;
375
375
  const r = n == null ? void 0 : n[t.key];
@@ -389,8 +389,8 @@ function dt({ data: a, columns: i, headerClassName: c, bodyClassName: m, rowClas
389
389
  )
390
390
  ] }, t.key);
391
391
  }) }),
392
- /* @__PURE__ */ l(ie, { className: v("", k), children: [
393
- w && /* @__PURE__ */ e(ce, { className: v("border-b border-border", c), children: /* @__PURE__ */ e(E, { className: "border-b-0 hover:bg-transparent", children: F.map((t, r) => {
392
+ /* @__PURE__ */ l(ie, { className: v("", y), children: [
393
+ k && /* @__PURE__ */ e(ce, { className: v("border-b border-border", c), children: /* @__PURE__ */ e(E, { className: "border-b-0 hover:bg-transparent", children: F.map((t, r) => {
394
394
  var s;
395
395
  return /* @__PURE__ */ e(de, { className: v("text-left", "whitespace-nowrap"), style: { width: t.width }, children: /* @__PURE__ */ l("div", { className: v("flex items-center gap-1 min-w-fit w-full whitespace-nowrap", t.align === "center" && "justify-center", t.align === "right" && "justify-end", (s = t.className) == null ? void 0 : s.call(t, t, r)), children: [
396
396
  t.label,
@@ -403,8 +403,8 @@ function dt({ data: a, columns: i, headerClassName: c, bodyClassName: m, rowClas
403
403
  var j;
404
404
  return /* @__PURE__ */ e(K, { className: v("text-left min-w-fit py-4", s.align === "center" && "text-center", s.align === "right" && "text-right", "whitespace-nowrap", (j = s.className) == null ? void 0 : j.call(s, s, r, a[r])), style: { width: s.width }, children: s.render ? s.render(t[s.key], t, r) : Fe(t[s.key]) }, u);
405
405
  }) }, r),
406
- g && /* @__PURE__ */ e(E, { className: "border-b-0", children: /* @__PURE__ */ e(K, { colSpan: F.length, className: "p-0", children: g(t, r) }) })
407
- ] }, r)) : /* @__PURE__ */ e(E, { className: "hover:bg-transparent data-[state=selected]:bg-transparent", children: /* @__PURE__ */ e(K, { colSpan: F.length, className: "w-full text-center", children: /* @__PURE__ */ e(ke, { className: v("w-full h-38", R) }) }) }) })
406
+ b && /* @__PURE__ */ e(E, { className: "border-b-0", children: /* @__PURE__ */ e(K, { colSpan: F.length, className: "p-0", children: b(t, r) }) })
407
+ ] }, r)) : /* @__PURE__ */ e(E, { className: "hover:bg-transparent data-[state=selected]:bg-transparent", children: /* @__PURE__ */ e(K, { colSpan: F.length, className: "w-full text-center", children: /* @__PURE__ */ e(ye, { className: v("w-full h-38", R) }) }) }) })
408
408
  ] })
409
409
  ] });
410
410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xchain/table",
3
- "version": "1.1.0-beta.14",
3
+ "version": "1.1.0-beta.16",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -33,15 +33,15 @@
33
33
  "antd": "6.1.1",
34
34
  "ahooks": "3.9.5",
35
35
  "@radix-ui/react-slider": "1.3.6",
36
- "@0xchain/ui": "1.1.0-beta.14",
37
- "@0xchain/image": "1.1.0-beta.14",
38
- "@0xchain/translation": "1.1.0-beta.14",
39
- "@0xchain/iconfont": "1.1.0-beta.14",
40
- "@0xchain/empty": "1.1.0-beta.14",
41
- "@0xchain/number-like": "1.1.0-beta.14",
42
- "@0xchain/request": "1.1.0-beta.14",
43
- "@0xchain/i18n": "1.1.0-beta.14",
44
- "@0xchain/loading": "1.1.0-beta.14"
36
+ "@0xchain/empty": "1.1.0-beta.16",
37
+ "@0xchain/ui": "1.1.0-beta.16",
38
+ "@0xchain/loading": "1.1.0-beta.16",
39
+ "@0xchain/image": "1.1.0-beta.16",
40
+ "@0xchain/i18n": "1.1.0-beta.16",
41
+ "@0xchain/translation": "1.1.0-beta.16",
42
+ "@0xchain/iconfont": "1.1.0-beta.16",
43
+ "@0xchain/number-like": "1.1.0-beta.16",
44
+ "@0xchain/request": "1.1.0-beta.16"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"