@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
52 lines • 2.75 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Input = exports.InputUnControlled = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const useInput_1 = require("../../hooks/useInput/useInput");
const inputControlled_1 = require("./inputControlled");
const input_1 = require("./types/input");
const inputType_1 = require("./types/inputType");
const InputUnControlledComponent = ({ type = inputType_1.InputTypeType.TEXT, truncate = false, internalErrorExecution = input_1.INTERNAL_ERROR_EXECUTION.ON_CHANGE_ON_BLUR, disabledArrowUpDownInputNumber = false, disabledWheelMouse = true, disabledCopyAndPaste, errorExecution, keyValidation, min, max, maxLength, minLength, mask, maskType, regex, disabled, error, value: currentValue, informationAssociatedValue, ignoreKeys, formatNumber, locale, onBlur, onChange, onFocus, onKeyDown, onError, onInternalErrors, onPaste, ...props }, ref) => {
const inputType = formatNumber ? inputType_1.InputTypeType.TEXT : type;
const { value, state, inputRef, handleChangeInternal, handleBlurInternal, handleFocusInternal, handleKeyDownInternal, handlePasteInternal, } = (0, useInput_1.useInput)({
ref,
errorExecution,
internalErrorExecution,
keyValidation,
disabledArrowUpDownInputNumber,
max,
min,
maxLength,
minLength,
mask,
maskType,
regex,
disabled,
error,
currentValue,
type: inputType,
truncate,
informationAssociated: informationAssociatedValue?.content,
ignoreKeys,
formatNumber,
locale,
disabledWheelMouse,
disabledCopyAndPaste,
onBlur,
onChange,
onFocus,
onKeyDown,
onError,
onInternalErrors,
onPaste,
});
return ((0, jsx_runtime_1.jsx)(inputControlled_1.InputControlled, { ...props, ref: inputRef, disabledArrowUpDownInputNumber: disabledArrowUpDownInputNumber, informationAssociatedValue: informationAssociatedValue, max: max, maxLength: maxLength, min: min, minLength: minLength, state: state, truncate: truncate, type: inputType, value: value, onBlur: handleBlurInternal, onChange: handleChangeInternal, onFocus: handleFocusInternal, onKeyDown: handleKeyDownInternal, onPaste: handlePasteInternal }));
};
const InputUnControlled = react_1.default.forwardRef(InputUnControlledComponent);
exports.InputUnControlled = InputUnControlled;
exports.Input = InputUnControlled;
//# sourceMappingURL=inputUnControlled.js.map