@hotosm/ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -6
- package/dist/chunks/chunk.3RPYDHJV.js +1 -0
- package/dist/chunks/chunk.5NFC3HMD.js +1 -0
- package/dist/chunks/{chunk.EOTM323U.js → chunk.7BVHA4G6.js} +1 -1
- package/dist/chunks/{chunk.G3Z3BOX2.js → chunk.7G6VEQ2R.js} +1 -1
- package/dist/chunks/chunk.ARF626EG.js +59 -0
- package/dist/chunks/{chunk.YH5QYI7V.js → chunk.BD4Q32VT.js} +1 -1
- package/dist/chunks/chunk.CQO3GWTI.js +32 -0
- package/dist/chunks/{chunk.EAG35WPB.js → chunk.EB2T3VFE.js} +1 -1
- package/dist/chunks/{chunk.EYNFK5TH.js → chunk.GEAU3JJH.js} +1 -1
- package/dist/chunks/{chunk.VA2JNCZO.js → chunk.GLN7KYWH.js} +1 -1
- package/dist/chunks/{chunk.6TJUNYFL.js → chunk.LHZ7Q2M3.js} +1 -1
- package/dist/chunks/{chunk.3DAASGWT.js → chunk.PBBH42B6.js} +1 -1
- package/dist/chunks/{chunk.LR75BDGN.js → chunk.PLECT4NZ.js} +1 -1
- package/dist/chunks/chunk.QABMDRWR.js +28 -0
- package/dist/chunks/chunk.SLA5IPJG.js +1 -0
- package/dist/chunks/chunk.TMMJP2DW.js +1 -0
- package/dist/chunks/chunk.VXTJYHK5.js +1 -0
- package/dist/chunks/chunk.W372S2KG.js +1 -0
- package/dist/chunks/chunk.WTTPHBL3.js +105 -0
- package/dist/chunks/chunk.XDXYJBLZ.js +1 -0
- package/dist/chunks/{chunk.BB52VMVE.js → chunk.XNZFLEXO.js} +1 -1
- package/dist/chunks/chunk.ZETV7TDG.js +25 -0
- package/dist/components/consent/consent.component.js +1 -1
- package/dist/components/consent/consent.js +1 -1
- package/dist/components/consent/consent.styles.js +1 -1
- package/dist/components/file-input-dropzone/file-input-dropzone.component.js +1 -1
- package/dist/components/file-input-dropzone/file-input-dropzone.js +1 -1
- package/dist/components/file-input-dropzone/file-input-dropzone.styles.js +1 -1
- package/dist/components/header/header.component.js +1 -1
- package/dist/components/header/header.js +1 -1
- package/dist/components/header/header.styles.js +1 -1
- package/dist/components/list-card/list-card.component.js +1 -1
- package/dist/components/list-card/list-card.js +1 -1
- package/dist/components/list-card/list-card.styles.js +1 -1
- package/dist/components/logo/logo.component.js +1 -1
- package/dist/components/logo/logo.js +1 -1
- package/dist/components/logo/logo.styles.js +1 -1
- package/dist/components/tool-menu/tool-menu.component.d.ts +13 -0
- package/dist/components/tool-menu/tool-menu.component.js +1 -0
- package/dist/components/tool-menu/tool-menu.d.ts +7 -0
- package/dist/components/tool-menu/tool-menu.js +1 -0
- package/dist/components/tool-menu/tool-menu.styles.d.ts +1 -0
- package/dist/components/tool-menu/tool-menu.styles.js +1 -0
- package/dist/components/tracking/tracking.component.js +1 -1
- package/dist/components/tracking/tracking.js +1 -1
- package/dist/hotosm-ui.d.ts +9 -8
- package/dist/hotosm-ui.js +1 -1
- package/package.json +8 -4
- package/dist/chunks/chunk.5AWU5BEU.js +0 -1
- package/dist/chunks/chunk.FBYBLQYY.js +0 -25
- package/dist/chunks/chunk.JFO3Z4VS.js +0 -1
- package/dist/chunks/chunk.KNTMZWRV.js +0 -28
- package/dist/chunks/chunk.L3MJ3UC7.js +0 -1
- package/dist/chunks/chunk.OFDFUT7C.js +0 -1
- package/dist/chunks/chunk.VNFZXHID.js +0 -1
- package/dist/chunks/chunk.XNPNEHIJ.js +0 -1
- package/dist/chunks/chunk.ZU62FSGZ.js +0 -105
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk.LR75BDGN.js";var a=e;customElements.define("hot-list-card",e);export{a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk.EAG35WPB.js";var r=e;customElements.define("hot-header",e);export{r as a};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import{a as M}from"./chunk.EYNFK5TH.js";import{a as f,b as m,c as z}from"./chunk.FBYBLQYY.js";import{d as h,e as x,f as F}from"./chunk.KNTMZWRV.js";import{d as n,e as o,f as d,g as c}from"./chunk.N2W26RCT.js";var E={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},y=l=>(...a)=>({_$litDirective$:l,values:a}),$=class{constructor(a){}get _$AU(){return this._$AM._$AU}_$AT(a,e,i){this._$Ct=a,this._$AM=e,this._$Ci=i}_$AS(a,e){return this.update(a,e)}update(a,e){return this.render(...e)}};var _=y(class extends ${constructor(l){var a;if(super(l),l.type!==E.ATTRIBUTE||l.name!=="class"||((a=l.strings)==null?void 0:a.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(l){return" "+Object.keys(l).filter((a=>l[a])).join(" ")+" "}update(l,[a]){var i,s;if(this.st===void 0){this.st=new Set,l.strings!==void 0&&(this.nt=new Set(l.strings.join(" ").split(/\s/).filter((t=>t!==""))));for(let t in a)a[t]&&!((i=this.nt)!=null&&i.has(t))&&this.st.add(t);return this.render(a)}let e=l.element.classList;for(let t of this.st)t in a||(e.remove(t),this.st.delete(t));for(let t in a){let p=!!a[t];p===this.st.has(t)||(s=this.nt)!=null&&s.has(t)||(p?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)))}return x}});import"@awesome.me/webawesome/dist/components/icon/icon.js";import"@awesome.me/webawesome/dist/components/divider/divider.js";var S,T,C,D,A,B,L,P,k,W,I,O,r=class extends F{constructor(){super(...arguments);this.name="hot-file-input-dropzone";d(this,S,!1);d(this,T,"");d(this,C,0);d(this,D,!0);d(this,A,!1);d(this,B,"");d(this,L,"traditional");d(this,P,!1);d(this,k,[]);d(this,W,"");d(this,I,"");d(this,O)}get multiple(){return o(this,S)}set multiple(e){c(this,S,e)}get accept(){return o(this,T)}set accept(e){c(this,T,e)}get maxSize(){return o(this,C)}set maxSize(e){c(this,C,e)}get showPreview(){return o(this,D)}set showPreview(e){c(this,D,e)}get disabled(){return o(this,A)}set disabled(e){c(this,A,e)}get label(){return o(this,B)}set label(e){c(this,B,e)}get variant(){return o(this,L)}set variant(e){c(this,L,e)}get isDragging(){return o(this,P)}set isDragging(e){c(this,P,e)}get selectedFiles(){return o(this,k)}set selectedFiles(e){c(this,k,e)}get errorMessage(){return o(this,W)}set errorMessage(e){c(this,W,e)}get statusMessage(){return o(this,I)}set statusMessage(e){c(this,I,e)}get fileInput(){return o(this,O)}set fileInput(e){c(this,O,e)}_generateId(){return`file-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}_handleDragOver(e){e.preventDefault(),e.stopPropagation(),this.disabled||(this.isDragging=!0)}_handleDragLeave(e){e.preventDefault(),e.stopPropagation(),this.isDragging=!1}_handleDrop(e){var s;if(e.preventDefault(),e.stopPropagation(),this.isDragging=!1,this.disabled)return;let i=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);this._processFiles(i)}_handleClick(){this.disabled||this.fileInput.click()}_handleKeyDown(e){!this.disabled&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.fileInput.click())}_handleFileInputChange(e){let i=e.target,s=Array.from(i.files||[]);this._processFiles(s)}_processFiles(e){if(this.errorMessage="",!this.multiple&&e.length>1){this.errorMessage="Only one file can be selected";return}if(this.accept){let t=this.accept.split(",").map(u=>u.trim().toLowerCase()),p=e.filter(u=>{let b=u.name.toLowerCase(),g=u.type.toLowerCase();return!t.some(v=>{if(v.startsWith("."))return b.endsWith(v);if(v.endsWith("/*")){let w=v.split("/")[0];if(g)return g.startsWith(w+"/");let j=b.substring(b.lastIndexOf("."));return this._getFileIcon(j).includes(w)}return g?g===v:!1})});if(p.length>0){this.errorMessage=`Invalid file type(s): ${p.map(u=>u.name).join(", ")}`;return}}if(this.maxSize>0){let t=e.filter(p=>p.size>this.maxSize);if(t.length>0){this.errorMessage=`File(s) exceed maximum size of ${this._formatFileSize(this.maxSize)}: ${t.map(p=>p.name).join(", ")}`;return}}let i=e.map(t=>({file:t,id:this._generateId()}));this.multiple?this.selectedFiles=[...i,...this.selectedFiles]:this.selectedFiles=i,this.dispatchEvent(new CustomEvent("hot-file-change",{detail:{files:this.selectedFiles.map(t=>t.file)},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("hot-files-selected",{detail:{files:i.map(t=>t.file),allFiles:this.selectedFiles.map(t=>t.file)},bubbles:!0,composed:!0}));let s=i.length;this.statusMessage=`${s} ${s===1?"file":"files"} selected: ${i.map(t=>t.file.name).join(", ")}`}_removeFile(e){let i=this.selectedFiles.find(s=>s.id===e);this.selectedFiles=this.selectedFiles.filter(s=>s.id!==e),this.fileInput&&(this.fileInput.value=""),this.dispatchEvent(new CustomEvent("hot-file-change",{detail:{files:this.selectedFiles.map(s=>s.file)},bubbles:!0,composed:!0})),i&&(this.statusMessage=`File removed: ${i.file.name}. ${this.selectedFiles.length} ${this.selectedFiles.length===1?"file":"files"} remaining.`)}_formatFileSize(e){if(e===0)return"0 Bytes";let i=1e3,s=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(i)),p=e/Math.pow(i,t);return`${Math.round(p*10)/10} ${s[t]}`}_getFileIcon(e){return e.startsWith("image/")?"file-image":e.startsWith("video/")?"file-video":e.startsWith("audio/")?"file-audio":e==="application/pdf"?"file-pdf":e.includes("word")?"file-word":e.includes("sheet")||e.includes("excel")?"file-excel":e.includes("zip")||e.includes("rar")||e.includes("7z")?"file-archive":e.includes("text")?"file-text":"file"}clearFiles(){this.selectedFiles=[],this.errorMessage="",this.fileInput&&(this.fileInput.value="")}getFiles(){return this.selectedFiles.map(e=>e.file)}render(){let e={dropzone:!0,"dropzone--dragging":this.isDragging,"dropzone--disabled":this.disabled,"dropzone--has-files":this.selectedFiles.length>0,"dropzone--compact":this.variant==="compact"},i=this.variant==="compact";return h`
|
|
2
|
-
<div class="file-input-dropzone">
|
|
3
|
-
${this.label&&this.variant==="traditional"?h`<label class="label" id="dropzone-label">${this.label}</label>`:""}
|
|
4
|
-
${this.variant==="traditional"?h`<wa-divider></wa-divider>`:""}
|
|
5
|
-
|
|
6
|
-
<div
|
|
7
|
-
class=${_(e)}
|
|
8
|
-
role="button"
|
|
9
|
-
tabindex=${this.disabled?"-1":"0"}
|
|
10
|
-
aria-disabled=${this.disabled}
|
|
11
|
-
aria-label=${this.label||"File upload"}
|
|
12
|
-
aria-describedby="dropzone-description${this.accept||this.maxSize?" dropzone-hints":""}"
|
|
13
|
-
@dragover=${this._handleDragOver}
|
|
14
|
-
@dragleave=${this._handleDragLeave}
|
|
15
|
-
@drop=${this._handleDrop}
|
|
16
|
-
@click=${this._handleClick}
|
|
17
|
-
@keydown=${this._handleKeyDown}
|
|
18
|
-
>
|
|
19
|
-
<input
|
|
20
|
-
type="file"
|
|
21
|
-
class="file-uploader"
|
|
22
|
-
?multiple=${this.multiple}
|
|
23
|
-
accept=${this.accept}
|
|
24
|
-
?disabled=${this.disabled}
|
|
25
|
-
@change=${this._handleFileInputChange}
|
|
26
|
-
aria-hidden="true"
|
|
27
|
-
tabindex="-1"
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<div class="dropzone-content">
|
|
31
|
-
<wa-icon
|
|
32
|
-
name="${i?"arrow-up-from-bracket":"cloud-arrow-up"}"
|
|
33
|
-
class="dropzone-icon"
|
|
34
|
-
aria-hidden="true"
|
|
35
|
-
></wa-icon>
|
|
36
|
-
<div class="dropzone-text">
|
|
37
|
-
${i?h`<div class="compact-text" id="dropzone-description">
|
|
38
|
-
${this.label}
|
|
39
|
-
</div>`:this.isDragging?h`<div id="dropzone-description">
|
|
40
|
-
Drop ${this.multiple?"files":"file"} here
|
|
41
|
-
</div>`:h`
|
|
42
|
-
<div class="dropzone-cta" id="dropzone-description">
|
|
43
|
-
<div>
|
|
44
|
-
Drop ${this.multiple?"files":"file"} here or
|
|
45
|
-
</div>
|
|
46
|
-
<div class="browse">browse</div>
|
|
47
|
-
</div>
|
|
48
|
-
${this.accept||this.maxSize?h`<div id="dropzone-hints">
|
|
49
|
-
${this.accept?h`<div class="dropzone-accept">
|
|
50
|
-
${this.accept.split(",").join(", ")} only
|
|
51
|
-
</div>`:""}
|
|
52
|
-
${this.maxSize?h`<div class="dropzone-maxsize">
|
|
53
|
-
Max size: ${this._formatFileSize(this.maxSize)}
|
|
54
|
-
</div>`:""}
|
|
55
|
-
</div>`:""}
|
|
56
|
-
`}
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
${this.errorMessage?h`
|
|
61
|
-
<div class="error-message" role="alert">
|
|
62
|
-
<wa-icon name="exclamation-circle"></wa-icon>
|
|
63
|
-
${this.errorMessage}
|
|
64
|
-
</div>
|
|
65
|
-
`:""}
|
|
66
|
-
${this.showPreview&&this.selectedFiles.length>0?h`
|
|
67
|
-
<div class="file-preview-list">
|
|
68
|
-
${this.selectedFiles.map(({file:s,id:t})=>h`
|
|
69
|
-
<hot-list-card
|
|
70
|
-
title=${s.name}
|
|
71
|
-
subtitle=${this._formatFileSize(s.size)}
|
|
72
|
-
icon=${this._getFileIcon(s.type)}
|
|
73
|
-
itemId=${t}
|
|
74
|
-
@hot-remove=${()=>this._removeFile(t)}
|
|
75
|
-
></hot-list-card>
|
|
76
|
-
`)}
|
|
77
|
-
</div>
|
|
78
|
-
`:""}
|
|
79
|
-
|
|
80
|
-
<div
|
|
81
|
-
class="sr-only"
|
|
82
|
-
role="status"
|
|
83
|
-
aria-live="polite"
|
|
84
|
-
aria-atomic="true"
|
|
85
|
-
>
|
|
86
|
-
${this.statusMessage}
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
`}};S=new WeakMap,T=new WeakMap,C=new WeakMap,D=new WeakMap,A=new WeakMap,B=new WeakMap,L=new WeakMap,P=new WeakMap,k=new WeakMap,W=new WeakMap,I=new WeakMap,O=new WeakMap,r.styles=[M],n([f({type:Boolean})],r.prototype,"multiple",1),n([f({type:String})],r.prototype,"accept",1),n([f({type:Number})],r.prototype,"maxSize",1),n([f({type:Boolean})],r.prototype,"showPreview",1),n([f({type:Boolean})],r.prototype,"disabled",1),n([f({type:String})],r.prototype,"label",1),n([f({type:String})],r.prototype,"variant",1),n([m()],r.prototype,"isDragging",1),n([m()],r.prototype,"selectedFiles",1),n([m()],r.prototype,"errorMessage",1),n([m()],r.prototype,"statusMessage",1),n([z('input[type="file"]')],r.prototype,"fileInput",1);var te=r;export{r as a,te as b};
|
|
90
|
-
/*! Bundled license information:
|
|
91
|
-
|
|
92
|
-
lit-html/directive.js:
|
|
93
|
-
(**
|
|
94
|
-
* @license
|
|
95
|
-
* Copyright 2017 Google LLC
|
|
96
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
97
|
-
*)
|
|
98
|
-
|
|
99
|
-
lit-html/directives/class-map.js:
|
|
100
|
-
(**
|
|
101
|
-
* @license
|
|
102
|
-
* Copyright 2018 Google LLC
|
|
103
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
104
|
-
*)
|
|
105
|
-
*/
|