@moni-labs/moni-ui 0.4.3 → 0.4.4
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 +6 -6
- package/custom-elements.json +53 -8
- package/dist/browser/moni-ui.iife.min.js +99 -6
- package/dist/browser/moni-ui.iife.min.js.br +0 -0
- package/dist/browser/moni-ui.iife.min.js.gz +0 -0
- package/dist/browser/moni-ui.iife.min.js.map +1 -1
- package/dist/browser/moni-ui.min.js +133 -30
- package/dist/browser/moni-ui.min.js.br +0 -0
- package/dist/browser/moni-ui.min.js.gz +0 -0
- package/dist/browser/moni-ui.min.js.map +1 -1
- package/dist/cdn/components/moni-button-group.js +72 -3
- package/dist/cdn/components/moni-button.js +1 -0
- package/dist/cdn/components/moni-loading-indicator.js +21 -2
- package/dist/cdn/components/moni-time-picker.js +5 -1
- package/dist/cdn/importmap.json +98 -98
- package/dist/components/moni-button-group.d.ts +14 -0
- package/dist/components/moni-button-group.d.ts.map +1 -1
- package/dist/components/moni-button-group.js +130 -25
- package/dist/components/moni-button.d.ts.map +1 -1
- package/dist/components/moni-button.js +1 -0
- package/dist/components/moni-loading-indicator.d.ts.map +1 -1
- package/dist/components/moni-loading-indicator.js +21 -2
- package/dist/components/moni-time-picker.d.ts.map +1 -1
- package/dist/components/moni-time-picker.js +5 -1
- package/package.json +1 -1
- package/src/components/moni-button-group.test.ts +76 -0
- package/src/components/moni-button-group.ts +130 -34
- package/src/components/moni-button.ts +1 -0
- package/src/components/moni-loading-indicator.test.ts +9 -0
- package/src/components/moni-loading-indicator.ts +21 -2
- package/src/components/moni-time-picker.ts +5 -1
|
@@ -2495,6 +2495,7 @@ var Ze, Qe = class extends W {
|
|
|
2495
2495
|
.button {
|
|
2496
2496
|
box-sizing: var(--moni-button-box-sizing, border-box);
|
|
2497
2497
|
display: inline-flex;
|
|
2498
|
+
inline-size: var(--moni-button-inline-size, auto);
|
|
2498
2499
|
--_button-visual-height: 3.5rem;
|
|
2499
2500
|
align-items: center;
|
|
2500
2501
|
justify-content: center;
|
|
@@ -10832,17 +10833,19 @@ var Ft = class extends W {
|
|
|
10832
10833
|
}
|
|
10833
10834
|
|
|
10834
10835
|
:host([orientation="horizontal"]) {
|
|
10835
|
-
inline-size:
|
|
10836
|
+
inline-size: min(40rem, 100%);
|
|
10836
10837
|
}
|
|
10837
10838
|
:host([orientation="horizontal"]) .main-content {
|
|
10838
10839
|
flex-direction: row;
|
|
10839
10840
|
align-items: center;
|
|
10841
|
+
justify-content: center;
|
|
10840
10842
|
gap: 2rem;
|
|
10841
10843
|
}
|
|
10842
10844
|
:host([orientation="horizontal"]) .left-pane {
|
|
10843
10845
|
display: flex;
|
|
10844
10846
|
flex-direction: column;
|
|
10845
10847
|
justify-content: center;
|
|
10848
|
+
flex: none;
|
|
10846
10849
|
}
|
|
10847
10850
|
|
|
10848
10851
|
/* Main Content (Default vertical) */
|
|
@@ -10872,6 +10875,7 @@ var Ft = class extends W {
|
|
|
10872
10875
|
:host(:not([orientation])) .main-content {
|
|
10873
10876
|
flex-direction: row;
|
|
10874
10877
|
align-items: center;
|
|
10878
|
+
justify-content: center;
|
|
10875
10879
|
gap: 2rem;
|
|
10876
10880
|
}
|
|
10877
10881
|
:host([orientation='auto']) .left-pane,
|
|
@@ -10879,6 +10883,7 @@ var Ft = class extends W {
|
|
|
10879
10883
|
display: flex;
|
|
10880
10884
|
flex-direction: column;
|
|
10881
10885
|
justify-content: center;
|
|
10886
|
+
flex: none;
|
|
10882
10887
|
}
|
|
10883
10888
|
}
|
|
10884
10889
|
|
|
@@ -11973,7 +11978,17 @@ K([V({ reflect: !0 })], Lt.prototype, "text", void 0), K([V({ reflect: !0 })], L
|
|
|
11973
11978
|
//#region src/components/moni-button-group.ts
|
|
11974
11979
|
var Rt = class extends W {
|
|
11975
11980
|
constructor(...e) {
|
|
11976
|
-
super(...e), this.variant = "standard", this.size = "small", this.multi = !1, this.gap = "", this.role = "group", this.label = "", this.labelledBy = "";
|
|
11981
|
+
super(...e), this._activeObserver = new MutationObserver(() => this.updateSelectionNeighbors()), this.variant = "standard", this.size = "small", this.multi = !1, this.selectionRequired = !1, this.shape = "round", this.resizing = "fixed", this.gap = "", this.role = "group", this.label = "", this.labelledBy = "";
|
|
11982
|
+
}
|
|
11983
|
+
connectedCallback() {
|
|
11984
|
+
super.connectedCallback(), this._activeObserver.observe(this, {
|
|
11985
|
+
subtree: !0,
|
|
11986
|
+
attributes: !0,
|
|
11987
|
+
attributeFilter: ["active"]
|
|
11988
|
+
});
|
|
11989
|
+
}
|
|
11990
|
+
disconnectedCallback() {
|
|
11991
|
+
this._activeObserver.disconnect(), super.disconnectedCallback();
|
|
11977
11992
|
}
|
|
11978
11993
|
static {
|
|
11979
11994
|
this.styles = [G, h`
|
|
@@ -11981,12 +11996,18 @@ var Rt = class extends W {
|
|
|
11981
11996
|
display: inline-flex;
|
|
11982
11997
|
align-items: center;
|
|
11983
11998
|
vertical-align: middle;
|
|
11999
|
+
max-inline-size: 100%;
|
|
12000
|
+
}
|
|
12001
|
+
:host([variant='connected']),
|
|
12002
|
+
:host([resizing='flexible']) {
|
|
12003
|
+
inline-size: 100%;
|
|
11984
12004
|
}
|
|
11985
12005
|
|
|
11986
12006
|
.group-container {
|
|
11987
12007
|
display: inline-flex;
|
|
11988
12008
|
align-items: center;
|
|
11989
12009
|
width: 100%;
|
|
12010
|
+
flex-wrap: nowrap;
|
|
11990
12011
|
}
|
|
11991
12012
|
|
|
11992
12013
|
slot {
|
|
@@ -12016,71 +12037,130 @@ var Rt = class extends W {
|
|
|
12016
12037
|
:host([variant='connected']) .group-container {
|
|
12017
12038
|
gap: 0.125rem; /* 2dp */
|
|
12018
12039
|
}
|
|
12040
|
+
:host([variant='connected']) ::slotted(moni-button),
|
|
12041
|
+
:host([variant='connected']) ::slotted(moni-icon-button),
|
|
12042
|
+
:host([resizing='flexible']) ::slotted(moni-button) {
|
|
12043
|
+
flex: 1 1 0;
|
|
12044
|
+
}
|
|
12045
|
+
:host([variant='connected']) ::slotted(moni-button) {
|
|
12046
|
+
--moni-button-inline-size: 100%;
|
|
12047
|
+
min-inline-size: 0;
|
|
12048
|
+
}
|
|
12049
|
+
:host([variant='connected'][size='xsmall']) ::slotted(moni-button),
|
|
12050
|
+
:host([variant='connected'][size='xsmall']) ::slotted(moni-icon-button),
|
|
12051
|
+
:host([variant='connected'][size='small']) ::slotted(moni-button),
|
|
12052
|
+
:host([variant='connected'][size='small']) ::slotted(moni-icon-button) {
|
|
12053
|
+
min-inline-size: 3rem;
|
|
12054
|
+
}
|
|
12055
|
+
|
|
12056
|
+
/* M3 Expressive selection emphasis. Increasing the button's internal
|
|
12057
|
+
* space (instead of scaling the host) keeps labels and icons crisp and
|
|
12058
|
+
* lets the existing padding transition transfer width smoothly. */
|
|
12059
|
+
:host([variant='standard'][size='xsmall']) ::slotted(moni-button[active]),
|
|
12060
|
+
:host([variant='standard'][size='xsmall']) ::slotted(moni-button[data-group-pressed]) {
|
|
12061
|
+
--moni-button-padding: 0 1.25rem;
|
|
12062
|
+
}
|
|
12063
|
+
:host([variant='standard'][size='small']) ::slotted(moni-button[active]),
|
|
12064
|
+
:host([variant='standard'][size='small']) ::slotted(moni-button[data-group-pressed]) {
|
|
12065
|
+
--moni-button-padding: 0 1.75rem;
|
|
12066
|
+
}
|
|
12067
|
+
:host([variant='standard'][size='medium']) ::slotted(moni-button[active]),
|
|
12068
|
+
:host([variant='standard'][size='medium']) ::slotted(moni-button[data-group-pressed]) {
|
|
12069
|
+
--moni-button-padding: 0 2.375rem;
|
|
12070
|
+
}
|
|
12071
|
+
:host([variant='standard'][size='large']) ::slotted(moni-button[active]),
|
|
12072
|
+
:host([variant='standard'][size='large']) ::slotted(moni-button[data-group-pressed]) {
|
|
12073
|
+
--moni-button-padding: 0 4rem;
|
|
12074
|
+
}
|
|
12075
|
+
:host([variant='standard'][size='xlarge']) ::slotted(moni-button[active]),
|
|
12076
|
+
:host([variant='standard'][size='extra']) ::slotted(moni-button[active]),
|
|
12077
|
+
:host([variant='standard'][size='xlarge']) ::slotted(moni-button[data-group-pressed]),
|
|
12078
|
+
:host([variant='standard'][size='extra']) ::slotted(moni-button[data-group-pressed]) {
|
|
12079
|
+
--moni-button-padding: 0 5.25rem;
|
|
12080
|
+
}
|
|
12081
|
+
|
|
12082
|
+
:host([variant='standard'][size='xsmall']) ::slotted(moni-button[data-group-adjacent-pressed]) { --moni-button-padding: 0 .5rem; }
|
|
12083
|
+
:host([variant='standard'][size='small']) ::slotted(moni-button[data-group-adjacent-pressed]) { --moni-button-padding: 0 .75rem; }
|
|
12084
|
+
:host([variant='standard'][size='medium']) ::slotted(moni-button[data-group-adjacent-pressed]) { --moni-button-padding: 0 1.25rem; }
|
|
12085
|
+
:host([variant='standard'][size='large']) ::slotted(moni-button[data-group-adjacent-pressed]) { --moni-button-padding: 0 2.75rem; }
|
|
12086
|
+
:host([variant='standard'][size='xlarge']) ::slotted(moni-button[data-group-adjacent-pressed]),
|
|
12087
|
+
:host([variant='standard'][size='extra']) ::slotted(moni-button[data-group-adjacent-pressed]) { --moni-button-padding: 0 3.75rem; }
|
|
12088
|
+
|
|
12089
|
+
/* A selected standard button borrows space from its immediate
|
|
12090
|
+
* neighbours, keeping the group's outside footprint stable. */
|
|
12091
|
+
:host([variant='standard'][size='xsmall']) ::slotted(moni-button[data-group-adjacent-selected='shared']) { --moni-button-padding: 0 .5rem; }
|
|
12092
|
+
:host([variant='standard'][size='xsmall']) ::slotted(moni-button[data-group-adjacent-selected='sole']) { --moni-button-padding: 0 .25rem; }
|
|
12093
|
+
:host([variant='standard'][size='small']) ::slotted(moni-button[data-group-adjacent-selected='shared']) { --moni-button-padding: 0 .625rem; }
|
|
12094
|
+
:host([variant='standard'][size='small']) ::slotted(moni-button[data-group-adjacent-selected='sole']) { --moni-button-padding: 0 .25rem; }
|
|
12095
|
+
:host([variant='standard'][size='medium']) ::slotted(moni-button[data-group-adjacent-selected='shared']) { --moni-button-padding: 0 1.0625rem; }
|
|
12096
|
+
:host([variant='standard'][size='medium']) ::slotted(moni-button[data-group-adjacent-selected='sole']) { --moni-button-padding: 0 .625rem; }
|
|
12097
|
+
:host([variant='standard'][size='large']) ::slotted(moni-button[data-group-adjacent-selected='shared']) { --moni-button-padding: 0 2.5rem; }
|
|
12098
|
+
:host([variant='standard'][size='large']) ::slotted(moni-button[data-group-adjacent-selected='sole']) { --moni-button-padding: 0 2rem; }
|
|
12099
|
+
:host([variant='standard'][size='xlarge']) ::slotted(moni-button[data-group-adjacent-selected='shared']),
|
|
12100
|
+
:host([variant='standard'][size='extra']) ::slotted(moni-button[data-group-adjacent-selected='shared']) { --moni-button-padding: 0 3.375rem; }
|
|
12101
|
+
:host([variant='standard'][size='xlarge']) ::slotted(moni-button[data-group-adjacent-selected='sole']),
|
|
12102
|
+
:host([variant='standard'][size='extra']) ::slotted(moni-button[data-group-adjacent-selected='sole']) { --moni-button-padding: 0 2.75rem; }
|
|
12019
12103
|
`];
|
|
12020
12104
|
}
|
|
12021
12105
|
updated(e) {
|
|
12022
|
-
super.updated(e), (e.has("variant") || e.has("size") || e.has("gap")) && this.updateChildren();
|
|
12106
|
+
super.updated(e), (e.has("variant") || e.has("size") || e.has("gap") || e.has("shape")) && this.updateChildren();
|
|
12023
12107
|
}
|
|
12024
12108
|
handleSlotChange() {
|
|
12025
12109
|
this.updateChildren();
|
|
12026
12110
|
}
|
|
12111
|
+
getButtons() {
|
|
12112
|
+
return (this.slottedButtons ?? []).filter((e) => e.tagName.toLowerCase() === "moni-button" || e.tagName.toLowerCase() === "moni-icon-button");
|
|
12113
|
+
}
|
|
12114
|
+
updateSelectionNeighbors() {
|
|
12115
|
+
let e = this.getButtons();
|
|
12116
|
+
if (e.forEach((e) => e.removeAttribute("data-group-adjacent-selected")), this.variant !== "standard" || e.filter((e) => e.hasAttribute("active")).length === 0) return;
|
|
12117
|
+
let t = e.filter((e) => !e.hasAttribute("active")), n = t.length === 1 ? "sole" : "shared";
|
|
12118
|
+
t.forEach((e) => e.setAttribute("data-group-adjacent-selected", n));
|
|
12119
|
+
}
|
|
12027
12120
|
getGapValue(e) {
|
|
12028
12121
|
if (!e) return "";
|
|
12029
12122
|
let t = e.toLowerCase();
|
|
12030
12123
|
return t === "xs" || t === "xsmall" ? "1.125rem" : t === "s" || t === "small" ? "0.75rem" : t === "m" || t === "medium" || t === "l" || t === "large" || t === "xl" || t === "xlarge" ? "0.5rem" : e;
|
|
12031
12124
|
}
|
|
12032
12125
|
updateChildren() {
|
|
12033
|
-
let e = this.
|
|
12126
|
+
let e = this.getButtons(), t = this.gap.trim().toLowerCase(), n = ![
|
|
12034
12127
|
"0",
|
|
12035
12128
|
"0px",
|
|
12036
12129
|
"0rem",
|
|
12037
12130
|
"0em"
|
|
12038
12131
|
].includes(t);
|
|
12039
12132
|
e.forEach((t, r) => {
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
let e = t.getAttribute("shape");
|
|
12043
|
-
(!e || [
|
|
12044
|
-
"left-round-flat",
|
|
12045
|
-
"right-round-flat",
|
|
12046
|
-
"no-round",
|
|
12047
|
-
"left-round",
|
|
12048
|
-
"right-round",
|
|
12049
|
-
"inner-round"
|
|
12050
|
-
].includes(e)) && t.setAttribute("shape", "round");
|
|
12051
|
-
}
|
|
12052
|
-
});
|
|
12133
|
+
t.setAttribute("size", this.size), this.variant === "connected" && this.shape === "square" ? t.setAttribute("shape", "square") : this.variant === "connected" ? n ? e.length === 1 ? t.setAttribute("shape", "round") : r === 0 ? t.setAttribute("shape", "left-round") : r === e.length - 1 ? t.setAttribute("shape", "right-round") : t.setAttribute("shape", "inner-round") : e.length === 1 ? t.setAttribute("shape", "round") : r === 0 ? t.setAttribute("shape", "left-round-flat") : r === e.length - 1 ? t.setAttribute("shape", "right-round-flat") : t.setAttribute("shape", "no-round") : t.setAttribute("shape", this.shape);
|
|
12134
|
+
}), this.updateSelectionNeighbors();
|
|
12053
12135
|
}
|
|
12054
12136
|
handlePointerDown(e) {
|
|
12055
12137
|
if (this.variant !== "standard") return;
|
|
12056
12138
|
let t = e.target.closest("moni-button, moni-icon-button");
|
|
12057
12139
|
if (!t || t.hasAttribute("disabled")) return;
|
|
12058
|
-
let n = this.
|
|
12059
|
-
|
|
12060
|
-
let i = n[r - 1], a = n[r + 1];
|
|
12061
|
-
i && (i.style.transition = "transform 200ms cubic-bezier(0.2, 0, 0, 1)", i.style.transform = "translateX(-6px) scaleX(0.92)", i.style.transformOrigin = "right center"), a && (a.style.transition = "transform 200ms cubic-bezier(0.2, 0, 0, 1)", a.style.transform = "translateX(6px) scaleX(0.92)", a.style.transformOrigin = "left center");
|
|
12140
|
+
let n = this.getButtons(), r = n.indexOf(t);
|
|
12141
|
+
r !== -1 && (t.setAttribute("data-group-pressed", ""), n[r - 1]?.setAttribute("data-group-adjacent-pressed", ""), n[r + 1]?.setAttribute("data-group-adjacent-pressed", ""));
|
|
12062
12142
|
}
|
|
12063
12143
|
handlePointerUp() {
|
|
12064
|
-
this.
|
|
12065
|
-
e.
|
|
12144
|
+
this.getButtons().forEach((e) => {
|
|
12145
|
+
e.removeAttribute("data-group-pressed"), e.removeAttribute("data-group-adjacent-pressed");
|
|
12066
12146
|
});
|
|
12067
12147
|
}
|
|
12068
12148
|
handleClick(e) {
|
|
12069
12149
|
let t = e.target.closest("moni-button, moni-icon-button");
|
|
12070
12150
|
if (!t || t.hasAttribute("disabled")) return;
|
|
12071
|
-
let n = this.
|
|
12151
|
+
let n = this.getButtons();
|
|
12072
12152
|
this.multi || n.forEach((e) => {
|
|
12073
12153
|
e !== t && (e.removeAttribute("active"), e.active = !1);
|
|
12074
12154
|
});
|
|
12075
|
-
let r = t.hasAttribute("active");
|
|
12076
|
-
r ? (t.removeAttribute("active"), t.active = !1) : (t.setAttribute("active", ""), t.active = !0), this.dispatchEvent(new CustomEvent("change", {
|
|
12155
|
+
let r = t.hasAttribute("active"), i = n.filter((e) => e.hasAttribute("active")).length;
|
|
12156
|
+
r && this.selectionRequired && i <= 1 || (r ? (t.removeAttribute("active"), t.active = !1) : (t.setAttribute("active", ""), t.active = !0), this.dispatchEvent(new CustomEvent("change", {
|
|
12077
12157
|
bubbles: !0,
|
|
12078
12158
|
composed: !0,
|
|
12079
12159
|
detail: {
|
|
12080
12160
|
button: t,
|
|
12081
12161
|
active: !r
|
|
12082
12162
|
}
|
|
12083
|
-
}));
|
|
12163
|
+
})));
|
|
12084
12164
|
}
|
|
12085
12165
|
render() {
|
|
12086
12166
|
let e = this.getGapValue(this.gap), t = this.gap.trim().toLowerCase(), n = [
|
|
@@ -12110,7 +12190,11 @@ var Rt = class extends W {
|
|
|
12110
12190
|
K([V({ reflect: !0 })], Rt.prototype, "variant", void 0), K([V({ reflect: !0 })], Rt.prototype, "size", void 0), K([V({
|
|
12111
12191
|
type: Boolean,
|
|
12112
12192
|
reflect: !0
|
|
12113
|
-
})], Rt.prototype, "multi", void 0), K([V(
|
|
12193
|
+
})], Rt.prototype, "multi", void 0), K([V({
|
|
12194
|
+
type: Boolean,
|
|
12195
|
+
reflect: !0,
|
|
12196
|
+
attribute: "selection-required"
|
|
12197
|
+
})], Rt.prototype, "selectionRequired", void 0), K([V({ reflect: !0 })], Rt.prototype, "shape", void 0), K([V({ reflect: !0 })], Rt.prototype, "resizing", void 0), K([V()], Rt.prototype, "gap", void 0), K([V({ reflect: !0 })], Rt.prototype, "role", void 0), K([V({ reflect: !0 })], Rt.prototype, "label", void 0), K([V({
|
|
12114
12198
|
reflect: !0,
|
|
12115
12199
|
attribute: "labelled-by"
|
|
12116
12200
|
})], Rt.prototype, "labelledBy", void 0), K([Ue({ flatten: !0 })], Rt.prototype, "slottedButtons", void 0), Rt = K([B("moni-button-group")], Rt);
|
|
@@ -12709,7 +12793,11 @@ var Ut = {
|
|
|
12709
12793
|
:host {
|
|
12710
12794
|
display: inline-block;
|
|
12711
12795
|
aspect-ratio: 1 / 1;
|
|
12712
|
-
|
|
12796
|
+
/* Paint containment clipped oversized morphs in the contained
|
|
12797
|
+
* variant. Keep layout/style isolation while allowing the active
|
|
12798
|
+
* indicator to animate beyond the container surface. */
|
|
12799
|
+
contain: layout style;
|
|
12800
|
+
overflow: visible;
|
|
12713
12801
|
vertical-align: middle;
|
|
12714
12802
|
}
|
|
12715
12803
|
|
|
@@ -12741,6 +12829,19 @@ var Ut = {
|
|
|
12741
12829
|
justify-content: center;
|
|
12742
12830
|
border-radius: var(--moni-loading-indicator-container-shape, 9999px);
|
|
12743
12831
|
box-sizing: border-box;
|
|
12832
|
+
overflow: visible;
|
|
12833
|
+
}
|
|
12834
|
+
|
|
12835
|
+
.active-indicator-wrapper {
|
|
12836
|
+
overflow: visible;
|
|
12837
|
+
}
|
|
12838
|
+
|
|
12839
|
+
.active-indicator-scale {
|
|
12840
|
+
display: flex;
|
|
12841
|
+
align-items: center;
|
|
12842
|
+
justify-content: center;
|
|
12843
|
+
overflow: visible;
|
|
12844
|
+
transform-origin: center;
|
|
12744
12845
|
}
|
|
12745
12846
|
|
|
12746
12847
|
.active-indicator {
|
|
@@ -12838,7 +12939,9 @@ var Ut = {
|
|
|
12838
12939
|
return R`
|
|
12839
12940
|
<div class="container animate" aria-hidden="true">
|
|
12840
12941
|
<div class="active-indicator-wrapper">
|
|
12841
|
-
<div class="active-indicator"
|
|
12942
|
+
<div class="active-indicator-scale">
|
|
12943
|
+
<div class="active-indicator"></div>
|
|
12944
|
+
</div>
|
|
12842
12945
|
</div>
|
|
12843
12946
|
</div>
|
|
12844
12947
|
`;
|
|
Binary file
|
|
Binary file
|