maz-ui 4.7.5 → 4.7.6

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 (220) hide show
  1. package/dist/chunks/MazAccordion.CKnz73h4.js +1 -0
  2. package/dist/chunks/MazAlert.B8hE7wet.js +1 -0
  3. package/dist/chunks/MazAnimatedCounter.GLLYbZAz.js +1 -0
  4. package/dist/chunks/MazAnimatedElement._8NY8WgC.js +1 -0
  5. package/dist/chunks/MazAnimatedText.BSZ8FNf-.js +1 -0
  6. package/dist/chunks/MazAvatar.vO5VNPi8.js +1 -0
  7. package/dist/chunks/MazBackdrop.Cjbwi8-V.js +1 -0
  8. package/dist/chunks/MazBadge.BBZJgHXm.js +1 -0
  9. package/dist/chunks/MazBottomSheet.WgZ6qobx.js +1 -0
  10. package/dist/chunks/MazBtn.Cc9C1v2l.js +1 -0
  11. package/dist/chunks/MazBtnGroup.3B1XcqWM.js +1 -0
  12. package/dist/chunks/MazCard.YYC0LaHY.js +1 -0
  13. package/dist/chunks/MazCardSpotlight.SpZF61hl.js +1 -0
  14. package/dist/chunks/MazCarousel.1NT4jcvR.js +1 -0
  15. package/dist/chunks/MazChart.CDZ2PBTC.js +1 -0
  16. package/dist/chunks/MazCheckbox.DurIbKdf.js +1 -0
  17. package/dist/chunks/MazChecklist.D9ezwGpQ.js +1 -0
  18. package/dist/chunks/MazCircularProgressBar.rATx_hD9.js +1 -0
  19. package/dist/chunks/MazContainer.zXcfMOs-.js +1 -0
  20. package/dist/chunks/MazDatePicker.KUP34cbV.js +1 -0
  21. package/dist/chunks/MazDialog.CtKF3Xzo.js +1 -0
  22. package/dist/chunks/MazDialogConfirm.CAAHeBPE.js +1 -0
  23. package/dist/chunks/MazDrawer.Dc_RGG8a.js +1 -0
  24. package/dist/chunks/MazDropdown.2DUcivzO.js +1 -0
  25. package/dist/chunks/MazDropzone.CiWiPcFM.js +1 -0
  26. package/dist/chunks/MazExpandAnimation.CMMwtuQA.js +1 -0
  27. package/dist/chunks/MazFullscreenLoader.BIVRcZJ8.js +1 -0
  28. package/dist/chunks/MazGallery.CEmGy0K9.js +1 -0
  29. package/dist/chunks/MazIcon.ZWAk25ZX.js +1 -0
  30. package/dist/chunks/MazInput.DJjWLaKg.js +1 -0
  31. package/dist/chunks/MazInputCode.DKnl3i-X.js +1 -0
  32. package/dist/chunks/MazInputNumber.B42Mn-9h.js +1 -0
  33. package/dist/chunks/MazInputPhoneNumber.CLivThtK.js +1 -0
  34. package/dist/chunks/MazInputPrice.BeL-M944.js +1 -0
  35. package/dist/chunks/MazInputTags.CIVT9F6Q.js +1 -0
  36. package/dist/chunks/MazLazyImg.-EMwandx.js +1 -0
  37. package/dist/chunks/MazLink.BOpxMATj.js +1 -0
  38. package/dist/chunks/MazLoadingBar.C86AX2Tk.js +1 -0
  39. package/dist/chunks/MazPagination.CNNKXBsg.js +1 -0
  40. package/dist/chunks/MazPickerCalendarDays.CSZZbk5Z.js +1 -0
  41. package/dist/chunks/MazPickerCalendarGrid.DrUHBH6-.js +1 -0
  42. package/dist/chunks/MazPickerContainer.BZ74M74V.js +1 -0
  43. package/dist/chunks/MazPopover.Co8BEopX.js +1 -0
  44. package/dist/chunks/MazPullToRefresh.DMtb6Oa3.js +1 -0
  45. package/dist/chunks/MazRadio.75ipjTw2.js +1 -0
  46. package/dist/chunks/MazRadioButtons.DenHCgB3.js +1 -0
  47. package/dist/chunks/MazReadMore.CDXacQIw.js +1 -0
  48. package/dist/chunks/MazReadingProgressBar.828Y0mxA.js +1 -0
  49. package/dist/chunks/MazSelect.yYFAbBb5.js +1 -0
  50. package/dist/chunks/MazSelectCountry.DvVgk2es.js +1 -0
  51. package/dist/chunks/MazSkeleton.BewTYJC2.js +1 -0
  52. package/dist/chunks/MazSlider.BS5QHWK6.js +1 -0
  53. package/dist/chunks/MazSpinner.D3NN2pow.js +1 -0
  54. package/dist/chunks/MazStepper.DTu8HG9T.js +1 -0
  55. package/dist/chunks/MazSwitch.Dvmj-rTW.js +1 -0
  56. package/dist/chunks/MazTable.DnOehvN6.js +1 -0
  57. package/dist/chunks/MazTableCell.xbm2NGWL.js +1 -0
  58. package/dist/chunks/MazTableRow.B5dJiXk1.js +1 -0
  59. package/dist/chunks/MazTableTitle.DNA_1mCy.js +1 -0
  60. package/dist/chunks/MazTabs.-0-YP3QQ.js +1 -0
  61. package/dist/chunks/MazTabsBar.D2JVKMS7.js +1 -0
  62. package/dist/chunks/MazTabsContent.C9omK25X.js +1 -0
  63. package/dist/chunks/MazTabsContentItem.mJEAS5R8.js +1 -0
  64. package/dist/chunks/MazTextarea.BliEP5G5.js +1 -0
  65. package/dist/chunks/MazUiProvider.BgN8V0lD.js +1 -0
  66. package/dist/chunks/_plugin-vue_export-helper.ChmETRGw.js +1 -0
  67. package/dist/chunks/dialog.DexeIC3K.js +1 -0
  68. package/dist/chunks/dom-events.BPrKJiCz.js +1 -0
  69. package/dist/chunks/resolveLinkComponent.DAc3sqGH.js +1 -0
  70. package/dist/chunks/toast.UQ8RRuT9.js +1 -0
  71. package/dist/chunks/types.DDbvTVqf.js +1 -0
  72. package/dist/chunks/useMazInputPhoneNumber.B_qQ0ldP.js +1 -0
  73. package/dist/chunks/utils.B8bfGQxN.js +1 -0
  74. package/dist/chunks/vFullscreenImg.CZeRh3mw.js +1 -0
  75. package/dist/chunks/vLazyImg.CXmd3Lp0.js +1 -0
  76. package/dist/chunks/vZoomImg.CaAHb98S.js +124 -0
  77. package/dist/components/MazAccordion.js +1 -86
  78. package/dist/components/MazAlert.js +1 -85
  79. package/dist/components/MazAnimatedCounter.js +1 -73
  80. package/dist/components/MazAnimatedElement.js +1 -44
  81. package/dist/components/MazAnimatedText.js +1 -103
  82. package/dist/components/MazAvatar.js +1 -125
  83. package/dist/components/MazBackdrop.js +1 -163
  84. package/dist/components/MazBadge.js +1 -29
  85. package/dist/components/MazBottomSheet.js +1 -55
  86. package/dist/components/MazBtn.js +1 -109
  87. package/dist/components/MazBtnGroup.js +1 -44
  88. package/dist/components/MazCard.js +1 -184
  89. package/dist/components/MazCardSpotlight.js +1 -81
  90. package/dist/components/MazCarousel.js +1 -104
  91. package/dist/components/MazChart.js +1 -4
  92. package/dist/components/MazCheckbox.js +1 -128
  93. package/dist/components/MazChecklist.js +1 -133
  94. package/dist/components/MazCircularProgressBar.js +1 -131
  95. package/dist/components/MazContainer.js +1 -71
  96. package/dist/components/MazDatePicker/MazPickerCalendar.js +1 -113
  97. package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarDays.js +1 -19
  98. package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarGrid.js +1 -181
  99. package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarMonth.js +1 -75
  100. package/dist/components/MazDatePicker/MazPickerCalendarSwitcher.js +1 -90
  101. package/dist/components/MazDatePicker/MazPickerContainer.js +1 -116
  102. package/dist/components/MazDatePicker/MazPickerHeader.js +1 -126
  103. package/dist/components/MazDatePicker/MazPickerMonthSwitcher.js +1 -82
  104. package/dist/components/MazDatePicker/MazPickerShortcuts.js +1 -55
  105. package/dist/components/MazDatePicker/MazPickerTime.js +1 -178
  106. package/dist/components/MazDatePicker/MazPickerYearSwitcher.js +1 -95
  107. package/dist/components/MazDatePicker.js +1 -466
  108. package/dist/components/MazDatePicker.vue.d.ts +2 -6
  109. package/dist/components/MazDialog.js +1 -115
  110. package/dist/components/MazDialog.vue.d.ts +2 -6
  111. package/dist/components/MazDialogConfirm.js +1 -6
  112. package/dist/components/MazDialogConfirm.vue.d.ts +2 -6
  113. package/dist/components/MazDrawer.js +1 -70
  114. package/dist/components/MazDropdown.js +1 -277
  115. package/dist/components/MazDropdown.vue.d.ts +2 -6
  116. package/dist/components/MazDropzone.js +1 -533
  117. package/dist/components/MazExpandAnimation.js +1 -46
  118. package/dist/components/MazFullscreenLoader.js +1 -38
  119. package/dist/components/MazGallery.js +1 -105
  120. package/dist/components/MazIcon.js +1 -114
  121. package/dist/components/MazInput.js +1 -256
  122. package/dist/components/MazInputCode.js +1 -152
  123. package/dist/components/MazInputNumber.js +1 -152
  124. package/dist/components/MazInputPhoneNumber/PhoneInput.js +1 -114
  125. package/dist/components/MazInputPhoneNumber.js +1 -253
  126. package/dist/components/MazInputPrice.js +1 -4
  127. package/dist/components/MazInputTags.js +1 -145
  128. package/dist/components/MazLazyImg.js +1 -62
  129. package/dist/components/MazLink.js +1 -80
  130. package/dist/components/MazLoadingBar.js +1 -24
  131. package/dist/components/MazPagination.js +1 -184
  132. package/dist/components/MazPopover.js +1 -326
  133. package/dist/components/MazPullToRefresh.js +1 -145
  134. package/dist/components/MazRadio.js +1 -103
  135. package/dist/components/MazRadioButtons.js +1 -135
  136. package/dist/components/MazReadMore.js +1 -110
  137. package/dist/components/MazReadingProgressBar.js +1 -68
  138. package/dist/components/MazSelect.js +1 -413
  139. package/dist/components/MazSelectCountry.js +1 -192
  140. package/dist/components/MazSkeleton.js +1 -50
  141. package/dist/components/MazSlider.js +1 -205
  142. package/dist/components/MazSpinner.js +1 -27
  143. package/dist/components/MazStepper.js +1 -170
  144. package/dist/components/MazSwitch.js +1 -4
  145. package/dist/components/MazTable.js +1 -8
  146. package/dist/components/MazTableCell.js +1 -18
  147. package/dist/components/MazTableRow.js +1 -26
  148. package/dist/components/MazTableTitle.js +1 -18
  149. package/dist/components/MazTabs.js +1 -4
  150. package/dist/components/MazTabsBar.js +1 -138
  151. package/dist/components/MazTabsContent.js +1 -4
  152. package/dist/components/MazTabsContentItem.js +1 -37
  153. package/dist/components/MazTextarea.js +1 -147
  154. package/dist/components/MazUiProvider.js +1 -4
  155. package/dist/components/index.js +1 -127
  156. package/dist/composables/index.js +1 -44
  157. package/dist/composables/useAos.js +1 -7
  158. package/dist/composables/useBreakpoints.js +1 -34
  159. package/dist/composables/useDialog.js +1 -7
  160. package/dist/composables/useDisplayNames.js +1 -111
  161. package/dist/composables/useDropzone.js +1 -66
  162. package/dist/composables/useFormField.js +1 -101
  163. package/dist/composables/useFormValidator.js +1 -163
  164. package/dist/composables/useFreezeValue.js +1 -8
  165. package/dist/composables/useIdleTimeout.js +1 -10
  166. package/dist/composables/useInjectStrict.js +1 -10
  167. package/dist/composables/useInstanceUniqId.js +1 -12
  168. package/dist/composables/useMountComponent.js +1 -16
  169. package/dist/composables/useMutationObserver.js +1 -37
  170. package/dist/composables/useReadingTime.js +1 -33
  171. package/dist/composables/useStringMatching.js +1 -42
  172. package/dist/composables/useSwipe.js +1 -26
  173. package/dist/composables/useTimer.js +1 -36
  174. package/dist/composables/useToast.js +1 -14
  175. package/dist/composables/useUserVisibility.js +1 -10
  176. package/dist/composables/useWait.js +1 -7
  177. package/dist/composables/useWindowSize.js +1 -21
  178. package/dist/directives/index.js +1 -19
  179. package/dist/directives/vClickOutside.js +1 -104
  180. package/dist/directives/vFullscreenImg.js +1 -10
  181. package/dist/directives/vLazyImg.js +1 -23
  182. package/dist/directives/vTooltip.js +1 -161
  183. package/dist/directives/vZoomImg.js +1 -286
  184. package/dist/index.js +1 -1
  185. package/dist/plugins/aos.js +1 -89
  186. package/dist/plugins/dialog.js +1 -61
  187. package/dist/plugins/index.js +1 -17
  188. package/dist/plugins/maz-ui.js +1 -11
  189. package/dist/plugins/toast.js +1 -261
  190. package/dist/plugins/wait.js +1 -43
  191. package/dist/resolvers/MazComponentsResolver.js +1 -18
  192. package/dist/resolvers/MazDirectivesResolver.js +1 -14
  193. package/dist/resolvers/MazModulesResolver.js +1 -76
  194. package/dist/resolvers/index.js +1 -8
  195. package/dist/tailwindcss/index.js +1 -20
  196. package/dist/tailwindcss/tailwind.config.js +1 -35
  197. package/dist/tailwindcss/utils/colors.js +1 -25
  198. package/dist/tailwindcss/variables/breakpoints.js +1 -29
  199. package/dist/tailwindcss/variables/colors.js +1 -33
  200. package/dist/tailwindcss/variables/design-tokens.js +1 -42
  201. package/dist/tailwindcss/variables/utilities.js +1 -20
  202. package/dist/tailwindcss/variables/z-indexes.js +1 -17
  203. package/package.json +12 -13
  204. package/dist/chunks/MazChart.vue_vue_type_script_setup_true_lang.DpG9UYdm.js +0 -50
  205. package/dist/chunks/MazDialogConfirm.vue_vue_type_script_setup_true_lang.BB2rYkwY.js +0 -215
  206. package/dist/chunks/MazInputPrice.vue_vue_type_script_setup_true_lang.DcNkyw1C.js +0 -77
  207. package/dist/chunks/MazSwitch.vue_vue_type_style_index_0_lang.lYfYsI0R.js +0 -84
  208. package/dist/chunks/MazTable.vue_vue_type_script_setup_true_lang.ycpSYFvJ.js +0 -517
  209. package/dist/chunks/MazTabs.vue_vue_type_script_setup_true_lang.CiIFxs7J.js +0 -28
  210. package/dist/chunks/MazTabsContent.vue_vue_type_script_setup_true_lang.MO7zA8LZ.js +0 -26
  211. package/dist/chunks/MazUiProvider.vue_vue_type_script_setup_true_lang.DtnM1DOn.js +0 -34
  212. package/dist/chunks/_plugin-vue_export-helper.B--vMWp3.js +0 -9
  213. package/dist/chunks/dom-events.DTx6Kblx.js +0 -368
  214. package/dist/chunks/fullscreen-img.directive.BJieSSIt.js +0 -321
  215. package/dist/chunks/lazy-img.directive.GRfYbidn.js +0 -174
  216. package/dist/chunks/resolveLinkComponent.CKR2McYy.js +0 -8
  217. package/dist/chunks/types.D0Bp_UhS.js +0 -6
  218. package/dist/chunks/useMazInputPhoneNumber.Os-2y9bz.js +0 -157
  219. package/dist/chunks/utils.D89Q5cCP.js +0 -207
  220. /package/dist/assets/{fullscreen-img.DFp1SMPU.css → vFullscreenImg.DFp1SMPU.css} +0 -0
@@ -1,126 +1 @@
1
- import { defineComponent, computed, ref, watch, openBlock, createElementBlock, normalizeClass, createVNode, TransitionGroup, withCtx, Fragment, renderList, toDisplayString, createCommentVNode } from "vue";
2
- import { capitalize } from "@maz-ui/utils/helpers/capitalize";
3
- import { formatDate } from "@maz-ui/utils/helpers/formatDate";
4
- import dayjs from "dayjs";
5
- import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
6
- import '../../assets/MazPickerHeader.B5IM2AdI.css';const _hoisted_1 = {
7
- key: 0,
8
- class: "m-date-picker-header__date"
9
- }, _sfc_main = /* @__PURE__ */ defineComponent({
10
- __name: "MazPickerHeader",
11
- props: {
12
- modelValue: {},
13
- color: {},
14
- locale: {},
15
- hideShortcuts: { type: Boolean },
16
- double: { type: Boolean },
17
- hasDate: { type: Boolean },
18
- hasTime: { type: Boolean },
19
- formatterOptions: {}
20
- },
21
- setup(__props) {
22
- const refDate = computed(
23
- () => typeof __props.modelValue == "string" ? __props.modelValue : __props.modelValue?.start
24
- ), transitionName = ref("maz-slidevnext"), year = computed(() => __props.modelValue && typeof __props.modelValue == "object" ? `${__props.modelValue.start ? formatDate(__props.modelValue.start, __props.locale, {
25
- year: "numeric",
26
- timeZone: __props.formatterOptions.timeZone
27
- }) : "..."} - ${__props.modelValue.end ? formatDate(__props.modelValue.end, __props.locale, {
28
- year: "numeric",
29
- timeZone: __props.formatterOptions.timeZone
30
- }) : "..."}` : typeof __props.modelValue == "string" ? formatDate(__props.modelValue, __props.locale, {
31
- year: "numeric",
32
- timeZone: __props.formatterOptions.timeZone
33
- }) : "-"), yearArray = computed(() => __props.hasDate ? [year.value] : void 0), dateString = computed(() => {
34
- if (__props.modelValue && typeof __props.modelValue == "object" && (__props.modelValue.start || __props.modelValue.end)) {
35
- const dateOption = __props.hideShortcuts && !__props.double ? "short" : "long";
36
- return `${__props.modelValue.start ? capitalize(
37
- formatDate(__props.modelValue.start, __props.locale, {
38
- weekday: dateOption,
39
- month: dateOption,
40
- day: "numeric",
41
- timeZone: __props.formatterOptions.timeZone
42
- }) ?? __props.modelValue.start
43
- ) : "..."} - ${__props.modelValue.end ? capitalize(
44
- formatDate(__props.modelValue.end, __props.locale, {
45
- weekday: dateOption,
46
- month: dateOption,
47
- day: "numeric",
48
- timeZone: __props.formatterOptions.timeZone
49
- }) ?? __props.modelValue.end
50
- ) : "..."}`;
51
- } else if (typeof __props.modelValue == "string") {
52
- const formattedDate = formatDate(__props.modelValue, __props.locale, {
53
- weekday: "long",
54
- month: "long",
55
- day: "numeric",
56
- timeZone: __props.formatterOptions.timeZone
57
- });
58
- return formattedDate ? capitalize(formattedDate) : void 0;
59
- }
60
- return "-";
61
- }), dateStringArray = computed(() => __props.hasDate ? [dateString.value] : void 0), timeValue = computed(() => refDate.value ? formatDate(refDate.value, __props.locale, {
62
- timeStyle: "short",
63
- timeZone: __props.formatterOptions.timeZone,
64
- hour12: __props.formatterOptions.hour12
65
- }) : void 0), timeArray = computed(() => __props.hasTime ? [timeValue.value] : void 0);
66
- return watch(
67
- () => __props.modelValue,
68
- (modelValue, oldModelValue) => {
69
- const currentValue = typeof modelValue == "object" ? modelValue.start : modelValue, oldValue = typeof oldModelValue == "object" ? oldModelValue.start : oldModelValue;
70
- transitionName.value = dayjs(currentValue).isAfter(oldValue, "date") || dayjs(currentValue).isSame(oldValue, "date") ? "maz-slidevnext" : "maz-slidevprev";
71
- }
72
- ), (_ctx, _cache) => (openBlock(), createElementBlock("div", {
73
- class: normalizeClass(["m-date-picker-header", [`--${__props.color}`]])
74
- }, [
75
- __props.hasDate ? (openBlock(), createElementBlock("div", _hoisted_1, [
76
- createVNode(TransitionGroup, {
77
- name: transitionName.value,
78
- tag: "div",
79
- class: "m-date-picker-header__year-transition"
80
- }, {
81
- default: withCtx(() => [
82
- (openBlock(!0), createElementBlock(Fragment, null, renderList(yearArray.value, (y, yi) => (openBlock(), createElementBlock("span", {
83
- key: `${y}-${yi}`,
84
- class: "m-date-picker-header__year-text"
85
- }, toDisplayString(y), 1))), 128))
86
- ]),
87
- _: 1
88
- }, 8, ["name"]),
89
- createVNode(TransitionGroup, {
90
- name: transitionName.value,
91
- tag: "div",
92
- class: "m-date-picker-header__date-transition"
93
- }, {
94
- default: withCtx(() => [
95
- (openBlock(!0), createElementBlock(Fragment, null, renderList(dateStringArray.value, (d, di) => (openBlock(), createElementBlock("span", {
96
- key: `${d}-${di}`,
97
- class: "m-date-picker-header__date-text"
98
- }, toDisplayString(d), 1))), 128))
99
- ]),
100
- _: 1
101
- }, 8, ["name"])
102
- ])) : createCommentVNode("", !0),
103
- timeArray.value ? (openBlock(), createElementBlock("div", {
104
- key: 1,
105
- class: normalizeClass(["m-date-picker-header__time", { "--has-date": __props.hasDate }])
106
- }, [
107
- createVNode(TransitionGroup, {
108
- name: transitionName.value,
109
- tag: "div",
110
- class: "m-date-picker-header__time-transition"
111
- }, {
112
- default: withCtx(() => [
113
- (openBlock(!0), createElementBlock(Fragment, null, renderList(timeArray.value, (t, ti) => (openBlock(), createElementBlock("span", {
114
- key: `${t}-${ti}`,
115
- class: "m-date-picker-header__time-text"
116
- }, toDisplayString(t), 1))), 128))
117
- ]),
118
- _: 1
119
- }, 8, ["name"])
120
- ], 2)) : createCommentVNode("", !0)
121
- ], 2));
122
- }
123
- }), MazPickerHeader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-523d752c"]]);
124
- export {
125
- MazPickerHeader as default
126
- };
1
+ import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{Fragment,TransitionGroup,computed,createCommentVNode,createElementBlock,createVNode,defineComponent,normalizeClass,openBlock,ref,renderList,toDisplayString,watch,withCtx}from"vue";import{formatDate}from"@maz-ui/utils/helpers/formatDate";import dayjs from"dayjs";import{capitalize}from"@maz-ui/utils/helpers/capitalize";import '../../assets/MazPickerHeader.B5IM2AdI.css';var _hoisted_1={key:0,class:`m-date-picker-header__date`};var MazPickerHeader_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazPickerHeader`,props:{modelValue:{},color:{},locale:{},hideShortcuts:{type:Boolean},double:{type:Boolean},hasDate:{type:Boolean},hasTime:{type:Boolean},formatterOptions:{}},setup(__props){let refDate=computed(()=>typeof __props.modelValue==`string`?__props.modelValue:__props.modelValue?.start);let transitionName=ref(`maz-slidevnext`);let year=computed(()=>__props.modelValue&&typeof __props.modelValue==`object`?`${__props.modelValue.start?formatDate(__props.modelValue.start,__props.locale,{year:`numeric`,timeZone:__props.formatterOptions.timeZone}):`...`} - ${__props.modelValue.end?formatDate(__props.modelValue.end,__props.locale,{year:`numeric`,timeZone:__props.formatterOptions.timeZone}):`...`}`:typeof __props.modelValue==`string`?formatDate(__props.modelValue,__props.locale,{year:`numeric`,timeZone:__props.formatterOptions.timeZone}):`-`);let yearArray=computed(()=>__props.hasDate?[year.value]:void 0);let dateString=computed(()=>{if(__props.modelValue&&typeof __props.modelValue==`object`&&(__props.modelValue.start||__props.modelValue.end)){let dateOption=__props.hideShortcuts&&!__props.double?`short`:`long`;return`${__props.modelValue.start?capitalize(formatDate(__props.modelValue.start,__props.locale,{weekday:dateOption,month:dateOption,day:`numeric`,timeZone:__props.formatterOptions.timeZone})??__props.modelValue.start):`...`} - ${__props.modelValue.end?capitalize(formatDate(__props.modelValue.end,__props.locale,{weekday:dateOption,month:dateOption,day:`numeric`,timeZone:__props.formatterOptions.timeZone})??__props.modelValue.end):`...`}`}else if(typeof __props.modelValue==`string`){let formattedDate=formatDate(__props.modelValue,__props.locale,{weekday:`long`,month:`long`,day:`numeric`,timeZone:__props.formatterOptions.timeZone});return formattedDate?capitalize(formattedDate):void 0}return`-`});let dateStringArray=computed(()=>__props.hasDate?[dateString.value]:void 0);let timeValue=computed(()=>refDate.value?formatDate(refDate.value,__props.locale,{timeStyle:`short`,timeZone:__props.formatterOptions.timeZone,hour12:__props.formatterOptions.hour12}):void 0);let timeArray=computed(()=>__props.hasTime?[timeValue.value]:void 0);return watch(()=>__props.modelValue,(modelValue,oldModelValue)=>{let currentValue=typeof modelValue==`object`?modelValue.start:modelValue;let oldValue=typeof oldModelValue==`object`?oldModelValue.start:oldModelValue;transitionName.value=dayjs(currentValue).isAfter(oldValue,`date`)||dayjs(currentValue).isSame(oldValue,`date`)?`maz-slidevnext`:`maz-slidevprev`}),(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`m-date-picker-header`,[`--${__props.color}`]])},[__props.hasDate?(openBlock(),createElementBlock(`div`,_hoisted_1,[createVNode(TransitionGroup,{name:transitionName.value,tag:`div`,class:`m-date-picker-header__year-transition`},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(yearArray.value,(y,yi)=>(openBlock(),createElementBlock(`span`,{key:`${y}-${yi}`,class:`m-date-picker-header__year-text`},toDisplayString(y),1))),128))]),_:1},8,[`name`]),createVNode(TransitionGroup,{name:transitionName.value,tag:`div`,class:`m-date-picker-header__date-transition`},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(dateStringArray.value,(d,di)=>(openBlock(),createElementBlock(`span`,{key:`${d}-${di}`,class:`m-date-picker-header__date-text`},toDisplayString(d),1))),128))]),_:1},8,[`name`])])):createCommentVNode(``,!0),timeArray.value?(openBlock(),createElementBlock(`div`,{key:1,class:normalizeClass([`m-date-picker-header__time`,{"--has-date":__props.hasDate}])},[createVNode(TransitionGroup,{name:transitionName.value,tag:`div`,class:`m-date-picker-header__time-transition`},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(timeArray.value,(t,ti)=>(openBlock(),createElementBlock(`span`,{key:`${t}-${ti}`,class:`m-date-picker-header__time-text`},toDisplayString(t),1))),128))]),_:1},8,[`name`])],2)):createCommentVNode(``,!0)],2))}}),[[`__scopeId`,`data-v-523d752c`]]);export{MazPickerHeader_default as default};
@@ -1,82 +1 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, createVNode, withModifiers, withCtx, unref, normalizeClass, Fragment, renderList, createBlock, createTextVNode, toDisplayString } from "vue";
2
- import { MazXMark } from "@maz-ui/icons/static";
3
- import { capitalize } from "@maz-ui/utils/helpers/capitalize";
4
- import { formatDate } from "@maz-ui/utils/helpers/formatDate";
5
- import dayjs from "dayjs";
6
- import MazBtn from "../MazBtn.js";
7
- import { i as isSameDate } from "../../chunks/utils.D89Q5cCP.js";
8
- import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
9
- import '../../assets/MazPickerMonthSwitcher.B22aTQrT.css';const _hoisted_1 = { class: "maz-picker-month-switcher" }, _hoisted_2 = { class: "maz-picker-month-switcher__header" }, _sfc_main = /* @__PURE__ */ defineComponent({
10
- __name: "MazPickerMonthSwitcher",
11
- props: {
12
- calendarDate: { type: String, required: !0 },
13
- color: { type: String, required: !0 },
14
- locale: { type: String, required: !0 },
15
- double: { type: Boolean, required: !0 }
16
- },
17
- emits: ["update:calendar-date", "close"],
18
- setup(__props, { emit: __emit }) {
19
- const props = __props, emits = __emit, months = computed(() => Array.from({ length: 12 }, (_v, i) => i).map((monthNumber) => {
20
- const monthDate = dayjs(props.calendarDate).set("month", monthNumber);
21
- return props.double ? {
22
- label: `${capitalize(
23
- formatDate(monthDate.format(), props.locale, {
24
- month: "short"
25
- }) ?? monthDate.add(1, "month").format()
26
- )} - ${capitalize(
27
- formatDate(monthDate.add(1, "month").format(), props.locale, {
28
- month: "short"
29
- }) ?? monthDate.add(1, "month").format()
30
- )}`,
31
- date: monthDate
32
- } : {
33
- label: capitalize(
34
- formatDate(monthDate.format(), props.locale, {
35
- month: "long"
36
- }) ?? monthDate.format()
37
- ),
38
- date: monthDate
39
- };
40
- }));
41
- function selectMonth(date) {
42
- emits("update:calendar-date", date.format()), emits("close");
43
- }
44
- return (_ctx, _cache) => (openBlock(), createElementBlock("div", _hoisted_1, [
45
- createElementVNode("div", _hoisted_2, [
46
- createVNode(MazBtn, {
47
- size: "xs",
48
- color: "transparent",
49
- type: "button",
50
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$emit("close", $event), ["stop"]))
51
- }, {
52
- default: withCtx(() => [
53
- createVNode(unref(MazXMark), { class: "maz-text-lg" })
54
- ]),
55
- _: 1
56
- })
57
- ]),
58
- createElementVNode("div", {
59
- class: normalizeClass(["maz-picker-month-switcher__main", { "--has-double": __props.double }])
60
- }, [
61
- (openBlock(!0), createElementBlock(Fragment, null, renderList(months.value, (month) => (openBlock(), createBlock(MazBtn, {
62
- key: month.label,
63
- size: props.double ? "sm" : "xs",
64
- class: normalizeClass({
65
- "--is-selected": unref(isSameDate)(month.date, __props.calendarDate, "month")
66
- }),
67
- color: unref(isSameDate)(month.date, __props.calendarDate, "month") ? __props.color : "transparent",
68
- type: "button",
69
- onClick: withModifiers(($event) => selectMonth(month.date), ["stop"])
70
- }, {
71
- default: withCtx(() => [
72
- createTextVNode(toDisplayString(month.label), 1)
73
- ]),
74
- _: 2
75
- }, 1032, ["size", "class", "color", "onClick"]))), 128))
76
- ], 2)
77
- ]));
78
- }
79
- }), MazPickerMonthSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e311e418"]]);
80
- export {
81
- MazPickerMonthSwitcher as default
82
- };
1
+ import{f as isSameDate}from"../../chunks/utils.B8bfGQxN.js";import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{t as MazBtn_default}from"../../chunks/MazBtn.Cc9C1v2l.js";import{Fragment,computed,createBlock,createElementBlock,createElementVNode,createTextVNode,createVNode,defineComponent,normalizeClass,openBlock,renderList,toDisplayString,unref,withCtx,withModifiers}from"vue";import{MazXMark}from"@maz-ui/icons/static";import{formatDate}from"@maz-ui/utils/helpers/formatDate";import dayjs from"dayjs";import{capitalize}from"@maz-ui/utils/helpers/capitalize";import '../../assets/MazPickerMonthSwitcher.B22aTQrT.css';var _hoisted_1={class:`maz-picker-month-switcher`};var _hoisted_2={class:`maz-picker-month-switcher__header`};var MazPickerMonthSwitcher_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazPickerMonthSwitcher`,props:{calendarDate:{type:String,required:!0},color:{type:String,required:!0},locale:{type:String,required:!0},double:{type:Boolean,required:!0}},emits:[`update:calendar-date`,`close`],setup(__props,{emit:__emit}){let props=__props;let emits=__emit;let months=computed(()=>Array.from({length:12},(_v,i)=>i).map(monthNumber=>{let monthDate=dayjs(props.calendarDate).set(`month`,monthNumber);return props.double?{label:`${capitalize(formatDate(monthDate.format(),props.locale,{month:`short`})??monthDate.add(1,`month`).format())} - ${capitalize(formatDate(monthDate.add(1,`month`).format(),props.locale,{month:`short`})??monthDate.add(1,`month`).format())}`,date:monthDate}:{label:capitalize(formatDate(monthDate.format(),props.locale,{month:`long`})??monthDate.format()),date:monthDate}}));function selectMonth(date){emits(`update:calendar-date`,date.format()),emits(`close`)}return(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,_hoisted_1,[createElementVNode(`div`,_hoisted_2,[createVNode(MazBtn_default,{size:`xs`,color:`transparent`,type:`button`,onClick:_cache[0]||=withModifiers($event=>_ctx.$emit(`close`,$event),[`stop`])},{default:withCtx(()=>[createVNode(unref(MazXMark),{class:`maz-text-lg`})]),_:1})]),createElementVNode(`div`,{class:normalizeClass([`maz-picker-month-switcher__main`,{"--has-double":__props.double}])},[(openBlock(!0),createElementBlock(Fragment,null,renderList(months.value,month=>(openBlock(),createBlock(MazBtn_default,{key:month.label,size:props.double?`sm`:`xs`,class:normalizeClass({"--is-selected":unref(isSameDate)(month.date,__props.calendarDate,`month`)}),color:unref(isSameDate)(month.date,__props.calendarDate,`month`)?__props.color:`transparent`,type:`button`,onClick:withModifiers($event=>selectMonth(month.date),[`stop`])},{default:withCtx(()=>[createTextVNode(toDisplayString(month.label),1)]),_:2},1032,[`size`,`class`,`color`,`onClick`]))),128))],2)]))}}),[[`__scopeId`,`data-v-e311e418`]]);export{MazPickerMonthSwitcher_default as default};
@@ -1,55 +1 @@
1
- import { defineComponent, ref, watch, openBlock, createElementBlock, Fragment, renderList, createBlock, withModifiers, normalizeClass, withCtx, createTextVNode, toDisplayString } from "vue";
2
- import MazBtn from "../MazBtn.js";
3
- import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
4
- import '../../assets/MazPickerShortcuts.immuGARx.css';const _hoisted_1 = { class: "maz-picker-shortcuts" }, _sfc_main = /* @__PURE__ */ defineComponent({
5
- __name: "MazPickerShortcuts",
6
- props: {
7
- color: {},
8
- modelValue: {},
9
- shortcuts: {},
10
- double: { type: Boolean },
11
- shortcut: {},
12
- disabled: { type: Boolean }
13
- },
14
- emits: ["update:model-value"],
15
- setup(__props, { emit: __emit }) {
16
- const props = __props, emits = __emit, selectedShortcut = ref(props.shortcut);
17
- function selectShortcut(value, identifier) {
18
- selectedShortcut.value = identifier, emits("update:model-value", value);
19
- }
20
- return watch(
21
- () => props.modelValue,
22
- (value) => {
23
- value?.end || (selectedShortcut.value = void 0);
24
- }
25
- ), watch(
26
- () => props.shortcut,
27
- (shortcut) => {
28
- const newShortcut = props.shortcuts && props.shortcuts.find(({ identifier }) => shortcut === identifier);
29
- if (newShortcut) {
30
- const { value, identifier } = newShortcut;
31
- selectShortcut(value, identifier);
32
- }
33
- },
34
- { immediate: !0 }
35
- ), (_ctx, _cache) => (openBlock(), createElementBlock("div", _hoisted_1, [
36
- (openBlock(!0), createElementBlock(Fragment, null, renderList(__props.shortcuts, ({ identifier, label, value }) => (openBlock(), createBlock(MazBtn, {
37
- key: identifier,
38
- type: "button",
39
- size: "sm",
40
- disabled: __props.disabled,
41
- color: identifier === selectedShortcut.value ? props.color : "transparent",
42
- class: normalizeClass({ "--is-selected": identifier === selectedShortcut.value }),
43
- onClick: withModifiers(($event) => selectShortcut(value, identifier), ["stop"])
44
- }, {
45
- default: withCtx(() => [
46
- createTextVNode(toDisplayString(label), 1)
47
- ]),
48
- _: 2
49
- }, 1032, ["disabled", "color", "class", "onClick"]))), 128))
50
- ]));
51
- }
52
- }), MazPickerShortcuts = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d30dbe36"]]);
53
- export {
54
- MazPickerShortcuts as default
55
- };
1
+ import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{t as MazBtn_default}from"../../chunks/MazBtn.Cc9C1v2l.js";import{Fragment,createBlock,createElementBlock,createTextVNode,defineComponent,normalizeClass,openBlock,ref,renderList,toDisplayString,watch,withCtx,withModifiers}from"vue";import '../../assets/MazPickerShortcuts.immuGARx.css';var _hoisted_1={class:`maz-picker-shortcuts`};var MazPickerShortcuts_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazPickerShortcuts`,props:{color:{},modelValue:{},shortcuts:{},double:{type:Boolean},shortcut:{},disabled:{type:Boolean}},emits:[`update:model-value`],setup(__props,{emit:__emit}){let props=__props;let emits=__emit;let selectedShortcut=ref(props.shortcut);function selectShortcut(value,identifier){selectedShortcut.value=identifier,emits(`update:model-value`,value)}return watch(()=>props.modelValue,value=>{value?.end||(selectedShortcut.value=void 0)}),watch(()=>props.shortcut,shortcut=>{let newShortcut=props.shortcuts&&props.shortcuts.find(({identifier})=>shortcut===identifier);if(newShortcut){let{value,identifier}=newShortcut;selectShortcut(value,identifier)}},{immediate:!0}),(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,_hoisted_1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(__props.shortcuts,({identifier,label,value})=>(openBlock(),createBlock(MazBtn_default,{key:identifier,type:`button`,size:`sm`,disabled:__props.disabled,color:identifier===selectedShortcut.value?props.color:`transparent`,class:normalizeClass({"--is-selected":identifier===selectedShortcut.value}),onClick:withModifiers($event=>selectShortcut(value,identifier),[`stop`])},{default:withCtx(()=>[createTextVNode(toDisplayString(label),1)]),_:2},1032,[`disabled`,`color`,`class`,`onClick`]))),128))]))}}),[[`__scopeId`,`data-v-d30dbe36`]]);export{MazPickerShortcuts_default as default};
@@ -1,178 +1 @@
1
- import { defineComponent, computed, ref, onMounted, watch, nextTick, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, normalizeStyle, createBlock, withModifiers, withCtx, createTextVNode, toDisplayString } from "vue";
2
- import dayjs from "dayjs";
3
- import MazBtn from "../MazBtn.js";
4
- import { f as findNearestNumberInList, s as scrollToTarget } from "../../chunks/utils.D89Q5cCP.js";
5
- import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
6
- import '../../assets/MazPickerTime.BpOWBzy_.css';const _hoisted_1 = { class: "m-date-picker-time__column__items" }, _sfc_main = /* @__PURE__ */ defineComponent({
7
- __name: "MazPickerTime",
8
- props: {
9
- modelValue: {
10
- type: [String, Object],
11
- default: void 0
12
- },
13
- formatterOptions: {
14
- type: Object,
15
- required: !0
16
- },
17
- color: { type: String, required: !0 },
18
- hasDate: { type: Boolean, required: !0 },
19
- minuteInterval: { type: Number, required: !0 },
20
- disabledHours: { type: Array, default: void 0 },
21
- format: { type: String, required: !0 },
22
- isHour12: { type: Boolean, required: !0 },
23
- minDate: { type: String, default: void 0 },
24
- maxDate: { type: String, default: void 0 },
25
- disabled: { type: Boolean, required: !0 }
26
- },
27
- emits: ["update:model-value"],
28
- setup(__props, { emit: __emit }) {
29
- const props = __props, emits = __emit, currentDate = computed({
30
- get: () => props.modelValue,
31
- set: (value) => {
32
- emits("update:model-value", value);
33
- }
34
- }), hours = computed(() => Array.from({ length: props.isHour12 ? 12 : 24 }, (_v, i) => i).map((hour) => {
35
- const hourBase = hour + (props.isHour12 ? 1 : 0), hour12or24 = getHour12or24(hourBase), hourValue = dayjs(currentDate.value).set("hour", hour12or24), isDisabled = isDisableHour(hour12or24) || (props.minDate && currentDate.value ? dayjs(props.minDate).isAfter(hourValue, "hour") : !1) || (props.maxDate && currentDate.value ? dayjs(props.maxDate).isBefore(hourValue, "hour") : !1);
36
- return {
37
- label: `${hourBase < 10 ? "0" : ""}${hourBase}`,
38
- value: dayjs(currentDate.value).set("hour", hour12or24),
39
- isDisabled
40
- };
41
- })), minutes = computed(() => {
42
- const length = Math.floor(60 / props.minuteInterval) - 0;
43
- return Array.from({ length }, (_v, i) => i * props.minuteInterval).map((minute) => {
44
- const minuteValue = dayjs(currentDate.value).set("minute", minute), isDisabled = (props.minDate && currentDate.value ? dayjs(props.minDate).isAfter(minuteValue, "minute") : !1) || (props.maxDate && currentDate.value ? dayjs(props.maxDate).isBefore(minuteValue, "minute") : !1);
45
- return {
46
- label: `${minute < 10 ? "0" : ""}${minute}`,
47
- value: minuteValue,
48
- isDisabled
49
- };
50
- });
51
- }), currentHour = computed(() => typeof currentDate.value == "string" ? findNearestHour(dayjs(currentDate.value).get("hour")) : void 0), currentMinute = computed(
52
- () => typeof currentDate.value == "string" ? findNearestNumberInList(
53
- minutes.value.map(({ value }) => value.get("minute")),
54
- dayjs(currentDate.value).get("minute")
55
- ) : void 0
56
- ), currentAmpm = computed(() => typeof currentHour.value == "number" ? currentHour.value >= 12 ? "pm" : "am" : void 0), ampm = computed(
57
- () => props.isHour12 ? [
58
- { label: "AM", value: "am" },
59
- { label: "PM", value: "pm" }
60
- ] : []
61
- ), columns = computed(() => {
62
- const columns2 = [
63
- {
64
- identifier: "hour",
65
- values: hours.value
66
- },
67
- {
68
- identifier: "minute",
69
- values: minutes.value
70
- }
71
- ];
72
- return props.isHour12 && columns2.push({
73
- identifier: "ampm",
74
- values: ampm.value
75
- }), columns2;
76
- });
77
- function findNearestHour(hour) {
78
- if (!props.disabledHours)
79
- return hour;
80
- const hourList = Array.from({ length: 24 }, (_v, i) => i).filter(
81
- (hour2) => !props.disabledHours?.includes(hour2) || !0
82
- ), nearHour = findNearestNumberInList(hourList, hour);
83
- return nearHour !== hour && selectTime("hour", dayjs(currentDate.value).set("hour", nearHour)), nearHour;
84
- }
85
- const MazDatePickerTime = ref(), spacerHeight = ref();
86
- function getHour12or24(hourValue) {
87
- if (props.isHour12) {
88
- const newValue = currentAmpm.value === "pm" ? hourValue + 12 : hourValue;
89
- return newValue === 12 ? 0 : newValue === 24 ? 12 : newValue;
90
- } else
91
- return hourValue;
92
- }
93
- function setSpacerHeight() {
94
- if (!MazDatePickerTime.value)
95
- return;
96
- const itemHeight = MazDatePickerTime.value.querySelector(
97
- ".m-date-picker-time__column .m-btn"
98
- )?.offsetHeight, topSpace = MazDatePickerTime.value.offsetHeight / 2 - itemHeight / 2;
99
- spacerHeight.value = topSpace;
100
- }
101
- onMounted(() => {
102
- setSpacerHeight(), scrollColumns(!1);
103
- }), watch(
104
- () => props.modelValue,
105
- async (value, oldValue) => {
106
- value !== oldValue && (await nextTick(), scrollColumns(!0));
107
- },
108
- { immediate: !0 }
109
- );
110
- function scrollColumns(hasSmoothEffect) {
111
- scrollColumn("hour", hasSmoothEffect), scrollColumn("minute", hasSmoothEffect), props.isHour12 && scrollColumn("ampm", hasSmoothEffect);
112
- }
113
- function isDisableHour(value) {
114
- return (props.disabledHours && props.disabledHours.includes(value)) ?? !1;
115
- }
116
- function isSelected(identifier, value) {
117
- return value === "am" || value === "pm" ? currentAmpm.value === value : identifier === "hour" ? currentHour.value === value.get(identifier) : identifier === "minute" ? currentMinute.value === value.get(identifier) : !1;
118
- }
119
- async function scrollColumn(identifier, hasSmoothEffect = !0) {
120
- if (!MazDatePickerTime.value)
121
- return;
122
- const column = MazDatePickerTime.value.querySelector(`.m-date-picker-time__column__${identifier}`), selectedButton = MazDatePickerTime.value.querySelector(
123
- `.m-date-picker-time__column__${identifier} .--is-selected`
124
- );
125
- spacerHeight.value && column && selectedButton && MazDatePickerTime.value && (await nextTick(), scrollToTarget(column, selectedButton, spacerHeight.value, hasSmoothEffect));
126
- }
127
- async function selectTime(identifier, value) {
128
- const newDate = dayjs(currentDate.value);
129
- if (identifier === "hour" && typeof value == "object" && (currentDate.value = newDate.set("hour", value.get("hour")).format()), identifier === "minute" && typeof value == "object") {
130
- const dateWithNewMinute = newDate.set("minute", value.get("minute"));
131
- currentDate.value = dateWithNewMinute.format();
132
- }
133
- if (identifier === "ampm" && (currentAmpm.value !== value || !currentHour.value) && (value === "am" && (currentDate.value = newDate.set("hour", newDate.get("hour")).subtract(12, "hour").format()), value === "pm")) {
134
- const baseHour = newDate.get("hour"), newHour = baseHour + 12 > 12 && baseHour + 12 < 24 ? baseHour + 12 : baseHour === 0 ? 12 : baseHour;
135
- currentDate.value = newDate.set("hour", newHour).format();
136
- }
137
- await nextTick(), scrollColumn(identifier);
138
- }
139
- return (_ctx, _cache) => (openBlock(), createElementBlock("div", {
140
- ref_key: "MazDatePickerTime",
141
- ref: MazDatePickerTime,
142
- class: normalizeClass(["m-date-picker-time", { "--has-date": __props.hasDate }])
143
- }, [
144
- (openBlock(!0), createElementBlock(Fragment, null, renderList(columns.value, ({ values, identifier }, i) => (openBlock(), createElementBlock("div", {
145
- key: i,
146
- class: normalizeClass(["m-date-picker-time__column", [`m-date-picker-time__column__${identifier}`]])
147
- }, [
148
- createElementVNode("div", {
149
- style: normalizeStyle({ height: `${spacerHeight.value}px` }),
150
- class: "m-date-picker-time__column__spacer"
151
- }, null, 4),
152
- createElementVNode("div", _hoisted_1, [
153
- (openBlock(!0), createElementBlock(Fragment, null, renderList(values, ({ value, label, isDisabled }, unitIndex) => (openBlock(), createBlock(MazBtn, {
154
- key: unitIndex,
155
- size: "xs",
156
- color: isSelected(identifier, value) ? __props.color : "transparent",
157
- class: normalizeClass({ "--is-selected": isSelected(identifier, value) }),
158
- disabled: isDisabled || __props.disabled,
159
- type: "button",
160
- onClick: withModifiers(($event) => selectTime(identifier, value), ["stop"])
161
- }, {
162
- default: withCtx(() => [
163
- createTextVNode(toDisplayString(label), 1)
164
- ]),
165
- _: 2
166
- }, 1032, ["color", "class", "disabled", "onClick"]))), 128))
167
- ]),
168
- createElementVNode("div", {
169
- style: normalizeStyle({ height: `${spacerHeight.value}px` }),
170
- class: "m-date-picker-time__column__spacer"
171
- }, null, 4)
172
- ], 2))), 128))
173
- ], 2));
174
- }
175
- }), MazPickerTime = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-50562a31"]]);
176
- export {
177
- MazPickerTime as default
178
- };
1
+ import{_ as scrollToTarget,n as findNearestNumberInList}from"../../chunks/utils.B8bfGQxN.js";import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{t as MazBtn_default}from"../../chunks/MazBtn.Cc9C1v2l.js";import{Fragment,computed,createBlock,createElementBlock,createElementVNode,createTextVNode,defineComponent,nextTick,normalizeClass,normalizeStyle,onMounted,openBlock,ref,renderList,toDisplayString,watch,withCtx,withModifiers}from"vue";import dayjs from"dayjs";import '../../assets/MazPickerTime.BpOWBzy_.css';var _hoisted_1={class:`m-date-picker-time__column__items`};var MazPickerTime_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazPickerTime`,props:{modelValue:{type:[String,Object],default:void 0},formatterOptions:{type:Object,required:!0},color:{type:String,required:!0},hasDate:{type:Boolean,required:!0},minuteInterval:{type:Number,required:!0},disabledHours:{type:Array,default:void 0},format:{type:String,required:!0},isHour12:{type:Boolean,required:!0},minDate:{type:String,default:void 0},maxDate:{type:String,default:void 0},disabled:{type:Boolean,required:!0}},emits:[`update:model-value`],setup(__props,{emit:__emit}){let props=__props;let emits=__emit;let currentDate=computed({get:()=>props.modelValue,set:value=>{emits(`update:model-value`,value)}});let hours=computed(()=>Array.from({length:props.isHour12?12:24},(_v,i)=>i).map(hour=>{let hourBase=hour+(props.isHour12?1:0);let hour12or24=getHour12or24(hourBase);let hourValue=dayjs(currentDate.value).set(`hour`,hour12or24);let isDisabled=isDisableHour(hour12or24)||(props.minDate&&currentDate.value?dayjs(props.minDate).isAfter(hourValue,`hour`):!1)||(props.maxDate&&currentDate.value?dayjs(props.maxDate).isBefore(hourValue,`hour`):!1);return{label:`${hourBase<10?`0`:``}${hourBase}`,value:dayjs(currentDate.value).set(`hour`,hour12or24),isDisabled}}));let minutes=computed(()=>{let length=Math.floor(60/props.minuteInterval)-0;return Array.from({length},(_v,i)=>i*props.minuteInterval).map(minute=>{let minuteValue=dayjs(currentDate.value).set(`minute`,minute);let isDisabled=(props.minDate&&currentDate.value?dayjs(props.minDate).isAfter(minuteValue,`minute`):!1)||(props.maxDate&&currentDate.value?dayjs(props.maxDate).isBefore(minuteValue,`minute`):!1);return{label:`${minute<10?`0`:``}${minute}`,value:minuteValue,isDisabled}})});let currentHour=computed(()=>typeof currentDate.value==`string`?findNearestHour(dayjs(currentDate.value).get(`hour`)):void 0);let currentMinute=computed(()=>typeof currentDate.value==`string`?findNearestNumberInList(minutes.value.map(({value})=>value.get(`minute`)),dayjs(currentDate.value).get(`minute`)):void 0);let currentAmpm=computed(()=>typeof currentHour.value==`number`?currentHour.value>=12?`pm`:`am`:void 0);let ampm=computed(()=>props.isHour12?[{label:`AM`,value:`am`},{label:`PM`,value:`pm`}]:[]);let columns=computed(()=>{let columns=[{identifier:`hour`,values:hours.value},{identifier:`minute`,values:minutes.value}];return props.isHour12&&columns.push({identifier:`ampm`,values:ampm.value}),columns});function findNearestHour(hour){if(!props.disabledHours)return hour;let nearHour=findNearestNumberInList(Array.from({length:24},(_v,i)=>i).filter(hour=>!props.disabledHours?.includes(hour)||!0),hour);return nearHour!==hour&&selectTime(`hour`,dayjs(currentDate.value).set(`hour`,nearHour)),nearHour}let MazDatePickerTime=ref();let spacerHeight=ref();function getHour12or24(hourValue){if(props.isHour12){let newValue=currentAmpm.value===`pm`?hourValue+12:hourValue;return newValue===12?0:newValue===24?12:newValue}else return hourValue}function setSpacerHeight(){if(!MazDatePickerTime.value)return;let itemHeight=MazDatePickerTime.value.querySelector(`.m-date-picker-time__column .m-btn`)?.offsetHeight;spacerHeight.value=MazDatePickerTime.value.offsetHeight/2-itemHeight/2}onMounted(()=>{setSpacerHeight(),scrollColumns(!1)}),watch(()=>props.modelValue,async(value,oldValue)=>{value!==oldValue&&(await nextTick(),scrollColumns(!0))},{immediate:!0});function scrollColumns(hasSmoothEffect){scrollColumn(`hour`,hasSmoothEffect),scrollColumn(`minute`,hasSmoothEffect),props.isHour12&&scrollColumn(`ampm`,hasSmoothEffect)}function isDisableHour(value){return(props.disabledHours&&props.disabledHours.includes(value))??!1}function isSelected(identifier,value){return value===`am`||value===`pm`?currentAmpm.value===value:identifier===`hour`?currentHour.value===value.get(identifier):identifier===`minute`?currentMinute.value===value.get(identifier):!1}async function scrollColumn(identifier,hasSmoothEffect=!0){if(!MazDatePickerTime.value)return;let column=MazDatePickerTime.value.querySelector(`.m-date-picker-time__column__${identifier}`);let selectedButton=MazDatePickerTime.value.querySelector(`.m-date-picker-time__column__${identifier} .--is-selected`);spacerHeight.value&&column&&selectedButton&&MazDatePickerTime.value&&(await nextTick(),scrollToTarget(column,selectedButton,spacerHeight.value,hasSmoothEffect))}async function selectTime(identifier,value){let newDate=dayjs(currentDate.value);if(identifier===`hour`&&typeof value==`object`&&(currentDate.value=newDate.set(`hour`,value.get(`hour`)).format()),identifier===`minute`&&typeof value==`object`&&(currentDate.value=newDate.set(`minute`,value.get(`minute`)).format()),identifier===`ampm`&&(currentAmpm.value!==value||!currentHour.value)&&(value===`am`&&(currentDate.value=newDate.set(`hour`,newDate.get(`hour`)).subtract(12,`hour`).format()),value===`pm`)){let baseHour=newDate.get(`hour`);let newHour=baseHour+12>12&&baseHour+12<24?baseHour+12:baseHour===0?12:baseHour;currentDate.value=newDate.set(`hour`,newHour).format()}await nextTick(),scrollColumn(identifier)}return(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,{ref_key:`MazDatePickerTime`,ref:MazDatePickerTime,class:normalizeClass([`m-date-picker-time`,{"--has-date":__props.hasDate}])},[(openBlock(!0),createElementBlock(Fragment,null,renderList(columns.value,({values,identifier},i)=>(openBlock(),createElementBlock(`div`,{key:i,class:normalizeClass([`m-date-picker-time__column`,[`m-date-picker-time__column__${identifier}`]])},[createElementVNode(`div`,{style:normalizeStyle({height:`${spacerHeight.value}px`}),class:`m-date-picker-time__column__spacer`},null,4),createElementVNode(`div`,_hoisted_1,[(openBlock(!0),createElementBlock(Fragment,null,renderList(values,({value,label,isDisabled},unitIndex)=>(openBlock(),createBlock(MazBtn_default,{key:unitIndex,size:`xs`,color:isSelected(identifier,value)?__props.color:`transparent`,class:normalizeClass({"--is-selected":isSelected(identifier,value)}),disabled:isDisabled||__props.disabled,type:`button`,onClick:withModifiers($event=>selectTime(identifier,value),[`stop`])},{default:withCtx(()=>[createTextVNode(toDisplayString(label),1)]),_:2},1032,[`color`,`class`,`disabled`,`onClick`]))),128))]),createElementVNode(`div`,{style:normalizeStyle({height:`${spacerHeight.value}px`}),class:`m-date-picker-time__column__spacer`},null,4)],2))),128))],2))}}),[[`__scopeId`,`data-v-50562a31`]]);export{MazPickerTime_default as default};
@@ -1,95 +1 @@
1
- import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, createVNode, withModifiers, withCtx, unref, Fragment, renderList, createBlock, normalizeClass, createTextVNode, toDisplayString } from "vue";
2
- import { MazChevronLeft, MazXMark } from "@maz-ui/icons/static";
3
- import { formatDate } from "@maz-ui/utils/helpers/formatDate";
4
- import dayjs from "dayjs";
5
- import MazBtn from "../MazBtn.js";
6
- import { i as isSameDate } from "../../chunks/utils.D89Q5cCP.js";
7
- import { _ as _export_sfc } from "../../chunks/_plugin-vue_export-helper.B--vMWp3.js";
8
- import '../../assets/MazPickerYearSwitcher.DM1NPxf1.css';const _hoisted_1 = { class: "maz-picker-year-switcher" }, _hoisted_2 = { class: "maz-picker-year-switcher__header" }, _hoisted_3 = { class: "maz-flex maz-space-x-2" }, _hoisted_4 = { class: "maz-picker-year-switcher__main" }, _sfc_main = /* @__PURE__ */ defineComponent({
9
- __name: "MazPickerYearSwitcher",
10
- props: {
11
- color: { type: String, required: !0 },
12
- locale: { type: String, required: !0 },
13
- calendarDate: { type: String, required: !0 }
14
- },
15
- emits: ["update:calendar-date", "close"],
16
- setup(__props, { emit: __emit }) {
17
- const props = __props, emits = __emit, currentDateTmp = ref(props.calendarDate), years = computed(() => Array.from({ length: 15 }, (_v, i) => i - 7).map((yearNumber) => {
18
- const currentYear = dayjs(currentDateTmp.value).get("year"), dateYear = dayjs(currentDateTmp.value).set("year", currentYear + yearNumber);
19
- return {
20
- label: formatDate(dateYear.format(), props.locale, {
21
- year: "numeric"
22
- }) ?? dateYear.format(),
23
- date: dateYear
24
- };
25
- }));
26
- function selectYear(date) {
27
- emits("update:calendar-date", dayjs(date).format()), emits("close");
28
- }
29
- function previousYears() {
30
- currentDateTmp.value = dayjs(currentDateTmp.value).subtract(7, "year").format();
31
- }
32
- function nextYears() {
33
- currentDateTmp.value = dayjs(currentDateTmp.value).add(7, "year").format();
34
- }
35
- return (_ctx, _cache) => (openBlock(), createElementBlock("div", _hoisted_1, [
36
- createElementVNode("div", _hoisted_2, [
37
- createElementVNode("div", _hoisted_3, [
38
- createVNode(MazBtn, {
39
- size: "xs",
40
- color: "transparent",
41
- type: "button",
42
- onClick: withModifiers(previousYears, ["stop"])
43
- }, {
44
- default: withCtx(() => [
45
- createVNode(unref(MazChevronLeft), { class: "maz-text-lg" })
46
- ]),
47
- _: 1
48
- }),
49
- createVNode(MazBtn, {
50
- size: "xs",
51
- color: "transparent",
52
- type: "button",
53
- onClick: withModifiers(nextYears, ["stop"])
54
- }, {
55
- default: withCtx(() => [
56
- createVNode(unref(MazChevronLeft), { class: "maz-rotate-180 maz-text-lg" })
57
- ]),
58
- _: 1
59
- })
60
- ]),
61
- createVNode(MazBtn, {
62
- size: "xs",
63
- color: "transparent",
64
- type: "button",
65
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$emit("close", $event), ["stop"]))
66
- }, {
67
- default: withCtx(() => [
68
- createVNode(unref(MazXMark), { class: "maz-text-lg" })
69
- ]),
70
- _: 1
71
- })
72
- ]),
73
- createElementVNode("div", _hoisted_4, [
74
- (openBlock(!0), createElementBlock(Fragment, null, renderList(years.value, (year) => (openBlock(), createBlock(MazBtn, {
75
- key: year.label,
76
- size: "sm",
77
- type: "button",
78
- class: normalizeClass({
79
- "--is-selected": unref(isSameDate)(year.date, __props.calendarDate, "year")
80
- }),
81
- color: unref(isSameDate)(year.date, __props.calendarDate, "year") ? __props.color : "transparent",
82
- onClick: withModifiers(($event) => selectYear(year.date), ["stop"])
83
- }, {
84
- default: withCtx(() => [
85
- createTextVNode(toDisplayString(year.label), 1)
86
- ]),
87
- _: 2
88
- }, 1032, ["class", "color", "onClick"]))), 128))
89
- ])
90
- ]));
91
- }
92
- }), MazPickerYearSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bcf1a665"]]);
93
- export {
94
- MazPickerYearSwitcher as default
95
- };
1
+ import{f as isSameDate}from"../../chunks/utils.B8bfGQxN.js";import{t as _plugin_vue_export_helper_default}from"../../chunks/_plugin-vue_export-helper.ChmETRGw.js";import{t as MazBtn_default}from"../../chunks/MazBtn.Cc9C1v2l.js";import{Fragment,computed,createBlock,createElementBlock,createElementVNode,createTextVNode,createVNode,defineComponent,normalizeClass,openBlock,ref,renderList,toDisplayString,unref,withCtx,withModifiers}from"vue";import{MazChevronLeft,MazXMark}from"@maz-ui/icons/static";import{formatDate}from"@maz-ui/utils/helpers/formatDate";import dayjs from"dayjs";import '../../assets/MazPickerYearSwitcher.DM1NPxf1.css';var _hoisted_1={class:`maz-picker-year-switcher`};var _hoisted_2={class:`maz-picker-year-switcher__header`};var _hoisted_3={class:`maz-flex maz-space-x-2`};var _hoisted_4={class:`maz-picker-year-switcher__main`};var MazPickerYearSwitcher_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazPickerYearSwitcher`,props:{color:{type:String,required:!0},locale:{type:String,required:!0},calendarDate:{type:String,required:!0}},emits:[`update:calendar-date`,`close`],setup(__props,{emit:__emit}){let props=__props;let emits=__emit;let currentDateTmp=ref(props.calendarDate);let years=computed(()=>Array.from({length:15},(_v,i)=>i-7).map(yearNumber=>{let currentYear=dayjs(currentDateTmp.value).get(`year`);let dateYear=dayjs(currentDateTmp.value).set(`year`,currentYear+yearNumber);return{label:formatDate(dateYear.format(),props.locale,{year:`numeric`})??dateYear.format(),date:dateYear}}));function selectYear(date){emits(`update:calendar-date`,dayjs(date).format()),emits(`close`)}function previousYears(){currentDateTmp.value=dayjs(currentDateTmp.value).subtract(7,`year`).format()}function nextYears(){currentDateTmp.value=dayjs(currentDateTmp.value).add(7,`year`).format()}return(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,_hoisted_1,[createElementVNode(`div`,_hoisted_2,[createElementVNode(`div`,_hoisted_3,[createVNode(MazBtn_default,{size:`xs`,color:`transparent`,type:`button`,onClick:withModifiers(previousYears,[`stop`])},{default:withCtx(()=>[createVNode(unref(MazChevronLeft),{class:`maz-text-lg`})]),_:1}),createVNode(MazBtn_default,{size:`xs`,color:`transparent`,type:`button`,onClick:withModifiers(nextYears,[`stop`])},{default:withCtx(()=>[createVNode(unref(MazChevronLeft),{class:`maz-rotate-180 maz-text-lg`})]),_:1})]),createVNode(MazBtn_default,{size:`xs`,color:`transparent`,type:`button`,onClick:_cache[0]||=withModifiers($event=>_ctx.$emit(`close`,$event),[`stop`])},{default:withCtx(()=>[createVNode(unref(MazXMark),{class:`maz-text-lg`})]),_:1})]),createElementVNode(`div`,_hoisted_4,[(openBlock(!0),createElementBlock(Fragment,null,renderList(years.value,year=>(openBlock(),createBlock(MazBtn_default,{key:year.label,size:`sm`,type:`button`,class:normalizeClass({"--is-selected":unref(isSameDate)(year.date,__props.calendarDate,`year`)}),color:unref(isSameDate)(year.date,__props.calendarDate,`year`)?__props.color:`transparent`,onClick:withModifiers($event=>selectYear(year.date),[`stop`])},{default:withCtx(()=>[createTextVNode(toDisplayString(year.label),1)]),_:2},1032,[`class`,`color`,`onClick`]))),128))])]))}}),[[`__scopeId`,`data-v-bcf1a665`]]);export{MazPickerYearSwitcher_default as default};