@webority/ui-elements 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui-elements.global.js +78 -66
- package/dist/ui-elements.js +376 -183
- package/package.json +1 -1
package/dist/ui-elements.js
CHANGED
|
@@ -866,7 +866,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
866
866
|
disconnectedCallback() {
|
|
867
867
|
this._teardown();
|
|
868
868
|
}
|
|
869
|
-
},
|
|
869
|
+
}, te = class extends e {
|
|
870
870
|
static formAssociated = !0;
|
|
871
871
|
static get observedAttributes() {
|
|
872
872
|
return [
|
|
@@ -1081,7 +1081,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1081
1081
|
disconnectedCallback() {
|
|
1082
1082
|
this._teardown();
|
|
1083
1083
|
}
|
|
1084
|
-
},
|
|
1084
|
+
}, ne = class extends e {
|
|
1085
1085
|
static get observedAttributes() {
|
|
1086
1086
|
return [
|
|
1087
1087
|
"static",
|
|
@@ -1102,10 +1102,10 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1102
1102
|
e === "static" && this.isConnected && this._wire();
|
|
1103
1103
|
}
|
|
1104
1104
|
_maxScale() {
|
|
1105
|
-
return
|
|
1105
|
+
return re(this.getAttribute("max-scale"), 1.6);
|
|
1106
1106
|
}
|
|
1107
1107
|
_radius() {
|
|
1108
|
-
return
|
|
1108
|
+
return re(this.getAttribute("radius"), 100);
|
|
1109
1109
|
}
|
|
1110
1110
|
_magnifyEnabled() {
|
|
1111
1111
|
return !(this.hasAttribute("static") || typeof matchMedia == "function" && (matchMedia("(pointer: coarse)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches));
|
|
@@ -1130,10 +1130,10 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1130
1130
|
_teardown() {
|
|
1131
1131
|
this._pointerMoveListener &&= (this.removeEventListener("pointermove", this._pointerMoveListener), null), this._pointerLeaveListener &&= (this.removeEventListener("pointerleave", this._pointerLeaveListener), null), this._resetMagnification();
|
|
1132
1132
|
}
|
|
1133
|
-
},
|
|
1133
|
+
}, re = (e, t) => {
|
|
1134
1134
|
let n = Number.parseFloat(e);
|
|
1135
1135
|
return Number.isFinite(n) ? n : t;
|
|
1136
|
-
},
|
|
1136
|
+
}, A = "wui-feedback-submit", j = {
|
|
1137
1137
|
label: "Feedback",
|
|
1138
1138
|
heading: "Share feedback",
|
|
1139
1139
|
placeholder: "What's working, what isn't?",
|
|
@@ -1144,7 +1144,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1144
1144
|
emptyError: "Please write a message before sending.",
|
|
1145
1145
|
failedError: "That didn't send. Please try again.",
|
|
1146
1146
|
thanks: "Thanks — we've got it."
|
|
1147
|
-
},
|
|
1147
|
+
}, ie = 1e4, ae = 1600, oe = class extends e {
|
|
1148
1148
|
static get observedAttributes() {
|
|
1149
1149
|
return [
|
|
1150
1150
|
"position",
|
|
@@ -1166,19 +1166,19 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1166
1166
|
this.setAttribute("position", String(e ?? "bottom-right"));
|
|
1167
1167
|
}
|
|
1168
1168
|
get label() {
|
|
1169
|
-
return this.getAttribute("label") ||
|
|
1169
|
+
return this.getAttribute("label") || j.label;
|
|
1170
1170
|
}
|
|
1171
1171
|
set label(e) {
|
|
1172
1172
|
this.setAttribute("label", String(e ?? ""));
|
|
1173
1173
|
}
|
|
1174
1174
|
get heading() {
|
|
1175
|
-
return this.getAttribute("heading") ||
|
|
1175
|
+
return this.getAttribute("heading") || j.heading;
|
|
1176
1176
|
}
|
|
1177
1177
|
set heading(e) {
|
|
1178
1178
|
this.setAttribute("heading", String(e ?? ""));
|
|
1179
1179
|
}
|
|
1180
1180
|
get placeholder() {
|
|
1181
|
-
return this.getAttribute("placeholder") ||
|
|
1181
|
+
return this.getAttribute("placeholder") || j.placeholder;
|
|
1182
1182
|
}
|
|
1183
1183
|
set placeholder(e) {
|
|
1184
1184
|
this.setAttribute("placeholder", String(e ?? ""));
|
|
@@ -1193,10 +1193,10 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1193
1193
|
return this._open === !0;
|
|
1194
1194
|
}
|
|
1195
1195
|
addEventListener(e, t, n) {
|
|
1196
|
-
e ===
|
|
1196
|
+
e === A && (this._submitListeners += 1), super.addEventListener(e, t, n);
|
|
1197
1197
|
}
|
|
1198
1198
|
removeEventListener(e, t, n) {
|
|
1199
|
-
e ===
|
|
1199
|
+
e === A && this._submitListeners > 0 && --this._submitListeners, super.removeEventListener(e, t, n);
|
|
1200
1200
|
}
|
|
1201
1201
|
connectedCallback() {
|
|
1202
1202
|
this._rendered || this.render();
|
|
@@ -1212,31 +1212,31 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1212
1212
|
this.innerHTML = `
|
|
1213
1213
|
<button type="button" class="feedback-trigger" aria-expanded="false" aria-haspopup="dialog">
|
|
1214
1214
|
<span class="feedback-trigger-icon" aria-hidden="true">${p("message-square", { size: 18 })}</span>
|
|
1215
|
-
<span class="feedback-trigger-label">${
|
|
1215
|
+
<span class="feedback-trigger-label">${se(this.label)}</span>
|
|
1216
1216
|
</button>
|
|
1217
|
-
<div class="feedback-panel" role="dialog" aria-label="${
|
|
1217
|
+
<div class="feedback-panel" role="dialog" aria-label="${ce(this.heading)}" hidden>
|
|
1218
1218
|
<div class="feedback-head">
|
|
1219
|
-
<h2 class="feedback-heading">${
|
|
1219
|
+
<h2 class="feedback-heading">${se(this.heading)}</h2>
|
|
1220
1220
|
<button type="button" class="feedback-close" aria-label="Close">${p("x", { size: 16 })}</button>
|
|
1221
1221
|
</div>
|
|
1222
1222
|
<div class="feedback-body">
|
|
1223
1223
|
<label class="feedback-field">
|
|
1224
|
-
<span class="feedback-field-label">${
|
|
1225
|
-
<textarea class="feedback-message" rows="4" required placeholder="${
|
|
1224
|
+
<span class="feedback-field-label">${j.messageLabel}</span>
|
|
1225
|
+
<textarea class="feedback-message" rows="4" required placeholder="${ce(this.placeholder)}"></textarea>
|
|
1226
1226
|
</label>
|
|
1227
1227
|
${this.collectEmail ? `<label class="feedback-field">
|
|
1228
|
-
<span class="feedback-field-label">${
|
|
1228
|
+
<span class="feedback-field-label">${j.emailLabel}</span>
|
|
1229
1229
|
<input type="email" class="feedback-email" autocomplete="email" placeholder="you@example.com" />
|
|
1230
1230
|
</label>` : ""}
|
|
1231
1231
|
<p class="feedback-error" role="alert" hidden></p>
|
|
1232
1232
|
</div>
|
|
1233
1233
|
<div class="feedback-actions">
|
|
1234
1234
|
<button type="button" class="feedback-cancel">Cancel</button>
|
|
1235
|
-
<button type="button" class="feedback-submit">${
|
|
1235
|
+
<button type="button" class="feedback-submit">${j.submitLabel}</button>
|
|
1236
1236
|
</div>
|
|
1237
1237
|
<div class="feedback-thanks" hidden>
|
|
1238
1238
|
<span class="feedback-thanks-icon" aria-hidden="true">${p("check-circle", { size: 20 })}</span>
|
|
1239
|
-
<span class="feedback-thanks-text">${
|
|
1239
|
+
<span class="feedback-thanks-text">${j.thanks}</span>
|
|
1240
1240
|
</div>
|
|
1241
1241
|
</div>`, this._rendered = !0, this._wire();
|
|
1242
1242
|
let r = this._refs();
|
|
@@ -1274,18 +1274,18 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1274
1274
|
let { thanks: e, error: t, submit: n, message: r, email: i } = this._refs();
|
|
1275
1275
|
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(() => {
|
|
1276
1276
|
r && (r.value = ""), i && (i.value = ""), this._reset(), this.close();
|
|
1277
|
-
},
|
|
1277
|
+
}, ae);
|
|
1278
1278
|
}
|
|
1279
1279
|
failed(e) {
|
|
1280
1280
|
this._clearTimers(), this._state = "error", this._setBusy(!1);
|
|
1281
1281
|
let { error: t, message: n } = this._refs();
|
|
1282
|
-
t && (t.textContent = e ||
|
|
1282
|
+
t && (t.textContent = e || j.failedError, t.hidden = !1), n?.focus();
|
|
1283
1283
|
}
|
|
1284
1284
|
_submit() {
|
|
1285
1285
|
if (this._state === "submitting") return;
|
|
1286
1286
|
let { message: e, email: t, error: n } = this._refs(), r = (e?.value ?? "").trim();
|
|
1287
1287
|
if (!r) {
|
|
1288
|
-
n && (n.textContent =
|
|
1288
|
+
n && (n.textContent = j.emptyError, n.hidden = !1), e?.focus();
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
1291
|
n && (n.hidden = !0, n.textContent = ""), this._state = "submitting", this._setBusy(!0);
|
|
@@ -1295,7 +1295,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1295
1295
|
surface: this.getAttribute("surface") || "",
|
|
1296
1296
|
screen: this.getAttribute("screen") || ""
|
|
1297
1297
|
};
|
|
1298
|
-
if (this.dispatchEvent(new CustomEvent(
|
|
1298
|
+
if (this.dispatchEvent(new CustomEvent(A, {
|
|
1299
1299
|
bubbles: !0,
|
|
1300
1300
|
composed: !0,
|
|
1301
1301
|
detail: i
|
|
@@ -1305,11 +1305,11 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1305
1305
|
}
|
|
1306
1306
|
this._timer = setTimeout(() => {
|
|
1307
1307
|
this._state === "submitting" && this.failed();
|
|
1308
|
-
},
|
|
1308
|
+
}, ie);
|
|
1309
1309
|
}
|
|
1310
1310
|
_setBusy(e) {
|
|
1311
1311
|
let { submit: t } = this._refs();
|
|
1312
|
-
t && (t.disabled = e, t.textContent = e ?
|
|
1312
|
+
t && (t.disabled = e, t.textContent = e ? j.sendingLabel : j.submitLabel, this.toggleAttribute("busy", e));
|
|
1313
1313
|
}
|
|
1314
1314
|
_reset() {
|
|
1315
1315
|
this._clearTimers(), this._state = "idle", this._setBusy(!1);
|
|
@@ -1319,7 +1319,23 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1319
1319
|
_clearTimers() {
|
|
1320
1320
|
this._timer &&= (clearTimeout(this._timer), 0), this._thanksTimer &&= (clearTimeout(this._thanksTimer), 0);
|
|
1321
1321
|
}
|
|
1322
|
-
},
|
|
1322
|
+
}, se = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), ce = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), le = {
|
|
1323
|
+
enter: "Enter",
|
|
1324
|
+
comma: ",",
|
|
1325
|
+
space: " ",
|
|
1326
|
+
tab: "Tab"
|
|
1327
|
+
}, ue = {
|
|
1328
|
+
enter: "\n",
|
|
1329
|
+
comma: ",",
|
|
1330
|
+
space: " ",
|
|
1331
|
+
tab: " "
|
|
1332
|
+
}, de = (e) => le[e], fe = (e) => ue[e];
|
|
1333
|
+
function pe(e, t) {
|
|
1334
|
+
let n = [String(e ?? "")];
|
|
1335
|
+
for (let e of t) n = n.flatMap((t) => t.split(e));
|
|
1336
|
+
return n.map((e) => e.trim()).filter(Boolean);
|
|
1337
|
+
}
|
|
1338
|
+
var M = (e, t) => t.some((t) => String(e ?? "").includes(t)), me = class extends e {
|
|
1323
1339
|
static formAssociated = !0;
|
|
1324
1340
|
_accessibleName() {
|
|
1325
1341
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Select";
|
|
@@ -1334,11 +1350,14 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1334
1350
|
"size",
|
|
1335
1351
|
"collapse-chips",
|
|
1336
1352
|
"aria-label",
|
|
1337
|
-
"aria-invalid"
|
|
1353
|
+
"aria-invalid",
|
|
1354
|
+
"allow-custom",
|
|
1355
|
+
"custom-pattern",
|
|
1356
|
+
"custom-invalid-message"
|
|
1338
1357
|
];
|
|
1339
1358
|
}
|
|
1340
1359
|
constructor() {
|
|
1341
|
-
super(), this._values = [], this._optionsProp = null, this._active = -1, this._typeahead = "", this._typeaheadTimer = null;
|
|
1360
|
+
super(), this._values = [], this._optionsProp = null, this._active = -1, this._typeahead = "", this._typeaheadTimer = null, this._customError = "";
|
|
1342
1361
|
try {
|
|
1343
1362
|
this._internals = this.attachInternals();
|
|
1344
1363
|
} catch {
|
|
@@ -1362,44 +1381,66 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1362
1381
|
}
|
|
1363
1382
|
formResetCallback() {
|
|
1364
1383
|
this.values = (this._defaultValues || []).slice();
|
|
1384
|
+
let e = this.querySelector("[data-input]");
|
|
1385
|
+
e && (e.value = ""), this._setCustomError("");
|
|
1365
1386
|
}
|
|
1366
1387
|
attributeChangedCallback(e) {
|
|
1367
1388
|
if (e === "aria-invalid") {
|
|
1368
1389
|
this._syncInvalid();
|
|
1369
1390
|
return;
|
|
1370
1391
|
}
|
|
1371
|
-
this._rendered && this.render();
|
|
1392
|
+
e === "custom-pattern" || e === "custom-invalid-message" || this._rendered && this.render();
|
|
1372
1393
|
}
|
|
1373
1394
|
_syncInvalid() {
|
|
1374
1395
|
let e = this.querySelector(".search-select-control");
|
|
1375
|
-
e && (this.hasAttribute("aria-invalid") ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
|
|
1396
|
+
e && (this.hasAttribute("aria-invalid") || this._customError ? e.setAttribute("aria-invalid", "true") : e.removeAttribute("aria-invalid"));
|
|
1376
1397
|
}
|
|
1377
1398
|
get values() {
|
|
1378
1399
|
return this._values.slice();
|
|
1379
1400
|
}
|
|
1380
1401
|
set values(e) {
|
|
1381
|
-
|
|
1382
|
-
this._renderControl();
|
|
1383
|
-
let e = this.querySelector(".search-select-input");
|
|
1384
|
-
this._renderOptions(e ? e.value : "");
|
|
1385
|
-
}
|
|
1402
|
+
this._values = Array.isArray(e) ? e.map(String) : [], d(this, this._values.join(",")), this._rendered && (this._renderControl(), this._renderOptions(this._query()));
|
|
1386
1403
|
}
|
|
1387
1404
|
set options(e) {
|
|
1388
|
-
this._optionsProp = Array.isArray(e) ? e : null, this.
|
|
1405
|
+
if (this._optionsProp = Array.isArray(e) ? e : null, this._rendered && this._allowCustom) {
|
|
1406
|
+
this._renderControl(), this._renderOptions(this._query());
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
this.isConnected && this.render();
|
|
1389
1410
|
}
|
|
1390
1411
|
get options() {
|
|
1391
1412
|
return this._readOptions();
|
|
1392
1413
|
}
|
|
1414
|
+
get validateCustom() {
|
|
1415
|
+
return this._validateCustom ?? null;
|
|
1416
|
+
}
|
|
1417
|
+
set validateCustom(e) {
|
|
1418
|
+
this._validateCustom = typeof e == "function" ? e : null;
|
|
1419
|
+
}
|
|
1420
|
+
get _allowCustom() {
|
|
1421
|
+
return this.hasAttribute("allow-custom");
|
|
1422
|
+
}
|
|
1423
|
+
_query() {
|
|
1424
|
+
let e = this.querySelector(this._allowCustom ? "[data-input]" : ".search-select-input");
|
|
1425
|
+
return e ? e.value : "";
|
|
1426
|
+
}
|
|
1393
1427
|
_snapshotDeclared() {
|
|
1394
1428
|
if (this._declared) return;
|
|
1395
1429
|
let e = [...this.querySelectorAll(":scope > wui-option")];
|
|
1396
|
-
e.length && (this._declared = e.map((e) =>
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1430
|
+
e.length && (this._declared = e.map((e) => {
|
|
1431
|
+
let t = {
|
|
1432
|
+
value: e.getAttribute("value") ?? e.textContent.trim(),
|
|
1433
|
+
label: e.innerHTML,
|
|
1434
|
+
icon: e.getAttribute("icon") || void 0,
|
|
1435
|
+
[h]: !0,
|
|
1436
|
+
selected: e.hasAttribute("selected")
|
|
1437
|
+
};
|
|
1438
|
+
for (let [n, r] of he) {
|
|
1439
|
+
let i = e.getAttribute(n);
|
|
1440
|
+
i && (t[r] = i);
|
|
1441
|
+
}
|
|
1442
|
+
return e.hasAttribute("disabled") && (t.disabled = !0), t;
|
|
1443
|
+
}));
|
|
1403
1444
|
}
|
|
1404
1445
|
_readOptions() {
|
|
1405
1446
|
return this._optionsProp ? this._optionsProp : (this._snapshotDeclared(), this._declared || []);
|
|
@@ -1414,32 +1455,54 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1414
1455
|
}
|
|
1415
1456
|
render() {
|
|
1416
1457
|
this._snapshotDeclared();
|
|
1417
|
-
let e = this.hasAttribute("searchable"),
|
|
1458
|
+
let e = this._allowCustom, t = this.hasAttribute("searchable") && !e, n = this.getAttribute("search-placeholder") || "Search…", r = this.getAttribute("icon"), i = this.getAttribute("size"), a = i === "sm" ? " search-select-sm" : i === "lg" ? " search-select-lg" : "";
|
|
1418
1459
|
d(this, this._values.join(",")), this.id ||= `wui-multiselect-${Math.random().toString(36).slice(2, 9)}`;
|
|
1419
|
-
let
|
|
1420
|
-
this._listboxId =
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1460
|
+
let o = `${this.id}-listbox`;
|
|
1461
|
+
this._listboxId = o;
|
|
1462
|
+
let s = this.hasAttribute("disabled");
|
|
1463
|
+
if (e) {
|
|
1464
|
+
let e = `${this.id}-custom-error`;
|
|
1465
|
+
this.innerHTML = `
|
|
1466
|
+
<div class="search-select${a}">
|
|
1467
|
+
<div class="input search-select-control search-select-multi"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : ""}>
|
|
1468
|
+
${r ? p(r, { className: "search-select-icon" }) : ""}
|
|
1469
|
+
<div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${F(o)}" aria-label="${F(this._accessibleName())}" aria-describedby="${F(e)}" autocomplete="off"${s ? " disabled" : ""} /></div>
|
|
1470
|
+
${p("chevron-down", { className: "search-select-caret" })}
|
|
1471
|
+
</div>
|
|
1472
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${F(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1473
|
+
<div class="search-select-options"></div>
|
|
1474
|
+
</div>
|
|
1475
|
+
</div>
|
|
1476
|
+
<div class="field-error wui-ms-custom-error" id="${F(e)}" aria-live="polite" hidden></div>`;
|
|
1477
|
+
} else this.innerHTML = `
|
|
1478
|
+
<div class="search-select${a}">
|
|
1479
|
+
<div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${F(o)}" aria-label="${F(this._accessibleName())}"${this.hasAttribute("aria-invalid") ? " aria-invalid=\"true\"" : ""}${s ? " aria-disabled=\"true\"" : " tabindex=\"0\""}>
|
|
1480
|
+
${r ? p(r, { className: "search-select-icon" }) : ""}
|
|
1424
1481
|
<div class="ms-chips" data-chips></div>
|
|
1425
1482
|
${p("chevron-down", { className: "search-select-caret" })}
|
|
1426
1483
|
</div>
|
|
1427
|
-
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${
|
|
1428
|
-
${
|
|
1484
|
+
<div class="search-select-menu search-select-menu-fixed" role="listbox" id="${F(o)}" aria-multiselectable="true" tabindex="-1" hidden>
|
|
1485
|
+
${t ? `<div class="search-select-search">${p("search")}<input class="search-select-input" placeholder="${F(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${p("x")}</button></div>` : ""}
|
|
1429
1486
|
<div class="search-select-options"></div>
|
|
1430
1487
|
<div class="search-select-empty" hidden>No matches</div>
|
|
1431
1488
|
</div>
|
|
1432
|
-
</div
|
|
1489
|
+
</div>`;
|
|
1490
|
+
this._rendered = !0, this._customError = "", d(this, this._values.join(",")), this._renderControl(), this._renderOptions(), this._wire();
|
|
1433
1491
|
}
|
|
1434
1492
|
_renderControl() {
|
|
1435
1493
|
let e = this.querySelector("[data-chips]");
|
|
1436
1494
|
if (!e) return;
|
|
1437
|
-
let t = this.getAttribute("placeholder") || "Select…";
|
|
1495
|
+
let t = this.getAttribute("placeholder") || "Select…", n = this._allowCustom ? e.querySelector("[data-input]") : null, r = 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="${F(e)}" aria-label="Remove ${F(I(this._labelFor(e)))}">${p("x")}</button></span>`).join("");
|
|
1496
|
+
if (n) {
|
|
1497
|
+
for (let t of [...e.querySelectorAll(":scope > .chip")]) t.remove();
|
|
1498
|
+
n.insertAdjacentHTML("beforebegin", r), n.placeholder = this._values.length ? "" : t, this._collapseChips();
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1438
1501
|
if (!this._values.length) {
|
|
1439
1502
|
e.innerHTML = `<span class="search-select-placeholder">${g(t)}</span>`;
|
|
1440
1503
|
return;
|
|
1441
1504
|
}
|
|
1442
|
-
e.innerHTML =
|
|
1505
|
+
e.innerHTML = r, this._collapseChips();
|
|
1443
1506
|
}
|
|
1444
1507
|
_collapseChips() {
|
|
1445
1508
|
let e = this.querySelector("[data-chips]");
|
|
@@ -1451,7 +1514,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1451
1514
|
let n = e.clientWidth, r = (e) => e.offsetLeft + e.offsetWidth;
|
|
1452
1515
|
if (r(t[t.length - 1]) <= n) return;
|
|
1453
1516
|
let i = document.createElement("span");
|
|
1454
|
-
i.className = "chip chip-sm chip-more", i.textContent = `+${t.length}`,
|
|
1517
|
+
i.className = "chip chip-sm chip-more", i.textContent = `+${t.length}`, t[t.length - 1].after(i);
|
|
1455
1518
|
let a = i.offsetWidth + 6, o = 0;
|
|
1456
1519
|
for (let e of t) if (r(e) <= n - a) o += 1;
|
|
1457
1520
|
else break;
|
|
@@ -1459,85 +1522,189 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1459
1522
|
for (let e = o; e < t.length; e += 1) t[e].style.display = "none";
|
|
1460
1523
|
i.textContent = `+${t.length - o}`;
|
|
1461
1524
|
}
|
|
1525
|
+
_matches(e, t) {
|
|
1526
|
+
return I(e.label).toLowerCase().includes(t) || String(e.description ?? "").toLowerCase().includes(t);
|
|
1527
|
+
}
|
|
1528
|
+
_optionNamed(e) {
|
|
1529
|
+
let t = e.trim().toLowerCase();
|
|
1530
|
+
return this._readOptions().find((e) => String(e.value ?? "").toLowerCase() === t || I(e.label).trim().toLowerCase() === t);
|
|
1531
|
+
}
|
|
1462
1532
|
_renderOptions(e) {
|
|
1463
1533
|
let t = this.querySelector(".search-select-options"), n = this.querySelector(".search-select-empty");
|
|
1464
1534
|
if (!t) return;
|
|
1465
|
-
let r = (e || "").trim().toLowerCase(),
|
|
1466
|
-
|
|
1467
|
-
let
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
}).join(""), n && (n.hidden =
|
|
1535
|
+
let r = (e || "").trim(), i = r.toLowerCase(), a = this._readOptions();
|
|
1536
|
+
i && (a = a.filter((e) => this._matches(e, i)));
|
|
1537
|
+
let o = this._listboxId || `${this.id || "wui-multiselect"}-listbox`, s = this._allowCustom && r && !this._optionNamed(r), c = a.map((e, t) => {
|
|
1538
|
+
let n = this._values.includes(String(e.value)), r = `${o}-opt-${t}`;
|
|
1539
|
+
return ge(e) ? ye(e, r, n) : `<button type="button" role="option" id="${F(r)}" class="search-select-option${n ? " selected" : ""}" data-value="${F(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${v(e)}</span><span class="ms-check">${p("check")}</span></button>`;
|
|
1540
|
+
});
|
|
1541
|
+
s && c.push(`<button type="button" role="option" id="${F(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${F(r)}" data-custom="true" aria-selected="false">Add “${g(r)}”</button>`), t.innerHTML = c.join(""), n && (n.hidden = a.length > 0), this._active = -1, this._combobox()?.removeAttribute("aria-activedescendant"), this._allowCustom && this._syncCustomMenu?.(), this._reanchor?.();
|
|
1542
|
+
}
|
|
1543
|
+
_combobox() {
|
|
1544
|
+
return this._allowCustom ? this.querySelector("[data-input]") : this.querySelector(".search-select-control");
|
|
1545
|
+
}
|
|
1546
|
+
_setCustomError(e) {
|
|
1547
|
+
this._customError = e || "";
|
|
1548
|
+
let t = this.querySelector(".wui-ms-custom-error"), n = this.querySelector("[data-input]");
|
|
1549
|
+
t && (t.textContent = this._customError, t.hidden = !this._customError), n && (this._customError ? n.setAttribute("aria-invalid", "true") : n.removeAttribute("aria-invalid")), this._syncInvalid();
|
|
1550
|
+
}
|
|
1551
|
+
_customRefusal(e) {
|
|
1552
|
+
let t = this.getAttribute("custom-invalid-message") || "Enter a valid value.", n = this.getAttribute("custom-pattern");
|
|
1553
|
+
if (n) {
|
|
1554
|
+
let r = be(n);
|
|
1555
|
+
if (r && !r.test(e)) return t;
|
|
1556
|
+
}
|
|
1557
|
+
let r = this._validateCustom;
|
|
1558
|
+
if (r) {
|
|
1559
|
+
let n = r(e);
|
|
1560
|
+
return n === !0 ? "" : typeof n == "string" && n ? n : t;
|
|
1561
|
+
}
|
|
1562
|
+
return "";
|
|
1563
|
+
}
|
|
1564
|
+
_commitTyped(e) {
|
|
1565
|
+
let t = e.trim().replace(/,+$/, "").trim();
|
|
1566
|
+
if (!t) return "";
|
|
1567
|
+
let n = this._optionNamed(t), r;
|
|
1568
|
+
if (n) {
|
|
1569
|
+
if (n.disabled) return n.disabledHint || this.getAttribute("custom-invalid-message") || "That option is not available.";
|
|
1570
|
+
r = String(n.value);
|
|
1571
|
+
} else {
|
|
1572
|
+
let e = this._customRefusal(t);
|
|
1573
|
+
if (e) return e;
|
|
1574
|
+
r = t;
|
|
1575
|
+
}
|
|
1576
|
+
let i = r.toLowerCase();
|
|
1577
|
+
return this._values.some((e) => e.toLowerCase() === i) || (this._values = [...this._values, r]), "";
|
|
1472
1578
|
}
|
|
1473
1579
|
_wire() {
|
|
1474
1580
|
this._teardown();
|
|
1475
|
-
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");
|
|
1581
|
+
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"), a = this._allowCustom, o = a ? this.querySelector("[data-input]") : null, l = o || e;
|
|
1476
1582
|
if (!e || !t) return;
|
|
1477
|
-
let
|
|
1478
|
-
let
|
|
1479
|
-
this._active =
|
|
1480
|
-
for (let e of
|
|
1481
|
-
|
|
1482
|
-
},
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1583
|
+
let u = () => this.hasAttribute("disabled"), f = () => s(e, t, { matchWidth: !0 }), p = () => [...this.querySelectorAll(".search-select-option")], h = () => p().filter((e) => !e.hidden), g = (e) => {
|
|
1584
|
+
let t = h();
|
|
1585
|
+
this._active = e;
|
|
1586
|
+
for (let e of p()) e.classList.remove("is-active");
|
|
1587
|
+
e >= 0 && t[e] ? (t[e].classList.add("is-active"), t[e].scrollIntoView({ block: "nearest" }), l.setAttribute("aria-activedescendant", t[e].id)) : l.removeAttribute("aria-activedescendant");
|
|
1588
|
+
}, _ = !1, v = () => a ? _ : !t.hidden, y = () => {
|
|
1589
|
+
let n = _ && p().length > 0, r = t.hidden;
|
|
1590
|
+
t.hidden = !n, l.setAttribute("aria-expanded", String(n)), e.classList.toggle("open", n), n && r && f();
|
|
1591
|
+
};
|
|
1592
|
+
this._syncCustomMenu = a ? y : null;
|
|
1593
|
+
let b = () => {
|
|
1594
|
+
if (!u()) {
|
|
1595
|
+
if (a) {
|
|
1596
|
+
_ = !0, y();
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
t.hidden = !1, e.setAttribute("aria-expanded", "true"), e.classList.add("open"), f(), n && (n.value = "", this._renderOptions(""), n.focus());
|
|
1600
|
+
}
|
|
1601
|
+
}, x = () => {
|
|
1602
|
+
a ? (_ = !1, y()) : (t.hidden = !0, e.setAttribute("aria-expanded", "false"), e.classList.remove("open")), g(-1), clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null, this._typeahead = "";
|
|
1603
|
+
}, S = () => {
|
|
1487
1604
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1488
|
-
},
|
|
1605
|
+
}, C = (e) => {
|
|
1489
1606
|
let t = String(e);
|
|
1490
|
-
this._values.includes(t)
|
|
1491
|
-
|
|
1492
|
-
this._values = this._values
|
|
1607
|
+
if (this._values.includes(t)) this._values = this._values.filter((e) => e !== t);
|
|
1608
|
+
else if (a && this._values.some((e) => e.toLowerCase() === t.toLowerCase())) return;
|
|
1609
|
+
else this._values = [...this._values, t];
|
|
1610
|
+
this._renderControl(), this._renderOptions(this._query()), S();
|
|
1611
|
+
}, w = (e) => {
|
|
1612
|
+
this._values = this._values.filter((t) => t !== String(e)), this._renderControl(), this._renderOptions(this._query()), S();
|
|
1613
|
+
}, T = (e, { quiet: t = !1 } = {}) => {
|
|
1614
|
+
let n = this._values.length, r = M(e, N) ? pe(e, N) : [e], i = [], a = "";
|
|
1615
|
+
for (let e of r) {
|
|
1616
|
+
let t = this._commitTyped(e);
|
|
1617
|
+
t && (i.push(e.trim()), a ||= t);
|
|
1618
|
+
}
|
|
1619
|
+
t && i.length || (o.value = i.join(", "), this._setCustomError(a), this._values.length !== n && (this._renderControl(), S()), this._renderOptions(o.value));
|
|
1620
|
+
}, E = (e) => {
|
|
1621
|
+
if (!(!e || e.getAttribute("aria-disabled") === "true")) {
|
|
1622
|
+
if (e.dataset.custom === "true") {
|
|
1623
|
+
T(e.dataset.value);
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
C(e.dataset.value), o?.value && (o.value = "", this._setCustomError(""), this._renderOptions(""));
|
|
1627
|
+
}
|
|
1493
1628
|
};
|
|
1494
1629
|
e.addEventListener("click", (e) => {
|
|
1495
|
-
if (
|
|
1630
|
+
if (u()) return;
|
|
1496
1631
|
let t = e.target.closest("[data-remove]");
|
|
1497
1632
|
if (t) {
|
|
1498
|
-
e.stopPropagation(),
|
|
1633
|
+
e.stopPropagation(), w(t.dataset.remove), o?.focus();
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
if (o) {
|
|
1637
|
+
let t = v();
|
|
1638
|
+
e.target !== o && o.focus(), e.target === o || !t ? b() : x();
|
|
1499
1639
|
return;
|
|
1500
1640
|
}
|
|
1501
|
-
|
|
1641
|
+
v() ? x() : b();
|
|
1502
1642
|
}), i.addEventListener("click", (e) => {
|
|
1503
1643
|
let t = e.target.closest(".search-select-option");
|
|
1504
|
-
t && (
|
|
1644
|
+
t && (E(t), (o || n)?.focus());
|
|
1505
1645
|
}), i.addEventListener("mousemove", (e) => {
|
|
1506
1646
|
let t = e.target.closest(".search-select-option");
|
|
1507
|
-
t &&
|
|
1508
|
-
}), i.addEventListener("mouseleave", () =>
|
|
1509
|
-
|
|
1647
|
+
t && g(h().indexOf(t));
|
|
1648
|
+
}), i.addEventListener("mouseleave", () => g(-1)), i.addEventListener("error", (e) => {
|
|
1649
|
+
e.target?.classList?.contains("avatar-img") && e.target.remove();
|
|
1650
|
+
}, !0), n?.addEventListener("input", () => {
|
|
1651
|
+
this._renderOptions(n.value), r && (r.hidden = !n.value), g(-1);
|
|
1510
1652
|
}), this._navHandler = m({
|
|
1511
|
-
getVisibleOptions:
|
|
1653
|
+
getVisibleOptions: h,
|
|
1512
1654
|
getActive: () => this._active,
|
|
1513
|
-
setActive: (e) =>
|
|
1655
|
+
setActive: (e) => g(e),
|
|
1514
1656
|
onEnter: (e) => {
|
|
1515
|
-
e
|
|
1657
|
+
e ? E(e) : o?.value.trim() && T(o.value);
|
|
1516
1658
|
},
|
|
1517
1659
|
onEscape: () => {
|
|
1518
|
-
this._navHandler.clearTypeahead(),
|
|
1660
|
+
this._navHandler.clearTypeahead(), x(), o || e.focus();
|
|
1519
1661
|
}
|
|
1520
1662
|
});
|
|
1521
|
-
let
|
|
1522
|
-
|
|
1523
|
-
|
|
1663
|
+
let D = (e) => {
|
|
1664
|
+
let t = o || n;
|
|
1665
|
+
if (e.key === "Backspace" && !t?.value && this._values.length) {
|
|
1666
|
+
w(this._values[this._values.length - 1]);
|
|
1524
1667
|
return;
|
|
1525
1668
|
}
|
|
1526
1669
|
this._navHandler.handler(e);
|
|
1527
1670
|
};
|
|
1528
|
-
n?.addEventListener("keydown",
|
|
1671
|
+
if (n?.addEventListener("keydown", D), r?.addEventListener("click", () => {
|
|
1529
1672
|
n.value = "", this._renderOptions(""), r.hidden = !0, n.focus();
|
|
1530
|
-
}),
|
|
1531
|
-
|
|
1532
|
-
|
|
1673
|
+
}), o) {
|
|
1674
|
+
let t = (e) => {
|
|
1675
|
+
e.target !== o && e.preventDefault();
|
|
1676
|
+
};
|
|
1677
|
+
i.addEventListener("mousedown", t), e.addEventListener("mousedown", t), o.addEventListener("focus", () => b()), o.addEventListener("input", () => {
|
|
1678
|
+
this._customError && this._setCustomError(""), this._renderOptions(o.value), b();
|
|
1679
|
+
}), o.addEventListener("keydown", (e) => {
|
|
1680
|
+
if (e.key === "," && o.value.trim()) {
|
|
1681
|
+
e.preventDefault(), T(o.value);
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
if (e.key === "Enter") {
|
|
1685
|
+
if (this._active < 0 && !o.value.trim()) return;
|
|
1686
|
+
this._navHandler.handler(e);
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && !v() && b(), D(e);
|
|
1690
|
+
}), o.addEventListener("paste", (e) => {
|
|
1691
|
+
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1692
|
+
M(t, N) && (e.preventDefault(), T(`${o.value}${t}`));
|
|
1693
|
+
}), o.addEventListener("blur", (e) => {
|
|
1694
|
+
e.relatedTarget && this.contains(e.relatedTarget) || (o.value.trim() && T(o.value, { quiet: !0 }), x());
|
|
1695
|
+
});
|
|
1696
|
+
} else e.addEventListener("keydown", (e) => {
|
|
1697
|
+
if (v()) {
|
|
1698
|
+
D(e);
|
|
1533
1699
|
return;
|
|
1534
1700
|
}
|
|
1535
|
-
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1536
|
-
})
|
|
1701
|
+
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
1702
|
+
});
|
|
1703
|
+
this._bindGlobal = () => {
|
|
1537
1704
|
this._teardown(), !this._ro && typeof ResizeObserver < "u" && (this._ro = new ResizeObserver(() => this._collapseChips()), this._ro.observe(this)), this._onDocClick = (e) => {
|
|
1538
|
-
|
|
1705
|
+
v() && !this.contains(e.target) && x();
|
|
1539
1706
|
}, document.addEventListener("click", this._onDocClick), c(this, () => {
|
|
1540
|
-
|
|
1707
|
+
v() && f();
|
|
1541
1708
|
});
|
|
1542
1709
|
}, this._bindGlobal();
|
|
1543
1710
|
}
|
|
@@ -1547,7 +1714,35 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1547
1714
|
disconnectedCallback() {
|
|
1548
1715
|
this._teardown(), this._ro?.disconnect(), this._ro = null;
|
|
1549
1716
|
}
|
|
1550
|
-
},
|
|
1717
|
+
}, N = [
|
|
1718
|
+
",",
|
|
1719
|
+
";",
|
|
1720
|
+
"\n",
|
|
1721
|
+
" "
|
|
1722
|
+
], he = [
|
|
1723
|
+
["description", "description"],
|
|
1724
|
+
["avatar", "avatar"],
|
|
1725
|
+
["initials", "initials"],
|
|
1726
|
+
["disabled-hint", "disabledHint"]
|
|
1727
|
+
], ge = (e) => !!(e.description || e.avatar || e.initials || e.disabled || e.disabledHint), _e = (e) => {
|
|
1728
|
+
let t = String(e ?? "").trim();
|
|
1729
|
+
return /^(https?:)?\/\//i.test(t) || /^\/(?!\/)/.test(t) || /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t) ? t : "";
|
|
1730
|
+
}, ve = (e) => {
|
|
1731
|
+
let t = _e(e.avatar);
|
|
1732
|
+
return !t && !e.initials ? "" : `<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${g(e.initials ?? "")}</span>${t ? `<img class="avatar-img" src="${F(t)}" alt="" />` : ""}</span>`;
|
|
1733
|
+
}, ye = (e, t, n) => {
|
|
1734
|
+
let r = !!e.disabled, i = e.description ? `<span class="wui-opt-desc">${g(e.description)}</span>` : "", a = e.disabledHint && r ? `<span class="wui-opt-hint">${g(e.disabledHint)}</span>` : "";
|
|
1735
|
+
return `<button type="button" role="option" id="${F(t)}" class="search-select-option wui-opt-rich${n ? " selected" : ""}" data-value="${F(e.value)}" aria-selected="${n}"${r ? " aria-disabled=\"true\"" : ""}><span class="ms-opt-label"><span class="wui-opt-name">${v(e)}</span>${i}</span>${a}${ve(e)}<span class="ms-check">${p("check")}</span></button>`;
|
|
1736
|
+
}, P = /* @__PURE__ */ new Map(), be = (e) => {
|
|
1737
|
+
if (P.has(e)) return P.get(e);
|
|
1738
|
+
let t = null;
|
|
1739
|
+
try {
|
|
1740
|
+
t = RegExp(`^(?:${e})$`, "u");
|
|
1741
|
+
} catch {
|
|
1742
|
+
console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`);
|
|
1743
|
+
}
|
|
1744
|
+
return P.set(e, t), t;
|
|
1745
|
+
}, F = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), I = (e) => String(e ?? "").replace(/<[^>]*>/g, ""), xe = /[^0-9]/g, Se = /[^0-9a-zA-Z]/g, Ce = class extends e {
|
|
1551
1746
|
static formAssociated = !0;
|
|
1552
1747
|
static get observedAttributes() {
|
|
1553
1748
|
return [
|
|
@@ -1578,7 +1773,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1578
1773
|
this._value = this._clean(e), d(this, this._value), this._paint();
|
|
1579
1774
|
}
|
|
1580
1775
|
_clean(e) {
|
|
1581
|
-
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ?
|
|
1776
|
+
return (e == null ? "" : String(e)).replace(this.mode === "alphanumeric" ? Se : xe, "").slice(0, this.length);
|
|
1582
1777
|
}
|
|
1583
1778
|
constructor() {
|
|
1584
1779
|
super();
|
|
@@ -1669,7 +1864,7 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
1669
1864
|
disconnectedCallback() {
|
|
1670
1865
|
this._onSelectionChange && document.removeEventListener("selectionchange", this._onSelectionChange);
|
|
1671
1866
|
}
|
|
1672
|
-
},
|
|
1867
|
+
}, we = [
|
|
1673
1868
|
[
|
|
1674
1869
|
"AF",
|
|
1675
1870
|
"Afghanistan",
|
|
@@ -2895,65 +3090,65 @@ var h = Symbol("wui.trustedHtml"), g = (e) => String(e ?? "").replace(/&/g, "&am
|
|
|
2895
3090
|
"Zimbabwe",
|
|
2896
3091
|
"263"
|
|
2897
3092
|
]
|
|
2898
|
-
],
|
|
3093
|
+
], L = (e) => (we.find((t) => t[0] === e) || [
|
|
2899
3094
|
"",
|
|
2900
3095
|
"",
|
|
2901
3096
|
""
|
|
2902
|
-
])[2],
|
|
2903
|
-
function
|
|
2904
|
-
return
|
|
3097
|
+
])[2], R = (e) => `wui-flag wui-flag-${String(e).toLowerCase()}`, z = null, Te = null;
|
|
3098
|
+
function Ee() {
|
|
3099
|
+
return z ? Promise.resolve(z) : (Te ||= Promise.all([import("./max-BDKx469G.js"), import("./examples.mobile.json-BMXTGiGC.js")]).then(([e, t]) => (z = {
|
|
2905
3100
|
AsYouType: e.AsYouType,
|
|
2906
3101
|
getExampleNumber: e.getExampleNumber,
|
|
2907
3102
|
isValidPhoneNumber: e.isValidPhoneNumber,
|
|
2908
3103
|
parsePhoneNumber: e.parsePhoneNumber,
|
|
2909
3104
|
examples: t.default || t
|
|
2910
|
-
},
|
|
3105
|
+
}, z)).catch(() => null), Te);
|
|
2911
3106
|
}
|
|
2912
3107
|
function B(e, t) {
|
|
2913
|
-
if (!
|
|
3108
|
+
if (!z || !t) return t;
|
|
2914
3109
|
try {
|
|
2915
|
-
return new
|
|
3110
|
+
return new z.AsYouType(e).input(t);
|
|
2916
3111
|
} catch {
|
|
2917
3112
|
return t;
|
|
2918
3113
|
}
|
|
2919
3114
|
}
|
|
2920
|
-
function
|
|
3115
|
+
function De(e, t) {
|
|
2921
3116
|
if (t <= 0) return 0;
|
|
2922
3117
|
let n = 0;
|
|
2923
3118
|
for (let r = 0; r < e.length; r++) if (/[0-9]/.test(e[r]) && (n += 1, n === t)) return r + 1;
|
|
2924
3119
|
return e.length;
|
|
2925
3120
|
}
|
|
2926
3121
|
function V(e) {
|
|
2927
|
-
if (!
|
|
3122
|
+
if (!z) return null;
|
|
2928
3123
|
try {
|
|
2929
|
-
return
|
|
3124
|
+
return z.getExampleNumber(e, z.examples)?.formatNational() || null;
|
|
2930
3125
|
} catch {
|
|
2931
3126
|
return null;
|
|
2932
3127
|
}
|
|
2933
3128
|
}
|
|
2934
|
-
function
|
|
2935
|
-
if (!
|
|
3129
|
+
function Oe(e) {
|
|
3130
|
+
if (!z || !e) return null;
|
|
2936
3131
|
try {
|
|
2937
|
-
if (!
|
|
2938
|
-
let t =
|
|
3132
|
+
if (!z.isValidPhoneNumber(e)) return !1;
|
|
3133
|
+
let t = z.parsePhoneNumber(e)?.getType?.();
|
|
2939
3134
|
return t === void 0 || t === "MOBILE" || t === "FIXED_LINE_OR_MOBILE";
|
|
2940
3135
|
} catch {
|
|
2941
3136
|
return null;
|
|
2942
3137
|
}
|
|
2943
3138
|
}
|
|
2944
|
-
function
|
|
2945
|
-
if (!
|
|
3139
|
+
function ke(e) {
|
|
3140
|
+
if (!z) return null;
|
|
2946
3141
|
try {
|
|
2947
|
-
let t =
|
|
3142
|
+
let t = z.getExampleNumber(e, z.examples);
|
|
2948
3143
|
return t?.nationalNumber ? t.nationalNumber.length : null;
|
|
2949
3144
|
} catch {
|
|
2950
3145
|
return null;
|
|
2951
3146
|
}
|
|
2952
3147
|
}
|
|
2953
|
-
function
|
|
2954
|
-
if (!
|
|
3148
|
+
function H(e) {
|
|
3149
|
+
if (!z || !e?.trim().startsWith("+")) return null;
|
|
2955
3150
|
try {
|
|
2956
|
-
let t = new
|
|
3151
|
+
let t = new z.AsYouType();
|
|
2957
3152
|
t.input(e.trim());
|
|
2958
3153
|
let n = t.getCountry();
|
|
2959
3154
|
return n ? {
|
|
@@ -2964,7 +3159,7 @@ function he(e) {
|
|
|
2964
3159
|
return null;
|
|
2965
3160
|
}
|
|
2966
3161
|
}
|
|
2967
|
-
var
|
|
3162
|
+
var Ae = class extends e {
|
|
2968
3163
|
static formAssociated = !0;
|
|
2969
3164
|
static get observedAttributes() {
|
|
2970
3165
|
return [
|
|
@@ -3011,13 +3206,13 @@ var ge = class extends e {
|
|
|
3011
3206
|
this.value = this._defaultValue || "";
|
|
3012
3207
|
}
|
|
3013
3208
|
get value() {
|
|
3014
|
-
return this._national ? `+${
|
|
3209
|
+
return this._national ? `+${L(this._country)}${this._national}` : "";
|
|
3015
3210
|
}
|
|
3016
3211
|
set value(e) {
|
|
3017
|
-
let t = String(e ?? "").trim(), n =
|
|
3212
|
+
let t = String(e ?? "").trim(), n = H(t);
|
|
3018
3213
|
if (n) this._country = n.country, this._national = n.national.replace(/[^0-9]/g, "");
|
|
3019
3214
|
else if (t.startsWith("+")) {
|
|
3020
|
-
let e = t.replace(/[^0-9]/g, ""), n = String(
|
|
3215
|
+
let e = t.replace(/[^0-9]/g, ""), n = String(L(this._country));
|
|
3021
3216
|
n && e.startsWith(n) && (e = e.slice(n.length)), this._national = e;
|
|
3022
3217
|
} else this._national = t.replace(/[^0-9]/g, "");
|
|
3023
3218
|
n && this.getAttribute("country") !== this._country ? this.setAttribute("country", this._country) : this._rendered && this.render(), this._committedValue = this.value, this._syncMirror();
|
|
@@ -3037,14 +3232,14 @@ var ge = class extends e {
|
|
|
3037
3232
|
this.id ||= `wui-phone-${Math.random().toString(36).slice(2, 9)}`;
|
|
3038
3233
|
let t = `${this.id}-listbox`;
|
|
3039
3234
|
this._listboxId = t;
|
|
3040
|
-
let n =
|
|
3235
|
+
let n = we.map(([e, n, r], i) => `<button type="button" role="option" id="${U(`${t}-opt-${i}`)}" class="country-dropdown-item${e === this._country ? " selected" : ""}" data-iso="${e}" aria-selected="${e === this._country}"><span class="${R(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join("");
|
|
3041
3236
|
this.innerHTML = `
|
|
3042
3237
|
<div class="phone-input-wrap">
|
|
3043
3238
|
<div class="phone-country-adornment">
|
|
3044
3239
|
<button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${U(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
|
|
3045
|
-
<span class="${
|
|
3240
|
+
<span class="${R(this._country)}" data-flag aria-hidden="true"></span>
|
|
3046
3241
|
${p("chevron-down", { className: "phone-chevron" })}
|
|
3047
|
-
<span class="phone-dial" data-dial>+${
|
|
3242
|
+
<span class="phone-dial" data-dial>+${L(this._country)}</span>
|
|
3048
3243
|
</button>
|
|
3049
3244
|
<div class="country-dropdown-menu" role="listbox" id="${U(t)}" tabindex="-1" hidden>
|
|
3050
3245
|
<div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${p("search")}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${U(t)}" aria-autocomplete="list" /></div>
|
|
@@ -3082,7 +3277,7 @@ var ge = class extends e {
|
|
|
3082
3277
|
}
|
|
3083
3278
|
a && (a.hidden = n > 0);
|
|
3084
3279
|
}, v = (e) => {
|
|
3085
|
-
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className =
|
|
3280
|
+
this._country = e, this.getAttribute("country") !== e && (this._suppressCountryRender = !0, this.setAttribute("country", e), this._suppressCountryRender = !1), u && (u.className = R(e)), d && (d.textContent = `+${L(e)}`);
|
|
3086
3281
|
for (let t of this._itemEls()) {
|
|
3087
3282
|
let n = t.dataset.iso === e;
|
|
3088
3283
|
t.classList.toggle("selected", n), t.setAttribute("aria-selected", String(n));
|
|
@@ -3129,19 +3324,19 @@ var ge = class extends e {
|
|
|
3129
3324
|
};
|
|
3130
3325
|
o.addEventListener("input", (e) => {
|
|
3131
3326
|
e.stopPropagation();
|
|
3132
|
-
let t = o.selectionStart ?? o.value.length, n = o.value.slice(0, t).replace(/[^0-9]/g, "").length, r = o.value.replace(/[^0-9]/g, ""), i =
|
|
3327
|
+
let t = o.selectionStart ?? o.value.length, n = o.value.slice(0, t).replace(/[^0-9]/g, "").length, r = o.value.replace(/[^0-9]/g, ""), i = ke(this._country);
|
|
3133
3328
|
i && r.length > i && (r = r.slice(0, i)), this._national = r;
|
|
3134
3329
|
let a = B(this._country, this._national);
|
|
3135
3330
|
if (o.value !== a) {
|
|
3136
3331
|
o.value = a;
|
|
3137
|
-
let e =
|
|
3332
|
+
let e = De(a, Math.min(n, r.length));
|
|
3138
3333
|
o.setSelectionRange(e, e);
|
|
3139
3334
|
}
|
|
3140
|
-
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national ||
|
|
3335
|
+
this._syncMirror(), this._emitInput(), o.classList.contains("is-invalid") && (!this._national || Oe(this.value) === !0) && x(!1);
|
|
3141
3336
|
}), o.addEventListener("change", (e) => e.stopPropagation()), o.addEventListener("blur", () => {
|
|
3142
|
-
x(this._national.length > 0 &&
|
|
3337
|
+
x(this._national.length > 0 && Oe(this.value) === !1), this.value !== this._committedValue && this._emitChange();
|
|
3143
3338
|
}), o.addEventListener("paste", (e) => {
|
|
3144
|
-
let t =
|
|
3339
|
+
let t = H(e.clipboardData?.getData("text"));
|
|
3145
3340
|
t && (e.preventDefault(), this._national = t.national.replace(/[^0-9]/g, ""), t.country === this._country ? o.value = B(this._country, this._national) : this.setAttribute("country", t.country), this._syncMirror(), this._emitInput(), this._emitChange(), this.querySelector("input[type=tel]")?.focus());
|
|
3146
3341
|
}), this._bindGlobal = () => {
|
|
3147
3342
|
this._teardownGlobals?.(), this._onDocClick = (e) => {
|
|
@@ -3151,7 +3346,7 @@ var ge = class extends e {
|
|
|
3151
3346
|
});
|
|
3152
3347
|
}, this._teardownGlobals = () => {
|
|
3153
3348
|
this._onDocClick &&= (document.removeEventListener("click", this._onDocClick), null), l(this);
|
|
3154
|
-
}, this._bindGlobal(),
|
|
3349
|
+
}, this._bindGlobal(), Ee().then((e) => {
|
|
3155
3350
|
if (!(!e || !o.isConnected) && (this._national && (o.value = B(this._country, this._national)), !this.getAttribute("placeholder"))) {
|
|
3156
3351
|
let e = V(this._country);
|
|
3157
3352
|
e && (o.placeholder = e);
|
|
@@ -3164,7 +3359,7 @@ var ge = class extends e {
|
|
|
3164
3359
|
disconnectedCallback() {
|
|
3165
3360
|
this._teardown();
|
|
3166
3361
|
}
|
|
3167
|
-
}, U = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"),
|
|
3362
|
+
}, U = (e) => String(e ?? "").replace(/"/g, """).replace(/</g, "<"), je = class extends e {
|
|
3168
3363
|
static formAssociated = !0;
|
|
3169
3364
|
static get observedAttributes() {
|
|
3170
3365
|
return [
|
|
@@ -3370,7 +3565,7 @@ var ge = class extends e {
|
|
|
3370
3565
|
disconnectedCallback() {
|
|
3371
3566
|
this._teardown();
|
|
3372
3567
|
}
|
|
3373
|
-
}, W = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"),
|
|
3568
|
+
}, W = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Me = class extends e {
|
|
3374
3569
|
static formAssociated = !0;
|
|
3375
3570
|
static get observedAttributes() {
|
|
3376
3571
|
return [
|
|
@@ -3512,7 +3707,7 @@ var ge = class extends e {
|
|
|
3512
3707
|
aria-valuenow="${this._value}"
|
|
3513
3708
|
aria-valuetext="${this._formatValue(this._value)}"
|
|
3514
3709
|
${a ? "disabled" : ""}
|
|
3515
|
-
aria-label="${
|
|
3710
|
+
aria-label="${Ne(this.getAttribute("aria-label") || "Value")}"
|
|
3516
3711
|
></button>
|
|
3517
3712
|
`}
|
|
3518
3713
|
${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>` : ""}
|
|
@@ -3615,7 +3810,7 @@ var ge = class extends e {
|
|
|
3615
3810
|
}, G = (e, t) => {
|
|
3616
3811
|
let n = Number.parseFloat(e);
|
|
3617
3812
|
return Number.isFinite(n) ? n : t;
|
|
3618
|
-
},
|
|
3813
|
+
}, Ne = (e) => String(e ?? "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), Pe = class extends e {
|
|
3619
3814
|
static formAssociated = !0;
|
|
3620
3815
|
_accessibleName() {
|
|
3621
3816
|
return this.getAttribute("aria-label") || this.getAttribute("placeholder") || "Add tags";
|
|
@@ -3700,16 +3895,14 @@ var ge = class extends e {
|
|
|
3700
3895
|
e.innerHTML = "";
|
|
3701
3896
|
return;
|
|
3702
3897
|
}
|
|
3703
|
-
e.innerHTML = this._values.map((e) => `<span class="chip chip-sm"><span class="chip-label">${
|
|
3898
|
+
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)}">${p("x")}</button></span>`).join("");
|
|
3704
3899
|
}
|
|
3705
3900
|
}
|
|
3706
3901
|
_wire() {
|
|
3707
3902
|
this._teardown();
|
|
3708
3903
|
let e = this.querySelector(".search-select-control"), t = this.querySelector("[data-input]");
|
|
3709
3904
|
if (!e || !t) return;
|
|
3710
|
-
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 =
|
|
3711
|
-
for (let e of r) e === "enter" ? o.add("Enter") : e === "comma" ? o.add(",") : e === "space" ? o.add(" ") : e === "tab" && o.add("Tab");
|
|
3712
|
-
let s = () => {
|
|
3905
|
+
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 = new Set(r.map(de).filter(Boolean)), s = () => {
|
|
3713
3906
|
d(this, this._values.join(",")), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
3714
3907
|
}, c = (e) => {
|
|
3715
3908
|
let t = e.trim();
|
|
@@ -3741,9 +3934,9 @@ var ge = class extends e {
|
|
|
3741
3934
|
e.preventDefault();
|
|
3742
3935
|
let n = e.clipboardData.getData("text/plain"), a = [];
|
|
3743
3936
|
for (let e of r) {
|
|
3744
|
-
let t = e;
|
|
3745
|
-
if (
|
|
3746
|
-
a.push(...n
|
|
3937
|
+
let t = fe(e) ?? e;
|
|
3938
|
+
if (M(n, [t])) {
|
|
3939
|
+
a.push(...pe(n, [t]));
|
|
3747
3940
|
break;
|
|
3748
3941
|
}
|
|
3749
3942
|
}
|
|
@@ -3771,7 +3964,7 @@ var ge = class extends e {
|
|
|
3771
3964
|
disconnectedCallback() {
|
|
3772
3965
|
this._teardown();
|
|
3773
3966
|
}
|
|
3774
|
-
},
|
|
3967
|
+
}, 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"), Ie = (e, t) => `${q(e)}:${q(t)}`, J = (e) => {
|
|
3775
3968
|
let t = /^(\d{2}):(\d{2})$/.exec(e || "");
|
|
3776
3969
|
return t ? {
|
|
3777
3970
|
h: +t[1],
|
|
@@ -3779,10 +3972,10 @@ var ge = class extends e {
|
|
|
3779
3972
|
} : null;
|
|
3780
3973
|
}, Y = (e, t = "24") => {
|
|
3781
3974
|
if (!e) return "";
|
|
3782
|
-
if (t === "24") return
|
|
3975
|
+
if (t === "24") return Ie(e.h, e.m);
|
|
3783
3976
|
let n = e.h % 12 || 12, r = e.h >= 12 ? "PM" : "AM";
|
|
3784
3977
|
return `${n}:${q(e.m)} ${r}`;
|
|
3785
|
-
},
|
|
3978
|
+
}, Le = class extends e {
|
|
3786
3979
|
static formAssociated = !0;
|
|
3787
3980
|
static get observedAttributes() {
|
|
3788
3981
|
return [
|
|
@@ -3867,7 +4060,7 @@ var ge = class extends e {
|
|
|
3867
4060
|
if (!e) return;
|
|
3868
4061
|
let t = this.getAttribute("format") || "24", n = this._buildTimes(), r = J(this._value), i = this._focus, a = "";
|
|
3869
4062
|
for (let e = 0; e < n.length; e++) {
|
|
3870
|
-
let o = n[e], s =
|
|
4063
|
+
let o = n[e], s = Ie(o.h, o.m), c = r && r.h === o.h && r.m === o.m;
|
|
3871
4064
|
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>`;
|
|
3872
4065
|
}
|
|
3873
4066
|
e.innerHTML = a, this._focusActive();
|
|
@@ -3966,7 +4159,7 @@ var ge = class extends e {
|
|
|
3966
4159
|
disconnectedCallback() {
|
|
3967
4160
|
this._teardown();
|
|
3968
4161
|
}
|
|
3969
|
-
},
|
|
4162
|
+
}, Re = "wui-wizard-step", ze = class extends e {
|
|
3970
4163
|
static get observedAttributes() {
|
|
3971
4164
|
return [
|
|
3972
4165
|
"active",
|
|
@@ -4000,7 +4193,7 @@ var ge = class extends e {
|
|
|
4000
4193
|
this._beforeNext = typeof e == "function" ? e : null;
|
|
4001
4194
|
}
|
|
4002
4195
|
get _steps() {
|
|
4003
|
-
return [...this.querySelectorAll(`:scope > ${
|
|
4196
|
+
return [...this.querySelectorAll(`:scope > ${Re}`)];
|
|
4004
4197
|
}
|
|
4005
4198
|
refresh() {
|
|
4006
4199
|
this._rendered && this._renderChrome();
|
|
@@ -4133,7 +4326,7 @@ var ge = class extends e {
|
|
|
4133
4326
|
_reflectActive(e) {
|
|
4134
4327
|
this._reflecting = !0, this.setAttribute("active", String(e)), this._reflecting = !1;
|
|
4135
4328
|
}
|
|
4136
|
-
}, X = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"),
|
|
4329
|
+
}, X = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Be = class extends e {
|
|
4137
4330
|
static get observedAttributes() {
|
|
4138
4331
|
return [
|
|
4139
4332
|
"label",
|
|
@@ -4147,8 +4340,8 @@ var ge = class extends e {
|
|
|
4147
4340
|
let e = this.closest("wui-wizard");
|
|
4148
4341
|
e && typeof e.refresh == "function" && e.refresh();
|
|
4149
4342
|
}
|
|
4150
|
-
},
|
|
4151
|
-
async function
|
|
4343
|
+
}, Ve = 2e3;
|
|
4344
|
+
async function He(e) {
|
|
4152
4345
|
try {
|
|
4153
4346
|
if (navigator.clipboard?.writeText) return await navigator.clipboard.writeText(e), !0;
|
|
4154
4347
|
} catch {}
|
|
@@ -4163,14 +4356,14 @@ async function Oe(e) {
|
|
|
4163
4356
|
}
|
|
4164
4357
|
//#endregion
|
|
4165
4358
|
//#region src/fileValidation.js
|
|
4166
|
-
var
|
|
4359
|
+
var Ue = "image/png,image/jpeg,image/webp", We = 5, Ge = {
|
|
4167
4360
|
"image/png": [".png"],
|
|
4168
4361
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
4169
4362
|
"image/webp": [".webp"],
|
|
4170
4363
|
"image/gif": [".gif"],
|
|
4171
4364
|
"image/svg+xml": [".svg"],
|
|
4172
4365
|
"application/pdf": [".pdf"]
|
|
4173
|
-
},
|
|
4366
|
+
}, Ke = {
|
|
4174
4367
|
"image/png": "PNG",
|
|
4175
4368
|
"image/jpeg": "JPG",
|
|
4176
4369
|
"image/webp": "WEBP",
|
|
@@ -4184,7 +4377,7 @@ var ke = "image/png,image/jpeg,image/webp", Ae = 5, je = {
|
|
|
4184
4377
|
".gif": "GIF",
|
|
4185
4378
|
".svg": "SVG",
|
|
4186
4379
|
".pdf": "PDF"
|
|
4187
|
-
}, Z = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean),
|
|
4380
|
+
}, Z = (e) => String(e || "").split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), qe = [
|
|
4188
4381
|
".png",
|
|
4189
4382
|
".jpg",
|
|
4190
4383
|
".jpeg",
|
|
@@ -4195,35 +4388,35 @@ var ke = "image/png,image/jpeg,image/webp", Ae = 5, je = {
|
|
|
4195
4388
|
".avif",
|
|
4196
4389
|
".heic"
|
|
4197
4390
|
];
|
|
4198
|
-
function
|
|
4391
|
+
function Je(e) {
|
|
4199
4392
|
if (!e) return !1;
|
|
4200
4393
|
let t = typeof e == "object" && e.type ? String(e.type).toLowerCase() : "";
|
|
4201
4394
|
if (t) return t.startsWith("image/");
|
|
4202
4395
|
let n = typeof e == "string" ? e : e.name || e.url || "", r = String(n).toLowerCase();
|
|
4203
|
-
return
|
|
4396
|
+
return qe.some((e) => r.endsWith(e));
|
|
4204
4397
|
}
|
|
4205
|
-
function
|
|
4398
|
+
function Ye(e) {
|
|
4206
4399
|
let t = Z(e);
|
|
4207
|
-
return t.length ? t.every((e) => e.startsWith(".") ?
|
|
4400
|
+
return t.length ? t.every((e) => e.startsWith(".") ? qe.includes(e) : e === "image/*" || e.startsWith("image/")) : !1;
|
|
4208
4401
|
}
|
|
4209
|
-
function
|
|
4402
|
+
function Xe(e) {
|
|
4210
4403
|
let t = [];
|
|
4211
4404
|
for (let n of Z(e)) {
|
|
4212
|
-
let e =
|
|
4405
|
+
let e = Ke[n] || (n.startsWith(".") ? n.slice(1).toUpperCase() : n.toUpperCase());
|
|
4213
4406
|
t.includes(e) || t.push(e);
|
|
4214
4407
|
}
|
|
4215
4408
|
return t.length <= 1 ? t[0] || "supported" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
|
|
4216
4409
|
}
|
|
4217
|
-
function
|
|
4410
|
+
function Ze(e, t) {
|
|
4218
4411
|
let n = Z(t);
|
|
4219
4412
|
if (!n.length) return !0;
|
|
4220
4413
|
let r = (e.type || "").toLowerCase(), i = (e.name || "").toLowerCase();
|
|
4221
|
-
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (
|
|
4414
|
+
return n.some((e) => e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r && r === e ? !0 : !r && (Ge[e] || []).some((e) => i.endsWith(e)));
|
|
4222
4415
|
}
|
|
4223
|
-
function
|
|
4416
|
+
function Qe(e, t = {}) {
|
|
4224
4417
|
if (!e) return null;
|
|
4225
|
-
let n = t.accept === void 0 ?
|
|
4226
|
-
return
|
|
4418
|
+
let n = t.accept === void 0 ? Ue : t.accept, r = t.maxSizeMb || 5;
|
|
4419
|
+
return Ze(e, n) ? e.size > r * 1024 * 1024 ? `Keep the file under ${r} MB.` : null : `Choose a ${Xe(n)} file.`;
|
|
4227
4420
|
}
|
|
4228
4421
|
//#endregion
|
|
4229
4422
|
//#region src/passwordRules.js
|
|
@@ -4234,15 +4427,15 @@ var Q = {
|
|
|
4234
4427
|
digit: !0,
|
|
4235
4428
|
special: !0,
|
|
4236
4429
|
uniqueChars: 0
|
|
4237
|
-
},
|
|
4238
|
-
function
|
|
4430
|
+
}, $e = "Password Requirements";
|
|
4431
|
+
function et(e) {
|
|
4239
4432
|
return e === !0 || e == null ? { ...Q } : {
|
|
4240
4433
|
...Q,
|
|
4241
4434
|
...e
|
|
4242
4435
|
};
|
|
4243
4436
|
}
|
|
4244
|
-
function
|
|
4245
|
-
let t =
|
|
4437
|
+
function tt(e) {
|
|
4438
|
+
let t = et(e), n = [];
|
|
4246
4439
|
if (t.minLength > 0 && n.push({
|
|
4247
4440
|
key: "length",
|
|
4248
4441
|
label: `At least ${t.minLength} characters long`,
|
|
@@ -4273,25 +4466,25 @@ function Ve(e) {
|
|
|
4273
4466
|
}
|
|
4274
4467
|
return n;
|
|
4275
4468
|
}
|
|
4276
|
-
function
|
|
4469
|
+
function nt(e, t) {
|
|
4277
4470
|
let n = e == null ? "" : String(e);
|
|
4278
|
-
return
|
|
4471
|
+
return tt(t).map((e) => ({
|
|
4279
4472
|
key: e.key,
|
|
4280
4473
|
label: e.label,
|
|
4281
4474
|
met: e.test(n)
|
|
4282
4475
|
}));
|
|
4283
4476
|
}
|
|
4284
|
-
function
|
|
4285
|
-
return
|
|
4477
|
+
function rt(e, t) {
|
|
4478
|
+
return nt(e, t).every((e) => e.met);
|
|
4286
4479
|
}
|
|
4287
4480
|
//#endregion
|
|
4288
4481
|
//#region src/index.js
|
|
4289
4482
|
var $ = (e, t) => {
|
|
4290
4483
|
typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
|
|
4291
4484
|
};
|
|
4292
|
-
function
|
|
4293
|
-
$("wui-select",
|
|
4485
|
+
function it() {
|
|
4486
|
+
$("wui-select", je), $("wui-phone", Ae), $("wui-datepicker", ee), $("wui-date-range", te), $("wui-dock", ne), $("wui-feedback", oe), $("wui-slider", Me), $("wui-timepicker", Le), $("wui-autocomplete", y), $("wui-multiselect", me), $("wui-taginput", Pe), $("wui-otp", Ce), $("wui-status-icon", r), $("wui-wizard-step", Be), $("wui-wizard", ze);
|
|
4294
4487
|
}
|
|
4295
|
-
|
|
4488
|
+
it();
|
|
4296
4489
|
//#endregion
|
|
4297
|
-
export {
|
|
4490
|
+
export { Ve as COPY_FEEDBACK_MS, Ue as DEFAULT_IMAGE_ACCEPT, We as DEFAULT_MAX_SIZE_MB, Q as DEFAULT_PASSWORD_RULES, $e as DEFAULT_REQUIREMENTS_TITLE, n as STATUS_TONES, y as WuiAutocomplete, ee as WuiDatePicker, te as WuiDateRange, ne as WuiDock, oe as WuiFeedback, me as WuiMultiSelect, Ce as WuiOtp, Ae as WuiPhone, je as WuiSelect, Me as WuiSlider, r as WuiStatusIcon, Pe as WuiTagInput, Le as WuiTimePicker, ze as WuiWizard, Be as WuiWizardStep, Xe as acceptLabel, tt as buildPasswordRules, He as copyTextToClipboard, it as defineWeborityElements, nt as evaluatePassword, p as glyphSvg, Je as isImageFile, Ye as isImageOnlyAccept, Ze as matchesAccept, rt as passwordSatisfies, Qe as validateFile };
|