allaw-ui 4.7.8 → 4.8.0

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.
Files changed (34) hide show
  1. package/dist/components/atoms/buttons/ActionButton.js +0 -1
  2. package/dist/components/atoms/buttons/TertiaryButton.js +1 -2
  3. package/dist/components/atoms/datepickers/Datepicker.d.ts +1 -0
  4. package/dist/components/atoms/datepickers/Datepicker.js +24 -16
  5. package/dist/components/atoms/datepickers/Datepicker.stories.d.ts +56 -0
  6. package/dist/components/atoms/datepickers/Datepicker.stories.js +35 -0
  7. package/dist/components/atoms/datepickers/datepicker.css +44 -0
  8. package/dist/components/atoms/inputs/TextArea.css +28 -0
  9. package/dist/components/atoms/inputs/TextArea.d.ts +1 -0
  10. package/dist/components/atoms/inputs/TextArea.js +9 -5
  11. package/dist/components/atoms/selects/Select.d.ts +1 -0
  12. package/dist/components/atoms/selects/Select.js +16 -10
  13. package/dist/components/atoms/selects/Select.module.css +28 -0
  14. package/dist/components/atoms/selects/Select.stories.d.ts +8 -0
  15. package/dist/components/atoms/selects/Select.stories.js +41 -0
  16. package/dist/components/atoms/typography/Heading.js +0 -1
  17. package/dist/components/molecules/datepickerForm/DatepickerForm.d.ts +1 -0
  18. package/dist/components/molecules/datepickerForm/DatepickerForm.js +2 -2
  19. package/dist/components/molecules/datepickerForm/DatepickerForm.stories.d.ts +80 -0
  20. package/dist/components/molecules/datepickerForm/DatepickerForm.stories.js +47 -0
  21. package/dist/components/molecules/notification/Notification.d.ts +27 -0
  22. package/dist/components/molecules/notification/Notification.js +30 -0
  23. package/dist/components/molecules/notification/Notification.stories.d.ts +377 -0
  24. package/dist/components/molecules/notification/Notification.stories.js +205 -0
  25. package/dist/components/molecules/notification/index.d.ts +2 -0
  26. package/dist/components/molecules/notification/index.js +1 -0
  27. package/dist/components/molecules/notification/notification.module.css +99 -0
  28. package/dist/components/molecules/selectForm/SelectForm.d.ts +1 -0
  29. package/dist/components/molecules/selectForm/SelectForm.js +2 -2
  30. package/dist/components/molecules/selectForm/SelectForm.stories.d.ts +7 -0
  31. package/dist/components/molecules/selectForm/SelectForm.stories.js +9 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +2 -0
  34. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  var __assign = (this && this.__assign) || function () {
3
2
  __assign = Object.assign || function(t) {
4
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import Link from "next/link";
3
2
  import "./TertiaryButton.css";
4
3
  import "../../../styles/global.css";
5
4
  var TertiaryButton = function (_a) {
@@ -12,7 +11,7 @@ var TertiaryButton = function (_a) {
12
11
  }
13
12
  onClick === null || onClick === void 0 ? void 0 : onClick();
14
13
  };
15
- return href ? (React.createElement(Link, { href: href, className: buttonClass, onClick: handleClick },
14
+ return href ? (React.createElement("a", { href: href, className: buttonClass, onClick: handleClick },
16
15
  startIcon && React.createElement("span", { className: "tertiary-button-icon ".concat(startIcon) }),
17
16
  React.createElement("span", { className: "tertiary-button-label" }, label),
18
17
  endIcon && React.createElement("span", { className: "tertiary-button-icon ".concat(endIcon) }))) : (React.createElement("button", { type: "button", className: buttonClass, onClick: handleClick, disabled: isDisabled },
@@ -13,6 +13,7 @@ export interface DatepickerProps {
13
13
  disableFutur?: Boolean;
14
14
  mode?: "button" | "input";
15
15
  onError?: (err: string) => void;
16
+ isPrefilled?: boolean;
16
17
  }
17
18
  declare const Datepicker: React.FC<DatepickerProps>;
18
19
  export default Datepicker;
@@ -20,8 +20,8 @@ import { fr } from "date-fns/locale";
20
20
  import { format } from "date-fns";
21
21
  import TinyInfo from "../typography/TinyInfo";
22
22
  var CustomInput = forwardRef(function (_a, ref) {
23
- var value = _a.value, onClick = _a.onClick, placeholder = _a.placeholder;
24
- var _b = useState(placeholder), displayedPlaceholder = _b[0], setDisplayedPlaceholder = _b[1];
23
+ var value = _a.value, onClick = _a.onClick, placeholder = _a.placeholder, _b = _a.isPrefilled, isPrefilled = _b === void 0 ? false : _b;
24
+ var _c = useState(placeholder), displayedPlaceholder = _c[0], setDisplayedPlaceholder = _c[1];
25
25
  var containerRef = useRef(null);
26
26
  var testRef = useRef(null);
27
27
  useEffect(function () {
@@ -41,7 +41,11 @@ var CustomInput = forwardRef(function (_a, ref) {
41
41
  window.addEventListener("resize", checkTextFit);
42
42
  return function () { return window.removeEventListener("resize", checkTextFit); };
43
43
  }, [placeholder]);
44
- return (React.createElement("button", { type: "button", className: "datepicker", onClick: onClick, ref: ref },
44
+ return (React.createElement("button", { type: "button", className: "datepicker ".concat(isPrefilled
45
+ ? (value === null || value === void 0 ? void 0 : value.trim())
46
+ ? "datepicker-prefilled"
47
+ : "datepicker-prefilled-empty"
48
+ : ""), onClick: onClick, ref: ref },
45
49
  React.createElement("span", { className: "datepicker-content", ref: containerRef },
46
50
  React.createElement("span", { className: "datepicker-text" }, value || displayedPlaceholder),
47
51
  React.createElement("i", { className: "datepicker-icon allaw-icon-calendar" })),
@@ -49,10 +53,10 @@ var CustomInput = forwardRef(function (_a, ref) {
49
53
  });
50
54
  CustomInput.displayName = "CustomInput";
51
55
  var CustomInputField = forwardRef(function (_a, ref) {
52
- var value = _a.value, onChange = _a.onChange, onCalendarClick = _a.onCalendarClick, placeholder = _a.placeholder, onBlur = _a.onBlur, error = _a.error, onError = _a.onError;
53
- var _b = useState(value || ""), inputValue = _b[0], setInputValue = _b[1];
54
- var _c = useState(false), isTouched = _c[0], setIsTouched = _c[1];
55
- var _d = useState(error || ""), localError = _d[0], setLocalError = _d[1];
56
+ var value = _a.value, onChange = _a.onChange, onCalendarClick = _a.onCalendarClick, placeholder = _a.placeholder, onBlur = _a.onBlur, error = _a.error, onError = _a.onError, _b = _a.isPrefilled, isPrefilled = _b === void 0 ? false : _b;
57
+ var _c = useState(value || ""), inputValue = _c[0], setInputValue = _c[1];
58
+ var _d = useState(false), isTouched = _d[0], setIsTouched = _d[1];
59
+ var _e = useState(error || ""), localError = _e[0], setLocalError = _e[1];
56
60
  var inputRef = useRef(null);
57
61
  useEffect(function () {
58
62
  setInputValue(value || "");
@@ -104,7 +108,11 @@ var CustomInputField = forwardRef(function (_a, ref) {
104
108
  onError(err);
105
109
  };
106
110
  return (React.createElement("div", { style: { width: "100%" } },
107
- React.createElement("div", { className: "datepicker-input-wrapper" },
111
+ React.createElement("div", { className: "datepicker-input-wrapper ".concat(isPrefilled
112
+ ? inputValue.trim()
113
+ ? "datepicker-input-wrapper-prefilled"
114
+ : "datepicker-input-wrapper-prefilled-empty"
115
+ : "") },
108
116
  React.createElement("input", { ref: inputRef, type: "text", inputMode: "numeric", pattern: "\\d{2}/\\d{2}/\\d{4}", maxLength: 10, className: "datepicker-input ".concat(localError && isTouched ? "datepicker-input-error" : ""), placeholder: placeholder, value: inputValue, onChange: handleInput, onBlur: handleBlur, autoComplete: "off", "data-form-type": "other", "data-lpignore": "true", "data-1p-ignore": true }),
109
117
  React.createElement("button", { type: "button", className: "datepicker-input-icon", tabIndex: -1, onClick: onCalendarClick },
110
118
  React.createElement("i", { className: "datepicker-icon allaw-icon-calendar" }))),
@@ -112,14 +120,14 @@ var CustomInputField = forwardRef(function (_a, ref) {
112
120
  });
113
121
  CustomInputField.displayName = "CustomInputField";
114
122
  var Datepicker = function (_a) {
115
- var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, _c = _a.yearDropdownItemNumber, yearDropdownItemNumber = _c === void 0 ? 10 : _c, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate, maxDate = _a.maxDate, _d = _a.disableFutur, disableFutur = _d === void 0 ? true : _d, _e = _a.mode, mode = _e === void 0 ? "button" : _e, onError = _a.onError;
116
- var _f = useState(value), selectedDate = _f[0], setSelectedDate = _f[1];
117
- var _g = useState(false), isOpen = _g[0], setIsOpen = _g[1];
118
- var _h = useState({ top: 0, left: 0 }), position = _h[0], setPosition = _h[1];
123
+ var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, _c = _a.yearDropdownItemNumber, yearDropdownItemNumber = _c === void 0 ? 10 : _c, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate, maxDate = _a.maxDate, _d = _a.disableFutur, disableFutur = _d === void 0 ? true : _d, _e = _a.mode, mode = _e === void 0 ? "button" : _e, onError = _a.onError, _f = _a.isPrefilled, isPrefilled = _f === void 0 ? false : _f;
124
+ var _g = useState(value), selectedDate = _g[0], setSelectedDate = _g[1];
125
+ var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
126
+ var _j = useState({ top: 0, left: 0 }), position = _j[0], setPosition = _j[1];
119
127
  var buttonRef = useRef(null);
120
128
  var calendarRef = useRef(null);
121
- var _j = useState("bottom"), placement = _j[0], setPlacement = _j[1];
122
- var _k = useState(""), inputError = _k[0], setInputError = _k[1];
129
+ var _k = useState("bottom"), placement = _k[0], setPlacement = _k[1];
130
+ var _l = useState(""), inputError = _l[0], setInputError = _l[1];
123
131
  useEffect(function () {
124
132
  setSelectedDate(value);
125
133
  }, [value]);
@@ -217,9 +225,9 @@ var Datepicker = function (_a) {
217
225
  }, onCalendarClick: function () { return setIsOpen(!isOpen); }, placeholder: placeholder, error: inputError, onBlur: function () {
218
226
  if (!selectedDate)
219
227
  setInputError("Date invalide");
220
- }, onError: onError })) : (React.createElement(CustomInput, { value: selectedDate
228
+ }, onError: onError, isPrefilled: isPrefilled })) : (React.createElement(CustomInput, { value: selectedDate
221
229
  ? format(selectedDate, "dd MMMM yyyy", { locale: fr })
222
- : "", onClick: function () { return setIsOpen(!isOpen); }, placeholder: placeholder })),
230
+ : "", onClick: function () { return setIsOpen(!isOpen); }, placeholder: placeholder, isPrefilled: isPrefilled })),
223
231
  isOpen &&
224
232
  ReactDOM.createPortal(React.createElement("div", { ref: calendarRef, className: "datepicker-portal ".concat(placement, " datepicker-portal-animated"), style: __assign({ left: "".concat(position.left, "px") }, (placement === "bottom"
225
233
  ? { top: "".concat(position.top, "px") }
@@ -50,6 +50,12 @@ declare namespace _default {
50
50
  let defaultValue_1: string;
51
51
  export { defaultValue_1 as defaultValue };
52
52
  }
53
+ namespace isPrefilled {
54
+ let control_4: string;
55
+ export { control_4 as control };
56
+ let description_4: string;
57
+ export { description_4 as description };
58
+ }
53
59
  }
54
60
  }
55
61
  export default _default;
@@ -58,6 +64,8 @@ export namespace Default {
58
64
  export let placeholder: string;
59
65
  let yearDropdownItemNumber_1: number;
60
66
  export { yearDropdownItemNumber_1 as yearDropdownItemNumber };
67
+ let isPrefilled_1: boolean;
68
+ export { isPrefilled_1 as isPrefilled };
61
69
  }
62
70
  }
63
71
  export namespace WithValue {
@@ -108,4 +116,52 @@ export namespace InputMode {
108
116
  }
109
117
  export { args_5 as args };
110
118
  }
119
+ export namespace PrefilledButton {
120
+ export namespace args_6 {
121
+ let value_1: Date;
122
+ export { value_1 as value };
123
+ let placeholder_6: string;
124
+ export { placeholder_6 as placeholder };
125
+ let mode_2: string;
126
+ export { mode_2 as mode };
127
+ let isPrefilled_2: boolean;
128
+ export { isPrefilled_2 as isPrefilled };
129
+ }
130
+ export { args_6 as args };
131
+ }
132
+ export namespace PrefilledButtonEmpty {
133
+ export namespace args_7 {
134
+ let placeholder_7: string;
135
+ export { placeholder_7 as placeholder };
136
+ let mode_3: string;
137
+ export { mode_3 as mode };
138
+ let isPrefilled_3: boolean;
139
+ export { isPrefilled_3 as isPrefilled };
140
+ }
141
+ export { args_7 as args };
142
+ }
143
+ export namespace PrefilledInput {
144
+ export namespace args_8 {
145
+ let value_2: Date;
146
+ export { value_2 as value };
147
+ let placeholder_8: string;
148
+ export { placeholder_8 as placeholder };
149
+ let mode_4: string;
150
+ export { mode_4 as mode };
151
+ let isPrefilled_4: boolean;
152
+ export { isPrefilled_4 as isPrefilled };
153
+ }
154
+ export { args_8 as args };
155
+ }
156
+ export namespace PrefilledInputEmpty {
157
+ export namespace args_9 {
158
+ let placeholder_9: string;
159
+ export { placeholder_9 as placeholder };
160
+ let mode_5: string;
161
+ export { mode_5 as mode };
162
+ let isPrefilled_5: boolean;
163
+ export { isPrefilled_5 as isPrefilled };
164
+ }
165
+ export { args_9 as args };
166
+ }
111
167
  import Datepicker from "./Datepicker";
@@ -36,12 +36,17 @@ export default {
36
36
  description: "Mode d'affichage du sélecteur (bouton ou champ de saisie)",
37
37
  defaultValue: "button",
38
38
  },
39
+ isPrefilled: {
40
+ control: "boolean",
41
+ description: "Affiche une bordure bleue pour indiquer un champ pré-rempli",
42
+ },
39
43
  },
40
44
  };
41
45
  export var Default = {
42
46
  args: {
43
47
  placeholder: "Sélectionner une date",
44
48
  yearDropdownItemNumber: 10,
49
+ isPrefilled: false,
45
50
  },
46
51
  };
47
52
  export var WithValue = {
@@ -76,3 +81,33 @@ export var InputMode = {
76
81
  placeholder: "jj/mm/aaaa",
77
82
  },
78
83
  };
84
+ export var PrefilledButton = {
85
+ args: {
86
+ value: new Date("2024-03-15"),
87
+ placeholder: "Sélectionner une date",
88
+ mode: "button",
89
+ isPrefilled: true,
90
+ },
91
+ };
92
+ export var PrefilledButtonEmpty = {
93
+ args: {
94
+ placeholder: "Champ pré-rempli vide",
95
+ mode: "button",
96
+ isPrefilled: true,
97
+ },
98
+ };
99
+ export var PrefilledInput = {
100
+ args: {
101
+ value: new Date("2024-03-15"),
102
+ placeholder: "jj/mm/aaaa",
103
+ mode: "input",
104
+ isPrefilled: true,
105
+ },
106
+ };
107
+ export var PrefilledInputEmpty = {
108
+ args: {
109
+ placeholder: "jj/mm/aaaa pré-rempli vide",
110
+ mode: "input",
111
+ isPrefilled: true,
112
+ },
113
+ };
@@ -334,3 +334,47 @@
334
334
  transform: scale(1);
335
335
  }
336
336
  }
337
+
338
+ /* Nouveaux styles pour la fonctionnalité isPrefilled */
339
+
340
+ /* Style prefilled pour le mode button */
341
+ .datepicker-prefilled {
342
+ border-color: var(--bleu-allaw, #25ceeb) !important;
343
+ }
344
+
345
+ .datepicker-prefilled-empty {
346
+ border-color: var(--bleu-allaw, #25ceeb) !important;
347
+ }
348
+
349
+ .datepicker-prefilled:hover {
350
+ border-color: var(--bleu-allaw, #25ceeb) !important;
351
+ }
352
+
353
+ .datepicker-prefilled-empty:hover {
354
+ border-color: var(--bleu-allaw, #25ceeb) !important;
355
+ }
356
+
357
+ /* Style prefilled pour le mode input */
358
+ .datepicker-input-wrapper-prefilled {
359
+ border-color: var(--bleu-allaw, #25ceeb) !important;
360
+ }
361
+
362
+ .datepicker-input-wrapper-prefilled-empty {
363
+ border-color: var(--bleu-allaw, #25ceeb) !important;
364
+ }
365
+
366
+ .datepicker-input-wrapper-prefilled:hover {
367
+ border-color: var(--bleu-allaw, #25ceeb) !important;
368
+ }
369
+
370
+ .datepicker-input-wrapper-prefilled-empty:hover {
371
+ border-color: var(--bleu-allaw, #25ceeb) !important;
372
+ }
373
+
374
+ .datepicker-input-wrapper-prefilled:focus-within {
375
+ border-color: var(--bleu-allaw, #25ceeb) !important;
376
+ }
377
+
378
+ .datepicker-input-wrapper-prefilled-empty:focus-within {
379
+ border-color: var(--bleu-allaw, #25ceeb) !important;
380
+ }
@@ -176,3 +176,31 @@
176
176
  padding-top: 4px;
177
177
  padding-left: 14px;
178
178
  }
179
+
180
+ /* Nouveaux styles pour la fonctionnalité isPrefilled */
181
+
182
+ /* Style prefilled - champ rempli */
183
+ .text-area-prefilled {
184
+ border-color: var(--bleu-allaw, #25ceeb) !important;
185
+ }
186
+
187
+ /* Style prefilled - champ vide */
188
+ .text-area-prefilled-empty {
189
+ border-color: var(--bleu-allaw, #25ceeb) !important;
190
+ }
191
+
192
+ .text-area-prefilled:hover {
193
+ border-color: var(--bleu-allaw, #25ceeb) !important;
194
+ }
195
+
196
+ .text-area-prefilled-empty:hover {
197
+ border-color: var(--bleu-allaw, #25ceeb) !important;
198
+ }
199
+
200
+ .text-area-prefilled:focus-within {
201
+ border-color: var(--bleu-allaw, #25ceeb) !important;
202
+ }
203
+
204
+ .text-area-prefilled-empty:focus-within {
205
+ border-color: var(--bleu-allaw, #25ceeb) !important;
206
+ }
@@ -17,6 +17,7 @@ export interface TextAreaProps {
17
17
  variant?: "bold" | "semiBold" | "medium";
18
18
  color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "grey-venom" | "venom-grey-dark";
19
19
  dataTestId?: string;
20
+ isPrefilled?: boolean;
20
21
  }
21
22
  export interface TextAreaRef {
22
23
  validate: () => boolean;
@@ -6,10 +6,10 @@ import Paragraph from "../typography/Paragraph";
6
6
  import TinyInfo from "../typography/TinyInfo";
7
7
  import "./TextArea.css";
8
8
  var TextArea = forwardRef(function (_a, ref) {
9
- var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.maxHeight, maxHeight = _d === void 0 ? 400 : _d, minHeight = _a.minHeight, _e = _a.variant, variant = _e === void 0 ? "medium" : _e, _f = _a.color, color = _f === void 0 ? "noir" : _f, dataTestId = _a.dataTestId;
10
- var _g = useState(propValue || ""), value = _g[0], setValue = _g[1];
11
- var _h = useState(propError || ""), error = _h[0], setError = _h[1];
12
- var _j = useState(false), isTouched = _j[0], setIsTouched = _j[1];
9
+ var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.maxHeight, maxHeight = _d === void 0 ? 400 : _d, minHeight = _a.minHeight, _e = _a.variant, variant = _e === void 0 ? "medium" : _e, _f = _a.color, color = _f === void 0 ? "noir" : _f, dataTestId = _a.dataTestId, _g = _a.isPrefilled, isPrefilled = _g === void 0 ? false : _g;
10
+ var _h = useState(propValue || ""), value = _h[0], setValue = _h[1];
11
+ var _j = useState(propError || ""), error = _j[0], setError = _j[1];
12
+ var _k = useState(false), isTouched = _k[0], setIsTouched = _k[1];
13
13
  var textareaRef = useRef(null);
14
14
  useEffect(function () {
15
15
  setValue(propValue || "");
@@ -79,7 +79,11 @@ var TextArea = forwardRef(function (_a, ref) {
79
79
  "\u00A0",
80
80
  "*"))),
81
81
  React.createElement("div", { className: "text-area-container" },
82
- React.createElement("div", { className: "text-area-input", "data-testid": dataTestId || "text-area" },
82
+ React.createElement("div", { className: "text-area-input ".concat(isPrefilled
83
+ ? value.trim()
84
+ ? "text-area-prefilled"
85
+ : "text-area-prefilled-empty"
86
+ : ""), "data-testid": dataTestId || "text-area" },
83
87
  React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: minHeight !== undefined
84
88
  ? "text-area-placeholder no-transition"
85
89
  : "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur, style: textareaStyle, "data-testid": dataTestId || "text-area" })),
@@ -18,6 +18,7 @@ export interface SelectProps<T extends string | string[]> {
18
18
  onChange?: (selected: T) => void;
19
19
  onError?: (error: string) => void;
20
20
  maxLines?: false | number;
21
+ isPrefilled?: boolean;
21
22
  }
22
23
  export interface SelectRef {
23
24
  validate: () => boolean;
@@ -14,21 +14,21 @@ import "../../../styles/global.css";
14
14
  import TinyInfo from "../typography/TinyInfo";
15
15
  function Select(_a, ref) {
16
16
  var _b;
17
- var items = _a.items, selectedItem = _a.selectedItem, _c = _a.placeholder, placeholder = _c === void 0 ? "Choisir..." : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, _f = _a.showError, showError = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, maxItems = _a.maxItems, _h = _a.requireAttention, requireAttention = _h === void 0 ? false : _h, _j = _a.disabledItems, disabledItems = _j === void 0 ? [] : _j, onChange = _a.onChange, onError = _a.onError, _k = _a.maxLines, maxLines = _k === void 0 ? false : _k;
18
- var _l = useState(false), isOpen = _l[0], setIsOpen = _l[1];
19
- var _m = useState((multiple ? selectedItem || [] : selectedItem || "")), selected = _m[0], setSelected = _m[1];
20
- var _o = useState(""), error = _o[0], setError = _o[1];
17
+ var items = _a.items, selectedItem = _a.selectedItem, _c = _a.placeholder, placeholder = _c === void 0 ? "Choisir..." : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, _f = _a.showError, showError = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, maxItems = _a.maxItems, _h = _a.requireAttention, requireAttention = _h === void 0 ? false : _h, _j = _a.disabledItems, disabledItems = _j === void 0 ? [] : _j, onChange = _a.onChange, onError = _a.onError, _k = _a.maxLines, maxLines = _k === void 0 ? false : _k, _l = _a.isPrefilled, isPrefilled = _l === void 0 ? false : _l;
18
+ var _m = useState(false), isOpen = _m[0], setIsOpen = _m[1];
19
+ var _o = useState((multiple ? selectedItem || [] : selectedItem || "")), selected = _o[0], setSelected = _o[1];
20
+ var _p = useState(""), error = _p[0], setError = _p[1];
21
21
  var selectRef = useRef(null);
22
22
  var listRef = useRef(null);
23
23
  var tagContainerRef = useRef(null);
24
- var _p = useState([]), visibleTags = _p[0], setVisibleTags = _p[1];
25
- var _q = useState(0), hiddenCount = _q[0], setHiddenCount = _q[1];
26
- var _r = useState({
24
+ var _q = useState([]), visibleTags = _q[0], setVisibleTags = _q[1];
25
+ var _r = useState(0), hiddenCount = _r[0], setHiddenCount = _r[1];
26
+ var _s = useState({
27
27
  top: 0,
28
28
  left: 0,
29
29
  width: 0,
30
- }), listPosition = _r[0], setListPosition = _r[1];
31
- var _s = useState("bottom"), placement = _s[0], setPlacement = _s[1];
30
+ }), listPosition = _s[0], setListPosition = _s[1];
31
+ var _t = useState("bottom"), placement = _t[0], setPlacement = _t[1];
32
32
  useEffect(function () {
33
33
  setSelected((multiple ? selectedItem || [] : selectedItem || ""));
34
34
  }, [selectedItem, multiple]);
@@ -233,7 +233,13 @@ function Select(_a, ref) {
233
233
  validate: function () { return validateSelect(selected); },
234
234
  }); });
235
235
  return (React.createElement("div", { ref: selectRef, className: "".concat(styles.selectContainer, " ").concat(isOpen ? styles.selectPressed : ""), style: { width: "".concat(width, "%") } },
236
- React.createElement("button", { type: "button", className: "".concat(styles.select, " ").concat(isOpen ? styles.selectPressed : styles.selectDefault, " ").concat(multiple ? styles.selectMultiple : styles.selectSingle, " ").concat(requireAttention ? styles.selectRequireAttention : ""), onClick: toggleOpen, style: { width: "100%" } },
236
+ React.createElement("button", { type: "button", className: "".concat(styles.select, " ").concat(isOpen ? styles.selectPressed : styles.selectDefault, " ").concat(multiple ? styles.selectMultiple : styles.selectSingle, " ").concat(requireAttention ? styles.selectRequireAttention : "", " ").concat(isPrefilled
237
+ ? Array.isArray(selected) && selected.length > 0
238
+ ? styles.selectPrefilled
239
+ : !Array.isArray(selected) && selected
240
+ ? styles.selectPrefilled
241
+ : styles.selectPrefilledEmpty
242
+ : ""), onClick: toggleOpen, style: { width: "100%" } },
237
243
  React.createElement("span", { className: "".concat(styles.selectText, " ").concat(maxLines !== false ? styles.selectTextClamp : ""), style: maxLines !== false
238
244
  ? { WebkitLineClamp: maxLines }
239
245
  : undefined }, Array.isArray(selected) && selected.length > 0
@@ -240,3 +240,31 @@
240
240
  transform: scale(1);
241
241
  }
242
242
  }
243
+
244
+ /* Nouveaux styles pour la fonctionnalité isPrefilled */
245
+
246
+ /* Style prefilled - champ rempli */
247
+ .selectPrefilled {
248
+ border-color: var(--bleu-allaw, #25ceeb) !important;
249
+ }
250
+
251
+ /* Style prefilled - champ vide */
252
+ .selectPrefilledEmpty {
253
+ border-color: var(--bleu-allaw, #25ceeb) !important;
254
+ }
255
+
256
+ .selectPrefilled:hover {
257
+ border-color: var(--bleu-allaw, #25ceeb) !important;
258
+ }
259
+
260
+ .selectPrefilledEmpty:hover {
261
+ border-color: var(--bleu-allaw, #25ceeb) !important;
262
+ }
263
+
264
+ .selectPrefilled:focus {
265
+ border-color: var(--bleu-allaw, #25ceeb) !important;
266
+ }
267
+
268
+ .selectPrefilledEmpty:focus {
269
+ border-color: var(--bleu-allaw, #25ceeb) !important;
270
+ }
@@ -88,6 +88,12 @@ declare namespace _default {
88
88
  export { control_9 as control };
89
89
  export let description: string;
90
90
  }
91
+ namespace isPrefilled {
92
+ let control_10: string;
93
+ export { control_10 as control };
94
+ let description_1: string;
95
+ export { description_1 as description };
96
+ }
91
97
  }
92
98
  export namespace parameters {
93
99
  namespace backgrounds {
@@ -122,4 +128,6 @@ export const RequireAttention: any;
122
128
  export const TwoLines: any;
123
129
  export const WithDisabledItems: any;
124
130
  export const MultipleWithDisabledItems: any;
131
+ export const Prefilled: any;
132
+ export const PrefilledEmpty: any;
125
133
  import Select from "./Select";
@@ -81,6 +81,10 @@ export default {
81
81
  },
82
82
  description: "Nombre de lignes max affichées (laisser vide pour 1 ligne)",
83
83
  },
84
+ isPrefilled: {
85
+ control: "boolean",
86
+ description: "Affiche une bordure bleue pour indiquer un champ pré-rempli",
87
+ },
84
88
  },
85
89
  parameters: {
86
90
  backgrounds: {
@@ -130,6 +134,7 @@ Default.args = {
130
134
  requireAttention: false,
131
135
  width: 100,
132
136
  maxLines: undefined,
137
+ isPrefilled: false,
133
138
  };
134
139
  export var Pressed = Template.bind({});
135
140
  Pressed.args = {
@@ -256,3 +261,39 @@ MultipleWithDisabledItems.args = {
256
261
  maxItems: 4,
257
262
  width: 100,
258
263
  };
264
+ export var Prefilled = Template.bind({});
265
+ Prefilled.args = {
266
+ items: [
267
+ { label: "Lundi 12 août", value: "lundi-12-aout" },
268
+ { label: "Mardi 13 août", value: "mardi-13-aout" },
269
+ { label: "Mercredi 14 août", value: "mercredi-14-aout" },
270
+ { label: "Jeudi 15 août", value: "jeudi-15-aout" },
271
+ { label: "Vendredi 16 août", value: "vendredi-16-aout" },
272
+ { label: "Samedi 17 août", value: "samedi-17-aout" },
273
+ ],
274
+ selectedItem: "mardi-13-aout",
275
+ placeholder: "Select...",
276
+ multiple: false,
277
+ isRequired: false,
278
+ requireAttention: false,
279
+ width: 100,
280
+ isPrefilled: true,
281
+ };
282
+ export var PrefilledEmpty = Template.bind({});
283
+ PrefilledEmpty.args = {
284
+ items: [
285
+ { label: "Lundi 12 août", value: "lundi-12-aout" },
286
+ { label: "Mardi 13 août", value: "mardi-13-aout" },
287
+ { label: "Mercredi 14 août", value: "mercredi-14-aout" },
288
+ { label: "Jeudi 15 août", value: "jeudi-15-aout" },
289
+ { label: "Vendredi 16 août", value: "vendredi-16-aout" },
290
+ { label: "Samedi 17 août", value: "samedi-17-aout" },
291
+ ],
292
+ selectedItem: "",
293
+ placeholder: "Champ pré-rempli vide...",
294
+ multiple: false,
295
+ isRequired: false,
296
+ requireAttention: false,
297
+ width: 100,
298
+ isPrefilled: true,
299
+ };
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import React, { useEffect, useState } from "react";
3
2
  import "./Heading.css";
4
3
  var Heading = function (_a) {
@@ -13,6 +13,7 @@ export interface DatepickerFormProps {
13
13
  minDate?: Date;
14
14
  mode?: "button" | "input";
15
15
  onError?: (err: string) => void;
16
+ isPrefilled?: boolean;
16
17
  }
17
18
  declare const DatepickerForm: React.FC<DatepickerFormProps>;
18
19
  export default DatepickerForm;
@@ -16,9 +16,9 @@ import Paragraph from "../../atoms/typography/Paragraph";
16
16
  import Datepicker from "../../atoms/datepickers/Datepicker";
17
17
  var DatepickerForm = function (_a) {
18
18
  // console.log("Valeur reçue dans DatepickerForm :", value);
19
- var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, text = _a.text, _c = _a.variant, variant = _c === void 0 ? "medium" : _c, _d = _a.color, color = _d === void 0 ? "noir" : _d, _e = _a.yearDropdownItemNumber, yearDropdownItemNumber = _e === void 0 ? 10 : _e, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate, mode = _a.mode, onError = _a.onError;
19
+ var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, text = _a.text, _c = _a.variant, variant = _c === void 0 ? "medium" : _c, _d = _a.color, color = _d === void 0 ? "noir" : _d, _e = _a.yearDropdownItemNumber, yearDropdownItemNumber = _e === void 0 ? 10 : _e, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate, mode = _a.mode, onError = _a.onError, _f = _a.isPrefilled, isPrefilled = _f === void 0 ? false : _f;
20
20
  return (React.createElement("div", { className: "datepicker-form-wrapper" },
21
21
  text && React.createElement(Paragraph, { text: text, variant: variant, color: color }),
22
- React.createElement(Datepicker, __assign({ value: value || undefined, onChange: onChange, placeholder: placeholder, yearDropdownItemNumber: yearDropdownItemNumber, maxDaysInPast: maxDaysInPast, minDate: minDate }, (mode ? { mode: mode } : {}), (onError ? { onError: onError } : {})))));
22
+ React.createElement(Datepicker, __assign({ value: value || undefined, onChange: onChange, placeholder: placeholder, yearDropdownItemNumber: yearDropdownItemNumber, maxDaysInPast: maxDaysInPast, minDate: minDate }, (mode ? { mode: mode } : {}), (onError ? { onError: onError } : {}), { isPrefilled: isPrefilled }))));
23
23
  };
24
24
  export default DatepickerForm;
@@ -80,6 +80,12 @@ declare namespace _default {
80
80
  let defaultValue_4: string;
81
81
  export { defaultValue_4 as defaultValue };
82
82
  }
83
+ namespace isPrefilled {
84
+ let control_7: string;
85
+ export { control_7 as control };
86
+ let description_5: string;
87
+ export { description_5 as description };
88
+ }
83
89
  }
84
90
  }
85
91
  export default _default;
@@ -94,6 +100,8 @@ export namespace Default {
94
100
  export { color_1 as color };
95
101
  let yearDropdownItemNumber_1: number;
96
102
  export { yearDropdownItemNumber_1 as yearDropdownItemNumber };
103
+ let isPrefilled_1: boolean;
104
+ export { isPrefilled_1 as isPrefilled };
97
105
  }
98
106
  }
99
107
  export namespace WithLabel {
@@ -208,4 +216,76 @@ export namespace ButtonMode {
208
216
  }
209
217
  export { args_7 as args };
210
218
  }
219
+ export namespace PrefilledButton {
220
+ export namespace args_8 {
221
+ let text_9: string;
222
+ export { text_9 as text };
223
+ let value_1: Date;
224
+ export { value_1 as value };
225
+ let placeholder_8: string;
226
+ export { placeholder_8 as placeholder };
227
+ let variant_9: string;
228
+ export { variant_9 as variant };
229
+ let color_9: string;
230
+ export { color_9 as color };
231
+ let mode_3: string;
232
+ export { mode_3 as mode };
233
+ let isPrefilled_2: boolean;
234
+ export { isPrefilled_2 as isPrefilled };
235
+ }
236
+ export { args_8 as args };
237
+ }
238
+ export namespace PrefilledButtonEmpty {
239
+ export namespace args_9 {
240
+ let text_10: string;
241
+ export { text_10 as text };
242
+ let placeholder_9: string;
243
+ export { placeholder_9 as placeholder };
244
+ let variant_10: string;
245
+ export { variant_10 as variant };
246
+ let color_10: string;
247
+ export { color_10 as color };
248
+ let mode_4: string;
249
+ export { mode_4 as mode };
250
+ let isPrefilled_3: boolean;
251
+ export { isPrefilled_3 as isPrefilled };
252
+ }
253
+ export { args_9 as args };
254
+ }
255
+ export namespace PrefilledInput {
256
+ export namespace args_10 {
257
+ let text_11: string;
258
+ export { text_11 as text };
259
+ let value_2: Date;
260
+ export { value_2 as value };
261
+ let placeholder_10: string;
262
+ export { placeholder_10 as placeholder };
263
+ let variant_11: string;
264
+ export { variant_11 as variant };
265
+ let color_11: string;
266
+ export { color_11 as color };
267
+ let mode_5: string;
268
+ export { mode_5 as mode };
269
+ let isPrefilled_4: boolean;
270
+ export { isPrefilled_4 as isPrefilled };
271
+ }
272
+ export { args_10 as args };
273
+ }
274
+ export namespace PrefilledInputEmpty {
275
+ export namespace args_11 {
276
+ let text_12: string;
277
+ export { text_12 as text };
278
+ let placeholder_11: string;
279
+ export { placeholder_11 as placeholder };
280
+ let variant_12: string;
281
+ export { variant_12 as variant };
282
+ let color_12: string;
283
+ export { color_12 as color };
284
+ let mode_6: string;
285
+ export { mode_6 as mode };
286
+ let isPrefilled_5: boolean;
287
+ export { isPrefilled_5 as isPrefilled };
288
+ }
289
+ export { args_11 as args };
290
+ }
211
291
  import DatepickerForm from "./DatepickerForm";