monobill-mintui 0.1.0 → 0.1.1
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/README.md +63 -18
- package/dist/components/table/Table.d.ts +13 -0
- package/dist/components/table/Table.d.ts.map +1 -0
- package/dist/components/table/index.d.ts +3 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +145 -69
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import './components/select/index';
|
|
|
18
18
|
import './components/dropzone/index';
|
|
19
19
|
import './components/form/index';
|
|
20
20
|
import './components/back-button/index';
|
|
21
|
+
import './components/table/index';
|
|
21
22
|
export { default as Button } from './components/button/Button';
|
|
22
23
|
export { default as Switch } from './components/switch/Switch';
|
|
23
24
|
export { default as Spinner } from './components/spinner/Spinner';
|
|
@@ -38,5 +39,6 @@ export { default as Select } from './components/select/Select';
|
|
|
38
39
|
export { default as Dropzone } from './components/dropzone/Dropzone';
|
|
39
40
|
export { default as Form } from './components/form/Form';
|
|
40
41
|
export { default as BackButton } from './components/back-button/BackButton';
|
|
42
|
+
export { default as Table } from './components/table/Table';
|
|
41
43
|
export { default } from './components/button/Button';
|
|
42
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAA;AAClC,OAAO,2BAA2B,CAAA;AAClC,OAAO,4BAA4B,CAAA;AACnC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,0BAA0B,CAAA;AACjC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,0BAA0B,CAAA;AACjC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,gCAAgC,CAAA;AACvC,OAAO,2BAA2B,CAAA;AAClC,OAAO,6BAA6B,CAAA;AACpC,OAAO,yBAAyB,CAAA;AAChC,OAAO,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAA;AAClC,OAAO,2BAA2B,CAAA;AAClC,OAAO,4BAA4B,CAAA;AACnC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,0BAA0B,CAAA;AACjC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,yBAAyB,CAAA;AAChC,OAAO,0BAA0B,CAAA;AACjC,OAAO,4BAA4B,CAAA;AACnC,OAAO,6BAA6B,CAAA;AACpC,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,gCAAgC,CAAA;AACvC,OAAO,2BAA2B,CAAA;AAClC,OAAO,6BAA6B,CAAA;AACpC,OAAO,yBAAyB,CAAA;AAChC,OAAO,gCAAgC,CAAA;AACvC,OAAO,0BAA0B,CAAA;AAGjC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -556,10 +556,10 @@ class R extends HTMLElement {
|
|
|
556
556
|
if (i)
|
|
557
557
|
i.setAttribute("data-button-variant", this.getVariant()), i.setAttribute("data-button-tone", this.getTone()), "render" in i && typeof i.render == "function" && i.render();
|
|
558
558
|
else {
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
const
|
|
562
|
-
|
|
559
|
+
const g = document.createElement("span");
|
|
560
|
+
g.className = "mr-2 inline-flex items-center";
|
|
561
|
+
const _ = document.createElement("mint-spinner");
|
|
562
|
+
_.setAttribute("size", "default"), _.setAttribute("data-button-variant", this.getVariant()), _.setAttribute("data-button-tone", this.getTone()), _.style.width = "0.875rem", _.style.height = "0.875rem", g.appendChild(_), this._button.insertBefore(g, this._button.firstChild);
|
|
563
563
|
}
|
|
564
564
|
else i && ((h = i.parentElement) == null || h.remove());
|
|
565
565
|
for (; this.firstChild && this.firstChild !== this._button; )
|
|
@@ -570,34 +570,34 @@ class R extends HTMLElement {
|
|
|
570
570
|
const n = this.getIconPosition();
|
|
571
571
|
let a = this._button.querySelector(".mint-button-content");
|
|
572
572
|
if (a) {
|
|
573
|
-
const
|
|
573
|
+
const g = r && r.tagName === "MINT-ICON";
|
|
574
574
|
if (r && !r.parentElement) {
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
} else if (r && (
|
|
575
|
+
const _ = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
|
|
576
|
+
g || n === "left" ? _ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a) : a.insertAdjacentElement("afterend", r);
|
|
577
|
+
} else if (r && (g || n === "left") && r.nextSibling !== a) {
|
|
578
578
|
r.remove();
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
} else r && !
|
|
579
|
+
const _ = (f = this._button.querySelector("mint-spinner")) == null ? void 0 : f.parentElement;
|
|
580
|
+
_ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a);
|
|
581
|
+
} else r && !g && n === "right" && r.previousSibling !== a && (r.remove(), a.insertAdjacentElement("afterend", r));
|
|
582
582
|
} else {
|
|
583
|
-
const
|
|
584
|
-
for (let
|
|
585
|
-
if (
|
|
586
|
-
|
|
583
|
+
const g = [];
|
|
584
|
+
for (let _ = this._button.firstChild; _; _ = _.nextSibling) {
|
|
585
|
+
if (_.nodeType !== Node.ELEMENT_NODE) {
|
|
586
|
+
g.push(_);
|
|
587
587
|
continue;
|
|
588
588
|
}
|
|
589
|
-
const m =
|
|
590
|
-
m.tagName !== "MINT-SPINNER" && !m.querySelector("mint-spinner") &&
|
|
589
|
+
const m = _;
|
|
590
|
+
m.tagName !== "MINT-SPINNER" && !m.querySelector("mint-spinner") && _ !== r && !m.hasAttribute("slot") && !(m.className === "mr-2" && m.querySelector("mint-spinner")) && g.push(_);
|
|
591
591
|
}
|
|
592
|
-
if (
|
|
593
|
-
a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center",
|
|
592
|
+
if (g.length > 0) {
|
|
593
|
+
a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", g.forEach((m) => {
|
|
594
594
|
a.appendChild(m);
|
|
595
595
|
});
|
|
596
|
-
const
|
|
597
|
-
r && n === "left" ?
|
|
596
|
+
const _ = (c = this._button.querySelector("mint-spinner")) == null ? void 0 : c.parentElement;
|
|
597
|
+
r && n === "left" ? _ ? (_.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", a)) : r && n === "right" ? _ ? (_.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", r)) : _ ? _.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
|
|
598
598
|
} else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
|
|
599
|
-
const
|
|
600
|
-
|
|
599
|
+
const _ = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
|
|
600
|
+
_ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, this._button.firstChild);
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
const l = this.isIconOnly();
|
|
@@ -1206,7 +1206,7 @@ class G extends HTMLElement {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
_updateBackgroundColor() {
|
|
1208
1208
|
if (!this._pageContainer) return;
|
|
1209
|
-
document.documentElement.classList.contains("dark") ? (this._pageContainer.classList.remove("bg-gray-
|
|
1209
|
+
document.documentElement.classList.contains("dark") ? (this._pageContainer.classList.remove("bg-gray-20"), this._pageContainer.classList.add("bg-gray-900")) : (this._pageContainer.classList.remove("bg-gray-900"), this._pageContainer.classList.add("bg-gray-20"));
|
|
1210
1210
|
}
|
|
1211
1211
|
_observeDarkMode() {
|
|
1212
1212
|
this._darkModeObserver || (this._darkModeObserver = new MutationObserver(() => {
|
|
@@ -2116,7 +2116,7 @@ class se extends HTMLElement {
|
|
|
2116
2116
|
render() {
|
|
2117
2117
|
var v, C, S, y;
|
|
2118
2118
|
this.getType();
|
|
2119
|
-
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), d = this.getRows(), u = this.getIcon(), f = this.getLabel(),
|
|
2119
|
+
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), d = this.getRows(), u = this.getIcon(), f = this.getLabel(), g = this.getInfo();
|
|
2120
2120
|
if (s) {
|
|
2121
2121
|
this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = c || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (p) => {
|
|
2122
2122
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
@@ -2198,7 +2198,7 @@ class se extends HTMLElement {
|
|
|
2198
2198
|
b && !this._input.value && (this._input.value = b.trim()), this.removeChild(this.firstChild);
|
|
2199
2199
|
}
|
|
2200
2200
|
let m = this.querySelector(".mint-input-label-container");
|
|
2201
|
-
if (f ||
|
|
2201
|
+
if (f || g) {
|
|
2202
2202
|
m || (m = document.createElement("div"), m.className = "mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]", this._wrapper && this._wrapper.parentElement === this ? this.insertBefore(m, this._wrapper) : this.insertBefore(m, this.firstChild));
|
|
2203
2203
|
let b = m.querySelector(".mint-input-label");
|
|
2204
2204
|
if (f) {
|
|
@@ -2213,7 +2213,7 @@ class se extends HTMLElement {
|
|
|
2213
2213
|
n ? b.classList.add("opacity-40") : b.classList.remove("opacity-40");
|
|
2214
2214
|
} else b && b.remove();
|
|
2215
2215
|
let p = m.querySelector(".mint-input-info");
|
|
2216
|
-
|
|
2216
|
+
g ? (p || (p = document.createElement("span"), p.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", m.appendChild(p)), p.textContent = g, n ? p.classList.add("opacity-40") : p.classList.remove("opacity-40")) : p && p.remove();
|
|
2217
2217
|
} else m && m.remove();
|
|
2218
2218
|
this._renderErrorState();
|
|
2219
2219
|
}
|
|
@@ -2485,11 +2485,11 @@ class re extends HTMLElement {
|
|
|
2485
2485
|
_parseDateString(e, t) {
|
|
2486
2486
|
const i = /[\/\-\.\s]+/;
|
|
2487
2487
|
if (i.test(e)) {
|
|
2488
|
-
const
|
|
2489
|
-
if (
|
|
2488
|
+
const _ = e.split(i).filter((v) => v.length > 0), m = t.split(/[\/\-\.\s]+/).filter((v) => v.length > 0);
|
|
2489
|
+
if (_.length === m.length) {
|
|
2490
2490
|
let v = 0, C = 0, S = 0;
|
|
2491
2491
|
for (let y = 0; y < m.length; y++) {
|
|
2492
|
-
const b = m[y].toLowerCase(), p =
|
|
2492
|
+
const b = m[y].toLowerCase(), p = _[y];
|
|
2493
2493
|
if (b.includes("d"))
|
|
2494
2494
|
v = parseInt(p, 10);
|
|
2495
2495
|
else if (b.includes("m"))
|
|
@@ -2513,27 +2513,27 @@ class re extends HTMLElement {
|
|
|
2513
2513
|
{ char: "d", index: a },
|
|
2514
2514
|
{ char: "m", index: l },
|
|
2515
2515
|
{ char: "y", index: o }
|
|
2516
|
-
].sort((
|
|
2516
|
+
].sort((_, m) => _.index - m.index);
|
|
2517
2517
|
let c = 0, d = 0, u = 0, f = 0;
|
|
2518
2518
|
n.length, r.length;
|
|
2519
|
-
for (const
|
|
2520
|
-
if (
|
|
2519
|
+
for (const _ of h)
|
|
2520
|
+
if (_.char === "d") {
|
|
2521
2521
|
const m = n.lastIndexOf("d") - n.indexOf("d") + 1, v = r.substr(f, m);
|
|
2522
2522
|
if (v.length === 0) return null;
|
|
2523
2523
|
c = parseInt(v, 10), f += v.length;
|
|
2524
|
-
} else if (
|
|
2524
|
+
} else if (_.char === "m") {
|
|
2525
2525
|
const m = n.lastIndexOf("m") - n.indexOf("m") + 1, v = r.substr(f, m);
|
|
2526
2526
|
if (v.length === 0) return null;
|
|
2527
2527
|
d = parseInt(v, 10) - 1, f += v.length;
|
|
2528
|
-
} else if (
|
|
2528
|
+
} else if (_.char === "y") {
|
|
2529
2529
|
const m = n.lastIndexOf("y") - n.indexOf("y") + 1, v = r.substr(f), C = Math.min(m, v.length), S = v.substr(0, C);
|
|
2530
2530
|
if (S.length === 0) return null;
|
|
2531
2531
|
let y = parseInt(S, 10);
|
|
2532
2532
|
C === 2 && m === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : C === 2 && m === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), u = y, f += C;
|
|
2533
2533
|
}
|
|
2534
2534
|
if (!c || d < 0 || d > 11 || !u) return null;
|
|
2535
|
-
const
|
|
2536
|
-
return isNaN(
|
|
2535
|
+
const g = new Date(u, d, c);
|
|
2536
|
+
return isNaN(g.getTime()) || g.getDate() !== c || g.getMonth() !== d || g.getFullYear() !== u ? null : g;
|
|
2537
2537
|
}
|
|
2538
2538
|
_formatDate(e, t) {
|
|
2539
2539
|
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = t.toLowerCase();
|
|
@@ -2543,8 +2543,8 @@ class re extends HTMLElement {
|
|
|
2543
2543
|
// PHP-style formatter for display mode
|
|
2544
2544
|
_formatDatePhp(e, t) {
|
|
2545
2545
|
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], h = (u, f = 2) => u.toString().padStart(f, "0"), c = (u) => {
|
|
2546
|
-
const f = u % 10,
|
|
2547
|
-
return f === 1 &&
|
|
2546
|
+
const f = u % 10, g = u % 100;
|
|
2547
|
+
return f === 1 && g !== 11 ? "st" : f === 2 && g !== 12 ? "nd" : f === 3 && g !== 13 ? "rd" : "th";
|
|
2548
2548
|
};
|
|
2549
2549
|
let d = "";
|
|
2550
2550
|
for (let u = 0; u < t.length; u++) {
|
|
@@ -2618,7 +2618,7 @@ class re extends HTMLElement {
|
|
|
2618
2618
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
2619
2619
|
const f = this._getFormatTokens(o);
|
|
2620
2620
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
2621
|
-
const
|
|
2621
|
+
const g = (m) => {
|
|
2622
2622
|
const v = document.createDocumentFragment();
|
|
2623
2623
|
return f.forEach((C) => {
|
|
2624
2624
|
if (C.type === "sep") {
|
|
@@ -2630,12 +2630,12 @@ class re extends HTMLElement {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
}), v;
|
|
2632
2632
|
};
|
|
2633
|
-
if (this._inputsWrapperEl.appendChild(
|
|
2633
|
+
if (this._inputsWrapperEl.appendChild(g("start")), this._isRange) {
|
|
2634
2634
|
const m = document.createElement("span");
|
|
2635
|
-
m.textContent = " - ", m.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(m), this._inputsWrapperEl.appendChild(
|
|
2635
|
+
m.textContent = " - ", m.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(m), this._inputsWrapperEl.appendChild(g("end"));
|
|
2636
2636
|
}
|
|
2637
|
-
const
|
|
2638
|
-
if (
|
|
2637
|
+
const _ = document.createElement("div");
|
|
2638
|
+
if (_.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", _.appendChild(this._displayEl), _.appendChild(this._inputsWrapperEl), u.appendChild(_), u.addEventListener("click", () => {
|
|
2639
2639
|
this._isInputMode || s || r || this._enterInputMode();
|
|
2640
2640
|
}), this._attachPartInputHandlers(this._startPartInputs, f, u), this._isRange && this._attachPartInputHandlers(this._endPartInputs, f, u), this._parseValue(i), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
|
|
2641
2641
|
this._iconButton.disabled = s || r, !s && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
|
|
@@ -2816,12 +2816,12 @@ class re extends HTMLElement {
|
|
|
2816
2816
|
f.type = "button", f.tabIndex = 0, f.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", f.setAttribute("data-keep-popover-open", "true"), f.textContent = String(this._currentYear), f.addEventListener("click", () => {
|
|
2817
2817
|
this._viewMode = "year", this._buildCalendar();
|
|
2818
2818
|
}), d.appendChild(f), o.appendChild(d);
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2819
|
+
const g = document.createElement("button");
|
|
2820
|
+
g.type = "button", g.tabIndex = 0, g.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", g.setAttribute("data-keep-popover-open", "true");
|
|
2821
|
+
const _ = document.createElement("mint-icon");
|
|
2822
|
+
_.setAttribute("name", "caret-right"), _.className = "w-4 h-4", g.appendChild(_), g.addEventListener("click", () => {
|
|
2823
2823
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
2824
|
-
}), o.appendChild(
|
|
2824
|
+
}), o.appendChild(g);
|
|
2825
2825
|
const m = document.createElement("div");
|
|
2826
2826
|
m.className = "grid grid-cols-7 mb-2", s.forEach((y) => {
|
|
2827
2827
|
const b = document.createElement("div");
|
|
@@ -2889,25 +2889,25 @@ class re extends HTMLElement {
|
|
|
2889
2889
|
A.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", b.appendChild(A);
|
|
2890
2890
|
const L = () => {
|
|
2891
2891
|
if (window.innerWidth >= 768) {
|
|
2892
|
-
const
|
|
2893
|
-
|
|
2892
|
+
const T = p.scrollTop, H = p.scrollHeight, D = p.clientHeight;
|
|
2893
|
+
T > 0 ? w.style.opacity = "1" : w.style.opacity = "0", T + D < H - 1 ? A.style.opacity = "1" : A.style.opacity = "0", E.style.opacity = "0", I.style.opacity = "0";
|
|
2894
2894
|
} else {
|
|
2895
|
-
const
|
|
2896
|
-
|
|
2895
|
+
const T = p.scrollLeft, H = p.scrollWidth, D = p.clientWidth;
|
|
2896
|
+
T > 0 ? E.style.opacity = "1" : E.style.opacity = "0", T + D < H - 1 ? I.style.opacity = "1" : I.style.opacity = "0", w.style.opacity = "0", A.style.opacity = "0";
|
|
2897
2897
|
}
|
|
2898
2898
|
};
|
|
2899
2899
|
p.addEventListener("scroll", L), window.addEventListener("resize", L), setTimeout(L, 0), r.forEach((M) => {
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2900
|
+
const T = document.createElement("button");
|
|
2901
|
+
T.type = "button", T.tabIndex = 0, T.className = "px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", T.textContent = M.label, T.setAttribute("data-keep-popover-open", "true"), T.addEventListener("click", () => {
|
|
2902
2902
|
const H = M.action();
|
|
2903
2903
|
if (H) {
|
|
2904
2904
|
if (this._isRange && "start" in H && "end" in H) {
|
|
2905
2905
|
this._selectedStartDate = H.start, this._selectedEndDate = H.end;
|
|
2906
|
-
const
|
|
2906
|
+
const D = this.getFormat(), N = this._formatDate(H.start, D), O = this._formatDate(H.end, D), q = `${N} - ${O}`;
|
|
2907
2907
|
this.setValue(q), this._currentMonth = H.start.getMonth(), this._currentYear = H.start.getFullYear();
|
|
2908
2908
|
} else if (H instanceof Date) {
|
|
2909
2909
|
this._selectedStartDate = H, this._selectedEndDate = null;
|
|
2910
|
-
const
|
|
2910
|
+
const D = this.getFormat(), N = this._formatDate(H, D);
|
|
2911
2911
|
this.setValue(N), this._currentMonth = H.getMonth(), this._currentYear = H.getFullYear();
|
|
2912
2912
|
}
|
|
2913
2913
|
this._buildCalendar(), this._popover && typeof this._popover.close == "function" && this._popover.close(), this.dispatchEvent(new CustomEvent("input", {
|
|
@@ -2920,7 +2920,7 @@ class re extends HTMLElement {
|
|
|
2920
2920
|
cancelable: !0
|
|
2921
2921
|
}));
|
|
2922
2922
|
}
|
|
2923
|
-
}), p.appendChild(
|
|
2923
|
+
}), p.appendChild(T);
|
|
2924
2924
|
}), b.appendChild(p), y.appendChild(b), a.appendChild(y);
|
|
2925
2925
|
}
|
|
2926
2926
|
l.appendChild(o), l.appendChild(m), l.appendChild(v), a.appendChild(l), this._calendarContainer.appendChild(a);
|
|
@@ -3460,21 +3460,21 @@ class ae extends HTMLElement {
|
|
|
3460
3460
|
t.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((o, h) => {
|
|
3461
3461
|
const c = document.createElement("div");
|
|
3462
3462
|
if (c.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", o.type.startsWith("image/")) {
|
|
3463
|
-
const
|
|
3464
|
-
|
|
3465
|
-
const
|
|
3466
|
-
this._previewUrls.push(
|
|
3463
|
+
const g = document.createElement("img");
|
|
3464
|
+
g.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
|
|
3465
|
+
const _ = URL.createObjectURL(o);
|
|
3466
|
+
this._previewUrls.push(_), g.src = _, c.appendChild(g);
|
|
3467
3467
|
} else {
|
|
3468
|
-
const
|
|
3469
|
-
|
|
3468
|
+
const g = document.createElement("mint-icon");
|
|
3469
|
+
g.setAttribute("name", "attach"), g.className = "w-5 h-5 text-gray-500 dark:text-gray-300", c.appendChild(g);
|
|
3470
3470
|
}
|
|
3471
3471
|
const d = document.createElement("div");
|
|
3472
3472
|
d.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", d.textContent = o.name, c.appendChild(d);
|
|
3473
3473
|
const u = document.createElement("button");
|
|
3474
3474
|
u.type = "button", u.className = "text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";
|
|
3475
3475
|
const f = document.createElement("mint-icon");
|
|
3476
|
-
f.setAttribute("name", "close"), f.className = "w-4 h-4", u.appendChild(f), u.addEventListener("click", (
|
|
3477
|
-
|
|
3476
|
+
f.setAttribute("name", "close"), f.className = "w-4 h-4", u.appendChild(f), u.addEventListener("click", (g) => {
|
|
3477
|
+
g.preventDefault(), g.stopPropagation(), this._removeFileAt(h);
|
|
3478
3478
|
}), c.appendChild(u), t.appendChild(c);
|
|
3479
3479
|
});
|
|
3480
3480
|
const i = this.hasError(), s = this._isDragging;
|
|
@@ -3635,12 +3635,12 @@ class oe extends HTMLElement {
|
|
|
3635
3635
|
d.open(s, o, !0), Object.entries(l).forEach(([u, f]) => d.setRequestHeader(u, f)), d.onload = function() {
|
|
3636
3636
|
const { status: u, responseText: f } = d;
|
|
3637
3637
|
if (u >= 200 && u < 300) {
|
|
3638
|
-
let
|
|
3638
|
+
let g = f;
|
|
3639
3639
|
try {
|
|
3640
|
-
|
|
3640
|
+
g = JSON.parse(f);
|
|
3641
3641
|
} catch {
|
|
3642
3642
|
}
|
|
3643
|
-
h({ status: u, ok: !0, data:
|
|
3643
|
+
h({ status: u, ok: !0, data: g });
|
|
3644
3644
|
} else
|
|
3645
3645
|
c({ status: u, data: f });
|
|
3646
3646
|
}, d.onerror = function() {
|
|
@@ -3919,6 +3919,81 @@ class oe extends HTMLElement {
|
|
|
3919
3919
|
}
|
|
3920
3920
|
}
|
|
3921
3921
|
customElements.get("mint-form") || customElements.define("mint-form", oe);
|
|
3922
|
+
class le extends HTMLElement {
|
|
3923
|
+
constructor() {
|
|
3924
|
+
super(), this._observer = null;
|
|
3925
|
+
}
|
|
3926
|
+
static get observedAttributes() {
|
|
3927
|
+
return ["striped", "hover", "bordered", "compact"];
|
|
3928
|
+
}
|
|
3929
|
+
connectedCallback() {
|
|
3930
|
+
this.classList.add("block", "w-full", "overflow-x-auto"), this._applyStyles(), this._observeChanges(), setTimeout(() => this._applyStyles(), 0), setTimeout(() => this._applyStyles(), 100);
|
|
3931
|
+
}
|
|
3932
|
+
disconnectedCallback() {
|
|
3933
|
+
this._observer && (this._observer.disconnect(), this._observer = null);
|
|
3934
|
+
}
|
|
3935
|
+
attributeChangedCallback() {
|
|
3936
|
+
this._applyStyles();
|
|
3937
|
+
}
|
|
3938
|
+
_observeChanges() {
|
|
3939
|
+
this._observer = new MutationObserver(() => {
|
|
3940
|
+
this._applyStyles();
|
|
3941
|
+
}), this._observer.observe(this, {
|
|
3942
|
+
childList: !0,
|
|
3943
|
+
subtree: !0,
|
|
3944
|
+
attributes: !1
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
_applyStyles() {
|
|
3948
|
+
const e = this.querySelector("table");
|
|
3949
|
+
if (!e) return;
|
|
3950
|
+
const t = this.hasAttribute("bordered"), i = this.hasAttribute("striped"), s = this.hasAttribute("hover"), r = this.hasAttribute("compact");
|
|
3951
|
+
this._setClasses(e, [
|
|
3952
|
+
"w-full",
|
|
3953
|
+
"border-collapse",
|
|
3954
|
+
"text-sm",
|
|
3955
|
+
"font-medium"
|
|
3956
|
+
]);
|
|
3957
|
+
const n = e.querySelector("thead");
|
|
3958
|
+
n && (this._setClasses(n, ["bg-gray-50", "dark:bg-gray-800"]), n.querySelectorAll("th").forEach((h) => {
|
|
3959
|
+
const c = [
|
|
3960
|
+
"text-left",
|
|
3961
|
+
"font-semibold",
|
|
3962
|
+
"text-gray-900",
|
|
3963
|
+
"dark:text-white",
|
|
3964
|
+
"uppercase",
|
|
3965
|
+
"tracking-wider",
|
|
3966
|
+
"text-xs"
|
|
3967
|
+
];
|
|
3968
|
+
t && c.push("border", "border-gray-200", "dark:border-gray-700"), r ? c.push("px-3", "py-1.5") : c.push("px-4", "py-3"), this._setClasses(h, c);
|
|
3969
|
+
}));
|
|
3970
|
+
const a = e.querySelector("tbody");
|
|
3971
|
+
a && (i ? this._setClasses(a, ["divide-y", "divide-gray-200", "dark:divide-gray-700"]) : this._setClasses(a, []), a.querySelectorAll("tr").forEach((h, c) => {
|
|
3972
|
+
const d = [];
|
|
3973
|
+
t && d.push("border-b", "border-gray-200", "dark:border-gray-700"), i ? c % 2 === 0 ? d.push("bg-white", "dark:bg-gray-900") : d.push("bg-gray-50", "dark:bg-gray-800") : d.push("bg-white", "dark:bg-gray-900"), s && d.push("transition-colors", "duration-150", "hover:bg-gray-100", "dark:hover:bg-gray-800"), this._setClasses(h, d), h.querySelectorAll("td").forEach((f) => {
|
|
3974
|
+
const g = [
|
|
3975
|
+
"text-gray-900",
|
|
3976
|
+
"dark:text-gray-100"
|
|
3977
|
+
];
|
|
3978
|
+
t && g.push("border", "border-gray-200", "dark:border-gray-700"), r ? g.push("px-3", "py-1.5") : g.push("px-4", "py-3"), this._setClasses(f, g);
|
|
3979
|
+
});
|
|
3980
|
+
}));
|
|
3981
|
+
const l = e.querySelector("tfoot");
|
|
3982
|
+
l && (this._setClasses(l, ["bg-gray-50", "dark:bg-gray-800", "font-semibold"]), l.querySelectorAll("td").forEach((h) => {
|
|
3983
|
+
const c = [
|
|
3984
|
+
"text-gray-900",
|
|
3985
|
+
"dark:text-gray-100"
|
|
3986
|
+
];
|
|
3987
|
+
t && c.push("border", "border-gray-200", "dark:border-gray-700"), r ? c.push("px-3", "py-1.5") : c.push("px-4", "py-3"), this._setClasses(h, c);
|
|
3988
|
+
}));
|
|
3989
|
+
}
|
|
3990
|
+
_setClasses(e, t) {
|
|
3991
|
+
e.className = "", t.forEach((i) => {
|
|
3992
|
+
i && i.trim() && e.classList.add(i);
|
|
3993
|
+
});
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
customElements.get("mint-table") || customElements.define("mint-table", le);
|
|
3922
3997
|
export {
|
|
3923
3998
|
J as BackButton,
|
|
3924
3999
|
R as Button,
|
|
@@ -3939,6 +4014,7 @@ export {
|
|
|
3939
4014
|
B as Spinner,
|
|
3940
4015
|
$ as Stack,
|
|
3941
4016
|
W as Switch,
|
|
4017
|
+
le as Table,
|
|
3942
4018
|
j as Text,
|
|
3943
4019
|
R as default
|
|
3944
4020
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monobill-mintui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A modern framework-agnostic UI kit built as Web Components. Requires Tailwind CSS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"require": "./dist/index.cjs",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
|
-
"./styles": "./dist/styles.css"
|
|
15
|
+
"./styles": "./dist/styles.css",
|
|
16
|
+
"./icons": {
|
|
17
|
+
"import": "./dist/components/icon/icons/index.js",
|
|
18
|
+
"types": "./dist/components/icon/icons/index.d.ts"
|
|
19
|
+
}
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
|
18
22
|
"dist"
|