@axa-fr/design-system-apollo-react 3.0.1-tags-slash-2-0-4.3 → 3.1.0-RC.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.
Files changed (37) hide show
  1. package/dist/Accordion/AccordionApollo.js +2 -2
  2. package/dist/Accordion/AccordionCommon.d.ts +13 -9
  3. package/dist/Accordion/AccordionCommon.js +12 -6
  4. package/dist/Accordion/AccordionLF.js +2 -2
  5. package/dist/AccordionCore/AccordionCoreCommon.d.ts +11 -7
  6. package/dist/AccordionCore/AccordionCoreCommon.js +12 -4
  7. package/dist/Form/FileUpload/FileUpload/FileUploadApollo.d.ts +1 -1
  8. package/dist/Form/FileUpload/FileUpload/FileUploadApollo.js +1 -1
  9. package/dist/Form/FileUpload/FileUpload/FileUploadCommon.js +5 -1
  10. package/dist/Form/FileUpload/FileUpload/FileUploadLF.d.ts +1 -1
  11. package/dist/Form/FileUpload/FileUpload/FileUploadLF.js +1 -1
  12. package/dist/Form/FileUpload/InputFile/InputFileCommon.js +12 -7
  13. package/dist/Form/FileUpload/ItemFile/ItemFileCommon.js +6 -3
  14. package/dist/Form/InputDate/InputDate.helper.d.ts +7 -0
  15. package/dist/Form/InputDate/InputDate.helper.js +22 -0
  16. package/dist/Form/InputDate/InputDateAtom.d.ts +9 -0
  17. package/dist/Form/InputDate/InputDateAtom.js +6 -0
  18. package/dist/Form/InputDate/InputDateCommon.d.ts +1 -1
  19. package/dist/Form/InputDate/InputDateCommon.js +16 -31
  20. package/dist/Form/InputDate/InputDateTextAtom.d.ts +9 -0
  21. package/dist/Form/InputDate/InputDateTextAtom.js +16 -0
  22. package/dist/Form/InputTextAtom/InputTextAtomCommon.js +2 -2
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +5 -5
  25. package/dist/indexLF.d.ts +5 -5
  26. package/dist/indexLF.js +5 -5
  27. package/dist/utilities/getClassName.d.ts +20 -0
  28. package/dist/utilities/getClassName.js +24 -0
  29. package/dist/utilities/getComponentClassName.d.ts +3 -0
  30. package/dist/utilities/getComponentClassName.js +3 -0
  31. package/package.json +3 -4
  32. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerApollo.d.ts +0 -3
  33. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerApollo.js +0 -5
  34. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerCommon.d.ts +0 -12
  35. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerCommon.js +0 -9
  36. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerLF.d.ts +0 -3
  37. package/dist/Accordion/AccordionTagDateContainer/AccordionTagDateContainerLF.js +0 -5
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AccordionCore } from "../AccordionCore/AccordionCoreApollo";
3
- import { AccordionTagDateContainer } from "./AccordionTagDateContainer/AccordionTagDateContainerApollo";
3
+ import { Tag } from "../Tag/TagApollo";
4
4
  import { Icon } from "../Icon/IconApollo";
5
5
  import { AccordionCommon } from "./AccordionCommon";
6
6
  import "@axa-fr/design-system-apollo-css/dist/Accordion/AccordionApollo.css";
7
- export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, AccordionTagDateContainerComponent: AccordionTagDateContainer, IconComponent: Icon }));
7
+ export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, TagComponent: Tag, IconComponent: Icon }));
8
8
  export { accordionVariants } from "./AccordionCommon";
@@ -1,12 +1,12 @@
1
- import { type ComponentProps, type ComponentType } from "react";
2
- import { AccordionTagDateContainerCommon, type AccordionTagDateContainerProps } from "./AccordionTagDateContainer/AccordionTagDateContainerCommon";
3
- import { Icon } from "../Icon/IconCommon";
4
- import { type AccordionCoreProps } from "../AccordionCore/AccordionCoreCommon";
1
+ import type { ComponentProps, ComponentType } from "react";
2
+ import type { TagProps } from "../Tag/TagCommon";
3
+ import type { IconProps } from "../Icon/IconCommon";
4
+ import type { AccordionCoreProps } from "../AccordionCore/AccordionCoreCommon";
5
5
  export declare const accordionVariants: {
6
6
  readonly primary: "primary";
7
7
  readonly secondary: "secondary";
8
8
  };
9
- export type AccordionVariants = keyof typeof accordionVariants;
9
+ export type AccordionVariants = (typeof accordionVariants)[keyof typeof accordionVariants];
10
10
  export type AccordionProps = {
11
11
  variant?: AccordionVariants;
12
12
  title: string;
@@ -14,11 +14,15 @@ export type AccordionProps = {
14
14
  icon?: string;
15
15
  info1: string;
16
16
  info2: string;
17
- } & AccordionTagDateContainerProps & Partial<AccordionCoreProps>;
17
+ dateLabel?: string;
18
+ dateProps?: Omit<ComponentProps<"time">, "children">;
19
+ tagLabel?: string;
20
+ tagProps?: Omit<TagProps, "children">;
21
+ } & Omit<AccordionCoreProps, "summary">;
18
22
  type AccordionCommonProps = AccordionProps & {
19
23
  AccordionCoreComponent: ComponentType<AccordionCoreProps>;
20
- AccordionTagDateContainerComponent: ComponentType<Omit<ComponentProps<typeof AccordionTagDateContainerCommon>, "TagComponent">>;
21
- IconComponent: ComponentType<ComponentProps<typeof Icon>>;
24
+ TagComponent: ComponentType<TagProps>;
25
+ IconComponent: ComponentType<IconProps>;
22
26
  };
23
- export declare const AccordionCommon: ({ variant, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, AccordionTagDateContainerComponent, IconComponent, ...accordionCoreProps }: AccordionCommonProps) => import("react/jsx-runtime").JSX.Element;
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;
24
28
  export {};
@@ -1,11 +1,17 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { getComponentClassName } from "../utilities/getComponentClassName";
2
+ import { getClassName } from "../utilities/getClassName";
4
3
  export const accordionVariants = {
5
4
  primary: "primary",
6
5
  secondary: "secondary",
7
6
  };
8
- export const AccordionCommon = ({ variant = accordionVariants.primary, className, children, icon, title, subtitle, tagLabel, tagProps, dateLabel, dateProps, info1, info2, AccordionCoreComponent, AccordionTagDateContainerComponent, IconComponent, ...accordionCoreProps }) => {
9
- const componentClassName = useMemo(() => getComponentClassName("af-apollo-accordion", className, variant), [className, variant]);
10
- return (_jsx(AccordionCoreComponent, { className: componentClassName, summary: _jsxs(_Fragment, { children: [icon ? (_jsx(IconComponent, { role: "presentation", src: icon, variant: "primary", size: "S", className: "af-accordion__icon" })) : null, title ? _jsx("p", { className: "af-accordion__title", children: title }) : null, subtitle ? (_jsx("p", { className: "af-accordion__subtitle", children: subtitle })) : null, _jsx(AccordionTagDateContainerComponent, { tagLabel: tagLabel, dateLabel: dateLabel, tagProps: tagProps, dateProps: dateProps }), info1 ? _jsx("p", { className: "af-accordion__info1", children: info1 }) : null, info2 ? _jsx("p", { className: "af-accordion__info2", children: info2 }) : null] }), ...accordionCoreProps, children: children }));
11
- };
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({
8
+ baseClassName: "af-apollo-accordion",
9
+ modifiers: [variant],
10
+ className,
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
+ baseClassName: "af-accordion__tag-container",
13
+ className: tagProps?.className,
14
+ }), children: tagLabel })) : null, dateLabel ? (_jsx("time", { ...dateProps, className: getClassName({
15
+ baseClassName: "af-accordion__date",
16
+ className: dateProps?.className,
17
+ }), children: dateLabel })) : null, info1 ? _jsx("p", { className: "af-accordion__info1", children: info1 }) : null, info2 ? _jsx("p", { className: "af-accordion__info2", children: info2 }) : null] }), ...accordionCoreProps, children: children }));
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AccordionCore } from "../AccordionCore/AccordionCoreLF";
3
- import { AccordionTagDateContainer } from "./AccordionTagDateContainer/AccordionTagDateContainerLF";
3
+ import { Tag } from "../Tag/TagLF";
4
4
  import { AccordionCommon } from "./AccordionCommon";
5
5
  import { Icon } from "../Icon/IconCommon";
6
6
  import "@axa-fr/design-system-apollo-css/dist/Accordion/AccordionLF.css";
7
- export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, AccordionTagDateContainerComponent: AccordionTagDateContainer, IconComponent: Icon }));
7
+ export const Accordion = (props) => (_jsx(AccordionCommon, { ...props, AccordionCoreComponent: AccordionCore, TagComponent: Tag, IconComponent: Icon }));
8
8
  export { accordionVariants } from "./AccordionCommon";
@@ -1,13 +1,17 @@
1
- import { type ComponentProps, ComponentType, type MouseEvent, type ReactNode } from "react";
2
- import { Icon } from "../Icon/IconCommon";
1
+ import { type ComponentProps, type ComponentType, type MouseEventHandler, type ReactNode } from "react";
2
+ import type { IconProps } from "../Icon/IconCommon";
3
+ type SummaryOnClick = MouseEventHandler<HTMLElement>;
3
4
  export type AccordionCoreProps = {
4
5
  summary: ReactNode;
5
- children: ReactNode;
6
+ /**
7
+ * @deprecated use `open` instead
8
+ */
6
9
  isOpen?: boolean;
7
- summaryProps?: ComponentProps<"summary">;
8
- onClick?: (event: MouseEvent<HTMLDetailsElement>) => void;
9
- } & Partial<ComponentProps<"details">>;
10
+ summaryProps?: Omit<ComponentProps<"summary">, "onClick">;
11
+ onClick?: SummaryOnClick;
12
+ } & ComponentProps<"details">;
10
13
  export type AccordionPropsCommonProps = AccordionCoreProps & {
11
- IconComponent: ComponentType<ComponentProps<typeof Icon>>;
14
+ IconComponent: ComponentType<IconProps>;
12
15
  };
13
16
  export declare const AccordionCoreCommon: ({ summary, children, className, summaryProps, isOpen, IconComponent, onClick, ...detailsProps }: AccordionPropsCommonProps) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -1,14 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, } from "react";
3
3
  import keyboardDown from "@material-symbols/svg-400/rounded/keyboard_arrow_down-fill.svg";
4
+ import { getClassName } from "../utilities/getClassName";
4
5
  export const AccordionCoreCommon = ({ summary, children, className, summaryProps, isOpen = false, IconComponent, onClick, ...detailsProps }) => {
5
- const handleToggle = useCallback((event) => {
6
+ const handleSummaryClick = useCallback((event) => {
6
7
  if (onClick) {
7
8
  event.preventDefault();
8
9
  onClick(event);
9
10
  }
10
11
  }, [onClick]);
11
- return (_jsxs("details", { className: ["af-apollo-accordion", className].filter(Boolean).join(" "), open: isOpen, ...detailsProps, children: [_jsxs("summary", { onClick: handleToggle, role: "button", tabIndex: 0, ...summaryProps, className: ["af-apollo-accordion__summary", summaryProps?.className]
12
- .filter(Boolean)
13
- .join(" "), children: [summary, _jsx("div", { className: ["af-accordion__arrow", "af-click-icon"].join(" "), children: _jsx(IconComponent, { src: keyboardDown, role: "presentation" }) })] }), children] }));
12
+ return (_jsxs("details", { className: getClassName({
13
+ baseClassName: "af-apollo-accordion",
14
+ className,
15
+ }), open: isOpen, ...detailsProps, children: [_jsxs("summary", { onClick: handleSummaryClick, tabIndex: 0, ...summaryProps, className: getClassName({
16
+ baseClassName: "af-apollo-accordion__summary",
17
+ className: summaryProps?.className,
18
+ }), children: [summary, _jsx("div", { className: getClassName({
19
+ baseClassName: "af-accordion__arrow",
20
+ className: "af-click-icon",
21
+ }), children: _jsx(IconComponent, { src: keyboardDown, role: "presentation" }) })] }), children] }));
14
22
  };
@@ -1,3 +1,3 @@
1
1
  import { type FileUploadProps } from "./FileUploadCommon";
2
- import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadApollo.css";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
3
3
  export declare const FileUpload: import("react").ForwardRefExoticComponent<Omit<FileUploadProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { InputFile } from "../InputFile/InputFileApollo";
4
4
  import { FileUploadCommon } from "./FileUploadCommon";
5
- import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadApollo.css";
5
+ import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
6
6
  export const FileUpload = forwardRef((props, ref) => (_jsx(FileUploadCommon, { ...props, ref: ref, InputFileComponent: InputFile })));
7
7
  FileUpload.displayName = "FileUpload";
@@ -1,7 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, forwardRef, } from "react";
3
3
  import { generateId } from "../../../utilities/generateId";
4
+ import { getClassName } from "../../../utilities/getClassName";
4
5
  export const FileUploadCommon = forwardRef(({ InputFileComponent, className, children, fileListLabel = "Vos fichiers importés :", ...props }, ref) => {
5
- return (_jsx(InputFileComponent, { ...props, className: ["af-file-upload", className].filter(Boolean).join(" "), ref: ref, children: children ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "af-file-list__title", children: fileListLabel }), _jsx("ul", { className: "af-file-list", children: Children.map(children, (child) => (_jsx("li", { className: "af-file-list__item", children: child }, generateId(child)))) })] })) : null }));
6
+ return (_jsx(InputFileComponent, { ...props, className: getClassName({
7
+ baseClassName: "af-file-upload",
8
+ className,
9
+ }), ref: ref, children: children ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "af-file-list__title", children: fileListLabel }), _jsx("ul", { className: "af-file-list", children: Children.map(children, (child) => (_jsx("li", { className: "af-file-list__item", children: child }, generateId(child)))) })] })) : null }));
6
10
  });
7
11
  FileUploadCommon.displayName = "FileUploadCommon";
@@ -1,3 +1,3 @@
1
1
  import { type FileUploadProps } from "./FileUploadCommon";
2
- import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadLF.css";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
3
3
  export declare const FileUpload: import("react").ForwardRefExoticComponent<Omit<FileUploadProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { InputFile } from "../InputFile/InputFileLF";
4
4
  import { FileUploadCommon } from "./FileUploadCommon";
5
- import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadLF.css";
5
+ import "@axa-fr/design-system-apollo-css/dist/Form/FileUpload/FileUpload/FileUploadAll.css";
6
6
  export const FileUpload = forwardRef((props, ref) => (_jsx(FileUploadCommon, { ...props, ref: ref, InputFileComponent: InputFile })));
7
7
  FileUpload.displayName = "FileUpload";
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
3
  import addCircleIcon from "@material-symbols/svg-400/rounded/add_circle-fill.svg";
4
4
  import { Svg } from "../../../Svg/Svg";
5
+ import { getClassName } from "../../../utilities/getClassName";
5
6
  const DEFAULT_DROPZONE_LABELS = {
6
7
  dropzone: "Glisser et déposer un fichier",
7
8
  or: "ou",
@@ -22,13 +23,17 @@ export const InputFileCommon = forwardRef(({ ItemLabelComponent, ItemMessageComp
22
23
  or: dropzoneLabels.or || DEFAULT_DROPZONE_LABELS.or,
23
24
  button: dropzoneLabels.button || DEFAULT_DROPZONE_LABELS.button,
24
25
  };
25
- return (_jsxs("div", { className: ["af-input-file", className].filter(Boolean).join(" "), style: style, children: [_jsx(ItemLabelComponent, { htmlFor: inputId, description: description, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, required: required, ...labelProps, children: label }), _jsxs("div", { className: "af-input-file__container", children: [_jsxs("span", { className: [
26
- "af-input-file__dropzone",
27
- hasError && "af-input-file__dropzone--error",
28
- ]
29
- .filter(Boolean)
30
- .join(" "), children: [_jsx("input", { ref: ref, type: "file", id: inputId, required: required, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": ariaDescribedby.length > 0
26
+ return (_jsxs("div", { className: getClassName({
27
+ baseClassName: "af-input-file",
28
+ className,
29
+ }), style: style, children: [_jsx(ItemLabelComponent, { htmlFor: inputId, description: description, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, required: required, ...labelProps, children: label }), _jsxs("div", { className: "af-input-file__container", children: [_jsxs("span", { className: getClassName({
30
+ baseClassName: "af-input-file__dropzone",
31
+ modifiers: [hasError && "error"],
32
+ }), children: [_jsx("input", { ref: ref, type: "file", id: inputId, required: required, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": ariaDescribedby.length > 0
31
33
  ? ariaDescribedby.join(" ")
32
- : undefined, ...props }), _jsx("span", { children: resolvedDropzoneLabels.dropzone }), _jsx("span", { children: resolvedDropzoneLabels.or }), _jsxs("span", { className: "af-btn-client af-btn-client--tertiary", children: [_jsx(Svg, { src: addCircleIcon, role: "presentation" }), resolvedDropzoneLabels.button] })] }), helper ? (_jsx("span", { id: helpId, className: "af-input-file__help", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message, messageType: messageType })] }), children] }));
34
+ : undefined, ...props }), _jsx("span", { children: resolvedDropzoneLabels.dropzone }), _jsx("span", { children: resolvedDropzoneLabels.or }), _jsxs("span", { className: getClassName({
35
+ baseClassName: "af-btn-client",
36
+ modifiers: ["tertiary"],
37
+ }), children: [_jsx(Svg, { src: addCircleIcon, role: "presentation" }), resolvedDropzoneLabels.button] })] }), helper ? (_jsx("span", { id: helpId, className: "af-input-file__help", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message, messageType: messageType })] }), children] }));
33
38
  });
34
39
  InputFileCommon.displayName = "InputFileCommon";
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import validationIcon from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
3
3
  import errorIcon from "@material-symbols/svg-400/outlined/error-fill.svg";
4
+ import { getClassName } from "../../../utilities/getClassName";
4
5
  const BASE_UNIT = 1000;
5
6
  const BYTE_UNITS = ["Ko", "Mo", "Go"];
6
7
  const getReadableFileSizeString = (fileSizeInBytes) => {
@@ -17,7 +18,9 @@ export const ItemFileCommon = ({ file, isLoading, errorMessage, className, onRem
17
18
  const handleClick = (callback) => (e) => {
18
19
  callback(file, e);
19
20
  };
20
- return (_jsxs("section", { className: ["af-item-file", hasError && "af-item-file--error", className]
21
- .filter(Boolean)
22
- .join(" "), "aria-busy": isLoading ? true : undefined, "aria-live": "polite", ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [isLoading && !hasError ? (_jsx(ItemSpinnerComponent, { size: 24 })) : (_jsx(ItemIconComponent, { size: "S", src: hasError ? errorIcon : validationIcon })), _jsx("p", { className: "af-item-file__file-name", children: file.name }), _jsx("p", { className: "af-item-file__file-size", children: getReadableFileSizeString(file.size) }), _jsxs("div", { className: "af-item-file__actions", children: [!isLoading && !hasError && (_jsx(ClickIconComponent, { src: previewIcon, onClick: handleClick(onPreview), "aria-label": `Previsualiser le fichier ${file.name}`, ...previewProps })), _jsx(ClickIconComponent, { src: removeIcon, onClick: handleClick(onRemove), "aria-label": `Suppression du fichier ${file.name}`, ...removeProps })] })] }), _jsx(ItemMessageComponent, { message: errorMessage })] }));
21
+ return (_jsxs("section", { className: getClassName({
22
+ baseClassName: "af-item-file",
23
+ modifiers: [hasError && "error"],
24
+ className,
25
+ }), "aria-busy": isLoading ? true : undefined, "aria-live": "polite", ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [isLoading && !hasError ? (_jsx(ItemSpinnerComponent, { size: 24 })) : (_jsx(ItemIconComponent, { size: "S", src: hasError ? errorIcon : validationIcon })), _jsx("p", { className: "af-item-file__file-name", children: file.name }), _jsx("p", { className: "af-item-file__file-size", children: getReadableFileSizeString(file.size) }), _jsxs("div", { className: "af-item-file__actions", children: [!isLoading && !hasError && (_jsx(ClickIconComponent, { src: previewIcon, onClick: handleClick(onPreview), "aria-label": `Previsualiser le fichier ${file.name}`, ...previewProps })), _jsx(ClickIconComponent, { src: removeIcon, onClick: handleClick(onRemove), "aria-label": `Suppression du fichier ${file.name}`, ...removeProps })] })] }), _jsx(ItemMessageComponent, { message: errorMessage })] }));
23
26
  };
@@ -1 +1,8 @@
1
1
  export declare const formatInputDateValue: (value?: Date | string) => string | undefined;
2
+ export declare const isValidDayDecimal: (char: string, index: number) => boolean;
3
+ export declare const isValidDay: (day: number, index: number) => boolean;
4
+ export declare const isValidMonthDecimal: (char: string, index: number) => boolean;
5
+ export declare const isValidMonth: (month: number, index: number) => boolean;
6
+ export declare const isValidMillennium: (char: string, index: number) => boolean;
7
+ export declare const isValidDigit: (char: string, index: number, currentCleanValue: string[]) => boolean;
8
+ export declare const formatDateTextValue: (value?: string) => string;
@@ -1 +1,23 @@
1
1
  export const formatInputDateValue = (value) => value instanceof Date ? value.toISOString().split("T")[0] : value;
2
+ export const isValidDayDecimal = (char, index) => (index === 0 && Number(char) <= 3) || index !== 0;
3
+ export const isValidDay = (day, index) => (index === 1 && day <= 31 && day > 0) || index !== 1;
4
+ export const isValidMonthDecimal = (char, index) => (index === 2 && Number(char) <= 1) || index !== 2;
5
+ export const isValidMonth = (month, index) => (index === 3 && month <= 12 && month > 0) || index !== 3;
6
+ export const isValidMillennium = (char, index) => (index === 4 && Number(char) > 0) || index !== 4;
7
+ export const isValidDigit = (char, index, currentCleanValue) => Number.isInteger(Number(char)) &&
8
+ isValidDayDecimal(char, index) &&
9
+ isValidDay(Number(`${Number(currentCleanValue[0])}${Number(char)}`), index) &&
10
+ isValidMonthDecimal(char, index) &&
11
+ isValidMonth(Number(`${Number(currentCleanValue[2])}${Number(char)}`), index) &&
12
+ isValidMillennium(char, index);
13
+ export const formatDateTextValue = (value) => {
14
+ if (!value) {
15
+ return "";
16
+ }
17
+ return value
18
+ .split("")
19
+ .filter((char) => char !== "/")
20
+ .filter((char, index, currentCleanValue) => isValidDigit(char, index, currentCleanValue))
21
+ .map((char, index) => (index === 2 || index === 4 ? `/${char}` : char))
22
+ .join("");
23
+ };
@@ -0,0 +1,9 @@
1
+ import { type ComponentPropsWithRef } from "react";
2
+ export type InputDateAtomProps = Omit<ComponentPropsWithRef<"input">, "value" | "min" | "max"> & {
3
+ defaultValue?: Date | string;
4
+ value?: Date | string;
5
+ min?: Date | string;
6
+ max?: Date | string;
7
+ };
8
+ declare const InputDateAtom: import("react").ForwardRefExoticComponent<Omit<InputDateAtomProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
9
+ export { InputDateAtom };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { formatInputDateValue } from "./InputDate.helper";
4
+ const InputDateAtom = forwardRef(({ defaultValue, value, min, max, ...otherProps }, inputRef) => (_jsx("input", { ...otherProps, type: "date", ref: inputRef, defaultValue: formatInputDateValue(defaultValue), value: formatInputDateValue(value), min: formatInputDateValue(min), max: formatInputDateValue(max) })));
5
+ InputDateAtom.displayName = "InputDateAtom";
6
+ export { InputDateAtom };
@@ -18,7 +18,7 @@ export type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min
18
18
  success?: string;
19
19
  hidePicker?: boolean;
20
20
  label: ItemLabelProps["label"];
21
- } & Partial<ItemLabelProps & ItemMessageProps>;
21
+ } & Partial<Omit<ItemLabelProps, "onChange"> & ItemMessageProps>;
22
22
  type InputDateCommonProps = InputDateProps & {
23
23
  ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
24
24
  ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
@@ -1,41 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useId, useImperativeHandle, useRef, } from "react";
2
+ import { forwardRef, useId, } from "react";
3
3
  import { getComponentClassName } from "../../utilities/getComponentClassName";
4
- import { formatInputDateValue } from "./InputDate.helper";
5
- const InputDateCommon = forwardRef(({ className, classModifier = "", defaultValue, value, helper, error, success, message, messageType, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, min, max, hidePicker, ...otherProps }, ref) => {
6
- const componentClassName = getComponentClassName("af-form__input-date", className ?? "", `${classModifier}${hidePicker ? " no-picker" : ""}`);
4
+ import { InputDateAtom } from "./InputDateAtom";
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);
7
8
  let inputId = useId();
8
9
  inputId = otherProps.id ?? inputId;
9
10
  const idMessage = useId();
10
11
  const idHelp = useId();
11
- const inputRef = useRef(null);
12
- useImperativeHandle(ref, () => inputRef.current);
13
- const ariaDescribedby = [helper && idHelp, success && idMessage].filter(Boolean);
14
- /* Stop space keydown, enter keydown for non webkit browsers and click events targeting the input element when picker is disabled */
15
- useEffect(() => {
16
- function handleKeydown(event) {
17
- if (hidePicker &&
18
- (event.keyCode === 32 ||
19
- (event.keyCode === 13 &&
20
- !window.navigator?.userAgent?.includes("WebKit"))) &&
21
- event.target === inputRef.current) {
22
- event.preventDefault();
23
- }
24
- }
25
- function handleClick(event) {
26
- if (hidePicker && event.target === inputRef.current) {
27
- event.preventDefault();
28
- }
29
- }
30
- window.addEventListener("keydown", handleKeydown);
31
- window.addEventListener("click", handleClick);
32
- return () => {
33
- window.removeEventListener("keydown", handleKeydown);
34
- window.removeEventListener("click", handleClick);
35
- };
36
- }, [hidePicker]);
12
+ const ariaDescribedbyIds = [
13
+ helper && idHelp,
14
+ ((Boolean(message) && messageType === "success") || Boolean(success)) &&
15
+ idMessage,
16
+ ].filter(Boolean);
17
+ const ariaDescribedby = ariaDescribedbyIds.length
18
+ ? ariaDescribedbyIds.join(" ")
19
+ : undefined;
37
20
  const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
38
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId }), _jsx("input", { ...otherProps, id: inputId, className: componentClassName, type: "date", ref: inputRef, defaultValue: formatInputDateValue(defaultValue), value: formatInputDateValue(value), "aria-errormessage": hasError ? idMessage : undefined, "aria-invalid": hasError || undefined, "aria-describedby": ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, required: required, min: formatInputDateValue(min), max: formatInputDateValue(max) }), 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") })] }));
21
+ const ariaErrormessage = hasError ? idMessage : undefined;
22
+ 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") })] }));
39
24
  });
40
25
  InputDateCommon.displayName = "InputDate";
41
26
  export { InputDateCommon };
@@ -0,0 +1,9 @@
1
+ import { type ComponentProps } from "react";
2
+ import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
3
+ export type InputDateTextAtomProps = Omit<ComponentProps<typeof InputTextAtom>, "value"> & {
4
+ value?: Date | string;
5
+ defaultValue?: Date | string;
6
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ };
8
+ declare const InputDateTextAtom: import("react").ForwardRefExoticComponent<Omit<InputDateTextAtomProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
9
+ export { InputDateTextAtom };
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
4
+ import { formatDateTextValue, formatInputDateValue } from "./InputDate.helper";
5
+ const InputDateTextAtom = forwardRef(({ onChange, value, defaultValue, ...otherProps }, inputRef) => {
6
+ const handleChange = (e) => {
7
+ const formattedValue = formatDateTextValue(e.target.value);
8
+ onChange?.({
9
+ ...e,
10
+ target: { ...e.target, value: formattedValue },
11
+ });
12
+ };
13
+ return (_jsx(InputTextAtom, { pattern: "\\d{0,2}/?\\d{0,2}/?\\d{0,4}", maxLength: 10, ref: inputRef, inputMode: "numeric", onChange: handleChange, value: formatInputDateValue(value), defaultValue: formatInputDateValue(defaultValue), ...otherProps }));
14
+ });
15
+ InputDateTextAtom.displayName = "InputDateText";
16
+ export { InputDateTextAtom };
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
3
  import { getComponentClassName } from "../../utilities/getComponentClassName";
4
- const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, type = "text", ...otherProps }, inputRef) => {
4
+ const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, "aria-describedby": ariaDescribedby, type = "text", ...otherProps }, inputRef) => {
5
5
  const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
6
6
  let inputId = useId();
7
7
  inputId = otherProps.id || inputId;
8
- return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: type, required: required, ref: inputRef, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": idHelp, ...otherProps }), unit] }));
8
+ return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: type, required: required, ref: inputRef, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": ariaDescribedby ?? idHelp, ...otherProps }), unit] }));
9
9
  });
10
10
  InputTextAtom.displayName = "InputTextAtom";
11
11
  export { InputTextAtom };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { BasePicture } from "./BasePicture/BasePicture";
8
8
  export { Button, buttonVariants, type ButtonVariants, } from "./Button/ButtonApollo";
9
9
  export { CardMessage, cardMessageVariants, type CardMessageVariants, } from "./CardMessage/CardMessageApollo";
10
10
  export { ClickIcon } from "./ClickIcon/ClickIconApollo";
11
+ export { ContentItemDuoAction, type ContentItemDuoActionState, } from "./ContentItemDuoAction/ContentItemDuoActionApollo";
11
12
  export { ContentItemMono } from "./ContentItemMono/ContentItemMonoApollo";
12
13
  export { DataAgent } from "./DataAgent/DataAgentApollo";
13
14
  export { Divider } from "./Divider/DividerApollo";
@@ -18,6 +19,9 @@ export { CardCheckboxOption } from "./Form/Checkbox/CardCheckboxOption/CardCheck
18
19
  export { Checkbox } from "./Form/Checkbox/Checkbox/CheckboxApollo";
19
20
  export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextApollo";
20
21
  export { Dropdown } from "./Form/Dropdown/DropdownApollo";
22
+ export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadApollo";
23
+ export { InputFile } from "./Form/FileUpload/InputFile/InputFileApollo";
24
+ export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileApollo";
21
25
  export { InputDate } from "./Form/InputDate/InputDateApollo";
22
26
  export { type OptionType } from "./Form/InputPhone/InputPhone.types";
23
27
  export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
@@ -33,12 +37,10 @@ export { DebugGrid } from "./Grid/DebugGridApollo";
33
37
  export { Heading, type HeadingLevel } from "./Heading/HeadingApollo";
34
38
  export { Icon, iconSizeVariants, iconVariants, type IconSizeVariants, type IconVariants, } from "./Icon/IconApollo";
35
39
  export { ItemTabBar, type ItemTabBarProps, } from "./ItemTabBar/ItemTabBarApollo";
36
- export { TabBar, type TabBarProps, tabBarDirection, type TabBarDirection, } from "./TabBar/TabBarApollo";
37
40
  export { Footer, type FooterProps } from "./Layout/Footer/FooterApollo";
38
41
  export { Link, linkVariants, type LinkVariants } from "./Link/LinkApollo";
39
42
  export { ClickItem, clickItemStates, clickItemVariants, type ClickItemStates, type ClickItemVariants, } from "./List/ClickItem/ClickItemApollo";
40
43
  export { ContentItemDuo } from "./List/ContentItemDuo/ContentItemDuoApollo";
41
- export { type ContentItemDuoActionState, ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionApollo";
42
44
  export { Message, messageVariants, type MessageVariants, } from "./Message/MessageApollo";
43
45
  export { Modal, ModalCore, ModalCoreBody, ModalCoreFooter, ModalCoreHeader, } from "./Modal/ModalApollo";
44
46
  export { ProgressBar } from "./ProgressBar/ProgressBarApollo";
@@ -46,9 +48,7 @@ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupApollo";
46
48
  export { Spinner, spinnerVariants, type SpinnerVariants, } from "./Spinner/SpinnerApollo";
47
49
  export { Stepper } from "./Stepper/StepperApollo";
48
50
  export { Svg } from "./Svg/Svg";
51
+ export { TabBar, tabBarDirection, type TabBarDirection, type TabBarProps, } from "./TabBar/TabBarApollo";
49
52
  export { Tag, tagVariants, type TagVariants } from "./Tag/TagApollo";
50
53
  export { TimelineVertical } from "./TimelineVertical/TimelineVerticalApollo";
51
54
  export { Toggle } from "./Toggle/ToggleApollo";
52
- export { InputFile } from "./Form/FileUpload/InputFile/InputFileApollo";
53
- export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileApollo";
54
- export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadApollo";
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export { BasePicture } from "./BasePicture/BasePicture";
8
8
  export { Button, buttonVariants, } from "./Button/ButtonApollo";
9
9
  export { CardMessage, cardMessageVariants, } from "./CardMessage/CardMessageApollo";
10
10
  export { ClickIcon } from "./ClickIcon/ClickIconApollo";
11
+ export { ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionApollo";
11
12
  export { ContentItemMono } from "./ContentItemMono/ContentItemMonoApollo";
12
13
  export { DataAgent } from "./DataAgent/DataAgentApollo";
13
14
  export { Divider } from "./Divider/DividerApollo";
@@ -18,6 +19,9 @@ export { CardCheckboxOption } from "./Form/Checkbox/CardCheckboxOption/CardCheck
18
19
  export { Checkbox } from "./Form/Checkbox/Checkbox/CheckboxApollo";
19
20
  export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextApollo";
20
21
  export { Dropdown } from "./Form/Dropdown/DropdownApollo";
22
+ export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadApollo";
23
+ export { InputFile } from "./Form/FileUpload/InputFile/InputFileApollo";
24
+ export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileApollo";
21
25
  export { InputDate } from "./Form/InputDate/InputDateApollo";
22
26
  export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
23
27
  export { InputText } from "./Form/InputText/InputTextApollo";
@@ -32,12 +36,10 @@ export { DebugGrid } from "./Grid/DebugGridApollo";
32
36
  export { Heading } from "./Heading/HeadingApollo";
33
37
  export { Icon, iconSizeVariants, iconVariants, } from "./Icon/IconApollo";
34
38
  export { ItemTabBar, } from "./ItemTabBar/ItemTabBarApollo";
35
- export { TabBar, tabBarDirection, } from "./TabBar/TabBarApollo";
36
39
  export { Footer } from "./Layout/Footer/FooterApollo";
37
40
  export { Link, linkVariants } from "./Link/LinkApollo";
38
41
  export { ClickItem, clickItemStates, clickItemVariants, } from "./List/ClickItem/ClickItemApollo";
39
42
  export { ContentItemDuo } from "./List/ContentItemDuo/ContentItemDuoApollo";
40
- export { ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionApollo";
41
43
  export { Message, messageVariants, } from "./Message/MessageApollo";
42
44
  export { Modal, ModalCore, ModalCoreBody, ModalCoreFooter, ModalCoreHeader, } from "./Modal/ModalApollo";
43
45
  export { ProgressBar } from "./ProgressBar/ProgressBarApollo";
@@ -45,9 +47,7 @@ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupApollo";
45
47
  export { Spinner, spinnerVariants, } from "./Spinner/SpinnerApollo";
46
48
  export { Stepper } from "./Stepper/StepperApollo";
47
49
  export { Svg } from "./Svg/Svg";
50
+ export { TabBar, tabBarDirection, } from "./TabBar/TabBarApollo";
48
51
  export { Tag, tagVariants } from "./Tag/TagApollo";
49
52
  export { TimelineVertical } from "./TimelineVertical/TimelineVerticalApollo";
50
53
  export { Toggle } from "./Toggle/ToggleApollo";
51
- export { InputFile } from "./Form/FileUpload/InputFile/InputFileApollo";
52
- export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileApollo";
53
- export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadApollo";
package/dist/indexLF.d.ts CHANGED
@@ -8,6 +8,7 @@ export { BasePicture } from "./BasePicture/BasePicture";
8
8
  export { Button, buttonVariants, type ButtonVariants } from "./Button/ButtonLF";
9
9
  export { CardMessage, cardMessageVariants, type CardMessageVariants, } from "./CardMessage/CardMessageLF";
10
10
  export { ClickIcon } from "./ClickIcon/ClickIconLF";
11
+ export { ContentItemDuoAction, type ContentItemDuoActionState, } from "./ContentItemDuoAction/ContentItemDuoActionLF";
11
12
  export { ContentItemMono } from "./ContentItemMono/ContentItemMonoLF";
12
13
  export { DataAgent } from "./DataAgent/DataAgentLF";
13
14
  export { Divider } from "./Divider/DividerLF";
@@ -18,6 +19,9 @@ export { CardCheckboxOption } from "./Form/Checkbox/CardCheckboxOption/CardCheck
18
19
  export { Checkbox } from "./Form/Checkbox/Checkbox/CheckboxLF";
19
20
  export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextLF";
20
21
  export { Dropdown } from "./Form/Dropdown/DropdownLF";
22
+ export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadLF";
23
+ export { InputFile } from "./Form/FileUpload/InputFile/InputFileLF";
24
+ export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileLF";
21
25
  export {
22
26
  /** @deprecated Use `InputDate` instead. */
23
27
  InputDate as DateInput, InputDate, } from "./Form/InputDate/InputDateLF";
@@ -37,12 +41,10 @@ export { DebugGrid } from "./Grid/DebugGridLF";
37
41
  export { Heading, type HeadingLevel } from "./Heading/HeadingLF";
38
42
  export { Icon, iconSizeVariants, iconVariants, type IconSizeVariants, type IconVariants, } from "./Icon/IconLF";
39
43
  export { ItemTabBar, type ItemTabBarProps } from "./ItemTabBar/ItemTabBarLF";
40
- export { TabBar, type TabBarProps, tabBarDirection, type TabBarDirection, } from "./TabBar/TabBarLF";
41
44
  export { Footer, type FooterProps } from "./Layout/Footer/FooterLF";
42
45
  export { Link, linkVariants, type LinkVariants } from "./Link/LinkLF";
43
46
  export { ClickItem, clickItemStates, clickItemVariants, type ClickItemStates, type ClickItemVariants, } from "./List/ClickItem/ClickItemLF";
44
47
  export { ContentItemDuo } from "./List/ContentItemDuo/ContentItemDuoLF";
45
- export { type ContentItemDuoActionState, ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionLF";
46
48
  export { Message, messageVariants, type MessageVariants, } from "./Message/MessageLF";
47
49
  export { Modal, ModalCore, ModalCoreBody, ModalCoreFooter, ModalCoreHeader, } from "./Modal/ModalLF";
48
50
  export { ProgressBar } from "./ProgressBar/ProgressBarLF";
@@ -50,9 +52,7 @@ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupLF";
50
52
  export { Spinner, spinnerVariants, type SpinnerVariants, } from "./Spinner/SpinnerLF";
51
53
  export { Stepper } from "./Stepper/StepperLF";
52
54
  export { Svg } from "./Svg/Svg";
55
+ export { TabBar, tabBarDirection, type TabBarDirection, type TabBarProps, } from "./TabBar/TabBarLF";
53
56
  export { Tag, tagVariants, type TagVariants } from "./Tag/TagLF";
54
57
  export { TimelineVertical } from "./TimelineVertical/TimelineVerticalLF";
55
58
  export { Toggle } from "./Toggle/ToggleLF";
56
- export { InputFile } from "./Form/FileUpload/InputFile/InputFileLF";
57
- export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileLF";
58
- export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadLF";
package/dist/indexLF.js CHANGED
@@ -8,6 +8,7 @@ export { BasePicture } from "./BasePicture/BasePicture";
8
8
  export { Button, buttonVariants } from "./Button/ButtonLF";
9
9
  export { CardMessage, cardMessageVariants, } from "./CardMessage/CardMessageLF";
10
10
  export { ClickIcon } from "./ClickIcon/ClickIconLF";
11
+ export { ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionLF";
11
12
  export { ContentItemMono } from "./ContentItemMono/ContentItemMonoLF";
12
13
  export { DataAgent } from "./DataAgent/DataAgentLF";
13
14
  export { Divider } from "./Divider/DividerLF";
@@ -18,6 +19,9 @@ export { CardCheckboxOption } from "./Form/Checkbox/CardCheckboxOption/CardCheck
18
19
  export { Checkbox } from "./Form/Checkbox/Checkbox/CheckboxLF";
19
20
  export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextLF";
20
21
  export { Dropdown } from "./Form/Dropdown/DropdownLF";
22
+ export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadLF";
23
+ export { InputFile } from "./Form/FileUpload/InputFile/InputFileLF";
24
+ export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileLF";
21
25
  export {
22
26
  /** @deprecated Use `InputDate` instead. */
23
27
  InputDate as DateInput, InputDate, } from "./Form/InputDate/InputDateLF";
@@ -36,12 +40,10 @@ export { DebugGrid } from "./Grid/DebugGridLF";
36
40
  export { Heading } from "./Heading/HeadingLF";
37
41
  export { Icon, iconSizeVariants, iconVariants, } from "./Icon/IconLF";
38
42
  export { ItemTabBar } from "./ItemTabBar/ItemTabBarLF";
39
- export { TabBar, tabBarDirection, } from "./TabBar/TabBarLF";
40
43
  export { Footer } from "./Layout/Footer/FooterLF";
41
44
  export { Link, linkVariants } from "./Link/LinkLF";
42
45
  export { ClickItem, clickItemStates, clickItemVariants, } from "./List/ClickItem/ClickItemLF";
43
46
  export { ContentItemDuo } from "./List/ContentItemDuo/ContentItemDuoLF";
44
- export { ContentItemDuoAction, } from "./ContentItemDuoAction/ContentItemDuoActionLF";
45
47
  export { Message, messageVariants, } from "./Message/MessageLF";
46
48
  export { Modal, ModalCore, ModalCoreBody, ModalCoreFooter, ModalCoreHeader, } from "./Modal/ModalLF";
47
49
  export { ProgressBar } from "./ProgressBar/ProgressBarLF";
@@ -49,9 +51,7 @@ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupLF";
49
51
  export { Spinner, spinnerVariants, } from "./Spinner/SpinnerLF";
50
52
  export { Stepper } from "./Stepper/StepperLF";
51
53
  export { Svg } from "./Svg/Svg";
54
+ export { TabBar, tabBarDirection, } from "./TabBar/TabBarLF";
52
55
  export { Tag, tagVariants } from "./Tag/TagLF";
53
56
  export { TimelineVertical } from "./TimelineVertical/TimelineVerticalLF";
54
57
  export { Toggle } from "./Toggle/ToggleLF";
55
- export { InputFile } from "./Form/FileUpload/InputFile/InputFileLF";
56
- export { ItemFile } from "./Form/FileUpload/ItemFile/ItemFileLF";
57
- export { FileUpload } from "./Form/FileUpload/FileUpload/FileUploadLF";
@@ -0,0 +1,20 @@
1
+ type getClassNameParams = {
2
+ baseClassName: string;
3
+ modifiers?: Array<string | boolean | undefined>;
4
+ className?: string;
5
+ };
6
+ /**
7
+ * Generates a CSS class string from a base class name, optional modifiers, and an additional class name.
8
+ *
9
+ * @param {string} params.baseClassName - The base class name (required).
10
+ * @param {Array<string|boolean|undefined>} [params.modifiers] - List of modifiers to append as `${baseClassName}--{modifier}`. Falsy values are ignored.
11
+ * @param {string} [params.className] - Additional class name(s) to append to the final string.
12
+ * @returns {string} The concatenated CSS class string, separated by spaces.
13
+ *
14
+ * @example
15
+ * const isLarge = false;
16
+ * getClassName({ baseClassName: 'af-button', modifiers: ['primary', isLarge && 'large'], className: 'custom-class' })
17
+ * // Returns: 'af-button af-button--primary custom-class'
18
+ */
19
+ export declare const getClassName: ({ baseClassName, modifiers, className, }: getClassNameParams) => string;
20
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Generates a CSS class string from a base class name, optional modifiers, and an additional class name.
3
+ *
4
+ * @param {string} params.baseClassName - The base class name (required).
5
+ * @param {Array<string|boolean|undefined>} [params.modifiers] - List of modifiers to append as `${baseClassName}--{modifier}`. Falsy values are ignored.
6
+ * @param {string} [params.className] - Additional class name(s) to append to the final string.
7
+ * @returns {string} The concatenated CSS class string, separated by spaces.
8
+ *
9
+ * @example
10
+ * const isLarge = false;
11
+ * getClassName({ baseClassName: 'af-button', modifiers: ['primary', isLarge && 'large'], className: 'custom-class' })
12
+ * // Returns: 'af-button af-button--primary custom-class'
13
+ */
14
+ export const getClassName = ({ baseClassName, modifiers = [], className = "", }) => {
15
+ const parsedModifiers = modifiers
16
+ .filter(Boolean)
17
+ .map((modifier) => `${baseClassName}--${modifier}`);
18
+ const classList = [
19
+ baseClassName,
20
+ ...parsedModifiers,
21
+ ...className.split(" "),
22
+ ].filter(Boolean);
23
+ return Array.from(new Set(classList)).join(" ");
24
+ };
@@ -1 +1,4 @@
1
+ /**
2
+ * @deprecated This function is deprecated and will be removed in a future release. Use getClassName instead.
3
+ */
1
4
  export declare const getComponentClassName: (defaultClassName: string, className?: string, classModifier?: string) => string;
@@ -11,6 +11,9 @@ const listClassModifier = (classModifier) => {
11
11
  }
12
12
  return classModifier.split(" ");
13
13
  };
14
+ /**
15
+ * @deprecated This function is deprecated and will be removed in a future release. Use getClassName instead.
16
+ */
14
17
  export const getComponentClassName = (defaultClassName, className, classModifier) => {
15
18
  // Fail fast, when no defaultClassName we don't want to loop on modifier
16
19
  if (!defaultClassName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "3.0.1-tags-slash-2-0-4.3",
3
+ "version": "3.1.0-RC.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -46,10 +46,9 @@
46
46
  },
47
47
  "homepage": "https://github.com/AxaFrance/design-system#readme",
48
48
  "peerDependencies": {
49
- "@axa-fr/design-system-apollo-css": "3.0.1-tags-slash-2-0-4.3",
49
+ "@axa-fr/design-system-apollo-css": "3.1.0-RC.2",
50
50
  "@material-symbols/svg-400": ">= 0.19.0",
51
- "react": ">= 18",
52
- "@axa-fr/design-system-look-and-feel-css": "3.0.1-tags-slash-2-0-4.3"
51
+ "react": ">= 18"
53
52
  },
54
53
  "peerDependenciesMeta": {
55
54
  "@material-symbols/svg-400": {
@@ -1,3 +0,0 @@
1
- import { type AccordionTagDateContainerProps } from "./AccordionTagDateContainerCommon";
2
- import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreApollo.css";
3
- export declare const AccordionTagDateContainer: (props: AccordionTagDateContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Tag } from "../../Tag/TagApollo";
3
- import { AccordionTagDateContainerCommon, } from "./AccordionTagDateContainerCommon";
4
- import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreApollo.css";
5
- export const AccordionTagDateContainer = (props) => _jsx(AccordionTagDateContainerCommon, { ...props, TagComponent: Tag });
@@ -1,12 +0,0 @@
1
- import { type ComponentProps, ComponentType } from "react";
2
- import { Tag } from "../../Tag/TagCommon";
3
- export type AccordionTagDateContainerProps = {
4
- dateLabel?: string;
5
- dateProps?: ComponentProps<"time">;
6
- tagLabel?: string;
7
- tagProps?: ComponentProps<typeof Tag>;
8
- };
9
- export type AccordionTagDateContainerCommonProps = AccordionTagDateContainerProps & {
10
- TagComponent: ComponentType<ComponentProps<typeof Tag>>;
11
- };
12
- export declare const AccordionTagDateContainerCommon: ({ dateLabel, dateProps, tagLabel, tagProps, TagComponent, }: AccordionTagDateContainerCommonProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- export const AccordionTagDateContainerCommon = ({ dateLabel, dateProps, tagLabel, tagProps, TagComponent, }) => {
4
- const isShowing = useMemo(() => Boolean(tagLabel) || Boolean(dateLabel), [tagLabel, dateLabel]);
5
- if (!isShowing) {
6
- return null;
7
- }
8
- return (_jsxs(_Fragment, { children: [tagLabel ? (_jsx("div", { className: "af-accordion__tag-container", children: _jsx(TagComponent, { variant: "warning", ...tagProps, children: tagLabel }) })) : null, dateLabel ? (_jsx("time", { className: "af-accordion__date", ...dateProps, children: dateLabel })) : null] }));
9
- };
@@ -1,3 +0,0 @@
1
- import { type AccordionTagDateContainerProps } from "./AccordionTagDateContainerCommon";
2
- import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreLF.css";
3
- export declare const AccordionTagDateContainer: (props: AccordionTagDateContainerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Tag } from "../../Tag/TagLF";
3
- import { AccordionTagDateContainerCommon, } from "./AccordionTagDateContainerCommon";
4
- import "@axa-fr/design-system-apollo-css/dist/AccordionCore/AccordionCoreLF.css";
5
- export const AccordionTagDateContainer = (props) => _jsx(AccordionTagDateContainerCommon, { ...props, TagComponent: Tag });