@muibook/components 8.0.2 → 9.1.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 +8 -1
- package/dist/esm/agent/keywords/index.js +2 -2
- package/dist/esm/agent/prompts/index.js +856 -4
- package/dist/esm/components/mui-alert/index.js +48 -40
- package/dist/esm/components/mui-body/index.js +8 -0
- package/dist/esm/components/mui-button/index.js +47 -42
- package/dist/esm/components/mui-card/body/index.js +42 -29
- package/dist/esm/components/mui-checkbox/index.js +38 -39
- package/dist/esm/components/mui-dialog/index.js +4 -0
- package/dist/esm/components/mui-file-upload/index.js +12 -3
- package/dist/esm/components/mui-grid/index.js +19 -12
- package/dist/esm/components/mui-heading/index.js +11 -5
- package/dist/esm/components/mui-input/index.js +45 -38
- package/dist/esm/components/mui-select/index.js +42 -30
- package/dist/esm/components/mui-smart-card/index.js +1 -0
- package/dist/esm/components/mui-stack/hstack/index.js +13 -13
- package/dist/esm/components/mui-stack/vstack/index.js +13 -13
- package/dist/esm/components/mui-switch/index.js +38 -30
- package/dist/esm/components/mui-tabs/item/index.js +18 -12
- package/dist/esm/css/mui-brand.css +179 -0
- package/dist/esm/css/mui-tokens.css +31 -221
- package/dist/esm/css/readme.md +129 -0
- package/dist/esm/custom-elements.json +308 -133
- package/dist/esm/tokens/js/index.js +140 -0
- package/dist/types/agent/prompts/index.d.ts +9 -0
- package/dist/types/tokens/js/index.d.ts +140 -0
- package/dist/types/tokens/js/mui-brand.d.ts +140 -0
- package/package.json +14 -3
|
@@ -3,23 +3,31 @@ import "../mui-icons/check/index.js";
|
|
|
3
3
|
import "../mui-icons/info/index.js";
|
|
4
4
|
import "../mui-icons/warning/index.js";
|
|
5
5
|
import "../mui-icons/attention/index.js";
|
|
6
|
-
function
|
|
7
|
-
return ["positive", "info", "warning", "attention"].includes(
|
|
6
|
+
function b(d) {
|
|
7
|
+
return ["positive", "info", "warning", "attention"].includes(d);
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class m extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.actionSlotListener = null, this.attachShadow({ mode: "open" });
|
|
12
|
+
}
|
|
10
13
|
static get observedAttributes() {
|
|
11
14
|
return ["variant"];
|
|
12
15
|
}
|
|
13
|
-
constructor() {
|
|
14
|
-
super(), this.attachShadow({ mode: "open" });
|
|
15
|
-
}
|
|
16
16
|
connectedCallback() {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
this.render();
|
|
18
|
+
}
|
|
19
|
+
attributeChangedCallback(i, o, t) {
|
|
20
|
+
i === "variant" && o !== t && this.shadowRoot && this.render();
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const i = this.getAttribute("variant") || "positive", o = {
|
|
19
24
|
success: "positive",
|
|
20
25
|
error: "attention"
|
|
21
|
-
}, t =
|
|
22
|
-
|
|
26
|
+
}, t = b(i) ? i : o[i] || "positive";
|
|
27
|
+
if (i !== t) {
|
|
28
|
+
this.setAttribute("variant", t);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
23
31
|
const s = {
|
|
24
32
|
positive: "polite",
|
|
25
33
|
info: "polite",
|
|
@@ -27,29 +35,27 @@ class x extends HTMLElement {
|
|
|
27
35
|
attention: "assertive"
|
|
28
36
|
};
|
|
29
37
|
this.setAttribute("role", "alert"), this.setAttribute("aria-live", s[t] || "polite");
|
|
30
|
-
const
|
|
38
|
+
const r = {
|
|
31
39
|
positive: "mui-icon-check",
|
|
32
40
|
info: "mui-icon-info",
|
|
33
41
|
warning: "mui-icon-warning",
|
|
34
42
|
attention: "mui-icon-attention"
|
|
35
|
-
},
|
|
43
|
+
}, a = {
|
|
36
44
|
positive: "--feedback-positive-icon",
|
|
37
45
|
info: "--feedback-info-icon",
|
|
38
46
|
warning: "--feedback-warning-icon",
|
|
39
47
|
attention: "--feedback-attention-icon"
|
|
40
|
-
},
|
|
48
|
+
}, e = {
|
|
41
49
|
positive: "--feedback-positive-text",
|
|
42
50
|
info: "--feedback-info-text",
|
|
43
51
|
warning: "--feedback-warning-text",
|
|
44
52
|
attention: "--feedback-attention-text"
|
|
45
|
-
},
|
|
53
|
+
}, n = {
|
|
46
54
|
positive: "Success!",
|
|
47
55
|
info: "Info:",
|
|
48
56
|
warning: "Warning!",
|
|
49
57
|
attention: "Error!"
|
|
50
|
-
}
|
|
51
|
-
this.setAttribute("aria-live", s[t]);
|
|
52
|
-
const r = g[t], v = u[t], h = b[t], f = m[t], w = (
|
|
58
|
+
}, c = r[t], p = a[t], g = e[t], u = n[t], h = (
|
|
53
59
|
/*css*/
|
|
54
60
|
`
|
|
55
61
|
:host {
|
|
@@ -79,7 +85,6 @@ class x extends HTMLElement {
|
|
|
79
85
|
::slotted(mui-button[slot="action"]),
|
|
80
86
|
::slotted(mui-link[slot="action"]) { padding-top: var(--space-100); }
|
|
81
87
|
|
|
82
|
-
|
|
83
88
|
@media (min-width: 600px) {
|
|
84
89
|
:host { gap: var(--alert-gap-horizontal-desktop); }
|
|
85
90
|
:host([has-action]) { padding-right: var(--space-100); }
|
|
@@ -88,7 +93,7 @@ class x extends HTMLElement {
|
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
.label {
|
|
91
|
-
color: var(${
|
|
96
|
+
color: var(${g});
|
|
92
97
|
font-weight: var(--font-weight-bold);
|
|
93
98
|
}
|
|
94
99
|
|
|
@@ -101,41 +106,44 @@ class x extends HTMLElement {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
${["positive", "info", "warning", "attention"].map(
|
|
104
|
-
(
|
|
109
|
+
(l) => (
|
|
105
110
|
/*css*/
|
|
106
111
|
`
|
|
107
|
-
:host([variant="${
|
|
108
|
-
border: var(--feedback-${
|
|
109
|
-
background: var(--feedback-${
|
|
112
|
+
:host([variant="${l}"]) {
|
|
113
|
+
border: var(--feedback-${l}-border);
|
|
114
|
+
background: var(--feedback-${l}-background);
|
|
110
115
|
}
|
|
111
116
|
`
|
|
112
117
|
)
|
|
113
118
|
).join("")}
|
|
114
119
|
`
|
|
115
120
|
);
|
|
116
|
-
|
|
117
|
-
this.shadowRoot.innerHTML = /*html*/
|
|
121
|
+
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
118
122
|
`
|
|
119
|
-
<style>${
|
|
120
|
-
<${
|
|
123
|
+
<style>${h}</style>
|
|
124
|
+
<${c} size="medium" color="var(${p})" class="icon"></${c}>
|
|
121
125
|
<mui-body>
|
|
122
|
-
<span class="label">${
|
|
126
|
+
<span class="label">${u}</span>
|
|
123
127
|
<slot></slot>
|
|
124
128
|
</mui-body>
|
|
125
129
|
<slot name="action"></slot>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
`, this.setupActionSlot());
|
|
131
|
+
}
|
|
132
|
+
setupActionSlot() {
|
|
133
|
+
var o;
|
|
134
|
+
const i = (o = this.shadowRoot) == null ? void 0 : o.querySelector('slot[name="action"]');
|
|
135
|
+
if (i) {
|
|
136
|
+
this.actionSlotListener && i.removeEventListener("slotchange", this.actionSlotListener);
|
|
137
|
+
const t = () => {
|
|
138
|
+
const s = this.getAttribute("variant") || "positive", r = i.assignedElements();
|
|
139
|
+
let a = !1;
|
|
140
|
+
r.forEach((e) => {
|
|
141
|
+
const n = e.tagName;
|
|
142
|
+
(n === "MUI-BUTTON" || n === "MUI-LINK") && (a = !0, e.setAttribute("variant", "tertiary"), e.classList.add("alert-slot", `alert-${s}-slot`));
|
|
143
|
+
}), a ? this.setAttribute("has-action", "") : this.removeAttribute("has-action");
|
|
136
144
|
};
|
|
137
|
-
|
|
145
|
+
this.actionSlotListener = t, i.addEventListener("slotchange", this.actionSlotListener), requestAnimationFrame(t);
|
|
138
146
|
}
|
|
139
147
|
}
|
|
140
148
|
}
|
|
141
|
-
customElements.get("mui-alert") || customElements.define("mui-alert",
|
|
149
|
+
customElements.get("mui-alert") || customElements.define("mui-alert", m);
|
|
@@ -55,6 +55,11 @@ class r extends HTMLElement {
|
|
|
55
55
|
:host([variant="default"]) p {
|
|
56
56
|
color: var(--text-color);
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
:host([variant="optional"]) p {
|
|
60
|
+
color: var(--text-color-optional);
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
:host([variant="success"]) p {
|
|
59
64
|
color: var(--text-color-success);
|
|
60
65
|
}
|
|
@@ -68,6 +73,9 @@ class r extends HTMLElement {
|
|
|
68
73
|
:host([variant="default"]) ::slotted(.mui-icon) {
|
|
69
74
|
fill: var(--text-color);
|
|
70
75
|
}
|
|
76
|
+
:host([variant="optional"]) ::slotted(.mui-icon) {
|
|
77
|
+
fill: var(--text-color-optional);
|
|
78
|
+
}
|
|
71
79
|
:host([variant="success"]) ::slotted(.mui-icon) {
|
|
72
80
|
fill: var(--text-color-success);
|
|
73
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPartMap as
|
|
1
|
+
import { getPartMap as b } from "../../utils/part-map/index.js";
|
|
2
2
|
class h extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ["onclick", "type", "aria-label", "disabled", "variant", "size", "usage"];
|
|
@@ -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 o = (
|
|
12
12
|
/*html*/
|
|
13
13
|
`
|
|
14
14
|
<style>
|
|
@@ -24,7 +24,7 @@ class h extends HTMLElement {
|
|
|
24
24
|
border: none;
|
|
25
25
|
cursor: pointer;
|
|
26
26
|
width: 100%;
|
|
27
|
-
border-radius: var(--action-radius);
|
|
27
|
+
border-radius: var(--action-radius-medium);
|
|
28
28
|
padding: var(--action-padding);
|
|
29
29
|
text-decoration: none;
|
|
30
30
|
line-height: var(--action-line-height);
|
|
@@ -524,7 +524,7 @@ class h extends HTMLElement {
|
|
|
524
524
|
</style>
|
|
525
525
|
|
|
526
526
|
<button
|
|
527
|
-
part="${
|
|
527
|
+
part="${b("text", "spacing", "layout", "visual")}"
|
|
528
528
|
onclick="${this.getAttribute("onclick")}"
|
|
529
529
|
type="${this.getAttribute("type") || "button"}"
|
|
530
530
|
aria-label="${this.getAttribute("aria-label") || ""}"
|
|
@@ -537,23 +537,23 @@ class h extends HTMLElement {
|
|
|
537
537
|
|
|
538
538
|
`
|
|
539
539
|
);
|
|
540
|
-
this.shadowRoot.innerHTML =
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
543
|
-
const
|
|
540
|
+
this.shadowRoot.innerHTML = o, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
|
|
541
|
+
const n = this.shadowRoot;
|
|
542
|
+
if (!n) return;
|
|
543
|
+
const e = n.querySelector("slot:not([name])"), t = n.querySelector('slot[name="before"]'), i = n.querySelector('slot[name="after"]'), a = (l) => l ? l.assignedNodes({ flatten: !0 }).some((s) => {
|
|
544
544
|
var c;
|
|
545
545
|
return s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE && !!((c = s.textContent) != null && c.trim());
|
|
546
|
-
}) : !1, d =
|
|
547
|
-
this.classList.toggle("has-before", d), this.classList.toggle("has-after",
|
|
548
|
-
const
|
|
549
|
-
|
|
546
|
+
}) : !1, d = a(t), u = a(i);
|
|
547
|
+
this.classList.toggle("has-before", d), this.classList.toggle("has-after", u);
|
|
548
|
+
const v = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) ?? [];
|
|
549
|
+
v.every((l) => {
|
|
550
550
|
var s;
|
|
551
551
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
552
552
|
const c = l;
|
|
553
553
|
return c.tagName.toLowerCase() === "svg" || c.classList.contains("mui-icon");
|
|
554
554
|
}
|
|
555
555
|
return l.nodeType === Node.TEXT_NODE && !((s = l.textContent) != null && s.trim());
|
|
556
|
-
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(
|
|
556
|
+
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(v, !0)) : (this.removeAttribute("icon-only"), [t, e, i].forEach((s) => {
|
|
557
557
|
if (s) {
|
|
558
558
|
const c = s.assignedNodes({ flatten: !0 });
|
|
559
559
|
this.updateIconSizes(c, !1), this.updateAvatarSizes(c);
|
|
@@ -561,60 +561,65 @@ class h extends HTMLElement {
|
|
|
561
561
|
}));
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
|
-
attributeChangedCallback(
|
|
565
|
-
e
|
|
564
|
+
attributeChangedCallback(r, o, n) {
|
|
565
|
+
var e;
|
|
566
|
+
if (r === "disabled") {
|
|
567
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("button");
|
|
568
|
+
t && (this.hasAttribute("disabled") ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
|
|
569
|
+
}
|
|
570
|
+
r === "size" && o !== n && this.shadowRoot && requestAnimationFrame(() => {
|
|
566
571
|
const t = this.shadowRoot;
|
|
567
572
|
if (!t) return;
|
|
568
|
-
const
|
|
573
|
+
const i = [
|
|
569
574
|
t.querySelector("slot:not([name])"),
|
|
570
575
|
t.querySelector('slot[name="before"]'),
|
|
571
576
|
t.querySelector('slot[name="after"]')
|
|
572
|
-
],
|
|
573
|
-
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
this.updateIconSizes(
|
|
577
|
+
], a = this.hasAttribute("icon-only");
|
|
578
|
+
i.forEach((d) => {
|
|
579
|
+
if (d) {
|
|
580
|
+
const u = d.assignedNodes({ flatten: !0 });
|
|
581
|
+
this.updateIconSizes(u, a), this.updateAvatarSizes(u);
|
|
577
582
|
}
|
|
578
583
|
});
|
|
579
584
|
});
|
|
580
585
|
}
|
|
581
586
|
// Update avatar sizes based on button size
|
|
582
|
-
updateAvatarSizes(
|
|
583
|
-
const
|
|
587
|
+
updateAvatarSizes(r) {
|
|
588
|
+
const o = this.getAttribute("size") || "medium", e = {
|
|
584
589
|
"x-small": "x-small",
|
|
585
590
|
small: "x-small",
|
|
586
591
|
medium: "small",
|
|
587
592
|
large: "medium"
|
|
588
|
-
}[
|
|
589
|
-
|
|
590
|
-
if (
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
+
}[o] || "small";
|
|
594
|
+
r.forEach((t) => {
|
|
595
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
596
|
+
const i = t;
|
|
597
|
+
i.tagName.toLowerCase() === "mui-avatar" && i.setAttribute("size", e);
|
|
593
598
|
}
|
|
594
599
|
});
|
|
595
600
|
}
|
|
596
|
-
updateIconSizes(
|
|
597
|
-
const
|
|
601
|
+
updateIconSizes(r, o) {
|
|
602
|
+
const n = this.getAttribute("size") || "medium", t = {
|
|
598
603
|
"x-small": "x-small",
|
|
599
604
|
small: "x-small",
|
|
600
|
-
medium:
|
|
605
|
+
medium: o ? "medium" : "small",
|
|
601
606
|
// small for regular, medium for icon-only
|
|
602
|
-
large:
|
|
603
|
-
}[
|
|
604
|
-
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
(
|
|
607
|
+
large: o ? "large" : "medium"
|
|
608
|
+
}[n] || "small";
|
|
609
|
+
r.forEach((i) => {
|
|
610
|
+
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
611
|
+
const a = i;
|
|
612
|
+
(a.tagName.toLowerCase() === "svg" || a.classList.contains("mui-icon") || a.tagName.toLowerCase() === "mui-icon") && !a.hasAttribute("size") && a.setAttribute("size", t);
|
|
608
613
|
}
|
|
609
614
|
});
|
|
610
615
|
}
|
|
611
616
|
waitForPartMap() {
|
|
612
|
-
return new Promise((
|
|
613
|
-
if (typeof
|
|
614
|
-
const
|
|
615
|
-
typeof
|
|
617
|
+
return new Promise((r) => {
|
|
618
|
+
if (typeof b == "function") return r();
|
|
619
|
+
const o = () => {
|
|
620
|
+
typeof b == "function" ? r() : requestAnimationFrame(o);
|
|
616
621
|
};
|
|
617
|
-
|
|
622
|
+
o();
|
|
618
623
|
});
|
|
619
624
|
}
|
|
620
625
|
}
|
|
@@ -1,10 +1,48 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l extends HTMLElement {
|
|
2
|
+
static get observedAttributes() {
|
|
3
|
+
return ["condensed"];
|
|
4
|
+
}
|
|
2
5
|
constructor() {
|
|
3
6
|
super(), this.attachShadow({ mode: "open" });
|
|
4
7
|
}
|
|
5
8
|
connectedCallback() {
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(o, r, a) {
|
|
12
|
+
o === "condensed" && this.updateSlottedContent();
|
|
13
|
+
}
|
|
14
|
+
updateSlottedContent() {
|
|
15
|
+
requestAnimationFrame(() => {
|
|
16
|
+
if (!this.shadowRoot) return;
|
|
17
|
+
const o = this.shadowRoot.querySelector("slot");
|
|
18
|
+
if (!o) return;
|
|
19
|
+
const r = o.assignedNodes({ flatten: !0 });
|
|
20
|
+
this.classList.remove("inner-space", "has-card-slat-group", "has-accordion-slat-group");
|
|
21
|
+
let a = !1;
|
|
22
|
+
r.forEach((c) => {
|
|
23
|
+
if (c.nodeType === Node.ELEMENT_NODE) {
|
|
24
|
+
const t = c, i = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
|
|
25
|
+
i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((s) => {
|
|
26
|
+
s.classList.add("card-slot");
|
|
27
|
+
}), a = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((e) => {
|
|
28
|
+
const s = e.getAttribute("variant");
|
|
29
|
+
(s === "action" || s === "row") && (e.classList.add("card-slot"), this.hasAttribute("condensed") ? e.classList.add("condensed-slot") : e.classList.remove("condensed-slot"));
|
|
30
|
+
});
|
|
31
|
+
const n = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
|
|
32
|
+
n instanceof HTMLElement && (n.querySelectorAll("mui-cell").forEach((s) => {
|
|
33
|
+
s.classList.add("card-slot");
|
|
34
|
+
}), a = !0);
|
|
35
|
+
const d = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
|
|
36
|
+
d.length && (a = !0, d.forEach((e) => {
|
|
37
|
+
e.setAttribute("usage", "card"), e.closest("mui-accordion-block") ? this.classList.add("has-accordion-slat-group") : this.classList.add("inner-space", "has-card-slat-group");
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}), !a && !this.hasAttribute("condensed") && this.classList.add("inner-space");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
6
44
|
if (!this.shadowRoot) return;
|
|
7
|
-
const
|
|
45
|
+
const o = (
|
|
8
46
|
/*html*/
|
|
9
47
|
`
|
|
10
48
|
<style>
|
|
@@ -35,32 +73,7 @@ class u extends HTMLElement {
|
|
|
35
73
|
<slot></slot>
|
|
36
74
|
`
|
|
37
75
|
);
|
|
38
|
-
this.shadowRoot.innerHTML =
|
|
39
|
-
if (!this.shadowRoot) return;
|
|
40
|
-
const a = this.shadowRoot.querySelector("slot");
|
|
41
|
-
if (!a) return;
|
|
42
|
-
const d = a.assignedNodes({ flatten: !0 });
|
|
43
|
-
let e = !1;
|
|
44
|
-
d.forEach((c) => {
|
|
45
|
-
if (c.nodeType === Node.ELEMENT_NODE) {
|
|
46
|
-
const t = c, i = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
|
|
47
|
-
i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((o) => {
|
|
48
|
-
o.classList.add("card-slot");
|
|
49
|
-
}), e = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((s) => {
|
|
50
|
-
const o = s.getAttribute("variant");
|
|
51
|
-
(o === "action" || o === "row") && (s.classList.add("card-slot"), this.hasAttribute("condensed") && s.classList.add("condensed-slot"));
|
|
52
|
-
});
|
|
53
|
-
const r = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
|
|
54
|
-
r instanceof HTMLElement && (r.querySelectorAll("mui-cell").forEach((o) => {
|
|
55
|
-
o.classList.add("card-slot");
|
|
56
|
-
}), e = !0);
|
|
57
|
-
const n = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
|
|
58
|
-
n.length && (e = !0, n.forEach((s) => {
|
|
59
|
-
s.setAttribute("usage", "card"), s.closest("mui-accordion-block") ? this.classList.add("has-accordion-slat-group") : this.classList.add("inner-space", "has-card-slat-group");
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
}), !e && !this.hasAttribute("condensed") && this.classList.add("inner-space");
|
|
63
|
-
});
|
|
76
|
+
this.shadowRoot.innerHTML = o, this.updateSlottedContent();
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
|
-
customElements.get("mui-card-body") || customElements.define("mui-card-body",
|
|
79
|
+
customElements.get("mui-card-body") || customElements.define("mui-card-body", l);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../mui-body/index.js";
|
|
2
|
-
class
|
|
2
|
+
class a extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ["checked", "disabled", "id", "indeterminate"];
|
|
5
5
|
}
|
|
@@ -9,55 +9,54 @@ class d extends HTMLElement {
|
|
|
9
9
|
connectedCallback() {
|
|
10
10
|
this.render(), this.setupListener();
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
disconnectedCallback() {
|
|
13
|
+
this.cleanupListeners();
|
|
14
|
+
}
|
|
15
|
+
attributeChangedCallback(e, t, c) {
|
|
16
|
+
var r, o, s;
|
|
14
17
|
if (e === "checked") {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
|
|
18
|
+
const i = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
|
|
19
|
+
if (!i) return;
|
|
20
|
+
i.checked = c !== null;
|
|
18
21
|
}
|
|
19
22
|
if (e === "disabled") {
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
|
|
23
|
+
const i = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
|
|
24
|
+
if (!i) return;
|
|
25
|
+
i.disabled = c !== null;
|
|
23
26
|
}
|
|
24
27
|
if (e === "indeterminate") {
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
27
|
-
const n =
|
|
28
|
-
|
|
28
|
+
const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
29
|
+
if (!i) return;
|
|
30
|
+
const n = c !== null;
|
|
31
|
+
i.indeterminate = n, n && (i.checked = !0, this.setAttribute("checked", ""));
|
|
29
32
|
}
|
|
30
33
|
"id".includes(e) && (this.render(), this.setupListener());
|
|
31
34
|
}
|
|
35
|
+
cleanupListeners() {
|
|
36
|
+
var t;
|
|
37
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
38
|
+
e && this._changeHandler && e.removeEventListener("change", this._changeHandler);
|
|
39
|
+
}
|
|
32
40
|
setupListener() {
|
|
33
|
-
var
|
|
34
|
-
const e = (
|
|
35
|
-
e && (e.
|
|
36
|
-
const
|
|
37
|
-
this.dispatchEvent(
|
|
38
|
-
new CustomEvent("change", {
|
|
39
|
-
detail: { checked: c.checked },
|
|
40
|
-
bubbles: !0,
|
|
41
|
-
composed: !0
|
|
42
|
-
})
|
|
43
|
-
), c.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
44
|
-
}), e.indeterminate = this.hasAttribute("indeterminate"), e.addEventListener("change", (i) => {
|
|
45
|
-
const c = i.target;
|
|
46
|
-
this.dispatchEvent(
|
|
41
|
+
var t;
|
|
42
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
43
|
+
e && (this.cleanupListeners(), e.indeterminate = this.hasAttribute("indeterminate"), this._changeHandler = (c) => {
|
|
44
|
+
const r = c.target;
|
|
45
|
+
r.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this.removeAttribute("indeterminate"), this.dispatchEvent(
|
|
47
46
|
new CustomEvent("change", {
|
|
48
|
-
detail: { checked:
|
|
47
|
+
detail: { checked: r.checked },
|
|
49
48
|
bubbles: !0,
|
|
50
49
|
composed: !0
|
|
51
50
|
})
|
|
52
|
-
)
|
|
53
|
-
}));
|
|
51
|
+
);
|
|
52
|
+
}, e.addEventListener("change", this._changeHandler));
|
|
54
53
|
}
|
|
55
54
|
render() {
|
|
56
|
-
const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`,
|
|
55
|
+
const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`, t = this.hasAttribute("checked"), c = this.hasAttribute("disabled"), r = `
|
|
57
56
|
<mui-icon-checkmark class="icon" size="x-small" color="inverted"></mui-icon-checkmark>
|
|
58
|
-
`, o = this.hasAttribute("indeterminate"),
|
|
57
|
+
`, o = this.hasAttribute("indeterminate"), i = o ? `
|
|
59
58
|
<mui-icon-subtract class="icon" size="x-small" color="inverted"></mui-icon-subtract>
|
|
60
|
-
` :
|
|
59
|
+
` : r, n = this.innerHTML.trim().length > 0;
|
|
61
60
|
this.shadowRoot.innerHTML = /*html*/
|
|
62
61
|
`
|
|
63
62
|
<style>
|
|
@@ -139,22 +138,22 @@ class d extends HTMLElement {
|
|
|
139
138
|
type="checkbox"
|
|
140
139
|
id="${e}"
|
|
141
140
|
${o ? "indeterminate" : ""}
|
|
142
|
-
${o ||
|
|
143
|
-
${
|
|
141
|
+
${o || t ? "checked" : ""}
|
|
142
|
+
${c ? "disabled" : ""}
|
|
144
143
|
/>
|
|
145
|
-
${
|
|
144
|
+
${i}
|
|
146
145
|
</span>
|
|
147
146
|
${n ? '<mui-body size="small"><slot></slot></mui-body>' : ""}
|
|
148
147
|
</label>
|
|
149
148
|
`;
|
|
150
149
|
}
|
|
151
150
|
get checked() {
|
|
152
|
-
var
|
|
153
|
-
const e = (
|
|
151
|
+
var t;
|
|
152
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
154
153
|
return (e == null ? void 0 : e.checked) ?? !1;
|
|
155
154
|
}
|
|
156
155
|
set checked(e) {
|
|
157
156
|
e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
|
-
customElements.get("mui-checkbox") || customElements.define("mui-checkbox",
|
|
159
|
+
customElements.get("mui-checkbox") || customElements.define("mui-checkbox", a);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import "../mui-button/index.js";
|
|
2
2
|
class r extends HTMLElement {
|
|
3
3
|
constructor() {
|
|
4
|
-
super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.getAttribute("acceptedFileTypes") || "", this.currentFileName = this.getAttribute("currentFileName") || "", this.selectedFileName = null
|
|
4
|
+
super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.getAttribute("acceptedFileTypes") || "", this.currentFileName = this.getAttribute("currentFileName") || "", this.selectedFileName = null;
|
|
5
|
+
}
|
|
6
|
+
connectedCallback() {
|
|
7
|
+
this.render(), this.cacheElements(), this.attachEvents();
|
|
8
|
+
}
|
|
9
|
+
disconnectedCallback() {
|
|
10
|
+
this.cleanupListeners();
|
|
5
11
|
}
|
|
6
12
|
render() {
|
|
7
13
|
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
@@ -81,10 +87,13 @@ class r extends HTMLElement {
|
|
|
81
87
|
cacheElements() {
|
|
82
88
|
this.shadowRoot && (this.wrapper = this.shadowRoot.querySelector(".wrapper"), this.label = this.shadowRoot.querySelector(".label"), this.button = this.shadowRoot.querySelector(".button"), this.input = this.shadowRoot.querySelector('input[type="file"]'));
|
|
83
89
|
}
|
|
90
|
+
cleanupListeners() {
|
|
91
|
+
this.wrapper && this._wrapperClickHandler && this.wrapper.removeEventListener("click", this._wrapperClickHandler), this.input && this._inputChangeHandler && this.input.removeEventListener("change", this._inputChangeHandler);
|
|
92
|
+
}
|
|
84
93
|
attachEvents() {
|
|
85
|
-
this.
|
|
94
|
+
this._wrapperClickHandler = () => {
|
|
86
95
|
this.input.click();
|
|
87
|
-
}), this.
|
|
96
|
+
}, this._inputChangeHandler = this.handleFileChange.bind(this), this.wrapper.addEventListener("click", this._wrapperClickHandler), this.input.addEventListener("change", this._inputChangeHandler);
|
|
88
97
|
}
|
|
89
98
|
handleFileChange(i) {
|
|
90
99
|
var t;
|