@m3ui-vue/m3ui-vue 1.6.2 → 1.7.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 (163) hide show
  1. package/dist/API.md +649 -28
  2. package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
  3. package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
  4. package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-BKM1CHxr.js} +4 -4
  5. package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-BKM1CHxr.js.map} +1 -1
  6. package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
  7. package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
  8. package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
  9. package/dist/MListItem-BU5KDRCB.js.map +1 -0
  10. package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
  11. package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
  12. package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
  13. package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
  14. package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
  15. package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
  16. package/dist/MSlider-BCeVIxcq.js +739 -0
  17. package/dist/MSlider-BCeVIxcq.js.map +1 -0
  18. package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
  19. package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
  20. package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
  21. package/dist/MTextField-NaFbMkjv.js.map +1 -0
  22. package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
  23. package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
  24. package/dist/api.json +1 -1
  25. package/dist/code-editor.js +184 -103
  26. package/dist/code-editor.js.map +1 -1
  27. package/dist/components/MAddressField.vue.d.ts +18 -3
  28. package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
  29. package/dist/components/MAudioRecorder.vue.d.ts +2 -2
  30. package/dist/components/MAutocomplete.vue.d.ts +22 -3
  31. package/dist/components/MCheckbox.vue.d.ts +23 -1
  32. package/dist/components/MCodeEditor.vue.d.ts +23 -1
  33. package/dist/components/MColorPicker.vue.d.ts +24 -3
  34. package/dist/components/MConfirmDialog.vue.d.ts +2 -2
  35. package/dist/components/MCountrySelect.vue.d.ts +13 -2
  36. package/dist/components/MCreditCardInput.vue.d.ts +33 -0
  37. package/dist/components/MCronField.vue.d.ts +23 -1
  38. package/dist/components/MDataTable.vue.d.ts +1 -1
  39. package/dist/components/MDatePicker.vue.d.ts +24 -3
  40. package/dist/components/MDateRangePicker.vue.d.ts +24 -3
  41. package/dist/components/MFileUpload.vue.d.ts +23 -2
  42. package/dist/components/MForm.vue.d.ts +61 -0
  43. package/dist/components/MJsonEditor.vue.d.ts +23 -1
  44. package/dist/components/MMapRoute.vue.d.ts +168 -0
  45. package/dist/components/MMaskField.vue.d.ts +20 -2
  46. package/dist/components/MMentionField.vue.d.ts +13 -2
  47. package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
  48. package/dist/components/MMultiSelect.vue.d.ts +22 -3
  49. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  50. package/dist/components/MNotificationCenter.vue.d.ts +2 -2
  51. package/dist/components/MNumberField.vue.d.ts +20 -2
  52. package/dist/components/MPhoneInput.vue.d.ts +19 -4
  53. package/dist/components/MPinInput.vue.d.ts +24 -3
  54. package/dist/components/MPosKeypad.vue.d.ts +2 -2
  55. package/dist/components/MRadioGroup.vue.d.ts +23 -1
  56. package/dist/components/MRating.vue.d.ts +23 -1
  57. package/dist/components/MRichTextEditor.vue.d.ts +23 -1
  58. package/dist/components/MSearchBar.vue.d.ts +1 -1
  59. package/dist/components/MSegmentedButton.vue.d.ts +23 -2
  60. package/dist/components/MSelect.vue.d.ts +22 -3
  61. package/dist/components/MSignaturePad.vue.d.ts +19 -0
  62. package/dist/components/MSlider.vue.d.ts +23 -1
  63. package/dist/components/MSwitch.vue.d.ts +23 -1
  64. package/dist/components/MTable.vue.d.ts +1 -1
  65. package/dist/components/MTagInput.vue.d.ts +20 -2
  66. package/dist/components/MText.vue.d.ts +1 -1
  67. package/dist/components/MTextField.vue.d.ts +26 -3
  68. package/dist/components/MTimePicker.vue.d.ts +24 -3
  69. package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
  70. package/dist/components/MTour.vue.d.ts +2 -2
  71. package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
  72. package/dist/components/MWindow.vue.d.ts +2 -2
  73. package/dist/composables/_routeGeometry.d.ts +26 -0
  74. package/dist/composables/_useFieldValidation.d.ts +91 -0
  75. package/dist/composables/mapRouting.d.ts +35 -0
  76. package/dist/composables/useLocale.d.ts +23 -0
  77. package/dist/composables/validation.d.ts +82 -0
  78. package/dist/draw.js +2 -2
  79. package/dist/flow.js +1 -1
  80. package/dist/gantt.js +2 -2
  81. package/dist/index.d.ts +5 -0
  82. package/dist/locales/index.js +154 -7
  83. package/dist/locales/index.js.map +1 -1
  84. package/dist/m3ui-vue.css +1 -1
  85. package/dist/m3ui.js +6768 -5602
  86. package/dist/m3ui.js.map +1 -1
  87. package/dist/map.d.ts +4 -0
  88. package/dist/map.js +1230 -784
  89. package/dist/map.js.map +1 -1
  90. package/dist/media.js +4 -4
  91. package/dist/pdf.js +4 -4
  92. package/dist/rich-text-editor.js +189 -146
  93. package/dist/rich-text-editor.js.map +1 -1
  94. package/dist/styles.css +1 -1
  95. package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
  96. package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
  97. package/package.json +1 -1
  98. package/src/__tests__/MForm.test.ts +325 -0
  99. package/src/__tests__/MMapRoute.test.ts +384 -0
  100. package/src/__tests__/MPhoneInput.test.ts +5 -2
  101. package/src/__tests__/MRichTextEditor.test.ts +2 -1
  102. package/src/__tests__/MTrackingTimeline.test.ts +66 -0
  103. package/src/__tests__/_fakeMaplibre.ts +4 -1
  104. package/src/__tests__/_osrmRoutes.ts +10 -0
  105. package/src/__tests__/attrsFallthrough.test.ts +11 -0
  106. package/src/__tests__/fieldsValidation.test.ts +229 -0
  107. package/src/__tests__/ssr.test.ts +1 -0
  108. package/src/__tests__/validation.test.ts +77 -0
  109. package/src/components/MAddressField.vue +45 -8
  110. package/src/components/MAutocomplete.vue +69 -23
  111. package/src/components/MCheckbox.vue +80 -17
  112. package/src/components/MCodeEditor.vue +59 -2
  113. package/src/components/MColorPicker.vue +65 -16
  114. package/src/components/MCountrySelect.vue +17 -3
  115. package/src/components/MCreditCardInput.vue +76 -7
  116. package/src/components/MCronField.vue +60 -10
  117. package/src/components/MDatePicker.vue +65 -16
  118. package/src/components/MDateRangePicker.vue +66 -16
  119. package/src/components/MFileUpload.vue +71 -8
  120. package/src/components/MForm.vue +208 -0
  121. package/src/components/MJsonEditor.vue +57 -3
  122. package/src/components/MMapRoute.vue +470 -0
  123. package/src/components/MMaskField.vue +55 -13
  124. package/src/components/MMentionField.vue +17 -2
  125. package/src/components/MMultiAutocomplete.vue +70 -23
  126. package/src/components/MMultiSelect.vue +70 -23
  127. package/src/components/MNumberField.vue +58 -16
  128. package/src/components/MPhoneInput.vue +60 -18
  129. package/src/components/MPinInput.vue +58 -10
  130. package/src/components/MRadioGroup.vue +65 -4
  131. package/src/components/MRating.vue +62 -6
  132. package/src/components/MRichTextEditor.vue +64 -4
  133. package/src/components/MSegmentedButton.vue +59 -2
  134. package/src/components/MSelect.vue +72 -26
  135. package/src/components/MSignaturePad.vue +71 -6
  136. package/src/components/MSlider.vue +61 -10
  137. package/src/components/MSwitch.vue +63 -8
  138. package/src/components/MTagInput.vue +67 -25
  139. package/src/components/MTextField.vue +68 -14
  140. package/src/components/MTimePicker.vue +65 -16
  141. package/src/components/MTimezoneSelect.vue +17 -3
  142. package/src/components/MTrackingTimeline.vue +257 -0
  143. package/src/composables/_routeGeometry.ts +140 -0
  144. package/src/composables/_useFieldValidation.ts +287 -0
  145. package/src/composables/mapRouting.ts +55 -0
  146. package/src/composables/useLocale.ts +46 -0
  147. package/src/composables/validation.ts +178 -0
  148. package/src/index.ts +5 -0
  149. package/src/locales/de.ts +21 -0
  150. package/src/locales/es.ts +28 -7
  151. package/src/locales/fr.ts +21 -0
  152. package/src/locales/ja.ts +21 -0
  153. package/src/locales/ko.ts +21 -0
  154. package/src/locales/pt.ts +21 -0
  155. package/src/locales/zh.ts +21 -0
  156. package/src/map.ts +4 -0
  157. package/dist/MListItem-D2cNUyzP.js.map +0 -1
  158. package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
  159. package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
  160. package/dist/MSlider-BIkA6DiE.js +0 -690
  161. package/dist/MSlider-BIkA6DiE.js.map +0 -1
  162. package/dist/MTextField-CNH-byir.js.map +0 -1
  163. package/dist/useLocale-DaVSTdm0.js.map +0 -1
@@ -1,690 +0,0 @@
1
- import { t as e } from "./MIcon-DpajuUTJ.js";
2
- import { i as t } from "./useLocale-DaVSTdm0.js";
3
- import { Fragment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as ee, onMounted as te, openBlock as p, ref as m, renderList as ne, toDisplayString as h, unref as re, withCtx as ie } from "vue";
4
- // src/components/MSlider.vue?vue&type=script&setup=true&lang.ts
5
- var ae = {
6
- key: 0,
7
- class: "flex items-center justify-between"
8
- }, oe = {
9
- key: 0,
10
- class: "text-label-large text-on-surface"
11
- }, se = {
12
- key: 1,
13
- class: "tabular-nums text-label-large text-on-surface-variant"
14
- }, ce = [
15
- "role",
16
- "tabindex",
17
- "aria-label",
18
- "aria-valuenow",
19
- "aria-valuemin",
20
- "aria-valuemax",
21
- "aria-disabled",
22
- "aria-orientation"
23
- ], le = [
24
- "tabindex",
25
- "aria-label",
26
- "aria-valuenow",
27
- "aria-valuemin",
28
- "aria-valuemax",
29
- "aria-disabled",
30
- "aria-orientation",
31
- "onKeydown",
32
- "onFocus"
33
- ], ue = "color-mix(in srgb, var(--color-on-surface) 38%, transparent)", de = "color-mix(in srgb, var(--color-on-surface) 12%, transparent)", fe = /* @__PURE__ */ u({
34
- __name: "MSlider",
35
- props: {
36
- modelValue: {},
37
- min: { default: 0 },
38
- max: { default: 100 },
39
- step: { default: 1 },
40
- disabled: {
41
- type: Boolean,
42
- default: !1
43
- },
44
- label: {},
45
- showValue: {
46
- type: Boolean,
47
- default: !1
48
- },
49
- showTooltip: {
50
- type: Boolean,
51
- default: !1
52
- },
53
- orientation: { default: "horizontal" },
54
- size: { default: "xs" },
55
- variant: { default: "standard" },
56
- stops: {
57
- type: Boolean,
58
- default: !1
59
- },
60
- icon: {},
61
- color: { default: "primary" },
62
- fillColor: {},
63
- thumbIcon: {},
64
- thumbColor: {}
65
- },
66
- emits: ["update:modelValue"],
67
- setup(u, { emit: fe }) {
68
- let g = u, _ = fe, pe = t(), v = m(), me = m([]), y = m(!1), b = m(!1), x = m(null), S = m(null), C = !1;
69
- function he(e) {
70
- C = !0, me.value[e]?.focus({ preventScroll: !0 }), C = !1;
71
- }
72
- function ge(e) {
73
- x.value = e, S.value = C ? null : e;
74
- }
75
- function _e() {
76
- x.value = null, S.value = null;
77
- }
78
- let w = i(() => g.orientation === "vertical"), T = i(() => g.variant === "range");
79
- i(() => g.variant === "centered");
80
- let E = i(() => {
81
- if (T.value) {
82
- let e = g.modelValue;
83
- return {
84
- lo: Math.min(e[0], e[1]),
85
- hi: Math.max(e[0], e[1])
86
- };
87
- }
88
- return {
89
- lo: g.modelValue,
90
- hi: g.modelValue
91
- };
92
- });
93
- function D(e) {
94
- let t = g.max - g.min;
95
- return t === 0 ? 0 : (e - g.min) / t * 100;
96
- }
97
- let O = m(null), ve = i(() => !g.stops && y.value !== !1 && O.value !== null ? O.value * 100 : null), k = i(() => {
98
- let e = ve.value;
99
- return e !== null && (y.value === "single" || y.value === 0) ? T.value ? Math.min(e, D(E.value.hi)) : e : D(E.value.lo);
100
- }), A = i(() => {
101
- let e = ve.value;
102
- return e !== null && y.value === 1 ? Math.max(e, D(E.value.lo)) : D(E.value.hi);
103
- }), j = i(() => D(0)), ye = i(() => Se.value < I.value.dotInset + I.value.dot / 2 ? !0 : g.variant === "centered" ? Math.min(k.value, j.value) <= 0 : g.variant !== "range" || k.value <= 0), be = i(() => Ce.value < I.value.dotInset + I.value.dot / 2 ? !0 : g.variant === "centered" ? Math.max(k.value, j.value) >= 100 : g.variant === "range" ? A.value >= 100 : k.value >= 100), M = m(0), N, xe = () => {
104
- let e = v.value;
105
- e && (M.value = w.value ? e.offsetHeight : e.offsetWidth);
106
- };
107
- te(() => {
108
- xe(), typeof ResizeObserver < "u" && v.value && (N = new ResizeObserver(xe), N.observe(v.value));
109
- }), ee(() => N?.disconnect());
110
- let P = (e) => {
111
- let t = I.value.thumbInset;
112
- return Math.min(Math.max(e / 100 * M.value, t), M.value - t);
113
- }, Se = i(() => M.value && (g.variant === "range" || g.variant === "centered" && k.value <= j.value) ? P(k.value) - L.value : Infinity), Ce = i(() => M.value ? g.variant === "range" ? M.value - P(A.value) - L.value : g.variant === "centered" && k.value < j.value ? Infinity : M.value - P(k.value) - L.value : Infinity), we = i(() => Se.value <= J.value), F = i(() => Ce.value <= J.value), Te = {
114
- xs: {
115
- track: 16,
116
- thumbW: 4,
117
- thumbH: 44,
118
- dot: 4,
119
- gap: 6,
120
- hitArea: 46,
121
- radius: 6,
122
- dotInset: 12,
123
- thumbInset: 5,
124
- iconSize: 14,
125
- thumbIconSize: 22
126
- },
127
- sm: {
128
- track: 28,
129
- thumbW: 4,
130
- thumbH: 40,
131
- dot: 5,
132
- gap: 7,
133
- hitArea: 46,
134
- radius: 8,
135
- dotInset: 13,
136
- thumbInset: 6,
137
- iconSize: 16,
138
- thumbIconSize: 28
139
- },
140
- md: {
141
- track: 54,
142
- thumbW: 5,
143
- thumbH: 62,
144
- dot: 5,
145
- gap: 8,
146
- hitArea: 66,
147
- radius: 12,
148
- dotInset: 15,
149
- thumbInset: 7,
150
- iconSize: 20,
151
- thumbIconSize: 42
152
- },
153
- lg: {
154
- track: 72,
155
- thumbW: 5,
156
- thumbH: 78,
157
- dot: 6,
158
- gap: 10,
159
- hitArea: 82,
160
- radius: 14,
161
- dotInset: 17,
162
- thumbInset: 8,
163
- iconSize: 24,
164
- thumbIconSize: 52
165
- },
166
- xl: {
167
- track: 96,
168
- thumbW: 6,
169
- thumbH: 98,
170
- dot: 7,
171
- gap: 10,
172
- hitArea: 100,
173
- radius: 18,
174
- dotInset: 19,
175
- thumbInset: 9,
176
- iconSize: 28,
177
- thumbIconSize: 66
178
- }
179
- }, I = i(() => Te[g.size] ?? Te.xs), Ee = i(() => I.value.thumbInset + I.value.thumbW / 2 + I.value.iconSize / 2 + 3), L = i(() => g.thumbIcon ? Math.max(I.value.gap, I.value.thumbIconSize / 2 + 4) : I.value.gap), De = {
180
- primary: "var(--color-primary)",
181
- secondary: "var(--color-secondary)",
182
- tertiary: "var(--color-tertiary)",
183
- error: "var(--color-error)"
184
- };
185
- function Oe(e, t) {
186
- let n = e ?? t;
187
- return De[n] ?? n;
188
- }
189
- let R = i(() => g.disabled ? {
190
- active: ue,
191
- inactive: de
192
- } : {
193
- active: Oe(g.fillColor, g.color),
194
- inactive: "var(--color-secondary-container)"
195
- }), z = i(() => g.disabled ? {
196
- active: ue,
197
- inactive: de
198
- } : {
199
- active: Oe(g.thumbColor, g.color),
200
- inactive: "var(--color-secondary-container)"
201
- });
202
- function B(e) {
203
- let t = Math.round((e - g.min) / g.step) * g.step + g.min;
204
- return Math.max(g.min, Math.min(g.max, +t.toFixed(10)));
205
- }
206
- function V(e) {
207
- if (!v.value) return 0;
208
- let t = v.value.getBoundingClientRect();
209
- return w.value ? 1 - Math.max(0, Math.min(1, (e.clientY - t.top) / t.height)) : Math.max(0, Math.min(1, (e.clientX - t.left) / t.width));
210
- }
211
- function ke(e) {
212
- return B(g.min + V(e) * (g.max - g.min));
213
- }
214
- let H = !1;
215
- function U(e, t) {
216
- let { lo: n, hi: r } = E.value;
217
- return e === 0 ? [Math.min(t, r), r] : [n, Math.max(t, n)];
218
- }
219
- function Ae(e) {
220
- if (g.disabled) return;
221
- e.preventDefault();
222
- let t = ke(e);
223
- if (T.value) {
224
- let { lo: e, hi: n } = E.value;
225
- H = !1;
226
- let r;
227
- t <= e && t < n ? r = 0 : t >= n && t > e ? r = 1 : e === n ? (r = 0, H = !0) : r = Math.abs(t - e) <= Math.abs(t - n) ? 0 : 1, y.value = r, he(r), H || _("update:modelValue", U(r, t));
228
- } else y.value = "single", _("update:modelValue", t);
229
- O.value = H ? null : V(e), window.addEventListener("pointermove", W), window.addEventListener("pointerup", G), window.addEventListener("pointercancel", G);
230
- }
231
- function W(e) {
232
- if (y.value === !1) return;
233
- let t = ke(e);
234
- if (T.value) {
235
- if (H) {
236
- if (t === E.value.lo) return;
237
- H = !1, y.value = +(t > E.value.lo), he(y.value);
238
- }
239
- O.value = V(e), _("update:modelValue", U(y.value, t));
240
- } else O.value = V(e), _("update:modelValue", t);
241
- }
242
- function G() {
243
- y.value = !1, O.value = null, H = !1, window.removeEventListener("pointermove", W), window.removeEventListener("pointerup", G), window.removeEventListener("pointercancel", G);
244
- }
245
- let K = {
246
- ArrowRight: 1,
247
- ArrowUp: 1,
248
- ArrowLeft: -1,
249
- ArrowDown: -1
250
- };
251
- function je(e) {
252
- if (g.disabled) return;
253
- let t = K[e.key];
254
- t !== void 0 && (e.preventDefault(), _("update:modelValue", B(g.modelValue + t * g.step))), e.key === "Home" && (e.preventDefault(), _("update:modelValue", g.min)), e.key === "End" && (e.preventDefault(), _("update:modelValue", g.max));
255
- }
256
- function Me(e, t) {
257
- if (g.disabled) return;
258
- let { lo: n, hi: r } = E.value, i = e === 0 ? n : r, a = K[t.key], o;
259
- a === void 0 ? t.key === "Home" ? o = e === 0 ? g.min : n : t.key === "End" && (o = e === 0 ? r : g.max) : o = B(i + a * g.step), o !== void 0 && (t.preventDefault(), S.value = e, _("update:modelValue", U(e, o)));
260
- }
261
- ee(() => {
262
- window.removeEventListener("pointermove", W), window.removeEventListener("pointerup", G), window.removeEventListener("pointercancel", G);
263
- });
264
- let Ne = i(() => {
265
- if (!g.stops) return [];
266
- let e = [], t = g.max - g.min, n = g.icon ? (I.value.iconSize + I.value.radius) / 2 : 0;
267
- for (let r = g.min + g.step; r < g.max; r += g.step) {
268
- let i = (r - g.min) / t * 100;
269
- g.icon && i < n || e.push(i);
270
- }
271
- return e.length <= 28 ? e : [];
272
- });
273
- function Pe(e) {
274
- return `calc(${$(e)} - ${L.value}px)`;
275
- }
276
- function Fe(e) {
277
- return F.value ? "0px" : `calc(100% - ${$(e)} - ${L.value}px)`;
278
- }
279
- function Ie() {
280
- return we.value ? "0px" : `calc(${$(k.value)} - ${L.value}px)`;
281
- }
282
- function Le() {
283
- return `calc(${$(k.value)} + ${L.value}px)`;
284
- }
285
- function Re() {
286
- return `calc(${$(A.value)} - ${$(k.value)} - ${L.value * 2}px)`;
287
- }
288
- function ze() {
289
- return F.value ? "0px" : `calc(100% - ${$(A.value)} - ${L.value}px)`;
290
- }
291
- function Be() {
292
- return k.value >= j.value ? `${j.value}%` : `calc(${$(k.value)} + ${L.value}px)`;
293
- }
294
- function Ve() {
295
- return k.value >= j.value ? `calc(${$(k.value)} - ${j.value}% - ${L.value}px)` : `calc(${j.value}% - ${$(k.value)} - ${L.value}px)`;
296
- }
297
- function He() {
298
- return F.value ? "0px" : k.value >= j.value ? `calc(100% - ${$(k.value)} - ${L.value}px)` : `calc(100% - ${j.value}% - ${L.value}px)`;
299
- }
300
- function Ue() {
301
- return we.value ? "0px" : k.value <= j.value ? `calc(${$(k.value)} - ${L.value}px)` : `calc(${j.value}% - ${L.value}px)`;
302
- }
303
- let We = i(() => I.value.radius), q = i(() => Math.max(2, We.value / 4)), J = i(() => We.value * 1.3);
304
- function Ge() {
305
- return `${q.value}px`;
306
- }
307
- function Y() {
308
- return w.value ? `${q.value}px ${q.value}px ${J.value}px ${J.value}px` : `${J.value}px ${q.value}px ${q.value}px ${J.value}px`;
309
- }
310
- function X() {
311
- return w.value ? `${J.value}px ${J.value}px ${q.value}px ${q.value}px` : `${q.value}px ${J.value}px ${J.value}px ${q.value}px`;
312
- }
313
- let Z = i(() => y.value === !1), Q = i(() => Z.value ? "75ms ease" : "0s");
314
- function $(e) {
315
- let t = I.value.thumbInset;
316
- return `clamp(${t}px, ${e}%, calc(100% - ${t}px))`;
317
- }
318
- function Ke(e, t = 0) {
319
- let n = w.value ? I.value.thumbH : I.value.thumbW, r = w.value ? I.value.thumbW : I.value.thumbH, i = Math.min(n, r) / 2, a = y.value !== !1, o = {
320
- position: "absolute",
321
- width: `${n}px`,
322
- height: `${r}px`,
323
- borderRadius: `${i}px`,
324
- backgroundColor: z.value.active,
325
- "--tw-ring-color": z.value.active,
326
- zIndex: "2",
327
- transition: Z.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
328
- }, s = T.value ? y.value === t || x.value === t : a || b.value, c = (T.value ? y.value === t : a) ? 1.08 : 1, l = s ? .5 : 1;
329
- return w.value ? (o.left = "50%", o.bottom = $(e), o.transform = `translateX(-50%) translateY(50%) scaleX(${c}) scaleY(${l})`) : (o.left = $(e), o.top = "50%", o.transform = `translateX(-50%) translateY(-50%) scaleY(${c}) scaleX(${l})`), o;
330
- }
331
- function qe(e) {
332
- let t = y.value === !1 ? 1 : 1.15, n = {
333
- position: "absolute",
334
- color: z.value.active,
335
- "--tw-ring-color": z.value.active,
336
- zIndex: "2",
337
- transition: Z.value ? "left 75ms ease, bottom 75ms ease, transform 80ms ease" : "transform 80ms ease"
338
- };
339
- return w.value ? (n.left = "50%", n.bottom = $(e), n.transform = `translateX(-50%) translateY(50%) scale(${t})`) : (n.left = $(e), n.top = "50%", n.transform = `translateX(-50%) translateY(-50%) scale(${t})`), n;
340
- }
341
- function Je(e) {
342
- let t = I.value.track / 2 + 36, n = I.value.track / 2 + 40;
343
- return w.value ? {
344
- left: `calc(50% - ${n}px)`,
345
- bottom: $(e),
346
- transform: "translateY(50%)",
347
- transition: Z.value ? "bottom " + Q.value : "none"
348
- } : {
349
- left: $(e),
350
- top: `calc(50% - ${t}px)`,
351
- transform: "translateX(-50%)",
352
- transition: Z.value ? "left " + Q.value : "none"
353
- };
354
- }
355
- let Ye = i(() => T.value ? `${E.value.lo} – ${E.value.hi}` : String(g.modelValue)), Xe = i(() => T.value && typeof y.value == "number" ? y.value === 0 ? E.value.lo : E.value.hi : g.modelValue), Ze = i(() => T.value && typeof y.value == "number" ? y.value === 0 ? k.value : A.value : k.value);
356
- return (t, i) => (p(), s("div", { class: d(["flex select-none", w.value ? "h-full flex-col items-center" : "flex-col gap-1"]) }, [u.label || u.showValue ? (p(), s("div", ae, [u.label ? (p(), s("span", oe, h(u.label), 1)) : o("", !0), u.showValue ? (p(), s("span", se, h(Ye.value), 1)) : o("", !0)])) : o("", !0), c("div", { class: d(["flex items-center", w.value ? "flex-1 flex-col" : ""]) }, [c("div", {
357
- ref_key: "trackEl",
358
- ref: v,
359
- role: T.value ? "group" : "slider",
360
- tabindex: T.value ? void 0 : 0,
361
- "aria-label": T.value ? u.label : void 0,
362
- "aria-valuenow": T.value ? void 0 : u.modelValue,
363
- "aria-valuemin": T.value ? void 0 : u.min,
364
- "aria-valuemax": T.value ? void 0 : u.max,
365
- "aria-disabled": u.disabled || void 0,
366
- "aria-orientation": T.value ? void 0 : u.orientation,
367
- class: d(["group relative touch-none cursor-pointer outline-none", u.disabled && "cursor-not-allowed"]),
368
- style: f(w.value ? {
369
- width: `${I.value.hitArea}px`,
370
- minHeight: "160px",
371
- height: "100%"
372
- } : {
373
- height: `${I.value.hitArea}px`,
374
- width: "100%"
375
- }),
376
- onPointerdown: Ae,
377
- onKeydown: i[0] ||= (e) => !T.value && je(e),
378
- onFocus: i[1] ||= (e) => b.value = !T.value,
379
- onBlur: i[2] ||= (e) => b.value = !1
380
- }, [
381
- c("div", {
382
- class: "absolute",
383
- style: f(w.value ? {
384
- left: "50%",
385
- top: "0",
386
- bottom: "0",
387
- width: `${I.value.track}px`,
388
- transform: "translateX(-50%)",
389
- borderRadius: `${J.value}px`
390
- } : {
391
- top: "50%",
392
- left: "0",
393
- right: "0",
394
- height: `${I.value.track}px`,
395
- transform: "translateY(-50%)",
396
- borderRadius: `${J.value}px`
397
- })
398
- }, [
399
- u.variant === "standard" ? (p(), s(n, { key: 0 }, [c("div", {
400
- class: "absolute",
401
- style: f({
402
- ...w.value ? {
403
- left: 0,
404
- right: 0,
405
- bottom: 0,
406
- height: Pe(k.value)
407
- } : {
408
- top: 0,
409
- bottom: 0,
410
- left: 0,
411
- width: Pe(k.value)
412
- },
413
- borderRadius: Y(),
414
- backgroundColor: R.value.active,
415
- transition: `all ${Q.value}`
416
- })
417
- }, null, 4), c("div", {
418
- class: "absolute",
419
- style: f({
420
- ...w.value ? {
421
- left: 0,
422
- right: 0,
423
- top: 0,
424
- height: Fe(k.value)
425
- } : {
426
- top: 0,
427
- bottom: 0,
428
- right: 0,
429
- width: Fe(k.value)
430
- },
431
- borderRadius: X(),
432
- backgroundColor: R.value.inactive,
433
- transition: `all ${Q.value}`
434
- })
435
- }, null, 4)], 64)) : u.variant === "centered" ? (p(), s(n, { key: 1 }, [
436
- c("div", {
437
- class: "absolute",
438
- style: f({
439
- ...w.value ? {
440
- left: 0,
441
- right: 0,
442
- bottom: Be(),
443
- height: Ve()
444
- } : {
445
- top: 0,
446
- bottom: 0,
447
- left: Be(),
448
- width: Ve()
449
- },
450
- borderRadius: Ge(),
451
- backgroundColor: R.value.active,
452
- transition: `all ${Q.value}`
453
- })
454
- }, null, 4),
455
- c("div", {
456
- class: "absolute",
457
- style: f({
458
- ...w.value ? {
459
- left: 0,
460
- right: 0,
461
- top: 0,
462
- height: He()
463
- } : {
464
- top: 0,
465
- bottom: 0,
466
- right: 0,
467
- width: He()
468
- },
469
- borderRadius: X(),
470
- backgroundColor: R.value.inactive,
471
- transition: `all ${Q.value}`
472
- })
473
- }, null, 4),
474
- c("div", {
475
- class: "absolute",
476
- style: f({
477
- ...w.value ? {
478
- left: 0,
479
- right: 0,
480
- bottom: 0,
481
- height: Ue()
482
- } : {
483
- top: 0,
484
- bottom: 0,
485
- left: 0,
486
- width: Ue()
487
- },
488
- borderRadius: Y(),
489
- backgroundColor: R.value.inactive,
490
- transition: `all ${Q.value}`
491
- })
492
- }, null, 4)
493
- ], 64)) : u.variant === "range" ? (p(), s(n, { key: 2 }, [
494
- c("div", {
495
- class: "absolute",
496
- style: f({
497
- ...w.value ? {
498
- left: 0,
499
- right: 0,
500
- bottom: 0,
501
- height: Ie()
502
- } : {
503
- top: 0,
504
- bottom: 0,
505
- left: 0,
506
- width: Ie()
507
- },
508
- borderRadius: Y(),
509
- backgroundColor: R.value.inactive,
510
- transition: `all ${Q.value}`
511
- })
512
- }, null, 4),
513
- c("div", {
514
- class: "absolute",
515
- style: f({
516
- ...w.value ? {
517
- left: 0,
518
- right: 0,
519
- bottom: Le(),
520
- height: Re()
521
- } : {
522
- top: 0,
523
- bottom: 0,
524
- left: Le(),
525
- width: Re()
526
- },
527
- borderRadius: Ge(),
528
- backgroundColor: R.value.active,
529
- transition: `all ${Q.value}`
530
- })
531
- }, null, 4),
532
- c("div", {
533
- class: "absolute",
534
- style: f({
535
- ...w.value ? {
536
- left: 0,
537
- right: 0,
538
- top: 0,
539
- height: ze()
540
- } : {
541
- top: 0,
542
- bottom: 0,
543
- right: 0,
544
- width: ze()
545
- },
546
- borderRadius: X(),
547
- backgroundColor: R.value.inactive,
548
- transition: `all ${Q.value}`
549
- })
550
- }, null, 4)
551
- ], 64)) : o("", !0),
552
- u.icon ? (p(), a(e, {
553
- key: 3,
554
- name: u.icon,
555
- size: I.value.iconSize,
556
- class: "absolute z-[1]",
557
- style: f({
558
- color: u.variant === "standard" && k.value > 0 || u.variant === "range" && k.value > 0 ? R.value.inactive : R.value.active,
559
- ...w.value ? {
560
- left: "50%",
561
- bottom: `${Ee.value}px`,
562
- transform: "translateX(-50%)"
563
- } : {
564
- top: "50%",
565
- left: `${Ee.value}px`,
566
- transform: "translateY(-50%)"
567
- },
568
- transition: "color 150ms ease"
569
- })
570
- }, null, 8, [
571
- "name",
572
- "size",
573
- "style"
574
- ])) : u.stops ? o("", !0) : (p(), s("div", {
575
- key: 4,
576
- class: "absolute rounded-full",
577
- style: f({
578
- width: `${I.value.dot}px`,
579
- height: `${I.value.dot}px`,
580
- backgroundColor: R.value.active,
581
- opacity: +!ye.value,
582
- ...w.value ? {
583
- left: "50%",
584
- bottom: `${I.value.dotInset}px`,
585
- transform: "translateX(-50%)"
586
- } : {
587
- top: "50%",
588
- left: `${I.value.dotInset}px`,
589
- transform: "translateY(-50%)"
590
- },
591
- transition: "opacity 150ms ease"
592
- })
593
- }, null, 4)),
594
- u.stops ? o("", !0) : (p(), s("div", {
595
- key: 5,
596
- class: "absolute rounded-full",
597
- style: f({
598
- width: `${I.value.dot}px`,
599
- height: `${I.value.dot}px`,
600
- backgroundColor: R.value.active,
601
- opacity: +!be.value,
602
- ...w.value ? {
603
- left: "50%",
604
- top: `${I.value.dotInset}px`,
605
- transform: "translateX(-50%)"
606
- } : {
607
- top: "50%",
608
- right: `${I.value.dotInset}px`,
609
- transform: "translateY(-50%)"
610
- },
611
- transition: "opacity 150ms ease"
612
- })
613
- }, null, 4)),
614
- u.stops ? (p(!0), s(n, { key: 6 }, ne(Ne.value, (e, t) => (p(), s("div", {
615
- key: t,
616
- class: "absolute rounded-full",
617
- style: f({
618
- width: `${I.value.dot}px`,
619
- height: `${I.value.dot}px`,
620
- backgroundColor: e <= k.value ? R.value.inactive : R.value.active,
621
- opacity: Math.abs(e - k.value) < .01 || T.value && Math.abs(e - A.value) < .01 ? 0 : 1,
622
- ...w.value ? {
623
- left: "50%",
624
- bottom: `${e}%`,
625
- transform: "translateX(-50%) translateY(50%)"
626
- } : {
627
- top: "50%",
628
- left: `${e}%`,
629
- transform: "translateX(-50%) translateY(-50%)"
630
- }
631
- })
632
- }, null, 4))), 128)) : o("", !0)
633
- ], 4),
634
- T.value ? (p(), s(n, { key: 1 }, ne([0, 1], (t) => c("div", {
635
- key: t,
636
- ref_for: !0,
637
- ref: (e) => {
638
- e && (me.value[t] = e);
639
- },
640
- role: "slider",
641
- tabindex: u.disabled ? -1 : 0,
642
- "aria-label": t === 0 ? re(pe).sliderRangeStart : re(pe).sliderRangeEnd,
643
- "aria-valuenow": t === 0 ? E.value.lo : E.value.hi,
644
- "aria-valuemin": t === 0 ? u.min : E.value.lo,
645
- "aria-valuemax": t === 0 ? E.value.hi : u.max,
646
- "aria-disabled": u.disabled || void 0,
647
- "aria-orientation": u.orientation,
648
- class: d(["pointer-events-none flex items-center justify-center rounded-full outline-none", S.value === t && "ring-2 ring-offset-2 ring-offset-surface"]),
649
- style: f(u.thumbIcon ? qe(t === 0 ? k.value : A.value) : Ke(t === 0 ? k.value : A.value, t)),
650
- onKeydown: (e) => Me(t, e),
651
- onFocus: (e) => ge(t),
652
- onBlur: _e
653
- }, [u.thumbIcon ? (p(), a(e, {
654
- key: 0,
655
- name: u.thumbIcon,
656
- size: I.value.thumbIconSize
657
- }, null, 8, ["name", "size"])) : o("", !0)], 46, le)), 64)) : (p(), s(n, { key: 0 }, [u.thumbIcon ? (p(), a(e, {
658
- key: 0,
659
- name: u.thumbIcon,
660
- size: I.value.thumbIconSize,
661
- class: "pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
662
- style: f(qe(k.value))
663
- }, null, 8, [
664
- "name",
665
- "size",
666
- "style"
667
- ])) : (p(), s("div", {
668
- key: 1,
669
- class: "pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface",
670
- style: f(Ke(k.value))
671
- }, null, 4))], 64)),
672
- l(r, {
673
- "enter-active-class": "transition-opacity duration-100",
674
- "enter-from-class": "opacity-0",
675
- "leave-active-class": "transition-opacity duration-75",
676
- "leave-to-class": "opacity-0"
677
- }, {
678
- default: ie(() => [u.showTooltip && y.value !== !1 ? (p(), s("div", {
679
- key: 0,
680
- class: "pointer-events-none absolute z-10 flex h-7 min-w-7 items-center justify-center rounded-full bg-inverse-surface px-2 text-label-small tabular-nums text-inverse-on-surface",
681
- style: f(Je(Ze.value))
682
- }, h(Xe.value), 5)) : o("", !0)]),
683
- _: 1
684
- })
685
- ], 46, ce)], 2)], 2));
686
- }
687
- });
688
- export { fe as t };
689
-
690
- //# sourceMappingURL=MSlider-BIkA6DiE.js.map