@muibook/components 20.0.0 → 20.1.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/AGENTS.md +67 -0
- package/DESIGN.md +358 -0
- package/README.md +52 -1
- package/dist/esm/agent/keywords/index.js +2 -204
- package/dist/esm/agent/prompts/index.js +6 -434
- package/dist/esm/components/mui-accordion/core/index.js +25 -17
- package/dist/esm/components/mui-avatar/index.js +99 -42
- package/dist/esm/components/mui-avatar-chip/index.js +158 -0
- package/dist/esm/components/mui-avatar-group/index.js +88 -0
- package/dist/esm/components/mui-badge/index.js +2 -2
- package/dist/esm/components/mui-body/index.js +20 -11
- package/dist/esm/components/mui-button/index.js +117 -65
- package/dist/esm/components/mui-calendar/index.js +199 -0
- package/dist/esm/components/mui-card/body/index.js +32 -17
- package/dist/esm/components/mui-card/footer/index.js +11 -9
- package/dist/esm/components/mui-carousel/controller/index.js +1 -1
- package/dist/esm/components/mui-checkbox/index.js +23 -18
- package/dist/esm/components/mui-chip/index.js +184 -68
- package/dist/esm/components/mui-chip-input/index.js +146 -137
- package/dist/esm/components/mui-chip-rail/index.js +154 -51
- package/dist/esm/components/mui-code/index.js +27 -8
- package/dist/esm/components/mui-container/index.js +68 -45
- package/dist/esm/components/mui-date-picker/index.js +169 -0
- package/dist/esm/components/mui-drawer/index.js +968 -100
- package/dist/esm/components/mui-dropdown/index.js +250 -63
- package/dist/esm/components/mui-field/index.js +1 -1
- package/dist/esm/components/mui-file-upload/index.js +13 -4
- package/dist/esm/components/mui-form-group/index.js +1 -2
- package/dist/esm/components/mui-form-message/index.js +4 -9
- package/dist/esm/components/mui-hint/index.js +178 -72
- package/dist/esm/components/mui-icons/copy/index.js +54 -0
- package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
- package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
- package/dist/esm/components/mui-icons/index.js +14 -1
- package/dist/esm/components/mui-icons/moon/index.js +3 -1
- package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
- package/dist/esm/components/mui-icons/pause/index.js +5 -0
- package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
- package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
- package/dist/esm/components/mui-icons/reload/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/spinner/index.js +7 -5
- package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/sun/index.js +5 -5
- package/dist/esm/components/mui-icons/timer/index.js +54 -0
- package/dist/esm/components/mui-icons/toggle/index.js +16 -6
- package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
- package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
- package/dist/esm/components/mui-input/index.js +87 -62
- package/dist/esm/components/mui-link/index.js +195 -83
- package/dist/esm/components/mui-media-player/index.js +1577 -83
- package/dist/esm/components/mui-model-viewer/index.js +258 -0
- package/dist/esm/components/mui-progress-ring/index.js +349 -0
- package/dist/esm/components/mui-prompt/index.js +99 -71
- package/dist/esm/components/mui-prompt-preview/index.js +11 -23
- package/dist/esm/components/mui-radio/index.js +38 -17
- package/dist/esm/components/mui-range-input/index.js +9 -4
- package/dist/esm/components/mui-responsive/index.js +60 -27
- package/dist/esm/components/mui-search-input/index.js +300 -0
- package/dist/esm/components/mui-select/index.js +231 -42
- package/dist/esm/components/mui-slat/slat/index.js +40 -12
- package/dist/esm/components/mui-spinner/index.js +11 -9
- package/dist/esm/components/mui-switch/index.js +23 -20
- package/dist/esm/components/mui-table/row/index.js +2 -6
- package/dist/esm/components/mui-table/table/index.js +157 -14
- package/dist/esm/components/mui-textarea/index.js +43 -26
- package/dist/esm/components/mui-time/index/index.js +336 -0
- package/dist/esm/components/mui-time-picker/index.js +126 -0
- package/dist/esm/components/mui-video-thumbnail/index.js +5 -5
- package/dist/esm/css/mui-brand.css +12 -8
- package/dist/esm/css/mui-tokens.css +417 -305
- package/dist/esm/css/readme.md +2 -2
- package/dist/esm/custom-elements.json +3678 -1553
- package/dist/esm/dynamic-attrs.json +263 -66
- package/dist/esm/index.js +30 -6
- package/dist/esm/knowledge/compositions/index.js +1560 -0
- package/dist/esm/knowledge/index.js +28 -0
- package/dist/esm/knowledge/keywords/index.js +306 -0
- package/dist/esm/knowledge/rules/index.js +199 -0
- package/dist/esm/tokens/js/index.js +143 -139
- package/dist/types/agent/keywords/index.d.ts +1 -1
- package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
- package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
- package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
- package/dist/types/components/mui-button/api.d.ts +2 -2
- package/dist/types/components/mui-calendar/api.d.ts +41 -0
- package/dist/types/components/mui-calendar/doc.d.ts +2 -0
- package/dist/types/components/mui-calendar/index.d.ts +3 -0
- package/dist/types/components/mui-checkbox/api.d.ts +4 -0
- package/dist/types/components/mui-chip-input/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +1 -0
- package/dist/types/components/mui-date-picker/api.d.ts +38 -0
- package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-date-picker/index.d.ts +6 -0
- package/dist/types/components/mui-drawer/api.d.ts +4 -0
- package/dist/types/components/mui-drawer/index.d.ts +2 -0
- package/dist/types/components/mui-file-upload/api.d.ts +4 -0
- package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
- package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +14 -1
- package/dist/types/components/mui-icons/panel.d.ts +1 -0
- package/dist/types/components/mui-icons/pause.d.ts +1 -0
- package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
- package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
- package/dist/types/components/mui-icons/reload.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/timer.d.ts +1 -0
- package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
- package/dist/types/components/mui-input/api.d.ts +12 -0
- package/dist/types/components/mui-media-player/api.d.ts +4 -0
- package/dist/types/components/mui-media-player/index.d.ts +13 -4
- package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
- package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
- package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
- package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
- package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
- package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
- package/dist/types/components/mui-radio/api.d.ts +12 -0
- package/dist/types/components/mui-range-input/api.d.ts +4 -0
- package/dist/types/components/mui-responsive/api.d.ts +10 -2
- package/dist/types/components/mui-search-input/api.d.ts +40 -0
- package/dist/types/components/mui-search-input/doc.d.ts +2 -0
- package/dist/types/components/mui-search-input/index.d.ts +3 -0
- package/dist/types/components/mui-select/api.d.ts +12 -0
- package/dist/types/components/mui-switch/api.d.ts +4 -0
- package/dist/types/components/mui-table/api.d.ts +15 -0
- package/dist/types/components/mui-textarea/api.d.ts +12 -0
- package/dist/types/components/mui-time/api.d.ts +41 -0
- package/dist/types/components/mui-time/doc.d.ts +2 -0
- package/dist/types/components/mui-time/index.d.ts +1 -0
- package/dist/types/components/mui-time-picker/api.d.ts +38 -0
- package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-time-picker/index.d.ts +4 -0
- package/dist/types/index.d.ts +24 -2
- package/dist/types/knowledge/compositions.d.ts +4644 -0
- package/dist/types/knowledge/index.d.ts +4657 -0
- package/dist/types/knowledge/keywords.d.ts +4 -0
- package/dist/types/knowledge/rules.d.ts +1 -0
- package/dist/types/tokens/js/index.d.ts +11 -7
- package/package.json +119 -12
- package/dist/esm/components/mui-form-hint/index.js +0 -1
- package/dist/types/components/mui-form-hint/index.d.ts +0 -1
- /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
- /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { getPartMap as
|
|
2
|
-
class
|
|
1
|
+
import { getPartMap as f } from "../../utils/part-map/index.js";
|
|
2
|
+
class g extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return [
|
|
5
5
|
"onclick",
|
|
6
6
|
"type",
|
|
7
7
|
"aria-label",
|
|
8
8
|
"disabled",
|
|
9
|
+
"pending",
|
|
9
10
|
"variant",
|
|
10
11
|
"stroke",
|
|
11
12
|
"stroke-ring-size",
|
|
@@ -17,9 +18,14 @@ class f extends HTMLElement {
|
|
|
17
18
|
constructor() {
|
|
18
19
|
super(), this.attachShadow({ mode: "open" });
|
|
19
20
|
}
|
|
21
|
+
focus(t) {
|
|
22
|
+
var e;
|
|
23
|
+
const o = (e = this.shadowRoot) == null ? void 0 : e.querySelector("button");
|
|
24
|
+
o ? o.focus(t) : super.focus(t);
|
|
25
|
+
}
|
|
20
26
|
async connectedCallback() {
|
|
21
27
|
if (this.hasAttribute("size") || this.setAttribute("size", "medium"), this.syncRingSizeAttribute(), await this.waitForPartMap(), !this.shadowRoot) return;
|
|
22
|
-
let
|
|
28
|
+
let o = (
|
|
23
29
|
/*html*/
|
|
24
30
|
`
|
|
25
31
|
<style>
|
|
@@ -79,6 +85,14 @@ class f extends HTMLElement {
|
|
|
79
85
|
cursor: not-allowed;
|
|
80
86
|
}
|
|
81
87
|
|
|
88
|
+
:host([pending]) {
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host([pending]) button {
|
|
93
|
+
cursor: progress;
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
button, button:before, button:after {box-sizing: border-box;}
|
|
83
97
|
|
|
84
98
|
button:focus-visible {
|
|
@@ -560,8 +574,8 @@ class f extends HTMLElement {
|
|
|
560
574
|
:host([size="xx-small"]) button:hover,
|
|
561
575
|
:host([size="xx-small"]) button:focus,
|
|
562
576
|
:host([size="xx-small"]) button:disabled {
|
|
563
|
-
font-size: var(--font-size-
|
|
564
|
-
line-height: var(--line-height-
|
|
577
|
+
font-size: var(--text-font-size-xxs);
|
|
578
|
+
line-height: var(--text-line-height-xxs);
|
|
565
579
|
font-weight: var(--font-weight-semi-bold);
|
|
566
580
|
min-height: var(--action-size-xx-small);
|
|
567
581
|
padding: var(--space-025) var(--space-100);
|
|
@@ -766,8 +780,9 @@ class f extends HTMLElement {
|
|
|
766
780
|
min-width: 0;
|
|
767
781
|
min-height: 0;
|
|
768
782
|
padding: var(--space-000);
|
|
769
|
-
border: none;
|
|
783
|
+
border: var(--action-avatar-border, none);
|
|
770
784
|
background: transparent;
|
|
785
|
+
box-shadow: var(--action-avatar-shadow, none);
|
|
771
786
|
display: inline-flex;
|
|
772
787
|
align-items: center;
|
|
773
788
|
justify-content: center;
|
|
@@ -781,6 +796,34 @@ class f extends HTMLElement {
|
|
|
781
796
|
margin-left: var(--space-000);
|
|
782
797
|
}
|
|
783
798
|
|
|
799
|
+
:host([has-avatar-chip]) {
|
|
800
|
+
display: inline-flex;
|
|
801
|
+
width: auto;
|
|
802
|
+
text-align: left;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
:host([has-avatar-chip]) button {
|
|
806
|
+
display: inline-flex;
|
|
807
|
+
width: auto;
|
|
808
|
+
min-width: 0;
|
|
809
|
+
align-items: center;
|
|
810
|
+
justify-content: flex-start;
|
|
811
|
+
text-align: left;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
:host([has-avatar-chip][size="x-small"]) button {
|
|
815
|
+
padding-left: var(--space-100);
|
|
816
|
+
}
|
|
817
|
+
:host([has-avatar-chip][size="small"]) button {
|
|
818
|
+
padding-left: var(--space-200);
|
|
819
|
+
}
|
|
820
|
+
:host([has-avatar-chip][size="medium"]) button {
|
|
821
|
+
padding-left: var(--space-300);
|
|
822
|
+
}
|
|
823
|
+
:host([has-avatar-chip][size="large"]) button {
|
|
824
|
+
padding-left: var(--space-400);
|
|
825
|
+
}
|
|
826
|
+
|
|
784
827
|
:host([has-video]) {
|
|
785
828
|
display: inline-block;
|
|
786
829
|
width: auto;
|
|
@@ -818,10 +861,11 @@ class f extends HTMLElement {
|
|
|
818
861
|
</style>
|
|
819
862
|
|
|
820
863
|
<button
|
|
821
|
-
part="${
|
|
864
|
+
part="${f("text", "spacing", "layout", "visual")}"
|
|
822
865
|
onclick="${this.getAttribute("onclick")}"
|
|
823
866
|
type="${this.getAttribute("type") || "button"}"
|
|
824
867
|
aria-label="${this.getAttribute("aria-label") || ""}"
|
|
868
|
+
aria-busy="${this.hasAttribute("pending") ? "true" : "false"}"
|
|
825
869
|
${this.hasAttribute("disabled") ? "disabled" : ""}
|
|
826
870
|
>
|
|
827
871
|
<slot name="before"></slot>
|
|
@@ -831,116 +875,124 @@ class f extends HTMLElement {
|
|
|
831
875
|
|
|
832
876
|
`
|
|
833
877
|
);
|
|
834
|
-
this.shadowRoot.innerHTML =
|
|
878
|
+
this.shadowRoot.innerHTML = o;
|
|
879
|
+
const e = this.shadowRoot.querySelector("button");
|
|
880
|
+
e == null || e.addEventListener("click", (a) => {
|
|
881
|
+
this.hasAttribute("pending") && (a.preventDefault(), a.stopImmediatePropagation());
|
|
882
|
+
}), await customElements.whenDefined("mui-button"), [
|
|
835
883
|
this.shadowRoot.querySelector("slot:not([name])"),
|
|
836
884
|
this.shadowRoot.querySelector('slot[name="before"]'),
|
|
837
885
|
this.shadowRoot.querySelector('slot[name="after"]')
|
|
838
886
|
].forEach((a) => a == null ? void 0 : a.addEventListener("slotchange", () => this.syncButtonState())), requestAnimationFrame(() => this.syncButtonState());
|
|
839
887
|
}
|
|
840
|
-
attributeChangedCallback(
|
|
841
|
-
var a;
|
|
842
|
-
if (
|
|
843
|
-
const
|
|
844
|
-
|
|
888
|
+
attributeChangedCallback(t, o, e) {
|
|
889
|
+
var s, a;
|
|
890
|
+
if (t === "disabled") {
|
|
891
|
+
const i = (s = this.shadowRoot) == null ? void 0 : s.querySelector("button");
|
|
892
|
+
i && (this.hasAttribute("disabled") ? i.setAttribute("disabled", "") : i.removeAttribute("disabled"));
|
|
893
|
+
}
|
|
894
|
+
if (t === "pending") {
|
|
895
|
+
const i = (a = this.shadowRoot) == null ? void 0 : a.querySelector("button");
|
|
896
|
+
i && i.setAttribute("aria-busy", this.hasAttribute("pending") ? "true" : "false");
|
|
845
897
|
}
|
|
846
|
-
|
|
898
|
+
t === "size" && o !== e && this.shadowRoot && requestAnimationFrame(() => this.syncButtonState()), t === "stroke-ring-size" && o !== e && this.syncRingSizeAttribute();
|
|
847
899
|
}
|
|
848
900
|
syncRingSizeAttribute() {
|
|
849
|
-
var
|
|
850
|
-
const
|
|
851
|
-
if (!
|
|
901
|
+
var s;
|
|
902
|
+
const t = (s = this.getAttribute("stroke-ring-size")) == null ? void 0 : s.trim();
|
|
903
|
+
if (!t) {
|
|
852
904
|
this.style.removeProperty("--action-ring-size");
|
|
853
905
|
return;
|
|
854
906
|
}
|
|
855
|
-
const
|
|
856
|
-
this.style.setProperty("--action-ring-size",
|
|
907
|
+
const o = t.startsWith("stroke-size-") ? t.replace("stroke-size-", "") : t, e = /^(100|200|300|400|500)$/.test(o);
|
|
908
|
+
this.style.setProperty("--action-ring-size", e ? `var(--stroke-size-${o})` : t);
|
|
857
909
|
}
|
|
858
910
|
syncButtonState() {
|
|
859
|
-
const
|
|
860
|
-
if (!
|
|
861
|
-
const
|
|
911
|
+
const t = this.shadowRoot;
|
|
912
|
+
if (!t) return;
|
|
913
|
+
const o = t.querySelector("slot:not([name])"), e = t.querySelector('slot[name="before"]'), s = t.querySelector('slot[name="after"]'), a = (r) => r ? r.assignedNodes({ flatten: !0 }).some((n) => {
|
|
862
914
|
var c;
|
|
863
|
-
return
|
|
864
|
-
}) : !1,
|
|
865
|
-
this.toggleAttribute("has-before",
|
|
866
|
-
const d = (
|
|
867
|
-
this.toggleAttribute("has-video", b);
|
|
868
|
-
const v = !b && u.length === 1 && u[0].tagName.toLowerCase() === "mui-avatar" && d.every((r) => {
|
|
869
|
-
var
|
|
870
|
-
return r.nodeType === Node.TEXT_NODE ? !((
|
|
915
|
+
return n.nodeType === Node.ELEMENT_NODE || n.nodeType === Node.TEXT_NODE && !!((c = n.textContent) != null && c.trim());
|
|
916
|
+
}) : !1, i = a(e), l = a(s);
|
|
917
|
+
this.toggleAttribute("has-before", i), this.toggleAttribute("has-after", l);
|
|
918
|
+
const d = (o == null ? void 0 : o.assignedNodes({ flatten: !0 })) ?? [], u = (o == null ? void 0 : o.assignedElements({ flatten: !0 })) ?? [], b = u.some((r) => r.tagName.toLowerCase() === "mui-video-thumbnail"), h = u.some((r) => r.tagName.toLowerCase() === "mui-avatar-chip");
|
|
919
|
+
this.toggleAttribute("has-video", b), this.toggleAttribute("has-avatar-chip", h);
|
|
920
|
+
const v = !b && !h && u.length === 1 && u[0].tagName.toLowerCase() === "mui-avatar" && d.every((r) => {
|
|
921
|
+
var n;
|
|
922
|
+
return r.nodeType === Node.TEXT_NODE ? !((n = r.textContent) != null && n.trim()) : r.nodeType === Node.ELEMENT_NODE ? r.tagName.toLowerCase() === "mui-avatar" : !1;
|
|
871
923
|
});
|
|
872
|
-
if (this.toggleAttribute("avatar-only", v), !v && !b && d.every((r) => {
|
|
873
|
-
var
|
|
924
|
+
if (this.toggleAttribute("avatar-only", v), !v && !b && !h && d.every((r) => {
|
|
925
|
+
var n;
|
|
874
926
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
875
927
|
const c = r;
|
|
876
928
|
return c.tagName.toLowerCase() === "svg" || c.classList.contains("mui-icon");
|
|
877
929
|
}
|
|
878
|
-
return r.nodeType === Node.TEXT_NODE && !((
|
|
930
|
+
return r.nodeType === Node.TEXT_NODE && !((n = r.textContent) != null && n.trim());
|
|
879
931
|
})) {
|
|
880
932
|
this.setAttribute("icon-only", ""), this.updateIconSizes(d, !0);
|
|
881
933
|
return;
|
|
882
934
|
}
|
|
883
|
-
this.removeAttribute("icon-only"), [
|
|
935
|
+
this.removeAttribute("icon-only"), [e, o, s].forEach((r) => {
|
|
884
936
|
if (!r) return;
|
|
885
|
-
const
|
|
886
|
-
this.updateIconSizes(
|
|
937
|
+
const n = r.assignedNodes({ flatten: !0 });
|
|
938
|
+
this.updateIconSizes(n, !1), v || this.updateAvatarSizes(n), this.updateBadgeSizes(n);
|
|
887
939
|
});
|
|
888
940
|
}
|
|
889
941
|
// Update avatar sizes based on button size
|
|
890
|
-
updateAvatarSizes(
|
|
891
|
-
const
|
|
942
|
+
updateAvatarSizes(t) {
|
|
943
|
+
const o = this.getAttribute("size") || "medium", s = {
|
|
892
944
|
"xx-small": "xx-small",
|
|
893
945
|
"x-small": "xx-small",
|
|
894
946
|
small: "xx-small",
|
|
895
947
|
medium: "small",
|
|
896
948
|
large: "medium"
|
|
897
|
-
}[
|
|
898
|
-
|
|
899
|
-
if (
|
|
900
|
-
const
|
|
901
|
-
|
|
949
|
+
}[o] || "small";
|
|
950
|
+
t.forEach((a) => {
|
|
951
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
952
|
+
const i = a;
|
|
953
|
+
i.tagName.toLowerCase() === "mui-avatar" && i.setAttribute("size", s);
|
|
902
954
|
}
|
|
903
955
|
});
|
|
904
956
|
}
|
|
905
|
-
updateIconSizes(
|
|
906
|
-
const
|
|
957
|
+
updateIconSizes(t, o) {
|
|
958
|
+
const e = this.getAttribute("size") || "medium", a = {
|
|
907
959
|
"xx-small": "xx-small",
|
|
908
960
|
"x-small": "x-small",
|
|
909
961
|
small: "x-small",
|
|
910
|
-
medium:
|
|
962
|
+
medium: o ? "medium" : "small",
|
|
911
963
|
// small for regular, medium for icon-only
|
|
912
|
-
large:
|
|
913
|
-
}[
|
|
914
|
-
|
|
915
|
-
if (
|
|
916
|
-
const l =
|
|
917
|
-
(l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "mui-icon") && !l.hasAttribute("size") && l.setAttribute("size",
|
|
964
|
+
large: o ? "large" : "medium"
|
|
965
|
+
}[e] || "small";
|
|
966
|
+
t.forEach((i) => {
|
|
967
|
+
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
968
|
+
const l = i;
|
|
969
|
+
(l.tagName.toLowerCase() === "svg" || l.classList.contains("mui-icon") || l.tagName.toLowerCase() === "mui-icon") && !l.hasAttribute("size") && l.setAttribute("size", a);
|
|
918
970
|
}
|
|
919
971
|
});
|
|
920
972
|
}
|
|
921
|
-
updateBadgeSizes(
|
|
922
|
-
const
|
|
973
|
+
updateBadgeSizes(t) {
|
|
974
|
+
const o = this.getAttribute("size") || "medium", s = {
|
|
923
975
|
"xx-small": "x-small",
|
|
924
976
|
"x-small": "x-small",
|
|
925
977
|
small: "small",
|
|
926
978
|
medium: "medium",
|
|
927
979
|
large: "large"
|
|
928
|
-
}[
|
|
929
|
-
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
|
|
980
|
+
}[o] || "medium";
|
|
981
|
+
t.forEach((a) => {
|
|
982
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
983
|
+
const i = a;
|
|
984
|
+
i.tagName.toLowerCase() === "mui-badge" && i.setAttribute("size", s);
|
|
933
985
|
}
|
|
934
986
|
});
|
|
935
987
|
}
|
|
936
988
|
waitForPartMap() {
|
|
937
|
-
return new Promise((
|
|
938
|
-
if (typeof
|
|
939
|
-
const
|
|
940
|
-
typeof
|
|
989
|
+
return new Promise((t) => {
|
|
990
|
+
if (typeof f == "function") return t();
|
|
991
|
+
const o = () => {
|
|
992
|
+
typeof f == "function" ? t() : requestAnimationFrame(o);
|
|
941
993
|
};
|
|
942
|
-
|
|
994
|
+
o();
|
|
943
995
|
});
|
|
944
996
|
}
|
|
945
997
|
}
|
|
946
|
-
customElements.get("mui-button") || customElements.define("mui-button",
|
|
998
|
+
customElements.get("mui-button") || customElements.define("mui-button", g);
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import "../mui-button/index.js";
|
|
2
|
+
import "../mui-icons/left-chevron/index.js";
|
|
3
|
+
import "../mui-icons/right-chevron/index.js";
|
|
4
|
+
class z extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.selectedDate = null, this.viewMode = "single", this.attachShadow({ mode: "open" });
|
|
7
|
+
const t = /* @__PURE__ */ new Date();
|
|
8
|
+
this.currentDate = new Date(t.getFullYear(), t.getMonth(), 1);
|
|
9
|
+
}
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ["value", "view", "min-date", "max-date"];
|
|
12
|
+
}
|
|
13
|
+
get value() {
|
|
14
|
+
return this.getAttribute("value") || "";
|
|
15
|
+
}
|
|
16
|
+
set value(t) {
|
|
17
|
+
this.setAttribute("value", t ?? "");
|
|
18
|
+
}
|
|
19
|
+
focus(t) {
|
|
20
|
+
var i;
|
|
21
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".selected, .today, .day:not(.empty)");
|
|
22
|
+
e && typeof e.focus == "function" ? e.focus(t) : super.focus(t);
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
this.syncAttributes(), this.render();
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(t, e, i) {
|
|
28
|
+
e !== i && (this.syncAttributes(), this.render());
|
|
29
|
+
}
|
|
30
|
+
syncAttributes() {
|
|
31
|
+
const t = this.getAttribute("value");
|
|
32
|
+
if (t) {
|
|
33
|
+
const e = new Date(t);
|
|
34
|
+
isNaN(e.getTime()) || (this.selectedDate = e, this.hasAttribute("data-initialized") || (this.currentDate = new Date(e.getFullYear(), e.getMonth(), 1), this.setAttribute("data-initialized", "true")));
|
|
35
|
+
}
|
|
36
|
+
this.viewMode = this.getAttribute("view") === "double" ? "double" : "single";
|
|
37
|
+
}
|
|
38
|
+
changeMonth(t) {
|
|
39
|
+
this.currentDate.setMonth(this.currentDate.getMonth() + t), this.render();
|
|
40
|
+
}
|
|
41
|
+
selectDate(t) {
|
|
42
|
+
this.selectedDate = t;
|
|
43
|
+
const e = t.getFullYear(), i = String(t.getMonth() + 1).padStart(2, "0"), h = String(t.getDate()).padStart(2, "0"), o = `${e}-${i}-${h}`;
|
|
44
|
+
this.setAttribute("value", o), this.dispatchEvent(new CustomEvent("change", { detail: { value: o }, bubbles: !0, composed: !0 }));
|
|
45
|
+
}
|
|
46
|
+
renderMonth(t, e) {
|
|
47
|
+
var d, u, g;
|
|
48
|
+
const i = new Date(t, e + 1, 0).getDate(), h = new Date(t, e, 1).getDay(), o = new Intl.DateTimeFormat("en-US", { month: "long" }).format(new Date(t, e, 1)), p = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
49
|
+
let c = "";
|
|
50
|
+
for (let n = 0; n < h; n++)
|
|
51
|
+
c += '<div class="day empty"></div>';
|
|
52
|
+
const r = /* @__PURE__ */ new Date(), m = r.getFullYear() === t && r.getMonth() === e, s = ((d = this.selectedDate) == null ? void 0 : d.getFullYear()) === t && ((u = this.selectedDate) == null ? void 0 : u.getMonth()) === e;
|
|
53
|
+
for (let n = 1; n <= i; n++) {
|
|
54
|
+
const a = m && r.getDate() === n, v = s && ((g = this.selectedDate) == null ? void 0 : g.getDate()) === n, y = `${t}-${String(e + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`, l = ["day"];
|
|
55
|
+
v && l.push("selected"), a && l.push("today"), c += `<mui-button variant="${v ? "primary" : "tertiary"}" size="small" class="${l.join(" ")}" data-date="${y}" aria-label="${o} ${n}, ${t}">${n}</mui-button>`;
|
|
56
|
+
}
|
|
57
|
+
return (
|
|
58
|
+
/*html*/
|
|
59
|
+
`
|
|
60
|
+
<div class="month">
|
|
61
|
+
<div class="month-header">
|
|
62
|
+
<div class="month-title">${o} ${t}</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="grid">
|
|
65
|
+
${p.map((n) => `<div class="weekday">${n}</div>`).join("")}
|
|
66
|
+
${c}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
var h, o, p;
|
|
74
|
+
if (!this.shadowRoot) return;
|
|
75
|
+
const t = this.currentDate.getFullYear(), e = this.currentDate.getMonth(), i = (
|
|
76
|
+
/*html*/
|
|
77
|
+
`
|
|
78
|
+
<style>
|
|
79
|
+
:host {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
font-family: inherit;
|
|
82
|
+
--calendar-width: 28rem;
|
|
83
|
+
--calendar-day-size: 3.6rem;
|
|
84
|
+
}
|
|
85
|
+
.calendar-container {
|
|
86
|
+
position: relative;
|
|
87
|
+
display: flex;
|
|
88
|
+
gap: var(--space-400);
|
|
89
|
+
padding: var(--space-200);
|
|
90
|
+
}
|
|
91
|
+
.controls {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: var(--space-200);
|
|
94
|
+
left: var(--space-200);
|
|
95
|
+
right: var(--space-200);
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
}
|
|
100
|
+
.controls mui-button {
|
|
101
|
+
pointer-events: auto;
|
|
102
|
+
}
|
|
103
|
+
.month {
|
|
104
|
+
width: var(--calendar-width);
|
|
105
|
+
}
|
|
106
|
+
.month-header {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
height: 3.6rem;
|
|
111
|
+
margin-bottom: var(--space-200);
|
|
112
|
+
}
|
|
113
|
+
.month-title {
|
|
114
|
+
font-weight: var(--font-weight-medium);
|
|
115
|
+
font-size: var(--text-font-size-s);
|
|
116
|
+
color: var(--text-color);
|
|
117
|
+
}
|
|
118
|
+
.grid {
|
|
119
|
+
display: grid;
|
|
120
|
+
grid-template-columns: repeat(7, 1fr);
|
|
121
|
+
gap: var(--space-050);
|
|
122
|
+
justify-items: center;
|
|
123
|
+
}
|
|
124
|
+
.weekday {
|
|
125
|
+
font-size: var(--text-font-size-xs);
|
|
126
|
+
color: var(--text-color-secondary);
|
|
127
|
+
font-weight: var(--font-weight-medium);
|
|
128
|
+
width: var(--calendar-day-size);
|
|
129
|
+
height: var(--calendar-day-size);
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
}
|
|
134
|
+
.day {
|
|
135
|
+
width: var(--calendar-day-size);
|
|
136
|
+
height: var(--calendar-day-size);
|
|
137
|
+
--action-size-small: var(--calendar-day-size);
|
|
138
|
+
--action-padding-small: 0;
|
|
139
|
+
}
|
|
140
|
+
:host([slotted]) .day {
|
|
141
|
+
--action-radius-small: var(--stroke-size-200);
|
|
142
|
+
}
|
|
143
|
+
.day.today {
|
|
144
|
+
--action-tertiary-text-color: var(--action-primary-background);
|
|
145
|
+
}
|
|
146
|
+
.day.empty {
|
|
147
|
+
cursor: default;
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
150
|
+
<div class="calendar-container">
|
|
151
|
+
<div class="controls">
|
|
152
|
+
<mui-button variant="tertiary" size="small" id="prev-btn" aria-label="Previous Month">
|
|
153
|
+
<mui-icon-left-chevron></mui-icon-left-chevron>
|
|
154
|
+
</mui-button>
|
|
155
|
+
<mui-button variant="tertiary" size="small" id="next-btn" aria-label="Next Month">
|
|
156
|
+
<mui-icon-right-chevron></mui-icon-right-chevron>
|
|
157
|
+
</mui-button>
|
|
158
|
+
</div>
|
|
159
|
+
${this.renderMonth(t, e)}
|
|
160
|
+
${this.viewMode === "double" ? this.renderMonth(t, e + 1) : ""}
|
|
161
|
+
</div>
|
|
162
|
+
`
|
|
163
|
+
);
|
|
164
|
+
this.shadowRoot.innerHTML = i, (h = this.shadowRoot.getElementById("prev-btn")) == null || h.addEventListener("click", () => this.changeMonth(-1)), (o = this.shadowRoot.getElementById("next-btn")) == null || o.addEventListener("click", () => this.changeMonth(1)), this.shadowRoot.querySelectorAll(".day:not(.empty)").forEach((c) => {
|
|
165
|
+
c.addEventListener("click", (r) => {
|
|
166
|
+
const s = r.target.getAttribute("data-date");
|
|
167
|
+
if (s) {
|
|
168
|
+
const [d, u, g] = s.split("-").map(Number);
|
|
169
|
+
this.selectDate(new Date(d, u - 1, g));
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}), (p = this.shadowRoot.querySelector(".calendar-container")) == null || p.addEventListener("keydown", (c) => {
|
|
173
|
+
const r = c.target;
|
|
174
|
+
if (!r.classList.contains("day") || r.classList.contains("empty")) return;
|
|
175
|
+
const m = c, s = m.key;
|
|
176
|
+
if (["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(s)) {
|
|
177
|
+
m.preventDefault();
|
|
178
|
+
const d = r.getAttribute("data-date");
|
|
179
|
+
if (!d) return;
|
|
180
|
+
const [u, g, n] = d.split("-").map(Number), a = new Date(u, g - 1, n);
|
|
181
|
+
s === "ArrowLeft" && a.setDate(a.getDate() - 1), s === "ArrowRight" && a.setDate(a.getDate() + 1), s === "ArrowUp" && a.setDate(a.getDate() - 7), s === "ArrowDown" && a.setDate(a.getDate() + 7);
|
|
182
|
+
const v = () => {
|
|
183
|
+
var S;
|
|
184
|
+
const D = a.getFullYear(), $ = String(a.getMonth() + 1).padStart(2, "0"), A = String(a.getDate()).padStart(2, "0"), x = `${D}-${$}-${A}`, M = (S = this.shadowRoot) == null ? void 0 : S.querySelector(`.day[data-date="${x}"]`);
|
|
185
|
+
M == null || M.focus();
|
|
186
|
+
}, y = this.currentDate.getMonth(), l = this.currentDate.getFullYear(), f = a.getMonth(), w = a.getFullYear();
|
|
187
|
+
let b = !1;
|
|
188
|
+
if (this.viewMode === "single")
|
|
189
|
+
b = y === f && l === w;
|
|
190
|
+
else {
|
|
191
|
+
const D = new Date(l, y + 1, 1);
|
|
192
|
+
b = y === f && l === w || D.getMonth() === f && D.getFullYear() === w;
|
|
193
|
+
}
|
|
194
|
+
b ? v() : (this.currentDate = new Date(w, f, 1), this.render(), setTimeout(v, 0));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
customElements.get("mui-calendar") || customElements.define("mui-calendar", z);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class m extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["condensed"];
|
|
4
4
|
}
|
|
@@ -8,7 +8,7 @@ class l extends HTMLElement {
|
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
this.render();
|
|
10
10
|
}
|
|
11
|
-
attributeChangedCallback(s,
|
|
11
|
+
attributeChangedCallback(s, l, a) {
|
|
12
12
|
s === "condensed" && this.updateSlottedContent();
|
|
13
13
|
}
|
|
14
14
|
updateSlottedContent() {
|
|
@@ -16,28 +16,43 @@ class l extends HTMLElement {
|
|
|
16
16
|
if (!this.shadowRoot) return;
|
|
17
17
|
const s = this.shadowRoot.querySelector("slot");
|
|
18
18
|
if (!s) return;
|
|
19
|
-
const
|
|
19
|
+
const l = s.assignedNodes({ flatten: !0 });
|
|
20
20
|
this.removeAttribute("inner-space"), this.removeAttribute("has-card-slat-group"), this.removeAttribute("has-accordion-slat-group");
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
let a = !1;
|
|
22
|
+
const u = [];
|
|
23
|
+
if (l.forEach((r) => {
|
|
24
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
25
|
+
const t = r, c = t.tagName.toLowerCase() === "mui-accordion-group" ? t : t.querySelector("mui-accordion-group");
|
|
26
|
+
c instanceof HTMLElement && (c.querySelectorAll("mui-accordion-block").forEach((o) => {
|
|
26
27
|
o.setAttribute("card-slot", "");
|
|
27
|
-
}),
|
|
28
|
+
}), a = !0), (t.tagName.toLowerCase() === "mui-slat" ? [t] : Array.from(t.querySelectorAll("mui-slat"))).forEach((e) => {
|
|
28
29
|
const o = e.getAttribute("variant");
|
|
29
|
-
(o === "action" || o === "row") && (e.setAttribute("card-slot", ""), this.hasAttribute("condensed") ? e.setAttribute("condensed-slot", "") : e.removeAttribute("condensed-slot"));
|
|
30
|
+
(o === "action" || o === "row") && (e.setAttribute("card-slot", ""), e.removeAttribute("condensed-slot-first"), e.removeAttribute("condensed-slot-last"), this.hasAttribute("condensed") ? (e.setAttribute("condensed-slot", ""), u.push(e)) : e.removeAttribute("condensed-slot"));
|
|
30
31
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const d = t.tagName.toLowerCase() === "mui-table" ? t : t.querySelector("mui-table");
|
|
33
|
+
d instanceof HTMLElement && (d.setAttribute("card-slot", ""), d.querySelectorAll("mui-cell").forEach((o) => {
|
|
33
34
|
o.setAttribute("card-slot", "");
|
|
34
|
-
}),
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
}), a = !0), (t.tagName.toLowerCase() === "mui-avatar-group" ? [t] : Array.from(t.querySelectorAll("mui-avatar-group"))).forEach((e) => {
|
|
36
|
+
e.setAttribute("card-slot", "");
|
|
37
|
+
}), (t.tagName.toLowerCase() === "mui-chip-rail" ? [t] : Array.from(t.querySelectorAll("mui-chip-rail"))).forEach((e) => {
|
|
38
|
+
e.setAttribute("card-slot", "");
|
|
39
|
+
}), (t.tagName.toLowerCase() === "mui-code" ? [t] : Array.from(t.querySelectorAll("mui-code"))).forEach((e) => {
|
|
40
|
+
e.setAttribute("card-slot", "");
|
|
41
|
+
});
|
|
42
|
+
const h = t.tagName.toLowerCase() === "mui-slat-group" ? [t] : Array.from(t.querySelectorAll("mui-slat-group"));
|
|
43
|
+
h.length && (a = !0, h.forEach((e) => {
|
|
37
44
|
e.setAttribute("usage", "card"), e.closest("mui-accordion-block") ? this.setAttribute("has-accordion-slat-group", "") : (this.setAttribute("inner-space", ""), this.setAttribute("has-card-slat-group", ""));
|
|
38
45
|
}));
|
|
39
46
|
}
|
|
40
|
-
}),
|
|
47
|
+
}), u.length) {
|
|
48
|
+
const r = l.flatMap((c) => {
|
|
49
|
+
if (c.nodeType !== Node.ELEMENT_NODE) return [];
|
|
50
|
+
const n = c;
|
|
51
|
+
return n.tagName.toLowerCase() === "mui-slat" ? [n] : Array.from(n.querySelectorAll("mui-slat"));
|
|
52
|
+
}), t = r[0], i = r[r.length - 1];
|
|
53
|
+
t != null && t.hasAttribute("condensed-slot") && t.setAttribute("condensed-slot-first", ""), i != null && i.hasAttribute("condensed-slot") && i.setAttribute("condensed-slot-last", "");
|
|
54
|
+
}
|
|
55
|
+
!a && !this.hasAttribute("condensed") && this.setAttribute("inner-space", "");
|
|
41
56
|
});
|
|
42
57
|
}
|
|
43
58
|
render() {
|
|
@@ -83,4 +98,4 @@ class l extends HTMLElement {
|
|
|
83
98
|
this.shadowRoot.innerHTML = s, this.updateSlottedContent();
|
|
84
99
|
}
|
|
85
100
|
}
|
|
86
|
-
customElements.get("mui-card-body") || customElements.define("mui-card-body",
|
|
101
|
+
customElements.get("mui-card-body") || customElements.define("mui-card-body", m);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class l extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" });
|
|
4
4
|
}
|
|
@@ -46,23 +46,25 @@ class c extends HTMLElement {
|
|
|
46
46
|
if (!this.shadowRoot) return;
|
|
47
47
|
const s = this.shadowRoot.querySelector("slot");
|
|
48
48
|
if (!s) return;
|
|
49
|
-
const
|
|
49
|
+
const i = s.assignedNodes({ flatten: !0 }).filter((e) => {
|
|
50
50
|
var o;
|
|
51
51
|
return e.nodeType === Node.ELEMENT_NODE || e.nodeType === Node.TEXT_NODE && ((o = e.textContent) == null ? void 0 : o.trim()) !== "";
|
|
52
52
|
});
|
|
53
|
-
if (
|
|
53
|
+
if (i.length === 0) {
|
|
54
54
|
this.setAttribute("hidden", "");
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
let
|
|
58
|
-
|
|
57
|
+
let a = !1, d = !1;
|
|
58
|
+
i.forEach((e) => {
|
|
59
59
|
var o, n;
|
|
60
60
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
61
|
-
const t = e,
|
|
62
|
-
(
|
|
61
|
+
const t = e, r = t.tagName.toLowerCase();
|
|
62
|
+
(r === "mui-code" || (o = t.querySelector) != null && o.call(t, "mui-code")) && (a = !0, (r === "mui-code" ? [t] : Array.from(t.querySelectorAll("mui-code"))).forEach((c) => {
|
|
63
|
+
c.setAttribute("card-slot", "");
|
|
64
|
+
})), (r === "mui-button-group" || (n = t.querySelector) != null && n.call(t, "mui-button-group")) && (d = !0);
|
|
63
65
|
}
|
|
64
|
-
}),
|
|
66
|
+
}), a || this.setAttribute("inner-space", ""), d && this.setAttribute("has-button-group", "");
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
customElements.get("mui-card-footer") || customElements.define("mui-card-footer",
|
|
70
|
+
customElements.get("mui-card-footer") || customElements.define("mui-card-footer", l);
|