@m3ui-vue/m3ui-vue 1.9.0 → 1.10.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 +2 -0
- package/dist/API.md +305 -12
- package/dist/{MButton-LiZRRP4h.js → MButton-B9RCM06i.js} +4 -4
- package/dist/MButton-B9RCM06i.js.map +1 -0
- package/dist/{MColorPickerModal-IjciC8zh.js → MColorPickerModal-ChRtcZOo.js} +5 -5
- package/dist/{MColorPickerModal-IjciC8zh.js.map → MColorPickerModal-ChRtcZOo.js.map} +1 -1
- package/dist/{MDialog-BLpfgIA3.js → MDialog-dk07tify.js} +3 -3
- package/dist/{MDialog-BLpfgIA3.js.map → MDialog-dk07tify.js.map} +1 -1
- package/dist/{MIconButton-CNjN0xwW.js → MIconButton-CrBPZidd.js} +46 -39
- package/dist/MIconButton-CrBPZidd.js.map +1 -0
- package/dist/MListItem-h9H223vx.js +1239 -0
- package/dist/MListItem-h9H223vx.js.map +1 -0
- package/dist/{MLoadingIndicator-dejdXpu8.js → MLoadingIndicator-YTV1Ov5w.js} +2 -2
- package/dist/{MLoadingIndicator-dejdXpu8.js.map → MLoadingIndicator-YTV1Ov5w.js.map} +1 -1
- package/dist/MMenuItem-US0Zbglq.js +596 -0
- package/dist/MMenuItem-US0Zbglq.js.map +1 -0
- package/dist/{MPdfViewer-B5Q9Xs9d.js → MPdfViewer-DL9mRsd2.js} +8 -8
- package/dist/{MPdfViewer-B5Q9Xs9d.js.map → MPdfViewer-DL9mRsd2.js.map} +1 -1
- package/dist/MProgressBar-BzZMxq7M.js +254 -0
- package/dist/MProgressBar-BzZMxq7M.js.map +1 -0
- package/dist/{MSeekBar-NwkuAzx-.js → MSeekBar-JFZcoJ8y.js} +2 -2
- package/dist/{MSeekBar-NwkuAzx-.js.map → MSeekBar-JFZcoJ8y.js.map} +1 -1
- package/dist/MSegmentedButton-DMou-8sG.js +106 -0
- package/dist/MSegmentedButton-DMou-8sG.js.map +1 -0
- package/dist/{MSignaturePad-Bqr-1R9f.js → MSignaturePad-WuvE_Cyl.js} +2 -2
- package/dist/{MSignaturePad-Bqr-1R9f.js.map → MSignaturePad-WuvE_Cyl.js.map} +1 -1
- package/dist/{MSlider-B7dIcHVn.js → MSlider-7TzhFHKS.js} +3 -3
- package/dist/{MSlider-B7dIcHVn.js.map → MSlider-7TzhFHKS.js.map} +1 -1
- package/dist/{MSpinner-CXLY7lWw.js → MSpinner-CkIVBuGE.js} +2 -2
- package/dist/{MSpinner-CXLY7lWw.js.map → MSpinner-CkIVBuGE.js.map} +1 -1
- package/dist/{MTextField-CryHMs8-.js → MTextField-B6_iOczK.js} +3 -3
- package/dist/{MTextField-CryHMs8-.js.map → MTextField-B6_iOczK.js.map} +1 -1
- package/dist/{_useFieldValidation-CvZnZfl-.js → _useFieldValidation-COBJ1tWr.js} +2 -2
- package/dist/{_useFieldValidation-CvZnZfl-.js.map → _useFieldValidation-COBJ1tWr.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/components/MAvatarGroup.vue.d.ts +48 -0
- package/dist/components/MCommentThread.vue.d.ts +42 -0
- package/dist/components/MContainer.vue.d.ts +1 -1
- package/dist/components/MContextMenu.vue.d.ts +7 -0
- package/dist/components/MDataTable.vue.d.ts +7 -0
- package/dist/components/MList.vue.d.ts +11 -0
- package/dist/components/MListDetail.vue.d.ts +22 -0
- package/dist/components/MListItem.vue.d.ts +9 -1
- package/dist/components/MMenu.vue.d.ts +10 -0
- package/dist/components/MReactions.vue.d.ts +35 -0
- package/dist/components/MScaffold.vue.d.ts +45 -0
- package/dist/components/MScrollField.vue.d.ts +4 -1
- package/dist/components/MScrollable.vue.d.ts +5 -4
- package/dist/components/MSpreadsheet.vue.d.ts +1 -1
- package/dist/components/MSupportingPane.vue.d.ts +22 -0
- package/dist/components/MTable.vue.d.ts +7 -0
- package/dist/components/MVirtualList.vue.d.ts +51 -0
- package/dist/components/_MComment.vue.d.ts +8 -0
- package/dist/components/_MCommentComposer.vue.d.ts +23 -0
- package/dist/components/_commentThread.d.ts +41 -0
- package/dist/composables/_menuGroups.d.ts +7 -0
- package/dist/composables/_usePaneResize.d.ts +45 -0
- package/dist/composables/useLocale.d.ts +22 -0
- package/dist/composables/useUndo.d.ts +45 -0
- package/dist/directives/vRipple.d.ts +4 -0
- package/dist/draw.js +4 -4
- package/dist/flow.js +2 -2
- package/dist/gantt.js +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/locales/index.js +128 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +11027 -9741
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +7 -7
- package/dist/media.js +6 -6
- package/dist/pdf-sign.js +8 -8
- package/dist/pdf.js +1 -1
- package/dist/plugin.d.ts +6 -0
- package/dist/rich-text-editor.js +6 -6
- package/dist/styles/theme.css +43 -6
- package/dist/styles.css +1 -1
- package/dist/{useLocale-ybIju59R.js → useLocale-YRaOT12S.js} +17 -1
- package/dist/useLocale-YRaOT12S.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MListItemNestedControl.test.ts +1 -1
- package/src/__tests__/MListMultiSelect.test.ts +132 -0
- package/src/__tests__/MMenu.test.ts +152 -0
- package/src/__tests__/MProgressBar.test.ts +84 -1
- package/src/__tests__/MScrollField.test.ts +16 -0
- package/src/__tests__/MScrollable.test.ts +61 -5
- package/src/__tests__/MSwitch.test.ts +83 -0
- package/src/__tests__/adaptiveLayouts.test.ts +167 -0
- package/src/__tests__/backlogComponents.test.ts +249 -0
- package/src/__tests__/popupPosition.test.ts +4 -0
- package/src/__tests__/stateLayerOpacity.test.ts +65 -0
- package/src/__tests__/tableCheckboxReveal.test.ts +35 -0
- package/src/__tests__/vRipple.test.ts +62 -0
- package/src/components/MAvatarGroup.vue +150 -0
- package/src/components/MButton.vue +1 -1
- package/src/components/MButtonGroup.vue +1 -1
- package/src/components/MCard.vue +4 -2
- package/src/components/MCheckbox.vue +13 -2
- package/src/components/MChip.vue +7 -4
- package/src/components/MCircleProgressBar.vue +69 -21
- package/src/components/MCommentThread.vue +131 -0
- package/src/components/MContextMenu.vue +18 -31
- package/src/components/MDataTable.vue +16 -6
- package/src/components/MFab.vue +2 -2
- package/src/components/MIconButton.vue +2 -2
- package/src/components/MList.vue +163 -5
- package/src/components/MListDetail.vue +100 -14
- package/src/components/MListItem.vue +66 -6
- package/src/components/MMenu.vue +48 -41
- package/src/components/MMenuItem.vue +48 -14
- package/src/components/MProgressBar.vue +183 -50
- package/src/components/MRadio.vue +14 -2
- package/src/components/MReactions.vue +161 -0
- package/src/components/MScaffold.vue +213 -0
- package/src/components/MScrollField.vue +15 -12
- package/src/components/MScrollable.vue +187 -46
- package/src/components/MSegmentedButton.vue +3 -1
- package/src/components/MSupportingPane.vue +102 -12
- package/src/components/MSwitch.vue +92 -9
- package/src/components/MTable.vue +17 -4
- package/src/components/MTimeScroll.vue +1 -1
- package/src/components/MToggleButton.vue +2 -2
- package/src/components/MVirtualList.vue +222 -0
- package/src/components/_MComment.vue +142 -0
- package/src/components/_MCommentComposer.vue +68 -0
- package/src/components/_commentThread.ts +46 -0
- package/src/composables/_menuGroups.ts +31 -0
- package/src/composables/_usePaneResize.ts +271 -0
- package/src/composables/useLocale.ts +38 -0
- package/src/composables/useUndo.ts +170 -0
- package/src/directives/vRipple.ts +18 -5
- package/src/index.ts +12 -0
- package/src/locales/ar.ts +16 -0
- package/src/locales/de.ts +16 -0
- package/src/locales/es.ts +16 -0
- package/src/locales/fr.ts +16 -0
- package/src/locales/ja.ts +16 -0
- package/src/locales/ko.ts +16 -0
- package/src/locales/pt.ts +16 -0
- package/src/locales/zh.ts +16 -0
- package/src/plugin.ts +7 -0
- package/src/styles/theme.css +43 -6
- package/dist/MButton-LiZRRP4h.js.map +0 -1
- package/dist/MIconButton-CNjN0xwW.js.map +0 -1
- package/dist/MListItem-BBQ-6i3v.js +0 -991
- package/dist/MListItem-BBQ-6i3v.js.map +0 -1
- package/dist/MMenuItem-E31tMzOt.js +0 -577
- package/dist/MMenuItem-E31tMzOt.js.map +0 -1
- package/dist/MProgressBar-CPrZhQbA.js +0 -179
- package/dist/MProgressBar-CPrZhQbA.js.map +0 -1
- package/dist/MSegmentedButton-DZuZLBML.js +0 -105
- package/dist/MSegmentedButton-DZuZLBML.js.map +0 -1
- package/dist/useLocale-ybIju59R.js.map +0 -1
|
@@ -0,0 +1,1239 @@
|
|
|
1
|
+
import { r as e, t } from "./MIcon-BSsJZhK7.js";
|
|
2
|
+
import { i as n } from "./useLocale-YRaOT12S.js";
|
|
3
|
+
import { a as r, i, p as a, s as o } from "./MIconButton-CrBPZidd.js";
|
|
4
|
+
import { n as s } from "./_useFieldValidation-COBJ1tWr.js";
|
|
5
|
+
import { Transition as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, getCurrentInstance as _, h as v, inject as y, mergeProps as b, nextTick as x, normalizeClass as S, normalizeStyle as C, onBeforeUnmount as w, onMounted as T, onUnmounted as E, onUpdated as D, openBlock as O, provide as k, ref as A, renderSlot as j, resolveDynamicComponent as M, shallowRef as N, toDisplayString as P, unref as F, useId as I, useSlots as L, watch as R, withCtx as z, withDirectives as B, withModifiers as V } from "vue";
|
|
6
|
+
// src/composables/_useFollowAnchor.ts
|
|
7
|
+
var H = /(auto|scroll|hidden|clip)/;
|
|
8
|
+
function U(e) {
|
|
9
|
+
if (!e.isConnected) return !0;
|
|
10
|
+
let t = e.getBoundingClientRect(), n = t.top, r = t.left, i = t.bottom, a = t.right;
|
|
11
|
+
for (let t = e.parentElement; t && t !== document.body && t !== document.documentElement; t = t.parentElement) {
|
|
12
|
+
let e = getComputedStyle(t);
|
|
13
|
+
if (e.position === "fixed") break;
|
|
14
|
+
if (!H.test(e.overflow + e.overflowX + e.overflowY)) continue;
|
|
15
|
+
let o = t.getBoundingClientRect();
|
|
16
|
+
n = Math.max(n, o.top), r = Math.max(r, o.left), i = Math.min(i, o.bottom), a = Math.min(a, o.right);
|
|
17
|
+
}
|
|
18
|
+
return n = Math.max(n, 0), r = Math.max(r, 0), i = Math.min(i, window.innerHeight), a = Math.min(a, window.innerWidth), i <= n || a <= r;
|
|
19
|
+
}
|
|
20
|
+
function W(e) {
|
|
21
|
+
let t = 0, n = null, r = !1;
|
|
22
|
+
function i() {
|
|
23
|
+
if (t = 0, !e.open()) return;
|
|
24
|
+
let n = e.anchor.value;
|
|
25
|
+
if (!n || U(n)) {
|
|
26
|
+
e.close();
|
|
27
|
+
let t = document.activeElement;
|
|
28
|
+
n && t instanceof HTMLElement && n.contains(t) && t.blur();
|
|
29
|
+
} else e.place();
|
|
30
|
+
}
|
|
31
|
+
function a() {
|
|
32
|
+
t ||= requestAnimationFrame(i);
|
|
33
|
+
}
|
|
34
|
+
function o(t) {
|
|
35
|
+
let n = t.target;
|
|
36
|
+
n instanceof Node && e.popup.value?.contains(n) || a();
|
|
37
|
+
}
|
|
38
|
+
function s() {
|
|
39
|
+
r || typeof window > "u" || (r = !0, window.addEventListener("scroll", o, {
|
|
40
|
+
capture: !0,
|
|
41
|
+
passive: !0
|
|
42
|
+
}), window.addEventListener("resize", a), window.visualViewport?.addEventListener("resize", a), window.visualViewport?.addEventListener("scroll", a), typeof ResizeObserver < "u" && e.anchor.value && (n = new ResizeObserver(a), n.observe(e.anchor.value)));
|
|
43
|
+
}
|
|
44
|
+
function c() {
|
|
45
|
+
r && (r = !1, window.removeEventListener("scroll", o, { capture: !0 }), window.removeEventListener("resize", a), window.visualViewport?.removeEventListener("resize", a), window.visualViewport?.removeEventListener("scroll", a), n?.disconnect(), n = null, t && cancelAnimationFrame(t), t = 0);
|
|
46
|
+
}
|
|
47
|
+
R(e.open, (e) => e ? s() : c(), { immediate: !0 }), w(c);
|
|
48
|
+
}
|
|
49
|
+
// src/components/MAvatar.vue
|
|
50
|
+
var G = /* @__PURE__ */ g({
|
|
51
|
+
__name: "MAvatar",
|
|
52
|
+
props: {
|
|
53
|
+
name: {},
|
|
54
|
+
fallback: {},
|
|
55
|
+
size: { default: 40 }
|
|
56
|
+
},
|
|
57
|
+
setup(e) {
|
|
58
|
+
let t = e, n = l(() => {
|
|
59
|
+
if (t.name) {
|
|
60
|
+
let e = t.name.trim().split(/\s+/).filter(Boolean);
|
|
61
|
+
return ((e[0]?.[0] ?? "") + (e.length > 1 ? e[e.length - 1]?.[0] ?? "" : "")).toUpperCase() || t.fallback || "?";
|
|
62
|
+
}
|
|
63
|
+
return t.fallback || "?";
|
|
64
|
+
});
|
|
65
|
+
return (t, r) => (O(), f("div", {
|
|
66
|
+
class: "inline-flex shrink-0 items-center justify-center rounded-full bg-primary-container font-medium text-on-primary-container",
|
|
67
|
+
style: C({
|
|
68
|
+
width: `${e.size}px`,
|
|
69
|
+
height: `${e.size}px`,
|
|
70
|
+
fontSize: `${Math.round(e.size * .4)}px`
|
|
71
|
+
})
|
|
72
|
+
}, P(n.value), 5));
|
|
73
|
+
}
|
|
74
|
+
}), ee = [
|
|
75
|
+
"role",
|
|
76
|
+
"tabindex",
|
|
77
|
+
"aria-disabled"
|
|
78
|
+
], te = ["src", "alt"], K = {
|
|
79
|
+
key: 1,
|
|
80
|
+
class: "px-4 pt-4 pb-2"
|
|
81
|
+
}, q = {
|
|
82
|
+
key: 2,
|
|
83
|
+
class: "px-4 pt-4 pb-2"
|
|
84
|
+
}, J = { class: "text-title-large font-medium text-on-surface" }, Y = {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: "mt-1 text-body-medium text-on-surface-variant"
|
|
87
|
+
}, ne = {
|
|
88
|
+
key: 3,
|
|
89
|
+
class: "flex justify-end gap-2 px-4 pt-2 pb-4"
|
|
90
|
+
}, re = "relative before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-on-surface before:opacity-0 before:transition-opacity before:duration-150 hover:before:opacity-[0.08] focus-visible:before:opacity-[0.1] active:before:opacity-[0.1]", ie = /* @__PURE__ */ g({
|
|
91
|
+
__name: "MCard",
|
|
92
|
+
props: {
|
|
93
|
+
variant: { default: "elevated" },
|
|
94
|
+
clickable: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: !1
|
|
97
|
+
},
|
|
98
|
+
elevated: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: !1
|
|
101
|
+
},
|
|
102
|
+
disabled: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: !1
|
|
105
|
+
},
|
|
106
|
+
image: {},
|
|
107
|
+
imageAlt: {},
|
|
108
|
+
imageHeight: {},
|
|
109
|
+
title: {},
|
|
110
|
+
subtitle: {}
|
|
111
|
+
},
|
|
112
|
+
setup(e) {
|
|
113
|
+
let t = e, n = l(() => t.elevated ? "elevated" : t.variant), r = {
|
|
114
|
+
elevated: "var(--color-surface-container-low)",
|
|
115
|
+
filled: "var(--color-surface-container-highest)",
|
|
116
|
+
outlined: "var(--color-surface)"
|
|
117
|
+
}, i = l(() => (t.disabled ? {
|
|
118
|
+
elevated: "bg-surface/38 shadow-none",
|
|
119
|
+
filled: "bg-surface-variant/38",
|
|
120
|
+
outlined: "bg-surface border border-outline/12"
|
|
121
|
+
} : {
|
|
122
|
+
elevated: "bg-surface-container-low shadow-elevation-1",
|
|
123
|
+
filled: "bg-surface-container-highest",
|
|
124
|
+
outlined: "bg-surface border border-outline-variant"
|
|
125
|
+
})[n.value]), o = {
|
|
126
|
+
elevated: "hover:shadow-elevation-2 active:shadow-elevation-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary",
|
|
127
|
+
filled: "hover:shadow-elevation-1 active:shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary",
|
|
128
|
+
outlined: "hover:shadow-elevation-1 active:shadow-none focus-visible:outline-none focus-visible:border-on-surface"
|
|
129
|
+
}, s = l(() => t.clickable && !t.disabled);
|
|
130
|
+
function c(e) {
|
|
131
|
+
s.value && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.click());
|
|
132
|
+
}
|
|
133
|
+
return (t, l) => B((O(), f("div", {
|
|
134
|
+
class: S(["overflow-hidden rounded-md transition-shadow duration-150", [
|
|
135
|
+
i.value,
|
|
136
|
+
s.value ? [
|
|
137
|
+
"cursor-pointer",
|
|
138
|
+
o[n.value],
|
|
139
|
+
re
|
|
140
|
+
] : "",
|
|
141
|
+
e.disabled ? "cursor-not-allowed pointer-events-none" : ""
|
|
142
|
+
]]),
|
|
143
|
+
style: C({ "--field-bg": r[n.value] }),
|
|
144
|
+
role: e.clickable ? "button" : void 0,
|
|
145
|
+
tabindex: s.value ? 0 : void 0,
|
|
146
|
+
"aria-disabled": e.clickable && e.disabled ? "true" : void 0,
|
|
147
|
+
onKeydown: c
|
|
148
|
+
}, [
|
|
149
|
+
e.image || t.$slots.media ? (O(), f("div", {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: S(["w-full overflow-hidden", e.imageHeight ?? "h-48"])
|
|
152
|
+
}, [e.image ? (O(), f("img", {
|
|
153
|
+
key: 0,
|
|
154
|
+
src: e.image,
|
|
155
|
+
alt: e.imageAlt ?? "",
|
|
156
|
+
class: "h-full w-full object-cover"
|
|
157
|
+
}, null, 8, te)) : j(t.$slots, "media", {}, void 0, void 0, 1)], 2)) : d("", !0),
|
|
158
|
+
t.$slots.header ? (O(), f("div", K, [j(t.$slots, "header")])) : e.title ? (O(), f("div", q, [p("h3", J, P(e.title), 1), e.subtitle ? (O(), f("p", Y, P(e.subtitle), 1)) : d("", !0)])) : d("", !0),
|
|
159
|
+
j(t.$slots, "default"),
|
|
160
|
+
t.$slots.actions ? (O(), f("div", ne, [j(t.$slots, "actions")])) : d("", !0)
|
|
161
|
+
], 46, ee)), [[F(a), s.value ? { disabled: e.disabled } : !1]]);
|
|
162
|
+
}
|
|
163
|
+
}), ae = [
|
|
164
|
+
"checked",
|
|
165
|
+
"disabled",
|
|
166
|
+
"name",
|
|
167
|
+
"required",
|
|
168
|
+
"aria-label",
|
|
169
|
+
"aria-invalid",
|
|
170
|
+
"aria-describedby"
|
|
171
|
+
], oe = {
|
|
172
|
+
key: 2,
|
|
173
|
+
class: "pointer-events-none absolute inset-0 rounded-full ring-0 ring-secondary transition-[box-shadow] duration-150 peer-focus-visible:ring-2"
|
|
174
|
+
}, X = {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: "flex flex-col"
|
|
177
|
+
}, se = {
|
|
178
|
+
key: 0,
|
|
179
|
+
class: "text-error"
|
|
180
|
+
}, ce = ["id"], Z = "border-error bg-error text-on-error", le = /* @__PURE__ */ g({
|
|
181
|
+
__name: "MCheckbox",
|
|
182
|
+
props: {
|
|
183
|
+
modelValue: { type: Boolean },
|
|
184
|
+
indeterminate: {
|
|
185
|
+
type: Boolean,
|
|
186
|
+
default: !1
|
|
187
|
+
},
|
|
188
|
+
disabled: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: !1
|
|
191
|
+
},
|
|
192
|
+
label: {},
|
|
193
|
+
color: { default: "primary" },
|
|
194
|
+
ariaLabel: {},
|
|
195
|
+
error: { type: [Boolean, String] },
|
|
196
|
+
errorLabel: {},
|
|
197
|
+
required: { type: Boolean },
|
|
198
|
+
rules: {},
|
|
199
|
+
validateOn: {},
|
|
200
|
+
validateDebounce: {},
|
|
201
|
+
name: {}
|
|
202
|
+
},
|
|
203
|
+
emits: ["update:modelValue", "blur"],
|
|
204
|
+
setup(e, { expose: n, emit: r }) {
|
|
205
|
+
let i = e, o = r, c = A(null), l = A(null), u = s({
|
|
206
|
+
value: () => i.modelValue,
|
|
207
|
+
rules: () => i.rules,
|
|
208
|
+
required: () => i.required,
|
|
209
|
+
error: () => i.error,
|
|
210
|
+
errorLabel: () => i.errorLabel,
|
|
211
|
+
name: () => i.name,
|
|
212
|
+
validateOn: () => i.validateOn,
|
|
213
|
+
validateDebounce: () => i.validateDebounce,
|
|
214
|
+
disabled: () => i.disabled,
|
|
215
|
+
focus: () => {
|
|
216
|
+
c.value?.focus();
|
|
217
|
+
},
|
|
218
|
+
el: () => c.value,
|
|
219
|
+
setValue: (e) => o("update:modelValue", e)
|
|
220
|
+
}), g = u.disabled, { hasError: _, message: v, messageId: y } = u, b = {
|
|
221
|
+
primary: "border-primary bg-primary text-on-primary",
|
|
222
|
+
secondary: "border-secondary bg-secondary text-on-secondary",
|
|
223
|
+
tertiary: "border-tertiary bg-tertiary text-on-tertiary",
|
|
224
|
+
error: "border-error bg-error text-on-error"
|
|
225
|
+
}, x = {
|
|
226
|
+
primary: "bg-primary",
|
|
227
|
+
secondary: "bg-secondary",
|
|
228
|
+
tertiary: "bg-tertiary",
|
|
229
|
+
error: "bg-error"
|
|
230
|
+
};
|
|
231
|
+
return n({
|
|
232
|
+
validate: u.validate,
|
|
233
|
+
resetValidation: u.resetValidation
|
|
234
|
+
}), (n, r) => B((O(), f("label", { class: S(["group inline-flex gap-2 select-none", [F(g) ? "cursor-not-allowed" : "cursor-pointer", F(v) ? "items-start" : "items-center"]]) }, [p("span", {
|
|
235
|
+
class: "relative -m-[11px] inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full",
|
|
236
|
+
style: C(F(v) ? { marginTop: "-8px" } : void 0)
|
|
237
|
+
}, [
|
|
238
|
+
p("input", {
|
|
239
|
+
type: "checkbox",
|
|
240
|
+
class: "peer sr-only",
|
|
241
|
+
checked: e.modelValue,
|
|
242
|
+
disabled: F(g),
|
|
243
|
+
ref_key: "inputEl",
|
|
244
|
+
ref: c,
|
|
245
|
+
name: e.name,
|
|
246
|
+
required: e.required,
|
|
247
|
+
"aria-label": e.ariaLabel,
|
|
248
|
+
"aria-invalid": F(_) || void 0,
|
|
249
|
+
"aria-describedby": F(v) ? F(y) : void 0,
|
|
250
|
+
onChange: r[0] ||= (t) => o("update:modelValue", !e.modelValue),
|
|
251
|
+
onBlur: r[1] ||= (e) => {
|
|
252
|
+
F(u).onBlur(), o("blur", e);
|
|
253
|
+
}
|
|
254
|
+
}, null, 40, ae),
|
|
255
|
+
F(g) ? d("", !0) : (O(), f("span", {
|
|
256
|
+
key: 0,
|
|
257
|
+
class: S(["pointer-events-none absolute inset-0 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] peer-focus-visible:opacity-[0.1] group-active:opacity-[0.1]", F(_) ? "bg-error" : e.modelValue || e.indeterminate ? x[e.color] : "bg-on-surface"])
|
|
258
|
+
}, null, 2)),
|
|
259
|
+
F(g) ? d("", !0) : (O(), f("span", {
|
|
260
|
+
key: 1,
|
|
261
|
+
ref_key: "rippleEl",
|
|
262
|
+
ref: l,
|
|
263
|
+
"aria-hidden": "true",
|
|
264
|
+
class: S(["pointer-events-none absolute inset-0 rounded-full", (F(_) ? "bg-error" : e.modelValue || e.indeterminate ? x[e.color] : "bg-on-surface").replace("bg-", "text-")])
|
|
265
|
+
}, null, 2)),
|
|
266
|
+
F(g) ? d("", !0) : (O(), f("span", oe)),
|
|
267
|
+
p("span", { class: S(["relative inline-flex h-4.5 w-4.5 items-center justify-center rounded-[2px] border-2 transition-colors", F(g) ? e.modelValue || e.indeterminate ? "border-on-surface/38 bg-on-surface/38 text-surface" : "border-on-surface/38 text-transparent" : F(_) ? e.modelValue || e.indeterminate ? Z : "border-error text-transparent" : e.modelValue || e.indeterminate ? b[e.color] : "border-on-surface-variant text-transparent group-hover:border-on-surface group-active:border-on-surface"]) }, [h(t, {
|
|
268
|
+
name: e.indeterminate ? "remove" : "check",
|
|
269
|
+
size: 18,
|
|
270
|
+
class: S(["transition-[opacity,transform] duration-150", e.modelValue || e.indeterminate ? "scale-100 opacity-100" : "scale-0 opacity-0"])
|
|
271
|
+
}, null, 8, ["name", "class"])], 2)
|
|
272
|
+
], 4), e.label || n.$slots.default || F(v) ? (O(), f("span", X, [e.label || n.$slots.default ? (O(), f("span", {
|
|
273
|
+
key: 0,
|
|
274
|
+
class: S(["text-body-large", F(g) ? "text-on-surface/38" : "text-on-surface"])
|
|
275
|
+
}, [j(n.$slots, "default", {}, () => [m(P(e.label), 1)]), e.required ? (O(), f("span", se, "\xA0*")) : d("", !0)], 2)) : d("", !0), F(v) ? (O(), f("span", {
|
|
276
|
+
key: 1,
|
|
277
|
+
id: F(y),
|
|
278
|
+
role: "alert",
|
|
279
|
+
class: "text-body-small text-error"
|
|
280
|
+
}, P(F(v)), 9, ce)) : d("", !0)])) : d("", !0)], 2)), [[F(a), {
|
|
281
|
+
disabled: F(g),
|
|
282
|
+
layer: () => l.value,
|
|
283
|
+
centered: !0
|
|
284
|
+
}]]);
|
|
285
|
+
}
|
|
286
|
+
}), ue = ["disabled", "aria-pressed"], de = { class: "whitespace-nowrap" }, fe = ["aria-label", "disabled"], pe = ["aria-label", "disabled"], me = "relative cursor-pointer before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 hover:before:opacity-[0.08] focus-visible:before:opacity-[0.1] active:before:opacity-[0.1] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", Q = /* @__PURE__ */ g({
|
|
287
|
+
__name: "MChip",
|
|
288
|
+
props: {
|
|
289
|
+
tone: { default: "neutral" },
|
|
290
|
+
selected: {
|
|
291
|
+
type: Boolean,
|
|
292
|
+
default: !1
|
|
293
|
+
},
|
|
294
|
+
removable: {
|
|
295
|
+
type: Boolean,
|
|
296
|
+
default: !1
|
|
297
|
+
},
|
|
298
|
+
clickable: {
|
|
299
|
+
type: Boolean,
|
|
300
|
+
default: !1
|
|
301
|
+
},
|
|
302
|
+
disabled: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: !1
|
|
305
|
+
},
|
|
306
|
+
icon: {},
|
|
307
|
+
type: {},
|
|
308
|
+
elevated: {
|
|
309
|
+
type: Boolean,
|
|
310
|
+
default: !1
|
|
311
|
+
},
|
|
312
|
+
trailingIcon: {}
|
|
313
|
+
},
|
|
314
|
+
emits: [
|
|
315
|
+
"click",
|
|
316
|
+
"remove",
|
|
317
|
+
"update:selected"
|
|
318
|
+
],
|
|
319
|
+
setup(e, { emit: s }) {
|
|
320
|
+
let c = [
|
|
321
|
+
"neutral",
|
|
322
|
+
"primary",
|
|
323
|
+
"success",
|
|
324
|
+
"error",
|
|
325
|
+
"tertiary",
|
|
326
|
+
"secondary"
|
|
327
|
+
], m = e, g = s, _ = n(), v = L(), y = l(() => !!m.tone && !c.includes(m.tone)), b = l(() => {
|
|
328
|
+
if (y.value) return {
|
|
329
|
+
"--chip-bg": m.tone + "22",
|
|
330
|
+
"--chip-color": m.tone
|
|
331
|
+
};
|
|
332
|
+
}), x = l(() => {
|
|
333
|
+
if (m.disabled) return m.tone === "neutral" && !m.selected && !y.value ? "border border-on-surface/10 bg-transparent text-on-surface/38" : "border border-transparent bg-on-surface/12 text-on-surface/38";
|
|
334
|
+
if (y.value) return "border border-transparent bg-[var(--chip-bg)] text-[var(--chip-color)]";
|
|
335
|
+
if (m.tone === "neutral" && !m.selected) return "border border-outline-variant bg-transparent text-on-surface-variant";
|
|
336
|
+
let e = {
|
|
337
|
+
neutral: "border border-transparent bg-secondary-container text-on-secondary-container",
|
|
338
|
+
primary: "border border-transparent bg-primary-container text-on-primary-container",
|
|
339
|
+
secondary: "border border-transparent bg-secondary-container text-on-secondary-container",
|
|
340
|
+
success: "border border-transparent bg-success-container text-on-success-container",
|
|
341
|
+
error: "border border-transparent bg-error-container text-on-error-container",
|
|
342
|
+
tertiary: "border border-transparent bg-tertiary-container text-on-tertiary-container"
|
|
343
|
+
};
|
|
344
|
+
return e[m.tone ?? "neutral"] ?? e.neutral;
|
|
345
|
+
}), w = l(() => m.selected ? "rounded-full" : "rounded-md"), T = l(() => m.type === "filter" || m.type === "input"), E = l(() => m.type === "input" && !!v.avatar), D = l(() => !!m.trailingIcon || m.type === "input" && m.removable), k = l(() => {
|
|
346
|
+
let e = T.value && m.selected;
|
|
347
|
+
if (m.disabled) return e || m.elevated && m.type !== "input" ? "bg-on-surface/12 text-on-surface/38" : "border border-on-surface/12 text-on-surface/38";
|
|
348
|
+
if (e) return ["bg-secondary-container text-on-secondary-container", m.elevated ? "shadow-elevation-1 hover:shadow-elevation-2" : ""];
|
|
349
|
+
let t = m.type === "assist" ? "text-on-surface" : "text-on-surface-variant";
|
|
350
|
+
return m.elevated && m.type !== "input" ? ["bg-surface-container-low shadow-elevation-1 hover:shadow-elevation-2", t] : ["border border-outline-variant", t];
|
|
351
|
+
}), N = l(() => m.disabled ? "" : m.type === "assist" || m.type === "suggestion" ? "text-primary" : m.selected ? "text-on-secondary-container" : "text-on-surface-variant"), P = l(() => m.type === "input" ? [E.value ? "ps-1" : m.icon ? "ps-2" : "ps-3", D.value ? "pe-2" : "pe-3"] : [m.icon || U.value ? "ps-2" : "ps-4", D.value ? "pe-2" : "pe-4"]), I = A(!1), R = A(), H = A(), U = l(() => m.type === "filter" && !m.icon);
|
|
352
|
+
o(() => m.type === "filter" || m.type === "input" ? [I.value ? 8 : m.selected ? 16 : 12, U.value ? m.selected ? 26 : 8 : 0] : [], ([e, t]) => {
|
|
353
|
+
R.value && e !== void 0 && (R.value.style.borderRadius = `${e}px`), H.value && t !== void 0 && (H.value.style.width = `${t}px`);
|
|
354
|
+
}, r), o(() => U.value ? [+!!m.selected] : [], ([e]) => {
|
|
355
|
+
H.value && e !== void 0 && (H.value.style.opacity = String(e));
|
|
356
|
+
}, i);
|
|
357
|
+
function W() {
|
|
358
|
+
m.disabled || (T.value && g("update:selected", !m.selected), g("click"));
|
|
359
|
+
}
|
|
360
|
+
return (n, r) => e.type ? (O(), f("span", {
|
|
361
|
+
key: 0,
|
|
362
|
+
ref_key: "typedEl",
|
|
363
|
+
ref: R,
|
|
364
|
+
class: S(["relative inline-flex h-8 items-center overflow-hidden align-middle text-label-large transition-[background-color,box-shadow,color] has-[button:focus-visible]:ring-2 has-[button:focus-visible]:ring-inset has-[button:focus-visible]:ring-secondary", [k.value, e.type === "assist" || e.type === "suggestion" ? "rounded-sm" : "rounded-md"]])
|
|
365
|
+
}, [B((O(), f("button", {
|
|
366
|
+
type: "button",
|
|
367
|
+
class: S(["flex h-full items-center gap-2 outline-none before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity", [P.value, e.disabled ? "cursor-not-allowed" : "cursor-pointer hover:before:opacity-[0.08] focus-visible:before:opacity-[0.1] active:before:opacity-[0.1]"]]),
|
|
368
|
+
disabled: e.disabled,
|
|
369
|
+
"aria-pressed": T.value ? e.selected : void 0,
|
|
370
|
+
onPointerdown: r[0] ||= (e) => I.value = !0,
|
|
371
|
+
onPointerup: r[1] ||= (e) => I.value = !1,
|
|
372
|
+
onPointerleave: r[2] ||= (e) => I.value = !1,
|
|
373
|
+
onPointercancel: r[3] ||= (e) => I.value = !1,
|
|
374
|
+
onClick: W
|
|
375
|
+
}, [
|
|
376
|
+
E.value ? (O(), f("span", {
|
|
377
|
+
key: 0,
|
|
378
|
+
class: S(["-my-1 flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full", e.disabled ? "opacity-38" : ""])
|
|
379
|
+
}, [j(n.$slots, "avatar")], 2)) : e.icon ? (O(), u(t, {
|
|
380
|
+
key: 1,
|
|
381
|
+
name: e.icon,
|
|
382
|
+
size: 18,
|
|
383
|
+
filled: e.type === "filter" && e.selected,
|
|
384
|
+
class: S(["shrink-0", N.value])
|
|
385
|
+
}, null, 8, [
|
|
386
|
+
"name",
|
|
387
|
+
"filled",
|
|
388
|
+
"class"
|
|
389
|
+
])) : U.value ? (O(), f("span", {
|
|
390
|
+
key: 2,
|
|
391
|
+
ref_key: "checkEl",
|
|
392
|
+
ref: H,
|
|
393
|
+
class: "-me-2 flex shrink-0 overflow-hidden",
|
|
394
|
+
style: {
|
|
395
|
+
width: "8px",
|
|
396
|
+
opacity: "0"
|
|
397
|
+
},
|
|
398
|
+
"aria-hidden": "true"
|
|
399
|
+
}, [h(t, {
|
|
400
|
+
name: "check",
|
|
401
|
+
size: 18,
|
|
402
|
+
class: S(["shrink-0", N.value])
|
|
403
|
+
}, null, 8, ["class"])], 512)) : d("", !0),
|
|
404
|
+
p("span", de, [j(n.$slots, "default")]),
|
|
405
|
+
e.trailingIcon ? (O(), u(t, {
|
|
406
|
+
key: 3,
|
|
407
|
+
name: e.trailingIcon,
|
|
408
|
+
size: 18,
|
|
409
|
+
class: S(["shrink-0", e.disabled ? "" : e.selected && T.value ? "text-on-secondary-container" : "text-on-surface-variant"])
|
|
410
|
+
}, null, 8, ["name", "class"])) : d("", !0)
|
|
411
|
+
], 42, ue)), [[F(a), { disabled: e.disabled }]]), e.type === "input" && e.removable ? (O(), f("button", {
|
|
412
|
+
key: 0,
|
|
413
|
+
type: "button",
|
|
414
|
+
class: S(["relative -ms-1 me-2 flex h-6 w-6 shrink-0 items-center justify-center rounded-full outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-secondary", e.disabled ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
415
|
+
"aria-label": F(_).remove,
|
|
416
|
+
disabled: e.disabled,
|
|
417
|
+
onClick: r[4] ||= V((e) => g("remove"), ["stop"])
|
|
418
|
+
}, [h(t, {
|
|
419
|
+
name: "close",
|
|
420
|
+
size: 18
|
|
421
|
+
})], 10, fe)) : d("", !0)], 2)) : B((O(), u(M(e.clickable ? "button" : "span"), {
|
|
422
|
+
key: 1,
|
|
423
|
+
type: e.clickable ? "button" : void 0,
|
|
424
|
+
disabled: e.clickable && e.disabled ? !0 : void 0,
|
|
425
|
+
class: S(["inline-flex h-8 items-center gap-1.5 overflow-hidden px-3 text-label-large transition-colors", [
|
|
426
|
+
w.value,
|
|
427
|
+
x.value,
|
|
428
|
+
e.clickable && !e.disabled ? me : "",
|
|
429
|
+
e.disabled ? "cursor-not-allowed" : ""
|
|
430
|
+
]]),
|
|
431
|
+
style: C(b.value),
|
|
432
|
+
onClick: r[6] ||= (t) => e.clickable && !e.disabled && g("click")
|
|
433
|
+
}, {
|
|
434
|
+
default: z(() => [
|
|
435
|
+
e.icon ? (O(), u(t, {
|
|
436
|
+
key: 0,
|
|
437
|
+
name: e.icon,
|
|
438
|
+
size: 18
|
|
439
|
+
}, null, 8, ["name"])) : d("", !0),
|
|
440
|
+
j(n.$slots, "default"),
|
|
441
|
+
e.removable ? (O(), f("button", {
|
|
442
|
+
key: 1,
|
|
443
|
+
type: "button",
|
|
444
|
+
class: "-me-1 ms-0.5 inline-flex items-center justify-center rounded-full hover:bg-on-surface/8 active:bg-on-surface/10",
|
|
445
|
+
"aria-label": F(_).remove,
|
|
446
|
+
disabled: e.disabled,
|
|
447
|
+
onClick: r[5] ||= V((e) => g("remove"), ["stop"])
|
|
448
|
+
}, [h(t, {
|
|
449
|
+
name: "close",
|
|
450
|
+
size: 16
|
|
451
|
+
})], 8, pe)) : d("", !0)
|
|
452
|
+
]),
|
|
453
|
+
_: 3
|
|
454
|
+
}, 8, [
|
|
455
|
+
"type",
|
|
456
|
+
"disabled",
|
|
457
|
+
"class",
|
|
458
|
+
"style"
|
|
459
|
+
])), [[F(a), e.clickable ? { disabled: e.disabled } : !1]]);
|
|
460
|
+
}
|
|
461
|
+
}), he = { class: "relative -my-2 inline-flex h-12 shrink-0 items-center" }, ge = [
|
|
462
|
+
"checked",
|
|
463
|
+
"disabled",
|
|
464
|
+
"name",
|
|
465
|
+
"required",
|
|
466
|
+
"aria-invalid",
|
|
467
|
+
"aria-describedby"
|
|
468
|
+
], _e = {
|
|
469
|
+
key: 0,
|
|
470
|
+
class: "text-body-large text-on-surface"
|
|
471
|
+
}, ve = {
|
|
472
|
+
key: 0,
|
|
473
|
+
class: "text-error"
|
|
474
|
+
}, ye = ["id"], be = "bg-outline group-hover:bg-on-surface-variant group-active:bg-on-surface-variant peer-focus-visible:bg-on-surface-variant", $ = 18, xe = 8, Se = 125, Ce = /* @__PURE__ */ g({
|
|
475
|
+
__name: "MSwitch",
|
|
476
|
+
props: {
|
|
477
|
+
modelValue: { type: Boolean },
|
|
478
|
+
disabled: {
|
|
479
|
+
type: Boolean,
|
|
480
|
+
default: !1
|
|
481
|
+
},
|
|
482
|
+
label: {},
|
|
483
|
+
color: { default: "primary" },
|
|
484
|
+
icon: {
|
|
485
|
+
type: Boolean,
|
|
486
|
+
default: !0
|
|
487
|
+
},
|
|
488
|
+
error: { type: [Boolean, String] },
|
|
489
|
+
errorLabel: {},
|
|
490
|
+
required: { type: Boolean },
|
|
491
|
+
rules: {},
|
|
492
|
+
validateOn: {},
|
|
493
|
+
validateDebounce: {},
|
|
494
|
+
name: {}
|
|
495
|
+
},
|
|
496
|
+
emits: ["update:modelValue", "blur"],
|
|
497
|
+
setup(n, { expose: r, emit: i }) {
|
|
498
|
+
let o = n, g = i, _ = A(null), v = A(null), y = s({
|
|
499
|
+
value: () => o.modelValue,
|
|
500
|
+
rules: () => o.rules,
|
|
501
|
+
required: () => o.required,
|
|
502
|
+
error: () => o.error,
|
|
503
|
+
errorLabel: () => o.errorLabel,
|
|
504
|
+
name: () => o.name,
|
|
505
|
+
validateOn: () => o.validateOn,
|
|
506
|
+
validateDebounce: () => o.validateDebounce,
|
|
507
|
+
disabled: () => o.disabled,
|
|
508
|
+
focus: () => {
|
|
509
|
+
_.value?.focus();
|
|
510
|
+
},
|
|
511
|
+
el: () => _.value,
|
|
512
|
+
setValue: (e) => g("update:modelValue", e)
|
|
513
|
+
}), b = y.disabled, { hasError: x, message: w, messageId: T } = y, E = {
|
|
514
|
+
primary: "border-primary bg-primary",
|
|
515
|
+
secondary: "border-secondary bg-secondary",
|
|
516
|
+
tertiary: "border-tertiary bg-tertiary",
|
|
517
|
+
error: "border-error bg-error"
|
|
518
|
+
}, D = {
|
|
519
|
+
primary: "bg-on-primary group-hover:bg-primary-container group-active:bg-primary-container peer-focus-visible:bg-primary-container",
|
|
520
|
+
secondary: "bg-on-secondary group-hover:bg-secondary-container group-active:bg-secondary-container peer-focus-visible:bg-secondary-container",
|
|
521
|
+
tertiary: "bg-on-tertiary group-hover:bg-tertiary-container group-active:bg-tertiary-container peer-focus-visible:bg-tertiary-container",
|
|
522
|
+
error: "bg-on-error group-hover:bg-error-container group-active:bg-error-container peer-focus-visible:bg-error-container"
|
|
523
|
+
}, k = {
|
|
524
|
+
primary: "text-on-primary-container",
|
|
525
|
+
secondary: "text-on-secondary-container",
|
|
526
|
+
tertiary: "text-on-tertiary-container",
|
|
527
|
+
error: "text-on-error-container"
|
|
528
|
+
}, j = {
|
|
529
|
+
primary: "bg-primary",
|
|
530
|
+
secondary: "bg-secondary",
|
|
531
|
+
tertiary: "bg-tertiary",
|
|
532
|
+
error: "bg-error"
|
|
533
|
+
}, M = A(!1);
|
|
534
|
+
function N() {
|
|
535
|
+
b.value || (M.value = !0);
|
|
536
|
+
}
|
|
537
|
+
function I() {
|
|
538
|
+
L.value === null && (M.value = !1);
|
|
539
|
+
}
|
|
540
|
+
let L = A(null), R = null, V = !1;
|
|
541
|
+
function H(t) {
|
|
542
|
+
b.value || t.button !== 0 || (R = {
|
|
543
|
+
id: t.pointerId,
|
|
544
|
+
x: t.clientX,
|
|
545
|
+
from: o.modelValue ? $ : 0,
|
|
546
|
+
dir: e(t.currentTarget) ? -1 : 1,
|
|
547
|
+
last: []
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
function U(e) {
|
|
551
|
+
if (!R || e.pointerId !== R.id) return;
|
|
552
|
+
let t = (e.clientX - R.x) * R.dir, n = Math.min($, Math.max(0, R.from + t));
|
|
553
|
+
if (R.last.push({
|
|
554
|
+
t: e.timeStamp,
|
|
555
|
+
x: n
|
|
556
|
+
}), R.last.length > 6 && R.last.shift(), L.value === null) {
|
|
557
|
+
if (Math.abs(t) < xe) return;
|
|
558
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), M.value = !0;
|
|
559
|
+
}
|
|
560
|
+
L.value = n;
|
|
561
|
+
}
|
|
562
|
+
function W(e) {
|
|
563
|
+
if (!R || e.pointerId !== R.id) return;
|
|
564
|
+
let t = L.value, n = R.last.filter((t) => e.timeStamp - t.t <= 100);
|
|
565
|
+
if (R = null, t === null) return;
|
|
566
|
+
let r = n[0], i = n[n.length - 1], a = r && i && i.t > r.t ? (i.x - r.x) / (i.t - r.t) * 1e3 : 0, s = a >= Se ? !0 : a <= -125 ? !1 : t >= $ / 2;
|
|
567
|
+
L.value = null, M.value = !1, V = !0, setTimeout(() => {
|
|
568
|
+
V = !1;
|
|
569
|
+
}, 0), s !== o.modelValue && g("update:modelValue", s);
|
|
570
|
+
}
|
|
571
|
+
function G() {
|
|
572
|
+
R = null, L.value = null, M.value = !1;
|
|
573
|
+
}
|
|
574
|
+
function ee(e) {
|
|
575
|
+
V && (V = !1, e.preventDefault(), e.stopPropagation());
|
|
576
|
+
}
|
|
577
|
+
let te = l(() => L.value ?? (o.modelValue ? $ : 0)), K = (e) => L.value === null ? e ? "transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color 280ms ease" : "transform 240ms cubic-bezier(0.2, 0, 0, 1), background-color 240ms ease" : "background-color 280ms ease", q = l(() => M.value ? 28 / 24 : o.modelValue ? 1 : 16 / 24), J = l(() => ({
|
|
578
|
+
transform: `translateY(-50%) translateX(calc(${te.value}px * var(--m3-dir, 1))) scale(${q.value})`,
|
|
579
|
+
transition: K(o.modelValue)
|
|
580
|
+
})), Y = l(() => ({
|
|
581
|
+
transform: `translateX(calc(${te.value}px * var(--m3-dir, 1)))`,
|
|
582
|
+
transition: L.value === null ? o.modelValue ? "transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1)" : "transform 240ms cubic-bezier(0.2, 0, 0, 1)" : "none"
|
|
583
|
+
}));
|
|
584
|
+
return r({
|
|
585
|
+
validate: y.validate,
|
|
586
|
+
resetValidation: y.resetValidation
|
|
587
|
+
}), (e, r) => B((O(), f("label", {
|
|
588
|
+
class: S(["group inline-flex gap-3 select-none", [F(b) ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer", F(w) ? "items-start" : "items-center"]]),
|
|
589
|
+
onPointerdown: N,
|
|
590
|
+
onPointerup: I,
|
|
591
|
+
onPointerleave: I,
|
|
592
|
+
onPointercancel: I,
|
|
593
|
+
onClickCapture: ee
|
|
594
|
+
}, [p("span", he, [p("span", {
|
|
595
|
+
class: S(["relative inline-flex h-8 w-[52px] touch-pan-y items-center rounded-full border-2 transition-colors duration-200", n.modelValue ? E[n.color] : "border-outline bg-surface-container-highest"]),
|
|
596
|
+
onPointerdown: H,
|
|
597
|
+
onPointermove: U,
|
|
598
|
+
onPointerup: W,
|
|
599
|
+
onPointercancel: G
|
|
600
|
+
}, [
|
|
601
|
+
p("input", {
|
|
602
|
+
type: "checkbox",
|
|
603
|
+
class: "peer sr-only",
|
|
604
|
+
checked: n.modelValue,
|
|
605
|
+
disabled: F(b),
|
|
606
|
+
ref_key: "inputEl",
|
|
607
|
+
ref: _,
|
|
608
|
+
role: "switch",
|
|
609
|
+
name: n.name,
|
|
610
|
+
required: n.required,
|
|
611
|
+
"aria-invalid": F(x) || void 0,
|
|
612
|
+
"aria-describedby": F(w) ? F(T) : void 0,
|
|
613
|
+
onChange: r[0] ||= (e) => g("update:modelValue", !n.modelValue),
|
|
614
|
+
onBlur: r[1] ||= (e) => {
|
|
615
|
+
F(y).onBlur(), g("blur", e);
|
|
616
|
+
}
|
|
617
|
+
}, null, 40, ge),
|
|
618
|
+
F(b) ? d("", !0) : (O(), f("span", {
|
|
619
|
+
key: 0,
|
|
620
|
+
class: S(["pointer-events-none absolute top-1/2 -start-1 h-10 w-10 -translate-y-1/2 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] group-active:opacity-[0.1] peer-focus-visible:opacity-[0.1]", n.modelValue ? j[n.color] : "bg-on-surface-variant"]),
|
|
621
|
+
style: C(Y.value)
|
|
622
|
+
}, null, 6)),
|
|
623
|
+
F(b) ? d("", !0) : (O(), f("span", {
|
|
624
|
+
key: 1,
|
|
625
|
+
ref_key: "rippleEl",
|
|
626
|
+
ref: v,
|
|
627
|
+
"aria-hidden": "true",
|
|
628
|
+
class: S(["pointer-events-none absolute top-1/2 -start-1 h-10 w-10 -translate-y-1/2 rounded-full", (n.modelValue ? j[n.color] : "bg-on-surface-variant").replace("bg-", "text-")]),
|
|
629
|
+
style: C(Y.value)
|
|
630
|
+
}, null, 6)),
|
|
631
|
+
F(b) ? d("", !0) : (O(), f("span", {
|
|
632
|
+
key: 2,
|
|
633
|
+
class: "pointer-events-none absolute top-1/2 -start-1 h-10 w-10 -translate-y-1/2 rounded-full ring-0 ring-secondary transition-[box-shadow] duration-150 peer-focus-visible:ring-2",
|
|
634
|
+
style: C(Y.value)
|
|
635
|
+
}, null, 4)),
|
|
636
|
+
p("span", {
|
|
637
|
+
class: S(["absolute start-1 top-1/2 flex h-6 w-6 items-center justify-center rounded-full will-change-transform", n.modelValue ? [D[n.color], "shadow-sm"] : be]),
|
|
638
|
+
style: C(J.value)
|
|
639
|
+
}, [h(c, {
|
|
640
|
+
"enter-active-class": "transition-opacity duration-150 delay-[120ms]",
|
|
641
|
+
"enter-from-class": "opacity-0",
|
|
642
|
+
"enter-to-class": "opacity-100",
|
|
643
|
+
"leave-active-class": "transition-opacity duration-75",
|
|
644
|
+
"leave-from-class": "opacity-100",
|
|
645
|
+
"leave-to-class": "opacity-0"
|
|
646
|
+
}, {
|
|
647
|
+
default: z(() => [n.modelValue && n.icon ? (O(), u(t, {
|
|
648
|
+
key: 0,
|
|
649
|
+
name: "check",
|
|
650
|
+
size: 14,
|
|
651
|
+
class: S(k[n.color])
|
|
652
|
+
}, null, 8, ["class"])) : d("", !0)]),
|
|
653
|
+
_: 1
|
|
654
|
+
})], 6)
|
|
655
|
+
], 34)]), n.label || F(w) ? (O(), f("span", {
|
|
656
|
+
key: 0,
|
|
657
|
+
class: S(["flex flex-col", F(w) && "pt-1"])
|
|
658
|
+
}, [n.label ? (O(), f("span", _e, [m(P(n.label), 1), n.required ? (O(), f("span", ve, "\xA0*")) : d("", !0)])) : d("", !0), F(w) ? (O(), f("span", {
|
|
659
|
+
key: 1,
|
|
660
|
+
id: F(T),
|
|
661
|
+
role: "alert",
|
|
662
|
+
class: "text-body-small text-error"
|
|
663
|
+
}, P(F(w)), 9, ye)) : d("", !0)], 2)) : d("", !0)], 34)), [[F(a), {
|
|
664
|
+
disabled: F(b),
|
|
665
|
+
layer: () => v.value,
|
|
666
|
+
centered: !0
|
|
667
|
+
}]]);
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
// src/composables/_useSegmentRuns.ts
|
|
671
|
+
function we(e) {
|
|
672
|
+
let t = N(/* @__PURE__ */ new Map());
|
|
673
|
+
function n() {
|
|
674
|
+
let n = /* @__PURE__ */ new Map(), r = [], i = () => {
|
|
675
|
+
r.forEach((e, t) => n.set(e, r.length === 1 ? "single" : t === 0 ? "first" : t === r.length - 1 ? "last" : "middle")), r = [];
|
|
676
|
+
};
|
|
677
|
+
for (let t of e.value?.children ?? []) t.getAttribute("role") === "listitem" ? r.push(t) : i();
|
|
678
|
+
i(), t.value = n;
|
|
679
|
+
}
|
|
680
|
+
let r;
|
|
681
|
+
return T(() => {
|
|
682
|
+
n(), e.value && (r = new MutationObserver(n), r.observe(e.value, { childList: !0 }));
|
|
683
|
+
}), E(() => r?.disconnect()), (e) => e ? t.value.get(e) : void 0;
|
|
684
|
+
}
|
|
685
|
+
// src/components/MList.vue?vue&type=script&setup=true&lang.ts
|
|
686
|
+
var Te = ["role", "aria-multiselectable"], Ee = 400, De = 8, Oe = /* @__PURE__ */ g({
|
|
687
|
+
__name: "MList",
|
|
688
|
+
props: {
|
|
689
|
+
dense: {
|
|
690
|
+
type: Boolean,
|
|
691
|
+
default: !1
|
|
692
|
+
},
|
|
693
|
+
dividers: {
|
|
694
|
+
type: [Boolean, String],
|
|
695
|
+
default: !1
|
|
696
|
+
},
|
|
697
|
+
nav: {
|
|
698
|
+
type: Boolean,
|
|
699
|
+
default: !1
|
|
700
|
+
},
|
|
701
|
+
segmented: {
|
|
702
|
+
type: Boolean,
|
|
703
|
+
default: !1
|
|
704
|
+
},
|
|
705
|
+
selectable: {
|
|
706
|
+
type: Boolean,
|
|
707
|
+
default: !1
|
|
708
|
+
},
|
|
709
|
+
selected: {},
|
|
710
|
+
lines: {},
|
|
711
|
+
multiSelect: { type: Boolean },
|
|
712
|
+
checked: {},
|
|
713
|
+
selectionMode: {
|
|
714
|
+
type: Boolean,
|
|
715
|
+
default: void 0
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
emits: [
|
|
719
|
+
"update:selected",
|
|
720
|
+
"update:checked",
|
|
721
|
+
"update:selectionMode"
|
|
722
|
+
],
|
|
723
|
+
setup(e, { emit: t }) {
|
|
724
|
+
let n = e, r = t, i = A(), a = we(i);
|
|
725
|
+
k("m-list", {
|
|
726
|
+
segmentPosition: a,
|
|
727
|
+
dense: l(() => n.dense),
|
|
728
|
+
nav: l(() => n.nav),
|
|
729
|
+
segmented: l(() => n.segmented),
|
|
730
|
+
selectable: l(() => n.selectable),
|
|
731
|
+
selected: l(() => n.selected),
|
|
732
|
+
dividers: l(() => n.dividers),
|
|
733
|
+
lines: l(() => n.lines),
|
|
734
|
+
select: (e) => r("update:selected", e),
|
|
735
|
+
multiSelect: l(() => n.multiSelect),
|
|
736
|
+
selecting: l(() => d.value),
|
|
737
|
+
isChecked: (e) => c.value.has(e),
|
|
738
|
+
toggle: g,
|
|
739
|
+
enterSelection: _,
|
|
740
|
+
register: (e, t) => p.set(e, t),
|
|
741
|
+
unregister: (e) => p.delete(e)
|
|
742
|
+
});
|
|
743
|
+
let o = A(n.checked ?? []);
|
|
744
|
+
R(() => n.checked, (e) => {
|
|
745
|
+
e && (o.value = e);
|
|
746
|
+
});
|
|
747
|
+
let s = l(() => o.value), c = l(() => new Set(s.value)), u = A(!1), d = l(() => n.selectionMode ?? (u.value || s.value.length > 0)), p = /* @__PURE__ */ new WeakMap();
|
|
748
|
+
function m(e) {
|
|
749
|
+
o.value = e, r("update:checked", e), !e.length && n.selectionMode === void 0 && h(!1);
|
|
750
|
+
}
|
|
751
|
+
function h(e) {
|
|
752
|
+
(u.value !== e || n.selectionMode !== void 0) && (u.value = e, r("update:selectionMode", e));
|
|
753
|
+
}
|
|
754
|
+
function g(e) {
|
|
755
|
+
let t = new Set(s.value);
|
|
756
|
+
t.has(e) ? t.delete(e) : t.add(e), m([...t]);
|
|
757
|
+
}
|
|
758
|
+
function _(e) {
|
|
759
|
+
d.value || h(!0), c.value.has(e) || m([...s.value, e]);
|
|
760
|
+
}
|
|
761
|
+
function v() {
|
|
762
|
+
m([]), h(!1);
|
|
763
|
+
}
|
|
764
|
+
let y = () => [...i.value?.querySelectorAll("[data-mli-value]") ?? []], b = null, C = !1;
|
|
765
|
+
function E(e) {
|
|
766
|
+
let t = e.target?.closest?.("[data-mli-value]");
|
|
767
|
+
if (!t || !i.value?.contains(t)) return null;
|
|
768
|
+
let n = e.target.closest("button, a[href], input, select, textarea, [role=\"checkbox\"], [role=\"switch\"]");
|
|
769
|
+
return n && n !== t && t.contains(n) && !n.closest("[data-mli-part]") ? null : t;
|
|
770
|
+
}
|
|
771
|
+
function M(e) {
|
|
772
|
+
if (!n.multiSelect || e.button !== 0) return;
|
|
773
|
+
let t = E(e);
|
|
774
|
+
t && t.getAttribute("aria-disabled") !== "true" && (b = {
|
|
775
|
+
x: e.clientX,
|
|
776
|
+
y: e.clientY,
|
|
777
|
+
row: t,
|
|
778
|
+
base: /* @__PURE__ */ new Set(),
|
|
779
|
+
anchor: -1,
|
|
780
|
+
ranging: !1,
|
|
781
|
+
timer: setTimeout(N, Ee)
|
|
782
|
+
}, window.addEventListener("pointermove", P), window.addEventListener("pointerup", F), window.addEventListener("pointercancel", I));
|
|
783
|
+
}
|
|
784
|
+
function N() {
|
|
785
|
+
if (!b) return;
|
|
786
|
+
let e = p.get(b.row);
|
|
787
|
+
e !== void 0 && (_(e), b.base = new Set(s.value), b.anchor = y().indexOf(b.row), b.ranging = !0, C = !0, document.body.style.userSelect = "none");
|
|
788
|
+
}
|
|
789
|
+
function P(e) {
|
|
790
|
+
if (!b) return;
|
|
791
|
+
if (!b.ranging) {
|
|
792
|
+
Math.hypot(e.clientX - b.x, e.clientY - b.y) > De && L();
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
let t = document.elementFromPoint?.(e.clientX, e.clientY)?.closest?.("[data-mli-value]"), n = y(), r = t ? n.indexOf(t) : -1;
|
|
796
|
+
if (r < 0) return;
|
|
797
|
+
let [i, a] = r < b.anchor ? [r, b.anchor] : [b.anchor, r], o = new Set(b.base);
|
|
798
|
+
for (let e = i; e <= a; e++) {
|
|
799
|
+
let t = p.get(n[e]);
|
|
800
|
+
t !== void 0 && n[e].getAttribute("aria-disabled") !== "true" && o.add(t);
|
|
801
|
+
}
|
|
802
|
+
(o.size !== c.value.size || [...o].some((e) => !c.value.has(e))) && m([...o]);
|
|
803
|
+
}
|
|
804
|
+
function F() {
|
|
805
|
+
L();
|
|
806
|
+
}
|
|
807
|
+
function I() {
|
|
808
|
+
L();
|
|
809
|
+
}
|
|
810
|
+
function L() {
|
|
811
|
+
b && (clearTimeout(b.timer), b.ranging && (document.body.style.userSelect = ""), b = null, window.removeEventListener("pointermove", P), window.removeEventListener("pointerup", F), window.removeEventListener("pointercancel", I), C && setTimeout(() => {
|
|
812
|
+
C = !1;
|
|
813
|
+
}, 0));
|
|
814
|
+
}
|
|
815
|
+
function z(e) {
|
|
816
|
+
C && (C = !1, e.preventDefault(), e.stopPropagation());
|
|
817
|
+
}
|
|
818
|
+
function B(e) {
|
|
819
|
+
b?.ranging && e.preventDefault();
|
|
820
|
+
}
|
|
821
|
+
function V(e) {
|
|
822
|
+
n.multiSelect && b && e.preventDefault();
|
|
823
|
+
}
|
|
824
|
+
T(() => i.value?.addEventListener("touchmove", B, { passive: !1 })), w(() => {
|
|
825
|
+
L(), i.value?.removeEventListener("touchmove", B);
|
|
826
|
+
}), R(() => n.multiSelect, (e) => {
|
|
827
|
+
e || L();
|
|
828
|
+
});
|
|
829
|
+
let H = () => [...i.value?.querySelectorAll("[role=\"option\"]") ?? []].filter((e) => e.getAttribute("aria-disabled") !== "true");
|
|
830
|
+
function U(e) {
|
|
831
|
+
if (n.multiSelect && e.key === "Escape" && d.value) {
|
|
832
|
+
e.stopPropagation(), v();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
if (!n.selectable && !n.multiSelect) return;
|
|
836
|
+
let t = H(), r = t.indexOf(document.activeElement);
|
|
837
|
+
if (r < 0) return;
|
|
838
|
+
let i = e.key === "ArrowDown" ? t[r + 1] : e.key === "ArrowUp" ? t[r - 1] : e.key === "Home" ? t[0] : e.key === "End" ? t[t.length - 1] : void 0;
|
|
839
|
+
i && (e.preventDefault(), i.focus());
|
|
840
|
+
}
|
|
841
|
+
function W() {
|
|
842
|
+
if (!n.selectable && !n.multiSelect) return;
|
|
843
|
+
let e = H();
|
|
844
|
+
e.length && !e.some((e) => e.tabIndex === 0) && (e[0].tabIndex = 0);
|
|
845
|
+
}
|
|
846
|
+
T(W), D(() => x(W));
|
|
847
|
+
let G = l(() => [
|
|
848
|
+
"flex flex-col",
|
|
849
|
+
n.segmented ? "gap-0.5 p-2" : "py-2",
|
|
850
|
+
n.nav && !n.segmented && "gap-0.5 px-3"
|
|
851
|
+
]);
|
|
852
|
+
return (t, n) => (O(), f("ul", {
|
|
853
|
+
ref_key: "listEl",
|
|
854
|
+
ref: i,
|
|
855
|
+
role: e.selectable || e.multiSelect ? "listbox" : "list",
|
|
856
|
+
"aria-multiselectable": e.multiSelect || void 0,
|
|
857
|
+
class: S(G.value),
|
|
858
|
+
onKeydown: U,
|
|
859
|
+
onPointerdown: M,
|
|
860
|
+
onClickCapture: z,
|
|
861
|
+
onContextmenu: V
|
|
862
|
+
}, [j(t.$slots, "default")], 42, Te));
|
|
863
|
+
}
|
|
864
|
+
}), ke = [
|
|
865
|
+
"tabindex",
|
|
866
|
+
"aria-expanded",
|
|
867
|
+
"aria-controls",
|
|
868
|
+
"aria-disabled"
|
|
869
|
+
], Ae = { class: "min-w-0 flex-1" }, je = ["id"], Me = {
|
|
870
|
+
key: 1,
|
|
871
|
+
"data-mli-leading": "",
|
|
872
|
+
class: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary text-on-primary"
|
|
873
|
+
}, Ne = {
|
|
874
|
+
key: 2,
|
|
875
|
+
"data-mli-leading": "",
|
|
876
|
+
class: "contents"
|
|
877
|
+
}, Pe = ["src"], Fe = ["src"], Ie = { class: "min-w-0 flex-1" }, Le = 4, Re = 8, ze = 16, Be = "button, a, input, select, textarea, label, [role=\"button\"], [role=\"switch\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"link\"], [tabindex]", Ve = /* @__PURE__ */ g({
|
|
878
|
+
inheritAttrs: !1,
|
|
879
|
+
__name: "MListItem",
|
|
880
|
+
props: {
|
|
881
|
+
title: {},
|
|
882
|
+
overline: {},
|
|
883
|
+
subtitle: {},
|
|
884
|
+
description: {},
|
|
885
|
+
lines: {},
|
|
886
|
+
icon: {},
|
|
887
|
+
leading: {},
|
|
888
|
+
avatarName: {},
|
|
889
|
+
image: {},
|
|
890
|
+
iconContainerColor: {},
|
|
891
|
+
trailingIcon: {},
|
|
892
|
+
trailingText: {},
|
|
893
|
+
trailing: {},
|
|
894
|
+
trailingValue: { type: Boolean },
|
|
895
|
+
value: {},
|
|
896
|
+
active: {
|
|
897
|
+
type: Boolean,
|
|
898
|
+
default: !1
|
|
899
|
+
},
|
|
900
|
+
disabled: {
|
|
901
|
+
type: Boolean,
|
|
902
|
+
default: !1
|
|
903
|
+
},
|
|
904
|
+
clickable: { type: Boolean },
|
|
905
|
+
href: {},
|
|
906
|
+
to: {},
|
|
907
|
+
expandable: {
|
|
908
|
+
type: Boolean,
|
|
909
|
+
default: !1
|
|
910
|
+
},
|
|
911
|
+
expanded: { type: Boolean },
|
|
912
|
+
indent: {}
|
|
913
|
+
},
|
|
914
|
+
emits: [
|
|
915
|
+
"click",
|
|
916
|
+
"update:trailingValue",
|
|
917
|
+
"update:expanded"
|
|
918
|
+
],
|
|
919
|
+
setup(e, { emit: n }) {
|
|
920
|
+
let r = e, i = n, s = _(), m = () => !!s?.vnode.props?.onClick, g = A(r.expanded ?? !1);
|
|
921
|
+
R(() => r.expanded, (e) => {
|
|
922
|
+
e !== void 0 && (g.value = e);
|
|
923
|
+
});
|
|
924
|
+
let x = l(() => g.value), w = y("m-list", null), T = l(() => !!w?.multiSelect?.value && r.value != null && !r.href && !r.to && !r.expandable), E = l(() => T.value && !!w?.isChecked?.(r.value)), D = l(() => !!w?.selecting?.value), k = l(() => r.lines ? r.lines : w?.lines.value ? w.lines.value : r.description || r.overline && r.subtitle ? 3 : r.subtitle || r.overline ? 2 : 1), N = l(() => r.clickable || r.href || r.to || m() || w?.selectable.value || r.expandable || T.value), L = l(() => (!!w?.selectable.value || T.value) && r.value != null && !r.href && !r.to && !r.expandable), V = l(() => !!(r.href || r.to)), H = l(() => !L.value && !V.value && !r.expandable && (r.clickable || m())), U = l(() => V.value || H.value), W = l(() => L.value ? "option" : H.value ? "button" : V.value ? void 0 : "listitem"), ee = l(() => {
|
|
925
|
+
if (L.value && T.value) return -1;
|
|
926
|
+
if (L.value) return K.value && !r.disabled ? 0 : -1;
|
|
927
|
+
if (H.value) return r.disabled ? -1 : 0;
|
|
928
|
+
});
|
|
929
|
+
function te(e) {
|
|
930
|
+
(L.value || H.value) && (e.key !== "Enter" && e.key !== " " || e.target !== e.currentTarget || (e.preventDefault(), T.value && !r.disabled && (e.key === " " || D.value) ? D.value ? w.toggle(r.value) : w.enterSelection(r.value) : Ge(e)));
|
|
931
|
+
}
|
|
932
|
+
let K = l(() => r.active ? !0 : T.value ? E.value : w?.selectable.value && r.value != null ? w.selected.value === r.value : !1), q = l(() => r.leading ? r.leading : r.icon ? "icon" : r.avatarName ? "avatar" : r.image ? "image" : null), J = l(() => r.expandable ? "expand" : r.trailing ? r.trailing : r.trailingIcon ? "icon" : r.trailingText ? "text" : null), Y = {
|
|
933
|
+
primary: "bg-primary-container text-on-primary-container",
|
|
934
|
+
secondary: "bg-secondary-container text-on-secondary-container",
|
|
935
|
+
tertiary: "bg-tertiary-container text-on-tertiary-container",
|
|
936
|
+
error: "bg-error-container text-on-error-container",
|
|
937
|
+
success: "bg-success-container text-on-success-container"
|
|
938
|
+
}, ne = l(() => w?.dense.value ?? !1), re = l(() => w?.nav.value ?? !1), ie = l(() => w?.segmented.value ?? !1), ae = l(() => w?.dividers.value ?? !1), oe = l(() => K.value ? "text-on-secondary-container" : "text-on-surface"), X = l(() => K.value ? "text-on-secondary-container" : "text-on-surface-variant"), se = l(() => ne.value ? "" : k.value === 3 ? "min-h-22" : k.value === 2 ? "min-h-18" : "min-h-14"), ce = l(() => [
|
|
939
|
+
"mli-row relative flex w-full items-center gap-4 text-start",
|
|
940
|
+
ie.value ? "bg-surface-container px-4" : re.value ? "rounded-full px-4" : "px-4",
|
|
941
|
+
ne.value ? "py-1" : k.value === 3 ? "py-3" : "py-2",
|
|
942
|
+
se.value,
|
|
943
|
+
N.value && !r.disabled && "cursor-pointer",
|
|
944
|
+
K.value && "bg-secondary-container text-on-secondary-container",
|
|
945
|
+
r.disabled && "opacity-[0.38] pointer-events-none"
|
|
946
|
+
]), Z = A(null), ue = A(null), de = (e, { slots: t }) => U.value ? v("li", {
|
|
947
|
+
role: "listitem",
|
|
948
|
+
ref: (e) => {
|
|
949
|
+
ue.value = e;
|
|
950
|
+
}
|
|
951
|
+
}, t.default?.()) : t.default?.(), fe = A(null), pe = (e) => e && "$el" in e ? e.$el : e, me = A(!1), Q = A(!1), he = A(!1), ge = l(() => ie.value ? w?.segmentPosition(U.value ? ue.value : pe(Z.value)) : void 0), _e = l(() => {
|
|
952
|
+
if (re.value) return [];
|
|
953
|
+
let e = N.value && !r.disabled, t = e && Q.value || K.value || e && he.value ? ze : e && me.value ? Re : null;
|
|
954
|
+
if (t !== null) return [
|
|
955
|
+
t,
|
|
956
|
+
t,
|
|
957
|
+
t,
|
|
958
|
+
t
|
|
959
|
+
];
|
|
960
|
+
let n = ge.value, i = n === "first" || n === "single" ? ze : Le, a = n === "last" || n === "single" ? ze : Le;
|
|
961
|
+
return [
|
|
962
|
+
i,
|
|
963
|
+
i,
|
|
964
|
+
a,
|
|
965
|
+
a
|
|
966
|
+
];
|
|
967
|
+
}), { snap: ve } = o(() => _e.value, (e) => {
|
|
968
|
+
let t = fe.value ?? pe(Z.value);
|
|
969
|
+
t && (t.style.borderRadius = e.length ? e.map((e) => `${e}px`).join(" ") : "");
|
|
970
|
+
});
|
|
971
|
+
R([ge, re], () => ve());
|
|
972
|
+
function ye(e) {
|
|
973
|
+
let t = e.currentTarget, n = e.target?.closest?.(Be);
|
|
974
|
+
return !!n && n !== t && t.contains(n) && !n.closest("[data-mli-part]");
|
|
975
|
+
}
|
|
976
|
+
function be(e) {
|
|
977
|
+
e.pointerType !== "touch" && (me.value = !ye(e));
|
|
978
|
+
}
|
|
979
|
+
function $() {
|
|
980
|
+
me.value = !1, Q.value = !1;
|
|
981
|
+
}
|
|
982
|
+
function xe(e) {
|
|
983
|
+
e.button === 0 && !ye(e) && (Q.value = !0);
|
|
984
|
+
}
|
|
985
|
+
function Se() {
|
|
986
|
+
Q.value = !1;
|
|
987
|
+
}
|
|
988
|
+
let we = l(() => !N.value || r.disabled ? 0 : Q.value || he.value ? .1 : me.value ? .08 : 0), Te = l(() => r.indent === void 0 ? void 0 : { paddingInlineStart: typeof r.indent == "number" ? `${r.indent}px` : r.indent });
|
|
989
|
+
function Ee(e) {
|
|
990
|
+
he.value = e.currentTarget.matches(":focus-visible");
|
|
991
|
+
}
|
|
992
|
+
function De() {
|
|
993
|
+
he.value = !1;
|
|
994
|
+
}
|
|
995
|
+
let Oe = l(() => r.href ? "a" : r.to ? "router-link" : H.value ? "div" : "li"), Ve = l(() => r.href ? { href: r.href } : r.to ? { to: r.to } : {}), He = I();
|
|
996
|
+
function Ue(e) {
|
|
997
|
+
(e.key === "Enter" || e.key === " ") && e.target === e.currentTarget && (e.preventDefault(), Ge(e));
|
|
998
|
+
}
|
|
999
|
+
function We(e) {
|
|
1000
|
+
r.disabled || (g.value = !g.value, i("update:expanded", g.value), i("click", e));
|
|
1001
|
+
}
|
|
1002
|
+
function Ge(e) {
|
|
1003
|
+
if (!r.disabled) {
|
|
1004
|
+
if (r.expandable) {
|
|
1005
|
+
if (ye(e)) return;
|
|
1006
|
+
We(e);
|
|
1007
|
+
} else {
|
|
1008
|
+
if (T.value) {
|
|
1009
|
+
if (D.value) {
|
|
1010
|
+
w.toggle(r.value);
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (e.target?.closest?.("[data-mli-leading]")) {
|
|
1014
|
+
w.enterSelection(r.value);
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
w?.selectable.value && r.value != null && w.select(r.value), i("click", e);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
R([
|
|
1023
|
+
Z,
|
|
1024
|
+
() => r.value,
|
|
1025
|
+
T
|
|
1026
|
+
], ([e, t, n], r, i) => {
|
|
1027
|
+
if (!e || t == null || !n || !w?.register) return;
|
|
1028
|
+
let a = e;
|
|
1029
|
+
w.register(a, t), i(() => w.unregister?.(a));
|
|
1030
|
+
}, {
|
|
1031
|
+
immediate: !0,
|
|
1032
|
+
flush: "post"
|
|
1033
|
+
});
|
|
1034
|
+
function Ke() {
|
|
1035
|
+
i("update:trailingValue", !r.trailingValue);
|
|
1036
|
+
}
|
|
1037
|
+
return (n, r) => e.expandable ? (O(), f("li", b({
|
|
1038
|
+
key: 0,
|
|
1039
|
+
ref_key: "rootEl",
|
|
1040
|
+
ref: Z
|
|
1041
|
+
}, n.$attrs, { role: "listitem" }), [B((O(), f("div", {
|
|
1042
|
+
ref_key: "shapeEl",
|
|
1043
|
+
ref: fe,
|
|
1044
|
+
role: "button",
|
|
1045
|
+
tabindex: e.disabled ? -1 : 0,
|
|
1046
|
+
"aria-expanded": x.value,
|
|
1047
|
+
"aria-controls": F(He),
|
|
1048
|
+
"aria-disabled": e.disabled || void 0,
|
|
1049
|
+
class: S(["focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", ce.value]),
|
|
1050
|
+
onClick: Ge,
|
|
1051
|
+
onKeydown: Ue,
|
|
1052
|
+
onFocus: Ee,
|
|
1053
|
+
onBlur: De,
|
|
1054
|
+
onPointerenter: be,
|
|
1055
|
+
onPointermove: be,
|
|
1056
|
+
onPointerleave: $,
|
|
1057
|
+
onPointerdown: xe,
|
|
1058
|
+
onPointerup: Se,
|
|
1059
|
+
onPointercancel: Se
|
|
1060
|
+
}, [
|
|
1061
|
+
p("span", {
|
|
1062
|
+
class: S(["mli-state-layer pointer-events-none absolute inset-0 rounded-[inherit]", K.value ? "bg-on-secondary-container" : "bg-on-surface"]),
|
|
1063
|
+
style: C({ opacity: we.value }),
|
|
1064
|
+
"aria-hidden": "true"
|
|
1065
|
+
}, null, 6),
|
|
1066
|
+
j(n.$slots, "leading", {}, () => [q.value === "icon" ? (O(), u(t, {
|
|
1067
|
+
key: 0,
|
|
1068
|
+
name: e.icon,
|
|
1069
|
+
size: 24,
|
|
1070
|
+
class: S(["shrink-0", X.value])
|
|
1071
|
+
}, null, 8, ["name", "class"])) : d("", !0)]),
|
|
1072
|
+
p("div", Ae, [j(n.$slots, "overline", {}, () => [e.overline ? (O(), f("p", {
|
|
1073
|
+
key: 0,
|
|
1074
|
+
class: S(["truncate text-label-small", X.value])
|
|
1075
|
+
}, P(e.overline), 3)) : d("", !0)]), j(n.$slots, "default", {}, () => [p("p", { class: S(["truncate text-body-large", oe.value]) }, P(e.title), 3), e.subtitle && k.value >= 2 ? (O(), f("p", {
|
|
1076
|
+
key: 0,
|
|
1077
|
+
class: S(["text-body-medium", [X.value, k.value === 2 && "truncate"]])
|
|
1078
|
+
}, P(e.subtitle), 3)) : d("", !0)])]),
|
|
1079
|
+
j(n.$slots, "trailing"),
|
|
1080
|
+
h(t, {
|
|
1081
|
+
name: x.value ? "expand_less" : "expand_more",
|
|
1082
|
+
size: 20,
|
|
1083
|
+
class: S(["shrink-0", X.value])
|
|
1084
|
+
}, null, 8, ["name", "class"])
|
|
1085
|
+
], 42, ke)), [[F(a), { disabled: e.disabled }]]), h(c, { name: "mli-expand" }, {
|
|
1086
|
+
default: z(() => [x.value ? (O(), f("div", {
|
|
1087
|
+
key: 0,
|
|
1088
|
+
id: F(He),
|
|
1089
|
+
class: "mli-expand-grid"
|
|
1090
|
+
}, [p("div", {
|
|
1091
|
+
class: "mli-expand-body",
|
|
1092
|
+
style: C(Te.value)
|
|
1093
|
+
}, [j(n.$slots, "children")], 4)], 8, je)) : d("", !0)]),
|
|
1094
|
+
_: 3
|
|
1095
|
+
})], 16)) : (O(), u(de, { key: 1 }, {
|
|
1096
|
+
default: z(() => [B((O(), u(M(Oe.value), b({
|
|
1097
|
+
class: ce.value,
|
|
1098
|
+
ref_key: "rootEl",
|
|
1099
|
+
ref: Z
|
|
1100
|
+
}, {
|
|
1101
|
+
...Ve.value,
|
|
1102
|
+
...n.$attrs
|
|
1103
|
+
}, {
|
|
1104
|
+
role: W.value,
|
|
1105
|
+
tabindex: ee.value,
|
|
1106
|
+
"data-mli-value": T.value ? "" : void 0,
|
|
1107
|
+
"aria-selected": L.value ? K.value : void 0,
|
|
1108
|
+
"aria-disabled": (L.value || H.value) && e.disabled ? "true" : void 0,
|
|
1109
|
+
onClick: Ge,
|
|
1110
|
+
onKeydown: te,
|
|
1111
|
+
onPointerenter: be,
|
|
1112
|
+
onPointermove: be,
|
|
1113
|
+
onPointerleave: $,
|
|
1114
|
+
onPointerdown: xe,
|
|
1115
|
+
onPointerup: Se,
|
|
1116
|
+
onPointercancel: Se,
|
|
1117
|
+
onFocus: Ee,
|
|
1118
|
+
onBlur: De
|
|
1119
|
+
}), {
|
|
1120
|
+
default: z(() => [
|
|
1121
|
+
p("span", {
|
|
1122
|
+
class: S(["mli-state-layer pointer-events-none absolute inset-0 rounded-[inherit]", K.value ? "bg-on-secondary-container" : "bg-on-surface"]),
|
|
1123
|
+
style: C({ opacity: we.value }),
|
|
1124
|
+
"aria-hidden": "true"
|
|
1125
|
+
}, null, 6),
|
|
1126
|
+
ae.value ? (O(), f("div", {
|
|
1127
|
+
key: 0,
|
|
1128
|
+
class: S(["absolute top-0 end-0 h-px bg-outline-variant", ae.value === "inset" ? "start-16" : "start-0"])
|
|
1129
|
+
}, null, 2)) : d("", !0),
|
|
1130
|
+
T.value && E.value && q.value && q.value !== "checkbox" && q.value !== "radio" && !n.$slots.leading ? (O(), f("span", Me, [h(t, {
|
|
1131
|
+
name: "check",
|
|
1132
|
+
size: 24
|
|
1133
|
+
})])) : T.value ? (O(), f("span", Ne, [j(n.$slots, "leading", {
|
|
1134
|
+
checked: E.value,
|
|
1135
|
+
selecting: D.value
|
|
1136
|
+
}, () => [q.value === "icon" ? (O(), u(t, {
|
|
1137
|
+
key: 0,
|
|
1138
|
+
name: e.icon,
|
|
1139
|
+
size: 24,
|
|
1140
|
+
class: S(["shrink-0", X.value])
|
|
1141
|
+
}, null, 8, ["name", "class"])) : q.value === "icon-container" ? (O(), f("div", {
|
|
1142
|
+
key: 1,
|
|
1143
|
+
class: S(["flex h-10 w-10 shrink-0 items-center justify-center rounded-full", Y[e.iconContainerColor || "primary"]])
|
|
1144
|
+
}, [h(t, {
|
|
1145
|
+
name: e.icon,
|
|
1146
|
+
size: 24
|
|
1147
|
+
}, null, 8, ["name"])], 2)) : q.value === "avatar" ? (O(), u(G, {
|
|
1148
|
+
key: 2,
|
|
1149
|
+
name: e.avatarName,
|
|
1150
|
+
size: 40,
|
|
1151
|
+
class: "shrink-0"
|
|
1152
|
+
}, null, 8, ["name"])) : q.value === "image" ? (O(), f("img", {
|
|
1153
|
+
key: 3,
|
|
1154
|
+
src: e.image,
|
|
1155
|
+
alt: "",
|
|
1156
|
+
class: "h-14 w-14 shrink-0 rounded-md object-cover"
|
|
1157
|
+
}, null, 8, Pe)) : q.value === "checkbox" ? (O(), u(le, {
|
|
1158
|
+
key: 4,
|
|
1159
|
+
"model-value": E.value,
|
|
1160
|
+
class: "shrink-0",
|
|
1161
|
+
"data-mli-part": ""
|
|
1162
|
+
}, null, 8, ["model-value"])) : d("", !0)])])) : j(n.$slots, "leading", {
|
|
1163
|
+
checked: !1,
|
|
1164
|
+
selecting: !1
|
|
1165
|
+
}, () => [q.value === "icon" ? (O(), u(t, {
|
|
1166
|
+
key: 0,
|
|
1167
|
+
name: e.icon,
|
|
1168
|
+
size: 24,
|
|
1169
|
+
class: S(["shrink-0", X.value])
|
|
1170
|
+
}, null, 8, ["name", "class"])) : q.value === "icon-container" ? (O(), f("div", {
|
|
1171
|
+
key: 1,
|
|
1172
|
+
class: S(["flex h-10 w-10 shrink-0 items-center justify-center rounded-full", Y[e.iconContainerColor || "primary"]])
|
|
1173
|
+
}, [h(t, {
|
|
1174
|
+
name: e.icon,
|
|
1175
|
+
size: 24
|
|
1176
|
+
}, null, 8, ["name"])], 2)) : q.value === "avatar" ? (O(), u(G, {
|
|
1177
|
+
key: 2,
|
|
1178
|
+
name: e.avatarName,
|
|
1179
|
+
size: 40,
|
|
1180
|
+
class: "shrink-0"
|
|
1181
|
+
}, null, 8, ["name"])) : q.value === "image" ? (O(), f("img", {
|
|
1182
|
+
key: 3,
|
|
1183
|
+
src: e.image,
|
|
1184
|
+
alt: "",
|
|
1185
|
+
class: "h-14 w-14 shrink-0 rounded-md object-cover"
|
|
1186
|
+
}, null, 8, Fe)) : q.value === "checkbox" ? (O(), u(le, {
|
|
1187
|
+
key: 4,
|
|
1188
|
+
"model-value": K.value,
|
|
1189
|
+
class: "shrink-0",
|
|
1190
|
+
"data-mli-part": ""
|
|
1191
|
+
}, null, 8, ["model-value"])) : d("", !0)], void 0, 3),
|
|
1192
|
+
p("div", Ie, [j(n.$slots, "overline", {}, () => [e.overline ? (O(), f("p", {
|
|
1193
|
+
key: 0,
|
|
1194
|
+
class: S(["truncate text-label-small", X.value])
|
|
1195
|
+
}, P(e.overline), 3)) : d("", !0)]), j(n.$slots, "default", {}, () => [
|
|
1196
|
+
p("p", { class: S(["truncate text-body-large", oe.value]) }, P(e.title), 3),
|
|
1197
|
+
e.subtitle && k.value >= 2 ? (O(), f("p", {
|
|
1198
|
+
key: 0,
|
|
1199
|
+
class: S(["text-body-medium", [X.value, k.value === 2 && "truncate"]])
|
|
1200
|
+
}, P(e.subtitle), 3)) : d("", !0),
|
|
1201
|
+
e.description && k.value >= 3 ? (O(), f("p", {
|
|
1202
|
+
key: 1,
|
|
1203
|
+
class: S(["line-clamp-2 text-body-small", X.value])
|
|
1204
|
+
}, P(e.description), 3)) : d("", !0)
|
|
1205
|
+
])]),
|
|
1206
|
+
j(n.$slots, "trailing", {}, () => [J.value === "icon" ? (O(), u(t, {
|
|
1207
|
+
key: 0,
|
|
1208
|
+
name: e.trailingIcon,
|
|
1209
|
+
size: 24,
|
|
1210
|
+
class: S(["shrink-0", X.value])
|
|
1211
|
+
}, null, 8, ["name", "class"])) : J.value === "text" ? (O(), f("span", {
|
|
1212
|
+
key: 1,
|
|
1213
|
+
class: S(["shrink-0 text-label-small", X.value])
|
|
1214
|
+
}, P(e.trailingText), 3)) : J.value === "switch" ? (O(), u(Ce, {
|
|
1215
|
+
key: 2,
|
|
1216
|
+
"model-value": !!e.trailingValue,
|
|
1217
|
+
"onUpdate:modelValue": Ke
|
|
1218
|
+
}, null, 8, ["model-value"])) : J.value === "checkbox" ? (O(), u(le, {
|
|
1219
|
+
key: 3,
|
|
1220
|
+
"model-value": !!e.trailingValue,
|
|
1221
|
+
"onUpdate:modelValue": Ke
|
|
1222
|
+
}, null, 8, ["model-value"])) : d("", !0)])
|
|
1223
|
+
]),
|
|
1224
|
+
_: 3
|
|
1225
|
+
}, 16, [
|
|
1226
|
+
"class",
|
|
1227
|
+
"role",
|
|
1228
|
+
"tabindex",
|
|
1229
|
+
"data-mli-value",
|
|
1230
|
+
"aria-selected",
|
|
1231
|
+
"aria-disabled"
|
|
1232
|
+
])), [[F(a), N.value ? { disabled: e.disabled } : !1]])]),
|
|
1233
|
+
_: 3
|
|
1234
|
+
}));
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
export { Q as a, G as c, Ce as i, W as l, Oe as n, le as o, we as r, ie as s, Ve as t };
|
|
1238
|
+
|
|
1239
|
+
//# sourceMappingURL=MListItem-h9H223vx.js.map
|