@axa-fr/design-system-apollo-react 1.0.5-alpha.326 → 1.0.5-alpha.328
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.
- package/dist/Form/InputPhone/CountryCodeSelect.d.ts +12 -0
- package/dist/Form/InputPhone/CountryCodeSelect.js +29 -0
- package/dist/Form/InputPhone/InputPhone.types.d.ts +4 -0
- package/dist/Form/InputPhone/InputPhone.types.js +1 -0
- package/dist/Form/InputPhone/InputPhoneApollo.d.ts +3 -0
- package/dist/Form/InputPhone/InputPhoneApollo.js +8 -0
- package/dist/Form/InputPhone/InputPhoneCommon.d.ts +29 -0
- package/dist/Form/InputPhone/InputPhoneCommon.js +31 -0
- package/dist/Form/InputPhone/InputPhoneLF.d.ts +3 -0
- package/dist/Form/InputPhone/InputPhoneLF.js +8 -0
- package/dist/Form/InputPhone/maskFrenchPhoneNumber.d.ts +1 -0
- package/dist/Form/InputPhone/maskFrenchPhoneNumber.js +12 -0
- package/dist/Form/InputText/InputTextApollo.d.ts +3 -1
- package/dist/Form/InputText/InputTextApollo.js +2 -1
- package/dist/Form/InputText/InputTextCommon.d.ts +2 -0
- package/dist/Form/InputText/InputTextCommon.js +2 -2
- package/dist/Form/InputText/InputTextLF.d.ts +3 -1
- package/dist/Form/InputText/InputTextLF.js +2 -1
- package/dist/Form/InputTextAtom/InputTextAtomApollo.d.ts +2 -0
- package/dist/Form/InputTextAtom/InputTextAtomApollo.js +2 -0
- package/dist/Form/InputTextAtom/InputTextAtomCommon.d.ts +11 -0
- package/dist/Form/InputTextAtom/InputTextAtomCommon.js +11 -0
- package/dist/Form/InputTextAtom/InputTextAtomLF.d.ts +2 -0
- package/dist/Form/InputTextAtom/InputTextAtomLF.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/indexLF.d.ts +3 -0
- package/dist/indexLF.js +2 -0
- package/package.json +5 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentProps, ComponentType } from "react";
|
|
2
|
+
import { SingleValue } from "react-select";
|
|
3
|
+
import { OptionType } from "./InputPhone.types";
|
|
4
|
+
import { Icon } from "../../Icon/IconCommon";
|
|
5
|
+
declare const CountryCodeSelect: ({ options, defaultCountry, onChangeSelect, IconComponent, disabled, }: {
|
|
6
|
+
options: OptionType[];
|
|
7
|
+
defaultCountry?: string;
|
|
8
|
+
onChangeSelect?: (value: SingleValue<OptionType>) => void;
|
|
9
|
+
IconComponent: ComponentType<ComponentProps<typeof Icon>>;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { CountryCodeSelect };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import Select from "react-select";
|
|
4
|
+
const CountryCodeSelect = ({ options, defaultCountry, onChangeSelect, IconComponent, disabled, }) => {
|
|
5
|
+
const defaultOption = options.find((option) => option.code === (defaultCountry ?? "+33"));
|
|
6
|
+
const [selectedOption, setSelectedOption] = useState(defaultOption);
|
|
7
|
+
const customStyles = {
|
|
8
|
+
control: (provided) => ({
|
|
9
|
+
...provided,
|
|
10
|
+
margin: 0,
|
|
11
|
+
}),
|
|
12
|
+
dropdownIndicator: (provided) => ({
|
|
13
|
+
...provided,
|
|
14
|
+
display: "none",
|
|
15
|
+
}),
|
|
16
|
+
indicatorSeparator: (provided) => ({
|
|
17
|
+
...provided,
|
|
18
|
+
display: "none",
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
const formatOptionLabel = ({ flag, code }) => (_jsxs("div", { className: "country-code-select-format-label", children: [_jsx(IconComponent, { src: flag }), code] }));
|
|
22
|
+
const handleChange = (newValue) => {
|
|
23
|
+
setSelectedOption(newValue ?? undefined);
|
|
24
|
+
if (newValue)
|
|
25
|
+
onChangeSelect?.(newValue);
|
|
26
|
+
};
|
|
27
|
+
return (_jsx(Select, { classNamePrefix: "country-code-select", styles: customStyles, options: options, value: selectedOption, onChange: handleChange, formatOptionLabel: formatOptionLabel, "aria-label": "Select country code", getOptionValue: (option) => option.code, isDisabled: disabled }));
|
|
28
|
+
};
|
|
29
|
+
export { CountryCodeSelect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/InputPhone/InputPhoneApollo.scss";
|
|
3
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
4
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
5
|
+
import { InputPhoneCommon } from "./InputPhoneCommon";
|
|
6
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomApollo";
|
|
7
|
+
import { Icon } from "../../Icon/IconApollo";
|
|
8
|
+
export const InputPhone = (props) => (_jsx(InputPhoneCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextComponent: InputTextAtom, IconComponent: Icon }));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
|
+
import { SingleValue } from "react-select";
|
|
3
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
|
|
4
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
5
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
6
|
+
import { Icon } from "../../Icon/IconCommon";
|
|
7
|
+
import { type OptionType } from "./InputPhone.types";
|
|
8
|
+
export type InputPhoneProps = ComponentPropsWithRef<"input"> & {
|
|
9
|
+
classModifier?: string;
|
|
10
|
+
helper?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
success?: string;
|
|
13
|
+
defaultCountry?: string;
|
|
14
|
+
showSelect?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
countryCodeOptions?: OptionType[];
|
|
17
|
+
onChangeSelect?: (value: SingleValue<OptionType>) => void;
|
|
18
|
+
onChangeInput?: (value: string) => void;
|
|
19
|
+
mask?: (value: string) => string;
|
|
20
|
+
label: ComponentProps<typeof ItemLabel>["label"];
|
|
21
|
+
} & Partial<ComponentPropsWithRef<typeof ItemLabel>>;
|
|
22
|
+
type InputPhoneCommonProps = InputPhoneProps & {
|
|
23
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabel>, "ButtonComponent">>;
|
|
24
|
+
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
25
|
+
InputTextComponent: ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
26
|
+
IconComponent: ComponentType<ComponentProps<typeof Icon>>;
|
|
27
|
+
};
|
|
28
|
+
declare const InputPhoneCommon: import("react").ForwardRefExoticComponent<Omit<InputPhoneCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
29
|
+
export { InputPhoneCommon };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId, } from "react";
|
|
3
|
+
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
|
+
import { CountryCodeSelect } from "./CountryCodeSelect";
|
|
5
|
+
import { maskFrenchPhoneNumber } from "./maskFrenchPhoneNumber";
|
|
6
|
+
const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, error, success, defaultCountry, showSelect, disabled, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, countryCodeOptions = [], onChangeSelect, onChangeInput, mask = maskFrenchPhoneNumber, ItemLabelComponent, ItemMessageComponent, InputTextComponent, IconComponent, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
|
|
7
|
+
const componentClassName = getComponentClassName("af-form__input-phone", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
8
|
+
let inputId = useId();
|
|
9
|
+
inputId = otherProps.id || inputId;
|
|
10
|
+
const idMessage = useId();
|
|
11
|
+
const idLabel = useId();
|
|
12
|
+
const idHelp = useId();
|
|
13
|
+
/**
|
|
14
|
+
* Gère le changement de valeur du champ numéro de téléphone.
|
|
15
|
+
* - Récupère une fonction de masquage (mask) depuis les props ou utilise une version par défaut.
|
|
16
|
+
* - La fonction de masquage par défaut :
|
|
17
|
+
* - Ne garde que les chiffres (supprime tout le reste).
|
|
18
|
+
* - Limite à 10 chiffres.
|
|
19
|
+
* - Formate par groupes de 2 chiffres séparés par un espace (ex: 06 12 34 56 78).
|
|
20
|
+
* - Applique le masquage à la valeur saisie et transmet le résultat via onChangeInput.
|
|
21
|
+
*/
|
|
22
|
+
const handleChangeNumber = (e) => {
|
|
23
|
+
const input = e.target;
|
|
24
|
+
const rawValue = input.value;
|
|
25
|
+
const maskedValue = mask(rawValue);
|
|
26
|
+
onChangeInput?.(maskedValue);
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "af-form__input-phone-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId, idLabel: idLabel }), _jsxs("div", { className: "af-form__input-phone-fields", children: [showSelect && (_jsx("div", { className: "af-form__country-code-wrapper", children: _jsx(CountryCodeSelect, { options: countryCodeOptions, defaultCountry: defaultCountry, onChangeSelect: onChangeSelect, IconComponent: IconComponent, disabled: disabled }) })), _jsx(InputTextComponent, { ...otherProps, className: componentClassName, ref: inputRef, error: error, type: "tel", required: required, placeholder: otherProps.placeholder, "aria-errormessage": ariaErrormessage, value: otherProps.value, onChange: handleChangeNumber, disabled: disabled, idLabel: idLabel, idMessage: idMessage, idHelp: idHelp, id: inputId })] }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-phone-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error || success, messageType: error ? "error" : "success" })] }));
|
|
29
|
+
});
|
|
30
|
+
InputPhoneCommon.displayName = "InputPhone";
|
|
31
|
+
export { InputPhoneCommon };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/InputPhone/InputPhoneLF.scss";
|
|
3
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
4
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
5
|
+
import { InputPhoneCommon } from "./InputPhoneCommon";
|
|
6
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomLF";
|
|
7
|
+
import { Icon } from "../../Icon/IconLF";
|
|
8
|
+
export const InputPhone = (props) => (_jsx(InputPhoneCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextComponent: InputTextAtom, IconComponent: Icon }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function maskFrenchPhoneNumber(value: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function maskFrenchPhoneNumber(value) {
|
|
2
|
+
let numericValue = value.replace(/[^0-9]/g, "");
|
|
3
|
+
numericValue = numericValue.slice(0, 10);
|
|
4
|
+
let formattedValue = "";
|
|
5
|
+
for (let i = 0; i < numericValue.length; i += 2) {
|
|
6
|
+
formattedValue += numericValue.slice(i, i + 2);
|
|
7
|
+
if (i + 2 < numericValue.length) {
|
|
8
|
+
formattedValue += " ";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return formattedValue;
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextApollo.scss";
|
|
2
2
|
import { type ComponentProps } from "react";
|
|
3
3
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
4
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomApollo";
|
|
4
5
|
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
5
6
|
unit?: React.ReactNode;
|
|
6
7
|
classModifier?: string;
|
|
@@ -10,6 +11,7 @@ export declare const InputText: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
10
11
|
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
11
12
|
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
12
13
|
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
|
+
InputTextAtomComponent: import("react").ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
13
15
|
} & Partial<{
|
|
14
16
|
label?: string;
|
|
15
17
|
description?: string;
|
|
@@ -21,4 +23,4 @@ export declare const InputText: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
21
23
|
buttonLabel?: string;
|
|
22
24
|
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
23
25
|
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
24
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
26
|
+
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent" | "InputTextAtomComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -4,5 +4,6 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
6
6
|
import { InputText as InputTextCommon } from "./InputTextCommon";
|
|
7
|
-
|
|
7
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomApollo";
|
|
8
|
+
export const InputText = forwardRef((props, ref) => (_jsx(InputTextCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextAtomComponent: InputTextAtom })));
|
|
8
9
|
InputText.displayName = "InputText";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
2
|
import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
|
|
3
3
|
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
4
5
|
type InputTextProps = ComponentPropsWithRef<"input"> & {
|
|
5
6
|
unit?: React.ReactNode;
|
|
6
7
|
classModifier?: string;
|
|
@@ -10,6 +11,7 @@ type InputTextProps = ComponentPropsWithRef<"input"> & {
|
|
|
10
11
|
label: ComponentProps<typeof ItemLabel>["label"];
|
|
11
12
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabel>, "ButtonComponent">>;
|
|
12
13
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
|
+
InputTextAtomComponent: ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
13
15
|
} & Partial<ComponentPropsWithRef<typeof ItemLabel>>;
|
|
14
16
|
declare const InputText: import("react").ForwardRefExoticComponent<Omit<InputTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
17
|
export { InputText };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
3
|
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
|
-
const InputText = forwardRef(({ unit, className, classModifier = "", helper, error, success, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, "aria-errormessage": ariaErrormessage, ...otherProps }
|
|
4
|
+
const InputText = forwardRef(({ unit, className, classModifier = "", helper, error, success, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, "aria-errormessage": ariaErrormessage, ...otherProps }) => {
|
|
5
5
|
const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
6
6
|
let inputId = useId();
|
|
7
7
|
inputId = otherProps.id || inputId;
|
|
8
8
|
const idMessage = useId();
|
|
9
9
|
const idHelp = useId();
|
|
10
10
|
const idLabel = useId();
|
|
11
|
-
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, idLabel: idLabel }),
|
|
11
|
+
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, idLabel: idLabel }), _jsx(InputTextAtomComponent, { unit: unit, className: componentClassName, error: error, required: required, idMessage: idMessage, idHelp: idHelp, idLabel: idLabel, ...otherProps }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error || success, messageType: error ? "error" : "success" })] }));
|
|
12
12
|
});
|
|
13
13
|
InputText.displayName = "InputText";
|
|
14
14
|
export { InputText };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextLF.scss";
|
|
2
2
|
import { type ComponentProps } from "react";
|
|
3
3
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
4
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomLF";
|
|
4
5
|
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
5
6
|
unit?: React.ReactNode;
|
|
6
7
|
classModifier?: string;
|
|
@@ -10,6 +11,7 @@ export declare const InputText: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
10
11
|
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
11
12
|
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
12
13
|
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
|
+
InputTextAtomComponent: import("react").ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
13
15
|
} & Partial<{
|
|
14
16
|
label?: string;
|
|
15
17
|
description?: string;
|
|
@@ -21,4 +23,4 @@ export declare const InputText: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
21
23
|
buttonLabel?: string;
|
|
22
24
|
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
23
25
|
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
24
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
26
|
+
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent" | "InputTextAtomComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -4,5 +4,6 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
6
6
|
import { InputText as InputTextCommon } from "./InputTextCommon";
|
|
7
|
-
|
|
7
|
+
import { InputTextAtom } from "../InputTextAtom/InputTextAtomLF";
|
|
8
|
+
export const InputText = forwardRef((props, ref) => (_jsx(InputTextCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextAtomComponent: InputTextAtom })));
|
|
8
9
|
InputText.displayName = "InputText";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
2
|
+
type InputTextAtomProps = ComponentPropsWithRef<"input"> & {
|
|
3
|
+
unit?: React.ReactNode;
|
|
4
|
+
classModifier?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
idMessage?: string;
|
|
7
|
+
idHelp?: string;
|
|
8
|
+
idLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const InputTextAtom: import("react").ForwardRefExoticComponent<Omit<InputTextAtomProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
|
+
export { InputTextAtom };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
|
+
const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, "aria-errormessage": ariaErrormessage, idMessage, idHelp, idLabel, ...otherProps }, inputRef) => {
|
|
5
|
+
const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
6
|
+
let inputId = useId();
|
|
7
|
+
inputId = otherProps.id || inputId;
|
|
8
|
+
return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: otherProps.type || "text", required: required, ref: inputRef, "aria-labelledby": idLabel, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": idHelp, ...otherProps }), unit] }));
|
|
9
|
+
});
|
|
10
|
+
InputTextAtom.displayName = "InputTextAtom";
|
|
11
|
+
export { InputTextAtom };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
|
|
|
22
22
|
export { InputText } from "./Form/InputText/InputTextApollo";
|
|
23
23
|
export { DebugGrid } from "./Grid/DebugGridApollo";
|
|
24
24
|
export { Heading, type HeadingLevel } from "./Heading/HeadingApollo";
|
|
25
|
+
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomApollo";
|
|
25
26
|
export { Icon, iconSizeVariants, iconVariants, type IconSizeVariants, type IconVariants, } from "./Icon/IconApollo";
|
|
26
27
|
export { ItemTabBar, itemTabBarVariants, type ItemTabBarVariants, } from "./ItemTabBar/ItemTabBarApollo";
|
|
27
28
|
export { Link, linkVariants, type LinkVariants } from "./Link/LinkApollo";
|
|
@@ -35,4 +36,6 @@ export { Svg } from "./Svg/Svg";
|
|
|
35
36
|
export { Tag, tagVariants, type TagVariants } from "./Tag/TagApollo";
|
|
36
37
|
export { TimelineVertical } from "./TimelineVertical/TimelineVerticalApollo";
|
|
37
38
|
export { Toggle } from "./Toggle/ToggleApollo";
|
|
39
|
+
export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
|
|
40
|
+
export { type OptionType } from "./Form/InputPhone/InputPhone.types";
|
|
38
41
|
export { Dropdown } from "./Form/Dropdown/DropdownApollo";
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
|
|
|
22
22
|
export { InputText } from "./Form/InputText/InputTextApollo";
|
|
23
23
|
export { DebugGrid } from "./Grid/DebugGridApollo";
|
|
24
24
|
export { Heading } from "./Heading/HeadingApollo";
|
|
25
|
+
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomApollo";
|
|
25
26
|
export { Icon, iconSizeVariants, iconVariants, } from "./Icon/IconApollo";
|
|
26
27
|
export { ItemTabBar, itemTabBarVariants, } from "./ItemTabBar/ItemTabBarApollo";
|
|
27
28
|
export { Link, linkVariants } from "./Link/LinkApollo";
|
|
@@ -35,4 +36,5 @@ export { Svg } from "./Svg/Svg";
|
|
|
35
36
|
export { Tag, tagVariants } from "./Tag/TagApollo";
|
|
36
37
|
export { TimelineVertical } from "./TimelineVertical/TimelineVerticalApollo";
|
|
37
38
|
export { Toggle } from "./Toggle/ToggleApollo";
|
|
39
|
+
export { InputPhone } from "./Form/InputPhone/InputPhoneApollo";
|
|
38
40
|
export { Dropdown } from "./Form/Dropdown/DropdownApollo";
|
package/dist/indexLF.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextLF";
|
|
|
16
16
|
export { InputDate,
|
|
17
17
|
/** @deprecated Use `InputDate` instead. */
|
|
18
18
|
InputDate as DateInput, } from "./Form/InputDate/InputDateLF";
|
|
19
|
+
export { InputPhone } from "./Form/InputPhone/InputPhoneLF";
|
|
19
20
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
20
21
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
21
22
|
export { TextArea } from "./Form/TextArea/TextAreaLF";
|
|
@@ -26,6 +27,7 @@ export { InputText,
|
|
|
26
27
|
InputText as TextInput, } from "./Form/InputText/InputTextLF";
|
|
27
28
|
export { DebugGrid } from "./Grid/DebugGridLF";
|
|
28
29
|
export { Heading, type HeadingLevel } from "./Heading/HeadingLF";
|
|
30
|
+
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomLF";
|
|
29
31
|
export { Icon, iconSizeVariants, iconVariants, type IconSizeVariants, type IconVariants, } from "./Icon/IconLF";
|
|
30
32
|
export { ItemTabBar, itemTabBarVariants, type ItemTabBarVariants, } from "./ItemTabBar/ItemTabBarLF";
|
|
31
33
|
export { Link, linkVariants, type LinkVariants } from "./Link/LinkLF";
|
|
@@ -39,4 +41,5 @@ export { Svg } from "./Svg/Svg";
|
|
|
39
41
|
export { Tag, tagVariants, type TagVariants } from "./Tag/TagLF";
|
|
40
42
|
export { TimelineVertical } from "./TimelineVertical/TimelineVerticalLF";
|
|
41
43
|
export { Toggle } from "./Toggle/ToggleLF";
|
|
44
|
+
export { type OptionType } from "./Form/InputPhone/InputPhone.types";
|
|
42
45
|
export { Dropdown } from "./Form/Dropdown/DropdownLF";
|
package/dist/indexLF.js
CHANGED
|
@@ -16,6 +16,7 @@ export { CheckboxText } from "./Form/Checkbox/CheckboxText/CheckboxTextLF";
|
|
|
16
16
|
export { InputDate,
|
|
17
17
|
/** @deprecated Use `InputDate` instead. */
|
|
18
18
|
InputDate as DateInput, } from "./Form/InputDate/InputDateLF";
|
|
19
|
+
export { InputPhone } from "./Form/InputPhone/InputPhoneLF";
|
|
19
20
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
20
21
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
21
22
|
export { TextArea } from "./Form/TextArea/TextAreaLF";
|
|
@@ -26,6 +27,7 @@ export { InputText,
|
|
|
26
27
|
InputText as TextInput, } from "./Form/InputText/InputTextLF";
|
|
27
28
|
export { DebugGrid } from "./Grid/DebugGridLF";
|
|
28
29
|
export { Heading } from "./Heading/HeadingLF";
|
|
30
|
+
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomLF";
|
|
29
31
|
export { Icon, iconSizeVariants, iconVariants, } from "./Icon/IconLF";
|
|
30
32
|
export { ItemTabBar, itemTabBarVariants, } from "./ItemTabBar/ItemTabBarLF";
|
|
31
33
|
export { Link, linkVariants } from "./Link/LinkLF";
|
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.
|
|
3
|
+
"version": "1.0.5-alpha.328",
|
|
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.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "1.0.5-alpha.328",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.328",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"@fontsource/source-sans-pro": "^5.2.5",
|
|
61
61
|
"@tanem/svg-injector": "^10.1.68",
|
|
62
62
|
"classnames": "^2.5.1",
|
|
63
|
-
"dompurify": "^3.1.5"
|
|
63
|
+
"dompurify": "^3.1.5",
|
|
64
|
+
"react-select": "^5.10.1"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@axa-fr/design-system-apollo-css": "*",
|