1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| import { cn } from "../../../../../utils/bem";
| import { FormField } from "../../FormField";
| import { default as Label } from "../Label/Label";
| import "./Input.scss";
|
| const Input = ({ label, className, validate, required, skip, labelProps, ghost, ...props }) => {
| const mods = {
| ghost,
| };
| const classList = [cn("form-input").mod(mods), className].join(" ").trim();
|
| const input = (
| <FormField label={label} name={props.name} validate={validate} required={required} skip={skip} {...props}>
| {({ ref }) => <input {...props} ref={ref} className={classList} />}
| </FormField>
| );
|
| return label ? (
| <Label {...(labelProps ?? {})} text={label} required={required}>
| {input}
| </Label>
| ) : (
| input
| );
| };
|
| export default Input;
|
|