@getflip/swirl-components 0.225.1 → 0.225.2

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.
package/components.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-08-12T09:15:23",
2
+ "timestamp": "2024-08-12T09:41:05",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.18.1",
@@ -165,6 +165,12 @@ const SwirlFileViewerFallback = class {
165
165
  constructor(hostRef) {
166
166
  index.registerInstance(this, hostRef);
167
167
  this.activate = index.createEvent(this, "activate", 7);
168
+ this.download = async (event) => {
169
+ event.preventDefault();
170
+ const fileName = this.fileName || this.file.split("/").pop();
171
+ const file = await fetch(this.file);
172
+ FileSaver_min.exports.saveAs(await file.blob(), fileName);
173
+ };
168
174
  this.disableDownload = undefined;
169
175
  this.downloadButtonLabel = "Download";
170
176
  this.fileName = undefined;
@@ -174,7 +180,7 @@ const SwirlFileViewerFallback = class {
174
180
  this.activate.emit(this.el);
175
181
  }
176
182
  render() {
177
- return (index.h(index.Host, { key: '44e7cb280c1ea5c5bcaba0606ba9b80cb184f567', class: "file-viewer-fallback" }, index.h("swirl-stack", { key: 'd8e3ec9f3231ed26dbaad4354a725248023c9766', align: "center", height: "100%", justify: "center", spacing: "16" }, index.h("swirl-icon-file", { key: '0a496b835fa5cd1c388e149299565991613d84c0', class: "file-viewer-fallback__icon", color: "on-image", size: 28 }), this.fileName && (index.h("swirl-text", { key: '6f799e74cf34839d8dd655746da50b7b1b68357a', color: "on-image", size: "lg", weight: "medium" }, this.fileName)), !this.disableDownload && (index.h("swirl-button", { key: '8f00258c7a517e99dd293dc54cfc70c880f8dd4e', download: this.fileName, href: this.file, icon: "<swirl-icon-download></swirl-icon-download>", label: this.downloadButtonLabel, variant: "on-image" })))));
183
+ return (index.h(index.Host, { key: '013c3626aaf69477c1a36dbb73a3bc9ab35fe6af', class: "file-viewer-fallback" }, index.h("swirl-stack", { key: '009d8e202845210ce8259537baec1ec4f93caef0', align: "center", height: "100%", justify: "center", spacing: "16" }, index.h("swirl-icon-file", { key: '3ae8921a9c0c5f04a8b4998ce93e9805c10cd83e', class: "file-viewer-fallback__icon", color: "on-image", size: 28 }), this.fileName && (index.h("swirl-text", { key: 'cb3224d8ab22c78aea29f286ee1948165b813f1b', color: "on-image", size: "lg", weight: "medium" }, this.fileName)), !this.disableDownload && (index.h("swirl-button", { key: '756d8099401a76adfc6d4607a80078fa4bf92b36', download: this.fileName, href: this.file, icon: "<swirl-icon-download></swirl-icon-download>", label: this.downloadButtonLabel, onClick: this.download, variant: "on-image" })))));
178
184
  }
179
185
  get el() { return index.getElement(this); }
180
186
  };