@m3ui-vue/m3ui-vue 1.1.3 → 1.1.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 +1 -1
- package/dist/API.md +70 -8
- package/dist/{MMenuItem-BckcR0nW.js → MMenuItem-BfjqwcYP.js} +84 -63
- package/dist/MMenuItem-BfjqwcYP.js.map +1 -0
- package/dist/MSlider-JflHJ70q.js +1525 -0
- package/dist/MSlider-JflHJ70q.js.map +1 -0
- package/dist/{MTextField-FCPOTB0o.js → MTextField-NaIB6RbM.js} +5 -4
- package/dist/MTextField-NaIB6RbM.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAnimatedNumber.vue.d.ts +3 -1
- package/dist/components/MButton.vue.d.ts +2 -0
- package/dist/components/MContainerTransform.vue.d.ts +59 -0
- package/dist/components/MDialog.vue.d.ts +8 -5
- package/dist/components/MFlex.vue.d.ts +1 -1
- package/dist/components/MIconButton.vue.d.ts +2 -0
- package/dist/components/MListItem.vue.d.ts +5 -5
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +1 -1
- package/dist/components/MToolbar.vue.d.ts +32 -5
- package/dist/components/_MToolbarFab.vue.d.ts +16 -0
- package/dist/composables/_containerTransform.d.ts +48 -0
- package/dist/composables/useContainerTransform.d.ts +30 -0
- package/dist/composables/useLocale.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/locales/index.js +14 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +4217 -3713
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +38 -38
- package/dist/rich-text-editor.js +10 -10
- package/dist/styles.css +1 -1
- package/dist/{useLocale-SfQHnJfp.js → useLocale-CXibICQA.js} +3 -1
- package/dist/useLocale-CXibICQA.js.map +1 -0
- package/package.json +2 -1
- package/src/__tests__/MAnimatedNumber.test.ts +24 -2
- package/src/__tests__/MContainerTransform.test.ts +279 -0
- package/src/__tests__/MDialog.test.ts +27 -0
- package/src/__tests__/MListItemExpandable.test.ts +48 -0
- package/src/__tests__/MListItemShape.test.ts +9 -6
- package/src/__tests__/MListKeyboard.test.ts +90 -0
- package/src/__tests__/MMapTools.test.ts +2 -1
- package/src/__tests__/MNavigationRail.test.ts +33 -0
- package/src/__tests__/MSlider.test.ts +161 -0
- package/src/__tests__/MToolbar.test.ts +157 -0
- package/src/__tests__/attrsFallthrough.test.ts +6 -0
- package/src/__tests__/hydration.test.ts +25 -0
- package/src/components/MAnimatedNumber.vue +32 -6
- package/src/components/MButton.vue +4 -2
- package/src/components/MContainerTransform.vue +321 -0
- package/src/components/MDialog.vue +31 -6
- package/src/components/MFab.vue +10 -5
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MList.vue +26 -2
- package/src/components/MListItem.vue +138 -84
- package/src/components/MNavigationRail.vue +40 -10
- package/src/components/MSlider.vue +161 -42
- package/src/components/MToolbar.vue +256 -15
- package/src/components/_MToolbarFab.vue +14 -0
- package/src/composables/_containerTransform.ts +179 -0
- package/src/composables/_useEscapeStack.ts +2 -0
- package/src/composables/useContainerTransform.ts +59 -0
- package/src/composables/useLocale.ts +5 -0
- package/src/index.ts +3 -0
- package/src/locales/de.ts +2 -0
- package/src/locales/es.ts +2 -0
- package/src/locales/fr.ts +2 -0
- package/src/locales/ja.ts +2 -0
- package/src/locales/ko.ts +2 -0
- package/src/locales/pt.ts +2 -0
- package/src/locales/zh.ts +2 -0
- package/dist/MMenuItem-BckcR0nW.js.map +0 -1
- package/dist/MSlider-LyH_gy8D.js +0 -1411
- package/dist/MSlider-LyH_gy8D.js.map +0 -1
- package/dist/MTextField-FCPOTB0o.js.map +0 -1
- package/dist/useLocale-SfQHnJfp.js.map +0 -1
|
@@ -0,0 +1,1525 @@
|
|
|
1
|
+
import { i as e } from "./useLocale-CXibICQA.js";
|
|
2
|
+
import { a as t, c as n, o as r } from "./MTextField-NaIB6RbM.js";
|
|
3
|
+
import { t as i } from "./MIcon-Bxh9j135.js";
|
|
4
|
+
import { Fragment as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, getCurrentInstance as h, h as g, inject as _, mergeProps as v, nextTick as y, normalizeClass as b, normalizeStyle as x, onBeforeUnmount as S, onMounted as C, onUnmounted as w, onUpdated as T, openBlock as E, provide as D, ref as O, renderList as k, renderSlot as A, resolveDynamicComponent as ee, shallowRef as j, toDisplayString as M, unref as te, useId as N, useSlots as P, watch as F, withCtx as ne, withModifiers as I } from "vue";
|
|
5
|
+
//#region src/composables/_storageKeys.ts
|
|
6
|
+
var L = "m3-theme", R = "m3-dynamic-palette", z = "m3-viewport", re = /* @__PURE__ */ m({
|
|
7
|
+
__name: "MAvatar",
|
|
8
|
+
props: {
|
|
9
|
+
name: {},
|
|
10
|
+
fallback: {},
|
|
11
|
+
size: { default: 40 }
|
|
12
|
+
},
|
|
13
|
+
setup(e) {
|
|
14
|
+
let t = e, n = s(() => {
|
|
15
|
+
if (t.name) {
|
|
16
|
+
let e = t.name.trim().split(/\s+/).filter(Boolean);
|
|
17
|
+
return ((e[0]?.[0] ?? "") + (e.length > 1 ? e[e.length - 1]?.[0] ?? "" : "")).toUpperCase() || t.fallback || "?";
|
|
18
|
+
}
|
|
19
|
+
return t.fallback || "?";
|
|
20
|
+
});
|
|
21
|
+
return (t, r) => (E(), u("div", {
|
|
22
|
+
class: "inline-flex shrink-0 items-center justify-center rounded-full bg-primary-container font-medium text-on-primary-container",
|
|
23
|
+
style: x({
|
|
24
|
+
width: `${e.size}px`,
|
|
25
|
+
height: `${e.size}px`,
|
|
26
|
+
fontSize: `${Math.round(e.size * .4)}px`
|
|
27
|
+
})
|
|
28
|
+
}, M(n.value), 5));
|
|
29
|
+
}
|
|
30
|
+
}), B = 1e3 / 60, ie = .004;
|
|
31
|
+
function ae(e, t, n, r, i) {
|
|
32
|
+
let a = [e], o = e, s = n, c = 2 * r.dampingRatio * Math.sqrt(r.stiffness);
|
|
33
|
+
for (let e = 0; e < 600; e++) {
|
|
34
|
+
for (let e = B / 1e3; e > 1e-9; e -= ie) {
|
|
35
|
+
let n = Math.min(ie, e);
|
|
36
|
+
s += (-r.stiffness * (o - t) - c * s) * n, o += s * n;
|
|
37
|
+
}
|
|
38
|
+
if (a.push(o), Math.abs(o - t) < i && Math.abs(s) < i * 10) break;
|
|
39
|
+
}
|
|
40
|
+
return a[a.length - 1] = t, a;
|
|
41
|
+
}
|
|
42
|
+
function oe(e, t) {
|
|
43
|
+
let n = Number(t ?? 0) / B, r = Math.floor(n);
|
|
44
|
+
return r >= e.length - 1 ? e[e.length - 1] : r < 0 ? e[0] : e[r] + (e[r + 1] - e[r]) * (n - r);
|
|
45
|
+
}
|
|
46
|
+
var se = (e) => (e.length - 1) * B;
|
|
47
|
+
function ce(e, t, n, r = 0) {
|
|
48
|
+
if (!e || typeof e.animate != "function" || t.length < 2) return null;
|
|
49
|
+
let i = e.animate(t.map(n), {
|
|
50
|
+
duration: se(t),
|
|
51
|
+
delay: r,
|
|
52
|
+
easing: "linear"
|
|
53
|
+
});
|
|
54
|
+
return i.finished.catch(() => {}), i;
|
|
55
|
+
}
|
|
56
|
+
var le = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, V = [
|
|
57
|
+
"role",
|
|
58
|
+
"tabindex",
|
|
59
|
+
"aria-disabled"
|
|
60
|
+
], ue = ["src", "alt"], H = {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "px-4 pt-4 pb-2"
|
|
63
|
+
}, de = {
|
|
64
|
+
key: 2,
|
|
65
|
+
class: "px-4 pt-4 pb-2"
|
|
66
|
+
}, U = { class: "text-title-large font-medium text-on-surface" }, fe = {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "mt-1 text-body-medium text-on-surface-variant"
|
|
69
|
+
}, pe = {
|
|
70
|
+
key: 3,
|
|
71
|
+
class: "flex justify-end gap-2 px-4 pt-2 pb-4"
|
|
72
|
+
}, W = "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] active:before:opacity-[0.12]", G = /* @__PURE__ */ m({
|
|
73
|
+
__name: "MCard",
|
|
74
|
+
props: {
|
|
75
|
+
variant: { default: "elevated" },
|
|
76
|
+
clickable: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: !1
|
|
79
|
+
},
|
|
80
|
+
elevated: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1
|
|
83
|
+
},
|
|
84
|
+
disabled: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: !1
|
|
87
|
+
},
|
|
88
|
+
image: {},
|
|
89
|
+
imageAlt: {},
|
|
90
|
+
imageHeight: {},
|
|
91
|
+
title: {},
|
|
92
|
+
subtitle: {}
|
|
93
|
+
},
|
|
94
|
+
setup(e) {
|
|
95
|
+
let t = e, n = s(() => t.elevated ? "elevated" : t.variant), r = {
|
|
96
|
+
elevated: "var(--color-surface-container-low)",
|
|
97
|
+
filled: "var(--color-surface-container-highest)",
|
|
98
|
+
outlined: "var(--color-surface)"
|
|
99
|
+
}, i = s(() => (t.disabled ? {
|
|
100
|
+
elevated: "bg-surface/38 shadow-none",
|
|
101
|
+
filled: "bg-surface-variant/38",
|
|
102
|
+
outlined: "bg-surface border border-outline/12"
|
|
103
|
+
} : {
|
|
104
|
+
elevated: "bg-surface-container-low shadow-elevation-1",
|
|
105
|
+
filled: "bg-surface-container-highest",
|
|
106
|
+
outlined: "bg-surface border border-outline-variant"
|
|
107
|
+
})[n.value]), a = {
|
|
108
|
+
elevated: "hover:shadow-elevation-2 active:shadow-elevation-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary",
|
|
109
|
+
filled: "hover:shadow-elevation-1 active:shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-secondary",
|
|
110
|
+
outlined: "hover:shadow-elevation-1 active:shadow-none focus-visible:outline-none focus-visible:border-on-surface"
|
|
111
|
+
}, o = s(() => t.clickable && !t.disabled);
|
|
112
|
+
function c(e) {
|
|
113
|
+
o.value && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.click());
|
|
114
|
+
}
|
|
115
|
+
return (t, s) => (E(), u("div", {
|
|
116
|
+
class: b(["overflow-hidden rounded-md transition-shadow duration-150", [
|
|
117
|
+
i.value,
|
|
118
|
+
o.value ? [
|
|
119
|
+
"cursor-pointer",
|
|
120
|
+
a[n.value],
|
|
121
|
+
W
|
|
122
|
+
] : "",
|
|
123
|
+
e.disabled ? "cursor-not-allowed pointer-events-none" : ""
|
|
124
|
+
]]),
|
|
125
|
+
style: x({ "--field-bg": r[n.value] }),
|
|
126
|
+
role: e.clickable ? "button" : void 0,
|
|
127
|
+
tabindex: o.value ? 0 : void 0,
|
|
128
|
+
"aria-disabled": e.clickable && e.disabled ? "true" : void 0,
|
|
129
|
+
onKeydown: c
|
|
130
|
+
}, [
|
|
131
|
+
e.image || t.$slots.media ? (E(), u("div", {
|
|
132
|
+
key: 0,
|
|
133
|
+
class: b(["w-full overflow-hidden", e.imageHeight ?? "h-48"])
|
|
134
|
+
}, [e.image ? (E(), u("img", {
|
|
135
|
+
key: 0,
|
|
136
|
+
src: e.image,
|
|
137
|
+
alt: e.imageAlt ?? "",
|
|
138
|
+
class: "h-full w-full object-cover"
|
|
139
|
+
}, null, 8, ue)) : A(t.$slots, "media", {}, void 0, void 0, 1)], 2)) : l("", !0),
|
|
140
|
+
t.$slots.header ? (E(), u("div", H, [A(t.$slots, "header")])) : e.title ? (E(), u("div", de, [d("h3", U, M(e.title), 1), e.subtitle ? (E(), u("p", fe, M(e.subtitle), 1)) : l("", !0)])) : l("", !0),
|
|
141
|
+
A(t.$slots, "default"),
|
|
142
|
+
t.$slots.actions ? (E(), u("div", pe, [A(t.$slots, "actions")])) : l("", !0)
|
|
143
|
+
], 46, V));
|
|
144
|
+
}
|
|
145
|
+
}), K = { class: "relative -m-[11px] inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full" }, me = [
|
|
146
|
+
"checked",
|
|
147
|
+
"disabled",
|
|
148
|
+
"aria-label"
|
|
149
|
+
], he = {
|
|
150
|
+
key: 1,
|
|
151
|
+
class: "pointer-events-none absolute inset-0 rounded-full ring-0 ring-secondary transition-[box-shadow] duration-150 peer-focus-visible:ring-2"
|
|
152
|
+
}, q = /* @__PURE__ */ m({
|
|
153
|
+
__name: "MCheckbox",
|
|
154
|
+
props: {
|
|
155
|
+
modelValue: { type: Boolean },
|
|
156
|
+
indeterminate: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: !1
|
|
159
|
+
},
|
|
160
|
+
disabled: {
|
|
161
|
+
type: Boolean,
|
|
162
|
+
default: !1
|
|
163
|
+
},
|
|
164
|
+
label: {},
|
|
165
|
+
color: { default: "primary" },
|
|
166
|
+
ariaLabel: {}
|
|
167
|
+
},
|
|
168
|
+
emits: ["update:modelValue"],
|
|
169
|
+
setup(e, { emit: t }) {
|
|
170
|
+
let n = t, r = {
|
|
171
|
+
primary: "border-primary bg-primary text-on-primary",
|
|
172
|
+
secondary: "border-secondary bg-secondary text-on-secondary",
|
|
173
|
+
tertiary: "border-tertiary bg-tertiary text-on-tertiary",
|
|
174
|
+
error: "border-error bg-error text-on-error"
|
|
175
|
+
}, a = {
|
|
176
|
+
primary: "bg-primary",
|
|
177
|
+
secondary: "bg-secondary",
|
|
178
|
+
tertiary: "bg-tertiary",
|
|
179
|
+
error: "bg-error"
|
|
180
|
+
};
|
|
181
|
+
return (t, o) => (E(), u("label", { class: b(["group inline-flex items-center gap-2 select-none", e.disabled ? "cursor-not-allowed" : "cursor-pointer"]) }, [d("span", K, [
|
|
182
|
+
d("input", {
|
|
183
|
+
type: "checkbox",
|
|
184
|
+
class: "peer sr-only",
|
|
185
|
+
checked: e.modelValue,
|
|
186
|
+
disabled: e.disabled,
|
|
187
|
+
"aria-label": e.ariaLabel,
|
|
188
|
+
onChange: o[0] ||= (t) => n("update:modelValue", !e.modelValue)
|
|
189
|
+
}, null, 40, me),
|
|
190
|
+
e.disabled ? l("", !0) : (E(), u("span", {
|
|
191
|
+
key: 0,
|
|
192
|
+
class: b(["pointer-events-none absolute inset-0 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] group-active:opacity-[0.12]", e.modelValue || e.indeterminate ? a[e.color] : "bg-on-surface"])
|
|
193
|
+
}, null, 2)),
|
|
194
|
+
e.disabled ? l("", !0) : (E(), u("span", he)),
|
|
195
|
+
d("span", { class: b(["relative inline-flex h-4.5 w-4.5 items-center justify-center rounded-[2px] border-2 transition-colors", e.disabled ? e.modelValue || e.indeterminate ? "border-on-surface/38 bg-on-surface/38 text-surface" : "border-on-surface/38 text-transparent" : e.modelValue || e.indeterminate ? r[e.color] : "border-on-surface-variant text-transparent group-hover:border-on-surface group-active:border-on-surface"]) }, [p(i, {
|
|
196
|
+
name: e.indeterminate ? "remove" : "check",
|
|
197
|
+
size: 18,
|
|
198
|
+
class: b(["transition-[opacity,transform] duration-150", e.modelValue || e.indeterminate ? "scale-100 opacity-100" : "scale-0 opacity-0"])
|
|
199
|
+
}, null, 8, ["name", "class"])], 2)
|
|
200
|
+
]), e.label || t.$slots.default ? (E(), u("span", {
|
|
201
|
+
key: 0,
|
|
202
|
+
class: b(["text-body-large", e.disabled ? "text-on-surface/38" : "text-on-surface"])
|
|
203
|
+
}, [A(t.$slots, "default", {}, () => [f(M(e.label), 1)])], 2)) : l("", !0)], 2));
|
|
204
|
+
}
|
|
205
|
+
}), ge = ["disabled", "aria-pressed"], _e = { class: "whitespace-nowrap" }, ve = ["aria-label", "disabled"], J = ["aria-label", "disabled"], ye = "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] active:before:opacity-[0.12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", be = /* @__PURE__ */ m({
|
|
206
|
+
__name: "MChip",
|
|
207
|
+
props: {
|
|
208
|
+
tone: { default: "neutral" },
|
|
209
|
+
selected: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
default: !1
|
|
212
|
+
},
|
|
213
|
+
removable: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: !1
|
|
216
|
+
},
|
|
217
|
+
clickable: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: !1
|
|
220
|
+
},
|
|
221
|
+
disabled: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
default: !1
|
|
224
|
+
},
|
|
225
|
+
icon: {},
|
|
226
|
+
type: {},
|
|
227
|
+
elevated: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
default: !1
|
|
230
|
+
},
|
|
231
|
+
trailingIcon: {}
|
|
232
|
+
},
|
|
233
|
+
emits: [
|
|
234
|
+
"click",
|
|
235
|
+
"remove",
|
|
236
|
+
"update:selected"
|
|
237
|
+
],
|
|
238
|
+
setup(a, { emit: o }) {
|
|
239
|
+
let f = [
|
|
240
|
+
"neutral",
|
|
241
|
+
"primary",
|
|
242
|
+
"success",
|
|
243
|
+
"error",
|
|
244
|
+
"tertiary",
|
|
245
|
+
"secondary"
|
|
246
|
+
], m = a, h = o, g = e(), _ = P(), v = s(() => !!m.tone && !f.includes(m.tone)), y = s(() => {
|
|
247
|
+
if (v.value) return {
|
|
248
|
+
"--chip-bg": m.tone + "22",
|
|
249
|
+
"--chip-color": m.tone
|
|
250
|
+
};
|
|
251
|
+
}), S = s(() => {
|
|
252
|
+
if (m.disabled) return m.tone === "neutral" && !m.selected && !v.value ? "border border-on-surface/10 bg-transparent text-on-surface/38" : "border border-transparent bg-on-surface/12 text-on-surface/38";
|
|
253
|
+
if (v.value) return "border border-transparent bg-[var(--chip-bg)] text-[var(--chip-color)]";
|
|
254
|
+
if (m.tone === "neutral" && !m.selected) return "border border-outline-variant bg-transparent text-on-surface-variant";
|
|
255
|
+
let e = {
|
|
256
|
+
neutral: "border border-transparent bg-secondary-container text-on-secondary-container",
|
|
257
|
+
primary: "border border-transparent bg-primary-container text-on-primary-container",
|
|
258
|
+
secondary: "border border-transparent bg-secondary-container text-on-secondary-container",
|
|
259
|
+
success: "border border-transparent bg-success-container text-on-success-container",
|
|
260
|
+
error: "border border-transparent bg-error-container text-on-error-container",
|
|
261
|
+
tertiary: "border border-transparent bg-tertiary-container text-on-tertiary-container"
|
|
262
|
+
};
|
|
263
|
+
return e[m.tone ?? "neutral"] ?? e.neutral;
|
|
264
|
+
}), C = s(() => m.selected ? "rounded-full" : "rounded-md"), w = s(() => m.type === "filter" || m.type === "input"), T = s(() => m.type === "input" && !!_.avatar), D = s(() => !!m.trailingIcon || m.type === "input" && m.removable), k = s(() => {
|
|
265
|
+
let e = w.value && m.selected;
|
|
266
|
+
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";
|
|
267
|
+
if (e) return ["bg-secondary-container text-on-secondary-container", m.elevated ? "shadow-elevation-1 hover:shadow-elevation-2" : ""];
|
|
268
|
+
let t = m.type === "assist" ? "text-on-surface" : "text-on-surface-variant";
|
|
269
|
+
return m.elevated && m.type !== "input" ? ["bg-surface-container-low shadow-elevation-1 hover:shadow-elevation-2", t] : ["border border-outline-variant", t];
|
|
270
|
+
}), j = s(() => m.disabled ? "" : m.type === "assist" || m.type === "suggestion" ? "text-primary" : m.selected ? "text-on-secondary-container" : "text-on-surface-variant"), M = s(() => m.type === "input" ? [T.value ? "pl-1" : m.icon ? "pl-2" : "pl-3", D.value ? "pr-2" : "pr-3"] : [m.icon || R.value ? "pl-2" : "pl-4", D.value ? "pr-2" : "pr-4"]), N = O(!1), F = O(), L = O(), R = s(() => m.type === "filter" && !m.icon);
|
|
271
|
+
n(() => m.type === "filter" || m.type === "input" ? [N.value ? 8 : m.selected ? 16 : 12, R.value ? m.selected ? 26 : 8 : 0] : [], ([e, t]) => {
|
|
272
|
+
F.value && e !== void 0 && (F.value.style.borderRadius = `${e}px`), L.value && t !== void 0 && (L.value.style.width = `${t}px`);
|
|
273
|
+
}, r), n(() => R.value ? [+!!m.selected] : [], ([e]) => {
|
|
274
|
+
L.value && e !== void 0 && (L.value.style.opacity = String(e));
|
|
275
|
+
}, t);
|
|
276
|
+
function z() {
|
|
277
|
+
m.disabled || (w.value && h("update:selected", !m.selected), h("click"));
|
|
278
|
+
}
|
|
279
|
+
return (e, t) => a.type ? (E(), u("span", {
|
|
280
|
+
key: 0,
|
|
281
|
+
ref_key: "typedEl",
|
|
282
|
+
ref: F,
|
|
283
|
+
class: b(["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, a.type === "assist" || a.type === "suggestion" ? "rounded-sm" : "rounded-md"]])
|
|
284
|
+
}, [d("button", {
|
|
285
|
+
type: "button",
|
|
286
|
+
class: b(["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", [M.value, a.disabled ? "cursor-not-allowed" : "cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]"]]),
|
|
287
|
+
disabled: a.disabled,
|
|
288
|
+
"aria-pressed": w.value ? a.selected : void 0,
|
|
289
|
+
onPointerdown: t[0] ||= (e) => N.value = !0,
|
|
290
|
+
onPointerup: t[1] ||= (e) => N.value = !1,
|
|
291
|
+
onPointerleave: t[2] ||= (e) => N.value = !1,
|
|
292
|
+
onPointercancel: t[3] ||= (e) => N.value = !1,
|
|
293
|
+
onClick: z
|
|
294
|
+
}, [
|
|
295
|
+
T.value ? (E(), u("span", {
|
|
296
|
+
key: 0,
|
|
297
|
+
class: b(["-my-1 flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full", a.disabled ? "opacity-38" : ""])
|
|
298
|
+
}, [A(e.$slots, "avatar")], 2)) : a.icon ? (E(), c(i, {
|
|
299
|
+
key: 1,
|
|
300
|
+
name: a.icon,
|
|
301
|
+
size: 18,
|
|
302
|
+
filled: a.type === "filter" && a.selected,
|
|
303
|
+
class: b(["shrink-0", j.value])
|
|
304
|
+
}, null, 8, [
|
|
305
|
+
"name",
|
|
306
|
+
"filled",
|
|
307
|
+
"class"
|
|
308
|
+
])) : R.value ? (E(), u("span", {
|
|
309
|
+
key: 2,
|
|
310
|
+
ref_key: "checkEl",
|
|
311
|
+
ref: L,
|
|
312
|
+
class: "-mr-2 flex shrink-0 overflow-hidden",
|
|
313
|
+
style: {
|
|
314
|
+
width: "8px",
|
|
315
|
+
opacity: "0"
|
|
316
|
+
},
|
|
317
|
+
"aria-hidden": "true"
|
|
318
|
+
}, [p(i, {
|
|
319
|
+
name: "check",
|
|
320
|
+
size: 18,
|
|
321
|
+
class: b(["shrink-0", j.value])
|
|
322
|
+
}, null, 8, ["class"])], 512)) : l("", !0),
|
|
323
|
+
d("span", _e, [A(e.$slots, "default")]),
|
|
324
|
+
a.trailingIcon ? (E(), c(i, {
|
|
325
|
+
key: 3,
|
|
326
|
+
name: a.trailingIcon,
|
|
327
|
+
size: 18,
|
|
328
|
+
class: b(["shrink-0", a.disabled ? "" : a.selected && w.value ? "text-on-secondary-container" : "text-on-surface-variant"])
|
|
329
|
+
}, null, 8, ["name", "class"])) : l("", !0)
|
|
330
|
+
], 42, ge), a.type === "input" && a.removable ? (E(), u("button", {
|
|
331
|
+
key: 0,
|
|
332
|
+
type: "button",
|
|
333
|
+
class: b(["relative -ml-1 mr-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", a.disabled ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
334
|
+
"aria-label": te(g).remove,
|
|
335
|
+
disabled: a.disabled,
|
|
336
|
+
onClick: t[4] ||= I((e) => h("remove"), ["stop"])
|
|
337
|
+
}, [p(i, {
|
|
338
|
+
name: "close",
|
|
339
|
+
size: 18
|
|
340
|
+
})], 10, ve)) : l("", !0)], 2)) : (E(), c(ee(a.clickable ? "button" : "span"), {
|
|
341
|
+
key: 1,
|
|
342
|
+
type: a.clickable ? "button" : void 0,
|
|
343
|
+
disabled: a.clickable && a.disabled ? !0 : void 0,
|
|
344
|
+
class: b(["inline-flex h-8 items-center gap-1.5 overflow-hidden px-3 text-label-large transition-colors", [
|
|
345
|
+
C.value,
|
|
346
|
+
S.value,
|
|
347
|
+
a.clickable && !a.disabled ? ye : "",
|
|
348
|
+
a.disabled ? "cursor-not-allowed" : ""
|
|
349
|
+
]]),
|
|
350
|
+
style: x(y.value),
|
|
351
|
+
onClick: t[6] ||= (e) => a.clickable && !a.disabled && h("click")
|
|
352
|
+
}, {
|
|
353
|
+
default: ne(() => [
|
|
354
|
+
a.icon ? (E(), c(i, {
|
|
355
|
+
key: 0,
|
|
356
|
+
name: a.icon,
|
|
357
|
+
size: 18
|
|
358
|
+
}, null, 8, ["name"])) : l("", !0),
|
|
359
|
+
A(e.$slots, "default"),
|
|
360
|
+
a.removable ? (E(), u("button", {
|
|
361
|
+
key: 1,
|
|
362
|
+
type: "button",
|
|
363
|
+
class: "-mr-1 ml-0.5 inline-flex items-center justify-center rounded-full hover:bg-on-surface/12",
|
|
364
|
+
"aria-label": te(g).remove,
|
|
365
|
+
disabled: a.disabled,
|
|
366
|
+
onClick: t[5] ||= I((e) => h("remove"), ["stop"])
|
|
367
|
+
}, [p(i, {
|
|
368
|
+
name: "close",
|
|
369
|
+
size: 16
|
|
370
|
+
})], 8, J)) : l("", !0)
|
|
371
|
+
]),
|
|
372
|
+
_: 3
|
|
373
|
+
}, 8, [
|
|
374
|
+
"type",
|
|
375
|
+
"disabled",
|
|
376
|
+
"class",
|
|
377
|
+
"style"
|
|
378
|
+
]));
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/composables/_useSegmentRuns.ts
|
|
383
|
+
function xe(e) {
|
|
384
|
+
let t = j(/* @__PURE__ */ new Map());
|
|
385
|
+
function n() {
|
|
386
|
+
let n = /* @__PURE__ */ new Map(), r = [], i = () => {
|
|
387
|
+
r.forEach((e, t) => n.set(e, r.length === 1 ? "single" : t === 0 ? "first" : t === r.length - 1 ? "last" : "middle")), r = [];
|
|
388
|
+
};
|
|
389
|
+
for (let t of e.value?.children ?? []) t.getAttribute("role") === "listitem" ? r.push(t) : i();
|
|
390
|
+
i(), t.value = n;
|
|
391
|
+
}
|
|
392
|
+
let r;
|
|
393
|
+
return C(() => {
|
|
394
|
+
n(), e.value && (r = new MutationObserver(n), r.observe(e.value, { childList: !0 }));
|
|
395
|
+
}), w(() => r?.disconnect()), (e) => e ? t.value.get(e) : void 0;
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/components/MList.vue?vue&type=script&setup=true&lang.ts
|
|
399
|
+
var Se = ["role"], Ce = /* @__PURE__ */ m({
|
|
400
|
+
__name: "MList",
|
|
401
|
+
props: {
|
|
402
|
+
dense: {
|
|
403
|
+
type: Boolean,
|
|
404
|
+
default: !1
|
|
405
|
+
},
|
|
406
|
+
dividers: {
|
|
407
|
+
type: [Boolean, String],
|
|
408
|
+
default: !1
|
|
409
|
+
},
|
|
410
|
+
nav: {
|
|
411
|
+
type: Boolean,
|
|
412
|
+
default: !1
|
|
413
|
+
},
|
|
414
|
+
segmented: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
default: !1
|
|
417
|
+
},
|
|
418
|
+
selectable: {
|
|
419
|
+
type: Boolean,
|
|
420
|
+
default: !1
|
|
421
|
+
},
|
|
422
|
+
selected: {},
|
|
423
|
+
lines: {}
|
|
424
|
+
},
|
|
425
|
+
emits: ["update:selected"],
|
|
426
|
+
setup(e, { emit: t }) {
|
|
427
|
+
let n = e, r = t, i = O(), a = xe(i);
|
|
428
|
+
D("m-list", {
|
|
429
|
+
segmentPosition: a,
|
|
430
|
+
dense: s(() => n.dense),
|
|
431
|
+
nav: s(() => n.nav),
|
|
432
|
+
segmented: s(() => n.segmented),
|
|
433
|
+
selectable: s(() => n.selectable),
|
|
434
|
+
selected: s(() => n.selected),
|
|
435
|
+
dividers: s(() => n.dividers),
|
|
436
|
+
lines: s(() => n.lines),
|
|
437
|
+
select: (e) => r("update:selected", e)
|
|
438
|
+
});
|
|
439
|
+
let o = () => [...i.value?.querySelectorAll("[role=\"option\"]") ?? []].filter((e) => e.getAttribute("aria-disabled") !== "true");
|
|
440
|
+
function c(e) {
|
|
441
|
+
if (!n.selectable) return;
|
|
442
|
+
let t = o(), r = t.indexOf(document.activeElement);
|
|
443
|
+
if (r < 0) return;
|
|
444
|
+
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;
|
|
445
|
+
i && (e.preventDefault(), i.focus());
|
|
446
|
+
}
|
|
447
|
+
function l() {
|
|
448
|
+
if (!n.selectable) return;
|
|
449
|
+
let e = o();
|
|
450
|
+
e.length && !e.some((e) => e.tabIndex === 0) && (e[0].tabIndex = 0);
|
|
451
|
+
}
|
|
452
|
+
C(l), T(() => y(l));
|
|
453
|
+
let d = s(() => [
|
|
454
|
+
"flex flex-col",
|
|
455
|
+
n.segmented ? "gap-0.5 p-2" : "py-2",
|
|
456
|
+
n.nav && !n.segmented && "gap-0.5 px-3"
|
|
457
|
+
]);
|
|
458
|
+
return (t, n) => (E(), u("ul", {
|
|
459
|
+
ref_key: "listEl",
|
|
460
|
+
ref: i,
|
|
461
|
+
role: e.selectable ? "listbox" : "list",
|
|
462
|
+
class: b(d.value),
|
|
463
|
+
onKeydown: c
|
|
464
|
+
}, [A(t.$slots, "default")], 42, Se));
|
|
465
|
+
}
|
|
466
|
+
}), we = { class: "relative -my-2 inline-flex h-12 shrink-0 items-center" }, Te = ["checked", "disabled"], Ee = {
|
|
467
|
+
key: 0,
|
|
468
|
+
class: "text-body-large text-on-surface"
|
|
469
|
+
}, De = "bg-outline group-hover:bg-on-surface-variant group-active:bg-on-surface-variant peer-focus-visible:bg-on-surface-variant", Oe = /* @__PURE__ */ m({
|
|
470
|
+
__name: "MSwitch",
|
|
471
|
+
props: {
|
|
472
|
+
modelValue: { type: Boolean },
|
|
473
|
+
disabled: {
|
|
474
|
+
type: Boolean,
|
|
475
|
+
default: !1
|
|
476
|
+
},
|
|
477
|
+
label: {},
|
|
478
|
+
color: { default: "primary" },
|
|
479
|
+
icon: {
|
|
480
|
+
type: Boolean,
|
|
481
|
+
default: !0
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
emits: ["update:modelValue"],
|
|
485
|
+
setup(e, { emit: t }) {
|
|
486
|
+
let n = e, r = t, a = {
|
|
487
|
+
primary: "border-primary bg-primary",
|
|
488
|
+
secondary: "border-secondary bg-secondary",
|
|
489
|
+
tertiary: "border-tertiary bg-tertiary",
|
|
490
|
+
error: "border-error bg-error"
|
|
491
|
+
}, f = {
|
|
492
|
+
primary: "bg-on-primary group-hover:bg-primary-container group-active:bg-primary-container peer-focus-visible:bg-primary-container",
|
|
493
|
+
secondary: "bg-on-secondary group-hover:bg-secondary-container group-active:bg-secondary-container peer-focus-visible:bg-secondary-container",
|
|
494
|
+
tertiary: "bg-on-tertiary group-hover:bg-tertiary-container group-active:bg-tertiary-container peer-focus-visible:bg-tertiary-container",
|
|
495
|
+
error: "bg-on-error group-hover:bg-error-container group-active:bg-error-container peer-focus-visible:bg-error-container"
|
|
496
|
+
}, m = {
|
|
497
|
+
primary: "text-on-primary-container",
|
|
498
|
+
secondary: "text-on-secondary-container",
|
|
499
|
+
tertiary: "text-on-tertiary-container",
|
|
500
|
+
error: "text-on-error-container"
|
|
501
|
+
}, h = {
|
|
502
|
+
primary: "bg-primary",
|
|
503
|
+
secondary: "bg-secondary",
|
|
504
|
+
tertiary: "bg-tertiary",
|
|
505
|
+
error: "bg-error"
|
|
506
|
+
}, g = O(!1);
|
|
507
|
+
function _() {
|
|
508
|
+
n.disabled || (g.value = !0);
|
|
509
|
+
}
|
|
510
|
+
function v() {
|
|
511
|
+
g.value = !1;
|
|
512
|
+
}
|
|
513
|
+
let y = s(() => g.value ? 28 / 24 : n.modelValue ? 1 : 16 / 24), S = s(() => ({
|
|
514
|
+
transform: `translateY(-50%) translateX(${n.modelValue ? 18 : 0}px) scale(${y.value})`,
|
|
515
|
+
transition: n.modelValue ? "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"
|
|
516
|
+
})), C = s(() => ({
|
|
517
|
+
transform: `translateX(${n.modelValue ? 18 : 0}px)`,
|
|
518
|
+
transition: n.modelValue ? "transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1)" : "transform 240ms cubic-bezier(0.2, 0, 0, 1)"
|
|
519
|
+
}));
|
|
520
|
+
return (t, n) => (E(), u("label", {
|
|
521
|
+
class: b(["group inline-flex items-center gap-3 select-none", e.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer"]),
|
|
522
|
+
onPointerdown: _,
|
|
523
|
+
onPointerup: v,
|
|
524
|
+
onPointerleave: v,
|
|
525
|
+
onPointercancel: v
|
|
526
|
+
}, [d("span", we, [d("span", { class: b(["relative inline-flex h-8 w-[52px] items-center rounded-full border-2 transition-colors duration-200", e.modelValue ? a[e.color] : "border-outline bg-surface-container-highest"]) }, [
|
|
527
|
+
d("input", {
|
|
528
|
+
type: "checkbox",
|
|
529
|
+
class: "peer sr-only",
|
|
530
|
+
checked: e.modelValue,
|
|
531
|
+
disabled: e.disabled,
|
|
532
|
+
onChange: n[0] ||= (t) => r("update:modelValue", !e.modelValue)
|
|
533
|
+
}, null, 40, Te),
|
|
534
|
+
e.disabled ? l("", !0) : (E(), u("span", {
|
|
535
|
+
key: 0,
|
|
536
|
+
class: b(["pointer-events-none absolute top-1/2 -left-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.12] peer-focus-visible:opacity-[0.08]", e.modelValue ? h[e.color] : "bg-on-surface-variant"]),
|
|
537
|
+
style: x(C.value)
|
|
538
|
+
}, null, 6)),
|
|
539
|
+
e.disabled ? l("", !0) : (E(), u("span", {
|
|
540
|
+
key: 1,
|
|
541
|
+
class: "pointer-events-none absolute top-1/2 -left-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",
|
|
542
|
+
style: x(C.value)
|
|
543
|
+
}, null, 4)),
|
|
544
|
+
d("span", {
|
|
545
|
+
class: b(["absolute left-1 top-1/2 flex h-6 w-6 items-center justify-center rounded-full will-change-transform", e.modelValue ? [f[e.color], "shadow-sm"] : De]),
|
|
546
|
+
style: x(S.value)
|
|
547
|
+
}, [p(o, {
|
|
548
|
+
"enter-active-class": "transition-opacity duration-150 delay-[120ms]",
|
|
549
|
+
"enter-from-class": "opacity-0",
|
|
550
|
+
"enter-to-class": "opacity-100",
|
|
551
|
+
"leave-active-class": "transition-opacity duration-75",
|
|
552
|
+
"leave-from-class": "opacity-100",
|
|
553
|
+
"leave-to-class": "opacity-0"
|
|
554
|
+
}, {
|
|
555
|
+
default: ne(() => [e.modelValue && e.icon ? (E(), c(i, {
|
|
556
|
+
key: 0,
|
|
557
|
+
name: "check",
|
|
558
|
+
size: 14,
|
|
559
|
+
class: b(m[e.color])
|
|
560
|
+
}, null, 8, ["class"])) : l("", !0)]),
|
|
561
|
+
_: 1
|
|
562
|
+
})], 6)
|
|
563
|
+
], 2)]), e.label ? (E(), u("span", Ee, M(e.label), 1)) : l("", !0)], 34));
|
|
564
|
+
}
|
|
565
|
+
}), ke = [
|
|
566
|
+
"tabindex",
|
|
567
|
+
"aria-expanded",
|
|
568
|
+
"aria-controls",
|
|
569
|
+
"aria-disabled"
|
|
570
|
+
], Ae = { class: "min-w-0 flex-1" }, je = ["id"], Me = { class: "mli-expand-body" }, Ne = ["src"], Y = { class: "min-w-0 flex-1" }, X = 4, Pe = 8, Fe = 16, Z = /* @__PURE__ */ m({
|
|
571
|
+
inheritAttrs: !1,
|
|
572
|
+
__name: "MListItem",
|
|
573
|
+
props: {
|
|
574
|
+
title: {},
|
|
575
|
+
overline: {},
|
|
576
|
+
subtitle: {},
|
|
577
|
+
description: {},
|
|
578
|
+
lines: {},
|
|
579
|
+
icon: {},
|
|
580
|
+
leading: {},
|
|
581
|
+
avatarName: {},
|
|
582
|
+
image: {},
|
|
583
|
+
iconContainerColor: {},
|
|
584
|
+
trailingIcon: {},
|
|
585
|
+
trailingText: {},
|
|
586
|
+
trailing: {},
|
|
587
|
+
trailingValue: { type: Boolean },
|
|
588
|
+
value: {},
|
|
589
|
+
active: {
|
|
590
|
+
type: Boolean,
|
|
591
|
+
default: !1
|
|
592
|
+
},
|
|
593
|
+
disabled: {
|
|
594
|
+
type: Boolean,
|
|
595
|
+
default: !1
|
|
596
|
+
},
|
|
597
|
+
clickable: { type: Boolean },
|
|
598
|
+
href: {},
|
|
599
|
+
to: {},
|
|
600
|
+
expandable: {
|
|
601
|
+
type: Boolean,
|
|
602
|
+
default: !1
|
|
603
|
+
},
|
|
604
|
+
expanded: { type: Boolean }
|
|
605
|
+
},
|
|
606
|
+
emits: [
|
|
607
|
+
"click",
|
|
608
|
+
"update:trailingValue",
|
|
609
|
+
"update:expanded"
|
|
610
|
+
],
|
|
611
|
+
setup(e, { emit: t }) {
|
|
612
|
+
let r = e, a = t, f = h(), m = () => !!f?.vnode.props?.onClick, y = O(r.expanded ?? !1);
|
|
613
|
+
F(() => r.expanded, (e) => {
|
|
614
|
+
e !== void 0 && (y.value = e);
|
|
615
|
+
});
|
|
616
|
+
let x = s(() => y.value), S = _("m-list", null), C = s(() => r.lines ? r.lines : S?.lines.value ? S.lines.value : r.description || r.overline && r.subtitle ? 3 : r.subtitle || r.overline ? 2 : 1), w = s(() => r.clickable || r.href || r.to || m() || S?.selectable.value || r.expandable), T = s(() => !!S?.selectable.value && r.value != null && !r.href && !r.to && !r.expandable), D = s(() => !!(r.href || r.to)), k = s(() => !T.value && !D.value && !r.expandable && (r.clickable || m())), j = s(() => D.value || k.value), P = s(() => T.value ? "option" : k.value ? "button" : D.value ? void 0 : "listitem"), I = s(() => {
|
|
617
|
+
if (T.value) return R.value && !r.disabled ? 0 : -1;
|
|
618
|
+
if (k.value) return r.disabled ? -1 : 0;
|
|
619
|
+
});
|
|
620
|
+
function L(e) {
|
|
621
|
+
(T.value || k.value) && (e.key !== "Enter" && e.key !== " " || e.target !== e.currentTarget || (e.preventDefault(), Z(e)));
|
|
622
|
+
}
|
|
623
|
+
let R = s(() => r.active ? !0 : S?.selectable.value && r.value != null ? S.selected.value === r.value : !1), z = s(() => r.leading ? r.leading : r.icon ? "icon" : r.avatarName ? "avatar" : r.image ? "image" : null), B = s(() => r.expandable ? "expand" : r.trailing ? r.trailing : r.trailingIcon ? "icon" : r.trailingText ? "text" : null), ie = {
|
|
624
|
+
primary: "bg-primary-container text-on-primary-container",
|
|
625
|
+
secondary: "bg-secondary-container text-on-secondary-container",
|
|
626
|
+
tertiary: "bg-tertiary-container text-on-tertiary-container",
|
|
627
|
+
error: "bg-error-container text-on-error-container",
|
|
628
|
+
success: "bg-success-container text-on-success-container"
|
|
629
|
+
}, ae = s(() => S?.dense.value ?? !1), oe = s(() => S?.nav.value ?? !1), se = s(() => S?.segmented.value ?? !1), ce = s(() => S?.dividers.value ?? !1), le = s(() => R.value ? "text-on-secondary-container" : "text-on-surface"), V = s(() => R.value ? "text-on-secondary-container" : "text-on-surface-variant"), ue = s(() => ae.value ? "" : C.value === 3 ? "min-h-22" : C.value === 2 ? "min-h-18" : "min-h-14"), H = s(() => [
|
|
630
|
+
"mli-row relative flex w-full items-center gap-4 text-left",
|
|
631
|
+
se.value ? "bg-surface-container px-4" : oe.value ? "rounded-full px-4" : "px-4",
|
|
632
|
+
ae.value ? "py-1" : C.value === 3 ? "py-3" : "py-2",
|
|
633
|
+
ue.value,
|
|
634
|
+
w.value && !r.disabled && "cursor-pointer transition-colors duration-150 hover:bg-on-surface/8 active:bg-on-surface/12",
|
|
635
|
+
R.value && "bg-secondary-container text-on-secondary-container",
|
|
636
|
+
r.disabled && "opacity-[0.38] pointer-events-none"
|
|
637
|
+
]), de = O(null), U = O(null), fe = (e, { slots: t }) => j.value ? g("li", {
|
|
638
|
+
role: "listitem",
|
|
639
|
+
ref: (e) => {
|
|
640
|
+
U.value = e;
|
|
641
|
+
}
|
|
642
|
+
}, t.default?.()) : t.default?.(), pe = O(null), W = (e) => e && "$el" in e ? e.$el : e, G = O(!1), K = O(!1), me = O(!1), he = s(() => se.value ? S?.segmentPosition(j.value ? U.value : W(de.value)) : void 0), ge = s(() => {
|
|
643
|
+
if (oe.value) return [];
|
|
644
|
+
let e = w.value && !r.disabled, t = e && K.value || R.value || e && me.value ? Fe : e && G.value ? Pe : null;
|
|
645
|
+
if (t !== null) return [
|
|
646
|
+
t,
|
|
647
|
+
t,
|
|
648
|
+
t,
|
|
649
|
+
t
|
|
650
|
+
];
|
|
651
|
+
let n = he.value, i = n === "first" || n === "single" ? Fe : X, a = n === "last" || n === "single" ? Fe : X;
|
|
652
|
+
return [
|
|
653
|
+
i,
|
|
654
|
+
i,
|
|
655
|
+
a,
|
|
656
|
+
a
|
|
657
|
+
];
|
|
658
|
+
}), { snap: _e } = n(() => ge.value, (e) => {
|
|
659
|
+
let t = pe.value ?? W(de.value);
|
|
660
|
+
t && (t.style.borderRadius = e.length ? e.map((e) => `${e}px`).join(" ") : "");
|
|
661
|
+
});
|
|
662
|
+
F([he, oe], () => _e());
|
|
663
|
+
function ve(e) {
|
|
664
|
+
e.pointerType !== "touch" && (G.value = !0);
|
|
665
|
+
}
|
|
666
|
+
function J() {
|
|
667
|
+
G.value = !1, K.value = !1;
|
|
668
|
+
}
|
|
669
|
+
function ye(e) {
|
|
670
|
+
e.button === 0 && (K.value = !0);
|
|
671
|
+
}
|
|
672
|
+
function be() {
|
|
673
|
+
K.value = !1;
|
|
674
|
+
}
|
|
675
|
+
function xe(e) {
|
|
676
|
+
me.value = e.currentTarget.matches(":focus-visible");
|
|
677
|
+
}
|
|
678
|
+
function Se() {
|
|
679
|
+
me.value = !1;
|
|
680
|
+
}
|
|
681
|
+
let Ce = s(() => r.href ? "a" : r.to ? "router-link" : k.value ? "div" : "li"), we = s(() => r.href ? { href: r.href } : r.to ? { to: r.to } : {}), Te = N();
|
|
682
|
+
function Ee(e) {
|
|
683
|
+
(e.key === "Enter" || e.key === " ") && e.target === e.currentTarget && (e.preventDefault(), Z(e));
|
|
684
|
+
}
|
|
685
|
+
function De(e) {
|
|
686
|
+
r.disabled || (y.value = !y.value, a("update:expanded", y.value), a("click", e));
|
|
687
|
+
}
|
|
688
|
+
function Z(e) {
|
|
689
|
+
if (!r.disabled) {
|
|
690
|
+
if (r.expandable) {
|
|
691
|
+
De(e);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
S?.selectable.value && r.value != null && S.select(r.value), a("click", e);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function Ie() {
|
|
698
|
+
a("update:trailingValue", !r.trailingValue);
|
|
699
|
+
}
|
|
700
|
+
return (t, n) => e.expandable ? (E(), u("li", v({
|
|
701
|
+
key: 0,
|
|
702
|
+
ref_key: "rootEl",
|
|
703
|
+
ref: de
|
|
704
|
+
}, t.$attrs, { role: "listitem" }), [d("div", {
|
|
705
|
+
ref_key: "shapeEl",
|
|
706
|
+
ref: pe,
|
|
707
|
+
role: "button",
|
|
708
|
+
tabindex: e.disabled ? -1 : 0,
|
|
709
|
+
"aria-expanded": x.value,
|
|
710
|
+
"aria-controls": te(Te),
|
|
711
|
+
"aria-disabled": e.disabled || void 0,
|
|
712
|
+
class: b(["focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", H.value]),
|
|
713
|
+
onClick: Z,
|
|
714
|
+
onKeydown: Ee,
|
|
715
|
+
onFocus: xe,
|
|
716
|
+
onBlur: Se,
|
|
717
|
+
onPointerenter: ve,
|
|
718
|
+
onPointerleave: J,
|
|
719
|
+
onPointerdown: ye,
|
|
720
|
+
onPointerup: be,
|
|
721
|
+
onPointercancel: be
|
|
722
|
+
}, [
|
|
723
|
+
A(t.$slots, "leading", {}, () => [z.value === "icon" ? (E(), c(i, {
|
|
724
|
+
key: 0,
|
|
725
|
+
name: e.icon,
|
|
726
|
+
size: 24,
|
|
727
|
+
class: b(["shrink-0", V.value])
|
|
728
|
+
}, null, 8, ["name", "class"])) : l("", !0)]),
|
|
729
|
+
d("div", Ae, [A(t.$slots, "overline", {}, () => [e.overline ? (E(), u("p", {
|
|
730
|
+
key: 0,
|
|
731
|
+
class: b(["truncate text-label-small", V.value])
|
|
732
|
+
}, M(e.overline), 3)) : l("", !0)]), A(t.$slots, "default", {}, () => [d("p", { class: b(["truncate text-body-large", le.value]) }, M(e.title), 3), e.subtitle && C.value >= 2 ? (E(), u("p", {
|
|
733
|
+
key: 0,
|
|
734
|
+
class: b(["text-body-medium", [V.value, C.value === 2 && "truncate"]])
|
|
735
|
+
}, M(e.subtitle), 3)) : l("", !0)])]),
|
|
736
|
+
p(i, {
|
|
737
|
+
name: x.value ? "expand_less" : "expand_more",
|
|
738
|
+
size: 20,
|
|
739
|
+
class: b(["shrink-0", V.value])
|
|
740
|
+
}, null, 8, ["name", "class"])
|
|
741
|
+
], 42, ke), p(o, { name: "mli-expand" }, {
|
|
742
|
+
default: ne(() => [x.value ? (E(), u("div", {
|
|
743
|
+
key: 0,
|
|
744
|
+
id: te(Te),
|
|
745
|
+
class: "mli-expand-grid"
|
|
746
|
+
}, [d("div", Me, [A(t.$slots, "children")])], 8, je)) : l("", !0)]),
|
|
747
|
+
_: 3
|
|
748
|
+
})], 16)) : (E(), c(fe, { key: 1 }, {
|
|
749
|
+
default: ne(() => [(E(), c(ee(Ce.value), v({
|
|
750
|
+
class: H.value,
|
|
751
|
+
ref_key: "rootEl",
|
|
752
|
+
ref: de
|
|
753
|
+
}, {
|
|
754
|
+
...we.value,
|
|
755
|
+
...t.$attrs
|
|
756
|
+
}, {
|
|
757
|
+
role: P.value,
|
|
758
|
+
tabindex: I.value,
|
|
759
|
+
"aria-selected": T.value ? R.value : void 0,
|
|
760
|
+
"aria-disabled": (T.value || k.value) && e.disabled ? "true" : void 0,
|
|
761
|
+
onClick: Z,
|
|
762
|
+
onKeydown: L,
|
|
763
|
+
onPointerenter: ve,
|
|
764
|
+
onPointerleave: J,
|
|
765
|
+
onPointerdown: ye,
|
|
766
|
+
onPointerup: be,
|
|
767
|
+
onPointercancel: be,
|
|
768
|
+
onFocus: xe,
|
|
769
|
+
onBlur: Se
|
|
770
|
+
}), {
|
|
771
|
+
default: ne(() => [
|
|
772
|
+
ce.value ? (E(), u("div", {
|
|
773
|
+
key: 0,
|
|
774
|
+
class: b(["absolute top-0 right-0 h-px bg-outline-variant", ce.value === "inset" ? "left-16" : "left-0"])
|
|
775
|
+
}, null, 2)) : l("", !0),
|
|
776
|
+
A(t.$slots, "leading", {}, () => [z.value === "icon" ? (E(), c(i, {
|
|
777
|
+
key: 0,
|
|
778
|
+
name: e.icon,
|
|
779
|
+
size: 24,
|
|
780
|
+
class: b(["shrink-0", V.value])
|
|
781
|
+
}, null, 8, ["name", "class"])) : z.value === "icon-container" ? (E(), u("div", {
|
|
782
|
+
key: 1,
|
|
783
|
+
class: b(["flex h-10 w-10 shrink-0 items-center justify-center rounded-full", ie[e.iconContainerColor || "primary"]])
|
|
784
|
+
}, [p(i, {
|
|
785
|
+
name: e.icon,
|
|
786
|
+
size: 24
|
|
787
|
+
}, null, 8, ["name"])], 2)) : z.value === "avatar" ? (E(), c(re, {
|
|
788
|
+
key: 2,
|
|
789
|
+
name: e.avatarName,
|
|
790
|
+
size: 40,
|
|
791
|
+
class: "shrink-0"
|
|
792
|
+
}, null, 8, ["name"])) : z.value === "image" ? (E(), u("img", {
|
|
793
|
+
key: 3,
|
|
794
|
+
src: e.image,
|
|
795
|
+
alt: "",
|
|
796
|
+
class: "h-14 w-14 shrink-0 rounded-md object-cover"
|
|
797
|
+
}, null, 8, Ne)) : z.value === "checkbox" ? (E(), c(q, {
|
|
798
|
+
key: 4,
|
|
799
|
+
"model-value": R.value,
|
|
800
|
+
class: "shrink-0"
|
|
801
|
+
}, null, 8, ["model-value"])) : l("", !0)]),
|
|
802
|
+
d("div", Y, [A(t.$slots, "overline", {}, () => [e.overline ? (E(), u("p", {
|
|
803
|
+
key: 0,
|
|
804
|
+
class: b(["truncate text-label-small", V.value])
|
|
805
|
+
}, M(e.overline), 3)) : l("", !0)]), A(t.$slots, "default", {}, () => [
|
|
806
|
+
d("p", { class: b(["truncate text-body-large", le.value]) }, M(e.title), 3),
|
|
807
|
+
e.subtitle && C.value >= 2 ? (E(), u("p", {
|
|
808
|
+
key: 0,
|
|
809
|
+
class: b(["text-body-medium", [V.value, C.value === 2 && "truncate"]])
|
|
810
|
+
}, M(e.subtitle), 3)) : l("", !0),
|
|
811
|
+
e.description && C.value >= 3 ? (E(), u("p", {
|
|
812
|
+
key: 1,
|
|
813
|
+
class: b(["line-clamp-2 text-body-small", V.value])
|
|
814
|
+
}, M(e.description), 3)) : l("", !0)
|
|
815
|
+
])]),
|
|
816
|
+
A(t.$slots, "trailing", {}, () => [B.value === "icon" ? (E(), c(i, {
|
|
817
|
+
key: 0,
|
|
818
|
+
name: e.trailingIcon,
|
|
819
|
+
size: 24,
|
|
820
|
+
class: b(["shrink-0", V.value])
|
|
821
|
+
}, null, 8, ["name", "class"])) : B.value === "text" ? (E(), u("span", {
|
|
822
|
+
key: 1,
|
|
823
|
+
class: b(["shrink-0 text-label-small", V.value])
|
|
824
|
+
}, M(e.trailingText), 3)) : B.value === "switch" ? (E(), c(Oe, {
|
|
825
|
+
key: 2,
|
|
826
|
+
"model-value": !!e.trailingValue,
|
|
827
|
+
"onUpdate:modelValue": Ie
|
|
828
|
+
}, null, 8, ["model-value"])) : B.value === "checkbox" ? (E(), c(q, {
|
|
829
|
+
key: 3,
|
|
830
|
+
"model-value": !!e.trailingValue,
|
|
831
|
+
"onUpdate:modelValue": Ie
|
|
832
|
+
}, null, 8, ["model-value"])) : l("", !0)])
|
|
833
|
+
]),
|
|
834
|
+
_: 3
|
|
835
|
+
}, 16, [
|
|
836
|
+
"class",
|
|
837
|
+
"role",
|
|
838
|
+
"tabindex",
|
|
839
|
+
"aria-selected",
|
|
840
|
+
"aria-disabled"
|
|
841
|
+
]))]),
|
|
842
|
+
_: 3
|
|
843
|
+
}));
|
|
844
|
+
}
|
|
845
|
+
}), Ie = {
|
|
846
|
+
key: 0,
|
|
847
|
+
class: "flex items-center justify-between"
|
|
848
|
+
}, Le = {
|
|
849
|
+
key: 0,
|
|
850
|
+
class: "text-label-large text-on-surface"
|
|
851
|
+
}, Re = {
|
|
852
|
+
key: 1,
|
|
853
|
+
class: "tabular-nums text-label-large text-on-surface-variant"
|
|
854
|
+
}, ze = [
|
|
855
|
+
"role",
|
|
856
|
+
"tabindex",
|
|
857
|
+
"aria-label",
|
|
858
|
+
"aria-valuenow",
|
|
859
|
+
"aria-valuemin",
|
|
860
|
+
"aria-valuemax",
|
|
861
|
+
"aria-disabled",
|
|
862
|
+
"aria-orientation"
|
|
863
|
+
], Be = [
|
|
864
|
+
"tabindex",
|
|
865
|
+
"aria-label",
|
|
866
|
+
"aria-valuenow",
|
|
867
|
+
"aria-valuemin",
|
|
868
|
+
"aria-valuemax",
|
|
869
|
+
"aria-disabled",
|
|
870
|
+
"aria-orientation",
|
|
871
|
+
"onKeydown",
|
|
872
|
+
"onFocus"
|
|
873
|
+
], Ve = "color-mix(in srgb, var(--color-on-surface) 38%, transparent)", He = "color-mix(in srgb, var(--color-on-surface) 12%, transparent)", Ue = /* @__PURE__ */ m({
|
|
874
|
+
__name: "MSlider",
|
|
875
|
+
props: {
|
|
876
|
+
modelValue: {},
|
|
877
|
+
min: { default: 0 },
|
|
878
|
+
max: { default: 100 },
|
|
879
|
+
step: { default: 1 },
|
|
880
|
+
disabled: {
|
|
881
|
+
type: Boolean,
|
|
882
|
+
default: !1
|
|
883
|
+
},
|
|
884
|
+
label: {},
|
|
885
|
+
showValue: {
|
|
886
|
+
type: Boolean,
|
|
887
|
+
default: !1
|
|
888
|
+
},
|
|
889
|
+
showTooltip: {
|
|
890
|
+
type: Boolean,
|
|
891
|
+
default: !1
|
|
892
|
+
},
|
|
893
|
+
orientation: { default: "horizontal" },
|
|
894
|
+
size: { default: "xs" },
|
|
895
|
+
variant: { default: "standard" },
|
|
896
|
+
stops: {
|
|
897
|
+
type: Boolean,
|
|
898
|
+
default: !1
|
|
899
|
+
},
|
|
900
|
+
icon: {},
|
|
901
|
+
color: { default: "primary" },
|
|
902
|
+
fillColor: {},
|
|
903
|
+
thumbIcon: {},
|
|
904
|
+
thumbColor: {}
|
|
905
|
+
},
|
|
906
|
+
emits: ["update:modelValue"],
|
|
907
|
+
setup(t, { emit: n }) {
|
|
908
|
+
let r = t, f = n, m = e(), h = O(), g = O([]), _ = O(!1), v = O(!1), y = O(null), w = O(null), T = !1;
|
|
909
|
+
function D(e) {
|
|
910
|
+
T = !0, g.value[e]?.focus({ preventScroll: !0 }), T = !1;
|
|
911
|
+
}
|
|
912
|
+
function A(e) {
|
|
913
|
+
y.value = e, w.value = T ? null : e;
|
|
914
|
+
}
|
|
915
|
+
function ee() {
|
|
916
|
+
y.value = null, w.value = null;
|
|
917
|
+
}
|
|
918
|
+
let j = s(() => r.orientation === "vertical"), N = s(() => r.variant === "range");
|
|
919
|
+
s(() => r.variant === "centered");
|
|
920
|
+
let P = s(() => {
|
|
921
|
+
if (N.value) {
|
|
922
|
+
let e = r.modelValue;
|
|
923
|
+
return {
|
|
924
|
+
lo: Math.min(e[0], e[1]),
|
|
925
|
+
hi: Math.max(e[0], e[1])
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
return {
|
|
929
|
+
lo: r.modelValue,
|
|
930
|
+
hi: r.modelValue
|
|
931
|
+
};
|
|
932
|
+
});
|
|
933
|
+
function F(e) {
|
|
934
|
+
let t = r.max - r.min;
|
|
935
|
+
return t === 0 ? 0 : (e - r.min) / t * 100;
|
|
936
|
+
}
|
|
937
|
+
let I = s(() => F(P.value.lo)), L = s(() => F(P.value.hi)), R = s(() => F(0)), z = s(() => se.value < H.value.dotInset + H.value.dot / 2 ? !0 : r.variant === "centered" ? Math.min(I.value, R.value) <= 0 : r.variant !== "range" || I.value <= 0), re = s(() => ce.value < H.value.dotInset + H.value.dot / 2 ? !0 : r.variant === "centered" ? Math.max(I.value, R.value) >= 100 : r.variant === "range" ? L.value >= 100 : I.value >= 100), B = O(0), ie, ae = () => {
|
|
938
|
+
let e = h.value;
|
|
939
|
+
e && (B.value = j.value ? e.offsetHeight : e.offsetWidth);
|
|
940
|
+
};
|
|
941
|
+
C(() => {
|
|
942
|
+
ae(), !(typeof ResizeObserver > "u" || !h.value) && (ie = new ResizeObserver(ae), ie.observe(h.value));
|
|
943
|
+
}), S(() => ie?.disconnect());
|
|
944
|
+
let oe = (e) => {
|
|
945
|
+
let t = H.value.thumbInset;
|
|
946
|
+
return Math.min(Math.max(e / 100 * B.value, t), B.value - t);
|
|
947
|
+
}, se = s(() => B.value && (r.variant === "range" || r.variant === "centered" && I.value <= R.value) ? oe(I.value) - U.value : Infinity), ce = s(() => B.value ? r.variant === "range" ? B.value - oe(L.value) - U.value : r.variant === "centered" && I.value < R.value ? Infinity : B.value - oe(I.value) - U.value : Infinity), le = s(() => se.value <= X.value), V = s(() => ce.value <= X.value), ue = {
|
|
948
|
+
xs: {
|
|
949
|
+
track: 16,
|
|
950
|
+
thumbW: 4,
|
|
951
|
+
thumbH: 44,
|
|
952
|
+
dot: 4,
|
|
953
|
+
gap: 6,
|
|
954
|
+
hitArea: 46,
|
|
955
|
+
radius: 6,
|
|
956
|
+
dotInset: 12,
|
|
957
|
+
thumbInset: 5,
|
|
958
|
+
iconSize: 14,
|
|
959
|
+
thumbIconSize: 22
|
|
960
|
+
},
|
|
961
|
+
sm: {
|
|
962
|
+
track: 28,
|
|
963
|
+
thumbW: 4,
|
|
964
|
+
thumbH: 40,
|
|
965
|
+
dot: 5,
|
|
966
|
+
gap: 7,
|
|
967
|
+
hitArea: 46,
|
|
968
|
+
radius: 8,
|
|
969
|
+
dotInset: 13,
|
|
970
|
+
thumbInset: 6,
|
|
971
|
+
iconSize: 16,
|
|
972
|
+
thumbIconSize: 28
|
|
973
|
+
},
|
|
974
|
+
md: {
|
|
975
|
+
track: 54,
|
|
976
|
+
thumbW: 5,
|
|
977
|
+
thumbH: 62,
|
|
978
|
+
dot: 5,
|
|
979
|
+
gap: 8,
|
|
980
|
+
hitArea: 66,
|
|
981
|
+
radius: 12,
|
|
982
|
+
dotInset: 15,
|
|
983
|
+
thumbInset: 7,
|
|
984
|
+
iconSize: 20,
|
|
985
|
+
thumbIconSize: 42
|
|
986
|
+
},
|
|
987
|
+
lg: {
|
|
988
|
+
track: 72,
|
|
989
|
+
thumbW: 5,
|
|
990
|
+
thumbH: 78,
|
|
991
|
+
dot: 6,
|
|
992
|
+
gap: 10,
|
|
993
|
+
hitArea: 82,
|
|
994
|
+
radius: 14,
|
|
995
|
+
dotInset: 17,
|
|
996
|
+
thumbInset: 8,
|
|
997
|
+
iconSize: 24,
|
|
998
|
+
thumbIconSize: 52
|
|
999
|
+
},
|
|
1000
|
+
xl: {
|
|
1001
|
+
track: 96,
|
|
1002
|
+
thumbW: 6,
|
|
1003
|
+
thumbH: 98,
|
|
1004
|
+
dot: 7,
|
|
1005
|
+
gap: 10,
|
|
1006
|
+
hitArea: 100,
|
|
1007
|
+
radius: 18,
|
|
1008
|
+
dotInset: 19,
|
|
1009
|
+
thumbInset: 9,
|
|
1010
|
+
iconSize: 28,
|
|
1011
|
+
thumbIconSize: 66
|
|
1012
|
+
}
|
|
1013
|
+
}, H = s(() => ue[r.size] ?? ue.xs), de = s(() => H.value.thumbInset + H.value.thumbW / 2 + H.value.iconSize / 2 + 3), U = s(() => r.thumbIcon ? Math.max(H.value.gap, H.value.thumbIconSize / 2 + 4) : H.value.gap), fe = {
|
|
1014
|
+
primary: "var(--color-primary)",
|
|
1015
|
+
secondary: "var(--color-secondary)",
|
|
1016
|
+
tertiary: "var(--color-tertiary)",
|
|
1017
|
+
error: "var(--color-error)"
|
|
1018
|
+
};
|
|
1019
|
+
function pe(e, t) {
|
|
1020
|
+
let n = e ?? t;
|
|
1021
|
+
return fe[n] ?? n;
|
|
1022
|
+
}
|
|
1023
|
+
let W = s(() => r.disabled ? {
|
|
1024
|
+
active: Ve,
|
|
1025
|
+
inactive: He
|
|
1026
|
+
} : {
|
|
1027
|
+
active: pe(r.fillColor, r.color),
|
|
1028
|
+
inactive: "var(--color-secondary-container)"
|
|
1029
|
+
}), G = s(() => r.disabled ? {
|
|
1030
|
+
active: Ve,
|
|
1031
|
+
inactive: He
|
|
1032
|
+
} : {
|
|
1033
|
+
active: pe(r.thumbColor, r.color),
|
|
1034
|
+
inactive: "var(--color-secondary-container)"
|
|
1035
|
+
});
|
|
1036
|
+
function K(e) {
|
|
1037
|
+
let t = Math.round((e - r.min) / r.step) * r.step + r.min;
|
|
1038
|
+
return Math.max(r.min, Math.min(r.max, +t.toFixed(10)));
|
|
1039
|
+
}
|
|
1040
|
+
function me(e) {
|
|
1041
|
+
if (!h.value) return 0;
|
|
1042
|
+
let t = h.value.getBoundingClientRect();
|
|
1043
|
+
return j.value ? 1 - Math.max(0, Math.min(1, (e.clientY - t.top) / t.height)) : Math.max(0, Math.min(1, (e.clientX - t.left) / t.width));
|
|
1044
|
+
}
|
|
1045
|
+
function he(e) {
|
|
1046
|
+
return K(r.min + me(e) * (r.max - r.min));
|
|
1047
|
+
}
|
|
1048
|
+
let q = !1;
|
|
1049
|
+
function ge(e, t) {
|
|
1050
|
+
let { lo: n, hi: r } = P.value;
|
|
1051
|
+
return e === 0 ? [Math.min(t, r), r] : [n, Math.max(t, n)];
|
|
1052
|
+
}
|
|
1053
|
+
function _e(e) {
|
|
1054
|
+
if (r.disabled) return;
|
|
1055
|
+
e.preventDefault();
|
|
1056
|
+
let t = he(e);
|
|
1057
|
+
if (N.value) {
|
|
1058
|
+
let { lo: e, hi: n } = P.value;
|
|
1059
|
+
q = !1;
|
|
1060
|
+
let r;
|
|
1061
|
+
t <= e && t < n ? r = 0 : t >= n && t > e ? r = 1 : e === n ? (r = 0, q = !0) : r = Math.abs(t - e) <= Math.abs(t - n) ? 0 : 1, _.value = r, D(r), q || f("update:modelValue", ge(r, t));
|
|
1062
|
+
} else _.value = "single", f("update:modelValue", t);
|
|
1063
|
+
window.addEventListener("pointermove", ve), window.addEventListener("pointerup", J), window.addEventListener("pointercancel", J);
|
|
1064
|
+
}
|
|
1065
|
+
function ve(e) {
|
|
1066
|
+
if (_.value === !1) return;
|
|
1067
|
+
let t = he(e);
|
|
1068
|
+
if (N.value) {
|
|
1069
|
+
if (q) {
|
|
1070
|
+
if (t === P.value.lo) return;
|
|
1071
|
+
q = !1, _.value = +(t > P.value.lo), D(_.value);
|
|
1072
|
+
}
|
|
1073
|
+
f("update:modelValue", ge(_.value, t));
|
|
1074
|
+
} else f("update:modelValue", t);
|
|
1075
|
+
}
|
|
1076
|
+
function J() {
|
|
1077
|
+
_.value = !1, q = !1, window.removeEventListener("pointermove", ve), window.removeEventListener("pointerup", J), window.removeEventListener("pointercancel", J);
|
|
1078
|
+
}
|
|
1079
|
+
let ye = {
|
|
1080
|
+
ArrowRight: 1,
|
|
1081
|
+
ArrowUp: 1,
|
|
1082
|
+
ArrowLeft: -1,
|
|
1083
|
+
ArrowDown: -1
|
|
1084
|
+
};
|
|
1085
|
+
function be(e) {
|
|
1086
|
+
if (r.disabled) return;
|
|
1087
|
+
let t = ye[e.key];
|
|
1088
|
+
t !== void 0 && (e.preventDefault(), f("update:modelValue", K(r.modelValue + t * r.step))), e.key === "Home" && (e.preventDefault(), f("update:modelValue", r.min)), e.key === "End" && (e.preventDefault(), f("update:modelValue", r.max));
|
|
1089
|
+
}
|
|
1090
|
+
function xe(e, t) {
|
|
1091
|
+
if (r.disabled) return;
|
|
1092
|
+
let { lo: n, hi: i } = P.value, a = e === 0 ? n : i, o = ye[t.key], s;
|
|
1093
|
+
o === void 0 ? t.key === "Home" ? s = e === 0 ? r.min : n : t.key === "End" && (s = e === 0 ? i : r.max) : s = K(a + o * r.step), s !== void 0 && (t.preventDefault(), w.value = e, f("update:modelValue", ge(e, s)));
|
|
1094
|
+
}
|
|
1095
|
+
S(() => {
|
|
1096
|
+
window.removeEventListener("pointermove", ve), window.removeEventListener("pointerup", J), window.removeEventListener("pointercancel", J);
|
|
1097
|
+
});
|
|
1098
|
+
let Se = s(() => {
|
|
1099
|
+
if (!r.stops) return [];
|
|
1100
|
+
let e = [], t = r.max - r.min, n = r.icon ? (H.value.iconSize + H.value.radius) / 2 : 0;
|
|
1101
|
+
for (let i = r.min + r.step; i < r.max; i += r.step) {
|
|
1102
|
+
let a = (i - r.min) / t * 100;
|
|
1103
|
+
r.icon && a < n || e.push(a);
|
|
1104
|
+
}
|
|
1105
|
+
return e.length <= 28 ? e : [];
|
|
1106
|
+
});
|
|
1107
|
+
function Ce(e) {
|
|
1108
|
+
return `calc(${$(e)} - ${U.value}px)`;
|
|
1109
|
+
}
|
|
1110
|
+
function we(e) {
|
|
1111
|
+
return V.value ? "0px" : `calc(100% - ${$(e)} - ${U.value}px)`;
|
|
1112
|
+
}
|
|
1113
|
+
function Te() {
|
|
1114
|
+
return le.value ? "0px" : `calc(${$(I.value)} - ${U.value}px)`;
|
|
1115
|
+
}
|
|
1116
|
+
function Ee() {
|
|
1117
|
+
return `calc(${$(I.value)} + ${U.value}px)`;
|
|
1118
|
+
}
|
|
1119
|
+
function De() {
|
|
1120
|
+
return `calc(${$(L.value)} - ${$(I.value)} - ${U.value * 2}px)`;
|
|
1121
|
+
}
|
|
1122
|
+
function Oe() {
|
|
1123
|
+
return V.value ? "0px" : `calc(100% - ${$(L.value)} - ${U.value}px)`;
|
|
1124
|
+
}
|
|
1125
|
+
function ke() {
|
|
1126
|
+
return I.value >= R.value ? `${R.value}%` : `calc(${$(I.value)} + ${U.value}px)`;
|
|
1127
|
+
}
|
|
1128
|
+
function Ae() {
|
|
1129
|
+
return I.value >= R.value ? `calc(${$(I.value)} - ${R.value}% - ${U.value}px)` : `calc(${R.value}% - ${$(I.value)} - ${U.value}px)`;
|
|
1130
|
+
}
|
|
1131
|
+
function je() {
|
|
1132
|
+
return V.value ? "0px" : I.value >= R.value ? `calc(100% - ${$(I.value)} - ${U.value}px)` : `calc(100% - ${R.value}% - ${U.value}px)`;
|
|
1133
|
+
}
|
|
1134
|
+
function Me() {
|
|
1135
|
+
return le.value ? "0px" : I.value <= R.value ? `calc(${$(I.value)} - ${U.value}px)` : `calc(${R.value}% - ${U.value}px)`;
|
|
1136
|
+
}
|
|
1137
|
+
let Ne = s(() => H.value.radius), Y = s(() => Math.max(2, Ne.value / 4)), X = s(() => Ne.value * 1.3);
|
|
1138
|
+
function Pe() {
|
|
1139
|
+
return `${Y.value}px`;
|
|
1140
|
+
}
|
|
1141
|
+
function Fe() {
|
|
1142
|
+
return j.value ? `${Y.value}px ${Y.value}px ${X.value}px ${X.value}px` : `${X.value}px ${Y.value}px ${Y.value}px ${X.value}px`;
|
|
1143
|
+
}
|
|
1144
|
+
function Z() {
|
|
1145
|
+
return j.value ? `${X.value}px ${X.value}px ${Y.value}px ${Y.value}px` : `${Y.value}px ${X.value}px ${X.value}px ${Y.value}px`;
|
|
1146
|
+
}
|
|
1147
|
+
let Ue = s(() => _.value === !1), Q = s(() => Ue.value ? "75ms ease" : "0s");
|
|
1148
|
+
function $(e) {
|
|
1149
|
+
let t = H.value.thumbInset;
|
|
1150
|
+
return `clamp(${t}px, ${e}%, calc(100% - ${t}px))`;
|
|
1151
|
+
}
|
|
1152
|
+
function We(e, t = 0) {
|
|
1153
|
+
let n = j.value ? H.value.thumbH : H.value.thumbW, r = j.value ? H.value.thumbW : H.value.thumbH, i = Math.min(n, r) / 2, a = _.value !== !1, o = {
|
|
1154
|
+
position: "absolute",
|
|
1155
|
+
width: `${n}px`,
|
|
1156
|
+
height: `${r}px`,
|
|
1157
|
+
borderRadius: `${i}px`,
|
|
1158
|
+
backgroundColor: G.value.active,
|
|
1159
|
+
"--tw-ring-color": G.value.active,
|
|
1160
|
+
zIndex: "2",
|
|
1161
|
+
transition: Ue.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
|
|
1162
|
+
}, s = N.value ? _.value === t || y.value === t : a || v.value, c = (N.value ? _.value === t : a) ? 1.08 : 1, l = s ? .5 : 1;
|
|
1163
|
+
return j.value ? (o.left = "50%", o.bottom = $(e), o.transform = `translateX(-50%) translateY(50%) scaleX(${c}) scaleY(${l})`) : (o.left = $(e), o.top = "50%", o.transform = `translateX(-50%) translateY(-50%) scaleY(${c}) scaleX(${l})`), o;
|
|
1164
|
+
}
|
|
1165
|
+
function Ge(e) {
|
|
1166
|
+
let t = _.value === !1 ? 1 : 1.15, n = {
|
|
1167
|
+
position: "absolute",
|
|
1168
|
+
color: G.value.active,
|
|
1169
|
+
"--tw-ring-color": G.value.active,
|
|
1170
|
+
zIndex: "2",
|
|
1171
|
+
transition: Ue.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
|
|
1172
|
+
};
|
|
1173
|
+
return j.value ? (n.left = "50%", n.bottom = $(e), n.transform = `translateX(-50%) translateY(50%) scale(${t})`) : (n.left = $(e), n.top = "50%", n.transform = `translateX(-50%) translateY(-50%) scale(${t})`), n;
|
|
1174
|
+
}
|
|
1175
|
+
function Ke(e) {
|
|
1176
|
+
let t = H.value.track / 2 + 36, n = H.value.track / 2 + 40;
|
|
1177
|
+
return j.value ? {
|
|
1178
|
+
left: `calc(50% - ${n}px)`,
|
|
1179
|
+
bottom: $(e),
|
|
1180
|
+
transform: "translateY(50%)",
|
|
1181
|
+
transition: Ue.value ? "bottom " + Q.value : "none"
|
|
1182
|
+
} : {
|
|
1183
|
+
left: $(e),
|
|
1184
|
+
top: `calc(50% - ${t}px)`,
|
|
1185
|
+
transform: "translateX(-50%)",
|
|
1186
|
+
transition: Ue.value ? "left " + Q.value : "none"
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
let qe = s(() => N.value ? `${P.value.lo} – ${P.value.hi}` : String(r.modelValue)), Je = s(() => N.value && typeof _.value == "number" ? _.value === 0 ? P.value.lo : P.value.hi : r.modelValue), Ye = s(() => N.value && typeof _.value == "number" ? _.value === 0 ? I.value : L.value : I.value);
|
|
1190
|
+
return (e, n) => (E(), u("div", { class: b(["flex select-none", j.value ? "h-full flex-col items-center" : "flex-col gap-1"]) }, [t.label || t.showValue ? (E(), u("div", Ie, [t.label ? (E(), u("span", Le, M(t.label), 1)) : l("", !0), t.showValue ? (E(), u("span", Re, M(qe.value), 1)) : l("", !0)])) : l("", !0), d("div", { class: b(["flex items-center", j.value ? "flex-1 flex-col" : ""]) }, [d("div", {
|
|
1191
|
+
ref_key: "trackEl",
|
|
1192
|
+
ref: h,
|
|
1193
|
+
role: N.value ? "group" : "slider",
|
|
1194
|
+
tabindex: N.value ? void 0 : 0,
|
|
1195
|
+
"aria-label": N.value ? t.label : void 0,
|
|
1196
|
+
"aria-valuenow": N.value ? void 0 : t.modelValue,
|
|
1197
|
+
"aria-valuemin": N.value ? void 0 : t.min,
|
|
1198
|
+
"aria-valuemax": N.value ? void 0 : t.max,
|
|
1199
|
+
"aria-disabled": t.disabled || void 0,
|
|
1200
|
+
"aria-orientation": N.value ? void 0 : t.orientation,
|
|
1201
|
+
class: b(["group relative touch-none cursor-pointer outline-none", t.disabled && "cursor-not-allowed"]),
|
|
1202
|
+
style: x(j.value ? {
|
|
1203
|
+
width: `${H.value.hitArea}px`,
|
|
1204
|
+
minHeight: "160px",
|
|
1205
|
+
height: "100%"
|
|
1206
|
+
} : {
|
|
1207
|
+
height: `${H.value.hitArea}px`,
|
|
1208
|
+
width: "100%"
|
|
1209
|
+
}),
|
|
1210
|
+
onPointerdown: _e,
|
|
1211
|
+
onKeydown: n[0] ||= (e) => !N.value && be(e),
|
|
1212
|
+
onFocus: n[1] ||= (e) => v.value = !N.value,
|
|
1213
|
+
onBlur: n[2] ||= (e) => v.value = !1
|
|
1214
|
+
}, [
|
|
1215
|
+
d("div", {
|
|
1216
|
+
class: "absolute",
|
|
1217
|
+
style: x(j.value ? {
|
|
1218
|
+
left: "50%",
|
|
1219
|
+
top: "0",
|
|
1220
|
+
bottom: "0",
|
|
1221
|
+
width: `${H.value.track}px`,
|
|
1222
|
+
transform: "translateX(-50%)",
|
|
1223
|
+
borderRadius: `${X.value}px`
|
|
1224
|
+
} : {
|
|
1225
|
+
top: "50%",
|
|
1226
|
+
left: "0",
|
|
1227
|
+
right: "0",
|
|
1228
|
+
height: `${H.value.track}px`,
|
|
1229
|
+
transform: "translateY(-50%)",
|
|
1230
|
+
borderRadius: `${X.value}px`
|
|
1231
|
+
})
|
|
1232
|
+
}, [
|
|
1233
|
+
t.variant === "standard" ? (E(), u(a, { key: 0 }, [d("div", {
|
|
1234
|
+
class: "absolute",
|
|
1235
|
+
style: x({
|
|
1236
|
+
...j.value ? {
|
|
1237
|
+
left: 0,
|
|
1238
|
+
right: 0,
|
|
1239
|
+
bottom: 0,
|
|
1240
|
+
height: Ce(I.value)
|
|
1241
|
+
} : {
|
|
1242
|
+
top: 0,
|
|
1243
|
+
bottom: 0,
|
|
1244
|
+
left: 0,
|
|
1245
|
+
width: Ce(I.value)
|
|
1246
|
+
},
|
|
1247
|
+
borderRadius: Fe(),
|
|
1248
|
+
backgroundColor: W.value.active,
|
|
1249
|
+
transition: `all ${Q.value}`
|
|
1250
|
+
})
|
|
1251
|
+
}, null, 4), d("div", {
|
|
1252
|
+
class: "absolute",
|
|
1253
|
+
style: x({
|
|
1254
|
+
...j.value ? {
|
|
1255
|
+
left: 0,
|
|
1256
|
+
right: 0,
|
|
1257
|
+
top: 0,
|
|
1258
|
+
height: we(I.value)
|
|
1259
|
+
} : {
|
|
1260
|
+
top: 0,
|
|
1261
|
+
bottom: 0,
|
|
1262
|
+
right: 0,
|
|
1263
|
+
width: we(I.value)
|
|
1264
|
+
},
|
|
1265
|
+
borderRadius: Z(),
|
|
1266
|
+
backgroundColor: W.value.inactive,
|
|
1267
|
+
transition: `all ${Q.value}`
|
|
1268
|
+
})
|
|
1269
|
+
}, null, 4)], 64)) : t.variant === "centered" ? (E(), u(a, { key: 1 }, [
|
|
1270
|
+
d("div", {
|
|
1271
|
+
class: "absolute",
|
|
1272
|
+
style: x({
|
|
1273
|
+
...j.value ? {
|
|
1274
|
+
left: 0,
|
|
1275
|
+
right: 0,
|
|
1276
|
+
bottom: ke(),
|
|
1277
|
+
height: Ae()
|
|
1278
|
+
} : {
|
|
1279
|
+
top: 0,
|
|
1280
|
+
bottom: 0,
|
|
1281
|
+
left: ke(),
|
|
1282
|
+
width: Ae()
|
|
1283
|
+
},
|
|
1284
|
+
borderRadius: Pe(),
|
|
1285
|
+
backgroundColor: W.value.active,
|
|
1286
|
+
transition: `all ${Q.value}`
|
|
1287
|
+
})
|
|
1288
|
+
}, null, 4),
|
|
1289
|
+
d("div", {
|
|
1290
|
+
class: "absolute",
|
|
1291
|
+
style: x({
|
|
1292
|
+
...j.value ? {
|
|
1293
|
+
left: 0,
|
|
1294
|
+
right: 0,
|
|
1295
|
+
top: 0,
|
|
1296
|
+
height: je()
|
|
1297
|
+
} : {
|
|
1298
|
+
top: 0,
|
|
1299
|
+
bottom: 0,
|
|
1300
|
+
right: 0,
|
|
1301
|
+
width: je()
|
|
1302
|
+
},
|
|
1303
|
+
borderRadius: Z(),
|
|
1304
|
+
backgroundColor: W.value.inactive,
|
|
1305
|
+
transition: `all ${Q.value}`
|
|
1306
|
+
})
|
|
1307
|
+
}, null, 4),
|
|
1308
|
+
d("div", {
|
|
1309
|
+
class: "absolute",
|
|
1310
|
+
style: x({
|
|
1311
|
+
...j.value ? {
|
|
1312
|
+
left: 0,
|
|
1313
|
+
right: 0,
|
|
1314
|
+
bottom: 0,
|
|
1315
|
+
height: Me()
|
|
1316
|
+
} : {
|
|
1317
|
+
top: 0,
|
|
1318
|
+
bottom: 0,
|
|
1319
|
+
left: 0,
|
|
1320
|
+
width: Me()
|
|
1321
|
+
},
|
|
1322
|
+
borderRadius: Fe(),
|
|
1323
|
+
backgroundColor: W.value.inactive,
|
|
1324
|
+
transition: `all ${Q.value}`
|
|
1325
|
+
})
|
|
1326
|
+
}, null, 4)
|
|
1327
|
+
], 64)) : t.variant === "range" ? (E(), u(a, { key: 2 }, [
|
|
1328
|
+
d("div", {
|
|
1329
|
+
class: "absolute",
|
|
1330
|
+
style: x({
|
|
1331
|
+
...j.value ? {
|
|
1332
|
+
left: 0,
|
|
1333
|
+
right: 0,
|
|
1334
|
+
bottom: 0,
|
|
1335
|
+
height: Te()
|
|
1336
|
+
} : {
|
|
1337
|
+
top: 0,
|
|
1338
|
+
bottom: 0,
|
|
1339
|
+
left: 0,
|
|
1340
|
+
width: Te()
|
|
1341
|
+
},
|
|
1342
|
+
borderRadius: Fe(),
|
|
1343
|
+
backgroundColor: W.value.inactive,
|
|
1344
|
+
transition: `all ${Q.value}`
|
|
1345
|
+
})
|
|
1346
|
+
}, null, 4),
|
|
1347
|
+
d("div", {
|
|
1348
|
+
class: "absolute",
|
|
1349
|
+
style: x({
|
|
1350
|
+
...j.value ? {
|
|
1351
|
+
left: 0,
|
|
1352
|
+
right: 0,
|
|
1353
|
+
bottom: Ee(),
|
|
1354
|
+
height: De()
|
|
1355
|
+
} : {
|
|
1356
|
+
top: 0,
|
|
1357
|
+
bottom: 0,
|
|
1358
|
+
left: Ee(),
|
|
1359
|
+
width: De()
|
|
1360
|
+
},
|
|
1361
|
+
borderRadius: Pe(),
|
|
1362
|
+
backgroundColor: W.value.active,
|
|
1363
|
+
transition: `all ${Q.value}`
|
|
1364
|
+
})
|
|
1365
|
+
}, null, 4),
|
|
1366
|
+
d("div", {
|
|
1367
|
+
class: "absolute",
|
|
1368
|
+
style: x({
|
|
1369
|
+
...j.value ? {
|
|
1370
|
+
left: 0,
|
|
1371
|
+
right: 0,
|
|
1372
|
+
top: 0,
|
|
1373
|
+
height: Oe()
|
|
1374
|
+
} : {
|
|
1375
|
+
top: 0,
|
|
1376
|
+
bottom: 0,
|
|
1377
|
+
right: 0,
|
|
1378
|
+
width: Oe()
|
|
1379
|
+
},
|
|
1380
|
+
borderRadius: Z(),
|
|
1381
|
+
backgroundColor: W.value.inactive,
|
|
1382
|
+
transition: `all ${Q.value}`
|
|
1383
|
+
})
|
|
1384
|
+
}, null, 4)
|
|
1385
|
+
], 64)) : l("", !0),
|
|
1386
|
+
t.icon ? (E(), c(i, {
|
|
1387
|
+
key: 3,
|
|
1388
|
+
name: t.icon,
|
|
1389
|
+
size: H.value.iconSize,
|
|
1390
|
+
class: "absolute z-[1]",
|
|
1391
|
+
style: x({
|
|
1392
|
+
color: t.variant === "standard" && I.value > 0 || t.variant === "range" && I.value > 0 ? W.value.inactive : W.value.active,
|
|
1393
|
+
...j.value ? {
|
|
1394
|
+
left: "50%",
|
|
1395
|
+
bottom: `${de.value}px`,
|
|
1396
|
+
transform: "translateX(-50%)"
|
|
1397
|
+
} : {
|
|
1398
|
+
top: "50%",
|
|
1399
|
+
left: `${de.value}px`,
|
|
1400
|
+
transform: "translateY(-50%)"
|
|
1401
|
+
},
|
|
1402
|
+
transition: "color 150ms ease"
|
|
1403
|
+
})
|
|
1404
|
+
}, null, 8, [
|
|
1405
|
+
"name",
|
|
1406
|
+
"size",
|
|
1407
|
+
"style"
|
|
1408
|
+
])) : t.stops ? l("", !0) : (E(), u("div", {
|
|
1409
|
+
key: 4,
|
|
1410
|
+
class: "absolute rounded-full",
|
|
1411
|
+
style: x({
|
|
1412
|
+
width: `${H.value.dot}px`,
|
|
1413
|
+
height: `${H.value.dot}px`,
|
|
1414
|
+
backgroundColor: W.value.active,
|
|
1415
|
+
opacity: +!z.value,
|
|
1416
|
+
...j.value ? {
|
|
1417
|
+
left: "50%",
|
|
1418
|
+
bottom: `${H.value.dotInset}px`,
|
|
1419
|
+
transform: "translateX(-50%)"
|
|
1420
|
+
} : {
|
|
1421
|
+
top: "50%",
|
|
1422
|
+
left: `${H.value.dotInset}px`,
|
|
1423
|
+
transform: "translateY(-50%)"
|
|
1424
|
+
},
|
|
1425
|
+
transition: "opacity 150ms ease"
|
|
1426
|
+
})
|
|
1427
|
+
}, null, 4)),
|
|
1428
|
+
t.stops ? l("", !0) : (E(), u("div", {
|
|
1429
|
+
key: 5,
|
|
1430
|
+
class: "absolute rounded-full",
|
|
1431
|
+
style: x({
|
|
1432
|
+
width: `${H.value.dot}px`,
|
|
1433
|
+
height: `${H.value.dot}px`,
|
|
1434
|
+
backgroundColor: W.value.active,
|
|
1435
|
+
opacity: +!re.value,
|
|
1436
|
+
...j.value ? {
|
|
1437
|
+
left: "50%",
|
|
1438
|
+
top: `${H.value.dotInset}px`,
|
|
1439
|
+
transform: "translateX(-50%)"
|
|
1440
|
+
} : {
|
|
1441
|
+
top: "50%",
|
|
1442
|
+
right: `${H.value.dotInset}px`,
|
|
1443
|
+
transform: "translateY(-50%)"
|
|
1444
|
+
},
|
|
1445
|
+
transition: "opacity 150ms ease"
|
|
1446
|
+
})
|
|
1447
|
+
}, null, 4)),
|
|
1448
|
+
t.stops ? (E(!0), u(a, { key: 6 }, k(Se.value, (e, t) => (E(), u("div", {
|
|
1449
|
+
key: t,
|
|
1450
|
+
class: "absolute rounded-full",
|
|
1451
|
+
style: x({
|
|
1452
|
+
width: `${H.value.dot}px`,
|
|
1453
|
+
height: `${H.value.dot}px`,
|
|
1454
|
+
backgroundColor: e <= I.value ? W.value.inactive : W.value.active,
|
|
1455
|
+
opacity: Math.abs(e - I.value) < .01 || N.value && Math.abs(e - L.value) < .01 ? 0 : 1,
|
|
1456
|
+
...j.value ? {
|
|
1457
|
+
left: "50%",
|
|
1458
|
+
bottom: `${e}%`,
|
|
1459
|
+
transform: "translateX(-50%) translateY(50%)"
|
|
1460
|
+
} : {
|
|
1461
|
+
top: "50%",
|
|
1462
|
+
left: `${e}%`,
|
|
1463
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
1464
|
+
}
|
|
1465
|
+
})
|
|
1466
|
+
}, null, 4))), 128)) : l("", !0)
|
|
1467
|
+
], 4),
|
|
1468
|
+
N.value ? (E(), u(a, { key: 1 }, k([0, 1], (e) => d("div", {
|
|
1469
|
+
key: e,
|
|
1470
|
+
ref_for: !0,
|
|
1471
|
+
ref: (t) => {
|
|
1472
|
+
t && (g.value[e] = t);
|
|
1473
|
+
},
|
|
1474
|
+
role: "slider",
|
|
1475
|
+
tabindex: t.disabled ? -1 : 0,
|
|
1476
|
+
"aria-label": e === 0 ? te(m).sliderRangeStart : te(m).sliderRangeEnd,
|
|
1477
|
+
"aria-valuenow": e === 0 ? P.value.lo : P.value.hi,
|
|
1478
|
+
"aria-valuemin": e === 0 ? t.min : P.value.lo,
|
|
1479
|
+
"aria-valuemax": e === 0 ? P.value.hi : t.max,
|
|
1480
|
+
"aria-disabled": t.disabled || void 0,
|
|
1481
|
+
"aria-orientation": t.orientation,
|
|
1482
|
+
class: b(["pointer-events-none flex items-center justify-center rounded-full outline-none", w.value === e && "ring-2 ring-offset-2 ring-offset-surface"]),
|
|
1483
|
+
style: x(t.thumbIcon ? Ge(e === 0 ? I.value : L.value) : We(e === 0 ? I.value : L.value, e)),
|
|
1484
|
+
onKeydown: (t) => xe(e, t),
|
|
1485
|
+
onFocus: (t) => A(e),
|
|
1486
|
+
onBlur: ee
|
|
1487
|
+
}, [t.thumbIcon ? (E(), c(i, {
|
|
1488
|
+
key: 0,
|
|
1489
|
+
name: t.thumbIcon,
|
|
1490
|
+
size: H.value.thumbIconSize
|
|
1491
|
+
}, null, 8, ["name", "size"])) : l("", !0)], 46, Be)), 64)) : (E(), u(a, { key: 0 }, [t.thumbIcon ? (E(), c(i, {
|
|
1492
|
+
key: 0,
|
|
1493
|
+
name: t.thumbIcon,
|
|
1494
|
+
size: H.value.thumbIconSize,
|
|
1495
|
+
class: "pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
|
|
1496
|
+
style: x(Ge(I.value))
|
|
1497
|
+
}, null, 8, [
|
|
1498
|
+
"name",
|
|
1499
|
+
"size",
|
|
1500
|
+
"style"
|
|
1501
|
+
])) : (E(), u("div", {
|
|
1502
|
+
key: 1,
|
|
1503
|
+
class: "pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
|
|
1504
|
+
style: x(We(I.value))
|
|
1505
|
+
}, null, 4))], 64)),
|
|
1506
|
+
p(o, {
|
|
1507
|
+
"enter-active-class": "transition-opacity duration-100",
|
|
1508
|
+
"enter-from-class": "opacity-0",
|
|
1509
|
+
"leave-active-class": "transition-opacity duration-75",
|
|
1510
|
+
"leave-to-class": "opacity-0"
|
|
1511
|
+
}, {
|
|
1512
|
+
default: ne(() => [t.showTooltip && _.value !== !1 ? (E(), u("div", {
|
|
1513
|
+
key: 0,
|
|
1514
|
+
class: "pointer-events-none absolute z-10 flex h-7 min-w-7 items-center justify-center rounded-full bg-inverse-surface px-2 text-label-small tabular-nums text-inverse-on-surface",
|
|
1515
|
+
style: x(Ke(Ye.value))
|
|
1516
|
+
}, M(Je.value), 5)) : l("", !0)]),
|
|
1517
|
+
_: 1
|
|
1518
|
+
})
|
|
1519
|
+
], 46, ze)], 2)], 2));
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
//#endregion
|
|
1523
|
+
export { z as _, xe as a, G as c, le as d, oe as f, L as g, R as h, Ce as i, B as l, re as m, Z as n, be as o, ae as p, Oe as r, q as s, Ue as t, ce as u };
|
|
1524
|
+
|
|
1525
|
+
//# sourceMappingURL=MSlider-JflHJ70q.js.map
|