Skip to content

Commit 3d51df2

Browse files
committed
feat: textarea v15
1 parent b4a99b1 commit 3d51df2

File tree

21 files changed

+99
-50
lines changed

21 files changed

+99
-50
lines changed

migrate-from-v2.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,8 @@ plugins: [
516516

517517
#### TextArea
518518

519-
- `maxlength` 重命名为 `maxLength`
520-
- `readonly` 重命名为 `readOnly`
521-
- `limitShow` 重命名为 `showCount`
522-
- `autosize` 重命名为 `autoSize`
523-
- 移除 `textAlign`,可通过 `style` 传入
524-
- `defaultValue` 改为非受控,增加受控值 `value`
519+
- 增加 `type`,只为 `plain``container`
520+
- 删掉一些可使用基础样式变量,并且建议使用基础样式变量的样式变量,比如 `$textarea-font` `$textarea-limit-color` `$textarea-disabled-color`
525521

526522
#### Uploader
527523

src/packages/textarea/__test__/__snapshots__/textarea.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`textarea props test 1`] = `
44
<div>
55
<div
6-
class="nut-textarea"
6+
class="nut-textarea nut-textarea-plain"
77
>
88
<textarea
99
class="nut-textarea-textarea "
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
import React from 'react'
2-
import { TextArea } from '@nutui/nutui-react'
2+
import { Space, TextArea } from '@nutui/nutui-react'
33

44
const Demo1 = () => {
55
return (
6-
<TextArea
7-
defaultValue="基础用法"
8-
className="text-1"
9-
style={{ fontSize: '12px' }}
10-
onChange={(value) => console.log('change', value)}
11-
onBlur={() => console.log('blur')}
12-
onFocus={() => console.log('focus')}
13-
/>
6+
<Space direction="vertical">
7+
<TextArea
8+
defaultValue="基础用法1"
9+
onChange={(value) => console.log('change', value)}
10+
onBlur={() => console.log('blur')}
11+
onFocus={() => console.log('focus')}
12+
/>
13+
<TextArea
14+
defaultValue="基础用法2"
15+
type="container"
16+
onChange={(value) => console.log('change', value)}
17+
onBlur={() => console.log('blur')}
18+
onFocus={() => console.log('focus')}
19+
/>
20+
</Space>
1421
)
1522
}
1623
export default Demo1

src/packages/textarea/demos/h5/demo2.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { TextArea } from '@nutui/nutui-react'
33

44
const Demo2 = () => {
55
const [value, setValue] = useState('')
6-
return <TextArea value={value} onChange={(value) => setValue(value)} />
6+
return (
7+
<TextArea
8+
type="container"
9+
value={value}
10+
onChange={(value) => setValue(value)}
11+
/>
12+
)
713
}
814
export default Demo2

src/packages/textarea/demos/h5/demo3.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import React from 'react'
22
import { TextArea } from '@nutui/nutui-react'
33

44
const Demo3 = () => {
5-
return <TextArea showCount maxLength={20} />
5+
return <TextArea showCount maxLength={20} type="container" />
66
}
77
export default Demo3

src/packages/textarea/demos/h5/demo4.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import React from 'react'
22
import { TextArea } from '@nutui/nutui-react'
33

44
const Demo4 = () => {
5-
return <TextArea autoSize maxLength={-1} />
5+
return <TextArea autoSize maxLength={-1} type="container" />
66
}
77
export default Demo4

src/packages/textarea/demos/h5/demo5.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Demo5 = () => {
88
}
99
return (
1010
<ConfigProvider theme={customTheme}>
11-
<TextArea showCount maxLength={20} />
11+
<TextArea showCount maxLength={20} type="container" />
1212
</ConfigProvider>
1313
)
1414
}

src/packages/textarea/demos/h5/demo6.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TextArea } from '@nutui/nutui-react'
44
const Demo6 = () => {
55
return (
66
<>
7-
<TextArea readOnly defaultValue="textarea只读状态" />
7+
<TextArea readOnly defaultValue="textarea只读状态" type="container" />
88
</>
99
)
1010
}

src/packages/textarea/demos/h5/demo7.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const Demo7 = () => {
88
disabled
99
defaultValue="textarea禁用状态"
1010
showCount
11+
type="container"
1112
maxLength={20}
1213
/>
1314
</>

src/packages/textarea/demos/h5/demo8.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const Demo8 = () => {
55
return (
66
<TextArea
77
defaultValue="文本居右"
8+
type="container"
89
style={{
910
textAlign: 'right',
1011
}}

0 commit comments

Comments
 (0)