@muibook/components 19.3.0 → 19.4.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.
package/README.md CHANGED
@@ -147,6 +147,21 @@ npm run preview:create-mui-app
147
147
  npm install
148
148
  ```
149
149
 
150
+ #### Clean install from the lockfile:
151
+
152
+ Use this when you want to install the exact dependency versions already recorded in `package-lock.json`, especially during an active NPM supply-chain issue.
153
+
154
+ ```bash
155
+ npm ci
156
+ npm run build
157
+ ```
158
+
159
+ - `npm install` reads `package.json` version ranges and may update `package-lock.json`.
160
+ - `npm ci` removes `node_modules` and installs exactly from `package-lock.json`.
161
+ - `npm ci` fails if `package.json` and `package-lock.json` are out of sync.
162
+ - Prefer `npm ci` for CI, release builds, and clean local verification.
163
+ - The current declared versions in `package.json` are pinned for now by removing `^` and `~` ranges.
164
+
150
165
  #### TypeScript Support:
151
166
 
152
167
  ```bash
@@ -1,4 +1,4 @@
1
- class y extends HTMLElement {
1
+ class w extends HTMLElement {
2
2
  static get observedAttributes() {
3
3
  return ["label", "image", "size", "background", "background-color"];
4
4
  }
@@ -59,21 +59,24 @@ class y extends HTMLElement {
59
59
  }
60
60
  render() {
61
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 = {
62
+ "xx-small": "var(--avatar-xx-small)",
62
63
  "x-small": "var(--avatar-x-small)",
63
64
  small: "var(--avatar-small)",
64
65
  medium: "var(--avatar-medium)",
65
66
  large: "var(--avatar-large)"
66
67
  }, s = d[a] ?? d.medium, g = {
67
- "x-small": "var(--font-size-15)",
68
+ "xx-small": "var(--font-size-15)",
69
+ "x-small": "var(--font-size-100)",
68
70
  small: "var(--font-size-200)",
69
71
  medium: "var(--font-size-300)",
70
72
  large: "var(--font-size-400)"
71
73
  }, k = g[a] ?? g.medium, u = {
74
+ "xx-small": "x-small",
72
75
  "x-small": "x-small",
73
76
  small: "small",
74
77
  medium: "medium",
75
78
  large: "large"
76
- }, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m, w = (
79
+ }, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m, x = (
77
80
  /*css*/
78
81
  `
79
82
  :host {
@@ -119,7 +122,7 @@ class y extends HTMLElement {
119
122
  `
120
123
  );
121
124
  if (this.shadowRoot.innerHTML = `
122
- <style>${w}</style>
125
+ <style>${x}</style>
123
126
  ${i ? `<img src="${t}" alt="${l}" />` : ""}
124
127
  <div class="initials" role="img" aria-label="${l}">${h}</div>
125
128
  <slot></slot>
@@ -133,4 +136,4 @@ class y extends HTMLElement {
133
136
  }
134
137
  }
135
138
  }
136
- customElements.get("mui-avatar") || customElements.define("mui-avatar", y);
139
+ customElements.get("mui-avatar") || customElements.define("mui-avatar", w);
@@ -754,9 +754,9 @@ class h extends HTMLElement {
754
754
  // Update avatar sizes based on button size
755
755
  updateAvatarSizes(o) {
756
756
  const t = this.getAttribute("size") || "medium", r = {
757
- "xx-small": "x-small",
758
- "x-small": "x-small",
759
- small: "x-small",
757
+ "xx-small": "xx-small",
758
+ "x-small": "xx-small",
759
+ small: "xx-small",
760
760
  medium: "small",
761
761
  large: "medium"
762
762
  }[t] || "small";
@@ -35,7 +35,7 @@ class l extends HTMLElement {
35
35
  r.assignedNodes({ flatten: !0 }).forEach((o) => {
36
36
  if (o.nodeType === Node.ELEMENT_NODE) {
37
37
  const t = o, i = t.tagName.toLowerCase();
38
- i === "mui-avatar" ? t.setAttribute("size", "x-small") : i.startsWith("mui-icon-") && t.setAttribute("size", a);
38
+ i === "mui-avatar" ? t.setAttribute("size", "xx-small") : i.startsWith("mui-icon-") && t.setAttribute("size", a);
39
39
  }
40
40
  });
41
41
  }
@@ -40,7 +40,7 @@ class s extends HTMLElement {
40
40
  border-radius: inherit;
41
41
  font-family: monospace;
42
42
  color: var(--text-color);
43
- background: var(--surface-elevated-200);
43
+ background: var(--code-background);
44
44
  padding: var(--space-400) var(--space-500);
45
45
  box-sizing: border-box;
46
46
  width: 100%;
@@ -18,10 +18,11 @@ class l extends HTMLElement {
18
18
  }
19
19
 
20
20
  dialog {
21
- border: none;
21
+ border: var(--dialog-border);
22
22
  width: ${this.getAttribute("width") || "350px"};
23
23
  max-width: 90vw;
24
24
  padding: 0;
25
+ box-sizing: border-box;
25
26
  overflow: hidden;
26
27
  border-radius: var(--dialog-radius);
27
28
  background: var(--dialog-background);
@@ -1,6 +1,6 @@
1
1
  import "../mui-icons/close/index.js";
2
2
  import "../mui-button/index.js";
3
- class p extends HTMLElement {
3
+ class u extends HTMLElement {
4
4
  constructor() {
5
5
  super(), this.innerEl = null, this.overlayEl = null, this.footerEl = null, this.actionsSlot = null, this.pushLayout = null, this.outer = null, this.persistentLayout = null, this.headerEl = null, this.headerSlot = null, this._handleEscape = (t) => {
6
6
  const e = this.getAttribute("variant") || "overlay";
@@ -56,15 +56,22 @@ class p extends HTMLElement {
56
56
  `
57
57
  .header {
58
58
  display: flex;
59
+ flex: 0 0 auto;
59
60
  justify-content: space-between;
60
61
  align-items: center;
61
62
  padding: calc(var(--space-400) + env(safe-area-inset-top)) var(--space-400) var(--space-400) var(--space-500);
62
63
  border-bottom: var(--border-thin);
63
64
  box-sizing: border-box;
64
65
  }
66
+ .inner {
67
+ display: flex;
68
+ flex-direction: column;
69
+ }
65
70
  .content {
71
+ flex: 1 1 auto;
72
+ min-height: 0;
66
73
  overflow-y: auto;
67
- height: 100%;
74
+ height: auto;
68
75
  padding: var(--space-500);
69
76
  box-sizing: border-box;
70
77
  }
@@ -83,6 +90,7 @@ class p extends HTMLElement {
83
90
 
84
91
  .actions {
85
92
  display: flex;
93
+ flex: 0 0 auto;
86
94
  align-items: center;
87
95
  justify-content: flex-end;
88
96
  padding: var(--space-400) var(--space-500) calc(var(--space-400) + env(safe-area-inset-bottom));
@@ -90,8 +98,6 @@ class p extends HTMLElement {
90
98
  background: var(--drawer-background);
91
99
  gap: var(--space-300);
92
100
  box-sizing: border-box;
93
- position: fixed;
94
- bottom: 0;
95
101
  width: 100%;
96
102
  }
97
103
  .header[hidden],
@@ -102,18 +108,6 @@ class p extends HTMLElement {
102
108
  ), s = (
103
109
  /*css*/
104
110
  `
105
- :host([has-header]) .content {
106
- height: calc(100dvh - (7.7rem + env(safe-area-inset-top) ));
107
- }
108
-
109
- :host([has-footer]) .content {
110
- height: calc(100dvh - (7.7rem + env(safe-area-inset-bottom) ));
111
- }
112
-
113
- :host([has-header][has-footer]) .content {
114
- height: calc(100dvh - ((7.7rem * 2) + (env(safe-area-inset-top) + env(safe-area-inset-bottom)) ));
115
- }
116
-
117
111
  .overlay {
118
112
  position: fixed;
119
113
  top: 0;
@@ -145,8 +139,6 @@ class p extends HTMLElement {
145
139
  transform: translateX(100%);
146
140
  opacity: 0;
147
141
  visibility: hidden;
148
- display: flex;
149
- flex-direction: column;
150
142
  will-change: transform, opacity;
151
143
  }
152
144
 
@@ -178,7 +170,7 @@ class p extends HTMLElement {
178
170
  visibility: visible;
179
171
  }
180
172
  `
181
- ), r = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", d = (
173
+ ), a = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", l = (
182
174
  /*css*/
183
175
  `
184
176
  .inner {
@@ -190,17 +182,6 @@ class p extends HTMLElement {
190
182
  height: 100%;
191
183
  }
192
184
 
193
- .content { height: 100%; }
194
-
195
- :host([has-header]) .content,
196
- :host([has-footer]) .content {
197
- height: calc(100% - 7.7rem);
198
- }
199
-
200
- :host([has-header][has-footer]) .content {
201
- height: calc(100% - (7.7rem * 2));
202
- }
203
-
204
185
  .outer {
205
186
  overflow: hidden;
206
187
  will-change: transform;
@@ -233,7 +214,7 @@ class p extends HTMLElement {
233
214
 
234
215
  /* Hidden & Persistent */
235
216
  :host([open]) .outer,
236
- :host([variant="persistent"]) .outer { ${r} }
217
+ :host([variant="persistent"]) .outer { ${a} }
237
218
 
238
219
 
239
220
  /* Direct slotted element */
@@ -266,12 +247,6 @@ class p extends HTMLElement {
266
247
  border: none;
267
248
  }
268
249
 
269
- .actions {
270
- position: fixed;
271
- bottom: 0;
272
- width: 100%;
273
- }
274
-
275
250
  /* Overlay */
276
251
  :host([variant="overlay"]) .inner {
277
252
  max-width: ${t};
@@ -313,12 +288,15 @@ class p extends HTMLElement {
313
288
  padding-top: var(--space-400);
314
289
  }
315
290
 
316
- :host([variant="persistent"]) .content { height: auto; }
291
+ :host([variant="persistent"]) .content {
292
+ flex: 0 1 auto;
293
+ min-height: initial;
294
+ height: auto;
295
+ }
317
296
 
318
297
  :host([variant="persistent"]) .actions {
319
298
  border-bottom-right-radius: var(--radius-200);
320
299
  border-bottom-left-radius: var(--radius-200);
321
- position: static;
322
300
  width: 100%;
323
301
  padding: var(--space-400) var(--space-500) var(--space-400);
324
302
  }
@@ -332,10 +310,10 @@ class p extends HTMLElement {
332
310
  }
333
311
 
334
312
  `
335
- ), l = this.getAttribute("side") || this._computedSide, h = e === "overlay" || e === "push";
336
- let a = "";
313
+ ), d = this.getAttribute("side") || this._computedSide, h = e === "overlay" || e === "push";
314
+ let r = "";
337
315
  const c = this.hasAttribute("drawer-space") ? "no-padding" : "";
338
- e === "overlay" ? a = /*html*/
316
+ e === "overlay" ? r = /*html*/
339
317
  `
340
318
  <style>${o}${s}${n}</style>
341
319
  <div class="overlay"></div>
@@ -353,13 +331,13 @@ class p extends HTMLElement {
353
331
  <slot name="actions"></slot>
354
332
  </div>
355
333
  </div>
356
- ` : (e === "push" || e === "persistent") && (a = /*html*/
334
+ ` : (e === "push" || e === "persistent") && (r = /*html*/
357
335
  `
358
- <style>${o}${d}${n}</style>
336
+ <style>${o}${l}${n}</style>
359
337
  <div class="shell">
360
- ${l === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
338
+ ${d === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
361
339
  </div>
362
- `), this.shadowRoot.innerHTML = a;
340
+ `), this.shadowRoot.innerHTML = r;
363
341
  }
364
342
  cacheEls() {
365
343
  this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector(".actions"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector(".header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]');
@@ -403,4 +381,4 @@ class p extends HTMLElement {
403
381
  this.removeAttribute("open"), this.dispatchEvent(new CustomEvent("mui-drawer-close", { bubbles: !0, composed: !0 }));
404
382
  }
405
383
  }
406
- customElements.get("mui-drawer") || customElements.define("mui-drawer", p);
384
+ customElements.get("mui-drawer") || customElements.define("mui-drawer", u);
@@ -1,4 +1,5 @@
1
- class n extends HTMLElement {
1
+ import "../mui-icons/info/index.js";
2
+ class r extends HTMLElement {
2
3
  static get observedAttributes() {
3
4
  return ["variant", "message", "label", "hide-label", "size", "optional"];
4
5
  }
@@ -102,11 +103,12 @@ class n extends HTMLElement {
102
103
  if (!e || !t) return;
103
104
  const i = this.variant, s = this.message;
104
105
  let a = "";
105
- if (i === "success" ? a = '<mui-icon-check slot="before"></mui-icon-check>' : i === "warning" ? a = '<mui-icon-warning slot="before"></mui-icon-warning>' : i === "error" && (a = '<mui-icon-attention slot="before"></mui-icon-attention>'), t.assignedNodes({ flatten: !0 }).some((o) => o.nodeType === Node.ELEMENT_NODE ? !0 : o.nodeType === Node.TEXT_NODE ? (o.textContent || "").trim().length > 0 : !1)) {
106
+ if (i === "success" ? a = '<mui-icon-check slot="before"></mui-icon-check>' : i === "warning" ? a = '<mui-icon-warning slot="before"></mui-icon-warning>' : i === "error" ? a = '<mui-icon-attention slot="before"></mui-icon-attention>' : i === "info" && (a = '<mui-icon-info slot="before" color="var(--feedback-info-icon)"></mui-icon-info>'), t.assignedNodes({ flatten: !0 }).some((o) => o.nodeType === Node.ELEMENT_NODE ? !0 : o.nodeType === Node.TEXT_NODE ? (o.textContent || "").trim().length > 0 : !1)) {
106
107
  e.innerHTML = "", this.setAttribute("has-message", "");
107
108
  return;
108
109
  }
109
- e.innerHTML = s ? `<mui-body size="${this.size}" variant="${i}">${a}${s}</mui-body>` : "", s ? this.setAttribute("has-message", "") : this.removeAttribute("has-message");
110
+ const n = i === "info" ? ' style="--text-color: var(--feedback-info-text);"' : "";
111
+ e.innerHTML = s ? `<mui-body size="${this.size}" variant="${i}"${n}>${a}${s}</mui-body>` : "", s ? this.setAttribute("has-message", "") : this.removeAttribute("has-message");
110
112
  }
111
113
  syncMessageSlotSizing() {
112
114
  if (!this.shadowRoot) return;
@@ -127,4 +129,4 @@ class n extends HTMLElement {
127
129
  t && t.addEventListener("slotchange", () => this.passAttributesToChild());
128
130
  }
129
131
  }
130
- customElements.get("mui-field") || customElements.define("mui-field", n);
132
+ customElements.get("mui-field") || customElements.define("mui-field", r);
@@ -1,42 +1,54 @@
1
1
  import "../mui-heading/index.js";
2
2
  import "../mui-body/index.js";
3
- class h extends HTMLElement {
4
- static get observedAttributes() {
5
- return ["heading", "hide-label", "variant"];
6
- }
3
+ class n extends HTMLElement {
7
4
  constructor() {
8
- super(), this.attachShadow({ mode: "open" });
5
+ super(), this.slotEl = null, this.updateChoiceGroupState = () => {
6
+ var o;
7
+ const t = ((o = this.slotEl) == null ? void 0 : o.assignedElements({ flatten: !0 })) || [], e = "mui-radio-group, mui-radio, mui-checkbox, mui-switch", i = t.some((r) => {
8
+ var a;
9
+ const s = r.tagName.toLowerCase();
10
+ return s === "mui-radio-group" || s === "mui-radio" || s === "mui-checkbox" || s === "mui-switch" ? !0 : !!((a = r.querySelector) != null && a.call(r, e));
11
+ });
12
+ i !== this.hasAttribute("choice-group") && (this.toggleAttribute("choice-group", i), this.render(), this.bindSlotBehavior());
13
+ }, this.attachShadow({ mode: "open" });
14
+ }
15
+ static get observedAttributes() {
16
+ return ["heading", "heading-level", "heading-space", "hide-label", "variant", "space", "aligny"];
9
17
  }
10
18
  connectedCallback() {
11
- this.render(), this.setupSlotBehavior();
19
+ this.render(), this.bindSlotBehavior(), this.updateChoiceGroupState();
12
20
  }
13
21
  attributeChangedCallback() {
14
- this.render();
22
+ this.render(), this.bindSlotBehavior(), this.updateChoiceGroupState();
15
23
  }
16
24
  render() {
17
25
  if (!this.shadowRoot) return;
18
- const t = this.getAttribute("heading") || "", e = this.hasAttribute("hide-label"), r = this.hasAttribute("choice-group");
19
- this.shadowRoot.innerHTML = /*html*/
26
+ const t = this.getAttribute("heading") || "", e = this.hasAttribute("hide-label"), i = this.hasAttribute("choice-group"), o = this.getHeadingLevel();
27
+ this.syncLayoutAttributes(), this.shadowRoot.innerHTML = /*html*/
20
28
  `
21
29
  <style>
22
30
  :host {
23
31
  display: block;
32
+ --form-group-space: var(--space-500);
33
+ --form-group-heading-space: var(--form-group-space);
34
+ --form-group-align-y: start;
24
35
  }
25
36
  .group {
26
37
  display: grid;
27
- gap: var(--space-500);
28
38
  }
29
39
  .group-heading {
30
40
  display: block;
31
41
  margin: 0;
42
+ margin-bottom: var(--form-group-heading-space);
32
43
  }
33
44
  .group-label {
34
45
  display: inline-flex;
35
46
  margin: 0;
47
+ margin-bottom: var(--form-group-space);
36
48
  }
37
49
  .content {
38
50
  display: grid;
39
- gap: var(--space-500);
51
+ gap: var(--form-group-space);
40
52
  min-inline-size: 0;
41
53
  }
42
54
  .content-inner {
@@ -44,7 +56,7 @@ class h extends HTMLElement {
44
56
  }
45
57
  :host([variant="horizontal"]) .content {
46
58
  grid-template-columns: var(--form-group-horizontal-template, minmax(0, 1fr) minmax(0, 20rem));
47
- align-items: start;
59
+ align-items: var(--form-group-align-y);
48
60
  }
49
61
  :host([variant="horizontal"]) .content-inner ::slotted(*) {
50
62
  min-inline-size: 0;
@@ -61,7 +73,7 @@ class h extends HTMLElement {
61
73
  </style>
62
74
 
63
75
  <div class="group">
64
- ${t && !e ? r ? `<mui-body class="group-label" size="small" weight="bold" variant="optional">${t}</mui-body>` : `<mui-heading class="group-heading" size="5" level="5">${t}</mui-heading>` : ""}
76
+ ${t && !e ? i ? `<mui-body class="group-label" size="small" weight="bold" variant="optional">${t}</mui-body>` : `<mui-heading class="group-heading" size="5" level="${o}">${t}</mui-heading>` : ""}
65
77
  <div class="content">
66
78
  <div class="content-inner">
67
79
  <slot></slot>
@@ -70,19 +82,19 @@ class h extends HTMLElement {
70
82
  </div>
71
83
  `;
72
84
  }
73
- setupSlotBehavior() {
85
+ bindSlotBehavior() {
86
+ var e;
74
87
  if (!this.shadowRoot) return;
75
88
  const t = this.shadowRoot.querySelector("slot");
76
- if (!t) return;
77
- const e = () => {
78
- const r = t.assignedElements({ flatten: !0 }), a = "mui-radio-group, mui-radio, mui-checkbox, mui-switch", n = r.some((i) => {
79
- var s;
80
- const o = i.tagName.toLowerCase();
81
- return o === "mui-radio-group" || o === "mui-radio" || o === "mui-checkbox" || o === "mui-switch" ? !0 : !!((s = i.querySelector) != null && s.call(i, a));
82
- });
83
- n && !this.hasAttribute("choice-group") ? (this.setAttribute("choice-group", ""), this.render()) : !n && this.hasAttribute("choice-group") && (this.removeAttribute("choice-group"), this.render());
84
- };
85
- t.addEventListener("slotchange", e), e();
89
+ t && this.slotEl !== t && ((e = this.slotEl) == null || e.removeEventListener("slotchange", this.updateChoiceGroupState), this.slotEl = t, this.slotEl.addEventListener("slotchange", this.updateChoiceGroupState));
90
+ }
91
+ syncLayoutAttributes() {
92
+ const t = this.getAttribute("space"), e = this.getAttribute("aligny"), i = this.getAttribute("heading-space");
93
+ t ? this.style.setProperty("--form-group-space", t) : this.style.removeProperty("--form-group-space"), e ? this.style.setProperty("--form-group-align-y", e) : this.style.removeProperty("--form-group-align-y"), i ? this.style.setProperty("--form-group-heading-space", i) : this.style.removeProperty("--form-group-heading-space");
94
+ }
95
+ getHeadingLevel() {
96
+ const t = this.getAttribute("heading-level") || "5";
97
+ return ["1", "2", "3", "4", "5", "6"].includes(t) ? t : "5";
86
98
  }
87
99
  }
88
- customElements.get("mui-form-group") || customElements.define("mui-form-group", h);
100
+ customElements.get("mui-form-group") || customElements.define("mui-form-group", n);
@@ -779,15 +779,15 @@ class h extends HTMLElement {
779
779
  // Update avatar sizes based on button size
780
780
  updateAvatarSizes(t) {
781
781
  const e = this.getAttribute("size") || "medium", s = ((this.getAttribute("variant") || "default") === "default" ? {
782
- "xx-small": "x-small",
783
- "x-small": "x-small",
784
- small: "x-small",
785
- medium: "x-small",
782
+ "xx-small": "xx-small",
783
+ "x-small": "xx-small",
784
+ small: "xx-small",
785
+ medium: "xx-small",
786
786
  large: "small"
787
787
  } : {
788
- "xx-small": "x-small",
789
- "x-small": "x-small",
790
- small: "x-small",
788
+ "xx-small": "xx-small",
789
+ "x-small": "xx-small",
790
+ small: "xx-small",
791
791
  medium: "small",
792
792
  large: "medium"
793
793
  })[e] || "small";