allaw-ui 0.1.15 → 0.1.16
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.
|
@@ -9,7 +9,7 @@ import PrimaryButton from "../../atoms/buttons/PrimaryButton";
|
|
|
9
9
|
import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
10
10
|
var Stepper = function (_a) {
|
|
11
11
|
var steps = _a.steps, currentStep = _a.currentStep, _b = _a.startIcon, startIcon = _b === void 0 ? [] : _b, _c = _a.endIcon, endIcon = _c === void 0 ? true : _c, children = _a.children, _d = _a.secondaryButton, secondaryButton = _d === void 0 ? [] : _d, _e = _a.primaryButton, primaryButton = _e === void 0 ? [] : _e, _f = _a.showProgressBar, showProgressBar = _f === void 0 ? [] : _f, onClose = _a.onClose, validateStep = _a.validateStep;
|
|
12
|
-
var _g = useState(currentStep), step = _g[0], setStep = _g[1];
|
|
12
|
+
var _g = useState(currentStep || 1), step = _g[0], setStep = _g[1];
|
|
13
13
|
var _h = useState(false), isVisible = _h[0], setIsVisible = _h[1];
|
|
14
14
|
var portalContainerRef = useRef(null);
|
|
15
15
|
useEffect(function () {
|
|
@@ -26,7 +26,7 @@ var Stepper = function (_a) {
|
|
|
26
26
|
};
|
|
27
27
|
}, []);
|
|
28
28
|
useEffect(function () {
|
|
29
|
-
setStep(currentStep);
|
|
29
|
+
setStep(currentStep || 1);
|
|
30
30
|
}, [currentStep]);
|
|
31
31
|
var handleNext = useCallback(function () {
|
|
32
32
|
// console.log("Stepper: Validating current step");
|
|
@@ -55,8 +55,8 @@ var Stepper = function (_a) {
|
|
|
55
55
|
setStep(step - 1);
|
|
56
56
|
}
|
|
57
57
|
}, [step]);
|
|
58
|
-
var currentSecondaryButton = secondaryButton[step - 1];
|
|
59
|
-
var currentPrimaryButton = primaryButton[step - 1];
|
|
58
|
+
var currentSecondaryButton = secondaryButton[step - 1] || {};
|
|
59
|
+
var currentPrimaryButton = primaryButton[step - 1] || {};
|
|
60
60
|
var currentShowProgressBar = showProgressBar[step - 1] !== false;
|
|
61
61
|
var currentShowStartIcon = startIcon[step - 1];
|
|
62
62
|
var handleClose = useCallback(function () {
|