@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,266 +0,0 @@
1
- "use client"
2
-
3
- import React, { useRef, useState } from "react"
4
- import { motion, useMotionValue, useSpring, useTransform } from "framer-motion"
5
- import { cn } from "../../lib/utils"
6
-
7
- export interface CardProProps extends React.HTMLAttributes<HTMLDivElement> {
8
- enableGlassmorphism?: boolean
9
- enableParallax?: boolean
10
- enableTilt?: boolean
11
- enableGlow?: boolean
12
- enableReveal?: boolean
13
- tiltMaxAngle?: number
14
- glowColor?: string
15
- parallaxOffset?: number
16
- }
17
-
18
- export const CardPro = React.forwardRef<HTMLDivElement, CardProProps>(
19
- ({
20
- className,
21
- children,
22
- enableGlassmorphism = true,
23
- enableParallax = false,
24
- enableTilt = true,
25
- enableGlow = false,
26
- enableReveal = false,
27
- tiltMaxAngle = 15,
28
- glowColor = "rgba(59, 130, 246, 0.5)",
29
- parallaxOffset = 20,
30
- ...props
31
- }, ref) => {
32
- const cardRef = useRef<HTMLDivElement>(null)
33
- const [isHovered, setIsHovered] = useState(false)
34
-
35
- // Motion values for tilt effect
36
- const mouseX = useMotionValue(0)
37
- const mouseY = useMotionValue(0)
38
-
39
- // Spring physics for smooth animations
40
- const springConfig = { damping: 20, stiffness: 300 }
41
- const mouseXSpring = useSpring(mouseX, springConfig)
42
- const mouseYSpring = useSpring(mouseY, springConfig)
43
-
44
- // Transform values for 3D tilt
45
- const rotateX = useTransform(mouseYSpring, [-1, 1], [tiltMaxAngle, -tiltMaxAngle])
46
- const rotateY = useTransform(mouseXSpring, [-1, 1], [-tiltMaxAngle, tiltMaxAngle])
47
-
48
- // Glow effect position
49
- const glowX = useTransform(mouseXSpring, [-1, 1], [0, 100])
50
- const glowY = useTransform(mouseYSpring, [-1, 1], [0, 100])
51
-
52
- const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
53
- if (!cardRef.current || (!enableTilt && !enableGlow)) return
54
-
55
- const rect = cardRef.current.getBoundingClientRect()
56
- const centerX = rect.left + rect.width / 2
57
- const centerY = rect.top + rect.height / 2
58
-
59
- const x = (e.clientX - centerX) / (rect.width / 2)
60
- const y = (e.clientY - centerY) / (rect.height / 2)
61
-
62
- mouseX.set(x)
63
- mouseY.set(y)
64
- }
65
-
66
- const handleMouseEnter = () => {
67
- setIsHovered(true)
68
- }
69
-
70
- const handleMouseLeave = () => {
71
- setIsHovered(false)
72
- mouseX.set(0)
73
- mouseY.set(0)
74
- }
75
-
76
- return (
77
- <motion.div
78
- ref={cardRef || ref}
79
- className={cn(
80
- "relative rounded-xl transition-all duration-300",
81
- enableGlassmorphism && [
82
- "backdrop-blur-md",
83
- "bg-white/10 dark:bg-gray-900/10",
84
- "border border-white/20 dark:border-gray-700/20",
85
- "shadow-xl"
86
- ],
87
- !enableGlassmorphism && [
88
- "bg-card",
89
- "border border-border",
90
- "shadow-sm"
91
- ],
92
- isHovered && "shadow-2xl",
93
- className
94
- )}
95
- onMouseMove={handleMouseMove}
96
- onMouseEnter={handleMouseEnter}
97
- onMouseLeave={handleMouseLeave}
98
- style={{
99
- transformStyle: "preserve-3d",
100
- perspective: "1000px"
101
- }}
102
- animate={{
103
- rotateX: enableTilt ? rotateX.get() : 0,
104
- rotateY: enableTilt ? rotateY.get() : 0,
105
- }}
106
- transition={{ type: "spring", ...springConfig }}
107
- >
108
- {/* Glow effect overlay */}
109
- {enableGlow && (
110
- <motion.div
111
- className="absolute inset-0 rounded-xl pointer-events-none opacity-0"
112
- style={{
113
- background: `radial-gradient(600px circle at ${glowX}% ${glowY}%, ${glowColor}, transparent 40%)`,
114
- }}
115
- animate={{
116
- opacity: isHovered ? 1 : 0
117
- }}
118
- transition={{ duration: 0.3 }}
119
- />
120
- )}
121
-
122
- {/* Glassmorphism noise texture */}
123
- {enableGlassmorphism && (
124
- <div
125
- className="absolute inset-0 rounded-xl opacity-[0.03] pointer-events-none"
126
- style={{
127
- backgroundImage: `url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' /%3E%3C/svg%3E")`,
128
- }}
129
- />
130
- )}
131
-
132
- {/* Content with parallax effect */}
133
- <motion.div
134
- className="relative z-10"
135
- style={{
136
- transform: enableParallax ? "translateZ(50px)" : undefined,
137
- }}
138
- animate={{
139
- x: enableParallax && isHovered ? mouseXSpring.get() * parallaxOffset : 0,
140
- y: enableParallax && isHovered ? mouseYSpring.get() * parallaxOffset : 0,
141
- }}
142
- >
143
- {children}
144
- </motion.div>
145
-
146
- {/* Reveal effect border */}
147
- {enableReveal && (
148
- <motion.div
149
- className="absolute inset-0 rounded-xl pointer-events-none"
150
- style={{
151
- background: `conic-gradient(from ${glowX}deg, transparent, ${glowColor}, transparent 30%)`,
152
- opacity: 0,
153
- filter: "blur(5px)",
154
- }}
155
- animate={{
156
- opacity: isHovered ? 0.5 : 0,
157
- rotate: isHovered ? 360 : 0,
158
- }}
159
- transition={{
160
- opacity: { duration: 0.3 },
161
- rotate: { duration: 20, repeat: Infinity, ease: "linear" }
162
- }}
163
- />
164
- )}
165
-
166
- {/* Soft shadow layers for depth */}
167
- <div className="absolute inset-0 rounded-xl -z-10">
168
- <motion.div
169
- className="absolute inset-0 rounded-xl bg-black/5 dark:bg-white/5"
170
- animate={{
171
- scale: isHovered ? 1.02 : 1,
172
- opacity: isHovered ? 0.5 : 0,
173
- }}
174
- transition={{ duration: 0.3 }}
175
- style={{ filter: "blur(10px)" }}
176
- />
177
- <motion.div
178
- className="absolute inset-0 rounded-xl bg-black/5 dark:bg-white/5"
179
- animate={{
180
- scale: isHovered ? 1.05 : 1,
181
- opacity: isHovered ? 0.3 : 0,
182
- }}
183
- transition={{ duration: 0.3 }}
184
- style={{ filter: "blur(20px)" }}
185
- />
186
- </div>
187
- </motion.div>
188
- )
189
- }
190
- )
191
-
192
- CardPro.displayName = "CardPro"
193
-
194
- // Enhanced Card sub-components with animations
195
- export const CardProHeader = React.forwardRef<
196
- HTMLDivElement,
197
- React.HTMLAttributes<HTMLDivElement>
198
- >(({ className, ...props }, ref) => (
199
- <motion.div
200
- ref={ref}
201
- className={cn("flex flex-col space-y-1.5 p-6", className)}
202
- initial={{ opacity: 0, y: -10 }}
203
- animate={{ opacity: 1, y: 0 }}
204
- transition={{ duration: 0.3, delay: 0.1 }}
205
- />
206
- ))
207
- CardProHeader.displayName = "CardProHeader"
208
-
209
- export const EnhancedCardTitle = React.forwardRef<
210
- HTMLParagraphElement,
211
- React.HTMLAttributes<HTMLHeadingElement>
212
- >(({ className, ...props }, ref) => (
213
- <motion.h3
214
- ref={ref}
215
- className={cn(
216
- "text-2xl font-semibold leading-none tracking-tight",
217
- className
218
- )}
219
- initial={{ opacity: 0, x: -10 }}
220
- animate={{ opacity: 1, x: 0 }}
221
- transition={{ duration: 0.3, delay: 0.2 }}
222
- />
223
- ))
224
- EnhancedCardTitle.displayName = "EnhancedCardTitle"
225
-
226
- export const EnhancedCardDescription = React.forwardRef<
227
- HTMLParagraphElement,
228
- React.HTMLAttributes<HTMLParagraphElement>
229
- >(({ className, ...props }, ref) => (
230
- <motion.p
231
- ref={ref}
232
- className={cn("text-sm text-muted-foreground", className)}
233
- initial={{ opacity: 0 }}
234
- animate={{ opacity: 1 }}
235
- transition={{ duration: 0.3, delay: 0.3 }}
236
- />
237
- ))
238
- EnhancedCardDescription.displayName = "EnhancedCardDescription"
239
-
240
- export const CardProContent = React.forwardRef<
241
- HTMLDivElement,
242
- React.HTMLAttributes<HTMLDivElement>
243
- >(({ className, ...props }, ref) => (
244
- <motion.div
245
- ref={ref}
246
- className={cn("p-6 pt-0", className)}
247
- initial={{ opacity: 0 }}
248
- animate={{ opacity: 1 }}
249
- transition={{ duration: 0.3, delay: 0.4 }}
250
- />
251
- ))
252
- CardProContent.displayName = "CardProContent"
253
-
254
- export const CardProFooter = React.forwardRef<
255
- HTMLDivElement,
256
- React.HTMLAttributes<HTMLDivElement>
257
- >(({ className, ...props }, ref) => (
258
- <motion.div
259
- ref={ref}
260
- className={cn("flex items-center p-6 pt-0", className)}
261
- initial={{ opacity: 0, y: 10 }}
262
- animate={{ opacity: 1, y: 0 }}
263
- transition={{ duration: 0.3, delay: 0.5 }}
264
- />
265
- ))
266
- CardProFooter.displayName = "CardProFooter"
@@ -1,246 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as DialogPrimitive from "@radix-ui/react-dialog"
5
- import { motion, AnimatePresence } from "framer-motion"
6
- import { X } from "lucide-react"
7
- import { cn } from "../../lib/utils"
8
-
9
- const Dialog = DialogPrimitive.Root
10
- const DialogTrigger = DialogPrimitive.Trigger
11
- const DialogPortal = DialogPrimitive.Portal
12
- const DialogClose = DialogPrimitive.Close
13
-
14
- interface DialogProOverlayProps
15
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {
16
- blur?: "none" | "sm" | "md" | "lg" | "xl"
17
- variant?: "default" | "dark" | "light" | "gradient"
18
- }
19
-
20
- const DialogProOverlay = React.forwardRef<
21
- React.ElementRef<typeof DialogPrimitive.Overlay>,
22
- DialogProOverlayProps
23
- >(({ className, blur = "md", variant = "default", ...props }, ref) => {
24
- const blurClasses = {
25
- none: "",
26
- sm: "backdrop-blur-sm",
27
- md: "backdrop-blur-md",
28
- lg: "backdrop-blur-lg",
29
- xl: "backdrop-blur-xl",
30
- }
31
-
32
- const variantClasses = {
33
- default: "bg-black/80",
34
- dark: "bg-black/90",
35
- light: "bg-white/80",
36
- gradient: "bg-gradient-to-br from-black/80 via-gray-900/80 to-black/80",
37
- }
38
-
39
- return (
40
- <DialogPrimitive.Overlay
41
- ref={ref}
42
- className={cn(
43
- "fixed inset-0 z-50",
44
- blurClasses[blur],
45
- variantClasses[variant],
46
- className
47
- )}
48
- {...props}
49
- />
50
- )
51
- })
52
- DialogProOverlay.displayName = DialogPrimitive.Overlay.displayName
53
-
54
- interface DialogProContentProps
55
- extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
56
- animation?: "fade" | "scale" | "slide" | "rotate" | "bounce"
57
- animationDuration?: number
58
- overlay?: boolean
59
- overlayProps?: DialogProOverlayProps
60
- }
61
-
62
- const DialogProContent = React.forwardRef<
63
- React.ElementRef<typeof DialogPrimitive.Content>,
64
- DialogProContentProps
65
- >(({
66
- className,
67
- children,
68
- animation = "scale",
69
- animationDuration = 0.3,
70
- overlay = true,
71
- overlayProps = {},
72
- ...props
73
- }, ref) => {
74
- const animationVariants = {
75
- fade: {
76
- initial: { opacity: 0 },
77
- animate: { opacity: 1 },
78
- exit: { opacity: 0 }
79
- },
80
- scale: {
81
- initial: { opacity: 0, scale: 0.9, y: 20 },
82
- animate: { opacity: 1, scale: 1, y: 0 },
83
- exit: { opacity: 0, scale: 0.9, y: 20 }
84
- },
85
- slide: {
86
- initial: { opacity: 0, y: 100 },
87
- animate: { opacity: 1, y: 0 },
88
- exit: { opacity: 0, y: 100 }
89
- },
90
- rotate: {
91
- initial: { opacity: 0, scale: 0.9, rotate: -10 },
92
- animate: { opacity: 1, scale: 1, rotate: 0 },
93
- exit: { opacity: 0, scale: 0.9, rotate: 10 }
94
- },
95
- bounce: {
96
- initial: { opacity: 0, scale: 0.3, y: -100 },
97
- animate: {
98
- opacity: 1,
99
- scale: 1,
100
- y: 0,
101
- transition: {
102
- type: "spring",
103
- duration: animationDuration,
104
- bounce: 0.5
105
- }
106
- },
107
- exit: { opacity: 0, scale: 0.5, y: -50 }
108
- }
109
- }
110
-
111
- return (
112
- <AnimatePresence>
113
- <DialogPortal>
114
- {overlay && (
115
- <motion.div
116
- initial={{ opacity: 0 }}
117
- animate={{ opacity: 1 }}
118
- exit={{ opacity: 0 }}
119
- transition={{ duration: animationDuration * 0.8 }}
120
- >
121
- <DialogProOverlay {...overlayProps} />
122
- </motion.div>
123
- )}
124
- <motion.div
125
- className="fixed inset-0 z-50 flex items-center justify-center p-4"
126
- initial={{ opacity: 0 }}
127
- animate={{ opacity: 1 }}
128
- exit={{ opacity: 0 }}
129
- >
130
- <DialogPrimitive.Content
131
- ref={ref}
132
- asChild
133
- className={cn(
134
- "relative w-full max-w-lg",
135
- className
136
- )}
137
- {...props}
138
- >
139
- <motion.div
140
- variants={animationVariants[animation]}
141
- initial="initial"
142
- animate="animate"
143
- exit="exit"
144
- transition={{
145
- duration: animationDuration,
146
- ease: "easeInOut"
147
- }}
148
- className={cn(
149
- "relative bg-background rounded-lg shadow-2xl",
150
- "border border-border",
151
- "w-full max-w-lg",
152
- "max-h-[90vh] overflow-auto",
153
- className
154
- )}
155
- >
156
- {/* Glass effect overlay */}
157
- <div className="absolute inset-0 rounded-lg bg-gradient-to-br from-white/5 to-white/0 pointer-events-none" />
158
-
159
- {/* Content wrapper with padding */}
160
- <div className="relative p-6">
161
- {children}
162
- </div>
163
-
164
- {/* Close button with enhanced styling */}
165
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-all hover:opacity-100 hover:rotate-90 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
166
- <X className="h-4 w-4" />
167
- <span className="sr-only">Close</span>
168
- </DialogPrimitive.Close>
169
- </motion.div>
170
- </DialogPrimitive.Content>
171
- </motion.div>
172
- </DialogPortal>
173
- </AnimatePresence>
174
- )
175
- })
176
- DialogProContent.displayName = DialogPrimitive.Content.displayName
177
-
178
- const DialogProHeader = ({
179
- className,
180
- ...props
181
- }: React.HTMLAttributes<HTMLDivElement>) => (
182
- <motion.div
183
- className={cn(
184
- "flex flex-col space-y-1.5 text-center sm:text-left",
185
- className
186
- )}
187
- initial={{ opacity: 0, y: -10 }}
188
- animate={{ opacity: 1, y: 0 }}
189
- transition={{ delay: 0.1, duration: 0.3 }}
190
- />
191
- )
192
- DialogProHeader.displayName = "DialogProHeader"
193
-
194
- const DialogProFooter = ({
195
- className,
196
- ...props
197
- }: React.HTMLAttributes<HTMLDivElement>) => (
198
- <motion.div
199
- className={cn(
200
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
201
- className
202
- )}
203
- initial={{ opacity: 0, y: 10 }}
204
- animate={{ opacity: 1, y: 0 }}
205
- transition={{ delay: 0.2, duration: 0.3 }}
206
- />
207
- )
208
- DialogProFooter.displayName = "DialogProFooter"
209
-
210
- const DialogProTitle = React.forwardRef<
211
- React.ElementRef<typeof DialogPrimitive.Title>,
212
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
213
- >(({ className, ...props }, ref) => (
214
- <DialogPrimitive.Title
215
- ref={ref}
216
- className={cn(
217
- "text-lg font-semibold leading-none tracking-tight",
218
- className
219
- )}
220
- {...props}
221
- />
222
- ))
223
- DialogProTitle.displayName = DialogPrimitive.Title.displayName
224
-
225
- const DialogProDescription = React.forwardRef<
226
- React.ElementRef<typeof DialogPrimitive.Description>,
227
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
228
- >(({ className, ...props }, ref) => (
229
- <DialogPrimitive.Description
230
- ref={ref}
231
- className={cn("text-sm text-muted-foreground", className)}
232
- {...props}
233
- />
234
- ))
235
- DialogProDescription.displayName = DialogPrimitive.Description.displayName
236
-
237
- export {
238
- Dialog as DialogPro,
239
- DialogTrigger as DialogProTrigger,
240
- DialogProContent,
241
- DialogProHeader,
242
- DialogProFooter,
243
- DialogProTitle,
244
- DialogProDescription,
245
- DialogClose as DialogProClose,
246
- }
@@ -1,4 +0,0 @@
1
- export * from './button'
2
- export * from './card'
3
- export * from './dialog'
4
- export * from './badge'
@@ -1,109 +0,0 @@
1
- "use client"
2
-
3
- import React, { Component, ErrorInfo, ReactNode } from "react"
4
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card"
5
- import { Button } from "../ui/button"
6
- import { AlertTriangle, RefreshCw, Lock, Sparkles } from "lucide-react"
7
- import { cn } from "../../lib/utils"
8
- import { useSubscription } from "../../hooks/use-subscription"
9
-
10
- interface ErrorBoundaryProps {
11
- children: ReactNode
12
- fallback?: ReactNode
13
- className?: string
14
- onError?: (error: Error, errorInfo: ErrorInfo) => void
15
- }
16
-
17
- interface ErrorBoundaryState {
18
- hasError: boolean
19
- error?: Error
20
- }
21
-
22
- class ErrorBoundaryInternal extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
23
- constructor(props: ErrorBoundaryProps) {
24
- super(props)
25
- this.state = { hasError: false }
26
- }
27
-
28
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
29
- return { hasError: true, error }
30
- }
31
-
32
- componentDidCatch(error: Error, errorInfo: ErrorInfo) {
33
- this.props.onError?.(error, errorInfo)
34
- console.error('ErrorBoundary caught an error:', error, errorInfo)
35
- }
36
-
37
- render() {
38
- if (this.state.hasError) {
39
- if (this.props.fallback) {
40
- return this.props.fallback
41
- }
42
-
43
- return (
44
- <div className={cn("flex items-center justify-center min-h-[200px] p-4", this.props.className)}>
45
- <Card className="w-full max-w-md">
46
- <CardHeader className="text-center">
47
- <div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-red-100">
48
- <AlertTriangle className="h-6 w-6 text-red-600" />
49
- </div>
50
- <CardTitle>Something went wrong</CardTitle>
51
- <CardDescription>
52
- An error occurred while rendering this component
53
- </CardDescription>
54
- </CardHeader>
55
- <CardContent className="text-center">
56
- <Button
57
- onClick={() => this.setState({ hasError: false, error: undefined })}
58
- className="mt-4"
59
- >
60
- <RefreshCw className="mr-2 h-4 w-4" />
61
- Try again
62
- </Button>
63
- </CardContent>
64
- </Card>
65
- </div>
66
- )
67
- }
68
-
69
- return this.props.children
70
- }
71
- }
72
-
73
- function ErrorBoundaryWrapper(props: ErrorBoundaryProps) {
74
- // Check if we're in docs mode or have pro access
75
- const { hasProAccess, isLoading } = useSubscription()
76
-
77
- // In docs mode, always show the component
78
-
79
- // If not in docs mode and no pro access, show upgrade prompt
80
- if (!isLoading && !hasProAccess) {
81
- return (
82
- <Card className={cn("w-fit", props.className)}>
83
- <CardContent className="py-6 text-center">
84
- <div className="space-y-4">
85
- <div className="rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto">
86
- <Lock className="h-6 w-6 text-purple-600 dark:text-purple-400" />
87
- </div>
88
- <div>
89
- <h3 className="font-semibold text-sm mb-2">Pro Feature</h3>
90
- <p className="text-muted-foreground text-xs mb-4">
91
- Error Boundary is available exclusively to MoonUI Pro subscribers.
92
- </p>
93
- <a href="/pricing">
94
- <Button size="sm">
95
- <Sparkles className="mr-2 h-4 w-4" />
96
- Upgrade to Pro
97
- </Button>
98
- </a>
99
- </div>
100
- </div>
101
- </CardContent>
102
- </Card>
103
- )
104
- }
105
-
106
- return <ErrorBoundaryInternal {...props} />
107
- }
108
-
109
- export const ErrorBoundary = ErrorBoundaryWrapper