@axa-fr/canopee-react 1.2.1-alpha.23 → 1.2.1-alpha.25

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 CHANGED
@@ -64,3 +64,4 @@ export { List, type ListProps } from "./prospect-client/List/List/ListLF";
64
64
  export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorLF";
65
65
  export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonLF";
66
66
  export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListLF";
67
+ export { Fieldset, type FieldsetProps, } from "./prospect-client/Fieldset/FieldsetLF";
package/dist/client.js CHANGED
@@ -63,3 +63,4 @@ export { List } from "./prospect-client/List/List/ListLF";
63
63
  export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorLF";
64
64
  export { Skeleton, } from "./prospect-client/Skeleton/SkeletonLF";
65
65
  export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListLF";
66
+ export { Fieldset, } from "./prospect-client/Fieldset/FieldsetLF";
@@ -11,14 +11,14 @@ export type ContentMonoItemPictureProps = {
11
11
  };
12
12
  export type ContentMonoItemIconProps = {
13
13
  type: "icon";
14
+ title?: string;
15
+ subtitle1?: string;
16
+ subtitle2?: string;
14
17
  /**
15
18
  * @deprecated Use `iconProps` instead.
16
19
  */
17
20
  icon?: string;
18
21
  iconProps?: IconProps;
19
- title: string;
20
- subtitle1?: string;
21
- subtitle2?: string;
22
22
  };
23
23
  export type ContentMonoItemStickProps = {
24
24
  type: "stick";
@@ -1,9 +1,17 @@
1
+ import type { ElementType } from "react";
2
+ import { ReactNode } from "react";
3
+ import { AtLeastOne } from "../utilities/types/AtLeastOne";
1
4
  export type ContentMonoItemSize = "medium" | "large";
2
- export type ContentItemCoreProps = {
3
- size?: ContentMonoItemSize;
5
+ type TextFields = {
4
6
  title?: string;
5
7
  primarySubtitle?: string;
6
8
  subtitle?: string;
7
- leftComponent?: React.ReactNode;
8
9
  };
9
- export declare const ContentItemMonoCore: ({ size, leftComponent, title, primarySubtitle, subtitle, }: ContentItemCoreProps) => import("react/jsx-runtime").JSX.Element;
10
+ type AtLeastOneText = AtLeastOne<TextFields>;
11
+ export type ContentItemCoreProps<T extends ElementType = "div"> = {
12
+ as?: T;
13
+ size?: ContentMonoItemSize;
14
+ leftComponent?: ReactNode;
15
+ } & AtLeastOneText;
16
+ export declare const ContentItemMonoCore: <T extends ElementType = "div">({ as, size, leftComponent, title, primarySubtitle, subtitle, }: ContentItemCoreProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const ContentItemMonoCore = ({ size = "medium", leftComponent, title, primarySubtitle, subtitle, }) => {
3
- return (_jsxs("div", { "data-testid": "container", className: `af-content-item-mono ${size}`, children: [leftComponent, _jsxs("div", { className: "text-content", children: [_jsx("span", { className: "title", children: title }), primarySubtitle ? (_jsx("span", { className: "subtitle-primary", children: primarySubtitle })) : null, subtitle ? _jsx("span", { className: "subtitle", children: subtitle }) : null] })] }));
2
+ export const ContentItemMonoCore = ({ as, size = "medium", leftComponent, title, primarySubtitle, subtitle, }) => {
3
+ const Component = as ?? "div";
4
+ return (_jsxs(Component, { className: `af-content-item-mono ${size}`, children: [leftComponent, _jsxs("div", { className: "text-content", children: [title ? _jsx("span", { className: "title", children: title }) : null, primarySubtitle ? (_jsx("span", { className: "subtitle-primary", children: primarySubtitle })) : null, subtitle ? _jsx("span", { className: "subtitle", children: subtitle }) : null] })] }));
4
5
  };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/prospect/Fieldset/FieldsetApollo.css";
2
+ import { type FieldsetProps } from "./FieldsetCommon";
3
+ export type { FieldsetProps };
4
+ export declare const Fieldset: (props: FieldsetProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/prospect/Fieldset/FieldsetApollo.css";
3
+ import { Icon } from "../Icon/IconApollo";
4
+ import { Card } from "../Card/CardApollo";
5
+ import { FieldsetCommon } from "./FieldsetCommon";
6
+ export const Fieldset = (props) => (_jsx(FieldsetCommon, { ...props, IconComponent: Icon, CardComponent: Card }));
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps, ComponentType, PropsWithChildren } from "react";
2
+ import { CardCommon } from "../Card/CardCommon";
3
+ import { Icon, type IconProps } from "../Icon/IconCommon";
4
+ export type FieldsetProps = PropsWithChildren<{
5
+ title: string;
6
+ iconProps?: IconProps;
7
+ className?: string;
8
+ }>;
9
+ export type FieldsetCommonProps = FieldsetProps & {
10
+ IconComponent: ComponentType<ComponentProps<typeof Icon>>;
11
+ CardComponent: ComponentType<ComponentProps<typeof CardCommon>>;
12
+ };
13
+ export declare const FieldsetCommon: ({ children, title, iconProps, className, IconComponent, CardComponent, }: FieldsetCommonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ContentItemMonoCore } from "../ContentItemMono/ContentItemMonoCore";
3
+ import { getClassName } from "../utilities/getClassName";
4
+ export const FieldsetCommon = ({ children, title, iconProps, className, IconComponent, CardComponent, }) => {
5
+ const iconComponent = iconProps && (_jsx(IconComponent, { "aria-hidden": "true", ...iconProps }));
6
+ return (_jsxs(CardComponent, { as: "fieldset", className: getClassName({ baseClassName: "af-fieldset", className }), children: [_jsx(ContentItemMonoCore, { as: "legend", title: title, leftComponent: iconComponent }), _jsx("div", { className: "af-fieldset__content", children: children })] }));
7
+ };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/client/Fieldset/FieldsetLF.css";
2
+ import { type FieldsetProps } from "./FieldsetCommon";
3
+ export type { FieldsetProps };
4
+ export declare const Fieldset: (props: FieldsetProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/client/Fieldset/FieldsetLF.css";
3
+ import { Icon } from "../Icon/IconLF";
4
+ import { Card } from "../Card/CardLF";
5
+ import { FieldsetCommon } from "./FieldsetCommon";
6
+ export const Fieldset = (props) => (_jsx(FieldsetCommon, { ...props, IconComponent: Icon, CardComponent: Card }));
@@ -0,0 +1,3 @@
1
+ export type AtLeastOne<T, K extends keyof T = keyof T> = Partial<T> & {
2
+ [P in K]: Required<Pick<T, P>>;
3
+ }[K];
@@ -0,0 +1 @@
1
+ export {};
@@ -60,3 +60,4 @@ export { List, type ListProps } from "./prospect-client/List/List/ListApollo";
60
60
  export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
61
61
  export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonApollo";
62
62
  export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListApollo";
63
+ export { Fieldset, type FieldsetProps, } from "./prospect-client/Fieldset/FieldsetApollo";
package/dist/prospect.js CHANGED
@@ -59,3 +59,4 @@ export { List } from "./prospect-client/List/List/ListApollo";
59
59
  export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
60
60
  export { Skeleton, } from "./prospect-client/Skeleton/SkeletonApollo";
61
61
  export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListApollo";
62
+ export { Fieldset, } from "./prospect-client/Fieldset/FieldsetApollo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.2.1-alpha.23",
3
+ "version": "1.2.1-alpha.25",
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.23",
48
+ "@axa-fr/canopee-css": "1.2.1-alpha.25",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "@material-symbols/svg-700": ">= 0.19.0",
51
51
  "react": ">= 18"