@axa-fr/design-system-slash-react 1.1.1-alpha.2 → 1.1.1-alpha.204

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 (88) hide show
  1. package/dist/Accordion/CollapseCard.d.ts +3 -3
  2. package/dist/Action/Action.js +1 -1
  3. package/dist/Alert/Alert.d.ts +2 -1
  4. package/dist/Alert/Alert.js +2 -2
  5. package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
  6. package/dist/Form/Checkbox/CheckboxInput.js +8 -3
  7. package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
  8. package/dist/Form/Choice/ChoiceInput.js +6 -3
  9. package/dist/Form/Date/DateInput.d.ts +40 -6
  10. package/dist/Form/Date/DateInput.js +9 -5
  11. package/dist/Form/File/File.d.ts +2 -0
  12. package/dist/Form/File/File.js +1 -0
  13. package/dist/Form/File/FileInput.d.ts +2 -2
  14. package/dist/Form/File/FileInput.js +6 -2
  15. package/dist/Form/File/constants.d.ts +1 -0
  16. package/dist/Form/File/constants.js +1 -0
  17. package/dist/Form/File/index.d.ts +4 -3
  18. package/dist/Form/File/index.js +3 -3
  19. package/dist/Form/MultiSelect/MultiSelectInput.d.ts +2 -2
  20. package/dist/Form/MultiSelect/MultiSelectInput.js +5 -2
  21. package/dist/Form/NestedQuestion/NestedQuestion.d.ts +5 -0
  22. package/dist/Form/NestedQuestion/NestedQuestion.js +7 -0
  23. package/dist/Form/Number/NumberInput.d.ts +2 -2
  24. package/dist/Form/Number/NumberInput.js +5 -2
  25. package/dist/Form/Pass/PassInput.d.ts +2 -2
  26. package/dist/Form/Pass/PassInput.js +7 -3
  27. package/dist/Form/Radio/RadioInput.d.ts +3 -6
  28. package/dist/Form/Radio/RadioInput.js +6 -3
  29. package/dist/Form/Select/Select.d.ts +310 -5
  30. package/dist/Form/Select/Select.js +7 -4
  31. package/dist/Form/Select/SelectBase.d.ts +1 -1
  32. package/dist/Form/Select/SelectBase.js +3 -2
  33. package/dist/Form/Select/SelectDefault.d.ts +3 -2
  34. package/dist/Form/Select/SelectDefault.js +6 -8
  35. package/dist/Form/Select/SelectDefaultWithOptions.d.ts +9 -0
  36. package/dist/Form/Select/SelectDefaultWithOptions.js +18 -0
  37. package/dist/Form/Select/SelectInput.d.ts +386 -6
  38. package/dist/Form/Select/SelectInput.js +5 -2
  39. package/dist/Form/Slider/SliderInput.d.ts +2 -2
  40. package/dist/Form/Slider/SliderInput.js +8 -3
  41. package/dist/Form/Text/TextInput.d.ts +3 -6
  42. package/dist/Form/Text/TextInput.js +7 -10
  43. package/dist/Form/Text/index.d.ts +1 -1
  44. package/dist/Form/Text/index.js +1 -1
  45. package/dist/Form/Textarea/TextareaInput.d.ts +2 -2
  46. package/dist/Form/Textarea/TextareaInput.js +5 -2
  47. package/dist/Form/core/Field.d.ts +16 -4
  48. package/dist/Form/core/Field.js +18 -8
  49. package/dist/Form/core/FieldError.d.ts +2 -1
  50. package/dist/Form/core/FieldError.js +2 -2
  51. package/dist/Form/core/FieldForm.d.ts +2 -2
  52. package/dist/Form/core/FieldForm.js +3 -2
  53. package/dist/Form/core/LegacyField.d.ts +17 -0
  54. package/dist/Form/core/LegacyField.js +15 -0
  55. package/dist/Form/core/index.d.ts +6 -5
  56. package/dist/Form/core/index.js +6 -5
  57. package/dist/Form/core/useAriaInvalid.d.ts +2 -0
  58. package/dist/Form/core/useAriaInvalid.js +2 -0
  59. package/dist/Layout/Footer/Footer.js +1 -1
  60. package/dist/Layout/Header/Infos/Infos.js +4 -1
  61. package/dist/Layout/Header/MenuTitleWrapper/MenuTitleWrapper.d.ts +4 -1
  62. package/dist/Layout/Header/MenuTitleWrapper/MenuTitleWrapper.js +3 -3
  63. package/dist/Layout/Header/NavBar/NavBar.js +1 -0
  64. package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.d.ts +7 -1
  65. package/dist/Layout/Header/NavBar/NavBarItem/NavBarItemBase.d.ts +1 -1
  66. package/dist/Layout/Header/ToggleButton/ToggleButton.d.ts +2 -2
  67. package/dist/Layout/Header/ToggleButton/ToggleButton.js +1 -1
  68. package/dist/Layout/Header/index.d.ts +3 -2
  69. package/dist/Layout/Header/index.js +3 -2
  70. package/dist/Link/Link.d.ts +10 -0
  71. package/dist/Link/Link.js +8 -0
  72. package/dist/ModalAgent/Modal.js +1 -1
  73. package/dist/Restitution/HeaderRestitution.js +1 -1
  74. package/dist/Restitution/SectionRestitutionTitle.js +1 -1
  75. package/dist/Summary/index.js +2 -1
  76. package/dist/Table/Pagination/Items.d.ts +2 -1
  77. package/dist/Table/Pagination/Items.js +9 -5
  78. package/dist/Table/Pagination/Paging.d.ts +1 -1
  79. package/dist/Table/Pagination/Paging.js +2 -2
  80. package/dist/Tabs/components/TabsStateless.d.ts +2 -2
  81. package/dist/Tabs/components/TabsStateless.js +1 -1
  82. package/dist/Title/Title.d.ts +3 -1
  83. package/dist/Title/Title.js +6 -5
  84. package/dist/index.d.ts +6 -2
  85. package/dist/index.js +5 -1
  86. package/package.json +41 -19
  87. package/dist/Form/Text/inputTypes.d.ts +0 -2
  88. package/dist/Form/Text/inputTypes.js +0 -5
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getComponentClassName } from "../../utilities";
3
3
  import { MessageTypes } from "./MessageTypes";
4
4
  const DEFAULT_CLASS_NAME = "af-form__message";
5
- export const FieldError = ({ message = null, messageType = MessageTypes.error, }) => {
5
+ export const FieldError = ({ message = null, messageType = MessageTypes.error, errorId = undefined, }) => {
6
6
  const className = getComponentClassName(DEFAULT_CLASS_NAME, messageType, DEFAULT_CLASS_NAME);
7
- return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { className: `af-form__${messageType}-text`, children: message })] })));
7
+ return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { id: errorId, className: `af-form__${messageType}-text`, children: message })] })));
8
8
  };
@@ -1,4 +1,4 @@
1
- import { BaseSyntheticEvent, Dispatch, ReactNode, SetStateAction } from "react";
1
+ import { type BaseSyntheticEvent, type Dispatch, type ReactElement, type ReactNode, type SetStateAction } from "react";
2
2
  import { FormClassManager } from "./FormClassManager";
3
3
  import { MessageTypes } from "./MessageTypes";
4
4
  type TMessage = {
@@ -49,7 +49,7 @@ export declare const eventWrapper: ({ wrapper, props }: EventWrapperProps) => {
49
49
  onFocus: (ev: BaseSyntheticEvent) => void;
50
50
  };
51
51
  type AddPropsClone = Omit<RenderChildrenProps, "children"> & {
52
- child: JSX.Element;
52
+ child: ReactElement<Record<string, unknown>>;
53
53
  classModifier: string;
54
54
  name: string;
55
55
  getMessageClassModifierFn?: typeof FormClassManager.getMessageClassModifier;
@@ -100,7 +100,8 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
100
100
  };
101
101
  if (child.props.children) {
102
102
  const subChildren = renderedChildren({
103
- children: child.props.children,
103
+ children: child.props
104
+ .children,
104
105
  wrapper,
105
106
  message,
106
107
  messageType,
@@ -118,7 +119,7 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
118
119
  messageType,
119
120
  classModifier: props.classModifier,
120
121
  wrapper,
121
- child,
122
+ child: child,
122
123
  }),
123
124
  });
124
125
  });
@@ -0,0 +1,17 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
+ import { FieldForm } from "./FieldForm";
3
+ type FieldProps = Omit<ComponentPropsWithoutRef<typeof FieldForm>, "children"> & {
4
+ label: ReactNode;
5
+ children?: ReactNode;
6
+ id?: string;
7
+ classModifier?: string;
8
+ classNameContainerLabel?: string;
9
+ classNameContainerInput?: string;
10
+ isVisible?: boolean;
11
+ roleContainer?: string;
12
+ ariaLabelContainer?: string;
13
+ isLabelContainerLinkedToInput?: boolean;
14
+ errorId?: string;
15
+ };
16
+ export declare const LegacyField: ({ id, message, messageType, label, children, forceDisplayMessage, classModifier, className, classNameContainerLabel, classNameContainerInput, isVisible, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, errorId, }: FieldProps) => import("react/jsx-runtime").JSX.Element | null;
17
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { getComponentClassName } from "../../utilities";
4
+ import { FieldError } from "./FieldError";
5
+ import { FieldForm } from "./FieldForm";
6
+ import { MessageTypes } from "./MessageTypes";
7
+ export const LegacyField = ({ id = "", message = "", messageType = MessageTypes.error, label, children, forceDisplayMessage, classModifier = "", className, classNameContainerLabel = "col-md-2", classNameContainerInput = "col-md-10", isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, errorId, }) => {
8
+ if (!isVisible) {
9
+ return null;
10
+ }
11
+ const componentClassName = getComponentClassName(className, classModifier, "row af-form__group");
12
+ return (_jsxs("div", { className: componentClassName, role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: classNames({
13
+ "af-form__group-label--required": classModifier.includes("required"),
14
+ }, "af-form__group-label"), htmlFor: isLabelContainerLinkedToInput ? id : undefined, children: label }) }), _jsxs(FieldForm, { className: classNameContainerInput, message: message, messageType: messageType, forceDisplayMessage: forceDisplayMessage, children: [children, _jsx(FieldError, { message: message, messageType: messageType, errorId: errorId })] })] }));
15
+ };
@@ -1,16 +1,17 @@
1
1
  import { ReactNode } from "react";
2
2
  export { Field } from "./Field";
3
- export { FieldInput } from "./FieldInput";
4
- export { MessageTypes } from "./MessageTypes";
5
3
  export { FieldError } from "./FieldError";
6
- export { FormClassManager } from "./FormClassManager";
7
4
  export { FieldForm } from "./FieldForm";
5
+ export { FieldInput } from "./FieldInput";
6
+ export { FormClassManager } from "./FormClassManager";
8
7
  export { HelpMessage } from "./HelpMessage";
9
8
  export { InputList } from "./InputList";
10
- export { useInputClassModifier } from "./useInputClassModifier";
9
+ export { LegacyField } from "./LegacyField";
10
+ export { MessageTypes } from "./MessageTypes";
11
+ export { getFirstId } from "./getFirstId";
11
12
  export { getOptionClassName } from "./getOptionClassName";
13
+ export { useInputClassModifier } from "./useInputClassModifier";
12
14
  export { useOptionsWithId } from "./useOptionsWithId";
13
- export { getFirstId } from "./getFirstId";
14
15
  export type Option = {
15
16
  id?: string;
16
17
  icon?: ReactNode;
@@ -1,12 +1,13 @@
1
1
  export { Field } from "./Field";
2
- export { FieldInput } from "./FieldInput";
3
- export { MessageTypes } from "./MessageTypes";
4
2
  export { FieldError } from "./FieldError";
5
- export { FormClassManager } from "./FormClassManager";
6
3
  export { FieldForm } from "./FieldForm";
4
+ export { FieldInput } from "./FieldInput";
5
+ export { FormClassManager } from "./FormClassManager";
7
6
  export { HelpMessage } from "./HelpMessage";
8
7
  export { InputList } from "./InputList";
9
- export { useInputClassModifier } from "./useInputClassModifier";
8
+ export { LegacyField } from "./LegacyField";
9
+ export { MessageTypes } from "./MessageTypes";
10
+ export { getFirstId } from "./getFirstId";
10
11
  export { getOptionClassName } from "./getOptionClassName";
12
+ export { useInputClassModifier } from "./useInputClassModifier";
11
13
  export { useOptionsWithId } from "./useOptionsWithId";
12
- export { getFirstId } from "./getFirstId";
@@ -0,0 +1,2 @@
1
+ import { MessageTypes } from ".";
2
+ export declare const useAriaInvalid: (message?: string, forceDisplayMessage?: boolean, messageType?: MessageTypes) => boolean;
@@ -0,0 +1,2 @@
1
+ import { MessageTypes } from ".";
2
+ export const useAriaInvalid = (message, forceDisplayMessage, messageType) => Boolean(message && forceDisplayMessage && messageType === MessageTypes.error);
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import logo from "@axa-fr/design-system-slash-css/dist/common/assets/logo-axa.svg";
2
+ import logo from "@axa-fr/design-system-slash-css/logo-axa.svg";
3
3
  import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.scss";
4
4
  import { forwardRef } from "react";
5
5
  export const Footer = forwardRef(({ className = "af-footer", href = "https://www.axa.fr/", title = "Site Axa", icon = logo, alt = "Logo Axa", children = `© ${new Date().getFullYear()} AXA Tous droits réservés`, ...props }, ref) => (_jsx("footer", { ref: ref, className: className, ...props, children: _jsxs("div", { className: "container-fluid container", children: [Boolean(icon) && (_jsx("a", { className: "af-logo", href: href, title: title, target: "blank", rel: "noopener noreferrer", children: _jsx("img", { className: "af-logo__brand", src: icon, alt: alt }) })), _jsx("div", { className: "af-footer-content", children: children })] }) })));
@@ -6,6 +6,9 @@ import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
6
6
  const defaultClassName = "af-contrat";
7
7
  const Infos = ({ infos, className, classModifier }) => {
8
8
  const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
9
- return (_jsxs("div", { className: componentClassName, children: [_jsx("i", { className: "glyphicon glyphicon-info-sign" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => (_jsxs(Fragment, { children: [_jsx("dt", { className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, children: info.definition })] }, `info-${generateId(info)}`))) })] }));
9
+ return (_jsxs("div", { className: componentClassName, children: [_jsx("i", { className: "glyphicon glyphicon-info-sign" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
10
+ const idTerm = info.id ?? `info-${generateId(info)}`;
11
+ return (_jsxs(Fragment, { children: [_jsx("dt", { id: idTerm, className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, "aria-labelledby": idTerm, children: info.definition })] }, idTerm));
12
+ }) })] }));
10
13
  };
11
14
  export { Infos };
@@ -1,8 +1,11 @@
1
+ import { type ComponentProps } from "react";
2
+ import { NavBar } from "../NavBar";
1
3
  type TMenuTitleWrapperProps = {
2
4
  children: React.ReactNode;
3
5
  menuVisible: boolean;
4
6
  subtitle: string;
5
7
  title: string;
8
+ navBarProps?: Partial<ComponentProps<typeof NavBar>>;
6
9
  };
7
- declare const MenuTitleWrapper: ({ children, menuVisible, subtitle, title, }: TMenuTitleWrapperProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const MenuTitleWrapper: ({ children, menuVisible, subtitle, title, navBarProps, }: TMenuTitleWrapperProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export { MenuTitleWrapper };
@@ -1,14 +1,14 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from "react";
3
- import { NavBar } from "../NavBar";
4
3
  import { HeaderTitle } from "../HeaderTitle/HeaderTitle";
5
- const MenuTitleWrapper = ({ children, menuVisible, subtitle, title, }) => {
4
+ import { NavBar } from "../NavBar";
5
+ const MenuTitleWrapper = ({ children, menuVisible, subtitle, title, navBarProps, }) => {
6
6
  const [isMenuVisible, setIsMenuVisible] = useState(menuVisible);
7
7
  const handleClick = useCallback(() => {
8
8
  const { body } = document;
9
9
  body.classList.toggle("af-menu-open");
10
10
  setIsMenuVisible((prev) => !prev);
11
11
  }, []);
12
- return (_jsxs(_Fragment, { children: [_jsx(NavBar, { isVisible: isMenuVisible, onClick: handleClick, children: children }), _jsx(HeaderTitle, { title: title, subtitle: subtitle, toggleMenu: handleClick })] }));
12
+ return (_jsxs(_Fragment, { children: [_jsx(NavBar, { isVisible: isMenuVisible, onClick: handleClick, ...navBarProps, children: children }), _jsx(HeaderTitle, { title: title, subtitle: subtitle, toggleMenu: handleClick })] }));
13
13
  };
14
14
  export { MenuTitleWrapper };
@@ -28,6 +28,7 @@ const NavBar = ({ positionInit = 0, children, ...otherProps }) => {
28
28
  tabIndex: isCurrent ? 0 : -1,
29
29
  index,
30
30
  hasFocus: isMenuFocused && isCurrent,
31
+ onClick: () => setPosition(index),
31
32
  });
32
33
  }) }));
33
34
  };
@@ -1,8 +1,14 @@
1
1
  import { ComponentProps, ReactElement } from "react";
2
2
  import { NavBarItemBase } from "./NavBarItemBase";
3
+ type ChildrenProps = {
4
+ classModifier?: string;
5
+ tabIndex?: number;
6
+ hasFocus?: boolean;
7
+ [key: string]: unknown;
8
+ };
3
9
  type Props = Omit<ComponentProps<typeof NavBarItemBase>, "handleKeys" | "isMenuOpen" | "position"> & {
4
10
  ariaLabel?: string;
5
- children?: ReactElement | ReactElement[];
11
+ children?: ReactElement<ChildrenProps> | ReactElement<ChildrenProps>[];
6
12
  };
7
13
  declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
8
14
  export { NavBarItem };
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes, KeyboardEvent, ReactElement } from "react";
2
2
  type Props = HTMLAttributes<HTMLLIElement> & {
3
- actionElt: ReactElement;
3
+ actionElt: ReactElement<HTMLAttributes<HTMLElement>>;
4
4
  handleKeys: (event: KeyboardEvent<HTMLLIElement>) => void;
5
5
  hasFocus?: boolean;
6
6
  isMenuOpen?: boolean;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
2
  type Props = {
3
3
  children: ReactNode;
4
4
  idControl: string;
5
5
  };
6
- declare const ToggleButton: ({ children, idControl }: Props) => false | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
6
+ declare const ToggleButton: ({ children, idControl }: Props) => false | ReactElement<HTMLAttributes<HTMLElement>, string | import("react").JSXElementConstructor<any>>;
7
7
  export { ToggleButton };
@@ -1,4 +1,4 @@
1
- import { cloneElement, isValidElement } from "react";
1
+ import { cloneElement, isValidElement, } from "react";
2
2
  const ToggleButton = ({ children, idControl }) => isValidElement(children) &&
3
3
  cloneElement(children, {
4
4
  ...children.props,
@@ -1,7 +1,8 @@
1
1
  export { Header } from "./Header";
2
+ export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
2
3
  export { Infos } from "./Infos/Infos";
4
+ export { MenuTitleWrapper } from "./MenuTitleWrapper/MenuTitleWrapper";
3
5
  export { Name } from "./Name/Name";
4
- export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
6
+ export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
5
7
  export { ToggleButton } from "./ToggleButton/ToggleButton";
6
8
  export { User } from "./User/User";
7
- export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
@@ -1,7 +1,8 @@
1
1
  export { Header } from "./Header";
2
+ export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
2
3
  export { Infos } from "./Infos/Infos";
4
+ export { MenuTitleWrapper } from "./MenuTitleWrapper/MenuTitleWrapper";
3
5
  export { Name } from "./Name/Name";
4
- export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
6
+ export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
5
7
  export { ToggleButton } from "./ToggleButton/ToggleButton";
6
8
  export { User } from "./User/User";
7
- export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
@@ -0,0 +1,10 @@
1
+ import { type ComponentProps, type ElementType, type ReactNode } from "react";
2
+ import "@axa-fr/design-system-slash-css/dist/Link/Link.scss";
3
+ export type LinkProps<C extends ElementType> = {
4
+ component?: C;
5
+ leftIcon?: ReactNode;
6
+ rightIcon?: ReactNode;
7
+ className?: string;
8
+ disabled?: boolean;
9
+ } & ComponentProps<C>;
10
+ export declare const Link: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,8 @@
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classnames from "classnames";
3
+ import { forwardRef, } from "react";
4
+ import "@axa-fr/design-system-slash-css/dist/Link/Link.scss";
5
+ export const Link = forwardRef(({ className, component: Component = "a", leftIcon, rightIcon, target, rel, disabled, children, ...props }, ref) => {
6
+ return (_jsxs(Component, { className: classnames("af-slash-link", className), target: target, rel: target === "_blank" ? "noopener noreferrer" : rel, "aria-disabled": disabled ?? props["aria-disabled"], ...props, ref: ref, children: [leftIcon, children, rightIcon] }));
7
+ });
8
+ Link.displayName = "Link";
@@ -3,7 +3,7 @@ import { forwardRef } from "react";
3
3
  import { getComponentClassName } from "..";
4
4
  const Modal = forwardRef(({ className, title = "", onOutsideTap, children, classModifier, ...props }, ref) => {
5
5
  const componentClassName = getComponentClassName(className, classModifier, "af-modal");
6
- return (_jsx("dialog", { "aria-describedby": title, className: componentClassName, onClick: onOutsideTap, ref: ref, ...props, children: _jsx("div", { className: "af-modal__dialog", onClick: (event) => event.stopPropagation(), children: _jsx("div", { className: "af-modal__content", children: children }) }) }));
6
+ return (_jsx("dialog", { "aria-label": title, className: componentClassName, onClick: onOutsideTap, ref: ref, ...props, children: _jsx("div", { className: "af-modal__dialog", onClick: (event) => event.stopPropagation(), children: _jsx("div", { className: "af-modal__content", children: children }) }) }));
7
7
  });
8
8
  Modal.displayName = "Modal";
9
9
  export { Modal };
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getComponentClassName } from "../utilities";
3
3
  export const HeaderRestitution = ({ title, subtitle, rightTitle, className, classModifier, }) => {
4
4
  const componentClassName = getComponentClassName(className, classModifier, "af-restitution__header");
5
- return (_jsxs("header", { className: componentClassName, children: [_jsx("div", { className: "af-restitution__header-left", children: _jsxs("div", { className: "af-restitution__title", children: [_jsx("span", { className: "af-restitution__title-main", children: title }), subtitle ? (_jsx("span", { className: "af-restitution__title-subtitle", children: subtitle })) : null] }) }), rightTitle ? (_jsx("div", { className: "af-restitution__header-right", children: _jsx("span", { className: "af-restitution__title", children: rightTitle }) })) : null] }));
5
+ return (_jsxs("header", { className: componentClassName, children: [_jsx("div", { className: "af-restitution__header-left", children: _jsxs("h3", { className: "af-restitution__title", children: [_jsx("span", { className: "af-restitution__title-main", children: title }), subtitle ? (_jsx("span", { className: "af-restitution__title-subtitle", children: subtitle })) : null] }) }), rightTitle ? (_jsx("div", { className: "af-restitution__header-right", children: _jsx("span", { className: "af-restitution__title", children: rightTitle }) })) : null] }));
6
6
  };
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getComponentClassName } from "../utilities";
3
3
  export const SectionRestitutionTitle = ({ title, className, classModifier, }) => {
4
4
  const componentClassName = getComponentClassName(className, classModifier, "af-restitution__content-title");
5
- return _jsx("div", { className: componentClassName, children: title });
5
+ return _jsx("h4", { className: componentClassName, children: title });
6
6
  };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Alert } from "../Alert/Alert";
3
+ import { generateId } from "../utilities/helpers/generateId";
3
4
  export const Summary = ({ messages = [], isVisible = true, title = "Invalid form", classModifier = "error", ...args }) => {
4
5
  const messagesNotBlank = messages.filter((message) => Boolean(message));
5
6
  if (!messages || !isVisible || messagesNotBlank.length === 0) {
6
7
  return null;
7
8
  }
8
- return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${message}`))) }) }));
9
+ return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${generateId({ message })}`))) }) }));
9
10
  };
@@ -6,9 +6,10 @@ export type Props = {
6
6
  elementsLabel?: string;
7
7
  items?: number[];
8
8
  numberItems?: number;
9
+ selectAriaLabel?: string;
9
10
  onChange: (e: {
10
11
  value: number;
11
12
  }) => void;
12
13
  };
13
- declare const Items: ({ className, classModifier, onChange, displayLabel, elementsLabel, id, items, numberItems, }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ declare const Items: ({ className, classModifier, onChange, displayLabel, elementsLabel, selectAriaLabel, id, items, numberItems, }: Props) => import("react/jsx-runtime").JSX.Element;
14
15
  export { Items };
@@ -1,13 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
3
  import { getComponentClassName } from "../../utilities";
4
- const Items = ({ className, classModifier, onChange, displayLabel = "Afficher", elementsLabel = "éléments", id, items = [5, 10, 25, 50, 100], numberItems = 10, }) => {
4
+ import { Select } from "../../Form/Select";
5
+ const Items = ({ className, classModifier, onChange, displayLabel = "Afficher", elementsLabel = "éléments", selectAriaLabel = "Modifier le nombre d'éléments à afficher dans le tableau", id, items = [5, 10, 25, 50, 100], numberItems = 10, }) => {
5
6
  const defaultIdName = useId();
6
7
  const newId = id ?? defaultIdName;
7
8
  const componentClassName = getComponentClassName(className, classModifier, "af-paging__form");
8
- return (_jsx("div", { className: "af-paging__limit", children: _jsx("form", { className: componentClassName, children: _jsxs("div", { className: "af-form__group", children: [_jsx("div", { className: "col col-sm-2 col-md-2 col-lg-2 col-xl-2", children: _jsx("label", { className: "af-form__group-label", htmlFor: newId, children: displayLabel }) }), _jsx("div", { className: "col col-sm-10 col-md-10 col-lg-10 col-xl-10", children: _jsxs("div", { className: "af-form__select", children: [_jsxs("div", { className: "af-form__select-container", children: [_jsx("select", { id: newId, className: "af-form__input-select", value: numberItems, onChange: (e) => {
9
- e.preventDefault();
10
- onChange({ value: Number(e.target.value) });
11
- }, children: items.map((item) => (_jsx("option", { value: item, children: item }, item))) }), _jsx("span", { className: "glyphicon glyphicon-menu-down" })] }), _jsx("span", { className: "af-form__input-cmplt", children: elementsLabel })] }) })] }) }) }));
9
+ return (_jsx("div", { className: "af-paging__limit", children: _jsx("form", { className: componentClassName, children: _jsxs("div", { className: "af-form__group", children: [_jsx("div", { className: "col col-sm-2 col-md-2 col-lg-2 col-xl-2", children: _jsx("label", { className: "af-form__group-label", htmlFor: newId, children: displayLabel }) }), _jsxs("div", { className: "col col-sm-10 col-md-10 col-lg-10 col-xl-10", children: [_jsx(Select, { id: newId, value: numberItems, mode: "base", options: items.map((item) => ({
10
+ label: item.toString(),
11
+ value: item.toString(),
12
+ })), onChange: (e) => {
13
+ e.preventDefault();
14
+ onChange({ value: Number(e.target.value) });
15
+ }, "aria-label": selectAriaLabel }), _jsx("span", { className: "af-form__input-cmplt", children: elementsLabel })] })] }) }) }));
12
16
  };
13
17
  export { Items };
@@ -10,5 +10,5 @@ type OnChangePager = (e: {
10
10
  export type Props = Omit<PagingComponentProps, "onChange"> & {
11
11
  onChange?: OnChangePager;
12
12
  };
13
- declare const Paging: ({ className, classModifier, currentPage, displayLabel, elementsLabel, id, mode, nextLabel, numberItems, numberPages, ofLabel, previousLabel, items, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const Paging: ({ className, classModifier, currentPage, displayLabel, selectAriaLabel, elementsLabel, id, mode, nextLabel, numberItems, numberPages, ofLabel, previousLabel, items, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export { Paging };
@@ -4,7 +4,7 @@ import { useCallback } from "react";
4
4
  import { getComponentClassName } from "../..";
5
5
  import { Items } from "./Items";
6
6
  import { Pager } from "./Pager";
7
- const Paging = ({ className, classModifier, currentPage = 1, displayLabel, elementsLabel, id, mode, nextLabel, numberItems = 10, numberPages, ofLabel, previousLabel, items, onChange, }) => {
7
+ const Paging = ({ className, classModifier, currentPage = 1, displayLabel, selectAriaLabel, elementsLabel, id, mode, nextLabel, numberItems = 10, numberPages, ofLabel, previousLabel, items, onChange, }) => {
8
8
  const componentClassName = getComponentClassName(className, classModifier, "af-paging");
9
9
  const handleChangeItems = useCallback((e) => onChange &&
10
10
  onChange({
@@ -16,6 +16,6 @@ const Paging = ({ className, classModifier, currentPage = 1, displayLabel, eleme
16
16
  numberItems,
17
17
  page: e.value,
18
18
  }), [numberItems, onChange]);
19
- return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, elementsLabel: elementsLabel, items: items }) }), _jsx("div", { className: "af-paging__pager", children: _jsx(Pager, { onChange: handleChangePager, currentPage: currentPage, numberPages: numberPages, previousLabel: previousLabel, nextLabel: nextLabel, ofLabel: ofLabel, mode: mode }) })] }));
19
+ return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, selectAriaLabel: selectAriaLabel, elementsLabel: elementsLabel, items: items }) }), _jsx("div", { className: "af-paging__pager", children: _jsx(Pager, { onChange: handleChangePager, currentPage: currentPage, numberPages: numberPages, previousLabel: previousLabel, nextLabel: nextLabel, ofLabel: ofLabel, mode: mode }) })] }));
20
20
  };
21
21
  export { Paging };
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from "react";
1
+ import { type ReactNode, type MouseEvent } from "react";
2
2
  export interface TabsStatelessProps {
3
3
  children: ReactNode;
4
4
  activeIndex: string;
@@ -6,7 +6,7 @@ export interface TabsStatelessProps {
6
6
  classModifier?: string;
7
7
  }
8
8
  export interface TabsStatelessHandlers {
9
- onChange: (event: React.MouseEvent<HTMLButtonElement>, index: string) => void;
9
+ onChange: (event: MouseEvent<HTMLButtonElement>, index: string) => void;
10
10
  }
11
11
  type Props = TabsStatelessProps & TabsStatelessHandlers;
12
12
  declare const TabsStateless: ({ activeIndex, className, classModifier, children, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Children, isValidElement } from "react";
2
+ import { Children, isValidElement, } from "react";
3
3
  import { getComponentClassName } from "../..";
4
4
  import { Pane } from "./Pane";
5
5
  import { Title } from "./Title";
@@ -1,9 +1,11 @@
1
1
  import "@axa-fr/design-system-slash-css/dist/Title/Title.scss";
2
- import { ComponentPropsWithRef, PropsWithChildren } from "react";
2
+ import { ComponentPropsWithRef, PropsWithChildren, ReactElement } from "react";
3
3
  type Headings = "h2" | "h3" | "h4";
4
4
  type TitleProps = ComponentPropsWithRef<"h2"> & {
5
5
  classModifier?: string;
6
6
  heading?: Headings;
7
+ contentLeft?: ReactElement;
8
+ contentRight?: ReactElement;
7
9
  };
8
10
  export declare const Title: import("react").ForwardRefExoticComponent<Omit<PropsWithChildren<TitleProps>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
9
11
  export {};
@@ -1,9 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/Title/Title.scss";
3
- import { forwardRef } from "react";
3
+ import { forwardRef, } from "react";
4
4
  import { getComponentClassName } from "../utilities";
5
- export const Title = forwardRef(({ className, classModifier, children, heading: Heading = "h2", ...otherProps }, ref) => {
6
- const componentClassName = getComponentClassName(className, classModifier, "af-title");
7
- return (_jsx(Heading, { ref: ref, className: componentClassName, ...otherProps, children: children }));
5
+ const baseClass = "af-title";
6
+ export const Title = forwardRef(({ className, classModifier, children, heading: Heading = "h2", contentLeft, contentRight, ...otherProps }, ref) => {
7
+ const componentClassName = getComponentClassName(className, classModifier, baseClass);
8
+ return (_jsxs("div", { className: `${baseClass}--container`, children: [_jsxs(Heading, { ref: ref, className: componentClassName, ...otherProps, children: [children, contentLeft] }), contentRight ? (_jsx("div", { className: "content-right", children: contentRight })) : null] }));
8
9
  });
9
10
  Title.displayName = "Title";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
1
2
  import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
3
+ import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
2
4
  import "@fontsource/source-sans-pro";
3
5
  export { Action } from "./Action/Action";
4
6
  export { Alert } from "./Alert/Alert";
@@ -8,7 +10,7 @@ export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Ch
8
10
  export { Choice, ChoiceInput } from "./Form/Choice";
9
11
  export { Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
10
12
  export { Date, DateInput } from "./Form/Date";
11
- export { File, FileInput, FileTable } from "./Form/File";
13
+ export { File, FileInput, FileTable, type FilePreview } from "./Form/File";
12
14
  export { MultiSelect, MultiSelectInput } from "./Form/MultiSelect";
13
15
  export { Number, NumberInput } from "./Form/Number";
14
16
  export { Pass, PassInput } from "./Form/Pass";
@@ -17,8 +19,10 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
17
19
  export { Slider, SliderInput } from "./Form/Slider";
18
20
  export { Text, TextInput } from "./Form/Text";
19
21
  export { Textarea, TextareaInput } from "./Form/Textarea";
22
+ export { NestedQuestion } from "./Form/NestedQuestion/NestedQuestion";
20
23
  export { Footer } from "./Layout/Footer";
21
- export { Header, HeaderTitle, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
24
+ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
25
+ export { Link, type LinkProps } from "./Link/Link";
22
26
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
23
27
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
24
28
  export { Step, StepBase, Steps } from "./Steps";
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
1
2
  import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
3
+ import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
2
4
  import "@fontsource/source-sans-pro";
3
5
  export { Action } from "./Action/Action";
4
6
  export { Alert } from "./Alert/Alert";
@@ -17,8 +19,10 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
17
19
  export { Slider, SliderInput } from "./Form/Slider";
18
20
  export { Text, TextInput } from "./Form/Text";
19
21
  export { Textarea, TextareaInput } from "./Form/Textarea";
22
+ export { NestedQuestion } from "./Form/NestedQuestion/NestedQuestion";
20
23
  export { Footer } from "./Layout/Footer";
21
- export { Header, HeaderTitle, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
24
+ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
25
+ export { Link } from "./Link/Link";
22
26
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
23
27
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
24
28
  export { Step, StepBase, Steps } from "./Steps";
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-slash-react",
3
- "version": "1.1.1-alpha.2",
3
+ "version": "1.1.1-alpha.204",
4
4
  "description": "",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
5
7
  "exports": {
6
8
  ".": {
7
- "import": "./dist/index.js",
8
- "types": "./dist/index.d.ts"
9
+ "default": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
9
13
  },
10
14
  "./utilities": {
11
- "import": "./dist/utilities.js",
12
- "types": "./dist/utilities.d.ts"
15
+ "default": {
16
+ "import": "./dist/utilities.js",
17
+ "types": "./dist/utilities.d.ts"
18
+ }
13
19
  }
14
20
  },
15
21
  "files": [
@@ -19,18 +25,14 @@
19
25
  "prebuild": "rimraf dist",
20
26
  "build": "tsc -p tsconfig.build.json",
21
27
  "postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
22
- "start:storybook": "storybook dev -p 6007",
23
- "build:storybook": "storybook build",
24
- "build-storybook": "storybook build",
25
28
  "eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
26
29
  "eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
27
- "prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --check",
28
- "prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --write",
29
- "tsc": "tsc --noEmit",
30
+ "prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --check --ignore-unknown",
31
+ "prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --write --ignore-unknown",
32
+ "check-types": "tsc --noEmit",
30
33
  "test": "vitest",
31
34
  "test:ui": "vitest --ui",
32
- "test:ci": "vitest run --coverage",
33
- "chromatic": "npx chromatic"
35
+ "test:ci": "vitest run --coverage"
34
36
  },
35
37
  "repository": {
36
38
  "type": "git",
@@ -45,7 +47,7 @@
45
47
  },
46
48
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
49
  "peerDependencies": {
48
- "@axa-fr/design-system-slash-css": "1.1.1-alpha.2",
50
+ "@axa-fr/design-system-slash-css": "1.1.1-alpha.204",
49
51
  "@material-symbols/svg-400": ">= 0.19.0",
50
52
  "react": ">= 18"
51
53
  },
@@ -55,8 +57,8 @@
55
57
  }
56
58
  },
57
59
  "dependencies": {
58
- "@floating-ui/react": "^0.27.2",
59
- "@fontsource/source-sans-pro": "^5.0.8",
60
+ "@floating-ui/react": "^0.27.8",
61
+ "@fontsource/source-sans-pro": "^5.2.5",
60
62
  "@tanem/svg-injector": "^10.1.68",
61
63
  "classnames": "^2.5.1",
62
64
  "dompurify": "^3.1.5",
@@ -64,12 +66,32 @@
64
66
  "react-dropzone": "^11.5.3",
65
67
  "react-select": "^5.9.0"
66
68
  },
69
+ "devDependencies": {
70
+ "@axa-fr/design-system-slash-css": "*",
71
+ "@axa-fr/eslint-config-design-system": "*",
72
+ "@axa-fr/prettier-config-design-system": "*",
73
+ "@testing-library/dom": "^10.4.0",
74
+ "@testing-library/jest-dom": "^6.6.3",
75
+ "@testing-library/react": "^16.2.0",
76
+ "@testing-library/user-event": "^14.6.1",
77
+ "@types/dompurify": "^3.0.5",
78
+ "@types/jest": "^29.5.14",
79
+ "@types/jest-axe": "^3.5.9",
80
+ "@vitest/coverage-v8": "^3.0.7",
81
+ "@vitest/ui": "^3.0.7",
82
+ "copyfiles": "^2.4.1",
83
+ "jest-axe": "^9.0.0",
84
+ "jsdom": "^25.0.1",
85
+ "react": "^19.0.0",
86
+ "rimraf": "^6.0.1",
87
+ "vitest": "^3.0.7"
88
+ },
67
89
  "lint-staged": {
68
90
  "*.(js|jsx|ts|tsx)": "eslint --fix",
69
- "*.(ts|tsx)": "tsc-files --noEmit",
70
- "*.mdx": "prettier --write"
91
+ "*.(ts|tsx)": "tsc-files --noEmit"
71
92
  },
93
+ "prettier": "@axa-fr/prettier-config-design-system",
72
94
  "volta": {
73
95
  "extends": "../../package.json"
74
96
  }
75
- }
97
+ }