@muibook/components 19.2.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 +15 -0
- package/dist/esm/components/mui-avatar/index.js +8 -5
- package/dist/esm/components/mui-button/index.js +101 -75
- package/dist/esm/components/mui-chip/index.js +1 -1
- package/dist/esm/components/mui-code/index.js +1 -1
- package/dist/esm/components/mui-dialog/index.js +2 -1
- package/dist/esm/components/mui-drawer/index.js +25 -47
- package/dist/esm/components/mui-field/index.js +6 -4
- package/dist/esm/components/mui-form-group/index.js +37 -25
- package/dist/esm/components/mui-link/index.js +7 -7
- package/dist/esm/components/mui-prompt/index.js +92 -85
- package/dist/esm/components/mui-prompt-message/index.js +1 -1
- package/dist/esm/components/mui-stack/hstack/index.js +30 -14
- package/dist/esm/components/mui-stack/vstack/index.js +30 -14
- package/dist/esm/components/mui-switch/index.js +30 -30
- package/dist/esm/components/mui-tabs/tab-bar/index.js +1 -1
- package/dist/esm/components/mui-textarea/index.js +39 -29
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +12 -3
- package/dist/esm/custom-elements.json +708 -557
- package/dist/esm/dynamic-attrs.json +7 -6
- package/dist/types/components/mui-field/index.d.ts +1 -1
- package/dist/types/components/mui-form-message/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-toggle/doc.d.ts +2 -0
- package/dist/types/components/mui-radio-group/doc.d.ts +2 -0
- package/package.json +6 -6
|
@@ -49,16 +49,16 @@ class n extends HTMLElement {
|
|
|
49
49
|
small: "xx-small",
|
|
50
50
|
medium: "x-small",
|
|
51
51
|
large: "x-small"
|
|
52
|
-
}[e] || "x-small",
|
|
52
|
+
}[e] || "x-small", o = (h) => {
|
|
53
53
|
if (!h) return;
|
|
54
|
-
const
|
|
54
|
+
const a = () => {
|
|
55
55
|
h.assignedElements().forEach((r) => {
|
|
56
56
|
r.tagName.toLowerCase().startsWith("mui-icon") && r.setAttribute("size", c);
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
-
h.addEventListener("slotchange",
|
|
59
|
+
h.addEventListener("slotchange", a), setTimeout(a, 0);
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
o(s), o(t);
|
|
62
62
|
}
|
|
63
63
|
_updateIcons() {
|
|
64
64
|
const s = this.shadowRoot.querySelector('slot[name="on-icon"]'), t = this.shadowRoot.querySelector('slot[name="off-icon"]');
|
|
@@ -78,8 +78,8 @@ class n extends HTMLElement {
|
|
|
78
78
|
.switch {
|
|
79
79
|
position: relative;
|
|
80
80
|
display: inline-block;
|
|
81
|
-
width: var(--
|
|
82
|
-
height: var(--
|
|
81
|
+
width: var(--switch-width-computed, var(--switch-width));
|
|
82
|
+
height: var(--switch-height-computed, var(--switch-height));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
.switch input {
|
|
@@ -101,15 +101,15 @@ class n extends HTMLElement {
|
|
|
101
101
|
bottom: 0;
|
|
102
102
|
background-color: var(--switch-track-background);
|
|
103
103
|
transition: background-color var(--speed-200);
|
|
104
|
-
border-radius: var(--
|
|
104
|
+
border-radius: var(--switch-height-computed, var(--switch-height));
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.thumb {
|
|
108
108
|
position: absolute;
|
|
109
|
-
top: var(--
|
|
110
|
-
left: var(--
|
|
111
|
-
width: var(--
|
|
112
|
-
height: var(--
|
|
109
|
+
top: var(--switch-offset-computed, var(--switch-offset));
|
|
110
|
+
left: var(--switch-offset-computed, var(--switch-offset));
|
|
111
|
+
width: var(--switch-thumb-size-computed, var(--switch-thumb-size));
|
|
112
|
+
height: var(--switch-thumb-size-computed, var(--switch-thumb-size));
|
|
113
113
|
background-color: var(--switch-thumb-bg);
|
|
114
114
|
transition: transform var(--speed-200);
|
|
115
115
|
border-radius: 50%;
|
|
@@ -125,36 +125,36 @@ class n extends HTMLElement {
|
|
|
125
125
|
input:checked + .track .thumb {
|
|
126
126
|
transform: translateX(
|
|
127
127
|
calc(
|
|
128
|
-
var(--
|
|
129
|
-
var(--
|
|
130
|
-
(var(--
|
|
128
|
+
var(--switch-width-computed, var(--switch-width)) -
|
|
129
|
+
var(--switch-thumb-size-computed, var(--switch-thumb-size)) -
|
|
130
|
+
(var(--switch-offset-computed, var(--switch-offset)) * 2)
|
|
131
131
|
)
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
:host([size="x-small"]) {
|
|
136
|
-
--
|
|
137
|
-
--
|
|
138
|
-
--
|
|
139
|
-
--
|
|
136
|
+
--switch-offset-computed: var(--stroke-size-100);
|
|
137
|
+
--switch-thumb-size-computed: calc(var(--action-icon-only-size-x-small) - var(--space-200));
|
|
138
|
+
--switch-height-computed: calc(var(--switch-thumb-size-computed) + (var(--switch-offset-computed) * 2));
|
|
139
|
+
--switch-width-computed: calc(var(--switch-height-computed) * 1.6);
|
|
140
140
|
}
|
|
141
141
|
:host([size="small"]) {
|
|
142
|
-
--
|
|
143
|
-
--
|
|
144
|
-
--
|
|
145
|
-
--
|
|
142
|
+
--switch-offset-computed: var(--stroke-size-100);
|
|
143
|
+
--switch-thumb-size-computed: calc(var(--action-icon-only-size-small) - var(--space-200));
|
|
144
|
+
--switch-height-computed: calc(var(--switch-thumb-size-computed) + (var(--switch-offset-computed) * 2));
|
|
145
|
+
--switch-width-computed: calc(var(--switch-height-computed) * 1.6);
|
|
146
146
|
}
|
|
147
147
|
:host([size="medium"]) {
|
|
148
|
-
--
|
|
149
|
-
--
|
|
150
|
-
--
|
|
151
|
-
--
|
|
148
|
+
--switch-offset-computed: var(--stroke-size-100);
|
|
149
|
+
--switch-thumb-size-computed: calc(var(--switch-thumb-size) - var(--space-100));
|
|
150
|
+
--switch-height-computed: calc(var(--switch-thumb-size-computed) + (var(--switch-offset-computed) * 2));
|
|
151
|
+
--switch-width-computed: calc(var(--switch-height-computed) * 1.6);
|
|
152
152
|
}
|
|
153
153
|
:host([size="large"]) {
|
|
154
|
-
--
|
|
155
|
-
--
|
|
156
|
-
--
|
|
157
|
-
--
|
|
154
|
+
--switch-offset-computed: var(--switch-offset);
|
|
155
|
+
--switch-thumb-size-computed: var(--switch-thumb-size);
|
|
156
|
+
--switch-height-computed: var(--switch-height);
|
|
157
|
+
--switch-width-computed: var(--switch-width);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
::slotted([slot="on-icon"]),
|
|
@@ -106,7 +106,7 @@ class l extends HTMLElement {
|
|
|
106
106
|
z-index: 0;
|
|
107
107
|
padding: var(--space-200) var(--space-400);
|
|
108
108
|
box-sizing: border-box;
|
|
109
|
-
box-shadow:
|
|
109
|
+
box-shadow: var(--tab-shadow-active);
|
|
110
110
|
will-change: transform, width;
|
|
111
111
|
transform: translateX(0) translateZ(0);
|
|
112
112
|
width: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class p extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return [
|
|
4
4
|
"name",
|
|
@@ -68,7 +68,7 @@ class b extends HTMLElement {
|
|
|
68
68
|
!e || !a || e.maxLength <= 0 || (a.textContent = `${e.value.length}/${e.maxLength}`);
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
|
-
const e = this.getAttribute("name") || "", a = this.getAttribute("value") || "", r = this.getAttribute("placeholder") || "", t = this.getAttribute("id") || `mui-textarea-${Math.random().toString(36).substr(2, 9)}`, o = this.getAttribute("label") || "",
|
|
71
|
+
const e = this.getAttribute("name") || "", a = this.getAttribute("value") || "", r = this.getAttribute("placeholder") || "", t = this.getAttribute("id") || `mui-textarea-${Math.random().toString(36).substr(2, 9)}`, o = this.getAttribute("label") || "", d = this.hasAttribute("optional"), n = this.hasAttribute("hide-label"), x = this.hasAttribute("disabled"), l = this.getAttribute("rows") || "4", i = this.getAttribute("max-length"), s = i && Number(i) > 0 ? String(Number(i)) : "", c = this.getAttribute("size") || "medium", u = ["x-small", "small", "medium", "large"].includes(c) ? c : "medium", v = n && o ? `aria-label="${o}"` : "", h = this.getAttribute("variant") || "", g = h || "", b = (
|
|
72
72
|
/*html*/
|
|
73
73
|
`
|
|
74
74
|
<style>
|
|
@@ -104,11 +104,16 @@ class b extends HTMLElement {
|
|
|
104
104
|
|
|
105
105
|
textarea {
|
|
106
106
|
width: 100%;
|
|
107
|
-
min-height:
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
min-height: calc(
|
|
108
|
+
(var(--textarea-line-height-current) * var(--textarea-rows, 4)) +
|
|
109
|
+
(var(--textarea-padding-block-current) * 2) +
|
|
110
|
+
(var(--stroke-size-100) * 2)
|
|
111
|
+
);
|
|
112
|
+
line-height: var(--textarea-line-height-current);
|
|
113
|
+
padding-block: var(--textarea-padding-block-current);
|
|
114
|
+
padding-inline: var(--textarea-padding-inline-current);
|
|
110
115
|
box-sizing: border-box;
|
|
111
|
-
font-size: var(--
|
|
116
|
+
font-size: var(--textarea-font-size-current);
|
|
112
117
|
border-radius: var(--radius-100);
|
|
113
118
|
border: var(--border-thin);
|
|
114
119
|
border-color: var(--form-default-border-color);
|
|
@@ -116,30 +121,34 @@ class b extends HTMLElement {
|
|
|
116
121
|
background: var(--input-background);
|
|
117
122
|
resize: vertical;
|
|
118
123
|
font-family: var(--font-family);
|
|
124
|
+
--textarea-font-size-current: var(--text-font-size);
|
|
125
|
+
--textarea-line-height-current: var(--text-line-height);
|
|
126
|
+
--textarea-padding-block-current: var(--space-200);
|
|
127
|
+
--textarea-padding-inline-current: var(--space-300);
|
|
119
128
|
}
|
|
120
129
|
textarea.size-x-small {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
--textarea-font-size-current: var(--text-font-size-xs);
|
|
131
|
+
--textarea-line-height-current: var(--text-line-height-xs);
|
|
132
|
+
--textarea-padding-block-current: var(--space-050);
|
|
133
|
+
--textarea-padding-inline-current: var(--space-200);
|
|
125
134
|
}
|
|
126
135
|
textarea.size-small {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
--textarea-font-size-current: var(--text-font-size-s);
|
|
137
|
+
--textarea-line-height-current: var(--text-line-height-s);
|
|
138
|
+
--textarea-padding-block-current: calc(var(--space-100) - (var(--stroke-size-100) / 2));
|
|
139
|
+
--textarea-padding-inline-current: var(--space-300);
|
|
131
140
|
}
|
|
132
141
|
textarea.size-medium {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
--textarea-font-size-current: var(--text-font-size);
|
|
143
|
+
--textarea-line-height-current: var(--text-line-height);
|
|
144
|
+
--textarea-padding-block-current: var(--space-200);
|
|
145
|
+
--textarea-padding-inline-current: var(--space-300);
|
|
137
146
|
}
|
|
138
147
|
textarea.size-large {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
--textarea-font-size-current: var(--text-font-size-l);
|
|
149
|
+
--textarea-line-height-current: var(--text-line-height-l);
|
|
150
|
+
--textarea-padding-block-current: var(--space-300);
|
|
151
|
+
--textarea-padding-inline-current: var(--space-400);
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
textarea:hover {
|
|
@@ -269,22 +278,23 @@ class b extends HTMLElement {
|
|
|
269
278
|
}
|
|
270
279
|
</style>
|
|
271
280
|
|
|
272
|
-
${o ? `<label for="${t}" class="${
|
|
281
|
+
${o ? `<label for="${t}" class="${n ? "vh" : ""}">${o}${d ? ' <span class="optional"><span class="optional-dot" aria-hidden="true">•</span><span class="optional-text">Optional</span></span>' : ""}</label>` : ""}
|
|
273
282
|
|
|
274
283
|
<textarea
|
|
275
284
|
id="${t}"
|
|
276
285
|
name="${e}"
|
|
277
|
-
class="${[g, `size-${
|
|
278
|
-
|
|
286
|
+
class="${[g, `size-${u}`].filter(Boolean).join(" ")}"
|
|
287
|
+
style="--textarea-rows: ${l};"
|
|
288
|
+
rows="${l}"
|
|
279
289
|
placeholder="${r}"
|
|
280
290
|
${s ? `maxlength="${s}"` : ""}
|
|
281
|
-
${
|
|
282
|
-
${
|
|
291
|
+
${x ? "disabled" : ""}
|
|
292
|
+
${v}
|
|
283
293
|
>${a}</textarea>
|
|
284
294
|
${s ? '<div class="meta"><span class="char-count"></span></div>' : ""}
|
|
285
295
|
`
|
|
286
296
|
);
|
|
287
|
-
this.shadowRoot.innerHTML =
|
|
297
|
+
this.shadowRoot.innerHTML = b, o || console.warn("mui-textarea: Missing required 'label' attribute for accessibility.");
|
|
288
298
|
}
|
|
289
299
|
}
|
|
290
|
-
customElements.get("mui-textarea") || customElements.define("mui-textarea",
|
|
300
|
+
customElements.get("mui-textarea") || customElements.define("mui-textarea", p);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/* ================================================================================================== */
|
|
3
|
-
/* Don't edit directly • Generated on
|
|
3
|
+
/* Don't edit directly • Generated on Mon, 25 May 2026 10:00:49 GMT • muibook.com */
|
|
4
4
|
/* ================================================================================================== */
|
|
5
5
|
|
|
6
6
|
/* ================================================================================================== */
|
|
@@ -179,11 +179,13 @@ html[data-theme="light"] {
|
|
|
179
179
|
--surface-elevated-alpha: var(--white-opacity-50);
|
|
180
180
|
--surface-elevated-100: var(--white);
|
|
181
181
|
--surface-elevated-200: var(--grey-100);
|
|
182
|
+
--code-background: var(--surface-elevated-200);
|
|
182
183
|
--prompt-preview-dismiss-border-color: var(--black-opacity-30);
|
|
183
184
|
--prompt-preview-box-drop-shadow: drop-shadow(
|
|
184
185
|
0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-10)
|
|
185
186
|
);
|
|
186
187
|
--prompt-preview-surface: var(--surface-elevated-100);
|
|
188
|
+
--prompt-preview-code-background: var(--code-background);
|
|
187
189
|
--prompt-preview-accent-mix-100: 10%;
|
|
188
190
|
--prompt-preview-accent-mix-200: 8%;
|
|
189
191
|
--prompt-preview-accent-mix-300: 6%;
|
|
@@ -314,7 +316,8 @@ html[data-theme="light"] {
|
|
|
314
316
|
--tab-background-active: var(--white);
|
|
315
317
|
--tab-icon-active: var(--black);
|
|
316
318
|
--tab-text-color-active: var(--black);
|
|
317
|
-
--tab-shadow-active: var(--black-opacity-10);
|
|
319
|
+
--tab-shadow-active-color: var(--black-opacity-10);
|
|
320
|
+
--tab-shadow-active: 0 0 var(--stroke-size-400) var(--stroke-size-400) var(--tab-shadow-active-color);
|
|
318
321
|
--tabs-ghost-box-shadow: none;
|
|
319
322
|
|
|
320
323
|
/* Carousel */
|
|
@@ -395,6 +398,7 @@ html[data-theme="light"] {
|
|
|
395
398
|
|
|
396
399
|
/* Dialog */
|
|
397
400
|
--dialog-background: var(--white);
|
|
401
|
+
--dialog-border: none;
|
|
398
402
|
|
|
399
403
|
/* Drawer */
|
|
400
404
|
--drawer-background: var(--white);
|
|
@@ -529,11 +533,13 @@ html[data-theme="dark"] {
|
|
|
529
533
|
--surface-elevated-alpha: var(--white-opacity-10);
|
|
530
534
|
--surface-elevated-100: var(--grey-800);
|
|
531
535
|
--surface-elevated-200: var(--grey-900);
|
|
536
|
+
--code-background: var(--surface-elevated-200);
|
|
532
537
|
--prompt-preview-dismiss-border-color: var(--white-opacity-30);
|
|
533
538
|
--prompt-preview-box-drop-shadow: drop-shadow(
|
|
534
539
|
0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20)
|
|
535
540
|
);
|
|
536
541
|
--prompt-preview-surface: var(--surface-elevated-200);
|
|
542
|
+
--prompt-preview-code-background: var(--code-background);
|
|
537
543
|
--prompt-preview-accent-mix-100: 14%;
|
|
538
544
|
--prompt-preview-accent-mix-200: 10%;
|
|
539
545
|
--prompt-preview-accent-mix-300: 8%;
|
|
@@ -663,7 +669,8 @@ html[data-theme="dark"] {
|
|
|
663
669
|
--tab-background-active: var(--grey-700);
|
|
664
670
|
--tab-icon-active: var(--white);
|
|
665
671
|
--tab-text-color-active: var(--white);
|
|
666
|
-
--tab-shadow-active: var(--black-opacity-40);
|
|
672
|
+
--tab-shadow-active-color: var(--black-opacity-40);
|
|
673
|
+
--tab-shadow-active: 0 0 var(--stroke-size-400) var(--stroke-size-400) var(--tab-shadow-active-color);
|
|
667
674
|
--tabs-ghost-box-shadow: none;
|
|
668
675
|
|
|
669
676
|
/* Carousel */
|
|
@@ -744,6 +751,7 @@ html[data-theme="dark"] {
|
|
|
744
751
|
|
|
745
752
|
/* Dialog */
|
|
746
753
|
--dialog-background: var(--grey-800);
|
|
754
|
+
--dialog-border: none;
|
|
747
755
|
|
|
748
756
|
/* Drawer */
|
|
749
757
|
--drawer-background: var(--grey-800);
|
|
@@ -974,7 +982,8 @@ html[data-theme="dark"] {
|
|
|
974
982
|
/* Dialog */
|
|
975
983
|
--dialog-radius: var(--radius-150);
|
|
976
984
|
/* Avatar */
|
|
977
|
-
--avatar-
|
|
985
|
+
--avatar-xx-small: var(--space-500); /* 24px */
|
|
986
|
+
--avatar-x-small: calc(var(--space-500) + var(--space-200)); /* 32px */
|
|
978
987
|
--avatar-small: calc(var(--space-600) + var(--space-025)); /* 38px */
|
|
979
988
|
--avatar-medium: var(--space-700); /* 48px */
|
|
980
989
|
--avatar-large: calc(var(--space-700) + var(--space-200)); /* 56px */
|