@muibook/components 19.6.0 → 20.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/README.md +1 -1
- package/dist/esm/agent/keywords/index.js +32 -1
- package/dist/esm/agent/prompts/index.js +10 -8
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +4 -1
- package/dist/esm/components/mui-badge/index.js +35 -18
- package/dist/esm/components/mui-button/index.js +187 -52
- package/dist/esm/components/mui-card/body/index.js +1 -1
- package/dist/esm/components/mui-chip/index.js +56 -26
- package/dist/esm/components/mui-chip-rail/index.js +239 -0
- package/dist/esm/components/mui-code/index.js +5 -5
- package/dist/esm/components/mui-dropdown/index.js +55 -46
- package/dist/esm/components/mui-file-upload/index.js +1 -0
- package/dist/esm/components/mui-heading/index.js +3 -2
- package/dist/esm/components/mui-input/index.js +21 -17
- package/dist/esm/components/mui-link/index.js +199 -55
- package/dist/esm/components/mui-message/index.js +7 -6
- package/dist/esm/components/mui-prompt/index.js +102 -102
- package/dist/esm/components/mui-select/index.js +4 -4
- package/dist/esm/components/mui-stack/hstack/index.js +10 -5
- package/dist/esm/components/mui-status/index.js +239 -0
- package/dist/esm/components/mui-stepper/step/index.js +46 -32
- package/dist/esm/components/mui-switch/index.js +21 -13
- package/dist/esm/components/mui-tabs/controller/index.js +17 -6
- package/dist/esm/components/mui-tabs/item/index.js +17 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
- package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
- package/dist/esm/css/mui-brand.css +1 -1
- package/dist/esm/css/mui-tokens.css +267 -77
- package/dist/esm/custom-elements.json +2212 -1538
- package/dist/esm/dynamic-attrs.json +26 -6
- package/dist/esm/index.js +7 -4
- package/dist/types/components/mui-button/api.d.ts +4 -0
- package/dist/types/components/mui-chip/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
- package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +3 -0
- package/dist/types/components/mui-link/api.d.ts +4 -0
- package/dist/types/components/mui-status/api.d.ts +24 -0
- package/dist/types/components/mui-status/doc.d.ts +2 -0
- package/dist/types/components/mui-status/index.d.ts +1 -0
- package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
- package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
- package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +13 -1
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as h } from "../../utils/part-map/index.js";
|
|
2
|
+
class f extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return [
|
|
4
|
+
return [
|
|
5
|
+
"onclick",
|
|
6
|
+
"type",
|
|
7
|
+
"aria-label",
|
|
8
|
+
"disabled",
|
|
9
|
+
"variant",
|
|
10
|
+
"stroke",
|
|
11
|
+
"stroke-ring-size",
|
|
12
|
+
"focus-ring",
|
|
13
|
+
"size",
|
|
14
|
+
"usage"
|
|
15
|
+
];
|
|
5
16
|
}
|
|
6
17
|
constructor() {
|
|
7
18
|
super(), this.attachShadow({ mode: "open" });
|
|
8
19
|
}
|
|
9
20
|
async connectedCallback() {
|
|
10
|
-
if (this.hasAttribute("size") || this.setAttribute("size", "medium"), await this.waitForPartMap(), !this.shadowRoot) return;
|
|
21
|
+
if (this.hasAttribute("size") || this.setAttribute("size", "medium"), this.syncRingSizeAttribute(), await this.waitForPartMap(), !this.shadowRoot) return;
|
|
11
22
|
let t = (
|
|
12
23
|
/*html*/
|
|
13
24
|
`
|
|
@@ -18,6 +29,9 @@ class h extends HTMLElement {
|
|
|
18
29
|
display: inline-block;
|
|
19
30
|
width: auto;
|
|
20
31
|
text-align: center;
|
|
32
|
+
--action-focus-outline: var(--stroke-size-400) var(--stroke-outset) var(--outline-color);
|
|
33
|
+
--action-focus-outline-inset-offset: var(--stroke-size-400);
|
|
34
|
+
--action-focus-outline-offset: calc(-1 * var(--action-focus-outline-inset-offset));
|
|
21
35
|
}
|
|
22
36
|
button {
|
|
23
37
|
vertical-align: baseline;
|
|
@@ -26,6 +40,7 @@ class h extends HTMLElement {
|
|
|
26
40
|
width: 100%;
|
|
27
41
|
border-radius: var(--action-radius-medium);
|
|
28
42
|
padding: var(--action-padding);
|
|
43
|
+
min-height: var(--action-size-medium);
|
|
29
44
|
text-decoration: none;
|
|
30
45
|
line-height: var(--action-line-height);
|
|
31
46
|
display: inherit;
|
|
@@ -67,7 +82,8 @@ class h extends HTMLElement {
|
|
|
67
82
|
button, button:before, button:after {box-sizing: border-box;}
|
|
68
83
|
|
|
69
84
|
button:focus-visible {
|
|
70
|
-
outline: var(--outline
|
|
85
|
+
outline: var(--action-focus-outline);
|
|
86
|
+
outline-offset: var(--action-focus-outline-offset);
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
:host button ::slotted(.mui-icon) { fill: var(--action-primary-text-color); }
|
|
@@ -245,14 +261,83 @@ class h extends HTMLElement {
|
|
|
245
261
|
:host([variant="attention"]) button:focus-visible ::slotted(.mui-icon) { fill: var(--action-attention-text-color-focus); }
|
|
246
262
|
:host([variant="attention"]) button:disabled ::slotted(.mui-icon) { fill: var(--action-attention-text-color-disabled); }
|
|
247
263
|
|
|
264
|
+
:host,
|
|
265
|
+
:host([variant="primary"]) {
|
|
266
|
+
--action-ring-color: var(--action-primary-border-color);
|
|
267
|
+
--action-ring-color-hover: var(--action-primary-border-color-hover);
|
|
268
|
+
--action-ring-color-focus: var(--action-primary-border-color-focus);
|
|
269
|
+
--action-ring-color-disabled: var(--action-primary-border-color-disabled);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
:host([variant="secondary"]) {
|
|
273
|
+
--action-ring-color: var(--action-secondary-border-color);
|
|
274
|
+
--action-ring-color-hover: var(--action-secondary-border-color-hover);
|
|
275
|
+
--action-ring-color-focus: var(--action-secondary-border-color-focus);
|
|
276
|
+
--action-ring-color-disabled: var(--action-secondary-border-color-disabled);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:host([variant="tertiary"]) {
|
|
280
|
+
--action-ring-color: var(--action-tertiary-border-color);
|
|
281
|
+
--action-ring-color-hover: var(--action-tertiary-border-color-hover);
|
|
282
|
+
--action-ring-color-focus: var(--action-tertiary-border-color-focus);
|
|
283
|
+
--action-ring-color-disabled: var(--action-tertiary-border-color-disabled);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:host([variant="overlay"]) {
|
|
287
|
+
--action-ring-size: var(--stroke-size-100);
|
|
288
|
+
--action-ring-color: var(--action-overlay-border-color);
|
|
289
|
+
--action-ring-color-hover: var(--action-overlay-border-color-hover);
|
|
290
|
+
--action-ring-color-focus: var(--action-overlay-border-color-focus);
|
|
291
|
+
--action-ring-color-disabled: var(--action-overlay-border-color-disabled);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:host([variant="attention"]) {
|
|
295
|
+
--action-ring-color: var(--action-attention-border-color);
|
|
296
|
+
--action-ring-color-hover: var(--action-attention-border-color-hover);
|
|
297
|
+
--action-ring-color-focus: var(--action-attention-border-color-focus);
|
|
298
|
+
--action-ring-color-disabled: var(--action-attention-border-color-disabled);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
:host([stroke="ring"]:not([usage="input"])) button {
|
|
302
|
+
border: none;
|
|
303
|
+
box-shadow: var(
|
|
304
|
+
--action-ring-shadow,
|
|
305
|
+
inset 0 0 0 var(--action-ring-size, var(--stroke-size-100)) var(--action-ring-color)
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:host([stroke="ring"]:not([usage="input"])) button:hover {
|
|
310
|
+
border: none;
|
|
311
|
+
box-shadow: var(
|
|
312
|
+
--action-ring-shadow-hover,
|
|
313
|
+
inset 0 0 0 var(--action-ring-size, var(--stroke-size-100)) var(--action-ring-color-hover)
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
:host([stroke="ring"]:not([usage="input"])) button:focus-visible {
|
|
318
|
+
border: none;
|
|
319
|
+
box-shadow: var(
|
|
320
|
+
--action-ring-shadow-focus,
|
|
321
|
+
inset 0 0 0 var(--action-ring-size, var(--stroke-size-100)) var(--action-ring-color-focus)
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
:host([stroke="ring"]:not([usage="input"])) button:disabled {
|
|
326
|
+
border: none;
|
|
327
|
+
box-shadow: var(
|
|
328
|
+
--action-ring-shadow-disabled,
|
|
329
|
+
inset 0 0 0 var(--action-ring-size, var(--stroke-size-100)) var(--action-ring-color-disabled)
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
248
333
|
/* Icon only
|
|
249
334
|
========================================= */
|
|
250
335
|
:host([icon-only]) button {
|
|
251
336
|
display: flex;
|
|
252
337
|
justify-content: center;
|
|
253
338
|
align-items: center;
|
|
254
|
-
height: var(--action-
|
|
255
|
-
width: var(--action-
|
|
339
|
+
height: var(--action-size-medium);
|
|
340
|
+
width: var(--action-size-medium);
|
|
256
341
|
padding: var(--action-icon-only-padding);
|
|
257
342
|
}
|
|
258
343
|
/* ===================================== */
|
|
@@ -478,6 +563,7 @@ class h extends HTMLElement {
|
|
|
478
563
|
font-size: var(--font-size-15);
|
|
479
564
|
line-height: var(--line-height-25);
|
|
480
565
|
font-weight: var(--font-weight-semi-bold);
|
|
566
|
+
min-height: var(--action-size-xx-small);
|
|
481
567
|
padding: var(--space-025) var(--space-100);
|
|
482
568
|
border-width: var(--stroke-size-100);
|
|
483
569
|
border-radius: var(--action-radius-x-small);
|
|
@@ -490,6 +576,7 @@ class h extends HTMLElement {
|
|
|
490
576
|
font-size: var(--text-font-size-xs);
|
|
491
577
|
line-height: var(--text-line-height-xs);
|
|
492
578
|
font-weight: var(--font-weight-semi-bold);
|
|
579
|
+
min-height: var(--action-size-x-small);
|
|
493
580
|
padding: var(--action-padding-x-small);
|
|
494
581
|
border-width: var(--stroke-size-100);
|
|
495
582
|
border-radius: var(--action-radius-x-small);
|
|
@@ -498,6 +585,7 @@ class h extends HTMLElement {
|
|
|
498
585
|
:host([size="small"]) button {
|
|
499
586
|
font-size: var(--text-font-size-s);
|
|
500
587
|
line-height: var(--text-line-height-s);
|
|
588
|
+
min-height: var(--action-size-small);
|
|
501
589
|
padding: var(--action-padding-small);
|
|
502
590
|
border-radius: var(--action-radius-small);
|
|
503
591
|
}
|
|
@@ -505,12 +593,14 @@ class h extends HTMLElement {
|
|
|
505
593
|
:host([size="medium"]) button {
|
|
506
594
|
font-size: var(--text-font-size-m);
|
|
507
595
|
line-height: var(--text-line-height-m);
|
|
596
|
+
min-height: var(--action-size-medium);
|
|
508
597
|
border-radius: var(--action-radius-medium);
|
|
509
598
|
}
|
|
510
599
|
|
|
511
600
|
:host([size="large"]) button {
|
|
512
601
|
font-size: var(--text-font-size-l);
|
|
513
602
|
line-height: var(--text-line-height-l);
|
|
603
|
+
min-height: var(--action-size-large);
|
|
514
604
|
padding: var(--action-padding-large);
|
|
515
605
|
border-radius: var(--action-radius-large);
|
|
516
606
|
}
|
|
@@ -560,26 +650,26 @@ class h extends HTMLElement {
|
|
|
560
650
|
}
|
|
561
651
|
|
|
562
652
|
:host([size="xx-small"][icon-only]) button {
|
|
563
|
-
height:
|
|
564
|
-
width:
|
|
653
|
+
height: var(--action-size-xx-small);
|
|
654
|
+
width: var(--action-size-xx-small);
|
|
565
655
|
padding: var(--action-icon-only-padding);
|
|
566
656
|
}
|
|
567
657
|
|
|
568
658
|
:host([size="x-small"][icon-only]) button {
|
|
569
|
-
height: var(--action-
|
|
570
|
-
width: var(--action-
|
|
659
|
+
height: var(--action-size-x-small);
|
|
660
|
+
width: var(--action-size-x-small);
|
|
571
661
|
padding: var(--action-icon-only-padding);
|
|
572
662
|
}
|
|
573
663
|
|
|
574
664
|
:host([size="small"][icon-only]) button {
|
|
575
|
-
height: var(--action-
|
|
576
|
-
width: var(--action-
|
|
665
|
+
height: var(--action-size-small);
|
|
666
|
+
width: var(--action-size-small);
|
|
577
667
|
padding: var(--action-icon-only-padding);
|
|
578
668
|
}
|
|
579
669
|
|
|
580
670
|
:host([size="large"][icon-only]) button {
|
|
581
|
-
height: var(--action-
|
|
582
|
-
width: var(--action-
|
|
671
|
+
height: var(--action-size-large);
|
|
672
|
+
width: var(--action-size-large);
|
|
583
673
|
padding: var(--action-icon-only-padding);
|
|
584
674
|
}
|
|
585
675
|
|
|
@@ -691,11 +781,44 @@ class h extends HTMLElement {
|
|
|
691
781
|
margin-left: var(--space-000);
|
|
692
782
|
}
|
|
693
783
|
|
|
784
|
+
:host([has-video]) {
|
|
785
|
+
display: inline-block;
|
|
786
|
+
width: auto;
|
|
787
|
+
text-align: initial;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
:host([has-video]) button,
|
|
791
|
+
:host([has-video]) button:hover,
|
|
792
|
+
:host([has-video]) button:focus,
|
|
793
|
+
:host([has-video]) button:focus-visible,
|
|
794
|
+
:host([has-video]) button:disabled {
|
|
795
|
+
display: block;
|
|
796
|
+
width: 100%;
|
|
797
|
+
min-height: 0;
|
|
798
|
+
padding: var(--space-000);
|
|
799
|
+
border: none;
|
|
800
|
+
border-radius: var(--radius-000);
|
|
801
|
+
background: transparent;
|
|
802
|
+
color: inherit;
|
|
803
|
+
font-size: inherit;
|
|
804
|
+
font-weight: inherit;
|
|
805
|
+
line-height: inherit;
|
|
806
|
+
text-align: initial;
|
|
807
|
+
box-shadow: none;
|
|
808
|
+
outline-offset: var(--video-thumbnail-action-focus-outline-offset, var(--space-300));
|
|
809
|
+
-webkit-backdrop-filter: none;
|
|
810
|
+
backdrop-filter: none;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
:host([focus-ring="outset"]) button:focus-visible {
|
|
814
|
+
outline-offset: var(--action-focus-outline-outset-offset, var(--stroke-size-200));
|
|
815
|
+
}
|
|
816
|
+
|
|
694
817
|
|
|
695
818
|
</style>
|
|
696
819
|
|
|
697
820
|
<button
|
|
698
|
-
part="${
|
|
821
|
+
part="${h("text", "spacing", "layout", "visual")}"
|
|
699
822
|
onclick="${this.getAttribute("onclick")}"
|
|
700
823
|
type="${this.getAttribute("type") || "button"}"
|
|
701
824
|
aria-label="${this.getAttribute("aria-label") || ""}"
|
|
@@ -712,48 +835,60 @@ class h extends HTMLElement {
|
|
|
712
835
|
this.shadowRoot.querySelector("slot:not([name])"),
|
|
713
836
|
this.shadowRoot.querySelector('slot[name="before"]'),
|
|
714
837
|
this.shadowRoot.querySelector('slot[name="after"]')
|
|
715
|
-
].forEach((
|
|
838
|
+
].forEach((a) => a == null ? void 0 : a.addEventListener("slotchange", () => this.syncButtonState())), requestAnimationFrame(() => this.syncButtonState());
|
|
716
839
|
}
|
|
717
|
-
attributeChangedCallback(o, t,
|
|
718
|
-
var
|
|
840
|
+
attributeChangedCallback(o, t, s) {
|
|
841
|
+
var a;
|
|
719
842
|
if (o === "disabled") {
|
|
720
|
-
const e = (
|
|
843
|
+
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector("button");
|
|
721
844
|
e && (this.hasAttribute("disabled") ? e.setAttribute("disabled", "") : e.removeAttribute("disabled"));
|
|
722
845
|
}
|
|
723
|
-
o === "size" && t !==
|
|
846
|
+
o === "size" && t !== s && this.shadowRoot && requestAnimationFrame(() => this.syncButtonState()), o === "stroke-ring-size" && t !== s && this.syncRingSizeAttribute();
|
|
847
|
+
}
|
|
848
|
+
syncRingSizeAttribute() {
|
|
849
|
+
var a;
|
|
850
|
+
const o = (a = this.getAttribute("stroke-ring-size")) == null ? void 0 : a.trim();
|
|
851
|
+
if (!o) {
|
|
852
|
+
this.style.removeProperty("--action-ring-size");
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const t = o.startsWith("stroke-size-") ? o.replace("stroke-size-", "") : o, s = /^(100|200|300|400|500)$/.test(t);
|
|
856
|
+
this.style.setProperty("--action-ring-size", s ? `var(--stroke-size-${t})` : o);
|
|
724
857
|
}
|
|
725
858
|
syncButtonState() {
|
|
726
859
|
const o = this.shadowRoot;
|
|
727
860
|
if (!o) return;
|
|
728
|
-
const t = o.querySelector("slot:not([name])"),
|
|
729
|
-
var
|
|
730
|
-
return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((
|
|
731
|
-
}) : !1,
|
|
732
|
-
this.toggleAttribute("has-before",
|
|
733
|
-
const
|
|
861
|
+
const t = o.querySelector("slot:not([name])"), s = o.querySelector('slot[name="before"]'), a = o.querySelector('slot[name="after"]'), e = (r) => r ? r.assignedNodes({ flatten: !0 }).some((i) => {
|
|
862
|
+
var c;
|
|
863
|
+
return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((c = i.textContent) != null && c.trim());
|
|
864
|
+
}) : !1, n = e(s), l = e(a);
|
|
865
|
+
this.toggleAttribute("has-before", n), this.toggleAttribute("has-after", l);
|
|
866
|
+
const d = (t == null ? void 0 : t.assignedNodes({ flatten: !0 })) ?? [], u = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [], b = u.some((r) => r.tagName.toLowerCase() === "mui-video-thumbnail");
|
|
867
|
+
this.toggleAttribute("has-video", b);
|
|
868
|
+
const v = !b && u.length === 1 && u[0].tagName.toLowerCase() === "mui-avatar" && d.every((r) => {
|
|
734
869
|
var i;
|
|
735
|
-
return
|
|
870
|
+
return r.nodeType === Node.TEXT_NODE ? !((i = r.textContent) != null && i.trim()) : r.nodeType === Node.ELEMENT_NODE ? r.tagName.toLowerCase() === "mui-avatar" : !1;
|
|
736
871
|
});
|
|
737
|
-
if (this.toggleAttribute("avatar-only",
|
|
872
|
+
if (this.toggleAttribute("avatar-only", v), !v && !b && d.every((r) => {
|
|
738
873
|
var i;
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
741
|
-
return
|
|
874
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
875
|
+
const c = r;
|
|
876
|
+
return c.tagName.toLowerCase() === "svg" || c.classList.contains("mui-icon");
|
|
742
877
|
}
|
|
743
|
-
return
|
|
878
|
+
return r.nodeType === Node.TEXT_NODE && !((i = r.textContent) != null && i.trim());
|
|
744
879
|
})) {
|
|
745
|
-
this.setAttribute("icon-only", ""), this.updateIconSizes(
|
|
880
|
+
this.setAttribute("icon-only", ""), this.updateIconSizes(d, !0);
|
|
746
881
|
return;
|
|
747
882
|
}
|
|
748
|
-
this.removeAttribute("icon-only"), [
|
|
749
|
-
if (!
|
|
750
|
-
const i =
|
|
751
|
-
this.updateIconSizes(i, !1),
|
|
883
|
+
this.removeAttribute("icon-only"), [s, t, a].forEach((r) => {
|
|
884
|
+
if (!r) return;
|
|
885
|
+
const i = r.assignedNodes({ flatten: !0 });
|
|
886
|
+
this.updateIconSizes(i, !1), v || this.updateAvatarSizes(i), this.updateBadgeSizes(i);
|
|
752
887
|
});
|
|
753
888
|
}
|
|
754
889
|
// Update avatar sizes based on button size
|
|
755
890
|
updateAvatarSizes(o) {
|
|
756
|
-
const t = this.getAttribute("size") || "medium",
|
|
891
|
+
const t = this.getAttribute("size") || "medium", a = {
|
|
757
892
|
"xx-small": "xx-small",
|
|
758
893
|
"x-small": "xx-small",
|
|
759
894
|
small: "xx-small",
|
|
@@ -762,29 +897,29 @@ class h extends HTMLElement {
|
|
|
762
897
|
}[t] || "small";
|
|
763
898
|
o.forEach((e) => {
|
|
764
899
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
765
|
-
const
|
|
766
|
-
|
|
900
|
+
const n = e;
|
|
901
|
+
n.tagName.toLowerCase() === "mui-avatar" && n.setAttribute("size", a);
|
|
767
902
|
}
|
|
768
903
|
});
|
|
769
904
|
}
|
|
770
905
|
updateIconSizes(o, t) {
|
|
771
|
-
const
|
|
906
|
+
const s = this.getAttribute("size") || "medium", e = {
|
|
772
907
|
"xx-small": "xx-small",
|
|
773
908
|
"x-small": "x-small",
|
|
774
909
|
small: "x-small",
|
|
775
910
|
medium: t ? "medium" : "small",
|
|
776
911
|
// small for regular, medium for icon-only
|
|
777
912
|
large: t ? "large" : "medium"
|
|
778
|
-
}[
|
|
779
|
-
o.forEach((
|
|
780
|
-
if (
|
|
781
|
-
const l =
|
|
913
|
+
}[s] || "small";
|
|
914
|
+
o.forEach((n) => {
|
|
915
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
916
|
+
const l = n;
|
|
782
917
|
(l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "mui-icon") && !l.hasAttribute("size") && l.setAttribute("size", e);
|
|
783
918
|
}
|
|
784
919
|
});
|
|
785
920
|
}
|
|
786
921
|
updateBadgeSizes(o) {
|
|
787
|
-
const t = this.getAttribute("size") || "medium",
|
|
922
|
+
const t = this.getAttribute("size") || "medium", a = {
|
|
788
923
|
"xx-small": "x-small",
|
|
789
924
|
"x-small": "x-small",
|
|
790
925
|
small: "small",
|
|
@@ -793,19 +928,19 @@ class h extends HTMLElement {
|
|
|
793
928
|
}[t] || "medium";
|
|
794
929
|
o.forEach((e) => {
|
|
795
930
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
796
|
-
const
|
|
797
|
-
|
|
931
|
+
const n = e;
|
|
932
|
+
n.tagName.toLowerCase() === "mui-badge" && n.setAttribute("size", a);
|
|
798
933
|
}
|
|
799
934
|
});
|
|
800
935
|
}
|
|
801
936
|
waitForPartMap() {
|
|
802
937
|
return new Promise((o) => {
|
|
803
|
-
if (typeof
|
|
938
|
+
if (typeof h == "function") return o();
|
|
804
939
|
const t = () => {
|
|
805
|
-
typeof
|
|
940
|
+
typeof h == "function" ? o() : requestAnimationFrame(t);
|
|
806
941
|
};
|
|
807
942
|
t();
|
|
808
943
|
});
|
|
809
944
|
}
|
|
810
945
|
}
|
|
811
|
-
customElements.get("mui-button") || customElements.define("mui-button",
|
|
946
|
+
customElements.get("mui-button") || customElements.define("mui-button", f);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class d extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" });
|
|
4
4
|
}
|
|
@@ -17,30 +17,30 @@ class l extends HTMLElement {
|
|
|
17
17
|
requestAnimationFrame(() => {
|
|
18
18
|
const r = this.shadowRoot;
|
|
19
19
|
if (!r) return;
|
|
20
|
-
const e = r.querySelector('slot[name="before"]'), s = r.querySelector('slot[name="after"]'),
|
|
21
|
-
var
|
|
22
|
-
return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((
|
|
23
|
-
}) : !1,
|
|
24
|
-
this.toggleAttribute("has-before",
|
|
20
|
+
const e = r.querySelector('slot[name="before"]'), s = r.querySelector('slot[name="after"]'), o = (t) => t ? t.assignedNodes({ flatten: !0 }).some((i) => {
|
|
21
|
+
var n;
|
|
22
|
+
return i.nodeType === Node.ELEMENT_NODE || i.nodeType === Node.TEXT_NODE && !!((n = i.textContent) != null && n.trim());
|
|
23
|
+
}) : !1, c = o(e), a = o(s);
|
|
24
|
+
this.toggleAttribute("has-before", c), this.toggleAttribute("has-after", a), this.forceAvatarSize(e), this.forceAvatarSize(s);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
forceAvatarSize(r) {
|
|
28
28
|
if (!r) return;
|
|
29
|
-
const e = this.getAttribute("size") || "medium",
|
|
29
|
+
const e = this.getAttribute("size") || "medium", o = {
|
|
30
30
|
"x-small": "xx-small",
|
|
31
31
|
small: "x-small",
|
|
32
32
|
medium: "medium",
|
|
33
33
|
large: "medium"
|
|
34
34
|
}[e] || "medium";
|
|
35
|
-
r.assignedNodes({ flatten: !0 }).forEach((
|
|
36
|
-
if (
|
|
37
|
-
const t =
|
|
38
|
-
i === "mui-avatar" ? t.setAttribute("size", "xx-small") : i.startsWith("mui-icon-") && t.setAttribute("size",
|
|
35
|
+
r.assignedNodes({ flatten: !0 }).forEach((a) => {
|
|
36
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
37
|
+
const t = a, i = t.tagName.toLowerCase();
|
|
38
|
+
i === "mui-avatar" ? t.setAttribute("size", "xx-small") : i.startsWith("mui-icon-") && t.setAttribute("size", o);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
render() {
|
|
43
|
-
var
|
|
43
|
+
var n;
|
|
44
44
|
const r = this.getAttribute("size") || "medium", e = {
|
|
45
45
|
"x-small": "x-small",
|
|
46
46
|
small: "x-small",
|
|
@@ -51,17 +51,22 @@ class l extends HTMLElement {
|
|
|
51
51
|
small: "xx-small",
|
|
52
52
|
medium: "x-small",
|
|
53
53
|
large: "small"
|
|
54
|
-
},
|
|
54
|
+
}, o = {
|
|
55
55
|
"x-small": "x-small",
|
|
56
56
|
small: "x-small",
|
|
57
57
|
medium: "small",
|
|
58
58
|
large: "small"
|
|
59
|
-
},
|
|
59
|
+
}, c = e[r] || "small", a = s[r] || "x-small", t = o[r] || "small", i = (
|
|
60
60
|
/*css*/
|
|
61
61
|
`
|
|
62
62
|
:host {
|
|
63
63
|
display: inline-flex;
|
|
64
64
|
box-sizing: border-box;
|
|
65
|
+
min-width: 0;
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
--chip-focus-outline: var(--stroke-size-300) var(--stroke-outset) var(--outline-color);
|
|
68
|
+
--chip-focus-outline-offset: calc(-1 * var(--stroke-size-300));
|
|
69
|
+
--chip-dismiss-action-size: var(--chip-height-medium);
|
|
65
70
|
}
|
|
66
71
|
:host([disabled]) {
|
|
67
72
|
opacity: 0.4;
|
|
@@ -78,12 +83,23 @@ class l extends HTMLElement {
|
|
|
78
83
|
background: var(--chip-background);
|
|
79
84
|
border-color: var(--chip-border-color);
|
|
80
85
|
border-radius: var(--chip-radius);
|
|
86
|
+
min-width: 0;
|
|
87
|
+
max-width: 100%;
|
|
81
88
|
filter: var(
|
|
82
89
|
--chip-filter,
|
|
83
90
|
drop-shadow(0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20))
|
|
84
91
|
);
|
|
85
92
|
}
|
|
86
93
|
|
|
94
|
+
mui-body {
|
|
95
|
+
min-width: 0;
|
|
96
|
+
max-width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
mui-body::part(color) {
|
|
100
|
+
color: var(--chip-text-color, var(--text-color));
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
:host([size="x-small"]) .container {
|
|
88
104
|
height: var(--chip-height-x-small);
|
|
89
105
|
padding: var(--chip-padding-x-small);
|
|
@@ -171,6 +187,11 @@ class l extends HTMLElement {
|
|
|
171
187
|
border-color: var(--chip-border-color-hover);
|
|
172
188
|
box-shadow: inset 0 0 0 1px var(--chip-border-color-hover);
|
|
173
189
|
}
|
|
190
|
+
|
|
191
|
+
:host([variant="clickable"]:hover) mui-body::part(color) {
|
|
192
|
+
color: var(--chip-text-color-hover, var(--chip-text-color, var(--text-color)));
|
|
193
|
+
}
|
|
194
|
+
|
|
174
195
|
:host([variant="ghost"]) .container {
|
|
175
196
|
background: var(--chip-ghost-background, transparent);
|
|
176
197
|
border-color: var(--chip-ghost-border-color, color-mix(in srgb, var(--border-color) 50%, transparent));
|
|
@@ -187,12 +208,19 @@ class l extends HTMLElement {
|
|
|
187
208
|
:host([variant="clickable"]:focus-visible) .container {
|
|
188
209
|
background: var(--chip-background-focus);
|
|
189
210
|
border-color: var(--chip-border-color-focus);
|
|
190
|
-
outline: var(--outline-thick);
|
|
211
|
+
outline: var(--chip-focus-outline, var(--outline-thick));
|
|
212
|
+
outline-offset: var(--chip-focus-outline-offset, 0px);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
:host([variant="clickable"]:focus-visible) mui-body::part(color) {
|
|
216
|
+
color: var(--chip-text-color-focus, var(--chip-text-color, var(--text-color)));
|
|
191
217
|
}
|
|
218
|
+
|
|
192
219
|
:host([variant="ghost"]:focus-visible) .container {
|
|
193
220
|
background: var(--chip-ghost-background-focus, color-mix(in srgb, var(--surface-elevated-100) 62%, transparent));
|
|
194
221
|
border-color: var(--chip-ghost-border-color-focus, color-mix(in srgb, var(--border-color) 80%, transparent));
|
|
195
|
-
outline: var(--outline-thick);
|
|
222
|
+
outline: var(--chip-focus-outline, var(--outline-thick));
|
|
223
|
+
outline-offset: var(--chip-focus-outline-offset, 0px);
|
|
196
224
|
}
|
|
197
225
|
|
|
198
226
|
/* Active: mouse down OR programmatic */
|
|
@@ -211,13 +239,14 @@ class l extends HTMLElement {
|
|
|
211
239
|
|
|
212
240
|
:host([variant="clickable"]:active) mui-body::part(color),
|
|
213
241
|
:host([variant="clickable"][active]) mui-body::part(color) {
|
|
214
|
-
color: var(--chip-text-color-active);
|
|
242
|
+
color: var(--chip-text-color-active, var(--chip-text-color, var(--text-color)));
|
|
215
243
|
}
|
|
216
244
|
|
|
217
245
|
::slotted(.mui-icon) {
|
|
218
246
|
box-sizing: border-box;
|
|
219
247
|
padding: var(--space-025);
|
|
220
248
|
fill: var(--chip-icon-fill);
|
|
249
|
+
flex-shrink: 0;
|
|
221
250
|
}
|
|
222
251
|
|
|
223
252
|
:host([has-before]) ::slotted(.mui-icon) {
|
|
@@ -258,9 +287,10 @@ class l extends HTMLElement {
|
|
|
258
287
|
|
|
259
288
|
/* Dismiss Icon */
|
|
260
289
|
mui-button::part(background) {
|
|
261
|
-
height:
|
|
262
|
-
width:
|
|
263
|
-
|
|
290
|
+
height: var(--chip-dismiss-action-size);
|
|
291
|
+
width: var(--chip-dismiss-action-size);
|
|
292
|
+
min-height: var(--chip-dismiss-action-size);
|
|
293
|
+
padding: var(--space-000);
|
|
264
294
|
border-radius: var(--radius-400);
|
|
265
295
|
background: var(--chip-dismiss-action-background);
|
|
266
296
|
filter: var(--chip-dismiss-action-filter, var(--chip-filter));
|
|
@@ -278,7 +308,7 @@ class l extends HTMLElement {
|
|
|
278
308
|
<style>${i}</style>
|
|
279
309
|
<span class="container">
|
|
280
310
|
<slot name="before"></slot>
|
|
281
|
-
<mui-body size="${
|
|
311
|
+
<mui-body size="${c}" weight="bold" truncate>
|
|
282
312
|
<slot></slot>
|
|
283
313
|
</mui-body>
|
|
284
314
|
<mui-button
|
|
@@ -288,11 +318,11 @@ class l extends HTMLElement {
|
|
|
288
318
|
aria-label="Remove chip"
|
|
289
319
|
${this.hasAttribute("disabled") ? "disabled" : ""}
|
|
290
320
|
>
|
|
291
|
-
<mui-icon-close size="${
|
|
321
|
+
<mui-icon-close size="${a}"></mui-icon-close>
|
|
292
322
|
</mui-button>
|
|
293
323
|
</span>
|
|
294
|
-
`, (
|
|
295
|
-
this.hasAttribute("disabled") || (
|
|
324
|
+
`, (n = this.shadowRoot.querySelector('[part="dismiss-btn"]')) == null || n.addEventListener("click", (l) => {
|
|
325
|
+
this.hasAttribute("disabled") || (l.stopPropagation(), this.dispatchEvent(
|
|
296
326
|
new CustomEvent("dismiss", {
|
|
297
327
|
bubbles: !0,
|
|
298
328
|
composed: !0,
|
|
@@ -304,7 +334,7 @@ class l extends HTMLElement {
|
|
|
304
334
|
<style>${i}</style>
|
|
305
335
|
<span class="container">
|
|
306
336
|
<slot name="before"></slot>
|
|
307
|
-
<mui-body size="${
|
|
337
|
+
<mui-body size="${c}" weight="bold" truncate>
|
|
308
338
|
<slot></slot>
|
|
309
339
|
</mui-body>
|
|
310
340
|
<slot name="after"></slot>
|
|
@@ -312,4 +342,4 @@ class l extends HTMLElement {
|
|
|
312
342
|
`);
|
|
313
343
|
}
|
|
314
344
|
}
|
|
315
|
-
customElements.get("mui-chip") || customElements.define("mui-chip",
|
|
345
|
+
customElements.get("mui-chip") || customElements.define("mui-chip", d);
|