@moontra/moonui-pro 2.20.1 → 2.20.3

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 (162) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +11 -5
  4. package/plugin/index.d.ts +86 -0
  5. package/plugin/index.js +308 -0
  6. package/scripts/postbuild.js +27 -0
  7. package/scripts/postinstall.js +176 -23
  8. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  9. package/src/__tests__/use-local-storage.test.tsx +0 -174
  10. package/src/__tests__/use-pro-access.test.tsx +0 -183
  11. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  12. package/src/components/advanced-chart/index.tsx +0 -1242
  13. package/src/components/advanced-forms/index.tsx +0 -426
  14. package/src/components/animated-button/index.tsx +0 -385
  15. package/src/components/calendar/event-dialog.tsx +0 -372
  16. package/src/components/calendar/index.tsx +0 -1073
  17. package/src/components/calendar-pro/index.tsx +0 -1697
  18. package/src/components/color-picker/index.tsx +0 -432
  19. package/src/components/credit-card-input/index.tsx +0 -406
  20. package/src/components/dashboard/dashboard-grid.tsx +0 -462
  21. package/src/components/dashboard/demo.tsx +0 -425
  22. package/src/components/dashboard/index.tsx +0 -1046
  23. package/src/components/dashboard/time-range-picker.tsx +0 -336
  24. package/src/components/dashboard/types.ts +0 -222
  25. package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
  26. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  27. package/src/components/dashboard/widgets/metric-card.tsx +0 -343
  28. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  29. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  30. package/src/components/data-table/data-table-export.ts +0 -156
  31. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  32. package/src/components/data-table/data-table.test.tsx +0 -187
  33. package/src/components/data-table/index.tsx +0 -845
  34. package/src/components/draggable-list/index.tsx +0 -100
  35. package/src/components/enhanced/badge.tsx +0 -191
  36. package/src/components/enhanced/button.tsx +0 -362
  37. package/src/components/enhanced/card.tsx +0 -266
  38. package/src/components/enhanced/dialog.tsx +0 -246
  39. package/src/components/enhanced/index.ts +0 -4
  40. package/src/components/error-boundary/index.tsx +0 -109
  41. package/src/components/file-upload/file-upload.test.tsx +0 -243
  42. package/src/components/file-upload/index.tsx +0 -1660
  43. package/src/components/floating-action-button/index.tsx +0 -206
  44. package/src/components/form-wizard/form-wizard-context.tsx +0 -307
  45. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  46. package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
  47. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  48. package/src/components/form-wizard/index.tsx +0 -102
  49. package/src/components/form-wizard/types.ts +0 -76
  50. package/src/components/gesture-drawer/index.tsx +0 -551
  51. package/src/components/github-stars/github-api.ts +0 -426
  52. package/src/components/github-stars/hooks.ts +0 -516
  53. package/src/components/github-stars/index.tsx +0 -375
  54. package/src/components/github-stars/types.ts +0 -148
  55. package/src/components/github-stars/variants.tsx +0 -513
  56. package/src/components/health-check/index.tsx +0 -439
  57. package/src/components/hover-card-3d/index.tsx +0 -530
  58. package/src/components/index.ts +0 -128
  59. package/src/components/internal/index.ts +0 -78
  60. package/src/components/kanban/add-card-modal.tsx +0 -502
  61. package/src/components/kanban/card-detail-modal.tsx +0 -761
  62. package/src/components/kanban/index.ts +0 -13
  63. package/src/components/kanban/kanban.tsx +0 -1684
  64. package/src/components/kanban/types.ts +0 -168
  65. package/src/components/lazy-component/index.tsx +0 -823
  66. package/src/components/license-error/index.tsx +0 -29
  67. package/src/components/magnetic-button/index.tsx +0 -167
  68. package/src/components/memory-efficient-data/index.tsx +0 -1016
  69. package/src/components/moonui-quiz-form/index.tsx +0 -817
  70. package/src/components/optimized-image/index.tsx +0 -425
  71. package/src/components/performance-debugger/index.tsx +0 -589
  72. package/src/components/performance-monitor/index.tsx +0 -794
  73. package/src/components/phone-number-input/index.tsx +0 -338
  74. package/src/components/pinch-zoom/index.tsx +0 -566
  75. package/src/components/quiz-form/index.tsx +0 -479
  76. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  77. package/src/components/rich-text-editor/index.tsx +0 -2324
  78. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
  79. package/src/components/rich-text-editor/slash-commands.css +0 -35
  80. package/src/components/rich-text-editor/table-styles.css +0 -65
  81. package/src/components/sidebar/index.tsx +0 -865
  82. package/src/components/spotlight-card/index.tsx +0 -191
  83. package/src/components/swipeable-card/index.tsx +0 -100
  84. package/src/components/timeline/index.tsx +0 -1148
  85. package/src/components/ui/accordion.tsx +0 -73
  86. package/src/components/ui/alert-dialog.tsx +0 -141
  87. package/src/components/ui/alert.tsx +0 -141
  88. package/src/components/ui/aspect-ratio.tsx +0 -245
  89. package/src/components/ui/avatar.tsx +0 -153
  90. package/src/components/ui/badge.tsx +0 -228
  91. package/src/components/ui/breadcrumb.tsx +0 -214
  92. package/src/components/ui/button.tsx +0 -222
  93. package/src/components/ui/calendar.tsx +0 -387
  94. package/src/components/ui/card.tsx +0 -214
  95. package/src/components/ui/checkbox.tsx +0 -259
  96. package/src/components/ui/collapsible.tsx +0 -135
  97. package/src/components/ui/color-picker.tsx +0 -97
  98. package/src/components/ui/command.tsx +0 -225
  99. package/src/components/ui/dialog.tsx +0 -334
  100. package/src/components/ui/dropdown-menu.tsx +0 -218
  101. package/src/components/ui/gesture-drawer.tsx +0 -11
  102. package/src/components/ui/hover-card.tsx +0 -29
  103. package/src/components/ui/index.ts +0 -190
  104. package/src/components/ui/input.tsx +0 -222
  105. package/src/components/ui/label.tsx +0 -29
  106. package/src/components/ui/lightbox.tsx +0 -606
  107. package/src/components/ui/magnetic-button.tsx +0 -129
  108. package/src/components/ui/media-gallery.tsx +0 -612
  109. package/src/components/ui/pagination.tsx +0 -123
  110. package/src/components/ui/popover.tsx +0 -185
  111. package/src/components/ui/progress.tsx +0 -30
  112. package/src/components/ui/radio-group.tsx +0 -257
  113. package/src/components/ui/scroll-area.tsx +0 -47
  114. package/src/components/ui/select.tsx +0 -374
  115. package/src/components/ui/separator.tsx +0 -145
  116. package/src/components/ui/sheet.tsx +0 -139
  117. package/src/components/ui/skeleton.tsx +0 -20
  118. package/src/components/ui/slider.tsx +0 -354
  119. package/src/components/ui/spotlight-card.tsx +0 -119
  120. package/src/components/ui/switch.tsx +0 -86
  121. package/src/components/ui/table.tsx +0 -329
  122. package/src/components/ui/tabs.tsx +0 -198
  123. package/src/components/ui/textarea.tsx +0 -28
  124. package/src/components/ui/toast.tsx +0 -317
  125. package/src/components/ui/toggle.tsx +0 -119
  126. package/src/components/ui/tooltip.tsx +0 -151
  127. package/src/components/virtual-list/index.tsx +0 -668
  128. package/src/hooks/use-chart.ts +0 -205
  129. package/src/hooks/use-data-table.ts +0 -182
  130. package/src/hooks/use-docs-pro-access.ts +0 -13
  131. package/src/hooks/use-license-check.ts +0 -65
  132. package/src/hooks/use-subscription.ts +0 -19
  133. package/src/hooks/use-toast.ts +0 -15
  134. package/src/index.ts +0 -14
  135. package/src/lib/ai-providers.ts +0 -377
  136. package/src/lib/component-metadata.ts +0 -18
  137. package/src/lib/micro-interactions.ts +0 -255
  138. package/src/lib/paddle.ts +0 -17
  139. package/src/lib/utils.ts +0 -6
  140. package/src/patterns/login-form/index.tsx +0 -276
  141. package/src/patterns/login-form/types.ts +0 -67
  142. package/src/setupTests.ts +0 -41
  143. package/src/styles/advanced-chart.css +0 -239
  144. package/src/styles/calendar.css +0 -35
  145. package/src/styles/design-system.css +0 -363
  146. package/src/styles/index.css +0 -85
  147. package/src/styles/tailwind.css +0 -7
  148. package/src/styles/tokens.css +0 -455
  149. package/src/types/moonui.d.ts +0 -22
  150. package/src/types/next-auth.d.ts +0 -21
  151. package/src/use-intersection-observer.tsx +0 -154
  152. package/src/use-local-storage.tsx +0 -71
  153. package/src/use-paddle.ts +0 -138
  154. package/src/use-performance-optimizer.ts +0 -389
  155. package/src/use-pro-access.ts +0 -141
  156. package/src/use-scroll-animation.ts +0 -219
  157. package/src/use-subscription.ts +0 -37
  158. package/src/use-toast.ts +0 -32
  159. package/src/utils/chart-helpers.ts +0 -357
  160. package/src/utils/cn.ts +0 -6
  161. package/src/utils/data-processing.ts +0 -151
  162. package/src/utils/license-validator.tsx +0 -183
@@ -1,551 +0,0 @@
1
- "use client"
2
-
3
- import React, { useEffect, useRef, useState, useCallback, useMemo } from "react"
4
- import { motion, useMotionValue, useTransform, animate, PanInfo, useAnimation, AnimationControls, useSpring } from "framer-motion"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
- import { cn } from "../../lib/utils"
7
- import { X, Lock, Sparkles } from "lucide-react"
8
- import { useSubscription } from "../../hooks/use-subscription"
9
- import { Card, CardContent } from "../ui/card"
10
- import { Button } from "../ui/button"
11
-
12
- // Gesture Drawer Variants
13
- const gestureDrawerVariants = cva(
14
- "fixed bg-background shadow-2xl overflow-hidden",
15
- {
16
- variants: {
17
- position: {
18
- bottom: "bottom-0 left-0 right-0 rounded-t-[20px] max-h-[95vh]",
19
- top: "top-0 left-0 right-0 rounded-b-[20px] max-h-[95vh]",
20
- left: "left-0 top-0 bottom-0 rounded-r-[20px] max-w-[90vw]",
21
- right: "right-0 top-0 bottom-0 rounded-l-[20px] max-w-[90vw]"
22
- },
23
- size: {
24
- default: "",
25
- sm: "",
26
- md: "",
27
- lg: "",
28
- full: ""
29
- }
30
- },
31
- compoundVariants: [
32
- {
33
- position: ["bottom", "top"],
34
- size: "sm",
35
- class: "h-[30vh]"
36
- },
37
- {
38
- position: ["bottom", "top"],
39
- size: "md",
40
- class: "h-[50vh]"
41
- },
42
- {
43
- position: ["bottom", "top"],
44
- size: "lg",
45
- class: "h-[70vh]"
46
- },
47
- {
48
- position: ["bottom", "top"],
49
- size: "full",
50
- class: "h-[95vh]"
51
- },
52
- {
53
- position: ["left", "right"],
54
- size: "sm",
55
- class: "w-[280px]"
56
- },
57
- {
58
- position: ["left", "right"],
59
- size: "md",
60
- class: "w-[380px]"
61
- },
62
- {
63
- position: ["left", "right"],
64
- size: "lg",
65
- class: "w-[480px]"
66
- },
67
- {
68
- position: ["left", "right"],
69
- size: "full",
70
- class: "w-[90vw]"
71
- }
72
- ],
73
- defaultVariants: {
74
- position: "bottom",
75
- size: "default"
76
- }
77
- }
78
- )
79
-
80
- // Handle/Indicator Variants
81
- const handleVariants = cva(
82
- "absolute bg-muted-foreground/20 transition-all duration-200",
83
- {
84
- variants: {
85
- position: {
86
- bottom: "top-2 left-1/2 -translate-x-1/2 w-12 h-1 rounded-full",
87
- top: "bottom-2 left-1/2 -translate-x-1/2 w-12 h-1 rounded-full",
88
- left: "right-2 top-1/2 -translate-y-1/2 w-1 h-12 rounded-full",
89
- right: "left-2 top-1/2 -translate-y-1/2 w-1 h-12 rounded-full"
90
- }
91
- },
92
- defaultVariants: {
93
- position: "bottom"
94
- }
95
- }
96
- )
97
-
98
- export interface GestureDrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onAnimationStart' | 'onAnimationEnd' | 'onAnimationIteration' | 'onDragStart' | 'onDragEnd' | 'onDrag'>,
99
- VariantProps<typeof gestureDrawerVariants> {
100
- // Core props
101
- isOpen: boolean
102
- onOpenChange: (open: boolean) => void
103
- children: React.ReactNode
104
-
105
- // Position and size
106
- position?: "bottom" | "top" | "left" | "right"
107
- size?: "default" | "sm" | "md" | "lg" | "full"
108
-
109
- // Snap points (percentages of viewport)
110
- snapPoints?: number[]
111
- defaultSnapPoint?: number
112
-
113
- // Gesture options
114
- enableSwipeToClose?: boolean
115
- closeThreshold?: number
116
- closeVelocity?: number
117
- dragElastic?: number
118
-
119
- // Visual options
120
- showHandle?: boolean
121
- handleClassName?: string
122
- showCloseButton?: boolean
123
- closeButtonClassName?: string
124
-
125
- // Backdrop options
126
- showBackdrop?: boolean
127
- backdropClassName?: string
128
- backdropBlur?: boolean
129
- closeOnBackdropClick?: boolean
130
-
131
- // Animation options
132
- animationDuration?: number
133
- springConfig?: {
134
- stiffness?: number
135
- damping?: number
136
- mass?: number
137
- }
138
-
139
- // Advanced features
140
- preventBodyScroll?: boolean
141
- autoHeight?: boolean
142
- nestedScrolling?: boolean
143
- onSnapPointChange?: (snapPoint: number) => void
144
-
145
- // Component specific
146
- asChild?: boolean
147
- isProComponent?: boolean
148
- }
149
-
150
- // Body scroll lock hook
151
- const useBodyScrollLock = (isLocked: boolean) => {
152
- useEffect(() => {
153
- if (!isLocked) return
154
-
155
- const originalStyle = window.getComputedStyle(document.body).overflow
156
- document.body.style.overflow = "hidden"
157
-
158
- return () => {
159
- document.body.style.overflow = originalStyle
160
- }
161
- }, [isLocked])
162
- }
163
-
164
- // Snap point calculation
165
- const calculateSnapPoint = (
166
- offset: number,
167
- velocity: number,
168
- snapPoints: number[],
169
- direction: "up" | "down" | "left" | "right",
170
- viewportSize: number
171
- ): number => {
172
- const currentPosition = Math.abs(offset) / viewportSize * 100
173
-
174
- // Velocity-based snap
175
- if (Math.abs(velocity) > 500) {
176
- if ((direction === "up" || direction === "left") && velocity < 0) {
177
- // Swiping to open more
178
- const higherPoints = snapPoints.filter(p => p > currentPosition)
179
- return higherPoints.length > 0 ? higherPoints[0] : snapPoints[snapPoints.length - 1]
180
- } else if ((direction === "down" || direction === "right") && velocity > 0) {
181
- // Swiping to close
182
- const lowerPoints = snapPoints.filter(p => p < currentPosition)
183
- return lowerPoints.length > 0 ? lowerPoints[lowerPoints.length - 1] : 0
184
- }
185
- }
186
-
187
- // Find closest snap point
188
- return snapPoints.reduce((prev, curr) =>
189
- Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition) ? curr : prev
190
- )
191
- }
192
-
193
- const MoonUIGestureDrawerProComponent = React.forwardRef<HTMLDivElement, GestureDrawerProps>(({
194
- isOpen,
195
- onOpenChange,
196
- children,
197
- position = "bottom",
198
- size = "default",
199
- snapPoints = size === "default" ? [25, 50, 75, 100] : [],
200
- defaultSnapPoint,
201
- enableSwipeToClose = true,
202
- closeThreshold = 20,
203
- closeVelocity = 500,
204
- dragElastic = 0.2,
205
- showHandle = true,
206
- handleClassName,
207
- showCloseButton = false,
208
- closeButtonClassName,
209
- showBackdrop = true,
210
- backdropClassName,
211
- backdropBlur = true,
212
- closeOnBackdropClick = true,
213
- animationDuration = 0.5,
214
- springConfig = {
215
- stiffness: 300,
216
- damping: 30,
217
- mass: 1
218
- },
219
- preventBodyScroll = true,
220
- autoHeight = false,
221
- nestedScrolling = true,
222
- onSnapPointChange,
223
- className,
224
- asChild = false,
225
- isProComponent = true,
226
- ...props
227
- }, ref) => {
228
- const isVertical = position === "bottom" || position === "top"
229
- const controls = useAnimation()
230
- const dragControls = useAnimation()
231
-
232
- // Motion values
233
- const x = useMotionValue(0)
234
- const y = useMotionValue(0)
235
- const motionValue = isVertical ? y : x
236
-
237
- // State
238
- const [currentSnapPoint, setCurrentSnapPoint] = useState(
239
- defaultSnapPoint || (snapPoints.length > 0 ? snapPoints[0] : 50)
240
- )
241
- const [isDragging, setIsDragging] = useState(false)
242
- const contentRef = useRef<HTMLDivElement>(null)
243
- const [contentHeight, setContentHeight] = useState<number | null>(null)
244
-
245
- // Body scroll lock
246
- useBodyScrollLock(isOpen && preventBodyScroll)
247
-
248
- // Viewport dimensions
249
- const viewportSize = useMemo(() => {
250
- if (typeof window === "undefined") return 1000
251
- return isVertical ? window.innerHeight : window.innerWidth
252
- }, [isVertical])
253
-
254
- // Calculate position based on snap point
255
- const calculatePosition = useCallback((snapPoint: number) => {
256
- // For snap points, we don't need to calculate positions
257
- // CVA classes handle the static positioning
258
- // Motion values should only handle transforms during drag
259
- return 0
260
- }, [position, viewportSize])
261
-
262
-
263
- // Backdrop opacity - fixed when drawer is open
264
- const backdropOpacity = isOpen ? 0.5 : 0
265
-
266
- // Handle drag end
267
- const handleDragEnd = useCallback((event: any, info: PanInfo) => {
268
- setIsDragging(false)
269
-
270
- const offset = isVertical ? info.offset.y : info.offset.x
271
- const velocity = isVertical ? info.velocity.y : info.velocity.x
272
-
273
- // Check if should close
274
- const shouldClose = enableSwipeToClose && (
275
- (position === "bottom" && offset > closeThreshold && velocity > -closeVelocity) ||
276
- (position === "top" && offset < -closeThreshold && velocity < closeVelocity) ||
277
- (position === "right" && offset > closeThreshold && velocity > -closeVelocity) ||
278
- (position === "left" && offset < -closeThreshold && velocity < closeVelocity)
279
- )
280
-
281
- if (shouldClose) {
282
- onOpenChange(false)
283
- return
284
- }
285
-
286
- // Snap to point
287
- if (snapPoints.length > 0) {
288
- // Map position to direction for calculateSnapPoint
289
- const direction = position === "bottom" ? "down" :
290
- position === "top" ? "up" :
291
- position === "left" ? "left" : "right"
292
-
293
- const newSnapPoint = calculateSnapPoint(
294
- Math.abs(motionValue.get()),
295
- velocity,
296
- snapPoints,
297
- direction,
298
- viewportSize
299
- )
300
-
301
- setCurrentSnapPoint(newSnapPoint)
302
- onSnapPointChange?.(newSnapPoint)
303
-
304
- animate(motionValue, calculatePosition(newSnapPoint), {
305
- type: "spring",
306
- ...springConfig
307
- })
308
- } else {
309
- // Return to original position
310
- animate(motionValue, calculatePosition(currentSnapPoint), {
311
- type: "spring",
312
- ...springConfig
313
- })
314
- }
315
- }, [
316
- isVertical,
317
- position,
318
- enableSwipeToClose,
319
- closeThreshold,
320
- closeVelocity,
321
- snapPoints,
322
- motionValue,
323
- viewportSize,
324
- calculatePosition,
325
- currentSnapPoint,
326
- springConfig,
327
- onOpenChange,
328
- onSnapPointChange
329
- ])
330
-
331
- // Handle drag start
332
- const handleDragStart = useCallback((event: any, info: PanInfo) => {
333
- setIsDragging(true)
334
- }, [])
335
-
336
- // Auto height calculation
337
- useEffect(() => {
338
- if (!autoHeight || !contentRef.current || !isOpen) return
339
-
340
- const resizeObserver = new ResizeObserver((entries) => {
341
- for (const entry of entries) {
342
- setContentHeight(entry.contentRect.height)
343
- }
344
- })
345
-
346
- resizeObserver.observe(contentRef.current)
347
-
348
- return () => {
349
- resizeObserver.disconnect()
350
- }
351
- }, [autoHeight, isOpen])
352
-
353
- // Animation on open/close - reset transform values
354
- useEffect(() => {
355
- if (isOpen) {
356
- // Reset to zero - CVA handles positioning
357
- animate(motionValue, 0, {
358
- type: "spring",
359
- ...springConfig
360
- })
361
- } else {
362
- // Reset transform
363
- animate(motionValue, 0, {
364
- type: "spring",
365
- ...springConfig
366
- })
367
- }
368
- }, [isOpen, motionValue, springConfig])
369
-
370
- // Keyboard accessibility
371
- useEffect(() => {
372
- if (!isOpen) return
373
-
374
- const handleKeyDown = (e: KeyboardEvent) => {
375
- if (e.key === "Escape" && enableSwipeToClose) {
376
- onOpenChange(false)
377
- }
378
- }
379
-
380
- document.addEventListener("keydown", handleKeyDown)
381
- return () => document.removeEventListener("keydown", handleKeyDown)
382
- }, [isOpen, enableSwipeToClose, onOpenChange])
383
-
384
- // Initial position - CVA handles static positioning
385
- const getInitialPosition = () => {
386
- return { x: 0, y: 0 }
387
- }
388
-
389
- // Drag constraints - allow reasonable drag movement
390
- const getDragConstraints = () => {
391
- switch (position) {
392
- case "bottom":
393
- return { top: -200, bottom: 100 }
394
- case "top":
395
- return { top: -100, bottom: 200 }
396
- case "right":
397
- return { left: -200, right: 100 }
398
- case "left":
399
- return { left: -100, right: 200 }
400
- default:
401
- return {}
402
- }
403
- }
404
-
405
- if (!isOpen) return null
406
-
407
- const drawerContent = (
408
- <motion.div
409
- initial={{ opacity: 0 }}
410
- animate={{ opacity: 1 }}
411
- exit={{ opacity: 0 }}
412
- transition={{ duration: animationDuration }}
413
- className="fixed inset-0 z-50"
414
- style={{ pointerEvents: isDragging ? "none" : "auto" }}
415
- >
416
- {/* Backdrop */}
417
- {showBackdrop && (
418
- <motion.div
419
- className={cn(
420
- "absolute inset-0 bg-black/50",
421
- backdropBlur && "backdrop-blur-sm",
422
- backdropClassName
423
- )}
424
- style={{ opacity: backdropOpacity }}
425
- onClick={closeOnBackdropClick ? () => onOpenChange(false) : undefined}
426
- />
427
- )}
428
-
429
- {/* Drawer */}
430
- <motion.div
431
- ref={ref}
432
- drag={enableSwipeToClose ? (isVertical ? "y" : "x") : false}
433
- dragConstraints={getDragConstraints()}
434
- dragElastic={dragElastic}
435
- onDragStart={handleDragStart}
436
- onDragEnd={handleDragEnd}
437
- initial={getInitialPosition()}
438
- style={{
439
- ...(isDragging ? { [isVertical ? "y" : "x"]: motionValue } : {}),
440
- ...(autoHeight && contentHeight && isVertical
441
- ? { height: `${Math.min(contentHeight + 60, viewportSize * 0.95)}px` }
442
- : {})
443
- }}
444
- className={cn(
445
- gestureDrawerVariants({ position, size }),
446
- "will-change-transform",
447
- className
448
- )}
449
- {...props}
450
- >
451
- {/* Handle */}
452
- {showHandle && (
453
- <div
454
- className={cn(
455
- handleVariants({ position }),
456
- "cursor-grab active:cursor-grabbing",
457
- isDragging && "bg-muted-foreground/40 scale-x-150",
458
- handleClassName
459
- )}
460
- />
461
- )}
462
-
463
- {/* Close button */}
464
- {showCloseButton && (
465
- <button
466
- onClick={() => onOpenChange(false)}
467
- className={cn(
468
- "absolute z-50 p-2 rounded-full bg-background/80 backdrop-blur-sm border shadow-sm",
469
- "hover:bg-background transition-colors",
470
- position === "bottom" && "top-3 right-3",
471
- position === "top" && "bottom-3 right-3",
472
- position === "left" && "top-3 right-3",
473
- position === "right" && "top-3 left-3",
474
- closeButtonClassName
475
- )}
476
- aria-label="Close drawer"
477
- >
478
- <X className="h-4 w-4" />
479
- </button>
480
- )}
481
-
482
- {/* Content wrapper for nested scrolling */}
483
- <div
484
- ref={contentRef}
485
- className={cn(
486
- "h-full overflow-auto overscroll-contain",
487
- nestedScrolling && "touch-pan-y",
488
- showHandle && position === "bottom" && "pt-2",
489
- showHandle && position === "top" && "pb-2"
490
- )}
491
- style={{
492
- // Prevent drag when scrolling content
493
- touchAction: nestedScrolling ? "pan-y" : "none"
494
- }}
495
- >
496
- {children}
497
- </div>
498
- </motion.div>
499
- </motion.div>
500
- )
501
-
502
- return drawerContent
503
- })
504
-
505
- MoonUIGestureDrawerProComponent.displayName = "MoonUIGestureDrawerProComponent"
506
-
507
- export const MoonUIGestureDrawerPro = React.forwardRef<
508
- HTMLDivElement,
509
- GestureDrawerProps
510
- >((props, ref) => {
511
- const { hasProAccess, isLoading } = useSubscription()
512
-
513
- // Show upgrade prompt if no pro access
514
- if (!isLoading && !hasProAccess) {
515
- return (
516
- <Card className="w-fit mx-auto">
517
- <CardContent className="py-6 text-center">
518
- <div className="space-y-4">
519
- <div className="rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto">
520
- <Lock className="h-6 w-6 text-purple-600 dark:text-purple-400" />
521
- </div>
522
- <div>
523
- <h3 className="font-semibold text-sm mb-2">Pro Feature</h3>
524
- <p className="text-muted-foreground text-xs mb-4">
525
- Gesture Drawer is available exclusively to MoonUI Pro subscribers.
526
- </p>
527
- <a href="/pricing">
528
- <Button size="sm">
529
- <Sparkles className="mr-2 h-4 w-4" />
530
- Upgrade to Pro
531
- </Button>
532
- </a>
533
- </div>
534
- </div>
535
- </CardContent>
536
- </Card>
537
- )
538
- }
539
-
540
- return <MoonUIGestureDrawerProComponent {...props} ref={ref} />
541
- })
542
-
543
- MoonUIGestureDrawerPro.displayName = "MoonUIGestureDrawerPro"
544
-
545
- // Backward compatibility alias
546
- export const GestureDrawer = MoonUIGestureDrawerPro
547
-
548
- // Export types
549
- export type MoonUIGestureDrawerProProps = GestureDrawerProps
550
- export { gestureDrawerVariants as moonUIGestureDrawerProVariants }
551
- export default MoonUIGestureDrawerPro