monobill-mintui 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Icon-BTuYBm_3.cjs +1 -0
- package/dist/Icon-ByNhn8tE.js +77 -0
- package/dist/button-CAQ8mBQ2.js +575 -0
- package/dist/button-DuNZkwFV.cjs +1 -0
- package/dist/button.cjs +1 -0
- package/dist/button.d.ts +1 -0
- package/dist/button.js +2 -0
- package/dist/card-C1AqNkxK.cjs +1 -0
- package/dist/card-LNjZ86sr.js +58 -0
- package/dist/card.cjs +1 -0
- package/dist/card.d.ts +1 -0
- package/dist/card.js +2 -0
- package/dist/checkbox-Bkgxfl0k.js +169 -0
- package/dist/checkbox-DgwXHIbu.cjs +1 -0
- package/dist/checkbox.cjs +1 -0
- package/dist/checkbox.d.ts +1 -0
- package/dist/checkbox.js +1 -0
- package/dist/choice-BAk8Jd5E.cjs +1 -0
- package/dist/choice-Cs16XiRh.js +204 -0
- package/dist/choice.cjs +1 -0
- package/dist/choice.d.ts +1 -0
- package/dist/choice.js +1 -0
- package/dist/grid-ByGfCtMT.cjs +1 -0
- package/dist/grid-DhnNax_w.js +62 -0
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +2 -0
- package/dist/icon-D8dpuFVm.js +701 -0
- package/dist/icon-Dut5ZPmM.cjs +1 -0
- package/dist/icon.cjs +1 -0
- package/dist/icon.d.ts +1 -0
- package/dist/icon.js +3 -0
- package/dist/index.cjs +1 -63
- package/dist/index.d.ts +35 -0
- package/dist/index.js +16 -2756
- package/dist/link-B-z-io7I.cjs +1 -0
- package/dist/link-DC8l274I.js +75 -0
- package/dist/link.cjs +1 -0
- package/dist/link.d.ts +1 -0
- package/dist/link.js +2 -0
- package/dist/mintui-elements.d.ts +78 -0
- package/dist/modal-BZYcRU3i.js +98 -0
- package/dist/modal-C_ukm1We.cjs +1 -0
- package/dist/modal.cjs +1 -0
- package/dist/modal.d.ts +1 -0
- package/dist/modal.js +1 -0
- package/dist/page-CJ3M0wAd.cjs +1 -0
- package/dist/page-aBsDfG3x.js +112 -0
- package/dist/page.cjs +1 -0
- package/dist/page.d.ts +1 -0
- package/dist/page.js +2 -0
- package/dist/popover-7bn3gySt.js +181 -0
- package/dist/popover-CuSBQ8Jm.cjs +1 -0
- package/dist/popover.cjs +1 -0
- package/dist/popover.d.ts +1 -0
- package/dist/popover.js +1 -0
- package/dist/spinner-DqXU-cr-.js +111 -0
- package/dist/spinner-GtQIe8rS.cjs +63 -0
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +1 -0
- package/dist/spinner.js +2 -0
- package/dist/stack-D0noPfD1.js +114 -0
- package/dist/stack-tFy8YlX2.cjs +1 -0
- package/dist/stack.cjs +1 -0
- package/dist/stack.d.ts +1 -0
- package/dist/stack.js +2 -0
- package/dist/styles.css +1 -0
- package/dist/switch-DQ0Eaz6M.js +138 -0
- package/dist/switch-DeQNPnla.cjs +1 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.d.ts +1 -0
- package/dist/switch.js +2 -0
- package/dist/text-CoinZsjJ.cjs +1 -0
- package/dist/text-q58TQcH-.js +111 -0
- package/dist/text.cjs +1 -0
- package/dist/text.d.ts +1 -0
- package/dist/text.js +2 -0
- package/package.json +50 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=new Map;function t(t){e.set(t.name,t)}function n(t){return e.get(t)}function r(t){return e.has(t)}function i(){return Array.from(e.values())}var a=class extends HTMLElement{static get observedAttributes(){return[`name`]}constructor(){super(),this._darkModeObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-flex`,`items-center`,`leading-none`),this.render(),this._observeDarkMode()}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){this.render();break}}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getName(){return this.getAttribute(`name`)||``}getIconUrl(){let e=document.documentElement.getAttribute(`data-icon-base-url`)||document.querySelector(`meta[name="icon-base-url"]`)?.getAttribute(`content`);return e?`${e}/${this.getName()}.svg`:`/icons/${this.getName()}.svg`}render(){let e=this.getName();if(!e){this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}if(!n(e)){console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`),this.innerHTML=``,this.style.maskImage=``,this.style.webkitMaskImage=``;return}let t=this.closest(`mint-button`)||this.parentElement?.closest(`mint-button`),r=this.closest(`mint-switch`)||this.parentElement?.closest(`mint-switch`),i;i=r?`w-3 h-3`:t?`w-5 h-5`:`w-[1.3em] h-[1.3em]`,this.classList.remove(`w-4`,`h-4`,`w-5`,`h-5`,`w-[1em]`,`h-[1em]`),i.split(` `).forEach(e=>{e&&this.classList.add(e)});let a=this.getIconUrl();if(this.style.maskImage=`url(${a})`,this.style.webkitMaskImage=`url(${a})`,this.style.maskSize=`contain`,this.style.webkitMaskSize=`contain`,this.style.maskRepeat=`no-repeat`,this.style.webkitMaskRepeat=`no-repeat`,this.style.maskPosition=`center`,this.style.webkitMaskPosition=`center`,this.style.aspectRatio=`1 / 1`,this.style.backgroundColor=`currentColor`,r)this.classList.remove(`text-gray-100`,`text-gray-900`),this.classList.add(`text-gray-900`);else if(t)this.classList.remove(`text-gray-100`,`text-gray-900`);else{let e=document.documentElement.classList.contains(`dark`)?`text-gray-100`:`text-gray-900`;this.classList.remove(`text-gray-100`,`text-gray-900`),this.classList.add(e)}this.innerHTML=``}};customElements.get(`mint-icon`)||customElements.define(`mint-icon`,a),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/components/icon/registry.js
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(t) {
|
|
4
|
+
e.set(t.name, t);
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
return e.get(t);
|
|
8
|
+
}
|
|
9
|
+
function r(t) {
|
|
10
|
+
return e.has(t);
|
|
11
|
+
}
|
|
12
|
+
function i() {
|
|
13
|
+
return Array.from(e.values());
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/icon/Icon.js
|
|
17
|
+
var a = class extends HTMLElement {
|
|
18
|
+
static get observedAttributes() {
|
|
19
|
+
return ["name"];
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super(), this._darkModeObserver = null;
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
this.classList.add("box-border", "m-0", "p-0", "border-0", "inline-flex", "items-center", "leading-none"), this.render(), this._observeDarkMode();
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(e, t, n) {
|
|
28
|
+
t !== n && this.render();
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
this._darkModeObserver &&= (this._darkModeObserver.disconnect(), null);
|
|
32
|
+
}
|
|
33
|
+
_observeDarkMode() {
|
|
34
|
+
this._darkModeObserver || (this._darkModeObserver = new MutationObserver((e) => {
|
|
35
|
+
for (let t of e) if (t.type === "attributes" && t.attributeName === "class") {
|
|
36
|
+
this.render();
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}), this._darkModeObserver.observe(document.documentElement, {
|
|
40
|
+
attributes: !0,
|
|
41
|
+
attributeFilter: ["class"]
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
getName() {
|
|
45
|
+
return this.getAttribute("name") || "";
|
|
46
|
+
}
|
|
47
|
+
getIconUrl() {
|
|
48
|
+
let e = document.documentElement.getAttribute("data-icon-base-url") || document.querySelector("meta[name=\"icon-base-url\"]")?.getAttribute("content");
|
|
49
|
+
return e ? `${e}/${this.getName()}.svg` : `/icons/${this.getName()}.svg`;
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
let e = this.getName();
|
|
53
|
+
if (!e) {
|
|
54
|
+
this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!n(e)) {
|
|
58
|
+
console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let t = this.closest("mint-button") || this.parentElement?.closest("mint-button"), r = this.closest("mint-switch") || this.parentElement?.closest("mint-switch"), i;
|
|
62
|
+
i = r ? "w-3 h-3" : t ? "w-5 h-5" : "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]"), i.split(" ").forEach((e) => {
|
|
63
|
+
e && this.classList.add(e);
|
|
64
|
+
});
|
|
65
|
+
let a = this.getIconUrl();
|
|
66
|
+
if (this.style.maskImage = `url(${a})`, this.style.webkitMaskImage = `url(${a})`, this.style.maskSize = "contain", this.style.webkitMaskSize = "contain", this.style.maskRepeat = "no-repeat", this.style.webkitMaskRepeat = "no-repeat", this.style.maskPosition = "center", this.style.webkitMaskPosition = "center", this.style.aspectRatio = "1 / 1", this.style.backgroundColor = "currentColor", r) this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add("text-gray-900");
|
|
67
|
+
else if (t) this.classList.remove("text-gray-100", "text-gray-900");
|
|
68
|
+
else {
|
|
69
|
+
let e = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
|
|
70
|
+
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(e);
|
|
71
|
+
}
|
|
72
|
+
this.innerHTML = "";
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
customElements.get("mint-icon") || customElements.define("mint-icon", a);
|
|
76
|
+
//#endregion
|
|
77
|
+
export { t as a, r as i, i as n, n as r, a as t };
|
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import "./spinner-DqXU-cr-.js";
|
|
2
|
+
import "./icon-D8dpuFVm.js";
|
|
3
|
+
//#region src/components/button/Button.js
|
|
4
|
+
var e = class extends HTMLElement {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return [
|
|
7
|
+
"variant",
|
|
8
|
+
"tone",
|
|
9
|
+
"disabled",
|
|
10
|
+
"loading",
|
|
11
|
+
"button-type",
|
|
12
|
+
"full-width",
|
|
13
|
+
"icon-position",
|
|
14
|
+
"icon"
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1;
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.render(), this._button && this.setupEventListeners(), this.isFullWidth() && this.classList.add("w-full");
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
this.removeEventListeners();
|
|
25
|
+
}
|
|
26
|
+
attributeChangedCallback(e, t, n) {
|
|
27
|
+
t !== n && this.render();
|
|
28
|
+
}
|
|
29
|
+
getVariant() {
|
|
30
|
+
return this.getAttribute("variant") || "solid";
|
|
31
|
+
}
|
|
32
|
+
getTone() {
|
|
33
|
+
return this.getAttribute("tone") || "neutral";
|
|
34
|
+
}
|
|
35
|
+
isDisabled() {
|
|
36
|
+
return this.hasAttribute("disabled");
|
|
37
|
+
}
|
|
38
|
+
isLoading() {
|
|
39
|
+
return this.hasAttribute("loading");
|
|
40
|
+
}
|
|
41
|
+
getType() {
|
|
42
|
+
return (this.getAttribute("button-type") || "default") === "submit" ? "submit" : "button";
|
|
43
|
+
}
|
|
44
|
+
isFullWidth() {
|
|
45
|
+
return this.hasAttribute("full-width");
|
|
46
|
+
}
|
|
47
|
+
getIconPosition() {
|
|
48
|
+
return this.getAttribute("icon-position") || "left";
|
|
49
|
+
}
|
|
50
|
+
getIcon() {
|
|
51
|
+
return this.getAttribute("icon") || "";
|
|
52
|
+
}
|
|
53
|
+
isIconOnly() {
|
|
54
|
+
if (!(this.getIcon() || this._button?.querySelector("[slot=\"icon\"], .mint-button-icon, mint-icon"))) return !1;
|
|
55
|
+
let e = this._button?.querySelector(".mint-button-content");
|
|
56
|
+
if (e && e.textContent.trim()) return !1;
|
|
57
|
+
if (this._button) {
|
|
58
|
+
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;
|
|
59
|
+
}
|
|
60
|
+
return !0;
|
|
61
|
+
}
|
|
62
|
+
getButtonClasses() {
|
|
63
|
+
let e = this.isIconOnly(), t = this.getVariant(), n = [
|
|
64
|
+
"inline-flex",
|
|
65
|
+
"items-center",
|
|
66
|
+
"justify-center",
|
|
67
|
+
"font-medium",
|
|
68
|
+
"rounded-lg",
|
|
69
|
+
"box-border",
|
|
70
|
+
...e ? [
|
|
71
|
+
"p-1.5",
|
|
72
|
+
"aspect-square",
|
|
73
|
+
"w-[2rem]",
|
|
74
|
+
"h-[2rem]"
|
|
75
|
+
] : [
|
|
76
|
+
"px-3.5",
|
|
77
|
+
"py-1.5",
|
|
78
|
+
"min-h-[2rem]"
|
|
79
|
+
],
|
|
80
|
+
"text-sm",
|
|
81
|
+
"transition-all",
|
|
82
|
+
"duration-200",
|
|
83
|
+
"outline-none",
|
|
84
|
+
"focus:outline-none",
|
|
85
|
+
"focus-visible:ring-2",
|
|
86
|
+
"focus-visible:ring-offset-2",
|
|
87
|
+
"[&.mint-button-active>*]:scale-95",
|
|
88
|
+
"[&>*]:transition-transform",
|
|
89
|
+
"[&>*]:duration-100",
|
|
90
|
+
"disabled:opacity-50",
|
|
91
|
+
"disabled:cursor-not-allowed"
|
|
92
|
+
], r = this.getTone(), i = {
|
|
93
|
+
"solid-action": [
|
|
94
|
+
"bg-slate-800",
|
|
95
|
+
"dark:bg-slate-600",
|
|
96
|
+
"text-white",
|
|
97
|
+
"hover:bg-slate-950",
|
|
98
|
+
"dark:hover:bg-slate-700",
|
|
99
|
+
"active:bg-slate-900",
|
|
100
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
101
|
+
"dark:active:bg-slate-700",
|
|
102
|
+
"disabled:active:bg-slate-800",
|
|
103
|
+
"dark:disabled:active:bg-slate-600",
|
|
104
|
+
"disabled:active:shadow-none",
|
|
105
|
+
"focus-visible:ring-slate-500",
|
|
106
|
+
"dark:focus-visible:ring-slate-400",
|
|
107
|
+
"shadow-sm",
|
|
108
|
+
"hover:shadow",
|
|
109
|
+
"dark:shadow-gray-900/50",
|
|
110
|
+
"border-2",
|
|
111
|
+
"border-transparent"
|
|
112
|
+
],
|
|
113
|
+
"solid-neutral": [
|
|
114
|
+
"bg-white",
|
|
115
|
+
"dark:bg-gray-700",
|
|
116
|
+
"text-gray-900",
|
|
117
|
+
"dark:text-white",
|
|
118
|
+
"hover:bg-gray-50",
|
|
119
|
+
"dark:hover:bg-gray-600",
|
|
120
|
+
"active:bg-gray-100",
|
|
121
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
122
|
+
"dark:active:bg-gray-800",
|
|
123
|
+
"disabled:active:bg-white",
|
|
124
|
+
"dark:disabled:active:bg-gray-700",
|
|
125
|
+
"disabled:active:shadow-none",
|
|
126
|
+
"focus-visible:ring-gray-400",
|
|
127
|
+
"dark:focus-visible:ring-gray-500",
|
|
128
|
+
"shadow-sm",
|
|
129
|
+
"hover:shadow",
|
|
130
|
+
"dark:shadow-gray-900/50",
|
|
131
|
+
"border-2",
|
|
132
|
+
"border-gray-200",
|
|
133
|
+
"dark:border-gray-600"
|
|
134
|
+
],
|
|
135
|
+
"solid-info": [
|
|
136
|
+
"bg-blue-800",
|
|
137
|
+
"dark:bg-blue-600",
|
|
138
|
+
"text-white",
|
|
139
|
+
"hover:bg-blue-950",
|
|
140
|
+
"dark:hover:bg-blue-700",
|
|
141
|
+
"active:bg-blue-900",
|
|
142
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
143
|
+
"dark:active:bg-blue-700",
|
|
144
|
+
"disabled:active:bg-blue-800",
|
|
145
|
+
"dark:disabled:active:bg-blue-600",
|
|
146
|
+
"disabled:active:shadow-none",
|
|
147
|
+
"focus-visible:ring-blue-500",
|
|
148
|
+
"dark:focus-visible:ring-blue-400",
|
|
149
|
+
"shadow-sm",
|
|
150
|
+
"hover:shadow",
|
|
151
|
+
"dark:shadow-gray-900/50",
|
|
152
|
+
"border-2",
|
|
153
|
+
"border-transparent"
|
|
154
|
+
],
|
|
155
|
+
"solid-warning": [
|
|
156
|
+
"bg-amber-800",
|
|
157
|
+
"dark:bg-amber-600",
|
|
158
|
+
"text-white",
|
|
159
|
+
"hover:bg-amber-950",
|
|
160
|
+
"dark:hover:bg-amber-700",
|
|
161
|
+
"active:bg-amber-900",
|
|
162
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
163
|
+
"dark:active:bg-amber-700",
|
|
164
|
+
"disabled:active:bg-amber-800",
|
|
165
|
+
"dark:disabled:active:bg-amber-600",
|
|
166
|
+
"disabled:active:shadow-none",
|
|
167
|
+
"focus-visible:ring-amber-500",
|
|
168
|
+
"dark:focus-visible:ring-amber-400",
|
|
169
|
+
"shadow-sm",
|
|
170
|
+
"hover:shadow",
|
|
171
|
+
"dark:shadow-gray-900/50",
|
|
172
|
+
"border-2",
|
|
173
|
+
"border-transparent"
|
|
174
|
+
],
|
|
175
|
+
"solid-danger": [
|
|
176
|
+
"bg-red-800",
|
|
177
|
+
"dark:bg-red-600",
|
|
178
|
+
"text-white",
|
|
179
|
+
"hover:bg-red-950",
|
|
180
|
+
"dark:hover:bg-red-700",
|
|
181
|
+
"active:bg-red-900",
|
|
182
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
183
|
+
"dark:active:bg-red-700",
|
|
184
|
+
"disabled:active:bg-red-800",
|
|
185
|
+
"dark:disabled:active:bg-red-600",
|
|
186
|
+
"disabled:active:shadow-none",
|
|
187
|
+
"focus-visible:ring-red-500",
|
|
188
|
+
"dark:focus-visible:ring-red-400",
|
|
189
|
+
"shadow-sm",
|
|
190
|
+
"hover:shadow",
|
|
191
|
+
"dark:shadow-gray-900/50",
|
|
192
|
+
"border-2",
|
|
193
|
+
"border-transparent"
|
|
194
|
+
],
|
|
195
|
+
"outline-action": [
|
|
196
|
+
"bg-transparent",
|
|
197
|
+
"border-2",
|
|
198
|
+
"border-slate-700",
|
|
199
|
+
"dark:border-slate-500",
|
|
200
|
+
"text-slate-800",
|
|
201
|
+
"dark:text-slate-600",
|
|
202
|
+
"hover:bg-slate-800",
|
|
203
|
+
"dark:hover:bg-slate-600",
|
|
204
|
+
"hover:text-white",
|
|
205
|
+
"active:bg-slate-900",
|
|
206
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
207
|
+
"dark:active:bg-slate-700",
|
|
208
|
+
"disabled:active:bg-transparent",
|
|
209
|
+
"dark:disabled:active:bg-transparent",
|
|
210
|
+
"disabled:active:shadow-none",
|
|
211
|
+
"focus-visible:ring-slate-500",
|
|
212
|
+
"dark:focus-visible:ring-slate-400",
|
|
213
|
+
"shadow-none",
|
|
214
|
+
"hover:shadow-sm"
|
|
215
|
+
],
|
|
216
|
+
"outline-neutral": [
|
|
217
|
+
"bg-transparent",
|
|
218
|
+
"border-2",
|
|
219
|
+
"border-gray-300",
|
|
220
|
+
"dark:border-gray-500",
|
|
221
|
+
"text-gray-700",
|
|
222
|
+
"dark:text-gray-200",
|
|
223
|
+
"hover:bg-white",
|
|
224
|
+
"dark:hover:bg-gray-700",
|
|
225
|
+
"hover:text-gray-900",
|
|
226
|
+
"dark:hover:text-white",
|
|
227
|
+
"active:bg-gray-50",
|
|
228
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
229
|
+
"dark:active:bg-gray-800",
|
|
230
|
+
"disabled:active:bg-transparent",
|
|
231
|
+
"dark:disabled:active:bg-transparent",
|
|
232
|
+
"disabled:active:shadow-none",
|
|
233
|
+
"focus-visible:ring-gray-400",
|
|
234
|
+
"dark:focus-visible:ring-gray-500",
|
|
235
|
+
"shadow-none",
|
|
236
|
+
"hover:shadow-sm"
|
|
237
|
+
],
|
|
238
|
+
"outline-info": [
|
|
239
|
+
"bg-transparent",
|
|
240
|
+
"border-2",
|
|
241
|
+
"border-blue-700",
|
|
242
|
+
"dark:border-blue-500",
|
|
243
|
+
"text-blue-800",
|
|
244
|
+
"dark:text-blue-600",
|
|
245
|
+
"hover:bg-blue-800",
|
|
246
|
+
"dark:hover:bg-blue-600",
|
|
247
|
+
"hover:text-white",
|
|
248
|
+
"active:bg-blue-900",
|
|
249
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
250
|
+
"dark:active:bg-blue-700",
|
|
251
|
+
"disabled:active:bg-transparent",
|
|
252
|
+
"dark:disabled:active:bg-transparent",
|
|
253
|
+
"disabled:active:shadow-none",
|
|
254
|
+
"focus-visible:ring-blue-500",
|
|
255
|
+
"dark:focus-visible:ring-blue-400",
|
|
256
|
+
"shadow-none",
|
|
257
|
+
"hover:shadow-sm"
|
|
258
|
+
],
|
|
259
|
+
"outline-warning": [
|
|
260
|
+
"bg-transparent",
|
|
261
|
+
"border-2",
|
|
262
|
+
"border-amber-700",
|
|
263
|
+
"dark:border-amber-500",
|
|
264
|
+
"text-amber-800",
|
|
265
|
+
"dark:text-amber-600",
|
|
266
|
+
"hover:bg-amber-800",
|
|
267
|
+
"dark:hover:bg-amber-600",
|
|
268
|
+
"hover:text-white",
|
|
269
|
+
"active:bg-amber-900",
|
|
270
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
271
|
+
"dark:active:bg-amber-700",
|
|
272
|
+
"disabled:active:bg-transparent",
|
|
273
|
+
"dark:disabled:active:bg-transparent",
|
|
274
|
+
"disabled:active:shadow-none",
|
|
275
|
+
"focus-visible:ring-amber-500",
|
|
276
|
+
"dark:focus-visible:ring-amber-400",
|
|
277
|
+
"shadow-none",
|
|
278
|
+
"hover:shadow-sm"
|
|
279
|
+
],
|
|
280
|
+
"outline-danger": [
|
|
281
|
+
"bg-transparent",
|
|
282
|
+
"border-2",
|
|
283
|
+
"border-red-700",
|
|
284
|
+
"dark:border-red-500",
|
|
285
|
+
"text-red-800",
|
|
286
|
+
"dark:text-red-600",
|
|
287
|
+
"hover:bg-red-800",
|
|
288
|
+
"dark:hover:bg-red-600",
|
|
289
|
+
"hover:text-white",
|
|
290
|
+
"active:bg-red-900",
|
|
291
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
|
|
292
|
+
"dark:active:bg-red-700",
|
|
293
|
+
"disabled:active:bg-transparent",
|
|
294
|
+
"dark:disabled:active:bg-transparent",
|
|
295
|
+
"disabled:active:shadow-none",
|
|
296
|
+
"focus-visible:ring-red-500",
|
|
297
|
+
"dark:focus-visible:ring-red-400",
|
|
298
|
+
"shadow-none",
|
|
299
|
+
"hover:shadow-sm"
|
|
300
|
+
],
|
|
301
|
+
"ghost-action": [
|
|
302
|
+
"bg-transparent",
|
|
303
|
+
"text-slate-800",
|
|
304
|
+
"dark:text-slate-400",
|
|
305
|
+
"active:bg-gray-100",
|
|
306
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
307
|
+
"dark:active:bg-gray-800",
|
|
308
|
+
"disabled:active:bg-transparent",
|
|
309
|
+
"dark:disabled:active:bg-transparent",
|
|
310
|
+
"disabled:active:shadow-none",
|
|
311
|
+
"focus-visible:ring-gray-400",
|
|
312
|
+
"dark:focus-visible:ring-gray-500",
|
|
313
|
+
"shadow-none",
|
|
314
|
+
"hover:shadow-none",
|
|
315
|
+
"border-2",
|
|
316
|
+
"border-transparent"
|
|
317
|
+
],
|
|
318
|
+
"ghost-neutral": [
|
|
319
|
+
"bg-transparent",
|
|
320
|
+
"text-gray-700",
|
|
321
|
+
"dark:text-gray-200",
|
|
322
|
+
"active:bg-gray-50",
|
|
323
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
324
|
+
"dark:active:bg-gray-800",
|
|
325
|
+
"active:text-gray-900",
|
|
326
|
+
"dark:active:text-white",
|
|
327
|
+
"disabled:active:bg-transparent",
|
|
328
|
+
"dark:disabled:active:bg-transparent",
|
|
329
|
+
"disabled:active:shadow-none",
|
|
330
|
+
"focus-visible:ring-gray-400",
|
|
331
|
+
"dark:focus-visible:ring-gray-500",
|
|
332
|
+
"shadow-none",
|
|
333
|
+
"hover:shadow-none",
|
|
334
|
+
"border-2",
|
|
335
|
+
"border-transparent"
|
|
336
|
+
],
|
|
337
|
+
"ghost-info": [
|
|
338
|
+
"bg-transparent",
|
|
339
|
+
"text-blue-800",
|
|
340
|
+
"dark:text-blue-400",
|
|
341
|
+
"active:bg-gray-100",
|
|
342
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
343
|
+
"dark:active:bg-gray-800",
|
|
344
|
+
"disabled:active:bg-transparent",
|
|
345
|
+
"dark:disabled:active:bg-transparent",
|
|
346
|
+
"disabled:active:shadow-none",
|
|
347
|
+
"focus-visible:ring-gray-400",
|
|
348
|
+
"dark:focus-visible:ring-gray-500",
|
|
349
|
+
"shadow-none",
|
|
350
|
+
"hover:shadow-none",
|
|
351
|
+
"border-2",
|
|
352
|
+
"border-transparent"
|
|
353
|
+
],
|
|
354
|
+
"ghost-warning": [
|
|
355
|
+
"bg-transparent",
|
|
356
|
+
"text-amber-800",
|
|
357
|
+
"dark:text-amber-400",
|
|
358
|
+
"active:bg-gray-100",
|
|
359
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
360
|
+
"dark:active:bg-gray-800",
|
|
361
|
+
"disabled:active:bg-transparent",
|
|
362
|
+
"dark:disabled:active:bg-transparent",
|
|
363
|
+
"disabled:active:shadow-none",
|
|
364
|
+
"focus-visible:ring-gray-400",
|
|
365
|
+
"dark:focus-visible:ring-gray-500",
|
|
366
|
+
"shadow-none",
|
|
367
|
+
"hover:shadow-none",
|
|
368
|
+
"border-2",
|
|
369
|
+
"border-transparent"
|
|
370
|
+
],
|
|
371
|
+
"ghost-danger": [
|
|
372
|
+
"bg-transparent",
|
|
373
|
+
"text-red-800",
|
|
374
|
+
"dark:text-red-400",
|
|
375
|
+
"active:bg-gray-100",
|
|
376
|
+
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
377
|
+
"dark:active:bg-gray-800",
|
|
378
|
+
"disabled:active:bg-transparent",
|
|
379
|
+
"dark:disabled:active:bg-transparent",
|
|
380
|
+
"disabled:active:shadow-none",
|
|
381
|
+
"focus-visible:ring-gray-400",
|
|
382
|
+
"dark:focus-visible:ring-gray-500",
|
|
383
|
+
"shadow-none",
|
|
384
|
+
"hover:shadow-none",
|
|
385
|
+
"border-2",
|
|
386
|
+
"border-transparent"
|
|
387
|
+
],
|
|
388
|
+
"link-action": [
|
|
389
|
+
"bg-transparent",
|
|
390
|
+
"text-slate-800",
|
|
391
|
+
"dark:text-slate-400",
|
|
392
|
+
"hover:text-slate-950",
|
|
393
|
+
"dark:hover:text-slate-200",
|
|
394
|
+
"active:text-slate-900",
|
|
395
|
+
"dark:active:text-slate-300",
|
|
396
|
+
"disabled:active:bg-transparent",
|
|
397
|
+
"dark:disabled:active:bg-transparent",
|
|
398
|
+
"disabled:active:shadow-none",
|
|
399
|
+
"focus-visible:ring-slate-500",
|
|
400
|
+
"dark:focus-visible:ring-slate-400",
|
|
401
|
+
"shadow-none",
|
|
402
|
+
"hover:shadow-none",
|
|
403
|
+
"border-2",
|
|
404
|
+
"border-transparent"
|
|
405
|
+
],
|
|
406
|
+
"link-neutral": [
|
|
407
|
+
"bg-transparent",
|
|
408
|
+
"text-gray-700",
|
|
409
|
+
"dark:text-gray-300",
|
|
410
|
+
"hover:text-gray-900",
|
|
411
|
+
"dark:hover:text-gray-100",
|
|
412
|
+
"active:text-gray-950",
|
|
413
|
+
"dark:active:text-gray-200",
|
|
414
|
+
"disabled:active:bg-transparent",
|
|
415
|
+
"dark:disabled:active:bg-transparent",
|
|
416
|
+
"disabled:active:shadow-none",
|
|
417
|
+
"focus-visible:ring-gray-400",
|
|
418
|
+
"dark:focus-visible:ring-gray-500",
|
|
419
|
+
"shadow-none",
|
|
420
|
+
"hover:shadow-none",
|
|
421
|
+
"border-2",
|
|
422
|
+
"border-transparent"
|
|
423
|
+
],
|
|
424
|
+
"link-info": [
|
|
425
|
+
"bg-transparent",
|
|
426
|
+
"text-blue-800",
|
|
427
|
+
"dark:text-blue-400",
|
|
428
|
+
"hover:text-blue-950",
|
|
429
|
+
"dark:hover:text-blue-300",
|
|
430
|
+
"active:text-blue-900",
|
|
431
|
+
"dark:active:text-blue-200",
|
|
432
|
+
"disabled:active:bg-transparent",
|
|
433
|
+
"dark:disabled:active:bg-transparent",
|
|
434
|
+
"disabled:active:shadow-none",
|
|
435
|
+
"focus-visible:ring-blue-500",
|
|
436
|
+
"dark:focus-visible:ring-blue-400",
|
|
437
|
+
"shadow-none",
|
|
438
|
+
"hover:shadow-none",
|
|
439
|
+
"border-2",
|
|
440
|
+
"border-transparent"
|
|
441
|
+
],
|
|
442
|
+
"link-warning": [
|
|
443
|
+
"bg-transparent",
|
|
444
|
+
"text-amber-800",
|
|
445
|
+
"dark:text-amber-400",
|
|
446
|
+
"hover:text-amber-950",
|
|
447
|
+
"dark:hover:text-amber-300",
|
|
448
|
+
"active:text-amber-900",
|
|
449
|
+
"dark:active:text-amber-200",
|
|
450
|
+
"disabled:active:bg-transparent",
|
|
451
|
+
"dark:disabled:active:bg-transparent",
|
|
452
|
+
"disabled:active:shadow-none",
|
|
453
|
+
"focus-visible:ring-amber-500",
|
|
454
|
+
"dark:focus-visible:ring-amber-400",
|
|
455
|
+
"shadow-none",
|
|
456
|
+
"hover:shadow-none",
|
|
457
|
+
"border-2",
|
|
458
|
+
"border-transparent"
|
|
459
|
+
],
|
|
460
|
+
"link-danger": [
|
|
461
|
+
"bg-transparent",
|
|
462
|
+
"text-red-800",
|
|
463
|
+
"dark:text-red-400",
|
|
464
|
+
"hover:text-red-950",
|
|
465
|
+
"dark:hover:text-red-300",
|
|
466
|
+
"active:text-red-900",
|
|
467
|
+
"dark:active:text-red-200",
|
|
468
|
+
"disabled:active:bg-transparent",
|
|
469
|
+
"dark:disabled:active:bg-transparent",
|
|
470
|
+
"disabled:active:shadow-none",
|
|
471
|
+
"focus-visible:ring-red-500",
|
|
472
|
+
"dark:focus-visible:ring-red-400",
|
|
473
|
+
"shadow-none",
|
|
474
|
+
"hover:shadow-none",
|
|
475
|
+
"border-2",
|
|
476
|
+
"border-transparent"
|
|
477
|
+
]
|
|
478
|
+
}, a = i[`${t}-${r}`] || i["solid-neutral"], o = [...n, ...a];
|
|
479
|
+
return this.isFullWidth() && o.push("w-full"), o.join(" ");
|
|
480
|
+
}
|
|
481
|
+
render() {
|
|
482
|
+
let e = this.isDisabled() || this.isLoading(), t = this.getType();
|
|
483
|
+
if (!this._button) {
|
|
484
|
+
for (this._button = document.createElement("button"); this.firstChild;) this._button.appendChild(this.firstChild);
|
|
485
|
+
this.appendChild(this._button), this.setupEventListeners();
|
|
486
|
+
}
|
|
487
|
+
this._button.type = t, this._button.disabled = e;
|
|
488
|
+
let n = this._button.querySelector("mint-spinner");
|
|
489
|
+
if (this.isLoading()) if (n) n.setAttribute("data-button-variant", this.getVariant()), n.setAttribute("data-button-tone", this.getTone()), n.render();
|
|
490
|
+
else {
|
|
491
|
+
let e = document.createElement("span");
|
|
492
|
+
e.className = "mr-2 inline-flex items-center";
|
|
493
|
+
let t = document.createElement("mint-spinner");
|
|
494
|
+
t.setAttribute("size", "default"), t.setAttribute("data-button-variant", this.getVariant()), t.setAttribute("data-button-tone", this.getTone()), t.style.width = "0.875rem", t.style.height = "0.875rem", e.appendChild(t), this._button.insertBefore(e, this._button.firstChild);
|
|
495
|
+
}
|
|
496
|
+
else n && n.parentElement?.remove();
|
|
497
|
+
for (; this.firstChild && this.firstChild !== this._button;) this._button.appendChild(this.firstChild);
|
|
498
|
+
let r = this.getIcon(), i = this._button.querySelector("[slot=\"icon\"], .mint-button-icon, mint-icon");
|
|
499
|
+
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");
|
|
500
|
+
let a = this.getIconPosition(), o = this._button.querySelector(".mint-button-content");
|
|
501
|
+
if (o) {
|
|
502
|
+
let e = i && i.tagName === "MINT-ICON";
|
|
503
|
+
if (i && !i.parentElement) {
|
|
504
|
+
let t = this._button.querySelector("mint-spinner")?.parentElement;
|
|
505
|
+
e || a === "left" ? t ? t.insertAdjacentElement("afterend", i) : this._button.insertBefore(i, o) : o.insertAdjacentElement("afterend", i);
|
|
506
|
+
} else if (i && (e || a === "left") && i.nextSibling !== o) {
|
|
507
|
+
i.remove();
|
|
508
|
+
let e = this._button.querySelector("mint-spinner")?.parentElement;
|
|
509
|
+
e ? e.insertAdjacentElement("afterend", i) : this._button.insertBefore(i, o);
|
|
510
|
+
} else i && !e && a === "right" && i.previousSibling !== o && (i.remove(), o.insertAdjacentElement("afterend", i));
|
|
511
|
+
} else {
|
|
512
|
+
let e = [];
|
|
513
|
+
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);
|
|
514
|
+
if (e.length > 0) {
|
|
515
|
+
o = document.createElement("span"), o.className = "mint-button-content inline-flex items-center", e.forEach((e) => {
|
|
516
|
+
o.appendChild(e);
|
|
517
|
+
});
|
|
518
|
+
let t = this._button.querySelector("mint-spinner")?.parentElement;
|
|
519
|
+
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);
|
|
520
|
+
} else if (i && i.tagName === "MINT-ICON" && !i.parentElement) {
|
|
521
|
+
let e = this._button.querySelector("mint-spinner")?.parentElement;
|
|
522
|
+
e ? e.insertAdjacentElement("afterend", i) : this._button.insertBefore(i, this._button.firstChild);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
let s = this.isIconOnly();
|
|
526
|
+
i && (i.classList.contains("mint-button-icon") || i.classList.add("mint-button-icon"), i.classList.remove("mr-1.5", "ml-1.5"), s ? 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("mr-1.5") : i.classList.add("ml-1.5"));
|
|
527
|
+
let c = this.getButtonClasses();
|
|
528
|
+
this._button.className = c;
|
|
529
|
+
}
|
|
530
|
+
setupEventListeners() {
|
|
531
|
+
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));
|
|
532
|
+
}
|
|
533
|
+
removeEventListeners() {
|
|
534
|
+
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));
|
|
535
|
+
}
|
|
536
|
+
_handleMouseDown = () => {
|
|
537
|
+
this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
|
|
538
|
+
};
|
|
539
|
+
_handleMouseUp = () => {
|
|
540
|
+
this._button && this._button.classList.remove("mint-button-active");
|
|
541
|
+
};
|
|
542
|
+
_handleMouseLeave = () => {
|
|
543
|
+
this._button && this._button.classList.remove("mint-button-active");
|
|
544
|
+
};
|
|
545
|
+
_handleTouchStart = () => {
|
|
546
|
+
this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
|
|
547
|
+
};
|
|
548
|
+
_handleTouchEnd = () => {
|
|
549
|
+
this._button && this._button.classList.remove("mint-button-active");
|
|
550
|
+
};
|
|
551
|
+
_handleTouchCancel = () => {
|
|
552
|
+
this._button && this._button.classList.remove("mint-button-active");
|
|
553
|
+
};
|
|
554
|
+
handleClick(e) {
|
|
555
|
+
if (this.isDisabled() || this.isLoading()) {
|
|
556
|
+
e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (e.stopPropagation(), e.stopImmediatePropagation(), this._isHandlingClick) {
|
|
560
|
+
e.preventDefault();
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
this._isHandlingClick = !0, e.preventDefault(), this.dispatchEvent(new CustomEvent("click", {
|
|
564
|
+
detail: { originalEvent: e },
|
|
565
|
+
bubbles: !0,
|
|
566
|
+
cancelable: !0,
|
|
567
|
+
composed: !0
|
|
568
|
+
})), requestAnimationFrame(() => {
|
|
569
|
+
this._isHandlingClick = !1;
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
customElements.get("mint-button") || customElements.define("mint-button", e);
|
|
574
|
+
//#endregion
|
|
575
|
+
export { e as t };
|