Skip to content

Commit 4cb33d0

Browse files
authored
RI-7071: Replace EuiTextArea with TextArea (#4619)
* RI-7071: Replace EuiTextArea with TextArea * RI-7071: remove .euiTextArea class styles * fix label
1 parent 0b87f59 commit 4cb33d0

File tree

22 files changed

+54
-397
lines changed

22 files changed

+54
-397
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { TextArea } from '@redis-ui/components'
2+
3+
export default TextArea
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { default as PasswordInput } from './PasswordInput'
22
export { default as SearchInput } from './SearchInput'
33
export { default as NumericInput } from './NumericInput'
4+
export { default as TextArea } from './TextArea'

redisinsight/ui/src/components/form-dialog/styles.module.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,12 @@
5454
.euiFieldNumber,
5555
.euiSelect,
5656
.euiSuperSelectControl,
57-
.euiComboBox .euiComboBox__inputWrap,
58-
.euiTextArea {
57+
.euiComboBox .euiComboBox__inputWrap {
5958
background-color: var(--browserTableRowEven) !important;
6059
padding: 12px;
6160
border-color: var(--separatorColor) !important;
6261
}
6362

64-
.euiTextArea {
65-
min-height: 80px;
66-
}
67-
6863
.euiFormControlLayout--group {
6964
border-color: var(--separatorColor) !important;
7065
}

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { Ref, useRef, useState } from 'react'
22
import {
33
EuiForm,
44
EuiPopover,
5-
EuiTextArea,
65
EuiTitle,
76
EuiToolTip,
87
keys,
@@ -15,6 +14,7 @@ import { Spacer } from 'uiSrc/components/base/layout/spacer'
1514
import { PrimaryButton } from 'uiSrc/components/base/forms/buttons'
1615
import { SendIcon } from 'uiSrc/components/base/icons'
1716
import { Text } from 'uiSrc/components/base/text'
17+
import { TextArea } from 'uiSrc/components/base/inputs'
1818
import styles from './styles.module.scss'
1919

2020
export interface Props {
@@ -64,8 +64,8 @@ const ChatForm = (props: Props) => {
6464
}
6565
}
6666

67-
const handleChange = ({ target }: React.ChangeEvent<HTMLTextAreaElement>) => {
68-
setValue(target.value)
67+
const handleChange = (value: string) => {
68+
setValue(value)
6969
updateTextAreaHeight()
7070
}
7171

@@ -128,10 +128,9 @@ const ChatForm = (props: Props) => {
128128
onSubmit={handleSubmitForm}
129129
onKeyDown={handleKeyDown}
130130
>
131-
<EuiTextArea
132-
inputRef={textAreaRef}
131+
<TextArea
132+
ref={textAreaRef}
133133
placeholder={placeholder || 'Ask me about Redis'}
134-
className={styles.textarea}
135134
value={value}
136135
onChange={handleChange}
137136
disabled={!!validation}

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/styles.module.scss

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,6 @@
66
pointer-events: none;
77
}
88

9-
.textarea {
10-
height: 0;
11-
resize: none !important;
12-
background-color: var(--browserTableRowEven) !important;
13-
border: 1px solid var(--separatorColor) !important;
14-
15-
padding: 8px 40px 8px 10px;
16-
scroll-padding-bottom: 8px;
17-
border-radius: 8px;
18-
19-
min-height: 42px;
20-
max-height: 200px;
21-
background-image: none !important;
22-
23-
font-size: 12px;
24-
25-
transition: border-color ease .3s;
26-
27-
&::placeholder {
28-
font-size: 12px;
29-
white-space: nowrap;
30-
overflow: hidden;
31-
text-overflow: ellipsis;
32-
}
33-
34-
&:placeholder-shown {
35-
text-overflow: ellipsis;
36-
}
37-
38-
&:focus {
39-
border-color: var(--euiColorPrimary) !important;
40-
}
41-
}
42-
439
.submitBtn {
4410
width: 24px !important;
4511
height: 24px !important;

redisinsight/ui/src/pages/browser/components/add-key/AddKeyString/AddKeyString.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { ChangeEvent, FormEvent, useEffect, useState } from 'react'
1+
import React, { FormEvent, useEffect, useState } from 'react'
22
import { useDispatch, useSelector } from 'react-redux'
33

4-
import { EuiForm, EuiPanel, EuiTextArea } from '@elastic/eui'
4+
import { EuiForm, EuiPanel } from '@elastic/eui'
55
import { Maybe, stringToBuffer } from 'uiSrc/utils'
66

77
import { addKeyStateSelector, addStringKey } from 'uiSrc/slices/browser/keys'
@@ -12,6 +12,7 @@ import {
1212
} from 'uiSrc/components/base/forms/buttons'
1313
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
1414
import { FormField } from 'uiSrc/components/base/forms/FormField'
15+
import { TextArea } from 'uiSrc/components/base/inputs'
1516
import { SetStringWithExpireDto } from 'apiSrc/modules/browser/string/dto'
1617
import AddKeyFooter from '../AddKeyFooter/AddKeyFooter'
1718
import { AddStringFormConfig as config } from '../constants/fields-config'
@@ -55,16 +56,12 @@ const AddKeyString = (props: Props) => {
5556
return (
5657
<EuiForm component="form" onSubmit={onFormSubmit}>
5758
<FormField label={config.value.label}>
58-
<EuiTextArea
59-
fullWidth
59+
<TextArea
6060
name="value"
6161
id="value"
62-
resize="vertical"
6362
placeholder={config.value.placeholder}
6463
value={value}
65-
onChange={(e: ChangeEvent<HTMLTextAreaElement>) =>
66-
setValue(e.target.value)
67-
}
64+
onChange={setValue}
6865
disabled={loading}
6966
data-testid="string-value"
7067
/>

redisinsight/ui/src/pages/browser/modules/key-details/components/rejson-details/components/edit-entire-item-action/EditEntireItemAction.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React, { ChangeEvent, useState } from 'react'
1+
import React, { useState } from 'react'
22
import {
33
EuiForm,
4-
EuiTextArea,
54
keys,
65
} from '@elastic/eui'
76
import cx from 'classnames'
@@ -14,6 +13,7 @@ import { WindowEvent } from 'uiSrc/components/base/utils/WindowEvent'
1413
import { FocusTrap } from 'uiSrc/components/base/utils/FocusTrap'
1514
import { OutsideClickDetector } from 'uiSrc/components/base/utils'
1615
import { IconButton } from 'uiSrc/components/base/forms/buttons'
16+
import { TextArea } from 'uiSrc/components/base/inputs'
1717
import { isValidJSON } from '../../utils'
1818
import { JSONErrors } from '../../constants'
1919

@@ -63,14 +63,12 @@ const EditEntireItemAction = (props: Props) => {
6363
noValidate
6464
>
6565
<FlexItem grow inline>
66-
<EuiTextArea
67-
isInvalid={!!error}
66+
<TextArea
67+
valid={!error}
6868
className={styles.fullWidthTextArea}
6969
value={value}
7070
placeholder="Enter JSON value"
71-
onChange={(e: ChangeEvent<HTMLTextAreaElement>) =>
72-
setValue(e.target.value)
73-
}
71+
onChange={setValue}
7472
data-testid="json-value"
7573
/>
7674
</FlexItem>

redisinsight/ui/src/pages/browser/modules/key-details/components/string-details/string-details-value/StringDetailsValue.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {
2-
ChangeEvent,
32
Ref,
43
useCallback,
54
useEffect,
@@ -8,8 +7,7 @@ import React, {
87
useState,
98
} from 'react'
109
import { useDispatch, useSelector } from 'react-redux'
11-
import cx from 'classnames'
12-
import { EuiProgress, EuiTextArea, EuiToolTip } from '@elastic/eui'
10+
import { EuiProgress, EuiToolTip } from '@elastic/eui'
1311

1412
import {
1513
bufferToSerializedFormat,
@@ -60,6 +58,7 @@ import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
6058
import { DownloadIcon } from 'uiSrc/components/base/icons'
6159
import { SecondaryButton } from 'uiSrc/components/base/forms/buttons'
6260
import { Text } from 'uiSrc/components/base/text'
61+
import { TextArea } from 'uiSrc/components/base/inputs'
6362
import styles from './styles.module.scss'
6463

6564
const MIN_ROWS = 8
@@ -293,22 +292,15 @@ const StringDetailsValue = (props: Props) => {
293292
)?.isValid
294293
}
295294
>
296-
<EuiTextArea
297-
fullWidth
295+
<TextArea
298296
name="value"
299297
id="value"
300298
rows={rows}
301-
resize="vertical"
302299
placeholder={config.value.placeholder}
303300
value={areaValue}
304-
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {
305-
setAreaValue(e.target.value)
306-
}}
301+
onChange={setAreaValue}
307302
disabled={loading}
308-
inputRef={textAreaRef}
309-
className={cx(styles.stringTextArea, {
310-
[styles.areaWarning]: isDisabled,
311-
})}
303+
ref={textAreaRef}
312304
style={{
313305
maxHeight: containerRef.current
314306
? containerRef.current?.clientHeight - 80

redisinsight/ui/src/pages/browser/modules/key-details/components/string-details/string-details-value/styles.module.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ $outer-height-mobile: 340px;
3434
}
3535
}
3636

37-
.stringTextArea {
38-
&.areaWarning {
39-
border-color: var(--euiColorWarningLight) !important;
40-
background-image: none !important;
41-
}
42-
}
43-
4437
.tooltipAnchor {
4538
display: inline-flex !important;
4639
height: auto;

redisinsight/ui/src/pages/browser/modules/key-details/shared/editable-textarea/EditableTextArea.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react'
22
import AutoSizer from 'react-virtualized-auto-sizer'
3-
import { EuiTextArea, EuiToolTip } from '@elastic/eui'
3+
import { EuiToolTip } from '@elastic/eui'
44
import cx from 'classnames'
55

66
import { StopPropagation } from 'uiSrc/components/virtual-table'
@@ -9,6 +9,7 @@ import InlineItemEditor from 'uiSrc/components/inline-item-editor'
99
import { Text } from 'uiSrc/components/base/text'
1010
import { EditIcon } from 'uiSrc/components/base/icons'
1111
import { IconButton } from 'uiSrc/components/base/forms/buttons'
12+
import { TextArea } from 'uiSrc/components/base/inputs'
1213
import styles from './styles.module.scss'
1314

1415
export interface Props {
@@ -159,19 +160,14 @@ const EditableTextArea = (props: Props) => {
159160
approveText={approveText}
160161
approveByValidation={() => approveByValidation?.(value)}
161162
>
162-
<EuiTextArea
163-
fullWidth
163+
<TextArea
164164
name="value"
165165
id="value"
166-
resize="none"
167166
placeholder="Enter Value"
168167
value={value}
169-
onChange={handleOnChange}
168+
onChangeCapture={handleOnChange}
170169
disabled={isLoading}
171-
inputRef={textAreaRef}
172-
className={cx(styles.textArea, {
173-
[styles.areaWarning]: isDisabled,
174-
})}
170+
ref={textAreaRef}
175171
spellCheck={false}
176172
style={{
177173
height: textAreaRef.current?.scrollHeight || 0,

0 commit comments

Comments
 (0)