@webority/ui-elements 0.9.10 → 0.9.12
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/{libphonenumber-js-BcNT8oq0.js → max-BDKx469G.js} +4171 -1336
- package/dist/ui-elements.global.js +86 -57
- package/dist/ui-elements.js +350 -105
- package/package.json +1 -1
package/dist/ui-elements.js
CHANGED
|
@@ -1123,7 +1123,193 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1123
1123
|
}, re = (e, t) => {
|
|
1124
1124
|
let n = Number.parseFloat(e);
|
|
1125
1125
|
return Number.isFinite(n) ? n : t;
|
|
1126
|
-
},
|
|
1126
|
+
}, k = "wui-feedback-submit", A = {
|
|
1127
|
+
label: "Feedback",
|
|
1128
|
+
heading: "Share feedback",
|
|
1129
|
+
placeholder: "What's working, what isn't?",
|
|
1130
|
+
emailLabel: "Email (optional)",
|
|
1131
|
+
submitLabel: "Send feedback",
|
|
1132
|
+
sendingLabel: "Sending…",
|
|
1133
|
+
messageLabel: "Your message",
|
|
1134
|
+
emptyError: "Please write a message before sending.",
|
|
1135
|
+
failedError: "That didn't send. Please try again.",
|
|
1136
|
+
thanks: "Thanks — we've got it."
|
|
1137
|
+
}, ie = 1e4, ae = 1600, j = class extends HTMLElement {
|
|
1138
|
+
static get observedAttributes() {
|
|
1139
|
+
return [
|
|
1140
|
+
"position",
|
|
1141
|
+
"label",
|
|
1142
|
+
"heading",
|
|
1143
|
+
"placeholder",
|
|
1144
|
+
"collect-email",
|
|
1145
|
+
"surface",
|
|
1146
|
+
"screen"
|
|
1147
|
+
];
|
|
1148
|
+
}
|
|
1149
|
+
constructor() {
|
|
1150
|
+
super(), this._state = "idle", this._submitListeners = 0, this._timer = 0, this._thanksTimer = 0;
|
|
1151
|
+
}
|
|
1152
|
+
get position() {
|
|
1153
|
+
return this.getAttribute("position") === "bottom-left" ? "bottom-left" : "bottom-right";
|
|
1154
|
+
}
|
|
1155
|
+
set position(e) {
|
|
1156
|
+
this.setAttribute("position", String(e ?? "bottom-right"));
|
|
1157
|
+
}
|
|
1158
|
+
get label() {
|
|
1159
|
+
return this.getAttribute("label") || A.label;
|
|
1160
|
+
}
|
|
1161
|
+
set label(e) {
|
|
1162
|
+
this.setAttribute("label", String(e ?? ""));
|
|
1163
|
+
}
|
|
1164
|
+
get heading() {
|
|
1165
|
+
return this.getAttribute("heading") || A.heading;
|
|
1166
|
+
}
|
|
1167
|
+
set heading(e) {
|
|
1168
|
+
this.setAttribute("heading", String(e ?? ""));
|
|
1169
|
+
}
|
|
1170
|
+
get placeholder() {
|
|
1171
|
+
return this.getAttribute("placeholder") || A.placeholder;
|
|
1172
|
+
}
|
|
1173
|
+
set placeholder(e) {
|
|
1174
|
+
this.setAttribute("placeholder", String(e ?? ""));
|
|
1175
|
+
}
|
|
1176
|
+
get collectEmail() {
|
|
1177
|
+
return this.hasAttribute("collect-email");
|
|
1178
|
+
}
|
|
1179
|
+
set collectEmail(e) {
|
|
1180
|
+
e ? this.setAttribute("collect-email", "") : this.removeAttribute("collect-email");
|
|
1181
|
+
}
|
|
1182
|
+
get isOpen() {
|
|
1183
|
+
return this._open === !0;
|
|
1184
|
+
}
|
|
1185
|
+
addEventListener(e, t, n) {
|
|
1186
|
+
e === k && (this._submitListeners += 1), super.addEventListener(e, t, n);
|
|
1187
|
+
}
|
|
1188
|
+
removeEventListener(e, t, n) {
|
|
1189
|
+
e === k && this._submitListeners > 0 && --this._submitListeners, super.removeEventListener(e, t, n);
|
|
1190
|
+
}
|
|
1191
|
+
connectedCallback() {
|
|
1192
|
+
this._rendered || this.render();
|
|
1193
|
+
}
|
|
1194
|
+
disconnectedCallback() {
|
|
1195
|
+
this._clearTimers();
|
|
1196
|
+
}
|
|
1197
|
+
attributeChangedCallback(e, t, n) {
|
|
1198
|
+
this._rendered && e !== "position" && this.render();
|
|
1199
|
+
}
|
|
1200
|
+
render() {
|
|
1201
|
+
let e = this._open === !0, t = this._refs().message?.value ?? "", n = this._refs().email?.value ?? "";
|
|
1202
|
+
this.innerHTML = `
|
|
1203
|
+
<button type="button" class="feedback-trigger" aria-expanded="false" aria-haspopup="dialog">
|
|
1204
|
+
<span class="feedback-trigger-icon" aria-hidden="true">${f("message-square", { size: 18 })}</span>
|
|
1205
|
+
<span class="feedback-trigger-label">${oe(this.label)}</span>
|
|
1206
|
+
</button>
|
|
1207
|
+
<div class="feedback-panel" role="dialog" aria-label="${se(this.heading)}" hidden>
|
|
1208
|
+
<div class="feedback-head">
|
|
1209
|
+
<h2 class="feedback-heading">${oe(this.heading)}</h2>
|
|
1210
|
+
<button type="button" class="feedback-close" aria-label="Close">${f("x", { size: 16 })}</button>
|
|
1211
|
+
</div>
|
|
1212
|
+
<div class="feedback-body">
|
|
1213
|
+
<label class="feedback-field">
|
|
1214
|
+
<span class="feedback-field-label">${A.messageLabel}</span>
|
|
1215
|
+
<textarea class="feedback-message" rows="4" required placeholder="${se(this.placeholder)}"></textarea>
|
|
1216
|
+
</label>
|
|
1217
|
+
${this.collectEmail ? `<label class="feedback-field">
|
|
1218
|
+
<span class="feedback-field-label">${A.emailLabel}</span>
|
|
1219
|
+
<input type="email" class="feedback-email" autocomplete="email" placeholder="you@example.com" />
|
|
1220
|
+
</label>` : ""}
|
|
1221
|
+
<p class="feedback-error" role="alert" hidden></p>
|
|
1222
|
+
</div>
|
|
1223
|
+
<div class="feedback-actions">
|
|
1224
|
+
<button type="button" class="feedback-cancel">Cancel</button>
|
|
1225
|
+
<button type="button" class="feedback-submit">${A.submitLabel}</button>
|
|
1226
|
+
</div>
|
|
1227
|
+
<div class="feedback-thanks" hidden>
|
|
1228
|
+
<span class="feedback-thanks-icon" aria-hidden="true">${f("check-circle", { size: 20 })}</span>
|
|
1229
|
+
<span class="feedback-thanks-text">${A.thanks}</span>
|
|
1230
|
+
</div>
|
|
1231
|
+
</div>`, this._rendered = !0, this._wire();
|
|
1232
|
+
let r = this._refs();
|
|
1233
|
+
r.message && (r.message.value = t), r.email && (r.email.value = n), e && this.open({ focus: !1 });
|
|
1234
|
+
}
|
|
1235
|
+
_refs() {
|
|
1236
|
+
return {
|
|
1237
|
+
trigger: this.querySelector(".feedback-trigger"),
|
|
1238
|
+
panel: this.querySelector(".feedback-panel"),
|
|
1239
|
+
close: this.querySelector(".feedback-close"),
|
|
1240
|
+
cancel: this.querySelector(".feedback-cancel"),
|
|
1241
|
+
submit: this.querySelector(".feedback-submit"),
|
|
1242
|
+
message: this.querySelector(".feedback-message"),
|
|
1243
|
+
email: this.querySelector(".feedback-email"),
|
|
1244
|
+
error: this.querySelector(".feedback-error"),
|
|
1245
|
+
thanks: this.querySelector(".feedback-thanks")
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
_wire() {
|
|
1249
|
+
let { trigger: e, close: t, cancel: n, submit: r } = this._refs();
|
|
1250
|
+
e?.addEventListener("click", () => this.isOpen ? this.close() : this.open()), t?.addEventListener("click", () => this.close()), n?.addEventListener("click", () => this.close()), r?.addEventListener("click", () => this._submit()), this._onKeyDown || (this._onKeyDown = (e) => {
|
|
1251
|
+
e.key === "Escape" && this.isOpen && (e.stopPropagation(), this.close());
|
|
1252
|
+
}, this.addEventListener("keydown", this._onKeyDown));
|
|
1253
|
+
}
|
|
1254
|
+
open({ focus: e = !0 } = {}) {
|
|
1255
|
+
let { panel: t, trigger: n, message: r } = this._refs();
|
|
1256
|
+
t && (this._open = !0, t.hidden = !1, this.setAttribute("open", ""), n?.setAttribute("aria-expanded", "true"), e && r?.focus());
|
|
1257
|
+
}
|
|
1258
|
+
close() {
|
|
1259
|
+
let { panel: e, trigger: t } = this._refs();
|
|
1260
|
+
e && (this._open = !1, e.hidden = !0, this.removeAttribute("open"), t?.setAttribute("aria-expanded", "false"), t?.focus());
|
|
1261
|
+
}
|
|
1262
|
+
submitted() {
|
|
1263
|
+
this._clearTimers(), this._state = "done";
|
|
1264
|
+
let { thanks: e, error: t, submit: n, message: r, email: i } = this._refs();
|
|
1265
|
+
this._setBusy(!1), t && (t.hidden = !0, t.textContent = ""), e && (e.hidden = !1), this.querySelector(".feedback-body")?.setAttribute("hidden", ""), this.querySelector(".feedback-actions")?.setAttribute("hidden", ""), n && (n.disabled = !0), this._thanksTimer = setTimeout(() => {
|
|
1266
|
+
r && (r.value = ""), i && (i.value = ""), this._reset(), this.close();
|
|
1267
|
+
}, ae);
|
|
1268
|
+
}
|
|
1269
|
+
failed(e) {
|
|
1270
|
+
this._clearTimers(), this._state = "error", this._setBusy(!1);
|
|
1271
|
+
let { error: t, message: n } = this._refs();
|
|
1272
|
+
t && (t.textContent = e || A.failedError, t.hidden = !1), n?.focus();
|
|
1273
|
+
}
|
|
1274
|
+
_submit() {
|
|
1275
|
+
if (this._state === "submitting") return;
|
|
1276
|
+
let { message: e, email: t, error: n } = this._refs(), r = (e?.value ?? "").trim();
|
|
1277
|
+
if (!r) {
|
|
1278
|
+
n && (n.textContent = A.emptyError, n.hidden = !1), e?.focus();
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
n && (n.hidden = !0, n.textContent = ""), this._state = "submitting", this._setBusy(!0);
|
|
1282
|
+
let i = {
|
|
1283
|
+
message: r,
|
|
1284
|
+
email: (t?.value ?? "").trim(),
|
|
1285
|
+
surface: this.getAttribute("surface") || "",
|
|
1286
|
+
screen: this.getAttribute("screen") || ""
|
|
1287
|
+
};
|
|
1288
|
+
if (this.dispatchEvent(new CustomEvent(k, {
|
|
1289
|
+
bubbles: !0,
|
|
1290
|
+
composed: !0,
|
|
1291
|
+
detail: i
|
|
1292
|
+
})), this._submitListeners === 0) {
|
|
1293
|
+
this._reset();
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
this._timer = setTimeout(() => {
|
|
1297
|
+
this._state === "submitting" && this.failed();
|
|
1298
|
+
}, ie);
|
|
1299
|
+
}
|
|
1300
|
+
_setBusy(e) {
|
|
1301
|
+
let { submit: t } = this._refs();
|
|
1302
|
+
t && (t.disabled = e, t.textContent = e ? A.sendingLabel : A.submitLabel, this.toggleAttribute("busy", e));
|
|
1303
|
+
}
|
|
1304
|
+
_reset() {
|
|
1305
|
+
this._clearTimers(), this._state = "idle", this._setBusy(!1);
|
|
1306
|
+
let { thanks: e, submit: t } = this._refs();
|
|
1307
|
+
e && (e.hidden = !0), this.querySelector(".feedback-body")?.removeAttribute("hidden"), this.querySelector(".feedback-actions")?.removeAttribute("hidden"), t && (t.disabled = !1);
|
|
1308
|
+
}
|
|
1309
|
+
_clearTimers() {
|
|
1310
|
+
this._timer &&= (clearTimeout(this._timer), 0), this._thanksTimer &&= (clearTimeout(this._thanksTimer), 0);
|
|
1311
|
+
}
|
|
1312
|
+
}, oe = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), se = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), ce = class extends HTMLElement {
|
|
1127
1313
|
static formAssociated = !0;
|
|
1128
1314
|
_accessibleName() {
|
|
1129
1315
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1223,13 +1409,13 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1223
1409
|
let a = `${this.id}-listbox`;
|
|
1224
1410
|
this._listboxId = a, this.innerHTML = `
|
|
1225
1411
|
<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="${
|
|
1412
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${M(a)}" aria-label="${M(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
|
|
1227
1413
|
${n ? f(n, { className: "search-select-icon" }) : ""}
|
|
1228
1414
|
<div class="ms-chips" data-chips></div>
|
|
1229
1415
|
${f("chevron-down", { className: "search-select-caret" })}
|
|
1230
1416
|
</div>
|
|
1231
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1232
|
-
${e ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${
|
|
1417
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${M(a)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1418
|
+
${e ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${M(t)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${f("x")}</button></div>` : ""}
|
|
1233
1419
|
<div class="search-select-options"></div>
|
|
1234
1420
|
<div class="search-select-empty" hidden>No matches</div>
|
|
1235
1421
|
</div>
|
|
@@ -1243,7 +1429,7 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1243
1429
|
e.innerHTML = `<span class="search-select-placeholder">${h(t)}</span>`;
|
|
1244
1430
|
return;
|
|
1245
1431
|
}
|
|
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="${
|
|
1432
|
+
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="${M(e)}" aria-label="Remove ${M(le(this._labelFor(e)))}">${f("x")}</button></span>`).join(""), this._collapseChips();
|
|
1247
1433
|
}
|
|
1248
1434
|
_collapseChips() {
|
|
1249
1435
|
let e = this.querySelector("[data-chips]");
|
|
@@ -1267,11 +1453,11 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1267
1453
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
1268
1454
|
if (!t) return;
|
|
1269
1455
|
let r = (e || "").trim().toLowerCase(), i = this._readOptions();
|
|
1270
|
-
r && (i = i.filter((e) =>
|
|
1456
|
+
r && (i = i.filter((e) => le(e.label).toLowerCase().includes(r)));
|
|
1271
1457
|
let a = this._listboxId || `${this.id || "wui-multiselect"}-listbox`;
|
|
1272
1458
|
t.innerHTML = i.map((e, t) => {
|
|
1273
1459
|
let n = this._values.includes(String(e.value));
|
|
1274
|
-
return `<button type="button" role="option" id="${
|
|
1460
|
+
return `<button type="button" role="option" id="${M(`${a}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${M(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${_(e)}</span><span class="ms-check">${f("check")}</span></button>`;
|
|
1275
1461
|
}).join(""), n && (n.hidden = i.length > 0), this._active = -1, this.querySelector(".search-select-control")?.removeAttribute("aria-activedescendant"), this._reanchor?.();
|
|
1276
1462
|
}
|
|
1277
1463
|
_wire() {
|
|
@@ -1351,7 +1537,7 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1351
1537
|
disconnectedCallback() {
|
|
1352
1538
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
1353
1539
|
}
|
|
1354
|
-
},
|
|
1540
|
+
}, M = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), le = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), ue = /[^0-9]/g, de = /[^0-9a-zA-Z]/g, fe = class extends HTMLElement {
|
|
1355
1541
|
static formAssociated = !0;
|
|
1356
1542
|
static get observedAttributes() {
|
|
1357
1543
|
return [
|
|
@@ -1382,7 +1568,7 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1382
1568
|
this._value = this._clean(e), u(this, this._value), this._paint();
|
|
1383
1569
|
}
|
|
1384
1570
|
_clean(e) {
|
|
1385
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
1571
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? de : ue, "").slice(0, this.length);
|
|
1386
1572
|
}
|
|
1387
1573
|
constructor() {
|
|
1388
1574
|
super();
|
|
@@ -1473,7 +1659,7 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1473
1659
|
disconnectedCallback() {
|
|
1474
1660
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
1475
1661
|
}
|
|
1476
|
-
},
|
|
1662
|
+
}, pe = [
|
|
1477
1663
|
[
|
|
1478
1664
|
"AF",
|
|
1479
1665
|
"Afghanistan",
|
|
@@ -2699,56 +2885,56 @@ var m = Symbol("wui.trustedHtml"), h = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2699
2885
|
"Zimbabwe",
|
|
2700
2886
|
"263"
|
|
2701
2887
|
]
|
|
2702
|
-
],
|
|
2888
|
+
], N = (e) => (pe.find((t) => t[0] === e) || [
|
|
2703
2889
|
"",
|
|
2704
2890
|
"",
|
|
2705
2891
|
""
|
|
2706
|
-
])[2],
|
|
2707
|
-
function
|
|
2708
|
-
return
|
|
2892
|
+
])[2], P = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, F = null, I = null;
|
|
2893
|
+
function me() {
|
|
2894
|
+
return F ? Promise.resolve(F) : (I ||= Promise.all([import("./max-BDKx469G.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (F = {
|
|
2709
2895
|
AsYouType: e.AsYouType,
|
|
2710
2896
|
getExampleNumber: e.getExampleNumber,
|
|
2711
2897
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
2712
2898
|
examples: t.default || t
|
|
2713
|
-
},
|
|
2899
|
+
}, F)).catch(() => null), I);
|
|
2714
2900
|
}
|
|
2715
|
-
function
|
|
2716
|
-
if (!
|
|
2901
|
+
function L(e, t) {
|
|
2902
|
+
if (!F || !t) return t;
|
|
2717
2903
|
try {
|
|
2718
|
-
return new
|
|
2904
|
+
return new F.AsYouType(e).input(t);
|
|
2719
2905
|
} catch {
|
|
2720
2906
|
return t;
|
|
2721
2907
|
}
|
|
2722
2908
|
}
|
|
2723
|
-
function
|
|
2724
|
-
if (!
|
|
2909
|
+
function R(e) {
|
|
2910
|
+
if (!F) return null;
|
|
2725
2911
|
try {
|
|
2726
|
-
return
|
|
2912
|
+
return F.getExampleNumber(e, F.examples)?.formatNational() || null;
|
|
2727
2913
|
} catch {
|
|
2728
2914
|
return null;
|
|
2729
2915
|
}
|
|
2730
2916
|
}
|
|
2731
|
-
function
|
|
2732
|
-
if (!
|
|
2917
|
+
function z(e) {
|
|
2918
|
+
if (!F || !e) return null;
|
|
2733
2919
|
try {
|
|
2734
|
-
return
|
|
2920
|
+
return F.isValidPhoneNumber(e);
|
|
2735
2921
|
} catch {
|
|
2736
2922
|
return null;
|
|
2737
2923
|
}
|
|
2738
2924
|
}
|
|
2739
|
-
function
|
|
2740
|
-
if (!
|
|
2925
|
+
function he(e) {
|
|
2926
|
+
if (!F) return null;
|
|
2741
2927
|
try {
|
|
2742
|
-
let t =
|
|
2928
|
+
let t = F.getExampleNumber(e, F.examples);
|
|
2743
2929
|
return t?.nationalNumber ? t.nationalNumber.length : null;
|
|
2744
2930
|
} catch {
|
|
2745
2931
|
return null;
|
|
2746
2932
|
}
|
|
2747
2933
|
}
|
|
2748
|
-
function
|
|
2749
|
-
if (!
|
|
2934
|
+
function B(e) {
|
|
2935
|
+
if (!F || !e?.trim().startsWith("+")) return null;
|
|
2750
2936
|
try {
|
|
2751
|
-
let t = new
|
|
2937
|
+
let t = new F.AsYouType();
|
|
2752
2938
|
t.input(e.trim());
|
|
2753
2939
|
let n = t.getCountry();
|
|
2754
2940
|
return n ? {
|
|
@@ -2759,7 +2945,7 @@ function R(e) {
|
|
|
2759
2945
|
return null;
|
|
2760
2946
|
}
|
|
2761
2947
|
}
|
|
2762
|
-
var
|
|
2948
|
+
var V = class extends HTMLElement {
|
|
2763
2949
|
static formAssociated = !0;
|
|
2764
2950
|
static get observedAttributes() {
|
|
2765
2951
|
return [
|
|
@@ -2806,13 +2992,13 @@ var z = class extends HTMLElement {
|
|
|
2806
2992
|
this.value = this._defaultValue || "";
|
|
2807
2993
|
}
|
|
2808
2994
|
get value() {
|
|
2809
|
-
return this._national ? `+${
|
|
2995
|
+
return this._national ? `+${N(this._country)}${this._national}` : "";
|
|
2810
2996
|
}
|
|
2811
2997
|
set value(e) {
|
|
2812
|
-
let t = String(e ?? "").trim(), n =
|
|
2998
|
+
let t = String(e ?? "").trim(), n = B(t);
|
|
2813
2999
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
2814
3000
|
else if (t.startsWith("+")) {
|
|
2815
|
-
let e = t.replace(/[^0-9]/g, ""), n = String(
|
|
3001
|
+
let e = t.replace(/[^0-9]/g, ""), n = String(N(this._country));
|
|
2816
3002
|
n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
|
|
2817
3003
|
} else this._national = t.replace(/[^0-9]/g, "");
|
|
2818
3004
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
@@ -2828,25 +3014,25 @@ var z = class extends HTMLElement {
|
|
|
2828
3014
|
}
|
|
2829
3015
|
render() {
|
|
2830
3016
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || ""), this._country = this.getAttribute("country") || this._country;
|
|
2831
|
-
let e = this.getAttribute("placeholder") ||
|
|
3017
|
+
let e = this.getAttribute("placeholder") || R(this._country) || "Enter phone number";
|
|
2832
3018
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
2833
3019
|
let t = `${this.id}-listbox`;
|
|
2834
3020
|
this._listboxId = t;
|
|
2835
|
-
let n =
|
|
3021
|
+
let n = pe.map(([e, n, r], i) => `<button type="button" role="option" id="${H(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${P(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
2836
3022
|
this.innerHTML = `
|
|
2837
3023
|
<div class="phone-input-wrap">
|
|
2838
3024
|
<div class="phone-country-adornment">
|
|
2839
|
-
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
2840
|
-
<span class="${
|
|
3025
|
+
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${H(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
3026
|
+
<span class="${P(this._country)}" data-flag aria-hidden="true"></span>
|
|
2841
3027
|
${f("chevron-down", { className: "phone-chevron" })}
|
|
2842
|
-
<span class="phone-dial" data-dial>+${
|
|
3028
|
+
<span class="phone-dial" data-dial>+${N(this._country)}</span>
|
|
2843
3029
|
</button>
|
|
2844
|
-
<div class="country-dropdown-menu" role="listbox" id="${
|
|
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="${
|
|
3030
|
+
<div class="country-dropdown-menu" role="listbox" id="${H(t)}" tabindex="-1" hidden>
|
|
3031
|
+
<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="${H(t)}" aria-autocomplete="list" /></div>
|
|
2846
3032
|
<div class="country-list-scroll">${n}<div class="country-empty" hidden>No countries found</div></div>
|
|
2847
3033
|
</div>
|
|
2848
3034
|
</div>
|
|
2849
|
-
<input type="tel" class="input" placeholder="${
|
|
3035
|
+
<input type="tel" class="input" placeholder="${H(e)}" value="${H(L(this._country, this._national))}"${this.getAttribute("aria-label") ? ` aria-label="${H(this.getAttribute("aria-label"))}"` : ""}${this.getAttribute("aria-describedby") ? ` aria-describedby="${H(this.getAttribute("aria-describedby"))}"` : ""}${this.hasAttribute("required") ? " required aria-required=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""} />
|
|
2850
3036
|
</div>
|
|
2851
3037
|
<div class="field-error" data-phone-error hidden></div>`, this._rendered = !0, u(this, this.value), this._wire();
|
|
2852
3038
|
}
|
|
@@ -2877,12 +3063,12 @@ var z = class extends HTMLElement {
|
|
|
2877
3063
|
}
|
|
2878
3064
|
a && (a.hidden = n > 0);
|
|
2879
3065
|
}, v = (e) => {
|
|
2880
|
-
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className =
|
|
3066
|
+
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = P(e)), d && (d.textContent = `+${N(e)}`);
|
|
2881
3067
|
for (let t of this._itemEls()) {
|
|
2882
3068
|
let n = t.dataset.iso === e;
|
|
2883
3069
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
2884
3070
|
}
|
|
2885
|
-
!this.getAttribute("placeholder") && l && (l.placeholder =
|
|
3071
|
+
!this.getAttribute("placeholder") && l && (l.placeholder = R(e) || "Enter phone number"), l && this._national && (l.value = L(e, this._national)), g(), this._syncMirror(), this._emitChange(), l?.focus();
|
|
2886
3072
|
}, y = (t) => {
|
|
2887
3073
|
let n = this._visibleItems();
|
|
2888
3074
|
if (t.key === "ArrowDown") {
|
|
@@ -2916,7 +3102,7 @@ var z = class extends HTMLElement {
|
|
|
2916
3102
|
let b = this.querySelector("[data-phone-error]"), x = (e) => {
|
|
2917
3103
|
if (l.classList.toggle("is-invalid", e), e ? l.setAttribute("aria-invalid", "true") : l.removeAttribute("aria-invalid"), b) {
|
|
2918
3104
|
if (e) {
|
|
2919
|
-
let e =
|
|
3105
|
+
let e = R(this._country);
|
|
2920
3106
|
b.textContent = e ? `Enter a valid phone number, e.g. ${e}` : "Enter a valid phone number";
|
|
2921
3107
|
}
|
|
2922
3108
|
b.hidden = !e;
|
|
@@ -2924,15 +3110,15 @@ var z = class extends HTMLElement {
|
|
|
2924
3110
|
};
|
|
2925
3111
|
l.addEventListener("input", (e) => {
|
|
2926
3112
|
e.stopPropagation();
|
|
2927
|
-
let t = l.value.replace(/[^0-9]/g, ""), n =
|
|
3113
|
+
let t = l.value.replace(/[^0-9]/g, ""), n = he(this._country);
|
|
2928
3114
|
n && t.length > n && (t = t.slice(0, n)), this._national = t;
|
|
2929
|
-
let r =
|
|
2930
|
-
l.value !== r && (l.value = r), this._syncMirror(), this._emitInput(), l.classList.contains("is-invalid") && (!this._national ||
|
|
3115
|
+
let r = L(this._country, this._national);
|
|
3116
|
+
l.value !== r && (l.value = r), this._syncMirror(), this._emitInput(), l.classList.contains("is-invalid") && (!this._national || z(this.value) === !0) && x(!1);
|
|
2931
3117
|
}), l.addEventListener("change", (e) => e.stopPropagation()), l.addEventListener("blur", () => {
|
|
2932
|
-
x(this._national.length > 0 &&
|
|
3118
|
+
x(this._national.length > 0 && z(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
2933
3119
|
}), l.addEventListener("paste", (e) => {
|
|
2934
|
-
let t =
|
|
2935
|
-
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? l.value =
|
|
3120
|
+
let t = B(e.clipboardData?.getData("text"));
|
|
3121
|
+
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? l.value = L(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
|
|
2936
3122
|
}), this._bindGlobal = () => {
|
|
2937
3123
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
2938
3124
|
f() && !this.contains(e.target) && g();
|
|
@@ -2941,9 +3127,9 @@ var z = class extends HTMLElement {
|
|
|
2941
3127
|
});
|
|
2942
3128
|
}, this._teardownGlobals = () => {
|
|
2943
3129
|
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), c(this);
|
|
2944
|
-
}, this._bindGlobal(),
|
|
2945
|
-
if (!(!e || !l.isConnected) && (this._national && (l.value =
|
|
2946
|
-
let e =
|
|
3130
|
+
}, this._bindGlobal(), me().then((e) => {
|
|
3131
|
+
if (!(!e || !l.isConnected) && (this._national && (l.value = L(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
3132
|
+
let e = R(this._country);
|
|
2947
3133
|
e && (l.placeholder = e);
|
|
2948
3134
|
}
|
|
2949
3135
|
}), this._syncMirror();
|
|
@@ -2954,7 +3140,7 @@ var z = class extends HTMLElement {
|
|
|
2954
3140
|
disconnectedCallback() {
|
|
2955
3141
|
this._teardown();
|
|
2956
3142
|
}
|
|
2957
|
-
},
|
|
3143
|
+
}, H = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), ge = class extends HTMLElement {
|
|
2958
3144
|
static formAssociated = !0;
|
|
2959
3145
|
static get observedAttributes() {
|
|
2960
3146
|
return [
|
|
@@ -3043,19 +3229,19 @@ var z = class extends HTMLElement {
|
|
|
3043
3229
|
this._listboxId = d;
|
|
3044
3230
|
let p = e.map((e, t) => {
|
|
3045
3231
|
let n = String(e.value) === String(this._value);
|
|
3046
|
-
return `<button type="button" role="option" id="${
|
|
3232
|
+
return `<button type="button" role="option" id="${U(`${d}-opt-${t}`)}" class="search-select-option${n ? " selected" : ""}" data-value="${U(e.value)}" aria-selected="${n}">${_(e)}</button>`;
|
|
3047
3233
|
}).join("");
|
|
3048
3234
|
this.innerHTML = `
|
|
3049
3235
|
<div class="search-select${this.hasAttribute("compact") ? " search-select-compact" : ""}${i}">
|
|
3050
|
-
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${
|
|
3236
|
+
<button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${U(d)}" aria-label="${U(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
3051
3237
|
${a ? f(a, { className: "search-select-icon" }) : ""}
|
|
3052
3238
|
${o ? `<span class="search-select-prefix">${h(o)}</span>` : ""}
|
|
3053
3239
|
<span class="${l ? "" : "search-select-placeholder"}" data-label>${l ? _(l) : h(s)}</span>
|
|
3054
3240
|
${n ? `<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${f("x")}</span>` : ""}
|
|
3055
3241
|
${f("chevron-down", { className: "search-select-caret" })}
|
|
3056
3242
|
</button>
|
|
3057
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
3058
|
-
${t ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${
|
|
3243
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${U(d)}" tabindex="-1" hidden>
|
|
3244
|
+
${t ? `<div class="search-select-search">${f("search")}<input class="search-select-input" placeholder="${U(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${f("x")}</button></div>` : ""}
|
|
3059
3245
|
<div class="search-select-options">${p}<div class="search-select-empty" hidden>No matches</div></div>
|
|
3060
3246
|
</div>
|
|
3061
3247
|
</div>`, this._rendered = !0, u(this, this._value), this._wire(), this._syncReset();
|
|
@@ -3160,7 +3346,7 @@ var z = class extends HTMLElement {
|
|
|
3160
3346
|
disconnectedCallback() {
|
|
3161
3347
|
this._teardown();
|
|
3162
3348
|
}
|
|
3163
|
-
},
|
|
3349
|
+
}, U = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), _e = class extends HTMLElement {
|
|
3164
3350
|
static formAssociated = !0;
|
|
3165
3351
|
static get observedAttributes() {
|
|
3166
3352
|
return [
|
|
@@ -3302,7 +3488,7 @@ var z = class extends HTMLElement {
|
|
|
3302
3488
|
aria-valuenow="${this._value}"
|
|
3303
3489
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
3304
3490
|
${a ? "disabled" : ""}
|
|
3305
|
-
aria-label="${
|
|
3491
|
+
aria-label="${ve(this.getAttribute("aria-label") || "Value")}"
|
|
3306
3492
|
></button>
|
|
3307
3493
|
`}
|
|
3308
3494
|
${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>` : ""}
|
|
@@ -3405,7 +3591,7 @@ var z = class extends HTMLElement {
|
|
|
3405
3591
|
}, W = (e, t) => {
|
|
3406
3592
|
let n = Number.parseFloat(e);
|
|
3407
3593
|
return Number.isFinite(n) ? n : t;
|
|
3408
|
-
},
|
|
3594
|
+
}, ve = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), ye = class extends HTMLElement {
|
|
3409
3595
|
static formAssociated = !0;
|
|
3410
3596
|
_accessibleName() {
|
|
3411
3597
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -3478,7 +3664,7 @@ var z = class extends HTMLElement {
|
|
|
3478
3664
|
u(this, this._values.join(",")), this.innerHTML = `
|
|
3479
3665
|
<div class="search-select${t}">
|
|
3480
3666
|
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${this.hasAttribute("disabled") ? " aria-disabled=\"true\"" : ""}>
|
|
3481
|
-
<input type="text" class="ms-input" data-input aria-label="${
|
|
3667
|
+
<input type="text" class="ms-input" data-input aria-label="${G(this._accessibleName())}" placeholder="${G(this.getAttribute("placeholder") || "Add…")}" autocomplete="off"${this.hasAttribute("disabled") ? " disabled" : ""}/>
|
|
3482
3668
|
<div class="ms-chips" data-chips></div>
|
|
3483
3669
|
</div>
|
|
3484
3670
|
</div>`, this._rendered = !0, u(this, this._values.join(",")), this._renderControl(), this._wire();
|
|
@@ -3490,7 +3676,7 @@ var z = class extends HTMLElement {
|
|
|
3490
3676
|
e.innerHTML = "";
|
|
3491
3677
|
return;
|
|
3492
3678
|
}
|
|
3493
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
3679
|
+
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${be(e)}</span><button type="button" class="chip-remove" data-remove="${G(e)}" aria-label="Remove ${G(e)}">${f("x")}</button></span>`).join("");
|
|
3494
3680
|
}
|
|
3495
3681
|
}
|
|
3496
3682
|
_wire() {
|
|
@@ -3561,18 +3747,18 @@ var z = class extends HTMLElement {
|
|
|
3561
3747
|
disconnectedCallback() {
|
|
3562
3748
|
this._teardown();
|
|
3563
3749
|
}
|
|
3564
|
-
},
|
|
3750
|
+
}, be = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), G = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), K = (e) => String(e).padStart(2, "0"), xe = (e, t) => `${K(e)}:${K(t)}`, q = (e) => {
|
|
3565
3751
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
3566
3752
|
return t ? {
|
|
3567
3753
|
h: +t[1],
|
|
3568
3754
|
m: +t[2]
|
|
3569
3755
|
} : null;
|
|
3570
|
-
},
|
|
3756
|
+
}, J = (e, t = "24") => {
|
|
3571
3757
|
if (!e) return "";
|
|
3572
|
-
if (t === "24") return
|
|
3758
|
+
if (t === "24") return xe(e.h, e.m);
|
|
3573
3759
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
3574
|
-
return `${n}:${
|
|
3575
|
-
},
|
|
3760
|
+
return `${n}:${K(e.m)} ${r}`;
|
|
3761
|
+
}, Se = class extends HTMLElement {
|
|
3576
3762
|
static formAssociated = !0;
|
|
3577
3763
|
static get observedAttributes() {
|
|
3578
3764
|
return [
|
|
@@ -3619,11 +3805,11 @@ var z = class extends HTMLElement {
|
|
|
3619
3805
|
}
|
|
3620
3806
|
render() {
|
|
3621
3807
|
this._defaultValue === void 0 && (this._defaultValue = this.getAttribute("value") || "", this._value = this._defaultValue || this._value);
|
|
3622
|
-
let e = this.getAttribute("placeholder") || "Select time", t =
|
|
3808
|
+
let e = this.getAttribute("placeholder") || "Select time", t = q(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");
|
|
3623
3809
|
this.innerHTML = `
|
|
3624
3810
|
<div class="timepicker">
|
|
3625
3811
|
<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 ?
|
|
3812
|
+
<span data-trigger-label class="${t ? "" : "timepicker-placeholder"}">${t ? J(t, n) : h(e)}</span>
|
|
3627
3813
|
${f("clock")}
|
|
3628
3814
|
</button>
|
|
3629
3815
|
<div class="timepicker-pop" role="listbox" tabindex="-1" hidden></div>
|
|
@@ -3635,14 +3821,14 @@ var z = class extends HTMLElement {
|
|
|
3635
3821
|
_syncTrigger() {
|
|
3636
3822
|
let e = this.querySelector(".timepicker-trigger"), t = this.querySelector("[data-trigger-label]");
|
|
3637
3823
|
if (!t) return;
|
|
3638
|
-
let n =
|
|
3639
|
-
t.textContent = n ?
|
|
3824
|
+
let n = q(this._value), r = this.getAttribute("format") || "24";
|
|
3825
|
+
t.textContent = n ? J(n, r) : this.getAttribute("placeholder") || "Select time", t.classList.toggle("timepicker-placeholder", !n), e?.classList.toggle("has-value", !!n);
|
|
3640
3826
|
}
|
|
3641
3827
|
_buildTimes() {
|
|
3642
|
-
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r =
|
|
3828
|
+
let e = Math.max(1, parseInt(this.getAttribute("step") || "30", 10)), t = this.getAttribute("min") || "00:00", n = this.getAttribute("max") || "23:59", r = q(t) || {
|
|
3643
3829
|
h: 0,
|
|
3644
3830
|
m: 0
|
|
3645
|
-
}, i =
|
|
3831
|
+
}, i = q(n) || {
|
|
3646
3832
|
h: 23,
|
|
3647
3833
|
m: 59
|
|
3648
3834
|
}, a = [], o = r.h, s = r.m;
|
|
@@ -3655,10 +3841,10 @@ var z = class extends HTMLElement {
|
|
|
3655
3841
|
_renderOptions() {
|
|
3656
3842
|
let e = this.querySelector(".timepicker-pop");
|
|
3657
3843
|
if (!e) return;
|
|
3658
|
-
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r =
|
|
3844
|
+
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = q(this._value), i = this._focus, a = "";
|
|
3659
3845
|
for (let e = 0; e < n.length; e++) {
|
|
3660
|
-
let o = n[e], s =
|
|
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\"" : ""}>${
|
|
3846
|
+
let o = n[e], s = xe(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
3847
|
+
a += `<button type="button" class="timepicker-option${c ? " is-selected" : ""}" data-hm="${s}" role="option" tabindex="${i === e ? "0" : "-1"}"${c ? " aria-selected=\"true\"" : ""}>${J(o, t)}</button>`;
|
|
3662
3848
|
}
|
|
3663
3849
|
e.innerHTML = a, this._focusActive();
|
|
3664
3850
|
}
|
|
@@ -3756,7 +3942,7 @@ var z = class extends HTMLElement {
|
|
|
3756
3942
|
disconnectedCallback() {
|
|
3757
3943
|
this._teardown();
|
|
3758
3944
|
}
|
|
3759
|
-
},
|
|
3945
|
+
}, Ce = "wui-wizard-step", we = class extends HTMLElement {
|
|
3760
3946
|
static get observedAttributes() {
|
|
3761
3947
|
return [
|
|
3762
3948
|
"active",
|
|
@@ -3790,7 +3976,7 @@ var z = class extends HTMLElement {
|
|
|
3790
3976
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
3791
3977
|
}
|
|
3792
3978
|
get _steps() {
|
|
3793
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
3979
|
+
return [...this.querySelectorAll(`:scope > ${Ce}`)];
|
|
3794
3980
|
}
|
|
3795
3981
|
refresh() {
|
|
3796
3982
|
this._rendered && this._renderChrome();
|
|
@@ -3849,13 +4035,13 @@ var z = class extends HTMLElement {
|
|
|
3849
4035
|
return e.map((e, r) => {
|
|
3850
4036
|
let a = this._stepStatus(e, r), o = e.getAttribute("label") || "", s = e.getAttribute("description") || "", c = e.getAttribute("icon") || "", l = r + 1, u;
|
|
3851
4037
|
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">${
|
|
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">${
|
|
4038
|
+
let d = a === "pending" ? "step" : `step ${a}`, p = a === "active" ? " aria-current=\"step\"" : "", m = i || r < this._active, h = s ? `<span class="step-desc">${Y(s)}</span>` : "", g;
|
|
4039
|
+
return g = t ? `<span class="step-circle">${u}</span><span class="step-text"><span class="step-index">Step ${l}</span><span class="step-label">${Y(o)}</span>${h}</span>` : n ? `<span class="step-circle">${u}</span><span class="step-index">Step ${l}</span><span class="step-label">${Y(o)}</span>${h}` : `<span class="step-circle">${u}</span><span class="step-label">${Y(o)}</span>${h}`, m ? `<button type="button" class="${d}" data-step="${r}"${p}>${g}</button>` : `<div class="${d}"${p}>${g}</div>`;
|
|
3854
4040
|
}).join("");
|
|
3855
4041
|
}
|
|
3856
4042
|
_footerHtml(e) {
|
|
3857
4043
|
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";
|
|
3858
|
-
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${f("arrow-left", { className: "me-2" })}${
|
|
4044
|
+
return `${t > 0 ? `<button type="button" class="btn btn-secondary" data-nav="back"${r}>${f("arrow-left", { className: "me-2" })}${Y(a)}</button>` : "<span></span>"}<span class="wizard-footer-actions">${i && t < n ? `<button type="button" class="btn btn-subtle" data-nav="skip"${r}>${Y(s)}</button>` : ""}${t < n ? `<button type="button" class="btn btn-primary" data-nav="next"${r}>${Y(o)}${f("arrow-right", { className: "ms-2" })}</button>` : `<button type="button" class="btn btn-primary" data-nav="finish"${r}>${Y(c)}</button>`}</span>`;
|
|
3859
4045
|
}
|
|
3860
4046
|
_wire() {
|
|
3861
4047
|
this._teardown(), this._onHeaderClick = (e) => {
|
|
@@ -3923,7 +4109,7 @@ var z = class extends HTMLElement {
|
|
|
3923
4109
|
_reflectActive(e) {
|
|
3924
4110
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
3925
4111
|
}
|
|
3926
|
-
},
|
|
4112
|
+
}, Y = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Te = class extends HTMLElement {
|
|
3927
4113
|
static get observedAttributes() {
|
|
3928
4114
|
return [
|
|
3929
4115
|
"label",
|
|
@@ -3937,14 +4123,14 @@ var z = class extends HTMLElement {
|
|
|
3937
4123
|
let e = this.closest("wui-wizard");
|
|
3938
4124
|
e && typeof e.refresh == "function" && e.refresh();
|
|
3939
4125
|
}
|
|
3940
|
-
},
|
|
4126
|
+
}, Ee = "image/png,image/jpeg,image/webp", De = 5, Oe = {
|
|
3941
4127
|
"image/png": [".png"],
|
|
3942
4128
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
3943
4129
|
"image/webp": [".webp"],
|
|
3944
4130
|
"image/gif": [".gif"],
|
|
3945
4131
|
"image/svg+xml": [".svg"],
|
|
3946
4132
|
"application/pdf": [".pdf"]
|
|
3947
|
-
},
|
|
4133
|
+
}, ke = {
|
|
3948
4134
|
"image/png": "PNG",
|
|
3949
4135
|
"image/jpeg": "JPG",
|
|
3950
4136
|
"image/webp": "WEBP",
|
|
@@ -3958,7 +4144,7 @@ var z = class extends HTMLElement {
|
|
|
3958
4144
|
".gif": "GIF",
|
|
3959
4145
|
".svg": "SVG",
|
|
3960
4146
|
".pdf": "PDF"
|
|
3961
|
-
},
|
|
4147
|
+
}, X = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), Z = [
|
|
3962
4148
|
".png",
|
|
3963
4149
|
".jpg",
|
|
3964
4150
|
".jpeg",
|
|
@@ -3969,44 +4155,103 @@ var z = class extends HTMLElement {
|
|
|
3969
4155
|
".avif",
|
|
3970
4156
|
".heic"
|
|
3971
4157
|
];
|
|
3972
|
-
function
|
|
4158
|
+
function Ae(e) {
|
|
3973
4159
|
if (!e) return !1;
|
|
3974
4160
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
3975
4161
|
if (t) return t.startsWith("image/");
|
|
3976
4162
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
3977
|
-
return
|
|
4163
|
+
return Z.some((e) => r.endsWith(e));
|
|
3978
4164
|
}
|
|
3979
|
-
function
|
|
3980
|
-
let t =
|
|
3981
|
-
return t.length ? t.every((e) => e.startsWith(".") ?
|
|
4165
|
+
function je(e) {
|
|
4166
|
+
let t = X(e);
|
|
4167
|
+
return t.length ? t.every((e) => e.startsWith(".") ? Z.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
3982
4168
|
}
|
|
3983
|
-
function
|
|
4169
|
+
function Me(e) {
|
|
3984
4170
|
let t = [];
|
|
3985
|
-
for (let n of
|
|
3986
|
-
let e =
|
|
4171
|
+
for (let n of X(e)) {
|
|
4172
|
+
let e = ke[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
3987
4173
|
t.includes(e) || t.push(e);
|
|
3988
4174
|
}
|
|
3989
4175
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
3990
4176
|
}
|
|
3991
|
-
function
|
|
3992
|
-
let n =
|
|
4177
|
+
function Ne(e, t) {
|
|
4178
|
+
let n = X(t);
|
|
3993
4179
|
if (!n.length) return !0;
|
|
3994
4180
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
3995
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
4181
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (Oe[e] || []).some((e) => i.endsWith(e)));
|
|
3996
4182
|
}
|
|
3997
|
-
function
|
|
4183
|
+
function Pe(e, t = {}) {
|
|
3998
4184
|
if (!e) return null;
|
|
3999
|
-
let n = t.accept === void 0 ?
|
|
4000
|
-
return
|
|
4185
|
+
let n = t.accept === void 0 ? Ee : t.accept, r = t.maxSizeMb || 5;
|
|
4186
|
+
return Ne(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${Me(n)} file.`;
|
|
4187
|
+
}
|
|
4188
|
+
//#endregion
|
|
4189
|
+
//#region src/passwordRules.js
|
|
4190
|
+
var Q = {
|
|
4191
|
+
minLength: 8,
|
|
4192
|
+
uppercase: !0,
|
|
4193
|
+
lowercase: !0,
|
|
4194
|
+
digit: !0,
|
|
4195
|
+
special: !0,
|
|
4196
|
+
uniqueChars: 0
|
|
4197
|
+
}, Fe = "Password Requirements";
|
|
4198
|
+
function Ie(e) {
|
|
4199
|
+
return e === !0 || e == null ? { ...Q } : {
|
|
4200
|
+
...Q,
|
|
4201
|
+
...e
|
|
4202
|
+
};
|
|
4203
|
+
}
|
|
4204
|
+
function Le(e) {
|
|
4205
|
+
let t = Ie(e), n = [];
|
|
4206
|
+
if (t.minLength > 0 && n.push({
|
|
4207
|
+
key: "length",
|
|
4208
|
+
label: `At least ${t.minLength} characters long`,
|
|
4209
|
+
test: (e) => e.length >= t.minLength
|
|
4210
|
+
}), t.uppercase && n.push({
|
|
4211
|
+
key: "uppercase",
|
|
4212
|
+
label: "At least one uppercase letter",
|
|
4213
|
+
test: (e) => /[A-Z]/.test(e)
|
|
4214
|
+
}), t.lowercase && n.push({
|
|
4215
|
+
key: "lowercase",
|
|
4216
|
+
label: "At least one lowercase letter",
|
|
4217
|
+
test: (e) => /[a-z]/.test(e)
|
|
4218
|
+
}), t.digit && n.push({
|
|
4219
|
+
key: "digit",
|
|
4220
|
+
label: "At least one digit",
|
|
4221
|
+
test: (e) => /[0-9]/.test(e)
|
|
4222
|
+
}), t.special && n.push({
|
|
4223
|
+
key: "special",
|
|
4224
|
+
label: "At least one special character",
|
|
4225
|
+
test: (e) => /[^A-Za-z0-9]/.test(e)
|
|
4226
|
+
}), t.uniqueChars > 0) {
|
|
4227
|
+
let e = t.uniqueChars;
|
|
4228
|
+
n.push({
|
|
4229
|
+
key: "unique",
|
|
4230
|
+
label: `At least ${e} unique character${e > 1 ? "s" : ""}`,
|
|
4231
|
+
test: (t) => new Set(t).size >= e
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
return n;
|
|
4235
|
+
}
|
|
4236
|
+
function Re(e, t) {
|
|
4237
|
+
let n = e == null ? "" : String(e);
|
|
4238
|
+
return Le(t).map((e) => ({
|
|
4239
|
+
key: e.key,
|
|
4240
|
+
label: e.label,
|
|
4241
|
+
met: e.test(n)
|
|
4242
|
+
}));
|
|
4243
|
+
}
|
|
4244
|
+
function ze(e, t) {
|
|
4245
|
+
return Re(e, t).every((e) => e.met);
|
|
4001
4246
|
}
|
|
4002
4247
|
//#endregion
|
|
4003
4248
|
//#region src/index.js
|
|
4004
4249
|
var $ = (e, t) => {
|
|
4005
4250
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
4006
4251
|
};
|
|
4007
|
-
function
|
|
4008
|
-
$("wui-select",
|
|
4252
|
+
function Be() {
|
|
4253
|
+
$("wui-select", ge), $("wui-phone", V), $("wui-datepicker", ee), $("wui-date-range", te), $("wui-dock", ne), $("wui-feedback", j), $("wui-slider", _e), $("wui-timepicker", Se), $("wui-autocomplete", v), $("wui-multiselect", ce), $("wui-taginput", ye), $("wui-otp", fe), $("wui-status-icon", n), $("wui-wizard-step", Te), $("wui-wizard", we);
|
|
4009
4254
|
}
|
|
4010
|
-
|
|
4255
|
+
Be();
|
|
4011
4256
|
//#endregion
|
|
4012
|
-
export {
|
|
4257
|
+
export { Ee as DEFAULT_IMAGE_ACCEPT, De as DEFAULT_MAX_SIZE_MB, Q as DEFAULT_PASSWORD_RULES, Fe as DEFAULT_REQUIREMENTS_TITLE, t as STATUS_TONES, v as WuiAutocomplete, ee as WuiDatePicker, te as WuiDateRange, ne as WuiDock, j as WuiFeedback, ce as WuiMultiSelect, fe as WuiOtp, V as WuiPhone, ge as WuiSelect, _e as WuiSlider, n as WuiStatusIcon, ye as WuiTagInput, Se as WuiTimePicker, we as WuiWizard, Te as WuiWizardStep, Me as acceptLabel, Le as buildPasswordRules, Be as defineWeborityElements, Re as evaluatePassword, Ae as isImageFile, je as isImageOnlyAccept, Ne as matchesAccept, ze as passwordSatisfies, Pe as validateFile };
|