@axa-fr/design-system-apollo-react 1.0.5-alpha.439 → 1.0.5-alpha.441
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/Message/Message.helpers.d.ts +5 -0
- package/dist/Message/Message.helpers.js +7 -0
- package/dist/Message/MessageApollo.d.ts +4 -1
- package/dist/Message/MessageApollo.js +5 -1
- package/dist/Message/MessageCommon.d.ts +15 -11
- package/dist/Message/MessageCommon.js +11 -25
- package/dist/Message/MessageLF.d.ts +4 -1
- package/dist/Message/MessageLF.js +5 -1
- package/dist/Message/constants.d.ts +3 -0
- package/dist/Message/constants.js +19 -0
- package/dist/Message/types.d.ts +1 -0
- package/dist/Message/types.js +1 -0
- package/package.json +3 -3
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Message/MessageApollo.scss";
|
|
2
|
-
|
|
2
|
+
import { type MessageProps } from "./MessageCommon";
|
|
3
|
+
export { messageVariants } from "./constants";
|
|
4
|
+
export type { MessageVariants } from "./types";
|
|
5
|
+
export declare const Message: (props: MessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import "@axa-fr/design-system-apollo-css/dist/Message/MessageApollo.scss";
|
|
2
|
-
|
|
3
|
+
import { Icon } from "..";
|
|
4
|
+
import { MessageCommon } from "./MessageCommon";
|
|
5
|
+
export { messageVariants } from "./constants";
|
|
6
|
+
export const Message = (props) => (_jsx(MessageCommon, { ...props, IconComponent: Icon }));
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentPropsWithoutRef, ComponentType, ReactElement, ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../Button/ButtonCommon";
|
|
3
|
+
import type { Icon } from "../Icon/IconCommon";
|
|
3
4
|
import { Link } from "../Link/LinkCommon";
|
|
5
|
+
import type { MessageVariants } from "./types";
|
|
4
6
|
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
7
|
export type MessageProps = {
|
|
8
|
+
/** Message variant (validation, error, warning, information, neutral) */
|
|
14
9
|
variant: MessageVariants;
|
|
10
|
+
/** Title displayed in the message */
|
|
15
11
|
title?: string;
|
|
12
|
+
/** Main content of the message */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Action (link or button) displayed on the right side of the message */
|
|
16
15
|
action?: ReactElement<typeof Link | ComponentType<ButtonProps>>;
|
|
16
|
+
/** Icon size in pixels */
|
|
17
17
|
iconSize?: number;
|
|
18
|
+
/** HTML heading level used for the title */
|
|
18
19
|
heading?: Headings;
|
|
19
|
-
} & ComponentPropsWithoutRef<"
|
|
20
|
-
|
|
20
|
+
} & ComponentPropsWithoutRef<"section">;
|
|
21
|
+
type MessagePropsWithComponents = MessageProps & {
|
|
22
|
+
IconComponent: typeof Icon;
|
|
23
|
+
};
|
|
24
|
+
export declare const MessageCommon: ({ variant, className, title, children, action, iconSize, heading: Heading, IconComponent, ...sectionProps }: MessagePropsWithComponents) => import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export {};
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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]
|
|
2
|
+
import { iconByVariant, messageVariants } from "./constants";
|
|
3
|
+
import { getAriaRole } from "./Message.helpers";
|
|
4
|
+
const defaultClassName = "af-message";
|
|
5
|
+
export const MessageCommon = ({ variant = messageVariants.information, className, title, children, action, iconSize = 24, heading: Heading = "h4", IconComponent, ...sectionProps }) => {
|
|
6
|
+
const role = getAriaRole(variant);
|
|
7
|
+
return (_jsxs("section", { className: [
|
|
8
|
+
defaultClassName,
|
|
9
|
+
variant && `${defaultClassName}--${variant}`,
|
|
10
|
+
className,
|
|
11
|
+
]
|
|
26
12
|
.filter(Boolean)
|
|
27
|
-
.join(" "), role:
|
|
13
|
+
.join(" "), role: role, ...sectionProps, children: [_jsx(IconComponent, { src: iconByVariant[variant], 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 })) : null, children, action ? _jsx("div", { className: "af-message__action", children: action }) : null] })] }));
|
|
28
14
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Message/MessageLF.scss";
|
|
2
|
-
|
|
2
|
+
import { type MessageProps } from "./MessageCommon";
|
|
3
|
+
export { messageVariants } from "./constants";
|
|
4
|
+
export type { MessageVariants } from "./types";
|
|
5
|
+
export declare const Message: (props: MessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import "@axa-fr/design-system-apollo-css/dist/Message/MessageLF.scss";
|
|
2
|
-
|
|
3
|
+
import { Icon } from "../indexLF";
|
|
4
|
+
import { MessageCommon } from "./MessageCommon";
|
|
5
|
+
export { messageVariants } from "./constants";
|
|
6
|
+
export const Message = (props) => (_jsx(MessageCommon, { ...props, IconComponent: Icon }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import validationIcon from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
|
|
2
|
+
import infoIcon from "@material-symbols/svg-400/outlined/emoji_objects-fill.svg";
|
|
3
|
+
import errorIcon from "@material-symbols/svg-400/outlined/error-fill.svg";
|
|
4
|
+
import neutralIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
5
|
+
import warningIcon from "@material-symbols/svg-400/outlined/warning-fill.svg";
|
|
6
|
+
export const messageVariants = {
|
|
7
|
+
validation: "validation",
|
|
8
|
+
error: "error",
|
|
9
|
+
warning: "warning",
|
|
10
|
+
information: "information",
|
|
11
|
+
neutral: "neutral",
|
|
12
|
+
};
|
|
13
|
+
export const iconByVariant = {
|
|
14
|
+
validation: validationIcon,
|
|
15
|
+
error: errorIcon,
|
|
16
|
+
neutral: neutralIcon,
|
|
17
|
+
warning: warningIcon,
|
|
18
|
+
information: infoIcon,
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MessageVariants = "validation" | "error" | "warning" | "information" | "neutral";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.
|
|
3
|
+
"version": "1.0.5-alpha.441",
|
|
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.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "1.0.5-alpha.441",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.441",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|