allaw-ui 3.5.9 → 3.6.1

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,7 +4,7 @@ import styles from "./InboxButton.module.css";
4
4
  var InboxButton = function (_a) {
5
5
  var _b = _a.count, count = _b === void 0 ? 0 : _b, onClick = _a.onClick, labels = _a.labels, dataCy = _a.dataCy, _c = _a.scheme, scheme = _c === void 0 ? "notification" : _c, iconClassName = _a.iconClassName, iconAriaLabel = _a.iconAriaLabel;
6
6
  var isZero = count === 0;
7
- var isDisabled = scheme === "notification" && isZero;
7
+ var isDisabled = scheme === "qualification" && isZero;
8
8
  var isQualificationZero = scheme === "qualification" && isZero;
9
9
  // Choix du label
10
10
  var label = isZero
@@ -38,7 +38,7 @@ var InboxButton = function (_a) {
38
38
  }
39
39
  return (React.createElement("button", { className: clsx(styles.inboxBtn, isDisabled && styles.disabled, isQualificationZero && styles.qualificationZero, !isDisabled && !isQualificationZero && styles["bg-".concat(bgKey)], scheme === "qualification" &&
40
40
  !isQualificationZero &&
41
- styles.qualificationActive), disabled: isDisabled, onClick: onClick, "data-cy": dataCy },
41
+ styles.qualificationActive, scheme === "notification" && !isZero && styles.notifActive), disabled: isDisabled, onClick: onClick, "data-cy": dataCy },
42
42
  iconClassName && (React.createElement("i", { className: clsx(styles.icon, iconClassName, !isDisabled && !isQualificationZero && styles["color-".concat(colorKey)], isQualificationZero && styles.colorDarkGrey, scheme === "qualification" &&
43
43
  !isQualificationZero &&
44
44
  styles.colorNoir), "aria-label": iconAriaLabel })),
@@ -9,18 +9,20 @@
9
9
  width: 100%;
10
10
  border: none;
11
11
  border-radius: 0.5rem;
12
+ }
13
+
14
+ .notifActive {
12
15
  cursor: pointer;
13
16
  }
14
17
 
15
- .inboxBtn:hover:not(.disabled):not(.qualificationZero):not(
16
- .qualificationActive
17
- ) {
18
- background-color: #fbe8e8;
18
+ .notifActive:hover {
19
+ cursor: pointer;
19
20
  }
20
21
 
21
22
  .qualificationActive:hover {
22
23
  background-color: #000000;
23
24
  color: #25beeb;
25
+ cursor: pointer;
24
26
  }
25
27
 
26
28
  .qualificationActive:hover .icon {
@@ -32,16 +34,16 @@
32
34
  }
33
35
 
34
36
  .disabled {
35
- cursor: initial;
37
+ cursor: default;
36
38
  background-color: #daebfb;
37
- color: #1985e8;
39
+ /* color: #1985e8; */
38
40
  }
39
41
 
40
42
  .qualificationZero {
41
43
  cursor: initial;
42
44
  background-color: #ffffff;
43
45
  color: #d1dce8;
44
- border: 2px solid #d1dce8;
46
+ border: 2px solid #e6edf5;
45
47
  }
46
48
 
47
49
  .qualificationActive {
@@ -74,7 +76,7 @@
74
76
  }
75
77
 
76
78
  .labelDisabled {
77
- color: #1985e8;
79
+ color: #d1dce8;
78
80
  }
79
81
 
80
82
  .bg-mid-grey {
@@ -66,6 +66,7 @@
66
66
  border: 2px solid var(--grey-venom, #e6edf5);
67
67
  background: var(--Primary-Blanc, #fff);
68
68
  padding: 10px;
69
+ position: relative;
69
70
  }
70
71
 
71
72
  .Input-default .Input-input:hover {
@@ -81,6 +82,7 @@
81
82
  border: none;
82
83
  outline: none;
83
84
  color: var(--noir);
85
+ padding-right: 30px;
84
86
  }
85
87
 
86
88
  /* Style variation */
@@ -116,6 +118,7 @@
116
118
  border: 2px solid var(--grey-venom, #e6edf5);
117
119
  background: var(--Primary-Blanc, #fff);
118
120
  padding: 10px;
121
+ position: relative;
119
122
  }
120
123
 
121
124
  .Input-variation .Input-input:hover {
@@ -131,6 +134,7 @@
131
134
  border: none;
132
135
  outline: none;
133
136
  color: var(--noir);
137
+ padding-right: 30px;
134
138
  }
135
139
 
136
140
  .Input-variation .Input-icon-button {
@@ -200,6 +204,7 @@
200
204
  flex: 1;
201
205
  flex-direction: column;
202
206
  align-items: flex-start;
207
+ position: relative;
203
208
  }
204
209
 
205
210
  .Input-password .Input-input input {
@@ -207,6 +212,7 @@
207
212
  border: none;
208
213
  outline: none;
209
214
  color: var(--noir);
215
+ padding-right: 30px;
210
216
  }
211
217
 
212
218
  .Input-password .Input-button {
@@ -230,3 +236,36 @@
230
236
  padding-left: 4px;
231
237
  width: 100%;
232
238
  }
239
+
240
+ /* Nouveaux styles pour les fonctionnalités ajoutées */
241
+
242
+ /* Style prefilled */
243
+ .Input-prefilled {
244
+ background-color: rgba(255, 200, 87, 0.15) !important;
245
+ border-color: var(--actions-warning, #ffc857) !important;
246
+ }
247
+
248
+ /* Bouton clear */
249
+ .Input-clear-button {
250
+ position: absolute;
251
+ right: 10px;
252
+ top: 50%;
253
+ transform: translateY(-50%);
254
+ cursor: pointer;
255
+ color: var(--actions-error, #e15151);
256
+ font-weight: medium;
257
+ font-size: 1.5rem;
258
+ background: none;
259
+ border: none;
260
+ padding: 0;
261
+ width: 16px;
262
+ height: 16px;
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ z-index: 2;
267
+ }
268
+
269
+ .Input-clear-button:hover {
270
+ color: #c62828;
271
+ }
@@ -21,6 +21,9 @@ export interface InputProps {
21
21
  color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "grey-venom" | "venom-grey-dark";
22
22
  variant?: "bold" | "semiBold" | "medium";
23
23
  disableZoom?: boolean;
24
+ isPrefilled?: boolean;
25
+ showClearButton?: boolean;
26
+ disableAutofill?: boolean;
24
27
  }
25
28
  export interface InputRef {
26
29
  validate: () => boolean;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import React, { useState, useEffect, useCallback, forwardRef, useImperativeHandle, useRef, } from "react";
2
13
  import "./Input.css";
3
14
  import "../../../styles/global.css";
@@ -6,11 +17,11 @@ import { commonRegex } from "../../../utils/regex";
6
17
  import TinyInfo from "../typography/TinyInfo";
7
18
  import Paragraph from "../typography/Paragraph";
8
19
  var Input = forwardRef(function (_a, ref) {
9
- var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, rowChange = _a.rowChange, placeholder = _a.placeholder, endIcon = _a.endIcon, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, _d = _a.type, type = _d === void 0 ? "text" : _d, propError = _a.error, _e = _a.color, color = _e === void 0 ? "noir" : _e, _f = _a.variant, variant = _f === void 0 ? "medium" : _f, onKeyDown = _a.onKeyDown, name = _a.name, _g = _a.disableZoom, disableZoom = _g === void 0 ? false : _g;
10
- var _h = useState(false), isPasswordVisible = _h[0], setIsPasswordVisible = _h[1];
11
- var _j = useState(propValue || ""), value = _j[0], setValue = _j[1];
12
- var _k = useState(propError || ""), error = _k[0], setError = _k[1];
13
- var _l = useState(false), isTouched = _l[0], setIsTouched = _l[1];
20
+ var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, rowChange = _a.rowChange, placeholder = _a.placeholder, endIcon = _a.endIcon, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, _d = _a.type, type = _d === void 0 ? "text" : _d, propError = _a.error, _e = _a.color, color = _e === void 0 ? "noir" : _e, _f = _a.variant, variant = _f === void 0 ? "medium" : _f, onKeyDown = _a.onKeyDown, name = _a.name, _g = _a.disableZoom, disableZoom = _g === void 0 ? false : _g, _h = _a.isPrefilled, isPrefilled = _h === void 0 ? false : _h, _j = _a.showClearButton, showClearButton = _j === void 0 ? false : _j, _k = _a.disableAutofill, disableAutofill = _k === void 0 ? false : _k;
21
+ var _l = useState(false), isPasswordVisible = _l[0], setIsPasswordVisible = _l[1];
22
+ var _m = useState(propValue || ""), value = _m[0], setValue = _m[1];
23
+ var _o = useState(propError || ""), error = _o[0], setError = _o[1];
24
+ var _p = useState(false), isTouched = _p[0], setIsTouched = _p[1];
14
25
  var inputRef = useRef(null);
15
26
  useEffect(function () {
16
27
  setValue(propValue || "");
@@ -59,6 +70,15 @@ var Input = forwardRef(function (_a, ref) {
59
70
  setIsTouched(true);
60
71
  validateInput();
61
72
  };
73
+ var handleClear = function (e) {
74
+ e.preventDefault();
75
+ e.stopPropagation();
76
+ setValue("");
77
+ onChange === null || onChange === void 0 ? void 0 : onChange("");
78
+ if (inputRef.current) {
79
+ inputRef.current.focus();
80
+ }
81
+ };
62
82
  var renderEndIcon = function () {
63
83
  if (style === "variation" && endIcon) {
64
84
  return (React.createElement("button", { className: "Input-icon-button" },
@@ -81,11 +101,17 @@ var Input = forwardRef(function (_a, ref) {
81
101
  "*"))),
82
102
  React.createElement("div", { className: "Input-wrapper" },
83
103
  React.createElement("div", { className: "Input-container" },
84
- React.createElement("div", { className: "Input-input" },
85
- React.createElement("input", { ref: inputRef, type: style === "password" && !isPasswordVisible ? "password" : type, placeholder: placeholder, className: "Input-placeholder ".concat(disableZoom ? "Input-no-zoom" : ""), value: value, onChange: function (e) {
104
+ React.createElement("div", { className: "Input-input ".concat(isPrefilled ? "Input-prefilled" : "") },
105
+ React.createElement("input", __assign({ ref: inputRef, type: style === "password" && !isPasswordVisible ? "password" : type, placeholder: placeholder, className: "Input-placeholder ".concat(disableZoom ? "Input-no-zoom" : ""), value: value, onChange: function (e) {
86
106
  handleChange(e);
87
107
  rowChange && rowChange(e);
88
- }, name: name, onKeyDown: onKeyDown, onBlur: handleBlur })),
108
+ }, name: name, onKeyDown: onKeyDown, onBlur: handleBlur }, (disableAutofill && {
109
+ autoComplete: "off",
110
+ "data-form-type": "other",
111
+ "data-lpignore": "true",
112
+ "data-1p-ignore": true,
113
+ }))),
114
+ showClearButton && value && (React.createElement("button", { type: "button", className: "Input-clear-button", onClick: handleClear, "aria-label": "Effacer le contenu" }, "\u00D7"))),
89
115
  renderEndIcon()),
90
116
  error && isTouched && (React.createElement("div", { className: "error-message" },
91
117
  React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))))));
@@ -42,6 +42,23 @@ declare namespace _default {
42
42
  }
43
43
  export { control_4 as control };
44
44
  }
45
+ export namespace isPrefilled {
46
+ let control_5: string;
47
+ export { control_5 as control };
48
+ export let description: string;
49
+ }
50
+ export namespace showClearButton {
51
+ let control_6: string;
52
+ export { control_6 as control };
53
+ let description_1: string;
54
+ export { description_1 as description };
55
+ }
56
+ export namespace disableAutofill {
57
+ let control_7: string;
58
+ export { control_7 as control };
59
+ let description_2: string;
60
+ export { description_2 as description };
61
+ }
45
62
  }
46
63
  export namespace parameters {
47
64
  namespace backgrounds {
@@ -60,4 +77,7 @@ export const Variation: any;
60
77
  export const Password: any;
61
78
  export const WithValidation: any;
62
79
  export const PasswordWithError: any;
80
+ export const WithClearButton: any;
81
+ export const PrefilledInput: any;
82
+ export const WithAutofillDisabled: any;
63
83
  import Input from "./Input";
@@ -47,6 +47,18 @@ export default {
47
47
  options: ["bold", "semiBold", "medium"],
48
48
  },
49
49
  },
50
+ isPrefilled: {
51
+ control: "boolean",
52
+ description: "Indique si le champ a été pré-rempli automatiquement",
53
+ },
54
+ showClearButton: {
55
+ control: "boolean",
56
+ description: "Affiche un bouton pour effacer rapidement le contenu",
57
+ },
58
+ disableAutofill: {
59
+ control: "boolean",
60
+ description: "Désactive l'auto-remplissage des gestionnaires de mots de passe",
61
+ },
50
62
  },
51
63
  parameters: {
52
64
  backgrounds: {
@@ -108,3 +120,30 @@ PasswordWithError.args = {
108
120
  isRequired: true,
109
121
  error: "Le mot de passe doit contenir au moins 8 caractères",
110
122
  };
123
+ export var WithClearButton = Template.bind({});
124
+ WithClearButton.args = {
125
+ name: "clearButtonInput",
126
+ title: "Texte",
127
+ placeholder: "Entrez du texte",
128
+ value: "Test de texte",
129
+ showClearButton: true,
130
+ style: "default",
131
+ };
132
+ export var PrefilledInput = Template.bind({});
133
+ PrefilledInput.args = {
134
+ name: "prefilledInput",
135
+ title: "Prénom",
136
+ placeholder: "Entrez votre prénom",
137
+ value: "Vincent",
138
+ isPrefilled: true,
139
+ showClearButton: true,
140
+ style: "default",
141
+ };
142
+ export var WithAutofillDisabled = Template.bind({});
143
+ WithAutofillDisabled.args = {
144
+ name: "autofillDisabledInput",
145
+ title: "Email",
146
+ placeholder: "Entrez votre email",
147
+ style: "default",
148
+ disableAutofill: true,
149
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.5.9",
3
+ "version": "3.6.1",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",