@moontra/moonui-pro 2.19.0 → 2.20.1
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.
- package/dist/index.d.ts +3251 -0
- package/dist/index.mjs +2410 -1545
- package/package.json +137 -136
- package/src/__tests__/use-local-storage.test.tsx +2 -2
- package/src/components/advanced-chart/index.tsx +6 -6
- package/src/components/calendar/event-dialog.tsx +1 -1
- package/src/components/calendar/index.tsx +1 -1
- package/src/components/calendar-pro/index.tsx +2 -4
- package/src/components/dashboard/demo.tsx +2 -2
- package/src/components/dashboard/widgets/activity-feed.tsx +1 -1
- package/src/components/dashboard/widgets/metric-card.tsx +1 -1
- package/src/components/enhanced/button.tsx +13 -13
- package/src/components/file-upload/file-upload.test.tsx +20 -19
- package/src/components/form-wizard/form-wizard-progress.tsx +7 -7
- package/src/components/gesture-drawer/index.tsx +551 -0
- package/src/components/github-stars/hooks.ts +1 -1
- package/src/components/github-stars/index.tsx +1 -1
- package/src/components/github-stars/types.ts +1 -0
- package/src/components/health-check/index.tsx +2 -2
- package/src/components/hover-card-3d/index.tsx +437 -74
- package/src/components/index.ts +10 -1
- package/src/components/lazy-component/index.tsx +4 -2
- package/src/components/license-error/index.tsx +29 -0
- package/src/components/memory-efficient-data/index.tsx +1 -1
- package/src/components/pinch-zoom/index.tsx +438 -42
- package/src/components/rich-text-editor/index.tsx +12 -12
- package/src/components/timeline/index.tsx +2 -2
- package/src/components/ui/aspect-ratio.tsx +186 -22
- package/src/components/ui/button.tsx +47 -50
- package/src/components/ui/card.tsx +98 -30
- package/src/components/ui/gesture-drawer.tsx +11 -0
- package/src/components/ui/index.ts +17 -5
- package/src/components/ui/lightbox.tsx +606 -0
- package/src/components/ui/media-gallery.tsx +612 -0
- package/src/components/ui/select.tsx +134 -35
- package/src/components/ui/toggle.tsx +78 -15
- package/src/components/virtual-list/index.tsx +7 -7
- package/src/index.ts +4 -4
- package/src/lib/component-metadata.ts +18 -0
- package/src/lib/paddle.ts +17 -0
- package/src/patterns/login-form/index.tsx +1 -1
- package/src/patterns/login-form/types.ts +6 -6
- package/src/styles/index.css +14 -4
- package/src/types/next-auth.d.ts +21 -0
- package/src/use-local-storage.tsx +3 -3
- package/src/use-scroll-animation.ts +3 -5
- package/src/components/ui/hover-card-3d.tsx +0 -472
|
@@ -6,33 +6,78 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
6
6
|
import { cn } from "../../lib/utils"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Aspect Ratio Component
|
|
9
|
+
* Premium Aspect Ratio Component
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Advanced component that maintains specific aspect ratios with preset support,
|
|
12
|
+
* responsive behavior, animations, and enhanced styling options.
|
|
13
|
+
* Perfect for images, videos, and media content in modern applications.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
// Preset ratios
|
|
17
|
+
const PRESET_RATIOS = {
|
|
18
|
+
square: 1,
|
|
19
|
+
video: 16 / 9,
|
|
20
|
+
portrait: 3 / 4,
|
|
21
|
+
landscape: 4 / 3,
|
|
22
|
+
golden: 1.618,
|
|
23
|
+
ultrawide: 21 / 9,
|
|
24
|
+
cinema: 2.39,
|
|
25
|
+
instagram: 4 / 5,
|
|
26
|
+
story: 9 / 16,
|
|
27
|
+
banner: 3 / 1,
|
|
28
|
+
} as const
|
|
29
|
+
|
|
30
|
+
type PresetRatio = keyof typeof PRESET_RATIOS
|
|
31
|
+
|
|
32
|
+
// Responsive ratio configuration
|
|
33
|
+
interface ResponsiveRatio {
|
|
34
|
+
sm?: number | PresetRatio
|
|
35
|
+
md?: number | PresetRatio
|
|
36
|
+
lg?: number | PresetRatio
|
|
37
|
+
xl?: number | PresetRatio
|
|
38
|
+
"2xl"?: number | PresetRatio
|
|
39
|
+
}
|
|
40
|
+
|
|
16
41
|
const MoonUIaspectRatioVariantsPro = cva(
|
|
17
42
|
"relative overflow-hidden",
|
|
18
43
|
{
|
|
19
44
|
variants: {
|
|
20
45
|
variant: {
|
|
21
|
-
default: "
|
|
46
|
+
default: "bg-muted/10",
|
|
22
47
|
ghost: "bg-transparent",
|
|
23
|
-
outline: "
|
|
24
|
-
card: "
|
|
48
|
+
outline: "border border-border",
|
|
49
|
+
card: "bg-card shadow-sm",
|
|
50
|
+
glass: "bg-white/10 backdrop-blur-md border border-white/20",
|
|
51
|
+
gradient: "bg-gradient-to-br from-primary/10 to-secondary/10",
|
|
25
52
|
},
|
|
26
53
|
radius: {
|
|
27
54
|
none: "rounded-none",
|
|
28
55
|
sm: "rounded-sm",
|
|
29
56
|
md: "rounded-md",
|
|
30
57
|
lg: "rounded-lg",
|
|
58
|
+
xl: "rounded-xl",
|
|
59
|
+
"2xl": "rounded-2xl",
|
|
31
60
|
full: "rounded-full",
|
|
32
61
|
},
|
|
62
|
+
animate: {
|
|
63
|
+
true: "transition-all duration-300 ease-in-out",
|
|
64
|
+
false: "",
|
|
65
|
+
},
|
|
66
|
+
hover: {
|
|
67
|
+
true: "hover:scale-105 hover:shadow-lg cursor-pointer",
|
|
68
|
+
false: "",
|
|
69
|
+
},
|
|
70
|
+
loading: {
|
|
71
|
+
true: "animate-pulse",
|
|
72
|
+
false: "",
|
|
73
|
+
},
|
|
33
74
|
},
|
|
34
75
|
defaultVariants: {
|
|
35
76
|
variant: "default",
|
|
77
|
+
radius: "md",
|
|
78
|
+
animate: false,
|
|
79
|
+
hover: false,
|
|
80
|
+
loading: false,
|
|
36
81
|
},
|
|
37
82
|
}
|
|
38
83
|
)
|
|
@@ -45,27 +90,146 @@ interface AspectRatioProps
|
|
|
45
90
|
* @default 16/9
|
|
46
91
|
*/
|
|
47
92
|
ratio?: number
|
|
93
|
+
/**
|
|
94
|
+
* Preset aspect ratio for quick usage
|
|
95
|
+
*/
|
|
96
|
+
preset?: PresetRatio
|
|
97
|
+
/**
|
|
98
|
+
* Responsive aspect ratios for different breakpoints
|
|
99
|
+
*/
|
|
100
|
+
responsive?: ResponsiveRatio
|
|
101
|
+
/**
|
|
102
|
+
* Enable smooth aspect ratio changes
|
|
103
|
+
*/
|
|
104
|
+
smoothTransition?: boolean
|
|
105
|
+
/**
|
|
106
|
+
* Add overlay content
|
|
107
|
+
*/
|
|
108
|
+
overlay?: React.ReactNode
|
|
109
|
+
/**
|
|
110
|
+
* Overlay position
|
|
111
|
+
*/
|
|
112
|
+
overlayPosition?: "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
113
|
+
/**
|
|
114
|
+
* Show loading skeleton
|
|
115
|
+
*/
|
|
116
|
+
skeleton?: boolean
|
|
48
117
|
}
|
|
49
118
|
|
|
50
119
|
const MoonUIAspectRatioPro = React.forwardRef<
|
|
51
120
|
HTMLDivElement,
|
|
52
121
|
AspectRatioProps
|
|
53
|
-
>(({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
122
|
+
>(({
|
|
123
|
+
className,
|
|
124
|
+
variant,
|
|
125
|
+
radius,
|
|
126
|
+
animate,
|
|
127
|
+
hover,
|
|
128
|
+
loading,
|
|
129
|
+
ratio = 16 / 9,
|
|
130
|
+
preset,
|
|
131
|
+
responsive,
|
|
132
|
+
smoothTransition = false,
|
|
133
|
+
overlay,
|
|
134
|
+
overlayPosition = "center",
|
|
135
|
+
skeleton = false,
|
|
136
|
+
style,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}, ref) => {
|
|
140
|
+
const [currentRatio, setCurrentRatio] = React.useState(() => {
|
|
141
|
+
if (preset) return PRESET_RATIOS[preset]
|
|
142
|
+
return ratio
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
// Update ratio when props change
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
const newRatio = preset ? PRESET_RATIOS[preset] : ratio
|
|
148
|
+
if (smoothTransition) {
|
|
149
|
+
setCurrentRatio(newRatio)
|
|
150
|
+
} else {
|
|
151
|
+
setCurrentRatio(newRatio)
|
|
152
|
+
}
|
|
153
|
+
}, [preset, ratio, smoothTransition])
|
|
154
|
+
|
|
155
|
+
// Handle responsive ratios
|
|
156
|
+
React.useEffect(() => {
|
|
157
|
+
if (!responsive) return
|
|
158
|
+
|
|
159
|
+
const handleResize = () => {
|
|
160
|
+
const width = window.innerWidth
|
|
161
|
+
let newRatio = currentRatio
|
|
162
|
+
|
|
163
|
+
if (width >= 1536 && responsive["2xl"]) {
|
|
164
|
+
newRatio = typeof responsive["2xl"] === "string"
|
|
165
|
+
? PRESET_RATIOS[responsive["2xl"]]
|
|
166
|
+
: responsive["2xl"]
|
|
167
|
+
} else if (width >= 1280 && responsive.xl) {
|
|
168
|
+
newRatio = typeof responsive.xl === "string"
|
|
169
|
+
? PRESET_RATIOS[responsive.xl]
|
|
170
|
+
: responsive.xl
|
|
171
|
+
} else if (width >= 1024 && responsive.lg) {
|
|
172
|
+
newRatio = typeof responsive.lg === "string"
|
|
173
|
+
? PRESET_RATIOS[responsive.lg]
|
|
174
|
+
: responsive.lg
|
|
175
|
+
} else if (width >= 768 && responsive.md) {
|
|
176
|
+
newRatio = typeof responsive.md === "string"
|
|
177
|
+
? PRESET_RATIOS[responsive.md]
|
|
178
|
+
: responsive.md
|
|
179
|
+
} else if (width >= 640 && responsive.sm) {
|
|
180
|
+
newRatio = typeof responsive.sm === "string"
|
|
181
|
+
? PRESET_RATIOS[responsive.sm]
|
|
182
|
+
: responsive.sm
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
setCurrentRatio(newRatio)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
handleResize()
|
|
189
|
+
window.addEventListener("resize", handleResize)
|
|
190
|
+
return () => window.removeEventListener("resize", handleResize)
|
|
191
|
+
}, [responsive, currentRatio])
|
|
192
|
+
|
|
193
|
+
const overlayPositionClasses = {
|
|
194
|
+
center: "items-center justify-center",
|
|
195
|
+
"top-left": "items-start justify-start p-4",
|
|
196
|
+
"top-right": "items-start justify-end p-4",
|
|
197
|
+
"bottom-left": "items-end justify-start p-4",
|
|
198
|
+
"bottom-right": "items-end justify-end p-4",
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<div
|
|
203
|
+
ref={ref}
|
|
204
|
+
className={cn(
|
|
205
|
+
MoonUIaspectRatioVariantsPro({ variant, radius, animate: animate || smoothTransition, hover, loading: loading || skeleton }),
|
|
206
|
+
className
|
|
207
|
+
)}
|
|
208
|
+
style={{
|
|
209
|
+
position: "relative",
|
|
210
|
+
paddingBottom: `${(1 / currentRatio) * 100}%`,
|
|
211
|
+
...style
|
|
212
|
+
}}
|
|
213
|
+
{...props}
|
|
214
|
+
>
|
|
215
|
+
<div className="absolute inset-0">
|
|
216
|
+
{skeleton ? (
|
|
217
|
+
<div className="w-full h-full bg-muted animate-pulse" />
|
|
218
|
+
) : (
|
|
219
|
+
children
|
|
220
|
+
)}
|
|
221
|
+
{overlay && (
|
|
222
|
+
<div className={cn(
|
|
223
|
+
"absolute inset-0 flex",
|
|
224
|
+
overlayPositionClasses[overlayPosition]
|
|
225
|
+
)}>
|
|
226
|
+
{overlay}
|
|
227
|
+
</div>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
66
230
|
</div>
|
|
67
|
-
|
|
68
|
-
)
|
|
231
|
+
)
|
|
232
|
+
})
|
|
69
233
|
MoonUIAspectRatioPro.displayName = "AspectRatioPro"
|
|
70
234
|
|
|
71
235
|
|
|
@@ -13,73 +13,70 @@ const moonUIButtonProVariants = cva(
|
|
|
13
13
|
["inline-flex items-center justify-center gap-2 whitespace-nowrap",
|
|
14
14
|
"font-medium relative",
|
|
15
15
|
"transition-all duration-200 ease-out",
|
|
16
|
-
"
|
|
16
|
+
"transform active:scale-[0.98]",
|
|
17
17
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
18
|
-
"disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none"],
|
|
18
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none disabled:transform-none"],
|
|
19
19
|
{
|
|
20
20
|
variants: {
|
|
21
21
|
variant: {
|
|
22
22
|
primary: [
|
|
23
23
|
"bg-primary text-primary-foreground",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
24
|
+
"dark:bg-primary dark:text-primary-foreground",
|
|
25
|
+
"hover:bg-primary/90 dark:hover:bg-primary/90",
|
|
26
|
+
"active:bg-primary/80 dark:active:bg-primary/80",
|
|
27
|
+
"shadow-sm hover:shadow-md",
|
|
28
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
29
29
|
"transition-all duration-200",
|
|
30
30
|
],
|
|
31
31
|
secondary: [
|
|
32
|
-
"bg-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
32
|
+
"bg-muted text-muted-foreground",
|
|
33
|
+
"dark:bg-muted dark:text-muted-foreground",
|
|
34
|
+
"hover:bg-muted/80 dark:hover:bg-muted/80",
|
|
35
|
+
"active:bg-muted/70 dark:active:bg-muted/70",
|
|
36
|
+
"border border-input dark:border-input",
|
|
37
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
38
|
+
"shadow-sm hover:shadow-md",
|
|
39
39
|
],
|
|
40
40
|
outline: [
|
|
41
41
|
"bg-background text-foreground",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"hover:bg-
|
|
45
|
-
"active:bg-
|
|
46
|
-
"focus-visible:ring-
|
|
47
|
-
"
|
|
48
|
-
"dark:shadow-sm dark:shadow-gray-950/10",
|
|
42
|
+
"dark:bg-background dark:text-foreground",
|
|
43
|
+
"border border-input dark:border-input",
|
|
44
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent dark:hover:text-accent-foreground",
|
|
45
|
+
"active:bg-accent/80 dark:active:bg-accent/80",
|
|
46
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
47
|
+
"transition-all duration-200",
|
|
49
48
|
],
|
|
50
49
|
ghost: [
|
|
51
50
|
"text-foreground",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"transition-
|
|
51
|
+
"dark:text-foreground",
|
|
52
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent dark:hover:text-accent-foreground",
|
|
53
|
+
"active:bg-accent/80 dark:active:bg-accent/80",
|
|
54
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
55
|
+
"transition-all duration-200",
|
|
57
56
|
],
|
|
58
57
|
destructive: [
|
|
59
|
-
"bg-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"transition-
|
|
58
|
+
"bg-destructive text-destructive-foreground",
|
|
59
|
+
"dark:bg-destructive dark:text-destructive-foreground",
|
|
60
|
+
"hover:bg-destructive/90 dark:hover:bg-destructive/90",
|
|
61
|
+
"active:bg-destructive/80 dark:active:bg-destructive/80",
|
|
62
|
+
"shadow-sm hover:shadow-md",
|
|
63
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
64
|
+
"transition-all duration-200",
|
|
66
65
|
],
|
|
67
66
|
success: [
|
|
68
|
-
"bg-success text-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"transition-
|
|
67
|
+
"bg-success text-success-foreground",
|
|
68
|
+
"dark:bg-success dark:text-success-foreground",
|
|
69
|
+
"hover:bg-success/90 dark:hover:bg-success/90",
|
|
70
|
+
"active:bg-success/80 dark:active:bg-success/80",
|
|
71
|
+
"shadow-sm hover:shadow-md",
|
|
72
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
73
|
+
"transition-all duration-200",
|
|
75
74
|
],
|
|
76
75
|
link: [
|
|
77
76
|
"text-primary bg-transparent",
|
|
78
77
|
"underline-offset-4 hover:underline",
|
|
79
|
-
"hover:text-primary
|
|
78
|
+
"hover:text-primary/80 active:text-primary/70",
|
|
80
79
|
"p-0 h-auto",
|
|
81
|
-
"dark:text-blue-400 dark:hover:text-blue-300",
|
|
82
|
-
"dark:active:text-blue-500",
|
|
83
80
|
"transition-colors duration-200",
|
|
84
81
|
],
|
|
85
82
|
gradient: [
|
|
@@ -129,14 +126,14 @@ const moonUIButtonProVariants = cva(
|
|
|
129
126
|
],
|
|
130
127
|
},
|
|
131
128
|
size: {
|
|
132
|
-
xs: "h-7 px-2.5 text-xs rounded",
|
|
133
|
-
sm: "h-8 px-3 text-sm rounded",
|
|
134
|
-
md: "h-10 px-4 text-base rounded-
|
|
129
|
+
xs: "h-7 px-2.5 text-xs rounded-md",
|
|
130
|
+
sm: "h-8 px-3 text-sm rounded-md",
|
|
131
|
+
md: "h-10 px-4 text-base rounded-lg",
|
|
135
132
|
lg: "h-12 px-6 text-lg rounded-lg",
|
|
136
|
-
xl: "h-14 px-8 text-xl rounded-
|
|
137
|
-
icon: "h-10 w-10 p-2 rounded-
|
|
138
|
-
"icon-sm": "h-8 w-8 p-1.5 rounded",
|
|
139
|
-
"icon-lg": "h-12 w-12 p-3 rounded-
|
|
133
|
+
xl: "h-14 px-8 text-xl rounded-xl",
|
|
134
|
+
icon: "h-10 w-10 p-2 rounded-lg",
|
|
135
|
+
"icon-sm": "h-8 w-8 p-1.5 rounded-md",
|
|
136
|
+
"icon-lg": "h-12 w-12 p-3 rounded-xl",
|
|
140
137
|
},
|
|
141
138
|
rounded: {
|
|
142
139
|
default: "",
|
|
@@ -5,16 +5,18 @@ import { cn } from "../../lib/utils";
|
|
|
5
5
|
import { microInteractionVariants, hoverAnimations, tapAnimations } from "../../lib/micro-interactions";
|
|
6
6
|
|
|
7
7
|
const moonUICardVariantsPro = cva(
|
|
8
|
-
"rounded-lg border bg-card text-card-foreground shadow-sm
|
|
8
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm transition-all duration-200",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default: "",
|
|
13
|
-
outline: "border border-border shadow-none bg-transparent dark:border-
|
|
14
|
-
filled: "border-none bg-secondary dark:bg-
|
|
15
|
-
elevated: "border-none shadow-
|
|
12
|
+
default: "border-border dark:border-border",
|
|
13
|
+
outline: "border border-border shadow-none bg-transparent dark:border-border",
|
|
14
|
+
filled: "border-none bg-secondary dark:bg-secondary shadow-inner",
|
|
15
|
+
elevated: "border-none shadow-lg dark:shadow-xl dark:shadow-black/20",
|
|
16
16
|
gradient: "border-none bg-gradient-to-br from-primary/5 to-primary/10 dark:from-primary/10 dark:to-primary/20",
|
|
17
|
-
glass: "border border-white/20 bg-white/10 backdrop-blur-md dark:border-
|
|
17
|
+
glass: "border border-white/20 bg-white/10 backdrop-blur-md dark:border-white/10 dark:bg-black/10",
|
|
18
|
+
neon: "border-2 border-primary/50 shadow-[0_0_15px_rgba(var(--primary),0.5)] dark:shadow-[0_0_20px_rgba(var(--primary),0.7)]",
|
|
19
|
+
glow: "border border-border shadow-[0_0_30px_rgba(var(--primary),0.15)] dark:shadow-[0_0_40px_rgba(var(--primary),0.25)]",
|
|
18
20
|
},
|
|
19
21
|
size: {
|
|
20
22
|
default: "p-6",
|
|
@@ -47,38 +49,104 @@ export interface MoonUICardProProps
|
|
|
47
49
|
VariantProps<typeof moonUICardVariantsPro> {
|
|
48
50
|
asChild?: boolean;
|
|
49
51
|
microInteraction?: "lift" | "glow" | "scale" | "none";
|
|
52
|
+
enableGlassmorphism?: boolean;
|
|
53
|
+
enableParallax?: boolean;
|
|
54
|
+
enableTilt?: boolean;
|
|
55
|
+
tiltMaxAngle?: number;
|
|
56
|
+
parallaxOffset?: number;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
const MoonUICardPro = React.forwardRef<HTMLDivElement, MoonUICardProProps>(
|
|
53
|
-
({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
({
|
|
61
|
+
className,
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
radius,
|
|
65
|
+
interactive,
|
|
66
|
+
microInteraction = "lift",
|
|
67
|
+
enableGlassmorphism,
|
|
68
|
+
enableParallax = false,
|
|
69
|
+
enableTilt = false,
|
|
70
|
+
tiltMaxAngle = 15,
|
|
71
|
+
parallaxOffset = 20,
|
|
72
|
+
children,
|
|
73
|
+
asChild,
|
|
74
|
+
...props
|
|
75
|
+
}, ref) => {
|
|
76
|
+
const [mousePos, setMousePos] = React.useState({ x: 0, y: 0 });
|
|
77
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
78
|
+
|
|
79
|
+
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
80
|
+
if (!enableTilt && !enableParallax) return;
|
|
81
|
+
|
|
82
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
83
|
+
const centerX = rect.left + rect.width / 2;
|
|
84
|
+
const centerY = rect.top + rect.height / 2;
|
|
62
85
|
|
|
63
|
-
const
|
|
86
|
+
const x = (e.clientX - centerX) / (rect.width / 2);
|
|
87
|
+
const y = (e.clientY - centerY) / (rect.height / 2);
|
|
64
88
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
setMousePos({ x, y });
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleMouseEnter = () => setIsHovered(true);
|
|
93
|
+
const handleMouseLeave = () => {
|
|
94
|
+
setIsHovered(false);
|
|
95
|
+
setMousePos({ x: 0, y: 0 });
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Apply glassmorphism variant if enabled
|
|
99
|
+
const finalVariant = enableGlassmorphism ? "glass" : variant;
|
|
100
|
+
|
|
101
|
+
// Calculate tilt transforms
|
|
102
|
+
const rotateX = enableTilt ? mousePos.y * -tiltMaxAngle : 0;
|
|
103
|
+
const rotateY = enableTilt ? mousePos.x * tiltMaxAngle : 0;
|
|
104
|
+
|
|
105
|
+
// Base interaction props
|
|
106
|
+
const interactionProps = interactive && microInteraction !== "none" ? {
|
|
107
|
+
whileHover: microInteraction === "scale" ? hoverAnimations.scale :
|
|
108
|
+
microInteraction === "glow" ? hoverAnimations.glow :
|
|
109
|
+
hoverAnimations.lift,
|
|
110
|
+
whileTap: tapAnimations.scale,
|
|
111
|
+
} : {};
|
|
112
|
+
|
|
113
|
+
const { onDrag, onDragStart, onDragEnd, ...divProps } = props as any;
|
|
74
114
|
|
|
75
|
-
// Non-interactive version
|
|
76
115
|
return (
|
|
77
|
-
<div
|
|
116
|
+
<motion.div
|
|
78
117
|
ref={ref}
|
|
79
|
-
className={cn(moonUICardVariantsPro({ variant, size, radius, interactive, className }))}
|
|
80
|
-
{
|
|
81
|
-
|
|
118
|
+
className={cn(moonUICardVariantsPro({ variant: finalVariant, size, radius, interactive, className }))}
|
|
119
|
+
onMouseMove={handleMouseMove}
|
|
120
|
+
onMouseEnter={handleMouseEnter}
|
|
121
|
+
onMouseLeave={handleMouseLeave}
|
|
122
|
+
style={{
|
|
123
|
+
transformStyle: enableTilt || enableParallax ? "preserve-3d" : undefined,
|
|
124
|
+
perspective: enableTilt || enableParallax ? "1000px" : undefined,
|
|
125
|
+
}}
|
|
126
|
+
animate={{
|
|
127
|
+
rotateX,
|
|
128
|
+
rotateY,
|
|
129
|
+
}}
|
|
130
|
+
transition={{ type: "spring", damping: 20, stiffness: 300 }}
|
|
131
|
+
{...interactionProps}
|
|
132
|
+
{...divProps}
|
|
133
|
+
>
|
|
134
|
+
{/* Parallax content wrapper */}
|
|
135
|
+
{enableParallax ? (
|
|
136
|
+
<motion.div
|
|
137
|
+
style={{ transform: "translateZ(50px)" }}
|
|
138
|
+
animate={{
|
|
139
|
+
x: isHovered ? mousePos.x * parallaxOffset : 0,
|
|
140
|
+
y: isHovered ? mousePos.y * parallaxOffset : 0,
|
|
141
|
+
}}
|
|
142
|
+
transition={{ type: "spring", damping: 20, stiffness: 300 }}
|
|
143
|
+
>
|
|
144
|
+
{children}
|
|
145
|
+
</motion.div>
|
|
146
|
+
) : (
|
|
147
|
+
children
|
|
148
|
+
)}
|
|
149
|
+
</motion.div>
|
|
82
150
|
);
|
|
83
151
|
}
|
|
84
152
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
MoonUIGestureDrawerPro,
|
|
5
|
+
GestureDrawer,
|
|
6
|
+
type MoonUIGestureDrawerProProps,
|
|
7
|
+
type GestureDrawerProps,
|
|
8
|
+
moonUIGestureDrawerProVariants
|
|
9
|
+
} from "../gesture-drawer/index"
|
|
10
|
+
|
|
11
|
+
export { MoonUIGestureDrawerPro as default } from "../gesture-drawer/index"
|
|
@@ -170,9 +170,21 @@ export {
|
|
|
170
170
|
HoverCard, HoverCardTrigger, HoverCardContent
|
|
171
171
|
} from './hover-card';
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
// HoverCard3D is exported from components/hover-card-3d/index.tsx
|
|
174
|
+
|
|
175
|
+
// Note: Micro-interaction components are exported from their individual directories
|
|
176
|
+
|
|
177
|
+
// Gesture Drawer
|
|
178
|
+
export {
|
|
179
|
+
MoonUIGestureDrawerPro,
|
|
180
|
+
GestureDrawer,
|
|
181
|
+
type MoonUIGestureDrawerProProps,
|
|
182
|
+
type GestureDrawerProps,
|
|
183
|
+
moonUIGestureDrawerProVariants
|
|
184
|
+
} from './gesture-drawer';
|
|
185
|
+
|
|
186
|
+
// Lightbox
|
|
187
|
+
export * from './lightbox';
|
|
177
188
|
|
|
178
|
-
//
|
|
189
|
+
// Media Gallery
|
|
190
|
+
export * from './media-gallery';
|