@axa-fr/design-system-apollo-react 1.0.5-alpha.398 → 1.0.5-alpha.403

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,2 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxApollo.scss";
2
- export declare const Checkbox: import("react").ForwardRefExoticComponent<{
3
- errorId?: string;
4
- hasError?: boolean;
5
- className?: string;
6
- } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "disabled"> & import("react").RefAttributes<HTMLInputElement>>;
2
+ export { Checkbox } from "./CheckboxCommon";
@@ -1,7 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxApollo.scss";
4
- import checkBoxIcon from "@material-symbols/svg-400/rounded/check_small.svg";
5
- import { CheckboxCommon } from "./CheckboxCommon";
6
- export const Checkbox = forwardRef((props, ref) => (_jsx(CheckboxCommon, { ...props, ref: ref, checkBoxIcon: checkBoxIcon })));
7
- Checkbox.displayName = "Checkbox";
2
+ export { Checkbox } from "./CheckboxCommon";
@@ -1,14 +1,8 @@
1
- import { type InputHTMLAttributes } from "react";
1
+ import { type ComponentProps } from "react";
2
2
  export type CheckboxProps = {
3
+ /** @deprecated Use `aria-errormessage` instead */
3
4
  errorId?: string;
5
+ /** @deprecated Use `aria-invalid` instead */
4
6
  hasError?: boolean;
5
- className?: string;
6
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "disabled">;
7
- declare const CheckboxCommon: import("react").ForwardRefExoticComponent<{
8
- errorId?: string;
9
- hasError?: boolean;
10
- className?: string;
11
- } & Omit<InputHTMLAttributes<HTMLInputElement>, "disabled"> & {
12
- checkBoxIcon: string;
13
- } & import("react").RefAttributes<HTMLInputElement>>;
14
- export { CheckboxCommon };
7
+ } & Omit<ComponentProps<"input">, "disabled" | "type">;
8
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,6 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { Svg } from "../../../Svg/Svg";
4
- const CheckboxCommon = forwardRef(({ errorId, checkBoxIcon, hasError, ...inputProps }, ref) => (_jsxs("span", { className: "af-checkbox", children: [_jsx(Svg, { src: checkBoxIcon, "aria-hidden": true }), _jsx("input", { ...inputProps, ref: ref, type: "checkbox", "aria-errormessage": errorId, "aria-invalid": hasError, disabled: false })] })));
5
- CheckboxCommon.displayName = "CheckboxCommon";
6
- export { CheckboxCommon };
3
+ export const Checkbox = forwardRef(({ errorId, hasError, className, ...inputProps }, ref) => (_jsx("input", { "aria-errormessage": errorId, "aria-invalid": hasError, ...inputProps, className: ["af-checkbox", className].filter(Boolean).join(" "), ref: ref, type: "checkbox" })));
4
+ Checkbox.displayName = "Checkbox";
@@ -1,6 +1,2 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxLF.scss";
2
- export declare const Checkbox: import("react").ForwardRefExoticComponent<{
3
- errorId?: string;
4
- hasError?: boolean;
5
- className?: string;
6
- } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "disabled"> & import("react").RefAttributes<HTMLInputElement>>;
2
+ export { Checkbox } from "./CheckboxCommon";
@@ -1,7 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxLF.scss";
4
- import checkBoxIcon from "@material-symbols/svg-400/rounded/check.svg";
5
- import { CheckboxCommon } from "./CheckboxCommon";
6
- export const Checkbox = forwardRef((props, ref) => (_jsx(CheckboxCommon, { ...props, ref: ref, checkBoxIcon: checkBoxIcon })));
7
- Checkbox.displayName = "Checkbox";
2
+ export { Checkbox } from "./CheckboxCommon";
@@ -1,5 +1,3 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/CheckboxTextApollo.scss";
2
- export declare const CheckboxText: import("react").ForwardRefExoticComponent<{
3
- label: string | import("react").ReactNode;
4
- errorMessage?: string;
5
- } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "disabled"> & import("react").RefAttributes<HTMLInputElement>>;
2
+ import { type CheckboxTextProps } from "./CheckboxTextCommon";
3
+ export declare const CheckboxText: import("react").ForwardRefExoticComponent<Omit<CheckboxTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,19 +1,12 @@
1
- import React, { type ReactNode, type ComponentProps, type ComponentType } from "react";
2
- import { ItemMessage } from "../../ItemMessage/ItemMessageCommon";
3
- import { CheckboxCommon } from "../Checkbox/CheckboxCommon";
1
+ import { type ReactNode, type ComponentType } from "react";
2
+ import type { ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
3
+ import type { CheckboxProps } from "../Checkbox/CheckboxCommon";
4
4
  export type CheckboxTextProps = {
5
5
  label: string | ReactNode;
6
6
  errorMessage?: string;
7
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">;
7
+ } & Omit<CheckboxProps, "aria-errormessage" | "aria-invalid">;
8
8
  export type CheckboxTextCommonProps = CheckboxTextProps & {
9
- CheckboxComponent: ComponentType<Omit<ComponentProps<typeof CheckboxCommon>, "checkBoxIcon">>;
10
- ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
9
+ CheckboxComponent: ComponentType<Omit<CheckboxProps, "checkBoxIcon">>;
10
+ ItemMessageComponent: ComponentType<ItemMessageProps>;
11
11
  };
12
- declare const CheckboxTextCommon: React.ForwardRefExoticComponent<{
13
- label: string | ReactNode;
14
- errorMessage?: string;
15
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled"> & {
16
- CheckboxComponent: ComponentType<Omit<ComponentProps<typeof CheckboxCommon>, "checkBoxIcon">>;
17
- ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
18
- } & React.RefAttributes<HTMLInputElement>>;
19
- export { CheckboxTextCommon };
12
+ export declare const CheckboxTextCommon: import("react").ForwardRefExoticComponent<Omit<CheckboxTextCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, forwardRef, } from "react";
3
- const CheckboxTextCommon = forwardRef(({ label, errorMessage, CheckboxComponent, ItemMessageComponent, ...inputProps }, ref) => {
4
- const errorId = useId();
5
- let inputId = useId();
6
- inputId = inputProps.id || inputId;
7
- return (_jsxs("div", { className: "af-checkbox-text", children: [_jsx(CheckboxComponent, { id: inputId, errorId: errorId, hasError: Boolean(errorMessage), ...inputProps, ref: ref }), _jsx("label", { htmlFor: inputId, children: _jsx("span", { children: label }) }, inputProps.name), _jsx(ItemMessageComponent, { message: errorMessage })] }));
2
+ import { useId, forwardRef } from "react";
3
+ export const CheckboxTextCommon = forwardRef(({ label, errorMessage, id, CheckboxComponent, ItemMessageComponent, ...inputProps }, ref) => {
4
+ const generatedId = useId();
5
+ const inputId = id ?? generatedId;
6
+ const errorId = `${inputId}-error`;
7
+ return (_jsxs("div", { className: "af-checkbox-text", children: [_jsxs("label", { htmlFor: inputId, children: [_jsx(CheckboxComponent, { id: inputId, ...inputProps, "aria-errormessage": errorMessage ? errorId : undefined, "aria-invalid": errorMessage ? true : undefined, ref: ref }), _jsx("span", { className: "af-checkbox-text__label-content", children: label })] }), _jsx(ItemMessageComponent, { message: errorMessage, id: errorId })] }));
8
8
  });
9
9
  CheckboxTextCommon.displayName = "CheckboxTextCommon";
10
- export { CheckboxTextCommon };
@@ -1,5 +1,3 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/CheckboxTextLF.scss";
2
- export declare const CheckboxText: import("react").ForwardRefExoticComponent<{
3
- label: string | import("react").ReactNode;
4
- errorMessage?: string;
5
- } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "disabled"> & import("react").RefAttributes<HTMLInputElement>>;
2
+ import { CheckboxTextProps } from "./CheckboxTextCommon";
3
+ export declare const CheckboxText: import("react").ForwardRefExoticComponent<Omit<CheckboxTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,8 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
- type ItemMessageProps = {
2
+ export type ItemMessageProps = {
3
3
  message?: ReactNode;
4
4
  id?: string;
5
5
  messageType?: "error" | "success";
6
6
  };
7
7
  export declare const ItemMessage: ({ message, id, messageType, }: ItemMessageProps) => import("react/jsx-runtime").JSX.Element | null;
8
- export {};
@@ -18,8 +18,4 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Om
18
18
  ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
19
19
  ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
20
20
  onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
21
- } & Partial<{
22
- message?: import("react").ReactNode;
23
- id?: string;
24
- messageType?: "error" | "success";
25
- }>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
21
+ } & Partial<import("../ItemMessage/ItemMessageCommon").ItemMessageProps>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -2,6 +2,7 @@ import { type ComponentProps, ComponentPropsWithRef, type ComponentType, MouseEv
2
2
  import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
3
3
  import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
4
4
  type Props = ComponentPropsWithRef<"textarea"> & Pick<ComponentProps<typeof ItemLabel>, "label" | "description" | "buttonLabel" | "sideButtonLabel" | "onSideButtonClick"> & {
5
+ /** @deprecated Use `className` instead */
5
6
  classModifier?: string;
6
7
  helper?: string;
7
8
  error?: string;
@@ -9,5 +10,5 @@ type Props = ComponentPropsWithRef<"textarea"> & Pick<ComponentProps<typeof Item
9
10
  ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
10
11
  onButtonClick?: MouseEventHandler<HTMLButtonElement>;
11
12
  } & Partial<ComponentPropsWithRef<typeof ItemMessage>>;
12
- declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
13
- export { TextArea };
13
+ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
14
+ export {};
@@ -1,13 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
- import { getComponentClassName } from "../../utilities/getComponentClassName";
4
- const TextArea = forwardRef(({ className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, ...otherProps }, inputRef) => {
5
- const componentClassName = getComponentClassName("af-form__input-textarea", className, classModifier);
6
- let inputId = useId();
7
- inputId = otherProps.id || inputId;
8
- const idHelp = useId();
9
- const idError = useId();
10
- return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _jsx("textarea", { id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": error ? idError : undefined, "aria-describedby": helper ? idHelp : undefined, "aria-invalid": Boolean(error), ...otherProps }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idError, message: error })] }));
3
+ export const TextArea = forwardRef(({ id, className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", ...inputProps }, inputRef) => {
4
+ const generatedId = useId();
5
+ const inputId = id ?? generatedId;
6
+ const helperId = `${inputId}-helper`;
7
+ const errorId = `${inputId}-error`;
8
+ return (_jsxs("div", { className: ["af-form__input-container", className]
9
+ .filter(Boolean)
10
+ .join(" "), children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _jsx("textarea", { id: inputId, className: "af-form__input-textarea", ref: inputRef, "aria-errormessage": error ? errorId : undefined, "aria-describedby": helper ? helperId : undefined, required: required, "aria-invalid": Boolean(error) || classModifier.includes("error") ? true : undefined, placeholder: placeholder, ...inputProps }), helper ? (_jsx("span", { id: helperId, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: errorId, message: error })] }));
11
11
  });
12
12
  TextArea.displayName = "TextArea";
13
- export { TextArea };
@@ -18,8 +18,4 @@ export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Om
18
18
  ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
19
19
  ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
20
20
  onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
21
- } & Partial<{
22
- message?: import("react").ReactNode;
23
- id?: string;
24
- messageType?: "error" | "success";
25
- }>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
21
+ } & Partial<import("../ItemMessage/ItemMessageCommon").ItemMessageProps>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.5-alpha.398",
3
+ "version": "1.0.5-alpha.403",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "homepage": "https://github.com/AxaFrance/design-system#readme",
48
48
  "peerDependencies": {
49
- "@axa-fr/design-system-apollo-css": "1.0.5-alpha.398",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.398",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.403",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.403",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },