@hotosm/ui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +15 -5
  2. package/dist/chunks/{chunk.MKQTK2RW.js → chunk.347QGSW2.js} +1 -1
  3. package/dist/chunks/{chunk.IKKWEPSE.js → chunk.45EZ2EC2.js} +1 -1
  4. package/dist/chunks/{chunk.DNXHV7I7.js → chunk.54C4CCIE.js} +1 -1
  5. package/dist/chunks/{chunk.V5BQICX2.js → chunk.6HIYAU2K.js} +1 -1
  6. package/dist/chunks/{chunk.L7KUSNV7.js → chunk.AYSFL7J5.js} +1 -1
  7. package/dist/chunks/{chunk.N7SRHM5F.js → chunk.B3F7XGIL.js} +1 -1
  8. package/dist/chunks/{chunk.NCBKWO6J.js → chunk.B77WIT2F.js} +1 -1
  9. package/dist/chunks/{chunk.UB7NXUCE.js → chunk.BWW4EBSJ.js} +33 -39
  10. package/dist/chunks/{chunk.WENKDNDZ.js → chunk.DMESFENF.js} +1 -1
  11. package/dist/chunks/{chunk.ZETV7TDG.js → chunk.DVVFVLNQ.js} +1 -1
  12. package/dist/chunks/{chunk.NZMGMJCM.js → chunk.GP3AB7RO.js} +1 -1
  13. package/dist/chunks/{chunk.THIZOVTW.js → chunk.GQ4LISAU.js} +1 -1
  14. package/dist/chunks/{chunk.QABMDRWR.js → chunk.HOF672RD.js} +1 -1
  15. package/dist/chunks/chunk.HQKELQDW.js +144 -0
  16. package/dist/chunks/{chunk.ZZ7X3H3S.js → chunk.HZNHTKN6.js} +1 -1
  17. package/dist/chunks/{chunk.IASKXF74.js → chunk.IV3UXIV2.js} +1 -1
  18. package/dist/chunks/{chunk.M2F6Z3GI.js → chunk.IVW6CBE7.js} +1 -1
  19. package/dist/chunks/{chunk.SOBALH23.js → chunk.LH3TTPVQ.js} +1 -1
  20. package/dist/chunks/{chunk.ZKUACKKG.js → chunk.LIASDRWH.js} +1 -1
  21. package/dist/chunks/{chunk.34AG3B2Y.js → chunk.LJ4XIP4K.js} +1 -1
  22. package/dist/chunks/{chunk.L2GREEZE.js → chunk.N2MY7EL5.js} +1 -1
  23. package/dist/chunks/{chunk.UVBWHOA2.js → chunk.TJOQKPXN.js} +1 -1
  24. package/dist/chunks/{chunk.ZG2J5SU5.js → chunk.TMPPHKMO.js} +1 -1
  25. package/dist/chunks/{chunk.TUEFHEUN.js → chunk.VSRVTIBV.js} +1 -1
  26. package/dist/components/announcement/announcement.component.js +1 -1
  27. package/dist/components/announcement/announcement.js +1 -1
  28. package/dist/components/consent/consent.component.js +1 -1
  29. package/dist/components/consent/consent.js +1 -1
  30. package/dist/components/consent/consent.styles.js +1 -1
  31. package/dist/components/file-input-dropzone/file-input-dropzone.component.js +1 -1
  32. package/dist/components/file-input-dropzone/file-input-dropzone.js +1 -1
  33. package/dist/components/file-input-dropzone/file-input-dropzone.styles.js +1 -1
  34. package/dist/components/header/header.component.d.ts +13 -28
  35. package/dist/components/header/header.component.js +1 -1
  36. package/dist/components/header/header.js +1 -1
  37. package/dist/components/header/header.styles.js +1 -1
  38. package/dist/components/list-card/list-card.component.js +1 -1
  39. package/dist/components/list-card/list-card.js +1 -1
  40. package/dist/components/list-card/list-card.styles.js +1 -1
  41. package/dist/components/logo/logo.component.js +1 -1
  42. package/dist/components/logo/logo.js +1 -1
  43. package/dist/components/logo/logo.styles.js +1 -1
  44. package/dist/components/tool-menu/tool-menu.component.js +1 -1
  45. package/dist/components/tool-menu/tool-menu.js +1 -1
  46. package/dist/components/tool-menu/tool-menu.styles.js +1 -1
  47. package/dist/components/tracking/tracking.component.js +1 -1
  48. package/dist/components/tracking/tracking.js +1 -1
  49. package/dist/hotosm-ui.js +1 -1
  50. package/package.json +1 -1
  51. package/dist/chunks/chunk.LLGJXBVH.js +0 -163
@@ -1,163 +0,0 @@
1
- import{a as w,b as f}from"./chunk.UB7NXUCE.js";import{a as y}from"./chunk.KO4EOD3I.js";import{a as d}from"./chunk.ZETV7TDG.js";import{d as i,f as g}from"./chunk.QABMDRWR.js";import{d as o,e as l,f as c,g as h}from"./chunk.N2W26RCT.js";Promise.allSettled([import("@awesome.me/webawesome/dist/components/tab-group/tab-group.js"),import("@awesome.me/webawesome/dist/components/icon/icon.js"),import("@awesome.me/webawesome/dist/components/drawer/drawer.js"),import("@awesome.me/webawesome/dist/components/dropdown/dropdown.js"),import("@awesome.me/webawesome/dist/components/dropdown-item/dropdown-item.js")]);y();var S,m,$,E,L,T,k,A,_,C,I,x,s=class s extends g{constructor(){super(...arguments);this.name="hot-header";c(this,S,"");c(this,m,"Mapping our world together");c(this,$,"Humanitarian OpenStreetMap Team Website");c(this,E,"https://www.hotosm.org");c(this,L,"");c(this,T,!1);c(this,k,[]);c(this,A,[]);c(this,_,"small");c(this,C,!1);c(this,I,0);c(this,x,0);this._navScrollAtStart=!0;this._navScrollAtEnd=!1;this._boundLocationSync=null}get title(){return l(this,S)}set title(e){h(this,S,e)}get topTagline(){return l(this,m)}set topTagline(e){h(this,m,e)}get topLinkLabel(){return l(this,$)}set topLinkLabel(e){h(this,$,e)}get topLinkHref(){return l(this,E)}set topLinkHref(e){h(this,E,e)}get logo(){return l(this,L)}set logo(e){h(this,L,e)}get drawer(){return l(this,T)}set drawer(e){h(this,T,e)}get tabs(){return l(this,k)}set tabs(e){h(this,k,e)}get drawerLinks(){return l(this,A)}set drawerLinks(e){h(this,A,e)}get size(){return l(this,_)}set size(e){h(this,_,e)}get tabsCenterAlign(){return l(this,C)}set tabsCenterAlign(e){h(this,C,e)}get selectedTab(){return l(this,I)}set selectedTab(e){h(this,I,e)}get activeTabIndex(){return l(this,x)}set activeTabIndex(e){h(this,x,e)}async connectedCallback(){super.connectedCallback(),this._boundLocationSync=()=>this.syncActiveTab(),window.addEventListener("popstate",this._boundLocationSync),window.addEventListener("hot-locationchange",this._boundLocationSync),window.addEventListener("htmx:pushedIntoHistory",this._boundLocationSync),s._patchHistory()}disconnectedCallback(){super.disconnectedCallback(),this._boundLocationSync&&(window.removeEventListener("popstate",this._boundLocationSync),window.removeEventListener("hot-locationchange",this._boundLocationSync),window.removeEventListener("htmx:pushedIntoHistory",this._boundLocationSync),this._boundLocationSync=null)}firstUpdated(e){this._updateNavScrollState(),this.syncActiveTab()}updated(e){if(super.updated(e),e.has("selectedTab")){let t=this.selectedTab;typeof t=="number"&&t>=0&&t<this.tabs.length&&t!==this.activeTabIndex&&(this.activeTabIndex=t)}(e.has("tabs")||e.has("size"))&&(this.updateComplete.then(()=>this._updateNavScrollState()),e.has("tabs")&&this.syncActiveTab())}selectTab(e){if(e!==this.selectedTab&&e>=0&&e<this.tabs.length){let t=this.selectedTab;this.selectedTab=e,this.activeTabIndex=e,this.dispatchEvent(new CustomEvent("tab-change",{detail:{selectedIndex:e,previousIndex:t,tab:this.tabs[e]},bubbles:!0})),this.requestUpdate()}}_updateNavScrollState(){var v;let e=(v=this.renderRoot)==null?void 0:v.querySelector(".header--nav-scroll");if(!e)return;let{scrollLeft:t,scrollWidth:a,clientWidth:r}=e,n=t<=0,u=t+r>=a-1;(n!==this._navScrollAtStart||u!==this._navScrollAtEnd)&&(this._navScrollAtStart=n,this._navScrollAtEnd=u,this.requestUpdate())}_scrollNav(e){var n;let t=(n=this.renderRoot)==null?void 0:n.querySelector(".header--nav-scroll");if(!t)return;let a=Math.max(t.scrollWidth-t.clientWidth,0),r=e==="right"?a:0;t.scrollTo({left:r,behavior:"smooth"}),window.setTimeout(()=>this._updateNavScrollState(),250)}syncActiveTab(){var r;if(typeof window=="undefined"||!((r=this.tabs)!=null&&r.length))return;let e=window.location.pathname.replace(/\/+$/,"");if(!e)return;let t=-1,a=-1;this.tabs.forEach((n,u)=>{if(n!=null&&n.href)try{let p=new URL(n.href,window.location.origin).pathname.replace(/\/+$/,"");if(!p)return;e===p?(t=u,a=Number.MAX_SAFE_INTEGER):a<Number.MAX_SAFE_INTEGER&&e.startsWith(p)&&p.length>a&&(t=u,a=p.length)}catch(v){}}),t>=0&&t!==this.activeTabIndex&&(this.selectedTab=t,this.activeTabIndex=t,this.requestUpdate())}static _patchHistory(){if(s._historyPatched||typeof window=="undefined")return;s._historyPatched=!0;let e=history.pushState.bind(history),t=history.replaceState.bind(history);history.pushState=function(a,r,n){e(a,r,n),window.dispatchEvent(new Event("hot-locationchange"))},history.replaceState=function(a,r,n){t(a,r,n),window.dispatchEvent(new Event("hot-locationchange"))}}render(){let e=typeof this.logo=="string"||this.logo instanceof URL?typeof this.logo=="string"?this.logo:this.logo.href:"";return i`
2
- <div class="header-container">
3
- ${this.size!=="small"?i`
4
- <div class="header--top">
5
- <div class="header--top-left">
6
- ${this.topTagline?i`
7
- <span class="header--top-tagline">
8
- ${this.topTagline}
9
- </span>
10
- `:null}
11
- </div>
12
- <div class="header--top-right">
13
- ${this.topLinkHref&&this.topLinkLabel?i`
14
- <a
15
- href="${this.topLinkHref}"
16
- class="header--top-link"
17
- target="_blank"
18
- rel="noopener noreferrer"
19
- >
20
- <span class="header--top-link-full">${this.topLinkLabel}</span>
21
- <span class="header--top-link-short">HOT Website</span>
22
- <svg width="11" height="11" viewBox="0 0 11 11" class="header--external-icon" aria-hidden="true"><path fill="currentColor" d="M9.778 9.778H1.222V1.222H5.5V0H1.222C.544 0 0 .55 0 1.222v8.556C0 10.45.544 11 1.222 11h8.556C10.45 11 11 10.45 11 9.778V5.5H9.778v4.278zM6.722 0v1.222h2.194L2.91 7.23l.862.862 6.007-6.007v2.194H11V0H6.722z"></path></svg>
23
- </a>
24
- `:null}
25
- </div>
26
- </div>
27
- `:null}
28
-
29
- <header
30
- class=${w({size:this.size})}
31
- >
32
- <a href="/" class="header--link">
33
- ${e.length>0?i`
34
- <img
35
- id="logo"
36
- src="${this.logo}"
37
- alt="Logo"
38
- class="header--logo-img"
39
- />
40
- `:i`
41
- <hot-logo
42
- ?icon-only=${this.title.length>0}
43
- >
44
- </hot-logo>
45
- `}
46
- ${this.title.length>0?i`
47
- <h1 class="header--title">
48
- ${this.title}
49
- </h1>
50
- `:null}
51
- </a>
52
-
53
- ${""}
54
- <nav class="header--nav ${this.tabsCenterAlign?"header--nav-center":""}">
55
- ${this.tabs.length>0?i`
56
- <div class="header--nav-wrapper">
57
- <button
58
- class="header--nav-arrow header--nav-arrow-left"
59
- ?disabled=${this._navScrollAtStart}
60
- @click=${()=>this._scrollNav("left")}
61
- aria-hidden=${this._navScrollAtStart}
62
- tabindex=${this._navScrollAtStart?-1:0}
63
- >
64
- &#8249;
65
- </button>
66
-
67
- <div
68
- class="header--nav-scroll"
69
- @scroll=${()=>this._updateNavScrollState()}
70
- >
71
- <wa-tab-group
72
- class="header--tab-group"
73
- @wa-tab-show=${t=>this._handleTabShow(t)}
74
- >
75
- ${this.tabs.map((t,a)=>{let r=this.activeTabIndex===a;return i`
76
- <wa-tab
77
- panel="${t.label}-${a}"
78
- class="header--tab"
79
- slot="nav"
80
- ?active=${r}
81
- data-index="${a}"
82
- @click=${n=>this._tabClick(n,t.clickEvent,a)}
83
- >
84
- ${t.label}
85
- </wa-tab>
86
- `})}
87
- </wa-tab-group>
88
- </div>
89
-
90
- <button
91
- class="header--nav-arrow header--nav-arrow-right"
92
- ?disabled=${this._navScrollAtEnd}
93
- @click=${()=>this._scrollNav("right")}
94
- aria-hidden=${this._navScrollAtEnd}
95
- tabindex=${this._navScrollAtEnd?-1:0}
96
- >
97
- &#8250;
98
- </button>
99
- </div>
100
- `:null}
101
- </nav>
102
-
103
-
104
-
105
- <div id="right-section" class="header--right-section">
106
- <slot name="lang" class="header--lang-slot"></slot>
107
- <slot name="auth" class="header--auth-slot"></slot>
108
- ${this._showDrawer?i`
109
- <wa-drawer label=" " id="drawer-overview">
110
- <div class="drawer-content">
111
- ${this.tabs.length?i`
112
- <div class="drawer-nav">
113
- <ul class="drawer-nav-list">
114
- ${this.tabs.map((t,a)=>i`
115
- <li class="drawer-nav-item">
116
- <button
117
- class="drawer-nav-button"
118
- data-index="${a}"
119
- @click=${r=>this._tabClick(r,t.clickEvent,a)}
120
- >
121
- ${t.label}
122
- </button>
123
- </li>
124
- `)}
125
- </ul>
126
- <hr class="drawer-separator" />
127
- </div>
128
- `:null}
129
-
130
- <ul class="drawer-link-list">
131
- ${this.drawerLinks.map(t=>i`
132
- <li class="drawer-link-item">
133
- <a
134
- href="${t.href}"
135
- data-drawer-close
136
- class="drawer-link"
137
- >
138
- ${t.label}
139
- </a>
140
- </li>
141
- `)}
142
- </ul>
143
-
144
- <div class="drawer-extras">
145
- <slot name="drawer-lang" class="drawer-lang-slot"></slot>
146
- <slot name="drawer-auth" class="drawer-auth-slot"></slot>
147
- </div>
148
- </div>
149
- </wa-drawer>
150
- <wa-button
151
- appearance="outlined"
152
- class="${this.drawer?"":"header--drawer-mobile-only"}"
153
- @click=${()=>this._handleDrawerOpen()}
154
- aria-label="Open Sidebar"
155
- >
156
- <wa-icon name="bars"></wa-icon>
157
- </wa-button>
158
- `:null}
159
- </div>
160
-
161
- </header>
162
- </div>
163
- `}async _tabClick(e,t,a){e.preventDefault(),e.stopPropagation();try{this.selectTab(a),setTimeout(async()=>{try{typeof t=="function"&&await t()}catch(r){console.error("Error during navigation:",r),typeof t=="function"&&t()}},0)}catch(r){console.error("Error handling tab click:",r);try{typeof t=="function"&&t()}catch(n){console.error("Fallback navigation also failed:",n)}}}_handleTabShow(e){try{let t=e.target,a=parseInt(t.getAttribute("data-index")||"0",10);!isNaN(a)&&a<this.tabs.length&&this.selectTab(a)}catch(t){console.error("Error handling tab show event:",t)}}get _showDrawer(){return this.drawer||this.tabs.length>0}_handleDrawerOpen(){var t;let e=(t=this.renderRoot)==null?void 0:t.querySelector("#drawer-overview");e&&(e.open=!0)}};S=new WeakMap,m=new WeakMap,$=new WeakMap,E=new WeakMap,L=new WeakMap,T=new WeakMap,k=new WeakMap,A=new WeakMap,_=new WeakMap,C=new WeakMap,I=new WeakMap,x=new WeakMap,s.styles=[f],s._historyPatched=!1,o([d({type:String})],s.prototype,"title",1),o([d({type:String,attribute:"top-tagline"})],s.prototype,"topTagline",1),o([d({type:String,attribute:"top-link-label"})],s.prototype,"topLinkLabel",1),o([d({type:String,attribute:"top-link-href"})],s.prototype,"topLinkHref",1),o([d({type:String})],s.prototype,"logo",1),o([d({type:Boolean})],s.prototype,"drawer",1),o([d({type:Array})],s.prototype,"tabs",1),o([d({type:Array})],s.prototype,"drawerLinks",1),o([d({type:String})],s.prototype,"size",1),o([d({type:Boolean,attribute:"tabs-center-align"})],s.prototype,"tabsCenterAlign",1),o([d({type:Number})],s.prototype,"selectedTab",1),o([d({type:Number})],s.prototype,"activeTabIndex",1);var b=s,V=b;export{b as a,V as b};