x-ui-design 1.0.24 → 1.0.25
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/esm/types/components/Input/Input.d.ts +4 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +8 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +7 -12
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, {
|
|
4
|
-
forwardRef,
|
|
5
4
|
KeyboardEvent,
|
|
6
5
|
MouseEvent,
|
|
7
6
|
useEffect,
|
|
@@ -18,7 +17,7 @@ import { ErrorIcon } from '../Icons/Icons';
|
|
|
18
17
|
import { applyMask, MASK_CHAR, MASK_REGEX, stripMask } from '../../helpers/mask';
|
|
19
18
|
import './style.css';
|
|
20
19
|
|
|
21
|
-
const InputComponent =
|
|
20
|
+
const InputComponent = ({
|
|
22
21
|
size = 'large',
|
|
23
22
|
error,
|
|
24
23
|
suffix,
|
|
@@ -46,8 +45,9 @@ const InputComponent = forwardRef(({
|
|
|
46
45
|
defaultValue,
|
|
47
46
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
47
|
child,
|
|
48
|
+
ref,
|
|
49
49
|
...props
|
|
50
|
-
}: InputProps
|
|
50
|
+
}: InputProps) => {
|
|
51
51
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
52
52
|
const lastKeyPressed = useRef<string | null>(null);
|
|
53
53
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -56,13 +56,8 @@ const InputComponent = forwardRef(({
|
|
|
56
56
|
const animationRef = useRef<number | null>(null);
|
|
57
57
|
|
|
58
58
|
useImperativeHandle(ref, () => ({
|
|
59
|
-
focus: () =>
|
|
60
|
-
|
|
61
|
-
inputRef.current?.focus()
|
|
62
|
-
},
|
|
63
|
-
blur: () => {
|
|
64
|
-
inputRef.current?.blur()
|
|
65
|
-
},
|
|
59
|
+
focus: () => inputRef.current?.focus(),
|
|
60
|
+
blur: () => inputRef.current?.blur(),
|
|
66
61
|
input: inputRef.current,
|
|
67
62
|
nativeElement: inputRef.current,
|
|
68
63
|
setSelectionRange: (start: number, end: number) => {
|
|
@@ -70,7 +65,7 @@ const InputComponent = forwardRef(({
|
|
|
70
65
|
inputRef.current.setSelectionRange(start, end);
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
|
-
})
|
|
68
|
+
}));
|
|
74
69
|
|
|
75
70
|
useEffect(() => {
|
|
76
71
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : (value ?? ''));
|
|
@@ -208,7 +203,7 @@ const InputComponent = forwardRef(({
|
|
|
208
203
|
) : null}
|
|
209
204
|
</div>
|
|
210
205
|
);
|
|
211
|
-
}
|
|
206
|
+
};
|
|
212
207
|
|
|
213
208
|
InputComponent.displayName = 'Input';
|
|
214
209
|
|