@axa-fr/design-system-slash-react 0.2.0-beta.301 → 0.2.0-beta.302

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.
@@ -1,6 +1,7 @@
1
1
  import "@axa-fr/design-system-slash-css/dist/Form/InputError/InputError.client.scss";
2
2
  type InputErrorProps = {
3
3
  message: string;
4
+ id?: string;
4
5
  };
5
- export declare const InputError: ({ message }: InputErrorProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const InputError: ({ message, id }: InputErrorProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import errorIcon from "@material-symbols/svg-400/outlined/error.svg";
3
2
  import "@axa-fr/design-system-slash-css/dist/Form/InputError/InputError.client.scss";
3
+ import errorIcon from "@material-symbols/svg-400/outlined/error.svg";
4
4
  import { Svg } from "../../Svg";
5
- export const InputError = ({ message }) => (_jsxs("div", { className: "af-input-error", children: [_jsx(Svg, { src: errorIcon, className: "af-input-error__icon" }), _jsx("span", { className: "af-input-error__message", children: message })] }));
5
+ export const InputError = ({ message, id }) => (_jsxs("div", { className: "af-input-error", children: [_jsx(Svg, { src: errorIcon, className: "af-input-error__icon" }), _jsx("span", { id: id, "aria-live": "assertive", className: "af-input-error__message", children: message })] }));
@@ -6,7 +6,7 @@ import { InputError } from "../../InputError";
6
6
  const Text = forwardRef(({ className, classModifier = "", ...otherProps }, inputRef) => {
7
7
  const componentClassName = getComponentClassName(className, classModifier, "af-form__input-text");
8
8
  const { id, label, required, disabled, description, helper, error } = otherProps;
9
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsxs("label", { htmlFor: id, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), _jsx("input", { className: componentClassName, type: "text", ref: inputRef, required: required, disabled: disabled, ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { message: error })] }));
9
+ return (_jsxs("div", { className: "af-form__input-container", children: [_jsxs("label", { htmlFor: id, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), _jsx("input", { className: componentClassName, type: "text", ref: inputRef, required: required, disabled: disabled, "aria-invalid": Boolean(error), "aria-describedby": error ? `${id}-error` : undefined, ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { id: `${id}-error`, message: error })] }));
10
10
  });
11
11
  Text.displayName = "Text";
12
12
  export { Text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-slash-react",
3
- "version": "0.2.0-beta.301",
3
+ "version": "0.2.0-beta.302",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./agent": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/design-system-slash-css": "0.2.0-beta.301",
48
+ "@axa-fr/design-system-slash-css": "0.2.0-beta.302",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "react": ">= 18"
51
51
  },