@muibook/components 19.3.0 → 19.5.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/agent/prompts/index.js +3 -3
- package/dist/esm/components/mui-avatar/index.js +8 -5
- package/dist/esm/components/mui-button/index.js +3 -3
- 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 +20 -28
- package/dist/esm/components/mui-grid/index.js +44 -15
- 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 +43 -14
- package/dist/esm/components/mui-stack/vstack/index.js +43 -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 +4309 -6192
- package/dist/esm/dynamic-attrs.json +1 -1
- package/dist/types/components/mui-accordion/api.d.ts +73 -0
- package/dist/types/components/mui-addon/api.d.ts +28 -0
- package/dist/types/components/mui-alert/api.d.ts +28 -0
- package/dist/types/components/mui-avatar/api.d.ts +28 -0
- package/dist/types/components/mui-badge/api.d.ts +28 -0
- package/dist/types/components/mui-body/api.d.ts +21 -0
- package/dist/types/components/mui-button/api.d.ts +24 -0
- package/dist/types/components/mui-button-group/api.d.ts +17 -0
- package/dist/types/components/mui-card/api.d.ts +50 -0
- package/dist/types/components/mui-carousel/api.d.ts +35 -0
- package/dist/types/components/mui-checkbox/api.d.ts +36 -0
- package/dist/types/components/mui-chip/api.d.ts +28 -0
- package/dist/types/components/mui-chip-input/api.d.ts +36 -0
- package/dist/types/components/mui-code/api.d.ts +21 -0
- package/dist/types/components/mui-container/api.d.ts +17 -0
- package/dist/types/components/mui-dialog/api.d.ts +46 -0
- package/dist/types/components/mui-drawer/api.d.ts +39 -0
- package/dist/types/components/mui-dropdown/api.d.ts +25 -0
- package/dist/types/components/mui-field/api.d.ts +24 -0
- package/dist/types/components/mui-field/index.d.ts +1 -1
- package/dist/types/components/mui-file-upload/api.d.ts +16 -0
- package/dist/types/components/mui-form-group/api.d.ts +28 -0
- package/dist/types/components/mui-form-group/index.d.ts +0 -1
- package/dist/types/components/mui-form-message/api.d.ts +17 -0
- package/dist/types/components/mui-form-section/api.d.ts +24 -0
- package/dist/types/components/mui-form-section-footer/api.d.ts +13 -0
- package/dist/types/components/mui-grid/api.d.ts +28 -0
- package/dist/types/components/mui-heading/api.d.ts +28 -0
- package/dist/types/components/mui-hint/api.d.ts +21 -0
- package/dist/types/components/mui-icons/api.d.ts +28 -0
- package/dist/types/components/mui-illustrations/api.d.ts +17 -0
- package/dist/types/components/mui-image/api.d.ts +24 -0
- package/dist/types/components/mui-input/api.d.ts +32 -0
- package/dist/types/components/mui-link/api.d.ts +24 -0
- package/dist/types/components/mui-list/api.d.ts +32 -0
- package/dist/types/components/mui-loader/api.d.ts +17 -0
- package/dist/types/components/mui-media-player/api.d.ts +24 -0
- package/dist/types/components/mui-message/api.d.ts +28 -0
- package/dist/types/components/mui-progress/api.d.ts +24 -0
- package/dist/types/components/mui-prompt/api.d.ts +45 -0
- package/dist/types/components/mui-prompt-message/api.d.ts +17 -0
- package/dist/types/components/mui-prompt-preview/api.d.ts +36 -0
- package/dist/types/components/mui-prompt-toggle/api.d.ts +17 -0
- package/dist/types/components/mui-quote/api.d.ts +9 -0
- package/dist/types/components/mui-radio/api.d.ts +28 -0
- package/dist/types/components/mui-radio-group/api.d.ts +28 -0
- package/dist/types/components/mui-range-input/api.d.ts +29 -0
- package/dist/types/components/mui-responsive/api.d.ts +16 -0
- package/dist/types/components/mui-rule/api.d.ts +13 -0
- package/dist/types/components/mui-select/api.d.ts +24 -0
- package/dist/types/components/mui-skeleton/api.d.ts +28 -0
- package/dist/types/components/mui-slat/api.d.ts +42 -0
- package/dist/types/components/mui-slide-frame/api.d.ts +28 -0
- package/dist/types/components/mui-smart-card/api.d.ts +20 -0
- package/dist/types/components/mui-spinner/api.d.ts +13 -0
- package/dist/types/components/mui-stack/api.d.ts +54 -0
- package/dist/types/components/mui-stepper/api.d.ts +47 -0
- package/dist/types/components/mui-switch/api.d.ts +42 -0
- package/dist/types/components/mui-table/api.d.ts +65 -0
- package/dist/types/components/mui-tabs/api.d.ts +80 -0
- package/dist/types/components/mui-textarea/api.d.ts +24 -0
- package/package.json +6 -6
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
|
|
@@ -66,9 +66,9 @@ TEXT NODE RULES FOR MUISCAN:
|
|
|
66
66
|
Available Components:
|
|
67
67
|
|
|
68
68
|
LAYOUT:
|
|
69
|
-
- VStack: space, alignX, alignY, style
|
|
70
|
-
- HStack: space, alignX, alignY, style
|
|
71
|
-
- Grid: col, space, alignX, alignY
|
|
69
|
+
- VStack: space, padding, alignX, alignY, height, width, fill, viewport, style
|
|
70
|
+
- HStack: space, padding, alignX, alignY, height, width, fill, viewport, style
|
|
71
|
+
- Grid: col, space, padding, alignX, alignY, height, width, fill, viewport, style
|
|
72
72
|
- Container: size (small|medium|large), center, style
|
|
73
73
|
- Responsive: breakpoint, breakpoint-low, breakpoint-high; slots showBelow/showMiddle/showAbove
|
|
74
74
|
- Rule: length, weight, direction (horizontal|vertical)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
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
|
-
"
|
|
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,
|
|
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>${
|
|
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",
|
|
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": "
|
|
758
|
-
"x-small": "
|
|
759
|
-
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", "
|
|
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(--
|
|
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:
|
|
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
|
|
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:
|
|
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
|
-
),
|
|
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 { ${
|
|
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 {
|
|
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
|
-
),
|
|
336
|
-
let
|
|
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" ?
|
|
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") && (
|
|
334
|
+
` : (e === "push" || e === "persistent") && (r = /*html*/
|
|
357
335
|
`
|
|
358
|
-
<style>${o}${
|
|
336
|
+
<style>${o}${l}${n}</style>
|
|
359
337
|
<div class="shell">
|
|
360
|
-
${
|
|
338
|
+
${d === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
|
|
361
339
|
</div>
|
|
362
|
-
`), this.shadowRoot.innerHTML =
|
|
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",
|
|
384
|
+
customElements.get("mui-drawer") || customElements.define("mui-drawer", u);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
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"
|
|
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
|
-
|
|
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",
|
|
132
|
+
customElements.get("mui-field") || customElements.define("mui-field", r);
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
import "../mui-heading/index.js";
|
|
2
|
-
|
|
3
|
-
class h extends HTMLElement {
|
|
2
|
+
class r extends HTMLElement {
|
|
4
3
|
static get observedAttributes() {
|
|
5
|
-
return ["heading", "hide-label", "variant"];
|
|
4
|
+
return ["heading", "heading-level", "heading-space", "hide-heading", "hide-label", "variant", "space", "aligny"];
|
|
6
5
|
}
|
|
7
6
|
constructor() {
|
|
8
7
|
super(), this.attachShadow({ mode: "open" });
|
|
9
8
|
}
|
|
10
9
|
connectedCallback() {
|
|
11
|
-
this.render()
|
|
10
|
+
this.render();
|
|
12
11
|
}
|
|
13
12
|
attributeChangedCallback() {
|
|
14
13
|
this.render();
|
|
15
14
|
}
|
|
16
15
|
render() {
|
|
17
16
|
if (!this.shadowRoot) return;
|
|
18
|
-
const
|
|
19
|
-
this.shadowRoot.innerHTML = /*html*/
|
|
17
|
+
const e = this.getAttribute("heading") || "", t = this.hasAttribute("hide-heading") || this.hasAttribute("hide-label"), i = this.getHeadingLevel();
|
|
18
|
+
this.syncLayoutAttributes(), this.shadowRoot.innerHTML = /*html*/
|
|
20
19
|
`
|
|
21
20
|
<style>
|
|
22
21
|
:host {
|
|
23
22
|
display: block;
|
|
23
|
+
--form-group-space: var(--space-500);
|
|
24
|
+
--form-group-heading-space: var(--form-group-space);
|
|
25
|
+
--form-group-align-y: start;
|
|
24
26
|
}
|
|
25
27
|
.group {
|
|
26
28
|
display: grid;
|
|
27
|
-
gap: var(--space-500);
|
|
28
29
|
}
|
|
29
30
|
.group-heading {
|
|
30
31
|
display: block;
|
|
31
32
|
margin: 0;
|
|
32
|
-
|
|
33
|
-
.group-label {
|
|
34
|
-
display: inline-flex;
|
|
35
|
-
margin: 0;
|
|
33
|
+
margin-bottom: var(--form-group-heading-space);
|
|
36
34
|
}
|
|
37
35
|
.content {
|
|
38
36
|
display: grid;
|
|
39
|
-
gap: var(--space
|
|
37
|
+
gap: var(--form-group-space);
|
|
40
38
|
min-inline-size: 0;
|
|
41
39
|
}
|
|
42
40
|
.content-inner {
|
|
@@ -44,7 +42,7 @@ class h extends HTMLElement {
|
|
|
44
42
|
}
|
|
45
43
|
:host([variant="horizontal"]) .content {
|
|
46
44
|
grid-template-columns: var(--form-group-horizontal-template, minmax(0, 1fr) minmax(0, 20rem));
|
|
47
|
-
align-items:
|
|
45
|
+
align-items: var(--form-group-align-y);
|
|
48
46
|
}
|
|
49
47
|
:host([variant="horizontal"]) .content-inner ::slotted(*) {
|
|
50
48
|
min-inline-size: 0;
|
|
@@ -61,7 +59,7 @@ class h extends HTMLElement {
|
|
|
61
59
|
</style>
|
|
62
60
|
|
|
63
61
|
<div class="group">
|
|
64
|
-
${
|
|
62
|
+
${e && !t ? `<mui-heading class="group-heading" size="5" level="${i}">${e}</mui-heading>` : ""}
|
|
65
63
|
<div class="content">
|
|
66
64
|
<div class="content-inner">
|
|
67
65
|
<slot></slot>
|
|
@@ -70,19 +68,13 @@ class h extends HTMLElement {
|
|
|
70
68
|
</div>
|
|
71
69
|
`;
|
|
72
70
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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();
|
|
71
|
+
syncLayoutAttributes() {
|
|
72
|
+
const e = this.getAttribute("space"), t = this.getAttribute("aligny"), i = this.getAttribute("heading-space");
|
|
73
|
+
e ? this.style.setProperty("--form-group-space", e) : this.style.removeProperty("--form-group-space"), t ? this.style.setProperty("--form-group-align-y", t) : this.style.removeProperty("--form-group-align-y"), i ? this.style.setProperty("--form-group-heading-space", i) : this.style.removeProperty("--form-group-heading-space");
|
|
74
|
+
}
|
|
75
|
+
getHeadingLevel() {
|
|
76
|
+
const e = this.getAttribute("heading-level") || "5";
|
|
77
|
+
return ["1", "2", "3", "4", "5", "6"].includes(e) ? e : "5";
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
|
-
customElements.get("mui-form-group") || customElements.define("mui-form-group",
|
|
80
|
+
customElements.get("mui-form-group") || customElements.define("mui-form-group", r);
|
|
@@ -1,49 +1,78 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as r } from "../../utils/part-map/index.js";
|
|
2
|
+
class a extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return ["col", "space", "alignx", "aligny"];
|
|
4
|
+
return ["col", "space", "alignx", "aligny", "padding", "height", "width", "viewport", "fill"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" }), this.col = "1fr 1fr", this.space = "var(--space-000)", this.alignX = "normal", this.alignY = "normal";
|
|
8
8
|
}
|
|
9
9
|
async connectedCallback() {
|
|
10
10
|
await this.waitForPartMap();
|
|
11
|
-
const t = this.getAttribute("col") || this.col,
|
|
11
|
+
const t = this.getAttribute("col") || this.col, i = this.getAttribute("space") || this.space, s = this.getAttribute("alignx") || this.alignX, e = this.getAttribute("aligny") || this.alignY, o = r("layout", "spacing");
|
|
12
|
+
this.syncDimensions();
|
|
13
|
+
const h = (
|
|
12
14
|
/*css*/
|
|
13
15
|
`
|
|
14
16
|
:host {
|
|
15
17
|
display: block;
|
|
18
|
+
--grid-height: auto;
|
|
19
|
+
--grid-width: auto;
|
|
20
|
+
height: var(--grid-height);
|
|
21
|
+
width: var(--grid-width);
|
|
22
|
+
}
|
|
23
|
+
:host([fill]) {
|
|
24
|
+
--grid-height: 100%;
|
|
25
|
+
--grid-width: 100%;
|
|
26
|
+
}
|
|
27
|
+
:host([viewport]) {
|
|
28
|
+
--grid-height: 100dvh;
|
|
16
29
|
}
|
|
17
30
|
div {
|
|
18
31
|
display: grid;
|
|
19
32
|
grid-template-columns: var(--col);
|
|
20
33
|
gap: var(--gap);
|
|
34
|
+
padding: var(--padding);
|
|
35
|
+
box-sizing: border-box;
|
|
21
36
|
align-items: var(--alignY);
|
|
22
37
|
justify-items: var(--alignX);
|
|
23
38
|
}
|
|
39
|
+
:host([height]) div,
|
|
40
|
+
:host([viewport]) div,
|
|
41
|
+
:host([fill]) div {
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
:host([width]) div,
|
|
45
|
+
:host([fill]) div {
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
24
48
|
`
|
|
25
49
|
);
|
|
26
50
|
this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
27
51
|
`
|
|
28
|
-
<style>${
|
|
29
|
-
<div part="${o}" style="--col: ${t}; --gap: ${
|
|
52
|
+
<style>${h}</style>
|
|
53
|
+
<div part="${o}" style="--col: ${t}; --gap: ${i}; --padding: ${this.getAttribute("padding") || "var(--space-000)"}; --alignX: ${s}; --alignY: ${e};">
|
|
30
54
|
<slot></slot>
|
|
31
55
|
</div>
|
|
32
56
|
`);
|
|
33
57
|
}
|
|
34
|
-
attributeChangedCallback(t,
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
attributeChangedCallback(t, i, s) {
|
|
59
|
+
if (i === s || !this.shadowRoot) return;
|
|
60
|
+
(t === "height" || t === "width") && this.syncDimensions();
|
|
61
|
+
const e = this.shadowRoot.querySelector("div");
|
|
62
|
+
e && (t === "col" && e.style.setProperty("--col", s || this.col), t === "space" && e.style.setProperty("--gap", s || this.space), t === "padding" && e.style.setProperty("--padding", s || "var(--space-000)"), t === "alignx" && e.style.setProperty("--alignX", s || this.alignX), t === "aligny" && e.style.setProperty("--alignY", s || this.alignY));
|
|
63
|
+
}
|
|
64
|
+
syncDimensions() {
|
|
65
|
+
const t = this.getAttribute("height"), i = this.getAttribute("width");
|
|
66
|
+
t ? this.style.setProperty("--grid-height", t) : this.style.removeProperty("--grid-height"), i ? this.style.setProperty("--grid-width", i) : this.style.removeProperty("--grid-width");
|
|
38
67
|
}
|
|
39
68
|
waitForPartMap() {
|
|
40
69
|
return new Promise((t) => {
|
|
41
|
-
if (typeof
|
|
42
|
-
const
|
|
43
|
-
typeof
|
|
70
|
+
if (typeof r == "function") return t();
|
|
71
|
+
const i = () => {
|
|
72
|
+
typeof r == "function" ? t() : requestAnimationFrame(i);
|
|
44
73
|
};
|
|
45
|
-
|
|
74
|
+
i();
|
|
46
75
|
});
|
|
47
76
|
}
|
|
48
77
|
}
|
|
49
|
-
customElements.get("mui-grid") || customElements.define("mui-grid",
|
|
78
|
+
customElements.get("mui-grid") || customElements.define("mui-grid", a);
|
|
@@ -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": "
|
|
783
|
-
"x-small": "
|
|
784
|
-
small: "
|
|
785
|
-
medium: "
|
|
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": "
|
|
789
|
-
"x-small": "
|
|
790
|
-
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";
|