@moontra/moonui-pro 2.20.2 → 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.
- package/package.json +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +176 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -480
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -77
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -517
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1689
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -884
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1183
- package/src/components/ui/accordion.tsx +0 -581
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -222
- package/src/components/ui/input.tsx +0 -224
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -378
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -22
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,752 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
-
import { motion, AnimatePresence } from "framer-motion";
|
|
7
|
-
import { Check, Loader2, X, AlertTriangle, Info, HelpCircle } from "lucide-react";
|
|
8
|
-
|
|
9
|
-
import { cn } from "../../lib/utils";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Premium Dialog Component Pro
|
|
13
|
-
*
|
|
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
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const MoonUIDialogPro = DialogPrimitive.Root;
|
|
32
|
-
const MoonUIDialogTriggerPro = DialogPrimitive.Trigger;
|
|
33
|
-
const MoonUIDialogPortal = DialogPrimitive.Portal;
|
|
34
|
-
const MoonUIDialogClosePro = DialogPrimitive.Close;
|
|
35
|
-
|
|
36
|
-
const overlayVariants = cva(
|
|
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",
|
|
38
|
-
{
|
|
39
|
-
variants: {
|
|
40
|
-
variant: {
|
|
41
|
-
default: "bg-black/80 backdrop-blur-sm",
|
|
42
|
-
subtle: "bg-black/60 backdrop-blur-sm",
|
|
43
|
-
blur: "bg-black/40 backdrop-blur-md",
|
|
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",
|
|
54
|
-
},
|
|
55
|
-
animation: {
|
|
56
|
-
default: "duration-200",
|
|
57
|
-
slow: "duration-300",
|
|
58
|
-
fast: "duration-100",
|
|
59
|
-
spring: "duration-500",
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
defaultVariants: {
|
|
63
|
-
variant: "default",
|
|
64
|
-
blurAmount: "sm",
|
|
65
|
-
animation: "default",
|
|
66
|
-
},
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
interface DialogOverlayProps
|
|
71
|
-
extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>,
|
|
72
|
-
VariantProps<typeof overlayVariants> {
|
|
73
|
-
/** Custom backdrop effects */
|
|
74
|
-
customBackdrop?: boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const MoonUIDialogOverlayPro = React.forwardRef<
|
|
78
|
-
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
79
|
-
DialogOverlayProps
|
|
80
|
-
>(({ className, variant, blurAmount, animation, customBackdrop = false, ...props }, ref) => (
|
|
81
|
-
<DialogPrimitive.Overlay
|
|
82
|
-
ref={ref}
|
|
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
|
-
)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
));
|
|
91
|
-
MoonUIDialogOverlayPro.displayName = DialogPrimitive.Overlay.displayName;
|
|
92
|
-
|
|
93
|
-
const dialogContentVariants = cva(
|
|
94
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg",
|
|
95
|
-
{
|
|
96
|
-
variants: {
|
|
97
|
-
variant: {
|
|
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)]",
|
|
106
|
-
},
|
|
107
|
-
size: {
|
|
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",
|
|
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",
|
|
120
|
-
},
|
|
121
|
-
radius: {
|
|
122
|
-
none: "rounded-none",
|
|
123
|
-
sm: "rounded-md",
|
|
124
|
-
default: "rounded-lg",
|
|
125
|
-
lg: "rounded-xl",
|
|
126
|
-
xl: "rounded-2xl",
|
|
127
|
-
full: "rounded-3xl",
|
|
128
|
-
},
|
|
129
|
-
animation: {
|
|
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: "",
|
|
145
|
-
none: "",
|
|
146
|
-
},
|
|
147
|
-
position: {
|
|
148
|
-
default: "top-[50%]",
|
|
149
|
-
top: "top-[5%]",
|
|
150
|
-
bottom: "bottom-[5%] top-auto translate-y-0",
|
|
151
|
-
center: "top-[50%]",
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
defaultVariants: {
|
|
155
|
-
variant: "default",
|
|
156
|
-
size: "default",
|
|
157
|
-
radius: "default",
|
|
158
|
-
animation: "default",
|
|
159
|
-
position: "default",
|
|
160
|
-
},
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
interface MoonUIDialogContentProProps
|
|
165
|
-
extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'title'>,
|
|
166
|
-
VariantProps<typeof dialogContentVariants> {
|
|
167
|
-
/** X butonunu gizle */
|
|
168
|
-
hideCloseButton?: boolean;
|
|
169
|
-
/** Overlay varyantı */
|
|
170
|
-
overlayVariant?: VariantProps<typeof overlayVariants>["variant"];
|
|
171
|
-
/** Overlay blur miktarı */
|
|
172
|
-
overlayBlur?: VariantProps<typeof overlayVariants>["blurAmount"];
|
|
173
|
-
/** Overlay animasyonu */
|
|
174
|
-
overlayAnimation?: VariantProps<typeof overlayVariants>["animation"];
|
|
175
|
-
/** İçerik başlığı (hızlı kullanım için) */
|
|
176
|
-
title?: React.ReactNode;
|
|
177
|
-
/** İçerik açıklaması (hızlı kullanım için) */
|
|
178
|
-
description?: React.ReactNode;
|
|
179
|
-
/** Başlık ikonu */
|
|
180
|
-
icon?: React.ReactNode;
|
|
181
|
-
/** Yükleniyor durumu */
|
|
182
|
-
loading?: boolean;
|
|
183
|
-
/** Success durumu */
|
|
184
|
-
success?: boolean;
|
|
185
|
-
/** Özel onClose handler */
|
|
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;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const MoonUIDialogContentPro = React.forwardRef<
|
|
206
|
-
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
207
|
-
MoonUIDialogContentProProps
|
|
208
|
-
>(
|
|
209
|
-
(
|
|
210
|
-
{
|
|
211
|
-
className,
|
|
212
|
-
children,
|
|
213
|
-
variant,
|
|
214
|
-
size,
|
|
215
|
-
radius,
|
|
216
|
-
animation,
|
|
217
|
-
position,
|
|
218
|
-
overlayVariant = "default",
|
|
219
|
-
overlayBlur = "sm",
|
|
220
|
-
overlayAnimation = "default",
|
|
221
|
-
hideCloseButton = false,
|
|
222
|
-
title,
|
|
223
|
-
description,
|
|
224
|
-
icon,
|
|
225
|
-
loading = false,
|
|
226
|
-
success = false,
|
|
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,
|
|
236
|
-
...props
|
|
237
|
-
},
|
|
238
|
-
ref
|
|
239
|
-
) => {
|
|
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
|
-
}
|
|
411
|
-
if (onClose) {
|
|
412
|
-
onClose();
|
|
413
|
-
}
|
|
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]);
|
|
433
|
-
|
|
434
|
-
return (
|
|
435
|
-
<MoonUIDialogPortal>
|
|
436
|
-
<MoonUIDialogOverlayPro
|
|
437
|
-
variant={overlayVariant}
|
|
438
|
-
blurAmount={overlayBlur}
|
|
439
|
-
animation={overlayAnimation}
|
|
440
|
-
customBackdrop={customBackdrop}
|
|
441
|
-
onClick={hideCloseButton ? undefined : handleClose}
|
|
442
|
-
style={{ zIndex }}
|
|
443
|
-
/>
|
|
444
|
-
<DialogPrimitive.Content
|
|
445
|
-
ref={ref}
|
|
446
|
-
onEscapeKeyDown={hideCloseButton ? undefined : handleClose}
|
|
447
|
-
onInteractOutside={
|
|
448
|
-
hideCloseButton ? undefined : handleClose
|
|
449
|
-
}
|
|
450
|
-
className="outline-none"
|
|
451
|
-
{...props}
|
|
452
|
-
asChild
|
|
453
|
-
>
|
|
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>
|
|
529
|
-
)}
|
|
530
|
-
{description && (
|
|
531
|
-
<MoonUIDialogDescriptionPro>
|
|
532
|
-
{description}
|
|
533
|
-
</MoonUIDialogDescriptionPro>
|
|
534
|
-
)}
|
|
535
|
-
</div>
|
|
536
|
-
</MoonUIDialogHeaderPro>
|
|
537
|
-
)}
|
|
538
|
-
|
|
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
|
-
)}
|
|
546
|
-
|
|
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>
|
|
563
|
-
</DialogPrimitive.Content>
|
|
564
|
-
</MoonUIDialogPortal>
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
);
|
|
568
|
-
MoonUIDialogContentPro.displayName = DialogPrimitive.Content.displayName;
|
|
569
|
-
|
|
570
|
-
const MoonUIDialogHeaderPro = ({
|
|
571
|
-
className,
|
|
572
|
-
...props
|
|
573
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
574
|
-
<div
|
|
575
|
-
className={cn(
|
|
576
|
-
"flex flex-col space-y-2 text-center sm:text-left",
|
|
577
|
-
className
|
|
578
|
-
)}
|
|
579
|
-
{...props}
|
|
580
|
-
/>
|
|
581
|
-
);
|
|
582
|
-
MoonUIDialogHeaderPro.displayName = "MoonUIDialogHeaderPro";
|
|
583
|
-
|
|
584
|
-
const MoonUIDialogFooterPro = ({
|
|
585
|
-
className,
|
|
586
|
-
...props
|
|
587
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
588
|
-
<div
|
|
589
|
-
className={cn(
|
|
590
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-2 mt-6",
|
|
591
|
-
className
|
|
592
|
-
)}
|
|
593
|
-
{...props}
|
|
594
|
-
/>
|
|
595
|
-
);
|
|
596
|
-
MoonUIDialogFooterPro.displayName = "MoonUIDialogFooterPro";
|
|
597
|
-
|
|
598
|
-
const MoonUIDialogTitlePro = React.forwardRef<
|
|
599
|
-
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
600
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
601
|
-
>(({ className, ...props }, ref) => (
|
|
602
|
-
<DialogPrimitive.Title
|
|
603
|
-
ref={ref}
|
|
604
|
-
className={cn(
|
|
605
|
-
"text-xl font-semibold leading-snug tracking-tight dark:text-white",
|
|
606
|
-
className
|
|
607
|
-
)}
|
|
608
|
-
{...props}
|
|
609
|
-
/>
|
|
610
|
-
));
|
|
611
|
-
MoonUIDialogTitlePro.displayName = DialogPrimitive.Title.displayName;
|
|
612
|
-
|
|
613
|
-
const MoonUIDialogDescriptionPro = React.forwardRef<
|
|
614
|
-
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
615
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
616
|
-
>(({ className, ...props }, ref) => (
|
|
617
|
-
<DialogPrimitive.Description
|
|
618
|
-
ref={ref}
|
|
619
|
-
className={cn(
|
|
620
|
-
"text-sm text-muted-foreground leading-normal dark:text-gray-400",
|
|
621
|
-
className
|
|
622
|
-
)}
|
|
623
|
-
{...props}
|
|
624
|
-
/>
|
|
625
|
-
));
|
|
626
|
-
MoonUIDialogDescriptionPro.displayName = DialogPrimitive.Description.displayName;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Dialog-Form integration for use with form support
|
|
630
|
-
* Used to integrate form submission processes into the modal
|
|
631
|
-
*/
|
|
632
|
-
const MoonUIDialogFormPro = React.forwardRef<
|
|
633
|
-
HTMLFormElement,
|
|
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";
|
|
665
|
-
|
|
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,
|
|
724
|
-
MoonUIDialogTriggerPro,
|
|
725
|
-
MoonUIDialogContentPro,
|
|
726
|
-
MoonUIDialogHeaderPro,
|
|
727
|
-
MoonUIDialogFooterPro,
|
|
728
|
-
MoonUIDialogTitlePro,
|
|
729
|
-
MoonUIDialogDescriptionPro,
|
|
730
|
-
MoonUIDialogClosePro,
|
|
731
|
-
MoonUIDialogFormPro,
|
|
732
|
-
confirmationPresets,
|
|
733
|
-
useStackedDialog,
|
|
734
|
-
type MoonUIDialogContentProProps,
|
|
735
|
-
type DialogOverlayProps
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
// Backward compatibility exports
|
|
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 };
|