@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
@@ -1,673 +0,0 @@
1
- import { i as e } from "./useLocale-CXibICQA.js";
2
- import { t } from "./MIcon-Bxh9j135.js";
3
- import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, onUnmounted as m, openBlock as h, ref as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, useId as x, useSlots as S, watch as C, withCtx as w, withDirectives as T } from "vue";
4
- //#region src/directives/vRipple.ts
5
- function E(e) {
6
- return e === !1 ? { disabled: !0 } : typeof e == "string" ? { color: e } : e === !0 || e == null ? {} : e;
7
- }
8
- function D(e, t, n) {
9
- let r = e.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = document.createElement("span");
10
- a.className = "m3-ripple-layer";
11
- let o = document.createElement("span");
12
- 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 });
13
- }
14
- var O = /* @__PURE__ */ new WeakMap(), k = {
15
- mounted(e, t) {
16
- let n = {
17
- options: E(t.value),
18
- onPointerDown(t) {
19
- if (n.options.disabled || t.button !== 0) return;
20
- let { position: r } = getComputedStyle(e);
21
- (!r || r === "static") && (e.style.position = "relative"), D(e, t, n.options.color);
22
- }
23
- };
24
- O.set(e, n), e.addEventListener("pointerdown", n.onPointerDown);
25
- },
26
- updated(e, t) {
27
- let n = O.get(e);
28
- n && (n.options = E(t.value));
29
- },
30
- beforeUnmount(e) {
31
- let t = O.get(e);
32
- t && e.removeEventListener("pointerdown", t.onPointerDown), O.delete(e);
33
- }
34
- }, A = ["aria-label"], j = {
35
- key: 0,
36
- class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
37
- }, M = [
38
- "width",
39
- "height",
40
- "viewBox"
41
- ], ee = ["d", "stroke-dasharray"], N = 3, P = 9, F = /* @__PURE__ */ l({
42
- __name: "MSpinner",
43
- props: {
44
- size: { default: 20 },
45
- wavy: {
46
- type: Boolean,
47
- default: !1
48
- },
49
- label: {}
50
- },
51
- setup(t) {
52
- let r = t, i = e(), s = n(() => (r.size / 2 - 1 - N / 2) / 1.25), c = n(() => r.size / 2), l = n(() => {
53
- let e = c.value, t = s.value, n = t * .08, r = [], i = 0, a = 0, o = 0;
54
- for (let s = 0; s <= 216; s++) {
55
- let c = 2 * Math.PI * s / 216 - Math.PI / 2, l = t + n * Math.sin(P * c), u = e + l * Math.cos(c), d = e + l * Math.sin(c);
56
- s > 0 && (i += Math.sqrt((u - a) ** 2 + (d - o) ** 2)), r.push(`${s === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), a = u, o = d;
57
- }
58
- let l = i * .58, u = i - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
59
- return {
60
- path: r.join("") + "Z",
61
- dash: d,
62
- len: i.toFixed(1)
63
- };
64
- });
65
- return (e, n) => (h(), a("span", {
66
- class: "inline-flex shrink-0 items-center justify-center",
67
- style: d({
68
- width: `${t.size}px`,
69
- height: `${t.size}px`
70
- }),
71
- role: "status",
72
- "aria-label": t.label ?? b(i).loading
73
- }, [t.wavy ? (h(), a("svg", {
74
- key: 1,
75
- width: t.size,
76
- height: t.size,
77
- viewBox: `0 0 ${t.size} ${t.size}`,
78
- fill: "none",
79
- class: "animate-[m3-wavy-spin_2.8s_linear_infinite]",
80
- style: d(`transform-origin: ${c.value}px ${c.value}px`)
81
- }, [o("path", {
82
- d: l.value.path,
83
- stroke: "currentColor",
84
- "stroke-width": N,
85
- "stroke-linecap": "round",
86
- "stroke-dasharray": l.value.dash,
87
- class: "animate-[m3-wavy-travel_2s_linear_infinite]",
88
- style: d({ "--m3-wave-len": l.value.len })
89
- }, null, 12, ee)], 12, M)) : (h(), a("span", j))], 12, A));
90
- }
91
- }), I = [
92
- "bg-surface-container-highest",
93
- "bg-surface-container-high",
94
- "bg-surface-container-low",
95
- "bg-surface-container-lowest",
96
- "bg-surface-container",
97
- "bg-surface-variant",
98
- "bg-surface-bright",
99
- "bg-surface-dim",
100
- "bg-surface",
101
- "bg-background",
102
- "bg-inverse-surface",
103
- "bg-primary-container",
104
- "bg-secondary-container",
105
- "bg-tertiary-container",
106
- "bg-error-container",
107
- "bg-primary-fixed",
108
- "bg-primary-fixed-dim",
109
- "bg-secondary-fixed",
110
- "bg-secondary-fixed-dim",
111
- "bg-tertiary-fixed",
112
- "bg-tertiary-fixed-dim",
113
- "bg-primary",
114
- "bg-secondary",
115
- "bg-tertiary",
116
- "bg-error"
117
- ];
118
- function L(e) {
119
- for (let t of I) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
120
- return null;
121
- }
122
- function R(e) {
123
- if (!e || e === "transparent") return !0;
124
- let t = e.match(/^rgba?\(([^)]+)\)$/);
125
- if (t) {
126
- let e = t[1].split(",").map((e) => e.trim());
127
- if (e.length === 4 && parseFloat(e[3]) === 0) return !0;
128
- }
129
- return !1;
130
- }
131
- function z(e, t) {
132
- let r = g("var(--color-surface)");
133
- function i(n) {
134
- r.value = n, e.value?.style.setProperty("--field-bg", t() ?? n);
135
- }
136
- function a() {
137
- let t = e.value?.parentElement ?? null;
138
- for (; t;) {
139
- let e = L(t);
140
- if (e) {
141
- i(e);
142
- return;
143
- }
144
- if (t === document.body) {
145
- i("var(--color-surface)");
146
- return;
147
- }
148
- let n = getComputedStyle(t).backgroundColor;
149
- if (!R(n)) {
150
- i(n);
151
- return;
152
- }
153
- t = t.parentElement;
154
- }
155
- i("var(--color-surface)");
156
- }
157
- let o = null;
158
- return p(() => {
159
- a(), o = new MutationObserver(() => a()), o.observe(document.documentElement, {
160
- attributes: !0,
161
- attributeFilter: [
162
- "class",
163
- "style",
164
- "data-theme"
165
- ]
166
- });
167
- }), f(() => o?.disconnect()), { resolvedFieldBg: n(() => t() ?? r.value) };
168
- }
169
- //#endregion
170
- //#region src/composables/useDebounce.ts
171
- function B(e, t) {
172
- let n = null;
173
- function r(...r) {
174
- n && clearTimeout(n), n = setTimeout(() => {
175
- n = null, e(...r);
176
- }, t);
177
- }
178
- function i() {
179
- n &&= (clearTimeout(n), null);
180
- }
181
- return f(i), {
182
- debounced: r,
183
- cancel: i
184
- };
185
- }
186
- //#endregion
187
- //#region src/composables/motion.ts
188
- var V = {
189
- standard: {
190
- fastSpatial: {
191
- dampingRatio: .9,
192
- stiffness: 1400
193
- },
194
- defaultSpatial: {
195
- dampingRatio: .9,
196
- stiffness: 700
197
- },
198
- slowSpatial: {
199
- dampingRatio: .9,
200
- stiffness: 300
201
- },
202
- fastEffects: {
203
- dampingRatio: 1,
204
- stiffness: 3800
205
- },
206
- defaultEffects: {
207
- dampingRatio: 1,
208
- stiffness: 1600
209
- },
210
- slowEffects: {
211
- dampingRatio: 1,
212
- stiffness: 800
213
- }
214
- },
215
- expressive: {
216
- fastSpatial: {
217
- dampingRatio: .6,
218
- stiffness: 800
219
- },
220
- defaultSpatial: {
221
- dampingRatio: .8,
222
- stiffness: 380
223
- },
224
- slowSpatial: {
225
- dampingRatio: .8,
226
- stiffness: 200
227
- },
228
- fastEffects: {
229
- dampingRatio: 1,
230
- stiffness: 3800
231
- },
232
- defaultEffects: {
233
- dampingRatio: 1,
234
- stiffness: 1600
235
- },
236
- slowEffects: {
237
- dampingRatio: 1,
238
- stiffness: 800
239
- }
240
- }
241
- }, H = {
242
- emphasized: [
243
- .2,
244
- 0,
245
- 0,
246
- 1
247
- ],
248
- emphasizedDecelerate: [
249
- .05,
250
- .7,
251
- .1,
252
- 1
253
- ],
254
- emphasizedAccelerate: [
255
- .3,
256
- 0,
257
- .8,
258
- .15
259
- ],
260
- standard: [
261
- .2,
262
- 0,
263
- 0,
264
- 1
265
- ],
266
- standardDecelerate: [
267
- 0,
268
- 0,
269
- 0,
270
- 1
271
- ],
272
- standardAccelerate: [
273
- .3,
274
- 0,
275
- 1,
276
- 1
277
- ],
278
- legacy: [
279
- .4,
280
- 0,
281
- .2,
282
- 1
283
- ],
284
- legacyDecelerate: [
285
- 0,
286
- 0,
287
- .2,
288
- 1
289
- ],
290
- legacyAccelerate: [
291
- .4,
292
- 0,
293
- 1,
294
- 1
295
- ],
296
- linear: [
297
- 0,
298
- 0,
299
- 1,
300
- 1
301
- ]
302
- }, U = {
303
- short1: 50,
304
- short2: 100,
305
- short3: 150,
306
- short4: 200,
307
- medium1: 250,
308
- medium2: 300,
309
- medium3: 350,
310
- medium4: 400,
311
- long1: 450,
312
- long2: 500,
313
- long3: 550,
314
- long4: 600,
315
- extraLong1: 700,
316
- extraLong2: 800,
317
- extraLong3: 900,
318
- extraLong4: 1e3
319
- };
320
- function W(e, t, n, r) {
321
- return (i) => {
322
- if (i <= 0) return 0;
323
- if (i >= 1) return 1;
324
- let a = i;
325
- for (let t = 0; t < 8; t++) {
326
- 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);
327
- if (Math.abs(r) < 1e-6) break;
328
- a -= t / r;
329
- }
330
- return 3 * a * (1 - a) ** 2 * t + 3 * a ** 2 * (1 - a) * r + a ** 3;
331
- };
332
- }
333
- //#endregion
334
- //#region src/composables/_useSpring.ts
335
- var G = V.standard.fastSpatial, K = V.standard.fastEffects, q = V.standard.defaultEffects, J = V.standard.defaultSpatial, Y = .004;
336
- function X(e, t, n = G) {
337
- let r = [...e()], i = r.map(() => 0), a = 0, o = 0;
338
- function s(c) {
339
- let l = Math.min((c - o) / 1e3, 1 / 30);
340
- o = c;
341
- let u = e();
342
- u.length !== r.length && (r = [...u], i = u.map(() => 0));
343
- let d = n.stiffness, f = 2 * n.dampingRatio * Math.sqrt(d);
344
- for (; l > 0;) {
345
- let e = Math.min(l, Y);
346
- l -= e;
347
- for (let t = 0; t < u.length; t++) i[t] += (-d * (r[t] - u[t]) - f * i[t]) * e, r[t] += i[t] * e;
348
- }
349
- let p = u.every((e, t) => Math.abs(e - r[t]) < .05 && Math.abs(i[t]) < .05);
350
- p && (r = [...u], i = u.map(() => 0)), t(r), a = p ? 0 : requestAnimationFrame(s);
351
- }
352
- function c() {
353
- a ||= (o = performance.now(), requestAnimationFrame(s));
354
- }
355
- function l() {
356
- cancelAnimationFrame(a), a = 0, r = [...e()], i = r.map(() => 0), t(r);
357
- }
358
- return C(() => e().join(","), c), p(() => t(r)), m(() => cancelAnimationFrame(a)), { snap: l };
359
- }
360
- var Z = W(.4, 0, .2, 1), Q = "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]", te = /* @__PURE__ */ l({
361
- __name: "MIconButton",
362
- props: {
363
- icon: {},
364
- label: {},
365
- variant: { default: "standard" },
366
- shape: { default: "rounded" },
367
- size: { default: "sm" },
368
- disabled: {
369
- type: Boolean,
370
- default: !1
371
- },
372
- to: {},
373
- rippleColor: {},
374
- checked: {
375
- type: Boolean,
376
- default: void 0
377
- },
378
- checkedIcon: {},
379
- iconFilled: { type: Boolean }
380
- },
381
- emits: ["update:checked"],
382
- setup(e, { emit: i }) {
383
- let a = e, o = i, s = n(() => a.checked !== void 0), l = n(() => a.to && !s.value ? "RouterLink" : "button"), f = {
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
- }, p = n(() => typeof a.size == "number" ? {
425
- px: a.size,
426
- icon: Math.round(a.size * .55),
427
- squareRadius: "rounded-md",
428
- square: 12,
429
- pressed: 8,
430
- checkedRound: 12
431
- } : f[a.size] ?? f.sm), m = g(null), _ = g(!1);
432
- function y() {
433
- let e = p.value, t = e.px / 2;
434
- return _.value ? e.pressed : a.checked ? a.shape === "squared" ? t : e.checkedRound : a.shape === "squared" ? e.square : t;
435
- }
436
- X(() => s.value ? [y()] : [], (e) => {
437
- m.value instanceof HTMLElement && (m.value.style.borderRadius = e.length ? `${e[0]}px` : "");
438
- }, q);
439
- function x() {
440
- s.value && !a.disabled && (_.value = !0);
441
- }
442
- function S() {
443
- _.value = !1;
444
- }
445
- function C() {
446
- s.value && !a.disabled && o("update:checked", !a.checked);
447
- }
448
- let E = n(() => {
449
- if (a.variant === "outlined" && a.checked) return "disabled:bg-on-surface/10";
450
- switch (a.variant) {
451
- case "filled":
452
- case "tonal": return "disabled:bg-on-surface/10";
453
- default: return "";
454
- }
455
- }), D = n(() => a.shape === "squared" ? p.value.squareRadius : "rounded-full"), O = n(() => {
456
- let e = a.checked;
457
- switch (a.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
- }), A = n(() => {
464
- if (s.value) return O.value;
465
- switch (a.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, i) => T((h(), r(v(l.value), {
473
- ref_key: "rootEl",
474
- ref: m,
475
- to: l.value === "RouterLink" ? e.to : void 0,
476
- type: l.value === "RouterLink" ? void 0 : "button",
477
- "aria-label": e.label || void 0,
478
- "aria-pressed": s.value ? e.checked : void 0,
479
- disabled: e.disabled,
480
- class: u([
481
- Q,
482
- D.value,
483
- A.value,
484
- E.value
485
- ]),
486
- style: d({
487
- width: `${p.value.px}px`,
488
- height: `${p.value.px}px`
489
- }),
490
- onPointerdown: x,
491
- onPointerup: S,
492
- onPointerleave: S,
493
- onPointercancel: S,
494
- onClick: C
495
- }, {
496
- default: w(() => [c(t, {
497
- name: e.checked && e.checkedIcon ? e.checkedIcon : e.icon,
498
- size: p.value.icon,
499
- filled: !!e.checked || e.iconFilled
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
- ])), [[b(k), {
515
- disabled: e.disabled,
516
- color: e.rippleColor
517
- }]]);
518
- }
519
- }), ne = { class: "flex flex-col gap-1" }, re = [
520
- "id",
521
- "value",
522
- "rows",
523
- "disabled",
524
- "required"
525
- ], ie = [
526
- "id",
527
- "type",
528
- "value",
529
- "disabled",
530
- "required",
531
- "autocomplete"
532
- ], ae = ["for"], oe = {
533
- key: 0,
534
- class: "text-error"
535
- }, $ = {
536
- key: 3,
537
- class: "absolute right-2 top-1/2 -translate-y-1/2"
538
- }, se = ["aria-label"], ce = {
539
- key: 0,
540
- class: "px-4 text-body-small text-error"
541
- }, le = {
542
- key: 1,
543
- class: "px-4 text-body-small text-on-surface-variant"
544
- }, ue = /* @__PURE__ */ l({
545
- __name: "MTextField",
546
- props: {
547
- modelValue: {},
548
- label: {},
549
- type: { default: "text" },
550
- variant: { default: "filled" },
551
- error: { type: Boolean },
552
- errorLabel: {},
553
- hint: {},
554
- disabled: { type: Boolean },
555
- required: { type: Boolean },
556
- multiline: { type: Boolean },
557
- rows: { default: 3 },
558
- autocomplete: {},
559
- leadingIcon: {},
560
- clearable: {
561
- type: Boolean,
562
- default: !1
563
- },
564
- fieldBg: {},
565
- debounce: { default: 0 }
566
- },
567
- emits: ["update:modelValue", "debounced"],
568
- setup(r, { emit: l }) {
569
- let f = e(), p = r, m = l, v = x(), C = S(), w = g(null), { resolvedFieldBg: T } = z(w, () => p.fieldBg), { debounced: E, cancel: D } = B((e) => m("debounced", e), p.debounce), O = n(() => p.clearable && String(p.modelValue).length > 0 && !p.disabled), k = n(() => {
570
- let e = !!C.trailing || p.clearable, t = p.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", r = p.multiline ? "resize-y min-h-[56px]" : "h-14", i = [
571
- "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
572
- "transition-[border-color,border-width] duration-150",
573
- "disabled:cursor-not-allowed disabled:text-on-surface/38",
574
- p.error ? "caret-error" : "caret-primary",
575
- r,
576
- t,
577
- n
578
- ];
579
- return p.variant === "outlined" ? [
580
- ...i,
581
- "rounded-xs border bg-transparent py-4",
582
- p.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
583
- "disabled:border-on-surface/12"
584
- ].join(" ") : [
585
- ...i,
586
- "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
587
- p.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",
588
- "disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
589
- ].join(" ");
590
- }), A = n(() => {
591
- let e = [
592
- "pointer-events-none absolute truncate transition-all duration-200",
593
- p.leadingIcon ? p.variant === "outlined" ? "left-11" : "left-12" : p.variant === "outlined" ? "left-3" : "left-4",
594
- "right-4",
595
- `${p.variant === "filled" ? "top-[53%]" : "top-1/2"} -translate-y-1/2 text-body-large`
596
- ];
597
- return p.variant === "outlined" ? [
598
- ...e,
599
- "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",
600
- "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)]",
601
- "peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
602
- p.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
603
- "peer-disabled:text-on-surface/38"
604
- ].join(" ") : [
605
- ...e,
606
- "peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
607
- "peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
608
- p.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
609
- "peer-disabled:text-on-surface/38"
610
- ].join(" ");
611
- });
612
- function j(e) {
613
- let t = e.target;
614
- m("update:modelValue", t.value), p.debounce > 0 && E(t.value);
615
- }
616
- return (e, n) => (h(), a("div", ne, [o("div", {
617
- ref_key: "fieldBgEl",
618
- ref: w,
619
- class: u(["relative", r.variant === "outlined" ? "mt-2" : ""]),
620
- style: d(r.variant === "outlined" ? { "--field-bg": b(T) } : void 0)
621
- }, [
622
- r.leadingIcon ? (h(), a("div", {
623
- key: 0,
624
- class: u(["pointer-events-none absolute left-3.5", [r.multiline ? "top-[55%] -translate-y-1/2" : r.variant === "filled" ? "top-4.5" : "top-4", r.disabled ? "text-on-surface/38" : "text-on-surface-variant"]])
625
- }, [c(t, {
626
- name: r.leadingIcon,
627
- size: 24
628
- }, null, 8, ["name"])], 2)) : i("", !0),
629
- r.multiline ? (h(), a("textarea", {
630
- key: 1,
631
- id: b(v),
632
- value: String(r.modelValue),
633
- rows: r.rows,
634
- disabled: r.disabled,
635
- required: r.required,
636
- placeholder: " ",
637
- class: u(k.value),
638
- onInput: j
639
- }, null, 42, re)) : (h(), a("input", {
640
- key: 2,
641
- id: b(v),
642
- type: r.type,
643
- value: r.modelValue,
644
- disabled: r.disabled,
645
- required: r.required,
646
- autocomplete: r.autocomplete,
647
- placeholder: " ",
648
- class: u(k.value),
649
- onInput: j
650
- }, null, 42, ie)),
651
- o("label", {
652
- for: b(v),
653
- class: u(A.value)
654
- }, [s(y(r.label), 1), r.required ? (h(), a("span", oe, "\xA0*")) : i("", !0)], 10, ae),
655
- e.$slots.trailing ? (h(), a("div", $, [_(e.$slots, "trailing")])) : O.value ? (h(), a("button", {
656
- key: 4,
657
- "aria-label": b(f).clear,
658
- type: "button",
659
- 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",
660
- onClick: n[0] ||= (e) => {
661
- b(D)(), m("update:modelValue", "");
662
- }
663
- }, [c(t, {
664
- name: "close",
665
- size: 18
666
- })], 8, se)) : i("", !0)
667
- ], 6), r.error && r.errorLabel ? (h(), a("p", ce, y(r.errorLabel), 1)) : r.hint ? (h(), a("p", le, y(r.hint), 1)) : i("", !0)]));
668
- }
669
- });
670
- //#endregion
671
- export { K as a, X as c, H as d, V as f, k as g, F as h, J as i, W as l, z as m, te as n, G as o, B as p, q as r, Z as s, ue as t, U as u };
672
-
673
- //# sourceMappingURL=MTextField-NaIB6RbM.js.map