UNPKG

@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 3.22 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InputPhone = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = __importDefault(require("react")); const stylesName_1 = require("../../constants/stylesName/stylesName"); const useInput_1 = require("../../hooks/useInput/useInput"); const useStyles_1 = require("../../hooks/useStyles/useStyles"); const inputType_1 = require("../../types/inputType/inputType"); const errorBoundary_1 = require("../../provider/errorBoundary/errorBoundary"); const fallbackComponent_1 = require("../../provider/errorBoundary/fallbackComponent"); const input_1 = require("../input/types/input"); const inputPhoneStandAlone_1 = require("./inputPhoneStandAlone"); const InputPhoneComponent = react_1.default.forwardRef(({ type = inputType_1.InputTypeType.TEL, maskType = input_1.MASK_TYPE.NUMBERS, truncate = false, internalErrorExecution = input_1.INTERNAL_ERROR_EXECUTION.ON_CHANGE, errorExecution, keyValidation, min, max, maxLength, minLength, mask, disabled, error, value: currentValue, informationAssociatedValue, ignoreKeys, disabledCopyAndPaste, onBlur, onChange, onFocus, onKeyDown, onError, onInternalErrors, onPaste, ctv, ...props }, ref) => { const styles = (0, useStyles_1.useStyles)(stylesName_1.STYLES_NAME.INPUT_PHONE, props.variant, ctv); const { value, state, inputRef, handleChangeInternal, handleBlurInternal, handleFocusInternal, handleKeyDownInternal, handlePasteInternal, } = (0, useInput_1.useInput)({ ref, errorExecution, internalErrorExecution, keyValidation, max, min, maxLength, minLength, mask, maskType, disabled, error, currentValue, type, truncate, informationAssociated: informationAssociatedValue?.content, ignoreKeys, disabledCopyAndPaste, onBlur, onChange, onFocus, onKeyDown, onError, onInternalErrors, onPaste, }); return ((0, jsx_runtime_1.jsx)(inputPhoneStandAlone_1.InputPhoneStandAlone, { ...props, ref: inputRef, informationAssociatedValue: informationAssociatedValue, max: max, maxLength: maxLength, min: min, minLength: minLength, state: state, styles: styles, truncate: truncate, type: type, value: value, onBlur: handleBlurInternal, onChange: handleChangeInternal, onFocus: handleFocusInternal, onKeyDown: handleKeyDownInternal, onPaste: handlePasteInternal })); }); InputPhoneComponent.displayName = 'InputPhoneComponent'; const InputPhoneBoundary = (props, ref) => ((0, jsx_runtime_1.jsx)(errorBoundary_1.ErrorBoundary, { fallBackComponent: (0, jsx_runtime_1.jsx)(fallbackComponent_1.FallbackComponent, { children: (0, jsx_runtime_1.jsx)(inputPhoneStandAlone_1.InputPhoneStandAlone, { ...props, ref: ref }) }), children: (0, jsx_runtime_1.jsx)(InputPhoneComponent, { ...props, ref: ref }) })); const InputPhone = react_1.default.forwardRef(InputPhoneBoundary); exports.InputPhone = InputPhone; //# sourceMappingURL=inputPhone.js.map