diff options
Diffstat (limited to 'packages/forms/src/textarea/index.tsx')
-rw-r--r-- | packages/forms/src/textarea/index.tsx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/packages/forms/src/textarea/index.tsx b/packages/forms/src/textarea/index.tsx index cd691a507..2d89d1c9f 100644 --- a/packages/forms/src/textarea/index.tsx +++ b/packages/forms/src/textarea/index.tsx | |||
@@ -1,5 +1,3 @@ | |||
1 | import { mdiEye, mdiEyeOff } from '@mdi/js'; | ||
2 | import Icon from '@mdi/react'; | ||
3 | import classnames from 'classnames'; | 1 | import classnames from 'classnames'; |
4 | import React, { Component, createRef } from 'react'; | 2 | import React, { Component, createRef } from 'react'; |
5 | import injectSheet from 'react-jss'; | 3 | import injectSheet from 'react-jss'; |
@@ -16,7 +14,10 @@ interface IData { | |||
16 | [index: string]: string; | 14 | [index: string]: string; |
17 | } | 15 | } |
18 | 16 | ||
19 | interface IProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, IFormField, IWithStyle { | 17 | interface IProps |
18 | extends React.TextareaHTMLAttributes<HTMLTextAreaElement>, | ||
19 | IFormField, | ||
20 | IWithStyle { | ||
20 | focus?: boolean; | 21 | focus?: boolean; |
21 | data: IData; | 22 | data: IData; |
22 | textareaClassName?: string; | 23 | textareaClassName?: string; |
@@ -39,14 +40,14 @@ class TextareaComponent extends Component<IProps> { | |||
39 | const { data } = this.props; | 40 | const { data } = this.props; |
40 | 41 | ||
41 | if (this.textareaRef && this.textareaRef.current && data) { | 42 | if (this.textareaRef && this.textareaRef.current && data) { |
42 | Object.keys(data).map(key => this.textareaRef.current!.dataset[key] = data[key]); | 43 | Object.keys(data).map( |
44 | key => (this.textareaRef.current!.dataset[key] = data[key]), | ||
45 | ); | ||
43 | } | 46 | } |
44 | } | 47 | } |
45 | 48 | ||
46 | onChange(e: React.ChangeEvent<HTMLTextAreaElement>) { | 49 | onChange(e: React.ChangeEvent<HTMLTextAreaElement>) { |
47 | const { | 50 | const { onChange } = this.props; |
48 | onChange, | ||
49 | } = this.props; | ||
50 | 51 | ||
51 | if (onChange) { | 52 | if (onChange) { |
52 | onChange(e); | 53 | onChange(e); |
@@ -59,7 +60,6 @@ class TextareaComponent extends Component<IProps> { | |||
59 | className, | 60 | className, |
60 | disabled, | 61 | disabled, |
61 | error, | 62 | error, |
62 | focus, | ||
63 | id, | 63 | id, |
64 | textareaClassName, | 64 | textareaClassName, |
65 | label, | 65 | label, |
@@ -96,9 +96,9 @@ class TextareaComponent extends Component<IProps> { | |||
96 | [`${classes.wrapper}`]: true, | 96 | [`${classes.wrapper}`]: true, |
97 | [`${classes.disabled}`]: disabled, | 97 | [`${classes.disabled}`]: disabled, |
98 | [`${classes.hasError}`]: error, | 98 | [`${classes.hasError}`]: error, |
99 | })}> | 99 | })} |
100 | > | ||
100 | <textarea | 101 | <textarea |
101 | autoFocus={focus} | ||
102 | id={id} | 102 | id={id} |
103 | name={name} | 103 | name={name} |
104 | placeholder={placeholder} | 104 | placeholder={placeholder} |
@@ -117,9 +117,7 @@ class TextareaComponent extends Component<IProps> { | |||
117 | </textarea> | 117 | </textarea> |
118 | </div> | 118 | </div> |
119 | </Label> | 119 | </Label> |
120 | {error && ( | 120 | {error && <Error message={error} />} |
121 | <Error message={error} /> | ||
122 | )} | ||
123 | </Wrapper> | 121 | </Wrapper> |
124 | ); | 122 | ); |
125 | } | 123 | } |