@axa-fr/canopee-react 1.5.1-alpha.28 → 1.5.1-alpha.29

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.
@@ -6,11 +6,6 @@ import { ItemMessage, } from "../ItemMessage/ItemMessageCommon";
6
6
  import { InputDateAtom } from "./InputDateAtom";
7
7
  import { InputDateTextAtom } from "./InputDateTextAtom";
8
8
  const InputDateCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, ItemLabelComponent, ItemMessageComponent, required, hidePicker, max, min, containerProps, ...otherProps }, inputRef) => {
9
- const componentClassName = getClassName({
10
- baseClassName: "af-form__input-date",
11
- modifiers: classModifier.split(" "),
12
- className,
13
- });
14
9
  let inputId = useId();
15
10
  inputId = otherProps.id ?? inputId;
16
11
  const idMessage = useId();
@@ -26,6 +21,12 @@ const InputDateCommon = forwardRef(({ className, classModifier = "", helper, err
26
21
  const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
27
22
  const ariaErrormessage = hasError ? idMessage : undefined;
28
23
  const ariaInvalid = hasError || undefined;
24
+ const hasWarning = Boolean(message) && messageType === "warning" && !hasError;
25
+ const componentClassName = getClassName({
26
+ baseClassName: "af-form__input-date",
27
+ modifiers: [...classModifier.split(" "), hasWarning && "warning"],
28
+ className,
29
+ });
29
30
  return (_jsxs("div", { className: "af-form__input-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, required: required, htmlFor: inputId, children: label }), hidePicker ? (_jsx(InputDateTextAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required })) : (_jsx(InputDateAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required, max: max, min: min })), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
30
31
  });
31
32
  InputDateCommon.displayName = "InputDate";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.5.1-alpha.28",
3
+ "version": "1.5.1-alpha.29",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "exports": {
6
6
  "./distributeur": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "homepage": "https://github.com/AxaFrance/design-system#readme",
51
51
  "peerDependencies": {
52
- "@axa-fr/canopee-css": "1.5.1-alpha.28",
52
+ "@axa-fr/canopee-css": "1.5.1-alpha.29",
53
53
  "@material-symbols/svg-400": ">= 0.19.0",
54
54
  "@material-symbols/svg-700": ">= 0.19.0",
55
55
  "react": ">= 18"