@muibook/components 18.1.1 → 19.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/dist/esm/components/mui-body/index.js +5 -3
- package/dist/esm/components/mui-button/index.js +35 -10
- package/dist/esm/components/mui-card/body/index.js +13 -6
- package/dist/esm/components/mui-carousel/controller/index.js +10 -10
- package/dist/esm/components/mui-chip-input/index.js +103 -66
- package/dist/esm/components/mui-file-upload/index.js +28 -10
- package/dist/esm/components/mui-hint/index.js +40 -19
- package/dist/esm/components/mui-slat/slat/index.js +10 -5
- package/dist/esm/components/mui-stepper/stepper/index.js +9 -9
- package/dist/esm/components/mui-table/cell/index.js +22 -3
- package/dist/esm/components/mui-table/row/index.js +87 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +5 -5
- package/dist/esm/css/mui-brand.css +2 -1
- package/dist/esm/css/mui-tokens.css +5 -0
- package/dist/esm/custom-elements.json +2077 -951
- package/dist/esm/dynamic-attrs.json +166 -0
- package/dist/esm/tokens/js/index.js +14 -13
- package/dist/types/components/mui-chip-input/index.d.ts +1 -0
- package/dist/types/tokens/js/index.d.ts +1 -0
- package/package.json +5 -3
|
@@ -47,7 +47,7 @@ class l extends HTMLElement {
|
|
|
47
47
|
::slotted([slot="before"]),
|
|
48
48
|
::slotted([slot="after"]) {
|
|
49
49
|
flex-shrink: 0;
|
|
50
|
-
margin-top: var(--body-inline-icon-offset-medium, var(--body-inline-icon-offset, var(--stroke-size-
|
|
50
|
+
margin-top: var(--body-inline-icon-offset-medium, var(--body-inline-icon-offset, var(--stroke-size-200)));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
:host([size="x-small"]) ::slotted([slot="before"]),
|
|
@@ -57,12 +57,14 @@ class l extends HTMLElement {
|
|
|
57
57
|
|
|
58
58
|
:host([size="small"]) ::slotted([slot="before"]),
|
|
59
59
|
:host([size="small"]) ::slotted([slot="after"]) {
|
|
60
|
-
margin-top: var(
|
|
60
|
+
margin-top: var(
|
|
61
|
+
--body-inline-icon-offset-small, var(--body-inline-icon-offset)
|
|
62
|
+
);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
:host([size="large"]) ::slotted([slot="before"]),
|
|
64
66
|
:host([size="large"]) ::slotted([slot="after"]) {
|
|
65
|
-
margin-top: var(--body-inline-icon-offset-large, var(--body-inline-icon-offset, var(--stroke-size-
|
|
67
|
+
margin-top: var(--body-inline-icon-offset-large, var(--body-inline-icon-offset, var(--stroke-size-050)));
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
:host([size="x-small"]) p {
|
|
@@ -515,6 +515,31 @@ class h extends HTMLElement {
|
|
|
515
515
|
border-radius: var(--action-radius-large);
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
/* Dropdown slot corner radius must win over size radius rules */
|
|
519
|
+
:host([size][dropdown-slot]) button,
|
|
520
|
+
:host([size][dropdown-slot]) button:hover,
|
|
521
|
+
:host([size][dropdown-slot]) button:focus,
|
|
522
|
+
:host([size][dropdown-slot]) button:disabled {
|
|
523
|
+
border-radius: var(--radius-000);
|
|
524
|
+
white-space: nowrap;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
:host([size][dropdown-slot-first]) button,
|
|
528
|
+
:host([size][dropdown-slot-first]) button:hover,
|
|
529
|
+
:host([size][dropdown-slot-first]) button:focus,
|
|
530
|
+
:host([size][dropdown-slot-first]) button:disabled {
|
|
531
|
+
border-top-left-radius: calc(var(--radius-100) / 2);
|
|
532
|
+
border-top-right-radius: calc(var(--radius-100) / 2);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
:host([size][dropdown-slot-last]) button,
|
|
536
|
+
:host([size][dropdown-slot-last]) button:hover,
|
|
537
|
+
:host([size][dropdown-slot-last]) button:focus,
|
|
538
|
+
:host([size][dropdown-slot-last]) button:disabled {
|
|
539
|
+
border-bottom-left-radius: calc(var(--radius-100) / 2);
|
|
540
|
+
border-bottom-right-radius: calc(var(--radius-100) / 2);
|
|
541
|
+
}
|
|
542
|
+
|
|
518
543
|
:host([size="xx-small"][icon-only]) button {
|
|
519
544
|
height: calc(var(--action-icon-only-size-x-small) - var(--space-100));
|
|
520
545
|
width: calc(var(--action-icon-only-size-x-small) - var(--space-100));
|
|
@@ -638,19 +663,19 @@ class h extends HTMLElement {
|
|
|
638
663
|
this.shadowRoot.innerHTML = o, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
|
|
639
664
|
const s = this.shadowRoot;
|
|
640
665
|
if (!s) return;
|
|
641
|
-
const e = s.querySelector("slot:not([name])"), t = s.querySelector('slot[name="before"]'), a = s.querySelector('slot[name="after"]'), i = (
|
|
666
|
+
const e = s.querySelector("slot:not([name])"), t = s.querySelector('slot[name="before"]'), a = s.querySelector('slot[name="after"]'), i = (d) => d ? d.assignedNodes({ flatten: !0 }).some((n) => {
|
|
642
667
|
var l;
|
|
643
668
|
return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && !!((l = n.textContent) != null && l.trim());
|
|
644
|
-
}) : !1,
|
|
645
|
-
this.toggleAttribute("has-before",
|
|
669
|
+
}) : !1, c = i(t), u = i(a);
|
|
670
|
+
this.toggleAttribute("has-before", c), this.toggleAttribute("has-after", u);
|
|
646
671
|
const v = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) ?? [];
|
|
647
|
-
v.every((
|
|
672
|
+
v.every((d) => {
|
|
648
673
|
var n;
|
|
649
|
-
if (
|
|
650
|
-
const l =
|
|
674
|
+
if (d.nodeType === Node.ELEMENT_NODE) {
|
|
675
|
+
const l = d;
|
|
651
676
|
return l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon");
|
|
652
677
|
}
|
|
653
|
-
return
|
|
678
|
+
return d.nodeType === Node.TEXT_NODE && !((n = d.textContent) != null && n.trim());
|
|
654
679
|
}) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(v, !0)) : (this.removeAttribute("icon-only"), [t, e, a].forEach((n) => {
|
|
655
680
|
if (n) {
|
|
656
681
|
const l = n.assignedNodes({ flatten: !0 });
|
|
@@ -673,9 +698,9 @@ class h extends HTMLElement {
|
|
|
673
698
|
t.querySelector('slot[name="before"]'),
|
|
674
699
|
t.querySelector('slot[name="after"]')
|
|
675
700
|
], i = this.hasAttribute("icon-only");
|
|
676
|
-
a.forEach((
|
|
677
|
-
if (
|
|
678
|
-
const u =
|
|
701
|
+
a.forEach((c) => {
|
|
702
|
+
if (c) {
|
|
703
|
+
const u = c.assignedNodes({ flatten: !0 });
|
|
679
704
|
this.updateIconSizes(u, i), this.updateAvatarSizes(u), this.updateBadgeSizes(u);
|
|
680
705
|
}
|
|
681
706
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["condensed"];
|
|
4
4
|
}
|
|
@@ -32,8 +32,8 @@ class d extends HTMLElement {
|
|
|
32
32
|
c instanceof HTMLElement && (c.querySelectorAll("mui-cell").forEach((o) => {
|
|
33
33
|
o.setAttribute("card-slot", "");
|
|
34
34
|
}), r = !0);
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const d = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
|
|
36
|
+
d.length && (r = !0, d.forEach((e) => {
|
|
37
37
|
e.setAttribute("usage", "card"), e.closest("mui-accordion-block") ? this.setAttribute("has-accordion-slat-group", "") : (this.setAttribute("inner-space", ""), this.setAttribute("has-card-slat-group", ""));
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
@@ -64,9 +64,16 @@ class d extends HTMLElement {
|
|
|
64
64
|
padding-bottom: var(--space-200);
|
|
65
65
|
}
|
|
66
66
|
@media (min-width: 768px) {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
:host([has-card-slat-group]) {
|
|
68
|
+
padding-bottom: var(--space-500);
|
|
69
|
+
}
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
:host([condensed]),
|
|
73
|
+
:host([condensed][inner-space]),
|
|
74
|
+
:host([condensed][has-card-slat-group]),
|
|
75
|
+
:host([condensed][has-accordion-slat-group]) {
|
|
76
|
+
padding: var(--space-000);
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
</style>
|
|
@@ -76,4 +83,4 @@ class d extends HTMLElement {
|
|
|
76
83
|
this.shadowRoot.innerHTML = s, this.updateSlottedContent();
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
|
-
customElements.get("mui-card-body") || customElements.define("mui-card-body",
|
|
86
|
+
customElements.get("mui-card-body") || customElements.define("mui-card-body", l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class n extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.currentIndex = 0, this.boundMouseEnter = () => this.pauseAutoRotate(), this.boundMouseLeave = () => this.resumeAutoRotate(), this.boundFocusIn = () => this.pauseAutoRotate(), this.boundFocusOut = () => this.resumeAutoRotate(), this.shadow = this.attachShadow({ mode: "open" }), this.handleTabChange = this.handleTabChange.bind(this);
|
|
4
4
|
}
|
|
@@ -7,13 +7,13 @@ class a extends HTMLElement {
|
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
this.hasAttribute("direction") || this.setAttribute("direction", "horizontal"), this.render(), this.addEventListener("tab-change", this.handleTabChange);
|
|
10
|
-
const t = this.querySelector("tab-bar");
|
|
10
|
+
const t = this.querySelector("mui-tab-bar");
|
|
11
11
|
if (t) {
|
|
12
|
-
const e = t.querySelector("tab-item[active]");
|
|
12
|
+
const e = t.querySelector("mui-tab-item[active]");
|
|
13
13
|
if (e)
|
|
14
14
|
this.updatePanels(e.id);
|
|
15
15
|
else {
|
|
16
|
-
const o = t.querySelector("tab-item");
|
|
16
|
+
const o = t.querySelector("mui-tab-item");
|
|
17
17
|
o && (o.setAttribute("active", ""), this.updatePanels(o.id));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -56,11 +56,11 @@ class a extends HTMLElement {
|
|
|
56
56
|
const o = t[this.currentIndex].getAttribute("item");
|
|
57
57
|
if (console.log("➡️ Rotating to index:", this.currentIndex, "itemId:", o), o) {
|
|
58
58
|
this.updatePanels(o);
|
|
59
|
-
const s = this.querySelector("tab-bar");
|
|
59
|
+
const s = this.querySelector("mui-tab-bar");
|
|
60
60
|
if (s) {
|
|
61
|
-
const r = s.querySelector(`tab-item#${o}`);
|
|
62
|
-
r && (s.querySelectorAll("tab-item").forEach((
|
|
63
|
-
|
|
61
|
+
const r = s.querySelector(`mui-tab-item#${o}`);
|
|
62
|
+
r && (s.querySelectorAll("mui-tab-item").forEach((i) => {
|
|
63
|
+
i.removeAttribute("active");
|
|
64
64
|
}), r.setAttribute("active", ""));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -173,7 +173,7 @@ class a extends HTMLElement {
|
|
|
173
173
|
console.error("❌ Track element not found!");
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const s = Array.from(e).findIndex((
|
|
176
|
+
const s = Array.from(e).findIndex((i) => i.getAttribute("item") === t);
|
|
177
177
|
if (s === -1) {
|
|
178
178
|
console.warn("⚠️ Panel not found for:", t);
|
|
179
179
|
return;
|
|
@@ -183,4 +183,4 @@ class a extends HTMLElement {
|
|
|
183
183
|
console.log("🎬 Setting transform to:", r), console.log("📏 Current transform:", o.style.transform), console.log("🎨 Current transition:", window.getComputedStyle(o).transition), o.style.transform = r, o.offsetHeight, console.log("✅ After setting transform:", o.style.transform);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
customElements.get("mui-carousel-controller") || customElements.define("mui-carousel-controller",
|
|
186
|
+
customElements.get("mui-carousel-controller") || customElements.define("mui-carousel-controller", n);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../mui-input/index.js";
|
|
2
2
|
import "../mui-chip/index.js";
|
|
3
|
+
import "../mui-button/index.js";
|
|
3
4
|
import "../mui-stack/hstack/index.js";
|
|
4
5
|
class w extends HTMLElement {
|
|
5
6
|
constructor() {
|
|
@@ -83,16 +84,16 @@ class w extends HTMLElement {
|
|
|
83
84
|
try {
|
|
84
85
|
e = JSON.parse(t);
|
|
85
86
|
} catch {
|
|
86
|
-
e = t.split(",").map((
|
|
87
|
+
e = t.split(",").map((o) => o.trim()).filter(Boolean);
|
|
87
88
|
}
|
|
88
89
|
if (!Array.isArray(e)) return [];
|
|
89
90
|
const i = new Map(this.parseOptions().map((a) => [a.value.toLowerCase(), a])), s = e.map((a) => {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
91
|
+
const o = this.normalizeOption(a);
|
|
92
|
+
return o ? i.get(o.value.toLowerCase()) || o : null;
|
|
92
93
|
}).filter((a) => !!a), r = /* @__PURE__ */ new Set();
|
|
93
94
|
return s.filter((a) => {
|
|
94
|
-
const
|
|
95
|
-
return r.has(
|
|
95
|
+
const o = a.value.toLowerCase();
|
|
96
|
+
return r.has(o) ? !1 : (r.add(o), !0);
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
syncSelectedFromAttribute() {
|
|
@@ -115,6 +116,10 @@ class w extends HTMLElement {
|
|
|
115
116
|
get placement() {
|
|
116
117
|
return this.getAttribute("placement") === "after" ? "after" : "before";
|
|
117
118
|
}
|
|
119
|
+
set placement(t) {
|
|
120
|
+
const e = t === "after" ? "after" : "before";
|
|
121
|
+
this.setAttribute("placement", e);
|
|
122
|
+
}
|
|
118
123
|
get useStackLayout() {
|
|
119
124
|
if (this.hasAttribute("mobile-stack")) return !0;
|
|
120
125
|
const t = this.getAttribute("breakpoint");
|
|
@@ -196,21 +201,15 @@ class w extends HTMLElement {
|
|
|
196
201
|
handleKeyboard(t) {
|
|
197
202
|
const e = this.filteredOptions, i = e.length + (this.showCreateOption ? 1 : 0);
|
|
198
203
|
if (t.key === "ArrowDown" && i > 0) {
|
|
199
|
-
t.preventDefault(), this.highlightedIndex = (this.highlightedIndex + 1 + i) % i;
|
|
200
|
-
const s = this.inputValue.length;
|
|
201
|
-
this.rerenderAndPreserveFocus(s, s);
|
|
204
|
+
t.preventDefault(), this.highlightedIndex = (this.highlightedIndex + 1 + i) % i, this.updateListbox();
|
|
202
205
|
return;
|
|
203
206
|
}
|
|
204
207
|
if (t.key === "ArrowUp" && i > 0) {
|
|
205
|
-
t.preventDefault(), this.highlightedIndex = (this.highlightedIndex - 1 + i) % i;
|
|
206
|
-
const s = this.inputValue.length;
|
|
207
|
-
this.rerenderAndPreserveFocus(s, s);
|
|
208
|
+
t.preventDefault(), this.highlightedIndex = (this.highlightedIndex - 1 + i) % i, this.updateListbox();
|
|
208
209
|
return;
|
|
209
210
|
}
|
|
210
211
|
if (t.key === "Escape") {
|
|
211
|
-
this.highlightedIndex = -1;
|
|
212
|
-
const s = this.inputValue.length;
|
|
213
|
-
this.rerenderAndPreserveFocus(s, s);
|
|
212
|
+
this.highlightedIndex = -1, this.updateListbox();
|
|
214
213
|
return;
|
|
215
214
|
}
|
|
216
215
|
if (t.key === "Backspace" && !this.inputValue && this.selectedItems.length > 0) {
|
|
@@ -228,53 +227,97 @@ class w extends HTMLElement {
|
|
|
228
227
|
setupListeners() {
|
|
229
228
|
if (!this.shadowRoot) return;
|
|
230
229
|
const t = this.shadowRoot.querySelector("mui-input");
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
230
|
+
if (!t) return;
|
|
231
|
+
t.oninput = (i) => {
|
|
232
|
+
var a;
|
|
233
|
+
const s = (a = i.detail) == null ? void 0 : a.value, r = t.getAttribute("value") || "";
|
|
234
|
+
this.inputValue = s ?? r, this.highlightedIndex = -1, this.emitQueryChange(), this.updateListbox();
|
|
235
|
+
}, t.onkeydown = (i) => {
|
|
236
|
+
this.handleKeyboard(i);
|
|
237
|
+
};
|
|
238
|
+
const e = this.shadowRoot.querySelector(".listbox");
|
|
239
|
+
e && (e.onmousedown = (i) => {
|
|
240
|
+
const s = i.target, r = s == null ? void 0 : s.closest("[data-option-value]");
|
|
241
|
+
if (!r) return;
|
|
242
|
+
i.preventDefault();
|
|
243
|
+
const a = r.getAttribute("data-option-value");
|
|
244
|
+
a && this.addValue(a);
|
|
245
|
+
}), this.shadowRoot.querySelectorAll("[data-remove-value]").forEach((i) => {
|
|
246
|
+
i.addEventListener("dismiss", (s) => {
|
|
247
|
+
s.stopPropagation();
|
|
248
|
+
const r = i.getAttribute("data-remove-value");
|
|
249
|
+
r && !this.disabled && this.removeValue(r);
|
|
248
250
|
});
|
|
249
|
-
})
|
|
251
|
+
});
|
|
250
252
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
updateListbox() {
|
|
254
|
+
if (!this.shadowRoot) return;
|
|
255
|
+
const t = this.shadowRoot.querySelector(".listbox");
|
|
256
|
+
if (!t) return;
|
|
257
|
+
const e = this.filteredOptions;
|
|
258
|
+
if (!(!this.disabled && (e.length > 0 || this.showCreateOption) && this.inputValue.trim().length > 0)) {
|
|
259
|
+
t.hidden = !0, t.innerHTML = "";
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const s = e.map((o, u) => {
|
|
263
|
+
const n = u === this.highlightedIndex;
|
|
254
264
|
return (
|
|
255
265
|
/*html*/
|
|
256
266
|
`
|
|
257
|
-
<button
|
|
258
|
-
|
|
259
|
-
|
|
267
|
+
<mui-button
|
|
268
|
+
variant="${n ? "secondary" : "tertiary"}"
|
|
269
|
+
size="small"
|
|
270
|
+
class="option ${n ? "active" : ""}"
|
|
260
271
|
role="option"
|
|
261
|
-
aria-selected="${
|
|
272
|
+
aria-selected="${n ? "true" : "false"}"
|
|
262
273
|
data-option-value="${o.value}"
|
|
263
|
-
>${o.label}</button>
|
|
274
|
+
>${o.label}</mui-button>
|
|
275
|
+
`
|
|
276
|
+
);
|
|
277
|
+
}).join(""), r = e.length, a = this.showCreateOption ? (
|
|
278
|
+
/*html*/
|
|
279
|
+
`
|
|
280
|
+
<mui-button
|
|
281
|
+
variant="${this.highlightedIndex === r ? "secondary" : "tertiary"}"
|
|
282
|
+
size="small"
|
|
283
|
+
class="option ${this.highlightedIndex === r ? "active" : ""}"
|
|
284
|
+
role="option"
|
|
285
|
+
aria-selected="${this.highlightedIndex === r ? "true" : "false"}"
|
|
286
|
+
data-option-value="${this.inputValue.trim()}"
|
|
287
|
+
>Add "${this.inputValue.trim()}"</mui-button>
|
|
288
|
+
`
|
|
289
|
+
) : "";
|
|
290
|
+
t.hidden = !1, t.innerHTML = `${s}${a}`;
|
|
291
|
+
}
|
|
292
|
+
render() {
|
|
293
|
+
const t = this.getAttribute("id") || "", e = this.getAttribute("label") || "", i = this.getAttribute("placeholder") || "Type to add", s = this.hasAttribute("hide-label"), r = this.useStackLayout, a = this.getAttribute("name") || "", o = this.filteredOptions, u = `${t}-listbox`, n = !this.disabled && (o.length > 0 || this.showCreateOption) && this.inputValue.trim().length > 0, c = o.map((l, v) => {
|
|
294
|
+
const d = v === this.highlightedIndex;
|
|
295
|
+
return (
|
|
296
|
+
/*html*/
|
|
297
|
+
`
|
|
298
|
+
<mui-button
|
|
299
|
+
variant="${d ? "secondary" : "tertiary"}"
|
|
300
|
+
size="small"
|
|
301
|
+
class="option ${d ? "active" : ""}"
|
|
302
|
+
role="option"
|
|
303
|
+
aria-selected="${d ? "true" : "false"}"
|
|
304
|
+
data-option-value="${l.value}"
|
|
305
|
+
>${l.label}</mui-button>
|
|
264
306
|
`
|
|
265
307
|
);
|
|
266
|
-
}).join(""),
|
|
308
|
+
}).join(""), h = o.length, p = this.showCreateOption ? (
|
|
267
309
|
/*html*/
|
|
268
310
|
`
|
|
269
|
-
<button
|
|
270
|
-
|
|
271
|
-
|
|
311
|
+
<mui-button
|
|
312
|
+
variant="${this.highlightedIndex === h ? "secondary" : "tertiary"}"
|
|
313
|
+
size="small"
|
|
314
|
+
class="option ${this.highlightedIndex === h ? "active" : ""}"
|
|
272
315
|
role="option"
|
|
273
|
-
aria-selected="${this.highlightedIndex ===
|
|
316
|
+
aria-selected="${this.highlightedIndex === h ? "true" : "false"}"
|
|
274
317
|
data-option-value="${this.inputValue.trim()}"
|
|
275
|
-
>Add "${this.inputValue.trim()}"</button>
|
|
318
|
+
>Add "${this.inputValue.trim()}"</mui-button>
|
|
276
319
|
`
|
|
277
|
-
) : "", m = this.placement, b = this.placement === "after" ? "chip-slot-shell after-shell" : "chip-slot-shell before-shell",
|
|
320
|
+
) : "", m = this.placement, b = this.placement === "after" ? "chip-slot-shell after-shell" : "chip-slot-shell before-shell", f = this.selectedItems.length ? (
|
|
278
321
|
/*html*/
|
|
279
322
|
`
|
|
280
323
|
<mui-h-stack
|
|
@@ -284,7 +327,7 @@ class w extends HTMLElement {
|
|
|
284
327
|
aligny="center"
|
|
285
328
|
>
|
|
286
329
|
${this.selectedItems.map(
|
|
287
|
-
(
|
|
330
|
+
(l) => (
|
|
288
331
|
/*html*/
|
|
289
332
|
`
|
|
290
333
|
<mui-chip
|
|
@@ -292,15 +335,15 @@ class w extends HTMLElement {
|
|
|
292
335
|
size="${this.normalizedSize}"
|
|
293
336
|
dismiss
|
|
294
337
|
${this.disabled ? "disabled" : ""}
|
|
295
|
-
data-remove-value="${
|
|
296
|
-
aria-label="Remove ${
|
|
297
|
-
>${
|
|
338
|
+
data-remove-value="${l.value}"
|
|
339
|
+
aria-label="Remove ${l.label}"
|
|
340
|
+
>${l.label}</mui-chip>
|
|
298
341
|
`
|
|
299
342
|
)
|
|
300
343
|
).join("")}
|
|
301
344
|
</mui-h-stack>
|
|
302
345
|
`
|
|
303
|
-
) : "",
|
|
346
|
+
) : "", g = a ? this.selectedValues.map((l) => `<input type="hidden" name="${a}" value="${l}" />`).join("") : "";
|
|
304
347
|
this.shadowRoot.innerHTML = /*html*/
|
|
305
348
|
`
|
|
306
349
|
<style>
|
|
@@ -362,16 +405,8 @@ class w extends HTMLElement {
|
|
|
362
405
|
}
|
|
363
406
|
.option {
|
|
364
407
|
width: 100%;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
background: transparent;
|
|
368
|
-
padding: var(--space-200) var(--space-300);
|
|
369
|
-
cursor: pointer;
|
|
370
|
-
color: var(--text-color);
|
|
371
|
-
}
|
|
372
|
-
.option.active,
|
|
373
|
-
.option:hover {
|
|
374
|
-
background: var(--surface-elevated-200);
|
|
408
|
+
justify-content: flex-start;
|
|
409
|
+
--button-width: 100%;
|
|
375
410
|
}
|
|
376
411
|
</style>
|
|
377
412
|
|
|
@@ -391,16 +426,18 @@ class w extends HTMLElement {
|
|
|
391
426
|
value="${this.inputValue}"
|
|
392
427
|
${r ? 'slot-layout="stack-mobile"' : ""}
|
|
393
428
|
${this.disabled ? "disabled" : ""}
|
|
394
|
-
aria-controls="${
|
|
429
|
+
aria-controls="${u}"
|
|
395
430
|
aria-autocomplete="list"
|
|
396
431
|
>
|
|
397
|
-
${
|
|
432
|
+
${f}
|
|
398
433
|
</mui-input>
|
|
399
434
|
|
|
400
|
-
|
|
435
|
+
<div id="${u}" class="listbox" role="listbox" ${n ? "" : "hidden"}>
|
|
436
|
+
${n ? `${c}${p}` : ""}
|
|
437
|
+
</div>
|
|
401
438
|
</div>
|
|
402
439
|
|
|
403
|
-
${
|
|
440
|
+
${g}
|
|
404
441
|
`;
|
|
405
442
|
}
|
|
406
443
|
}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import "../mui-button/index.js";
|
|
2
|
-
class
|
|
2
|
+
class a extends HTMLElement {
|
|
3
|
+
static get observedAttributes() {
|
|
4
|
+
return ["accepted-file-types", "current-file-name", "acceptedfiletypes", "currentfilename"];
|
|
5
|
+
}
|
|
3
6
|
constructor() {
|
|
4
|
-
super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.
|
|
7
|
+
super(), this.attachShadow({ mode: "open" }), this.acceptedFileTypes = this.readAcceptedFileTypes(), this.currentFileName = this.readCurrentFileName(), this.selectedFileName = null;
|
|
8
|
+
}
|
|
9
|
+
readAcceptedFileTypes() {
|
|
10
|
+
return this.getAttribute("accepted-file-types") || this.getAttribute("acceptedFileTypes") || this.getAttribute("acceptedfiletypes") || "";
|
|
11
|
+
}
|
|
12
|
+
readCurrentFileName() {
|
|
13
|
+
return this.getAttribute("current-file-name") || this.getAttribute("currentFileName") || this.getAttribute("currentfilename") || "";
|
|
14
|
+
}
|
|
15
|
+
attributeChangedCallback(e, i, t) {
|
|
16
|
+
if (i !== t) {
|
|
17
|
+
if (e === "accepted-file-types" || e === "acceptedfiletypes") {
|
|
18
|
+
this.acceptedFileTypes = this.readAcceptedFileTypes(), this.input && (this.input.accept = this.acceptedFileTypes);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
(e === "current-file-name" || e === "currentfilename") && (this.currentFileName = this.readCurrentFileName(), !this.selectedFileName && this.label && (this.label.textContent = this.currentFileName || "No file selected"));
|
|
22
|
+
}
|
|
5
23
|
}
|
|
6
24
|
connectedCallback() {
|
|
7
|
-
this.render(), this.cacheElements(), this.attachEvents();
|
|
25
|
+
this.acceptedFileTypes = this.readAcceptedFileTypes(), this.currentFileName = this.readCurrentFileName(), this.render(), this.cacheElements(), this.attachEvents();
|
|
8
26
|
}
|
|
9
27
|
disconnectedCallback() {
|
|
10
28
|
this.cleanupListeners();
|
|
@@ -78,7 +96,7 @@ class r extends HTMLElement {
|
|
|
78
96
|
}
|
|
79
97
|
</style>
|
|
80
98
|
<div class="wrapper">
|
|
81
|
-
<span class="label">${this.currentFileName}</span>
|
|
99
|
+
<span class="label">${this.selectedFileName || this.currentFileName || "No file selected"}</span>
|
|
82
100
|
<mui-button variant="tertiary">Browse</mui-button>
|
|
83
101
|
<input type="file" accept="${this.acceptedFileTypes}" />
|
|
84
102
|
</div>
|
|
@@ -95,16 +113,16 @@ class r extends HTMLElement {
|
|
|
95
113
|
this.input.click();
|
|
96
114
|
}, this._inputChangeHandler = this.handleFileChange.bind(this), this.wrapper.addEventListener("click", this._wrapperClickHandler), this.input.addEventListener("change", this._inputChangeHandler);
|
|
97
115
|
}
|
|
98
|
-
handleFileChange(
|
|
99
|
-
var
|
|
100
|
-
const
|
|
101
|
-
|
|
116
|
+
handleFileChange(e) {
|
|
117
|
+
var r;
|
|
118
|
+
const t = (r = e.target.files) == null ? void 0 : r[0];
|
|
119
|
+
t && (this.selectedFileName = t.name, this.label.textContent = t.name, this.dispatchEvent(
|
|
102
120
|
new CustomEvent("file-upload", {
|
|
103
|
-
detail: { file:
|
|
121
|
+
detail: { file: t },
|
|
104
122
|
bubbles: !0,
|
|
105
123
|
composed: !0
|
|
106
124
|
})
|
|
107
125
|
));
|
|
108
126
|
}
|
|
109
127
|
}
|
|
110
|
-
customElements.get("mui-file-upload") || customElements.define("mui-file-upload",
|
|
128
|
+
customElements.get("mui-file-upload") || customElements.define("mui-file-upload", a);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
class
|
|
1
|
+
class T extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.openTimer = null, this.closeTimer = null, this.hasOpenedOnce = !1, this.boundReposition = () => this.positionTooltip(), this.boundDocPointer = (t) => {
|
|
4
4
|
t.composedPath().includes(this) || this.close(!0);
|
|
5
5
|
}, this.attachShadow({ mode: "open" });
|
|
6
6
|
}
|
|
7
7
|
static get observedAttributes() {
|
|
8
|
-
return ["placement", "open", "delay", "initial-delay"];
|
|
8
|
+
return ["placement", "open", "delay", "initial-delay", "size"];
|
|
9
9
|
}
|
|
10
10
|
connectedCallback() {
|
|
11
|
-
this.hasAttribute("placement") || this.setAttribute("placement", "top"), this.render(), this.setupEvents();
|
|
11
|
+
this.hasAttribute("placement") || this.setAttribute("placement", "top"), this.render(), this.setupEvents(), this.syncTriggerSize();
|
|
12
12
|
}
|
|
13
13
|
attributeChangedCallback() {
|
|
14
|
-
this.shadowRoot && this.hasAttribute("open") && requestAnimationFrame(() => this.positionTooltip());
|
|
14
|
+
this.shadowRoot && (this.syncTriggerSize(), this.hasAttribute("open") && requestAnimationFrame(() => this.positionTooltip()));
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
if (!this.shadowRoot) return;
|
|
@@ -102,11 +102,32 @@ class y extends HTMLElement {
|
|
|
102
102
|
`;
|
|
103
103
|
}
|
|
104
104
|
setupEvents() {
|
|
105
|
-
var
|
|
106
|
-
const t = (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
var r, p;
|
|
106
|
+
const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".trigger");
|
|
107
|
+
if (!t) return;
|
|
108
|
+
const o = (p = this.shadowRoot) == null ? void 0 : p.querySelector('slot[name="trigger"]');
|
|
109
|
+
t.addEventListener("mouseenter", () => this.openWithDelay()), t.addEventListener("mouseleave", () => this.closeWithDelay()), t.addEventListener("focusin", () => this.openWithDelay()), t.addEventListener("focusout", () => this.close(!0)), o == null || o.addEventListener("slotchange", () => this.syncTriggerSize()), this.addEventListener("keydown", (m) => {
|
|
110
|
+
m.key === "Escape" && this.close(!0);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
syncTriggerSize() {
|
|
114
|
+
var u, i;
|
|
115
|
+
const t = (u = this.shadowRoot) == null ? void 0 : u.querySelector('slot[name="trigger"]');
|
|
116
|
+
if (!t) return;
|
|
117
|
+
const o = this.getAttribute("size") || ((i = this.closest("mui-body")) == null ? void 0 : i.getAttribute("size")) || "medium", r = {
|
|
118
|
+
"x-small": "x-small",
|
|
119
|
+
small: "small",
|
|
120
|
+
medium: "small",
|
|
121
|
+
large: "medium"
|
|
122
|
+
}, p = {
|
|
123
|
+
"x-small": "xx-small",
|
|
124
|
+
small: "x-small",
|
|
125
|
+
medium: "small",
|
|
126
|
+
large: "medium"
|
|
127
|
+
}, m = r[o] || "small", h = p[o] || "small";
|
|
128
|
+
t.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
129
|
+
s.tagName.startsWith("MUI-ICON-") && !s.hasAttribute("size") && s.setAttribute("size", m), s.tagName === "MUI-BADGE" && !s.hasAttribute("size") && s.setAttribute("size", h);
|
|
130
|
+
});
|
|
110
131
|
}
|
|
111
132
|
getDelay() {
|
|
112
133
|
const t = Number(this.getAttribute("delay"));
|
|
@@ -131,16 +152,16 @@ class y extends HTMLElement {
|
|
|
131
152
|
this.openTimer && (window.clearTimeout(this.openTimer), this.openTimer = null), this.closeTimer && (window.clearTimeout(this.closeTimer), this.closeTimer = null), t && this.setAttribute("closing-immediate", ""), this.removeAttribute("open"), t && requestAnimationFrame(() => this.removeAttribute("closing-immediate")), window.removeEventListener("resize", this.boundReposition), window.removeEventListener("scroll", this.boundReposition, !0), document.removeEventListener("pointerdown", this.boundDocPointer, !0);
|
|
132
153
|
}
|
|
133
154
|
positionTooltip() {
|
|
134
|
-
var
|
|
135
|
-
const t = (
|
|
155
|
+
var b, f, w, v;
|
|
156
|
+
const t = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".trigger"), o = (f = this.shadowRoot) == null ? void 0 : f.querySelector(".tooltip");
|
|
136
157
|
if (!o || !t) return;
|
|
137
|
-
const
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
o.style.top = `${
|
|
158
|
+
const r = (w = this.shadowRoot) == null ? void 0 : w.querySelector('slot[name="trigger"]'), m = ((v = r == null ? void 0 : r.assignedElements({ flatten: !0 })) == null ? void 0 : v[0]) || null || t, h = this.getAttribute("placement") || "top", e = m.getBoundingClientRect(), u = this.getBoundingClientRect(), i = o.getBoundingClientRect(), s = window.innerHeight, g = window.innerWidth, n = 8, a = 8;
|
|
159
|
+
let l = h;
|
|
160
|
+
h === "top" && e.top - i.height - a < n && (l = "bottom"), h === "bottom" && e.bottom + i.height + a > s - n && (l = "top"), h === "left" && e.left - i.width - a < n && (l = "right"), h === "right" && e.right + i.width + a > g - n && (l = "left"), o.setAttribute("data-placement", l);
|
|
161
|
+
let d = 0, c = 0;
|
|
162
|
+
l === "top" ? (d = e.top - i.height - a, c = e.left + e.width / 2 - i.width / 2) : l === "bottom" ? (d = e.bottom + a, c = e.left + e.width / 2 - i.width / 2) : l === "left" ? (d = e.top + e.height / 2 - i.height / 2, c = e.left - i.width - a) : (d = e.top + e.height / 2 - i.height / 2, c = e.right + a), d = Math.max(n, Math.min(d, s - i.height - n)), c = Math.max(n, Math.min(c, g - i.width - n));
|
|
163
|
+
const x = d - u.top, y = c - u.left;
|
|
164
|
+
o.style.top = `${x}px`, o.style.left = `${y}px`;
|
|
144
165
|
}
|
|
145
166
|
}
|
|
146
|
-
customElements.get("mui-hint") || customElements.define("mui-hint",
|
|
167
|
+
customElements.get("mui-hint") || customElements.define("mui-hint", T);
|
|
@@ -108,13 +108,18 @@ class i extends HTMLElement {
|
|
|
108
108
|
--slat-background-hover: var(--slat-card-background-hover);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
:host([
|
|
112
|
-
border-radius: 0;
|
|
111
|
+
:host([radius="none"]) .action::part(border-radius) {
|
|
112
|
+
border-radius: 0;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
:host([condensed-slot]:
|
|
116
|
-
border-
|
|
117
|
-
border-
|
|
115
|
+
:host([radius="none"][condensed-slot]:first-of-type) .action::part(border-radius) {
|
|
116
|
+
border-top-left-radius: var(--card-radius);
|
|
117
|
+
border-top-right-radius: var(--card-radius);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host([radius="none"][condensed-slot]:last-of-type) .action::part(border-radius) {
|
|
121
|
+
border-bottom-left-radius: var(--card-radius);
|
|
122
|
+
border-bottom-right-radius: var(--card-radius);
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
::slotted(mui-avatar) {
|