diff --git a/blocks/ExternalSource/ExternalSource.js b/blocks/ExternalSource/ExternalSource.js index 42c47e3f..b61942af 100644 --- a/blocks/ExternalSource/ExternalSource.js +++ b/blocks/ExternalSource/ExternalSource.js @@ -28,10 +28,12 @@ export class ExternalSource extends UploaderBlock { total: 0, isSelectionReady: false, + isDoneBtnEnabled: false, couldSelectAll: false, couldDeselectAll: false, showSelectionStatus: false, counterText: '', + doneBtnTextClass: 'uc-hidden', onDone: () => { for (const message of this.$.selectedList) { @@ -146,7 +148,9 @@ export class ExternalSource extends UploaderBlock { ); this.set$({ + doneBtnTextClass: message.isReady ? '' : 'uc-hidden', isSelectionReady: message.isReady, + isDoneBtnEnabled: message.isReady && message.selectedFiles.length > 0, showSelectionStatus: message.isMultipleMode && message.total > 0, couldSelectAll: message.selectedCount < message.total, couldDeselectAll: message.selectedCount === message.total, @@ -240,7 +244,7 @@ export class ExternalSource extends UploaderBlock { this.set$({ selectedList: [], total: 0, - isSelectionReady: false, + isDoneBtnEnabled: false, couldSelectAll: false, couldDeselectAll: false, showSelectionStatus: false, @@ -268,12 +272,10 @@ ExternalSource.template = /* HTML */ ` - + `; diff --git a/blocks/ExternalSource/external-source.css b/blocks/ExternalSource/external-source.css index ff470a60..0a3a243e 100644 --- a/blocks/ExternalSource/external-source.css +++ b/blocks/ExternalSource/external-source.css @@ -78,3 +78,17 @@ uc-external-source uc-activity-header { uc-external-source uc-activity-header .uc-close-btn { pointer-events: auto; } + +uc-external-source .uc-done-btn > span.uc-hidden { + visibility: hidden; + pointer-events: none; +} + +uc-external-source .uc-done-btn > uc-spinner { + position: absolute; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} diff --git a/blocks/Spinner/Spinner.js b/blocks/Spinner/Spinner.js new file mode 100644 index 00000000..cf2d280b --- /dev/null +++ b/blocks/Spinner/Spinner.js @@ -0,0 +1,5 @@ +import { BaseComponent } from '@symbiotejs/symbiote'; + +export class Spinner extends BaseComponent {} + +Spinner.template = /* HTML */ `
`; diff --git a/blocks/Spinner/spinner.css b/blocks/Spinner/spinner.css new file mode 100644 index 00000000..536a7b8d --- /dev/null +++ b/blocks/Spinner/spinner.css @@ -0,0 +1,18 @@ +@keyframes uc-spinner-keyframes { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +.uc-spinner { + width: 1em; + height: 1em; + border: solid 2px transparent; + border-top-color: currentColor; + border-left-color: currentColor; + border-radius: 50%; + animation: uc-spinner-keyframes 400ms linear infinite; +} diff --git a/blocks/themes/uc-basic/index.css b/blocks/themes/uc-basic/index.css index 6d3f5548..ae076f98 100644 --- a/blocks/themes/uc-basic/index.css +++ b/blocks/themes/uc-basic/index.css @@ -30,6 +30,7 @@ @import url('../../CloudImageEditor/index.css'); @import url('../../CloudImageEditorActivity/index.css'); @import url('../../Select/select.css'); +@import url('../../Spinner/spinner.css'); /* POST RESET */ @import url('post-reset.css'); diff --git a/index.js b/index.js index ed4d4c79..54f5afe1 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,7 @@ export { FormInput } from './blocks/FormInput/FormInput.js'; export { ActivityHeader } from './blocks/ActivityHeader/ActivityHeader.js'; export { Select } from './blocks/Select/Select.js'; export { Copyright } from './blocks/Copyright/Copyright.js'; +export { Spinner } from './blocks/Spinner/Spinner.js'; // Solutions: export { FileUploaderRegular } from './solutions/file-uploader/regular/FileUploaderRegular.js';