@axa-fr/design-system-apollo-react 1.0.3-alpha.211 → 1.0.3-alpha.217

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,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Message/MessageApollo.scss";
2
+ export { Message, messageVariants, type MessageVariants, } from "./MessageCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Message/MessageApollo.scss";
2
+ export { Message, messageVariants, } from "./MessageCommon";
@@ -0,0 +1,21 @@
1
+ import { type ComponentPropsWithoutRef, type PropsWithChildren, type ReactElement } from "react";
2
+ import { Button } from "../Button/ButtonCommon";
3
+ import { Link } from "../Link/LinkCommon";
4
+ type Headings = "h2" | "h3" | "h4" | "h5" | "h6";
5
+ export declare const messageVariants: {
6
+ readonly validation: "validation";
7
+ readonly error: "error";
8
+ readonly warning: "warning";
9
+ readonly information: "information";
10
+ readonly neutral: "neutral";
11
+ };
12
+ export type MessageVariants = keyof typeof messageVariants;
13
+ export type MessageProps = {
14
+ variant: MessageVariants;
15
+ title?: string;
16
+ action?: ReactElement<typeof Link | typeof Button>;
17
+ iconSize?: number;
18
+ heading?: Headings;
19
+ } & ComponentPropsWithoutRef<"div">;
20
+ export declare const Message: ({ variant, className, title, children, action, iconSize, heading: Heading, }: PropsWithChildren<MessageProps>) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } 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 warningIcon from "@material-symbols/svg-400/outlined/warning-fill.svg";
5
+ import neutralIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
6
+ import infoIcon from "@material-symbols/svg-400/outlined/emoji_objects-fill.svg";
7
+ import { useMemo, } from "react";
8
+ import { Svg } from "../Svg/Svg";
9
+ export const messageVariants = {
10
+ validation: "validation",
11
+ error: "error",
12
+ warning: "warning",
13
+ information: "information",
14
+ neutral: "neutral",
15
+ };
16
+ const getIconFromType = (variant) => ({
17
+ [messageVariants.validation]: validationIcon,
18
+ [messageVariants.error]: errorIcon,
19
+ [messageVariants.neutral]: neutralIcon,
20
+ [messageVariants.warning]: warningIcon,
21
+ [messageVariants.information]: infoIcon,
22
+ })[variant] || infoIcon;
23
+ export const Message = ({ variant = messageVariants.information, className, title, children, action, iconSize = 24, heading: Heading = "h4", }) => {
24
+ const icon = useMemo(() => getIconFromType(variant), [variant]);
25
+ return (_jsxs("div", { className: ["af-message", `af-message--${variant}`, className]
26
+ .filter(Boolean)
27
+ .join(" "), role: "alert", children: [_jsx(Svg, { src: icon, width: iconSize, height: iconSize, className: "af-message__icon", role: "presentation" }), _jsxs("div", { className: "af-message__content", children: [title && _jsx(Heading, { className: "af-message__title", children: title }), children, action && _jsx("div", { className: "af-message__action", children: action })] })] }));
28
+ };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Message/MessageLF.scss";
2
+ export { Message, messageVariants, type MessageVariants, } from "./MessageCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Message/MessageLF.scss";
2
+ export { Message, messageVariants, } from "./MessageCommon";
package/dist/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export { Icon, iconVariants, type IconVariants, iconSizeVariants, type IconSizeV
15
15
  export { Divider } from "./Divider/DividerApollo";
16
16
  export { Toggle } from "./Toggle/ToggleApollo";
17
17
  export { BasePicture } from "./BasePicture/BasePictureApollo";
18
+ export { Message, messageVariants, type MessageVariants, } from "./Message/MessageApollo";
package/dist/index.js CHANGED
@@ -15,3 +15,4 @@ export { Icon, iconVariants, iconSizeVariants, } from "./Icon/IconApollo";
15
15
  export { Divider } from "./Divider/DividerApollo";
16
16
  export { Toggle } from "./Toggle/ToggleApollo";
17
17
  export { BasePicture } from "./BasePicture/BasePictureApollo";
18
+ export { Message, messageVariants, } from "./Message/MessageApollo";
package/dist/indexLF.d.ts CHANGED
@@ -14,3 +14,4 @@ export { Icon, iconVariants, type IconVariants, iconSizeVariants, type IconSizeV
14
14
  export { Divider } from "./Divider/DividerLF";
15
15
  export { Toggle } from "./Toggle/ToggleLF";
16
16
  export { BasePicture } from "./BasePicture/BasePictureLF";
17
+ export { Message, messageVariants, type MessageVariants, } from "./Message/MessageLF";
package/dist/indexLF.js CHANGED
@@ -14,3 +14,4 @@ export { Icon, iconVariants, iconSizeVariants, } from "./Icon/IconLF";
14
14
  export { Divider } from "./Divider/DividerLF";
15
15
  export { Toggle } from "./Toggle/ToggleLF";
16
16
  export { BasePicture } from "./BasePicture/BasePictureLF";
17
+ export { Message, messageVariants, } from "./Message/MessageLF";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.3-alpha.211",
3
+ "version": "1.0.3-alpha.217",
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.3-alpha.211",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.211",
49
+ "@axa-fr/design-system-apollo-css": "1.0.3-alpha.217",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.217",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },