maz-ui 2.3.13 → 2.4.2

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 (237) hide show
  1. package/components/MazArrowIcon.d.ts +43 -0
  2. package/components/MazArrowIcon.js +1 -0
  3. package/components/MazAvatar.d.ts +149 -0
  4. package/components/MazAvatar.js +3 -0
  5. package/components/MazBackdrop.d.ts +89 -0
  6. package/components/MazBackdrop.js +3 -0
  7. package/components/MazBadge.d.ts +68 -0
  8. package/components/MazBadge.js +1 -0
  9. package/components/MazBottomSheet.d.ts +29 -0
  10. package/components/MazBottomSheet.js +3 -0
  11. package/components/MazBtn.d.ts +171 -0
  12. package/components/MazBtn.js +3 -0
  13. package/components/MazCard.d.ts +183 -0
  14. package/components/MazCard.js +3 -0
  15. package/components/MazCarousel.d.ts +16 -0
  16. package/components/MazCarousel.js +3 -0
  17. package/components/MazChart/includes.d.ts +11 -0
  18. package/components/MazChart.d.ts +114 -0
  19. package/components/MazChart.js +1 -0
  20. package/components/MazCheckbox.d.ts +49 -0
  21. package/components/MazCheckbox.js +1 -0
  22. package/components/MazDialog.d.ts +29 -0
  23. package/components/MazDialog.js +3 -0
  24. package/components/MazDialogPromise/use-maz-dialog-promise.d.ts +30 -0
  25. package/components/MazDialogPromise.d.ts +28 -0
  26. package/components/MazDialogPromise.js +3 -0
  27. package/components/MazDrawer.d.ts +59 -0
  28. package/components/MazDrawer.js +3 -0
  29. package/components/MazDropzone.d.ts +128 -0
  30. package/components/MazDropzone.js +3 -0
  31. package/components/MazGallery.d.ts +144 -0
  32. package/components/MazGallery.js +3 -0
  33. package/components/MazIcon.d.ts +66 -0
  34. package/components/MazIcon.js +3 -0
  35. package/components/MazInput.d.ts +276 -0
  36. package/components/MazInput.js +3 -0
  37. package/components/MazInputNumber.d.ts +67 -0
  38. package/components/MazInputNumber.js +3 -0
  39. package/components/MazInputPrice.d.ts +64 -0
  40. package/components/MazInputPrice.js +3 -0
  41. package/components/MazInputTags.d.ts +96 -0
  42. package/components/MazInputTags.js +3 -0
  43. package/components/MazLazyImg.d.ts +80 -0
  44. package/components/MazLazyImg.js +3 -0
  45. package/components/MazPhoneNumberInput/constantes/locales.d.ts +12 -0
  46. package/components/MazPhoneNumberInput/types.d.ts +21 -0
  47. package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +2 -0
  48. package/components/MazPhoneNumberInput/utils/index.d.ts +12 -0
  49. package/components/MazPhoneNumberInput.d.ts +255 -0
  50. package/components/MazPhoneNumberInput.js +3 -0
  51. package/components/MazPicker/MazPickerCalendar.vue.d.ts +137 -0
  52. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarDays.vue.d.ts +22 -0
  53. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarGrid.vue.d.ts +114 -0
  54. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarMonth.vue.d.ts +124 -0
  55. package/components/MazPicker/MazPickerCalendarSwitcher.vue.d.ts +38 -0
  56. package/components/MazPicker/MazPickerContainer.vue.d.ts +212 -0
  57. package/components/MazPicker/MazPickerHeader.vue.d.ts +84 -0
  58. package/components/MazPicker/MazPickerMonthSwitcher.vue.d.ts +43 -0
  59. package/components/MazPicker/MazPickerShortcuts.vue.d.ts +62 -0
  60. package/components/MazPicker/MazPickerTime.vue.d.ts +129 -0
  61. package/components/MazPicker/MazPickerYearSwitcher.vue.d.ts +35 -0
  62. package/components/MazPicker/types.d.ts +15 -0
  63. package/components/MazPicker/utils.d.ts +54 -0
  64. package/components/MazPicker.d.ts +313 -0
  65. package/components/MazPicker.js +3 -0
  66. package/components/MazRadioButtons.d.ts +69 -0
  67. package/components/MazRadioButtons.js +1 -0
  68. package/components/MazSelect.d.ts +176 -0
  69. package/components/MazSelect.js +3 -0
  70. package/components/MazSlider/utils.d.ts +15 -0
  71. package/components/MazSlider.d.ts +96 -0
  72. package/components/MazSlider.js +3 -0
  73. package/components/MazSpinner.d.ts +30 -0
  74. package/components/MazSpinner.js +1 -0
  75. package/components/MazStepper.d.ts +73 -0
  76. package/components/MazStepper.js +1 -0
  77. package/components/MazSwitch.d.ts +56 -0
  78. package/components/MazSwitch.js +1 -0
  79. package/components/MazTabsBar.d.ts +49 -0
  80. package/components/MazTabsBar.js +3 -0
  81. package/components/MazTabsContent.d.ts +16 -0
  82. package/components/MazTabsContent.js +1 -0
  83. package/components/MazTabsContentItem.d.ts +14 -0
  84. package/components/MazTabsContentItem.js +3 -0
  85. package/components/MazTextarea/textarea-autogrow.d.ts +9 -0
  86. package/components/MazTextarea.d.ts +125 -0
  87. package/components/MazTextarea.js +1 -0
  88. package/components/MazTransitionExpand.d.ts +4 -0
  89. package/components/MazTransitionExpand.js +1 -0
  90. package/components/index.d.ts +34 -0
  91. package/components/index.js +36 -0
  92. package/components/no_photo-a72545e4.js +1 -0
  93. package/components/types.d.ts +17 -0
  94. package/css/aos.css +1 -0
  95. package/css/main.css +1 -0
  96. package/maz-ui.d.ts +307 -0
  97. package/modules/index.js +3 -0
  98. package/modules/no_photo-a72545e4.js +1 -0
  99. package/package.json +145 -81
  100. package/tailwindcss/tailwind.config.js +65 -0
  101. package/tailwindcss/utils/colors.js +28 -0
  102. package/tailwindcss/variables/breakpoints.js +15 -0
  103. package/tailwindcss/variables/colors.js +44 -0
  104. package/tailwindcss/variables/utilities.js +20 -0
  105. package/tailwindcss/variables/z-indexes.js +15 -0
  106. package/LICENSE +0 -21
  107. package/README.md +0 -66
  108. package/bin/index.js +0 -63
  109. package/bin/lib/_constantes/default-colors.js +0 -69
  110. package/bin/lib/index.d.ts +0 -2
  111. package/bin/lib/index.js +0 -145
  112. package/bin/lib/methods/generate-root-css.js +0 -49
  113. package/bin/lib/methods/get-theme-settings.js +0 -58
  114. package/bin/lib/methods/set-css-vars.js +0 -11
  115. package/lib/css/base.css +0 -1
  116. package/lib/css/index.css +0 -1
  117. package/lib/css/maz-avatar.css +0 -1
  118. package/lib/css/maz-bottom-sheet.css +0 -1
  119. package/lib/css/maz-btn-group.css +0 -1
  120. package/lib/css/maz-btn.css +0 -0
  121. package/lib/css/maz-card.css +0 -1
  122. package/lib/css/maz-carousel.css +0 -1
  123. package/lib/css/maz-checkbox.css +0 -1
  124. package/lib/css/maz-collapse.css +0 -1
  125. package/lib/css/maz-dialog.css +0 -1
  126. package/lib/css/maz-draggable-list.css +0 -1
  127. package/lib/css/maz-dropdown.css +0 -1
  128. package/lib/css/maz-dropzone.css +0 -1
  129. package/lib/css/maz-flex.css +0 -0
  130. package/lib/css/maz-gallery.css +0 -0
  131. package/lib/css/maz-img.css +0 -1
  132. package/lib/css/maz-input-tags.css +0 -1
  133. package/lib/css/maz-input.css +0 -0
  134. package/lib/css/maz-list-item.css +0 -1
  135. package/lib/css/maz-list.css +0 -1
  136. package/lib/css/maz-loader.css +0 -0
  137. package/lib/css/maz-pagination.css +0 -1
  138. package/lib/css/maz-phone-number-input.css +0 -1
  139. package/lib/css/maz-picker.css +0 -1
  140. package/lib/css/maz-plotly.css +0 -0
  141. package/lib/css/maz-progress-bar.css +0 -1
  142. package/lib/css/maz-radio.css +0 -1
  143. package/lib/css/maz-read-more.css +0 -1
  144. package/lib/css/maz-responsive-menu.css +0 -1
  145. package/lib/css/maz-search.css +0 -1
  146. package/lib/css/maz-select.css +0 -0
  147. package/lib/css/maz-sidebar.css +0 -1
  148. package/lib/css/maz-slider.css +0 -1
  149. package/lib/css/maz-spinner.css +0 -0
  150. package/lib/css/maz-stepper.css +0 -1
  151. package/lib/css/maz-switch.css +0 -1
  152. package/lib/css/maz-tabs-bar.css +0 -1
  153. package/lib/css/maz-tabs-content-item.css +0 -1
  154. package/lib/css/maz-tabs-content.css +0 -1
  155. package/lib/css/maz-transition-expand.css +0 -0
  156. package/lib/index.d.ts +0 -1
  157. package/lib/index.js +0 -1
  158. package/lib/maz-avatar.d.ts +0 -3
  159. package/lib/maz-avatar.js +0 -430
  160. package/lib/maz-bottom-sheet.d.ts +0 -3
  161. package/lib/maz-bottom-sheet.js +0 -1045
  162. package/lib/maz-btn-group.d.ts +0 -3
  163. package/lib/maz-btn-group.js +0 -907
  164. package/lib/maz-btn.d.ts +0 -3
  165. package/lib/maz-btn.js +0 -764
  166. package/lib/maz-card.d.ts +0 -3
  167. package/lib/maz-card.js +0 -572
  168. package/lib/maz-carousel.d.ts +0 -3
  169. package/lib/maz-carousel.js +0 -569
  170. package/lib/maz-checkbox.d.ts +0 -3
  171. package/lib/maz-checkbox.js +0 -359
  172. package/lib/maz-collapse.d.ts +0 -3
  173. package/lib/maz-collapse.js +0 -1238
  174. package/lib/maz-dialog.d.ts +0 -3
  175. package/lib/maz-dialog.js +0 -1315
  176. package/lib/maz-draggable-list.d.ts +0 -3
  177. package/lib/maz-draggable-list.js +0 -439
  178. package/lib/maz-dropdown.d.ts +0 -3
  179. package/lib/maz-dropdown.js +0 -438
  180. package/lib/maz-dropzone.d.ts +0 -3
  181. package/lib/maz-dropzone.js +0 -664
  182. package/lib/maz-flex.d.ts +0 -3
  183. package/lib/maz-flex.js +0 -427
  184. package/lib/maz-gallery.d.ts +0 -3
  185. package/lib/maz-gallery.js +0 -672
  186. package/lib/maz-img.d.ts +0 -3
  187. package/lib/maz-img.js +0 -612
  188. package/lib/maz-input-tags.d.ts +0 -3
  189. package/lib/maz-input-tags.js +0 -1207
  190. package/lib/maz-input.d.ts +0 -3
  191. package/lib/maz-input.js +0 -1076
  192. package/lib/maz-list-item.d.ts +0 -3
  193. package/lib/maz-list-item.js +0 -304
  194. package/lib/maz-list.d.ts +0 -3
  195. package/lib/maz-list.js +0 -331
  196. package/lib/maz-loader.d.ts +0 -3
  197. package/lib/maz-loader.js +0 -304
  198. package/lib/maz-pagination.d.ts +0 -3
  199. package/lib/maz-pagination.js +0 -1414
  200. package/lib/maz-phone-number-input.d.ts +0 -3
  201. package/lib/maz-phone-number-input.js +0 -3776
  202. package/lib/maz-picker.d.ts +0 -3
  203. package/lib/maz-picker.js +0 -6474
  204. package/lib/maz-plotly.d.ts +0 -3
  205. package/lib/maz-plotly.js +0 -500
  206. package/lib/maz-progress-bar.d.ts +0 -3
  207. package/lib/maz-progress-bar.js +0 -398
  208. package/lib/maz-radio.d.ts +0 -3
  209. package/lib/maz-radio.js +0 -358
  210. package/lib/maz-read-more.d.ts +0 -3
  211. package/lib/maz-read-more.js +0 -344
  212. package/lib/maz-responsive-menu.d.ts +0 -3
  213. package/lib/maz-responsive-menu.js +0 -438
  214. package/lib/maz-search.d.ts +0 -3
  215. package/lib/maz-search.js +0 -1590
  216. package/lib/maz-select.d.ts +0 -3
  217. package/lib/maz-select.js +0 -2740
  218. package/lib/maz-sidebar.d.ts +0 -3
  219. package/lib/maz-sidebar.js +0 -815
  220. package/lib/maz-slider.d.ts +0 -3
  221. package/lib/maz-slider.js +0 -1014
  222. package/lib/maz-spinner.d.ts +0 -3
  223. package/lib/maz-spinner.js +0 -328
  224. package/lib/maz-stepper.d.ts +0 -3
  225. package/lib/maz-stepper.js +0 -1011
  226. package/lib/maz-switch.d.ts +0 -3
  227. package/lib/maz-switch.js +0 -375
  228. package/lib/maz-tabs-bar.d.ts +0 -3
  229. package/lib/maz-tabs-bar.js +0 -428
  230. package/lib/maz-tabs-content-item.d.ts +0 -3
  231. package/lib/maz-tabs-content-item.js +0 -376
  232. package/lib/maz-tabs-content.d.ts +0 -3
  233. package/lib/maz-tabs-content.js +0 -367
  234. package/lib/maz-transition-expand.d.ts +0 -3
  235. package/lib/maz-transition-expand.js +0 -328
  236. package/lib/maz-ui.common.d.ts +0 -1
  237. package/lib/maz-ui.common.js +0 -17202
@@ -0,0 +1,15 @@
1
+ /* eslint-disable unicorn/prefer-module */
2
+ module.exports = {
3
+ 1: '1',
4
+ 2: '2',
5
+ 3: '3',
6
+ 4: '4',
7
+ 5: '5',
8
+ 15: '15',
9
+ 25: '25',
10
+ 35: '35',
11
+ 45: '45',
12
+ 75: '75',
13
+ 100: '100',
14
+ 'default-backdrop': '1050',
15
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 LouisMazel
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,66 +0,0 @@
1
- # maz-ui
2
-
3
- [![license](https://img.shields.io/github/license/LouisMazel/maz-ui.svg?style=flat-square)](https://github.com/LouisMazel/maz-ui/blob/master/LICENSE)
4
- [![vue 2](https://img.shields.io/badge/vue-2-42b983.svg?style=flat-square)](https://vuejs.org)
5
- [![npm](https://img.shields.io/npm/v/maz-ui.svg?style=flat-square)](https://www.npmjs.com/package/maz-ui)
6
- [![npm](https://img.shields.io/npm/dt/maz-ui.svg?style=flat-square)](https://www.npmjs.com/package/maz-ui)
7
- [![Codacy grade](https://img.shields.io/codacy/grade/3d15a7c11bfe47c69a2aed93cc67cc29.svg?style=flat-square)](https://www.codacy.com/app/LouisMazel/maz-ui)
8
-
9
- [![npm](https://nodei.co/npm/maz-ui.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/maz-ui)
10
-
11
- > [Maz-ui](https://louismazel.github.io/maz-ui/) is a stand-alone components library for [VueJS](https://vuejs.org) & [NuxtJS](https://nuxtjs.org/)
12
-
13
- ## Documentation & Components
14
-
15
- [Documentation & Components](https://louismazel.github.io/maz-ui/)
16
-
17
- ## Install
18
-
19
- [Get Started](https://louismazel.github.io/maz-ui/documentation/get-started)
20
-
21
- ```shell
22
- npm install maz-ui
23
-
24
- # Or yarn add maz-ui
25
- ```
26
-
27
- ### On demande install
28
-
29
- To optimize your bundle size, it's recommanded to use the [on demand install](https://louismazel.github.io/maz-ui/documentation/get-started)
30
-
31
- ```javascript
32
- import Vue from 'vue'
33
- import {
34
- ...
35
- MazBtn
36
- MazInput
37
- MazPicker
38
- MazPhoneNumberInput
39
- ...
40
- } from 'maz-ui'
41
-
42
- ...
43
- Vue.use(MazBtn)
44
- Vue.use(MazInput)
45
- Vue.use(MazPicker)
46
- Vue.use(MazPhoneNumberInput)
47
- ...
48
- ```
49
-
50
- ### Quick Start - Fully install (not recommanded)
51
-
52
- ```javascript
53
- import Vue from "vue";
54
- import "maz-ui/lib/css/index.css";
55
- import MazUi from "maz-ui";
56
-
57
- Vue.use(MazUi);
58
- ```
59
-
60
- ## Contribute
61
-
62
- Read documentation of [CONTRIBUTING.md](./.github/CONTRIBUTING.md)
63
-
64
- ## LICENSE
65
-
66
- [MIT](LICENSE)
package/bin/index.js DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const chalk = require('chalk')
4
- const clear = require('clear')
5
- const figlet = require('figlet')
6
- const path = require('path')
7
- const { Command } = require('commander')
8
-
9
- const VERSION = require('../package').version
10
- const NAME = require('../package').name
11
- const PREFIX = 'maz-'
12
- const generateRootCss = require('./lib/index.js')
13
-
14
- const program = new Command()
15
-
16
- clear()
17
- console.log(
18
- chalk.bold.keyword('dodgerblue')(
19
- figlet.textSync(NAME, { horizontalLayout: 'full' })
20
- )
21
- )
22
- console.log()
23
- console.log(chalk.bold.keyword('dodgerblue')(`${NAME} v${VERSION}`))
24
- console.log()
25
-
26
- program
27
- .version(`${NAME} ${VERSION}`)
28
- .usage('<command> [options]')
29
-
30
- program
31
- .arguments('[command]')
32
- .action((cmd) => {
33
- program.outputHelp()
34
- if (cmd) {
35
- console.log()
36
- console.log(
37
- chalk.red(` ⛔️ Unknown command ${chalk.bold.keyword('dodgerblue')(cmd)}.`)
38
- )
39
- console.log()
40
- }
41
- })
42
-
43
- program.on('--help', () => {
44
- console.log()
45
- console.log(` Run ${chalk.bold.keyword('dodgerblue')('maz <command> --help')} for detailed usage of given command.`)
46
- console.log()
47
- })
48
-
49
- program
50
- .command('get-theme')
51
- .option('-c, --config <path-to-config-file>', 'Optionnal: Provide path to config file - Ex: "./maz-ui.config.js"')
52
- .description('Generate css variables')
53
- .action(async (options) => {
54
- const configPath = path.resolve(process.env.PWD, options.config ? options.config : './maz-ui.config.js')
55
- const config = require(configPath)
56
- const output = config.output
57
- const colors = config.theme
58
- delete config.output
59
- generateRootCss(PREFIX, colors, output)
60
- process.exit(0)
61
- })
62
-
63
- program.parse(process.argv)
@@ -1,69 +0,0 @@
1
- module.exports = {
2
- mainColors: {
3
- primary: 'dodgerblue',
4
- secondary: '#1CD1A1',
5
- third: '#C41AF9',
6
- danger: 'orangered',
7
- success: 'yellowgreen',
8
- info: '#17A2B8',
9
- warning: '#FFA300',
10
- light: '#EEEEEE',
11
- dark: '#21222E',
12
- grey: '#999999',
13
- default: '#CCCCCC',
14
- black: 'black',
15
- white: 'white',
16
- transparent: '#FFFFFF00',
17
- disabled: '#F2F2F2'
18
- },
19
- typo: {
20
- 'base-font-size': '16px',
21
- 'base-font-family': 'system-ui, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Helvetica, Arial, sans-serif, \'Apple Color Emoji\', \'Segoe UI Emoji\', \'Segoe UI Symbol\'',
22
- 'base-font-weight': '400',
23
- 'base-line-height': '1.5'
24
- },
25
- border: {
26
- 'border-width': '2px',
27
- 'border-radius': '8px'
28
- },
29
- light: {
30
- typo: {
31
- 'text-color': '#212121',
32
- 'muted-color': 'rgba(0, 0, 0, .54)',
33
- 'placeholder-color': '#A7A7A7',
34
- 'icon-color': '#DEDEDE'
35
- },
36
- layout: {
37
- 'bg-color': 'white',
38
- 'bg-color-light': '#F2F2F2',
39
- 'overlay-color': 'rgba(86, 87, 117, .7)'
40
- },
41
- borderColor: {
42
- 'border-color': '#EEEEEE'
43
- },
44
- state: {
45
- 'hover-color': '#F2F2F2',
46
- 'disabled-color': '#F2F2F2'
47
- }
48
- },
49
- dark: {
50
- typo: {
51
- 'text-color': '#EEEEEE',
52
- 'muted-color': 'rgba(255, 255, 255, .54)',
53
- 'placeholder-color': 'rgba(255, 255, 255, .6)',
54
- 'icon-color': '#65678F'
55
- },
56
- layout: {
57
- 'bg-color': '#21222E',
58
- 'bg-color-light': '#303144',
59
- 'overlay-color': 'rgba(86, 87, 117, .7)'
60
- },
61
- borderColor: {
62
- 'border-color': '#3B3C53'
63
- },
64
- state: {
65
- 'hover-color': '#2E2F40',
66
- 'disabled-color': '#CCCCCC'
67
- }
68
- }
69
- }
@@ -1,2 +0,0 @@
1
- declare const _default: (color: object, output: string) => object
2
- export default _default
package/bin/lib/index.js DELETED
@@ -1,145 +0,0 @@
1
- const { isColorName, colorNameToHex, shadeColor, hexToRgba } = require('color-transformer-ui')
2
- const generateRootCss = require('./methods/generate-root-css')
3
-
4
- const getAlpha = (color, coef) => {
5
- const alpha = color.length === 7 ? hexToRgba(color, coef) : 'transparent'
6
-
7
- const outputCoef = coef * 100 < 10 ? `0${coef * 100}` : coef * 100
8
-
9
- return {
10
- alpha,
11
- coef: outputCoef
12
- }
13
- }
14
-
15
- const getMainVariants = (color) => {
16
- if (isColorName(color)) color = colorNameToHex(color)
17
- const darken = shadeColor(color, -20)
18
- const alpha = getAlpha(color, 0.05)
19
- const alpha5 = getAlpha(color, 0.5)
20
- const alpha4 = getAlpha(color, 0.4)
21
- const alpha6 = getAlpha(color, 0.6)
22
-
23
- return [color, darken, [alpha, alpha4, alpha5, alpha6]]
24
- }
25
-
26
- const getLayoutVariants = (color) => {
27
- if (isColorName(color)) color = colorNameToHex(color)
28
- const darken = shadeColor(color, -10)
29
-
30
- return [color, darken]
31
- }
32
-
33
- const getStateVariants = (color, dark) => {
34
- if (isColorName(color)) color = colorNameToHex(color)
35
- const darken = dark ? shadeColor(color, 15) : shadeColor(color, -10)
36
-
37
- return [color, darken]
38
- }
39
-
40
- module.exports = (prefix, theme, output) => {
41
- if (!prefix) throw new Error('The "prefix" should be defined')
42
- if (!output) throw new Error('No "output" found in maz-ui.config.js - Ex: "output: ./assets/root-vars.css"')
43
- if (!theme || !Object.keys(theme).length) throw new Error('No colors provided in maz-ui-config.js - Ex: "{ theme: { mainColors: { primary: "red" } } }"')
44
-
45
- const results = {
46
- light: {},
47
- dark: {}
48
- }
49
-
50
- /**
51
- * Main Colors
52
- */
53
- if (theme.main) {
54
- Object.entries(theme.main).forEach((values) => {
55
- const variants = getMainVariants(values[1])
56
- results.light[`--${prefix}${values[0]}`] = variants[0]
57
- results.light[`--${prefix}${values[0]}-darken`] = variants[1]
58
- variants[2].forEach((v) => {
59
- results.light[`--${prefix}${values[0]}-alpha-${v.coef}`] = v.alpha
60
- })
61
- })
62
- }
63
-
64
- /**
65
- * Typo base
66
- */
67
- if (theme.typo) {
68
- Object.entries(theme.typo).forEach((values) => {
69
- results.light[`--${prefix}${values[0]}`] = values[1]
70
- })
71
- }
72
-
73
- /**
74
- * Border
75
- */
76
- if (theme.border) {
77
- Object.entries(theme.border).forEach((values) => {
78
- results.light[`--${prefix}${values[0]}`] = values[1]
79
- })
80
- }
81
-
82
- /**
83
- * Light
84
- */
85
- if (theme.light) {
86
- if (theme.light.typo) {
87
- Object.entries(theme.light.typo).forEach((values) => {
88
- results.light[`--${prefix}${values[0]}`] = values[1]
89
- })
90
- }
91
- if (theme.light.layout) {
92
- Object.entries(theme.light.layout).forEach((values) => {
93
- results.light[`--${prefix}${values[0]}`] = values[1]
94
- })
95
- }
96
-
97
- if (theme.light.borderColor) {
98
- Object.entries(theme.light.borderColor).forEach((values) => {
99
- const variants = getLayoutVariants(values[1])
100
- results.light[`--${prefix}${values[0]}`] = variants[0]
101
- results.light[`--${prefix}${values[0]}-darken`] = variants[1]
102
- })
103
- }
104
- if (theme.light.state) {
105
- Object.entries(theme.light.state).forEach((values) => {
106
- const variants = getStateVariants(values[1])
107
- results.light[`--${prefix}${values[0]}`] = variants[0]
108
- results.light[`--${prefix}${values[0]}-darken`] = variants[1]
109
- })
110
- }
111
- }
112
-
113
- /**
114
- * Dark
115
- */
116
- if (theme.dark) {
117
- if (theme.dark.typo) {
118
- Object.entries(theme.dark.typo).forEach((values) => {
119
- results.dark[`--${prefix}${values[0]}`] = values[1]
120
- })
121
- }
122
- if (theme.dark.layout) {
123
- Object.entries(theme.dark.layout).forEach((values) => {
124
- results.dark[`--${prefix}${values[0]}`] = values[1]
125
- })
126
- }
127
- if (theme.dark.borderColor) {
128
- Object.entries(theme.dark.borderColor).forEach((values) => {
129
- const variants = getLayoutVariants(values[1])
130
- results.dark[`--${prefix}${values[0]}`] = variants[0]
131
- results.dark[`--${prefix}${values[0]}-darken`] = variants[1]
132
- })
133
- }
134
- if (theme.dark.state) {
135
- Object.entries(theme.dark.state).forEach((values) => {
136
- const variants = getStateVariants(values[1], true)
137
- results.dark[`--${prefix}${values[0]}`] = variants[0]
138
- results.dark[`--${prefix}${values[0]}-darken`] = variants[1]
139
- })
140
- }
141
- }
142
-
143
- generateRootCss(results, output)
144
- return results
145
- }
@@ -1,49 +0,0 @@
1
- const fs = require('fs')
2
- const { EOL: endOfLine } = require('os')
3
- const render = require('json-templater/string')
4
-
5
- const LIGHT_TEMPLATE = `
6
- /* Automatically generated by 'maz-ui' */
7
-
8
- /* stylelint-disable */
9
-
10
- :root {
11
- {{light_include}}
12
- }`
13
-
14
- const DARK_TEMPLATE = `.maz-is-dark {
15
- {{dark_include}}
16
- }`
17
-
18
- const END_TEMPLATE = `
19
- /* stylelint-enable */`
20
-
21
-
22
-
23
- module.exports = (variables, output) => {
24
- const lightProperties = Object.entries(variables.light)
25
- .map((values) => ` ${values[0]}: ${values[1]};`)
26
- .join(endOfLine)
27
- const darkProperties = Object.entries(variables.dark)
28
- .map((values) => ` ${values[0]}: ${values[1]};`)
29
- .join(endOfLine)
30
-
31
- const lightTemplate = render(LIGHT_TEMPLATE, {
32
- light_include: lightProperties,
33
- dark_include: darkProperties
34
- })
35
-
36
- const darkTemplate = render(DARK_TEMPLATE, {
37
- light_include: lightProperties,
38
- dark_include: darkProperties
39
- })
40
-
41
- const result = `
42
- ${lightTemplate}
43
- ${darkProperties ? darkTemplate : ''}
44
- ${END_TEMPLATE}
45
- `.trim()
46
-
47
- fs.writeFileSync(output, result)
48
- console.log('\x1B[32m', '[build root css file] DONE:', output)
49
- }
@@ -1,58 +0,0 @@
1
- const defaultTheme = require('./../_constantes/default-colors')
2
-
3
- module.exports = (opts) => {
4
- return {
5
- mainColors: {
6
- ...defaultTheme.mainColors,
7
- ...opts.mainColors
8
- },
9
- typo: {
10
- ...defaultTheme.typo,
11
- ...opts.typo
12
- },
13
- border: {
14
- ...defaultTheme.border,
15
- ...opts.border
16
- },
17
- light: {
18
- typo: {
19
- ...defaultTheme.light.typo,
20
- ...(opts.light ? opts.light.typo : {})
21
- },
22
- layout: {
23
- ...defaultTheme.light.layout,
24
- ...(opts.light ? opts.light.layout : {})
25
- },
26
- state: {
27
- ...defaultTheme.light.state,
28
- ...(opts.light ? opts.light.state : {})
29
- },
30
- borderColor: {
31
- ...defaultTheme.light.borderColor,
32
- ...(opts.light ? opts.light.borderColor : {})
33
- }
34
- },
35
- dark: {
36
- typo: {
37
- ...defaultTheme.dark.typo,
38
- ...(opts.dark ? opts.dark.typo : {})
39
- },
40
- layout: {
41
- ...defaultTheme.dark.layout,
42
- ...(opts.dark ? opts.dark.layout : {})
43
- },
44
- state: {
45
- ...defaultTheme.dark.state,
46
- ...(opts.dark ? opts.dark.state : {})
47
- },
48
- borderColor: {
49
- ...defaultTheme.dark.borderColor,
50
- ...(opts.dark ? opts.dark.borderColor : {})
51
- }
52
- },
53
- breakpoints: {
54
- ...defaultTheme.breakpoints,
55
- ...opts.breakpoints
56
- }
57
- }
58
- }
@@ -1,11 +0,0 @@
1
- module.exports = (variables) => {
2
- const root = document.documentElement.style
3
-
4
- Object.entries(variables.light).forEach((values) => {
5
- root.setProperty(values[0], values[1])
6
- })
7
-
8
- Object.entries(variables.dark).forEach((values) => {
9
- root.setProperty(values[0], values[1])
10
- })
11
- }