x-ui-design 1.0.23 → 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.
@@ -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 = forwardRef<HTMLInputElement | { focus: () => void; blur: () => void; input: HTMLInputElement | null; nativeElement: HTMLInputElement | null; setSelectionRange: (start: number, end: number) => void; }, InputProps>(({
20
+ const InputComponent = ({
22
21
  size = 'large',
23
22
  error,
24
23
  suffix,
@@ -42,10 +41,13 @@ const InputComponent = forwardRef<HTMLInputElement | { focus: () => void; blur:
42
41
  // @ts-expect-error
43
42
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
43
  __injected,
44
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
45
  defaultValue,
46
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
46
47
  child,
48
+ ref,
47
49
  ...props
48
- }, ref) => {
50
+ }: InputProps) => {
49
51
  const inputRef = useRef<HTMLInputElement>(null);
50
52
  const lastKeyPressed = useRef<string | null>(null);
51
53
  const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
@@ -59,9 +61,11 @@ const InputComponent = forwardRef<HTMLInputElement | { focus: () => void; blur:
59
61
  input: inputRef.current,
60
62
  nativeElement: inputRef.current,
61
63
  setSelectionRange: (start: number, end: number) => {
62
- inputRef.current?.setSelectionRange(start, end);
64
+ if (inputRef.current) {
65
+ inputRef.current.setSelectionRange(start, end);
66
+ }
63
67
  }
64
- }), [inputRef]);
68
+ }));
65
69
 
66
70
  useEffect(() => {
67
71
  setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : (value ?? ''));
@@ -199,7 +203,7 @@ const InputComponent = forwardRef<HTMLInputElement | { focus: () => void; blur:
199
203
  ) : null}
200
204
  </div>
201
205
  );
202
- });
206
+ };
203
207
 
204
208
  InputComponent.displayName = 'Input';
205
209
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",