@axa-fr/design-system-apollo-react 1.0.5-alpha.378 → 1.0.5-alpha.380

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.
@@ -1,4 +1 @@
1
- const MAXIMUM_SIZE_DATE = 10;
2
- export const formatInputDateValue = (value) => value instanceof Date
3
- ? value.toISOString().slice(0, MAXIMUM_SIZE_DATE)
4
- : value;
1
+ export const formatInputDateValue = (value) => value instanceof Date ? value.toISOString().split("T")[0] : value;
@@ -1,10 +1,12 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateApollo.scss";
2
2
  import { type ComponentProps } from "react";
3
3
  import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
4
- export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "value"> & {
4
+ export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "max" | "min" | "value"> & {
5
5
  classModifier?: string;
6
6
  defaultValue?: Date | string;
7
7
  value?: Date | string;
8
+ min?: Date | string;
9
+ max?: Date | string;
8
10
  helper?: string;
9
11
  error?: string;
10
12
  success?: string;
@@ -1,10 +1,12 @@
1
1
  import { ComponentProps, ComponentPropsWithRef, ComponentType } from "react";
2
2
  import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
3
3
  import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
4
- type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value"> & {
4
+ type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min" | "max"> & {
5
5
  classModifier?: string;
6
6
  defaultValue?: Date | string;
7
7
  value?: Date | string;
8
+ min?: Date | string;
9
+ max?: Date | string;
8
10
  helper?: string;
9
11
  error?: string;
10
12
  success?: string;
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
3
  import { getComponentClassName } from "../../utilities/getComponentClassName";
4
4
  import { formatInputDateValue } from "./InputDate.helper";
5
- const InputDate = forwardRef(({ className, classModifier = "", defaultValue, value, helper, error, success, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
5
+ const InputDate = forwardRef(({ className, classModifier = "", defaultValue, value, helper, error, success, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, "aria-errormessage": ariaErrormessage, min, max, ...otherProps }, inputRef) => {
6
6
  const componentClassName = getComponentClassName("af-form__input-date", className ?? "", classModifier + (error || ariaErrormessage ? " error" : ""));
7
7
  let inputId = useId();
8
8
  inputId = otherProps.id ?? inputId;
9
9
  const idMessage = useId();
10
10
  const idHelp = useId();
11
11
  const idLabel = useId();
12
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId, idLabel: idLabel }), _jsx("input", { ...otherProps, id: inputId, className: componentClassName, type: "date", ref: inputRef, defaultValue: formatInputDateValue(defaultValue), value: formatInputDateValue(value), "aria-labelledby": idLabel, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error ?? ariaErrormessage), "aria-describedby": idHelp, required: required }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error ?? success, messageType: error ? "error" : "success" })] }));
12
+ return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId, idLabel: idLabel }), _jsx("input", { ...otherProps, id: inputId, className: componentClassName, type: "date", ref: inputRef, defaultValue: formatInputDateValue(defaultValue), value: formatInputDateValue(value), "aria-labelledby": idLabel, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error ?? ariaErrormessage), "aria-describedby": idHelp, required: required, min: formatInputDateValue(min), max: formatInputDateValue(max) }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error ?? success, messageType: error ? "error" : "success" })] }));
13
13
  });
14
14
  InputDate.displayName = "InputDate";
15
15
  export { InputDate };
@@ -1,10 +1,12 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateLF.scss";
2
2
  import { ComponentProps } from "react";
3
3
  import { ItemMessage } from "../ItemMessage/ItemMessageLF";
4
- export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "value"> & {
4
+ export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "max" | "min" | "value"> & {
5
5
  classModifier?: string;
6
6
  defaultValue?: Date | string;
7
7
  value?: Date | string;
8
+ min?: Date | string;
9
+ max?: Date | string;
8
10
  helper?: string;
9
11
  error?: string;
10
12
  success?: string;
@@ -7,14 +7,15 @@ import { CardRadioItem } from "./CardRadioItem";
7
7
  const CardRadioCommon = ({ className, labelGroup, descriptionGroup, RadioComponent, IconComponent, isRequired, options, type = "vertical", error, name, value, onChange, ItemMessageComponent, ...inputProps }) => {
8
8
  const componentClassName = getComponentClassName("af-card-radio__container", className);
9
9
  const RadioGroupClassName = getComponentClassName("af-card-radio-group", className, type);
10
- const errorId = useId();
10
+ const cardRadioId = useId();
11
+ const errorId = `${cardRadioId}:error`;
11
12
  const isMobile = useIsSmallScreen(BREAKPOINT.SM);
12
13
  const size = isMobile
13
14
  ? "M"
14
15
  : "L";
15
16
  return (_jsxs("fieldset", { className: componentClassName, "aria-invalid": Boolean(error), "aria-errormessage": error ? errorId : undefined, children: [labelGroup && (_jsxs("legend", { className: "af-card-radio__legend", children: [_jsxs("p", { children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] }), descriptionGroup && (_jsx("p", { className: "af-card-radio__description", children: descriptionGroup }))] })), _jsx("div", { className: RadioGroupClassName, children: options.map((cardRadioItemProps) => (_jsx(CardRadioItem, { name: name, onChange: onChange, size: size, RadioComponent: RadioComponent, IconComponent: IconComponent, checked: value !== undefined
16
17
  ? value === cardRadioItemProps.value
17
- : undefined, ...inputProps, ...cardRadioItemProps }, `${name}-${crypto.randomUUID()}`))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] }));
18
+ : undefined, ...inputProps, ...cardRadioItemProps }, `${name ?? cardRadioId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] }));
18
19
  };
19
20
  CardRadioCommon.displayName = "CardRadioCommon";
20
21
  export { CardRadioCommon };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.5-alpha.378",
3
+ "version": "1.0.5-alpha.380",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "homepage": "https://github.com/AxaFrance/design-system#readme",
48
48
  "peerDependencies": {
49
- "@axa-fr/design-system-apollo-css": "1.0.5-alpha.378",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.378",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.380",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.380",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },