@axa-fr/canopee-react 1.7.1-alpha.16 → 1.7.1-alpha.17

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,3 +1,4 @@
1
1
  import { type ItemFileProps } from "./ItemFileCommon";
2
+ import "@axa-fr/canopee-css/prospect/ContentItemMono/ContentItemMonoApollo.css";
2
3
  import "@axa-fr/canopee-css/prospect/Form/FileUpload/ItemFile/ItemFileApollo.css";
3
4
  export declare const ItemFile: (props: ItemFileProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,5 +6,6 @@ import { Icon } from "../../../Icon/IconApollo";
6
6
  import { Spinner } from "../../../Spinner/SpinnerApollo";
7
7
  import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
8
8
  import { ItemFileCommon } from "./ItemFileCommon";
9
+ import "@axa-fr/canopee-css/prospect/ContentItemMono/ContentItemMonoApollo.css";
9
10
  import "@axa-fr/canopee-css/prospect/Form/FileUpload/ItemFile/ItemFileApollo.css";
10
11
  export const ItemFile = (props) => (_jsx(ItemFileCommon, { ItemMessageComponent: ItemMessage, ItemIconComponent: Icon, ItemSpinnerComponent: Spinner, ClickIconComponent: ClickIcon, removeIcon: deleteIcon, previewIcon: visibilityIcon, ...props }));
@@ -1,7 +1,8 @@
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 {} from "react";
4
+ import { useMemo, } from "react";
5
+ import { ContentItemMonoCore } from "../../../ContentItemMono/ContentItemMonoCore";
5
6
  import { getClassName } from "../../../utilities/getClassName";
6
7
  const BASE_UNIT = 1000;
7
8
  const BYTE_UNITS = ["Ko", "Mo", "Go"];
@@ -19,9 +20,10 @@ export const ItemFileCommon = ({ file, isLoading, errorMessage, className, onRem
19
20
  const handleClick = (callback) => (e) => {
20
21
  callback(file, e);
21
22
  };
23
+ const statusIndicator = useMemo(() => isLoading && !hasError ? (_jsx(ItemSpinnerComponent, { size: 24 })) : (_jsx(ItemIconComponent, { size: "S", src: hasError ? errorIcon : validationIcon })), [ItemIconComponent, ItemSpinnerComponent, hasError, isLoading]);
22
24
  return (_jsxs("section", { className: getClassName({
23
25
  baseClassName: "af-item-file",
24
26
  modifiers: [hasError && "error"],
25
27
  className,
26
- }), "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 })] }));
28
+ }), "aria-busy": isLoading ? true : undefined, "aria-live": "polite", ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [_jsx(ContentItemMonoCore, { leftComponent: statusIndicator, primarySubtitle: file.name, subtitle: 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 })] }));
27
29
  };
@@ -1,3 +1,4 @@
1
1
  import { type ItemFileProps } from "./ItemFileCommon";
2
+ import "@axa-fr/canopee-css/client/ContentItemMono/ContentItemMonoLF.css";
2
3
  import "@axa-fr/canopee-css/client/Form/FileUpload/ItemFile/ItemFileLF.css";
3
4
  export declare const ItemFile: (props: ItemFileProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,5 +6,6 @@ import { Icon } from "../../../Icon/IconLF";
6
6
  import { Spinner } from "../../../Spinner/SpinnerLF";
7
7
  import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
8
8
  import { ItemFileCommon } from "./ItemFileCommon";
9
+ import "@axa-fr/canopee-css/client/ContentItemMono/ContentItemMonoLF.css";
9
10
  import "@axa-fr/canopee-css/client/Form/FileUpload/ItemFile/ItemFileLF.css";
10
11
  export const ItemFile = (props) => (_jsx(ItemFileCommon, { ItemMessageComponent: ItemMessage, ItemIconComponent: Icon, ItemSpinnerComponent: Spinner, ClickIconComponent: ClickIcon, removeIcon: deleteIconFilled, previewIcon: visibilityIcon, ...props }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.7.1-alpha.16",
3
+ "version": "1.7.1-alpha.17",
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.7.1-alpha.16",
52
+ "@axa-fr/canopee-css": "1.7.1-alpha.17",
53
53
  "@material-symbols/svg-400": ">= 0.19.0",
54
54
  "@material-symbols/svg-700": ">= 0.19.0",
55
55
  "react": ">= 18"