@blofin/blofin-ui 0.7.12 → 0.7.13

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/dist/Slider.es.js CHANGED
@@ -1,33 +1,33 @@
1
1
  import { j as t } from "./jsx-runtime-944c88e2.js";
2
- import { forwardRef as V, useRef as $, useState as S, useCallback as w } from "react";
2
+ import { forwardRef as S, useRef as x, useState as w, useCallback as E } from "react";
3
3
  import { a as l, u as R } from "./index-96a8d125.js";
4
4
  import { c as i } from "./utils-7e50508b.js";
5
- const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_tooltip_1f4y3_53", P = "_thumb_1f4y3_50", n = {
5
+ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", L = "_mark_1f4y3_23", P = "_tooltip_1f4y3_53", A = "_thumb_1f4y3_50", n = {
6
6
  "slider-container": "_slider-container_1f4y3_1",
7
7
  "slider-content": "_slider-content_1f4y3_4",
8
8
  rail: T,
9
9
  track: X,
10
10
  "mark-container": "_mark-container_1f4y3_23",
11
- mark: E,
11
+ mark: L,
12
12
  "mark-label": "_mark-label_1f4y3_39",
13
13
  "thumb-container": "_thumb-container_1f4y3_50",
14
- tooltip: L,
15
- thumb: P
16
- }, A = l("", {
14
+ tooltip: P,
15
+ thumb: A
16
+ }, B = l("", {
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
- }), B = l("", {
23
+ }), q = l("", {
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
- }), q = l("", {
30
+ }), z = l("", {
31
31
  variants: {
32
32
  theme: {
33
33
  light: ["bu-bg-light-label-60"],
@@ -41,35 +41,35 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
41
41
  dark: ["bu-border-dark-line-secondary bu-bg-dark-background"]
42
42
  }
43
43
  }
44
- }), z = l("bu-transition-colors", {
44
+ }), F = l("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
- }), x = l("", {
51
+ }), j = l("", {
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
- }), F = l("", {
58
+ }), G = l("", {
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
- }), j = l("", {
65
+ }), N = l("", {
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
- }), G = l("after:border", {
72
+ }), H = l("after:border", {
73
73
  variants: {
74
74
  theme: {
75
75
  light: [
@@ -80,46 +80,46 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
80
80
  ]
81
81
  }
82
82
  }
83
- }), O = V((N, C) => {
84
- const { value: s, onSliderChange: u, theme: r, id: o } = N, { theme: a } = R(), v = $(null), k = (e) => {
85
- var y;
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
86
  e.stopPropagation(), e.preventDefault();
87
- const { left: c, right: f } = ((y = v.current) == null ? void 0 : y.getBoundingClientRect()) || {
87
+ const { left: c, right: f } = (($ = p.current) == null ? void 0 : $.getBoundingClientRect()) || {
88
88
  left: 0,
89
89
  right: 0
90
90
  };
91
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 = $(!1), [g, p] = S(!1), M = (e) => {
93
- e.stopPropagation(), e.preventDefault(), document.activeElement.blur(), h.current = !0, p(!0), document.addEventListener(
92
+ }, h = x(!1), [g, _] = w(!1), D = (e) => {
93
+ e.stopPropagation(), e.preventDefault(), document.activeElement.blur(), h.current = !0, _(!0), document.addEventListener(
94
94
  "mouseup",
95
95
  () => {
96
- h.current = !1, p(!1), document.removeEventListener("mousemove", _);
96
+ h.current = !1, _(!1), document.removeEventListener("mousemove", y), v && v(s);
97
97
  },
98
98
  { once: !0 }
99
- ), document.addEventListener("mousemove", _);
100
- }, _ = w(
99
+ ), document.addEventListener("mousemove", y);
100
+ }, y = E(
101
101
  (e) => {
102
102
  h.current && k(e);
103
103
  },
104
104
  [h.current, k]
105
105
  ), d = (e, c) => {
106
106
  e.stopPropagation(), u(c);
107
- }, D = (e) => {
107
+ }, V = (e) => {
108
108
  k(e);
109
- }, m = () => g ? z({ theme: r || a }) : j({ theme: r || a });
109
+ }, m = () => g ? F({ theme: r || a }) : N({ theme: r || a });
110
110
  return /* @__PURE__ */ t.jsxs("div", { id: o ? `${o}-slider-container` : "", className: n["slider-container"], children: [
111
111
  /* @__PURE__ */ t.jsxs("div", { className: n["slider-content"], children: [
112
112
  /* @__PURE__ */ t.jsx(
113
113
  "div",
114
114
  {
115
- ref: v,
116
- className: `${n.rail} ${i(A({ theme: r || a }))}`
115
+ ref: p,
116
+ className: `${n.rail} ${i(B({ theme: r || a }))}`
117
117
  }
118
118
  ),
119
119
  /* @__PURE__ */ t.jsx(
120
120
  "div",
121
121
  {
122
- className: `${n.track} ${g ? i(B({ theme: r || a })) : q({ theme: r || a })}`,
122
+ className: `${n.track} ${g ? i(q({ theme: r || a })) : z({ theme: r || a })}`,
123
123
  style: { width: `${s}%` }
124
124
  }
125
125
  ),
@@ -128,7 +128,7 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
128
128
  {
129
129
  id: o ? `${o}-mark-container` : "",
130
130
  className: n["mark-container"],
131
- onClick: (e) => D(e),
131
+ onClick: (e) => V(e),
132
132
  children: [
133
133
  /* @__PURE__ */ t.jsx(
134
134
  "div",
@@ -142,7 +142,7 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
142
142
  "span",
143
143
  {
144
144
  className: `${n["mark-label"]} ${i(
145
- x({ theme: r || a })
145
+ j({ theme: r || a })
146
146
  )}`,
147
147
  children: "0%"
148
148
  }
@@ -191,7 +191,7 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
191
191
  "span",
192
192
  {
193
193
  className: `${n["mark-label"]} ${i(
194
- x({ theme: r || a })
194
+ j({ theme: r || a })
195
195
  )}`,
196
196
  children: "100%"
197
197
  }
@@ -214,7 +214,7 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
214
214
  "div",
215
215
  {
216
216
  className: `${n.tooltip} ${i(
217
- G({ theme: r || a })
217
+ H({ theme: r || a })
218
218
  )}`,
219
219
  children: [
220
220
  s,
@@ -226,17 +226,17 @@ const T = "_rail_1f4y3_7", X = "_track_1f4y3_15", E = "_mark_1f4y3_23", L = "_to
226
226
  "div",
227
227
  {
228
228
  id: o ? `${o}-thumb` : "",
229
- className: `${n.thumb} ${g ? i(F({ theme: r || a })) : j({ theme: r || a })}`,
230
- onMouseDown: M
229
+ className: `${n.thumb} ${g ? i(G({ theme: r || a })) : N({ theme: r || a })}`,
230
+ onMouseDown: D
231
231
  }
232
232
  )
233
233
  ]
234
234
  }
235
235
  )
236
236
  ] }),
237
- /* @__PURE__ */ t.jsx("input", { type: "hidden", value: s, ref: C })
237
+ /* @__PURE__ */ t.jsx("input", { type: "hidden", value: s, ref: M })
238
238
  ] });
239
239
  });
240
240
  export {
241
- O as Slider
241
+ Q as Slider
242
242
  };
@@ -11,6 +11,11 @@ export interface SliderProps {
11
11
  * @returns void
12
12
  */
13
13
  onSliderChange: (value: number) => void;
14
+ /**
15
+ * @param value number
16
+ * @returns void
17
+ */
18
+ onDragEnd?: (value: number) => void;
14
19
  /**
15
20
  * BUI theme
16
21
  */
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": "0.7.12",
7
+ "version": "0.7.13",
8
8
  "module": "./dist/index.es.js",
9
9
  "type": "module",
10
10
  "types": "./dist/index.d.ts",