@axa-fr/design-system-look-and-feel-react 0.3.0-ci.291 → 0.3.0-ci.293

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.
@@ -1,14 +1,2 @@
1
- import { type ComponentProps, type ReactNode } from "react";
2
- type TClickItem = {
3
- classModifier?: string;
4
- isDisabled?: boolean;
5
- } & Omit<ComponentProps<"button">, "disabled"> & ComponentProps<"a"> & {
6
- label?: ReactNode;
7
- parentClickComponent?: ({ children, }: {
8
- children: ReactNode;
9
- } & Record<string, unknown>) => ReactNode;
10
- children?: ReactNode;
11
- icon?: ReactNode;
12
- } & Record<string, unknown>;
13
- export declare const ClickItem: ({ label, children, icon, parentClickComponent: ClickComponent, isDisabled, className, classModifier, ...otherProps }: TClickItem) => import("react/jsx-runtime").JSX.Element;
14
- export {};
1
+ import type { TClickItem } from "./types";
2
+ export declare const ClickItem: ({ children, icon, parentClickComponent: ClickComponent, isDisabled, className, classModifier, ...otherProps }: TClickItem) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { ComponentProps, ComponentType, ElementType } from "react";
2
+ import type { TParentClickComponentProps } from "./types";
3
+ export declare const createClickItemParent: <TComponent extends ElementType>(Wrapper: ComponentType<TComponent> | TComponent, wrapperProps: ComponentProps<TComponent>) => ({ children, ...clickItemProps }: TParentClickComponentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const createClickItemParent = (Wrapper, wrapperProps) => {
3
+ const ClickItemWrapper = ({ children, ...clickItemProps }) => (_jsx(Wrapper, { ...wrapperProps, ...clickItemProps, children: children }));
4
+ return ClickItemWrapper;
5
+ };
@@ -3,7 +3,7 @@ import chevron from "@material-symbols/svg-400/outlined/chevron_right.svg";
3
3
  import { useMemo } from "react";
4
4
  import { Svg } from "../../../Svg";
5
5
  import { getComponentClassName } from "../../../utilities";
6
- export const ClickItem = ({ label, children, icon, parentClickComponent: ClickComponent = ({ children: parentClickComponentChildren, ...parentClickComponentProps }) => (_jsx("button", { type: "button", ...parentClickComponentProps, children: parentClickComponentChildren })), isDisabled = false, className, classModifier = "", ...otherProps }) => {
6
+ export const ClickItem = ({ children, icon, parentClickComponent: ClickComponent = ({ children: parentClickComponentChildren, ...parentClickComponentProps }) => (_jsx("button", { type: "button", ...parentClickComponentProps, children: parentClickComponentChildren })), isDisabled = false, className, classModifier = "", ...otherProps }) => {
7
7
  const componentClassName = useMemo(() => getComponentClassName(className, `${classModifier}${isDisabled ? " disabled" : ""}`, "af-click-item"), [className, classModifier, isDisabled]);
8
- return (_jsxs(ClickComponent, { className: componentClassName, disabled: isDisabled, "aria-disabled": isDisabled, ...otherProps, children: [_jsxs("div", { className: "af-click-item__content", children: [icon && _jsx("div", { className: "af-click-item__icon", children: icon }), _jsx("div", { className: "af-click-item__label", children: children || label })] }), _jsx("div", { className: "af-click-item__action", children: _jsx(Svg, { src: chevron, "aria-hidden": true }) })] }));
8
+ return (_jsxs(ClickComponent, { className: componentClassName, disabled: isDisabled, "aria-disabled": isDisabled, ...otherProps, children: [_jsxs("div", { className: "af-click-item__content", children: [icon && _jsx("div", { className: "af-click-item__icon", children: icon }), _jsx("div", { className: "af-click-item__label", children: children })] }), _jsx("div", { className: "af-click-item__action", children: _jsx(Svg, { src: chevron, "aria-hidden": true }) })] }));
9
9
  };
@@ -1 +1,2 @@
1
1
  export { ClickItem } from "./ClickItem";
2
+ export { createClickItemParent } from "./ClickItem.helpers";
@@ -1 +1,2 @@
1
1
  export { ClickItem } from "./ClickItem";
2
+ export { createClickItemParent } from "./ClickItem.helpers";
@@ -1,3 +1,3 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/List/ClickList/ClickList.scss";
2
- export { ClickItem } from "./ClickItem";
2
+ export { ClickItem, createClickItemParent } from "./ClickItem";
3
3
  export { ClickList } from "./ClickList";
@@ -1,3 +1,3 @@
1
1
  import "@axa-fr/design-system-look-and-feel-css/dist/List/ClickList/ClickList.scss";
2
- export { ClickItem } from "./ClickItem";
2
+ export { ClickItem, createClickItemParent } from "./ClickItem";
3
3
  export { ClickList } from "./ClickList";
@@ -2,5 +2,5 @@ import type { TContentTabItem } from "./types";
2
2
  type TContentTabItemProps = TContentTabItem & {
3
3
  isMobile?: boolean;
4
4
  };
5
- export declare const ContentTabItem: ({ title, subtitle, tag, tagProps, date, buttons, value, isMobile, }: TContentTabItemProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const ContentTabItem: ({ title, subtitle, tag, tagProps, date, actions, value, isMobile, }: TContentTabItemProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, Tag } from "../../..";
3
- export const ContentTabItem = ({ title, subtitle, tag, tagProps, date, buttons = [], value, isMobile = false, }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "af-list-item__left-container", children: [Boolean(value) && (Boolean(tag) || Boolean(date)) && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && _jsx("span", { className: "af-list-item__date", children: date })] })), _jsxs("div", { className: "af-list-item__label", children: [_jsx("span", { className: "af-list-item-label__title", children: title }), Boolean(subtitle) && (_jsx("span", { className: "af-list-item-label__subtitle", children: subtitle }))] }), !value && isMobile && (Boolean(tag) || Boolean(date)) && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && _jsx("span", { className: "af-list-item__date", children: date })] }))] }), (buttons.length > 0 ||
2
+ import { Tag } from "../../..";
3
+ export const ContentTabItem = ({ title, subtitle, tag, tagProps, date, actions = [], value, isMobile = false, }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "af-list-item__left-container", children: [Boolean(value) && (Boolean(tag) || Boolean(date)) && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && _jsx("span", { className: "af-list-item__date", children: date })] })), _jsxs("div", { className: "af-list-item__label", children: [_jsx("span", { className: "af-list-item-label__title", children: title }), Boolean(subtitle) && (_jsx("span", { className: "af-list-item-label__subtitle", children: subtitle }))] }), !value && isMobile && (Boolean(tag) || Boolean(date)) && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && _jsx("span", { className: "af-list-item__date", children: date })] }))] }), (actions.length > 0 ||
4
4
  Boolean(tag) ||
5
5
  Boolean(date) ||
6
- Boolean(value)) && (_jsxs("div", { className: "af-list-item__right-container", children: [!value && (Boolean(tag) || Boolean(date)) && !isMobile && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && (_jsx("span", { className: "af-list-item__date", children: date }))] })), buttons.map((button) => (_jsx("div", { className: "af-list-item__button-container", children: _jsx(Button, { ...button }) }, button?.id))), Boolean(value) && _jsx("span", { className: "af-list-item__value", children: value })] }))] }));
6
+ Boolean(value)) && (_jsxs("div", { className: "af-list-item__right-container", children: [!value && (Boolean(tag) || Boolean(date)) && !isMobile && (_jsxs("div", { className: "af-list-item__additional-data-container", children: [Boolean(tag) && (_jsx(Tag, { classModifier: "warning", ...tagProps, children: tag })), Boolean(date) && (_jsx("span", { className: "af-list-item__date", children: date }))] })), actions.map(({ id, component }) => (_jsx("div", { className: "af-list-item__action-container", children: component }, id))), Boolean(value) && _jsx("span", { className: "af-list-item__value", children: value })] }))] }));
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export { Footer } from "./Layout/Footer/Footer";
16
16
  export { Header } from "./Layout/Header";
17
17
  export { Link } from "./Link";
18
18
  export { List } from "./List";
19
- export { ClickItem, ClickList } from "./List/ClickList";
19
+ export { ClickItem, ClickList, createClickItemParent } from "./List/ClickList";
20
20
  export { ContentItemDuo } from "./List/ContentItemDuo";
21
21
  export { ContentItemMono, ContentItemMonoSize } from "./List/ContentItemMono";
22
22
  export { ContentTabList } from "./List/ContentTabList";
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ export { Footer } from "./Layout/Footer/Footer";
15
15
  export { Header } from "./Layout/Header";
16
16
  export { Link } from "./Link";
17
17
  export { List } from "./List";
18
- export { ClickItem, ClickList } from "./List/ClickList";
18
+ export { ClickItem, ClickList, createClickItemParent } from "./List/ClickList";
19
19
  export { ContentItemDuo } from "./List/ContentItemDuo";
20
20
  export { ContentItemMono, ContentItemMonoSize } from "./List/ContentItemMono";
21
21
  export { ContentTabList } from "./List/ContentTabList";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-look-and-feel-react",
3
- "version": "0.3.0-ci.291",
3
+ "version": "0.3.0-ci.293",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/design-system-look-and-feel-css": "0.3.0-ci.291",
48
+ "@axa-fr/design-system-look-and-feel-css": "0.3.0-ci.293",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "react": ">= 18"
51
51
  },