@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,4 +1,4 @@
1
- class c extends HTMLElement {
1
+ class a extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" });
4
4
  }
@@ -12,7 +12,7 @@ class c extends HTMLElement {
12
12
  e ? this.setAttribute("open", "") : this.removeAttribute("open");
13
13
  }
14
14
  connectedCallback() {
15
- var n, a;
15
+ var r, n;
16
16
  if (!this.shadowRoot) return;
17
17
  const e = this.querySelector('[slot="summary"]'), i = this.querySelector('[slot="detail"]');
18
18
  if (!e || !i) return;
@@ -46,23 +46,24 @@ class c extends HTMLElement {
46
46
  <div class="accordion-detail" role="region" aria-hidden="true">
47
47
  <slot name="detail"></slot>
48
48
  </div>
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 = () => {
49
+ `, this.summaryEl = this.shadowRoot.querySelector(".accordion-summary"), this.detailEl = this.shadowRoot.querySelector(".accordion-detail"), this.detailSlotEl = this.shadowRoot.querySelector('slot[name="detail"]');
50
+ const o = () => {
51
51
  this.open && this.detailEl && (this.detailEl.style.maxHeight = this.detailEl.scrollHeight + "px");
52
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();
53
+ if (Array.from(this.detailSlotEl.assignedElements({ flatten: !1 })).forEach((t) => {
54
+ new ResizeObserver(o).observe(t);
55
+ }), this.detailSlotEl.addEventListener("slotchange", () => {
56
+ var t;
57
+ Array.from(((t = this.detailSlotEl) == null ? void 0 : t.assignedElements({ flatten: !1 })) || []).forEach((l) => {
58
+ new ResizeObserver(o).observe(l);
59
+ }), this.syncDetailInert(), o();
59
60
  }), 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"));
61
+ const t = e.querySelector("mui-icon-right-chevron"), l = e.querySelector("mui-icon-down-chevron");
62
+ t ? (this.chevronEl = t, t.setAttribute("data-icon-animation", "accordion-inline")) : l && (this.chevronEl = l, l.setAttribute("data-icon-animation", "accordion-block"));
62
63
  }
63
- (n = this.summaryEl) == null || n.addEventListener("click", () => this.toggleAccordion()), (a = this.summaryEl) == null || a.addEventListener("keydown", (t) => {
64
+ (r = this.summaryEl) == null || r.addEventListener("click", () => this.toggleAccordion()), (n = this.summaryEl) == null || n.addEventListener("keydown", (t) => {
64
65
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleAccordion());
65
- }), this.hasAttribute("open") && this.openAccordion();
66
+ }), this.hasAttribute("open") ? this.openAccordion() : this.syncDetailInert();
66
67
  }
67
68
  attributeChangedCallback(e, i, s) {
68
69
  e === "open" && this.detailEl && this.summaryEl && (s !== null ? this.openAccordion() : this.closeAccordion());
@@ -74,11 +75,18 @@ class c extends HTMLElement {
74
75
  var i;
75
76
  if (!this.detailEl || !this.summaryEl) return;
76
77
  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"));
78
+ 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.syncDetailInert(), this.iconToggleEl && (this.iconToggleEl.toggle = !0, this.iconToggleEl.setAttribute("aria-pressed", "true"));
78
79
  }
79
80
  closeAccordion() {
80
81
  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")));
82
+ !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.syncDetailInert(), this.iconToggleEl && (this.iconToggleEl.toggle = !1, this.iconToggleEl.setAttribute("aria-pressed", "false")));
83
+ }
84
+ syncDetailInert() {
85
+ var s;
86
+ const e = this.hasAttribute("open");
87
+ (((s = this.detailSlotEl) == null ? void 0 : s.assignedElements({ flatten: !1 })) || []).forEach((o) => {
88
+ o instanceof HTMLElement && o.toggleAttribute("inert", !e);
89
+ });
82
90
  }
83
91
  }
84
- customElements.get("mui-accordion-core") || customElements.define("mui-accordion-core", c);
92
+ customElements.get("mui-accordion-core") || customElements.define("mui-accordion-core", a);
@@ -1,4 +1,4 @@
1
- class s extends HTMLElement {
1
+ class a extends HTMLElement {
2
2
  static get observedAttributes() {
3
3
  return ["slot", "size"];
4
4
  }
@@ -16,8 +16,8 @@ class s extends HTMLElement {
16
16
  const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
17
17
  if (!t) return;
18
18
  const i = this.getAttribute("size") || "medium";
19
- t.assignedElements({ flatten: !0 }).forEach((o) => {
20
- o.tagName.toLowerCase() === "mui-body" && o.setAttribute("size", i);
19
+ t.assignedElements({ flatten: !0 }).forEach((s) => {
20
+ s.tagName.toLowerCase() === "mui-body" && s.setAttribute("size", i);
21
21
  });
22
22
  }
23
23
  render() {
@@ -30,32 +30,32 @@ class s extends HTMLElement {
30
30
  align-items: center;
31
31
  justify-content: center;
32
32
  box-sizing: border-box;
33
- min-height: 4.4rem;
33
+ min-height: var(--action-size-medium);
34
34
  padding: var(--space-200) var(--space-400);
35
35
  background: var(--addon-background);
36
36
  border: var(--border-thin);
37
37
  border-color: var(--form-default-border-color);
38
- min-width: 4.4rem;
38
+ min-width: var(--action-size-medium);
39
39
  white-space: nowrap;
40
40
  }
41
41
  :host([size="x-small"]) {
42
- min-height: var(--action-icon-only-size-x-small);
43
- min-width: var(--action-icon-only-size-x-small);
42
+ min-height: var(--action-size-x-small);
43
+ min-width: var(--action-size-x-small);
44
44
  padding: var(--action-padding-x-small);
45
45
  }
46
46
  :host([size="small"]) {
47
- min-height: var(--action-icon-only-size-small);
48
- min-width: var(--action-icon-only-size-small);
47
+ min-height: var(--action-size-small);
48
+ min-width: var(--action-size-small);
49
49
  padding: var(--action-padding-small);
50
50
  }
51
51
  :host([size="medium"]) {
52
- min-height: 4.4rem;
53
- min-width: 4.4rem;
52
+ min-height: var(--action-size-medium);
53
+ min-width: var(--action-size-medium);
54
54
  padding: var(--space-200) var(--space-400);
55
55
  }
56
56
  :host([size="large"]) {
57
- min-height: var(--action-icon-only-size-large);
58
- min-width: var(--action-icon-only-size-large);
57
+ min-height: var(--action-size-large);
58
+ min-width: var(--action-size-large);
59
59
  padding: var(--space-300) var(--space-500);
60
60
  }
61
61
  :host([slot="before"]) {
@@ -75,4 +75,4 @@ class s extends HTMLElement {
75
75
  t == null || t.addEventListener("slotchange", () => this.syncSlottedContent());
76
76
  }
77
77
  }
78
- customElements.get("mui-addon") || customElements.define("mui-addon", s);
78
+ customElements.get("mui-addon") || customElements.define("mui-addon", a);
@@ -1,6 +1,6 @@
1
- class w extends HTMLElement {
1
+ class S extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["label", "image", "size", "background", "background-color"];
3
+ return ["label", "image", "size", "background", "background-color", "status", "status-label"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
@@ -13,28 +13,28 @@ class w extends HTMLElement {
13
13
  }
14
14
  // Check if slot has content
15
15
  hasSlottedContent() {
16
- var a;
17
- const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector("slot");
18
- return e ? e.assignedNodes({ flatten: !0 }).some(
19
- (r) => {
20
- var n;
21
- return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && ((n = r.textContent) == null ? void 0 : n.trim());
16
+ var e;
17
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
18
+ return t ? t.assignedNodes({ flatten: !0 }).some(
19
+ (n) => {
20
+ var o;
21
+ return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && ((o = n.textContent) == null ? void 0 : o.trim());
22
22
  }
23
23
  ) : !1;
24
24
  }
25
25
  // Generate initials from label
26
- getInitials(e) {
27
- if (!e) return "?";
28
- const t = e.trim().split(/\s+/);
29
- let a = t[0][0] ?? "";
30
- return t.length > 1 && (a += t[t.length - 1][0] ?? ""), a.toUpperCase();
26
+ getInitials(t) {
27
+ if (!t) return "?";
28
+ const a = t.trim().split(/\s+/);
29
+ let e = a[0][0] ?? "";
30
+ return a.length > 1 && (e += a[a.length - 1][0] ?? ""), e.toUpperCase();
31
31
  }
32
32
  // Map background prop to token or app-supplied colour
33
33
  getBackgroundCSS() {
34
- const e = this.getAttribute("background") || "neutral", t = this.getAttribute("background-color");
35
- if (t)
36
- return t;
37
- const a = {
34
+ const t = this.getAttribute("background") || "neutral", a = this.getAttribute("background-color");
35
+ if (a)
36
+ return a;
37
+ const e = {
38
38
  neutral: "var(--avatar-background-neutral)",
39
39
  positive: "var(--avatar-background-positive)",
40
40
  warning: "var(--avatar-background-warning)",
@@ -55,56 +55,97 @@ class w extends HTMLElement {
55
55
  blue: "var(--avatar-background-blue)",
56
56
  indigo: "var(--avatar-background-indigo)"
57
57
  };
58
- return a[e] ?? a.neutral;
58
+ return e[t] ?? e.neutral;
59
+ }
60
+ getStatusLabel(t) {
61
+ const a = this.getAttribute("status-label");
62
+ return a || {
63
+ online: "Online",
64
+ active: "Online",
65
+ away: "Away",
66
+ busy: "Busy",
67
+ dnd: "Do not disturb",
68
+ offline: "Offline",
69
+ positive: "Online",
70
+ warning: "Away",
71
+ attention: "Do not disturb",
72
+ neutral: "Offline"
73
+ }[t] || t;
74
+ }
75
+ getStatusBackground(t) {
76
+ const a = {
77
+ online: "var(--avatar-status-background-positive, var(--badge-background-positive))",
78
+ active: "var(--avatar-status-background-positive, var(--badge-background-positive))",
79
+ away: "var(--avatar-status-background-warning, var(--badge-background-warning))",
80
+ busy: "var(--avatar-status-background-attention, var(--badge-background-attention))",
81
+ dnd: "var(--avatar-status-background-attention, var(--badge-background-attention))",
82
+ offline: "var(--avatar-status-background-neutral, var(--badge-background-neutral))",
83
+ positive: "var(--avatar-status-background-positive, var(--badge-background-positive))",
84
+ warning: "var(--avatar-status-background-warning, var(--badge-background-warning))",
85
+ attention: "var(--avatar-status-background-attention, var(--badge-background-attention))",
86
+ neutral: "var(--avatar-status-background-neutral, var(--badge-background-neutral))"
87
+ };
88
+ return a[t] || a.neutral;
59
89
  }
60
90
  render() {
61
- const e = this.getAttribute("label"), t = this.getAttribute("image"), a = (this.getAttribute("size") || "medium").toLowerCase(), r = this.getAttribute("background") || "neutral", n = this.getAttribute("background-color"), l = e || "Avatar", o = this.hasSlottedContent(), i = t && !this._imageFailed && !o, c = !i && !o, h = this.getInitials(e), d = {
91
+ var h;
92
+ const t = this.getAttribute("label"), a = this.getAttribute("image"), e = (this.getAttribute("size") || "medium").toLowerCase(), n = this.getAttribute("background") || "neutral", o = this.getAttribute("background-color"), i = ((h = this.getAttribute("status")) == null ? void 0 : h.trim().toLowerCase()) || "", u = t || "Avatar", s = this.hasSlottedContent(), l = a && !this._imageFailed && !s, d = !l && !s, p = this.getInitials(t), c = {
93
+ "xxx-small": "var(--avatar-xxx-small)",
62
94
  "xx-small": "var(--avatar-xx-small)",
63
95
  "x-small": "var(--avatar-x-small)",
64
96
  small: "var(--avatar-small)",
65
97
  medium: "var(--avatar-medium)",
66
98
  large: "var(--avatar-large)"
67
- }, s = d[a] ?? d.medium, g = {
99
+ }, r = c[e] ?? c.medium, g = {
100
+ "xxx-small": "var(--font-size-10)",
68
101
  "xx-small": "var(--font-size-15)",
69
102
  "x-small": "var(--font-size-100)",
70
103
  small: "var(--font-size-200)",
71
104
  medium: "var(--font-size-300)",
72
105
  large: "var(--font-size-400)"
73
- }, k = g[a] ?? g.medium, u = {
106
+ }, x = g[e] ?? g.medium, v = {
107
+ "xxx-small": "xx-small",
74
108
  "xx-small": "x-small",
75
109
  "x-small": "x-small",
76
110
  small: "small",
77
111
  medium: "medium",
78
112
  large: "large"
79
- }, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m, x = (
113
+ }, w = v[e] ?? v.medium, b = this.getBackgroundCSS(), y = this.getStatusBackground(i), m = i ? this.getStatusLabel(i) : "", $ = n === "neutral" && !o ? `var(--avatar-background-override, ${b})` : b, z = (
80
114
  /*css*/
81
115
  `
82
116
  :host {
83
117
  display: inline-flex;
84
- width: ${s};
85
- height: ${s};
86
- border-radius: ${s};
118
+ position: relative;
119
+ width: ${r};
120
+ height: ${r};
121
+ border-radius: ${r};
122
+ flex: none;
123
+ }
124
+ .avatar-frame {
125
+ display: inline-flex;
126
+ width: 100%;
127
+ height: 100%;
128
+ border-radius: inherit;
87
129
  font-weight: var(--font-weight-bold);
88
130
  letter-spacing: -0.05rem;
89
- font-size: ${k};
90
- color: var(--text-color);
91
- background: ${p};
131
+ font-size: ${x};
132
+ color: var(--avatar-text-color, var(--text-color));
133
+ background: ${$};
92
134
  overflow: hidden;
93
135
  align-items: center;
94
136
  justify-content: center;
95
137
  user-select: none;
96
138
  box-sizing: border-box;
97
- padding: ${c || o ? `calc(${s} * 0.1)` : "0"};
98
- flex: none;
139
+ padding: ${d || s ? `calc(${r} * 0.1)` : "0"};
99
140
  }
100
141
  img {
101
142
  width: 100%;
102
143
  height: 100%;
103
144
  object-fit: cover;
104
- display: ${i ? "block" : "none"};
145
+ display: ${l ? "block" : "none"};
105
146
  }
106
147
  .initials {
107
- display: ${c ? "flex" : "none"};
148
+ display: ${d ? "flex" : "none"};
108
149
  align-items: center;
109
150
  justify-content: center;
110
151
  width: 100%;
@@ -113,27 +154,46 @@ class w extends HTMLElement {
113
154
  text-decoration: none;
114
155
  }
115
156
  slot {
116
- display: ${o ? "flex" : "none"};
157
+ display: ${s ? "flex" : "none"};
117
158
  align-items: center;
118
159
  justify-content: center;
119
160
  width: 100%;
120
161
  height: 100%;
121
162
  }
163
+ ::slotted([class*="mui-icon"]) {
164
+ fill: var(--avatar-icon-color, currentColor);
165
+ }
166
+ .status {
167
+ display: ${i ? "block" : "none"};
168
+ position: absolute;
169
+ right: var(--avatar-status-offset, 0);
170
+ bottom: var(--avatar-status-offset, 0);
171
+ width: var(--avatar-status-size, max(0.8rem, calc(${r} * 0.28)));
172
+ height: var(--avatar-status-size, max(0.8rem, calc(${r} * 0.28)));
173
+ border-radius: 999px;
174
+ background: ${y};
175
+ border: var(--avatar-status-border, var(--stroke-size-200) solid var(--surface));
176
+ box-sizing: border-box;
177
+ pointer-events: none;
178
+ }
122
179
  `
123
180
  );
124
181
  if (this.shadowRoot.innerHTML = `
125
- <style>${x}</style>
126
- ${i ? `<img src="${t}" alt="${l}" />` : ""}
127
- <div class="initials" role="img" aria-label="${l}">${h}</div>
128
- <slot></slot>
129
- `, o && this.shadowRoot.querySelector("slot").assignedElements().forEach((b) => {
130
- b.tagName.toLowerCase().startsWith("mui-icon-") && b.setAttribute("size", f);
131
- }), i && t) {
132
- const v = this.shadowRoot.querySelector("img");
133
- v.onerror = () => {
182
+ <style>${z}</style>
183
+ <span class="avatar-frame">
184
+ ${l ? `<img src="${a}" alt="${u}" />` : ""}
185
+ <div class="initials" role="img" aria-label="${u}">${p}</div>
186
+ <slot></slot>
187
+ </span>
188
+ <span class="status" aria-label="${m}" title="${m}"></span>
189
+ `, s && this.shadowRoot.querySelector("slot").assignedElements().forEach((f) => {
190
+ f.tagName.toLowerCase().startsWith("mui-icon-") && f.setAttribute("size", w);
191
+ }), l && a) {
192
+ const k = this.shadowRoot.querySelector("img");
193
+ k.onerror = () => {
134
194
  this._imageFailed = !0, this.render();
135
195
  };
136
196
  }
137
197
  }
138
198
  }
139
- customElements.get("mui-avatar") || customElements.define("mui-avatar", w);
199
+ customElements.get("mui-avatar") || customElements.define("mui-avatar", S);
@@ -0,0 +1,158 @@
1
+ import "../mui-avatar/index.js";
2
+ import "../mui-body/index.js";
3
+ import "../mui-link/index.js";
4
+ import "../mui-stack/hstack/index.js";
5
+ import "../mui-stack/vstack/index.js";
6
+ const h = {
7
+ "x-small": {
8
+ avatar: "x-small",
9
+ primary: "xx-small",
10
+ secondary: "xx-small"
11
+ },
12
+ small: {
13
+ avatar: "small",
14
+ primary: "x-small",
15
+ secondary: "x-small"
16
+ },
17
+ medium: {
18
+ avatar: "medium",
19
+ primary: "small",
20
+ secondary: "x-small"
21
+ },
22
+ large: {
23
+ avatar: "large",
24
+ primary: "medium",
25
+ secondary: "small"
26
+ }
27
+ };
28
+ class u extends HTMLElement {
29
+ static get observedAttributes() {
30
+ return ["primary", "secondary", "image", "label", "href", "target", "usage", "size"];
31
+ }
32
+ constructor() {
33
+ super(), this.attachShadow({ mode: "open" });
34
+ }
35
+ connectedCallback() {
36
+ this.render();
37
+ }
38
+ attributeChangedCallback() {
39
+ this.render();
40
+ }
41
+ escapeAttribute(t) {
42
+ return (t || "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
43
+ }
44
+ escapeText(t) {
45
+ return (t || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
46
+ }
47
+ getSize() {
48
+ const t = (this.getAttribute("size") || "medium").toLowerCase();
49
+ return t in h ? t : "medium";
50
+ }
51
+ renderAvatar(t) {
52
+ const r = this.getAttribute("image"), c = this.getAttribute("label") || this.getAttribute("primary") || "Profile", e = r ? ` image="${this.escapeAttribute(r)}"` : "";
53
+ return `<mui-avatar size="${t}"${e} label="${this.escapeAttribute(c)}"></mui-avatar>`;
54
+ }
55
+ syncSlottedTextSizes(t) {
56
+ const r = (e, o) => {
57
+ const i = e.tagName.toLowerCase();
58
+ (i === "mui-body" || i === "mui-link") && e.setAttribute("size", o);
59
+ }, c = (e, o) => {
60
+ var a;
61
+ Array.from(this.children).filter((s) => s.getAttribute("slot") === e).forEach((s) => r(s, o));
62
+ const i = (a = this.shadowRoot) == null ? void 0 : a.querySelector(`slot[name="${e}"]`);
63
+ i == null || i.assignedElements({ flatten: !0 }).forEach((s) => r(s, o));
64
+ };
65
+ c("primary", t.primary), c("secondary", t.secondary);
66
+ }
67
+ render() {
68
+ var n, m;
69
+ if (!this.shadowRoot) return;
70
+ const t = this.getAttribute("primary"), r = this.getAttribute("secondary"), c = this.getAttribute("label") || t || "Profile", e = this.getAttribute("href"), o = this.getAttribute("target"), i = this.getSize(), a = h[i], s = o ? ` target="${this.escapeAttribute(o)}"` : "", l = this.renderAvatar(a.avatar), d = e ? (
71
+ /*html*/
72
+ `
73
+ <mui-link class="avatar-action" href="${this.escapeAttribute(e)}" aria-label="Open ${this.escapeAttribute(c)} profile"${s}>
74
+ ${l}
75
+ </mui-link>
76
+ `
77
+ ) : l, p = (
78
+ /*css*/
79
+ `
80
+ :host {
81
+ display: inline-flex;
82
+ min-width: 0;
83
+ max-width: 100%;
84
+ --avatar-chip-primary-size: ${a.primary};
85
+ --avatar-chip-secondary-size: ${a.secondary};
86
+ color: var(--avatar-chip-text-color, currentColor);
87
+ --text-color: var(--avatar-chip-text-color, currentColor);
88
+ --text-color-optional: var(--avatar-chip-secondary-color, var(--avatar-chip-text-color, currentColor));
89
+ --link-text-color-default: var(--avatar-chip-link-color, var(--avatar-chip-text-color, currentColor));
90
+ --link-text-color-default-hover: var(--avatar-chip-link-color-hover, var(--avatar-chip-link-color, var(--avatar-chip-text-color, currentColor)));
91
+ --link-text-color-default-focus: var(--avatar-chip-link-color-focus, var(--avatar-chip-link-color, var(--avatar-chip-text-color, currentColor)));
92
+ }
93
+
94
+ .avatar-chip {
95
+ min-width: 0;
96
+ max-width: 100%;
97
+ }
98
+
99
+ .avatar-action {
100
+ display: inline-flex;
101
+ align-items: center;
102
+ flex: 0 0 auto;
103
+ }
104
+
105
+ mui-avatar {
106
+ flex: 0 0 auto;
107
+ border: 0;
108
+ box-shadow: none;
109
+ }
110
+
111
+ .copy {
112
+ min-width: 0;
113
+ max-width: 100%;
114
+ }
115
+
116
+ :host([usage="media-player"]) mui-avatar {
117
+ border: var(--avatar-chip-avatar-border, var(--border-thin));
118
+ box-shadow: var(--avatar-chip-avatar-shadow, none);
119
+ }
120
+
121
+ mui-body {
122
+ min-width: 0;
123
+ max-width: 100%;
124
+ }
125
+
126
+ slot[name="primary"],
127
+ slot[name="secondary"] {
128
+ display: contents;
129
+ }
130
+
131
+ slot[name="primary"]::slotted(*),
132
+ slot[name="secondary"]::slotted(*) {
133
+ min-width: 0;
134
+ max-width: 100%;
135
+ }
136
+ `
137
+ );
138
+ this.shadowRoot.innerHTML = /*html*/
139
+ `
140
+ <style>${p}</style>
141
+ <mui-h-stack class="avatar-chip" space="var(--space-200)" aligny="center">
142
+ ${d}
143
+ <mui-v-stack class="copy" space="var(--space-000)">
144
+ <slot name="primary">
145
+ <mui-body weight="bold" size="${a.primary}" truncate>${this.escapeText(t)}</mui-body>
146
+ </slot>
147
+ <slot name="secondary">
148
+ ${r ? `<mui-body weight="medium" size="${a.secondary}" truncate>${this.escapeText(r)}</mui-body>` : ""}
149
+ </slot>
150
+ </mui-v-stack>
151
+ </mui-h-stack>
152
+ `, this.syncSlottedTextSizes(a), (n = this.shadowRoot.querySelector('slot[name="primary"]')) == null || n.addEventListener("slotchange", () => this.syncSlottedTextSizes(a)), (m = this.shadowRoot.querySelector('slot[name="secondary"]')) == null || m.addEventListener("slotchange", () => this.syncSlottedTextSizes(a));
153
+ }
154
+ }
155
+ customElements.get("mui-avatar-chip") || customElements.define("mui-avatar-chip", u);
156
+ export {
157
+ u as MuiAvatarChip
158
+ };
@@ -0,0 +1,88 @@
1
+ import "../mui-avatar/index.js";
2
+ class n extends HTMLElement {
3
+ static get observedAttributes() {
4
+ return ["size", "overlap", "label", "fan"];
5
+ }
6
+ constructor() {
7
+ super(), this.attachShadow({ mode: "open" });
8
+ }
9
+ connectedCallback() {
10
+ this.render();
11
+ }
12
+ attributeChangedCallback() {
13
+ this.render();
14
+ }
15
+ syncAvatars() {
16
+ var t;
17
+ const r = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot");
18
+ if (!r) return;
19
+ const e = this.getAttribute("size") || "", s = r.assignedElements({ flatten: !0 }).filter((a) => a.tagName.toLowerCase() === "mui-avatar");
20
+ s.forEach((a, o) => {
21
+ e && !a.hasAttribute("size") && a.setAttribute("size", e);
22
+ const i = a;
23
+ i.style.zIndex = String(s.length - o), i.style.marginInlineStart = o === 0 ? "0" : "var(--avatar-group-overlap)";
24
+ });
25
+ }
26
+ render() {
27
+ if (!this.shadowRoot) return;
28
+ const r = this.getAttribute("size") || "medium", e = this.getAttribute("overlap") || "tight", s = this.getAttribute("label") || "Avatar group", t = {
29
+ "xxx-small": "var(--avatar-xxx-small)",
30
+ "xx-small": "var(--avatar-xx-small)",
31
+ "x-small": "var(--avatar-x-small)",
32
+ small: "var(--avatar-small)",
33
+ medium: "var(--avatar-medium)",
34
+ large: "var(--avatar-large)"
35
+ }, a = {
36
+ loose: "calc(var(--avatar-group-size) * -0.2)",
37
+ tight: "calc(var(--avatar-group-size) * -0.32)",
38
+ compact: "calc(var(--avatar-group-size) * -0.44)"
39
+ }, o = t[r] || t.medium, i = a[e] || a.tight;
40
+ this.shadowRoot.innerHTML = /*html*/
41
+ `
42
+ <style>
43
+ :host {
44
+ --avatar-group-size: ${o};
45
+ --avatar-group-overlap: ${i};
46
+ --avatar-group-ring-color: var(--surface);
47
+ --avatar-group-fan-overlap: var(--space-100);
48
+ --avatar-group-transition: var(--speed-200) ease;
49
+ display: inline-flex;
50
+ align-items: center;
51
+ isolation: isolate;
52
+ }
53
+
54
+ .group {
55
+ display: inline-flex;
56
+ align-items: center;
57
+ min-height: var(--avatar-group-size);
58
+ }
59
+
60
+ ::slotted(mui-avatar) {
61
+ position: relative;
62
+ transition:
63
+ margin-inline-start var(--avatar-group-transition),
64
+ transform var(--avatar-group-transition),
65
+ box-shadow var(--avatar-group-transition);
66
+ box-shadow: 0 0 0 var(--avatar-group-ring-width, var(--stroke-size-200))
67
+ var(--avatar-group-ring-color, var(--surface));
68
+ }
69
+
70
+ :host([card-slot]) {
71
+ --avatar-group-ring-color: var(--surface-elevated-100);
72
+ }
73
+
74
+ :host([fan]:hover),
75
+ :host([fan]:focus-within) {
76
+ --avatar-group-overlap: var(--avatar-group-fan-overlap);
77
+ }
78
+
79
+ </style>
80
+ <span class="group" role="group" aria-label="${s}">
81
+ <slot></slot>
82
+ </span>
83
+ `;
84
+ const l = this.shadowRoot.querySelector("slot");
85
+ l == null || l.addEventListener("slotchange", () => this.syncAvatars()), this.syncAvatars();
86
+ }
87
+ }
88
+ customElements.get("mui-avatar-group") || customElements.define("mui-avatar-group", n);