monobill-mintui 0.6.718 → 0.6.721
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 +1 -0
- package/dist/checkbox.css +1 -1
- package/dist/components/alert/browser.js +4 -4
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/back-button/browser.js +1 -1
- package/dist/components/back-button/index.cjs +1 -1
- package/dist/components/back-button/index.js +1 -1
- package/dist/components/bottom-navigation/browser.js +2 -2
- package/dist/components/bottom-navigation/index.cjs +1 -1
- package/dist/components/bottom-navigation/index.js +2 -2
- package/dist/components/button/browser.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +3 -0
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/browser.js +2 -186
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +2 -186
- package/dist/components/chip/browser.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chunks/{back-button-By8eO_KR.js → back-button-C0ajSqKu.js} +2 -2
- package/dist/components/chunks/{back-button-BGzrOtpx.js → back-button-Dw4NF_vN.js} +1 -1
- package/dist/components/chunks/{button-B_yN18B-.js → button-B4BMYTk1.js} +1 -1
- package/dist/components/chunks/{button-JPTyQfRs.js → button-BTQHrE0x.js} +2 -2
- package/dist/components/chunks/caret-down-DbFlPN-2.js +1 -0
- package/dist/components/chunks/{caret-down-ZjQN2yKq.js → caret-down-pn6aBT-u.js} +1 -1
- package/dist/components/chunks/caret-right-B8gOXLh9.js +1 -0
- package/dist/components/chunks/{caret-right-BlRbsLlh.js → caret-right-DDGEbhEH.js} +1 -1
- package/dist/components/chunks/checkbox-BKU8fiY7.js +1 -0
- package/dist/components/chunks/checkbox-p-Fb5ojp.js +193 -0
- package/dist/components/chunks/{chip-BUaS7ks-.js → chip-B0kg_vr8.js} +1 -1
- package/dist/components/chunks/{chip-XuYPtZ3Z.js → chip-bcCOd6-h.js} +3 -3
- package/dist/components/chunks/{close-Cn8XLO1c.js → close-8VXvDCau.js} +1 -1
- package/dist/components/chunks/close-CWAmmMRg.js +1 -0
- package/dist/components/chunks/{confirm-action-CX_FEzCR.js → confirm-action-BW1UwJNu.js} +2 -2
- package/dist/components/chunks/{confirm-action-86hDdUKT.js → confirm-action-sovGys0x.js} +1 -1
- package/dist/components/chunks/{date-picker-J8AtC8Py.js → date-picker-CDEVgbw7.js} +1 -1
- package/dist/components/chunks/{date-picker-BLqafHuc.js → date-picker-R2gbHZCP.js} +5 -5
- package/dist/components/chunks/{icon-CWOP4Com.js → icon-B9P0jyS2.js} +6 -6
- package/dist/components/chunks/icon-CIAsmizQ.js +1 -0
- package/dist/components/chunks/icon-Cia9x_J2.js +1 -0
- package/dist/components/chunks/{icon-hyFz3uhh.js → icon-DAB2KLeo.js} +217 -207
- package/dist/components/chunks/{input-BI4nrOaG.js → input-BXC4lMG_.js} +1 -1
- package/dist/components/chunks/{input-B-njkq5j.js → input-B_q63xQu.js} +3 -3
- package/dist/components/chunks/{modal-BEv3P1P0.js → modal-BixpSAyU.js} +10 -30
- package/dist/components/chunks/{modal-ux6cqTde.js → modal-BrIOYE1W.js} +1 -1
- package/dist/components/chunks/{popover-0YEhBrgv.js → popover-CWWKb7L1.js} +1 -1
- package/dist/components/chunks/{popover-CE2t5dKP.js → popover-DPNBidSz.js} +1 -1
- package/dist/components/chunks/search-CGQa7dR2.js +1 -0
- package/dist/components/chunks/{search-BwjKBnv9.js → search-COAeeXxO.js} +1 -1
- package/dist/components/chunks/{select-DS2CJyXR.js → select-CHImyDWO.js} +1 -1
- package/dist/components/chunks/{select-DDnYtBVR.js → select-CnN6eiFK.js} +3 -3
- package/dist/components/chunks/{table-slcPmVWy.js → table-B_S4xwx3.js} +1 -1
- package/dist/components/chunks/{table-B_g7lNzN.js → table-C6ufpGLx.js} +1 -1
- package/dist/components/chunks/{time-picker-EAyF05v1.js → time-picker-CijVykQ3.js} +1 -1
- package/dist/components/chunks/{time-picker-MtNyIZFb.js → time-picker-NksIqyuD.js} +3 -3
- package/dist/components/chunks/{warning-DKCaTYO6.js → warning-CVnTPaMj.js} +1 -1
- package/dist/components/chunks/{warning-DAYbxh3S.js → warning-vve-cXPr.js} +1 -1
- package/dist/components/confirm-action/browser.js +1 -1
- package/dist/components/confirm-action/index.cjs +1 -1
- package/dist/components/confirm-action/index.js +1 -1
- package/dist/components/date-picker/browser.js +1 -1
- package/dist/components/date-picker/index.cjs +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/datetime-picker/browser.js +3 -3
- package/dist/components/datetime-picker/index.cjs +1 -1
- package/dist/components/datetime-picker/index.js +3 -3
- package/dist/components/dropzone/browser.js +4 -4
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +4 -4
- package/dist/components/icon/browser.js +1 -1
- package/dist/components/icon/icons/code.d.ts +3 -0
- package/dist/components/icon/icons/code.d.ts.map +1 -0
- package/dist/components/icon/icons/index.d.ts +1 -0
- package/dist/components/icon/icons/index.d.ts.map +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- 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/modal/Modal.d.ts +0 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/browser.js +1 -1
- package/dist/components/modal/index.cjs +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/navigation/browser.js +4 -4
- package/dist/components/navigation/index.cjs +1 -1
- package/dist/components/navigation/index.js +4 -4
- package/dist/components/off-canvas/browser.js +3 -3
- package/dist/components/off-canvas/index.cjs +1 -1
- package/dist/components/off-canvas/index.js +3 -3
- package/dist/components/page/browser.js +4 -4
- package/dist/components/page/index.cjs +1 -1
- package/dist/components/page/index.js +4 -4
- 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 +25 -0
- package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
- package/dist/components/resource-table/browser.js +127 -35
- package/dist/components/resource-table/index.cjs +2 -2
- package/dist/components/resource-table/index.js +127 -35
- package/dist/components/scroll-fade/browser.js +1 -1
- package/dist/components/scroll-fade/index.cjs +1 -1
- package/dist/components/scroll-fade/index.js +1 -1
- package/dist/components/search/browser.js +7 -7
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +7 -7
- package/dist/components/select/browser.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/side-navigation/browser.js +6 -6
- package/dist/components/side-navigation/index.cjs +1 -1
- package/dist/components/side-navigation/index.js +6 -6
- 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/stack/browser.js +1 -1
- package/dist/components/stack/index.cjs +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/switch/browser.js +2 -2
- package/dist/components/switch/index.cjs +1 -1
- package/dist/components/switch/index.js +2 -2
- 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/tabs/browser.js +1 -1
- package/dist/components/tabs/index.cjs +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tags/browser.js +4 -4
- package/dist/components/tags/index.cjs +1 -1
- package/dist/components/tags/index.js +4 -4
- package/dist/components/time-picker/browser.js +1 -1
- package/dist/components/time-picker/index.cjs +1 -1
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/tree/browser.js +5 -5
- package/dist/components/tree/index.cjs +1 -1
- package/dist/components/tree/index.js +5 -5
- package/dist/icons/code.svg +3 -0
- package/dist/index.cjs +11 -11
- package/dist/index.css +3 -3
- package/dist/index.js +521 -434
- package/dist/modal.css +1 -1
- package/dist/navigation-search.json +7 -0
- package/dist/resource-table.css +1 -1
- package/package.json +1 -1
- package/dist/components/chunks/caret-down-BFHFcMyL.js +0 -1
- package/dist/components/chunks/caret-right--YnEL-Ny.js +0 -1
- package/dist/components/chunks/close-DSrpkGHJ.js +0 -1
- package/dist/components/chunks/icon-D6C1XGp2.js +0 -1
- package/dist/components/chunks/icon-l34kRIZg.js +0 -1
- package/dist/components/chunks/search-q3dkl4-X.js +0 -1
- /package/dist/components/chunks/{ScrollFade-DvzPIk2A.js → ScrollFade-Cg9fVO0V.js} +0 -0
- /package/dist/components/chunks/{ScrollFade-BMs09zZN.js → ScrollFade-Dfq2B1Hm.js} +0 -0
- /package/dist/components/chunks/{link-DVKhDl3O.js → link-B_fNmwOk.js} +0 -0
- /package/dist/components/chunks/{link-ACOyvLkd.js → link-BxTQfAW9.js} +0 -0
- /package/dist/components/chunks/{sortable-BSw58wy_.js → sortable-Bql13n3L.js} +0 -0
- /package/dist/components/chunks/{sortable-D3et5wXB.js → sortable-DdT2ptc5.js} +0 -0
- /package/dist/components/chunks/{stack-DEIdHS0n.js → stack-CK2o4-As.js} +0 -0
- /package/dist/components/chunks/{stack-CzcHNnl8.js → stack-CKUu8IVZ.js} +0 -0
|
@@ -1,189 +1,5 @@
|
|
|
1
1
|
import '../../theme.css'
|
|
2
2
|
import '../../icon.css'
|
|
3
3
|
import '../../checkbox.css'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import "../chunks/icon-l34kRIZg.js";
|
|
7
|
-
e({
|
|
8
|
-
name: "check",
|
|
9
|
-
viewBox: "0 0 24 24",
|
|
10
|
-
path: "M5 13l4 4L19 7",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
strokeWidth: "3.2"
|
|
14
|
-
});
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/components/checkbox/Checkbox.js
|
|
17
|
-
var n = class extends HTMLElement {
|
|
18
|
-
static get observedAttributes() {
|
|
19
|
-
return [
|
|
20
|
-
"checked",
|
|
21
|
-
"disabled",
|
|
22
|
-
"label",
|
|
23
|
-
"info",
|
|
24
|
-
"id",
|
|
25
|
-
"name",
|
|
26
|
-
"value",
|
|
27
|
-
"loading"
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
constructor() {
|
|
31
|
-
super(), this._checkbox = null, this._checked = !1, this._clickHandler = null;
|
|
32
|
-
}
|
|
33
|
-
connectedCallback() {
|
|
34
|
-
let e = this.getAttribute("checked");
|
|
35
|
-
this._checked = e !== null && e !== "false", this.render();
|
|
36
|
-
}
|
|
37
|
-
disconnectedCallback() {
|
|
38
|
-
this.removeEventListeners();
|
|
39
|
-
}
|
|
40
|
-
attributeChangedCallback(e, t, n) {
|
|
41
|
-
e === "checked" && (this._checked = n !== null && n !== "false", this._checkbox && (this._checkbox.checked = this._checked)), t !== n && (this.render(), e === "checked" && this._checkbox && this.updateVisualState());
|
|
42
|
-
}
|
|
43
|
-
get checked() {
|
|
44
|
-
return this._checked;
|
|
45
|
-
}
|
|
46
|
-
set checked(e) {
|
|
47
|
-
e ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._checked = !!e, this._checkbox && (this._checkbox.checked = this._checked), this.updateVisualState();
|
|
48
|
-
}
|
|
49
|
-
isDisabled() {
|
|
50
|
-
return this.hasAttribute("disabled") || this.getAttribute("loading") === "true";
|
|
51
|
-
}
|
|
52
|
-
getLabel() {
|
|
53
|
-
return this.getAttribute("label") || "";
|
|
54
|
-
}
|
|
55
|
-
getInfo() {
|
|
56
|
-
return this.getAttribute("info") || "";
|
|
57
|
-
}
|
|
58
|
-
getId() {
|
|
59
|
-
return this.getAttribute("id") || "";
|
|
60
|
-
}
|
|
61
|
-
getName() {
|
|
62
|
-
return this.getAttribute("name") || "";
|
|
63
|
-
}
|
|
64
|
-
getValue() {
|
|
65
|
-
return this.getAttribute("value") || "";
|
|
66
|
-
}
|
|
67
|
-
getCheckboxClasses() {
|
|
68
|
-
return "mint-checkbox-control";
|
|
69
|
-
}
|
|
70
|
-
render() {
|
|
71
|
-
let e = this.getAttribute("loading") === "true";
|
|
72
|
-
this.toggleAttribute("aria-busy", e);
|
|
73
|
-
let t = this.getLabel(), n = this.getInfo(), r = this.isDisabled(), i = this.querySelector(".mint-checkbox-wrapper");
|
|
74
|
-
i || (i = document.createElement("div"), i.className = "mint-checkbox-wrapper", this.insertBefore(i, this.firstChild)), this._checkbox ? this._checkbox.parentElement !== i && i.appendChild(this._checkbox) : (this._checkbox = document.createElement("input"), this._checkbox.type = "checkbox", i.appendChild(this._checkbox), this.setupEventListeners()), this._checkbox.className = "mint-input-overlay", this._checkbox.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;", this._checkbox.checked = this._checked, this._checkbox.disabled = r, this._changeHandler || this.setupEventListeners();
|
|
75
|
-
let a = this.getId();
|
|
76
|
-
a ? this._checkbox.id = a : this._checkbox.removeAttribute("id");
|
|
77
|
-
let o = this.getName();
|
|
78
|
-
o ? this._checkbox.name = o : this._checkbox.removeAttribute("name");
|
|
79
|
-
let s = this.getValue();
|
|
80
|
-
s ? this._checkbox.value = s : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), i.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, i.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
|
|
81
|
-
let c = i.querySelector("mint-icon");
|
|
82
|
-
c || (c = document.createElement("mint-icon"), c.setAttribute("name", "check"), c.className = "mint-checkbox-check", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", i.appendChild(c)), this.updateVisualState();
|
|
83
|
-
let l = this.querySelector(".mint-checkbox-label-container");
|
|
84
|
-
if (t || n) {
|
|
85
|
-
l || (l = document.createElement("div"), l.className = "mint-checkbox-label-container", this.appendChild(l));
|
|
86
|
-
let e = l.querySelector(".mint-checkbox-label");
|
|
87
|
-
t ? (e || (e = document.createElement("span"), e.className = "mint-checkbox-label", l.insertBefore(e, l.firstChild)), e.textContent = t, r ? e.style.opacity = "0.5" : e.style.opacity = "") : e && e.remove();
|
|
88
|
-
let i = l.querySelector(".mint-checkbox-info");
|
|
89
|
-
if (n ? (i || (i = document.createElement("span"), i.className = "mint-checkbox-info", l.appendChild(i)), i.textContent = n, r ? i.style.opacity = "0.5" : i.style.opacity = "") : i && i.remove(), r) l.style.cursor = "default", l._clickHandler && (l.removeEventListener("click", l._clickHandler), l._clickHandler = null);
|
|
90
|
-
else {
|
|
91
|
-
l.style.cursor = "pointer";
|
|
92
|
-
let e = l._clickHandler;
|
|
93
|
-
e && l.removeEventListener("click", e), l._clickHandler = (e) => {
|
|
94
|
-
this._checkbox && (e.target === this._checkbox || this._checkbox.contains(e.target) || e.composedPath().includes(this._checkbox)) || this.toggle();
|
|
95
|
-
}, l.addEventListener("click", l._clickHandler);
|
|
96
|
-
}
|
|
97
|
-
} else l && l.remove();
|
|
98
|
-
let u = this.querySelector(":scope > .mint-checkbox-loading-skeleton");
|
|
99
|
-
if (e) {
|
|
100
|
-
if (!u) {
|
|
101
|
-
u = document.createElement("div"), u.className = "mint-checkbox-loading-skeleton", u.setAttribute("aria-hidden", "true"), Object.assign(u.style, {
|
|
102
|
-
position: "absolute",
|
|
103
|
-
inset: "0",
|
|
104
|
-
display: "flex",
|
|
105
|
-
alignItems: "center",
|
|
106
|
-
gap: "0.5rem",
|
|
107
|
-
pointerEvents: "none",
|
|
108
|
-
zIndex: "20"
|
|
109
|
-
});
|
|
110
|
-
let e = document.createElement("span");
|
|
111
|
-
if (Object.assign(e.style, {
|
|
112
|
-
display: "block",
|
|
113
|
-
width: "1.25rem",
|
|
114
|
-
height: "1.25rem",
|
|
115
|
-
flex: "none",
|
|
116
|
-
borderRadius: "0.25rem",
|
|
117
|
-
background: "var(--mint-color-surface-control, #e8eee9)",
|
|
118
|
-
animation: "mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite"
|
|
119
|
-
}), u.appendChild(e), t) {
|
|
120
|
-
let e = document.createElement("span");
|
|
121
|
-
Object.assign(e.style, {
|
|
122
|
-
display: "block",
|
|
123
|
-
width: "6rem",
|
|
124
|
-
height: "1rem",
|
|
125
|
-
borderRadius: "0.35rem",
|
|
126
|
-
background: "var(--mint-color-surface-control, #e8eee9)",
|
|
127
|
-
animation: "mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite"
|
|
128
|
-
}), u.appendChild(e);
|
|
129
|
-
}
|
|
130
|
-
this.appendChild(u);
|
|
131
|
-
}
|
|
132
|
-
this.style.position = "relative", u.style.display = "flex", i.style.visibility = "hidden", l && (l.style.visibility = "hidden");
|
|
133
|
-
} else u && (u.style.display = "none"), i.style.visibility = "", l && (l.style.visibility = "");
|
|
134
|
-
}
|
|
135
|
-
setupEventListeners() {
|
|
136
|
-
this.removeEventListeners(), this._checkbox && (this._changeHandler = (e) => {
|
|
137
|
-
e.stopPropagation(), this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
|
|
138
|
-
let t = new CustomEvent("change", {
|
|
139
|
-
detail: {
|
|
140
|
-
checked: this._checked,
|
|
141
|
-
value: this.getValue()
|
|
142
|
-
},
|
|
143
|
-
bubbles: !0,
|
|
144
|
-
cancelable: !0
|
|
145
|
-
});
|
|
146
|
-
this.dispatchEvent(t);
|
|
147
|
-
}, this._checkbox.addEventListener("change", this._changeHandler), this._mousedownHandler = (e) => {
|
|
148
|
-
e.stopPropagation();
|
|
149
|
-
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
150
|
-
t && !this.isDisabled() && (t.classList.add("mint-checkbox-active"), this._checked ? (t.style.backgroundColor = "var(--mint-color-primary)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.3)") : (t.style.backgroundColor = "var(--mint-color-surface-hover)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.1)"));
|
|
151
|
-
}, this._mouseupHandler = (e) => {
|
|
152
|
-
e.stopPropagation();
|
|
153
|
-
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
154
|
-
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
155
|
-
}, this._mouseleaveHandler = (e) => {
|
|
156
|
-
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
157
|
-
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
158
|
-
}, this._checkbox.addEventListener("mousedown", this._mousedownHandler), this._checkbox.addEventListener("mouseup", this._mouseupHandler), this._checkbox.addEventListener("mouseleave", this._mouseleaveHandler), this._touchstartHandler = (e) => {
|
|
159
|
-
e.stopPropagation();
|
|
160
|
-
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
161
|
-
t && !this.isDisabled() && (t.classList.add("mint-checkbox-active"), this._checked ? (t.style.backgroundColor = "var(--mint-color-primary)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.3)") : (t.style.backgroundColor = "var(--mint-color-surface-hover)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.1)"));
|
|
162
|
-
}, this._touchendHandler = (e) => {
|
|
163
|
-
e.stopPropagation();
|
|
164
|
-
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
165
|
-
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
166
|
-
}, this._checkbox.addEventListener("touchstart", this._touchstartHandler), this._checkbox.addEventListener("touchend", this._touchendHandler));
|
|
167
|
-
}
|
|
168
|
-
removeEventListeners() {
|
|
169
|
-
this._checkbox && (this._changeHandler &&= (this._checkbox.removeEventListener("change", this._changeHandler), null), this._mousedownHandler &&= (this._checkbox.removeEventListener("mousedown", this._mousedownHandler), null), this._mouseupHandler &&= (this._checkbox.removeEventListener("mouseup", this._mouseupHandler), null), this._mouseleaveHandler &&= (this._checkbox.removeEventListener("mouseleave", this._mouseleaveHandler), null), this._touchstartHandler &&= (this._checkbox.removeEventListener("touchstart", this._touchstartHandler), null), this._touchendHandler &&= (this._checkbox.removeEventListener("touchend", this._touchendHandler), null));
|
|
170
|
-
}
|
|
171
|
-
updateVisualState() {
|
|
172
|
-
let e = this.querySelector(".mint-checkbox-wrapper"), t = e?.querySelector("mint-icon");
|
|
173
|
-
t && (t.style.opacity = this._checked ? "1" : "0", t.style.transform = this._checked ? "scale(1)" : "scale(0.8)"), e && (e.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, e.classList.contains("mint-checkbox-active") || (e.style.backgroundColor = "", e.style.boxShadow = ""));
|
|
174
|
-
}
|
|
175
|
-
toggle() {
|
|
176
|
-
if (this._checkbox && !this.isDisabled()) {
|
|
177
|
-
this._checkbox.checked = !this._checked, this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
|
|
178
|
-
let e = new CustomEvent("change", {
|
|
179
|
-
detail: { checked: this._checked },
|
|
180
|
-
bubbles: !0,
|
|
181
|
-
cancelable: !0
|
|
182
|
-
});
|
|
183
|
-
this.dispatchEvent(e);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
typeof customElements < "u" && !customElements.get("mint-checkbox") && t("mint-checkbox", n);
|
|
188
|
-
//#endregion
|
|
189
|
-
export { n as default };
|
|
4
|
+
import { t as e } from "../chunks/checkbox-p-Fb5ojp.js";
|
|
5
|
+
export { e as default };
|
|
@@ -13,5 +13,5 @@ const __mintLoadStyle = (key, url) => {
|
|
|
13
13
|
__mintLoadStyle('theme', '../../theme.css')
|
|
14
14
|
__mintLoadStyle('icon', '../../icon.css')
|
|
15
15
|
__mintLoadStyle('chip', '../../chip.css')
|
|
16
|
-
import { t as e } from "../chunks/chip-
|
|
16
|
+
import { t as e } from "../chunks/chip-bcCOd6-h.js";
|
|
17
17
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunks/chip-
|
|
1
|
+
const e=require(`../chunks/chip-B0kg_vr8.js`);module.exports=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./icon-CWOP4Com.js`),t=require(`./register-element-tCL_F1YI.js`);require(`./icon-D6C1XGp2.js`),/* empty css */require(`./spinner-CUcCgLKS.js`),e.a({name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});var n=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.hasAttribute(`disabled`)}isLoading(){return this.hasAttribute(`loading`)}getType(){return(this.getAttribute(`type`)||this.getAttribute(`button-type`)||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.hasAttribute(`full-width`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}isIconOnly(){if(!(this.getIcon()||this._button?.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent.trim())return!1;if(this._button){for(let e=this._button.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.TEXT_NODE&&e.textContent.trim()||e.nodeType===Node.ELEMENT_NODE&&e.tagName!==`MINT-ICON`&&e.tagName!==`MINT-SPINNER`&&!e.querySelector?.(`mint-spinner`)&&!e.hasAttribute?.(`slot`)&&e.className!==`mint-button-icon`&&!(e.className===`mr-2`&&e.querySelector(`mint-spinner`))&&e.textContent.trim())return!1}return!0}getButtonClasses(){return[`mint-button-core`,`mint-button-`+this.getVariant(),`mint-button-tone-`+this.getTone(),this.isIconOnly()?`mint-button-icon-only`:``,this.isFullWidth()?`mint-button-full-width`:``].filter(Boolean).join(` `)}render(){let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button),this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`);if(this.isLoading())if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),n.render();else{let e=document.createElement(`span`);e.className=`mint-button-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`1em`,t.style.height=`1em`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let r=this.getIcon(),i=this._button.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`);r?(i&&i.tagName!==`MINT-ICON`&&(i.remove(),i=null),!i||i.tagName!==`MINT-ICON`?(i=document.createElement(`mint-icon`),i.setAttribute(`name`,r),i.className=`mint-button-icon`):i.setAttribute(`name`,r)):i&&i.tagName===`MINT-ICON`&&(i.remove(),i=null),i||=this._button.querySelector(`[slot="icon"], .mint-button-icon`);let a=this.getIconPosition(),o=this._button.querySelector(`.mint-button-content`);if(o){let e=i&&i.tagName===`MINT-ICON`;if(i&&!i.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||a===`left`?t?t.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o):o.insertAdjacentElement(`afterend`,i)}else if(i&&(e||a===`left`)&&i.nextSibling!==o){i.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o)}else i&&!e&&a===`right`&&i.previousSibling!==o&&(i.remove(),o.insertAdjacentElement(`afterend`,i))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling)t.tagName!==`MINT-SPINNER`&&!t.querySelector?.(`mint-spinner`)&&t!==i&&!t.hasAttribute?.(`slot`)&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&e.push(t);if(e.length>0){o=document.createElement(`span`),o.className=`mint-button-content`,e.forEach(e=>{o.appendChild(e)});let t=this._button.querySelector(`mint-spinner`)?.parentElement;i&&a===`left`?t?(t.insertAdjacentElement(`afterend`,i),i.insertAdjacentElement(`afterend`,o)):(this._button.insertBefore(i,this._button.firstChild),i.insertAdjacentElement(`afterend`,o)):i&&a===`right`?t?(t.insertAdjacentElement(`afterend`,o),o.insertAdjacentElement(`afterend`,i)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement(`afterend`,i)):t?t.insertAdjacentElement(`afterend`,o):this._button.insertBefore(o,this._button.firstChild)}else if(i&&i.tagName===`MINT-ICON`&&!i.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,this._button.firstChild)}}let s=this._button.querySelector(`.mint-button-spinner-wrap`);if(i&&(i.style.display=this.isLoading()?`none`:``,this.isLoading()&&s)){s.setAttribute(`data-position`,a);let e=window.getComputedStyle(i),t=e.width,n=e.height;if(t!==`auto`&&t!==`0px`){s.style.width=t,s.style.flexBasis=t;let e=s.querySelector(`mint-spinner`);e&&(e.style.width=t)}if(n!==`auto`&&n!==`0px`){s.style.height=n;let e=s.querySelector(`mint-spinner`);e&&(e.style.height=n)}i.parentElement===this._button&&i.insertAdjacentElement(`beforebegin`,s)}let c=this.isIconOnly();this.isLoading()&&s&&(s.setAttribute(`data-position`,a),c?s.setAttribute(`data-icon-only`,`true`):s.removeAttribute(`data-icon-only`)),i&&(i.classList.contains(`mint-button-icon`)||i.classList.add(`mint-button-icon`),i.classList.remove(`mint-icon-leading`,`mint-icon-trailing`),c?i.tagName===`MINT-ICON`?(i.style.width=`1rem`,i.style.height=`1rem`,i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`):(i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`,i.tagName===`svg`&&(i.style.width=`1rem`,i.style.height=`1rem`)):a===`left`?i.classList.add(`mint-icon-leading`):i.classList.add(`mint-icon-trailing`));let l=this.getButtonClasses();this._button.className=l}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}_handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleMouseUp=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleMouseLeave=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleTouchEnd=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchCancel=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};typeof customElements<`u`&&!customElements.get(`mint-button`)&&t.t(`mint-button`,n);var r=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0}connectedCallback(){this.render(),this._setupHistoryTracking()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_setupHistoryTracking(){window.addEventListener(`popstate`,()=>{this._backAttempts=0}),this._historyDepth=window.history.length}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}handleClick(e){if(e.preventDefault(),e.stopPropagation(),window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;let e=window.location.href,t=Date.now();window.history.back(),setTimeout(()=>{Date.now()-t,window.location.href===e?this._navigateToFallback():setTimeout(()=>{this._backAttempts=0},500)},200)}else this._navigateToFallback()}_navigateToFallback(){let e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith(`/`)&&!e.startsWith(`//`))try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`));return}catch{}window.location.href=e}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`solid`),this._button.setAttribute(`tone`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||`Go back`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};typeof customElements<`u`&&!customElements.get(`mint-back-button`)&&t.t(`mint-back-button`,r),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
1
|
+
const e=require(`./icon-B9P0jyS2.js`),t=require(`./register-element-tCL_F1YI.js`);require(`./icon-Cia9x_J2.js`),/* empty css */require(`./spinner-CUcCgLKS.js`),e.a({name:`arrow-left`,viewBox:`0 0 24 24`,path:`M19 12H5m7-7l-7 7 7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});var n=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.hasAttribute(`disabled`)}isLoading(){return this.hasAttribute(`loading`)}getType(){return(this.getAttribute(`type`)||this.getAttribute(`button-type`)||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.hasAttribute(`full-width`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}isIconOnly(){if(!(this.getIcon()||this._button?.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent.trim())return!1;if(this._button){for(let e=this._button.firstChild;e;e=e.nextSibling)if(e.nodeType===Node.TEXT_NODE&&e.textContent.trim()||e.nodeType===Node.ELEMENT_NODE&&e.tagName!==`MINT-ICON`&&e.tagName!==`MINT-SPINNER`&&!e.querySelector?.(`mint-spinner`)&&!e.hasAttribute?.(`slot`)&&e.className!==`mint-button-icon`&&!(e.className===`mr-2`&&e.querySelector(`mint-spinner`))&&e.textContent.trim())return!1}return!0}getButtonClasses(){return[`mint-button-core`,`mint-button-`+this.getVariant(),`mint-button-tone-`+this.getTone(),this.isIconOnly()?`mint-button-icon-only`:``,this.isFullWidth()?`mint-button-full-width`:``].filter(Boolean).join(` `)}render(){let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button),this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`);if(this.isLoading())if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),n.render();else{let e=document.createElement(`span`);e.className=`mint-button-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`1em`,t.style.height=`1em`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let r=this.getIcon(),i=this._button.querySelector(`[slot="icon"], .mint-button-icon, mint-icon`);r?(i&&i.tagName!==`MINT-ICON`&&(i.remove(),i=null),!i||i.tagName!==`MINT-ICON`?(i=document.createElement(`mint-icon`),i.setAttribute(`name`,r),i.className=`mint-button-icon`):i.setAttribute(`name`,r)):i&&i.tagName===`MINT-ICON`&&(i.remove(),i=null),i||=this._button.querySelector(`[slot="icon"], .mint-button-icon`);let a=this.getIconPosition(),o=this._button.querySelector(`.mint-button-content`);if(o){let e=i&&i.tagName===`MINT-ICON`;if(i&&!i.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||a===`left`?t?t.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o):o.insertAdjacentElement(`afterend`,i)}else if(i&&(e||a===`left`)&&i.nextSibling!==o){i.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,o)}else i&&!e&&a===`right`&&i.previousSibling!==o&&(i.remove(),o.insertAdjacentElement(`afterend`,i))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling)t.tagName!==`MINT-SPINNER`&&!t.querySelector?.(`mint-spinner`)&&t!==i&&!t.hasAttribute?.(`slot`)&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&e.push(t);if(e.length>0){o=document.createElement(`span`),o.className=`mint-button-content`,e.forEach(e=>{o.appendChild(e)});let t=this._button.querySelector(`mint-spinner`)?.parentElement;i&&a===`left`?t?(t.insertAdjacentElement(`afterend`,i),i.insertAdjacentElement(`afterend`,o)):(this._button.insertBefore(i,this._button.firstChild),i.insertAdjacentElement(`afterend`,o)):i&&a===`right`?t?(t.insertAdjacentElement(`afterend`,o),o.insertAdjacentElement(`afterend`,i)):(this._button.insertBefore(o,this._button.firstChild),o.insertAdjacentElement(`afterend`,i)):t?t.insertAdjacentElement(`afterend`,o):this._button.insertBefore(o,this._button.firstChild)}else if(i&&i.tagName===`MINT-ICON`&&!i.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,i):this._button.insertBefore(i,this._button.firstChild)}}let s=this._button.querySelector(`.mint-button-spinner-wrap`);if(i&&(i.style.display=this.isLoading()?`none`:``,this.isLoading()&&s)){s.setAttribute(`data-position`,a);let e=window.getComputedStyle(i),t=e.width,n=e.height;if(t!==`auto`&&t!==`0px`){s.style.width=t,s.style.flexBasis=t;let e=s.querySelector(`mint-spinner`);e&&(e.style.width=t)}if(n!==`auto`&&n!==`0px`){s.style.height=n;let e=s.querySelector(`mint-spinner`);e&&(e.style.height=n)}i.parentElement===this._button&&i.insertAdjacentElement(`beforebegin`,s)}let c=this.isIconOnly();this.isLoading()&&s&&(s.setAttribute(`data-position`,a),c?s.setAttribute(`data-icon-only`,`true`):s.removeAttribute(`data-icon-only`)),i&&(i.classList.contains(`mint-button-icon`)||i.classList.add(`mint-button-icon`),i.classList.remove(`mint-icon-leading`,`mint-icon-trailing`),c?i.tagName===`MINT-ICON`?(i.style.width=`1rem`,i.style.height=`1rem`,i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`):(i.style.maxWidth=`1rem`,i.style.maxHeight=`1rem`,i.style.flexShrink=`0`,i.tagName===`svg`&&(i.style.width=`1rem`,i.style.height=`1rem`)):a===`left`?i.classList.add(`mint-icon-leading`):i.classList.add(`mint-icon-trailing`));let l=this.getButtonClasses();this._button.className=l}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}_handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleMouseUp=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleMouseLeave=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)};_handleTouchEnd=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};_handleTouchCancel=()=>{this._button&&this._button.classList.remove(`mint-button-active`)};handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};typeof customElements<`u`&&!customElements.get(`mint-button`)&&t.t(`mint-button`,n);var r=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._historyDepth=0,this._maxBackAttempts=10,this._backAttempts=0}connectedCallback(){this.render(),this._setupHistoryTracking()}attributeChangedCallback(e,t,n){t!==n&&this.render()}_setupHistoryTracking(){window.addEventListener(`popstate`,()=>{this._backAttempts=0}),this._historyDepth=window.history.length}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}handleClick(e){if(e.preventDefault(),e.stopPropagation(),window.history.length>1&&this._backAttempts<this._maxBackAttempts&&this._backAttempts===0){this._backAttempts++;let e=window.location.href,t=Date.now();window.history.back(),setTimeout(()=>{Date.now()-t,window.location.href===e?this._navigateToFallback():setTimeout(()=>{this._backAttempts=0},500)},200)}else this._navigateToFallback()}_navigateToFallback(){let e=this.getFallbackHref();if(this._backAttempts=0,e.startsWith(`/`)&&!e.startsWith(`//`))try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`));return}catch{}window.location.href=e}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`solid`),this._button.setAttribute(`tone`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||`Go back`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};typeof customElements<`u`&&!customElements.get(`mint-back-button`)&&t.t(`mint-back-button`,r),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./icon-CWOP4Com.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./icon-D6C1XGp2.js`),/* empty css */require(`./spinner-CUcCgLKS.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`,`active`,`align`,`aria-label`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._mousePressed=!1,this._hostChildObserver=null,this._hostRenderFromObserverRaf=null,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&(this._button.classList.add(`mint-button-active`),this._mousePressed||(this._mousePressed=!0,document.addEventListener(`mouseup`,this._handleMouseUp),window.addEventListener(`blur`,this._handleMouseCancel)))},this._handleMouseUp=()=>{this._clearMousePressedState()},this._handleMouseCancel=()=>{this._clearMousePressedState()},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)},this._handleTouchEnd=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))},this._handleTouchCancel=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))}}_getGeneratedIcon(){return this._button?this._button.querySelector(`:scope > [data-generated-icon="true"]`):null}_getContentWrapperClass(e){return`mint-button-content`}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners(),this._clearMousePressedState()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){let e=this.getAttribute(`variant`);return e===`ghost`||e===`outline`?e:`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.classList.contains(`mint-button-spinner-wrap`)&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=[`mint-button-core`,`mint-button-${this.getVariant()}`,`mint-button-tone-${this.getTone()}`];return this.isIconOnly()&&e.push(`mint-button-icon-only`),this.isFullWidth()&&e.push(`mint-button-full-width`),e.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isLoading(),t=this.isDisabled()||e,n=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=n,this._button.disabled=t,this._button.setAttribute(`aria-busy`,String(e));let r=this._button.querySelector(`mint-spinner`);if(e)if(r)r.setAttribute(`data-button-variant`,this.getVariant()),r.setAttribute(`data-button-tone`,this.getTone()),`render`in r&&typeof r.render==`function`&&r.render();else{let e=document.createElement(`span`);e.className=`mint-button-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`1em`,t.style.height=`1em`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else r&&r.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.classList.contains(`mint-button-spinner-wrap`)&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),e?a.style.display=`none`:a.style.display=``,a.setAttribute(`data-position`,o),a.toggleAttribute(`data-icon-only`,c),c&&(a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`))));let l=this._button.querySelector(`.mint-button-spinner-wrap`),u=a??this._button.querySelector(`:scope > .mint-button-icon, :scope > [slot="icon"]`);if(e&&l&&u){l.setAttribute(`data-position`,o);let e=window.getComputedStyle(u),t=e.width,n=e.height;if(t!==`auto`&&t!==`0px`){l.style.width=t,l.style.flexBasis=t;let e=l.querySelector(`mint-spinner`);e&&(e.style.width=t)}if(n!==`auto`&&n!==`0px`){l.style.height=n;let e=l.querySelector(`mint-spinner`);e&&(e.style.height=n)}u.parentElement===this._button&&u.insertAdjacentElement(`beforebegin`,l)}if(e){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(e.setAttribute(`data-position`,o),c?e.setAttribute(`data-icon-only`,`true`):e.removeAttribute(`data-icon-only`))}let d=this.getButtonClasses();this._button.className=d;let f=this.getAttribute(`aria-label`)?.trim();if(f)this._button.setAttribute(`aria-label`,f);else if(this.isIconOnly()){let e=this.getIcon().split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);this._button.setAttribute(`aria-label`,e||`Action`)}else this._button.removeAttribute(`aria-label`);this.hasAttribute(`active`)?this._button.setAttribute(`aria-pressed`,String(this.isActive())):this._button.removeAttribute(`aria-pressed`),this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),this._button.setAttribute(`data-align`,this.getAlignment()),this._button.toggleAttribute(`data-icon-only`,c),e?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{this._connectHostChildObserver()}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}_clearMousePressedState(){this._mousePressed&&(this._mousePressed=!1,document.removeEventListener(`mouseup`,this._handleMouseUp),window.removeEventListener(`blur`,this._handleMouseCancel)),this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||e.t(`mint-button`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
1
|
+
require(`./icon-B9P0jyS2.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./icon-Cia9x_J2.js`),/* empty css */require(`./spinner-CUcCgLKS.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`variant`,`tone`,`disabled`,`loading`,`button-type`,`type`,`full-width`,`icon-position`,`icon`,`active`,`align`,`aria-label`]}constructor(){super(),this._button=null,this._clickHandler=null,this._isHandlingClick=!1,this._mousePressed=!1,this._hostChildObserver=null,this._hostRenderFromObserverRaf=null,this._handleMouseDown=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&(this._button.classList.add(`mint-button-active`),this._mousePressed||(this._mousePressed=!0,document.addEventListener(`mouseup`,this._handleMouseUp),window.addEventListener(`blur`,this._handleMouseCancel)))},this._handleMouseUp=()=>{this._clearMousePressedState()},this._handleMouseCancel=()=>{this._clearMousePressedState()},this._handleTouchStart=()=>{this._button&&!this.isDisabled()&&!this.isLoading()&&this._button.classList.add(`mint-button-active`)},this._handleTouchEnd=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))},this._handleTouchCancel=()=>{this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))}}_getGeneratedIcon(){return this._button?this._button.querySelector(`:scope > [data-generated-icon="true"]`):null}_getContentWrapperClass(e){return`mint-button-content`}connectedCallback(){this.render(),this._button&&this.setupEventListeners()}disconnectedCallback(){this._disconnectHostChildObserver(),this._hostRenderFromObserverRaf!==null&&(cancelAnimationFrame(this._hostRenderFromObserverRaf),this._hostRenderFromObserverRaf=null),this.removeEventListeners(),this._clearMousePressedState()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){let e=this.getAttribute(`variant`);return e===`ghost`||e===`outline`?e:`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.classList.contains(`mint-button-spinner-wrap`)&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-neutral-900`,`dark:!bg-neutral-700`,`hover:!bg-neutral-900`,`dark:hover:!bg-neutral-700`,`!border-t-neutral-900`,`!border-l-neutral-900`,`!border-r-neutral-600`,`!border-b-neutral-600`,`dark:!border-t-neutral-700`,`dark:!border-l-neutral-700`,`dark:!border-r-neutral-500`,`dark:!border-b-neutral-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-mint-divider`,`dark:!border-b-mint-divider`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-mint-hover`,`hover:!bg-gray-100`,`dark:hover:!bg-mint-hover`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`]}[e]||[]}_disconnectHostChildObserver(){this._hostChildObserver?.disconnect()}_connectHostChildObserver(){this.isConnected&&(this._hostChildObserver||=new MutationObserver(e=>{this._onLightDomMutation(e)}),this._hostChildObserver.disconnect(),this._hostChildObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}))}_onLightDomMutation(e){if(this.isConnected){if(this._button&&!this._button.isConnected){this._button=null,this._scheduleRenderFromHostObserver();return}for(let t of e){let e=t.target;if(!(this._button&&(e===this._button||this._button.contains(e)))){this._scheduleRenderFromHostObserver();return}}}}_scheduleRenderFromHostObserver(){this._hostRenderFromObserverRaf===null&&(this._hostRenderFromObserverRaf=requestAnimationFrame(()=>{this._hostRenderFromObserverRaf=null,this.isConnected&&this.render()}))}getButtonClasses(){let e=[`mint-button-core`,`mint-button-${this.getVariant()}`,`mint-button-tone-${this.getTone()}`];return this.isIconOnly()&&e.push(`mint-button-icon-only`),this.isFullWidth()&&e.push(`mint-button-full-width`),e.join(` `)}render(){this._disconnectHostChildObserver(),this._button&&!this._button.isConnected&&(this._button=null);try{let e=this.isLoading(),t=this.isDisabled()||e,n=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=n,this._button.disabled=t,this._button.setAttribute(`aria-busy`,String(e));let r=this._button.querySelector(`mint-spinner`);if(e)if(r)r.setAttribute(`data-button-variant`,this.getVariant()),r.setAttribute(`data-button-tone`,this.getTone()),`render`in r&&typeof r.render==`function`&&r.render();else{let e=document.createElement(`span`);e.className=`mint-button-spinner-wrap`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`1em`,t.style.height=`1em`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else r&&r.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.classList.contains(`mint-button-spinner-wrap`)&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),e?a.style.display=`none`:a.style.display=``,a.setAttribute(`data-position`,o),a.toggleAttribute(`data-icon-only`,c),c&&(a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`))));let l=this._button.querySelector(`.mint-button-spinner-wrap`),u=a??this._button.querySelector(`:scope > .mint-button-icon, :scope > [slot="icon"]`);if(e&&l&&u){l.setAttribute(`data-position`,o);let e=window.getComputedStyle(u),t=e.width,n=e.height;if(t!==`auto`&&t!==`0px`){l.style.width=t,l.style.flexBasis=t;let e=l.querySelector(`mint-spinner`);e&&(e.style.width=t)}if(n!==`auto`&&n!==`0px`){l.style.height=n;let e=l.querySelector(`mint-spinner`);e&&(e.style.height=n)}u.parentElement===this._button&&u.insertAdjacentElement(`beforebegin`,l)}if(e){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(e.setAttribute(`data-position`,o),c?e.setAttribute(`data-icon-only`,`true`):e.removeAttribute(`data-icon-only`))}let d=this.getButtonClasses();this._button.className=d;let f=this.getAttribute(`aria-label`)?.trim();if(f)this._button.setAttribute(`aria-label`,f);else if(this.isIconOnly()){let e=this.getIcon().split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);this._button.setAttribute(`aria-label`,e||`Action`)}else this._button.removeAttribute(`aria-label`);this.hasAttribute(`active`)?this._button.setAttribute(`aria-pressed`,String(this.isActive())):this._button.removeAttribute(`aria-pressed`),this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),this._button.setAttribute(`data-align`,this.getAlignment()),this._button.toggleAttribute(`data-icon-only`,c),e?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}finally{this._connectHostChildObserver()}}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}_clearMousePressedState(){this._mousePressed&&(this._mousePressed=!1,document.removeEventListener(`mouseup`,this._handleMouseUp),window.removeEventListener(`blur`,this._handleMouseCancel)),this._button&&(this.isActive()||this._button.classList.remove(`mint-button-active`))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||e.t(`mint-button`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./icon-
|
|
1
|
+
import "./icon-DAB2KLeo.js";
|
|
2
2
|
import { t as e } from "./register-element-BFYmIynH.js";
|
|
3
|
-
import "./icon-
|
|
3
|
+
import "./icon-CIAsmizQ.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import "./spinner-B2sml0AG.js";
|
|
6
6
|
//#region src/components/button/Button.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./icon-B9P0jyS2.js`).a({name:`caret-down`,viewBox:`0 0 24 24`,path:`M19 9l-7 7-7-7`,strokeLinecap:`round`,strokeLinejoin:`round`});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./icon-B9P0jyS2.js`).a({name:`caret-right`,viewBox:`0 0 24 24`,path:`M9 5l7 7-7 7`,strokeLinecap:`round`,strokeLinejoin:`round`});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./icon-B9P0jyS2.js`),t=require(`./register-element-tCL_F1YI.js`);require(`./icon-Cia9x_J2.js`),e.a({name:`check`,viewBox:`0 0 24 24`,path:`M5 13l4 4L19 7`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3.2`});var n=class extends HTMLElement{static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`info`,`id`,`name`,`value`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._indeterminate=!1,this._clickHandler=null}connectedCallback(){let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this._indeterminate=this.hasAttribute(`indeterminate`)&&this.getAttribute(`indeterminate`)!==`false`,this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.checked=this._checked)),e===`indeterminate`&&(this._indeterminate=n!==null&&n!==`false`,this._checkbox&&(this._checkbox.indeterminate=this._indeterminate)),t!==n&&(this.render(),e===`checked`&&this._checkbox&&this.updateVisualState(),e===`indeterminate`&&this.updateVisualState())}get checked(){return this._checked}set checked(e){e?this.setAttribute(`checked`,``):this.removeAttribute(`checked`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}get indeterminate(){return this._indeterminate}set indeterminate(e){this._indeterminate=!!e,this._indeterminate?this.setAttribute(`indeterminate`,`true`):this.removeAttribute(`indeterminate`),this._checkbox&&(this._checkbox.indeterminate=this._indeterminate),this.updateVisualState()}isDisabled(){return this.hasAttribute(`disabled`)||this.getAttribute(`loading`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}getCheckboxClasses(){return`mint-checkbox-control`}render(){let e=this.getAttribute(`loading`)===`true`;this.toggleAttribute(`aria-busy`,e);let t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-wrapper`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-wrapper`,this.insertBefore(i,this.firstChild)),this._checkbox?this._checkbox.parentElement!==i&&i.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,i.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`mint-input-overlay`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.indeterminate=this._indeterminate,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let a=this.getId();a?this._checkbox.id=a:this._checkbox.removeAttribute(`id`);let o=this.getName();o?this._checkbox.name=o:this._checkbox.removeAttribute(`name`);let s=this.getValue();s?this._checkbox.value=s:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,i.style.pointerEvents=`none`,this._checkbox.style.pointerEvents=`auto`;let c=i.querySelector(`mint-icon`);c||(c=document.createElement(`mint-icon`),c.setAttribute(`name`,`check`),c.className=`mint-checkbox-check`,c.style.position=`absolute`,c.style.inset=`auto`,c.style.top=`50%`,c.style.left=`50%`,c.style.width=`0.875rem`,c.style.height=`0.875rem`,c.style.margin=`0`,c.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,c.style.zIndex=`1`,i.appendChild(c)),this.updateVisualState();let l=this.querySelector(`.mint-checkbox-label-container`);if(t||n){l||(l=document.createElement(`div`),l.className=`mint-checkbox-label-container`,this.appendChild(l));let e=l.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label`,l.insertBefore(e,l.firstChild)),e.textContent=t,r?e.style.opacity=`0.5`:e.style.opacity=``):e&&e.remove();let i=l.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info`,l.appendChild(i)),i.textContent=n,r?i.style.opacity=`0.5`:i.style.opacity=``):i&&i.remove(),r)l.style.cursor=`default`,l._clickHandler&&(l.removeEventListener(`click`,l._clickHandler),l._clickHandler=null);else{l.style.cursor=`pointer`;let e=l._clickHandler;e&&l.removeEventListener(`click`,e),l._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},l.addEventListener(`click`,l._clickHandler)}}else l&&l.remove();let u=this.querySelector(`:scope > .mint-checkbox-loading-skeleton`);if(e){if(!u){u=document.createElement(`div`),u.className=`mint-checkbox-loading-skeleton`,u.setAttribute(`aria-hidden`,`true`),Object.assign(u.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,gap:`0.5rem`,pointerEvents:`none`,zIndex:`20`});let e=document.createElement(`span`);if(Object.assign(e.style,{display:`block`,width:`1.25rem`,height:`1.25rem`,flex:`none`,borderRadius:`0.25rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e),t){let e=document.createElement(`span`);Object.assign(e.style,{display:`block`,width:`6rem`,height:`1rem`,borderRadius:`0.35rem`,background:`var(--mint-color-surface-control, #e8eee9)`,animation:`mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite`}),u.appendChild(e)}this.appendChild(u)}this.style.position=`relative`,u.style.display=`flex`,i.style.visibility=`hidden`,l&&(l.style.visibility=`hidden`)}else u&&(u.style.display=`none`),i.style.visibility=``,l&&(l.style.visibility=``)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._indeterminate=!1,this._checkbox.indeterminate=!1,this.removeAttribute(`indeterminate`),this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let t=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(t)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`var(--mint-color-primary)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`var(--mint-color-surface-hover)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null))}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked&&!this._indeterminate?`1`:`0`,t.style.transform=this._checked&&!this._indeterminate?`translate(-50%, -50%)`:`translate(-50%, -50%) scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.toggleAttribute(`data-indeterminate`,this._indeterminate),e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._indeterminate=!1,this._checkbox.indeterminate=!1,this.removeAttribute(`indeterminate`),this._checked=this._checkbox.checked,this._checked?this.hasAttribute(`checked`)||this.setAttribute(`checked`,``):this.hasAttribute(`checked`)&&this.removeAttribute(`checked`),this.updateVisualState();let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}};typeof customElements<`u`&&!customElements.get(`mint-checkbox`)&&t.t(`mint-checkbox`,n),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { a as e } from "./icon-DAB2KLeo.js";
|
|
2
|
+
import { t } from "./register-element-BFYmIynH.js";
|
|
3
|
+
import "./icon-CIAsmizQ.js";
|
|
4
|
+
e({
|
|
5
|
+
name: "check",
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
path: "M5 13l4 4L19 7",
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
strokeLinejoin: "round",
|
|
10
|
+
strokeWidth: "3.2"
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/checkbox/Checkbox.js
|
|
14
|
+
var n = class extends HTMLElement {
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return [
|
|
17
|
+
"checked",
|
|
18
|
+
"indeterminate",
|
|
19
|
+
"disabled",
|
|
20
|
+
"label",
|
|
21
|
+
"info",
|
|
22
|
+
"id",
|
|
23
|
+
"name",
|
|
24
|
+
"value",
|
|
25
|
+
"loading"
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
constructor() {
|
|
29
|
+
super(), this._checkbox = null, this._checked = !1, this._indeterminate = !1, this._clickHandler = null;
|
|
30
|
+
}
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
let e = this.getAttribute("checked");
|
|
33
|
+
this._checked = e !== null && e !== "false", this._indeterminate = this.hasAttribute("indeterminate") && this.getAttribute("indeterminate") !== "false", this.render();
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
this.removeEventListeners();
|
|
37
|
+
}
|
|
38
|
+
attributeChangedCallback(e, t, n) {
|
|
39
|
+
e === "checked" && (this._checked = n !== null && n !== "false", this._checkbox && (this._checkbox.checked = this._checked)), e === "indeterminate" && (this._indeterminate = n !== null && n !== "false", this._checkbox && (this._checkbox.indeterminate = this._indeterminate)), t !== n && (this.render(), e === "checked" && this._checkbox && this.updateVisualState(), e === "indeterminate" && this.updateVisualState());
|
|
40
|
+
}
|
|
41
|
+
get checked() {
|
|
42
|
+
return this._checked;
|
|
43
|
+
}
|
|
44
|
+
set checked(e) {
|
|
45
|
+
e ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._checked = !!e, this._checkbox && (this._checkbox.checked = this._checked), this.updateVisualState();
|
|
46
|
+
}
|
|
47
|
+
get indeterminate() {
|
|
48
|
+
return this._indeterminate;
|
|
49
|
+
}
|
|
50
|
+
set indeterminate(e) {
|
|
51
|
+
this._indeterminate = !!e, this._indeterminate ? this.setAttribute("indeterminate", "true") : this.removeAttribute("indeterminate"), this._checkbox && (this._checkbox.indeterminate = this._indeterminate), this.updateVisualState();
|
|
52
|
+
}
|
|
53
|
+
isDisabled() {
|
|
54
|
+
return this.hasAttribute("disabled") || this.getAttribute("loading") === "true";
|
|
55
|
+
}
|
|
56
|
+
getLabel() {
|
|
57
|
+
return this.getAttribute("label") || "";
|
|
58
|
+
}
|
|
59
|
+
getInfo() {
|
|
60
|
+
return this.getAttribute("info") || "";
|
|
61
|
+
}
|
|
62
|
+
getId() {
|
|
63
|
+
return this.getAttribute("id") || "";
|
|
64
|
+
}
|
|
65
|
+
getName() {
|
|
66
|
+
return this.getAttribute("name") || "";
|
|
67
|
+
}
|
|
68
|
+
getValue() {
|
|
69
|
+
return this.getAttribute("value") || "";
|
|
70
|
+
}
|
|
71
|
+
getCheckboxClasses() {
|
|
72
|
+
return "mint-checkbox-control";
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
let e = this.getAttribute("loading") === "true";
|
|
76
|
+
this.toggleAttribute("aria-busy", e);
|
|
77
|
+
let t = this.getLabel(), n = this.getInfo(), r = this.isDisabled(), i = this.querySelector(".mint-checkbox-wrapper");
|
|
78
|
+
i || (i = document.createElement("div"), i.className = "mint-checkbox-wrapper", this.insertBefore(i, this.firstChild)), this._checkbox ? this._checkbox.parentElement !== i && i.appendChild(this._checkbox) : (this._checkbox = document.createElement("input"), this._checkbox.type = "checkbox", i.appendChild(this._checkbox), this.setupEventListeners()), this._checkbox.className = "mint-input-overlay", this._checkbox.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;", this._checkbox.checked = this._checked, this._checkbox.indeterminate = this._indeterminate, this._checkbox.disabled = r, this._changeHandler || this.setupEventListeners();
|
|
79
|
+
let a = this.getId();
|
|
80
|
+
a ? this._checkbox.id = a : this._checkbox.removeAttribute("id");
|
|
81
|
+
let o = this.getName();
|
|
82
|
+
o ? this._checkbox.name = o : this._checkbox.removeAttribute("name");
|
|
83
|
+
let s = this.getValue();
|
|
84
|
+
s ? this._checkbox.value = s : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), i.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, i.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
|
|
85
|
+
let c = i.querySelector("mint-icon");
|
|
86
|
+
c || (c = document.createElement("mint-icon"), c.setAttribute("name", "check"), c.className = "mint-checkbox-check", c.style.position = "absolute", c.style.inset = "auto", c.style.top = "50%", c.style.left = "50%", c.style.width = "0.875rem", c.style.height = "0.875rem", c.style.margin = "0", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", i.appendChild(c)), this.updateVisualState();
|
|
87
|
+
let l = this.querySelector(".mint-checkbox-label-container");
|
|
88
|
+
if (t || n) {
|
|
89
|
+
l || (l = document.createElement("div"), l.className = "mint-checkbox-label-container", this.appendChild(l));
|
|
90
|
+
let e = l.querySelector(".mint-checkbox-label");
|
|
91
|
+
t ? (e || (e = document.createElement("span"), e.className = "mint-checkbox-label", l.insertBefore(e, l.firstChild)), e.textContent = t, r ? e.style.opacity = "0.5" : e.style.opacity = "") : e && e.remove();
|
|
92
|
+
let i = l.querySelector(".mint-checkbox-info");
|
|
93
|
+
if (n ? (i || (i = document.createElement("span"), i.className = "mint-checkbox-info", l.appendChild(i)), i.textContent = n, r ? i.style.opacity = "0.5" : i.style.opacity = "") : i && i.remove(), r) l.style.cursor = "default", l._clickHandler && (l.removeEventListener("click", l._clickHandler), l._clickHandler = null);
|
|
94
|
+
else {
|
|
95
|
+
l.style.cursor = "pointer";
|
|
96
|
+
let e = l._clickHandler;
|
|
97
|
+
e && l.removeEventListener("click", e), l._clickHandler = (e) => {
|
|
98
|
+
this._checkbox && (e.target === this._checkbox || this._checkbox.contains(e.target) || e.composedPath().includes(this._checkbox)) || this.toggle();
|
|
99
|
+
}, l.addEventListener("click", l._clickHandler);
|
|
100
|
+
}
|
|
101
|
+
} else l && l.remove();
|
|
102
|
+
let u = this.querySelector(":scope > .mint-checkbox-loading-skeleton");
|
|
103
|
+
if (e) {
|
|
104
|
+
if (!u) {
|
|
105
|
+
u = document.createElement("div"), u.className = "mint-checkbox-loading-skeleton", u.setAttribute("aria-hidden", "true"), Object.assign(u.style, {
|
|
106
|
+
position: "absolute",
|
|
107
|
+
inset: "0",
|
|
108
|
+
display: "flex",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
gap: "0.5rem",
|
|
111
|
+
pointerEvents: "none",
|
|
112
|
+
zIndex: "20"
|
|
113
|
+
});
|
|
114
|
+
let e = document.createElement("span");
|
|
115
|
+
if (Object.assign(e.style, {
|
|
116
|
+
display: "block",
|
|
117
|
+
width: "1.25rem",
|
|
118
|
+
height: "1.25rem",
|
|
119
|
+
flex: "none",
|
|
120
|
+
borderRadius: "0.25rem",
|
|
121
|
+
background: "var(--mint-color-surface-control, #e8eee9)",
|
|
122
|
+
animation: "mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite"
|
|
123
|
+
}), u.appendChild(e), t) {
|
|
124
|
+
let e = document.createElement("span");
|
|
125
|
+
Object.assign(e.style, {
|
|
126
|
+
display: "block",
|
|
127
|
+
width: "6rem",
|
|
128
|
+
height: "1rem",
|
|
129
|
+
borderRadius: "0.35rem",
|
|
130
|
+
background: "var(--mint-color-surface-control, #e8eee9)",
|
|
131
|
+
animation: "mint-checkbox-skeleton-pulse 1.4s ease-in-out infinite"
|
|
132
|
+
}), u.appendChild(e);
|
|
133
|
+
}
|
|
134
|
+
this.appendChild(u);
|
|
135
|
+
}
|
|
136
|
+
this.style.position = "relative", u.style.display = "flex", i.style.visibility = "hidden", l && (l.style.visibility = "hidden");
|
|
137
|
+
} else u && (u.style.display = "none"), i.style.visibility = "", l && (l.style.visibility = "");
|
|
138
|
+
}
|
|
139
|
+
setupEventListeners() {
|
|
140
|
+
this.removeEventListeners(), this._checkbox && (this._changeHandler = (e) => {
|
|
141
|
+
e.stopPropagation(), this._checked = this._checkbox.checked, this._indeterminate = !1, this._checkbox.indeterminate = !1, this.removeAttribute("indeterminate"), this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
|
|
142
|
+
let t = new CustomEvent("change", {
|
|
143
|
+
detail: {
|
|
144
|
+
checked: this._checked,
|
|
145
|
+
value: this.getValue()
|
|
146
|
+
},
|
|
147
|
+
bubbles: !0,
|
|
148
|
+
cancelable: !0
|
|
149
|
+
});
|
|
150
|
+
this.dispatchEvent(t);
|
|
151
|
+
}, this._checkbox.addEventListener("change", this._changeHandler), this._mousedownHandler = (e) => {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
154
|
+
t && !this.isDisabled() && (t.classList.add("mint-checkbox-active"), this._checked ? (t.style.backgroundColor = "var(--mint-color-primary)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.3)") : (t.style.backgroundColor = "var(--mint-color-surface-hover)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.1)"));
|
|
155
|
+
}, this._mouseupHandler = (e) => {
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
158
|
+
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
159
|
+
}, this._mouseleaveHandler = (e) => {
|
|
160
|
+
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
161
|
+
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
162
|
+
}, this._checkbox.addEventListener("mousedown", this._mousedownHandler), this._checkbox.addEventListener("mouseup", this._mouseupHandler), this._checkbox.addEventListener("mouseleave", this._mouseleaveHandler), this._touchstartHandler = (e) => {
|
|
163
|
+
e.stopPropagation();
|
|
164
|
+
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
165
|
+
t && !this.isDisabled() && (t.classList.add("mint-checkbox-active"), this._checked ? (t.style.backgroundColor = "var(--mint-color-primary)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.3)") : (t.style.backgroundColor = "var(--mint-color-surface-hover)", t.style.boxShadow = "inset 0 2px 4px rgba(0, 0, 0, 0.1)"));
|
|
166
|
+
}, this._touchendHandler = (e) => {
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
let t = this.querySelector(".mint-checkbox-wrapper");
|
|
169
|
+
t && (t.classList.remove("mint-checkbox-active"), t.style.backgroundColor = "", t.style.boxShadow = "");
|
|
170
|
+
}, this._checkbox.addEventListener("touchstart", this._touchstartHandler), this._checkbox.addEventListener("touchend", this._touchendHandler));
|
|
171
|
+
}
|
|
172
|
+
removeEventListeners() {
|
|
173
|
+
this._checkbox && (this._changeHandler &&= (this._checkbox.removeEventListener("change", this._changeHandler), null), this._mousedownHandler &&= (this._checkbox.removeEventListener("mousedown", this._mousedownHandler), null), this._mouseupHandler &&= (this._checkbox.removeEventListener("mouseup", this._mouseupHandler), null), this._mouseleaveHandler &&= (this._checkbox.removeEventListener("mouseleave", this._mouseleaveHandler), null), this._touchstartHandler &&= (this._checkbox.removeEventListener("touchstart", this._touchstartHandler), null), this._touchendHandler &&= (this._checkbox.removeEventListener("touchend", this._touchendHandler), null));
|
|
174
|
+
}
|
|
175
|
+
updateVisualState() {
|
|
176
|
+
let e = this.querySelector(".mint-checkbox-wrapper"), t = e?.querySelector("mint-icon");
|
|
177
|
+
t && (t.style.opacity = this._checked && !this._indeterminate ? "1" : "0", t.style.transform = this._checked && !this._indeterminate ? "translate(-50%, -50%)" : "translate(-50%, -50%) scale(0.8)"), e && (e.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, e.toggleAttribute("data-indeterminate", this._indeterminate), e.classList.contains("mint-checkbox-active") || (e.style.backgroundColor = "", e.style.boxShadow = ""));
|
|
178
|
+
}
|
|
179
|
+
toggle() {
|
|
180
|
+
if (this._checkbox && !this.isDisabled()) {
|
|
181
|
+
this._checkbox.checked = !this._checked, this._indeterminate = !1, this._checkbox.indeterminate = !1, this.removeAttribute("indeterminate"), this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
|
|
182
|
+
let e = new CustomEvent("change", {
|
|
183
|
+
detail: { checked: this._checked },
|
|
184
|
+
bubbles: !0,
|
|
185
|
+
cancelable: !0
|
|
186
|
+
});
|
|
187
|
+
this.dispatchEvent(e);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
typeof customElements < "u" && !customElements.get("mint-checkbox") && t("mint-checkbox", n);
|
|
192
|
+
//#endregion
|
|
193
|
+
export { n as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./icon-
|
|
1
|
+
require(`./icon-B9P0jyS2.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./icon-Cia9x_J2.js`),require(`./close-CWAmmMRg.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._root=null,this._label=null,this._dismissBtn=null,this._clickHandler=null}static get observedAttributes(){return[`dismissable`,`tone`,`size`]}connectedCallback(){this._render()}disconnectedCallback(){this._dismissBtn&&this._clickHandler&&this._dismissBtn.removeEventListener(`click`,this._clickHandler)}attributeChangedCallback(){this.isConnected&&this._render()}_render(){if(this.classList.add(`mint-chip`),!this._root){for(this._root=document.createElement(`span`),this._root.className=`mint-chip__content`,this._label=document.createElement(`span`),this._label.className=`mint-chip__label`,this._label.setAttribute(`data-mt-chip-text`,``);this.firstChild;){let e=this.firstChild;if(e===this._root)break;this._label.appendChild(e)}this._root.appendChild(this._label),this.appendChild(this._root)}let e=this.getAttribute(`dismissable`);if(e===``||e===`true`?(this._dismissBtn||this._createDismissButton(),this._dismissBtn&&this._dismissBtn.parentElement!==this._root&&this._root?.appendChild(this._dismissBtn)):this._dismissBtn?.parentElement===this._root&&this._dismissBtn.remove(),this._dismissBtn){let e=this._label?.textContent?.trim();this._dismissBtn.setAttribute(`aria-label`,e?`Remove ${e}`:`Dismiss chip`)}}_createDismissButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`mint-chip__dismiss`,e.setAttribute(`aria-label`,`Dismiss chip`);let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`close`),t.className=`mint-chip__dismiss-icon`,t.setAttribute(`aria-hidden`,`true`),e.appendChild(t),this._clickHandler=e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismiss`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},e.addEventListener(`click`,this._clickHandler),this._dismissBtn=e}};customElements.get(`mint-chip`)||e.t(`mint-chip`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|