@muibook/components 19.2.0 → 19.4.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/README.md +15 -0
- package/dist/esm/components/mui-avatar/index.js +8 -5
- package/dist/esm/components/mui-button/index.js +101 -75
- package/dist/esm/components/mui-chip/index.js +1 -1
- package/dist/esm/components/mui-code/index.js +1 -1
- package/dist/esm/components/mui-dialog/index.js +2 -1
- package/dist/esm/components/mui-drawer/index.js +25 -47
- package/dist/esm/components/mui-field/index.js +6 -4
- package/dist/esm/components/mui-form-group/index.js +37 -25
- package/dist/esm/components/mui-link/index.js +7 -7
- package/dist/esm/components/mui-prompt/index.js +92 -85
- package/dist/esm/components/mui-prompt-message/index.js +1 -1
- package/dist/esm/components/mui-stack/hstack/index.js +30 -14
- package/dist/esm/components/mui-stack/vstack/index.js +30 -14
- package/dist/esm/components/mui-switch/index.js +30 -30
- package/dist/esm/components/mui-tabs/tab-bar/index.js +1 -1
- package/dist/esm/components/mui-textarea/index.js +39 -29
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +12 -3
- package/dist/esm/custom-elements.json +708 -557
- package/dist/esm/dynamic-attrs.json +7 -6
- package/dist/types/components/mui-field/index.d.ts +1 -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 +6 -6
package/README.md
CHANGED
|
@@ -147,6 +147,21 @@ npm run preview:create-mui-app
|
|
|
147
147
|
npm install
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
#### Clean install from the lockfile:
|
|
151
|
+
|
|
152
|
+
Use this when you want to install the exact dependency versions already recorded in `package-lock.json`, especially during an active NPM supply-chain issue.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm ci
|
|
156
|
+
npm run build
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- `npm install` reads `package.json` version ranges and may update `package-lock.json`.
|
|
160
|
+
- `npm ci` removes `node_modules` and installs exactly from `package-lock.json`.
|
|
161
|
+
- `npm ci` fails if `package.json` and `package-lock.json` are out of sync.
|
|
162
|
+
- Prefer `npm ci` for CI, release builds, and clean local verification.
|
|
163
|
+
- The current declared versions in `package.json` are pinned for now by removing `^` and `~` ranges.
|
|
164
|
+
|
|
150
165
|
#### TypeScript Support:
|
|
151
166
|
|
|
152
167
|
```bash
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class w extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["label", "image", "size", "background", "background-color"];
|
|
4
4
|
}
|
|
@@ -59,21 +59,24 @@ class y extends HTMLElement {
|
|
|
59
59
|
}
|
|
60
60
|
render() {
|
|
61
61
|
const e = this.getAttribute("label"), t = this.getAttribute("image"), a = (this.getAttribute("size") || "medium").toLowerCase(), r = this.getAttribute("background") || "neutral", n = this.getAttribute("background-color"), l = e || "Avatar", o = this.hasSlottedContent(), i = t && !this._imageFailed && !o, c = !i && !o, h = this.getInitials(e), d = {
|
|
62
|
+
"xx-small": "var(--avatar-xx-small)",
|
|
62
63
|
"x-small": "var(--avatar-x-small)",
|
|
63
64
|
small: "var(--avatar-small)",
|
|
64
65
|
medium: "var(--avatar-medium)",
|
|
65
66
|
large: "var(--avatar-large)"
|
|
66
67
|
}, s = d[a] ?? d.medium, g = {
|
|
67
|
-
"
|
|
68
|
+
"xx-small": "var(--font-size-15)",
|
|
69
|
+
"x-small": "var(--font-size-100)",
|
|
68
70
|
small: "var(--font-size-200)",
|
|
69
71
|
medium: "var(--font-size-300)",
|
|
70
72
|
large: "var(--font-size-400)"
|
|
71
73
|
}, k = g[a] ?? g.medium, u = {
|
|
74
|
+
"xx-small": "x-small",
|
|
72
75
|
"x-small": "x-small",
|
|
73
76
|
small: "small",
|
|
74
77
|
medium: "medium",
|
|
75
78
|
large: "large"
|
|
76
|
-
}, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m,
|
|
79
|
+
}, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m, x = (
|
|
77
80
|
/*css*/
|
|
78
81
|
`
|
|
79
82
|
:host {
|
|
@@ -119,7 +122,7 @@ class y extends HTMLElement {
|
|
|
119
122
|
`
|
|
120
123
|
);
|
|
121
124
|
if (this.shadowRoot.innerHTML = `
|
|
122
|
-
<style>${
|
|
125
|
+
<style>${x}</style>
|
|
123
126
|
${i ? `<img src="${t}" alt="${l}" />` : ""}
|
|
124
127
|
<div class="initials" role="img" aria-label="${l}">${h}</div>
|
|
125
128
|
<slot></slot>
|
|
@@ -133,4 +136,4 @@ class y extends HTMLElement {
|
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
|
-
customElements.get("mui-avatar") || customElements.define("mui-avatar",
|
|
139
|
+
customElements.get("mui-avatar") || customElements.define("mui-avatar", w);
|
|
@@ -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
|
|
731
|
-
"xx-small": "
|
|
732
|
-
"x-small": "
|
|
733
|
-
small: "
|
|
755
|
+
updateAvatarSizes(o) {
|
|
756
|
+
const t = this.getAttribute("size") || "medium", r = {
|
|
757
|
+
"xx-small": "xx-small",
|
|
758
|
+
"x-small": "xx-small",
|
|
759
|
+
small: "xx-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
|
}
|
|
@@ -35,7 +35,7 @@ class l extends HTMLElement {
|
|
|
35
35
|
r.assignedNodes({ flatten: !0 }).forEach((o) => {
|
|
36
36
|
if (o.nodeType === Node.ELEMENT_NODE) {
|
|
37
37
|
const t = o, i = t.tagName.toLowerCase();
|
|
38
|
-
i === "mui-avatar" ? t.setAttribute("size", "
|
|
38
|
+
i === "mui-avatar" ? t.setAttribute("size", "xx-small") : i.startsWith("mui-icon-") && t.setAttribute("size", a);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -40,7 +40,7 @@ class s extends HTMLElement {
|
|
|
40
40
|
border-radius: inherit;
|
|
41
41
|
font-family: monospace;
|
|
42
42
|
color: var(--text-color);
|
|
43
|
-
background: var(--
|
|
43
|
+
background: var(--code-background);
|
|
44
44
|
padding: var(--space-400) var(--space-500);
|
|
45
45
|
box-sizing: border-box;
|
|
46
46
|
width: 100%;
|
|
@@ -18,10 +18,11 @@ class l extends HTMLElement {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
dialog {
|
|
21
|
-
border:
|
|
21
|
+
border: var(--dialog-border);
|
|
22
22
|
width: ${this.getAttribute("width") || "350px"};
|
|
23
23
|
max-width: 90vw;
|
|
24
24
|
padding: 0;
|
|
25
|
+
box-sizing: border-box;
|
|
25
26
|
overflow: hidden;
|
|
26
27
|
border-radius: var(--dialog-radius);
|
|
27
28
|
background: var(--dialog-background);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../mui-icons/close/index.js";
|
|
2
2
|
import "../mui-button/index.js";
|
|
3
|
-
class
|
|
3
|
+
class u extends HTMLElement {
|
|
4
4
|
constructor() {
|
|
5
5
|
super(), this.innerEl = null, this.overlayEl = null, this.footerEl = null, this.actionsSlot = null, this.pushLayout = null, this.outer = null, this.persistentLayout = null, this.headerEl = null, this.headerSlot = null, this._handleEscape = (t) => {
|
|
6
6
|
const e = this.getAttribute("variant") || "overlay";
|
|
@@ -56,15 +56,22 @@ class p extends HTMLElement {
|
|
|
56
56
|
`
|
|
57
57
|
.header {
|
|
58
58
|
display: flex;
|
|
59
|
+
flex: 0 0 auto;
|
|
59
60
|
justify-content: space-between;
|
|
60
61
|
align-items: center;
|
|
61
62
|
padding: calc(var(--space-400) + env(safe-area-inset-top)) var(--space-400) var(--space-400) var(--space-500);
|
|
62
63
|
border-bottom: var(--border-thin);
|
|
63
64
|
box-sizing: border-box;
|
|
64
65
|
}
|
|
66
|
+
.inner {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
}
|
|
65
70
|
.content {
|
|
71
|
+
flex: 1 1 auto;
|
|
72
|
+
min-height: 0;
|
|
66
73
|
overflow-y: auto;
|
|
67
|
-
height:
|
|
74
|
+
height: auto;
|
|
68
75
|
padding: var(--space-500);
|
|
69
76
|
box-sizing: border-box;
|
|
70
77
|
}
|
|
@@ -83,6 +90,7 @@ class p extends HTMLElement {
|
|
|
83
90
|
|
|
84
91
|
.actions {
|
|
85
92
|
display: flex;
|
|
93
|
+
flex: 0 0 auto;
|
|
86
94
|
align-items: center;
|
|
87
95
|
justify-content: flex-end;
|
|
88
96
|
padding: var(--space-400) var(--space-500) calc(var(--space-400) + env(safe-area-inset-bottom));
|
|
@@ -90,8 +98,6 @@ class p extends HTMLElement {
|
|
|
90
98
|
background: var(--drawer-background);
|
|
91
99
|
gap: var(--space-300);
|
|
92
100
|
box-sizing: border-box;
|
|
93
|
-
position: fixed;
|
|
94
|
-
bottom: 0;
|
|
95
101
|
width: 100%;
|
|
96
102
|
}
|
|
97
103
|
.header[hidden],
|
|
@@ -102,18 +108,6 @@ class p extends HTMLElement {
|
|
|
102
108
|
), s = (
|
|
103
109
|
/*css*/
|
|
104
110
|
`
|
|
105
|
-
:host([has-header]) .content {
|
|
106
|
-
height: calc(100dvh - (7.7rem + env(safe-area-inset-top) ));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
:host([has-footer]) .content {
|
|
110
|
-
height: calc(100dvh - (7.7rem + env(safe-area-inset-bottom) ));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
:host([has-header][has-footer]) .content {
|
|
114
|
-
height: calc(100dvh - ((7.7rem * 2) + (env(safe-area-inset-top) + env(safe-area-inset-bottom)) ));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
111
|
.overlay {
|
|
118
112
|
position: fixed;
|
|
119
113
|
top: 0;
|
|
@@ -145,8 +139,6 @@ class p extends HTMLElement {
|
|
|
145
139
|
transform: translateX(100%);
|
|
146
140
|
opacity: 0;
|
|
147
141
|
visibility: hidden;
|
|
148
|
-
display: flex;
|
|
149
|
-
flex-direction: column;
|
|
150
142
|
will-change: transform, opacity;
|
|
151
143
|
}
|
|
152
144
|
|
|
@@ -178,7 +170,7 @@ class p extends HTMLElement {
|
|
|
178
170
|
visibility: visible;
|
|
179
171
|
}
|
|
180
172
|
`
|
|
181
|
-
),
|
|
173
|
+
), a = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", l = (
|
|
182
174
|
/*css*/
|
|
183
175
|
`
|
|
184
176
|
.inner {
|
|
@@ -190,17 +182,6 @@ class p extends HTMLElement {
|
|
|
190
182
|
height: 100%;
|
|
191
183
|
}
|
|
192
184
|
|
|
193
|
-
.content { height: 100%; }
|
|
194
|
-
|
|
195
|
-
:host([has-header]) .content,
|
|
196
|
-
:host([has-footer]) .content {
|
|
197
|
-
height: calc(100% - 7.7rem);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
:host([has-header][has-footer]) .content {
|
|
201
|
-
height: calc(100% - (7.7rem * 2));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
185
|
.outer {
|
|
205
186
|
overflow: hidden;
|
|
206
187
|
will-change: transform;
|
|
@@ -233,7 +214,7 @@ class p extends HTMLElement {
|
|
|
233
214
|
|
|
234
215
|
/* Hidden & Persistent */
|
|
235
216
|
:host([open]) .outer,
|
|
236
|
-
:host([variant="persistent"]) .outer { ${
|
|
217
|
+
:host([variant="persistent"]) .outer { ${a} }
|
|
237
218
|
|
|
238
219
|
|
|
239
220
|
/* Direct slotted element */
|
|
@@ -266,12 +247,6 @@ class p extends HTMLElement {
|
|
|
266
247
|
border: none;
|
|
267
248
|
}
|
|
268
249
|
|
|
269
|
-
.actions {
|
|
270
|
-
position: fixed;
|
|
271
|
-
bottom: 0;
|
|
272
|
-
width: 100%;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
250
|
/* Overlay */
|
|
276
251
|
:host([variant="overlay"]) .inner {
|
|
277
252
|
max-width: ${t};
|
|
@@ -313,12 +288,15 @@ class p extends HTMLElement {
|
|
|
313
288
|
padding-top: var(--space-400);
|
|
314
289
|
}
|
|
315
290
|
|
|
316
|
-
:host([variant="persistent"]) .content {
|
|
291
|
+
:host([variant="persistent"]) .content {
|
|
292
|
+
flex: 0 1 auto;
|
|
293
|
+
min-height: initial;
|
|
294
|
+
height: auto;
|
|
295
|
+
}
|
|
317
296
|
|
|
318
297
|
:host([variant="persistent"]) .actions {
|
|
319
298
|
border-bottom-right-radius: var(--radius-200);
|
|
320
299
|
border-bottom-left-radius: var(--radius-200);
|
|
321
|
-
position: static;
|
|
322
300
|
width: 100%;
|
|
323
301
|
padding: var(--space-400) var(--space-500) var(--space-400);
|
|
324
302
|
}
|
|
@@ -332,10 +310,10 @@ class p extends HTMLElement {
|
|
|
332
310
|
}
|
|
333
311
|
|
|
334
312
|
`
|
|
335
|
-
),
|
|
336
|
-
let
|
|
313
|
+
), d = this.getAttribute("side") || this._computedSide, h = e === "overlay" || e === "push";
|
|
314
|
+
let r = "";
|
|
337
315
|
const c = this.hasAttribute("drawer-space") ? "no-padding" : "";
|
|
338
|
-
e === "overlay" ?
|
|
316
|
+
e === "overlay" ? r = /*html*/
|
|
339
317
|
`
|
|
340
318
|
<style>${o}${s}${n}</style>
|
|
341
319
|
<div class="overlay"></div>
|
|
@@ -353,13 +331,13 @@ class p extends HTMLElement {
|
|
|
353
331
|
<slot name="actions"></slot>
|
|
354
332
|
</div>
|
|
355
333
|
</div>
|
|
356
|
-
` : (e === "push" || e === "persistent") && (
|
|
334
|
+
` : (e === "push" || e === "persistent") && (r = /*html*/
|
|
357
335
|
`
|
|
358
|
-
<style>${o}${
|
|
336
|
+
<style>${o}${l}${n}</style>
|
|
359
337
|
<div class="shell">
|
|
360
|
-
${
|
|
338
|
+
${d === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
|
|
361
339
|
</div>
|
|
362
|
-
`), this.shadowRoot.innerHTML =
|
|
340
|
+
`), this.shadowRoot.innerHTML = r;
|
|
363
341
|
}
|
|
364
342
|
cacheEls() {
|
|
365
343
|
this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector(".header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]');
|
|
@@ -403,4 +381,4 @@ class p extends HTMLElement {
|
|
|
403
381
|
this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-drawer-close", { bubbles: !0, composed: !0 }));
|
|
404
382
|
}
|
|
405
383
|
}
|
|
406
|
-
customElements.get("mui-drawer") || customElements.define("mui-drawer",
|
|
384
|
+
customElements.get("mui-drawer") || customElements.define("mui-drawer", u);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import "../mui-icons/info/index.js";
|
|
2
|
+
class r extends HTMLElement {
|
|
2
3
|
static get observedAttributes() {
|
|
3
4
|
return ["variant", "message", "label", "hide-label", "size", "optional"];
|
|
4
5
|
}
|
|
@@ -102,11 +103,12 @@ class n extends HTMLElement {
|
|
|
102
103
|
if (!e || !t) return;
|
|
103
104
|
const i = this.variant, s = this.message;
|
|
104
105
|
let a = "";
|
|
105
|
-
if (i === "success" ? a = '<mui-icon-check slot="before"></mui-icon-check>' : i === "warning" ? a = '<mui-icon-warning slot="before"></mui-icon-warning>' : i === "error"
|
|
106
|
+
if (i === "success" ? a = '<mui-icon-check slot="before"></mui-icon-check>' : i === "warning" ? a = '<mui-icon-warning slot="before"></mui-icon-warning>' : i === "error" ? a = '<mui-icon-attention slot="before"></mui-icon-attention>' : i === "info" && (a = '<mui-icon-info slot="before" color="var(--feedback-info-icon)"></mui-icon-info>'), t.assignedNodes({ flatten: !0 }).some((o) => o.nodeType === Node.ELEMENT_NODE ? !0 : o.nodeType === Node.TEXT_NODE ? (o.textContent || "").trim().length > 0 : !1)) {
|
|
106
107
|
e.innerHTML = "", this.setAttribute("has-message", "");
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
|
-
|
|
110
|
+
const n = i === "info" ? ' style="--text-color: var(--feedback-info-text);"' : "";
|
|
111
|
+
e.innerHTML = s ? `<mui-body size="${this.size}" variant="${i}"${n}>${a}${s}</mui-body>` : "", s ? this.setAttribute("has-message", "") : this.removeAttribute("has-message");
|
|
110
112
|
}
|
|
111
113
|
syncMessageSlotSizing() {
|
|
112
114
|
if (!this.shadowRoot) return;
|
|
@@ -127,4 +129,4 @@ class n extends HTMLElement {
|
|
|
127
129
|
t && t.addEventListener("slotchange", () => this.passAttributesToChild());
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
|
-
customElements.get("mui-field") || customElements.define("mui-field",
|
|
132
|
+
customElements.get("mui-field") || customElements.define("mui-field", r);
|
|
@@ -1,42 +1,54 @@
|
|
|
1
1
|
import "../mui-heading/index.js";
|
|
2
2
|
import "../mui-body/index.js";
|
|
3
|
-
class
|
|
4
|
-
static get observedAttributes() {
|
|
5
|
-
return ["heading", "hide-label", "variant"];
|
|
6
|
-
}
|
|
3
|
+
class n extends HTMLElement {
|
|
7
4
|
constructor() {
|
|
8
|
-
super(), this.
|
|
5
|
+
super(), this.slotEl = null, this.updateChoiceGroupState = () => {
|
|
6
|
+
var o;
|
|
7
|
+
const t = ((o = this.slotEl) == null ? void 0 : o.assignedElements({ flatten: !0 })) || [], e = "mui-radio-group, mui-radio, mui-checkbox, mui-switch", i = t.some((r) => {
|
|
8
|
+
var a;
|
|
9
|
+
const s = r.tagName.toLowerCase();
|
|
10
|
+
return s === "mui-radio-group" || s === "mui-radio" || s === "mui-checkbox" || s === "mui-switch" ? !0 : !!((a = r.querySelector) != null && a.call(r, e));
|
|
11
|
+
});
|
|
12
|
+
i !== this.hasAttribute("choice-group") && (this.toggleAttribute("choice-group", i), this.render(), this.bindSlotBehavior());
|
|
13
|
+
}, this.attachShadow({ mode: "open" });
|
|
14
|
+
}
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return ["heading", "heading-level", "heading-space", "hide-label", "variant", "space", "aligny"];
|
|
9
17
|
}
|
|
10
18
|
connectedCallback() {
|
|
11
|
-
this.render(), this.
|
|
19
|
+
this.render(), this.bindSlotBehavior(), this.updateChoiceGroupState();
|
|
12
20
|
}
|
|
13
21
|
attributeChangedCallback() {
|
|
14
|
-
this.render();
|
|
22
|
+
this.render(), this.bindSlotBehavior(), this.updateChoiceGroupState();
|
|
15
23
|
}
|
|
16
24
|
render() {
|
|
17
25
|
if (!this.shadowRoot) return;
|
|
18
|
-
const t = this.getAttribute("heading") || "", e = this.hasAttribute("hide-label"),
|
|
19
|
-
this.shadowRoot.innerHTML = /*html*/
|
|
26
|
+
const t = this.getAttribute("heading") || "", e = this.hasAttribute("hide-label"), i = this.hasAttribute("choice-group"), o = this.getHeadingLevel();
|
|
27
|
+
this.syncLayoutAttributes(), this.shadowRoot.innerHTML = /*html*/
|
|
20
28
|
`
|
|
21
29
|
<style>
|
|
22
30
|
:host {
|
|
23
31
|
display: block;
|
|
32
|
+
--form-group-space: var(--space-500);
|
|
33
|
+
--form-group-heading-space: var(--form-group-space);
|
|
34
|
+
--form-group-align-y: start;
|
|
24
35
|
}
|
|
25
36
|
.group {
|
|
26
37
|
display: grid;
|
|
27
|
-
gap: var(--space-500);
|
|
28
38
|
}
|
|
29
39
|
.group-heading {
|
|
30
40
|
display: block;
|
|
31
41
|
margin: 0;
|
|
42
|
+
margin-bottom: var(--form-group-heading-space);
|
|
32
43
|
}
|
|
33
44
|
.group-label {
|
|
34
45
|
display: inline-flex;
|
|
35
46
|
margin: 0;
|
|
47
|
+
margin-bottom: var(--form-group-space);
|
|
36
48
|
}
|
|
37
49
|
.content {
|
|
38
50
|
display: grid;
|
|
39
|
-
gap: var(--space
|
|
51
|
+
gap: var(--form-group-space);
|
|
40
52
|
min-inline-size: 0;
|
|
41
53
|
}
|
|
42
54
|
.content-inner {
|
|
@@ -44,7 +56,7 @@ class h extends HTMLElement {
|
|
|
44
56
|
}
|
|
45
57
|
:host([variant="horizontal"]) .content {
|
|
46
58
|
grid-template-columns: var(--form-group-horizontal-template, minmax(0, 1fr) minmax(0, 20rem));
|
|
47
|
-
align-items:
|
|
59
|
+
align-items: var(--form-group-align-y);
|
|
48
60
|
}
|
|
49
61
|
:host([variant="horizontal"]) .content-inner ::slotted(*) {
|
|
50
62
|
min-inline-size: 0;
|
|
@@ -61,7 +73,7 @@ class h extends HTMLElement {
|
|
|
61
73
|
</style>
|
|
62
74
|
|
|
63
75
|
<div class="group">
|
|
64
|
-
${t && !e ?
|
|
76
|
+
${t && !e ? i ? `<mui-body class="group-label" size="small" weight="bold" variant="optional">${t}</mui-body>` : `<mui-heading class="group-heading" size="5" level="${o}">${t}</mui-heading>` : ""}
|
|
65
77
|
<div class="content">
|
|
66
78
|
<div class="content-inner">
|
|
67
79
|
<slot></slot>
|
|
@@ -70,19 +82,19 @@ class h extends HTMLElement {
|
|
|
70
82
|
</div>
|
|
71
83
|
`;
|
|
72
84
|
}
|
|
73
|
-
|
|
85
|
+
bindSlotBehavior() {
|
|
86
|
+
var e;
|
|
74
87
|
if (!this.shadowRoot) return;
|
|
75
88
|
const t = this.shadowRoot.querySelector("slot");
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
t.addEventListener("slotchange", e), e();
|
|
89
|
+
t && this.slotEl !== t && ((e = this.slotEl) == null || e.removeEventListener("slotchange", this.updateChoiceGroupState), this.slotEl = t, this.slotEl.addEventListener("slotchange", this.updateChoiceGroupState));
|
|
90
|
+
}
|
|
91
|
+
syncLayoutAttributes() {
|
|
92
|
+
const t = this.getAttribute("space"), e = this.getAttribute("aligny"), i = this.getAttribute("heading-space");
|
|
93
|
+
t ? this.style.setProperty("--form-group-space", t) : this.style.removeProperty("--form-group-space"), e ? this.style.setProperty("--form-group-align-y", e) : this.style.removeProperty("--form-group-align-y"), i ? this.style.setProperty("--form-group-heading-space", i) : this.style.removeProperty("--form-group-heading-space");
|
|
94
|
+
}
|
|
95
|
+
getHeadingLevel() {
|
|
96
|
+
const t = this.getAttribute("heading-level") || "5";
|
|
97
|
+
return ["1", "2", "3", "4", "5", "6"].includes(t) ? t : "5";
|
|
86
98
|
}
|
|
87
99
|
}
|
|
88
|
-
customElements.get("mui-form-group") || customElements.define("mui-form-group",
|
|
100
|
+
customElements.get("mui-form-group") || customElements.define("mui-form-group", n);
|