@webority/ui-elements 0.37.0 → 0.38.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.
Files changed (116) hide show
  1. package/dist/WuiAutocomplete-Comrnbmf.js +13 -0
  2. package/dist/WuiCommandPalette-CKna1GlO.js +2 -0
  3. package/dist/WuiConsentBanner-CFll7vxN.js +201 -0
  4. package/dist/WuiContextMenu-CBy0O4HT.js +1 -0
  5. package/dist/WuiCountrySelect-oLBUHvMM.js +1 -0
  6. package/dist/WuiDatePicker-nB1B3eWW.js +31 -0
  7. package/dist/WuiDateRange-Di5YE9mg.js +25 -0
  8. package/dist/WuiDock-BD2HgMmP.js +1 -0
  9. package/dist/WuiImageCrop-Cr3D2iPo.js +17 -0
  10. package/dist/WuiMultiSelect-BUw-7apM.js +25 -0
  11. package/dist/WuiOtp-BbO_75RB.js +14 -0
  12. package/dist/WuiPhone-GJglNelp.js +15 -0
  13. package/dist/WuiSelect-DvtN4qC2.js +14 -0
  14. package/dist/WuiSlider-Br6V2amU.js +49 -0
  15. package/dist/WuiSortable-Bd7Fz5Ox.js +1 -0
  16. package/dist/WuiTagInput-DzEZooIn.js +6 -0
  17. package/dist/WuiTimePicker-Bolpp93P.js +9 -0
  18. package/dist/WuiTour-DiKZEWeb.js +15 -0
  19. package/dist/WuiTree-SA0QU9AF.js +1 -0
  20. package/dist/WuiWizardStep-DIHxrXn9.js +1 -0
  21. package/dist/anchorOverlay-WcDeH46q.js +1 -0
  22. package/dist/calendarMath-BC2wGCD-.js +1 -0
  23. package/dist/countries-CvmZ2xpG.js +1 -0
  24. package/dist/elementBase-BlsR4tqa.js +1 -0
  25. package/dist/elements/autocomplete.js +1 -6
  26. package/dist/elements/command-palette.js +1 -6
  27. package/dist/elements/consent-banner.js +1 -6
  28. package/dist/elements/context-menu.js +1 -6
  29. package/dist/elements/country-select.js +1 -6
  30. package/dist/elements/date-range.js +1 -6
  31. package/dist/elements/datepicker.js +1 -6
  32. package/dist/elements/dock.js +1 -6
  33. package/dist/elements/image-crop.js +1 -6
  34. package/dist/elements/kanban.js +1 -6
  35. package/dist/elements/multiselect.js +1 -6
  36. package/dist/elements/otp.js +1 -6
  37. package/dist/elements/phone.js +1 -6
  38. package/dist/elements/select.js +1 -6
  39. package/dist/elements/slider.js +1 -6
  40. package/dist/elements/sortable.js +1 -6
  41. package/dist/elements/status-icon.js +1 -6
  42. package/dist/elements/taginput.js +1 -6
  43. package/dist/elements/timepicker.js +1 -6
  44. package/dist/elements/tour.js +1 -6
  45. package/dist/elements/tree.js +1 -6
  46. package/dist/elements/wizard.js +1 -5
  47. package/dist/examples.mobile.json-GS1_MGh9.js +1 -0
  48. package/dist/fileViewerImage-Y9QBn2Rj.js +6 -0
  49. package/dist/fileViewerMedia-CaJaVnjE.js +1 -0
  50. package/dist/fileViewerPdf-BN0zuehw.js +19 -0
  51. package/dist/fileViewerUi-DasgDsU-.js +1 -0
  52. package/dist/focusOrigin-2imUSs-u.js +1 -0
  53. package/dist/formMirror-BgY7zkC3.js +1 -0
  54. package/dist/formatters-BAE__8ye.js +1 -0
  55. package/dist/helpers.js +1 -5
  56. package/dist/iconGlyphs.g-CUm_mfze.js +1 -0
  57. package/dist/kanban-CdELdS3U.js +1 -0
  58. package/dist/listboxKeyNav-DMIvs9d6.js +1 -0
  59. package/dist/max-CNrKnpEj.js +17 -0
  60. package/dist/optionLabel-DsX2fhWs.js +1 -0
  61. package/dist/statusIcons-2X4iGkKL.js +10 -0
  62. package/dist/textMatch-wdY7XLIc.js +1 -0
  63. package/dist/themeTransition-lkmQm8FR.js +1 -0
  64. package/dist/tokenCommit-BKckxgtg.js +2 -0
  65. package/dist/ui-calendar.global.js +1 -1
  66. package/dist/ui-calendar.js +1 -9905
  67. package/dist/ui-chart.js +21 -34563
  68. package/dist/ui-chat-core.js +10 -347
  69. package/dist/ui-chat.js +10 -1066
  70. package/dist/ui-elements.global.js +52 -53
  71. package/dist/ui-elements.js +1 -692
  72. package/dist/ui-file-viewer.js +1 -311
  73. package/dist/ui-rich-text.js +193 -16887
  74. package/dist/wuiHttp-BC8co934.js +1 -0
  75. package/package.json +5 -7
  76. package/dist/WuiAutocomplete-ByxnwJNQ.js +0 -283
  77. package/dist/WuiCommandPalette-CtZ04JxZ.js +0 -130
  78. package/dist/WuiConsentBanner-oVe-jxCO.js +0 -399
  79. package/dist/WuiContextMenu-Bx_U2X3t.js +0 -211
  80. package/dist/WuiCountrySelect-CUAwKnL9.js +0 -28
  81. package/dist/WuiDatePicker-DkNbc-z7.js +0 -325
  82. package/dist/WuiDateRange-BocnVO6L.js +0 -233
  83. package/dist/WuiDock-BSDY9g8Q.js +0 -57
  84. package/dist/WuiImageCrop-1yaAONTk.js +0 -462
  85. package/dist/WuiMultiSelect-BrCGRNCt.js +0 -416
  86. package/dist/WuiOtp-D8-4Pqil.js +0 -128
  87. package/dist/WuiPhone-BvbhiP2r.js +0 -731
  88. package/dist/WuiSelect-BXrpiuXG.js +0 -214
  89. package/dist/WuiSlider-BcU0psYf.js +0 -256
  90. package/dist/WuiSortable-JjJqstSU.js +0 -280
  91. package/dist/WuiTagInput-D1ay3OcL.js +0 -158
  92. package/dist/WuiTimePicker-C7n-VFGt.js +0 -370
  93. package/dist/WuiTour-R5O9l--J.js +0 -205
  94. package/dist/WuiTree-DXP7pGeI.js +0 -393
  95. package/dist/WuiWizardStep-BU5w9_Ds.js +0 -221
  96. package/dist/anchorOverlay-DluGZ8ef.js +0 -23
  97. package/dist/calendarMath-BAF2Jkg_.js +0 -42
  98. package/dist/countries-B-M_LTgS.js +0 -1234
  99. package/dist/elementBase-Bg1xpvup.js +0 -9
  100. package/dist/examples.mobile.json-BMXTGiGC.js +0 -250
  101. package/dist/fileViewerImage-Dky4nQZS.js +0 -185
  102. package/dist/fileViewerMedia-DPk_YcvC.js +0 -133
  103. package/dist/fileViewerPdf-BnIsj-J-.js +0 -15799
  104. package/dist/fileViewerUi-R6hlcShk.js +0 -272
  105. package/dist/formMirror-jGf5M4gk.js +0 -29
  106. package/dist/formatters-DusKbTyV.js +0 -138
  107. package/dist/iconGlyphs.g-Cpg1BUHm.js +0 -215
  108. package/dist/kanban-BIiEMkTK.js +0 -985
  109. package/dist/listboxKeyNav-zts_8d5e.js +0 -36
  110. package/dist/max-BDKx469G.js +0 -14478
  111. package/dist/optionLabel-Dn-I7zyp.js +0 -16
  112. package/dist/statusIcons-C3zjycpa.js +0 -37
  113. package/dist/textMatch-DEUjlkdy.js +0 -27
  114. package/dist/themeTransition-BpCuMnjk.js +0 -589
  115. package/dist/tokenCommit-VWz-2jEf.js +0 -20
  116. package/dist/wuiHttp-oeHs7X_c.js +0 -118
@@ -1,399 +0,0 @@
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 };
@@ -1,211 +0,0 @@
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 };
@@ -1,28 +0,0 @@
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 };