@axa-fr/design-system-apollo-react 1.0.5-alpha.376 → 1.0.5-alpha.379
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
|
|
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;
|
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.
|
|
3
|
+
"version": "1.0.5-alpha.379",
|
|
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.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "1.0.5-alpha.379",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.379",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|