@axa-fr/design-system-slash-react 1.2.1-alpha.12 → 1.2.1-alpha.123

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 (126) hide show
  1. package/dist/Button/Button.d.ts +11 -7
  2. package/dist/Button/Button.js +7 -7
  3. package/dist/Card/Card.d.ts +13 -0
  4. package/dist/Card/Card.js +6 -0
  5. package/dist/Divider/Divider.d.ts +7 -0
  6. package/dist/Divider/Divider.js +10 -0
  7. package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
  8. package/dist/Form/Checkbox/CheckboxInput.js +6 -16
  9. package/dist/Form/Checkbox/CheckboxItem.js +3 -1
  10. package/dist/Form/Choice/Choice.d.ts +3 -2
  11. package/dist/Form/Choice/Choice.js +1 -2
  12. package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
  13. package/dist/Form/Choice/ChoiceInput.js +4 -17
  14. package/dist/Form/Date/DateInput.d.ts +6 -42
  15. package/dist/Form/Date/DateInput.js +5 -11
  16. package/dist/Form/File/File.js +1 -1
  17. package/dist/Form/File/FileErrors.js +3 -2
  18. package/dist/Form/File/FileInput.d.ts +4 -5
  19. package/dist/Form/File/FileInput.js +6 -11
  20. package/dist/Form/File/FileTable.js +1 -1
  21. package/dist/Form/MultiSelect/FormatOptionLabel.d.ts +4 -0
  22. package/dist/Form/MultiSelect/FormatOptionLabel.js +12 -0
  23. package/dist/Form/MultiSelect/MultiSelect.d.ts +6 -3
  24. package/dist/Form/MultiSelect/MultiSelect.js +25 -5
  25. package/dist/Form/MultiSelect/MultiSelectInput.d.ts +4 -6
  26. package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
  27. package/dist/Form/MultiSelect/NoOptionsMessage.d.ts +3 -0
  28. package/dist/Form/MultiSelect/NoOptionsMessage.js +1 -0
  29. package/dist/Form/MultiSelect/ValueContainer.d.ts +4 -0
  30. package/dist/Form/MultiSelect/ValueContainer.js +20 -0
  31. package/dist/Form/MultiSelect/useMultiSelectStyle.d.ts +5 -0
  32. package/dist/Form/MultiSelect/useMultiSelectStyle.js +81 -0
  33. package/dist/Form/Number/NumberInput.d.ts +4 -7
  34. package/dist/Form/Number/NumberInput.js +4 -11
  35. package/dist/Form/Pass/PassInput.d.ts +4 -4
  36. package/dist/Form/Pass/PassInput.js +5 -12
  37. package/dist/Form/Radio/Radio.d.ts +19 -7
  38. package/dist/Form/Radio/Radio.js +13 -4
  39. package/dist/Form/Radio/RadioCardGroup.d.ts +10 -0
  40. package/dist/Form/Radio/RadioCardGroup.js +26 -0
  41. package/dist/Form/Radio/RadioInput.d.ts +5 -43
  42. package/dist/Form/Radio/RadioInput.js +6 -11
  43. package/dist/Form/Select/Select.d.ts +52 -52
  44. package/dist/Form/Select/SelectInput.d.ts +96 -108
  45. package/dist/Form/Select/SelectInput.js +5 -11
  46. package/dist/Form/Slider/Slider.d.ts +3 -0
  47. package/dist/Form/Slider/Slider.js +3 -0
  48. package/dist/Form/Slider/SliderInput.d.ts +7 -6
  49. package/dist/Form/Slider/SliderInput.js +7 -12
  50. package/dist/Form/Text/TextInput.d.ts +3 -5
  51. package/dist/Form/Text/TextInput.js +4 -7
  52. package/dist/Form/Textarea/TextareaInput.d.ts +3 -5
  53. package/dist/Form/Textarea/TextareaInput.js +5 -12
  54. package/dist/Form/core/{LegacyField.d.ts → Deprecated/Field.d.ts} +4 -0
  55. package/dist/Form/core/{LegacyField.js → Deprecated/Field.js} +7 -3
  56. package/dist/Form/core/{FieldForm.d.ts → Deprecated/FieldForm.d.ts} +7 -2
  57. package/dist/Form/core/{FieldForm.js → Deprecated/FieldForm.js} +8 -3
  58. package/dist/Form/core/{FieldInput.d.ts → Deprecated/FieldInput.d.ts} +4 -0
  59. package/dist/Form/core/{FieldInput.js → Deprecated/FieldInput.js} +5 -1
  60. package/dist/Form/core/Field.d.ts +58 -6
  61. package/dist/Form/core/Field.js +23 -10
  62. package/dist/Form/core/FormClassManager.js +4 -1
  63. package/dist/Form/core/HelpMessage.d.ts +2 -1
  64. package/dist/Form/core/HelpMessage.js +1 -1
  65. package/dist/Form/core/index.d.ts +7 -4
  66. package/dist/Form/core/index.js +3 -3
  67. package/dist/Layout/Footer/Footer.d.ts +2 -1
  68. package/dist/Layout/Footer/Footer.js +4 -2
  69. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +39 -0
  70. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +21 -0
  71. package/dist/Layout/Header/Header.js +2 -1
  72. package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
  73. package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +8 -3
  74. package/dist/Layout/Header/Infos/Infos.js +3 -1
  75. package/dist/Layout/Header/NavBar/NavBarBase.js +9 -8
  76. package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.js +1 -1
  77. package/dist/Layout/Header/NavBar/index.d.ts +1 -0
  78. package/dist/Layout/Header/NavBar/index.js +1 -0
  79. package/dist/Layout/Header/User/InnerUser.js +1 -1
  80. package/dist/Layout/MainContainer/MainContainer.d.ts +6 -0
  81. package/dist/Layout/MainContainer/MainContainer.js +4 -0
  82. package/dist/Link/Link.d.ts +1 -1
  83. package/dist/Link/Link.js +1 -1
  84. package/dist/Link/LinkAnchor.d.ts +5 -3
  85. package/dist/Link/LinkAnchor.js +5 -3
  86. package/dist/Loader/Loader.js +1 -1
  87. package/dist/Messages/Message.d.ts +47 -0
  88. package/dist/Messages/Message.js +43 -0
  89. package/dist/ModalAgent/BooleanModal.d.ts +28 -3
  90. package/dist/ModalAgent/BooleanModal.js +1 -1
  91. package/dist/ModalAgent/Modal.d.ts +17 -3
  92. package/dist/ModalAgent/Modal.js +15 -2
  93. package/dist/ModalAgent/components/Header.d.ts +25 -5
  94. package/dist/ModalAgent/components/Header.js +4 -3
  95. package/dist/Popover/AnimatedPopover.js +1 -1
  96. package/dist/Steps/StepBase.js +5 -3
  97. package/dist/Steps/VerticalStep.d.ts +48 -0
  98. package/dist/Steps/VerticalStep.js +22 -0
  99. package/dist/Steps/index.d.ts +1 -0
  100. package/dist/Steps/index.js +1 -0
  101. package/dist/Steps/types.d.ts +8 -0
  102. package/dist/Steps/types.js +1 -0
  103. package/dist/Summary/index.d.ts +3 -3
  104. package/dist/Summary/index.js +3 -2
  105. package/dist/Svg/Svg.js +1 -1
  106. package/dist/Table/Pagination/Items.d.ts +1 -1
  107. package/dist/Table/Pagination/Li.d.ts +2 -1
  108. package/dist/Table/Pagination/Li.js +2 -5
  109. package/dist/Table/Pagination/Pager.d.ts +5 -1
  110. package/dist/Table/Pagination/Pager.js +3 -3
  111. package/dist/Table/Pagination/PaginationButton.d.ts +2 -1
  112. package/dist/Table/Pagination/PaginationButton.js +2 -2
  113. package/dist/Table/Pagination/Paging.d.ts +2 -1
  114. package/dist/Table/Pagination/Paging.js +2 -2
  115. package/dist/Tag/Tag.d.ts +29 -0
  116. package/dist/Tag/Tag.js +27 -0
  117. package/dist/Title/Title.d.ts +2 -2
  118. package/dist/index.d.ts +21 -3
  119. package/dist/index.js +16 -3
  120. package/dist/utilities/helpers/getComponentClassName.d.ts +15 -0
  121. package/dist/utilities/helpers/getComponentClassName.js +22 -0
  122. package/package.json +6 -5
  123. package/dist/Alert/Alert.d.ts +0 -17
  124. package/dist/Alert/Alert.js +0 -14
  125. package/dist/Badge/Badge.d.ts +0 -8
  126. package/dist/Badge/Badge.js +0 -9
@@ -1,29 +1,8 @@
1
- import { OptionHTMLAttributes, ReactNode } from "react";
1
+ import { OptionHTMLAttributes } from "react";
2
2
  declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<{
3
- message?: string;
4
- messageType?: import("../core").MessageTypes;
5
- } & {
6
- className?: string;
7
- classModifier?: string;
8
- forceDisplayMessage?: boolean;
9
- children: ReactNode;
10
- setStateMemoryFn?: typeof import("../core/FieldForm").setStateMemory;
11
- onChangeByStateFn?: typeof import("../core/FieldForm").onChangeByState;
12
- setStateOnBlurFn?: typeof import("../core/FieldForm").setStateOnBlur;
13
- setStateOnFocusFn?: typeof import("../core/FieldForm").setStateOnFocus;
14
- initialState?: {
15
- hasLostFocusOnce: boolean;
16
- hasFocus: boolean;
17
- hasChange: boolean;
18
- memory: {
19
- message?: string;
20
- messageType?: import("../core").MessageTypes;
21
- };
22
- };
23
- }, "children"> & {
24
- label: ReactNode;
25
- children?: ReactNode;
3
+ label: import("react").ReactNode;
26
4
  id?: string;
5
+ className?: string;
27
6
  classModifier?: string;
28
7
  classNameContainerLabel?: string;
29
8
  classNameContainerInput?: string;
@@ -31,64 +10,33 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
31
10
  roleContainer?: string;
32
11
  ariaLabelContainer?: string;
33
12
  isLabelContainerLinkedToInput?: boolean;
34
- errorId?: string;
13
+ forceDisplayMessage?: boolean;
14
+ message?: string;
15
+ messageType?: import("../core").MessageTypes;
16
+ required?: boolean;
17
+ disabled?: boolean;
18
+ helpMessage?: import("react").ReactNode;
19
+ labelPosition?: "top" | "center";
20
+ classNameSuffix?: string;
21
+ renderInput: (props: {
22
+ id: string;
23
+ classModifier: string;
24
+ errorId?: string;
25
+ ariaInvalid?: boolean;
26
+ } & Record<string, unknown>) => import("react").ReactNode;
27
+ appendChildren?: import("react").ReactNode;
28
+ }, "children" | "renderInput" | "classNameSuffix"> & {
29
+ rightElement?: import("react").ReactNode;
35
30
  } & Omit<Omit<{
36
- form?: string | undefined | undefined;
37
- slot?: string | undefined | undefined;
38
- style?: import("react").CSSProperties | undefined;
39
- title?: string | undefined | undefined;
40
- ref?: import("react").Ref<HTMLSelectElement> | undefined;
41
- key?: import("react").Key | null | undefined;
42
- defaultChecked?: boolean | undefined | undefined;
43
- defaultValue?: string | number | readonly string[] | undefined;
44
- suppressContentEditableWarning?: boolean | undefined | undefined;
45
31
  suppressHydrationWarning?: boolean | undefined | undefined;
46
- accessKey?: string | undefined | undefined;
47
- autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
48
- autoFocus?: boolean | undefined | undefined;
49
32
  className?: string | undefined | undefined;
50
- contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
51
- contextMenu?: string | undefined | undefined;
52
- dir?: string | undefined | undefined;
53
- draggable?: (boolean | "true" | "false") | undefined;
54
- enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
55
- hidden?: boolean | undefined | undefined;
33
+ color?: string | undefined | undefined;
56
34
  id?: string | undefined | undefined;
57
35
  lang?: string | undefined | undefined;
58
- nonce?: string | undefined | undefined;
59
- spellCheck?: (boolean | "true" | "false") | undefined;
60
- tabIndex?: number | undefined | undefined;
61
- translate?: "yes" | "no" | undefined | undefined;
62
- radioGroup?: string | undefined | undefined;
36
+ name?: string | undefined | undefined;
37
+ style?: import("react").CSSProperties | undefined;
63
38
  role?: import("react").AriaRole | undefined;
64
- about?: string | undefined | undefined;
65
- content?: string | undefined | undefined;
66
- datatype?: string | undefined | undefined;
67
- inlist?: any;
68
- prefix?: string | undefined | undefined;
69
- property?: string | undefined | undefined;
70
- rel?: string | undefined | undefined;
71
- resource?: string | undefined | undefined;
72
- rev?: string | undefined | undefined;
73
- typeof?: string | undefined | undefined;
74
- vocab?: string | undefined | undefined;
75
- autoCorrect?: string | undefined | undefined;
76
- autoSave?: string | undefined | undefined;
77
- color?: string | undefined | undefined;
78
- itemProp?: string | undefined | undefined;
79
- itemScope?: boolean | undefined | undefined;
80
- itemType?: string | undefined | undefined;
81
- itemID?: string | undefined | undefined;
82
- itemRef?: string | undefined | undefined;
83
- results?: number | undefined | undefined;
84
- security?: string | undefined | undefined;
85
- unselectable?: "on" | "off" | undefined | undefined;
86
- popover?: "" | "auto" | "manual" | undefined | undefined;
87
- popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
88
- popoverTarget?: string | undefined | undefined;
89
- inert?: boolean | undefined | undefined;
90
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
91
- is?: string | undefined | undefined;
39
+ tabIndex?: number | undefined | undefined;
92
40
  "aria-activedescendant"?: string | undefined | undefined;
93
41
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
94
42
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
@@ -142,7 +90,7 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
142
90
  "aria-valuemin"?: number | undefined | undefined;
143
91
  "aria-valuenow"?: number | undefined | undefined;
144
92
  "aria-valuetext"?: string | undefined | undefined;
145
- children: ReactNode | undefined;
93
+ children: import("react").ReactNode | undefined;
146
94
  dangerouslySetInnerHTML?: {
147
95
  __html: string | TrustedHTML;
148
96
  } | undefined | undefined;
@@ -314,9 +262,56 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
314
262
  onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
315
263
  onTransitionStart?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
316
264
  onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
265
+ ref?: import("react").Ref<HTMLSelectElement> | undefined;
266
+ form?: string | undefined | undefined;
267
+ slot?: string | undefined | undefined;
268
+ title?: string | undefined | undefined;
269
+ dir?: string | undefined | undefined;
317
270
  classModifier?: string | undefined;
271
+ key?: import("react").Key | null | undefined;
272
+ defaultChecked?: boolean | undefined | undefined;
273
+ defaultValue?: string | number | readonly string[] | undefined;
274
+ suppressContentEditableWarning?: boolean | undefined | undefined;
275
+ accessKey?: string | undefined | undefined;
276
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
277
+ autoFocus?: boolean | undefined | undefined;
278
+ contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
279
+ contextMenu?: string | undefined | undefined;
280
+ draggable?: (boolean | "true" | "false") | undefined;
281
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
282
+ hidden?: boolean | undefined | undefined;
283
+ nonce?: string | undefined | undefined;
284
+ spellCheck?: (boolean | "true" | "false") | undefined;
285
+ translate?: "yes" | "no" | undefined | undefined;
286
+ radioGroup?: string | undefined | undefined;
287
+ about?: string | undefined | undefined;
288
+ content?: string | undefined | undefined;
289
+ datatype?: string | undefined | undefined;
290
+ inlist?: any;
291
+ prefix?: string | undefined | undefined;
292
+ property?: string | undefined | undefined;
293
+ rel?: string | undefined | undefined;
294
+ resource?: string | undefined | undefined;
295
+ rev?: string | undefined | undefined;
296
+ typeof?: string | undefined | undefined;
297
+ vocab?: string | undefined | undefined;
298
+ autoCorrect?: string | undefined | undefined;
299
+ autoSave?: string | undefined | undefined;
300
+ itemProp?: string | undefined | undefined;
301
+ itemScope?: boolean | undefined | undefined;
302
+ itemType?: string | undefined | undefined;
303
+ itemID?: string | undefined | undefined;
304
+ itemRef?: string | undefined | undefined;
305
+ results?: number | undefined | undefined;
306
+ security?: string | undefined | undefined;
307
+ unselectable?: "on" | "off" | undefined | undefined;
308
+ popover?: "" | "auto" | "manual" | undefined | undefined;
309
+ popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
310
+ popoverTarget?: string | undefined | undefined;
311
+ inert?: boolean | undefined | undefined;
312
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
313
+ is?: string | undefined | undefined;
318
314
  disabled?: boolean | undefined | undefined;
319
- name?: string | undefined | undefined;
320
315
  value?: string | number | readonly string[] | undefined;
321
316
  required?: boolean | undefined | undefined;
322
317
  autoComplete?: string | undefined | undefined;
@@ -328,37 +323,15 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
328
323
  options?: OptionHTMLAttributes<HTMLOptionElement>[];
329
324
  mode?: "default" | "base";
330
325
  } & {
331
- children?: ReactNode | undefined;
326
+ children?: import("react").ReactNode | undefined;
332
327
  }, "ref"> & import("react").RefAttributes<HTMLSelectElement> & {
333
- helpMessage?: ReactNode;
334
328
  options: OptionHTMLAttributes<HTMLOptionElement>[];
335
329
  } & {
336
- children?: ReactNode | undefined;
330
+ children?: import("react").ReactNode | undefined;
337
331
  }, "ref"> | Omit<Omit<{
338
- message?: string;
339
- messageType?: import("../core").MessageTypes;
340
- } & {
341
- className?: string;
342
- classModifier?: string;
343
- forceDisplayMessage?: boolean;
344
- children: ReactNode;
345
- setStateMemoryFn?: typeof import("../core/FieldForm").setStateMemory;
346
- onChangeByStateFn?: typeof import("../core/FieldForm").onChangeByState;
347
- setStateOnBlurFn?: typeof import("../core/FieldForm").setStateOnBlur;
348
- setStateOnFocusFn?: typeof import("../core/FieldForm").setStateOnFocus;
349
- initialState?: {
350
- hasLostFocusOnce: boolean;
351
- hasFocus: boolean;
352
- hasChange: boolean;
353
- memory: {
354
- message?: string;
355
- messageType?: import("../core").MessageTypes;
356
- };
357
- };
358
- }, "children"> & {
359
- label: ReactNode;
360
- children?: ReactNode;
332
+ label: import("react").ReactNode;
361
333
  id?: string;
334
+ className?: string;
362
335
  classModifier?: string;
363
336
  classNameContainerLabel?: string;
364
337
  classNameContainerInput?: string;
@@ -366,7 +339,23 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
366
339
  roleContainer?: string;
367
340
  ariaLabelContainer?: string;
368
341
  isLabelContainerLinkedToInput?: boolean;
369
- errorId?: string;
342
+ forceDisplayMessage?: boolean;
343
+ message?: string;
344
+ messageType?: import("../core").MessageTypes;
345
+ required?: boolean;
346
+ disabled?: boolean;
347
+ helpMessage?: import("react").ReactNode;
348
+ labelPosition?: "top" | "center";
349
+ classNameSuffix?: string;
350
+ renderInput: (props: {
351
+ id: string;
352
+ classModifier: string;
353
+ errorId?: string;
354
+ ariaInvalid?: boolean;
355
+ } & Record<string, unknown>) => import("react").ReactNode;
356
+ appendChildren?: import("react").ReactNode;
357
+ }, "children" | "renderInput" | "classNameSuffix"> & {
358
+ rightElement?: import("react").ReactNode;
370
359
  } & Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "ref"> & {
371
360
  options?: OptionHTMLAttributes<HTMLOptionElement>[];
372
361
  classModifier?: string;
@@ -378,11 +367,10 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
378
367
  options?: OptionHTMLAttributes<HTMLOptionElement>[];
379
368
  mode?: "default" | "base";
380
369
  } & {
381
- children?: ReactNode | undefined;
370
+ children?: import("react").ReactNode | undefined;
382
371
  }, "ref"> & import("react").RefAttributes<HTMLSelectElement> & {
383
- helpMessage?: ReactNode;
384
372
  options: OptionHTMLAttributes<HTMLOptionElement>[];
385
373
  } & {
386
- children?: ReactNode | undefined;
374
+ children?: import("react").ReactNode | undefined;
387
375
  }, "ref">) & import("react").RefAttributes<HTMLSelectElement>>;
388
376
  export { SelectInput };
@@ -1,15 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useId, } from "react";
3
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, } from "react";
3
+ import { Field } from "../core";
4
4
  import { Select } from "./Select";
5
- import { useAriaInvalid } from "../core/useAriaInvalid";
6
- const SelectInput = forwardRef(({ classModifier = "", message, children, helpMessage, id, disabled = false, label, classNameContainerLabel, classNameContainerInput, messageType, isVisible, forceDisplayMessage, className, required, ...otherSelectProps }, inputRef) => {
7
- const generatedId = useId();
8
- const errorUseId = useId();
9
- const inputId = id ?? generatedId;
10
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
11
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
12
- return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__select", classModifier: inputFieldClassModifier, children: [_jsx(Select, { id: inputId, disabled: disabled, classModifier: inputClassModifier, ref: inputRef, required: required, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherSelectProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
5
+ const SelectInput = forwardRef(({ label, options, ...props }, inputRef) => {
6
+ return (_jsx(Field, { label: label, classNameSuffix: "select", ...props, renderInput: ({ classModifier, id, ariaInvalid, errorId, ...otherSelectProps }) => (_jsx(Select, { id: id, ref: inputRef, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, options: options, ...otherSelectProps })) }));
13
7
  });
14
8
  SelectInput.displayName = "SelectInput";
15
9
  export { SelectInput };
@@ -20,5 +20,8 @@ type Props = Omit<RcSliderProps, "marks" | "onChange" | "onChangeComplete"> & {
20
20
  value: number;
21
21
  }) => void;
22
22
  };
23
+ /**
24
+ * @deprecated Slider is deprecated and will be removed in a future major release.
25
+ */
23
26
  declare const Slider: ({ options, value, defaultValue, className, classModifier, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
24
27
  export { Slider };
@@ -2,6 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import RcSlider from "rc-slider";
3
3
  import { useCallback, useMemo, } from "react";
4
4
  import { getComponentClassName } from "../../utilities";
5
+ /**
6
+ * @deprecated Slider is deprecated and will be removed in a future major release.
7
+ */
5
8
  const Slider = ({ options, value, defaultValue, className, classModifier, ...otherProps }) => {
6
9
  const defaultValueIndex = useMemo(() => {
7
10
  const newDefaultValueIndex = options.findIndex((opt) => opt.value === (defaultValue || value));
@@ -1,8 +1,9 @@
1
- import { type ComponentProps, type ReactNode } from "react";
2
- import { LegacyField } from "../core";
1
+ import { type ComponentProps } from "react";
2
+ import { ConsumerFieldProps } from "../core";
3
3
  import { Slider } from "./Slider";
4
- type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof Slider> & {
5
- helpMessage?: ReactNode;
6
- };
7
- declare const SliderInput: ({ id, children, helpMessage, message, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, classModifier, ...sliderProps }: Props) => import("react/jsx-runtime").JSX.Element;
4
+ type Props = Omit<ConsumerFieldProps & ComponentProps<typeof Slider>, "children">;
5
+ /**
6
+ * @deprecated This component is deprecated and will be removed in a future major release.
7
+ */
8
+ declare const SliderInput: ({ rightElement, name, options, label, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
8
9
  export { SliderInput };
@@ -1,15 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, useMemo } from "react";
3
- import { HelpMessage, LegacyField } from "../core";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Field } from "../core";
4
3
  import { Slider } from "./Slider";
5
- const SliderInput = ({ id, children, helpMessage, message, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, classModifier, ...sliderProps }) => {
6
- const generatedId = useId();
7
- const newId = useMemo(() => {
8
- if (id) {
9
- return id;
10
- }
11
- return generatedId;
12
- }, [generatedId, id]);
13
- return (_jsxs(LegacyField, { id: newId, label: label, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: classModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsx(Slider, { ...sliderProps, id: id, classModifier: classModifier }), children, _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
4
+ /**
5
+ * @deprecated This component is deprecated and will be removed in a future major release.
6
+ */
7
+ const SliderInput = ({ rightElement, name, options, label, ...props }) => {
8
+ return (_jsx(Field, { label: label, ...props, renderInput: ({ id, classModifier, ...sliderProps }) => (_jsxs(_Fragment, { children: [_jsx(Slider, { id: id, classModifier: classModifier, name: name, options: options, ...sliderProps }), rightElement] })) }));
14
9
  };
15
10
  export { SliderInput };
@@ -1,8 +1,6 @@
1
- import { ComponentProps, ReactNode } from "react";
2
- import { Field } from "../core";
1
+ import { ComponentProps } from "react";
2
+ import { ConsumerFieldProps } from "../core";
3
3
  import { Text } from "./Text";
4
- export type TextInputProps = Omit<ComponentProps<typeof Field> & ComponentProps<typeof Text> & {
5
- helpMessage?: ReactNode;
6
- }, "renderInput">;
4
+ export type TextInputProps = Omit<ConsumerFieldProps & ComponentProps<typeof Text>, "children">;
7
5
  declare const TextInput: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
8
6
  export { TextInput };
@@ -1,12 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useId } from "react";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
3
  import { Field } from "../core";
4
4
  import { Text } from "./Text";
5
- import { useAriaInvalid } from "../core/useAriaInvalid";
6
- const TextInput = forwardRef(({ children, message, forceDisplayMessage, messageType, ...props }, inputRef) => {
7
- const errorUseId = useId();
8
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
9
- return (_jsx(Field, { ...props, renderInput: ({ id, classModifier }) => (_jsx(Text, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...props })), errorId: errorUseId, forceDisplayMessage: forceDisplayMessage, message: message, children: children }));
5
+ const TextInput = forwardRef(({ rightElement, ...props }, inputRef) => {
6
+ return (_jsx(Field, { ...props, renderInput: ({ id, classModifier, ariaInvalid, errorId }) => (_jsxs(_Fragment, { children: [_jsx(Text, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), rightElement] })) }));
10
7
  });
11
8
  TextInput.displayName = "TextInput";
12
9
  export { TextInput };
@@ -1,11 +1,9 @@
1
1
  import "@axa-fr/design-system-slash-css/dist/common/grid.scss";
2
2
  import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
3
3
  import "@axa-fr/design-system-slash-css/dist/Form/core/FormCore.scss";
4
- import { ComponentProps, ReactNode } from "react";
5
- import { LegacyField } from "../core";
4
+ import { ComponentProps } from "react";
5
+ import { type ConsumerFieldProps } from "../core";
6
6
  import { Textarea } from "./Textarea";
7
- type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof Textarea> & {
8
- helpMessage?: ReactNode;
9
- };
7
+ type Props = Omit<ConsumerFieldProps & ComponentProps<typeof Textarea>, "children">;
10
8
  declare const TextareaInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
11
9
  export { TextareaInput };
@@ -1,19 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/common/grid.scss";
3
3
  import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
4
4
  import "@axa-fr/design-system-slash-css/dist/Form/core/FormCore.scss";
5
- import { forwardRef, useId } from "react";
6
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
5
+ import { forwardRef } from "react";
6
+ import { Field } from "../core";
7
7
  import { Textarea } from "./Textarea";
8
- import { useAriaInvalid } from "../core/useAriaInvalid";
9
- const TextareaInput = forwardRef(({ id, classModifier = "", message, children, helpMessage, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, rows = 5, cols = 50, disabled = false, required, ...textareaInputProps }, inputRef) => {
10
- const rowModifier = `${classModifier} label-top`;
11
- const inputUseId = useId();
12
- const errorUseId = useId();
13
- const inputId = id ?? inputUseId;
14
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
15
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
16
- return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__textarea", classModifier: `${rowModifier} ${inputFieldClassModifier}`, children: [_jsx(Textarea, { ...textareaInputProps, id: inputId, rows: rows, cols: cols, classModifier: inputClassModifier, disabled: disabled, ref: inputRef, "aria-describedby": errorUseId, "aria-invalid": isInvalid }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
8
+ const TextareaInput = forwardRef(({ label, rightElement, ...props }, inputRef) => {
9
+ return (_jsx(Field, { label: label, labelPosition: "top", classNameSuffix: "textarea", ...props, renderInput: ({ id, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Textarea, { id: id, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), rightElement] })) }));
17
10
  });
18
11
  TextareaInput.displayName = "TextareaInput";
19
12
  export { TextareaInput };
@@ -13,5 +13,9 @@ type FieldProps = Omit<ComponentPropsWithoutRef<typeof FieldForm>, "children"> &
13
13
  isLabelContainerLinkedToInput?: boolean;
14
14
  errorId?: string;
15
15
  };
16
+ /**
17
+ * @deprecated This component is deprecated and will be removed in future versions. Use components with labels instead, such as `TextInput`
18
+ * or `SelectInput`.
19
+ */
16
20
  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
21
  export {};
@@ -1,9 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
- import { getComponentClassName } from "../../utilities";
4
- import { FieldError } from "./FieldError";
3
+ import { getComponentClassName } from "../../../utilities";
4
+ import { FieldError } from "../FieldError";
5
+ import { MessageTypes } from "../MessageTypes";
5
6
  import { FieldForm } from "./FieldForm";
6
- import { MessageTypes } from "./MessageTypes";
7
+ /**
8
+ * @deprecated This component is deprecated and will be removed in future versions. Use components with labels instead, such as `TextInput`
9
+ * or `SelectInput`.
10
+ */
7
11
  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
12
  if (!isVisible) {
9
13
  return null;
@@ -1,6 +1,6 @@
1
1
  import { type BaseSyntheticEvent, type Dispatch, type ReactElement, type ReactNode, type SetStateAction } from "react";
2
- import { FormClassManager } from "./FormClassManager";
3
- import { MessageTypes } from "./MessageTypes";
2
+ import { FormClassManager } from "../FormClassManager";
3
+ import { MessageTypes } from "../MessageTypes";
4
4
  type TMessage = {
5
5
  message?: string;
6
6
  messageType?: MessageTypes;
@@ -94,5 +94,10 @@ type RenderChildrenProps = {
94
94
  wrapper: EventFunction;
95
95
  } & Partial<Pick<FieldFormProps, "children">> & ReturnType<typeof getMessageInfo>;
96
96
  export declare const renderedChildren: ({ children, wrapper, message, messageType, }: RenderChildrenProps) => ReactNode;
97
+ /**
98
+ * @deprecated This component is deprecated and will be removed in future versions.
99
+ * This was an internal component used to manage the state of the form fields.
100
+ * It is not recommended to use it directly in your code as it is not a public API.
101
+ */
97
102
  export declare const FieldForm: ({ children, message, messageType, className, classModifier, forceDisplayMessage, setStateMemoryFn, onChangeByStateFn, setStateOnBlurFn, setStateOnFocusFn, initialState, }: FieldFormProps) => import("react/jsx-runtime").JSX.Element;
98
103
  export {};
@@ -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 {};