maz-ui 2.3.12 → 3.0.0-beta.4

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 (251) hide show
  1. package/.browserslistrc +3 -0
  2. package/.editorconfig +13 -0
  3. package/.eslintignore +2 -0
  4. package/.eslintrc.js +38 -0
  5. package/.prettierignore +2 -0
  6. package/.prettierrc +12 -0
  7. package/.vscode/settings.json +21 -0
  8. package/Makefile +79 -0
  9. package/babel.config.js +17 -0
  10. package/build/rollup.config.js +207 -0
  11. package/jest.config.js +7 -0
  12. package/package/components/MazArrowIcon.vue +53 -0
  13. package/package/components/MazAvatar.vue +178 -0
  14. package/package/components/MazBackDrop.vue +230 -0
  15. package/package/components/MazBottomSheet.vue +69 -0
  16. package/package/components/MazBtn.vue +555 -0
  17. package/package/components/MazCard.vue +314 -0
  18. package/package/components/MazCheckbox.vue +313 -0
  19. package/package/components/MazDialog.vue +86 -0
  20. package/package/components/MazDropzone/index.vue +718 -0
  21. package/package/components/MazGallery.vue +286 -0
  22. package/package/components/MazIcon.vue +173 -0
  23. package/package/components/MazInput.vue +449 -0
  24. package/package/components/MazInputPrice.vue +88 -0
  25. package/package/components/MazLazyImg.vue +85 -0
  26. package/package/components/MazPhoneNumberInput/constantes/locales.ts +10 -0
  27. package/package/components/MazPhoneNumberInput/css/flags.css +1300 -0
  28. package/package/components/MazPhoneNumberInput/index.vue +559 -0
  29. package/package/components/MazPhoneNumberInput/types.ts +28 -0
  30. package/package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.ts +254 -0
  31. package/package/components/MazPhoneNumberInput/utils/index.ts +178 -0
  32. package/package/components/MazSelect.vue +366 -0
  33. package/package/components/MazSpinner.vue +88 -0
  34. package/package/components/MazTransitionExpand.vue +74 -0
  35. package/package/components/index.ts +18 -0
  36. package/package/components/types.ts +90 -0
  37. package/package/components_tmp/MazBadge.vue +148 -0
  38. package/package/components_tmp/MazBtnGroup.vue +47 -0
  39. package/package/components_tmp/MazCalendar/Calendar.vue +471 -0
  40. package/package/components_tmp/MazCalendar/CalendarBanner.vue +14 -0
  41. package/package/components_tmp/MazCalendar/CalendarDays.vue +83 -0
  42. package/package/components_tmp/MazCalendar/CalendarEmptySlots.vue +12 -0
  43. package/package/components_tmp/MazCalendar/CalendarFooter.vue +26 -0
  44. package/package/components_tmp/MazCalendar/CalendarLoader.vue +17 -0
  45. package/package/components_tmp/MazCalendar/CalendarSlot.vue +149 -0
  46. package/package/components_tmp/MazCalendar/CalendarSlots.vue +62 -0
  47. package/package/components_tmp/MazCalendar/CalendarSlotsButton.vue +41 -0
  48. package/package/components_tmp/MazCalendar/CalendarWeekButton.vue +47 -0
  49. package/package/components_tmp/MazCalendar/types.ts +17 -0
  50. package/package/components_tmp/MazCarousel.vue +172 -0
  51. package/package/components_tmp/MazChart/MazChart.vue +165 -0
  52. package/package/components_tmp/MazChart/includes.ts +56 -0
  53. package/package/components_tmp/MazCollapse/MazCollapse.vue +95 -0
  54. package/package/components_tmp/MazCollapse.vue +41 -0
  55. package/package/components_tmp/MazConfirmDialog.vue +36 -0
  56. package/package/components_tmp/MazDraggableList/MazDraggableList.vue +85 -0
  57. package/package/components_tmp/MazDrawer.vue +91 -0
  58. package/package/components_tmp/MazDropdown.vue +87 -0
  59. package/package/components_tmp/MazInputNumber/index.vue +145 -0
  60. package/package/components_tmp/MazInputTags.vue +136 -0
  61. package/package/components_tmp/MazLeaflet/index.vue +195 -0
  62. package/package/components_tmp/MazMap/NMap.vue +69 -0
  63. package/package/components_tmp/MazMap/map-module/create-html-marker.ts +98 -0
  64. package/package/components_tmp/MazMap/map-module/map.ts +145 -0
  65. package/package/components_tmp/MazMap/map-module/script-loader.ts +86 -0
  66. package/package/components_tmp/MazNavBar/MazNavBar.vue +180 -0
  67. package/package/components_tmp/MazPromiseDialog/MazPromiseDialog.vue +47 -0
  68. package/package/components_tmp/MazPromiseDialog/use-maz-promise-dialog.ts +70 -0
  69. package/package/components_tmp/MazSlider/MazSlider.vue +453 -0
  70. package/package/components_tmp/MazSlider/utils.ts +72 -0
  71. package/package/components_tmp/MazTabs/MazTabsBar.vue +141 -0
  72. package/package/components_tmp/MazTabs/MazTabsContent.vue +41 -0
  73. package/package/components_tmp/MazTabs/MazTabsContentItem.vue +55 -0
  74. package/package/components_tmp/MazTabs/maz-tabs.composable.ts +9 -0
  75. package/package/components_tmp/index.vue +97 -0
  76. package/package/components_tmp/toaster/NToast.vue +292 -0
  77. package/package/components_tmp/toaster/index.ts +19 -0
  78. package/package/components_tmp/toaster/positions.ts +8 -0
  79. package/package/components_tmp/toaster/timer.ts +31 -0
  80. package/package/components_tmp/toaster/use-toast.ts +70 -0
  81. package/package/directives/click-outside.directive.ts +63 -0
  82. package/package/directives/closable.directive.ts +63 -0
  83. package/package/directives/index.ts +13 -0
  84. package/package/directives/v-lazy-img/assets/no_photo.svg +8 -0
  85. package/package/directives/v-lazy-img/index.ts +34 -0
  86. package/package/directives/v-lazy-img/lazy-img-handler.ts +305 -0
  87. package/package/directives/v-lazy-img/lazy-img.directive.ts +20 -0
  88. package/package/directives/v-lazy-img/types.ts +54 -0
  89. package/package/directives/zoom-img.directive.ts +455 -0
  90. package/package/filters/capitalize.ts +6 -0
  91. package/package/filters/currency.ts +63 -0
  92. package/package/filters/date.ts +28 -0
  93. package/package/filters/index.ts +5 -0
  94. package/package/filters/number.ts +21 -0
  95. package/package/filters/telephone.ts +10 -0
  96. package/package/index.esm.ts +24 -0
  97. package/package/index.ts +24 -0
  98. package/package/tailwindcss/css/_subs/animation.css +187 -0
  99. package/package/tailwindcss/css/_subs/colors-vars.css +116 -0
  100. package/package/tailwindcss/css/_subs/each-colors-vars.css +2 -0
  101. package/package/tailwindcss/css/_subs/padded-container-vars.css +44 -0
  102. package/package/tailwindcss/css/_subs/reset.css +7 -0
  103. package/package/tailwindcss/css/tailwind.css +8 -0
  104. package/package/tailwindcss/tailwind.config.js +75 -0
  105. package/package/tailwindcss/utils/colors.js +28 -0
  106. package/package/tailwindcss/variables/breakpoints.js +14 -0
  107. package/package/tailwindcss/variables/colors.js +36 -0
  108. package/package/tailwindcss/variables/utilities.js +25 -0
  109. package/package/tailwindcss/variables/z-indexes.js +14 -0
  110. package/package/utils/debounce.ts +74 -0
  111. package/package/utils/index.ts +1 -0
  112. package/package/utils/injectStrict.ts +11 -0
  113. package/package.json +104 -85
  114. package/postcss.config.js +10 -0
  115. package/stylelint.config.js +16 -0
  116. package/tailwind.config.js +10 -0
  117. package/tsconfig.json +30 -0
  118. package/types/shims-vue.d.ts +9 -0
  119. package/types/svg.d.ts +5 -0
  120. package/LICENSE +0 -21
  121. package/README.md +0 -66
  122. package/bin/index.js +0 -63
  123. package/bin/lib/_constantes/default-colors.js +0 -69
  124. package/bin/lib/index.d.ts +0 -2
  125. package/bin/lib/index.js +0 -145
  126. package/bin/lib/methods/generate-root-css.js +0 -49
  127. package/bin/lib/methods/get-theme-settings.js +0 -58
  128. package/bin/lib/methods/set-css-vars.js +0 -11
  129. package/lib/css/base.css +0 -1
  130. package/lib/css/index.css +0 -1
  131. package/lib/css/maz-avatar.css +0 -1
  132. package/lib/css/maz-bottom-sheet.css +0 -1
  133. package/lib/css/maz-btn-group.css +0 -1
  134. package/lib/css/maz-btn.css +0 -0
  135. package/lib/css/maz-card.css +0 -1
  136. package/lib/css/maz-carousel.css +0 -1
  137. package/lib/css/maz-checkbox.css +0 -1
  138. package/lib/css/maz-collapse.css +0 -1
  139. package/lib/css/maz-dialog.css +0 -1
  140. package/lib/css/maz-draggable-list.css +0 -1
  141. package/lib/css/maz-dropdown.css +0 -1
  142. package/lib/css/maz-dropzone.css +0 -1
  143. package/lib/css/maz-flex.css +0 -0
  144. package/lib/css/maz-gallery.css +0 -0
  145. package/lib/css/maz-img.css +0 -1
  146. package/lib/css/maz-input-tags.css +0 -1
  147. package/lib/css/maz-input.css +0 -0
  148. package/lib/css/maz-list-item.css +0 -1
  149. package/lib/css/maz-list.css +0 -1
  150. package/lib/css/maz-loader.css +0 -0
  151. package/lib/css/maz-pagination.css +0 -1
  152. package/lib/css/maz-phone-number-input.css +0 -1
  153. package/lib/css/maz-picker.css +0 -1
  154. package/lib/css/maz-plotly.css +0 -0
  155. package/lib/css/maz-progress-bar.css +0 -1
  156. package/lib/css/maz-radio.css +0 -1
  157. package/lib/css/maz-read-more.css +0 -1
  158. package/lib/css/maz-responsive-menu.css +0 -1
  159. package/lib/css/maz-search.css +0 -1
  160. package/lib/css/maz-select.css +0 -0
  161. package/lib/css/maz-sidebar.css +0 -1
  162. package/lib/css/maz-slider.css +0 -1
  163. package/lib/css/maz-spinner.css +0 -0
  164. package/lib/css/maz-stepper.css +0 -1
  165. package/lib/css/maz-switch.css +0 -1
  166. package/lib/css/maz-tabs-bar.css +0 -1
  167. package/lib/css/maz-tabs-content-item.css +0 -1
  168. package/lib/css/maz-tabs-content.css +0 -1
  169. package/lib/css/maz-transition-expand.css +0 -0
  170. package/lib/index.d.ts +0 -1
  171. package/lib/index.js +0 -1
  172. package/lib/maz-avatar.d.ts +0 -3
  173. package/lib/maz-avatar.js +0 -430
  174. package/lib/maz-bottom-sheet.d.ts +0 -3
  175. package/lib/maz-bottom-sheet.js +0 -1045
  176. package/lib/maz-btn-group.d.ts +0 -3
  177. package/lib/maz-btn-group.js +0 -907
  178. package/lib/maz-btn.d.ts +0 -3
  179. package/lib/maz-btn.js +0 -764
  180. package/lib/maz-card.d.ts +0 -3
  181. package/lib/maz-card.js +0 -572
  182. package/lib/maz-carousel.d.ts +0 -3
  183. package/lib/maz-carousel.js +0 -569
  184. package/lib/maz-checkbox.d.ts +0 -3
  185. package/lib/maz-checkbox.js +0 -359
  186. package/lib/maz-collapse.d.ts +0 -3
  187. package/lib/maz-collapse.js +0 -1238
  188. package/lib/maz-dialog.d.ts +0 -3
  189. package/lib/maz-dialog.js +0 -1315
  190. package/lib/maz-draggable-list.d.ts +0 -3
  191. package/lib/maz-draggable-list.js +0 -439
  192. package/lib/maz-dropdown.d.ts +0 -3
  193. package/lib/maz-dropdown.js +0 -438
  194. package/lib/maz-dropzone.d.ts +0 -3
  195. package/lib/maz-dropzone.js +0 -664
  196. package/lib/maz-flex.d.ts +0 -3
  197. package/lib/maz-flex.js +0 -427
  198. package/lib/maz-gallery.d.ts +0 -3
  199. package/lib/maz-gallery.js +0 -672
  200. package/lib/maz-img.d.ts +0 -3
  201. package/lib/maz-img.js +0 -612
  202. package/lib/maz-input-tags.d.ts +0 -3
  203. package/lib/maz-input-tags.js +0 -1207
  204. package/lib/maz-input.d.ts +0 -3
  205. package/lib/maz-input.js +0 -1076
  206. package/lib/maz-list-item.d.ts +0 -3
  207. package/lib/maz-list-item.js +0 -304
  208. package/lib/maz-list.d.ts +0 -3
  209. package/lib/maz-list.js +0 -331
  210. package/lib/maz-loader.d.ts +0 -3
  211. package/lib/maz-loader.js +0 -304
  212. package/lib/maz-pagination.d.ts +0 -3
  213. package/lib/maz-pagination.js +0 -1414
  214. package/lib/maz-phone-number-input.d.ts +0 -3
  215. package/lib/maz-phone-number-input.js +0 -3782
  216. package/lib/maz-picker.d.ts +0 -3
  217. package/lib/maz-picker.js +0 -6474
  218. package/lib/maz-plotly.d.ts +0 -3
  219. package/lib/maz-plotly.js +0 -500
  220. package/lib/maz-progress-bar.d.ts +0 -3
  221. package/lib/maz-progress-bar.js +0 -398
  222. package/lib/maz-radio.d.ts +0 -3
  223. package/lib/maz-radio.js +0 -358
  224. package/lib/maz-read-more.d.ts +0 -3
  225. package/lib/maz-read-more.js +0 -344
  226. package/lib/maz-responsive-menu.d.ts +0 -3
  227. package/lib/maz-responsive-menu.js +0 -438
  228. package/lib/maz-search.d.ts +0 -3
  229. package/lib/maz-search.js +0 -1590
  230. package/lib/maz-select.d.ts +0 -3
  231. package/lib/maz-select.js +0 -2740
  232. package/lib/maz-sidebar.d.ts +0 -3
  233. package/lib/maz-sidebar.js +0 -815
  234. package/lib/maz-slider.d.ts +0 -3
  235. package/lib/maz-slider.js +0 -1014
  236. package/lib/maz-spinner.d.ts +0 -3
  237. package/lib/maz-spinner.js +0 -328
  238. package/lib/maz-stepper.d.ts +0 -3
  239. package/lib/maz-stepper.js +0 -1011
  240. package/lib/maz-switch.d.ts +0 -3
  241. package/lib/maz-switch.js +0 -375
  242. package/lib/maz-tabs-bar.d.ts +0 -3
  243. package/lib/maz-tabs-bar.js +0 -428
  244. package/lib/maz-tabs-content-item.d.ts +0 -3
  245. package/lib/maz-tabs-content-item.js +0 -376
  246. package/lib/maz-tabs-content.d.ts +0 -3
  247. package/lib/maz-tabs-content.js +0 -367
  248. package/lib/maz-transition-expand.d.ts +0 -3
  249. package/lib/maz-transition-expand.js +0 -328
  250. package/lib/maz-ui.common.d.ts +0 -1
  251. package/lib/maz-ui.common.js +0 -17208
@@ -0,0 +1,3 @@
1
+ > 1%
2
+ last 2 versions
3
+ ie > 10
package/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ dist
2
+ package/components_tmp
package/.eslintrc.js ADDED
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ browser: true,
5
+ es2021: true,
6
+ node: true,
7
+ },
8
+ globals: {
9
+ defineProps: 'readonly',
10
+ defineEmits: 'readonly',
11
+ defineExpose: 'readonly',
12
+ withDefaults: 'readonly',
13
+ },
14
+ plugins: ['vue', 'prettier', 'unicorn'],
15
+ extends: [
16
+ 'plugin:vue/vue3-recommended',
17
+ 'eslint:recommended',
18
+ '@vue/eslint-config-prettier',
19
+ '@vue/eslint-config-typescript/recommended',
20
+ ],
21
+ parserOptions: {
22
+ ecmaVersion: 2021,
23
+ },
24
+ rules: {
25
+ 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
26
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
27
+ 'vue/component-name-in-template-casing': [
28
+ 'error',
29
+ 'PascalCase',
30
+ {
31
+ registeredComponentsOnly: false,
32
+ ignores: [],
33
+ },
34
+ ],
35
+ 'prettier/prettier': ['error', {}, { usePrettierrc: true }],
36
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
37
+ },
38
+ }
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ lib
package/.prettierrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "quoteProps": "as-needed",
6
+ "trailingComma": "all",
7
+ "bracketSpacing": true,
8
+ "arrowParens": "always",
9
+ "printWidth": 80,
10
+ "endOfLine": "auto",
11
+ "vueIndentScriptAndStyle": true
12
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.eslint": true,
5
+ "source.fixAll.stylelint": true
6
+ },
7
+ "eslint.validate": ["vue", "javascript", "typescript"],
8
+ "eslint.packageManager": "npm",
9
+ "editor.quickSuggestions": {
10
+ "other": true,
11
+ "comments": false,
12
+ "strings": true
13
+ },
14
+ "css.validate": false,
15
+ "emmet.includeLanguages": {
16
+ "javascript": "javascriptreact",
17
+ "vue-html": "html",
18
+ "razor": "html",
19
+ "plaintext": "jade"
20
+ }
21
+ }
package/Makefile ADDED
@@ -0,0 +1,79 @@
1
+ .PHONY: lint build install reinstall lint-staged
2
+
3
+ lint:
4
+ npm run lint
5
+
6
+ build:
7
+ make clean-build && npm run build
8
+
9
+ clean-build:
10
+ npm run clean
11
+
12
+ build-watch:
13
+ npm run build:watch
14
+
15
+ install:
16
+ npm i
17
+
18
+ reinstall:
19
+ rm -rf ./node_modules
20
+ rm package-lock.json
21
+ npm i
22
+
23
+ lint-staged: ## lint-staged
24
+ npm run pre-commit
25
+
26
+ define GetFromPkg
27
+ $(shell node -p "require('./package.json').$(1)")
28
+ endef
29
+
30
+ define bump-version
31
+ VERSION=`node -pe "require('./package.json').version"` && \
32
+ NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
33
+ npm version $$NEXT_VERSION
34
+ endef
35
+
36
+ define bump-version-tag
37
+ VERSION=`node -pe "require('./package.json').version"` && \
38
+ NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", 'prerelease', '$(1)')"` && \
39
+ npm version $$NEXT_VERSION
40
+ endef
41
+
42
+ define push-version
43
+ @$(call bump-version,$(1))
44
+ make install
45
+ make clean-build
46
+ make build
47
+ git add --all
48
+ git commit -m "chore: pre-build"
49
+ # npm publish
50
+ # git push origin HEAD
51
+ endef
52
+
53
+ define push-version-tag
54
+ @$(call bump-version-tag,$(1))
55
+ make install
56
+ make clean-build
57
+ make build
58
+ npm publish --tag $(1)
59
+ git add --all
60
+ git commit -m "chore(lib): bump-version $(1)"
61
+ git push origin HEAD
62
+ endef
63
+
64
+ commit:
65
+ git add --all
66
+ git commit -m "chore(lib): bump-version to $(call GetFromPkg,version)"
67
+ git push origin HEAD
68
+
69
+ publish-version-tag:
70
+ @$(call push-version-tag,$(tag))
71
+
72
+ publish-version:
73
+ @$(call push-version,patch)
74
+
75
+ publish-version-minor:
76
+ @$(call push-version,minor)
77
+
78
+ publish-version-major:
79
+ @$(call push-version,major)
@@ -0,0 +1,17 @@
1
+ const devPresets = ['@vue/babel-preset-app']
2
+ const buildPresets = [
3
+ [
4
+ '@babel/preset-env',
5
+ // Config for @babel/preset-env
6
+ {
7
+ // Example: Always transpile optional chaining/nullish coalescing
8
+ // include: [
9
+ // /(optional-chaining|nullish-coalescing)/
10
+ // ],
11
+ },
12
+ ],
13
+ '@babel/preset-typescript',
14
+ ]
15
+ module.exports = {
16
+ presets: process.env.NODE_ENV === 'development' ? devPresets : buildPresets,
17
+ }
@@ -0,0 +1,207 @@
1
+ // rollup.config.js
2
+ import { readFileSync } from 'fs'
3
+ import { resolve } from 'path'
4
+
5
+ import vue from 'rollup-plugin-vue'
6
+ import alias from '@rollup/plugin-alias'
7
+ import nodeResolve from '@rollup/plugin-node-resolve'
8
+ import replace from '@rollup/plugin-replace'
9
+ import babel from '@rollup/plugin-babel'
10
+ import url from '@rollup/plugin-url'
11
+
12
+ import PostCSS from 'rollup-plugin-postcss'
13
+ import nested from 'postcss-nested'
14
+ import simpleVars from 'postcss-simple-vars'
15
+ import postcssImport from 'postcss-import'
16
+ import postcssUrl from 'postcss-url'
17
+ import autoprefixer from 'autoprefixer'
18
+
19
+ import { terser } from 'rollup-plugin-terser'
20
+ import ttypescript from 'ttypescript'
21
+ import typescript from 'rollup-plugin-typescript2'
22
+ import minimist from 'minimist'
23
+ import commonjs from '@rollup/plugin-commonjs'
24
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external'
25
+
26
+ const INPUT_ENTRY = './package/index.ts'
27
+ const COMPONENT_INPUT = './package/components/index.ts'
28
+
29
+ // Get browserslist config and remove ie from es build targets
30
+ const esbrowserslist = readFileSync('./.browserslistrc')
31
+ .toString()
32
+ .split('\n')
33
+ .filter((entry) => entry && entry.substring(0, 2) !== 'ie')
34
+
35
+ // Extract babel preset-env config, to combine with esbrowserslist
36
+ const babelPresetEnvConfig = require('../babel.config').presets.filter(
37
+ (entry) => entry[0] === '@babel/preset-env',
38
+ )[0][1]
39
+
40
+ const argv = minimist(process.argv.slice(2))
41
+
42
+ const projectRoot = resolve(__dirname, '..')
43
+
44
+ const postcssConfigList = [
45
+ postcssImport({
46
+ resolve(id, basedir) {
47
+ // resolve alias @css, @import '@css/style.css'
48
+ // because @css/ has 5 chars
49
+ if (id.startsWith('@css')) {
50
+ return resolve('./tailwindcss/css', id.slice(5))
51
+ }
52
+ // resolve node_modules, @import '~normalize.css/normalize.css'
53
+ // similar to how css-loader's handling of node_modules
54
+ if (id.startsWith('~')) {
55
+ return resolve('./node_modules', id.slice(1))
56
+ }
57
+ // resolve relative path, @import './components/style.css'
58
+ return resolve(basedir, id)
59
+ },
60
+ }),
61
+ nested,
62
+ simpleVars,
63
+ postcssUrl({ url: 'inline' }),
64
+ autoprefixer({
65
+ overrideBrowserslist: '> 1%, IE 6, Explorer >= 10, Safari >= 7',
66
+ }),
67
+ ]
68
+
69
+ const baseConfig = {
70
+ input: INPUT_ENTRY,
71
+ plugins: {
72
+ preVue: [
73
+ alias({
74
+ entries: [
75
+ {
76
+ find: '@',
77
+ replacement: `${resolve(projectRoot, 'src')}`,
78
+ },
79
+ ],
80
+ }),
81
+ ],
82
+ replace: {
83
+ preventAssignment: true,
84
+ 'process.env.NODE_ENV': JSON.stringify('production'),
85
+ },
86
+ vue: {
87
+ target: 'browser',
88
+ preprocessStyles: true,
89
+ postcssPlugins: [...postcssConfigList],
90
+ },
91
+ postVue: [
92
+ nodeResolve({
93
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
94
+ }),
95
+ // Process only `<style module>` blocks.
96
+ PostCSS({
97
+ modules: {
98
+ generateScopedName: '[local]___[hash:base64:5]',
99
+ },
100
+ include: /&module=.*\.css$/,
101
+ plugins: postcssConfigList,
102
+ }),
103
+ // Process all `<style>` blocks except `<style module>`.
104
+ PostCSS({ include: /(?<!&module=.*)\.css$/ }),
105
+ commonjs(),
106
+ url({
107
+ include: ['**/*.svg', '**/*.png', '**/*.gif', '**/*.jpg', '**/*.jpeg'],
108
+ }),
109
+ ],
110
+ babel: {
111
+ exclude: 'node_modules/**',
112
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
113
+ babelHelpers: 'runtime',
114
+ plugins: ['@babel/plugin-transform-runtime'],
115
+ },
116
+ },
117
+ }
118
+
119
+ // ESM/UMD/IIFE shared settings: externals
120
+ // Refer to https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
121
+ const external = [
122
+ // list external dependencies, exactly the way it is written in the import statement.
123
+ // eg. 'jquery'
124
+ 'vue',
125
+ ]
126
+
127
+ // UMD/IIFE shared settings: output.globals
128
+ // Refer to https://rollupjs.org/guide/en#output-globals for details
129
+ const globals = {
130
+ // Provide global variable names to replace your external imports
131
+ // eg. jquery: '$'
132
+ vue: 'Vue',
133
+ }
134
+
135
+ // Customize configs for individual targets
136
+ const buildFormats = []
137
+
138
+ if (!argv.format || argv.format === 'es') {
139
+ const esConfig = {
140
+ ...baseConfig,
141
+ input: COMPONENT_INPUT,
142
+ external,
143
+ output: {
144
+ dir: 'dist',
145
+ format: 'esm',
146
+ sourcemap: true,
147
+ exports: 'named',
148
+ },
149
+ plugins: [
150
+ peerDepsExternal(),
151
+ replace(baseConfig.plugins.replace),
152
+ ...baseConfig.plugins.preVue,
153
+ vue(baseConfig.plugins.vue),
154
+ ...baseConfig.plugins.postVue,
155
+ // Only use typescript for declarations - babel will
156
+ // do actual js transformations
157
+ typescript({
158
+ typescript: ttypescript,
159
+ useTsconfigDeclarationDir: true,
160
+ emitDeclarationOnly: true,
161
+ }),
162
+ babel({
163
+ ...baseConfig.plugins.babel,
164
+ presets: [
165
+ [
166
+ '@babel/preset-env',
167
+ {
168
+ ...babelPresetEnvConfig,
169
+ targets: esbrowserslist,
170
+ },
171
+ ],
172
+ ],
173
+ }),
174
+ terser({ output: { ecma: 5 } }),
175
+ ],
176
+ }
177
+ buildFormats.push(esConfig)
178
+ }
179
+
180
+ if (!argv.format || argv.format === 'cjs') {
181
+ const umdConfig = {
182
+ ...baseConfig,
183
+ external,
184
+ output: {
185
+ compact: true,
186
+ dir: 'dist/cjs',
187
+ format: 'cjs',
188
+ name: 'MazUi',
189
+ exports: 'named',
190
+ sourcemap: true,
191
+ globals,
192
+ },
193
+ plugins: [
194
+ peerDepsExternal(),
195
+ replace(baseConfig.plugins.replace),
196
+ ...baseConfig.plugins.preVue,
197
+ vue(baseConfig.plugins.vue),
198
+ ...baseConfig.plugins.postVue,
199
+ babel(baseConfig.plugins.babel),
200
+ terser({ output: { ecma: 5 } }),
201
+ ],
202
+ }
203
+ buildFormats.push(umdConfig)
204
+ }
205
+
206
+ // Export config
207
+ export default buildFormats
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ transform: {
3
+ '^.+\\.tsx?$': 'ts-jest',
4
+ '^.+\\.vue$': 'vue-jest',
5
+ },
6
+ moduleFileExtensions: ['js', 'ts', 'json', 'vue'],
7
+ }
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <svg
3
+ mlns="http://www.w3.org/2000/svg"
4
+ :width="size"
5
+ :height="size"
6
+ viewBox="0 0 24 24"
7
+ class="maz-arrow-icon"
8
+ :class="[{ 'is-white': dark }, orientation]"
9
+ >
10
+ <path
11
+ :fill="hex"
12
+ :class="[hex]"
13
+ class="arrow"
14
+ d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
15
+ />
16
+ <path fill="none" d="M0 0h24v24H0V0z" />
17
+ </svg>
18
+ </template>
19
+
20
+ <script lang="ts" setup>
21
+ defineProps({
22
+ dark: { type: Boolean, default: false },
23
+ hex: { type: String, default: undefined },
24
+ size: { type: Number, default: 24 },
25
+ orientation: { type: String, default: 'bottom' },
26
+ })
27
+ </script>
28
+
29
+ <style lang="postcss" scoped>
30
+ .maz-arrow-icon {
31
+ transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
32
+
33
+ path.arrow {
34
+ @apply maz-fill-current;
35
+ }
36
+
37
+ &.is-white path.arrow {
38
+ fill: white;
39
+ }
40
+
41
+ &.top {
42
+ transform: rotate(180deg);
43
+ }
44
+
45
+ &.right {
46
+ transform: rotate(-90deg);
47
+ }
48
+
49
+ &.left {
50
+ transform: rotate(90deg);
51
+ }
52
+ }
53
+ </style>
@@ -0,0 +1,178 @@
1
+ <template>
2
+ <Component
3
+ :is="componentType"
4
+ :style="{ fontSize: size }"
5
+ class="m-avatar"
6
+ :class="[
7
+ {
8
+ '--has-link': isLink,
9
+ },
10
+ ]"
11
+ v-bind="$attrs"
12
+ :href="href"
13
+ :to="to"
14
+ :target="isLink ? target : undefined"
15
+ >
16
+ <div
17
+ class="m-avatar__wrapper"
18
+ :tabindex="clickable ? 0 : -1"
19
+ :class="{
20
+ '--has-shadow': !noElevation,
21
+ '--bordered': bordered,
22
+ '--clickable': clickable,
23
+ '--square': square,
24
+ '--has-initial': !src && caption,
25
+ }"
26
+ @keydown.enter="clickable ? $emit('click', $event) : undefined"
27
+ >
28
+ <MazLazyImg
29
+ v-if="src"
30
+ class="m-avatar__picture"
31
+ :image="src"
32
+ :alt="alt"
33
+ image-height-full
34
+ :no-loader="noLoader"
35
+ @click="clickable ? $emit('click', $event) : null"
36
+ />
37
+ <slot v-if="caption" name="round-text">
38
+ <span class="m-avatar__initial"> {{ caption?.charAt(0) }} </span>
39
+ </slot>
40
+
41
+ <button
42
+ v-if="clickable"
43
+ type="button"
44
+ tabindex="-1"
45
+ class="m-avatar__button maz-flex maz-flex-center"
46
+ @click="$emit('click', $event)"
47
+ >
48
+ <slot name="icon">
49
+ <MazIcon name="pencil" class="m-avatar__button__icon" />
50
+ </slot>
51
+ </button>
52
+ </div>
53
+ <slot name="caption">
54
+ <p v-if="showCaption && caption" class="m-avatar__caption">
55
+ {{ caption }}
56
+ </p>
57
+ </slot>
58
+ </Component>
59
+ </template>
60
+
61
+ <script lang="ts" setup>
62
+ import { PropType, computed } from 'vue'
63
+ import MazLazyImg from './MazLazyImg.vue'
64
+ import MazIcon from './MazIcon.vue'
65
+
66
+ const props = defineProps({
67
+ // url or path of the image
68
+ src: {
69
+ type: String as PropType<undefined | null | string>,
70
+ default: undefined,
71
+ },
72
+ caption: {
73
+ type: String as PropType<undefined | null | string>,
74
+ default: undefined,
75
+ },
76
+ // url or path to link another page
77
+ href: { type: String, default: undefined },
78
+ // route config
79
+ to: { type: Object, default: undefined },
80
+ // alt text of image
81
+ alt: { type: String, default: 'avatar image' },
82
+ // target attribute of link (if url is provide)
83
+ target: { type: String, default: '_self' },
84
+ // size of avatar
85
+ size: { type: String, default: undefined },
86
+ // add border around the avatar
87
+ bordered: { type: Boolean, default: false },
88
+ // add an edit layer & emit `edit` event on click
89
+ clickable: { type: Boolean, default: false },
90
+ // Make the avatar square
91
+ square: { type: Boolean, default: false },
92
+ // Remove the shadow behind the avatar
93
+ noElevation: { type: Boolean, default: false },
94
+ showCaption: { type: Boolean, default: false },
95
+ imageHeightFull: { type: Boolean, default: false },
96
+ noLoader: { type: Boolean, default: false },
97
+ })
98
+
99
+ const componentType = computed(() =>
100
+ props.to ? 'RouterLink' : props.href ? 'a' : 'div',
101
+ )
102
+ const isLink = computed(() => !!props.to || !!props.href)
103
+
104
+ defineEmits(['click'])
105
+ </script>
106
+
107
+ <style lang="postcss" scoped>
108
+ .m-avatar {
109
+ @apply maz-inline-flex maz-flex-col maz-flex-center;
110
+ @apply maz-no-underline !important;
111
+
112
+ &__caption {
113
+ @apply maz-mt-2 maz-w-full maz-truncate maz-text-center maz-text-base maz-font-medium maz-capitalize maz-text-black;
114
+ }
115
+
116
+ &__initial {
117
+ @apply maz-text-2xl maz-capitalize maz-text-white;
118
+ }
119
+
120
+ &__wrapper {
121
+ @apply maz-relative maz-flex maz-h-12 maz-w-12 maz-flex-none maz-justify-center maz-overflow-hidden
122
+ maz-rounded-full maz-bg-gray-50;
123
+
124
+ &.--clickable {
125
+ & .m-avatar__button {
126
+ @apply maz-outline-none maz-absolute maz-inset-0 maz-w-full maz-scale-0 maz-cursor-pointer maz-rounded-full maz-border-none
127
+ maz-bg-transparent maz-opacity-0;
128
+
129
+ transition: all 200ms ease-in-out;
130
+ transition-property: transform, filter;
131
+
132
+ &__icon {
133
+ @apply maz-h-6 maz-w-6 maz-text-white;
134
+ }
135
+ }
136
+
137
+ &:hover,
138
+ &:focus {
139
+ & .m-avatar__picture {
140
+ filter: blur(1.5px);
141
+ }
142
+
143
+ & .m-avatar__button {
144
+ @apply maz-scale-105 maz-opacity-100;
145
+
146
+ background-color: var(--maz-color-danger-alpha);
147
+ }
148
+ }
149
+ }
150
+
151
+ &.--bordered {
152
+ @apply maz-border-2 maz-border-white;
153
+ }
154
+
155
+ &.--square {
156
+ @apply maz-rounded-lg;
157
+ }
158
+
159
+ &.--has-shadow {
160
+ @apply maz-shadow;
161
+ }
162
+
163
+ &.--has-initial {
164
+ @apply maz-items-center maz-bg-primary;
165
+
166
+ &.--clickable {
167
+ & .m-avatar__button {
168
+ @apply maz-bg-danger;
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ &.--has-link {
175
+ @apply maz-cursor-pointer;
176
+ }
177
+ }
178
+ </style>