@muibook/components 11.0.1 → 13.0.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 (33) hide show
  1. package/dist/esm/components/mui-addon/index.js +41 -8
  2. package/dist/esm/components/mui-field/index.js +26 -9
  3. package/dist/esm/components/mui-hint/index.js +6 -6
  4. package/dist/esm/components/mui-image/index.js +89 -42
  5. package/dist/esm/components/mui-input/index.js +67 -27
  6. package/dist/esm/components/mui-prompt/index.js +87 -64
  7. package/dist/esm/components/mui-prompt-preview/index.js +43 -18
  8. package/dist/esm/components/mui-rule/index.js +7 -5
  9. package/dist/esm/components/mui-select/index.js +48 -15
  10. package/dist/esm/components/mui-skeleton/index.js +139 -0
  11. package/dist/esm/components/mui-slide-frame/index.js +410 -0
  12. package/dist/esm/components/mui-switch/index.js +72 -35
  13. package/dist/esm/components/mui-tabs/tab-bar/index.js +1 -1
  14. package/dist/esm/components/mui-textarea/index.js +40 -7
  15. package/dist/esm/css/mui-brand.css +1 -1
  16. package/dist/esm/css/mui-tokens.css +26 -0
  17. package/dist/esm/custom-elements.json +1573 -732
  18. package/dist/esm/index.js +6 -5
  19. package/dist/types/components/mui-prompt-preview/index.d.ts +1 -0
  20. package/dist/types/components/mui-slide-frame/index.d.ts +7 -0
  21. package/dist/types/index.d.ts +2 -1
  22. package/package.json +11 -11
  23. package/dist/esm/components/mui-markdown/index.js +0 -149
  24. package/dist/types/components/mui-agent-bubble/index.d.ts +0 -1
  25. package/dist/types/components/mui-agent-prompt/index.d.ts +0 -1
  26. package/dist/types/components/mui-markdown/doc.d.ts +0 -2
  27. package/dist/types/components/mui-markdown/index.d.ts +0 -1
  28. package/dist/types/components/mui-prompt-chip/index.d.ts +0 -1
  29. package/dist/types/components/mui-slat/accessory/index.d.ts +0 -1
  30. package/dist/types/tokens/js/mui-brand.d.ts +0 -140
  31. /package/dist/types/components/{mui-agent-bubble → mui-skeleton}/doc.d.ts +0 -0
  32. /package/dist/types/components/{mui-form-group-horizontal → mui-skeleton}/index.d.ts +0 -0
  33. /package/dist/types/components/{mui-agent-prompt → mui-slide-frame}/doc.d.ts +0 -0
@@ -1,18 +1,28 @@
1
- class o extends HTMLElement {
1
+ class s extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["slot"];
3
+ return ["slot", "size"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" });
7
7
  }
8
8
  connectedCallback() {
9
- this.render();
9
+ this.hasAttribute("size") || this.setAttribute("size", "medium"), this.render(), this.syncSlottedContent();
10
10
  }
11
- attributeChangedCallback(r, e, t) {
12
- r === "slot" && e !== t && this.render();
11
+ attributeChangedCallback(t, i, e) {
12
+ (t === "slot" || t === "size") && i !== e && (this.render(), this.syncSlottedContent());
13
+ }
14
+ syncSlottedContent() {
15
+ var e;
16
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
17
+ if (!t) return;
18
+ const i = this.getAttribute("size") || "medium";
19
+ t.assignedElements({ flatten: !0 }).forEach((o) => {
20
+ o.tagName.toLowerCase() === "mui-body" && o.setAttribute("size", i);
21
+ });
13
22
  }
14
23
  render() {
15
- this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
24
+ if (!this.shadowRoot) return;
25
+ this.shadowRoot.innerHTML = /*html*/
16
26
  `
17
27
  <style>
18
28
  :host {
@@ -20,6 +30,7 @@ class o extends HTMLElement {
20
30
  align-items: center;
21
31
  justify-content: center;
22
32
  box-sizing: border-box;
33
+ min-height: 4.4rem;
23
34
  padding: var(--space-200) var(--space-400);
24
35
  background: var(--addon-background);
25
36
  border: var(--border-thin);
@@ -27,6 +38,26 @@ class o extends HTMLElement {
27
38
  min-width: 4.4rem;
28
39
  white-space: nowrap;
29
40
  }
41
+ :host([size="x-small"]) {
42
+ min-height: var(--action-icon-only-size-x-small);
43
+ min-width: var(--action-icon-only-size-x-small);
44
+ padding: var(--action-padding-x-small);
45
+ }
46
+ :host([size="small"]) {
47
+ min-height: var(--action-icon-only-size-small);
48
+ min-width: var(--action-icon-only-size-small);
49
+ padding: var(--action-padding-small);
50
+ }
51
+ :host([size="medium"]) {
52
+ min-height: 4.4rem;
53
+ min-width: 4.4rem;
54
+ padding: var(--space-200) var(--space-400);
55
+ }
56
+ :host([size="large"]) {
57
+ min-height: var(--action-icon-only-size-large);
58
+ min-width: var(--action-icon-only-size-large);
59
+ padding: var(--space-300) var(--space-500);
60
+ }
30
61
  :host([slot="before"]) {
31
62
  border-right: none;
32
63
  border-top-left-radius: var(--radius-100);
@@ -39,7 +70,9 @@ class o extends HTMLElement {
39
70
  }
40
71
  </style>
41
72
  <slot></slot>
42
- `);
73
+ `;
74
+ const t = this.shadowRoot.querySelector("slot");
75
+ t == null || t.addEventListener("slotchange", () => this.syncSlottedContent());
43
76
  }
44
77
  }
45
- customElements.get("mui-addon") || customElements.define("mui-addon", o);
78
+ customElements.get("mui-addon") || customElements.define("mui-addon", s);
@@ -1,6 +1,6 @@
1
- class o extends HTMLElement {
1
+ class n extends HTMLElement {
2
2
  static get observedAttributes() {
3
- return ["variant", "message", "label", "hide-label", "size"];
3
+ return ["variant", "message", "label", "hide-label", "size", "optional"];
4
4
  }
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
@@ -70,14 +70,20 @@ class o extends HTMLElement {
70
70
  set size(e) {
71
71
  this.setAttribute("size", e);
72
72
  }
73
+ get optional() {
74
+ return this.hasAttribute("optional");
75
+ }
76
+ set optional(e) {
77
+ e ? this.setAttribute("optional", "") : this.removeAttribute("optional");
78
+ }
73
79
  // -----------------------
74
80
  // Lifecycle methods
75
81
  // -----------------------
76
82
  connectedCallback() {
77
- this.bindSlotEvents(), this.renderMessage(), this.passAttributesToChild();
83
+ this.bindSlotEvents(), this.renderMessage(), this.passAttributesToChild(), this.syncMessageSlotSizing();
78
84
  }
79
85
  attributeChangedCallback(e) {
80
- ["variant", "message", "label", "hide-label", "size"].includes(e) && (this.renderMessage(), this.passAttributesToChild());
86
+ ["variant", "message", "label", "hide-label", "size", "optional"].includes(e) && (this.renderMessage(), this.passAttributesToChild(), this.syncMessageSlotSizing());
81
87
  }
82
88
  // -----------------------
83
89
  // Helper methods
@@ -86,7 +92,7 @@ class o extends HTMLElement {
86
92
  var i;
87
93
  if (!this.shadowRoot) return;
88
94
  const e = this.shadowRoot.querySelector("slot"), t = (i = e == null ? void 0 : e.assignedElements) == null ? void 0 : i.call(e)[0];
89
- t && ["variant", "label", "hide-label", "size"].forEach((s) => {
95
+ t && ["variant", "label", "hide-label", "size", "optional"].forEach((s) => {
90
96
  this.hasAttribute(s) ? t.setAttribute(s, this.getAttribute(s) || "") : t.removeAttribute(s);
91
97
  });
92
98
  }
@@ -96,18 +102,29 @@ class o extends HTMLElement {
96
102
  if (!e || !t) return;
97
103
  const i = this.variant, s = this.message;
98
104
  let a = "";
99
- 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((n) => n.nodeType === Node.ELEMENT_NODE ? !0 : n.nodeType === Node.TEXT_NODE ? (n.textContent || "").trim().length > 0 : !1)) {
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)) {
100
106
  e.innerHTML = "", this.setAttribute("has-message", "");
101
107
  return;
102
108
  }
103
- e.innerHTML = s ? `<mui-body size="small" variant="${i}">${a}${s}</mui-body>` : "", s ? this.setAttribute("has-message", "") : this.removeAttribute("has-message");
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
+ }
111
+ syncMessageSlotSizing() {
112
+ if (!this.shadowRoot) return;
113
+ const e = this.size || "medium", t = this.shadowRoot.querySelector('slot[name="message"]');
114
+ if (!t) return;
115
+ t.assignedElements({ flatten: !0 }).forEach((s) => {
116
+ const a = s.tagName.toLowerCase();
117
+ (a === "mui-form-message" || a === "mui-form-hint" || a === "mui-body") && s.setAttribute("size", e);
118
+ });
104
119
  }
105
120
  bindSlotEvents() {
106
121
  if (!this.shadowRoot) return;
107
122
  const e = this.shadowRoot.querySelector('slot[name="message"]');
108
- e && e.addEventListener("slotchange", () => this.renderMessage());
123
+ e && e.addEventListener("slotchange", () => {
124
+ this.renderMessage(), this.syncMessageSlotSizing();
125
+ });
109
126
  const t = this.shadowRoot.querySelector("slot:not([name])");
110
127
  t && t.addEventListener("slotchange", () => this.passAttributesToChild());
111
128
  }
112
129
  }
113
- customElements.get("mui-field") || customElements.define("mui-field", o);
130
+ customElements.get("mui-field") || customElements.define("mui-field", n);
@@ -20,7 +20,7 @@ class y extends HTMLElement {
20
20
  `
21
21
  <style>
22
22
  :host {
23
- display: block;
23
+ display: inline-flex;
24
24
  width: max-content;
25
25
  position: relative;
26
26
  vertical-align: middle;
@@ -131,14 +131,14 @@ class y extends HTMLElement {
131
131
  this.openTimer && (window.clearTimeout(this.openTimer), this.openTimer = null), this.closeTimer && (window.clearTimeout(this.closeTimer), this.closeTimer = null), t && this.setAttribute("closing-immediate", ""), this.removeAttribute("open"), t && requestAnimationFrame(() => this.removeAttribute("closing-immediate")), window.removeEventListener("resize", this.boundReposition), window.removeEventListener("scroll", this.boundReposition, !0), document.removeEventListener("pointerdown", this.boundDocPointer, !0);
132
132
  }
133
133
  positionTooltip() {
134
- var u, b, g, f;
135
- const t = (u = this.shadowRoot) == null ? void 0 : u.querySelector(".trigger"), o = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".tooltip");
134
+ var u, g, b, f;
135
+ const t = (u = this.shadowRoot) == null ? void 0 : u.querySelector(".trigger"), o = (g = this.shadowRoot) == null ? void 0 : g.querySelector(".tooltip");
136
136
  if (!o || !t) return;
137
- const h = (g = this.shadowRoot) == null ? void 0 : g.querySelector('slot[name="trigger"]'), w = ((f = h == null ? void 0 : h.assignedElements({ flatten: !0 })) == null ? void 0 : f[0]) || null || t, d = this.getAttribute("placement") || "top", e = w.getBoundingClientRect(), p = this.getBoundingClientRect(), i = o.getBoundingClientRect(), c = window.innerHeight, m = window.innerWidth, r = 8, n = 8;
137
+ const h = (b = this.shadowRoot) == null ? void 0 : b.querySelector('slot[name="trigger"]'), w = ((f = h == null ? void 0 : h.assignedElements({ flatten: !0 })) == null ? void 0 : f[0]) || null || t, d = this.getAttribute("placement") || "top", e = w.getBoundingClientRect(), p = this.getBoundingClientRect(), i = o.getBoundingClientRect(), c = window.innerHeight, m = window.innerWidth, n = 8, r = 8;
138
138
  let s = d;
139
- d === "top" && e.top - i.height - n < r && (s = "bottom"), d === "bottom" && e.bottom + i.height + n > c - r && (s = "top"), d === "left" && e.left - i.width - n < r && (s = "right"), d === "right" && e.right + i.width + n > m - r && (s = "left"), o.setAttribute("data-placement", s);
139
+ d === "top" && e.top - i.height - r < n && (s = "bottom"), d === "bottom" && e.bottom + i.height + r > c - n && (s = "top"), d === "left" && e.left - i.width - r < n && (s = "right"), d === "right" && e.right + i.width + r > m - n && (s = "left"), o.setAttribute("data-placement", s);
140
140
  let a = 0, l = 0;
141
- s === "top" ? (a = e.top - i.height - n, l = e.left + e.width / 2 - i.width / 2) : s === "bottom" ? (a = e.bottom + n, l = e.left + e.width / 2 - i.width / 2) : s === "left" ? (a = e.top + e.height / 2 - i.height / 2, l = e.left - i.width - n) : (a = e.top + e.height / 2 - i.height / 2, l = e.right + n), a = Math.max(r, Math.min(a, c - i.height - r)), l = Math.max(r, Math.min(l, m - i.width - r));
141
+ s === "top" ? (a = e.top - i.height - r, l = e.left + e.width / 2 - i.width / 2) : s === "bottom" ? (a = e.bottom + r, l = e.left + e.width / 2 - i.width / 2) : s === "left" ? (a = e.top + e.height / 2 - i.height / 2, l = e.left - i.width - r) : (a = e.top + e.height / 2 - i.height / 2, l = e.right + r), a = Math.max(n, Math.min(a, c - i.height - n)), l = Math.max(n, Math.min(l, m - i.width - n));
142
142
  const v = a - p.top, x = l - p.left;
143
143
  o.style.top = `${v}px`, o.style.left = `${x}px`;
144
144
  }
@@ -1,49 +1,96 @@
1
- class t extends HTMLElement {
1
+ class c extends HTMLElement {
2
2
  constructor() {
3
- super(), this.attachShadow({ mode: "open" });
3
+ super(), this.observer = null, this.attachShadow({ mode: "open" });
4
+ }
5
+ static get observedAttributes() {
6
+ return ["height", "fit", "crop", "position", "zoom", "focal-x", "focal-y", "radius", "aspect-ratio"];
7
+ }
8
+ syncChildSlots() {
9
+ Array.from(this.children).forEach((e) => {
10
+ const i = e.tagName.toLowerCase();
11
+ i === "img" && !e.hasAttribute("slot") && e.setAttribute("slot", "image"), i === "figcaption" && !e.hasAttribute("slot") && e.setAttribute("slot", "caption");
12
+ });
4
13
  }
5
14
  connectedCallback() {
15
+ this.syncChildSlots(), this.render(), this.observer = new MutationObserver(() => this.syncChildSlots()), this.observer.observe(this, { childList: !0, subtree: !1 });
16
+ }
17
+ disconnectedCallback() {
18
+ var t;
19
+ (t = this.observer) == null || t.disconnect(), this.observer = null;
20
+ }
21
+ attributeChangedCallback(t, e, i) {
22
+ e !== i && this.render();
23
+ }
24
+ clampPercent(t, e) {
25
+ const i = Number.parseFloat(t || "");
26
+ return Number.isFinite(i) ? Math.min(100, Math.max(0, i)) : e;
27
+ }
28
+ getPosition() {
29
+ const t = this.getAttribute("focal-x"), e = this.getAttribute("focal-y");
30
+ if (t != null || e != null) {
31
+ const i = this.clampPercent(t, 50), a = this.clampPercent(e, 50);
32
+ return `${i}% ${a}%`;
33
+ }
34
+ return this.getAttribute("position") || "center center";
35
+ }
36
+ getZoom() {
37
+ const t = Number.parseFloat(this.getAttribute("zoom") || "1");
38
+ return !Number.isFinite(t) || t <= 0 ? 1 : t;
39
+ }
40
+ render() {
6
41
  if (!this.shadowRoot) return;
7
- let e = (
8
- /*html*/
9
- `
10
-
11
- <style>
12
-
13
-
14
- :host {
15
- display: flex;
16
- }
17
- figure {
18
- background: var(--surface-elevated-200);
19
- display: block;
20
- width: 100%;
21
- margin: var(--space-000);
22
- border-radius: var(--radius-300);
23
- overflow: hidden;
24
- }
25
- ::slotted(img) {
26
- width: 100%;
27
- height: auto;
28
- display: block;
29
- border-style: none;
30
- -ms-interpolation-mode: bicubic;
31
- vertical-align: middle;
32
- }
33
- ::slotted(figcaption) {
34
- padding: var(--space-500);
35
- color: var( --text-color);
36
- text-align: center;
37
- display: block;
38
- }
39
- </style>
42
+ const t = this.getAttribute("height") || "", e = this.getAttribute("fit") || (this.hasAttribute("crop") ? "cover" : "contain"), i = this.getPosition(), a = this.getZoom(), o = this.getAttribute("radius") || "var(--radius-300)", s = this.getAttribute("aspect-ratio") || "", r = this.hasAttribute("crop");
43
+ this.style.setProperty("--mui-image-radius-active", o), this.style.setProperty("--mui-image-overflow-active", r ? "hidden" : "clip"), this.style.setProperty("--mui-image-fit-active", e), this.style.setProperty("--mui-image-position-active", i), this.style.setProperty("--mui-image-zoom-active", String(a)), this.style.setProperty("--mui-image-height-active", t || "auto"), this.style.setProperty("--mui-image-aspect-ratio-active", s || "auto"), this.style.setProperty("--mui-image-image-height-active", t || s ? "100%" : "auto"), this.shadowRoot.innerHTML = /*html*/
44
+ `
45
+ <style>
46
+ :host {
47
+ display: flex;
48
+ width: 100%;
49
+ --mui-image-radius-active: var(--radius-300);
50
+ --mui-image-overflow-active: clip;
51
+ --mui-image-fit-active: contain;
52
+ --mui-image-position-active: center center;
53
+ --mui-image-zoom-active: 1;
54
+ --mui-image-height-active: auto;
55
+ --mui-image-aspect-ratio-active: auto;
56
+ --mui-image-image-height-active: auto;
57
+ }
58
+ figure {
59
+ background: var(--surface-elevated-200);
60
+ display: block;
61
+ width: 100%;
62
+ margin: var(--space-000);
63
+ box-sizing: border-box;
64
+ border-radius: var(--mui-image-radius-active);
65
+ overflow: var(--mui-image-overflow-active);
66
+ height: var(--mui-image-height-active);
67
+ aspect-ratio: var(--mui-image-aspect-ratio-active);
68
+ }
69
+ ::slotted([slot="image"]) {
70
+ width: 100%;
71
+ height: var(--mui-image-image-height-active);
72
+ object-fit: var(--mui-image-fit-active);
73
+ object-position: var(--mui-image-position-active);
74
+ display: block;
75
+ border-style: none;
76
+ -ms-interpolation-mode: bicubic;
77
+ vertical-align: middle;
78
+ transform-origin: center;
79
+ transform: scale(var(--mui-image-zoom-active));
80
+ }
81
+ ::slotted([slot="caption"]) {
82
+ padding: var(--space-500);
83
+ color: var(--text-color);
84
+ text-align: center;
85
+ display: block;
86
+ }
87
+ </style>
40
88
 
41
- <figure>
42
- <slot name="image"></slot>
43
- <slot name="caption"></slot>
44
- </figure>`
45
- );
46
- this.shadowRoot.innerHTML = e;
89
+ <figure>
90
+ <slot name="image"></slot>
91
+ <slot name="caption"></slot>
92
+ </figure>
93
+ `;
47
94
  }
48
95
  }
49
- customElements.get("mui-image") || customElements.define("mui-image", t);
96
+ customElements.get("mui-image") || customElements.define("mui-image", c);
@@ -25,7 +25,7 @@ class S extends HTMLElement {
25
25
  disconnectedCallback() {
26
26
  this.cleanupListeners();
27
27
  }
28
- attributeChangedCallback(t, i, e) {
28
+ attributeChangedCallback(t, r, e) {
29
29
  var d;
30
30
  const o = (d = this.shadowRoot) == null ? void 0 : d.querySelector("input");
31
31
  if (o) {
@@ -43,15 +43,15 @@ class S extends HTMLElement {
43
43
  }
44
44
  }
45
45
  cleanupListeners() {
46
- var i;
47
- const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("input");
46
+ var r;
47
+ const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
48
48
  t && this._changeHandler && (t.removeEventListener("change", this._changeHandler), t.removeEventListener("input", this._changeHandler));
49
49
  }
50
50
  setupListener() {
51
51
  if (!this.shadowRoot) return;
52
52
  const t = this.shadowRoot.querySelector("input");
53
- t && (this.cleanupListeners(), this._changeHandler = (i) => {
54
- const e = i.target;
53
+ t && (this.cleanupListeners(), this._changeHandler = (r) => {
54
+ const e = r.target;
55
55
  this.setAttribute("value", e.value);
56
56
  const o = {
57
57
  detail: { value: e.value },
@@ -63,23 +63,23 @@ class S extends HTMLElement {
63
63
  }
64
64
  updateCharacterCount() {
65
65
  var e, o;
66
- const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input"), i = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".char-count");
67
- !t || !i || t.maxLength <= 0 || (i.textContent = `${t.value.length}/${t.maxLength}`);
66
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input"), r = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".char-count");
67
+ !t || !r || t.maxLength <= 0 || (r.textContent = `${t.value.length}/${t.maxLength}`);
68
68
  }
69
69
  updateSlottedButtons() {
70
70
  requestAnimationFrame(() => {
71
- var l, h, p;
72
- const t = this.getAttribute("size") || "medium", e = ["x-small", "small", "medium", "large"].includes(t) ? t : "medium", o = (l = this.shadowRoot) == null ? void 0 : l.querySelector('slot[name="before"]'), d = (h = this.shadowRoot) == null ? void 0 : h.querySelector('slot[name="after"]'), m = (p = this.shadowRoot) == null ? void 0 : p.querySelector('slot[name="hint"]'), u = (c) => {
73
- if (!c) return;
74
- c.assignedNodes({ flatten: !0 }).forEach((s) => {
71
+ var n, u, p;
72
+ const t = this.getAttribute("size") || "medium", e = ["x-small", "small", "medium", "large"].includes(t) ? t : "medium", o = (n = this.shadowRoot) == null ? void 0 : n.querySelector('slot[name="before"]'), d = (u = this.shadowRoot) == null ? void 0 : u.querySelector('slot[name="after"]'), f = (p = this.shadowRoot) == null ? void 0 : p.querySelector('slot[name="hint"]'), c = (h) => {
73
+ if (!h) return;
74
+ h.assignedNodes({ flatten: !0 }).forEach((s) => {
75
75
  if (s.nodeType === Node.ELEMENT_NODE) {
76
- const r = s, a = r.tagName.toLowerCase();
77
- (a === "mui-button" || a === "mui-link") && (r.setAttribute("usage", "input"), r.setAttribute("size", e), r.removeAttribute("variant"), r.removeAttribute("weight")), a === "mui-chip" && (r.setAttribute("usage", "input"), r.setAttribute("size", e));
76
+ const i = s, a = i.tagName.toLowerCase();
77
+ (a === "mui-button" || a === "mui-link") && (i.setAttribute("usage", "input"), i.setAttribute("size", e), i.removeAttribute("variant"), i.removeAttribute("weight")), a === "mui-chip" && (i.setAttribute("usage", "input"), i.setAttribute("size", e)), a === "mui-addon" && i.setAttribute("size", e);
78
78
  }
79
79
  });
80
80
  };
81
- if (u(o), u(d), m) {
82
- const c = {
81
+ if (c(o), c(d), f) {
82
+ const h = {
83
83
  "x-small": "xx-small",
84
84
  small: "x-small",
85
85
  medium: "x-small",
@@ -89,11 +89,15 @@ class S extends HTMLElement {
89
89
  small: "x-small",
90
90
  medium: "small",
91
91
  large: "medium"
92
- }, s = c[e] || "x-small", r = b[e] || "small";
93
- m.assignedNodes({ flatten: !0 }).forEach((a) => {
92
+ }, s = h[e] || "x-small", i = b[e] || "small";
93
+ f.assignedNodes({ flatten: !0 }).forEach((a) => {
94
94
  if (a.nodeType !== Node.ELEMENT_NODE) return;
95
- const n = a, f = n.tagName.toLowerCase();
96
- f.startsWith("mui-icon-") && !n.hasAttribute("size") && n.setAttribute("size", s), f === "mui-badge" && !n.hasAttribute("size") && n.setAttribute("size", r), n.setAttribute("aria-hidden", "true");
95
+ const l = a, m = l.tagName.toLowerCase();
96
+ if (m === "mui-hint") {
97
+ l.removeAttribute("aria-hidden");
98
+ return;
99
+ }
100
+ m.startsWith("mui-icon-") && !l.hasAttribute("size") && l.setAttribute("size", s), m === "mui-badge" && !l.hasAttribute("size") && l.setAttribute("size", i), l.setAttribute("aria-hidden", "true");
97
101
  });
98
102
  }
99
103
  });
@@ -112,7 +116,7 @@ class S extends HTMLElement {
112
116
  "datetime-local",
113
117
  "month",
114
118
  "week"
115
- ], i = this.getAttribute("type") || "text", e = t.includes(i) ? i : "text", o = this.getAttribute("name") || "", d = this.getAttribute("value") || "", m = this.getAttribute("placeholder") || "", u = this.getAttribute("id") || `mui-input-${Math.random().toString(36).substr(2, 9)}`, l = this.getAttribute("label") || "", h = this.hasAttribute("optional"), p = this.hasAttribute("hide-label"), c = this.hasAttribute("disabled"), b = p && l ? `aria-label="${l}"` : "", s = this.getAttribute("max-length"), r = s && Number(s) > 0 ? String(Number(s)) : "", a = this.getAttribute("size") || "medium", f = ["x-small", "small", "medium", "large"].includes(a) ? a : "medium", v = this.getAttribute("variant") || "", g = v || "", x = (this.getAttribute("slot-layout") || "inline") === "stack-mobile" ? "input-wrapper stack-mobile" : "input-wrapper", w = this.querySelector('[slot="before"]') !== null, y = this.querySelector('[slot="after"]') !== null, z = this.querySelector('[slot="hint"]') !== null, E = [g, w ? "before" : "", y ? "after" : "", z ? "hint" : ""].filter(Boolean).join(" "), A = (
119
+ ], r = this.getAttribute("type") || "text", e = t.includes(r) ? r : "text", o = this.getAttribute("name") || "", d = this.getAttribute("value") || "", f = this.getAttribute("placeholder") || "", c = this.getAttribute("id") || `mui-input-${Math.random().toString(36).substr(2, 9)}`, n = this.getAttribute("label") || "", u = this.hasAttribute("optional"), p = this.hasAttribute("hide-label"), h = this.hasAttribute("disabled"), b = p && n ? `aria-label="${n}"` : "", s = this.getAttribute("max-length"), i = s && Number(s) > 0 ? String(Number(s)) : "", a = this.getAttribute("size") || "medium", m = ["x-small", "small", "medium", "large"].includes(a) ? a : "medium", v = this.getAttribute("variant") || "", g = v || "", x = (this.getAttribute("slot-layout") || "inline") === "stack-mobile" ? "input-wrapper stack-mobile" : "input-wrapper", w = this.querySelector('[slot="before"]') !== null, z = this.querySelector('[slot="after"]') !== null, y = this.querySelector('[slot="hint"]') !== null, E = [g, w ? "before" : "", z ? "after" : "", y ? "hint" : ""].filter(Boolean).join(" "), A = (
116
120
  /*html*/
117
121
  `
118
122
  <style>
@@ -133,10 +137,27 @@ class S extends HTMLElement {
133
137
  label {
134
138
  display: block;
135
139
  font-size: var(--text-font-size);
140
+ line-height: var(--text-line-height);
136
141
  font-weight: var(--font-weight-medium);
137
142
  margin-bottom: var(--space-100);
138
143
  color: var(--text-color);
139
144
  }
145
+ :host([size="x-small"]) label {
146
+ font-size: var(--text-font-size-xs);
147
+ line-height: var(--text-line-height-xs);
148
+ }
149
+ :host([size="small"]) label {
150
+ font-size: var(--text-font-size-s);
151
+ line-height: var(--text-line-height-s);
152
+ }
153
+ :host([size="medium"]) label {
154
+ font-size: var(--text-font-size);
155
+ line-height: var(--text-line-height);
156
+ }
157
+ :host([size="large"]) label {
158
+ font-size: var(--text-font-size-l);
159
+ line-height: var(--text-line-height-l);
160
+ }
140
161
  .label-with-optional {
141
162
  display: flex;
142
163
  align-items: center;
@@ -270,6 +291,22 @@ class S extends HTMLElement {
270
291
  text-transform: uppercase;
271
292
  font-weight: var(--font-weight-medium);
272
293
  }
294
+ :host([size="x-small"]) .optional {
295
+ font-size: var(--text-font-size-xs);
296
+ line-height: var(--text-line-height-xs);
297
+ }
298
+ :host([size="small"]) .optional {
299
+ font-size: var(--text-font-size-xs);
300
+ line-height: var(--text-line-height-xs);
301
+ }
302
+ :host([size="medium"]) .optional {
303
+ font-size: var(--text-font-size-s);
304
+ line-height: var(--text-line-height-s);
305
+ }
306
+ :host([size="large"]) .optional {
307
+ font-size: var(--text-font-size);
308
+ line-height: var(--text-line-height);
309
+ }
273
310
  .optional-dot {
274
311
  display: inline-flex;
275
312
  align-items: center;
@@ -469,25 +506,28 @@ class S extends HTMLElement {
469
506
  flex: none;
470
507
  pointer-events: none;
471
508
  }
509
+ slot[name="hint"]::slotted(mui-hint) {
510
+ pointer-events: auto;
511
+ }
472
512
 
473
513
  /* ========================================================================== */
474
514
 
475
515
 
476
516
  </style>
477
- ${l ? `<label for="${u}" class="${[p ? "vh" : "", h ? "label-with-optional" : ""].filter(Boolean).join(" ")}">${l}${h ? ' <span class="optional"><span class="optional-dot" aria-hidden="true">•</span><span class="optional-text">Optional</span></span>' : ""}</label>` : ""}
517
+ ${n ? `<label for="${c}" class="${[p ? "vh" : "", u ? "label-with-optional" : ""].filter(Boolean).join(" ")}">${n}${u ? ' <span class="optional"><span class="optional-dot" aria-hidden="true">•</span><span class="optional-text">Optional</span></span>' : ""}</label>` : ""}
478
518
  <div class="${x}">
479
519
  <div class="before-slot">
480
520
  <slot name="before"></slot>
481
521
  </div>
482
522
  <input
483
- class="${[E, `size-${f}`].filter(Boolean).join(" ")}"
523
+ class="${[E, `size-${m}`].filter(Boolean).join(" ")}"
484
524
  type="${e}"
485
525
  name="${o}"
486
- id="${u}"
526
+ id="${c}"
487
527
  value="${d}"
488
- placeholder="${m}"
489
- ${c ? 'disabled aria-disabled="true"' : ""}
490
- ${r ? `maxlength="${r}"` : ""}
528
+ placeholder="${f}"
529
+ ${h ? 'disabled aria-disabled="true"' : ""}
530
+ ${i ? `maxlength="${i}"` : ""}
491
531
  ${b}
492
532
  />
493
533
  <div class="hint-slot">
@@ -497,7 +537,7 @@ class S extends HTMLElement {
497
537
  <slot name="after"></slot>
498
538
  </div>
499
539
  </div>
500
- ${r ? '<div class="meta"><span class="char-count"></span></div>' : ""}
540
+ ${i ? '<div class="meta"><span class="char-count"></span></div>' : ""}
501
541
  `
502
542
  );
503
543
  this.shadowRoot && (this.shadowRoot.innerHTML = A, this.updateSlottedButtons());