@axa-fr/design-system-apollo-react 1.0.3-alpha.153 → 1.0.3-alpha.154
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/TextInput/TextInputApollo.d.ts +4 -0
- package/dist/Form/TextInput/TextInputApollo.js +6 -0
- package/dist/Form/TextInput/TextInputCommon.d.ts +15 -0
- package/dist/Form/TextInput/TextInputCommon.js +14 -0
- package/dist/Form/TextInput/TextInputLF.d.ts +4 -0
- package/dist/Form/TextInput/TextInputLF.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/indexLF.d.ts +1 -0
- package/dist/indexLF.js +1 -0
- package/dist/utilities/getComponentClassName.d.ts +1 -0
- package/dist/utilities/getComponentClassName.js +26 -0
- package/package.json +3 -3
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/TextInput/TextInputApollo.scss";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { TextInput as TextInputCommon } from "./TextInputCommon";
|
|
4
|
+
export declare const TextInput: (props: Omit<ComponentProps<typeof TextInputCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/TextInput/TextInputApollo.scss";
|
|
3
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
4
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
5
|
+
import { TextInput as TextInputCommon } from "./TextInputCommon";
|
|
6
|
+
export const TextInput = (props) => (_jsx(TextInputCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
|
|
3
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
type TextInputProps = ComponentPropsWithRef<"input"> & {
|
|
5
|
+
unit?: React.ReactNode;
|
|
6
|
+
classModifier?: string;
|
|
7
|
+
helper?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
success?: string;
|
|
10
|
+
label: ComponentProps<typeof ItemLabel>["label"];
|
|
11
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabel>, "ButtonComponent">>;
|
|
12
|
+
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
13
|
+
} & Partial<ComponentPropsWithRef<typeof ItemLabel>>;
|
|
14
|
+
declare const TextInput: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
|
+
export { TextInput };
|
|
@@ -0,0 +1,14 @@
|
|
|
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 TextInput = forwardRef(({ unit, className, classModifier = "", helper, error, success, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, "aria-errormessage": ariaErrormessage, ...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
|
+
const idMessage = useId();
|
|
9
|
+
const idHelp = useId();
|
|
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 }), _jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: "text", ref: inputRef, "aria-labelledby": idLabel, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": idHelp, ...otherProps }), unit] }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error || success, messageType: error ? "error" : "success" })] }));
|
|
12
|
+
});
|
|
13
|
+
TextInput.displayName = "TextInput";
|
|
14
|
+
export { TextInput };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/TextInput/TextInputLF.scss";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { TextInput as TextInputCommon } from "./TextInputCommon";
|
|
4
|
+
export declare const TextInput: (props: Omit<ComponentProps<typeof TextInputCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-apollo-css/dist/Form/TextInput/TextInputLF.scss";
|
|
3
|
+
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
4
|
+
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
5
|
+
import { TextInput as TextInputCommon } from "./TextInputCommon";
|
|
6
|
+
export const TextInput = (props) => (_jsx(TextInputCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
|
package/dist/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export { Spinner, spinnerVariants, type SpinnerVariants, } from "./Spinner/Spinn
|
|
|
8
8
|
export { DebugGrid } from "./Grid/DebugGrid";
|
|
9
9
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
|
|
10
10
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
|
|
11
|
+
export { TextInput } from "./Form/TextInput/TextInputApollo";
|
package/dist/index.js
CHANGED
|
@@ -8,3 +8,4 @@ export { Spinner, spinnerVariants, } from "./Spinner/SpinnerApollo";
|
|
|
8
8
|
export { DebugGrid } from "./Grid/DebugGrid";
|
|
9
9
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
|
|
10
10
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
|
|
11
|
+
export { TextInput } from "./Form/TextInput/TextInputApollo";
|
package/dist/indexLF.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { Spinner, spinnerVariants, type SpinnerVariants, } from "./Spinner/Spinn
|
|
|
7
7
|
export { DebugGrid } from "./Grid/DebugGrid";
|
|
8
8
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
9
9
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
10
|
+
export { TextInput } from "./Form/TextInput/TextInputLF";
|
package/dist/indexLF.js
CHANGED
|
@@ -7,3 +7,4 @@ export { Spinner, spinnerVariants, } from "./Spinner/SpinnerLF";
|
|
|
7
7
|
export { DebugGrid } from "./Grid/DebugGrid";
|
|
8
8
|
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
9
9
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
10
|
+
export { TextInput } from "./Form/TextInput/TextInputLF";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getComponentClassName: (defaultClassName: string, className?: string, classModifier?: string) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
const getLastClassName = (defaultClassName) => {
|
|
3
|
+
if (!defaultClassName) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
return defaultClassName.split(" ").filter(Boolean).at(-1);
|
|
7
|
+
};
|
|
8
|
+
const listClassModifier = (classModifier) => {
|
|
9
|
+
if (!classModifier) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return classModifier.split(" ");
|
|
13
|
+
};
|
|
14
|
+
export const getComponentClassName = (defaultClassName, className, classModifier) => {
|
|
15
|
+
if (!defaultClassName) {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
const classWithoutModifier = getLastClassName(defaultClassName);
|
|
19
|
+
const modifiers = listClassModifier(classModifier);
|
|
20
|
+
const modifiersObject = modifiers
|
|
21
|
+
.filter((it) => /\S/.test(it))
|
|
22
|
+
.map((it) => {
|
|
23
|
+
return `${classWithoutModifier}--${it}`;
|
|
24
|
+
});
|
|
25
|
+
return classNames(defaultClassName, className, modifiersObject);
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-apollo-react",
|
|
3
|
-
"version": "1.0.3-alpha.
|
|
3
|
+
"version": "1.0.3-alpha.154",
|
|
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.3-alpha.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "1.0.3-alpha.154",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.154",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|