@m3ui-vue/m3ui-vue 1.1.3 → 1.2.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 (236) hide show
  1. package/README.md +1 -1
  2. package/dist/API.md +579 -40
  3. package/dist/MMenuItem-DI351kIf.js +929 -0
  4. package/dist/MMenuItem-DI351kIf.js.map +1 -0
  5. package/dist/MSlider-BnEy5ieZ.js +1500 -0
  6. package/dist/MSlider-BnEy5ieZ.js.map +1 -0
  7. package/dist/MTextField-BBmkaIbO.js +633 -0
  8. package/dist/MTextField-BBmkaIbO.js.map +1 -0
  9. package/dist/api.json +1 -1
  10. package/dist/chart.js +83 -49
  11. package/dist/chart.js.map +1 -1
  12. package/dist/code-editor.js +1 -1
  13. package/dist/components/MAnimatedNumber.vue.d.ts +3 -1
  14. package/dist/components/MButton.vue.d.ts +9 -1
  15. package/dist/components/MButtonGroup.vue.d.ts +40 -31
  16. package/dist/components/MCarousel.vue.d.ts +2 -0
  17. package/dist/components/MChart.vue.d.ts +6 -0
  18. package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
  19. package/dist/components/MContainerTransform.vue.d.ts +59 -0
  20. package/dist/components/MContextMenu.vue.d.ts +2 -2
  21. package/dist/components/MCopyButton.vue.d.ts +1 -1
  22. package/dist/components/MDialog.vue.d.ts +8 -5
  23. package/dist/components/MExportButton.vue.d.ts +1 -1
  24. package/dist/components/MFab.vue.d.ts +2 -2
  25. package/dist/components/MFabMenu.vue.d.ts +1 -1
  26. package/dist/components/MFlex.vue.d.ts +1 -1
  27. package/dist/components/MIconButton.vue.d.ts +15 -1
  28. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  29. package/dist/components/MListItem.vue.d.ts +5 -5
  30. package/dist/components/MMap.vue.d.ts +20 -2
  31. package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
  32. package/dist/components/MMapFilter.vue.d.ts +3 -0
  33. package/dist/components/MMapLayers.vue.d.ts +3 -0
  34. package/dist/components/MMenu.vue.d.ts +2 -2
  35. package/dist/components/MMenuItem.vue.d.ts +7 -3
  36. package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
  37. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  38. package/dist/components/MOverlay.vue.d.ts +12 -1
  39. package/dist/components/MProgressBar.vue.d.ts +5 -3
  40. package/dist/components/MPullToRefresh.vue.d.ts +7 -2
  41. package/dist/components/MRichTextEditor.vue.d.ts +7 -1
  42. package/dist/components/MSearchField.vue.d.ts +58 -0
  43. package/dist/components/MSegmentedButton.vue.d.ts +31 -23
  44. package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
  45. package/dist/components/MSkeleton.vue.d.ts +6 -3
  46. package/dist/components/MSplitter.vue.d.ts +1 -1
  47. package/dist/components/MStack.vue.d.ts +1 -1
  48. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  49. package/dist/components/MSwitch.vue.d.ts +1 -1
  50. package/dist/components/MTextField.vue.d.ts +5 -1
  51. package/dist/components/MTimeline.vue.d.ts +85 -22
  52. package/dist/components/MToolbar.vue.d.ts +32 -5
  53. package/dist/components/MTooltip.vue.d.ts +1 -1
  54. package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
  55. package/dist/components/_MToolbarFab.vue.d.ts +16 -0
  56. package/dist/composables/_containerTransform.d.ts +48 -0
  57. package/dist/composables/_mapStyle.d.ts +13 -0
  58. package/dist/composables/_themeTransition.d.ts +2 -0
  59. package/dist/composables/_tooltipTrigger.d.ts +22 -0
  60. package/dist/composables/_useMenuNav.d.ts +28 -0
  61. package/dist/composables/useAutoGrow.d.ts +21 -0
  62. package/dist/composables/useColorPalette.d.ts +1 -1
  63. package/dist/composables/useContainerTransform.d.ts +30 -0
  64. package/dist/composables/useLocale.d.ts +6 -0
  65. package/dist/composables/useMap.d.ts +19 -3
  66. package/dist/composables/useMapFilter.d.ts +4 -1
  67. package/dist/composables/useMapLayers.d.ts +5 -2
  68. package/dist/composables/useScrollReveal.d.ts +44 -0
  69. package/dist/composables/useThemeTokens.d.ts +21 -0
  70. package/dist/composables/viewportHints.d.ts +27 -0
  71. package/dist/directives/vClickOutside.d.ts +25 -0
  72. package/dist/directives/vFocusRing.d.ts +22 -0
  73. package/dist/directives/vLongPress.d.ts +27 -0
  74. package/dist/directives/vReveal.d.ts +10 -0
  75. package/dist/directives/vScrollElevation.d.ts +31 -0
  76. package/dist/directives/vSkeleton.d.ts +19 -0
  77. package/dist/directives/vStateLayer.d.ts +20 -0
  78. package/dist/directives/vSwipe.d.ts +45 -0
  79. package/dist/directives/vTooltip.d.ts +23 -0
  80. package/dist/index.d.ts +31 -1
  81. package/dist/locales/index.js +35 -7
  82. package/dist/locales/index.js.map +1 -1
  83. package/dist/m3ui-vue.css +1 -1
  84. package/dist/m3ui.js +7692 -6273
  85. package/dist/m3ui.js.map +1 -1
  86. package/dist/map.d.ts +1 -1
  87. package/dist/map.js +823 -793
  88. package/dist/map.js.map +1 -1
  89. package/dist/motion-DZiXG09o.js +150 -0
  90. package/dist/motion-DZiXG09o.js.map +1 -0
  91. package/dist/plugin.d.ts +24 -0
  92. package/dist/rich-text-editor.js +20 -16
  93. package/dist/rich-text-editor.js.map +1 -1
  94. package/dist/styles/theme.css +63 -0
  95. package/dist/styles.css +1 -1
  96. package/dist/{useLocale-SfQHnJfp.js → useLocale-JYxDDeXC.js} +6 -2
  97. package/dist/useLocale-JYxDDeXC.js.map +1 -0
  98. package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
  99. package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
  100. package/package.json +2 -1
  101. package/src/__tests__/MAnimatedNumber.test.ts +24 -2
  102. package/src/__tests__/MButton.test.ts +22 -0
  103. package/src/__tests__/MCarousel.test.ts +9 -0
  104. package/src/__tests__/MChart.test.ts +77 -5
  105. package/src/__tests__/MContainerTransform.test.ts +279 -0
  106. package/src/__tests__/MDialog.test.ts +27 -0
  107. package/src/__tests__/MIconButton.test.ts +33 -0
  108. package/src/__tests__/MListItemExpandable.test.ts +48 -0
  109. package/src/__tests__/MListItemShape.test.ts +9 -6
  110. package/src/__tests__/MListKeyboard.test.ts +90 -0
  111. package/src/__tests__/MMap.test.ts +53 -1
  112. package/src/__tests__/MMapLayers.test.ts +46 -2
  113. package/src/__tests__/MMapTools.test.ts +2 -1
  114. package/src/__tests__/MMenu.test.ts +104 -1
  115. package/src/__tests__/MMenuItem.test.ts +18 -0
  116. package/src/__tests__/MNavigationDrawer.test.ts +80 -0
  117. package/src/__tests__/MNavigationRail.test.ts +33 -0
  118. package/src/__tests__/MOverlay.test.ts +49 -0
  119. package/src/__tests__/MProgressBar.test.ts +41 -0
  120. package/src/__tests__/MPullToRefresh.test.ts +33 -0
  121. package/src/__tests__/MRichTextEditor.test.ts +22 -0
  122. package/src/__tests__/MSearchField.test.ts +71 -0
  123. package/src/__tests__/MSkeleton.test.ts +38 -0
  124. package/src/__tests__/MSlider.test.ts +161 -0
  125. package/src/__tests__/MTimeline.test.ts +238 -0
  126. package/src/__tests__/MToolbar.test.ts +157 -0
  127. package/src/__tests__/_fakeMaplibre.ts +3 -1
  128. package/src/__tests__/attrsFallthrough.test.ts +9 -0
  129. package/src/__tests__/escapeStack.test.ts +93 -0
  130. package/src/__tests__/hydration.test.ts +25 -0
  131. package/src/__tests__/ssr.test.ts +21 -2
  132. package/src/__tests__/useAutoGrow.test.ts +103 -0
  133. package/src/__tests__/useScrollReveal.test.ts +102 -0
  134. package/src/__tests__/useThemeTokens.test.ts +114 -0
  135. package/src/__tests__/vClickOutside.test.ts +82 -0
  136. package/src/__tests__/vFocusRing.test.ts +36 -0
  137. package/src/__tests__/vLongPress.test.ts +81 -0
  138. package/src/__tests__/vScrollElevation.test.ts +89 -0
  139. package/src/__tests__/vSkeleton.test.ts +48 -0
  140. package/src/__tests__/vStateLayer.test.ts +53 -0
  141. package/src/__tests__/vSwipe.test.ts +93 -0
  142. package/src/__tests__/vTooltip.test.ts +95 -0
  143. package/src/__tests__/viewportHints.test.ts +41 -0
  144. package/src/components/MAnimatedNumber.vue +32 -6
  145. package/src/components/MAutocomplete.vue +5 -0
  146. package/src/components/MBottomSheet.vue +4 -1
  147. package/src/components/MButton.vue +19 -3
  148. package/src/components/MButtonGroup.vue +22 -17
  149. package/src/components/MCarousel.vue +7 -1
  150. package/src/components/MChart.vue +74 -34
  151. package/src/components/MCircleProgressBar.vue +14 -9
  152. package/src/components/MCommandPalette.vue +3 -2
  153. package/src/components/MContainerTransform.vue +321 -0
  154. package/src/components/MContextMenu.vue +19 -60
  155. package/src/components/MDialog.vue +31 -6
  156. package/src/components/MDragDropList.vue +2 -0
  157. package/src/components/MFab.vue +10 -5
  158. package/src/components/MIconButton.vue +43 -2
  159. package/src/components/MKanban.vue +2 -0
  160. package/src/components/MLightbox.vue +7 -2
  161. package/src/components/MList.vue +26 -2
  162. package/src/components/MListItem.vue +138 -84
  163. package/src/components/MMap.vue +38 -5
  164. package/src/components/MMapBaseLayers.vue +7 -3
  165. package/src/components/MMapFilter.vue +7 -4
  166. package/src/components/MMapGeoJson.vue +1 -1
  167. package/src/components/MMapLayers.vue +6 -2
  168. package/src/components/MMapMeasure.vue +5 -2
  169. package/src/components/MMenu.vue +18 -59
  170. package/src/components/MMenuItem.vue +11 -2
  171. package/src/components/MMultiAutocomplete.vue +5 -0
  172. package/src/components/MNavigationDrawer.vue +96 -11
  173. package/src/components/MNavigationRail.vue +44 -25
  174. package/src/components/MOverlay.vue +32 -13
  175. package/src/components/MProgressBar.vue +25 -27
  176. package/src/components/MPullToRefresh.vue +20 -1
  177. package/src/components/MRichTextEditor.vue +19 -5
  178. package/src/components/MSearchBar.vue +5 -0
  179. package/src/components/MSearchField.vue +142 -0
  180. package/src/components/MSegmentedButton.vue +19 -17
  181. package/src/components/MSelect.vue +10 -1
  182. package/src/components/MSideSheet.vue +5 -2
  183. package/src/components/MSimpleCarousel.vue +10 -1
  184. package/src/components/MSkeleton.vue +30 -8
  185. package/src/components/MSlider.vue +161 -42
  186. package/src/components/MSpotlightSearch.vue +3 -2
  187. package/src/components/MTextField.vue +15 -2
  188. package/src/components/MTimeline.vue +370 -81
  189. package/src/components/MToolbar.vue +256 -15
  190. package/src/components/MTooltip.vue +20 -152
  191. package/src/components/_MDrawerItemList.vue +25 -6
  192. package/src/components/_MToolbarFab.vue +14 -0
  193. package/src/composables/_containerTransform.ts +179 -0
  194. package/src/composables/_mapStyle.ts +45 -0
  195. package/src/composables/_themeTransition.ts +2 -0
  196. package/src/composables/_tooltipTrigger.ts +184 -0
  197. package/src/composables/_useEscapeStack.ts +2 -0
  198. package/src/composables/_useMenuNav.ts +209 -0
  199. package/src/composables/useAutoGrow.ts +78 -0
  200. package/src/composables/useContainerTransform.ts +59 -0
  201. package/src/composables/useLocale.ts +10 -0
  202. package/src/composables/useMap.ts +43 -5
  203. package/src/composables/useMapFilter.ts +6 -5
  204. package/src/composables/useMapLayers.ts +7 -6
  205. package/src/composables/useScrollReveal.ts +151 -0
  206. package/src/composables/useThemeTokens.ts +116 -0
  207. package/src/composables/viewportHints.ts +80 -0
  208. package/src/directives/vClickOutside.ts +90 -0
  209. package/src/directives/vFocusRing.ts +60 -0
  210. package/src/directives/vLongPress.ts +134 -0
  211. package/src/directives/vReveal.ts +57 -0
  212. package/src/directives/vScrollElevation.ts +116 -0
  213. package/src/directives/vSkeleton.ts +87 -0
  214. package/src/directives/vStateLayer.ts +83 -0
  215. package/src/directives/vSwipe.ts +197 -0
  216. package/src/directives/vTooltip.ts +128 -0
  217. package/src/index.ts +31 -1
  218. package/src/locales/de.ts +4 -0
  219. package/src/locales/es.ts +4 -0
  220. package/src/locales/fr.ts +4 -0
  221. package/src/locales/ja.ts +4 -0
  222. package/src/locales/ko.ts +4 -0
  223. package/src/locales/pt.ts +4 -0
  224. package/src/locales/zh.ts +4 -0
  225. package/src/map.ts +1 -1
  226. package/src/plugin.ts +34 -0
  227. package/src/styles/theme.css +63 -0
  228. package/dist/MMenuItem-BckcR0nW.js +0 -809
  229. package/dist/MMenuItem-BckcR0nW.js.map +0 -1
  230. package/dist/MSlider-LyH_gy8D.js +0 -1411
  231. package/dist/MSlider-LyH_gy8D.js.map +0 -1
  232. package/dist/MTextField-FCPOTB0o.js +0 -672
  233. package/dist/MTextField-FCPOTB0o.js.map +0 -1
  234. package/dist/composables/_useThemeTokens.d.ts +0 -7
  235. package/dist/useLocale-SfQHnJfp.js.map +0 -1
  236. package/src/composables/_useThemeTokens.ts +0 -42
@@ -1,672 +0,0 @@
1
- import { i as e } from "./useLocale-SfQHnJfp.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
- },
380
- emits: ["update:checked"],
381
- setup(e, { emit: i }) {
382
- let a = e, o = i, s = n(() => a.checked !== void 0), l = n(() => a.to && !s.value ? "RouterLink" : "button"), f = {
383
- xs: {
384
- px: 32,
385
- icon: 20,
386
- squareRadius: "rounded-md",
387
- square: 12,
388
- pressed: 8,
389
- checkedRound: 12
390
- },
391
- sm: {
392
- px: 40,
393
- icon: 24,
394
- squareRadius: "rounded-md",
395
- square: 12,
396
- pressed: 8,
397
- checkedRound: 12
398
- },
399
- md: {
400
- px: 56,
401
- icon: 24,
402
- squareRadius: "rounded-lg",
403
- square: 16,
404
- pressed: 12,
405
- checkedRound: 16
406
- },
407
- lg: {
408
- px: 96,
409
- icon: 32,
410
- squareRadius: "rounded-xl",
411
- square: 28,
412
- pressed: 16,
413
- checkedRound: 28
414
- },
415
- xl: {
416
- px: 136,
417
- icon: 40,
418
- squareRadius: "rounded-xl",
419
- square: 28,
420
- pressed: 16,
421
- checkedRound: 28
422
- }
423
- }, p = n(() => typeof a.size == "number" ? {
424
- px: a.size,
425
- icon: Math.round(a.size * .55),
426
- squareRadius: "rounded-md",
427
- square: 12,
428
- pressed: 8,
429
- checkedRound: 12
430
- } : f[a.size] ?? f.sm), m = g(null), _ = g(!1);
431
- function y() {
432
- let e = p.value, t = e.px / 2;
433
- return _.value ? e.pressed : a.checked ? a.shape === "squared" ? t : e.checkedRound : a.shape === "squared" ? e.square : t;
434
- }
435
- X(() => s.value ? [y()] : [], (e) => {
436
- m.value instanceof HTMLElement && (m.value.style.borderRadius = e.length ? `${e[0]}px` : "");
437
- }, q);
438
- function x() {
439
- s.value && !a.disabled && (_.value = !0);
440
- }
441
- function S() {
442
- _.value = !1;
443
- }
444
- function C() {
445
- s.value && !a.disabled && o("update:checked", !a.checked);
446
- }
447
- let E = n(() => {
448
- if (a.variant === "outlined" && a.checked) return "disabled:bg-on-surface/10";
449
- switch (a.variant) {
450
- case "filled":
451
- case "tonal": return "disabled:bg-on-surface/10";
452
- default: return "";
453
- }
454
- }), D = n(() => a.shape === "squared" ? p.value.squareRadius : "rounded-full"), O = n(() => {
455
- let e = a.checked;
456
- switch (a.variant) {
457
- case "filled": return e ? "bg-primary text-on-primary" : "bg-surface-container text-on-surface-variant";
458
- case "tonal": return e ? "bg-secondary text-on-secondary" : "bg-secondary-container text-on-secondary-container";
459
- case "outlined": return e ? "bg-inverse-surface text-inverse-on-surface" : "border border-current text-on-surface-variant";
460
- default: return e ? "text-primary" : "text-on-surface-variant";
461
- }
462
- }), A = n(() => {
463
- if (s.value) return O.value;
464
- switch (a.variant) {
465
- case "filled": return "bg-primary text-on-primary";
466
- case "tonal": return "bg-secondary-container text-on-secondary-container";
467
- case "outlined": return "border border-current text-on-surface-variant";
468
- default: return "text-on-surface-variant";
469
- }
470
- });
471
- return (n, i) => T((h(), r(v(l.value), {
472
- ref_key: "rootEl",
473
- ref: m,
474
- to: l.value === "RouterLink" ? e.to : void 0,
475
- type: l.value === "RouterLink" ? void 0 : "button",
476
- "aria-label": e.label || void 0,
477
- "aria-pressed": s.value ? e.checked : void 0,
478
- disabled: e.disabled,
479
- class: u([
480
- Q,
481
- D.value,
482
- A.value,
483
- E.value
484
- ]),
485
- style: d({
486
- width: `${p.value.px}px`,
487
- height: `${p.value.px}px`
488
- }),
489
- onPointerdown: x,
490
- onPointerup: S,
491
- onPointerleave: S,
492
- onPointercancel: S,
493
- onClick: C
494
- }, {
495
- default: w(() => [c(t, {
496
- name: e.checked && e.checkedIcon ? e.checkedIcon : e.icon,
497
- size: p.value.icon,
498
- filled: !!e.checked
499
- }, null, 8, [
500
- "name",
501
- "size",
502
- "filled"
503
- ])]),
504
- _: 1
505
- }, 40, [
506
- "to",
507
- "type",
508
- "aria-label",
509
- "aria-pressed",
510
- "disabled",
511
- "class",
512
- "style"
513
- ])), [[b(k), {
514
- disabled: e.disabled,
515
- color: e.rippleColor
516
- }]]);
517
- }
518
- }), ne = { class: "flex flex-col gap-1" }, re = [
519
- "id",
520
- "value",
521
- "rows",
522
- "disabled",
523
- "required"
524
- ], ie = [
525
- "id",
526
- "type",
527
- "value",
528
- "disabled",
529
- "required",
530
- "autocomplete"
531
- ], ae = ["for"], oe = {
532
- key: 0,
533
- class: "text-error"
534
- }, $ = {
535
- key: 3,
536
- class: "absolute right-2 top-1/2 -translate-y-1/2"
537
- }, se = ["aria-label"], ce = {
538
- key: 0,
539
- class: "px-4 text-body-small text-error"
540
- }, le = {
541
- key: 1,
542
- class: "px-4 text-body-small text-on-surface-variant"
543
- }, ue = /* @__PURE__ */ l({
544
- __name: "MTextField",
545
- props: {
546
- modelValue: {},
547
- label: {},
548
- type: { default: "text" },
549
- variant: { default: "filled" },
550
- error: { type: Boolean },
551
- errorLabel: {},
552
- hint: {},
553
- disabled: { type: Boolean },
554
- required: { type: Boolean },
555
- multiline: { type: Boolean },
556
- rows: { default: 3 },
557
- autocomplete: {},
558
- leadingIcon: {},
559
- clearable: {
560
- type: Boolean,
561
- default: !1
562
- },
563
- fieldBg: {},
564
- debounce: { default: 0 }
565
- },
566
- emits: ["update:modelValue", "debounced"],
567
- setup(r, { emit: l }) {
568
- 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(() => {
569
- 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 = [
570
- "peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
571
- "transition-[border-color,border-width] duration-150",
572
- "disabled:cursor-not-allowed disabled:text-on-surface/38",
573
- p.error ? "caret-error" : "caret-primary",
574
- r,
575
- t,
576
- n
577
- ];
578
- return p.variant === "outlined" ? [
579
- ...i,
580
- "rounded-xs border bg-transparent py-4",
581
- p.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
582
- "disabled:border-on-surface/12"
583
- ].join(" ") : [
584
- ...i,
585
- "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
586
- 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",
587
- "disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
588
- ].join(" ");
589
- }), A = n(() => {
590
- let e = [
591
- "pointer-events-none absolute truncate transition-all duration-200",
592
- p.leadingIcon ? p.variant === "outlined" ? "left-11" : "left-12" : p.variant === "outlined" ? "left-3" : "left-4",
593
- "right-4",
594
- `${p.variant === "filled" ? "top-[53%]" : "top-1/2"} -translate-y-1/2 text-body-large`
595
- ];
596
- return p.variant === "outlined" ? [
597
- ...e,
598
- "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",
599
- "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)]",
600
- "peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
601
- p.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
602
- "peer-disabled:text-on-surface/38"
603
- ].join(" ") : [
604
- ...e,
605
- "peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
606
- "peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
607
- p.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
608
- "peer-disabled:text-on-surface/38"
609
- ].join(" ");
610
- });
611
- function j(e) {
612
- let t = e.target;
613
- m("update:modelValue", t.value), p.debounce > 0 && E(t.value);
614
- }
615
- return (e, n) => (h(), a("div", ne, [o("div", {
616
- ref_key: "fieldBgEl",
617
- ref: w,
618
- class: u(["relative", r.variant === "outlined" ? "mt-2" : ""]),
619
- style: d(r.variant === "outlined" ? { "--field-bg": b(T) } : void 0)
620
- }, [
621
- r.leadingIcon ? (h(), a("div", {
622
- key: 0,
623
- 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"]])
624
- }, [c(t, {
625
- name: r.leadingIcon,
626
- size: 24
627
- }, null, 8, ["name"])], 2)) : i("", !0),
628
- r.multiline ? (h(), a("textarea", {
629
- key: 1,
630
- id: b(v),
631
- value: String(r.modelValue),
632
- rows: r.rows,
633
- disabled: r.disabled,
634
- required: r.required,
635
- placeholder: " ",
636
- class: u(k.value),
637
- onInput: j
638
- }, null, 42, re)) : (h(), a("input", {
639
- key: 2,
640
- id: b(v),
641
- type: r.type,
642
- value: r.modelValue,
643
- disabled: r.disabled,
644
- required: r.required,
645
- autocomplete: r.autocomplete,
646
- placeholder: " ",
647
- class: u(k.value),
648
- onInput: j
649
- }, null, 42, ie)),
650
- o("label", {
651
- for: b(v),
652
- class: u(A.value)
653
- }, [s(y(r.label), 1), r.required ? (h(), a("span", oe, "\xA0*")) : i("", !0)], 10, ae),
654
- e.$slots.trailing ? (h(), a("div", $, [_(e.$slots, "trailing")])) : O.value ? (h(), a("button", {
655
- key: 4,
656
- "aria-label": b(f).clear,
657
- type: "button",
658
- 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",
659
- onClick: n[0] ||= (e) => {
660
- b(D)(), m("update:modelValue", "");
661
- }
662
- }, [c(t, {
663
- name: "close",
664
- size: 18
665
- })], 8, se)) : i("", !0)
666
- ], 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)]));
667
- }
668
- });
669
- //#endregion
670
- 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 };
671
-
672
- //# sourceMappingURL=MTextField-FCPOTB0o.js.map