epn-ui
Version:
Дизайн система кабинета ВМ
40 lines (37 loc) • 2.11 kB
JavaScript
import { __rest, __assign } from '../../_virtual/_tslib.js';
import React from 'react';
import clsx from 'clsx';
import Input from 'antd/lib/input';
import InputMask from 'antd-mask-input';
import InputTextArea from './textarea.js';
import InputTextPassword from './password.js';
function TextInput(_a) {
var className = _a.className, style = _a.style, placeholder = _a.placeholder, id = _a.id, maxLength = _a.maxLength, type = _a.type, value = _a.value, prefix = _a.prefix, suffix = _a.suffix, disabled = _a.disabled, readOnly = _a.readOnly, allowClear = _a.allowClear, mask = _a.mask, maskOptions = _a.maskOptions, autoComplete = _a.autoComplete, onChange = _a.onChange, onPressEnter = _a.onPressEnter, onClick = _a.onClick, onPaste = _a.onPaste, rest = __rest(_a, ["className", "style", "placeholder", "id", "maxLength", "type", "value", "prefix", "suffix", "disabled", "readOnly", "allowClear", "mask", "maskOptions", "autoComplete", "onChange", "onPressEnter", "onClick", "onPaste"]);
var commonCustomEpnProps = {
id: id,
style: style,
allowClear: allowClear,
type: type,
prefix: prefix,
suffix: suffix,
disabled: disabled,
readOnly: readOnly,
className: clsx('epn-inputText', className),
autoComplete: autoComplete,
onChange: onChange,
onPressEnter: onPressEnter,
onClick: onClick,
onPaste: onPaste,
};
if (typeof mask !== 'undefined') {
var onPasteFix = function (e) {
e.preventDefault();
};
return (React.createElement(InputMask, __assign({ value: typeof value === 'string' || typeof value === 'undefined' ? value : undefined, mask: mask, maskOptions: maskOptions }, commonCustomEpnProps, rest, { onPaste: onPasteFix })));
}
return (React.createElement(Input, __assign({ value: value, placeholder: placeholder, maxLength: maxLength }, commonCustomEpnProps, rest)));
}
TextInput.TextArea = InputTextArea;
TextInput.Password = InputTextPassword;
TextInput.OTP = Input.OTP;
export { TextInput as default };