@muibook/components 7.1.0 → 8.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.
- package/dist/esm/agent/keywords/index.js +1 -0
- package/dist/esm/agent/prompts/index.js +13 -1
- package/dist/esm/components/mui-addon/index.js +0 -1
- package/dist/esm/components/mui-avatar/index.js +136 -0
- package/dist/esm/components/mui-button/index.js +91 -47
- package/dist/esm/components/mui-checkbox/index.js +30 -56
- package/dist/esm/components/mui-chip/index.js +17 -10
- package/dist/esm/components/mui-dialog/index.js +17 -17
- package/dist/esm/components/mui-drawer/index.js +38 -39
- package/dist/esm/components/mui-file-upload/index.js +6 -6
- package/dist/esm/components/mui-icons/checkmark/index.js +53 -0
- package/dist/esm/components/mui-icons/game-controller/index.js +55 -0
- package/dist/esm/components/mui-icons/home/index.js +55 -0
- package/dist/esm/components/mui-icons/index.js +8 -0
- package/dist/esm/components/mui-icons/list-and-film/index.js +55 -0
- package/dist/esm/components/mui-icons/movie-clapper/index.js +55 -0
- package/dist/esm/components/mui-icons/music-microphone/index.js +55 -0
- package/dist/esm/components/mui-icons/music-quarter-note/index.js +55 -0
- package/dist/esm/components/mui-icons/play-rectangle/index.js +55 -0
- package/dist/esm/components/mui-icons/play-stack/index.js +55 -0
- package/dist/esm/components/mui-icons/search/index.js +53 -0
- package/dist/esm/components/mui-input/index.js +43 -19
- package/dist/esm/components/mui-link/index.js +120 -42
- package/dist/esm/components/mui-select/index.js +2 -1
- package/dist/esm/components/mui-slat/index.js +0 -1
- package/dist/esm/components/mui-slat/slat/index.js +36 -9
- package/dist/esm/components/mui-switch/index.js +23 -13
- package/dist/esm/css/mui-tokens.css +120 -12
- package/dist/esm/custom-elements.json +6186 -0
- package/dist/esm/index.js +15 -5
- package/dist/types/components/mui-accordion/doc.d.ts +2 -0
- package/dist/types/components/mui-addon/doc.d.ts +2 -0
- package/dist/types/components/mui-alert/doc.d.ts +2 -0
- package/dist/types/components/mui-avatar/doc.d.ts +2 -0
- package/dist/types/components/mui-avatar/index.d.ts +1 -0
- package/dist/types/components/mui-badge/doc.d.ts +2 -0
- package/dist/types/components/mui-body/doc.d.ts +2 -0
- package/dist/types/components/mui-button/doc.d.ts +2 -0
- package/dist/types/components/mui-button-group/doc.d.ts +2 -0
- package/dist/types/components/mui-card/doc.d.ts +2 -0
- package/dist/types/components/mui-carousel/doc.d.ts +2 -0
- package/dist/types/components/mui-checkbox/doc.d.ts +2 -0
- package/dist/types/components/mui-chip/doc.d.ts +2 -0
- package/dist/types/components/mui-code/doc.d.ts +2 -0
- package/dist/types/components/mui-container/doc.d.ts +2 -0
- package/dist/types/components/mui-dialog/doc.d.ts +2 -0
- package/dist/types/components/mui-drawer/doc.d.ts +2 -0
- package/dist/types/components/mui-dropdown/doc.d.ts +2 -0
- package/dist/types/components/mui-field/doc.d.ts +2 -0
- package/dist/types/components/mui-file-upload/doc.d.ts +2 -0
- package/dist/types/components/mui-grid/doc.d.ts +2 -0
- package/dist/types/components/mui-heading/doc.d.ts +2 -0
- package/dist/types/components/mui-icons/checkmark.d.ts +1 -0
- package/dist/types/components/mui-icons/doc.d.ts +2 -0
- package/dist/types/components/mui-icons/game-controller.d.ts +1 -0
- package/dist/types/components/mui-icons/home.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +8 -0
- package/dist/types/components/mui-icons/list-and-film.d.ts +1 -0
- package/dist/types/components/mui-icons/movie-clapper.d.ts +1 -0
- package/dist/types/components/mui-icons/music-microphone.d.ts +1 -0
- package/dist/types/components/mui-icons/music-quarter-note.d.ts +1 -0
- package/dist/types/components/mui-icons/play-rectangle.d.ts +1 -0
- package/dist/types/components/mui-icons/play-stack.d.ts +1 -0
- package/dist/types/components/mui-icons/search.d.ts +1 -0
- package/dist/types/components/mui-image/doc.d.ts +2 -0
- package/dist/types/components/mui-input/doc.d.ts +2 -0
- package/dist/types/components/mui-link/doc.d.ts +2 -0
- package/dist/types/components/mui-list/doc.d.ts +2 -0
- package/dist/types/components/mui-loader/doc.d.ts +2 -0
- package/dist/types/components/mui-message/doc.d.ts +2 -0
- package/dist/types/components/mui-progress/doc.d.ts +2 -0
- package/dist/types/components/mui-quote/doc.d.ts +2 -0
- package/dist/types/components/mui-responsive/doc.d.ts +2 -0
- package/dist/types/components/mui-rule/doc.d.ts +2 -0
- package/dist/types/components/mui-select/doc.d.ts +2 -0
- package/dist/types/components/mui-slat/doc.d.ts +67 -0
- package/dist/types/components/mui-slat/index.d.ts +0 -1
- package/dist/types/components/mui-smart-card/doc.d.ts +2 -0
- package/dist/types/components/mui-stack/doc.d.ts +2 -0
- package/dist/types/components/mui-stepper/doc.d.ts +2 -0
- package/dist/types/components/mui-switch/doc.d.ts +2 -0
- package/dist/types/components/mui-table/doc.d.ts +2 -0
- package/dist/types/components/mui-tabs/doc.d.ts +2 -0
- package/dist/types/index.d.ts +11 -1
- package/package.json +55 -9
- package/dist/esm/components/mui-slat/accessory/index.js +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as h } from "../../utils/part-map/index.js";
|
|
2
|
+
class u extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return ["target", "href", "variant", "weight", "size", "download", "usage"];
|
|
4
|
+
return ["target", "href", "variant", "disabled", "weight", "size", "download", "usage"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" });
|
|
@@ -19,6 +19,10 @@ class f extends HTMLElement {
|
|
|
19
19
|
const t = this.shadowRoot.querySelector("a");
|
|
20
20
|
t && t.setAttribute("target", e || "_self");
|
|
21
21
|
}
|
|
22
|
+
if (a === "disabled") {
|
|
23
|
+
const t = this.shadowRoot.querySelector("a");
|
|
24
|
+
t && (e !== null ? (t.setAttribute("aria-disabled", "true"), t.setAttribute("href", "javascript:void(0)")) : (t.setAttribute("aria-disabled", "false"), t.setAttribute("href", this.getAttribute("href") || "#")));
|
|
25
|
+
}
|
|
22
26
|
if (a === "download") {
|
|
23
27
|
const t = this.shadowRoot.querySelector("a");
|
|
24
28
|
if (!t) return;
|
|
@@ -27,44 +31,44 @@ class f extends HTMLElement {
|
|
|
27
31
|
a === "size" && o !== e && this.shadowRoot && requestAnimationFrame(() => {
|
|
28
32
|
const t = this.shadowRoot;
|
|
29
33
|
if (!t) return;
|
|
30
|
-
const
|
|
34
|
+
const d = [
|
|
31
35
|
t.querySelector("slot:not([name])"),
|
|
32
36
|
t.querySelector('slot[name="before"]'),
|
|
33
37
|
t.querySelector('slot[name="after"]')
|
|
34
|
-
],
|
|
35
|
-
|
|
38
|
+
], s = this.hasAttribute("icon-only");
|
|
39
|
+
d.forEach((r) => {
|
|
36
40
|
if (r) {
|
|
37
|
-
const
|
|
38
|
-
this.updateIconSizes(
|
|
41
|
+
const i = r.assignedNodes({ flatten: !0 });
|
|
42
|
+
this.updateIconSizes(i, s), this.updateAvatarSizes(i);
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
updateSlotState() {
|
|
45
|
-
const a = this.shadowRoot, o = a.querySelector("slot:not([name])"), e = a.querySelector('slot[name="before"]'), t = a.querySelector('slot[name="after"]'),
|
|
46
|
-
(
|
|
49
|
+
const a = this.shadowRoot, o = a.querySelector("slot:not([name])"), e = a.querySelector('slot[name="before"]'), t = a.querySelector('slot[name="after"]'), d = (l) => !!l && l.assignedNodes({ flatten: !0 }).some(
|
|
50
|
+
(n) => {
|
|
47
51
|
var c;
|
|
48
|
-
return
|
|
52
|
+
return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && !!((c = n.textContent) != null && c.trim());
|
|
49
53
|
}
|
|
50
|
-
),
|
|
51
|
-
this.classList.toggle("has-before",
|
|
52
|
-
const
|
|
53
|
-
(
|
|
54
|
-
var
|
|
55
|
-
return
|
|
54
|
+
), s = d(e), r = d(t);
|
|
55
|
+
this.classList.toggle("has-before", s), this.classList.toggle("has-after", r);
|
|
56
|
+
const i = (o == null ? void 0 : o.assignedNodes({ flatten: !0 })) ?? [], v = i.length > 0 && i.every(
|
|
57
|
+
(l) => {
|
|
58
|
+
var n;
|
|
59
|
+
return l.nodeType === Node.ELEMENT_NODE ? l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "svg" : !((n = l.textContent) != null && n.trim());
|
|
56
60
|
}
|
|
57
61
|
);
|
|
58
|
-
this.toggleAttribute("icon-only",
|
|
59
|
-
if (
|
|
60
|
-
const c =
|
|
61
|
-
this.updateIconSizes(c, !1);
|
|
62
|
+
this.toggleAttribute("icon-only", v), v ? this.updateIconSizes(i, !0) : [e, o, t].forEach((n) => {
|
|
63
|
+
if (n) {
|
|
64
|
+
const c = n.assignedNodes({ flatten: !0 });
|
|
65
|
+
this.updateIconSizes(c, !1), this.updateAvatarSizes(c);
|
|
62
66
|
}
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
69
|
render() {
|
|
66
70
|
if (!this.shadowRoot) return;
|
|
67
|
-
const a =
|
|
71
|
+
const a = h("text", "spacing", "layout", "visual");
|
|
68
72
|
this.shadowRoot.innerHTML = /*html*/
|
|
69
73
|
`
|
|
70
74
|
<style>
|
|
@@ -88,7 +92,7 @@ class f extends HTMLElement {
|
|
|
88
92
|
a:focus, a:active, a:hover { outline: var(--space-000); }
|
|
89
93
|
a:hover { color: var(--link-text-color-default-hover); text-decoration-color: color-mix(in srgb, var(--link-text-color-default-hover) 80%, transparent); }
|
|
90
94
|
a:focus { color: var(--link-text-color-default-focus); text-decoration-color: color-mix(in srgb, var(--link-text-color-default-focus) 80%, transparent); }
|
|
91
|
-
a
|
|
95
|
+
a[aria-disabled="true"] { color: var(--link-text-color-default-disabled); text-decoration-color: color-mix(in srgb, var(--link-text-color-default-disabled) 80%, transparent); cursor: not-allowed; }
|
|
92
96
|
a, a:before, a:after {box-sizing: border-box;}
|
|
93
97
|
a:focus-visible { outline: var(--outline-thick); }
|
|
94
98
|
|
|
@@ -165,7 +169,7 @@ class f extends HTMLElement {
|
|
|
165
169
|
border: var(--action-primary-border-focus);
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
:host([variant="primary"]) a
|
|
172
|
+
:host([variant="primary"]) a[aria-disabled="true"] {
|
|
169
173
|
background: var(--action-primary-background-disabled);
|
|
170
174
|
color: var(--action-primary-text-color-disabled);
|
|
171
175
|
border: var(--action-primary-border-disabled);
|
|
@@ -175,7 +179,7 @@ class f extends HTMLElement {
|
|
|
175
179
|
:host([variant="primary"]) a ::slotted(.mui-icon) { fill: var(--action-primary-text-color); }
|
|
176
180
|
:host([variant="primary"]) a:hover ::slotted(.mui-icon) { fill: var(--action-primary-text-color-hover); }
|
|
177
181
|
:host([variant="primary"]) a:focus ::slotted(.mui-icon) { fill: var(--action-primary-text-color-focus); }
|
|
178
|
-
:host([variant="primary"]) a
|
|
182
|
+
:host([variant="primary"]) a[aria-disabled="true"] ::slotted(.mui-icon) { fill: var(--action-primary-text-color-disabled); }
|
|
179
183
|
|
|
180
184
|
/* Button Secondary
|
|
181
185
|
========================================= */
|
|
@@ -197,7 +201,7 @@ class f extends HTMLElement {
|
|
|
197
201
|
border: var(--action-secondary-border-focus);
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
:host([variant="secondary"]) a
|
|
204
|
+
:host([variant="secondary"]) a[aria-disabled="true"] {
|
|
201
205
|
background: var(--action-secondary-background-disabled);
|
|
202
206
|
color: var(--action-secondary-text-color-disabled);
|
|
203
207
|
border: var(--action-secondary-border-disabled);
|
|
@@ -207,7 +211,7 @@ class f extends HTMLElement {
|
|
|
207
211
|
:host([variant="secondary"]) a ::slotted(.mui-icon) { fill: var(--action-secondary-text-color); }
|
|
208
212
|
:host([variant="secondary"]) a:hover ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-hover); }
|
|
209
213
|
:host([variant="secondary"]) a:focus ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-focus); }
|
|
210
|
-
:host([variant="secondary"]) a
|
|
214
|
+
:host([variant="secondary"]) a[aria-disabled="true"] ::slotted(.mui-icon) { fill: var(--action-secondary-text-color-disabled); }
|
|
211
215
|
|
|
212
216
|
/* Button Tertiary
|
|
213
217
|
========================================= */
|
|
@@ -229,7 +233,7 @@ class f extends HTMLElement {
|
|
|
229
233
|
border: var(--action-tertiary-border-focus);
|
|
230
234
|
}
|
|
231
235
|
|
|
232
|
-
:host([variant="tertiary"]) a
|
|
236
|
+
:host([variant="tertiary"]) a[aria-disabled="true"] {
|
|
233
237
|
background: var(--action-tertiary-background-disabled);
|
|
234
238
|
color: var(--action-tertiary-text-color-disabled);
|
|
235
239
|
border: var(--action-tertiary-border-disabled);
|
|
@@ -239,7 +243,7 @@ class f extends HTMLElement {
|
|
|
239
243
|
:host([variant="tertiary"]) a ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color); }
|
|
240
244
|
:host([variant="tertiary"]) a:hover ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-hover); }
|
|
241
245
|
:host([variant="tertiary"]) a:focus ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-focus); }
|
|
242
|
-
:host([variant="tertiary"]) a
|
|
246
|
+
:host([variant="tertiary"]) a[aria-disabled="true"] ::slotted(.mui-icon) { fill: var(--action-tertiary-text-color-disabled); }
|
|
243
247
|
|
|
244
248
|
/* Button Attention
|
|
245
249
|
========================================= */
|
|
@@ -261,7 +265,7 @@ class f extends HTMLElement {
|
|
|
261
265
|
border: var(--action-attention-border-focus);
|
|
262
266
|
}
|
|
263
267
|
|
|
264
|
-
:host([variant="attention"]) a
|
|
268
|
+
:host([variant="attention"]) a[aria-disabled="true"] {
|
|
265
269
|
background: var(--action-attention-background-disabled);
|
|
266
270
|
color: var(--action-attention-text-color-disabled);
|
|
267
271
|
border: var(--action-attention-border-disabled);
|
|
@@ -271,7 +275,7 @@ class f extends HTMLElement {
|
|
|
271
275
|
:host([variant="attention"]) a ::slotted(.mui-icon) { fill: var(--action-attention-text-color); }
|
|
272
276
|
:host([variant="attention"]) a:hover ::slotted(.mui-icon) { fill: var(--action-attention-text-color-hover); }
|
|
273
277
|
:host([variant="attention"]) a:focus ::slotted(.mui-icon) { fill: var(--action-attention-text-color-focus); }
|
|
274
|
-
:host([variant="attention"]) a
|
|
278
|
+
:host([variant="attention"]) a[aria-disabled="true"] ::slotted(.mui-icon) { fill: var(--action-attention-text-color-disabled); }
|
|
275
279
|
|
|
276
280
|
/* Icon only
|
|
277
281
|
========================================= */
|
|
@@ -326,6 +330,54 @@ class f extends HTMLElement {
|
|
|
326
330
|
fill: var(--alert-icon);
|
|
327
331
|
}
|
|
328
332
|
|
|
333
|
+
/* AVATAR */
|
|
334
|
+
|
|
335
|
+
/* Link - Default */
|
|
336
|
+
:host([variant="default"][size="x-small"]) a ::slotted(mui-avatar) {
|
|
337
|
+
margin-right: var(--space-025);
|
|
338
|
+
}
|
|
339
|
+
:host([variant="default"][size="small"]) a ::slotted(mui-avatar),
|
|
340
|
+
:host([variant="default"][size="medium"]) a ::slotted(mui-avatar),
|
|
341
|
+
:host([variant="default"][size="large"]) a ::slotted(mui-avatar) {
|
|
342
|
+
margin-right: var(--space-025);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* Link Button */
|
|
346
|
+
:host(:not([variant="default"])) a ::slotted(mui-avatar) {
|
|
347
|
+
--avatar-background-override: var(--action-avatar-background);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* Link Button: Sizes */
|
|
351
|
+
:host(:not([variant="default"])[size="x-small"]) a ::slotted(mui-avatar) {
|
|
352
|
+
margin-right: var(--space-025);
|
|
353
|
+
}
|
|
354
|
+
:host(:not([variant="default"])[size="small"]) a ::slotted(mui-avatar),
|
|
355
|
+
:host(:not([variant="default"])[size="medium"]) a ::slotted(mui-avatar),
|
|
356
|
+
:host(:not([variant="default"])[size="large"]) a ::slotted(mui-avatar) {
|
|
357
|
+
margin-right: var(--space-050);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* Link Button: Background */
|
|
361
|
+
:host(:not([variant="default"])) a[aria-disabled="true"] ::slotted(mui-avatar),
|
|
362
|
+
:host(:not([variant="default"])) a[aria-disabled="true"]:hover ::slotted(mui-avatar),
|
|
363
|
+
:host(:not([variant="default"])) a[aria-disabled="true"]:focus ::slotted(mui-avatar) {
|
|
364
|
+
--avatar-background-override: var(--action-avatar-background);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/* Disabled */
|
|
368
|
+
:host a[aria-disabled="true"] ::slotted(mui-avatar),
|
|
369
|
+
:host a[aria-disabled="true"]:hover ::slotted(mui-avatar),
|
|
370
|
+
:host a[aria-disabled="true"]:focus ::slotted(mui-avatar) {
|
|
371
|
+
opacity: 0.5;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:host(:not([variant="default"])) a:hover ::slotted(mui-avatar),
|
|
375
|
+
:host(:not([variant="default"])) a:focus ::slotted(mui-avatar) {
|
|
376
|
+
--avatar-background-override: var(--action-avatar-background-hover);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
329
381
|
/* Before & After Icon
|
|
330
382
|
========================================= */
|
|
331
383
|
:host(.has-after) a,
|
|
@@ -438,30 +490,35 @@ class f extends HTMLElement {
|
|
|
438
490
|
|
|
439
491
|
:host([size="x-small"][variant]:not([variant="default"])) a,
|
|
440
492
|
:host([size="x-small"][variant]:not([variant="default"])) a:hover,
|
|
441
|
-
:host([size="x-small"][variant]:not([variant="default"])) a:focus
|
|
493
|
+
:host([size="x-small"][variant]:not([variant="default"])) a:focus,
|
|
494
|
+
:host([size="x-small"][variant]:not([variant="default"])) a[aria-disabled="true"] {
|
|
442
495
|
font-size: var(--text-font-size-xs);
|
|
443
496
|
line-height: var(--text-line-height-xs);
|
|
444
497
|
font-weight: var(--font-weight-semi-bold);
|
|
445
498
|
padding: var(--action-padding-x-small);
|
|
446
499
|
border-width: var(--stroke-size-100);
|
|
500
|
+
border-radius: var(--action-radius-x-small);
|
|
447
501
|
}
|
|
448
502
|
|
|
449
503
|
:host([size="small"][variant]:not([variant="default"])) a {
|
|
450
504
|
font-size: var(--text-font-size-s);
|
|
451
505
|
line-height: var(--text-line-height-s);
|
|
452
506
|
padding: var(--action-padding-small);
|
|
507
|
+
border-radius: var(--action-radius-small);
|
|
453
508
|
}
|
|
454
509
|
|
|
455
510
|
:host([size="medium"][variant]:not([variant="default"])) a {
|
|
456
511
|
font-size: var(--text-font-size-m);
|
|
457
512
|
line-height: var(--text-line-height-m);
|
|
458
513
|
padding: var(--action-padding);
|
|
514
|
+
border-radius: var(--action-radius-medium);
|
|
459
515
|
}
|
|
460
516
|
|
|
461
517
|
:host([size="large"][variant]:not([variant="default"])) a {
|
|
462
518
|
font-size: var(--text-font-size-l);
|
|
463
519
|
line-height: var(--text-line-height-l);
|
|
464
520
|
padding: var(--action-padding-large);
|
|
521
|
+
border-radius: var(--action-radius-large);
|
|
465
522
|
}
|
|
466
523
|
|
|
467
524
|
/* Icon-only size variants */
|
|
@@ -569,8 +626,9 @@ class f extends HTMLElement {
|
|
|
569
626
|
<a
|
|
570
627
|
part="${a}"
|
|
571
628
|
target="${this.getAttribute("target") || "_self"}"
|
|
572
|
-
href="${this.getAttribute("href") || "#"}"
|
|
573
|
-
${this.hasAttribute("
|
|
629
|
+
href="${this.hasAttribute("disabled") ? "javascript:void(0)" : this.getAttribute("href") || "#"}"
|
|
630
|
+
aria-disabled="${this.hasAttribute("disabled") ? "true" : "false"}"
|
|
631
|
+
${this.hasAttribute("download") && !this.hasAttribute("disabled") ? `download="${this.getAttribute("download") || ""}"` : ""}
|
|
574
632
|
>
|
|
575
633
|
<slot name="before"></slot>
|
|
576
634
|
<slot></slot>
|
|
@@ -578,28 +636,48 @@ class f extends HTMLElement {
|
|
|
578
636
|
</a>
|
|
579
637
|
`;
|
|
580
638
|
}
|
|
639
|
+
// Update avatar sizes based on button size
|
|
640
|
+
updateAvatarSizes(a) {
|
|
641
|
+
const o = this.getAttribute("size") || "medium", s = ((this.getAttribute("variant") || "default") === "default" ? {
|
|
642
|
+
"x-small": "x-small",
|
|
643
|
+
small: "x-small",
|
|
644
|
+
medium: "x-small",
|
|
645
|
+
large: "small"
|
|
646
|
+
} : {
|
|
647
|
+
"x-small": "x-small",
|
|
648
|
+
small: "x-small",
|
|
649
|
+
medium: "small",
|
|
650
|
+
large: "medium"
|
|
651
|
+
})[o] || "small";
|
|
652
|
+
a.forEach((r) => {
|
|
653
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
654
|
+
const i = r;
|
|
655
|
+
i.tagName.toLowerCase() === "mui-avatar" && i.setAttribute("size", s);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
}
|
|
581
659
|
updateIconSizes(a, o) {
|
|
582
|
-
const e = this.getAttribute("size") || "medium",
|
|
660
|
+
const e = this.getAttribute("size") || "medium", d = {
|
|
583
661
|
"x-small": "x-small",
|
|
584
662
|
small: "x-small",
|
|
585
663
|
medium: o ? "medium" : "small",
|
|
586
664
|
large: o ? "large" : "medium"
|
|
587
665
|
}[e] || "small";
|
|
588
|
-
a.forEach((
|
|
589
|
-
if (
|
|
590
|
-
const r =
|
|
591
|
-
(
|
|
666
|
+
a.forEach((s) => {
|
|
667
|
+
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
668
|
+
const r = s, i = r.tagName.toLowerCase();
|
|
669
|
+
(i === "svg" || r.classList.contains("mui-icon") || i === "mui-icon") && !r.hasAttribute("size") && r.setAttribute("size", d);
|
|
592
670
|
}
|
|
593
671
|
});
|
|
594
672
|
}
|
|
595
673
|
waitForPartMap() {
|
|
596
674
|
return new Promise((a) => {
|
|
597
|
-
if (typeof
|
|
675
|
+
if (typeof h == "function") return a();
|
|
598
676
|
const o = () => {
|
|
599
|
-
typeof
|
|
677
|
+
typeof h == "function" ? a() : requestAnimationFrame(o);
|
|
600
678
|
};
|
|
601
679
|
o();
|
|
602
680
|
});
|
|
603
681
|
}
|
|
604
682
|
}
|
|
605
|
-
customElements.get("mui-link") || customElements.define("mui-link",
|
|
683
|
+
customElements.get("mui-link") || customElements.define("mui-link", u);
|
|
@@ -67,7 +67,7 @@ class p extends HTMLElement {
|
|
|
67
67
|
border: var(--border-thin);
|
|
68
68
|
border-color: var(--form-default-border-color);
|
|
69
69
|
border-radius: var(--radius-100);
|
|
70
|
-
color: var(--text-color);
|
|
70
|
+
color: var(--form-default-text-color);
|
|
71
71
|
background: var(--input-background);
|
|
72
72
|
width: 100%;
|
|
73
73
|
box-sizing: border-box;
|
|
@@ -75,6 +75,7 @@ class p extends HTMLElement {
|
|
|
75
75
|
}
|
|
76
76
|
select:hover {
|
|
77
77
|
border-color: var(--form-default-border-color-hover);
|
|
78
|
+
color: var(--form-default-text-color-hover);
|
|
78
79
|
}
|
|
79
80
|
select:focus {
|
|
80
81
|
outline: var(--outline-thick);
|
|
@@ -9,16 +9,27 @@ class i extends HTMLElement {
|
|
|
9
9
|
static get observedAttributes() {
|
|
10
10
|
return ["variant", "col", "space"];
|
|
11
11
|
}
|
|
12
|
-
attributeChangedCallback(
|
|
13
|
-
|
|
12
|
+
attributeChangedCallback(a, t, r) {
|
|
13
|
+
a === "variant" && (this.variant = r), this.render();
|
|
14
|
+
}
|
|
15
|
+
enforceAvatarSizes() {
|
|
16
|
+
var t;
|
|
17
|
+
const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("slot");
|
|
18
|
+
a == null || a.forEach((r) => {
|
|
19
|
+
r.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
20
|
+
s.tagName.toLowerCase() === "mui-avatar" && s.setAttribute("size", "small");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
14
23
|
}
|
|
15
24
|
connectedCallback() {
|
|
16
|
-
this.variant = this.getAttribute("variant") || "", this.setAttribute("role", "row"), this.render()
|
|
25
|
+
this.variant = this.getAttribute("variant") || "", this.setAttribute("role", "row"), this.render(), requestAnimationFrame(() => {
|
|
26
|
+
this.enforceAvatarSizes();
|
|
27
|
+
});
|
|
17
28
|
}
|
|
18
29
|
applyCellRoles() {
|
|
19
|
-
var
|
|
20
|
-
const
|
|
21
|
-
|
|
30
|
+
var t;
|
|
31
|
+
const a = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("slot");
|
|
32
|
+
a == null || a.forEach((r) => {
|
|
22
33
|
r.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
23
34
|
s.setAttribute("role", "cell");
|
|
24
35
|
});
|
|
@@ -28,12 +39,12 @@ class i extends HTMLElement {
|
|
|
28
39
|
return this.querySelector('[slot="accessory"]') !== null;
|
|
29
40
|
}
|
|
30
41
|
render() {
|
|
31
|
-
const
|
|
42
|
+
const a = this.variant === "action", t = this.getAttribute("col") || "1fr 1fr", r = this.getAttribute("space") || "var(--space-500)", e = this.hasAccessorySlot(), s = (
|
|
32
43
|
/*css*/
|
|
33
44
|
`
|
|
34
45
|
:host {
|
|
35
46
|
display: grid;
|
|
36
|
-
grid-template-columns: ${
|
|
47
|
+
grid-template-columns: ${t};
|
|
37
48
|
align-items: center;
|
|
38
49
|
gap: ${r};
|
|
39
50
|
box-sizing: border-box;
|
|
@@ -106,6 +117,22 @@ class i extends HTMLElement {
|
|
|
106
117
|
border-bottom-right-radius: var(--card-radius);
|
|
107
118
|
}
|
|
108
119
|
|
|
120
|
+
::slotted(mui-avatar) {
|
|
121
|
+
--avatar-background-override: var(--slat-avatar-background);
|
|
122
|
+
}
|
|
123
|
+
.action:hover ::slotted(mui-avatar),
|
|
124
|
+
.action:focus ::slotted(mui-avatar) {
|
|
125
|
+
--avatar-background-override: var(--slat-avatar-background-hover);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host(.card-slot) ::slotted(mui-avatar) {
|
|
129
|
+
--avatar-background-override: var(--slat-card-avatar-background);
|
|
130
|
+
}
|
|
131
|
+
:host(.card-slot) .action:hover ::slotted(mui-avatar),
|
|
132
|
+
:host(.card-slot) .action:focus ::slotted(mui-avatar) {
|
|
133
|
+
--avatar-background-override: var(--slat-card-avatar-background-hover);
|
|
134
|
+
}
|
|
135
|
+
|
|
109
136
|
`
|
|
110
137
|
), o = e ? `
|
|
111
138
|
<mui-h-stack alignY="center" space="var(--space-400)">
|
|
@@ -113,7 +140,7 @@ class i extends HTMLElement {
|
|
|
113
140
|
<slot name="start"></slot>
|
|
114
141
|
</mui-h-stack>
|
|
115
142
|
` : '<slot name="start"></slot>';
|
|
116
|
-
this.shadowRoot.innerHTML =
|
|
143
|
+
this.shadowRoot.innerHTML = a ? (
|
|
117
144
|
/*html*/
|
|
118
145
|
`
|
|
119
146
|
<style>${s}</style>
|
|
@@ -4,7 +4,7 @@ class h extends HTMLElement {
|
|
|
4
4
|
}
|
|
5
5
|
connectedCallback() {
|
|
6
6
|
var t;
|
|
7
|
-
this.render(), this._checkbox = this.shadowRoot.querySelector('input[type="checkbox"]'), this._checked = this.hasAttribute("checked"), this._checkbox && (this._checkbox.checked = this._checked), this._updateIcons(), this._updateDisabledState(), (t = this._checkbox) == null || t.addEventListener("change", () => {
|
|
7
|
+
this.render(), this._checkbox = this.shadowRoot.querySelector('input[type="checkbox"]'), this._checked = this.hasAttribute("checked"), this._checkbox && (this._checkbox.checked = this._checked), this._updateIcons(), this._updateDisabledState(), this._enforceIconSize(), (t = this._checkbox) == null || t.addEventListener("change", () => {
|
|
8
8
|
this._checkbox && (this.checked = this._checkbox.checked, this.dispatchEvent(
|
|
9
9
|
new CustomEvent("change", {
|
|
10
10
|
detail: { checked: this.checked },
|
|
@@ -17,10 +17,10 @@ class h extends HTMLElement {
|
|
|
17
17
|
static get observedAttributes() {
|
|
18
18
|
return ["label", "disabled", "checked"];
|
|
19
19
|
}
|
|
20
|
-
attributeChangedCallback(t, e,
|
|
21
|
-
if (t === "checked" && e !==
|
|
22
|
-
const
|
|
23
|
-
this._checkbox && (this._checkbox.disabled =
|
|
20
|
+
attributeChangedCallback(t, e, s) {
|
|
21
|
+
if (t === "checked" && e !== s && (this._checked = s !== null, this._checkbox && (this._checkbox.checked = this._checked, this._updateIcons())), t === "disabled" && e !== s) {
|
|
22
|
+
const i = s !== null;
|
|
23
|
+
this._checkbox && (this._checkbox.disabled = i, this._checkbox.setAttribute("aria-disabled", i.toString())), this._updateDisabledState();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
get checked() {
|
|
@@ -31,15 +31,27 @@ class h extends HTMLElement {
|
|
|
31
31
|
this._checked !== e && (this._checked = e, e ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._checkbox && (this._checkbox.checked = this._checked, this._checkbox.setAttribute("aria-checked", this._checked.toString()), this._updateIcons()));
|
|
32
32
|
}
|
|
33
33
|
_updateDisabledState() {
|
|
34
|
-
var e,
|
|
35
|
-
this.hasAttribute("disabled") ? (this.shadowRoot.host.classList.add("disabled"), (e = this._checkbox) == null || e.setAttribute("aria-disabled", "true"), (
|
|
34
|
+
var e, s, i, c;
|
|
35
|
+
this.hasAttribute("disabled") ? (this.shadowRoot.host.classList.add("disabled"), (e = this._checkbox) == null || e.setAttribute("aria-disabled", "true"), (s = this._checkbox) == null || s.setAttribute("tabindex", "-1")) : (this.shadowRoot.host.classList.remove("disabled"), (i = this._checkbox) == null || i.removeAttribute("aria-disabled"), (c = this._checkbox) == null || c.removeAttribute("tabindex"));
|
|
36
|
+
}
|
|
37
|
+
_enforceIconSize() {
|
|
38
|
+
const t = this.shadowRoot.querySelector('slot[name="on-icon"]'), e = this.shadowRoot.querySelector('slot[name="off-icon"]'), s = (i) => {
|
|
39
|
+
if (!i) return;
|
|
40
|
+
const c = () => {
|
|
41
|
+
i.assignedElements().forEach((o) => {
|
|
42
|
+
o.tagName.toLowerCase().startsWith("mui-icon") && o.setAttribute("size", "x-small");
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
i.addEventListener("slotchange", c), setTimeout(c, 0);
|
|
46
|
+
};
|
|
47
|
+
s(t), s(e);
|
|
36
48
|
}
|
|
37
49
|
_updateIcons() {
|
|
38
50
|
const t = this.shadowRoot.querySelector('slot[name="on-icon"]'), e = this.shadowRoot.querySelector('slot[name="off-icon"]');
|
|
39
|
-
t && t.assignedElements().forEach((
|
|
40
|
-
|
|
41
|
-
}), e && e.assignedElements().forEach((
|
|
42
|
-
|
|
51
|
+
t && t.assignedElements().forEach((s) => {
|
|
52
|
+
s.style.display = this._checked ? "inline" : "none";
|
|
53
|
+
}), e && e.assignedElements().forEach((s) => {
|
|
54
|
+
s.style.display = this._checked ? "none" : "inline";
|
|
43
55
|
});
|
|
44
56
|
}
|
|
45
57
|
render() {
|
|
@@ -102,8 +114,6 @@ class h extends HTMLElement {
|
|
|
102
114
|
|
|
103
115
|
::slotted([slot="on-icon"]),
|
|
104
116
|
::slotted([slot="off-icon"]) {
|
|
105
|
-
width: 16px;
|
|
106
|
-
height: 16px;
|
|
107
117
|
fill: var(--switch-icon);
|
|
108
118
|
}
|
|
109
119
|
|