@moontra/moonui-pro 2.20.1 → 2.20.2

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 (76) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +4 -3
  4. package/scripts/postbuild.js +27 -0
  5. package/src/components/advanced-chart/index.tsx +5 -1
  6. package/src/components/advanced-forms/index.tsx +175 -16
  7. package/src/components/calendar/event-dialog.tsx +18 -13
  8. package/src/components/calendar/index.tsx +197 -50
  9. package/src/components/dashboard/dashboard-grid.tsx +21 -3
  10. package/src/components/dashboard/types.ts +3 -0
  11. package/src/components/dashboard/widgets/activity-feed.tsx +6 -1
  12. package/src/components/dashboard/widgets/comparison-widget.tsx +177 -0
  13. package/src/components/dashboard/widgets/index.ts +5 -0
  14. package/src/components/dashboard/widgets/metric-card.tsx +21 -1
  15. package/src/components/dashboard/widgets/progress-widget.tsx +113 -0
  16. package/src/components/error-boundary/index.tsx +160 -37
  17. package/src/components/form-wizard/form-wizard-context.tsx +54 -26
  18. package/src/components/form-wizard/form-wizard-progress.tsx +33 -2
  19. package/src/components/form-wizard/types.ts +2 -1
  20. package/src/components/github-stars/hooks.ts +1 -0
  21. package/src/components/github-stars/variants.tsx +3 -1
  22. package/src/components/health-check/index.tsx +14 -14
  23. package/src/components/hover-card-3d/index.tsx +2 -3
  24. package/src/components/index.ts +5 -3
  25. package/src/components/kanban/kanban.tsx +23 -18
  26. package/src/components/license-error/index.tsx +2 -0
  27. package/src/components/magnetic-button/index.tsx +56 -7
  28. package/src/components/memory-efficient-data/index.tsx +117 -115
  29. package/src/components/navbar/index.tsx +781 -0
  30. package/src/components/performance-debugger/index.tsx +62 -38
  31. package/src/components/performance-monitor/index.tsx +47 -33
  32. package/src/components/phone-number-input/index.tsx +32 -27
  33. package/src/components/phone-number-input/phone-number-input-simple.tsx +167 -0
  34. package/src/components/rich-text-editor/index.tsx +26 -28
  35. package/src/components/rich-text-editor/slash-commands-extension.ts +15 -5
  36. package/src/components/sidebar/index.tsx +32 -13
  37. package/src/components/timeline/index.tsx +84 -49
  38. package/src/components/ui/accordion.tsx +550 -42
  39. package/src/components/ui/avatar.tsx +2 -0
  40. package/src/components/ui/badge.tsx +2 -0
  41. package/src/components/ui/breadcrumb.tsx +2 -0
  42. package/src/components/ui/button.tsx +39 -33
  43. package/src/components/ui/card.tsx +2 -0
  44. package/src/components/ui/collapsible.tsx +546 -50
  45. package/src/components/ui/command.tsx +790 -67
  46. package/src/components/ui/dialog.tsx +510 -92
  47. package/src/components/ui/dropdown-menu.tsx +540 -52
  48. package/src/components/ui/index.ts +37 -5
  49. package/src/components/ui/input.tsx +2 -0
  50. package/src/components/ui/magnetic-button.tsx +1 -1
  51. package/src/components/ui/media-gallery.tsx +1 -2
  52. package/src/components/ui/navigation-menu.tsx +130 -0
  53. package/src/components/ui/pagination.tsx +2 -0
  54. package/src/components/ui/select.tsx +6 -2
  55. package/src/components/ui/spotlight-card.tsx +1 -1
  56. package/src/components/ui/table.tsx +2 -0
  57. package/src/components/ui/tabs-pro.tsx +542 -0
  58. package/src/components/ui/tabs.tsx +23 -167
  59. package/src/components/ui/toggle.tsx +12 -12
  60. package/src/index.ts +11 -3
  61. package/src/styles/index.css +596 -0
  62. package/src/use-performance-optimizer.ts +1 -1
  63. package/src/utils/chart-helpers.ts +1 -1
  64. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  65. package/src/__tests__/use-local-storage.test.tsx +0 -174
  66. package/src/__tests__/use-pro-access.test.tsx +0 -183
  67. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  68. package/src/components/data-table/data-table.test.tsx +0 -187
  69. package/src/components/enhanced/badge.tsx +0 -191
  70. package/src/components/enhanced/button.tsx +0 -362
  71. package/src/components/enhanced/card.tsx +0 -266
  72. package/src/components/enhanced/dialog.tsx +0 -246
  73. package/src/components/enhanced/index.ts +0 -4
  74. package/src/components/file-upload/file-upload.test.tsx +0 -243
  75. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  76. package/src/types/moonui.d.ts +0 -22
@@ -3,16 +3,29 @@
3
3
  import * as React from "react";
4
4
  import * as DialogPrimitive from "@radix-ui/react-dialog";
5
5
  import { cva, type VariantProps } from "class-variance-authority";
6
- import { Check, Loader2, X } from "lucide-react";
6
+ import { motion, AnimatePresence } from "framer-motion";
7
+ import { Check, Loader2, X, AlertTriangle, Info, HelpCircle } from "lucide-react";
7
8
 
8
9
  import { cn } from "../../lib/utils";
9
10
 
10
11
  /**
11
- * Premium Dialog Component
12
+ * Premium Dialog Component Pro
12
13
  *
13
- * Modern, accessible and customizable modal dialog component.
14
- * Enhances user experience with variants, sizes and rich features.
15
- * Provides a premium appearance with dark and light mode compatibility and fluid animations.
14
+ * Gelişmiş, erişilebilir ve özelleştirilebilir modal dialog component'i.
15
+ * Kullanıcı deneyimini variants, boyutlar ve zengin özelliklerle geliştirir.
16
+ * Premium görünüm sunar, dark ve light mode uyumlu, akıcı animasyonlar.
17
+ *
18
+ * Pro Özellikler:
19
+ * - Gelişmiş animasyon seçenekleri (bounce, elastic, spring, rotate)
20
+ * - Stacked dialog desteği (birden fazla dialog)
21
+ * - Confirmation dialog presets (silme, kaydet, çıkış onayları)
22
+ * - Form validation desteği ve otomatik hata yönetimi
23
+ * - Responsive breakpoint davranışları
24
+ * - Glass, gradient ve neon visual variants
25
+ * - Custom backdrop effects ve blur seçenekleri
26
+ * - Spring physics ile gelişmiş animasyonlar
27
+ * - Accessibility improvements ve keyboard navigation
28
+ * - Auto-close prevention ve confirmation prompts
16
29
  */
17
30
 
18
31
  const MoonUIDialogPro = DialogPrimitive.Root;
@@ -21,23 +34,34 @@ const MoonUIDialogPortal = DialogPrimitive.Portal;
21
34
  const MoonUIDialogClosePro = DialogPrimitive.Close;
22
35
 
23
36
  const overlayVariants = cva(
24
- "fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
37
+ "fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
38
  {
26
39
  variants: {
27
40
  variant: {
28
- default: "bg-black/80",
29
- subtle: "bg-black/60",
41
+ default: "bg-black/80 backdrop-blur-sm",
42
+ subtle: "bg-black/60 backdrop-blur-sm",
30
43
  blur: "bg-black/40 backdrop-blur-md",
31
44
  minimal: "bg-black/20 backdrop-blur-sm",
45
+ gradient: "bg-gradient-to-br from-black/80 via-purple-900/20 to-black/80 backdrop-blur-md",
46
+ dark: "bg-black/90 backdrop-blur-lg",
47
+ },
48
+ blurAmount: {
49
+ none: "",
50
+ sm: "backdrop-blur-sm",
51
+ md: "backdrop-blur-md",
52
+ lg: "backdrop-blur-lg",
53
+ xl: "backdrop-blur-xl",
32
54
  },
33
55
  animation: {
34
56
  default: "duration-200",
35
57
  slow: "duration-300",
36
58
  fast: "duration-100",
59
+ spring: "duration-500",
37
60
  },
38
61
  },
39
62
  defaultVariants: {
40
63
  variant: "default",
64
+ blurAmount: "sm",
41
65
  animation: "default",
42
66
  },
43
67
  }
@@ -45,15 +69,22 @@ const overlayVariants = cva(
45
69
 
46
70
  interface DialogOverlayProps
47
71
  extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>,
48
- VariantProps<typeof overlayVariants> {}
72
+ VariantProps<typeof overlayVariants> {
73
+ /** Custom backdrop effects */
74
+ customBackdrop?: boolean;
75
+ }
49
76
 
50
77
  const MoonUIDialogOverlayPro = React.forwardRef<
51
78
  React.ElementRef<typeof DialogPrimitive.Overlay>,
52
79
  DialogOverlayProps
53
- >(({ className, variant, animation, ...props }, ref) => (
80
+ >(({ className, variant, blurAmount, animation, customBackdrop = false, ...props }, ref) => (
54
81
  <DialogPrimitive.Overlay
55
82
  ref={ref}
56
- className={cn(overlayVariants({ variant, animation }), className)}
83
+ className={cn(
84
+ overlayVariants({ variant, blurAmount, animation }),
85
+ customBackdrop && "before:absolute before:inset-0 before:bg-gradient-to-br before:from-transparent before:via-primary/10 before:to-transparent",
86
+ className
87
+ )}
57
88
  {...props}
58
89
  />
59
90
  ));
@@ -64,20 +95,28 @@ const dialogContentVariants = cva(
64
95
  {
65
96
  variants: {
66
97
  variant: {
67
- default: "border-gray-200 dark:border-gray-700",
68
- primary: "border-primary/20 dark:border-primary/30",
69
- secondary: "border-gray-300 dark:border-gray-600",
70
- ghost: "border-transparent shadow-xl",
71
- destructive: "border-error/20 dark:border-error/30",
98
+ default: "border-gray-200 dark:border-gray-700 bg-background",
99
+ primary: "border-primary/20 dark:border-primary/30 bg-background",
100
+ secondary: "border-gray-300 dark:border-gray-600 bg-background",
101
+ ghost: "border-transparent shadow-xl bg-background",
102
+ destructive: "border-error/20 dark:border-error/30 bg-background",
103
+ glass: "border-white/10 dark:border-white/10 bg-white/5 dark:bg-black/5 backdrop-blur-xl shadow-2xl",
104
+ gradient: "border-0 bg-gradient-to-br from-background/90 via-primary/5 to-background/90 backdrop-blur-md shadow-2xl",
105
+ neon: "border-2 border-primary/50 bg-background shadow-[0_0_20px_rgba(59,130,246,0.3)] dark:shadow-[0_0_20px_rgba(59,130,246,0.5)]",
72
106
  },
73
107
  size: {
74
- xs: "max-w-xs p-4",
75
- sm: "max-w-sm p-5",
76
- default: "max-w-lg p-6",
77
- md: "max-w-md p-6",
78
- lg: "max-w-2xl p-7",
79
- xl: "max-w-4xl p-8",
108
+ xs: "max-w-[280px] p-3",
109
+ sm: "max-w-[360px] p-4",
110
+ md: "max-w-[480px] p-5",
111
+ default: "max-w-[520px] p-6",
112
+ lg: "max-w-[680px] p-6",
113
+ xl: "max-w-[860px] p-8",
114
+ "2xl": "max-w-[1024px] p-8",
115
+ "3xl": "max-w-[1280px] p-10",
116
+ "4xl": "max-w-[1536px] p-10",
80
117
  full: "max-w-[95vw] max-h-[95vh] p-6",
118
+ fullscreen: "w-screen h-screen max-w-none max-h-none rounded-none p-8",
119
+ responsive: "max-w-[95vw] sm:max-w-[480px] md:max-w-[640px] lg:max-w-[768px] xl:max-w-[1024px] p-4 sm:p-6",
81
120
  },
82
121
  radius: {
83
122
  none: "rounded-none",
@@ -88,17 +127,28 @@ const dialogContentVariants = cva(
88
127
  full: "rounded-3xl",
89
128
  },
90
129
  animation: {
91
- default:
92
- "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
93
- fade: "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
94
- zoom: "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
95
- slide: "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
130
+ // Framer Motion kullanıldığında CSS animasyonları devre dışı
131
+ default: "",
132
+ fade: "",
133
+ zoom: "",
134
+ slide: "",
135
+ slideUp: "",
136
+ slideLeft: "",
137
+ slideRight: "",
138
+ bounce: "",
139
+ rotate: "",
140
+ rotateScale: "",
141
+ elastic: "",
142
+ spring: "",
143
+ flip: "",
144
+ swirl: "",
96
145
  none: "",
97
146
  },
98
147
  position: {
99
148
  default: "top-[50%]",
100
149
  top: "top-[5%]",
101
150
  bottom: "bottom-[5%] top-auto translate-y-0",
151
+ center: "top-[50%]",
102
152
  },
103
153
  },
104
154
  defaultVariants: {
@@ -118,6 +168,8 @@ interface MoonUIDialogContentProProps
118
168
  hideCloseButton?: boolean;
119
169
  /** Overlay varyantı */
120
170
  overlayVariant?: VariantProps<typeof overlayVariants>["variant"];
171
+ /** Overlay blur miktarı */
172
+ overlayBlur?: VariantProps<typeof overlayVariants>["blurAmount"];
121
173
  /** Overlay animasyonu */
122
174
  overlayAnimation?: VariantProps<typeof overlayVariants>["animation"];
123
175
  /** İçerik başlığı (hızlı kullanım için) */
@@ -132,6 +184,22 @@ interface MoonUIDialogContentProProps
132
184
  success?: boolean;
133
185
  /** Özel onClose handler */
134
186
  onClose?: () => void;
187
+ /** Animasyon süresi (saniye) */
188
+ animationDuration?: number;
189
+ /** Spring physics animasyonları etkinleştir */
190
+ enableSpringPhysics?: boolean;
191
+ /** Stack edilmiş dialog desteği için z-index */
192
+ stackLevel?: number;
193
+ /** Confirmation dialog türü */
194
+ confirmationType?: 'info' | 'warning' | 'error' | 'success';
195
+ /** Form validation desteği için */
196
+ hasFormValidation?: boolean;
197
+ /** Responsive breakpoint davranışı */
198
+ responsive?: boolean;
199
+ /** Custom backdrop effects */
200
+ customBackdrop?: boolean;
201
+ /** Close animasyonu */
202
+ closeAnimation?: boolean;
135
203
  }
136
204
 
137
205
  const MoonUIDialogContentPro = React.forwardRef<
@@ -148,6 +216,7 @@ const MoonUIDialogContentPro = React.forwardRef<
148
216
  animation,
149
217
  position,
150
218
  overlayVariant = "default",
219
+ overlayBlur = "sm",
151
220
  overlayAnimation = "default",
152
221
  hideCloseButton = false,
153
222
  title,
@@ -156,23 +225,221 @@ const MoonUIDialogContentPro = React.forwardRef<
156
225
  loading = false,
157
226
  success = false,
158
227
  onClose,
228
+ animationDuration = 0.2,
229
+ enableSpringPhysics = false,
230
+ stackLevel = 0,
231
+ confirmationType,
232
+ hasFormValidation = false,
233
+ responsive = true,
234
+ customBackdrop = false,
235
+ closeAnimation = true,
159
236
  ...props
160
237
  },
161
238
  ref
162
239
  ) => {
163
- // Capturing the close function through the Radix Dialog API
164
- const handleClose = () => {
240
+ const [isClosing, setIsClosing] = React.useState(false);
241
+
242
+ // Stack edilmiş dialog'lar için z-index hesaplama
243
+ const zIndex = 50 + stackLevel * 10;
244
+
245
+ // Confirmation dialog presets
246
+ const getConfirmationIcon = () => {
247
+ switch (confirmationType) {
248
+ case 'info':
249
+ return <Info className="h-5 w-5 text-blue-500" />;
250
+ case 'warning':
251
+ return <AlertTriangle className="h-5 w-5 text-yellow-500" />;
252
+ case 'error':
253
+ return <AlertTriangle className="h-5 w-5 text-red-500" />;
254
+ case 'success':
255
+ return <Check className="h-5 w-5 text-green-500" />;
256
+ default:
257
+ return null;
258
+ }
259
+ };
260
+
261
+ // Animasyon variants for framer-motion
262
+ const getAnimationVariants = () => {
263
+ const duration = animationDuration;
264
+ const springConfig = enableSpringPhysics ? {
265
+ type: "spring",
266
+ stiffness: 300,
267
+ damping: 30
268
+ } : {
269
+ type: "tween",
270
+ duration
271
+ };
272
+
273
+ // Debug logs
274
+ if (process.env.NODE_ENV === 'development') {
275
+ console.log('Dialog Animation Debug:', {
276
+ animation,
277
+ duration,
278
+ enableSpringPhysics,
279
+ springConfig
280
+ });
281
+ }
282
+
283
+ switch (animation) {
284
+ case 'bounce':
285
+ return {
286
+ initial: { scale: 0.8, opacity: 0 },
287
+ animate: {
288
+ scale: 1,
289
+ opacity: 1,
290
+ transition: {
291
+ scale: {
292
+ type: "spring",
293
+ stiffness: 300,
294
+ damping: 10,
295
+ restDelta: 0.001
296
+ }
297
+ }
298
+ },
299
+ exit: { scale: 0.8, opacity: 0 },
300
+ transition: { duration: duration * 1.2 }
301
+ };
302
+ case 'zoom':
303
+ return {
304
+ initial: { scale: 0, opacity: 0 },
305
+ animate: { scale: 1, opacity: 1 },
306
+ exit: { scale: 0, opacity: 0 },
307
+ transition: { ...springConfig, duration: duration * 0.8 }
308
+ };
309
+ case 'fade':
310
+ return {
311
+ initial: { opacity: 0 },
312
+ animate: { opacity: 1 },
313
+ exit: { opacity: 0 },
314
+ transition: { duration }
315
+ };
316
+ case 'slide':
317
+ return {
318
+ initial: { opacity: 0, translateY: 100 },
319
+ animate: { opacity: 1, translateY: 0 },
320
+ exit: { opacity: 0, translateY: 100 },
321
+ transition: springConfig
322
+ };
323
+ case 'rotate':
324
+ return {
325
+ initial: { scale: 0.8, opacity: 0, rotate: -10 },
326
+ animate: { scale: 1, opacity: 1, rotate: 0 },
327
+ exit: { scale: 0.8, opacity: 0, rotate: 10 },
328
+ transition: springConfig
329
+ };
330
+ case 'elastic':
331
+ return {
332
+ initial: { scale: 0.3, opacity: 0 },
333
+ animate: { scale: 1, opacity: 1 },
334
+ exit: { scale: 0.3, opacity: 0 },
335
+ transition: {
336
+ type: "spring",
337
+ stiffness: 400,
338
+ damping: 15
339
+ }
340
+ };
341
+ case 'spring':
342
+ return {
343
+ initial: { scale: 0.9, opacity: 0, translateY: 20 },
344
+ animate: { scale: 1, opacity: 1, translateY: 0 },
345
+ exit: { scale: 0.9, opacity: 0, translateY: 20 },
346
+ transition: {
347
+ type: "spring",
348
+ stiffness: 500,
349
+ damping: 25
350
+ }
351
+ };
352
+ case 'slideUp':
353
+ return {
354
+ initial: { opacity: 0, translateY: -100 },
355
+ animate: { opacity: 1, translateY: 0 },
356
+ exit: { opacity: 0, translateY: -100 },
357
+ transition: springConfig
358
+ };
359
+ case 'slideLeft':
360
+ return {
361
+ initial: { opacity: 0, translateX: -100 },
362
+ animate: { opacity: 1, translateX: 0 },
363
+ exit: { opacity: 0, translateX: -100 },
364
+ transition: springConfig
365
+ };
366
+ case 'slideRight':
367
+ return {
368
+ initial: { opacity: 0, translateX: 100 },
369
+ animate: { opacity: 1, translateX: 0 },
370
+ exit: { opacity: 0, translateX: 100 },
371
+ transition: springConfig
372
+ };
373
+ case 'flip':
374
+ return {
375
+ initial: { rotateX: -90, opacity: 0 },
376
+ animate: { rotateX: 0, opacity: 1 },
377
+ exit: { rotateX: 90, opacity: 0 },
378
+ transition: { ...springConfig, duration: duration * 1.2 }
379
+ };
380
+ case 'swirl':
381
+ return {
382
+ initial: { rotate: -540, scale: 0, opacity: 0 },
383
+ animate: { rotate: 0, scale: 1, opacity: 1 },
384
+ exit: { rotate: 540, scale: 0, opacity: 0 },
385
+ transition: { ...springConfig, duration: duration * 1.5 }
386
+ };
387
+ case 'rotateScale':
388
+ return {
389
+ initial: { rotate: -90, scale: 0, opacity: 0 },
390
+ animate: { rotate: 0, scale: 1, opacity: 1 },
391
+ exit: { rotate: 90, scale: 0, opacity: 0 },
392
+ transition: springConfig
393
+ };
394
+ default:
395
+ return {
396
+ initial: { scale: 0.95, opacity: 0 },
397
+ animate: { scale: 1, opacity: 1 },
398
+ exit: { scale: 0.95, opacity: 0 },
399
+ transition: springConfig
400
+ };
401
+ }
402
+ };
403
+
404
+ // Close handler with animation
405
+ const handleClose = async () => {
406
+ if (closeAnimation) {
407
+ setIsClosing(true);
408
+ // Animasyon süresini bekle
409
+ await new Promise(resolve => setTimeout(resolve, animationDuration * 1000));
410
+ }
165
411
  if (onClose) {
166
412
  onClose();
167
413
  }
168
414
  };
415
+
416
+ const animationVariants = getAnimationVariants();
417
+ const displayIcon = confirmationType ? getConfirmationIcon() : icon;
418
+
419
+ // Debug log
420
+ React.useEffect(() => {
421
+ if (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
422
+ console.log('🎭 Dialog Animation Debug:', {
423
+ animation,
424
+ size,
425
+ variant,
426
+ enableSpringPhysics,
427
+ animationVariants,
428
+ hasAnimation: !!animation,
429
+ animationType: typeof animation
430
+ });
431
+ }
432
+ }, [animation, size, variant, enableSpringPhysics]);
169
433
 
170
434
  return (
171
435
  <MoonUIDialogPortal>
172
436
  <MoonUIDialogOverlayPro
173
437
  variant={overlayVariant}
438
+ blurAmount={overlayBlur}
174
439
  animation={overlayAnimation}
440
+ customBackdrop={customBackdrop}
175
441
  onClick={hideCloseButton ? undefined : handleClose}
442
+ style={{ zIndex }}
176
443
  />
177
444
  <DialogPrimitive.Content
178
445
  ref={ref}
@@ -180,64 +447,119 @@ const MoonUIDialogContentPro = React.forwardRef<
180
447
  onInteractOutside={
181
448
  hideCloseButton ? undefined : handleClose
182
449
  }
183
- className={cn(
184
- dialogContentVariants({
185
- variant,
186
- size,
187
- radius,
188
- animation,
189
- position,
190
- }),
191
- "outline-none",
192
- loading && "pointer-events-none",
193
- success && "border-success/40",
194
- className
195
- )}
450
+ className="outline-none"
196
451
  {...props}
452
+ asChild
197
453
  >
198
- {/* Başlık ve açıklama varsa otomatik olarak DialogHeader oluştur */}
199
- {(title || description || icon) && (
200
- <MoonUIDialogHeaderPro className="flex gap-4">
201
- {/* İkon veya loading/success durumları */}
202
- {(icon || loading || success) && (
203
- <div className="flex shrink-0 items-center justify-center">
204
- {loading && (
205
- <Loader2 className="h-5 w-5 animate-spin text-primary" />
206
- )}
207
- {success && (
208
- <Check className="h-5 w-5 text-success" />
454
+ <motion.div
455
+ initial={{
456
+ ...animationVariants.initial,
457
+ x: "-50%",
458
+ y: "-50%"
459
+ }}
460
+ animate={{
461
+ ...animationVariants.animate,
462
+ x: "-50%",
463
+ y: "-50%"
464
+ }}
465
+ exit={{
466
+ ...animationVariants.exit,
467
+ x: "-50%",
468
+ y: "-50%"
469
+ }}
470
+ transition={animationVariants.transition}
471
+ style={{
472
+ zIndex: zIndex + 1,
473
+ position: 'fixed',
474
+ left: '50%',
475
+ top: '50%'
476
+ }}
477
+ className={cn(
478
+ dialogContentVariants({
479
+ variant: confirmationType ?
480
+ (confirmationType === 'error' ? 'destructive' :
481
+ confirmationType === 'success' ? 'primary' : variant) : variant,
482
+ size: responsive ? (typeof window !== 'undefined' && window.innerWidth < 640 ? 'full' : size) : size,
483
+ radius,
484
+ animation: 'none', // Framer Motion handles animation
485
+ position,
486
+ }),
487
+ "outline-none",
488
+ loading && "pointer-events-none",
489
+ success && "border-success/40",
490
+ hasFormValidation && "pb-2", // Extra space for validation messages
491
+ isClosing && "pointer-events-none",
492
+ className
493
+ )}
494
+ >
495
+ {/* Auto-generated header for quick usage */}
496
+ {(title || description || displayIcon || loading || success) && (
497
+ <MoonUIDialogHeaderPro className={cn(
498
+ "flex gap-4",
499
+ confirmationType && "items-start"
500
+ )}>
501
+ {/* Icon or status indicators */}
502
+ {(displayIcon || loading || success) && (
503
+ <div className="flex shrink-0 items-center justify-center">
504
+ {loading && (
505
+ <Loader2 className="h-5 w-5 animate-spin text-primary" />
506
+ )}
507
+ {success && !loading && (
508
+ <Check className="h-5 w-5 text-success" />
509
+ )}
510
+ {!loading && !success && displayIcon && (
511
+ <span className={cn(
512
+ confirmationType ? "" : "text-primary"
513
+ )}>
514
+ {displayIcon}
515
+ </span>
516
+ )}
517
+ </div>
518
+ )}
519
+ <div className="flex-1">
520
+ {title && (
521
+ <MoonUIDialogTitlePro className={cn(
522
+ confirmationType === 'error' && "text-red-600 dark:text-red-400",
523
+ confirmationType === 'warning' && "text-yellow-600 dark:text-yellow-400",
524
+ confirmationType === 'success' && "text-green-600 dark:text-green-400",
525
+ confirmationType === 'info' && "text-blue-600 dark:text-blue-400"
526
+ )}>
527
+ {title}
528
+ </MoonUIDialogTitlePro>
209
529
  )}
210
- {!loading && !success && icon && (
211
- <span className="text-primary">
212
- {icon}
213
- </span>
530
+ {description && (
531
+ <MoonUIDialogDescriptionPro>
532
+ {description}
533
+ </MoonUIDialogDescriptionPro>
214
534
  )}
215
535
  </div>
216
- )}
217
- <div className="flex-1">
218
- {title && <MoonUIDialogTitlePro>{title}</MoonUIDialogTitlePro>}
219
- {description && (
220
- <MoonUIDialogDescriptionPro>
221
- {description}
222
- </MoonUIDialogDescriptionPro>
223
- )}
224
- </div>
225
- </MoonUIDialogHeaderPro>
226
- )}
536
+ </MoonUIDialogHeaderPro>
537
+ )}
227
538
 
228
- {/* Main content */}
229
- {children}
539
+ {/* Main content */}
540
+ {children}
541
+
542
+ {/* Form validation messages area */}
543
+ {hasFormValidation && (
544
+ <div id="dialog-validation-messages" className="mt-2 min-h-[20px]" />
545
+ )}
230
546
 
231
- {/* Close button */}
232
- {!hideCloseButton && (
233
- <DialogPrimitive.Close
234
- onClick={handleClose}
235
- className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:ring-offset-2 disabled:pointer-events-none dark:text-gray-300 dark:hover:text-white"
236
- >
237
- <X className="h-4 w-4" />
238
- <span className="sr-only">Close</span>
239
- </DialogPrimitive.Close>
240
- )}
547
+ {/* Close button */}
548
+ {!hideCloseButton && (
549
+ <DialogPrimitive.Close
550
+ onClick={handleClose}
551
+ className={cn(
552
+ "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-all duration-200",
553
+ "hover:opacity-100 hover:scale-110 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:ring-offset-2",
554
+ "disabled:pointer-events-none dark:text-gray-300 dark:hover:text-white",
555
+ isClosing && "opacity-0 pointer-events-none"
556
+ )}
557
+ >
558
+ <X className="h-4 w-4" />
559
+ <span className="sr-only">Close</span>
560
+ </DialogPrimitive.Close>
561
+ )}
562
+ </motion.div>
241
563
  </DialogPrimitive.Content>
242
564
  </MoonUIDialogPortal>
243
565
  );
@@ -309,17 +631,96 @@ MoonUIDialogDescriptionPro.displayName = DialogPrimitive.Description.displayName
309
631
  */
310
632
  const MoonUIDialogFormPro = React.forwardRef<
311
633
  HTMLFormElement,
312
- React.HTMLAttributes<HTMLFormElement>
313
- >(({ className, ...props }, ref) => (
314
- <form
315
- ref={ref}
316
- className={cn("flex flex-col gap-4", className)}
317
- {...props}
318
- />
319
- ));
320
- MoonUIDialogFormPro.displayName = "DialogForm";
634
+ React.HTMLAttributes<HTMLFormElement> & {
635
+ /** Form validation enabled */
636
+ enableValidation?: boolean;
637
+ /** Form submission handler */
638
+ onSubmit?: (e: React.FormEvent) => void | Promise<void>;
639
+ /** Loading state during form submission */
640
+ isSubmitting?: boolean;
641
+ }
642
+ >(({ className, enableValidation = false, onSubmit, isSubmitting = false, ...props }, ref) => {
643
+ const handleSubmit = async (e: React.FormEvent) => {
644
+ e.preventDefault();
645
+ if (onSubmit && !isSubmitting) {
646
+ await onSubmit(e);
647
+ }
648
+ };
649
+
650
+ return (
651
+ <form
652
+ ref={ref}
653
+ className={cn(
654
+ "flex flex-col gap-4",
655
+ isSubmitting && "pointer-events-none opacity-75",
656
+ className
657
+ )}
658
+ onSubmit={handleSubmit}
659
+ noValidate={!enableValidation}
660
+ {...props}
661
+ />
662
+ );
663
+ });
664
+ MoonUIDialogFormPro.displayName = "MoonUIDialogFormPro";
321
665
 
322
- export { MoonUIDialogPro,
666
+ /**
667
+ * Confirmation Dialog Presets - Hazır dialog türleri
668
+ */
669
+ const confirmationPresets = {
670
+ deleteConfirmation: {
671
+ confirmationType: 'error' as const,
672
+ title: 'Silme Onayı',
673
+ description: 'Bu işlem geri alınamaz. Devam etmek istediğinizden emin misiniz?',
674
+ variant: 'destructive' as const,
675
+ },
676
+ saveConfirmation: {
677
+ confirmationType: 'info' as const,
678
+ title: 'Değişiklikleri Kaydet',
679
+ description: 'Yaptığınız değişiklikler kaydedilecek. Onaylıyor musunuz?',
680
+ variant: 'primary' as const,
681
+ },
682
+ exitConfirmation: {
683
+ confirmationType: 'warning' as const,
684
+ title: 'Çıkış Onayı',
685
+ description: 'Kaydedilmemiş değişiklikleriniz kaybolacak. Çıkmak istediğinizden emin misiniz?',
686
+ variant: 'secondary' as const,
687
+ },
688
+ successNotification: {
689
+ confirmationType: 'success' as const,
690
+ title: 'İşlem Başarılı',
691
+ description: 'İşleminiz başarıyla tamamlandı.',
692
+ variant: 'primary' as const,
693
+ }
694
+ };
695
+
696
+ /**
697
+ * Stacked Dialog Hook - Birden fazla dialog yönetimi
698
+ */
699
+ const useStackedDialog = () => {
700
+ const [dialogStack, setDialogStack] = React.useState<string[]>([]);
701
+
702
+ const pushDialog = (id: string) => {
703
+ setDialogStack(prev => [...prev, id]);
704
+ };
705
+
706
+ const popDialog = (id: string) => {
707
+ setDialogStack(prev => prev.filter(dialogId => dialogId !== id));
708
+ };
709
+
710
+ const getStackLevel = (id: string) => {
711
+ return dialogStack.indexOf(id);
712
+ };
713
+
714
+ return {
715
+ pushDialog,
716
+ popDialog,
717
+ getStackLevel,
718
+ stackCount: dialogStack.length
719
+ };
720
+ };
721
+
722
+ export {
723
+ MoonUIDialogPro,
323
724
  MoonUIDialogTriggerPro,
324
725
  MoonUIDialogContentPro,
325
726
  MoonUIDialogHeaderPro,
@@ -328,7 +729,24 @@ export { MoonUIDialogPro,
328
729
  MoonUIDialogDescriptionPro,
329
730
  MoonUIDialogClosePro,
330
731
  MoonUIDialogFormPro,
331
- };
732
+ confirmationPresets,
733
+ useStackedDialog,
734
+ type MoonUIDialogContentProProps,
735
+ type DialogOverlayProps
736
+ };
332
737
 
333
738
  // Backward compatibility exports
334
- export { MoonUIDialogPro as Dialog, MoonUIDialogContentPro as DialogContent, MoonUIDialogHeaderPro as DialogHeader, MoonUIDialogFooterPro as DialogFooter, MoonUIDialogTitlePro as DialogTitle, MoonUIDialogDescriptionPro as DialogDescription, MoonUIDialogTriggerPro as DialogTrigger, MoonUIDialogClosePro as DialogClose };
739
+ export {
740
+ MoonUIDialogPro as Dialog,
741
+ MoonUIDialogContentPro as DialogContent,
742
+ MoonUIDialogHeaderPro as DialogHeader,
743
+ MoonUIDialogFooterPro as DialogFooter,
744
+ MoonUIDialogTitlePro as DialogTitle,
745
+ MoonUIDialogDescriptionPro as DialogDescription,
746
+ MoonUIDialogTriggerPro as DialogTrigger,
747
+ MoonUIDialogClosePro as DialogClose,
748
+ MoonUIDialogFormPro as DialogForm
749
+ };
750
+
751
+ // Export hook for easy access
752
+ export { useStackedDialog as useDialogStack };