@muibook/components 10.0.1 → 11.0.1

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 (150) hide show
  1. package/LICENSE +27 -11
  2. package/README.md +10 -4
  3. package/dist/esm/components/mui-accordion/block/index.js +9 -5
  4. package/dist/esm/components/mui-alert/index.js +88 -52
  5. package/dist/esm/components/mui-badge/index.js +61 -16
  6. package/dist/esm/components/mui-body/index.js +76 -10
  7. package/dist/esm/components/mui-button/index.js +152 -32
  8. package/dist/esm/components/mui-card/card/index.js +13 -8
  9. package/dist/esm/components/mui-checkbox/index.js +64 -30
  10. package/dist/esm/components/mui-chip/index.js +153 -33
  11. package/dist/esm/components/mui-chip-input/index.js +407 -0
  12. package/dist/esm/components/mui-code/index.js +11 -9
  13. package/dist/esm/components/mui-dialog/index.js +17 -8
  14. package/dist/esm/components/mui-dropdown/index.js +44 -44
  15. package/dist/esm/components/mui-field/index.js +56 -21
  16. package/dist/esm/components/mui-form-group/index.js +88 -0
  17. package/dist/esm/components/mui-form-hint/index.js +1 -0
  18. package/dist/esm/components/mui-form-message/index.js +72 -0
  19. package/dist/esm/components/mui-form-section/index.js +108 -0
  20. package/dist/esm/components/mui-form-section-footer/index.js +46 -0
  21. package/dist/esm/components/mui-hint/index.js +146 -0
  22. package/dist/esm/components/mui-icons/accessibility/index.js +5 -4
  23. package/dist/esm/components/mui-icons/add/index.js +1 -0
  24. package/dist/esm/components/mui-icons/ai/index.js +5 -4
  25. package/dist/esm/components/mui-icons/attention/index.js +1 -0
  26. package/dist/esm/components/mui-icons/calendar/index.js +5 -4
  27. package/dist/esm/components/mui-icons/check/index.js +6 -5
  28. package/dist/esm/components/mui-icons/checkmark/index.js +9 -8
  29. package/dist/esm/components/mui-icons/close/index.js +6 -5
  30. package/dist/esm/components/mui-icons/down-arrow-circle/index.js +9 -8
  31. package/dist/esm/components/mui-icons/down-chevron/index.js +8 -7
  32. package/dist/esm/components/mui-icons/ellipsis/index.js +1 -0
  33. package/dist/esm/components/mui-icons/exclamationmark/index.js +49 -0
  34. package/dist/esm/components/mui-icons/game-controller/index.js +8 -7
  35. package/dist/esm/components/mui-icons/gear/index.js +5 -4
  36. package/dist/esm/components/mui-icons/globe/index.js +8 -7
  37. package/dist/esm/components/mui-icons/grid/index.js +1 -0
  38. package/dist/esm/components/mui-icons/home/index.js +9 -8
  39. package/dist/esm/components/mui-icons/index.js +3 -0
  40. package/dist/esm/components/mui-icons/info/index.js +3 -2
  41. package/dist/esm/components/mui-icons/left-arrow/index.js +1 -0
  42. package/dist/esm/components/mui-icons/left-chevron/index.js +6 -5
  43. package/dist/esm/components/mui-icons/left-sidebar/index.js +6 -5
  44. package/dist/esm/components/mui-icons/list-and-film/index.js +1 -0
  45. package/dist/esm/components/mui-icons/menu/index.js +8 -7
  46. package/dist/esm/components/mui-icons/message/index.js +5 -4
  47. package/dist/esm/components/mui-icons/moon/index.js +3 -2
  48. package/dist/esm/components/mui-icons/movie-clapper/index.js +5 -4
  49. package/dist/esm/components/mui-icons/music-microphone/index.js +6 -5
  50. package/dist/esm/components/mui-icons/music-quarter-note/index.js +1 -0
  51. package/dist/esm/components/mui-icons/notification/index.js +5 -4
  52. package/dist/esm/components/mui-icons/pin/index.js +3 -2
  53. package/dist/esm/components/mui-icons/pin-slash/index.js +6 -5
  54. package/dist/esm/components/mui-icons/play-rectangle/index.js +9 -8
  55. package/dist/esm/components/mui-icons/play-stack/index.js +5 -4
  56. package/dist/esm/components/mui-icons/rectangle/index.js +6 -5
  57. package/dist/esm/components/mui-icons/rectangle-bottom-panel/index.js +1 -0
  58. package/dist/esm/components/mui-icons/rectangle-dashed/index.js +1 -0
  59. package/dist/esm/components/mui-icons/rectangle-left-drawer/index.js +1 -0
  60. package/dist/esm/components/mui-icons/rectangle-media-text/index.js +6 -5
  61. package/dist/esm/components/mui-icons/right-chevron/index.js +1 -0
  62. package/dist/esm/components/mui-icons/search/index.js +6 -5
  63. package/dist/esm/components/mui-icons/spinner/index.js +56 -0
  64. package/dist/esm/components/mui-icons/stop/index.js +3 -2
  65. package/dist/esm/components/mui-icons/subtract/index.js +1 -0
  66. package/dist/esm/components/mui-icons/sun/index.js +1 -0
  67. package/dist/esm/components/mui-icons/text-below-folder/index.js +55 -0
  68. package/dist/esm/components/mui-icons/toggle/index.js +8 -6
  69. package/dist/esm/components/mui-icons/translate/index.js +5 -4
  70. package/dist/esm/components/mui-icons/up-arrow/index.js +5 -4
  71. package/dist/esm/components/mui-icons/up-chevron/index.js +6 -5
  72. package/dist/esm/components/mui-icons/warning/index.js +7 -6
  73. package/dist/esm/components/mui-input/index.js +298 -47
  74. package/dist/esm/components/mui-link/index.js +187 -59
  75. package/dist/esm/components/mui-list/item/index.js +3 -0
  76. package/dist/esm/components/mui-markdown/index.js +149 -0
  77. package/dist/esm/components/mui-media-player/index.js +184 -0
  78. package/dist/esm/components/mui-message/index.js +50 -20
  79. package/dist/esm/components/mui-progress/index.js +15 -15
  80. package/dist/esm/components/mui-prompt/index.js +1461 -0
  81. package/dist/esm/components/mui-prompt-message/index.js +114 -0
  82. package/dist/esm/components/mui-prompt-preview/index.js +497 -0
  83. package/dist/esm/components/mui-prompt-toggle/index.js +48 -0
  84. package/dist/esm/components/mui-radio/index.js +155 -0
  85. package/dist/esm/components/mui-radio-group/index.js +104 -0
  86. package/dist/esm/components/mui-range-input/index.js +122 -0
  87. package/dist/esm/components/mui-rule/index.js +11 -3
  88. package/dist/esm/components/mui-select/index.js +89 -30
  89. package/dist/esm/components/mui-spinner/index.js +70 -0
  90. package/dist/esm/components/mui-stepper/step/index.js +255 -18
  91. package/dist/esm/components/mui-stepper/stepper/index.js +68 -72
  92. package/dist/esm/components/mui-table/row/index.js +16 -3
  93. package/dist/esm/components/mui-tabs/controller/index.js +21 -14
  94. package/dist/esm/components/mui-tabs/item/index.js +285 -29
  95. package/dist/esm/components/mui-tabs/panel/index.js +3 -0
  96. package/dist/esm/components/mui-tabs/tab-bar/index.js +85 -34
  97. package/dist/esm/components/mui-textarea/index.js +257 -0
  98. package/dist/esm/css/mui-base.css +27 -0
  99. package/dist/esm/css/mui-brand.css +3 -1
  100. package/dist/esm/css/mui-tokens.css +234 -7
  101. package/dist/esm/custom-elements.json +5202 -1791
  102. package/dist/esm/index.js +24 -4
  103. package/dist/esm/tokens/js/index.js +107 -105
  104. package/dist/types/components/mui-agent-bubble/doc.d.ts +2 -0
  105. package/dist/types/components/mui-agent-bubble/index.d.ts +1 -0
  106. package/dist/types/components/mui-agent-prompt/doc.d.ts +2 -0
  107. package/dist/types/components/mui-agent-prompt/index.d.ts +1 -0
  108. package/dist/types/components/mui-chip-input/doc.d.ts +2 -0
  109. package/dist/types/components/mui-chip-input/index.d.ts +3 -0
  110. package/dist/types/components/mui-form-group/doc.d.ts +2 -0
  111. package/dist/types/components/mui-form-group/index.d.ts +2 -0
  112. package/dist/types/components/mui-form-group-horizontal/index.d.ts +1 -0
  113. package/dist/types/components/mui-form-hint/doc.d.ts +2 -0
  114. package/dist/types/components/mui-form-hint/index.d.ts +1 -0
  115. package/dist/types/components/mui-form-message/index.d.ts +2 -0
  116. package/dist/types/components/mui-form-section/doc.d.ts +2 -0
  117. package/dist/types/components/mui-form-section/index.d.ts +1 -0
  118. package/dist/types/components/mui-form-section-footer/doc.d.ts +2 -0
  119. package/dist/types/components/mui-form-section-footer/index.d.ts +1 -0
  120. package/dist/types/components/mui-hint/doc.d.ts +2 -0
  121. package/dist/types/components/mui-hint/index.d.ts +1 -0
  122. package/dist/types/components/mui-icons/exclamationmark.d.ts +1 -0
  123. package/dist/types/components/mui-icons/index.d.ts +3 -0
  124. package/dist/types/components/mui-icons/spinner.d.ts +1 -0
  125. package/dist/types/components/mui-icons/text-below-folder.d.ts +1 -0
  126. package/dist/types/components/mui-markdown/doc.d.ts +2 -0
  127. package/dist/types/components/mui-markdown/index.d.ts +1 -0
  128. package/dist/types/components/mui-media-player/doc.d.ts +2 -0
  129. package/dist/types/components/mui-media-player/index.d.ts +8 -0
  130. package/dist/types/components/mui-prompt/doc.d.ts +2 -0
  131. package/dist/types/components/mui-prompt/index.d.ts +18 -0
  132. package/dist/types/components/mui-prompt-chip/index.d.ts +1 -0
  133. package/dist/types/components/mui-prompt-message/doc.d.ts +2 -0
  134. package/dist/types/components/mui-prompt-message/index.d.ts +1 -0
  135. package/dist/types/components/mui-prompt-preview/doc.d.ts +2 -0
  136. package/dist/types/components/mui-prompt-preview/index.d.ts +7 -0
  137. package/dist/types/components/mui-prompt-toggle/index.d.ts +1 -0
  138. package/dist/types/components/mui-radio/doc.d.ts +2 -0
  139. package/dist/types/components/mui-radio/index.d.ts +1 -0
  140. package/dist/types/components/mui-radio-group/index.d.ts +1 -0
  141. package/dist/types/components/mui-range-input/doc.d.ts +2 -0
  142. package/dist/types/components/mui-range-input/index.d.ts +1 -0
  143. package/dist/types/components/mui-spinner/doc.d.ts +2 -0
  144. package/dist/types/components/mui-spinner/index.d.ts +1 -0
  145. package/dist/types/components/mui-stepper/step/index.d.ts +4 -1
  146. package/dist/types/components/mui-textarea/doc.d.ts +2 -0
  147. package/dist/types/components/mui-textarea/index.d.ts +1 -0
  148. package/dist/types/index.d.ts +21 -0
  149. package/dist/types/tokens/js/index.d.ts +2 -0
  150. package/package.json +91 -1
@@ -0,0 +1,407 @@
1
+ import "../mui-input/index.js";
2
+ import "../mui-chip/index.js";
3
+ import "../mui-stack/hstack/index.js";
4
+ class w extends HTMLElement {
5
+ constructor() {
6
+ super(), this.selectedItems = [], this.highlightedIndex = -1, this.inputValue = "", this.mql = null, this.mqlHandler = null, this.attachShadow({ mode: "open" });
7
+ }
8
+ static get observedAttributes() {
9
+ return [
10
+ "id",
11
+ "label",
12
+ "hide-label",
13
+ "placeholder",
14
+ "options",
15
+ "value",
16
+ "allow-custom",
17
+ "disabled",
18
+ "size",
19
+ "name",
20
+ "placement",
21
+ "mobile-stack",
22
+ "breakpoint"
23
+ ];
24
+ }
25
+ get value() {
26
+ return this.selectedItems.map((t) => ({ ...t }));
27
+ }
28
+ set value(t) {
29
+ this.selectedItems = (Array.isArray(t) ? t : []).filter((e) => e && typeof e.value == "string").map((e) => ({ ...e, label: String(e.label ?? e.value), value: String(e.value) })), this.syncValueAttribute(), this.rerenderAndPreserveFocus(0, 0);
30
+ }
31
+ connectedCallback() {
32
+ this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("id") || this.setAttribute(
33
+ "id",
34
+ `mui-chip-input-${Math.random().toString(36).slice(2, 9)}`
35
+ ), this.syncSelectedFromAttribute(), this.setupBreakpointListener(), this.render(), this.setupListeners();
36
+ }
37
+ disconnectedCallback() {
38
+ this.cleanupBreakpointListener();
39
+ }
40
+ attributeChangedCallback(t, e, i) {
41
+ e !== i && (t === "value" && this.syncSelectedFromAttribute(), (t === "breakpoint" || t === "mobile-stack") && this.setupBreakpointListener(), this.render(), this.setupListeners());
42
+ }
43
+ cleanupBreakpointListener() {
44
+ this.mql && this.mqlHandler && this.mql.removeEventListener("change", this.mqlHandler), this.mql = null, this.mqlHandler = null;
45
+ }
46
+ setupBreakpointListener() {
47
+ this.cleanupBreakpointListener();
48
+ const t = this.getAttribute("breakpoint");
49
+ if (!t || this.hasAttribute("mobile-stack")) return;
50
+ const e = Number.parseInt(t, 10);
51
+ Number.isNaN(e) || e <= 0 || (this.mql = window.matchMedia(`(max-width: ${e}px)`), this.mqlHandler = () => {
52
+ this.render(), this.setupListeners();
53
+ }, this.mql.addEventListener("change", this.mqlHandler));
54
+ }
55
+ normalizeOption(t) {
56
+ if (typeof t == "string") {
57
+ const e = t.trim();
58
+ return e ? { value: e, label: e } : null;
59
+ }
60
+ if (t && typeof t == "object") {
61
+ const e = t, i = e.value, s = i == null ? "" : String(i).trim();
62
+ return s ? {
63
+ ...e,
64
+ value: s,
65
+ label: String(e.label ?? s).trim() || s
66
+ } : null;
67
+ }
68
+ return null;
69
+ }
70
+ parseOptions() {
71
+ const t = this.getAttribute("options") || "[]";
72
+ let e = [];
73
+ try {
74
+ e = JSON.parse(t);
75
+ } catch {
76
+ e = t.split(",").map((s) => s.trim()).filter(Boolean);
77
+ }
78
+ return Array.isArray(e) ? e.map((i) => this.normalizeOption(i)).filter((i) => !!i) : [];
79
+ }
80
+ parseValueAttribute() {
81
+ const t = this.getAttribute("value") || "[]";
82
+ let e = [];
83
+ try {
84
+ e = JSON.parse(t);
85
+ } catch {
86
+ e = t.split(",").map((l) => l.trim()).filter(Boolean);
87
+ }
88
+ if (!Array.isArray(e)) return [];
89
+ const i = new Map(this.parseOptions().map((a) => [a.value.toLowerCase(), a])), s = e.map((a) => {
90
+ const l = this.normalizeOption(a);
91
+ return l ? i.get(l.value.toLowerCase()) || l : null;
92
+ }).filter((a) => !!a), r = /* @__PURE__ */ new Set();
93
+ return s.filter((a) => {
94
+ const l = a.value.toLowerCase();
95
+ return r.has(l) ? !1 : (r.add(l), !0);
96
+ });
97
+ }
98
+ syncSelectedFromAttribute() {
99
+ this.selectedItems = this.parseValueAttribute();
100
+ }
101
+ syncValueAttribute() {
102
+ const t = JSON.stringify(this.selectedItems);
103
+ this.getAttribute("value") !== t && this.setAttribute("value", t);
104
+ }
105
+ get normalizedSize() {
106
+ const t = this.getAttribute("size") || "medium";
107
+ return ["x-small", "small", "medium", "large"].includes(t) ? t : "medium";
108
+ }
109
+ get allowCustom() {
110
+ return this.hasAttribute("allow-custom");
111
+ }
112
+ get disabled() {
113
+ return this.hasAttribute("disabled");
114
+ }
115
+ get placement() {
116
+ return this.getAttribute("placement") === "after" ? "after" : "before";
117
+ }
118
+ get useStackLayout() {
119
+ if (this.hasAttribute("mobile-stack")) return !0;
120
+ const t = this.getAttribute("breakpoint");
121
+ if (!t) return !1;
122
+ const e = Number.parseInt(t, 10);
123
+ return Number.isNaN(e) || e <= 0 ? !1 : window.matchMedia(`(max-width: ${e}px)`).matches;
124
+ }
125
+ get selectedValues() {
126
+ return this.selectedItems.map((t) => t.value);
127
+ }
128
+ get filteredOptions() {
129
+ const t = new Set(this.selectedValues.map((i) => i.toLowerCase())), e = this.inputValue.toLowerCase().trim();
130
+ return this.parseOptions().filter((i) => t.has(i.value.toLowerCase()) ? !1 : e ? i.label.toLowerCase().includes(e) : !0);
131
+ }
132
+ get showCreateOption() {
133
+ const t = this.inputValue.trim();
134
+ if (!this.allowCustom || !t) return !1;
135
+ const i = this.parseOptions().some((r) => r.value.toLowerCase() === t.toLowerCase()), s = this.selectedValues.some((r) => r.toLowerCase() === t.toLowerCase());
136
+ return !i && !s;
137
+ }
138
+ emitQueryChange() {
139
+ this.dispatchEvent(
140
+ new CustomEvent("chip-input-query-change", {
141
+ detail: { query: this.inputValue },
142
+ bubbles: !0,
143
+ composed: !0
144
+ })
145
+ );
146
+ }
147
+ emitChange(t, e, i) {
148
+ this.syncValueAttribute();
149
+ const s = {
150
+ action: t,
151
+ values: this.selectedValues,
152
+ items: this.selectedItems.map((r) => ({ ...r })),
153
+ added: e ? { ...e } : null,
154
+ removed: i ? { ...i } : null
155
+ };
156
+ this.dispatchEvent(new CustomEvent("chip-input-change", { detail: s, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: s, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("input", { detail: s, bubbles: !0, composed: !0 }));
157
+ }
158
+ setInputValue(t) {
159
+ var i;
160
+ this.inputValue = t;
161
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector("mui-input");
162
+ e && e.setAttribute("value", t);
163
+ }
164
+ getInnerInput() {
165
+ var e, i;
166
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("mui-input");
167
+ return ((i = t == null ? void 0 : t.shadowRoot) == null ? void 0 : i.querySelector("input")) ?? null;
168
+ }
169
+ restoreInputFocus(t, e) {
170
+ requestAnimationFrame(() => {
171
+ const i = this.getInnerInput();
172
+ if (!(!i || this.disabled) && (i.focus({ preventScroll: !0 }), !(t == null || e == null)))
173
+ try {
174
+ i.setSelectionRange(t, e);
175
+ } catch {
176
+ }
177
+ });
178
+ }
179
+ rerenderAndPreserveFocus(t, e) {
180
+ this.render(), this.setupListeners(), this.restoreInputFocus(t, e);
181
+ }
182
+ addValue(t) {
183
+ const e = t.trim();
184
+ if (!e || this.selectedValues.some((r) => r.toLowerCase() === e.toLowerCase())) return;
185
+ const s = this.parseOptions().find((r) => r.value.toLowerCase() === e.toLowerCase()) || { value: e, label: e, custom: !0 };
186
+ this.selectedItems = [...this.selectedItems, s], this.highlightedIndex = -1, this.setInputValue(""), this.emitChange("add", s), this.rerenderAndPreserveFocus(0, 0);
187
+ }
188
+ removeValue(t) {
189
+ const e = this.selectedItems.findIndex((r) => r.value === t);
190
+ if (e < 0) return;
191
+ const i = this.selectedItems[e];
192
+ this.selectedItems = this.selectedItems.filter((r) => r.value !== t), this.emitChange("remove", void 0, i);
193
+ const s = this.inputValue.length;
194
+ this.rerenderAndPreserveFocus(s, s);
195
+ }
196
+ handleKeyboard(t) {
197
+ const e = this.filteredOptions, i = e.length + (this.showCreateOption ? 1 : 0);
198
+ if (t.key === "ArrowDown" && i > 0) {
199
+ t.preventDefault(), this.highlightedIndex = (this.highlightedIndex + 1 + i) % i;
200
+ const s = this.inputValue.length;
201
+ this.rerenderAndPreserveFocus(s, s);
202
+ return;
203
+ }
204
+ if (t.key === "ArrowUp" && i > 0) {
205
+ t.preventDefault(), this.highlightedIndex = (this.highlightedIndex - 1 + i) % i;
206
+ const s = this.inputValue.length;
207
+ this.rerenderAndPreserveFocus(s, s);
208
+ return;
209
+ }
210
+ if (t.key === "Escape") {
211
+ this.highlightedIndex = -1;
212
+ const s = this.inputValue.length;
213
+ this.rerenderAndPreserveFocus(s, s);
214
+ return;
215
+ }
216
+ if (t.key === "Backspace" && !this.inputValue && this.selectedItems.length > 0) {
217
+ this.removeValue(this.selectedItems[this.selectedItems.length - 1].value);
218
+ return;
219
+ }
220
+ if (t.key === "Enter" || t.key === ",") {
221
+ if (t.preventDefault(), this.highlightedIndex >= 0 && this.highlightedIndex < e.length) {
222
+ this.addValue(e[this.highlightedIndex].value);
223
+ return;
224
+ }
225
+ this.showCreateOption && this.addValue(this.inputValue);
226
+ }
227
+ }
228
+ setupListeners() {
229
+ if (!this.shadowRoot) return;
230
+ const t = this.shadowRoot.querySelector("mui-input");
231
+ t && (t.oninput = (e) => {
232
+ var n;
233
+ const i = this.getInnerInput(), s = (i == null ? void 0 : i.selectionStart) ?? null, r = (i == null ? void 0 : i.selectionEnd) ?? null, a = (n = e.detail) == null ? void 0 : n.value, l = t.getAttribute("value") || "";
234
+ this.inputValue = a ?? l, this.highlightedIndex = -1, this.emitQueryChange(), this.rerenderAndPreserveFocus(s, r);
235
+ }, t.onkeydown = (e) => {
236
+ this.handleKeyboard(e);
237
+ }, this.shadowRoot.querySelectorAll("[data-option-value]").forEach((e) => {
238
+ e.addEventListener("mousedown", (i) => {
239
+ i.preventDefault();
240
+ const s = e.getAttribute("data-option-value");
241
+ s && this.addValue(s);
242
+ });
243
+ }), this.shadowRoot.querySelectorAll("[data-remove-value]").forEach((e) => {
244
+ e.addEventListener("dismiss", (i) => {
245
+ i.stopPropagation();
246
+ const s = e.getAttribute("data-remove-value");
247
+ s && !this.disabled && this.removeValue(s);
248
+ });
249
+ }));
250
+ }
251
+ render() {
252
+ const t = this.getAttribute("id") || "", e = this.getAttribute("label") || "", i = this.getAttribute("placeholder") || "Type to add", s = this.hasAttribute("hide-label"), r = this.useStackLayout, a = this.getAttribute("name") || "", l = this.filteredOptions, n = `${t}-listbox`, d = !this.disabled && (l.length > 0 || this.showCreateOption) && this.inputValue.trim().length > 0, c = l.map((o, v) => {
253
+ const h = v === this.highlightedIndex;
254
+ return (
255
+ /*html*/
256
+ `
257
+ <button
258
+ type="button"
259
+ class="option ${h ? "active" : ""}"
260
+ role="option"
261
+ aria-selected="${h ? "true" : "false"}"
262
+ data-option-value="${o.value}"
263
+ >${o.label}</button>
264
+ `
265
+ );
266
+ }).join(""), u = l.length, p = this.showCreateOption ? (
267
+ /*html*/
268
+ `
269
+ <button
270
+ type="button"
271
+ class="option ${this.highlightedIndex === u ? "active" : ""}"
272
+ role="option"
273
+ aria-selected="${this.highlightedIndex === u ? "true" : "false"}"
274
+ data-option-value="${this.inputValue.trim()}"
275
+ >Add "${this.inputValue.trim()}"</button>
276
+ `
277
+ ) : "", m = this.placement, b = this.placement === "after" ? "chip-slot-shell after-shell" : "chip-slot-shell before-shell", g = this.selectedItems.length ? (
278
+ /*html*/
279
+ `
280
+ <mui-h-stack
281
+ slot="${m}"
282
+ class="${b} ${r ? "mobile-stack" : ""}"
283
+ space="var(--stroke-size-200)"
284
+ aligny="center"
285
+ >
286
+ ${this.selectedItems.map(
287
+ (o) => (
288
+ /*html*/
289
+ `
290
+ <mui-chip
291
+ usage="input"
292
+ size="${this.normalizedSize}"
293
+ dismiss
294
+ ${this.disabled ? "disabled" : ""}
295
+ data-remove-value="${o.value}"
296
+ aria-label="Remove ${o.label}"
297
+ >${o.label}</mui-chip>
298
+ `
299
+ )
300
+ ).join("")}
301
+ </mui-h-stack>
302
+ `
303
+ ) : "", f = a ? this.selectedValues.map((o) => `<input type="hidden" name="${a}" value="${o}" />`).join("") : "";
304
+ this.shadowRoot.innerHTML = /*html*/
305
+ `
306
+ <style>
307
+ :host {
308
+ display: inline-block;
309
+ width: 100%;
310
+ --chip-input-before-max-width: min(70%, 52rem);
311
+ }
312
+ .stack {
313
+ display: grid;
314
+ gap: var(--space-100);
315
+ }
316
+ .listbox {
317
+ border: var(--border-thin);
318
+ border-color: var(--form-default-border-color);
319
+ border-radius: var(--radius-100);
320
+ background: var(--surface-elevated-100);
321
+ overflow: hidden;
322
+ }
323
+ mui-h-stack.chip-slot-shell {
324
+ background: var(--chip-input-background, #333333);
325
+ padding: var(--chip-input-shell-padding, 2px);
326
+ border: var(--chip-input-shell-border, 1px solid var(--form-default-border-color));
327
+ box-sizing: border-box;
328
+ width: 100%;
329
+ min-width: 0;
330
+ border-radius: var(--radius-100);
331
+ }
332
+ mui-h-stack.chip-slot-shell.mobile-stack {
333
+ overflow-x: auto;
334
+ overflow-y: hidden;
335
+ -webkit-overflow-scrolling: touch;
336
+ }
337
+ mui-h-stack.chip-slot-shell.before-shell {
338
+ border-right: none;
339
+ border-top-right-radius: 0;
340
+ border-bottom-right-radius: 0;
341
+ }
342
+ mui-h-stack.chip-slot-shell.after-shell {
343
+ border-left: none;
344
+ border-top-left-radius: 0;
345
+ border-bottom-left-radius: 0;
346
+ }
347
+ mui-h-stack.chip-slot-shell.mobile-stack.before-shell {
348
+ border-right: var(--chip-input-shell-border, 1px solid var(--form-default-border-color));
349
+ border-bottom: none;
350
+ border-top-left-radius: var(--radius-100);
351
+ border-top-right-radius: var(--radius-100);
352
+ border-bottom-left-radius: 0;
353
+ border-bottom-right-radius: 0;
354
+ }
355
+ mui-h-stack.chip-slot-shell.mobile-stack.after-shell {
356
+ border-left: var(--chip-input-shell-border, 1px solid var(--form-default-border-color));
357
+ border-top: none;
358
+ border-top-left-radius: 0;
359
+ border-top-right-radius: 0;
360
+ border-bottom-left-radius: var(--radius-100);
361
+ border-bottom-right-radius: var(--radius-100);
362
+ }
363
+ .option {
364
+ width: 100%;
365
+ text-align: left;
366
+ border: none;
367
+ background: transparent;
368
+ padding: var(--space-200) var(--space-300);
369
+ cursor: pointer;
370
+ color: var(--text-color);
371
+ }
372
+ .option.active,
373
+ .option:hover {
374
+ background: var(--surface-elevated-200);
375
+ }
376
+ </style>
377
+
378
+ <div class="stack">
379
+ <mui-input
380
+ style="
381
+ --input-before-slot-max-width: var(--chip-input-before-max-width);
382
+ --input-after-slot-max-width: var(--chip-input-after-max-width, var(--chip-input-before-max-width));
383
+ --input-slot-wrap: wrap;
384
+ --input-slot-overflow-x: ${r ? "hidden" : "visible"};
385
+ "
386
+ id="${t}"
387
+ label="${e}"
388
+ ${s ? "hide-label" : ""}
389
+ size="${this.normalizedSize}"
390
+ placeholder="${i}"
391
+ value="${this.inputValue}"
392
+ ${r ? 'slot-layout="stack-mobile"' : ""}
393
+ ${this.disabled ? "disabled" : ""}
394
+ aria-controls="${n}"
395
+ aria-autocomplete="list"
396
+ >
397
+ ${g}
398
+ </mui-input>
399
+
400
+ ${d ? `<div id="${n}" class="listbox" role="listbox">${c}${p}</div>` : ""}
401
+ </div>
402
+
403
+ ${f}
404
+ `;
405
+ }
406
+ }
407
+ customElements.get("mui-chip-input") || customElements.define("mui-chip-input", w);
@@ -1,6 +1,6 @@
1
- class i extends HTMLElement {
1
+ class s extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["size", "scrollable"];
3
+ return ["size", "scrollable", "wrap"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
@@ -13,7 +13,7 @@ class i extends HTMLElement {
13
13
  }
14
14
  render() {
15
15
  if (!this.shadowRoot) return;
16
- const e = this.hasAttribute("scrollable"), t = (
16
+ const t = this.hasAttribute("scrollable"), e = this.hasAttribute("wrap"), i = (
17
17
  /*css*/
18
18
  `
19
19
  :host {
@@ -44,13 +44,15 @@ class i extends HTMLElement {
44
44
  padding: var(--space-400) var(--space-500);
45
45
  box-sizing: border-box;
46
46
  width: 100%;
47
- overflow-x: ${e ? "auto" : "visible"};
48
- white-space: ${e ? "nowrap" : "wrap"};
47
+ overflow-x: ${e ? "hidden" : t ? "auto" : "visible"};
48
+ white-space: ${e ? "pre-wrap" : t ? "nowrap" : "normal"};
49
+ overflow-wrap: ${e ? "anywhere" : "normal"};
50
+ word-break: ${e ? "break-word" : "normal"};
49
51
  }
50
52
 
51
53
  code:focus-visible {
52
- outline: ${e ? "var(--outline-thick)" : "none"};
53
- outline-offset: ${e ? "calc(-1 * var(--stroke-size-500))" : "none"};
54
+ outline: ${t && !e ? "var(--outline-thick)" : "none"};
55
+ outline-offset: ${t && !e ? "calc(-1 * var(--stroke-size-500))" : "none"};
54
56
  }
55
57
 
56
58
  @media (min-width: 600px) {
@@ -63,9 +65,9 @@ class i extends HTMLElement {
63
65
  );
64
66
  this.shadowRoot.innerHTML = /*html*/
65
67
  `
66
- <style>${t}</style>
68
+ <style>${i}</style>
67
69
  <code><slot></slot></code>
68
70
  `;
69
71
  }
70
72
  }
71
- customElements.get("mui-code") || customElements.define("mui-code", i);
73
+ customElements.get("mui-code") || customElements.define("mui-code", s);
@@ -1,8 +1,8 @@
1
1
  import "../mui-icons/close/index.js";
2
2
  import "../mui-button/index.js";
3
- class l extends HTMLElement {
3
+ class n extends HTMLElement {
4
4
  static get observedAttributes() {
5
- return ["open", "width"];
5
+ return ["open", "width", "content-max-height"];
6
6
  }
7
7
  constructor() {
8
8
  super(), this.attachShadow({ mode: "open" });
@@ -51,6 +51,15 @@ class l extends HTMLElement {
51
51
  padding: var(--space-500);
52
52
  }
53
53
 
54
+ :host([content-max-height="none"]) .content {
55
+ max-height: none;
56
+ overflow-y: visible;
57
+ }
58
+
59
+ :host([content-padding="none"]) .content {
60
+ padding: var(--space-000);
61
+ }
62
+
54
63
  .actions {
55
64
  display: flex;
56
65
  justify-content: flex-end;
@@ -80,10 +89,10 @@ class l extends HTMLElement {
80
89
  </div>
81
90
  </dialog>
82
91
  `, this.dialogEl = this.shadowRoot.querySelector("dialog"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]');
83
- const i = this.shadowRoot.querySelector(".close");
84
- i == null || i.addEventListener("click", () => this.close()), this.dialogEl.addEventListener("click", (e) => {
92
+ const e = this.shadowRoot.querySelector(".close");
93
+ e == null || e.addEventListener("click", () => this.close()), this.dialogEl.addEventListener("click", (i) => {
85
94
  const o = this.dialogEl.getBoundingClientRect();
86
- e.clientX >= o.left && e.clientX <= o.right && e.clientY >= o.top && e.clientY <= o.bottom || this.close();
95
+ i.clientX >= o.left && i.clientX <= o.right && i.clientY >= o.top && i.clientY <= o.bottom || this.close();
87
96
  }), (a = this.actionsSlot) == null || a.addEventListener("slotchange", () => this.updateFooterVisibility()), this.updateFooterVisibility(), this.syncOpenState();
88
97
  }
89
98
  updateFooterVisibility() {
@@ -91,8 +100,8 @@ class l extends HTMLElement {
91
100
  const t = this.actionsSlot.assignedElements().length > 0;
92
101
  this.footerEl.hidden = !t;
93
102
  }
94
- attributeChangedCallback(t, s, i) {
95
- t === "open" && this.syncOpenState(), t === "width" && this.dialogEl && (this.dialogEl.style.width = i || "350px");
103
+ attributeChangedCallback(t, s, e) {
104
+ t === "open" && this.syncOpenState(), t === "width" && this.dialogEl && (this.dialogEl.style.width = e || "350px");
96
105
  }
97
106
  syncOpenState() {
98
107
  this.dialogEl && (this.hasAttribute("open") ? this.dialogEl.open || this.dialogEl.showModal() : this.dialogEl.open && this.dialogEl.close());
@@ -104,4 +113,4 @@ class l extends HTMLElement {
104
113
  this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-dialog-close", { bubbles: !0, composed: !0 }));
105
114
  }
106
115
  }
107
- customElements.get("mui-dialog") || customElements.define("mui-dialog", l);
116
+ customElements.get("mui-dialog") || customElements.define("mui-dialog", n);