allaw-ui 0.1.29 → 0.1.30
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.
|
@@ -4,8 +4,8 @@ import "../../../styles/global.css";
|
|
|
4
4
|
import "../../../styles/icons.css";
|
|
5
5
|
var ProgressBar = function (_a) {
|
|
6
6
|
var steps = _a.steps, currentStep = _a.currentStep, _b = _a.startIcon, startIcon = _b === void 0 ? true : _b, _c = _a.endIcon, endIcon = _c === void 0 ? true : _c, onStartIconClick = _a.onStartIconClick, onEndIconClick = _a.onEndIconClick, _d = _a.showProgressBar, showProgressBar = _d === void 0 ? true : _d;
|
|
7
|
-
var constrainedCurrentStep = Math.max(
|
|
8
|
-
var progressWidth =
|
|
7
|
+
var constrainedCurrentStep = Math.max(0, Math.min(currentStep, steps));
|
|
8
|
+
var progressWidth = constrainedCurrentStep === 0 ? 0 : (constrainedCurrentStep / steps) * 100;
|
|
9
9
|
return (React.createElement("div", { className: "progress-bar-container" },
|
|
10
10
|
startIcon && currentStep > 1 && (React.createElement("div", { className: "progress-bar-icon-container" },
|
|
11
11
|
React.createElement("button", { className: "progress-bar-chevron", onClick: onStartIconClick },
|
|
@@ -11,7 +11,10 @@ export interface StepperProps {
|
|
|
11
11
|
secondaryButton?: {
|
|
12
12
|
show: boolean;
|
|
13
13
|
label: string;
|
|
14
|
-
|
|
14
|
+
startIcon?: React.ReactNode;
|
|
15
|
+
endIcon?: React.ReactNode;
|
|
16
|
+
startIconName?: string;
|
|
17
|
+
endIconName?: string;
|
|
15
18
|
onSecondaryButtonClick?: (step: number) => void;
|
|
16
19
|
}[];
|
|
17
20
|
primaryButton?: {
|
|
@@ -113,7 +113,7 @@ var Stepper = function (_a) {
|
|
|
113
113
|
React.createElement("div", { className: "stepper-content" }, children[step - 1]),
|
|
114
114
|
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" : "") },
|
|
115
115
|
(currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container" },
|
|
116
|
-
React.createElement(SecondaryButton, { label: currentSecondaryButton.label, startIcon: currentSecondaryButton.
|
|
116
|
+
React.createElement(SecondaryButton, { 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
117
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
118
118
|
React.createElement(PrimaryButton, { label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, onClick: handleNext })))))));
|
|
119
119
|
return portalContainerRef.current && isVisible
|