@axa-fr/design-system-slash-react 1.1.0-alpha.4 → 1.1.0-alpha.6
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.
package/dist/Form/Date/Date.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import "@axa-fr/design-system-slash-css/dist/Form/Date/Date.scss";
|
|
|
2
2
|
import { ComponentPropsWithRef } from "react";
|
|
3
3
|
type Props = Omit<ComponentPropsWithRef<"input">, "value"> & {
|
|
4
4
|
classModifier?: string;
|
|
5
|
-
defaultValue?: Date;
|
|
6
|
-
value?: Date;
|
|
5
|
+
defaultValue?: Date | string;
|
|
6
|
+
value?: Date | string;
|
|
7
7
|
};
|
|
8
8
|
declare const Date: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export { Date };
|
package/dist/Form/Date/Date.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/Date/Date.scss";
|
|
3
|
-
import { forwardRef
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
4
|
import { getComponentClassName } from "../../utilities";
|
|
5
|
-
|
|
6
|
-
const formattedDateValue = new globalThis.Date(dateValue);
|
|
7
|
-
const monthFormatted = `0${formattedDateValue.getMonth() + 1}`.slice(-2);
|
|
8
|
-
const dayFormatted = `0${formattedDateValue.getDate()}`.slice(-2);
|
|
9
|
-
return `${formattedDateValue.getFullYear()}-${monthFormatted}-${dayFormatted}`;
|
|
10
|
-
};
|
|
5
|
+
import { formatDateInputValue } from "../../utilities/helpers/date";
|
|
11
6
|
const Date = forwardRef(({ className, classModifier, defaultValue, value, ...otherProps }, ref) => {
|
|
12
7
|
const componentClassName = getComponentClassName(className, classModifier, "af-form__input-date");
|
|
13
|
-
|
|
14
|
-
return value ? formatDateValue(value) : undefined;
|
|
15
|
-
}, [value]);
|
|
16
|
-
const currentDefaultValue = useMemo(() => {
|
|
17
|
-
return defaultValue ? formatDateValue(defaultValue) : undefined;
|
|
18
|
-
}, [defaultValue]);
|
|
19
|
-
return (_jsx("input", { className: componentClassName, type: "date", defaultValue: currentDefaultValue, value: currentValue, ref: ref, disabled: classModifier?.includes("disabled"), required: classModifier?.includes("required"), ...otherProps }));
|
|
8
|
+
return (_jsx("input", { className: componentClassName, type: "date", defaultValue: formatDateInputValue(defaultValue), value: formatDateInputValue(value), ref: ref, disabled: classModifier?.includes("disabled"), required: classModifier?.includes("required"), ...otherProps }));
|
|
20
9
|
});
|
|
21
10
|
Date.displayName = "Date";
|
|
22
11
|
export { Date };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatDateInputValue: (value?: Date | string) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@axa-fr/design-system-slash-css": "1.1.0-alpha.
|
|
48
|
+
"@axa-fr/design-system-slash-css": "1.1.0-alpha.6",
|
|
49
49
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
50
50
|
"react": ">= 18"
|
|
51
51
|
},
|