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