2021-12-20 17:21:19 +00:00
|
|
|
import clsx from 'clsx';
|
2023-02-22 20:13:33 +00:00
|
|
|
import { forwardRef, InputHTMLAttributes, Ref } from 'react';
|
|
|
|
|
|
|
|
export const InputWithRef = forwardRef<
|
|
|
|
HTMLInputElement,
|
|
|
|
InputHTMLAttributes<HTMLInputElement>
|
|
|
|
>(
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
|
|
(props, ref) => <Input {...props} mRef={ref} />
|
|
|
|
);
|
2021-12-20 17:21:19 +00:00
|
|
|
|
|
|
|
export function Input({
|
|
|
|
className,
|
2023-02-22 20:13:33 +00:00
|
|
|
mRef: ref,
|
2021-12-20 17:21:19 +00:00
|
|
|
...props
|
2023-02-22 20:13:33 +00:00
|
|
|
}: InputHTMLAttributes<HTMLInputElement> & { mRef?: Ref<HTMLInputElement> }) {
|
2021-12-20 17:21:19 +00:00
|
|
|
return (
|
|
|
|
<input
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
|
|
{...props}
|
2023-02-22 20:13:33 +00:00
|
|
|
ref={ref}
|
2021-12-20 17:21:19 +00:00
|
|
|
className={clsx('form-control', className)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|