@axa-fr/design-system-apollo-react 3.0.1-alpha.15 → 3.0.1-alpha.18
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/FileUpload/FileUpload/FileUploadApollo.d.ts +1 -1
- package/dist/Form/FileUpload/FileUpload/FileUploadApollo.js +1 -1
- package/dist/Form/FileUpload/FileUpload/FileUploadCommon.js +5 -1
- package/dist/Form/FileUpload/FileUpload/FileUploadLF.d.ts +1 -1
- package/dist/Form/FileUpload/FileUpload/FileUploadLF.js +1 -1
- package/dist/Form/FileUpload/InputFile/InputFileCommon.js +12 -7
- package/dist/Form/FileUpload/ItemFile/ItemFileCommon.js +6 -3
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type FileUploadProps } from "./FileUploadCommon";
|
|
2
|
-
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
|
|
3
3
|
export declare const FileUpload: import("react").ForwardRefExoticComponent<Omit<FileUploadProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { InputFile } from "../InputFile/InputFileApollo";
|
|
4
4
|
import { FileUploadCommon } from "./FileUploadCommon";
|
|
5
|
-
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/
|
|
5
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
|
|
6
6
|
export const FileUpload = forwardRef((props, ref) => (_jsx(FileUploadCommon, { ...props, ref: ref, InputFileComponent: InputFile })));
|
|
7
7
|
FileUpload.displayName = "FileUpload";
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, forwardRef, } from "react";
|
|
3
3
|
import { generateId } from "../../../utilities/generateId";
|
|
4
|
+
import { getClassName } from "../../../utilities/getClassName";
|
|
4
5
|
export const FileUploadCommon = forwardRef(({ InputFileComponent, className, children, fileListLabel = "Vos fichiers importés :", ...props }, ref) => {
|
|
5
|
-
return (_jsx(InputFileComponent, { ...props, className:
|
|
6
|
+
return (_jsx(InputFileComponent, { ...props, className: getClassName({
|
|
7
|
+
baseClassName: "af-file-upload",
|
|
8
|
+
className,
|
|
9
|
+
}), ref: ref, children: children ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "af-file-list__title", children: fileListLabel }), _jsx("ul", { className: "af-file-list", children: Children.map(children, (child) => (_jsx("li", { className: "af-file-list__item", children: child }, generateId(child)))) })] })) : null }));
|
|
6
10
|
});
|
|
7
11
|
FileUploadCommon.displayName = "FileUploadCommon";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type FileUploadProps } from "./FileUploadCommon";
|
|
2
|
-
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
|
|
3
3
|
export declare const FileUpload: import("react").ForwardRefExoticComponent<Omit<FileUploadProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { InputFile } from "../InputFile/InputFileLF";
|
|
4
4
|
import { FileUploadCommon } from "./FileUploadCommon";
|
|
5
|
-
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/
|
|
5
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
|
|
6
6
|
export const FileUpload = forwardRef((props, ref) => (_jsx(FileUploadCommon, { ...props, ref: ref, InputFileComponent: InputFile })));
|
|
7
7
|
FileUpload.displayName = "FileUpload";
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
3
|
import addCircleIcon from "@material-symbols/svg-400/rounded/add_circle-fill.svg";
|
|
4
4
|
import { Svg } from "../../../Svg/Svg";
|
|
5
|
+
import { getClassName } from "../../../utilities/getClassName";
|
|
5
6
|
const DEFAULT_DROPZONE_LABELS = {
|
|
6
7
|
dropzone: "Glisser et déposer un fichier",
|
|
7
8
|
or: "ou",
|
|
@@ -22,13 +23,17 @@ export const InputFileCommon = forwardRef(({ ItemLabelComponent, ItemMessageComp
|
|
|
22
23
|
or: dropzoneLabels.or || DEFAULT_DROPZONE_LABELS.or,
|
|
23
24
|
button: dropzoneLabels.button || DEFAULT_DROPZONE_LABELS.button,
|
|
24
25
|
};
|
|
25
|
-
return (_jsxs("div", { className:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
return (_jsxs("div", { className: getClassName({
|
|
27
|
+
baseClassName: "af-input-file",
|
|
28
|
+
className,
|
|
29
|
+
}), style: style, children: [_jsx(ItemLabelComponent, { htmlFor: inputId, description: description, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, required: required, ...labelProps, children: label }), _jsxs("div", { className: "af-input-file__container", children: [_jsxs("span", { className: getClassName({
|
|
30
|
+
baseClassName: "af-input-file__dropzone",
|
|
31
|
+
modifiers: [hasError && "error"],
|
|
32
|
+
}), children: [_jsx("input", { ref: ref, type: "file", id: inputId, required: required, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": ariaDescribedby.length > 0
|
|
31
33
|
? ariaDescribedby.join(" ")
|
|
32
|
-
: undefined, ...props }), _jsx("span", { children: resolvedDropzoneLabels.dropzone }), _jsx("span", { children: resolvedDropzoneLabels.or }), _jsxs("span", { className:
|
|
34
|
+
: undefined, ...props }), _jsx("span", { children: resolvedDropzoneLabels.dropzone }), _jsx("span", { children: resolvedDropzoneLabels.or }), _jsxs("span", { className: getClassName({
|
|
35
|
+
baseClassName: "af-btn-client",
|
|
36
|
+
modifiers: ["tertiary"],
|
|
37
|
+
}), children: [_jsx(Svg, { src: addCircleIcon, role: "presentation" }), resolvedDropzoneLabels.button] })] }), helper ? (_jsx("span", { id: helpId, className: "af-input-file__help", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message, messageType: messageType })] }), children] }));
|
|
33
38
|
});
|
|
34
39
|
InputFileCommon.displayName = "InputFileCommon";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import validationIcon from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
|
|
3
3
|
import errorIcon from "@material-symbols/svg-400/outlined/error-fill.svg";
|
|
4
|
+
import { getClassName } from "../../../utilities/getClassName";
|
|
4
5
|
const BASE_UNIT = 1000;
|
|
5
6
|
const BYTE_UNITS = ["Ko", "Mo", "Go"];
|
|
6
7
|
const getReadableFileSizeString = (fileSizeInBytes) => {
|
|
@@ -17,7 +18,9 @@ export const ItemFileCommon = ({ file, isLoading, errorMessage, className, onRem
|
|
|
17
18
|
const handleClick = (callback) => (e) => {
|
|
18
19
|
callback(file, e);
|
|
19
20
|
};
|
|
20
|
-
return (_jsxs("section", { className:
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
return (_jsxs("section", { className: getClassName({
|
|
22
|
+
baseClassName: "af-item-file",
|
|
23
|
+
modifiers: [hasError && "error"],
|
|
24
|
+
className,
|
|
25
|
+
}), "aria-busy": isLoading ? true : undefined, "aria-live": "polite", ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [isLoading && !hasError ? (_jsx(ItemSpinnerComponent, { size: 24 })) : (_jsx(ItemIconComponent, { size: "S", src: hasError ? errorIcon : validationIcon })), _jsx("p", { className: "af-item-file__file-name", children: file.name }), _jsx("p", { className: "af-item-file__file-size", children: getReadableFileSizeString(file.size) }), _jsxs("div", { className: "af-item-file__actions", children: [!isLoading && !hasError && (_jsx(ClickIconComponent, { src: previewIcon, onClick: handleClick(onPreview), "aria-label": `Previsualiser le fichier ${file.name}`, ...previewProps })), _jsx(ClickIconComponent, { src: removeIcon, onClick: handleClick(onRemove), "aria-label": `Suppression du fichier ${file.name}`, ...removeProps })] })] }), _jsx(ItemMessageComponent, { message: errorMessage })] }));
|
|
23
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-apollo-react",
|
|
3
|
-
"version": "3.0.1-alpha.
|
|
3
|
+
"version": "3.0.1-alpha.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@axa-fr/design-system-apollo-css": "3.0.1-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "3.0.1-alpha.18",
|
|
50
50
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
51
51
|
"react": ">= 18",
|
|
52
|
-
"@axa-fr/design-system-look-and-feel-css": "3.0.1-alpha.
|
|
52
|
+
"@axa-fr/design-system-look-and-feel-css": "3.0.1-alpha.18"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@material-symbols/svg-400": {
|