@moontra/moonui-pro 2.7.3 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -60193,55 +60193,130 @@ var FormWizardProgress = ({
|
|
|
60193
60193
|
const { steps, currentStep, isStepCompleted, isStepAccessible, error: error42 } = useFormWizard();
|
|
60194
60194
|
if (progressType === "linear") {
|
|
60195
60195
|
return /* @__PURE__ */ jsx("div", { className: cn(
|
|
60196
|
-
"relative",
|
|
60197
|
-
orientation === "vertical" ? "flex flex-col space-y-8" : "
|
|
60196
|
+
"relative w-full",
|
|
60197
|
+
orientation === "vertical" ? "flex flex-col space-y-8" : "",
|
|
60198
60198
|
className
|
|
60199
|
-
), children:
|
|
60200
|
-
|
|
60201
|
-
|
|
60202
|
-
|
|
60203
|
-
|
|
60204
|
-
|
|
60205
|
-
|
|
60206
|
-
"relative flex items-center",
|
|
60207
|
-
orientation === "vertical" ? "w-full" : "flex-1"
|
|
60208
|
-
), children: [
|
|
60209
|
-
/* @__PURE__ */ jsx(
|
|
60210
|
-
motion.div,
|
|
60211
|
-
{
|
|
60212
|
-
initial: { scale: 0.8 },
|
|
60213
|
-
animate: { scale: isActive2 ? 1.1 : 1 },
|
|
60214
|
-
className: cn(
|
|
60215
|
-
"relative z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300",
|
|
60216
|
-
stepIconPosition === "inside" ? "w-12 h-12" : "w-10 h-10",
|
|
60217
|
-
isActive2 && "border-primary bg-primary text-primary-foreground shadow-lg",
|
|
60218
|
-
isCompleted && !isActive2 && "border-primary bg-primary text-primary-foreground",
|
|
60219
|
-
!isActive2 && !isCompleted && isAccessible && "border-muted-foreground/50 bg-background text-muted-foreground hover:border-muted-foreground",
|
|
60220
|
-
!isAccessible && "border-muted bg-muted text-muted-foreground cursor-not-allowed opacity-50",
|
|
60221
|
-
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
60222
|
-
),
|
|
60223
|
-
children: hasError ? errorStepIcon : isCompleted && !isActive2 ? completedStepIcon : isActive2 && activeStepIcon ? activeStepIcon : StepIcon ? /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center", children: StepIcon }) : showStepNumbers ? /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: index2 + 1 }) : /* @__PURE__ */ jsx(Circle, { className: "w-4 h-4" })
|
|
60199
|
+
), children: orientation === "horizontal" ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
60200
|
+
/* @__PURE__ */ jsx(
|
|
60201
|
+
"div",
|
|
60202
|
+
{
|
|
60203
|
+
className: "absolute left-6 right-6 h-[2px] bg-gray-200 dark:bg-gray-700",
|
|
60204
|
+
style: {
|
|
60205
|
+
top: showStepTitles ? "80px" : "24px"
|
|
60224
60206
|
}
|
|
60225
|
-
|
|
60226
|
-
|
|
60227
|
-
|
|
60228
|
-
|
|
60229
|
-
|
|
60230
|
-
|
|
60231
|
-
|
|
60232
|
-
|
|
60233
|
-
|
|
60234
|
-
|
|
60235
|
-
|
|
60236
|
-
|
|
60207
|
+
}
|
|
60208
|
+
),
|
|
60209
|
+
/* @__PURE__ */ jsx(
|
|
60210
|
+
motion.div,
|
|
60211
|
+
{
|
|
60212
|
+
className: "absolute left-6 h-[2px] bg-primary",
|
|
60213
|
+
style: {
|
|
60214
|
+
top: showStepTitles ? "80px" : "24px",
|
|
60215
|
+
right: `${100 - currentStep / (steps.length - 1) * 100}%`
|
|
60216
|
+
},
|
|
60217
|
+
initial: { right: "100%" },
|
|
60218
|
+
animate: {
|
|
60219
|
+
right: steps.length > 1 ? `${100 - currentStep / (steps.length - 1) * 100}%` : "100%"
|
|
60220
|
+
},
|
|
60221
|
+
transition: { duration: 0.5, ease: "easeInOut" }
|
|
60222
|
+
}
|
|
60223
|
+
),
|
|
60224
|
+
/* @__PURE__ */ jsx("div", { className: "relative flex items-start justify-between w-full", children: steps.map((step, index2) => {
|
|
60225
|
+
const isActive2 = index2 === currentStep;
|
|
60226
|
+
const isCompleted = isStepCompleted(index2);
|
|
60227
|
+
const isAccessible = isStepAccessible(index2);
|
|
60228
|
+
const hasError = isActive2 && error42;
|
|
60229
|
+
const StepIcon = typeof step.icon === "function" ? step.icon({ isActive: isActive2, isCompleted }) : step.icon;
|
|
60230
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center", children: [
|
|
60231
|
+
showStepTitles && /* @__PURE__ */ jsxs("div", { className: "text-center mb-3 min-h-[40px] px-2", children: [
|
|
60232
|
+
/* @__PURE__ */ jsx("p", { className: cn(
|
|
60233
|
+
"text-sm font-semibold transition-colors",
|
|
60234
|
+
isActive2 && "text-primary",
|
|
60235
|
+
isCompleted && !isActive2 && "text-primary",
|
|
60236
|
+
!isActive2 && !isCompleted && "text-muted-foreground"
|
|
60237
|
+
), children: step.title }),
|
|
60238
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: step.description })
|
|
60239
|
+
] }),
|
|
60240
|
+
/* @__PURE__ */ jsx(
|
|
60241
|
+
motion.div,
|
|
60242
|
+
{
|
|
60243
|
+
initial: { scale: 0.8 },
|
|
60244
|
+
animate: { scale: isActive2 ? 1.05 : 1 },
|
|
60245
|
+
transition: { duration: 0.2 },
|
|
60246
|
+
className: cn(
|
|
60247
|
+
"relative z-10 flex items-center justify-center rounded-full transition-all duration-300",
|
|
60248
|
+
"w-12 h-12 border-2",
|
|
60249
|
+
isActive2 && "border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/20",
|
|
60250
|
+
isCompleted && !isActive2 && "border-primary bg-primary text-primary-foreground",
|
|
60251
|
+
!isActive2 && !isCompleted && isAccessible && "border-gray-300 bg-background text-gray-500 hover:border-gray-400 dark:border-gray-600 dark:text-gray-400",
|
|
60252
|
+
!isAccessible && "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed dark:border-gray-700 dark:bg-gray-900 dark:text-gray-600",
|
|
60253
|
+
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
60254
|
+
),
|
|
60255
|
+
children: hasError ? errorStepIcon : isCompleted && !isActive2 ? completedStepIcon : isActive2 && activeStepIcon ? activeStepIcon : StepIcon ? /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center", children: StepIcon }) : showStepNumbers ? /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: index2 + 1 }) : /* @__PURE__ */ jsx(Circle, { className: "w-4 h-4" })
|
|
60256
|
+
}
|
|
60257
|
+
),
|
|
60258
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground font-medium", children: [
|
|
60259
|
+
"Step ",
|
|
60260
|
+
index2 + 1,
|
|
60261
|
+
" of ",
|
|
60262
|
+
steps.length
|
|
60263
|
+
] }) })
|
|
60264
|
+
] }, step.id);
|
|
60265
|
+
}) })
|
|
60266
|
+
] }) : (
|
|
60267
|
+
// Vertical orientation
|
|
60268
|
+
/* @__PURE__ */ jsxs("div", { className: "relative pl-12", children: [
|
|
60269
|
+
steps.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60270
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-6 top-8 bottom-8 w-[2px] bg-gray-200 dark:bg-gray-700" }),
|
|
60271
|
+
/* @__PURE__ */ jsx(
|
|
60272
|
+
motion.div,
|
|
60273
|
+
{
|
|
60274
|
+
className: "absolute left-6 top-8 w-[2px] bg-primary",
|
|
60275
|
+
initial: { height: 0 },
|
|
60276
|
+
animate: {
|
|
60277
|
+
height: `${currentStep / (steps.length - 1) * (100 - 16)}%`
|
|
60278
|
+
},
|
|
60279
|
+
transition: { duration: 0.5 }
|
|
60280
|
+
}
|
|
60281
|
+
)
|
|
60237
60282
|
] }),
|
|
60238
|
-
|
|
60239
|
-
|
|
60240
|
-
|
|
60241
|
-
|
|
60242
|
-
|
|
60243
|
-
|
|
60244
|
-
|
|
60283
|
+
steps.map((step, index2) => {
|
|
60284
|
+
const isActive2 = index2 === currentStep;
|
|
60285
|
+
const isCompleted = isStepCompleted(index2);
|
|
60286
|
+
const isAccessible = isStepAccessible(index2);
|
|
60287
|
+
const hasError = isActive2 && error42;
|
|
60288
|
+
const StepIcon = typeof step.icon === "function" ? step.icon({ isActive: isActive2, isCompleted }) : step.icon;
|
|
60289
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex items-center mb-8 last:mb-0", children: [
|
|
60290
|
+
/* @__PURE__ */ jsx(
|
|
60291
|
+
motion.div,
|
|
60292
|
+
{
|
|
60293
|
+
initial: { scale: 0.8 },
|
|
60294
|
+
animate: { scale: isActive2 ? 1.05 : 1 },
|
|
60295
|
+
className: cn(
|
|
60296
|
+
"absolute left-0 z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300",
|
|
60297
|
+
"w-12 h-12",
|
|
60298
|
+
isActive2 && "border-primary bg-primary text-primary-foreground shadow-lg",
|
|
60299
|
+
isCompleted && !isActive2 && "border-primary bg-primary text-primary-foreground",
|
|
60300
|
+
!isActive2 && !isCompleted && isAccessible && "border-gray-300 bg-background text-gray-500 hover:border-gray-400",
|
|
60301
|
+
!isAccessible && "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed",
|
|
60302
|
+
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
60303
|
+
),
|
|
60304
|
+
children: hasError ? errorStepIcon : isCompleted && !isActive2 ? completedStepIcon : isActive2 && activeStepIcon ? activeStepIcon : StepIcon ? /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center", children: StepIcon }) : showStepNumbers ? /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: index2 + 1 }) : /* @__PURE__ */ jsx(Circle, { className: "w-4 h-4" })
|
|
60305
|
+
}
|
|
60306
|
+
),
|
|
60307
|
+
/* @__PURE__ */ jsx("div", { className: "ml-16", children: showStepTitles && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60308
|
+
/* @__PURE__ */ jsx("p", { className: cn(
|
|
60309
|
+
"text-sm font-semibold transition-colors",
|
|
60310
|
+
isActive2 && "text-primary",
|
|
60311
|
+
isCompleted && !isActive2 && "text-primary",
|
|
60312
|
+
!isActive2 && !isCompleted && "text-muted-foreground"
|
|
60313
|
+
), children: step.title }),
|
|
60314
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: step.description })
|
|
60315
|
+
] }) })
|
|
60316
|
+
] }, step.id);
|
|
60317
|
+
})
|
|
60318
|
+
] })
|
|
60319
|
+
) });
|
|
60245
60320
|
}
|
|
60246
60321
|
if (progressType === "dots") {
|
|
60247
60322
|
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center space-x-2", className), children: steps.map((_, index2) => {
|
|
@@ -60265,28 +60340,28 @@ var FormWizardProgress = ({
|
|
|
60265
60340
|
}
|
|
60266
60341
|
if (progressType === "circular") {
|
|
60267
60342
|
const progress = (currentStep + 1) / steps.length * 100;
|
|
60268
|
-
const circumference = 2 * Math.PI *
|
|
60343
|
+
const circumference = 2 * Math.PI * 45;
|
|
60269
60344
|
const strokeDashoffset = circumference - progress / 100 * circumference;
|
|
60270
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("relative w-
|
|
60271
|
-
/* @__PURE__ */ jsxs("svg", { className: "w-full h-full -rotate-90", children: [
|
|
60345
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative w-36 h-36 mx-auto", className), children: [
|
|
60346
|
+
/* @__PURE__ */ jsxs("svg", { className: "w-full h-full -rotate-90", viewBox: "0 0 144 144", children: [
|
|
60272
60347
|
/* @__PURE__ */ jsx(
|
|
60273
60348
|
"circle",
|
|
60274
60349
|
{
|
|
60275
|
-
cx: "
|
|
60276
|
-
cy: "
|
|
60277
|
-
r: "
|
|
60350
|
+
cx: "72",
|
|
60351
|
+
cy: "72",
|
|
60352
|
+
r: "45",
|
|
60278
60353
|
fill: "none",
|
|
60279
60354
|
stroke: "currentColor",
|
|
60280
60355
|
strokeWidth: "8",
|
|
60281
|
-
className: "text-
|
|
60356
|
+
className: "text-gray-200 dark:text-gray-700"
|
|
60282
60357
|
}
|
|
60283
60358
|
),
|
|
60284
60359
|
/* @__PURE__ */ jsx(
|
|
60285
60360
|
motion.circle,
|
|
60286
60361
|
{
|
|
60287
|
-
cx: "
|
|
60288
|
-
cy: "
|
|
60289
|
-
r: "
|
|
60362
|
+
cx: "72",
|
|
60363
|
+
cy: "72",
|
|
60364
|
+
r: "45",
|
|
60290
60365
|
fill: "none",
|
|
60291
60366
|
stroke: "currentColor",
|
|
60292
60367
|
strokeWidth: "8",
|
|
@@ -60299,7 +60374,7 @@ var FormWizardProgress = ({
|
|
|
60299
60374
|
)
|
|
60300
60375
|
] }),
|
|
60301
60376
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
60302
|
-
/* @__PURE__ */ jsx("p", { className: "text-
|
|
60377
|
+
/* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children: currentStep + 1 }),
|
|
60303
60378
|
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
60304
60379
|
"of ",
|
|
60305
60380
|
steps.length
|
|
@@ -60523,23 +60598,20 @@ var MoonUIFormWizardPro = t__default.forwardRef(({
|
|
|
60523
60598
|
persistData,
|
|
60524
60599
|
storageKey,
|
|
60525
60600
|
children: /* @__PURE__ */ jsxs("div", { ref, className: cn("w-full", className), children: [
|
|
60526
|
-
showProgressBar && /* @__PURE__ */
|
|
60527
|
-
|
|
60528
|
-
|
|
60529
|
-
|
|
60530
|
-
|
|
60531
|
-
|
|
60532
|
-
|
|
60533
|
-
|
|
60534
|
-
|
|
60535
|
-
|
|
60536
|
-
|
|
60537
|
-
|
|
60538
|
-
|
|
60539
|
-
|
|
60540
|
-
),
|
|
60541
|
-
/* @__PURE__ */ jsx(MoonUISeparatorPro, { className: "my-8" })
|
|
60542
|
-
] }),
|
|
60601
|
+
showProgressBar && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
60602
|
+
FormWizardProgress,
|
|
60603
|
+
{
|
|
60604
|
+
className: cn("mb-12", progressClassName),
|
|
60605
|
+
progressType,
|
|
60606
|
+
orientation,
|
|
60607
|
+
showStepNumbers,
|
|
60608
|
+
showStepTitles,
|
|
60609
|
+
stepIconPosition,
|
|
60610
|
+
completedStepIcon,
|
|
60611
|
+
activeStepIcon,
|
|
60612
|
+
errorStepIcon
|
|
60613
|
+
}
|
|
60614
|
+
) }),
|
|
60543
60615
|
/* @__PURE__ */ jsx(MoonUICardPro, { className: cn("border-0 shadow-none", contentClassName), children: /* @__PURE__ */ jsx(MoonUICardContentPro, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
60544
60616
|
FormWizardStep,
|
|
60545
60617
|
{
|
|
@@ -60548,11 +60620,10 @@ var MoonUIFormWizardPro = t__default.forwardRef(({
|
|
|
60548
60620
|
animationDuration
|
|
60549
60621
|
}
|
|
60550
60622
|
) }) }),
|
|
60551
|
-
/* @__PURE__ */ jsx(MoonUISeparatorPro, { className: "my-8" }),
|
|
60552
60623
|
/* @__PURE__ */ jsx(
|
|
60553
60624
|
FormWizardNavigation,
|
|
60554
60625
|
{
|
|
60555
|
-
className: navigationClassName
|
|
60626
|
+
className: cn("mt-8", navigationClassName)
|
|
60556
60627
|
}
|
|
60557
60628
|
)
|
|
60558
60629
|
] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -35,90 +35,194 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
35
35
|
if (progressType === 'linear') {
|
|
36
36
|
return (
|
|
37
37
|
<div className={cn(
|
|
38
|
-
"relative",
|
|
39
|
-
orientation === 'vertical' ? "flex flex-col space-y-8" : "
|
|
38
|
+
"relative w-full",
|
|
39
|
+
orientation === 'vertical' ? "flex flex-col space-y-8" : "",
|
|
40
40
|
className
|
|
41
41
|
)}>
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
{orientation === 'horizontal' ? (
|
|
43
|
+
<div className="relative w-full">
|
|
44
|
+
{/* Progress Line Background - Positioned absolutely */}
|
|
45
|
+
<div
|
|
46
|
+
className="absolute left-6 right-6 h-[2px] bg-gray-200 dark:bg-gray-700"
|
|
47
|
+
style={{
|
|
48
|
+
top: showStepTitles ? '80px' : '24px'
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{/* Progress Line Fill */}
|
|
53
|
+
<motion.div
|
|
54
|
+
className="absolute left-6 h-[2px] bg-primary"
|
|
55
|
+
style={{
|
|
56
|
+
top: showStepTitles ? '80px' : '24px',
|
|
57
|
+
right: `${100 - ((currentStep / (steps.length - 1)) * 100)}%`
|
|
58
|
+
}}
|
|
59
|
+
initial={{ right: '100%' }}
|
|
60
|
+
animate={{
|
|
61
|
+
right: steps.length > 1
|
|
62
|
+
? `${100 - ((currentStep / (steps.length - 1)) * 100)}%`
|
|
63
|
+
: '100%'
|
|
64
|
+
}}
|
|
65
|
+
transition={{ duration: 0.5, ease: "easeInOut" }}
|
|
66
|
+
/>
|
|
51
67
|
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
stepIconPosition === 'inside' ? "w-12 h-12" : "w-10 h-10",
|
|
64
|
-
isActive && "border-primary bg-primary text-primary-foreground shadow-lg",
|
|
65
|
-
isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
|
|
66
|
-
!isActive && !isCompleted && isAccessible && "border-muted-foreground/50 bg-background text-muted-foreground hover:border-muted-foreground",
|
|
67
|
-
!isAccessible && "border-muted bg-muted text-muted-foreground cursor-not-allowed opacity-50",
|
|
68
|
-
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
69
|
-
)}
|
|
70
|
-
>
|
|
71
|
-
{hasError ? (
|
|
72
|
-
errorStepIcon
|
|
73
|
-
) : isCompleted && !isActive ? (
|
|
74
|
-
completedStepIcon
|
|
75
|
-
) : isActive && activeStepIcon ? (
|
|
76
|
-
activeStepIcon
|
|
77
|
-
) : StepIcon ? (
|
|
78
|
-
<span className="w-5 h-5 flex items-center justify-center">{StepIcon}</span>
|
|
79
|
-
) : showStepNumbers ? (
|
|
80
|
-
<span className="text-sm font-medium">{index + 1}</span>
|
|
81
|
-
) : (
|
|
82
|
-
<Circle className="w-4 h-4" />
|
|
83
|
-
)}
|
|
84
|
-
</motion.div>
|
|
68
|
+
{/* Steps Container */}
|
|
69
|
+
<div className="relative flex items-start justify-between w-full">
|
|
70
|
+
{steps.map((step, index) => {
|
|
71
|
+
const isActive = index === currentStep
|
|
72
|
+
const isCompleted = isStepCompleted(index)
|
|
73
|
+
const isAccessible = isStepAccessible(index)
|
|
74
|
+
const hasError = isActive && error
|
|
75
|
+
|
|
76
|
+
const StepIcon = typeof step.icon === 'function'
|
|
77
|
+
? step.icon({ isActive, isCompleted })
|
|
78
|
+
: step.icon
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
<div className=
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</
|
|
80
|
+
return (
|
|
81
|
+
<div key={step.id} className="relative flex flex-col items-center">
|
|
82
|
+
{/* Step Title & Description - Above the circle */}
|
|
83
|
+
{showStepTitles && (
|
|
84
|
+
<div className="text-center mb-3 min-h-[40px] px-2">
|
|
85
|
+
<p className={cn(
|
|
86
|
+
"text-sm font-semibold transition-colors",
|
|
87
|
+
isActive && "text-primary",
|
|
88
|
+
isCompleted && !isActive && "text-primary",
|
|
89
|
+
!isActive && !isCompleted && "text-muted-foreground"
|
|
90
|
+
)}>
|
|
91
|
+
{step.title}
|
|
92
|
+
</p>
|
|
93
|
+
{step.description && (
|
|
94
|
+
<p className="text-xs text-muted-foreground mt-1">
|
|
95
|
+
{step.description}
|
|
96
|
+
</p>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
105
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",
|
|
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-gray-300 bg-background text-gray-500 hover:border-gray-400 dark:border-gray-600 dark:text-gray-400",
|
|
112
|
+
!isAccessible && "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed dark:border-gray-700 dark:bg-gray-900 dark:text-gray-600",
|
|
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
|
+
|
|
131
|
+
{/* Step Label Below Circle */}
|
|
132
|
+
<div className="mt-3">
|
|
133
|
+
<p className="text-xs text-muted-foreground font-medium">
|
|
134
|
+
Step {index + 1} of {steps.length}
|
|
135
|
+
</p>
|
|
136
|
+
</div>
|
|
106
137
|
</div>
|
|
107
|
-
)
|
|
138
|
+
)
|
|
139
|
+
})}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
) : (
|
|
143
|
+
// Vertical orientation
|
|
144
|
+
<div className="relative pl-12">
|
|
145
|
+
{/* Vertical Progress Line */}
|
|
146
|
+
{steps.length > 1 && (
|
|
147
|
+
<>
|
|
148
|
+
<div className="absolute left-6 top-8 bottom-8 w-[2px] bg-gray-200 dark:bg-gray-700" />
|
|
149
|
+
<motion.div
|
|
150
|
+
className="absolute left-6 top-8 w-[2px] bg-primary"
|
|
151
|
+
initial={{ height: 0 }}
|
|
152
|
+
animate={{
|
|
153
|
+
height: `${(currentStep / (steps.length - 1)) * (100 - 16)}%`
|
|
154
|
+
}}
|
|
155
|
+
transition={{ duration: 0.5 }}
|
|
156
|
+
/>
|
|
157
|
+
</>
|
|
158
|
+
)}
|
|
108
159
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
160
|
+
{steps.map((step, index) => {
|
|
161
|
+
const isActive = index === currentStep
|
|
162
|
+
const isCompleted = isStepCompleted(index)
|
|
163
|
+
const isAccessible = isStepAccessible(index)
|
|
164
|
+
const hasError = isActive && error
|
|
165
|
+
|
|
166
|
+
const StepIcon = typeof step.icon === 'function'
|
|
167
|
+
? step.icon({ isActive, isCompleted })
|
|
168
|
+
: step.icon
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<div key={step.id} className="relative flex items-center mb-8 last:mb-0">
|
|
172
|
+
{/* Step Circle */}
|
|
173
|
+
<motion.div
|
|
174
|
+
initial={{ scale: 0.8 }}
|
|
175
|
+
animate={{ scale: isActive ? 1.05 : 1 }}
|
|
176
|
+
className={cn(
|
|
177
|
+
"absolute left-0 z-20 flex items-center justify-center rounded-full border-2 transition-all duration-300",
|
|
178
|
+
"w-12 h-12",
|
|
179
|
+
isActive && "border-primary bg-primary text-primary-foreground shadow-lg",
|
|
180
|
+
isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
|
|
181
|
+
!isActive && !isCompleted && isAccessible && "border-gray-300 bg-background text-gray-500 hover:border-gray-400",
|
|
182
|
+
!isAccessible && "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed",
|
|
183
|
+
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
184
|
+
)}
|
|
185
|
+
>
|
|
186
|
+
{hasError ? (
|
|
187
|
+
errorStepIcon
|
|
188
|
+
) : isCompleted && !isActive ? (
|
|
189
|
+
completedStepIcon
|
|
190
|
+
) : isActive && activeStepIcon ? (
|
|
191
|
+
activeStepIcon
|
|
192
|
+
) : StepIcon ? (
|
|
193
|
+
<span className="w-5 h-5 flex items-center justify-center">{StepIcon}</span>
|
|
194
|
+
) : showStepNumbers ? (
|
|
195
|
+
<span className="text-sm font-semibold">{index + 1}</span>
|
|
196
|
+
) : (
|
|
197
|
+
<Circle className="w-4 h-4" />
|
|
198
|
+
)}
|
|
199
|
+
</motion.div>
|
|
200
|
+
|
|
201
|
+
{/* Step Content */}
|
|
202
|
+
<div className="ml-16">
|
|
203
|
+
{showStepTitles && (
|
|
204
|
+
<>
|
|
205
|
+
<p className={cn(
|
|
206
|
+
"text-sm font-semibold transition-colors",
|
|
207
|
+
isActive && "text-primary",
|
|
208
|
+
isCompleted && !isActive && "text-primary",
|
|
209
|
+
!isActive && !isCompleted && "text-muted-foreground"
|
|
210
|
+
)}>
|
|
211
|
+
{step.title}
|
|
212
|
+
</p>
|
|
213
|
+
{step.description && (
|
|
214
|
+
<p className="text-xs text-muted-foreground mt-1">
|
|
215
|
+
{step.description}
|
|
216
|
+
</p>
|
|
217
|
+
)}
|
|
218
|
+
</>
|
|
219
|
+
)}
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
)
|
|
223
|
+
})}
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
122
226
|
</div>
|
|
123
227
|
)
|
|
124
228
|
}
|
|
@@ -150,25 +254,25 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
150
254
|
|
|
151
255
|
if (progressType === 'circular') {
|
|
152
256
|
const progress = ((currentStep + 1) / steps.length) * 100
|
|
153
|
-
const circumference = 2 * Math.PI *
|
|
257
|
+
const circumference = 2 * Math.PI * 45 // radius = 45
|
|
154
258
|
const strokeDashoffset = circumference - (progress / 100) * circumference
|
|
155
259
|
|
|
156
260
|
return (
|
|
157
|
-
<div className={cn("relative w-
|
|
158
|
-
<svg className="w-full h-full -rotate-90">
|
|
261
|
+
<div className={cn("relative w-36 h-36 mx-auto", className)}>
|
|
262
|
+
<svg className="w-full h-full -rotate-90" viewBox="0 0 144 144">
|
|
159
263
|
<circle
|
|
160
|
-
cx="
|
|
161
|
-
cy="
|
|
162
|
-
r="
|
|
264
|
+
cx="72"
|
|
265
|
+
cy="72"
|
|
266
|
+
r="45"
|
|
163
267
|
fill="none"
|
|
164
268
|
stroke="currentColor"
|
|
165
269
|
strokeWidth="8"
|
|
166
|
-
className="text-
|
|
270
|
+
className="text-gray-200 dark:text-gray-700"
|
|
167
271
|
/>
|
|
168
272
|
<motion.circle
|
|
169
|
-
cx="
|
|
170
|
-
cy="
|
|
171
|
-
r="
|
|
273
|
+
cx="72"
|
|
274
|
+
cy="72"
|
|
275
|
+
r="45"
|
|
172
276
|
fill="none"
|
|
173
277
|
stroke="currentColor"
|
|
174
278
|
strokeWidth="8"
|
|
@@ -181,7 +285,7 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
181
285
|
</svg>
|
|
182
286
|
<div className="absolute inset-0 flex items-center justify-center">
|
|
183
287
|
<div className="text-center">
|
|
184
|
-
<p className="text-
|
|
288
|
+
<p className="text-3xl font-bold">{currentStep + 1}</p>
|
|
185
289
|
<p className="text-sm text-muted-foreground">of {steps.length}</p>
|
|
186
290
|
</div>
|
|
187
291
|
</div>
|
|
@@ -59,7 +59,7 @@ export const MoonUIFormWizardPro = React.forwardRef<HTMLDivElement, FormWizardPr
|
|
|
59
59
|
{showProgressBar && (
|
|
60
60
|
<>
|
|
61
61
|
<FormWizardProgress
|
|
62
|
-
className={progressClassName}
|
|
62
|
+
className={cn("mb-12", progressClassName)}
|
|
63
63
|
progressType={progressType}
|
|
64
64
|
orientation={orientation}
|
|
65
65
|
showStepNumbers={showStepNumbers}
|
|
@@ -69,7 +69,6 @@ export const MoonUIFormWizardPro = React.forwardRef<HTMLDivElement, FormWizardPr
|
|
|
69
69
|
activeStepIcon={activeStepIcon}
|
|
70
70
|
errorStepIcon={errorStepIcon}
|
|
71
71
|
/>
|
|
72
|
-
<Separator className="my-8" />
|
|
73
72
|
</>
|
|
74
73
|
)}
|
|
75
74
|
|
|
@@ -83,10 +82,8 @@ export const MoonUIFormWizardPro = React.forwardRef<HTMLDivElement, FormWizardPr
|
|
|
83
82
|
</CardContent>
|
|
84
83
|
</Card>
|
|
85
84
|
|
|
86
|
-
<Separator className="my-8" />
|
|
87
|
-
|
|
88
85
|
<FormWizardNavigation
|
|
89
|
-
className={navigationClassName}
|
|
86
|
+
className={cn("mt-8", navigationClassName)}
|
|
90
87
|
/>
|
|
91
88
|
</div>
|
|
92
89
|
</FormWizardProvider>
|