@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,21 +1,164 @@
1
- class t extends HTMLElement {
1
+ class n extends HTMLElement {
2
2
  constructor() {
3
- super(), this.attachShadow({ mode: "open" });
3
+ super(), this.hoverRow = null, this.handlePointerOver = (t) => {
4
+ if (!this.isHoverHighlightEnabled()) return;
5
+ const e = this.getEventRow(t);
6
+ if (!e || !this.isBodyRow(e)) {
7
+ this.hoverRow && (this.hoverRow = null, this.scheduleHighlightUpdate());
8
+ return;
9
+ }
10
+ this.hoverRow !== e && (this.hoverRow = e, this.scheduleHighlightUpdate());
11
+ }, this.handlePointerLeave = () => {
12
+ this.hoverRow && (this.hoverRow = null, this.scheduleHighlightUpdate());
13
+ }, this.handleRowClick = (t) => {
14
+ if (!this.hasHighlightMode("select")) return;
15
+ const e = this.getEventRow(t);
16
+ if (!e || !this.isBodyRow(e)) return;
17
+ const i = e.getAttribute("row-id"), r = this.getBodyRows().indexOf(e);
18
+ i ? (this.setAttribute("highlight-row", i), this.removeAttribute("highlight-row-index")) : r >= 0 && (this.setAttribute("highlight-row-index", String(r)), this.removeAttribute("highlight-row")), this.dispatchEvent(
19
+ new CustomEvent("row-highlight-change", {
20
+ detail: { row: e, rowId: i, rowIndex: r, source: "select" },
21
+ bubbles: !0
22
+ })
23
+ );
24
+ }, this.attachShadow({ mode: "open" });
25
+ }
26
+ static get observedAttributes() {
27
+ return ["highlight", "highlight-row", "highlight-row-index"];
4
28
  }
5
29
  connectedCallback() {
6
- this.setAttribute("role", "table"), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
30
+ this.setAttribute("role", "table"), this.render(), this.addEventListener("pointerover", this.handlePointerOver), this.addEventListener("pointerleave", this.handlePointerLeave), this.addEventListener("click", this.handleRowClick), this.syncHighlightTracking(), this.scheduleHighlightUpdate();
31
+ }
32
+ disconnectedCallback() {
33
+ this.removeEventListener("pointerover", this.handlePointerOver), this.removeEventListener("pointerleave", this.handlePointerLeave), this.removeEventListener("click", this.handleRowClick), this.disconnectLayoutObservers(), this.animationFrame && cancelAnimationFrame(this.animationFrame);
34
+ }
35
+ attributeChangedCallback() {
36
+ this.syncHighlightTracking(), this.scheduleHighlightUpdate();
37
+ }
38
+ hasHighlightTarget() {
39
+ return this.hasAttribute("highlight-row") || this.hasAttribute("highlight-row-index");
40
+ }
41
+ get highlightModes() {
42
+ return (this.getAttribute("highlight") || "").split(/\s+/).map((t) => t.trim().toLowerCase()).filter(Boolean);
43
+ }
44
+ hasHighlightMode(t) {
45
+ return this.highlightModes.includes(t);
46
+ }
47
+ isHoverHighlightEnabled() {
48
+ return this.hasHighlightMode("hover") && !this.hasHighlightMode("select");
49
+ }
50
+ hasHighlightBehavior() {
51
+ return this.hasHighlightTarget() || this.highlightModes.length > 0;
52
+ }
53
+ getBodyRows() {
54
+ return Array.from(this.querySelectorAll("mui-row-group:not([heading]) > mui-row"));
55
+ }
56
+ getEventRow(t) {
57
+ return t.composedPath().find((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "mui-row");
58
+ }
59
+ isBodyRow(t) {
60
+ return this.getBodyRows().includes(t);
61
+ }
62
+ getHighlightRow() {
63
+ if (this.hoverRow && this.isHoverHighlightEnabled())
64
+ return this.hoverRow;
65
+ const t = this.getAttribute("highlight-row");
66
+ if (t)
67
+ return this.querySelector(`mui-row[row-id="${CSS.escape(t)}"]`);
68
+ const e = this.getAttribute("highlight-row-index");
69
+ if (e === null) return null;
70
+ const i = Number.parseInt(e, 10);
71
+ return !Number.isFinite(i) || i < 0 ? null : this.getBodyRows()[i] || null;
72
+ }
73
+ observeLayout() {
74
+ var t, e;
75
+ (t = this.resizeObserver) == null || t.disconnect(), (e = this.mutationObserver) == null || e.disconnect(), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => this.scheduleHighlightUpdate()), this.resizeObserver.observe(this)), this.mutationObserver = new MutationObserver(() => this.scheduleHighlightUpdate()), this.mutationObserver.observe(this, {
76
+ childList: !0,
77
+ subtree: !0,
78
+ attributes: !0,
79
+ attributeFilter: ["row-id", "hidden", "style", "columns", "size"]
80
+ });
81
+ }
82
+ disconnectLayoutObservers() {
83
+ var t, e;
84
+ (t = this.resizeObserver) == null || t.disconnect(), (e = this.mutationObserver) == null || e.disconnect(), this.resizeObserver = void 0, this.mutationObserver = void 0;
85
+ }
86
+ syncHighlightTracking() {
87
+ this.hasHighlightBehavior() ? this.observeLayout() : this.disconnectLayoutObservers();
88
+ }
89
+ scheduleHighlightUpdate() {
90
+ this.animationFrame && cancelAnimationFrame(this.animationFrame), this.animationFrame = requestAnimationFrame(() => {
91
+ this.animationFrame = void 0, this.updateHighlight();
92
+ });
93
+ }
94
+ updateHighlight() {
95
+ var o;
96
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".row-highlight");
97
+ if (!t) return;
98
+ const e = this.getHighlightRow();
99
+ if (!e) {
100
+ t.removeAttribute("data-visible"), t.removeAttribute("data-last-row");
101
+ return;
102
+ }
103
+ const i = this.getBodyRows(), r = this.getBoundingClientRect(), s = e.getBoundingClientRect(), a = s.top - r.top, h = t.hasAttribute("data-visible");
104
+ h || t.setAttribute("data-positioning", ""), t.style.transform = `translate3d(0, ${a}px, 0)`, t.style.height = `${s.height}px`, t.toggleAttribute("data-last-row", i.at(-1) === e), t.setAttribute("data-visible", ""), h || requestAnimationFrame(() => {
105
+ t.removeAttribute("data-positioning");
106
+ });
107
+ }
108
+ render() {
109
+ this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
7
110
  `
8
- <style>
9
- :host {
10
- display: block;
11
- box-sizing: border-box;
12
- text-indent: initial;
13
- width: 100%;
14
- margin: var(--space-000);
15
- }
16
- </style>
17
- <slot></slot>
111
+ <style>
112
+ :host {
113
+ display: block;
114
+ box-sizing: border-box;
115
+ text-indent: initial;
116
+ width: 100%;
117
+ margin: var(--space-000);
118
+ position: relative;
119
+ }
120
+ :host([card-slot]) {
121
+ --table-row-highlight-background: var(--surface-elevated-200);
122
+ }
123
+ :host([card-slot]) .row-highlight[data-last-row] {
124
+ border-bottom-left-radius: var(--card-radius);
125
+ border-bottom-right-radius: var(--card-radius);
126
+ }
127
+ .row-highlight {
128
+ position: absolute;
129
+ inset-block-start: 0;
130
+ inset-inline: 0;
131
+ height: 0;
132
+ border-radius: var(--table-row-highlight-radius, var(--radius-000));
133
+ background: var(--table-row-highlight-background, var(--surface-elevated-100));
134
+ box-shadow: var(--table-row-highlight-shadow, none);
135
+ opacity: 0;
136
+ pointer-events: none;
137
+ transform: translate3d(0, 0, 0);
138
+ transition:
139
+ transform var(--table-row-highlight-speed, var(--speed-200)) var(--table-row-highlight-easing, ease),
140
+ height var(--table-row-highlight-speed, var(--speed-200)) var(--table-row-highlight-easing, ease),
141
+ opacity var(--speed-100) ease;
142
+ z-index: 0;
143
+ }
144
+ .row-highlight[data-visible] {
145
+ opacity: 1;
146
+ }
147
+ .row-highlight[data-positioning] {
148
+ transition: opacity var(--speed-100) ease;
149
+ }
150
+ slot {
151
+ position: relative;
152
+ z-index: 1;
153
+ }
154
+ ::slotted(mui-row-group) {
155
+ position: relative;
156
+ z-index: 1;
157
+ }
158
+ </style>
159
+ <div class="row-highlight" aria-hidden="true"></div>
160
+ <slot></slot>
18
161
  `);
19
162
  }
20
163
  }
21
- customElements.get("mui-table") || customElements.define("mui-table", t);
164
+ customElements.get("mui-table") || customElements.define("mui-table", n);
@@ -1,9 +1,9 @@
1
- class s extends HTMLElement {
1
+ class a extends HTMLElement {
2
2
  constructor() {
3
- super(), this.handleTabChange = this.handleTabChange.bind(this);
3
+ super(), this.handleTabChange = this.handleTabChange.bind(this), this.attachShadow({ mode: "open" });
4
4
  }
5
5
  connectedCallback() {
6
- this.addEventListener("tab-change", this.handleTabChange), requestAnimationFrame(() => this.initializePanels());
6
+ this.render(), this.addEventListener("tab-change", this.handleTabChange), requestAnimationFrame(() => this.initializePanels());
7
7
  }
8
8
  disconnectedCallback() {
9
9
  this.removeEventListener("tab-change", this.handleTabChange);
@@ -22,9 +22,20 @@ class s extends HTMLElement {
22
22
  if (!e.length) return;
23
23
  let n = e.find((t) => t.getAttribute("item") === i) || null;
24
24
  n || (n = e[0]), e.forEach((t) => {
25
- const a = t === n;
26
- t.toggleAttribute("hidden", !a), t.setAttribute("aria-hidden", String(!a)), t.style.display = a ? "" : "none";
25
+ const s = t === n;
26
+ t.toggleAttribute("hidden", !s), t.setAttribute("aria-hidden", String(!s)), t.style.display = s ? "" : "none";
27
27
  });
28
28
  }
29
+ render() {
30
+ this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
31
+ `
32
+ <style>
33
+ :host {
34
+ display: block;
35
+ }
36
+ </style>
37
+ <slot></slot>
38
+ `);
39
+ }
29
40
  }
30
- customElements.get("mui-tab-controller") || customElements.define("mui-tab-controller", s);
41
+ customElements.get("mui-tab-controller") || customElements.define("mui-tab-controller", a);
@@ -5,7 +5,7 @@ class i extends HTMLElement {
5
5
  }
6
6
  getBadgeSizeFromTabSize() {
7
7
  const t = this.getAttribute("size") || "medium";
8
- return t === "x-small" ? "x-small" : t === "small" ? "small" : t === "large" ? "large" : "medium";
8
+ return t === "x-small" ? "xx-small" : t === "small" ? "x-small" : t === "large" ? "large" : "medium";
9
9
  }
10
10
  hasAssignedContent(t) {
11
11
  return t ? t.assignedNodes({ flatten: !0 }).some(
@@ -55,7 +55,7 @@ class i extends HTMLElement {
55
55
  background: transparent;
56
56
  white-space: nowrap;
57
57
  cursor: pointer;
58
- min-height: var(--action-icon-only-size);
58
+ min-height: var(--tab-item-size-medium, var(--action-size-medium));
59
59
  box-sizing: border-box;
60
60
  border-radius: calc(var(--tab-radius) - 0.2rem);
61
61
  }
@@ -140,12 +140,24 @@ class i extends HTMLElement {
140
140
  margin-left: var(--tab-badge-offset-large);
141
141
  }
142
142
 
143
+ :host ::slotted(mui-badge[variant="neutral"]:not([color])[slot="before"]),
144
+ :host ::slotted(mui-badge[variant="neutral"]:not([color])[slot="after"]) {
145
+ --badge-background: var(--tab-text-color);
146
+ --badge-text-color: var(--tab-background);
147
+ }
148
+
149
+ :host([active]) ::slotted(mui-badge[variant="neutral"]:not([color])[slot="before"]),
150
+ :host([active]) ::slotted(mui-badge[variant="neutral"]:not([color])[slot="after"]) {
151
+ --badge-background: var(--tab-text-color-active);
152
+ --badge-text-color: var(--tab-background-active);
153
+ }
154
+
143
155
  :host([size="x-small"]) {
144
156
  font-size: var(--text-font-size-xs);
145
157
  line-height: var(--text-line-height-xs);
146
158
  font-weight: var(--font-weight-semi-bold);
147
159
  padding: var(--action-padding-x-small);
148
- min-height: var(--action-icon-only-size-x-small);
160
+ min-height: var(--tab-item-size-x-small, var(--action-size-x-small));
149
161
  }
150
162
 
151
163
  :host([size="x-small"][has-after]) {
@@ -169,7 +181,7 @@ class i extends HTMLElement {
169
181
  font-size: var(--text-font-size-s);
170
182
  line-height: var(--text-line-height-s);
171
183
  padding: var(--action-padding-small);
172
- min-height: var(--action-icon-only-size-small);
184
+ min-height: var(--tab-item-size-small, var(--action-size-small));
173
185
  }
174
186
 
175
187
  :host([size="small"][has-after]) {
@@ -193,7 +205,7 @@ class i extends HTMLElement {
193
205
  font-size: var(--text-font-size-l);
194
206
  line-height: var(--text-line-height-l);
195
207
  padding: var(--action-padding-large);
196
- min-height: var(--action-icon-only-size-large);
208
+ min-height: var(--tab-item-size-large, var(--action-size-large));
197
209
  }
198
210
 
199
211
  :host([size="large"][has-after]) {
@@ -1,51 +1,51 @@
1
- class l extends HTMLElement {
1
+ class d extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this._animationSpeed = 200, this.attachShadow({ mode: "open" }), this._handleResize = this._handleResize.bind(this), this._hasInitialized = !1, this._resizeTimeout = null, this._observedTab = null, this._activeTab = null, this._resizeObserver = new ResizeObserver(() => {
4
4
  this._activeTab && this._updateHighlight(this._activeTab);
5
5
  });
6
6
  }
7
7
  static get observedAttributes() {
8
- return ["size", "variant"];
8
+ return ["size", "variant", "stroke", "radius"];
9
9
  }
10
- attributeChangedCallback(e, s, a) {
11
- (e === "size" || e === "variant") && s !== a && (this._applySizeToChildren(), this._applyVariantToChildren(), this._activeTab && this._updateHighlight(this._activeTab));
10
+ attributeChangedCallback(e, i, s) {
11
+ (e === "size" || e === "variant" || e === "stroke") && i !== s && (this._applySizeToChildren(), this._applyVariantToChildren(), this._activeTab && this._updateHighlight(this._activeTab)), e === "radius" && i !== s && this._syncRadiusAttribute();
12
12
  }
13
13
  connectedCallback() {
14
- this.hasAttribute("size") || this.setAttribute("size", "medium");
14
+ this.hasAttribute("size") || this.setAttribute("size", "medium"), this._syncRadiusAttribute();
15
15
  const e = this.getAttribute("speed") || "200";
16
16
  this._animationSpeed = parseInt(e, 10);
17
- const s = Array.from(this.children);
18
- this._applySizeToChildren(s), this._applyVariantToChildren(s), this.setAttribute("role", "tablist");
19
- const a = this.getAttribute("orientation") || "horizontal";
20
- this.setAttribute("aria-orientation", a), this.addEventListener("keydown", (t) => {
21
- const i = Array.from(this.children), r = i.findIndex((d) => d.hasAttribute("active")), n = this.getAttribute("aria-orientation") || "horizontal";
17
+ const i = Array.from(this.children);
18
+ this._applySizeToChildren(i), this._applyVariantToChildren(i), this.setAttribute("role", "tablist");
19
+ const s = this.getAttribute("orientation") || "horizontal";
20
+ this.setAttribute("aria-orientation", s), this.addEventListener("keydown", (t) => {
21
+ const a = Array.from(this.children), r = a.findIndex((l) => l.hasAttribute("active")), n = this.getAttribute("aria-orientation") || "horizontal";
22
22
  let o = r;
23
23
  switch (t.key) {
24
24
  case "ArrowRight":
25
- n === "horizontal" && (o = (r + 1) % i.length, t.preventDefault());
25
+ n === "horizontal" && (o = (r + 1) % a.length, t.preventDefault());
26
26
  break;
27
27
  case "ArrowLeft":
28
- n === "horizontal" && (o = (r - 1 + i.length) % i.length, t.preventDefault());
28
+ n === "horizontal" && (o = (r - 1 + a.length) % a.length, t.preventDefault());
29
29
  break;
30
30
  case "ArrowDown":
31
- n === "vertical" && (o = (r + 1) % i.length, t.preventDefault());
31
+ n === "vertical" && (o = (r + 1) % a.length, t.preventDefault());
32
32
  break;
33
33
  case "ArrowUp":
34
- n === "vertical" && (o = (r - 1 + i.length) % i.length, t.preventDefault());
34
+ n === "vertical" && (o = (r - 1 + a.length) % a.length, t.preventDefault());
35
35
  break;
36
36
  case "Home":
37
37
  o = 0, t.preventDefault();
38
38
  break;
39
39
  case "End":
40
- o = i.length - 1, t.preventDefault();
40
+ o = a.length - 1, t.preventDefault();
41
41
  break;
42
42
  default:
43
43
  return;
44
44
  }
45
- const h = i[o];
45
+ const h = a[o];
46
46
  h && (this.setActiveTab(h), h.focus());
47
- }), s.forEach((t, i) => {
48
- t.classList.remove("first", "middle", "last", "only"), s.length === 1 ? t.classList.add("only") : i === 0 ? t.classList.add("first") : i === s.length - 1 ? t.classList.add("last") : t.classList.add("middle");
47
+ }), i.forEach((t, a) => {
48
+ t.classList.remove("first", "middle", "last", "only"), i.length === 1 ? t.classList.add("only") : a === 0 ? t.classList.add("first") : a === i.length - 1 ? t.classList.add("last") : t.classList.add("middle");
49
49
  }), this.addEventListener("click", (t) => {
50
50
  const r = (typeof t.composedPath == "function" ? t.composedPath() : []).find(
51
51
  (h) => h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-tab-item"
@@ -56,24 +56,48 @@ class l extends HTMLElement {
56
56
  <style>
57
57
  :host {
58
58
  --tab-animation-speed: ${this._animationSpeed}ms;
59
+ --tab-stroke-size: var(--stroke-size-100);
60
+ --tab-item-size-x-small: calc(var(--action-size-x-small) - (var(--tab-stroke-size) * 2));
61
+ --tab-item-size-small: calc(var(--action-size-small) - (var(--tab-stroke-size) * 2));
62
+ --tab-item-size-medium: calc(var(--action-size-medium) - (var(--tab-stroke-size) * 2));
63
+ --tab-item-size-large: calc(var(--action-size-large) - (var(--tab-stroke-size) * 2));
64
+ --tab-active-shadow: var(--tab-shadow-active);
65
+ --tab-active-inset-width: var(--stroke-size-300);
59
66
  position: relative;
60
67
  display: inline-flex;
61
- border-width: var(--stroke-size-100);
68
+ border-width: var(--tab-stroke-size);
62
69
  border-style: var(--stroke-solid);
63
70
  border-color: var(--tab-border-color);
64
71
  border-radius: var(--tab-radius);
65
72
  background: var(--tab-background);
66
- will-change: transform;
67
73
  box-sizing: border-box;
68
74
  overflow: hidden;
69
75
  }
70
76
 
77
+ :host([active-inset]) {
78
+ --tab-active-shadow: none;
79
+ }
80
+
81
+ :host([stroke="none"]) {
82
+ --tab-stroke-size: 0px;
83
+ --tab-item-size-x-small: var(--action-size-x-small);
84
+ --tab-item-size-small: var(--action-size-small);
85
+ --tab-item-size-medium: var(--action-size-medium);
86
+ --tab-item-size-large: var(--action-size-large);
87
+ border: none;
88
+ }
89
+
71
90
  :host([full-width]) {
72
91
  display: flex;
73
92
  width: 100%;
74
93
  }
75
94
 
76
95
  :host([variant="dots"]) {
96
+ --tab-stroke-size: 0px;
97
+ --tab-item-size-x-small: var(--action-size-x-small);
98
+ --tab-item-size-small: var(--action-size-small);
99
+ --tab-item-size-medium: var(--action-size-medium);
100
+ --tab-item-size-large: var(--action-size-large);
77
101
  border: none;
78
102
  border-radius: var(--radius-000);
79
103
  background: transparent;
@@ -83,6 +107,11 @@ class l extends HTMLElement {
83
107
  }
84
108
 
85
109
  :host([variant="ghost"]) {
110
+ --tab-stroke-size: 0px;
111
+ --tab-item-size-x-small: var(--action-size-x-small);
112
+ --tab-item-size-small: var(--action-size-small);
113
+ --tab-item-size-medium: var(--action-size-medium);
114
+ --tab-item-size-large: var(--action-size-large);
86
115
  border: none;
87
116
  background: transparent;
88
117
  box-shadow: var(--tabs-ghost-box-shadow);
@@ -106,12 +135,29 @@ class l extends HTMLElement {
106
135
  z-index: 0;
107
136
  padding: var(--space-200) var(--space-400);
108
137
  box-sizing: border-box;
109
- box-shadow: var(--tab-shadow-active);
110
- will-change: transform, width;
111
- transform: translateX(0) translateZ(0);
138
+ box-shadow: var(--tab-active-shadow);
139
+ transform: translateX(0);
112
140
  width: 0;
113
141
  }
114
142
 
143
+ .highlight::after {
144
+ content: none;
145
+ }
146
+
147
+ :host([active-inset]) .highlight {
148
+ background: var(--tab-background);
149
+ box-shadow: none;
150
+ }
151
+
152
+ :host([active-inset]) .highlight::after {
153
+ content: "";
154
+ position: absolute;
155
+ inset: var(--tab-active-inset-width);
156
+ border-radius: calc(var(--tab-radius) - var(--tab-active-inset-width));
157
+ background: var(--tab-background-active);
158
+ box-shadow: var(--tab-active-shadow);
159
+ }
160
+
115
161
  :host([variant="dots"]) .highlight {
116
162
  display: none;
117
163
  }
@@ -120,8 +166,6 @@ class l extends HTMLElement {
120
166
  position: relative;
121
167
  z-index: 1;
122
168
  flex: 1;
123
- contain: content; /* Performance optimization */
124
- transform: translateZ(0);
125
169
  }
126
170
 
127
171
  :host([variant="dots"]) ::slotted(mui-tab-item) {
@@ -133,31 +177,41 @@ class l extends HTMLElement {
133
177
  `, window.addEventListener("resize", this._handleResize), this._resizeObserver.observe(this), requestAnimationFrame(() => {
134
178
  const t = this.shadowRoot.querySelector(".highlight");
135
179
  t.style.transition = "none";
136
- const i = s.find((r) => r.hasAttribute("active")) || s[0];
137
- i && (this._activeTab = i, i.setAttribute("active", ""), this._updateHighlight(i), this._observedTab = i, this._resizeObserver.observe(i)), t.offsetWidth, requestAnimationFrame(() => {
180
+ const a = i.find((r) => r.hasAttribute("active")) || i[0];
181
+ a && (this._activeTab = a, a.setAttribute("active", ""), this._updateHighlight(a), this._observedTab = a, this._resizeObserver.observe(a)), t.offsetWidth, requestAnimationFrame(() => {
138
182
  t.style.transition = "", this._hasInitialized = !0;
139
183
  });
140
184
  }));
141
185
  }
142
186
  _applySizeToChildren(e) {
143
- const s = this.getAttribute("size") || "medium";
187
+ const i = this.getAttribute("size") || "medium";
144
188
  (e || Array.from(this.children)).forEach((t) => {
145
- t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("size", s);
189
+ t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("size", i);
146
190
  });
147
191
  }
148
192
  _applyVariantToChildren(e) {
149
- const s = this.getAttribute("variant") || "default";
193
+ const i = this.getAttribute("variant") || "default";
150
194
  (e || Array.from(this.children)).forEach((t) => {
151
- t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("variant", s);
195
+ t.tagName.toLowerCase() === "mui-tab-item" && t.setAttribute("variant", i);
152
196
  });
153
197
  }
198
+ _syncRadiusAttribute() {
199
+ var t;
200
+ const e = (t = this.getAttribute("radius")) == null ? void 0 : t.trim();
201
+ if (!e) {
202
+ this.style.removeProperty("--tab-radius");
203
+ return;
204
+ }
205
+ const i = e.startsWith("radius-") ? e.replace("radius-", "") : e, s = /^(000|100|150|200|300|400|500|600)$/.test(i);
206
+ this.style.setProperty("--tab-radius", s ? `var(--radius-${i})` : e);
207
+ }
154
208
  disconnectedCallback() {
155
209
  window.removeEventListener("resize", this._handleResize), this._observedTab && this._resizeObserver.unobserve(this._observedTab), this._resizeObserver.unobserve(this), this._resizeTimeout && clearTimeout(this._resizeTimeout), this._resizeObserver.disconnect();
156
210
  }
157
211
  _handleResize() {
158
212
  if (!this._activeTab) return;
159
- this._resizeTimeout && clearTimeout(this._resizeTimeout), this._activeTab && Array.from(this.children).forEach((s) => {
160
- s === this._activeTab ? s.setAttribute("active", "") : s.removeAttribute("active");
213
+ this._resizeTimeout && clearTimeout(this._resizeTimeout), this._activeTab && Array.from(this.children).forEach((i) => {
214
+ i === this._activeTab ? i.setAttribute("active", "") : i.removeAttribute("active");
161
215
  });
162
216
  const e = this.shadowRoot.querySelector(".highlight");
163
217
  e && (e.style.transition = "none", this._updateHighlight(this._activeTab), e.offsetWidth, this._resizeTimeout = window.setTimeout(() => {
@@ -166,15 +220,15 @@ class l extends HTMLElement {
166
220
  }
167
221
  _updateHighlight(e) {
168
222
  if (this.getAttribute("variant") === "dots") return;
169
- const s = this.shadowRoot.querySelector(".highlight"), a = e.getBoundingClientRect(), t = this.getBoundingClientRect(), i = parseFloat(getComputedStyle(this).borderWidth) || 0, r = a.left - t.left - i;
170
- s.style.transform = `translateX(${r}px) translateZ(0)`, s.style.width = `${a.width}px`;
223
+ const i = this.shadowRoot.querySelector(".highlight"), s = e.getBoundingClientRect(), t = this.getBoundingClientRect(), a = parseFloat(getComputedStyle(this).borderWidth) || 0, r = s.left - t.left - a;
224
+ i.style.transform = `translateX(${r}px)`, i.style.width = `${s.width}px`;
171
225
  }
172
226
  setActiveTab(e) {
173
- if (Array.from(this.children).forEach((a) => a.removeAttribute("active")), e.setAttribute("active", ""), this._activeTab = e, this._observedTab && this._observedTab !== e && this._resizeObserver.unobserve(this._observedTab), this._observedTab = e, this._resizeObserver.observe(e), this._hasInitialized)
227
+ if (Array.from(this.children).forEach((s) => s.removeAttribute("active")), e.setAttribute("active", ""), this._activeTab = e, this._observedTab && this._observedTab !== e && this._resizeObserver.unobserve(this._observedTab), this._observedTab = e, this._resizeObserver.observe(e), this._hasInitialized)
174
228
  this._updateHighlight(e);
175
229
  else {
176
- const a = this.shadowRoot.querySelector(".highlight");
177
- a.style.transition = "none", this._updateHighlight(e), a.offsetWidth, a.style.transition = "", this._hasInitialized = !0;
230
+ const s = this.shadowRoot.querySelector(".highlight");
231
+ s.style.transition = "none", this._updateHighlight(e), s.offsetWidth, s.style.transition = "", this._hasInitialized = !0;
178
232
  }
179
233
  this.dispatchEvent(
180
234
  new CustomEvent("tab-change", {
@@ -185,4 +239,4 @@ class l extends HTMLElement {
185
239
  );
186
240
  }
187
241
  }
188
- customElements.get("mui-tab-bar") || customElements.define("mui-tab-bar", l);
242
+ customElements.get("mui-tab-bar") || customElements.define("mui-tab-bar", d);