monobill-mintui 0.6.650 → 0.6.652
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/bin/component-dependencies.json +13 -1
- package/dist/components/chunks/ScrollFade-D1FPF6ZS.js +82 -0
- package/dist/components/chunks/ScrollFade-DT2Br2g7.js +1 -0
- package/dist/components/chunks/date-picker-BQsCoKaK.js +1282 -0
- package/dist/components/chunks/date-picker-tm5Oc92c.js +1 -0
- package/dist/components/chunks/{input-CYv5hraJ.js → input-DcglGwsR.js} +13 -6
- package/dist/components/chunks/input-awdYlp-G.js +1 -0
- package/dist/components/chunks/{popover-DB1OaYVe.js → popover-FdMS4yAD.js} +54 -14
- package/dist/components/chunks/popover-wGdggZ-a.js +1 -0
- package/dist/components/chunks/{table-DRdsVUJL.js → table-B9e-cnAC.js} +7 -6
- package/dist/components/chunks/table-vjF3q3J5.js +1 -0
- package/dist/components/chunks/time-picker-Cq3qzkDb.js +1 -0
- package/dist/components/chunks/time-picker-S0bc0BPU.js +360 -0
- package/dist/components/date-picker/DatePicker.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/browser.js +2 -1270
- package/dist/components/date-picker/index.cjs +1 -1
- package/dist/components/date-picker/index.js +2 -1270
- package/dist/components/datetime-picker/DateTimePicker.d.ts +44 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts.map +1 -0
- package/dist/components/datetime-picker/browser.js +255 -0
- package/dist/components/datetime-picker/index.cjs +1 -0
- package/dist/components/datetime-picker/index.d.ts +4 -0
- package/dist/components/datetime-picker/index.d.ts.map +1 -0
- package/dist/components/datetime-picker/index.js +243 -0
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/form/browser.js +9 -8
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +9 -8
- package/dist/components/input/browser.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/link/browser.js +1 -1
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/navigation/browser.js +2 -2
- package/dist/components/navigation/index.cjs +1 -1
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/popover/Popover.d.ts.map +1 -1
- package/dist/components/popover/browser.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/resource-table/ResourceTable.d.ts +1 -0
- package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
- package/dist/components/resource-table/browser.js +22 -22
- package/dist/components/resource-table/index.cjs +2 -2
- package/dist/components/resource-table/index.js +22 -22
- package/dist/components/scroll-fade/ScrollFade.d.ts +15 -0
- package/dist/components/scroll-fade/ScrollFade.d.ts.map +1 -0
- package/dist/components/scroll-fade/browser.js +16 -0
- package/dist/components/scroll-fade/index.cjs +1 -0
- package/dist/components/scroll-fade/index.d.ts +6 -0
- package/dist/components/scroll-fade/index.d.ts.map +1 -0
- package/dist/components/scroll-fade/index.js +4 -0
- package/dist/components/search/Search.d.ts.map +1 -1
- package/dist/components/search/browser.js +3 -3
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +3 -3
- package/dist/components/select/NativeSelect.d.ts +38 -0
- package/dist/components/select/NativeSelect.d.ts.map +1 -0
- package/dist/components/select/Select.d.ts +36 -29
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/browser.js +313 -19
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.d.ts +3 -2
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/index.js +313 -19
- package/dist/components/side-navigation/SideNavigation.d.ts +1 -0
- package/dist/components/side-navigation/SideNavigation.d.ts.map +1 -1
- package/dist/components/side-navigation/browser.js +24 -23
- package/dist/components/side-navigation/index.cjs +1 -1
- package/dist/components/side-navigation/index.js +24 -23
- package/dist/components/sortable/browser.js +1 -1
- package/dist/components/sortable/index.cjs +1 -1
- package/dist/components/sortable/index.js +1 -1
- package/dist/components/table/Table.d.ts +1 -0
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/browser.js +1 -1
- package/dist/components/table/index.cjs +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/tags/browser.js +1 -1
- package/dist/components/tags/index.cjs +1 -1
- package/dist/components/tags/index.js +1 -1
- package/dist/components/time-picker/TimePicker.d.ts +1 -0
- package/dist/components/time-picker/TimePicker.d.ts.map +1 -1
- package/dist/components/time-picker/browser.js +2 -347
- package/dist/components/time-picker/index.cjs +1 -1
- package/dist/components/time-picker/index.js +2 -347
- package/dist/components/tree/Tree.d.ts +2 -0
- package/dist/components/tree/Tree.d.ts.map +1 -1
- package/dist/components/tree/browser.js +15 -7
- package/dist/components/tree/index.cjs +1 -1
- package/dist/components/tree/index.js +15 -7
- package/dist/datetime-picker.css +3 -0
- package/dist/index.cjs +4 -4
- package/dist/index.css +22 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1413 -739
- package/dist/modal.css +1 -1
- package/dist/navigation-search.json +15 -1
- package/dist/navigation.css +1 -1
- package/dist/off-canvas.css +1 -1
- package/dist/popover.css +1 -1
- package/dist/scroll-fade.css +3 -0
- package/dist/select.css +1 -1
- package/dist/side-navigation.css +1 -1
- package/dist/theme.css +7 -2
- package/dist/time-picker.css +1 -1
- package/package.json +19 -1
- package/dist/components/chunks/caret-up-DzrY-bTy.js +0 -1
- package/dist/components/chunks/caret-up-ZK3v_oWQ.js +0 -9
- package/dist/components/chunks/input-Du8C2LW8.js +0 -1
- package/dist/components/chunks/popover-CNZ5u-MA.js +0 -1
- package/dist/components/chunks/table-2-0iNQJy.js +0 -1
- /package/dist/components/chunks/{caret-right-BzeJ0Fw3.js → caret-right-BcZ9bOhS.js} +0 -0
- /package/dist/components/chunks/{caret-right-Bh7uMg-Y.js → caret-right-CgIVfus7.js} +0 -0
- /package/dist/components/chunks/{link-BsC3zT_I.js → link-BjbBJpI6.js} +0 -0
- /package/dist/components/chunks/{link-dTjSvr4E.js → link-CU-gTgir.js} +0 -0
- /package/dist/components/chunks/{search-v06eZL4m.js → search--bcFMYMP.js} +0 -0
- /package/dist/components/chunks/{search-CTAGy5ab.js → search-Cixhf7hA.js} +0 -0
- /package/dist/components/chunks/{sortable-B1nMJBah.js → sortable-CNlF0_gv.js} +0 -0
- /package/dist/components/chunks/{sortable-CXM-7eyL.js → sortable-CVK48xj1.js} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import '../../theme.css'
|
|
2
2
|
import '../../icon.css'
|
|
3
|
+
import '../../popover.css'
|
|
4
|
+
import '../../stack.css'
|
|
3
5
|
import '../../select.css'
|
|
4
6
|
import "../chunks/icon-Cxv9k3CY.js";
|
|
5
7
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
6
8
|
import "../chunks/icon-DMa6Oo80.js";
|
|
7
|
-
import "../chunks/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var t = "data-mint-select-part", n = class extends HTMLElement {
|
|
9
|
+
import "../chunks/popover-FdMS4yAD.js";
|
|
10
|
+
//#region src/components/select/NativeSelect.ts
|
|
11
|
+
var t = "data-mint-native-select-part", n = class extends HTMLElement {
|
|
11
12
|
static get observedAttributes() {
|
|
12
13
|
return [
|
|
13
14
|
"name",
|
|
@@ -27,10 +28,10 @@ var t = "data-mint-select-part", n = class extends HTMLElement {
|
|
|
27
28
|
];
|
|
28
29
|
}
|
|
29
30
|
constructor() {
|
|
30
|
-
super(), this._select = null, this._wrapper = null, this._caretUpIcon = null, this._caretDownIcon = null, this._changeHandler = null, this._optionObserver = null, this._childrenObserver = null, this._hostOptionsObserverRaf = null, this._generatedControlId = `mint-select-${Math.random().toString(36).slice(2, 10)}`;
|
|
31
|
+
super(), this._select = null, this._wrapper = null, this._caretUpIcon = null, this._caretDownIcon = null, this._changeHandler = null, this._optionObserver = null, this._childrenObserver = null, this._hostOptionsObserverRaf = null, this._generatedControlId = `mint-native-select-${Math.random().toString(36).slice(2, 10)}`;
|
|
31
32
|
}
|
|
32
33
|
connectedCallback() {
|
|
33
|
-
this.classList.add("mint-select-host"), this.getLabel() || console.error("mint-select: The \"label\" attribute is required. Please provide a label for the select."), this.render(), this._childrenObserver && this._childrenObserver.disconnect(), this._childrenObserver = new MutationObserver((e) => {
|
|
34
|
+
this.classList.add("mint-native-select-host"), this.getLabel() || console.error("mint-native-select: The \"label\" attribute is required. Please provide a label for the select."), this.render(), this._childrenObserver && this._childrenObserver.disconnect(), this._childrenObserver = new MutationObserver((e) => {
|
|
34
35
|
if (e.some((e) => {
|
|
35
36
|
let t = e.target;
|
|
36
37
|
if (this._select && (t === this._select || this._select.contains(t))) return !1;
|
|
@@ -157,7 +158,7 @@ var t = "data-mint-select-part", n = class extends HTMLElement {
|
|
|
157
158
|
}
|
|
158
159
|
getSelectClasses() {
|
|
159
160
|
return [
|
|
160
|
-
"mint-select-control",
|
|
161
|
+
"mint-native-select-control",
|
|
161
162
|
this.isMultiple() ? "is-multiple" : "",
|
|
162
163
|
this.hasError() ? "has-error" : ""
|
|
163
164
|
].filter(Boolean).join(" ");
|
|
@@ -173,11 +174,11 @@ var t = "data-mint-select-part", n = class extends HTMLElement {
|
|
|
173
174
|
let a = Array.from(this.children).filter((e) => e.tagName === "OPTION" || e.tagName === "OPTGROUP").map((e) => e.cloneNode(!0)), o = this.getLabel(), s = this.getInfo(), c = this.getId() || this._generatedControlId, l = this.getName(), u = this.isDisabled(), d = this.hasError();
|
|
174
175
|
if (o) {
|
|
175
176
|
let e = document.createElement("label");
|
|
176
|
-
e.setAttribute(t, "label"), e.className = "mint-select-label", c && e.setAttribute("for", c);
|
|
177
|
+
e.setAttribute(t, "label"), e.className = "mint-native-select-label", c && e.setAttribute("for", c);
|
|
177
178
|
let n = document.createTextNode(o);
|
|
178
179
|
e.appendChild(n), this.appendChild(e);
|
|
179
180
|
}
|
|
180
|
-
this._wrapper = document.createElement("div"), this._wrapper.setAttribute(t, "wrapper"), this._wrapper.className = "mint-select-control-wrap", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), c && (this._select.id = c), l && (this._select.name = l), u && (this._select.disabled = !0), this._select.required = this.isRequired(), n && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", d ? "true" : "false");
|
|
181
|
+
this._wrapper = document.createElement("div"), this._wrapper.setAttribute(t, "wrapper"), this._wrapper.className = "mint-native-select-control-wrap", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), c && (this._select.id = c), l && (this._select.name = l), u && (this._select.disabled = !0), this._select.required = this.isRequired(), n && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", d ? "true" : "false");
|
|
181
182
|
let f = this.getAttribute("aria-label")?.trim(), p = this.getAttribute("aria-labelledby")?.trim();
|
|
182
183
|
p ? this._select.setAttribute("aria-labelledby", p) : o ? this._select.removeAttribute("aria-label") : this._select.setAttribute("aria-label", f || "Select an option");
|
|
183
184
|
let m = a.length > 0 ? a : i;
|
|
@@ -240,34 +241,327 @@ var t = "data-mint-select-part", n = class extends HTMLElement {
|
|
|
240
241
|
}), this._wrapper.appendChild(this._select), n) this._caretUpIcon = null, this._caretDownIcon = null;
|
|
241
242
|
else {
|
|
242
243
|
let e = document.createElement("div");
|
|
243
|
-
e.className = "mint-select-caret", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "mint-select-caret-up", this._caretUpIcon.setAttribute("aria-hidden", "true"), e.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "mint-select-caret-down", this._caretDownIcon.setAttribute("aria-hidden", "true"), e.appendChild(this._caretDownIcon), this._wrapper.appendChild(e);
|
|
244
|
+
e.className = "mint-native-select-caret", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "mint-native-select-caret-up", this._caretUpIcon.setAttribute("aria-hidden", "true"), e.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "mint-native-select-caret-down", this._caretDownIcon.setAttribute("aria-hidden", "true"), e.appendChild(this._caretDownIcon), this._wrapper.appendChild(e);
|
|
244
245
|
}
|
|
245
246
|
if (s) {
|
|
246
247
|
let e = document.createElement("div");
|
|
247
|
-
e.setAttribute(t, "info"), e.className = "mint-select-info", e.textContent = s, this.appendChild(e);
|
|
248
|
+
e.setAttribute(t, "info"), e.className = "mint-native-select-info", e.textContent = s, this.appendChild(e);
|
|
248
249
|
}
|
|
249
250
|
this._renderErrorState(), this._syncSelectAccessibility(), this._renderSkeleton(e);
|
|
250
251
|
}
|
|
251
252
|
_renderSkeleton(e) {
|
|
252
|
-
let t = this.querySelector(".mint-select-skeleton-container"), n = this._wrapper;
|
|
253
|
+
let t = this.querySelector(".mint-native-select-skeleton-container"), n = this._wrapper;
|
|
253
254
|
if (e) {
|
|
254
|
-
t || (t = document.createElement("div"), t.className = "mint-select-skeleton-container", t.setAttribute("aria-hidden", "true"), n ? n.appendChild(t) : this.appendChild(t));
|
|
255
|
-
let e = t.querySelector(".mint-select-skeleton");
|
|
255
|
+
t || (t = document.createElement("div"), t.className = "mint-native-select-skeleton-container", t.setAttribute("aria-hidden", "true"), n ? n.appendChild(t) : this.appendChild(t));
|
|
256
|
+
let e = t.querySelector(".mint-native-select-skeleton");
|
|
256
257
|
e || (e = document.createElement("div"), t.appendChild(e));
|
|
257
258
|
let r = this.isMultiple();
|
|
258
259
|
e.classList.toggle("is-multiple", r), e.style.height = r ? "5rem" : "2rem", t.style.display = "block", this._select && (this._select.style.opacity = "0", this._select.style.pointerEvents = "none", this._select.setAttribute("aria-busy", "true"));
|
|
259
260
|
} else t && (t.style.display = "none"), this._select && (this._select.style.opacity = "1", this._select.style.pointerEvents = "auto", this._select.removeAttribute("aria-busy"));
|
|
260
261
|
}
|
|
261
262
|
_renderErrorState() {
|
|
262
|
-
let e = this.hasError(), n = this.getErrorMessage(), r = this.querySelector(".mint-select-error");
|
|
263
|
-
e && n ? (r ? r.hasAttribute(t) || r.setAttribute(t, "error") : (r = document.createElement("div"), r.setAttribute(t, "error"), r.className = "mint-select-error", this.appendChild(r)), r.textContent = n) : r && r.remove();
|
|
263
|
+
let e = this.hasError(), n = this.getErrorMessage(), r = this.querySelector(".mint-native-select-error");
|
|
264
|
+
e && n ? (r ? r.hasAttribute(t) || r.setAttribute(t, "error") : (r = document.createElement("div"), r.setAttribute(t, "error"), r.className = "mint-native-select-error", this.appendChild(r)), r.textContent = n) : r && r.remove();
|
|
264
265
|
}
|
|
265
266
|
_syncSelectAccessibility() {
|
|
266
267
|
if (!this._select) return;
|
|
267
|
-
let e = this._select.id || this._generatedControlId, n = (this.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean), r = this.querySelector(`[${t}="info"]`), i = this.querySelector(".mint-select-error");
|
|
268
|
+
let e = this._select.id || this._generatedControlId, n = (this.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean), r = this.querySelector(`[${t}="info"]`), i = this.querySelector(".mint-native-select-error");
|
|
268
269
|
r && (r.id = `${e}-info`, n.push(r.id)), i && (i.id = `${e}-error`, n.push(i.id)), n.length ? this._select.setAttribute("aria-describedby", Array.from(new Set(n)).join(" ")) : this._select.removeAttribute("aria-describedby");
|
|
269
270
|
}
|
|
270
271
|
};
|
|
271
|
-
customElements.get("mint-select") || e("mint-select", n);
|
|
272
|
+
customElements.get("mint-native-select") || e("mint-native-select", n);
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/components/select/Select.ts
|
|
275
|
+
var r = "data-mint-select-part", i = class extends HTMLElement {
|
|
276
|
+
constructor(...e) {
|
|
277
|
+
super(...e), this._native = null, this._trigger = null, this._popover = null, this._list = null, this._observer = null, this._syncing = !1, this._typeahead = "", this._typeaheadTimer = null, this._id = `mint-select-${Math.random().toString(36).slice(2, 10)}`;
|
|
278
|
+
}
|
|
279
|
+
static get observedAttributes() {
|
|
280
|
+
return [
|
|
281
|
+
"name",
|
|
282
|
+
"value",
|
|
283
|
+
"values",
|
|
284
|
+
"multiple",
|
|
285
|
+
"disabled",
|
|
286
|
+
"id",
|
|
287
|
+
"required",
|
|
288
|
+
"label",
|
|
289
|
+
"info",
|
|
290
|
+
"error",
|
|
291
|
+
"error-message",
|
|
292
|
+
"loading",
|
|
293
|
+
"placeholder",
|
|
294
|
+
"aria-label",
|
|
295
|
+
"aria-labelledby",
|
|
296
|
+
"aria-describedby",
|
|
297
|
+
"form"
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
connectedCallback() {
|
|
301
|
+
this.classList.add("mint-select-host"), this.render(), this._observer?.disconnect(), this._observer = new MutationObserver((e) => {
|
|
302
|
+
this._syncing || e.some((e) => {
|
|
303
|
+
let t = e.target instanceof Element ? e.target : e.target.parentElement;
|
|
304
|
+
return t === this || t?.closest(`[${r}]`) ? !1 : e.type === "attributes" ? [
|
|
305
|
+
"value",
|
|
306
|
+
"label",
|
|
307
|
+
"disabled",
|
|
308
|
+
"selected"
|
|
309
|
+
].includes(e.attributeName) : t instanceof HTMLOptionElement || t instanceof HTMLOptGroupElement || [...e.addedNodes, ...e.removedNodes].some((e) => e instanceof HTMLOptionElement || e instanceof HTMLOptGroupElement);
|
|
310
|
+
}) && this.render();
|
|
311
|
+
}), this._observer.observe(this, {
|
|
312
|
+
childList: !0,
|
|
313
|
+
subtree: !0,
|
|
314
|
+
attributes: !0,
|
|
315
|
+
attributeFilter: [
|
|
316
|
+
"value",
|
|
317
|
+
"label",
|
|
318
|
+
"disabled",
|
|
319
|
+
"selected"
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
disconnectedCallback() {
|
|
324
|
+
this._observer?.disconnect(), this._observer = null, this._typeaheadTimer !== null && window.clearTimeout(this._typeaheadTimer);
|
|
325
|
+
}
|
|
326
|
+
attributeChangedCallback(e, t, n) {
|
|
327
|
+
if (!(t === n || !this.isConnected)) {
|
|
328
|
+
if (e === "values" && this._native && this.isMultiple()) {
|
|
329
|
+
this._applyValues(this.parseValues(n)), this.updateDisplay();
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (e === "multiple" && this._native) {
|
|
333
|
+
this.render();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (e === "value" && this._native) {
|
|
337
|
+
this.isMultiple() ? this._applyValues(n ? [n] : []) : this._native.value = n || "", this.updateDisplay();
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
this.render();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
get value() {
|
|
344
|
+
return this.isMultiple() ? this.values : this._native?.value || this.getAttribute("value") || "";
|
|
345
|
+
}
|
|
346
|
+
set value(e) {
|
|
347
|
+
this.setValue(e);
|
|
348
|
+
}
|
|
349
|
+
get values() {
|
|
350
|
+
return this._native && this.isMultiple() ? Array.from(this._native.selectedOptions, (e) => e.value) : this.parseValues(this.getAttribute("values"));
|
|
351
|
+
}
|
|
352
|
+
set values(e) {
|
|
353
|
+
this.setValue(e);
|
|
354
|
+
}
|
|
355
|
+
getValue() {
|
|
356
|
+
return this.value;
|
|
357
|
+
}
|
|
358
|
+
setValue(e) {
|
|
359
|
+
if (this.isMultiple()) {
|
|
360
|
+
let t = Array.isArray(e) ? e.map(String) : e == null || e === "" ? [] : [String(e)];
|
|
361
|
+
this.setAttribute("values", JSON.stringify(t)), this._applyValues(t);
|
|
362
|
+
} else {
|
|
363
|
+
let t = e == null ? "" : String(e);
|
|
364
|
+
this.setAttribute("value", t), this._native && (this._native.value = t);
|
|
365
|
+
}
|
|
366
|
+
this.updateDisplay();
|
|
367
|
+
}
|
|
368
|
+
isDisabled() {
|
|
369
|
+
return this.hasAttribute("disabled") && this.getAttribute("disabled") !== "false";
|
|
370
|
+
}
|
|
371
|
+
isLoading() {
|
|
372
|
+
let e = this.getAttribute("loading");
|
|
373
|
+
return e !== null && e !== "false";
|
|
374
|
+
}
|
|
375
|
+
isRequired() {
|
|
376
|
+
return this.hasAttribute("required") && this.getAttribute("required") !== "false";
|
|
377
|
+
}
|
|
378
|
+
isMultiple() {
|
|
379
|
+
return this.hasAttribute("multiple") && this.getAttribute("multiple") !== "false";
|
|
380
|
+
}
|
|
381
|
+
hasError() {
|
|
382
|
+
return this.getAttribute("error") === "true";
|
|
383
|
+
}
|
|
384
|
+
parseValues(e) {
|
|
385
|
+
if (!e) return [];
|
|
386
|
+
try {
|
|
387
|
+
let t = JSON.parse(e);
|
|
388
|
+
if (Array.isArray(t)) {
|
|
389
|
+
if (t.length === 1 && typeof t[0] == "string" && t[0].trim().startsWith("[")) try {
|
|
390
|
+
let e = JSON.parse(t[0]);
|
|
391
|
+
if (Array.isArray(e)) return e.map(String);
|
|
392
|
+
} catch {}
|
|
393
|
+
return t.map(String);
|
|
394
|
+
}
|
|
395
|
+
} catch {}
|
|
396
|
+
return [e];
|
|
397
|
+
}
|
|
398
|
+
_applyValues(e) {
|
|
399
|
+
if (!this._native) return;
|
|
400
|
+
let t = new Set(e);
|
|
401
|
+
Array.from(this._native.options).forEach((e) => {
|
|
402
|
+
e.selected = t.has(e.value);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
options() {
|
|
406
|
+
return Array.from(this.querySelectorAll(":scope > option, :scope > optgroup > option"));
|
|
407
|
+
}
|
|
408
|
+
selectedOption() {
|
|
409
|
+
return this._native?.selectedOptions[0] || this.options().find((e) => e.value === this.value);
|
|
410
|
+
}
|
|
411
|
+
render() {
|
|
412
|
+
let e = this._native?.value ?? this.getAttribute("value") ?? "", t = this._native && this._native.multiple ? Array.from(this._native.selectedOptions, (e) => e.value) : this.parseValues(this.getAttribute("values"));
|
|
413
|
+
this._syncing = !0, Array.from(this.children).forEach((e) => {
|
|
414
|
+
e.hasAttribute(r) && e.remove();
|
|
415
|
+
});
|
|
416
|
+
let n = this.getAttribute("label")?.trim() || "", i = this.getAttribute("id") || this._id;
|
|
417
|
+
if (n) {
|
|
418
|
+
let e = document.createElement("label");
|
|
419
|
+
e.setAttribute(r, "label"), e.className = "mint-select-label", e.htmlFor = `${i}-trigger`, e.textContent = n, this.append(e);
|
|
420
|
+
}
|
|
421
|
+
let a = document.createElement("div");
|
|
422
|
+
a.setAttribute(r, "wrap"), a.className = "mint-select-control-wrap", this.append(a);
|
|
423
|
+
let o = document.createElement("button");
|
|
424
|
+
o.type = "button", o.id = `${i}-trigger`, o.className = "mint-select-trigger", o.disabled = this.isDisabled() || this.isLoading(), o.setAttribute("role", "combobox"), o.setAttribute("aria-busy", String(this.isLoading())), o.setAttribute("aria-haspopup", "listbox"), o.setAttribute("aria-expanded", "false"), o.setAttribute("aria-required", String(this.isRequired())), o.setAttribute("aria-invalid", String(this.hasError()));
|
|
425
|
+
let s = this.getAttribute("aria-labelledby"), c = this.getAttribute("aria-label")?.trim();
|
|
426
|
+
if (s ? o.setAttribute("aria-labelledby", s) : !n && c ? o.setAttribute("aria-label", c) : n && o.setAttribute("aria-labelledby", `${i}-label`), n) {
|
|
427
|
+
let e = this.querySelector(`[${r}="label"]`);
|
|
428
|
+
e && (e.id = `${i}-label`);
|
|
429
|
+
}
|
|
430
|
+
let l = document.createElement("span");
|
|
431
|
+
l.className = "mint-select-value", o.append(l);
|
|
432
|
+
let u = document.createElement("span");
|
|
433
|
+
u.className = "mint-select-caret", u.setAttribute("aria-hidden", "true"), u.innerHTML = "<mint-icon name=\"caret-up\"></mint-icon><mint-icon name=\"caret-down\"></mint-icon>", o.append(u), a.append(o);
|
|
434
|
+
let d = document.createElement("select");
|
|
435
|
+
d.setAttribute(r, "native"), d.className = "mint-select-native-control", d.id = `${i}-native`, d.name = this.getAttribute("name") || "", d.multiple = this.isMultiple(), this.hasAttribute("form") && d.setAttribute("form", this.getAttribute("form") || ""), d.required = this.isRequired(), d.disabled = this.isDisabled(), d.tabIndex = -1, d.setAttribute("aria-hidden", "true"), d.setAttribute("aria-invalid", String(this.hasError()));
|
|
436
|
+
let f = [
|
|
437
|
+
this.getAttribute("aria-describedby"),
|
|
438
|
+
n ? `${i}-label` : "",
|
|
439
|
+
this.getAttribute("info") ? `${i}-info` : "",
|
|
440
|
+
this.getAttribute("error-message") ? `${i}-error` : ""
|
|
441
|
+
].filter(Boolean).join(" ");
|
|
442
|
+
if (f && d.setAttribute("aria-describedby", f), this.options().forEach((e) => d.append(e.cloneNode(!0))), !d.options.length) {
|
|
443
|
+
let e = document.createElement("option");
|
|
444
|
+
e.value = "", e.textContent = this.getAttribute("placeholder") || "Select an option", e.disabled = !0, d.append(e);
|
|
445
|
+
}
|
|
446
|
+
if (d.multiple) {
|
|
447
|
+
let n = t.length ? t : this.parseValues(this.getAttribute("values")).length ? this.parseValues(this.getAttribute("values")) : e ? [e] : [];
|
|
448
|
+
n.length && Array.from(d.options).forEach((e) => {
|
|
449
|
+
e.selected = n.includes(e.value);
|
|
450
|
+
});
|
|
451
|
+
} else d.value = e;
|
|
452
|
+
a.append(d), this._native = d, this._trigger = o;
|
|
453
|
+
let p = document.createElement("mint-popover");
|
|
454
|
+
p.className = "mint-select-popover", p.setAttribute(r, "popover"), p.setAttribute("trigger-id", o.id), p.setAttribute("trigger-toggle", "false"), p.setAttribute("direction", "down"), p.setAttribute("trigger-align", "start"), p.setAttribute("align-selected", "true"), p.setAttribute("distance", "4"), p.setAttribute("padding", "0"), p.setAttribute("aria-label", n ? `${n} options` : "Select options");
|
|
455
|
+
let m = document.createElement("div");
|
|
456
|
+
m.className = "mint-select-options", m.id = `${i}-listbox`, m.setAttribute("role", "listbox"), m.setAttribute("aria-multiselectable", String(this.isMultiple())), o.setAttribute("aria-controls", m.id), p.append(m), this.append(p), this._popover = p, this._list = m, this.renderOptions(), this.updateDisplay(), this.bindEvents();
|
|
457
|
+
let h = this.getAttribute("info");
|
|
458
|
+
if (h) {
|
|
459
|
+
let e = document.createElement("div");
|
|
460
|
+
e.setAttribute(r, "info"), e.className = "mint-select-info", e.id = `${i}-info`, e.textContent = h, this.append(e);
|
|
461
|
+
}
|
|
462
|
+
let g = this.getAttribute("error-message");
|
|
463
|
+
if (this.hasError() && g) {
|
|
464
|
+
let e = document.createElement("div");
|
|
465
|
+
e.setAttribute(r, "error"), e.className = "mint-select-error", e.id = `${i}-error`, e.textContent = g, this.append(e);
|
|
466
|
+
}
|
|
467
|
+
this._syncing = !1;
|
|
468
|
+
}
|
|
469
|
+
renderOptions() {
|
|
470
|
+
this._list && (this._list.replaceChildren(), Array.from(this.children).filter((e) => e.tagName === "OPTION" || e.tagName === "OPTGROUP").forEach((e) => {
|
|
471
|
+
if (e instanceof HTMLOptGroupElement) {
|
|
472
|
+
let t = document.createElement("div");
|
|
473
|
+
t.className = "mint-select-group-label", t.setAttribute("role", "presentation"), t.textContent = e.label, this._list.append(t), Array.from(e.children).forEach((t) => this.addOption(t, e.disabled));
|
|
474
|
+
} else this.addOption(e, !1);
|
|
475
|
+
}));
|
|
476
|
+
}
|
|
477
|
+
addOption(e, t) {
|
|
478
|
+
if (!this._list) return;
|
|
479
|
+
let n = document.createElement("button");
|
|
480
|
+
n.type = "button", n.className = "mint-select-option", n.dataset.value = e.value, n.setAttribute("role", "option"), n.setAttribute("aria-selected", String(this.isMultiple() ? this.values.includes(e.value) : e.value === this.value)), n.disabled = e.disabled || t || this.isDisabled(), n.tabIndex = -1;
|
|
481
|
+
let r = document.createElement("span");
|
|
482
|
+
r.textContent = e.label || e.textContent || "", n.append(r);
|
|
483
|
+
let i = document.createElement("mint-icon");
|
|
484
|
+
i.setAttribute("name", "check"), i.setAttribute("aria-hidden", "true"), i.className = "mint-select-option-check", n.append(i), this._list.append(n);
|
|
485
|
+
}
|
|
486
|
+
updateDisplay() {
|
|
487
|
+
if (!this._native || !this._trigger) return;
|
|
488
|
+
let e = this.selectedOption(), t = this.values, n = this.isMultiple() ? t.map((e) => this.options().find((t) => t.value === e)?.label || e) : [], r = this._trigger.querySelector(".mint-select-value");
|
|
489
|
+
r && (r.textContent = this.isMultiple() ? n.join(", ") || this.getAttribute("placeholder") || "Select an option" : e?.label || e?.textContent?.trim() || this.getAttribute("placeholder") || "Select an option", r.classList.toggle("is-placeholder", this.isMultiple() ? t.length === 0 : !e || e.value === "")), this._trigger.setAttribute("aria-invalid", String(this.hasError())), this._trigger.setAttribute("aria-haspopup", "listbox"), this._list?.setAttribute("aria-multiselectable", String(this.isMultiple())), this._list?.querySelectorAll("[role=\"option\"]").forEach((e) => e.setAttribute("aria-selected", String(this.isMultiple() ? t.includes(e.dataset.value || "") : e.dataset.value === this._native.value)));
|
|
490
|
+
}
|
|
491
|
+
bindEvents() {
|
|
492
|
+
!this._trigger || !this._popover || !this._native || !this._list || (this._trigger.onclick = () => {
|
|
493
|
+
this._popover.style.setProperty("--mint-select-popover-width", `${this._trigger.getBoundingClientRect().width}px`), this._popover.hasAttribute("open") ? this._popover.close() : this._popover.open();
|
|
494
|
+
}, this._trigger.onkeydown = (e) => {
|
|
495
|
+
let t = Array.from(this._list.querySelectorAll("[role=\"option\"]:not(:disabled)"));
|
|
496
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
497
|
+
e.preventDefault(), this._popover.hasAttribute("open") || this._popover.open();
|
|
498
|
+
let n = t.findIndex((e) => e.dataset.value === (this.isMultiple() ? this.values[0] : this._native.value));
|
|
499
|
+
t[e.key === "ArrowDown" ? Math.min(t.length - 1, n + 1) : Math.max(0, n <= 0 ? 0 : n - 1)]?.focus();
|
|
500
|
+
} else if (e.key === "Enter" || e.key === " ") if (this._popover.hasAttribute("open")) {
|
|
501
|
+
e.preventDefault();
|
|
502
|
+
let t = this._list.querySelector("[role=\"option\"]:focus");
|
|
503
|
+
t ? this.selectOption(t.dataset.value || "") : this._popover.open();
|
|
504
|
+
} else e.key === " " && (e.preventDefault(), this._popover.open());
|
|
505
|
+
else e.key === "Escape" && this._popover.hasAttribute("open") ? (e.preventDefault(), this._popover.close(), this._trigger.focus()) : e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && this.typeahead(e.key);
|
|
506
|
+
}, this._list.onclick = (e) => {
|
|
507
|
+
let t = e.target.closest("[role=\"option\"]");
|
|
508
|
+
t && !t.disabled && this.selectOption(t.dataset.value || "");
|
|
509
|
+
}, this._list.onkeydown = (e) => {
|
|
510
|
+
let t = Array.from(this._list.querySelectorAll("[role=\"option\"]:not(:disabled)")), n = t.indexOf(e.target), r = n;
|
|
511
|
+
if (e.key === "ArrowDown") r = Math.min(t.length - 1, n + 1);
|
|
512
|
+
else if (e.key === "ArrowUp") r = Math.max(0, n - 1);
|
|
513
|
+
else if (e.key === "Home") r = 0;
|
|
514
|
+
else if (e.key === "End") r = t.length - 1;
|
|
515
|
+
else if (e.key === "Escape") {
|
|
516
|
+
e.preventDefault(), this._popover.close(), this._trigger.focus();
|
|
517
|
+
return;
|
|
518
|
+
} else if (e.key === "Enter" || e.key === " ") {
|
|
519
|
+
e.preventDefault(), this.selectOption(e.target.dataset.value || "");
|
|
520
|
+
return;
|
|
521
|
+
} else if (e.key.length === 1) {
|
|
522
|
+
this.typeahead(e.key);
|
|
523
|
+
return;
|
|
524
|
+
} else return;
|
|
525
|
+
e.preventDefault(), t[r]?.focus();
|
|
526
|
+
}, this._native.onchange = () => {
|
|
527
|
+
this.isMultiple() ? this.setAttribute("values", JSON.stringify(this.values)) : this.setAttribute("value", this._native.value), this.updateDisplay(), this.dispatchSelectionEvents();
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
selectOption(e) {
|
|
531
|
+
if (this._native) {
|
|
532
|
+
if (this.isMultiple()) {
|
|
533
|
+
let t = new Set(this.values);
|
|
534
|
+
t.has(e) ? t.delete(e) : t.add(e);
|
|
535
|
+
let n = [...t];
|
|
536
|
+
this._applyValues(n), this.setAttribute("values", JSON.stringify(n)), this.updateDisplay(), this.dispatchSelectionEvents();
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
this._native.value = e, this.setAttribute("value", e), this.updateDisplay(), this._popover?.close(), this._trigger?.focus(), this.dispatchSelectionEvents();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
dispatchSelectionEvents() {
|
|
543
|
+
let e = this.isMultiple() ? this.values : this._native?.value || "", t = this.isMultiple() ? {
|
|
544
|
+
value: e,
|
|
545
|
+
values: e
|
|
546
|
+
} : { value: e };
|
|
547
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
548
|
+
bubbles: !0,
|
|
549
|
+
composed: !0,
|
|
550
|
+
detail: t
|
|
551
|
+
})), this.dispatchEvent(new CustomEvent("change", {
|
|
552
|
+
bubbles: !0,
|
|
553
|
+
composed: !0,
|
|
554
|
+
detail: t
|
|
555
|
+
}));
|
|
556
|
+
}
|
|
557
|
+
typeahead(e) {
|
|
558
|
+
this._typeahead += e.toLocaleLowerCase(), this._typeaheadTimer !== null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => {
|
|
559
|
+
this._typeahead = "";
|
|
560
|
+
}, 700);
|
|
561
|
+
let t = Array.from(this._list?.querySelectorAll("[role=\"option\"]:not(:disabled)") || []).find((e) => e.textContent?.trim().toLocaleLowerCase().startsWith(this._typeahead));
|
|
562
|
+
t && (this._popover?.hasAttribute("open") || this._popover?.open(), t.focus());
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
customElements.get("mint-select") || e("mint-select", i);
|
|
272
566
|
//#endregion
|
|
273
|
-
export { n as default };
|
|
567
|
+
export { n as NativeSelect, i as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/SideNavigation.ts"],"names":[],"mappings":"AAGA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,4BAA4B,CAAA;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,sBAAsB,CAAC,EAAE,OAAO,CAAA;KACjC;CACF;AAyBD,cAAM,kBAAmB,SAAQ,WAAW;IAC1C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,mBAAmB,CAA4B;IACvD,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,cAAc,CAAyE;IAC/F,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,iBAAiB,CAA4B;IACrD,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAsB;IAE1C,kFAAkF;IAClF,OAAO,CAAC,yBAAyB,CAmBhC;IAED,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAiB5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,oBAAoB;IAQ5B,wFAAwF;IACxF,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,wBAAwB;IAchC,WAAW,IAAI,MAAM;IAIrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAiBpB,MAAM,IAAI,IAAI;CAQf;AAMD,eAAe,kBAAkB,CAAA"}
|
|
@@ -20,11 +20,12 @@ import "../chunks/icon-Cxv9k3CY.js";
|
|
|
20
20
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
21
21
|
import "../chunks/icon-DMa6Oo80.js";
|
|
22
22
|
import "../chunks/text-Bmfl6CxJ.js";
|
|
23
|
-
import "../chunks/caret-right-
|
|
23
|
+
import "../chunks/caret-right-CgIVfus7.js";
|
|
24
24
|
import "../chunks/caret-down-DJvCrCjc.js";
|
|
25
|
-
import "../chunks/popover-
|
|
25
|
+
import "../chunks/popover-FdMS4yAD.js";
|
|
26
|
+
import { n as t } from "../chunks/ScrollFade-D1FPF6ZS.js";
|
|
26
27
|
//#region src/components/side-navigation/SideNavigationLink.ts
|
|
27
|
-
var
|
|
28
|
+
var n = class extends HTMLElement {
|
|
28
29
|
constructor(...e) {
|
|
29
30
|
super(...e), this._trigger = null, this._submenuContainer = null, this._contentObserver = null, this._renderFrame = null;
|
|
30
31
|
}
|
|
@@ -158,10 +159,10 @@ var t = class extends HTMLElement {
|
|
|
158
159
|
this._hasSubmenu() && !this._isSubmenuItem() ? this._buildDropdownLink() : this._buildSimpleLink();
|
|
159
160
|
}
|
|
160
161
|
};
|
|
161
|
-
customElements.get("mint-sidenav-link") || e("mint-sidenav-link",
|
|
162
|
+
customElements.get("mint-sidenav-link") || e("mint-sidenav-link", n);
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/components/side-navigation/SideNavigationLinks.ts
|
|
164
|
-
var
|
|
165
|
+
var r = class extends HTMLElement {
|
|
165
166
|
constructor(...e) {
|
|
166
167
|
super(...e), this._container = null, this._title = null, this._titleLabel = null, this._titleCaret = null, this._titleIsInteractive = null, this._list = null, this._titleClickHandler = null, this._listenerCounts = /* @__PURE__ */ new Map();
|
|
167
168
|
}
|
|
@@ -224,10 +225,10 @@ var n = class extends HTMLElement {
|
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
};
|
|
227
|
-
customElements.get("mint-sidenav-links") || e("mint-sidenav-links",
|
|
228
|
+
customElements.get("mint-sidenav-links") || e("mint-sidenav-links", r);
|
|
228
229
|
//#endregion
|
|
229
230
|
//#region src/components/side-navigation/SideNavigationActionLinks.ts
|
|
230
|
-
var
|
|
231
|
+
var i = class extends HTMLElement {
|
|
231
232
|
static get observedAttributes() {
|
|
232
233
|
return ["separated"];
|
|
233
234
|
}
|
|
@@ -244,10 +245,10 @@ var r = class extends HTMLElement {
|
|
|
244
245
|
this.className = this._isSeparated() ? "mint-sidenav-action-links is-separated" : "mint-sidenav-action-links";
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
|
-
customElements.get("mint-sidenav-action-links") || e("mint-sidenav-action-links",
|
|
248
|
+
customElements.get("mint-sidenav-action-links") || e("mint-sidenav-action-links", i);
|
|
248
249
|
//#endregion
|
|
249
250
|
//#region src/components/side-navigation/SideNavigationActionMenu.ts
|
|
250
|
-
var
|
|
251
|
+
var a = class extends HTMLElement {
|
|
251
252
|
constructor(...e) {
|
|
252
253
|
super(...e), this._wrapper = null, this._trigger = null, this._popover = null, this._triggerId = "", this._contentObserver = null, this._renderFrame = null;
|
|
253
254
|
}
|
|
@@ -314,15 +315,15 @@ var i = class extends HTMLElement {
|
|
|
314
315
|
}) : a.appendChild(this._createDefaultGroup()), this._popover.appendChild(a), this._wrapper.appendChild(this._trigger), this._wrapper.appendChild(this._popover);
|
|
315
316
|
}
|
|
316
317
|
};
|
|
317
|
-
customElements.get("mint-sidenav-action-menu") || e("mint-sidenav-action-menu",
|
|
318
|
+
customElements.get("mint-sidenav-action-menu") || e("mint-sidenav-action-menu", a);
|
|
318
319
|
//#endregion
|
|
319
320
|
//#region src/components/side-navigation/SideNavigation.ts
|
|
320
|
-
var
|
|
321
|
-
function
|
|
321
|
+
var o = "mint:url-change";
|
|
322
|
+
function s() {
|
|
322
323
|
if (window.__mintUrlChangePatched) return;
|
|
323
324
|
window.__mintUrlChangePatched = !0;
|
|
324
325
|
let e = () => {
|
|
325
|
-
window.dispatchEvent(new Event(
|
|
326
|
+
window.dispatchEvent(new Event(o));
|
|
326
327
|
}, t = (t) => {
|
|
327
328
|
let n = history[t].bind(history);
|
|
328
329
|
history[t] = ((...t) => {
|
|
@@ -332,9 +333,9 @@ function o() {
|
|
|
332
333
|
};
|
|
333
334
|
t("pushState"), t("replaceState");
|
|
334
335
|
}
|
|
335
|
-
var
|
|
336
|
+
var c = class extends HTMLElement {
|
|
336
337
|
constructor(...e) {
|
|
337
|
-
super(...e), this._backdrop = null, this._container = null, this._header = null, this._content = null, this._footer = null, this._escapeHandler = null, this._mediaQuery = null, this._mediaListener = null, this._accordionHandler = null, this._urlChangeHandler = null, this._contentObserver = null, this._renderFrame = null, this._onMobileNavNavigateClick = (e) => {
|
|
338
|
+
super(...e), this._backdrop = null, this._container = null, this._header = null, this._content = null, this._disposeContentFade = null, this._footer = null, this._escapeHandler = null, this._mediaQuery = null, this._mediaListener = null, this._accordionHandler = null, this._urlChangeHandler = null, this._contentObserver = null, this._renderFrame = null, this._onMobileNavNavigateClick = (e) => {
|
|
338
339
|
if (this._mediaQuery?.matches) return;
|
|
339
340
|
let t = e.target;
|
|
340
341
|
if (!(t instanceof Element)) return;
|
|
@@ -357,7 +358,7 @@ var s = class extends HTMLElement {
|
|
|
357
358
|
this._attachEscapeListener(), this._attachMediaListener(), this._attachAccordionListener(), this._attachUrlChangeListener(), this._observeContentMutations(), this.render();
|
|
358
359
|
}
|
|
359
360
|
disconnectedCallback() {
|
|
360
|
-
this._detachEscapeListener(), this._detachMediaListener(), this._detachAccordionListener(), this._detachUrlChangeListener(), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null);
|
|
361
|
+
this._detachEscapeListener(), this._detachMediaListener(), this._detachAccordionListener(), this._detachUrlChangeListener(), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._disposeContentFade?.(), this._disposeContentFade = null, this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null);
|
|
361
362
|
}
|
|
362
363
|
attributeChangedCallback(e, t, n) {
|
|
363
364
|
t !== n && this.render();
|
|
@@ -395,12 +396,12 @@ var s = class extends HTMLElement {
|
|
|
395
396
|
this._accordionHandler &&= (this.removeEventListener("mint-sidenav-accordion", this._accordionHandler), null);
|
|
396
397
|
}
|
|
397
398
|
_attachUrlChangeListener() {
|
|
398
|
-
this._urlChangeHandler || (
|
|
399
|
+
this._urlChangeHandler || (s(), this._urlChangeHandler = () => {
|
|
399
400
|
this._mediaQuery?.matches || this._isOpen() && this.removeAttribute("open");
|
|
400
|
-
}, window.addEventListener("popstate", this._urlChangeHandler), window.addEventListener("hashchange", this._urlChangeHandler), window.addEventListener(
|
|
401
|
+
}, window.addEventListener("popstate", this._urlChangeHandler), window.addEventListener("hashchange", this._urlChangeHandler), window.addEventListener(o, this._urlChangeHandler));
|
|
401
402
|
}
|
|
402
403
|
_detachUrlChangeListener() {
|
|
403
|
-
this._urlChangeHandler &&= (window.removeEventListener("popstate", this._urlChangeHandler), window.removeEventListener("hashchange", this._urlChangeHandler), window.removeEventListener(
|
|
404
|
+
this._urlChangeHandler &&= (window.removeEventListener("popstate", this._urlChangeHandler), window.removeEventListener("hashchange", this._urlChangeHandler), window.removeEventListener(o, this._urlChangeHandler), null);
|
|
404
405
|
}
|
|
405
406
|
_observeContentMutations() {
|
|
406
407
|
this._contentObserver ||= new MutationObserver(() => {
|
|
@@ -446,7 +447,7 @@ var s = class extends HTMLElement {
|
|
|
446
447
|
e.replaceChildren(...n);
|
|
447
448
|
}
|
|
448
449
|
_buildContent() {
|
|
449
|
-
this._container && (this._content || (this._content = document.createElement("div"), this._content.className = "mint-sidenav-content", this._container.appendChild(this._content)), this._replaceSlottedChildren(this._content, "links"));
|
|
450
|
+
this._container && (this._content || (this._content = document.createElement("div"), this._content.className = "mint-sidenav-content", this._container.appendChild(this._content)), this._replaceSlottedChildren(this._content, "links"), this._disposeContentFade ||= t(this._content, "vertical"));
|
|
450
451
|
}
|
|
451
452
|
_buildFooter() {
|
|
452
453
|
if (!this._container) return;
|
|
@@ -458,9 +459,9 @@ var s = class extends HTMLElement {
|
|
|
458
459
|
this._ensureBackdrop(), this._ensureContainer(), this._syncShell(), this._buildUserHeader(), this._buildContent(), this._buildFooter();
|
|
459
460
|
}
|
|
460
461
|
};
|
|
461
|
-
customElements.get("mint-side-navigation") || e("mint-side-navigation",
|
|
462
|
+
customElements.get("mint-side-navigation") || e("mint-side-navigation", c);
|
|
462
463
|
//#endregion
|
|
463
464
|
//#region src/components/side-navigation/index.ts
|
|
464
|
-
var
|
|
465
|
+
var l = c;
|
|
465
466
|
//#endregion
|
|
466
|
-
export {
|
|
467
|
+
export { i as MintSidenavActionLinks, a as MintSidenavActionMenu, n as MintSidenavLink, r as MintSidenavLinks, l as default };
|