allaw-ui 0.1.12 → 0.1.14
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useState, useEffect, useCallback, useRef } from "react";
|
|
2
3
|
import ReactDOM from "react-dom";
|
|
3
4
|
import "./Stepper.css";
|
|
4
5
|
import "../../../styles/global.css";
|
|
@@ -9,13 +10,16 @@ import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
|
9
10
|
var Stepper = function (_a) {
|
|
10
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;
|
|
11
12
|
var _g = useState(currentStep), step = _g[0], setStep = _g[1];
|
|
12
|
-
var
|
|
13
|
+
var portalContainerRef = useRef(null);
|
|
13
14
|
useEffect(function () {
|
|
14
15
|
var container = document.createElement("div");
|
|
15
16
|
document.body.appendChild(container);
|
|
16
|
-
|
|
17
|
+
portalContainerRef.current = container;
|
|
17
18
|
return function () {
|
|
18
|
-
|
|
19
|
+
if (portalContainerRef.current &&
|
|
20
|
+
document.body.contains(portalContainerRef.current)) {
|
|
21
|
+
document.body.removeChild(portalContainerRef.current);
|
|
22
|
+
}
|
|
19
23
|
};
|
|
20
24
|
}, []);
|
|
21
25
|
useEffect(function () {
|
|
@@ -61,8 +65,8 @@ var Stepper = function (_a) {
|
|
|
61
65
|
React.createElement(SecondaryButton, { label: currentSecondaryButton.label, startIcon: currentSecondaryButton.icon, onClick: function () { var _a; return (_a = currentSecondaryButton.onSecondaryButtonClick) === null || _a === void 0 ? void 0 : _a.call(currentSecondaryButton, step); } }))),
|
|
62
66
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
63
67
|
React.createElement(PrimaryButton, { label: currentPrimaryButton.label, onClick: handleNext })))))));
|
|
64
|
-
return
|
|
65
|
-
? ReactDOM.createPortal(stepperContent,
|
|
68
|
+
return portalContainerRef.current
|
|
69
|
+
? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
|
|
66
70
|
: null;
|
|
67
71
|
};
|
|
68
72
|
export default Stepper;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export { default as ContactCard } from "./components/molecules/contactCard/Conta
|
|
|
36
36
|
export { default as DocumentCard } from "./components/molecules/documentCard/DocumentCard";
|
|
37
37
|
export { default as EmployeeCard } from "./components/molecules/employeeCard/EmployeeCard";
|
|
38
38
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
39
|
+
export type { StepperProps } from "./components/molecules/stepper/Stepper";
|
|
39
40
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
40
41
|
export { default as Breadcrumb } from "./components/molecules/breadcrumb/Breadcrumb";
|
|
41
42
|
export { default as ProCard } from "./components/molecules/proCard/ProCard";
|