@muibook/components 19.6.0 → 20.1.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 (172) hide show
  1. package/AGENTS.md +67 -0
  2. package/DESIGN.md +358 -0
  3. package/README.md +53 -2
  4. package/dist/esm/agent/keywords/index.js +2 -173
  5. package/dist/esm/agent/prompts/index.js +6 -432
  6. package/dist/esm/components/mui-accordion/core/index.js +25 -17
  7. package/dist/esm/components/mui-addon/index.js +14 -14
  8. package/dist/esm/components/mui-avatar/index.js +103 -43
  9. package/dist/esm/components/mui-avatar-chip/index.js +158 -0
  10. package/dist/esm/components/mui-avatar-group/index.js +88 -0
  11. package/dist/esm/components/mui-badge/index.js +37 -20
  12. package/dist/esm/components/mui-body/index.js +20 -11
  13. package/dist/esm/components/mui-button/index.js +265 -78
  14. package/dist/esm/components/mui-calendar/index.js +199 -0
  15. package/dist/esm/components/mui-card/body/index.js +33 -18
  16. package/dist/esm/components/mui-card/footer/index.js +11 -9
  17. package/dist/esm/components/mui-carousel/controller/index.js +1 -1
  18. package/dist/esm/components/mui-checkbox/index.js +23 -18
  19. package/dist/esm/components/mui-chip/index.js +219 -73
  20. package/dist/esm/components/mui-chip-input/index.js +146 -137
  21. package/dist/esm/components/mui-chip-rail/index.js +342 -0
  22. package/dist/esm/components/mui-code/index.js +26 -7
  23. package/dist/esm/components/mui-container/index.js +68 -45
  24. package/dist/esm/components/mui-date-picker/index.js +169 -0
  25. package/dist/esm/components/mui-drawer/index.js +968 -100
  26. package/dist/esm/components/mui-dropdown/index.js +255 -59
  27. package/dist/esm/components/mui-field/index.js +1 -1
  28. package/dist/esm/components/mui-file-upload/index.js +14 -4
  29. package/dist/esm/components/mui-form-group/index.js +1 -2
  30. package/dist/esm/components/mui-form-message/index.js +4 -9
  31. package/dist/esm/components/mui-heading/index.js +3 -2
  32. package/dist/esm/components/mui-hint/index.js +178 -72
  33. package/dist/esm/components/mui-icons/copy/index.js +54 -0
  34. package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
  35. package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
  36. package/dist/esm/components/mui-icons/index.js +14 -1
  37. package/dist/esm/components/mui-icons/moon/index.js +3 -1
  38. package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
  39. package/dist/esm/components/mui-icons/pause/index.js +5 -0
  40. package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
  41. package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
  42. package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
  43. package/dist/esm/components/mui-icons/reload/index.js +5 -0
  44. package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
  45. package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
  46. package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
  47. package/dist/esm/components/mui-icons/spinner/index.js +7 -5
  48. package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
  49. package/dist/esm/components/mui-icons/sun/index.js +5 -5
  50. package/dist/esm/components/mui-icons/timer/index.js +54 -0
  51. package/dist/esm/components/mui-icons/toggle/index.js +16 -6
  52. package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
  53. package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
  54. package/dist/esm/components/mui-input/index.js +96 -67
  55. package/dist/esm/components/mui-link/index.js +352 -96
  56. package/dist/esm/components/mui-media-player/index.js +1577 -83
  57. package/dist/esm/components/mui-message/index.js +7 -6
  58. package/dist/esm/components/mui-model-viewer/index.js +258 -0
  59. package/dist/esm/components/mui-progress-ring/index.js +349 -0
  60. package/dist/esm/components/mui-prompt/index.js +143 -115
  61. package/dist/esm/components/mui-prompt-preview/index.js +11 -23
  62. package/dist/esm/components/mui-radio/index.js +38 -17
  63. package/dist/esm/components/mui-range-input/index.js +9 -4
  64. package/dist/esm/components/mui-responsive/index.js +60 -27
  65. package/dist/esm/components/mui-search-input/index.js +300 -0
  66. package/dist/esm/components/mui-select/index.js +235 -46
  67. package/dist/esm/components/mui-slat/slat/index.js +40 -12
  68. package/dist/esm/components/mui-spinner/index.js +11 -9
  69. package/dist/esm/components/mui-stack/hstack/index.js +10 -5
  70. package/dist/esm/components/mui-status/index.js +239 -0
  71. package/dist/esm/components/mui-stepper/step/index.js +46 -32
  72. package/dist/esm/components/mui-switch/index.js +37 -26
  73. package/dist/esm/components/mui-table/row/index.js +2 -6
  74. package/dist/esm/components/mui-table/table/index.js +157 -14
  75. package/dist/esm/components/mui-tabs/controller/index.js +17 -6
  76. package/dist/esm/components/mui-tabs/item/index.js +17 -5
  77. package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
  78. package/dist/esm/components/mui-textarea/index.js +43 -26
  79. package/dist/esm/components/mui-time/index/index.js +336 -0
  80. package/dist/esm/components/mui-time-picker/index.js +126 -0
  81. package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
  82. package/dist/esm/css/mui-brand.css +12 -8
  83. package/dist/esm/css/mui-tokens.css +646 -344
  84. package/dist/esm/css/readme.md +2 -2
  85. package/dist/esm/custom-elements.json +4506 -1707
  86. package/dist/esm/dynamic-attrs.json +271 -54
  87. package/dist/esm/index.js +33 -6
  88. package/dist/esm/knowledge/compositions/index.js +1560 -0
  89. package/dist/esm/knowledge/index.js +28 -0
  90. package/dist/esm/knowledge/keywords/index.js +306 -0
  91. package/dist/esm/knowledge/rules/index.js +199 -0
  92. package/dist/esm/tokens/js/index.js +143 -139
  93. package/dist/types/agent/keywords/index.d.ts +1 -1
  94. package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
  95. package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
  96. package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
  97. package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
  98. package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
  99. package/dist/types/components/mui-button/api.d.ts +6 -2
  100. package/dist/types/components/mui-calendar/api.d.ts +41 -0
  101. package/dist/types/components/mui-calendar/doc.d.ts +2 -0
  102. package/dist/types/components/mui-calendar/index.d.ts +3 -0
  103. package/dist/types/components/mui-checkbox/api.d.ts +4 -0
  104. package/dist/types/components/mui-chip/api.d.ts +4 -0
  105. package/dist/types/components/mui-chip-input/api.d.ts +4 -0
  106. package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
  107. package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
  108. package/dist/types/components/mui-chip-rail/index.d.ts +4 -0
  109. package/dist/types/components/mui-date-picker/api.d.ts +38 -0
  110. package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
  111. package/dist/types/components/mui-date-picker/index.d.ts +6 -0
  112. package/dist/types/components/mui-drawer/api.d.ts +4 -0
  113. package/dist/types/components/mui-drawer/index.d.ts +2 -0
  114. package/dist/types/components/mui-file-upload/api.d.ts +4 -0
  115. package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
  116. package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
  117. package/dist/types/components/mui-icons/index.d.ts +14 -1
  118. package/dist/types/components/mui-icons/panel.d.ts +1 -0
  119. package/dist/types/components/mui-icons/pause.d.ts +1 -0
  120. package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
  121. package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
  122. package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
  123. package/dist/types/components/mui-icons/reload.d.ts +1 -0
  124. package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
  125. package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
  126. package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
  127. package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
  128. package/dist/types/components/mui-icons/timer.d.ts +1 -0
  129. package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
  130. package/dist/types/components/mui-input/api.d.ts +12 -0
  131. package/dist/types/components/mui-link/api.d.ts +4 -0
  132. package/dist/types/components/mui-media-player/api.d.ts +4 -0
  133. package/dist/types/components/mui-media-player/index.d.ts +13 -4
  134. package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
  135. package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
  136. package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
  137. package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
  138. package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
  139. package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
  140. package/dist/types/components/mui-radio/api.d.ts +12 -0
  141. package/dist/types/components/mui-range-input/api.d.ts +4 -0
  142. package/dist/types/components/mui-responsive/api.d.ts +10 -2
  143. package/dist/types/components/mui-search-input/api.d.ts +40 -0
  144. package/dist/types/components/mui-search-input/doc.d.ts +2 -0
  145. package/dist/types/components/mui-search-input/index.d.ts +3 -0
  146. package/dist/types/components/mui-select/api.d.ts +12 -0
  147. package/dist/types/components/mui-status/api.d.ts +24 -0
  148. package/dist/types/components/mui-status/doc.d.ts +2 -0
  149. package/dist/types/components/mui-status/index.d.ts +1 -0
  150. package/dist/types/components/mui-switch/api.d.ts +4 -0
  151. package/dist/types/components/mui-table/api.d.ts +15 -0
  152. package/dist/types/components/mui-textarea/api.d.ts +12 -0
  153. package/dist/types/components/mui-time/api.d.ts +41 -0
  154. package/dist/types/components/mui-time/doc.d.ts +2 -0
  155. package/dist/types/components/mui-time/index.d.ts +1 -0
  156. package/dist/types/components/mui-time-picker/api.d.ts +38 -0
  157. package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
  158. package/dist/types/components/mui-time-picker/index.d.ts +4 -0
  159. package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
  160. package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
  161. package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
  162. package/dist/types/index.d.ts +27 -2
  163. package/dist/types/knowledge/compositions.d.ts +4644 -0
  164. package/dist/types/knowledge/index.d.ts +4657 -0
  165. package/dist/types/knowledge/keywords.d.ts +4 -0
  166. package/dist/types/knowledge/rules.d.ts +1 -0
  167. package/dist/types/tokens/js/index.d.ts +11 -7
  168. package/package.json +131 -12
  169. package/dist/esm/components/mui-form-hint/index.js +0 -1
  170. package/dist/types/components/mui-form-hint/index.d.ts +0 -1
  171. /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
  172. /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
@@ -1,20 +1,34 @@
1
- const s = class s extends HTMLElement {
1
+ const r = class r extends HTMLElement {
2
2
  constructor() {
3
- super(), this.button = null, this.menu = null, this.handleResize = () => {
3
+ super(), this.button = null, this.menu = null, this.portalMenu = null, this.portalInner = null, this.portaledItems = [], this.originalNextSibling = /* @__PURE__ */ new Map(), this.positionFrameId = null, this.positionTimeoutIds = [], this.menuResizeObserver = null, this.handleResize = () => {
4
4
  var t;
5
- (t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
5
+ (t = this.activeMenu) != null && t.classList.contains("show") && this.closeMenu();
6
6
  }, this.handleScroll = () => {
7
7
  var t;
8
- (t = this.menu) != null && t.classList.contains("show") && this.adjustPosition();
8
+ (t = this.activeMenu) != 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, o;
11
+ if (this.persistent) return;
12
+ const i = t.relatedTarget;
13
+ !this.contains(i) && !((e = this.portalMenu) != null && e.contains(i)) && (this.closeWithAnimation(), (n = this.activeMenu) == null || n.setAttribute("inert", "true"), r.openDropdown === this && (r.openDropdown = null), (o = this.button) == null || o.setAttribute("aria-expanded", "false"), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })));
14
+ }, this.handleActionKeyDown = (t) => {
15
+ var i;
16
+ if (t.key === "Tab" && !t.shiftKey && ((i = this.activeMenu) != null && i.classList.contains("show"))) {
17
+ t.preventDefault(), this.focusFirstItem();
18
+ return;
19
+ }
20
+ t.key !== "Enter" && t.key !== " " || (t.preventDefault(), this.toggleMenu(t));
12
21
  }, this.attachShadow({ mode: "open" });
13
22
  }
23
+ get activeMenu() {
24
+ return this.portalMenu || this.menu;
25
+ }
14
26
  handleKeyDown(t) {
27
+ var i, e;
15
28
  if (t.key === "Escape") {
16
- if (!this.menu) return;
17
- this.menu.classList.remove("show"), this.menu.setAttribute("inert", "true"), s.openDropdown === this && (s.openDropdown = null), this.dispatchEvent(
29
+ const n = this.activeMenu;
30
+ if (!n || !n.classList.contains("show")) return;
31
+ n.classList.remove("show"), n.setAttribute("inert", "true"), this.restorePortalItems(), r.openDropdown === this && (r.openDropdown = null), (i = this.button) == null || i.setAttribute("aria-expanded", "false"), (e = this.button) == null || e.focus(), this.dispatchEvent(
18
32
  new CustomEvent("dropdown-toggle", {
19
33
  detail: { open: !1 },
20
34
  bubbles: !0
@@ -22,87 +36,267 @@ const s = class s extends HTMLElement {
22
36
  );
23
37
  }
24
38
  }
39
+ close() {
40
+ var i, e;
41
+ const t = this.activeMenu;
42
+ !t || !t.classList.contains("show") || (t.classList.remove("show"), t.setAttribute("inert", "true"), this.restorePortalItems(), r.openDropdown === this && (r.openDropdown = null), (i = this.button) == null || i.setAttribute("aria-expanded", "false"), (e = this.button) == null || e.focus(), this.dispatchEvent(
43
+ new CustomEvent("dropdown-toggle", {
44
+ detail: { open: !1 },
45
+ bubbles: !0
46
+ })
47
+ ));
48
+ }
49
+ clearPositionSchedules() {
50
+ this.positionFrameId !== null && (cancelAnimationFrame(this.positionFrameId), this.positionFrameId = null), this.positionTimeoutIds.forEach((t) => window.clearTimeout(t)), this.positionTimeoutIds = [];
51
+ }
52
+ schedulePositionUpdate() {
53
+ this.clearPositionSchedules();
54
+ let t = 0;
55
+ const i = () => {
56
+ var e;
57
+ if (!((e = this.activeMenu) != null && e.classList.contains("show"))) {
58
+ this.positionFrameId = null;
59
+ return;
60
+ }
61
+ this.adjustPosition(), t += 1, t < 4 ? this.positionFrameId = requestAnimationFrame(i) : this.positionFrameId = null;
62
+ };
63
+ this.positionFrameId = requestAnimationFrame(i), [80, 180, 320].forEach((e) => {
64
+ const n = window.setTimeout(() => {
65
+ var o;
66
+ this.positionTimeoutIds = this.positionTimeoutIds.filter((s) => s !== n), (o = this.activeMenu) != null && o.classList.contains("show") && this.adjustPosition();
67
+ }, e);
68
+ this.positionTimeoutIds.push(n);
69
+ });
70
+ }
71
+ focusFirstItem() {
72
+ const t = this.portalInner || this.menu;
73
+ if (!t) return;
74
+ const i = (n) => {
75
+ const o = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
76
+ if (n instanceof HTMLElement && n.matches(o))
77
+ return n;
78
+ const s = n.children;
79
+ for (let u = 0; u < s.length; u++) {
80
+ const l = s[u];
81
+ if (l.shadowRoot) {
82
+ const h = i(l.shadowRoot);
83
+ if (h) return h;
84
+ }
85
+ if (l.tagName === "SLOT") {
86
+ const h = l.assignedElements({ flatten: !0 });
87
+ for (const p of h)
88
+ if (p instanceof HTMLElement) {
89
+ const a = i(p);
90
+ if (a) return a;
91
+ }
92
+ }
93
+ if (l.matches(o))
94
+ return l;
95
+ const d = i(l);
96
+ if (d) return d;
97
+ }
98
+ return null;
99
+ }, e = i(t);
100
+ e && e.focus();
101
+ }
25
102
  static get observedAttributes() {
26
103
  return ["zindex", "position", "vertical-position", "persistent"];
27
104
  }
28
105
  get persistent() {
29
106
  return this.hasAttribute("persistent");
30
107
  }
31
- attributeChangedCallback(t, e, n) {
32
- t === "zindex" && this.menu && (this.menu.style.zIndex = n ?? "1"), (t === "position" || t === "vertical-position") && this.menu && this.adjustPosition();
108
+ attributeChangedCallback(t, i, e) {
109
+ t === "zindex" && this.menu && (this.menu.style.zIndex = e ?? "1", this.portalMenu && (this.portalMenu.style.zIndex = e ?? "1")), (t === "position" || t === "vertical-position") && this.menu && this.adjustPosition();
33
110
  }
34
111
  connectedCallback() {
35
- var i, r, l, a, h;
36
- this.render(), this.menu = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".dropdown-menu");
112
+ var o, s, u, l;
113
+ this.render(), this.menu = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".dropdown-menu");
37
114
  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);
115
+ this.menu && (this.menu.style.zIndex = t), this.menu && this.menu.setAttribute("inert", "true"), (s = this.menu) == null || s.addEventListener("focusout", this.handleFocusOut);
116
+ const i = (u = this.shadowRoot) == null ? void 0 : u.querySelector("slot:not([name])");
117
+ if (i) {
118
+ const d = () => {
119
+ const p = i.assignedElements({ flatten: !0 }).filter((a) => {
120
+ const c = a.tagName.toLowerCase();
121
+ return c === "mui-button" || c === "mui-link";
122
+ });
123
+ p.forEach((a) => {
124
+ a.removeAttribute("dropdown-slot"), a.removeAttribute("dropdown-slot-first"), a.removeAttribute("dropdown-slot-last");
125
+ }), p.forEach((a, c) => {
126
+ a.hasAttribute("variant") || a.setAttribute("variant", "tertiary"), a.setAttribute("dropdown-slot", ""), c === 0 && a.setAttribute("dropdown-slot-first", ""), c === p.length - 1 && a.setAttribute("dropdown-slot-last", ""), a._dropdownListenerAdded || (a.addEventListener("click", () => {
127
+ var m, b, w;
128
+ this.persistent || ((m = this.activeMenu) == null || m.classList.remove("show"), (b = this.activeMenu) == null || b.setAttribute("inert", "true"), this.restorePortalItems(), r.openDropdown === this && (r.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 })), (w = this.button) == null || w.focus());
129
+ }), a._dropdownListenerAdded = !0);
54
130
  });
55
131
  };
56
- d.addEventListener("slotchange", u), u();
132
+ i.addEventListener("slotchange", d), d();
57
133
  }
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);
134
+ this.toggleMenu = this.toggleMenu.bind(this), this.closeMenu = this.closeMenu.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this);
135
+ const e = (l = this.shadowRoot) == null ? void 0 : l.querySelector('slot[name="action"]'), n = () => {
136
+ var a, c, m;
137
+ (a = this.button) == null || a.removeEventListener("click", this.toggleMenu), (c = this.button) == null || c.removeEventListener("keydown", this.handleActionKeyDown);
138
+ const d = (e == null ? void 0 : e.assignedElements({ flatten: !0 })) || [];
139
+ if (this.button = d.find((b) => b instanceof HTMLElement), !this.button) return;
140
+ const h = this.button.tagName.toLowerCase();
141
+ h === "mui-button" || h === "button" || h === "a" || h === "mui-input" || (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", (m = this.menu) != null && m.classList.contains("show") ? "true" : "false"), this.button.addEventListener("click", this.toggleMenu), this.button.addEventListener("keydown", this.handleActionKeyDown);
142
+ };
143
+ e == null || e.addEventListener("slotchange", n), n(), document.addEventListener("click", this.closeMenu), document.addEventListener("keydown", this.handleKeyDown), window.addEventListener("resize", this.handleResize), window.addEventListener("scroll", this.handleScroll, !0);
59
144
  }
60
145
  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);
146
+ var t, i, e, n;
147
+ (t = this.button) == null || t.removeEventListener("click", this.toggleMenu), (i = this.button) == null || i.removeEventListener("keydown", this.handleActionKeyDown), this.clearPositionSchedules(), (e = this.menuResizeObserver) == null || e.disconnect(), this.menuResizeObserver = null, 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), this.restorePortalItems();
63
148
  }
64
149
  closeWithAnimation() {
65
- if (!this.menu) return;
66
- this.menu.classList.remove("show"), setTimeout(() => {
67
- this.menu && (this.menu.classList.contains("show") || (this.menu.style.display = "none"));
150
+ var e;
151
+ const t = this.activeMenu;
152
+ if (!t) return;
153
+ t.classList.remove("show"), (e = this.button) == null || e.setAttribute("aria-expanded", "false"), setTimeout(() => {
154
+ const n = this.activeMenu;
155
+ n && (n.classList.contains("show") || (n.style.display = "none", this.restorePortalItems()));
68
156
  }, 150);
69
157
  }
70
158
  toggleMenu(t) {
71
- var n;
159
+ var e, n, o;
72
160
  if (t.stopPropagation(), !this.menu) return;
73
- 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 })));
161
+ const i = (e = this.activeMenu) == null ? void 0 : e.classList.contains("show");
162
+ if (!i && r.openDropdown && r.openDropdown !== this && r.openDropdown.closeWithAnimation(), i)
163
+ this.closeWithAnimation(), (n = this.activeMenu) == null || n.setAttribute("inert", "true"), r.openDropdown === this && (r.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }));
164
+ else {
165
+ this.portalItems();
166
+ const s = this.activeMenu;
167
+ if (!s) return;
168
+ s.style.display = "block", requestAnimationFrame(() => {
169
+ s.classList.add("show"), s.removeAttribute("inert"), this.schedulePositionUpdate();
170
+ }), (o = this.button) == null || o.setAttribute("aria-expanded", "true"), r.openDropdown = this, this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !0 }, bubbles: !0 }));
171
+ }
78
172
  }
79
173
  closeMenu(t) {
80
- var n;
81
- 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 })));
174
+ var i;
175
+ if (t) {
176
+ const e = t.composedPath();
177
+ if (this.menu && e.includes(this.menu) || this.portalMenu && e.includes(this.portalMenu) || this.button && e.includes(this.button)) return;
178
+ }
179
+ this.closeWithAnimation(), (i = this.activeMenu) == null || i.setAttribute("inert", "true"), r.openDropdown === this && (r.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }));
180
+ }
181
+ portalItems() {
182
+ var e, n;
183
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot:not([name])"), i = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) || [];
184
+ if (i.length) {
185
+ if (this.ensurePortalStyles(), !this.portalMenu) {
186
+ this.portalMenu = document.createElement("div"), this.portalMenu.className = "mui-dropdown-portal", this.portalMenu.setAttribute("inert", "true"), this.portalMenu.style.zIndex = this.getAttribute("zindex") || "1";
187
+ const o = () => {
188
+ const s = document.createElement("div");
189
+ return s.tabIndex = 0, s.style.position = "absolute", s.style.opacity = "0", s.style.pointerEvents = "none", s.addEventListener("focus", () => {
190
+ var u, l, d;
191
+ this.persistent || ((u = this.activeMenu) == null || u.classList.remove("show"), (l = this.activeMenu) == null || l.setAttribute("inert", "true"), this.restorePortalItems(), r.openDropdown === this && (r.openDropdown = null), this.dispatchEvent(new CustomEvent("dropdown-toggle", { detail: { open: !1 }, bubbles: !0 }))), (d = this.button) == null || d.focus();
192
+ }), s;
193
+ };
194
+ this.portalMenu.appendChild(o()), this.portalInner = document.createElement("div"), this.portalInner.className = "inner", this.portalMenu.appendChild(this.portalInner), this.portalMenu.appendChild(o()), this.portalMenu.addEventListener("focusout", this.handleFocusOut), document.body.appendChild(this.portalMenu);
195
+ }
196
+ this.syncPortalStyles(), this.portaledItems = i, i.forEach((o) => {
197
+ var s;
198
+ this.originalNextSibling.has(o) || this.originalNextSibling.set(o, o.nextSibling), (s = this.portalInner) == null || s.appendChild(o);
199
+ }), typeof ResizeObserver < "u" && this.portalMenu && ((n = this.menuResizeObserver) == null || n.disconnect(), this.menuResizeObserver = new ResizeObserver(() => {
200
+ var o;
201
+ (o = this.activeMenu) != null && o.classList.contains("show") && this.adjustPosition();
202
+ }), this.menuResizeObserver.observe(this.portalMenu));
203
+ }
204
+ }
205
+ restorePortalItems() {
206
+ var t;
207
+ this.portalMenu && (this.clearPositionSchedules(), (t = this.menuResizeObserver) == null || t.disconnect(), this.menuResizeObserver = null, this.portaledItems.forEach((i) => {
208
+ const e = this.originalNextSibling.get(i);
209
+ e && e.parentNode === this ? this.insertBefore(i, e) : this.appendChild(i);
210
+ }), this.portaledItems = [], this.originalNextSibling.clear(), this.portalMenu.removeEventListener("focusout", this.handleFocusOut), this.portalMenu.remove(), this.portalMenu = null, this.portalInner = null);
211
+ }
212
+ ensurePortalStyles() {
213
+ if (r.portalStylesInjected) return;
214
+ const t = document.createElement("style");
215
+ t.textContent = `
216
+ .mui-dropdown-portal {
217
+ display: none;
218
+ opacity: 0;
219
+ transform: translateY(-0.25rem);
220
+ transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
221
+ min-width: var(--dropdown-min-width, 15rem);
222
+ position: fixed;
223
+ z-index: 1;
224
+ box-sizing: border-box;
225
+ border: var(--border-thin);
226
+ background: var(--dropdown-background);
227
+ border-color: var(--dropdown-border-color);
228
+ box-shadow: 0 var(--space-100) var(--space-200) var(--dropdown-shadow-color);
229
+ border-radius: var(--dropdown-radius);
230
+ padding: 1px;
231
+ }
232
+ .mui-dropdown-portal.show {
233
+ visibility: visible;
234
+ opacity: 1;
235
+ transform: translateY(0);
236
+ }
237
+ .mui-dropdown-portal .inner {
238
+ display: flex;
239
+ flex-direction: column;
240
+ gap: 1px;
241
+ }
242
+ .mui-dropdown-portal mui-button,
243
+ .mui-dropdown-portal mui-link {
244
+ width: 100%;
245
+ text-align: left;
246
+ }
247
+ .mui-dropdown-portal mui-button:focus,
248
+ .mui-dropdown-portal mui-link:focus {
249
+ z-index: 1;
250
+ }
251
+ `, document.head.appendChild(t), r.portalStylesInjected = !0;
252
+ }
253
+ syncPortalStyles() {
254
+ if (!this.portalMenu) return;
255
+ const t = window.getComputedStyle(this);
256
+ [
257
+ "--dropdown-background",
258
+ "--dropdown-border-color",
259
+ "--dropdown-min-width",
260
+ "--dropdown-radius",
261
+ "--dropdown-shadow-color",
262
+ "--action-tertiary-background",
263
+ "--action-tertiary-background-hover",
264
+ "--action-tertiary-background-focus",
265
+ "--action-tertiary-border",
266
+ "--action-tertiary-border-hover",
267
+ "--action-tertiary-border-focus",
268
+ "--action-tertiary-text-color",
269
+ "--action-tertiary-text-color-hover",
270
+ "--action-tertiary-text-color-focus"
271
+ ].forEach((i) => {
272
+ var n;
273
+ const e = t.getPropertyValue(i);
274
+ e && ((n = this.portalMenu) == null || n.style.setProperty(i, e));
275
+ });
83
276
  }
84
277
  adjustPosition() {
85
- 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;
278
+ const t = this.activeMenu;
279
+ if (!t) return;
280
+ const i = 8, e = getComputedStyle(this).getPropertyValue("--dropdown-offset").trim() || "0.8rem", n = parseFloat(getComputedStyle(document.documentElement).fontSize) || 10, o = e.endsWith("rem") ? parseFloat(e) * n : parseFloat(e) || 8;
87
281
  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;
282
+ const s = this.getBoundingClientRect(), u = t.offsetWidth, l = t.offsetHeight, d = window.innerWidth, h = window.innerHeight, p = (this.getAttribute("vertical-position") || "auto").toLowerCase(), a = h - s.bottom, c = s.top, m = l + o, b = a >= m, w = c >= m;
283
+ let v = this.portalMenu ? s.bottom + o : s.height + o;
284
+ p === "up" ? v = w || !b ? this.portalMenu ? s.top - l - o : -(l + o) : this.portalMenu ? s.bottom + o : s.height + o : p === "down" ? v = b || !w ? this.portalMenu ? s.bottom + o : s.height + o : this.portalMenu ? s.top - l - o : -(l + o) : !b && c > a && (v = this.portalMenu ? s.top - l - o : -(l + o));
285
+ let f = 0;
92
286
  switch (this.getAttribute("position") || "left") {
93
287
  case "left":
94
- m = 0;
288
+ f = this.portalMenu ? s.left : 0;
95
289
  break;
96
290
  case "center":
97
- m = (r.width - l) / 2;
291
+ f = this.portalMenu ? s.left + (s.width - u) / 2 : (s.width - u) / 2;
98
292
  break;
99
293
  case "right":
100
294
  default:
101
- m = r.width - l;
295
+ f = this.portalMenu ? s.right - u : s.width - u;
102
296
  break;
103
297
  }
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`;
298
+ const y = this.portalMenu ? i : i - s.left, M = this.portalMenu ? d - i - u : d - i - (s.left + u);
299
+ f = Math.max(y, Math.min(f, M)), u > d - i * 2 && (t.style.maxWidth = `${d - i * 2}px`), t.style.top = `${v}px`, t.style.left = `${f}px`;
106
300
  }
107
301
  render() {
108
302
  this.shadowRoot.innerHTML = /*html*/
@@ -139,12 +333,14 @@ const s = class s extends HTMLElement {
139
333
  transform: translateY(0);
140
334
  }
141
335
 
142
- .dropdown-menu ::slotted(mui-button) {
336
+ .dropdown-menu ::slotted(mui-button),
337
+ .dropdown-menu ::slotted(mui-link) {
143
338
  width: 100%;
144
339
  text-align: left;
145
340
  }
146
341
 
147
- .dropdown-menu ::slotted(mui-button:focus) {
342
+ .dropdown-menu ::slotted(mui-button:focus),
343
+ .dropdown-menu ::slotted(mui-link:focus) {
148
344
  z-index: 1;
149
345
  }
150
346
 
@@ -168,6 +364,6 @@ const s = class s extends HTMLElement {
168
364
  `;
169
365
  }
170
366
  };
171
- s.openDropdown = null;
172
- let g = s;
367
+ r.openDropdown = null, r.portalStylesInjected = !1;
368
+ let g = r;
173
369
  customElements.get("mui-dropdown") || customElements.define("mui-dropdown", g);
@@ -116,7 +116,7 @@ class r extends HTMLElement {
116
116
  if (!t) return;
117
117
  t.assignedElements({ flatten: !0 }).forEach((s) => {
118
118
  const a = s.tagName.toLowerCase();
119
- (a === "mui-form-message" || a === "mui-form-hint" || a === "mui-body") && s.setAttribute("size", e);
119
+ (a === "mui-form-message" || a === "mui-body") && s.setAttribute("size", e);
120
120
  });
121
121
  }
122
122
  bindSlotEvents() {
@@ -24,6 +24,9 @@ class a extends HTMLElement {
24
24
  connectedCallback() {
25
25
  this.acceptedFileTypes = this.readAcceptedFileTypes(), this.currentFileName = this.readCurrentFileName(), this.render(), this.cacheElements(), this.attachEvents();
26
26
  }
27
+ focus(e) {
28
+ this.wrapper ? this.wrapper.focus(e) : super.focus(e);
29
+ }
27
30
  disconnectedCallback() {
28
31
  this.cleanupListeners();
29
32
  }
@@ -42,7 +45,7 @@ class a extends HTMLElement {
42
45
  line-height: var(--text-line-height-s);
43
46
  box-sizing: border-box;
44
47
  font-size: var(--text-font-size-s);
45
- border-radius: var(--radius-100);
48
+ border-radius: var(--form-radius-medium);
46
49
  border: var(--border-thin);
47
50
  border-style: dashed;
48
51
  border-color: var(--form-default-border-color);
@@ -53,6 +56,10 @@ class a extends HTMLElement {
53
56
  .wrapper:hover {
54
57
  border-color: var(--form-default-border-color-hover);
55
58
  }
59
+ .wrapper:focus-visible {
60
+ outline: var(--outline-medium);
61
+ outline-offset: var(--outline-offset);
62
+ }
56
63
  .label {
57
64
  width: 90px;
58
65
  white-space: nowrap;
@@ -81,6 +88,7 @@ class a extends HTMLElement {
81
88
 
82
89
  mui-button::part(height) {
83
90
  height: calc(var(--space-600) + var(--space-050));
91
+ min-height: initial;
84
92
  padding: var(--space-400);
85
93
  padding-top: var(--space-000);
86
94
  padding-bottom: var(--space-000);
@@ -95,7 +103,7 @@ class a extends HTMLElement {
95
103
  display: none;
96
104
  }
97
105
  </style>
98
- <div class="wrapper">
106
+ <div class="wrapper" role="button" tabindex="0">
99
107
  <span class="label">${this.selectedFileName || this.currentFileName || "No file selected"}</span>
100
108
  <mui-button variant="tertiary">Browse</mui-button>
101
109
  <input type="file" accept="${this.acceptedFileTypes}" />
@@ -106,12 +114,14 @@ class a extends HTMLElement {
106
114
  this.shadowRoot && (this.wrapper = this.shadowRoot.querySelector(".wrapper"), this.label = this.shadowRoot.querySelector(".label"), this.button = this.shadowRoot.querySelector(".button"), this.input = this.shadowRoot.querySelector('input[type="file"]'));
107
115
  }
108
116
  cleanupListeners() {
109
- this.wrapper && this._wrapperClickHandler && this.wrapper.removeEventListener("click", this._wrapperClickHandler), this.input && this._inputChangeHandler && this.input.removeEventListener("change", this._inputChangeHandler);
117
+ this.wrapper && this._wrapperClickHandler && this.wrapper.removeEventListener("click", this._wrapperClickHandler), this.wrapper && this._wrapperKeydownHandler && this.wrapper.removeEventListener("keydown", this._wrapperKeydownHandler), this.input && this._inputChangeHandler && this.input.removeEventListener("change", this._inputChangeHandler);
110
118
  }
111
119
  attachEvents() {
112
120
  this._wrapperClickHandler = () => {
113
121
  this.input.click();
114
- }, this._inputChangeHandler = this.handleFileChange.bind(this), this.wrapper.addEventListener("click", this._wrapperClickHandler), this.input.addEventListener("change", this._inputChangeHandler);
122
+ }, this._wrapperKeydownHandler = (e) => {
123
+ e.key !== "Enter" && e.key !== " " || (e.preventDefault(), this.input.click());
124
+ }, this._inputChangeHandler = this.handleFileChange.bind(this), this.wrapper.addEventListener("click", this._wrapperClickHandler), this.wrapper.addEventListener("keydown", this._wrapperKeydownHandler), this.input.addEventListener("change", this._inputChangeHandler);
115
125
  }
116
126
  handleFileChange(e) {
117
127
  var r;
@@ -47,8 +47,7 @@ class r extends HTMLElement {
47
47
  :host([variant="horizontal"]) .content-inner ::slotted(*) {
48
48
  min-inline-size: 0;
49
49
  }
50
- :host([variant="horizontal"]) .content-inner ::slotted(mui-form-message),
51
- :host([variant="horizontal"]) .content-inner ::slotted(mui-form-hint) {
50
+ :host([variant="horizontal"]) .content-inner ::slotted(mui-form-message) {
52
51
  grid-column: 1 / -1;
53
52
  }
54
53
  @media (max-width: 767px) {
@@ -1,6 +1,6 @@
1
1
  import "../mui-body/index.js";
2
2
  import "../mui-icons/info/index.js";
3
- class a extends HTMLElement {
3
+ class r extends HTMLElement {
4
4
  static get observedAttributes() {
5
5
  return ["size", "weight", "variant"];
6
6
  }
@@ -39,7 +39,7 @@ class a extends HTMLElement {
39
39
  }
40
40
  render() {
41
41
  if (!this.shadowRoot) return;
42
- const t = this.getAttribute("size") || "small", s = this.getAttribute("weight") || "regular", o = this.getAttribute("variant") || "optional", r = this.querySelector('[slot="after"]') !== null;
42
+ const t = this.getAttribute("size") || "small", s = this.getAttribute("weight") || "regular", o = this.getAttribute("variant") || "optional", i = this.querySelector('[slot="after"]') !== null;
43
43
  this.shadowRoot.innerHTML = /*html*/
44
44
  `
45
45
  <style>
@@ -63,7 +63,7 @@ class a extends HTMLElement {
63
63
  </slot>
64
64
  </span>
65
65
  <slot></slot>
66
- ${r ? `<span slot="after" class="slot-wrapper">
66
+ ${i ? `<span slot="after" class="slot-wrapper">
67
67
  <slot name="after"></slot>
68
68
  </span>` : ""}
69
69
  </mui-body>
@@ -72,9 +72,4 @@ class a extends HTMLElement {
72
72
  e == null || e.addEventListener("slotchange", () => this.syncBeforeIcon()), this.syncBeforeIcon();
73
73
  }
74
74
  }
75
- customElements.get("mui-form-message") || customElements.define("mui-form-message", a);
76
- if (!customElements.get("mui-form-hint")) {
77
- class i extends a {
78
- }
79
- customElements.define("mui-form-hint", i);
80
- }
75
+ customElements.get("mui-form-message") || customElements.define("mui-form-message", r);
@@ -1,4 +1,4 @@
1
- class h extends HTMLElement {
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", h);
78
+ customElements.get("mui-heading") || customElements.define("mui-heading", a);