@blofin/blofin-ui 1.0.0-beta.8 → 1.0.0-beta.9

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/Slider.es.js +29 -31
  2. package/package.json +1 -1
package/dist/Slider.es.js CHANGED
@@ -99,7 +99,7 @@ const I = "_rail_ku8lc_8", J = "_track_ku8lc_16", K = "_mark_ku8lc_24", Q = "_to
99
99
  dark: ["bu-border-dark-primary bu-bg-dark-background"]
100
100
  }
101
101
  }
102
- }), X = m("", {
102
+ }), A = m("", {
103
103
  variants: {
104
104
  theme: {
105
105
  light: ["!bu-border-light-label-60 bu-bg-light-background"],
@@ -134,27 +134,27 @@ const I = "_rail_ku8lc_8", J = "_track_ku8lc_16", K = "_mark_ku8lc_24", Q = "_to
134
134
  }
135
135
  }
136
136
  });
137
- function L(a, e, r) {
137
+ function E(a, e, r) {
138
138
  return Math.max(e, Math.min(a, r));
139
139
  }
140
- function F(a, e, r, n) {
140
+ function L(a, e, r, n) {
141
141
  return r === e ? 0 : ((a - e) / (r - e) * 100).toFixed(n);
142
142
  }
143
143
  function se(a) {
144
144
  const e = a.toString();
145
145
  return e.indexOf(".") === -1 ? 0 : e.split(".")[1].length;
146
146
  }
147
- function A(a, e, r, n, s, h, b) {
147
+ function F(a, e, r, n, s, h, b) {
148
148
  if (s === n)
149
149
  return e;
150
150
  let u = (a - n) / (s - n);
151
- u = L(u, 0, 1);
151
+ u = E(u, 0, 1);
152
152
  let i = e + u * (r - e);
153
- return i = Math.round((i - e) / h) * h + e, i = Number(i.toFixed(b)), L(i, e, r);
153
+ return i = Math.round((i - e) / h) * h + e, i = Number(i.toFixed(b)), E(i, e, r);
154
154
  }
155
- const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme: r || e }), oe = (a, e, r, n) => a ? k(Z({ theme: n || e }), "track-drag") : ee({ theme: n || e, disabled: r }), ce = (a, e, r, n, s) => k(
155
+ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : A({ theme: r || e }), oe = (a, e, r, n) => a ? k(Z({ theme: n || e }), "track-drag") : ee({ theme: n || e, disabled: r }), ce = (a, e, r, n, s) => k(
156
156
  te({ theme: s || e, current: n === a }),
157
- n > a ? r ? k(re({ theme: s || e }), "mark-drag") : X({ theme: s || e }) : ""
157
+ n > a ? r ? k(re({ theme: s || e }), "mark-drag") : A({ theme: s || e }) : ""
158
158
  ), ge = g.forwardRef((a, e) => {
159
159
  const {
160
160
  value: r,
@@ -167,11 +167,11 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
167
167
  step: p = 1,
168
168
  marks: M = [0, 25, 50, 75, 100],
169
169
  labels: w = [],
170
- className: B,
170
+ className: X,
171
171
  renderLabel: D = (t) => `${t}%`,
172
172
  disabled: _ = !1,
173
- showTooltip: O = !0
174
- } = a, { theme: v } = H(), j = g.useRef(null), N = g.useMemo(() => {
173
+ showTooltip: B = !0
174
+ } = a, { theme: v } = H(), j = g.useRef(null), O = g.useMemo(() => {
175
175
  const t = Array.from(new Set(M.concat(w))).sort((l, f) => l - f), o = [];
176
176
  return t.forEach((l) => {
177
177
  l >= u && l <= i && o.push({
@@ -180,16 +180,14 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
180
180
  showMark: M.includes(l) || l === u || l === i
181
181
  });
182
182
  }), o;
183
- }, [M, u, i, p, w]);
184
- console.log(N);
185
- const S = g.useRef(!1), [x, C] = g.useState(!1), y = g.useMemo(() => se(p), [p]), R = g.useCallback(
183
+ }, [M, u, i, p, w]), S = g.useRef(!1), [x, N] = g.useState(!1), y = g.useMemo(() => se(p), [p]), C = g.useCallback(
186
184
  (t) => {
187
185
  var $;
188
186
  t.stopPropagation(), t.preventDefault();
189
187
  const o = ($ = j.current) == null ? void 0 : $.getBoundingClientRect();
190
188
  if (!o)
191
189
  return;
192
- const { left: l, right: f } = o, V = A(
190
+ const { left: l, right: f } = o, V = F(
193
191
  t.clientX,
194
192
  u,
195
193
  i,
@@ -201,34 +199,34 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
201
199
  n(V);
202
200
  },
203
201
  [u, i, p, n, y]
204
- ), T = g.useCallback(
202
+ ), R = g.useCallback(
205
203
  (t) => {
206
- S.current && R(t);
204
+ S.current && C(t);
207
205
  },
208
- [R]
206
+ [C]
209
207
  ), q = (t) => {
210
- t.stopPropagation(), t.preventDefault(), document.activeElement.blur(), S.current = !0, C(!0), document.addEventListener(
208
+ t.stopPropagation(), t.preventDefault(), document.activeElement.blur(), S.current = !0, N(!0), document.addEventListener(
211
209
  "mouseup",
212
210
  () => {
213
- S.current = !1, C(!1), document.removeEventListener("mousemove", T), s && s(r);
211
+ S.current = !1, N(!1), document.removeEventListener("mousemove", R), s && s(r);
214
212
  },
215
213
  { once: !0 }
216
- ), document.addEventListener("mousemove", T);
214
+ ), document.addEventListener("mousemove", R);
217
215
  }, z = (t, o) => {
218
216
  t.stopPropagation(), n(o), s && s(o);
219
217
  }, G = (t) => {
220
- var E;
221
- const o = (E = j.current) == null ? void 0 : E.getBoundingClientRect();
218
+ var P;
219
+ const o = (P = j.current) == null ? void 0 : P.getBoundingClientRect();
222
220
  if (!o)
223
221
  return;
224
- const { left: l, right: f } = o, V = t.clientX, $ = A(V, u, i, l, f, p, y);
222
+ const { left: l, right: f } = o, V = t.clientX, $ = F(V, u, i, l, f, p, y);
225
223
  n($), s && s($);
226
- }, P = F(r, u, i, y);
224
+ }, T = L(r, u, i, y);
227
225
  return /* @__PURE__ */ c.jsxs(
228
226
  "div",
229
227
  {
230
228
  id: b ? `${b}-slider-container` : "",
231
- className: k(d["slider-container"], _ && d.disabled, B),
229
+ className: k(d["slider-container"], _ && d.disabled, X),
232
230
  children: [
233
231
  /* @__PURE__ */ c.jsxs("div", { className: d["slider-content"], children: [
234
232
  /* @__PURE__ */ c.jsx(
@@ -247,7 +245,7 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
247
245
  _,
248
246
  h
249
247
  )} track`,
250
- style: { width: `${P}%` }
248
+ style: { width: `${T}%` }
251
249
  }
252
250
  ),
253
251
  /* @__PURE__ */ c.jsx(
@@ -256,8 +254,8 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
256
254
  id: b ? `${b}-mark-container` : "",
257
255
  className: `${d["mark-container"]} mark-container`,
258
256
  onClick: _ ? void 0 : G,
259
- children: N.map((t, o) => {
260
- const l = F(t.value, u, i, y);
257
+ children: O.map((t, o) => {
258
+ const l = L(t.value, u, i, y);
261
259
  return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
262
260
  t.showMark && /* @__PURE__ */ c.jsx(
263
261
  "div",
@@ -294,10 +292,10 @@ const ie = (a, e, r) => a ? k(ne({ theme: r || e }), "thumb-drag") : X({ theme:
294
292
  id: b ? `${b}-thumb-container` : "",
295
293
  className: `${d["thumb-container"]} thumb-container`,
296
294
  style: {
297
- left: `${P}%`
295
+ left: `${T}%`
298
296
  },
299
297
  children: [
300
- O && /* @__PURE__ */ c.jsx(
298
+ B && /* @__PURE__ */ c.jsx(
301
299
  "div",
302
300
  {
303
301
  className: `${d.tooltip} ${x ? d["tooltip-drag"] : ""} ${k(
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/blofinex/blofin-ui.git"
6
6
  },
7
- "version": "1.0.0-beta.8",
7
+ "version": "1.0.0-beta.9",
8
8
  "module": "./dist/index.es.js",
9
9
  "type": "module",
10
10
  "types": "./dist/index.d.ts",