@axa-fr/design-system-apollo-react 1.0.5-alpha.438 → 1.0.5-alpha.440

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
+ export declare const DynamicIcon: ({ iconName, className, }: {
2
+ iconName: string;
3
+ className?: string;
4
+ }) => string | import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import facebook from "@axa-fr/design-system-apollo-css/facebook.svg";
3
+ import linkedin from "@axa-fr/design-system-apollo-css/linkedin.svg";
4
+ import twitterx from "@axa-fr/design-system-apollo-css/twitterx.svg";
5
+ import youtube from "@axa-fr/design-system-apollo-css/youtube.svg";
6
+ import { Svg } from "../../Svg/Svg";
7
+ export const DynamicIcon = ({ iconName, className, }) => {
8
+ switch (iconName) {
9
+ case "facebook":
10
+ return _jsx(Svg, { src: facebook, className: className });
11
+ case "twitter":
12
+ return _jsx(Svg, { src: twitterx, className: className });
13
+ case "youtube":
14
+ return _jsx(Svg, { src: youtube, className: className });
15
+ case "linkedin":
16
+ return _jsx(Svg, { src: linkedin, className: className });
17
+ default:
18
+ return iconName;
19
+ }
20
+ };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Layout/Footer/FooterApollo.scss";
2
+ export { type FooterProps, Footer } from "./FooterCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Layout/Footer/FooterApollo.scss";
2
+ export { Footer } from "./FooterCommon";
@@ -0,0 +1,10 @@
1
+ import { SocialMedia } from "./MenuIcons";
2
+ import { Link } from "./MenuLink";
3
+ export type FooterProps = {
4
+ links: Link[];
5
+ socialMedias?: SocialMedia[];
6
+ copyright: string;
7
+ expandLinkText: string;
8
+ id?: string;
9
+ };
10
+ export declare const Footer: ({ links, socialMedias, copyright, expandLinkText, id, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import expandMore from "@material-symbols/svg-400/outlined/keyboard_arrow_down.svg";
3
+ import classNames from "classnames";
4
+ import { useCallback, useState } from "react";
5
+ import { MenuIcons } from "./MenuIcons";
6
+ import { MenuLink } from "./MenuLink";
7
+ import { Svg } from "../../Svg/Svg";
8
+ export const Footer = ({ links, socialMedias = [], copyright, expandLinkText, id, }) => {
9
+ const [isAboutOpen, setIsAboutOpen] = useState(false);
10
+ const handleClick = useCallback(() => {
11
+ setIsAboutOpen((isOpen) => !isOpen);
12
+ }, []);
13
+ return (_jsxs("footer", { role: "contentinfo", id: id, className: "af-footer", children: [_jsxs("div", { className: "af-footer__footerTop", children: [_jsxs("nav", { role: "navigation", className: "af-footer__menuTop", "aria-label": expandLinkText, children: [_jsxs("button", { type: "button", onClick: handleClick, className: "af-footer__menuAboutTrigger", children: [_jsx("span", { className: "af-footer__menuAboutTriggerText", children: expandLinkText }), _jsx(Svg, { src: expandMore, className: classNames("af-footer__icon", "af-footer__iconTrigger", isAboutOpen && "af-footer__iconTrigger--display") })] }), _jsx(MenuLink, { links: links, isAboutOpen: isAboutOpen })] }), _jsx(MenuIcons, { socialMedias: socialMedias })] }), _jsx("div", { className: "af-footer__footerBottom", children: _jsx("div", { className: "af-footer__footerBottomWidth", children: _jsx("span", { className: "af-footer__textCopyright", children: copyright }) }) })] }));
14
+ };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Layout/Footer/FooterLF.scss";
2
+ export { type FooterProps, Footer } from "./FooterCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Layout/Footer/FooterLF.scss";
2
+ export { Footer } from "./FooterCommon";
@@ -0,0 +1,9 @@
1
+ export type SocialMedia = {
2
+ icon: "facebook" | "twitter" | "youtube" | "linkedin";
3
+ link: string;
4
+ };
5
+ type MenuIconsProps = {
6
+ socialMedias: SocialMedia[];
7
+ };
8
+ export declare const MenuIcons: ({ socialMedias }: MenuIconsProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { DynamicIcon } from "./DynamicIcons";
3
+ export const MenuIcons = ({ socialMedias }) => {
4
+ if (socialMedias.length === 0) {
5
+ return null;
6
+ }
7
+ return (_jsx("nav", { role: "navigation", className: "af-footer__footerMenuIcons", children: _jsx("ul", { children: socialMedias.map((socialItem) => (_jsx("li", { children: _jsx("a", { "aria-label": `social media ${socialItem.icon}`, className: "af-footer__menuIconLinks", href: socialItem.link, target: "_blank", rel: "noopener noreferrer", children: _jsx(DynamicIcon, { iconName: socialItem.icon }) }) }, socialItem.icon))) }) }));
8
+ };
@@ -0,0 +1,11 @@
1
+ export type Link = {
2
+ link: string;
3
+ text: string;
4
+ openInCurrentTab?: boolean;
5
+ };
6
+ type MenuLinkProps = {
7
+ links: Link[];
8
+ isAboutOpen?: boolean;
9
+ };
10
+ export declare const MenuLink: ({ links, isAboutOpen }: MenuLinkProps) => import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { useIsSmallScreen } from "../../utilities/hook/useIsSmallScreen";
4
+ import { BREAKPOINT } from "../../utilities/constants";
5
+ export const MenuLink = ({ links, isAboutOpen = false }) => {
6
+ const isSmallScreen = useIsSmallScreen(BREAKPOINT.MD);
7
+ if (links.length === 0) {
8
+ return null;
9
+ }
10
+ return (_jsx("ul", { className: classNames("af-footer__menuLinks", isAboutOpen && "af-footer__menuLinks--display"), children: links.map((menuItem) => (_jsx("li", { children: _jsx("a", { className: "af-footer__linkItem", href: menuItem.link, target: menuItem.openInCurrentTab ? "_top" : "_blank", rel: "noreferrer", tabIndex: isSmallScreen && !isAboutOpen ? -1 : undefined, children: menuItem.text }) }, menuItem.text))) }));
11
+ };
@@ -0,0 +1,5 @@
1
+ import type { MessageVariants } from "./types";
2
+ /**
3
+ * Returns the appropriate ARIA role for a message variant
4
+ */
5
+ export declare const getAriaRole: (variant: MessageVariants) => "alert" | "status";
@@ -0,0 +1,7 @@
1
+ import { messageVariants } from "./constants";
2
+ /**
3
+ * Returns the appropriate ARIA role for a message variant
4
+ */
5
+ export const getAriaRole = (variant) => variant === messageVariants.error || variant === messageVariants.warning
6
+ ? "alert"
7
+ : "status";
@@ -1,2 +1,5 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Message/MessageApollo.scss";
2
- export { Message, messageVariants, type MessageVariants, } from "./MessageCommon";
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
- export { Message, messageVariants, } from "./MessageCommon";
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 { type ComponentPropsWithoutRef, ComponentType, type PropsWithChildren, type ReactElement } from "react";
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<"div">;
20
- export declare const Message: ({ variant, className, title, children, action, iconSize, heading: Heading, }: PropsWithChildren<MessageProps>) => import("react/jsx-runtime").JSX.Element;
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 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]
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: "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 })) : null, children, action ? _jsx("div", { className: "af-message__action", children: action }) : null] })] }));
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
- export { Message, messageVariants, type MessageVariants, } from "./MessageCommon";
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
- export { Message, messageVariants, } from "./MessageCommon";
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,3 @@
1
+ import type { MessageVariants } from "./types";
2
+ export declare const messageVariants: Record<MessageVariants, MessageVariants>;
3
+ export declare const iconByVariant: Record<MessageVariants, string>;
@@ -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/dist/index.d.ts CHANGED
@@ -47,3 +47,4 @@ export { Toggle } from "./Toggle/ToggleApollo";
47
47
  export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
48
48
  export { type OptionType } from "./Form/InputPhone/InputPhone.types";
49
49
  export { Dropdown } from "./Form/Dropdown/DropdownApollo";
50
+ export { Footer, type FooterProps } from "./Layout/Footer/FooterApollo";
package/dist/index.js CHANGED
@@ -46,3 +46,4 @@ export { TimelineVertical } from "./TimelineVertical/TimelineVerticalApollo";
46
46
  export { Toggle } from "./Toggle/ToggleApollo";
47
47
  export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
48
48
  export { Dropdown } from "./Form/Dropdown/DropdownApollo";
49
+ export { Footer } from "./Layout/Footer/FooterApollo";
package/dist/indexLF.d.ts CHANGED
@@ -51,3 +51,4 @@ export { TimelineVertical } from "./TimelineVertical/TimelineVerticalLF";
51
51
  export { Toggle } from "./Toggle/ToggleLF";
52
52
  export { type OptionType } from "./Form/InputPhone/InputPhone.types";
53
53
  export { Dropdown } from "./Form/Dropdown/DropdownLF";
54
+ export { Footer, type FooterProps } from "./Layout/Footer/FooterLF";
package/dist/indexLF.js CHANGED
@@ -50,3 +50,4 @@ export { Tag, tagVariants } from "./Tag/TagLF";
50
50
  export { TimelineVertical } from "./TimelineVertical/TimelineVerticalLF";
51
51
  export { Toggle } from "./Toggle/ToggleLF";
52
52
  export { Dropdown } from "./Form/Dropdown/DropdownLF";
53
+ export { Footer } from "./Layout/Footer/FooterLF";
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.438",
3
+ "version": "1.0.5-alpha.440",
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.438",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.438",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.440",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.440",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },