allaw-ui 2.6.1 → 2.6.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.
@@ -14,6 +14,7 @@ var VerificationCodeInput = function (_a) {
14
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
15
  var _g = useState(Array(numInputs).fill("")), values = _g[0], setValues = _g[1];
16
16
  var _h = useState(""), error = _h[0], setError = _h[1];
17
+ var _j = useState(false), isSmallScreen = _j[0], setIsSmallScreen = _j[1];
17
18
  var inputRefs = useRef(Array(numInputs).fill(null));
18
19
  useEffect(function () {
19
20
  setValues(Array(numInputs).fill(""));
@@ -29,6 +30,17 @@ var VerificationCodeInput = function (_a) {
29
30
  onError === null || onError === void 0 ? void 0 : onError(null);
30
31
  }
31
32
  }, [testError, onError]);
33
+ useEffect(function () {
34
+ var checkScreenSize = function () {
35
+ setIsSmallScreen(window.innerWidth < 400);
36
+ };
37
+ // Vérifier la taille initiale
38
+ checkScreenSize();
39
+ // Ajouter un écouteur d'événement pour les changements de taille
40
+ window.addEventListener("resize", checkScreenSize);
41
+ // Nettoyer l'écouteur d'événement
42
+ return function () { return window.removeEventListener("resize", checkScreenSize); };
43
+ }, []);
32
44
  var handleInputChange = function (index, value) {
33
45
  // console.log(`[VerificationCodeInput] Input ${index} changed to:`, value);
34
46
  var _a;
@@ -128,7 +140,7 @@ var VerificationCodeInput = function (_a) {
128
140
  return regex.test(value);
129
141
  };
130
142
  var renderInputs = function () {
131
- return values.map(function (value, index) { return (React.createElement("input", { key: index, className: "".concat(styles.input, " ").concat(styles[size], " ").concat(value ? styles.filledInput : ""), value: value, onChange: function (e) { return handleInputChange(index, e.target.value); }, onKeyDown: function (e) { return handleKeyDown(index, e); }, onPaste: index === 0 ? handlePaste : undefined, onBlur: handleBlur, maxLength: 1, inputMode: allowedChars === "numeric" ? "numeric" : "text", pattern: allowedChars === "numeric"
143
+ return values.map(function (value, index) { return (React.createElement("input", { key: index, className: "".concat(styles.input, " ").concat(styles[size], " ").concat(value ? styles.filledInput : "", " ").concat(isSmallScreen ? styles.responsive : ""), value: value, onChange: function (e) { return handleInputChange(index, e.target.value); }, onKeyDown: function (e) { return handleKeyDown(index, e); }, onPaste: index === 0 ? handlePaste : undefined, onBlur: handleBlur, maxLength: 1, inputMode: allowedChars === "numeric" ? "numeric" : "text", pattern: allowedChars === "numeric"
132
144
  ? "[0-9]*"
133
145
  : allowedChars === "alphabetic"
134
146
  ? "[a-zA-Z]*"
@@ -136,8 +148,8 @@ var VerificationCodeInput = function (_a) {
136
148
  , "data-form-type": "other" // Indique que ce n'est pas un champ de mot de passe
137
149
  , disabled: isDisabled })); });
138
150
  };
139
- return (React.createElement("div", { className: styles.container },
140
- React.createElement("div", { className: styles.inputsContainer }, renderInputs()),
151
+ return (React.createElement("div", { className: "".concat(styles.container, " ").concat(isSmallScreen ? styles.responsiveContainer : "") },
152
+ React.createElement("div", { className: "".concat(styles.inputsContainer, " ").concat(isSmallScreen ? styles.responsiveInputsContainer : "") }, renderInputs()),
141
153
  error && (React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))));
142
154
  };
143
155
  export default VerificationCodeInput;
@@ -82,3 +82,38 @@
82
82
  height: 56px;
83
83
  font-size: 20px;
84
84
  }
85
+
86
+ /* Styles responsifs pour les petits écrans (moins de 400px) */
87
+ .responsiveContainer {
88
+ gap: 6px;
89
+ }
90
+
91
+ .responsiveInputsContainer {
92
+ gap: 6px;
93
+ }
94
+
95
+ .responsive.small {
96
+ width: 32px;
97
+ height: 32px;
98
+ font-size: 14px;
99
+ }
100
+
101
+ .responsive.medium {
102
+ width: 38px;
103
+ height: 38px;
104
+ font-size: 16px;
105
+ }
106
+
107
+ .responsive.large {
108
+ width: 44px;
109
+ height: 44px;
110
+ font-size: 18px;
111
+ }
112
+
113
+ /* Media query pour les petits écrans */
114
+ @media (max-width: 400px) {
115
+ .input {
116
+ border-width: 1.5px;
117
+ border-radius: 6px;
118
+ }
119
+ }
@@ -56,4 +56,26 @@ declare namespace _default {
56
56
  export default _default;
57
57
  export const Default: any;
58
58
  export const WithError: any;
59
+ export function Responsive(args: any): React.JSX.Element;
60
+ export namespace Responsive {
61
+ export namespace args {
62
+ let numInputs_1: number;
63
+ export { numInputs_1 as numInputs };
64
+ let size_1: string;
65
+ export { size_1 as size };
66
+ }
67
+ export namespace parameters_1 {
68
+ namespace docs {
69
+ export namespace description_4 {
70
+ let story: string;
71
+ }
72
+ export { description_4 as description };
73
+ }
74
+ namespace viewport {
75
+ let defaultViewport: string;
76
+ }
77
+ }
78
+ export { parameters_1 as parameters };
79
+ }
59
80
  import VerificationCodeInput from "./VerificationCodeInput";
81
+ import React from "react";
@@ -70,3 +70,20 @@ WithError.parameters = {
70
70
  },
71
71
  },
72
72
  };
73
+ export var Responsive = function (args) { return (React.createElement("div", null,
74
+ React.createElement("p", { style: { marginBottom: "10px" } }, "Redimensionnez la fen\u00EAtre \u00E0 moins de 400px pour voir le design responsive"),
75
+ React.createElement(VerificationCodeInput, __assign({}, args)))); };
76
+ Responsive.args = {
77
+ numInputs: 6,
78
+ size: "large",
79
+ };
80
+ Responsive.parameters = {
81
+ docs: {
82
+ description: {
83
+ story: "Montre le comportement responsive du composant lorsque la largeur de l'écran est inférieure à 400px",
84
+ },
85
+ },
86
+ viewport: {
87
+ defaultViewport: "mobile1",
88
+ },
89
+ };
@@ -199,3 +199,19 @@
199
199
  transform: scale(1);
200
200
  }
201
201
  }
202
+
203
+ .stepper-button-container.auto-width {
204
+ width: auto;
205
+ margin: 0 auto;
206
+ }
207
+
208
+ .stepper-button-container.auto-width button {
209
+ width: auto;
210
+ min-width: 150px;
211
+ padding-left: 24px;
212
+ padding-right: 24px;
213
+ }
214
+
215
+ .stepper-buttons .primary-button-container.auto-width:only-child {
216
+ width: auto;
217
+ }
@@ -16,6 +16,7 @@ export interface StepperProps {
16
16
  startIconName?: string;
17
17
  endIconName?: string;
18
18
  onSecondaryButtonClick?: (step: number) => void;
19
+ fullWidth?: boolean;
19
20
  }[];
20
21
  primaryButton?: {
21
22
  show: boolean;
@@ -26,6 +27,7 @@ export interface StepperProps {
26
27
  endIconName?: string;
27
28
  onPrimaryButtonClick?: (step: number) => void;
28
29
  disabled?: boolean;
30
+ fullWidth?: boolean;
29
31
  }[];
30
32
  showProgressBar?: boolean[];
31
33
  onClose?: () => void;
@@ -131,10 +131,10 @@ var Stepper = function (_a) {
131
131
  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)
132
132
  ? "no-buttons"
133
133
  : "") },
134
- (currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container" },
135
- 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); } }))),
136
- (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
137
- React.createElement(PrimaryButton, { fullWidth: true, label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, disabled: currentPrimaryButton.disabled, onClick: handleNext })))),
134
+ (currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container ".concat(currentSecondaryButton.fullWidth === false ? "auto-width" : "") },
135
+ React.createElement(SecondaryButton, { fullWidth: currentSecondaryButton.fullWidth !== false, 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); } }))),
136
+ (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container ".concat(currentPrimaryButton.fullWidth === false ? "auto-width" : "") },
137
+ React.createElement(PrimaryButton, { fullWidth: currentPrimaryButton.fullWidth !== false, label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, disabled: currentPrimaryButton.disabled, onClick: handleNext })))),
138
138
  React.createElement(ConfirmationModal, { show: (_b = confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.show) !== null && _b !== void 0 ? _b : false, title: (_c = confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.title) !== null && _c !== void 0 ? _c : "Confirmation", description: (_d = confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.description) !== null && _d !== void 0 ? _d : "Voulez-vous continuer ?", confirmLabel: (_e = confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.confirmLabel) !== null && _e !== void 0 ? _e : "Confirmer", cancelLabel: (_f = confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.cancelLabel) !== null && _f !== void 0 ? _f : "Annuler", onConfirm: onModalConfirm !== null && onModalConfirm !== void 0 ? onModalConfirm : (function () { }), onCancel: onModalCancel !== null && onModalCancel !== void 0 ? onModalCancel : (function () { }), isDanger: confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.isDanger }))));
139
139
  return portalContainerRef.current && isVisible
140
140
  ? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",