@solostylist/ui-kit 1.0.78 → 1.0.79

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,31 +1,36 @@
1
1
  import { j as i } from "../jsx-runtime-DywqP_6a.js";
2
- import { useState as u, useEffect as v, useRef as C } from "react";
3
- import { Box as l, Paper as y, Typography as b, Modal as I, IconButton as z, Stack as S } from "@mui/material";
4
- import { AnimatePresence as j, motion as p } from "framer-motion";
5
- import R from "../s-lazy-image/s-lazy-image.js";
6
- import { C as P } from "../Close-CVFQMMUW.js";
7
- const m = ({ item: r, sx: s, onClick: a }) => {
8
- const e = C(null), [d, x] = u(!1), [h, t] = u(!0);
2
+ import { useState as b, useEffect as v, useRef as z } from "react";
3
+ import { Box as l, Paper as y, Typography as m, Modal as R, IconButton as j, Stack as P } from "@mui/material";
4
+ import { AnimatePresence as k, motion as u } from "framer-motion";
5
+ import S from "../s-lazy-image/s-lazy-image.js";
6
+ import { C as E } from "../Close-CVFQMMUW.js";
7
+ import { c as C } from "../createSvgIcon-DN-sh_sr.js";
8
+ const D = C(/* @__PURE__ */ i.jsx("path", {
9
+ d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"
10
+ }), "ChevronLeft"), M = C(/* @__PURE__ */ i.jsx("path", {
11
+ d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
12
+ }), "ChevronRight"), w = ({ item: r, sx: s, onClick: a }) => {
13
+ const e = z(null), [d, g] = b(!1), [f, o] = b(!0);
9
14
  return v(() => {
10
- const o = { root: null, rootMargin: "50px", threshold: 0.1 }, n = new IntersectionObserver((c) => {
11
- c.forEach((g) => x(g.isIntersecting));
12
- }, o);
13
- return e.current && n.observe(e.current), () => {
14
- e.current && n.unobserve(e.current);
15
+ const n = { root: null, rootMargin: "50px", threshold: 0.1 }, x = new IntersectionObserver((p) => {
16
+ p.forEach((t) => g(t.isIntersecting));
17
+ }, n);
18
+ return e.current && x.observe(e.current), () => {
19
+ e.current && x.unobserve(e.current);
15
20
  };
16
21
  }, []), v(() => {
17
- let o = !0;
22
+ let n = !0;
18
23
  return d ? (async () => {
19
- if (!(!e.current || !d || !o))
24
+ if (!(!e.current || !d || !n))
20
25
  try {
21
- e.current.readyState >= 3 ? (t(!1), await e.current.play()) : (t(!0), await new Promise((c) => {
22
- e.current && (e.current.oncanplay = () => c());
23
- }), o && (t(!1), await e.current.play()));
24
- } catch (c) {
25
- console.warn("Video playback failed:", c);
26
+ e.current.readyState >= 3 ? (o(!1), await e.current.play()) : (o(!0), await new Promise((p) => {
27
+ e.current && (e.current.oncanplay = () => p());
28
+ }), n && (o(!1), await e.current.play()));
29
+ } catch (p) {
30
+ console.warn("Video playback failed:", p);
26
31
  }
27
32
  })() : e.current && e.current.pause(), () => {
28
- o = !1, e.current && (e.current.pause(), e.current.removeAttribute("src"), e.current.load());
33
+ n = !1, e.current && (e.current.pause(), e.current.removeAttribute("src"), e.current.load());
29
34
  };
30
35
  }, [d]), r.type === "video" ? /* @__PURE__ */ i.jsxs(
31
36
  l,
@@ -52,7 +57,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
52
57
  width: "100%",
53
58
  height: "100%",
54
59
  objectFit: "cover",
55
- opacity: h ? 0.8 : 1,
60
+ opacity: f ? 0.8 : 1,
56
61
  transition: "opacity 0.2s",
57
62
  transform: "translateZ(0)",
58
63
  willChange: "transform",
@@ -61,7 +66,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
61
66
  children: /* @__PURE__ */ i.jsx("source", { src: r.url, type: "video/mp4" })
62
67
  }
63
68
  ),
64
- h && /* @__PURE__ */ i.jsx(
69
+ f && /* @__PURE__ */ i.jsx(
65
70
  l,
66
71
  {
67
72
  sx: {
@@ -94,7 +99,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
94
99
  ]
95
100
  }
96
101
  ) : /* @__PURE__ */ i.jsx(l, { onClick: a, sx: { width: "100%", height: "100%", ...s }, children: /* @__PURE__ */ i.jsx(
97
- R,
102
+ S,
98
103
  {
99
104
  src: r.url,
100
105
  alt: r.title || "",
@@ -109,16 +114,36 @@ const m = ({ item: r, sx: s, onClick: a }) => {
109
114
  }
110
115
  }
111
116
  ) });
112
- }, D = ({
117
+ }, L = ({
113
118
  selectedItem: r,
114
119
  isOpen: s,
115
120
  onClose: a,
116
121
  setSelectedItem: e,
117
122
  mediaItems: d
118
123
  }) => {
119
- const [x, h] = u({ x: 0, y: 0 });
120
- return s ? /* @__PURE__ */ i.jsx(
121
- I,
124
+ const [g, f] = b({ x: 0, y: 0 }), o = d.findIndex((t) => t.id === r.id), n = d.length, x = () => {
125
+ o > 0 && e(d[o - 1]);
126
+ }, p = () => {
127
+ o < n - 1 && e(d[o + 1]);
128
+ };
129
+ return v(() => {
130
+ const t = (c) => {
131
+ if (s)
132
+ switch (c.key) {
133
+ case "ArrowLeft":
134
+ x();
135
+ break;
136
+ case "ArrowRight":
137
+ p();
138
+ break;
139
+ case "Escape":
140
+ a();
141
+ break;
142
+ }
143
+ };
144
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
145
+ }, [s, o, n]), s ? /* @__PURE__ */ i.jsx(
146
+ R,
122
147
  {
123
148
  open: s,
124
149
  onClose: a,
@@ -137,7 +162,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
137
162
  },
138
163
  children: /* @__PURE__ */ i.jsxs(l, { children: [
139
164
  /* @__PURE__ */ i.jsx(
140
- p.div,
165
+ u.div,
141
166
  {
142
167
  initial: { scale: 0.98 },
143
168
  animate: { scale: 1 },
@@ -177,8 +202,8 @@ const m = ({ item: r, sx: s, onClick: a }) => {
177
202
  justifyContent: "center",
178
203
  bgcolor: "background.default"
179
204
  },
180
- children: /* @__PURE__ */ i.jsx(j, { mode: "wait", children: /* @__PURE__ */ i.jsx(
181
- p.div,
205
+ children: /* @__PURE__ */ i.jsx(k, { mode: "wait", children: /* @__PURE__ */ i.jsx(
206
+ u.div,
182
207
  {
183
208
  style: { position: "relative" },
184
209
  initial: { y: 20, scale: 0.97 },
@@ -204,7 +229,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
204
229
  },
205
230
  children: [
206
231
  /* @__PURE__ */ i.jsx(
207
- m,
232
+ w,
208
233
  {
209
234
  item: r,
210
235
  sx: { width: "100%", height: "100%", objectFit: "contain", bgcolor: "background.paper" },
@@ -225,8 +250,8 @@ const m = ({ item: r, sx: s, onClick: a }) => {
225
250
  },
226
251
  onClick: (t) => t.stopPropagation(),
227
252
  children: [
228
- r.title && /* @__PURE__ */ i.jsx(b, { variant: "h6", sx: { fontWeight: 600, fontSize: { xs: 14, sm: 18, md: 20 } }, children: r.title }),
229
- r.desc && /* @__PURE__ */ i.jsx(b, { variant: "body2", sx: { opacity: 0.8, mt: 0.5 }, children: r.desc })
253
+ r.title && /* @__PURE__ */ i.jsx(m, { variant: "h6", sx: { fontWeight: 600, fontSize: { xs: 14, sm: 18, md: 20 } }, children: r.title }),
254
+ r.desc && /* @__PURE__ */ i.jsx(m, { variant: "body2", sx: { opacity: 0.8, mt: 0.5 }, children: r.desc })
230
255
  ]
231
256
  }
232
257
  )
@@ -241,7 +266,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
241
266
  }
242
267
  ),
243
268
  /* @__PURE__ */ i.jsx(
244
- z,
269
+ j,
245
270
  {
246
271
  "aria-label": "Close",
247
272
  onClick: a,
@@ -252,7 +277,69 @@ const m = ({ item: r, sx: s, onClick: a }) => {
252
277
  zIndex: (t) => t.zIndex.modal + 102
253
278
  // Ensure it's above everything
254
279
  },
255
- children: /* @__PURE__ */ i.jsx(P, { fontSize: "small" })
280
+ children: /* @__PURE__ */ i.jsx(E, {})
281
+ }
282
+ ),
283
+ /* @__PURE__ */ i.jsxs(
284
+ l,
285
+ {
286
+ sx: {
287
+ position: "absolute",
288
+ top: { xs: 8, sm: 10, md: 12 },
289
+ left: { xs: 8, sm: 10, md: 12 },
290
+ zIndex: (t) => t.zIndex.modal + 102,
291
+ padding: 1,
292
+ px: 2,
293
+ fontSize: { xs: 14, sm: 16 },
294
+ color: "text.primary"
295
+ },
296
+ children: [
297
+ o + 1,
298
+ " / ",
299
+ n
300
+ ]
301
+ }
302
+ ),
303
+ /* @__PURE__ */ i.jsx(
304
+ j,
305
+ {
306
+ "aria-label": "Previous image",
307
+ onClick: (t) => {
308
+ t.stopPropagation(), x();
309
+ },
310
+ disabled: o === 0,
311
+ sx: {
312
+ position: "absolute",
313
+ left: { xs: 8, sm: 10, md: 12 },
314
+ top: "50%",
315
+ transform: "translateY(-50%)",
316
+ zIndex: (t) => t.zIndex.modal + 102,
317
+ "&:disabled": {
318
+ opacity: 0.5
319
+ }
320
+ },
321
+ children: /* @__PURE__ */ i.jsx(D, {})
322
+ }
323
+ ),
324
+ /* @__PURE__ */ i.jsx(
325
+ j,
326
+ {
327
+ "aria-label": "Next image",
328
+ onClick: (t) => {
329
+ t.stopPropagation(), p();
330
+ },
331
+ disabled: o === n - 1,
332
+ sx: {
333
+ position: "absolute",
334
+ right: { xs: 8, sm: 10, md: 12 },
335
+ top: "50%",
336
+ transform: "translateY(-50%)",
337
+ zIndex: (t) => t.zIndex.modal + 102,
338
+ "&:disabled": {
339
+ opacity: 0.5
340
+ }
341
+ },
342
+ children: /* @__PURE__ */ i.jsx(M, {})
256
343
  }
257
344
  )
258
345
  ]
@@ -261,15 +348,15 @@ const m = ({ item: r, sx: s, onClick: a }) => {
261
348
  }
262
349
  ),
263
350
  /* @__PURE__ */ i.jsx(
264
- p.div,
351
+ u.div,
265
352
  {
266
353
  drag: !0,
267
354
  dragMomentum: !1,
268
355
  dragElastic: 0.1,
269
356
  initial: !1,
270
- animate: { x: x.x, y: x.y },
271
- onDragEnd: (t, o) => {
272
- h((n) => ({ x: n.x + o.offset.x, y: n.y + o.offset.y }));
357
+ animate: { x: g.x, y: g.y },
358
+ onDragEnd: (t, c) => {
359
+ f((h) => ({ x: h.x + c.offset.x, y: h.y + c.offset.y }));
273
360
  },
274
361
  style: {
275
362
  position: "fixed",
@@ -296,11 +383,11 @@ const m = ({ item: r, sx: s, onClick: a }) => {
296
383
  px: 1.5,
297
384
  py: 1
298
385
  },
299
- children: /* @__PURE__ */ i.jsx(S, { direction: "row", alignItems: "center", spacing: -1.5, children: d.map((t, o) => /* @__PURE__ */ i.jsxs(
300
- p.div,
386
+ children: /* @__PURE__ */ i.jsx(P, { direction: "row", alignItems: "center", spacing: -1.5, children: d.map((t, c) => /* @__PURE__ */ i.jsxs(
387
+ u.div,
301
388
  {
302
- onClick: (n) => {
303
- n.stopPropagation(), e(t);
389
+ onClick: (h) => {
390
+ h.stopPropagation(), e(t);
304
391
  },
305
392
  style: {
306
393
  position: "relative",
@@ -309,15 +396,15 @@ const m = ({ item: r, sx: s, onClick: a }) => {
309
396
  borderRadius: 10,
310
397
  overflow: "hidden",
311
398
  flexShrink: 0,
312
- zIndex: r.id === t.id ? 30 : d.length - o,
399
+ zIndex: r.id === t.id ? 30 : d.length - c,
313
400
  border: r.id === t.id ? "2px solid" : void 0,
314
401
  borderColor: r.id === t.id ? "divider" : void 0,
315
402
  cursor: "pointer"
316
403
  },
317
- initial: { rotate: o % 2 === 0 ? -15 : 15 },
404
+ initial: { rotate: c % 2 === 0 ? -15 : 15 },
318
405
  animate: {
319
406
  scale: r.id === t.id ? 1.2 : 1,
320
- rotate: r.id === t.id ? 0 : o % 2 === 0 ? -15 : 15,
407
+ rotate: r.id === t.id ? 0 : c % 2 === 0 ? -15 : 15,
321
408
  y: r.id === t.id ? -8 : 0
322
409
  },
323
410
  whileHover: {
@@ -327,20 +414,20 @@ const m = ({ item: r, sx: s, onClick: a }) => {
327
414
  transition: { type: "spring", stiffness: 400, damping: 25 }
328
415
  },
329
416
  children: [
330
- /* @__PURE__ */ i.jsx(m, { item: t, sx: { width: "100%", height: "100%" }, onClick: () => e(t) }),
417
+ /* @__PURE__ */ i.jsx(w, { item: t, sx: { width: "100%", height: "100%" }, onClick: () => e(t) }),
331
418
  /* @__PURE__ */ i.jsx(
332
419
  l,
333
420
  {
334
421
  sx: {
335
422
  position: "absolute",
336
423
  inset: 0,
337
- background: (n) => `linear-gradient(to bottom, transparent, ${n.palette.action.hover}, ${n.palette.action.selected})`,
424
+ background: (h) => `linear-gradient(to bottom, transparent, ${h.palette.action.hover}, ${h.palette.action.selected})`,
338
425
  pointerEvents: "none"
339
426
  }
340
427
  }
341
428
  ),
342
429
  r.id === t.id && /* @__PURE__ */ i.jsx(
343
- p.div,
430
+ u.div,
344
431
  {
345
432
  layoutId: "activeGlow",
346
433
  style: {
@@ -365,14 +452,14 @@ const m = ({ item: r, sx: s, onClick: a }) => {
365
452
  ] })
366
453
  }
367
454
  ) : null;
368
- }, T = ({ mediaItems: r }) => {
369
- const [s, a] = u(null), [e, d] = u(r), [x, h] = u(!1);
455
+ }, W = ({ mediaItems: r }) => {
456
+ const [s, a] = b(null), [e, d] = b(r), [g, f] = b(!1);
370
457
  return v(() => {
371
458
  d(r);
372
459
  }, [r]), /* @__PURE__ */ i.jsxs(l, { sx: { width: "100%", position: "relative", zIndex: 1 }, children: [
373
460
  " ",
374
461
  s && /* @__PURE__ */ i.jsx(
375
- D,
462
+ L,
376
463
  {
377
464
  selectedItem: s,
378
465
  isOpen: !0,
@@ -381,8 +468,8 @@ const m = ({ item: r, sx: s, onClick: a }) => {
381
468
  mediaItems: e
382
469
  }
383
470
  ),
384
- /* @__PURE__ */ i.jsx(j, { mode: "wait", children: !s && /* @__PURE__ */ i.jsx(
385
- p.div,
471
+ /* @__PURE__ */ i.jsx(k, { mode: "wait", children: !s && /* @__PURE__ */ i.jsx(
472
+ u.div,
386
473
  {
387
474
  initial: "hidden",
388
475
  animate: "visible",
@@ -409,11 +496,11 @@ const m = ({ item: r, sx: s, onClick: a }) => {
409
496
  position: "relative"
410
497
  // Ensure proper stacking context
411
498
  },
412
- children: e.map((t, o) => /* @__PURE__ */ i.jsx(
413
- p.div,
499
+ children: e.map((o, n) => /* @__PURE__ */ i.jsx(
500
+ u.div,
414
501
  {
415
- layoutId: `media-${t.id}`,
416
- onClick: () => !x && a(t),
502
+ layoutId: `media-${o.id}`,
503
+ onClick: () => !g && a(o),
417
504
  variants: {
418
505
  hidden: { y: 50, scale: 0.9, opacity: 0 },
419
506
  visible: {
@@ -424,7 +511,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
424
511
  type: "spring",
425
512
  stiffness: 350,
426
513
  damping: 25,
427
- delay: o * 0.05
514
+ delay: n * 0.05
428
515
  }
429
516
  }
430
517
  },
@@ -432,19 +519,19 @@ const m = ({ item: r, sx: s, onClick: a }) => {
432
519
  drag: !0,
433
520
  dragConstraints: { left: 0, right: 0, top: 0, bottom: 0 },
434
521
  dragElastic: 1,
435
- onDragStart: () => h(!0),
436
- onDragEnd: (n, c) => {
437
- h(!1);
438
- const g = c.offset.x + c.offset.y;
439
- if (Math.abs(g) > 50) {
440
- const f = [...e], w = f[o], k = g > 0 ? Math.min(o + 1, e.length - 1) : Math.max(o - 1, 0);
441
- f.splice(o, 1), f.splice(k, 0, w), d(f);
522
+ onDragStart: () => f(!0),
523
+ onDragEnd: (x, p) => {
524
+ f(!1);
525
+ const t = p.offset.x + p.offset.y;
526
+ if (Math.abs(t) > 50) {
527
+ const c = [...e], h = c[n], I = t > 0 ? Math.min(n + 1, e.length - 1) : Math.max(n - 1, 0);
528
+ c.splice(n, 1), c.splice(I, 0, h), d(c);
442
529
  }
443
530
  },
444
531
  style: {
445
532
  position: "relative",
446
- gridRow: t.rowSpan ? `span ${t.rowSpan}` : "span 2",
447
- gridColumn: t.colSpan ? `span ${t.colSpan}` : "span 1"
533
+ gridRow: o.rowSpan ? `span ${o.rowSpan}` : "span 2",
534
+ gridColumn: o.colSpan ? `span ${o.colSpan}` : "span 1"
448
535
  },
449
536
  children: /* @__PURE__ */ i.jsxs(
450
537
  y,
@@ -462,15 +549,15 @@ const m = ({ item: r, sx: s, onClick: a }) => {
462
549
  },
463
550
  children: [
464
551
  /* @__PURE__ */ i.jsx(
465
- m,
552
+ w,
466
553
  {
467
- item: t,
554
+ item: o,
468
555
  sx: { position: "absolute", inset: 0, width: "100%", height: "100%" },
469
- onClick: () => !x && a(t)
556
+ onClick: () => !g && a(o)
470
557
  }
471
558
  ),
472
559
  /* @__PURE__ */ i.jsxs(
473
- p.div,
560
+ u.div,
474
561
  {
475
562
  style: {
476
563
  position: "absolute",
@@ -492,12 +579,12 @@ const m = ({ item: r, sx: s, onClick: a }) => {
492
579
  sx: {
493
580
  position: "absolute",
494
581
  inset: 0,
495
- background: (n) => `linear-gradient(to top, ${n.palette.grey[900]}CC, ${n.palette.grey[900]}66, transparent)`
582
+ background: (x) => `linear-gradient(to top, ${x.palette.grey[900]}CC, ${x.palette.grey[900]}66, transparent)`
496
583
  }
497
584
  }
498
585
  ),
499
586
  /* @__PURE__ */ i.jsx(
500
- b,
587
+ m,
501
588
  {
502
589
  variant: "subtitle2",
503
590
  sx: {
@@ -508,11 +595,11 @@ const m = ({ item: r, sx: s, onClick: a }) => {
508
595
  overflow: "hidden",
509
596
  textOverflow: "ellipsis"
510
597
  },
511
- children: t.title
598
+ children: o.title
512
599
  }
513
600
  ),
514
601
  /* @__PURE__ */ i.jsx(
515
- b,
602
+ m,
516
603
  {
517
604
  variant: "caption",
518
605
  sx: {
@@ -524,7 +611,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
524
611
  WebkitBoxOrient: "vertical",
525
612
  overflow: "hidden"
526
613
  },
527
- children: t.desc
614
+ children: o.desc
528
615
  }
529
616
  )
530
617
  ]
@@ -534,7 +621,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
534
621
  }
535
622
  )
536
623
  },
537
- t.id
624
+ o.id
538
625
  ))
539
626
  }
540
627
  )
@@ -543,7 +630,7 @@ const m = ({ item: r, sx: s, onClick: a }) => {
543
630
  ] });
544
631
  };
545
632
  export {
546
- D as GalleryModal,
547
- m as MediaItem,
548
- T as default
633
+ L as GalleryModal,
634
+ w as MediaItem,
635
+ W as default
549
636
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.78",
6
+ "version": "1.0.79",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "private": false,
9
9
  "type": "module",