@webority/ui-elements 0.34.0 → 0.35.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 (62) hide show
  1. package/dist/WuiAutocomplete-ByxnwJNQ.js +283 -0
  2. package/dist/WuiCommandPalette-CtZ04JxZ.js +130 -0
  3. package/dist/WuiConsentBanner-oVe-jxCO.js +399 -0
  4. package/dist/WuiContextMenu-Bx_U2X3t.js +211 -0
  5. package/dist/WuiCountrySelect-CUAwKnL9.js +28 -0
  6. package/dist/WuiDatePicker-DkNbc-z7.js +325 -0
  7. package/dist/WuiDateRange-BocnVO6L.js +233 -0
  8. package/dist/WuiDock-BSDY9g8Q.js +57 -0
  9. package/dist/WuiImageCrop-1yaAONTk.js +462 -0
  10. package/dist/WuiMultiSelect-BrCGRNCt.js +416 -0
  11. package/dist/WuiOtp-D8-4Pqil.js +128 -0
  12. package/dist/WuiPhone-BvbhiP2r.js +731 -0
  13. package/dist/WuiSelect-BXrpiuXG.js +214 -0
  14. package/dist/WuiSlider-BcU0psYf.js +256 -0
  15. package/dist/WuiSortable-JjJqstSU.js +280 -0
  16. package/dist/WuiTagInput-D1ay3OcL.js +158 -0
  17. package/dist/WuiTimePicker-C7n-VFGt.js +370 -0
  18. package/dist/WuiTour-R5O9l--J.js +205 -0
  19. package/dist/WuiTree-Ds-8tNgs.js +393 -0
  20. package/dist/WuiWizardStep-BU5w9_Ds.js +221 -0
  21. package/dist/anchorOverlay-DluGZ8ef.js +23 -0
  22. package/dist/calendarMath-BAF2Jkg_.js +42 -0
  23. package/dist/countries-B-M_LTgS.js +1234 -0
  24. package/dist/elementBase-Bg1xpvup.js +9 -0
  25. package/dist/elements/autocomplete.js +6 -0
  26. package/dist/elements/command-palette.js +6 -0
  27. package/dist/elements/consent-banner.js +6 -0
  28. package/dist/elements/context-menu.js +6 -0
  29. package/dist/elements/country-select.js +6 -0
  30. package/dist/elements/date-range.js +6 -0
  31. package/dist/elements/datepicker.js +6 -0
  32. package/dist/elements/dock.js +6 -0
  33. package/dist/elements/image-crop.js +6 -0
  34. package/dist/elements/kanban.js +6 -0
  35. package/dist/elements/multiselect.js +6 -0
  36. package/dist/elements/otp.js +6 -0
  37. package/dist/elements/phone.js +6 -0
  38. package/dist/elements/select.js +6 -0
  39. package/dist/elements/slider.js +6 -0
  40. package/dist/elements/sortable.js +6 -0
  41. package/dist/elements/status-icon.js +6 -0
  42. package/dist/elements/taginput.js +6 -0
  43. package/dist/elements/timepicker.js +6 -0
  44. package/dist/elements/tour.js +6 -0
  45. package/dist/elements/tree.js +6 -0
  46. package/dist/elements/wizard.js +5 -0
  47. package/dist/formMirror-jGf5M4gk.js +29 -0
  48. package/dist/formatters-DusKbTyV.js +138 -0
  49. package/dist/helpers.js +5 -0
  50. package/dist/iconGlyphs.g-Cpg1BUHm.js +215 -0
  51. package/dist/kanban-BeVAItir.js +972 -0
  52. package/dist/listboxKeyNav-zts_8d5e.js +36 -0
  53. package/dist/optionLabel-Dn-I7zyp.js +16 -0
  54. package/dist/statusIcons-C3zjycpa.js +37 -0
  55. package/dist/textMatch-DEUjlkdy.js +27 -0
  56. package/dist/themeTransition-BpCuMnjk.js +589 -0
  57. package/dist/tokenCommit-VWz-2jEf.js +20 -0
  58. package/dist/ui-elements.global.js +118 -129
  59. package/dist/ui-elements.js +253 -8864
  60. package/dist/ui-phone.global.js +14 -0
  61. package/dist/wuiHttp-m0yQadwQ.js +117 -0
  62. package/package.json +28 -3
@@ -0,0 +1,399 @@
1
+ import { t as e } from "./elementBase-Bg1xpvup.js";
2
+ //#region src/consentBannerStandalone.js
3
+ var t = {
4
+ "--color-primary": "#4F46E5",
5
+ "--color-primary-hover": "#4338CA",
6
+ "--color-text": "#071437",
7
+ "--color-text-muted": "#4B5675",
8
+ "--color-border": "#EBEDF3",
9
+ "--color-surface": "#FFFFFF",
10
+ "--wui-radius-lg": "14px",
11
+ "--wui-shadow-overlay-lg": "0 24px 60px -16px rgba(7, 20, 55, 0.28)",
12
+ "--wui-z-fixed": "1030"
13
+ }, n = (e) => `var(${e}, ${t[e]})`, r = `
14
+ :host {
15
+ all: initial;
16
+ position: fixed;
17
+ bottom: 20px;
18
+ left: 20px;
19
+ right: auto;
20
+ z-index: ${n("--wui-z-fixed")};
21
+ display: block;
22
+ width: 420px;
23
+ max-width: calc(100vw - 40px);
24
+ font-family: inherit;
25
+ font-size: 16px;
26
+ line-height: 1.5;
27
+ color: ${n("--color-text")};
28
+ }
29
+ :host([position="bottom-right"]) {
30
+ right: 20px;
31
+ left: auto;
32
+ }
33
+ :host(:not([open])) {
34
+ pointer-events: none;
35
+ }
36
+ *, *::before, *::after {
37
+ box-sizing: border-box;
38
+ }
39
+ [hidden] {
40
+ display: none !important;
41
+ }
42
+
43
+ .wui-consent-banner-panel {
44
+ padding: 20px;
45
+ background: ${n("--color-surface")};
46
+ border: 1px solid ${n("--color-border")};
47
+ border-radius: ${n("--wui-radius-lg")};
48
+ box-shadow: ${n("--wui-shadow-overlay-lg")};
49
+ text-align: start;
50
+ pointer-events: auto;
51
+ }
52
+ .wui-consent-banner-heading {
53
+ margin: 0 0 8px;
54
+ font-size: 18px;
55
+ font-weight: 600;
56
+ line-height: 1.3;
57
+ color: ${n("--color-text")};
58
+ }
59
+ .wui-consent-banner-description {
60
+ margin: 0 0 16px;
61
+ font-size: 14px;
62
+ line-height: 1.5;
63
+ color: ${n("--color-text-muted")};
64
+ }
65
+ .wui-consent-banner-policy {
66
+ color: ${n("--color-primary")};
67
+ font-weight: 500;
68
+ }
69
+
70
+ .wui-consent-banner-settings {
71
+ display: grid;
72
+ gap: 12px;
73
+ max-height: 50vh;
74
+ margin: 0 0 16px;
75
+ padding: 12px 0;
76
+ overflow-y: auto;
77
+ border-top: 1px solid ${n("--color-border")};
78
+ border-bottom: 1px solid ${n("--color-border")};
79
+ }
80
+ .wui-consent-banner-category-description {
81
+ margin: 2px 0 0;
82
+ padding-inline-start: 2.5em;
83
+ font-size: 12px;
84
+ line-height: 1.4;
85
+ color: ${n("--color-text-muted")};
86
+ }
87
+
88
+ .form-check {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: 0.5em;
92
+ margin: 0;
93
+ font-size: 14px;
94
+ }
95
+ .form-check-input {
96
+ appearance: none;
97
+ flex: none;
98
+ width: 2em;
99
+ height: 1em;
100
+ margin: 0;
101
+ border: 1px solid rgba(0, 0, 0, 0.25);
102
+ border-radius: 2em;
103
+ background: ${n("--color-surface")} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat;
104
+ cursor: pointer;
105
+ transition: background-position 0.15s ease-in-out;
106
+ }
107
+ .form-check-input:checked {
108
+ border-color: ${n("--color-primary")};
109
+ background: ${n("--color-primary")} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat;
110
+ }
111
+ .form-check-input:disabled {
112
+ opacity: 0.5;
113
+ cursor: default;
114
+ }
115
+ .form-check-input:focus-visible {
116
+ outline: 2px solid ${n("--color-primary")};
117
+ outline-offset: 2px;
118
+ }
119
+ .form-check-label {
120
+ cursor: pointer;
121
+ }
122
+
123
+ .wui-consent-banner-actions {
124
+ display: flex;
125
+ flex-wrap: wrap;
126
+ align-items: center;
127
+ justify-content: flex-end;
128
+ gap: 8px;
129
+ }
130
+ .btn {
131
+ display: inline-block;
132
+ padding: 0.25rem 0.5rem;
133
+ border: 1px solid transparent;
134
+ border-radius: 0.375rem;
135
+ background: transparent;
136
+ font: inherit;
137
+ font-size: 0.875rem;
138
+ font-weight: 500;
139
+ line-height: 1.5;
140
+ text-align: center;
141
+ white-space: nowrap;
142
+ cursor: pointer;
143
+ }
144
+ .btn:focus-visible {
145
+ outline: 2px solid ${n("--color-primary")};
146
+ outline-offset: 2px;
147
+ }
148
+ .btn-primary {
149
+ background: ${n("--color-primary")};
150
+ border-color: ${n("--color-primary")};
151
+ color: #fff;
152
+ }
153
+ .btn-primary:hover {
154
+ background: ${n("--color-primary-hover")};
155
+ border-color: ${n("--color-primary-hover")};
156
+ }
157
+ .btn-outline-secondary {
158
+ border-color: ${n("--color-text-muted")};
159
+ color: ${n("--color-text-muted")};
160
+ }
161
+ .btn-outline-secondary:hover {
162
+ background: ${n("--color-text-muted")};
163
+ color: #fff;
164
+ }
165
+ .btn-link {
166
+ font-weight: 400;
167
+ color: ${n("--color-primary")};
168
+ text-decoration: underline;
169
+ }
170
+ .btn-link:hover {
171
+ color: ${n("--color-primary-hover")};
172
+ }
173
+ .wui-consent-banner-settings-toggle {
174
+ margin-inline-end: auto;
175
+ padding-inline: 0;
176
+ }
177
+ .wui-consent-banner-save {
178
+ flex: 1 1 100%;
179
+ }
180
+
181
+ @media (max-width: 480px) {
182
+ :host,
183
+ :host([position="bottom-right"]) {
184
+ left: 12px;
185
+ right: 12px;
186
+ bottom: 12px;
187
+ width: auto;
188
+ max-width: none;
189
+ }
190
+ }
191
+ `, i = "wui-consent-save", a = "[data-consent-settings]", o = {
192
+ heading: "Cookies on this site",
193
+ description: "We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.",
194
+ policyLabel: "Cookie policy",
195
+ essentialLabel: "Essential cookies",
196
+ essentialDescription: "Required for the site to work and stay secure. Always on.",
197
+ analyticsLabel: "Analytics cookies",
198
+ analyticsDescription: "Help us understand how visitors use the site.",
199
+ functionalLabel: "Functional cookies",
200
+ functionalDescription: "Remember choices you make, such as your preferences.",
201
+ marketingLabel: "Marketing cookies",
202
+ marketingDescription: "Measure how well our campaigns work.",
203
+ settingsLabel: "Cookie settings",
204
+ rejectLabel: "Reject all",
205
+ acceptLabel: "Accept all",
206
+ saveLabel: "Save preferences"
207
+ }, s = [
208
+ "analytics",
209
+ "functional",
210
+ "marketing"
211
+ ], c = 0, l = class extends e {
212
+ static get observedAttributes() {
213
+ return [
214
+ "heading",
215
+ "description",
216
+ "policy-href",
217
+ "policy-label",
218
+ "analytics-description",
219
+ "functional-description",
220
+ "marketing-description"
221
+ ];
222
+ }
223
+ constructor() {
224
+ super(), c += 1, this._uid = `wui-consent-${c}`, this._preferences = {
225
+ analytics: !1,
226
+ functional: !1,
227
+ marketing: !1
228
+ }, this._settings = !1, this._onDocumentClick = (e) => {
229
+ e.target instanceof Element && e.target.closest(a) && (e.preventDefault(), this.open({
230
+ settings: !0,
231
+ focus: !0
232
+ }));
233
+ };
234
+ }
235
+ get position() {
236
+ return this.getAttribute("position") === "bottom-right" ? "bottom-right" : "bottom-left";
237
+ }
238
+ set position(e) {
239
+ this.setAttribute("position", String(e ?? "bottom-left"));
240
+ }
241
+ get standalone() {
242
+ return this.hasAttribute("standalone");
243
+ }
244
+ set standalone(e) {
245
+ this.toggleAttribute("standalone", e === !0 || e === "" || e === "true");
246
+ }
247
+ get heading() {
248
+ return this.getAttribute("heading") || o.heading;
249
+ }
250
+ set heading(e) {
251
+ this.setAttribute("heading", String(e ?? ""));
252
+ }
253
+ get description() {
254
+ return this.getAttribute("description") || o.description;
255
+ }
256
+ set description(e) {
257
+ this.setAttribute("description", String(e ?? ""));
258
+ }
259
+ get policyHref() {
260
+ return this.getAttribute("policy-href") || "";
261
+ }
262
+ set policyHref(e) {
263
+ this.setAttribute("policy-href", String(e ?? ""));
264
+ }
265
+ get policyLabel() {
266
+ return this.getAttribute("policy-label") || o.policyLabel;
267
+ }
268
+ set policyLabel(e) {
269
+ this.setAttribute("policy-label", String(e ?? ""));
270
+ }
271
+ get analyticsDescription() {
272
+ return this.getAttribute("analytics-description") || o.analyticsDescription;
273
+ }
274
+ set analyticsDescription(e) {
275
+ this.setAttribute("analytics-description", String(e ?? ""));
276
+ }
277
+ get functionalDescription() {
278
+ return this.getAttribute("functional-description") || o.functionalDescription;
279
+ }
280
+ set functionalDescription(e) {
281
+ this.setAttribute("functional-description", String(e ?? ""));
282
+ }
283
+ get marketingDescription() {
284
+ return this.getAttribute("marketing-description") || o.marketingDescription;
285
+ }
286
+ set marketingDescription(e) {
287
+ this.setAttribute("marketing-description", String(e ?? ""));
288
+ }
289
+ get preferences() {
290
+ return { ...this._preferences };
291
+ }
292
+ set preferences(e) {
293
+ this._preferences = {
294
+ analytics: e?.analytics === !0,
295
+ functional: e?.functional === !0,
296
+ marketing: e?.marketing === !0
297
+ }, this._applyPreferences();
298
+ }
299
+ get isOpen() {
300
+ return this.hasAttribute("open");
301
+ }
302
+ connectedCallback() {
303
+ this._rendered || this.render(), document.addEventListener("click", this._onDocumentClick);
304
+ }
305
+ disconnectedCallback() {
306
+ document.removeEventListener("click", this._onDocumentClick);
307
+ }
308
+ attributeChangedCallback() {
309
+ this._rendered && this.render();
310
+ }
311
+ render() {
312
+ let e = this.isOpen, t = this._uid, n = this.policyHref ? ` <a class="wui-consent-banner-policy" href="${f(this.policyHref)}">${d(this.policyLabel)}</a>` : "", i = this._root();
313
+ i.innerHTML = `${i === this ? "" : `<style>${r}</style>`}
314
+ <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden>
315
+ <h2 class="wui-consent-banner-heading" id="${t}-heading">${d(this.heading)}</h2>
316
+ <p class="wui-consent-banner-description" id="${t}-description">${d(this.description)}${n}</p>
317
+ <div class="wui-consent-banner-settings" hidden>
318
+ ${u(t, "essential", o.essentialLabel, o.essentialDescription, !0)}
319
+ ${u(t, "analytics", o.analyticsLabel, this.analyticsDescription, !1)}
320
+ ${u(t, "functional", o.functionalLabel, this.functionalDescription, !1)}
321
+ ${u(t, "marketing", o.marketingLabel, this.marketingDescription, !1)}
322
+ </div>
323
+ <div class="wui-consent-banner-actions">
324
+ <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${o.settingsLabel}</button>
325
+ <button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${o.rejectLabel}</button>
326
+ <button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${o.acceptLabel}</button>
327
+ <button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${o.saveLabel}</button>
328
+ </div>
329
+ </div>`, this._rendered = !0, this._wire(), this._applyPreferences(), this._showSettings(this._settings), e && (this._panel().hidden = !1);
330
+ }
331
+ open({ settings: e = !1, focus: t = !1 } = {}) {
332
+ this._rendered || this.render(), this._applyPreferences(), this._showSettings(e), this._panel().hidden = !1, this.setAttribute("open", ""), t && (e ? this._root().querySelector(".wui-consent-banner-category input:not([disabled])") : this._root().querySelector(".wui-consent-banner-accept"))?.focus();
333
+ }
334
+ close() {
335
+ let e = this._panel();
336
+ e && (e.hidden = !0), this.removeAttribute("open"), this._showSettings(!1);
337
+ }
338
+ _root() {
339
+ return this.shadowRoot ? this.shadowRoot : this.standalone ? this.attachShadow({ mode: "open" }) : this;
340
+ }
341
+ _panel() {
342
+ return this._root().querySelector(".wui-consent-banner-panel");
343
+ }
344
+ _wire() {
345
+ let e = this._root();
346
+ e.querySelector(".wui-consent-banner-accept")?.addEventListener("click", () => this._save({
347
+ analytics: !0,
348
+ functional: !0,
349
+ marketing: !0
350
+ })), e.querySelector(".wui-consent-banner-reject")?.addEventListener("click", () => this._save({
351
+ analytics: !1,
352
+ functional: !1,
353
+ marketing: !1
354
+ })), e.querySelector(".wui-consent-banner-save")?.addEventListener("click", () => this._save(this._switchValues())), e.querySelector(".wui-consent-banner-settings-toggle")?.addEventListener("click", () => this._showSettings(!this._settings));
355
+ }
356
+ _save(e) {
357
+ this._preferences = { ...e }, this.dispatchEvent(new CustomEvent(i, {
358
+ bubbles: !0,
359
+ composed: !0,
360
+ detail: { ...e }
361
+ })), this.close();
362
+ }
363
+ _switchValues() {
364
+ let e = {};
365
+ for (let t of s) e[t] = this._root().querySelector(`input[data-category="${t}"]`)?.checked === !0;
366
+ return e;
367
+ }
368
+ _applyPreferences() {
369
+ for (let e of s) {
370
+ let t = this._root().querySelector(`input[data-category="${e}"]`);
371
+ t && (t.checked = this._preferences[e]);
372
+ }
373
+ }
374
+ _showSettings(e) {
375
+ this._settings = e;
376
+ let t = this._root(), n = t.querySelector(".wui-consent-banner-settings");
377
+ if (!n) return;
378
+ n.hidden = !e, t.querySelector(".wui-consent-banner-settings-toggle")?.setAttribute("aria-expanded", e ? "true" : "false");
379
+ let r = t.querySelector(".wui-consent-banner-save");
380
+ r && (r.hidden = !e);
381
+ for (let n of [".wui-consent-banner-reject", ".wui-consent-banner-accept"]) {
382
+ let r = t.querySelector(n);
383
+ r && (r.hidden = e);
384
+ }
385
+ }
386
+ };
387
+ function u(e, t, n, r, i) {
388
+ let a = `${e}-${t}`;
389
+ return `<div class="wui-consent-banner-category">
390
+ <div class="form-check form-switch">
391
+ <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i ? " checked disabled" : ""} />
392
+ <label class="form-check-label" for="${a}">${d(n)}</label>
393
+ </div>
394
+ <p class="wui-consent-banner-category-description">${d(r)}</p>
395
+ </div>`;
396
+ }
397
+ var d = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), f = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
398
+ //#endregion
399
+ export { l as t };
@@ -0,0 +1,211 @@
1
+ import { t as e } from "./elementBase-Bg1xpvup.js";
2
+ import { t } from "./anchorOverlay-DluGZ8ef.js";
3
+ import { t as n } from "./listboxKeyNav-zts_8d5e.js";
4
+ //#region src/WuiContextMenu.js
5
+ var r = "[role=\"menuitem\"]", i = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]", a = "data-open", o = 500, s = 10, c = 400, l = null, u = null, d = /* @__PURE__ */ new WeakMap();
6
+ function f(e, t, n) {
7
+ let r = d.get(e);
8
+ if (r) {
9
+ if (r.region === t || t.contains(r.region)) return !1;
10
+ r.cancel();
11
+ }
12
+ return d.set(e, {
13
+ region: t,
14
+ cancel: n
15
+ }), !0;
16
+ }
17
+ var p = (e) => e instanceof Element ? e : e?.parentElement ?? null, m = class extends e {
18
+ static get observedAttributes() {
19
+ return ["disabled"];
20
+ }
21
+ constructor() {
22
+ super(), this._region = null, this._origin = null, this._returnFocus = null, this._press = null, this._swallowClick = !1, this._nav = n({
23
+ getVisibleOptions: () => this._items(),
24
+ getActive: () => this._items().indexOf(document.activeElement),
25
+ setActive: (e) => this._items()[e]?.focus({ preventScroll: !0 })
26
+ }), this._onContextMenu = (e) => this._handleContextMenu(e), this._onContextMenuCapture = (e) => {
27
+ this.isOpen && !this._inPanel(e.target) && !this._isKeyEcho() && this.close();
28
+ }, this._onDocKeyDown = (e) => this._handleDocKeyDown(e), this._onPointerDown = (e) => this._handlePointerDown(e), this._onPressMove = (e) => {
29
+ this._press && Math.hypot(e.clientX - this._press.x, e.clientY - this._press.y) > s && this._cancelPress();
30
+ }, this._onPressEnd = () => this._cancelPress(), this._onClickCapture = (e) => {
31
+ !this._swallowClick || !this._region?.contains(e.target) || (this._swallowClick = !1, e.preventDefault(), e.stopImmediatePropagation());
32
+ }, this._onKeyDown = (e) => {
33
+ this._inPanel(e.target) && this._handleMenuKey(e);
34
+ }, this._onClick = (e) => this._handleClick(e), this._onMouseMove = (e) => {
35
+ let t = p(e.target)?.closest(r);
36
+ t && this._inPanel(t) && !this._isDisabled(t) && t !== document.activeElement && t.focus({ preventScroll: !0 });
37
+ }, this._onDismiss = (e) => {
38
+ e.type === "scroll" && this._inPanel(e.target) || this.close();
39
+ }, this._onPointerDownCapture = (e) => {
40
+ this._swallowClick = !1, this.isOpen && !this._inPanel(e.target) && this.close();
41
+ };
42
+ }
43
+ connectedCallback() {
44
+ this._teardown(), document.addEventListener("contextmenu", this._onContextMenuCapture, !0), document.addEventListener("contextmenu", this._onContextMenu), document.addEventListener("keydown", this._onDocKeyDown), document.addEventListener("pointerdown", this._onPointerDownCapture, !0), document.addEventListener("pointerdown", this._onPointerDown), document.addEventListener("click", this._onClickCapture, !0), this.addEventListener("keydown", this._onKeyDown), this.addEventListener("click", this._onClick), this.addEventListener("mousemove", this._onMouseMove);
45
+ }
46
+ disconnectedCallback() {
47
+ this._teardown();
48
+ }
49
+ attributeChangedCallback() {
50
+ this.disabled && this.close();
51
+ }
52
+ get target() {
53
+ return this.getAttribute("target");
54
+ }
55
+ set target(e) {
56
+ e == null || e === "" ? this.removeAttribute("target") : this.setAttribute("target", String(e));
57
+ }
58
+ get disabled() {
59
+ return this.hasAttribute("disabled");
60
+ }
61
+ set disabled(e) {
62
+ this.toggleAttribute("disabled", !!e);
63
+ }
64
+ get isOpen() {
65
+ return this._panel()?.hasAttribute(a) ?? !1;
66
+ }
67
+ open(e, n, { region: r = this, origin: i = r, keyboard: o = !1 } = {}) {
68
+ let s = this._panel();
69
+ if (s) {
70
+ if (l && l !== this && l.close(!0), !this.isOpen) {
71
+ let e = document.activeElement;
72
+ this._returnFocus = e && e !== document.body && !this._inPanel(e) ? e : null;
73
+ }
74
+ this._region = r, this._origin = i, u = null, s.setAttribute(a, ""), l = this, t({ getBoundingClientRect: () => ({
75
+ left: e,
76
+ right: e,
77
+ top: n,
78
+ bottom: n,
79
+ width: 0,
80
+ height: 0
81
+ }) }, s, { clampHeight: !0 }), window.addEventListener("scroll", this._onDismiss, !0), window.addEventListener("resize", this._onDismiss), window.addEventListener("blur", this._onDismiss), ((o ? this._items()[0] : null) ?? s).focus({ preventScroll: !0 }), this.dispatchEvent(new CustomEvent("wui-context-menu:open", {
82
+ bubbles: !0,
83
+ detail: {
84
+ region: r,
85
+ origin: i,
86
+ x: e,
87
+ y: n
88
+ }
89
+ }));
90
+ }
91
+ }
92
+ close(e = !1) {
93
+ let t = this._panel();
94
+ if (!t?.hasAttribute(a)) return;
95
+ t.removeAttribute(a), l === this && (l = null), window.removeEventListener("scroll", this._onDismiss, !0), window.removeEventListener("resize", this._onDismiss), window.removeEventListener("blur", this._onDismiss), this._nav.teardown();
96
+ let n = this._returnFocus;
97
+ this._returnFocus = null, e && n?.isConnected && n.focus({ preventScroll: !0 });
98
+ }
99
+ _panel() {
100
+ return [...this.children].find((e) => e.getAttribute("role") === "menu") ?? null;
101
+ }
102
+ _inPanel(e) {
103
+ return !!e && !!this._panel()?.contains(e);
104
+ }
105
+ _items() {
106
+ return [...this._panel()?.querySelectorAll(r) ?? []].filter((e) => !this._isDisabled(e));
107
+ }
108
+ _isDisabled(e) {
109
+ return e.getAttribute("aria-disabled") === "true";
110
+ }
111
+ _regionFor(e) {
112
+ let t = p(e);
113
+ if (!t || this.disabled || !this._panel() || this._inPanel(t) || t.closest(i)) return null;
114
+ let n = this.target;
115
+ return n ? t.closest(n) : this.contains(t) ? this : null;
116
+ }
117
+ _isKeyEcho() {
118
+ return u?.menu === this && this.isOpen && performance.now() - u.at < c;
119
+ }
120
+ _handleContextMenu(e) {
121
+ if (this._inPanel(e.target)) {
122
+ e.preventDefault();
123
+ return;
124
+ }
125
+ if (e.defaultPrevented && !d.has(e)) return;
126
+ let t = this._regionFor(e.target);
127
+ if (t) {
128
+ if (this._isKeyEcho()) {
129
+ e.preventDefault();
130
+ return;
131
+ }
132
+ e.shiftKey || f(e, t, () => this.close(!0)) && (e.preventDefault(), this.open(e.clientX, e.clientY, {
133
+ region: t,
134
+ origin: p(e.target)
135
+ }));
136
+ }
137
+ }
138
+ _handleDocKeyDown(e) {
139
+ if (e.defaultPrevented && !d.has(e) || !(e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) || this._inPanel(e.target)) return;
140
+ let t = this._regionFor(e.target);
141
+ if (!t || !f(e, t, () => this.close(!0))) return;
142
+ e.preventDefault();
143
+ let n = p(e.target), r = n.getBoundingClientRect();
144
+ this.open(r.left + Math.min(16, r.width / 2), r.bottom, {
145
+ region: t,
146
+ origin: n,
147
+ keyboard: !0
148
+ }), u = {
149
+ menu: this,
150
+ at: performance.now()
151
+ };
152
+ }
153
+ _handlePointerDown(e) {
154
+ if (e.pointerType !== "touch") return;
155
+ let t = this._regionFor(e.target);
156
+ if (!t || !f(e, t, () => this._cancelPress())) return;
157
+ this._cancelPress();
158
+ let { clientX: n, clientY: r } = e, i = p(e.target);
159
+ this._press = {
160
+ x: n,
161
+ y: r,
162
+ timer: setTimeout(() => {
163
+ this._cancelPress(), this._swallowClick = !0, this.open(n, r, {
164
+ region: t,
165
+ origin: i
166
+ });
167
+ }, o)
168
+ }, document.addEventListener("pointermove", this._onPressMove, { passive: !0 }), document.addEventListener("pointerup", this._onPressEnd), document.addEventListener("pointercancel", this._onPressEnd), window.addEventListener("scroll", this._onPressEnd, !0);
169
+ }
170
+ _cancelPress() {
171
+ this._press && (clearTimeout(this._press.timer), this._press = null, document.removeEventListener("pointermove", this._onPressMove), document.removeEventListener("pointerup", this._onPressEnd), document.removeEventListener("pointercancel", this._onPressEnd), window.removeEventListener("scroll", this._onPressEnd, !0));
172
+ }
173
+ _handleMenuKey(e) {
174
+ if (this.isOpen) if (e.key === "Escape") e.preventDefault(), e.stopPropagation(), this.close(!0);
175
+ else if (e.key === "Tab") this.close(!0);
176
+ else if (e.key === "ArrowDown" || e.key === "ArrowUp") e.preventDefault(), this._step(e.key === "ArrowDown" ? 1 : -1);
177
+ else if (e.key === " ") {
178
+ let t = p(e.target)?.closest(r);
179
+ e.preventDefault(), t && t.click();
180
+ } else this._nav.handler(e);
181
+ }
182
+ _step(e) {
183
+ let t = this._items();
184
+ if (!t.length) return;
185
+ let n = t.indexOf(document.activeElement);
186
+ t[n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length].focus({ preventScroll: !0 });
187
+ }
188
+ _handleClick(e) {
189
+ let t = p(e.target)?.closest(r);
190
+ if (!(!t || !this._inPanel(t))) {
191
+ if (this._isDisabled(t)) {
192
+ e.preventDefault(), e.stopPropagation();
193
+ return;
194
+ }
195
+ this.close(!0), this.dispatchEvent(new CustomEvent("wui-context-menu:select", {
196
+ bubbles: !0,
197
+ detail: {
198
+ key: t.dataset.key ?? null,
199
+ item: t,
200
+ region: this._region,
201
+ origin: this._origin
202
+ }
203
+ }));
204
+ }
205
+ }
206
+ _teardown() {
207
+ this.close(), this._cancelPress(), document.removeEventListener("contextmenu", this._onContextMenuCapture, !0), document.removeEventListener("contextmenu", this._onContextMenu), document.removeEventListener("keydown", this._onDocKeyDown), document.removeEventListener("pointerdown", this._onPointerDownCapture, !0), document.removeEventListener("pointerdown", this._onPointerDown), document.removeEventListener("click", this._onClickCapture, !0), this.removeEventListener("keydown", this._onKeyDown), this.removeEventListener("click", this._onClick), this.removeEventListener("mousemove", this._onMouseMove);
208
+ }
209
+ };
210
+ //#endregion
211
+ export { m as t };
@@ -0,0 +1,28 @@
1
+ import { t as e } from "./countries-B-M_LTgS.js";
2
+ import { t } from "./WuiSelect-BXrpiuXG.js";
3
+ //#region src/WuiCountrySelect.js
4
+ var n = (e) => {
5
+ if (e == null) return null;
6
+ let t = String(e).split(",").map((e) => e.trim().toUpperCase()).filter(Boolean);
7
+ return t.length ? new Set(t) : null;
8
+ }, r = (t) => {
9
+ let r = n(t);
10
+ return e.filter(([e]) => !r || r.has(e)).map(([e, t]) => ({
11
+ value: e,
12
+ label: t,
13
+ flag: e
14
+ }));
15
+ }, i = class extends t {
16
+ static get observedAttributes() {
17
+ return [...t.observedAttributes, "countries"];
18
+ }
19
+ _readOptions() {
20
+ let e = this.getAttribute("countries");
21
+ return this._countryCache?.attr !== e && (this._countryCache = {
22
+ attr: e,
23
+ options: r(e)
24
+ }), this._countryCache.options;
25
+ }
26
+ };
27
+ //#endregion
28
+ export { i as t };