@hotosm/ui 0.3.1-b2 → 0.3.1-b3
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/dist/chunks/button.LEHBRWP3.js +1 -0
- package/dist/chunks/{chunk.PQUDDU4D.js → callout.USQGOL5A.js} +2 -2
- package/dist/chunks/chunk.7VBX4GII.js +1 -0
- package/dist/chunks/chunk.BPVA67NM.js +94 -0
- package/dist/chunks/chunk.FIQQYKEP.js +14 -0
- package/dist/chunks/{chunk.3Y46BCZT.js → chunk.IWVLJ74K.js} +2 -2
- package/dist/chunks/chunk.KPZVTN5G.js +460 -0
- package/dist/chunks/chunk.OHRBDQCO.js +45 -0
- package/dist/chunks/chunk.TFICHQZE.js +186 -0
- package/dist/chunks/{chunk.WBE5WRYN.js → chunk.XCJG4HAO.js} +3 -3
- package/dist/chunks/dialog.7CZCE2KM.js +217 -0
- package/dist/chunks/icon.ZB6BUFKB.js +1 -0
- package/dist/chunks/tab-group.JN54CODM.js +360 -0
- package/dist/components/consent/consent.component.d.ts +0 -3
- package/dist/components/consent/consent.component.js +1 -1
- package/dist/components/consent/consent.js +1 -1
- package/dist/components/header/header.component.d.ts +0 -3
- package/dist/components/header/header.component.js +1 -1
- package/dist/components/header/header.js +1 -1
- package/dist/components/tracking/tracking.component.d.ts +0 -3
- package/dist/components/tracking/tracking.component.js +1 -1
- package/dist/components/tracking/tracking.js +1 -1
- package/dist/hotosm-ui.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk.54RIFX2M.js +0 -669
- package/dist/chunks/chunk.PE4OKGWW.js +0 -700
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
var o=`@layer wa-utilities {
|
|
2
|
+
:host([size='small']),
|
|
3
|
+
.wa-size-s {
|
|
4
|
+
font-size: var(--wa-font-size-s);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host([size='medium']),
|
|
8
|
+
.wa-size-m {
|
|
9
|
+
font-size: var(--wa-font-size-m);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([size='large']),
|
|
13
|
+
.wa-size-l {
|
|
14
|
+
font-size: var(--wa-font-size-l);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;var a=`@layer wa-utilities {
|
|
18
|
+
/** Register color properties so that the space toggle hack can work. */
|
|
19
|
+
@property --wa-color-fill-loud {
|
|
20
|
+
syntax: '<color>';
|
|
21
|
+
inherits: true;
|
|
22
|
+
initial-value: transparent;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@property --wa-color-fill-normal {
|
|
26
|
+
syntax: '<color>';
|
|
27
|
+
inherits: true;
|
|
28
|
+
initial-value: transparent;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@property --wa-color-fill-quiet {
|
|
32
|
+
syntax: '<color>';
|
|
33
|
+
inherits: true;
|
|
34
|
+
initial-value: transparent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@property --wa-color-border-loud {
|
|
38
|
+
syntax: '<color>';
|
|
39
|
+
inherits: true;
|
|
40
|
+
initial-value: transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@property --wa-color-border-normal {
|
|
44
|
+
syntax: '<color>';
|
|
45
|
+
inherits: true;
|
|
46
|
+
initial-value: transparent;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@property --wa-color-border-quiet {
|
|
50
|
+
syntax: '<color>';
|
|
51
|
+
inherits: true;
|
|
52
|
+
initial-value: transparent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@property --wa-color-on-loud {
|
|
56
|
+
syntax: '<color>';
|
|
57
|
+
inherits: true;
|
|
58
|
+
initial-value: transparent;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@property --wa-color-on-normal {
|
|
62
|
+
syntax: '<color>';
|
|
63
|
+
inherits: true;
|
|
64
|
+
initial-value: transparent;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@property --wa-color-on-quiet {
|
|
68
|
+
syntax: '<color>';
|
|
69
|
+
inherits: true;
|
|
70
|
+
initial-value: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Element defaults.
|
|
75
|
+
We want these to resolve to inherit when inside a variant, and only be applied when not inside an explicit variant.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
:host(wa-button),
|
|
79
|
+
button,
|
|
80
|
+
input[type='button'],
|
|
81
|
+
input[type='submit'],
|
|
82
|
+
:host(wa-tag) {
|
|
83
|
+
--wa-color-fill-loud: var(--wa-no-variant, var(--wa-color-neutral-fill-loud));
|
|
84
|
+
--wa-color-fill-normal: var(--wa-no-variant, var(--wa-color-neutral-fill-normal));
|
|
85
|
+
--wa-color-fill-quiet: var(--wa-no-variant, var(--wa-color-neutral-fill-quiet));
|
|
86
|
+
--wa-color-border-loud: var(--wa-no-variant, var(--wa-color-neutral-border-loud));
|
|
87
|
+
--wa-color-border-normal: var(--wa-no-variant, var(--wa-color-neutral-border-normal));
|
|
88
|
+
--wa-color-border-quiet: var(--wa-no-variant, var(--wa-color-neutral-border-quiet));
|
|
89
|
+
--wa-color-on-loud: var(--wa-no-variant, var(--wa-color-neutral-on-loud));
|
|
90
|
+
--wa-color-on-normal: var(--wa-no-variant, var(--wa-color-neutral-on-normal));
|
|
91
|
+
--wa-color-on-quiet: var(--wa-no-variant, var(--wa-color-neutral-on-quiet));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host(wa-callout),
|
|
95
|
+
:host(wa-badge) {
|
|
96
|
+
--wa-color-fill-loud: var(--wa-no-variant, var(--wa-color-brand-fill-loud));
|
|
97
|
+
--wa-color-fill-normal: var(--wa-no-variant, var(--wa-color-brand-fill-normal));
|
|
98
|
+
--wa-color-fill-quiet: var(--wa-no-variant, var(--wa-color-brand-fill-quiet));
|
|
99
|
+
--wa-color-border-loud: var(--wa-no-variant, var(--wa-color-brand-border-loud));
|
|
100
|
+
--wa-color-border-normal: var(--wa-no-variant, var(--wa-color-brand-border-normal));
|
|
101
|
+
--wa-color-border-quiet: var(--wa-no-variant, var(--wa-color-brand-border-quiet));
|
|
102
|
+
--wa-color-on-loud: var(--wa-no-variant, var(--wa-color-brand-on-loud));
|
|
103
|
+
--wa-color-on-normal: var(--wa-no-variant, var(--wa-color-brand-on-normal));
|
|
104
|
+
--wa-color-on-quiet: var(--wa-no-variant, var(--wa-color-brand-on-quiet));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Variants
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
:root,
|
|
112
|
+
.wa-neutral,
|
|
113
|
+
:host([variant='neutral']) {
|
|
114
|
+
--wa-color-fill-loud: var(--wa-color-neutral-fill-loud);
|
|
115
|
+
--wa-color-fill-normal: var(--wa-color-neutral-fill-normal);
|
|
116
|
+
--wa-color-fill-quiet: var(--wa-color-neutral-fill-quiet);
|
|
117
|
+
--wa-color-border-loud: var(--wa-color-neutral-border-loud);
|
|
118
|
+
--wa-color-border-normal: var(--wa-color-neutral-border-normal);
|
|
119
|
+
--wa-color-border-quiet: var(--wa-color-neutral-border-quiet);
|
|
120
|
+
--wa-color-on-loud: var(--wa-color-neutral-on-loud);
|
|
121
|
+
--wa-color-on-normal: var(--wa-color-neutral-on-normal);
|
|
122
|
+
--wa-color-on-quiet: var(--wa-color-neutral-on-quiet);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.wa-brand,
|
|
126
|
+
:host([variant='brand']) {
|
|
127
|
+
--wa-color-fill-loud: var(--wa-color-brand-fill-loud);
|
|
128
|
+
--wa-color-fill-normal: var(--wa-color-brand-fill-normal);
|
|
129
|
+
--wa-color-fill-quiet: var(--wa-color-brand-fill-quiet);
|
|
130
|
+
--wa-color-border-loud: var(--wa-color-brand-border-loud);
|
|
131
|
+
--wa-color-border-normal: var(--wa-color-brand-border-normal);
|
|
132
|
+
--wa-color-border-quiet: var(--wa-color-brand-border-quiet);
|
|
133
|
+
--wa-color-on-loud: var(--wa-color-brand-on-loud);
|
|
134
|
+
--wa-color-on-normal: var(--wa-color-brand-on-normal);
|
|
135
|
+
--wa-color-on-quiet: var(--wa-color-brand-on-quiet);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.wa-success,
|
|
139
|
+
:host([variant='success']) {
|
|
140
|
+
--wa-color-fill-loud: var(--wa-color-success-fill-loud);
|
|
141
|
+
--wa-color-fill-normal: var(--wa-color-success-fill-normal);
|
|
142
|
+
--wa-color-fill-quiet: var(--wa-color-success-fill-quiet);
|
|
143
|
+
--wa-color-border-loud: var(--wa-color-success-border-loud);
|
|
144
|
+
--wa-color-border-normal: var(--wa-color-success-border-normal);
|
|
145
|
+
--wa-color-border-quiet: var(--wa-color-success-border-quiet);
|
|
146
|
+
--wa-color-on-loud: var(--wa-color-success-on-loud);
|
|
147
|
+
--wa-color-on-normal: var(--wa-color-success-on-normal);
|
|
148
|
+
--wa-color-on-quiet: var(--wa-color-success-on-quiet);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.wa-warning,
|
|
152
|
+
:host([variant='warning']) {
|
|
153
|
+
--wa-color-fill-loud: var(--wa-color-warning-fill-loud);
|
|
154
|
+
--wa-color-fill-normal: var(--wa-color-warning-fill-normal);
|
|
155
|
+
--wa-color-fill-quiet: var(--wa-color-warning-fill-quiet);
|
|
156
|
+
--wa-color-border-loud: var(--wa-color-warning-border-loud);
|
|
157
|
+
--wa-color-border-normal: var(--wa-color-warning-border-normal);
|
|
158
|
+
--wa-color-border-quiet: var(--wa-color-warning-border-quiet);
|
|
159
|
+
--wa-color-on-loud: var(--wa-color-warning-on-loud);
|
|
160
|
+
--wa-color-on-normal: var(--wa-color-warning-on-normal);
|
|
161
|
+
--wa-color-on-quiet: var(--wa-color-warning-on-quiet);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.wa-danger,
|
|
165
|
+
:host([variant='danger']) {
|
|
166
|
+
--wa-color-fill-loud: var(--wa-color-danger-fill-loud);
|
|
167
|
+
--wa-color-fill-normal: var(--wa-color-danger-fill-normal);
|
|
168
|
+
--wa-color-fill-quiet: var(--wa-color-danger-fill-quiet);
|
|
169
|
+
--wa-color-border-loud: var(--wa-color-danger-border-loud);
|
|
170
|
+
--wa-color-border-normal: var(--wa-color-danger-border-normal);
|
|
171
|
+
--wa-color-border-quiet: var(--wa-color-danger-border-quiet);
|
|
172
|
+
--wa-color-on-loud: var(--wa-color-danger-on-loud);
|
|
173
|
+
--wa-color-on-normal: var(--wa-color-danger-on-normal);
|
|
174
|
+
--wa-color-on-quiet: var(--wa-color-danger-on-quiet);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.wa-neutral,
|
|
178
|
+
.wa-brand,
|
|
179
|
+
.wa-success,
|
|
180
|
+
.wa-warning,
|
|
181
|
+
.wa-danger,
|
|
182
|
+
:host([variant]) {
|
|
183
|
+
--wa-no-variant: /* space toggle */;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
`;export{o as a,a as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as c,c as
|
|
1
|
+
import{b as c,c as o}from"./chunk.6ZDEZIWM.js";import{b as u,e as l,k as b}from"./chunk.U4P7XQR4.js";import{d as a,e as n,f as s,g as i}from"./chunk.NI7UJOOZ.js";async function y(){customElements.get("wa-callout")||await import("./callout.USQGOL5A.js"),customElements.get("wa-icon")||await import("./icon.ZB6BUFKB.js"),customElements.get("wa-button")||await import("./button.LEHBRWP3.js")}(async()=>await y())();var w,m,f,x,v,t=class extends b{constructor(){super(...arguments);this.name="hot-tracking";s(this,w,"");s(this,m,"");s(this,f,"https://matomo.hotosm.org");s(this,x,!0);s(this,v,"We use cookies and similar technologies to help personalize content, tailor and measure ads, and provide a better experience. By clicking 'Accept', you consent to our use of cookies and tracking technologies.");this.consentGiven=!1;this.consentShown=!1;this.errorMessage="";this.showError=!1;this.successMessage="";this.showSuccess=!1;this.infoMessage="";this.showInfo=!1}get siteId(){return n(this,w)}set siteId(e){i(this,w,e)}get domain(){return n(this,m)}set domain(e){i(this,m,e)}get matomoURL(){return n(this,f)}set matomoURL(e){i(this,f,e)}get showConsent(){return n(this,x)}set showConsent(e){i(this,x,e)}get consentMessage(){return n(this,v)}set consentMessage(e){i(this,v,e)}agree(){this.consentGiven=!0,this.consentShown=!1;let e=window._paq=window._paq||[];e.length!==0&&(e.push(["rememberConsentGiven"]),e.push(["trackPageView"]),this.showSuccessCallout("Tracking consent granted. Thank you!"))}disagree(){this.consentGiven=!1,this.consentShown=!1;let e=window._paq=window._paq||[];e.length!==0&&(e.push(["forgetConsentGiven"]),this.showInfoCallout("Tracking disabled. You can change this preference later."))}showConsentBanner(){this.showConsent&&!this.consentGiven&&!this.consentShown&&(this.consentShown=!0)}showErrorCallout(e){this.errorMessage=e,this.showError=!0,setTimeout(()=>{this.showError=!1},1e4)}showSuccessCallout(e){this.successMessage=e,this.showSuccess=!0,setTimeout(()=>{this.showSuccess=!1},5e3)}showInfoCallout(e){this.infoMessage=e,this.showInfo=!0,setTimeout(()=>{this.showInfo=!1},5e3)}render(){return l`
|
|
2
2
|
${this.showError?l`
|
|
3
3
|
<div class="error-banner">
|
|
4
4
|
<wa-callout style="padding: 1rem;" variant="danger" appearance="outlined filled" size="large">
|
|
@@ -54,7 +54,7 @@ import{b as c,c as r}from"./chunk.6ZDEZIWM.js";import{b,e as l,k as u}from"./chu
|
|
|
54
54
|
</wa-callout>
|
|
55
55
|
</div>
|
|
56
56
|
`:""}
|
|
57
|
-
`}connectedCallback(){if(super.connectedCallback(),window.location.hostname!==this.domain){this.showErrorCallout(`Matomo tracking is not configured for this domain. Current domain: ${window.location.hostname}, Expected: ${this.domain}`);return}let e=this.siteId;if(e.length===0||this.domain.length===0){this.showErrorCallout("Matomo tracking is not properly configured. Please provide both site-id and domain attributes.");return}console.log(`Setting Matomo tracking for site=${e} domain=${this.domain}`);let
|
|
57
|
+
`}connectedCallback(){if(super.connectedCallback(),window.location.hostname!==this.domain){this.showErrorCallout(`Matomo tracking is not configured for this domain. Current domain: ${window.location.hostname}, Expected: ${this.domain}`);return}let e=this.siteId;if(e.length===0||this.domain.length===0){this.showErrorCallout("Matomo tracking is not properly configured. Please provide both site-id and domain attributes.");return}console.log(`Setting Matomo tracking for site=${e} domain=${this.domain}`);let r=window._paq=window._paq||[];r.push(["requireConsent"]),r.push(["setDomains",[this.domain]]),r.push(["enableLinkTracking"]),r.push(["trackVisibleContentImpressions"]),function(g){r.push(["setTrackerUrl",`${g}/matomo.php`]),r.push(["setSiteId",e]);let h=document,p=h.createElement("script"),d=h.getElementsByTagName("script")[0];(d==null?void 0:d.parentNode)!=null?(p.async=!0,p.src=`${g}/matomo.js`,d.parentNode.insertBefore(p,d)):console.warn("Script insertion failed. Parent node is null.")}(this.matomoURL),setTimeout(()=>{this.showConsentBanner()},1e3)}};w=new WeakMap,m=new WeakMap,f=new WeakMap,x=new WeakMap,v=new WeakMap,t.styles=u`
|
|
58
58
|
:host {
|
|
59
59
|
display: block;
|
|
60
60
|
font-family: var(--wa-font-sans);
|
|
@@ -236,4 +236,4 @@ import{b as c,c as r}from"./chunk.6ZDEZIWM.js";import{b,e as l,k as u}from"./chu
|
|
|
236
236
|
width: 100%;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
`,a([c({type:String,attribute:"site-id"})],t.prototype,"siteId",1),a([c({type:String})],t.prototype,"domain",1),a([c({type:String})],t.prototype,"matomoURL",1),a([c({type:Boolean,attribute:"show-consent"})],t.prototype,"showConsent",1),a([c({type:String,attribute:"consent-message"})],t.prototype,"consentMessage",1),a([
|
|
239
|
+
`,a([c({type:String,attribute:"site-id"})],t.prototype,"siteId",1),a([c({type:String})],t.prototype,"domain",1),a([c({type:String})],t.prototype,"matomoURL",1),a([c({type:Boolean,attribute:"show-consent"})],t.prototype,"showConsent",1),a([c({type:String,attribute:"consent-message"})],t.prototype,"consentMessage",1),a([o()],t.prototype,"consentGiven",2),a([o()],t.prototype,"consentShown",2),a([o()],t.prototype,"errorMessage",2),a([o()],t.prototype,"showError",2),a([o()],t.prototype,"successMessage",2),a([o()],t.prototype,"showSuccess",2),a([o()],t.prototype,"infoMessage",2),a([o()],t.prototype,"showInfo",2);var $=t;customElements.define("hot-tracking",t);export{t as a,$ as b};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import{a as h,b as p}from"./chunk.7VBX4GII.js";import{a as f,b as v,c as b}from"./chunk.KPZVTN5G.js";import"./chunk.TFICHQZE.js";import{a as g}from"./chunk.OHRBDQCO.js";import{a as i,b as w}from"./chunk.FIQQYKEP.js";import{a as u,b as r,d as m}from"./chunk.6ZDEZIWM.js";import{e as d}from"./chunk.U4P7XQR4.js";import"./chunk.NI7UJOOZ.js";function y(e){return e.split(" ").map(t=>t.trim()).filter(t=>t!=="")}var x=class extends Event{constructor(){super("wa-after-hide",{bubbles:!0,cancelable:!1,composed:!0})}},k=class extends Event{constructor(){super("wa-after-show",{bubbles:!0,cancelable:!1,composed:!0})}},E=class extends Event{constructor(e){super("wa-hide",{bubbles:!0,cancelable:!0,composed:!0}),this.detail=e}},C=class extends Event{constructor(){super("wa-show",{bubbles:!0,cancelable:!0,composed:!0})}};function l(e,t){return new Promise(n=>{let a=new AbortController,{signal:c}=a;if(e.classList.contains(t))return;e.classList.remove(t),e.classList.add(t);let s=()=>{e.classList.remove(t),n(),a.abort()};e.addEventListener("animationend",s,{once:!0,signal:c}),e.addEventListener("animationcancel",s,{once:!0,signal:c})})}var S=`:host {
|
|
2
|
+
--width: 31rem;
|
|
3
|
+
--spacing: var(--wa-space-l);
|
|
4
|
+
--show-duration: 200ms;
|
|
5
|
+
--hide-duration: 200ms;
|
|
6
|
+
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([open]) {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dialog {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
top: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
width: var(--width);
|
|
22
|
+
max-width: calc(100% - var(--wa-space-2xl));
|
|
23
|
+
max-height: calc(100% - var(--wa-space-2xl));
|
|
24
|
+
background-color: var(--wa-color-surface-raised);
|
|
25
|
+
border-radius: var(--wa-panel-border-radius);
|
|
26
|
+
border: none;
|
|
27
|
+
box-shadow: var(--wa-shadow-l);
|
|
28
|
+
padding: 0;
|
|
29
|
+
margin: auto;
|
|
30
|
+
|
|
31
|
+
&.show {
|
|
32
|
+
animation: show-dialog var(--show-duration) ease;
|
|
33
|
+
|
|
34
|
+
&::backdrop {
|
|
35
|
+
animation: show-backdrop var(--show-duration, 200ms) ease;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.hide {
|
|
40
|
+
animation: show-dialog var(--hide-duration) ease reverse;
|
|
41
|
+
|
|
42
|
+
&::backdrop {
|
|
43
|
+
animation: show-backdrop var(--hide-duration, 200ms) ease reverse;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.pulse {
|
|
48
|
+
animation: pulse 250ms ease;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dialog:focus {
|
|
53
|
+
outline: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Ensure there's enough vertical padding for phones that don't update vh when chrome appears (e.g. iPhone) */
|
|
57
|
+
@media screen and (max-width: 420px) {
|
|
58
|
+
.dialog {
|
|
59
|
+
max-height: 80vh;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.open {
|
|
64
|
+
display: flex;
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.header {
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: nowrap;
|
|
72
|
+
|
|
73
|
+
padding-inline-start: var(--spacing);
|
|
74
|
+
padding-block-end: 0;
|
|
75
|
+
|
|
76
|
+
/* Subtract the close button's padding so that the X is visually aligned with the edges of the dialog content */
|
|
77
|
+
padding-inline-end: calc(var(--spacing) - var(--wa-form-control-padding-block));
|
|
78
|
+
padding-block-start: calc(var(--spacing) - var(--wa-form-control-padding-block));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.title {
|
|
82
|
+
align-self: center;
|
|
83
|
+
flex: 1 1 auto;
|
|
84
|
+
font-family: inherit;
|
|
85
|
+
font-size: var(--wa-font-size-l);
|
|
86
|
+
font-weight: var(--wa-font-weight-heading);
|
|
87
|
+
line-height: var(--wa-line-height-condensed);
|
|
88
|
+
margin: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.header-actions {
|
|
92
|
+
align-self: start;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
flex-wrap: wrap;
|
|
96
|
+
justify-content: end;
|
|
97
|
+
gap: var(--wa-space-2xs);
|
|
98
|
+
padding-inline-start: var(--spacing);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.header-actions wa-button,
|
|
102
|
+
.header-actions ::slotted(wa-button) {
|
|
103
|
+
flex: 0 0 auto;
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.body {
|
|
109
|
+
flex: 1 1 auto;
|
|
110
|
+
display: block;
|
|
111
|
+
padding: var(--spacing);
|
|
112
|
+
overflow: auto;
|
|
113
|
+
-webkit-overflow-scrolling: touch;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.footer {
|
|
117
|
+
flex: 0 0 auto;
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
gap: var(--wa-space-xs);
|
|
121
|
+
justify-content: end;
|
|
122
|
+
padding: var(--spacing);
|
|
123
|
+
padding-block-start: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.footer ::slotted(wa-button:not(:first-of-type)) {
|
|
127
|
+
margin-inline-start: var(--wa-spacing-xs);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.dialog::backdrop {
|
|
131
|
+
/*
|
|
132
|
+
NOTE: the ::backdrop element doesn't inherit properly in Safari yet, but it will in 17.4! At that time, we can
|
|
133
|
+
remove the fallback values here.
|
|
134
|
+
*/
|
|
135
|
+
background-color: var(--wa-color-overlay-modal, rgb(0 0 0 / 0.25));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes pulse {
|
|
139
|
+
0% {
|
|
140
|
+
scale: 1;
|
|
141
|
+
}
|
|
142
|
+
50% {
|
|
143
|
+
scale: 1.02;
|
|
144
|
+
}
|
|
145
|
+
100% {
|
|
146
|
+
scale: 1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@keyframes show-dialog {
|
|
151
|
+
from {
|
|
152
|
+
opacity: 0;
|
|
153
|
+
scale: 0.8;
|
|
154
|
+
}
|
|
155
|
+
to {
|
|
156
|
+
opacity: 1;
|
|
157
|
+
scale: 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@keyframes show-backdrop {
|
|
162
|
+
from {
|
|
163
|
+
opacity: 0;
|
|
164
|
+
}
|
|
165
|
+
to {
|
|
166
|
+
opacity: 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media (forced-colors: active) {
|
|
171
|
+
.dialog {
|
|
172
|
+
border: solid 1px white;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`,o=class extends w{constructor(){super(...arguments),this.localize=new f(this),this.hasSlotController=new b(this,"footer","header-actions","label"),this.open=!1,this.label="",this.withoutHeader=!1,this.lightDismiss=!1,this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.requestClose(this.dialog))}}firstUpdated(){this.open&&(this.addOpenListeners(),this.dialog.showModal(),h(this))}disconnectedCallback(){super.disconnectedCallback(),p(this),this.removeOpenListeners()}async requestClose(e){let t=new E({source:e});if(this.dispatchEvent(t),t.defaultPrevented){this.open=!0,l(this.dialog,"pulse");return}this.removeOpenListeners(),await l(this.dialog,"hide"),this.open=!1,this.dialog.close(),p(this);let n=this.originalTrigger;typeof(n==null?void 0:n.focus)=="function"&&setTimeout(()=>n.focus()),this.dispatchEvent(new x)}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleDialogCancel(e){e.preventDefault(),this.dialog.classList.contains("hide")||this.requestClose(this.dialog)}handleDialogClick(e){let n=e.target.closest('[data-dialog="close"]');n&&(e.stopPropagation(),this.requestClose(n))}async handleDialogPointerDown(e){e.target===this.dialog&&(this.lightDismiss?this.requestClose(this.dialog):await l(this.dialog,"pulse"))}handleOpenChange(){this.open&&!this.dialog.open?this.show():!this.open&&this.dialog.open&&(this.open=!0,this.requestClose(this.dialog))}async show(){let e=new C;if(this.dispatchEvent(e),e.defaultPrevented){this.open=!1;return}this.addOpenListeners(),this.originalTrigger=document.activeElement,this.open=!0,this.dialog.showModal(),h(this),requestAnimationFrame(()=>{let t=this.querySelector("[autofocus]");t&&typeof t.focus=="function"&&t.focus()}),await l(this.dialog,"show"),this.dispatchEvent(new k)}render(){let e=!this.withoutHeader&&(this.label.length>0||this.hasSlotController.test("label")||this.hasSlotController.test("header-actions")),t=this.hasSlotController.test("footer");return d`
|
|
176
|
+
<dialog
|
|
177
|
+
part="dialog"
|
|
178
|
+
class=${v({dialog:!0,open:this.open})}
|
|
179
|
+
@cancel=${this.handleDialogCancel}
|
|
180
|
+
@click=${this.handleDialogClick}
|
|
181
|
+
@pointerdown=${this.handleDialogPointerDown}
|
|
182
|
+
>
|
|
183
|
+
${e?d`
|
|
184
|
+
<header part="header" class="header">
|
|
185
|
+
<h2 part="title" class="title" id="title">
|
|
186
|
+
<!-- If there's no label, use an invisible character to prevent the header from collapsing -->
|
|
187
|
+
<slot name="label"> ${this.label.length>0?this.label:"\uFEFF"} </slot>
|
|
188
|
+
</h2>
|
|
189
|
+
<div part="header-actions" class="header-actions">
|
|
190
|
+
<slot name="header-actions"></slot>
|
|
191
|
+
<wa-button
|
|
192
|
+
part="close-button"
|
|
193
|
+
exportparts="base:close-button__base"
|
|
194
|
+
class="close"
|
|
195
|
+
appearance="plain"
|
|
196
|
+
@click="${n=>this.requestClose(n.target)}"
|
|
197
|
+
>
|
|
198
|
+
<wa-icon
|
|
199
|
+
name="xmark"
|
|
200
|
+
label=${this.localize.term("close")}
|
|
201
|
+
library="system"
|
|
202
|
+
variant="solid"
|
|
203
|
+
></wa-icon>
|
|
204
|
+
</wa-button>
|
|
205
|
+
</div>
|
|
206
|
+
</header>
|
|
207
|
+
`:""}
|
|
208
|
+
|
|
209
|
+
<div part="body" class="body"><slot></slot></div>
|
|
210
|
+
|
|
211
|
+
${t?d`
|
|
212
|
+
<footer part="footer" class="footer">
|
|
213
|
+
<slot name="footer"></slot>
|
|
214
|
+
</footer>
|
|
215
|
+
`:""}
|
|
216
|
+
</dialog>
|
|
217
|
+
`}};o.css=S;i([m(".dialog")],o.prototype,"dialog",2);i([r({type:Boolean,reflect:!0})],o.prototype,"open",2);i([r({reflect:!0})],o.prototype,"label",2);i([r({attribute:"without-header",type:Boolean,reflect:!0})],o.prototype,"withoutHeader",2);i([r({attribute:"light-dismiss",type:Boolean})],o.prototype,"lightDismiss",2);i([g("open",{waitUntilFirstUpdate:!0})],o.prototype,"handleOpenChange",1);o=i([u("wa-dialog")],o);document.addEventListener("click",e=>{let t=e.target.closest("[data-dialog]");if(t instanceof Element){let[n,a]=y(t.getAttribute("data-dialog")||"");if(n==="open"&&(a!=null&&a.length)){let s=t.getRootNode().getElementById(a);(s==null?void 0:s.localName)==="wa-dialog"?s.open=!0:console.warn(`A dialog with an ID of "${a}" could not be found in this document.`)}}});!1||document.addEventListener("pointerdown",()=>{});export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o}from"./chunk.OHRBDQCO.js";import"./chunk.FIQQYKEP.js";import"./chunk.6ZDEZIWM.js";import"./chunk.U4P7XQR4.js";import"./chunk.NI7UJOOZ.js";export{o as default};
|