@axa-fr/canopee-react 1.2.1-alpha.11 → 1.2.1-alpha.13
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/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/distributeur/Form/Radio/Radio.d.ts +9 -1
- package/dist/distributeur/Form/Radio/RadioCardGroup.d.ts +5 -2
- package/dist/distributeur/Form/Radio/RadioCardGroup.js +2 -2
- package/dist/prospect-client/Skeleton/SkeletonApollo.d.ts +2 -0
- package/dist/prospect-client/Skeleton/SkeletonApollo.js +2 -0
- package/dist/prospect-client/Skeleton/SkeletonCommon.d.ts +19 -0
- package/dist/prospect-client/Skeleton/SkeletonCommon.js +11 -0
- package/dist/prospect-client/Skeleton/SkeletonLF.d.ts +2 -0
- package/dist/prospect-client/Skeleton/SkeletonLF.js +2 -0
- package/dist/prospect-client/SkeletonList/SkeletonListApollo.d.ts +3 -0
- package/dist/prospect-client/SkeletonList/SkeletonListApollo.js +5 -0
- package/dist/prospect-client/SkeletonList/SkeletonListCommon.d.ts +17 -0
- package/dist/prospect-client/SkeletonList/SkeletonListCommon.js +4 -0
- package/dist/prospect-client/SkeletonList/SkeletonListLF.d.ts +3 -0
- package/dist/prospect-client/SkeletonList/SkeletonListLF.js +5 -0
- package/dist/prospect.d.ts +2 -0
- package/dist/prospect.js +2 -0
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -61,3 +61,5 @@ export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pag
|
|
|
61
61
|
export { Card, type CardProps } from "./prospect-client/Card/CardLF";
|
|
62
62
|
export { List, type ListProps } from "./prospect-client/List/List/ListLF";
|
|
63
63
|
export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorLF";
|
|
64
|
+
export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonLF";
|
|
65
|
+
export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListLF";
|
package/dist/client.js
CHANGED
|
@@ -60,3 +60,5 @@ export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/Ite
|
|
|
60
60
|
export { Card } from "./prospect-client/Card/CardLF";
|
|
61
61
|
export { List } from "./prospect-client/List/List/ListLF";
|
|
62
62
|
export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorLF";
|
|
63
|
+
export { Skeleton, } from "./prospect-client/Skeleton/SkeletonLF";
|
|
64
|
+
export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListLF";
|
|
@@ -8,7 +8,15 @@ export declare enum RadioModes {
|
|
|
8
8
|
declare const Radio: import("react").ForwardRefExoticComponent<(({
|
|
9
9
|
options: Option[];
|
|
10
10
|
} & Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
11
|
-
options:
|
|
11
|
+
options: ({
|
|
12
|
+
id?: string;
|
|
13
|
+
icon?: import("react").ReactNode;
|
|
14
|
+
label: import("react").ReactNode;
|
|
15
|
+
description?: import("react").ReactNode;
|
|
16
|
+
value: string;
|
|
17
|
+
} & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
18
|
+
action?: import("react").ReactNode;
|
|
19
|
+
})[];
|
|
12
20
|
orientation?: "horizontal" | "vertical";
|
|
13
21
|
}, "ref"> & {
|
|
14
22
|
mode: "cardRadio";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Radio/RadioCardGroup.css";
|
|
2
|
-
import { ComponentProps } from "react";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
3
|
import type { Option } from "../core";
|
|
4
|
+
type RadioOptions = Option & {
|
|
5
|
+
action?: ReactNode;
|
|
6
|
+
};
|
|
4
7
|
type Props = ComponentProps<"input"> & {
|
|
5
|
-
options:
|
|
8
|
+
options: RadioOptions[];
|
|
6
9
|
orientation?: "horizontal" | "vertical";
|
|
7
10
|
};
|
|
8
11
|
export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled, "aria-invalid": ariaInvalid, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,7 +12,7 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
|
|
|
12
12
|
className,
|
|
13
13
|
orientation === "horizontal" &&
|
|
14
14
|
`${DEFAULT_CONTAINER_CLASSNAME}--horizontal`,
|
|
15
|
-
]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, ...otherOptionProps }) => {
|
|
15
|
+
]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, action, ...otherOptionProps }) => {
|
|
16
16
|
const newName = name || optionName || idGenerated;
|
|
17
17
|
const allClassNames = classNames([
|
|
18
18
|
DEFAULT_CLASSNAME,
|
|
@@ -20,6 +20,6 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
|
|
|
20
20
|
ariaInvalid && `${DEFAULT_CLASSNAME}--error`,
|
|
21
21
|
]);
|
|
22
22
|
const isDisabled = disabled || optionDisabled;
|
|
23
|
-
return (_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue));
|
|
23
|
+
return (_jsxs("div", { children: [_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue), action] }, optionValue));
|
|
24
24
|
}), children] }));
|
|
25
25
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type isLoadingAndChildrenProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
} | {
|
|
6
|
+
children?: undefined;
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type SkeletonProps = {
|
|
10
|
+
className?: string;
|
|
11
|
+
grid: number[][];
|
|
12
|
+
"aria-busy"?: boolean;
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
maxCols?: number;
|
|
15
|
+
colGap?: number;
|
|
16
|
+
rowGap?: number;
|
|
17
|
+
} & isLoadingAndChildrenProps;
|
|
18
|
+
export declare const Skeleton: ({ className, grid, "aria-busy": ariaBusy, "aria-label": ariaLabel, maxCols, colGap, rowGap, isLoading, children, }: SkeletonProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName } from "../utilities/getClassName";
|
|
3
|
+
const CLASS_NAME = "af-skeleton";
|
|
4
|
+
export const Skeleton = ({ className, grid = [], "aria-busy": ariaBusy = true, "aria-label": ariaLabel = "Chargement", maxCols = 12, colGap = 16, rowGap = 8, isLoading = true, children, }) => isLoading ? (_jsx("div", { className: getClassName({
|
|
5
|
+
baseClassName: `${CLASS_NAME}-container`,
|
|
6
|
+
className,
|
|
7
|
+
}), "aria-label": ariaLabel, role: "status", "aria-busy": ariaBusy, style: {
|
|
8
|
+
"--max-cols": maxCols,
|
|
9
|
+
"--col-gap": `calc(${colGap} / var(--font-size-base) * 1rem)`,
|
|
10
|
+
"--row-gap": `calc(${rowGap} / var(--font-size-base) * 1rem)`,
|
|
11
|
+
}, children: grid.map((cols, indexRow) => cols.map((colSize, indexCol) => (_jsx("div", { style: { "--col-size": colSize }, className: CLASS_NAME }, `${indexRow}-${indexCol}`)))) })) : (children);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from "../Skeleton/SkeletonApollo";
|
|
3
|
+
import { List } from "../List/List/ListApollo";
|
|
4
|
+
import { SkeletonListCommon, } from "./SkeletonListCommon";
|
|
5
|
+
export const SkeletonList = (props) => (_jsx(SkeletonListCommon, { ...props, SkeletonComponent: Skeleton, ListComponent: List }));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType, PropsWithChildren } from "react";
|
|
2
|
+
import type { SkeletonProps } from "../Skeleton/SkeletonCommon";
|
|
3
|
+
import type { ListProps } from "../List/List/ListCommon";
|
|
4
|
+
export type SkeletonListProps = {
|
|
5
|
+
lists: {
|
|
6
|
+
lines?: number;
|
|
7
|
+
grid: SkeletonProps["grid"];
|
|
8
|
+
}[];
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
} & PropsWithChildren;
|
|
12
|
+
type SkeletonListPropsCommon = SkeletonListProps & {
|
|
13
|
+
ListComponent: ComponentType<ListProps>;
|
|
14
|
+
SkeletonComponent: ComponentType<SkeletonProps>;
|
|
15
|
+
};
|
|
16
|
+
export declare const SkeletonListCommon: ({ children, isLoading, lists, className, ListComponent, SkeletonComponent, }: SkeletonListPropsCommon) => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element[] | null | undefined;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const SkeletonListCommon = ({ children, isLoading, lists = [], className, ListComponent, SkeletonComponent, }) => isLoading
|
|
3
|
+
? lists.map(({ lines = 1, grid }, linesIndex) => (_jsx(ListComponent, { className: className, children: [...Array(lines).keys()].map((_, lineIndex) => (_jsx(SkeletonComponent, { grid: grid }, lineIndex))) }, linesIndex)))
|
|
4
|
+
: children;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from "../Skeleton/SkeletonLF";
|
|
3
|
+
import { List } from "../List/List/ListLF";
|
|
4
|
+
import { SkeletonListCommon, } from "./SkeletonListCommon";
|
|
5
|
+
export const SkeletonList = (props) => (_jsx(SkeletonListCommon, { ...props, SkeletonComponent: Skeleton, ListComponent: List }));
|
package/dist/prospect.d.ts
CHANGED
|
@@ -57,3 +57,5 @@ export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pag
|
|
|
57
57
|
export { Card, type CardProps } from "./prospect-client/Card/CardApollo";
|
|
58
58
|
export { List, type ListProps } from "./prospect-client/List/List/ListApollo";
|
|
59
59
|
export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
|
|
60
|
+
export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonApollo";
|
|
61
|
+
export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListApollo";
|
package/dist/prospect.js
CHANGED
|
@@ -56,3 +56,5 @@ export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/Ite
|
|
|
56
56
|
export { Card } from "./prospect-client/Card/CardApollo";
|
|
57
57
|
export { List } from "./prospect-client/List/List/ListApollo";
|
|
58
58
|
export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
|
|
59
|
+
export { Skeleton, } from "./prospect-client/Skeleton/SkeletonApollo";
|
|
60
|
+
export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListApollo";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/canopee-react",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.13",
|
|
4
4
|
"description": "Package React - Design System Canopée",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./distributeur": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@axa-fr/canopee-css": "1.2.1-alpha.
|
|
48
|
+
"@axa-fr/canopee-css": "1.2.1-alpha.13",
|
|
49
49
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
50
50
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
51
51
|
"react": ">= 18"
|