@axa-fr/design-system-slash-react 1.2.1-alpha.8 → 1.2.1-alpha.84

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 (79) hide show
  1. package/dist/Card/Card.d.ts +13 -0
  2. package/dist/Card/Card.js +6 -0
  3. package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
  4. package/dist/Form/Checkbox/CheckboxInput.js +6 -16
  5. package/dist/Form/Checkbox/CheckboxItem.js +3 -1
  6. package/dist/Form/Choice/Choice.d.ts +3 -2
  7. package/dist/Form/Choice/Choice.js +1 -2
  8. package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
  9. package/dist/Form/Choice/ChoiceInput.js +4 -17
  10. package/dist/Form/Date/DateInput.d.ts +6 -42
  11. package/dist/Form/Date/DateInput.js +5 -11
  12. package/dist/Form/File/FileInput.d.ts +4 -5
  13. package/dist/Form/File/FileInput.js +6 -11
  14. package/dist/Form/MultiSelect/MultiSelectInput.d.ts +4 -6
  15. package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
  16. package/dist/Form/Number/NumberInput.d.ts +4 -7
  17. package/dist/Form/Number/NumberInput.js +4 -11
  18. package/dist/Form/Pass/PassInput.d.ts +4 -4
  19. package/dist/Form/Pass/PassInput.js +5 -12
  20. package/dist/Form/Radio/Radio.d.ts +19 -7
  21. package/dist/Form/Radio/Radio.js +13 -4
  22. package/dist/Form/Radio/RadioCardGroup.d.ts +10 -0
  23. package/dist/Form/Radio/RadioCardGroup.js +26 -0
  24. package/dist/Form/Radio/RadioInput.d.ts +5 -43
  25. package/dist/Form/Radio/RadioInput.js +6 -11
  26. package/dist/Form/Select/Select.d.ts +52 -52
  27. package/dist/Form/Select/SelectInput.d.ts +96 -108
  28. package/dist/Form/Select/SelectInput.js +5 -11
  29. package/dist/Form/Slider/Slider.d.ts +3 -0
  30. package/dist/Form/Slider/Slider.js +3 -0
  31. package/dist/Form/Slider/SliderInput.d.ts +7 -6
  32. package/dist/Form/Slider/SliderInput.js +7 -12
  33. package/dist/Form/Text/TextInput.d.ts +3 -5
  34. package/dist/Form/Text/TextInput.js +4 -7
  35. package/dist/Form/Textarea/TextareaInput.d.ts +3 -5
  36. package/dist/Form/Textarea/TextareaInput.js +5 -12
  37. package/dist/Form/core/{LegacyField.d.ts → Deprecated/Field.d.ts} +4 -0
  38. package/dist/Form/core/{LegacyField.js → Deprecated/Field.js} +7 -3
  39. package/dist/Form/core/{FieldForm.d.ts → Deprecated/FieldForm.d.ts} +7 -2
  40. package/dist/Form/core/{FieldForm.js → Deprecated/FieldForm.js} +8 -3
  41. package/dist/Form/core/{FieldInput.d.ts → Deprecated/FieldInput.d.ts} +4 -0
  42. package/dist/Form/core/{FieldInput.js → Deprecated/FieldInput.js} +5 -1
  43. package/dist/Form/core/Field.d.ts +58 -6
  44. package/dist/Form/core/Field.js +23 -10
  45. package/dist/Form/core/FormClassManager.js +4 -1
  46. package/dist/Form/core/HelpMessage.d.ts +2 -1
  47. package/dist/Form/core/HelpMessage.js +1 -1
  48. package/dist/Form/core/index.d.ts +7 -4
  49. package/dist/Form/core/index.js +3 -3
  50. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +16 -0
  51. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +20 -0
  52. package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
  53. package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +7 -2
  54. package/dist/Messages/Message.d.ts +47 -0
  55. package/dist/Messages/Message.js +43 -0
  56. package/dist/ModalAgent/BooleanModal.d.ts +28 -3
  57. package/dist/ModalAgent/BooleanModal.js +1 -1
  58. package/dist/ModalAgent/Modal.d.ts +17 -3
  59. package/dist/ModalAgent/Modal.js +15 -2
  60. package/dist/ModalAgent/components/Header.d.ts +25 -5
  61. package/dist/ModalAgent/components/Header.js +4 -3
  62. package/dist/Steps/StepBase.js +5 -3
  63. package/dist/Steps/VerticalStep.d.ts +16 -0
  64. package/dist/Steps/VerticalStep.js +22 -0
  65. package/dist/Steps/index.d.ts +1 -0
  66. package/dist/Steps/index.js +1 -0
  67. package/dist/Steps/types.d.ts +8 -0
  68. package/dist/Steps/types.js +1 -0
  69. package/dist/Summary/index.d.ts +3 -3
  70. package/dist/Summary/index.js +3 -2
  71. package/dist/Svg/Svg.js +1 -1
  72. package/dist/Table/Pagination/Li.js +1 -4
  73. package/dist/index.d.ts +10 -2
  74. package/dist/index.js +9 -2
  75. package/dist/utilities/helpers/getComponentClassName.d.ts +7 -0
  76. package/dist/utilities/helpers/getComponentClassName.js +14 -0
  77. package/package.json +4 -4
  78. package/dist/Alert/Alert.d.ts +0 -17
  79. package/dist/Alert/Alert.js +0 -14
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Children, cloneElement, isValidElement, useEffect, useRef, useState, } from "react";
3
- import { getComponentClassName } from "../../utilities";
4
- import { FormClassManager } from "./FormClassManager";
5
- import { MessageTypes } from "./MessageTypes";
3
+ import { getComponentClassName } from "../../../utilities";
4
+ import { FormClassManager } from "../FormClassManager";
5
+ import { MessageTypes } from "../MessageTypes";
6
6
  const defaultClassName = "md-10";
7
7
  const INITIAL_STATE = {
8
8
  hasLostFocusOnce: false,
@@ -123,6 +123,11 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
123
123
  }),
124
124
  });
125
125
  });
126
+ /**
127
+ * @deprecated This component is deprecated and will be removed in future versions.
128
+ * This was an internal component used to manage the state of the form fields.
129
+ * It is not recommended to use it directly in your code as it is not a public API.
130
+ */
126
131
  export const FieldForm = ({ children, message = "", messageType = MessageTypes.error, className = defaultClassName, classModifier = "", forceDisplayMessage = false, setStateMemoryFn = setStateMemory, onChangeByStateFn = onChangeByState, setStateOnBlurFn = setStateOnBlur, setStateOnFocusFn = setStateOnFocus, initialState = INITIAL_STATE, }) => {
127
132
  const [state, setState] = useState(initialState);
128
133
  const previousForceDisplayMessage = useRef(forceDisplayMessage);
@@ -5,6 +5,10 @@ type FieldProps = {
5
5
  classModifier?: string;
6
6
  children?: ReactNode;
7
7
  };
8
+ /**
9
+ * @deprecated This component is deprecated and will be removed in future versions.
10
+ * This was an internal component and it is not recommended to use it directly in your code as it is not a public API.
11
+ */
8
12
  export declare const FieldInput: {
9
13
  ({ children, className, classModifier, isVisible, }: FieldProps): import("react/jsx-runtime").JSX.Element | null;
10
14
  displayName: string;
@@ -1,5 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getComponentClassName } from "../../utilities";
2
+ import { getComponentClassName } from "../../../utilities";
3
+ /**
4
+ * @deprecated This component is deprecated and will be removed in future versions.
5
+ * This was an internal component and it is not recommended to use it directly in your code as it is not a public API.
6
+ */
3
7
  export const FieldInput = ({ children, className = "", classModifier = "", isVisible = true, }) => {
4
8
  if (!isVisible) {
5
9
  return null;
@@ -1,12 +1,24 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { MessageTypes } from ".";
3
3
  type InputProps = {
4
+ /**
5
+ * The label of the input element.
6
+ */
4
7
  label: ReactNode;
5
- children?: ReactNode;
8
+ /**
9
+ * The id of the input element. If not provided, a unique id will be generated.
10
+ */
6
11
  id?: string;
12
+ className?: string;
7
13
  classModifier?: string;
8
14
  classNameContainerLabel?: string;
9
15
  classNameContainerInput?: string;
16
+ /**
17
+ * Setting this to false will disable the rendering of the component
18
+ * @default true
19
+ * @deprecated You should handle the visibility of the component in your code
20
+ * instead of using this prop. This prop will be removed in a future version.
21
+ */
10
22
  isVisible?: boolean;
11
23
  roleContainer?: string;
12
24
  ariaLabelContainer?: string;
@@ -17,12 +29,52 @@ type InputProps = {
17
29
  required?: boolean;
18
30
  disabled?: boolean;
19
31
  helpMessage?: ReactNode;
20
- errorId?: string;
21
- };
22
- export declare const Field: ({ classNameContainerInput, classNameContainerLabel, label, forceDisplayMessage, message, messageType, required, classModifier, children, disabled, helpMessage, id, isVisible, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, errorId, renderInput, }: InputProps & {
32
+ /**
33
+ * Sets the position of the label relative to the input.
34
+ * Top will put the label at the top of the input group. This is useful for textarea for example.
35
+ * Center will put the label in the center of the input group, and is used for single line inputs in order to align the label and the input box.
36
+ * @default "center"
37
+ *
38
+ */
39
+ labelPosition?: "top" | "center";
40
+ /**
41
+ * suffix appended to the className of the div wrapping the input
42
+ * @deprecated We should rationalize the CSS for the components to avoid having to use different sufixes
43
+ * but it would be a breaking change to do so, so we keep it for now
44
+ * @example "textarea" will result in
45
+ * ```html
46
+ * <div class="af-form__textarea">
47
+ * // ... input
48
+ * </div>
49
+ * ```
50
+ * @default "text"
51
+ */
52
+ classNameSuffix?: string;
23
53
  renderInput: (props: {
24
54
  id: string;
25
55
  classModifier: string;
26
- }) => ReactNode;
27
- }) => import("react/jsx-runtime").JSX.Element | null;
56
+ errorId?: string;
57
+ ariaInvalid?: boolean;
58
+ } & Record<string, unknown>) => ReactNode;
59
+ /**
60
+ * Elements to be appended to the end of the input group, just before the 2 ending divs
61
+ * @example <Field appendChildren={<Button>Submit</Button>} renderinput={() => <span>hello</span>} />
62
+ * will result in
63
+ * ```html
64
+ * <div class="af-form__text">
65
+ * <span>hello</span>
66
+ * <Button>Submit</Button>
67
+ * </div>
68
+ * ```
69
+ * @optional
70
+ */
71
+ appendChildren?: ReactNode;
72
+ };
73
+ export type ConsumerFieldProps = Omit<InputProps, "renderInput" | "classNameSuffix" | "children"> & {
74
+ /**
75
+ * Element appended right to the input
76
+ */
77
+ rightElement?: ReactNode;
78
+ };
79
+ export declare const Field: ({ classNameContainerInput, classNameContainerLabel, className, label, forceDisplayMessage, message, messageType, required, classModifier, disabled, helpMessage, id, isVisible, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, labelPosition, classNameSuffix, renderInput, appendChildren, ...otherProps }: InputProps) => import("react/jsx-runtime").JSX.Element | null;
28
80
  export {};
@@ -3,23 +3,36 @@ import classNames from "classnames";
3
3
  import { useId } from "react";
4
4
  import { FieldError, FormClassManager, HelpMessage, useInputClassModifier, } from ".";
5
5
  import { getComponentClassName } from "../../utilities";
6
- export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", label, forceDisplayMessage, message, messageType, required, classModifier = "", children, disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, errorId, renderInput, }) => {
6
+ import { useAriaInvalid } from "./useAriaInvalid";
7
+ export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required, classModifier = "", disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", classNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
7
8
  const inputUseId = useId();
8
9
  const inputId = id ?? inputUseId;
9
10
  const actualRequired = required || classModifier.includes("required");
10
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), actualRequired);
11
+ const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
12
+ const errorId = forceDisplayMessage || helpMessage ? `${inputId}-description` : undefined;
13
+ const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, false, actualRequired);
14
+ const labelId = useId();
11
15
  if (!isVisible) {
12
16
  return null;
13
17
  }
14
- const fieldContainerClassName = getComponentClassName("af-form__text", forceDisplayMessage
18
+ const isGroup = roleContainer === "radiogroup" || roleContainer === "group";
19
+ const LabelElement = isGroup ? "div" : "label";
20
+ const modifiers = forceDisplayMessage
15
21
  ? `${inputFieldClassModifier} ${FormClassManager.getModifier(messageType)}`
16
- : inputFieldClassModifier);
17
- return (_jsxs("div", { className: classNames("row af-form__group", {
22
+ : inputFieldClassModifier;
23
+ const fieldContainerClassName = getComponentClassName(`af-form__${classNameSuffix}`, modifiers);
24
+ const groupClassName = getComponentClassName(className, classModifier, "af-form__group");
25
+ return (_jsxs("div", { className: classNames("row", groupClassName, {
18
26
  "af-form__group--required": actualRequired,
19
- }), role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: classNames("af-form__group-label", {
27
+ "af-form__group--label-top": labelPosition === "top",
28
+ }), role: roleContainer, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
20
29
  "af-form__group-label--required": actualRequired,
21
- }), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsxs("div", { className: fieldContainerClassName, children: [renderInput({
22
- id: inputId,
23
- classModifier: inputClassModifier,
24
- }), children] }), forceDisplayMessage ? (_jsx(FieldError, { message: message, messageType: messageType, errorId: errorId })) : (_jsx(HelpMessage, { message: helpMessage }))] })] }));
30
+ }), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, id: labelId, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsx("div", { className: fieldContainerClassName, children: renderInput({
31
+ classModifier: `${inputClassModifier} ${modifiers}`,
32
+ id: inputId,
33
+ errorId,
34
+ disabled,
35
+ ariaInvalid: isInvalid,
36
+ ...otherProps,
37
+ }) }), forceDisplayMessage ? (_jsx(FieldError, { message: message, messageType: messageType, errorId: errorId })) : (_jsx(HelpMessage, { message: helpMessage, id: errorId })), appendChildren] })] }));
25
38
  };
@@ -2,7 +2,7 @@ import { MessageTypes } from "./MessageTypes";
2
2
  const getFieldInputClassModifier = (modifier, disabled) => disabled ? `${modifier} disabled` : modifier;
3
3
  const getInputClassModifier = (modifier, children) => children ? `${modifier} hasinfobulle` : modifier;
4
4
  const getModifier = (messageType) => {
5
- let modifier = "error";
5
+ let modifier = "";
6
6
  switch (messageType) {
7
7
  case MessageTypes.success:
8
8
  modifier = "success";
@@ -10,6 +10,9 @@ const getModifier = (messageType) => {
10
10
  case MessageTypes.warning:
11
11
  modifier = "warning";
12
12
  break;
13
+ case MessageTypes.error:
14
+ modifier = "error";
15
+ break;
13
16
  default:
14
17
  break;
15
18
  }
@@ -2,6 +2,7 @@ import { ReactNode } from "react";
2
2
  type HelpProps = {
3
3
  message?: ReactNode;
4
4
  isVisible?: boolean;
5
+ id?: string;
5
6
  };
6
- export declare const HelpMessage: ({ message, isVisible }: HelpProps) => false | import("react/jsx-runtime").JSX.Element;
7
+ export declare const HelpMessage: ({ message, isVisible, id }: HelpProps) => false | import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- export const HelpMessage = ({ message, isVisible = true }) => isVisible && _jsx("small", { className: "af-form__help", children: message });
2
+ export const HelpMessage = ({ message, isVisible = true, id }) => isVisible && (_jsx("small", { id: id, className: "af-form__help", children: message }));
@@ -1,12 +1,13 @@
1
1
  import { ReactNode } from "react";
2
+ export { LegacyField } from "./Deprecated/Field";
3
+ export { FieldForm } from "./Deprecated/FieldForm";
4
+ export { FieldInput } from "./Deprecated/FieldInput";
2
5
  export { Field } from "./Field";
6
+ export type { ConsumerFieldProps } from "./Field";
3
7
  export { FieldError } from "./FieldError";
4
- export { FieldForm } from "./FieldForm";
5
- export { FieldInput } from "./FieldInput";
6
8
  export { FormClassManager } from "./FormClassManager";
7
9
  export { HelpMessage } from "./HelpMessage";
8
10
  export { InputList } from "./InputList";
9
- export { LegacyField } from "./LegacyField";
10
11
  export { MessageTypes } from "./MessageTypes";
11
12
  export { getFirstId } from "./getFirstId";
12
13
  export { getOptionClassName } from "./getOptionClassName";
@@ -16,9 +17,11 @@ export type Option = {
16
17
  id?: string;
17
18
  icon?: ReactNode;
18
19
  label: ReactNode;
20
+ /**
21
+ * @deprecated Ne semble pas utilisé
22
+ */
19
23
  description?: ReactNode;
20
24
  value: string;
21
- disabled?: boolean;
22
25
  } & React.InputHTMLAttributes<HTMLInputElement>;
23
26
  type BaseFormEvent = {
24
27
  id: string;
@@ -1,11 +1,11 @@
1
+ export { LegacyField } from "./Deprecated/Field";
2
+ export { FieldForm } from "./Deprecated/FieldForm";
3
+ export { FieldInput } from "./Deprecated/FieldInput";
1
4
  export { Field } from "./Field";
2
5
  export { FieldError } from "./FieldError";
3
- export { FieldForm } from "./FieldForm";
4
- export { FieldInput } from "./FieldInput";
5
6
  export { FormClassManager } from "./FormClassManager";
6
7
  export { HelpMessage } from "./HelpMessage";
7
8
  export { InputList } from "./InputList";
8
- export { LegacyField } from "./LegacyField";
9
9
  export { MessageTypes } from "./MessageTypes";
10
10
  export { getFirstId } from "./getFirstId";
11
11
  export { getOptionClassName } from "./getOptionClassName";
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/AnchorNavBar/AnchorNavBar.css";
3
+ export type AnchorNavBarItem = {
4
+ name: string;
5
+ isActive?: boolean;
6
+ onClick?: () => void;
7
+ link?: string;
8
+ externalLink?: boolean;
9
+ render?: (props: {
10
+ className: string;
11
+ }) => ReactNode;
12
+ };
13
+ export type AnchorNavBarProps = {
14
+ items: AnchorNavBarItem[];
15
+ };
16
+ export declare const AnchorNavBar: ({ items }: AnchorNavBarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import externalLinkIcon from "@material-symbols/svg-400/sharp/exit_to_app.svg";
4
+ import { Svg } from "../../../Svg";
5
+ import { Link } from "../../../Link/Link";
6
+ import { linkClassName } from "../../../Link/linkClassName";
7
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/AnchorNavBar/AnchorNavBar.css";
8
+ const defaultClassName = "af-anchor-navbar";
9
+ export const AnchorNavBar = ({ items }) => {
10
+ return (_jsx("nav", { className: defaultClassName, children: _jsx("ul", { children: items.map((item) => {
11
+ if (item.render) {
12
+ return (_jsx("li", { children: _jsx(Link, { render: item.render, className: classNames(`${linkClassName} ${defaultClassName}-link`, {
13
+ [`${defaultClassName}-link--active`]: item.isActive,
14
+ }) }) }, `nav-item-${item.name}`));
15
+ }
16
+ return (_jsx("li", { children: _jsxs(Link, { href: item.link, "aria-current": item.isActive ? "page" : undefined, onClick: item.onClick, className: classNames(`${defaultClassName}-link`, {
17
+ [`${defaultClassName}-link--active`]: item.isActive,
18
+ }), children: [item.name, item.externalLink ? (_jsx(Svg, { role: "presentation", src: externalLinkIcon, className: `${defaultClassName}-external-link-svg` })) : null] }) }, `nav-item-${item.name}`));
19
+ }) }) }));
20
+ };
@@ -1,13 +1,17 @@
1
1
  import { ReactNode } from "react";
2
2
  import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
3
+ import { AnchorNavBarItem } from "../AnchorNavBar/AnchorNavBar";
3
4
  type Props = {
4
5
  children?: ReactNode;
5
6
  classModifier?: string;
6
7
  className?: string;
7
8
  isSticky?: boolean;
9
+ contentLeft?: ReactNode;
10
+ contentRight?: ReactNode;
8
11
  subtitle?: string;
9
12
  title: string;
10
13
  toggleMenu?: () => void;
14
+ anchorNavBarItems?: AnchorNavBarItem[];
11
15
  };
12
- declare const HeaderTitle: ({ children, classModifier, className, isSticky, subtitle, title, toggleMenu, }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ declare const HeaderTitle: ({ children, classModifier, className, isSticky, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }: Props) => import("react/jsx-runtime").JSX.Element;
13
17
  export { HeaderTitle };
@@ -1,12 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
3
+ import classNames from "classnames";
3
4
  import { getComponentClassName } from "../../../utilities";
4
5
  import { ToggleButton } from "../ToggleButton/ToggleButton";
5
6
  import { Action } from "../../../Action/Action";
6
7
  import { getClassModifier } from "./HeaderTitle.helpers";
8
+ import { AnchorNavBar } from "../AnchorNavBar/AnchorNavBar";
7
9
  const defaultClassName = "af-title-bar";
8
- const HeaderTitle = ({ children, classModifier, className, isSticky = true, subtitle, title, toggleMenu, }) => {
10
+ const HeaderTitle = ({ children, classModifier, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
9
11
  const componentClassName = getComponentClassName(className, getClassModifier(classModifier, isSticky), defaultClassName);
10
- return (_jsx("div", { className: componentClassName, children: _jsxs("div", { className: `container ${defaultClassName}__wrapper`, children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle && (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle }))] }), children] }) }));
12
+ const isAnchorNavBarPresent = anchorNavBarItems && anchorNavBarItems.length > 0;
13
+ return (_jsxs("div", { className: classNames(componentClassName, {
14
+ [`${defaultClassName}__shadow`]: isAnchorNavBarPresent,
15
+ }), children: [_jsxs("div", { className: `container ${defaultClassName}__wrapper`, children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("div", { className: `${defaultClassName}__leftSection`, children: [contentLeft, _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle && (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle }))] }), children] }), contentRight && (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight }))] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
11
16
  };
12
17
  export { HeaderTitle };
@@ -0,0 +1,47 @@
1
+ import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
2
+ import { MouseEventHandler, PropsWithChildren, ReactNode } from "react";
3
+ export type MessageVariants = "error" | "warning" | "info" | "success";
4
+ export type MessageProps = {
5
+ /**
6
+ * Content of the message title. Can be a string or a ReactNode.
7
+ */
8
+ title: ReactNode;
9
+ /**
10
+ * URL of an svg icon to display in the sidebar of the message.
11
+ * If not provided, a default icon based on the classModifier will be used.
12
+ * <strong>This not recommended to use</strong>. Only use as an escape hatch.
13
+ */
14
+ icon?: string;
15
+ /**
16
+ * handler for the close button click event.
17
+ * If not provided, the close button will not be displayed.
18
+ */
19
+ onClose?: MouseEventHandler<HTMLButtonElement>;
20
+ /**
21
+ * If you want to add a custom class to the component.
22
+ * @example
23
+ * ```tsx
24
+ * <Message className="my-custom-class" title="My message">
25
+ * ```
26
+ * will produce
27
+ * ```html
28
+ * <div class="my-custom-class af-alert">My message</div>
29
+ */
30
+ className?: string;
31
+ /**
32
+ * @deprecated Use `variant` instead.
33
+ */
34
+ classModifier?: MessageVariants | "danger";
35
+ /**
36
+ * Variant of the message.
37
+ * This will determine the icon and the style of the message.
38
+ */
39
+ variant?: MessageVariants;
40
+ /**
41
+ * Aria label for the close button.
42
+ * This is important for accessibility, use a meaningful label to describe the action.
43
+ * @default "close"
44
+ */
45
+ closeButtonAriaLabel?: string;
46
+ };
47
+ export declare const Message: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: PropsWithChildren<MessageProps>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
3
+ import successSvg from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
4
+ import closeSvg from "@material-symbols/svg-400/outlined/close.svg";
5
+ import errorSvg from "@material-symbols/svg-400/outlined/error-fill.svg";
6
+ import infoSvg from "@material-symbols/svg-400/outlined/info-fill.svg";
7
+ import warningSvg from "@material-symbols/svg-400/outlined/warning-fill.svg";
8
+ import { Svg } from "../Svg";
9
+ import { getComponentClassNameWithUserClassname } from "../utilities/helpers/getComponentClassName";
10
+ const getIconUrl = (type) => {
11
+ switch (type) {
12
+ case "info":
13
+ return infoSvg;
14
+ case "success":
15
+ return successSvg;
16
+ case "error":
17
+ return errorSvg;
18
+ case "warning":
19
+ return warningSvg;
20
+ default:
21
+ return errorSvg;
22
+ }
23
+ };
24
+ const getVariant = (classModifier, variant) => {
25
+ if (variant) {
26
+ return variant;
27
+ }
28
+ if (classModifier) {
29
+ return classModifier === "danger" ? "warning" : classModifier;
30
+ }
31
+ return "error"; // Default variant
32
+ };
33
+ export const Message = ({ className, onClose, icon, title, children, classModifier = "error", variant, // Backward compatibility
34
+ closeButtonAriaLabel = "close", }) => {
35
+ const safeVariant = getVariant(classModifier, variant);
36
+ const componentClassName = getComponentClassNameWithUserClassname({
37
+ componentClassName: "af-alert",
38
+ userClassName: className,
39
+ classModifier: safeVariant,
40
+ });
41
+ const iconSrc = icon ?? getIconUrl(safeVariant);
42
+ return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsx("div", { className: "af-alert__sidebar", children: _jsx("div", { className: "af-alert__indicator", children: _jsx(Svg, { src: iconSrc, className: "af-alert__icon", role: "presentation" }) }) }), _jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__title", children: title }), children] }), onClose ? (_jsx("button", { onClick: onClose, "aria-label": closeButtonAriaLabel, type: "button", className: "af-alert__close-button", children: _jsx(Svg, { src: closeSvg, className: "af-alert__close-icon", role: "presentation" }) })) : null] }));
43
+ };
@@ -1,15 +1,40 @@
1
- import React, { type ReactNode, type Ref } from "react";
1
+ import React, { type ReactNode } from "react";
2
2
  import { type HeaderProps } from "./components/Header";
3
- export type BooleanModalProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & HeaderProps & {
3
+ import { ModalProps } from "./Modal";
4
+ export type BooleanModalProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & Omit<HeaderProps, "children" | "onCancel" | "title"> & Pick<ModalProps, "size"> & {
5
+ /**
6
+ * Title of the modal, displayed in the header.
7
+ * Also used as the `aria-label` of the <dialog> element for accessibility.
8
+ */
9
+ title: string;
10
+ /**
11
+ * Callback function called when the modal is submitted.
12
+ * @param event The event that triggered the submission, can be a mouse click or a keyboard event.
13
+ * @returns void
14
+ */
4
15
  onSubmit: (event: React.MouseEvent | React.KeyboardEvent) => void;
16
+ /**
17
+ * Callback function called when the modal is cancelled.
18
+ * @param event The event that triggered the cancellation, can be a mouse click or a keyboard event.
19
+ * @returns void
20
+ */
5
21
  onCancel: (event: React.MouseEvent | React.KeyboardEvent) => void;
6
22
  id: string;
7
23
  children: ReactNode;
24
+ /**
25
+ * Text content of the submit button.
26
+ */
8
27
  submitTitle?: string;
28
+ /**
29
+ * Text content of the cancel button.
30
+ */
9
31
  cancelTitle?: string;
10
32
  className?: string;
33
+ /**
34
+ * @deprecated Use `size` prop instead.
35
+ * Class modifier for the modal. Can be used to apply custom styles.
36
+ */
11
37
  classModifier?: string;
12
- ref?: Ref<HTMLDialogElement>;
13
38
  };
14
39
  declare const BooleanModal: React.ForwardRefExoticComponent<Omit<BooleanModalProps, "ref"> & React.RefAttributes<HTMLDialogElement>>;
15
40
  export { BooleanModal };
@@ -7,7 +7,7 @@ import { Header } from "./components/Header";
7
7
  const defaultClassName = "af-modal";
8
8
  const BooleanModal = forwardRef(({ children, title, submitTitle = "Valider", cancelTitle = "Annuler", className = defaultClassName, classModifier, onCancel, onSubmit, closeButtonAriaLabel, ...props }, ref) => {
9
9
  const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
10
- return (_jsxs(Modal, { className: componentClassName, onOutsideTap: onCancel, title: title, ref: ref, ...props, children: [_jsx(Header, { title: title, onCancel: onCancel, closeButtonAriaLabel: closeButtonAriaLabel }), _jsx(Body, { children: children }), _jsxs(Footer, { children: [_jsx(Button, { classModifier: "reverse", onClick: onCancel, children: cancelTitle }), _jsx(Button, { onClick: onSubmit, children: submitTitle })] })] }));
10
+ return (_jsxs(Modal, { className: componentClassName, onOutsideTap: onCancel, title: title, ref: ref, ...props, children: [_jsx(Header, { title: title, onCancel: onCancel, closeButtonAriaLabel: closeButtonAriaLabel }), _jsx(Body, { children: children }), _jsxs(Footer, { children: [_jsx(Button, { classModifier: "reverse", onClick: onCancel, children: cancelTitle }), _jsx(Button, { onClick: onSubmit, classModifier: "success", children: submitTitle })] })] }));
11
11
  });
12
12
  BooleanModal.displayName = "BooleanModal";
13
13
  export { BooleanModal };
@@ -1,10 +1,24 @@
1
1
  import { type ReactNode } from "react";
2
2
  export type ModalProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & {
3
- className?: string;
4
- title?: string;
5
- onOutsideTap: (event: React.MouseEvent | React.KeyboardEvent) => void;
3
+ size?: "lg" | "sm";
4
+ /**
5
+ * The content of the modal.
6
+ */
6
7
  children: ReactNode;
8
+ onOutsideTap: (event: React.MouseEvent | React.KeyboardEvent) => void;
9
+ /**
10
+ * `aria-label` of the modal, used for accessibility.
11
+ */
12
+ title?: string;
13
+ className?: string;
14
+ /**
15
+ * @deprecated Use `size` prop instead.
16
+ * Class modifier for the modal. Can be used to apply custom styles.
17
+ */
7
18
  classModifier?: string;
19
+ /**
20
+ * Size of the modal. Overrides classModifier if set
21
+ */
8
22
  ref?: React.Ref<HTMLDialogElement>;
9
23
  };
10
24
  declare const Modal: import("react").ForwardRefExoticComponent<Omit<ModalProps, "ref"> & import("react").RefAttributes<HTMLDialogElement>>;
@@ -1,8 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { getComponentClassName } from "..";
4
- const Modal = forwardRef(({ className, title = "", onOutsideTap, children, classModifier, ...props }, ref) => {
5
- const componentClassName = getComponentClassName(className, classModifier, "af-modal");
4
+ const Modal = forwardRef(({ className, title = "", onOutsideTap, children, classModifier, size, ...props }, ref) => {
5
+ // If size is set to 'lg' or 'sm', use it as the classModifier, otherwise use the provided classModifier
6
+ let effectiveClassModifier;
7
+ if (size) {
8
+ if (classModifier && classModifier !== "lg" && classModifier !== "sm") {
9
+ effectiveClassModifier = `${size} ${classModifier}`;
10
+ }
11
+ else {
12
+ effectiveClassModifier = size;
13
+ }
14
+ }
15
+ else {
16
+ effectiveClassModifier = classModifier;
17
+ }
18
+ const componentClassName = getComponentClassName(className, effectiveClassModifier, "af-modal");
6
19
  return (
7
20
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events
8
21
  _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 }) }) }));
@@ -1,10 +1,30 @@
1
- import type { MouseEventHandler } from "react";
1
+ import type { MouseEventHandler, ReactNode } from "react";
2
2
  export type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
- className?: string;
4
- onCancel: MouseEventHandler<HTMLButtonElement>;
3
+ /**
4
+ * Text displayed in the header.
5
+ * @deprecated Use `children` instead to allow for more flexible content.
6
+ */
5
7
  title?: string;
6
- classModifier?: string;
8
+ /**
9
+ * Text displayed in the header, overrides `title` if both are set.
10
+ */
11
+ children?: ReactNode;
12
+ /**
13
+ * Callback function called when the close button is clicked.
14
+ */
15
+ onCancel: MouseEventHandler<HTMLButtonElement>;
16
+ /**
17
+ * Aria label for the close button, used for accessibility.
18
+ */
7
19
  closeButtonAriaLabel?: string;
20
+ /**
21
+ * Class modifier for the header. Can be used to apply custom styles.
22
+ */
23
+ classModifier?: string;
24
+ /**
25
+ * Prop to override the style of the header. Will totally remove the default styles.
26
+ */
27
+ className?: string;
8
28
  };
9
- declare const Header: ({ className, classModifier, title, closeButtonAriaLabel, onCancel, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
29
+ declare const Header: ({ className, classModifier, title, closeButtonAriaLabel, onCancel, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
10
30
  export { Header };
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getComponentClassName } from "../..";
3
- const Header = ({ className, classModifier, title, closeButtonAriaLabel = "Fermer la boite de dialogue", onCancel, ...props }) => {
2
+ import closeIcon from "@material-symbols/svg-400/outlined/close.svg";
3
+ import { getComponentClassName, Svg } from "../..";
4
+ const Header = ({ className, classModifier, title, closeButtonAriaLabel = "Fermer la boite de dialogue", onCancel, children, ...props }) => {
4
5
  const componentClassName = getComponentClassName(className, classModifier, "af-modal__header");
5
- return (_jsxs("header", { className: componentClassName, ...props, children: [_jsx("h4", { className: "af-modal__header-title", children: title }), _jsx("button", { className: "af-modal__header-close-btn", type: "button", "aria-label": closeButtonAriaLabel, onClick: onCancel, children: _jsx("span", { className: "glyphicon glyphicon-close", "aria-hidden": "true" }) })] }));
6
+ return (_jsxs("header", { className: componentClassName, ...props, children: [_jsx("h4", { className: "af-modal__header-title", children: children ?? title }), _jsx("button", { className: "af-modal__header-close-btn", type: "button", "aria-label": closeButtonAriaLabel, onClick: onCancel, children: _jsx(Svg, { src: closeIcon }) })] }));
6
7
  };
7
8
  export { Header };
@@ -1,7 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getComponentClassName } from "..";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import chevronSvg from "@material-symbols/svg-400/outlined/chevron_right.svg";
3
+ import checkSvg from "@material-symbols/svg-400/outlined/check.svg";
4
+ import { getComponentClassName, Svg } from "..";
3
5
  const StepBase = ({ children, id, title, className, classModifier }) => {
4
6
  const componentClassName = getComponentClassName(className, classModifier, "af-steps-list-step");
5
- return (_jsx("li", { className: componentClassName, title: title, children: children }, id));
7
+ return (_jsxs("li", { className: componentClassName, title: title, children: [_jsx(Svg, { src: checkSvg }), children, _jsx(Svg, { src: chevronSvg })] }, id));
6
8
  };
7
9
  export { StepBase };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ import type { VerticalStepMode } from "./types";
3
+ import "@axa-fr/design-system-slash-css/dist/Steps/VerticalStep.css";
4
+ type Props = {
5
+ title: string;
6
+ id: string;
7
+ stepMode: VerticalStepMode;
8
+ onEdit: React.MouseEventHandler<HTMLButtonElement>;
9
+ form: ReactNode;
10
+ restitution: ReactNode;
11
+ editButtonLabel?: string;
12
+ editButtonAriaLabel?: string;
13
+ showRestitution?: boolean;
14
+ };
15
+ export declare const VerticalStep: ({ title, id, stepMode, editButtonLabel, editButtonAriaLabel, onEdit, form, restitution, showRestitution, }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ export {};