@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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/dist/API.md +70 -8
  3. package/dist/{MMenuItem-BckcR0nW.js → MMenuItem-BfjqwcYP.js} +84 -63
  4. package/dist/MMenuItem-BfjqwcYP.js.map +1 -0
  5. package/dist/MSlider-JflHJ70q.js +1525 -0
  6. package/dist/MSlider-JflHJ70q.js.map +1 -0
  7. package/dist/{MTextField-FCPOTB0o.js → MTextField-NaIB6RbM.js} +5 -4
  8. package/dist/MTextField-NaIB6RbM.js.map +1 -0
  9. package/dist/api.json +1 -1
  10. package/dist/code-editor.js +1 -1
  11. package/dist/components/MAnimatedNumber.vue.d.ts +3 -1
  12. package/dist/components/MButton.vue.d.ts +2 -0
  13. package/dist/components/MContainerTransform.vue.d.ts +59 -0
  14. package/dist/components/MDialog.vue.d.ts +8 -5
  15. package/dist/components/MFlex.vue.d.ts +1 -1
  16. package/dist/components/MIconButton.vue.d.ts +2 -0
  17. package/dist/components/MListItem.vue.d.ts +5 -5
  18. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  19. package/dist/components/MSplitter.vue.d.ts +1 -1
  20. package/dist/components/MStack.vue.d.ts +1 -1
  21. package/dist/components/MToolbar.vue.d.ts +32 -5
  22. package/dist/components/_MToolbarFab.vue.d.ts +16 -0
  23. package/dist/composables/_containerTransform.d.ts +48 -0
  24. package/dist/composables/useContainerTransform.d.ts +30 -0
  25. package/dist/composables/useLocale.d.ts +3 -0
  26. package/dist/index.d.ts +3 -0
  27. package/dist/locales/index.js +14 -0
  28. package/dist/locales/index.js.map +1 -1
  29. package/dist/m3ui-vue.css +1 -1
  30. package/dist/m3ui.js +4217 -3713
  31. package/dist/m3ui.js.map +1 -1
  32. package/dist/map.js +38 -38
  33. package/dist/rich-text-editor.js +10 -10
  34. package/dist/styles.css +1 -1
  35. package/dist/{useLocale-SfQHnJfp.js → useLocale-CXibICQA.js} +3 -1
  36. package/dist/useLocale-CXibICQA.js.map +1 -0
  37. package/package.json +2 -1
  38. package/src/__tests__/MAnimatedNumber.test.ts +24 -2
  39. package/src/__tests__/MContainerTransform.test.ts +279 -0
  40. package/src/__tests__/MDialog.test.ts +27 -0
  41. package/src/__tests__/MListItemExpandable.test.ts +48 -0
  42. package/src/__tests__/MListItemShape.test.ts +9 -6
  43. package/src/__tests__/MListKeyboard.test.ts +90 -0
  44. package/src/__tests__/MMapTools.test.ts +2 -1
  45. package/src/__tests__/MNavigationRail.test.ts +33 -0
  46. package/src/__tests__/MSlider.test.ts +161 -0
  47. package/src/__tests__/MToolbar.test.ts +157 -0
  48. package/src/__tests__/attrsFallthrough.test.ts +6 -0
  49. package/src/__tests__/hydration.test.ts +25 -0
  50. package/src/components/MAnimatedNumber.vue +32 -6
  51. package/src/components/MButton.vue +4 -2
  52. package/src/components/MContainerTransform.vue +321 -0
  53. package/src/components/MDialog.vue +31 -6
  54. package/src/components/MFab.vue +10 -5
  55. package/src/components/MIconButton.vue +3 -1
  56. package/src/components/MList.vue +26 -2
  57. package/src/components/MListItem.vue +138 -84
  58. package/src/components/MNavigationRail.vue +40 -10
  59. package/src/components/MSlider.vue +161 -42
  60. package/src/components/MToolbar.vue +256 -15
  61. package/src/components/_MToolbarFab.vue +14 -0
  62. package/src/composables/_containerTransform.ts +179 -0
  63. package/src/composables/_useEscapeStack.ts +2 -0
  64. package/src/composables/useContainerTransform.ts +59 -0
  65. package/src/composables/useLocale.ts +5 -0
  66. package/src/index.ts +3 -0
  67. package/src/locales/de.ts +2 -0
  68. package/src/locales/es.ts +2 -0
  69. package/src/locales/fr.ts +2 -0
  70. package/src/locales/ja.ts +2 -0
  71. package/src/locales/ko.ts +2 -0
  72. package/src/locales/pt.ts +2 -0
  73. package/src/locales/zh.ts +2 -0
  74. package/dist/MMenuItem-BckcR0nW.js.map +0 -1
  75. package/dist/MSlider-LyH_gy8D.js +0 -1411
  76. package/dist/MSlider-LyH_gy8D.js.map +0 -1
  77. package/dist/MTextField-FCPOTB0o.js.map +0 -1
  78. package/dist/useLocale-SfQHnJfp.js.map +0 -1
@@ -1,1411 +0,0 @@
1
- import { i as e } from "./useLocale-SfQHnJfp.js";
2
- import { a as t, c as n, o as r } from "./MTextField-FCPOTB0o.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, inject as h, mergeProps as g, normalizeClass as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, onUnmounted as x, openBlock as S, provide as C, ref as w, renderList as T, renderSlot as E, resolveDynamicComponent as D, shallowRef as O, toDisplayString as k, unref as ee, useAttrs as te, useSlots as A, watch as j, withCtx as ne, withModifiers as M } from "vue";
5
- //#region src/composables/_storageKeys.ts
6
- var N = "m3-theme", P = "m3-dynamic-palette", F = "m3-viewport", I = /* @__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) => (S(), 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: v({
24
- width: `${e.size}px`,
25
- height: `${e.size}px`,
26
- fontSize: `${Math.round(e.size * .4)}px`
27
- })
28
- }, k(n.value), 5));
29
- }
30
- }), L = 1e3 / 60, R = .004;
31
- function z(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 = L / 1e3; e > 1e-9; e -= R) {
35
- let n = Math.min(R, 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 B(e, t) {
43
- let n = Number(t ?? 0) / L, 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 re = (e) => (e.length - 1) * L;
47
- function V(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: re(t),
51
- delay: r,
52
- easing: "linear"
53
- });
54
- return i.finished.catch(() => {}), i;
55
- }
56
- var H = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, U = [
57
- "role",
58
- "tabindex",
59
- "aria-disabled"
60
- ], W = ["src", "alt"], G = {
61
- key: 1,
62
- class: "px-4 pt-4 pb-2"
63
- }, ie = {
64
- key: 2,
65
- class: "px-4 pt-4 pb-2"
66
- }, ae = { class: "text-title-large font-medium text-on-surface" }, K = {
67
- key: 0,
68
- class: "mt-1 text-body-medium text-on-surface-variant"
69
- }, oe = {
70
- key: 3,
71
- class: "flex justify-end gap-2 px-4 pt-2 pb-4"
72
- }, se = "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]", q = /* @__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) => (S(), u("div", {
116
- class: _(["overflow-hidden rounded-md transition-shadow duration-150", [
117
- i.value,
118
- o.value ? [
119
- "cursor-pointer",
120
- a[n.value],
121
- se
122
- ] : "",
123
- e.disabled ? "cursor-not-allowed pointer-events-none" : ""
124
- ]]),
125
- style: v({ "--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 ? (S(), u("div", {
132
- key: 0,
133
- class: _(["w-full overflow-hidden", e.imageHeight ?? "h-48"])
134
- }, [e.image ? (S(), u("img", {
135
- key: 0,
136
- src: e.image,
137
- alt: e.imageAlt ?? "",
138
- class: "h-full w-full object-cover"
139
- }, null, 8, W)) : E(t.$slots, "media", {}, void 0, void 0, 1)], 2)) : l("", !0),
140
- t.$slots.header ? (S(), u("div", G, [E(t.$slots, "header")])) : e.title ? (S(), u("div", ie, [d("h3", ae, k(e.title), 1), e.subtitle ? (S(), u("p", K, k(e.subtitle), 1)) : l("", !0)])) : l("", !0),
141
- E(t.$slots, "default"),
142
- t.$slots.actions ? (S(), u("div", oe, [E(t.$slots, "actions")])) : l("", !0)
143
- ], 46, U));
144
- }
145
- }), ce = { class: "relative -m-[11px] inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full" }, le = [
146
- "checked",
147
- "disabled",
148
- "aria-label"
149
- ], ue = {
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
- }, de = /* @__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) => (S(), u("label", { class: _(["group inline-flex items-center gap-2 select-none", e.disabled ? "cursor-not-allowed" : "cursor-pointer"]) }, [d("span", ce, [
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, le),
190
- e.disabled ? l("", !0) : (S(), u("span", {
191
- key: 0,
192
- class: _(["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) : (S(), u("span", ue)),
195
- d("span", { class: _(["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: _(["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 ? (S(), u("span", {
201
- key: 0,
202
- class: _(["text-body-large", e.disabled ? "text-on-surface/38" : "text-on-surface"])
203
- }, [E(t.$slots, "default", {}, () => [f(k(e.label), 1)])], 2)) : l("", !0)], 2));
204
- }
205
- }), J = ["disabled", "aria-pressed"], Y = { class: "whitespace-nowrap" }, fe = ["aria-label", "disabled"], X = ["aria-label", "disabled"], pe = "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", Z = /* @__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(), y = A(), b = s(() => !!m.tone && !f.includes(m.tone)), x = s(() => {
247
- if (b.value) return {
248
- "--chip-bg": m.tone + "22",
249
- "--chip-color": m.tone
250
- };
251
- }), C = s(() => {
252
- if (m.disabled) return m.tone === "neutral" && !m.selected && !b.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 (b.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
- }), T = s(() => m.selected ? "rounded-full" : "rounded-md"), O = s(() => m.type === "filter" || m.type === "input"), k = s(() => m.type === "input" && !!y.avatar), te = s(() => !!m.trailingIcon || m.type === "input" && m.removable), j = s(() => {
265
- let e = O.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
- }), N = s(() => m.disabled ? "" : m.type === "assist" || m.type === "suggestion" ? "text-primary" : m.selected ? "text-on-secondary-container" : "text-on-surface-variant"), P = s(() => m.type === "input" ? [k.value ? "pl-1" : m.icon ? "pl-2" : "pl-3", te.value ? "pr-2" : "pr-3"] : [m.icon || R.value ? "pl-2" : "pl-4", te.value ? "pr-2" : "pr-4"]), F = w(!1), I = w(), L = w(), R = s(() => m.type === "filter" && !m.icon);
271
- n(() => m.type === "filter" || m.type === "input" ? [F.value ? 8 : m.selected ? 16 : 12, R.value ? m.selected ? 26 : 8 : 0] : [], ([e, t]) => {
272
- I.value && e !== void 0 && (I.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 || (O.value && h("update:selected", !m.selected), h("click"));
278
- }
279
- return (e, t) => a.type ? (S(), u("span", {
280
- key: 0,
281
- ref_key: "typedEl",
282
- ref: I,
283
- class: _(["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", [j.value, a.type === "assist" || a.type === "suggestion" ? "rounded-sm" : "rounded-md"]])
284
- }, [d("button", {
285
- type: "button",
286
- class: _(["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, a.disabled ? "cursor-not-allowed" : "cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]"]]),
287
- disabled: a.disabled,
288
- "aria-pressed": O.value ? a.selected : void 0,
289
- onPointerdown: t[0] ||= (e) => F.value = !0,
290
- onPointerup: t[1] ||= (e) => F.value = !1,
291
- onPointerleave: t[2] ||= (e) => F.value = !1,
292
- onPointercancel: t[3] ||= (e) => F.value = !1,
293
- onClick: z
294
- }, [
295
- k.value ? (S(), u("span", {
296
- key: 0,
297
- class: _(["-my-1 flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full", a.disabled ? "opacity-38" : ""])
298
- }, [E(e.$slots, "avatar")], 2)) : a.icon ? (S(), c(i, {
299
- key: 1,
300
- name: a.icon,
301
- size: 18,
302
- filled: a.type === "filter" && a.selected,
303
- class: _(["shrink-0", N.value])
304
- }, null, 8, [
305
- "name",
306
- "filled",
307
- "class"
308
- ])) : R.value ? (S(), 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: _(["shrink-0", N.value])
322
- }, null, 8, ["class"])], 512)) : l("", !0),
323
- d("span", Y, [E(e.$slots, "default")]),
324
- a.trailingIcon ? (S(), c(i, {
325
- key: 3,
326
- name: a.trailingIcon,
327
- size: 18,
328
- class: _(["shrink-0", a.disabled ? "" : a.selected && O.value ? "text-on-secondary-container" : "text-on-surface-variant"])
329
- }, null, 8, ["name", "class"])) : l("", !0)
330
- ], 42, J), a.type === "input" && a.removable ? (S(), u("button", {
331
- key: 0,
332
- type: "button",
333
- class: _(["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": ee(g).remove,
335
- disabled: a.disabled,
336
- onClick: t[4] ||= M((e) => h("remove"), ["stop"])
337
- }, [p(i, {
338
- name: "close",
339
- size: 18
340
- })], 10, fe)) : l("", !0)], 2)) : (S(), c(D(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: _(["inline-flex h-8 items-center gap-1.5 overflow-hidden px-3 text-label-large transition-colors", [
345
- T.value,
346
- C.value,
347
- a.clickable && !a.disabled ? pe : "",
348
- a.disabled ? "cursor-not-allowed" : ""
349
- ]]),
350
- style: v(x.value),
351
- onClick: t[6] ||= (e) => a.clickable && !a.disabled && h("click")
352
- }, {
353
- default: ne(() => [
354
- a.icon ? (S(), c(i, {
355
- key: 0,
356
- name: a.icon,
357
- size: 18
358
- }, null, 8, ["name"])) : l("", !0),
359
- E(e.$slots, "default"),
360
- a.removable ? (S(), 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": ee(g).remove,
365
- disabled: a.disabled,
366
- onClick: t[5] ||= M((e) => h("remove"), ["stop"])
367
- }, [p(i, {
368
- name: "close",
369
- size: 16
370
- })], 8, X)) : 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 Q(e) {
384
- let t = O(/* @__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 b(() => {
394
- n(), e.value && (r = new MutationObserver(n), r.observe(e.value, { childList: !0 }));
395
- }), x(() => r?.disconnect()), (e) => e ? t.value.get(e) : void 0;
396
- }
397
- //#endregion
398
- //#region src/components/MList.vue
399
- var $ = /* @__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 = w(), a = Q(i);
428
- C("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 = s(() => [
440
- "flex flex-col",
441
- n.segmented ? "gap-0.5 p-2" : "py-2",
442
- n.nav && !n.segmented && "gap-0.5 px-3"
443
- ]);
444
- return (e, t) => (S(), u("ul", {
445
- ref_key: "listEl",
446
- ref: i,
447
- role: "list",
448
- class: _(o.value)
449
- }, [E(e.$slots, "default")], 2));
450
- }
451
- }), me = { class: "relative -my-2 inline-flex h-12 shrink-0 items-center" }, he = ["checked", "disabled"], ge = {
452
- key: 0,
453
- class: "text-body-large text-on-surface"
454
- }, _e = "bg-outline group-hover:bg-on-surface-variant group-active:bg-on-surface-variant peer-focus-visible:bg-on-surface-variant", ve = /* @__PURE__ */ m({
455
- __name: "MSwitch",
456
- props: {
457
- modelValue: { type: Boolean },
458
- disabled: {
459
- type: Boolean,
460
- default: !1
461
- },
462
- label: {},
463
- color: { default: "primary" },
464
- icon: {
465
- type: Boolean,
466
- default: !0
467
- }
468
- },
469
- emits: ["update:modelValue"],
470
- setup(e, { emit: t }) {
471
- let n = e, r = t, a = {
472
- primary: "border-primary bg-primary",
473
- secondary: "border-secondary bg-secondary",
474
- tertiary: "border-tertiary bg-tertiary",
475
- error: "border-error bg-error"
476
- }, f = {
477
- primary: "bg-on-primary group-hover:bg-primary-container group-active:bg-primary-container peer-focus-visible:bg-primary-container",
478
- secondary: "bg-on-secondary group-hover:bg-secondary-container group-active:bg-secondary-container peer-focus-visible:bg-secondary-container",
479
- tertiary: "bg-on-tertiary group-hover:bg-tertiary-container group-active:bg-tertiary-container peer-focus-visible:bg-tertiary-container",
480
- error: "bg-on-error group-hover:bg-error-container group-active:bg-error-container peer-focus-visible:bg-error-container"
481
- }, m = {
482
- primary: "text-on-primary-container",
483
- secondary: "text-on-secondary-container",
484
- tertiary: "text-on-tertiary-container",
485
- error: "text-on-error-container"
486
- }, h = {
487
- primary: "bg-primary",
488
- secondary: "bg-secondary",
489
- tertiary: "bg-tertiary",
490
- error: "bg-error"
491
- }, g = w(!1);
492
- function y() {
493
- n.disabled || (g.value = !0);
494
- }
495
- function b() {
496
- g.value = !1;
497
- }
498
- let x = s(() => g.value ? 28 / 24 : n.modelValue ? 1 : 16 / 24), C = s(() => ({
499
- transform: `translateY(-50%) translateX(${n.modelValue ? 18 : 0}px) scale(${x.value})`,
500
- 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"
501
- })), T = s(() => ({
502
- transform: `translateX(${n.modelValue ? 18 : 0}px)`,
503
- transition: n.modelValue ? "transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1)" : "transform 240ms cubic-bezier(0.2, 0, 0, 1)"
504
- }));
505
- return (t, n) => (S(), u("label", {
506
- class: _(["group inline-flex items-center gap-3 select-none", e.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer"]),
507
- onPointerdown: y,
508
- onPointerup: b,
509
- onPointerleave: b,
510
- onPointercancel: b
511
- }, [d("span", me, [d("span", { class: _(["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"]) }, [
512
- d("input", {
513
- type: "checkbox",
514
- class: "peer sr-only",
515
- checked: e.modelValue,
516
- disabled: e.disabled,
517
- onChange: n[0] ||= (t) => r("update:modelValue", !e.modelValue)
518
- }, null, 40, he),
519
- e.disabled ? l("", !0) : (S(), u("span", {
520
- key: 0,
521
- class: _(["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"]),
522
- style: v(T.value)
523
- }, null, 6)),
524
- e.disabled ? l("", !0) : (S(), u("span", {
525
- key: 1,
526
- 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",
527
- style: v(T.value)
528
- }, null, 4)),
529
- d("span", {
530
- class: _(["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"] : _e]),
531
- style: v(C.value)
532
- }, [p(o, {
533
- "enter-active-class": "transition-opacity duration-150 delay-[120ms]",
534
- "enter-from-class": "opacity-0",
535
- "enter-to-class": "opacity-100",
536
- "leave-active-class": "transition-opacity duration-75",
537
- "leave-from-class": "opacity-100",
538
- "leave-to-class": "opacity-0"
539
- }, {
540
- default: ne(() => [e.modelValue && e.icon ? (S(), c(i, {
541
- key: 0,
542
- name: "check",
543
- size: 14,
544
- class: _(m[e.color])
545
- }, null, 8, ["class"])) : l("", !0)]),
546
- _: 1
547
- })], 6)
548
- ], 2)]), e.label ? (S(), u("span", ge, k(e.label), 1)) : l("", !0)], 34));
549
- }
550
- }), ye = { class: "min-w-0 flex-1" }, be = {
551
- key: 0,
552
- class: "mli-expand-grid"
553
- }, xe = { class: "mli-expand-body" }, Se = ["src"], Ce = { class: "min-w-0 flex-1" }, we = 4, Te = 8, Ee = 16, De = /* @__PURE__ */ m({
554
- __name: "MListItem",
555
- props: {
556
- title: {},
557
- overline: {},
558
- subtitle: {},
559
- description: {},
560
- lines: {},
561
- icon: {},
562
- leading: {},
563
- avatarName: {},
564
- image: {},
565
- iconContainerColor: {},
566
- trailingIcon: {},
567
- trailingText: {},
568
- trailing: {},
569
- trailingValue: { type: Boolean },
570
- value: {},
571
- active: {
572
- type: Boolean,
573
- default: !1
574
- },
575
- disabled: {
576
- type: Boolean,
577
- default: !1
578
- },
579
- clickable: { type: Boolean },
580
- href: {},
581
- to: {},
582
- expandable: {
583
- type: Boolean,
584
- default: !1
585
- },
586
- expanded: { type: Boolean }
587
- },
588
- emits: [
589
- "click",
590
- "update:trailingValue",
591
- "update:expanded"
592
- ],
593
- setup(e, { emit: t }) {
594
- let r = e, a = t, f = te(), m = w(r.expanded ?? !1);
595
- j(() => r.expanded, (e) => {
596
- e !== void 0 && (m.value = e);
597
- });
598
- let v = s(() => m.value), y = h("m-list", null), b = s(() => r.lines ? r.lines : y?.lines.value ? y.lines.value : r.description || r.overline && r.subtitle ? 3 : r.subtitle || r.overline ? 2 : 1), x = s(() => r.clickable || r.href || r.to || !!f.onClick || y?.selectable.value || r.expandable), C = s(() => r.active ? !0 : y?.selectable.value && r.value != null ? y.selected.value === r.value : !1), T = s(() => r.leading ? r.leading : r.icon ? "icon" : r.avatarName ? "avatar" : r.image ? "image" : null), O = s(() => r.expandable ? "expand" : r.trailing ? r.trailing : r.trailingIcon ? "icon" : r.trailingText ? "text" : null), ee = {
599
- primary: "bg-primary-container text-on-primary-container",
600
- secondary: "bg-secondary-container text-on-secondary-container",
601
- tertiary: "bg-tertiary-container text-on-tertiary-container",
602
- error: "bg-error-container text-on-error-container",
603
- success: "bg-success-container text-on-success-container"
604
- }, A = s(() => y?.dense.value ?? !1), M = s(() => y?.nav.value ?? !1), N = s(() => y?.segmented.value ?? !1), P = s(() => y?.dividers.value ?? !1), F = s(() => C.value ? "text-on-secondary-container" : "text-on-surface"), L = s(() => C.value ? "text-on-secondary-container" : "text-on-surface-variant"), R = s(() => A.value ? "" : b.value === 3 ? "min-h-22" : b.value === 2 ? "min-h-18" : "min-h-14"), z = s(() => [
605
- "mli-row relative flex w-full items-center gap-4 text-left",
606
- N.value ? "bg-surface-container px-4" : M.value ? "rounded-full px-4" : "px-4",
607
- A.value ? "py-1" : b.value === 3 ? "py-3" : "py-2",
608
- R.value,
609
- x.value && !r.disabled && "cursor-pointer transition-colors duration-150 hover:bg-on-surface/8 active:bg-on-surface/12",
610
- C.value && "bg-secondary-container text-on-secondary-container",
611
- r.disabled && "opacity-[0.38] pointer-events-none"
612
- ]), B = w(null), re = w(null), V = (e) => e && "$el" in e ? e.$el : e, H = w(!1), U = w(!1), W = w(!1), G = s(() => N.value ? y?.segmentPosition(V(B.value)) : void 0), ie = s(() => {
613
- if (M.value) return [];
614
- let e = x.value && !r.disabled, t = e && U.value || C.value || e && W.value ? Ee : e && H.value ? Te : null;
615
- if (t !== null) return [
616
- t,
617
- t,
618
- t,
619
- t
620
- ];
621
- let n = G.value, i = n === "first" || n === "single" ? Ee : we, a = n === "last" || n === "single" ? Ee : we;
622
- return [
623
- i,
624
- i,
625
- a,
626
- a
627
- ];
628
- }), { snap: ae } = n(() => ie.value, (e) => {
629
- let t = re.value ?? V(B.value);
630
- t && (t.style.borderRadius = e.length ? e.map((e) => `${e}px`).join(" ") : "");
631
- });
632
- j([G, M], () => ae());
633
- function K(e) {
634
- e.pointerType !== "touch" && (H.value = !0);
635
- }
636
- function oe() {
637
- H.value = !1, U.value = !1;
638
- }
639
- function se(e) {
640
- e.button === 0 && (U.value = !0);
641
- }
642
- function q() {
643
- U.value = !1;
644
- }
645
- function ce(e) {
646
- W.value = e.currentTarget.matches(":focus-visible");
647
- }
648
- function le() {
649
- W.value = !1;
650
- }
651
- let ue = s(() => r.href ? "a" : r.to ? "router-link" : r.expandable ? "div" : "li"), J = s(() => r.href ? { href: r.href } : r.to ? { to: r.to } : {});
652
- function Y(e) {
653
- r.disabled || (m.value = !m.value, a("update:expanded", m.value), a("click", e));
654
- }
655
- function fe(e) {
656
- if (!r.disabled) {
657
- if (r.expandable) {
658
- Y(e);
659
- return;
660
- }
661
- y?.selectable.value && r.value != null && y.select(r.value), a("click", e);
662
- }
663
- }
664
- function X() {
665
- a("update:trailingValue", !r.trailingValue);
666
- }
667
- return (t, n) => e.expandable ? (S(), u("li", {
668
- key: 0,
669
- ref_key: "rootEl",
670
- ref: B,
671
- role: "listitem"
672
- }, [d("div", {
673
- ref_key: "shapeEl",
674
- ref: re,
675
- class: _(z.value),
676
- onClick: fe,
677
- onPointerenter: K,
678
- onPointerleave: oe,
679
- onPointerdown: se,
680
- onPointerup: q,
681
- onPointercancel: q
682
- }, [
683
- E(t.$slots, "leading", {}, () => [T.value === "icon" ? (S(), c(i, {
684
- key: 0,
685
- name: e.icon,
686
- size: 24,
687
- class: _(["shrink-0", L.value])
688
- }, null, 8, ["name", "class"])) : l("", !0)]),
689
- d("div", ye, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
690
- key: 0,
691
- class: _(["truncate text-label-small", L.value])
692
- }, k(e.overline), 3)) : l("", !0)]), E(t.$slots, "default", {}, () => [d("p", { class: _(["truncate text-body-large", F.value]) }, k(e.title), 3), e.subtitle && b.value >= 2 ? (S(), u("p", {
693
- key: 0,
694
- class: _(["text-body-medium", [L.value, b.value === 2 && "truncate"]])
695
- }, k(e.subtitle), 3)) : l("", !0)])]),
696
- p(i, {
697
- name: v.value ? "expand_less" : "expand_more",
698
- size: 20,
699
- class: _(["shrink-0", L.value])
700
- }, null, 8, ["name", "class"])
701
- ], 34), p(o, { name: "mli-expand" }, {
702
- default: ne(() => [v.value ? (S(), u("div", be, [d("div", xe, [E(t.$slots, "children")])])) : l("", !0)]),
703
- _: 3
704
- })], 512)) : (S(), c(D(ue.value), g({
705
- key: 1,
706
- class: z.value,
707
- ref_key: "rootEl",
708
- ref: B
709
- }, J.value, {
710
- role: "listitem",
711
- onClick: fe,
712
- onPointerenter: K,
713
- onPointerleave: oe,
714
- onPointerdown: se,
715
- onPointerup: q,
716
- onPointercancel: q,
717
- onFocus: ce,
718
- onBlur: le
719
- }), {
720
- default: ne(() => [
721
- P.value ? (S(), u("div", {
722
- key: 0,
723
- class: _(["absolute top-0 right-0 h-px bg-outline-variant", P.value === "inset" ? "left-16" : "left-0"])
724
- }, null, 2)) : l("", !0),
725
- E(t.$slots, "leading", {}, () => [T.value === "icon" ? (S(), c(i, {
726
- key: 0,
727
- name: e.icon,
728
- size: 24,
729
- class: _(["shrink-0", L.value])
730
- }, null, 8, ["name", "class"])) : T.value === "icon-container" ? (S(), u("div", {
731
- key: 1,
732
- class: _(["flex h-10 w-10 shrink-0 items-center justify-center rounded-full", ee[e.iconContainerColor || "primary"]])
733
- }, [p(i, {
734
- name: e.icon,
735
- size: 24
736
- }, null, 8, ["name"])], 2)) : T.value === "avatar" ? (S(), c(I, {
737
- key: 2,
738
- name: e.avatarName,
739
- size: 40,
740
- class: "shrink-0"
741
- }, null, 8, ["name"])) : T.value === "image" ? (S(), u("img", {
742
- key: 3,
743
- src: e.image,
744
- alt: "",
745
- class: "h-14 w-14 shrink-0 rounded-md object-cover"
746
- }, null, 8, Se)) : T.value === "checkbox" ? (S(), c(de, {
747
- key: 4,
748
- "model-value": C.value,
749
- class: "shrink-0"
750
- }, null, 8, ["model-value"])) : l("", !0)]),
751
- d("div", Ce, [E(t.$slots, "overline", {}, () => [e.overline ? (S(), u("p", {
752
- key: 0,
753
- class: _(["truncate text-label-small", L.value])
754
- }, k(e.overline), 3)) : l("", !0)]), E(t.$slots, "default", {}, () => [
755
- d("p", { class: _(["truncate text-body-large", F.value]) }, k(e.title), 3),
756
- e.subtitle && b.value >= 2 ? (S(), u("p", {
757
- key: 0,
758
- class: _(["text-body-medium", [L.value, b.value === 2 && "truncate"]])
759
- }, k(e.subtitle), 3)) : l("", !0),
760
- e.description && b.value >= 3 ? (S(), u("p", {
761
- key: 1,
762
- class: _(["line-clamp-2 text-body-small", L.value])
763
- }, k(e.description), 3)) : l("", !0)
764
- ])]),
765
- E(t.$slots, "trailing", {}, () => [O.value === "icon" ? (S(), c(i, {
766
- key: 0,
767
- name: e.trailingIcon,
768
- size: 24,
769
- class: _(["shrink-0", L.value])
770
- }, null, 8, ["name", "class"])) : O.value === "text" ? (S(), u("span", {
771
- key: 1,
772
- class: _(["shrink-0 text-label-small", L.value])
773
- }, k(e.trailingText), 3)) : O.value === "switch" ? (S(), c(ve, {
774
- key: 2,
775
- "model-value": !!e.trailingValue,
776
- "onUpdate:modelValue": X
777
- }, null, 8, ["model-value"])) : O.value === "checkbox" ? (S(), c(de, {
778
- key: 3,
779
- "model-value": !!e.trailingValue,
780
- "onUpdate:modelValue": X
781
- }, null, 8, ["model-value"])) : l("", !0)])
782
- ]),
783
- _: 3
784
- }, 16, ["class"]));
785
- }
786
- }), Oe = {
787
- key: 0,
788
- class: "flex items-center justify-between"
789
- }, ke = {
790
- key: 0,
791
- class: "text-label-large text-on-surface"
792
- }, Ae = {
793
- key: 1,
794
- class: "tabular-nums text-label-large text-on-surface-variant"
795
- }, je = [
796
- "aria-valuenow",
797
- "aria-valuemin",
798
- "aria-valuemax",
799
- "aria-disabled",
800
- "aria-orientation"
801
- ], Me = "color-mix(in srgb, var(--color-on-surface) 38%, transparent)", Ne = "color-mix(in srgb, var(--color-on-surface) 12%, transparent)", Pe = /* @__PURE__ */ m({
802
- __name: "MSlider",
803
- props: {
804
- modelValue: {},
805
- min: { default: 0 },
806
- max: { default: 100 },
807
- step: { default: 1 },
808
- disabled: {
809
- type: Boolean,
810
- default: !1
811
- },
812
- label: {},
813
- showValue: {
814
- type: Boolean,
815
- default: !1
816
- },
817
- showTooltip: {
818
- type: Boolean,
819
- default: !1
820
- },
821
- orientation: { default: "horizontal" },
822
- size: { default: "xs" },
823
- variant: { default: "standard" },
824
- stops: {
825
- type: Boolean,
826
- default: !1
827
- },
828
- icon: {},
829
- color: { default: "primary" },
830
- fillColor: {},
831
- thumbIcon: {},
832
- thumbColor: {}
833
- },
834
- emits: ["update:modelValue"],
835
- setup(e, { emit: t }) {
836
- let n = e, r = t, f = w(), m = w(!1), h = w(!1), g = s(() => n.orientation === "vertical"), b = s(() => n.variant === "range");
837
- s(() => n.variant === "centered");
838
- let x = s(() => {
839
- if (b.value) {
840
- let e = n.modelValue;
841
- return {
842
- lo: Math.min(e[0], e[1]),
843
- hi: Math.max(e[0], e[1])
844
- };
845
- }
846
- return {
847
- lo: n.modelValue,
848
- hi: n.modelValue
849
- };
850
- });
851
- function C(e) {
852
- let t = n.max - n.min;
853
- return t === 0 ? 0 : (e - n.min) / t * 100;
854
- }
855
- let E = s(() => C(x.value.lo)), D = s(() => C(x.value.hi)), O = s(() => C(0)), ee = s(() => n.variant === "centered" ? Math.min(E.value, O.value) <= 0 : n.variant !== "range" || E.value <= 0), te = s(() => n.variant === "centered" ? Math.max(E.value, O.value) >= 100 : n.variant === "range" ? D.value >= 100 : E.value >= 100), A = {
856
- xs: {
857
- track: 16,
858
- thumbW: 4,
859
- thumbH: 44,
860
- dot: 4,
861
- gap: 6,
862
- hitArea: 46,
863
- radius: 6,
864
- dotInset: 12,
865
- thumbInset: 5,
866
- iconSize: 14,
867
- thumbIconSize: 22
868
- },
869
- sm: {
870
- track: 28,
871
- thumbW: 4,
872
- thumbH: 40,
873
- dot: 5,
874
- gap: 7,
875
- hitArea: 46,
876
- radius: 8,
877
- dotInset: 13,
878
- thumbInset: 6,
879
- iconSize: 16,
880
- thumbIconSize: 28
881
- },
882
- md: {
883
- track: 54,
884
- thumbW: 5,
885
- thumbH: 62,
886
- dot: 5,
887
- gap: 8,
888
- hitArea: 66,
889
- radius: 12,
890
- dotInset: 15,
891
- thumbInset: 7,
892
- iconSize: 20,
893
- thumbIconSize: 42
894
- },
895
- lg: {
896
- track: 72,
897
- thumbW: 5,
898
- thumbH: 78,
899
- dot: 6,
900
- gap: 10,
901
- hitArea: 82,
902
- radius: 14,
903
- dotInset: 17,
904
- thumbInset: 8,
905
- iconSize: 24,
906
- thumbIconSize: 52
907
- },
908
- xl: {
909
- track: 96,
910
- thumbW: 6,
911
- thumbH: 98,
912
- dot: 7,
913
- gap: 10,
914
- hitArea: 100,
915
- radius: 18,
916
- dotInset: 19,
917
- thumbInset: 9,
918
- iconSize: 28,
919
- thumbIconSize: 66
920
- }
921
- }, j = s(() => A[n.size] ?? A.xs), M = s(() => j.value.thumbInset + j.value.thumbW / 2 + j.value.iconSize / 2 + 3), N = s(() => n.thumbIcon ? Math.max(j.value.gap, j.value.thumbIconSize / 2 + 4) : j.value.gap), P = {
922
- primary: "var(--color-primary)",
923
- secondary: "var(--color-secondary)",
924
- tertiary: "var(--color-tertiary)",
925
- error: "var(--color-error)"
926
- };
927
- function F(e, t) {
928
- let n = e ?? t;
929
- return P[n] ?? n;
930
- }
931
- let I = s(() => n.disabled ? {
932
- active: Me,
933
- inactive: Ne
934
- } : {
935
- active: F(n.fillColor, n.color),
936
- inactive: "var(--color-secondary-container)"
937
- }), L = s(() => n.disabled ? {
938
- active: Me,
939
- inactive: Ne
940
- } : {
941
- active: F(n.thumbColor, n.color),
942
- inactive: "var(--color-secondary-container)"
943
- });
944
- function R(e) {
945
- let t = Math.round((e - n.min) / n.step) * n.step + n.min;
946
- return Math.max(n.min, Math.min(n.max, +t.toFixed(10)));
947
- }
948
- function z(e) {
949
- if (!f.value) return 0;
950
- let t = f.value.getBoundingClientRect();
951
- return g.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));
952
- }
953
- function B(e) {
954
- return R(n.min + z(e) * (n.max - n.min));
955
- }
956
- function re(e) {
957
- if (n.disabled) return;
958
- e.preventDefault();
959
- let t = B(e);
960
- if (b.value) {
961
- let e = n.modelValue, i = Math.abs(t - e[0]) <= Math.abs(t - e[1]) ? 0 : 1;
962
- m.value = i;
963
- let a = [e[0], e[1]];
964
- a[i] = t, r("update:modelValue", a);
965
- } else m.value = "single", r("update:modelValue", t);
966
- window.addEventListener("pointermove", V), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H);
967
- }
968
- function V(e) {
969
- if (m.value === !1) return;
970
- let t = B(e);
971
- if (b.value) {
972
- let e = n.modelValue, i = [e[0], e[1]];
973
- i[m.value] = t, r("update:modelValue", i);
974
- } else r("update:modelValue", t);
975
- }
976
- function H() {
977
- m.value = !1, window.removeEventListener("pointermove", V), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H);
978
- }
979
- function U(e) {
980
- if (n.disabled) return;
981
- let t = {
982
- ArrowRight: 1,
983
- ArrowUp: 1,
984
- ArrowLeft: -1,
985
- ArrowDown: -1
986
- }[e.key];
987
- if (t !== void 0) {
988
- if (e.preventDefault(), b.value) {
989
- let e = n.modelValue;
990
- r("update:modelValue", [R(e[0] + t * n.step), e[1]]);
991
- } else r("update:modelValue", R(n.modelValue + t * n.step));
992
- }
993
- e.key === "Home" && (e.preventDefault(), r("update:modelValue", b.value ? [n.min, n.modelValue[1]] : n.min)), e.key === "End" && (e.preventDefault(), r("update:modelValue", b.value ? [n.modelValue[0], n.max] : n.max));
994
- }
995
- y(() => {
996
- window.removeEventListener("pointermove", V), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H);
997
- });
998
- let W = s(() => {
999
- if (!n.stops) return [];
1000
- let e = [], t = n.max - n.min, r = n.icon ? (j.value.iconSize + j.value.radius) / 2 : 0;
1001
- for (let i = n.min + n.step; i < n.max; i += n.step) {
1002
- let a = (i - n.min) / t * 100;
1003
- n.icon && a < r || e.push(a);
1004
- }
1005
- return e.length <= 28 ? e : [];
1006
- });
1007
- function G(e) {
1008
- return `calc(${$(e)} - ${N.value}px)`;
1009
- }
1010
- function ie(e) {
1011
- return `calc(100% - ${$(e)} - ${N.value}px)`;
1012
- }
1013
- function ae() {
1014
- return `calc(${$(E.value)} - ${N.value}px)`;
1015
- }
1016
- function K() {
1017
- return `calc(${$(E.value)} + ${N.value}px)`;
1018
- }
1019
- function oe() {
1020
- return `calc(${$(D.value)} - ${$(E.value)} - ${N.value * 2}px)`;
1021
- }
1022
- function se() {
1023
- return `calc(100% - ${$(D.value)} - ${N.value}px)`;
1024
- }
1025
- function q() {
1026
- return E.value >= O.value ? `${O.value}%` : `calc(${$(E.value)} + ${N.value}px)`;
1027
- }
1028
- function ce() {
1029
- return E.value >= O.value ? `calc(${$(E.value)} - ${O.value}% - ${N.value}px)` : `calc(${O.value}% - ${$(E.value)} - ${N.value}px)`;
1030
- }
1031
- function le() {
1032
- return E.value >= O.value ? `calc(100% - ${$(E.value)} - ${N.value}px)` : `calc(100% - ${O.value}% - ${N.value}px)`;
1033
- }
1034
- function ue() {
1035
- return E.value <= O.value ? `calc(${$(E.value)} - ${N.value}px)` : `calc(${O.value}% - ${N.value}px)`;
1036
- }
1037
- let de = s(() => j.value.radius), J = s(() => Math.max(2, de.value / 4)), Y = s(() => de.value * 1.3);
1038
- function fe() {
1039
- return `${J.value}px`;
1040
- }
1041
- function X() {
1042
- return g.value ? `${J.value}px ${J.value}px ${Y.value}px ${Y.value}px` : `${Y.value}px ${J.value}px ${J.value}px ${Y.value}px`;
1043
- }
1044
- function pe() {
1045
- return g.value ? `${Y.value}px ${Y.value}px ${J.value}px ${J.value}px` : `${J.value}px ${Y.value}px ${Y.value}px ${J.value}px`;
1046
- }
1047
- let Z = s(() => m.value === !1), Q = s(() => Z.value ? "75ms ease" : "0s");
1048
- function $(e) {
1049
- let t = j.value.thumbInset;
1050
- return `clamp(${t}px, ${e}%, calc(100% - ${t}px))`;
1051
- }
1052
- function me(e) {
1053
- let t = g.value ? j.value.thumbH : j.value.thumbW, n = g.value ? j.value.thumbW : j.value.thumbH, r = Math.min(t, n) / 2, i = m.value !== !1, a = {
1054
- position: "absolute",
1055
- width: `${t}px`,
1056
- height: `${n}px`,
1057
- borderRadius: `${r}px`,
1058
- backgroundColor: L.value.active,
1059
- zIndex: "2",
1060
- transition: Z.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
1061
- }, o = i || h.value, s = i ? 1.08 : 1, c = o ? .5 : 1;
1062
- return g.value ? (a.left = "50%", a.bottom = $(e), a.transform = `translateX(-50%) translateY(50%) scaleX(${s}) scaleY(${c})`) : (a.left = $(e), a.top = "50%", a.transform = `translateX(-50%) translateY(-50%) scaleY(${s}) scaleX(${c})`), a;
1063
- }
1064
- function he(e) {
1065
- let t = m.value === !1 ? 1 : 1.15, n = {
1066
- position: "absolute",
1067
- color: L.value.active,
1068
- zIndex: "2",
1069
- transition: Z.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
1070
- };
1071
- return g.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;
1072
- }
1073
- function ge(e) {
1074
- let t = j.value.track / 2 + 36, n = j.value.track / 2 + 40;
1075
- return g.value ? {
1076
- left: `calc(50% - ${n}px)`,
1077
- bottom: $(e),
1078
- transform: "translateY(50%)",
1079
- transition: Z.value ? "bottom " + Q.value : "none"
1080
- } : {
1081
- left: $(e),
1082
- top: `calc(50% - ${t}px)`,
1083
- transform: "translateX(-50%)",
1084
- transition: Z.value ? "left " + Q.value : "none"
1085
- };
1086
- }
1087
- let _e = s(() => b.value ? `${x.value.lo} – ${x.value.hi}` : String(n.modelValue)), ve = s(() => b.value && typeof m.value == "number" ? n.modelValue[m.value] : n.modelValue), ye = s(() => b.value && typeof m.value == "number" ? C(n.modelValue[m.value]) : E.value);
1088
- return (t, n) => (S(), u("div", { class: _(["flex select-none", g.value ? "h-full flex-col items-center" : "flex-col gap-1"]) }, [e.label || e.showValue ? (S(), u("div", Oe, [e.label ? (S(), u("span", ke, k(e.label), 1)) : l("", !0), e.showValue ? (S(), u("span", Ae, k(_e.value), 1)) : l("", !0)])) : l("", !0), d("div", { class: _(["flex items-center", g.value ? "flex-1 flex-col" : ""]) }, [d("div", {
1089
- ref_key: "trackEl",
1090
- ref: f,
1091
- role: "slider",
1092
- tabindex: "0",
1093
- "aria-valuenow": b.value ? void 0 : e.modelValue,
1094
- "aria-valuemin": e.min,
1095
- "aria-valuemax": e.max,
1096
- "aria-disabled": e.disabled || void 0,
1097
- "aria-orientation": e.orientation,
1098
- class: _(["group relative touch-none cursor-pointer outline-none", e.disabled && "cursor-not-allowed"]),
1099
- style: v(g.value ? {
1100
- width: `${j.value.hitArea}px`,
1101
- minHeight: "160px",
1102
- height: "100%"
1103
- } : {
1104
- height: `${j.value.hitArea}px`,
1105
- width: "100%"
1106
- }),
1107
- onPointerdown: re,
1108
- onKeydown: U,
1109
- onFocus: n[0] ||= (e) => h.value = !0,
1110
- onBlur: n[1] ||= (e) => h.value = !1
1111
- }, [
1112
- d("div", {
1113
- class: "absolute",
1114
- style: v(g.value ? {
1115
- left: "50%",
1116
- top: "0",
1117
- bottom: "0",
1118
- width: `${j.value.track}px`,
1119
- transform: "translateX(-50%)",
1120
- borderRadius: `${Y.value}px`
1121
- } : {
1122
- top: "50%",
1123
- left: "0",
1124
- right: "0",
1125
- height: `${j.value.track}px`,
1126
- transform: "translateY(-50%)",
1127
- borderRadius: `${Y.value}px`
1128
- })
1129
- }, [
1130
- e.variant === "standard" ? (S(), u(a, { key: 0 }, [d("div", {
1131
- class: "absolute",
1132
- style: v({
1133
- ...g.value ? {
1134
- left: 0,
1135
- right: 0,
1136
- bottom: 0,
1137
- height: G(E.value)
1138
- } : {
1139
- top: 0,
1140
- bottom: 0,
1141
- left: 0,
1142
- width: G(E.value)
1143
- },
1144
- borderRadius: X(),
1145
- backgroundColor: I.value.active,
1146
- transition: `all ${Q.value}`
1147
- })
1148
- }, null, 4), d("div", {
1149
- class: "absolute",
1150
- style: v({
1151
- ...g.value ? {
1152
- left: 0,
1153
- right: 0,
1154
- top: 0,
1155
- height: ie(E.value)
1156
- } : {
1157
- top: 0,
1158
- bottom: 0,
1159
- right: 0,
1160
- width: ie(E.value)
1161
- },
1162
- borderRadius: pe(),
1163
- backgroundColor: I.value.inactive,
1164
- transition: `all ${Q.value}`
1165
- })
1166
- }, null, 4)], 64)) : e.variant === "centered" ? (S(), u(a, { key: 1 }, [
1167
- d("div", {
1168
- class: "absolute",
1169
- style: v({
1170
- ...g.value ? {
1171
- left: 0,
1172
- right: 0,
1173
- bottom: q(),
1174
- height: ce()
1175
- } : {
1176
- top: 0,
1177
- bottom: 0,
1178
- left: q(),
1179
- width: ce()
1180
- },
1181
- borderRadius: fe(),
1182
- backgroundColor: I.value.active,
1183
- transition: `all ${Q.value}`
1184
- })
1185
- }, null, 4),
1186
- d("div", {
1187
- class: "absolute",
1188
- style: v({
1189
- ...g.value ? {
1190
- left: 0,
1191
- right: 0,
1192
- top: 0,
1193
- height: le()
1194
- } : {
1195
- top: 0,
1196
- bottom: 0,
1197
- right: 0,
1198
- width: le()
1199
- },
1200
- borderRadius: pe(),
1201
- backgroundColor: I.value.inactive,
1202
- transition: `all ${Q.value}`
1203
- })
1204
- }, null, 4),
1205
- d("div", {
1206
- class: "absolute",
1207
- style: v({
1208
- ...g.value ? {
1209
- left: 0,
1210
- right: 0,
1211
- bottom: 0,
1212
- height: ue()
1213
- } : {
1214
- top: 0,
1215
- bottom: 0,
1216
- left: 0,
1217
- width: ue()
1218
- },
1219
- borderRadius: X(),
1220
- backgroundColor: I.value.inactive,
1221
- transition: `all ${Q.value}`
1222
- })
1223
- }, null, 4)
1224
- ], 64)) : e.variant === "range" ? (S(), u(a, { key: 2 }, [
1225
- d("div", {
1226
- class: "absolute",
1227
- style: v({
1228
- ...g.value ? {
1229
- left: 0,
1230
- right: 0,
1231
- bottom: 0,
1232
- height: ae()
1233
- } : {
1234
- top: 0,
1235
- bottom: 0,
1236
- left: 0,
1237
- width: ae()
1238
- },
1239
- borderRadius: X(),
1240
- backgroundColor: I.value.inactive,
1241
- transition: `all ${Q.value}`
1242
- })
1243
- }, null, 4),
1244
- d("div", {
1245
- class: "absolute",
1246
- style: v({
1247
- ...g.value ? {
1248
- left: 0,
1249
- right: 0,
1250
- bottom: K(),
1251
- height: oe()
1252
- } : {
1253
- top: 0,
1254
- bottom: 0,
1255
- left: K(),
1256
- width: oe()
1257
- },
1258
- borderRadius: fe(),
1259
- backgroundColor: I.value.active,
1260
- transition: `all ${Q.value}`
1261
- })
1262
- }, null, 4),
1263
- d("div", {
1264
- class: "absolute",
1265
- style: v({
1266
- ...g.value ? {
1267
- left: 0,
1268
- right: 0,
1269
- top: 0,
1270
- height: se()
1271
- } : {
1272
- top: 0,
1273
- bottom: 0,
1274
- right: 0,
1275
- width: se()
1276
- },
1277
- borderRadius: pe(),
1278
- backgroundColor: I.value.inactive,
1279
- transition: `all ${Q.value}`
1280
- })
1281
- }, null, 4)
1282
- ], 64)) : l("", !0),
1283
- e.icon ? (S(), c(i, {
1284
- key: 3,
1285
- name: e.icon,
1286
- size: j.value.iconSize,
1287
- class: "absolute z-[1]",
1288
- style: v({
1289
- color: e.variant === "standard" && E.value > 0 || e.variant === "range" && E.value > 0 ? I.value.inactive : I.value.active,
1290
- ...g.value ? {
1291
- left: "50%",
1292
- bottom: `${M.value}px`,
1293
- transform: "translateX(-50%)"
1294
- } : {
1295
- top: "50%",
1296
- left: `${M.value}px`,
1297
- transform: "translateY(-50%)"
1298
- },
1299
- transition: "color 150ms ease"
1300
- })
1301
- }, null, 8, [
1302
- "name",
1303
- "size",
1304
- "style"
1305
- ])) : e.stops ? l("", !0) : (S(), u("div", {
1306
- key: 4,
1307
- class: "absolute rounded-full",
1308
- style: v({
1309
- width: `${j.value.dot}px`,
1310
- height: `${j.value.dot}px`,
1311
- backgroundColor: I.value.active,
1312
- opacity: +!ee.value,
1313
- ...g.value ? {
1314
- left: "50%",
1315
- bottom: `${j.value.dotInset}px`,
1316
- transform: "translateX(-50%)"
1317
- } : {
1318
- top: "50%",
1319
- left: `${j.value.dotInset}px`,
1320
- transform: "translateY(-50%)"
1321
- },
1322
- transition: "opacity 150ms ease"
1323
- })
1324
- }, null, 4)),
1325
- e.stops ? l("", !0) : (S(), u("div", {
1326
- key: 5,
1327
- class: "absolute rounded-full",
1328
- style: v({
1329
- width: `${j.value.dot}px`,
1330
- height: `${j.value.dot}px`,
1331
- backgroundColor: I.value.active,
1332
- opacity: +!te.value,
1333
- ...g.value ? {
1334
- left: "50%",
1335
- top: `${j.value.dotInset}px`,
1336
- transform: "translateX(-50%)"
1337
- } : {
1338
- top: "50%",
1339
- right: `${j.value.dotInset}px`,
1340
- transform: "translateY(-50%)"
1341
- },
1342
- transition: "opacity 150ms ease"
1343
- })
1344
- }, null, 4)),
1345
- e.stops ? (S(!0), u(a, { key: 6 }, T(W.value, (e, t) => (S(), u("div", {
1346
- key: t,
1347
- class: "absolute rounded-full",
1348
- style: v({
1349
- width: `${j.value.dot}px`,
1350
- height: `${j.value.dot}px`,
1351
- backgroundColor: e <= E.value ? I.value.inactive : I.value.active,
1352
- opacity: Math.abs(e - E.value) < .01 || b.value && Math.abs(e - D.value) < .01 ? 0 : 1,
1353
- ...g.value ? {
1354
- left: "50%",
1355
- bottom: `${e}%`,
1356
- transform: "translateX(-50%) translateY(50%)"
1357
- } : {
1358
- top: "50%",
1359
- left: `${e}%`,
1360
- transform: "translateX(-50%) translateY(-50%)"
1361
- }
1362
- })
1363
- }, null, 4))), 128)) : l("", !0)
1364
- ], 4),
1365
- e.thumbIcon ? (S(), u(a, { key: 0 }, [p(i, {
1366
- name: e.thumbIcon,
1367
- size: j.value.thumbIconSize,
1368
- class: "pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
1369
- style: v(he(E.value))
1370
- }, null, 8, [
1371
- "name",
1372
- "size",
1373
- "style"
1374
- ]), b.value ? (S(), c(i, {
1375
- key: 0,
1376
- name: e.thumbIcon,
1377
- size: j.value.thumbIconSize,
1378
- class: "pointer-events-none",
1379
- style: v(he(D.value))
1380
- }, null, 8, [
1381
- "name",
1382
- "size",
1383
- "style"
1384
- ])) : l("", !0)], 64)) : (S(), u(a, { key: 1 }, [d("div", {
1385
- class: "pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
1386
- style: v(me(E.value))
1387
- }, null, 4), b.value ? (S(), u("div", {
1388
- key: 0,
1389
- class: "pointer-events-none",
1390
- style: v(me(D.value))
1391
- }, null, 4)) : l("", !0)], 64)),
1392
- p(o, {
1393
- "enter-active-class": "transition-opacity duration-100",
1394
- "enter-from-class": "opacity-0",
1395
- "leave-active-class": "transition-opacity duration-75",
1396
- "leave-to-class": "opacity-0"
1397
- }, {
1398
- default: ne(() => [e.showTooltip && m.value !== !1 ? (S(), u("div", {
1399
- key: 0,
1400
- 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",
1401
- style: v(ge(ye.value))
1402
- }, k(ve.value), 5)) : l("", !0)]),
1403
- _: 1
1404
- })
1405
- ], 46, je)], 2)], 2));
1406
- }
1407
- });
1408
- //#endregion
1409
- export { Q as a, q as c, B as d, z as f, F as g, N as h, $ as i, V as l, P as m, De as n, Z as o, I as p, ve as r, de as s, Pe as t, H as u };
1410
-
1411
- //# sourceMappingURL=MSlider-LyH_gy8D.js.map