@limetech/lime-elements 37.1.0-next.54 → 37.1.0-next.56

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.
Files changed (64) hide show
  1. package/dist/cjs/lime-elements.cjs.js +1 -1
  2. package/dist/cjs/limel-chip-set.cjs.entry.js +8 -0
  3. package/dist/cjs/limel-chip-set.cjs.entry.js.map +1 -1
  4. package/dist/cjs/limel-file-viewer.cjs.entry.js +36 -11
  5. package/dist/cjs/limel-file-viewer.cjs.entry.js.map +1 -1
  6. package/dist/cjs/limel-file.cjs.entry.js +2 -1
  7. package/dist/cjs/limel-file.cjs.entry.js.map +1 -1
  8. package/dist/cjs/limel-form.cjs.entry.js +491 -6079
  9. package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
  10. package/dist/cjs/limel-helper-line.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-helper-line.cjs.entry.js.map +1 -1
  12. package/dist/cjs/limel-picker.cjs.entry.js +2 -1
  13. package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/components/chip-set/chip-set.js +26 -0
  16. package/dist/collection/components/chip-set/chip-set.js.map +1 -1
  17. package/dist/collection/components/file/file.js +20 -1
  18. package/dist/collection/components/file/file.js.map +1 -1
  19. package/dist/collection/components/file-viewer/file-viewer.js +39 -12
  20. package/dist/collection/components/file-viewer/file-viewer.js.map +1 -1
  21. package/dist/collection/components/helper-line/helper-line.css +3 -4
  22. package/dist/collection/components/picker/picker.js +20 -1
  23. package/dist/collection/components/picker/picker.js.map +1 -1
  24. package/dist/esm/lime-elements.js +1 -1
  25. package/dist/esm/limel-chip-set.entry.js +8 -0
  26. package/dist/esm/limel-chip-set.entry.js.map +1 -1
  27. package/dist/esm/limel-file-viewer.entry.js +36 -11
  28. package/dist/esm/limel-file-viewer.entry.js.map +1 -1
  29. package/dist/esm/limel-file.entry.js +2 -1
  30. package/dist/esm/limel-file.entry.js.map +1 -1
  31. package/dist/esm/limel-form.entry.js +491 -6079
  32. package/dist/esm/limel-form.entry.js.map +1 -1
  33. package/dist/esm/limel-helper-line.entry.js +1 -1
  34. package/dist/esm/limel-helper-line.entry.js.map +1 -1
  35. package/dist/esm/limel-picker.entry.js +2 -1
  36. package/dist/esm/limel-picker.entry.js.map +1 -1
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/lime-elements/lime-elements.esm.js +1 -1
  39. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  40. package/dist/lime-elements/p-17989f4d.entry.js +21 -0
  41. package/dist/lime-elements/p-17989f4d.entry.js.map +1 -0
  42. package/dist/lime-elements/{p-80f0c441.entry.js → p-17b91e03.entry.js} +2 -2
  43. package/dist/lime-elements/{p-80f0c441.entry.js.map → p-17b91e03.entry.js.map} +1 -1
  44. package/dist/lime-elements/{p-8eff47a6.entry.js → p-71802c27.entry.js} +2 -2
  45. package/dist/lime-elements/p-71802c27.entry.js.map +1 -0
  46. package/dist/lime-elements/p-98be972f.entry.js +16 -0
  47. package/dist/lime-elements/p-98be972f.entry.js.map +1 -0
  48. package/dist/lime-elements/{p-b8deba1b.entry.js → p-b4f1c135.entry.js} +2 -2
  49. package/dist/lime-elements/p-b4f1c135.entry.js.map +1 -0
  50. package/dist/lime-elements/p-eacad510.entry.js +2 -0
  51. package/dist/lime-elements/p-eacad510.entry.js.map +1 -0
  52. package/dist/types/components/chip-set/chip-set.d.ts +5 -0
  53. package/dist/types/components/file/file.d.ts +5 -0
  54. package/dist/types/components/picker/picker.d.ts +5 -0
  55. package/dist/types/components.d.ts +24 -0
  56. package/package.json +4 -4
  57. package/dist/lime-elements/p-1f6953d2.entry.js +0 -2
  58. package/dist/lime-elements/p-1f6953d2.entry.js.map +0 -1
  59. package/dist/lime-elements/p-21450d9a.entry.js +0 -21
  60. package/dist/lime-elements/p-21450d9a.entry.js.map +0 -1
  61. package/dist/lime-elements/p-7bddef83.entry.js +0 -16
  62. package/dist/lime-elements/p-7bddef83.entry.js.map +0 -1
  63. package/dist/lime-elements/p-8eff47a6.entry.js.map +0 -1
  64. package/dist/lime-elements/p-b8deba1b.entry.js.map +0 -1
@@ -123,33 +123,37 @@ const FileViewer = class {
123
123
  this.renderPdf = () => {
124
124
  return [
125
125
  index.h("div", { class: "action-menu-for-pdf-files" }, this.renderActionMenu()),
126
- index.h("object", { data: this.url, type: "application/pdf" }),
126
+ index.h("iframe", { src: this.fileUrl }),
127
127
  ];
128
128
  };
129
129
  this.renderImage = () => {
130
- return [this.renderButtons(), index.h("img", { src: this.url, alt: this.alt })];
130
+ return [
131
+ this.renderButtons(),
132
+ index.h("img", { src: this.fileUrl, alt: this.alt }),
133
+ ];
131
134
  };
132
135
  this.renderVideo = () => {
133
- return (index.h("video", { controls: true }, index.h("source", { src: this.url })));
136
+ return (index.h("video", { controls: true }, index.h("source", { src: this.fileUrl })));
134
137
  };
135
138
  this.renderAudio = () => {
136
- return (index.h("audio", { controls: true }, index.h("source", { src: this.url })));
139
+ return (index.h("audio", { controls: true }, index.h("source", { src: this.fileUrl })));
137
140
  };
138
141
  this.renderText = () => {
139
142
  return [
140
143
  this.renderButtons(),
141
- index.h("object", { data: this.url, type: "text/plain" }),
144
+ index.h("object", { data: this.fileUrl, type: "text/plain" }),
142
145
  ];
143
146
  };
144
147
  this.renderOffice = () => {
145
148
  return [
146
149
  index.h("div", { class: "action-menu-for-office-files" }, this.renderActionMenu()),
147
- index.h("iframe", { src: this.getOfficeViewerUrl() + this.url + '&embedded=true', frameborder: "0" }),
150
+ index.h("iframe", { src: this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true', frameborder: "0" }),
148
151
  ];
149
152
  };
150
153
  this.isOfficeFileAccessibleViaURL = () => {
151
154
  return (this.fileType === 'office' &&
152
- !(this.url.startsWith('http://') || this.url.startsWith('https://')));
155
+ !(this.fileUrl.startsWith('http://') ||
156
+ this.fileUrl.startsWith('https://')));
153
157
  };
154
158
  this.getOfficeViewerUrl = () => {
155
159
  const officeViewers = {
@@ -182,13 +186,13 @@ const FileViewer = class {
182
186
  if (!this.allowDownload || this.isFullscreen) {
183
187
  return;
184
188
  }
185
- return (index.h("a", { class: "button--download", id: "tooltip-download", role: "button", download: this.filename ? this.filename : '', href: this.url, target: "_blank" }, index.h("limel-icon", { name: "download_2" }), index.h("limel-tooltip", { label: this.getTranslation('download'), elementId: "tooltip-download", openDirection: "left" })));
189
+ return (index.h("a", { class: "button--download", id: "tooltip-download", role: "button", download: this.filename ? this.filename : '', href: this.fileUrl, target: "_blank" }, index.h("limel-icon", { name: "download_2" }), index.h("limel-tooltip", { label: this.getTranslation('download'), elementId: "tooltip-download", openDirection: "left" })));
186
190
  };
187
191
  this.renderOpenInNewTabButton = () => {
188
192
  if (!this.allowOpenInNewTab || this.isFullscreen) {
189
193
  return;
190
194
  }
191
- return (index.h("a", { class: "button--new-tab", id: "tooltip-new-tab", role: "button", href: this.url, target: "_blank", rel: "noopener noreferrer" }, index.h("limel-icon", { name: "external_link" }), index.h("limel-tooltip", { label: this.getTranslation('open-in-new-tab'), elementId: "tooltip-new-tab", openDirection: "left" })));
195
+ return (index.h("a", { class: "button--new-tab", id: "tooltip-new-tab", role: "button", href: this.fileUrl, target: "_blank", rel: "noopener noreferrer" }, index.h("limel-icon", { name: "external_link" }), index.h("limel-tooltip", { label: this.getTranslation('open-in-new-tab'), elementId: "tooltip-new-tab", openDirection: "left" })));
192
196
  };
193
197
  this.renderActionMenu = () => {
194
198
  if (!this.actions || this.isFullscreen) {
@@ -196,6 +200,17 @@ const FileViewer = class {
196
200
  }
197
201
  return (index.h("limel-menu", { class: "action-menu", items: this.actions, onSelect: this.emitOnAction, "open-direction": "left" }, index.h("button", { class: "button--action", id: "tooltip-more", role: "button", slot: "trigger" }, index.h("limel-icon", { name: "menu_2" }), index.h("limel-tooltip", { label: this.getTranslation('more-actions'), elementId: "tooltip-more", openDirection: "left" }))));
198
202
  };
203
+ this.createURL = async (fileType) => {
204
+ if (['pdf'].includes(fileType)) {
205
+ const response = await fetch(this.url);
206
+ const blob = await response.blob();
207
+ this.fileUrl = URL.createObjectURL(blob);
208
+ }
209
+ else {
210
+ this.fileUrl = this.url;
211
+ }
212
+ this.loading = false;
213
+ };
199
214
  this.handleToggleFullscreen = () => {
200
215
  if (this.fullscreen.isSupported()) {
201
216
  this.fullscreen.toggle();
@@ -217,20 +232,30 @@ const FileViewer = class {
217
232
  this.actions = undefined;
218
233
  this.isFullscreen = false;
219
234
  this.fileType = undefined;
235
+ this.loading = true;
236
+ this.fileUrl = '';
220
237
  this.fullscreen = new Fullscreen(this.HostElement);
238
+ }
239
+ async componentWillLoad() {
221
240
  this.fileType = detectExtension(this.filename, this.url);
241
+ await this.createURL(this.url);
222
242
  }
223
243
  render() {
224
244
  if (!this.isOfficeFileAccessibleViaURL) {
225
245
  return this.renderNoFileSupportMessage();
226
246
  }
247
+ if (this.loading) {
248
+ return index.h("limel-spinner", { size: "x-small", limeBranded: false });
249
+ }
227
250
  return this.renderFileViewer();
228
251
  }
229
- watchUrl(newUrl, oldUrl) {
252
+ async watchUrl(newUrl, oldUrl) {
230
253
  if (newUrl === oldUrl) {
231
254
  return;
232
255
  }
233
- this.fileType = detectExtension(this.filename, this.url);
256
+ this.loading = true;
257
+ this.fileType = detectExtension(this.filename, this.fileUrl);
258
+ await this.createURL(this.fileType);
234
259
  }
235
260
  renderFileViewer() {
236
261
  const fileViewerFunctions = {
@@ -1 +1 @@
1
- {"file":"limel-file-viewer.entry.cjs.js","mappings":";;;;;;;SAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG;EACzC,MAAM,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC;EACjC,IAAI,CAAC,QAAQ,EAAE;IACX,OAAO,SAAS,CAAC;GACpB;EAED,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;EAC1D,MAAM,iBAAiB,GAAG;IACtB,GAAG,EAA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eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;GAC5D;EAEO,gBAAgB;IACpB,MAAM,mBAAmB,GAAG;MACxB,GAAG,EAAE,IAAI,CAAC,SAAS;MACnB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,IAAI,EAAE,IAAI,CAAC,UAAU;MACrB,MAAM,EAAE,IAAI,CAAC,YAAY;KAC5B,CAAC;IACF,MAAM,kBAAkB,GACpB,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClC,IAAI,CAAC,0BAA0B,CAAC;IAEpC,OAAO,kBAAkB,EAAE,CAAC;GAC/B;EAmNO,cAAc,CAAC,GAAW;IAC9B,OAAOC,sBAAS,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC7D;;;;;;;;;;","names":["h","translate"],"sources":["./src/components/file-viewer/extension-mapping.tsx","./src/components/file-viewer/fullscreen.ts","./src/components/file-viewer/file-viewer.scss?tag=limel-file-viewer&encapsulation=shadow","./src/components/file-viewer/file-viewer.tsx"],"sourcesContent":["export function detectExtension(fileName, url): any {\n const pathLike = fileName || url;\n if (!pathLike) {\n return 'unknown';\n }\n\n const extension = pathLike.split('.').pop().toLowerCase();\n const extensionsToTypes = {\n pdf: 'pdf',\n jpg: 'image',\n jpeg: 'image',\n heic: 'image',\n bmp: 'image',\n png: 'image',\n gif: 'image',\n svg: 'image',\n svgz: 'image',\n ep: 'image',\n eps: 'image',\n avi: 'video',\n flv: 'video',\n h264: 'video',\n mov: 'video',\n mp4: 'video',\n mwv: 'video',\n mkv: 'video',\n mp3: 'audio',\n wav: 'audio',\n wma: 'audio',\n ogg: 'audio',\n txt: 'text',\n json: 'text',\n html: 'text',\n xml: 'text',\n // Word\n doc: 'office',\n docx: 'office',\n odt: 'office',\n dot: 'office',\n dotx: 'office',\n docm: 'office', // not supported\n dotm: 'office', // not yet tested\n // Presentation\n pot: 'office', // not tested\n ppt: 'office',\n pptx: 'office',\n odp: 'office',\n potx: 'office', // not supported\n potm: 'office', // not supported\n pps: 'office',\n ppsx: 'office',\n ppsm: 'office', // not supported\n pptm: 'office', // not supported\n ppam: 'office', // not tested\n pages: 'office', // not supported (Apple)\n // Spreadsheet\n xls: 'office',\n xlsx: 'office',\n xlsm: 'office',\n xlsb: 'office',\n ods: 'office',\n csv: 'office', // not supported\n numbers: 'office', // not supported (Apple)\n };\n\n return extensionsToTypes[extension] || 'unknown';\n}\n","export class Fullscreen {\n private enter: () => void;\n private exit: () => void;\n\n constructor(element: any) {\n this.enter =\n element.requestFullscreen ||\n element.msRequestFullscreen ||\n element.mozRequestFullScreen ||\n element.webkitRequestFullscreen;\n this.enter = this.enter.bind(element);\n const doc: any = window.document;\n this.exit =\n doc.exitFullscreen ||\n doc.msExitFullscreen ||\n doc.mozCancelFullScreen ||\n doc.webkitExitFullscreen;\n }\n\n public requestFullscreen = () => {\n if (this.enter) {\n this.enter();\n }\n };\n\n public exitFullscreen = () => {\n if (this.exit) {\n this.exit.bind(window.document)();\n }\n };\n\n public toggle = () => {\n const doc: any = window.document;\n const isFullscreen =\n doc.fullscreenElement ||\n doc.mozFullScreenElement ||\n doc.webkitFullscreenElement ||\n doc.msFullscreenElement;\n\n if (isFullscreen) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n };\n\n public isSupported(): boolean {\n return !!this.requestFullscreen;\n }\n}\n","@use '../../style/internal/variables';\n@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n\n$size-of-buttons: 2rem;\n\n:host {\n isolation: isolate;\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n\n* {\n box-sizing: border-box;\n}\n\nimg,\nvideo,\naudio,\nobject,\niframe {\n max-height: 100%;\n max-width: 100%;\n box-sizing: border-box;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n min-height: 20rem; // makes sure to get minimum comfortable space for viewing office files, and Microsoft Office viewers toolbars\n}\n\nimg {\n min-width: 7rem;\n object-fit: contain; // increases or decreases the size of the image to fill the box whilst preserving its aspect-ratio.\n}\n\nvideo {\n width: 100%;\n height: auto;\n}\n\naudio {\n width: 100%;\n}\n\nobject {\n width: 100%;\n height: 100%;\n}\n\nobject[type='application/pdf'] {\n min-height: 20rem;\n // makes sure to get browsers' native controls for the PDF\n}\n\nobject[type='text/plain'] {\n border-radius: 0.25rem;\n padding-right: $size-of-buttons;\n\n overflow-y: auto;\n}\n\n@mixin plain-text-in-fullscreen {\n background-color: rgb(var(--color-gray-darker));\n\n object[type='text/plain'] {\n max-width: 50rem;\n max-height: calc(100% - 2rem);\n }\n}\n\n:host(:fullscreen) {\n @include plain-text-in-fullscreen;\n}\n:host(:-webkit-full-screen) {\n // this is repetition of the previous block,\n // but needed for Safari to work.\n // Cannot write SCSS rules for `:host` using commas for some reason.\n // e.g.: `:host(:fullscreen), :host(:-webkit-full-screen)`.\n // So you have to repeat it sadly.\n @include plain-text-in-fullscreen;\n}\n\n@import './partial-styles/ui-controls.scss';\n","import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages, ListItem } from '@limetech/lime-elements';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\n\n/**\n * This is a smart component that automatically detects\n * the most common file types such as image, audio, video, and text,\n * and properly displays them in the browser.\n * The component is also capable to render the most common office files.\n *\n * :::note\n * Image files will always be contained in their containers, which means\n * they automatically increase or decrease in size to fill their containing box\n * whilst preserving their aspect-ratio.\n *\n * Text and PDF files will also always respect the width and height of the\n * container in which the `limel-file-viewer` is loaded.\n * :::\n *\n * For some file types such as text and images, the component will display a\n * download button and a button to open the file in a new browser tab.\n * This will allow users to preview the file in a fullscreen mode with the\n * browser and take advantage of for example native zooming and panning\n * functionalities.\n * @exampleComponent limel-example-file-viewer\n * @exampleComponent limel-example-file-viewer-office\n * @exampleComponent limel-example-file-viewer-filename\n * @exampleComponent limel-example-file-viewer-inbuilt-actions\n * @exampleComponent limel-example-file-viewer-custom-actions\n * @exampleComponent limel-example-file-viewer-with-picker\n * @private\n */\n\n@Component({\n tag: 'limel-file-viewer',\n shadow: true,\n styleUrl: 'file-viewer.scss',\n})\nexport class FileViewer {\n /**\n * Link to the file\n */\n @Prop({ reflect: true })\n public url: string;\n\n /**\n * The name of the file that must also contains its extension.\n * This overrides the filename that the `url` ends with.\n * Useful when the `url` does not contain the filename.\n * When specified, the `filename` will be used as filename of\n * the downloaded file.\n */\n @Prop({ reflect: true })\n public filename?: string;\n\n /**\n * An optional alternative text, mainly for assistive technologies and screen readers.\n * It is used for only image files, as an `alt` attribute.\n * Should optimally hold a description of the image,\n * which is also displayed on the page if the image can't be loaded for some reason.\n */\n @Prop({ reflect: true })\n public alt?: string;\n\n /**\n * Displays a button that allows the user to view the file\n * in fullscreen mode.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowFullscreen?: boolean = false;\n\n /**\n * Displays a button that allows the user to open the file\n * in a new browser tab.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowOpenInNewTab?: boolean = false;\n\n /**\n * Displays a button that allows the user to download the file.\n * Note that due to the browser's security policies,\n * the file should be hosted on the same domain\n * for the download button to work properly.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowDownload?: boolean = false;\n\n /**\n * Defines the localization for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Defines the third-party viewer that should be used to render\n * the content of office files, such as word processing documents,\n * presentations, or spreadsheets.\n */\n @Prop({ reflect: true })\n public officeViewer: OfficeViewer = 'microsoft-office';\n\n /**\n * An array of custom actions that can be displayed\n * as an action menu on the file which is being displayed.\n */\n @Prop()\n public actions: ListItem[];\n\n /**\n * Emitted when a custom action is selected from the action menu.\n */\n @Event()\n public action: EventEmitter<ListItem>;\n\n @Element()\n public HostElement: HTMLLimelFileViewerElement;\n\n private fullscreen: Fullscreen;\n\n @State()\n private isFullscreen: boolean = false;\n\n @State()\n public fileType: FileType;\n\n constructor() {\n this.fullscreen = new Fullscreen(this.HostElement);\n this.fileType = detectExtension(this.filename, this.url);\n }\n\n public render() {\n if (!this.isOfficeFileAccessibleViaURL) {\n return this.renderNoFileSupportMessage();\n }\n\n return this.renderFileViewer();\n }\n\n @Watch('url')\n protected watchUrl(newUrl: string, oldUrl: string) {\n if (newUrl === oldUrl) {\n return;\n }\n\n this.fileType = detectExtension(this.filename, this.url);\n }\n\n private renderFileViewer() {\n const fileViewerFunctions = {\n pdf: this.renderPdf,\n image: this.renderImage,\n video: this.renderVideo,\n audio: this.renderAudio,\n text: this.renderText,\n office: this.renderOffice,\n };\n const fileViewerFunction =\n fileViewerFunctions[this.fileType] ||\n this.renderNoFileSupportMessage;\n\n return fileViewerFunction();\n }\n\n private renderPdf = () => {\n return [\n <div class=\"action-menu-for-pdf-files\">\n {this.renderActionMenu()}\n </div>,\n <object data={this.url} type=\"application/pdf\" />,\n ];\n };\n\n private renderImage = () => {\n return [this.renderButtons(), <img src={this.url} alt={this.alt} />];\n };\n\n private renderVideo = () => {\n return (\n <video controls>\n <source src={this.url} />\n </video>\n );\n };\n\n private renderAudio = () => {\n return (\n <audio controls>\n <source src={this.url} />\n </audio>\n );\n };\n\n private renderText = () => {\n return [\n this.renderButtons(),\n <object data={this.url} type=\"text/plain\" />,\n ];\n };\n\n private renderOffice = () => {\n return [\n <div class=\"action-menu-for-office-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe\n src={this.getOfficeViewerUrl() + this.url + '&embedded=true'}\n frameborder=\"0\"\n />,\n ];\n };\n\n private isOfficeFileAccessibleViaURL = () => {\n return (\n this.fileType === 'office' &&\n !(this.url.startsWith('http://') || this.url.startsWith('https://'))\n );\n };\n\n private getOfficeViewerUrl = () => {\n const officeViewers = {\n 'microsoft-office':\n 'https://view.officeapps.live.com/op/embed.aspx?src=',\n 'google-drive': 'https://docs.google.com/gview?url=',\n };\n\n return officeViewers[this.officeViewer];\n };\n\n private renderNoFileSupportMessage = () => {\n return (\n <div class=\"no-support\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>{this.getTranslation('message.unsupported-filetype')}</p>\n {this.renderDownloadButton()}\n </div>\n );\n };\n\n private renderButtons = () => {\n return (\n <div class=\"buttons\">\n {this.renderActionMenu()}\n {this.renderToggleFullscreenButton()}\n {this.renderDownloadButton()}\n {this.renderOpenInNewTabButton()}\n </div>\n );\n };\n\n private renderToggleFullscreenButton = () => {\n if (!this.allowFullscreen || !this.fullscreen.isSupported()) {\n return;\n }\n\n const icon = this.isFullscreen ? 'multiply' : 'fit_to_width';\n // eslint-disable-next-line multiline-ternary\n const label = this.isFullscreen\n ? // eslint-disable-next-line multiline-ternary\n this.getTranslation('exit-fullscreen')\n : this.getTranslation('open-in-fullscreen');\n\n return [\n <button\n class=\"button--toggle-fullscreen\"\n id=\"tooltip-toggle-fullscreen\"\n role=\"button\"\n onClick={this.handleToggleFullscreen}\n >\n <limel-icon name={icon} />\n <limel-tooltip\n label={label}\n elementId=\"tooltip-toggle-fullscreen\"\n openDirection=\"left\"\n />\n </button>,\n ];\n };\n\n private renderDownloadButton = () => {\n if (!this.allowDownload || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--download\"\n id=\"tooltip-download\"\n role=\"button\"\n download={this.filename ? this.filename : ''}\n href={this.url}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('download')}\n elementId=\"tooltip-download\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderOpenInNewTabButton = () => {\n if (!this.allowOpenInNewTab || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--new-tab\"\n id=\"tooltip-new-tab\"\n role=\"button\"\n href={this.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <limel-icon name=\"external_link\" />\n <limel-tooltip\n label={this.getTranslation('open-in-new-tab')}\n elementId=\"tooltip-new-tab\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderActionMenu = () => {\n if (!this.actions || this.isFullscreen) {\n return;\n }\n\n return (\n <limel-menu\n class=\"action-menu\"\n items={this.actions}\n onSelect={this.emitOnAction}\n open-direction=\"left\"\n >\n <button\n class=\"button--action\"\n id=\"tooltip-more\"\n role=\"button\"\n slot=\"trigger\"\n >\n <limel-icon name=\"menu_2\" />\n <limel-tooltip\n label={this.getTranslation('more-actions')}\n elementId=\"tooltip-more\"\n openDirection=\"left\"\n />\n </button>\n </limel-menu>\n );\n };\n\n private handleToggleFullscreen = () => {\n if (this.fullscreen.isSupported()) {\n this.fullscreen.toggle();\n this.isFullscreen = !this.isFullscreen;\n }\n };\n\n private emitOnAction = (event: CustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(`file-viewer.${key}`, this.language);\n }\n}\n"],"version":3}
1
+ {"file":"limel-file-viewer.entry.cjs.js","mappings":";;;;;;;SAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG;EACzC,MAAM,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC;EACjC,IAAI,CAAC,QAAQ,EAAE;IACX,OAAO,SAAS,CAAC;GACpB;EAED,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;EAC1D,MAAM,iBAAiB,GAAG;IACtB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO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","translate"],"sources":["./src/components/file-viewer/extension-mapping.tsx","./src/components/file-viewer/fullscreen.ts","./src/components/file-viewer/file-viewer.scss?tag=limel-file-viewer&encapsulation=shadow","./src/components/file-viewer/file-viewer.tsx"],"sourcesContent":["export function detectExtension(fileName, url): any {\n const pathLike = fileName || url;\n if (!pathLike) {\n return 'unknown';\n }\n\n const extension = pathLike.split('.').pop().toLowerCase();\n const extensionsToTypes = {\n pdf: 'pdf',\n jpg: 'image',\n jpeg: 'image',\n heic: 'image',\n bmp: 'image',\n png: 'image',\n gif: 'image',\n svg: 'image',\n svgz: 'image',\n ep: 'image',\n eps: 'image',\n avi: 'video',\n flv: 'video',\n h264: 'video',\n mov: 'video',\n mp4: 'video',\n mwv: 'video',\n mkv: 'video',\n mp3: 'audio',\n wav: 'audio',\n wma: 'audio',\n ogg: 'audio',\n txt: 'text',\n json: 'text',\n html: 'text',\n xml: 'text',\n // Word\n doc: 'office',\n docx: 'office',\n odt: 'office',\n dot: 'office',\n dotx: 'office',\n docm: 'office', // not supported\n dotm: 'office', // not yet tested\n // Presentation\n pot: 'office', // not tested\n ppt: 'office',\n pptx: 'office',\n odp: 'office',\n potx: 'office', // not supported\n potm: 'office', // not supported\n pps: 'office',\n ppsx: 'office',\n ppsm: 'office', // not supported\n pptm: 'office', // not supported\n ppam: 'office', // not tested\n pages: 'office', // not supported (Apple)\n // Spreadsheet\n xls: 'office',\n xlsx: 'office',\n xlsm: 'office',\n xlsb: 'office',\n ods: 'office',\n csv: 'office', // not supported\n numbers: 'office', // not supported (Apple)\n };\n\n return extensionsToTypes[extension] || 'unknown';\n}\n","export class Fullscreen {\n private enter: () => void;\n private exit: () => void;\n\n constructor(element: any) {\n this.enter =\n element.requestFullscreen ||\n element.msRequestFullscreen ||\n element.mozRequestFullScreen ||\n element.webkitRequestFullscreen;\n this.enter = this.enter.bind(element);\n const doc: any = window.document;\n this.exit =\n doc.exitFullscreen ||\n doc.msExitFullscreen ||\n doc.mozCancelFullScreen ||\n doc.webkitExitFullscreen;\n }\n\n public requestFullscreen = () => {\n if (this.enter) {\n this.enter();\n }\n };\n\n public exitFullscreen = () => {\n if (this.exit) {\n this.exit.bind(window.document)();\n }\n };\n\n public toggle = () => {\n const doc: any = window.document;\n const isFullscreen =\n doc.fullscreenElement ||\n doc.mozFullScreenElement ||\n doc.webkitFullscreenElement ||\n doc.msFullscreenElement;\n\n if (isFullscreen) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n };\n\n public isSupported(): boolean {\n return !!this.requestFullscreen;\n }\n}\n","@use '../../style/internal/variables';\n@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n\n$size-of-buttons: 2rem;\n\n:host {\n isolation: isolate;\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n\n* {\n box-sizing: border-box;\n}\n\nimg,\nvideo,\naudio,\nobject,\niframe {\n max-height: 100%;\n max-width: 100%;\n box-sizing: border-box;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n min-height: 20rem; // makes sure to get minimum comfortable space for viewing office files, and Microsoft Office viewers toolbars\n}\n\nimg {\n min-width: 7rem;\n object-fit: contain; // increases or decreases the size of the image to fill the box whilst preserving its aspect-ratio.\n}\n\nvideo {\n width: 100%;\n height: auto;\n}\n\naudio {\n width: 100%;\n}\n\nobject {\n width: 100%;\n height: 100%;\n}\n\nobject[type='application/pdf'] {\n min-height: 20rem;\n // makes sure to get browsers' native controls for the PDF\n}\n\nobject[type='text/plain'] {\n border-radius: 0.25rem;\n padding-right: $size-of-buttons;\n\n overflow-y: auto;\n}\n\n@mixin plain-text-in-fullscreen {\n background-color: rgb(var(--color-gray-darker));\n\n object[type='text/plain'] {\n max-width: 50rem;\n max-height: calc(100% - 2rem);\n }\n}\n\n:host(:fullscreen) {\n @include plain-text-in-fullscreen;\n}\n:host(:-webkit-full-screen) {\n // this is repetition of the previous block,\n // but needed for Safari to work.\n // Cannot write SCSS rules for `:host` using commas for some reason.\n // e.g.: `:host(:fullscreen), :host(:-webkit-full-screen)`.\n // So you have to repeat it sadly.\n @include plain-text-in-fullscreen;\n}\n\n@import './partial-styles/ui-controls.scss';\n","import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages, ListItem } from '@limetech/lime-elements';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\n\n/**\n * This is a smart component that automatically detects\n * the most common file types such as image, audio, video, and text,\n * and properly displays them in the browser.\n * The component is also capable to render the most common office files.\n *\n * :::note\n * Image files will always be contained in their containers, which means\n * they automatically increase or decrease in size to fill their containing box\n * whilst preserving their aspect-ratio.\n *\n * Text and PDF files will also always respect the width and height of the\n * container in which the `limel-file-viewer` is loaded.\n * :::\n *\n * For some file types such as text and images, the component will display a\n * download button and a button to open the file in a new browser tab.\n * This will allow users to preview the file in a fullscreen mode with the\n * browser and take advantage of for example native zooming and panning\n * functionalities.\n * @exampleComponent limel-example-file-viewer\n * @exampleComponent limel-example-file-viewer-office\n * @exampleComponent limel-example-file-viewer-filename\n * @exampleComponent limel-example-file-viewer-inbuilt-actions\n * @exampleComponent limel-example-file-viewer-custom-actions\n * @exampleComponent limel-example-file-viewer-with-picker\n * @private\n */\n\n@Component({\n tag: 'limel-file-viewer',\n shadow: true,\n styleUrl: 'file-viewer.scss',\n})\nexport class FileViewer {\n /**\n * Link to the file\n */\n @Prop({ reflect: true })\n public url: string;\n\n /**\n * The name of the file that must also contains its extension.\n * This overrides the filename that the `url` ends with.\n * Useful when the `url` does not contain the filename.\n * When specified, the `filename` will be used as filename of\n * the downloaded file.\n */\n @Prop({ reflect: true })\n public filename?: string;\n\n /**\n * An optional alternative text, mainly for assistive technologies and screen readers.\n * It is used for only image files, as an `alt` attribute.\n * Should optimally hold a description of the image,\n * which is also displayed on the page if the image can't be loaded for some reason.\n */\n @Prop({ reflect: true })\n public alt?: string;\n\n /**\n * Displays a button that allows the user to view the file\n * in fullscreen mode.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowFullscreen?: boolean = false;\n\n /**\n * Displays a button that allows the user to open the file\n * in a new browser tab.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowOpenInNewTab?: boolean = false;\n\n /**\n * Displays a button that allows the user to download the file.\n * Note that due to the browser's security policies,\n * the file should be hosted on the same domain\n * for the download button to work properly.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowDownload?: boolean = false;\n\n /**\n * Defines the localization for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Defines the third-party viewer that should be used to render\n * the content of office files, such as word processing documents,\n * presentations, or spreadsheets.\n */\n @Prop({ reflect: true })\n public officeViewer: OfficeViewer = 'microsoft-office';\n\n /**\n * An array of custom actions that can be displayed\n * as an action menu on the file which is being displayed.\n */\n @Prop()\n public actions: ListItem[];\n\n /**\n * Emitted when a custom action is selected from the action menu.\n */\n @Event()\n public action: EventEmitter<ListItem>;\n\n @Element()\n public HostElement: HTMLLimelFileViewerElement;\n\n private fullscreen: Fullscreen;\n\n @State()\n private isFullscreen: boolean = false;\n\n @State()\n private fileType: FileType;\n\n /**\n * True while the file is being loaded.\n */\n @State()\n private loading: boolean = true;\n\n @State()\n private fileUrl: string = '';\n\n constructor() {\n this.fullscreen = new Fullscreen(this.HostElement);\n }\n\n public async componentWillLoad() {\n this.fileType = detectExtension(this.filename, this.url);\n await this.createURL(this.url);\n }\n\n public render() {\n if (!this.isOfficeFileAccessibleViaURL) {\n return this.renderNoFileSupportMessage();\n }\n\n if (this.loading) {\n return <limel-spinner size=\"x-small\" limeBranded={false} />;\n }\n\n return this.renderFileViewer();\n }\n\n @Watch('url')\n protected async watchUrl(newUrl: string, oldUrl: string) {\n if (newUrl === oldUrl) {\n return;\n }\n\n this.loading = true;\n this.fileType = detectExtension(this.filename, this.fileUrl);\n await this.createURL(this.fileType);\n }\n\n private renderFileViewer() {\n const fileViewerFunctions = {\n pdf: this.renderPdf,\n image: this.renderImage,\n video: this.renderVideo,\n audio: this.renderAudio,\n text: this.renderText,\n office: this.renderOffice,\n };\n const fileViewerFunction =\n fileViewerFunctions[this.fileType] ||\n this.renderNoFileSupportMessage;\n\n return fileViewerFunction();\n }\n\n private renderPdf = () => {\n return [\n <div class=\"action-menu-for-pdf-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe src={this.fileUrl} />,\n ];\n };\n\n private renderImage = () => {\n return [\n this.renderButtons(),\n <img src={this.fileUrl} alt={this.alt} />,\n ];\n };\n\n private renderVideo = () => {\n return (\n <video controls>\n <source src={this.fileUrl} />\n </video>\n );\n };\n\n private renderAudio = () => {\n return (\n <audio controls>\n <source src={this.fileUrl} />\n </audio>\n );\n };\n\n private renderText = () => {\n return [\n this.renderButtons(),\n <object data={this.fileUrl} type=\"text/plain\" />,\n ];\n };\n\n private renderOffice = () => {\n return [\n <div class=\"action-menu-for-office-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe\n src={\n this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true'\n }\n frameborder=\"0\"\n />,\n ];\n };\n\n private isOfficeFileAccessibleViaURL = () => {\n return (\n this.fileType === 'office' &&\n !(\n this.fileUrl.startsWith('http://') ||\n this.fileUrl.startsWith('https://')\n )\n );\n };\n\n private getOfficeViewerUrl = () => {\n const officeViewers = {\n 'microsoft-office':\n 'https://view.officeapps.live.com/op/embed.aspx?src=',\n 'google-drive': 'https://docs.google.com/gview?url=',\n };\n\n return officeViewers[this.officeViewer];\n };\n\n private renderNoFileSupportMessage = () => {\n return (\n <div class=\"no-support\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>{this.getTranslation('message.unsupported-filetype')}</p>\n {this.renderDownloadButton()}\n </div>\n );\n };\n\n private renderButtons = () => {\n return (\n <div class=\"buttons\">\n {this.renderActionMenu()}\n {this.renderToggleFullscreenButton()}\n {this.renderDownloadButton()}\n {this.renderOpenInNewTabButton()}\n </div>\n );\n };\n\n private renderToggleFullscreenButton = () => {\n if (!this.allowFullscreen || !this.fullscreen.isSupported()) {\n return;\n }\n\n const icon = this.isFullscreen ? 'multiply' : 'fit_to_width';\n // eslint-disable-next-line multiline-ternary\n const label = this.isFullscreen\n ? // eslint-disable-next-line multiline-ternary\n this.getTranslation('exit-fullscreen')\n : this.getTranslation('open-in-fullscreen');\n\n return [\n <button\n class=\"button--toggle-fullscreen\"\n id=\"tooltip-toggle-fullscreen\"\n role=\"button\"\n onClick={this.handleToggleFullscreen}\n >\n <limel-icon name={icon} />\n <limel-tooltip\n label={label}\n elementId=\"tooltip-toggle-fullscreen\"\n openDirection=\"left\"\n />\n </button>,\n ];\n };\n\n private renderDownloadButton = () => {\n if (!this.allowDownload || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--download\"\n id=\"tooltip-download\"\n role=\"button\"\n download={this.filename ? this.filename : ''}\n href={this.fileUrl}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('download')}\n elementId=\"tooltip-download\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderOpenInNewTabButton = () => {\n if (!this.allowOpenInNewTab || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--new-tab\"\n id=\"tooltip-new-tab\"\n role=\"button\"\n href={this.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <limel-icon name=\"external_link\" />\n <limel-tooltip\n label={this.getTranslation('open-in-new-tab')}\n elementId=\"tooltip-new-tab\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderActionMenu = () => {\n if (!this.actions || this.isFullscreen) {\n return;\n }\n\n return (\n <limel-menu\n class=\"action-menu\"\n items={this.actions}\n onSelect={this.emitOnAction}\n open-direction=\"left\"\n >\n <button\n class=\"button--action\"\n id=\"tooltip-more\"\n role=\"button\"\n slot=\"trigger\"\n >\n <limel-icon name=\"menu_2\" />\n <limel-tooltip\n label={this.getTranslation('more-actions')}\n elementId=\"tooltip-more\"\n openDirection=\"left\"\n />\n </button>\n </limel-menu>\n );\n };\n\n private createURL = async (fileType: string) => {\n if (['pdf'].includes(fileType)) {\n const response = await fetch(this.url);\n const blob = await response.blob();\n\n this.fileUrl = URL.createObjectURL(blob);\n } else {\n this.fileUrl = this.url;\n }\n\n this.loading = false;\n };\n\n private handleToggleFullscreen = () => {\n if (this.fullscreen.isSupported()) {\n this.fullscreen.toggle();\n this.isFullscreen = !this.isFullscreen;\n }\n };\n\n private emitOnAction = (event: CustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(`file-viewer.${key}`, this.language);\n }\n}\n"],"version":3}
@@ -425,6 +425,7 @@ const File = class {
425
425
  this.required = false;
426
426
  this.disabled = false;
427
427
  this.readonly = false;
428
+ this.invalid = false;
428
429
  this.accept = '*';
429
430
  this.language = 'en';
430
431
  this.isDraggingOverDropZone = false;
@@ -462,7 +463,7 @@ const File = class {
462
463
  'is-file-picker': true,
463
464
  'shows-dropzone': true,
464
465
  'highlight-dropzone': this.isDraggingOverDropZone,
465
- }, disabled: this.disabled, readonly: this.readonly, label: this.label, leadingIcon: "upload_to_cloud", language: this.language, onChange: this.handleChipSetChange, onClick: this.handleFileSelection, onInteract: this.handleChipInteract, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, required: this.required, type: "input", value: this.chipArray, title: this.getTranslation('drag-and-drop-tips'), onDragEnter: this.handleDragEnter, onDragOver: this.preventAndStop, onDragLeave: this.handleDragLeave, onDrop: this.handleFileDrop }),
466
+ }, disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, leadingIcon: "upload_to_cloud", language: this.language, onChange: this.handleChipSetChange, onClick: this.handleFileSelection, onInteract: this.handleChipInteract, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, required: this.required, type: "input", value: this.chipArray, title: this.getTranslation('drag-and-drop-tips'), onDragEnter: this.handleDragEnter, onDragOver: this.preventAndStop, onDragLeave: this.handleDragLeave, onDrop: this.handleFileDrop }),
466
467
  ];
467
468
  }
468
469
  get chipArray() {
@@ -1 +1 @@
1
- {"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AACrC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAChD,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAC9C,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B,MAAM,iBAAiB,GAA2B;;EAE9C,GAAG,EAAE,YAAY;;EAGjB,GAAG,EAAE,aAAa;EAClB,IAAI,EAAE,aAAa;EACnB,SAAS,EAAE,aAAa;EACxB,GAAG,EAAE,aAAa;;EAGlB,KAAK,EAAE,UAAU;EACjB,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,IAAI,EAAE,UAAU;;EAG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,CAAC,eAAe,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3D,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACpB,IAAI,CAAC,IAAI,EAAE;MACP,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC;MAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;MACvB,IAAI,IAAI,CAAC,QAAQ,EAAE;QACf,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;OACnC;KACJ;GACJ;EAEO,kBAAkB,CAAC,KAAwB;IAC/C,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;GACvC;EAEO,cAAc,CAAC,KAAY;IAC/B,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;GAC1B;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAOG,sBAAS,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GACtD;;;;;;;","names":["createRandomString","MDCTextField","h","translate"],"sources":["./src/components/file/icons.ts","./src/components/file/icon-fill-colors.ts","./src/components/file/icon-background-colors.ts","./src/components/file/file-metadata.ts","./src/components/file/file.scss?tag=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["const DEFAULT_ICON = 'file';\nconst CALENDAR_ICON = 'tear_off_calendar';\nconst EMAIL_ICON = 'email';\nconst HTML_ICON = 'internet';\nconst TEXT_ICON = 'text_box';\nconst EXCEL_ICON = 'ms_excel_copyrighted';\nconst WORD_ICON = 'ms_word_copyrighted';\nconst POWERPOINT_ICON = 'ms_powerpoint_copyrighted';\nconst IMAGE_ICON = 'picture';\nconst PHOTO_ICON = 'camera';\nconst VECTOR_GRAPHIC_ICON = 'vector';\nconst PRESENTATION_ICON = 'presentation_filled';\nconst DOCUMENT_ICON = 'overview_pages_2';\nconst SPREADSHEET_ICON = 'data_sheet';\nconst AUDIO_ICON = 'audio_wave';\nconst VIDEO_ICON = 'video_file';\nconst COMPRESSED_ICON = 'condom_package';\nconst MESSAGE_ICON = 'ms_outlook_copyrighted';\nconst DATA_ICON = 'database';\n\nconst filetypeIconTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON,\n\n // Calendar\n ics: CALENDAR_ICON,\n ical: CALENDAR_ICON,\n icalendar: CALENDAR_ICON,\n ifb: CALENDAR_ICON,\n\n // Email\n email: EMAIL_ICON,\n eml: EMAIL_ICON,\n oft: EMAIL_ICON,\n ost: EMAIL_ICON,\n emlx: EMAIL_ICON,\n\n // Web\n html: HTML_ICON,\n xml: HTML_ICON,\n\n // Editable text\n txt: TEXT_ICON,\n rtf: TEXT_ICON,\n\n // Editable document\n dot: WORD_ICON,\n doc: WORD_ICON,\n docx: WORD_ICON,\n dotx: WORD_ICON,\n docm: WORD_ICON,\n dotm: WORD_ICON,\n odt: DOCUMENT_ICON,\n pages: DOCUMENT_ICON,\n\n // Portable document\n pdf: 'PDF_2',\n\n // Presentation\n ppt: POWERPOINT_ICON,\n pot: POWERPOINT_ICON,\n pps: POWERPOINT_ICON,\n pptx: POWERPOINT_ICON,\n pptm: POWERPOINT_ICON,\n potx: POWERPOINT_ICON,\n potm: POWERPOINT_ICON,\n ppam: POWERPOINT_ICON,\n ppsx: POWERPOINT_ICON,\n ppsm: POWERPOINT_ICON,\n sldx: POWERPOINT_ICON,\n sldm: POWERPOINT_ICON,\n odp: PRESENTATION_ICON,\n key: PRESENTATION_ICON,\n\n // Spreadsheet\n xls: EXCEL_ICON,\n xlsx: EXCEL_ICON,\n csv: SPREADSHEET_ICON,\n numbers: SPREADSHEET_ICON,\n\n // Image\n jpg: PHOTO_ICON,\n jpeg: PHOTO_ICON,\n heic: PHOTO_ICON,\n bmp: IMAGE_ICON,\n png: IMAGE_ICON,\n gif: IMAGE_ICON,\n\n // Editable image\n psd: 'adobe_photoshop_copyrighted',\n ai: 'adobe_illustrator_copyrighted',\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON,\n svgz: VECTOR_GRAPHIC_ICON,\n ep: VECTOR_GRAPHIC_ICON,\n eps: VECTOR_GRAPHIC_ICON,\n sketch: VECTOR_GRAPHIC_ICON,\n\n // Audio\n mp3: AUDIO_ICON,\n wav: AUDIO_ICON,\n wma: AUDIO_ICON,\n ogg: AUDIO_ICON,\n\n // Video\n avi: VIDEO_ICON,\n flv: VIDEO_ICON,\n h264: VIDEO_ICON,\n mov: VIDEO_ICON,\n mp4: VIDEO_ICON,\n mwv: VIDEO_ICON,\n\n // Compressed\n zip: COMPRESSED_ICON,\n '7z': COMPRESSED_ICON,\n rar: COMPRESSED_ICON,\n\n // Data\n json: 'json',\n yaml: DATA_ICON,\n sql: DATA_ICON,\n db: DATA_ICON,\n dbf: DATA_ICON,\n};\n\nexport function getIconForFile(extension: string): string {\n return filetypeIconTable[extension.toLowerCase()] || DEFAULT_ICON;\n}\n","const DEFAULT_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst CALENDAR_ICON_FILL_COLOR = 'rgb(var(--color-cyan-dark))';\nconst EMAIL_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst HTML_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst TEXT_ICON_FILL_COLOR = 'rgb(var(--color-yellow-darker))';\nconst EXCEL_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst POWERPOINT_ICON_FILL_COLOR = 'rgb(var(--color-coral-dark))';\nconst WORD_ICON_FILL_COLOR = 'rgb(var(--color-sky-dark))';\nconst IMAGE_ICON_FILL_COLOR = 'rgb(var(--color-lime-dark))';\nconst VECTOR_GRAPHIC_FILL_COLOR = 'rgb(var(--color-magenta-dark))';\nconst PRESENTATION_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst DOCUMENT_ICON_FILL_COLOR = 'rgb(var(--color-orange-dark))';\nconst SPREADSHEET_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst AUDIO_ICON_FILL_COLOR = 'rgb(var(--color-indigo-dark))';\nconst VIDEO_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst COMPRESSED_ICON_FILL_COLOR = 'rgb(var(--color-brown-default))';\nconst MESSAGE_ICON_FILL_COLOR = 'rgb(var(--color-yellow-dark))';\nconst PDF_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst DATA_ICON_FILL_COLOR = 'rgb(var(--color-glaucous-dark))';\n\nconst filetypeFillColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_FILL_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_FILL_COLOR,\n ical: CALENDAR_ICON_FILL_COLOR,\n icalendar: CALENDAR_ICON_FILL_COLOR,\n ifb: CALENDAR_ICON_FILL_COLOR,\n\n // Email\n email: EMAIL_ICON_FILL_COLOR,\n eml: EMAIL_ICON_FILL_COLOR,\n oft: EMAIL_ICON_FILL_COLOR,\n ost: EMAIL_ICON_FILL_COLOR,\n emlx: EMAIL_ICON_FILL_COLOR,\n\n // Web\n html: HTML_ICON_FILL_COLOR,\n xml: HTML_ICON_FILL_COLOR,\n\n // Editable text\n txt: TEXT_ICON_FILL_COLOR,\n rtf: TEXT_ICON_FILL_COLOR,\n\n // Editable document\n dot: WORD_ICON_FILL_COLOR,\n doc: WORD_ICON_FILL_COLOR,\n docx: WORD_ICON_FILL_COLOR,\n dotx: WORD_ICON_FILL_COLOR,\n docm: WORD_ICON_FILL_COLOR,\n dotm: WORD_ICON_FILL_COLOR,\n odt: DOCUMENT_ICON_FILL_COLOR,\n pages: DOCUMENT_ICON_FILL_COLOR,\n\n // Portable document\n pdf: PDF_ICON_FILL_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_FILL_COLOR,\n pot: POWERPOINT_ICON_FILL_COLOR,\n pps: POWERPOINT_ICON_FILL_COLOR,\n pptx: POWERPOINT_ICON_FILL_COLOR,\n pptm: POWERPOINT_ICON_FILL_COLOR,\n potx: POWERPOINT_ICON_FILL_COLOR,\n potm: POWERPOINT_ICON_FILL_COLOR,\n ppam: POWERPOINT_ICON_FILL_COLOR,\n ppsx: POWERPOINT_ICON_FILL_COLOR,\n ppsm: POWERPOINT_ICON_FILL_COLOR,\n sldx: POWERPOINT_ICON_FILL_COLOR,\n sldm: POWERPOINT_ICON_FILL_COLOR,\n odp: PRESENTATION_ICON_FILL_COLOR,\n key: PRESENTATION_ICON_FILL_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_FILL_COLOR,\n xlsx: EXCEL_ICON_FILL_COLOR,\n csv: DEFAULT_ICON_FILL_COLOR,\n numbers: SPREADSHEET_ICON_FILL_COLOR,\n\n // Image\n bmp: IMAGE_ICON_FILL_COLOR,\n jpg: IMAGE_ICON_FILL_COLOR,\n jpeg: IMAGE_ICON_FILL_COLOR,\n heic: IMAGE_ICON_FILL_COLOR,\n png: IMAGE_ICON_FILL_COLOR,\n gif: IMAGE_ICON_FILL_COLOR,\n\n // Editable image\n psd: PRESENTATION_ICON_FILL_COLOR,\n ai: DOCUMENT_ICON_FILL_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_FILL_COLOR,\n svgz: VECTOR_GRAPHIC_FILL_COLOR,\n ep: VECTOR_GRAPHIC_FILL_COLOR,\n eps: VECTOR_GRAPHIC_FILL_COLOR,\n sketch: VECTOR_GRAPHIC_FILL_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_FILL_COLOR,\n wav: AUDIO_ICON_FILL_COLOR,\n wma: AUDIO_ICON_FILL_COLOR,\n ogg: AUDIO_ICON_FILL_COLOR,\n\n // Video\n flv: VIDEO_ICON_FILL_COLOR,\n h264: VIDEO_ICON_FILL_COLOR,\n mov: VIDEO_ICON_FILL_COLOR,\n mp4: VIDEO_ICON_FILL_COLOR,\n mwv: VIDEO_ICON_FILL_COLOR,\n\n // Compressed\n zip: COMPRESSED_ICON_FILL_COLOR,\n '7z': COMPRESSED_ICON_FILL_COLOR,\n rar: COMPRESSED_ICON_FILL_COLOR,\n\n // Data\n json: DATA_ICON_FILL_COLOR,\n yaml: DATA_ICON_FILL_COLOR,\n sql: DATA_ICON_FILL_COLOR,\n db: DATA_ICON_FILL_COLOR,\n dbf: DATA_ICON_FILL_COLOR,\n};\n\nexport function getIconFillColorForFile(extension: string): string {\n return (\n filetypeFillColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_FILL_COLOR\n );\n}\n","const DEFAULT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst CALENDAR_ICON_BACKGROUND_COLOR = 'rgba(var(--color-cyan-lighter), 0.4)';\nconst EMAIL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst HTML_ICON_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst TEXT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst EXCEL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-green-lighter), 0.4)';\nconst POWERPOINT_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-coral-lighter), 0.4)';\nconst WORD_ICON_BACKGROUND_COLOR = 'rgba(var(--color-sky-lighter), 0.4)';\nconst IMAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-lime-lighter), 0.4)';\nconst VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-magenta-lighter), 0.4)';\nconst PRESENTATION_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst DOCUMENT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-orange-lighter), 0.4)';\nconst SPREADSHEET_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-green-lighter), 0.4)';\nconst AUDIO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-indigo-lighter), 0.4)';\nconst VIDEO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst COMPRESSED_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-orange-lighter), 0.4)';\nconst MESSAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst PDF_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst DATA_ICON_BACKGROUND_COLOR = 'rgba(var(--color-glaucous-lighter), 0.4)';\n\nconst filetypeBackgroundColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_BACKGROUND_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_BACKGROUND_COLOR,\n ical: CALENDAR_ICON_BACKGROUND_COLOR,\n icalendar: CALENDAR_ICON_BACKGROUND_COLOR,\n\n // Email\n ifb: CALENDAR_ICON_BACKGROUND_COLOR,\n email: EMAIL_ICON_BACKGROUND_COLOR,\n eml: EMAIL_ICON_BACKGROUND_COLOR,\n oft: EMAIL_ICON_BACKGROUND_COLOR,\n ost: EMAIL_ICON_BACKGROUND_COLOR,\n emlx: EMAIL_ICON_BACKGROUND_COLOR,\n\n // Web\n html: HTML_ICON_BACKGROUND_COLOR,\n xml: HTML_ICON_BACKGROUND_COLOR,\n\n // Editable text\n txt: TEXT_ICON_BACKGROUND_COLOR,\n rtf: TEXT_ICON_BACKGROUND_COLOR,\n\n // Editable document\n dot: WORD_ICON_BACKGROUND_COLOR,\n doc: WORD_ICON_BACKGROUND_COLOR,\n docx: WORD_ICON_BACKGROUND_COLOR,\n dotx: WORD_ICON_BACKGROUND_COLOR,\n docm: WORD_ICON_BACKGROUND_COLOR,\n dotm: WORD_ICON_BACKGROUND_COLOR,\n odt: DOCUMENT_ICON_BACKGROUND_COLOR,\n pages: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Portable document\n pdf: PDF_ICON_BACKGROUND_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_BACKGROUND_COLOR,\n pot: POWERPOINT_ICON_BACKGROUND_COLOR,\n pps: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptx: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptm: POWERPOINT_ICON_BACKGROUND_COLOR,\n potx: POWERPOINT_ICON_BACKGROUND_COLOR,\n potm: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppam: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsx: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsm: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldx: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldm: POWERPOINT_ICON_BACKGROUND_COLOR,\n odp: PRESENTATION_BACKGROUND_COLOR,\n key: PRESENTATION_BACKGROUND_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_BACKGROUND_COLOR,\n xlsx: EXCEL_ICON_BACKGROUND_COLOR,\n csv: DEFAULT_ICON_BACKGROUND_COLOR,\n numbers: SPREADSHEET_ICON_BACKGROUND_COLOR,\n\n // Image\n bmp: IMAGE_ICON_BACKGROUND_COLOR,\n jpg: IMAGE_ICON_BACKGROUND_COLOR,\n jpeg: IMAGE_ICON_BACKGROUND_COLOR,\n heic: IMAGE_ICON_BACKGROUND_COLOR,\n png: IMAGE_ICON_BACKGROUND_COLOR,\n gif: IMAGE_ICON_BACKGROUND_COLOR,\n\n // Editable image\n psd: PRESENTATION_BACKGROUND_COLOR,\n ai: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n svgz: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n ep: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n eps: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n sketch: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_BACKGROUND_COLOR,\n wav: AUDIO_ICON_BACKGROUND_COLOR,\n wma: AUDIO_ICON_BACKGROUND_COLOR,\n ogg: AUDIO_ICON_BACKGROUND_COLOR,\n\n // Video\n flv: VIDEO_ICON_BACKGROUND_COLOR,\n h264: VIDEO_ICON_BACKGROUND_COLOR,\n mov: VIDEO_ICON_BACKGROUND_COLOR,\n mp4: VIDEO_ICON_BACKGROUND_COLOR,\n mwv: VIDEO_ICON_BACKGROUND_COLOR,\n\n // Compressed:\n zip: COMPRESSED_ICON_BACKGROUND_COLOR,\n '7z': COMPRESSED_ICON_BACKGROUND_COLOR,\n rar: COMPRESSED_ICON_BACKGROUND_COLOR,\n\n // Data\n json: DATA_ICON_BACKGROUND_COLOR,\n yaml: DATA_ICON_BACKGROUND_COLOR,\n sql: DATA_ICON_BACKGROUND_COLOR,\n db: DATA_ICON_BACKGROUND_COLOR,\n dbf: DATA_ICON_BACKGROUND_COLOR,\n};\n\nexport function getIconBackgroundColorForFile(extension: string): string {\n return (\n filetypeBackgroundColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_BACKGROUND_COLOR\n );\n}\n","import { FileInfo } from '../../interface';\nimport { getIconForFile } from './icons';\nimport { getIconFillColorForFile } from './icon-fill-colors';\nimport { getIconBackgroundColorForFile } from './icon-background-colors';\n\nexport function getFileIcon(file: FileInfo) {\n if (file?.icon) {\n return file.icon;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconForFile(extension);\n}\n\nexport function getFileColor(file: FileInfo) {\n if (file?.iconColor) {\n return file.iconColor;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconFillColorForFile(extension);\n}\n\nexport function getFileBackgroundColor(file: FileInfo) {\n if (file?.iconBackgroundColor) {\n return file.iconBackgroundColor;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconBackgroundColorForFile(extension);\n}\n\nexport function getFileExtensionTitle(file: FileInfo) {\n if (file?.icon) {\n return file.icon;\n }\n\n return getExtension(file);\n}\n\nexport function getExtension(file: FileInfo) {\n if (!file) {\n return;\n }\n\n return file.filename.split('.').pop();\n}\n","/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n\n:host {\n --icon-background-color: rgb(var(--contrast-400));\n --icon-color: rgb(var(--contrast-1100));\n}\n","import translate from '../../global/translations';\nimport { Chip, FileInfo, Languages } from '../../interface';\nimport { MDCTextField } from '@material/textfield';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nconst CHIP_SET_TAG_NAME = 'limel-chip-set';\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n @Element()\n private element: HTMLLimelFileElement;\n\n @State()\n private isDraggingOverDropZone = false;\n\n private fileInput: HTMLInputElement;\n private fileInputId = createRandomString();\n private chipSet;\n private mdcTextField;\n\n constructor() {\n this.handleFileSelection = this.handleFileSelection.bind(this);\n this.handleFileChange = this.handleFileChange.bind(this);\n this.handleChipSetChange = this.handleChipSetChange.bind(this);\n this.handleFileDrop = this.handleFileDrop.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n this.handleChipInteract = this.handleChipInteract.bind(this);\n }\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentDidLoad() {\n this.fileInput = this.element.shadowRoot.getElementById(\n this.fileInputId\n ) as HTMLInputElement;\n this.chipSet = this.element.shadowRoot.querySelector(CHIP_SET_TAG_NAME);\n this.initialize();\n }\n\n private initialize() {\n if (!this.chipSet) {\n return;\n }\n\n this.mdcTextField = new MDCTextField(\n this.chipSet.shadowRoot.querySelector('.mdc-text-field')\n );\n }\n\n public disconnectedCallback() {\n if (this.mdcTextField) {\n this.mdcTextField.destroy();\n }\n }\n\n public render() {\n return [\n <input\n hidden={true}\n id={this.fileInputId}\n onChange={this.handleFileChange}\n type=\"file\"\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n />,\n <limel-chip-set\n class={{\n 'is-file-picker': true,\n 'shows-dropzone': true,\n 'highlight-dropzone': this.isDraggingOverDropZone,\n }}\n disabled={this.disabled}\n readonly={this.readonly}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onClick={this.handleFileSelection}\n onInteract={this.handleChipInteract}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n required={this.required}\n type=\"input\"\n value={this.chipArray}\n title={this.getTranslation('drag-and-drop-tips')}\n onDragEnter={this.handleDragEnter}\n onDragOver={this.preventAndStop}\n onDragLeave={this.handleDragLeave}\n onDrop={this.handleFileDrop}\n />,\n ];\n }\n\n private handleDragEnter = (event: DragEvent) => {\n this.isDraggingOverDropZone = true;\n this.preventAndStop(event);\n };\n\n private handleDragLeave = () => {\n this.isDraggingOverDropZone = false;\n };\n\n private handleFileDrop = (event: DragEvent) => {\n this.preventAndStop(event);\n this.isDraggingOverDropZone = false;\n const dataTransfer = event.dataTransfer;\n this.handleFile(dataTransfer.files[0]);\n };\n\n private get chipArray() {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: getFileIcon(this.value),\n iconFillColor: getFileColor(this.value),\n iconBackgroundColor: getFileBackgroundColor(this.value),\n href: this.value.href,\n iconTitle: getFileExtensionTitle(this.value),\n },\n ];\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (\n event.code === 'Tab' ||\n event.code === 'Backspace' ||\n event.code === 'Enter'\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private handleKeyUp(event: KeyboardEvent) {\n if (event.code === 'Enter' && !this.value) {\n this.fileInput.click();\n }\n }\n\n private handleFileSelection(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n if (!this.value) {\n this.fileInput.click();\n }\n }\n\n private handleFileChange(event: Event) {\n if (this.fileInput.files.length > 0) {\n event.stopPropagation();\n this.handleFile(this.fileInput.files[0]);\n }\n }\n\n private handleFile(file) {\n const limeFile: FileInfo = {\n id: createRandomString(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n this.change.emit(limeFile);\n this.chipSet.blur();\n this.mdcTextField.valid = true;\n }\n\n private handleChipSetChange(event: CustomEvent) {\n event.stopPropagation();\n const file = !event.detail.length ? event.detail[0] : null;\n this.chipSet.blur();\n if (!file) {\n this.fileInput.value = '';\n this.change.emit(file);\n if (this.required) {\n this.mdcTextField.valid = false;\n }\n }\n }\n\n private handleChipInteract(event: CustomEvent<Chip>) {\n event.stopPropagation();\n event.preventDefault();\n this.interact.emit(event.detail.id);\n }\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(`file.${key}`, this.language);\n }\n}\n"],"version":3}
1
+ {"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,MAAM,SAAS,GAAG,UAAU,CAAC;AAC7B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AACrC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAChD,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,MAAM,gBAAgB,GAAG,YAAY,CAAC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,cAAc,EAAE,CAAC;GAC1B;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAOG,sBAAS,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GACtD;;;;;;;","names":["createRandomString","MDCTextField","h","translate"],"sources":["./src/components/file/icons.ts","./src/components/file/icon-fill-colors.ts","./src/components/file/icon-background-colors.ts","./src/components/file/file-metadata.ts","./src/components/file/file.scss?tag=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["const DEFAULT_ICON = 'file';\nconst CALENDAR_ICON = 'tear_off_calendar';\nconst EMAIL_ICON = 'email';\nconst HTML_ICON = 'internet';\nconst TEXT_ICON = 'text_box';\nconst EXCEL_ICON = 'ms_excel_copyrighted';\nconst WORD_ICON = 'ms_word_copyrighted';\nconst POWERPOINT_ICON = 'ms_powerpoint_copyrighted';\nconst IMAGE_ICON = 'picture';\nconst PHOTO_ICON = 'camera';\nconst VECTOR_GRAPHIC_ICON = 'vector';\nconst PRESENTATION_ICON = 'presentation_filled';\nconst DOCUMENT_ICON = 'overview_pages_2';\nconst SPREADSHEET_ICON = 'data_sheet';\nconst AUDIO_ICON = 'audio_wave';\nconst VIDEO_ICON = 'video_file';\nconst COMPRESSED_ICON = 'condom_package';\nconst MESSAGE_ICON = 'ms_outlook_copyrighted';\nconst DATA_ICON = 'database';\n\nconst filetypeIconTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON,\n\n // Calendar\n ics: CALENDAR_ICON,\n ical: CALENDAR_ICON,\n icalendar: CALENDAR_ICON,\n ifb: CALENDAR_ICON,\n\n // Email\n email: EMAIL_ICON,\n eml: EMAIL_ICON,\n oft: EMAIL_ICON,\n ost: EMAIL_ICON,\n emlx: EMAIL_ICON,\n\n // Web\n html: HTML_ICON,\n xml: HTML_ICON,\n\n // Editable text\n txt: TEXT_ICON,\n rtf: TEXT_ICON,\n\n // Editable document\n dot: WORD_ICON,\n doc: WORD_ICON,\n docx: WORD_ICON,\n dotx: WORD_ICON,\n docm: WORD_ICON,\n dotm: WORD_ICON,\n odt: DOCUMENT_ICON,\n pages: DOCUMENT_ICON,\n\n // Portable document\n pdf: 'PDF_2',\n\n // Presentation\n ppt: POWERPOINT_ICON,\n pot: POWERPOINT_ICON,\n pps: POWERPOINT_ICON,\n pptx: POWERPOINT_ICON,\n pptm: POWERPOINT_ICON,\n potx: POWERPOINT_ICON,\n potm: POWERPOINT_ICON,\n ppam: POWERPOINT_ICON,\n ppsx: POWERPOINT_ICON,\n ppsm: POWERPOINT_ICON,\n sldx: POWERPOINT_ICON,\n sldm: POWERPOINT_ICON,\n odp: PRESENTATION_ICON,\n key: PRESENTATION_ICON,\n\n // Spreadsheet\n xls: EXCEL_ICON,\n xlsx: EXCEL_ICON,\n csv: SPREADSHEET_ICON,\n numbers: SPREADSHEET_ICON,\n\n // Image\n jpg: PHOTO_ICON,\n jpeg: PHOTO_ICON,\n heic: PHOTO_ICON,\n bmp: IMAGE_ICON,\n png: IMAGE_ICON,\n gif: IMAGE_ICON,\n\n // Editable image\n psd: 'adobe_photoshop_copyrighted',\n ai: 'adobe_illustrator_copyrighted',\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON,\n svgz: VECTOR_GRAPHIC_ICON,\n ep: VECTOR_GRAPHIC_ICON,\n eps: VECTOR_GRAPHIC_ICON,\n sketch: VECTOR_GRAPHIC_ICON,\n\n // Audio\n mp3: AUDIO_ICON,\n wav: AUDIO_ICON,\n wma: AUDIO_ICON,\n ogg: AUDIO_ICON,\n\n // Video\n avi: VIDEO_ICON,\n flv: VIDEO_ICON,\n h264: VIDEO_ICON,\n mov: VIDEO_ICON,\n mp4: VIDEO_ICON,\n mwv: VIDEO_ICON,\n\n // Compressed\n zip: COMPRESSED_ICON,\n '7z': COMPRESSED_ICON,\n rar: COMPRESSED_ICON,\n\n // Data\n json: 'json',\n yaml: DATA_ICON,\n sql: DATA_ICON,\n db: DATA_ICON,\n dbf: DATA_ICON,\n};\n\nexport function getIconForFile(extension: string): string {\n return filetypeIconTable[extension.toLowerCase()] || DEFAULT_ICON;\n}\n","const DEFAULT_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst CALENDAR_ICON_FILL_COLOR = 'rgb(var(--color-cyan-dark))';\nconst EMAIL_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst HTML_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst TEXT_ICON_FILL_COLOR = 'rgb(var(--color-yellow-darker))';\nconst EXCEL_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst POWERPOINT_ICON_FILL_COLOR = 'rgb(var(--color-coral-dark))';\nconst WORD_ICON_FILL_COLOR = 'rgb(var(--color-sky-dark))';\nconst IMAGE_ICON_FILL_COLOR = 'rgb(var(--color-lime-dark))';\nconst VECTOR_GRAPHIC_FILL_COLOR = 'rgb(var(--color-magenta-dark))';\nconst PRESENTATION_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst DOCUMENT_ICON_FILL_COLOR = 'rgb(var(--color-orange-dark))';\nconst SPREADSHEET_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst AUDIO_ICON_FILL_COLOR = 'rgb(var(--color-indigo-dark))';\nconst VIDEO_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst COMPRESSED_ICON_FILL_COLOR = 'rgb(var(--color-brown-default))';\nconst MESSAGE_ICON_FILL_COLOR = 'rgb(var(--color-yellow-dark))';\nconst PDF_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst DATA_ICON_FILL_COLOR = 'rgb(var(--color-glaucous-dark))';\n\nconst filetypeFillColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_FILL_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_FILL_COLOR,\n ical: CALENDAR_ICON_FILL_COLOR,\n icalendar: CALENDAR_ICON_FILL_COLOR,\n ifb: CALENDAR_ICON_FILL_COLOR,\n\n // Email\n email: EMAIL_ICON_FILL_COLOR,\n eml: EMAIL_ICON_FILL_COLOR,\n oft: EMAIL_ICON_FILL_COLOR,\n ost: EMAIL_ICON_FILL_COLOR,\n emlx: EMAIL_ICON_FILL_COLOR,\n\n // Web\n html: HTML_ICON_FILL_COLOR,\n xml: HTML_ICON_FILL_COLOR,\n\n // Editable text\n txt: TEXT_ICON_FILL_COLOR,\n rtf: TEXT_ICON_FILL_COLOR,\n\n // Editable document\n dot: WORD_ICON_FILL_COLOR,\n doc: WORD_ICON_FILL_COLOR,\n docx: WORD_ICON_FILL_COLOR,\n dotx: WORD_ICON_FILL_COLOR,\n docm: WORD_ICON_FILL_COLOR,\n dotm: WORD_ICON_FILL_COLOR,\n odt: DOCUMENT_ICON_FILL_COLOR,\n pages: DOCUMENT_ICON_FILL_COLOR,\n\n // Portable document\n pdf: PDF_ICON_FILL_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_FILL_COLOR,\n pot: POWERPOINT_ICON_FILL_COLOR,\n pps: POWERPOINT_ICON_FILL_COLOR,\n pptx: POWERPOINT_ICON_FILL_COLOR,\n pptm: POWERPOINT_ICON_FILL_COLOR,\n potx: POWERPOINT_ICON_FILL_COLOR,\n potm: POWERPOINT_ICON_FILL_COLOR,\n ppam: POWERPOINT_ICON_FILL_COLOR,\n ppsx: POWERPOINT_ICON_FILL_COLOR,\n ppsm: POWERPOINT_ICON_FILL_COLOR,\n sldx: POWERPOINT_ICON_FILL_COLOR,\n sldm: POWERPOINT_ICON_FILL_COLOR,\n odp: PRESENTATION_ICON_FILL_COLOR,\n key: PRESENTATION_ICON_FILL_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_FILL_COLOR,\n xlsx: EXCEL_ICON_FILL_COLOR,\n csv: DEFAULT_ICON_FILL_COLOR,\n numbers: SPREADSHEET_ICON_FILL_COLOR,\n\n // Image\n bmp: IMAGE_ICON_FILL_COLOR,\n jpg: IMAGE_ICON_FILL_COLOR,\n jpeg: IMAGE_ICON_FILL_COLOR,\n heic: IMAGE_ICON_FILL_COLOR,\n png: IMAGE_ICON_FILL_COLOR,\n gif: IMAGE_ICON_FILL_COLOR,\n\n // Editable image\n psd: PRESENTATION_ICON_FILL_COLOR,\n ai: DOCUMENT_ICON_FILL_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_FILL_COLOR,\n svgz: VECTOR_GRAPHIC_FILL_COLOR,\n ep: VECTOR_GRAPHIC_FILL_COLOR,\n eps: VECTOR_GRAPHIC_FILL_COLOR,\n sketch: VECTOR_GRAPHIC_FILL_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_FILL_COLOR,\n wav: AUDIO_ICON_FILL_COLOR,\n wma: AUDIO_ICON_FILL_COLOR,\n ogg: AUDIO_ICON_FILL_COLOR,\n\n // Video\n flv: VIDEO_ICON_FILL_COLOR,\n h264: VIDEO_ICON_FILL_COLOR,\n mov: VIDEO_ICON_FILL_COLOR,\n mp4: VIDEO_ICON_FILL_COLOR,\n mwv: VIDEO_ICON_FILL_COLOR,\n\n // Compressed\n zip: COMPRESSED_ICON_FILL_COLOR,\n '7z': COMPRESSED_ICON_FILL_COLOR,\n rar: COMPRESSED_ICON_FILL_COLOR,\n\n // Data\n json: DATA_ICON_FILL_COLOR,\n yaml: DATA_ICON_FILL_COLOR,\n sql: DATA_ICON_FILL_COLOR,\n db: DATA_ICON_FILL_COLOR,\n dbf: DATA_ICON_FILL_COLOR,\n};\n\nexport function getIconFillColorForFile(extension: string): string {\n return (\n filetypeFillColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_FILL_COLOR\n );\n}\n","const DEFAULT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst CALENDAR_ICON_BACKGROUND_COLOR = 'rgba(var(--color-cyan-lighter), 0.4)';\nconst EMAIL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst HTML_ICON_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst TEXT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst EXCEL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-green-lighter), 0.4)';\nconst POWERPOINT_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-coral-lighter), 0.4)';\nconst WORD_ICON_BACKGROUND_COLOR = 'rgba(var(--color-sky-lighter), 0.4)';\nconst IMAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-lime-lighter), 0.4)';\nconst VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-magenta-lighter), 0.4)';\nconst PRESENTATION_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst DOCUMENT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-orange-lighter), 0.4)';\nconst SPREADSHEET_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-green-lighter), 0.4)';\nconst AUDIO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-indigo-lighter), 0.4)';\nconst VIDEO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst COMPRESSED_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-orange-lighter), 0.4)';\nconst MESSAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst PDF_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst DATA_ICON_BACKGROUND_COLOR = 'rgba(var(--color-glaucous-lighter), 0.4)';\n\nconst filetypeBackgroundColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_BACKGROUND_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_BACKGROUND_COLOR,\n ical: CALENDAR_ICON_BACKGROUND_COLOR,\n icalendar: CALENDAR_ICON_BACKGROUND_COLOR,\n\n // Email\n ifb: CALENDAR_ICON_BACKGROUND_COLOR,\n email: EMAIL_ICON_BACKGROUND_COLOR,\n eml: EMAIL_ICON_BACKGROUND_COLOR,\n oft: EMAIL_ICON_BACKGROUND_COLOR,\n ost: EMAIL_ICON_BACKGROUND_COLOR,\n emlx: EMAIL_ICON_BACKGROUND_COLOR,\n\n // Web\n html: HTML_ICON_BACKGROUND_COLOR,\n xml: HTML_ICON_BACKGROUND_COLOR,\n\n // Editable text\n txt: TEXT_ICON_BACKGROUND_COLOR,\n rtf: TEXT_ICON_BACKGROUND_COLOR,\n\n // Editable document\n dot: WORD_ICON_BACKGROUND_COLOR,\n doc: WORD_ICON_BACKGROUND_COLOR,\n docx: WORD_ICON_BACKGROUND_COLOR,\n dotx: WORD_ICON_BACKGROUND_COLOR,\n docm: WORD_ICON_BACKGROUND_COLOR,\n dotm: WORD_ICON_BACKGROUND_COLOR,\n odt: DOCUMENT_ICON_BACKGROUND_COLOR,\n pages: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Portable document\n pdf: PDF_ICON_BACKGROUND_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_BACKGROUND_COLOR,\n pot: POWERPOINT_ICON_BACKGROUND_COLOR,\n pps: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptx: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptm: POWERPOINT_ICON_BACKGROUND_COLOR,\n potx: POWERPOINT_ICON_BACKGROUND_COLOR,\n potm: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppam: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsx: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsm: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldx: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldm: POWERPOINT_ICON_BACKGROUND_COLOR,\n odp: PRESENTATION_BACKGROUND_COLOR,\n key: PRESENTATION_BACKGROUND_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_BACKGROUND_COLOR,\n xlsx: EXCEL_ICON_BACKGROUND_COLOR,\n csv: DEFAULT_ICON_BACKGROUND_COLOR,\n numbers: SPREADSHEET_ICON_BACKGROUND_COLOR,\n\n // Image\n bmp: IMAGE_ICON_BACKGROUND_COLOR,\n jpg: IMAGE_ICON_BACKGROUND_COLOR,\n jpeg: IMAGE_ICON_BACKGROUND_COLOR,\n heic: IMAGE_ICON_BACKGROUND_COLOR,\n png: IMAGE_ICON_BACKGROUND_COLOR,\n gif: IMAGE_ICON_BACKGROUND_COLOR,\n\n // Editable image\n psd: PRESENTATION_BACKGROUND_COLOR,\n ai: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n svgz: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n ep: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n eps: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n sketch: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_BACKGROUND_COLOR,\n wav: AUDIO_ICON_BACKGROUND_COLOR,\n wma: AUDIO_ICON_BACKGROUND_COLOR,\n ogg: AUDIO_ICON_BACKGROUND_COLOR,\n\n // Video\n flv: VIDEO_ICON_BACKGROUND_COLOR,\n h264: VIDEO_ICON_BACKGROUND_COLOR,\n mov: VIDEO_ICON_BACKGROUND_COLOR,\n mp4: VIDEO_ICON_BACKGROUND_COLOR,\n mwv: VIDEO_ICON_BACKGROUND_COLOR,\n\n // Compressed:\n zip: COMPRESSED_ICON_BACKGROUND_COLOR,\n '7z': COMPRESSED_ICON_BACKGROUND_COLOR,\n rar: COMPRESSED_ICON_BACKGROUND_COLOR,\n\n // Data\n json: DATA_ICON_BACKGROUND_COLOR,\n yaml: DATA_ICON_BACKGROUND_COLOR,\n sql: DATA_ICON_BACKGROUND_COLOR,\n db: DATA_ICON_BACKGROUND_COLOR,\n dbf: DATA_ICON_BACKGROUND_COLOR,\n};\n\nexport function getIconBackgroundColorForFile(extension: string): string {\n return (\n filetypeBackgroundColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_BACKGROUND_COLOR\n );\n}\n","import { FileInfo } from '../../interface';\nimport { getIconForFile } from './icons';\nimport { getIconFillColorForFile } from './icon-fill-colors';\nimport { getIconBackgroundColorForFile } from './icon-background-colors';\n\nexport function getFileIcon(file: FileInfo) {\n if (file?.icon) {\n return file.icon;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconForFile(extension);\n}\n\nexport function getFileColor(file: FileInfo) {\n if (file?.iconColor) {\n return file.iconColor;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconFillColorForFile(extension);\n}\n\nexport function getFileBackgroundColor(file: FileInfo) {\n if (file?.iconBackgroundColor) {\n return file.iconBackgroundColor;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconBackgroundColorForFile(extension);\n}\n\nexport function getFileExtensionTitle(file: FileInfo) {\n if (file?.icon) {\n return file.icon;\n }\n\n return getExtension(file);\n}\n\nexport function getExtension(file: FileInfo) {\n if (!file) {\n return;\n }\n\n return file.filename.split('.').pop();\n}\n","/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n\n:host {\n --icon-background-color: rgb(var(--contrast-400));\n --icon-color: rgb(var(--contrast-1100));\n}\n","import translate from '../../global/translations';\nimport { Chip, FileInfo, Languages } from '../../interface';\nimport { MDCTextField } from '@material/textfield';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nconst CHIP_SET_TAG_NAME = 'limel-chip-set';\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n @Element()\n private element: HTMLLimelFileElement;\n\n @State()\n private isDraggingOverDropZone = false;\n\n private fileInput: HTMLInputElement;\n private fileInputId = createRandomString();\n private chipSet;\n private mdcTextField;\n\n constructor() {\n this.handleFileSelection = this.handleFileSelection.bind(this);\n this.handleFileChange = this.handleFileChange.bind(this);\n this.handleChipSetChange = this.handleChipSetChange.bind(this);\n this.handleFileDrop = this.handleFileDrop.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n this.handleChipInteract = this.handleChipInteract.bind(this);\n }\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentDidLoad() {\n this.fileInput = this.element.shadowRoot.getElementById(\n this.fileInputId\n ) as HTMLInputElement;\n this.chipSet = this.element.shadowRoot.querySelector(CHIP_SET_TAG_NAME);\n this.initialize();\n }\n\n private initialize() {\n if (!this.chipSet) {\n return;\n }\n\n this.mdcTextField = new MDCTextField(\n this.chipSet.shadowRoot.querySelector('.mdc-text-field')\n );\n }\n\n public disconnectedCallback() {\n if (this.mdcTextField) {\n this.mdcTextField.destroy();\n }\n }\n\n public render() {\n return [\n <input\n hidden={true}\n id={this.fileInputId}\n onChange={this.handleFileChange}\n type=\"file\"\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n />,\n <limel-chip-set\n class={{\n 'is-file-picker': true,\n 'shows-dropzone': true,\n 'highlight-dropzone': this.isDraggingOverDropZone,\n }}\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onClick={this.handleFileSelection}\n onInteract={this.handleChipInteract}\n onKeyDown={this.handleKeyDown}\n onKeyUp={this.handleKeyUp}\n required={this.required}\n type=\"input\"\n value={this.chipArray}\n title={this.getTranslation('drag-and-drop-tips')}\n onDragEnter={this.handleDragEnter}\n onDragOver={this.preventAndStop}\n onDragLeave={this.handleDragLeave}\n onDrop={this.handleFileDrop}\n />,\n ];\n }\n\n private handleDragEnter = (event: DragEvent) => {\n this.isDraggingOverDropZone = true;\n this.preventAndStop(event);\n };\n\n private handleDragLeave = () => {\n this.isDraggingOverDropZone = false;\n };\n\n private handleFileDrop = (event: DragEvent) => {\n this.preventAndStop(event);\n this.isDraggingOverDropZone = false;\n const dataTransfer = event.dataTransfer;\n this.handleFile(dataTransfer.files[0]);\n };\n\n private get chipArray() {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: getFileIcon(this.value),\n iconFillColor: getFileColor(this.value),\n iconBackgroundColor: getFileBackgroundColor(this.value),\n href: this.value.href,\n iconTitle: getFileExtensionTitle(this.value),\n },\n ];\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (\n event.code === 'Tab' ||\n event.code === 'Backspace' ||\n event.code === 'Enter'\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private handleKeyUp(event: KeyboardEvent) {\n if (event.code === 'Enter' && !this.value) {\n this.fileInput.click();\n }\n }\n\n private handleFileSelection(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n if (!this.value) {\n this.fileInput.click();\n }\n }\n\n private handleFileChange(event: Event) {\n if (this.fileInput.files.length > 0) {\n event.stopPropagation();\n this.handleFile(this.fileInput.files[0]);\n }\n }\n\n private handleFile(file) {\n const limeFile: FileInfo = {\n id: createRandomString(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n this.change.emit(limeFile);\n this.chipSet.blur();\n this.mdcTextField.valid = true;\n }\n\n private handleChipSetChange(event: CustomEvent) {\n event.stopPropagation();\n const file = !event.detail.length ? event.detail[0] : null;\n this.chipSet.blur();\n if (!file) {\n this.fileInput.value = '';\n this.change.emit(file);\n if (this.required) {\n this.mdcTextField.valid = false;\n }\n }\n }\n\n private handleChipInteract(event: CustomEvent<Chip>) {\n event.stopPropagation();\n event.preventDefault();\n this.interact.emit(event.detail.id);\n }\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(`file.${key}`, this.language);\n }\n}\n"],"version":3}