@axa-fr/canopee-react 2.0.0-alpha.74 → 2.0.0-alpha.76

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 (179) hide show
  1. package/dist/distributeur/Accordion/Accordion.d.ts +1 -3
  2. package/dist/distributeur/Accordion/Accordion.js +2 -5
  3. package/dist/distributeur/Accordion/CollapseCard.d.ts +1 -3
  4. package/dist/distributeur/Accordion/CollapseCard.js +2 -4
  5. package/dist/distributeur/Accordion/Header.d.ts +1 -3
  6. package/dist/distributeur/Accordion/Header.js +1 -2
  7. package/dist/distributeur/Action/Action.d.ts +1 -3
  8. package/dist/distributeur/Action/Action.js +2 -3
  9. package/dist/distributeur/Form/Checkbox/Checkbox.d.ts +1 -1
  10. package/dist/distributeur/Form/Checkbox/Checkbox.js +9 -4
  11. package/dist/distributeur/Form/Checkbox/CheckboxInput.js +2 -2
  12. package/dist/distributeur/Form/Checkbox/CheckboxItem.d.ts +1 -3
  13. package/dist/distributeur/Form/Checkbox/CheckboxItem.js +2 -2
  14. package/dist/distributeur/Form/Choice/Choice.d.ts +0 -2
  15. package/dist/distributeur/Form/Choice/ChoiceInput.js +1 -1
  16. package/dist/distributeur/Form/Date/Date.d.ts +2 -3
  17. package/dist/distributeur/Form/Date/Date.js +3 -3
  18. package/dist/distributeur/Form/Date/DateInput.js +1 -1
  19. package/dist/distributeur/Form/File/File.d.ts +1 -3
  20. package/dist/distributeur/Form/File/File.js +1 -2
  21. package/dist/distributeur/Form/File/FileInput.d.ts +3 -1
  22. package/dist/distributeur/Form/File/FileInput.js +2 -2
  23. package/dist/distributeur/Form/File/FileLine.d.ts +1 -2
  24. package/dist/distributeur/Form/File/FileLine.js +6 -3
  25. package/dist/distributeur/Form/File/FileTable.d.ts +1 -2
  26. package/dist/distributeur/Form/File/FileTable.js +6 -3
  27. package/dist/distributeur/Form/MultiSelect/MultiSelectInput.js +1 -1
  28. package/dist/distributeur/Form/NestedQuestion/NestedQuestion.js +7 -3
  29. package/dist/distributeur/Form/Number/Number.d.ts +4 -7
  30. package/dist/distributeur/Form/Number/Number.js +4 -5
  31. package/dist/distributeur/Form/Number/NumberInput.js +1 -1
  32. package/dist/distributeur/Form/Radio/Radio.d.ts +1 -1
  33. package/dist/distributeur/Form/Radio/RadioInput.js +1 -1
  34. package/dist/distributeur/Form/Radio/RadioItem.d.ts +1 -3
  35. package/dist/distributeur/Form/Radio/RadioItem.js +2 -2
  36. package/dist/distributeur/Form/Select/Select.d.ts +3 -19
  37. package/dist/distributeur/Form/Select/Select.js +3 -4
  38. package/dist/distributeur/Form/Select/SelectBase.d.ts +3 -24
  39. package/dist/distributeur/Form/Select/SelectBase.js +2 -7
  40. package/dist/distributeur/Form/Select/SelectDefault.d.ts +3 -3
  41. package/dist/distributeur/Form/Select/SelectInput.js +1 -1
  42. package/dist/distributeur/Form/Select/index.d.ts +0 -1
  43. package/dist/distributeur/Form/Select/index.js +0 -1
  44. package/dist/distributeur/Form/Text/Text.d.ts +2 -3
  45. package/dist/distributeur/Form/Text/Text.js +3 -3
  46. package/dist/distributeur/Form/Text/TextInput.js +1 -1
  47. package/dist/distributeur/Form/Textarea/Textarea.d.ts +2 -3
  48. package/dist/distributeur/Form/Textarea/Textarea.js +3 -3
  49. package/dist/distributeur/Form/Textarea/TextareaInput.js +1 -1
  50. package/dist/distributeur/Form/core/Field.d.ts +4 -23
  51. package/dist/distributeur/Form/core/Field.js +25 -16
  52. package/dist/distributeur/Form/core/FieldError.js +5 -2
  53. package/dist/distributeur/Form/core/getOptionClassName.d.ts +1 -1
  54. package/dist/distributeur/Form/core/getOptionClassName.js +2 -6
  55. package/dist/distributeur/Form/core/index.d.ts +0 -8
  56. package/dist/distributeur/Form/core/index.js +0 -4
  57. package/dist/distributeur/HelpButton/index.d.ts +1 -1
  58. package/dist/distributeur/HelpButton/index.js +4 -6
  59. package/dist/distributeur/Layout/Header/Header.d.ts +1 -3
  60. package/dist/distributeur/Layout/Header/Header.js +1 -2
  61. package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.d.ts +1 -2
  62. package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.js +7 -4
  63. package/dist/distributeur/Layout/Header/Infos/Infos.d.ts +1 -3
  64. package/dist/distributeur/Layout/Header/Infos/Infos.js +1 -2
  65. package/dist/distributeur/Layout/Header/Name/Name.d.ts +1 -3
  66. package/dist/distributeur/Layout/Header/Name/Name.js +1 -2
  67. package/dist/distributeur/Layout/Header/NavBar/NavBar.js +1 -6
  68. package/dist/distributeur/Layout/Header/NavBar/NavBarBase.d.ts +1 -3
  69. package/dist/distributeur/Layout/Header/NavBar/NavBarBase.js +7 -3
  70. package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.d.ts +2 -2
  71. package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.js +10 -3
  72. package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.d.ts +1 -2
  73. package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.js +6 -3
  74. package/dist/distributeur/Layout/Header/User/User.d.ts +1 -11
  75. package/dist/distributeur/Layout/Header/User/User.js +1 -2
  76. package/dist/distributeur/Messages/Message.d.ts +2 -6
  77. package/dist/distributeur/Messages/Message.js +3 -14
  78. package/dist/distributeur/ModalAgent/BooleanModal.d.ts +1 -6
  79. package/dist/distributeur/ModalAgent/BooleanModal.js +7 -4
  80. package/dist/distributeur/ModalAgent/Modal.d.ts +2 -7
  81. package/dist/distributeur/ModalAgent/Modal.js +7 -16
  82. package/dist/distributeur/ModalAgent/components/Body.d.ts +2 -5
  83. package/dist/distributeur/ModalAgent/components/Body.js +1 -2
  84. package/dist/distributeur/ModalAgent/components/Footer.d.ts +2 -5
  85. package/dist/distributeur/ModalAgent/components/Footer.js +1 -2
  86. package/dist/distributeur/ModalAgent/components/Header.d.ts +1 -11
  87. package/dist/distributeur/ModalAgent/components/Header.js +2 -3
  88. package/dist/distributeur/ModalAgent/components/HeaderBase.d.ts +2 -5
  89. package/dist/distributeur/ModalAgent/components/HeaderBase.js +1 -2
  90. package/dist/distributeur/Popover/AnimatedPopover.d.ts +1 -3
  91. package/dist/distributeur/Popover/AnimatedPopover.js +1 -2
  92. package/dist/distributeur/Popover/Popover.d.ts +1 -3
  93. package/dist/distributeur/Popover/Popover.js +2 -2
  94. package/dist/distributeur/Popover/Popover.types.d.ts +0 -2
  95. package/dist/distributeur/Popover/PopoverBase.d.ts +1 -3
  96. package/dist/distributeur/Popover/PopoverBase.js +2 -2
  97. package/dist/distributeur/Popover/PopoverClick.d.ts +1 -1
  98. package/dist/distributeur/Popover/PopoverClick.js +2 -2
  99. package/dist/distributeur/Popover/PopoverOver.d.ts +1 -1
  100. package/dist/distributeur/Popover/PopoverOver.js +2 -2
  101. package/dist/distributeur/Restitution/ArticleRestitution.d.ts +2 -5
  102. package/dist/distributeur/Restitution/ArticleRestitution.js +1 -2
  103. package/dist/distributeur/Restitution/HeaderRestitution.d.ts +1 -3
  104. package/dist/distributeur/Restitution/HeaderRestitution.js +1 -2
  105. package/dist/distributeur/Restitution/Restitution.d.ts +1 -3
  106. package/dist/distributeur/Restitution/Restitution.js +2 -2
  107. package/dist/distributeur/Restitution/SectionRestitution.d.ts +1 -3
  108. package/dist/distributeur/Restitution/SectionRestitution.js +1 -2
  109. package/dist/distributeur/Restitution/SectionRestitutionColumn.d.ts +1 -3
  110. package/dist/distributeur/Restitution/SectionRestitutionColumn.js +1 -2
  111. package/dist/distributeur/Restitution/SectionRestitutionRow.d.ts +1 -3
  112. package/dist/distributeur/Restitution/SectionRestitutionRow.js +5 -9
  113. package/dist/distributeur/Restitution/SectionRestitutionTitle.d.ts +1 -3
  114. package/dist/distributeur/Restitution/SectionRestitutionTitle.js +1 -2
  115. package/dist/distributeur/Steps/Step.d.ts +1 -1
  116. package/dist/distributeur/Steps/Step.js +4 -4
  117. package/dist/distributeur/Steps/StepBase.d.ts +1 -3
  118. package/dist/distributeur/Steps/StepBase.js +1 -2
  119. package/dist/distributeur/Steps/Steps.d.ts +1 -3
  120. package/dist/distributeur/Steps/Steps.js +1 -2
  121. package/dist/distributeur/Summary/index.d.ts +1 -1
  122. package/dist/distributeur/Summary/index.js +1 -2
  123. package/dist/distributeur/Table/Pagination/Items.d.ts +1 -2
  124. package/dist/distributeur/Table/Pagination/Items.js +8 -8
  125. package/dist/distributeur/Table/Pagination/Pager.d.ts +1 -2
  126. package/dist/distributeur/Table/Pagination/Pager.js +6 -3
  127. package/dist/distributeur/Table/Pagination/Paging.d.ts +1 -1
  128. package/dist/distributeur/Table/Pagination/Paging.js +6 -3
  129. package/dist/distributeur/Table/TBody.d.ts +1 -5
  130. package/dist/distributeur/Table/TBody.js +1 -2
  131. package/dist/distributeur/Table/THead.d.ts +2 -5
  132. package/dist/distributeur/Table/THead.js +1 -2
  133. package/dist/distributeur/Table/Table.d.ts +6 -33
  134. package/dist/distributeur/Table/Table.js +1 -10
  135. package/dist/distributeur/Table/Td.d.ts +1 -5
  136. package/dist/distributeur/Table/Td.js +1 -2
  137. package/dist/distributeur/Table/Th.d.ts +2 -4
  138. package/dist/distributeur/Table/Th.js +2 -2
  139. package/dist/distributeur/Table/Tr.d.ts +2 -5
  140. package/dist/distributeur/Table/Tr.js +1 -2
  141. package/dist/distributeur/Table/index.d.ts +1 -1
  142. package/dist/distributeur/Tabs/components/Tab.d.ts +0 -4
  143. package/dist/distributeur/Tabs/components/TabsStateless.d.ts +3 -7
  144. package/dist/distributeur/Tabs/components/TabsStateless.js +2 -2
  145. package/dist/distributeur/Tag/Tag.d.ts +1 -6
  146. package/dist/distributeur/Tag/Tag.js +2 -2
  147. package/dist/distributeur/Title/Title.d.ts +1 -3
  148. package/dist/distributeur/Title/Title.js +2 -2
  149. package/dist/distributeur/utilities.d.ts +1 -1
  150. package/dist/distributeur/utilities.js +1 -1
  151. package/dist/distributeur.d.ts +5 -24
  152. package/dist/distributeur.js +5 -17
  153. package/package.json +2 -2
  154. package/dist/distributeur/Form/Pass/Pass.d.ts +0 -15
  155. package/dist/distributeur/Form/Pass/Pass.js +0 -13
  156. package/dist/distributeur/Form/Pass/PassInput.d.ts +0 -13
  157. package/dist/distributeur/Form/Pass/PassInput.js +0 -34
  158. package/dist/distributeur/Form/Pass/index.d.ts +0 -2
  159. package/dist/distributeur/Form/Pass/index.js +0 -2
  160. package/dist/distributeur/Form/Select/SelectDefaultWithOptions.d.ts +0 -26
  161. package/dist/distributeur/Form/Select/SelectDefaultWithOptions.js +0 -32
  162. package/dist/distributeur/Form/Slider/Slider.d.ts +0 -28
  163. package/dist/distributeur/Form/Slider/Slider.js +0 -40
  164. package/dist/distributeur/Form/Slider/SliderInput.d.ts +0 -9
  165. package/dist/distributeur/Form/Slider/SliderInput.js +0 -11
  166. package/dist/distributeur/Form/Slider/index.d.ts +0 -3
  167. package/dist/distributeur/Form/Slider/index.js +0 -3
  168. package/dist/distributeur/Form/core/Deprecated/Field.d.ts +0 -21
  169. package/dist/distributeur/Form/core/Deprecated/Field.js +0 -20
  170. package/dist/distributeur/Form/core/Deprecated/FieldForm.d.ts +0 -103
  171. package/dist/distributeur/Form/core/Deprecated/FieldForm.js +0 -162
  172. package/dist/distributeur/Form/core/Deprecated/FieldInput.d.ts +0 -16
  173. package/dist/distributeur/Form/core/Deprecated/FieldInput.js +0 -14
  174. package/dist/distributeur/Form/core/useInputClassModifier.d.ts +0 -4
  175. package/dist/distributeur/Form/core/useInputClassModifier.js +0 -13
  176. package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.d.ts +0 -1
  177. package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.js +0 -6
  178. package/dist/distributeur/utilities/helpers/getComponentClassName.d.ts +0 -20
  179. package/dist/distributeur/utilities/helpers/getComponentClassName.js +0 -54
@@ -2,17 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/canopee-css/distributeur/Form/Select/Select.css";
3
3
  import {} from "react";
4
4
  import { getClassName } from "../../utilities/helpers/getClassName";
5
- /**
6
- * @deprecated Use Select instead
7
- */
8
- const SelectBase = ({ options, id, className, classModifier, required, children, ...otherProps }) => {
5
+ const SelectBase = ({ id, className, required, children, ...otherProps }) => {
9
6
  const componentClassName = getClassName({
10
7
  baseClassName: "af-form__input-select",
11
- modifiers: classModifier?.split(" "),
12
8
  className,
13
9
  });
14
- return (_jsxs("div", { className: "af-form__select-container", children: [_jsx("select", { ...otherProps, id: id, className: componentClassName, required: classModifier?.includes("required") || required, children: children ??
15
- options?.map(({ label, ...opt }) => (_jsx("option", { ...opt, children: label }, opt.value?.toString()))) }), _jsx("span", { "aria-controls": id, className: "glyphicon glyphicon-menu-down" })] }));
10
+ return (_jsxs("div", { className: "af-form__select-container", children: [_jsx("select", { ...otherProps, id: id, className: componentClassName, required: required, children: children }), _jsx("span", { "aria-controls": id, className: "glyphicon glyphicon-menu-down" })] }));
16
11
  };
17
12
  SelectBase.displayName = "SelectBase";
18
13
  export { SelectBase };
@@ -1,10 +1,10 @@
1
1
  import { type ComponentPropsWithRef } from "react";
2
2
  import { SelectBase } from "./SelectBase";
3
- type Props = Omit<ComponentPropsWithRef<typeof SelectBase> & {
3
+ type Props = ComponentPropsWithRef<typeof SelectBase> & {
4
4
  forceDisplayPlaceholder?: boolean;
5
5
  placeholder?: string;
6
- children: React.ReactNode;
7
- }, "options">;
6
+ children?: React.ReactNode;
7
+ };
8
8
  declare const SelectDefault: {
9
9
  ({ onChange, forceDisplayPlaceholder, value, defaultValue, required, placeholder, id, children, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
10
10
  displayName: string;
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import {} from "react";
3
3
  import { Field } from "../core";
4
4
  import { Select } from "./Select";
5
- const SelectInput = ({ label, options, children, ...props }) => (_jsx(Field, { label: label, classNameSuffix: "select", ...props, renderInput: ({ classModifier, id, ariaInvalid, errorId, ...otherSelectProps }) => (_jsxs(_Fragment, { children: [_jsx(Select, { id: id, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, options: options, ...otherSelectProps }), children] })) }));
5
+ const SelectInput = ({ label, options, children, ...props }) => (_jsx(Field, { label: label, fieldClassNameSuffix: "select", ...props, renderInput: ({ inputClassName, id, ariaInvalid, errorId, ...otherSelectProps }) => (_jsxs(_Fragment, { children: [_jsx(Select, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...otherSelectProps, children: options.map(({ label: optionLabel, ...option }) => (_jsx("option", { ...option, children: optionLabel }, option.value?.toString()))) }), children] })) }));
6
6
  SelectInput.displayName = "SelectInput";
7
7
  export { SelectInput };
@@ -1,3 +1,2 @@
1
1
  export { Select } from "./Select";
2
- export { SelectBase } from "./SelectBase";
3
2
  export { SelectInput } from "./SelectInput";
@@ -1,3 +1,2 @@
1
1
  export { Select } from "./Select";
2
- export { SelectBase } from "./SelectBase";
3
2
  export { SelectInput } from "./SelectInput";
@@ -1,11 +1,10 @@
1
1
  import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
2
2
  import { type ComponentPropsWithRef } from "react";
3
3
  type Props = ComponentPropsWithRef<"input"> & {
4
- /** @deprecated Use `className` and the native `required` prop instead. */
5
- classModifier?: string;
4
+ hasInfobulle?: boolean;
6
5
  };
7
6
  declare const Text: {
8
- ({ className, classModifier, required, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
7
+ ({ className, required, hasInfobulle, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
9
8
  displayName: string;
10
9
  };
11
10
  export { Text };
@@ -2,13 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
3
3
  import {} from "react";
4
4
  import { getClassName } from "../../utilities/helpers/getClassName";
5
- const Text = ({ className, classModifier, required, ...otherProps }) => {
5
+ const Text = ({ className, required, hasInfobulle, ...otherProps }) => {
6
6
  const componentClassName = getClassName({
7
7
  baseClassName: "af-form__input-text",
8
- modifiers: classModifier?.split(" "),
8
+ modifiers: [hasInfobulle && "hasinfobulle"],
9
9
  className,
10
10
  });
11
- return (_jsx("input", { className: componentClassName, type: "text", required: required || classModifier?.includes("required"), ...otherProps }));
11
+ return (_jsx("input", { className: componentClassName, type: "text", required: required, ...otherProps }));
12
12
  };
13
13
  Text.displayName = "Text";
14
14
  export { Text };
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import {} from "react";
3
3
  import { Field } from "../core";
4
4
  import { Text } from "./Text";
5
- const TextInput = ({ children, ...props }) => (_jsx(Field, { ...props, renderInput: ({ id, classModifier, ariaInvalid, errorId, ...textProps }) => (_jsxs(_Fragment, { children: [_jsx(Text, { id: id, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...textProps }), children] })) }));
5
+ const TextInput = ({ children, ...props }) => (_jsx(Field, { ...props, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...textProps }) => (_jsxs(_Fragment, { children: [_jsx(Text, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...textProps }), children] })) }));
6
6
  TextInput.displayName = "TextInput";
7
7
  export { TextInput };
@@ -1,11 +1,10 @@
1
1
  import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
2
2
  import { type ComponentPropsWithRef } from "react";
3
3
  type Props = ComponentPropsWithRef<"textarea"> & {
4
- /** @deprecated Use `className` and the native `required` prop instead. */
5
- classModifier?: string;
4
+ hasInfobulle?: boolean;
6
5
  };
7
6
  declare const Textarea: {
8
- ({ id, className, classModifier, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
7
+ ({ id, className, required, hasInfobulle, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
9
8
  displayName: string;
10
9
  };
11
10
  export { Textarea };
@@ -2,15 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
3
3
  import { useId } from "react";
4
4
  import { getClassName } from "../../utilities/helpers/getClassName";
5
- const Textarea = ({ id, className, classModifier, ...otherProps }) => {
5
+ const Textarea = ({ id, className, required, hasInfobulle, ...otherProps }) => {
6
6
  const inputUseId = useId();
7
7
  const inputId = id ?? inputUseId;
8
8
  const componentClassName = getClassName({
9
9
  baseClassName: "af-form__input-textarea",
10
- modifiers: classModifier?.split(" "),
10
+ modifiers: [hasInfobulle && "hasinfobulle"],
11
11
  className,
12
12
  });
13
- return (_jsx("textarea", { ...otherProps, id: inputId, className: componentClassName, required: classModifier?.includes("required") }));
13
+ return (_jsx("textarea", { ...otherProps, id: inputId, className: componentClassName, required: required }));
14
14
  };
15
15
  Textarea.displayName = "Textarea";
16
16
  export { Textarea };
@@ -3,6 +3,6 @@ import "@axa-fr/canopee-css/distributeur/Form/Textarea/Textarea.css";
3
3
  import {} from "react";
4
4
  import { Field } from "../core";
5
5
  import { Textarea } from "./Textarea";
6
- const TextareaInput = ({ label, children, ...props }) => (_jsx(Field, { label: label, labelPosition: "top", classNameSuffix: "textarea", ...props, renderInput: ({ id, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Textarea, { id: id, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), children] })) }));
6
+ const TextareaInput = ({ label, children, ...props }) => (_jsx(Field, { label: label, labelPosition: "top", fieldClassNameSuffix: "textarea", ...props, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Textarea, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), children] })) }));
7
7
  TextareaInput.displayName = "TextareaInput";
8
8
  export { TextareaInput };
@@ -10,16 +10,8 @@ type InputProps = {
10
10
  */
11
11
  id?: string;
12
12
  className?: string;
13
- classModifier?: string;
14
13
  classNameContainerLabel?: string;
15
14
  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
- */
22
- isVisible?: boolean;
23
15
  roleContainer?: string;
24
16
  ariaLabelContainer?: string;
25
17
  isLabelContainerLinkedToInput?: boolean;
@@ -28,6 +20,7 @@ type InputProps = {
28
20
  messageType?: MessageTypes;
29
21
  required?: boolean;
30
22
  disabled?: boolean;
23
+ hasInfobulle?: boolean;
31
24
  helpMessage?: ReactNode;
32
25
  /**
33
26
  * Sets the position of the label relative to the input.
@@ -37,22 +30,10 @@ type InputProps = {
37
30
  *
38
31
  */
39
32
  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;
33
+ fieldClassNameSuffix?: string;
53
34
  renderInput: (props: {
54
35
  id: string;
55
- classModifier: string;
36
+ inputClassName: string;
56
37
  errorId?: string;
57
38
  ariaInvalid?: boolean;
58
39
  } & Record<string, unknown>) => ReactNode;
@@ -76,5 +57,5 @@ export type ConsumerFieldProps = Omit<InputProps, "renderInput" | "classNameSuff
76
57
  */
77
58
  children?: ReactNode;
78
59
  };
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;
60
+ export declare const Field: ({ classNameContainerInput, classNameContainerLabel, className, label, forceDisplayMessage, message, messageType, required, disabled, hasInfobulle, helpMessage, id, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, labelPosition, fieldClassNameSuffix, renderInput, appendChildren, ...otherProps }: InputProps) => import("react/jsx-runtime").JSX.Element;
80
61
  export {};
@@ -1,37 +1,46 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
3
  import { useId } from "react";
4
- import { FieldError, FormClassManager, HelpMessage, MessageTypes, useInputClassModifier, } from ".";
5
- import { getComponentClassName } from "../../utilities";
4
+ import { FieldError, FormClassManager, HelpMessage, MessageTypes } from ".";
5
+ import { getClassName } from "../../utilities";
6
6
  import { useAriaInvalid } from "./useAriaInvalid";
7
7
  function isIdDefined(id) {
8
8
  return typeof id === "string" && id.length > 0;
9
9
  }
10
- 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 }) => {
10
+ export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required, disabled = false, hasInfobulle, helpMessage, id, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", fieldClassNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
11
11
  const inputUseId = useId();
12
12
  const inputId = isIdDefined(id) ? id : inputUseId;
13
- const actualRequired = required || classModifier.includes("required");
14
13
  const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
15
14
  const errorId = forceDisplayMessage || helpMessage ? `${inputId}-description` : undefined;
16
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, false, actualRequired);
17
15
  const labelId = useId();
18
- if (!isVisible) {
19
- return null;
20
- }
21
16
  const isGroup = roleContainer === "radiogroup" || roleContainer === "group";
22
17
  const LabelElement = isGroup ? "div" : "label";
23
- const modifiers = forceDisplayMessage
24
- ? `${inputFieldClassModifier} ${FormClassManager.getModifier(messageType)}`
25
- : inputFieldClassModifier;
26
- const fieldContainerClassName = getComponentClassName(`af-form__${classNameSuffix}`, modifiers);
27
- const groupClassName = getComponentClassName(className, classModifier, "af-form__group");
18
+ const fieldModifiers = [
19
+ disabled && "disabled",
20
+ required && "required",
21
+ forceDisplayMessage && FormClassManager.getModifier(messageType),
22
+ ];
23
+ const inputClassName = [
24
+ ...fieldModifiers,
25
+ hasInfobulle && `af-form__input-${fieldClassNameSuffix}--hasinfobulle`,
26
+ ]
27
+ .filter(Boolean)
28
+ .join(" ");
29
+ const fieldContainerClassName = getClassName({
30
+ baseClassName: `af-form__${fieldClassNameSuffix}`,
31
+ modifiers: fieldModifiers,
32
+ });
33
+ const groupClassName = getClassName({
34
+ baseClassName: "af-form__group",
35
+ className,
36
+ });
28
37
  return (_jsxs("div", { className: classNames("row", groupClassName, {
29
- "af-form__group--required": actualRequired,
38
+ "af-form__group--required": required,
30
39
  "af-form__group--label-top": labelPosition === "top",
31
40
  }), role: roleContainer, "aria-invalid": isGroup ? isInvalid : undefined, "aria-required": isGroup ? required : undefined, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, "aria-errormessage": isGroup && isInvalid ? errorId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
32
- "af-form__group-label--required": actualRequired,
41
+ "af-form__group-label--required": required,
33
42
  }), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, id: labelId, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsx("div", { className: fieldContainerClassName, children: renderInput({
34
- classModifier: `${inputClassModifier} ${modifiers}`,
43
+ inputClassName,
35
44
  id: inputId,
36
45
  errorId,
37
46
  disabled,
@@ -1,8 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getComponentClassName } from "../../utilities";
2
+ import { getClassName } from "../../utilities";
3
3
  import { MessageTypes } from "./MessageTypes";
4
4
  const DEFAULT_CLASS_NAME = "af-form__message";
5
5
  export const FieldError = ({ message = null, messageType = MessageTypes.error, errorId = undefined, }) => {
6
- const className = getComponentClassName(DEFAULT_CLASS_NAME, messageType, DEFAULT_CLASS_NAME);
6
+ const className = getClassName({
7
+ baseClassName: DEFAULT_CLASS_NAME,
8
+ modifiers: [messageType],
9
+ });
7
10
  return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { id: errorId, role: "alert", className: `af-form__${messageType}-text`, children: message })] })));
8
11
  };
@@ -1 +1 @@
1
- export declare function getOptionClassName(className: string, classModifier: string, defaultClassName: string, disabled: boolean, variant?: string): string;
1
+ export declare function getOptionClassName(className: string, defaultClassName: string, disabled: boolean, variant?: string): string;
@@ -1,12 +1,8 @@
1
1
  import { getClassName } from "../../utilities/helpers/getClassName";
2
- export function getOptionClassName(className, classModifier, defaultClassName, disabled, variant) {
2
+ export function getOptionClassName(className, defaultClassName, disabled, variant) {
3
3
  return getClassName({
4
4
  baseClassName: className || defaultClassName,
5
- modifiers: [
6
- variant,
7
- ...(classModifier?.split(" ") ?? []),
8
- disabled && "disabled",
9
- ],
5
+ modifiers: [variant, disabled && "disabled"],
10
6
  className,
11
7
  });
12
8
  }
@@ -1,7 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
- export { LegacyField } from "./Deprecated/Field";
3
- export { FieldForm } from "./Deprecated/FieldForm";
4
- export { FieldInput } from "./Deprecated/FieldInput";
5
2
  export { Field } from "./Field";
6
3
  export type { ConsumerFieldProps } from "./Field";
7
4
  export { FieldError } from "./FieldError";
@@ -11,16 +8,11 @@ export { InputList } from "./InputList";
11
8
  export { MessageTypes } from "./MessageTypes";
12
9
  export { getFirstId } from "./getFirstId";
13
10
  export { getOptionClassName } from "./getOptionClassName";
14
- export { useInputClassModifier } from "./useInputClassModifier";
15
11
  export { useOptionsWithId } from "./useOptionsWithId";
16
12
  export type Option = {
17
13
  id?: string;
18
14
  icon?: ReactNode;
19
15
  label: ReactNode;
20
- /**
21
- * @deprecated Ne semble pas utilisé
22
- */
23
- description?: ReactNode;
24
16
  value: string;
25
17
  } & React.InputHTMLAttributes<HTMLInputElement>;
26
18
  type BaseFormEvent = {
@@ -1,6 +1,3 @@
1
- export { LegacyField } from "./Deprecated/Field";
2
- export { FieldForm } from "./Deprecated/FieldForm";
3
- export { FieldInput } from "./Deprecated/FieldInput";
4
1
  export { Field } from "./Field";
5
2
  export { FieldError } from "./FieldError";
6
3
  export { FormClassManager } from "./FormClassManager";
@@ -9,5 +6,4 @@ export { InputList } from "./InputList";
9
6
  export { MessageTypes } from "./MessageTypes";
10
7
  export { getFirstId } from "./getFirstId";
11
8
  export { getOptionClassName } from "./getOptionClassName";
12
- export { useInputClassModifier } from "./useInputClassModifier";
13
9
  export { useOptionsWithId } from "./useOptionsWithId";
@@ -5,5 +5,5 @@ type HelpProps = Omit<ComponentPropsWithoutRef<typeof Popover>, "popoverElement"
5
5
  helpButtonContent?: ReactNode;
6
6
  variant?: "default" | "inverse";
7
7
  };
8
- export declare const HelpButton: ({ className, classModifier, children, mode, placement, variant, helpButtonContent, }: HelpProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const HelpButton: ({ className, children, mode, placement, variant, helpButtonContent, }: HelpProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -5,13 +5,11 @@ import info from "@material-symbols/svg-400/rounded/info_i-fill.svg";
5
5
  import { Popover } from "../Popover";
6
6
  import { getClassName } from "../utilities/helpers/getClassName";
7
7
  import { Svg } from "../Svg";
8
- export const HelpButton = ({ className, classModifier, children, mode = "click", placement = "right", variant = "default", helpButtonContent = _jsx(Svg, { src: info, alt: "Help" }), }) => {
8
+ export const HelpButton = ({ className, children, mode = "click", placement = "right", variant = "default", helpButtonContent = _jsx(Svg, { src: info, alt: "Help" }), }) => {
9
9
  const buttonClassName = classNames("btn", getClassName({
10
10
  baseClassName: "af-btn--circle",
11
- modifiers: [
12
- ...(classModifier?.split(" ") ?? []),
13
- ...(variant === "inverse" ? ["inverse"] : []),
14
- ],
11
+ modifiers: [variant === "inverse" && "inverse"],
12
+ className,
15
13
  }));
16
- return (_jsx(Popover, { className: classNames("af-help-button", className), classModifier: classModifier, placement: placement, mode: mode, popoverElement: children, children: _jsx("div", { className: buttonClassName, children: helpButtonContent }) }));
14
+ return (_jsx(Popover, { className: classNames("af-help-button", className), placement: placement, mode: mode, popoverElement: children, children: _jsx("div", { className: buttonClassName, children: helpButtonContent }) }));
17
15
  };
@@ -2,9 +2,7 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Header.css";
2
2
  import { type ReactNode } from "react";
3
3
  type Props = {
4
4
  children: ReactNode;
5
- /** @deprecated Use `className` instead. */
6
- classModifier?: string;
7
5
  className?: string;
8
6
  };
9
- declare const Header: ({ classModifier, className, children }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const Header: ({ className, children }: Props) => import("react/jsx-runtime").JSX.Element;
10
8
  export { Header };
@@ -4,10 +4,9 @@ import classNames from "classnames";
4
4
  import {} from "react";
5
5
  import { getClassName } from "../../utilities/helpers/getClassName";
6
6
  const defaultClassName = "af-header";
7
- const Header = ({ classModifier, className, children }) => {
7
+ const Header = ({ className, children }) => {
8
8
  const componentClassName = getClassName({
9
9
  baseClassName: defaultClassName,
10
- modifiers: classModifier?.split(" "),
11
10
  className,
12
11
  });
13
12
  return (_jsx("div", { className: classNames("af-container", componentClassName), children: _jsx("header", { className: `${defaultClassName}__content`, role: "banner", children: children }) }));
@@ -3,7 +3,6 @@ import type { ReactNode } from "react";
3
3
  import { type AnchorNavBarItem } from "../AnchorNavBar/AnchorNavBar";
4
4
  type Props = {
5
5
  children?: ReactNode;
6
- classModifier?: string;
7
6
  className?: string;
8
7
  isSticky?: boolean;
9
8
  contentLeft?: ReactNode;
@@ -13,5 +12,5 @@ type Props = {
13
12
  toggleMenu?: () => void;
14
13
  anchorNavBarItems?: AnchorNavBarItem[];
15
14
  };
16
- declare const HeaderTitle: ({ children, classModifier, className, isSticky, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }: Props) => import("react/jsx-runtime").JSX.Element;
15
+ declare const HeaderTitle: ({ children, className, isSticky, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }: Props) => import("react/jsx-runtime").JSX.Element;
17
16
  export { HeaderTitle };
@@ -2,13 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import "@axa-fr/canopee-css/distributeur/Layout/Header/HeaderTitle/HeaderTitle.css";
3
3
  import classNames from "classnames";
4
4
  import { Action } from "../../../Action/Action";
5
- import { getComponentClassName } from "../../../utilities";
5
+ import { getClassName } from "../../../utilities";
6
6
  import { AnchorNavBar, } from "../AnchorNavBar/AnchorNavBar";
7
7
  import { ToggleButton } from "../ToggleButton/ToggleButton";
8
- import { getClassModifier } from "./HeaderTitle.helpers";
9
8
  const defaultClassName = "af-title-bar";
10
- const HeaderTitle = ({ children, classModifier, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
11
- const componentClassName = getComponentClassName(className, getClassModifier(classModifier, isSticky), defaultClassName);
9
+ const HeaderTitle = ({ children, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
10
+ const componentClassName = getClassName({
11
+ baseClassName: defaultClassName,
12
+ modifiers: [isSticky && "sticky"],
13
+ className,
14
+ });
12
15
  const isAnchorNavBarPresent = anchorNavBarItems && anchorNavBarItems.length > 0;
13
16
  return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames("af-container", componentClassName), 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 })) : null] }), children] }), contentRight ? (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight })) : null] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
14
17
  };
@@ -6,10 +6,8 @@ export type TInfo = {
6
6
  word: ReactNode;
7
7
  };
8
8
  type InfosProps = {
9
- /** @deprecated Use `className` instead. */
10
- classModifier?: string;
11
9
  className?: string;
12
10
  infos: TInfo[];
13
11
  };
14
- declare const Infos: ({ infos, className, classModifier }: InfosProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const Infos: ({ infos, className }: InfosProps) => import("react/jsx-runtime").JSX.Element;
15
13
  export { Infos };
@@ -6,10 +6,9 @@ import { getClassName } from "../../../utilities/helpers/getClassName";
6
6
  import "@axa-fr/canopee-css/distributeur/Layout/Header/Infos/Infos.css";
7
7
  import { Svg } from "../../../Svg";
8
8
  const defaultClassName = "af-contrat";
9
- const Infos = ({ infos, className, classModifier }) => {
9
+ const Infos = ({ infos, className }) => {
10
10
  const componentClassName = getClassName({
11
11
  baseClassName: defaultClassName,
12
- modifiers: classModifier?.split(" "),
13
12
  className,
14
13
  });
15
14
  return (_jsxs("div", { className: componentClassName, children: [_jsx(Svg, { className: "af-contrat__icon", src: infoIcon, "aria-hidden": "true" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
@@ -3,8 +3,6 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Name/Name.css";
3
3
  import { type MouseEvent } from "react";
4
4
  type Props = {
5
5
  alt?: string;
6
- /** @deprecated Use `className` instead. */
7
- classModifier?: string;
8
6
  className?: string;
9
7
  img?: string;
10
8
  onClick?: (action: {
@@ -13,5 +11,5 @@ type Props = {
13
11
  subtitle?: string;
14
12
  title: string;
15
13
  };
16
- declare const Name: ({ alt, classModifier, className, img, onClick, subtitle, title, }: Props) => import("react/jsx-runtime").JSX.Element;
14
+ declare const Name: ({ alt, className, img, onClick, subtitle, title, }: Props) => import("react/jsx-runtime").JSX.Element;
17
15
  export { Name };
@@ -4,10 +4,9 @@ import "@axa-fr/canopee-css/distributeur/Layout/Header/Name/Name.css";
4
4
  import {} from "react";
5
5
  import { getClassName } from "../../../utilities/helpers/getClassName";
6
6
  const defaultClassName = "af-header__name";
7
- const Name = ({ alt = "logo", classModifier, className, img, onClick, subtitle, title, }) => {
7
+ const Name = ({ alt = "logo", className, img, onClick, subtitle, title, }) => {
8
8
  const componentClassName = getClassName({
9
9
  baseClassName: defaultClassName,
10
- modifiers: classModifier?.split(" "),
11
10
  className,
12
11
  });
13
12
  return (_jsxs("div", { className: componentClassName, children: [_jsx("a", { className: "af-logo", href: "/", onClick: (event) => onClick && onClick({ event }), children: _jsx("img", { className: "af-logo__brand", src: img, alt: alt }) }), _jsxs("p", { className: "af-header__title", children: [title, _jsx("span", { className: "af-header__subtitle", children: subtitle })] })] }));
@@ -19,12 +19,7 @@ const NavBar = ({ positionInit = 0, children, ...otherProps }) => {
19
19
  const isCurrent = index === position;
20
20
  return React.cloneElement(child, {
21
21
  key: `NavBarItem`,
22
- classModifier: [
23
- child.props.classModifier,
24
- isCurrent ? "active" : undefined,
25
- ]
26
- .filter((c) => Boolean(c))
27
- .join(" "),
22
+ active: isCurrent,
28
23
  tabIndex: isCurrent ? 0 : -1,
29
24
  index,
30
25
  hasFocus: isMenuFocused && isCurrent,
@@ -6,8 +6,6 @@ type Props = {
6
6
  isMenuFocused?: boolean;
7
7
  onClick: (event: MouseEvent<HTMLButtonElement>) => void;
8
8
  className?: string;
9
- /** @deprecated Use `className` instead. */
10
- classModifier?: string;
11
9
  handleKeys: (key: string) => void;
12
10
  onFocus: (action: {
13
11
  e: FocusEvent<HTMLUListElement>;
@@ -17,5 +15,5 @@ type Props = {
17
15
  }) => void;
18
16
  children?: ReactNode;
19
17
  };
20
- declare const NavBarBase: ({ isVisible, onClick, id, toggleMenuId, isMenuFocused, className, classModifier, handleKeys, onFocus, onBlur, children, }: Props) => import("react/jsx-runtime").JSX.Element;
18
+ declare const NavBarBase: ({ onClick, id, toggleMenuId, isMenuFocused, className, handleKeys, onFocus, onBlur, children, isVisible, }: Props) => import("react/jsx-runtime").JSX.Element;
21
19
  export { NavBarBase };
@@ -2,13 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
3
  import { getClassName } from "../../../utilities/helpers/getClassName";
4
4
  const defaultClassName = "af-nav-container";
5
- const NavBarBase = ({ isVisible = true, onClick, id = "mainmenu", toggleMenuId = "togglemenu", isMenuFocused, className, classModifier, handleKeys, onFocus, onBlur, children, }) => {
5
+ const NavBarBase = ({ onClick, id = "mainmenu", toggleMenuId = "togglemenu", isMenuFocused, className, handleKeys, onFocus, onBlur, children, isVisible, }) => {
6
6
  const componentClassName = getClassName({
7
7
  baseClassName: defaultClassName,
8
- modifiers: classModifier?.split(" "),
9
8
  className,
10
9
  });
11
- return (_jsxs("div", { className: classNames("af-container", componentClassName), children: [_jsx("button", { "aria-controls": id, "aria-haspopup": "true", type: "button", onClick: onClick, className: `mask fade ${isVisible ? "show" : ""}`, id: `open-${toggleMenuId}`, "aria-label": "Open Menu" }), _jsxs("nav", { className: `af-nav af-drawer left ${isVisible ? "show" : ""}`, role: "navigation", "aria-label": "Menu principal", children: [_jsxs("div", { className: "af-nav__aside-header", children: [_jsx("h4", { className: "af-nav__aside-title", children: "Menu" }), _jsx("button", { "aria-controls": id, "aria-haspopup": "true", onClick: onClick, type: "button", className: "af-nav__aside-close", id: `close-${toggleMenuId}`, "aria-label": "Close Menu", children: "\u00D7" })] }), _jsx("ul", { onKeyDown: (e) => {
10
+ const navClassName = getClassName({
11
+ baseClassName: "af-nav",
12
+ modifiers: [isVisible && "open"],
13
+ className: "af-drawer left",
14
+ });
15
+ return (_jsxs("div", { className: classNames("af-container", componentClassName), children: [isVisible ? (_jsx("button", { "aria-controls": id, "aria-haspopup": "true", type: "button", onClick: onClick, className: "mask fade", id: `open-${toggleMenuId}`, "aria-label": "Close Menu" })) : null, _jsxs("nav", { className: navClassName, role: "navigation", "aria-label": "Menu principal", children: [_jsxs("div", { className: "af-nav__aside-header", children: [_jsx("h4", { className: "af-nav__aside-title", children: "Menu" }), _jsx("button", { "aria-controls": id, "aria-haspopup": "true", onClick: onClick, type: "button", className: "af-nav__aside-close", id: `close-${toggleMenuId}`, "aria-label": "Close Menu", children: "\u00D7" })] }), _jsx("ul", { onKeyDown: (e) => {
12
16
  e.preventDefault();
13
17
  handleKeys(e.key);
14
18
  }, onFocus: (e) => {
@@ -1,7 +1,6 @@
1
1
  import { type ComponentProps, type ReactElement } from "react";
2
2
  import { NavBarItemBase } from "./NavBarItemBase";
3
3
  type ChildrenProps = {
4
- classModifier?: string;
5
4
  tabIndex?: number;
6
5
  hasFocus?: boolean;
7
6
  [key: string]: unknown;
@@ -9,6 +8,7 @@ type ChildrenProps = {
9
8
  type Props = Omit<ComponentProps<typeof NavBarItemBase>, "handleKeys" | "isMenuOpen" | "position"> & {
10
9
  ariaLabel?: string;
11
10
  children?: ReactElement<ChildrenProps> | ReactElement<ChildrenProps>[];
11
+ active?: boolean;
12
12
  };
13
- declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, active, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export { NavBarItem };
@@ -2,8 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import React, { useCallback, useState, } from "react";
3
3
  import { getPosition } from "../NavBar.helpers";
4
4
  import { NavBarItemBase } from "./NavBarItemBase";
5
+ import { getClassName } from "../../../../utilities";
5
6
  const defaultClassName = "af-nav__item";
6
- const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tabIndex = -1, role = "menuitem", className = defaultClassName, ...otherProps }) => {
7
+ const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tabIndex = -1, role = "menuitem", className, active = false, ...otherProps }) => {
7
8
  const [isMenuOpen, setIsMenuOpen] = useState(false);
8
9
  const [position, setPosition] = useState(0);
9
10
  const moveBykey = useCallback((key) => {
@@ -44,11 +45,17 @@ const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tab
44
45
  }
45
46
  }, [children, isMenuOpen, position, moveBykey, openMenu, closeMenu]);
46
47
  const renderChild = useCallback((child, childIndex) => React.cloneElement(child, {
47
- classModifier: childIndex === position && isMenuOpen ? " active" : undefined,
48
+ className: child.props.className,
49
+ "aria-current": childIndex === position && isMenuOpen ? "page" : undefined,
48
50
  tabIndex: childIndex === position && isMenuOpen ? 0 : -1,
49
51
  key: `child${childIndex}`,
50
52
  hasFocus: hasFocus && position === childIndex && isMenuOpen,
51
53
  }), [position, isMenuOpen, hasFocus]);
52
- return (_jsx(NavBarItemBase, { className: className, role: role, hasFocus: hasFocus, tabIndex: tabIndex, isMenuOpen: isMenuOpen, handleKeys: handleKeys, actionElt: actionElt, ...otherProps, children: children ? (_jsxs(_Fragment, { children: [_jsx("i", { className: "glyphicon glyphicon-arrow-xs-down" }, `icon${tabIndex}`), _jsx("ul", { className: "af-nav__list af-nav__list--children", role: "menu", "aria-label": ariaLabel, children: React.Children.map(children, renderChild) }, `list${tabIndex}`)] })) : null }));
54
+ const componentClassName = getClassName({
55
+ baseClassName: defaultClassName,
56
+ modifiers: [active ? "active" : ""],
57
+ className,
58
+ });
59
+ return (_jsx(NavBarItemBase, { className: componentClassName, role: role, hasFocus: hasFocus, tabIndex: tabIndex, isMenuOpen: isMenuOpen, handleKeys: handleKeys, actionElt: actionElt, ...otherProps, children: children ? (_jsxs(_Fragment, { children: [_jsx("i", { className: "glyphicon glyphicon-arrow-xs-down" }, `icon${tabIndex}`), _jsx("ul", { className: "af-nav__list af-nav__list--children", role: "menu", "aria-label": ariaLabel, children: React.Children.map(children, renderChild) }, `list${tabIndex}`)] })) : null }));
53
60
  };
54
61
  export { NavBarItem };
@@ -4,7 +4,6 @@ type Props = HTMLAttributes<HTMLLIElement> & {
4
4
  handleKeys: (event: KeyboardEvent<HTMLLIElement>) => void;
5
5
  hasFocus?: boolean;
6
6
  isMenuOpen?: boolean;
7
- classModifier?: string;
8
7
  };
9
- export declare const NavBarItemBase: ({ tabIndex, role, children, hasFocus, handleKeys, isMenuOpen, className, classModifier, actionElt, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const NavBarItemBase: ({ tabIndex, role, children, hasFocus, handleKeys, isMenuOpen, className, actionElt, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
10
9
  export {};