@muibook/components 19.2.0 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/mui-button/index.js +98 -72
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/custom-elements.json +1908 -1827
- package/dist/esm/dynamic-attrs.json +2 -1
- package/dist/types/components/mui-form-message/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-toggle/doc.d.ts +2 -0
- package/dist/types/components/mui-radio-group/doc.d.ts +2 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ class h extends HTMLElement {
|
|
|
8
8
|
}
|
|
9
9
|
async connectedCallback() {
|
|
10
10
|
if (this.hasAttribute("size") || this.setAttribute("size", "medium"), await this.waitForPartMap(), !this.shadowRoot) return;
|
|
11
|
-
let
|
|
11
|
+
let t = (
|
|
12
12
|
/*html*/
|
|
13
13
|
`
|
|
14
14
|
<style>
|
|
@@ -662,6 +662,35 @@ class h extends HTMLElement {
|
|
|
662
662
|
padding-left: var(--action-before-slot-padding-large);
|
|
663
663
|
}
|
|
664
664
|
|
|
665
|
+
:host([avatar-only]) {
|
|
666
|
+
width: auto;
|
|
667
|
+
display: flex;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
:host([avatar-only]) button,
|
|
671
|
+
:host([avatar-only]) button:hover,
|
|
672
|
+
:host([avatar-only]) button:focus,
|
|
673
|
+
:host([avatar-only]) button:focus-visible,
|
|
674
|
+
:host([avatar-only]) button:disabled {
|
|
675
|
+
width: auto;
|
|
676
|
+
min-width: 0;
|
|
677
|
+
min-height: 0;
|
|
678
|
+
padding: var(--space-000);
|
|
679
|
+
border: none;
|
|
680
|
+
background: transparent;
|
|
681
|
+
display: inline-flex;
|
|
682
|
+
align-items: center;
|
|
683
|
+
justify-content: center;
|
|
684
|
+
gap: var(--space-000);
|
|
685
|
+
line-height: 0;
|
|
686
|
+
border-radius: 999rem;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
:host([avatar-only]) button ::slotted(mui-avatar) {
|
|
690
|
+
margin-right: var(--space-000);
|
|
691
|
+
margin-left: var(--space-000);
|
|
692
|
+
}
|
|
693
|
+
|
|
665
694
|
|
|
666
695
|
</style>
|
|
667
696
|
|
|
@@ -679,106 +708,103 @@ class h extends HTMLElement {
|
|
|
679
708
|
|
|
680
709
|
`
|
|
681
710
|
);
|
|
682
|
-
this.shadowRoot.innerHTML =
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
return l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon");
|
|
696
|
-
}
|
|
697
|
-
return d.nodeType === Node.TEXT_NODE && !((n = d.textContent) != null && n.trim());
|
|
698
|
-
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(v, !0)) : (this.removeAttribute("icon-only"), [t, e, a].forEach((n) => {
|
|
699
|
-
if (n) {
|
|
700
|
-
const l = n.assignedNodes({ flatten: !0 });
|
|
701
|
-
this.updateIconSizes(l, !1), this.updateAvatarSizes(l), this.updateBadgeSizes(l);
|
|
702
|
-
}
|
|
703
|
-
}));
|
|
704
|
-
});
|
|
711
|
+
this.shadowRoot.innerHTML = t, await customElements.whenDefined("mui-button"), [
|
|
712
|
+
this.shadowRoot.querySelector("slot:not([name])"),
|
|
713
|
+
this.shadowRoot.querySelector('slot[name="before"]'),
|
|
714
|
+
this.shadowRoot.querySelector('slot[name="after"]')
|
|
715
|
+
].forEach((r) => r == null ? void 0 : r.addEventListener("slotchange", () => this.syncButtonState())), requestAnimationFrame(() => this.syncButtonState());
|
|
716
|
+
}
|
|
717
|
+
attributeChangedCallback(o, t, n) {
|
|
718
|
+
var r;
|
|
719
|
+
if (o === "disabled") {
|
|
720
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("button");
|
|
721
|
+
e && (this.hasAttribute("disabled") ? e.setAttribute("disabled", "") : e.removeAttribute("disabled"));
|
|
722
|
+
}
|
|
723
|
+
o === "size" && t !== n && this.shadowRoot && requestAnimationFrame(() => this.syncButtonState());
|
|
705
724
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
a.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
725
|
+
syncButtonState() {
|
|
726
|
+
const o = this.shadowRoot;
|
|
727
|
+
if (!o) return;
|
|
728
|
+
const t = o.querySelector("slot:not([name])"), n = o.querySelector('slot[name="before"]'), r = o.querySelector('slot[name="after"]'), e = (a) => a ? a.assignedNodes({ flatten: !0 }).some((i) => {
|
|
729
|
+
var d;
|
|
730
|
+
return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((d = i.textContent) != null && d.trim());
|
|
731
|
+
}) : !1, s = e(n), l = e(r);
|
|
732
|
+
this.toggleAttribute("has-before", s), this.toggleAttribute("has-after", l);
|
|
733
|
+
const c = (t == null ? void 0 : t.assignedNodes({ flatten: !0 })) ?? [], v = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [], u = v.length === 1 && v[0].tagName.toLowerCase() === "mui-avatar" && c.every((a) => {
|
|
734
|
+
var i;
|
|
735
|
+
return a.nodeType === Node.TEXT_NODE ? !((i = a.textContent) != null && i.trim()) : a.nodeType === Node.ELEMENT_NODE ? a.tagName.toLowerCase() === "mui-avatar" : !1;
|
|
736
|
+
});
|
|
737
|
+
if (this.toggleAttribute("avatar-only", u), !u && c.every((a) => {
|
|
738
|
+
var i;
|
|
739
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
740
|
+
const d = a;
|
|
741
|
+
return d.tagName.toLowerCase() === "svg" || d.classList.contains("mui-icon");
|
|
742
|
+
}
|
|
743
|
+
return a.nodeType === Node.TEXT_NODE && !((i = a.textContent) != null && i.trim());
|
|
744
|
+
})) {
|
|
745
|
+
this.setAttribute("icon-only", ""), this.updateIconSizes(c, !0);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
this.removeAttribute("icon-only"), [n, t, r].forEach((a) => {
|
|
749
|
+
if (!a) return;
|
|
750
|
+
const i = a.assignedNodes({ flatten: !0 });
|
|
751
|
+
this.updateIconSizes(i, !1), u || this.updateAvatarSizes(i), this.updateBadgeSizes(i);
|
|
726
752
|
});
|
|
727
753
|
}
|
|
728
754
|
// Update avatar sizes based on button size
|
|
729
|
-
updateAvatarSizes(
|
|
730
|
-
const
|
|
755
|
+
updateAvatarSizes(o) {
|
|
756
|
+
const t = this.getAttribute("size") || "medium", r = {
|
|
731
757
|
"xx-small": "x-small",
|
|
732
758
|
"x-small": "x-small",
|
|
733
759
|
small: "x-small",
|
|
734
760
|
medium: "small",
|
|
735
761
|
large: "medium"
|
|
736
|
-
}[
|
|
737
|
-
|
|
738
|
-
if (
|
|
739
|
-
const
|
|
740
|
-
|
|
762
|
+
}[t] || "small";
|
|
763
|
+
o.forEach((e) => {
|
|
764
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
765
|
+
const s = e;
|
|
766
|
+
s.tagName.toLowerCase() === "mui-avatar" && s.setAttribute("size", r);
|
|
741
767
|
}
|
|
742
768
|
});
|
|
743
769
|
}
|
|
744
|
-
updateIconSizes(
|
|
745
|
-
const
|
|
770
|
+
updateIconSizes(o, t) {
|
|
771
|
+
const n = this.getAttribute("size") || "medium", e = {
|
|
746
772
|
"xx-small": "xx-small",
|
|
747
773
|
"x-small": "x-small",
|
|
748
774
|
small: "x-small",
|
|
749
|
-
medium:
|
|
775
|
+
medium: t ? "medium" : "small",
|
|
750
776
|
// small for regular, medium for icon-only
|
|
751
|
-
large:
|
|
752
|
-
}[
|
|
753
|
-
|
|
754
|
-
if (
|
|
755
|
-
const
|
|
756
|
-
(
|
|
777
|
+
large: t ? "large" : "medium"
|
|
778
|
+
}[n] || "small";
|
|
779
|
+
o.forEach((s) => {
|
|
780
|
+
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
781
|
+
const l = s;
|
|
782
|
+
(l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "mui-icon") && !l.hasAttribute("size") && l.setAttribute("size", e);
|
|
757
783
|
}
|
|
758
784
|
});
|
|
759
785
|
}
|
|
760
|
-
updateBadgeSizes(
|
|
761
|
-
const
|
|
786
|
+
updateBadgeSizes(o) {
|
|
787
|
+
const t = this.getAttribute("size") || "medium", r = {
|
|
762
788
|
"xx-small": "x-small",
|
|
763
789
|
"x-small": "x-small",
|
|
764
790
|
small: "small",
|
|
765
791
|
medium: "medium",
|
|
766
792
|
large: "large"
|
|
767
|
-
}[
|
|
768
|
-
|
|
769
|
-
if (
|
|
770
|
-
const
|
|
771
|
-
|
|
793
|
+
}[t] || "medium";
|
|
794
|
+
o.forEach((e) => {
|
|
795
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
796
|
+
const s = e;
|
|
797
|
+
s.tagName.toLowerCase() === "mui-badge" && s.setAttribute("size", r);
|
|
772
798
|
}
|
|
773
799
|
});
|
|
774
800
|
}
|
|
775
801
|
waitForPartMap() {
|
|
776
|
-
return new Promise((
|
|
777
|
-
if (typeof b == "function") return
|
|
778
|
-
const
|
|
779
|
-
typeof b == "function" ?
|
|
802
|
+
return new Promise((o) => {
|
|
803
|
+
if (typeof b == "function") return o();
|
|
804
|
+
const t = () => {
|
|
805
|
+
typeof b == "function" ? o() : requestAnimationFrame(t);
|
|
780
806
|
};
|
|
781
|
-
|
|
807
|
+
t();
|
|
782
808
|
});
|
|
783
809
|
}
|
|
784
810
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/* ================================================================================================== */
|
|
3
|
-
/* Don't edit directly • Generated on
|
|
3
|
+
/* Don't edit directly • Generated on Thu, 07 May 2026 04:13:10 GMT • muibook.com */
|
|
4
4
|
/* ================================================================================================== */
|
|
5
5
|
|
|
6
6
|
/* ================================================================================================== */
|