@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.
Files changed (47) hide show
  1. package/dist/index.d.ts +3251 -0
  2. package/dist/index.mjs +2410 -1545
  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/calendar/event-dialog.tsx +1 -1
  7. package/src/components/calendar/index.tsx +1 -1
  8. package/src/components/calendar-pro/index.tsx +2 -4
  9. package/src/components/dashboard/demo.tsx +2 -2
  10. package/src/components/dashboard/widgets/activity-feed.tsx +1 -1
  11. package/src/components/dashboard/widgets/metric-card.tsx +1 -1
  12. package/src/components/enhanced/button.tsx +13 -13
  13. package/src/components/file-upload/file-upload.test.tsx +20 -19
  14. package/src/components/form-wizard/form-wizard-progress.tsx +7 -7
  15. package/src/components/gesture-drawer/index.tsx +551 -0
  16. package/src/components/github-stars/hooks.ts +1 -1
  17. package/src/components/github-stars/index.tsx +1 -1
  18. package/src/components/github-stars/types.ts +1 -0
  19. package/src/components/health-check/index.tsx +2 -2
  20. package/src/components/hover-card-3d/index.tsx +437 -74
  21. package/src/components/index.ts +10 -1
  22. package/src/components/lazy-component/index.tsx +4 -2
  23. package/src/components/license-error/index.tsx +29 -0
  24. package/src/components/memory-efficient-data/index.tsx +1 -1
  25. package/src/components/pinch-zoom/index.tsx +438 -42
  26. package/src/components/rich-text-editor/index.tsx +12 -12
  27. package/src/components/timeline/index.tsx +2 -2
  28. package/src/components/ui/aspect-ratio.tsx +186 -22
  29. package/src/components/ui/button.tsx +47 -50
  30. package/src/components/ui/card.tsx +98 -30
  31. package/src/components/ui/gesture-drawer.tsx +11 -0
  32. package/src/components/ui/index.ts +17 -5
  33. package/src/components/ui/lightbox.tsx +606 -0
  34. package/src/components/ui/media-gallery.tsx +612 -0
  35. package/src/components/ui/select.tsx +134 -35
  36. package/src/components/ui/toggle.tsx +78 -15
  37. package/src/components/virtual-list/index.tsx +7 -7
  38. package/src/index.ts +4 -4
  39. package/src/lib/component-metadata.ts +18 -0
  40. package/src/lib/paddle.ts +17 -0
  41. package/src/patterns/login-form/index.tsx +1 -1
  42. package/src/patterns/login-form/types.ts +6 -6
  43. package/src/styles/index.css +14 -4
  44. package/src/types/next-auth.d.ts +21 -0
  45. package/src/use-local-storage.tsx +3 -3
  46. package/src/use-scroll-animation.ts +3 -5
  47. package/src/components/ui/hover-card-3d.tsx +0 -472
@@ -1,472 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { motion, useMotionValue, useSpring, useTransform, type SpringOptions } from "framer-motion";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
- import { cn } from "../../lib/utils";
7
-
8
- // Gelişmiş spring konfigürasyonu tipleri
9
- export interface SpringConfig extends SpringOptions {
10
- stiffness?: number;
11
- damping?: number;
12
- mass?: number;
13
- velocity?: number;
14
- restDelta?: number;
15
- restSpeed?: number;
16
- }
17
-
18
- // Overlay render prop tipi
19
- export type OverlayRenderProp = (props: {
20
- isHovered: boolean;
21
- rotateX: number;
22
- rotateY: number;
23
- }) => React.ReactNode;
24
-
25
- // 3D efekt varyantları
26
- const hoverCard3DVariants = cva(
27
- "relative w-full h-full",
28
- {
29
- variants: {
30
- variant: {
31
- subtle: "",
32
- dramatic: "",
33
- gaming: "",
34
- elegant: "",
35
- neon: "",
36
- },
37
- shadowIntensity: {
38
- none: "",
39
- light: "",
40
- medium: "",
41
- heavy: "",
42
- extreme: "",
43
- },
44
- glowEffect: {
45
- none: "",
46
- subtle: "",
47
- vibrant: "",
48
- neon: "",
49
- }
50
- },
51
- defaultVariants: {
52
- variant: "subtle",
53
- shadowIntensity: "medium",
54
- glowEffect: "none",
55
- }
56
- }
57
- );
58
-
59
- export interface HoverCard3DProps
60
- extends React.HTMLAttributes<HTMLDivElement>,
61
- VariantProps<typeof hoverCard3DVariants> {
62
- /** İçerik */
63
- children: React.ReactNode;
64
- /** Maksimum rotasyon açısı (derece) */
65
- maxRotation?: number;
66
- /** Hover durumunda ölçekleme faktörü */
67
- scale?: number;
68
- /** 3D perspektif değeri (px) */
69
- perspective?: number;
70
- /** Animasyon hızı (0-1 arası, 1 en hızlı) */
71
- animationSpeed?: number;
72
- /** Spring animasyon konfigürasyonu */
73
- springConfig?: SpringConfig;
74
- /** Özel overlay içeriği veya render prop */
75
- overlay?: React.ReactNode | OverlayRenderProp;
76
- /** Overlay'in her zaman görünür olup olmayacağı */
77
- overlayAlwaysVisible?: boolean;
78
- /** Glow efekti rengi (CSS color değeri) */
79
- glowColor?: string;
80
- /** Glow efekti blur değeri (px) */
81
- glowBlur?: number;
82
- /** Glow efekti spread değeri (px) */
83
- glowSpread?: number;
84
- /** Touch desteği aktif mi? */
85
- enableTouch?: boolean;
86
- /** Klavye desteği aktif mi? */
87
- enableKeyboard?: boolean;
88
- /** Rotasyon eksenleri */
89
- rotateAxes?: {
90
- x?: boolean;
91
- y?: boolean;
92
- };
93
- /** Animasyon başlangıç gecikmesi (ms) */
94
- animationDelay?: number;
95
- /** Hover'da tetiklenecek callback */
96
- onHoverStart?: () => void;
97
- /** Hover bittiğinde tetiklenecek callback */
98
- onHoverEnd?: () => void;
99
- /** Rotasyon değiştiğinde tetiklenecek callback */
100
- onRotationChange?: (rotateX: number, rotateY: number) => void;
101
- /** ARIA label */
102
- ariaLabel?: string;
103
- /** Otomatik odaklanma */
104
- autoFocus?: boolean;
105
- }
106
-
107
- // Varyant bazlı konfigürasyonlar
108
- const variantConfigs = {
109
- subtle: {
110
- maxRotation: 10,
111
- scale: 1.02,
112
- springConfig: { stiffness: 400, damping: 30 },
113
- },
114
- dramatic: {
115
- maxRotation: 25,
116
- scale: 1.1,
117
- springConfig: { stiffness: 200, damping: 20 },
118
- },
119
- gaming: {
120
- maxRotation: 30,
121
- scale: 1.15,
122
- springConfig: { stiffness: 300, damping: 15 },
123
- },
124
- elegant: {
125
- maxRotation: 8,
126
- scale: 1.03,
127
- springConfig: { stiffness: 500, damping: 40 },
128
- },
129
- neon: {
130
- maxRotation: 20,
131
- scale: 1.08,
132
- springConfig: { stiffness: 250, damping: 25 },
133
- },
134
- };
135
-
136
- // Shadow intensity değerleri
137
- const shadowIntensityMap = {
138
- none: "none",
139
- light: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
140
- medium: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
141
- heavy: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
142
- extreme: "0 25px 50px -12px rgb(0 0 0 / 0.25)",
143
- };
144
-
145
- const HoverCard3D = React.forwardRef<HTMLDivElement, HoverCard3DProps>(
146
- (
147
- {
148
- children,
149
- className,
150
- variant = "subtle",
151
- shadowIntensity = "medium",
152
- glowEffect = "none",
153
- maxRotation,
154
- scale,
155
- perspective = 1000,
156
- animationSpeed = 1,
157
- springConfig,
158
- overlay,
159
- overlayAlwaysVisible = false,
160
- glowColor = "rgb(99, 102, 241)",
161
- glowBlur = 20,
162
- glowSpread = 5,
163
- enableTouch = true,
164
- enableKeyboard = true,
165
- rotateAxes = { x: true, y: true },
166
- animationDelay = 0,
167
- onHoverStart,
168
- onHoverEnd,
169
- onRotationChange,
170
- ariaLabel,
171
- autoFocus = false,
172
- ...props
173
- },
174
- ref
175
- ) => {
176
- const cardRef = React.useRef<HTMLDivElement>(null);
177
- const [isHovered, setIsHovered] = React.useState(false);
178
- const [isFocused, setIsFocused] = React.useState(false);
179
-
180
- // Varyant bazlı default değerler
181
- const variantConfig = variantConfigs[variant as keyof typeof variantConfigs] || variantConfigs.subtle;
182
- const finalMaxRotation = maxRotation ?? variantConfig.maxRotation;
183
- const finalScale = scale ?? variantConfig.scale;
184
- const finalSpringConfig = springConfig ?? variantConfig.springConfig;
185
-
186
- // Animasyon hızı faktörü
187
- const speedFactor = Math.max(0.1, Math.min(1, animationSpeed));
188
- const adjustedSpringConfig = {
189
- ...finalSpringConfig,
190
- stiffness: (finalSpringConfig.stiffness || 300) * speedFactor,
191
- damping: (finalSpringConfig.damping || 20) / speedFactor,
192
- };
193
-
194
- const mouseX = useMotionValue(0);
195
- const mouseY = useMotionValue(0);
196
-
197
- // Rotasyon değerleri
198
- const rotateX = useSpring(
199
- useTransform(
200
- mouseY,
201
- [-0.5, 0.5],
202
- rotateAxes.x ? [finalMaxRotation, -finalMaxRotation] : [0, 0]
203
- ),
204
- adjustedSpringConfig
205
- );
206
- const rotateY = useSpring(
207
- useTransform(
208
- mouseX,
209
- [-0.5, 0.5],
210
- rotateAxes.y ? [-finalMaxRotation, finalMaxRotation] : [0, 0]
211
- ),
212
- adjustedSpringConfig
213
- );
214
-
215
- // Rotasyon değişim callback'i
216
- React.useEffect(() => {
217
- if (onRotationChange) {
218
- const unsubscribeX = rotateX.on("change", (x) => {
219
- const y = rotateY.get();
220
- onRotationChange(x, y);
221
- });
222
- const unsubscribeY = rotateY.on("change", (y) => {
223
- const x = rotateX.get();
224
- onRotationChange(x, y);
225
- });
226
-
227
- return () => {
228
- unsubscribeX();
229
- unsubscribeY();
230
- };
231
- }
232
- }, [rotateX, rotateY, onRotationChange]);
233
-
234
- // Mouse/Touch pozisyon hesaplama
235
- const calculatePosition = React.useCallback(
236
- (clientX: number, clientY: number) => {
237
- if (!cardRef.current) return;
238
-
239
- const rect = cardRef.current.getBoundingClientRect();
240
- const width = rect.width;
241
- const height = rect.height;
242
- const x = clientX - rect.left;
243
- const y = clientY - rect.top;
244
-
245
- const xPct = x / width - 0.5;
246
- const yPct = y / height - 0.5;
247
-
248
- mouseX.set(xPct);
249
- mouseY.set(yPct);
250
- },
251
- [mouseX, mouseY]
252
- );
253
-
254
- // Event handler'lar
255
- const handleMouseMove = React.useCallback(
256
- (e: React.MouseEvent<HTMLDivElement>) => {
257
- calculatePosition(e.clientX, e.clientY);
258
- },
259
- [calculatePosition]
260
- );
261
-
262
- const handleTouchMove = React.useCallback(
263
- (e: React.TouchEvent<HTMLDivElement>) => {
264
- if (!enableTouch) return;
265
- const touch = e.touches[0];
266
- calculatePosition(touch.clientX, touch.clientY);
267
- },
268
- [calculatePosition, enableTouch]
269
- );
270
-
271
- const handleMouseEnter = React.useCallback(() => {
272
- setIsHovered(true);
273
- onHoverStart?.();
274
- }, [onHoverStart]);
275
-
276
- const handleMouseLeave = React.useCallback(() => {
277
- mouseX.set(0);
278
- mouseY.set(0);
279
- setIsHovered(false);
280
- onHoverEnd?.();
281
- }, [mouseX, mouseY, onHoverEnd]);
282
-
283
- const handleTouchEnd = React.useCallback(() => {
284
- if (!enableTouch) return;
285
- handleMouseLeave();
286
- }, [handleMouseLeave, enableTouch]);
287
-
288
- // Klavye desteği
289
- const handleKeyDown = React.useCallback(
290
- (e: React.KeyboardEvent<HTMLDivElement>) => {
291
- if (!enableKeyboard) return;
292
-
293
- const step = 0.1;
294
- let newX = mouseX.get();
295
- let newY = mouseY.get();
296
-
297
- switch (e.key) {
298
- case "ArrowUp":
299
- newY = Math.max(-0.5, newY - step);
300
- break;
301
- case "ArrowDown":
302
- newY = Math.min(0.5, newY + step);
303
- break;
304
- case "ArrowLeft":
305
- newX = Math.max(-0.5, newX - step);
306
- break;
307
- case "ArrowRight":
308
- newX = Math.min(0.5, newX + step);
309
- break;
310
- case "Enter":
311
- case " ":
312
- setIsHovered(!isHovered);
313
- if (!isHovered) {
314
- onHoverStart?.();
315
- } else {
316
- onHoverEnd?.();
317
- }
318
- break;
319
- case "Escape":
320
- newX = 0;
321
- newY = 0;
322
- setIsHovered(false);
323
- onHoverEnd?.();
324
- break;
325
- default:
326
- return;
327
- }
328
-
329
- e.preventDefault();
330
- mouseX.set(newX);
331
- mouseY.set(newY);
332
- },
333
- [mouseX, mouseY, isHovered, enableKeyboard, onHoverStart, onHoverEnd]
334
- );
335
-
336
- const handleFocus = React.useCallback(() => {
337
- setIsFocused(true);
338
- }, []);
339
-
340
- const handleBlur = React.useCallback(() => {
341
- setIsFocused(false);
342
- if (!isHovered) {
343
- mouseX.set(0);
344
- mouseY.set(0);
345
- }
346
- }, [mouseX, mouseY, isHovered]);
347
-
348
- // Glow efekti stili
349
- const glowStyle = React.useMemo(() => {
350
- if (glowEffect === "none") return {};
351
-
352
- const intensity = {
353
- subtle: 0.3,
354
- vibrant: 0.6,
355
- neon: 1,
356
- }[glowEffect as string] || 0.3;
357
-
358
- return {
359
- boxShadow: isHovered
360
- ? `0 0 ${glowBlur}px ${glowSpread}px ${glowColor}${Math.round(intensity * 255).toString(16).padStart(2, '0')}`
361
- : undefined,
362
- };
363
- }, [glowEffect, glowColor, glowBlur, glowSpread, isHovered]);
364
-
365
- // Overlay içeriği
366
- const overlayContent = React.useMemo(() => {
367
- if (!overlay) return null;
368
-
369
- if (typeof overlay === "function") {
370
- return overlay({
371
- isHovered,
372
- rotateX: rotateX.get(),
373
- rotateY: rotateY.get(),
374
- });
375
- }
376
-
377
- return overlay;
378
- }, [overlay, isHovered, rotateX, rotateY]);
379
-
380
- return (
381
- <div
382
- ref={ref}
383
- className={cn("relative", className)}
384
- style={{ perspective }}
385
- {...props}
386
- >
387
- <motion.div
388
- ref={cardRef}
389
- className={cn(
390
- hoverCard3DVariants({ variant, shadowIntensity, glowEffect }),
391
- "transition-shadow duration-300",
392
- isFocused && "ring-2 ring-primary ring-offset-2 ring-offset-background"
393
- )}
394
- style={{
395
- rotateX,
396
- rotateY,
397
- transformStyle: "preserve-3d",
398
- boxShadow: shadowIntensityMap[shadowIntensity as keyof typeof shadowIntensityMap],
399
- ...glowStyle,
400
- }}
401
- onMouseMove={handleMouseMove}
402
- onMouseEnter={handleMouseEnter}
403
- onMouseLeave={handleMouseLeave}
404
- onTouchMove={handleTouchMove}
405
- onTouchEnd={handleTouchEnd}
406
- onKeyDown={handleKeyDown}
407
- onFocus={handleFocus}
408
- onBlur={handleBlur}
409
- whileHover={{ scale: finalScale }}
410
- initial={{ scale: 1 }}
411
- transition={{
412
- type: "spring",
413
- delay: animationDelay / 1000,
414
- ...adjustedSpringConfig,
415
- }}
416
- tabIndex={enableKeyboard ? 0 : -1}
417
- role="button"
418
- aria-label={ariaLabel || "3D hover card"}
419
- autoFocus={autoFocus}
420
- >
421
- {/* Overlay katmanı */}
422
- {(overlayAlwaysVisible || isHovered) && overlayContent && (
423
- <div
424
- className="absolute inset-0 rounded-lg pointer-events-none"
425
- style={{
426
- transform: "translateZ(1px)",
427
- }}
428
- >
429
- {overlayContent}
430
- </div>
431
- )}
432
-
433
- {/* Varsayılan highlight efekti */}
434
- {!overlay && variant !== "neon" && (
435
- <div
436
- className={cn(
437
- "absolute inset-0 rounded-lg bg-gradient-to-br from-white/20 to-white/0",
438
- "opacity-0 transition-opacity duration-300 pointer-events-none",
439
- isHovered && "opacity-100"
440
- )}
441
- style={{
442
- transform: "translateZ(1px)",
443
- }}
444
- />
445
- )}
446
-
447
- {/* Neon varyantı için özel efekt */}
448
- {variant === "neon" && (
449
- <div
450
- className={cn(
451
- "absolute inset-0 rounded-lg",
452
- "opacity-0 transition-opacity duration-300 pointer-events-none",
453
- isHovered && "opacity-100"
454
- )}
455
- style={{
456
- transform: "translateZ(2px)",
457
- background: `linear-gradient(45deg, ${glowColor}20, transparent, ${glowColor}20)`,
458
- filter: "blur(10px)",
459
- }}
460
- />
461
- )}
462
-
463
- {children}
464
- </motion.div>
465
- </div>
466
- );
467
- }
468
- );
469
-
470
- HoverCard3D.displayName = "HoverCard3D";
471
-
472
- export { HoverCard3D, hoverCard3DVariants };