@axa-fr/design-system-slash-react 1.2.1-alpha.7 → 1.2.1-alpha.71

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 +2 -2
  7. package/dist/Form/Choice/Choice.js +0 -1
  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 +3 -4
  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 +3 -3
  19. package/dist/Form/Pass/PassInput.js +5 -12
  20. package/dist/Form/Radio/Radio.d.ts +24 -7
  21. package/dist/Form/Radio/Radio.js +15 -4
  22. package/dist/Form/Radio/RadioCardGroup.d.ts +12 -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 +61 -128
  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 +3 -6
  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 +53 -5
  44. package/dist/Form/core/Field.js +23 -9
  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
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+ export type CustomClickEvent = {
3
+ href: string;
4
+ number?: ReactNode;
5
+ id: string;
6
+ title: string;
7
+ };
8
+ export type VerticalStepMode = "edited" | "locked" | "validated";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
- import { Alert } from "../Alert/Alert";
3
- type SummaryProps = Omit<ComponentPropsWithoutRef<typeof Alert>, "title"> & {
1
+ import { ReactNode } from "react";
2
+ import { type MessageProps } from "../Messages/Message";
3
+ type SummaryProps = Omit<MessageProps, "title"> & {
4
4
  title?: string;
5
5
  messages?: ReactNode[];
6
6
  isVisible?: boolean;
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Alert } from "../Alert/Alert";
2
+ import { Message } from "../Messages/Message";
3
3
  import { generateId } from "../utilities/helpers/generateId";
4
4
  export const Summary = ({ messages = [], isVisible = true, title = "Invalid form", classModifier = "error", ...args }) => {
5
5
  const messagesNotBlank = messages.filter((message) => Boolean(message));
6
6
  if (!messages || !isVisible || messagesNotBlank.length === 0) {
7
7
  return null;
8
8
  }
9
- return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${generateId({ message })}`))) }) }));
9
+ const variant = classModifier === "danger" ? "warning" : classModifier;
10
+ return (_jsx(Message, { icon: "glyphicon glyphicon-warning-sign", title: title, variant: variant, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${generateId({ message })}`))) }) }));
10
11
  };
package/dist/Svg/Svg.js CHANGED
@@ -46,5 +46,5 @@ export const Svg = ({ src, alt, width = 24, height = 24, ...props }) => {
46
46
  if (hasError) {
47
47
  return alt ? (_jsx("span", { ...props, children: alt })) : null;
48
48
  }
49
- return _jsx("svg", { ref: rootRef, "data-src": src, ...props });
49
+ return _jsx("svg", { ref: rootRef, "data-src": src, role: "presentation", ...props });
50
50
  };
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import classNames from "classnames";
3
2
  const onClick = ({ onChange, value }) => (event) => {
4
3
  event.preventDefault();
5
4
  onChange({
@@ -10,8 +9,6 @@ const Li = ({ isVisible, active, value, ...props }) => {
10
9
  if (!isVisible) {
11
10
  return null;
12
11
  }
13
- return (_jsx("li", { className: classNames("af-pager__item", {
14
- "af-pager__item--active": active,
15
- }), children: _jsx("a", { className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
12
+ return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { "aria-current": active ? "page" : undefined, className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
16
13
  };
17
14
  export { Li };
package/dist/index.d.ts CHANGED
@@ -2,10 +2,11 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
2
2
  import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
3
3
  import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ import { Message } from "./Messages/Message";
5
6
  export { Action } from "./Action/Action";
6
- export { Alert } from "./Alert/Alert";
7
7
  export { Badge } from "./Badge/Badge";
8
8
  export { Button } from "./Button/Button";
9
+ export { Card } from "./Card/Card";
9
10
  export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
10
11
  export { Choice, ChoiceInput } from "./Form/Choice";
11
12
  export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
@@ -25,14 +26,21 @@ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase,
25
26
  export { Link, type LinkProps } from "./Link/Link";
26
27
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
27
28
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
28
- export { Step, StepBase, Steps } from "./Steps";
29
+ export { Step, StepBase, Steps, VerticalStep } from "./Steps";
29
30
  export { Summary } from "./Summary";
30
31
  export { Svg } from "./Svg";
31
32
  export { Tabs } from "./Tabs/Tabs";
32
33
  export { Title } from "./Title/Title";
33
34
  export { getComponentClassName } from "./utilities";
35
+ /**
36
+ * @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
37
+ * @see {@link Message}
38
+ */
39
+ declare const Alert: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: import("react").PropsWithChildren<import("./Messages/Message").MessageProps>) => import("react/jsx-runtime").JSX.Element;
34
40
  export * from "./Accordion";
41
+ export { type MessageProps, type MessageVariants } from "./Messages/Message";
35
42
  export * from "./Popover";
36
43
  export * from "./Table";
44
+ export { Alert, Message };
37
45
  export { HelpButton } from "./HelpButton";
38
46
  export { Loader } from "./Loader/Loader";
package/dist/index.js CHANGED
@@ -2,10 +2,11 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
2
2
  import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
3
3
  import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ import { Message } from "./Messages/Message";
5
6
  export { Action } from "./Action/Action";
6
- export { Alert } from "./Alert/Alert";
7
7
  export { Badge } from "./Badge/Badge";
8
8
  export { Button } from "./Button/Button";
9
+ export { Card } from "./Card/Card";
9
10
  export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
10
11
  export { Choice, ChoiceInput } from "./Form/Choice";
11
12
  export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
@@ -25,14 +26,20 @@ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase,
25
26
  export { Link } from "./Link/Link";
26
27
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
27
28
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
28
- export { Step, StepBase, Steps } from "./Steps";
29
+ export { Step, StepBase, Steps, VerticalStep } from "./Steps";
29
30
  export { Summary } from "./Summary";
30
31
  export { Svg } from "./Svg";
31
32
  export { Tabs } from "./Tabs/Tabs";
32
33
  export { Title } from "./Title/Title";
33
34
  export { getComponentClassName } from "./utilities";
35
+ /**
36
+ * @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
37
+ * @see {@link Message}
38
+ */
39
+ const Alert = Message;
34
40
  export * from "./Accordion";
35
41
  export * from "./Popover";
36
42
  export * from "./Table";
43
+ export { Alert, Message };
37
44
  export { HelpButton } from "./HelpButton";
38
45
  export { Loader } from "./Loader/Loader";
@@ -1 +1,8 @@
1
1
  export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
2
+ type getComponentClassNameWithUserClassnameParams = {
3
+ userClassName?: string;
4
+ classModifier?: string;
5
+ componentClassName: string;
6
+ };
7
+ export declare const getComponentClassNameWithUserClassname: ({ componentClassName, userClassName, classModifier, }: getComponentClassNameWithUserClassnameParams) => string;
8
+ export {};
@@ -26,3 +26,17 @@ export const getComponentClassName = (className, classModifier, defaultClassName
26
26
  });
27
27
  return classNames(classNameToUse, modifiersObject);
28
28
  };
29
+ export const getComponentClassNameWithUserClassname = ({ componentClassName, userClassName, classModifier, }) => {
30
+ // Fail fast, when no className or componentClassName we don't want to loop on modifier
31
+ if (!componentClassName) {
32
+ return "";
33
+ }
34
+ const classWithoutModifier = getLastClassName(componentClassName);
35
+ const modifiers = listClassModifier(classModifier);
36
+ const modifiersObject = modifiers
37
+ .filter((it) => /\S/.test(it))
38
+ .map((it) => {
39
+ return `${classWithoutModifier}--${it}`;
40
+ });
41
+ return classNames(componentClassName, modifiersObject, userClassName);
42
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-slash-react",
3
- "version": "1.2.1-alpha.7",
3
+ "version": "1.2.1-alpha.71",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "homepage": "https://github.com/AxaFrance/design-system#readme",
49
49
  "peerDependencies": {
50
- "@axa-fr/design-system-slash-css": "1.2.1-alpha.7",
50
+ "@axa-fr/design-system-slash-css": "1.2.1-alpha.71",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },
@@ -77,10 +77,10 @@
77
77
  "@types/dompurify": "^3.0.5",
78
78
  "@types/jest": "^29.5.14",
79
79
  "@types/jest-axe": "^3.5.9",
80
- "@vitest/coverage-v8": "^3.0.7",
80
+ "@vitest/coverage-v8": "^3.2.4",
81
81
  "@vitest/ui": "^3.0.7",
82
82
  "copyfiles": "^2.4.1",
83
- "jest-axe": "^9.0.0",
83
+ "jest-axe": "^10.0.0",
84
84
  "jsdom": "^25.0.1",
85
85
  "react": "^19.0.0",
86
86
  "rimraf": "^6.0.1",
@@ -1,17 +0,0 @@
1
- import { MouseEventHandler, PropsWithChildren } from "react";
2
- import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
3
- export declare enum TypeIcons {
4
- error = "glyphicon glyphicon-minus-sign",
5
- danger = "glyphicon glyphicon-alert",
6
- info = "glyphicon glyphicon-info-sign",
7
- success = "glyphicon glyphicon-ok"
8
- }
9
- export type AlertCoreComponentProps = {
10
- title: string;
11
- icon?: string;
12
- onClose?: MouseEventHandler<HTMLButtonElement>;
13
- className?: string;
14
- classModifier?: "error" | "danger" | "info" | "success";
15
- closeButtonAriaLabel?: string;
16
- };
17
- export declare const Alert: ({ className, onClose, icon, title, children, classModifier, closeButtonAriaLabel, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getComponentClassName } from "../utilities";
3
- import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
4
- export var TypeIcons;
5
- (function (TypeIcons) {
6
- TypeIcons["error"] = "glyphicon glyphicon-minus-sign";
7
- TypeIcons["danger"] = "glyphicon glyphicon-alert";
8
- TypeIcons["info"] = "glyphicon glyphicon-info-sign";
9
- TypeIcons["success"] = "glyphicon glyphicon-ok";
10
- })(TypeIcons || (TypeIcons = {}));
11
- export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", closeButtonAriaLabel = "close", }) => {
12
- const componentClassName = getComponentClassName(className, classModifier, "af-alert");
13
- return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsxs("div", { className: "af-alert__title", children: [_jsx("div", { className: "af-alert__title-icon", children: _jsx("i", { role: "presentation", className: icon || TypeIcons[classModifier] }) }), _jsx("div", { className: "af-alert__title-text", children: title }), onClose && (_jsx("button", { type: "button", className: "af-alert__title-icon-close", onClick: onClose, "aria-label": closeButtonAriaLabel, children: _jsx("i", { className: "glyphicon glyphicon-close" }) }))] }), children && (_jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__content-left" }), _jsx("div", { className: "af-alert__content-right", children: children })] }))] }));
14
- };