allaw-ui 1.0.46 → 1.0.48
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.
|
@@ -69,32 +69,29 @@ var Stepper = function (_a) {
|
|
|
69
69
|
return __generator(this, function (_a) {
|
|
70
70
|
switch (_a.label) {
|
|
71
71
|
case 0:
|
|
72
|
-
console.log("[Stepper.handleNext] Starting with step:", step);
|
|
73
72
|
currentPrimaryButton = primaryButton[step - 1];
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_a.sent();
|
|
79
|
-
_a.label = 2;
|
|
80
|
-
case 2:
|
|
81
|
-
if (!validateStep) return [3 /*break*/, 4];
|
|
82
|
-
console.log("[Stepper.handleNext] Validating step");
|
|
73
|
+
if (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.onPrimaryButtonClick) {
|
|
74
|
+
currentPrimaryButton.onPrimaryButtonClick(step);
|
|
75
|
+
}
|
|
76
|
+
if (!validateStep) return [3 /*break*/, 2];
|
|
83
77
|
return [4 /*yield*/, validateStep(step)];
|
|
84
|
-
case
|
|
78
|
+
case 1:
|
|
85
79
|
isValid = _a.sent();
|
|
86
|
-
console.log("[Stepper.handleNext] Validation result:", isValid);
|
|
87
80
|
if (!isValid) {
|
|
88
|
-
console.log("[Stepper.handleNext] Validation failed, stopping");
|
|
89
81
|
return [2 /*return*/];
|
|
90
82
|
}
|
|
91
|
-
_a.label =
|
|
92
|
-
case
|
|
93
|
-
|
|
83
|
+
_a.label = 2;
|
|
84
|
+
case 2:
|
|
85
|
+
if (step < steps) {
|
|
86
|
+
setStep(step + 1);
|
|
87
|
+
}
|
|
88
|
+
else if (step === steps && onClose) {
|
|
89
|
+
onClose();
|
|
90
|
+
}
|
|
94
91
|
return [2 /*return*/];
|
|
95
92
|
}
|
|
96
93
|
});
|
|
97
|
-
}); }, [step, validateStep, primaryButton]);
|
|
94
|
+
}); }, [step, steps, validateStep, primaryButton, onClose]);
|
|
98
95
|
var handlePrevious = useCallback(function () {
|
|
99
96
|
if (step > 1) {
|
|
100
97
|
setStep(step - 1);
|
|
@@ -119,13 +116,6 @@ var Stepper = function (_a) {
|
|
|
119
116
|
React.createElement(SecondaryButton, { fullWidth: true, label: currentSecondaryButton.label, startIcon: currentSecondaryButton.startIconName ? true : undefined, endIcon: currentSecondaryButton.endIconName ? true : undefined, startIconName: currentSecondaryButton.startIconName, endIconName: currentSecondaryButton.endIconName, onClick: function () { var _a; return (_a = currentSecondaryButton.onSecondaryButtonClick) === null || _a === void 0 ? void 0 : _a.call(currentSecondaryButton, step); } }))),
|
|
120
117
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
121
118
|
React.createElement(PrimaryButton, { fullWidth: true, label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, disabled: currentPrimaryButton.disabled, onClick: handleNext })))))));
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
console.log("[Stepper] Step changed:", {
|
|
124
|
-
step: step,
|
|
125
|
-
currentStep: currentStep,
|
|
126
|
-
totalSteps: steps,
|
|
127
|
-
});
|
|
128
|
-
}, [step, currentStep, steps]);
|
|
129
119
|
return portalContainerRef.current && isVisible
|
|
130
120
|
? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
|
|
131
121
|
: null;
|