@@ -30,7 +30,7 @@ export default class DaList extends LitElement {
3030 _dropFiles : { state : true } ,
3131 _dropMessage : { state : true } ,
3232 _dropConflicts : { state : true } ,
33- _status : { state : true } ,
33+ _toast : { state : true } ,
3434 _confirm : { state : true } ,
3535 _confirmText : { state : true } ,
3636 _unpublish : { state : true } ,
@@ -91,16 +91,17 @@ export default class DaList extends LitElement {
9191
9292 async firstUpdated ( ) {
9393 await import ( '../../shared/da-dialog/da-dialog.js' ) ;
94+ await import ( '../../shared/da-toast/da-toast.js' ) ;
9495 await import ( '../da-actionbar/da-actionbar.js' ) ;
9596 this . setupObserver ( ) ;
9697 }
9798
9899 setStatus ( text , description , type = 'info' ) {
99100 if ( ! text ) {
100- this . _status = null ;
101+ this . _toast = null ;
101102 return ;
102103 }
103- this . _status = { type, text, description } ;
104+ this . _toast = { type, text, description, duration : 0 } ;
104105 }
105106
106107 handlePermissions ( permissions ) {
@@ -409,7 +410,7 @@ export default class DaList extends LitElement {
409410 return pasteItem ;
410411 } ) ;
411412
412- const showStatus = setTimeout ( ( ) => {
413+ const pasteStatusTimer = setTimeout ( ( ) => {
413414 this . setStatus ( 'Pasting' , 'Please be patient. Pasting items with many children can take time.' ) ;
414415 } , 2000 ) ;
415416
@@ -419,7 +420,7 @@ export default class DaList extends LitElement {
419420 await this . handleItemAction ( { item, type } ) ;
420421 } ) ) ;
421422
422- clearTimeout ( showStatus ) ;
423+ clearTimeout ( pasteStatusTimer ) ;
423424
424425 this . setStatus ( ) ;
425426 this . handleClear ( ) ;
@@ -506,8 +507,7 @@ export default class DaList extends LitElement {
506507 }
507508
508509 handleShare ( ) {
509- this . setStatus ( 'Copied' , 'URLs have been copied to the clipboard.' ) ;
510- setTimeout ( ( ) => { this . setStatus ( ) ; } , 3000 ) ;
510+ this . _toast = { text : 'Copied' , description : 'URLs have been copied to the clipboard.' } ;
511511 }
512512
513513 dragenter ( e ) {
@@ -793,13 +793,7 @@ export default class DaList extends LitElement {
793793 }
794794
795795 renderStatus ( ) {
796- return html `
797- < div class ="da-list-status ">
798- < div class ="da-list-status-toast da-list-status-type- ${ this . _status . type } ">
799- < p class ="da-list-status-title "> ${ this . _status . text } </ p >
800- ${ this . _status . description ? html `< p class ="da-list-status-description "> ${ this . _status . description } </ p > ` : nothing }
801- </ div >
802- </ div > ` ;
796+ return html `< da-toast .toast =${ this . _toast } @close =${ ( ) => { this . _toast = null ; } } > </ da-toast > ` ;
803797 }
804798
805799 renderConfirm ( ) {
@@ -1012,7 +1006,7 @@ export default class DaList extends LitElement {
10121006 currentPath="${ this . fullpath } "
10131007 role="row"
10141008 data-visible="${ this . _selectedItems ?. length > 0 } "> </ da-actionbar >
1015- ${ this . _status ? this . renderStatus ( ) : nothing }
1009+ ${ this . _toast ? this . renderStatus ( ) : nothing }
10161010 ${ this . _confirm ? this . renderConfirm ( ) : nothing }
10171011 ${ this . _dropConflicts ?. length ? this . renderDropConfirm ( ) : nothing }
10181012 ${ ! this . _confirm && this . _itemErrors . length ? this . renderErrors ( ) : nothing }
0 commit comments