@blofin/blofin-ui 0.7.31 → 0.7.33

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 (94) hide show
  1. package/dist/Slider.es.js +184 -171
  2. package/dist/blofin.css +1 -1
  3. package/dist/components/Slider/Slider.d.ts +31 -1
  4. package/dist/components/Sort/SortButton.d.ts +2 -0
  5. package/dist/{index-4969b2d4.js → index-026ebcd9.js} +1 -1
  6. package/dist/{index-465a1b8f.js → index-057254bc.js} +1 -1
  7. package/dist/{index-9d87a86d.js → index-0800b770.js} +1 -1
  8. package/dist/{index-f4e0d963.js → index-080a34d9.js} +1 -1
  9. package/dist/{index-7b2c3626.js → index-093de6dd.js} +1 -1
  10. package/dist/{index-26266fd3.js → index-0976e37f.js} +1 -1
  11. package/dist/{index-cab17fcf.js → index-0c51087e.js} +2 -2
  12. package/dist/{index-24d1e949.js → index-0c874740.js} +2 -2
  13. package/dist/{index-9c3ed4d4.js → index-1036ba3d.js} +1 -1
  14. package/dist/{index-a95ae46d.js → index-12d9f414.js} +1 -1
  15. package/dist/{index-667c2149.js → index-13b4fd7d.js} +1 -1
  16. package/dist/{index-6cc045e9.js → index-19f80f45.js} +1 -1
  17. package/dist/{index-5f6a2b7f.js → index-1f4eda8b.js} +1 -1
  18. package/dist/{index-b346d308.js → index-20d7063d.js} +1 -1
  19. package/dist/{index-0be70ef2.js → index-21c40f1d.js} +1 -1
  20. package/dist/{index-8b2573d0.js → index-26863cab.js} +2 -2
  21. package/dist/{index-5b6067ce.js → index-2ae46fb9.js} +1 -1
  22. package/dist/{index-e823abb3.js → index-2bbabb69.js} +1 -1
  23. package/dist/{index-f80a2ff9.js → index-30c50c7f.js} +1 -1
  24. package/dist/{index-729ab697.js → index-33153c0a.js} +1 -1
  25. package/dist/{index-ce79e48d.js → index-34be45d7.js} +1 -1
  26. package/dist/{index-b967a2e7.js → index-3b9c234b.js} +3 -3
  27. package/dist/{index-90e62757.js → index-3c5c556b.js} +2 -2
  28. package/dist/{index-a5f58af2.js → index-3cf41b01.js} +1 -1
  29. package/dist/{index-2fe092f8.js → index-3e9e993b.js} +1 -1
  30. package/dist/{index-ac507b75.js → index-3f8aa119.js} +2 -2
  31. package/dist/{index-0dcd6e3b.js → index-415978d5.js} +1 -1
  32. package/dist/{index-ad892e27.js → index-42ba09d2.js} +2 -2
  33. package/dist/{index-5aaa4b96.js → index-4cd6e331.js} +2 -2
  34. package/dist/{index-d3824d09.js → index-5756dd70.js} +1 -1
  35. package/dist/{index-d7539f15.js → index-58081556.js} +1 -1
  36. package/dist/{index-e745323d.js → index-6d4ce315.js} +2 -2
  37. package/dist/{index-8a38785c.js → index-6e08efad.js} +1 -1
  38. package/dist/{index-d5f997f0.js → index-6fea2098.js} +1 -1
  39. package/dist/{index-87414e65.js → index-70437360.js} +1 -1
  40. package/dist/{index-c75400e2.js → index-708f6f19.js} +1 -1
  41. package/dist/{index-40dd019b.js → index-71ac4eab.js} +1 -1
  42. package/dist/{index-327f0eb8.js → index-79398178.js} +2 -2
  43. package/dist/{index-a163e2cf.js → index-795f8729.js} +1 -1
  44. package/dist/{index-10f1f67a.js → index-7df23a5a.js} +1 -1
  45. package/dist/{index-baf7e4ef.js → index-7f6a192c.js} +1 -1
  46. package/dist/{index-9038e582.js → index-87d3c649.js} +1 -1
  47. package/dist/{index-d7d71c9a.js → index-8f8bdea6.js} +2 -2
  48. package/dist/{index-f1df569c.js → index-9249573b.js} +1 -1
  49. package/dist/{index-e7e20661.js → index-92c84b5a.js} +2 -2
  50. package/dist/{index-b29cd115.js → index-9b094f4d.js} +1 -1
  51. package/dist/{index-39381109.js → index-9e2105c6.js} +1 -1
  52. package/dist/{index-28dd85e9.js → index-a2bc3886.js} +1 -1
  53. package/dist/{index-7a255491.js → index-a3613a03.js} +1 -1
  54. package/dist/{index-ddafcdbd.js → index-a3e375be.js} +1 -1
  55. package/dist/{index-fb4f1f0f.js → index-a88f4aa1.js} +1 -1
  56. package/dist/{index-3daff147.js → index-aa7d96e0.js} +1 -1
  57. package/dist/{index-4bb94c88.js → index-aaab606a.js} +1 -1
  58. package/dist/{index-56ebd12d.js → index-aee6d836.js} +1 -1
  59. package/dist/{index-1937d4bd.js → index-b0b5453f.js} +2 -2
  60. package/dist/{index-c38ee75f.js → index-b1593e8f.js} +1 -1
  61. package/dist/{index-95b235d2.js → index-b40d53c7.js} +1 -1
  62. package/dist/{index-60fb032c.js → index-b4a929de.js} +1 -1
  63. package/dist/{index-283b970a.js → index-b5652b5c.js} +1 -1
  64. package/dist/{index-bd4c24fa.js → index-b5debd42.js} +1 -1
  65. package/dist/{index-833135cf.js → index-b70912dd.js} +2 -2
  66. package/dist/{index-0b011404.js → index-b886c18c.js} +1 -1
  67. package/dist/{index-f802247e.js → index-b8ac16a1.js} +1182 -1179
  68. package/dist/{index-cc85c09c.js → index-ba4b4dd6.js} +1 -1
  69. package/dist/{index-b585a1dd.js → index-bc3781f4.js} +1 -1
  70. package/dist/{index-e85f011d.js → index-bcb3f2fb.js} +2 -2
  71. package/dist/{index-a04e246a.js → index-beda3133.js} +1 -1
  72. package/dist/{index-edc951a0.js → index-c04d9054.js} +1 -1
  73. package/dist/{index-f48064ab.js → index-c0ee3992.js} +1 -1
  74. package/dist/{index-6beb3faf.js → index-c734496a.js} +2 -2
  75. package/dist/{index-7a76d54a.js → index-cab1642b.js} +1 -1
  76. package/dist/{index-b0c2f632.js → index-cf056cd9.js} +1 -1
  77. package/dist/{index-8186be25.js → index-d64b1716.js} +1 -1
  78. package/dist/{index-416a257b.js → index-d650c38b.js} +2 -2
  79. package/dist/{index-c73fc6c7.js → index-d72736fc.js} +1 -1
  80. package/dist/{index-16c12de7.js → index-d8e8d9e6.js} +1 -1
  81. package/dist/{index-fb97002a.js → index-daf2234a.js} +1 -1
  82. package/dist/{index-4e116e6f.js → index-db0cecea.js} +1 -1
  83. package/dist/{index-a8de059c.js → index-e2aa3cdf.js} +1 -1
  84. package/dist/{index-d01dbcb6.js → index-e3dd1369.js} +1 -1
  85. package/dist/{index-821488d0.js → index-e96af436.js} +1 -1
  86. package/dist/{index-020c5a3c.js → index-e9e08371.js} +1 -1
  87. package/dist/{index-b93af4d7.js → index-eb7bbcc8.js} +1 -1
  88. package/dist/{index-3b825bbf.js → index-ec713531.js} +1 -1
  89. package/dist/{index-eb56ba0d.js → index-ed51942b.js} +1 -1
  90. package/dist/{index-75c41413.js → index-f3a4c713.js} +3 -3
  91. package/dist/{index-fc810d16.js → index-fa46fdfa.js} +1 -1
  92. package/dist/{index-86b37b35.js → index-fe42569f.js} +1 -1
  93. package/dist/index.es.js +1 -1
  94. package/package.json +1 -1
package/dist/Slider.es.js CHANGED
@@ -1,75 +1,75 @@
1
- import { j as t } from "./jsx-runtime-944c88e2.js";
2
- import { forwardRef as S, useRef as x, useState as w, useCallback as E } from "react";
3
- import { a as l, u as R } from "./index-96a8d125.js";
4
- import { c as i } from "./utils-7e50508b.js";
5
- const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", L = "_mark_1f4y3_23", P = "_tooltip_1f4y3_53", A = "_thumb_1f4y3_50", n = {
6
- "slider-container": "_slider-container_1f4y3_1",
7
- "slider-content": "_slider-content_1f4y3_4",
8
- rail: T,
9
- track: X,
10
- "mark-container": "_mark-container_1f4y3_23",
11
- mark: L,
12
- "mark-label": "_mark-label_1f4y3_39",
13
- "thumb-container": "_thumb-container_1f4y3_50",
14
- tooltip: P,
15
- thumb: A
16
- }, B = l("", {
1
+ import { j as i } from "./jsx-runtime-944c88e2.js";
2
+ import { forwardRef as J, useRef as T, useMemo as K, useState as Q, useCallback as E } from "react";
3
+ import { a as g, u as U } from "./index-96a8d125.js";
4
+ import { c as p } from "./utils-7e50508b.js";
5
+ const W = "_rail_ppjl3_7", Y = "_track_ppjl3_15", Z = "_mark_ppjl3_23", ee = "_tooltip_ppjl3_67", te = "_thumb_ppjl3_64", h = {
6
+ "slider-container": "_slider-container_ppjl3_1",
7
+ "slider-content": "_slider-content_ppjl3_4",
8
+ rail: W,
9
+ track: Y,
10
+ "mark-container": "_mark-container_ppjl3_23",
11
+ mark: Z,
12
+ "mark-label": "_mark-label_ppjl3_46",
13
+ "thumb-container": "_thumb-container_ppjl3_64",
14
+ tooltip: ee,
15
+ thumb: te
16
+ }, re = g("", {
17
17
  variants: {
18
18
  theme: {
19
19
  light: ["bu-bg-light-line-secondary"],
20
20
  dark: ["bu-bg-dark-line-secondary"]
21
21
  }
22
22
  }
23
- }), q = l("", {
23
+ }), ae = g("", {
24
24
  variants: {
25
25
  theme: {
26
26
  light: ["bu-bg-light-primary"],
27
27
  dark: ["bu-bg-dark-primary"]
28
28
  }
29
29
  }
30
- }), z = l("", {
30
+ }), ne = g("", {
31
31
  variants: {
32
32
  theme: {
33
33
  light: ["bu-bg-light-label-60"],
34
34
  dark: ["bu-bg-dark-label"]
35
35
  }
36
36
  }
37
- }), b = l("", {
37
+ }), le = g("", {
38
38
  variants: {
39
39
  theme: {
40
40
  light: ["bu-border-light-line-secondary bu-bg-light-background"],
41
41
  dark: ["bu-border-dark-line-secondary bu-bg-dark-background"]
42
42
  }
43
43
  }
44
- }), F = l("bu-transition-colors", {
44
+ }), oe = g("bu-transition-colors", {
45
45
  variants: {
46
46
  theme: {
47
47
  light: ["bu-border-light-primary"],
48
48
  dark: ["bu-border-dark-primary"]
49
49
  }
50
50
  }
51
- }), j = l("", {
51
+ }), se = g("", {
52
52
  variants: {
53
53
  theme: {
54
54
  light: ["bu-text-light-label-60"],
55
55
  dark: ["bu-text-dark-label-60"]
56
56
  }
57
57
  }
58
- }), G = l("", {
58
+ }), ie = g("", {
59
59
  variants: {
60
60
  theme: {
61
61
  light: ["bu-border-light-primary bu-bg-light-background"],
62
62
  dark: ["bu-border-dark-primary bu-bg-dark-background"]
63
63
  }
64
64
  }
65
- }), N = l("", {
65
+ }), L = g("", {
66
66
  variants: {
67
67
  theme: {
68
68
  light: ["!bu-border-light-label-60 bu-bg-light-background"],
69
69
  dark: ["!bu-border-dark-label bu-bg-dark-background"]
70
70
  }
71
71
  }
72
- }), H = l("after:border", {
72
+ }), ce = g("after:border", {
73
73
  variants: {
74
74
  theme: {
75
75
  light: [
@@ -80,163 +80,176 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", L = "_mark_1f4y3_23", P = "_to
80
80
  ]
81
81
  }
82
82
  }
83
- }), Q = S((C, M) => {
84
- const { value: s, onSliderChange: u, onDragEnd: v, theme: r, id: o } = C, { theme: a } = R(), p = x(null), k = (e) => {
85
- var $;
86
- e.stopPropagation(), e.preventDefault();
87
- const { left: c, right: f } = (($ = p.current) == null ? void 0 : $.getBoundingClientRect()) || {
88
- left: 0,
89
- right: 0
90
- };
91
- e.clientX >= c && e.clientX <= f ? u(Math.ceil((e.clientX - c) / (f - c) * 100)) : e.clientX < c && e.clientX > 0 ? u(0) : e.clientX > f && u(100);
92
- }, h = x(!1), [g, _] = w(!1), D = (e) => {
93
- e.stopPropagation(), e.preventDefault(), document.activeElement.blur(), h.current = !0, _(!0), document.addEventListener(
83
+ });
84
+ function P(m, t, o) {
85
+ return Math.max(t, Math.min(m, o));
86
+ }
87
+ function R(m, t, o, u) {
88
+ if (o === t)
89
+ return 0;
90
+ let s = (m - t) / (o - t) * 100;
91
+ return typeof u == "number" && (s = Number(s.toFixed(A(u)))), s;
92
+ }
93
+ function A(m) {
94
+ const t = m.toString();
95
+ return t.indexOf(".") === -1 ? 0 : t.split(".")[1].length;
96
+ }
97
+ function F(m, t, o, u, s, n) {
98
+ if (s === u)
99
+ return t;
100
+ let c = (m - u) / (s - u);
101
+ c = P(c, 0, 1);
102
+ let a = t + c * (o - t);
103
+ return a = Math.round((a - t) / n) * n + t, a = Number(a.toFixed(A(n))), P(a, t, o);
104
+ }
105
+ const me = J((m, t) => {
106
+ const {
107
+ value: o,
108
+ onSliderChange: u,
109
+ onDragEnd: s,
110
+ theme: n,
111
+ id: c,
112
+ min: a = 0,
113
+ max: d = 100,
114
+ step: k = 1,
115
+ marks: _ = [25, 50, 75],
116
+ labels: y = [0, 100],
117
+ className: X,
118
+ renderLabel: w = (e) => `${e}%`
119
+ } = m, { theme: b } = U(), j = T(null), B = K(() => {
120
+ const e = Array.from(new Set(_.concat([a, ...y, d]))).sort((r, f) => r - f), l = [];
121
+ return e.forEach((r) => {
122
+ r >= a && r <= d && l.push({
123
+ value: r,
124
+ showLabel: y.includes(r) || r === a || r === d,
125
+ showMark: _.includes(r) || r === a || r === d
126
+ });
127
+ }), l;
128
+ }, [_, a, d, k, y]), O = (e) => p(
129
+ le({ theme: n || b }),
130
+ o >= e ? $ ? oe({ theme: n || b }) : L({ theme: n || b }) : ""
131
+ ), q = () => $ ? p(ie({ theme: n || b })) : L({ theme: n || b }), z = () => $ ? p(ae({ theme: n || b })) : ne({ theme: n || b }), x = T(!1), [$, N] = Q(!1), S = E(
132
+ (e) => {
133
+ var v;
134
+ e.stopPropagation(), e.preventDefault();
135
+ const l = (v = j.current) == null ? void 0 : v.getBoundingClientRect();
136
+ if (!l)
137
+ return;
138
+ const { left: r, right: f } = l, M = F(e.clientX, a, d, r, f, k);
139
+ u(M);
140
+ },
141
+ [a, d, k, u]
142
+ ), D = E(
143
+ (e) => {
144
+ x.current && S(e);
145
+ },
146
+ [S]
147
+ ), G = (e) => {
148
+ e.stopPropagation(), e.preventDefault(), document.activeElement.blur(), x.current = !0, N(!0), document.addEventListener(
94
149
  "mouseup",
95
150
  () => {
96
- h.current = !1, _(!1), document.removeEventListener("mousemove", y), v && v(s);
151
+ x.current = !1, N(!1), document.removeEventListener("mousemove", D), s && s(o);
97
152
  },
98
153
  { once: !0 }
99
- ), document.addEventListener("mousemove", y);
100
- }, y = E(
101
- (e) => {
102
- h.current && k(e);
103
- },
104
- [h.current, k]
105
- ), d = (e, c) => {
106
- e.stopPropagation(), u(c);
107
- }, V = (e) => {
108
- k(e);
109
- }, m = () => g ? F({ theme: r || a }) : N({ theme: r || a });
110
- return /* @__PURE__ */ t.jsxs("div", { id: o ? `${o}-slider-container` : "", className: n["slider-container"], children: [
111
- /* @__PURE__ */ t.jsxs("div", { className: n["slider-content"], children: [
112
- /* @__PURE__ */ t.jsx(
113
- "div",
114
- {
115
- ref: p,
116
- className: `${n.rail} ${i(B({ theme: r || a }))}`
117
- }
118
- ),
119
- /* @__PURE__ */ t.jsx(
120
- "div",
121
- {
122
- className: `${n.track} ${g ? i(q({ theme: r || a })) : z({ theme: r || a })}`,
123
- style: { width: `${s}%` }
124
- }
125
- ),
126
- /* @__PURE__ */ t.jsxs(
127
- "div",
128
- {
129
- id: o ? `${o}-mark-container` : "",
130
- className: n["mark-container"],
131
- onClick: (e) => V(e),
132
- children: [
133
- /* @__PURE__ */ t.jsx(
134
- "div",
135
- {
136
- className: `${n.mark} ${i(
137
- b({ theme: r || a }),
138
- s >= 0 ? m() : ""
139
- )}`,
140
- onClick: (e) => d(e, 0),
141
- children: /* @__PURE__ */ t.jsx(
142
- "span",
154
+ ), document.addEventListener("mousemove", D);
155
+ }, H = (e, l) => {
156
+ e.stopPropagation(), u(l), s && s(l);
157
+ }, I = (e) => {
158
+ var C;
159
+ const l = (C = j.current) == null ? void 0 : C.getBoundingClientRect();
160
+ if (!l)
161
+ return;
162
+ const { left: r, right: f } = l, M = e.clientX, v = F(M, a, d, r, f, k);
163
+ u(v), s && s(v);
164
+ }, V = R(o, a, d, k);
165
+ return /* @__PURE__ */ i.jsxs(
166
+ "div",
167
+ {
168
+ id: c ? `${c}-slider-container` : "",
169
+ className: p(h["slider-container"], X),
170
+ children: [
171
+ /* @__PURE__ */ i.jsxs("div", { className: h["slider-content"], children: [
172
+ /* @__PURE__ */ i.jsx(
173
+ "div",
174
+ {
175
+ ref: j,
176
+ className: `${h.rail} ${p(re({ theme: n || b }))}`
177
+ }
178
+ ),
179
+ /* @__PURE__ */ i.jsx(
180
+ "div",
181
+ {
182
+ className: `${h.track} ${z()}`,
183
+ style: { width: `${V}%` }
184
+ }
185
+ ),
186
+ /* @__PURE__ */ i.jsx(
187
+ "div",
188
+ {
189
+ id: c ? `${c}-mark-container` : "",
190
+ className: h["mark-container"],
191
+ onClick: I,
192
+ children: B.map((e) => {
193
+ const l = R(e.value, a, d, k);
194
+ return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
195
+ e.showMark && /* @__PURE__ */ i.jsx(
196
+ "div",
197
+ {
198
+ className: `${h.mark} ${O(e.value)} mark`,
199
+ style: { left: `${l}%` },
200
+ onClick: (r) => H(r, e.value)
201
+ },
202
+ e.value
203
+ ),
204
+ e.showLabel && /* @__PURE__ */ i.jsx(
205
+ "span",
206
+ {
207
+ className: `${h["mark-label"]} ${p(
208
+ se({ theme: n || b })
209
+ )} mark-label`,
210
+ style: { left: `${l}%` },
211
+ children: w(e.value)
212
+ }
213
+ )
214
+ ] });
215
+ })
216
+ }
217
+ ),
218
+ /* @__PURE__ */ i.jsxs(
219
+ "div",
220
+ {
221
+ id: c ? `${c}-thumb-container` : "",
222
+ className: h["thumb-container"],
223
+ style: {
224
+ left: `${V}%`
225
+ },
226
+ children: [
227
+ /* @__PURE__ */ i.jsx(
228
+ "div",
143
229
  {
144
- className: `${n["mark-label"]} ${i(
145
- j({ theme: r || a })
230
+ className: `${h.tooltip} ${p(
231
+ ce({ theme: n || b })
146
232
  )}`,
147
- children: "0%"
233
+ children: w(o)
148
234
  }
149
- )
150
- }
151
- ),
152
- /* @__PURE__ */ t.jsx(
153
- "div",
154
- {
155
- className: `${n.mark} ${i(
156
- b({ theme: r || a }),
157
- s >= 25 ? m() : ""
158
- )}`,
159
- onClick: (e) => d(e, 25)
160
- }
161
- ),
162
- /* @__PURE__ */ t.jsx(
163
- "div",
164
- {
165
- className: `${n.mark} ${i(
166
- b({ theme: r || a }),
167
- s >= 50 ? m() : ""
168
- )}`,
169
- onClick: (e) => d(e, 50)
170
- }
171
- ),
172
- /* @__PURE__ */ t.jsx(
173
- "div",
174
- {
175
- className: `${n.mark} ${i(
176
- b({ theme: r || a }),
177
- s >= 75 ? m() : ""
178
- )}`,
179
- onClick: (e) => d(e, 75)
180
- }
181
- ),
182
- /* @__PURE__ */ t.jsx(
183
- "div",
184
- {
185
- className: `${n.mark} ${i(
186
- b({ theme: r || a }),
187
- s >= 100 ? m() : ""
188
- )}`,
189
- onClick: (e) => d(e, 100),
190
- children: /* @__PURE__ */ t.jsx(
191
- "span",
235
+ ),
236
+ /* @__PURE__ */ i.jsx(
237
+ "div",
192
238
  {
193
- className: `${n["mark-label"]} ${i(
194
- j({ theme: r || a })
195
- )}`,
196
- children: "100%"
239
+ id: c ? `${c}-thumb` : "",
240
+ className: `${h.thumb} ${q()} thumb`,
241
+ onMouseDown: G
197
242
  }
198
243
  )
199
- }
200
- )
201
- ]
202
- }
203
- ),
204
- /* @__PURE__ */ t.jsxs(
205
- "div",
206
- {
207
- id: o ? `${o}-thumb-container` : "",
208
- className: n["thumb-container"],
209
- style: {
210
- left: `${s}%`
211
- },
212
- children: [
213
- /* @__PURE__ */ t.jsxs(
214
- "div",
215
- {
216
- className: `${n.tooltip} ${i(
217
- H({ theme: r || a })
218
- )}`,
219
- children: [
220
- s,
221
- "%"
222
- ]
223
- }
224
- ),
225
- /* @__PURE__ */ t.jsx(
226
- "div",
227
- {
228
- id: o ? `${o}-thumb` : "",
229
- className: `${n.thumb} ${g ? i(G({ theme: r || a })) : N({ theme: r || a })}`,
230
- onMouseDown: D
231
- }
232
- )
233
- ]
234
- }
235
- )
236
- ] }),
237
- /* @__PURE__ */ t.jsx("input", { type: "hidden", value: s, ref: M })
238
- ] });
244
+ ]
245
+ }
246
+ )
247
+ ] }),
248
+ /* @__PURE__ */ i.jsx("input", { type: "hidden", value: o, ref: t })
249
+ ]
250
+ }
251
+ );
239
252
  });
240
253
  export {
241
- Q as Slider
254
+ me as Slider
242
255
  };