aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/input/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ui/input/index.tsx')
-rw-r--r--src/components/ui/input/index.tsx16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx
index 3bafc93e7..2a36d7aa9 100644
--- a/src/components/ui/input/index.tsx
+++ b/src/components/ui/input/index.tsx
@@ -1,7 +1,13 @@
1import { mdiEye, mdiEyeOff } from '@mdi/js'; 1import { mdiEye, mdiEyeOff } from '@mdi/js';
2import Icon from '@mdi/react'; 2import Icon from '@mdi/react';
3import classnames from 'classnames'; 3import classnames from 'classnames';
4import { Component, createRef, InputHTMLAttributes } from 'react'; 4import {
5 Component,
6 createRef,
7 InputHTMLAttributes,
8 ReactElement,
9 RefObject,
10} from 'react';
5import injectSheet, { WithStylesProps } from 'react-jss'; 11import injectSheet, { WithStylesProps } from 'react-jss';
6import { noop } from 'lodash'; 12import { noop } from 'lodash';
7import { IFormField } from '../typings/generic'; 13import { IFormField } from '../typings/generic';
@@ -26,7 +32,7 @@ interface IProps
26 showPasswordToggle?: boolean; 32 showPasswordToggle?: boolean;
27 data?: IData; 33 data?: IData;
28 inputClassName?: string; 34 inputClassName?: string;
29 onEnterKey?: Function; 35 onEnterKey?: () => {};
30} 36}
31 37
32interface IState { 38interface IState {
@@ -35,7 +41,7 @@ interface IState {
35} 41}
36 42
37class InputComponent extends Component<IProps, IState> { 43class InputComponent extends Component<IProps, IState> {
38 private inputRef = createRef<HTMLInputElement>(); 44 private inputRef: RefObject<HTMLInputElement> = createRef<HTMLInputElement>();
39 45
40 constructor(props: IProps) { 46 constructor(props: IProps) {
41 super(props); 47 super(props);
@@ -73,14 +79,14 @@ class InputComponent extends Component<IProps, IState> {
73 } 79 }
74 } 80 }
75 81
76 onInputKeyPress(e: React.KeyboardEvent) { 82 onInputKeyPress(e: React.KeyboardEvent): void {
77 if (e.key === 'Enter') { 83 if (e.key === 'Enter') {
78 const { onEnterKey } = this.props; 84 const { onEnterKey } = this.props;
79 onEnterKey && onEnterKey(); 85 onEnterKey && onEnterKey();
80 } 86 }
81 } 87 }
82 88
83 render() { 89 render(): ReactElement {
84 const { 90 const {
85 classes, 91 classes,
86 className, 92 className,