@@ -139,7 +139,7 @@ storiesOf('ListView', module)
139
139
. addDecorator ( decorator )
140
140
. addParameters ( parameters )
141
141
. add ( 'default' , args => (
142
- < ListView width = "250px" { ...args } >
142
+ < ListView width = "250px" aria-label = "default ListView" { ...args } >
143
143
< Item textValue = "Adobe Photoshop" > Adobe Photoshop</ Item >
144
144
< Item textValue = "Adobe Illustrator" > Adobe Illustrator</ Item >
145
145
< Item textValue = "Adobe XD" > Adobe XD</ Item >
@@ -168,7 +168,7 @@ storiesOf('ListView', module)
168
168
)
169
169
)
170
170
. add ( 'dynamic items - small viewport' , args => (
171
- < ListView items = { items } width = "100px" height = "250px" { ...args } >
171
+ < ListView aria-label = "small view port listview" items = { items } width = "100px" height = "250px" { ...args } >
172
172
{ ( item : any ) => (
173
173
< Item key = { item . key } textValue = { item . name } >
174
174
< Text >
@@ -193,17 +193,17 @@ storiesOf('ListView', module)
193
193
< FalsyIds { ...args } />
194
194
) )
195
195
. add ( 'empty list' , args => (
196
- < ListView width = "300px" height = "300px" renderEmptyState = { renderEmptyState } { ...args } >
196
+ < ListView aria-label = "empty ListView" width = "300px" height = "300px" renderEmptyState = { renderEmptyState } { ...args } >
197
197
{ [ ] }
198
198
</ ListView >
199
199
) )
200
200
. add ( 'loading' , args => (
201
- < ListView width = "300px" height = "300px" loadingState = "loading" { ...args } >
201
+ < ListView aria-label = "loading ListView" width = "300px" height = "300px" loadingState = "loading" { ...args } >
202
202
{ [ ] }
203
203
</ ListView >
204
204
) )
205
205
. add ( 'loadingMore' , args => (
206
- < ListView width = "300px" height = "300px" loadingState = "loadingMore" { ...args } >
206
+ < ListView aria-label = "loading more ListView" width = "300px" height = "300px" loadingState = "loadingMore" { ...args } >
207
207
< Item textValue = "Adobe Photoshop" > Adobe Photoshop</ Item >
208
208
< Item textValue = "Adobe Illustrator" > Adobe Illustrator</ Item >
209
209
< Item textValue = "Adobe XD" > Adobe XD</ Item >
@@ -219,12 +219,12 @@ storiesOf('ListView', module)
219
219
. add ( 'with ActionBar' , args => < ActionBarExample { ...args } /> )
220
220
. add ( 'with emphasized ActionBar' , args => < ActionBarExample isEmphasized { ...args } /> )
221
221
. add ( 'thumbnails' , args => (
222
- < ListView width = "250px" items = { itemsWithThumbs } { ...args } >
223
- { ( item : any ) => < Item textValue = { item . title } > < Image src = { item . url } /> < Text > { item . title } </ Text > < Text slot = "description" > JPG</ Text > </ Item > }
222
+ < ListView width = "250px" items = { itemsWithThumbs } aria-label = "ListView with thumbnails" { ...args } >
223
+ { ( item : any ) => < Item textValue = { item . title } > < Image src = { item . url } alt = "" /> < Text > { item . title } </ Text > < Text slot = "description" > JPG</ Text > </ Item > }
224
224
</ ListView >
225
225
) )
226
226
. add ( 'long text' , args => (
227
- < ListView width = "250px" { ...args } >
227
+ < ListView width = "250px" aria-label = "long text ListView" { ...args } >
228
228
< Item textValue = "row 1" > row 1 with a very very very very very long title</ Item >
229
229
< Item textValue = "row 2" >
230
230
< Text > Text slot with a really really really long name</ Text >
@@ -238,8 +238,8 @@ storiesOf('ListView/Actions', module)
238
238
. add ( 'ActionButton' , ( args ) =>
239
239
renderActionsExample ( props => < ActionButton { ...props } > < Copy /> </ ActionButton > , args ) )
240
240
. add ( 'ActionGroup' , args =>
241
- renderActionsExample ( props => (
242
- < ActionGroup buttonLabelBehavior = "hide" { ... props } >
241
+ renderActionsExample ( ( ) => (
242
+ < ActionGroup buttonLabelBehavior = "hide" onAction = { action ( 'actionGroupAction' ) } >
243
243
< Item key = "add" >
244
244
< Add />
245
245
< Text > Add</ Text >
@@ -251,8 +251,8 @@ storiesOf('ListView/Actions', module)
251
251
</ ActionGroup >
252
252
) , args ) )
253
253
. add ( 'ActionMenu' , args =>
254
- renderActionsExample ( props => (
255
- < ActionMenu { ... props } >
254
+ renderActionsExample ( ( ) => (
255
+ < ActionMenu onAction = { action ( 'actionMenuAction' ) } >
256
256
< Item key = "add" >
257
257
< Add />
258
258
< Text > Add</ Text >
@@ -264,15 +264,15 @@ storiesOf('ListView/Actions', module)
264
264
</ ActionMenu >
265
265
) , args ) )
266
266
. add ( 'ActionGroup + ActionMenu' , args =>
267
- renderActionsExample ( props => (
267
+ renderActionsExample ( ( ) => (
268
268
< >
269
- < ActionGroup buttonLabelBehavior = "hide" { ... props } >
269
+ < ActionGroup buttonLabelBehavior = "hide" onAction = { action ( 'actionGroupAction' ) } >
270
270
< Item key = "info" >
271
271
< Info />
272
272
< Text > Info</ Text >
273
273
</ Item >
274
274
</ ActionGroup >
275
- < ActionMenu { ... props } >
275
+ < ActionMenu onAction = { action ( 'actionMenuACtion' ) } >
276
276
< Item key = "add" >
277
277
< Add />
278
278
< Text > Add</ Text >
@@ -288,27 +288,27 @@ storiesOf('ListView/Actions', module)
288
288
storiesOf ( 'ListView/Selection' , module )
289
289
. addParameters ( parameters )
290
290
. add ( 'default' , args => (
291
- < ListView width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } { ...args } >
291
+ < ListView aria-label = "default selection ListView" width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } { ...args } >
292
292
{ ( item : any ) => (
293
- < Item >
293
+ < Item textValue = { item . name } >
294
294
{ item . type === 'folder' ? < Folder /> : null }
295
295
< Text > { item . name } </ Text >
296
296
</ Item >
297
297
) }
298
298
</ ListView >
299
299
) )
300
300
. add ( 'disable folders' , args => (
301
- < ListView width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } disabledKeys = { [ 'c' , 'e' , 'm' ] } { ...args } >
301
+ < ListView aria-label = "disabled folders ListView" width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } disabledKeys = { [ 'c' , 'e' , 'm' ] } { ...args } >
302
302
{ ( item : any ) => (
303
- < Item >
303
+ < Item textValue = { item . name } >
304
304
{ item . type === 'folder' ? < Folder /> : null }
305
305
< Text > { item . name } </ Text >
306
306
</ Item >
307
307
) }
308
308
</ ListView >
309
309
) )
310
310
. add ( 'disable folder selection' , args => (
311
- < ListView width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } disabledKeys = { [ 'c' , 'e' , 'm' ] } disabledBehavior = "selection" { ...args } >
311
+ < ListView aria-label = "disabled folder selection ListView" width = "250px" height = { 400 } onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } disabledKeys = { [ 'c' , 'e' , 'm' ] } disabledBehavior = "selection" { ...args } >
312
312
{ ( item : any ) => (
313
313
< Item textValue = { item . name } >
314
314
{ item . type === 'folder' ? < Folder /> : null }
@@ -411,7 +411,7 @@ storiesOf('ListView/Drag and Drop', module)
411
411
412
412
function renderActionsExample ( renderActions , props ?) {
413
413
return (
414
- < ListView width = "300px" selectionMode = "single" { ...props } onAction = { action ( 'onAction' ) } onSelectionChange = { keys => console . log ( 'sel' , keys ) } >
414
+ < ListView width = "300px" selectionMode = "single" { ...props } onAction = { action ( 'onAction' ) } onSelectionChange = { action ( 'onSelectionChange' ) } aria-label = "render actions ListView" >
415
415
< Item key = "a" textValue = "Utilities" hasChildItems >
416
416
< Folder />
417
417
< Text > Utilities</ Text >
@@ -479,7 +479,7 @@ function NavigationExample(props) {
479
479
selectedKeys = { selectedKeys }
480
480
items = { children }
481
481
disabledKeys = { props . disabledType ? children . filter ( item => item . type === props . disabledType ) . map ( item => item . key ) : null }
482
- onAction = { onAction }
482
+ onAction = { chain ( onAction , action ( 'onAction' ) ) }
483
483
{ ...props } >
484
484
{ ( item : any ) => (
485
485
< Item hasChildItems = { item . type === 'folder' } textValue = { item . name } >
@@ -528,7 +528,7 @@ function EmptyTest() {
528
528
< div >
529
529
< Flex direction = "row" >
530
530
< div { ...divProps } >
531
- < ListView items = { items } width = "250px" height = { hasDivProps ? null : '500px' } renderEmptyState = { renderEmpty } >
531
+ < ListView aria-label = "render empty state ListView" items = { items } width = "250px" height = { hasDivProps ? null : '500px' } renderEmptyState = { renderEmpty } >
532
532
{
533
533
item => (
534
534
< Item key = { item . key } >
@@ -1124,8 +1124,9 @@ function AsyncList(props) {
1124
1124
height = "size-3000"
1125
1125
items = { list . items }
1126
1126
loadingState = { list . loadingState }
1127
- onLoadMore = { list . loadMore } >
1128
- { ( item ) => {
1127
+ onLoadMore = { list . loadMore }
1128
+ { ...props } >
1129
+ { ( item : any ) => {
1129
1130
if ( props . withActions ) {
1130
1131
return < Item key = { item . name } textValue = { item . name } > < Text > { item . name } </ Text > < ActionButton > Edit</ ActionButton > </ Item > ;
1131
1132
}
@@ -1135,15 +1136,15 @@ function AsyncList(props) {
1135
1136
) ;
1136
1137
}
1137
1138
1138
- function FalsyIds ( ) {
1139
+ function FalsyIds ( props ) {
1139
1140
let items = [
1140
1141
{ id : 1 , name : 'key=1' } ,
1141
1142
{ id : 0 , name : 'key=0' }
1142
1143
] ;
1143
1144
1144
1145
return (
1145
- < ListView width = "250px" height = { 400 } selectionMode = "multiple" onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } onAction = { action ( 'onAction' ) } >
1146
- { item => < Item > { item . name } </ Item > }
1146
+ < ListView aria-label = "falsy id ListView" width = "250px" height = { 400 } selectionMode = "multiple" onSelectionChange = { action ( 'onSelectionChange' ) } items = { items } onAction = { action ( 'onAction' ) } { ... props } >
1147
+ { ( item : any ) => < Item > { item . name } </ Item > }
1147
1148
</ ListView >
1148
1149
) ;
1149
1150
}
@@ -1159,7 +1160,7 @@ function ActionBarExample(props?) {
1159
1160
} ) ;
1160
1161
return (
1161
1162
< ActionBarContainer height = { 300 } >
1162
- < ListView { ...props } selectedKeys = { list . selectedKeys } onSelectionChange = { list . setSelectedKeys } items = { list . items } width = "250px" >
1163
+ < ListView { ...props } selectedKeys = { list . selectedKeys } onSelectionChange = { list . setSelectedKeys } items = { list . items } width = "250px" aria-label = "Action Bar ListView" >
1163
1164
{ ( item : any ) => < Item > { item . name } </ Item > }
1164
1165
</ ListView >
1165
1166
< ActionBar
0 commit comments