@solostylist/ui-kit 1.0.116 → 1.0.117
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.
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import * as
|
|
3
|
-
import { C as
|
|
4
|
-
import { Box as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { j as t } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { C as I, a as L } from "../ChevronRight-DQD188LX.js";
|
|
4
|
+
import { Box as s, IconButton as R } from "@mui/material";
|
|
5
|
+
import v from "../s-lazy-image/s-lazy-image.js";
|
|
6
|
+
const C = n.forwardRef(
|
|
7
|
+
({ sx: x, leftImage: g, rightImage: b, altLeft: w = "Left image", altRight: j = "Right image", initialPosition: y = 50, ...E }, r) => {
|
|
8
|
+
const [i, S] = n.useState(y), [o, d] = n.useState(!1), l = n.useRef(null), u = (e) => {
|
|
8
9
|
if (!l.current) return;
|
|
9
|
-
const
|
|
10
|
-
let c = (
|
|
10
|
+
const f = l.current.getBoundingClientRect();
|
|
11
|
+
let c = (e - f.left) / f.width * 100;
|
|
11
12
|
c = Math.max(0, Math.min(100, c)), S(c);
|
|
12
|
-
}, m = (
|
|
13
|
-
|
|
14
|
-
}, h = (
|
|
15
|
-
|
|
16
|
-
},
|
|
13
|
+
}, m = (e) => {
|
|
14
|
+
o && u(e.clientX);
|
|
15
|
+
}, h = (e) => {
|
|
16
|
+
o && u(e.touches[0].clientX);
|
|
17
|
+
}, p = () => {
|
|
17
18
|
d(!0);
|
|
18
19
|
}, a = () => {
|
|
19
20
|
d(!1);
|
|
20
21
|
};
|
|
21
|
-
return
|
|
22
|
+
return n.useEffect(() => (o ? (document.addEventListener("mousemove", m), document.addEventListener("touchmove", h), document.addEventListener("mouseup", a), document.addEventListener("touchend", a), document.body.style.cursor = "ew-resize") : document.body.style.cursor = "", () => {
|
|
22
23
|
document.removeEventListener("mousemove", m), document.removeEventListener("touchmove", h), document.removeEventListener("mouseup", a), document.removeEventListener("touchend", a), document.body.style.cursor = "";
|
|
23
|
-
}), [
|
|
24
|
-
|
|
24
|
+
}), [o]), /* @__PURE__ */ t.jsxs(
|
|
25
|
+
s,
|
|
25
26
|
{
|
|
26
|
-
ref: (
|
|
27
|
-
l.current =
|
|
27
|
+
ref: (e) => {
|
|
28
|
+
l.current = e, typeof r == "function" ? r(e) : r && (r.current = e);
|
|
28
29
|
},
|
|
29
30
|
sx: {
|
|
30
31
|
position: "relative",
|
|
@@ -35,19 +36,18 @@ const R = s.forwardRef(
|
|
|
35
36
|
"&:hover .slider-handle": {
|
|
36
37
|
transform: "translate(-50%, -50%) scale(1.05)"
|
|
37
38
|
},
|
|
38
|
-
...
|
|
39
|
+
...x
|
|
39
40
|
},
|
|
40
|
-
onMouseDown:
|
|
41
|
-
onTouchStart:
|
|
41
|
+
onMouseDown: p,
|
|
42
|
+
onTouchStart: p,
|
|
42
43
|
...E,
|
|
43
44
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
|
|
45
|
+
/* @__PURE__ */ t.jsx(
|
|
46
|
+
v,
|
|
46
47
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
sx: {
|
|
48
|
+
src: b,
|
|
49
|
+
alt: j,
|
|
50
|
+
style: {
|
|
51
51
|
position: "absolute",
|
|
52
52
|
inset: 0,
|
|
53
53
|
width: "100%",
|
|
@@ -58,8 +58,8 @@ const R = s.forwardRef(
|
|
|
58
58
|
draggable: !1
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
61
|
+
/* @__PURE__ */ t.jsx(
|
|
62
|
+
s,
|
|
63
63
|
{
|
|
64
64
|
sx: {
|
|
65
65
|
position: "absolute",
|
|
@@ -68,15 +68,14 @@ const R = s.forwardRef(
|
|
|
68
68
|
height: "100%",
|
|
69
69
|
overflow: "hidden",
|
|
70
70
|
pointerEvents: "none",
|
|
71
|
-
clipPath: `polygon(0 0, ${
|
|
71
|
+
clipPath: `polygon(0 0, ${i}% 0, ${i}% 100%, 0 100%)`
|
|
72
72
|
},
|
|
73
|
-
children: /* @__PURE__ */
|
|
74
|
-
|
|
73
|
+
children: /* @__PURE__ */ t.jsx(
|
|
74
|
+
v,
|
|
75
75
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
sx: {
|
|
76
|
+
src: g,
|
|
77
|
+
alt: w,
|
|
78
|
+
style: {
|
|
80
79
|
width: "100%",
|
|
81
80
|
height: "100%",
|
|
82
81
|
objectFit: "cover"
|
|
@@ -86,8 +85,8 @@ const R = s.forwardRef(
|
|
|
86
85
|
)
|
|
87
86
|
}
|
|
88
87
|
),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
88
|
+
/* @__PURE__ */ t.jsxs(
|
|
89
|
+
s,
|
|
91
90
|
{
|
|
92
91
|
sx: {
|
|
93
92
|
position: "absolute",
|
|
@@ -95,11 +94,11 @@ const R = s.forwardRef(
|
|
|
95
94
|
height: "100%",
|
|
96
95
|
width: "4px",
|
|
97
96
|
cursor: "ew-resize",
|
|
98
|
-
left: `calc(${
|
|
97
|
+
left: `calc(${i}% - 2px)`
|
|
99
98
|
},
|
|
100
99
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
100
|
+
/* @__PURE__ */ t.jsx(
|
|
101
|
+
s,
|
|
103
102
|
{
|
|
104
103
|
sx: {
|
|
105
104
|
position: "absolute",
|
|
@@ -110,8 +109,8 @@ const R = s.forwardRef(
|
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
112
|
+
/* @__PURE__ */ t.jsx(
|
|
113
|
+
R,
|
|
115
114
|
{
|
|
116
115
|
className: "slider-handle",
|
|
117
116
|
sx: {
|
|
@@ -124,20 +123,23 @@ const R = s.forwardRef(
|
|
|
124
123
|
backdropFilter: "blur(10px)",
|
|
125
124
|
boxShadow: 3,
|
|
126
125
|
transition: "all 0.3s ease-in-out",
|
|
127
|
-
...
|
|
126
|
+
...o && {
|
|
128
127
|
transform: "translate(-50%, -50%) scale(1.05)",
|
|
129
128
|
boxShadow: 6
|
|
130
129
|
}
|
|
131
130
|
},
|
|
132
131
|
role: "slider",
|
|
133
|
-
"aria-valuenow":
|
|
132
|
+
"aria-valuenow": i,
|
|
134
133
|
"aria-valuemin": 0,
|
|
135
134
|
"aria-valuemax": 100,
|
|
136
135
|
"aria-orientation": "horizontal",
|
|
137
136
|
"aria-label": "Image comparison slider",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
onClick: (e) => {
|
|
138
|
+
e.preventDefault(), e.stopPropagation();
|
|
139
|
+
},
|
|
140
|
+
children: /* @__PURE__ */ t.jsxs(s, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
141
|
+
/* @__PURE__ */ t.jsx(I, { sx: { fontSize: 20 } }),
|
|
142
|
+
/* @__PURE__ */ t.jsx(L, { sx: { fontSize: 20 } })
|
|
141
143
|
] })
|
|
142
144
|
}
|
|
143
145
|
)
|
|
@@ -149,7 +151,7 @@ const R = s.forwardRef(
|
|
|
149
151
|
);
|
|
150
152
|
}
|
|
151
153
|
);
|
|
152
|
-
|
|
154
|
+
C.displayName = "SImageComparison";
|
|
153
155
|
export {
|
|
154
|
-
|
|
156
|
+
C as default
|
|
155
157
|
};
|