@m3ui-vue/m3ui-vue 1.1.4 → 1.2.1

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 (200) hide show
  1. package/dist/API.md +511 -34
  2. package/dist/MMenuItem-DI351kIf.js +929 -0
  3. package/dist/MMenuItem-DI351kIf.js.map +1 -0
  4. package/dist/{MSlider-JflHJ70q.js → MSlider-BnEy5ieZ.js} +295 -320
  5. package/dist/MSlider-BnEy5ieZ.js.map +1 -0
  6. package/dist/MTextField-BBmkaIbO.js +633 -0
  7. package/dist/MTextField-BBmkaIbO.js.map +1 -0
  8. package/dist/api.json +1 -1
  9. package/dist/chart.js +83 -49
  10. package/dist/chart.js.map +1 -1
  11. package/dist/code-editor.js +1 -1
  12. package/dist/components/MButton.vue.d.ts +7 -1
  13. package/dist/components/MButtonGroup.vue.d.ts +40 -31
  14. package/dist/components/MCarousel.vue.d.ts +2 -0
  15. package/dist/components/MChart.vue.d.ts +6 -0
  16. package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
  17. package/dist/components/MContextMenu.vue.d.ts +2 -2
  18. package/dist/components/MCopyButton.vue.d.ts +1 -1
  19. package/dist/components/MExportButton.vue.d.ts +1 -1
  20. package/dist/components/MFab.vue.d.ts +2 -2
  21. package/dist/components/MFabMenu.vue.d.ts +1 -1
  22. package/dist/components/MIconButton.vue.d.ts +13 -1
  23. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  24. package/dist/components/MMap.vue.d.ts +20 -2
  25. package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
  26. package/dist/components/MMapFilter.vue.d.ts +3 -0
  27. package/dist/components/MMapLayers.vue.d.ts +3 -0
  28. package/dist/components/MMenu.vue.d.ts +2 -2
  29. package/dist/components/MMenuItem.vue.d.ts +7 -3
  30. package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
  31. package/dist/components/MOverlay.vue.d.ts +12 -1
  32. package/dist/components/MProgressBar.vue.d.ts +5 -3
  33. package/dist/components/MPullToRefresh.vue.d.ts +7 -2
  34. package/dist/components/MRichTextEditor.vue.d.ts +7 -1
  35. package/dist/components/MSearchField.vue.d.ts +58 -0
  36. package/dist/components/MSegmentedButton.vue.d.ts +31 -23
  37. package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
  38. package/dist/components/MSkeleton.vue.d.ts +6 -3
  39. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  40. package/dist/components/MSwitch.vue.d.ts +1 -1
  41. package/dist/components/MTextField.vue.d.ts +5 -1
  42. package/dist/components/MTimeline.vue.d.ts +85 -22
  43. package/dist/components/MTooltip.vue.d.ts +1 -1
  44. package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
  45. package/dist/composables/_mapStyle.d.ts +13 -0
  46. package/dist/composables/_themeTransition.d.ts +2 -0
  47. package/dist/composables/_tooltipTrigger.d.ts +22 -0
  48. package/dist/composables/_useMenuNav.d.ts +28 -0
  49. package/dist/composables/useAutoGrow.d.ts +21 -0
  50. package/dist/composables/useColorPalette.d.ts +1 -1
  51. package/dist/composables/useLocale.d.ts +3 -0
  52. package/dist/composables/useMap.d.ts +19 -3
  53. package/dist/composables/useMapFilter.d.ts +4 -1
  54. package/dist/composables/useMapLayers.d.ts +5 -2
  55. package/dist/composables/useScrollReveal.d.ts +44 -0
  56. package/dist/composables/useThemeTokens.d.ts +21 -0
  57. package/dist/composables/viewportHints.d.ts +27 -0
  58. package/dist/directives/vClickOutside.d.ts +25 -0
  59. package/dist/directives/vFocusRing.d.ts +22 -0
  60. package/dist/directives/vLongPress.d.ts +27 -0
  61. package/dist/directives/vReveal.d.ts +10 -0
  62. package/dist/directives/vScrollElevation.d.ts +31 -0
  63. package/dist/directives/vSkeleton.d.ts +19 -0
  64. package/dist/directives/vStateLayer.d.ts +20 -0
  65. package/dist/directives/vSwipe.d.ts +45 -0
  66. package/dist/directives/vTooltip.d.ts +23 -0
  67. package/dist/index.d.ts +28 -1
  68. package/dist/locales/index.js +21 -7
  69. package/dist/locales/index.js.map +1 -1
  70. package/dist/m3ui-vue.css +1 -1
  71. package/dist/m3ui.js +7132 -6217
  72. package/dist/m3ui.js.map +1 -1
  73. package/dist/map.d.ts +1 -1
  74. package/dist/map.js +821 -791
  75. package/dist/map.js.map +1 -1
  76. package/dist/motion-DZiXG09o.js +150 -0
  77. package/dist/motion-DZiXG09o.js.map +1 -0
  78. package/dist/plugin.d.ts +24 -0
  79. package/dist/rich-text-editor.js +13 -9
  80. package/dist/rich-text-editor.js.map +1 -1
  81. package/dist/styles/theme.css +63 -0
  82. package/dist/styles.css +1 -1
  83. package/dist/{useLocale-CXibICQA.js → useLocale-JYxDDeXC.js} +4 -2
  84. package/dist/useLocale-JYxDDeXC.js.map +1 -0
  85. package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
  86. package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
  87. package/package.json +1 -1
  88. package/src/__tests__/MButton.test.ts +22 -0
  89. package/src/__tests__/MCarousel.test.ts +9 -0
  90. package/src/__tests__/MChart.test.ts +77 -5
  91. package/src/__tests__/MIconButton.test.ts +33 -0
  92. package/src/__tests__/MMap.test.ts +53 -1
  93. package/src/__tests__/MMapLayers.test.ts +46 -2
  94. package/src/__tests__/MMenu.test.ts +104 -1
  95. package/src/__tests__/MMenuItem.test.ts +18 -0
  96. package/src/__tests__/MNavigationDrawer.test.ts +80 -0
  97. package/src/__tests__/MOverlay.test.ts +49 -0
  98. package/src/__tests__/MProgressBar.test.ts +41 -0
  99. package/src/__tests__/MPullToRefresh.test.ts +33 -0
  100. package/src/__tests__/MRichTextEditor.test.ts +22 -0
  101. package/src/__tests__/MSearchField.test.ts +71 -0
  102. package/src/__tests__/MSegmentedButton.test.ts +10 -0
  103. package/src/__tests__/MSkeleton.test.ts +38 -0
  104. package/src/__tests__/MTimeline.test.ts +238 -0
  105. package/src/__tests__/_fakeMaplibre.ts +3 -1
  106. package/src/__tests__/attrsFallthrough.test.ts +3 -0
  107. package/src/__tests__/escapeStack.test.ts +93 -0
  108. package/src/__tests__/ssr.test.ts +21 -2
  109. package/src/__tests__/useAutoGrow.test.ts +103 -0
  110. package/src/__tests__/useScrollReveal.test.ts +102 -0
  111. package/src/__tests__/useThemeTokens.test.ts +114 -0
  112. package/src/__tests__/vClickOutside.test.ts +82 -0
  113. package/src/__tests__/vFocusRing.test.ts +36 -0
  114. package/src/__tests__/vLongPress.test.ts +81 -0
  115. package/src/__tests__/vScrollElevation.test.ts +89 -0
  116. package/src/__tests__/vSkeleton.test.ts +48 -0
  117. package/src/__tests__/vStateLayer.test.ts +53 -0
  118. package/src/__tests__/vSwipe.test.ts +93 -0
  119. package/src/__tests__/vTooltip.test.ts +95 -0
  120. package/src/__tests__/viewportHints.test.ts +41 -0
  121. package/src/components/MAutocomplete.vue +5 -0
  122. package/src/components/MBottomSheet.vue +4 -1
  123. package/src/components/MButton.vue +15 -1
  124. package/src/components/MButtonGroup.vue +22 -17
  125. package/src/components/MCarousel.vue +7 -1
  126. package/src/components/MChart.vue +74 -34
  127. package/src/components/MCircleProgressBar.vue +14 -9
  128. package/src/components/MCommandPalette.vue +3 -2
  129. package/src/components/MContextMenu.vue +19 -60
  130. package/src/components/MDragDropList.vue +2 -0
  131. package/src/components/MIconButton.vue +40 -1
  132. package/src/components/MKanban.vue +2 -0
  133. package/src/components/MLightbox.vue +7 -2
  134. package/src/components/MMap.vue +38 -5
  135. package/src/components/MMapBaseLayers.vue +7 -3
  136. package/src/components/MMapFilter.vue +7 -4
  137. package/src/components/MMapGeoJson.vue +1 -1
  138. package/src/components/MMapLayers.vue +6 -2
  139. package/src/components/MMapMeasure.vue +5 -2
  140. package/src/components/MMenu.vue +18 -59
  141. package/src/components/MMenuItem.vue +11 -2
  142. package/src/components/MMultiAutocomplete.vue +5 -0
  143. package/src/components/MNavigationDrawer.vue +96 -11
  144. package/src/components/MNavigationRail.vue +4 -15
  145. package/src/components/MOverlay.vue +32 -13
  146. package/src/components/MProgressBar.vue +25 -27
  147. package/src/components/MPullToRefresh.vue +20 -1
  148. package/src/components/MRichTextEditor.vue +19 -5
  149. package/src/components/MSearchBar.vue +5 -0
  150. package/src/components/MSearchField.vue +142 -0
  151. package/src/components/MSegmentedButton.vue +20 -18
  152. package/src/components/MSelect.vue +10 -1
  153. package/src/components/MSideSheet.vue +5 -2
  154. package/src/components/MSimpleCarousel.vue +10 -1
  155. package/src/components/MSkeleton.vue +30 -8
  156. package/src/components/MSpotlightSearch.vue +3 -2
  157. package/src/components/MTextField.vue +15 -2
  158. package/src/components/MTimeline.vue +370 -81
  159. package/src/components/MTooltip.vue +20 -152
  160. package/src/components/_MDrawerItemList.vue +25 -6
  161. package/src/composables/_mapStyle.ts +45 -0
  162. package/src/composables/_themeTransition.ts +2 -0
  163. package/src/composables/_tooltipTrigger.ts +184 -0
  164. package/src/composables/_useMenuNav.ts +209 -0
  165. package/src/composables/useAutoGrow.ts +78 -0
  166. package/src/composables/useLocale.ts +5 -0
  167. package/src/composables/useMap.ts +43 -5
  168. package/src/composables/useMapFilter.ts +6 -5
  169. package/src/composables/useMapLayers.ts +7 -6
  170. package/src/composables/useScrollReveal.ts +151 -0
  171. package/src/composables/useThemeTokens.ts +116 -0
  172. package/src/composables/viewportHints.ts +80 -0
  173. package/src/directives/vClickOutside.ts +90 -0
  174. package/src/directives/vFocusRing.ts +60 -0
  175. package/src/directives/vLongPress.ts +134 -0
  176. package/src/directives/vReveal.ts +57 -0
  177. package/src/directives/vScrollElevation.ts +116 -0
  178. package/src/directives/vSkeleton.ts +87 -0
  179. package/src/directives/vStateLayer.ts +83 -0
  180. package/src/directives/vSwipe.ts +197 -0
  181. package/src/directives/vTooltip.ts +128 -0
  182. package/src/index.ts +28 -1
  183. package/src/locales/de.ts +2 -0
  184. package/src/locales/es.ts +2 -0
  185. package/src/locales/fr.ts +2 -0
  186. package/src/locales/ja.ts +2 -0
  187. package/src/locales/ko.ts +2 -0
  188. package/src/locales/pt.ts +2 -0
  189. package/src/locales/zh.ts +2 -0
  190. package/src/map.ts +1 -1
  191. package/src/plugin.ts +34 -0
  192. package/src/styles/theme.css +63 -0
  193. package/dist/MMenuItem-BfjqwcYP.js +0 -830
  194. package/dist/MMenuItem-BfjqwcYP.js.map +0 -1
  195. package/dist/MSlider-JflHJ70q.js.map +0 -1
  196. package/dist/MTextField-NaIB6RbM.js +0 -673
  197. package/dist/MTextField-NaIB6RbM.js.map +0 -1
  198. package/dist/composables/_useThemeTokens.d.ts +0 -7
  199. package/dist/useLocale-CXibICQA.js.map +0 -1
  200. package/src/composables/_useThemeTokens.ts +0 -42
@@ -0,0 +1,633 @@
1
+ import { i as e } from "./useLocale-JYxDDeXC.js";
2
+ import { i as t, t as n } from "./motion-DZiXG09o.js";
3
+ import { t as r } from "./MIcon-Bxh9j135.js";
4
+ import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, getCurrentInstance as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, onMounted as g, onUnmounted as _, openBlock as v, ref as y, renderSlot as b, resolveDynamicComponent as x, toDisplayString as S, toValue as C, unref as w, useId as T, useSlots as E, watch as D, withCtx as O, withDirectives as k } from "vue";
5
+ //#region src/directives/vRipple.ts
6
+ function A(e) {
7
+ return e === !1 ? { disabled: !0 } : typeof e == "string" ? { color: e } : e === !0 || e == null ? {} : e;
8
+ }
9
+ function j(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 M = /* @__PURE__ */ new WeakMap(), N = {
16
+ mounted(e, t) {
17
+ let n = {
18
+ options: A(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"), j(e, t, n.options.color);
23
+ }
24
+ };
25
+ M.set(e, n), e.addEventListener("pointerdown", n.onPointerDown);
26
+ },
27
+ updated(e, t) {
28
+ let n = M.get(e);
29
+ n && (n.options = A(t.value));
30
+ },
31
+ beforeUnmount(e) {
32
+ let t = M.get(e);
33
+ t && e.removeEventListener("pointerdown", t.onPointerDown), M.delete(e);
34
+ }
35
+ }, P = 1e3 / 60, F = .004;
36
+ function ee(e, t, n, r, i) {
37
+ let a = [e], o = e, s = n, c = 2 * r.dampingRatio * Math.sqrt(r.stiffness);
38
+ for (let e = 0; e < 600; e++) {
39
+ for (let e = P / 1e3; e > 1e-9; e -= F) {
40
+ let n = Math.min(F, e);
41
+ s += (-r.stiffness * (o - t) - c * s) * n, o += s * n;
42
+ }
43
+ if (a.push(o), Math.abs(o - t) < i && Math.abs(s) < i * 10) break;
44
+ }
45
+ return a[a.length - 1] = t, a;
46
+ }
47
+ function I(e, t) {
48
+ let n = Number(t ?? 0) / P, r = Math.floor(n);
49
+ return r >= e.length - 1 ? e[e.length - 1] : r < 0 ? e[0] : e[r] + (e[r + 1] - e[r]) * (n - r);
50
+ }
51
+ var L = (e) => (e.length - 1) * P;
52
+ function R(e, t, n, r = 0) {
53
+ if (!e || typeof e.animate != "function" || t.length < 2) return null;
54
+ let i = e.animate(t.map(n), {
55
+ duration: L(t),
56
+ delay: r,
57
+ easing: "linear"
58
+ });
59
+ return i.finished.catch(() => {}), i;
60
+ }
61
+ var te = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, ne = ["aria-label"], re = {
62
+ key: 0,
63
+ class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
64
+ }, ie = [
65
+ "width",
66
+ "height",
67
+ "viewBox"
68
+ ], ae = ["d", "stroke-dasharray"], z = 3, B = 9, V = /* @__PURE__ */ d({
69
+ __name: "MSpinner",
70
+ props: {
71
+ size: { default: 20 },
72
+ wavy: {
73
+ type: Boolean,
74
+ default: !1
75
+ },
76
+ label: {}
77
+ },
78
+ setup(t) {
79
+ let n = t, r = e(), a = i(() => (n.size / 2 - 1 - z / 2) / 1.25), o = i(() => n.size / 2), l = i(() => {
80
+ let e = o.value, t = a.value, n = t * .08, r = [], i = 0, s = 0, c = 0;
81
+ for (let a = 0; a <= 216; a++) {
82
+ let o = 2 * Math.PI * a / 216 - Math.PI / 2, l = t + n * Math.sin(B * o), u = e + l * Math.cos(o), d = e + l * Math.sin(o);
83
+ a > 0 && (i += Math.sqrt((u - s) ** 2 + (d - c) ** 2)), r.push(`${a === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), s = u, c = d;
84
+ }
85
+ let l = i * .58, u = i - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
86
+ return {
87
+ path: r.join("") + "Z",
88
+ dash: d,
89
+ len: i.toFixed(1)
90
+ };
91
+ });
92
+ return (e, n) => (v(), s("span", {
93
+ class: "inline-flex shrink-0 items-center justify-center",
94
+ style: m({
95
+ width: `${t.size}px`,
96
+ height: `${t.size}px`
97
+ }),
98
+ role: "status",
99
+ "aria-label": t.label ?? w(r).loading
100
+ }, [t.wavy ? (v(), s("svg", {
101
+ key: 1,
102
+ width: t.size,
103
+ height: t.size,
104
+ viewBox: `0 0 ${t.size} ${t.size}`,
105
+ fill: "none",
106
+ class: "animate-[m3-wavy-spin_2.8s_linear_infinite]",
107
+ style: m(`transform-origin: ${o.value}px ${o.value}px`)
108
+ }, [c("path", {
109
+ d: l.value.path,
110
+ stroke: "currentColor",
111
+ "stroke-width": z,
112
+ "stroke-linecap": "round",
113
+ "stroke-dasharray": l.value.dash,
114
+ class: "animate-[m3-wavy-travel_2s_linear_infinite]",
115
+ style: m({ "--m3-wave-len": l.value.len })
116
+ }, null, 12, ae)], 12, ie)) : (v(), s("span", re))], 12, ne));
117
+ }
118
+ }), H = [
119
+ "bg-surface-container-highest",
120
+ "bg-surface-container-high",
121
+ "bg-surface-container-low",
122
+ "bg-surface-container-lowest",
123
+ "bg-surface-container",
124
+ "bg-surface-variant",
125
+ "bg-surface-bright",
126
+ "bg-surface-dim",
127
+ "bg-surface",
128
+ "bg-background",
129
+ "bg-inverse-surface",
130
+ "bg-primary-container",
131
+ "bg-secondary-container",
132
+ "bg-tertiary-container",
133
+ "bg-error-container",
134
+ "bg-primary-fixed",
135
+ "bg-primary-fixed-dim",
136
+ "bg-secondary-fixed",
137
+ "bg-secondary-fixed-dim",
138
+ "bg-tertiary-fixed",
139
+ "bg-tertiary-fixed-dim",
140
+ "bg-primary",
141
+ "bg-secondary",
142
+ "bg-tertiary",
143
+ "bg-error"
144
+ ];
145
+ function U(e) {
146
+ for (let t of H) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
147
+ return null;
148
+ }
149
+ function W(e) {
150
+ if (!e || e === "transparent") return !0;
151
+ let t = e.match(/^rgba?\(([^)]+)\)$/);
152
+ if (t) {
153
+ let e = t[1].split(",").map((e) => e.trim());
154
+ if (e.length === 4 && parseFloat(e[3]) === 0) return !0;
155
+ }
156
+ return !1;
157
+ }
158
+ function G(e, t) {
159
+ let n = y("var(--color-surface)");
160
+ function r(r) {
161
+ n.value = r, e.value?.style.setProperty("--field-bg", t() ?? r);
162
+ }
163
+ function a() {
164
+ let t = e.value?.parentElement ?? null;
165
+ for (; t;) {
166
+ let e = U(t);
167
+ if (e) {
168
+ r(e);
169
+ return;
170
+ }
171
+ if (t === document.body) {
172
+ r("var(--color-surface)");
173
+ return;
174
+ }
175
+ let n = getComputedStyle(t).backgroundColor;
176
+ if (!W(n)) {
177
+ r(n);
178
+ return;
179
+ }
180
+ t = t.parentElement;
181
+ }
182
+ r("var(--color-surface)");
183
+ }
184
+ let o = null;
185
+ return g(() => {
186
+ a(), o = new MutationObserver(() => a()), o.observe(document.documentElement, {
187
+ attributes: !0,
188
+ attributeFilter: [
189
+ "class",
190
+ "style",
191
+ "data-theme"
192
+ ]
193
+ });
194
+ }), h(() => o?.disconnect()), { resolvedFieldBg: i(() => t() ?? n.value) };
195
+ }
196
+ //#endregion
197
+ //#region src/composables/useAutoGrow.ts
198
+ function K(e, t = {}) {
199
+ let n = null, r = null, i = 0;
200
+ function a() {
201
+ if (!n) return;
202
+ let e = getComputedStyle(n), r = (e) => parseFloat(e) || 0, i = r(e.lineHeight) || r(e.fontSize) * 1.5 || 24, a = r(e.paddingTop) + r(e.paddingBottom), o = e.boxSizing === "border-box" ? r(e.borderTopWidth) + r(e.borderBottomWidth) : 0, s = (e.boxSizing === "border-box" ? a : 0) + o, c = (C(t.minRows) ?? 1) * i + s, l = C(t.maxRows), u = l ? l * i + s : Infinity;
203
+ n.style.height = "auto";
204
+ let d = n.scrollHeight + o + (e.boxSizing === "border-box" ? 0 : -a), f = Math.min(u, Math.max(c, d));
205
+ n.style.height = `${f}px`, n.style.overflowY = d > u ? "auto" : "hidden";
206
+ }
207
+ function o(e) {
208
+ n && (n.removeEventListener("input", a), r?.disconnect(), n.style.height = "", n.style.overflowY = ""), n = e ?? null, n && (n.addEventListener("input", a), typeof ResizeObserver < "u" && (r ??= new ResizeObserver(([e]) => {
209
+ let t = e.contentRect.width;
210
+ t !== i && (i = t, a());
211
+ }), r.observe(n)), a());
212
+ }
213
+ return D(() => C(e), o, {
214
+ immediate: !0,
215
+ flush: "post"
216
+ }), D([() => C(t.minRows), () => C(t.maxRows)], () => a(), { flush: "post" }), t.value && D(t.value, () => a(), { flush: "post" }), f() && h(() => o(null)), { resize: a };
217
+ }
218
+ //#endregion
219
+ //#region src/composables/useDebounce.ts
220
+ function q(e, t) {
221
+ let n = null;
222
+ function r(...r) {
223
+ n && clearTimeout(n), n = setTimeout(() => {
224
+ n = null, e(...r);
225
+ }, t);
226
+ }
227
+ function i() {
228
+ n &&= (clearTimeout(n), null);
229
+ }
230
+ return h(i), {
231
+ debounced: r,
232
+ cancel: i
233
+ };
234
+ }
235
+ //#endregion
236
+ //#region src/composables/_useSpring.ts
237
+ var J = t.standard.fastSpatial, oe = t.standard.fastEffects, Y = t.standard.defaultEffects, se = t.standard.defaultSpatial, ce = .004;
238
+ function X(e, t, n = J) {
239
+ let r = [...e()], i = r.map(() => 0), a = 0, o = 0;
240
+ function s(c) {
241
+ let l = Math.min((c - o) / 1e3, 1 / 30);
242
+ o = c;
243
+ let u = e();
244
+ u.length !== r.length && (r = [...u], i = u.map(() => 0));
245
+ let d = n.stiffness, f = 2 * n.dampingRatio * Math.sqrt(d);
246
+ for (; l > 0;) {
247
+ let e = Math.min(l, ce);
248
+ l -= e;
249
+ for (let t = 0; t < u.length; t++) i[t] += (-d * (r[t] - u[t]) - f * i[t]) * e, r[t] += i[t] * e;
250
+ }
251
+ let p = u.every((e, t) => Math.abs(e - r[t]) < .05 && Math.abs(i[t]) < .05);
252
+ p && (r = [...u], i = u.map(() => 0)), t(r), a = p ? 0 : requestAnimationFrame(s);
253
+ }
254
+ function c() {
255
+ a ||= (o = performance.now(), requestAnimationFrame(s));
256
+ }
257
+ function l() {
258
+ cancelAnimationFrame(a), a = 0, r = [...e()], i = r.map(() => 0), t(r);
259
+ }
260
+ return D(() => e().join(","), c), g(() => t(r)), _(() => cancelAnimationFrame(a)), { snap: l };
261
+ }
262
+ var le = n(.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__ */ d({
263
+ __name: "MIconButton",
264
+ props: {
265
+ icon: {},
266
+ label: {},
267
+ variant: { default: "standard" },
268
+ color: {},
269
+ contentColor: {},
270
+ shape: { default: "rounded" },
271
+ size: { default: "sm" },
272
+ disabled: {
273
+ type: Boolean,
274
+ default: !1
275
+ },
276
+ to: {},
277
+ rippleColor: {},
278
+ checked: {
279
+ type: Boolean,
280
+ default: void 0
281
+ },
282
+ checkedIcon: {},
283
+ iconFilled: { type: Boolean }
284
+ },
285
+ emits: ["update:checked"],
286
+ setup(e, { emit: t }) {
287
+ let n = e, o = t, s = i(() => n.checked !== void 0), c = [
288
+ "primary",
289
+ "secondary",
290
+ "tertiary",
291
+ "error"
292
+ ], l = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/, d = i(() => {
293
+ let e = f(), t = n.contentColor;
294
+ return !t || n.disabled || s.value ? e : {
295
+ ...e,
296
+ color: l.test(t) ? `var(--color-${t})` : t
297
+ };
298
+ });
299
+ function f() {
300
+ let e = n.color;
301
+ if (!e || n.disabled || s.value) return;
302
+ let t = c.includes(e), r = t ? `var(--color-${e})` : e;
303
+ switch (n.variant) {
304
+ case "filled": return {
305
+ backgroundColor: r,
306
+ color: t ? `var(--color-on-${e})` : "#fff"
307
+ };
308
+ case "tonal": return t ? {
309
+ backgroundColor: `var(--color-${e}-container)`,
310
+ color: `var(--color-on-${e}-container)`
311
+ } : {
312
+ backgroundColor: `color-mix(in srgb, ${e} 20%, transparent)`,
313
+ color: e
314
+ };
315
+ default: return { color: r };
316
+ }
317
+ }
318
+ let h = i(() => n.to && !s.value ? "RouterLink" : "button"), g = {
319
+ xs: {
320
+ px: 32,
321
+ icon: 20,
322
+ squareRadius: "rounded-md",
323
+ square: 12,
324
+ pressed: 8,
325
+ checkedRound: 12
326
+ },
327
+ sm: {
328
+ px: 40,
329
+ icon: 24,
330
+ squareRadius: "rounded-md",
331
+ square: 12,
332
+ pressed: 8,
333
+ checkedRound: 12
334
+ },
335
+ md: {
336
+ px: 56,
337
+ icon: 24,
338
+ squareRadius: "rounded-lg",
339
+ square: 16,
340
+ pressed: 12,
341
+ checkedRound: 16
342
+ },
343
+ lg: {
344
+ px: 96,
345
+ icon: 32,
346
+ squareRadius: "rounded-xl",
347
+ square: 28,
348
+ pressed: 16,
349
+ checkedRound: 28
350
+ },
351
+ xl: {
352
+ px: 136,
353
+ icon: 40,
354
+ squareRadius: "rounded-xl",
355
+ square: 28,
356
+ pressed: 16,
357
+ checkedRound: 28
358
+ }
359
+ }, _ = i(() => typeof n.size == "number" ? {
360
+ px: n.size,
361
+ icon: Math.round(n.size * .55),
362
+ squareRadius: "rounded-md",
363
+ square: 12,
364
+ pressed: 8,
365
+ checkedRound: 12
366
+ } : g[n.size] ?? g.sm), b = y(null), S = y(!1);
367
+ function C() {
368
+ let e = _.value, t = e.px / 2;
369
+ return S.value ? e.pressed : n.checked ? n.shape === "squared" ? t : e.checkedRound : n.shape === "squared" ? e.square : t;
370
+ }
371
+ X(() => s.value ? [C()] : [], (e) => {
372
+ b.value instanceof HTMLElement && (b.value.style.borderRadius = e.length ? `${e[0]}px` : "");
373
+ }, Y);
374
+ function T() {
375
+ s.value && !n.disabled && (S.value = !0);
376
+ }
377
+ function E() {
378
+ S.value = !1;
379
+ }
380
+ function D() {
381
+ s.value && !n.disabled && o("update:checked", !n.checked);
382
+ }
383
+ let A = i(() => {
384
+ if (n.variant === "outlined" && n.checked) return "disabled:bg-on-surface/10";
385
+ switch (n.variant) {
386
+ case "filled":
387
+ case "tonal": return "disabled:bg-on-surface/10";
388
+ default: return "";
389
+ }
390
+ }), j = i(() => n.shape === "squared" ? _.value.squareRadius : "rounded-full"), M = i(() => {
391
+ let e = n.checked;
392
+ switch (n.variant) {
393
+ case "filled": return e ? "bg-primary text-on-primary" : "bg-surface-container text-on-surface-variant";
394
+ case "tonal": return e ? "bg-secondary text-on-secondary" : "bg-secondary-container text-on-secondary-container";
395
+ case "outlined": return e ? "bg-inverse-surface text-inverse-on-surface" : "border border-current text-on-surface-variant";
396
+ default: return e ? "text-primary" : "text-on-surface-variant";
397
+ }
398
+ }), P = i(() => {
399
+ if (s.value) return M.value;
400
+ switch (n.variant) {
401
+ case "filled": return "bg-primary text-on-primary";
402
+ case "tonal": return "bg-secondary-container text-on-secondary-container";
403
+ case "outlined": return "border border-current text-on-surface-variant";
404
+ default: return "text-on-surface-variant";
405
+ }
406
+ });
407
+ return (t, n) => k((v(), a(x(h.value), {
408
+ ref_key: "rootEl",
409
+ ref: b,
410
+ to: h.value === "RouterLink" ? e.to : void 0,
411
+ type: h.value === "RouterLink" ? void 0 : "button",
412
+ "aria-label": e.label || void 0,
413
+ "aria-pressed": s.value ? e.checked : void 0,
414
+ disabled: e.disabled,
415
+ class: p([
416
+ ue,
417
+ j.value,
418
+ P.value,
419
+ A.value
420
+ ]),
421
+ style: m([{
422
+ width: `${_.value.px}px`,
423
+ height: `${_.value.px}px`
424
+ }, d.value]),
425
+ onPointerdown: T,
426
+ onPointerup: E,
427
+ onPointerleave: E,
428
+ onPointercancel: E,
429
+ onClick: D
430
+ }, {
431
+ default: O(() => [u(r, {
432
+ name: e.checked && e.checkedIcon ? e.checkedIcon : e.icon,
433
+ size: _.value.icon,
434
+ filled: !!e.checked || e.iconFilled
435
+ }, null, 8, [
436
+ "name",
437
+ "size",
438
+ "filled"
439
+ ])]),
440
+ _: 1
441
+ }, 40, [
442
+ "to",
443
+ "type",
444
+ "aria-label",
445
+ "aria-pressed",
446
+ "disabled",
447
+ "class",
448
+ "style"
449
+ ])), [[w(N), {
450
+ disabled: e.disabled,
451
+ color: e.rippleColor
452
+ }]]);
453
+ }
454
+ }), Z = [];
455
+ function Q(e) {
456
+ e.key === "Escape" && Z.length && (e.preventDefault(), Z[Z.length - 1]());
457
+ }
458
+ function fe(e, t) {
459
+ let n = () => t();
460
+ function r(e) {
461
+ if (typeof document > "u") return;
462
+ let t = Z.indexOf(n);
463
+ e && t < 0 ? (Z.push(n), Z.length === 1 && document.addEventListener("keydown", Q)) : !e && t >= 0 && (Z.splice(t, 1), Z.length || document.removeEventListener("keydown", Q));
464
+ }
465
+ D(e, (e) => r(!!e), { immediate: !0 }), f() && h(() => r(!1));
466
+ }
467
+ //#endregion
468
+ //#region src/components/MTextField.vue?vue&type=script&setup=true&lang.ts
469
+ var pe = { class: "flex flex-col gap-1" }, me = [
470
+ "id",
471
+ "value",
472
+ "rows",
473
+ "disabled",
474
+ "required"
475
+ ], he = [
476
+ "id",
477
+ "type",
478
+ "value",
479
+ "disabled",
480
+ "required",
481
+ "autocomplete"
482
+ ], ge = ["for"], $ = {
483
+ key: 0,
484
+ class: "text-error"
485
+ }, _e = {
486
+ key: 3,
487
+ class: "absolute right-2 top-1/2 -translate-y-1/2"
488
+ }, ve = ["aria-label"], ye = {
489
+ key: 0,
490
+ class: "px-4 text-body-small text-error"
491
+ }, be = {
492
+ key: 1,
493
+ class: "px-4 text-body-small text-on-surface-variant"
494
+ }, xe = /* @__PURE__ */ d({
495
+ __name: "MTextField",
496
+ props: {
497
+ modelValue: {},
498
+ label: {},
499
+ type: { default: "text" },
500
+ variant: { default: "filled" },
501
+ error: { type: Boolean },
502
+ errorLabel: {},
503
+ hint: {},
504
+ disabled: { type: Boolean },
505
+ required: { type: Boolean },
506
+ multiline: { type: Boolean },
507
+ rows: { default: 3 },
508
+ autoGrow: { type: Boolean },
509
+ maxRows: {},
510
+ autocomplete: {},
511
+ leadingIcon: {},
512
+ clearable: {
513
+ type: Boolean,
514
+ default: !1
515
+ },
516
+ fieldBg: {},
517
+ debounce: { default: 0 }
518
+ },
519
+ emits: ["update:modelValue", "debounced"],
520
+ setup(t, { emit: n }) {
521
+ let a = e(), d = t, f = n, h = T(), g = E(), _ = y(null), { resolvedFieldBg: x } = G(_, () => d.fieldBg), { debounced: C, cancel: D } = q((e) => f("debounced", e), d.debounce), O = y(null);
522
+ K(() => d.multiline && d.autoGrow ? O.value : null, {
523
+ minRows: () => d.rows,
524
+ maxRows: () => d.maxRows,
525
+ value: () => d.modelValue
526
+ });
527
+ let k = i(() => d.clearable && String(d.modelValue).length > 0 && !d.disabled), A = i(() => {
528
+ let e = !!g.trailing || d.clearable, t = d.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", r = d.multiline ? d.autoGrow ? "resize-none min-h-[56px]" : "resize-y min-h-[56px]" : "h-14", i = [
529
+ "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
530
+ "transition-[border-color,border-width] duration-150",
531
+ "disabled:cursor-not-allowed disabled:text-on-surface/38",
532
+ d.error ? "caret-error" : "caret-primary",
533
+ r,
534
+ t,
535
+ n
536
+ ];
537
+ return d.variant === "outlined" ? [
538
+ ...i,
539
+ "rounded-xs border bg-transparent py-4",
540
+ d.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
541
+ "disabled:border-on-surface/12"
542
+ ].join(" ") : [
543
+ ...i,
544
+ "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
545
+ d.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",
546
+ "disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
547
+ ].join(" ");
548
+ }), j = i(() => {
549
+ let e = [
550
+ "pointer-events-none absolute truncate transition-all duration-200",
551
+ d.leadingIcon ? d.variant === "outlined" ? "left-11" : "left-12" : d.variant === "outlined" ? "left-3" : "left-4",
552
+ "right-4",
553
+ `${d.variant === "filled" ? "top-[53%]" : "top-1/2"} -translate-y-1/2 text-body-large`
554
+ ];
555
+ return d.variant === "outlined" ? [
556
+ ...e,
557
+ "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",
558
+ "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)]",
559
+ "peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
560
+ d.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
561
+ "peer-disabled:text-on-surface/38"
562
+ ].join(" ") : [
563
+ ...e,
564
+ "peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
565
+ "peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
566
+ d.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
567
+ "peer-disabled:text-on-surface/38"
568
+ ].join(" ");
569
+ });
570
+ function M(e) {
571
+ let t = e.target;
572
+ f("update:modelValue", t.value), d.debounce > 0 && C(t.value);
573
+ }
574
+ return (e, n) => (v(), s("div", pe, [c("div", {
575
+ ref_key: "fieldBgEl",
576
+ ref: _,
577
+ class: p(["relative", t.variant === "outlined" ? "mt-2" : ""]),
578
+ style: m(t.variant === "outlined" ? { "--field-bg": w(x) } : void 0)
579
+ }, [
580
+ t.leadingIcon ? (v(), s("div", {
581
+ key: 0,
582
+ class: p(["pointer-events-none absolute left-3.5", [t.multiline ? "top-[55%] -translate-y-1/2" : t.variant === "filled" ? "top-4.5" : "top-4", t.disabled ? "text-on-surface/38" : "text-on-surface-variant"]])
583
+ }, [u(r, {
584
+ name: t.leadingIcon,
585
+ size: 24
586
+ }, null, 8, ["name"])], 2)) : o("", !0),
587
+ t.multiline ? (v(), s("textarea", {
588
+ key: 1,
589
+ ref_key: "textareaEl",
590
+ ref: O,
591
+ id: w(h),
592
+ value: String(t.modelValue),
593
+ rows: t.rows,
594
+ disabled: t.disabled,
595
+ required: t.required,
596
+ placeholder: " ",
597
+ class: p(A.value),
598
+ onInput: M
599
+ }, null, 42, me)) : (v(), s("input", {
600
+ key: 2,
601
+ id: w(h),
602
+ type: t.type,
603
+ value: t.modelValue,
604
+ disabled: t.disabled,
605
+ required: t.required,
606
+ autocomplete: t.autocomplete,
607
+ placeholder: " ",
608
+ class: p(A.value),
609
+ onInput: M
610
+ }, null, 42, he)),
611
+ c("label", {
612
+ for: w(h),
613
+ class: p(j.value)
614
+ }, [l(S(t.label), 1), t.required ? (v(), s("span", $, "\xA0*")) : o("", !0)], 10, ge),
615
+ e.$slots.trailing ? (v(), s("div", _e, [b(e.$slots, "trailing")])) : k.value ? (v(), s("button", {
616
+ key: 4,
617
+ "aria-label": w(a).clear,
618
+ type: "button",
619
+ 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",
620
+ onClick: n[0] ||= (e) => {
621
+ w(D)(), f("update:modelValue", "");
622
+ }
623
+ }, [u(r, {
624
+ name: "close",
625
+ size: 18
626
+ })], 8, ve)) : o("", !0)
627
+ ], 6), t.error && t.errorLabel ? (v(), s("p", ye, S(t.errorLabel), 1)) : t.hint ? (v(), s("p", be, S(t.hint), 1)) : o("", !0)]));
628
+ }
629
+ });
630
+ //#endregion
631
+ export { I as _, se as a, le as c, K as d, G as f, te as g, R as h, Y as i, X as l, P as m, fe as n, oe as o, V as p, de as r, J as s, xe as t, q as u, ee as v, N as y };
632
+
633
+ //# sourceMappingURL=MTextField-BBmkaIbO.js.map