hi-tm 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TextInputPropsType } from '../../types/Inputs/TextInputType';
|
|
3
3
|
interface TextInputProps extends TextInputPropsType {
|
|
4
4
|
applyConditionalStyles?: boolean;
|
|
5
|
+
maxLength?: number;
|
|
5
6
|
}
|
|
6
|
-
declare const TextInput: ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled, type, style, startContent, startContentStyle, placeHolderDirection, applyConditionalStyles, }: TextInputProps) => React.JSX.Element;
|
|
7
|
+
declare const TextInput: ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled, type, style, startContent, startContentStyle, placeHolderDirection, applyConditionalStyles, maxLength, }: TextInputProps) => React.JSX.Element;
|
|
7
8
|
export default TextInput;
|
|
@@ -38,7 +38,7 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const TextInput = ({ label, required, value, placeholderText, autoComplete, autoFocus, textError, onChangeValueHandler, onBlurHandler, onFocusHandler, onKeyUpHandler, onKeyDownHandler, disabled = false, type = 'text', style = {
|
|
39
39
|
margin: 'mt-[-6px]',
|
|
40
40
|
width: 'w-full',
|
|
41
|
-
}, startContent, startContentStyle, placeHolderDirection = 'ltr', applyConditionalStyles = false, }) => {
|
|
41
|
+
}, startContent, startContentStyle, placeHolderDirection = 'ltr', applyConditionalStyles = false, maxLength, }) => {
|
|
42
42
|
const [inputValue, setInputValue] = (0, react_1.useState)('');
|
|
43
43
|
const inputRef = (0, react_1.useRef)(null);
|
|
44
44
|
const handleInputChange = (e) => {
|
|
@@ -83,7 +83,7 @@ const TextInput = ({ label, required, value, placeholderText, autoComplete, auto
|
|
|
83
83
|
react_1.default.createElement("span", { className: `text-red-primary ${required ? 'opacity-100' : 'opacity-0'} ` }, "*")),
|
|
84
84
|
react_1.default.createElement("div", { className: "relative flex items-center" },
|
|
85
85
|
startContent && (react_1.default.createElement("div", { className: "absolute left-2 z-10", style: { ...startContentStyle } }, startContent)),
|
|
86
|
-
react_1.default.createElement("input", { ref: inputRef, type: type === 'captcha' ? 'tel' : type, id: label, disabled: disabled, value: value || inputValue, required: false, onChange: handleInputChange, onBlur: onBlurHandler ? onBlurHandler : () => { }, onFocus: handleFocus, onKeyDown: onKeyDownHandler ? onKeyDownHandler : () => { }, onKeyUp: onKeyUpHandler ? onKeyUpHandler : () => { }, placeholder: placeholderText, autoComplete: autoComplete ? 'on' : 'off', autoFocus: autoFocus, maxLength: type === 'captcha' ? 4 :
|
|
86
|
+
react_1.default.createElement("input", { ref: inputRef, type: type === 'captcha' ? 'tel' : type, id: label, disabled: disabled, value: value || inputValue, required: false, onChange: handleInputChange, onBlur: onBlurHandler ? onBlurHandler : () => { }, onFocus: handleFocus, onKeyDown: onKeyDownHandler ? onKeyDownHandler : () => { }, onKeyUp: onKeyUpHandler ? onKeyUpHandler : () => { }, placeholder: placeholderText, autoComplete: autoComplete ? 'on' : 'off', autoFocus: autoFocus, maxLength: type === 'captcha' ? 4 : maxLength, inputMode: type === 'captcha' ? 'numeric' : undefined, className: `input-style bg-inherit ${disabled ? 'cursor-not-allowed' : ''} text-gray-secondary ${textError === ''
|
|
87
87
|
? 'border-[2px] border-solid border-gray-tertiary'
|
|
88
88
|
: ' border-[2.5px] border-solid border-red-primary'} ${startContent ? 'pl-12' : ''} placeholder-rtl`, style: computedInputStyle })),
|
|
89
89
|
react_1.default.createElement("span", { className: `absolute bottom-0 text-sm mr-1 text-nowrap font-normal text-red-primary ${showError() ? 'opacity-0' : 'opacity-100'}` }, textError?.trim()))));
|