@moontra/moonui-pro 2.20.1 → 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.
Files changed (162) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +11 -5
  4. package/plugin/index.d.ts +86 -0
  5. package/plugin/index.js +308 -0
  6. package/scripts/postbuild.js +27 -0
  7. package/scripts/postinstall.js +176 -23
  8. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  9. package/src/__tests__/use-local-storage.test.tsx +0 -174
  10. package/src/__tests__/use-pro-access.test.tsx +0 -183
  11. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  12. package/src/components/advanced-chart/index.tsx +0 -1242
  13. package/src/components/advanced-forms/index.tsx +0 -426
  14. package/src/components/animated-button/index.tsx +0 -385
  15. package/src/components/calendar/event-dialog.tsx +0 -372
  16. package/src/components/calendar/index.tsx +0 -1073
  17. package/src/components/calendar-pro/index.tsx +0 -1697
  18. package/src/components/color-picker/index.tsx +0 -432
  19. package/src/components/credit-card-input/index.tsx +0 -406
  20. package/src/components/dashboard/dashboard-grid.tsx +0 -462
  21. package/src/components/dashboard/demo.tsx +0 -425
  22. package/src/components/dashboard/index.tsx +0 -1046
  23. package/src/components/dashboard/time-range-picker.tsx +0 -336
  24. package/src/components/dashboard/types.ts +0 -222
  25. package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
  26. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  27. package/src/components/dashboard/widgets/metric-card.tsx +0 -343
  28. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  29. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  30. package/src/components/data-table/data-table-export.ts +0 -156
  31. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  32. package/src/components/data-table/data-table.test.tsx +0 -187
  33. package/src/components/data-table/index.tsx +0 -845
  34. package/src/components/draggable-list/index.tsx +0 -100
  35. package/src/components/enhanced/badge.tsx +0 -191
  36. package/src/components/enhanced/button.tsx +0 -362
  37. package/src/components/enhanced/card.tsx +0 -266
  38. package/src/components/enhanced/dialog.tsx +0 -246
  39. package/src/components/enhanced/index.ts +0 -4
  40. package/src/components/error-boundary/index.tsx +0 -109
  41. package/src/components/file-upload/file-upload.test.tsx +0 -243
  42. package/src/components/file-upload/index.tsx +0 -1660
  43. package/src/components/floating-action-button/index.tsx +0 -206
  44. package/src/components/form-wizard/form-wizard-context.tsx +0 -307
  45. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  46. package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
  47. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  48. package/src/components/form-wizard/index.tsx +0 -102
  49. package/src/components/form-wizard/types.ts +0 -76
  50. package/src/components/gesture-drawer/index.tsx +0 -551
  51. package/src/components/github-stars/github-api.ts +0 -426
  52. package/src/components/github-stars/hooks.ts +0 -516
  53. package/src/components/github-stars/index.tsx +0 -375
  54. package/src/components/github-stars/types.ts +0 -148
  55. package/src/components/github-stars/variants.tsx +0 -513
  56. package/src/components/health-check/index.tsx +0 -439
  57. package/src/components/hover-card-3d/index.tsx +0 -530
  58. package/src/components/index.ts +0 -128
  59. package/src/components/internal/index.ts +0 -78
  60. package/src/components/kanban/add-card-modal.tsx +0 -502
  61. package/src/components/kanban/card-detail-modal.tsx +0 -761
  62. package/src/components/kanban/index.ts +0 -13
  63. package/src/components/kanban/kanban.tsx +0 -1684
  64. package/src/components/kanban/types.ts +0 -168
  65. package/src/components/lazy-component/index.tsx +0 -823
  66. package/src/components/license-error/index.tsx +0 -29
  67. package/src/components/magnetic-button/index.tsx +0 -167
  68. package/src/components/memory-efficient-data/index.tsx +0 -1016
  69. package/src/components/moonui-quiz-form/index.tsx +0 -817
  70. package/src/components/optimized-image/index.tsx +0 -425
  71. package/src/components/performance-debugger/index.tsx +0 -589
  72. package/src/components/performance-monitor/index.tsx +0 -794
  73. package/src/components/phone-number-input/index.tsx +0 -338
  74. package/src/components/pinch-zoom/index.tsx +0 -566
  75. package/src/components/quiz-form/index.tsx +0 -479
  76. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  77. package/src/components/rich-text-editor/index.tsx +0 -2324
  78. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
  79. package/src/components/rich-text-editor/slash-commands.css +0 -35
  80. package/src/components/rich-text-editor/table-styles.css +0 -65
  81. package/src/components/sidebar/index.tsx +0 -865
  82. package/src/components/spotlight-card/index.tsx +0 -191
  83. package/src/components/swipeable-card/index.tsx +0 -100
  84. package/src/components/timeline/index.tsx +0 -1148
  85. package/src/components/ui/accordion.tsx +0 -73
  86. package/src/components/ui/alert-dialog.tsx +0 -141
  87. package/src/components/ui/alert.tsx +0 -141
  88. package/src/components/ui/aspect-ratio.tsx +0 -245
  89. package/src/components/ui/avatar.tsx +0 -153
  90. package/src/components/ui/badge.tsx +0 -228
  91. package/src/components/ui/breadcrumb.tsx +0 -214
  92. package/src/components/ui/button.tsx +0 -222
  93. package/src/components/ui/calendar.tsx +0 -387
  94. package/src/components/ui/card.tsx +0 -214
  95. package/src/components/ui/checkbox.tsx +0 -259
  96. package/src/components/ui/collapsible.tsx +0 -135
  97. package/src/components/ui/color-picker.tsx +0 -97
  98. package/src/components/ui/command.tsx +0 -225
  99. package/src/components/ui/dialog.tsx +0 -334
  100. package/src/components/ui/dropdown-menu.tsx +0 -218
  101. package/src/components/ui/gesture-drawer.tsx +0 -11
  102. package/src/components/ui/hover-card.tsx +0 -29
  103. package/src/components/ui/index.ts +0 -190
  104. package/src/components/ui/input.tsx +0 -222
  105. package/src/components/ui/label.tsx +0 -29
  106. package/src/components/ui/lightbox.tsx +0 -606
  107. package/src/components/ui/magnetic-button.tsx +0 -129
  108. package/src/components/ui/media-gallery.tsx +0 -612
  109. package/src/components/ui/pagination.tsx +0 -123
  110. package/src/components/ui/popover.tsx +0 -185
  111. package/src/components/ui/progress.tsx +0 -30
  112. package/src/components/ui/radio-group.tsx +0 -257
  113. package/src/components/ui/scroll-area.tsx +0 -47
  114. package/src/components/ui/select.tsx +0 -374
  115. package/src/components/ui/separator.tsx +0 -145
  116. package/src/components/ui/sheet.tsx +0 -139
  117. package/src/components/ui/skeleton.tsx +0 -20
  118. package/src/components/ui/slider.tsx +0 -354
  119. package/src/components/ui/spotlight-card.tsx +0 -119
  120. package/src/components/ui/switch.tsx +0 -86
  121. package/src/components/ui/table.tsx +0 -329
  122. package/src/components/ui/tabs.tsx +0 -198
  123. package/src/components/ui/textarea.tsx +0 -28
  124. package/src/components/ui/toast.tsx +0 -317
  125. package/src/components/ui/toggle.tsx +0 -119
  126. package/src/components/ui/tooltip.tsx +0 -151
  127. package/src/components/virtual-list/index.tsx +0 -668
  128. package/src/hooks/use-chart.ts +0 -205
  129. package/src/hooks/use-data-table.ts +0 -182
  130. package/src/hooks/use-docs-pro-access.ts +0 -13
  131. package/src/hooks/use-license-check.ts +0 -65
  132. package/src/hooks/use-subscription.ts +0 -19
  133. package/src/hooks/use-toast.ts +0 -15
  134. package/src/index.ts +0 -14
  135. package/src/lib/ai-providers.ts +0 -377
  136. package/src/lib/component-metadata.ts +0 -18
  137. package/src/lib/micro-interactions.ts +0 -255
  138. package/src/lib/paddle.ts +0 -17
  139. package/src/lib/utils.ts +0 -6
  140. package/src/patterns/login-form/index.tsx +0 -276
  141. package/src/patterns/login-form/types.ts +0 -67
  142. package/src/setupTests.ts +0 -41
  143. package/src/styles/advanced-chart.css +0 -239
  144. package/src/styles/calendar.css +0 -35
  145. package/src/styles/design-system.css +0 -363
  146. package/src/styles/index.css +0 -85
  147. package/src/styles/tailwind.css +0 -7
  148. package/src/styles/tokens.css +0 -455
  149. package/src/types/moonui.d.ts +0 -22
  150. package/src/types/next-auth.d.ts +0 -21
  151. package/src/use-intersection-observer.tsx +0 -154
  152. package/src/use-local-storage.tsx +0 -71
  153. package/src/use-paddle.ts +0 -138
  154. package/src/use-performance-optimizer.ts +0 -389
  155. package/src/use-pro-access.ts +0 -141
  156. package/src/use-scroll-animation.ts +0 -219
  157. package/src/use-subscription.ts +0 -37
  158. package/src/use-toast.ts +0 -32
  159. package/src/utils/chart-helpers.ts +0 -357
  160. package/src/utils/cn.ts +0 -6
  161. package/src/utils/data-processing.ts +0 -151
  162. package/src/utils/license-validator.tsx +0 -183
@@ -1,298 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { motion } from "framer-motion"
5
- import { CheckCircle, Circle, XCircle } from "lucide-react"
6
- import { cn } from "../../lib/utils"
7
- import { useFormWizard } from "./form-wizard-context"
8
- import { FormWizardProps } from "./types"
9
-
10
- interface FormWizardProgressProps {
11
- className?: string
12
- progressType?: FormWizardProps['progressType']
13
- orientation?: FormWizardProps['orientation']
14
- showStepNumbers?: boolean
15
- showStepTitles?: boolean
16
- stepIconPosition?: FormWizardProps['stepIconPosition']
17
- completedStepIcon?: React.ReactNode
18
- activeStepIcon?: React.ReactNode
19
- errorStepIcon?: React.ReactNode
20
- }
21
-
22
- export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
23
- className,
24
- progressType = 'linear',
25
- orientation = 'horizontal',
26
- showStepNumbers = true,
27
- showStepTitles = true,
28
- stepIconPosition = 'top',
29
- completedStepIcon = <CheckCircle className="w-5 h-5" />,
30
- activeStepIcon,
31
- errorStepIcon = <XCircle className="w-5 h-5" />
32
- }) => {
33
- const { steps, currentStep, isStepCompleted, isStepAccessible, error } = useFormWizard()
34
-
35
- if (progressType === 'linear') {
36
- return (
37
- <div className={cn(
38
- "relative w-full",
39
- orientation === 'vertical' ? "flex flex-col space-y-8" : "",
40
- className
41
- )}>
42
- {orientation === 'horizontal' ? (
43
- <div className="relative w-full">
44
- {/* Steps Container with connecting lines */}
45
- <div className="relative flex items-start justify-between w-full">
46
- {steps.map((step, index) => {
47
- const isActive = index === currentStep
48
- const isCompleted = isStepCompleted(index)
49
- const isAccessible = isStepAccessible(index)
50
- const hasError = isActive && error
51
-
52
- const StepIcon = typeof step.icon === 'function'
53
- ? step.icon({ isActive, isCompleted })
54
- : step.icon
55
-
56
- return (
57
- <div key={step.id} className="relative flex-1 flex flex-col items-center">
58
- {/* Step Title & Description - Above the circle */}
59
- {showStepTitles && (
60
- <div className="text-center mb-3 min-h-[40px] px-2">
61
- <p className={cn(
62
- "text-sm font-semibold transition-colors",
63
- isActive && "text-primary",
64
- isCompleted && !isActive && "text-primary",
65
- !isActive && !isCompleted && "text-muted-foreground"
66
- )}>
67
- {step.title}
68
- </p>
69
- {step.description && (
70
- <p className="text-xs text-muted-foreground mt-1">
71
- {step.description}
72
- </p>
73
- )}
74
- </div>
75
- )}
76
-
77
- {/* Step Circle Container with line */}
78
- <div className="relative flex items-center w-full">
79
- {/* Connecting Line - Positioned after each circle except the last */}
80
- {index < steps.length - 1 && (
81
- <div
82
- className="absolute left-1/2 w-full h-[2px]"
83
- style={{
84
- width: 'calc(100% + 24px)',
85
- marginLeft: '24px'
86
- }}
87
- >
88
- <div className="h-full bg-border" />
89
- {index < currentStep && (
90
- <motion.div
91
- className="absolute inset-0 bg-primary"
92
- initial={{ scaleX: 0 }}
93
- animate={{ scaleX: 1 }}
94
- transition={{ duration: 0.5, delay: index * 0.1 }}
95
- style={{ transformOrigin: 'left' }}
96
- />
97
- )}
98
- </div>
99
- )}
100
-
101
- {/* Step Circle */}
102
- <motion.div
103
- initial={{ scale: 0.8 }}
104
- animate={{ scale: isActive ? 1.05 : 1 }}
105
- transition={{ duration: 0.2 }}
106
- className={cn(
107
- "relative z-10 flex items-center justify-center rounded-full transition-all duration-300 mx-auto",
108
- "w-12 h-12 border-2",
109
- isActive && "border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/20",
110
- isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
111
- !isActive && !isCompleted && isAccessible && "border-border bg-background text-muted-foreground hover:border-accent",
112
- !isAccessible && "border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",
113
- hasError && "border-destructive bg-destructive text-destructive-foreground"
114
- )}
115
- >
116
- {hasError ? (
117
- errorStepIcon
118
- ) : isCompleted && !isActive ? (
119
- completedStepIcon
120
- ) : isActive && activeStepIcon ? (
121
- activeStepIcon
122
- ) : StepIcon ? (
123
- <span className="w-5 h-5 flex items-center justify-center">{StepIcon}</span>
124
- ) : showStepNumbers ? (
125
- <span className="text-sm font-semibold">{index + 1}</span>
126
- ) : (
127
- <Circle className="w-4 h-4" />
128
- )}
129
- </motion.div>
130
- </div>
131
-
132
- {/* Step Label Below Circle */}
133
- <div className="mt-3">
134
- <p className="text-xs text-muted-foreground font-medium">
135
- Step {index + 1} of {steps.length}
136
- </p>
137
- </div>
138
- </div>
139
- )
140
- })}
141
- </div>
142
- </div>
143
- ) : (
144
- // Vertical orientation
145
- <div className="relative pl-12">
146
- {/* Vertical Progress Line */}
147
- {steps.length > 1 && (
148
- <>
149
- <div className="absolute left-6 top-8 bottom-8 w-[2px] bg-border" />
150
- <motion.div
151
- className="absolute left-6 top-8 w-[2px] bg-primary"
152
- initial={{ height: 0 }}
153
- animate={{
154
- height: `${(currentStep / (steps.length - 1)) * (100 - 16)}%`
155
- }}
156
- transition={{ duration: 0.5 }}
157
- />
158
- </>
159
- )}
160
-
161
- {steps.map((step, index) => {
162
- const isActive = index === currentStep
163
- const isCompleted = isStepCompleted(index)
164
- const isAccessible = isStepAccessible(index)
165
- const hasError = isActive && error
166
-
167
- const StepIcon = typeof step.icon === 'function'
168
- ? step.icon({ isActive, isCompleted })
169
- : step.icon
170
-
171
- return (
172
- <div key={step.id} className="relative flex items-center mb-8 last:mb-0">
173
- {/* Step Circle */}
174
- <motion.div
175
- initial={{ scale: 0.8 }}
176
- animate={{ scale: isActive ? 1.05 : 1 }}
177
- className={cn(
178
- "absolute left-0 z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300",
179
- "w-12 h-12",
180
- isActive && "border-primary bg-primary text-primary-foreground shadow-lg",
181
- isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
182
- !isActive && !isCompleted && isAccessible && "border-border bg-background text-muted-foreground hover:border-accent",
183
- !isAccessible && "border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",
184
- hasError && "border-destructive bg-destructive text-destructive-foreground"
185
- )}
186
- >
187
- {hasError ? (
188
- errorStepIcon
189
- ) : isCompleted && !isActive ? (
190
- completedStepIcon
191
- ) : isActive && activeStepIcon ? (
192
- activeStepIcon
193
- ) : StepIcon ? (
194
- <span className="w-5 h-5 flex items-center justify-center">{StepIcon}</span>
195
- ) : showStepNumbers ? (
196
- <span className="text-sm font-semibold">{index + 1}</span>
197
- ) : (
198
- <Circle className="w-4 h-4" />
199
- )}
200
- </motion.div>
201
-
202
- {/* Step Content */}
203
- <div className="ml-16">
204
- {showStepTitles && (
205
- <>
206
- <p className={cn(
207
- "text-sm font-semibold transition-colors",
208
- isActive && "text-primary",
209
- isCompleted && !isActive && "text-primary",
210
- !isActive && !isCompleted && "text-muted-foreground"
211
- )}>
212
- {step.title}
213
- </p>
214
- {step.description && (
215
- <p className="text-xs text-muted-foreground mt-1">
216
- {step.description}
217
- </p>
218
- )}
219
- </>
220
- )}
221
- </div>
222
- </div>
223
- )
224
- })}
225
- </div>
226
- )}
227
- </div>
228
- )
229
- }
230
-
231
- if (progressType === 'dots') {
232
- return (
233
- <div className={cn("flex items-center justify-center space-x-2", className)}>
234
- {steps.map((_, index) => {
235
- const isActive = index === currentStep
236
- const isCompleted = isStepCompleted(index)
237
-
238
- return (
239
- <motion.div
240
- key={index}
241
- initial={{ scale: 0.8 }}
242
- animate={{ scale: isActive ? 1.2 : 1 }}
243
- className={cn(
244
- "rounded-full transition-all duration-300",
245
- isActive ? "w-3 h-3 bg-primary" : "w-2 h-2",
246
- isCompleted && !isActive && "bg-primary/60",
247
- !isActive && !isCompleted && "bg-muted"
248
- )}
249
- />
250
- )
251
- })}
252
- </div>
253
- )
254
- }
255
-
256
- if (progressType === 'circular') {
257
- const progress = ((currentStep + 1) / steps.length) * 100
258
- const circumference = 2 * Math.PI * 45 // radius = 45
259
- const strokeDashoffset = circumference - (progress / 100) * circumference
260
-
261
- return (
262
- <div className={cn("relative w-36 h-36 mx-auto", className)}>
263
- <svg className="w-full h-full -rotate-90" viewBox="0 0 144 144">
264
- <circle
265
- cx="72"
266
- cy="72"
267
- r="45"
268
- fill="none"
269
- stroke="currentColor"
270
- strokeWidth="8"
271
- className="text-border"
272
- />
273
- <motion.circle
274
- cx="72"
275
- cy="72"
276
- r="45"
277
- fill="none"
278
- stroke="currentColor"
279
- strokeWidth="8"
280
- strokeDasharray={circumference}
281
- initial={{ strokeDashoffset: circumference }}
282
- animate={{ strokeDashoffset }}
283
- className="text-primary"
284
- transition={{ duration: 0.5 }}
285
- />
286
- </svg>
287
- <div className="absolute inset-0 flex items-center justify-center">
288
- <div className="text-center">
289
- <p className="text-3xl font-bold">{currentStep + 1}</p>
290
- <p className="text-sm text-muted-foreground">of {steps.length}</p>
291
- </div>
292
- </div>
293
- </div>
294
- )
295
- }
296
-
297
- return null
298
- }
@@ -1,111 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { motion, AnimatePresence } from "framer-motion"
5
- import { cn } from "../../lib/utils"
6
- import { useFormWizard } from "./form-wizard-context"
7
- import { FormWizardProps } from "./types"
8
- import { Alert, AlertDescription } from "../ui/alert"
9
- import { AlertCircle } from "lucide-react"
10
-
11
- interface FormWizardStepProps {
12
- className?: string
13
- animationType?: FormWizardProps['animationType']
14
- animationDuration?: number
15
- }
16
-
17
- const animations = {
18
- slide: {
19
- initial: (direction: number) => ({
20
- x: direction > 0 ? 1000 : -1000,
21
- opacity: 0
22
- }),
23
- animate: {
24
- x: 0,
25
- opacity: 1
26
- },
27
- exit: (direction: number) => ({
28
- x: direction < 0 ? 1000 : -1000,
29
- opacity: 0
30
- })
31
- },
32
- fade: {
33
- initial: { opacity: 0 },
34
- animate: { opacity: 1 },
35
- exit: { opacity: 0 }
36
- },
37
- scale: {
38
- initial: { opacity: 0, scale: 0.8 },
39
- animate: { opacity: 1, scale: 1 },
40
- exit: { opacity: 0, scale: 0.8 }
41
- },
42
- none: {
43
- initial: {},
44
- animate: {},
45
- exit: {}
46
- }
47
- }
48
-
49
- export const FormWizardStep: React.FC<FormWizardStepProps> = ({
50
- className,
51
- animationType = 'slide',
52
- animationDuration = 0.3
53
- }) => {
54
- const { steps, currentStep, goToNext, goToPrevious, goToStep, updateStepData, stepData, error } = useFormWizard()
55
- const [direction, setDirection] = React.useState(0)
56
- const previousStep = React.useRef(currentStep)
57
-
58
- React.useEffect(() => {
59
- setDirection(currentStep > previousStep.current ? 1 : -1)
60
- previousStep.current = currentStep
61
- }, [currentStep])
62
-
63
- const currentStepObj = steps[currentStep]
64
- const isFirstStep = currentStep === 0
65
- const isLastStep = currentStep === steps.length - 1
66
-
67
- const stepContentProps = {
68
- currentStep,
69
- totalSteps: steps.length,
70
- goToNext,
71
- goToPrevious,
72
- goToStep,
73
- isFirstStep,
74
- isLastStep,
75
- stepData: stepData[currentStepObj.id] || {},
76
- updateStepData: (data: any) => updateStepData(currentStepObj.id, data)
77
- }
78
-
79
- const content = typeof currentStepObj.content === 'function'
80
- ? currentStepObj.content(stepContentProps)
81
- : currentStepObj.content
82
-
83
- return (
84
- <AnimatePresence mode="wait" custom={direction}>
85
- <motion.div
86
- key={currentStep}
87
- custom={direction}
88
- variants={animations[animationType]}
89
- initial="initial"
90
- animate="animate"
91
- exit="exit"
92
- transition={{
93
- duration: animationDuration,
94
- ease: "easeInOut"
95
- }}
96
- className={cn("w-full", className)}
97
- data-wizard-step-content
98
- >
99
- <div className="space-y-4">
100
- {error && (
101
- <Alert variant="error">
102
- <AlertCircle className="h-4 w-4" />
103
- <AlertDescription>{error}</AlertDescription>
104
- </Alert>
105
- )}
106
- {content}
107
- </div>
108
- </motion.div>
109
- </AnimatePresence>
110
- )
111
- }
@@ -1,102 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { cn } from "../../lib/utils"
5
- import { FormWizardProvider } from "./form-wizard-context"
6
- import { FormWizardProgress } from "./form-wizard-progress"
7
- import { FormWizardStep } from "./form-wizard-step"
8
- import { FormWizardNavigation } from "./form-wizard-navigation"
9
- import { FormWizardProps } from "./types"
10
- import { Card, CardContent } from "../ui/card"
11
- import { Separator } from "../ui/separator"
12
-
13
- export const MoonUIFormWizardPro = React.forwardRef<HTMLDivElement, FormWizardProps>(({
14
- steps,
15
- currentStep = 0,
16
- onStepChange,
17
- onComplete,
18
- orientation = 'horizontal',
19
- progressType = 'linear',
20
- allowStepSkip = false,
21
- allowBackNavigation = true,
22
- validateOnStepChange = true,
23
- animationType = 'slide',
24
- animationDuration = 0.3,
25
- showStepNumbers = true,
26
- showStepTitles = true,
27
- showProgressBar = true,
28
- stepIconPosition = 'top',
29
- completedStepIcon,
30
- activeStepIcon,
31
- errorStepIcon,
32
- className,
33
- progressClassName,
34
- navigationClassName,
35
- contentClassName,
36
- stepClassName,
37
- autoSave = false,
38
- autoSaveDelay = 2000,
39
- onAutoSave,
40
- persistData = false,
41
- storageKey = "form-wizard-data"
42
- }, ref) => {
43
- return (
44
- <FormWizardProvider
45
- steps={steps}
46
- initialStep={currentStep}
47
- onStepChange={onStepChange}
48
- onComplete={onComplete}
49
- validateOnStepChange={validateOnStepChange}
50
- allowBackNavigation={allowBackNavigation}
51
- allowStepSkip={allowStepSkip}
52
- autoSave={autoSave}
53
- autoSaveDelay={autoSaveDelay}
54
- onAutoSave={onAutoSave}
55
- persistData={persistData}
56
- storageKey={storageKey}
57
- >
58
- <div ref={ref} className={cn("w-full", className)}>
59
- {showProgressBar && (
60
- <>
61
- <FormWizardProgress
62
- className={cn("mb-12", progressClassName)}
63
- progressType={progressType}
64
- orientation={orientation}
65
- showStepNumbers={showStepNumbers}
66
- showStepTitles={showStepTitles}
67
- stepIconPosition={stepIconPosition}
68
- completedStepIcon={completedStepIcon}
69
- activeStepIcon={activeStepIcon}
70
- errorStepIcon={errorStepIcon}
71
- />
72
- </>
73
- )}
74
-
75
- <Card className={cn("border-0 shadow-none", contentClassName)}>
76
- <CardContent className="p-0">
77
- <FormWizardStep
78
- className={stepClassName}
79
- animationType={animationType}
80
- animationDuration={animationDuration}
81
- />
82
- </CardContent>
83
- </Card>
84
-
85
- <FormWizardNavigation
86
- className={cn("mt-8", navigationClassName)}
87
- />
88
- </div>
89
- </FormWizardProvider>
90
- )
91
- })
92
-
93
- MoonUIFormWizardPro.displayName = "MoonUIFormWizardPro"
94
-
95
- // Export types and hooks
96
- export type { FormWizardProps, WizardStep, WizardStepContentProps } from "./types"
97
- export { useFormWizard } from "./form-wizard-context"
98
-
99
- // Export sub-components for advanced usage
100
- export { FormWizardProgress } from "./form-wizard-progress"
101
- export { FormWizardStep } from "./form-wizard-step"
102
- export { FormWizardNavigation } from "./form-wizard-navigation"
@@ -1,76 +0,0 @@
1
- import { ReactNode } from "react"
2
-
3
- export interface WizardStep {
4
- id: string
5
- title: string
6
- description?: string
7
- icon?: ReactNode | ((props: { isActive: boolean; isCompleted: boolean }) => ReactNode)
8
- content: ReactNode | ((props: WizardStepContentProps) => ReactNode)
9
- validation?: () => boolean | Promise<boolean>
10
- isOptional?: boolean
11
- isDisabled?: boolean | ((currentStep: number, steps: WizardStep[]) => boolean)
12
- onEnter?: () => void | Promise<void>
13
- onExit?: () => void | Promise<void>
14
- }
15
-
16
- export interface WizardStepContentProps {
17
- currentStep: number
18
- totalSteps: number
19
- goToNext: () => void
20
- goToPrevious: () => void
21
- goToStep: (step: number) => void
22
- isFirstStep: boolean
23
- isLastStep: boolean
24
- stepData: any
25
- updateStepData: (data: any) => void
26
- }
27
-
28
- export interface FormWizardProps {
29
- steps: WizardStep[]
30
- currentStep?: number
31
- onStepChange?: (step: number, previousStep: number) => void
32
- onComplete?: (data: Record<string, any>) => void | Promise<void>
33
- orientation?: 'horizontal' | 'vertical'
34
- progressType?: 'linear' | 'circular' | 'dots' | 'custom'
35
- allowStepSkip?: boolean
36
- allowBackNavigation?: boolean
37
- validateOnStepChange?: boolean
38
- animationType?: 'slide' | 'fade' | 'scale' | 'none'
39
- animationDuration?: number
40
- showStepNumbers?: boolean
41
- showStepTitles?: boolean
42
- showProgressBar?: boolean
43
- stepIconPosition?: 'top' | 'left' | 'inside'
44
- completedStepIcon?: ReactNode
45
- activeStepIcon?: ReactNode
46
- errorStepIcon?: ReactNode
47
- className?: string
48
- progressClassName?: string
49
- navigationClassName?: string
50
- contentClassName?: string
51
- stepClassName?: string
52
- autoSave?: boolean
53
- autoSaveDelay?: number
54
- onAutoSave?: (stepId: string, data: any) => void | Promise<void>
55
- persistData?: boolean
56
- storageKey?: string
57
- }
58
-
59
- export interface WizardContextValue {
60
- steps: WizardStep[]
61
- currentStep: number
62
- stepData: Record<string, any>
63
- isLoading: boolean
64
- error: string | null
65
- goToNext: () => void
66
- goToPrevious: () => void
67
- goToStep: (step: number) => void
68
- updateStepData: (stepId: string, data: any) => void
69
- validateCurrentStep: () => Promise<boolean>
70
- completeWizard: () => void
71
- resetWizard: () => void
72
- isStepCompleted: (stepIndex: number) => boolean
73
- isStepAccessible: (stepIndex: number) => boolean
74
- canGoNext: boolean
75
- canGoPrevious: boolean
76
- }