@xaypay/tui 0.1.2 → 0.1.4
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.
- package/dist/index.es.js +356 -192
- package/dist/index.js +356 -192
- package/package.json +1 -1
- package/tui.config.js +0 -3
package/dist/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
38
38
|
function unsafeStringify(arr, offset = 0) {
|
|
39
39
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
40
40
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
41
|
-
return
|
|
41
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
@@ -958,7 +958,7 @@ const File = ({
|
|
|
958
958
|
setSingleFile(null);
|
|
959
959
|
}
|
|
960
960
|
if (multiple && !removeFile) {
|
|
961
|
-
alert('Please add removeFile prop on
|
|
961
|
+
alert('Please add removeFile prop on File component, it is a require in multiple mode');
|
|
962
962
|
}
|
|
963
963
|
if (maxCHoosenLength) {
|
|
964
964
|
if (typeof maxCHoosenLength !== 'number') {
|
|
@@ -974,7 +974,7 @@ const File = ({
|
|
|
974
974
|
}, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
|
|
975
975
|
useEffect(() => {
|
|
976
976
|
if (deleteComponent && !removeComponent) {
|
|
977
|
-
alert('Please add removeComponent prop on
|
|
977
|
+
alert('Please add removeComponent prop on File component it is require when deleteComponent prop is true');
|
|
978
978
|
}
|
|
979
979
|
}, [deleteComponent]);
|
|
980
980
|
useEffect(() => {
|
|
@@ -2952,6 +2952,287 @@ Modal.defaultProps = {
|
|
|
2952
2952
|
type: 'content'
|
|
2953
2953
|
};
|
|
2954
2954
|
|
|
2955
|
+
const handleCheckTypeTel = (val, prevVal) => {
|
|
2956
|
+
const phoneNumberRegex = /^\d{0,8}$/;
|
|
2957
|
+
if (!phoneNumberRegex.test(val)) {
|
|
2958
|
+
val = prevVal;
|
|
2959
|
+
}
|
|
2960
|
+
return val;
|
|
2961
|
+
};
|
|
2962
|
+
const handleCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize) => {
|
|
2963
|
+
if (maxLength && maxLength > 0) {
|
|
2964
|
+
if (val.length > maxLength) {
|
|
2965
|
+
val = val.substr(0, maxLength);
|
|
2966
|
+
}
|
|
2967
|
+
} else {
|
|
2968
|
+
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
2969
|
+
if (val.length > 16 && !val.includes('.')) {
|
|
2970
|
+
val = val.substr(0, 16);
|
|
2971
|
+
}
|
|
2972
|
+
if (val < Number.MIN_SAFE_INTEGER || val > Number.MAX_SAFE_INTEGER || innerMinNumSize && val < innerMinNumSize || maxNumSize && val > maxNumSize) {
|
|
2973
|
+
val = prevVal;
|
|
2974
|
+
}
|
|
2975
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
2976
|
+
const int = floatNumParts[0];
|
|
2977
|
+
const float = floatNumParts[1];
|
|
2978
|
+
if (floatToFix > 0) {
|
|
2979
|
+
if (float && float.length > 0) {
|
|
2980
|
+
let floatResult = '';
|
|
2981
|
+
[...float].map((item, index) => {
|
|
2982
|
+
if (index + 1 <= floatToFix) {
|
|
2983
|
+
floatResult += item;
|
|
2984
|
+
}
|
|
2985
|
+
});
|
|
2986
|
+
floatResult !== '' ? val = `${int}.${floatResult}` : val = `${int}`;
|
|
2987
|
+
}
|
|
2988
|
+
} else {
|
|
2989
|
+
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
2990
|
+
val = `${int}`;
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
if (!regNum.test(val)) {
|
|
2994
|
+
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
2995
|
+
return b + c.replace(/\./g, '');
|
|
2996
|
+
});
|
|
2997
|
+
val = newStr;
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
if (withoutDot && !/^\d+$/.test(val)) {
|
|
3001
|
+
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3002
|
+
return b + c.replace(/\./g, '');
|
|
3003
|
+
});
|
|
3004
|
+
val = newStr;
|
|
3005
|
+
}
|
|
3006
|
+
return val;
|
|
3007
|
+
};
|
|
3008
|
+
|
|
3009
|
+
const TelInput = ({
|
|
3010
|
+
type,
|
|
3011
|
+
value,
|
|
3012
|
+
radius,
|
|
3013
|
+
isHover,
|
|
3014
|
+
disabled,
|
|
3015
|
+
inpStyles,
|
|
3016
|
+
errorColor,
|
|
3017
|
+
inputChange,
|
|
3018
|
+
phoneDisplay,
|
|
3019
|
+
inpAttributes,
|
|
3020
|
+
phoneAlignItems,
|
|
3021
|
+
innerErrorMessage,
|
|
3022
|
+
telBorderRightWidth,
|
|
3023
|
+
telBorderRightColor,
|
|
3024
|
+
telBorderRightStyle,
|
|
3025
|
+
phoneJustifyContent,
|
|
3026
|
+
telBorderRightColorHover
|
|
3027
|
+
}) => {
|
|
3028
|
+
const [innerValue, setInnerValue] = useState('');
|
|
3029
|
+
const handleChange = event => {
|
|
3030
|
+
let prevValue = innerValue;
|
|
3031
|
+
let currentValue = event.target.value;
|
|
3032
|
+
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
3033
|
+
setInnerValue(() => currentValue);
|
|
3034
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3035
|
+
inputChange(currentValue);
|
|
3036
|
+
}
|
|
3037
|
+
};
|
|
3038
|
+
useEffect(() => {
|
|
3039
|
+
let newValue = '';
|
|
3040
|
+
if (value !== undefined && value !== null) {
|
|
3041
|
+
newValue = handleCheckTypeTel(value, newValue);
|
|
3042
|
+
}
|
|
3043
|
+
setInnerValue(() => newValue);
|
|
3044
|
+
}, [value]);
|
|
3045
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
3046
|
+
style: {
|
|
3047
|
+
...inpStyles,
|
|
3048
|
+
width: 'auto',
|
|
3049
|
+
display: phoneDisplay,
|
|
3050
|
+
alignItems: phoneAlignItems,
|
|
3051
|
+
borderTopLeftRadius: radius,
|
|
3052
|
+
borderBottomLeftRadius: radius,
|
|
3053
|
+
justifyContent: phoneJustifyContent,
|
|
3054
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
3055
|
+
borderRight: `${telBorderRightWidth} ${telBorderRightStyle}`,
|
|
3056
|
+
borderColor: innerErrorMessage ? errorColor : isHover ? telBorderRightColorHover : telBorderRightColor
|
|
3057
|
+
}
|
|
3058
|
+
}, "+374"), /*#__PURE__*/React__default.createElement("input", {
|
|
3059
|
+
type: type,
|
|
3060
|
+
value: innerValue,
|
|
3061
|
+
disabled: disabled,
|
|
3062
|
+
onInput: handleChange,
|
|
3063
|
+
name: inpAttributes?.iName,
|
|
3064
|
+
placeholder: inpAttributes?.placeholder,
|
|
3065
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3066
|
+
style: {
|
|
3067
|
+
...inpStyles,
|
|
3068
|
+
border: 'none',
|
|
3069
|
+
outline: 'none',
|
|
3070
|
+
borderRadius: radius
|
|
3071
|
+
}
|
|
3072
|
+
}));
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
const TextInput = ({
|
|
3076
|
+
value,
|
|
3077
|
+
radius,
|
|
3078
|
+
inputChange,
|
|
3079
|
+
maxLength,
|
|
3080
|
+
inpStyles,
|
|
3081
|
+
inpAttributes
|
|
3082
|
+
}) => {
|
|
3083
|
+
const [innerValue, setInnerValue] = useState('');
|
|
3084
|
+
const handleChange = event => {
|
|
3085
|
+
let prevValue = innerValue;
|
|
3086
|
+
let currentValue = event.target.value;
|
|
3087
|
+
if (maxLength && currentValue.length > maxLength) {
|
|
3088
|
+
currentValue = currentValue.substr(0, maxLength);
|
|
3089
|
+
}
|
|
3090
|
+
setInnerValue(() => currentValue);
|
|
3091
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3092
|
+
inputChange(currentValue);
|
|
3093
|
+
}
|
|
3094
|
+
};
|
|
3095
|
+
useEffect(() => {
|
|
3096
|
+
let newValue = '';
|
|
3097
|
+
if (value !== undefined && value !== null) {
|
|
3098
|
+
newValue = value;
|
|
3099
|
+
if (maxLength && value.length > maxLength) {
|
|
3100
|
+
newValue = value.substr(0, maxLength);
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
setInnerValue(() => newValue);
|
|
3104
|
+
}, [value]);
|
|
3105
|
+
return /*#__PURE__*/React__default.createElement("input", {
|
|
3106
|
+
type: "text",
|
|
3107
|
+
value: innerValue,
|
|
3108
|
+
onInput: handleChange,
|
|
3109
|
+
name: inpAttributes?.iName,
|
|
3110
|
+
placeholder: inpAttributes?.placeholder,
|
|
3111
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3112
|
+
style: {
|
|
3113
|
+
...inpStyles,
|
|
3114
|
+
border: 'none',
|
|
3115
|
+
outline: 'none',
|
|
3116
|
+
borderRadius: radius
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
};
|
|
3120
|
+
|
|
3121
|
+
const PassInput = ({
|
|
3122
|
+
show,
|
|
3123
|
+
value,
|
|
3124
|
+
radius,
|
|
3125
|
+
inputChange,
|
|
3126
|
+
maxLength,
|
|
3127
|
+
inpAttributes,
|
|
3128
|
+
inpStyles
|
|
3129
|
+
}) => {
|
|
3130
|
+
const [innerShow, setInnerShow] = useState('');
|
|
3131
|
+
const [innerValue, setInnerValue] = useState('');
|
|
3132
|
+
const handleChange = event => {
|
|
3133
|
+
let prevValue = innerValue;
|
|
3134
|
+
let currentValue = event.target.value;
|
|
3135
|
+
if (maxLength && currentValue.length > maxLength) {
|
|
3136
|
+
currentValue = currentValue.substr(0, maxLength);
|
|
3137
|
+
}
|
|
3138
|
+
setInnerValue(() => currentValue);
|
|
3139
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3140
|
+
inputChange(currentValue);
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
useEffect(() => {
|
|
3144
|
+
let newValue = '';
|
|
3145
|
+
if (value !== undefined && value !== null) {
|
|
3146
|
+
newValue = value;
|
|
3147
|
+
if (maxLength && value.length > maxLength) {
|
|
3148
|
+
newValue = value.substr(0, maxLength);
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
setInnerValue(() => newValue);
|
|
3152
|
+
}, [value]);
|
|
3153
|
+
useEffect(() => {
|
|
3154
|
+
setInnerShow(show);
|
|
3155
|
+
}, [show]);
|
|
3156
|
+
return /*#__PURE__*/React__default.createElement("input", {
|
|
3157
|
+
type: innerShow ? 'text' : 'password',
|
|
3158
|
+
value: innerValue,
|
|
3159
|
+
onInput: handleChange,
|
|
3160
|
+
name: inpAttributes?.iName,
|
|
3161
|
+
placeholder: inpAttributes?.placeholder,
|
|
3162
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3163
|
+
style: {
|
|
3164
|
+
...inpStyles,
|
|
3165
|
+
border: 'none',
|
|
3166
|
+
outline: 'none',
|
|
3167
|
+
borderRadius: radius
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
};
|
|
3171
|
+
|
|
3172
|
+
const NumberInput = ({
|
|
3173
|
+
dots,
|
|
3174
|
+
value,
|
|
3175
|
+
float,
|
|
3176
|
+
radius,
|
|
3177
|
+
maxLength,
|
|
3178
|
+
inpStyles,
|
|
3179
|
+
minNumSize,
|
|
3180
|
+
maxNumSize,
|
|
3181
|
+
inputChange,
|
|
3182
|
+
inpAttributes
|
|
3183
|
+
}) => {
|
|
3184
|
+
const [innerValue, setInnerValue] = useState('');
|
|
3185
|
+
const [innerMinNumSize, setInnerMinNumSize] = useState(0);
|
|
3186
|
+
const handleChange = event => {
|
|
3187
|
+
let prevValue = innerValue;
|
|
3188
|
+
let currentValue = event.target.value;
|
|
3189
|
+
const max = maxLength ? maxLength : null;
|
|
3190
|
+
currentValue = handleCheckTypeNumber(currentValue, prevValue, max, float, maxNumSize, dots, innerMinNumSize);
|
|
3191
|
+
setInnerValue(() => currentValue);
|
|
3192
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3193
|
+
inputChange(currentValue);
|
|
3194
|
+
}
|
|
3195
|
+
};
|
|
3196
|
+
useEffect(() => {
|
|
3197
|
+
if (minNumSize && minNumSize < 0) {
|
|
3198
|
+
setInnerMinNumSize(0);
|
|
3199
|
+
alert("minNumSize prop can't be less then 0");
|
|
3200
|
+
} else if (minNumSize && minNumSize >= 0) {
|
|
3201
|
+
setInnerMinNumSize(minNumSize);
|
|
3202
|
+
}
|
|
3203
|
+
if ((maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3204
|
+
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3205
|
+
}
|
|
3206
|
+
if (maxNumSize < minNumSize) {
|
|
3207
|
+
alert("maxNumSize prop can't be less then minNumSize");
|
|
3208
|
+
}
|
|
3209
|
+
}, [maxLength, minNumSize, maxNumSize]);
|
|
3210
|
+
useEffect(() => {
|
|
3211
|
+
let newValue = '';
|
|
3212
|
+
if (value !== undefined && value !== null) {
|
|
3213
|
+
const max = maxLength ? maxLength : null;
|
|
3214
|
+
newValue = handleCheckTypeNumber(value, newValue, max, float, maxNumSize, dots, innerMinNumSize);
|
|
3215
|
+
}
|
|
3216
|
+
setInnerValue(() => newValue);
|
|
3217
|
+
}, [dots, value, float, maxNumSize, minNumSize]);
|
|
3218
|
+
return /*#__PURE__*/React__default.createElement("input", {
|
|
3219
|
+
type: "text",
|
|
3220
|
+
value: innerValue,
|
|
3221
|
+
name: inpAttributes?.iName,
|
|
3222
|
+
placeholder: inpAttributes?.placeholder,
|
|
3223
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3224
|
+
style: {
|
|
3225
|
+
...inpStyles,
|
|
3226
|
+
border: 'none',
|
|
3227
|
+
outline: 'none',
|
|
3228
|
+
borderRadius: radius
|
|
3229
|
+
},
|
|
3230
|
+
min: minNumSize,
|
|
3231
|
+
max: maxNumSize,
|
|
3232
|
+
onInput: handleChange
|
|
3233
|
+
});
|
|
3234
|
+
};
|
|
3235
|
+
|
|
2955
3236
|
var css_248z$9 = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{appearance:none!important;-webkit-appearance:none!important;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}input::-ms-clear,input::-ms-reveal{display:none}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
2956
3237
|
var styles$7 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
2957
3238
|
styleInject(css_248z$9);
|
|
@@ -2963,7 +3244,7 @@ const InputTypes = {
|
|
|
2963
3244
|
PASSWORD: 'password'
|
|
2964
3245
|
};
|
|
2965
3246
|
const P = styled.span`
|
|
2966
|
-
animation: ${
|
|
3247
|
+
animation: ${true};
|
|
2967
3248
|
`;
|
|
2968
3249
|
const Input = ({
|
|
2969
3250
|
type,
|
|
@@ -2985,7 +3266,6 @@ const Input = ({
|
|
|
2985
3266
|
leftIcon,
|
|
2986
3267
|
required,
|
|
2987
3268
|
disabled,
|
|
2988
|
-
transform,
|
|
2989
3269
|
iconWidth,
|
|
2990
3270
|
rightIcon,
|
|
2991
3271
|
className,
|
|
@@ -3015,7 +3295,6 @@ const Input = ({
|
|
|
3015
3295
|
errorMarginTop,
|
|
3016
3296
|
boxShadowHover,
|
|
3017
3297
|
errorClassName,
|
|
3018
|
-
errorAnimation,
|
|
3019
3298
|
labelFontFamily,
|
|
3020
3299
|
phoneAlignItems,
|
|
3021
3300
|
errorLineHeight,
|
|
@@ -3028,17 +3307,30 @@ const Input = ({
|
|
|
3028
3307
|
telBorderRightStyle,
|
|
3029
3308
|
telBorderRightColor,
|
|
3030
3309
|
backgroundDisableColor,
|
|
3031
|
-
|
|
3032
|
-
telBorderRightColorHover,
|
|
3033
|
-
...props
|
|
3310
|
+
telBorderRightColorHover
|
|
3034
3311
|
}) => {
|
|
3035
|
-
const phoneNumberRegex = /^\d+$/;
|
|
3036
3312
|
const [show, setShow] = useState(false);
|
|
3037
3313
|
const [isHover, setIsHover] = useState(false);
|
|
3038
|
-
const [innerValue, setInnerValue] = useState('');
|
|
3039
|
-
const [innerMinNumSize, setInnerMinNumSize] = useState(0);
|
|
3040
3314
|
const [innerErrorMessage, setInnerErrorMessage] = useState('');
|
|
3041
|
-
const
|
|
3315
|
+
const inpStyles = {
|
|
3316
|
+
width: width ?? merge.INPUT.width,
|
|
3317
|
+
cursor: disabled ? 'not-allowed' : 'auto',
|
|
3318
|
+
height: height ?? merge.INPUT.height,
|
|
3319
|
+
padding: padding ?? merge.INPUT.padding,
|
|
3320
|
+
fontSize: size ?? merge.INPUT.font.size,
|
|
3321
|
+
fontStyle: style ?? merge.INPUT.font.style,
|
|
3322
|
+
fontWeight: weight ?? merge.INPUT.font.weight,
|
|
3323
|
+
fontFamily: family ?? merge.INPUT.font.family,
|
|
3324
|
+
boxSizing: boxSizing ?? merge.INPUT.box.sizing,
|
|
3325
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : merge.INPUT.color,
|
|
3326
|
+
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : merge.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3327
|
+
};
|
|
3328
|
+
const uuid = v4();
|
|
3329
|
+
const inpAttributes = {
|
|
3330
|
+
placeholder: placeholder ?? '',
|
|
3331
|
+
iName: name ? name : `tui_${uuid}_tui`,
|
|
3332
|
+
autoComplete: autoComplete ?? merge.INPUT.autoComplete
|
|
3333
|
+
};
|
|
3042
3334
|
const classProps = classnames(className ?? merge.INPUT.className, type === 'number' ? styles$7['inp-num'] : '', styles$7['input-wrap']);
|
|
3043
3335
|
const errorShow = keyframes`
|
|
3044
3336
|
100% {
|
|
@@ -3051,102 +3343,8 @@ const Input = ({
|
|
|
3051
3343
|
}
|
|
3052
3344
|
`;
|
|
3053
3345
|
const animation = () => css`
|
|
3054
|
-
${errorShow}
|
|
3346
|
+
${errorShow} 240ms forwards
|
|
3055
3347
|
`;
|
|
3056
|
-
const handleCheckTypeTel = (val, prevVal) => {
|
|
3057
|
-
if (type === 'tel') {
|
|
3058
|
-
if (!phoneNumberRegex.test(val)) {
|
|
3059
|
-
if (val !== '') {
|
|
3060
|
-
val = prevVal;
|
|
3061
|
-
}
|
|
3062
|
-
} else {
|
|
3063
|
-
if (val.length > 8) {
|
|
3064
|
-
val = val.substr(0, 8);
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
return val;
|
|
3069
|
-
};
|
|
3070
|
-
const handleCheckTypeNumber = (val, prevVal) => {
|
|
3071
|
-
if (type === 'number') {
|
|
3072
|
-
if (maxLength && maxLength > 0) {
|
|
3073
|
-
if (val.length > maxLength) {
|
|
3074
|
-
val = val.substr(0, maxLength);
|
|
3075
|
-
}
|
|
3076
|
-
} else {
|
|
3077
|
-
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
3078
|
-
if (val.length > 16 && !val.includes('.')) {
|
|
3079
|
-
val = val.substr(0, 16);
|
|
3080
|
-
}
|
|
3081
|
-
if (val > Number.MAX_SAFE_INTEGER) {
|
|
3082
|
-
val = prevVal;
|
|
3083
|
-
}
|
|
3084
|
-
if (val < Number.MIN_SAFE_INTEGER) {
|
|
3085
|
-
val = prevVal;
|
|
3086
|
-
}
|
|
3087
|
-
if (innerMinNumSize && val < innerMinNumSize) {
|
|
3088
|
-
val = prevVal;
|
|
3089
|
-
}
|
|
3090
|
-
if (maxNumSize && val > maxNumSize) {
|
|
3091
|
-
val = prevVal;
|
|
3092
|
-
}
|
|
3093
|
-
if (floatToFix > 0) {
|
|
3094
|
-
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
3095
|
-
const int = floatNumParts[0];
|
|
3096
|
-
const float = floatNumParts[1];
|
|
3097
|
-
if (float && float.length > 0) {
|
|
3098
|
-
let floatResult = '';
|
|
3099
|
-
[...float].map((item, index) => {
|
|
3100
|
-
if (index + 1 <= floatToFix) {
|
|
3101
|
-
floatResult += item;
|
|
3102
|
-
}
|
|
3103
|
-
});
|
|
3104
|
-
if (floatResult !== '') {
|
|
3105
|
-
val = `${int}.${floatResult}`;
|
|
3106
|
-
} else {
|
|
3107
|
-
val = `${int}`;
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
} else {
|
|
3111
|
-
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
3112
|
-
const int = floatNumParts[0];
|
|
3113
|
-
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
3114
|
-
val = `${int}`;
|
|
3115
|
-
}
|
|
3116
|
-
}
|
|
3117
|
-
if (!regNum.test(val)) {
|
|
3118
|
-
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3119
|
-
return b + c.replace(/\./g, '');
|
|
3120
|
-
});
|
|
3121
|
-
val = newStr;
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3124
|
-
if (withoutDot && !/^\d+$/.test(val)) {
|
|
3125
|
-
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3126
|
-
return b + c.replace(/\./g, '');
|
|
3127
|
-
});
|
|
3128
|
-
val = newStr;
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
return val;
|
|
3132
|
-
};
|
|
3133
|
-
const handleChange = event => {
|
|
3134
|
-
let prevValue = innerValue;
|
|
3135
|
-
let currentValue = event.target.value;
|
|
3136
|
-
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : merge.INPUT.maxLength;
|
|
3137
|
-
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
3138
|
-
currentValue = handleCheckTypeNumber(currentValue, prevValue);
|
|
3139
|
-
if (max && currentValue.length > max && type !== 'tel' && type !== 'number') {
|
|
3140
|
-
currentValue = currentValue.substr(0, max);
|
|
3141
|
-
}
|
|
3142
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3143
|
-
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3144
|
-
}
|
|
3145
|
-
setInnerValue(() => currentValue);
|
|
3146
|
-
if (change && currentValue !== prevValue) {
|
|
3147
|
-
change(currentValue);
|
|
3148
|
-
}
|
|
3149
|
-
};
|
|
3150
3348
|
const handleMouseEnter = () => {
|
|
3151
3349
|
setIsHover(true);
|
|
3152
3350
|
};
|
|
@@ -3157,41 +3355,15 @@ const Input = ({
|
|
|
3157
3355
|
setShow(!show);
|
|
3158
3356
|
};
|
|
3159
3357
|
useEffect(() => {
|
|
3160
|
-
let newValue = value;
|
|
3161
3358
|
if (errorMessage) {
|
|
3162
3359
|
setInnerErrorMessage(errorMessage);
|
|
3163
3360
|
} else {
|
|
3164
3361
|
setInnerErrorMessage('');
|
|
3165
3362
|
}
|
|
3166
|
-
if (
|
|
3167
|
-
|
|
3168
|
-
alert("minNumSize prop can't be less then 0");
|
|
3169
|
-
} else if (minNumSize && minNumSize >= 0) {
|
|
3170
|
-
setInnerMinNumSize(minNumSize);
|
|
3171
|
-
}
|
|
3172
|
-
if (type === 'number' && (maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3173
|
-
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3174
|
-
}
|
|
3175
|
-
if (type === 'number' && maxNumSize < minNumSize) {
|
|
3176
|
-
alert("maxNumSize prop can't be less then minNumSize");
|
|
3177
|
-
}
|
|
3178
|
-
if (value !== undefined) {
|
|
3179
|
-
if (value === null) {
|
|
3180
|
-
newValue = '';
|
|
3181
|
-
} else {
|
|
3182
|
-
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : merge.INPUT.maxLength;
|
|
3183
|
-
newValue = handleCheckTypeTel(value, newValue);
|
|
3184
|
-
newValue = handleCheckTypeNumber(value, newValue);
|
|
3185
|
-
if (max && value.length > max && type !== 'tel' && type !== 'number') {
|
|
3186
|
-
newValue = value.substr(0, max);
|
|
3187
|
-
}
|
|
3188
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3189
|
-
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3190
|
-
}
|
|
3191
|
-
}
|
|
3363
|
+
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3364
|
+
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3192
3365
|
}
|
|
3193
|
-
|
|
3194
|
-
}, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage]);
|
|
3366
|
+
}, [type, regexp, errorMessage, regexpErrorMessage]);
|
|
3195
3367
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3196
3368
|
className: classProps
|
|
3197
3369
|
}, label ? /*#__PURE__*/React__default.createElement("label", {
|
|
@@ -3229,56 +3401,52 @@ const Input = ({
|
|
|
3229
3401
|
borderBottomLeftRadius: radius ?? merge.INPUT.radius,
|
|
3230
3402
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3231
3403
|
}
|
|
3232
|
-
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default.createElement(
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
type:
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
color: innerErrorMessage && errorColor ? errorColor : color ? color : merge.INPUT.color,
|
|
3279
|
-
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : merge.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3280
|
-
}
|
|
3281
|
-
})), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
3404
|
+
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default.createElement(TelInput, {
|
|
3405
|
+
type: type,
|
|
3406
|
+
value: value,
|
|
3407
|
+
inputChange: change,
|
|
3408
|
+
isHover: isHover,
|
|
3409
|
+
disabled: disabled,
|
|
3410
|
+
inpStyles: inpStyles,
|
|
3411
|
+
inpAttributes: inpAttributes,
|
|
3412
|
+
radius: radius ?? merge.INPUT.radius,
|
|
3413
|
+
phoneDisplay: phoneDisplay ?? merge.INPUT.tel.display,
|
|
3414
|
+
phoneAlignItems: phoneAlignItems ?? merge.INPUT.tel.alignItems,
|
|
3415
|
+
phoneJustifyContent: phoneJustifyContent ?? merge.INPUT.tel.justifyContent,
|
|
3416
|
+
telBorderRightWidth: telBorderRightWidth ?? merge.INPUT.tel.borderRight.width,
|
|
3417
|
+
telBorderRightStyle: telBorderRightStyle ?? merge.INPUT.tel.borderRight.style,
|
|
3418
|
+
telBorderRightColor: telBorderRightColor ?? merge.INPUT.tel.borderRight.color,
|
|
3419
|
+
telBorderRightColorHover: telBorderRightColorHover ?? merge.INPUT.tel.borderRight.colors.hover
|
|
3420
|
+
}) : type === 'number' ? /*#__PURE__*/React__default.createElement(NumberInput, {
|
|
3421
|
+
value: value,
|
|
3422
|
+
inputChange: change,
|
|
3423
|
+
dots: withoutDot,
|
|
3424
|
+
float: floatToFix,
|
|
3425
|
+
maxLength: maxLength,
|
|
3426
|
+
inpStyles: inpStyles,
|
|
3427
|
+
inpAttributes: inpAttributes,
|
|
3428
|
+
minNumSize: minNumSize ? minNumSize : '',
|
|
3429
|
+
maxNumSize: maxNumSize ? maxNumSize : '',
|
|
3430
|
+
radius: radius ?? merge.INPUT.radius
|
|
3431
|
+
}) : type === 'password' ? /*#__PURE__*/React__default.createElement(PassInput, {
|
|
3432
|
+
show: show,
|
|
3433
|
+
type: type,
|
|
3434
|
+
value: value,
|
|
3435
|
+
isHover: isHover,
|
|
3436
|
+
disabled: disabled,
|
|
3437
|
+
inputChange: change,
|
|
3438
|
+
maxLength: maxLength,
|
|
3439
|
+
inpStyles: inpStyles,
|
|
3440
|
+
inpAttributes: inpAttributes,
|
|
3441
|
+
radius: radius ?? merge.INPUT.radius
|
|
3442
|
+
}) : /*#__PURE__*/React__default.createElement(TextInput, {
|
|
3443
|
+
value: value,
|
|
3444
|
+
inputChange: change,
|
|
3445
|
+
inpStyles: inpStyles,
|
|
3446
|
+
maxLength: maxLength,
|
|
3447
|
+
inpAttributes: inpAttributes,
|
|
3448
|
+
radius: radius ?? merge.INPUT.radius
|
|
3449
|
+
}), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
3282
3450
|
onClick: type === 'password' ? handleShowPass : _ => _,
|
|
3283
3451
|
style: {
|
|
3284
3452
|
display: 'flex',
|
|
@@ -3294,7 +3462,6 @@ const Input = ({
|
|
|
3294
3462
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3295
3463
|
}
|
|
3296
3464
|
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default.createElement(P, {
|
|
3297
|
-
errorAnimation: errorAnimation ?? merge.INPUT.error.animation,
|
|
3298
3465
|
animation: animation,
|
|
3299
3466
|
style: {
|
|
3300
3467
|
margin: '0px',
|
|
@@ -3309,7 +3476,7 @@ const Input = ({
|
|
|
3309
3476
|
zIndex: errorZindex ?? merge.INPUT.error.zIndex,
|
|
3310
3477
|
lineHeight: errorLineHeight ?? merge.INPUT.error.lineHeight,
|
|
3311
3478
|
top: errorMarginTop ? `calc(100% + ${errorMarginTop})` : `calc(100% + ${merge.INPUT.error.marginTop})`,
|
|
3312
|
-
transform:
|
|
3479
|
+
transform: 'scale3d(1,1,1)'
|
|
3313
3480
|
},
|
|
3314
3481
|
className: errorClassName ?? merge.INPUT.error.className
|
|
3315
3482
|
}, innerErrorMessage) : '');
|
|
@@ -3331,7 +3498,6 @@ Input.propTypes = {
|
|
|
3331
3498
|
padding: PropTypes.string,
|
|
3332
3499
|
tooltip: PropTypes.element,
|
|
3333
3500
|
withoutDot: PropTypes.bool,
|
|
3334
|
-
transform: PropTypes.string,
|
|
3335
3501
|
className: PropTypes.string,
|
|
3336
3502
|
iconWidth: PropTypes.string,
|
|
3337
3503
|
boxSizing: PropTypes.string,
|
|
@@ -3356,7 +3522,6 @@ Input.propTypes = {
|
|
|
3356
3522
|
errorMessage: PropTypes.string,
|
|
3357
3523
|
phoneDisplay: PropTypes.string,
|
|
3358
3524
|
autoComplete: PropTypes.string,
|
|
3359
|
-
errorAnimation: PropTypes.bool,
|
|
3360
3525
|
labelDisplay: PropTypes.string,
|
|
3361
3526
|
errorPosition: PropTypes.string,
|
|
3362
3527
|
errorMarginTop: PropTypes.string,
|
|
@@ -3375,7 +3540,6 @@ Input.propTypes = {
|
|
|
3375
3540
|
telBorderRightColor: PropTypes.string,
|
|
3376
3541
|
phoneJustifyContent: PropTypes.string,
|
|
3377
3542
|
backgroundDisableColor: PropTypes.string,
|
|
3378
|
-
errorAnimationDuration: PropTypes.string,
|
|
3379
3543
|
telBorderRightColorHover: PropTypes.string,
|
|
3380
3544
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
3381
3545
|
rightIcon: PropTypes.arrayOf(PropTypes.element),
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
68
68
|
function unsafeStringify(arr, offset = 0) {
|
|
69
69
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
70
70
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
71
|
-
return
|
|
71
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
@@ -988,7 +988,7 @@ const File = ({
|
|
|
988
988
|
setSingleFile(null);
|
|
989
989
|
}
|
|
990
990
|
if (multiple && !removeFile) {
|
|
991
|
-
alert('Please add removeFile prop on
|
|
991
|
+
alert('Please add removeFile prop on File component, it is a require in multiple mode');
|
|
992
992
|
}
|
|
993
993
|
if (maxCHoosenLength) {
|
|
994
994
|
if (typeof maxCHoosenLength !== 'number') {
|
|
@@ -1004,7 +1004,7 @@ const File = ({
|
|
|
1004
1004
|
}, [multiple, removeFile, filesArray && filesArray.length, defaultData, maxCHoosenLength]);
|
|
1005
1005
|
React.useEffect(() => {
|
|
1006
1006
|
if (deleteComponent && !removeComponent) {
|
|
1007
|
-
alert('Please add removeComponent prop on
|
|
1007
|
+
alert('Please add removeComponent prop on File component it is require when deleteComponent prop is true');
|
|
1008
1008
|
}
|
|
1009
1009
|
}, [deleteComponent]);
|
|
1010
1010
|
React.useEffect(() => {
|
|
@@ -2982,6 +2982,287 @@ Modal.defaultProps = {
|
|
|
2982
2982
|
type: 'content'
|
|
2983
2983
|
};
|
|
2984
2984
|
|
|
2985
|
+
const handleCheckTypeTel = (val, prevVal) => {
|
|
2986
|
+
const phoneNumberRegex = /^\d{0,8}$/;
|
|
2987
|
+
if (!phoneNumberRegex.test(val)) {
|
|
2988
|
+
val = prevVal;
|
|
2989
|
+
}
|
|
2990
|
+
return val;
|
|
2991
|
+
};
|
|
2992
|
+
const handleCheckTypeNumber = (val, prevVal, maxLength, floatToFix, maxNumSize, withoutDot, innerMinNumSize) => {
|
|
2993
|
+
if (maxLength && maxLength > 0) {
|
|
2994
|
+
if (val.length > maxLength) {
|
|
2995
|
+
val = val.substr(0, maxLength);
|
|
2996
|
+
}
|
|
2997
|
+
} else {
|
|
2998
|
+
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
2999
|
+
if (val.length > 16 && !val.includes('.')) {
|
|
3000
|
+
val = val.substr(0, 16);
|
|
3001
|
+
}
|
|
3002
|
+
if (val < Number.MIN_SAFE_INTEGER || val > Number.MAX_SAFE_INTEGER || innerMinNumSize && val < innerMinNumSize || maxNumSize && val > maxNumSize) {
|
|
3003
|
+
val = prevVal;
|
|
3004
|
+
}
|
|
3005
|
+
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
3006
|
+
const int = floatNumParts[0];
|
|
3007
|
+
const float = floatNumParts[1];
|
|
3008
|
+
if (floatToFix > 0) {
|
|
3009
|
+
if (float && float.length > 0) {
|
|
3010
|
+
let floatResult = '';
|
|
3011
|
+
[...float].map((item, index) => {
|
|
3012
|
+
if (index + 1 <= floatToFix) {
|
|
3013
|
+
floatResult += item;
|
|
3014
|
+
}
|
|
3015
|
+
});
|
|
3016
|
+
floatResult !== '' ? val = `${int}.${floatResult}` : val = `${int}`;
|
|
3017
|
+
}
|
|
3018
|
+
} else {
|
|
3019
|
+
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
3020
|
+
val = `${int}`;
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
if (!regNum.test(val)) {
|
|
3024
|
+
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3025
|
+
return b + c.replace(/\./g, '');
|
|
3026
|
+
});
|
|
3027
|
+
val = newStr;
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
if (withoutDot && !/^\d+$/.test(val)) {
|
|
3031
|
+
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3032
|
+
return b + c.replace(/\./g, '');
|
|
3033
|
+
});
|
|
3034
|
+
val = newStr;
|
|
3035
|
+
}
|
|
3036
|
+
return val;
|
|
3037
|
+
};
|
|
3038
|
+
|
|
3039
|
+
const TelInput = ({
|
|
3040
|
+
type,
|
|
3041
|
+
value,
|
|
3042
|
+
radius,
|
|
3043
|
+
isHover,
|
|
3044
|
+
disabled,
|
|
3045
|
+
inpStyles,
|
|
3046
|
+
errorColor,
|
|
3047
|
+
inputChange,
|
|
3048
|
+
phoneDisplay,
|
|
3049
|
+
inpAttributes,
|
|
3050
|
+
phoneAlignItems,
|
|
3051
|
+
innerErrorMessage,
|
|
3052
|
+
telBorderRightWidth,
|
|
3053
|
+
telBorderRightColor,
|
|
3054
|
+
telBorderRightStyle,
|
|
3055
|
+
phoneJustifyContent,
|
|
3056
|
+
telBorderRightColorHover
|
|
3057
|
+
}) => {
|
|
3058
|
+
const [innerValue, setInnerValue] = React.useState('');
|
|
3059
|
+
const handleChange = event => {
|
|
3060
|
+
let prevValue = innerValue;
|
|
3061
|
+
let currentValue = event.target.value;
|
|
3062
|
+
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
3063
|
+
setInnerValue(() => currentValue);
|
|
3064
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3065
|
+
inputChange(currentValue);
|
|
3066
|
+
}
|
|
3067
|
+
};
|
|
3068
|
+
React.useEffect(() => {
|
|
3069
|
+
let newValue = '';
|
|
3070
|
+
if (value !== undefined && value !== null) {
|
|
3071
|
+
newValue = handleCheckTypeTel(value, newValue);
|
|
3072
|
+
}
|
|
3073
|
+
setInnerValue(() => newValue);
|
|
3074
|
+
}, [value]);
|
|
3075
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3076
|
+
style: {
|
|
3077
|
+
...inpStyles,
|
|
3078
|
+
width: 'auto',
|
|
3079
|
+
display: phoneDisplay,
|
|
3080
|
+
alignItems: phoneAlignItems,
|
|
3081
|
+
borderTopLeftRadius: radius,
|
|
3082
|
+
borderBottomLeftRadius: radius,
|
|
3083
|
+
justifyContent: phoneJustifyContent,
|
|
3084
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
3085
|
+
borderRight: `${telBorderRightWidth} ${telBorderRightStyle}`,
|
|
3086
|
+
borderColor: innerErrorMessage ? errorColor : isHover ? telBorderRightColorHover : telBorderRightColor
|
|
3087
|
+
}
|
|
3088
|
+
}, "+374"), /*#__PURE__*/React__default["default"].createElement("input", {
|
|
3089
|
+
type: type,
|
|
3090
|
+
value: innerValue,
|
|
3091
|
+
disabled: disabled,
|
|
3092
|
+
onInput: handleChange,
|
|
3093
|
+
name: inpAttributes?.iName,
|
|
3094
|
+
placeholder: inpAttributes?.placeholder,
|
|
3095
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3096
|
+
style: {
|
|
3097
|
+
...inpStyles,
|
|
3098
|
+
border: 'none',
|
|
3099
|
+
outline: 'none',
|
|
3100
|
+
borderRadius: radius
|
|
3101
|
+
}
|
|
3102
|
+
}));
|
|
3103
|
+
};
|
|
3104
|
+
|
|
3105
|
+
const TextInput = ({
|
|
3106
|
+
value,
|
|
3107
|
+
radius,
|
|
3108
|
+
inputChange,
|
|
3109
|
+
maxLength,
|
|
3110
|
+
inpStyles,
|
|
3111
|
+
inpAttributes
|
|
3112
|
+
}) => {
|
|
3113
|
+
const [innerValue, setInnerValue] = React.useState('');
|
|
3114
|
+
const handleChange = event => {
|
|
3115
|
+
let prevValue = innerValue;
|
|
3116
|
+
let currentValue = event.target.value;
|
|
3117
|
+
if (maxLength && currentValue.length > maxLength) {
|
|
3118
|
+
currentValue = currentValue.substr(0, maxLength);
|
|
3119
|
+
}
|
|
3120
|
+
setInnerValue(() => currentValue);
|
|
3121
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3122
|
+
inputChange(currentValue);
|
|
3123
|
+
}
|
|
3124
|
+
};
|
|
3125
|
+
React.useEffect(() => {
|
|
3126
|
+
let newValue = '';
|
|
3127
|
+
if (value !== undefined && value !== null) {
|
|
3128
|
+
newValue = value;
|
|
3129
|
+
if (maxLength && value.length > maxLength) {
|
|
3130
|
+
newValue = value.substr(0, maxLength);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
setInnerValue(() => newValue);
|
|
3134
|
+
}, [value]);
|
|
3135
|
+
return /*#__PURE__*/React__default["default"].createElement("input", {
|
|
3136
|
+
type: "text",
|
|
3137
|
+
value: innerValue,
|
|
3138
|
+
onInput: handleChange,
|
|
3139
|
+
name: inpAttributes?.iName,
|
|
3140
|
+
placeholder: inpAttributes?.placeholder,
|
|
3141
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3142
|
+
style: {
|
|
3143
|
+
...inpStyles,
|
|
3144
|
+
border: 'none',
|
|
3145
|
+
outline: 'none',
|
|
3146
|
+
borderRadius: radius
|
|
3147
|
+
}
|
|
3148
|
+
});
|
|
3149
|
+
};
|
|
3150
|
+
|
|
3151
|
+
const PassInput = ({
|
|
3152
|
+
show,
|
|
3153
|
+
value,
|
|
3154
|
+
radius,
|
|
3155
|
+
inputChange,
|
|
3156
|
+
maxLength,
|
|
3157
|
+
inpAttributes,
|
|
3158
|
+
inpStyles
|
|
3159
|
+
}) => {
|
|
3160
|
+
const [innerShow, setInnerShow] = React.useState('');
|
|
3161
|
+
const [innerValue, setInnerValue] = React.useState('');
|
|
3162
|
+
const handleChange = event => {
|
|
3163
|
+
let prevValue = innerValue;
|
|
3164
|
+
let currentValue = event.target.value;
|
|
3165
|
+
if (maxLength && currentValue.length > maxLength) {
|
|
3166
|
+
currentValue = currentValue.substr(0, maxLength);
|
|
3167
|
+
}
|
|
3168
|
+
setInnerValue(() => currentValue);
|
|
3169
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3170
|
+
inputChange(currentValue);
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3173
|
+
React.useEffect(() => {
|
|
3174
|
+
let newValue = '';
|
|
3175
|
+
if (value !== undefined && value !== null) {
|
|
3176
|
+
newValue = value;
|
|
3177
|
+
if (maxLength && value.length > maxLength) {
|
|
3178
|
+
newValue = value.substr(0, maxLength);
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
setInnerValue(() => newValue);
|
|
3182
|
+
}, [value]);
|
|
3183
|
+
React.useEffect(() => {
|
|
3184
|
+
setInnerShow(show);
|
|
3185
|
+
}, [show]);
|
|
3186
|
+
return /*#__PURE__*/React__default["default"].createElement("input", {
|
|
3187
|
+
type: innerShow ? 'text' : 'password',
|
|
3188
|
+
value: innerValue,
|
|
3189
|
+
onInput: handleChange,
|
|
3190
|
+
name: inpAttributes?.iName,
|
|
3191
|
+
placeholder: inpAttributes?.placeholder,
|
|
3192
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3193
|
+
style: {
|
|
3194
|
+
...inpStyles,
|
|
3195
|
+
border: 'none',
|
|
3196
|
+
outline: 'none',
|
|
3197
|
+
borderRadius: radius
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
};
|
|
3201
|
+
|
|
3202
|
+
const NumberInput = ({
|
|
3203
|
+
dots,
|
|
3204
|
+
value,
|
|
3205
|
+
float,
|
|
3206
|
+
radius,
|
|
3207
|
+
maxLength,
|
|
3208
|
+
inpStyles,
|
|
3209
|
+
minNumSize,
|
|
3210
|
+
maxNumSize,
|
|
3211
|
+
inputChange,
|
|
3212
|
+
inpAttributes
|
|
3213
|
+
}) => {
|
|
3214
|
+
const [innerValue, setInnerValue] = React.useState('');
|
|
3215
|
+
const [innerMinNumSize, setInnerMinNumSize] = React.useState(0);
|
|
3216
|
+
const handleChange = event => {
|
|
3217
|
+
let prevValue = innerValue;
|
|
3218
|
+
let currentValue = event.target.value;
|
|
3219
|
+
const max = maxLength ? maxLength : null;
|
|
3220
|
+
currentValue = handleCheckTypeNumber(currentValue, prevValue, max, float, maxNumSize, dots, innerMinNumSize);
|
|
3221
|
+
setInnerValue(() => currentValue);
|
|
3222
|
+
if (inputChange && currentValue !== prevValue) {
|
|
3223
|
+
inputChange(currentValue);
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
React.useEffect(() => {
|
|
3227
|
+
if (minNumSize && minNumSize < 0) {
|
|
3228
|
+
setInnerMinNumSize(0);
|
|
3229
|
+
alert("minNumSize prop can't be less then 0");
|
|
3230
|
+
} else if (minNumSize && minNumSize >= 0) {
|
|
3231
|
+
setInnerMinNumSize(minNumSize);
|
|
3232
|
+
}
|
|
3233
|
+
if ((maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3234
|
+
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3235
|
+
}
|
|
3236
|
+
if (maxNumSize < minNumSize) {
|
|
3237
|
+
alert("maxNumSize prop can't be less then minNumSize");
|
|
3238
|
+
}
|
|
3239
|
+
}, [maxLength, minNumSize, maxNumSize]);
|
|
3240
|
+
React.useEffect(() => {
|
|
3241
|
+
let newValue = '';
|
|
3242
|
+
if (value !== undefined && value !== null) {
|
|
3243
|
+
const max = maxLength ? maxLength : null;
|
|
3244
|
+
newValue = handleCheckTypeNumber(value, newValue, max, float, maxNumSize, dots, innerMinNumSize);
|
|
3245
|
+
}
|
|
3246
|
+
setInnerValue(() => newValue);
|
|
3247
|
+
}, [dots, value, float, maxNumSize, minNumSize]);
|
|
3248
|
+
return /*#__PURE__*/React__default["default"].createElement("input", {
|
|
3249
|
+
type: "text",
|
|
3250
|
+
value: innerValue,
|
|
3251
|
+
name: inpAttributes?.iName,
|
|
3252
|
+
placeholder: inpAttributes?.placeholder,
|
|
3253
|
+
autoComplete: inpAttributes?.autoComplete,
|
|
3254
|
+
style: {
|
|
3255
|
+
...inpStyles,
|
|
3256
|
+
border: 'none',
|
|
3257
|
+
outline: 'none',
|
|
3258
|
+
borderRadius: radius
|
|
3259
|
+
},
|
|
3260
|
+
min: minNumSize,
|
|
3261
|
+
max: maxNumSize,
|
|
3262
|
+
onInput: handleChange
|
|
3263
|
+
});
|
|
3264
|
+
};
|
|
3265
|
+
|
|
2985
3266
|
var css_248z$9 = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{appearance:none!important;-webkit-appearance:none!important;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}input::-ms-clear,input::-ms-reveal{display:none}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
2986
3267
|
var styles$7 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
2987
3268
|
styleInject(css_248z$9);
|
|
@@ -2993,7 +3274,7 @@ const InputTypes = {
|
|
|
2993
3274
|
PASSWORD: 'password'
|
|
2994
3275
|
};
|
|
2995
3276
|
const P = styled__default["default"].span`
|
|
2996
|
-
animation: ${
|
|
3277
|
+
animation: ${true};
|
|
2997
3278
|
`;
|
|
2998
3279
|
const Input = ({
|
|
2999
3280
|
type,
|
|
@@ -3015,7 +3296,6 @@ const Input = ({
|
|
|
3015
3296
|
leftIcon,
|
|
3016
3297
|
required,
|
|
3017
3298
|
disabled,
|
|
3018
|
-
transform,
|
|
3019
3299
|
iconWidth,
|
|
3020
3300
|
rightIcon,
|
|
3021
3301
|
className,
|
|
@@ -3045,7 +3325,6 @@ const Input = ({
|
|
|
3045
3325
|
errorMarginTop,
|
|
3046
3326
|
boxShadowHover,
|
|
3047
3327
|
errorClassName,
|
|
3048
|
-
errorAnimation,
|
|
3049
3328
|
labelFontFamily,
|
|
3050
3329
|
phoneAlignItems,
|
|
3051
3330
|
errorLineHeight,
|
|
@@ -3058,17 +3337,30 @@ const Input = ({
|
|
|
3058
3337
|
telBorderRightStyle,
|
|
3059
3338
|
telBorderRightColor,
|
|
3060
3339
|
backgroundDisableColor,
|
|
3061
|
-
|
|
3062
|
-
telBorderRightColorHover,
|
|
3063
|
-
...props
|
|
3340
|
+
telBorderRightColorHover
|
|
3064
3341
|
}) => {
|
|
3065
|
-
const phoneNumberRegex = /^\d+$/;
|
|
3066
3342
|
const [show, setShow] = React.useState(false);
|
|
3067
3343
|
const [isHover, setIsHover] = React.useState(false);
|
|
3068
|
-
const [innerValue, setInnerValue] = React.useState('');
|
|
3069
|
-
const [innerMinNumSize, setInnerMinNumSize] = React.useState(0);
|
|
3070
3344
|
const [innerErrorMessage, setInnerErrorMessage] = React.useState('');
|
|
3071
|
-
const
|
|
3345
|
+
const inpStyles = {
|
|
3346
|
+
width: width ?? merge.INPUT.width,
|
|
3347
|
+
cursor: disabled ? 'not-allowed' : 'auto',
|
|
3348
|
+
height: height ?? merge.INPUT.height,
|
|
3349
|
+
padding: padding ?? merge.INPUT.padding,
|
|
3350
|
+
fontSize: size ?? merge.INPUT.font.size,
|
|
3351
|
+
fontStyle: style ?? merge.INPUT.font.style,
|
|
3352
|
+
fontWeight: weight ?? merge.INPUT.font.weight,
|
|
3353
|
+
fontFamily: family ?? merge.INPUT.font.family,
|
|
3354
|
+
boxSizing: boxSizing ?? merge.INPUT.box.sizing,
|
|
3355
|
+
color: innerErrorMessage && errorColor ? errorColor : color ? color : merge.INPUT.color,
|
|
3356
|
+
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : merge.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3357
|
+
};
|
|
3358
|
+
const uuid = v4();
|
|
3359
|
+
const inpAttributes = {
|
|
3360
|
+
placeholder: placeholder ?? '',
|
|
3361
|
+
iName: name ? name : `tui_${uuid}_tui`,
|
|
3362
|
+
autoComplete: autoComplete ?? merge.INPUT.autoComplete
|
|
3363
|
+
};
|
|
3072
3364
|
const classProps = classnames__default["default"](className ?? merge.INPUT.className, type === 'number' ? styles$7['inp-num'] : '', styles$7['input-wrap']);
|
|
3073
3365
|
const errorShow = styled.keyframes`
|
|
3074
3366
|
100% {
|
|
@@ -3081,102 +3373,8 @@ const Input = ({
|
|
|
3081
3373
|
}
|
|
3082
3374
|
`;
|
|
3083
3375
|
const animation = () => styled.css`
|
|
3084
|
-
${errorShow}
|
|
3376
|
+
${errorShow} 240ms forwards
|
|
3085
3377
|
`;
|
|
3086
|
-
const handleCheckTypeTel = (val, prevVal) => {
|
|
3087
|
-
if (type === 'tel') {
|
|
3088
|
-
if (!phoneNumberRegex.test(val)) {
|
|
3089
|
-
if (val !== '') {
|
|
3090
|
-
val = prevVal;
|
|
3091
|
-
}
|
|
3092
|
-
} else {
|
|
3093
|
-
if (val.length > 8) {
|
|
3094
|
-
val = val.substr(0, 8);
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
}
|
|
3098
|
-
return val;
|
|
3099
|
-
};
|
|
3100
|
-
const handleCheckTypeNumber = (val, prevVal) => {
|
|
3101
|
-
if (type === 'number') {
|
|
3102
|
-
if (maxLength && maxLength > 0) {
|
|
3103
|
-
if (val.length > maxLength) {
|
|
3104
|
-
val = val.substr(0, maxLength);
|
|
3105
|
-
}
|
|
3106
|
-
} else {
|
|
3107
|
-
const regNum = floatToFix && floatToFix >= 0 ? /^\d+(\.)?(\d+)?$/ : /^\d+$/;
|
|
3108
|
-
if (val.length > 16 && !val.includes('.')) {
|
|
3109
|
-
val = val.substr(0, 16);
|
|
3110
|
-
}
|
|
3111
|
-
if (val > Number.MAX_SAFE_INTEGER) {
|
|
3112
|
-
val = prevVal;
|
|
3113
|
-
}
|
|
3114
|
-
if (val < Number.MIN_SAFE_INTEGER) {
|
|
3115
|
-
val = prevVal;
|
|
3116
|
-
}
|
|
3117
|
-
if (innerMinNumSize && val < innerMinNumSize) {
|
|
3118
|
-
val = prevVal;
|
|
3119
|
-
}
|
|
3120
|
-
if (maxNumSize && val > maxNumSize) {
|
|
3121
|
-
val = prevVal;
|
|
3122
|
-
}
|
|
3123
|
-
if (floatToFix > 0) {
|
|
3124
|
-
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
3125
|
-
const int = floatNumParts[0];
|
|
3126
|
-
const float = floatNumParts[1];
|
|
3127
|
-
if (float && float.length > 0) {
|
|
3128
|
-
let floatResult = '';
|
|
3129
|
-
[...float].map((item, index) => {
|
|
3130
|
-
if (index + 1 <= floatToFix) {
|
|
3131
|
-
floatResult += item;
|
|
3132
|
-
}
|
|
3133
|
-
});
|
|
3134
|
-
if (floatResult !== '') {
|
|
3135
|
-
val = `${int}.${floatResult}`;
|
|
3136
|
-
} else {
|
|
3137
|
-
val = `${int}`;
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
} else {
|
|
3141
|
-
const floatNumParts = typeof val === 'string' ? val.split('.') : val;
|
|
3142
|
-
const int = floatNumParts[0];
|
|
3143
|
-
if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
|
|
3144
|
-
val = `${int}`;
|
|
3145
|
-
}
|
|
3146
|
-
}
|
|
3147
|
-
if (!regNum.test(val)) {
|
|
3148
|
-
const newStr = val.replace(/[^0-9.]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3149
|
-
return b + c.replace(/\./g, '');
|
|
3150
|
-
});
|
|
3151
|
-
val = newStr;
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
if (withoutDot && !/^\d+$/.test(val)) {
|
|
3155
|
-
const newStr = val.replace(/[^0-9]/g, '').replace(/^([^.]*\.)(.*)$/, function (_, b, c) {
|
|
3156
|
-
return b + c.replace(/\./g, '');
|
|
3157
|
-
});
|
|
3158
|
-
val = newStr;
|
|
3159
|
-
}
|
|
3160
|
-
}
|
|
3161
|
-
return val;
|
|
3162
|
-
};
|
|
3163
|
-
const handleChange = event => {
|
|
3164
|
-
let prevValue = innerValue;
|
|
3165
|
-
let currentValue = event.target.value;
|
|
3166
|
-
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : merge.INPUT.maxLength;
|
|
3167
|
-
currentValue = handleCheckTypeTel(currentValue, prevValue);
|
|
3168
|
-
currentValue = handleCheckTypeNumber(currentValue, prevValue);
|
|
3169
|
-
if (max && currentValue.length > max && type !== 'tel' && type !== 'number') {
|
|
3170
|
-
currentValue = currentValue.substr(0, max);
|
|
3171
|
-
}
|
|
3172
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3173
|
-
!regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3174
|
-
}
|
|
3175
|
-
setInnerValue(() => currentValue);
|
|
3176
|
-
if (change && currentValue !== prevValue) {
|
|
3177
|
-
change(currentValue);
|
|
3178
|
-
}
|
|
3179
|
-
};
|
|
3180
3378
|
const handleMouseEnter = () => {
|
|
3181
3379
|
setIsHover(true);
|
|
3182
3380
|
};
|
|
@@ -3187,41 +3385,15 @@ const Input = ({
|
|
|
3187
3385
|
setShow(!show);
|
|
3188
3386
|
};
|
|
3189
3387
|
React.useEffect(() => {
|
|
3190
|
-
let newValue = value;
|
|
3191
3388
|
if (errorMessage) {
|
|
3192
3389
|
setInnerErrorMessage(errorMessage);
|
|
3193
3390
|
} else {
|
|
3194
3391
|
setInnerErrorMessage('');
|
|
3195
3392
|
}
|
|
3196
|
-
if (
|
|
3197
|
-
|
|
3198
|
-
alert("minNumSize prop can't be less then 0");
|
|
3199
|
-
} else if (minNumSize && minNumSize >= 0) {
|
|
3200
|
-
setInnerMinNumSize(minNumSize);
|
|
3201
|
-
}
|
|
3202
|
-
if (type === 'number' && (maxNumSize || maxNumSize === 0 || minNumSize || minNumSize === 0) && (maxLength || maxLength === 0)) {
|
|
3203
|
-
alert("You can't use maxNumSize or minNumSize and maxLength props together when Input type is number");
|
|
3204
|
-
}
|
|
3205
|
-
if (type === 'number' && maxNumSize < minNumSize) {
|
|
3206
|
-
alert("maxNumSize prop can't be less then minNumSize");
|
|
3207
|
-
}
|
|
3208
|
-
if (value !== undefined) {
|
|
3209
|
-
if (value === null) {
|
|
3210
|
-
newValue = '';
|
|
3211
|
-
} else {
|
|
3212
|
-
const max = type === 'number' ? maxLength ? maxLength : null : maxLength ? maxLength : merge.INPUT.maxLength;
|
|
3213
|
-
newValue = handleCheckTypeTel(value, newValue);
|
|
3214
|
-
newValue = handleCheckTypeNumber(value, newValue);
|
|
3215
|
-
if (max && value.length > max && type !== 'tel' && type !== 'number') {
|
|
3216
|
-
newValue = value.substr(0, max);
|
|
3217
|
-
}
|
|
3218
|
-
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3219
|
-
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3393
|
+
if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
|
|
3394
|
+
!regexp.test(value) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
|
|
3222
3395
|
}
|
|
3223
|
-
|
|
3224
|
-
}, [type, value, regexp, maxLength, maxNumSize, minNumSize, errorMessage, regexpErrorMessage]);
|
|
3396
|
+
}, [type, regexp, errorMessage, regexpErrorMessage]);
|
|
3225
3397
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3226
3398
|
className: classProps
|
|
3227
3399
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -3259,56 +3431,52 @@ const Input = ({
|
|
|
3259
3431
|
borderBottomLeftRadius: radius ?? merge.INPUT.radius,
|
|
3260
3432
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3261
3433
|
}
|
|
3262
|
-
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default["default"].createElement(
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
type:
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
color: innerErrorMessage && errorColor ? errorColor : color ? color : merge.INPUT.color,
|
|
3309
|
-
backgroundColor: disabled ? backgroundDisableColor ? backgroundDisableColor : merge.INPUT.colors.backgroundDisable : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3310
|
-
}
|
|
3311
|
-
})), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3434
|
+
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', type === 'tel' ? /*#__PURE__*/React__default["default"].createElement(TelInput, {
|
|
3435
|
+
type: type,
|
|
3436
|
+
value: value,
|
|
3437
|
+
inputChange: change,
|
|
3438
|
+
isHover: isHover,
|
|
3439
|
+
disabled: disabled,
|
|
3440
|
+
inpStyles: inpStyles,
|
|
3441
|
+
inpAttributes: inpAttributes,
|
|
3442
|
+
radius: radius ?? merge.INPUT.radius,
|
|
3443
|
+
phoneDisplay: phoneDisplay ?? merge.INPUT.tel.display,
|
|
3444
|
+
phoneAlignItems: phoneAlignItems ?? merge.INPUT.tel.alignItems,
|
|
3445
|
+
phoneJustifyContent: phoneJustifyContent ?? merge.INPUT.tel.justifyContent,
|
|
3446
|
+
telBorderRightWidth: telBorderRightWidth ?? merge.INPUT.tel.borderRight.width,
|
|
3447
|
+
telBorderRightStyle: telBorderRightStyle ?? merge.INPUT.tel.borderRight.style,
|
|
3448
|
+
telBorderRightColor: telBorderRightColor ?? merge.INPUT.tel.borderRight.color,
|
|
3449
|
+
telBorderRightColorHover: telBorderRightColorHover ?? merge.INPUT.tel.borderRight.colors.hover
|
|
3450
|
+
}) : type === 'number' ? /*#__PURE__*/React__default["default"].createElement(NumberInput, {
|
|
3451
|
+
value: value,
|
|
3452
|
+
inputChange: change,
|
|
3453
|
+
dots: withoutDot,
|
|
3454
|
+
float: floatToFix,
|
|
3455
|
+
maxLength: maxLength,
|
|
3456
|
+
inpStyles: inpStyles,
|
|
3457
|
+
inpAttributes: inpAttributes,
|
|
3458
|
+
minNumSize: minNumSize ? minNumSize : '',
|
|
3459
|
+
maxNumSize: maxNumSize ? maxNumSize : '',
|
|
3460
|
+
radius: radius ?? merge.INPUT.radius
|
|
3461
|
+
}) : type === 'password' ? /*#__PURE__*/React__default["default"].createElement(PassInput, {
|
|
3462
|
+
show: show,
|
|
3463
|
+
type: type,
|
|
3464
|
+
value: value,
|
|
3465
|
+
isHover: isHover,
|
|
3466
|
+
disabled: disabled,
|
|
3467
|
+
inputChange: change,
|
|
3468
|
+
maxLength: maxLength,
|
|
3469
|
+
inpStyles: inpStyles,
|
|
3470
|
+
inpAttributes: inpAttributes,
|
|
3471
|
+
radius: radius ?? merge.INPUT.radius
|
|
3472
|
+
}) : /*#__PURE__*/React__default["default"].createElement(TextInput, {
|
|
3473
|
+
value: value,
|
|
3474
|
+
inputChange: change,
|
|
3475
|
+
inpStyles: inpStyles,
|
|
3476
|
+
maxLength: maxLength,
|
|
3477
|
+
inpAttributes: inpAttributes,
|
|
3478
|
+
radius: radius ?? merge.INPUT.radius
|
|
3479
|
+
}), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3312
3480
|
onClick: type === 'password' ? handleShowPass : _ => _,
|
|
3313
3481
|
style: {
|
|
3314
3482
|
display: 'flex',
|
|
@@ -3324,7 +3492,6 @@ const Input = ({
|
|
|
3324
3492
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : merge.INPUT.colors.background
|
|
3325
3493
|
}
|
|
3326
3494
|
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
|
|
3327
|
-
errorAnimation: errorAnimation ?? merge.INPUT.error.animation,
|
|
3328
3495
|
animation: animation,
|
|
3329
3496
|
style: {
|
|
3330
3497
|
margin: '0px',
|
|
@@ -3339,7 +3506,7 @@ const Input = ({
|
|
|
3339
3506
|
zIndex: errorZindex ?? merge.INPUT.error.zIndex,
|
|
3340
3507
|
lineHeight: errorLineHeight ?? merge.INPUT.error.lineHeight,
|
|
3341
3508
|
top: errorMarginTop ? `calc(100% + ${errorMarginTop})` : `calc(100% + ${merge.INPUT.error.marginTop})`,
|
|
3342
|
-
transform:
|
|
3509
|
+
transform: 'scale3d(1,1,1)'
|
|
3343
3510
|
},
|
|
3344
3511
|
className: errorClassName ?? merge.INPUT.error.className
|
|
3345
3512
|
}, innerErrorMessage) : '');
|
|
@@ -3361,7 +3528,6 @@ Input.propTypes = {
|
|
|
3361
3528
|
padding: PropTypes__default["default"].string,
|
|
3362
3529
|
tooltip: PropTypes__default["default"].element,
|
|
3363
3530
|
withoutDot: PropTypes__default["default"].bool,
|
|
3364
|
-
transform: PropTypes__default["default"].string,
|
|
3365
3531
|
className: PropTypes__default["default"].string,
|
|
3366
3532
|
iconWidth: PropTypes__default["default"].string,
|
|
3367
3533
|
boxSizing: PropTypes__default["default"].string,
|
|
@@ -3386,7 +3552,6 @@ Input.propTypes = {
|
|
|
3386
3552
|
errorMessage: PropTypes__default["default"].string,
|
|
3387
3553
|
phoneDisplay: PropTypes__default["default"].string,
|
|
3388
3554
|
autoComplete: PropTypes__default["default"].string,
|
|
3389
|
-
errorAnimation: PropTypes__default["default"].bool,
|
|
3390
3555
|
labelDisplay: PropTypes__default["default"].string,
|
|
3391
3556
|
errorPosition: PropTypes__default["default"].string,
|
|
3392
3557
|
errorMarginTop: PropTypes__default["default"].string,
|
|
@@ -3405,7 +3570,6 @@ Input.propTypes = {
|
|
|
3405
3570
|
telBorderRightColor: PropTypes__default["default"].string,
|
|
3406
3571
|
phoneJustifyContent: PropTypes__default["default"].string,
|
|
3407
3572
|
backgroundDisableColor: PropTypes__default["default"].string,
|
|
3408
|
-
errorAnimationDuration: PropTypes__default["default"].string,
|
|
3409
3573
|
telBorderRightColorHover: PropTypes__default["default"].string,
|
|
3410
3574
|
leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
3411
3575
|
rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
package/package.json
CHANGED
package/tui.config.js
CHANGED