@axa-fr/canopee-react 1.5.1-alpha.21 → 1.5.1-alpha.23

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.
@@ -11,11 +11,13 @@ export type DataAgentProps = {
11
11
  clickContents?: TupleMax3<ClickItemProps>;
12
12
  texteOrias?: string;
13
13
  isCompact?: boolean;
14
+ /** Display the compact layout (header only) regardless of screen size */
15
+ variant?: "default" | "compact";
14
16
  };
15
17
  type DataAgentCommonProps = DataAgentProps & {
16
18
  DividerComponent: ComponentType<ComponentProps<typeof Divider>>;
17
19
  ContentItemMonoComponent: ComponentType<ContentItemProps>;
18
20
  ClickItemComponent: ComponentType<ClickItemProps>;
19
21
  };
20
- export declare const DataAgentCommon: ({ className, agentProps, agentContractProps, contents, clickContents, texteOrias, DividerComponent, ContentItemMonoComponent, ClickItemComponent, isCompact, }: DataAgentCommonProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const DataAgentCommon: ({ className, agentProps, agentContractProps, contents, clickContents, texteOrias, DividerComponent, ContentItemMonoComponent, ClickItemComponent, isCompact, variant, }: DataAgentCommonProps) => import("react/jsx-runtime").JSX.Element;
21
23
  export {};
@@ -4,7 +4,7 @@ import { Divider } from "../Divider/DividerCommon";
4
4
  import { BREAKPOINT } from "../utilities/constants";
5
5
  import { getComponentClassName } from "../utilities/getComponentClassName";
6
6
  import { useIsSmallScreen } from "../utilities/hook/useIsSmallScreen";
7
- export const DataAgentCommon = ({ className, agentProps, agentContractProps, contents, clickContents, texteOrias, DividerComponent, ContentItemMonoComponent, ClickItemComponent, isCompact = true, }) => {
7
+ export const DataAgentCommon = ({ className, agentProps, agentContractProps, contents, clickContents, texteOrias, DividerComponent, ContentItemMonoComponent, ClickItemComponent, isCompact = true, variant = "default", }) => {
8
8
  const componentClassName = useMemo(() => getComponentClassName("af-data-agent", className), [className]);
9
9
  const isMobile = useIsSmallScreen(BREAKPOINT.SM);
10
10
  const renderForDefaultLayout = () => (_jsxs(_Fragment, { children: [_jsxs("section", { className: "af-data-agent__intro", children: [_jsx(ContentItemMonoComponent, { ...agentProps, type: "picture" }), agentContractProps ? (_jsx(ContentItemMonoComponent, { ...agentContractProps, type: "stick" })) : null] }), _jsx(DividerComponent, {}), contents && contents?.length > 0 ? (_jsx("section", { className: "af-data-agent__info-content", children: contents.map((content) => (_jsxs(Fragment, { children: [_jsx(ContentItemMonoComponent, { ...content, type: "icon" }), _jsx(DividerComponent, { className: "af-data-agent__line" })] }, `content--${crypto.randomUUID()}`))) })) : null, clickContents && clickContents?.length > 0 ? (_jsx("section", { className: "af-data-agent__info-click-content", children: clickContents.map((clickContent) => (_jsxs(Fragment, { children: [_jsx(ClickItemComponent, { ...clickContent, variant: "small" }), _jsx(DividerComponent, { className: "af-data-agent__line" })] }, `clickContent--${crypto.randomUUID()}`))) })) : null, Boolean(texteOrias) && (_jsx("p", { className: "af-data-agent__text-orias", children: texteOrias }))] }));
@@ -12,7 +12,7 @@ export const DataAgentCommon = ({ className, agentProps, agentContractProps, con
12
12
  src: agentProps.picture,
13
13
  alt: agentProps.title,
14
14
  }, variant: "agent" }) }));
15
- return (_jsx("section", { className: componentClassName, children: isMobile && isCompact
15
+ return (_jsx("section", { className: componentClassName, children: (isMobile && isCompact) || variant === "compact"
16
16
  ? renderForMobileLayout()
17
17
  : renderForDefaultLayout() }));
18
18
  };
@@ -11,7 +11,7 @@ const InputTextCommon = forwardRef(({ unit, className, classModifier = "", helpe
11
11
  const ariaDescribedby = [helper && idHelp, success && idMessage].filter(Boolean);
12
12
  return (_jsxs("div", { className: "af-form__input-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx(InputTextAtomComponent, { id: inputId, ref: inputRef, unit: unit, className: className, classModifier: classModifier, error: (message && messageType === "error") || Boolean(error)
13
13
  ? messageType || error
14
- : undefined, required: required, idMessage: message || error ? idMessage : undefined, idHelp: ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, ...otherProps }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
14
+ : undefined, warning: message && messageType === "warning" ? messageType : undefined, required: required, idMessage: message || error ? idMessage : undefined, idHelp: ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, ...otherProps }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
15
15
  });
16
16
  InputTextCommon.displayName = "InputText";
17
17
  export { InputTextCommon };
@@ -3,6 +3,7 @@ type InputTextAtomProps = ComponentPropsWithRef<"input"> & {
3
3
  unit?: ReactNode;
4
4
  classModifier?: string;
5
5
  error?: string;
6
+ warning?: string;
6
7
  idMessage?: string;
7
8
  idHelp?: string;
8
9
  };
@@ -1,10 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
3
  import { getClassName } from "../../utilities/getClassName";
4
- const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, "aria-describedby": ariaDescribedby, type = "text", ...otherProps }, inputRef) => {
4
+ const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, warning, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, "aria-describedby": ariaDescribedby, type = "text", ...otherProps }, inputRef) => {
5
5
  const componentClassName = getClassName({
6
6
  baseClassName: "af-form__input-text",
7
- modifiers: [classModifier, error || ariaErrormessage ? "error" : ""],
7
+ modifiers: [
8
+ classModifier,
9
+ error || ariaErrormessage ? "error" : "",
10
+ !error && !ariaErrormessage && warning ? "warning" : "",
11
+ ],
8
12
  className,
9
13
  });
10
14
  let inputId = useId();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.5.1-alpha.21",
3
+ "version": "1.5.1-alpha.23",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "exports": {
6
6
  "./distributeur": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "homepage": "https://github.com/AxaFrance/design-system#readme",
51
51
  "peerDependencies": {
52
- "@axa-fr/canopee-css": "1.5.1-alpha.21",
52
+ "@axa-fr/canopee-css": "1.5.1-alpha.23",
53
53
  "@material-symbols/svg-400": ">= 0.19.0",
54
54
  "@material-symbols/svg-700": ">= 0.19.0",
55
55
  "react": ">= 18"