x-ui-design 1.0.24 → 1.0.26

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.
@@ -18,7 +18,7 @@ import { ErrorIcon } from '../Icons/Icons';
18
18
  import { applyMask, MASK_CHAR, MASK_REGEX, stripMask } from '../../helpers/mask';
19
19
  import './style.css';
20
20
 
21
- const InputComponent = forwardRef(({
21
+ const InputComponent = forwardRef<RuleType, InputProps>(({
22
22
  size = 'large',
23
23
  error,
24
24
  suffix,
@@ -38,16 +38,13 @@ const InputComponent = forwardRef(({
38
38
  mask,
39
39
  maskChar = MASK_CHAR,
40
40
  maskRegex = MASK_REGEX,
41
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
41
  // @ts-expect-error
43
42
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
43
  __injected,
45
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
46
44
  defaultValue,
47
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
48
45
  child,
49
46
  ...props
50
- }: InputProps, ref) => {
47
+ }, ref) => {
51
48
  const inputRef = useRef<HTMLInputElement>(null);
52
49
  const lastKeyPressed = useRef<string | null>(null);
53
50
  const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
@@ -56,21 +53,14 @@ const InputComponent = forwardRef(({
56
53
  const animationRef = useRef<number | null>(null);
57
54
 
58
55
  useImperativeHandle(ref, () => ({
59
- focus: () => {
60
- console.info('focusing');
61
- inputRef.current?.focus()
62
- },
63
- blur: () => {
64
- inputRef.current?.blur()
65
- },
56
+ focus: () => inputRef.current?.focus(),
57
+ blur: () => inputRef.current?.blur(),
66
58
  input: inputRef.current,
67
59
  nativeElement: inputRef.current,
68
60
  setSelectionRange: (start: number, end: number) => {
69
- if (inputRef.current) {
70
- inputRef.current.setSelectionRange(start, end);
71
- }
61
+ inputRef.current?.setSelectionRange(start, end);
72
62
  }
73
- }), [ref]);
63
+ }));
74
64
 
75
65
  useEffect(() => {
76
66
  setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : (value ?? ''));
@@ -9,7 +9,7 @@ import {
9
9
  ReactNode,
10
10
  TextareaHTMLAttributes
11
11
  } from 'react';
12
- import { DefaultProps, RuleType, SizeType, SyntheticBaseEvent } from '.';
12
+ import { DefaultProps, SizeType, SyntheticBaseEvent } from '.';
13
13
 
14
14
  export type InputProps = Omit<
15
15
  InputHTMLAttributes<HTMLInputElement>,
@@ -38,7 +38,6 @@ export type InputProps = Omit<
38
38
  mask?: string;
39
39
  maskChar?: string;
40
40
  maskRegex?: RegExp;
41
- ref?: RuleType;
42
41
  };
43
42
 
44
43
  export type TextareaProps = Omit<
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",
package/src/app/page.tsx CHANGED
@@ -1,10 +1,5 @@
1
1
  'use client'
2
2
 
3
- import { Result } from "../../lib/components/Result";
4
- import { Button } from '../../lib/components/Button';
5
- import { Popover } from '../../lib/components/Popover';
6
- import { Select } from "../../lib/components/Select";
7
- import Option from "../../lib/components/Select/Option/Option";
8
3
  import Input from "../../lib/components/Input/Input";
9
4
  import { useEffect, useRef } from "react";
10
5
 
@@ -14,7 +9,7 @@ export default function Home() {
14
9
  useEffect(() => {
15
10
  if (ref.current) {
16
11
  console.log(ref.current);
17
-
12
+
18
13
  ref.current.focus();
19
14
  }
20
15
  }, [])