@mozaic-ds/web-components 0.6.1 → 0.6.2-beta.1

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 (29) hide show
  1. package/package.json +1 -1
  2. package/public/adeo/components/datatable/DataTable.js +1 -1
  3. package/public/adeo/components/datatable/DataTable.js.map +1 -1
  4. package/public/adeo/components/datatable/DataTable.svelte +26 -18
  5. package/public/adeo/components/fileuploader/FileUploader.js +1 -1
  6. package/public/adeo/components/fileuploader/FileUploader.js.map +1 -1
  7. package/public/adeo/components/fileuploader/FileUploader.svelte +5 -0
  8. package/public/adeo/components/fileuploader/ResultFile.nested.js +1 -1
  9. package/public/adeo/components/fileuploader/ResultFile.nested.js.map +1 -1
  10. package/public/adeo/components/resultfile/ResultFile.nested.svelte +31 -2
  11. package/public/bricoman/components/datatable/DataTable.js +1 -1
  12. package/public/bricoman/components/datatable/DataTable.js.map +1 -1
  13. package/public/bricoman/components/datatable/DataTable.svelte +26 -18
  14. package/public/bricoman/components/fileuploader/FileUploader.js +1 -1
  15. package/public/bricoman/components/fileuploader/FileUploader.js.map +1 -1
  16. package/public/bricoman/components/fileuploader/FileUploader.svelte +5 -0
  17. package/public/bricoman/components/fileuploader/ResultFile.nested.js +1 -1
  18. package/public/bricoman/components/fileuploader/ResultFile.nested.js.map +1 -1
  19. package/public/bricoman/components/resultfile/ResultFile.nested.svelte +31 -2
  20. package/public/components/datatable/DataTable.js +1 -1
  21. package/public/components/datatable/DataTable.js.map +1 -1
  22. package/public/components/datatable/DataTable.svelte +26 -18
  23. package/public/components/fileuploader/FileUploader.js +1 -1
  24. package/public/components/fileuploader/FileUploader.js.map +1 -1
  25. package/public/components/fileuploader/FileUploader.svelte +5 -0
  26. package/public/components/fileuploader/ResultFile.nested.js +1 -1
  27. package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
  28. package/public/components/resultfile/ResultFile.nested.svelte +31 -2
  29. package/public/utilities/stories/fileuploader/FileUploader.stories.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploader.js","sources":["../../../../src/components/fileuploader/FileUploader.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import { EventHandler } from '../../utilities/EventHandler';\n import ResultFile from './ResultFile.nested.svelte';\n\n export let id: string;\n export let label: string;\n export let accept: string;\n export let multiple = true;\n export let allowedextensions: string;\n export let maxsize: number;\n export let displayfileslist = false;\n export let disabled = false;\n export let removelabel = 'Remove';\n export let uploadedfiles: string;\n\n let files: FileList;\n let root: HTMLElement;\n let eventHandler = new EventHandler();\n\n $: allowedExtensions = allowedextensions ? JSON.parse(allowedextensions) : [];\n $: uploadedFiles = uploadedfiles ? JSON.parse(uploadedfiles) : [];\n $: files;\n $: maxSize = maxsize ? maxsize : undefined;\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n\n function checkFileStatus(file: File): boolean {\n const validExtension = allowedExtensions\n ? checkFileExtension(file.name)\n : true;\n const validSize = checkFileSize(file.size);\n\n if (!validExtension || !validSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function handleChange(e: Event): void {\n const target = e.target as HTMLInputElement;\n files = target.files as FileList;\n displayfileslist = true;\n const invalidFiles: Array = [];\n fileList.forEach((file, index) => {\n const fileName = file.name;\n const fileSize = file.size;\n const validExtension = checkFileExtension(fileName);\n const validSize = checkFileSize(fileSize);\n let errorType = '';\n\n if (!validExtension) {\n errorType = 'invalid-extension';\n }\n\n if (!validSize) {\n errorType = 'invalid-size';\n }\n\n if (!validExtension || !validSize) {\n invalidFiles.push({\n index: index,\n fileName: fileName,\n fileSize: fileSize,\n errorType: errorType,\n });\n }\n });\n\n if (invalidFiles.length > 0) {\n eventHandler.dispatch('invalid-files', invalidFiles);\n }\n eventHandler.dispatch('change', files);\n }\n\n function removeFromArray(fileList: FileList, value: File): FileList {\n const array = Array.from(fileList);\n const idx = array.indexOf(value);\n if (idx !== -1) {\n array.splice(idx, 1);\n }\n return array as FileList;\n }\n\n function deleteFile(e: CustomEvent): void {\n files = removeFromArray(files, e.detail);\n const fileuploader = root.querySelector(\n '.mc-fileuploader__input',\n ) as HTMLInputElement;\n fileuploader.value = '';\n eventHandler.dispatch('file-removed', e.detail);\n }\n\n function deleteUploadedFile(e: CustomEvent): void {\n const files = removeFromArray(uploadedFiles, e.detail);\n uploadedFiles = files;\n eventHandler.dispatch('uploaded-file-removed', e.detail);\n }\n\n function hasInvalidFiles(e: CustomEvent): void {\n eventHandler.dispatch('invalid-files', e.detail);\n }\n</script>\n\n<div class=\"mc-fileuploader\" bind:this={root}>\n <input\n {id}\n type=\"file\"\n class=\"mc-fileuploader__input\"\n {accept}\n {multiple}\n {disabled}\n on:change={handleChange}\n />\n <label for={id} class=\"mc-fileuploader__label\">\n <span class=\"mc-fileuploader__label--center\">\n {label}\n </span>\n </label>\n {#if displayfileslist && files && files.length > 0}\n <ResultFile\n {files}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n on:file-removed={deleteFile}\n />\n {/if}\n {#if uploadedFiles.length > 0}\n <ResultFile\n files={uploadedFiles}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n on:file-removed={deleteUploadedFile}\n />\n {/if}\n</div>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.file-uploader';\n</style>\n"],"names":["ctx","if_block0","length","create_if_block_1","create_if_block","insert","target","div","anchor","append","input","label_1","span","removeFromArray","fileList","value","array","Array","from","idx","indexOf","splice","files","root","id","$$props","label","accept","multiple","allowedextensions","maxsize","displayfileslist","disabled","removelabel","uploadedfiles","eventHandler","EventHandler","$$invalidate","allowedExtensions","JSON","parse","uploadedFiles","maxSize","undefined","e","invalidFiles","forEach","file","index","fileName","name","fileSize","size","validExtension","extension","slice","lastIndexOf","includes","String","checkFileExtension","validSize","checkFileSize","errorType","push","dispatch","detail","querySelector","$$value"],"mappings":"0aAmJuBA,EAAU,wVAKpBA,EAAa,gGAKHA,EAAkB,oFAL5BA,EAAa,uPAZnBC,EAAAD,MAAoBA,EAAK,IAAIA,EAAM,GAAAE,OAAS,GAACC,EAAAH,KAU7CA,EAAa,GAACE,OAAS,GAACE,EAAAJ,yEAbxBA,EAAK,8NAFEA,EAAE,iFAVhBK,EAmCKC,EAAAC,EAAAC,GAlCHC,EAQCF,EAAAG,UACDD,EAIOF,EAAAI,GAHLF,EAEME,EAAAC,uFALKZ,EAAY,wJAIpBA,EAAK,yBAFEA,EAAE,IAKTA,MAAoBA,EAAK,IAAIA,EAAM,GAAAE,OAAS,iGAU5CF,EAAa,GAACE,OAAS,mNAtDnBW,EAAgBC,EAAoBC,GACrC,MAAAC,EAAQC,MAAMC,KAAKJ,GACnBK,EAAMH,EAAMI,QAAQL,UACb,IAATI,GACFH,EAAMK,OAAOF,EAAK,GAEbH,8BApFLM,EACAC,MAZOC,GAAUC,SACVC,GAAaD,UACbE,GAAcF,GACdG,SAAAA,GAAW,GAAIH,qBACfI,GAAyBJ,WACzBK,GAAeL,GACfM,iBAAAA,GAAmB,GAAKN,GACxBO,SAAAA,GAAW,GAAKP,GAChBQ,YAAAA,EAAc,UAAQR,iBACtBS,GAAqBT,EAI5BU,MAAmBC,0aAEtBC,EAAA,GAAEC,EAAoBT,EAAoBU,KAAKC,MAAMX,GAAiB,uBACtEQ,EAAA,EAAEI,EAAgBP,EAAgBK,KAAKC,MAAMN,GAAa,sCAExDQ,EAAUZ,QAAoBa,6BAmCxB,SAAaC,SACdtC,EAASsC,EAAEtC,WACjBgB,EAAQhB,EAAOgB,OACfe,EAAA,EAAAN,GAAmB,SACbc,EAAY,GAClB/B,SAASgC,SAAS,CAAAC,EAAMC,WAChBC,EAAWF,EAAKG,KAChBC,EAAWJ,EAAKK,KAChBC,EAjCD,SAAmBJ,GACtB,GAAAX,GAAqBA,EAAkBpC,OAAS,EAAC,CAC7C,MAAAoD,EAAoBL,EAASM,MACS,GAAxCN,EAASO,YAAY,KAAO,IAAO,IAEnC,GAAAlB,IAAsBA,EAAkBmB,SAASC,OAAOJ,WACnD,SAIJ,EAuBkBK,CAAmBV,GACpCW,EA1CD,SAAcT,WAEjBT,GADeS,EAAW,KAAO,KACTT,GAwCRmB,CAAcV,GAC5B,IAAAW,EAAY,GAEXT,IACHS,EAAY,qBAGTF,IACHE,EAAY,gBAGTT,GAAmBO,GACtBf,EAAakB,KACJ,CAAAf,QACGC,WACAE,WACCW,iBAKbjB,EAAa3C,OAAS,GACxBiC,EAAa6B,SAAS,gBAAiBnB,GAEzCV,EAAa6B,SAAS,SAAU1C,IAYzB,SAAWsB,GAClBP,EAAA,EAAAf,EAAQT,EAAgBS,EAAOsB,EAAEqB,SACZ1C,EAAK2C,cACxB,2BAEWnD,MAAQ,GACrBoB,EAAa6B,SAAS,eAAgBpB,EAAEqB,SAGjC,SAAmBrB,GACpB,MAAAtB,EAAQT,EAAgB4B,EAAeG,EAAEqB,QAC/C5B,EAAA,EAAAI,EAAgBnB,GAChBa,EAAa6B,SAAS,wBAAyBpB,EAAEqB,uDAQb1C,EAAI4C"}
1
+ {"version":3,"file":"FileUploader.js","sources":["../../../../src/components/fileuploader/FileUploader.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import { EventHandler } from '../../utilities/EventHandler';\n import ResultFile from './ResultFile.nested.svelte';\n\n export let id: string;\n export let label: string;\n export let accept: string;\n export let multiple = true;\n export let allowedextensions: string;\n export let maxsize: number;\n export let displayfileslist = false;\n export let disabled = false;\n export let removelabel = 'Remove';\n export let uploadedfiles: string;\n export let errorlabels: string;\n\n let files: FileList;\n let root: HTMLElement;\n let eventHandler = new EventHandler();\n\n $: allowedExtensions = allowedextensions ? JSON.parse(allowedextensions) : [];\n $: uploadedFiles = uploadedfiles ? JSON.parse(uploadedfiles) : [];\n $: files;\n $: maxSize = maxsize ? maxsize : undefined;\n $: errorLabels = errorlabels ? JSON.parse(errorlabels) : [];\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n\n function checkFileStatus(file: File): boolean {\n const validExtension = allowedExtensions\n ? checkFileExtension(file.name)\n : true;\n const validSize = checkFileSize(file.size);\n\n if (!validExtension || !validSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function handleChange(e: Event): void {\n const target = e.target as HTMLInputElement;\n files = target.files as FileList;\n displayfileslist = true;\n const invalidFiles: Array = [];\n const fileList = [...files];\n fileList.forEach((file, index) => {\n const fileName = file.name;\n const fileSize = file.size;\n const validExtension = checkFileExtension(fileName);\n const validSize = checkFileSize(fileSize);\n let errorType = '';\n\n if (!validExtension) {\n errorType = 'invalid-extension';\n }\n\n if (!validSize) {\n errorType = 'invalid-size';\n }\n\n if (!validExtension || !validSize) {\n invalidFiles.push({\n index: index,\n fileName: fileName,\n fileSize: fileSize,\n errorType: errorType,\n });\n }\n });\n\n if (invalidFiles.length > 0) {\n eventHandler.dispatch('invalid-files', invalidFiles);\n }\n eventHandler.dispatch('change', files);\n }\n\n function removeFromArray(fileList: FileList, value: File): FileList {\n const array = Array.from(fileList);\n const idx = array.indexOf(value);\n if (idx !== -1) {\n array.splice(idx, 1);\n }\n return array as FileList;\n }\n\n function deleteFile(e: CustomEvent): void {\n files = removeFromArray(files, e.detail);\n const fileuploader = root.querySelector(\n '.mc-fileuploader__input',\n ) as HTMLInputElement;\n fileuploader.value = '';\n eventHandler.dispatch('file-removed', e.detail);\n }\n\n function deleteUploadedFile(e: CustomEvent): void {\n const files = removeFromArray(uploadedFiles, e.detail);\n uploadedFiles = files;\n eventHandler.dispatch('uploaded-file-removed', e.detail);\n }\n\n function hasInvalidFiles(e: CustomEvent): void {\n eventHandler.dispatch('invalid-files', e.detail);\n }\n</script>\n\n<div class=\"mc-fileuploader\" bind:this={root}>\n <input\n {id}\n type=\"file\"\n class=\"mc-fileuploader__input\"\n {accept}\n {multiple}\n {disabled}\n on:change={handleChange}\n />\n <label for={id} class=\"mc-fileuploader__label\">\n <span class=\"mc-fileuploader__label--center\">\n {label}\n </span>\n </label>\n {#if displayfileslist && files && files.length > 0}\n <ResultFile\n {files}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n {errorLabels}\n on:file-removed={deleteFile}\n />\n {/if}\n {#if uploadedFiles.length > 0}\n <ResultFile\n files={uploadedFiles}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n {errorLabels}\n on:file-removed={deleteUploadedFile}\n />\n {/if}\n</div>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.file-uploader';\n</style>\n"],"names":["ctx","if_block0","length","create_if_block_1","create_if_block","insert","target","div","anchor","append","input","label_1","span","removeFromArray","fileList","value","array","Array","from","idx","indexOf","splice","files","root","id","$$props","label","accept","multiple","allowedextensions","maxsize","displayfileslist","disabled","removelabel","uploadedfiles","errorlabels","eventHandler","EventHandler","$$invalidate","allowedExtensions","JSON","parse","uploadedFiles","maxSize","undefined","errorLabels","e","invalidFiles","forEach","file","index","fileName","name","fileSize","size","validExtension","extension","slice","lastIndexOf","includes","String","checkFileExtension","validSize","checkFileSize","errorType","push","dispatch","detail","querySelector","$$value"],"mappings":"icAuJuBA,EAAU,sXAKpBA,EAAa,kHAMHA,EAAkB,oFAN5BA,EAAa,qRAbnBC,EAAAD,MAAoBA,EAAK,IAAIA,EAAM,GAAAE,OAAS,GAACC,EAAAH,KAW7CA,EAAa,GAACE,OAAS,GAACE,EAAAJ,yEAdxBA,EAAK,8NAFEA,EAAE,iFAVhBK,EAqCKC,EAAAC,EAAAC,GApCHC,EAQCF,EAAAG,UACDD,EAIOF,EAAAI,GAHLF,EAEME,EAAAC,uFALKZ,EAAY,wJAIpBA,EAAK,yBAFEA,EAAE,IAKTA,MAAoBA,EAAK,IAAIA,EAAM,GAAAE,OAAS,iGAW5CF,EAAa,GAACE,OAAS,mNAvDnBW,EAAgBC,EAAoBC,GACrC,MAAAC,EAAQC,MAAMC,KAAKJ,GACnBK,EAAMH,EAAMI,QAAQL,UACb,IAATI,GACFH,EAAMK,OAAOF,EAAK,GAEbH,gCAtFLM,EACAC,MAbOC,GAAUC,SACVC,GAAaD,UACbE,GAAcF,GACdG,SAAAA,GAAW,GAAIH,qBACfI,GAAyBJ,WACzBK,GAAeL,GACfM,iBAAAA,GAAmB,GAAKN,GACxBO,SAAAA,GAAW,GAAKP,GAChBQ,YAAAA,EAAc,UAAQR,iBACtBS,GAAqBT,eACrBU,GAAmBV,EAI1BW,MAAmBC,mdAEtBC,EAAA,GAAEC,EAAoBV,EAAoBW,KAAKC,MAAMZ,GAAiB,uBACtES,EAAA,EAAEI,EAAgBR,EAAgBM,KAAKC,MAAMP,GAAa,uCAExDS,EAAUb,QAAoBc,sBAChCN,EAAA,GAAEO,EAAcV,EAAcK,KAAKC,MAAMN,GAAW,gCAmC5C,SAAaW,SACdxC,EAASwC,EAAExC,WACjBgB,EAAQhB,EAAOgB,OACfgB,EAAA,EAAAP,GAAmB,SACbgB,EAAY,OACGzB,GACZ0B,SAAS,CAAAC,EAAMC,WAChBC,EAAWF,EAAKG,KAChBC,EAAWJ,EAAKK,KAChBC,EAlCD,SAAmBJ,GACtB,GAAAZ,GAAqBA,EAAkBrC,OAAS,EAAC,CAC7C,MAAAsD,EAAoBL,EAASM,MACS,GAAxCN,EAASO,YAAY,KAAO,IAAO,IAEnC,GAAAnB,IAAsBA,EAAkBoB,SAASC,OAAOJ,WACnD,SAIJ,EAwBkBK,CAAmBV,GACpCW,EA3CD,SAAcT,WAEjBV,GADeU,EAAW,KAAO,KACTV,GAyCRoB,CAAcV,GAC5B,IAAAW,EAAY,GAEXT,IACHS,EAAY,qBAGTF,IACHE,EAAY,gBAGTT,GAAmBO,GACtBf,EAAakB,KACJ,CAAAf,QACGC,WACAE,WACCW,iBAKbjB,EAAa7C,OAAS,GACxBkC,EAAa8B,SAAS,gBAAiBnB,GAEzCX,EAAa8B,SAAS,SAAU5C,IAYzB,SAAWwB,GAClBR,EAAA,EAAAhB,EAAQT,EAAgBS,EAAOwB,EAAEqB,SACZ5C,EAAK6C,cACxB,2BAEWrD,MAAQ,GACrBqB,EAAa8B,SAAS,eAAgBpB,EAAEqB,SAGjC,SAAmBrB,GACpB,MAAAxB,EAAQT,EAAgB6B,EAAeI,EAAEqB,QAC/C7B,EAAA,EAAAI,EAAgBpB,GAChBc,EAAa8B,SAAS,wBAAyBpB,EAAEqB,yDAQb5C,EAAI8C"}
@@ -15,6 +15,7 @@
15
15
  export let disabled = false;
16
16
  export let removelabel = 'Remove';
17
17
  export let uploadedfiles: string;
18
+ export let errorlabels: string;
18
19
 
19
20
  let files: FileList;
20
21
  let root: HTMLElement;
@@ -24,6 +25,7 @@
24
25
  $: uploadedFiles = uploadedfiles ? JSON.parse(uploadedfiles) : [];
25
26
  $: files;
26
27
  $: maxSize = maxsize ? maxsize : undefined;
28
+ $: errorLabels = errorlabels ? JSON.parse(errorlabels) : [];
27
29
 
28
30
  function checkFileSize(fileSize: number): boolean {
29
31
  const fileSizeMB = fileSize / 1024 / 1024; // in MB
@@ -63,6 +65,7 @@
63
65
  files = target.files as FileList;
64
66
  displayfileslist = true;
65
67
  const invalidFiles: Array = [];
68
+ const fileList = [...files];
66
69
  fileList.forEach((file, index) => {
67
70
  const fileName = file.name;
68
71
  const fileSize = file.size;
@@ -145,6 +148,7 @@
145
148
  {disabled}
146
149
  {maxSize}
147
150
  {removelabel}
151
+ {errorLabels}
148
152
  on:file-removed={deleteFile}
149
153
  />
150
154
  {/if}
@@ -155,6 +159,7 @@
155
159
  {disabled}
156
160
  {maxSize}
157
161
  {removelabel}
162
+ {errorLabels}
158
163
  on:file-removed={deleteUploadedFile}
159
164
  />
160
165
  {/if}
@@ -1,2 +1,2 @@
1
- import{P as e,i as a,s as l,Q as i,e as s,g as t,b as o,n as r,o as w,J as n,c,q as M,t as b,d as u,j as d,l as m,k as g}from"../../index-c33b3772.js";import{E as f}from"../../EventHandler-02058705.js";function x(e){i(e,"svelte-1bhauwa",'.mc-fileuploader.svelte-1bhauwa.svelte-1bhauwa{position:relative;display:block}.mc-fileuploader__input.svelte-1bhauwa.svelte-1bhauwa{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;visibility:visible;white-space:nowrap}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa{font-family:"LeroyMerlin", sans-serif;font-weight:600;cursor:pointer;border-radius:4px;text-align:center;border:2px solid transparent;-webkit-transition:all ease 200ms;-o-transition:all ease 200ms;transition:all ease 200ms;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem;color:#120949;border-color:#120949;background-color:#ffffff;margin:0;-webkit-box-shadow:none;box-shadow:none;text-decoration:none;outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.mc-fileuploader__label.is-hover.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:hover{background-color:#e5e7fa;color:#161cb6}.mc-fileuploader__label.is-active.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:active{background-color:#b8bef4;color:#130f7b}.mc-fileuploader__label.is-active.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:active{background-color:#b8bef4;color:#130f7b}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:disabled,.mc-fileuploader__label.is-disabled.svelte-1bhauwa.svelte-1bhauwa{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa::before{content:"";width:1.5rem;height:1.5rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjMTIwOTQ5IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjx0aXRsZT5NZWRpYV9VcGxvYWRfMjRweDwvdGl0bGU+PHBhdGggZD0iTTguNzEsNy43MSwxMSw1LjQxVjE2YTEsMSwwLDAsMCwyLDBWNS40MWwyLjI5LDIuM2ExLDEsMCwwLDAsMS40MiwwLDEsMSwwLDAsMCwwLTEuNDJsLTQtNGExLDEsMCwwLDAtMS40MiwwbC00LDRBMSwxLDAsMSwwLDguNzEsNy43MVoiLz48cGF0aCBkPSJNMTYuMjIsMTIuNDRhMSwxLDAsMCwwLTEuMi43NywxLDEsMCwwLDAsLjc2LDEuMTlDMTguNTUsMTUsMjAsMTYuMTcsMjAsMTdjMCwxLjIyLTMuMTIsMy04LDNzLTgtMS43OC04LTNjMC0uODMsMS40NS0yLDQuMjItMi42QTEsMSwwLDAsMCw5LDEzLjIxYTEsMSwwLDAsMC0xLjItLjc3QzQuMTYsMTMuMjUsMiwxNSwyLDE3YzAsMi44NSw0LjMsNSwxMCw1czEwLTIuMTUsMTAtNUMyMiwxNSwxOS44NCwxMy4yNSwxNi4yMiwxMi40NFoiLz48L3N2Zz4=") no-repeat;background-size:1.5rem;margin-right:0.5rem;margin-left:-0.5rem}.is-focus.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:focus+.mc-fileuploader__label.svelte-1bhauwa{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc}.is-hover.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:hover+.mc-fileuploader__label.svelte-1bhauwa{color:#161cb6;background-color:#e5e7fa}.is-disabled.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:disabled+.mc-fileuploader__label.svelte-1bhauwa{color:#666666;background-color:#cccccc;border-color:transparent;cursor:not-allowed}.is-disabled.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa::before,.svelte-1bhauwa:disabled+.mc-fileuploader__label.svelte-1bhauwa::before{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjNjY2NjY2IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjx0aXRsZT5NZWRpYV9VcGxvYWRfMjRweDwvdGl0bGU+PHBhdGggZD0iTTguNzEsNy43MSwxMSw1LjQxVjE2YTEsMSwwLDAsMCwyLDBWNS40MWwyLjI5LDIuM2ExLDEsMCwwLDAsMS40MiwwLDEsMSwwLDAsMCwwLTEuNDJsLTQtNGExLDEsMCwwLDAtMS40MiwwbC00LDRBMSwxLDAsMSwwLDguNzEsNy43MVoiLz48cGF0aCBkPSJNMTYuMjIsMTIuNDRhMSwxLDAsMCwwLTEuMi43NywxLDEsMCwwLDAsLjc2LDEuMTlDMTguNTUsMTUsMjAsMTYuMTcsMjAsMTdjMCwxLjIyLTMuMTIsMy04LDNzLTgtMS43OC04LTNjMC0uODMsMS40NS0yLDQuMjItMi42QTEsMSwwLDAsMCw5LDEzLjIxYTEsMSwwLDAsMC0xLjItLjc3QzQuMTYsMTMuMjUsMiwxNSwyLDE3YzAsMi44NSw0LjMsNSwxMCw1czEwLTIuMTUsMTAtNUMyMiwxNSwxOS44NCwxMy4yNSwxNi4yMiwxMi40NFoiLz48L3N2Zz4=") no-repeat}.mc-fileuploader__files.svelte-1bhauwa.svelte-1bhauwa{list-style:none;padding:0;margin:1rem 0 0 0}.mc-fileuploader__file.svelte-1bhauwa.svelte-1bhauwa{font-family:"LeroyMerlin", sans-serif;font-weight:400;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:#e6e6e6;-webkit-box-sizing:content-box;box-sizing:content-box;color:#000000;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap}.mc-fileuploader__file.svelte-1bhauwa.svelte-1bhauwa:not(:last-child){margin-bottom:0.25rem}.mc-fileuploader__file-name.svelte-1bhauwa.svelte-1bhauwa{font-size:1rem;line-height:1.375;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;overflow:hidden;padding-left:0.75rem;padding-right:0.75rem;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 7.5rem)}.mc-fileuploader__file-icon.svelte-1bhauwa.svelte-1bhauwa{background-color:transparent;background-position:center right;background-repeat:no-repeat;background-size:1.5rem;display:block;height:1.5rem;margin-left:1rem;margin-right:1rem;width:1.5rem}.mc-fileuploader__file--is-valid.svelte-1bhauwa .mc-fileuploader__file-icon.svelte-1bhauwa{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjNGQ1YmY1IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMiA0YTggOCAwIDEgMS04IDggOCA4IDAgMCAxIDgtOG0wLTJhMTAgMTAgMCAxIDAgMTAgMTBBMTAgMTAgMCAwIDAgMTIgMnoiLz48cGF0aCBkPSJNMTAuNTkgMTYuMTJhMSAxIDAgMCAxLS42OC0uMjZsLTMuODQtMy41NWExIDEgMCAwIDEgMS4zNi0xLjQ3bDMuMTMgMi44OUwxNiA4LjE3YTEgMSAwIDAgMSAxLjQzIDEuNDFsLTYuMTMgNi4yNWExIDEgMCAwIDEtLjcxLjI5eiIvPjwvc3ZnPg==")}.mc-fileuploader__file--is-invalid.svelte-1bhauwa .mc-fileuploader__file-icon.svelte-1bhauwa{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjYzYxMTEyIiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMSAwIDEwIDEwQTEwIDEwIDAgMCAwIDEyIDJ6bTAgMThhOCA4IDAgMSAxIDgtOCA4IDggMCAwIDEtOCA4eiIvPjxwYXRoIGQ9Ik0xMiA3YTEgMSAwIDAgMC0xIDF2NC4zOGExIDEgMCAwIDAgMiAwVjhhMSAxIDAgMCAwLTEtMXoiLz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE2IiByPSIxIi8+PC9zdmc+")}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa{position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#cccccc;border:none;cursor:pointer;padding:0.5rem}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa::before{border-radius:2px;-webkit-box-shadow:0 0 0 0 transparent;box-shadow:0 0 0 0 transparent;content:"";display:block;pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-transition:-webkit-box-shadow 200ms ease;transition:-webkit-box-shadow 200ms ease;-o-transition:box-shadow 200ms ease;transition:box-shadow 200ms ease;transition:box-shadow 200ms ease, -webkit-box-shadow 200ms ease;top:-0.125rem;right:-0.125rem;bottom:-0.125rem;left:-0.125rem}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa::after{content:"";width:1.5rem;height:1.5rem;background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjMDAwMDAwIiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOC4wOCA4YTEgMSAwIDAgMC0xLjA4LjkyTDE2LjA4IDIwSDcuOTJMNyA4LjkyYTEgMSAwIDEgMC0yIC4xNmwxIDEyQTEgMSAwIDAgMCA3IDIyaDEwYTEgMSAwIDAgMCAxLS45MmwxLTEyQTEgMSAwIDAgMCAxOC4wOCA4eiIvPjxwYXRoIGQ9Ik0xOSA1aC0zLjc3bC0uNjUtMi4yN2ExIDEgMCAwIDAtMS0uNzNoLTMuMmExIDEgMCAwIDAtMSAuNzNMOC43NyA1SDVhMSAxIDAgMCAwIDAgMmgxNGExIDEgMCAwIDAgMC0yem0tOC42Mi0yaDMuMjRsLjU3IDJIOS44MXpNMTIuNSAxOHYtOGEuNS41IDAgMCAwLTEgMHY4YS41LjUgMCAwIDAgMSAwek0xNC4yNSAxOC41YS41LjUgMCAwIDAgLjUtLjQ3bC41LThhLjUuNSAwIDAgMC0uNDctLjUzLjQ5LjQ5IDAgMCAwLS41My40N2wtLjUgOGEuNS41IDAgMCAwIC40Ny41M3pNOS43NSAxOC41YS41LjUgMCAwIDAgLjQ3LS41M2wtLjUtOGEuNDkuNDkgMCAwIDAtLjUzLS40Ny41LjUgMCAwIDAtLjQ3LjUzbC41IDhhLjUuNSAwIDAgMCAuNTMuNDd6Ii8+PC9zdmc+") no-repeat;background-size:1.5rem;display:block}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa:focus{outline:none}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa:focus::before{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;-webkit-box-shadow:0 0 0 0.125rem #0b96cc;box-shadow:0 0 0 0.125rem #0b96cc}')}function h(e,a,l){const i=e.slice();return i[13]=a[l],i[15]=l,i}function D(e){let a,l,i,r,n,c,M,f,x,h,D,I=e[13].name+"";function A(){return e[8](e[13])}return{c(){a=s("li"),l=s("span"),i=b(I),r=u(),n=s("span"),n.textContent=" ",c=u(),M=s("button"),f=u(),t(l,"class","mc-fileuploader__file-name svelte-1bhauwa"),t(n,"class","mc-fileuploader__file-icon svelte-1bhauwa"),t(M,"type","button"),t(M,"class","mc-fileuploader__delete svelte-1bhauwa"),t(M,"aria-label",e[2]),M.disabled=e[1],t(a,"id",`file-${e[15]}`),t(a,"class",x=e[3](e[13])+" "+e[5].class+" svelte-1bhauwa")},m(e,s){o(e,a,s),d(a,l),d(l,i),d(a,r),d(a,n),d(a,c),d(a,M),d(a,f),h||(D=m(M,"click",A),h=!0)},p(l,s){e=l,1&s&&I!==(I=e[13].name+"")&&g(i,I),4&s&&t(M,"aria-label",e[2]),2&s&&(M.disabled=e[1]),33&s&&x!==(x=e[3](e[13])+" "+e[5].class+" svelte-1bhauwa")&&t(a,"class",x)},d(e){e&&w(a),h=!1,D()}}}function I(e){let a,l=e[0],i=[];for(let a=0;a<l.length;a+=1)i[a]=D(h(e,l,a));return{c(){a=s("ul");for(let e=0;e<i.length;e+=1)i[e].c();t(a,"id","file_uploaded"),t(a,"class","mc-fileuploader__files svelte-1bhauwa")},m(e,l){o(e,a,l);for(let e=0;e<i.length;e+=1)i[e]&&i[e].m(a,null)},p(e,[s]){if(63&s){let t;for(l=e[0],t=0;t<l.length;t+=1){const o=h(e,l,t);i[t]?i[t].p(o,s):(i[t]=D(o),i[t].c(),i[t].m(a,null))}for(;t<i.length;t+=1)i[t].d(1);i.length=l.length}},i:r,o:r,d(e){e&&w(a),n(i,e)}}}function A(e,a,l){let{allowedExtensions:i}=a,{maxSize:s}=a,{disabled:t=!1}=a,{files:o}=a,{removelabel:r="Remove"}=a,w=new f;function n(e){w.dispatch("file-removed",e)}return e.$$set=e=>{l(5,a=c(c({},a),M(e))),"allowedExtensions"in e&&l(7,i=e.allowedExtensions),"maxSize"in e&&l(6,s=e.maxSize),"disabled"in e&&l(1,t=e.disabled),"files"in e&&l(0,o=e.files),"removelabel"in e&&l(2,r=e.removelabel)},e.$$.update=()=>{1&e.$$.dirty&&l(0,o=o||[]),64&e.$$.dirty&&l(6,s=s||void 0)},a=M(a),[o,t,r,function(e){let a=["mc-fileuploader__file"];return!function(e){const a=!i||function(e){if(i&&i.length>0){const a=e.slice(2+(e.lastIndexOf(".")-1>>>0));if(i&&!i.includes(String(a)))return!1}return!0}(e.name),l=function(e){const a=e/1024/1024;if(s&&a>s)return!1;return!0}(e.size);if(!a||!l)return!1;return!0}(e)?a.push("mc-fileuploader__file--is-invalid"):a.push("mc-fileuploader__file--is-valid"),a.join(" ")},n,a,s,i,e=>n(e)]}class v extends e{constructor(e){super(),a(this,e,A,I,l,{allowedExtensions:7,maxSize:6,disabled:1,files:0,removelabel:2},x)}}export{v as default};
1
+ import{P as e,i as a,s as l,Q as i,e as s,g as t,b as o,n as r,o as w,J as n,c,q as u,t as b,d as M,j as d,l as m,k as f}from"../../index-c33b3772.js";import{E as g}from"../../EventHandler-02058705.js";function x(e){i(e,"svelte-1bhauwa",'.mc-fileuploader.svelte-1bhauwa.svelte-1bhauwa{position:relative;display:block}.mc-fileuploader__input.svelte-1bhauwa.svelte-1bhauwa{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;visibility:visible;white-space:nowrap}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa{font-family:"LeroyMerlin", sans-serif;font-weight:600;cursor:pointer;border-radius:4px;text-align:center;border:2px solid transparent;-webkit-transition:all ease 200ms;-o-transition:all ease 200ms;transition:all ease 200ms;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem;color:#120949;border-color:#120949;background-color:#ffffff;margin:0;-webkit-box-shadow:none;box-shadow:none;text-decoration:none;outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.mc-fileuploader__label.is-hover.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:hover{background-color:#e5e7fa;color:#161cb6}.mc-fileuploader__label.is-active.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:active{background-color:#b8bef4;color:#130f7b}.mc-fileuploader__label.is-active.svelte-1bhauwa.svelte-1bhauwa,.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:active{background-color:#b8bef4;color:#130f7b}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa:disabled,.mc-fileuploader__label.is-disabled.svelte-1bhauwa.svelte-1bhauwa{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-fileuploader__label.svelte-1bhauwa.svelte-1bhauwa::before{content:"";width:1.5rem;height:1.5rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjMTIwOTQ5IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjx0aXRsZT5NZWRpYV9VcGxvYWRfMjRweDwvdGl0bGU+PHBhdGggZD0iTTguNzEsNy43MSwxMSw1LjQxVjE2YTEsMSwwLDAsMCwyLDBWNS40MWwyLjI5LDIuM2ExLDEsMCwwLDAsMS40MiwwLDEsMSwwLDAsMCwwLTEuNDJsLTQtNGExLDEsMCwwLDAtMS40MiwwbC00LDRBMSwxLDAsMSwwLDguNzEsNy43MVoiLz48cGF0aCBkPSJNMTYuMjIsMTIuNDRhMSwxLDAsMCwwLTEuMi43NywxLDEsMCwwLDAsLjc2LDEuMTlDMTguNTUsMTUsMjAsMTYuMTcsMjAsMTdjMCwxLjIyLTMuMTIsMy04LDNzLTgtMS43OC04LTNjMC0uODMsMS40NS0yLDQuMjItMi42QTEsMSwwLDAsMCw5LDEzLjIxYTEsMSwwLDAsMC0xLjItLjc3QzQuMTYsMTMuMjUsMiwxNSwyLDE3YzAsMi44NSw0LjMsNSwxMCw1czEwLTIuMTUsMTAtNUMyMiwxNSwxOS44NCwxMy4yNSwxNi4yMiwxMi40NFoiLz48L3N2Zz4=") no-repeat;background-size:1.5rem;margin-right:0.5rem;margin-left:-0.5rem}.is-focus.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:focus+.mc-fileuploader__label.svelte-1bhauwa{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc}.is-hover.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:hover+.mc-fileuploader__label.svelte-1bhauwa{color:#161cb6;background-color:#e5e7fa}.is-disabled.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa,.svelte-1bhauwa:disabled+.mc-fileuploader__label.svelte-1bhauwa{color:#666666;background-color:#cccccc;border-color:transparent;cursor:not-allowed}.is-disabled.svelte-1bhauwa+.mc-fileuploader__label.svelte-1bhauwa::before,.svelte-1bhauwa:disabled+.mc-fileuploader__label.svelte-1bhauwa::before{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjNjY2NjY2IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjx0aXRsZT5NZWRpYV9VcGxvYWRfMjRweDwvdGl0bGU+PHBhdGggZD0iTTguNzEsNy43MSwxMSw1LjQxVjE2YTEsMSwwLDAsMCwyLDBWNS40MWwyLjI5LDIuM2ExLDEsMCwwLDAsMS40MiwwLDEsMSwwLDAsMCwwLTEuNDJsLTQtNGExLDEsMCwwLDAtMS40MiwwbC00LDRBMSwxLDAsMSwwLDguNzEsNy43MVoiLz48cGF0aCBkPSJNMTYuMjIsMTIuNDRhMSwxLDAsMCwwLTEuMi43NywxLDEsMCwwLDAsLjc2LDEuMTlDMTguNTUsMTUsMjAsMTYuMTcsMjAsMTdjMCwxLjIyLTMuMTIsMy04LDNzLTgtMS43OC04LTNjMC0uODMsMS40NS0yLDQuMjItMi42QTEsMSwwLDAsMCw5LDEzLjIxYTEsMSwwLDAsMC0xLjItLjc3QzQuMTYsMTMuMjUsMiwxNSwyLDE3YzAsMi44NSw0LjMsNSwxMCw1czEwLTIuMTUsMTAtNUMyMiwxNSwxOS44NCwxMy4yNSwxNi4yMiwxMi40NFoiLz48L3N2Zz4=") no-repeat}.mc-fileuploader__files.svelte-1bhauwa.svelte-1bhauwa{list-style:none;padding:0;margin:1rem 0 0 0}.mc-fileuploader__file.svelte-1bhauwa.svelte-1bhauwa{font-family:"LeroyMerlin", sans-serif;font-weight:400;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:#e6e6e6;-webkit-box-sizing:content-box;box-sizing:content-box;color:#000000;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap}.mc-fileuploader__file.svelte-1bhauwa.svelte-1bhauwa:not(:last-child){margin-bottom:0.25rem}.mc-fileuploader__file-name.svelte-1bhauwa.svelte-1bhauwa{font-size:1rem;line-height:1.375;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;overflow:hidden;padding-left:0.75rem;padding-right:0.75rem;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 7.5rem)}.mc-fileuploader__file-icon.svelte-1bhauwa.svelte-1bhauwa{background-color:transparent;background-position:center right;background-repeat:no-repeat;background-size:1.5rem;display:block;height:1.5rem;margin-left:1rem;margin-right:1rem;width:1.5rem}.mc-fileuploader__file--is-valid.svelte-1bhauwa .mc-fileuploader__file-icon.svelte-1bhauwa{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjNGQ1YmY1IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMiA0YTggOCAwIDEgMS04IDggOCA4IDAgMCAxIDgtOG0wLTJhMTAgMTAgMCAxIDAgMTAgMTBBMTAgMTAgMCAwIDAgMTIgMnoiLz48cGF0aCBkPSJNMTAuNTkgMTYuMTJhMSAxIDAgMCAxLS42OC0uMjZsLTMuODQtMy41NWExIDEgMCAwIDEgMS4zNi0xLjQ3bDMuMTMgMi44OUwxNiA4LjE3YTEgMSAwIDAgMSAxLjQzIDEuNDFsLTYuMTMgNi4yNWExIDEgMCAwIDEtLjcxLjI5eiIvPjwvc3ZnPg==")}.mc-fileuploader__file--is-invalid.svelte-1bhauwa .mc-fileuploader__file-icon.svelte-1bhauwa{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjYzYxMTEyIiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMSAwIDEwIDEwQTEwIDEwIDAgMCAwIDEyIDJ6bTAgMThhOCA4IDAgMSAxIDgtOCA4IDggMCAwIDEtOCA4eiIvPjxwYXRoIGQ9Ik0xMiA3YTEgMSAwIDAgMC0xIDF2NC4zOGExIDEgMCAwIDAgMiAwVjhhMSAxIDAgMCAwLTEtMXoiLz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE2IiByPSIxIi8+PC9zdmc+")}.mc-fileuploader__file--is-invalid.svelte-1bhauwa .mc-fileuploader__file-message.svelte-1bhauwa{font-size:0.875rem;line-height:1.2857142857;background:#ffffff;color:#c61112;-ms-flex-preferred-size:100%;flex-basis:100%;padding-top:0.25rem}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa{position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#cccccc;border:none;cursor:pointer;padding:0.5rem}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa::before{border-radius:2px;-webkit-box-shadow:0 0 0 0 transparent;box-shadow:0 0 0 0 transparent;content:"";display:block;pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-transition:-webkit-box-shadow 200ms ease;transition:-webkit-box-shadow 200ms ease;-o-transition:box-shadow 200ms ease;transition:box-shadow 200ms ease;transition:box-shadow 200ms ease, -webkit-box-shadow 200ms ease;top:-0.125rem;right:-0.125rem;bottom:-0.125rem;left:-0.125rem}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa::after{content:"";width:1.5rem;height:1.5rem;background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMS41cmVtIiB3aWR0aD0iMS41cmVtIiBmaWxsPSIjMDAwMDAwIiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOC4wOCA4YTEgMSAwIDAgMC0xLjA4LjkyTDE2LjA4IDIwSDcuOTJMNyA4LjkyYTEgMSAwIDEgMC0yIC4xNmwxIDEyQTEgMSAwIDAgMCA3IDIyaDEwYTEgMSAwIDAgMCAxLS45MmwxLTEyQTEgMSAwIDAgMCAxOC4wOCA4eiIvPjxwYXRoIGQ9Ik0xOSA1aC0zLjc3bC0uNjUtMi4yN2ExIDEgMCAwIDAtMS0uNzNoLTMuMmExIDEgMCAwIDAtMSAuNzNMOC43NyA1SDVhMSAxIDAgMCAwIDAgMmgxNGExIDEgMCAwIDAgMC0yem0tOC42Mi0yaDMuMjRsLjU3IDJIOS44MXpNMTIuNSAxOHYtOGEuNS41IDAgMCAwLTEgMHY4YS41LjUgMCAwIDAgMSAwek0xNC4yNSAxOC41YS41LjUgMCAwIDAgLjUtLjQ3bC41LThhLjUuNSAwIDAgMC0uNDctLjUzLjQ5LjQ5IDAgMCAwLS41My40N2wtLjUgOGEuNS41IDAgMCAwIC40Ny41M3pNOS43NSAxOC41YS41LjUgMCAwIDAgLjQ3LS41M2wtLjUtOGEuNDkuNDkgMCAwIDAtLjUzLS40Ny41LjUgMCAwIDAtLjQ3LjUzbC41IDhhLjUuNSAwIDAgMCAuNTMuNDd6Ii8+PC9zdmc+") no-repeat;background-size:1.5rem;display:block}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa:focus{outline:none}.mc-fileuploader__delete.svelte-1bhauwa.svelte-1bhauwa:focus::before{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #0b96cc;-webkit-box-shadow:0 0 0 0.125rem #0b96cc;box-shadow:0 0 0 0.125rem #0b96cc}')}function h(e,a,l){const i=e.slice();return i[15]=a[l],i[17]=l,i}function D(e){let a,l,i=e[3][e[15].errorType]+"";return{c(){a=s("div"),l=b(i),t(a,"class","mc-fileuploader__file-message svelte-1bhauwa")},m(e,i){o(e,a,i),d(a,l)},p(e,a){9&a&&i!==(i=e[3][e[15].errorType]+"")&&f(l,i)},d(e){e&&w(a)}}}function p(e){let a,l,i,r,n,c,u,g,x,h,p,I,A=e[15].name+"";function v(){return e[9](e[15])}let L=e[15].errorType&&D(e);return{c(){a=s("li"),l=s("span"),i=b(A),r=M(),n=s("span"),n.textContent=" ",c=M(),u=s("button"),g=M(),L&&L.c(),x=M(),t(l,"class","mc-fileuploader__file-name svelte-1bhauwa"),t(n,"class","mc-fileuploader__file-icon svelte-1bhauwa"),t(u,"type","button"),t(u,"class","mc-fileuploader__delete svelte-1bhauwa"),t(u,"aria-label",e[2]),u.disabled=e[1],t(a,"id",`file-${e[17]}`),t(a,"class",h=e[4](e[15])+" "+e[6].class+" svelte-1bhauwa")},m(e,s){o(e,a,s),d(a,l),d(l,i),d(a,r),d(a,n),d(a,c),d(a,u),d(a,g),L&&L.m(a,null),d(a,x),p||(I=m(u,"click",v),p=!0)},p(l,s){e=l,1&s&&A!==(A=e[15].name+"")&&f(i,A),4&s&&t(u,"aria-label",e[2]),2&s&&(u.disabled=e[1]),e[15].errorType?L?L.p(e,s):(L=D(e),L.c(),L.m(a,x)):L&&(L.d(1),L=null),65&s&&h!==(h=e[4](e[15])+" "+e[6].class+" svelte-1bhauwa")&&t(a,"class",h)},d(e){e&&w(a),L&&L.d(),p=!1,I()}}}function I(e){let a,l=e[0],i=[];for(let a=0;a<l.length;a+=1)i[a]=p(h(e,l,a));return{c(){a=s("ul");for(let e=0;e<i.length;e+=1)i[e].c();t(a,"id","file_uploaded"),t(a,"class","mc-fileuploader__files svelte-1bhauwa")},m(e,l){o(e,a,l);for(let e=0;e<i.length;e+=1)i[e]&&i[e].m(a,null)},p(e,[s]){if(127&s){let t;for(l=e[0],t=0;t<l.length;t+=1){const o=h(e,l,t);i[t]?i[t].p(o,s):(i[t]=p(o),i[t].c(),i[t].m(a,null))}for(;t<i.length;t+=1)i[t].d(1);i.length=l.length}},i:r,o:r,d(e){e&&w(a),n(i,e)}}}function A(e,a,l){let{allowedExtensions:i}=a,{maxSize:s}=a,{disabled:t=!1}=a,{files:o}=a,{removelabel:r="Remove"}=a,{errorLabels:w}=a,n=new g;function b(e){if(i&&i.length>0){const a=e.slice(2+(e.lastIndexOf(".")-1>>>0));if(i&&!i.includes(String(a)))return!1}return!0}function M(e){return!(s&&e/1024/1024>s)}function d(e){n.dispatch("file-removed",e)}return e.$$set=e=>{l(6,a=c(c({},a),u(e))),"allowedExtensions"in e&&l(8,i=e.allowedExtensions),"maxSize"in e&&l(7,s=e.maxSize),"disabled"in e&&l(1,t=e.disabled),"files"in e&&l(0,o=e.files),"removelabel"in e&&l(2,r=e.removelabel),"errorLabels"in e&&l(3,w=e.errorLabels)},e.$$.update=()=>{1&e.$$.dirty&&l(0,o=o?function(e){let a=[...e];return a.forEach(((e,a)=>{const l=b(e.name),i=M(e.size);let s="";l||(s="invalid-extension"),i||(s="invalid-size"),e.errorType&&(s=e.errorType),l&&i&&!e.errorType||(e.errorType=s)})),a}(o):[]),128&e.$$.dirty&&l(7,s=s||void 0)},a=u(a),[o,t,r,w,function(e){let a=["mc-fileuploader__file"];return!function(e){const a=!i||b(e.name),l=M(e.size);if(!a||!l)return!1;return!0}(e)||e.errorType?a.push("mc-fileuploader__file--is-invalid"):a.push("mc-fileuploader__file--is-valid"),a.join(" ")},d,a,s,i,e=>d(e)]}class v extends e{constructor(e){super(),a(this,e,A,I,l,{allowedExtensions:8,maxSize:7,disabled:1,files:0,removelabel:2,errorLabels:3},x)}}export{v as default};
2
2
  //# sourceMappingURL=ResultFile.nested.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultFile.nested.js","sources":["../../../../src/components/fileuploader/ResultFile.nested.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import { EventHandler } from '../../utilities/EventHandler';\n\n export let allowedExtensions: [];\n export let maxSize: number;\n export let disabled = false;\n export let files: FileList;\n export let removelabel = 'Remove';\n\n let eventHandler = new EventHandler();\n $: files = files ? (files as FileList) : [];\n $: maxSize = maxSize ? maxSize : undefined;\n\n function setClasses(file: File): string {\n let classes = ['mc-fileuploader__file'];\n\n if (checkFileStatus(file)) classes.push('mc-fileuploader__file--is-valid');\n else classes.push('mc-fileuploader__file--is-invalid');\n return classes.join(' ');\n }\n\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function checkFileStatus(file: File): boolean {\n const validExtension = allowedExtensions\n ? checkFileExtension(file.name)\n : true;\n const validSize = checkFileSize(file.size);\n\n if (!validExtension || !validSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n\n function deleteFile(file) {\n eventHandler.dispatch('file-removed', file);\n }\n</script>\n\n<ul id=\"file_uploaded\" class=\"mc-fileuploader__files\">\n {#each files as file, index}\n <li id={`file-${index}`} class=\"{setClasses(file)} {$$props.class}\">\n <span class=\"mc-fileuploader__file-name\">{file.name}</span>\n <span class=\"mc-fileuploader__file-icon\">&nbsp;</span>\n <button\n type=\"button\"\n class=\"mc-fileuploader__delete\"\n aria-label={removelabel}\n {disabled}\n on:click={() => deleteFile(file)}\n />\n </li>\n {/each}\n</ul>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.file-uploader';\n</style>\n"],"names":["t0_value","ctx","name","attr","li","li_class_value","class","insert","target","anchor","append","span0","span1","button","dirty","set_data","t0","length","i","ul","allowedExtensions","$$props","maxSize","disabled","files","removelabel","eventHandler","EventHandler","deleteFile","file","dispatch","$$invalidate","undefined","classes","validExtension","fileName","extension","slice","lastIndexOf","includes","String","checkFileExtension","validSize","fileSize","fileSizeMB","checkFileSize","size","checkFileStatus","push","join"],"mappings":"w7RAkEgDA,EAAAC,MAAKC,KAAI,uVAKrCD,EAAW,qCANXA,EAAK,OAAYE,EAAAC,EAAA,QAAAC,EAAAJ,EAAW,GAAAA,EAAQ,KAAA,IAAAA,KAAQK,MAAK,2BAAjEC,EAUIC,EAAAJ,EAAAK,GATFC,EAA0DN,EAAAO,iBAC1DD,EAAqDN,EAAAQ,UACrDF,EAMCN,EAAAS,iDARyC,EAAAC,GAAAd,KAAAA,EAAAC,MAAKC,KAAI,KAAAa,EAAAC,EAAAhB,yBAKrCC,EAAW,2BANM,GAAAa,GAAAT,KAAAA,EAAAJ,EAAW,GAAAA,EAAQ,KAAA,IAAAA,KAAQK,MAAK,kFAD5DL,EAAK,wBAAVgB,OAAIC,GAAA,oKADRX,EAcIC,EAAAW,EAAAV,mFAbKR,EAAK,WAAVgB,OAAIC,GAAA,EAAA,iHAAJD,+EA1DSG,GAAqBC,WACrBC,GAAeD,GACfE,SAAAA,GAAW,GAAKF,SAChBG,GAAeH,GACfI,YAAAA,EAAc,UAAQJ,EAE7BK,MAAmBC,EA8Cd,SAAAC,EAAWC,GAClBH,EAAaI,SAAS,eAAgBD,uQA9CrCE,EAAA,EAAAP,EAAQA,GAA2B,uBACnCF,EAAUA,QAAoBU,kBAExB,SAAWH,GACd,IAAAI,GAAW,gCA4BR,SAAgBJ,SACjBK,GAAiBd,GAtBhB,SAAmBe,GACtB,GAAAf,GAAqBA,EAAkBH,OAAS,EAAC,CAC7C,MAAAmB,EAAoBD,EAASE,MACS,GAAxCF,EAASG,YAAY,KAAO,IAAO,IAEnC,GAAAlB,IAAsBA,EAAkBmB,SAASC,OAAOJ,WACnD,SAIJ,EAaHK,CAAmBZ,EAAK3B,MAEtBwC,EAZC,SAAcC,GACf,MAAAC,EAAaD,EAAW,KAAO,QACjCrB,GAAWsB,EAAatB,SACnB,SAGF,EAMWuB,CAAchB,EAAKiB,MAEhC,IAAAZ,IAAmBQ,SACf,SAGF,EApCHK,CAAgBlB,GACfI,EAAQe,KAAK,qCADSf,EAAQe,KAAK,mCAEjCf,EAAQgB,KAAK,cAoDApB,GAAAD,EAAWC"}
1
+ {"version":3,"file":"ResultFile.nested.js","sources":["../../../../src/components/fileuploader/ResultFile.nested.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import { EventHandler } from '../../utilities/EventHandler';\n\n export let allowedExtensions: [];\n export let maxSize: number;\n export let disabled = false;\n export let files: FileList;\n export let removelabel = 'Remove';\n export let errorLabels;\n\n let eventHandler = new EventHandler();\n $: files = files ? handleChange(files) : [];\n $: maxSize = maxSize ? maxSize : undefined;\n\n function setClasses(file: File): string {\n let classes = ['mc-fileuploader__file'];\n\n if (checkFileStatus(file) && !file.errorType)\n classes.push('mc-fileuploader__file--is-valid');\n else classes.push('mc-fileuploader__file--is-invalid');\n return classes.join(' ');\n }\n\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function handleChange(myFiles: FileList): void {\n let files = [...myFiles];\n files.forEach((file, index) => {\n const validExtension = checkFileExtension(file.name);\n const validSize = checkFileSize(file.size);\n let errorType = '';\n if (!validExtension) {\n errorType = 'invalid-extension';\n }\n if (!validSize) {\n errorType = 'invalid-size';\n }\n if (file.errorType) {\n errorType = file.errorType;\n }\n if (!validExtension || !validSize || file.errorType) {\n file.errorType = errorType;\n }\n });\n return files;\n }\n\n function checkFileStatus(file: File): boolean {\n const validExtension = allowedExtensions\n ? checkFileExtension(file.name)\n : true;\n const validSize = checkFileSize(file.size);\n\n if (!validExtension || !validSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n\n function deleteFile(file) {\n eventHandler.dispatch('file-removed', file);\n }\n</script>\n\n<ul id=\"file_uploaded\" class=\"mc-fileuploader__files\">\n {#each files as file, index}\n <li id={`file-${index}`} class=\"{setClasses(file)} {$$props.class}\">\n <span class=\"mc-fileuploader__file-name\">{file.name}</span>\n <span class=\"mc-fileuploader__file-icon\">&nbsp;</span>\n <button\n type=\"button\"\n class=\"mc-fileuploader__delete\"\n aria-label={removelabel}\n {disabled}\n on:click={() => deleteFile(file)}\n />\n {#if file.errorType}\n <div class=\"mc-fileuploader__file-message\">\n {errorLabels[file.errorType]}\n </div>\n {/if}\n </li>\n {/each}\n</ul>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.file-uploader';\n</style>\n"],"names":["ctx","errorType","insert","target","div","anchor","set_data","t","t_value","t0_value","name","if_block","create_if_block","attr","li","li_class_value","class","append","span0","span1","button","dirty","t0","length","i","ul","allowedExtensions","$$props","maxSize","disabled","files","removelabel","errorLabels","eventHandler","EventHandler","checkFileExtension","fileName","extension","slice","lastIndexOf","includes","String","checkFileSize","fileSize","deleteFile","file","dispatch","myFiles","forEach","index","validExtension","validSize","size","handleChange","undefined","classes","checkFileStatus","push","join"],"mappings":"spSAqGWA,EAAW,GAACA,EAAI,IAACC,WAAS,oGAD7BC,EAEKC,EAAAC,EAAAC,8BADFL,EAAW,GAACA,EAAI,IAACC,WAAS,KAAAK,EAAAC,EAAAC,6DAXWC,EAAAT,MAAKU,KAAI,mCAS9C,IAAAC,EAAAX,MAAKC,WAASW,EAAAZ,sUAJLA,EAAW,qCANXA,EAAK,OAAYa,EAAAC,EAAA,QAAAC,EAAAf,EAAW,GAAAA,EAAQ,KAAA,IAAAA,KAAQgB,MAAK,2BAAjEd,EAeIC,EAAAW,EAAAT,GAdFY,EAA0DH,EAAAI,iBAC1DD,EAAqDH,EAAAK,UACrDF,EAMCH,EAAAM,uEARyC,EAAAC,GAAAZ,KAAAA,EAAAT,MAAKU,KAAI,KAAAJ,EAAAgB,EAAAb,yBAKrCT,EAAW,2BAIpBA,MAAKC,gEAVqB,GAAAoB,GAAAN,KAAAA,EAAAf,EAAW,GAAAA,EAAQ,KAAA,IAAAA,KAAQgB,MAAK,2FAD5DhB,EAAK,wBAAVuB,OAAIC,GAAA,oKADRtB,EAmBIC,EAAAsB,EAAApB,oFAlBKL,EAAK,WAAVuB,OAAIC,GAAA,EAAA,iHAAJD,+EAlFSG,GAAqBC,WACrBC,GAAeD,GACfE,SAAAA,GAAW,GAAKF,SAChBG,GAAeH,GACfI,YAAAA,EAAc,UAAQJ,eACtBK,GAAWL,EAElBM,MAAmBC,EAad,SAAAC,EAAmBC,GACtB,GAAAV,GAAqBA,EAAkBH,OAAS,EAAC,CAC7C,MAAAc,EAAoBD,EAASE,MACS,GAAxCF,EAASG,YAAY,KAAO,IAAO,IAEnC,GAAAb,IAAsBA,EAAkBc,SAASC,OAAOJ,WACnD,SAIJ,EAGA,SAAAK,EAAcC,WAEjBf,GADee,EAAW,KAAO,KACTf,GAyCrB,SAAAgB,EAAWC,GAClBZ,EAAaa,SAAS,eAAgBD,mTArErCf,EAAQA,EAiCF,SAAaiB,GAChB,IAAAjB,MAAYiB,UAChBjB,EAAMkB,SAAS,CAAAH,EAAMI,KACb,MAAAC,EAAiBf,EAAmBU,EAAKnC,MACzCyC,EAAYT,EAAcG,EAAKO,MACjC,IAAAnD,EAAY,GACXiD,IACHjD,EAAY,qBAETkD,IACHlD,EAAY,gBAEV4C,EAAK5C,YACPA,EAAY4C,EAAK5C,WAEdiD,GAAmBC,IAAaN,EAAK5C,YACxC4C,EAAK5C,UAAYA,MAGd6B,EApDUuB,CAAavB,GAAK,wBAClCF,EAAUA,QAAoB0B,oBAExB,SAAWT,GACd,IAAAU,GAAW,gCAmDR,SAAgBV,SACjBK,GAAiBxB,GACnBS,EAAmBU,EAAKnC,MAEtByC,EAAYT,EAAcG,EAAKO,MAEhC,IAAAF,IAAmBC,SACf,SAGF,EA3DHK,CAAgBX,IAAUA,EAAK5C,UAE9BsD,EAAQE,KAAK,qCADhBF,EAAQE,KAAK,mCAERF,EAAQG,KAAK,cA0EAb,GAAAD,EAAWC"}
@@ -9,15 +9,17 @@
9
9
  export let disabled = false;
10
10
  export let files: FileList;
11
11
  export let removelabel = 'Remove';
12
+ export let errorLabels;
12
13
 
13
14
  let eventHandler = new EventHandler();
14
- $: files = files ? (files as FileList) : [];
15
+ $: files = files ? handleChange(files) : [];
15
16
  $: maxSize = maxSize ? maxSize : undefined;
16
17
 
17
18
  function setClasses(file: File): string {
18
19
  let classes = ['mc-fileuploader__file'];
19
20
 
20
- if (checkFileStatus(file)) classes.push('mc-fileuploader__file--is-valid');
21
+ if (checkFileStatus(file) && !file.errorType)
22
+ classes.push('mc-fileuploader__file--is-valid');
21
23
  else classes.push('mc-fileuploader__file--is-invalid');
22
24
  return classes.join(' ');
23
25
  }
@@ -43,6 +45,28 @@
43
45
 
44
46
  return true; // valid
45
47
  }
48
+ function handleChange(myFiles: FileList): void {
49
+ let files = [...myFiles];
50
+ files.forEach((file, index) => {
51
+ const validExtension = checkFileExtension(file.name);
52
+ const validSize = checkFileSize(file.size);
53
+ let errorType = '';
54
+ if (!validExtension) {
55
+ errorType = 'invalid-extension';
56
+ }
57
+ if (!validSize) {
58
+ errorType = 'invalid-size';
59
+ }
60
+ if (file.errorType) {
61
+ errorType = file.errorType;
62
+ }
63
+ if (!validExtension || !validSize || file.errorType) {
64
+ file.errorType = errorType;
65
+ }
66
+ });
67
+ return files;
68
+ }
69
+
46
70
  function checkFileStatus(file: File): boolean {
47
71
  const validExtension = allowedExtensions
48
72
  ? checkFileExtension(file.name)
@@ -73,6 +97,11 @@
73
97
  {disabled}
74
98
  on:click={() => deleteFile(file)}
75
99
  />
100
+ {#if file.errorType}
101
+ <div class="mc-fileuploader__file-message">
102
+ {errorLabels[file.errorType]}
103
+ </div>
104
+ {/if}
76
105
  </li>
77
106
  {/each}
78
107
  </ul>