allaw-ui 1.0.45 → 1.0.46
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,29 +69,32 @@ 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);
|
|
72
73
|
currentPrimaryButton = primaryButton[step - 1];
|
|
73
|
-
if (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.onPrimaryButtonClick)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (!validateStep) return [3 /*break*/, 2];
|
|
77
|
-
return [4 /*yield*/, validateStep(step)];
|
|
74
|
+
if (!(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.onPrimaryButtonClick)) return [3 /*break*/, 2];
|
|
75
|
+
console.log("[Stepper.handleNext] Calling onPrimaryButtonClick");
|
|
76
|
+
return [4 /*yield*/, currentPrimaryButton.onPrimaryButtonClick(step)];
|
|
78
77
|
case 1:
|
|
78
|
+
_a.sent();
|
|
79
|
+
_a.label = 2;
|
|
80
|
+
case 2:
|
|
81
|
+
if (!validateStep) return [3 /*break*/, 4];
|
|
82
|
+
console.log("[Stepper.handleNext] Validating step");
|
|
83
|
+
return [4 /*yield*/, validateStep(step)];
|
|
84
|
+
case 3:
|
|
79
85
|
isValid = _a.sent();
|
|
86
|
+
console.log("[Stepper.handleNext] Validation result:", isValid);
|
|
80
87
|
if (!isValid) {
|
|
88
|
+
console.log("[Stepper.handleNext] Validation failed, stopping");
|
|
81
89
|
return [2 /*return*/];
|
|
82
90
|
}
|
|
83
|
-
_a.label =
|
|
84
|
-
case
|
|
85
|
-
|
|
86
|
-
setStep(step + 1);
|
|
87
|
-
}
|
|
88
|
-
else if (step === steps && onClose) {
|
|
89
|
-
onClose();
|
|
90
|
-
}
|
|
91
|
+
_a.label = 4;
|
|
92
|
+
case 4:
|
|
93
|
+
console.log("[Stepper.handleNext] Step validation successful");
|
|
91
94
|
return [2 /*return*/];
|
|
92
95
|
}
|
|
93
96
|
});
|
|
94
|
-
}); }, [step,
|
|
97
|
+
}); }, [step, validateStep, primaryButton]);
|
|
95
98
|
var handlePrevious = useCallback(function () {
|
|
96
99
|
if (step > 1) {
|
|
97
100
|
setStep(step - 1);
|
|
@@ -116,6 +119,13 @@ var Stepper = function (_a) {
|
|
|
116
119
|
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); } }))),
|
|
117
120
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
118
121
|
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]);
|
|
119
129
|
return portalContainerRef.current && isVisible
|
|
120
130
|
? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
|
|
121
131
|
: null;
|