@moontra/moonui-pro 2.18.6 → 2.20.0

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 (49) hide show
  1. package/dist/index.d.ts +3251 -0
  2. package/dist/index.mjs +2704 -1479
  3. package/package.json +137 -136
  4. package/src/__tests__/use-local-storage.test.tsx +2 -2
  5. package/src/components/advanced-chart/index.tsx +6 -6
  6. package/src/components/animated-button/index.tsx +240 -53
  7. package/src/components/calendar/event-dialog.tsx +1 -1
  8. package/src/components/calendar/index.tsx +1 -1
  9. package/src/components/calendar-pro/index.tsx +2 -4
  10. package/src/components/dashboard/demo.tsx +2 -2
  11. package/src/components/dashboard/widgets/activity-feed.tsx +1 -1
  12. package/src/components/dashboard/widgets/metric-card.tsx +1 -1
  13. package/src/components/enhanced/button.tsx +13 -13
  14. package/src/components/file-upload/file-upload.test.tsx +20 -19
  15. package/src/components/form-wizard/form-wizard-progress.tsx +7 -7
  16. package/src/components/gesture-drawer/index.tsx +551 -0
  17. package/src/components/github-stars/hooks.ts +1 -1
  18. package/src/components/github-stars/index.tsx +1 -1
  19. package/src/components/github-stars/types.ts +1 -0
  20. package/src/components/health-check/index.tsx +2 -2
  21. package/src/components/hover-card-3d/index.tsx +437 -74
  22. package/src/components/index.ts +15 -2
  23. package/src/components/lazy-component/index.tsx +4 -2
  24. package/src/components/license-error/index.tsx +29 -0
  25. package/src/components/memory-efficient-data/index.tsx +1 -1
  26. package/src/components/pinch-zoom/index.tsx +438 -42
  27. package/src/components/rich-text-editor/index.tsx +12 -12
  28. package/src/components/timeline/index.tsx +2 -2
  29. package/src/components/ui/aspect-ratio.tsx +186 -22
  30. package/src/components/ui/button.tsx +47 -50
  31. package/src/components/ui/card.tsx +98 -30
  32. package/src/components/ui/gesture-drawer.tsx +11 -0
  33. package/src/components/ui/index.ts +18 -1
  34. package/src/components/ui/lightbox.tsx +606 -0
  35. package/src/components/ui/media-gallery.tsx +612 -0
  36. package/src/components/ui/select.tsx +134 -35
  37. package/src/components/ui/toggle.tsx +78 -15
  38. package/src/components/virtual-list/index.tsx +7 -7
  39. package/src/index.ts +4 -4
  40. package/src/lib/component-metadata.ts +18 -0
  41. package/src/lib/paddle.ts +17 -0
  42. package/src/patterns/login-form/index.tsx +1 -1
  43. package/src/patterns/login-form/types.ts +6 -6
  44. package/src/styles/index.css +14 -4
  45. package/src/types/next-auth.d.ts +21 -0
  46. package/src/use-local-storage.tsx +3 -3
  47. package/src/use-scroll-animation.ts +3 -5
  48. package/src/components/ui/animated-button.tsx +0 -185
  49. package/src/components/ui/hover-card-3d.tsx +0 -103
@@ -1,185 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { motion, AnimatePresence } from "framer-motion";
5
- import { Check, X, Loader2 } from "lucide-react";
6
- import { cn } from "../../lib/utils";
7
- import { cva, type VariantProps } from "class-variance-authority";
8
-
9
- const animatedButtonVariants = cva(
10
- "relative inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
11
- {
12
- variants: {
13
- variant: {
14
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
15
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
16
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
18
- ghost: "hover:bg-accent hover:text-accent-foreground",
19
- link: "text-primary underline-offset-4 hover:underline",
20
- },
21
- size: {
22
- default: "h-10 px-4 py-2",
23
- sm: "h-9 rounded-md px-3",
24
- lg: "h-11 rounded-md px-8",
25
- icon: "h-10 w-10",
26
- },
27
- },
28
- defaultVariants: {
29
- variant: "default",
30
- size: "default",
31
- },
32
- }
33
- );
34
-
35
- export interface AnimatedButtonProps
36
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
37
- VariantProps<typeof animatedButtonVariants> {
38
- state?: "idle" | "loading" | "success" | "error";
39
- loadingText?: string;
40
- successText?: string;
41
- errorText?: string;
42
- }
43
-
44
- const AnimatedButton = React.forwardRef<HTMLButtonElement, AnimatedButtonProps>(
45
- (
46
- {
47
- className,
48
- variant,
49
- size,
50
- state = "idle",
51
- loadingText = "Loading...",
52
- successText = "Success!",
53
- errorText = "Error!",
54
- children,
55
- disabled,
56
- ...props
57
- },
58
- ref
59
- ) => {
60
- const [buttonWidth, setButtonWidth] = React.useState<number | "auto">("auto");
61
- const buttonRef = React.useRef<HTMLButtonElement>(null);
62
-
63
- React.useEffect(() => {
64
- if (buttonRef.current && state === "idle") {
65
- setButtonWidth(buttonRef.current.offsetWidth);
66
- }
67
- }, [state, children]);
68
-
69
- const isDisabled = disabled || state !== "idle";
70
-
71
- const contentVariants = {
72
- idle: { opacity: 1, y: 0 },
73
- loading: { opacity: 0, y: 10 },
74
- success: { opacity: 0, y: 10 },
75
- error: { opacity: 0, y: 10 },
76
- };
77
-
78
- const iconVariants = {
79
- hidden: { opacity: 0, scale: 0.8, y: -10 },
80
- visible: { opacity: 1, scale: 1, y: 0 },
81
- };
82
-
83
- return (
84
- <motion.button
85
- ref={(el) => {
86
- buttonRef.current = el;
87
- if (ref) {
88
- if (typeof ref === "function") ref(el);
89
- else ref.current = el;
90
- }
91
- }}
92
- className={cn(animatedButtonVariants({ variant, size, className }))}
93
- disabled={isDisabled}
94
- animate={{
95
- width: state !== "idle" ? buttonWidth : "auto",
96
- }}
97
- transition={{ duration: 0.2 }}
98
- {...props}
99
- >
100
- <AnimatePresence mode="wait">
101
- {state === "idle" && (
102
- <motion.span
103
- key="idle"
104
- variants={contentVariants}
105
- initial="loading"
106
- animate="idle"
107
- exit="loading"
108
- transition={{ duration: 0.2 }}
109
- className="inline-flex items-center"
110
- >
111
- {children}
112
- </motion.span>
113
- )}
114
-
115
- {state === "loading" && (
116
- <motion.span
117
- key="loading"
118
- className="inline-flex items-center gap-2"
119
- initial={{ opacity: 0, y: -10 }}
120
- animate={{ opacity: 1, y: 0 }}
121
- exit={{ opacity: 0, y: 10 }}
122
- transition={{ duration: 0.2 }}
123
- >
124
- <Loader2 className="h-4 w-4 animate-spin" />
125
- {loadingText}
126
- </motion.span>
127
- )}
128
-
129
- {state === "success" && (
130
- <motion.span
131
- key="success"
132
- className="inline-flex items-center gap-2"
133
- initial={{ opacity: 0, y: -10 }}
134
- animate={{ opacity: 1, y: 0 }}
135
- exit={{ opacity: 0, y: 10 }}
136
- transition={{ duration: 0.2 }}
137
- >
138
- <motion.div
139
- variants={iconVariants}
140
- initial="hidden"
141
- animate="visible"
142
- transition={{ duration: 0.3, delay: 0.1 }}
143
- >
144
- <Check className="h-4 w-4" />
145
- </motion.div>
146
- {successText}
147
- </motion.span>
148
- )}
149
-
150
- {state === "error" && (
151
- <motion.span
152
- key="error"
153
- className="inline-flex items-center gap-2"
154
- initial={{ opacity: 0, y: -10 }}
155
- animate={{ opacity: 1, y: 0 }}
156
- exit={{ opacity: 0, y: 10 }}
157
- transition={{ duration: 0.2 }}
158
- >
159
- <motion.div
160
- variants={iconVariants}
161
- initial="hidden"
162
- animate="visible"
163
- transition={{ duration: 0.3, delay: 0.1 }}
164
- animate={{
165
- x: [0, -2, 2, -2, 2, 0],
166
- }}
167
- transition={{
168
- duration: 0.4,
169
- delay: 0.1,
170
- }}
171
- >
172
- <X className="h-4 w-4" />
173
- </motion.div>
174
- {errorText}
175
- </motion.span>
176
- )}
177
- </AnimatePresence>
178
- </motion.button>
179
- );
180
- }
181
- );
182
-
183
- AnimatedButton.displayName = "AnimatedButton";
184
-
185
- export { AnimatedButton, animatedButtonVariants };
@@ -1,103 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { motion, useMotionValue, useSpring, useTransform } from "framer-motion";
5
- import { cn } from "../../lib/utils";
6
-
7
- export interface HoverCard3DProps extends React.HTMLAttributes<HTMLDivElement> {
8
- children: React.ReactNode;
9
- rotateAmount?: number;
10
- scale?: number;
11
- perspective?: number;
12
- springConfig?: {
13
- stiffness?: number;
14
- damping?: number;
15
- };
16
- }
17
-
18
- const HoverCard3D = React.forwardRef<HTMLDivElement, HoverCard3DProps>(
19
- (
20
- {
21
- children,
22
- className,
23
- rotateAmount = 15,
24
- scale = 1.05,
25
- perspective = 1000,
26
- springConfig = { stiffness: 300, damping: 20 },
27
- ...props
28
- },
29
- ref
30
- ) => {
31
- const cardRef = React.useRef<HTMLDivElement>(null);
32
- const mouseX = useMotionValue(0);
33
- const mouseY = useMotionValue(0);
34
-
35
- const rotateX = useSpring(
36
- useTransform(mouseY, [-0.5, 0.5], [rotateAmount, -rotateAmount]),
37
- springConfig
38
- );
39
- const rotateY = useSpring(
40
- useTransform(mouseX, [-0.5, 0.5], [-rotateAmount, rotateAmount]),
41
- springConfig
42
- );
43
-
44
- const handleMouseMove = React.useCallback(
45
- (e: React.MouseEvent<HTMLDivElement>) => {
46
- if (!cardRef.current) return;
47
-
48
- const rect = cardRef.current.getBoundingClientRect();
49
- const width = rect.width;
50
- const height = rect.height;
51
- const x = e.clientX - rect.left;
52
- const y = e.clientY - rect.top;
53
-
54
- const xPct = x / width - 0.5;
55
- const yPct = y / height - 0.5;
56
-
57
- mouseX.set(xPct);
58
- mouseY.set(yPct);
59
- },
60
- [mouseX, mouseY]
61
- );
62
-
63
- const handleMouseLeave = React.useCallback(() => {
64
- mouseX.set(0);
65
- mouseY.set(0);
66
- }, [mouseX, mouseY]);
67
-
68
- return (
69
- <div
70
- ref={ref}
71
- className={cn("relative", className)}
72
- style={{ perspective }}
73
- {...props}
74
- >
75
- <motion.div
76
- ref={cardRef}
77
- className="w-full h-full transition-shadow duration-300 hover:shadow-xl"
78
- style={{
79
- rotateX,
80
- rotateY,
81
- transformStyle: "preserve-3d",
82
- }}
83
- onMouseMove={handleMouseMove}
84
- onMouseLeave={handleMouseLeave}
85
- whileHover={{ scale }}
86
- transition={{ type: "spring", ...springConfig }}
87
- >
88
- <div
89
- className="absolute inset-0 rounded-lg bg-gradient-to-br from-white/20 to-white/0 opacity-0 hover:opacity-100 transition-opacity duration-300"
90
- style={{
91
- transform: "translateZ(1px)",
92
- }}
93
- />
94
- {children}
95
- </motion.div>
96
- </div>
97
- );
98
- }
99
- );
100
-
101
- HoverCard3D.displayName = "HoverCard3D";
102
-
103
- export { HoverCard3D };