@muibook/components 9.1.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/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-button/index.js +41 -42
- 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-link/index.js +44 -44
- package/dist/esm/components/mui-slat/slat/index.js +6 -6
- 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 +4 -0
- package/dist/esm/custom-elements.json +705 -275
- package/dist/esm/index.js +12 -4
- 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
|
@@ -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);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class l extends HTMLElement {
|
|
2
|
+
static get observedAttributes() {
|
|
3
|
+
return ["size", "color"];
|
|
4
|
+
}
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.attachShadow({ mode: "open" });
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(e, t, c) {
|
|
12
|
+
(e === "size" || e === "color") && t !== c && this.render();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const e = this.getAttribute("size") || "small", t = this.getAttribute("color"), s = t && {
|
|
16
|
+
default: "var(--icon-color-default)",
|
|
17
|
+
inverted: "var(--icon-color-inverted)"
|
|
18
|
+
}[t] || t || "var(--icon-color-default)", i = {
|
|
19
|
+
"x-small": "1.6rem",
|
|
20
|
+
small: "2.1rem",
|
|
21
|
+
medium: "2.4rem",
|
|
22
|
+
large: "2.8rem"
|
|
23
|
+
}, o = i[e] ?? i.small;
|
|
24
|
+
this.classList.add("mui-icon"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
25
|
+
`
|
|
26
|
+
<style>
|
|
27
|
+
:host {
|
|
28
|
+
width: ${o};
|
|
29
|
+
height: ${o};
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
fill: ${s};
|
|
34
|
+
}
|
|
35
|
+
svg {
|
|
36
|
+
width: 100%;
|
|
37
|
+
display: block;
|
|
38
|
+
fill: inherit;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
41
|
+
|
|
42
|
+
<svg
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
viewBox="0 0 36 36"
|
|
45
|
+
>
|
|
46
|
+
<path
|
|
47
|
+
d="M27.122 16.88a.643.643 0 0 1-.638-.566c-.651-4.316-1.154-5.034-5.44-5.6a.664.664 0 0 1-.6-.667c0-.327.245-.604.6-.642 4.163-.553 4.728-1.245 5.44-5.6.049-.34.307-.59.638-.59.32 0 .577.238.626.59.614 4.317 1.203 5.022 5.451 5.6.344.038.59.315.59.642 0 .34-.246.617-.59.667-4.137.692-4.714 1.22-5.45 5.6-.062.327-.308.566-.627.566m-24.324-.403c-1.117 0-1.903-.805-1.903-1.963v-1.573c0-2.995 1.67-4.693 4.592-4.693H19.08c-.43.44-.736 1.07-.736 1.8 0 .88.417 1.648 1.019 2.1H6.003c-.86 0-1.302.403-1.302 1.347v1.02c0 1.157-.786 1.962-1.903 1.962m29.826 2.857a.457.457 0 0 1-.455-.415c-.331-2.14-.282-2.152-2.529-2.567a.48.48 0 0 1-.393-.466c0-.24.16-.44.393-.478 2.235-.327 2.21-.365 2.53-2.542.024-.252.208-.44.454-.44.245 0 .417.176.454.44.307 2.101.282 2.127 2.517 2.542.245.05.405.239.405.478 0 .252-.16.415-.442.466-2.185.352-2.16.402-2.48 2.541-.037.252-.209.44-.454.44M8.408 26.032c-1.044 0-1.646-.604-1.646-1.623 0-.265.074-.642.234-1.158l2.185-6.62c.479-1.522 1.338-2.214 2.701-2.214 1.412 0 2.308.705 2.775 2.215l2.198 6.619c.16.516.22.893.22 1.157 0 1.02-.601 1.624-1.632 1.624-.884 0-1.437-.503-1.658-1.56l-.307-1.032h-3.106l-.307 1.031c-.233 1.058-.773 1.56-1.657 1.56m2.541-5.071h1.94l-.909-3.524h-.122zm-8.151 1.783c-1.252 0-2.284-1.057-2.284-2.34 0-1.284 1.032-2.341 2.284-2.341s2.283 1.057 2.283 2.34c0 1.284-1.03 2.341-2.283 2.341m2.689 10.042c-2.922 0-4.592-1.7-4.592-4.694V26.33c0-1.157.786-1.963 1.903-1.963S4.7 25.173 4.7 26.33v1.22c0 .945.442 1.347 1.301 1.347h17.903c.86 0 1.302-.402 1.302-1.346v-7.588c0-.512.153-.955.421-1.29 0 0 .23.522 1.482.522 1.251 0 1.481-.522 1.481-.522.268.335.422.778.422 1.29v8.129c0 2.995-1.658 4.694-4.592 4.694z"
|
|
48
|
+
></path>
|
|
49
|
+
<path
|
|
50
|
+
d="M19.194 16.084c0-.92.728-1.667 1.626-1.667.899 0 1.627.747 1.627 1.667l.011 8.28c0 .921-.728 1.668-1.626 1.668-.899 0-1.627-.747-1.627-1.667z"
|
|
51
|
+
></path>
|
|
52
|
+
</svg>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
customElements.get("mui-icon-ai") || customElements.define("mui-icon-ai", l);
|
|
@@ -34,3 +34,11 @@ import "./music-microphone/index.js";
|
|
|
34
34
|
import "./music-quarter-note/index.js";
|
|
35
35
|
import "./play-rectangle/index.js";
|
|
36
36
|
import "./list-and-film/index.js";
|
|
37
|
+
import "./ai/index.js";
|
|
38
|
+
import "./rectangle/index.js";
|
|
39
|
+
import "./rectangle-media-text/index.js";
|
|
40
|
+
import "./rectangle-dashed/index.js";
|
|
41
|
+
import "./rectangle-left-drawer/index.js";
|
|
42
|
+
import "./rectangle-bottom-panel/index.js";
|
|
43
|
+
import "./pin/index.js";
|
|
44
|
+
import "./pin-slash/index.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
class c extends HTMLElement {
|
|
2
|
+
static get observedAttributes() {
|
|
3
|
+
return ["size", "color"];
|
|
4
|
+
}
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.attachShadow({ mode: "open" });
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
attributeChangedCallback(e, t, i) {
|
|
12
|
+
(e === "size" || e === "color") && t !== i && this.render();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const e = this.getAttribute("size") || "small", t = this.getAttribute("color"), l = t && {
|
|
16
|
+
default: "var(--icon-color-default)",
|
|
17
|
+
inverted: "var(--icon-color-inverted)"
|
|
18
|
+
}[t] || t || "var(--icon-color-default)", o = {
|
|
19
|
+
"x-small": "1.6rem",
|
|
20
|
+
small: "2.1rem",
|
|
21
|
+
medium: "2.4rem",
|
|
22
|
+
large: "2.8rem"
|
|
23
|
+
}, s = o[e] ?? o.small;
|
|
24
|
+
this.classList.add("mui-icon"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
25
|
+
`
|
|
26
|
+
<style>
|
|
27
|
+
:host {
|
|
28
|
+
width: ${s};
|
|
29
|
+
height: ${s};
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
fill: ${l};
|
|
34
|
+
}
|
|
35
|
+
svg {
|
|
36
|
+
width: 100%;
|
|
37
|
+
display: block;
|
|
38
|
+
fill: inherit;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
41
|
+
|
|
42
|
+
<svg
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
viewBox="0 0 36 36"
|
|
45
|
+
>
|
|
46
|
+
<path d="M9.321 22.308c0-2.378 1.847-4.642 4.84-5.8l.334-5.027c-1.669-.939-2.837-1.899-3.359-2.556-.323-.407-.5-.855-.5-1.272 0-.856.667-1.482 1.596-1.482h11.536c.929 0 1.596.626 1.596 1.482 0 .417-.177.865-.5 1.272-.522.657-1.69 1.617-3.36 2.556l.335 5.028c2.993 1.157 4.84 3.42 4.84 5.8 0 1.126-.772 1.887-1.93 1.887h-5.372v5.1c0 1.075-1.001 3.047-1.377 3.047-.375 0-1.377-1.972-1.377-3.046v-5.1h-5.372c-1.158 0-1.93-.762-1.93-1.889"></path>
|
|
47
|
+
</svg>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
customElements.get("mui-icon-pin") || customElements.define("mui-icon-pin", c);
|