@axa-fr/design-system-apollo-react 3.1.0-RC.1 → 3.1.0-alpha.7
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/Accordion/AccordionApollo.js +2 -2
- package/dist/Accordion/AccordionCommon.d.ts +13 -9
- package/dist/Accordion/AccordionCommon.js +12 -6
- package/dist/Accordion/AccordionLF.js +2 -2
- package/dist/AccordionCore/AccordionCoreCommon.d.ts +11 -7
- package/dist/AccordionCore/AccordionCoreCommon.js +12 -4
- package/package.json +2 -2
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerApollo.d.ts +0 -3
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerApollo.js +0 -5
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerCommon.d.ts +0 -12
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerCommon.js +0 -9
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerLF.d.ts +0 -3
- package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerLF.js +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AccordionCore } from "../AccordionCore/AccordionCoreApollo";
|
|
3
|
-
import {
|
|
3
|
+
import { Tag } from "../Tag/TagApollo";
|
|
4
4
|
import { Icon } from "../Icon/IconApollo";
|
|
5
5
|
import { AccordionCommon } from "./AccordionCommon";
|
|
6
6
|
import "@axa-fr/design-system-apollo-css/dist/Accordion/AccordionApollo.css";
|
|
7
|
-
export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore,
|
|
7
|
+
export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, TagComponent: Tag, IconComponent: Icon }));
|
|
8
8
|
export { accordionVariants } from "./AccordionCommon";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ComponentProps, ComponentType } from "react";
|
|
2
|
+
import type { TagProps } from "../Tag/TagCommon";
|
|
3
|
+
import type { IconProps } from "../Icon/IconCommon";
|
|
4
|
+
import type { AccordionCoreProps } from "../AccordionCore/AccordionCoreCommon";
|
|
5
5
|
export declare const accordionVariants: {
|
|
6
6
|
readonly primary: "primary";
|
|
7
7
|
readonly secondary: "secondary";
|
|
8
8
|
};
|
|
9
|
-
export type AccordionVariants = keyof typeof accordionVariants;
|
|
9
|
+
export type AccordionVariants = (typeof accordionVariants)[keyof typeof accordionVariants];
|
|
10
10
|
export type AccordionProps = {
|
|
11
11
|
variant?: AccordionVariants;
|
|
12
12
|
title: string;
|
|
@@ -14,11 +14,15 @@ export type AccordionProps = {
|
|
|
14
14
|
icon?: string;
|
|
15
15
|
info1: string;
|
|
16
16
|
info2: string;
|
|
17
|
-
|
|
17
|
+
dateLabel?: string;
|
|
18
|
+
dateProps?: Omit<ComponentProps<"time">, "children">;
|
|
19
|
+
tagLabel?: string;
|
|
20
|
+
tagProps?: Omit<TagProps, "children">;
|
|
21
|
+
} & Omit<AccordionCoreProps, "summary">;
|
|
18
22
|
type AccordionCommonProps = AccordionProps & {
|
|
19
23
|
AccordionCoreComponent: ComponentType<AccordionCoreProps>;
|
|
20
|
-
|
|
21
|
-
IconComponent: ComponentType<
|
|
24
|
+
TagComponent: ComponentType<TagProps>;
|
|
25
|
+
IconComponent: ComponentType<IconProps>;
|
|
22
26
|
};
|
|
23
|
-
export declare const AccordionCommon: ({ variant, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent,
|
|
27
|
+
export declare const AccordionCommon: ({ variant, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, TagComponent, IconComponent, ...accordionCoreProps }: AccordionCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
28
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { getComponentClassName } from "../utilities/getComponentClassName";
|
|
2
|
+
import { getClassName } from "../utilities/getClassName";
|
|
4
3
|
export const accordionVariants = {
|
|
5
4
|
primary: "primary",
|
|
6
5
|
secondary: "secondary",
|
|
7
6
|
};
|
|
8
|
-
export const AccordionCommon = ({ variant = accordionVariants.primary, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const AccordionCommon = ({ variant = accordionVariants.primary, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, TagComponent, IconComponent, ...accordionCoreProps }) => (_jsx(AccordionCoreComponent, { className: getClassName({
|
|
8
|
+
baseClassName: "af-apollo-accordion",
|
|
9
|
+
modifiers: [variant],
|
|
10
|
+
className,
|
|
11
|
+
}), summary: _jsxs(_Fragment, { children: [icon ? (_jsx(IconComponent, { role: "presentation", src: icon, variant: "primary", size: "S", className: "af-accordion__icon" })) : null, _jsx("p", { className: "af-accordion__title", children: title }), subtitle ? _jsx("p", { className: "af-accordion__subtitle", children: subtitle }) : null, tagLabel ? (_jsx(TagComponent, { variant: "warning", ...tagProps, className: getClassName({
|
|
12
|
+
baseClassName: "af-accordion__tag-container",
|
|
13
|
+
className: tagProps?.className,
|
|
14
|
+
}), children: tagLabel })) : null, dateLabel ? (_jsx("time", { ...dateProps, className: getClassName({
|
|
15
|
+
baseClassName: "af-accordion__date",
|
|
16
|
+
className: dateProps?.className,
|
|
17
|
+
}), children: dateLabel })) : null, info1 ? _jsx("p", { className: "af-accordion__info1", children: info1 }) : null, info2 ? _jsx("p", { className: "af-accordion__info2", children: info2 }) : null] }), ...accordionCoreProps, children: children }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AccordionCore } from "../AccordionCore/AccordionCoreLF";
|
|
3
|
-
import {
|
|
3
|
+
import { Tag } from "../Tag/TagLF";
|
|
4
4
|
import { AccordionCommon } from "./AccordionCommon";
|
|
5
5
|
import { Icon } from "../Icon/IconCommon";
|
|
6
6
|
import "@axa-fr/design-system-apollo-css/dist/Accordion/AccordionLF.css";
|
|
7
|
-
export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore,
|
|
7
|
+
export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, TagComponent: Tag, IconComponent: Icon }));
|
|
8
8
|
export { accordionVariants } from "./AccordionCommon";
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { type ComponentProps, ComponentType, type
|
|
2
|
-
import {
|
|
1
|
+
import { type ComponentProps, type ComponentType, type MouseEventHandler, type ReactNode } from "react";
|
|
2
|
+
import type { IconProps } from "../Icon/IconCommon";
|
|
3
|
+
type SummaryOnClick = MouseEventHandler<HTMLElement>;
|
|
3
4
|
export type AccordionCoreProps = {
|
|
4
5
|
summary: ReactNode;
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use `open` instead
|
|
8
|
+
*/
|
|
6
9
|
isOpen?: boolean;
|
|
7
|
-
summaryProps?: ComponentProps<"summary">;
|
|
8
|
-
onClick?:
|
|
9
|
-
} &
|
|
10
|
+
summaryProps?: Omit<ComponentProps<"summary">, "onClick">;
|
|
11
|
+
onClick?: SummaryOnClick;
|
|
12
|
+
} & ComponentProps<"details">;
|
|
10
13
|
export type AccordionPropsCommonProps = AccordionCoreProps & {
|
|
11
|
-
IconComponent: ComponentType<
|
|
14
|
+
IconComponent: ComponentType<IconProps>;
|
|
12
15
|
};
|
|
13
16
|
export declare const AccordionCoreCommon: ({ summary, children, className, summaryProps, isOpen, IconComponent, onClick, ...detailsProps }: AccordionPropsCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, } from "react";
|
|
3
3
|
import keyboardDown from "@material-symbols/svg-400/rounded/keyboard_arrow_down-fill.svg";
|
|
4
|
+
import { getClassName } from "../utilities/getClassName";
|
|
4
5
|
export const AccordionCoreCommon = ({ summary, children, className, summaryProps, isOpen = false, IconComponent, onClick, ...detailsProps }) => {
|
|
5
|
-
const
|
|
6
|
+
const handleSummaryClick = useCallback((event) => {
|
|
6
7
|
if (onClick) {
|
|
7
8
|
event.preventDefault();
|
|
8
9
|
onClick(event);
|
|
9
10
|
}
|
|
10
11
|
}, [onClick]);
|
|
11
|
-
return (_jsxs("details", { className:
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
return (_jsxs("details", { className: getClassName({
|
|
13
|
+
baseClassName: "af-apollo-accordion",
|
|
14
|
+
className,
|
|
15
|
+
}), open: isOpen, ...detailsProps, children: [_jsxs("summary", { onClick: handleSummaryClick, tabIndex: 0, ...summaryProps, className: getClassName({
|
|
16
|
+
baseClassName: "af-apollo-accordion__summary",
|
|
17
|
+
className: summaryProps?.className,
|
|
18
|
+
}), children: [summary, _jsx("div", { className: getClassName({
|
|
19
|
+
baseClassName: "af-accordion__arrow",
|
|
20
|
+
className: "af-click-icon",
|
|
21
|
+
}), children: _jsx(IconComponent, { src: keyboardDown, role: "presentation" }) })] }), children] }));
|
|
14
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-apollo-react",
|
|
3
|
-
"version": "3.1.0-
|
|
3
|
+
"version": "3.1.0-alpha.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@axa-fr/design-system-apollo-css": "3.1.0-
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "3.1.0-alpha.7",
|
|
50
50
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
51
51
|
"react": ">= 18"
|
|
52
52
|
},
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type AccordionTagDateContainerProps } from "./AccordionTagDateContainerCommon";
|
|
2
|
-
import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreApollo.css";
|
|
3
|
-
export declare const AccordionTagDateContainer: (props: AccordionTagDateContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tag } from "../../Tag/TagApollo";
|
|
3
|
-
import { AccordionTagDateContainerCommon, } from "./AccordionTagDateContainerCommon";
|
|
4
|
-
import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreApollo.css";
|
|
5
|
-
export const AccordionTagDateContainer = (props) => _jsx(AccordionTagDateContainerCommon, { ...props, TagComponent: Tag });
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ComponentProps, ComponentType } from "react";
|
|
2
|
-
import { Tag } from "../../Tag/TagCommon";
|
|
3
|
-
export type AccordionTagDateContainerProps = {
|
|
4
|
-
dateLabel?: string;
|
|
5
|
-
dateProps?: ComponentProps<"time">;
|
|
6
|
-
tagLabel?: string;
|
|
7
|
-
tagProps?: ComponentProps<typeof Tag>;
|
|
8
|
-
};
|
|
9
|
-
export type AccordionTagDateContainerCommonProps = AccordionTagDateContainerProps & {
|
|
10
|
-
TagComponent: ComponentType<ComponentProps<typeof Tag>>;
|
|
11
|
-
};
|
|
12
|
-
export declare const AccordionTagDateContainerCommon: ({ dateLabel, dateProps, tagLabel, tagProps, TagComponent, }: AccordionTagDateContainerCommonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
export const AccordionTagDateContainerCommon = ({ dateLabel, dateProps, tagLabel, tagProps, TagComponent, }) => {
|
|
4
|
-
const isShowing = useMemo(() => Boolean(tagLabel) || Boolean(dateLabel), [tagLabel, dateLabel]);
|
|
5
|
-
if (!isShowing) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
return (_jsxs(_Fragment, { children: [tagLabel ? (_jsx("div", { className: "af-accordion__tag-container", children: _jsx(TagComponent, { variant: "warning", ...tagProps, children: tagLabel }) })) : null, dateLabel ? (_jsx("time", { className: "af-accordion__date", ...dateProps, children: dateLabel })) : null] }));
|
|
9
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type AccordionTagDateContainerProps } from "./AccordionTagDateContainerCommon";
|
|
2
|
-
import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreLF.css";
|
|
3
|
-
export declare const AccordionTagDateContainer: (props: AccordionTagDateContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tag } from "../../Tag/TagLF";
|
|
3
|
-
import { AccordionTagDateContainerCommon, } from "./AccordionTagDateContainerCommon";
|
|
4
|
-
import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreLF.css";
|
|
5
|
-
export const AccordionTagDateContainer = (props) => _jsx(AccordionTagDateContainerCommon, { ...props, TagComponent: Tag });
|