maz-ui 3.5.0 → 3.6.1

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 (174) hide show
  1. package/components/MazAvatar.d.ts +156 -149
  2. package/components/MazAvatar.mjs +656 -0
  3. package/components/MazAvatar.umd.js +2 -0
  4. package/components/MazBackdrop.d.ts +89 -89
  5. package/components/MazBackdrop.mjs +140 -0
  6. package/components/MazBackdrop.umd.js +2 -0
  7. package/components/MazBadge.d.ts +73 -68
  8. package/components/MazBadge.mjs +61 -0
  9. package/components/MazBadge.umd.js +2 -0
  10. package/components/MazBottomSheet.d.ts +36 -29
  11. package/components/MazBottomSheet.mjs +553 -0
  12. package/components/MazBottomSheet.umd.js +2 -0
  13. package/components/MazBtn.d.ts +178 -171
  14. package/components/MazBtn.mjs +371 -0
  15. package/components/MazBtn.umd.js +2 -0
  16. package/components/MazCard.d.ts +194 -183
  17. package/components/MazCard.mjs +1390 -0
  18. package/components/MazCard.umd.js +2 -0
  19. package/components/MazCarousel.d.ts +24 -16
  20. package/components/MazCarousel.mjs +469 -0
  21. package/components/MazCarousel.umd.js +2 -0
  22. package/components/MazChart/includes.d.ts +11 -11
  23. package/components/MazChart.d.ts +114 -114
  24. package/components/MazChart.mjs +135 -0
  25. package/components/MazChart.umd.js +2 -0
  26. package/components/MazCheckbox.d.ts +54 -49
  27. package/components/MazCheckbox.mjs +86 -0
  28. package/components/MazCheckbox.umd.js +2 -0
  29. package/components/MazDialog.d.ts +40 -29
  30. package/components/MazDialog.mjs +566 -0
  31. package/components/MazDialog.umd.js +2 -0
  32. package/components/MazDialogPromise/use-maz-dialog-promise.d.ts +30 -30
  33. package/components/MazDialogPromise.d.ts +36 -28
  34. package/components/MazDialogPromise.mjs +692 -0
  35. package/components/MazDialogPromise.umd.js +2 -0
  36. package/components/MazDrawer.d.ts +69 -59
  37. package/components/MazDrawer.mjs +572 -0
  38. package/components/MazDrawer.umd.js +2 -0
  39. package/components/MazDropzone.d.ts +128 -128
  40. package/components/MazDropzone.mjs +369 -0
  41. package/components/MazDropzone.umd.js +2 -0
  42. package/components/MazGallery.d.ts +144 -144
  43. package/components/MazGallery.mjs +948 -0
  44. package/components/MazGallery.umd.js +2 -0
  45. package/components/MazIcon.d.ts +64 -66
  46. package/components/MazIcon.mjs +161 -0
  47. package/components/MazIcon.umd.js +2 -0
  48. package/components/MazInput.d.ts +276 -276
  49. package/components/MazInput.mjs +750 -0
  50. package/components/MazInput.umd.js +2 -0
  51. package/components/MazInputNumber.d.ts +65 -67
  52. package/components/MazInputNumber.mjs +857 -0
  53. package/components/MazInputNumber.umd.js +2 -0
  54. package/components/MazInputPrice.d.ts +69 -64
  55. package/components/MazInputPrice.mjs +889 -0
  56. package/components/MazInputPrice.umd.js +2 -0
  57. package/components/MazInputTags.d.ts +94 -96
  58. package/components/MazInputTags.mjs +904 -0
  59. package/components/MazInputTags.umd.js +2 -0
  60. package/components/MazLazyImg.d.ts +85 -80
  61. package/components/MazLazyImg.mjs +376 -0
  62. package/components/MazLazyImg.umd.js +2 -0
  63. package/components/MazPhoneNumberInput/constantes/locales.d.ts +12 -12
  64. package/components/MazPhoneNumberInput/types.d.ts +21 -21
  65. package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +2 -2
  66. package/components/MazPhoneNumberInput/utils/index.d.ts +12 -12
  67. package/components/MazPhoneNumberInput.d.ts +253 -255
  68. package/components/MazPhoneNumberInput.mjs +1904 -0
  69. package/components/MazPhoneNumberInput.umd.js +2 -0
  70. package/components/MazPicker/MazPickerCalendar.vue.d.ts +135 -137
  71. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarDays.vue.d.ts +20 -22
  72. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarGrid.vue.d.ts +112 -114
  73. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarMonth.vue.d.ts +122 -124
  74. package/components/MazPicker/MazPickerCalendarSwitcher.vue.d.ts +36 -38
  75. package/components/MazPicker/MazPickerContainer.vue.d.ts +210 -212
  76. package/components/MazPicker/MazPickerFooter.vue.d.ts +16 -0
  77. package/components/MazPicker/MazPickerHeader.vue.d.ts +82 -84
  78. package/components/MazPicker/MazPickerMonthSwitcher.vue.d.ts +41 -43
  79. package/components/MazPicker/MazPickerShortcuts.vue.d.ts +60 -62
  80. package/components/MazPicker/MazPickerTime.vue.d.ts +127 -129
  81. package/components/MazPicker/MazPickerYearSwitcher.vue.d.ts +33 -35
  82. package/components/MazPicker/types.d.ts +15 -15
  83. package/components/MazPicker/utils.d.ts +54 -54
  84. package/components/MazPicker.d.ts +311 -313
  85. package/components/MazPicker.mjs +2942 -0
  86. package/components/MazPicker.umd.js +2 -0
  87. package/components/MazRadioButtons.d.ts +77 -69
  88. package/components/MazRadioButtons.mjs +80 -0
  89. package/components/MazRadioButtons.umd.js +2 -0
  90. package/components/MazSelect.d.ts +185 -176
  91. package/components/MazSelect.mjs +1082 -0
  92. package/components/MazSelect.umd.js +2 -0
  93. package/components/MazSlider/utils.d.ts +15 -15
  94. package/components/MazSlider.d.ts +94 -96
  95. package/components/MazSlider.mjs +377 -0
  96. package/components/MazSlider.umd.js +2 -0
  97. package/components/MazSpinner.d.ts +28 -30
  98. package/components/MazSpinner.mjs +59 -0
  99. package/components/MazSpinner.umd.js +2 -0
  100. package/components/MazStepper.d.ts +71 -73
  101. package/components/MazStepper.mjs +227 -0
  102. package/components/MazStepper.umd.js +2 -0
  103. package/components/MazSwitch.d.ts +54 -56
  104. package/components/MazSwitch.mjs +61 -0
  105. package/components/MazSwitch.umd.js +2 -0
  106. package/components/MazTabsBar.d.ts +47 -49
  107. package/components/MazTabsBar.mjs +470 -0
  108. package/components/MazTabsBar.umd.js +2 -0
  109. package/components/MazTabsContent.d.ts +21 -16
  110. package/components/MazTabsContent.mjs +89 -0
  111. package/components/MazTabsContent.umd.js +2 -0
  112. package/components/MazTabsContentItem.d.ts +19 -14
  113. package/components/MazTabsContentItem.mjs +61 -0
  114. package/components/MazTabsContentItem.umd.js +2 -0
  115. package/components/MazTextarea/textarea-autogrow.d.ts +9 -9
  116. package/components/MazTextarea.d.ts +123 -125
  117. package/components/MazTextarea.mjs +260 -0
  118. package/components/MazTextarea.umd.js +2 -0
  119. package/components/MazTransitionExpand.d.ts +9 -4
  120. package/components/MazTransitionExpand.mjs +62 -0
  121. package/components/MazTransitionExpand.umd.js +2 -0
  122. package/components/index.d.ts +33 -33
  123. package/components/index.mjs +35 -0
  124. package/components/index.umd.js +35 -0
  125. package/components/no_photo-410a8f01.mjs +4 -0
  126. package/components/types.d.ts +17 -17
  127. package/css/main.css +1 -1
  128. package/maz-ui.d.ts +234 -232
  129. package/modules/maz-ui.mjs +1892 -0
  130. package/modules/maz-ui.umd.js +2 -0
  131. package/modules/no_photo-410a8f01.mjs +4 -0
  132. package/package.json +43 -52
  133. package/tailwindcss/tailwind.config.js +6 -7
  134. package/tailwindcss/utils/colors.js +1 -3
  135. package/tailwindcss/variables/breakpoints.js +1 -2
  136. package/tailwindcss/variables/utilities.js +1 -2
  137. package/tailwindcss/variables/z-indexes.js +1 -1
  138. package/components/MazAvatar.js +0 -3
  139. package/components/MazBackdrop.js +0 -3
  140. package/components/MazBadge.js +0 -1
  141. package/components/MazBottomSheet.js +0 -3
  142. package/components/MazBtn.js +0 -3
  143. package/components/MazCard.js +0 -3
  144. package/components/MazCarousel.js +0 -3
  145. package/components/MazChart.js +0 -1
  146. package/components/MazCheckbox.js +0 -1
  147. package/components/MazDialog.js +0 -3
  148. package/components/MazDialogPromise.js +0 -3
  149. package/components/MazDrawer.js +0 -3
  150. package/components/MazDropzone.js +0 -3
  151. package/components/MazGallery.js +0 -3
  152. package/components/MazIcon.js +0 -3
  153. package/components/MazInput.js +0 -3
  154. package/components/MazInputNumber.js +0 -3
  155. package/components/MazInputPrice.js +0 -3
  156. package/components/MazInputTags.js +0 -3
  157. package/components/MazLazyImg.js +0 -3
  158. package/components/MazPhoneNumberInput.js +0 -3
  159. package/components/MazPicker.js +0 -3
  160. package/components/MazRadioButtons.js +0 -1
  161. package/components/MazSelect.js +0 -3
  162. package/components/MazSlider.js +0 -3
  163. package/components/MazSpinner.js +0 -1
  164. package/components/MazStepper.js +0 -1
  165. package/components/MazSwitch.js +0 -1
  166. package/components/MazTabsBar.js +0 -3
  167. package/components/MazTabsContent.js +0 -1
  168. package/components/MazTabsContentItem.js +0 -3
  169. package/components/MazTextarea.js +0 -1
  170. package/components/MazTransitionExpand.js +0 -1
  171. package/components/index.js +0 -35
  172. package/components/no_photo-a72545e4.js +0 -1
  173. package/modules/index.js +0 -3
  174. package/modules/no_photo-a72545e4.js +0 -1
@@ -0,0 +1,656 @@
1
+ (function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("@-webkit-keyframes maz-spin-503fe527{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes maz-spin-503fe527{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.m-spinner[data-v-503fe527]{-webkit-animation:maz-spin-503fe527 1s linear infinite;animation:maz-spin-503fe527 1s linear infinite;fill:currentColor;color:var(--maz-color-white);margin:0!important}.m-spinner--primary[data-v-503fe527]{color:var(--maz-color-primary)}.m-spinner--secondary[data-v-503fe527]{color:var(--maz-color-secondary)}.m-spinner--info[data-v-503fe527]{color:var(--maz-color-info)}.m-spinner--warning[data-v-503fe527]{color:var(--maz-color-warning)}.m-spinner--danger[data-v-503fe527]{color:var(--maz-color-danger)}.m-spinner--success[data-v-503fe527]{color:var(--maz-color-success)}.m-spinner--black[data-v-503fe527]{color:var(--maz-color-black)}.m-spinner--white[data-v-503fe527],.m-spinner--transparent[data-v-503fe527]{color:var(--maz-color-white)}.m-lazy-img-component[data-v-2dd96791]{position:relative;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;background-color:var(--maz-color-bg-lighter);-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.m-lazy-img-component-loader[data-v-2dd96791]{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:none;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.m-lazy-img-component:not(.m-lazy-error,.m-lazy-no-photo) img[data-v-2dd96791]{height:100%;width:100%}.m-lazy-img-component.--height-full img[data-v-2dd96791]{max-height:100%!important;width:-webkit-min-content!important;width:-moz-min-content!important;width:min-content!important;max-width:-webkit-min-content!important;max-width:-moz-min-content!important;max-width:min-content!important}.m-lazy-img-component:not(.m-lazy-loaded,.m-lazy-no-photo) .m-lazy-img-component-loader[data-v-2dd96791]{display:-webkit-box;display:-ms-flexbox;display:flex}.m-avatar[data-v-319e07de]{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;text-decoration-line:none!important}.m-avatar__caption[data-v-319e07de]{margin-top:.5rem;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-size:1rem;line-height:1.5rem;font-weight:500;text-transform:capitalize}.m-avatar__initial[data-v-319e07de]{text-transform:capitalize;color:var(--maz-color-white);font-size:1.5em}.m-avatar__wrapper[data-v-319e07de]{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:none;flex:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;overflow:hidden;border-radius:9999px;background-color:var(--maz-color-bg-lighter);height:3em;width:3em}.m-avatar__wrapper.--clickable .m-avatar__button[data-v-319e07de]{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;border-radius:var(--maz-border-radius);border-style:none;background-color:transparent;opacity:0;outline:2px solid transparent;outline-offset:2px;-webkit-transition-property:all;transition-property:all;-webkit-transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transform:scale(0);transform:scale(0)}.m-avatar__wrapper.--clickable .m-avatar__button__icon[data-v-319e07de]{color:var(--maz-color-white);height:1em;width:1em}.m-avatar__wrapper.--clickable:not(.--square) .m-avatar__button[data-v-319e07de]{border-radius:9999px}.m-avatar__wrapper.--clickable:hover .m-avatar__picture[data-v-319e07de],.m-avatar__wrapper.--clickable:focus .m-avatar__picture[data-v-319e07de]{-webkit-filter:blur(1.5px);filter:blur(1.5px)}.m-avatar__wrapper.--clickable:hover .m-avatar__button[data-v-319e07de],.m-avatar__wrapper.--clickable:focus .m-avatar__button[data-v-319e07de]{opacity:1;-webkit-transform:scale(1.05);transform:scale(1.05)}.m-avatar__wrapper.--bordered[data-v-319e07de]{border-width:2px;border-style:solid;border-color:var(--maz-color-white)}.m-avatar__wrapper.--square[data-v-319e07de]{border-radius:var(--maz-border-radius)}.m-avatar__wrapper.--has-shadow[data-v-319e07de]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.m-avatar__wrapper.--has-initial[data-v-319e07de]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--maz-color-primary)}.m-avatar.--has-link[data-v-319e07de]{cursor:pointer}")),document.head.appendChild(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, pushScopeId, popScopeId, createElementVNode, computed, withDirectives, Fragment, renderList, unref, mergeProps, createVNode, createCommentVNode, renderSlot, inject, ref, onMounted, watchEffect, nextTick, createBlock, resolveDynamicComponent, withCtx, withKeys, toDisplayString, normalizeStyle } from "vue";
9
+ const EMPTY_PHOTO = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
10
+ const DEFAULT_OPTIONS = {
11
+ baseClass: "m-lazy-img",
12
+ loadedClass: "m-lazy-loaded",
13
+ loadingClass: "m-lazy-loading",
14
+ errorClass: "m-lazy-error",
15
+ noPhotoClass: "m-lazy-no-photo",
16
+ noPhoto: false,
17
+ observerOnce: true,
18
+ loadOnce: false,
19
+ noUseErrorPhoto: false,
20
+ observerOptions: {
21
+ threshold: 0.1
22
+ }
23
+ };
24
+ class LazyImg {
25
+ constructor(opts = {}) {
26
+ __publicField(this, "observers", []);
27
+ __publicField(this, "defaultOptions", DEFAULT_OPTIONS);
28
+ __publicField(this, "options");
29
+ __publicField(this, "onImgLoadedCallback");
30
+ __publicField(this, "onImgErrorCallback");
31
+ __publicField(this, "hasImgLoaded", false);
32
+ this.options = this.buildOptions(opts);
33
+ this.onImgLoadedCallback = this.imageIsLoaded.bind(this);
34
+ this.onImgErrorCallback = this.imageHasError.bind(this);
35
+ }
36
+ async loadErrorPhoto() {
37
+ const { default: photo } = await import("./no_photo-410a8f01.mjs");
38
+ return photo;
39
+ }
40
+ buildOptions(opts) {
41
+ return {
42
+ ...this.defaultOptions,
43
+ ...opts,
44
+ observerOptions: {
45
+ ...this.defaultOptions.observerOptions,
46
+ ...opts.observerOptions
47
+ }
48
+ };
49
+ }
50
+ removeClass(el, className) {
51
+ el.classList.remove(className);
52
+ }
53
+ addClass(el, className) {
54
+ el.classList.add(className);
55
+ }
56
+ removeAllStateClasses(el) {
57
+ this.removeClass(el, this.options.loadedClass);
58
+ this.removeClass(el, this.options.loadingClass);
59
+ this.removeClass(el, this.options.errorClass);
60
+ this.removeClass(el, this.options.noPhotoClass);
61
+ }
62
+ setBaseClass(el) {
63
+ this.addClass(el, this.options.baseClass);
64
+ }
65
+ imageIsLoading(el) {
66
+ var _a, _b;
67
+ this.addClass(el, this.options.loadingClass);
68
+ (_b = (_a = this.options).onLoading) == null ? void 0 : _b.call(_a, el);
69
+ }
70
+ imageHasNoPhoto(el) {
71
+ this.removeClass(el, this.options.loadingClass);
72
+ this.addClass(el, this.options.noPhotoClass);
73
+ this.setDefaultPhoto(el);
74
+ }
75
+ imageIsLoaded(el) {
76
+ var _a, _b;
77
+ this.hasImgLoaded = true;
78
+ this.removeClass(el, this.options.loadingClass);
79
+ this.addClass(el, this.options.loadedClass);
80
+ (_b = (_a = this.options).onLoaded) == null ? void 0 : _b.call(_a, el);
81
+ }
82
+ imageHasError(el, event) {
83
+ var _a, _b;
84
+ console.warn(`[maz-ui][MazLazyImg] Error while loading image`, event);
85
+ this.removeClass(el, this.options.loadingClass);
86
+ this.addClass(el, this.options.errorClass);
87
+ (_b = (_a = this.options).onError) == null ? void 0 : _b.call(_a, el);
88
+ this.setDefaultPhoto(el);
89
+ }
90
+ getImageUrl(el, binding) {
91
+ const dataSrc = this.getImgElement(el).getAttribute("data-src");
92
+ if (dataSrc)
93
+ return dataSrc;
94
+ const bindingSrc = typeof binding.value === "object" ? binding.value.src : binding.value;
95
+ if (!bindingSrc)
96
+ console.warn(`[maz-ui][MazLazyImg] src url is not defined`);
97
+ return bindingSrc;
98
+ }
99
+ async setPictureSourceUrls(el) {
100
+ const sourceElements = el.querySelectorAll("source");
101
+ if (sourceElements.length > 0) {
102
+ for await (const source of sourceElements) {
103
+ const srcSet = source.getAttribute("data-srcset");
104
+ if (srcSet) {
105
+ source.srcset = srcSet;
106
+ } else {
107
+ console.warn(
108
+ '[maz-ui][MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"'
109
+ );
110
+ }
111
+ }
112
+ } else {
113
+ console.warn(
114
+ '[maz-ui][MazLazyImg] No "<source />" elements provided into the "<picture />" element'
115
+ );
116
+ this.imageHasError(el);
117
+ }
118
+ }
119
+ hasBgImgMode(binding) {
120
+ return binding.arg === "bg-image";
121
+ }
122
+ isPictureElement(el) {
123
+ return el instanceof HTMLPictureElement;
124
+ }
125
+ getImgElement(el) {
126
+ const isPictureElement = this.isPictureElement(el);
127
+ return isPictureElement ? el.querySelector("img") : el;
128
+ }
129
+ async setDefaultPhoto(el) {
130
+ if (this.options.noUseErrorPhoto)
131
+ return;
132
+ const errorPhoto = this.options.errorPhoto ?? await this.loadErrorPhoto();
133
+ const sourceElements = el.querySelectorAll("source");
134
+ if (sourceElements.length > 0) {
135
+ for await (const source of sourceElements) {
136
+ source.srcset = errorPhoto;
137
+ }
138
+ } else {
139
+ this.setImgSrc(el, errorPhoto);
140
+ }
141
+ }
142
+ addEventListenerToImg(el) {
143
+ const imgElement = this.getImgElement(el);
144
+ imgElement.addEventListener("load", () => this.onImgLoadedCallback(el), {
145
+ once: true
146
+ });
147
+ imgElement.addEventListener(
148
+ "error",
149
+ (err) => this.onImgErrorCallback(el, err),
150
+ { once: true }
151
+ );
152
+ }
153
+ async loadImage(el, binding) {
154
+ this.imageIsLoading(el);
155
+ if (this.isPictureElement(el)) {
156
+ this.addEventListenerToImg(el);
157
+ await this.setPictureSourceUrls(el);
158
+ } else {
159
+ const imageUrl = this.getImageUrl(el, binding);
160
+ if (!imageUrl)
161
+ return this.imageHasError(el);
162
+ if (this.hasBgImgMode(binding)) {
163
+ el.style.backgroundImage = `url('${imageUrl}')`;
164
+ this.imageIsLoaded(el);
165
+ } else {
166
+ this.addEventListenerToImg(el);
167
+ this.setImgSrc(el, imageUrl);
168
+ }
169
+ }
170
+ }
171
+ setImgSrc(el, src) {
172
+ const imgElement = this.getImgElement(el);
173
+ imgElement.src = src;
174
+ }
175
+ handleIntersectionObserver(el, binding, entries, observer) {
176
+ var _a, _b;
177
+ this.observers.push(observer);
178
+ for (const entry of entries) {
179
+ if (entry.isIntersecting) {
180
+ (_b = (_a = this.options).onIntersecting) == null ? void 0 : _b.call(_a, entry.target);
181
+ if (this.options.observerOnce) {
182
+ observer.unobserve(el);
183
+ }
184
+ if (this.options.loadOnce && this.hasImgLoaded)
185
+ return;
186
+ this.loadImage(el, binding);
187
+ }
188
+ }
189
+ }
190
+ createObserver(el, binding) {
191
+ const observerCallback = (entries, intersectionObserver) => {
192
+ this.handleIntersectionObserver(
193
+ el,
194
+ binding,
195
+ entries,
196
+ intersectionObserver
197
+ );
198
+ };
199
+ const observerOptions = this.options.observerOptions;
200
+ const observer = new IntersectionObserver(observerCallback, observerOptions);
201
+ observer.observe(el);
202
+ }
203
+ async imageHandler(el, binding, type) {
204
+ if (type === "update") {
205
+ for await (const observer of this.observers)
206
+ observer.unobserve(el);
207
+ }
208
+ if (window.IntersectionObserver) {
209
+ this.createObserver(el, binding);
210
+ } else {
211
+ this.loadImage(el, binding);
212
+ }
213
+ }
214
+ async bindUpdateHandler(el, binding, type) {
215
+ if (this.options.noPhoto)
216
+ return this.imageHasNoPhoto(el);
217
+ await this.imageHandler(el, binding, type);
218
+ }
219
+ async add(el, binding) {
220
+ if (this.hasBgImgMode(binding) && this.isPictureElement(el)) {
221
+ throw new Error(
222
+ `[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`
223
+ );
224
+ }
225
+ setTimeout(() => this.setBaseClass(el), 0);
226
+ if (!el.getAttribute("src"))
227
+ this.setImgSrc(el, EMPTY_PHOTO);
228
+ await this.bindUpdateHandler(el, binding, "bind");
229
+ }
230
+ async update(el, binding) {
231
+ if (binding.value !== binding.oldValue) {
232
+ this.hasImgLoaded = false;
233
+ this.removeAllStateClasses(el);
234
+ await this.bindUpdateHandler(el, binding, "update");
235
+ }
236
+ }
237
+ remove(el, binding) {
238
+ this.hasImgLoaded = false;
239
+ if (this.hasBgImgMode(binding))
240
+ el.style.backgroundImage = "";
241
+ this.removeAllStateClasses(el);
242
+ for (const observer of this.observers)
243
+ observer.unobserve(el);
244
+ this.observers = [];
245
+ }
246
+ }
247
+ let instance;
248
+ const vLazyImg = {
249
+ created(el, binding) {
250
+ const options = typeof binding.value === "object" ? binding.value : {};
251
+ instance = new LazyImg(options);
252
+ instance.add(el, binding);
253
+ },
254
+ updated(el, binding) {
255
+ instance.update(el, binding);
256
+ },
257
+ unmounted(el, binding) {
258
+ instance.remove(el, binding);
259
+ }
260
+ };
261
+ const _withScopeId = (n) => (pushScopeId("data-v-503fe527"), n = n(), popScopeId(), n);
262
+ const _hoisted_1$3 = ["width", "height"];
263
+ const _hoisted_2$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("path", { d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" }, null, -1));
264
+ const _hoisted_3$1 = [
265
+ _hoisted_2$2
266
+ ];
267
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
268
+ __name: "MazSpinner",
269
+ props: {
270
+ size: { type: String, default: "2em" },
271
+ color: {
272
+ type: String,
273
+ default: "primary",
274
+ validator: (value) => {
275
+ return [
276
+ "info",
277
+ "white",
278
+ "success",
279
+ "warning",
280
+ "danger",
281
+ "primary",
282
+ "black",
283
+ "secondary",
284
+ "transparent"
285
+ ].includes(value);
286
+ }
287
+ }
288
+ },
289
+ setup(__props) {
290
+ return (_ctx, _cache) => {
291
+ return openBlock(), createElementBlock("svg", {
292
+ width: __props.size,
293
+ height: __props.size,
294
+ version: "1.1",
295
+ xmlns: "http://www.w3.org/2000/svg",
296
+ x: "0px",
297
+ y: "0px",
298
+ viewBox: "0 0 50 50",
299
+ "xml:space": "preserve",
300
+ class: normalizeClass(["m-spinner", `m-spinner--${__props.color}`]),
301
+ style: { "enable-background": "new 0 0 50 50" }
302
+ }, _hoisted_3$1, 10, _hoisted_1$3);
303
+ };
304
+ }
305
+ });
306
+ const MazSpinner_vue_vue_type_style_index_0_scoped_503fe527_lang = "";
307
+ const _export_sfc = (sfc, props) => {
308
+ const target = sfc.__vccOpts || sfc;
309
+ for (const [key, val] of props) {
310
+ target[key] = val;
311
+ }
312
+ return target;
313
+ };
314
+ const MazSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-503fe527"]]);
315
+ const _hoisted_1$2 = ["data-srcset", "media"];
316
+ const _hoisted_2$1 = {
317
+ key: 0,
318
+ class: "m-lazy-img-component-loader"
319
+ };
320
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
321
+ __name: "MazLazyImg",
322
+ props: {
323
+ image: { type: [String, Object], default: void 0 },
324
+ noPhoto: { type: Boolean, default: false },
325
+ noLoader: { type: Boolean, default: false },
326
+ noObserverOnce: { type: Boolean, default: false },
327
+ loadOnce: { type: Boolean, default: false },
328
+ imageHeightFull: { type: Boolean, default: false },
329
+ observerOptions: { type: Object, default: null }
330
+ },
331
+ emits: ["intersecting", "loading", "loaded", "error"],
332
+ setup(__props) {
333
+ const props = __props;
334
+ const sources = computed(() => {
335
+ var _a;
336
+ return typeof props.image === "string" ? [{ srcset: props.image }] : (_a = props.image) == null ? void 0 : _a.sources;
337
+ });
338
+ return (_ctx, _cache) => {
339
+ return withDirectives((openBlock(), createElementBlock("picture", {
340
+ class: normalizeClass(["m-lazy-img-component", { "-use-loader": !__props.noLoader, "--height-full": __props.imageHeightFull }])
341
+ }, [
342
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(sources), ({ srcset, media }, sourceIndex) => {
343
+ return openBlock(), createElementBlock("source", {
344
+ key: sourceIndex,
345
+ "data-srcset": srcset,
346
+ media
347
+ }, null, 8, _hoisted_1$2);
348
+ }), 128)),
349
+ createElementVNode("img", mergeProps(_ctx.$attrs, { src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" }), null, 16),
350
+ !__props.noLoader ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
351
+ createVNode(MazSpinner, {
352
+ color: "black",
353
+ size: "2em"
354
+ })
355
+ ])) : createCommentVNode("", true),
356
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
357
+ ], 2)), [
358
+ [unref(vLazyImg), {
359
+ noPhoto: __props.noPhoto,
360
+ observerOnce: !__props.noObserverOnce,
361
+ loadOnce: __props.loadOnce,
362
+ onIntersecting: (el) => _ctx.$emit("intersecting", el),
363
+ onLoading: (el) => _ctx.$emit("loading", el),
364
+ onLoaded: (el) => _ctx.$emit("loaded", el),
365
+ onError: (el) => _ctx.$emit("error", el),
366
+ observerOptions: __props.observerOptions
367
+ }]
368
+ ]);
369
+ };
370
+ }
371
+ });
372
+ const MazLazyImg_vue_vue_type_style_index_0_scoped_2dd96791_lang = "";
373
+ const MazLazyImg = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2dd96791"]]);
374
+ function injectStrict(key, fallback) {
375
+ const resolved = inject(key, fallback);
376
+ if (!resolved) {
377
+ throw new Error(`[maz-ui](injectStrict) Could not resolve ${key}`);
378
+ }
379
+ return resolved;
380
+ }
381
+ const _hoisted_1$1 = ["innerHTML"];
382
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
383
+ __name: "MazIcon",
384
+ props: {
385
+ src: { type: String, default: void 0 },
386
+ path: { type: String, default: void 0 },
387
+ name: { type: String, default: void 0 },
388
+ size: { type: String, default: "1.5rem" },
389
+ title: { type: String, default: void 0 },
390
+ transformSource: {
391
+ type: Function,
392
+ default: (svg) => svg
393
+ }
394
+ },
395
+ emits: ["loaded", "unloaded", "error"],
396
+ setup(__props, { emit: emits }) {
397
+ const props = __props;
398
+ const cache = {};
399
+ const svgElSource = ref();
400
+ const svgElem = ref();
401
+ const getMazIconPath = () => {
402
+ try {
403
+ return injectStrict("mazIconPath");
404
+ } catch {
405
+ return void 0;
406
+ }
407
+ };
408
+ const iconPath = computed(() => props.path ?? getMazIconPath());
409
+ const fullSrc = computed(() => {
410
+ if (props.src) {
411
+ return props.src;
412
+ } else if (iconPath.value) {
413
+ return `${iconPath.value}/${props.name}.svg`;
414
+ } else {
415
+ return `/${props.name}.svg`;
416
+ }
417
+ });
418
+ onMounted(() => {
419
+ if (!props.name && !props.src) {
420
+ console.error(
421
+ '[maz-ui](MazIcon) you should provide "name" or "src" as prop'
422
+ );
423
+ }
424
+ });
425
+ const setTitle = (svg, title) => {
426
+ const titleTags = svg.querySelectorAll("title");
427
+ if (titleTags.length > 0) {
428
+ titleTags[0].textContent = title;
429
+ } else {
430
+ const titleEl = document.createElementNS(
431
+ "http://www.w3.org/2000/svg",
432
+ "title"
433
+ );
434
+ titleEl.textContent = title;
435
+ svg.append(titleEl);
436
+ }
437
+ };
438
+ const filterAttrs = (attrs) => {
439
+ return Object.keys(attrs).reduce((result, key) => {
440
+ if (attrs[key] !== false && attrs[key] !== null && attrs[key] !== void 0) {
441
+ result[key] = attrs[key];
442
+ }
443
+ return result;
444
+ }, {});
445
+ };
446
+ const getSvgAttrs = (svgEl) => {
447
+ const svgAttrs = {};
448
+ const attrs = svgEl.attributes;
449
+ if (!attrs) {
450
+ return svgAttrs;
451
+ }
452
+ for (let i = attrs.length - 1; i >= 0; i--) {
453
+ svgAttrs[attrs[i].name] = attrs[i].value;
454
+ }
455
+ return svgAttrs;
456
+ };
457
+ const getSvgContent = (svgEl) => {
458
+ let svgElNode = svgEl.cloneNode(true);
459
+ svgElNode = props.transformSource(svgEl);
460
+ if (props.title) {
461
+ setTitle(svgElNode, props.title);
462
+ }
463
+ return svgEl.innerHTML;
464
+ };
465
+ const getSource = async (src) => {
466
+ if (!cache[src]) {
467
+ cache[src] = download(src);
468
+ }
469
+ try {
470
+ svgElSource.value = await cache[src];
471
+ await nextTick();
472
+ emits("loaded", svgElem.value);
473
+ } catch (error) {
474
+ if (svgElSource.value) {
475
+ svgElSource.value = void 0;
476
+ emits("unloaded");
477
+ }
478
+ delete cache[src];
479
+ emits("error", error);
480
+ }
481
+ };
482
+ const download = (url) => {
483
+ return new Promise((resolve, reject) => {
484
+ const request = new XMLHttpRequest();
485
+ request.open("GET", url, true);
486
+ request.addEventListener("load", () => {
487
+ if (request.status >= 200 && request.status < 400) {
488
+ try {
489
+ const parser = new DOMParser();
490
+ const result = parser.parseFromString(
491
+ request.responseText,
492
+ "text/xml"
493
+ );
494
+ let svgEl = result.querySelectorAll("svg")[0];
495
+ if (svgEl) {
496
+ svgEl = props.transformSource(svgEl);
497
+ resolve(svgEl);
498
+ } else {
499
+ reject(new Error('Loaded file is not valid SVG"'));
500
+ }
501
+ } catch (error) {
502
+ reject(error);
503
+ }
504
+ } else {
505
+ reject(new Error("Error loading SVG"));
506
+ }
507
+ });
508
+ request.addEventListener("error", () => reject());
509
+ request.send();
510
+ });
511
+ };
512
+ watchEffect(() => getSource(fullSrc.value));
513
+ return (_ctx, _cache) => {
514
+ return svgElSource.value ? (openBlock(), createElementBlock("svg", mergeProps({
515
+ key: 0,
516
+ ref_key: "svgElem",
517
+ ref: svgElem,
518
+ width: "1em",
519
+ height: "1em"
520
+ }, {
521
+ ...getSvgAttrs(svgElSource.value),
522
+ ...filterAttrs(_ctx.$attrs)
523
+ }, {
524
+ style: `font-size: ${__props.size}`,
525
+ innerHTML: getSvgContent(svgElSource.value)
526
+ }), null, 16, _hoisted_1$1)) : createCommentVNode("", true);
527
+ };
528
+ }
529
+ });
530
+ const PencilIcon = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIGFyaWEtaGlkZGVuPSJ0cnVlIj4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIgZD0iTTE1LjIzMiA1LjIzMmwzLjUzNiAzLjUzNm0tMi4wMzYtNS4wMzZhMi41IDIuNSAwIDExMy41MzYgMy41MzZMNi41IDIxLjAzNkgzdi0zLjU3MkwxNi43MzIgMy43MzJ6Ii8+Cjwvc3ZnPgo=";
531
+ const _hoisted_1 = ["tabindex"];
532
+ const _hoisted_2 = { class: "m-avatar__initial" };
533
+ const _hoisted_3 = {
534
+ key: 0,
535
+ class: "m-avatar__caption"
536
+ };
537
+ const _sfc_main = /* @__PURE__ */ defineComponent({
538
+ __name: "MazAvatar",
539
+ props: {
540
+ src: {
541
+ type: String,
542
+ default: void 0
543
+ },
544
+ caption: {
545
+ type: String,
546
+ default: void 0
547
+ },
548
+ href: { type: String, default: void 0 },
549
+ to: { type: Object, default: void 0 },
550
+ alt: { type: String, default: "avatar image" },
551
+ target: { type: String, default: "_self" },
552
+ size: { type: String, default: void 0 },
553
+ bordered: { type: Boolean, default: false },
554
+ clickable: { type: Boolean, default: false },
555
+ square: { type: Boolean, default: false },
556
+ noElevation: { type: Boolean, default: false },
557
+ showCaption: { type: Boolean, default: false },
558
+ imageHeightFull: { type: Boolean, default: false },
559
+ noLoader: { type: Boolean, default: false },
560
+ buttonColor: {
561
+ type: String,
562
+ default: "info",
563
+ validator: (value) => {
564
+ return [
565
+ "primary",
566
+ "secondary",
567
+ "info",
568
+ "success",
569
+ "warning",
570
+ "danger",
571
+ "white",
572
+ "black",
573
+ "transparent"
574
+ ].includes(value);
575
+ }
576
+ }
577
+ },
578
+ emits: ["click"],
579
+ setup(__props) {
580
+ const props = __props;
581
+ const componentType = computed(
582
+ () => props.to ? "RouterLink" : props.href ? "a" : "div"
583
+ );
584
+ const isLink = computed(() => !!props.to || !!props.href);
585
+ return (_ctx, _cache) => {
586
+ return openBlock(), createBlock(resolveDynamicComponent(unref(componentType)), mergeProps({
587
+ style: { fontSize: __props.size },
588
+ class: ["m-avatar", [
589
+ {
590
+ "--has-link": unref(isLink)
591
+ }
592
+ ]]
593
+ }, _ctx.$attrs, {
594
+ href: __props.href,
595
+ to: __props.to,
596
+ target: unref(isLink) ? __props.target : void 0
597
+ }), {
598
+ default: withCtx(() => [
599
+ createElementVNode("div", {
600
+ class: normalizeClass(["m-avatar__wrapper", {
601
+ "--has-shadow": !__props.noElevation,
602
+ "--bordered": __props.bordered,
603
+ "--clickable": __props.clickable,
604
+ "--square": __props.square,
605
+ "--has-initial": !__props.src && __props.caption
606
+ }]),
607
+ tabindex: __props.clickable ? 0 : -1,
608
+ onKeydown: _cache[2] || (_cache[2] = withKeys(($event) => __props.clickable ? _ctx.$emit("click", $event) : void 0, ["enter"]))
609
+ }, [
610
+ __props.src ? (openBlock(), createBlock(MazLazyImg, {
611
+ key: 0,
612
+ class: "m-avatar__picture maz-max-w-full",
613
+ image: __props.src,
614
+ alt: __props.alt,
615
+ "image-height-full": "",
616
+ "no-loader": __props.noLoader,
617
+ onClick: _cache[0] || (_cache[0] = ($event) => __props.clickable ? _ctx.$emit("click", $event) : null)
618
+ }, null, 8, ["image", "alt", "no-loader"])) : createCommentVNode("", true),
619
+ __props.caption && !__props.src ? renderSlot(_ctx.$slots, "round-text", { key: 1 }, () => {
620
+ var _a;
621
+ return [
622
+ createElementVNode("span", _hoisted_2, toDisplayString((_a = __props.caption) == null ? void 0 : _a.charAt(0)), 1)
623
+ ];
624
+ }, true) : createCommentVNode("", true),
625
+ __props.clickable ? (openBlock(), createElementBlock("button", {
626
+ key: 2,
627
+ type: "button",
628
+ tabindex: "-1",
629
+ class: "m-avatar__button",
630
+ style: normalizeStyle({
631
+ backgroundColor: __props.src ? `var(--maz-color-${__props.buttonColor}-alpha)` : `var(--maz-color-${__props.buttonColor})`
632
+ }),
633
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("click", $event))
634
+ }, [
635
+ renderSlot(_ctx.$slots, "icon", {}, () => [
636
+ createVNode(_sfc_main$1, {
637
+ src: unref(PencilIcon),
638
+ class: "m-avatar__button__icon"
639
+ }, null, 8, ["src"])
640
+ ], true)
641
+ ], 4)) : createCommentVNode("", true)
642
+ ], 42, _hoisted_1),
643
+ renderSlot(_ctx.$slots, "caption", {}, () => [
644
+ __props.showCaption && __props.caption ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.caption), 1)) : createCommentVNode("", true)
645
+ ], true)
646
+ ]),
647
+ _: 3
648
+ }, 16, ["style", "class", "href", "to", "target"]);
649
+ };
650
+ }
651
+ });
652
+ const MazAvatar_vue_vue_type_style_index_0_scoped_319e07de_lang = "";
653
+ const MazAvatar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-319e07de"]]);
654
+ export {
655
+ MazAvatar as default
656
+ };