@webority/ui-elements 0.9.5 → 0.9.7
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/ui-elements.global.js +68 -68
- package/dist/ui-elements.js +299 -292
- package/package.json +1 -1
package/dist/ui-elements.js
CHANGED
|
@@ -19,37 +19,37 @@ var e = {
|
|
|
19
19
|
let t = this.getAttribute("tone"), n = Number.parseInt(this.getAttribute("size"), 10) || 72, r = e[t] || e.info;
|
|
20
20
|
this.innerHTML = `<svg width="${n}" height="${n}" viewBox="0 0 174 174" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${r}</svg>`;
|
|
21
21
|
}
|
|
22
|
-
}, r = 4;
|
|
23
|
-
function
|
|
22
|
+
}, r = 4, i = 300, a = 400;
|
|
23
|
+
function o(e, t, n = {}) {
|
|
24
24
|
if (!e || !t) return;
|
|
25
|
-
let
|
|
26
|
-
t.classList.toggle("drop-up",
|
|
27
|
-
let
|
|
28
|
-
t.style.left = `${Math.max(r,
|
|
25
|
+
let o = e.getBoundingClientRect(), s = t.offsetHeight, c = window.innerHeight - o.bottom, l = c < s + r && o.top > c;
|
|
26
|
+
t.classList.toggle("drop-up", l), t.style.position = "fixed", t.style.top = l ? `${Math.max(r, o.top - s - r)}px` : `${o.bottom + r}px`, n.matchWidth && (o.width >= i ? (t.style.minWidth = `${o.width}px`, t.style.width = `${o.width}px`, t.style.maxWidth = `${o.width}px`) : (t.style.minWidth = `${o.width}px`, t.style.width = "max-content", t.style.maxWidth = `${Math.min(a, window.innerWidth - r * 2)}px`));
|
|
27
|
+
let u = t.offsetWidth, d = Math.min(o.left, window.innerWidth - u - r);
|
|
28
|
+
t.style.left = `${Math.max(r, d)}px`;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
30
|
+
function s(e, t) {
|
|
31
|
+
c(e), e._reanchor = t, window.addEventListener("resize", e._reanchor), window.addEventListener("scroll", e._reanchor, !0);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function c(e) {
|
|
34
34
|
e?._reanchor && (window.removeEventListener("resize", e._reanchor), window.removeEventListener("scroll", e._reanchor, !0), e._reanchor = null);
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/formMirror.js
|
|
38
|
-
var
|
|
39
|
-
function
|
|
40
|
-
let n = e.getAttribute("name"), r = e.querySelector(`:scope > input[${
|
|
38
|
+
var l = "data-wui-mirror";
|
|
39
|
+
function u(e, t) {
|
|
40
|
+
let n = e.getAttribute("name"), r = e.querySelector(`:scope > input[${l}]`);
|
|
41
41
|
if (!n) {
|
|
42
42
|
r?.remove();
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute(
|
|
45
|
+
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute(l, ""), e.appendChild(r)), r.name = n, r.value = t == null ? "" : String(t);
|
|
46
46
|
for (let t of [...r.attributes]) t.name.startsWith("data-val") && !e.hasAttribute(t.name) && r.removeAttribute(t.name);
|
|
47
47
|
for (let t of e.attributes) t.name.startsWith("data-val") && r.setAttribute(t.name, t.value);
|
|
48
48
|
r.disabled = e.hasAttribute("disabled");
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/iconGlyphs.g.js
|
|
52
|
-
var
|
|
52
|
+
var d = {
|
|
53
53
|
activity: "<path d=\"M9 22h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9v6c0 5 2 7 7 7Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"m7.33 14.49 2.38-3.09c.34-.44.97-.52 1.41-.18l1.83 1.44c.44.34 1.07.26 1.41-.17l2.31-2.98\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
54
54
|
alarm: "<path d=\"M2 22h20M12 6a9 9 0 0 0-9 9v7h18v-7a9 9 0 0 0-9-9ZM12 2v1M4 4l1 1M20 4l-1 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
55
55
|
"alert-circle": "<path d=\"M12 7.75V13M21.08 8.58v6.84c0 1.12-.6 2.16-1.57 2.73l-5.94 3.43c-.97.56-2.17.56-3.15 0l-5.94-3.43a3.15 3.15 0 0 1-1.57-2.73V8.58c0-1.12.6-2.16 1.57-2.73l5.94-3.43c.97-.56 2.17-.56 3.15 0l5.94 3.43c.97.57 1.57 1.6 1.57 2.73Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M12 16.2v.1\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
@@ -192,14 +192,14 @@ var l = {
|
|
|
192
192
|
"zoom-in": "<path d=\"M11 20a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM8.5 11h5M11 13.5v-5M18.93 20.69c.53 1.6 1.74 1.76 2.67.36.85-1.28.29-2.33-1.25-2.33-1.14-.01-1.78.88-1.42 1.97Z\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>",
|
|
193
193
|
"zoom-out": "<path d=\"M9 11.7h5M11.5 21a9.5 9.5 0 1 0 0-19 9.5 9.5 0 0 0 0 19ZM22 22l-2-2\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>"
|
|
194
194
|
};
|
|
195
|
-
Object.keys(
|
|
196
|
-
function
|
|
197
|
-
let i =
|
|
195
|
+
Object.keys(d);
|
|
196
|
+
function f(e, { size: t = 16, className: n = "", style: r = "" } = {}) {
|
|
197
|
+
let i = d[e];
|
|
198
198
|
return i ? `<svg class="${n ? `wui-icon ${n}` : "wui-icon"}" data-icon="${e}" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="vertical-align:-.125em${r ? `;${r}` : ""}">${i}</svg>` : "";
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/listboxKeyNav.js
|
|
202
|
-
function
|
|
202
|
+
function p(e) {
|
|
203
203
|
let { getVisibleOptions: t, getActive: n, setActive: r, onEnter: i, onEscape: a, onTypeahead: o, typeaheadMs: s = 500 } = e, c = "", l = null, u = () => {
|
|
204
204
|
clearTimeout(l), l = null, c = "";
|
|
205
205
|
};
|
|
@@ -230,15 +230,15 @@ function d(e) {
|
|
|
230
230
|
}
|
|
231
231
|
//#endregion
|
|
232
232
|
//#region src/optionLabel.js
|
|
233
|
-
var
|
|
233
|
+
var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), g = (e) => {
|
|
234
234
|
if (!e) return "";
|
|
235
235
|
let t = String(e).toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
236
|
-
return t ?
|
|
237
|
-
},
|
|
236
|
+
return t ? f(t) : "";
|
|
237
|
+
}, _ = (e) => {
|
|
238
238
|
if (e == null) return "";
|
|
239
|
-
let t = e[
|
|
239
|
+
let t = e[m] ? String(e.label ?? "") : h(e.label), n = g(e.icon);
|
|
240
240
|
return n ? `<span class="wui-opt-label">${n}${t}</span>` : t;
|
|
241
|
-
},
|
|
241
|
+
}, v = class extends HTMLElement {
|
|
242
242
|
static formAssociated = !0;
|
|
243
243
|
_accessibleName() {
|
|
244
244
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -297,14 +297,14 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
297
297
|
return this._value;
|
|
298
298
|
}
|
|
299
299
|
set value(e) {
|
|
300
|
-
this._value = e == null ? "" : String(e),
|
|
300
|
+
this._value = e == null ? "" : String(e), u(this, this._value);
|
|
301
301
|
let t = this._readOptions().find((e) => String(e.value) === this._value);
|
|
302
|
-
this._label = t ?
|
|
302
|
+
this._label = t ? b(t.label) : "", this._syncInput(), this._renderOptions("");
|
|
303
303
|
}
|
|
304
304
|
set options(e) {
|
|
305
305
|
this._optionsProp = Array.isArray(e) ? e : [];
|
|
306
306
|
let t = this._readOptions().find((e) => String(e.value) === this._value);
|
|
307
|
-
t && (this._label =
|
|
307
|
+
t && (this._label = b(t.label)), this._renderOptions(), this._syncInput();
|
|
308
308
|
}
|
|
309
309
|
get options() {
|
|
310
310
|
return this._readOptions();
|
|
@@ -323,7 +323,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
323
323
|
}
|
|
324
324
|
_matchesKnownOption(e) {
|
|
325
325
|
let t = e.toLowerCase();
|
|
326
|
-
return this._readOptions().some((e) =>
|
|
326
|
+
return this._readOptions().some((e) => b(e.label).toLowerCase() === t || String(e.value ?? "").toLowerCase() === t);
|
|
327
327
|
}
|
|
328
328
|
get _minChars() {
|
|
329
329
|
return Math.max(0, Number(this.getAttribute("min-chars")) || +!!this._remote);
|
|
@@ -341,7 +341,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
341
341
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
342
342
|
label: e.innerHTML,
|
|
343
343
|
icon: e.getAttribute("icon") || void 0,
|
|
344
|
-
[
|
|
344
|
+
[m]: !0,
|
|
345
345
|
selected: e.hasAttribute("selected")
|
|
346
346
|
})));
|
|
347
347
|
}
|
|
@@ -355,17 +355,17 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
355
355
|
let r = `${this.id}-listbox`;
|
|
356
356
|
this._listboxId = r, this.innerHTML = `
|
|
357
357
|
<div class="search-select${n}">
|
|
358
|
-
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
359
|
-
<input class="search-select-input search-select-ac-input" placeholder="${
|
|
358
|
+
<div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${y(r)}" aria-label="${y(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}>
|
|
359
|
+
<input class="search-select-input search-select-ac-input" placeholder="${y(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
360
360
|
<span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
|
|
361
|
-
<button type="button" class="search-select-clear" aria-label="Clear" hidden>${
|
|
361
|
+
<button type="button" class="search-select-clear" aria-label="Clear" hidden>${f("x")}</button>
|
|
362
362
|
</div>
|
|
363
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
363
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${y(r)}" tabindex="-1" hidden>
|
|
364
364
|
<div class="search-select-options"></div>
|
|
365
365
|
<div class="search-select-empty" hidden>No matches</div>
|
|
366
366
|
<div class="search-select-hint" hidden>Type to search…</div>
|
|
367
367
|
</div>
|
|
368
|
-
</div>`, this._rendered = !0,
|
|
368
|
+
</div>`, this._rendered = !0, u(this, this._value), this._wire(), this._syncInput(), this._renderOptions();
|
|
369
369
|
}
|
|
370
370
|
_refs() {
|
|
371
371
|
return {
|
|
@@ -394,7 +394,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
394
394
|
let t = this._refs();
|
|
395
395
|
if (!t.optionsWrap) return;
|
|
396
396
|
let n = e ?? (t.input ? t.input.value : ""), r = n.trim().toLowerCase(), i = this._readOptions();
|
|
397
|
-
!this._remote && r && (i = i.filter((e) =>
|
|
397
|
+
!this._remote && r && (i = i.filter((e) => b(e.label).toLowerCase().includes(r)));
|
|
398
398
|
let a = n.trim(), o = this._allowCustom && a && !this._matchesKnownOption(a) ? [...i, {
|
|
399
399
|
value: a,
|
|
400
400
|
custom: !0
|
|
@@ -402,42 +402,42 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
402
402
|
t.optionsWrap.innerHTML = o.map((e, t) => {
|
|
403
403
|
let n = `${s}-opt-${t}`;
|
|
404
404
|
if (e.custom) {
|
|
405
|
-
let t = `Add “${
|
|
406
|
-
return `<button type="button" role="option" id="${
|
|
405
|
+
let t = `Add “${h(e.value)}”`;
|
|
406
|
+
return `<button type="button" role="option" id="${y(n)}" class="search-select-option search-select-option-custom" data-value="${y(e.value)}" data-custom="true" aria-selected="false">${t}</button>`;
|
|
407
407
|
}
|
|
408
408
|
let r = String(e.value) === String(this._value);
|
|
409
|
-
return `<button type="button" role="option" id="${
|
|
409
|
+
return `<button type="button" role="option" id="${y(n)}" class="search-select-option${r ? " selected" : ""}" data-value="${y(e.value)}" aria-selected="${r}">${_(e)}</button>`;
|
|
410
410
|
}).join(""), this._active = -1, t.control?.removeAttribute("aria-activedescendant");
|
|
411
411
|
let c = r.length < this._minChars;
|
|
412
|
-
t.hint && (t.hint.hidden = !(this._remote && c && !i.length)), t.empty && (t.empty.hidden = this._loading || o.length > 0 || this._remote && c);
|
|
412
|
+
t.hint && (t.hint.hidden = !(this._remote && c && !i.length)), t.empty && (t.empty.hidden = this._loading || o.length > 0 || this._remote && c), this._reanchor?.();
|
|
413
413
|
}
|
|
414
414
|
_wire() {
|
|
415
415
|
this._teardown();
|
|
416
416
|
let e = this._refs();
|
|
417
417
|
if (!e.control || !e.input) return;
|
|
418
|
-
let t = () =>
|
|
418
|
+
let t = () => o(e.control, e.menu, { matchWidth: !0 }), n = () => this._optionEls().filter((e) => !e.hidden), r = (t) => {
|
|
419
419
|
let r = n();
|
|
420
420
|
this._active = t;
|
|
421
421
|
for (let e of this._optionEls()) e.classList.remove("is-active");
|
|
422
422
|
t >= 0 && r[t] ? (r[t].classList.add("is-active"), r[t].scrollIntoView({ block: "nearest" }), e.control.setAttribute("aria-activedescendant", r[t].id)) : e.control.removeAttribute("aria-activedescendant");
|
|
423
|
-
},
|
|
423
|
+
}, i = () => !e.menu.hidden, a = () => {
|
|
424
424
|
e.menu.hidden = !1, e.control.setAttribute("aria-expanded", "true"), e.control.classList.add("open"), t(), this._renderOptions();
|
|
425
|
-
},
|
|
425
|
+
}, c = () => {
|
|
426
426
|
e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), r(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "", this._syncInput();
|
|
427
|
-
},
|
|
427
|
+
}, l = (t) => {
|
|
428
428
|
let n = t.dataset.custom === "true";
|
|
429
|
-
this._value = t.dataset.value, this._label = n ? t.dataset.value :
|
|
429
|
+
this._value = t.dataset.value, this._label = n ? t.dataset.value : b(t.innerHTML), u(this, this._value), e.input.value = this._label, this.dispatchEvent(new CustomEvent("change", {
|
|
430
430
|
bubbles: !0,
|
|
431
431
|
detail: { isCustom: n }
|
|
432
|
-
})),
|
|
433
|
-
},
|
|
434
|
-
this._value = t, this._label = t,
|
|
432
|
+
})), c(), e.input.focus();
|
|
433
|
+
}, d = (t) => {
|
|
434
|
+
this._value = t, this._label = t, u(this, t), e.input.value = t, this.dispatchEvent(new CustomEvent("change", {
|
|
435
435
|
bubbles: !0,
|
|
436
436
|
detail: { isCustom: !0 }
|
|
437
|
-
})),
|
|
438
|
-
},
|
|
437
|
+
})), c();
|
|
438
|
+
}, f = () => {
|
|
439
439
|
let t = e.input.value;
|
|
440
|
-
if (e.clear && (e.clear.hidden = !t),
|
|
440
|
+
if (e.clear && (e.clear.hidden = !t), i() || a(), this._remote) {
|
|
441
441
|
if (this._renderOptions(t), clearTimeout(this._timer), t.trim().length < this._minChars) {
|
|
442
442
|
this._pendingSearch = null;
|
|
443
443
|
return;
|
|
@@ -449,52 +449,52 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
449
449
|
}, this._timer = setTimeout(() => this._fireSearch(t, e), this._debounceMs);
|
|
450
450
|
} else this._renderOptions(t);
|
|
451
451
|
};
|
|
452
|
-
this._navHandler =
|
|
452
|
+
this._navHandler = p({
|
|
453
453
|
getVisibleOptions: n,
|
|
454
454
|
getActive: () => this._active,
|
|
455
455
|
setActive: (e) => r(e),
|
|
456
456
|
onEnter: (t, n) => {
|
|
457
|
-
if (n[this._active])
|
|
457
|
+
if (n[this._active]) l(n[this._active]);
|
|
458
458
|
else if (this._allowCustom) {
|
|
459
459
|
let t = e.input.value.trim();
|
|
460
|
-
t && !this._matchesKnownOption(t) &&
|
|
460
|
+
t && !this._matchesKnownOption(t) && d(t);
|
|
461
461
|
}
|
|
462
462
|
},
|
|
463
463
|
onEscape: () => {
|
|
464
|
-
this._navHandler.clearTypeahead(),
|
|
464
|
+
this._navHandler.clearTypeahead(), c();
|
|
465
465
|
}
|
|
466
466
|
});
|
|
467
467
|
let m = (e) => {
|
|
468
468
|
let t = e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA";
|
|
469
469
|
if (e.key === "ArrowDown") {
|
|
470
|
-
e.preventDefault(),
|
|
470
|
+
e.preventDefault(), i() || a();
|
|
471
471
|
let t = n();
|
|
472
472
|
r(Math.min(this._active + 1, t.length - 1));
|
|
473
473
|
return;
|
|
474
474
|
} else if (e.key === "ArrowUp") {
|
|
475
475
|
e.preventDefault(), r(Math.max(this._active - 1, 0));
|
|
476
476
|
return;
|
|
477
|
-
} else if ((e.key === "Home" || e.key === "End" || e.key === "PageDown" || e.key === "PageUp") && (!
|
|
478
|
-
else if (e.key.length === 1 && (e.ctrlKey || e.metaKey || e.altKey || !
|
|
477
|
+
} else if ((e.key === "Home" || e.key === "End" || e.key === "PageDown" || e.key === "PageUp") && (!i() || t)) return;
|
|
478
|
+
else if (e.key.length === 1 && (e.ctrlKey || e.metaKey || e.altKey || !i() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA") && (!i() || e.target?.tagName === "INPUT" || e.target?.tagName === "TEXTAREA")) return;
|
|
479
479
|
this._navHandler.handler(e);
|
|
480
480
|
};
|
|
481
|
-
e.input.addEventListener("focus", () =>
|
|
481
|
+
e.input.addEventListener("focus", () => a()), e.input.addEventListener("input", f), e.input.addEventListener("keydown", m), e.menu.addEventListener("keydown", m), e.input.addEventListener("blur", (t) => {
|
|
482
482
|
if (!this._allowCustom || t.relatedTarget && this.contains(t.relatedTarget)) return;
|
|
483
483
|
let n = e.input.value.trim();
|
|
484
|
-
!n || n === this._label || this._matchesKnownOption(n) ||
|
|
484
|
+
!n || n === this._label || this._matchesKnownOption(n) || d(n);
|
|
485
485
|
}), e.optionsWrap.addEventListener("click", (e) => {
|
|
486
486
|
let t = e.target.closest(".search-select-option");
|
|
487
|
-
t &&
|
|
487
|
+
t && l(t);
|
|
488
488
|
}), e.optionsWrap.addEventListener("mousemove", (e) => {
|
|
489
489
|
let t = e.target.closest(".search-select-option");
|
|
490
490
|
t && r(this._optionEls().indexOf(t));
|
|
491
491
|
}), e.optionsWrap.addEventListener("mouseleave", () => r(-1)), e.clear?.addEventListener("click", () => {
|
|
492
|
-
this._value = "", this._label = "",
|
|
492
|
+
this._value = "", this._label = "", u(this, ""), e.input.value = "", e.clear.hidden = !0, this._renderOptions(""), this.dispatchEvent(new Event("change", { bubbles: !0 })), e.input.focus();
|
|
493
493
|
}), this._bindGlobal = () => {
|
|
494
494
|
this._teardown(), this._onDocClick = (e) => {
|
|
495
|
-
|
|
496
|
-
}, document.addEventListener("click", this._onDocClick),
|
|
497
|
-
|
|
495
|
+
i() && !this.contains(e.target) && c();
|
|
496
|
+
}, document.addEventListener("click", this._onDocClick), s(this, () => {
|
|
497
|
+
i() && t();
|
|
498
498
|
});
|
|
499
499
|
}, this._bindGlobal();
|
|
500
500
|
}
|
|
@@ -508,12 +508,12 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
508
508
|
}));
|
|
509
509
|
}
|
|
510
510
|
_teardown() {
|
|
511
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null),
|
|
511
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), c(this), clearTimeout(this._timer), this._navHandler?.teardown();
|
|
512
512
|
}
|
|
513
513
|
disconnectedCallback() {
|
|
514
514
|
this._teardown();
|
|
515
515
|
}
|
|
516
|
-
},
|
|
516
|
+
}, y = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), b = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), x = [
|
|
517
517
|
"January",
|
|
518
518
|
"February",
|
|
519
519
|
"March",
|
|
@@ -526,7 +526,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
526
526
|
"October",
|
|
527
527
|
"November",
|
|
528
528
|
"December"
|
|
529
|
-
],
|
|
529
|
+
], S = [
|
|
530
530
|
"Su",
|
|
531
531
|
"Mo",
|
|
532
532
|
"Tu",
|
|
@@ -534,24 +534,24 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
534
534
|
"Th",
|
|
535
535
|
"Fr",
|
|
536
536
|
"Sa"
|
|
537
|
-
],
|
|
537
|
+
], C = (e) => String(e).padStart(2, "0"), w = (e, t, n) => `${e}-${C(t + 1)}-${C(n)}`, T = (e) => {
|
|
538
538
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e || "");
|
|
539
539
|
return t ? {
|
|
540
540
|
y: +t[1],
|
|
541
541
|
m: t[2] - 1,
|
|
542
542
|
d: +t[3]
|
|
543
543
|
} : null;
|
|
544
|
-
},
|
|
545
|
-
let t =
|
|
546
|
-
return t ? `${
|
|
547
|
-
},
|
|
544
|
+
}, E = (e) => {
|
|
545
|
+
let t = T(e);
|
|
546
|
+
return t ? `${C(t.d)} ${x[t.m].slice(0, 3)} ${t.y}` : "";
|
|
547
|
+
}, D = (e, t) => new Date(e, t + 1, 0).getDate(), O = (e, t) => {
|
|
548
548
|
for (; t < 0;) t += 12, --e;
|
|
549
549
|
for (; t > 11;) t -= 12, e += 1;
|
|
550
550
|
return {
|
|
551
551
|
y: e,
|
|
552
552
|
m: t
|
|
553
553
|
};
|
|
554
|
-
},
|
|
554
|
+
}, ee = class extends HTMLElement {
|
|
555
555
|
static formAssociated = !0;
|
|
556
556
|
static get observedAttributes() {
|
|
557
557
|
return [
|
|
@@ -594,7 +594,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
594
594
|
return this._value;
|
|
595
595
|
}
|
|
596
596
|
set value(e) {
|
|
597
|
-
this._value = e || "",
|
|
597
|
+
this._value = e || "", u(this, this._value), this._syncTrigger();
|
|
598
598
|
}
|
|
599
599
|
_firstDay() {
|
|
600
600
|
let e = Number.parseInt(this.getAttribute("first-day") ?? "", 10);
|
|
@@ -602,29 +602,29 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
602
602
|
}
|
|
603
603
|
render() {
|
|
604
604
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
605
|
-
let e = this.getAttribute("placeholder") || "Enter Date", t =
|
|
605
|
+
let e = this.getAttribute("placeholder") || "Enter Date", t = T(this._value);
|
|
606
606
|
t && (this._viewY = t.y, this._viewM = t.m);
|
|
607
607
|
let n = this.getAttribute("size"), r = n === "sm" ? " input-sm" : n === "lg" ? " input-lg" : "", i = this.getAttribute("aria-label"), a = this.getAttribute("aria-describedby");
|
|
608
608
|
this.innerHTML = `
|
|
609
609
|
<div class="datepicker">
|
|
610
|
-
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${
|
|
611
|
-
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ?
|
|
612
|
-
${
|
|
610
|
+
<button type="button" class="input datepicker-trigger${r}${t ? " has-value" : ""}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${i ? ` aria-label="${h(i)}"` : ""}${a ? ` aria-describedby="${h(a)}"` : ""}>
|
|
611
|
+
<span data-trigger-label class="${t ? "" : "search-select-placeholder"}">${t ? E(this._value) : h(e)}</span>
|
|
612
|
+
${f("calendar-dots")}
|
|
613
613
|
</button>
|
|
614
614
|
<div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
|
|
615
|
-
</div>`, this._rendered = !0,
|
|
615
|
+
</div>`, this._rendered = !0, u(this, this._value), this._wire();
|
|
616
616
|
}
|
|
617
617
|
_syncFormValue() {
|
|
618
|
-
|
|
618
|
+
u(this, this._value);
|
|
619
619
|
}
|
|
620
620
|
_syncTrigger() {
|
|
621
621
|
let e = this.querySelector(".datepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
622
622
|
if (!t) return;
|
|
623
|
-
let n =
|
|
624
|
-
t.textContent = n ?
|
|
623
|
+
let n = T(this._value);
|
|
624
|
+
t.textContent = n ? E(this._value) : this.getAttribute("placeholder") || "Enter Date", t.classList.toggle("search-select-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
625
625
|
}
|
|
626
626
|
_limits() {
|
|
627
|
-
let e =
|
|
627
|
+
let e = T(this.getAttribute("min")), t = T(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
|
|
628
628
|
return {
|
|
629
629
|
dayDisabled: (e, t, i) => {
|
|
630
630
|
let a = new Date(e, t, i).getTime();
|
|
@@ -632,7 +632,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
632
632
|
},
|
|
633
633
|
monthDisabled: (e, t) => {
|
|
634
634
|
let i = new Date(e, t, 1).getTime();
|
|
635
|
-
return new Date(e, t,
|
|
635
|
+
return new Date(e, t, D(e, t)).getTime() < n || i > r;
|
|
636
636
|
},
|
|
637
637
|
yearDisabled: (e) => {
|
|
638
638
|
let t = new Date(e, 0, 1).getTime();
|
|
@@ -645,29 +645,29 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
645
645
|
e && (this._mode === "months" ? e.innerHTML = this._monthsHtml() : this._mode === "years" ? e.innerHTML = this._yearsHtml() : e.innerHTML = this._daysHtml(), this._focusActive());
|
|
646
646
|
}
|
|
647
647
|
_daysHtml() {
|
|
648
|
-
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n =
|
|
648
|
+
let e = this._firstDay(), t = (new Date(this._viewY, this._viewM, 1).getDay() - e + 7) % 7, n = D(this._viewY, this._viewM), r = T(this._value), i = /* @__PURE__ */ new Date(), { dayDisabled: a } = this._limits(), o = this._focus || r || {
|
|
649
649
|
y: this._viewY,
|
|
650
650
|
m: this._viewM,
|
|
651
651
|
d: 1
|
|
652
652
|
}, s = (e, t, n, s) => {
|
|
653
|
-
let c =
|
|
653
|
+
let c = w(e, t, n), l = r && r.y === e && r.m === t && r.d === n, u = i.getFullYear() === e && i.getMonth() === t && i.getDate() === n, d = o.y === e && o.m === t && o.d === n, f = a(e, t, n);
|
|
654
654
|
return `<button type="button" class="${[
|
|
655
655
|
"datepicker-day",
|
|
656
656
|
s ? "is-outside" : "",
|
|
657
657
|
u ? "is-today" : "",
|
|
658
658
|
l ? "is-selected" : ""
|
|
659
659
|
].filter(Boolean).join(" ")}" data-iso="${c}" role="gridcell" tabindex="${d && !f ? "0" : "-1"}"${l ? " aria-selected=\"true\"" : ""}${f ? " disabled aria-disabled=\"true\"" : ""}>${n}</button>`;
|
|
660
|
-
}, c = "", l =
|
|
661
|
-
for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m,
|
|
660
|
+
}, c = "", l = O(this._viewY, this._viewM - 1), u = D(l.y, l.m);
|
|
661
|
+
for (let e = t - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
662
662
|
for (let e = 1; e <= n; e++) c += s(this._viewY, this._viewM, e, !1);
|
|
663
|
-
let
|
|
664
|
-
for (let e = 1; e <= p; e++) c += s(
|
|
665
|
-
let m =
|
|
663
|
+
let d = O(this._viewY, this._viewM + 1), p = (7 - (t + n) % 7) % 7;
|
|
664
|
+
for (let e = 1; e <= p; e++) c += s(d.y, d.m, e, !0);
|
|
665
|
+
let m = S.map((t, n) => S[(n + e) % 7]).map((e) => `<span>${e}</span>`).join("");
|
|
666
666
|
return `
|
|
667
667
|
<div class="datepicker-head">
|
|
668
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${
|
|
669
|
-
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${
|
|
670
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${
|
|
668
|
+
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${f("chevron-left")}</button>
|
|
669
|
+
<button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${x[this._viewM]} ${this._viewY}</button>
|
|
670
|
+
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${f("chevron-right")}</button>
|
|
671
671
|
</div>
|
|
672
672
|
<div class="datepicker-weekdays">${m}</div>
|
|
673
673
|
<div class="datepicker-grid${this._slide ? ` ${this._slide}` : ""}" role="grid">${c}</div>
|
|
@@ -677,25 +677,25 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
677
677
|
</div>`;
|
|
678
678
|
}
|
|
679
679
|
_monthsHtml() {
|
|
680
|
-
let e =
|
|
680
|
+
let e = T(this._value), t = /* @__PURE__ */ new Date(), { monthDisabled: n } = this._limits(), r = "";
|
|
681
681
|
for (let i = 0; i < 12; i++) {
|
|
682
682
|
let a = e && e.y === this._viewY && e.m === i, o = t.getFullYear() === this._viewY && t.getMonth() === i, s = n(this._viewY, i), c = [
|
|
683
683
|
"datepicker-cell",
|
|
684
684
|
o ? "is-today" : "",
|
|
685
685
|
a ? "is-selected" : ""
|
|
686
686
|
].filter(Boolean).join(" ");
|
|
687
|
-
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${
|
|
687
|
+
r += `<button type="button" class="${c}" data-month="${i}"${s ? " disabled" : ""}>${x[i].slice(0, 3)}</button>`;
|
|
688
688
|
}
|
|
689
689
|
return `
|
|
690
690
|
<div class="datepicker-head">
|
|
691
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${
|
|
691
|
+
<button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${f("chevron-left")}</button>
|
|
692
692
|
<button type="button" class="datepicker-month" data-view="years" aria-label="Choose year">${this._viewY}</button>
|
|
693
|
-
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${
|
|
693
|
+
<button type="button" class="datepicker-nav-btn" data-nav-year="1" aria-label="Next year">${f("chevron-right")}</button>
|
|
694
694
|
</div>
|
|
695
695
|
<div class="datepicker-cells">${r}</div>`;
|
|
696
696
|
}
|
|
697
697
|
_yearsHtml() {
|
|
698
|
-
let e =
|
|
698
|
+
let e = T(this._value), t = (/* @__PURE__ */ new Date()).getFullYear(), { yearDisabled: n } = this._limits(), r = this._viewY - (this._viewY % 10 + 10) % 10 - 1, i = "";
|
|
699
699
|
for (let a = 0; a < 12; a++) {
|
|
700
700
|
let o = r + a, s = e && e.y === o, c = t === o, l = n(o), u = [
|
|
701
701
|
"datepicker-cell",
|
|
@@ -706,9 +706,9 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
706
706
|
}
|
|
707
707
|
return `
|
|
708
708
|
<div class="datepicker-head">
|
|
709
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${
|
|
709
|
+
<button type="button" class="datepicker-nav-btn" data-nav-decade="-1" aria-label="Previous decade">${f("chevron-left")}</button>
|
|
710
710
|
<span class="datepicker-month">${r + 1} – ${r + 10}</span>
|
|
711
|
-
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${
|
|
711
|
+
<button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${f("chevron-right")}</button>
|
|
712
712
|
</div>
|
|
713
713
|
<div class="datepicker-cells">${i}</div>`;
|
|
714
714
|
}
|
|
@@ -717,24 +717,24 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
717
717
|
t && e.contains(document.activeElement) && t.focus();
|
|
718
718
|
}
|
|
719
719
|
_position(e, t) {
|
|
720
|
-
|
|
720
|
+
o(e, t);
|
|
721
721
|
}
|
|
722
722
|
_setFocus(e, t, n, r) {
|
|
723
|
-
let { y: i, m: a } =
|
|
723
|
+
let { y: i, m: a } = O(e, t);
|
|
724
724
|
this._focus = {
|
|
725
725
|
y: i,
|
|
726
726
|
m: a,
|
|
727
727
|
d: n
|
|
728
728
|
};
|
|
729
729
|
let o = i !== this._viewY || a !== this._viewM;
|
|
730
|
-
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${
|
|
730
|
+
this._viewY = i, this._viewM = a, this._slide = o && r || "", this._renderView(), this._slide = "", this.querySelector(`.datepicker-day[data-iso="${w(i, a, n)}"]`)?.focus();
|
|
731
731
|
}
|
|
732
732
|
_onKey(e) {
|
|
733
733
|
if (this._mode !== "days") {
|
|
734
734
|
e.key === "Escape" && this._close();
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
|
-
let t = this._focus ||
|
|
737
|
+
let t = this._focus || T(this._value) || {
|
|
738
738
|
y: this._viewY,
|
|
739
739
|
m: this._viewM,
|
|
740
740
|
d: 1
|
|
@@ -752,17 +752,17 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
752
752
|
case "End": return n(6 - (new Date(t.y, t.m, t.d).getDay() - this._firstDay() + 7) % 7, "slide-next");
|
|
753
753
|
case "PageUp": {
|
|
754
754
|
e.preventDefault();
|
|
755
|
-
let n =
|
|
756
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
755
|
+
let n = O(t.y, t.m - (e.shiftKey ? 12 : 1));
|
|
756
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, D(n.y, n.m)), "slide-prev");
|
|
757
757
|
}
|
|
758
758
|
case "PageDown": {
|
|
759
759
|
e.preventDefault();
|
|
760
|
-
let n =
|
|
761
|
-
return this._setFocus(n.y, n.m, Math.min(t.d,
|
|
760
|
+
let n = O(t.y, t.m + (e.shiftKey ? 12 : 1));
|
|
761
|
+
return this._setFocus(n.y, n.m, Math.min(t.d, D(n.y, n.m)), "slide-next");
|
|
762
762
|
}
|
|
763
763
|
case "Enter":
|
|
764
764
|
case " ":
|
|
765
|
-
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value =
|
|
765
|
+
e.preventDefault(), this._limits().dayDisabled(t.y, t.m, t.d) || (this.value = w(t.y, t.m, t.d), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close());
|
|
766
766
|
return;
|
|
767
767
|
case "Escape": return this._close();
|
|
768
768
|
default:
|
|
@@ -774,7 +774,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
774
774
|
if (!e || !t) return;
|
|
775
775
|
let r = () => !t.hidden;
|
|
776
776
|
this._open = () => {
|
|
777
|
-
let r = /* @__PURE__ */ new Date(), i =
|
|
777
|
+
let r = /* @__PURE__ */ new Date(), i = T(this._value);
|
|
778
778
|
(i || !this._viewNavigated) && (this._viewY = r.getFullYear(), this._viewM = r.getMonth()), this._mode = "days";
|
|
779
779
|
let a = r.getFullYear() === this._viewY && r.getMonth() === this._viewM, o = i && i.y === this._viewY && i.m === this._viewM;
|
|
780
780
|
this._focus = o ? i : {
|
|
@@ -789,7 +789,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
789
789
|
let t = e.target.closest("[data-nav]");
|
|
790
790
|
if (t) {
|
|
791
791
|
this._viewNavigated = !0, this._slide = Number(t.dataset.nav) < 0 ? "slide-prev" : "slide-next";
|
|
792
|
-
let e =
|
|
792
|
+
let e = O(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
793
793
|
this._viewY = e.y, this._viewM = e.m, this._focus = {
|
|
794
794
|
y: e.y,
|
|
795
795
|
m: e.m,
|
|
@@ -828,7 +828,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
828
828
|
}
|
|
829
829
|
if (e.target.closest("[data-today]")) {
|
|
830
830
|
let e = /* @__PURE__ */ new Date();
|
|
831
|
-
this.value =
|
|
831
|
+
this.value = w(e.getFullYear(), e.getMonth(), e.getDate()), this.dispatchEvent(new Event("change", { bubbles: !0 })), this._close();
|
|
832
832
|
return;
|
|
833
833
|
}
|
|
834
834
|
if (e.target.closest("[data-clear]")) {
|
|
@@ -845,18 +845,18 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
845
845
|
this._popClick = !1, r() && !t && !this.contains(e.target) && this._close();
|
|
846
846
|
}, document.addEventListener("click", this._onDocClick), this._onDocKey = (e) => {
|
|
847
847
|
r() && e.key === "Escape" && this._close();
|
|
848
|
-
}, document.addEventListener("keydown", this._onDocKey),
|
|
848
|
+
}, document.addEventListener("keydown", this._onDocKey), s(this, () => {
|
|
849
849
|
r() && this._position(e, t);
|
|
850
850
|
});
|
|
851
851
|
}, this._bindGlobal(), this._syncFormValue();
|
|
852
852
|
}
|
|
853
853
|
_teardown() {
|
|
854
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null),
|
|
854
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null), c(this);
|
|
855
855
|
}
|
|
856
856
|
disconnectedCallback() {
|
|
857
857
|
this._teardown();
|
|
858
858
|
}
|
|
859
|
-
},
|
|
859
|
+
}, te = class extends HTMLElement {
|
|
860
860
|
static formAssociated = !0;
|
|
861
861
|
static get observedAttributes() {
|
|
862
862
|
return [
|
|
@@ -915,20 +915,20 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
915
915
|
text: e,
|
|
916
916
|
empty: !0
|
|
917
917
|
} : {
|
|
918
|
-
text: `${
|
|
918
|
+
text: `${E(this._start) || "Start"} – ${E(this._end) || "End"}`,
|
|
919
919
|
empty: !1
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
922
|
render() {
|
|
923
923
|
this._defaultStart === void 0 && (this._defaultStart = this.getAttribute("start") || "", this._defaultEnd = this.getAttribute("end") || "", this._start = this._defaultStart || this._start, this._end = this._defaultEnd || this._end);
|
|
924
|
-
let e =
|
|
924
|
+
let e = T(this._start);
|
|
925
925
|
e && (this._viewY = e.y, this._viewM = e.m);
|
|
926
926
|
let t = this.getAttribute("size"), n = t === "sm" ? " input-sm" : t === "lg" ? " input-lg" : "", { text: r, empty: i } = this._label(), a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
|
|
927
927
|
this.innerHTML = `
|
|
928
928
|
<div class="daterange">
|
|
929
|
-
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${
|
|
930
|
-
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${
|
|
931
|
-
${
|
|
929
|
+
<button type="button" class="input daterange-trigger${n}${i ? "" : " has-value"}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${h(a)}"` : ""}${o ? ` aria-describedby="${h(o)}"` : ""}>
|
|
930
|
+
<span data-range-label class="${i ? "search-select-placeholder" : ""}">${h(r)}</span>
|
|
931
|
+
${f("calendar")}
|
|
932
932
|
</button>
|
|
933
933
|
<div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
|
|
934
934
|
</div>`, this._rendered = !0, this._syncMirrors(), this._wire();
|
|
@@ -955,24 +955,24 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
955
955
|
r || (r = document.createElement("input"), r.type = "hidden", r.setAttribute("data-range-mirror", e), this.appendChild(r)), r.name = t, r.value = n || "", r.disabled = this.hasAttribute("disabled");
|
|
956
956
|
}
|
|
957
957
|
_limits() {
|
|
958
|
-
let e =
|
|
958
|
+
let e = T(this.getAttribute("min")), t = T(this.getAttribute("max")), n = e ? new Date(e.y, e.m, e.d).getTime() : -Infinity, r = t ? new Date(t.y, t.m, t.d).getTime() : Infinity;
|
|
959
959
|
return (e, t, i) => {
|
|
960
960
|
let a = new Date(e, t, i).getTime();
|
|
961
961
|
return a < n || a > r;
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
_monthHtml(e, t) {
|
|
965
|
-
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i =
|
|
966
|
-
let i =
|
|
965
|
+
let n = this._firstDay(), r = (new Date(e, t, 1).getDay() - n + 7) % 7, i = D(e, t), a = this._limits(), o = S.map((e, t) => S[(t + n) % 7]).map((e) => `<span>${e}</span>`).join(""), s = (e, t, n, r) => {
|
|
966
|
+
let i = w(e, t, n), o = a(e, t, n);
|
|
967
967
|
return `<button type="button" class="${["datepicker-day", r ? "is-outside" : ""].filter(Boolean).join(" ")}" data-iso="${i}"${o ? " disabled" : ""}>${n}</button>`;
|
|
968
|
-
}, c = "", l =
|
|
968
|
+
}, c = "", l = O(e, t - 1), u = D(l.y, l.m);
|
|
969
969
|
for (let e = r - 1; e >= 0; e--) c += s(l.y, l.m, u - e, !0);
|
|
970
970
|
for (let n = 1; n <= i; n++) c += s(e, t, n, !1);
|
|
971
|
-
let d =
|
|
971
|
+
let d = O(e, t + 1), f = (7 - (r + i) % 7) % 7;
|
|
972
972
|
for (let e = 1; e <= f; e++) c += s(d.y, d.m, e, !0);
|
|
973
973
|
return `
|
|
974
974
|
<div class="daterange-cal">
|
|
975
|
-
<div class="datepicker-month-label">${
|
|
975
|
+
<div class="datepicker-month-label">${x[t]} ${e}</div>
|
|
976
976
|
<div class="datepicker-weekdays">${o}</div>
|
|
977
977
|
<div class="datepicker-grid" role="grid">${c}</div>
|
|
978
978
|
</div>`;
|
|
@@ -980,11 +980,11 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
980
980
|
_renderView() {
|
|
981
981
|
let e = this.querySelector(".daterange-pop");
|
|
982
982
|
if (!e) return;
|
|
983
|
-
let t =
|
|
983
|
+
let t = O(this._viewY, this._viewM + 1);
|
|
984
984
|
e.innerHTML = `
|
|
985
985
|
<div class="daterange-head">
|
|
986
|
-
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${
|
|
987
|
-
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${
|
|
986
|
+
<button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${f("chevron-left")}</button>
|
|
987
|
+
<button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${f("chevron-right")}</button>
|
|
988
988
|
</div>
|
|
989
989
|
<div class="daterange-cals">
|
|
990
990
|
${this._monthHtml(this._viewY, this._viewM)}
|
|
@@ -1006,10 +1006,10 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1006
1006
|
n.classList.toggle("is-range-start", i), n.classList.toggle("is-range-end", a), n.classList.toggle("in-range", o);
|
|
1007
1007
|
}
|
|
1008
1008
|
let i = e.querySelector("[data-range-hint]");
|
|
1009
|
-
i && (i.textContent = this._start ? this._end ? `${
|
|
1009
|
+
i && (i.textContent = this._start ? this._end ? `${E(this._start)} – ${E(this._end)}` : "Pick an end date" : "Pick a start date");
|
|
1010
1010
|
}
|
|
1011
1011
|
_position(e, t) {
|
|
1012
|
-
|
|
1012
|
+
o(e, t);
|
|
1013
1013
|
}
|
|
1014
1014
|
_pick(e) {
|
|
1015
1015
|
if (!this._start || this._start && this._end) {
|
|
@@ -1028,7 +1028,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1028
1028
|
if (!e || !t) return;
|
|
1029
1029
|
let r = () => !t.hidden;
|
|
1030
1030
|
this._open = () => {
|
|
1031
|
-
let r =
|
|
1031
|
+
let r = T(this._start);
|
|
1032
1032
|
if (r) this._viewY = r.y, this._viewM = r.m;
|
|
1033
1033
|
else {
|
|
1034
1034
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -1041,7 +1041,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1041
1041
|
this._popClick = !0;
|
|
1042
1042
|
let t = e.target.closest("[data-nav]");
|
|
1043
1043
|
if (t) {
|
|
1044
|
-
let e =
|
|
1044
|
+
let e = O(this._viewY, this._viewM + Number(t.dataset.nav));
|
|
1045
1045
|
this._viewY = e.y, this._viewM = e.m, this._renderView();
|
|
1046
1046
|
return;
|
|
1047
1047
|
}
|
|
@@ -1060,18 +1060,18 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1060
1060
|
this._popClick = !1, r() && !t && !this.contains(e.target) && this._close();
|
|
1061
1061
|
}, document.addEventListener("click", this._onDocClick), this._onDocKey = (e) => {
|
|
1062
1062
|
r() && e.key === "Escape" && this._close();
|
|
1063
|
-
}, document.addEventListener("keydown", this._onDocKey),
|
|
1063
|
+
}, document.addEventListener("keydown", this._onDocKey), s(this, () => {
|
|
1064
1064
|
r() && this._position(e, t);
|
|
1065
1065
|
});
|
|
1066
1066
|
}, this._bindGlobal(), this._syncMirrors();
|
|
1067
1067
|
}
|
|
1068
1068
|
_teardown() {
|
|
1069
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null),
|
|
1069
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null), c(this);
|
|
1070
1070
|
}
|
|
1071
1071
|
disconnectedCallback() {
|
|
1072
1072
|
this._teardown();
|
|
1073
1073
|
}
|
|
1074
|
-
},
|
|
1074
|
+
}, ne = class extends HTMLElement {
|
|
1075
1075
|
static get observedAttributes() {
|
|
1076
1076
|
return [
|
|
1077
1077
|
"static",
|
|
@@ -1092,10 +1092,10 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1092
1092
|
e === "static" && this.isConnected && this._wire();
|
|
1093
1093
|
}
|
|
1094
1094
|
_maxScale() {
|
|
1095
|
-
return
|
|
1095
|
+
return re(this.getAttribute("max-scale"), 1.6);
|
|
1096
1096
|
}
|
|
1097
1097
|
_radius() {
|
|
1098
|
-
return
|
|
1098
|
+
return re(this.getAttribute("radius"), 100);
|
|
1099
1099
|
}
|
|
1100
1100
|
_magnifyEnabled() {
|
|
1101
1101
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -1120,10 +1120,10 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1120
1120
|
_teardown() {
|
|
1121
1121
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
1122
1122
|
}
|
|
1123
|
-
},
|
|
1123
|
+
}, re = (e, t) => {
|
|
1124
1124
|
let n = Number.parseFloat(e);
|
|
1125
1125
|
return Number.isFinite(n) ? n : t;
|
|
1126
|
-
},
|
|
1126
|
+
}, ie = class extends HTMLElement {
|
|
1127
1127
|
static formAssociated = !0;
|
|
1128
1128
|
_accessibleName() {
|
|
1129
1129
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1182,7 +1182,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1182
1182
|
return this._values.slice();
|
|
1183
1183
|
}
|
|
1184
1184
|
set values(e) {
|
|
1185
|
-
if (this._values = Array.isArray(e) ? e.map(String) : [],
|
|
1185
|
+
if (this._values = Array.isArray(e) ? e.map(String) : [], u(this, this._values.join(",")), this._rendered) {
|
|
1186
1186
|
this._renderControl();
|
|
1187
1187
|
let e = this.querySelector(".search-select-input");
|
|
1188
1188
|
this._renderOptions(e ? e.value : "");
|
|
@@ -1201,7 +1201,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1201
1201
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
1202
1202
|
label: e.innerHTML,
|
|
1203
1203
|
icon: e.getAttribute("icon") || void 0,
|
|
1204
|
-
[
|
|
1204
|
+
[m]: !0,
|
|
1205
1205
|
selected: e.hasAttribute("selected")
|
|
1206
1206
|
})));
|
|
1207
1207
|
}
|
|
@@ -1214,36 +1214,36 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1214
1214
|
}
|
|
1215
1215
|
_labelHtmlFor(e) {
|
|
1216
1216
|
let t = this._readOptions().find((t) => String(t.value) === String(e));
|
|
1217
|
-
return t ?
|
|
1217
|
+
return t ? _(t) : h(e);
|
|
1218
1218
|
}
|
|
1219
1219
|
render() {
|
|
1220
1220
|
this._snapshotDeclared();
|
|
1221
1221
|
let e = this.hasAttribute("searchable"), t = this.getAttribute("search-placeholder") || "Search…", n = this.getAttribute("icon"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "";
|
|
1222
|
-
|
|
1222
|
+
u(this, this._values.join(",")), this.id ||= `wui-multiselect-${Math.random().toString(36).slice(2, 9)}`;
|
|
1223
1223
|
let a = `${this.id}-listbox`;
|
|
1224
1224
|
this._listboxId = a, this.innerHTML = `
|
|
1225
1225
|
<div class="search-select${i}">
|
|
1226
|
-
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
1227
|
-
${n ?
|
|
1226
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${k(a)}" aria-label="${k(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
|
|
1227
|
+
${n ? f(n, { className: "search-select-icon" }) : ""}
|
|
1228
1228
|
<div class="ms-chips" data-chips></div>
|
|
1229
|
-
${
|
|
1229
|
+
${f("chevron-down", { className: "search-select-caret" })}
|
|
1230
1230
|
</div>
|
|
1231
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1232
|
-
${e ? `<div class="search-select-search">${
|
|
1231
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${k(a)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1232
|
+
${e ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${k(t)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${f("x")}</button></div>` : ""}
|
|
1233
1233
|
<div class="search-select-options"></div>
|
|
1234
1234
|
<div class="search-select-empty" hidden>No matches</div>
|
|
1235
1235
|
</div>
|
|
1236
|
-
</div>`, this._rendered = !0,
|
|
1236
|
+
</div>`, this._rendered = !0, u(this, this._values.join(",")), this._renderControl(), this._renderOptions(), this._wire();
|
|
1237
1237
|
}
|
|
1238
1238
|
_renderControl() {
|
|
1239
1239
|
let e = this.querySelector("[data-chips]");
|
|
1240
1240
|
if (!e) return;
|
|
1241
1241
|
let t = this.getAttribute("placeholder") || "Select…";
|
|
1242
1242
|
if (!this._values.length) {
|
|
1243
|
-
e.innerHTML = `<span class="search-select-placeholder">${
|
|
1243
|
+
e.innerHTML = `<span class="search-select-placeholder">${h(t)}</span>`;
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${
|
|
1246
|
+
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${k(e)}" aria-label="Remove ${k(A(this._labelFor(e)))}">${f("x")}</button></span>`).join(""), this._collapseChips();
|
|
1247
1247
|
}
|
|
1248
1248
|
_collapseChips() {
|
|
1249
1249
|
let e = this.querySelector("[data-chips]");
|
|
@@ -1267,28 +1267,28 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1267
1267
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
1268
1268
|
if (!t) return;
|
|
1269
1269
|
let r = (e || "").trim().toLowerCase(), i = this._readOptions();
|
|
1270
|
-
r && (i = i.filter((e) =>
|
|
1270
|
+
r && (i = i.filter((e) => A(e.label).toLowerCase().includes(r)));
|
|
1271
1271
|
let a = this._listboxId || `${this.id || "wui-multiselect"}-listbox`;
|
|
1272
1272
|
t.innerHTML = i.map((e, t) => {
|
|
1273
1273
|
let n = this._values.includes(String(e.value));
|
|
1274
|
-
return `<button type="button" role="option" id="${
|
|
1275
|
-
}).join(""), n && (n.hidden = i.length > 0), this._active = -1, this.querySelector(".search-select-control")?.removeAttribute("aria-activedescendant");
|
|
1274
|
+
return `<button type="button" role="option" id="${k(`${a}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${k(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${_(e)}</span><span class="ms-check">${f("check")}</span></button>`;
|
|
1275
|
+
}).join(""), n && (n.hidden = i.length > 0), this._active = -1, this.querySelector(".search-select-control")?.removeAttribute("aria-activedescendant"), this._reanchor?.();
|
|
1276
1276
|
}
|
|
1277
1277
|
_wire() {
|
|
1278
1278
|
this._teardown();
|
|
1279
|
-
let e = this.querySelector(".search-select-control"), t = this.querySelector(".search-select-menu"), n = this.querySelector(".search-select-input"), r = this.querySelector(".search-select-clear"),
|
|
1279
|
+
let e = this.querySelector(".search-select-control"), t = this.querySelector(".search-select-menu"), n = this.querySelector(".search-select-input"), r = this.querySelector(".search-select-clear"), i = this.querySelector(".search-select-options");
|
|
1280
1280
|
if (!e || !t) return;
|
|
1281
|
-
let
|
|
1282
|
-
let n =
|
|
1281
|
+
let a = () => this.hasAttribute("disabled"), c = () => o(e, t, { matchWidth: !0 }), l = () => [...this.querySelectorAll(".search-select-option")], d = () => l().filter((e) => !e.hidden), f = (t) => {
|
|
1282
|
+
let n = d();
|
|
1283
1283
|
this._active = t;
|
|
1284
|
-
for (let e of
|
|
1284
|
+
for (let e of l()) e.classList.remove("is-active");
|
|
1285
1285
|
t >= 0 && n[t] ? (n[t].classList.add("is-active"), n[t].scrollIntoView({ block: "nearest" }), e.setAttribute("aria-activedescendant", n[t].id)) : e.removeAttribute("aria-activedescendant");
|
|
1286
1286
|
}, m = () => !t.hidden, h = () => {
|
|
1287
|
-
|
|
1287
|
+
a() || (t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), c(), n && (n.value = "", this._renderOptions(""), n.focus()));
|
|
1288
1288
|
}, g = () => {
|
|
1289
|
-
t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open"),
|
|
1289
|
+
t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open"), f(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
|
|
1290
1290
|
}, _ = () => {
|
|
1291
|
-
|
|
1291
|
+
u(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1292
1292
|
}, v = (e) => {
|
|
1293
1293
|
let t = String(e);
|
|
1294
1294
|
this._values.includes(t) ? this._values = this._values.filter((e) => e !== t) : this._values = [...this._values, t], this._renderControl(), this._renderOptions(n ? n.value : ""), _();
|
|
@@ -1296,25 +1296,25 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1296
1296
|
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(n ? n.value : ""), _();
|
|
1297
1297
|
};
|
|
1298
1298
|
e.addEventListener("click", (e) => {
|
|
1299
|
-
if (
|
|
1299
|
+
if (a()) return;
|
|
1300
1300
|
let t = e.target.closest("[data-remove]");
|
|
1301
1301
|
if (t) {
|
|
1302
1302
|
e.stopPropagation(), y(t.dataset.remove);
|
|
1303
1303
|
return;
|
|
1304
1304
|
}
|
|
1305
1305
|
m() ? g() : h();
|
|
1306
|
-
}),
|
|
1306
|
+
}), i.addEventListener("click", (e) => {
|
|
1307
1307
|
let t = e.target.closest(".search-select-option");
|
|
1308
1308
|
t && (v(t.dataset.value), n?.focus());
|
|
1309
|
-
}),
|
|
1309
|
+
}), i.addEventListener("mousemove", (e) => {
|
|
1310
1310
|
let t = e.target.closest(".search-select-option");
|
|
1311
|
-
t &&
|
|
1312
|
-
}),
|
|
1313
|
-
this._renderOptions(n.value), r && (r.hidden = !n.value),
|
|
1314
|
-
}), this._navHandler =
|
|
1315
|
-
getVisibleOptions:
|
|
1311
|
+
t && f(d().indexOf(t));
|
|
1312
|
+
}), i.addEventListener("mouseleave", () => f(-1)), n?.addEventListener("input", () => {
|
|
1313
|
+
this._renderOptions(n.value), r && (r.hidden = !n.value), f(-1);
|
|
1314
|
+
}), this._navHandler = p({
|
|
1315
|
+
getVisibleOptions: d,
|
|
1316
1316
|
getActive: () => this._active,
|
|
1317
|
-
setActive: (e) =>
|
|
1317
|
+
setActive: (e) => f(e),
|
|
1318
1318
|
onEnter: (e) => {
|
|
1319
1319
|
e && v(e.dataset.value);
|
|
1320
1320
|
},
|
|
@@ -1340,18 +1340,18 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1340
1340
|
}), this._bindGlobal = () => {
|
|
1341
1341
|
this._teardown(), !this._ro && typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(() => this._collapseChips()), this._ro.observe(this)), this._onDocClick = (e) => {
|
|
1342
1342
|
m() && !this.contains(e.target) && g();
|
|
1343
|
-
}, document.addEventListener("click", this._onDocClick),
|
|
1344
|
-
m() &&
|
|
1343
|
+
}, document.addEventListener("click", this._onDocClick), s(this, () => {
|
|
1344
|
+
m() && c();
|
|
1345
1345
|
});
|
|
1346
1346
|
}, this._bindGlobal();
|
|
1347
1347
|
}
|
|
1348
1348
|
_teardown() {
|
|
1349
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null),
|
|
1349
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), c(this), this._navHandler?.teardown();
|
|
1350
1350
|
}
|
|
1351
1351
|
disconnectedCallback() {
|
|
1352
1352
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
1353
1353
|
}
|
|
1354
|
-
},
|
|
1354
|
+
}, k = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), A = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), ae = /[^0-9]/g, oe = /[^0-9a-zA-Z]/g, j = class extends HTMLElement {
|
|
1355
1355
|
static formAssociated = !0;
|
|
1356
1356
|
static get observedAttributes() {
|
|
1357
1357
|
return [
|
|
@@ -1379,10 +1379,10 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1379
1379
|
return this._value ?? "";
|
|
1380
1380
|
}
|
|
1381
1381
|
set value(e) {
|
|
1382
|
-
this._value = this._clean(e),
|
|
1382
|
+
this._value = this._clean(e), u(this, this._value), this._paint();
|
|
1383
1383
|
}
|
|
1384
1384
|
_clean(e) {
|
|
1385
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
1385
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? oe : ae, "").slice(0, this.length);
|
|
1386
1386
|
}
|
|
1387
1387
|
constructor() {
|
|
1388
1388
|
super();
|
|
@@ -1396,10 +1396,10 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1396
1396
|
this._rendered ? this._onSelectionChange && document.addEventListener("selectionchange", this._onSelectionChange) : (this._defaultCaptured ||= (this._defaultValue = this._value, !0), this.render());
|
|
1397
1397
|
}
|
|
1398
1398
|
formResetCallback() {
|
|
1399
|
-
this._value = this._defaultValue || "",
|
|
1399
|
+
this._value = this._defaultValue || "", u(this, this._value), this._paint();
|
|
1400
1400
|
}
|
|
1401
1401
|
attributeChangedCallback(e, t, n) {
|
|
1402
|
-
this._rendered && (e === "value" ? (this._value = this._clean(n),
|
|
1402
|
+
this._rendered && (e === "value" ? (this._value = this._clean(n), u(this, this._value), this._paint()) : this.render());
|
|
1403
1403
|
}
|
|
1404
1404
|
render() {
|
|
1405
1405
|
this._value = this._clean(this.getAttribute("value") ?? this._value);
|
|
@@ -1417,7 +1417,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1417
1417
|
spellcheck="false"
|
|
1418
1418
|
${n ? "disabled" : ""} />
|
|
1419
1419
|
<div class="otp-slots" aria-hidden="true">${r}</div>
|
|
1420
|
-
</div>`, this._rendered = !0,
|
|
1420
|
+
</div>`, this._rendered = !0, u(this, this._value), this._wire(), this._paint();
|
|
1421
1421
|
}
|
|
1422
1422
|
_refs() {
|
|
1423
1423
|
return {
|
|
@@ -1439,7 +1439,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1439
1439
|
if (!e) return;
|
|
1440
1440
|
let t = (e) => {
|
|
1441
1441
|
let t = this._clean(e), n = t !== this._value;
|
|
1442
|
-
this._value = t,
|
|
1442
|
+
this._value = t, u(this, this._value), this._paint(), n && this.dispatchEvent(new Event("change", { bubbles: !0 })), n && t.length === this.length && this.dispatchEvent(new CustomEvent("complete", {
|
|
1443
1443
|
bubbles: !0,
|
|
1444
1444
|
detail: t
|
|
1445
1445
|
}));
|
|
@@ -1473,7 +1473,7 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1473
1473
|
disconnectedCallback() {
|
|
1474
1474
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
1475
1475
|
}
|
|
1476
|
-
},
|
|
1476
|
+
}, se = [
|
|
1477
1477
|
[
|
|
1478
1478
|
"AF",
|
|
1479
1479
|
"Afghanistan",
|
|
@@ -2699,18 +2699,18 @@ var f = Symbol("wui.trustedHtml"), p = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2699
2699
|
"Zimbabwe",
|
|
2700
2700
|
"263"
|
|
2701
2701
|
]
|
|
2702
|
-
], M = (e) => (
|
|
2702
|
+
], M = (e) => (se.find((t) => t[0] === e) || [
|
|
2703
2703
|
"",
|
|
2704
2704
|
"",
|
|
2705
2705
|
""
|
|
2706
|
-
])[2], N = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, P = null,
|
|
2707
|
-
function
|
|
2708
|
-
return P ? Promise.resolve(P) : (
|
|
2706
|
+
])[2], N = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, P = null, ce = null;
|
|
2707
|
+
function le() {
|
|
2708
|
+
return P ? Promise.resolve(P) : (ce ||= Promise.all([import("./libphonenumber-js-BcNT8oq0.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (P = {
|
|
2709
2709
|
AsYouType: e.AsYouType,
|
|
2710
2710
|
getExampleNumber: e.getExampleNumber,
|
|
2711
2711
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
2712
2712
|
examples: t.default || t
|
|
2713
|
-
}, P)).catch(() => null),
|
|
2713
|
+
}, P)).catch(() => null), ce);
|
|
2714
2714
|
}
|
|
2715
2715
|
function F(e, t) {
|
|
2716
2716
|
if (!P || !t) return t;
|
|
@@ -2736,7 +2736,7 @@ function L(e) {
|
|
|
2736
2736
|
return null;
|
|
2737
2737
|
}
|
|
2738
2738
|
}
|
|
2739
|
-
function
|
|
2739
|
+
function ue(e) {
|
|
2740
2740
|
if (!P) return null;
|
|
2741
2741
|
try {
|
|
2742
2742
|
let t = P.getExampleNumber(e, P.examples);
|
|
@@ -2793,7 +2793,14 @@ var z = class extends HTMLElement {
|
|
|
2793
2793
|
this.value = n;
|
|
2794
2794
|
return;
|
|
2795
2795
|
}
|
|
2796
|
-
|
|
2796
|
+
if (this._rendered) {
|
|
2797
|
+
if (e === "aria-label" || e === "aria-describedby") {
|
|
2798
|
+
let t = this.querySelector("input[type=tel]");
|
|
2799
|
+
t && (n == null ? t.removeAttribute(e) : t.setAttribute(e, n));
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
e === "country" && (this._country = n || "IN", this._suppressCountryRender) || this.render();
|
|
2803
|
+
}
|
|
2797
2804
|
}
|
|
2798
2805
|
formResetCallback() {
|
|
2799
2806
|
this.value = this._defaultValue || "";
|
|
@@ -2811,7 +2818,7 @@ var z = class extends HTMLElement {
|
|
|
2811
2818
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
2812
2819
|
}
|
|
2813
2820
|
_syncMirror() {
|
|
2814
|
-
|
|
2821
|
+
u(this, this.value);
|
|
2815
2822
|
}
|
|
2816
2823
|
_emitInput() {
|
|
2817
2824
|
this.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
@@ -2825,23 +2832,23 @@ var z = class extends HTMLElement {
|
|
|
2825
2832
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
2826
2833
|
let t = `${this.id}-listbox`;
|
|
2827
2834
|
this._listboxId = t;
|
|
2828
|
-
let n =
|
|
2835
|
+
let n = se.map(([e, n, r], i) => `<button type="button" role="option" id="${B(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${N(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
2829
2836
|
this.innerHTML = `
|
|
2830
2837
|
<div class="phone-input-wrap">
|
|
2831
2838
|
<div class="phone-country-adornment">
|
|
2832
2839
|
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${B(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
2833
2840
|
<span class="${N(this._country)}" data-flag aria-hidden="true"></span>
|
|
2834
|
-
${
|
|
2841
|
+
${f("chevron-down", { className: "phone-chevron" })}
|
|
2835
2842
|
<span class="phone-dial" data-dial>+${M(this._country)}</span>
|
|
2836
2843
|
</button>
|
|
2837
2844
|
<div class="country-dropdown-menu" role="listbox" id="${B(t)}" tabindex="-1" hidden>
|
|
2838
|
-
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${
|
|
2845
|
+
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${f("search")}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${B(t)}" aria-autocomplete="list" /></div>
|
|
2839
2846
|
<div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
|
|
2840
2847
|
</div>
|
|
2841
2848
|
</div>
|
|
2842
2849
|
<input type="tel" class="input" placeholder="${B(e)}" value="${B(F(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${B(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${B(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
2843
2850
|
</div>
|
|
2844
|
-
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0,
|
|
2851
|
+
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, u(this, this.value), this._wire();
|
|
2845
2852
|
}
|
|
2846
2853
|
_itemEls() {
|
|
2847
2854
|
return [...this.querySelectorAll(".country-dropdown-item")];
|
|
@@ -2851,9 +2858,9 @@ var z = class extends HTMLElement {
|
|
|
2851
2858
|
}
|
|
2852
2859
|
_wire() {
|
|
2853
2860
|
this._teardown();
|
|
2854
|
-
let e = this.querySelector(".country-toggle"), t = this.querySelector(".phone-input-wrap"), n = this.querySelector(".country-dropdown-menu"), r = this.querySelector(".dropdown-search-input"),
|
|
2861
|
+
let e = this.querySelector(".country-toggle"), t = this.querySelector(".phone-input-wrap"), n = this.querySelector(".country-dropdown-menu"), r = this.querySelector(".dropdown-search-input"), i = this.querySelector(".country-list-scroll"), a = this.querySelector(".country-empty"), l = this.querySelector("input[type=tel]"), u = this.querySelector("[data-flag]"), d = this.querySelector("[data-dial]");
|
|
2855
2862
|
if (!e || !n) return;
|
|
2856
|
-
let f = () => !n.hidden, p = () =>
|
|
2863
|
+
let f = () => !n.hidden, p = () => o(t || e, n), m = (e) => {
|
|
2857
2864
|
let t = this._visibleItems();
|
|
2858
2865
|
this._active = e;
|
|
2859
2866
|
for (let e of this._itemEls()) e.classList.remove("is-active");
|
|
@@ -2868,7 +2875,7 @@ var z = class extends HTMLElement {
|
|
|
2868
2875
|
let r = !t || e.textContent.toLowerCase().includes(t);
|
|
2869
2876
|
e.hidden = !r, r && (n += 1);
|
|
2870
2877
|
}
|
|
2871
|
-
|
|
2878
|
+
a && (a.hidden = n > 0);
|
|
2872
2879
|
}, v = (e) => {
|
|
2873
2880
|
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = N(e)), d && (d.textContent = `+${M(e)}`);
|
|
2874
2881
|
for (let t of this._itemEls()) {
|
|
@@ -2899,13 +2906,13 @@ var z = class extends HTMLElement {
|
|
|
2899
2906
|
_(r.value);
|
|
2900
2907
|
let e = this._visibleItems();
|
|
2901
2908
|
m(e.length ? 0 : -1);
|
|
2902
|
-
}),
|
|
2909
|
+
}), i.addEventListener("click", (e) => {
|
|
2903
2910
|
let t = e.target.closest(".country-dropdown-item");
|
|
2904
2911
|
t && v(t.dataset.iso);
|
|
2905
|
-
}),
|
|
2912
|
+
}), i.addEventListener("mousemove", (e) => {
|
|
2906
2913
|
let t = e.target.closest(".country-dropdown-item");
|
|
2907
2914
|
t && m(this._visibleItems().indexOf(t));
|
|
2908
|
-
}),
|
|
2915
|
+
}), i.addEventListener("mouseleave", () => m(-1)), n.addEventListener("keydown", y);
|
|
2909
2916
|
let b = this.querySelector("[data-phone-error]"), x = (e) => {
|
|
2910
2917
|
if (l.classList.toggle("is-invalid", e), e ? l.setAttribute("aria-invalid", "true") : l.removeAttribute("aria-invalid"), b) {
|
|
2911
2918
|
if (e) {
|
|
@@ -2917,7 +2924,7 @@ var z = class extends HTMLElement {
|
|
|
2917
2924
|
};
|
|
2918
2925
|
l.addEventListener("input", (e) => {
|
|
2919
2926
|
e.stopPropagation();
|
|
2920
|
-
let t = l.value.replace(/[^0-9]/g, ""), n =
|
|
2927
|
+
let t = l.value.replace(/[^0-9]/g, ""), n = ue(this._country);
|
|
2921
2928
|
n && t.length > n && (t = t.slice(0, n)), this._national = t;
|
|
2922
2929
|
let r = F(this._country, this._national);
|
|
2923
2930
|
l.value !== r && (l.value = r), this._syncMirror(), this._emitInput(), l.classList.contains("is-invalid") && (!this._national || L(this.value) === !0) && x(!1);
|
|
@@ -2929,12 +2936,12 @@ var z = class extends HTMLElement {
|
|
|
2929
2936
|
}), this._bindGlobal = () => {
|
|
2930
2937
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
2931
2938
|
f() && !this.contains(e.target) && g();
|
|
2932
|
-
}, document.addEventListener("click", this._onDocClick),
|
|
2939
|
+
}, document.addEventListener("click", this._onDocClick), s(this, () => {
|
|
2933
2940
|
f() && p();
|
|
2934
2941
|
});
|
|
2935
2942
|
}, this._teardownGlobals = () => {
|
|
2936
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null),
|
|
2937
|
-
}, this._bindGlobal(),
|
|
2943
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), c(this);
|
|
2944
|
+
}, this._bindGlobal(), le().then((e) => {
|
|
2938
2945
|
if (!(!e || !l.isConnected) && (this._national && (l.value = F(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
2939
2946
|
let e = I(this._country);
|
|
2940
2947
|
e && (l.placeholder = e);
|
|
@@ -3006,7 +3013,7 @@ var z = class extends HTMLElement {
|
|
|
3006
3013
|
return this._value;
|
|
3007
3014
|
}
|
|
3008
3015
|
set value(e) {
|
|
3009
|
-
this._value = e == null ? "" : String(e),
|
|
3016
|
+
this._value = e == null ? "" : String(e), u(this, this._value), this._syncSelected(), this._syncReset();
|
|
3010
3017
|
}
|
|
3011
3018
|
set options(e) {
|
|
3012
3019
|
this._optionsProp = Array.isArray(e) ? e : null, this.isConnected && this.render();
|
|
@@ -3021,7 +3028,7 @@ var z = class extends HTMLElement {
|
|
|
3021
3028
|
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
3022
3029
|
label: e.innerHTML,
|
|
3023
3030
|
icon: e.getAttribute("icon") || void 0,
|
|
3024
|
-
[
|
|
3031
|
+
[m]: !0,
|
|
3025
3032
|
selected: e.hasAttribute("selected")
|
|
3026
3033
|
})));
|
|
3027
3034
|
}
|
|
@@ -3030,28 +3037,28 @@ var z = class extends HTMLElement {
|
|
|
3030
3037
|
}
|
|
3031
3038
|
render() {
|
|
3032
3039
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._snapshotDeclared();
|
|
3033
|
-
let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...",
|
|
3034
|
-
|
|
3035
|
-
let
|
|
3036
|
-
this._listboxId =
|
|
3037
|
-
let
|
|
3040
|
+
let e = this._readOptions(), t = this.hasAttribute("searchable"), n = this.hasAttribute("clearable"), r = this.getAttribute("size"), i = r === "sm" ? " search-select-sm" : r === "lg" ? " search-select-lg" : "", a = this.getAttribute("icon"), o = this.getAttribute("prefix"), s = this.getAttribute("placeholder") || "Select...", c = this.getAttribute("search-placeholder") || "Search...", l = e.find((e) => String(e.value) === String(this._value)) || e.find((e) => e.selected);
|
|
3041
|
+
l && (this._value = String(l.value)), u(this, this._value), this.id ||= `wui-select-${Math.random().toString(36).slice(2, 9)}`;
|
|
3042
|
+
let d = `${this.id}-listbox`;
|
|
3043
|
+
this._listboxId = d;
|
|
3044
|
+
let p = e.map((e, t) => {
|
|
3038
3045
|
let n = String(e.value) === String(this._value);
|
|
3039
|
-
return `<button type="button" role="option" id="${H(`${
|
|
3046
|
+
return `<button type="button" role="option" id="${H(`${d}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${H(e.value)}" aria-selected="${n}">${_(e)}</button>`;
|
|
3040
3047
|
}).join("");
|
|
3041
3048
|
this.innerHTML = `
|
|
3042
3049
|
<div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
|
|
3043
|
-
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${H(
|
|
3044
|
-
${a ?
|
|
3045
|
-
${o ? `<span class="search-select-prefix">${
|
|
3046
|
-
<span class="${
|
|
3047
|
-
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${
|
|
3048
|
-
${
|
|
3050
|
+
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${H(d)}" aria-label="${H(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
3051
|
+
${a ? f(a, { className: "search-select-icon" }) : ""}
|
|
3052
|
+
${o ? `<span class="search-select-prefix">${h(o)}</span>` : ""}
|
|
3053
|
+
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? _(l) : h(s)}</span>
|
|
3054
|
+
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${f("x")}</span>` : ""}
|
|
3055
|
+
${f("chevron-down", { className: "search-select-caret" })}
|
|
3049
3056
|
</button>
|
|
3050
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${H(
|
|
3051
|
-
${t ? `<div class="search-select-search">${
|
|
3052
|
-
<div class="search-select-options">${
|
|
3057
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${H(d)}" tabindex="-1" hidden>
|
|
3058
|
+
${t ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${H(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${f("x")}</button></div>` : ""}
|
|
3059
|
+
<div class="search-select-options">${p}<div class="search-select-empty" hidden>No matches</div></div>
|
|
3053
3060
|
</div>
|
|
3054
|
-
</div>`, this._rendered = !0,
|
|
3061
|
+
</div>`, this._rendered = !0, u(this, this._value), this._wire(), this._syncReset();
|
|
3055
3062
|
}
|
|
3056
3063
|
_refs() {
|
|
3057
3064
|
return {
|
|
@@ -3077,7 +3084,7 @@ var z = class extends HTMLElement {
|
|
|
3077
3084
|
let t = e.dataset.value === String(this._value);
|
|
3078
3085
|
e.classList.toggle("selected", t), e.setAttribute("aria-selected", String(t));
|
|
3079
3086
|
}
|
|
3080
|
-
e && (e.innerHTML = t ?
|
|
3087
|
+
e && (e.innerHTML = t ? _(t) : h(this.getAttribute("placeholder") || "Select..."), e.classList.toggle("search-select-placeholder", !t));
|
|
3081
3088
|
}
|
|
3082
3089
|
_syncReset() {
|
|
3083
3090
|
let { reset: e } = this._refs();
|
|
@@ -3090,28 +3097,28 @@ var z = class extends HTMLElement {
|
|
|
3090
3097
|
let t = () => {
|
|
3091
3098
|
if (this.hasAttribute("compact")) {
|
|
3092
3099
|
let t = e.control.getBoundingClientRect();
|
|
3093
|
-
e.menu.style.width = "max-content", e.menu.style.minWidth = `${t.width}px`, e.menu.style.maxWidth = "280px",
|
|
3094
|
-
} else
|
|
3100
|
+
e.menu.style.width = "max-content", e.menu.style.minWidth = `${t.width}px`, e.menu.style.maxWidth = "280px", o(e.control, e.menu);
|
|
3101
|
+
} else o(e.control, e.menu, { matchWidth: !0 });
|
|
3095
3102
|
}, n = (t) => {
|
|
3096
3103
|
let n = this._visible();
|
|
3097
3104
|
this._active = t;
|
|
3098
3105
|
for (let e of this._optionEls()) e.classList.remove("is-active");
|
|
3099
3106
|
t >= 0 && n[t] ? (n[t].classList.add("is-active"), n[t].scrollIntoView({ block: "nearest" }), e.control.setAttribute("aria-activedescendant", n[t].id)) : e.control.removeAttribute("aria-activedescendant");
|
|
3100
|
-
}, r = (
|
|
3101
|
-
let
|
|
3107
|
+
}, r = (n) => {
|
|
3108
|
+
let r = n.trim().toLowerCase(), i = 0;
|
|
3102
3109
|
for (let e of this._optionEls()) {
|
|
3103
|
-
let t = !
|
|
3104
|
-
e.hidden = !t, t && (
|
|
3110
|
+
let t = !r || e.textContent.toLowerCase().includes(r);
|
|
3111
|
+
e.hidden = !t, t && (i += 1);
|
|
3105
3112
|
}
|
|
3106
|
-
e.empty && (e.empty.hidden =
|
|
3107
|
-
},
|
|
3113
|
+
e.empty && (e.empty.hidden = i > 0), e.clear && (e.clear.hidden = !r), e.menu.hidden || t();
|
|
3114
|
+
}, i = () => !e.menu.hidden, a = () => {
|
|
3108
3115
|
e.menu.hidden = !1, e.control.setAttribute("aria-expanded", "true"), e.control.classList.add("open"), t(), e.search && (e.search.value = "", r(""), e.search.focus()), n(this._optionEls().findIndex((e) => e.classList.contains("selected")));
|
|
3109
3116
|
}, c = () => {
|
|
3110
3117
|
e.menu.hidden = !0, e.control.setAttribute("aria-expanded", "false"), e.control.classList.remove("open"), n(-1);
|
|
3111
3118
|
}, l = (t) => {
|
|
3112
3119
|
this.value = t.dataset.value, this.dispatchEvent(new Event("change", { bubbles: !0 })), c(), e.control.focus();
|
|
3113
3120
|
};
|
|
3114
|
-
this._navHandler =
|
|
3121
|
+
this._navHandler = p({
|
|
3115
3122
|
getVisibleOptions: () => this._visible(),
|
|
3116
3123
|
getActive: () => this._active,
|
|
3117
3124
|
setActive: (e) => n(e),
|
|
@@ -3123,12 +3130,12 @@ var z = class extends HTMLElement {
|
|
|
3123
3130
|
}
|
|
3124
3131
|
}), e.reset?.addEventListener("click", (t) => {
|
|
3125
3132
|
t.stopPropagation(), this.value = "", this.dispatchEvent(new Event("change", { bubbles: !0 })), e.control.focus();
|
|
3126
|
-
}), e.control.addEventListener("click", () =>
|
|
3127
|
-
if (
|
|
3133
|
+
}), e.control.addEventListener("click", () => i() ? c() : a()), e.control.addEventListener("keydown", (e) => {
|
|
3134
|
+
if (i()) {
|
|
3128
3135
|
this._navHandler.handler(e);
|
|
3129
3136
|
return;
|
|
3130
3137
|
}
|
|
3131
|
-
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
3138
|
+
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
3132
3139
|
}), e.optionsWrap.addEventListener("click", (e) => {
|
|
3133
3140
|
let t = e.target.closest(".search-select-option");
|
|
3134
3141
|
t && l(t);
|
|
@@ -3141,14 +3148,14 @@ var z = class extends HTMLElement {
|
|
|
3141
3148
|
e.search.value = "", r(""), e.search.focus();
|
|
3142
3149
|
}), e.menu.addEventListener("keydown", this._navHandler.handler), this._bindGlobal = () => {
|
|
3143
3150
|
this._teardown(), this._onDocClick = (e) => {
|
|
3144
|
-
|
|
3145
|
-
}, document.addEventListener("click", this._onDocClick),
|
|
3146
|
-
|
|
3151
|
+
i() && !this.contains(e.target) && c();
|
|
3152
|
+
}, document.addEventListener("click", this._onDocClick), s(this, () => {
|
|
3153
|
+
i() && t();
|
|
3147
3154
|
});
|
|
3148
3155
|
}, this._bindGlobal();
|
|
3149
3156
|
}
|
|
3150
3157
|
_teardown() {
|
|
3151
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null),
|
|
3158
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), c(this), this._navHandler?.teardown();
|
|
3152
3159
|
}
|
|
3153
3160
|
disconnectedCallback() {
|
|
3154
3161
|
this._teardown();
|
|
@@ -3295,7 +3302,7 @@ var z = class extends HTMLElement {
|
|
|
3295
3302
|
aria-valuenow="${this._value}"
|
|
3296
3303
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
3297
3304
|
${a ? "disabled" : ""}
|
|
3298
|
-
aria-label="${
|
|
3305
|
+
aria-label="${de(this.getAttribute("aria-label") || "Value")}"
|
|
3299
3306
|
></button>
|
|
3300
3307
|
`}
|
|
3301
3308
|
${this.hasAttribute("show-value") ? n ? `<span class="slider-value">${this._formatValue(this._start)} – ${this._formatValue(this._end)}</span>` : `<span class="slider-value">${this._formatValue(this._value)}</span>` : ""}
|
|
@@ -3328,7 +3335,7 @@ var z = class extends HTMLElement {
|
|
|
3328
3335
|
this._isRange() ? this._syncRangeMirrors() : this._syncSingleMirror();
|
|
3329
3336
|
}
|
|
3330
3337
|
_syncSingleMirror() {
|
|
3331
|
-
this.getAttribute("name") &&
|
|
3338
|
+
this.getAttribute("name") && u(this, String(this._value));
|
|
3332
3339
|
}
|
|
3333
3340
|
_syncRangeMirrors() {
|
|
3334
3341
|
let e = this.getAttribute("start-name") || this.getAttribute("name"), t = this.getAttribute("end-name");
|
|
@@ -3398,7 +3405,7 @@ var z = class extends HTMLElement {
|
|
|
3398
3405
|
}, W = (e, t) => {
|
|
3399
3406
|
let n = Number.parseFloat(e);
|
|
3400
3407
|
return Number.isFinite(n) ? n : t;
|
|
3401
|
-
},
|
|
3408
|
+
}, de = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), G = class extends HTMLElement {
|
|
3402
3409
|
static formAssociated = !0;
|
|
3403
3410
|
_accessibleName() {
|
|
3404
3411
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -3464,17 +3471,17 @@ var z = class extends HTMLElement {
|
|
|
3464
3471
|
return this._values.slice();
|
|
3465
3472
|
}
|
|
3466
3473
|
set values(e) {
|
|
3467
|
-
this._values = Array.isArray(e) ? e.map(String) : [],
|
|
3474
|
+
this._values = Array.isArray(e) ? e.map(String) : [], u(this, this._values.join(",")), this._rendered && this._renderControl();
|
|
3468
3475
|
}
|
|
3469
3476
|
render() {
|
|
3470
3477
|
let e = this.getAttribute("size"), t = e === "sm" ? " search-select-sm" : e === "lg" ? " search-select-lg" : "";
|
|
3471
|
-
|
|
3478
|
+
u(this, this._values.join(",")), this.innerHTML = `
|
|
3472
3479
|
<div class="search-select${t}">
|
|
3473
3480
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
3474
3481
|
<input type="text" class="ms-input" data-input aria-label="${K(this._accessibleName())}" placeholder="${K(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
|
|
3475
3482
|
<div class="ms-chips" data-chips></div>
|
|
3476
3483
|
</div>
|
|
3477
|
-
</div>`, this._rendered = !0,
|
|
3484
|
+
</div>`, this._rendered = !0, u(this, this._values.join(",")), this._renderControl(), this._wire();
|
|
3478
3485
|
}
|
|
3479
3486
|
_renderControl() {
|
|
3480
3487
|
let e = this.querySelector("[data-chips]");
|
|
@@ -3483,7 +3490,7 @@ var z = class extends HTMLElement {
|
|
|
3483
3490
|
e.innerHTML = "";
|
|
3484
3491
|
return;
|
|
3485
3492
|
}
|
|
3486
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
3493
|
+
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${fe(e)}</span><button type="button" class="chip-remove" data-remove="${K(e)}" aria-label="Remove ${K(e)}">${f("x")}</button></span>`).join("");
|
|
3487
3494
|
}
|
|
3488
3495
|
}
|
|
3489
3496
|
_wire() {
|
|
@@ -3493,33 +3500,33 @@ var z = class extends HTMLElement {
|
|
|
3493
3500
|
let n = () => this.hasAttribute("disabled"), r = (this.getAttribute("separators") || "enter,comma").split(",").map((e) => e.trim()), i = this.getAttribute("max-tags"), a = this.hasAttribute("allow-duplicates"), o = /* @__PURE__ */ new Set();
|
|
3494
3501
|
for (let e of r) e === "enter" ? o.add("Enter") : e === "comma" ? o.add(",") : e === "space" ? o.add(" ") : e === "tab" && o.add("Tab");
|
|
3495
3502
|
let s = () => {
|
|
3496
|
-
|
|
3497
|
-
},
|
|
3503
|
+
u(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
3504
|
+
}, c = (e) => {
|
|
3498
3505
|
let t = e.trim();
|
|
3499
3506
|
if (!t || i && this._values.length >= parseInt(i, 10)) return;
|
|
3500
3507
|
let n = a ? t : t.toLowerCase();
|
|
3501
3508
|
(!this._values.some((e) => a ? e === t : e.toLowerCase() === n) || a) && (this._values.push(t), this._renderControl(), s());
|
|
3502
|
-
},
|
|
3509
|
+
}, l = (e) => {
|
|
3503
3510
|
this._values = this._values.filter((t) => t !== e), this._renderControl(), s();
|
|
3504
3511
|
}, d = (e) => {
|
|
3505
3512
|
if (e.key === "Enter" && o.has("Enter")) {
|
|
3506
|
-
e.preventDefault(),
|
|
3513
|
+
e.preventDefault(), c(t.value), t.value = "";
|
|
3507
3514
|
return;
|
|
3508
3515
|
}
|
|
3509
3516
|
if (e.key === "," && o.has(",")) {
|
|
3510
|
-
e.preventDefault(),
|
|
3517
|
+
e.preventDefault(), c(t.value.replace(/,+$/, "")), t.value = "";
|
|
3511
3518
|
return;
|
|
3512
3519
|
}
|
|
3513
3520
|
if (e.key === " " && o.has(" ")) {
|
|
3514
3521
|
let n = t.value.trim();
|
|
3515
|
-
n && (e.preventDefault(),
|
|
3522
|
+
n && (e.preventDefault(), c(n), t.value = "");
|
|
3516
3523
|
return;
|
|
3517
3524
|
}
|
|
3518
3525
|
if (e.key === "Tab" && o.has("Tab")) {
|
|
3519
|
-
e.preventDefault(),
|
|
3526
|
+
e.preventDefault(), c(t.value), t.value = "";
|
|
3520
3527
|
return;
|
|
3521
3528
|
}
|
|
3522
|
-
e.key === "Backspace" && !t.value && this._values.length && (e.preventDefault(),
|
|
3529
|
+
e.key === "Backspace" && !t.value && this._values.length && (e.preventDefault(), l(this._values[this._values.length - 1])), e.key === "Escape" && (t.value = "");
|
|
3523
3530
|
}, f = (e) => {
|
|
3524
3531
|
e.preventDefault();
|
|
3525
3532
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
@@ -3531,14 +3538,14 @@ var z = class extends HTMLElement {
|
|
|
3531
3538
|
}
|
|
3532
3539
|
}
|
|
3533
3540
|
a.length || a.push(n.trim());
|
|
3534
|
-
for (let e of a) if (
|
|
3541
|
+
for (let e of a) if (c(e), i && this._values.length >= parseInt(i, 10)) break;
|
|
3535
3542
|
t.value = "";
|
|
3536
3543
|
};
|
|
3537
3544
|
this._onControlClick = (e) => {
|
|
3538
3545
|
if (n()) return;
|
|
3539
3546
|
let r = e.target.closest("[data-remove]");
|
|
3540
3547
|
if (r) {
|
|
3541
|
-
e.stopPropagation(),
|
|
3548
|
+
e.stopPropagation(), l(r.dataset.remove), t.focus();
|
|
3542
3549
|
return;
|
|
3543
3550
|
}
|
|
3544
3551
|
t.focus();
|
|
@@ -3554,7 +3561,7 @@ var z = class extends HTMLElement {
|
|
|
3554
3561
|
disconnectedCallback() {
|
|
3555
3562
|
this._teardown();
|
|
3556
3563
|
}
|
|
3557
|
-
},
|
|
3564
|
+
}, fe = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), K = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), q = (e) => String(e).padStart(2, "0"), pe = (e, t) => `${q(e)}:${q(t)}`, J = (e) => {
|
|
3558
3565
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
3559
3566
|
return t ? {
|
|
3560
3567
|
h: +t[1],
|
|
@@ -3562,10 +3569,10 @@ var z = class extends HTMLElement {
|
|
|
3562
3569
|
} : null;
|
|
3563
3570
|
}, Y = (e, t = "24") => {
|
|
3564
3571
|
if (!e) return "";
|
|
3565
|
-
if (t === "24") return
|
|
3572
|
+
if (t === "24") return pe(e.h, e.m);
|
|
3566
3573
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
3567
3574
|
return `${n}:${q(e.m)} ${r}`;
|
|
3568
|
-
},
|
|
3575
|
+
}, me = class extends HTMLElement {
|
|
3569
3576
|
static formAssociated = !0;
|
|
3570
3577
|
static get observedAttributes() {
|
|
3571
3578
|
return [
|
|
@@ -3608,22 +3615,22 @@ var z = class extends HTMLElement {
|
|
|
3608
3615
|
return this._value;
|
|
3609
3616
|
}
|
|
3610
3617
|
set value(e) {
|
|
3611
|
-
this._value = e || "",
|
|
3618
|
+
this._value = e || "", u(this, this._value), this._syncTrigger();
|
|
3612
3619
|
}
|
|
3613
3620
|
render() {
|
|
3614
3621
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
3615
3622
|
let e = this.getAttribute("placeholder") || "Select time", t = J(this._value), n = this.getAttribute("format") || "24", r = this.getAttribute("size"), i = r === "sm" ? " input-sm" : r === "lg" ? " input-lg" : "", a = this.getAttribute("aria-label"), o = this.getAttribute("aria-describedby");
|
|
3616
3623
|
this.innerHTML = `
|
|
3617
3624
|
<div class="timepicker">
|
|
3618
|
-
<button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${
|
|
3619
|
-
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? Y(t, n) :
|
|
3620
|
-
${
|
|
3625
|
+
<button type="button" class="input timepicker-trigger${i}${t ? " has-value" : ""}" aria-haspopup="listbox" aria-expanded="false"${this.hasAttribute("disabled") ? " disabled" : ""}${a ? ` aria-label="${h(a)}"` : ""}${o ? ` aria-describedby="${h(o)}"` : ""}>
|
|
3626
|
+
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? Y(t, n) : h(e)}</span>
|
|
3627
|
+
${f("clock")}
|
|
3621
3628
|
</button>
|
|
3622
3629
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
3623
|
-
</div>`, this._rendered = !0,
|
|
3630
|
+
</div>`, this._rendered = !0, u(this, this._value), this._wire();
|
|
3624
3631
|
}
|
|
3625
3632
|
_syncFormValue() {
|
|
3626
|
-
|
|
3633
|
+
u(this, this._value);
|
|
3627
3634
|
}
|
|
3628
3635
|
_syncTrigger() {
|
|
3629
3636
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
@@ -3650,7 +3657,7 @@ var z = class extends HTMLElement {
|
|
|
3650
3657
|
if (!e) return;
|
|
3651
3658
|
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = J(this._value), i = this._focus, a = "";
|
|
3652
3659
|
for (let e = 0; e < n.length; e++) {
|
|
3653
|
-
let o = n[e], s =
|
|
3660
|
+
let o = n[e], s = pe(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
3654
3661
|
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${Y(o, t)}</button>`;
|
|
3655
3662
|
}
|
|
3656
3663
|
e.innerHTML = a, this._focusActive();
|
|
@@ -3660,7 +3667,7 @@ var z = class extends HTMLElement {
|
|
|
3660
3667
|
t && !e.hidden && t.focus();
|
|
3661
3668
|
}
|
|
3662
3669
|
_position(e, t) {
|
|
3663
|
-
|
|
3670
|
+
o(e, t);
|
|
3664
3671
|
}
|
|
3665
3672
|
_onKey(e) {
|
|
3666
3673
|
let t = [...this.querySelector(".timepicker-pop").querySelectorAll(".timepicker-option")];
|
|
@@ -3738,18 +3745,18 @@ var z = class extends HTMLElement {
|
|
|
3738
3745
|
this._popClick = !1, r() && !t && !this.contains(e.target) && this._close();
|
|
3739
3746
|
}, document.addEventListener("click", this._onDocClick), this._onDocKey = (e) => {
|
|
3740
3747
|
r() && e.key === "Escape" && this._close();
|
|
3741
|
-
}, document.addEventListener("keydown", this._onDocKey),
|
|
3748
|
+
}, document.addEventListener("keydown", this._onDocKey), s(this, () => {
|
|
3742
3749
|
r() && this._position(e, t);
|
|
3743
3750
|
});
|
|
3744
3751
|
}, this._bindGlobal(), this._syncFormValue();
|
|
3745
3752
|
}
|
|
3746
3753
|
_teardown() {
|
|
3747
|
-
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null),
|
|
3754
|
+
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), this._onDocKey &&= (document.removeEventListener("keydown", this._onDocKey), null), c(this), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
|
|
3748
3755
|
}
|
|
3749
3756
|
disconnectedCallback() {
|
|
3750
3757
|
this._teardown();
|
|
3751
3758
|
}
|
|
3752
|
-
},
|
|
3759
|
+
}, he = "wui-wizard-step", ge = class extends HTMLElement {
|
|
3753
3760
|
static get observedAttributes() {
|
|
3754
3761
|
return [
|
|
3755
3762
|
"active",
|
|
@@ -3783,7 +3790,7 @@ var z = class extends HTMLElement {
|
|
|
3783
3790
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
3784
3791
|
}
|
|
3785
3792
|
get _steps() {
|
|
3786
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
3793
|
+
return [...this.querySelectorAll(`:scope > ${he}`)];
|
|
3787
3794
|
}
|
|
3788
3795
|
refresh() {
|
|
3789
3796
|
this._rendered && this._renderChrome();
|
|
@@ -3840,15 +3847,15 @@ var z = class extends HTMLElement {
|
|
|
3840
3847
|
].filter(Boolean).join(" "), this._header.setAttribute("aria-label", this.getAttribute("label") || "Progress");
|
|
3841
3848
|
let i = this.hasAttribute("non-linear");
|
|
3842
3849
|
return e.map((e, r) => {
|
|
3843
|
-
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1,
|
|
3844
|
-
|
|
3845
|
-
let
|
|
3846
|
-
return g = t ? `<span class="step-circle">${
|
|
3850
|
+
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
|
|
3851
|
+
u = a === "done" ? f("check") : a === "error" ? f("alert-triangle") : a === "skipped" ? f("minus") : c ? f(c) : String(l);
|
|
3852
|
+
let d = a === "pending" ? "step" : `step ${a}`, p = a === "active" ? " aria-current=\"step\"" : "", m = i || r < this._active, h = s ? `<span class="step-desc">${X(s)}</span>` : "", g;
|
|
3853
|
+
return g = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${X(o)}</span>${h}</span>` : n ? `<span class="step-circle">${u}</span><span class="step-index">Step ${l}</span><span class="step-label">${X(o)}</span>${h}` : `<span class="step-circle">${u}</span><span class="step-label">${X(o)}</span>${h}`, m ? `<button type="button" class="${d}" data-step="${r}"${p}>${g}</button>` : `<div class="${d}"${p}>${g}</div>`;
|
|
3847
3854
|
}).join("");
|
|
3848
3855
|
}
|
|
3849
3856
|
_footerHtml(e) {
|
|
3850
3857
|
let t = this._active, n = e.length - 1, r = this.hasAttribute("disabled") ? " disabled" : "", i = e[t]?.hasAttribute("optional") || this.hasAttribute("skippable"), a = this.getAttribute("back-label") || "Back", o = this.getAttribute("next-label") || "Next", s = this.getAttribute("skip-label") || "Skip", c = this.getAttribute("finish-label") || "Finish";
|
|
3851
|
-
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${
|
|
3858
|
+
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${f("arrow-left", { className: "me-2" })}${X(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${X(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${X(o)}${f("arrow-right", { className: "ms-2" })}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${X(c)}</button>`}</span>`;
|
|
3852
3859
|
}
|
|
3853
3860
|
_wire() {
|
|
3854
3861
|
this._teardown(), this._onHeaderClick = (e) => {
|
|
@@ -3916,7 +3923,7 @@ var z = class extends HTMLElement {
|
|
|
3916
3923
|
_reflectActive(e) {
|
|
3917
3924
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
3918
3925
|
}
|
|
3919
|
-
}, X = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
|
|
3926
|
+
}, X = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), _e = class extends HTMLElement {
|
|
3920
3927
|
static get observedAttributes() {
|
|
3921
3928
|
return [
|
|
3922
3929
|
"label",
|
|
@@ -3930,14 +3937,14 @@ var z = class extends HTMLElement {
|
|
|
3930
3937
|
let e = this.closest("wui-wizard");
|
|
3931
3938
|
e && typeof e.refresh == "function" && e.refresh();
|
|
3932
3939
|
}
|
|
3933
|
-
},
|
|
3940
|
+
}, ve = "image/png,image/jpeg,image/webp", ye = 5, be = {
|
|
3934
3941
|
"image/png": [".png"],
|
|
3935
3942
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
3936
3943
|
"image/webp": [".webp"],
|
|
3937
3944
|
"image/gif": [".gif"],
|
|
3938
3945
|
"image/svg+xml": [".svg"],
|
|
3939
3946
|
"application/pdf": [".pdf"]
|
|
3940
|
-
},
|
|
3947
|
+
}, xe = {
|
|
3941
3948
|
"image/png": "PNG",
|
|
3942
3949
|
"image/jpeg": "JPG",
|
|
3943
3950
|
"image/webp": "WEBP",
|
|
@@ -3962,44 +3969,44 @@ var z = class extends HTMLElement {
|
|
|
3962
3969
|
".avif",
|
|
3963
3970
|
".heic"
|
|
3964
3971
|
];
|
|
3965
|
-
function
|
|
3972
|
+
function Se(e) {
|
|
3966
3973
|
if (!e) return !1;
|
|
3967
3974
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
3968
3975
|
if (t) return t.startsWith("image/");
|
|
3969
3976
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
3970
3977
|
return Q.some((e) => r.endsWith(e));
|
|
3971
3978
|
}
|
|
3972
|
-
function
|
|
3979
|
+
function Ce(e) {
|
|
3973
3980
|
let t = Z(e);
|
|
3974
3981
|
return t.length ? t.every((e) => e.startsWith(".") ? Q.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
3975
3982
|
}
|
|
3976
|
-
function
|
|
3983
|
+
function we(e) {
|
|
3977
3984
|
let t = [];
|
|
3978
3985
|
for (let n of Z(e)) {
|
|
3979
|
-
let e =
|
|
3986
|
+
let e = xe[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
3980
3987
|
t.includes(e) || t.push(e);
|
|
3981
3988
|
}
|
|
3982
3989
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
3983
3990
|
}
|
|
3984
|
-
function
|
|
3991
|
+
function Te(e, t) {
|
|
3985
3992
|
let n = Z(t);
|
|
3986
3993
|
if (!n.length) return !0;
|
|
3987
3994
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
3988
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
3995
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (be[e] || []).some((e) => i.endsWith(e)));
|
|
3989
3996
|
}
|
|
3990
|
-
function
|
|
3997
|
+
function Ee(e, t = {}) {
|
|
3991
3998
|
if (!e) return null;
|
|
3992
|
-
let n = t.accept === void 0 ?
|
|
3993
|
-
return
|
|
3999
|
+
let n = t.accept === void 0 ? ve : t.accept, r = t.maxSizeMb || 5;
|
|
4000
|
+
return Te(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${we(n)} file.`;
|
|
3994
4001
|
}
|
|
3995
4002
|
//#endregion
|
|
3996
4003
|
//#region src/index.js
|
|
3997
4004
|
var $ = (e, t) => {
|
|
3998
4005
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
3999
4006
|
};
|
|
4000
|
-
function
|
|
4001
|
-
$("wui-select", V), $("wui-phone", z), $("wui-datepicker",
|
|
4007
|
+
function De() {
|
|
4008
|
+
$("wui-select", V), $("wui-phone", z), $("wui-datepicker", ee), $("wui-date-range", te), $("wui-dock", ne), $("wui-slider", U), $("wui-timepicker", me), $("wui-autocomplete", v), $("wui-multiselect", ie), $("wui-taginput", G), $("wui-otp", j), $("wui-status-icon", n), $("wui-wizard-step", _e), $("wui-wizard", ge);
|
|
4002
4009
|
}
|
|
4003
|
-
|
|
4010
|
+
De();
|
|
4004
4011
|
//#endregion
|
|
4005
|
-
export {
|
|
4012
|
+
export { ve as DEFAULT_IMAGE_ACCEPT, ye as DEFAULT_MAX_SIZE_MB, t as STATUS_TONES, v as WuiAutocomplete, ee as WuiDatePicker, te as WuiDateRange, ne as WuiDock, ie as WuiMultiSelect, j as WuiOtp, z as WuiPhone, V as WuiSelect, U as WuiSlider, n as WuiStatusIcon, G as WuiTagInput, me as WuiTimePicker, ge as WuiWizard, _e as WuiWizardStep, we as acceptLabel, De as defineWeborityElements, Se as isImageFile, Ce as isImageOnlyAccept, Te as matchesAccept, Ee as validateFile };
|