@m3ui-vue/m3ui-vue 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/API.md +666 -12
  2. package/dist/MMenuItem-BOkcVtEe.js +809 -0
  3. package/dist/MMenuItem-BOkcVtEe.js.map +1 -0
  4. package/dist/MSlider-BXsBv0ox.js +1402 -0
  5. package/dist/MSlider-BXsBv0ox.js.map +1 -0
  6. package/dist/MTextField-rML9jnXs.js +671 -0
  7. package/dist/MTextField-rML9jnXs.js.map +1 -0
  8. package/dist/api.json +1 -1
  9. package/dist/code-editor.js +1 -1
  10. package/dist/components/MBottomSheet.vue.d.ts +20 -1
  11. package/dist/components/MDialog.vue.d.ts +17 -8
  12. package/dist/components/MDragDropList.vue.d.ts +1 -1
  13. package/dist/components/MIconButton.vue.d.ts +1 -1
  14. package/dist/components/MMap.vue.d.ts +74 -0
  15. package/dist/components/MMapBaseLayers.vue.d.ts +15 -0
  16. package/dist/components/MMapControl.vue.d.ts +40 -0
  17. package/dist/components/MMapFeatureInfo.vue.d.ts +25 -0
  18. package/dist/components/MMapFilter.vue.d.ts +19 -0
  19. package/dist/components/MMapGeoJson.vue.d.ts +34 -0
  20. package/dist/components/MMapHover.vue.d.ts +17 -0
  21. package/dist/components/MMapIdentify.vue.d.ts +37 -0
  22. package/dist/components/MMapLayers.vue.d.ts +31 -0
  23. package/dist/components/MMapMarker.vue.d.ts +45 -0
  24. package/dist/components/MMapMeasure.vue.d.ts +43 -0
  25. package/dist/components/MMapPopup.vue.d.ts +45 -0
  26. package/dist/components/MMapSearch.vue.d.ts +28 -0
  27. package/dist/components/MMenuItem.vue.d.ts +2 -2
  28. package/dist/components/MSeekBar.vue.d.ts +122 -0
  29. package/dist/components/MSplitButton.vue.d.ts +2 -2
  30. package/dist/components/_MMapAttribution.vue.d.ts +7 -0
  31. package/dist/components/_MMapLayerItem.vue.d.ts +25 -0
  32. package/dist/composables/_mapGeometry.d.ts +13 -0
  33. package/dist/composables/_mapPin.d.ts +5 -0
  34. package/dist/composables/_popupPosition.d.ts +12 -0
  35. package/dist/composables/_ssrState.d.ts +30 -0
  36. package/dist/composables/_storageKeys.d.ts +3 -0
  37. package/dist/composables/_useCalendarMonth.d.ts +24 -0
  38. package/dist/composables/_useEscapeStack.d.ts +3 -0
  39. package/dist/composables/_useScrollLock.d.ts +8 -0
  40. package/dist/composables/_useSheetMotion.d.ts +16 -1
  41. package/dist/composables/_useThemeTokens.d.ts +7 -0
  42. package/dist/composables/mapAdapters.d.ts +111 -0
  43. package/dist/composables/mapSearch.d.ts +31 -0
  44. package/dist/composables/themeInitScript.d.ts +4 -3
  45. package/dist/composables/useColorPalette.d.ts +173 -7
  46. package/dist/composables/useLocale.d.ts +38 -0
  47. package/dist/composables/useMap.d.ts +47 -0
  48. package/dist/composables/useMapFilter.d.ts +10 -0
  49. package/dist/composables/useMapLayers.d.ts +30 -0
  50. package/dist/composables/useTheme.d.ts +2 -1
  51. package/dist/index.d.ts +4 -1
  52. package/dist/locales/index.js +273 -7
  53. package/dist/locales/index.js.map +1 -1
  54. package/dist/m3ui-vue.css +1 -1
  55. package/dist/m3ui.js +7913 -8625
  56. package/dist/m3ui.js.map +1 -1
  57. package/dist/map.d.ts +24 -0
  58. package/dist/map.js +2067 -0
  59. package/dist/map.js.map +1 -0
  60. package/dist/plugin.d.ts +18 -2
  61. package/dist/rich-text-editor.js +26 -25
  62. package/dist/rich-text-editor.js.map +1 -1
  63. package/dist/styles.css +1 -1
  64. package/dist/{useLocale-CuvWRZ1h.js → useLocale-CqQrhWFl.js} +40 -2
  65. package/dist/useLocale-CqQrhWFl.js.map +1 -0
  66. package/package.json +11 -2
  67. package/src/__tests__/MDialog.test.ts +30 -0
  68. package/src/__tests__/MFab.test.ts +52 -6
  69. package/src/__tests__/MMap.test.ts +422 -0
  70. package/src/__tests__/MMapLayers.test.ts +257 -0
  71. package/src/__tests__/MMapTools.test.ts +233 -0
  72. package/src/__tests__/MSeekBar.test.ts +170 -0
  73. package/src/__tests__/MTooltip.test.ts +110 -0
  74. package/src/__tests__/_fakeMaplibre.ts +161 -0
  75. package/src/__tests__/calendarMonth.test.ts +59 -0
  76. package/src/__tests__/hydration.test.ts +33 -0
  77. package/src/__tests__/pickerModals.test.ts +128 -0
  78. package/src/__tests__/popupPosition.test.ts +224 -0
  79. package/src/__tests__/scrollLock.test.ts +110 -0
  80. package/src/__tests__/sheets.test.ts +158 -0
  81. package/src/__tests__/ssr.test.ts +63 -1
  82. package/src/__tests__/ssrState.test.ts +155 -0
  83. package/src/__tests__/themeInitScript.test.ts +18 -0
  84. package/src/components/MAutocomplete.vue +2 -4
  85. package/src/components/MBottomSheet.vue +211 -13
  86. package/src/components/MCommandPalette.vue +4 -6
  87. package/src/components/MContextMenu.vue +19 -5
  88. package/src/components/MDatePicker.vue +29 -70
  89. package/src/components/MDatePickerModal.vue +116 -172
  90. package/src/components/MDateRangePicker.vue +29 -51
  91. package/src/components/MDateRangePickerModal.vue +84 -162
  92. package/src/components/MDialog.vue +87 -63
  93. package/src/components/MFab.vue +29 -7
  94. package/src/components/MIconButton.vue +1 -1
  95. package/src/components/MLightbox.vue +12 -5
  96. package/src/components/MMap.vue +568 -0
  97. package/src/components/MMapBaseLayers.vue +67 -0
  98. package/src/components/MMapControl.vue +175 -0
  99. package/src/components/MMapFeatureInfo.vue +41 -0
  100. package/src/components/MMapFilter.vue +80 -0
  101. package/src/components/MMapGeoJson.vue +136 -0
  102. package/src/components/MMapHover.vue +131 -0
  103. package/src/components/MMapIdentify.vue +104 -0
  104. package/src/components/MMapLayers.vue +111 -0
  105. package/src/components/MMapMarker.vue +109 -0
  106. package/src/components/MMapMeasure.vue +452 -0
  107. package/src/components/MMapPopup.vue +103 -0
  108. package/src/components/MMapSearch.vue +162 -0
  109. package/src/components/MMenu.vue +31 -12
  110. package/src/components/MMenuItem.vue +21 -4
  111. package/src/components/MMultiAutocomplete.vue +2 -4
  112. package/src/components/MMultiSelect.vue +2 -4
  113. package/src/components/MNavigationDrawer.vue +2 -8
  114. package/src/components/MNavigationRail.vue +2 -3
  115. package/src/components/MSearchBar.vue +2 -5
  116. package/src/components/MSeekBar.vue +593 -0
  117. package/src/components/MSelect.vue +2 -8
  118. package/src/components/MSplitButton.vue +23 -7
  119. package/src/components/MSpotlightSearch.vue +4 -6
  120. package/src/components/MTimePicker.vue +23 -6
  121. package/src/components/MTimePickerModal.vue +213 -226
  122. package/src/components/MTooltip.vue +99 -3
  123. package/src/components/_MMapAttribution.vue +81 -0
  124. package/src/components/_MMapLayerItem.vue +77 -0
  125. package/src/composables/_mapGeometry.ts +75 -0
  126. package/src/composables/_mapPin.ts +25 -0
  127. package/src/composables/_popupPosition.ts +39 -0
  128. package/src/composables/_ssrState.ts +80 -0
  129. package/src/composables/_storageKeys.ts +6 -0
  130. package/src/composables/_useCalendarMonth.ts +74 -0
  131. package/src/composables/_useEscapeStack.ts +33 -0
  132. package/src/composables/_useScrollLock.ts +41 -0
  133. package/src/composables/_useSheetMotion.ts +82 -20
  134. package/src/composables/_useThemeTokens.ts +42 -0
  135. package/src/composables/mapAdapters.ts +208 -0
  136. package/src/composables/mapSearch.ts +56 -0
  137. package/src/composables/themeInitScript.ts +6 -4
  138. package/src/composables/useColorPalette.ts +23 -9
  139. package/src/composables/useLocale.ts +78 -0
  140. package/src/composables/useMap.ts +98 -0
  141. package/src/composables/useMapFilter.ts +45 -0
  142. package/src/composables/useMapLayers.ts +124 -0
  143. package/src/composables/useTheme.ts +8 -3
  144. package/src/composables/useWindowSizeClass.ts +14 -5
  145. package/src/index.ts +4 -1
  146. package/src/locales/de.ts +39 -1
  147. package/src/locales/es.ts +39 -1
  148. package/src/locales/fr.ts +39 -1
  149. package/src/locales/ja.ts +39 -1
  150. package/src/locales/ko.ts +39 -1
  151. package/src/locales/pt.ts +39 -1
  152. package/src/locales/zh.ts +39 -1
  153. package/src/map.ts +32 -0
  154. package/src/plugin.ts +54 -3
  155. package/dist/MTextField-BPbFeI9M.js +0 -1368
  156. package/dist/MTextField-BPbFeI9M.js.map +0 -1
  157. package/dist/useLocale-CuvWRZ1h.js.map +0 -1
@@ -1,1368 +0,0 @@
1
- import { i as e } from "./useLocale-CuvWRZ1h.js";
2
- import { t } from "./MIcon-DLOkQduI.js";
3
- import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
- import { Fragment as r, Teleport as i, Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, inject as m, mergeProps as h, nextTick 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, toDisplayString as O, unref as k, useId as A, useSlots as j, watch as ee, withCtx as M, withDirectives as N, withModifiers as P } from "vue";
5
- //#region src/directives/vRipple.ts
6
- function F(e) {
7
- return e === !1 ? { disabled: !0 } : typeof e == "string" ? { color: e } : e === !0 || e == null ? {} : e;
8
- }
9
- function te(e, t, n) {
10
- let r = e.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = document.createElement("span");
11
- a.className = "m3-ripple-layer";
12
- let o = document.createElement("span");
13
- o.className = "m3-ripple", o.style.cssText = `width:${i}px;height:${i}px;top:${t.clientY - r.top - i / 2}px;left:${t.clientX - r.left - i / 2}px`, n && (o.style.background = n), a.appendChild(o), e.appendChild(a), o.addEventListener("animationend", () => a.remove(), { once: !0 });
14
- }
15
- var I = /* @__PURE__ */ new WeakMap(), L = {
16
- mounted(e, t) {
17
- let n = {
18
- options: F(t.value),
19
- onPointerDown(t) {
20
- if (n.options.disabled || t.button !== 0) return;
21
- let { position: r } = getComputedStyle(e);
22
- (!r || r === "static") && (e.style.position = "relative"), te(e, t, n.options.color);
23
- }
24
- };
25
- I.set(e, n), e.addEventListener("pointerdown", n.onPointerDown);
26
- },
27
- updated(e, t) {
28
- let n = I.get(e);
29
- n && (n.options = F(t.value));
30
- },
31
- beforeUnmount(e) {
32
- let t = I.get(e);
33
- t && e.removeEventListener("pointerdown", t.onPointerDown), I.delete(e);
34
- }
35
- }, R = ["aria-label"], ne = {
36
- key: 0,
37
- class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
38
- }, z = [
39
- "width",
40
- "height",
41
- "viewBox"
42
- ], B = ["d", "stroke-dasharray"], V = 3, H = 9, U = /* @__PURE__ */ p({
43
- __name: "MSpinner",
44
- props: {
45
- size: { default: 20 },
46
- wavy: {
47
- type: Boolean,
48
- default: !1
49
- },
50
- label: {}
51
- },
52
- setup(t) {
53
- let n = t, r = e(), i = o(() => (n.size / 2 - 1 - V / 2) / 1.25), a = o(() => n.size / 2), s = o(() => {
54
- let e = a.value, t = i.value, n = t * .08, r = [], o = 0, s = 0, c = 0;
55
- for (let i = 0; i <= 216; i++) {
56
- let a = 2 * Math.PI * i / 216 - Math.PI / 2, l = t + n * Math.sin(H * a), u = e + l * Math.cos(a), d = e + l * Math.sin(a);
57
- i > 0 && (o += Math.sqrt((u - s) ** 2 + (d - c) ** 2)), r.push(`${i === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), s = u, c = d;
58
- }
59
- let l = o * .58, u = o - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
60
- return {
61
- path: r.join("") + "Z",
62
- dash: d,
63
- len: o.toFixed(1)
64
- };
65
- });
66
- return (e, n) => (S(), l("span", {
67
- class: "inline-flex shrink-0 items-center justify-center",
68
- style: v({
69
- width: `${t.size}px`,
70
- height: `${t.size}px`
71
- }),
72
- role: "status",
73
- "aria-label": t.label ?? k(r).loading
74
- }, [t.wavy ? (S(), l("svg", {
75
- key: 1,
76
- width: t.size,
77
- height: t.size,
78
- viewBox: `0 0 ${t.size} ${t.size}`,
79
- fill: "none",
80
- class: "animate-[m3-wavy-spin_2.8s_linear_infinite]",
81
- style: v(`transform-origin: ${a.value}px ${a.value}px`)
82
- }, [u("path", {
83
- d: s.value.path,
84
- stroke: "currentColor",
85
- "stroke-width": V,
86
- "stroke-linecap": "round",
87
- "stroke-dasharray": s.value.dash,
88
- class: "animate-[m3-wavy-travel_2s_linear_infinite]",
89
- style: v({ "--m3-wave-len": s.value.len })
90
- }, null, 12, B)], 12, z)) : (S(), l("span", ne))], 12, R));
91
- }
92
- }), re = [
93
- "bg-surface-container-highest",
94
- "bg-surface-container-high",
95
- "bg-surface-container-low",
96
- "bg-surface-container-lowest",
97
- "bg-surface-container",
98
- "bg-surface-variant",
99
- "bg-surface-bright",
100
- "bg-surface-dim",
101
- "bg-surface",
102
- "bg-background",
103
- "bg-inverse-surface",
104
- "bg-primary-container",
105
- "bg-secondary-container",
106
- "bg-tertiary-container",
107
- "bg-error-container",
108
- "bg-primary-fixed",
109
- "bg-primary-fixed-dim",
110
- "bg-secondary-fixed",
111
- "bg-secondary-fixed-dim",
112
- "bg-tertiary-fixed",
113
- "bg-tertiary-fixed-dim",
114
- "bg-primary",
115
- "bg-secondary",
116
- "bg-tertiary",
117
- "bg-error"
118
- ];
119
- function W(e) {
120
- for (let t of re) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
121
- return null;
122
- }
123
- function G(e) {
124
- if (!e || e === "transparent") return !0;
125
- let t = e.match(/^rgba?\(([^)]+)\)$/);
126
- if (t) {
127
- let e = t[1].split(",").map((e) => e.trim());
128
- if (e.length === 4 && parseFloat(e[3]) === 0) return !0;
129
- }
130
- return !1;
131
- }
132
- function K(e, t) {
133
- let n = w("var(--color-surface)");
134
- function r(r) {
135
- n.value = r, e.value?.style.setProperty("--field-bg", t() ?? r);
136
- }
137
- function i() {
138
- let t = e.value?.parentElement ?? null;
139
- for (; t;) {
140
- let e = W(t);
141
- if (e) {
142
- r(e);
143
- return;
144
- }
145
- if (t === document.body) {
146
- r("var(--color-surface)");
147
- return;
148
- }
149
- let n = getComputedStyle(t).backgroundColor;
150
- if (!G(n)) {
151
- r(n);
152
- return;
153
- }
154
- t = t.parentElement;
155
- }
156
- r("var(--color-surface)");
157
- }
158
- let a = null;
159
- return b(() => {
160
- i(), a = new MutationObserver(() => i()), a.observe(document.documentElement, {
161
- attributes: !0,
162
- attributeFilter: [
163
- "class",
164
- "style",
165
- "data-theme"
166
- ]
167
- });
168
- }), y(() => a?.disconnect()), { resolvedFieldBg: o(() => t() ?? n.value) };
169
- }
170
- //#endregion
171
- //#region src/composables/useDebounce.ts
172
- function q(e, t) {
173
- let n = null;
174
- function r(...r) {
175
- n && clearTimeout(n), n = setTimeout(() => {
176
- n = null, e(...r);
177
- }, t);
178
- }
179
- function i() {
180
- n &&= (clearTimeout(n), null);
181
- }
182
- return y(i), {
183
- debounced: r,
184
- cancel: i
185
- };
186
- }
187
- //#endregion
188
- //#region src/composables/motion.ts
189
- var J = {
190
- standard: {
191
- fastSpatial: {
192
- dampingRatio: .9,
193
- stiffness: 1400
194
- },
195
- defaultSpatial: {
196
- dampingRatio: .9,
197
- stiffness: 700
198
- },
199
- slowSpatial: {
200
- dampingRatio: .9,
201
- stiffness: 300
202
- },
203
- fastEffects: {
204
- dampingRatio: 1,
205
- stiffness: 3800
206
- },
207
- defaultEffects: {
208
- dampingRatio: 1,
209
- stiffness: 1600
210
- },
211
- slowEffects: {
212
- dampingRatio: 1,
213
- stiffness: 800
214
- }
215
- },
216
- expressive: {
217
- fastSpatial: {
218
- dampingRatio: .6,
219
- stiffness: 800
220
- },
221
- defaultSpatial: {
222
- dampingRatio: .8,
223
- stiffness: 380
224
- },
225
- slowSpatial: {
226
- dampingRatio: .8,
227
- stiffness: 200
228
- },
229
- fastEffects: {
230
- dampingRatio: 1,
231
- stiffness: 3800
232
- },
233
- defaultEffects: {
234
- dampingRatio: 1,
235
- stiffness: 1600
236
- },
237
- slowEffects: {
238
- dampingRatio: 1,
239
- stiffness: 800
240
- }
241
- }
242
- }, Y = {
243
- emphasized: [
244
- .2,
245
- 0,
246
- 0,
247
- 1
248
- ],
249
- emphasizedDecelerate: [
250
- .05,
251
- .7,
252
- .1,
253
- 1
254
- ],
255
- emphasizedAccelerate: [
256
- .3,
257
- 0,
258
- .8,
259
- .15
260
- ],
261
- standard: [
262
- .2,
263
- 0,
264
- 0,
265
- 1
266
- ],
267
- standardDecelerate: [
268
- 0,
269
- 0,
270
- 0,
271
- 1
272
- ],
273
- standardAccelerate: [
274
- .3,
275
- 0,
276
- 1,
277
- 1
278
- ],
279
- legacy: [
280
- .4,
281
- 0,
282
- .2,
283
- 1
284
- ],
285
- legacyDecelerate: [
286
- 0,
287
- 0,
288
- .2,
289
- 1
290
- ],
291
- legacyAccelerate: [
292
- .4,
293
- 0,
294
- 1,
295
- 1
296
- ],
297
- linear: [
298
- 0,
299
- 0,
300
- 1,
301
- 1
302
- ]
303
- }, X = {
304
- short1: 50,
305
- short2: 100,
306
- short3: 150,
307
- short4: 200,
308
- medium1: 250,
309
- medium2: 300,
310
- medium3: 350,
311
- medium4: 400,
312
- long1: 450,
313
- long2: 500,
314
- long3: 550,
315
- long4: 600,
316
- extraLong1: 700,
317
- extraLong2: 800,
318
- extraLong3: 900,
319
- extraLong4: 1e3
320
- };
321
- function ie(e, t, n, r) {
322
- return (i) => {
323
- if (i <= 0) return 0;
324
- if (i >= 1) return 1;
325
- let a = i;
326
- for (let t = 0; t < 8; t++) {
327
- let t = 3 * a * (1 - a) ** 2 * e + 3 * a ** 2 * (1 - a) * n + a ** 3 - i, r = 3 * (1 - a) ** 2 * e + 6 * a * (1 - a) * (n - e) + 3 * a ** 2 * (1 - n);
328
- if (Math.abs(r) < 1e-6) break;
329
- a -= t / r;
330
- }
331
- return 3 * a * (1 - a) ** 2 * t + 3 * a ** 2 * (1 - a) * r + a ** 3;
332
- };
333
- }
334
- //#endregion
335
- //#region src/composables/_useSpring.ts
336
- var ae = J.standard.fastSpatial, oe = J.standard.fastEffects, se = J.standard.defaultEffects, ce = J.standard.defaultSpatial, Z = .004;
337
- function Q(e, t, n = ae) {
338
- let r = [...e()], i = r.map(() => 0), a = 0, o = 0;
339
- function s(c) {
340
- let l = Math.min((c - o) / 1e3, 1 / 30);
341
- o = c;
342
- let u = e();
343
- u.length !== r.length && (r = [...u], i = u.map(() => 0));
344
- let d = n.stiffness, f = 2 * n.dampingRatio * Math.sqrt(d);
345
- for (; l > 0;) {
346
- let e = Math.min(l, Z);
347
- l -= e;
348
- for (let t = 0; t < u.length; t++) i[t] += (-d * (r[t] - u[t]) - f * i[t]) * e, r[t] += i[t] * e;
349
- }
350
- let p = u.every((e, t) => Math.abs(e - r[t]) < .05 && Math.abs(i[t]) < .05);
351
- p && (r = [...u], i = u.map(() => 0)), t(r), a = p ? 0 : requestAnimationFrame(s);
352
- }
353
- function c() {
354
- a ||= (o = performance.now(), requestAnimationFrame(s));
355
- }
356
- function l() {
357
- cancelAnimationFrame(a), a = 0, r = [...e()], i = r.map(() => 0), t(r);
358
- }
359
- return ee(() => e().join(","), c), b(() => t(r)), x(() => cancelAnimationFrame(a)), { snap: l };
360
- }
361
- var le = ie(.4, 0, .2, 1), ue = "relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer disabled:cursor-not-allowed disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", de = /* @__PURE__ */ p({
362
- __name: "MIconButton",
363
- props: {
364
- icon: {},
365
- label: {},
366
- variant: { default: "standard" },
367
- shape: { default: "rounded" },
368
- size: { default: "sm" },
369
- disabled: {
370
- type: Boolean,
371
- default: !1
372
- },
373
- to: {},
374
- rippleColor: {},
375
- checked: {
376
- type: Boolean,
377
- default: void 0
378
- },
379
- checkedIcon: {}
380
- },
381
- emits: ["update:checked"],
382
- setup(e, { emit: n }) {
383
- let r = e, i = n, a = o(() => r.checked !== void 0), c = o(() => r.to && !a.value ? "RouterLink" : "button"), l = {
384
- xs: {
385
- px: 32,
386
- icon: 20,
387
- squareRadius: "rounded-md",
388
- square: 12,
389
- pressed: 8,
390
- checkedRound: 12
391
- },
392
- sm: {
393
- px: 40,
394
- icon: 24,
395
- squareRadius: "rounded-md",
396
- square: 12,
397
- pressed: 8,
398
- checkedRound: 12
399
- },
400
- md: {
401
- px: 56,
402
- icon: 24,
403
- squareRadius: "rounded-lg",
404
- square: 16,
405
- pressed: 12,
406
- checkedRound: 16
407
- },
408
- lg: {
409
- px: 96,
410
- icon: 32,
411
- squareRadius: "rounded-xl",
412
- square: 28,
413
- pressed: 16,
414
- checkedRound: 28
415
- },
416
- xl: {
417
- px: 136,
418
- icon: 40,
419
- squareRadius: "rounded-xl",
420
- square: 28,
421
- pressed: 16,
422
- checkedRound: 28
423
- }
424
- }, u = o(() => typeof r.size == "number" ? {
425
- px: r.size,
426
- icon: Math.round(r.size * .55),
427
- squareRadius: "rounded-md",
428
- square: 12,
429
- pressed: 8,
430
- checkedRound: 12
431
- } : l[r.size] ?? l.sm), d = w(null), p = w(!1);
432
- function m() {
433
- let e = u.value, t = e.px / 2;
434
- return p.value ? e.pressed : r.checked ? r.shape === "squared" ? t : e.checkedRound : r.shape === "squared" ? e.square : t;
435
- }
436
- Q(() => a.value ? [m()] : [], (e) => {
437
- d.value instanceof HTMLElement && (d.value.style.borderRadius = e.length ? `${e[0]}px` : "");
438
- }, se);
439
- function h() {
440
- a.value && !r.disabled && (p.value = !0);
441
- }
442
- function g() {
443
- p.value = !1;
444
- }
445
- function y() {
446
- a.value && !r.disabled && i("update:checked", !r.checked);
447
- }
448
- let b = o(() => {
449
- if (r.variant === "outlined" && r.checked) return "disabled:bg-on-surface/10";
450
- switch (r.variant) {
451
- case "filled":
452
- case "tonal": return "disabled:bg-on-surface/10";
453
- default: return "";
454
- }
455
- }), x = o(() => r.shape === "squared" ? u.value.squareRadius : "rounded-full"), C = o(() => {
456
- let e = r.checked;
457
- switch (r.variant) {
458
- case "filled": return e ? "bg-primary text-on-primary" : "bg-surface-container text-on-surface-variant";
459
- case "tonal": return e ? "bg-secondary text-on-secondary" : "bg-secondary-container text-on-secondary-container";
460
- case "outlined": return e ? "bg-inverse-surface text-inverse-on-surface" : "border border-current text-on-surface-variant";
461
- default: return e ? "text-primary" : "text-on-surface-variant";
462
- }
463
- }), T = o(() => {
464
- if (a.value) return C.value;
465
- switch (r.variant) {
466
- case "filled": return "bg-primary text-on-primary";
467
- case "tonal": return "bg-secondary-container text-on-secondary-container";
468
- case "outlined": return "border border-current text-on-surface-variant";
469
- default: return "text-on-surface-variant";
470
- }
471
- });
472
- return (n, r) => N((S(), s(D(c.value), {
473
- ref_key: "rootEl",
474
- ref: d,
475
- to: c.value === "RouterLink" ? e.to : void 0,
476
- type: c.value === "RouterLink" ? void 0 : "button",
477
- "aria-label": e.label || void 0,
478
- "aria-pressed": a.value ? e.checked : void 0,
479
- disabled: e.disabled,
480
- class: _([
481
- ue,
482
- x.value,
483
- T.value,
484
- b.value
485
- ]),
486
- style: v({
487
- width: `${u.value.px}px`,
488
- height: `${u.value.px}px`
489
- }),
490
- onPointerdown: h,
491
- onPointerup: g,
492
- onPointerleave: g,
493
- onPointercancel: g,
494
- onClick: y
495
- }, {
496
- default: M(() => [f(t, {
497
- name: e.checked && e.checkedIcon ? e.checkedIcon : e.icon,
498
- size: u.value.icon,
499
- filled: !!e.checked
500
- }, null, 8, [
501
- "name",
502
- "size",
503
- "filled"
504
- ])]),
505
- _: 1
506
- }, 40, [
507
- "to",
508
- "type",
509
- "aria-label",
510
- "aria-pressed",
511
- "disabled",
512
- "class",
513
- "style"
514
- ])), [[k(L), {
515
- disabled: e.disabled,
516
- color: e.rippleColor
517
- }]]);
518
- }
519
- }), fe = "relative inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", pe = /* @__PURE__ */ p({
520
- __name: "MButton",
521
- props: {
522
- variant: { default: "filled" },
523
- color: { default: "primary" },
524
- type: { default: "button" },
525
- disabled: {
526
- type: Boolean,
527
- default: !1
528
- },
529
- loading: {
530
- type: Boolean,
531
- default: !1
532
- },
533
- icon: {},
534
- iconPos: { default: "leading" },
535
- size: { default: "sm" },
536
- shape: { default: "rounded" },
537
- to: {},
538
- rippleColor: {}
539
- },
540
- setup(e) {
541
- let n = ["primary", "error"], i = e, a = o(() => i.to ? "RouterLink" : "button"), u = o(() => !!i.color && !n.includes(i.color)), d = o(() => {
542
- if (u.value) return {
543
- "--color-primary": i.color,
544
- "--color-on-primary": "#ffffff",
545
- "--color-primary-container": i.color + "33",
546
- "--color-on-primary-container": i.color
547
- };
548
- }), f = o(() => i.color === "error"), p = o(() => {
549
- switch (i.variant) {
550
- case "filled":
551
- case "tonal":
552
- case "elevated": return "disabled:bg-on-surface/10";
553
- case "outlined": return f.value ? "disabled:border-error/10" : "disabled:border-outline-variant/10";
554
- default: return "";
555
- }
556
- }), m = {
557
- xs: {
558
- h: "h-8",
559
- text: "text-label-large",
560
- icon: 20,
561
- spinner: 16,
562
- gap: "gap-1",
563
- px: "px-3",
564
- pxText: "px-2",
565
- squareRadius: "rounded-md"
566
- },
567
- sm: {
568
- h: "h-10",
569
- text: "text-label-large",
570
- icon: 20,
571
- spinner: 16,
572
- gap: "gap-2",
573
- px: "px-4",
574
- pxText: "px-3",
575
- squareRadius: "rounded-md"
576
- },
577
- md: {
578
- h: "h-14",
579
- text: "text-title-medium",
580
- icon: 24,
581
- spinner: 18,
582
- gap: "gap-2",
583
- px: "px-6",
584
- pxText: "px-3",
585
- squareRadius: "rounded-lg"
586
- },
587
- lg: {
588
- h: "h-24",
589
- text: "text-headline-small",
590
- icon: 32,
591
- spinner: 26,
592
- gap: "gap-3",
593
- px: "px-12",
594
- pxText: "px-4",
595
- squareRadius: "rounded-xl"
596
- },
597
- xl: {
598
- h: "h-[136px]",
599
- text: "text-headline-large",
600
- icon: 40,
601
- spinner: 34,
602
- gap: "gap-4",
603
- px: "px-16",
604
- pxText: "px-4",
605
- squareRadius: "rounded-xl"
606
- }
607
- }, h = o(() => m[i.size] ?? m.sm), g = o(() => `${h.value.h} ${h.value.text} ${h.value.gap}`), y = o(() => h.value.icon), b = o(() => h.value.spinner), x = o(() => i.variant === "text" ? h.value.pxText : h.value.px), C = o(() => i.shape === "squared" ? h.value.squareRadius : "rounded-full"), w = o(() => {
608
- let e = f.value;
609
- switch (i.variant) {
610
- case "filled": return e ? "bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
611
- case "tonal": return e ? "bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none" : "bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none";
612
- case "elevated": return e ? "bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2" : "bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2";
613
- case "outlined": return e ? "border border-error text-error" : "border border-outline-variant text-primary";
614
- case "text": return e ? "text-error" : "text-primary";
615
- default: return "";
616
- }
617
- });
618
- return (n, i) => N((S(), s(D(a.value), {
619
- to: e.to || void 0,
620
- type: e.to ? void 0 : e.type,
621
- disabled: e.disabled || e.loading,
622
- class: _([
623
- fe,
624
- C.value,
625
- g.value,
626
- x.value,
627
- w.value,
628
- p.value
629
- ]),
630
- style: v(d.value)
631
- }, {
632
- default: M(() => [
633
- e.iconPos === "leading" ? (S(), l(r, { key: 0 }, [e.loading ? (S(), s(U, {
634
- key: 0,
635
- size: b.value
636
- }, null, 8, ["size"])) : e.icon ? (S(), s(t, {
637
- key: 1,
638
- name: e.icon,
639
- size: y.value
640
- }, null, 8, ["name", "size"])) : c("", !0)], 64)) : c("", !0),
641
- E(n.$slots, "default"),
642
- e.iconPos === "trailing" ? (S(), l(r, { key: 1 }, [e.loading ? (S(), s(U, {
643
- key: 0,
644
- size: b.value
645
- }, null, 8, ["size"])) : e.icon ? (S(), s(t, {
646
- key: 1,
647
- name: e.icon,
648
- size: y.value
649
- }, null, 8, ["name", "size"])) : c("", !0)], 64)) : c("", !0)
650
- ]),
651
- _: 3
652
- }, 8, [
653
- "to",
654
- "type",
655
- "disabled",
656
- "class",
657
- "style"
658
- ])), [[k(L), {
659
- disabled: e.disabled || e.loading,
660
- color: e.rippleColor
661
- }]]);
662
- }
663
- }), me = { class: "relative px-6 pt-6 pb-2" }, he = {
664
- key: 0,
665
- class: "absolute right-4 top-4"
666
- }, ge = {
667
- key: 1,
668
- class: "mb-4 flex justify-center text-secondary"
669
- }, _e = {
670
- key: 0,
671
- class: "shrink-0 border-t border-outline-variant"
672
- }, ve = {
673
- key: 1,
674
- class: "flex flex-wrap justify-end gap-2 px-6 pt-4 pb-6"
675
- }, ye = {
676
- key: 0,
677
- class: "dialog-fs fixed inset-0 z-50 flex flex-col bg-surface"
678
- }, be = { class: "flex h-14 shrink-0 items-center gap-2 px-2" }, xe = { class: "flex-1 text-title-large font-medium text-on-surface" }, Se = {
679
- key: 1,
680
- class: "flex items-center gap-2"
681
- }, Ce = { class: "flex-1 overflow-y-auto px-6 py-4 text-body-medium text-on-surface-variant" }, we = /*#__PURE__*/ n(/* @__PURE__ */ p({
682
- __name: "MDialog",
683
- props: {
684
- modelValue: { type: Boolean },
685
- title: {},
686
- maxWidth: { default: "max-w-[560px]" },
687
- maxHeight: { default: "max-h-[90vh]" },
688
- persistent: {
689
- type: Boolean,
690
- default: !1
691
- },
692
- fullscreen: {
693
- type: Boolean,
694
- default: !1
695
- },
696
- closeLabel: {},
697
- closable: {
698
- type: Boolean,
699
- default: !0
700
- }
701
- },
702
- emits: ["update:modelValue"],
703
- setup(t, { emit: n }) {
704
- let r = t, p = e(), m = (e) => /^-?[\d.]+[a-z%]*$|^(calc|min|max|clamp|var)\(/i.test(e.trim()), h = o(() => [r.maxWidth, r.maxHeight].filter((e) => !m(e))), y = o(() => ({
705
- ...m(r.maxWidth) ? { maxWidth: r.maxWidth } : {},
706
- ...m(r.maxHeight) ? { maxHeight: r.maxHeight } : {}
707
- })), b = n;
708
- function C() {
709
- r.persistent || b("update:modelValue", !1);
710
- }
711
- function T(e) {
712
- e.key === "Escape" && C();
713
- }
714
- let D = w(), A = w(), j = w(!1), N;
715
- function F() {
716
- let e = D.value;
717
- if (!e) {
718
- j.value = !1;
719
- return;
720
- }
721
- j.value = e.scrollHeight - e.scrollTop - e.clientHeight > 1;
722
- }
723
- return ee(() => r.modelValue, async (e) => {
724
- e ? (document.addEventListener("keydown", T), document.body.style.overflow = "hidden", await g(), F(), N = new ResizeObserver(F), D.value && N.observe(D.value), A.value && N.observe(A.value)) : (document.removeEventListener("keydown", T), document.body.style.overflow = "", N?.disconnect(), N = void 0);
725
- }), x(() => {
726
- document.removeEventListener("keydown", T), N?.disconnect();
727
- }), (e, n) => (S(), s(i, { to: "body" }, [t.fullscreen ? (S(), s(a, {
728
- key: 1,
729
- name: "m3-dialog-fs",
730
- appear: ""
731
- }, {
732
- default: M(() => [t.modelValue ? (S(), l("div", ye, [u("div", be, [
733
- t.persistent ? c("", !0) : (S(), s(de, {
734
- key: 0,
735
- icon: "close",
736
- label: t.closeLabel ?? k(p).close,
737
- onClick: C
738
- }, null, 8, ["label"])),
739
- u("h2", xe, [E(e.$slots, "title", {}, () => [d(O(t.title), 1)], !0)]),
740
- e.$slots.actions ? (S(), l("div", Se, [E(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
741
- ]), u("div", Ce, [E(e.$slots, "default", {}, void 0, !0)])])) : c("", !0)]),
742
- _: 3
743
- })) : (S(), s(a, {
744
- key: 0,
745
- name: "m3-dialog",
746
- appear: ""
747
- }, {
748
- default: M(() => [t.modelValue ? (S(), l("div", {
749
- key: 0,
750
- class: "fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4",
751
- onClick: P(C, ["self"])
752
- }, [u("div", {
753
- class: _(["dialog-box flex min-w-[280px] w-full flex-col rounded-xl bg-surface-container-high shadow-elevation-3", h.value]),
754
- style: v(y.value)
755
- }, [
756
- u("div", me, [
757
- t.closable && !t.persistent ? (S(), l("div", he, [f(de, {
758
- icon: "close",
759
- label: t.closeLabel ?? k(p).close,
760
- onClick: C
761
- }, null, 8, ["label"])])) : c("", !0),
762
- e.$slots.icon ? (S(), l("div", ge, [E(e.$slots, "icon", {}, void 0, !0)])) : c("", !0),
763
- u("h2", { class: _(["text-headline-small text-on-surface", [e.$slots.icon ? "text-center" : "text-left", t.closable && !t.persistent ? e.$slots.icon ? "px-10" : "pr-10" : ""]]) }, [E(e.$slots, "title", {}, () => [d(O(t.title), 1)], !0)], 2)
764
- ]),
765
- u("div", {
766
- ref_key: "contentEl",
767
- ref: D,
768
- class: _(["overflow-y-auto px-6 pt-2 text-body-medium text-on-surface-variant", e.$slots.actions ? "pb-2" : "pb-6"]),
769
- onScroll: F
770
- }, [u("div", {
771
- ref_key: "contentInnerEl",
772
- ref: A
773
- }, [E(e.$slots, "default", {}, void 0, !0)], 512)], 34),
774
- j.value && e.$slots.actions ? (S(), l("div", _e)) : c("", !0),
775
- e.$slots.actions ? (S(), l("div", ve, [E(e.$slots, "actions", {}, void 0, !0)])) : c("", !0)
776
- ], 6)])) : c("", !0)]),
777
- _: 3
778
- }))]));
779
- }
780
- }), [["__scopeId", "data-v-0aac9ebd"]]), Te = { class: "my-1 border-outline-variant" }, Ee = /* @__PURE__ */ p({
781
- __name: "MMenuDivider",
782
- props: { gap: {
783
- type: Boolean,
784
- default: !1
785
- } },
786
- setup(e) {
787
- return (e, t) => (S(), l("hr", Te));
788
- }
789
- }), De = { class: "flex-1 truncate" }, Oe = { key: "root" }, ke = {
790
- key: 0,
791
- class: "flex flex-col gap-1 px-1.5"
792
- }, Ae = { class: "overflow-hidden rounded-lg bg-surface-container" }, je = 220, $ = 1 / 240, Me = /* @__PURE__ */ p({
793
- inheritAttrs: !1,
794
- __name: "MMenu",
795
- props: {
796
- align: { default: "right" },
797
- submenuMode: { default: "flyout" },
798
- variant: { default: "standard" }
799
- },
800
- setup(e, { expose: n }) {
801
- let d = e, p = j();
802
- function y(e) {
803
- let t = [];
804
- for (let n of e) n.type === r && Array.isArray(n.children) ? t.push(...y(n.children)) : t.push(n);
805
- return t;
806
- }
807
- function O(e) {
808
- if (e.type !== Ee) return !1;
809
- let t = e.props?.gap;
810
- return t === "" || t === !0 || t === "true";
811
- }
812
- let k = o(() => {
813
- if (d.variant !== "expressive") return null;
814
- let e = y(p.default?.({ close: Z }) ?? []), t = [[]];
815
- for (let n of e) O(n) ? t.push([]) : t[t.length - 1].push(n);
816
- return t.filter((e) => e.length > 0);
817
- }), A = o(() => !!k.value && k.value.length > 1), N = w([]), P = o(() => N.value[N.value.length - 1]), F = w("forward");
818
- function te(e, t) {
819
- let n = F.value === "forward" ? 1 : -1, r = e.animate([{
820
- transform: `translateX(${n * 100}%)`,
821
- opacity: .4
822
- }, {
823
- transform: "translateX(0%)",
824
- opacity: 1
825
- }], {
826
- duration: je,
827
- easing: "cubic-bezier(0.05,0.7,0.1,1)"
828
- });
829
- r.onfinish = t;
830
- }
831
- function I(e, t) {
832
- let n = F.value === "forward" ? -1 : 1, r = e;
833
- r.style.position = "absolute", r.style.insetInline = "0", r.style.top = "0";
834
- let i = r.animate([{
835
- transform: "translateX(0%)",
836
- opacity: 1
837
- }, {
838
- transform: `translateX(${n * 100}%)`,
839
- opacity: .4
840
- }], {
841
- duration: je,
842
- easing: "cubic-bezier(0.3,0,0.8,0.15)"
843
- });
844
- i.onfinish = t;
845
- }
846
- let L = null;
847
- function R() {
848
- if (L) return L;
849
- let e = [], t = .8, n = 0, r = 0, i = 0;
850
- for (let a = 0; a < 1 && (e.push({
851
- scale: t,
852
- alpha: r
853
- }), n += (-1400 * (t - 1) - 1.8 * Math.sqrt(1400) * n) * $, t += n * $, i += (-3800 * (r - 1) - 2 * Math.sqrt(3800) * i) * $, r += i * $, !(Math.abs(t - 1) < .003 && Math.abs(r - 1) < .003)); a += $);
854
- return e.push({
855
- scale: 1,
856
- alpha: 1
857
- }), L = e, e;
858
- }
859
- let ne = 0, z = null, B = null;
860
- function V(e, t, n) {
861
- z?.();
862
- let r = e, i = R(), a = i.length - 1, o = Math.round(Math.max(0, Math.min(a, ne))), s = n ? a : 0, c = n ? 1 : -1, l = [];
863
- for (let e = o; n ? e <= s : e >= s; e += c) l.push(i[e]);
864
- let u = (e) => ({
865
- transform: `scale(${e.scale})`,
866
- opacity: String(Math.min(1, Math.max(0, e.alpha)))
867
- });
868
- Object.assign(r.style, u(i[s]));
869
- let d = !1;
870
- function f() {
871
- d || (d = !0, ne = s, z = null, B = null, t());
872
- }
873
- if (l.length < 2 || typeof r.animate != "function") return f();
874
- let p = r.animate(l.map(u), {
875
- duration: (l.length - 1) * $ * 1e3,
876
- easing: "linear"
877
- });
878
- p.finished.catch(() => {}), p.onfinish = f, z = () => {
879
- let e = Number(p.currentTime ?? 0) / ($ * 1e3);
880
- ne = Math.max(0, Math.min(a, o + c * e)), d = !0, p.cancel();
881
- }, B = n ? null : () => {
882
- z?.(), z = null, B = null, t();
883
- };
884
- }
885
- function H(e, t) {
886
- V(e, t, !0);
887
- }
888
- function U(e, t) {
889
- V(e, t, !1);
890
- }
891
- function re(e) {
892
- F.value = "forward", N.value.push(e), g(() => oe());
893
- }
894
- function W() {
895
- F.value = "backward", N.value.pop(), g(() => oe());
896
- }
897
- let G = w(!1), K = w(null), q = w(null), J = w({}), Y = m("m-menu-panel-registry", /* @__PURE__ */ new Set());
898
- C("m-menu-panel-registry", Y), ee(q, (e, t) => {
899
- t && Y.delete(t), e && Y.add(e);
900
- }), x(() => {
901
- q.value && Y.delete(q.value);
902
- });
903
- let X = m("m-menu-sibling-group", null);
904
- C("m-menu-sibling-group", { current: null });
905
- function ie() {
906
- if (!K.value) return;
907
- let e = K.value.getBoundingClientRect(), t = window.innerHeight - e.bottom - 8, n = t < 200 && e.top > t, r = { maxHeight: `${Math.min(n ? e.top - 12 : t, 400)}px` };
908
- n ? r.bottom = `${window.innerHeight - e.top + 4}px` : r.top = `${e.bottom + 4}px`, d.align === "right" ? r.right = `${window.innerWidth - e.right}px` : r.left = `${e.left}px`, J.value = r;
909
- }
910
- function ae() {
911
- return q.value ? Array.from(q.value.querySelectorAll("button:not(:disabled), a[href]")) : [];
912
- }
913
- function oe() {
914
- g(() => ae()[0]?.focus());
915
- }
916
- function se(e) {
917
- let t = ae();
918
- if (!t.length) return;
919
- let n = t.indexOf(document.activeElement);
920
- (n === -1 ? e === 1 ? t[0] : t[t.length - 1] : t[(n + e + t.length) % t.length])?.focus();
921
- }
922
- function ce() {
923
- G.value ? X?.current === Z && (X.current = null) : (X && X.current && X.current !== Z && X.current(), X && (X.current = Z), ie(), N.value = []), G.value = !G.value, G.value && oe();
924
- }
925
- function Z() {
926
- X?.current === Z && (X.current = null), G.value = !1;
927
- }
928
- C("m-menu-close", Z), C("m-menu-nav", {
929
- mode: d.submenuMode,
930
- push: re
931
- }), n({
932
- close: Z,
933
- open: G
934
- });
935
- function Q(e) {
936
- let t = e.target;
937
- if (!K.value?.contains(t)) {
938
- for (let e of Y) if (e.contains(t)) return;
939
- t.closest?.(".m3-submenu") || Z();
940
- }
941
- }
942
- function le(e) {
943
- if (!G.value) return;
944
- let t = e.target;
945
- for (let e of Y) if (e.contains(t)) return;
946
- t.closest?.(".m3-submenu") || Z();
947
- }
948
- function ue(e) {
949
- if (e.key === "Escape") {
950
- N.value.length ? W() : Z();
951
- return;
952
- }
953
- G.value && (e.key === "ArrowDown" ? (e.preventDefault(), se(1)) : e.key === "ArrowUp" && (e.preventDefault(), se(-1)));
954
- }
955
- b(() => {
956
- document.addEventListener("mousedown", Q), document.addEventListener("keydown", ue), window.addEventListener("scroll", le, !0);
957
- }), x(() => {
958
- document.removeEventListener("mousedown", Q), document.removeEventListener("keydown", ue), window.removeEventListener("scroll", le, !0), B ? B() : z?.();
959
- });
960
- let de = o(() => d.align === "right" ? "top right" : "top left");
961
- return (n, o) => (S(), l(r, null, [u("div", h({
962
- ref_key: "triggerEl",
963
- ref: K
964
- }, n.$attrs, {
965
- class: "inline-block",
966
- onClick: ce
967
- }), [E(n.$slots, "trigger", { open: G.value })], 16), (S(), s(i, { to: "body" }, [f(a, {
968
- css: !1,
969
- onEnter: H,
970
- onLeave: U
971
- }, {
972
- default: M(() => [G.value ? (S(), l("div", {
973
- key: 0,
974
- ref_key: "dropdownEl",
975
- ref: q,
976
- class: _(["fixed z-500 min-w-48", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", A.value ? "" : "shadow-elevation-2"]]),
977
- style: v({
978
- ...J.value,
979
- transformOrigin: de.value
980
- })
981
- }, [u("div", { class: _(["overflow-hidden", [e.variant === "expressive" ? "rounded-lg" : "rounded-xs", A.value ? "" : "bg-surface-container"]]) }, [u("div", {
982
- class: "relative overflow-y-auto overscroll-contain py-1",
983
- style: v({ maxHeight: J.value.maxHeight })
984
- }, [f(a, {
985
- css: !1,
986
- onEnter: te,
987
- onLeave: I
988
- }, {
989
- default: M(() => [P.value ? (S(), l("div", { key: N.value.length }, [u("button", {
990
- type: "button",
991
- class: "flex w-full items-center gap-3 border-b border-outline-variant px-4 py-2.5 text-left text-body-large text-on-surface outline-none transition-colors hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary",
992
- onClick: W
993
- }, [
994
- f(t, {
995
- name: "chevron_left",
996
- size: 20,
997
- class: "shrink-0 text-on-surface-variant"
998
- }),
999
- P.value.icon ? (S(), s(t, {
1000
- key: 0,
1001
- name: P.value.icon,
1002
- size: 20,
1003
- class: "shrink-0 text-on-surface-variant"
1004
- }, null, 8, ["name"])) : c("", !0),
1005
- u("span", De, [(S(), s(D(() => P.value?.header?.())))])
1006
- ]), (S(), s(D(() => P.value?.content?.())))])) : (S(), l("div", Oe, [A.value ? (S(), l("div", ke, [(S(!0), l(r, null, T(k.value, (e, t) => (S(), l("div", {
1007
- key: t,
1008
- class: "rounded-lg shadow-elevation-2"
1009
- }, [u("div", Ae, [(S(), s(D(() => e)))])]))), 128))])) : E(n.$slots, "default", { close: Z }, void 0, void 0, 1)]))]),
1010
- _: 3
1011
- })], 4)], 2)], 6)) : c("", !0)]),
1012
- _: 3
1013
- })]))], 64));
1014
- }
1015
- }), Ne = ["data-m3-menu-choice"], Pe = { class: "flex-1" }, Fe = {
1016
- key: 2,
1017
- class: "ml-4 shrink-0 text-label-small text-on-surface-variant opacity-60"
1018
- }, Ie = { class: "overflow-hidden rounded-xs bg-surface-container py-1" }, Le = 32, Re = /* @__PURE__ */ p({
1019
- __name: "MMenuItem",
1020
- props: {
1021
- icon: {},
1022
- shortcut: {},
1023
- to: {},
1024
- disabled: {
1025
- type: Boolean,
1026
- default: !1
1027
- },
1028
- danger: {
1029
- type: Boolean,
1030
- default: !1
1031
- },
1032
- keepOpen: {
1033
- type: Boolean,
1034
- default: void 0
1035
- },
1036
- selected: {
1037
- type: Boolean,
1038
- default: void 0
1039
- },
1040
- checked: {
1041
- type: Boolean,
1042
- default: void 0
1043
- },
1044
- selectedIcon: {}
1045
- },
1046
- emits: ["click", "update:checked"],
1047
- setup(e, { emit: n }) {
1048
- let r = e, d = n, p = o(() => r.checked !== void 0), h = o(() => p.value || r.selected !== void 0), y = o(() => !!(r.checked ?? r.selected)), C = o(() => h.value && !r.icon), T = o(() => r.selectedIcon ?? (r.icon ? void 0 : "check")), A = w("single");
1049
- function N() {
1050
- let e = B.value;
1051
- if (!e || !h.value) return;
1052
- let t = (e) => !!e?.hasAttribute("data-m3-menu-choice"), n = t(e.previousElementSibling), r = t(e.nextElementSibling);
1053
- A.value = n && r ? "middle" : n ? "last" : r ? "first" : "single";
1054
- }
1055
- function P() {
1056
- if (y.value) return [
1057
- 12,
1058
- 12,
1059
- 12,
1060
- 12
1061
- ];
1062
- let e = A.value === "first" ? 12 : 4, t = A.value === "last" ? 12 : 4;
1063
- return [
1064
- e,
1065
- e,
1066
- t,
1067
- t
1068
- ];
1069
- }
1070
- let { snap: F } = Q(() => h.value ? [...P(), C.value && y.value ? Le : 0] : [], ([e, t, n, r, i]) => {
1071
- let a = V.value instanceof HTMLElement ? V.value : V.value?.$el;
1072
- a && r !== void 0 && (a.style.borderRadius = `${e}px ${t}px ${n}px ${r}px`), H.value && i !== void 0 && (H.value.style.width = `${i}px`);
1073
- }, ae);
1074
- ee(A, () => F());
1075
- let te = null;
1076
- b(() => {
1077
- N();
1078
- let e = B.value?.parentElement;
1079
- e && (te = new MutationObserver(N), te.observe(e, { childList: !0 }));
1080
- }), x(() => te?.disconnect()), ee(h, () => g(N)), Q(() => C.value ? [+!!y.value] : [], ([e]) => {
1081
- H.value && e !== void 0 && (H.value.style.opacity = String(e));
1082
- }, oe);
1083
- let I = j(), L = o(() => r.to ? "RouterLink" : "button"), R = o(() => !!I.children), ne = m("m-menu-close", null), z = m("m-menu-nav", null), B = w(), V = w(), H = w(), U = w(!1), re = w({});
1084
- function W() {
1085
- if (!B.value) return;
1086
- let e = B.value.getBoundingClientRect(), t = e.right + 200 > window.innerWidth;
1087
- re.value = {
1088
- position: "fixed",
1089
- top: `${e.top}px`,
1090
- ...t ? { right: `${window.innerWidth - e.left}px` } : { left: `${e.right}px` },
1091
- zIndex: "501"
1092
- };
1093
- }
1094
- function G() {
1095
- if (U.value) {
1096
- U.value = !1;
1097
- return;
1098
- }
1099
- W(), U.value = !0;
1100
- }
1101
- function K() {
1102
- if (!r.disabled) {
1103
- if (R.value) {
1104
- z?.mode === "push" ? z.push({
1105
- icon: r.icon,
1106
- header: I.default,
1107
- content: I.children
1108
- }) : G();
1109
- return;
1110
- }
1111
- p.value && d("update:checked", !r.checked), d("click"), (r.keepOpen ?? p.value) || ne?.();
1112
- }
1113
- }
1114
- function q(e) {
1115
- e.pointerType === "mouse" && R.value && !r.disabled && (W(), U.value = !0);
1116
- }
1117
- function J(e) {
1118
- e.pointerType === "mouse" && (e.relatedTarget?.closest(".m3-submenu") || (U.value = !1));
1119
- }
1120
- function Y(e) {
1121
- if (e.pointerType !== "mouse") return;
1122
- let t = e.relatedTarget;
1123
- t?.closest(".m3-submenu") || B.value?.contains(t) || (U.value = !1);
1124
- }
1125
- return (n, r) => (S(), l("div", {
1126
- ref_key: "itemEl",
1127
- ref: B,
1128
- "data-m3-menu-choice": h.value || void 0,
1129
- onPointerenter: q,
1130
- onPointerleave: J
1131
- }, [(S(), s(D(L.value), {
1132
- ref_key: "controlEl",
1133
- ref: V,
1134
- to: e.to || void 0,
1135
- type: e.to ? void 0 : "button",
1136
- role: h.value ? p.value ? "menuitemcheckbox" : "menuitemradio" : void 0,
1137
- "aria-checked": h.value ? y.value : void 0,
1138
- class: _(["flex items-center gap-3 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary", h.value ? [
1139
- "relative mx-1 w-[calc(100%-0.5rem)] px-3 duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:bg-current before:opacity-0 before:transition-opacity",
1140
- y.value ? "bg-tertiary-container text-on-tertiary-container" : "text-on-surface",
1141
- e.disabled ? "cursor-not-allowed opacity-[0.38]" : "cursor-pointer hover:before:opacity-[0.08] active:before:opacity-[0.12]"
1142
- ] : [
1143
- "w-full px-4",
1144
- e.disabled ? "cursor-not-allowed opacity-[0.38] text-on-surface" : "cursor-pointer",
1145
- !e.disabled && e.danger ? "text-error hover:bg-error/8" : "",
1146
- !e.disabled && !e.danger ? "text-on-surface hover:bg-on-surface/8" : ""
1147
- ]]),
1148
- disabled: e.disabled || void 0,
1149
- "aria-haspopup": R.value ? "menu" : void 0,
1150
- "aria-expanded": R.value ? U.value : void 0,
1151
- onClick: K
1152
- }, {
1153
- default: M(() => [
1154
- C.value ? (S(), l("span", {
1155
- key: 0,
1156
- ref_key: "iconSlotEl",
1157
- ref: H,
1158
- class: "-mr-3 flex shrink-0 overflow-hidden",
1159
- style: {
1160
- width: "0",
1161
- opacity: "0"
1162
- }
1163
- }, [f(t, {
1164
- name: T.value,
1165
- size: 20,
1166
- class: "shrink-0"
1167
- }, null, 8, ["name"])], 512)) : e.icon ? (S(), s(t, {
1168
- key: 1,
1169
- name: y.value && T.value ? T.value : e.icon,
1170
- filled: y.value && !T.value,
1171
- size: 20,
1172
- class: _(["shrink-0", h.value ? y.value ? "" : "text-on-surface-variant" : e.danger ? "text-error" : "text-on-surface-variant"])
1173
- }, null, 8, [
1174
- "name",
1175
- "filled",
1176
- "class"
1177
- ])) : c("", !0),
1178
- u("span", Pe, [E(n.$slots, "default")]),
1179
- e.shortcut && !R.value ? (S(), l("span", Fe, O(e.shortcut), 1)) : c("", !0),
1180
- R.value ? (S(), s(t, {
1181
- key: 3,
1182
- name: "chevron_right",
1183
- size: 18,
1184
- class: "shrink-0 text-on-surface-variant"
1185
- })) : c("", !0)
1186
- ]),
1187
- _: 3
1188
- }, 8, [
1189
- "to",
1190
- "type",
1191
- "role",
1192
- "aria-checked",
1193
- "class",
1194
- "disabled",
1195
- "aria-haspopup",
1196
- "aria-expanded"
1197
- ])), R.value && k(z)?.mode !== "push" ? (S(), s(i, {
1198
- key: 0,
1199
- to: "body"
1200
- }, [f(a, {
1201
- "enter-active-class": "transition-opacity duration-100",
1202
- "enter-from-class": "opacity-0",
1203
- "leave-active-class": "transition-opacity duration-75",
1204
- "leave-to-class": "opacity-0"
1205
- }, {
1206
- default: M(() => [U.value ? (S(), l("div", {
1207
- key: 0,
1208
- class: "m3-submenu min-w-44 rounded-xs shadow-elevation-2",
1209
- style: v(re.value),
1210
- onPointerleave: Y
1211
- }, [u("div", Ie, [E(n.$slots, "children")])], 36)) : c("", !0)]),
1212
- _: 3
1213
- })])) : c("", !0)], 40, Ne));
1214
- }
1215
- }), ze = { class: "flex flex-col gap-1" }, Be = [
1216
- "id",
1217
- "value",
1218
- "rows",
1219
- "disabled",
1220
- "required"
1221
- ], Ve = [
1222
- "id",
1223
- "type",
1224
- "value",
1225
- "disabled",
1226
- "required",
1227
- "autocomplete"
1228
- ], He = ["for"], Ue = {
1229
- key: 0,
1230
- class: "text-error"
1231
- }, We = {
1232
- key: 3,
1233
- class: "absolute right-2 top-1/2 -translate-y-1/2"
1234
- }, Ge = {
1235
- key: 0,
1236
- class: "px-4 text-body-small text-error"
1237
- }, Ke = {
1238
- key: 1,
1239
- class: "px-4 text-body-small text-on-surface-variant"
1240
- }, qe = /* @__PURE__ */ p({
1241
- __name: "MTextField",
1242
- props: {
1243
- modelValue: {},
1244
- label: {},
1245
- type: { default: "text" },
1246
- variant: { default: "filled" },
1247
- error: { type: Boolean },
1248
- errorLabel: {},
1249
- hint: {},
1250
- disabled: { type: Boolean },
1251
- required: { type: Boolean },
1252
- multiline: { type: Boolean },
1253
- rows: { default: 3 },
1254
- autocomplete: {},
1255
- leadingIcon: {},
1256
- clearable: {
1257
- type: Boolean,
1258
- default: !1
1259
- },
1260
- fieldBg: {},
1261
- debounce: { default: 0 }
1262
- },
1263
- emits: ["update:modelValue", "debounced"],
1264
- setup(e, { emit: n }) {
1265
- let r = e, i = n, a = A(), s = j(), p = w(null), { resolvedFieldBg: m } = K(p, () => r.fieldBg), { debounced: h, cancel: g } = q((e) => i("debounced", e), r.debounce), y = o(() => r.clearable && String(r.modelValue).length > 0 && !r.disabled), b = o(() => {
1266
- let e = !!s.trailing || r.clearable, t = r.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", i = r.multiline ? "resize-y min-h-[56px]" : "h-14", a = [
1267
- "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
1268
- "transition-[border-color,border-width] duration-150",
1269
- "disabled:cursor-not-allowed disabled:text-on-surface/38",
1270
- r.error ? "caret-error" : "caret-primary",
1271
- i,
1272
- t,
1273
- n
1274
- ];
1275
- return r.variant === "outlined" ? [
1276
- ...a,
1277
- "rounded-xs border bg-transparent py-4",
1278
- r.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
1279
- "disabled:border-on-surface/12"
1280
- ].join(" ") : [
1281
- ...a,
1282
- "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
1283
- r.error ? "border-error focus:border-b-2 focus:border-error" : "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary",
1284
- "disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
1285
- ].join(" ");
1286
- }), x = o(() => {
1287
- let e = [
1288
- "pointer-events-none absolute truncate transition-all duration-200",
1289
- r.leadingIcon ? r.variant === "outlined" ? "left-11" : "left-12" : r.variant === "outlined" ? "left-3" : "left-4",
1290
- "right-4",
1291
- `${r.variant === "filled" ? "top-[53%]" : "top-1/2"} -translate-y-1/2 text-body-large`
1292
- ];
1293
- return r.variant === "outlined" ? [
1294
- ...e,
1295
- "peer-focus:-top-2.5 peer-focus:translate-y-0 peer-focus:text-label-small peer-focus:right-auto peer-focus:max-w-[calc(100%-1.5rem)] peer-focus:bg-[var(--field-bg)] peer-focus:px-1",
1296
- "peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]",
1297
- "peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
1298
- r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
1299
- "peer-disabled:text-on-surface/38"
1300
- ].join(" ") : [
1301
- ...e,
1302
- "peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
1303
- "peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
1304
- r.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
1305
- "peer-disabled:text-on-surface/38"
1306
- ].join(" ");
1307
- });
1308
- function C(e) {
1309
- let t = e.target;
1310
- i("update:modelValue", t.value), r.debounce > 0 && h(t.value);
1311
- }
1312
- return (n, r) => (S(), l("div", ze, [u("div", {
1313
- ref_key: "fieldBgEl",
1314
- ref: p,
1315
- class: _(["relative", e.variant === "outlined" ? "mt-2" : ""]),
1316
- style: v(e.variant === "outlined" ? { "--field-bg": k(m) } : void 0)
1317
- }, [
1318
- e.leadingIcon ? (S(), l("div", {
1319
- key: 0,
1320
- class: _(["pointer-events-none absolute left-3.5", [e.multiline ? "top-[55%] -translate-y-1/2" : e.variant === "filled" ? "top-4.5" : "top-4", e.disabled ? "text-on-surface/38" : "text-on-surface-variant"]])
1321
- }, [f(t, {
1322
- name: e.leadingIcon,
1323
- size: 24
1324
- }, null, 8, ["name"])], 2)) : c("", !0),
1325
- e.multiline ? (S(), l("textarea", {
1326
- key: 1,
1327
- id: k(a),
1328
- value: String(e.modelValue),
1329
- rows: e.rows,
1330
- disabled: e.disabled,
1331
- required: e.required,
1332
- placeholder: " ",
1333
- class: _(b.value),
1334
- onInput: C
1335
- }, null, 42, Be)) : (S(), l("input", {
1336
- key: 2,
1337
- id: k(a),
1338
- type: e.type,
1339
- value: e.modelValue,
1340
- disabled: e.disabled,
1341
- required: e.required,
1342
- autocomplete: e.autocomplete,
1343
- placeholder: " ",
1344
- class: _(b.value),
1345
- onInput: C
1346
- }, null, 42, Ve)),
1347
- u("label", {
1348
- for: k(a),
1349
- class: _(x.value)
1350
- }, [d(O(e.label), 1), e.required ? (S(), l("span", Ue, "\xA0*")) : c("", !0)], 10, He),
1351
- n.$slots.trailing ? (S(), l("div", We, [E(n.$slots, "trailing")])) : y.value ? (S(), l("button", {
1352
- key: 4,
1353
- type: "button",
1354
- class: "absolute right-3 top-1/2 -translate-y-1/2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8 hover:text-on-surface",
1355
- onClick: r[0] ||= (e) => {
1356
- k(g)(), i("update:modelValue", "");
1357
- }
1358
- }, [f(t, {
1359
- name: "close",
1360
- size: 18
1361
- })])) : c("", !0)
1362
- ], 6), e.error && e.errorLabel ? (S(), l("p", Ge, O(e.errorLabel), 1)) : e.hint ? (S(), l("p", Ke, O(e.hint), 1)) : c("", !0)]));
1363
- }
1364
- });
1365
- //#endregion
1366
- export { J as _, we as a, U as b, se as c, ae as d, le as f, Y as g, X as h, Ee as i, ce as l, ie as m, Re as n, pe as o, Q as p, Me as r, de as s, qe as t, oe as u, q as v, L as x, K as y };
1367
-
1368
- //# sourceMappingURL=MTextField-BPbFeI9M.js.map