@muibook/components 4.0.0 → 5.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 (53) hide show
  1. package/{readme.md → README.md} +2 -0
  2. package/dist/esm/components/mui-accordion/block/index.js +29 -23
  3. package/dist/esm/components/mui-accordion/core/index.js +35 -26
  4. package/dist/esm/components/mui-accordion/group/index.js +7 -7
  5. package/dist/esm/components/mui-accordion/inline/index.js +12 -6
  6. package/dist/esm/components/mui-button/index.js +52 -22
  7. package/dist/esm/components/mui-dialog/index.js +103 -0
  8. package/dist/esm/components/mui-drawer/index.js +393 -0
  9. package/dist/esm/components/mui-dropdown/index.js +172 -0
  10. package/dist/esm/components/mui-icons/add/index.js +3 -3
  11. package/dist/esm/components/mui-icons/calendar/index.js +55 -0
  12. package/dist/esm/components/mui-icons/close/index.js +1 -1
  13. package/dist/esm/components/mui-icons/down-arrow-circle/index.js +1 -1
  14. package/dist/esm/components/mui-icons/down-chevron/index.js +1 -1
  15. package/dist/esm/components/mui-icons/ellipsis/index.js +1 -1
  16. package/dist/esm/components/mui-icons/gear/index.js +8 -8
  17. package/dist/esm/components/mui-icons/globe/index.js +3 -3
  18. package/dist/esm/components/mui-icons/grid/index.js +1 -1
  19. package/dist/esm/components/mui-icons/index.js +1 -0
  20. package/dist/esm/components/mui-icons/info/index.js +3 -3
  21. package/dist/esm/components/mui-icons/left-arrow/index.js +1 -1
  22. package/dist/esm/components/mui-icons/left-chevron/index.js +1 -1
  23. package/dist/esm/components/mui-icons/left-sidebar/index.js +1 -1
  24. package/dist/esm/components/mui-icons/moon/index.js +1 -1
  25. package/dist/esm/components/mui-icons/notification/index.js +1 -1
  26. package/dist/esm/components/mui-icons/right-chevron/index.js +1 -1
  27. package/dist/esm/components/mui-icons/stop/index.js +1 -1
  28. package/dist/esm/components/mui-icons/subtract/index.js +1 -1
  29. package/dist/esm/components/mui-icons/sun/index.js +1 -1
  30. package/dist/esm/components/mui-icons/translate/index.js +53 -0
  31. package/dist/esm/components/mui-icons/up-arrow/index.js +3 -3
  32. package/dist/esm/components/mui-icons/up-chevron/index.js +1 -1
  33. package/dist/esm/components/mui-link/index.js +39 -33
  34. package/dist/esm/components/mui-loader/index.js +99 -0
  35. package/dist/esm/components/mui-progress/index.js +75 -0
  36. package/dist/esm/components/mui-stepper/index.js +2 -0
  37. package/dist/esm/components/mui-stepper/step/index.js +157 -0
  38. package/dist/esm/components/mui-stepper/stepper/index.js +95 -0
  39. package/dist/esm/css/mui-tokens.css +47 -2
  40. package/dist/esm/index.js +13 -4
  41. package/dist/types/components/mui-dialog/index.d.ts +2 -0
  42. package/dist/types/components/mui-drawer/index.d.ts +2 -0
  43. package/dist/types/components/mui-dropdown/index.d.ts +1 -0
  44. package/dist/types/components/mui-icons/calendar.d.ts +1 -0
  45. package/dist/types/components/mui-icons/index.d.ts +1 -0
  46. package/dist/types/components/mui-icons/translate.d.ts +1 -0
  47. package/dist/types/components/mui-loader/index.d.ts +1 -0
  48. package/dist/types/components/mui-progress/index.d.ts +1 -0
  49. package/dist/types/components/mui-stepper/index.d.ts +2 -0
  50. package/dist/types/components/mui-stepper/step/index.d.ts +1 -0
  51. package/dist/types/components/mui-stepper/stepper/index.d.ts +1 -0
  52. package/dist/types/index.d.ts +9 -0
  53. package/package.json +41 -1
@@ -1,3 +1,5 @@
1
+ - See [CHANGELOG.md](./CHANGELOG.md) for details on updates.
2
+
1
3
  # NPM Package 📦 – @muibook/components
2
4
 
3
5
  Leverage reusable vanilla Web Components built with the Mui (MichaelUI) Design System in your project. Simply install the [@muibook/components](https://www.npmjs.com/package/@muibook/components?activeTab=readme) package to access a framework-agnostic, accessible, and customizable component library.
@@ -4,10 +4,14 @@ class u extends HTMLElement {
4
4
  constructor() {
5
5
  super(), this.summaryEl = null, this.detailEl = null, this.chevronEl = null, this.attachShadow({ mode: "open" }), this.accordionId = `accordion-detail-${Math.random().toString(36).substring(2, 9)}`;
6
6
  }
7
+ getDetailEl() {
8
+ var e;
9
+ return this.detailEl || (this.detailEl = ((e = this.shadowRoot) == null ? void 0 : e.querySelector(".accordion-detail")) || null), this.detailEl;
10
+ }
7
11
  connectedCallback() {
8
- var s, r;
12
+ var r, n;
9
13
  if (!this.shadowRoot) return;
10
- const i = this.getAttribute("heading") || "Heading...", e = this.getAttribute("size") || "medium", l = this.getAttribute("level") || "3", o = this.getAttribute("detail-space"), h = o ? `detail-space-${o}` : "";
14
+ const e = this.getAttribute("heading") || "Heading...", t = this.getAttribute("size") || "medium", i = this.getAttribute("level") || "3", s = this.getAttribute("detail-space"), h = s ? `detail-space-${s}` : "";
11
15
  let m = (
12
16
  /*html*/
13
17
  `
@@ -58,10 +62,6 @@ class u extends HTMLElement {
58
62
  box-shadow: inset 0 1px 0 0 var(--border-color);
59
63
  }
60
64
 
61
- .accordion-detail[open] {
62
- max-height: 200vh;
63
- }
64
-
65
65
  .accordion-detail-inner {
66
66
  padding: var(--space-500);
67
67
  }
@@ -132,20 +132,20 @@ class u extends HTMLElement {
132
132
  </style>
133
133
 
134
134
  <div
135
- class="accordion-summary size-${e}-summary"
135
+ class="accordion-summary size-${t}-summary"
136
136
  role="button"
137
137
  tabindex="0"
138
138
  aria-expanded="false"
139
139
  aria-controls="${this.accordionId}"
140
140
  >
141
- <mui-heading size="6" level="${l}">${i}</mui-heading>
141
+ <mui-heading size="6" level="${i}">${e}</mui-heading>
142
142
  <div class="icon">
143
143
  <mui-icon-down-chevron size="x-small"></mui-icon-down-chevron>
144
144
  </div>
145
145
  </div>
146
146
 
147
147
  <div id="${this.accordionId}" class="accordion-detail">
148
- <div class="accordion-detail-inner size-${e}-detail ${h}" inert>
148
+ <div class="accordion-detail-inner size-${t}-detail ${h}" inert>
149
149
  <slot name="detail">Insert Content</slot>
150
150
  </div>
151
151
  </div>
@@ -153,30 +153,36 @@ class u extends HTMLElement {
153
153
  `
154
154
  );
155
155
  if (this.shadowRoot.innerHTML = m, requestAnimationFrame(() => {
156
- const t = this.shadowRoot.querySelector('slot[name="detail"]');
157
- t && t.assignedElements({ flatten: !0 }).forEach((a) => {
158
- var n, d;
159
- (((n = a.tagName) == null ? void 0 : n.toLowerCase()) === "mui-slat-group" ? [a] : Array.from(((d = a.querySelectorAll) == null ? void 0 : d.call(a, "mui-slat-group")) || [])).forEach((c) => {
160
- c.hasAttribute("usage") || c.setAttribute("usage", "accordion");
156
+ const a = this.shadowRoot.querySelector('slot[name="detail"]');
157
+ a && a.assignedElements({ flatten: !0 }).forEach((o) => {
158
+ var d, c;
159
+ (((d = o.tagName) == null ? void 0 : d.toLowerCase()) === "mui-slat-group" ? [o] : Array.from(((c = o.querySelectorAll) == null ? void 0 : c.call(o, "mui-slat-group")) || [])).forEach((l) => {
160
+ l.hasAttribute("usage") || l.setAttribute("usage", "accordion");
161
161
  });
162
162
  });
163
163
  }), this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.chevronEl = this.shadowRoot.querySelector("mui-icon-down-chevron"), !this.summaryEl || !this.detailEl || !this.chevronEl) {
164
164
  console.error("Accordion elements not found");
165
165
  return;
166
166
  }
167
- (s = this.summaryEl) == null || s.addEventListener("click", () => this.toggleAccordion()), (r = this.summaryEl) == null || r.addEventListener("keydown", (t) => {
168
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
167
+ (r = this.summaryEl) == null || r.addEventListener("click", () => this.toggleAccordion()), (n = this.summaryEl) == null || n.addEventListener("keydown", (a) => {
168
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), this.toggleAccordion());
169
169
  });
170
170
  }
171
171
  toggleAccordion() {
172
- if (!this.detailEl || !this.chevronEl || !this.summaryEl) return;
173
- const i = this.detailEl.hasAttribute("open");
174
- this.setOpen(!i);
172
+ const e = this.getDetailEl();
173
+ if (!e) return;
174
+ const i = !e.hasAttribute("open");
175
+ if (this.setOpen(i), i) {
176
+ const s = e.scrollHeight;
177
+ e.style.maxHeight = s + "px";
178
+ } else
179
+ e.style.maxHeight = "0";
175
180
  }
176
- setOpen(i) {
177
- if (!this.detailEl || !this.chevronEl || !this.summaryEl) return;
178
- const e = this.detailEl.querySelector(".accordion-detail-inner");
179
- i ? (this.detailEl.setAttribute("open", ""), this.chevronEl.setAttribute("open", ""), this.summaryEl.setAttribute("aria-expanded", "true"), e && e.removeAttribute("inert"), this.dispatchEvent(new CustomEvent("accordion-opened", { bubbles: !0, composed: !0 }))) : (this.detailEl.removeAttribute("open"), this.chevronEl.removeAttribute("open"), this.summaryEl.setAttribute("aria-expanded", "false"), e && e.setAttribute("inert", ""));
181
+ setOpen(e) {
182
+ const t = this.getDetailEl();
183
+ if (!t || !this.chevronEl || !this.summaryEl) return;
184
+ const i = t.querySelector(".accordion-detail-inner");
185
+ e ? (t.setAttribute("open", ""), this.chevronEl.setAttribute("open", ""), this.summaryEl.setAttribute("aria-expanded", "true"), i && i.removeAttribute("inert"), this.dispatchEvent(new CustomEvent("accordion-opened", { bubbles: !0, composed: !0 }))) : (t.removeAttribute("open"), this.chevronEl.removeAttribute("open"), this.summaryEl.setAttribute("aria-expanded", "false"), i && i.setAttribute("inert", ""), t.style.maxHeight = "0");
180
186
  }
181
187
  closeAccordion() {
182
188
  this.setOpen(!1);
@@ -1,4 +1,4 @@
1
- class l extends HTMLElement {
1
+ class c extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" });
4
4
  }
@@ -8,16 +8,16 @@ class l extends HTMLElement {
8
8
  get open() {
9
9
  return this.hasAttribute("open");
10
10
  }
11
- set open(t) {
12
- t ? this.setAttribute("open", "") : this.removeAttribute("open");
11
+ set open(e) {
12
+ e ? this.setAttribute("open", "") : this.removeAttribute("open");
13
13
  }
14
14
  connectedCallback() {
15
- var r, n;
15
+ var n, a;
16
16
  if (!this.shadowRoot) return;
17
- const t = this.querySelector('[slot="summary"]'), s = this.querySelector('[slot="detail"]');
18
- if (!t || !s) return;
19
- this.iconToggleEl = t.querySelector("mui-icon-toggle");
20
- const i = `
17
+ const e = this.querySelector('[slot="summary"]'), i = this.querySelector('[slot="detail"]');
18
+ if (!e || !i) return;
19
+ this.iconToggleEl = e.querySelector("mui-icon-toggle");
20
+ const s = `
21
21
  :host {
22
22
  display: block;
23
23
  }
@@ -34,42 +34,51 @@ class l extends HTMLElement {
34
34
  .accordion-detail {
35
35
  max-height: 0;
36
36
  overflow: hidden;
37
- transition: max-height 0.3s ease;
38
- }
39
- .accordion-detail[open] {
40
- max-height: 200vh;
37
+ transition: max-height var(--speed-300) ease;
41
38
  }
42
39
  `;
43
- if (this.shadowRoot.innerHTML = /* html */
40
+ this.shadowRoot.innerHTML = /* html */
44
41
  `
45
- <style>${i}</style>
42
+ <style>${s}</style>
46
43
  <div class="accordion-summary" tabindex="0" role="button" aria-expanded="false">
47
44
  <slot name="summary"></slot>
48
45
  </div>
49
46
  <div class="accordion-detail" role="region" aria-hidden="true">
50
47
  <slot name="detail"></slot>
51
48
  </div>
52
- `, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.iconToggleEl = t.querySelector("mui-icon-toggle"), !this.iconToggleEl) {
53
- const e = t.querySelector("mui-icon-right-chevron"), o = t.querySelector("mui-icon-down-chevron");
54
- e ? (this.chevronEl = e, e.setAttribute("data-icon-animation", "accordion-inline")) : o && (this.chevronEl = o, o.setAttribute("data-icon-animation", "accordion-block"));
49
+ `, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail");
50
+ const r = this.shadowRoot.querySelector('slot[name="detail"]'), l = () => {
51
+ this.open && this.detailEl && (this.detailEl.style.maxHeight = this.detailEl.scrollHeight + "px");
52
+ };
53
+ if (Array.from(r.assignedElements({ flatten: !1 })).forEach((t) => {
54
+ new ResizeObserver(l).observe(t);
55
+ }), r.addEventListener("slotchange", () => {
56
+ Array.from(r.assignedElements({ flatten: !1 })).forEach((t) => {
57
+ new ResizeObserver(l).observe(t);
58
+ }), l();
59
+ }), this.iconToggleEl = e.querySelector("mui-icon-toggle"), !this.iconToggleEl) {
60
+ const t = e.querySelector("mui-icon-right-chevron"), o = e.querySelector("mui-icon-down-chevron");
61
+ t ? (this.chevronEl = t, t.setAttribute("data-icon-animation", "accordion-inline")) : o && (this.chevronEl = o, o.setAttribute("data-icon-animation", "accordion-block"));
55
62
  }
56
- (r = this.summaryEl) == null || r.addEventListener("click", () => this.toggleAccordion()), (n = this.summaryEl) == null || n.addEventListener("keydown", (e) => {
57
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.toggleAccordion());
63
+ (n = this.summaryEl) == null || n.addEventListener("click", () => this.toggleAccordion()), (a = this.summaryEl) == null || a.addEventListener("keydown", (t) => {
64
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
58
65
  }), this.hasAttribute("open") && this.openAccordion();
59
66
  }
60
- attributeChangedCallback(t, s, i) {
61
- t === "open" && this.detailEl && this.summaryEl && (i !== null ? this.openAccordion() : this.closeAccordion());
67
+ attributeChangedCallback(e, i, s) {
68
+ e === "open" && this.detailEl && this.summaryEl && (s !== null ? this.openAccordion() : this.closeAccordion());
62
69
  }
63
70
  toggleAccordion() {
64
71
  this.open = !this.open;
65
72
  }
66
73
  openAccordion() {
67
- var t;
68
- !this.detailEl || !this.summaryEl || (this.detailEl.setAttribute("open", ""), this.detailEl.setAttribute("aria-hidden", "false"), this.summaryEl.setAttribute("aria-expanded", "true"), (t = this.chevronEl) == null || t.setAttribute("open", ""), this.iconToggleEl && (this.iconToggleEl.toggle = !0, this.iconToggleEl.setAttribute("aria-pressed", "true")));
74
+ var i;
75
+ if (!this.detailEl || !this.summaryEl) return;
76
+ const e = this.detailEl.scrollHeight;
77
+ this.detailEl.style.maxHeight = e + "px", this.detailEl.setAttribute("open", ""), this.detailEl.setAttribute("aria-hidden", "false"), this.summaryEl.setAttribute("aria-expanded", "true"), (i = this.chevronEl) == null || i.setAttribute("open", ""), this.iconToggleEl && (this.iconToggleEl.toggle = !0, this.iconToggleEl.setAttribute("aria-pressed", "true"));
69
78
  }
70
79
  closeAccordion() {
71
- var t;
72
- !this.detailEl || !this.summaryEl || (this.detailEl.removeAttribute("open"), this.detailEl.setAttribute("aria-hidden", "true"), this.summaryEl.setAttribute("aria-expanded", "false"), (t = this.chevronEl) == null || t.removeAttribute("open"), this.iconToggleEl && (this.iconToggleEl.toggle = !1, this.iconToggleEl.setAttribute("aria-pressed", "false")));
80
+ var e;
81
+ !this.detailEl || !this.summaryEl || (this.detailEl.style.maxHeight = "0", this.detailEl.removeAttribute("open"), this.detailEl.setAttribute("aria-hidden", "true"), this.summaryEl.setAttribute("aria-expanded", "false"), (e = this.chevronEl) == null || e.removeAttribute("open"), this.iconToggleEl && (this.iconToggleEl.toggle = !1, this.iconToggleEl.setAttribute("aria-pressed", "false")));
73
82
  }
74
83
  }
75
- customElements.get("mui-accordion-core") || customElements.define("mui-accordion-core", l);
84
+ customElements.get("mui-accordion-core") || customElements.define("mui-accordion-core", c);
@@ -1,4 +1,4 @@
1
- class e extends HTMLElement {
1
+ class c extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" }), this.accordions = [];
4
4
  }
@@ -13,14 +13,14 @@ class e extends HTMLElement {
13
13
  (t) => t.tagName === "MUI-ACCORDION-BLOCK" && typeof t.closeAccordion == "function"
14
14
  ), this.accordions.forEach((t) => {
15
15
  t.removeAttribute("first-child"), t.removeAttribute("last-child");
16
- }), this.accordions.length > 0 && (this.accordions[0].setAttribute("first-child", ""), this.accordions[this.accordions.length - 1].setAttribute("last-child", "")), this.accordions.forEach((t) => {
17
- t.addEventListener("accordion-opened", () => {
18
- this.hasAttribute("exclusive") && this.accordions.forEach((s) => {
19
- s !== t && s.closeAccordion();
20
- });
16
+ }), this.accordions.length > 0 && (this.accordions[0].setAttribute("first-child", ""), this.accordions[this.accordions.length - 1].setAttribute("last-child", "")), this.addEventListener("accordion-opened", (t) => {
17
+ if (!this.hasAttribute("exclusive")) return;
18
+ const e = t.composedPath()[0];
19
+ this.accordions.forEach((s) => {
20
+ s !== e && s.closeAccordion();
21
21
  });
22
22
  });
23
23
  }));
24
24
  }
25
25
  }
26
- customElements.get("mui-accordion-group") || customElements.define("mui-accordion-group", e);
26
+ customElements.get("mui-accordion-group") || customElements.define("mui-accordion-group", c);
@@ -5,10 +5,10 @@ class a extends HTMLElement {
5
5
  super(), this.attachShadow({ mode: "open" });
6
6
  }
7
7
  connectedCallback() {
8
- var o, n;
8
+ var n, r;
9
9
  if (!this.shadowRoot) return;
10
10
  const e = this.getAttribute("heading") || "Heading...";
11
- let r = (
11
+ let t = (
12
12
  /*html*/
13
13
  `
14
14
  <style>
@@ -51,7 +51,6 @@ class a extends HTMLElement {
51
51
  }
52
52
 
53
53
  .accordion-detail[open] {
54
- max-height: 200vh;
55
54
  transition: max-height var(--speed-400) ease-in-out;
56
55
  }
57
56
 
@@ -77,8 +76,8 @@ class a extends HTMLElement {
77
76
  </div>
78
77
  `
79
78
  );
80
- this.shadowRoot.innerHTML = r, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.chevronEl = this.shadowRoot.querySelector("mui-icon-right-chevron"), (o = this.summaryEl) == null || o.addEventListener("click", this.toggleAccordion.bind(this)), (n = this.summaryEl) == null || n.addEventListener("keydown", (t) => {
81
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
79
+ this.shadowRoot.innerHTML = t, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.chevronEl = this.shadowRoot.querySelector("mui-icon-right-chevron"), (n = this.summaryEl) == null || n.addEventListener("click", this.toggleAccordion.bind(this)), (r = this.summaryEl) == null || r.addEventListener("keydown", (o) => {
80
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), this.toggleAccordion());
82
81
  });
83
82
  }
84
83
  toggleAccordion() {
@@ -86,7 +85,14 @@ class a extends HTMLElement {
86
85
  const e = this.detailEl.hasAttribute("open");
87
86
  this.detailEl.toggleAttribute("open"), this.chevronEl.toggleAttribute("open"), this.summaryEl.setAttribute("aria-expanded", String(!e));
88
87
  const i = this.detailEl.querySelector(".accordion-detail-inner");
89
- i && (e ? i.setAttribute("inert", "") : i.removeAttribute("inert"));
88
+ if (i)
89
+ if (e)
90
+ i.setAttribute("inert", ""), this.detailEl.style.maxHeight = "0";
91
+ else {
92
+ i.removeAttribute("inert");
93
+ const t = this.detailEl.scrollHeight;
94
+ this.detailEl.style.maxHeight = t + "px";
95
+ }
90
96
  }
91
97
  }
92
98
  customElements.get("mui-accordion-inline") || customElements.define("mui-accordion-inline", a);
@@ -47,16 +47,20 @@ class v extends HTMLElement {
47
47
  button:hover {
48
48
  background: var(--action-primary-background-hover);
49
49
  color: var(--action-primary-text-color-hover);
50
+ border: var(--action-primary-border-hover);
50
51
  }
51
52
 
52
53
  button:focus-visible {
53
54
  background: var(--action-primary-background-focus);
54
55
  color: var(--action-primary-text-color-focus);
56
+ border: var(--action-primary-border-focus);
55
57
  }
56
58
 
57
59
  button:disabled {
58
60
  background: var(--action-primary-background-disabled);
59
61
  color: var(--action-primary-text-color-disabled);
62
+ border: var(--action-primary-border-disabled);
63
+ cursor: not-allowed;
60
64
  }
61
65
 
62
66
  button, button:before, button:after {box-sizing: border-box;}
@@ -65,6 +69,12 @@ class v extends HTMLElement {
65
69
  outline: var(--outline-thick);
66
70
  }
67
71
 
72
+ :host button ::slotted(.mui-icon) { fill: var(--action-primary-text-color); }
73
+ :host button:hover ::slotted(.mui-icon) { fill: var(--action-primary-text-color-hover); }
74
+ :host button:focus-visible ::slotted(.mui-icon) { fill: var(--action-primary-text-color-focus); }
75
+ :host button:disabled ::slotted(.mui-icon) { fill: var(--action-primary-text-color-disabled); }
76
+
77
+
68
78
  /* Primary
69
79
  ========================================= */
70
80
  :host([variant="primary"]) button {
@@ -92,10 +102,10 @@ class v extends HTMLElement {
92
102
  cursor: not-allowed;
93
103
  }
94
104
 
95
- :host([variant="primary"]) ::slotted(.mui-icon) { fill: var(--action-primary-text-color); }
96
- :host([variant="primary"]):hover ::slotted(.mui-icon) { fill: var(--action-primary-text-color-hover); }
97
- :host([variant="primary"]):focus-visible ::slotted(.mui-icon) { fill: var(--action-primary-text-color-focus); }
98
- :host([variant="primary"]):disabled ::slotted(.mui-icon) { fill: var(--action-primary-text-color-disabled); }
105
+ :host([variant="primary"]) button ::slotted(.mui-icon) { fill: var(--action-primary-text-color); }
106
+ :host([variant="primary"]) button:hover ::slotted(.mui-icon) { fill: var(--action-primary-text-color-hover); }
107
+ :host([variant="primary"]) button:focus-visible ::slotted(.mui-icon) { fill: var(--action-primary-text-color-focus); }
108
+ :host([variant="primary"]) button:disabled ::slotted(.mui-icon) { fill: var(--action-primary-text-color-disabled); }
99
109
 
100
110
  /* Secondary
101
111
  ========================================= */
@@ -125,10 +135,10 @@ class v extends HTMLElement {
125
135
  cursor: not-allowed;
126
136
  }
127
137
 
128
- :host([variant="secondary"]) ::slotted(.mui-icon) { fill: var(--action-secondary-text-color); }
129
- :host([variant="secondary"]):hover ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-hover); }
130
- :host([variant="secondary"]):focus-visible ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-focus); }
131
- :host([variant="secondary"]):disabled ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-disabled); }
138
+ :host([variant="secondary"]) button ::slotted(.mui-icon) { fill: var(--action-secondary-text-color); }
139
+ :host([variant="secondary"]) button:hover ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-hover); }
140
+ :host([variant="secondary"]) button:focus-visible ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-focus); }
141
+ :host([variant="secondary"]) button:disabled ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-disabled); }
132
142
 
133
143
  /* Tertiary
134
144
  ========================================= */
@@ -158,10 +168,10 @@ class v extends HTMLElement {
158
168
  cursor: not-allowed;
159
169
  }
160
170
 
161
- :host([variant="tertiary"]) ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color); }
162
- :host([variant="tertiary"]):hover ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-hover); }
163
- :host([variant="tertiary"]):focus-visible ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-focus); }
164
- :host([variant="tertiary"]):disabled ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-disabled); }
171
+ :host([variant="tertiary"]) button ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color); }
172
+ :host([variant="tertiary"]) button:hover ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-hover); }
173
+ :host([variant="tertiary"]) button:focus-visible ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-focus); }
174
+ :host([variant="tertiary"]) button:disabled ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-disabled); }
165
175
 
166
176
  /* Attention
167
177
  ========================================= */
@@ -190,10 +200,10 @@ class v extends HTMLElement {
190
200
  cursor: not-allowed;
191
201
  }
192
202
 
193
- :host([variant="attention"]) ::slotted(.mui-icon) { fill: var(--action-attention-text-color); }
194
- :host([variant="attention"]):hover ::slotted(.mui-icon) { fill: var(--action-attention-text-color-hover); }
195
- :host([variant="attention"]):focus-visible ::slotted(.mui-icon) { fill: var(--action-attention-text-color-focus); }
196
- :host([variant="attention"]):disabled ::slotted(.mui-icon) { fill: var(--action-attention-text-color-disabled); }
203
+ :host([variant="attention"]) button ::slotted(.mui-icon) { fill: var(--action-attention-text-color); }
204
+ :host([variant="attention"]) button:hover ::slotted(.mui-icon) { fill: var(--action-attention-text-color-hover); }
205
+ :host([variant="attention"]) button:focus-visible ::slotted(.mui-icon) { fill: var(--action-attention-text-color-focus); }
206
+ :host([variant="attention"]) button:disabled ::slotted(.mui-icon) { fill: var(--action-attention-text-color-disabled); }
197
207
 
198
208
  /* Icon only
199
209
  ========================================= */
@@ -300,6 +310,26 @@ class v extends HTMLElement {
300
310
  fill: var(--alert-icon);
301
311
  }
302
312
 
313
+ /* Dropdown Slot */
314
+ :host(.dropdown-slot) button {
315
+ border-radius: var(--radius-000);
316
+ }
317
+
318
+ :host(.dropdown-slot) button:hover,
319
+ :host(.dropdown-slot) button:focus {
320
+ background: var(--dropdown-button-background-hover);
321
+ }
322
+
323
+ :host(.dropdown-slot-first) button {
324
+ border-top-left-radius: calc(var(--radius-100) / 2);
325
+ border-top-right-radius: calc(var(--radius-100) / 2);
326
+ }
327
+
328
+ :host(.dropdown-slot-last) button {
329
+ border-bottom-left-radius: calc(var(--radius-100) / 2);
330
+ border-bottom-right-radius: calc(var(--radius-100) / 2);
331
+ }
332
+
303
333
 
304
334
  /* Before & After Icon
305
335
  ========================================= */
@@ -346,11 +376,11 @@ class v extends HTMLElement {
346
376
  this.shadowRoot.innerHTML = a, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
347
377
  const e = this.shadowRoot;
348
378
  if (!e) return;
349
- const n = e.querySelector("slot:not([name])"), l = e.querySelector('slot[name="before"]'), d = e.querySelector('slot[name="after"]'), s = (t) => t ? t.assignedNodes({ flatten: !0 }).some((o) => {
379
+ const i = e.querySelector("slot:not([name])"), d = e.querySelector('slot[name="before"]'), l = e.querySelector('slot[name="after"]'), s = (t) => t ? t.assignedNodes({ flatten: !0 }).some((o) => {
350
380
  var r;
351
381
  return o.nodeType === Node.ELEMENT_NODE || o.nodeType === Node.TEXT_NODE && !!((r = o.textContent) != null && r.trim());
352
- }) : !1, b = s(l), u = s(d);
353
- this.classList.toggle("has-before", b), this.classList.toggle("has-after", u), ((n == null ? void 0 : n.assignedNodes({ flatten: !0 })) ?? []).every((t) => {
382
+ }) : !1, b = s(d), u = s(l);
383
+ this.classList.toggle("has-before", b), this.classList.toggle("has-after", u), ((i == null ? void 0 : i.assignedNodes({ flatten: !0 })) ?? []).every((t) => {
354
384
  var o;
355
385
  if (t.nodeType === Node.ELEMENT_NODE) {
356
386
  const r = t;
@@ -361,10 +391,10 @@ class v extends HTMLElement {
361
391
  });
362
392
  }
363
393
  waitForPartMap() {
364
- return new Promise((i) => {
365
- if (typeof c == "function") return i();
394
+ return new Promise((n) => {
395
+ if (typeof c == "function") return n();
366
396
  const a = () => {
367
- typeof c == "function" ? i() : requestAnimationFrame(a);
397
+ typeof c == "function" ? n() : requestAnimationFrame(a);
368
398
  };
369
399
  a();
370
400
  });
@@ -0,0 +1,103 @@
1
+ import "../mui-icons/close/index.js";
2
+ import "../mui-button/index.js";
3
+ class l extends HTMLElement {
4
+ static get observedAttributes() {
5
+ return ["open", "width"];
6
+ }
7
+ constructor() {
8
+ super(), this.attachShadow({ mode: "open" });
9
+ }
10
+ connectedCallback() {
11
+ var a;
12
+ if (!this.shadowRoot) return;
13
+ const s = (
14
+ /*css*/
15
+ `
16
+ dialog {
17
+ border: none;
18
+ width: ${this.getAttribute("width") || "350px"};
19
+ max-width: 90vw;
20
+ padding: 0;
21
+ overflow: hidden;
22
+ border-radius: var(--dialog-radius);
23
+ background: var(--surface-elevated-100);
24
+ }
25
+
26
+ dialog,
27
+ dialog:focus,
28
+ dialog:focus-visible {
29
+ outline: none;
30
+ }
31
+
32
+ dialog::backdrop {
33
+ background: var(--backdrop-overlay);
34
+ }
35
+
36
+ header {
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ padding: var(--space-400) var(--space-400) var(--space-400) var(--space-500);
41
+ border-bottom: var(--border-thin);
42
+ }
43
+
44
+ main {
45
+ max-height: 60vh;
46
+ overflow-y: auto;
47
+ padding: var(--space-500);
48
+ }
49
+
50
+ footer {
51
+ display: flex;
52
+ justify-content: flex-end;
53
+ padding: var(--space-400) var(--space-500);
54
+ border-top: var(--border-thin);
55
+ gap: var(--space-300);
56
+ }
57
+
58
+ footer[hidden] {
59
+ display: none !important;
60
+ }
61
+ `
62
+ );
63
+ this.shadowRoot.innerHTML = /*html*/
64
+ `
65
+ <style>${s}</style>
66
+ <dialog>
67
+ <header>
68
+ <slot name="title"></slot>
69
+ <mui-button class="close" aria-label="Close" variant="tertiary"><mui-icon-close></mui-icon-close></mui-button>
70
+ </header>
71
+ <main>
72
+ <slot></slot>
73
+ </main>
74
+ <footer hidden>
75
+ <slot name="actions"></slot>
76
+ </footer>
77
+ </dialog>
78
+ `, this.dialogEl = this.shadowRoot.querySelector("dialog"), this.footerEl = this.shadowRoot.querySelector("footer"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]');
79
+ const e = this.shadowRoot.querySelector(".close");
80
+ e == null || e.addEventListener("click", () => this.close()), this.dialogEl.addEventListener("click", (i) => {
81
+ const o = this.dialogEl.getBoundingClientRect();
82
+ i.clientX >= o.left && i.clientX <= o.right && i.clientY >= o.top && i.clientY <= o.bottom || this.close();
83
+ }), (a = this.actionsSlot) == null || a.addEventListener("slotchange", () => this.updateFooterVisibility()), this.updateFooterVisibility(), this.syncOpenState();
84
+ }
85
+ updateFooterVisibility() {
86
+ if (!this.footerEl || !this.actionsSlot) return;
87
+ const t = this.actionsSlot.assignedElements().length > 0;
88
+ this.footerEl.hidden = !t;
89
+ }
90
+ attributeChangedCallback(t, s, e) {
91
+ t === "open" && this.syncOpenState(), t === "width" && this.dialogEl && (this.dialogEl.style.width = e || "350px");
92
+ }
93
+ syncOpenState() {
94
+ this.dialogEl && (this.hasAttribute("open") ? this.dialogEl.open || this.dialogEl.showModal() : this.dialogEl.open && this.dialogEl.close());
95
+ }
96
+ open() {
97
+ this.setAttribute("open", "");
98
+ }
99
+ close() {
100
+ this.removeAttribute("open");
101
+ }
102
+ }
103
+ customElements.get("mui-dialog") || customElements.define("mui-dialog", l);