@hotosm/ui 0.3.1-b3 → 0.3.1-b5

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 (30) hide show
  1. package/README.md +10 -8
  2. package/dist/chunks/chunk.2MK55PUE.js +700 -0
  3. package/dist/chunks/{callout.USQGOL5A.js → chunk.3NBBS2A2.js} +2 -2
  4. package/dist/chunks/{chunk.4YLAIDAG.js → chunk.7RJ72M75.js} +3 -3
  5. package/dist/chunks/{chunk.IWVLJ74K.js → chunk.MIYFUINI.js} +2 -2
  6. package/dist/chunks/{chunk.XCJG4HAO.js → chunk.PDLGEB7T.js} +3 -3
  7. package/dist/chunks/chunk.V7FZQXWL.js +667 -0
  8. package/dist/components/consent/consent.component.d.ts +3 -0
  9. package/dist/components/consent/consent.component.js +1 -1
  10. package/dist/components/consent/consent.js +1 -1
  11. package/dist/components/header/header.component.d.ts +4 -0
  12. package/dist/components/header/header.component.js +1 -1
  13. package/dist/components/header/header.js +1 -1
  14. package/dist/components/logo/logo.component.js +1 -1
  15. package/dist/components/logo/logo.js +1 -1
  16. package/dist/components/tracking/tracking.component.d.ts +3 -0
  17. package/dist/components/tracking/tracking.component.js +1 -1
  18. package/dist/components/tracking/tracking.js +1 -1
  19. package/dist/hotosm-ui.js +1 -1
  20. package/package.json +1 -1
  21. package/dist/chunks/button.LEHBRWP3.js +0 -1
  22. package/dist/chunks/chunk.7VBX4GII.js +0 -1
  23. package/dist/chunks/chunk.BPVA67NM.js +0 -94
  24. package/dist/chunks/chunk.FIQQYKEP.js +0 -14
  25. package/dist/chunks/chunk.KPZVTN5G.js +0 -460
  26. package/dist/chunks/chunk.OHRBDQCO.js +0 -45
  27. package/dist/chunks/chunk.TFICHQZE.js +0 -186
  28. package/dist/chunks/dialog.7CZCE2KM.js +0 -217
  29. package/dist/chunks/icon.ZB6BUFKB.js +0 -1
  30. package/dist/chunks/tab-group.JN54CODM.js +0 -360
@@ -1,360 +0,0 @@
1
- import{c as y}from"./chunk.7VBX4GII.js";import{a as T,b as m}from"./chunk.KPZVTN5G.js";import"./chunk.TFICHQZE.js";import{a as h}from"./chunk.OHRBDQCO.js";import{a as n,b as v}from"./chunk.FIQQYKEP.js";import{a as p,b as s,c as x,d as u}from"./chunk.6ZDEZIWM.js";import{e as b}from"./chunk.U4P7XQR4.js";import{a as k}from"./chunk.NI7UJOOZ.js";var A=class extends Event{constructor(t){super("wa-tab-hide",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}},C=class extends Event{constructor(t){super("wa-tab-show",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}},S=`:host {
2
- --indicator-color: var(--wa-color-brand-fill-loud);
3
- --track-color: var(--wa-color-neutral-fill-normal);
4
- --track-width: 0.125rem;
5
-
6
- display: block;
7
- }
8
-
9
- .tab-group {
10
- display: flex;
11
- border-radius: 0;
12
- }
13
-
14
- .tabs {
15
- display: flex;
16
- position: relative;
17
- }
18
-
19
- .indicator {
20
- position: absolute;
21
- }
22
-
23
- .tab-group-has-scroll-controls .nav-container {
24
- position: relative;
25
- padding: 0 1.5em;
26
- }
27
-
28
- .body {
29
- display: block;
30
- overflow: auto;
31
- }
32
-
33
- .scroll-button {
34
- display: flex;
35
- align-items: center;
36
- justify-content: center;
37
- position: absolute;
38
- top: 0;
39
- bottom: 0;
40
- width: 1.5em;
41
- }
42
-
43
- .scroll-button-start {
44
- inset-inline-start: 0;
45
- }
46
-
47
- .scroll-button-end {
48
- inset-inline-end: 0;
49
- }
50
-
51
- /*
52
- * Top
53
- */
54
-
55
- .tab-group-top {
56
- flex-direction: column;
57
- }
58
-
59
- .tab-group-top .nav-container {
60
- order: 1;
61
- }
62
-
63
- .tab-group-top .nav {
64
- display: flex;
65
- overflow-x: auto;
66
-
67
- /* Hide scrollbar in Firefox */
68
- scrollbar-width: none;
69
- }
70
-
71
- /* Hide scrollbar in Chrome/Safari */
72
- .tab-group-top .nav::-webkit-scrollbar {
73
- width: 0;
74
- height: 0;
75
- }
76
-
77
- .tab-group-top .tabs {
78
- flex: 1 1 auto;
79
- position: relative;
80
- flex-direction: row;
81
- border-bottom: solid var(--track-width) var(--track-color);
82
- }
83
-
84
- .tab-group-top .indicator {
85
- bottom: calc(-1 * var(--track-width));
86
- border-bottom: solid var(--track-width) var(--indicator-color);
87
- }
88
-
89
- .tab-group-top .body {
90
- order: 2;
91
- }
92
-
93
- .tab-group-top ::slotted(wa-tab[active]) {
94
- border-block-end: solid var(--track-width) var(--indicator-color);
95
- margin-block-end: calc(-1 * var(--track-width));
96
- }
97
-
98
- .tab-group-top ::slotted(wa-tab-panel) {
99
- --padding: var(--wa-space-xl) 0;
100
- }
101
-
102
- /*
103
- * Bottom
104
- */
105
-
106
- .tab-group-bottom {
107
- flex-direction: column;
108
- }
109
-
110
- .tab-group-bottom .nav-container {
111
- order: 2;
112
- }
113
-
114
- .tab-group-bottom .nav {
115
- display: flex;
116
- overflow-x: auto;
117
-
118
- /* Hide scrollbar in Firefox */
119
- scrollbar-width: none;
120
- }
121
-
122
- /* Hide scrollbar in Chrome/Safari */
123
- .tab-group-bottom .nav::-webkit-scrollbar {
124
- width: 0;
125
- height: 0;
126
- }
127
-
128
- .tab-group-bottom .tabs {
129
- flex: 1 1 auto;
130
- position: relative;
131
- flex-direction: row;
132
- border-top: solid var(--track-width) var(--track-color);
133
- }
134
-
135
- .tab-group-bottom .indicator {
136
- top: calc(-1 * var(--track-width));
137
- border-top: solid var(--track-width) var(--indicator-color);
138
- }
139
-
140
- .tab-group-bottom .body {
141
- order: 1;
142
- }
143
-
144
- .tab-group-bottom ::slotted(wa-tab[active]) {
145
- border-block-start: solid var(--track-width) var(--indicator-color);
146
- margin-block-start: calc(-1 * var(--track-width));
147
- }
148
-
149
- .tab-group-bottom ::slotted(wa-tab-panel) {
150
- --padding: var(--wa-space-xl) 0;
151
- }
152
-
153
- /*
154
- * Start
155
- */
156
-
157
- .tab-group-start {
158
- flex-direction: row;
159
- }
160
-
161
- .tab-group-start .nav-container {
162
- order: 1;
163
- }
164
-
165
- .tab-group-start .tabs {
166
- flex: 0 0 auto;
167
- flex-direction: column;
168
- border-inline-end: solid var(--track-width) var(--track-color);
169
- }
170
-
171
- .tab-group-start .indicator {
172
- inset-inline-end: calc(-1 * var(--track-width));
173
- border-right: solid var(--track-width) var(--indicator-color);
174
- }
175
-
176
- .tab-group-start .body {
177
- flex: 1 1 auto;
178
- order: 2;
179
- }
180
-
181
- .tab-group-start ::slotted(wa-tab[active]) {
182
- border-inline-end: solid var(--track-width) var(--indicator-color);
183
- margin-inline-end: calc(-1 * var(--track-width));
184
- }
185
-
186
- .tab-group-start ::slotted(wa-tab-panel) {
187
- --padding: 0 var(--wa-space-xl);
188
- }
189
-
190
- /*
191
- * End
192
- */
193
-
194
- .tab-group-end {
195
- flex-direction: row;
196
- }
197
-
198
- .tab-group-end .nav-container {
199
- order: 2;
200
- }
201
-
202
- .tab-group-end .tabs {
203
- flex: 0 0 auto;
204
- flex-direction: column;
205
- border-left: solid var(--track-width) var(--track-color);
206
- }
207
-
208
- .tab-group-end .indicator {
209
- inset-inline-start: calc(-1 * var(--track-width));
210
- border-inline-start: solid var(--track-width) var(--indicator-color);
211
- }
212
-
213
- .tab-group-end .body {
214
- flex: 1 1 auto;
215
- order: 1;
216
- }
217
-
218
- .tab-group-end ::slotted(wa-tab[active]) {
219
- border-inline-start: solid var(--track-width) var(--indicator-color);
220
- margin-inline-start: calc(-1 * var(--track-width));
221
- }
222
-
223
- .tab-group-end ::slotted(wa-tab-panel) {
224
- --padding: 0 var(--wa-space-xl);
225
- }
226
- `,i=class extends v{constructor(){super(...arguments),this.tabs=[],this.focusableTabs=[],this.panels=[],this.localize=new T(this),this.hasScrollControls=!1,this.active="",this.placement="top",this.activation="auto",this.withoutScrollControls=!1}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>{this.updateScrollControls()}),this.mutationObserver=new MutationObserver(t=>{t.some(e=>!["aria-labelledby","aria-controls"].includes(e.attributeName))&&setTimeout(()=>this.setAriaLabels());let a=t.filter(e=>e.target.closest("wa-tab-group")===this);if(a.some(e=>e.attributeName==="disabled"))this.syncTabsAndPanels();else if(a.some(e=>e.attributeName==="active")){let r=a.filter(o=>o.attributeName==="active"&&o.target.tagName.toLowerCase()==="wa-tab").map(o=>o.target).find(o=>o.active);r&&r.closest("wa-tab-group")===this&&this.setActiveTab(r)}}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav),new IntersectionObserver((a,e)=>{var r;if(a[0].intersectionRatio>0){if(this.setAriaLabels(),this.active){let o=this.tabs.find(w=>w.panel===this.active);o&&this.setActiveTab(o)}else this.setActiveTab((r=this.getActiveTab())!=null?r:this.tabs[0],{emitEvents:!1});e.unobserve(a[0].target)}}).observe(this.tabGroup)})}disconnectedCallback(){var t,a;super.disconnectedCallback(),(t=this.mutationObserver)==null||t.disconnect(),this.nav&&((a=this.resizeObserver)==null||a.unobserve(this.nav))}getAllTabs(){return[...this.shadowRoot.querySelector('slot[name="nav"]').assignedElements()].filter(a=>a.tagName.toLowerCase()==="wa-tab")}getAllPanels(){return[...this.body.assignedElements()].filter(t=>t.tagName.toLowerCase()==="wa-tab-panel")}getActiveTab(){return this.tabs.find(t=>t.active)}handleClick(t){let e=t.target.closest("wa-tab");(e==null?void 0:e.closest("wa-tab-group"))===this&&e!==null&&this.setActiveTab(e,{scrollBehavior:"smooth"})}handleKeyDown(t){let e=t.target.closest("wa-tab");if((e==null?void 0:e.closest("wa-tab-group"))===this){if(["Enter"," "].includes(t.key)){e!==null&&(this.setActiveTab(e,{scrollBehavior:"smooth"}),t.preventDefault());return}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){let o=this.tabs.find(d=>d.matches(":focus")),w=this.localize.dir()==="rtl",l=null;if((o==null?void 0:o.tagName.toLowerCase())==="wa-tab"){if(t.key==="Home")l=this.focusableTabs[0];else if(t.key==="End")l=this.focusableTabs[this.focusableTabs.length-1];else if(["top","bottom"].includes(this.placement)&&t.key===(w?"ArrowRight":"ArrowLeft")||["start","end"].includes(this.placement)&&t.key==="ArrowUp"){let d=this.tabs.findIndex(g=>g===o);l=this.findNextFocusableTab(d,"backward")}else if(["top","bottom"].includes(this.placement)&&t.key===(w?"ArrowLeft":"ArrowRight")||["start","end"].includes(this.placement)&&t.key==="ArrowDown"){let d=this.tabs.findIndex(g=>g===o);l=this.findNextFocusableTab(d,"forward")}if(!l)return;l.tabIndex=0,l.focus({preventScroll:!0}),this.activation==="auto"?this.setActiveTab(l,{scrollBehavior:"smooth"}):this.tabs.forEach(d=>{d.tabIndex=d===l?0:-1}),["top","bottom"].includes(this.placement)&&y(l,this.nav,"horizontal"),t.preventDefault()}}}}findNextFocusableTab(t,a){let e=null,r=a==="forward"?1:-1,o=t+r;for(;t<this.tabs.length;){if(e=this.tabs[o]||null,e===null){a==="forward"?e=this.focusableTabs[0]:e=this.focusableTabs[this.focusableTabs.length-1];break}if(!e.disabled)break;o+=r}return e}handleScrollToStart(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(t,a){if(a=k({emitEvents:!0,scrollBehavior:"auto"},a),t.closest("wa-tab-group")===this&&t!==this.activeTab&&!t.disabled){let e=this.activeTab;this.active=t.panel,this.activeTab=t,this.tabs.forEach(r=>{r.active=r===this.activeTab,r.tabIndex=r===this.activeTab?0:-1}),this.panels.forEach(r=>{var o;return r.active=r.name===((o=this.activeTab)==null?void 0:o.panel)}),["top","bottom"].includes(this.placement)&&y(this.activeTab,this.nav,"horizontal",a.scrollBehavior),a.emitEvents&&(e&&this.dispatchEvent(new A({name:e.panel})),this.dispatchEvent(new C({name:this.activeTab.panel})))}}setAriaLabels(){this.tabs.forEach(t=>{let a=this.panels.find(e=>e.name===t.panel);a&&(t.setAttribute("aria-controls",a.getAttribute("id")),a.setAttribute("aria-labelledby",t.getAttribute("id")))})}syncTabsAndPanels(){this.tabs=this.getAllTabs(),this.focusableTabs=this.tabs.filter(t=>!t.disabled),this.panels=this.getAllPanels(),this.updateComplete.then(()=>this.updateScrollControls())}updateActiveTab(){let t=this.tabs.find(a=>a.panel===this.active);t&&this.setActiveTab(t,{scrollBehavior:"smooth"})}updateScrollControls(){this.withoutScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth+1}render(){let t=this.hasUpdated?this.localize.dir()==="rtl":this.dir==="rtl";return b`
227
- <div
228
- part="base"
229
- class=${m({"tab-group":!0,"tab-group-top":this.placement==="top","tab-group-bottom":this.placement==="bottom","tab-group-start":this.placement==="start","tab-group-end":this.placement==="end","tab-group-has-scroll-controls":this.hasScrollControls})}
230
- @click=${this.handleClick}
231
- @keydown=${this.handleKeyDown}
232
- >
233
- <div class="nav-container" part="nav">
234
- ${this.hasScrollControls?b`
235
- <wa-button
236
- part="scroll-button scroll-button-start"
237
- exportparts="base:scroll-button__base"
238
- class="scroll-button scroll-button-start"
239
- appearance="plain"
240
- @click=${this.handleScrollToStart}
241
- >
242
- <wa-icon
243
- name=${t?"chevron-right":"chevron-left"}
244
- library="system"
245
- variant="solid"
246
- label=${this.localize.term("scrollToStart")}
247
- ></wa-icon>
248
- </wa-button>
249
- `:""}
250
-
251
- <!-- We have a focus listener because in Firefox (and soon to be Chrome) overflow containers are focusable. -->
252
- <div class="nav" @focus=${()=>{var a;return(a=this.activeTab)==null?void 0:a.focus({preventScroll:!0})}}>
253
- <div part="tabs" class="tabs" role="tablist">
254
- <slot name="nav" @slotchange=${this.syncTabsAndPanels}></slot>
255
- </div>
256
- </div>
257
-
258
- ${this.hasScrollControls?b`
259
- <wa-button
260
- part="scroll-button scroll-button-end"
261
- class="scroll-button scroll-button-end"
262
- exportparts="base:scroll-button__base"
263
- appearance="plain"
264
- @click=${this.handleScrollToEnd}
265
- >
266
- <wa-icon
267
- name=${t?"chevron-left":"chevron-right"}
268
- library="system"
269
- variant="solid"
270
- label=${this.localize.term("scrollToEnd")}
271
- ></wa-icon>
272
- </wa-button>
273
- `:""}
274
- </div>
275
-
276
- <slot part="body" class="body" @slotchange=${this.syncTabsAndPanels}></slot>
277
- </div>
278
- `}};i.css=S;n([u(".tab-group")],i.prototype,"tabGroup",2);n([u(".body")],i.prototype,"body",2);n([u(".nav")],i.prototype,"nav",2);n([x()],i.prototype,"hasScrollControls",2);n([s({reflect:!0})],i.prototype,"active",2);n([s()],i.prototype,"placement",2);n([s()],i.prototype,"activation",2);n([s({attribute:"without-scroll-controls",type:Boolean})],i.prototype,"withoutScrollControls",2);n([h("active")],i.prototype,"updateActiveTab",1);n([h("withoutScrollControls",{waitUntilFirstUpdate:!0})],i.prototype,"updateScrollControls",1);i=n([p("wa-tab-group")],i);var E=`:host {
279
- display: inline-block;
280
- color: var(--wa-color-neutral-on-quiet);
281
- font-weight: var(--wa-font-weight-action);
282
- }
283
-
284
- .tab {
285
- display: inline-flex;
286
- align-items: center;
287
- font: inherit;
288
- padding: 1em 1.5em;
289
- white-space: nowrap;
290
- user-select: none;
291
- -webkit-user-select: none;
292
- cursor: pointer;
293
- transition: color var(--wa-transition-fast) var(--wa-transition-easing);
294
-
295
- ::slotted(wa-icon:first-child) {
296
- margin-inline-end: 0.5em;
297
- }
298
-
299
- ::slotted(wa-icon:last-child) {
300
- margin-inline-start: 0.5em;
301
- }
302
- }
303
-
304
- @media (hover: hover) {
305
- :host(:hover:not([disabled])) .tab {
306
- color: currentColor;
307
- }
308
- }
309
-
310
- :host(:focus) {
311
- outline: transparent;
312
- }
313
-
314
- :host(:focus-visible) .tab {
315
- outline: var(--wa-focus-ring);
316
- outline-offset: calc(-1 * var(--wa-border-width-l) - var(--wa-focus-ring-offset));
317
- }
318
-
319
- :host([active]:not([disabled])) {
320
- color: var(--wa-color-brand-on-quiet);
321
- }
322
-
323
- :host([disabled]) .tab {
324
- opacity: 0.5;
325
- cursor: not-allowed;
326
- }
327
-
328
- @media (forced-colors: active) {
329
- :host([active]:not([disabled])) {
330
- outline: solid 1px transparent;
331
- outline-offset: -3px;
332
- }
333
- }
334
- `,I=0,c=class extends v{constructor(){super(...arguments),this.attrId=++I,this.componentId=`wa-tab-${this.attrId}`,this.panel="",this.active=!1,this.disabled=!1,this.tabIndex=0}connectedCallback(){this.slot||(this.slot="nav"),super.connectedCallback(),this.setAttribute("role","tab")}handleActiveChange(){this.setAttribute("aria-selected",this.active?"true":"false")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false"),this.disabled&&!this.active?this.tabIndex=-1:this.tabIndex=0}render(){var t;return this.id=((t=this.id)==null?void 0:t.length)>0?this.id:this.componentId,b`
335
- <div
336
- part="base"
337
- class=${m({tab:!0,"tab-active":this.active})}
338
- >
339
- <slot></slot>
340
- </div>
341
- `}};c.css=E;n([u(".tab")],c.prototype,"tab",2);n([s({reflect:!0})],c.prototype,"panel",2);n([s({type:Boolean,reflect:!0})],c.prototype,"active",2);n([s({type:Boolean,reflect:!0})],c.prototype,"disabled",2);n([s({type:Number,reflect:!0})],c.prototype,"tabIndex",2);n([h("active")],c.prototype,"handleActiveChange",1);n([h("disabled")],c.prototype,"handleDisabledChange",1);c=n([p("wa-tab")],c);var $=`:host {
342
- --padding: 0;
343
-
344
- display: none;
345
- }
346
-
347
- :host([active]) {
348
- display: block;
349
- }
350
-
351
- .tab-panel {
352
- display: block;
353
- padding: var(--padding);
354
- }
355
- `,L=0,f=class extends v{constructor(){super(...arguments),this.attrId=++L,this.componentId=`wa-tab-panel-${this.attrId}`,this.name="",this.active=!1}connectedCallback(){super.connectedCallback(),this.id=this.id.length>0?this.id:this.componentId,this.setAttribute("role","tabpanel")}handleActiveChange(){this.setAttribute("aria-hidden",this.active?"false":"true")}render(){return b`
356
- <slot
357
- part="base"
358
- class=${m({"tab-panel":!0,"tab-panel-active":this.active})}
359
- ></slot>
360
- `}};f.css=$;n([s({reflect:!0})],f.prototype,"name",2);n([s({type:Boolean,reflect:!0})],f.prototype,"active",2);n([h("active")],f.prototype,"handleActiveChange",1);f=n([p("wa-tab-panel")],f);export{i as default};