@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
@@ -1,2 +1,2 @@
1
- import{r as t,c as o,h as r,g as s}from"./p-3075aa67.js";import{t as i}from"./p-3ee3dcdc.js";import{c as e}from"./p-3ccdc4a3.js";import{M as n}from"./p-1c284626.js";import"./p-48d4ef20.js";import"./p-cbc43682.js";import"./p-dcc97cc2.js";import"./p-d0a7de87.js";const c="file";const a="tear_off_calendar";const l="email";const h="internet";const p="text_box";const d="ms_excel_copyrighted";const g="ms_word_copyrighted";const m="ms_powerpoint_copyrighted";const v="picture";const b="camera";const f="vector";const u="presentation_filled";const x="overview_pages_2";const k="data_sheet";const y="audio_wave";const _="video_file";const w="condom_package";const j="ms_outlook_copyrighted";const z="database";const C={msg:j,ics:a,ical:a,icalendar:a,ifb:a,email:l,eml:l,oft:l,ost:l,emlx:l,html:h,xml:h,txt:p,rtf:p,dot:g,doc:g,docx:g,dotx:g,docm:g,dotm:g,odt:x,pages:x,pdf:"PDF_2",ppt:m,pot:m,pps:m,pptx:m,pptm:m,potx:m,potm:m,ppam:m,ppsx:m,ppsm:m,sldx:m,sldm:m,odp:u,key:u,xls:d,xlsx:d,csv:k,numbers:k,jpg:b,jpeg:b,heic:b,bmp:v,png:v,gif:v,psd:"adobe_photoshop_copyrighted",ai:"adobe_illustrator_copyrighted",svg:f,svgz:f,ep:f,eps:f,sketch:f,mp3:y,wav:y,wma:y,ogg:y,avi:_,flv:_,h264:_,mov:_,mp4:_,mwv:_,zip:w,"7z":w,rar:w,json:"json",yaml:z,sql:z,db:z,dbf:z};function D(t){return C[t.toLowerCase()]||c}const F="rgb(var(--color-gray-dark))";const q="rgb(var(--color-cyan-dark))";const K="rgb(var(--color-gray-dark))";const T="rgb(var(--color-blue-dark))";const E="rgb(var(--color-yellow-darker))";const I="rgb(var(--color-green-dark))";const O="rgb(var(--color-coral-dark))";const S="rgb(var(--color-sky-dark))";const A="rgb(var(--color-lime-dark))";const B="rgb(var(--color-magenta-dark))";const L="rgb(var(--color-blue-dark))";const U="rgb(var(--color-orange-dark))";const M="rgb(var(--color-green-dark))";const P="rgb(var(--color-indigo-dark))";const $="rgb(var(--color-red-dark))";const G="rgb(var(--color-brown-default))";const H="rgb(var(--color-yellow-dark))";const J="rgb(var(--color-red-dark))";const N="rgb(var(--color-glaucous-dark))";const Q={msg:H,ics:q,ical:q,icalendar:q,ifb:q,email:K,eml:K,oft:K,ost:K,emlx:K,html:T,xml:T,txt:E,rtf:E,dot:S,doc:S,docx:S,dotx:S,docm:S,dotm:S,odt:U,pages:U,pdf:J,ppt:O,pot:O,pps:O,pptx:O,pptm:O,potx:O,potm:O,ppam:O,ppsx:O,ppsm:O,sldx:O,sldm:O,odp:L,key:L,xls:I,xlsx:I,csv:F,numbers:M,bmp:A,jpg:A,jpeg:A,heic:A,png:A,gif:A,psd:L,ai:U,svg:B,svgz:B,ep:B,eps:B,sketch:B,mp3:P,wav:P,wma:P,ogg:P,flv:$,h264:$,mov:$,mp4:$,mwv:$,zip:G,"7z":G,rar:G,json:N,yaml:N,sql:N,db:N,dbf:N};function R(t){return Q[t.toLowerCase()]||F}const V="rgba(var(--color-gray-lighter), 0.4)";const W="rgba(var(--color-cyan-lighter), 0.4)";const X="rgba(var(--color-gray-lighter), 0.4)";const Y="rgba(var(--color-blue-lighter), 0.4)";const Z="rgba(var(--color-yellow-lighter), 0.4)";const tt="rgba(var(--color-green-lighter), 0.4)";const ot="rgba(var(--color-coral-lighter), 0.4)";const rt="rgba(var(--color-sky-lighter), 0.4)";const st="rgba(var(--color-lime-lighter), 0.4)";const it="rgba(var(--color-magenta-lighter), 0.4)";const et="rgba(var(--color-blue-lighter), 0.4)";const nt="rgba(var(--color-orange-lighter), 0.4)";const ct="rgba(var(--color-green-lighter), 0.4)";const at="rgba(var(--color-indigo-lighter), 0.4)";const lt="rgba(var(--color-red-lighter), 0.4)";const ht="rgba(var(--color-orange-lighter), 0.4)";const pt="rgba(var(--color-yellow-lighter), 0.4)";const dt="rgba(var(--color-red-lighter), 0.4)";const gt="rgba(var(--color-glaucous-lighter), 0.4)";const mt={msg:pt,ics:W,ical:W,icalendar:W,ifb:W,email:X,eml:X,oft:X,ost:X,emlx:X,html:Y,xml:Y,txt:Z,rtf:Z,dot:rt,doc:rt,docx:rt,dotx:rt,docm:rt,dotm:rt,odt:nt,pages:nt,pdf:dt,ppt:ot,pot:ot,pps:ot,pptx:ot,pptm:ot,potx:ot,potm:ot,ppam:ot,ppsx:ot,ppsm:ot,sldx:ot,sldm:ot,odp:et,key:et,xls:tt,xlsx:tt,csv:V,numbers:ct,bmp:st,jpg:st,jpeg:st,heic:st,png:st,gif:st,psd:et,ai:nt,svg:it,svgz:it,ep:it,eps:it,sketch:it,mp3:at,wav:at,wma:at,ogg:at,flv:lt,h264:lt,mov:lt,mp4:lt,mwv:lt,zip:ht,"7z":ht,rar:ht,json:gt,yaml:gt,sql:gt,db:gt,dbf:gt};function vt(t){return mt[t.toLowerCase()]||V}function bt(t){if(t===null||t===void 0?void 0:t.icon){return t.icon}const o=kt(t);if(!o){return}return D(o)}function ft(t){if(t===null||t===void 0?void 0:t.iconColor){return t.iconColor}const o=kt(t);if(!o){return}return R(o)}function ut(t){if(t===null||t===void 0?void 0:t.iconBackgroundColor){return t.iconBackgroundColor}const o=kt(t);if(!o){return}return vt(o)}function xt(t){if(t===null||t===void 0?void 0:t.icon){return t.icon}return kt(t)}function kt(t){if(!t){return}return t.filename.split(".").pop()}const yt=":host{--icon-background-color:rgb(var(--contrast-400));--icon-color:rgb(var(--contrast-1100))}";const _t="limel-chip-set";const wt={id:null,text:null,removable:true};const jt=class{constructor(r){t(this,r);this.change=o(this,"change",7);this.interact=o(this,"interact",7);this.fileInputId=e();this.handleDragEnter=t=>{this.isDraggingOverDropZone=true;this.preventAndStop(t)};this.handleDragLeave=()=>{this.isDraggingOverDropZone=false};this.handleFileDrop=t=>{this.preventAndStop(t);this.isDraggingOverDropZone=false;const o=t.dataTransfer;this.handleFile(o.files[0])};this.value=undefined;this.label=undefined;this.required=false;this.disabled=false;this.readonly=false;this.accept="*";this.language="en";this.isDraggingOverDropZone=false;this.handleFileSelection=this.handleFileSelection.bind(this);this.handleFileChange=this.handleFileChange.bind(this);this.handleChipSetChange=this.handleChipSetChange.bind(this);this.handleFileDrop=this.handleFileDrop.bind(this);this.handleKeyDown=this.handleKeyDown.bind(this);this.handleKeyUp=this.handleKeyUp.bind(this);this.handleChipInteract=this.handleChipInteract.bind(this)}connectedCallback(){this.initialize()}componentDidLoad(){this.fileInput=this.element.shadowRoot.getElementById(this.fileInputId);this.chipSet=this.element.shadowRoot.querySelector(_t);this.initialize()}initialize(){if(!this.chipSet){return}this.mdcTextField=new n(this.chipSet.shadowRoot.querySelector(".mdc-text-field"))}disconnectedCallback(){if(this.mdcTextField){this.mdcTextField.destroy()}}render(){return[r("input",{hidden:true,id:this.fileInputId,onChange:this.handleFileChange,type:"file",accept:this.accept,disabled:this.disabled||this.readonly}),r("limel-chip-set",{class:{"is-file-picker":true,"shows-dropzone":true,"highlight-dropzone":this.isDraggingOverDropZone},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})]}get chipArray(){if(!this.value){return[]}return[Object.assign(Object.assign({},wt),{text:this.value.filename,id:this.value.id,icon:bt(this.value),iconFillColor:ft(this.value),iconBackgroundColor:ut(this.value),href:this.value.href,iconTitle:xt(this.value)})]}handleKeyDown(t){if(t.code==="Tab"||t.code==="Backspace"||t.code==="Enter"){return}t.preventDefault();t.stopPropagation()}handleKeyUp(t){if(t.code==="Enter"&&!this.value){this.fileInput.click()}}handleFileSelection(t){t.stopPropagation();t.preventDefault();if(!this.value){this.fileInput.click()}}handleFileChange(t){if(this.fileInput.files.length>0){t.stopPropagation();this.handleFile(this.fileInput.files[0])}}handleFile(t){const o={id:e(),filename:t.name,contentType:t.type,size:t.size,fileContent:t};this.change.emit(o);this.chipSet.blur();this.mdcTextField.valid=true}handleChipSetChange(t){t.stopPropagation();const o=!t.detail.length?t.detail[0]:null;this.chipSet.blur();if(!o){this.fileInput.value="";this.change.emit(o);if(this.required){this.mdcTextField.valid=false}}}handleChipInteract(t){t.stopPropagation();t.preventDefault();this.interact.emit(t.detail.id)}preventAndStop(t){t.stopPropagation();t.preventDefault()}getTranslation(t){return i.get(`file.${t}`,this.language)}get element(){return s(this)}};jt.style=yt;export{jt as limel_file};
2
- //# sourceMappingURL=p-8eff47a6.entry.js.map
1
+ import{r as t,c as o,h as r,g as s}from"./p-3075aa67.js";import{t as i}from"./p-3ee3dcdc.js";import{c as e}from"./p-3ccdc4a3.js";import{M as n}from"./p-1c284626.js";import"./p-48d4ef20.js";import"./p-cbc43682.js";import"./p-dcc97cc2.js";import"./p-d0a7de87.js";const a="file";const c="tear_off_calendar";const l="email";const h="internet";const p="text_box";const d="ms_excel_copyrighted";const g="ms_word_copyrighted";const m="ms_powerpoint_copyrighted";const v="picture";const b="camera";const f="vector";const u="presentation_filled";const x="overview_pages_2";const k="data_sheet";const y="audio_wave";const _="video_file";const w="condom_package";const j="ms_outlook_copyrighted";const z="database";const C={msg:j,ics:c,ical:c,icalendar:c,ifb:c,email:l,eml:l,oft:l,ost:l,emlx:l,html:h,xml:h,txt:p,rtf:p,dot:g,doc:g,docx:g,dotx:g,docm:g,dotm:g,odt:x,pages:x,pdf:"PDF_2",ppt:m,pot:m,pps:m,pptx:m,pptm:m,potx:m,potm:m,ppam:m,ppsx:m,ppsm:m,sldx:m,sldm:m,odp:u,key:u,xls:d,xlsx:d,csv:k,numbers:k,jpg:b,jpeg:b,heic:b,bmp:v,png:v,gif:v,psd:"adobe_photoshop_copyrighted",ai:"adobe_illustrator_copyrighted",svg:f,svgz:f,ep:f,eps:f,sketch:f,mp3:y,wav:y,wma:y,ogg:y,avi:_,flv:_,h264:_,mov:_,mp4:_,mwv:_,zip:w,"7z":w,rar:w,json:"json",yaml:z,sql:z,db:z,dbf:z};function D(t){return C[t.toLowerCase()]||a}const F="rgb(var(--color-gray-dark))";const q="rgb(var(--color-cyan-dark))";const K="rgb(var(--color-gray-dark))";const T="rgb(var(--color-blue-dark))";const E="rgb(var(--color-yellow-darker))";const I="rgb(var(--color-green-dark))";const O="rgb(var(--color-coral-dark))";const S="rgb(var(--color-sky-dark))";const A="rgb(var(--color-lime-dark))";const B="rgb(var(--color-magenta-dark))";const L="rgb(var(--color-blue-dark))";const U="rgb(var(--color-orange-dark))";const M="rgb(var(--color-green-dark))";const P="rgb(var(--color-indigo-dark))";const $="rgb(var(--color-red-dark))";const G="rgb(var(--color-brown-default))";const H="rgb(var(--color-yellow-dark))";const J="rgb(var(--color-red-dark))";const N="rgb(var(--color-glaucous-dark))";const Q={msg:H,ics:q,ical:q,icalendar:q,ifb:q,email:K,eml:K,oft:K,ost:K,emlx:K,html:T,xml:T,txt:E,rtf:E,dot:S,doc:S,docx:S,dotx:S,docm:S,dotm:S,odt:U,pages:U,pdf:J,ppt:O,pot:O,pps:O,pptx:O,pptm:O,potx:O,potm:O,ppam:O,ppsx:O,ppsm:O,sldx:O,sldm:O,odp:L,key:L,xls:I,xlsx:I,csv:F,numbers:M,bmp:A,jpg:A,jpeg:A,heic:A,png:A,gif:A,psd:L,ai:U,svg:B,svgz:B,ep:B,eps:B,sketch:B,mp3:P,wav:P,wma:P,ogg:P,flv:$,h264:$,mov:$,mp4:$,mwv:$,zip:G,"7z":G,rar:G,json:N,yaml:N,sql:N,db:N,dbf:N};function R(t){return Q[t.toLowerCase()]||F}const V="rgba(var(--color-gray-lighter), 0.4)";const W="rgba(var(--color-cyan-lighter), 0.4)";const X="rgba(var(--color-gray-lighter), 0.4)";const Y="rgba(var(--color-blue-lighter), 0.4)";const Z="rgba(var(--color-yellow-lighter), 0.4)";const tt="rgba(var(--color-green-lighter), 0.4)";const ot="rgba(var(--color-coral-lighter), 0.4)";const rt="rgba(var(--color-sky-lighter), 0.4)";const st="rgba(var(--color-lime-lighter), 0.4)";const it="rgba(var(--color-magenta-lighter), 0.4)";const et="rgba(var(--color-blue-lighter), 0.4)";const nt="rgba(var(--color-orange-lighter), 0.4)";const at="rgba(var(--color-green-lighter), 0.4)";const ct="rgba(var(--color-indigo-lighter), 0.4)";const lt="rgba(var(--color-red-lighter), 0.4)";const ht="rgba(var(--color-orange-lighter), 0.4)";const pt="rgba(var(--color-yellow-lighter), 0.4)";const dt="rgba(var(--color-red-lighter), 0.4)";const gt="rgba(var(--color-glaucous-lighter), 0.4)";const mt={msg:pt,ics:W,ical:W,icalendar:W,ifb:W,email:X,eml:X,oft:X,ost:X,emlx:X,html:Y,xml:Y,txt:Z,rtf:Z,dot:rt,doc:rt,docx:rt,dotx:rt,docm:rt,dotm:rt,odt:nt,pages:nt,pdf:dt,ppt:ot,pot:ot,pps:ot,pptx:ot,pptm:ot,potx:ot,potm:ot,ppam:ot,ppsx:ot,ppsm:ot,sldx:ot,sldm:ot,odp:et,key:et,xls:tt,xlsx:tt,csv:V,numbers:at,bmp:st,jpg:st,jpeg:st,heic:st,png:st,gif:st,psd:et,ai:nt,svg:it,svgz:it,ep:it,eps:it,sketch:it,mp3:ct,wav:ct,wma:ct,ogg:ct,flv:lt,h264:lt,mov:lt,mp4:lt,mwv:lt,zip:ht,"7z":ht,rar:ht,json:gt,yaml:gt,sql:gt,db:gt,dbf:gt};function vt(t){return mt[t.toLowerCase()]||V}function bt(t){if(t===null||t===void 0?void 0:t.icon){return t.icon}const o=kt(t);if(!o){return}return D(o)}function ft(t){if(t===null||t===void 0?void 0:t.iconColor){return t.iconColor}const o=kt(t);if(!o){return}return R(o)}function ut(t){if(t===null||t===void 0?void 0:t.iconBackgroundColor){return t.iconBackgroundColor}const o=kt(t);if(!o){return}return vt(o)}function xt(t){if(t===null||t===void 0?void 0:t.icon){return t.icon}return kt(t)}function kt(t){if(!t){return}return t.filename.split(".").pop()}const yt=":host{--icon-background-color:rgb(var(--contrast-400));--icon-color:rgb(var(--contrast-1100))}";const _t="limel-chip-set";const wt={id:null,text:null,removable:true};const jt=class{constructor(r){t(this,r);this.change=o(this,"change",7);this.interact=o(this,"interact",7);this.fileInputId=e();this.handleDragEnter=t=>{this.isDraggingOverDropZone=true;this.preventAndStop(t)};this.handleDragLeave=()=>{this.isDraggingOverDropZone=false};this.handleFileDrop=t=>{this.preventAndStop(t);this.isDraggingOverDropZone=false;const o=t.dataTransfer;this.handleFile(o.files[0])};this.value=undefined;this.label=undefined;this.required=false;this.disabled=false;this.readonly=false;this.invalid=false;this.accept="*";this.language="en";this.isDraggingOverDropZone=false;this.handleFileSelection=this.handleFileSelection.bind(this);this.handleFileChange=this.handleFileChange.bind(this);this.handleChipSetChange=this.handleChipSetChange.bind(this);this.handleFileDrop=this.handleFileDrop.bind(this);this.handleKeyDown=this.handleKeyDown.bind(this);this.handleKeyUp=this.handleKeyUp.bind(this);this.handleChipInteract=this.handleChipInteract.bind(this)}connectedCallback(){this.initialize()}componentDidLoad(){this.fileInput=this.element.shadowRoot.getElementById(this.fileInputId);this.chipSet=this.element.shadowRoot.querySelector(_t);this.initialize()}initialize(){if(!this.chipSet){return}this.mdcTextField=new n(this.chipSet.shadowRoot.querySelector(".mdc-text-field"))}disconnectedCallback(){if(this.mdcTextField){this.mdcTextField.destroy()}}render(){return[r("input",{hidden:true,id:this.fileInputId,onChange:this.handleFileChange,type:"file",accept:this.accept,disabled:this.disabled||this.readonly}),r("limel-chip-set",{class:{"is-file-picker":true,"shows-dropzone":true,"highlight-dropzone":this.isDraggingOverDropZone},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})]}get chipArray(){if(!this.value){return[]}return[Object.assign(Object.assign({},wt),{text:this.value.filename,id:this.value.id,icon:bt(this.value),iconFillColor:ft(this.value),iconBackgroundColor:ut(this.value),href:this.value.href,iconTitle:xt(this.value)})]}handleKeyDown(t){if(t.code==="Tab"||t.code==="Backspace"||t.code==="Enter"){return}t.preventDefault();t.stopPropagation()}handleKeyUp(t){if(t.code==="Enter"&&!this.value){this.fileInput.click()}}handleFileSelection(t){t.stopPropagation();t.preventDefault();if(!this.value){this.fileInput.click()}}handleFileChange(t){if(this.fileInput.files.length>0){t.stopPropagation();this.handleFile(this.fileInput.files[0])}}handleFile(t){const o={id:e(),filename:t.name,contentType:t.type,size:t.size,fileContent:t};this.change.emit(o);this.chipSet.blur();this.mdcTextField.valid=true}handleChipSetChange(t){t.stopPropagation();const o=!t.detail.length?t.detail[0]:null;this.chipSet.blur();if(!o){this.fileInput.value="";this.change.emit(o);if(this.required){this.mdcTextField.valid=false}}}handleChipInteract(t){t.stopPropagation();t.preventDefault();this.interact.emit(t.detail.id)}preventAndStop(t){t.stopPropagation();t.preventDefault()}getTranslation(t){return i.get(`file.${t}`,this.language)}get element(){return s(this)}};jt.style=yt;export{jt as limel_file};
2
+ //# sourceMappingURL=p-71802c27.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_ICON","CALENDAR_ICON","EMAIL_ICON","HTML_ICON","TEXT_ICON","EXCEL_ICON","WORD_ICON","POWERPOINT_ICON","IMAGE_ICON","PHOTO_ICON","VECTOR_GRAPHIC_ICON","PRESENTATION_ICON","DOCUMENT_ICON","SPREADSHEET_ICON","AUDIO_ICON","VIDEO_ICON","COMPRESSED_ICON","MESSAGE_ICON","DATA_ICON","filetypeIconTable","msg","ics","ical","icalendar","ifb","email","eml","oft","ost","emlx","html","xml","txt","rtf","dot","doc","docx","dotx","docm","dotm","odt","pages","pdf","ppt","pot","pps","pptx","pptm","potx","potm","ppam","ppsx","ppsm","sldx","sldm","odp","key","xls","xlsx","csv","numbers","jpg","jpeg","heic","bmp","png","gif","psd","ai","svg","svgz","ep","eps","sketch","mp3","wav","wma","ogg","avi","flv","h264","mov","mp4","mwv","zip","rar","json","yaml","sql","db","dbf","getIconForFile","extension","toLowerCase","DEFAULT_ICON_FILL_COLOR","CALENDAR_ICON_FILL_COLOR","EMAIL_ICON_FILL_COLOR","HTML_ICON_FILL_COLOR","TEXT_ICON_FILL_COLOR","EXCEL_ICON_FILL_COLOR","POWERPOINT_ICON_FILL_COLOR","WORD_ICON_FILL_COLOR","IMAGE_ICON_FILL_COLOR","VECTOR_GRAPHIC_FILL_COLOR","PRESENTATION_ICON_FILL_COLOR","DOCUMENT_ICON_FILL_COLOR","SPREADSHEET_ICON_FILL_COLOR","AUDIO_ICON_FILL_COLOR","VIDEO_ICON_FILL_COLOR","COMPRESSED_ICON_FILL_COLOR","MESSAGE_ICON_FILL_COLOR","PDF_ICON_FILL_COLOR","DATA_ICON_FILL_COLOR","filetypeFillColorTable","getIconFillColorForFile","DEFAULT_ICON_BACKGROUND_COLOR","CALENDAR_ICON_BACKGROUND_COLOR","EMAIL_ICON_BACKGROUND_COLOR","HTML_ICON_BACKGROUND_COLOR","TEXT_ICON_BACKGROUND_COLOR","EXCEL_ICON_BACKGROUND_COLOR","POWERPOINT_ICON_BACKGROUND_COLOR","WORD_ICON_BACKGROUND_COLOR","IMAGE_ICON_BACKGROUND_COLOR","VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR","PRESENTATION_BACKGROUND_COLOR","DOCUMENT_ICON_BACKGROUND_COLOR","SPREADSHEET_ICON_BACKGROUND_COLOR","AUDIO_ICON_BACKGROUND_COLOR","VIDEO_ICON_BACKGROUND_COLOR","COMPRESSED_ICON_BACKGROUND_COLOR","MESSAGE_ICON_BACKGROUND_COLOR","PDF_ICON_BACKGROUND_COLOR","DATA_ICON_BACKGROUND_COLOR","filetypeBackgroundColorTable","getIconBackgroundColorForFile","getFileIcon","file","icon","getExtension","getFileColor","iconColor","getFileBackgroundColor","iconBackgroundColor","getFileExtensionTitle","filename","split","pop","fileCss","CHIP_SET_TAG_NAME","DEFAULT_FILE_CHIP","id","text","removable","File","constructor","hostRef","this","fileInputId","createRandomString","handleDragEnter","event","isDraggingOverDropZone","preventAndStop","handleDragLeave","handleFileDrop","dataTransfer","handleFile","files","handleFileSelection","bind","handleFileChange","handleChipSetChange","handleKeyDown","handleKeyUp","handleChipInteract","connectedCallback","initialize","componentDidLoad","fileInput","element","shadowRoot","getElementById","chipSet","querySelector","mdcTextField","MDCTextField","disconnectedCallback","destroy","render","h","hidden","onChange","type","accept","disabled","readonly","class","invalid","label","leadingIcon","language","onClick","onInteract","onKeyDown","onKeyUp","required","value","chipArray","title","getTranslation","onDragEnter","onDragOver","onDragLeave","onDrop","iconFillColor","href","iconTitle","code","preventDefault","stopPropagation","click","length","limeFile","name","contentType","size","fileContent","change","emit","blur","valid","detail","interact","translate","get"],"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"],"mappings":"qQAAA,MAAMA,EAAe,OACrB,MAAMC,EAAgB,oBACtB,MAAMC,EAAa,QACnB,MAAMC,EAAY,WAClB,MAAMC,EAAY,WAClB,MAAMC,EAAa,uBACnB,MAAMC,EAAY,sBAClB,MAAMC,EAAkB,4BACxB,MAAMC,EAAa,UACnB,MAAMC,EAAa,SACnB,MAAMC,EAAsB,SAC5B,MAAMC,EAAoB,sBAC1B,MAAMC,EAAgB,mBACtB,MAAMC,EAAmB,aACzB,MAAMC,EAAa,aACnB,MAAMC,EAAa,aACnB,MAAMC,EAAkB,iBACxB,MAAMC,EAAe,yBACrB,MAAMC,EAAY,WAElB,MAAMC,EAA4C,CAE9CC,IAAKH,EAGLI,IAAKpB,EACLqB,KAAMrB,EACNsB,UAAWtB,EACXuB,IAAKvB,EAGLwB,MAAOvB,EACPwB,IAAKxB,EACLyB,IAAKzB,EACL0B,IAAK1B,EACL2B,KAAM3B,EAGN4B,KAAM3B,EACN4B,IAAK5B,EAGL6B,IAAK5B,EACL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IA,EAAMyD,OAAS,UAAY7D,KAAKkD,MAAO,CACvClD,KAAKsB,UAAU0C,O,EAIfpD,oBAAoBR,GACxBA,EAAM2D,kBACN3D,EAAM0D,iBACN,IAAK9D,KAAKkD,MAAO,CACblD,KAAKsB,UAAU0C,O,EAIflD,iBAAiBV,GACrB,GAAIJ,KAAKsB,UAAUX,MAAMsD,OAAS,EAAG,CACjC7D,EAAM2D,kBACN/D,KAAKU,WAAWV,KAAKsB,UAAUX,MAAM,G,EAIrCD,WAAW9B,GACf,MAAMsF,EAAqB,CACvBxE,GAAIQ,IACJd,SAAUR,EAAKuF,KACfC,YAAaxF,EAAKwD,KAClBiC,KAAMzF,EAAKyF,KACXC,YAAa1F,GAEjBoB,KAAKuE,OAAOC,KAAKN,GACjBlE,KAAK0B,QAAQ+C,OACbzE,KAAK4B,aAAa8C,MAAQ,I,CAGtB3D,oBAAoBX,GACxBA,EAAM2D,kBACN,MAAMnF,GAAQwB,EAAMuE,OAAOV,OAAS7D,EAAMuE,OAAO,GAAK,KACtD3E,KAAK0B,QAAQ+C,OACb,IAAK7F,EAAM,CACPoB,KAAKsB,UAAU4B,MAAQ,GACvBlD,KAAKuE,OAAOC,KAAK5F,GACjB,GAAIoB,KAAKiD,SAAU,CACfjD,KAAK4B,aAAa8C,MAAQ,K,GAK9BxD,mBAAmBd,GACvBA,EAAM2D,kBACN3D,EAAM0D,iBACN9D,KAAK4E,SAASJ,KAAKpE,EAAMuE,OAAOjF,G,CAG5BY,eAAeF,GACnBA,EAAM2D,kBACN3D,EAAM0D,gB,CAGFT,eAAe1J,GACnB,OAAOkL,EAAUC,IAAI,QAAQnL,IAAOqG,KAAK4C,S"}
@@ -0,0 +1,16 @@
1
+ import{r as t,c as i,h as s,g as e}from"./p-3075aa67.js";import{i as n}from"./p-5f020b3c.js";import{T as r,E as h,a as o,b as a,c as l,d as u,A as c,e as f,f as d,g as p}from"./p-d7801e00.js";import{c as v}from"./p-3ccdc4a3.js";var m=function t(i){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var n=void 0;var r=void 0;var h=void 0;var o=[];return function t(){var l=y(s);var u=(new Date).getTime();var c=!n||u-n>l;n=u;for(var f=arguments.length,d=Array(f),p=0;p<f;p++){d[p]=arguments[p]}if(c&&e.leading){return e.accumulate?Promise.resolve(i.call(this,[d])).then((function(t){return t[0]})):Promise.resolve(i.call.apply(i,[this].concat(d)))}if(r){clearTimeout(h)}else{r=g()}o.push(d);h=setTimeout(a.bind(this),l);if(e.accumulate){var v=o.length-1;return r.promise.then((function(t){return t[v]}))}return r.promise};function a(){var t=r;clearTimeout(h);Promise.resolve(e.accumulate?i.call(this,o):i.apply(this,o[o.length-1])).then(t.resolve,t.reject);o=[];r=null}};function y(t){return typeof t==="function"?t():t}function g(){var t={};t.promise=new Promise((function(i,s){t.resolve=i;t.reject=s}));return t}function b(t){var i=null;var s=null;var e=new Promise((function(t,e){i=t;s=e}));t&&t.then((function(t){i&&i(t)}),(function(t){s&&s(t)}));return{promise:e,resolve:function(t){i&&i(t)},reject:function(t){s&&s(t)},cancel:function(){i=null;s=null}}}function w(t){var i=null;var s=function(){var s=[];for(var e=0;e<arguments.length;e++){s[e]=arguments[e]}i&&i();var n=t.apply(void 0,s);var r=b(n),h=r.promise,o=r.cancel;i=o;return h};return s}
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this file except in compliance with the License. You may obtain a copy of the
6
+ License at http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
+ MERCHANTABLITY OR NON-INFRINGEMENT.
12
+
13
+ See the Apache Version 2.0 License for specific language governing permissions
14
+ and limitations under the License.
15
+ ***************************************************************************** */var C=function(){C=Object.assign||function t(i){for(var s,e=1,n=arguments.length;e<n;e++){s=arguments[e];for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r))i[r]=s[r]}return i};return C.apply(this,arguments)};var D={key:function(){var t=[];for(var i=0;i<arguments.length;i++){t[i]=arguments[i]}return null},onlyResolvesLast:true};var I=function(){function t(t){this.config=t;this.debounceSingleton=null;this.debounceCache={}}t.prototype._createDebouncedFunction=function(){var t=m(this.config.func,this.config.wait,this.config.options);if(this.config.options.onlyResolvesLast){t=w(t)}return{func:t}};t.prototype.getDebouncedFunction=function(t){var i;var s=(i=this.config.options).key.apply(i,t);if(s===null||typeof s==="undefined"){if(!this.debounceSingleton){this.debounceSingleton=this._createDebouncedFunction()}return this.debounceSingleton}else{if(!this.debounceCache[s]){this.debounceCache[s]=this._createDebouncedFunction()}return this.debounceCache[s]}};return t}();function j(t,i,s){var e=C({},D,s);var n=new I({func:t,wait:i,options:e});var r=function(){var t=[];for(var i=0;i<arguments.length;i++){t[i]=arguments[i]}var s=n.getDebouncedFunction(t).func;return s.apply(void 0,t)};return r}const x=":host{position:relative;display:block}:host([hidden]){display:none}";const S=500;const L="limel-chip-set";const P=class{constructor(s){t(this,s);this.change=i(this,"change",7);this.interact=i(this,"interact",7);this.action=i(this,"action",7);this.chipSetEditMode=false;this.disabled=false;this.readonly=false;this.label=undefined;this.searchLabel=undefined;this.helperText=undefined;this.leadingIcon=undefined;this.emptyResultMessage=undefined;this.required=false;this.invalid=false;this.value=undefined;this.searcher=undefined;this.multiple=false;this.delimiter=null;this.actions=[];this.actionPosition="bottom";this.actionScrollBehavior="sticky";this.badgeIcons=false;this.items=undefined;this.textValue="";this.loading=false;this.chips=[];this.handleTextInput=this.handleTextInput.bind(this);this.handleInputKeyDown=this.handleInputKeyDown.bind(this);this.handleDropdownKeyDown=this.handleDropdownKeyDown.bind(this);this.handleInputFieldFocus=this.handleInputFieldFocus.bind(this);this.handleChange=this.handleChange.bind(this);this.handleInteract=this.handleInteract.bind(this);this.handleListChange=this.handleListChange.bind(this);this.handleActionListChange=this.handleActionListChange.bind(this);this.handleStopEditAndBlur=this.handleStopEditAndBlur.bind(this);this.createDebouncedSearcher=this.createDebouncedSearcher.bind(this);this.handleCloseMenu=this.handleCloseMenu.bind(this);this.onListKeyDown=this.onListKeyDown.bind(this);this.portalId=v()}componentWillLoad(){this.chips=this.createChips(this.value)}componentDidLoad(){this.createDebouncedSearcher(this.searcher);this.chipSet=this.host.shadowRoot.querySelector(L)}async componentWillUpdate(){this.chipSetEditMode=false;if(this.chipSet){this.chipSetEditMode=await this.chipSet.getEditMode()}}render(){const t={};if(!this.multiple){t.maxItems=1}return[s("limel-chip-set",Object.assign({type:"input",inputType:"search",label:this.label,helperText:this.helperText,leadingIcon:this.leadingIcon,value:this.chips,disabled:this.disabled,invalid:this.invalid,delimiter:this.renderDelimiter(),readonly:this.readonly,required:this.required,searchLabel:this.searchLabel,onInput:this.handleTextInput,onKeyDown:this.handleInputKeyDown,onChange:this.handleChange,onInteract:this.handleInteract,onStartEdit:this.handleInputFieldFocus,onStopEdit:this.handleStopEditAndBlur,emptyInputOnBlur:false,clearAllButton:this.multiple&&!this.chipSetEditMode},t)),this.renderDropdown()]}onChangeValue(){this.chips=this.createChips(this.value)}createDebouncedSearcher(t){if(typeof t!=="function"){return}this.debouncedSearch=j(t,S)}renderDelimiter(){if(this.multiple){return this.delimiter}return null}createChips(t){if(!t){return[]}if(this.multiple){const i=t;return i.map(this.createChip)}const i=t;return[this.createChip(i)]}createChip(t){return{id:`${t.value}`,text:t.text,removable:true,icon:t.icon,iconFillColor:t.iconColor,value:t}}renderDropdown(){const t=this.getDropdownContent();const i=[];if(this.shouldShowDropDownContent()){const s=this.getActionContent();if(this.actionPosition==="top"){i.push(s)}if(t){i.push(t)}if(this.actionPosition==="bottom"){i.push(s)}}return this.renderPortal(i)}getActionContent(){var t,i;const e=(i=(t=this.actions)===null||t===void 0?void 0:t.length)!==null&&i!==void 0?i:0;if(e===0){return null}return[s("limel-list",{class:{"static-actions-list":true,"is-on-top":this.actionPosition==="top","is-at-bottom":this.actionPosition==="bottom","has-position-sticky":this.actionScrollBehavior==="sticky"},badgeIcons:true,type:"selectable",onChange:this.handleActionListChange,items:this.actions.map(this.removeUnusedPropertiesOnAction)})]}removeUnusedPropertiesOnAction(t){return Object.assign(Object.assign({},t),{actions:[]})}shouldShowDropDownContent(){if(this.isFull()){return false}return!!this.chipSetEditMode}getDropdownContent(){if(!this.shouldShowDropDownContent()){return}if(this.loading){return this.renderSpinner()}if(!this.items||!this.items.length){return this.renderEmptyMessage()}return this.renderListResult()}isFull(){return!this.multiple&&!!this.value}renderSpinner(){return s("div",{style:{width:"100%",display:"flex","align-items":"center","justify-content":"center",padding:"1rem 0"}},s("limel-spinner",{limeBranded:false}))}renderEmptyMessage(){if(!this.emptyResultMessage){return}const t={color:"rgb(var(--contrast-1100))","text-align":"center",margin:"0.5rem 1rem"};return s("p",{style:t},this.emptyResultMessage)}renderListResult(){return s("limel-list",{badgeIcons:this.badgeIcons,onChange:this.handleListChange,onKeyDown:this.onListKeyDown,type:"selectable",items:this.items})}onListKeyDown(t){const i=[r,h,o].includes(t.key);const s=[a,l,u].includes(t.keyCode);if(i||s){this.chipSet.setFocus()}}renderPortal(t=[]){const i=getComputedStyle(this.host).getPropertyValue("--dropdown-z-index");return s("limel-portal",{visible:t.length>0,containerId:this.portalId,inheritParentWidth:true,containerStyle:{"z-index":i}},s("limel-menu-surface",{open:t.length>0,allowClicksElement:this.host,style:{"--mdc-menu-min-width":"100%","max-height":"inherit",display:"flex"},onDismiss:this.handleCloseMenu},t))}handleStopEditAndBlur(){const t=this.host.shadowRoot.activeElement||document.activeElement;const i=document.querySelector(`#${this.portalId}`);if(n(t,this.host)||n(t,i)){return}this.clearInputField()}async handleTextInput(t){t.stopPropagation();const i=t.detail;this.textValue=i;this.loading=true;const s=i===""?this.searcher:this.debouncedSearch;const e=await s(i);this.handleSearchResult(i,e)}handleListChange(t){var i;t.stopPropagation();if(!this.value||this.value!==t.detail){let i=t.detail;if(this.multiple){i=[...this.value,t.detail]}this.change.emit(i);this.items=[]}if(this.multiple){(i=this.chipSet)===null||i===void 0?void 0:i.setFocus(true)}}handleActionListChange(t){t.stopPropagation();if(!t.detail){return}this.action.emit(t.detail.value);this.items=[]}async handleInputFieldFocus(){this.loading=true;const t=this.textValue;const i=await this.searcher(t);this.handleSearchResult(t,i)}handleChange(t){t.stopPropagation();let i=null;if(this.multiple){const s=t.detail;i=s.map((t=>this.value.find((i=>`${i.value}`===t.id))))}this.change.emit(i)}handleInteract(t){t.stopPropagation();this.interact.emit(t.detail?t.detail.value:t.detail)}handleInputKeyDown(t){const i=(t.key===r||t.keyCode===a)&&!t.altKey&&!t.metaKey&&!t.shiftKey;const s=t.key===c||t.keyCode===f;const e=t.key===d||t.keyCode===p;if(!i&&!s&&!e){return}const n=document.querySelector(` #${this.portalId} limel-list`);if(!n){return}t.preventDefault();if(i||e){const t=n.shadowRoot.querySelector(".mdc-deprecated-list-item:first-child");t.focus();return}if(s){const t=n.shadowRoot.querySelector(".mdc-deprecated-list-item:last-child");t.focus()}}handleDropdownKeyDown(t){const i=t.key===h||t.keyCode===l;if(i){t.preventDefault();this.textValue="";this.chipSet.setFocus(true)}}handleSearchResult(t,i){if(t===this.textValue){this.items=i;if(this.multiple){const t=this.value;this.items=i.filter((i=>!t.includes(i)))}this.loading=false}}handleCloseMenu(){if(this.items.length>0){return}this.clearInputField()}clearInputField(){this.chipSet.emptyInput();this.textValue="";this.handleSearchResult("",[])}get host(){return e(this)}static get watchers(){return{value:["onChangeValue"],searcher:["createDebouncedSearcher"]}}};P.style=x;export{P as limel_picker};
16
+ //# sourceMappingURL=p-98be972f.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["dist","debounce","fn","wait","arguments","length","undefined","options","lastCallAt","deferred","timer","pendingArgs","debounced","currentWait","getWait","currentTime","Date","getTime","isCold","_len","args","Array","_key","leading","accumulate","Promise","resolve","call","this","then","result","apply","concat","clearTimeout","defer","push","setTimeout","flush","bind","argsIndex","promise","results","thisDeferred","reject","createImperativePromise","promiseArg","wrappedPromise","_resolve","_reject","val","error","value","reason","cancel","onlyResolvesLast","asyncFunction","cancelPrevious","wrappedFunction","_i","initialPromise","_a","__assign","Object","assign","t","s","i","n","p","prototype","hasOwnProperty","DefaultOptions","key","_args","DebounceCache","config","debounceSingleton","debounceCache","_createDebouncedFunction","debouncedFunc","DebouncePromise","func","getDebouncedFunction","AwesomeDebouncePromise","finalOptions","AwesomeDebouncePromiseWrapper","debouncedFn","pickerCss","SEARCH_DEBOUNCE","CHIP_SET_TAG_NAME","Picker","constructor","hostRef","chipSetEditMode","handleTextInput","handleInputKeyDown","handleDropdownKeyDown","handleInputFieldFocus","handleChange","handleInteract","handleListChange","handleActionListChange","handleStopEditAndBlur","createDebouncedSearcher","handleCloseMenu","onListKeyDown","portalId","createRandomString","componentWillLoad","chips","createChips","componentDidLoad","searcher","chipSet","host","shadowRoot","querySelector","async","getEditMode","render","props","multiple","maxItems","h","type","inputType","label","helperText","leadingIcon","disabled","invalid","delimiter","renderDelimiter","readonly","required","searchLabel","onInput","onKeyDown","onChange","onInteract","onStartEdit","onStopEdit","emptyInputOnBlur","clearAllButton","renderDropdown","onChangeValue","newValue","debouncedSearch","listItems","map","createChip","listItem","id","text","removable","icon","iconFillColor","iconColor","dropDownContent","getDropdownContent","content","shouldShowDropDownContent","actionContent","getActionContent","actionPosition","renderPortal","actionCount","_b","actions","class","actionScrollBehavior","badgeIcons","items","removeUnusedPropertiesOnAction","action","isFull","loading","renderSpinner","renderEmptyMessage","renderListResult","style","width","display","padding","limeBranded","emptyResultMessage","color","margin","event","keyFound","TAB","ESCAPE","ENTER","includes","keyCodeFound","TAB_KEY_CODE","ESCAPE_KEY_CODE","ENTER_KEY_CODE","keyCode","setFocus","dropdownZIndex","getComputedStyle","getPropertyValue","visible","containerId","inheritParentWidth","containerStyle","open","allowClicksElement","onDismiss","element","activeElement","document","portalElement","isDescendant","clearInputField","stopPropagation","query","detail","textValue","searchFn","handleSearchResult","change","emit","chip","find","item","interact","isForwardTab","altKey","metaKey","shiftKey","isUp","ARROW_UP","ARROW_UP_KEY_CODE","isDown","ARROW_DOWN","ARROW_DOWN_KEY_CODE","list","preventDefault","listElement","focus","isEscape","values","filter","emptyInput"],"sources":["./node_modules/debounce-promise/dist/index.js","./node_modules/awesome-imperative-promise/dist/index.es.js","./node_modules/awesome-only-resolves-last-promise/dist/index.es.js","./node_modules/awesome-debounce-promise/dist/index.es.js","./src/components/picker/picker.scss?tag=limel-picker&encapsulation=shadow","./src/components/picker/picker.tsx"],"sourcesContent":["'use strict';\n\n/* global setTimeout, clearTimeout */\n\nmodule.exports = function debounce(fn) {\n var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var lastCallAt = void 0;\n var deferred = void 0;\n var timer = void 0;\n var pendingArgs = [];\n return function debounced() {\n var currentWait = getWait(wait);\n var currentTime = new Date().getTime();\n\n var isCold = !lastCallAt || currentTime - lastCallAt > currentWait;\n\n lastCallAt = currentTime;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (isCold && options.leading) {\n return options.accumulate ? Promise.resolve(fn.call(this, [args])).then(function (result) {\n return result[0];\n }) : Promise.resolve(fn.call.apply(fn, [this].concat(args)));\n }\n\n if (deferred) {\n clearTimeout(timer);\n } else {\n deferred = defer();\n }\n\n pendingArgs.push(args);\n timer = setTimeout(flush.bind(this), currentWait);\n\n if (options.accumulate) {\n var argsIndex = pendingArgs.length - 1;\n return deferred.promise.then(function (results) {\n return results[argsIndex];\n });\n }\n\n return deferred.promise;\n };\n\n function flush() {\n var thisDeferred = deferred;\n clearTimeout(timer);\n\n Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);\n\n pendingArgs = [];\n deferred = null;\n }\n};\n\nfunction getWait(wait) {\n return typeof wait === 'function' ? wait() : wait;\n}\n\nfunction defer() {\n var deferred = {};\n deferred.promise = new Promise(function (resolve, reject) {\n deferred.resolve = resolve;\n deferred.reject = reject;\n });\n return deferred;\n}\n//# sourceMappingURL=index.js.map","function createImperativePromise(promiseArg) {\r\n var resolve = null;\r\n var reject = null;\r\n var wrappedPromise = new Promise(function (_resolve, _reject) {\r\n resolve = _resolve;\r\n reject = _reject;\r\n });\r\n promiseArg && promiseArg.then(function (val) {\r\n resolve && resolve(val);\r\n }, function (error) {\r\n reject && reject(error);\r\n });\r\n return {\r\n promise: wrappedPromise,\r\n resolve: function (value) {\r\n resolve && resolve(value);\r\n },\r\n reject: function (reason) {\r\n reject && reject(reason);\r\n },\r\n cancel: function () {\r\n resolve = null;\r\n reject = null;\r\n }\r\n };\r\n}\n\nexport { createImperativePromise };\n//# sourceMappingURL=index.es.js.map\n","import { createImperativePromise } from 'awesome-imperative-promise';\n\n// see https://stackoverflow.com/a/54825370/82609\r\nfunction onlyResolvesLast(asyncFunction) {\r\n var cancelPrevious = null;\r\n var wrappedFunction = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n cancelPrevious && cancelPrevious();\r\n var initialPromise = asyncFunction.apply(void 0, args);\r\n var _a = createImperativePromise(initialPromise), promise = _a.promise, cancel = _a.cancel;\r\n cancelPrevious = cancel;\r\n return promise;\r\n };\r\n return wrappedFunction; // TODO fix TS\r\n}\n\nexport { onlyResolvesLast };\n//# sourceMappingURL=index.es.js.map\n","import DebouncePromise from 'debounce-promise';\nimport { onlyResolvesLast } from 'awesome-only-resolves-last-promise';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\nvar DefaultOptions = {\r\n // One distinct debounced function is created per key and added to an internal cache\r\n // By default, the key is null, which means that all the calls\r\n // will share the same debounced function\r\n key: function () {\r\n var _args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n _args[_i] = arguments[_i];\r\n }\r\n return null;\r\n },\r\n // By default, a debounced function will only resolve\r\n // the last promise it returned\r\n // Former calls will stay unresolved, so that you don't have\r\n // to handle concurrency issues in your code\r\n // Setting this to false means all returned promises will resolve to the last result\r\n onlyResolvesLast: true,\r\n};\r\n// We create a debouncing function cache, because when wrapping the original function,\r\n// we may actually want to route the function call to different debounced functions depending function paameters\r\nvar DebounceCache = /** @class */ (function () {\r\n function DebounceCache(config) {\r\n this.config = config;\r\n this.debounceSingleton = null;\r\n this.debounceCache = {}; // when key feature is used\r\n }\r\n DebounceCache.prototype._createDebouncedFunction = function () {\r\n var debouncedFunc = DebouncePromise(this.config.func, this.config.wait, this.config.options); // TODO TS\r\n if (this.config.options.onlyResolvesLast) {\r\n debouncedFunc = onlyResolvesLast(debouncedFunc);\r\n }\r\n return {\r\n func: debouncedFunc,\r\n };\r\n };\r\n DebounceCache.prototype.getDebouncedFunction = function (args) {\r\n var _a;\r\n var key = (_a = this.config.options).key.apply(_a, args);\r\n if (key === null || typeof key === 'undefined') {\r\n if (!this.debounceSingleton) {\r\n this.debounceSingleton = this._createDebouncedFunction();\r\n }\r\n return this.debounceSingleton;\r\n }\r\n else {\r\n if (!this.debounceCache[key]) {\r\n this.debounceCache[key] = this._createDebouncedFunction();\r\n }\r\n return this.debounceCache[key];\r\n }\r\n };\r\n return DebounceCache;\r\n}());\r\nfunction AwesomeDebouncePromise(func, wait, options) {\r\n var finalOptions = __assign({}, DefaultOptions, options);\r\n var debounceCache = new DebounceCache({\r\n func: func,\r\n wait: wait,\r\n options: finalOptions,\r\n });\r\n var AwesomeDebouncePromiseWrapper = (function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var debouncedFn = debounceCache.getDebouncedFunction(args).func;\r\n return debouncedFn.apply(void 0, args);\r\n }); // TODO fix TS\r\n /*\r\n AwesomeDebouncePromiseWrapper.cancel = (key?: string) => {\r\n \n };\r\n */\r\n return AwesomeDebouncePromiseWrapper;\r\n}\n\nexport default AwesomeDebouncePromise;\n//# sourceMappingURL=index.es.js.map\n","// Note! The `--dropdown-z-index` property is used from `picker.tsx`.\n/**\n * @prop --dropdown-z-index: z-index of the dropdown menu.\n */\n\n:host {\n position: relative;\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n","import {\n Action,\n ActionPosition,\n ActionScrollBehavior,\n Chip,\n ListItem,\n Searcher,\n} from '../../interface';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport AwesomeDebouncePromise from 'awesome-debounce-promise';\nimport { isDescendant } from '../../util/dom';\nimport {\n ARROW_DOWN,\n ARROW_DOWN_KEY_CODE,\n ARROW_UP,\n ARROW_UP_KEY_CODE,\n ENTER,\n ENTER_KEY_CODE,\n ESCAPE,\n ESCAPE_KEY_CODE,\n TAB,\n TAB_KEY_CODE,\n} from '../../util/keycodes';\nimport { createRandomString } from '../../util/random-string';\nimport { LimelChipSetCustomEvent, LimelListCustomEvent } from 'src/components';\n\nconst SEARCH_DEBOUNCE = 500;\nconst CHIP_SET_TAG_NAME = 'limel-chip-set';\n\n/**\n * @exampleComponent limel-example-picker-single\n * @exampleComponent limel-example-picker-multiple\n * @exampleComponent limel-example-picker-icons\n * @exampleComponent limel-example-picker-empty-suggestions\n * @exampleComponent limel-example-picker-leading-icon\n * @exampleComponent limel-example-picker-static-actions\n * @exampleComponent limel-example-picker-composite\n */\n@Component({\n tag: 'limel-picker',\n shadow: true,\n styleUrl: 'picker.scss',\n})\nexport class Picker {\n /**\n * True if the picker should be disabled\n */\n @Prop()\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing items,\n * but allow interaction with existing items.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Text to display for the input field of the picker\n */\n @Prop()\n public label: string;\n\n /**\n * Search label to display in the input field when searching\n */\n @Prop()\n public searchLabel: string;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * Leading icon to show to the far left in the text field\n */\n @Prop()\n public leadingIcon: string;\n\n /**\n * A message to display when the search returned an empty result\n */\n @Prop()\n public emptyResultMessage: string;\n\n /**\n * True if the control requires a value\n */\n @Prop()\n public required: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the input field is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * Currently selected value or values\n */\n @Prop()\n public value: ListItem<number | string> | Array<ListItem<number | string>>;\n\n /**\n * A search function that takes a search-string as an argument,\n * and returns a promise that will eventually be resolved with\n * an array of `ListItem`:s.\n *\n * See the docs for the type `Searcher` for type information on\n * the searcher function itself.\n */\n @Prop()\n public searcher: Searcher;\n\n /**\n * True if multiple values are allowed\n */\n @Prop()\n public multiple: boolean = false;\n\n /**\n * Sets delimiters between chips. Works only when `multiple` is `true`.\n */\n @Prop({ reflect: true })\n public delimiter: string = null;\n\n /**\n * Static actions that can be clicked by the user.\n */\n @Prop()\n public actions: Array<ListItem<Action>> = [];\n\n /**\n * Position of the custom static actions in the picker's results dropdown.\n * Can be set to `'top'` or `'bottom'`.\n */\n @Prop()\n public actionPosition: ActionPosition = 'bottom';\n\n /**\n * Scroll behavior of the custom static actions, when user scrolls\n * in the picker's results dropdown. Can be set to `'scroll'` which means\n * the action items will scroll together with the list, or `'sticky'` which\n * retains their position at the top or bottom of the drop down while\n * scrolling.\n */\n @Prop()\n public actionScrollBehavior: ActionScrollBehavior = 'sticky';\n\n /**\n * Whether badge icons should be used in the result list or not\n */\n @Prop({ reflect: true })\n public badgeIcons: boolean = false;\n\n /**\n * Fired when a new value has been selected from the picker\n */\n @Event()\n private change: EventEmitter<\n ListItem<number | string> | Array<ListItem<number | string>>\n >;\n\n /**\n * Fired when clicking on a selected value\n */\n @Event()\n private interact: EventEmitter<ListItem<number | string>>;\n\n /**\n * Emitted when the user selects an action.\n */\n @Event()\n private action: EventEmitter<Action>;\n\n @State()\n private items: Array<ListItem<number | string>>;\n\n @State()\n private textValue: string = '';\n\n @State()\n private loading: boolean = false;\n\n @State()\n private chips: Chip[] = [];\n\n @Element()\n private host: HTMLLimelPickerElement;\n\n // Should NOT be decorated with State(), since this\n // should not trigger a re-render by itself.\n private chipSetEditMode = false;\n\n private debouncedSearch: Searcher;\n private chipSet: HTMLLimelChipSetElement;\n private portalId: string;\n\n constructor() {\n this.handleTextInput = this.handleTextInput.bind(this);\n this.handleInputKeyDown = this.handleInputKeyDown.bind(this);\n this.handleDropdownKeyDown = this.handleDropdownKeyDown.bind(this);\n this.handleInputFieldFocus = this.handleInputFieldFocus.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.handleInteract = this.handleInteract.bind(this);\n this.handleListChange = this.handleListChange.bind(this);\n this.handleActionListChange = this.handleActionListChange.bind(this);\n this.handleStopEditAndBlur = this.handleStopEditAndBlur.bind(this);\n this.createDebouncedSearcher = this.createDebouncedSearcher.bind(this);\n this.handleCloseMenu = this.handleCloseMenu.bind(this);\n this.onListKeyDown = this.onListKeyDown.bind(this);\n\n this.portalId = createRandomString();\n }\n\n public componentWillLoad() {\n this.chips = this.createChips(this.value);\n }\n\n public componentDidLoad() {\n this.createDebouncedSearcher(this.searcher);\n this.chipSet = this.host.shadowRoot.querySelector(CHIP_SET_TAG_NAME);\n }\n\n public async componentWillUpdate() {\n this.chipSetEditMode = false;\n if (this.chipSet) {\n this.chipSetEditMode = await this.chipSet.getEditMode();\n }\n }\n\n public render() {\n const props: {\n maxItems?: number;\n } = {};\n\n if (!this.multiple) {\n props.maxItems = 1;\n }\n\n return [\n <limel-chip-set\n type=\"input\"\n inputType=\"search\"\n label={this.label}\n helperText={this.helperText}\n leadingIcon={this.leadingIcon}\n value={this.chips}\n disabled={this.disabled}\n invalid={this.invalid}\n delimiter={this.renderDelimiter()}\n readonly={this.readonly}\n required={this.required}\n searchLabel={this.searchLabel}\n onInput={this.handleTextInput}\n onKeyDown={this.handleInputKeyDown}\n onChange={this.handleChange}\n onInteract={this.handleInteract}\n onStartEdit={this.handleInputFieldFocus}\n onStopEdit={this.handleStopEditAndBlur}\n emptyInputOnBlur={false}\n clearAllButton={this.multiple && !this.chipSetEditMode}\n {...props}\n />,\n this.renderDropdown(),\n ];\n }\n\n @Watch('value')\n protected onChangeValue() {\n this.chips = this.createChips(this.value);\n }\n\n @Watch('searcher')\n protected createDebouncedSearcher(newValue: Searcher) {\n if (typeof newValue !== 'function') {\n return;\n }\n\n this.debouncedSearch = AwesomeDebouncePromise(\n newValue,\n SEARCH_DEBOUNCE\n );\n }\n\n private renderDelimiter() {\n if (this.multiple) {\n return this.delimiter;\n }\n\n return null;\n }\n\n private createChips(value: ListItem | ListItem[]): Chip[] {\n if (!value) {\n return [];\n }\n\n if (this.multiple) {\n const listItems: ListItem[] = value as ListItem[];\n\n return listItems.map(this.createChip);\n }\n\n const listItem: ListItem = value as ListItem;\n\n return [this.createChip(listItem)];\n }\n\n private createChip(listItem: ListItem): Chip {\n return {\n id: `${listItem.value}`,\n text: listItem.text,\n removable: true,\n icon: listItem.icon,\n iconFillColor: listItem.iconColor,\n value: listItem,\n };\n }\n\n /**\n * Renders the dropdown with the items to pick from, or a spinner if the picker\n * is waiting for items to be received\n * @returns {HTMLElement} picker dropdown\n */\n private renderDropdown() {\n const dropDownContent = this.getDropdownContent();\n\n const content = [];\n\n if (this.shouldShowDropDownContent()) {\n const actionContent = this.getActionContent();\n if (this.actionPosition === 'top') {\n content.push(actionContent);\n }\n\n if (dropDownContent) {\n content.push(dropDownContent);\n }\n\n if (this.actionPosition === 'bottom') {\n content.push(actionContent);\n }\n }\n\n return this.renderPortal(content);\n }\n\n private getActionContent() {\n const actionCount = this.actions?.length ?? 0;\n if (actionCount === 0) {\n return null;\n }\n\n return [\n <limel-list\n class={{\n 'static-actions-list': true,\n 'is-on-top': this.actionPosition === 'top',\n 'is-at-bottom': this.actionPosition === 'bottom',\n 'has-position-sticky':\n this.actionScrollBehavior === 'sticky',\n }}\n badgeIcons={true}\n type={'selectable'}\n onChange={this.handleActionListChange}\n items={this.actions.map(this.removeUnusedPropertiesOnAction)}\n />,\n ];\n }\n\n private removeUnusedPropertiesOnAction(\n action: ListItem<Action>\n ): ListItem<Action> {\n return {\n ...action,\n actions: [],\n };\n }\n\n private shouldShowDropDownContent() {\n if (this.isFull()) {\n return false;\n }\n\n return !!this.chipSetEditMode;\n }\n\n private getDropdownContent() {\n if (!this.shouldShowDropDownContent()) {\n return;\n }\n\n if (this.loading) {\n return this.renderSpinner();\n }\n\n if (!this.items || !this.items.length) {\n return this.renderEmptyMessage();\n }\n\n return this.renderListResult();\n }\n\n /**\n * Returns true if the picker is \"full\"\n * The picker is considered to be full if it has a value and only one is allowed\n * @returns {boolean} true if the picker is full\n */\n private isFull(): boolean {\n return !this.multiple && !!this.value;\n }\n\n private renderSpinner() {\n return (\n <div\n style={{\n width: '100%',\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n padding: '1rem 0',\n }}\n >\n <limel-spinner limeBranded={false} />\n </div>\n );\n }\n\n private renderEmptyMessage() {\n if (!this.emptyResultMessage) {\n return;\n }\n\n const style = {\n color: 'rgb(var(--contrast-1100))',\n 'text-align': 'center',\n margin: '0.5rem 1rem',\n };\n\n return <p style={style}>{this.emptyResultMessage}</p>;\n }\n\n private renderListResult() {\n return (\n <limel-list\n badgeIcons={this.badgeIcons}\n onChange={this.handleListChange}\n onKeyDown={this.onListKeyDown}\n type=\"selectable\"\n items={this.items}\n />\n );\n }\n\n private onListKeyDown(event: KeyboardEvent) {\n const keyFound = [TAB, ESCAPE, ENTER].includes(event.key);\n const keyCodeFound = [\n TAB_KEY_CODE,\n ESCAPE_KEY_CODE,\n ENTER_KEY_CODE,\n ].includes(event.keyCode);\n if (keyFound || keyCodeFound) {\n this.chipSet.setFocus();\n }\n }\n\n private renderPortal(content: any[] = []) {\n const dropdownZIndex = getComputedStyle(this.host).getPropertyValue(\n '--dropdown-z-index'\n );\n\n return (\n <limel-portal\n visible={content.length > 0}\n containerId={this.portalId}\n inheritParentWidth={true}\n containerStyle={{ 'z-index': dropdownZIndex }}\n >\n <limel-menu-surface\n open={content.length > 0}\n allowClicksElement={this.host}\n style={{\n '--mdc-menu-min-width': '100%',\n 'max-height': 'inherit',\n display: 'flex',\n }}\n onDismiss={this.handleCloseMenu}\n >\n {content}\n </limel-menu-surface>\n </limel-portal>\n );\n }\n\n /**\n * Check if a descendant still has focus. If not, reset text value and search result.\n * @returns {void}\n */\n private handleStopEditAndBlur() {\n // In browsers where shadow DOM is not supported activeElement on shadowRoot will return null\n // However, document.activeElement will return the actual focused element instead of the outermost shadow host\n const element =\n this.host.shadowRoot.activeElement || document.activeElement;\n const portalElement = document.querySelector(`#${this.portalId}`);\n if (\n isDescendant(element as HTMLElement, this.host) ||\n isDescendant(element as HTMLElement, portalElement as HTMLElement)\n ) {\n return;\n }\n\n this.clearInputField();\n }\n\n /**\n * Input handler for the input field\n * @param {InputEvent} event event\n * @returns {void}\n */\n private async handleTextInput(event) {\n event.stopPropagation();\n\n const query = event.detail;\n this.textValue = query;\n this.loading = true;\n\n // If the search-query is an empty string, bypass debouncing.\n const searchFn = query === '' ? this.searcher : this.debouncedSearch;\n const result = await searchFn(query);\n this.handleSearchResult(query, result);\n }\n\n /**\n * Change handler for the list\n * @param {LimelListCustomEvent<ListItem>} event event\n * @returns {void}\n */\n private handleListChange(event: LimelListCustomEvent<ListItem>) {\n event.stopPropagation();\n if (!this.value || this.value !== event.detail) {\n let newValue: ListItem | ListItem[] = event.detail;\n if (this.multiple) {\n newValue = [...(this.value as ListItem[]), event.detail];\n }\n\n this.change.emit(newValue);\n this.items = [];\n }\n\n if (this.multiple) {\n this.chipSet?.setFocus(true);\n }\n }\n\n /**\n * Change handler for the list\n * @param {LimelChipSetCustomEvent} event event\n * @returns {void}\n */\n private handleActionListChange(\n event: LimelListCustomEvent<ListItem<Action>>\n ) {\n event.stopPropagation();\n if (!event.detail) {\n return;\n }\n\n this.action.emit(event.detail.value);\n this.items = [];\n }\n\n /**\n * Focus handler for the chip set\n * Prevent focus if the picker has a value and does not support multiple values\n * @returns {void}\n */\n private async handleInputFieldFocus() {\n this.loading = true;\n const query = this.textValue;\n const result = await this.searcher(query);\n this.handleSearchResult(query, result);\n }\n\n private handleChange(event: LimelChipSetCustomEvent<Chip | Chip[]>) {\n event.stopPropagation();\n\n let newValue = null;\n if (this.multiple) {\n const chips = event.detail as Chip[];\n newValue = chips.map((chip) => {\n return (this.value as ListItem[]).find((item) => {\n return `${item.value}` === chip.id;\n });\n });\n }\n\n this.change.emit(newValue);\n }\n\n private handleInteract(event: LimelChipSetCustomEvent<Chip>) {\n event.stopPropagation();\n this.interact.emit(event.detail ? event.detail.value : event.detail);\n }\n\n /**\n * Key handler for the input field\n * Will change focus to the first/last item in the dropdown list to enable selection with the keyboard\n * @param {KeyboardEvent} event event\n * @returns {void}\n */\n private handleInputKeyDown(event: KeyboardEvent) {\n const isForwardTab =\n (event.key === TAB || event.keyCode === TAB_KEY_CODE) &&\n !event.altKey &&\n !event.metaKey &&\n !event.shiftKey;\n const isUp =\n event.key === ARROW_UP || event.keyCode === ARROW_UP_KEY_CODE;\n const isDown =\n event.key === ARROW_DOWN || event.keyCode === ARROW_DOWN_KEY_CODE;\n\n if (!isForwardTab && !isUp && !isDown) {\n return;\n }\n\n const list = document.querySelector(` #${this.portalId} limel-list`);\n if (!list) {\n return;\n }\n\n event.preventDefault();\n\n if (isForwardTab || isDown) {\n const listElement: HTMLElement = list.shadowRoot.querySelector(\n '.mdc-deprecated-list-item:first-child'\n );\n listElement.focus();\n\n return;\n }\n\n if (isUp) {\n const listElement: HTMLElement = list.shadowRoot.querySelector(\n '.mdc-deprecated-list-item:last-child'\n );\n listElement.focus();\n }\n }\n\n /**\n * Key handler for the dropdown\n * @param {KeyboardEvent} event event\n * @returns {void}\n */\n private handleDropdownKeyDown(event: KeyboardEvent) {\n const isEscape =\n event.key === ESCAPE || event.keyCode === ESCAPE_KEY_CODE;\n\n if (isEscape) {\n event.preventDefault();\n this.textValue = '';\n this.chipSet.setFocus(true);\n }\n }\n\n private handleSearchResult(query: string, result: ListItem[]) {\n if (query === this.textValue) {\n this.items = result;\n if (this.multiple) {\n const values = this.value as ListItem[];\n this.items = result.filter((item) => {\n return !values.includes(item);\n });\n }\n\n this.loading = false;\n }\n }\n\n private handleCloseMenu() {\n if (this.items.length > 0) {\n return;\n }\n\n this.clearInputField();\n }\n\n private clearInputField() {\n this.chipSet.emptyInput();\n this.textValue = '';\n this.handleSearchResult('', []);\n }\n}\n"],"mappings":"oOAIA,IAAAA,EAAiB,SAASC,EAASC,GACjC,IAAIC,EAAOC,UAAUC,OAAS,GAAKD,UAAU,KAAOE,UAAYF,UAAU,GAAK,EAC/E,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QAAU,K,EAIfxE,kBACJ,GAAI5E,KAAKgJ,MAAMvK,OAAS,EAAG,CACvB,M,CAGJuB,KAAK2L,iB,CAGDA,kBACJ3L,KAAKqF,QAAQoI,aACbzN,KAAK+L,UAAY,GACjB/L,KAAKiM,mBAAmB,GAAI,G"}
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,h as o,g as i}from"./p-3075aa67.js";import{t as r}from"./p-3ee3dcdc.js";function s(t,e){const o=t||e;if(!o){return"unknown"}const i=o.split(".").pop().toLowerCase();const r={pdf:"pdf",jpg:"image",jpeg:"image",heic:"image",bmp:"image",png:"image",gif:"image",svg:"image",svgz:"image",ep:"image",eps:"image",avi:"video",flv:"video",h264:"video",mov:"video",mp4:"video",mwv:"video",mkv:"video",mp3:"audio",wav:"audio",wma:"audio",ogg:"audio",txt:"text",json:"text",html:"text",xml:"text",doc:"office",docx:"office",odt:"office",dot:"office",dotx:"office",docm:"office",dotm:"office",pot:"office",ppt:"office",pptx:"office",odp:"office",potx:"office",potm:"office",pps:"office",ppsx:"office",ppsm:"office",pptm:"office",ppam:"office",pages:"office",xls:"office",xlsx:"office",xlsm:"office",xlsb:"office",ods:"office",csv:"office",numbers:"office"};return r[i]||"unknown"}class n{constructor(t){this.requestFullscreen=()=>{if(this.enter){this.enter()}};this.exitFullscreen=()=>{if(this.exit){this.exit.bind(window.document)()}};this.toggle=()=>{const t=window.document;const e=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement;if(e){this.exitFullscreen()}else{this.requestFullscreen()}};this.enter=t.requestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen;this.enter=this.enter.bind(t);const e=window.document;this.exit=e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen}isSupported(){return!!this.requestFullscreen}}const a=':host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host{isolation:isolate;position:relative;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;height:100%}*{box-sizing:border-box}img,video,audio,object,iframe{max-height:100%;max-width:100%;box-sizing:border-box}iframe{border:none;width:100%;height:100%;min-height:20rem}img{min-width:7rem;object-fit:contain}video{width:100%;height:auto}audio{width:100%}object{width:100%;height:100%}object[type="application/pdf"]{min-height:20rem}object[type="text/plain"]{border-radius:0.25rem;padding-right:2rem;overflow-y:auto}:host(:fullscreen){background-color:rgb(var(--color-gray-darker))}:host(:fullscreen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}:host(:-webkit-full-screen){background-color:rgb(var(--color-gray-darker))}:host(:-webkit-full-screen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}.buttons{position:absolute;z-index:1;top:0.25rem;right:0.25rem;display:flex;flex-direction:column;gap:0.25rem}@media (pointer: coarse){.buttons{gap:0.5rem}}.no-support{display:flex;flex-direction:column;align-items:center;border:1px dashed rgb(var(--contrast-600));border-radius:0.5rem;padding:1.25rem}.no-support .icon--warning{color:rgb(var(--color-orange-default))}[class^=button--]{all:unset;transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);display:flex;align-items:center;justify-content:center;border-radius:50%;width:2rem;height:2rem;background-color:rgba(var(--contrast-100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}[class^=button--]:hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}[class^=button--]:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}[class^=button--]:focus{outline:none}[class^=button--]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}[class^=button--] limel-icon{transition:color 0.2s ease;width:1.25rem;color:rgb(var(--contrast-1200))}[class^=button--]:hover limel-icon{color:rgb(var(--contrast-1400))}.action-menu-for-pdf-files,.action-menu-for-office-files{position:absolute;right:0.75rem}.action-menu-for-pdf-files{bottom:0.75rem}.action-menu-for-office-files{top:0.75rem}';const c=class{constructor(i){t(this,i);this.action=e(this,"action",7);this.renderPdf=()=>[o("div",{class:"action-menu-for-pdf-files"},this.renderActionMenu()),o("object",{data:this.url,type:"application/pdf"})];this.renderImage=()=>[this.renderButtons(),o("img",{src:this.url,alt:this.alt})];this.renderVideo=()=>o("video",{controls:true},o("source",{src:this.url}));this.renderAudio=()=>o("audio",{controls:true},o("source",{src:this.url}));this.renderText=()=>[this.renderButtons(),o("object",{data:this.url,type:"text/plain"})];this.renderOffice=()=>[o("div",{class:"action-menu-for-office-files"},this.renderActionMenu()),o("iframe",{src:this.getOfficeViewerUrl()+this.url+"&embedded=true",frameborder:"0"})];this.isOfficeFileAccessibleViaURL=()=>this.fileType==="office"&&!(this.url.startsWith("http://")||this.url.startsWith("https://"));this.getOfficeViewerUrl=()=>{const t={"microsoft-office":"https://view.officeapps.live.com/op/embed.aspx?src=","google-drive":"https://docs.google.com/gview?url="};return t[this.officeViewer]};this.renderNoFileSupportMessage=()=>o("div",{class:"no-support"},o("limel-icon",{class:"icon--warning",name:"brake_warning",size:"large",role:"presentation"}),o("p",null,this.getTranslation("message.unsupported-filetype")),this.renderDownloadButton());this.renderButtons=()=>o("div",{class:"buttons"},this.renderActionMenu(),this.renderToggleFullscreenButton(),this.renderDownloadButton(),this.renderOpenInNewTabButton());this.renderToggleFullscreenButton=()=>{if(!this.allowFullscreen||!this.fullscreen.isSupported()){return}const t=this.isFullscreen?"multiply":"fit_to_width";const e=this.isFullscreen?this.getTranslation("exit-fullscreen"):this.getTranslation("open-in-fullscreen");return[o("button",{class:"button--toggle-fullscreen",id:"tooltip-toggle-fullscreen",role:"button",onClick:this.handleToggleFullscreen},o("limel-icon",{name:t}),o("limel-tooltip",{label:e,elementId:"tooltip-toggle-fullscreen",openDirection:"left"}))]};this.renderDownloadButton=()=>{if(!this.allowDownload||this.isFullscreen){return}return o("a",{class:"button--download",id:"tooltip-download",role:"button",download:this.filename?this.filename:"",href:this.url,target:"_blank"},o("limel-icon",{name:"download_2"}),o("limel-tooltip",{label:this.getTranslation("download"),elementId:"tooltip-download",openDirection:"left"}))};this.renderOpenInNewTabButton=()=>{if(!this.allowOpenInNewTab||this.isFullscreen){return}return o("a",{class:"button--new-tab",id:"tooltip-new-tab",role:"button",href:this.url,target:"_blank",rel:"noopener noreferrer"},o("limel-icon",{name:"external_link"}),o("limel-tooltip",{label:this.getTranslation("open-in-new-tab"),elementId:"tooltip-new-tab",openDirection:"left"}))};this.renderActionMenu=()=>{if(!this.actions||this.isFullscreen){return}return o("limel-menu",{class:"action-menu",items:this.actions,onSelect:this.emitOnAction,"open-direction":"left"},o("button",{class:"button--action",id:"tooltip-more",role:"button",slot:"trigger"},o("limel-icon",{name:"menu_2"}),o("limel-tooltip",{label:this.getTranslation("more-actions"),elementId:"tooltip-more",openDirection:"left"})))};this.handleToggleFullscreen=()=>{if(this.fullscreen.isSupported()){this.fullscreen.toggle();this.isFullscreen=!this.isFullscreen}};this.emitOnAction=t=>{t.stopPropagation();this.action.emit(t.detail)};this.url=undefined;this.filename=undefined;this.alt=undefined;this.allowFullscreen=false;this.allowOpenInNewTab=false;this.allowDownload=false;this.language="en";this.officeViewer="microsoft-office";this.actions=undefined;this.isFullscreen=false;this.fileType=undefined;this.fullscreen=new n(this.HostElement);this.fileType=s(this.filename,this.url)}render(){if(!this.isOfficeFileAccessibleViaURL){return this.renderNoFileSupportMessage()}return this.renderFileViewer()}watchUrl(t,e){if(t===e){return}this.fileType=s(this.filename,this.url)}renderFileViewer(){const t={pdf:this.renderPdf,image:this.renderImage,video:this.renderVideo,audio:this.renderAudio,text:this.renderText,office:this.renderOffice};const e=t[this.fileType]||this.renderNoFileSupportMessage;return e()}getTranslation(t){return r.get(`file-viewer.${t}`,this.language)}get HostElement(){return i(this)}static get watchers(){return{url:["watchUrl"]}}};c.style=a;export{c as limel_file_viewer};
2
- //# sourceMappingURL=p-b8deba1b.entry.js.map
1
+ import{r as t,c as e,h as o,g as i}from"./p-3075aa67.js";import{t as r}from"./p-3ee3dcdc.js";function s(t,e){const o=t||e;if(!o){return"unknown"}const i=o.split(".").pop().toLowerCase();const r={pdf:"pdf",jpg:"image",jpeg:"image",heic:"image",bmp:"image",png:"image",gif:"image",svg:"image",svgz:"image",ep:"image",eps:"image",avi:"video",flv:"video",h264:"video",mov:"video",mp4:"video",mwv:"video",mkv:"video",mp3:"audio",wav:"audio",wma:"audio",ogg:"audio",txt:"text",json:"text",html:"text",xml:"text",doc:"office",docx:"office",odt:"office",dot:"office",dotx:"office",docm:"office",dotm:"office",pot:"office",ppt:"office",pptx:"office",odp:"office",potx:"office",potm:"office",pps:"office",ppsx:"office",ppsm:"office",pptm:"office",ppam:"office",pages:"office",xls:"office",xlsx:"office",xlsm:"office",xlsb:"office",ods:"office",csv:"office",numbers:"office"};return r[i]||"unknown"}class n{constructor(t){this.requestFullscreen=()=>{if(this.enter){this.enter()}};this.exitFullscreen=()=>{if(this.exit){this.exit.bind(window.document)()}};this.toggle=()=>{const t=window.document;const e=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement;if(e){this.exitFullscreen()}else{this.requestFullscreen()}};this.enter=t.requestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen;this.enter=this.enter.bind(t);const e=window.document;this.exit=e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen}isSupported(){return!!this.requestFullscreen}}const a=':host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host{isolation:isolate;position:relative;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;height:100%}*{box-sizing:border-box}img,video,audio,object,iframe{max-height:100%;max-width:100%;box-sizing:border-box}iframe{border:none;width:100%;height:100%;min-height:20rem}img{min-width:7rem;object-fit:contain}video{width:100%;height:auto}audio{width:100%}object{width:100%;height:100%}object[type="application/pdf"]{min-height:20rem}object[type="text/plain"]{border-radius:0.25rem;padding-right:2rem;overflow-y:auto}:host(:fullscreen){background-color:rgb(var(--color-gray-darker))}:host(:fullscreen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}:host(:-webkit-full-screen){background-color:rgb(var(--color-gray-darker))}:host(:-webkit-full-screen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}.buttons{position:absolute;z-index:1;top:0.25rem;right:0.25rem;display:flex;flex-direction:column;gap:0.25rem}@media (pointer: coarse){.buttons{gap:0.5rem}}.no-support{display:flex;flex-direction:column;align-items:center;border:1px dashed rgb(var(--contrast-600));border-radius:0.5rem;padding:1.25rem}.no-support .icon--warning{color:rgb(var(--color-orange-default))}[class^=button--]{all:unset;transition:color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);display:flex;align-items:center;justify-content:center;border-radius:50%;width:2rem;height:2rem;background-color:rgba(var(--contrast-100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}[class^=button--]:hover{color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}[class^=button--]:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}[class^=button--]:focus{outline:none}[class^=button--]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}[class^=button--] limel-icon{transition:color 0.2s ease;width:1.25rem;color:rgb(var(--contrast-1200))}[class^=button--]:hover limel-icon{color:rgb(var(--contrast-1400))}.action-menu-for-pdf-files,.action-menu-for-office-files{position:absolute;right:0.75rem}.action-menu-for-pdf-files{bottom:0.75rem}.action-menu-for-office-files{top:0.75rem}';const c=class{constructor(i){t(this,i);this.action=e(this,"action",7);this.renderPdf=()=>[o("div",{class:"action-menu-for-pdf-files"},this.renderActionMenu()),o("iframe",{src:this.fileUrl})];this.renderImage=()=>[this.renderButtons(),o("img",{src:this.fileUrl,alt:this.alt})];this.renderVideo=()=>o("video",{controls:true},o("source",{src:this.fileUrl}));this.renderAudio=()=>o("audio",{controls:true},o("source",{src:this.fileUrl}));this.renderText=()=>[this.renderButtons(),o("object",{data:this.fileUrl,type:"text/plain"})];this.renderOffice=()=>[o("div",{class:"action-menu-for-office-files"},this.renderActionMenu()),o("iframe",{src:this.getOfficeViewerUrl()+this.fileUrl+"&embedded=true",frameborder:"0"})];this.isOfficeFileAccessibleViaURL=()=>this.fileType==="office"&&!(this.fileUrl.startsWith("http://")||this.fileUrl.startsWith("https://"));this.getOfficeViewerUrl=()=>{const t={"microsoft-office":"https://view.officeapps.live.com/op/embed.aspx?src=","google-drive":"https://docs.google.com/gview?url="};return t[this.officeViewer]};this.renderNoFileSupportMessage=()=>o("div",{class:"no-support"},o("limel-icon",{class:"icon--warning",name:"brake_warning",size:"large",role:"presentation"}),o("p",null,this.getTranslation("message.unsupported-filetype")),this.renderDownloadButton());this.renderButtons=()=>o("div",{class:"buttons"},this.renderActionMenu(),this.renderToggleFullscreenButton(),this.renderDownloadButton(),this.renderOpenInNewTabButton());this.renderToggleFullscreenButton=()=>{if(!this.allowFullscreen||!this.fullscreen.isSupported()){return}const t=this.isFullscreen?"multiply":"fit_to_width";const e=this.isFullscreen?this.getTranslation("exit-fullscreen"):this.getTranslation("open-in-fullscreen");return[o("button",{class:"button--toggle-fullscreen",id:"tooltip-toggle-fullscreen",role:"button",onClick:this.handleToggleFullscreen},o("limel-icon",{name:t}),o("limel-tooltip",{label:e,elementId:"tooltip-toggle-fullscreen",openDirection:"left"}))]};this.renderDownloadButton=()=>{if(!this.allowDownload||this.isFullscreen){return}return o("a",{class:"button--download",id:"tooltip-download",role:"button",download:this.filename?this.filename:"",href:this.fileUrl,target:"_blank"},o("limel-icon",{name:"download_2"}),o("limel-tooltip",{label:this.getTranslation("download"),elementId:"tooltip-download",openDirection:"left"}))};this.renderOpenInNewTabButton=()=>{if(!this.allowOpenInNewTab||this.isFullscreen){return}return o("a",{class:"button--new-tab",id:"tooltip-new-tab",role:"button",href:this.fileUrl,target:"_blank",rel:"noopener noreferrer"},o("limel-icon",{name:"external_link"}),o("limel-tooltip",{label:this.getTranslation("open-in-new-tab"),elementId:"tooltip-new-tab",openDirection:"left"}))};this.renderActionMenu=()=>{if(!this.actions||this.isFullscreen){return}return o("limel-menu",{class:"action-menu",items:this.actions,onSelect:this.emitOnAction,"open-direction":"left"},o("button",{class:"button--action",id:"tooltip-more",role:"button",slot:"trigger"},o("limel-icon",{name:"menu_2"}),o("limel-tooltip",{label:this.getTranslation("more-actions"),elementId:"tooltip-more",openDirection:"left"})))};this.createURL=async t=>{if(["pdf"].includes(t)){const t=await fetch(this.url);const e=await t.blob();this.fileUrl=URL.createObjectURL(e)}else{this.fileUrl=this.url}this.loading=false};this.handleToggleFullscreen=()=>{if(this.fullscreen.isSupported()){this.fullscreen.toggle();this.isFullscreen=!this.isFullscreen}};this.emitOnAction=t=>{t.stopPropagation();this.action.emit(t.detail)};this.url=undefined;this.filename=undefined;this.alt=undefined;this.allowFullscreen=false;this.allowOpenInNewTab=false;this.allowDownload=false;this.language="en";this.officeViewer="microsoft-office";this.actions=undefined;this.isFullscreen=false;this.fileType=undefined;this.loading=true;this.fileUrl="";this.fullscreen=new n(this.HostElement)}async componentWillLoad(){this.fileType=s(this.filename,this.url);await this.createURL(this.url)}render(){if(!this.isOfficeFileAccessibleViaURL){return this.renderNoFileSupportMessage()}if(this.loading){return o("limel-spinner",{size:"x-small",limeBranded:false})}return this.renderFileViewer()}async watchUrl(t,e){if(t===e){return}this.loading=true;this.fileType=s(this.filename,this.fileUrl);await this.createURL(this.fileType)}renderFileViewer(){const t={pdf:this.renderPdf,image:this.renderImage,video:this.renderVideo,audio:this.renderAudio,text:this.renderText,office:this.renderOffice};const e=t[this.fileType]||this.renderNoFileSupportMessage;return e()}getTranslation(t){return r.get(`file-viewer.${t}`,this.language)}get HostElement(){return i(this)}static get watchers(){return{url:["watchUrl"]}}};c.style=a;export{c as limel_file_viewer};
2
+ //# sourceMappingURL=p-b4f1c135.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["detectExtension","fileName","url","pathLike","extension","split","pop","toLowerCase","extensionsToTypes","pdf","jpg","jpeg","heic","bmp","png","gif","svg","svgz","ep","eps","avi","flv","h264","mov","mp4","mwv","mkv","mp3","wav","wma","ogg","txt","json","html","xml","doc","docx","odt","dot","dotx","docm","dotm","pot","ppt","pptx","odp","potx","potm","pps","ppsx","ppsm","pptm","ppam","pages","xls","xlsx","xlsm","xlsb","ods","csv","numbers","Fullscreen","constructor","element","this","requestFullscreen","enter","exitFullscreen","exit","bind","window","document","toggle","isFullscreen","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","msRequestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msExitFullscreen","mozCancelFullScreen","webkitExitFullscreen","isSupported","fileViewerCss","FileViewer","hostRef","renderPdf","h","class","renderActionMenu","src","fileUrl","renderImage","renderButtons","alt","renderVideo","controls","renderAudio","renderText","data","type","renderOffice","getOfficeViewerUrl","frameborder","isOfficeFileAccessibleViaURL","fileType","startsWith","officeViewers","officeViewer","renderNoFileSupportMessage","name","size","role","getTranslation","renderDownloadButton","renderToggleFullscreenButton","renderOpenInNewTabButton","allowFullscreen","fullscreen","icon","label","id","onClick","handleToggleFullscreen","elementId","openDirection","allowDownload","download","filename","href","target","allowOpenInNewTab","rel","actions","items","onSelect","emitOnAction","slot","createURL","async","includes","response","fetch","blob","URL","createObjectURL","loading","event","stopPropagation","action","emit","detail","HostElement","render","limeBranded","renderFileViewer","newUrl","oldUrl","fileViewerFunctions","image","video","audio","text","office","fileViewerFunction","key","translate","get","language"],"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"],"mappings":"sGAAgBA,EAAgBC,EAAUC,GACtC,MAAMC,EAAWF,GAAYC,EAC7B,IAAKC,EAAU,CACX,MAAO,S,CAGX,MAAMC,EAAYD,EAASE,MAAM,KAAKC,MAAMC,cAC5C,MAAMC,EAAoB,CACtBC,IAAK,MACLC,IAAK,QACLC,KAAM,QACNC,KAAM,QACNC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,KAAM,QACNC,GAAI,QACJC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,KAAM,QACNC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,QACLC,IAAK,OACLC,KAAM,OACNC,KAAM,OACNC,IAAK,OAELC,IAAK,SACLC,KAAM,SACNC,IAAK,SACLC,IAAK,SACLC,KAAM,SACNC,KAAM,SACNC,KAAM,SAENC,IAAK,SACLC,IAAK,SACLC,KAAM,SACNC,IAAK,SACLC,KAAM,SACNC,KAAM,SACNC,IAAK,SACLC,KAAM,SACNC,KAAM,SACNC,KAAM,SACNC,KAAM,SACNC,MAAO,SAEPC,IAAK,SACLC,KAAM,SACNC,KAAM,SACNC,KAAM,SACNC,IAAK,SACLC,IAAK,SACLC,QAAS,UAGb,OAAOpD,EAAkBJ,IAAc,SAC3C,C,MClEayD,EAITC,YAAYC,GAeLC,KAAAC,kBAAoB,KACvB,GAAID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,mB,yCAqBJ,M,qCASL,K,aAGD,GAGtBzF,KAAKwD,WAAa,IAAI3D,EAAWG,KAAK0F,Y,CAGnCb,0BACH7E,KAAK2C,SAAW3G,EAAgBgE,KAAKkE,SAAUlE,KAAK9D,WAC9C8D,KAAK4E,UAAU5E,KAAK9D,I,CAGvByJ,SACH,IAAK3F,KAAK0C,6BAA8B,CACpC,OAAO1C,KAAK+C,4B,CAGhB,GAAI/C,KAAKoF,QAAS,CACd,OAAO3D,EAAA,iBAAewB,KAAK,UAAU2C,YAAa,O,CAGtD,OAAO5F,KAAK6F,kB,CAINhB,eAAeiB,EAAgBC,GACrC,GAAID,IAAWC,EAAQ,CACnB,M,CAGJ/F,KAAKoF,QAAU,KACfpF,KAAK2C,SAAW3G,EAAgBgE,KAAKkE,SAAUlE,KAAK6B,eAC9C7B,KAAK4E,UAAU5E,KAAK2C,S,CAGtBkD,mBACJ,MAAMG,EAAsB,CACxBvJ,IAAKuD,KAAKwB,UACVyE,MAAOjG,KAAK8B,YACZoE,MAAOlG,KAAKiC,YACZkE,MAAOnG,KAAKmC,YACZiE,KAAMpG,KAAKoC,WACXiE,OAAQrG,KAAKuC,cAEjB,MAAM+D,EACFN,EAAoBhG,KAAK2C,WACzB3C,KAAK+C,2BAET,OAAOuD,G,CAyOHnD,eAAeoD,GACnB,OAAOC,EAAUC,IAAI,eAAeF,IAAOvG,KAAK0G,S"}
@@ -0,0 +1,2 @@
1
+ import{r as e,h as i,H as t}from"./p-3075aa67.js";const s=":host(limel-helper-line){transition:opacity 0.2s ease;box-sizing:border-box;display:grid;min-width:0;font-family:Roboto, sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:0.6875rem;font-weight:400;letter-spacing:0.0333333333em;line-height:normal;color:rgb(var(--contrast-1200))}div{display:flex;justify-content:space-between;gap:0.75rem;overflow:hidden;padding:0 1rem}:host(limel-helper-line.invalid) .helper-text{color:var(--mdc-theme-error)}.counter{flex-shrink:0;margin-left:auto}.helper-text,.counter{padding-top:0.125rem}:host(limel-helper-line){transition:grid-template-rows var(--limel-h-l-grid-template-rows-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89);grid-template-rows:var(--limel-h-l-grid-template-rows, 1fr)}:host(limel-helper-line.hide){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}";const r=class{constructor(t){e(this,t);this.hasContent=()=>!!(this.maxLength>0||this.helperText&&this.helperText.length>0);this.renderHelperText=()=>{if(!this.helperText){return}return i("span",{class:"helper-text",id:this.helperTextId},this.helperText)};this.renderCharacterCounter=()=>{const e=`${this.length} / ${this.maxLength}`;if(!this.maxLength){return}return i("span",{class:"counter"},e)};this.helperText=undefined;this.length=undefined;this.maxLength=undefined;this.invalid=false;this.helperTextId=undefined}render(){return i(t,{tabIndex:-1,class:{invalid:this.invalid},style:!this.hasContent()?{display:"none"}:{},"aria-hidden":!this.hasContent()},i("div",null,this.renderHelperText(),this.renderCharacterCounter()))}};r.style=s;export{r as limel_helper_line};
2
+ //# sourceMappingURL=p-eacad510.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["helperLineCss","HelperLine","this","hasContent","maxLength","helperText","length","renderHelperText","h","class","id","helperTextId","renderCharacterCounter","counter","render","Host","tabIndex","invalid","style","display"],"sources":["./src/components/helper-line/helper-line.scss?tag=limel-helper-line&encapsulation=shadow","./src/components/helper-line/helper-line.tsx"],"sourcesContent":[":host(limel-helper-line) {\n transition: opacity 0.2s ease;\n\n box-sizing: border-box;\n display: grid;\n\n min-width: 0; // prevents overflowing, if component is placed in flex containers\n\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.6875rem;\n font-weight: 400;\n letter-spacing: 0.0333333333em; // keeping this for now for consistency, until we get rid of all of them\n line-height: normal;\n\n color: rgb(var(--contrast-1200));\n}\n\ndiv {\n display: flex;\n justify-content: space-between;\n gap: 0.75rem;\n overflow: hidden;\n padding: 0 1rem;\n}\n\n:host(limel-helper-line.invalid) {\n .helper-text {\n color: var(--mdc-theme-error);\n }\n}\n\n.counter {\n flex-shrink: 0;\n margin-left: auto;\n}\n\n.helper-text,\n.counter {\n padding-top: 0.125rem;\n}\n\n// This animates height of the helper line, from `0` to `auto`.\n// To get this animation effect, the consumer component should\n// add `hide` classed accordingly.\n:host(limel-helper-line) {\n transition: grid-template-rows\n var(--limel-h-l-grid-template-rows-transition-speed, 0.46s)\n cubic-bezier(1, 0.09, 0, 0.89);\n grid-template-rows: var(--limel-h-l-grid-template-rows, 1fr);\n}\n\n:host(limel-helper-line.hide) {\n --limel-h-l-grid-template-rows-transition-speed: 0.3s;\n --limel-h-l-grid-template-rows: 0fr;\n}\n// End: animating height\n","import { Component, Host, Prop, h } from '@stencil/core';\n\n/**\n * This is an internal and private component that many input fields\n * use to display a helper text, along with a character counter below the\n * input field.\n *\n * We created this to keep the visual styles the same everywhere\n * and to avoid importing styles separately.\n *\n * Also this enables us to open the helper line in limel-portal,\n * more easily without having to send the styles to the portal.\n * @exampleComponent limel-example-helper-line\n * @exampleComponent limel-example-helper-line-invalid\n * @exampleComponent limel-example-helper-line-long-text\n * @exampleComponent limel-example-helper-line-long-text-no-counter\n * @exampleComponent limel-example-helper-line-character-counter\n * @exampleComponent limel-example-helper-line-empty\n * @exampleComponent limel-example-helper-line-animation\n * @private\n */\n@Component({\n tag: 'limel-helper-line',\n shadow: true,\n styleUrl: 'helper-line.scss',\n})\nexport class HelperLine {\n /**\n * The helper text that is displayed on the left side.\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * Length of the current input value, coming from the parent component.\n * Used in the character counter section on the right side.\n */\n @Prop({ reflect: true })\n public length?: number;\n\n /**\n * Maximum length of the characters, defined on the parent component.\n * Used in the character counter section on the right side.\n */\n @Prop({ reflect: true })\n public maxLength?: number;\n\n /**\n * Turns `true`, when the parent component is invalid.\n * For example, when the parent component is `required` but is left empty.\n * Or when the input format is invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean = false;\n\n /**\n * Used by `aria-controls` and `aria-describedby` in the parent component.\n */\n @Prop({ reflect: true })\n public helperTextId?: string;\n\n public render() {\n return (\n <Host\n tabIndex={-1}\n class={{\n invalid: this.invalid,\n }}\n style={!this.hasContent() ? { display: 'none' } : {}}\n aria-hidden={!this.hasContent()}\n >\n <div>\n {this.renderHelperText()}\n {this.renderCharacterCounter()}\n </div>\n </Host>\n );\n }\n\n private hasContent = () => {\n return !!(\n this.maxLength > 0 ||\n (this.helperText && this.helperText.length > 0)\n );\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <span class=\"helper-text\" id={this.helperTextId}>\n {this.helperText}\n </span>\n );\n };\n\n private renderCharacterCounter = () => {\n const counter = `${this.length} / ${this.maxLength}`;\n\n if (!this.maxLength) {\n return;\n }\n\n return <span class=\"counter\">{counter}</span>;\n };\n}\n"],"mappings":"kDAAA,MAAMA,EAAgB,63B,MC0BTC,EAAU,M,yBAqDXC,KAAAC,WAAa,OAEbD,KAAKE,UAAY,GAChBF,KAAKG,YAAcH,KAAKG,WAAWC,OAAS,GAI7CJ,KAAAK,iBAAmB,KACvB,IAAKL,KAAKG,WAAY,CAClB,M,CAGJ,OACIG,EAAA,QAAMC,MAAM,cAAcC,GAAIR,KAAKS,cAC9BT,KAAKG,WACH,EAIPH,KAAAU,uBAAyB,KAC7B,MAAMC,EAAU,GAAGX,KAAKI,YAAYJ,KAAKE,YAEzC,IAAKF,KAAKE,UAAW,CACjB,M,CAGJ,OAAOI,EAAA,QAAMC,MAAM,WAAWI,EAAe,E,sFApDtB,M,4BAQpBC,SACH,OACIN,EAACO,EAAI,CACDC,UAAW,EACXP,MAAO,CACHQ,QAASf,KAAKe,SAElBC,OAAQhB,KAAKC,aAAe,CAAEgB,QAAS,QAAW,GAAE,eACtCjB,KAAKC,cAEnBK,EAAA,WACKN,KAAKK,mBACLL,KAAKU,0B"}
@@ -49,6 +49,11 @@ export declare class ChipSet {
49
49
  * the chip-set.
50
50
  */
51
51
  readonly: boolean;
52
+ /**
53
+ * Set to `true` to indicate that the current value of the input field is
54
+ * invalid.
55
+ */
56
+ invalid: boolean;
52
57
  /**
53
58
  * For chip-sets of type `input`. Value to use for the `type` attribute on the
54
59
  * input field inside the chip-set.
@@ -54,6 +54,11 @@ export declare class File {
54
54
  * with any already existing file.
55
55
  */
56
56
  readonly: boolean;
57
+ /**
58
+ * Set to `true` to indicate that the current value of the chosen file is
59
+ * invalid.
60
+ */
61
+ invalid: boolean;
57
62
  /**
58
63
  * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)
59
64
  */
@@ -42,6 +42,11 @@ export declare class Picker {
42
42
  * True if the control requires a value
43
43
  */
44
44
  required: boolean;
45
+ /**
46
+ * Set to `true` to indicate that the current value of the input field is
47
+ * invalid.
48
+ */
49
+ invalid: boolean;
45
50
  /**
46
51
  * Currently selected value or values
47
52
  */
@@ -364,6 +364,10 @@ export namespace Components {
364
364
  * For chip-sets of type `input`. Value to use for the `type` attribute on the input field inside the chip-set.
365
365
  */
366
366
  "inputType": 'search' | 'text';
367
+ /**
368
+ * Set to `true` to indicate that the current value of the input field is invalid.
369
+ */
370
+ "invalid": boolean;
367
371
  /**
368
372
  * Label for the chip-set
369
373
  */
@@ -768,6 +772,10 @@ export namespace Components {
768
772
  * True if the input should be disabled
769
773
  */
770
774
  "disabled": boolean;
775
+ /**
776
+ * Set to `true` to indicate that the current value of the chosen file is invalid.
777
+ */
778
+ "invalid": boolean;
771
779
  /**
772
780
  * The input label.
773
781
  */
@@ -1502,6 +1510,10 @@ export namespace Components {
1502
1510
  * Optional helper text to display below the input field when it has focus
1503
1511
  */
1504
1512
  "helperText": string;
1513
+ /**
1514
+ * Set to `true` to indicate that the current value of the input field is invalid.
1515
+ */
1516
+ "invalid": boolean;
1505
1517
  /**
1506
1518
  * Text to display for the input field of the picker
1507
1519
  */
@@ -3840,6 +3852,10 @@ declare namespace LocalJSX {
3840
3852
  * For chip-sets of type `input`. Value to use for the `type` attribute on the input field inside the chip-set.
3841
3853
  */
3842
3854
  "inputType"?: 'search' | 'text';
3855
+ /**
3856
+ * Set to `true` to indicate that the current value of the input field is invalid.
3857
+ */
3858
+ "invalid"?: boolean;
3843
3859
  /**
3844
3860
  * Label for the chip-set
3845
3861
  */
@@ -4322,6 +4338,10 @@ declare namespace LocalJSX {
4322
4338
  * True if the input should be disabled
4323
4339
  */
4324
4340
  "disabled"?: boolean;
4341
+ /**
4342
+ * Set to `true` to indicate that the current value of the chosen file is invalid.
4343
+ */
4344
+ "invalid"?: boolean;
4325
4345
  /**
4326
4346
  * The input label.
4327
4347
  */
@@ -5112,6 +5132,10 @@ declare namespace LocalJSX {
5112
5132
  * Optional helper text to display below the input field when it has focus
5113
5133
  */
5114
5134
  "helperText"?: string;
5135
+ /**
5136
+ * Set to `true` to indicate that the current value of the input field is invalid.
5137
+ */
5138
+ "invalid"?: boolean;
5115
5139
  /**
5116
5140
  * Text to display for the input field of the picker
5117
5141
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "37.1.0-next.54",
3
+ "version": "37.1.0-next.56",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -50,8 +50,8 @@
50
50
  "@types/html-escaper": "^3.0.1",
51
51
  "@types/jest": "^27.4.0",
52
52
  "@types/lodash-es": "^4.17.10",
53
- "@types/react": "^18.2.34",
54
- "@types/react-dom": "^18.2.14",
53
+ "@types/react": "^18.2.37",
54
+ "@types/react-dom": "^18.2.15",
55
55
  "@types/tabulator-tables": "^4.9.4",
56
56
  "@typescript-eslint/eslint-plugin": "^5.61.0",
57
57
  "@typescript-eslint/parser": "^5.62.0",
@@ -59,7 +59,7 @@
59
59
  "codemirror": "^5.65.9",
60
60
  "cross-env": "^7.0.3",
61
61
  "dayjs": "^1.11.10",
62
- "eslint": "^8.52.0",
62
+ "eslint": "^8.53.0",
63
63
  "eslint-config-prettier": "^9.0.0",
64
64
  "eslint-plugin-ban": "^1.6.0",
65
65
  "eslint-plugin-jsdoc": "^46.8.2",
@@ -1,2 +0,0 @@
1
- import{r as e,h as i,H as t}from"./p-3075aa67.js";const s=":host(limel-helper-line){transition:opacity 0.2s ease;box-sizing:border-box;display:grid;min-width:0;font-family:Roboto, sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:0.6875rem;font-weight:400;letter-spacing:0.0333333333em;line-height:normal;color:rgb(var(--contrast-1200))}div{display:flex;justify-content:space-between;gap:0.75rem;overflow:hidden;padding:0 1rem}:host(limel-helper-line.invalid) .helper-text{color:var(--mdc-theme-error)}.counter{flex-shrink:0;margin-left:auto}.helper-text,.counter{padding-top:0.125rem}:host(limel-helper-line){--limel-h-l-grid-template-rows-transition-speed:0.46s;transition:grid-template-rows var(--limel-h-l-grid-template-rows-transition-speed) cubic-bezier(1, 0.09, 0, 0.89);grid-template-rows:1fr}:host(limel-helper-line.hide){--limel-h-l-grid-template-rows-transition-speed:0.3s;grid-template-rows:0fr}";const r=class{constructor(t){e(this,t);this.hasContent=()=>!!(this.maxLength>0||this.helperText&&this.helperText.length>0);this.renderHelperText=()=>{if(!this.helperText){return}return i("span",{class:"helper-text",id:this.helperTextId},this.helperText)};this.renderCharacterCounter=()=>{const e=`${this.length} / ${this.maxLength}`;if(!this.maxLength){return}return i("span",{class:"counter"},e)};this.helperText=undefined;this.length=undefined;this.maxLength=undefined;this.invalid=false;this.helperTextId=undefined}render(){return i(t,{tabIndex:-1,class:{invalid:this.invalid},style:!this.hasContent()?{display:"none"}:{},"aria-hidden":!this.hasContent()},i("div",null,this.renderHelperText(),this.renderCharacterCounter()))}};r.style=s;export{r as limel_helper_line};
2
- //# sourceMappingURL=p-1f6953d2.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["helperLineCss","HelperLine","this","hasContent","maxLength","helperText","length","renderHelperText","h","class","id","helperTextId","renderCharacterCounter","counter","render","Host","tabIndex","invalid","style","display"],"sources":["./src/components/helper-line/helper-line.scss?tag=limel-helper-line&encapsulation=shadow","./src/components/helper-line/helper-line.tsx"],"sourcesContent":[":host(limel-helper-line) {\n transition: opacity 0.2s ease;\n\n box-sizing: border-box;\n display: grid;\n\n min-width: 0; // prevents overflowing, if component is placed in flex containers\n\n font-family: Roboto, sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n font-size: 0.6875rem;\n font-weight: 400;\n letter-spacing: 0.0333333333em; // keeping this for now for consistency, until we get rid of all of them\n line-height: normal;\n\n color: rgb(var(--contrast-1200));\n}\n\ndiv {\n display: flex;\n justify-content: space-between;\n gap: 0.75rem;\n overflow: hidden;\n padding: 0 1rem;\n}\n\n:host(limel-helper-line.invalid) {\n .helper-text {\n color: var(--mdc-theme-error);\n }\n}\n\n.counter {\n flex-shrink: 0;\n margin-left: auto;\n}\n\n.helper-text,\n.counter {\n padding-top: 0.125rem;\n}\n\n// This animates height of the helper line, from `0` to `auto`.\n// To get this animation effect, the consumer component should\n// add `hide` classed accordingly.\n:host(limel-helper-line) {\n --limel-h-l-grid-template-rows-transition-speed: 0.46s; // for internal use only!\n\n transition: grid-template-rows\n var(--limel-h-l-grid-template-rows-transition-speed)\n cubic-bezier(1, 0.09, 0, 0.89);\n grid-template-rows: 1fr;\n}\n\n:host(limel-helper-line.hide) {\n --limel-h-l-grid-template-rows-transition-speed: 0.3s;\n grid-template-rows: 0fr;\n}\n// End: animating height\n","import { Component, Host, Prop, h } from '@stencil/core';\n\n/**\n * This is an internal and private component that many input fields\n * use to display a helper text, along with a character counter below the\n * input field.\n *\n * We created this to keep the visual styles the same everywhere\n * and to avoid importing styles separately.\n *\n * Also this enables us to open the helper line in limel-portal,\n * more easily without having to send the styles to the portal.\n * @exampleComponent limel-example-helper-line\n * @exampleComponent limel-example-helper-line-invalid\n * @exampleComponent limel-example-helper-line-long-text\n * @exampleComponent limel-example-helper-line-long-text-no-counter\n * @exampleComponent limel-example-helper-line-character-counter\n * @exampleComponent limel-example-helper-line-empty\n * @exampleComponent limel-example-helper-line-animation\n * @private\n */\n@Component({\n tag: 'limel-helper-line',\n shadow: true,\n styleUrl: 'helper-line.scss',\n})\nexport class HelperLine {\n /**\n * The helper text that is displayed on the left side.\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * Length of the current input value, coming from the parent component.\n * Used in the character counter section on the right side.\n */\n @Prop({ reflect: true })\n public length?: number;\n\n /**\n * Maximum length of the characters, defined on the parent component.\n * Used in the character counter section on the right side.\n */\n @Prop({ reflect: true })\n public maxLength?: number;\n\n /**\n * Turns `true`, when the parent component is invalid.\n * For example, when the parent component is `required` but is left empty.\n * Or when the input format is invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean = false;\n\n /**\n * Used by `aria-controls` and `aria-describedby` in the parent component.\n */\n @Prop({ reflect: true })\n public helperTextId?: string;\n\n public render() {\n return (\n <Host\n tabIndex={-1}\n class={{\n invalid: this.invalid,\n }}\n style={!this.hasContent() ? { display: 'none' } : {}}\n aria-hidden={!this.hasContent()}\n >\n <div>\n {this.renderHelperText()}\n {this.renderCharacterCounter()}\n </div>\n </Host>\n );\n }\n\n private hasContent = () => {\n return !!(\n this.maxLength > 0 ||\n (this.helperText && this.helperText.length > 0)\n );\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <span class=\"helper-text\" id={this.helperTextId}>\n {this.helperText}\n </span>\n );\n };\n\n private renderCharacterCounter = () => {\n const counter = `${this.length} / ${this.maxLength}`;\n\n if (!this.maxLength) {\n return;\n }\n\n return <span class=\"counter\">{counter}</span>;\n };\n}\n"],"mappings":"kDAAA,MAAMA,EAAgB,23B,MC0BTC,EAAU,M,yBAqDXC,KAAAC,WAAa,OAEbD,KAAKE,UAAY,GAChBF,KAAKG,YAAcH,KAAKG,WAAWC,OAAS,GAI7CJ,KAAAK,iBAAmB,KACvB,IAAKL,KAAKG,WAAY,CAClB,M,CAGJ,OACIG,EAAA,QAAMC,MAAM,cAAcC,GAAIR,KAAKS,cAC9BT,KAAKG,WACH,EAIPH,KAAAU,uBAAyB,KAC7B,MAAMC,EAAU,GAAGX,KAAKI,YAAYJ,KAAKE,YAEzC,IAAKF,KAAKE,UAAW,CACjB,M,CAGJ,OAAOI,EAAA,QAAMC,MAAM,WAAWI,EAAe,E,sFApDtB,M,4BAQpBC,SACH,OACIN,EAACO,EAAI,CACDC,UAAW,EACXP,MAAO,CACHQ,QAASf,KAAKe,SAElBC,OAAQhB,KAAKC,aAAe,CAAEgB,QAAS,QAAW,GAAE,eACtCjB,KAAKC,cAEnBK,EAAA,WACKN,KAAKK,mBACLL,KAAKU,0B"}