@kodaris/krubble-components 1.0.45 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -544,6 +544,10 @@
544
544
  dropdown.style.top = '';
545
545
  dropdown.style.bottom = window.innerHeight - hostRect.top + 4 + 'px';
546
546
  dropdown.style.transformOrigin = 'bottom left';
547
+ dropdown.classList.add('dropdown--above');
548
+ }
549
+ else {
550
+ dropdown.classList.remove('dropdown--above');
547
551
  }
548
552
  // Align right if dropdown overflows viewport right
549
553
  if (dropdownRect.right > window.innerWidth) {
@@ -603,6 +607,12 @@
603
607
  this._stateTimeout = window.setTimeout(() => this.reset(), duration);
604
608
  }
605
609
  }
610
+ /**
611
+ * Returns whether the button is currently in the loading state.
612
+ */
613
+ isLoading() {
614
+ return this._state === 'loading';
615
+ }
606
616
  /**
607
617
  * Resets the button to its idle state.
608
618
  */
@@ -843,6 +853,10 @@
843
853
  animation: dropdown-fade-in 150ms ease-out;
844
854
  }
845
855
 
856
+ .dropdown--above {
857
+ animation-name: dropdown-fade-in-above;
858
+ }
859
+
846
860
  @keyframes dropdown-fade-in {
847
861
  from {
848
862
  opacity: 0;
@@ -854,6 +868,17 @@
854
868
  }
855
869
  }
856
870
 
871
+ @keyframes dropdown-fade-in-above {
872
+ from {
873
+ opacity: 0;
874
+ transform: translateY(4px);
875
+ }
876
+ to {
877
+ opacity: 1;
878
+ transform: translateY(0);
879
+ }
880
+ }
881
+
857
882
  .dropdown-item {
858
883
  display: block;
859
884
  width: 100%;
@@ -4020,16 +4045,6 @@
4020
4045
  composed: true,
4021
4046
  detail: { src: this.src, name: this.name },
4022
4047
  }));
4023
- fetch(this.src)
4024
- .then(response => response.blob())
4025
- .then(blob => {
4026
- const blobUrl = URL.createObjectURL(blob);
4027
- const a = document.createElement('a');
4028
- a.href = blobUrl;
4029
- a.download = this.name || 'file';
4030
- a.click();
4031
- URL.revokeObjectURL(blobUrl);
4032
- });
4033
4048
  }
4034
4049
  _handleZoomIn() {
4035
4050
  this._zoomLevel = Math.min(this._zoomLevel + 25, 300);
@@ -4456,7 +4471,10 @@
4456
4471
  detail: { file },
4457
4472
  }));
4458
4473
  if (file.url) {
4459
- exports.KRFilePreview.open({ src: file.url, name: file.name });
4474
+ const preview = exports.KRFilePreview.open({ src: file.url, name: file.name });
4475
+ preview.addEventListener('download', () => {
4476
+ this._handleDownload(file);
4477
+ });
4460
4478
  }
4461
4479
  }
4462
4480
  _handleDownload(file) {
@@ -4465,18 +4483,6 @@
4465
4483
  composed: true,
4466
4484
  detail: { file },
4467
4485
  }));
4468
- if (file.url) {
4469
- fetch(file.url)
4470
- .then(response => response.blob())
4471
- .then(blob => {
4472
- const blobUrl = URL.createObjectURL(blob);
4473
- const a = document.createElement('a');
4474
- a.href = blobUrl;
4475
- a.download = file.name || 'file';
4476
- a.click();
4477
- URL.revokeObjectURL(blobUrl);
4478
- });
4479
- }
4480
4486
  }
4481
4487
  _handleDelete(file) {
4482
4488
  this.dispatchEvent(new CustomEvent('delete', {
@@ -4658,9 +4664,6 @@
4658
4664
  fill: #000;
4659
4665
  }
4660
4666
 
4661
- .file-list__action--delete:hover {
4662
- fill: #dc3545;
4663
- }
4664
4667
 
4665
4668
  .file-list__empty {
4666
4669
  color: #000;