@axa-fr/design-system-apollo-react 3.1.1 → 3.1.2-alpha.2

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.
@@ -18,11 +18,12 @@ export type AccordionProps = {
18
18
  dateProps?: Omit<ComponentProps<"time">, "children">;
19
19
  tagLabel?: string;
20
20
  tagProps?: Omit<TagProps, "children">;
21
+ isPlain?: boolean;
21
22
  } & Omit<AccordionCoreProps, "summary">;
22
23
  type AccordionCommonProps = AccordionProps & {
23
24
  AccordionCoreComponent: ComponentType<AccordionCoreProps>;
24
25
  TagComponent: ComponentType<TagProps>;
25
26
  IconComponent: ComponentType<IconProps>;
26
27
  };
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;
28
+ export declare const AccordionCommon: ({ variant, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, TagComponent, IconComponent, isPlain, ...accordionCoreProps }: AccordionCommonProps) => import("react/jsx-runtime").JSX.Element;
28
29
  export {};
@@ -4,9 +4,9 @@ export const accordionVariants = {
4
4
  primary: "primary",
5
5
  secondary: "secondary",
6
6
  };
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({
7
+ export const AccordionCommon = ({ variant = accordionVariants.primary, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, TagComponent, IconComponent, isPlain, ...accordionCoreProps }) => (_jsx(AccordionCoreComponent, { className: getClassName({
8
8
  baseClassName: "af-apollo-accordion",
9
- modifiers: [variant],
9
+ modifiers: [variant, isPlain && "plain"],
10
10
  className,
11
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
12
  baseClassName: "af-accordion__tag-container",
@@ -17,8 +17,8 @@ export type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min
17
17
  */
18
18
  success?: string;
19
19
  hidePicker?: boolean;
20
- label: ItemLabelProps["label"];
21
- } & Partial<Omit<ItemLabelProps, "onChange"> & ItemMessageProps>;
20
+ label: ItemLabelProps["children"];
21
+ } & Partial<Pick<ItemLabelProps, "description" | "buttonLabel" | "moreButtonLabel" | "onButtonClick" | "onMoreButtonClick"> & ItemMessageProps>;
22
22
  type InputDateCommonProps = InputDateProps & {
23
23
  ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
24
24
  ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
@@ -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
- import { getComponentClassName } from "../../utilities/getComponentClassName";
3
+ import { getClassName } from "../../utilities/getClassName";
4
4
  import { InputDateAtom } from "./InputDateAtom";
5
5
  import { InputDateTextAtom } from "./InputDateTextAtom";
6
- const InputDateCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, hidePicker, max, min, ...otherProps }, inputRef) => {
7
- const componentClassName = getComponentClassName("af-form__input-date", className ?? "", classModifier);
6
+ const InputDateCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, ItemLabelComponent, ItemMessageComponent, required, hidePicker, max, min, ...otherProps }, inputRef) => {
7
+ const componentClassName = getClassName({
8
+ baseClassName: "af-form__input-date",
9
+ modifiers: classModifier.split(" "),
10
+ className,
11
+ });
8
12
  let inputId = useId();
9
13
  inputId = otherProps.id ?? inputId;
10
14
  const idMessage = useId();
@@ -20,7 +24,7 @@ const InputDateCommon = forwardRef(({ className, classModifier = "", helper, err
20
24
  const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
21
25
  const ariaErrormessage = hasError ? idMessage : undefined;
22
26
  const ariaInvalid = hasError || undefined;
23
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId }), hidePicker ? (_jsx(InputDateTextAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required })) : (_jsx(InputDateAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required, max: max, min: min })), 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") })] }));
27
+ return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: buttonLabel || moreButtonLabel, onMoreButtonClick: onButtonClick || onMoreButtonClick, required: required, htmlFor: inputId, children: label }), hidePicker ? (_jsx(InputDateTextAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required })) : (_jsx(InputDateAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required, max: max, min: min })), 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") })] }));
24
28
  });
25
29
  InputDateCommon.displayName = "InputDate";
26
30
  export { InputDateCommon };
@@ -1,4 +1,4 @@
1
- import { type ComponentType, type MouseEventHandler, type ReactNode, type ComponentProps } from "react";
1
+ import { type ComponentProps, type ComponentType, type MouseEventHandler, type ReactNode } from "react";
2
2
  import type { ButtonProps } from "../../Button/ButtonCommon";
3
3
  export type ItemLabelProps = ComponentProps<"label"> & {
4
4
  /**
@@ -40,7 +40,7 @@ export type ItemLabelProps = ComponentProps<"label"> & {
40
40
  buttonLabel?: ReactNode;
41
41
  /**
42
42
  * Click handler for the info button
43
- * @deprecated use `onInfoButtonClick` instead.
43
+ * @deprecated use `onMoreButtonClick` instead.
44
44
  */
45
45
  onButtonClick?: MouseEventHandler<HTMLButtonElement>;
46
46
  /**
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, } from "react";
3
2
  import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
3
+ import { useId, } from "react";
4
4
  import { Svg } from "../../Svg/Svg";
5
5
  /**
6
6
  * A comprehensive label component for form items with support for descriptions and action buttons.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "3.1.1",
3
+ "version": "3.1.2-alpha.2",
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.1",
49
+ "@axa-fr/design-system-apollo-css": "3.1.2-alpha.2",
50
50
  "@material-symbols/svg-400": ">= 0.19.0",
51
51
  "react": ">= 18"
52
52
  },