allaw-ui 2.5.1 → 2.5.3

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,7 +65,11 @@ var Input = forwardRef(function (_a, ref) {
65
65
  React.createElement("i", { className: endIcon })));
66
66
  }
67
67
  if (style === "password") {
68
- return (React.createElement("button", { className: "Input-button", onClick: function () { return setIsPasswordVisible(!isPasswordVisible); } }, isPasswordVisible ? "CACHER" : "AFFICHER"));
68
+ return (React.createElement("button", { type: "button", className: "Input-button", onClick: function (e) {
69
+ e.preventDefault();
70
+ e.stopPropagation();
71
+ setIsPasswordVisible(function (prev) { return !prev; });
72
+ } }, isPasswordVisible ? "CACHER" : "AFFICHER"));
69
73
  }
70
74
  return null;
71
75
  };
@@ -77,7 +81,10 @@ var Input = forwardRef(function (_a, ref) {
77
81
  "*"))),
78
82
  React.createElement("div", { className: "Input-container" },
79
83
  React.createElement("div", { className: "Input-input ".concat(style === "password" ? "Input-password-input" : "") },
80
- React.createElement("input", { ref: inputRef, type: style === "password" && !isPasswordVisible ? "password" : type, placeholder: placeholder, className: "Input-placeholder", value: value, onChange: function (e) { handleChange(e); rowChange && rowChange(e); }, onBlur: handleBlur })),
84
+ React.createElement("input", { ref: inputRef, type: style === "password" && !isPasswordVisible ? "password" : type, placeholder: placeholder, className: "Input-placeholder", value: value, onChange: function (e) {
85
+ handleChange(e);
86
+ rowChange && rowChange(e);
87
+ }, onBlur: handleBlur })),
81
88
  renderEndIcon(),
82
89
  error && isTouched && (React.createElement("div", { className: "error-message" },
83
90
  React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))))));
@@ -8,6 +8,7 @@ export interface VerificationCodeInputProps {
8
8
  onComplete?: (value: string) => void;
9
9
  testError?: boolean;
10
10
  autoFocus?: boolean;
11
+ isDisabled?: boolean;
11
12
  }
12
13
  declare const VerificationCodeInput: React.FC<VerificationCodeInputProps>;
13
14
  export default VerificationCodeInput;
@@ -11,9 +11,9 @@ import React, { useState, useEffect, useRef } from "react";
11
11
  import styles from "./VerificationCodeInput.module.css";
12
12
  import TinyInfo from "../typography/TinyInfo";
13
13
  var VerificationCodeInput = function (_a) {
14
- var numInputs = _a.numInputs, _b = _a.allowedChars, allowedChars = _b === void 0 ? "numeric" : _b, _c = _a.size, size = _c === void 0 ? "large" : _c, onChange = _a.onChange, onError = _a.onError, onComplete = _a.onComplete, _d = _a.testError, testError = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e;
15
- var _f = useState(Array(numInputs).fill("")), values = _f[0], setValues = _f[1];
16
- var _g = useState(""), error = _g[0], setError = _g[1];
14
+ var numInputs = _a.numInputs, _b = _a.allowedChars, allowedChars = _b === void 0 ? "numeric" : _b, _c = _a.size, size = _c === void 0 ? "large" : _c, onChange = _a.onChange, onError = _a.onError, onComplete = _a.onComplete, _d = _a.testError, testError = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e, _f = _a.isDisabled, isDisabled = _f === void 0 ? false : _f;
15
+ var _g = useState(Array(numInputs).fill("")), values = _g[0], setValues = _g[1];
16
+ var _h = useState(""), error = _h[0], setError = _h[1];
17
17
  var inputRefs = useRef(Array(numInputs).fill(null));
18
18
  useEffect(function () {
19
19
  setValues(Array(numInputs).fill(""));
@@ -134,7 +134,7 @@ var VerificationCodeInput = function (_a) {
134
134
  ? "[a-zA-Z]*"
135
135
  : "[a-zA-Z0-9]*", ref: function (input) { return (inputRefs.current[index] = input); }, autoFocus: index === 0 && autoFocus, tabIndex: index === 0 ? 0 : undefined, "data-lpignore": "true" // Empêche Dashlane d'intervenir
136
136
  , "data-form-type": "other" // Indique que ce n'est pas un champ de mot de passe
137
- })); });
137
+ , disabled: isDisabled })); });
138
138
  };
139
139
  return (React.createElement("div", { className: styles.container },
140
140
  React.createElement("div", { className: styles.inputsContainer }, renderInputs()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",