maz-ui 3.22.3 → 3.23.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 (243) hide show
  1. package/components/MazAvatar.mjs +2 -2
  2. package/components/MazBackdrop.mjs +67 -107
  3. package/components/MazBadge.mjs +41 -50
  4. package/components/MazBottomSheet.mjs +2 -2
  5. package/components/MazBtn.mjs +2 -2
  6. package/components/MazCard.mjs +2 -2
  7. package/components/MazCarousel.mjs +2 -2
  8. package/components/MazChart.mjs +53 -63
  9. package/components/MazCheckbox.mjs +84 -128
  10. package/components/MazDialog.mjs +2 -2
  11. package/components/MazDialogPromise.mjs +3 -3
  12. package/components/MazDrawer.mjs +2 -2
  13. package/components/MazDropdown.mjs +2 -2
  14. package/components/MazDropzone.mjs +2 -2
  15. package/components/MazFullscreenLoader.mjs +14 -18
  16. package/components/MazGallery.d.ts +41 -0
  17. package/components/MazGallery.mjs +370 -567
  18. package/components/MazIcon.mjs +76 -140
  19. package/components/MazInput.mjs +2 -2
  20. package/components/MazInputNumber.mjs +72 -99
  21. package/components/MazInputPrice.mjs +2 -2
  22. package/components/MazInputTags.mjs +2 -2
  23. package/components/MazLazyImg.mjs +2 -2
  24. package/components/MazPhoneNumberInput.mjs +2 -2
  25. package/components/MazPicker.mjs +2 -2
  26. package/components/MazRadio.mjs +65 -94
  27. package/components/MazRadioButtons.mjs +64 -78
  28. package/components/MazSelect.mjs +2 -2
  29. package/components/MazSlider.mjs +213 -325
  30. package/components/MazSpinner.mjs +25 -34
  31. package/components/MazStepper.mjs +2 -2
  32. package/components/MazSwitch.mjs +43 -60
  33. package/components/MazTabs.mjs +16 -25
  34. package/components/MazTabsBar.mjs +2 -2
  35. package/components/MazTabsContent.mjs +34 -43
  36. package/components/MazTabsContentItem.mjs +49 -63
  37. package/components/MazTextarea.mjs +124 -169
  38. package/components/MazTransitionExpand.mjs +36 -54
  39. package/components/assets/MazBackdrop.css +1 -1
  40. package/components/assets/MazBottomSheet.css +1 -1
  41. package/components/assets/MazDialog.css +1 -1
  42. package/components/assets/MazDialogPromise.css +1 -1
  43. package/components/assets/MazDrawer.css +1 -1
  44. package/components/assets/MazGallery.css +1 -1
  45. package/components/assets/MazPhoneNumberInput.css +1 -1
  46. package/components/assets/MazSelect.css +1 -1
  47. package/components/chunks/MazAvatar-1636f58b.mjs +126 -0
  48. package/components/chunks/MazBottomSheet-c24f92f8.mjs +217 -0
  49. package/components/chunks/MazBtn-124f3700.mjs +153 -0
  50. package/components/chunks/MazBtn-1e61862b.mjs +153 -0
  51. package/components/chunks/MazBtn-2d1d1ba5.mjs +153 -0
  52. package/components/chunks/MazBtn-3d74f737.mjs +153 -0
  53. package/components/chunks/MazBtn-4a447126.mjs +153 -0
  54. package/components/chunks/MazBtn-555928ed.mjs +153 -0
  55. package/components/chunks/MazBtn-571454f6.mjs +153 -0
  56. package/components/chunks/MazBtn-5e426592.mjs +153 -0
  57. package/components/chunks/MazBtn-6905cc39.mjs +153 -0
  58. package/components/chunks/MazBtn-6ce4cfd3.mjs +153 -0
  59. package/components/chunks/MazBtn-74656d5b.mjs +153 -0
  60. package/components/chunks/MazBtn-7706b2da.mjs +158 -0
  61. package/components/chunks/MazBtn-a7a913dd.mjs +153 -0
  62. package/components/chunks/MazBtn-ba27c61d.mjs +153 -0
  63. package/components/chunks/MazBtn-fb3c7af8.mjs +153 -0
  64. package/components/chunks/MazCard-bcc36489.mjs +214 -0
  65. package/components/chunks/MazCarousel-6da75122.mjs +107 -0
  66. package/components/chunks/MazCheckbox-040dc2c4.mjs +117 -0
  67. package/components/chunks/MazCheckbox-3a2b48b4.mjs +117 -0
  68. package/components/chunks/MazDialog-44eda544.mjs +250 -0
  69. package/components/chunks/MazDialogPromise-eec5acde.mjs +419 -0
  70. package/components/chunks/MazDrawer-b628b37e.mjs +206 -0
  71. package/components/chunks/MazDropdown-6f2248b0.mjs +345 -0
  72. package/components/chunks/MazDropzone-8cac10a6.mjs +242 -0
  73. package/components/chunks/MazGallery-6b8ecedf.mjs +617 -0
  74. package/components/chunks/MazIcon-52a76873.mjs +101 -0
  75. package/components/chunks/MazIcon-95e31ff8.mjs +96 -0
  76. package/components/chunks/MazInput-1ed4f946.mjs +283 -0
  77. package/components/chunks/MazInput-c51881ea.mjs +278 -0
  78. package/components/chunks/MazInput-e1373eaf.mjs +271 -0
  79. package/components/chunks/MazInputPrice-cd348d46.mjs +392 -0
  80. package/components/chunks/MazInputTags-aa95fae7.mjs +446 -0
  81. package/components/chunks/MazLazyImg-0412ab38.mjs +259 -0
  82. package/components/chunks/MazLazyImg-47d3449a.mjs +254 -0
  83. package/components/chunks/MazPhoneNumberInput-e1bf46f9.mjs +1216 -0
  84. package/components/chunks/MazPicker-c85774e5.mjs +1140 -0
  85. package/components/chunks/MazPickerCalendar-f5bbea58.mjs +532 -0
  86. package/components/chunks/MazPickerHeader-31a3619b.mjs +186 -0
  87. package/components/chunks/MazPickerMonthSwitcher-aaa759b9.mjs +97 -0
  88. package/components/chunks/MazPickerShortcuts-d0623e2d.mjs +74 -0
  89. package/components/chunks/MazPickerTime-de9cfc63.mjs +219 -0
  90. package/components/chunks/MazPickerYearSwitcher-746c84fc.mjs +106 -0
  91. package/components/chunks/MazSelect-6ff6bb96.mjs +652 -0
  92. package/components/chunks/MazSpinner-054f948c.mjs +39 -0
  93. package/components/chunks/MazSpinner-059ee1d2.mjs +39 -0
  94. package/components/chunks/MazSpinner-08ee440b.mjs +39 -0
  95. package/components/chunks/MazSpinner-13403729.mjs +39 -0
  96. package/components/chunks/MazSpinner-44011019.mjs +39 -0
  97. package/components/chunks/MazSpinner-452a1534.mjs +39 -0
  98. package/components/chunks/MazSpinner-4c02cfd2.mjs +39 -0
  99. package/components/chunks/MazSpinner-6d1d24d5.mjs +39 -0
  100. package/components/chunks/MazSpinner-6e7c4705.mjs +39 -0
  101. package/components/chunks/MazSpinner-7895f54f.mjs +39 -0
  102. package/components/chunks/MazSpinner-7eee202e.mjs +39 -0
  103. package/components/chunks/MazSpinner-805e14a6.mjs +39 -0
  104. package/components/chunks/MazSpinner-85080b43.mjs +39 -0
  105. package/components/chunks/MazSpinner-a13a50c9.mjs +39 -0
  106. package/components/chunks/MazSpinner-a6d61cee.mjs +43 -0
  107. package/components/chunks/MazSpinner-b065168a.mjs +39 -0
  108. package/components/chunks/MazSpinner-c67b05bb.mjs +39 -0
  109. package/components/chunks/MazSpinner-caa33afc.mjs +39 -0
  110. package/components/chunks/MazSpinner-cb8fbe9a.mjs +39 -0
  111. package/components/chunks/MazSpinner-d9ef329f.mjs +39 -0
  112. package/components/chunks/MazStepper-39f018f3.mjs +191 -0
  113. package/components/chunks/MazTabsBar-27965f16.mjs +132 -0
  114. package/components/chunks/MazTransitionExpand-55cfbecb.mjs +41 -0
  115. package/components/chunks/MazTransitionExpand-cd24498f.mjs +41 -0
  116. package/components/chunks/_plugin-vue_export-helper-dad06003.mjs +9 -0
  117. package/components/chunks/check-31d7ba2f.mjs +30 -0
  118. package/components/chunks/check-c9b483c0.mjs +30 -0
  119. package/components/chunks/{check-circle-7acfa4c4.mjs → check-circle-59c383ed.mjs} +10 -12
  120. package/components/chunks/chevron-down-2b60111a.mjs +30 -0
  121. package/components/chunks/chevron-left-39b4621e.mjs +30 -0
  122. package/components/chunks/chevron-right-949a60fa.mjs +30 -0
  123. package/components/chunks/debounce-19c516b6.mjs +11 -0
  124. package/components/chunks/examples.mobile.json-f63d22fb.mjs +4 -0
  125. package/components/chunks/{exclamation-circle-2e115536.mjs → exclamation-circle-e2620aab.mjs} +10 -12
  126. package/components/chunks/{exclamation-triangle-10eb48dc.mjs → exclamation-triangle-21bf116a.mjs} +10 -12
  127. package/components/chunks/{eye-fbb13657.mjs → eye-dc12ce09.mjs} +12 -15
  128. package/components/chunks/{eye-slash-342420ff.mjs → eye-slash-fa42a017.mjs} +10 -12
  129. package/components/chunks/{magnifying-glass-5dffa35e.mjs → magnifying-glass-908981c0.mjs} +10 -12
  130. package/components/chunks/minus-e71140e1.mjs +30 -0
  131. package/components/chunks/no-photography-4c6c77cf.mjs +4 -0
  132. package/components/chunks/{no-photography-b0d08d6f.mjs → no-photography-be94ddda.mjs} +12 -15
  133. package/components/chunks/{no-symbol-975ce547.mjs → no-symbol-87477ad0.mjs} +10 -12
  134. package/components/chunks/{pencil-2f766dc8.mjs → pencil-4c35b4e7.mjs} +10 -12
  135. package/components/chunks/plus-c20544c3.mjs +30 -0
  136. package/components/chunks/x-mark-35f2f1e7.mjs +30 -0
  137. package/components/chunks/x-mark-7761acf4.mjs +29 -0
  138. package/modules/chunks/MazBtn-82a868df.mjs +153 -0
  139. package/modules/chunks/MazIcon-169747b4.mjs +96 -0
  140. package/modules/chunks/MazSpinner-3febbfdc.mjs +39 -0
  141. package/modules/chunks/{arrow-top-right-on-square-32bbe5a1.mjs → arrow-top-right-on-square-15191934.mjs} +10 -12
  142. package/modules/chunks/chevron-left-39b4621e.mjs +30 -0
  143. package/modules/chunks/index-d9a25303.mjs +1628 -0
  144. package/modules/chunks/{link-4eb05848.mjs → link-bb14441d.mjs} +10 -12
  145. package/modules/chunks/no-photography-4c6c77cf.mjs +4 -0
  146. package/modules/chunks/x-mark-35f2f1e7.mjs +30 -0
  147. package/modules/index.mjs +45 -44
  148. package/nuxt/index.json +1 -1
  149. package/nuxt/types.d.mts +3 -2
  150. package/nuxt/types.d.ts +3 -2
  151. package/package.json +11 -7
  152. package/types/components/MazGallery.vue.d.ts +41 -0
  153. package/types/modules/index.d.ts +1 -0
  154. package/types/modules/resolvers/index.d.ts +2 -0
  155. package/components/chunks/MazAvatar-358d78d4.mjs +0 -138
  156. package/components/chunks/MazBottomSheet-61090f4a.mjs +0 -267
  157. package/components/chunks/MazBtn-0e02f0da.mjs +0 -184
  158. package/components/chunks/MazBtn-2f4fa942.mjs +0 -184
  159. package/components/chunks/MazBtn-31c6b731.mjs +0 -184
  160. package/components/chunks/MazBtn-48382169.mjs +0 -184
  161. package/components/chunks/MazBtn-4e1e116e.mjs +0 -184
  162. package/components/chunks/MazBtn-50abc4c5.mjs +0 -184
  163. package/components/chunks/MazBtn-84e12b6a.mjs +0 -184
  164. package/components/chunks/MazBtn-b42e3575.mjs +0 -184
  165. package/components/chunks/MazBtn-b56a7278.mjs +0 -184
  166. package/components/chunks/MazBtn-bbd6e9c8.mjs +0 -184
  167. package/components/chunks/MazBtn-cf0c8fcb.mjs +0 -184
  168. package/components/chunks/MazBtn-d92908b2.mjs +0 -191
  169. package/components/chunks/MazBtn-f48da79c.mjs +0 -184
  170. package/components/chunks/MazBtn-f7e94b59.mjs +0 -184
  171. package/components/chunks/MazBtn-fec4c3b7.mjs +0 -184
  172. package/components/chunks/MazCard-01b81dd2.mjs +0 -237
  173. package/components/chunks/MazCarousel-7825c7c9.mjs +0 -133
  174. package/components/chunks/MazCheckbox-ab5ddda2.mjs +0 -153
  175. package/components/chunks/MazCheckbox-e0bbe6ec.mjs +0 -153
  176. package/components/chunks/MazDialog-83e54b8c.mjs +0 -290
  177. package/components/chunks/MazDialogPromise-6967e821.mjs +0 -474
  178. package/components/chunks/MazDrawer-d778b3d2.mjs +0 -256
  179. package/components/chunks/MazDropdown-6f4482d7.mjs +0 -426
  180. package/components/chunks/MazDropzone-d1bb62dc.mjs +0 -325
  181. package/components/chunks/MazGallery-a8f6748b.mjs +0 -812
  182. package/components/chunks/MazIcon-b779da0a.mjs +0 -159
  183. package/components/chunks/MazIcon-bda198b4.mjs +0 -165
  184. package/components/chunks/MazInput-713b00d0.mjs +0 -326
  185. package/components/chunks/MazInput-b9386887.mjs +0 -341
  186. package/components/chunks/MazInput-c33627dd.mjs +0 -334
  187. package/components/chunks/MazInputPrice-452297f5.mjs +0 -481
  188. package/components/chunks/MazInputTags-7a463b81.mjs +0 -526
  189. package/components/chunks/MazLazyImg-6e395356.mjs +0 -336
  190. package/components/chunks/MazLazyImg-e0d8b6d0.mjs +0 -329
  191. package/components/chunks/MazPhoneNumberInput-48fe2445.mjs +0 -1536
  192. package/components/chunks/MazPicker-50fc11d1.mjs +0 -1352
  193. package/components/chunks/MazPickerCalendar-cacb361c.mjs +0 -689
  194. package/components/chunks/MazPickerHeader-63d45179.mjs +0 -216
  195. package/components/chunks/MazPickerMonthSwitcher-913c6e2c.mjs +0 -110
  196. package/components/chunks/MazPickerShortcuts-c6fabfc6.mjs +0 -88
  197. package/components/chunks/MazPickerTime-5e4475da.mjs +0 -301
  198. package/components/chunks/MazPickerYearSwitcher-dd4fa89c.mjs +0 -125
  199. package/components/chunks/MazSelect-2e5cd411.mjs +0 -850
  200. package/components/chunks/MazSpinner-022d7bee.mjs +0 -46
  201. package/components/chunks/MazSpinner-100c99b8.mjs +0 -46
  202. package/components/chunks/MazSpinner-191ad23b.mjs +0 -46
  203. package/components/chunks/MazSpinner-3155378b.mjs +0 -46
  204. package/components/chunks/MazSpinner-339a9006.mjs +0 -46
  205. package/components/chunks/MazSpinner-53979e96.mjs +0 -46
  206. package/components/chunks/MazSpinner-68d2f2ac.mjs +0 -46
  207. package/components/chunks/MazSpinner-6b563b22.mjs +0 -46
  208. package/components/chunks/MazSpinner-7cdc13e7.mjs +0 -46
  209. package/components/chunks/MazSpinner-8859d658.mjs +0 -46
  210. package/components/chunks/MazSpinner-8e180605.mjs +0 -52
  211. package/components/chunks/MazSpinner-98dd1f9d.mjs +0 -46
  212. package/components/chunks/MazSpinner-9950424b.mjs +0 -46
  213. package/components/chunks/MazSpinner-c8270a93.mjs +0 -46
  214. package/components/chunks/MazSpinner-cb491238.mjs +0 -46
  215. package/components/chunks/MazSpinner-cb6f99f3.mjs +0 -46
  216. package/components/chunks/MazSpinner-ce4be8f1.mjs +0 -46
  217. package/components/chunks/MazSpinner-e5a9f319.mjs +0 -46
  218. package/components/chunks/MazSpinner-e92bd359.mjs +0 -46
  219. package/components/chunks/MazSpinner-eea9056d.mjs +0 -46
  220. package/components/chunks/MazStepper-4c19dbfc.mjs +0 -255
  221. package/components/chunks/MazTabsBar-3c2e2d69.mjs +0 -157
  222. package/components/chunks/MazTransitionExpand-f293b830.mjs +0 -57
  223. package/components/chunks/MazTransitionExpand-f9e5a2d6.mjs +0 -57
  224. package/components/chunks/_plugin-vue_export-helper-cc2b3d55.mjs +0 -10
  225. package/components/chunks/check-8da249b1.mjs +0 -32
  226. package/components/chunks/check-f2fcce10.mjs +0 -32
  227. package/components/chunks/chevron-down-a78b9604.mjs +0 -32
  228. package/components/chunks/chevron-left-3365d59b.mjs +0 -32
  229. package/components/chunks/chevron-right-02f9e837.mjs +0 -32
  230. package/components/chunks/debounce-7d66ffa9.mjs +0 -12
  231. package/components/chunks/examples.mobile.json-618ba782.mjs +0 -4
  232. package/components/chunks/minus-c9cdee90.mjs +0 -32
  233. package/components/chunks/no-photography-7f2be516.mjs +0 -4
  234. package/components/chunks/plus-b1b0a5a8.mjs +0 -32
  235. package/components/chunks/x-mark-3b05101b.mjs +0 -31
  236. package/components/chunks/x-mark-c6ff45dd.mjs +0 -32
  237. package/modules/chunks/MazBtn-90ffd148.mjs +0 -184
  238. package/modules/chunks/MazIcon-988edef7.mjs +0 -159
  239. package/modules/chunks/MazSpinner-a16a3d8f.mjs +0 -46
  240. package/modules/chunks/chevron-left-3365d59b.mjs +0 -32
  241. package/modules/chunks/index-b1625fc2.mjs +0 -2315
  242. package/modules/chunks/no-photography-7f2be516.mjs +0 -4
  243. package/modules/chunks/x-mark-c6ff45dd.mjs +0 -32
@@ -1,57 +1,39 @@
1
1
  import "./assets/MazSlider.css";
2
- import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, nextTick, openBlock, createElementBlock, Fragment, createCommentVNode, createElementVNode, normalizeStyle, normalizeClass, renderList, toDisplayString } from "vue";
3
- function debounce(fn, delay) {
4
- let timeout;
5
- return function(...args) {
6
- clearTimeout(timeout);
7
- timeout = setTimeout(() => {
8
- fn.apply(this, args);
9
- }, delay);
2
+ import { defineComponent as te, ref as y, computed as f, watch as F, onMounted as ne, onBeforeUnmount as oe, nextTick as g, openBlock as b, createElementBlock as w, Fragment as V, createCommentVNode as ae, createElementVNode as T, normalizeStyle as B, normalizeClass as j, renderList as K, toDisplayString as se } from "vue";
3
+ function le(a, l) {
4
+ let n;
5
+ return function(...c) {
6
+ clearTimeout(n), n = setTimeout(() => {
7
+ a.apply(this, c);
8
+ }, l);
10
9
  };
11
10
  }
12
- const getOffset = (elem) => {
13
- const doc = document.documentElement;
14
- const body = document.body;
15
- const rect = elem.getBoundingClientRect();
16
- const offset = {
17
- y: rect.top + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || body.clientTop || 0),
18
- x: rect.left + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || body.clientLeft || 0)
11
+ const ue = (a) => {
12
+ const l = document.documentElement, n = document.body, c = a.getBoundingClientRect();
13
+ return {
14
+ y: c.top + (window.pageYOffset || l.scrollTop) - (l.clientTop || n.clientTop || 0),
15
+ x: c.left + (window.pageXOffset || l.scrollLeft) - (l.clientLeft || n.clientLeft || 0)
19
16
  };
20
- return offset;
21
- };
22
- const getPos = (e, elem, isReverse = false) => {
23
- const event = "targetTouches" in e ? e.targetTouches[0] : e;
24
- const offset = getOffset(elem);
25
- const posObj = {
26
- x: event.pageX - offset.x,
27
- y: event.pageY - offset.y
17
+ }, re = (a, l, n = !1) => {
18
+ const c = "targetTouches" in a ? a.targetTouches[0] : a, v = ue(l), i = {
19
+ x: c.pageX - v.x,
20
+ y: c.pageY - v.y
28
21
  };
29
22
  return {
30
- x: isReverse ? elem.offsetWidth - posObj.x : posObj.x,
31
- y: isReverse ? elem.offsetHeight - posObj.y : posObj.y
23
+ x: n ? l.offsetWidth - i.x : i.x,
24
+ y: n ? l.offsetHeight - i.y : i.y
32
25
  };
33
- };
34
- const isBetween = (value, prev, next, direction) => {
35
- return direction === "minus" ? prev ? value >= prev : true : next ? value <= next : true;
36
- };
37
- const getOpacityCoeff = (index, middle, length) => {
38
- const currentIndex = index + 1;
39
- const isBiggerThanMiddle = middle < currentIndex;
40
- const deviation = isBiggerThanMiddle ? currentIndex - middle : middle - currentIndex;
41
- return 100 / length * deviation / 100;
42
- };
43
- const _hoisted_1 = ["aria-valuenow", "aria-valuemin", "aria-valuemax"];
44
- const _hoisted_2 = ["data-label", "onMousedownPassive", "onTouchstartPassive", "onFocusPassive", "onBlurPassive", "onTouchendPassive", "onKeydownPassive"];
45
- const _sfc_main = /* @__PURE__ */ defineComponent({
26
+ }, q = (a, l, n, c) => c === "minus" ? l ? a >= l : !0 : n ? a <= n : !0, I = (a, l, n) => {
27
+ const c = a + 1, i = l < c ? c - l : l - c;
28
+ return 100 / n * i / 100;
29
+ }, ie = ["aria-valuenow", "aria-valuemin", "aria-valuemax"], ce = ["data-label", "onMousedownPassive", "onTouchstartPassive", "onFocusPassive", "onBlurPassive", "onTouchendPassive", "onKeydownPassive"], de = /* @__PURE__ */ te({
46
30
  __name: "MazSlider",
47
31
  props: {
48
32
  // Array of cursors values
49
33
  modelValue: {
50
34
  type: [Number, Array],
51
- required: true,
52
- validator: (value) => {
53
- return ["number"].includes(typeof value) || Array.isArray(value) || value === null;
54
- }
35
+ required: !0,
36
+ validator: (a) => ["number"].includes(typeof a) || Array.isArray(a) || a === null
55
37
  },
56
38
  // array of cursors label
57
39
  labels: { type: Array, default: void 0 },
@@ -62,319 +44,225 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
62
44
  // height size of slider bar
63
45
  size: { type: String, default: void 0 },
64
46
  // remove div in different colors
65
- noDivider: { type: Boolean, default: false },
47
+ noDivider: { type: Boolean, default: !1 },
66
48
  // become a logarithmic slider (exponential)
67
- log: { type: Boolean, default: false },
49
+ log: { type: Boolean, default: !1 },
68
50
  // main slider color
69
51
  color: {
70
52
  type: String,
71
53
  default: "primary"
72
54
  },
73
55
  // disables cursor animation when active
74
- noCursorAnim: { type: Boolean, default: false }
56
+ noCursorAnim: { type: Boolean, default: !1 }
75
57
  },
76
58
  emits: ["update:model-value"],
77
- setup(__props, { emit: __emit }) {
78
- const props = __props;
79
- const emits = __emit;
80
- const MazSlider2 = ref();
81
- const activeCursor = ref();
82
- const buttonPositions = ref();
83
- const tmpValues = ref();
84
- const buttonStyles = ref([]);
85
- const dividers = ref([]);
86
- const computedValue = computed(() => {
87
- if (typeof props.modelValue === "number") {
88
- return [props.modelValue];
89
- } else if (props.modelValue) {
90
- return props.modelValue;
91
- } else {
92
- return [0];
93
- }
94
- });
95
- const minLog = computed(() => {
96
- return Math.log(props.min || 1);
97
- });
98
- const maxLog = computed(() => {
99
- return Math.log(props.max);
100
- });
101
- const scale = computed(() => {
102
- const { min, max } = props;
103
- return (maxLog.value - minLog.value) / (max - min);
104
- });
105
- const range = computed(() => {
106
- const { min, max } = props;
107
- return max - min;
108
- });
109
- const wrapperStyle = computed(() => {
110
- return {
111
- paddingTop: props.labels ? `2.5em` : `1em`
112
- };
113
- });
114
- const hasMultipleValues = computed(() => Array.isArray(props.modelValue));
115
- watch(
116
- () => props.modelValue,
117
- () => tmpValues.value = computedValue.value,
118
- { immediate: true }
59
+ setup(a, { emit: l }) {
60
+ const n = a, c = l, v = y(), i = y(), m = y(), d = y(), C = y([]), k = y([]), p = f(() => typeof n.modelValue == "number" ? [n.modelValue] : n.modelValue ? n.modelValue : [0]), M = f(() => Math.log(n.min || 1)), X = f(() => Math.log(n.max)), L = f(() => {
61
+ const { min: e, max: t } = n;
62
+ return (X.value - M.value) / (t - e);
63
+ }), A = f(() => {
64
+ const { min: e, max: t } = n;
65
+ return t - e;
66
+ }), Y = f(() => ({
67
+ paddingTop: n.labels ? "2.5em" : "1em"
68
+ })), H = f(() => Array.isArray(n.modelValue));
69
+ F(
70
+ () => n.modelValue,
71
+ () => d.value = p.value,
72
+ { immediate: !0 }
73
+ ), F(
74
+ () => [p.value, n.min, n.max, n.log].join(","),
75
+ () => _(!0)
119
76
  );
120
- watch(
121
- () => [computedValue.value, props.min, props.max, props.log].join(","),
122
- () => buildComponent(true)
123
- );
124
- const resizeListenerFunction = debounce(() => buildComponent(), 300);
125
- onMounted(() => {
126
- buildComponent(true);
127
- window.addEventListener("resize", resizeListenerFunction);
128
- });
129
- onBeforeUnmount(() => {
130
- window.removeEventListener("resize", resizeListenerFunction);
77
+ const $ = le(() => _(), 300);
78
+ ne(() => {
79
+ _(!0), window.addEventListener("resize", $);
80
+ }), oe(() => {
81
+ window.removeEventListener("resize", $);
131
82
  });
132
- const buildComponent = async (emitValue2) => {
133
- if (emitValue2 === true)
134
- checkValues();
135
- await calcPos();
136
- await nextTick();
137
- for (const [index, _value] of computedValue.value.entries()) {
138
- setBtnDividers(index);
139
- }
140
- };
141
- const cursorKeyDown = (event, i) => {
142
- if (event.key === "ArrowLeft") {
143
- if (tmpValues.value && isBetween(tmpValues.value[i] - 1, tmpValues.value[i - 1], tmpValues.value[i + 1], "minus")) {
144
- tmpValues.value[i]--;
145
- emitValue(tmpValues.value);
146
- }
147
- } else if (event.key === "ArrowRight" && tmpValues.value && isBetween(tmpValues.value[i] + 1, tmpValues.value[i - 1], tmpValues.value[i + 1], "plus")) {
148
- tmpValues.value[i]++;
149
- emitValue(tmpValues.value);
150
- }
151
- };
152
- const blurCursor = (i) => {
153
- activeCursor.value = void 0;
154
- setBtnStyle(i);
155
- };
156
- const checkValues = () => {
157
- const { min, max } = props;
158
- const valuesChecked = computedValue.value.map(
159
- (v) => v < min ? min : v > max ? max : v
83
+ const _ = async (e) => {
84
+ e === !0 && U(), await Q(), await g();
85
+ for (const [t, u] of p.value.entries())
86
+ z(t);
87
+ }, R = (e, t) => {
88
+ e.key === "ArrowLeft" ? d.value && q(d.value[t] - 1, d.value[t - 1], d.value[t + 1], "minus") && (d.value[t]--, x(d.value)) : e.key === "ArrowRight" && d.value && q(d.value[t] + 1, d.value[t - 1], d.value[t + 1], "plus") && (d.value[t]++, x(d.value));
89
+ }, W = (e) => {
90
+ i.value = void 0, D(e);
91
+ }, U = () => {
92
+ const { min: e, max: t } = n, u = p.value.map(
93
+ (o) => o < e ? e : o > t ? t : o
160
94
  );
161
- emitValue(valuesChecked);
162
- tmpValues.value = valuesChecked;
163
- };
164
- const emitValue = (values) => {
165
- const valueToEmit = hasMultipleValues.value ? [...values] : values[0];
166
- emits("update:model-value", valueToEmit);
167
- };
168
- const getLabel = (i) => {
169
- const { labels } = props;
170
- return labels ? labels[i] : void 0;
171
- };
172
- const setBtnDividers = (i) => {
173
- setBtnStyle(i);
174
- if (!props.noDivider)
175
- setDividers();
176
- };
177
- const setBtnStyle = async (i) => {
178
- var _a;
179
- await nextTick();
180
- const currentCursor = document.querySelectorAll(".m-slider .m-slider__btn");
181
- if (currentCursor) {
182
- const cursor = currentCursor[i];
183
- const width = (cursor == null ? void 0 : cursor.clientWidth) + 16;
184
- const btnStyle = {
185
- left: typeof ((_a = buttonPositions.value) == null ? void 0 : _a[i]) === "number" ? `${buttonPositions.value[i] - width / 2}px` : ""
95
+ x(u), d.value = u;
96
+ }, x = (e) => {
97
+ const t = H.value ? [...e] : e[0];
98
+ c("update:model-value", t);
99
+ }, G = (e) => {
100
+ const { labels: t } = n;
101
+ return t ? t[e] : void 0;
102
+ }, z = (e) => {
103
+ D(e), n.noDivider || J();
104
+ }, D = async (e) => {
105
+ var u;
106
+ await g();
107
+ const t = document.querySelectorAll(".m-slider .m-slider__btn");
108
+ if (t) {
109
+ const o = t[e], s = (o == null ? void 0 : o.clientWidth) + 16, r = {
110
+ left: typeof ((u = m.value) == null ? void 0 : u[e]) == "number" ? `${m.value[e] - s / 2}px` : ""
186
111
  };
187
- buttonStyles.value[i] = btnStyle;
112
+ C.value[e] = r;
188
113
  }
189
- };
190
- const setDividers = () => {
191
- if (buttonPositions.value) {
192
- const base = [...buttonPositions.value];
193
- base.push(0);
194
- const baseLength = base.length;
195
- const middle = Math.round(baseLength / 2);
196
- dividers.value = base.map((pos, i) => ({
197
- left: `${i === 0 ? 0 : base[i - 1]}px`,
114
+ }, J = () => {
115
+ if (m.value) {
116
+ const e = [...m.value];
117
+ e.push(0);
118
+ const t = e.length, u = Math.round(t / 2);
119
+ k.value = e.map((o, s) => ({
120
+ left: `${s === 0 ? 0 : e[s - 1]}px`,
198
121
  // ATTENTION: buttonPositions.value[i - 1]
199
- right: `${i + 1 === baseLength ? 0 : "calc( 100% - " + pos + "px )"}`,
200
- backgroundColor: middle === i + 1 ? void 0 : i < middle ? (
122
+ right: `${s + 1 === t ? 0 : "calc( 100% - " + o + "px )"}`,
123
+ backgroundColor: u === s + 1 ? void 0 : s < u ? (
201
124
  // ligthen
202
- `rgba(255, 255, 255, ${getOpacityCoeff(i, middle, baseLength)})`
125
+ `rgba(255, 255, 255, ${I(s, u, t)})`
203
126
  ) : (
204
127
  // darken
205
- `rgba(0, 0, 0, ${getOpacityCoeff(i, middle, baseLength)})`
128
+ `rgba(0, 0, 0, ${I(s, u, t)})`
206
129
  )
207
130
  }));
208
131
  }
209
- };
210
- const calcPos = async () => {
211
- var _a, _b;
212
- await nextTick();
213
- const { min, max, log } = props;
214
- const barWidth = (_a = MazSlider2.value) == null ? void 0 : _a.clientWidth;
215
- if (barWidth) {
216
- buttonPositions.value = (_b = tmpValues.value) == null ? void 0 : _b.map(
217
- (v) => log ? barWidth / max * (min + (Math.log(v) - minLog.value) / scale.value) : barWidth / range.value * (v - min)
132
+ }, Q = async () => {
133
+ var s, r;
134
+ await g();
135
+ const { min: e, max: t, log: u } = n, o = (s = v.value) == null ? void 0 : s.clientWidth;
136
+ o ? m.value = (r = d.value) == null ? void 0 : r.map(
137
+ (h) => u ? o / t * (e + (Math.log(h) - M.value) / L.value) : o / A.value * (h - e)
138
+ ) : console.warn("[maz-ui][MazSlider] ref component not found");
139
+ }, E = async () => {
140
+ var s, r, h;
141
+ await g();
142
+ const { max: e, min: t, log: u } = n, o = (s = v.value) == null ? void 0 : s.clientWidth;
143
+ if (o)
144
+ return u ? (r = m.value) == null ? void 0 : r.map((P) => {
145
+ const Z = P / (o / e), ee = Math.exp((Z - t) * L.value + M.value);
146
+ return Math.round(ee);
147
+ }) : (h = m.value) == null ? void 0 : h.map(
148
+ (P) => Math.round(P / (o / A.value)) + t
218
149
  );
219
- } else {
220
- console.warn("[maz-ui][MazSlider] ref component not found");
221
- }
222
- };
223
- const getCursorsValues = async () => {
224
- var _a, _b, _c;
225
- await nextTick();
226
- const { max, min, log } = props;
227
- const barWidth = (_a = MazSlider2.value) == null ? void 0 : _a.clientWidth;
228
- if (barWidth) {
229
- return log ? (_b = buttonPositions.value) == null ? void 0 : _b.map((pos) => {
230
- const position = pos / (barWidth / max);
231
- const value = Math.exp((position - min) * scale.value + minLog.value);
232
- return Math.round(value);
233
- }) : (_c = buttonPositions.value) == null ? void 0 : _c.map(
234
- (pos) => Math.round(pos / (barWidth / range.value)) + min
235
- );
236
- } else {
237
- console.warn("[maz-ui][MazSlider] ref component not found");
238
- }
239
- };
240
- const handleMousedown = (_event, i) => {
241
- if (activeCursor.value !== void 0)
150
+ console.warn("[maz-ui][MazSlider] ref component not found");
151
+ }, S = (e, t) => {
152
+ i.value === void 0 && (i.value = t, z(t));
153
+ }, O = async () => {
154
+ if (i.value === void 0)
242
155
  return;
243
- activeCursor.value = i;
244
- setBtnDividers(i);
245
- };
246
- const handleMouseup = async () => {
247
- if (activeCursor.value === void 0)
156
+ const e = await E();
157
+ e && x(e), i.value = void 0;
158
+ }, N = async (e) => {
159
+ var u;
160
+ if (await g(), i.value === void 0)
248
161
  return;
249
- const values = await getCursorsValues();
250
- if (values)
251
- emitValue(values);
252
- activeCursor.value = void 0;
253
- };
254
- const handleMousemove = async (event) => {
255
- var _a;
256
- await nextTick();
257
- if (activeCursor.value === void 0)
258
- return;
259
- const barWidth = (_a = MazSlider2.value) == null ? void 0 : _a.clientWidth;
260
- if (buttonPositions.value) {
261
- const prevValue = buttonPositions.value[activeCursor.value - 1] || 0;
262
- const nextValue = buttonPositions.value[activeCursor.value + 1] || barWidth;
263
- if (!MazSlider2.value)
162
+ const t = (u = v.value) == null ? void 0 : u.clientWidth;
163
+ if (m.value) {
164
+ const o = m.value[i.value - 1] || 0, s = m.value[i.value + 1] || t;
165
+ if (!v.value)
264
166
  return console.error("[maz-ui](MazSlider/handleMousemove) MazSlider not available");
265
- buttonPositions.value[activeCursor.value] = (() => {
266
- const movement = getPos(event, MazSlider2.value).x;
267
- if (movement < prevValue) {
268
- return prevValue;
269
- } else if (nextValue && movement > nextValue) {
270
- return nextValue;
271
- }
272
- return movement;
273
- })();
274
- tmpValues.value = await getCursorsValues();
275
- setBtnDividers(activeCursor.value);
167
+ m.value[i.value] = (() => {
168
+ const r = re(e, v.value).x;
169
+ return r < o ? o : s && r > s ? s : r;
170
+ })(), d.value = await E(), z(i.value);
276
171
  }
277
172
  };
278
- return (_ctx, _cache) => {
279
- return openBlock(), createElementBlock(
280
- Fragment,
281
- null,
282
- [
283
- createCommentVNode(" eslint-disable vuejs-accessibility/mouse-events-have-key-events "),
284
- createElementVNode(
285
- "div",
286
- {
287
- style: normalizeStyle([wrapperStyle.value, { fontSize: __props.size }]),
288
- class: normalizeClass(["m-slider", [`m-slider--${__props.color}`]]),
289
- role: "button",
290
- tabindex: "-1",
291
- onMousemovePassive: handleMousemove,
292
- onMouseupPassive: handleMouseup,
293
- onMouseleavePassive: handleMouseup,
294
- onTouchmovePassive: handleMousemove
295
- },
296
- [
297
- createElementVNode("div", {
298
- ref_key: "MazSlider",
299
- ref: MazSlider2,
300
- class: "m-slider__bar",
301
- role: "slider",
302
- "aria-valuenow": __props.modelValue.toString(),
303
- "aria-valuemin": __props.min,
304
- "aria-valuemax": __props.max
305
- }, [
306
- (openBlock(true), createElementBlock(
307
- Fragment,
173
+ return (e, t) => (b(), w(
174
+ V,
175
+ null,
176
+ [
177
+ ae(" eslint-disable vuejs-accessibility/mouse-events-have-key-events "),
178
+ T(
179
+ "div",
180
+ {
181
+ style: B([Y.value, { fontSize: a.size }]),
182
+ class: j(["m-slider", [`m-slider--${a.color}`]]),
183
+ role: "button",
184
+ tabindex: "-1",
185
+ onMousemovePassive: N,
186
+ onMouseupPassive: O,
187
+ onMouseleavePassive: O,
188
+ onTouchmovePassive: N
189
+ },
190
+ [
191
+ T("div", {
192
+ ref_key: "MazSlider",
193
+ ref: v,
194
+ class: "m-slider__bar",
195
+ role: "slider",
196
+ "aria-valuenow": a.modelValue.toString(),
197
+ "aria-valuemin": a.min,
198
+ "aria-valuemax": a.max
199
+ }, [
200
+ (b(!0), w(
201
+ V,
202
+ null,
203
+ K(k.value, (u, o) => (b(), w(
204
+ "div",
205
+ {
206
+ key: `divider-${o}`,
207
+ style: B([u]),
208
+ class: "m-slider__divider"
209
+ },
308
210
  null,
309
- renderList(dividers.value, (div, i) => {
310
- return openBlock(), createElementBlock(
311
- "div",
312
- {
313
- key: `divider-${i}`,
314
- style: normalizeStyle([div]),
315
- class: "m-slider__divider"
316
- },
211
+ 4
212
+ /* STYLE */
213
+ ))),
214
+ 128
215
+ /* KEYED_FRAGMENT */
216
+ )),
217
+ (b(!0), w(
218
+ V,
219
+ null,
220
+ K(p.value, (u, o) => {
221
+ var s;
222
+ return b(), w("button", {
223
+ key: `cursor-${o}`,
224
+ type: "button",
225
+ "data-label": G(o),
226
+ class: j(["m-slider__btn", {
227
+ "active-cursor": o === i.value && !a.noCursorAnim
228
+ }]),
229
+ style: B([C.value[o]]),
230
+ onMousedownPassive: (r) => S(r, o),
231
+ onTouchstartPassive: (r) => S(r, o),
232
+ onFocusPassive: (r) => S(r, o),
233
+ onBlurPassive: (r) => W(o),
234
+ onTouchendPassive: (r) => W(o),
235
+ onKeydownPassive: (r) => R(r, o)
236
+ }, [
237
+ T(
238
+ "span",
317
239
  null,
318
- 4
319
- /* STYLE */
320
- );
321
- }),
322
- 128
323
- /* KEYED_FRAGMENT */
324
- )),
325
- (openBlock(true), createElementBlock(
326
- Fragment,
327
- null,
328
- renderList(computedValue.value, (_btn, i) => {
329
- var _a;
330
- return openBlock(), createElementBlock("button", {
331
- key: `cursor-${i}`,
332
- type: "button",
333
- "data-label": getLabel(i),
334
- class: normalizeClass(["m-slider__btn", {
335
- "active-cursor": i === activeCursor.value && !__props.noCursorAnim
336
- }]),
337
- style: normalizeStyle([buttonStyles.value[i]]),
338
- onMousedownPassive: ($event) => handleMousedown($event, i),
339
- onTouchstartPassive: ($event) => handleMousedown($event, i),
340
- onFocusPassive: ($event) => handleMousedown($event, i),
341
- onBlurPassive: ($event) => blurCursor(i),
342
- onTouchendPassive: ($event) => blurCursor(i),
343
- onKeydownPassive: ($event) => cursorKeyDown($event, i)
344
- }, [
345
- createElementVNode(
346
- "span",
347
- null,
348
- toDisplayString((_a = tmpValues.value) == null ? void 0 : _a[i]),
349
- 1
350
- /* TEXT */
351
- )
352
- ], 46, _hoisted_2);
353
- }),
354
- 128
355
- /* KEYED_FRAGMENT */
356
- ))
357
- ], 8, _hoisted_1)
358
- ],
359
- 38
360
- /* CLASS, STYLE, HYDRATE_EVENTS */
361
- )
362
- ],
363
- 2112
364
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
365
- );
366
- };
240
+ se((s = d.value) == null ? void 0 : s[o]),
241
+ 1
242
+ /* TEXT */
243
+ )
244
+ ], 46, ce);
245
+ }),
246
+ 128
247
+ /* KEYED_FRAGMENT */
248
+ ))
249
+ ], 8, ie)
250
+ ],
251
+ 38
252
+ /* CLASS, STYLE, HYDRATE_EVENTS */
253
+ )
254
+ ],
255
+ 2112
256
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
257
+ ));
367
258
  }
368
259
  });
369
- const MazSlider_vue_vue_type_style_index_0_scoped_22612f85_lang = "";
370
- const _export_sfc = (sfc, props) => {
371
- const target = sfc.__vccOpts || sfc;
372
- for (const [key, val] of props) {
373
- target[key] = val;
374
- }
375
- return target;
376
- };
377
- const MazSlider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-22612f85"]]);
260
+ const ve = (a, l) => {
261
+ const n = a.__vccOpts || a;
262
+ for (const [c, v] of l)
263
+ n[c] = v;
264
+ return n;
265
+ }, ye = /* @__PURE__ */ ve(de, [["__scopeId", "data-v-22612f85"]]);
378
266
  export {
379
- MazSlider as default
267
+ ye as default
380
268
  };