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