@moontra/moonui-pro 2.20.2 → 2.20.4

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.
Files changed (153) hide show
  1. package/package.json +8 -3
  2. package/plugin/index.d.ts +86 -0
  3. package/plugin/index.js +308 -0
  4. package/scripts/postinstall.js +191 -23
  5. package/src/components/advanced-chart/index.tsx +0 -1246
  6. package/src/components/advanced-forms/index.tsx +0 -585
  7. package/src/components/animated-button/index.tsx +0 -385
  8. package/src/components/calendar/event-dialog.tsx +0 -377
  9. package/src/components/calendar/index.tsx +0 -1220
  10. package/src/components/calendar-pro/index.tsx +0 -1697
  11. package/src/components/color-picker/index.tsx +0 -432
  12. package/src/components/credit-card-input/index.tsx +0 -406
  13. package/src/components/dashboard/dashboard-grid.tsx +0 -480
  14. package/src/components/dashboard/demo.tsx +0 -425
  15. package/src/components/dashboard/index.tsx +0 -1046
  16. package/src/components/dashboard/time-range-picker.tsx +0 -336
  17. package/src/components/dashboard/types.ts +0 -225
  18. package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
  19. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  20. package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
  21. package/src/components/dashboard/widgets/index.ts +0 -5
  22. package/src/components/dashboard/widgets/metric-card.tsx +0 -363
  23. package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
  24. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  25. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  26. package/src/components/data-table/data-table-export.ts +0 -156
  27. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  28. package/src/components/data-table/index.tsx +0 -845
  29. package/src/components/draggable-list/index.tsx +0 -100
  30. package/src/components/error-boundary/index.tsx +0 -232
  31. package/src/components/file-upload/index.tsx +0 -1660
  32. package/src/components/floating-action-button/index.tsx +0 -206
  33. package/src/components/form-wizard/form-wizard-context.tsx +0 -335
  34. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  35. package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
  36. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  37. package/src/components/form-wizard/index.tsx +0 -102
  38. package/src/components/form-wizard/types.ts +0 -77
  39. package/src/components/gesture-drawer/index.tsx +0 -551
  40. package/src/components/github-stars/github-api.ts +0 -426
  41. package/src/components/github-stars/hooks.ts +0 -517
  42. package/src/components/github-stars/index.tsx +0 -375
  43. package/src/components/github-stars/types.ts +0 -148
  44. package/src/components/github-stars/variants.tsx +0 -515
  45. package/src/components/health-check/index.tsx +0 -439
  46. package/src/components/hover-card-3d/index.tsx +0 -529
  47. package/src/components/index.ts +0 -130
  48. package/src/components/internal/index.ts +0 -78
  49. package/src/components/kanban/add-card-modal.tsx +0 -502
  50. package/src/components/kanban/card-detail-modal.tsx +0 -761
  51. package/src/components/kanban/index.ts +0 -13
  52. package/src/components/kanban/kanban.tsx +0 -1689
  53. package/src/components/kanban/types.ts +0 -168
  54. package/src/components/lazy-component/index.tsx +0 -823
  55. package/src/components/license-error/index.tsx +0 -31
  56. package/src/components/magnetic-button/index.tsx +0 -216
  57. package/src/components/memory-efficient-data/index.tsx +0 -1018
  58. package/src/components/moonui-quiz-form/index.tsx +0 -817
  59. package/src/components/navbar/index.tsx +0 -781
  60. package/src/components/optimized-image/index.tsx +0 -425
  61. package/src/components/performance-debugger/index.tsx +0 -613
  62. package/src/components/performance-monitor/index.tsx +0 -808
  63. package/src/components/phone-number-input/index.tsx +0 -343
  64. package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
  65. package/src/components/pinch-zoom/index.tsx +0 -566
  66. package/src/components/quiz-form/index.tsx +0 -479
  67. package/src/components/rich-text-editor/index.tsx +0 -2322
  68. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
  69. package/src/components/rich-text-editor/slash-commands.css +0 -35
  70. package/src/components/rich-text-editor/table-styles.css +0 -65
  71. package/src/components/sidebar/index.tsx +0 -884
  72. package/src/components/spotlight-card/index.tsx +0 -191
  73. package/src/components/swipeable-card/index.tsx +0 -100
  74. package/src/components/timeline/index.tsx +0 -1183
  75. package/src/components/ui/accordion.tsx +0 -581
  76. package/src/components/ui/alert-dialog.tsx +0 -141
  77. package/src/components/ui/alert.tsx +0 -141
  78. package/src/components/ui/aspect-ratio.tsx +0 -245
  79. package/src/components/ui/avatar.tsx +0 -155
  80. package/src/components/ui/badge.tsx +0 -230
  81. package/src/components/ui/breadcrumb.tsx +0 -216
  82. package/src/components/ui/button.tsx +0 -228
  83. package/src/components/ui/calendar.tsx +0 -387
  84. package/src/components/ui/card.tsx +0 -216
  85. package/src/components/ui/checkbox.tsx +0 -259
  86. package/src/components/ui/collapsible.tsx +0 -631
  87. package/src/components/ui/color-picker.tsx +0 -97
  88. package/src/components/ui/command.tsx +0 -948
  89. package/src/components/ui/dialog.tsx +0 -752
  90. package/src/components/ui/dropdown-menu.tsx +0 -706
  91. package/src/components/ui/gesture-drawer.tsx +0 -11
  92. package/src/components/ui/hover-card.tsx +0 -29
  93. package/src/components/ui/index.ts +0 -222
  94. package/src/components/ui/input.tsx +0 -224
  95. package/src/components/ui/label.tsx +0 -29
  96. package/src/components/ui/lightbox.tsx +0 -606
  97. package/src/components/ui/magnetic-button.tsx +0 -129
  98. package/src/components/ui/media-gallery.tsx +0 -611
  99. package/src/components/ui/navigation-menu.tsx +0 -130
  100. package/src/components/ui/pagination.tsx +0 -125
  101. package/src/components/ui/popover.tsx +0 -185
  102. package/src/components/ui/progress.tsx +0 -30
  103. package/src/components/ui/radio-group.tsx +0 -257
  104. package/src/components/ui/scroll-area.tsx +0 -47
  105. package/src/components/ui/select.tsx +0 -378
  106. package/src/components/ui/separator.tsx +0 -145
  107. package/src/components/ui/sheet.tsx +0 -139
  108. package/src/components/ui/skeleton.tsx +0 -20
  109. package/src/components/ui/slider.tsx +0 -354
  110. package/src/components/ui/spotlight-card.tsx +0 -119
  111. package/src/components/ui/switch.tsx +0 -86
  112. package/src/components/ui/table.tsx +0 -331
  113. package/src/components/ui/tabs-pro.tsx +0 -542
  114. package/src/components/ui/tabs.tsx +0 -54
  115. package/src/components/ui/textarea.tsx +0 -28
  116. package/src/components/ui/toast.tsx +0 -317
  117. package/src/components/ui/toggle.tsx +0 -119
  118. package/src/components/ui/tooltip.tsx +0 -151
  119. package/src/components/virtual-list/index.tsx +0 -668
  120. package/src/hooks/use-chart.ts +0 -205
  121. package/src/hooks/use-data-table.ts +0 -182
  122. package/src/hooks/use-docs-pro-access.ts +0 -13
  123. package/src/hooks/use-license-check.ts +0 -65
  124. package/src/hooks/use-subscription.ts +0 -19
  125. package/src/hooks/use-toast.ts +0 -15
  126. package/src/index.ts +0 -22
  127. package/src/lib/ai-providers.ts +0 -377
  128. package/src/lib/component-metadata.ts +0 -18
  129. package/src/lib/micro-interactions.ts +0 -255
  130. package/src/lib/paddle.ts +0 -17
  131. package/src/lib/utils.ts +0 -6
  132. package/src/patterns/login-form/index.tsx +0 -276
  133. package/src/patterns/login-form/types.ts +0 -67
  134. package/src/setupTests.ts +0 -41
  135. package/src/styles/advanced-chart.css +0 -239
  136. package/src/styles/calendar.css +0 -35
  137. package/src/styles/design-system.css +0 -363
  138. package/src/styles/index.css +0 -681
  139. package/src/styles/tailwind.css +0 -7
  140. package/src/styles/tokens.css +0 -455
  141. package/src/types/next-auth.d.ts +0 -21
  142. package/src/use-intersection-observer.tsx +0 -154
  143. package/src/use-local-storage.tsx +0 -71
  144. package/src/use-paddle.ts +0 -138
  145. package/src/use-performance-optimizer.ts +0 -389
  146. package/src/use-pro-access.ts +0 -141
  147. package/src/use-scroll-animation.ts +0 -219
  148. package/src/use-subscription.ts +0 -37
  149. package/src/use-toast.ts +0 -32
  150. package/src/utils/chart-helpers.ts +0 -357
  151. package/src/utils/cn.ts +0 -6
  152. package/src/utils/data-processing.ts +0 -151
  153. package/src/utils/license-validator.tsx +0 -183
@@ -1,611 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { cva, type VariantProps } from "class-variance-authority"
5
- import { motion, AnimatePresence } from "framer-motion"
6
- import { Grid3x3, LayoutGrid, Square, Columns, Filter, SortAsc, Image as ImageIcon, Video, X, Loader2 } from "lucide-react"
7
-
8
- import { cn } from "../../lib/utils"
9
- import {
10
- MoonUILightboxProviderPro,
11
- MoonUILightboxTriggerPro,
12
- MoonUILightboxContentPro,
13
- type MediaItem
14
- } from "./lightbox"
15
-
16
- /**
17
- * Premium Media Gallery Component
18
- *
19
- * Advanced gallery component for displaying images and videos in responsive layouts
20
- * with filtering, sorting, lightbox integration, and smooth animations.
21
- * Perfect for portfolios, product galleries, and media showcases.
22
- */
23
-
24
- const galleryVariants = cva(
25
- "w-full",
26
- {
27
- variants: {
28
- layout: {
29
- grid: "grid gap-4",
30
- masonry: "",
31
- horizontal: "flex overflow-x-auto gap-4 pb-4 snap-x snap-mandatory [&>*]:snap-center",
32
- justified: "flex flex-wrap gap-2",
33
- },
34
- columns: {
35
- 1: "grid-cols-1",
36
- 2: "grid-cols-1 sm:grid-cols-2",
37
- 3: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3",
38
- 4: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
39
- 5: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5",
40
- 6: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6",
41
- },
42
- },
43
- defaultVariants: {
44
- layout: "grid",
45
- columns: 3,
46
- },
47
- }
48
- )
49
-
50
- const galleryItemVariants = cva(
51
- "relative overflow-hidden cursor-pointer group",
52
- {
53
- variants: {
54
- variant: {
55
- default: "rounded-lg",
56
- card: "rounded-lg shadow-sm border border-border bg-card",
57
- ghost: "rounded-lg hover:bg-accent/50",
58
- outline: "rounded-lg border-2 border-transparent hover:border-primary",
59
- glass: "rounded-lg backdrop-blur-md bg-white/10 border border-white/20",
60
- },
61
- aspectRatio: {
62
- square: "aspect-square",
63
- video: "aspect-video",
64
- portrait: "aspect-[3/4]",
65
- auto: "",
66
- },
67
- hover: {
68
- none: "",
69
- zoom: "transition-transform duration-300 hover:scale-105",
70
- lift: "transition-all duration-300 hover:-translate-y-1 hover:shadow-lg",
71
- glow: "transition-all duration-300 hover:shadow-lg hover:shadow-primary/20",
72
- },
73
- },
74
- defaultVariants: {
75
- variant: "default",
76
- aspectRatio: "square",
77
- hover: "zoom",
78
- },
79
- }
80
- )
81
-
82
- interface GalleryCategory {
83
- id: string
84
- label: string
85
- icon?: React.ReactNode
86
- }
87
-
88
- interface GallerySortOption {
89
- id: string
90
- label: string
91
- compareFn: (a: MediaItem, b: MediaItem) => number
92
- }
93
-
94
- interface MoonUIMediaGalleryProProps
95
- extends React.HTMLAttributes<HTMLDivElement>,
96
- VariantProps<typeof galleryVariants> {
97
- items: MediaItem[]
98
- variant?: VariantProps<typeof galleryItemVariants>["variant"]
99
- aspectRatio?: VariantProps<typeof galleryItemVariants>["aspectRatio"]
100
- hover?: VariantProps<typeof galleryItemVariants>["hover"]
101
- enableLightbox?: boolean
102
- enableFiltering?: boolean
103
- enableSorting?: boolean
104
- categories?: GalleryCategory[]
105
- sortOptions?: GallerySortOption[]
106
- defaultCategory?: string
107
- defaultSort?: string
108
- showItemType?: boolean
109
- showOverlay?: boolean
110
- overlayContent?: (item: MediaItem, index: number) => React.ReactNode
111
- loadingState?: boolean
112
- skeletonCount?: number
113
- emptyState?: React.ReactNode
114
- onItemClick?: (item: MediaItem, index: number) => void
115
- lazyLoad?: boolean
116
- infiniteScroll?: boolean
117
- onLoadMore?: () => void
118
- hasMore?: boolean
119
- lightboxProps?: Partial<React.ComponentProps<typeof MoonUILightboxContentPro>>
120
- }
121
-
122
- const MoonUIMediaGalleryPro = React.forwardRef<
123
- HTMLDivElement,
124
- MoonUIMediaGalleryProProps
125
- >(({
126
- className,
127
- items,
128
- layout,
129
- columns,
130
- variant,
131
- aspectRatio,
132
- hover,
133
- enableLightbox = true,
134
- enableFiltering = false,
135
- enableSorting = false,
136
- categories = [],
137
- sortOptions = [],
138
- defaultCategory = "all",
139
- defaultSort = "default",
140
- showItemType = true,
141
- showOverlay = true,
142
- overlayContent,
143
- loadingState = false,
144
- skeletonCount = 6,
145
- emptyState,
146
- onItemClick,
147
- lazyLoad = true,
148
- infiniteScroll = false,
149
- onLoadMore,
150
- hasMore = false,
151
- lightboxProps,
152
- ...props
153
- }, ref) => {
154
- const [activeCategory, setActiveCategory] = React.useState(defaultCategory)
155
- const [activeSort, setActiveSort] = React.useState(defaultSort)
156
- const [showFilters, setShowFilters] = React.useState(false)
157
- const [loadedImages, setLoadedImages] = React.useState<Set<number>>(new Set())
158
- const observerRef = React.useRef<IntersectionObserver | null>(null)
159
- const loadMoreRef = React.useRef<HTMLDivElement>(null)
160
-
161
- // Filter items by category
162
- const filteredItems = React.useMemo(() => {
163
- if (!enableFiltering || activeCategory === "all") return items
164
-
165
- return items.filter(item => {
166
- // Check if item has category property
167
- if ('category' in item && typeof item.category === 'string') {
168
- return item.category === activeCategory
169
- }
170
- // Fallback to type-based filtering
171
- if (activeCategory === "image") return item.type === "image"
172
- if (activeCategory === "video") return item.type === "video"
173
- return true
174
- })
175
- }, [items, activeCategory, enableFiltering])
176
-
177
- // Sort items
178
- const sortedItems = React.useMemo(() => {
179
- if (!enableSorting || activeSort === "default") return filteredItems
180
-
181
- const sortOption = sortOptions.find(opt => opt.id === activeSort)
182
- if (!sortOption) return filteredItems
183
-
184
- return [...filteredItems].sort(sortOption.compareFn)
185
- }, [filteredItems, activeSort, enableSorting, sortOptions])
186
-
187
- // Default categories if none provided
188
- const defaultCategories: GalleryCategory[] = [
189
- { id: "all", label: "All" },
190
- { id: "image", label: "Images", icon: <ImageIcon className="h-4 w-4" /> },
191
- { id: "video", label: "Videos", icon: <Video className="h-4 w-4" /> },
192
- ]
193
-
194
- const finalCategories = categories.length > 0 ? categories : defaultCategories
195
-
196
- // Lazy loading
197
- React.useEffect(() => {
198
- if (!lazyLoad) return
199
-
200
- observerRef.current = new IntersectionObserver(
201
- (entries) => {
202
- entries.forEach((entry) => {
203
- if (entry.isIntersecting) {
204
- const index = parseInt(entry.target.getAttribute("data-index") || "0")
205
- setLoadedImages(prev => new Set(prev).add(index))
206
- }
207
- })
208
- },
209
- { rootMargin: "50px" }
210
- )
211
-
212
- return () => {
213
- observerRef.current?.disconnect()
214
- }
215
- }, [lazyLoad])
216
-
217
- // Infinite scroll
218
- React.useEffect(() => {
219
- if (!infiniteScroll || !onLoadMore || !hasMore) return
220
-
221
- const observer = new IntersectionObserver(
222
- (entries) => {
223
- if (entries[0].isIntersecting) {
224
- onLoadMore()
225
- }
226
- },
227
- { rootMargin: "100px" }
228
- )
229
-
230
- if (loadMoreRef.current) {
231
- observer.observe(loadMoreRef.current)
232
- }
233
-
234
- return () => observer.disconnect()
235
- }, [infiniteScroll, onLoadMore, hasMore])
236
-
237
- const handleItemClick = (item: MediaItem, index: number) => {
238
- if (onItemClick) {
239
- onItemClick(item, index)
240
- }
241
- }
242
-
243
- const renderGalleryItem = (item: MediaItem, index: number) => {
244
- const isLoaded = !lazyLoad || loadedImages.has(index) || (item.thumbnail && item.thumbnail.endsWith('.svg'))
245
-
246
- const itemContent = (
247
- <motion.div
248
- key={index}
249
- className={cn(
250
- galleryItemVariants({
251
- variant,
252
- aspectRatio: layout === "masonry" || layout === "justified" ? "auto" : aspectRatio,
253
- hover
254
- }),
255
- layout === "masonry" && "break-inside-avoid mb-4 inline-block w-full",
256
- layout === "justified" && "flex-grow"
257
- )}
258
- style={layout === "justified" ? { flexBasis: "200px", maxWidth: "400px" } : undefined}
259
- initial={{ opacity: 0, scale: 0.9 }}
260
- animate={{ opacity: 1, scale: 1 }}
261
- transition={{ duration: 0.3, delay: index * 0.05 }}
262
- data-index={index}
263
- ref={(el) => {
264
- if (el && observerRef.current && !loadedImages.has(index)) {
265
- observerRef.current.observe(el)
266
- }
267
- }}
268
- onClick={() => handleItemClick(item, index)}
269
- >
270
- {item.type === "image" ? (
271
- <div className={cn(
272
- "relative w-full",
273
- layout === "masonry" || layout === "justified" ? "" : "h-full"
274
- )}>
275
- <img
276
- src={item.thumbnail || item.src}
277
- alt={item.alt || `Gallery item ${index + 1}`}
278
- className={cn(
279
- "w-full object-cover",
280
- layout === "masonry" ? "h-auto" : "h-full",
281
- isLoaded ? "opacity-100" : "opacity-0",
282
- "transition-opacity duration-300"
283
- )}
284
- loading={lazyLoad ? "lazy" : undefined}
285
- onLoad={() => setLoadedImages(prev => new Set(prev).add(index))}
286
- />
287
- {!isLoaded && (
288
- <div className={cn(
289
- "absolute inset-0 w-full bg-muted animate-pulse",
290
- layout === "masonry" ? "h-64" : "h-full",
291
- layout === "masonry" && "aspect-[3/4]"
292
- )} />
293
- )}
294
- </div>
295
- ) : (
296
- <div className={cn(
297
- "relative w-full bg-black",
298
- layout === "masonry" ? "" : "h-full"
299
- )}>
300
- {isLoaded && (item.thumbnail || item.poster) && (
301
- <img
302
- src={item.thumbnail || item.poster}
303
- alt={item.alt || `Video thumbnail ${index + 1}`}
304
- className={cn(
305
- "w-full object-cover",
306
- layout === "masonry" ? "h-auto" : "h-full"
307
- )}
308
- loading={lazyLoad ? "lazy" : undefined}
309
- />
310
- )}
311
- <div className="absolute inset-0 flex items-center justify-center">
312
- <div className="w-12 h-12 bg-black/70 rounded-full flex items-center justify-center">
313
- <Video className="h-6 w-6 text-white" />
314
- </div>
315
- </div>
316
- </div>
317
- )}
318
-
319
- {/* Overlay */}
320
- {showOverlay && (
321
- <div className="absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300">
322
- {overlayContent ? (
323
- overlayContent(item, index)
324
- ) : (
325
- <div className="absolute bottom-0 left-0 right-0 p-4 text-white">
326
- {item.title && (
327
- <h3 className="text-sm font-semibold mb-1">{item.title}</h3>
328
- )}
329
- {item.description && (
330
- <p className="text-xs opacity-90 line-clamp-2">{item.description}</p>
331
- )}
332
- </div>
333
- )}
334
-
335
- {showItemType && (
336
- <div className="absolute top-2 right-2">
337
- <div className="w-8 h-8 bg-white/20 backdrop-blur-sm rounded-full flex items-center justify-center">
338
- {item.type === "image" ? (
339
- <ImageIcon className="h-4 w-4 text-white" />
340
- ) : (
341
- <Video className="h-4 w-4 text-white" />
342
- )}
343
- </div>
344
- </div>
345
- )}
346
- </div>
347
- )}
348
- </motion.div>
349
- )
350
-
351
- // If lightbox is enabled and we're in the main gallery content, wrap with trigger
352
- if (enableLightbox) {
353
- return (
354
- <MoonUILightboxTriggerPro key={index} index={index}>
355
- {itemContent}
356
- </MoonUILightboxTriggerPro>
357
- )
358
- }
359
-
360
- return itemContent
361
- }
362
-
363
- const renderSkeleton = () => (
364
- <div className={cn(galleryItemVariants({ variant, aspectRatio }))}>
365
- <div className="w-full h-full bg-muted animate-pulse" />
366
- </div>
367
- )
368
-
369
- const galleryContent = (
370
- <>
371
- {/* Filters and Sorting */}
372
- {(enableFiltering || enableSorting) && (
373
- <div className="mb-6">
374
- <div className="flex items-center justify-between mb-4">
375
- <div className="flex items-center gap-4">
376
- {enableFiltering && (
377
- <button
378
- onClick={() => setShowFilters(!showFilters)}
379
- className={cn(
380
- "flex items-center gap-2 px-4 py-2 rounded-lg border transition-colors",
381
- showFilters
382
- ? "bg-primary text-primary-foreground border-primary"
383
- : "bg-background border-border hover:bg-accent"
384
- )}
385
- >
386
- <Filter className="h-4 w-4" />
387
- Filters
388
- </button>
389
- )}
390
- {enableSorting && sortOptions.length > 0 && (
391
- <select
392
- value={activeSort}
393
- onChange={(e) => setActiveSort(e.target.value)}
394
- className="px-4 py-2 rounded-lg border bg-background"
395
- >
396
- <option value="default">Default order</option>
397
- {sortOptions.map(option => (
398
- <option key={option.id} value={option.id}>
399
- {option.label}
400
- </option>
401
- ))}
402
- </select>
403
- )}
404
- </div>
405
- <div className="text-sm text-muted-foreground">
406
- {sortedItems.length} items
407
- </div>
408
- </div>
409
-
410
- {/* Category filters */}
411
- <AnimatePresence>
412
- {showFilters && enableFiltering && (
413
- <motion.div
414
- initial={{ height: 0, opacity: 0 }}
415
- animate={{ height: "auto", opacity: 1 }}
416
- exit={{ height: 0, opacity: 0 }}
417
- transition={{ duration: 0.2 }}
418
- className="overflow-hidden"
419
- >
420
- <div className="flex flex-wrap gap-2 pb-4">
421
- {finalCategories.map(category => (
422
- <button
423
- key={category.id}
424
- onClick={() => setActiveCategory(category.id)}
425
- className={cn(
426
- "flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-colors",
427
- activeCategory === category.id
428
- ? "bg-primary text-primary-foreground"
429
- : "bg-muted hover:bg-accent"
430
- )}
431
- >
432
- {category.icon}
433
- {category.label}
434
- </button>
435
- ))}
436
- </div>
437
- </motion.div>
438
- )}
439
- </AnimatePresence>
440
- </div>
441
- )}
442
-
443
- {/* Gallery */}
444
- <div
445
- ref={ref}
446
- className={cn(
447
- layout === "masonry"
448
- ? "columns-1 sm:columns-2 md:columns-3 lg:columns-4 gap-4"
449
- : galleryVariants({ layout, columns }),
450
- className
451
- )}
452
- style={layout === "masonry" ? { columnGap: "1rem" } : undefined}
453
- >
454
- {loadingState ? (
455
- <>
456
- {Array.from({ length: skeletonCount }).map((_, i) => (
457
- <React.Fragment key={i}>{renderSkeleton()}</React.Fragment>
458
- ))}
459
- </>
460
- ) : sortedItems.length > 0 ? (
461
- sortedItems.map((item, index) => renderGalleryItem(item, index))
462
- ) : (
463
- emptyState || (
464
- <div className="col-span-full flex flex-col items-center justify-center py-12 text-center">
465
- <ImageIcon className="h-12 w-12 text-muted-foreground mb-4" />
466
- <p className="text-muted-foreground">No media items found</p>
467
- </div>
468
- )
469
- )}
470
- </div>
471
-
472
- {/* Load more trigger */}
473
- {infiniteScroll && hasMore && (
474
- <div ref={loadMoreRef} className="flex justify-center py-8">
475
- <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
476
- </div>
477
- )}
478
- </>
479
- )
480
-
481
- if (enableLightbox) {
482
- return (
483
- <MoonUILightboxProviderPro items={sortedItems}>
484
- {galleryContent}
485
- <MoonUILightboxContentPro showThumbnails showNavigation backdrop="blur" {...lightboxProps} />
486
- </MoonUILightboxProviderPro>
487
- )
488
- }
489
-
490
- return galleryContent
491
- })
492
- MoonUIMediaGalleryPro.displayName = "MoonUIMediaGalleryPro"
493
-
494
- // Gallery item component for custom layouts
495
- interface MoonUIGalleryItemProProps
496
- extends React.HTMLAttributes<HTMLDivElement>,
497
- VariantProps<typeof galleryItemVariants> {
498
- item: MediaItem
499
- index?: number
500
- showType?: boolean
501
- showOverlay?: boolean
502
- overlayContent?: React.ReactNode
503
- onLoad?: () => void
504
- }
505
-
506
- const MoonUIGalleryItemPro = React.forwardRef<
507
- HTMLDivElement,
508
- MoonUIGalleryItemProProps
509
- >(({
510
- className,
511
- item,
512
- index = 0,
513
- variant,
514
- aspectRatio,
515
- hover,
516
- showType = true,
517
- showOverlay = true,
518
- overlayContent,
519
- onLoad,
520
- ...props
521
- }, ref) => {
522
- const [isLoaded, setIsLoaded] = React.useState(false)
523
-
524
- const handleLoad = () => {
525
- setIsLoaded(true)
526
- onLoad?.()
527
- }
528
-
529
- return (
530
- <div
531
- ref={ref}
532
- className={cn(galleryItemVariants({ variant, aspectRatio, hover }), className)}
533
- {...props}
534
- >
535
- {item.type === "image" ? (
536
- <img
537
- src={item.src}
538
- alt={item.alt || `Gallery item ${index + 1}`}
539
- className={cn(
540
- "w-full h-full object-cover transition-opacity duration-300",
541
- isLoaded ? "opacity-100" : "opacity-0"
542
- )}
543
- onLoad={handleLoad}
544
- />
545
- ) : (
546
- <div className="relative w-full h-full bg-black">
547
- {item.poster && (
548
- <img
549
- src={item.poster}
550
- alt={item.alt || `Video thumbnail ${index + 1}`}
551
- className="w-full h-full object-cover"
552
- onLoad={handleLoad}
553
- />
554
- )}
555
- <div className="absolute inset-0 flex items-center justify-center">
556
- <div className="w-12 h-12 bg-black/70 rounded-full flex items-center justify-center">
557
- <Video className="h-6 w-6 text-white" />
558
- </div>
559
- </div>
560
- </div>
561
- )}
562
-
563
- {!isLoaded && (
564
- <div className="absolute inset-0 bg-muted animate-pulse" />
565
- )}
566
-
567
- {showOverlay && isLoaded && (
568
- <div className="absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300">
569
- {overlayContent || (
570
- <div className="absolute bottom-0 left-0 right-0 p-4 text-white">
571
- {item.title && (
572
- <h3 className="text-sm font-semibold mb-1">{item.title}</h3>
573
- )}
574
- {item.description && (
575
- <p className="text-xs opacity-90 line-clamp-2">{item.description}</p>
576
- )}
577
- </div>
578
- )}
579
-
580
- {showType && (
581
- <div className="absolute top-2 right-2">
582
- <div className="w-8 h-8 bg-white/20 backdrop-blur-sm rounded-full flex items-center justify-center">
583
- {item.type === "image" ? (
584
- <ImageIcon className="h-4 w-4 text-white" />
585
- ) : (
586
- <Video className="h-4 w-4 text-white" />
587
- )}
588
- </div>
589
- </div>
590
- )}
591
- </div>
592
- )}
593
- </div>
594
- )
595
- })
596
- MoonUIGalleryItemPro.displayName = "MoonUIGalleryItemPro"
597
-
598
- export {
599
- MoonUIMediaGalleryPro,
600
- MoonUIGalleryItemPro,
601
- galleryVariants,
602
- galleryItemVariants,
603
- type GalleryCategory,
604
- type GallerySortOption,
605
- }
606
-
607
- // Clean exports
608
- export {
609
- MoonUIMediaGalleryPro as MediaGallery,
610
- MoonUIGalleryItemPro as GalleryItem,
611
- }