This repository was archived by the owner on Sep 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +32
-25
lines changed
packages/chakra-ui-core/src/CTextarea Expand file tree Collapse file tree 2 files changed +32
-25
lines changed Original file line number Diff line number Diff line change @@ -62,26 +62,34 @@ const CTextarea = {
62
62
const nonNativeEvents = {
63
63
input : ( value , $e ) => {
64
64
const emitChange = listeners . change
65
+
65
66
if ( emitChange && $e instanceof Event ) {
66
- emitChange ( value , $e )
67
+ if ( typeof emitChange === 'function' ) {
68
+ return emitChange ( value , $e )
69
+ }
70
+ emitChange . forEach ( listener => listener ( value , $e ) )
67
71
}
68
72
}
69
73
}
70
74
const { nonNative } = extractListeners ( { listeners } , nonNativeEvents )
71
75
72
- return h ( CInput , {
73
- ...rest ,
74
- props : {
75
- ...forwardProps ( props ) ,
76
- as : 'textarea'
77
- } ,
78
- attrs : {
79
- ...defaultStyles ,
80
- ...( data . attrs || { } ) ,
81
- 'data-chakra-component' : 'CTextarea'
76
+ return h (
77
+ CInput ,
78
+ {
79
+ ...rest ,
80
+ props : {
81
+ ...forwardProps ( props ) ,
82
+ as : 'textarea'
83
+ } ,
84
+ attrs : {
85
+ ...defaultStyles ,
86
+ ...( data . attrs || { } ) ,
87
+ 'data-chakra-component' : 'CTextarea'
88
+ } ,
89
+ on : nonNative
82
90
} ,
83
- on : nonNative
84
- } , slots ( ) . default )
91
+ slots ( ) . default
92
+ )
85
93
}
86
94
}
87
95
Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ import { storiesOf } from '@storybook/vue'
2
2
import { action } from '@storybook/addon-actions'
3
3
import { CBox , CTextarea } from '..'
4
4
5
- storiesOf ( 'UI | Textarea' , module )
6
- . add ( 'Basic Usage' , ( ) => ( {
7
- components : { CBox, CTextarea } ,
8
- template : `
5
+ storiesOf ( 'UI | Textarea' , module ) . add ( 'Basic Usage' , ( ) => ( {
6
+ components : { CBox, CTextarea } ,
7
+ template : `
9
8
<CBox w="300px">
10
9
<CTextarea
11
10
v-model="textareaContent"
@@ -18,12 +17,12 @@ storiesOf('UI | Textarea', module)
18
17
/>
19
18
</CBox>
20
19
` ,
21
- data ( ) {
22
- return {
23
- textareaContent : 'Jonathan Bakebwa is awesome'
24
- }
25
- } ,
26
- methods : {
27
- action : action ( )
20
+ data ( ) {
21
+ return {
22
+ textareaContent : 'Jonathan Bakebwa is awesome'
28
23
}
29
- } ) )
24
+ } ,
25
+ methods : {
26
+ action : action ( )
27
+ }
28
+ } ) )
You can’t perform that action at this time.
0 commit comments