@classytic/fluid 0.4.0 → 0.4.2

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.
@@ -0,0 +1,545 @@
1
+ "use client";
2
+
3
+ import { t as cn } from "../utils-DQ5SCVoW.mjs";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
6
+ import { ChevronLeft, ChevronRight, RotateCcw, X, ZoomIn, ZoomOut } from "lucide-react";
7
+ import Image from "next/image";
8
+
9
+ //#region src/components/gallery/gallery-context.tsx
10
+ const GalleryContext = createContext(null);
11
+ function useGallery() {
12
+ const context = useContext(GalleryContext);
13
+ if (!context) throw new Error("useGallery must be used within a GalleryProvider");
14
+ return context;
15
+ }
16
+ function useGalleryOptional() {
17
+ return useContext(GalleryContext);
18
+ }
19
+ function GalleryProvider({ children, images, defaultIndex = 0, classNames, title, onIndexChange }) {
20
+ const [selectedIndex, setSelectedIndexState] = useState(defaultIndex);
21
+ const [lightboxOpen, setLightboxOpen] = useState(false);
22
+ const setSelectedIndex = useCallback((index) => {
23
+ setSelectedIndexState(index);
24
+ onIndexChange?.(index);
25
+ }, [onIndexChange]);
26
+ const goToNext = useCallback(() => {
27
+ setSelectedIndex(selectedIndex === images.length - 1 ? 0 : selectedIndex + 1);
28
+ }, [
29
+ selectedIndex,
30
+ images.length,
31
+ setSelectedIndex
32
+ ]);
33
+ const goToPrevious = useCallback(() => {
34
+ setSelectedIndex(selectedIndex === 0 ? images.length - 1 : selectedIndex - 1);
35
+ }, [
36
+ selectedIndex,
37
+ images.length,
38
+ setSelectedIndex
39
+ ]);
40
+ const value = useMemo(() => ({
41
+ images,
42
+ selectedIndex,
43
+ setSelectedIndex,
44
+ lightboxOpen,
45
+ setLightboxOpen,
46
+ goToNext,
47
+ goToPrevious,
48
+ classNames,
49
+ title
50
+ }), [
51
+ images,
52
+ selectedIndex,
53
+ setSelectedIndex,
54
+ lightboxOpen,
55
+ goToNext,
56
+ goToPrevious,
57
+ classNames,
58
+ title
59
+ ]);
60
+ return /* @__PURE__ */ jsx(GalleryContext.Provider, {
61
+ value,
62
+ children
63
+ });
64
+ }
65
+
66
+ //#endregion
67
+ //#region src/components/gallery/gallery-main.tsx
68
+ function GalleryMain({ children, badges, showNav = true, aspectRatio = "aspect-[4/5]", className }) {
69
+ const { images, selectedIndex, setLightboxOpen, goToNext, goToPrevious, classNames, title } = useGallery();
70
+ const [imagesLoaded, setImagesLoaded] = useState(new Set([0]));
71
+ const [touchStart, setTouchStart] = useState(null);
72
+ const [touchEnd, setTouchEnd] = useState(null);
73
+ const sliderRef = useRef(null);
74
+ const minSwipeDistance = 50;
75
+ useEffect(() => {
76
+ images.forEach((img, index) => {
77
+ if (index === 0) return;
78
+ const preloadImg = new window.Image();
79
+ preloadImg.src = img.src;
80
+ preloadImg.onload = () => {
81
+ setImagesLoaded((prev) => new Set([...prev, index]));
82
+ };
83
+ });
84
+ }, [images]);
85
+ const onTouchStart = useCallback((e) => {
86
+ setTouchEnd(null);
87
+ setTouchStart(e.targetTouches[0].clientX);
88
+ }, []);
89
+ const onTouchMove = useCallback((e) => {
90
+ setTouchEnd(e.targetTouches[0].clientX);
91
+ }, []);
92
+ const onTouchEnd = useCallback(() => {
93
+ if (!touchStart || !touchEnd) return;
94
+ const distance = touchStart - touchEnd;
95
+ if (distance > minSwipeDistance) goToNext();
96
+ if (distance < -minSwipeDistance) goToPrevious();
97
+ }, [
98
+ touchStart,
99
+ touchEnd,
100
+ goToNext,
101
+ goToPrevious
102
+ ]);
103
+ const handleImageLoad = useCallback((index) => {
104
+ setImagesLoaded((prev) => new Set([...prev, index]));
105
+ }, []);
106
+ return /* @__PURE__ */ jsx("div", {
107
+ className: cn("relative", className),
108
+ children: /* @__PURE__ */ jsxs("div", {
109
+ ref: sliderRef,
110
+ className: cn(aspectRatio, "bg-muted overflow-hidden relative rounded-lg", classNames?.main),
111
+ onTouchStart,
112
+ onTouchMove,
113
+ onTouchEnd,
114
+ children: [
115
+ /* @__PURE__ */ jsx("div", {
116
+ className: cn("absolute inset-0 flex transition-transform duration-300 ease-out", classNames?.slider),
117
+ style: { transform: `translateX(-${selectedIndex * 100}%)` },
118
+ children: images.map((img, index) => /* @__PURE__ */ jsxs("div", {
119
+ className: "w-full h-full shrink-0 relative cursor-zoom-in",
120
+ onClick: () => setLightboxOpen(true),
121
+ children: [/* @__PURE__ */ jsx(Image, {
122
+ src: img.src,
123
+ alt: img.alt || `${title || "Gallery"} - Image ${index + 1}`,
124
+ fill: true,
125
+ className: cn("object-cover transition-opacity duration-300", imagesLoaded.has(index) ? "opacity-100" : "opacity-0", classNames?.mainImage),
126
+ sizes: "(max-width: 768px) 100vw, 50vw",
127
+ priority: index === 0,
128
+ onLoad: () => handleImageLoad(index)
129
+ }), !imagesLoaded.has(index) && /* @__PURE__ */ jsx("div", {
130
+ className: "absolute inset-0 flex items-center justify-center bg-muted",
131
+ children: /* @__PURE__ */ jsx("div", { className: "w-8 h-8 border-2 border-muted-foreground/20 border-t-muted-foreground rounded-full animate-spin" })
132
+ })]
133
+ }, index))
134
+ }),
135
+ badges && badges.length > 0 && /* @__PURE__ */ jsx("div", {
136
+ className: cn("absolute top-4 left-4 flex flex-col gap-2 z-10", classNames?.badges),
137
+ children: badges.map((badge, index) => /* @__PURE__ */ jsx("span", {
138
+ className: cn("px-3 py-1 text-xs font-medium uppercase tracking-wider", classNames?.badge, badge.className),
139
+ children: badge.label
140
+ }, index))
141
+ }),
142
+ showNav && images.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
143
+ type: "button",
144
+ onClick: (e) => {
145
+ e.stopPropagation();
146
+ goToPrevious();
147
+ },
148
+ className: cn("hidden sm:flex absolute left-3 top-1/2 -translate-y-1/2 z-10", "w-10 h-10 items-center justify-center rounded-full", "bg-background/80 backdrop-blur-sm shadow-md hover:bg-background transition-colors", classNames?.nav, classNames?.navPrev),
149
+ "aria-label": "Previous image",
150
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-5 w-5" })
151
+ }), /* @__PURE__ */ jsx("button", {
152
+ type: "button",
153
+ onClick: (e) => {
154
+ e.stopPropagation();
155
+ goToNext();
156
+ },
157
+ className: cn("hidden sm:flex absolute right-3 top-1/2 -translate-y-1/2 z-10", "w-10 h-10 items-center justify-center rounded-full", "bg-background/80 backdrop-blur-sm shadow-md hover:bg-background transition-colors", classNames?.nav, classNames?.navNext),
158
+ "aria-label": "Next image",
159
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-5 w-5" })
160
+ })] }),
161
+ children
162
+ ]
163
+ })
164
+ });
165
+ }
166
+
167
+ //#endregion
168
+ //#region src/components/gallery/gallery-thumbnails.tsx
169
+ function GalleryThumbnails({ showOnMobile = true, orientation = "horizontal", sizeClassName = "w-16 h-20 sm:w-20 sm:h-24", className }) {
170
+ const { images, selectedIndex, setSelectedIndex, classNames, title } = useGallery();
171
+ if (images.length <= 1) return null;
172
+ return /* @__PURE__ */ jsx("div", {
173
+ className: cn("flex gap-2 sm:gap-3 scrollbar-hide", orientation === "vertical" ? "flex-col overflow-y-auto pr-2" : "overflow-x-auto pb-2", !showOnMobile && "hidden sm:flex", classNames?.thumbnails, className),
174
+ children: images.map((img, index) => /* @__PURE__ */ jsx("button", {
175
+ type: "button",
176
+ onClick: () => setSelectedIndex(index),
177
+ className: cn("bg-muted overflow-hidden border-2 transition-all duration-200 shrink-0 rounded-md relative", sizeClassName, selectedIndex === index ? cn("border-foreground", classNames?.thumbnailActive) : cn("border-transparent opacity-60 hover:opacity-100", classNames?.thumbnail)),
178
+ "aria-label": `View image ${index + 1}`,
179
+ children: /* @__PURE__ */ jsx(Image, {
180
+ src: img.thumbnail || img.src,
181
+ alt: img.alt || `${title || "Gallery"} thumbnail ${index + 1}`,
182
+ fill: true,
183
+ className: "object-cover",
184
+ sizes: "80px"
185
+ })
186
+ }, index))
187
+ });
188
+ }
189
+
190
+ //#endregion
191
+ //#region src/components/gallery/gallery-dots.tsx
192
+ function GalleryDots({ showOnDesktop = false, className }) {
193
+ const { images, selectedIndex, setSelectedIndex, classNames } = useGallery();
194
+ if (images.length <= 1) return null;
195
+ return /* @__PURE__ */ jsx("div", {
196
+ className: cn("flex justify-center gap-2 mt-3", !showOnDesktop && "sm:hidden", classNames?.dots, className),
197
+ children: images.map((_, index) => /* @__PURE__ */ jsx("button", {
198
+ type: "button",
199
+ onClick: () => setSelectedIndex(index),
200
+ className: cn("h-2 rounded-full transition-all duration-300", selectedIndex === index ? cn("bg-foreground w-6", classNames?.dotActive) : cn("bg-muted-foreground/30 hover:bg-muted-foreground/50 w-2", classNames?.dot)),
201
+ "aria-label": `Go to image ${index + 1}`
202
+ }, index))
203
+ });
204
+ }
205
+
206
+ //#endregion
207
+ //#region src/components/gallery/gallery-lightbox.tsx
208
+ const MIN_ZOOM = 1;
209
+ const MAX_ZOOM = 4;
210
+ const ZOOM_STEP = .5;
211
+ function GalleryLightbox({ className }) {
212
+ const { images, selectedIndex, setSelectedIndex, lightboxOpen, setLightboxOpen, goToNext, goToPrevious, classNames, title } = useGallery();
213
+ const [zoom, setZoom] = useState(1);
214
+ const [position, setPosition] = useState({
215
+ x: 0,
216
+ y: 0
217
+ });
218
+ const [isDragging, setIsDragging] = useState(false);
219
+ const [dragStart, setDragStart] = useState({
220
+ x: 0,
221
+ y: 0
222
+ });
223
+ const [imageLoaded, setImageLoaded] = useState(false);
224
+ useEffect(() => {
225
+ setZoom(1);
226
+ setPosition({
227
+ x: 0,
228
+ y: 0
229
+ });
230
+ setImageLoaded(false);
231
+ }, [selectedIndex, lightboxOpen]);
232
+ useEffect(() => {
233
+ if (!lightboxOpen) return;
234
+ const handleKeyDown = (e) => {
235
+ switch (e.key) {
236
+ case "Escape":
237
+ setLightboxOpen(false);
238
+ break;
239
+ case "ArrowLeft":
240
+ goToPrevious();
241
+ break;
242
+ case "ArrowRight":
243
+ goToNext();
244
+ break;
245
+ case "+":
246
+ case "=":
247
+ setZoom((prev) => Math.min(prev + ZOOM_STEP, MAX_ZOOM));
248
+ break;
249
+ case "-":
250
+ setZoom((prev) => {
251
+ const newZoom = Math.max(prev - ZOOM_STEP, MIN_ZOOM);
252
+ if (newZoom === 1) setPosition({
253
+ x: 0,
254
+ y: 0
255
+ });
256
+ return newZoom;
257
+ });
258
+ break;
259
+ case "0":
260
+ setZoom(1);
261
+ setPosition({
262
+ x: 0,
263
+ y: 0
264
+ });
265
+ break;
266
+ }
267
+ };
268
+ document.addEventListener("keydown", handleKeyDown);
269
+ return () => document.removeEventListener("keydown", handleKeyDown);
270
+ }, [
271
+ lightboxOpen,
272
+ goToNext,
273
+ goToPrevious,
274
+ setLightboxOpen
275
+ ]);
276
+ useEffect(() => {
277
+ if (lightboxOpen) document.body.style.overflow = "hidden";
278
+ else document.body.style.overflow = "";
279
+ return () => {
280
+ document.body.style.overflow = "";
281
+ };
282
+ }, [lightboxOpen]);
283
+ const handleWheel = useCallback((e) => {
284
+ e.preventDefault();
285
+ const delta = e.deltaY > 0 ? -ZOOM_STEP : ZOOM_STEP;
286
+ setZoom((prev) => {
287
+ const newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, prev + delta));
288
+ if (newZoom === 1) setPosition({
289
+ x: 0,
290
+ y: 0
291
+ });
292
+ return newZoom;
293
+ });
294
+ }, []);
295
+ const handleMouseDown = (e) => {
296
+ if (zoom > 1) {
297
+ setIsDragging(true);
298
+ setDragStart({
299
+ x: e.clientX - position.x,
300
+ y: e.clientY - position.y
301
+ });
302
+ }
303
+ };
304
+ const handleMouseMove = (e) => {
305
+ if (isDragging && zoom > 1) setPosition({
306
+ x: e.clientX - dragStart.x,
307
+ y: e.clientY - dragStart.y
308
+ });
309
+ };
310
+ const handleMouseUp = () => setIsDragging(false);
311
+ const handleTouchStart = (e) => {
312
+ if (zoom > 1 && e.touches.length === 1) {
313
+ setIsDragging(true);
314
+ setDragStart({
315
+ x: e.touches[0].clientX - position.x,
316
+ y: e.touches[0].clientY - position.y
317
+ });
318
+ }
319
+ };
320
+ const handleTouchMove = (e) => {
321
+ if (isDragging && zoom > 1 && e.touches.length === 1) setPosition({
322
+ x: e.touches[0].clientX - dragStart.x,
323
+ y: e.touches[0].clientY - dragStart.y
324
+ });
325
+ };
326
+ const handleDoubleClick = () => {
327
+ if (zoom > 1) {
328
+ setZoom(1);
329
+ setPosition({
330
+ x: 0,
331
+ y: 0
332
+ });
333
+ } else setZoom(2);
334
+ };
335
+ if (!lightboxOpen) return null;
336
+ const currentImage = images[selectedIndex];
337
+ return /* @__PURE__ */ jsxs("div", {
338
+ className: cn("fixed inset-0 z-50 bg-black", classNames?.lightbox, className),
339
+ role: "dialog",
340
+ "aria-modal": "true",
341
+ "aria-label": `${title || "Gallery"} - Image ${selectedIndex + 1} of ${images.length}`,
342
+ children: [
343
+ /* @__PURE__ */ jsxs("div", {
344
+ className: cn("absolute top-0 left-0 right-0 z-50", "flex items-center justify-between p-4", "bg-gradient-to-b from-black/60 to-transparent", classNames?.lightboxHeader),
345
+ children: [
346
+ /* @__PURE__ */ jsxs("span", {
347
+ className: "text-white text-sm font-medium",
348
+ children: [
349
+ selectedIndex + 1,
350
+ " / ",
351
+ images.length
352
+ ]
353
+ }),
354
+ /* @__PURE__ */ jsxs("div", {
355
+ className: "flex items-center gap-2",
356
+ children: [
357
+ /* @__PURE__ */ jsx("button", {
358
+ type: "button",
359
+ onClick: () => setZoom((prev) => {
360
+ const newZoom = Math.max(prev - ZOOM_STEP, MIN_ZOOM);
361
+ if (newZoom === 1) setPosition({
362
+ x: 0,
363
+ y: 0
364
+ });
365
+ return newZoom;
366
+ }),
367
+ disabled: zoom <= MIN_ZOOM,
368
+ className: "p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors disabled:opacity-30",
369
+ "aria-label": "Zoom out",
370
+ children: /* @__PURE__ */ jsx(ZoomOut, { className: "h-5 w-5 text-white" })
371
+ }),
372
+ /* @__PURE__ */ jsxs("span", {
373
+ className: "text-white text-sm min-w-[3rem] text-center",
374
+ children: [Math.round(zoom * 100), "%"]
375
+ }),
376
+ /* @__PURE__ */ jsx("button", {
377
+ type: "button",
378
+ onClick: () => setZoom((prev) => Math.min(prev + ZOOM_STEP, MAX_ZOOM)),
379
+ disabled: zoom >= MAX_ZOOM,
380
+ className: "p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors disabled:opacity-30",
381
+ "aria-label": "Zoom in",
382
+ children: /* @__PURE__ */ jsx(ZoomIn, { className: "h-5 w-5 text-white" })
383
+ }),
384
+ /* @__PURE__ */ jsx("button", {
385
+ type: "button",
386
+ onClick: () => {
387
+ setZoom(1);
388
+ setPosition({
389
+ x: 0,
390
+ y: 0
391
+ });
392
+ },
393
+ disabled: zoom === 1,
394
+ className: "p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors disabled:opacity-30",
395
+ "aria-label": "Reset zoom",
396
+ children: /* @__PURE__ */ jsx(RotateCcw, { className: "h-5 w-5 text-white" })
397
+ })
398
+ ]
399
+ }),
400
+ /* @__PURE__ */ jsx("button", {
401
+ type: "button",
402
+ onClick: () => setLightboxOpen(false),
403
+ className: "p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors",
404
+ "aria-label": "Close",
405
+ children: /* @__PURE__ */ jsx(X, { className: "h-6 w-6 text-white" })
406
+ })
407
+ ]
408
+ }),
409
+ /* @__PURE__ */ jsxs("div", {
410
+ className: cn("absolute inset-0 flex items-center justify-center", zoom > 1 ? "cursor-grab" : "cursor-zoom-in", isDragging && "cursor-grabbing"),
411
+ onWheel: handleWheel,
412
+ onMouseDown: handleMouseDown,
413
+ onMouseMove: handleMouseMove,
414
+ onMouseUp: handleMouseUp,
415
+ onMouseLeave: handleMouseUp,
416
+ onTouchStart: handleTouchStart,
417
+ onTouchMove: handleTouchMove,
418
+ onTouchEnd: handleMouseUp,
419
+ onDoubleClick: handleDoubleClick,
420
+ children: [!imageLoaded && /* @__PURE__ */ jsx("div", {
421
+ className: "absolute inset-0 flex items-center justify-center",
422
+ children: /* @__PURE__ */ jsx("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" })
423
+ }), /* @__PURE__ */ jsx("div", {
424
+ className: "relative w-full h-full transition-transform duration-100",
425
+ style: { transform: `scale(${zoom}) translate(${position.x / zoom}px, ${position.y / zoom}px)` },
426
+ children: /* @__PURE__ */ jsx(Image, {
427
+ src: currentImage.src,
428
+ alt: currentImage.alt || `${title || "Gallery"} - Image ${selectedIndex + 1}`,
429
+ fill: true,
430
+ className: cn("object-contain transition-opacity duration-300", imageLoaded ? "opacity-100" : "opacity-0", classNames?.lightboxImage),
431
+ sizes: "100vw",
432
+ quality: 100,
433
+ priority: true,
434
+ unoptimized: true,
435
+ onLoad: () => setImageLoaded(true)
436
+ })
437
+ })]
438
+ }),
439
+ images.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
440
+ type: "button",
441
+ onClick: goToPrevious,
442
+ className: "absolute left-4 top-1/2 -translate-y-1/2 z-50 p-3 rounded-full bg-white/10 hover:bg-white/20 transition-colors",
443
+ "aria-label": "Previous",
444
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-8 w-8 text-white" })
445
+ }), /* @__PURE__ */ jsx("button", {
446
+ type: "button",
447
+ onClick: goToNext,
448
+ className: "absolute right-4 top-1/2 -translate-y-1/2 z-50 p-3 rounded-full bg-white/10 hover:bg-white/20 transition-colors",
449
+ "aria-label": "Next",
450
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-8 w-8 text-white" })
451
+ })] }),
452
+ images.length > 1 && /* @__PURE__ */ jsxs("div", {
453
+ className: cn("absolute bottom-0 left-0 right-0 z-50 p-4", "bg-gradient-to-t from-black/60 to-transparent", classNames?.lightboxFooter),
454
+ children: [/* @__PURE__ */ jsx("div", {
455
+ className: "flex justify-center gap-2 overflow-x-auto max-w-full pb-2",
456
+ children: images.map((img, index) => /* @__PURE__ */ jsx("button", {
457
+ type: "button",
458
+ onClick: () => setSelectedIndex(index),
459
+ className: cn("w-16 h-16 md:w-20 md:h-20 overflow-hidden border-2 transition-all shrink-0 rounded-md relative", selectedIndex === index ? "border-white opacity-100" : "border-transparent opacity-50 hover:opacity-80"),
460
+ "aria-label": `View image ${index + 1}`,
461
+ children: /* @__PURE__ */ jsx(Image, {
462
+ src: img.thumbnail || img.src,
463
+ alt: img.alt || `Thumbnail ${index + 1}`,
464
+ fill: true,
465
+ className: "object-cover",
466
+ sizes: "80px"
467
+ })
468
+ }, index))
469
+ }), /* @__PURE__ */ jsx("p", {
470
+ className: "text-white/50 text-xs text-center mt-2 hidden md:block",
471
+ children: "Scroll to zoom · Double-click to toggle · Drag to pan · Arrow keys to navigate"
472
+ })]
473
+ })
474
+ ]
475
+ });
476
+ }
477
+
478
+ //#endregion
479
+ //#region src/components/gallery/gallery-nav.tsx
480
+ function GalleryNav({ direction, className, children }) {
481
+ const { images, goToNext, goToPrevious, classNames } = useGallery();
482
+ if (images.length <= 1) return null;
483
+ const isPrev = direction === "prev";
484
+ return /* @__PURE__ */ jsx("button", {
485
+ type: "button",
486
+ onClick: isPrev ? goToPrevious : goToNext,
487
+ className: cn("flex items-center justify-center", "w-10 h-10 rounded-full", "bg-background/80 backdrop-blur-sm shadow-md hover:bg-background transition-colors", classNames?.nav, isPrev ? classNames?.navPrev : classNames?.navNext, className),
488
+ "aria-label": isPrev ? "Previous image" : "Next image",
489
+ children: children || (isPrev ? /* @__PURE__ */ jsx(ChevronLeft, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-5 w-5" }))
490
+ });
491
+ }
492
+
493
+ //#endregion
494
+ //#region src/components/gallery/index.tsx
495
+ function ImageGalleryRoot({ children, images, defaultIndex = 0, classNames, title, onIndexChange, className }) {
496
+ return /* @__PURE__ */ jsx(GalleryProvider, {
497
+ images,
498
+ defaultIndex,
499
+ classNames,
500
+ title,
501
+ onIndexChange,
502
+ children: /* @__PURE__ */ jsx("div", {
503
+ className: cn("space-y-4", classNames?.root, className),
504
+ children
505
+ })
506
+ });
507
+ }
508
+ function ImageGallerySimple({ images, title, badges, defaultIndex = 0, showMobileThumbnails = true, aspectRatio = "aspect-[4/5]", showNav = true, classNames, onIndexChange, className }) {
509
+ if (!images || images.length === 0) return /* @__PURE__ */ jsx("div", {
510
+ className: cn(aspectRatio, "bg-muted flex items-center justify-center rounded-lg", className),
511
+ children: /* @__PURE__ */ jsx("span", {
512
+ className: "text-muted-foreground",
513
+ children: "No image available"
514
+ })
515
+ });
516
+ return /* @__PURE__ */ jsxs(ImageGalleryRoot, {
517
+ images,
518
+ defaultIndex,
519
+ classNames,
520
+ title,
521
+ onIndexChange,
522
+ className,
523
+ children: [
524
+ /* @__PURE__ */ jsx(GalleryMain, {
525
+ badges,
526
+ showNav,
527
+ aspectRatio
528
+ }),
529
+ !showMobileThumbnails && /* @__PURE__ */ jsx(GalleryDots, {}),
530
+ /* @__PURE__ */ jsx(GalleryThumbnails, { showOnMobile: showMobileThumbnails }),
531
+ /* @__PURE__ */ jsx(GalleryLightbox, {})
532
+ ]
533
+ });
534
+ }
535
+ const ImageGallery = Object.assign(ImageGallerySimple, {
536
+ Root: ImageGalleryRoot,
537
+ Main: GalleryMain,
538
+ Thumbnails: GalleryThumbnails,
539
+ Dots: GalleryDots,
540
+ Nav: GalleryNav,
541
+ Lightbox: GalleryLightbox
542
+ });
543
+
544
+ //#endregion
545
+ export { ImageGallery, useGallery, useGalleryOptional };