@muibook/components 19.6.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/esm/agent/keywords/index.js +32 -1
- package/dist/esm/agent/prompts/index.js +10 -8
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +4 -1
- package/dist/esm/components/mui-badge/index.js +35 -18
- package/dist/esm/components/mui-button/index.js +187 -52
- package/dist/esm/components/mui-card/body/index.js +1 -1
- package/dist/esm/components/mui-chip/index.js +56 -26
- package/dist/esm/components/mui-chip-rail/index.js +239 -0
- package/dist/esm/components/mui-code/index.js +5 -5
- package/dist/esm/components/mui-dropdown/index.js +55 -46
- package/dist/esm/components/mui-file-upload/index.js +1 -0
- package/dist/esm/components/mui-heading/index.js +3 -2
- package/dist/esm/components/mui-input/index.js +21 -17
- package/dist/esm/components/mui-link/index.js +199 -55
- package/dist/esm/components/mui-message/index.js +7 -6
- package/dist/esm/components/mui-prompt/index.js +102 -102
- package/dist/esm/components/mui-select/index.js +4 -4
- package/dist/esm/components/mui-stack/hstack/index.js +10 -5
- package/dist/esm/components/mui-status/index.js +239 -0
- package/dist/esm/components/mui-stepper/step/index.js +46 -32
- package/dist/esm/components/mui-switch/index.js +21 -13
- package/dist/esm/components/mui-tabs/controller/index.js +17 -6
- package/dist/esm/components/mui-tabs/item/index.js +17 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
- package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +267 -77
- package/dist/esm/custom-elements.json +2212 -1538
- package/dist/esm/dynamic-attrs.json +26 -6
- package/dist/esm/index.js +7 -4
- package/dist/types/components/mui-button/api.d.ts +4 -0
- package/dist/types/components/mui-chip/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
- package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +3 -0
- package/dist/types/components/mui-link/api.d.ts +4 -0
- package/dist/types/components/mui-status/api.d.ts +24 -0
- package/dist/types/components/mui-status/doc.d.ts +2 -0
- package/dist/types/components/mui-status/index.d.ts +1 -0
- package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
- package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
- package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +13 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import "../mui-button/index.js";
|
|
2
|
+
import "../mui-icons/left-chevron/index.js";
|
|
3
|
+
import "../mui-icons/right-chevron/index.js";
|
|
4
|
+
class n extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.scrollEl = null, this.slotEl = null, this.resizeObserver = null, this.mutationObserver = null, this.onScroll = () => this.syncEdges(), this.onSlotChange = () => this.syncSlottedItems(), this.onPreviousClick = () => this.scrollByPage(-1), this.onNextClick = () => this.scrollByPage(1), this.attachShadow({ mode: "open" });
|
|
7
|
+
}
|
|
8
|
+
static get observedAttributes() {
|
|
9
|
+
return ["size", "bleed", "bleed-inline-size", "bleed-block-size", "aria-label"];
|
|
10
|
+
}
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
this.hasAttribute("size") || this.setAttribute("size", "medium"), this.render(), this.syncBleed(), this.bindEvents(), this.syncSlottedItems();
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
this.unbindEvents();
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(e, i, t) {
|
|
18
|
+
if (i !== t && this.shadowRoot) {
|
|
19
|
+
if (e === "size") {
|
|
20
|
+
this.syncActionSizes(), this.syncSlottedItems();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (e === "bleed" || e === "bleed-inline-size" || e === "bleed-block-size") {
|
|
24
|
+
this.syncBleed();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
e === "aria-label" && this.scrollEl && this.scrollEl.setAttribute("aria-label", t || "Chip rail");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const e = this.normalizeSize(this.getAttribute("size")), i = this.getAttribute("aria-label") || "Chip rail", t = this.getIconSize(e);
|
|
32
|
+
this.shadowRoot.innerHTML = /*html*/
|
|
33
|
+
`
|
|
34
|
+
<style>
|
|
35
|
+
:host {
|
|
36
|
+
display: block;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
width: 100%;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
max-width: 100%;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
contain: inline-size;
|
|
43
|
+
padding-block: var(--chip-rail-bleed-block-size);
|
|
44
|
+
padding-inline: var(--chip-rail-bleed-inline-size);
|
|
45
|
+
--chip-rail-background: var(--surface-elevated-100);
|
|
46
|
+
--chip-rail-bleed-inline-size: 0px;
|
|
47
|
+
--chip-rail-bleed-block-size: 0px;
|
|
48
|
+
--chip-rail-gap: var(--space-200);
|
|
49
|
+
--chip-rail-edge-size: calc(var(--action-icon-only-size-medium) + var(--space-700));
|
|
50
|
+
--chip-rail-edge-solid: 54%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([size="x-small"]) {
|
|
54
|
+
--chip-rail-gap: var(--space-100);
|
|
55
|
+
--chip-rail-edge-size: calc(var(--action-icon-only-size-x-small) + var(--space-500));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([size="small"]) {
|
|
59
|
+
--chip-rail-gap: var(--space-100);
|
|
60
|
+
--chip-rail-edge-size: calc(var(--action-icon-only-size-small) + var(--space-600));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([size="large"]) {
|
|
64
|
+
--chip-rail-gap: var(--space-300);
|
|
65
|
+
--chip-rail-edge-size: calc(var(--action-icon-only-size-large) + var(--space-800));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rail {
|
|
69
|
+
position: relative;
|
|
70
|
+
width: 100%;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.scroll {
|
|
76
|
+
width: 100%;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
max-width: 100%;
|
|
79
|
+
overflow-x: auto;
|
|
80
|
+
overflow-y: hidden;
|
|
81
|
+
scrollbar-width: none;
|
|
82
|
+
scroll-behavior: smooth;
|
|
83
|
+
overscroll-behavior-inline: contain;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.scroll::-webkit-scrollbar {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
slot {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
width: max-content;
|
|
94
|
+
min-width: max-content;
|
|
95
|
+
gap: var(--chip-rail-gap);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::slotted(*) {
|
|
99
|
+
flex: 0 0 auto;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.edge {
|
|
103
|
+
position: absolute;
|
|
104
|
+
top: calc(-1 * var(--chip-rail-bleed-block-size));
|
|
105
|
+
bottom: calc(-1 * var(--chip-rail-bleed-block-size));
|
|
106
|
+
z-index: 2;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
width: calc(var(--chip-rail-edge-size) + var(--chip-rail-bleed-inline-size));
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
opacity: 1;
|
|
112
|
+
transition: opacity var(--speed-200) ease;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.edge[hidden] {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.edge mui-button {
|
|
120
|
+
pointer-events: auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.edge-start {
|
|
124
|
+
left: calc(-1 * var(--chip-rail-bleed-inline-size));
|
|
125
|
+
justify-content: flex-start;
|
|
126
|
+
padding-inline-start: var(--chip-rail-bleed-inline-size);
|
|
127
|
+
background:
|
|
128
|
+
linear-gradient(
|
|
129
|
+
90deg,
|
|
130
|
+
var(--chip-rail-background) 0%,
|
|
131
|
+
var(--chip-rail-background) var(--chip-rail-edge-solid),
|
|
132
|
+
color-mix(in srgb, var(--chip-rail-background) 68%, transparent) 78%,
|
|
133
|
+
transparent 100%
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.edge-end {
|
|
138
|
+
right: calc(-1 * var(--chip-rail-bleed-inline-size));
|
|
139
|
+
justify-content: flex-end;
|
|
140
|
+
padding-inline-end: var(--chip-rail-bleed-inline-size);
|
|
141
|
+
background:
|
|
142
|
+
linear-gradient(
|
|
143
|
+
270deg,
|
|
144
|
+
var(--chip-rail-background) 0%,
|
|
145
|
+
var(--chip-rail-background) var(--chip-rail-edge-solid),
|
|
146
|
+
color-mix(in srgb, var(--chip-rail-background) 68%, transparent) 78%,
|
|
147
|
+
transparent 100%
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
151
|
+
|
|
152
|
+
<div class="rail">
|
|
153
|
+
<div class="scroll" role="group" aria-label="${this.escapeAttribute(i)}">
|
|
154
|
+
<slot></slot>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="edge edge-start" hidden>
|
|
157
|
+
<mui-button class="rail-action rail-action-start" variant="tertiary" size="${e}" icon-only aria-label="Previous items">
|
|
158
|
+
<mui-icon-left-chevron class="mui-icon" size="${t}"></mui-icon-left-chevron>
|
|
159
|
+
</mui-button>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="edge edge-end" hidden>
|
|
162
|
+
<mui-button class="rail-action rail-action-end" variant="tertiary" size="${e}" icon-only aria-label="Next items">
|
|
163
|
+
<mui-icon-right-chevron class="mui-icon" size="${t}"></mui-icon-right-chevron>
|
|
164
|
+
</mui-button>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
`, this.scrollEl = this.shadowRoot.querySelector(".scroll"), this.slotEl = this.shadowRoot.querySelector("slot");
|
|
168
|
+
}
|
|
169
|
+
bindEvents() {
|
|
170
|
+
var t, s, l, r;
|
|
171
|
+
this.unbindEvents(), (t = this.scrollEl) == null || t.addEventListener("scroll", this.onScroll, { passive: !0 }), (s = this.slotEl) == null || s.addEventListener("slotchange", this.onSlotChange);
|
|
172
|
+
const e = (l = this.shadowRoot) == null ? void 0 : l.querySelector(".rail-action-start"), i = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".rail-action-end");
|
|
173
|
+
e == null || e.addEventListener("click", this.onPreviousClick), i == null || i.addEventListener("click", this.onNextClick), typeof ResizeObserver < "u" && this.scrollEl && (this.resizeObserver = new ResizeObserver(() => this.syncEdges()), this.resizeObserver.observe(this.scrollEl)), typeof MutationObserver < "u" && (this.mutationObserver = new MutationObserver(() => this.syncSlottedItems()), this.mutationObserver.observe(this, {
|
|
174
|
+
childList: !0,
|
|
175
|
+
subtree: !0,
|
|
176
|
+
attributes: !0,
|
|
177
|
+
attributeFilter: ["hidden", "size"]
|
|
178
|
+
})), requestAnimationFrame(() => this.syncEdges());
|
|
179
|
+
}
|
|
180
|
+
unbindEvents() {
|
|
181
|
+
var e, i, t, s, l, r, a, o;
|
|
182
|
+
(e = this.scrollEl) == null || e.removeEventListener("scroll", this.onScroll), (i = this.slotEl) == null || i.removeEventListener("slotchange", this.onSlotChange), (s = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".rail-action-start")) == null || s.removeEventListener("click", this.onPreviousClick), (r = (l = this.shadowRoot) == null ? void 0 : l.querySelector(".rail-action-end")) == null || r.removeEventListener("click", this.onNextClick), (a = this.resizeObserver) == null || a.disconnect(), (o = this.mutationObserver) == null || o.disconnect(), this.resizeObserver = null, this.mutationObserver = null;
|
|
183
|
+
}
|
|
184
|
+
syncSlottedItems() {
|
|
185
|
+
var t;
|
|
186
|
+
const e = this.normalizeSize(this.getAttribute("size")), i = (t = this.slotEl) == null ? void 0 : t.assignedElements({ flatten: !0 });
|
|
187
|
+
i == null || i.forEach((s) => {
|
|
188
|
+
s.tagName.toLowerCase() === "mui-chip" && s.getAttribute("size") !== e && s.setAttribute("size", e);
|
|
189
|
+
}), requestAnimationFrame(() => this.syncEdges());
|
|
190
|
+
}
|
|
191
|
+
syncActionSizes() {
|
|
192
|
+
var t, s;
|
|
193
|
+
const e = this.normalizeSize(this.getAttribute("size")), i = this.getIconSize(e);
|
|
194
|
+
(t = this.shadowRoot) == null || t.querySelectorAll("mui-button.rail-action").forEach((l) => {
|
|
195
|
+
l.setAttribute("size", e);
|
|
196
|
+
}), (s = this.shadowRoot) == null || s.querySelectorAll(".rail-action .mui-icon").forEach((l) => {
|
|
197
|
+
l.setAttribute("size", i);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
syncEdges() {
|
|
201
|
+
var r, a;
|
|
202
|
+
if (!this.scrollEl || !this.shadowRoot) return;
|
|
203
|
+
const e = Math.max(0, this.scrollEl.scrollWidth - this.scrollEl.clientWidth), i = this.scrollEl.scrollLeft, t = e > 1, s = t && i > 1, l = t && i < e - 1;
|
|
204
|
+
(r = this.shadowRoot.querySelector(".edge-start")) == null || r.toggleAttribute("hidden", !s), (a = this.shadowRoot.querySelector(".edge-end")) == null || a.toggleAttribute("hidden", !l);
|
|
205
|
+
}
|
|
206
|
+
syncBleed() {
|
|
207
|
+
this.style.setProperty("--chip-rail-bleed-inline-size", this.getBleedInlineValue()), this.style.setProperty("--chip-rail-bleed-block-size", this.getBleedBlockValue());
|
|
208
|
+
}
|
|
209
|
+
scrollByPage(e) {
|
|
210
|
+
if (!this.scrollEl) return;
|
|
211
|
+
const i = Math.max(this.scrollEl.clientWidth * 0.72, 120);
|
|
212
|
+
this.scrollEl.scrollBy({ left: i * e, behavior: "smooth" });
|
|
213
|
+
}
|
|
214
|
+
getBleedInlineValue() {
|
|
215
|
+
return this.normalizeBleedValue(this.getAttribute("bleed-inline-size") || this.getAttribute("bleed"));
|
|
216
|
+
}
|
|
217
|
+
getBleedBlockValue() {
|
|
218
|
+
return this.normalizeBleedValue(this.getAttribute("bleed-block-size"));
|
|
219
|
+
}
|
|
220
|
+
normalizeBleedValue(e) {
|
|
221
|
+
const i = (e || "0").trim(), t = /* @__PURE__ */ new Set(["000", "025", "050", "100", "200", "300", "400", "500", "600", "700", "800"]);
|
|
222
|
+
return !i || i === "0" || i === "none" || i === "false" ? "0px" : t.has(i) ? `var(--space-${i})` : i;
|
|
223
|
+
}
|
|
224
|
+
normalizeSize(e) {
|
|
225
|
+
return e && (/* @__PURE__ */ new Set(["x-small", "small", "medium", "large"])).has(e) ? e : "medium";
|
|
226
|
+
}
|
|
227
|
+
getIconSize(e) {
|
|
228
|
+
return {
|
|
229
|
+
"x-small": "x-small",
|
|
230
|
+
small: "x-small",
|
|
231
|
+
medium: "medium",
|
|
232
|
+
large: "large"
|
|
233
|
+
}[e] || "medium";
|
|
234
|
+
}
|
|
235
|
+
escapeAttribute(e) {
|
|
236
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
customElements.get("mui-chip-rail") || customElements.define("mui-chip-rail", n);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class i extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["size", "scrollable", "wrap"];
|
|
4
4
|
}
|
|
@@ -13,7 +13,7 @@ class s extends HTMLElement {
|
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
15
|
if (!this.shadowRoot) return;
|
|
16
|
-
const t = this.hasAttribute("scrollable"), e = this.hasAttribute("wrap"),
|
|
16
|
+
const t = this.hasAttribute("scrollable"), e = this.hasAttribute("wrap"), o = (
|
|
17
17
|
/*css*/
|
|
18
18
|
`
|
|
19
19
|
:host {
|
|
@@ -39,7 +39,7 @@ class s extends HTMLElement {
|
|
|
39
39
|
display: block;
|
|
40
40
|
border-radius: inherit;
|
|
41
41
|
font-family: monospace;
|
|
42
|
-
color: var(--text-color);
|
|
42
|
+
color: var(--code-text-color, var(--text-color));
|
|
43
43
|
background: var(--code-background);
|
|
44
44
|
padding: var(--space-400) var(--space-500);
|
|
45
45
|
box-sizing: border-box;
|
|
@@ -65,9 +65,9 @@ class s extends HTMLElement {
|
|
|
65
65
|
);
|
|
66
66
|
this.shadowRoot.innerHTML = /*html*/
|
|
67
67
|
`
|
|
68
|
-
<style>${
|
|
68
|
+
<style>${o}</style>
|
|
69
69
|
<code><slot></slot></code>
|
|
70
70
|
`;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
customElements.get("mui-code") || customElements.define("mui-code",
|
|
73
|
+
customElements.get("mui-code") || customElements.define("mui-code", i);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = class i extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.button = null, this.menu = null, this.handleResize = () => {
|
|
4
4
|
var t;
|
|
@@ -7,14 +7,17 @@ const s = class s extends HTMLElement {
|
|
|
7
7
|
var t;
|
|
8
8
|
(t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
|
|
9
9
|
}, this.handleFocusOut = (t) => {
|
|
10
|
-
var e;
|
|
11
|
-
this.persistent || this.contains(t.relatedTarget) || (this.closeWithAnimation(), (e = this.menu) == null || e.setAttribute("inert", "true"),
|
|
10
|
+
var e, n;
|
|
11
|
+
this.persistent || this.contains(t.relatedTarget) || (this.closeWithAnimation(), (e = this.menu) == null || e.setAttribute("inert", "true"), i.openDropdown === this && (i.openDropdown = null), (n = this.button) == null || n.setAttribute("aria-expanded", "false"), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
12
|
+
}, this.handleActionKeyDown = (t) => {
|
|
13
|
+
t.key !== "Enter" && t.key !== " " || (t.preventDefault(), this.toggleMenu(t));
|
|
12
14
|
}, this.attachShadow({ mode: "open" });
|
|
13
15
|
}
|
|
14
16
|
handleKeyDown(t) {
|
|
17
|
+
var e;
|
|
15
18
|
if (t.key === "Escape") {
|
|
16
19
|
if (!this.menu) return;
|
|
17
|
-
this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"),
|
|
20
|
+
this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"), i.openDropdown === this && (i.openDropdown = null), (e = this.button) == null || e.setAttribute("aria-expanded", "false"), this.dispatchEvent(
|
|
18
21
|
new CustomEvent("dropdown-toggle", {
|
|
19
22
|
detail: { open: !1 },
|
|
20
23
|
bubbles: !0
|
|
@@ -32,77 +35,83 @@ const s = class s extends HTMLElement {
|
|
|
32
35
|
t === "zindex" && this.menu && (this.menu.style.zIndex = n ?? "1"), (t === "position" || t === "vertical-position") && this.menu && this.adjustPosition();
|
|
33
36
|
}
|
|
34
37
|
connectedCallback() {
|
|
35
|
-
var
|
|
36
|
-
this.render(), this.menu = (
|
|
38
|
+
var r, o, c, p;
|
|
39
|
+
this.render(), this.menu = (r = this.shadowRoot) == null ? void 0 : r.querySelector(".dropdown-menu");
|
|
37
40
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
o.hasAttribute("variant") || o.setAttribute("variant", "tertiary"), o.setAttribute("dropdown-slot", ""), w === 0 && o.setAttribute("dropdown-slot-first", ""), w === c.length - 1 && o.setAttribute("dropdown-slot-last", ""), o._dropdownListenerAdded || (o.addEventListener("click", () => {
|
|
51
|
-
var p, f;
|
|
52
|
-
this.persistent || ((p = this.menu) == null || p.classList.remove("show"), (f = this.menu) == null || f.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
53
|
-
}), o._dropdownListenerAdded = !0);
|
|
41
|
+
this.menu && (this.menu.style.zIndex = t), this.menu && this.menu.setAttribute("inert", "true"), (o = this.menu) == null || o.addEventListener("focusout", this.handleFocusOut);
|
|
42
|
+
const e = (c = this.shadowRoot) == null ? void 0 : c.querySelector("slot:not([name])");
|
|
43
|
+
if (e) {
|
|
44
|
+
const d = () => {
|
|
45
|
+
const m = e.assignedElements({ flatten: !0 }).filter((s) => s.tagName.toLowerCase() === "mui-button");
|
|
46
|
+
m.forEach((s) => {
|
|
47
|
+
s.removeAttribute("dropdown-slot"), s.removeAttribute("dropdown-slot-first"), s.removeAttribute("dropdown-slot-last");
|
|
48
|
+
}), m.forEach((s, a) => {
|
|
49
|
+
s.hasAttribute("variant") || s.setAttribute("variant", "tertiary"), s.setAttribute("dropdown-slot", ""), a === 0 && s.setAttribute("dropdown-slot-first", ""), a === m.length - 1 && s.setAttribute("dropdown-slot-last", ""), s._dropdownListenerAdded || (s.addEventListener("click", () => {
|
|
50
|
+
var u, l;
|
|
51
|
+
this.persistent || ((u = this.menu) == null || u.classList.remove("show"), (l = this.menu) == null || l.setAttribute("inert", "true"), i.openDropdown === this && (i.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
52
|
+
}), s._dropdownListenerAdded = !0);
|
|
54
53
|
});
|
|
55
54
|
};
|
|
56
|
-
|
|
55
|
+
e.addEventListener("slotchange", d), d();
|
|
57
56
|
}
|
|
58
|
-
this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this)
|
|
57
|
+
this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
58
|
+
const n = (p = this.shadowRoot) == null ? void 0 : p.querySelector('slot[name="action"]'), h = () => {
|
|
59
|
+
var s, a, u;
|
|
60
|
+
(s = this.button) == null || s.removeEventListener("click", this.toggleMenu), (a = this.button) == null || a.removeEventListener("keydown", this.handleActionKeyDown);
|
|
61
|
+
const d = (n == null ? void 0 : n.assignedElements({ flatten: !0 })) || [];
|
|
62
|
+
if (this.button = d.find((l) => l instanceof HTMLElement), !this.button) return;
|
|
63
|
+
const w = this.button.tagName.toLowerCase();
|
|
64
|
+
w === "mui-button" || w === "button" || w === "a" || (this.button.hasAttribute("tabindex") || this.button.setAttribute("tabindex", "0"), this.button.setAttribute("role", "button")), this.button.setAttribute("aria-haspopup", "menu"), this.button.setAttribute("aria-expanded", (u = this.menu) != null && u.classList.contains("show") ? "true" : "false"), this.button.addEventListener("click", this.toggleMenu), this.button.addEventListener("keydown", this.handleActionKeyDown);
|
|
65
|
+
};
|
|
66
|
+
n == null || n.addEventListener("slotchange", h), h(), document.addEventListener("click", this.closeMenu), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("resize", this.handleResize), window.addEventListener("scroll", this.handleScroll, !0);
|
|
59
67
|
}
|
|
60
68
|
disconnectedCallback() {
|
|
61
|
-
var t, e;
|
|
62
|
-
(t = this.button) == null || t.removeEventListener("click", this.toggleMenu), document.removeEventListener("click", this.closeMenu), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("resize", this.handleResize), window.removeEventListener("scroll", this.handleScroll, !0), (
|
|
69
|
+
var t, e, n;
|
|
70
|
+
(t = this.button) == null || t.removeEventListener("click", this.toggleMenu), (e = this.button) == null || e.removeEventListener("keydown", this.handleActionKeyDown), document.removeEventListener("click", this.closeMenu), document.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("resize", this.handleResize), window.removeEventListener("scroll", this.handleScroll, !0), (n = this.menu) == null || n.removeEventListener("focusout", this.handleFocusOut);
|
|
63
71
|
}
|
|
64
72
|
closeWithAnimation() {
|
|
73
|
+
var e;
|
|
65
74
|
if (!this.menu) return;
|
|
66
|
-
this.menu.classList.remove("show"), setTimeout(() => {
|
|
75
|
+
this.menu.classList.remove("show"), (e = this.button) == null || e.setAttribute("aria-expanded", "false"), setTimeout(() => {
|
|
67
76
|
this.menu && (this.menu.classList.contains("show") || (this.menu.style.display = "none"));
|
|
68
77
|
}, 150);
|
|
69
78
|
}
|
|
70
79
|
toggleMenu(t) {
|
|
71
|
-
var n;
|
|
80
|
+
var n, h;
|
|
72
81
|
if (t.stopPropagation(), !this.menu) return;
|
|
73
82
|
const e = this.menu.classList.contains("show");
|
|
74
|
-
!e &&
|
|
75
|
-
var
|
|
76
|
-
(
|
|
77
|
-
}),
|
|
83
|
+
!e && i.openDropdown && i.openDropdown !== this && i.openDropdown.closeWithAnimation(), e ? (this.closeWithAnimation(), (n = this.menu) == null || n.setAttribute("inert", "true"), i.openDropdown === this && (i.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }))) : (this.menu.style.display = "block", requestAnimationFrame(() => {
|
|
84
|
+
var r, o;
|
|
85
|
+
(r = this.menu) == null || r.classList.add("show"), (o = this.menu) == null || o.removeAttribute("inert"), this.adjustPosition();
|
|
86
|
+
}), (h = this.button) == null || h.setAttribute("aria-expanded", "true"), i.openDropdown = this, this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !0 }, bubbles: !0 })));
|
|
78
87
|
}
|
|
79
88
|
closeMenu(t) {
|
|
80
89
|
var n;
|
|
81
90
|
const e = t.composedPath();
|
|
82
|
-
this.menu && e.includes(this.menu) || this.button && e.includes(this.button) || (this.closeWithAnimation(), (n = this.menu) == null || n.setAttribute("inert", "true"),
|
|
91
|
+
this.menu && e.includes(this.menu) || this.button && e.includes(this.button) || (this.closeWithAnimation(), (n = this.menu) == null || n.setAttribute("inert", "true"), i.openDropdown === this && (i.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
|
|
83
92
|
}
|
|
84
93
|
adjustPosition() {
|
|
85
94
|
if (!this.menu) return;
|
|
86
|
-
const t = this.menu, e = 8, n = getComputedStyle(this).getPropertyValue("--dropdown-offset").trim() || "0.8rem",
|
|
95
|
+
const t = this.menu, e = 8, n = getComputedStyle(this).getPropertyValue("--dropdown-offset").trim() || "0.8rem", h = parseFloat(getComputedStyle(document.documentElement).fontSize) || 10, r = n.endsWith("rem") ? parseFloat(n) * h : parseFloat(n) || 8;
|
|
87
96
|
t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.maxWidth = "";
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
let
|
|
97
|
+
const o = this.getBoundingClientRect(), c = t.offsetWidth, p = t.offsetHeight, d = window.innerWidth, w = window.innerHeight, m = (this.getAttribute("vertical-position") || "auto").toLowerCase(), s = w - o.bottom, a = o.top, u = p + r, l = s >= u, g = a >= u;
|
|
98
|
+
let f = o.height + r;
|
|
99
|
+
m === "up" ? f = g || !l ? -(p + r) : o.height + r : m === "down" ? f = l || !g ? o.height + r : -(p + r) : !l && a > s && (f = -(p + r));
|
|
100
|
+
let b = 0;
|
|
92
101
|
switch (this.getAttribute("position") || "left") {
|
|
93
102
|
case "left":
|
|
94
|
-
|
|
103
|
+
b = 0;
|
|
95
104
|
break;
|
|
96
105
|
case "center":
|
|
97
|
-
|
|
106
|
+
b = (o.width - c) / 2;
|
|
98
107
|
break;
|
|
99
108
|
case "right":
|
|
100
109
|
default:
|
|
101
|
-
|
|
110
|
+
b = o.width - c;
|
|
102
111
|
break;
|
|
103
112
|
}
|
|
104
|
-
const y = e -
|
|
105
|
-
|
|
113
|
+
const y = e - o.left, A = d - e - (o.left + c);
|
|
114
|
+
b = Math.max(y, Math.min(b, A)), c > d - e * 2 && (t.style.maxWidth = `${d - e * 2}px`), t.style.top = `${f}px`, t.style.left = `${b}px`;
|
|
106
115
|
}
|
|
107
116
|
render() {
|
|
108
117
|
this.shadowRoot.innerHTML = /*html*/
|
|
@@ -168,6 +177,6 @@ const s = class s extends HTMLElement {
|
|
|
168
177
|
`;
|
|
169
178
|
}
|
|
170
179
|
};
|
|
171
|
-
|
|
172
|
-
let
|
|
173
|
-
customElements.get("mui-dropdown") || customElements.define("mui-dropdown",
|
|
180
|
+
i.openDropdown = null;
|
|
181
|
+
let v = i;
|
|
182
|
+
customElements.get("mui-dropdown") || customElements.define("mui-dropdown", v);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class a extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["size", "level", "truncate", "clamp"];
|
|
4
4
|
}
|
|
@@ -30,6 +30,7 @@ class h extends HTMLElement {
|
|
|
30
30
|
|
|
31
31
|
h1, h2, h3, h4, h5, h6 {
|
|
32
32
|
margin: var(--space-000);
|
|
33
|
+
font-family: var(--heading-font-family, var(--font-family));
|
|
33
34
|
font-weight: var(--heading-font-weight);
|
|
34
35
|
color: var(--heading-text-color);
|
|
35
36
|
min-width: 0;
|
|
@@ -74,4 +75,4 @@ class h extends HTMLElement {
|
|
|
74
75
|
return Number.isFinite(e) && e > 0 ? Math.floor(e) : 2;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
customElements.get("mui-heading") || customElements.define("mui-heading",
|
|
78
|
+
customElements.get("mui-heading") || customElements.define("mui-heading", a);
|
|
@@ -71,16 +71,16 @@ class I extends HTMLElement {
|
|
|
71
71
|
requestAnimationFrame(() => {
|
|
72
72
|
var T, E, S, A, O, f, m, R;
|
|
73
73
|
const e = this.getAttribute("size") || "medium", t = ["x-small", "small", "medium", "large"].includes(e) ? e : "medium", o = (T = this.shadowRoot) == null ? void 0 : T.querySelector('slot[name="before"]'), h = (E = this.shadowRoot) == null ? void 0 : E.querySelector('slot[name="after"]'), N = (S = this.shadowRoot) == null ? void 0 : S.querySelector('slot[name="inside-before"]'), g = (A = this.shadowRoot) == null ? void 0 : A.querySelector('slot[name="inside-after"]'), l = (O = this.shadowRoot) == null ? void 0 : O.querySelector('slot[name="hint"]'), x = {
|
|
74
|
-
"x-small": "var(--action-
|
|
75
|
-
small: "var(--action-
|
|
76
|
-
medium: "var(--action-
|
|
77
|
-
large: "var(--action-
|
|
78
|
-
}[t] || "var(--action-
|
|
74
|
+
"x-small": "var(--action-size-x-small)",
|
|
75
|
+
small: "var(--action-size-small)",
|
|
76
|
+
medium: "var(--action-size-medium)",
|
|
77
|
+
large: "var(--action-size-large)"
|
|
78
|
+
}[t] || "var(--action-size-medium)", z = (s) => {
|
|
79
79
|
if (!s) return;
|
|
80
80
|
s.assignedNodes({ flatten: !0 }).forEach((a) => {
|
|
81
81
|
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
82
|
-
const i = a,
|
|
83
|
-
(
|
|
82
|
+
const i = a, p = i.tagName.toLowerCase();
|
|
83
|
+
(p === "mui-button" || p === "mui-link") && (i.setAttribute("usage", "input"), i.setAttribute("size", t), i.style.setProperty("--input-slot-min-height", x), i.removeAttribute("variant"), i.removeAttribute("weight")), p === "mui-chip" && (i.setAttribute("usage", "input"), i.setAttribute("size", t)), p === "mui-addon" && i.setAttribute("size", t);
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
};
|
|
@@ -118,14 +118,14 @@ class I extends HTMLElement {
|
|
|
118
118
|
medium: "small",
|
|
119
119
|
large: "medium"
|
|
120
120
|
}, a = s[t] || "x-small", i = u[t] || "small";
|
|
121
|
-
l.assignedNodes({ flatten: !0 }).forEach((
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
121
|
+
l.assignedNodes({ flatten: !0 }).forEach((p) => {
|
|
122
|
+
if (p.nodeType !== Node.ELEMENT_NODE) return;
|
|
123
|
+
const c = p, $ = c.tagName.toLowerCase();
|
|
124
124
|
if ($ === "mui-hint") {
|
|
125
|
-
|
|
125
|
+
c.removeAttribute("aria-hidden");
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
$.startsWith("mui-icon-") && !
|
|
128
|
+
$.startsWith("mui-icon-") && !c.hasAttribute("size") && c.setAttribute("size", a), $ === "mui-badge" && !c.hasAttribute("size") && c.setAttribute("size", i), c.setAttribute("aria-hidden", "true");
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
(f = this._slotResizeObserver) == null || f.disconnect();
|
|
@@ -320,7 +320,7 @@ class I extends HTMLElement {
|
|
|
320
320
|
}
|
|
321
321
|
.input-wrapper.stack-mobile .inside-before-slot,
|
|
322
322
|
.input-wrapper.stack-mobile .inside-after-cluster {
|
|
323
|
-
top: calc(var(--action-
|
|
323
|
+
top: calc(var(--action-size-medium) / 2);
|
|
324
324
|
}
|
|
325
325
|
.input-wrapper.stack-mobile slot[name="before"]::slotted(mui-addon),
|
|
326
326
|
.input-wrapper.stack-mobile slot[name="after"]::slotted(mui-addon) {
|
|
@@ -413,7 +413,7 @@ class I extends HTMLElement {
|
|
|
413
413
|
background: var(--input-background);
|
|
414
414
|
}
|
|
415
415
|
input.size-x-small {
|
|
416
|
-
min-height: var(--action-
|
|
416
|
+
min-height: var(--action-size-x-small);
|
|
417
417
|
padding: var(--action-padding-x-small);
|
|
418
418
|
font-size: var(--text-font-size-xs);
|
|
419
419
|
line-height: var(--text-line-height-xs);
|
|
@@ -427,7 +427,7 @@ class I extends HTMLElement {
|
|
|
427
427
|
padding-right: calc(var(--input-inline-padding-current) + var(--input-inside-after-space, 0px) + var(--input-inline-gap));
|
|
428
428
|
}
|
|
429
429
|
input.size-small {
|
|
430
|
-
min-height: var(--action-
|
|
430
|
+
min-height: var(--action-size-small);
|
|
431
431
|
padding: var(--action-padding-small);
|
|
432
432
|
font-size: var(--text-font-size-s);
|
|
433
433
|
line-height: var(--text-line-height-s);
|
|
@@ -441,7 +441,7 @@ class I extends HTMLElement {
|
|
|
441
441
|
padding-right: calc(var(--input-inline-padding-current) + var(--input-inside-after-space, 0px) + var(--input-inline-gap));
|
|
442
442
|
}
|
|
443
443
|
input.size-medium {
|
|
444
|
-
min-height:
|
|
444
|
+
min-height: var(--action-size-medium);
|
|
445
445
|
padding: var(--space-200) var(--space-300);
|
|
446
446
|
font-size: var(--text-font-size);
|
|
447
447
|
line-height: var(--text-line-height);
|
|
@@ -455,7 +455,7 @@ class I extends HTMLElement {
|
|
|
455
455
|
padding-right: calc(var(--input-inline-padding-current) + var(--input-inside-after-space, 0px) + var(--input-inline-gap));
|
|
456
456
|
}
|
|
457
457
|
input.size-large {
|
|
458
|
-
min-height: var(--action-
|
|
458
|
+
min-height: var(--action-size-large);
|
|
459
459
|
padding: var(--space-300) var(--space-400);
|
|
460
460
|
font-size: var(--text-font-size-l);
|
|
461
461
|
line-height: var(--text-line-height-l);
|
|
@@ -596,6 +596,10 @@ class I extends HTMLElement {
|
|
|
596
596
|
slot[name="inside-before"]::slotted(*:hover),
|
|
597
597
|
slot[name="inside-after"]::slotted(*:hover) { z-index: 1; }
|
|
598
598
|
|
|
599
|
+
input:focus {
|
|
600
|
+
z-index: 2;
|
|
601
|
+
}
|
|
602
|
+
|
|
599
603
|
/* Ensure feedback styles appear above SELECT and focusable Items */
|
|
600
604
|
input.success,
|
|
601
605
|
input.warning,
|