@muibook/components 8.0.2 → 9.0.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/prompts/index.js +1 -1
- package/dist/esm/components/mui-alert/index.js +48 -40
- package/dist/esm/components/mui-button/index.js +1 -1
- 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 +35 -38
- package/dist/esm/components/mui-select/index.js +34 -30
- 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 +29 -219
- package/dist/esm/css/readme.md +129 -0
- package/dist/esm/custom-elements.json +273 -98
- package/dist/esm/tokens/js/index.js +140 -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
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ import "@muibook/components/mui-body"; // Individual
|
|
|
18
18
|
#### CSS Usage
|
|
19
19
|
|
|
20
20
|
```javascript
|
|
21
|
+
import "@muibook/components/css/mui-brand.css";
|
|
21
22
|
import "@muibook/components/css/mui-tokens.css";
|
|
22
23
|
import "@muibook/components/css/mui-base.css";
|
|
23
24
|
import "@muibook/components/css/mui-reset.css";
|
|
@@ -178,7 +179,13 @@ npm publish
|
|
|
178
179
|
|
|
179
180
|
---
|
|
180
181
|
|
|
181
|
-
##
|
|
182
|
+
## Style Dictionary
|
|
183
|
+
|
|
184
|
+
- npm run token-build
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## NPM Token REFRESH
|
|
182
189
|
|
|
183
190
|
Refreshing Your npm Access Token (90-Day Expiry)
|
|
184
191
|
|
|
@@ -28,7 +28,7 @@ Rules:
|
|
|
28
28
|
placeholder: '<mui-field label="Email"><mui-input type="email" placeholder="you@example.com" value="..."></mui-input></mui-field>',
|
|
29
29
|
message: `<mui-field label="Name" message="This field doesn't accept special characters"><mui-input></mui-input></mui-field>`,
|
|
30
30
|
select: `<mui-field label="Brand"><mui-select options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-field>`,
|
|
31
|
-
inputAndSelect: `<mui-field label="Amount to transfer"
|
|
31
|
+
inputAndSelect: `<mui-field label="Amount to transfer"><mui-input type="number"><mui-select slot="after" label="Currency" hide-label style="width: 100px;" options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-input></mui-field>`
|
|
32
32
|
},
|
|
33
33
|
addon: {
|
|
34
34
|
text: [
|
|
@@ -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);
|
|
@@ -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);
|
|
@@ -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;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as e } from "../../utils/part-map/index.js";
|
|
2
|
+
class l extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return ["col", "space"];
|
|
4
|
+
return ["col", "space", "alignx", "aligny"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
|
-
super(), this.attachShadow({ mode: "open" });
|
|
7
|
+
super(), this.attachShadow({ mode: "open" }), this.col = "1fr 1fr", this.space = "var(--space-000)", this.alignX = "normal", this.alignY = "normal";
|
|
8
8
|
}
|
|
9
9
|
async connectedCallback() {
|
|
10
10
|
await this.waitForPartMap();
|
|
11
|
-
const t = this.getAttribute("col") || "
|
|
11
|
+
const t = this.getAttribute("col") || this.col, a = this.getAttribute("space") || this.space, i = this.getAttribute("alignx") || this.alignX, s = this.getAttribute("aligny") || this.alignY, o = e("layout", "spacing"), r = (
|
|
12
12
|
/*css*/
|
|
13
13
|
`
|
|
14
14
|
:host {
|
|
@@ -18,25 +18,32 @@ class i extends HTMLElement {
|
|
|
18
18
|
display: grid;
|
|
19
19
|
grid-template-columns: var(--col);
|
|
20
20
|
gap: var(--gap);
|
|
21
|
+
align-items: var(--alignY);
|
|
22
|
+
justify-items: var(--alignX);
|
|
21
23
|
}
|
|
22
24
|
`
|
|
23
25
|
);
|
|
24
26
|
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
25
27
|
`
|
|
26
|
-
<style>${
|
|
27
|
-
<div part="${
|
|
28
|
+
<style>${r}</style>
|
|
29
|
+
<div part="${o}" style="--col: ${t}; --gap: ${a}; --alignX: ${i}; --alignY: ${s};">
|
|
28
30
|
<slot></slot>
|
|
29
31
|
</div>
|
|
30
32
|
`);
|
|
31
33
|
}
|
|
34
|
+
attributeChangedCallback(t, a, i) {
|
|
35
|
+
if (a === i || !this.shadowRoot) return;
|
|
36
|
+
const s = this.shadowRoot.querySelector("div");
|
|
37
|
+
s && (t === "col" && s.style.setProperty("--col", i || this.col), t === "space" && s.style.setProperty("--gap", i || this.space), t === "alignx" && s.style.setProperty("--alignX", i || this.alignX), t === "aligny" && s.style.setProperty("--alignY", i || this.alignY));
|
|
38
|
+
}
|
|
32
39
|
waitForPartMap() {
|
|
33
40
|
return new Promise((t) => {
|
|
34
|
-
if (typeof
|
|
35
|
-
const
|
|
36
|
-
typeof
|
|
41
|
+
if (typeof e == "function") return t();
|
|
42
|
+
const a = () => {
|
|
43
|
+
typeof e == "function" ? t() : requestAnimationFrame(a);
|
|
37
44
|
};
|
|
38
|
-
|
|
45
|
+
a();
|
|
39
46
|
});
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
|
-
customElements.get("mui-grid") || customElements.define("mui-grid",
|
|
49
|
+
customElements.get("mui-grid") || customElements.define("mui-grid", l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class n extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["size", "level"];
|
|
4
4
|
}
|
|
@@ -6,8 +6,14 @@ class t extends HTMLElement {
|
|
|
6
6
|
super(), this.attachShadow({ mode: "open" });
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(i, t, e) {
|
|
12
|
+
t !== e && this.shadowRoot && this.render();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
9
15
|
if (!this.shadowRoot) return;
|
|
10
|
-
const
|
|
16
|
+
const i = this.getAttribute("size") || "1", e = `h${this.getAttribute("level") || i}`;
|
|
11
17
|
this.shadowRoot.innerHTML = /*html*/
|
|
12
18
|
`
|
|
13
19
|
<style>
|
|
@@ -26,10 +32,10 @@ class t extends HTMLElement {
|
|
|
26
32
|
.size-5 { font-size: var(--heading-font-size-500); line-height: var(--heading-line-height-500); }
|
|
27
33
|
.size-6 { font-size: var(--heading-font-size-600); line-height: var(--heading-line-height-600); }
|
|
28
34
|
</style>
|
|
29
|
-
<${
|
|
35
|
+
<${e} class="size-${i}">
|
|
30
36
|
<slot></slot>
|
|
31
|
-
</${
|
|
37
|
+
</${e}>
|
|
32
38
|
`;
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
|
-
customElements.get("mui-heading") || customElements.define("mui-heading",
|
|
41
|
+
customElements.get("mui-heading") || customElements.define("mui-heading", n);
|