@magicgol/polyjuice 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicgol/polyjuice",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ var icon = require('vue-svgicon')
3
+ icon.register({
4
+ 'check-with-circle': {
5
+ width: 16,
6
+ height: 16,
7
+ viewBox: '0 0 129 129',
8
+ data: '<g _fill="#349B50" fill-rule="nonzero"><path pid="0" d="M110.108 18.891C97.926 6.71 81.728 0 64.5 0 47.271 0 31.074 6.71 18.891 18.891 6.71 31.074 0 47.271 0 64.5c0 17.229 6.709 33.426 18.891 45.608C31.074 122.291 47.271 129 64.5 129c17.229 0 33.426-6.71 45.608-18.892C122.291 97.926 129 81.728 129 64.5c0-17.229-6.71-33.426-18.892-45.609zM64.5 121.441c-31.398 0-56.941-25.543-56.941-56.941 0-31.398 25.543-56.941 56.941-56.941 31.398 0 56.941 25.543 56.941 56.941 0 31.398-25.543 56.941-56.941 56.941z"/><path pid="1" d="M97.873 42.117a3.872 3.872 0 00-5.441 0L58.454 75.793 40.568 58.066a3.872 3.872 0 00-5.441 0 3.79 3.79 0 000 5.393l20.606 20.424A3.853 3.853 0 0058.454 85c.985 0 1.97-.372 2.72-1.117L97.874 47.51a3.79 3.79 0 000-5.393z"/></g>'
9
+ }
10
+ })
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable */
2
+ require('./check-with-circle')
2
3
  require('./magic-coin')
3
4
  require('./soccer-ball')
4
5
  require('./star-c')
@@ -53,7 +53,7 @@ export default {
53
53
  </script>
54
54
 
55
55
  <style lang="scss">
56
- @import '../../../assets/palette';
56
+ @import '../../../../assets/palette';
57
57
 
58
58
  .mg-primary-button {
59
59
  appearance: none;
@@ -36,7 +36,7 @@ export default {
36
36
  </script>
37
37
 
38
38
  <style lang="scss">
39
- @import '../../../assets/palette';
39
+ @import '../../../../assets/palette';
40
40
 
41
41
  .mg-secondary-button {
42
42
  appearance: none;
@@ -36,7 +36,7 @@ export default {
36
36
  </script>
37
37
 
38
38
  <style lang="scss">
39
- @import '../../../assets/palette';
39
+ @import '../../../../assets/palette';
40
40
 
41
41
  .mg-tertiary-button {
42
42
  color: map-get($palette, 'brand');
@@ -57,7 +57,7 @@ export default {
57
57
  </script>
58
58
 
59
59
  <style lang="scss">
60
- @import '../../../assets/palette';
60
+ @import '../../../../assets/palette';
61
61
 
62
62
  .mg-toggle-button {
63
63
  appearance: none;
@@ -0,0 +1,51 @@
1
+ import MgCheckbox from './Checkbox.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Form/Checkbox/Checkbox',
6
+ component: MgCheckbox,
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: { MgCheckbox },
28
+ template: `<mg-checkbox @click="$emit('click')" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-checkbox>`,
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
+ value: false,
36
+ default: 'checkbox'
37
+ };
38
+
39
+ export const Disabled = Template.bind({});
40
+ Disabled.args = {
41
+ disabled: true,
42
+ value: false,
43
+ default: 'checkbox'
44
+ };
45
+
46
+ export const Checked = Template.bind({});
47
+ Checked.args = {
48
+ disabled: false,
49
+ value: true,
50
+ default: 'checkbox'
51
+ };
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <label
3
+ class="mg-checkbox m-0"
4
+ v-bind:class="classes"
5
+ >
6
+ <!-- HIDDEN CHECKBOX -->
7
+ <input
8
+ type="checkbox"
9
+ class="d-none"
10
+ v-bind:name="name"
11
+ v-on:change="$emit('input', $event.target.checked)"
12
+ v-bind:checked="value"
13
+ v-bind:disabled="disabled"
14
+ />
15
+ <!-- end of HIDDEN CHECKBOX -->
16
+ <!-- THE SQUARE -->
17
+ <span class="mg-checkbox-check align-middle d-inline-block position-relative"></span>
18
+ <!-- end of THE SQUARE -->
19
+ <!-- TEXT AS LABEL -->
20
+ <span class="align-middle">
21
+ <slot></slot>
22
+ </span>
23
+ <!-- end of TEXT AS LABEL -->
24
+ </label>
25
+ </template>
26
+
27
+ <script>
28
+ export default {
29
+ name: 'mg-checkbox',
30
+
31
+ props: {
32
+ disabled: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ name: {
37
+ type: String
38
+ },
39
+ value: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ },
44
+
45
+ computed: {
46
+ classes() {
47
+ return {
48
+ 'mg-checkbox': true,
49
+ 'mg-checkbox--disabled': this.disabled,
50
+ };
51
+ }
52
+ },
53
+
54
+ methods: {
55
+ onClick() {
56
+ this.$emit('click');
57
+ },
58
+ },
59
+ };
60
+ </script>
61
+
62
+ <style lang="scss">
63
+ @import '../../../../assets/palette';
64
+
65
+ .mg-checkbox {
66
+ .mg-checkbox-check {
67
+ border: 2px solid map-get($palette, 'brand');
68
+ border-radius: 2px;
69
+ box-sizing: border-box;
70
+ height: 20px;
71
+ vertical-align: sub;
72
+ width: 20px;
73
+ }
74
+
75
+ input:checked {
76
+ + .mg-checkbox-check {
77
+ background-color: map-get($palette, 'brand');
78
+
79
+ &::after {
80
+ border-left: 2px solid #fff;
81
+ border-bottom: 2px solid #fff;
82
+ content: '';
83
+ height: 8px;
84
+ left: 50%;
85
+ margin-left: -7px;
86
+ position: absolute;
87
+ top: 2px;
88
+ transform: rotate(-45deg);
89
+ width: 14px;
90
+ }
91
+ }
92
+ }
93
+
94
+ &--disabled {
95
+ opacity: 0.6 !important;
96
+ cursor: not-allowed !important;
97
+ }
98
+ }
99
+ </style>
@@ -0,0 +1,39 @@
1
+ import MgSwitch from './Switch.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Form/Checkbox/Switch',
6
+ component: MgSwitch,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {},
9
+ };
10
+
11
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
12
+ const Template = (args, { argTypes }) => ({
13
+ props: Object.keys(argTypes),
14
+ components: { MgSwitch },
15
+ template: `<mg-switch @input="$emit('input')" v-bind="$props"></mg-switch>`,
16
+ });
17
+
18
+ export const Default = Template.bind({});
19
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
20
+ Default.args = {
21
+ value: false
22
+ };
23
+
24
+ export const Checked = Template.bind({});
25
+ Checked.args = {
26
+ value: true
27
+ };
28
+
29
+ export const Disabled = Template.bind({});
30
+ Disabled.args = {
31
+ disabled: true,
32
+ value: false
33
+ };
34
+
35
+ export const Blocked = Template.bind({});
36
+ Blocked.args = {
37
+ value: true,
38
+ reversible: false
39
+ };
@@ -0,0 +1,167 @@
1
+ <template>
2
+ <label
3
+ class="mg-switch"
4
+ v-bind:class="classes"
5
+ >
6
+ <input
7
+ type="checkbox"
8
+ v-bind:checked="value"
9
+ v-bind:disabled="disabled"
10
+ v-on:input="onInput"
11
+ >
12
+ <span class="mg-switch-slider"></span>
13
+ <span class="mg-switch-icon">
14
+ <svgicon
15
+ name="check-with-circle"
16
+ ></svgicon>
17
+ </span>
18
+ </label>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ name: 'mg-switch',
24
+
25
+ props: {
26
+ disabled: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ reversible: {
31
+ type: Boolean,
32
+ default: true
33
+ },
34
+ value: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ },
39
+
40
+ computed: {
41
+ checked() {
42
+ return this.value === true;
43
+ },
44
+ blocked() {
45
+ return this.checked && this.reversible === false;
46
+ },
47
+ classes() {
48
+ return {
49
+ 'mg-switch': true,
50
+ 'mg-switch--disabled': this.disabled,
51
+ 'mg-switch--checked': this.checked,
52
+ 'mg-switch--blocked': this.blocked
53
+ };
54
+ },
55
+ },
56
+
57
+ methods: {
58
+ onInput($event) {
59
+ if (!this.blocked) {
60
+ this.$emit('input', $event.target.checked);
61
+ }
62
+ },
63
+ },
64
+ };
65
+ </script>
66
+
67
+ <style lang="scss">
68
+ @import '../../../../assets/palette';
69
+
70
+ .mg-switch {
71
+ cursor: pointer;
72
+ display: inline-block;
73
+ height: 32px;
74
+ position: relative;
75
+ width: 60px;
76
+
77
+ input {
78
+ opacity: 0;
79
+ width: 0;
80
+ height: 0;
81
+ }
82
+
83
+ &-slider {
84
+ background-color: #ccc;
85
+ border-radius: 32px;
86
+ bottom: 0;
87
+ cursor: pointer;
88
+ left: 0;
89
+ position: absolute;
90
+ right: 0;
91
+ top: 0;
92
+ transition: .4s;
93
+
94
+ &:before {
95
+ background-color: white;
96
+ border-radius: 50%;
97
+ bottom: 4px;
98
+ content: "";
99
+ height: 24px;
100
+ left: 4px;
101
+ position: absolute;
102
+ transition: .4s;
103
+ width: 24px;
104
+ }
105
+ }
106
+
107
+ &-icon {
108
+ display: none;
109
+ left: 50%;
110
+ top: 50%;
111
+ margin-top: -.6125rem;
112
+ margin-left: -.6125rem;
113
+ position: absolute;
114
+ width: 1.25rem;
115
+
116
+ svg {
117
+ fill: #fff;
118
+ }
119
+ }
120
+
121
+ &--checked {
122
+ .mg-switch-slider {
123
+ background-color: map-get($palette, 'brand') !important;
124
+
125
+ &:before {
126
+ transform: translateX(28px);
127
+ }
128
+ }
129
+ }
130
+
131
+ &--blocked {
132
+ .mg-switch-slider {
133
+ background-color: map-get($palette, 'success') !important;
134
+
135
+ &:before {
136
+ content: none;
137
+ }
138
+ }
139
+
140
+ .mg-switch-icon {
141
+ display: block !important;
142
+ }
143
+ }
144
+
145
+
146
+ &--disabled {
147
+ opacity: 0.6 !important;
148
+ cursor: not-allowed !important;
149
+ }
150
+ //
151
+
152
+ //
153
+ // &--blocked {
154
+ // .mg-switch-slider {
155
+ // background-color: map-get($palette, 'success');
156
+ //
157
+ // &:before {
158
+ // content: none;
159
+ // }
160
+ // }
161
+ //
162
+ // .mg-switch-check {
163
+ // display: block !important;
164
+ // }
165
+ // }
166
+ }
167
+ </style>
package/src/main.js CHANGED
@@ -22,10 +22,10 @@ export MgHCard from './components/card/horizontal-card/HCard';
22
22
  export MgVCard from './components/card/vertical-card/VCard';
23
23
  export MgPrimaryClubButton from './components/club/button/primary-club-button/PrimaryClubButton';
24
24
  export MgSecondaryClubButton from './components/club/button/secondary-club-button/SecondaryClubButton';
25
- export MgPrimaryButton from './components/form/primary-button/PrimaryButton';
26
- export MgSecondaryButton from './components/form/secondary-button/SecondaryButton';
27
- export MgTertiaryButton from './components/form/tertiary-button/TertiaryButton';
28
- export MgToggleButton from './components/form/toggle-button/ToggleButton';
25
+ export MgPrimaryButton from './components/form/button/primary-button/PrimaryButton';
26
+ export MgSecondaryButton from './components/form/button/secondary-button/SecondaryButton';
27
+ export MgTertiaryButton from './components/form/button/tertiary-button/TertiaryButton';
28
+ export MgToggleButton from './components/form/button/toggle-button/ToggleButton';
29
29
  export MgMagicCoinButton from './components/magic-coin/button/MagicCoinButton';
30
30
  export MgCredits from './components/magic-coin/credits/Credits';
31
31
  export MgSoccerBall from './components/loader/soccer-ball/SoccerBall';
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg viewBox="0 0 129 129" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
+ <!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
4
+ <title>verified</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <g id="Lega" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
7
+ <g id="Lega---Nuova-Lega---Creata" transform="translate(-123.000000, -104.000000)" fill="#349B50" fill-rule="nonzero">
8
+ <g id="verified" transform="translate(123.000000, 104.000000)">
9
+ <path d="M110.108303,18.8914453 C97.9258652,6.70925977 81.7285547,0 64.5,0 C47.2711934,0 31.0736309,6.70925977 18.8914453,18.8914453 C6.70900781,31.0738828 0,47.2714453 0,64.5 C0,81.7285547 6.70900781,97.9258652 18.8914453,110.108303 C31.0738828,122.29074 47.2711934,129 64.5,129 C81.7285547,129 97.9258652,122.29074 110.108303,110.108303 C122.29074,97.9258652 129,81.7285547 129,64.5 C129,47.2714453 122.29074,31.0741348 110.108303,18.8914453 Z M64.5,121.441406 C33.1023574,121.441406 7.55859375,95.8976426 7.55859375,64.5 C7.55859375,33.1023574 33.1023574,7.55859375 64.5,7.55859375 C95.8976426,7.55859375 121.441406,33.1023574 121.441406,64.5 C121.441406,95.8976426 95.8976426,121.441406 64.5,121.441406 Z" id="Shape"></path>
10
+ <path d="M97.8730081,42.1165964 C96.3706087,40.6277588 93.9342438,40.6277588 92.4318444,42.1168506 L58.4543268,75.7934108 L40.5684121,58.0659215 C39.0660128,56.5768297 36.6296478,56.5768297 35.1269919,58.0659215 C33.624336,59.5550133 33.624336,61.969798 35.1269919,63.4591441 L55.7334884,83.8831176 C56.4848164,84.6277906 57.4695716,85 58.4540703,85 C59.438569,85 60.4235807,84.6275364 61.1746521,83.8831176 L97.8730081,47.509819 C99.375664,46.0207272 99.375664,43.6059425 97.8730081,42.1165964 Z" id="Path"></path>
11
+ </g>
12
+ </g>
13
+ </g>
14
+ </svg>