2021-02-03 11:43:38 +00:00
|
|
|
import React from "react";
|
|
|
|
import MaskedInput from "react-text-mask";
|
|
|
|
|
|
|
|
/* eslint-disable no-unused-vars, react/prop-types */
|
|
|
|
const Input = ({
|
2021-02-25 21:19:45 +00:00
|
|
|
isAutoFocussed,
|
|
|
|
isDisabled,
|
|
|
|
isReadOnly,
|
|
|
|
hasError,
|
|
|
|
hasWarning,
|
|
|
|
scale,
|
|
|
|
withBorder,
|
|
|
|
keepCharPositions,
|
|
|
|
fontWeight,
|
|
|
|
isBold,
|
2021-03-05 14:41:55 +00:00
|
|
|
forwardedRef,
|
2021-04-13 12:18:33 +00:00
|
|
|
className,
|
2022-01-25 07:56:51 +00:00
|
|
|
theme,
|
2021-02-25 21:19:45 +00:00
|
|
|
...props
|
2021-03-05 14:41:55 +00:00
|
|
|
}) => {
|
|
|
|
const rest = {};
|
|
|
|
|
|
|
|
if (isAutoFocussed) rest.autoFocus = true;
|
|
|
|
|
|
|
|
if (forwardedRef) rest.ref = forwardedRef;
|
|
|
|
|
|
|
|
return props.mask != null ? (
|
2021-04-13 12:18:33 +00:00
|
|
|
<MaskedInput
|
|
|
|
className={`${className} not-selectable`}
|
|
|
|
keepCharPositions
|
|
|
|
{...props}
|
|
|
|
/>
|
2021-02-25 21:19:45 +00:00
|
|
|
) : (
|
2022-01-27 13:54:58 +00:00
|
|
|
<input className={`${className} not-selectable`} {...props} {...rest} />
|
2021-02-25 21:19:45 +00:00
|
|
|
);
|
2021-03-05 14:41:55 +00:00
|
|
|
};
|
2021-02-25 21:19:45 +00:00
|
|
|
export default Input;
|