@muibook/components 19.5.1 → 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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/agent/keywords/index.js +41 -2
  3. package/dist/esm/agent/prompts/index.js +14 -11
  4. package/dist/esm/components/mui-addon/index.js +14 -14
  5. package/dist/esm/components/mui-avatar/index.js +4 -1
  6. package/dist/esm/components/mui-badge/index.js +35 -18
  7. package/dist/esm/components/mui-body/index.js +57 -14
  8. package/dist/esm/components/mui-button/index.js +187 -52
  9. package/dist/esm/components/mui-card/body/index.js +1 -1
  10. package/dist/esm/components/mui-chip/index.js +56 -26
  11. package/dist/esm/components/mui-chip-rail/index.js +239 -0
  12. package/dist/esm/components/mui-code/index.js +5 -5
  13. package/dist/esm/components/mui-dropdown/index.js +55 -46
  14. package/dist/esm/components/mui-file-upload/index.js +1 -0
  15. package/dist/esm/components/mui-form-message/index.js +21 -13
  16. package/dist/esm/components/mui-heading/index.js +47 -10
  17. package/dist/esm/components/mui-hint/index.js +2 -2
  18. package/dist/esm/components/mui-input/index.js +21 -17
  19. package/dist/esm/components/mui-link/index.js +199 -55
  20. package/dist/esm/components/mui-message/index.js +7 -6
  21. package/dist/esm/components/mui-prompt/index.js +102 -102
  22. package/dist/esm/components/mui-rule/index.js +8 -1
  23. package/dist/esm/components/mui-select/index.js +4 -4
  24. package/dist/esm/components/mui-slat/slat/index.js +9 -1
  25. package/dist/esm/components/mui-stack/hstack/index.js +10 -5
  26. package/dist/esm/components/mui-status/index.js +239 -0
  27. package/dist/esm/components/mui-stepper/step/index.js +46 -32
  28. package/dist/esm/components/mui-switch/index.js +21 -13
  29. package/dist/esm/components/mui-tabs/controller/index.js +17 -6
  30. package/dist/esm/components/mui-tabs/item/index.js +17 -5
  31. package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
  32. package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
  33. package/dist/esm/css/mui-brand.css +3 -1
  34. package/dist/esm/css/mui-tokens.css +270 -78
  35. package/dist/esm/custom-elements.json +2608 -1900
  36. package/dist/esm/dynamic-attrs.json +26 -6
  37. package/dist/esm/index.js +7 -4
  38. package/dist/esm/tokens/js/index.js +119 -118
  39. package/dist/types/components/mui-body/api.d.ts +9 -2
  40. package/dist/types/components/mui-button/api.d.ts +4 -0
  41. package/dist/types/components/mui-chip/api.d.ts +4 -0
  42. package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
  43. package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
  44. package/dist/types/components/mui-chip-rail/index.d.ts +3 -0
  45. package/dist/types/components/mui-link/api.d.ts +4 -0
  46. package/dist/types/components/mui-status/api.d.ts +24 -0
  47. package/dist/types/components/mui-status/doc.d.ts +2 -0
  48. package/dist/types/components/mui-status/index.d.ts +1 -0
  49. package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
  50. package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
  51. package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
  52. package/dist/types/index.d.ts +3 -0
  53. package/dist/types/tokens/js/index.d.ts +1 -0
  54. 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, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
237
+ }
238
+ }
239
+ customElements.get("mui-chip-rail") || customElements.define("mui-chip-rail", n);
@@ -1,4 +1,4 @@
1
- class s extends HTMLElement {
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"), i = (
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>${i}</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", s);
73
+ customElements.get("mui-code") || customElements.define("mui-code", i);
@@ -1,4 +1,4 @@
1
- const s = class s extends HTMLElement {
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"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
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"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(
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 i, r, l, a, h;
36
- this.render(), this.menu = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".dropdown-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"), (r = this.menu) == null || r.addEventListener("focusout", this.handleFocusOut);
39
- const e = (l = this.shadowRoot) == null ? void 0 : l.querySelector('slot[name="action"]'), n = (e == null ? void 0 : e.assignedNodes({ flatten: !0 })) || [];
40
- this.button = n.find(
41
- (u) => u instanceof HTMLElement && u.tagName.toLowerCase() === "mui-button"
42
- );
43
- const d = (a = this.shadowRoot) == null ? void 0 : a.querySelector("slot:not([name])");
44
- if (d) {
45
- const u = () => {
46
- const c = d.assignedElements({ flatten: !0 }).filter((o) => o.tagName.toLowerCase() === "mui-button");
47
- c.forEach((o) => {
48
- o.removeAttribute("dropdown-slot"), o.removeAttribute("dropdown-slot-first"), o.removeAttribute("dropdown-slot-last");
49
- }), c.forEach((o, w) => {
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
- d.addEventListener("slotchange", u), u();
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), (h = this.button) == null || h.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);
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), (e = this.menu) == null || e.removeEventListener("focusout", this.handleFocusOut);
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 && s.openDropdown && s.openDropdown !== this && s.openDropdown.closeWithAnimation(), e ? (this.closeWithAnimation(), (n = this.menu) == null || n.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }))) : (this.menu.style.display = "block", requestAnimationFrame(() => {
75
- var d, i;
76
- (d = this.menu) == null || d.classList.add("show"), (i = this.menu) == null || i.removeAttribute("inert"), this.adjustPosition();
77
- }), s.openDropdown = this, this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !0 }, bubbles: !0 })));
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"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
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", d = parseFloat(getComputedStyle(document.documentElement).fontSize) || 10, i = n.endsWith("rem") ? parseFloat(n) * d : parseFloat(n) || 8;
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 r = this.getBoundingClientRect(), l = t.offsetWidth, a = t.offsetHeight, h = window.innerWidth, u = window.innerHeight, v = (this.getAttribute("vertical-position") || "auto").toLowerCase(), c = u - r.bottom, o = r.top, w = a + i, p = c >= w, f = o >= w;
89
- let b = r.height + i;
90
- v === "up" ? b = f || !p ? -(a + i) : r.height + i : v === "down" ? b = p || !f ? r.height + i : -(a + i) : !p && o > c && (b = -(a + i));
91
- let m = 0;
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
- m = 0;
103
+ b = 0;
95
104
  break;
96
105
  case "center":
97
- m = (r.width - l) / 2;
106
+ b = (o.width - c) / 2;
98
107
  break;
99
108
  case "right":
100
109
  default:
101
- m = r.width - l;
110
+ b = o.width - c;
102
111
  break;
103
112
  }
104
- const y = e - r.left, E = h - e - (r.left + l);
105
- m = Math.max(y, Math.min(m, E)), l > h - e * 2 && (t.style.maxWidth = `${h - e * 2}px`), t.style.top = `${b}px`, t.style.left = `${m}px`;
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
- s.openDropdown = null;
172
- let g = s;
173
- customElements.get("mui-dropdown") || customElements.define("mui-dropdown", g);
180
+ i.openDropdown = null;
181
+ let v = i;
182
+ customElements.get("mui-dropdown") || customElements.define("mui-dropdown", v);
@@ -81,6 +81,7 @@ class a extends HTMLElement {
81
81
 
82
82
  mui-button::part(height) {
83
83
  height: calc(var(--space-600) + var(--space-050));
84
+ min-height: initial;
84
85
  padding: var(--space-400);
85
86
  padding-top: var(--space-000);
86
87
  padding-bottom: var(--space-000);
@@ -10,6 +10,7 @@ class a extends HTMLElement {
10
10
  getIconColor(t) {
11
11
  return {
12
12
  optional: "var(--text-color-optional)",
13
+ info: "var(--text-color-info)",
13
14
  warning: "var(--text-color-warning)",
14
15
  success: "var(--text-color-success)",
15
16
  error: "var(--text-color-error)"
@@ -25,9 +26,9 @@ class a extends HTMLElement {
25
26
  }
26
27
  syncBeforeIcon() {
27
28
  if (!this.shadowRoot) return;
28
- const t = this.shadowRoot.querySelector('slot[name="before"]'), e = this.getIconColor(this.getAttribute("variant") || "optional"), o = this.getIconSize(this.getAttribute("size") || "small");
29
- ((t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).forEach((s) => {
30
- s.tagName.toLowerCase().startsWith("mui-icon-") && (s.hasAttribute("color") || s.setAttribute("color", e), s.hasAttribute("size") || s.setAttribute("size", o));
29
+ const t = this.shadowRoot.querySelector('slot[name="before"]'), s = this.getIconColor(this.getAttribute("variant") || "optional"), o = this.getIconSize(this.getAttribute("size") || "small");
30
+ ((t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? []).forEach((e) => {
31
+ e.tagName.toLowerCase().startsWith("mui-icon-") && (e.hasAttribute("color") || e.setAttribute("color", s), e.hasAttribute("size") || e.setAttribute("size", o));
31
32
  });
32
33
  }
33
34
  connectedCallback() {
@@ -38,7 +39,7 @@ class a extends HTMLElement {
38
39
  }
39
40
  render() {
40
41
  if (!this.shadowRoot) return;
41
- const t = this.getAttribute("size") || "small", e = this.getAttribute("weight") || "regular", o = this.getAttribute("variant") || "optional";
42
+ const t = this.getAttribute("size") || "small", s = this.getAttribute("weight") || "regular", o = this.getAttribute("variant") || "optional", r = this.querySelector('[slot="after"]') !== null;
42
43
  this.shadowRoot.innerHTML = /*html*/
43
44
  `
44
45
  <style>
@@ -50,23 +51,30 @@ class a extends HTMLElement {
50
51
  margin-inline-start: var(--stroke-size-100);
51
52
  margin-block-start: var(--space-200);
52
53
  }
54
+ .slot-wrapper {
55
+ display: inline-flex;
56
+ }
53
57
  </style>
54
58
 
55
- <mui-body size="${t}" weight="${e}" variant="${o}">
56
- <slot slot="before" name="before">
57
- <mui-icon-info id="default-before-icon" size="${this.getIconSize(t)}" color="${this.getIconColor(o)}"></mui-icon-info>
58
- </slot>
59
+ <mui-body size="${t}" weight="${s}" variant="${o}">
60
+ <span slot="before" class="slot-wrapper">
61
+ <slot name="before">
62
+ <mui-icon-info id="default-before-icon" size="${this.getIconSize(t)}" color="${this.getIconColor(o)}"></mui-icon-info>
63
+ </slot>
64
+ </span>
59
65
  <slot></slot>
60
- <slot slot="after" name="after"></slot>
66
+ ${r ? `<span slot="after" class="slot-wrapper">
67
+ <slot name="after"></slot>
68
+ </span>` : ""}
61
69
  </mui-body>
62
70
  `;
63
- const i = this.shadowRoot.querySelector('slot[name="before"]');
64
- i == null || i.addEventListener("slotchange", () => this.syncBeforeIcon()), this.syncBeforeIcon();
71
+ const e = this.shadowRoot.querySelector('slot[name="before"]');
72
+ e == null || e.addEventListener("slotchange", () => this.syncBeforeIcon()), this.syncBeforeIcon();
65
73
  }
66
74
  }
67
75
  customElements.get("mui-form-message") || customElements.define("mui-form-message", a);
68
76
  if (!customElements.get("mui-form-hint")) {
69
- class r extends a {
77
+ class i extends a {
70
78
  }
71
- customElements.define("mui-form-hint", r);
79
+ customElements.define("mui-form-hint", i);
72
80
  }
@@ -1,6 +1,6 @@
1
- class n extends HTMLElement {
1
+ class a extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["size", "level"];
3
+ return ["size", "level", "truncate", "clamp"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
@@ -8,21 +8,54 @@ class n extends HTMLElement {
8
8
  connectedCallback() {
9
9
  this.render();
10
10
  }
11
- attributeChangedCallback(i, t, e) {
12
- t !== e && this.shadowRoot && this.render();
11
+ attributeChangedCallback(e, i, t) {
12
+ i !== t && this.shadowRoot && this.render();
13
13
  }
14
14
  render() {
15
15
  if (!this.shadowRoot) return;
16
- const i = this.getAttribute("size") || "1", e = `h${this.getAttribute("level") || i}`;
16
+ const e = this.getAttribute("size") || "1", t = `h${this.getAttribute("level") || e}`, n = this.getLineClamp();
17
17
  this.shadowRoot.innerHTML = /*html*/
18
18
  `
19
19
  <style>
20
- :host { display: block; }
20
+ :host {
21
+ display: block;
22
+ --heading-line-clamp: ${n};
23
+ }
24
+
25
+ :host([truncate]) {
26
+ min-width: 0;
27
+ max-width: 100%;
28
+ width: 100%;
29
+ }
21
30
 
22
31
  h1, h2, h3, h4, h5, h6 {
23
32
  margin: var(--space-000);
33
+ font-family: var(--heading-font-family, var(--font-family));
24
34
  font-weight: var(--heading-font-weight);
25
35
  color: var(--heading-text-color);
36
+ min-width: 0;
37
+ width: 100%;
38
+ }
39
+
40
+ .content {
41
+ max-width: 100%;
42
+ min-width: 0;
43
+ }
44
+
45
+ :host([truncate]) .content {
46
+ display: block;
47
+ max-width: 100%;
48
+ width: 100%;
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
52
+ }
53
+
54
+ :host([clamp]:not([truncate])) .content {
55
+ display: -webkit-box;
56
+ overflow: hidden;
57
+ -webkit-box-orient: vertical;
58
+ -webkit-line-clamp: var(--heading-line-clamp);
26
59
  }
27
60
 
28
61
  .size-1 { font-size: var(--heading-font-size-100); line-height: var(--heading-line-height-100); }
@@ -32,10 +65,14 @@ class n extends HTMLElement {
32
65
  .size-5 { font-size: var(--heading-font-size-500); line-height: var(--heading-line-height-500); }
33
66
  .size-6 { font-size: var(--heading-font-size-600); line-height: var(--heading-line-height-600); }
34
67
  </style>
35
- <${e} class="size-${i}">
36
- <slot></slot>
37
- </${e}>
68
+ <${t} class="size-${e}">
69
+ <span class="content"><slot></slot></span>
70
+ </${t}>
38
71
  `;
39
72
  }
73
+ getLineClamp() {
74
+ const e = Number(this.getAttribute("clamp"));
75
+ return Number.isFinite(e) && e > 0 ? Math.floor(e) : 2;
76
+ }
40
77
  }
41
- customElements.get("mui-heading") || customElements.define("mui-heading", n);
78
+ customElements.get("mui-heading") || customElements.define("mui-heading", a);
@@ -133,11 +133,11 @@ class T extends HTMLElement {
133
133
  }
134
134
  getDelay() {
135
135
  const t = Number(this.getAttribute("delay"));
136
- return Number.isFinite(t) ? Math.min(2e3, Math.max(1e3, t)) : 1500;
136
+ return Number.isFinite(t) ? Math.min(2e3, Math.max(250, t)) : 500;
137
137
  }
138
138
  getInitialDelay() {
139
139
  const t = Number(this.getAttribute("initial-delay"));
140
- return Number.isFinite(t) ? Math.min(2e3, Math.max(1e3, t)) : 1500;
140
+ return Number.isFinite(t) ? Math.min(2e3, Math.max(250, t)) : 500;
141
141
  }
142
142
  openWithDelay() {
143
143
  this.closeTimer && (window.clearTimeout(this.closeTimer), this.closeTimer = null);