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

46 lines 2.69 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { STYLES_NAME } from '../../constants/stylesName/stylesName'; import { useInput } from '../../hooks/useInput/useInput'; import { useStyles } from '../../hooks/useStyles/useStyles'; import { InputTypeType } from '../../types/inputType/inputType'; import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary'; import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent'; import { INTERNAL_ERROR_EXECUTION, MASK_TYPE } from '../input/types/input'; import { InputPhoneStandAlone } from './inputPhoneStandAlone'; const InputPhoneComponent = React.forwardRef(({ type = InputTypeType.TEL, maskType = MASK_TYPE.NUMBERS, truncate = false, internalErrorExecution = 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 = useStyles(STYLES_NAME.INPUT_PHONE, props.variant, ctv); const { value, state, inputRef, handleChangeInternal, handleBlurInternal, handleFocusInternal, handleKeyDownInternal, handlePasteInternal, } = 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 (_jsx(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) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(InputPhoneStandAlone, { ...props, ref: ref }) }), children: _jsx(InputPhoneComponent, { ...props, ref: ref }) })); const InputPhone = React.forwardRef(InputPhoneBoundary); export { InputPhone }; //# sourceMappingURL=inputPhone.js.map