@muibook/components 9.0.0 → 10.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/agent/keywords/index.js +2 -2
- package/dist/esm/agent/prompts/index.js +855 -3
- package/dist/esm/components/mui-accordion/block/index.js +6 -6
- package/dist/esm/components/mui-alert/index.js +43 -40
- package/dist/esm/components/mui-badge/index.js +15 -7
- package/dist/esm/components/mui-body/index.js +8 -0
- package/dist/esm/components/mui-button/index.js +86 -82
- package/dist/esm/components/mui-card/body/index.js +31 -31
- package/dist/esm/components/mui-card/card/index.js +6 -6
- package/dist/esm/components/mui-card/footer/index.js +10 -10
- package/dist/esm/components/mui-carousel/controller/index.js +75 -9
- package/dist/esm/components/mui-chip/index.js +40 -31
- package/dist/esm/components/mui-dropdown/index.js +45 -44
- package/dist/esm/components/mui-icons/ai/index.js +58 -0
- package/dist/esm/components/mui-icons/index.js +8 -0
- package/dist/esm/components/mui-icons/pin/index.js +53 -0
- package/dist/esm/components/mui-icons/pin-slash/index.js +53 -0
- package/dist/esm/components/mui-icons/rectangle/index.js +55 -0
- package/dist/esm/components/mui-icons/rectangle-bottom-panel/index.js +58 -0
- package/dist/esm/components/mui-icons/rectangle-dashed/index.js +55 -0
- package/dist/esm/components/mui-icons/rectangle-left-drawer/index.js +55 -0
- package/dist/esm/components/mui-icons/rectangle-media-text/index.js +55 -0
- package/dist/esm/components/mui-input/index.js +20 -10
- package/dist/esm/components/mui-link/index.js +44 -44
- package/dist/esm/components/mui-select/index.js +9 -1
- package/dist/esm/components/mui-slat/slat/index.js +6 -6
- package/dist/esm/components/mui-smart-card/index.js +1 -0
- package/dist/esm/components/mui-switch/index.js +19 -19
- package/dist/esm/components/mui-table/cell/index.js +4 -4
- package/dist/esm/components/mui-tabs/item/index.js +9 -9
- package/dist/esm/components/mui-tabs/tab-bar/index.js +17 -16
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +6 -2
- package/dist/esm/custom-elements.json +986 -556
- package/dist/esm/index.js +12 -4
- package/dist/types/agent/prompts/index.d.ts +9 -0
- package/dist/types/components/mui-icons/ai.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +8 -0
- package/dist/types/components/mui-icons/pin-slash.d.ts +1 -0
- package/dist/types/components/mui-icons/pin.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-bottom-panel.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-dashed.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-left-drawer.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-media-text.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle.d.ts +1 -0
- package/dist/types/index.d.ts +8 -0
- package/package.json +29 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class d extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["condensed"];
|
|
4
4
|
}
|
|
@@ -8,41 +8,41 @@ class l extends HTMLElement {
|
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
this.render();
|
|
10
10
|
}
|
|
11
|
-
attributeChangedCallback(
|
|
12
|
-
|
|
11
|
+
attributeChangedCallback(s, a, r) {
|
|
12
|
+
s === "condensed" && this.updateSlottedContent();
|
|
13
13
|
}
|
|
14
14
|
updateSlottedContent() {
|
|
15
15
|
requestAnimationFrame(() => {
|
|
16
16
|
if (!this.shadowRoot) return;
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
const
|
|
20
|
-
this.
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
const t =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
const
|
|
29
|
-
(
|
|
17
|
+
const s = this.shadowRoot.querySelector("slot");
|
|
18
|
+
if (!s) return;
|
|
19
|
+
const a = s.assignedNodes({ flatten: !0 });
|
|
20
|
+
this.removeAttribute("inner-space"), this.removeAttribute("has-card-slat-group"), this.removeAttribute("has-accordion-slat-group");
|
|
21
|
+
let r = !1;
|
|
22
|
+
a.forEach((i) => {
|
|
23
|
+
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
24
|
+
const t = i, n = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
|
|
25
|
+
n instanceof HTMLElement && (n.querySelectorAll("mui-accordion-block").forEach((o) => {
|
|
26
|
+
o.setAttribute("card-slot", "");
|
|
27
|
+
}), r = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((e) => {
|
|
28
|
+
const o = e.getAttribute("variant");
|
|
29
|
+
(o === "action" || o === "row") && (e.setAttribute("card-slot", ""), this.hasAttribute("condensed") ? e.setAttribute("condensed-slot", "") : e.removeAttribute("condensed-slot"));
|
|
30
30
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}),
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
e.setAttribute("usage", "card"), e.closest("mui-accordion-block") ? this.
|
|
31
|
+
const c = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
|
|
32
|
+
c instanceof HTMLElement && (c.querySelectorAll("mui-cell").forEach((o) => {
|
|
33
|
+
o.setAttribute("card-slot", "");
|
|
34
|
+
}), r = !0);
|
|
35
|
+
const l = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
|
|
36
|
+
l.length && (r = !0, l.forEach((e) => {
|
|
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
|
}
|
|
40
|
-
}), !
|
|
40
|
+
}), !r && !this.hasAttribute("condensed") && this.setAttribute("inner-space", "");
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
44
|
if (!this.shadowRoot) return;
|
|
45
|
-
const
|
|
45
|
+
const s = (
|
|
46
46
|
/*html*/
|
|
47
47
|
`
|
|
48
48
|
<style>
|
|
@@ -51,20 +51,20 @@ class l extends HTMLElement {
|
|
|
51
51
|
box-sizing: border-box;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
:host(
|
|
54
|
+
:host([inner-space]) {
|
|
55
55
|
padding: var(--space-500);
|
|
56
56
|
}
|
|
57
57
|
@media (min-width: 768px) {
|
|
58
|
-
:host(
|
|
58
|
+
:host([inner-space]) {
|
|
59
59
|
padding: var(--space-600);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
:host(
|
|
63
|
+
:host([has-card-slat-group]) {
|
|
64
64
|
padding-bottom: var(--space-200);
|
|
65
65
|
}
|
|
66
66
|
@media (min-width: 768px) {
|
|
67
|
-
:host(
|
|
67
|
+
:host([has-card-slat-group]) {
|
|
68
68
|
padding-bottom: var(--space-500);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -73,7 +73,7 @@ class l extends HTMLElement {
|
|
|
73
73
|
<slot></slot>
|
|
74
74
|
`
|
|
75
75
|
);
|
|
76
|
-
this.shadowRoot.innerHTML =
|
|
76
|
+
this.shadowRoot.innerHTML = s, this.updateSlottedContent();
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
customElements.get("mui-card-body") || customElements.define("mui-card-body",
|
|
79
|
+
customElements.get("mui-card-body") || customElements.define("mui-card-body", d);
|
|
@@ -7,7 +7,7 @@ class n extends HTMLElement {
|
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
if (!this.shadowRoot) return;
|
|
10
|
-
let
|
|
10
|
+
let r = (
|
|
11
11
|
/*html*/
|
|
12
12
|
`
|
|
13
13
|
<style>
|
|
@@ -19,24 +19,24 @@ class n extends HTMLElement {
|
|
|
19
19
|
::slotted(*:last-child) {
|
|
20
20
|
margin-bottom: 0;
|
|
21
21
|
}
|
|
22
|
-
::slotted(
|
|
23
|
-
|
|
22
|
+
::slotted([inner-space-top]) {
|
|
23
|
+
padding-top: 0;
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
26
26
|
<slot></slot>
|
|
27
27
|
`
|
|
28
28
|
);
|
|
29
|
-
this.shadowRoot.innerHTML =
|
|
29
|
+
this.shadowRoot.innerHTML = r;
|
|
30
30
|
const t = this.shadowRoot.querySelector("slot");
|
|
31
31
|
t && t.addEventListener("slotchange", () => {
|
|
32
|
-
const a = t.assignedElements(),
|
|
32
|
+
const a = t.assignedElements(), d = a.some((o) => {
|
|
33
33
|
var e;
|
|
34
34
|
return ((e = o.tagName) == null ? void 0 : e.toLowerCase()) === "mui-card-header";
|
|
35
35
|
}), s = a.find((o) => {
|
|
36
36
|
var e;
|
|
37
37
|
return ((e = o.tagName) == null ? void 0 : e.toLowerCase()) === "mui-card-body";
|
|
38
38
|
});
|
|
39
|
-
s && (
|
|
39
|
+
s && (d ? s.setAttribute("inner-space-top", "") : s.removeAttribute("inner-space-top"));
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -14,17 +14,17 @@ class c extends HTMLElement {
|
|
|
14
14
|
box-sizing: border-box;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
:host(
|
|
17
|
+
:host([inner-space]) {
|
|
18
18
|
padding: var(--space-400) var(--space-500);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@media (min-width: 768px) {
|
|
22
|
-
:host(
|
|
22
|
+
:host([inner-space]) {
|
|
23
23
|
padding: var(--space-500) var(--space-600);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
:host(
|
|
27
|
+
:host([hidden]) {
|
|
28
28
|
display: none;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ class c extends HTMLElement {
|
|
|
33
33
|
border-bottom-left-radius: calc(var(--card-radius) - 1px);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
:host(
|
|
36
|
+
:host([has-button-group]) {
|
|
37
37
|
padding-top: 0;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -51,17 +51,17 @@ class c extends HTMLElement {
|
|
|
51
51
|
return e.nodeType === Node.ELEMENT_NODE || e.nodeType === Node.TEXT_NODE && ((o = e.textContent) == null ? void 0 : o.trim()) !== "";
|
|
52
52
|
});
|
|
53
53
|
if (r.length === 0) {
|
|
54
|
-
this.
|
|
54
|
+
this.setAttribute("hidden", "");
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
let
|
|
57
|
+
let i = !1, a = !1;
|
|
58
58
|
r.forEach((e) => {
|
|
59
|
-
var o,
|
|
59
|
+
var o, n;
|
|
60
60
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
61
|
-
const t = e,
|
|
62
|
-
(
|
|
61
|
+
const t = e, d = t.tagName.toLowerCase();
|
|
62
|
+
(d === "mui-code" || (o = t.querySelector) != null && o.call(t, "mui-code")) && (i = !0), (d === "mui-button-group" || (n = t.querySelector) != null && n.call(t, "mui-button-group")) && (a = !0);
|
|
63
63
|
}
|
|
64
|
-
}),
|
|
64
|
+
}), i || this.setAttribute("inner-space", ""), a && this.setAttribute("has-button-group", "");
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,13 +1,68 @@
|
|
|
1
|
-
class
|
|
1
|
+
class a extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
|
-
super(), this.shadow = this.attachShadow({ mode: "open" }), this.handleTabChange = this.handleTabChange.bind(this);
|
|
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
|
+
}
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ["auto-rotate", "rotate-interval"];
|
|
4
7
|
}
|
|
5
8
|
connectedCallback() {
|
|
6
9
|
this.hasAttribute("direction") || this.setAttribute("direction", "horizontal"), this.render(), this.addEventListener("tab-change", this.handleTabChange);
|
|
7
10
|
const t = this.querySelector("tab-bar");
|
|
8
11
|
if (t) {
|
|
9
|
-
const
|
|
10
|
-
|
|
12
|
+
const e = t.querySelector("tab-item[active]");
|
|
13
|
+
if (e)
|
|
14
|
+
this.updatePanels(e.id);
|
|
15
|
+
else {
|
|
16
|
+
const o = t.querySelector("tab-item");
|
|
17
|
+
o && (o.setAttribute("active", ""), this.updatePanels(o.id));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (this.addEventListener("mouseenter", this.boundMouseEnter), this.addEventListener("mouseleave", this.boundMouseLeave), this.addEventListener("focusin", this.boundFocusIn), this.addEventListener("focusout", this.boundFocusOut), this.hasAttribute("auto-rotate")) {
|
|
21
|
+
const e = new IntersectionObserver((o) => {
|
|
22
|
+
o[0].isIntersecting && (e.disconnect(), setTimeout(() => {
|
|
23
|
+
const s = this.shadow.querySelector(".carousel-track");
|
|
24
|
+
s && s.offsetWidth > 0 && this.startAutoRotate();
|
|
25
|
+
}, 300));
|
|
26
|
+
});
|
|
27
|
+
e.observe(this);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
this.stopAutoRotate(), this.removeEventListener("mouseenter", this.boundMouseEnter), this.removeEventListener("mouseleave", this.boundMouseLeave), this.removeEventListener("focusin", this.boundFocusIn), this.removeEventListener("focusout", this.boundFocusOut);
|
|
32
|
+
}
|
|
33
|
+
attributeChangedCallback(t, e, o) {
|
|
34
|
+
e !== o && (t === "auto-rotate" && (o !== null ? this.startAutoRotate() : this.stopAutoRotate()), t === "rotate-interval" && this.hasAttribute("auto-rotate") && (this.stopAutoRotate(), this.startAutoRotate()));
|
|
35
|
+
}
|
|
36
|
+
startAutoRotate() {
|
|
37
|
+
this.stopAutoRotate();
|
|
38
|
+
const t = parseInt(this.getAttribute("rotate-interval") || "10000");
|
|
39
|
+
console.log("🎠 Starting auto-rotate with interval:", t), this.autoRotateInterval = window.setInterval(() => {
|
|
40
|
+
this.rotateNext();
|
|
41
|
+
}, t);
|
|
42
|
+
}
|
|
43
|
+
stopAutoRotate() {
|
|
44
|
+
this.autoRotateInterval && (clearInterval(this.autoRotateInterval), this.autoRotateInterval = void 0);
|
|
45
|
+
}
|
|
46
|
+
pauseAutoRotate() {
|
|
47
|
+
this.stopAutoRotate();
|
|
48
|
+
}
|
|
49
|
+
resumeAutoRotate() {
|
|
50
|
+
this.hasAttribute("auto-rotate") && this.startAutoRotate();
|
|
51
|
+
}
|
|
52
|
+
rotateNext() {
|
|
53
|
+
const t = this.querySelectorAll("mui-carousel-panel");
|
|
54
|
+
if (console.log("🔄 rotateNext called, panels:", t.length, "currentIndex:", this.currentIndex), t.length === 0) return;
|
|
55
|
+
this.currentIndex = (this.currentIndex + 1) % t.length;
|
|
56
|
+
const o = t[this.currentIndex].getAttribute("item");
|
|
57
|
+
if (console.log("➡️ Rotating to index:", this.currentIndex, "itemId:", o), o) {
|
|
58
|
+
this.updatePanels(o);
|
|
59
|
+
const s = this.querySelector("tab-bar");
|
|
60
|
+
if (s) {
|
|
61
|
+
const r = s.querySelector(`tab-item#${o}`);
|
|
62
|
+
r && (s.querySelectorAll("tab-item").forEach((n) => {
|
|
63
|
+
n.removeAttribute("active");
|
|
64
|
+
}), r.setAttribute("active", ""));
|
|
65
|
+
}
|
|
11
66
|
}
|
|
12
67
|
}
|
|
13
68
|
render() {
|
|
@@ -109,12 +164,23 @@ class r extends HTMLElement {
|
|
|
109
164
|
`;
|
|
110
165
|
}
|
|
111
166
|
handleTabChange(t) {
|
|
112
|
-
const
|
|
113
|
-
this.updatePanels(
|
|
167
|
+
const e = t;
|
|
168
|
+
this.updatePanels(e.detail.activeId);
|
|
114
169
|
}
|
|
115
170
|
updatePanels(t) {
|
|
116
|
-
const
|
|
117
|
-
|
|
171
|
+
const e = this.querySelectorAll("mui-carousel-panel"), o = this.shadow.querySelector(".carousel-track");
|
|
172
|
+
if (console.log("🎯 updatePanels called with:", t), !o) {
|
|
173
|
+
console.error("❌ Track element not found!");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const s = Array.from(e).findIndex((n) => n.getAttribute("item") === t);
|
|
177
|
+
if (s === -1) {
|
|
178
|
+
console.warn("⚠️ Panel not found for:", t);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.currentIndex = s;
|
|
182
|
+
const r = `translateX(-${s * 100}%)`;
|
|
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);
|
|
118
184
|
}
|
|
119
185
|
}
|
|
120
|
-
customElements.get("mui-carousel-controller") || customElements.define("mui-carousel-controller",
|
|
186
|
+
customElements.get("mui-carousel-controller") || customElements.define("mui-carousel-controller", a);
|
|
@@ -17,19 +17,19 @@ class d extends HTMLElement {
|
|
|
17
17
|
requestAnimationFrame(() => {
|
|
18
18
|
const t = this.shadowRoot;
|
|
19
19
|
if (!t) return;
|
|
20
|
-
const i = t.querySelector('slot[name="before"]'), e = t.querySelector('slot[name="after"]'), a = (
|
|
21
|
-
var
|
|
22
|
-
return
|
|
23
|
-
}) : !1,
|
|
24
|
-
this.
|
|
20
|
+
const i = t.querySelector('slot[name="before"]'), e = t.querySelector('slot[name="after"]'), a = (s) => s ? s.assignedNodes({ flatten: !0 }).some((r) => {
|
|
21
|
+
var n;
|
|
22
|
+
return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && !!((n = r.textContent) != null && n.trim());
|
|
23
|
+
}) : !1, o = a(i), c = a(e);
|
|
24
|
+
this.toggleAttribute("has-before", o), this.toggleAttribute("has-after", c), this.forceAvatarSize(i), this.forceAvatarSize(e);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
forceAvatarSize(t) {
|
|
28
28
|
if (!t) return;
|
|
29
29
|
t.assignedNodes({ flatten: !0 }).forEach((e) => {
|
|
30
30
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
31
|
-
const a = e,
|
|
32
|
-
|
|
31
|
+
const a = e, o = a.tagName.toLowerCase();
|
|
32
|
+
o === "mui-avatar" ? a.setAttribute("size", "x-small") : o.startsWith("mui-icon-") && a.setAttribute("size", "medium");
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -39,6 +39,11 @@ class d extends HTMLElement {
|
|
|
39
39
|
/*css*/
|
|
40
40
|
`
|
|
41
41
|
:host {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.container {
|
|
42
47
|
display: inline-grid;
|
|
43
48
|
align-items: center;
|
|
44
49
|
height: 4rem;
|
|
@@ -60,29 +65,29 @@ class d extends HTMLElement {
|
|
|
60
65
|
/* Before & After Slot
|
|
61
66
|
========================================= */
|
|
62
67
|
|
|
63
|
-
:host([
|
|
68
|
+
:host([has-after][has-before]) .container {
|
|
64
69
|
grid-template-columns: auto 1fr auto;
|
|
65
70
|
padding-right: var(--space-200);
|
|
66
71
|
padding-left: var(--space-200);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
:host([
|
|
74
|
+
:host([has-after]) .container {
|
|
70
75
|
grid-template-columns: 1fr auto;
|
|
71
76
|
padding-right: var(--space-200);
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
:host([
|
|
79
|
+
:host([has-before]) .container {
|
|
75
80
|
grid-template-columns: auto 1fr;
|
|
76
81
|
padding-left: var(--space-200);
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/* Usage: input */
|
|
80
|
-
:host([usage="input"]) {
|
|
85
|
+
:host([usage="input"]) .container {
|
|
81
86
|
border-radius: var(--input-radius);
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
/* Hover and focus (natural) */
|
|
85
|
-
:host([variant="clickable"]:hover) {
|
|
90
|
+
:host([variant="clickable"]:hover) .container {
|
|
86
91
|
background: var(--chip-background-hover);
|
|
87
92
|
border-color: var(--chip-border-color-hover);
|
|
88
93
|
box-shadow: inset 0 0 0 1px var(--chip-border-color-hover);
|
|
@@ -92,15 +97,15 @@ class d extends HTMLElement {
|
|
|
92
97
|
outline: none;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
:host([variant="clickable"]:focus-visible) {
|
|
100
|
+
:host([variant="clickable"]:focus-visible) .container {
|
|
96
101
|
background: var(--chip-background-focus);
|
|
97
102
|
border-color: var(--chip-border-color-focus);
|
|
98
103
|
outline: var(--outline-thick);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
/* Active: mouse down OR programmatic */
|
|
102
|
-
:host([variant="clickable"]:active),
|
|
103
|
-
:host([variant="clickable"][active]) {
|
|
107
|
+
:host([variant="clickable"]:active) .container,
|
|
108
|
+
:host([variant="clickable"][active]) .container {
|
|
104
109
|
background: var(--chip-background-active);
|
|
105
110
|
box-shadow: inset 0 0 0 1px var(--chip-border-color-active);
|
|
106
111
|
border-color: var(--chip-border-color-active);
|
|
@@ -117,11 +122,11 @@ class d extends HTMLElement {
|
|
|
117
122
|
fill: var(--chip-icon-fill);
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
:host(
|
|
125
|
+
:host([has-before]) ::slotted(.mui-icon) {
|
|
121
126
|
margin-right: -4px;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
:host(
|
|
129
|
+
:host([has-after]) ::slotted(.mui-icon) {
|
|
125
130
|
margin-left: -4px;
|
|
126
131
|
}
|
|
127
132
|
|
|
@@ -130,13 +135,13 @@ class d extends HTMLElement {
|
|
|
130
135
|
/* DISMISS */
|
|
131
136
|
|
|
132
137
|
/* Disable pointer and focus styles when dismiss attribute is present */
|
|
133
|
-
:host([dismiss]) {
|
|
138
|
+
:host([dismiss]) .container {
|
|
134
139
|
grid-template-columns: 1fr auto;
|
|
135
140
|
padding-right: calc(var(--space-100) + 0.1rem);
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
/* Has Before */
|
|
139
|
-
:host([dismiss]
|
|
144
|
+
:host([dismiss][has-before]) .container {
|
|
140
145
|
grid-template-columns: auto 1fr auto;
|
|
141
146
|
padding-left: var(--space-200);
|
|
142
147
|
}
|
|
@@ -157,13 +162,15 @@ class d extends HTMLElement {
|
|
|
157
162
|
this.hasAttribute("dismiss") ? (this.shadowRoot.innerHTML = /*html*/
|
|
158
163
|
`
|
|
159
164
|
<style>${t}</style>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<mui-
|
|
166
|
-
|
|
165
|
+
<span class="container">
|
|
166
|
+
<slot name="before"></slot>
|
|
167
|
+
<mui-body size="small" weight="bold">
|
|
168
|
+
<slot></slot>
|
|
169
|
+
</mui-body>
|
|
170
|
+
<mui-button part="dismiss-btn" variant="tertiary" aria-label="Remove chip">
|
|
171
|
+
<mui-icon-close size="x-small"></mui-icon-close>
|
|
172
|
+
</mui-button>
|
|
173
|
+
</span>
|
|
167
174
|
`, (i = this.shadowRoot.querySelector('[part="dismiss-btn"]')) == null || i.addEventListener("click", (e) => {
|
|
168
175
|
e.stopPropagation(), this.dispatchEvent(
|
|
169
176
|
new CustomEvent("dismiss", {
|
|
@@ -175,11 +182,13 @@ class d extends HTMLElement {
|
|
|
175
182
|
})) : (this.setAttribute("variant", "clickable"), this.shadowRoot.innerHTML = /*html*/
|
|
176
183
|
`
|
|
177
184
|
<style>${t}</style>
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
<span class="container">
|
|
186
|
+
<slot name="before"></slot>
|
|
187
|
+
<mui-body size="small" weight="bold">
|
|
188
|
+
<slot></slot>
|
|
189
|
+
</mui-body>
|
|
190
|
+
<slot name="after"></slot>
|
|
191
|
+
</span>
|
|
183
192
|
`);
|
|
184
193
|
}
|
|
185
194
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = class n extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.button = null, this.menu = null, this.handleResize = () => {
|
|
4
4
|
var t;
|
|
@@ -8,13 +8,13 @@ const s = class s extends HTMLElement {
|
|
|
8
8
|
(t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
|
|
9
9
|
}, this.handleFocusOut = (t) => {
|
|
10
10
|
var e;
|
|
11
|
-
this.persistent || this.contains(t.relatedTarget) || (this.closeWithAnimation(), (e = this.menu) == null || e.setAttribute("inert", "true"),
|
|
11
|
+
this.persistent || this.contains(t.relatedTarget) || (this.closeWithAnimation(), (e = this.menu) == null || e.setAttribute("inert", "true"), n.openDropdown === this && (n.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
12
12
|
}, this.attachShadow({ mode: "open" });
|
|
13
13
|
}
|
|
14
14
|
handleKeyDown(t) {
|
|
15
15
|
if (t.key === "Escape") {
|
|
16
16
|
if (!this.menu) return;
|
|
17
|
-
this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"),
|
|
17
|
+
this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"), n.openDropdown === this && (n.openDropdown = null), this.dispatchEvent(
|
|
18
18
|
new CustomEvent("dropdown-toggle", {
|
|
19
19
|
detail: { open: !1 },
|
|
20
20
|
bubbles: !0
|
|
@@ -28,34 +28,34 @@ const s = class s extends HTMLElement {
|
|
|
28
28
|
get persistent() {
|
|
29
29
|
return this.hasAttribute("persistent");
|
|
30
30
|
}
|
|
31
|
-
attributeChangedCallback(t, e,
|
|
32
|
-
t === "zindex" && this.menu && (this.menu.style.zIndex =
|
|
31
|
+
attributeChangedCallback(t, e, o) {
|
|
32
|
+
t === "zindex" && this.menu && (this.menu.style.zIndex = o ?? "1"), t === "position" && this.menu && this.adjustPosition();
|
|
33
33
|
}
|
|
34
34
|
connectedCallback() {
|
|
35
|
-
var r,
|
|
35
|
+
var r, i, u, c, a;
|
|
36
36
|
this.render(), this.menu = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".dropdown-menu");
|
|
37
37
|
const t = this.getAttribute("zindex") || "1";
|
|
38
|
-
this.menu && (this.menu.style.zIndex = t), this.menu && this.menu.setAttribute("inert", "true"), (
|
|
39
|
-
const e = (
|
|
40
|
-
this.button =
|
|
41
|
-
(
|
|
38
|
+
this.menu && (this.menu.style.zIndex = t), this.menu && this.menu.setAttribute("inert", "true"), (i = this.menu) == null || i.addEventListener("focusout", this.handleFocusOut);
|
|
39
|
+
const e = (u = this.shadowRoot) == null ? void 0 : u.querySelector('slot[name="action"]'), o = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) || [];
|
|
40
|
+
this.button = o.find(
|
|
41
|
+
(l) => l instanceof HTMLElement && l.tagName.toLowerCase() === "mui-button"
|
|
42
42
|
);
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
this.persistent || ((
|
|
53
|
-
}),
|
|
43
|
+
const d = (c = this.shadowRoot) == null ? void 0 : c.querySelector("slot:not([name])");
|
|
44
|
+
if (d) {
|
|
45
|
+
const l = () => {
|
|
46
|
+
const h = d.assignedElements({ flatten: !0 });
|
|
47
|
+
h.forEach((s) => {
|
|
48
|
+
s.removeAttribute("dropdown-slot"), s.removeAttribute("dropdown-slot-first"), s.removeAttribute("dropdown-slot-last");
|
|
49
|
+
}), h.forEach((s, w) => {
|
|
50
|
+
s.setAttribute("variant", "tertiary"), s.setAttribute("dropdown-slot", ""), w === 0 && s.setAttribute("dropdown-slot-first", ""), w === h.length - 1 && s.setAttribute("dropdown-slot-last", ""), s._dropdownListenerAdded || (s.addEventListener("click", () => {
|
|
51
|
+
var p, m;
|
|
52
|
+
this.persistent || ((p = this.menu) == null || p.classList.remove("show"), (m = this.menu) == null || m.setAttribute("inert", "true"), n.openDropdown === this && (n.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
53
|
+
}), s._dropdownListenerAdded = !0);
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
d.addEventListener("slotchange", l), l();
|
|
57
57
|
}
|
|
58
|
-
this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this), (
|
|
58
|
+
this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this), (a = this.button) == null || a.addEventListener("click", this.toggleMenu), document.addEventListener("click", this.closeMenu), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("resize", this.handleResize), window.addEventListener("scroll", this.handleScroll, !0);
|
|
59
59
|
}
|
|
60
60
|
disconnectedCallback() {
|
|
61
61
|
var t, e;
|
|
@@ -68,41 +68,41 @@ const s = class s extends HTMLElement {
|
|
|
68
68
|
}, 150);
|
|
69
69
|
}
|
|
70
70
|
toggleMenu(t) {
|
|
71
|
-
var
|
|
71
|
+
var o;
|
|
72
72
|
if (t.stopPropagation(), !this.menu) return;
|
|
73
73
|
const e = this.menu.classList.contains("show");
|
|
74
|
-
!e &&
|
|
75
|
-
var
|
|
76
|
-
(
|
|
77
|
-
}),
|
|
74
|
+
!e && n.openDropdown && n.openDropdown !== this && n.openDropdown.closeWithAnimation(), e ? (this.closeWithAnimation(), (o = this.menu) == null || o.setAttribute("inert", "true"), n.openDropdown === this && (n.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }))) : (this.menu.style.display = "block", requestAnimationFrame(() => {
|
|
75
|
+
var d, r;
|
|
76
|
+
(d = this.menu) == null || d.classList.add("show"), (r = this.menu) == null || r.removeAttribute("inert"), this.adjustPosition();
|
|
77
|
+
}), n.openDropdown = this, this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !0 }, bubbles: !0 })));
|
|
78
78
|
}
|
|
79
79
|
closeMenu(t) {
|
|
80
|
-
var
|
|
80
|
+
var o;
|
|
81
81
|
const e = t.composedPath();
|
|
82
|
-
this.menu && e.includes(this.menu) || this.button && e.includes(this.button) || (this.closeWithAnimation(), (
|
|
82
|
+
this.menu && e.includes(this.menu) || this.button && e.includes(this.button) || (this.closeWithAnimation(), (o = this.menu) == null || o.setAttribute("inert", "true"), n.openDropdown === this && (n.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
83
83
|
}
|
|
84
84
|
adjustPosition() {
|
|
85
85
|
if (!this.menu) return;
|
|
86
|
-
const t = this.menu, e = 8,
|
|
86
|
+
const t = this.menu, e = 8, o = getComputedStyle(this).getPropertyValue("--dropdown-offset").trim() || "0.8rem", d = parseFloat(getComputedStyle(document.documentElement).fontSize) || 10, r = o.endsWith("rem") ? parseFloat(o) * d : parseFloat(o) || 8;
|
|
87
87
|
t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.maxWidth = "";
|
|
88
|
-
const
|
|
89
|
-
let h =
|
|
90
|
-
|
|
91
|
-
let
|
|
88
|
+
const i = this.getBoundingClientRect(), u = t.offsetWidth, c = t.offsetHeight, a = window.innerWidth, l = window.innerHeight;
|
|
89
|
+
let h = i.height + r;
|
|
90
|
+
l - i.bottom < c + r && i.top > l - i.bottom && (h = -(c + r));
|
|
91
|
+
let s = 0;
|
|
92
92
|
switch (this.getAttribute("position") || "left") {
|
|
93
93
|
case "left":
|
|
94
|
-
|
|
94
|
+
s = 0;
|
|
95
95
|
break;
|
|
96
96
|
case "center":
|
|
97
|
-
|
|
97
|
+
s = (i.width - u) / 2;
|
|
98
98
|
break;
|
|
99
99
|
case "right":
|
|
100
100
|
default:
|
|
101
|
-
|
|
101
|
+
s = i.width - u;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
104
|
+
const p = e - i.left, m = a - e - (i.left + u);
|
|
105
|
+
s = Math.max(p, Math.min(s, m)), u > a - e * 2 && (t.style.maxWidth = `${a - e * 2}px`), t.style.top = `${h}px`, t.style.left = `${s}px`;
|
|
106
106
|
}
|
|
107
107
|
render() {
|
|
108
108
|
this.shadowRoot.innerHTML = /*html*/
|
|
@@ -119,9 +119,10 @@ const s = class s extends HTMLElement {
|
|
|
119
119
|
transform: translateY(-0.25rem);
|
|
120
120
|
transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
|
|
121
121
|
/* End */
|
|
122
|
-
min-width:
|
|
122
|
+
min-width: var(--dropdown-min-width, 15rem);
|
|
123
123
|
position: absolute;
|
|
124
124
|
z-index: 1;
|
|
125
|
+
box-sizing: border-box;
|
|
125
126
|
border: var(--border-thin);
|
|
126
127
|
/* Unique Styles */
|
|
127
128
|
background: var(--dropdown-background);
|
|
@@ -167,6 +168,6 @@ const s = class s extends HTMLElement {
|
|
|
167
168
|
`;
|
|
168
169
|
}
|
|
169
170
|
};
|
|
170
|
-
|
|
171
|
-
let
|
|
172
|
-
customElements.get("mui-dropdown") || customElements.define("mui-dropdown",
|
|
171
|
+
n.openDropdown = null;
|
|
172
|
+
let f = n;
|
|
173
|
+
customElements.get("mui-dropdown") || customElements.define("mui-dropdown", f);
|