maz-ui 2.4.2 → 2.4.7
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.
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/bin/index.js +63 -0
- package/bin/lib/_constantes/default-colors.js +69 -0
- package/bin/lib/index.d.ts +2 -0
- package/bin/lib/index.js +145 -0
- package/bin/lib/methods/generate-root-css.js +49 -0
- package/bin/lib/methods/get-theme-settings.js +58 -0
- package/bin/lib/methods/set-css-vars.js +11 -0
- package/lib/css/base.css +1 -0
- package/lib/css/index.css +1 -0
- package/lib/css/maz-avatar.css +1 -0
- package/lib/css/maz-bottom-sheet.css +1 -0
- package/lib/css/maz-btn-group.css +1 -0
- package/lib/css/maz-btn.css +0 -0
- package/lib/css/maz-card.css +1 -0
- package/lib/css/maz-carousel.css +1 -0
- package/lib/css/maz-checkbox.css +1 -0
- package/lib/css/maz-collapse.css +1 -0
- package/lib/css/maz-dialog.css +1 -0
- package/lib/css/maz-draggable-list.css +1 -0
- package/lib/css/maz-dropdown.css +1 -0
- package/lib/css/maz-dropzone.css +1 -0
- package/lib/css/maz-flex.css +0 -0
- package/lib/css/maz-gallery.css +0 -0
- package/lib/css/maz-img.css +1 -0
- package/lib/css/maz-input-tags.css +1 -0
- package/lib/css/maz-input.css +0 -0
- package/lib/css/maz-list-item.css +1 -0
- package/lib/css/maz-list.css +1 -0
- package/lib/css/maz-loader.css +0 -0
- package/lib/css/maz-pagination.css +1 -0
- package/lib/css/maz-phone-number-input.css +1 -0
- package/lib/css/maz-picker.css +1 -0
- package/lib/css/maz-plotly.css +0 -0
- package/lib/css/maz-progress-bar.css +1 -0
- package/lib/css/maz-radio.css +1 -0
- package/lib/css/maz-read-more.css +1 -0
- package/lib/css/maz-responsive-menu.css +1 -0
- package/lib/css/maz-search.css +1 -0
- package/lib/css/maz-select.css +0 -0
- package/lib/css/maz-sidebar.css +1 -0
- package/lib/css/maz-slider.css +1 -0
- package/lib/css/maz-spinner.css +0 -0
- package/lib/css/maz-stepper.css +1 -0
- package/lib/css/maz-switch.css +1 -0
- package/lib/css/maz-tabs-bar.css +1 -0
- package/lib/css/maz-tabs-content-item.css +1 -0
- package/lib/css/maz-tabs-content.css +1 -0
- package/lib/css/maz-transition-expand.css +0 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/maz-avatar.d.ts +3 -0
- package/lib/maz-avatar.js +430 -0
- package/lib/maz-bottom-sheet.d.ts +3 -0
- package/lib/maz-bottom-sheet.js +1045 -0
- package/lib/maz-btn-group.d.ts +3 -0
- package/lib/maz-btn-group.js +907 -0
- package/lib/maz-btn.d.ts +3 -0
- package/lib/maz-btn.js +764 -0
- package/lib/maz-card.d.ts +3 -0
- package/lib/maz-card.js +572 -0
- package/lib/maz-carousel.d.ts +3 -0
- package/lib/maz-carousel.js +569 -0
- package/lib/maz-checkbox.d.ts +3 -0
- package/lib/maz-checkbox.js +359 -0
- package/lib/maz-collapse.d.ts +3 -0
- package/lib/maz-collapse.js +1238 -0
- package/lib/maz-dialog.d.ts +3 -0
- package/lib/maz-dialog.js +1315 -0
- package/lib/maz-draggable-list.d.ts +3 -0
- package/lib/maz-draggable-list.js +439 -0
- package/lib/maz-dropdown.d.ts +3 -0
- package/lib/maz-dropdown.js +438 -0
- package/lib/maz-dropzone.d.ts +3 -0
- package/lib/maz-dropzone.js +664 -0
- package/lib/maz-flex.d.ts +3 -0
- package/lib/maz-flex.js +427 -0
- package/lib/maz-gallery.d.ts +3 -0
- package/lib/maz-gallery.js +672 -0
- package/lib/maz-img.d.ts +3 -0
- package/lib/maz-img.js +612 -0
- package/lib/maz-input-tags.d.ts +3 -0
- package/lib/maz-input-tags.js +1207 -0
- package/lib/maz-input.d.ts +3 -0
- package/lib/maz-input.js +1076 -0
- package/lib/maz-list-item.d.ts +3 -0
- package/lib/maz-list-item.js +304 -0
- package/lib/maz-list.d.ts +3 -0
- package/lib/maz-list.js +331 -0
- package/lib/maz-loader.d.ts +3 -0
- package/lib/maz-loader.js +304 -0
- package/lib/maz-pagination.d.ts +3 -0
- package/lib/maz-pagination.js +1414 -0
- package/lib/maz-phone-number-input.d.ts +3 -0
- package/lib/maz-phone-number-input.js +3776 -0
- package/lib/maz-picker.d.ts +3 -0
- package/lib/maz-picker.js +6474 -0
- package/lib/maz-plotly.d.ts +3 -0
- package/lib/maz-plotly.js +500 -0
- package/lib/maz-progress-bar.d.ts +3 -0
- package/lib/maz-progress-bar.js +398 -0
- package/lib/maz-radio.d.ts +3 -0
- package/lib/maz-radio.js +358 -0
- package/lib/maz-read-more.d.ts +3 -0
- package/lib/maz-read-more.js +344 -0
- package/lib/maz-responsive-menu.d.ts +3 -0
- package/lib/maz-responsive-menu.js +438 -0
- package/lib/maz-search.d.ts +3 -0
- package/lib/maz-search.js +1590 -0
- package/lib/maz-select.d.ts +3 -0
- package/lib/maz-select.js +2740 -0
- package/lib/maz-sidebar.d.ts +3 -0
- package/lib/maz-sidebar.js +815 -0
- package/lib/maz-slider.d.ts +3 -0
- package/lib/maz-slider.js +1014 -0
- package/lib/maz-spinner.d.ts +3 -0
- package/lib/maz-spinner.js +328 -0
- package/lib/maz-stepper.d.ts +3 -0
- package/lib/maz-stepper.js +1011 -0
- package/lib/maz-switch.d.ts +3 -0
- package/lib/maz-switch.js +375 -0
- package/lib/maz-tabs-bar.d.ts +3 -0
- package/lib/maz-tabs-bar.js +428 -0
- package/lib/maz-tabs-content-item.d.ts +3 -0
- package/lib/maz-tabs-content-item.js +376 -0
- package/lib/maz-tabs-content.d.ts +3 -0
- package/lib/maz-tabs-content.js +367 -0
- package/lib/maz-transition-expand.d.ts +3 -0
- package/lib/maz-transition-expand.js +328 -0
- package/lib/maz-ui.common.d.ts +1 -0
- package/lib/maz-ui.common.js +17202 -0
- package/package.json +81 -145
- package/components/MazArrowIcon.d.ts +0 -43
- package/components/MazArrowIcon.js +0 -1
- package/components/MazAvatar.d.ts +0 -149
- package/components/MazAvatar.js +0 -3
- package/components/MazBackdrop.d.ts +0 -89
- package/components/MazBackdrop.js +0 -3
- package/components/MazBadge.d.ts +0 -68
- package/components/MazBadge.js +0 -1
- package/components/MazBottomSheet.d.ts +0 -29
- package/components/MazBottomSheet.js +0 -3
- package/components/MazBtn.d.ts +0 -171
- package/components/MazBtn.js +0 -3
- package/components/MazCard.d.ts +0 -183
- package/components/MazCard.js +0 -3
- package/components/MazCarousel.d.ts +0 -16
- package/components/MazCarousel.js +0 -3
- package/components/MazChart/includes.d.ts +0 -11
- package/components/MazChart.d.ts +0 -114
- package/components/MazChart.js +0 -1
- package/components/MazCheckbox.d.ts +0 -49
- package/components/MazCheckbox.js +0 -1
- package/components/MazDialog.d.ts +0 -29
- package/components/MazDialog.js +0 -3
- package/components/MazDialogPromise/use-maz-dialog-promise.d.ts +0 -30
- package/components/MazDialogPromise.d.ts +0 -28
- package/components/MazDialogPromise.js +0 -3
- package/components/MazDrawer.d.ts +0 -59
- package/components/MazDrawer.js +0 -3
- package/components/MazDropzone.d.ts +0 -128
- package/components/MazDropzone.js +0 -3
- package/components/MazGallery.d.ts +0 -144
- package/components/MazGallery.js +0 -3
- package/components/MazIcon.d.ts +0 -66
- package/components/MazIcon.js +0 -3
- package/components/MazInput.d.ts +0 -276
- package/components/MazInput.js +0 -3
- package/components/MazInputNumber.d.ts +0 -67
- package/components/MazInputNumber.js +0 -3
- package/components/MazInputPrice.d.ts +0 -64
- package/components/MazInputPrice.js +0 -3
- package/components/MazInputTags.d.ts +0 -96
- package/components/MazInputTags.js +0 -3
- package/components/MazLazyImg.d.ts +0 -80
- package/components/MazLazyImg.js +0 -3
- package/components/MazPhoneNumberInput/constantes/locales.d.ts +0 -12
- package/components/MazPhoneNumberInput/types.d.ts +0 -21
- package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +0 -2
- package/components/MazPhoneNumberInput/utils/index.d.ts +0 -12
- package/components/MazPhoneNumberInput.d.ts +0 -255
- package/components/MazPhoneNumberInput.js +0 -3
- package/components/MazPicker/MazPickerCalendar.vue.d.ts +0 -137
- package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarDays.vue.d.ts +0 -22
- package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarGrid.vue.d.ts +0 -114
- package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarMonth.vue.d.ts +0 -124
- package/components/MazPicker/MazPickerCalendarSwitcher.vue.d.ts +0 -38
- package/components/MazPicker/MazPickerContainer.vue.d.ts +0 -212
- package/components/MazPicker/MazPickerHeader.vue.d.ts +0 -84
- package/components/MazPicker/MazPickerMonthSwitcher.vue.d.ts +0 -43
- package/components/MazPicker/MazPickerShortcuts.vue.d.ts +0 -62
- package/components/MazPicker/MazPickerTime.vue.d.ts +0 -129
- package/components/MazPicker/MazPickerYearSwitcher.vue.d.ts +0 -35
- package/components/MazPicker/types.d.ts +0 -15
- package/components/MazPicker/utils.d.ts +0 -54
- package/components/MazPicker.d.ts +0 -313
- package/components/MazPicker.js +0 -3
- package/components/MazRadioButtons.d.ts +0 -69
- package/components/MazRadioButtons.js +0 -1
- package/components/MazSelect.d.ts +0 -176
- package/components/MazSelect.js +0 -3
- package/components/MazSlider/utils.d.ts +0 -15
- package/components/MazSlider.d.ts +0 -96
- package/components/MazSlider.js +0 -3
- package/components/MazSpinner.d.ts +0 -30
- package/components/MazSpinner.js +0 -1
- package/components/MazStepper.d.ts +0 -73
- package/components/MazStepper.js +0 -1
- package/components/MazSwitch.d.ts +0 -56
- package/components/MazSwitch.js +0 -1
- package/components/MazTabsBar.d.ts +0 -49
- package/components/MazTabsBar.js +0 -3
- package/components/MazTabsContent.d.ts +0 -16
- package/components/MazTabsContent.js +0 -1
- package/components/MazTabsContentItem.d.ts +0 -14
- package/components/MazTabsContentItem.js +0 -3
- package/components/MazTextarea/textarea-autogrow.d.ts +0 -9
- package/components/MazTextarea.d.ts +0 -125
- package/components/MazTextarea.js +0 -1
- package/components/MazTransitionExpand.d.ts +0 -4
- package/components/MazTransitionExpand.js +0 -1
- package/components/index.d.ts +0 -34
- package/components/index.js +0 -36
- package/components/no_photo-a72545e4.js +0 -1
- package/components/types.d.ts +0 -17
- package/css/aos.css +0 -1
- package/css/main.css +0 -1
- package/maz-ui.d.ts +0 -307
- package/modules/index.js +0 -3
- package/modules/no_photo-a72545e4.js +0 -1
- package/tailwindcss/tailwind.config.js +0 -65
- package/tailwindcss/utils/colors.js +0 -28
- package/tailwindcss/variables/breakpoints.js +0 -15
- package/tailwindcss/variables/colors.js +0 -44
- package/tailwindcss/variables/utilities.js +0 -20
- package/tailwindcss/variables/z-indexes.js +0 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# maz-ui
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LouisMazel/maz-ui/blob/master/LICENSE)
|
|
4
|
+
[](https://vuejs.org)
|
|
5
|
+
[](https://www.npmjs.com/package/maz-ui)
|
|
6
|
+
[](https://www.npmjs.com/package/maz-ui)
|
|
7
|
+
[](https://www.codacy.com/app/LouisMazel/maz-ui)
|
|
8
|
+
|
|
9
|
+
[](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/) (v2.x)
|
|
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
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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)
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
}
|
package/bin/lib/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
}
|