@muibook/components 3.1.0 → 4.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 (28) hide show
  1. package/dist/esm/components/mui-accordion/block/index.js +26 -9
  2. package/dist/esm/components/mui-accordion/core/index.js +75 -0
  3. package/dist/esm/components/mui-accordion/index.js +1 -0
  4. package/dist/esm/components/mui-badge/index.js +9 -4
  5. package/dist/esm/components/mui-card/body/index.js +31 -17
  6. package/dist/esm/components/mui-card/footer/index.js +17 -11
  7. package/dist/esm/components/mui-chip/index.js +179 -0
  8. package/dist/esm/components/mui-code/index.js +7 -2
  9. package/dist/esm/components/mui-icons/gear/index.js +55 -0
  10. package/dist/esm/components/mui-icons/index.js +1 -0
  11. package/dist/esm/components/mui-icons/toggle/index.js +23 -13
  12. package/dist/esm/components/mui-link/index.js +29 -17
  13. package/dist/esm/components/mui-rule/index.js +14 -14
  14. package/dist/esm/components/mui-slat/group/index.js +136 -0
  15. package/dist/esm/components/mui-slat/index.js +1 -0
  16. package/dist/esm/css/mui-base.css +22 -42
  17. package/dist/esm/css/mui-reset.css +27 -22
  18. package/dist/esm/css/mui-tokens.css +30 -0
  19. package/dist/esm/index.js +8 -4
  20. package/dist/types/components/mui-accordion/core/index.d.ts +1 -0
  21. package/dist/types/components/mui-accordion/index.d.ts +1 -0
  22. package/dist/types/components/mui-chip/index.d.ts +1 -0
  23. package/dist/types/components/mui-icons/gear.d.ts +1 -0
  24. package/dist/types/components/mui-icons/index.d.ts +1 -0
  25. package/dist/types/components/mui-slat/group/index.d.ts +1 -0
  26. package/dist/types/components/mui-slat/index.d.ts +1 -0
  27. package/dist/types/index.d.ts +4 -0
  28. package/package.json +17 -1
@@ -1,14 +1,14 @@
1
1
  import "../../mui-icons/down-chevron/index.js";
2
2
  import "../../mui-heading/index.js";
3
- class c extends HTMLElement {
3
+ 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
7
  connectedCallback() {
8
- var o, r;
8
+ var s, r;
9
9
  if (!this.shadowRoot) return;
10
- const i = this.getAttribute("heading") || "Heading...", e = this.getAttribute("size") || "medium", s = this.getAttribute("level") || "3", a = this.getAttribute("detail-space"), n = a ? `detail-space-${a}` : "";
11
- let d = (
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}` : "";
11
+ let m = (
12
12
  /*html*/
13
13
  `
14
14
  <style>
@@ -119,6 +119,15 @@ class c extends HTMLElement {
119
119
  padding-right: var(--space-600);
120
120
  }
121
121
  }
122
+ :host(.card-slot) .detail-space-none {
123
+ padding: 0;
124
+ }
125
+ @media (min-width: 768px) {
126
+ :host(.card-slot) .detail-space-none {
127
+ padding: 0;
128
+ }
129
+ }
130
+
122
131
 
123
132
  </style>
124
133
 
@@ -129,25 +138,33 @@ class c extends HTMLElement {
129
138
  aria-expanded="false"
130
139
  aria-controls="${this.accordionId}"
131
140
  >
132
- <mui-heading size="6" level="${s}">${i}</mui-heading>
141
+ <mui-heading size="6" level="${l}">${i}</mui-heading>
133
142
  <div class="icon">
134
143
  <mui-icon-down-chevron size="x-small"></mui-icon-down-chevron>
135
144
  </div>
136
145
  </div>
137
146
 
138
147
  <div id="${this.accordionId}" class="accordion-detail">
139
- <div class="accordion-detail-inner size-${e}-detail ${n}" inert>
148
+ <div class="accordion-detail-inner size-${e}-detail ${h}" inert>
140
149
  <slot name="detail">Insert Content</slot>
141
150
  </div>
142
151
  </div>
143
152
 
144
153
  `
145
154
  );
146
- if (this.shadowRoot.innerHTML = d, 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) {
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");
161
+ });
162
+ });
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) {
147
164
  console.error("Accordion elements not found");
148
165
  return;
149
166
  }
150
- (o = this.summaryEl) == null || o.addEventListener("click", () => this.toggleAccordion()), (r = this.summaryEl) == null || r.addEventListener("keydown", (t) => {
167
+ (s = this.summaryEl) == null || s.addEventListener("click", () => this.toggleAccordion()), (r = this.summaryEl) == null || r.addEventListener("keydown", (t) => {
151
168
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
152
169
  });
153
170
  }
@@ -165,4 +182,4 @@ class c extends HTMLElement {
165
182
  this.setOpen(!1);
166
183
  }
167
184
  }
168
- customElements.get("mui-accordion-block") || customElements.define("mui-accordion-block", c);
185
+ customElements.get("mui-accordion-block") || customElements.define("mui-accordion-block", u);
@@ -0,0 +1,75 @@
1
+ class l extends HTMLElement {
2
+ constructor() {
3
+ super(), this.attachShadow({ mode: "open" });
4
+ }
5
+ static get observedAttributes() {
6
+ return ["open"];
7
+ }
8
+ get open() {
9
+ return this.hasAttribute("open");
10
+ }
11
+ set open(t) {
12
+ t ? this.setAttribute("open", "") : this.removeAttribute("open");
13
+ }
14
+ connectedCallback() {
15
+ var r, n;
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 = `
21
+ :host {
22
+ display: block;
23
+ }
24
+ .accordion-summary {
25
+ cursor: pointer;
26
+ display: flex;
27
+ align-items: center;
28
+ outline-offset: 2px;
29
+ border-radius: inherit;
30
+ }
31
+ .accordion-summary:focus-visible {
32
+ outline: var(--outline-thick);
33
+ }
34
+ .accordion-detail {
35
+ max-height: 0;
36
+ overflow: hidden;
37
+ transition: max-height 0.3s ease;
38
+ }
39
+ .accordion-detail[open] {
40
+ max-height: 200vh;
41
+ }
42
+ `;
43
+ if (this.shadowRoot.innerHTML = /* html */
44
+ `
45
+ <style>${i}</style>
46
+ <div class="accordion-summary" tabindex="0" role="button" aria-expanded="false">
47
+ <slot name="summary"></slot>
48
+ </div>
49
+ <div class="accordion-detail" role="region" aria-hidden="true">
50
+ <slot name="detail"></slot>
51
+ </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"));
55
+ }
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());
58
+ }), this.hasAttribute("open") && this.openAccordion();
59
+ }
60
+ attributeChangedCallback(t, s, i) {
61
+ t === "open" && this.detailEl && this.summaryEl && (i !== null ? this.openAccordion() : this.closeAccordion());
62
+ }
63
+ toggleAccordion() {
64
+ this.open = !this.open;
65
+ }
66
+ 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")));
69
+ }
70
+ 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")));
73
+ }
74
+ }
75
+ customElements.get("mui-accordion-core") || customElements.define("mui-accordion-core", l);
@@ -1,3 +1,4 @@
1
+ import "./core/index.js";
1
2
  import "./block/index.js";
2
3
  import "./inline/index.js";
3
4
  import "./group/index.js";
@@ -12,17 +12,17 @@ class n extends HTMLElement {
12
12
  this.render();
13
13
  }
14
14
  render() {
15
- const t = this.getAttribute("variant") || "neutral", e = {
15
+ const t = this.getAttribute("variant") || "neutral", a = {
16
16
  neutral: "var(--badge-background-neutral)",
17
17
  positive: "var(--badge-background-positive)",
18
18
  warning: "var(--badge-background-warning)",
19
19
  attention: "var(--badge-background-attention)"
20
- }, a = {
20
+ }, e = {
21
21
  neutral: "off",
22
22
  positive: "polite",
23
23
  warning: "assertive",
24
24
  attention: "assertive"
25
- }, r = e[t], i = a[t], s = (
25
+ }, r = a[t], i = e[t], s = (
26
26
  /*css*/
27
27
  `
28
28
  :host {
@@ -32,7 +32,12 @@ class n extends HTMLElement {
32
32
  font-size: var(--text-font-size-xs);
33
33
  font-weight: var(--badge-font-weight);
34
34
  color: var(--badge-text-color);
35
- padding: var(--space-050) var(--space-200);
35
+ padding: var(--space-100) var(--space-200);
36
+ line-height: 1;
37
+ }
38
+
39
+ :host([usage="slat-end"]) {
40
+ margin-right: calc(-1 * var(--space-200));
36
41
  }
37
42
  `
38
43
  );
@@ -1,10 +1,10 @@
1
- class d extends HTMLElement {
1
+ class u extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" });
4
4
  }
5
5
  connectedCallback() {
6
6
  if (!this.shadowRoot) return;
7
- const r = (
7
+ const l = (
8
8
  /*html*/
9
9
  `
10
10
  <style>
@@ -21,32 +21,46 @@ class d extends HTMLElement {
21
21
  padding: var(--space-600);
22
22
  }
23
23
  }
24
+
25
+ :host(.has-card-slat-group) {
26
+ padding-bottom: var(--space-200);
27
+ }
28
+ @media (min-width: 768px) {
29
+ :host(.has-card-slat-group) {
30
+ padding-bottom: var(--space-500);
31
+ }
32
+ }
33
+
24
34
  </style>
25
35
  <slot></slot>
26
36
  `
27
37
  );
28
- this.shadowRoot.innerHTML = r, requestAnimationFrame(() => {
38
+ this.shadowRoot.innerHTML = l, requestAnimationFrame(() => {
29
39
  if (!this.shadowRoot) return;
30
40
  const a = this.shadowRoot.querySelector("slot");
31
41
  if (!a) return;
32
- const l = a.assignedNodes({ flatten: !0 });
33
- let s = !1;
34
- l.forEach((c) => {
42
+ const d = a.assignedNodes({ flatten: !0 });
43
+ let e = !1;
44
+ d.forEach((c) => {
35
45
  if (c.nodeType === Node.ELEMENT_NODE) {
36
46
  const t = c, i = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
37
- i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((e) => {
38
- e.classList.add("card-slot");
39
- }), s = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((o) => {
40
- const e = o.getAttribute("variant");
41
- (e === "action" || e === "row") && (o.classList.add("card-slot"), this.hasAttribute("condensed") && o.classList.add("condensed-slot"));
47
+ i instanceof HTMLElement && (i.querySelectorAll("mui-accordion-block").forEach((o) => {
48
+ o.classList.add("card-slot");
49
+ }), e = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((s) => {
50
+ const o = s.getAttribute("variant");
51
+ (o === "action" || o === "row") && (s.classList.add("card-slot"), this.hasAttribute("condensed") && s.classList.add("condensed-slot"));
42
52
  });
43
- const n = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
44
- n instanceof HTMLElement && (n.querySelectorAll("mui-cell").forEach((e) => {
45
- e.classList.add("card-slot");
46
- }), s = !0);
53
+ const r = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
54
+ r instanceof HTMLElement && (r.querySelectorAll("mui-cell").forEach((o) => {
55
+ o.classList.add("card-slot");
56
+ }), e = !0);
57
+ const n = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
58
+ n.length && (e = !0, n.forEach((s) => {
59
+ s.setAttribute("usage", "card"), s.closest("mui-accordion-block") ? this.classList.add("has-accordion-slat-group") : this.classList.add("inner-space", "has-card-slat-group");
60
+ }));
47
61
  }
48
- }), !s && !this.hasAttribute("condensed") && this.classList.add("inner-space");
62
+ }), !e && !this.hasAttribute("condensed") && this.classList.add("inner-space");
49
63
  });
50
64
  }
51
65
  }
52
- customElements.get("mui-card-body") || customElements.define("mui-card-body", d);
66
+ customElements.get("mui-card-body") || customElements.define("mui-card-body", u);
@@ -1,10 +1,10 @@
1
- class d extends HTMLElement {
1
+ class c extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" });
4
4
  }
5
5
  connectedCallback() {
6
6
  if (!this.shadowRoot) return;
7
- const i = (
7
+ const u = (
8
8
  /*html*/
9
9
  `
10
10
  <style>
@@ -32,31 +32,37 @@ class d extends HTMLElement {
32
32
  border-bottom-right-radius: calc(var(--card-radius) - 1px);
33
33
  border-bottom-left-radius: calc(var(--card-radius) - 1px);
34
34
  }
35
+
36
+ :host(.has-button-group) {
37
+ padding-top: 0;
38
+ }
39
+
40
+
35
41
  </style>
36
42
  <slot></slot>
37
43
  `
38
44
  );
39
- this.shadowRoot.innerHTML = i, requestAnimationFrame(() => {
45
+ this.shadowRoot.innerHTML = u, requestAnimationFrame(() => {
40
46
  if (!this.shadowRoot) return;
41
47
  const s = this.shadowRoot.querySelector("slot");
42
48
  if (!s) return;
43
49
  const r = s.assignedNodes({ flatten: !0 }).filter((e) => {
44
- var t;
45
- return e.nodeType === Node.ELEMENT_NODE || e.nodeType === Node.TEXT_NODE && ((t = e.textContent) == null ? void 0 : t.trim()) !== "";
50
+ var o;
51
+ return e.nodeType === Node.ELEMENT_NODE || e.nodeType === Node.TEXT_NODE && ((o = e.textContent) == null ? void 0 : o.trim()) !== "";
46
52
  });
47
53
  if (r.length === 0) {
48
54
  this.classList.add("hidden");
49
55
  return;
50
56
  }
51
- let a = !1;
57
+ let a = !1, i = !1;
52
58
  r.forEach((e) => {
53
- var t;
59
+ var o, d;
54
60
  if (e.nodeType === Node.ELEMENT_NODE) {
55
- const o = e;
56
- (o.tagName.toLowerCase() === "mui-code" || (t = o.querySelector) != null && t.call(o, "mui-code")) && (a = !0);
61
+ const t = e, n = t.tagName.toLowerCase();
62
+ (n === "mui-code" || (o = t.querySelector) != null && o.call(t, "mui-code")) && (a = !0), (n === "mui-button-group" || (d = t.querySelector) != null && d.call(t, "mui-button-group")) && (i = !0);
57
63
  }
58
- }), a || this.classList.add("inner-space");
64
+ }), a || this.classList.add("inner-space"), i && this.classList.add("has-button-group");
59
65
  });
60
66
  }
61
67
  }
62
- customElements.get("mui-card-footer") || customElements.define("mui-card-footer", d);
68
+ customElements.get("mui-card-footer") || customElements.define("mui-card-footer", c);
@@ -0,0 +1,179 @@
1
+ class d extends HTMLElement {
2
+ constructor() {
3
+ super(), this.attachShadow({ mode: "open" });
4
+ }
5
+ static get observedAttributes() {
6
+ return ["active", "usage", "dismiss"];
7
+ }
8
+ connectedCallback() {
9
+ this.render(), this.updateIconSlots(), !this.hasAttribute("tabindex") && !this.hasAttribute("dismiss") ? this.setAttribute("tabindex", "0") : this.hasAttribute("dismiss") && this.removeAttribute("tabindex"), this.addEventListener("keydown", (t) => {
10
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
11
+ });
12
+ }
13
+ attributeChangedCallback() {
14
+ this.render(), this.updateIconSlots();
15
+ }
16
+ updateIconSlots() {
17
+ requestAnimationFrame(() => {
18
+ const t = this.shadowRoot;
19
+ if (!t) return;
20
+ const e = t.querySelector('slot[name="before"]'), i = t.querySelector('slot[name="after"]'), r = (o) => o ? o.assignedNodes({ flatten: !0 }).some((a) => {
21
+ var s;
22
+ return a.nodeType === Node.ELEMENT_NODE || a.nodeType === Node.TEXT_NODE && !!((s = a.textContent) != null && s.trim());
23
+ }) : !1, c = r(e), n = r(i);
24
+ this.classList.toggle("has-before", c), this.classList.toggle("has-after", n);
25
+ });
26
+ }
27
+ render() {
28
+ var e;
29
+ const t = (
30
+ /*css*/
31
+ `
32
+ :host {
33
+ display: inline-grid;
34
+ align-items: center;
35
+ height: 4rem;
36
+ box-sizing: border-box;
37
+ border: var(--border-thin);
38
+ padding: var(--space-100) var(--space-400);
39
+ gap: var(--space-200);
40
+ background: var(--chip-background);
41
+ border-color: var(--chip-border-color);
42
+ border-radius: var(--chip-radius);
43
+ }
44
+
45
+ /* CLICKABLE */
46
+ :host([variant="clickable"]) {
47
+ cursor: pointer;
48
+ transition: border-color var(--speed-200), background-color var(--speed-200);
49
+ }
50
+
51
+ /* Before & After Slot
52
+ ========================================= */
53
+
54
+ :host([variant="clickable"].has-after.has-before) {
55
+ grid-template-columns: auto 1fr auto;
56
+ padding-right: var(--space-200);
57
+ padding-left: var(--space-200);
58
+ }
59
+
60
+ :host([variant="clickable"].has-after) {
61
+ grid-template-columns: 1fr auto;
62
+ padding-right: var(--space-200);
63
+ }
64
+
65
+ :host([variant="clickable"].has-before) {
66
+ grid-template-columns: auto 1fr;
67
+ padding-left: var(--space-200);
68
+ }
69
+
70
+ /* Usage: input */
71
+ :host([usage="input"]) {
72
+ border-radius: var(--input-radius);
73
+ }
74
+
75
+ /* Hover and focus (natural) */
76
+ :host([variant="clickable"]:hover) {
77
+ background: var(--chip-background-hover);
78
+ border-color: var(--chip-border-color-hover);
79
+ box-shadow: inset 0 0 0 1px var(--chip-border-color-hover);
80
+ }
81
+
82
+ :host([variant="clickable"]:focus) {
83
+ outline: none;
84
+ }
85
+
86
+ :host([variant="clickable"]:focus-visible) {
87
+ background: var(--chip-background-focus);
88
+ border-color: var(--chip-border-color-focus);
89
+ outline: var(--outline-thick);
90
+ }
91
+
92
+ /* Active: mouse down OR programmatic */
93
+ :host([variant="clickable"]:active),
94
+ :host([variant="clickable"][active]) {
95
+ background: var(--chip-background-active);
96
+ box-shadow: inset 0 0 0 1px var(--chip-border-color-active);
97
+ border-color: var(--chip-border-color-active);
98
+ }
99
+
100
+ :host([variant="clickable"]:active) mui-body::part(color),
101
+ :host([variant="clickable"][active]) mui-body::part(color) {
102
+ color: var(--chip-text-color-active);
103
+ }
104
+
105
+ ::slotted(.mui-icon) {
106
+ box-sizing: border-box;
107
+ padding: var(--space-025);
108
+ width: var(--space-500);
109
+ height: var(--space-500);
110
+ fill: var(--chip-icon-fill);
111
+ }
112
+
113
+ :host(.has-before) ::slotted(.mui-icon) {
114
+ margin-right: -4px;
115
+ }
116
+
117
+ :host(.has-after) ::slotted(.mui-icon) {
118
+ margin-left: -4px;
119
+ }
120
+
121
+
122
+
123
+ /* DISMISS */
124
+
125
+ /* Disable pointer and focus styles when dismiss attribute is present */
126
+ :host([dismiss]) {
127
+ grid-template-columns: 1fr auto;
128
+ padding-right: calc(var(--space-100) + 0.1rem);
129
+ }
130
+
131
+ /* Has Before */
132
+ :host([dismiss].has-before) {
133
+ grid-template-columns: auto 1fr auto;
134
+ padding-left: var(--space-200);
135
+ }
136
+
137
+ /* Dismiss Icon */
138
+ mui-button::part(background) {
139
+ height: initial;
140
+ width: initial;
141
+ padding: var(--space-025);
142
+ border-radius: var(--radius-400);
143
+ background: var(--chip-dismiss-action-background);
144
+ }
145
+ mui-button::part(background):hover {
146
+ background: var(--chip-dismiss-action-background-hover);
147
+ }
148
+ `
149
+ );
150
+ this.hasAttribute("dismiss") ? (this.shadowRoot.innerHTML = /*html*/
151
+ `
152
+ <style>${t}</style>
153
+ <slot name="before"></slot>
154
+ <mui-body size="small" weight="bold">
155
+ <slot></slot>
156
+ </mui-body>
157
+ <mui-button part="dismiss-btn" variant="tertiary" aria-label="Remove chip">
158
+ <mui-icon-close size="x-small"></mui-icon-close>
159
+ </mui-button>
160
+ `, (e = this.shadowRoot.querySelector('[part="dismiss-btn"]')) == null || e.addEventListener("click", (i) => {
161
+ i.stopPropagation(), this.dispatchEvent(
162
+ new CustomEvent("dismiss", {
163
+ bubbles: !0,
164
+ composed: !0,
165
+ detail: { id: this.id }
166
+ })
167
+ );
168
+ })) : (this.setAttribute("variant", "clickable"), this.shadowRoot.innerHTML = /*html*/
169
+ `
170
+ <style>${t}</style>
171
+ <slot name="before"></slot>
172
+ <mui-body size="small" weight="bold">
173
+ <slot></slot>
174
+ </mui-body>
175
+ <slot name="after"></slot>
176
+ `);
177
+ }
178
+ }
179
+ customElements.get("mui-chip") || customElements.define("mui-chip", d);
@@ -1,4 +1,4 @@
1
- class s extends HTMLElement {
1
+ class i extends HTMLElement {
2
2
  static get observedAttributes() {
3
3
  return ["size", "scrollable"];
4
4
  }
@@ -48,6 +48,11 @@ class s extends HTMLElement {
48
48
  white-space: ${e ? "nowrap" : "wrap"};
49
49
  }
50
50
 
51
+ code:focus-visible {
52
+ outline: ${e ? "var(--outline-thick)" : "none"};
53
+ outline-offset: ${e ? "calc(-1 * var(--stroke-size-500))" : "none"};
54
+ }
55
+
51
56
  @media (min-width: 600px) {
52
57
  code {
53
58
  padding: var(--space-500) var(--space-600);
@@ -63,4 +68,4 @@ class s extends HTMLElement {
63
68
  `;
64
69
  }
65
70
  }
66
- customElements.get("mui-code") || customElements.define("mui-code", s);
71
+ customElements.get("mui-code") || customElements.define("mui-code", i);
@@ -0,0 +1,55 @@
1
+ class s extends HTMLElement {
2
+ static get observedAttributes() {
3
+ return ["size", "color"];
4
+ }
5
+ constructor() {
6
+ super(), this.attachShadow({ mode: "open" });
7
+ }
8
+ connectedCallback() {
9
+ this.render();
10
+ }
11
+ attributeChangedCallback(c, l, t) {
12
+ (c === "size" || c === "color") && l !== t && this.render();
13
+ }
14
+ render() {
15
+ const c = this.getAttribute("size") || "small", l = this.getAttribute("color"), o = l && {
16
+ default: "var(--icon-color-default)",
17
+ inverted: "var(--icon-color-inverted)"
18
+ }[l] || l || "var(--icon-color-default)", e = {
19
+ "x-small": "1.6rem",
20
+ small: "2.4rem",
21
+ medium: "3.6rem",
22
+ large: "4.8rem"
23
+ }, i = e[c] ?? e.small;
24
+ this.classList.add("mui-icon"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
25
+ `
26
+ <style>
27
+ :host {
28
+ width: ${i};
29
+ height: ${i};
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ fill: ${o};
34
+ }
35
+ svg {
36
+ width: 100%;
37
+ display: block;
38
+ fill: inherit;
39
+ }
40
+ </style>
41
+
42
+ <svg
43
+ xmlns="http://www.w3.org/2000/svg"
44
+ viewBox="0 0 36 36"
45
+ >
46
+ <path
47
+ d="M17.25 33.5c-1.332 0-2.427-.858-2.717-2.124l-.448-1.9-.119-.04-1.661 1.017c-1.121.686-2.466.488-3.416-.449l-1.859-1.86c-.976-.963-1.108-2.335-.435-3.43l1.029-1.636-.04-.106-1.886-.448c-1.252-.304-2.096-1.412-2.096-2.731V17.22c0-1.319.83-2.4 2.096-2.717l1.873-.462.04-.106-1.016-1.649c-.686-1.095-.554-2.454.422-3.417l1.872-1.86c.937-.936 2.295-1.134 3.416-.462l1.661 1.016.12-.04.447-1.899c.29-1.253 1.385-2.124 2.717-2.124h2.703c1.332 0 2.427.858 2.717 2.124l.448 1.9.119.04 1.661-1.017c1.121-.686 2.48-.474 3.416.462l1.872 1.86c.976.963 1.108 2.322.422 3.417l-1.015 1.65.04.105 1.872.462c1.266.316 2.097 1.398 2.097 2.717v2.573c0 1.32-.844 2.427-2.097 2.73l-1.886.45-.04.105 1.03 1.636c.672 1.095.54 2.467-.436 3.43l-1.86 1.86c-.949.937-2.294 1.134-3.415.448l-1.661-1.015-.119.04-.448 1.899c-.29 1.266-1.385 2.124-2.717 2.124zm.699-3.47h1.305c.224 0 .304-.105.343-.277l.752-3.18c1.055-.21 1.872-.566 2.782-1.147l2.743 1.689c.158.092.303.105.448-.053l.924-.91c.145-.145.131-.29.04-.436l-1.715-2.77c.54-.844.936-1.808 1.107-2.718l3.192-.752c.171-.04.277-.132.277-.343V17.88c0-.211-.106-.303-.277-.343l-3.192-.752a8.2 8.2 0 0 0-1.094-2.718l1.701-2.77c.092-.145.119-.304-.026-.449l-.937-.91c-.145-.145-.276-.132-.448-.04l-2.756 1.69a7.5 7.5 0 0 0-2.77-1.149l-.75-3.192c-.04-.172-.12-.277-.344-.277H17.95c-.211 0-.304.105-.343.277l-.752 3.18c-.989.21-2.083.659-2.782 1.147l-2.77-1.702c-.17-.092-.303-.092-.448.053l-.923.897c-.158.158-.132.303-.04.448l1.728 2.797a8.3 8.3 0 0 0-1.107 2.731l-3.165.739c-.185.04-.29.132-.29.343v1.253c0 .211.105.304.29.343l3.178.739c.158.937.553 1.847 1.107 2.73l-1.74 2.798c-.08.145-.106.29.04.435l.922.91c.145.145.29.145.449.04l2.782-1.702c.884.58 1.833.976 2.782 1.148l.739 3.18c.04.17.132.276.343.276m.646-6.61a4.923 4.923 0 0 1-4.932-4.92 4.923 4.923 0 0 1 4.932-4.92 4.92 4.92 0 0 1 4.919 4.92 4.92 4.92 0 0 1-4.919 4.92m0-2.968c1.081 0 1.952-.87 1.952-1.952s-.87-1.953-1.952-1.953-1.952.871-1.952 1.953.87 1.953 1.952 1.953"
48
+ ></path>
49
+ </svg>
50
+
51
+
52
+ `);
53
+ }
54
+ }
55
+ customElements.get("mui-icon-gear") || customElements.define("mui-icon-gear", s);
@@ -24,3 +24,4 @@ import "./up-chevron/index.js";
24
24
  import "./warning/index.js";
25
25
  import "./down-arrow-circle/index.js";
26
26
  import "./ellipsis/index.js";
27
+ import "./gear/index.js";
@@ -1,16 +1,25 @@
1
- class o extends HTMLElement {
1
+ class r extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["toggle", "rotate"];
3
+ return ["toggle", "rotate", "size"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
7
7
  }
8
8
  connectedCallback() {
9
- this.classList.add("mui-icon"), this.shadowRoot.innerHTML || this.render(), this.applySmallSize();
10
- const t = this.shadowRoot.querySelector('slot[name="start"]'), e = this.shadowRoot.querySelector('slot[name="end"]');
11
- t.addEventListener("slotchange", () => this.applySmallSize()), e.addEventListener("slotchange", () => this.applySmallSize());
9
+ this.classList.add("mui-icon"), this.shadowRoot.innerHTML || this.render(), this.attributeChangedCallback("size", null, this.getAttribute("size"));
10
+ const t = this.shadowRoot.querySelector('slot[name="start"]'), s = this.shadowRoot.querySelector('slot[name="end"]');
11
+ t.addEventListener("slotchange", () => this.applySize()), s.addEventListener("slotchange", () => this.applySize());
12
12
  }
13
- attributeChangedCallback() {
13
+ attributeChangedCallback(t, s, o) {
14
+ if (t === "size") {
15
+ const e = this.getAttribute("size") || "small", l = {
16
+ "x-small": "1.6rem",
17
+ small: "2.4rem",
18
+ medium: "3.6rem",
19
+ large: "4.8rem"
20
+ }, i = l[e] ?? l.small;
21
+ this.style.setProperty("--icon-toggle-size", i), this.applySize();
22
+ }
14
23
  }
15
24
  get toggle() {
16
25
  return this.hasAttribute("toggle");
@@ -27,10 +36,11 @@ class o extends HTMLElement {
27
36
  /* ------------------------------------------------------------------ */
28
37
  /* PRIVATE: force size="small" on all assigned elements */
29
38
  /* ------------------------------------------------------------------ */
30
- applySmallSize() {
31
- this.shadowRoot.querySelectorAll("slot").forEach((e) => {
32
- e.assignedElements({ flatten: !0 }).forEach((s) => {
33
- s.setAttribute("size", "small");
39
+ applySize() {
40
+ const t = this.getAttribute("size") || "small";
41
+ this.shadowRoot.querySelectorAll("slot").forEach((o) => {
42
+ o.assignedElements({ flatten: !0 }).forEach((e) => {
43
+ (!e.hasAttribute("size") || e.getAttribute("size") === "small") && e.setAttribute("size", t);
34
44
  });
35
45
  });
36
46
  }
@@ -41,8 +51,8 @@ class o extends HTMLElement {
41
51
  :host {
42
52
  display: inline-flex;
43
53
  position: relative;
44
- height: 2.4rem;
45
- width: 2.4rem;
54
+ height: var(--icon-toggle-size, 2.4rem);
55
+ width: var(--icon-toggle-size, 2.4rem);
46
56
  }
47
57
 
48
58
  ::slotted(*) {
@@ -78,4 +88,4 @@ class o extends HTMLElement {
78
88
  `;
79
89
  }
80
90
  }
81
- customElements.get("mui-icon-toggle") || customElements.define("mui-icon-toggle", o);
91
+ customElements.get("mui-icon-toggle") || customElements.define("mui-icon-toggle", r);