@solostylist/ui-kit 1.0.146 → 1.0.147
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.
|
@@ -32,7 +32,7 @@ export declare const MediaItem: React.FC<MediaItemProps>;
|
|
|
32
32
|
/**
|
|
33
33
|
* Built-in layout variants for the gallery
|
|
34
34
|
*/
|
|
35
|
-
export type GalleryLayoutVariant = 'masonry' | 'grid' | 'spotlight' | 'featured' | 'custom';
|
|
35
|
+
export type GalleryLayoutVariant = 'masonry' | 'grid' | 'spotlight' | 'featured' | 'highlight' | 'custom';
|
|
36
36
|
/**
|
|
37
37
|
* Props interface for the main SGallery component
|
|
38
38
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { useState as y, useId as R, useEffect as
|
|
2
|
+
import { useState as y, useId as R, useEffect as v, useRef as D } from "react";
|
|
3
3
|
import { Box as a, Paper as w, Skeleton as E, Typography as j } from "@mui/material";
|
|
4
4
|
import { AnimatePresence as M, motion as I } from "framer-motion";
|
|
5
5
|
import V from "../s-image-modal/s-image-modal.js";
|
|
6
6
|
import P from "../s-lazy-image/s-lazy-image.js";
|
|
7
|
-
const A = ({ item:
|
|
7
|
+
const A = ({ item: o, sx: s, onClick: i }) => {
|
|
8
8
|
const e = D(null), [n, l] = y(!1), [u, f] = y(!0);
|
|
9
|
-
return
|
|
9
|
+
return v(() => {
|
|
10
10
|
const c = {
|
|
11
11
|
root: null,
|
|
12
12
|
rootMargin: "50px",
|
|
@@ -19,7 +19,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
19
19
|
return e.current && g.observe(e.current), () => {
|
|
20
20
|
e.current && g.unobserve(e.current);
|
|
21
21
|
};
|
|
22
|
-
}, []),
|
|
22
|
+
}, []), v(() => {
|
|
23
23
|
let c = !0;
|
|
24
24
|
return n ? (async () => {
|
|
25
25
|
if (!(!e.current || !n || !c))
|
|
@@ -33,7 +33,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
33
33
|
})() : e.current && e.current.pause(), () => {
|
|
34
34
|
c = !1, e.current && (e.current.pause(), e.current.removeAttribute("src"), e.current.load());
|
|
35
35
|
};
|
|
36
|
-
}, [n]),
|
|
36
|
+
}, [n]), o.type === "video" ? /* @__PURE__ */ t.jsxs(
|
|
37
37
|
a,
|
|
38
38
|
{
|
|
39
39
|
sx: {
|
|
@@ -41,7 +41,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
41
41
|
overflow: "hidden",
|
|
42
42
|
width: "100%",
|
|
43
43
|
height: "100%",
|
|
44
|
-
...
|
|
44
|
+
...s
|
|
45
45
|
},
|
|
46
46
|
children: [
|
|
47
47
|
/* @__PURE__ */ t.jsx(
|
|
@@ -49,7 +49,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
49
49
|
{
|
|
50
50
|
component: "video",
|
|
51
51
|
ref: e,
|
|
52
|
-
onClick:
|
|
52
|
+
onClick: i,
|
|
53
53
|
playsInline: !0,
|
|
54
54
|
muted: !0,
|
|
55
55
|
loop: !0,
|
|
@@ -64,7 +64,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
64
64
|
willChange: "transform",
|
|
65
65
|
display: "block"
|
|
66
66
|
},
|
|
67
|
-
children: /* @__PURE__ */ t.jsx("source", { src:
|
|
67
|
+
children: /* @__PURE__ */ t.jsx("source", { src: o.url, type: "video/mp4" })
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
70
|
u && /* @__PURE__ */ t.jsx(
|
|
@@ -99,50 +99,53 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
99
99
|
)
|
|
100
100
|
]
|
|
101
101
|
}
|
|
102
|
-
) : /* @__PURE__ */ t.jsx(a, { onClick:
|
|
102
|
+
) : /* @__PURE__ */ t.jsx(a, { onClick: i, sx: { width: "100%", height: "100%", ...s }, children: /* @__PURE__ */ t.jsx(
|
|
103
103
|
P,
|
|
104
104
|
{
|
|
105
|
-
src:
|
|
106
|
-
alt:
|
|
105
|
+
src: o.url,
|
|
106
|
+
alt: o.title || "",
|
|
107
107
|
width: "100%",
|
|
108
108
|
height: "100%",
|
|
109
109
|
style: {
|
|
110
|
-
objectFit:
|
|
111
|
-
cursor:
|
|
110
|
+
objectFit: s != null && s.objectFit ? s.objectFit : "cover",
|
|
111
|
+
cursor: i ? "pointer" : "default",
|
|
112
112
|
display: "block",
|
|
113
113
|
width: "100%",
|
|
114
114
|
height: "100%"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
) });
|
|
118
|
-
},
|
|
119
|
-
let
|
|
120
|
-
switch (
|
|
118
|
+
}, k = (o, s) => {
|
|
119
|
+
let i = 1, e = 2;
|
|
120
|
+
switch (s) {
|
|
121
121
|
case "grid":
|
|
122
|
-
|
|
122
|
+
i = 1, e = 2;
|
|
123
123
|
break;
|
|
124
124
|
case "masonry":
|
|
125
|
-
|
|
125
|
+
i = 1, e = o % 3 === 0 ? 3 : o % 2 === 0 ? 2 : 4;
|
|
126
126
|
break;
|
|
127
127
|
case "spotlight":
|
|
128
|
-
|
|
128
|
+
o === 0 ? (i = 2, e = 4) : (i = 1, e = 2);
|
|
129
129
|
break;
|
|
130
130
|
case "featured":
|
|
131
|
-
|
|
131
|
+
o === 0 ? (i = 2, e = 6) : (i = 1, e = 2);
|
|
132
|
+
break;
|
|
133
|
+
case "highlight":
|
|
134
|
+
o === 0 ? (i = 3, e = 6) : (i = 1, e = 2);
|
|
132
135
|
break;
|
|
133
136
|
case "custom":
|
|
134
|
-
|
|
137
|
+
i = 1, e = 2;
|
|
135
138
|
break;
|
|
136
139
|
}
|
|
137
|
-
return { colSpan:
|
|
138
|
-
}, S = (
|
|
139
|
-
const { colSpan: n, rowSpan: l } =
|
|
140
|
-
return { ...
|
|
141
|
-
}), W = ({ mediaItems:
|
|
142
|
-
const [n, l] = y(null), [u, f] = y(() => S(
|
|
143
|
-
return
|
|
144
|
-
f(S(
|
|
145
|
-
}, [
|
|
140
|
+
return { colSpan: i, rowSpan: e };
|
|
141
|
+
}, S = (o, s) => s === "custom" ? o : o.map((i, e) => {
|
|
142
|
+
const { colSpan: n, rowSpan: l } = k(e, s);
|
|
143
|
+
return { ...i, colSpan: n, rowSpan: l };
|
|
144
|
+
}), W = ({ mediaItems: o, variant: s = "masonry", loading: i = !1, skeletonCount: e = 6 }) => {
|
|
145
|
+
const [n, l] = y(null), [u, f] = y(() => S(o, s)), [c, g] = y(!1), d = R();
|
|
146
|
+
return v(() => {
|
|
147
|
+
f(S(o, s));
|
|
148
|
+
}, [o, s]), /* @__PURE__ */ t.jsxs(a, { sx: { width: "100%", position: "relative", zIndex: 1 }, children: [
|
|
146
149
|
/* @__PURE__ */ t.jsx(
|
|
147
150
|
V,
|
|
148
151
|
{
|
|
@@ -182,8 +185,8 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
182
185
|
position: "relative"
|
|
183
186
|
// Ensure proper stacking context
|
|
184
187
|
},
|
|
185
|
-
children:
|
|
186
|
-
const { colSpan: h, rowSpan:
|
|
188
|
+
children: i ? Array.from({ length: e }).map((r, p) => {
|
|
189
|
+
const { colSpan: h, rowSpan: b } = k(p, s);
|
|
187
190
|
return /* @__PURE__ */ t.jsx(
|
|
188
191
|
w,
|
|
189
192
|
{
|
|
@@ -191,7 +194,7 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
191
194
|
position: "relative",
|
|
192
195
|
overflow: "hidden",
|
|
193
196
|
borderRadius: 2,
|
|
194
|
-
gridRow: `span ${
|
|
197
|
+
gridRow: `span ${b}`,
|
|
195
198
|
gridColumn: `span ${h}`
|
|
196
199
|
},
|
|
197
200
|
children: /* @__PURE__ */ t.jsx(
|
|
@@ -233,12 +236,12 @@ const A = ({ item: i, sx: o, onClick: s }) => {
|
|
|
233
236
|
dragConstraints: { left: 0, right: 0, top: 0, bottom: 0 },
|
|
234
237
|
dragElastic: 1,
|
|
235
238
|
onDragStart: () => g(!0),
|
|
236
|
-
onDragEnd: (h,
|
|
239
|
+
onDragEnd: (h, b) => {
|
|
237
240
|
g(!1);
|
|
238
|
-
const x =
|
|
241
|
+
const x = b.offset.x + b.offset.y;
|
|
239
242
|
if (Math.abs(x) > 50) {
|
|
240
|
-
const
|
|
241
|
-
|
|
243
|
+
const m = [...u], C = m[p], $ = x > 0 ? Math.min(p + 1, u.length - 1) : Math.max(p - 1, 0);
|
|
244
|
+
m.splice(p, 1), m.splice($, 0, C), f(m);
|
|
242
245
|
}
|
|
243
246
|
},
|
|
244
247
|
style: {
|