@muibook/components 7.1.0 → 8.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 (86) hide show
  1. package/dist/esm/agent/keywords/index.js +1 -0
  2. package/dist/esm/agent/prompts/index.js +13 -1
  3. package/dist/esm/components/mui-addon/index.js +0 -1
  4. package/dist/esm/components/mui-avatar/index.js +136 -0
  5. package/dist/esm/components/mui-button/index.js +91 -47
  6. package/dist/esm/components/mui-checkbox/index.js +30 -56
  7. package/dist/esm/components/mui-chip/index.js +17 -10
  8. package/dist/esm/components/mui-dialog/index.js +17 -17
  9. package/dist/esm/components/mui-drawer/index.js +38 -39
  10. package/dist/esm/components/mui-file-upload/index.js +6 -6
  11. package/dist/esm/components/mui-icons/checkmark/index.js +53 -0
  12. package/dist/esm/components/mui-icons/game-controller/index.js +55 -0
  13. package/dist/esm/components/mui-icons/home/index.js +55 -0
  14. package/dist/esm/components/mui-icons/index.js +8 -0
  15. package/dist/esm/components/mui-icons/list-and-film/index.js +55 -0
  16. package/dist/esm/components/mui-icons/movie-clapper/index.js +55 -0
  17. package/dist/esm/components/mui-icons/music-microphone/index.js +55 -0
  18. package/dist/esm/components/mui-icons/music-quarter-note/index.js +55 -0
  19. package/dist/esm/components/mui-icons/play-rectangle/index.js +55 -0
  20. package/dist/esm/components/mui-icons/play-stack/index.js +55 -0
  21. package/dist/esm/components/mui-icons/search/index.js +53 -0
  22. package/dist/esm/components/mui-input/index.js +43 -19
  23. package/dist/esm/components/mui-link/index.js +120 -42
  24. package/dist/esm/components/mui-select/index.js +2 -1
  25. package/dist/esm/components/mui-slat/index.js +0 -1
  26. package/dist/esm/components/mui-slat/slat/index.js +36 -9
  27. package/dist/esm/components/mui-switch/index.js +23 -13
  28. package/dist/esm/css/mui-tokens.css +120 -12
  29. package/dist/esm/custom-elements.json +6186 -0
  30. package/dist/esm/index.js +15 -5
  31. package/dist/types/components/mui-accordion/doc.d.ts +2 -0
  32. package/dist/types/components/mui-addon/doc.d.ts +2 -0
  33. package/dist/types/components/mui-alert/doc.d.ts +2 -0
  34. package/dist/types/components/mui-avatar/doc.d.ts +2 -0
  35. package/dist/types/components/mui-avatar/index.d.ts +1 -0
  36. package/dist/types/components/mui-badge/doc.d.ts +2 -0
  37. package/dist/types/components/mui-body/doc.d.ts +2 -0
  38. package/dist/types/components/mui-button/doc.d.ts +2 -0
  39. package/dist/types/components/mui-button-group/doc.d.ts +2 -0
  40. package/dist/types/components/mui-card/doc.d.ts +2 -0
  41. package/dist/types/components/mui-carousel/doc.d.ts +2 -0
  42. package/dist/types/components/mui-checkbox/doc.d.ts +2 -0
  43. package/dist/types/components/mui-chip/doc.d.ts +2 -0
  44. package/dist/types/components/mui-code/doc.d.ts +2 -0
  45. package/dist/types/components/mui-container/doc.d.ts +2 -0
  46. package/dist/types/components/mui-dialog/doc.d.ts +2 -0
  47. package/dist/types/components/mui-drawer/doc.d.ts +2 -0
  48. package/dist/types/components/mui-dropdown/doc.d.ts +2 -0
  49. package/dist/types/components/mui-field/doc.d.ts +2 -0
  50. package/dist/types/components/mui-file-upload/doc.d.ts +2 -0
  51. package/dist/types/components/mui-grid/doc.d.ts +2 -0
  52. package/dist/types/components/mui-heading/doc.d.ts +2 -0
  53. package/dist/types/components/mui-icons/checkmark.d.ts +1 -0
  54. package/dist/types/components/mui-icons/doc.d.ts +2 -0
  55. package/dist/types/components/mui-icons/game-controller.d.ts +1 -0
  56. package/dist/types/components/mui-icons/home.d.ts +1 -0
  57. package/dist/types/components/mui-icons/index.d.ts +8 -0
  58. package/dist/types/components/mui-icons/list-and-film.d.ts +1 -0
  59. package/dist/types/components/mui-icons/movie-clapper.d.ts +1 -0
  60. package/dist/types/components/mui-icons/music-microphone.d.ts +1 -0
  61. package/dist/types/components/mui-icons/music-quarter-note.d.ts +1 -0
  62. package/dist/types/components/mui-icons/play-rectangle.d.ts +1 -0
  63. package/dist/types/components/mui-icons/play-stack.d.ts +1 -0
  64. package/dist/types/components/mui-icons/search.d.ts +1 -0
  65. package/dist/types/components/mui-image/doc.d.ts +2 -0
  66. package/dist/types/components/mui-input/doc.d.ts +2 -0
  67. package/dist/types/components/mui-link/doc.d.ts +2 -0
  68. package/dist/types/components/mui-list/doc.d.ts +2 -0
  69. package/dist/types/components/mui-loader/doc.d.ts +2 -0
  70. package/dist/types/components/mui-message/doc.d.ts +2 -0
  71. package/dist/types/components/mui-progress/doc.d.ts +2 -0
  72. package/dist/types/components/mui-quote/doc.d.ts +2 -0
  73. package/dist/types/components/mui-responsive/doc.d.ts +2 -0
  74. package/dist/types/components/mui-rule/doc.d.ts +2 -0
  75. package/dist/types/components/mui-select/doc.d.ts +2 -0
  76. package/dist/types/components/mui-slat/doc.d.ts +67 -0
  77. package/dist/types/components/mui-slat/index.d.ts +0 -1
  78. package/dist/types/components/mui-smart-card/doc.d.ts +2 -0
  79. package/dist/types/components/mui-stack/doc.d.ts +2 -0
  80. package/dist/types/components/mui-stepper/doc.d.ts +2 -0
  81. package/dist/types/components/mui-switch/doc.d.ts +2 -0
  82. package/dist/types/components/mui-table/doc.d.ts +2 -0
  83. package/dist/types/components/mui-tabs/doc.d.ts +2 -0
  84. package/dist/types/index.d.ts +11 -1
  85. package/package.json +55 -9
  86. package/dist/esm/components/mui-slat/accessory/index.js +0 -29
@@ -104,6 +104,7 @@ const a = {
104
104
  "variant",
105
105
  "state"
106
106
  ],
107
+ addOn: ["input after", "input before"],
107
108
  // COMPOSITIONS
108
109
  wallet: [
109
110
  "wallet",
@@ -30,7 +30,19 @@ Rules:
30
30
  select: `<mui-field label="Brand"><mui-select options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-field>`,
31
31
  inputAndSelect: `<mui-field label="Amount to transfer" slot="body"><mui-input type="number"><mui-select slot="after" label="Currency" hide-label style="width: 100px;" options='[{ "value": "jpy", "label": "JPY" },{ "value": "usd", "label": "USD" }]'></mui-select></mui-input></mui-field>`
32
32
  },
33
- addon: "<mui-addon>...</mui-addon>",
33
+ addon: {
34
+ text: [
35
+ '<mui-input><mui-addon slot="before">$</mui-addon></mui-input>',
36
+ '<mui-input><mui-addon slot="after">kg</mui-addon></mui-input>',
37
+ '<mui-input><mui-addon slot="before">%</mui-addon></mui-input>',
38
+ '<mui-field label="Website"><mui-input><mui-addon slot="before">https://</mui-addon></mui-input></mui-field>'
39
+ ],
40
+ icon: [
41
+ '<mui-input><mui-addon slot="before"><mui-icon name="search"></mui-icon></mui-addon></mui-input>',
42
+ '<mui-input><mui-addon slot="after"><mui-icon name="calendar"></mui-icon></mui-addon></mui-input>',
43
+ '<mui-field label="Email"><mui-input type="email"><mui-addon slot="before"><mui-icon name="mail"></mui-icon></mui-addon></mui-input></mui-field>'
44
+ ]
45
+ },
34
46
  checkbox: "<mui-checkbox>...</mui-checkbox>",
35
47
  fileUpload: "<mui-file-upload>...</mui-file-upload>",
36
48
  input: "<mui-input>...</mui-input>",
@@ -24,7 +24,6 @@ class o extends HTMLElement {
24
24
  background: var(--addon-background);
25
25
  border: var(--border-thin);
26
26
  border-color: var(--form-default-border-color);
27
- height: 4.4rem;
28
27
  min-width: 4.4rem;
29
28
  white-space: nowrap;
30
29
  }
@@ -0,0 +1,136 @@
1
+ class y extends HTMLElement {
2
+ static get observedAttributes() {
3
+ return ["label", "image", "size", "background", "background-color"];
4
+ }
5
+ constructor() {
6
+ super(), this.attachShadow({ mode: "open" });
7
+ }
8
+ connectedCallback() {
9
+ this._imageFailed === void 0 && (this._imageFailed = !1), this.render();
10
+ }
11
+ attributeChangedCallback() {
12
+ this._imageFailed === void 0 && (this._imageFailed = !1), this.render();
13
+ }
14
+ // Check if slot has content
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());
22
+ }
23
+ ) : !1;
24
+ }
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();
31
+ }
32
+ // Map background prop to token or app-supplied colour
33
+ getBackgroundCSS() {
34
+ const e = this.getAttribute("background") || "neutral", t = this.getAttribute("background-color");
35
+ if (t)
36
+ return t;
37
+ const a = {
38
+ neutral: "var(--avatar-background-neutral)",
39
+ positive: "var(--avatar-background-positive)",
40
+ warning: "var(--avatar-background-warning)",
41
+ attention: "var(--avatar-background-attention)",
42
+ // Random-use profile colours
43
+ purple: "var(--avatar-background-purple)",
44
+ violet: "var(--avatar-background-violet)",
45
+ pink: "var(--avatar-background-pink)",
46
+ magenta: "var(--avatar-background-magenta)",
47
+ red: "var(--avatar-background-red)",
48
+ orange: "var(--avatar-background-orange)",
49
+ amber: "var(--avatar-background-amber)",
50
+ yellow: "var(--avatar-background-yellow)",
51
+ lime: "var(--avatar-background-lime)",
52
+ green: "var(--avatar-background-green)",
53
+ teal: "var(--avatar-background-teal)",
54
+ cyan: "var(--avatar-background-cyan)",
55
+ blue: "var(--avatar-background-blue)",
56
+ indigo: "var(--avatar-background-indigo)"
57
+ };
58
+ return a[e] ?? a.neutral;
59
+ }
60
+ 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 = {
62
+ "x-small": "var(--avatar-x-small)",
63
+ small: "var(--avatar-small)",
64
+ medium: "var(--avatar-medium)",
65
+ large: "var(--avatar-large)"
66
+ }, s = d[a] ?? d.medium, g = {
67
+ "x-small": "var(--font-size-15)",
68
+ small: "var(--font-size-200)",
69
+ medium: "var(--font-size-300)",
70
+ large: "var(--font-size-400)"
71
+ }, k = g[a] ?? g.medium, u = {
72
+ "x-small": "x-small",
73
+ small: "small",
74
+ medium: "medium",
75
+ large: "large"
76
+ }, f = u[a] ?? u.medium, m = this.getBackgroundCSS(), p = r === "neutral" && !n ? `var(--avatar-background-override, ${m})` : m, w = (
77
+ /*css*/
78
+ `
79
+ :host {
80
+ display: inline-flex;
81
+ width: ${s};
82
+ height: ${s};
83
+ border-radius: ${s};
84
+ font-weight: var(--font-weight-bold);
85
+ letter-spacing: -0.05rem;
86
+ font-size: ${k};
87
+ color: var(--text-color);
88
+ background: ${p};
89
+ overflow: hidden;
90
+ align-items: center;
91
+ justify-content: center;
92
+ user-select: none;
93
+ box-sizing: border-box;
94
+ padding: ${c || o ? `calc(${s} * 0.1)` : "0"};
95
+ flex: none;
96
+ }
97
+ img {
98
+ width: 100%;
99
+ height: 100%;
100
+ object-fit: cover;
101
+ display: ${i ? "block" : "none"};
102
+ }
103
+ .initials {
104
+ display: ${c ? "flex" : "none"};
105
+ align-items: center;
106
+ justify-content: center;
107
+ width: 100%;
108
+ height: 100%;
109
+ text-transform: uppercase;
110
+ text-decoration: none;
111
+ }
112
+ slot {
113
+ display: ${o ? "flex" : "none"};
114
+ align-items: center;
115
+ justify-content: center;
116
+ width: 100%;
117
+ height: 100%;
118
+ }
119
+ `
120
+ );
121
+ if (this.shadowRoot.innerHTML = `
122
+ <style>${w}</style>
123
+ ${i ? `<img src="${t}" alt="${l}" />` : ""}
124
+ <div class="initials" role="img" aria-label="${l}">${h}</div>
125
+ <slot></slot>
126
+ `, o && this.shadowRoot.querySelector("slot").assignedElements().forEach((b) => {
127
+ b.tagName.toLowerCase().startsWith("mui-icon-") && b.setAttribute("size", f);
128
+ }), i && t) {
129
+ const v = this.shadowRoot.querySelector("img");
130
+ v.onerror = () => {
131
+ this._imageFailed = !0, this.render();
132
+ };
133
+ }
134
+ }
135
+ }
136
+ customElements.get("mui-avatar") || customElements.define("mui-avatar", y);
@@ -1,5 +1,5 @@
1
1
  import { getPartMap as u } from "../../utils/part-map/index.js";
2
- class v extends HTMLElement {
2
+ class h extends HTMLElement {
3
3
  static get observedAttributes() {
4
4
  return ["onclick", "type", "aria-label", "disabled", "variant", "size", "usage"];
5
5
  }
@@ -337,7 +337,7 @@ class v extends HTMLElement {
337
337
  }
338
338
 
339
339
  /* Dropdown Slot */
340
- :host(.dropdown-slot) button {
340
+ :host([size].dropdown-slot) button {
341
341
  border-radius: var(--radius-000);
342
342
  }
343
343
 
@@ -346,16 +346,40 @@ class v extends HTMLElement {
346
346
  background: var(--dropdown-button-background-hover);
347
347
  }
348
348
 
349
- :host(.dropdown-slot-first) button {
349
+ :host([size].dropdown-slot-first) button {
350
350
  border-top-left-radius: calc(var(--radius-100) / 2);
351
351
  border-top-right-radius: calc(var(--radius-100) / 2);
352
352
  }
353
353
 
354
- :host(.dropdown-slot-last) button {
354
+ :host([size].dropdown-slot-last) button {
355
355
  border-bottom-left-radius: calc(var(--radius-100) / 2);
356
356
  border-bottom-right-radius: calc(var(--radius-100) / 2);
357
357
  }
358
358
 
359
+ :host button ::slotted(mui-avatar) {
360
+ --avatar-background-override: var(--action-avatar-background);
361
+ }
362
+
363
+ :host([size="x-small"]) button ::slotted(mui-avatar) {
364
+ margin-right: var(--space-025);
365
+ }
366
+ :host([size="small"]) button ::slotted(mui-avatar),
367
+ :host([size="medium"]) button ::slotted(mui-avatar),
368
+ :host([size="large"]) button ::slotted(mui-avatar) {
369
+ margin-right: var(--space-050);
370
+ }
371
+
372
+ :host button:disabled ::slotted(mui-avatar),
373
+ :host button:disabled:hover ::slotted(mui-avatar),
374
+ :host button:disabled:focus ::slotted(mui-avatar) {
375
+ opacity: 0.5;
376
+ --avatar-background-override: var(--action-avatar-background);
377
+ }
378
+
379
+ :host button:hover ::slotted(mui-avatar),
380
+ :host button:focus ::slotted(mui-avatar) {
381
+ --avatar-background-override: var(--action-avatar-background-hover);
382
+ }
359
383
 
360
384
  /* Before & After Icon
361
385
  ========================================= */
@@ -388,29 +412,34 @@ class v extends HTMLElement {
388
412
  ========================================= */
389
413
  :host([size="x-small"]) button,
390
414
  :host([size="x-small"]) button:hover,
391
- :host([size="x-small"]) button:focus {
415
+ :host([size="x-small"]) button:focus,
416
+ :host([size="x-small"]) button:disabled {
392
417
  font-size: var(--text-font-size-xs);
393
418
  line-height: var(--text-line-height-xs);
394
419
  font-weight: var(--font-weight-semi-bold);
395
420
  padding: var(--action-padding-x-small);
396
421
  border-width: var(--stroke-size-100);
422
+ border-radius: var(--action-radius-x-small);
397
423
  }
398
424
 
399
425
  :host([size="small"]) button {
400
426
  font-size: var(--text-font-size-s);
401
427
  line-height: var(--text-line-height-s);
402
428
  padding: var(--action-padding-small);
429
+ border-radius: var(--action-radius-small);
403
430
  }
404
431
 
405
432
  :host([size="medium"]) button {
406
433
  font-size: var(--text-font-size-m);
407
434
  line-height: var(--text-line-height-m);
435
+ border-radius: var(--action-radius-medium);
408
436
  }
409
437
 
410
438
  :host([size="large"]) button {
411
439
  font-size: var(--text-font-size-l);
412
440
  line-height: var(--text-line-height-l);
413
441
  padding: var(--action-padding-large);
442
+ border-radius: var(--action-radius-large);
414
443
  }
415
444
 
416
445
  :host([size="x-small"][icon-only]) button {
@@ -509,69 +538,84 @@ class v extends HTMLElement {
509
538
  `
510
539
  );
511
540
  this.shadowRoot.innerHTML = a, await customElements.whenDefined("mui-button"), requestAnimationFrame(() => {
512
- const e = this.shadowRoot;
513
- if (!e) return;
514
- const o = e.querySelector("slot:not([name])"), c = e.querySelector('slot[name="before"]'), s = e.querySelector('slot[name="after"]'), t = (i) => i ? i.assignedNodes({ flatten: !0 }).some((r) => {
515
- var l;
516
- return r.nodeType === Node.ELEMENT_NODE || r.nodeType === Node.TEXT_NODE && !!((l = r.textContent) != null && l.trim());
517
- }) : !1, d = t(c), h = t(s);
518
- this.classList.toggle("has-before", d), this.classList.toggle("has-after", h);
519
- const b = (o == null ? void 0 : o.assignedNodes({ flatten: !0 })) ?? [];
520
- b.every((i) => {
521
- var r;
522
- if (i.nodeType === Node.ELEMENT_NODE) {
523
- const l = i;
524
- return l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon");
541
+ const i = this.shadowRoot;
542
+ if (!i) return;
543
+ const t = i.querySelector("slot:not([name])"), n = i.querySelector('slot[name="before"]'), r = i.querySelector('slot[name="after"]'), o = (l) => l ? l.assignedNodes({ flatten: !0 }).some((s) => {
544
+ var c;
545
+ return s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE && !!((c = s.textContent) != null && c.trim());
546
+ }) : !1, d = o(n), v = o(r);
547
+ this.classList.toggle("has-before", d), this.classList.toggle("has-after", v);
548
+ const b = (t == null ? void 0 : t.assignedNodes({ flatten: !0 })) ?? [];
549
+ b.every((l) => {
550
+ var s;
551
+ if (l.nodeType === Node.ELEMENT_NODE) {
552
+ const c = l;
553
+ return c.tagName.toLowerCase() === "svg" || c.classList.contains("mui-icon");
525
554
  }
526
- return i.nodeType === Node.TEXT_NODE && !((r = i.textContent) != null && r.trim());
527
- }) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(b, !0)) : (this.removeAttribute("icon-only"), [c, o, s].forEach((r) => {
528
- if (r) {
529
- const l = r.assignedNodes({ flatten: !0 });
530
- this.updateIconSizes(l, !1);
555
+ return l.nodeType === Node.TEXT_NODE && !((s = l.textContent) != null && s.trim());
556
+ }) ? (this.setAttribute("icon-only", ""), this.updateIconSizes(b, !0)) : (this.removeAttribute("icon-only"), [n, t, r].forEach((s) => {
557
+ if (s) {
558
+ const c = s.assignedNodes({ flatten: !0 });
559
+ this.updateIconSizes(c, !1), this.updateAvatarSizes(c);
531
560
  }
532
561
  }));
533
562
  });
534
563
  }
535
- attributeChangedCallback(n, a, e) {
536
- n === "size" && a !== e && this.shadowRoot && requestAnimationFrame(() => {
537
- const o = this.shadowRoot;
538
- if (!o) return;
539
- const c = [
540
- o.querySelector("slot:not([name])"),
541
- o.querySelector('slot[name="before"]'),
542
- o.querySelector('slot[name="after"]')
543
- ], s = this.hasAttribute("icon-only");
544
- c.forEach((t) => {
545
- if (t) {
546
- const d = t.assignedNodes({ flatten: !0 });
547
- this.updateIconSizes(d, s);
564
+ attributeChangedCallback(e, a, i) {
565
+ e === "size" && a !== i && this.shadowRoot && requestAnimationFrame(() => {
566
+ const t = this.shadowRoot;
567
+ if (!t) return;
568
+ const n = [
569
+ t.querySelector("slot:not([name])"),
570
+ t.querySelector('slot[name="before"]'),
571
+ t.querySelector('slot[name="after"]')
572
+ ], r = this.hasAttribute("icon-only");
573
+ n.forEach((o) => {
574
+ if (o) {
575
+ const d = o.assignedNodes({ flatten: !0 });
576
+ this.updateIconSizes(d, r), this.updateAvatarSizes(d);
548
577
  }
549
578
  });
550
579
  });
551
580
  }
552
- updateIconSizes(n, a) {
553
- const e = this.getAttribute("size") || "medium", c = {
581
+ // Update avatar sizes based on button size
582
+ updateAvatarSizes(e) {
583
+ const a = this.getAttribute("size") || "medium", t = {
584
+ "x-small": "x-small",
585
+ small: "x-small",
586
+ medium: "small",
587
+ large: "medium"
588
+ }[a] || "small";
589
+ e.forEach((n) => {
590
+ if (n.nodeType === Node.ELEMENT_NODE) {
591
+ const r = n;
592
+ r.tagName.toLowerCase() === "mui-avatar" && r.setAttribute("size", t);
593
+ }
594
+ });
595
+ }
596
+ updateIconSizes(e, a) {
597
+ const i = this.getAttribute("size") || "medium", n = {
554
598
  "x-small": "x-small",
555
599
  small: "x-small",
556
600
  medium: a ? "medium" : "small",
557
601
  // small for regular, medium for icon-only
558
602
  large: a ? "large" : "medium"
559
- }[e] || "small";
560
- n.forEach((s) => {
561
- if (s.nodeType === Node.ELEMENT_NODE) {
562
- const t = s;
563
- (t.tagName.toLowerCase() === "svg" || t.classList.contains("mui-icon") || t.tagName.toLowerCase() === "mui-icon") && !t.hasAttribute("size") && t.setAttribute("size", c);
603
+ }[i] || "small";
604
+ e.forEach((r) => {
605
+ if (r.nodeType === Node.ELEMENT_NODE) {
606
+ const o = r;
607
+ (o.tagName.toLowerCase() === "svg" || o.classList.contains("mui-icon") || o.tagName.toLowerCase() === "mui-icon") && !o.hasAttribute("size") && o.setAttribute("size", n);
564
608
  }
565
609
  });
566
610
  }
567
611
  waitForPartMap() {
568
- return new Promise((n) => {
569
- if (typeof u == "function") return n();
612
+ return new Promise((e) => {
613
+ if (typeof u == "function") return e();
570
614
  const a = () => {
571
- typeof u == "function" ? n() : requestAnimationFrame(a);
615
+ typeof u == "function" ? e() : requestAnimationFrame(a);
572
616
  };
573
617
  a();
574
618
  });
575
619
  }
576
620
  }
577
- customElements.get("mui-button") || customElements.define("mui-button", v);
621
+ customElements.get("mui-button") || customElements.define("mui-button", h);
@@ -9,79 +9,55 @@ class d extends HTMLElement {
9
9
  connectedCallback() {
10
10
  this.render(), this.setupListener();
11
11
  }
12
- attributeChangedCallback(e, o, c) {
13
- var i, r, s;
12
+ attributeChangedCallback(e, r, i) {
13
+ var c, o, s;
14
14
  if (e === "checked") {
15
- const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("input");
15
+ const t = (c = this.shadowRoot) == null ? void 0 : c.querySelector("input");
16
16
  if (!t) return;
17
- t.checked = c !== null;
17
+ t.checked = i !== null;
18
18
  }
19
19
  if (e === "disabled") {
20
- const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
20
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
21
21
  if (!t) return;
22
- t.disabled = c !== null;
22
+ t.disabled = i !== null;
23
23
  }
24
24
  if (e === "indeterminate") {
25
25
  const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
26
26
  if (!t) return;
27
- const n = c !== null;
27
+ const n = i !== null;
28
28
  t.indeterminate = n, n && (t.checked = !0, this.setAttribute("checked", ""));
29
29
  }
30
30
  "id".includes(e) && (this.render(), this.setupListener());
31
31
  }
32
32
  setupListener() {
33
- var o;
34
- const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
35
- e && (e.addEventListener("change", (c) => {
36
- const i = c.target;
33
+ var r;
34
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
35
+ e && (e.addEventListener("change", (i) => {
36
+ const c = i.target;
37
37
  this.dispatchEvent(
38
38
  new CustomEvent("change", {
39
- detail: { checked: i.checked },
39
+ detail: { checked: c.checked },
40
40
  bubbles: !0,
41
41
  composed: !0
42
42
  })
43
- ), i.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
44
- }), e.indeterminate = this.hasAttribute("indeterminate"), e.addEventListener("change", (c) => {
45
- const i = c.target;
43
+ ), c.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
44
+ }), e.indeterminate = this.hasAttribute("indeterminate"), e.addEventListener("change", (i) => {
45
+ const c = i.target;
46
46
  this.dispatchEvent(
47
47
  new CustomEvent("change", {
48
- detail: { checked: i.checked },
48
+ detail: { checked: c.checked },
49
49
  bubbles: !0,
50
50
  composed: !0
51
51
  })
52
- ), this.removeAttribute("indeterminate"), i.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
52
+ ), this.removeAttribute("indeterminate"), c.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
53
53
  }));
54
54
  }
55
55
  render() {
56
- const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`, o = this.hasAttribute("checked"), c = this.hasAttribute("disabled"), i = `
57
- <svg
58
- class="icon"
59
- xmlns="http://www.w3.org/2000/svg"
60
- width="16"
61
- height="16"
62
- fill="none"
63
- viewBox="0 0 16 16"
64
- >
65
- <path
66
- fill="currentColor"
67
- d="M12.783 3.59a1 1 0 0 1 1.414 1.414L6.791 12.41a1 1 0 0 1-1.414 0L1.803 8.837l-.069-.076A1 1 0 0 1 3.14 7.353l.077.07 2.866 2.866z"
68
- ></path>
69
- </svg>
70
- `, r = this.hasAttribute("indeterminate"), t = r ? `
71
- <svg
72
- class="icon"
73
- xmlns="http://www.w3.org/2000/svg"
74
- width="16"
75
- height="16"
76
- fill="none"
77
- viewBox="0 0 16 16"
78
- >
79
- <path
80
- fill="currentColor"
81
- d="m12.5 7 .102.005a1 1 0 0 1 0 1.99L12.5 9h-9a1 1 0 0 1 0-2z"
82
- ></path>
83
- </svg>
84
- ` : i, n = this.innerHTML.trim().length > 0;
56
+ const e = this.getAttribute("id") || `mui-checkbox-${Math.random().toString(36).substr(2, 9)}`, r = this.hasAttribute("checked"), i = this.hasAttribute("disabled"), c = `
57
+ <mui-icon-checkmark class="icon" size="x-small" color="inverted"></mui-icon-checkmark>
58
+ `, o = this.hasAttribute("indeterminate"), t = o ? `
59
+ <mui-icon-subtract class="icon" size="x-small" color="inverted"></mui-icon-subtract>
60
+ ` : c, n = this.innerHTML.trim().length > 0;
85
61
  this.shadowRoot.innerHTML = /*html*/
86
62
  `
87
63
  <style>
@@ -98,8 +74,8 @@ class d extends HTMLElement {
98
74
 
99
75
  input[type="checkbox"] {
100
76
  all: unset;
101
- width: 19px;
102
- height: 19px;
77
+ width: var(--checkbox-size);
78
+ height: var(--checkbox-size);
103
79
  border: var(--border-thin);
104
80
  border-color: var(--form-default-border-color);
105
81
  border-radius: var(--checkbox-radius);
@@ -142,11 +118,9 @@ class d extends HTMLElement {
142
118
  top: 50%;
143
119
  left: 50%;
144
120
  transform: translate(-50%, -50%);
145
- width: 16px;
146
- height: 16px;
147
121
  pointer-events: none;
148
122
  display: none;
149
- color: var(--checkbox-icon-color-checked);
123
+ fill: var(--checkbox-icon-color-checked);
150
124
  }
151
125
 
152
126
  .checkbox-wrapper input:checked + .icon {
@@ -164,9 +138,9 @@ class d extends HTMLElement {
164
138
  <input
165
139
  type="checkbox"
166
140
  id="${e}"
167
- ${r ? "indeterminate" : ""}
168
- ${r || o ? "checked" : ""}
169
- ${c ? "disabled" : ""}
141
+ ${o ? "indeterminate" : ""}
142
+ ${o || r ? "checked" : ""}
143
+ ${i ? "disabled" : ""}
170
144
  />
171
145
  ${t}
172
146
  </span>
@@ -175,8 +149,8 @@ class d extends HTMLElement {
175
149
  `;
176
150
  }
177
151
  get checked() {
178
- var o;
179
- const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector("input");
152
+ var r;
153
+ const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
180
154
  return (e == null ? void 0 : e.checked) ?? !1;
181
155
  }
182
156
  set checked(e) {
@@ -17,15 +17,24 @@ class d extends HTMLElement {
17
17
  requestAnimationFrame(() => {
18
18
  const t = this.shadowRoot;
19
19
  if (!t) return;
20
- const e = t.querySelector('slot[name="before"]'), i = t.querySelector('slot[name="after"]'), r = (o) => o ? o.assignedNodes({ flatten: !0 }).some((a) => {
21
- var s;
22
- return a.nodeType === Node.ELEMENT_NODE || a.nodeType === Node.TEXT_NODE && !!((s = a.textContent) != null && s.trim());
23
- }) : !1, c = r(e), n = r(i);
24
- this.classList.toggle("has-before", c), this.classList.toggle("has-after", n);
20
+ const i = t.querySelector('slot[name="before"]'), e = t.querySelector('slot[name="after"]'), a = (o) => o ? o.assignedNodes({ flatten: !0 }).some((s) => {
21
+ var c;
22
+ return s.nodeType === Node.ELEMENT_NODE || s.nodeType === Node.TEXT_NODE && !!((c = s.textContent) != null && c.trim());
23
+ }) : !1, r = a(i), n = a(e);
24
+ this.classList.toggle("has-before", r), this.classList.toggle("has-after", n), this.forceAvatarSize(i), this.forceAvatarSize(e);
25
+ });
26
+ }
27
+ forceAvatarSize(t) {
28
+ if (!t) return;
29
+ t.assignedNodes({ flatten: !0 }).forEach((e) => {
30
+ if (e.nodeType === Node.ELEMENT_NODE) {
31
+ const a = e, r = a.tagName.toLowerCase();
32
+ r === "mui-avatar" ? a.setAttribute("size", "x-small") : r.startsWith("mui-icon-") && a.setAttribute("size", "medium");
33
+ }
25
34
  });
26
35
  }
27
36
  render() {
28
- var e;
37
+ var i;
29
38
  const t = (
30
39
  /*css*/
31
40
  `
@@ -105,8 +114,6 @@ class d extends HTMLElement {
105
114
  ::slotted(.mui-icon) {
106
115
  box-sizing: border-box;
107
116
  padding: var(--space-025);
108
- width: var(--space-500);
109
- height: var(--space-500);
110
117
  fill: var(--chip-icon-fill);
111
118
  }
112
119
 
@@ -157,8 +164,8 @@ class d extends HTMLElement {
157
164
  <mui-button part="dismiss-btn" variant="tertiary" aria-label="Remove chip">
158
165
  <mui-icon-close size="x-small"></mui-icon-close>
159
166
  </mui-button>
160
- `, (e = this.shadowRoot.querySelector('[part="dismiss-btn"]')) == null || e.addEventListener("click", (i) => {
161
- i.stopPropagation(), this.dispatchEvent(
167
+ `, (i = this.shadowRoot.querySelector('[part="dismiss-btn"]')) == null || i.addEventListener("click", (e) => {
168
+ e.stopPropagation(), this.dispatchEvent(
162
169
  new CustomEvent("dismiss", {
163
170
  bubbles: !0,
164
171
  composed: !0,