import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import { ReactNode } from "react"; import Validators from "../../Validators/Validators"; import BaseField, { IProps as IBaseFieldProps } from "../BaseField"; import classes from "./classes.module.scss"; export type IProps = IBaseFieldProps & { fakeplaceholder: string; textarea?: boolean; }; // @ts-ignore TODO: typing error on IProps (validator class?? cf Massi 22/02/23) export default class InputField extends BaseField { public override render(): ReactNode { let pattern; if (this.props.type === "number") { pattern = "(^[0-9]*)(\\.{0,1})([0-9]*)$"; } if (this.props.pattern) { pattern = this.props.pattern; } if (this.props.fieldRef) { this.fieldRef = this.props.fieldRef; } // we always need to control the input so we need to set the value as "" by default const value = this.state.value ?? ""; if (this.props.textarea === true) { return (