allaw-ui 2.0.1 → 2.0.4

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.
@@ -47,6 +47,7 @@ var Stepper = function (_a) {
47
47
  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;
48
48
  var _g = useState(false), isVisible = _g[0], setIsVisible = _g[1];
49
49
  var portalContainerRef = useRef(null);
50
+ var stepperContainerRef = useRef(null);
50
51
  useEffect(function () {
51
52
  var container = document.createElement("div");
52
53
  document.body.appendChild(container);
@@ -97,11 +98,21 @@ var Stepper = function (_a) {
97
98
  onClose();
98
99
  }
99
100
  }, [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(); } },
101
+ var handleMouseDown = useCallback(function (e) {
102
+ var selectList = document.querySelector('[class*="selectList"]');
103
+ if (stepperContainerRef.current &&
104
+ !stepperContainerRef.current.contains(e.target) &&
105
+ !(selectList === null || selectList === void 0 ? void 0 : selectList.contains(e.target))) {
106
+ handleClose();
107
+ }
108
+ }, [handleClose]);
109
+ var stepperContent = (React.createElement("div", { className: "stepper-overlay ".concat(isVisible ? "visible" : ""), onMouseDown: handleMouseDown },
110
+ React.createElement("div", { className: "stepper-container", onClick: function (e) { return e.stopPropagation(); }, ref: stepperContainerRef },
102
111
  React.createElement(ProgressBar, { steps: steps, currentStep: currentStep, startIcon: currentShowStartIcon, endIcon: endIcon, onStartIconClick: handlePrevious, onEndIconClick: handleClose, showProgressBar: currentShowProgressBar }),
103
112
  React.createElement("div", { className: "stepper-content" }, children[currentStep - 1]),
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
+ 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)
114
+ ? "no-buttons"
115
+ : "") },
105
116
  (currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container" },
106
117
  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); } }))),
107
118
  (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
@@ -7,9 +7,9 @@ declare const meta: {
7
7
  layout: string;
8
8
  };
9
9
  args: {
10
- onLogin: import("@vitest/spy").Mock<[], void>;
11
- onLogout: import("@vitest/spy").Mock<[], void>;
12
- onCreateAccount: import("@vitest/spy").Mock<[], void>;
10
+ onLogin: import("@vitest/spy").Mock<(...args: any[]) => any>;
11
+ onLogout: import("@vitest/spy").Mock<(...args: any[]) => any>;
12
+ onCreateAccount: import("@vitest/spy").Mock<(...args: any[]) => any>;
13
13
  };
14
14
  };
15
15
  export default meta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",