@magicgol/polyjuice 0.1.0

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/.gitlab-ci.yml ADDED
@@ -0,0 +1,18 @@
1
+ # Sets the docker image for the job
2
+ image: node:latest
3
+
4
+ # Sets the stages for the pipeline
5
+ stages:
6
+ - test
7
+
8
+ # Installs the dependencies
9
+ before_script:
10
+ - npm install
11
+
12
+ #👇Adds Chromatic as a job
13
+ chromatic_publish:
14
+ stage: test
15
+ script:
16
+ - npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN
17
+ only:
18
+ - master
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v16.0.0
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ 'stories': [
3
+ '../src/**/*.stories.mdx',
4
+ '../src/**/*.stories.@(js|jsx|ts|tsx)'
5
+ ],
6
+ 'addons': [
7
+ '@storybook/addon-links',
8
+ '@storybook/addon-essentials',
9
+ '@storybook/preset-scss',
10
+ ],
11
+ 'framework': '@storybook/vue',
12
+ }
@@ -0,0 +1,4 @@
1
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
2
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
3
+
4
+ <link href="https://fonts.googleapis.com/css?family=Ubuntu:500" rel="stylesheet" />
@@ -0,0 +1,15 @@
1
+ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
2
+
3
+ export const parameters = {
4
+ actions: { argTypesRegex: "^on[A-Z].*" },
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/,
9
+ },
10
+ },
11
+ viewport: {
12
+ viewports: INITIAL_VIEWPORTS,
13
+ defaultViewport: 'responsive',
14
+ },
15
+ }
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # polyjuice
2
+
3
+ ## Project setup
4
+ ```
5
+ npm install
6
+ ```
7
+
8
+ ### Compiles and hot-reloads for development
9
+ ```
10
+ npm run serve
11
+ ```
12
+
13
+ ### Compiles and minifies for production
14
+ ```
15
+ npm run build
16
+ ```
17
+
18
+ ### Lints and fixes files
19
+ ```
20
+ npm run lint
21
+ ```
22
+
23
+ ### Customize configuration
24
+ See [Configuration Reference](https://cli.vuejs.org/config/).
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ presets: [
3
+ '@vue/cli-plugin-babel/preset'
4
+ ]
5
+ }
package/lerna.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "packages": [
3
+ "src/components/*"
4
+ ],
5
+ "version": "independent"
6
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@magicgol/polyjuice",
3
+ "version": "0.1.0",
4
+ "scripts": {
5
+ "serve": "vue-cli-service serve",
6
+ "build": "vue-cli-service build",
7
+ "lint": "vue-cli-service lint",
8
+ "storybook": "start-storybook -p 6006",
9
+ "build-storybook": "build-storybook",
10
+ "chromatic": "npx chromatic --project-token=process.env.CHROMATIC_PROJECT_TOKEN"
11
+ },
12
+ "dependencies": {
13
+ "core-js": "^3.6.5",
14
+ "vue": "^2.6.11"
15
+ },
16
+ "devDependencies": {
17
+ "@babel/core": "^7.17.9",
18
+ "@storybook/addon-actions": "^6.4.22",
19
+ "@storybook/addon-essentials": "^6.4.22",
20
+ "@storybook/addon-links": "^6.4.22",
21
+ "@storybook/preset-scss": "^1.0.3",
22
+ "@storybook/vue": "^6.4.22",
23
+ "@vue/cli-plugin-babel": "~4.5.15",
24
+ "@vue/cli-plugin-eslint": "~4.5.15",
25
+ "@vue/cli-service": "~4.5.15",
26
+ "babel-eslint": "^10.1.0",
27
+ "babel-loader": "^8.2.4",
28
+ "babel-preset-vue": "^2.0.2",
29
+ "chromatic": "^6.5.4",
30
+ "css-loader": "^5.2.7",
31
+ "eslint": "^6.7.2",
32
+ "eslint-plugin-vue": "^6.2.2",
33
+ "lerna": "^4.0.0",
34
+ "sass": "^1.50.0",
35
+ "sass-loader": "^10.1.1",
36
+ "style-loader": "^2.0.0",
37
+ "vue-loader": "^15.9.8",
38
+ "vue-template-compiler": "^2.6.14"
39
+ },
40
+ "eslintConfig": {
41
+ "root": true,
42
+ "env": {
43
+ "node": true
44
+ },
45
+ "extends": [
46
+ "plugin:vue/essential",
47
+ "eslint:recommended"
48
+ ],
49
+ "parserOptions": {
50
+ "parser": "babel-eslint"
51
+ },
52
+ "rules": {}
53
+ },
54
+ "browserslist": [
55
+ "> 1%",
56
+ "last 2 versions",
57
+ "not dead"
58
+ ]
59
+ }
Binary file
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+ <head>
4
+ <link
5
+ rel="stylesheet"
6
+ href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
7
+ integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
8
+ crossorigin="anonymous"
9
+ >
10
+ <script
11
+ src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
12
+ integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
13
+ crossorigin="anonymous"
14
+ ></script>
15
+ <meta charset="utf-8">
16
+ <meta
17
+ http-equiv="X-UA-Compatible"
18
+ content="IE=edge"
19
+ >
20
+ <meta
21
+ name="viewport"
22
+ content="width=device-width,initial-scale=1.0"
23
+ >
24
+ <link
25
+ rel="icon"
26
+ href="<%= BASE_URL %>favicon.ico"
27
+ >
28
+ <title><%= htmlWebpackPlugin.options.title %></title>
29
+ </head>
30
+ <body>
31
+ <noscript>
32
+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
33
+ Please enable it to continue.</strong>
34
+ </noscript>
35
+ <div id="app"></div>
36
+ <!-- built files will be auto injected -->
37
+ </body>
38
+ </html>
package/src/App.vue ADDED
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div id="app">
3
+ <img alt="Vue logo" src="./assets/logo.png">
4
+ <HelloWorld msg="Welcome to Your Vue.js App"/>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import HelloWorld from './components/HelloWorld.vue'
10
+
11
+ export default {
12
+ name: 'App',
13
+ components: {
14
+ HelloWorld
15
+ }
16
+ }
17
+ </script>
18
+
19
+ <style>
20
+ #app {
21
+ font-family: Avenir, Helvetica, Arial, sans-serif;
22
+ -webkit-font-smoothing: antialiased;
23
+ -moz-osx-font-smoothing: grayscale;
24
+ text-align: center;
25
+ color: #2c3e50;
26
+ margin-top: 60px;
27
+ }
28
+ </style>
@@ -0,0 +1,4 @@
1
+ *:focus {
2
+ outline: none !important;
3
+ box-shadow: none !important;
4
+ }
Binary file
@@ -0,0 +1,3 @@
1
+ $palette: (
2
+ 'brand': #d81159,
3
+ );
@@ -0,0 +1,61 @@
1
+ import MgPrimaryButton from './PrimaryButton.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Form/Button/Primary Button',
6
+ component: MgPrimaryButton,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ type: {
10
+ control: { type: 'select' },
11
+ options: ['submit', 'button'],
12
+ defaultValue: 'button'
13
+ },
14
+ size: {
15
+ control: { type: 'select' },
16
+ options: ['normal', 'large'],
17
+ defaultValue: 'normal'
18
+ },
19
+ default: {
20
+ description: "The default Vue slot",
21
+ control: {
22
+ type: 'text',
23
+ },
24
+ table: {
25
+ category: 'Slots',
26
+ type: {
27
+ summary: 'html',
28
+ },
29
+ }
30
+ }
31
+ },
32
+ };
33
+
34
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
35
+ const Template = (args, { argTypes }) => ({
36
+ props: Object.keys(argTypes),
37
+ components: { MgPrimaryButton },
38
+ template: `<mg-primary-button @onClick="onClick" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-primary-button>`,
39
+ });
40
+
41
+ export const Default = Template.bind({});
42
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
43
+ Default.args = {
44
+ disabled: false,
45
+ type: 'button',
46
+ default: 'primary button'
47
+ };
48
+
49
+ export const Disabled = Template.bind({});
50
+ Disabled.args = {
51
+ disabled: true,
52
+ type: 'button',
53
+ default: 'primary button'
54
+ };
55
+
56
+ export const Large = Template.bind({});
57
+ Large.args = {
58
+ size: 'large',
59
+ type: 'button',
60
+ default: 'primary button'
61
+ };
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <button
3
+ class="d-block w-100 rounded text-white text-uppercase"
4
+ :class="classes"
5
+ :type="type"
6
+ :disabled="disabled"
7
+ @click="onClick"
8
+ ><slot></slot></button>
9
+ </template>
10
+
11
+ <script>
12
+ import './primary-button.scss';
13
+
14
+ export default {
15
+ name: 'mg-primary-button',
16
+
17
+ props: {
18
+ disabled: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ type: {
23
+ type: String,
24
+ default: 'button',
25
+ validator: function (value) {
26
+ return ['button', 'submit'].indexOf(value) !== -1;
27
+ },
28
+ },
29
+ size: {
30
+ type: String,
31
+ default: 'normal',
32
+ validator: function (value) {
33
+ return ['large', 'normal'].indexOf(value) !== -1;
34
+ },
35
+ }
36
+ },
37
+
38
+ computed: {
39
+ classes() {
40
+ return {
41
+ 'mg-primary-button': true,
42
+ 'mg-primary-button-size-normal': this.size === 'normal',
43
+ 'mg-primary-button-size-large': this.size === 'large',
44
+ 'mg-primary-button--disabled': this.disabled,
45
+ };
46
+ }
47
+ },
48
+
49
+ methods: {
50
+ onClick() {
51
+ this.$emit('onClick');
52
+ },
53
+ },
54
+ };
55
+ </script>
@@ -0,0 +1,27 @@
1
+ @import '../../../assets/palette';
2
+
3
+ .mg-primary-button {
4
+ appearance: none;
5
+ background-color: map-get($palette, 'brand');
6
+ border: 1px solid map-get($palette, 'brand');
7
+ cursor: pointer;
8
+ font-family: 'Ubuntu', sans-serif;
9
+ font-weight: 500;
10
+
11
+ &-size {
12
+ &-normal {
13
+ font-size: 0.8215rem;
14
+ padding: 0.5rem;
15
+ }
16
+ &-large {
17
+ box-shadow: 0 8px 22px 0 rgba(0, 0, 0, 0.3);
18
+ font-size: 1rem;
19
+ padding: 1rem;
20
+ }
21
+ }
22
+
23
+ &--disabled {
24
+ opacity: 0.6 !important;
25
+ cursor: not-allowed !important;
26
+ }
27
+ }
@@ -0,0 +1,42 @@
1
+ import MgSecondaryButton from './SecondaryButton.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Form/Button/Secondary Button',
6
+ component: MgSecondaryButton,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ default: {
10
+ description: "The default Vue slot",
11
+ control: {
12
+ type: 'text',
13
+ },
14
+ table: {
15
+ category: 'Slots',
16
+ type: {
17
+ summary: 'html',
18
+ },
19
+ }
20
+ }
21
+ },
22
+ };
23
+
24
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
25
+ const Template = (args, { argTypes }) => ({
26
+ props: Object.keys(argTypes),
27
+ components: { MgSecondaryButton },
28
+ template: `<mg-secondary-button @onClick="onClick" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-secondary-button>`,
29
+ });
30
+
31
+ export const Default = Template.bind({});
32
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
33
+ Default.args = {
34
+ disabled: false,
35
+ default: 'secondary button'
36
+ };
37
+
38
+ export const Disabled = Template.bind({});
39
+ Disabled.args = {
40
+ disabled: true,
41
+ default: 'secondary button'
42
+ };
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <button
3
+ class="d-block bg-white w-100 p-2 rounded text-uppercase text-center text-decoration-none"
4
+ :class="classes"
5
+ :disabled="disabled"
6
+ @click="onClick"
7
+ ><slot></slot></button>
8
+ </template>
9
+
10
+ <script>
11
+ import './secondary-button.scss';
12
+
13
+ export default {
14
+ name: 'mg-secondary-button',
15
+
16
+ props: {
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ },
22
+
23
+ computed: {
24
+ classes() {
25
+ return {
26
+ 'mg-secondary-button': true,
27
+ 'mg-secondary-button--disabled': this.disabled,
28
+ };
29
+ }
30
+ },
31
+
32
+ methods: {
33
+ onClick() {
34
+ this.$emit('onClick');
35
+ },
36
+ },
37
+ };
38
+ </script>
@@ -0,0 +1,16 @@
1
+ @import '../../../assets/palette';
2
+
3
+ .mg-secondary-button {
4
+ appearance: none;
5
+ border: 1px solid map-get($palette, 'brand');
6
+ color: map-get($palette, 'brand');
7
+ cursor: pointer;
8
+ font-family: 'Ubuntu', sans-serif;
9
+ font-size: 0.8215rem;
10
+ font-weight: 500;
11
+
12
+ &--disabled {
13
+ opacity: 0.6 !important;
14
+ cursor: not-allowed !important;
15
+ }
16
+ }
@@ -0,0 +1,42 @@
1
+ import MgTertiaryButton from './TertiaryButton.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Form/Button/Tertiary Button',
6
+ component: MgTertiaryButton,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ default: {
10
+ description: "The default Vue slot",
11
+ control: {
12
+ type: 'text',
13
+ },
14
+ table: {
15
+ category: 'Slots',
16
+ type: {
17
+ summary: 'html',
18
+ },
19
+ }
20
+ }
21
+ },
22
+ };
23
+
24
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
25
+ const Template = (args, { argTypes }) => ({
26
+ props: Object.keys(argTypes),
27
+ components: { MgTertiaryButton },
28
+ template: `<mg-tertiary-button @onClick="onClick" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-tertiary-button>`,
29
+ });
30
+
31
+ export const Default = Template.bind({});
32
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
33
+ Default.args = {
34
+ disabled: false,
35
+ default: 'tertiary button'
36
+ };
37
+
38
+ export const Disabled = Template.bind({});
39
+ Disabled.args = {
40
+ disabled: true,
41
+ default: 'tertiary button'
42
+ };
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <button
3
+ class="bg-transparent border-0 text-uppercase"
4
+ :class="classes"
5
+ :disabled="disabled"
6
+ @click="onClick"
7
+ ><slot></slot></button>
8
+ </template>
9
+
10
+ <script>
11
+ import './tertiary-button.scss';
12
+
13
+ export default {
14
+ name: 'mg-tertiary-button',
15
+
16
+ props: {
17
+ disabled: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ },
22
+
23
+ computed: {
24
+ classes() {
25
+ return {
26
+ 'mg-tertiary-button': true,
27
+ 'mg-tertiary-button--disabled': this.disabled,
28
+ };
29
+ }
30
+ },
31
+
32
+ methods: {
33
+ onClick() {
34
+ this.$emit('onClick');
35
+ },
36
+ },
37
+ };
38
+ </script>
@@ -0,0 +1,14 @@
1
+ @import '../../../assets/palette';
2
+
3
+ .mg-tertiary-button {
4
+ color: map-get($palette, 'brand');
5
+ cursor: pointer;
6
+ font-family: 'Ubuntu', sans-serif;
7
+ font-size: 0.75rem;
8
+ font-weight: 500;
9
+
10
+ &--disabled {
11
+ opacity: 0.6 !important;
12
+ cursor: not-allowed !important;
13
+ }
14
+ }
package/src/main.js ADDED
@@ -0,0 +1,8 @@
1
+ import Vue from 'vue'
2
+ import App from './App.vue'
3
+
4
+ Vue.config.productionTip = false
5
+
6
+ new Vue({
7
+ render: h => h(App),
8
+ }).$mount('#app')