allaw-ui 1.0.47 → 1.0.50
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.
|
@@ -65,35 +65,22 @@ var Stepper = function (_a) {
|
|
|
65
65
|
return __generator(this, function (_a) {
|
|
66
66
|
switch (_a.label) {
|
|
67
67
|
case 0:
|
|
68
|
-
console.log("[Stepper.handleNext] Starting with step:", currentStep);
|
|
69
68
|
currentPrimaryButton = primaryButton[currentStep - 1];
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
_a.sent();
|
|
75
|
-
_a.label = 2;
|
|
76
|
-
case 2:
|
|
77
|
-
if (!validateStep) return [3 /*break*/, 4];
|
|
78
|
-
console.log("[Stepper.handleNext] Validating step");
|
|
69
|
+
if (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.onPrimaryButtonClick) {
|
|
70
|
+
currentPrimaryButton.onPrimaryButtonClick(currentStep);
|
|
71
|
+
}
|
|
72
|
+
if (!validateStep) return [3 /*break*/, 2];
|
|
79
73
|
return [4 /*yield*/, validateStep(currentStep)];
|
|
80
|
-
case
|
|
74
|
+
case 1:
|
|
81
75
|
isValid = _a.sent();
|
|
82
|
-
console.log("[Stepper.handleNext] Validation result:", isValid);
|
|
83
76
|
if (!isValid) {
|
|
84
|
-
console.log("[Stepper.handleNext] Validation failed");
|
|
85
77
|
return [2 /*return*/];
|
|
86
78
|
}
|
|
87
|
-
_a.label =
|
|
88
|
-
case
|
|
79
|
+
_a.label = 2;
|
|
80
|
+
case 2: return [2 /*return*/];
|
|
89
81
|
}
|
|
90
82
|
});
|
|
91
83
|
}); }, [currentStep, validateStep, primaryButton]);
|
|
92
|
-
var handleClose = useCallback(function () {
|
|
93
|
-
if (onClose) {
|
|
94
|
-
onClose();
|
|
95
|
-
}
|
|
96
|
-
}, [onClose]);
|
|
97
84
|
var handlePrevious = useCallback(function () {
|
|
98
85
|
var currentSecondaryButton = secondaryButton[currentStep - 1];
|
|
99
86
|
if (currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.onSecondaryButtonClick) {
|
|
@@ -104,8 +91,14 @@ var Stepper = function (_a) {
|
|
|
104
91
|
var currentPrimaryButton = primaryButton[currentStep - 1] || {};
|
|
105
92
|
var currentShowProgressBar = showProgressBar[currentStep - 1] !== false;
|
|
106
93
|
var currentShowStartIcon = startIcon[currentStep - 1];
|
|
107
|
-
var
|
|
108
|
-
|
|
94
|
+
var handleClose = useCallback(function () {
|
|
95
|
+
setIsVisible(false);
|
|
96
|
+
if (onClose) {
|
|
97
|
+
onClose();
|
|
98
|
+
}
|
|
99
|
+
}, [onClose]);
|
|
100
|
+
var stepperContent = (React.createElement("div", { className: "stepper-overlay ".concat(isVisible ? "visible" : ""), onClick: handleClose },
|
|
101
|
+
React.createElement("div", { className: "stepper-container", onClick: function (e) { return e.stopPropagation(); } },
|
|
109
102
|
React.createElement(ProgressBar, { steps: steps, currentStep: currentStep, startIcon: currentShowStartIcon, endIcon: endIcon, onStartIconClick: handlePrevious, onEndIconClick: handleClose, showProgressBar: currentShowProgressBar }),
|
|
110
103
|
React.createElement("div", { className: "stepper-content" }, children[currentStep - 1]),
|
|
111
104
|
React.createElement("div", { className: "stepper-buttons ".concat(!(currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && !(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) ? "no-buttons" : "") },
|
|
@@ -113,9 +106,6 @@ var Stepper = function (_a) {
|
|
|
113
106
|
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, currentStep); } }))),
|
|
114
107
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
115
108
|
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 })))))));
|
|
116
|
-
useEffect(function () {
|
|
117
|
-
console.log("[Stepper] currentStep changed:", currentStep);
|
|
118
|
-
}, [currentStep]);
|
|
119
109
|
return portalContainerRef.current && isVisible
|
|
120
110
|
? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
|
|
121
111
|
: null;
|