@axa-fr/design-system-apollo-react 1.0.5-alpha.338 → 1.0.5-alpha.340

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.
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/ItemFile/ItemFileApollo.scss";
2
+ import type { ItemFileProps } from "./types";
3
+ export { itemFileVariants } from "./ItemFileCommon";
4
+ export declare const ItemFile: ({ onDeleteClick, onVisibilityClick, ariaLabelVisibility, ariaLabelDelete, filename, ...props }: ItemFileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/ItemFile/ItemFileApollo.scss";
3
+ import deleteIcon from "@material-symbols/svg-400/outlined/delete.svg";
4
+ import visibilityIcon from "@material-symbols/svg-400/outlined/visibility-fill.svg";
5
+ import { ClickIcon } from "../../ClickIcon/ClickIconApollo";
6
+ import { Icon } from "../../Icon/IconApollo";
7
+ import { Spinner } from "../../Spinner/SpinnerApollo";
8
+ import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
9
+ import { ItemFileCommon } from "./ItemFileCommon";
10
+ export { itemFileVariants } from "./ItemFileCommon";
11
+ export const ItemFile = ({ onDeleteClick, onVisibilityClick, ariaLabelVisibility, ariaLabelDelete, filename, ...props }) => (_jsx(ItemFileCommon, { ItemMessageComponent: ItemMessage, ItemIconComponent: Icon, ItemSpinnerComponent: Spinner, deleteIcon: _jsx(ClickIcon, { src: deleteIcon, onClick: onDeleteClick, "aria-label": ariaLabelDelete || `Suppression du fichier ${filename}` }), visibilityIcon: _jsx(ClickIcon, { src: visibilityIcon, onClick: onVisibilityClick, "aria-label": ariaLabelVisibility || `Observer le fichier ${filename}` }), ...props }));
@@ -0,0 +1,26 @@
1
+ import { ReactNode, type ComponentProps, type ComponentPropsWithoutRef, type ComponentType } from "react";
2
+ import type { IconProps } from "../../Icon/IconCommon";
3
+ import { Spinner } from "../../Spinner/SpinnerCommon";
4
+ import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
5
+ export declare const itemFileVariants: {
6
+ readonly success: "success";
7
+ readonly error: "error";
8
+ readonly loading: "loading";
9
+ };
10
+ export type ItemFileState = keyof typeof itemFileVariants;
11
+ export type ItemFileCommonProps = {
12
+ state: ItemFileState;
13
+ ariaLabelVisibility?: string;
14
+ ariaLabelDelete?: string;
15
+ filename?: string;
16
+ title: string;
17
+ subTitle: string;
18
+ errorMessage?: string;
19
+ deleteIcon: ReactNode;
20
+ visibilityIcon?: ReactNode;
21
+ success?: string;
22
+ ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
23
+ ItemIconComponent: ComponentType<IconProps>;
24
+ ItemSpinnerComponent: ComponentType<ComponentProps<typeof Spinner>>;
25
+ } & Omit<ComponentPropsWithoutRef<"section">, "children">;
26
+ export declare const ItemFileCommon: ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }: ItemFileCommonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { ItemStateIcon } from "./ItemStateIcon";
4
+ export const itemFileVariants = {
5
+ success: "success",
6
+ error: "error",
7
+ loading: "loading",
8
+ };
9
+ export const ItemFileCommon = ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }) => {
10
+ const classname = classNames("af-item-file", errorMessage && "af-item-file--error", className);
11
+ return (_jsxs("section", { className: classname, ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [_jsx(ItemStateIcon, { state: state, ItemIconComponent: ItemIconComponent, ItemSpinnerComponent: ItemSpinnerComponent }), _jsx("p", { className: "af-item-file__title", children: title }), _jsx("p", { className: "af-item-file__subtitle", children: subTitle }), _jsxs("div", { className: "af-item-file__actions", children: [state === "success" && visibilityIcon, deleteIcon] })] }), _jsx(ItemMessageComponent, { message: errorMessage ?? success, messageType: errorMessage ? "error" : "success" })] }));
12
+ };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/ItemFile/ItemFileLF.scss";
2
+ import type { ItemFileProps } from "./types";
3
+ export { itemFileVariants } from "./ItemFileCommon";
4
+ export declare const ItemFile: ({ onDeleteClick, onVisibilityClick, ariaLabelVisibility, ariaLabelDelete, filename, ...props }: ItemFileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/ItemFile/ItemFileLF.scss";
3
+ import deleteIconFilled from "@material-symbols/svg-400/outlined/delete-fill.svg";
4
+ import visibilityIcon from "@material-symbols/svg-400/outlined/visibility-fill.svg";
5
+ import { ClickIcon } from "../../ClickIcon/ClickIconLF";
6
+ import { Icon } from "../../Icon/IconLF";
7
+ import { Spinner } from "../../Spinner/SpinnerLF";
8
+ import { ItemMessage } from "../ItemMessage/ItemMessageLF";
9
+ import { ItemFileCommon } from "./ItemFileCommon";
10
+ export { itemFileVariants } from "./ItemFileCommon";
11
+ export const ItemFile = ({ onDeleteClick, onVisibilityClick, ariaLabelVisibility, ariaLabelDelete, filename, ...props }) => (_jsx(ItemFileCommon, { ItemMessageComponent: ItemMessage, ItemIconComponent: Icon, ItemSpinnerComponent: Spinner, deleteIcon: _jsx(ClickIcon, { src: deleteIconFilled, onClick: onDeleteClick, "aria-label": ariaLabelDelete || `Suppression du fichier ${filename}` }), visibilityIcon: _jsx(ClickIcon, { src: visibilityIcon, onClick: onVisibilityClick, "aria-label": ariaLabelVisibility || `Observer le fichier ${filename}` }), ...props }));
@@ -0,0 +1,11 @@
1
+ import type { ComponentType, ComponentProps } from "react";
2
+ import type { IconProps } from "../../Icon/IconCommon";
3
+ import { Spinner } from "../../Spinner/SpinnerCommon";
4
+ import type { ItemFileState } from "./ItemFileCommon";
5
+ interface ItemStateIconProps {
6
+ state: ItemFileState;
7
+ ItemIconComponent: ComponentType<IconProps>;
8
+ ItemSpinnerComponent: ComponentType<ComponentProps<typeof Spinner>>;
9
+ }
10
+ declare const ItemStateIcon: ({ state, ItemIconComponent, ItemSpinnerComponent, }: ItemStateIconProps) => import("react/jsx-runtime").JSX.Element;
11
+ export { ItemStateIcon };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import validationIcon from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
3
+ import errorIcon from "@material-symbols/svg-400/outlined/error-fill.svg";
4
+ import { getComponentClassName } from "../../utilities/getComponentClassName";
5
+ const ItemStateIcon = ({ state, ItemIconComponent, ItemSpinnerComponent, }) => {
6
+ const componentClassName = getComponentClassName("af-icon", `af-icon__${state}`);
7
+ return state === "loading" ? (_jsx(ItemSpinnerComponent, { size: 24, className: "af-item-file__spinner" })) : (_jsx(ItemIconComponent, { className: componentClassName, size: "S", src: state === "success" ? validationIcon : errorIcon }));
8
+ };
9
+ export { ItemStateIcon };
@@ -0,0 +1,6 @@
1
+ import { type MouseEvent } from "react";
2
+ import type { ItemFileCommonProps } from "./ItemFileCommon";
3
+ export type ItemFileProps = Omit<ItemFileCommonProps, "ItemMessageComponent" | "ItemIconComponent" | "ItemClickIconComponent" | "ItemSpinnerComponent" | "deleteIcon" | "visibilityIcon"> & {
4
+ onDeleteClick?: (event: MouseEvent<HTMLButtonElement>) => void;
5
+ onVisibilityClick?: (event: MouseEvent<HTMLButtonElement>) => void;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import { ComponentPropsWithoutRef } from "react";
1
2
  export declare const spinnerVariants: {
2
3
  readonly blue: "blue";
3
4
  readonly gray: "gray";
@@ -8,9 +9,9 @@ type SpinnerProps = {
8
9
  size?: 24 | 32 | 40;
9
10
  variant?: SpinnerVariants;
10
11
  text?: string;
11
- };
12
+ } & ComponentPropsWithoutRef<"div">;
12
13
  declare const Spinner: {
13
- ({ size, variant, text, }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
14
+ ({ size, variant, text, className, ...props }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
14
15
  displayName: string;
15
16
  };
16
17
  export { Spinner };
@@ -5,10 +5,11 @@ export const spinnerVariants = {
5
5
  white: "white",
6
6
  };
7
7
  const DEFAULT_CLASSNAME = "af-spinner";
8
- const Spinner = ({ size = 40, variant = "blue", text = "Chargement en cours", }) => (_jsx("div", { role: "alert", "aria-busy": true, "aria-label": text, "aria-live": "assertive", className: [
8
+ const Spinner = ({ size = 40, variant = "blue", text = "Chargement en cours", className, ...props }) => (_jsx("div", { role: "alert", ...props, "aria-busy": true, "aria-label": text, "aria-live": "assertive", className: [
9
9
  DEFAULT_CLASSNAME,
10
10
  `${DEFAULT_CLASSNAME}--${variant}`,
11
11
  `${DEFAULT_CLASSNAME}--${size}`,
12
+ className,
12
13
  ]
13
14
  .filter(Boolean)
14
15
  .join(" "), style: {
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextApollo";
18
18
  export { InputDate } from "./Form/InputDate/InputDateApollo";
19
19
  export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
20
20
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
21
+ export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileApollo";
21
22
  export { TextArea } from "./Form/TextArea/TextAreaApollo";
22
23
  export { Radio } from "./Form/Radio/Radio/RadioApollo";
23
24
  export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextApollo";
18
18
  export { InputDate } from "./Form/InputDate/InputDateApollo";
19
19
  export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
20
20
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
21
+ export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileApollo";
21
22
  export { TextArea } from "./Form/TextArea/TextAreaApollo";
22
23
  export { Radio } from "./Form/Radio/Radio/RadioApollo";
23
24
  export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
package/dist/indexLF.d.ts CHANGED
@@ -20,6 +20,7 @@ export { InputDate,
20
20
  InputDate as DateInput, } from "./Form/InputDate/InputDateLF";
21
21
  export { InputPhone } from "./Form/InputPhone/InputPhoneLF";
22
22
  export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
23
+ export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileLF";
23
24
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
24
25
  export { TextArea } from "./Form/TextArea/TextAreaLF";
25
26
  export { Radio } from "./Form/Radio/Radio/RadioLF";
package/dist/indexLF.js CHANGED
@@ -20,6 +20,7 @@ export { InputDate,
20
20
  InputDate as DateInput, } from "./Form/InputDate/InputDateLF";
21
21
  export { InputPhone } from "./Form/InputPhone/InputPhoneLF";
22
22
  export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
23
+ export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileLF";
23
24
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
24
25
  export { TextArea } from "./Form/TextArea/TextAreaLF";
25
26
  export { Radio } from "./Form/Radio/Radio/RadioLF";
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.338",
3
+ "version": "1.0.5-alpha.340",
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.338",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.338",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.340",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.340",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },