@magicgol/polyjuice 0.33.6 → 0.34.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.
@@ -15,10 +15,6 @@ module.exports = {
15
15
  html, body {
16
16
  background: #F6F9FC;
17
17
  }
18
- .mg-selection-box-content {
19
- position: absolute !important;
20
- padding: 16px !important;
21
- }
22
18
  </style>
23
19
  `),
24
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicgol/polyjuice",
3
- "version": "0.33.6",
3
+ "version": "0.34.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -25,6 +25,7 @@ export default {
25
25
  .mg-badge {
26
26
  background-color: #84485E;
27
27
  font-family: 'Ubuntu', sans-serif;
28
+ font-size: 1rem;
28
29
  font-weight: 500;
29
30
  height: 2rem;
30
31
  width: 2rem;
@@ -39,3 +39,10 @@ Default.args = {
39
39
  light: 'green',
40
40
  default: '300',
41
41
  };
42
+
43
+ export const HTML = Template.bind({});
44
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
45
+ HTML.args = {
46
+ light: 'green',
47
+ default: '<div>Per Utente</div><div><span>91</span><span>/</span><span>50</span></div>',
48
+ };
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  class="d-inline-flex bg-white align-items-center px-3"
4
- :class="classes"
4
+ :class="[classes, {'py-1': stretched}]"
5
5
  >
6
6
  <div><slot></slot></div>
7
7
  </div>
@@ -19,6 +19,11 @@ export default {
19
19
  return ['red', 'yellow', 'green'].indexOf(value) !== -1;
20
20
  },
21
21
  },
22
+
23
+ stretched: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
22
27
  },
23
28
 
24
29
  computed: {
@@ -39,11 +44,7 @@ export default {
39
44
 
40
45
  .mg-traffic-light {
41
46
  border: 2px solid;
42
- border-radius: 50px;
43
- font-family: 'Ubuntu', sans-serif;
44
- font-size: 1.3125rem;
45
- font-weight: 500;
46
- height: 2.25rem;
47
+ border-radius: 15px;
47
48
 
48
49
  &--error {
49
50
  border-color: map-get($palette, 'error');
@@ -94,7 +94,7 @@ export default {
94
94
  return 'col-' + ((this.secondColVisibility ? 8 : 10) - this.actionsCol);
95
95
  },
96
96
  thirdColClass () {
97
- return this.actionsColVisibility ? 'col-2' : 'col-3 pr-2'
97
+ return this.actionsColVisibility ? 'col-2' : 'col-3'
98
98
  }
99
99
  },
100
100
 
@@ -17,7 +17,10 @@
17
17
  <span class="mg-checkbox-check align-middle d-inline-block position-relative"></span>
18
18
  <!-- end of THE SQUARE -->
19
19
  <!-- TEXT AS LABEL -->
20
- <span class="align-middle pl-2">
20
+ <span
21
+ v-if="slotVisibility"
22
+ class="align-middle pl-2"
23
+ >
21
24
  <slot></slot>
22
25
  </span>
23
26
  <!-- end of TEXT AS LABEL -->
@@ -48,6 +51,9 @@ export default {
48
51
  'mg-checkbox': true,
49
52
  'mg-checkbox--disabled': this.disabled,
50
53
  };
54
+ },
55
+ slotVisibility() {
56
+ return 'default' in this.$slots && !!this.$slots.default;
51
57
  }
52
58
  },
53
59
  };
@@ -20,6 +20,18 @@ export default {
20
20
  summary: 'html',
21
21
  },
22
22
  }
23
+ },
24
+ detail: {
25
+ description: "The detail Vue slot",
26
+ control: {
27
+ type: 'text',
28
+ },
29
+ table: {
30
+ category: 'Slots',
31
+ type: {
32
+ summary: 'html',
33
+ },
34
+ }
23
35
  }
24
36
  },
25
37
  };
@@ -30,6 +42,7 @@ const Template = (args, { argTypes }) => ({
30
42
  components: { MgSelectionBox, MgPrimaryButton, MgTertiaryButton },
31
43
  template: `<mg-selection-box v-bind="$props">
32
44
  <template v-if="${'default' in args}" v-slot>${args.default}</template>
45
+ <template v-if="${'detail' in args}" v-slot:detail>${args.detail}</template>
33
46
  <template v-slot:cancel>
34
47
  <mg-tertiary-button>Annulla</mg-tertiary-button>
35
48
  </template>
@@ -42,7 +55,8 @@ const Template = (args, { argTypes }) => ({
42
55
  export const Default = Template.bind({});
43
56
  // More on args: https://storybook.js.org/docs/vue/writing-stories/args
44
57
  Default.args = {
45
- default: 'this is the content'
58
+ default: 'this is the content',
59
+ detail: 'this is the detail'
46
60
  };
47
61
 
48
62
  const PaymentTemplate = (args, { argTypes }) => ({
@@ -2,9 +2,11 @@
2
2
  <div
3
3
  :class="classes"
4
4
  >
5
- <div class="mg-selection-box-content fixed-bottom p-2">
6
- <div class="bg-white rounded w-100 h-100 p-2">
7
- <div class="text-center text-uppercase"><slot></slot></div>
5
+ <div class="mg-selection-box-content fixed-bottom px-3 py-2">
6
+ <div class="bg-white rounded w-100 h-100 px-3 py-2">
7
+ <div class="mg-selection-box-title text-uppercase text-center"><slot></slot></div>
8
+ <div><slot name="summary"></slot></div>
9
+ <div v-if="expanded"><slot name="detail"></slot></div>
8
10
  <div class="d-flex align-items-center mt-2">
9
11
  <div class="w-50 text-center">
10
12
  <slot name="cancel"></slot>
@@ -23,13 +25,31 @@
23
25
  export default {
24
26
  name: 'mg-selection-box',
25
27
 
28
+ props: {
29
+ expanded: {
30
+ type: Boolean,
31
+ default: false
32
+ }
33
+ },
34
+
26
35
  computed: {
27
36
  classes() {
28
37
  return {
29
38
  'mg-selection-box': true,
39
+ 'mg-selection-box--expanded': this.expanded === true,
30
40
  };
31
- },
41
+ }
32
42
  },
43
+
44
+ watch: {
45
+ expanded (value) {
46
+ if (value) {
47
+ document.body.classList.add('overflow-hidden');
48
+ } else {
49
+ document.body.classList.remove('overflow-hidden');
50
+ }
51
+ }
52
+ }
33
53
  };
34
54
  </script>
35
55
 
@@ -39,15 +59,27 @@ export default {
39
59
  height: 7.5rem;
40
60
  }
41
61
 
62
+ &-title {
63
+ font-size: 0.8125rem;
64
+ font-weight: 500;
65
+ }
66
+
42
67
  &-content {
43
68
  bottom: 0;
44
69
 
45
70
  > div {
46
71
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
47
72
  font-family: 'Ubuntu', sans-serif;
48
- font-size: 0.8125rem;
49
- font-weight: 500;
50
73
  }
51
74
  }
75
+
76
+ &--expanded {
77
+ background-color: rgba(0, 0, 0, 0.7);
78
+ height: 100%;
79
+ left: 0;
80
+ position: fixed;
81
+ top: 0;
82
+ width: 100%;
83
+ }
52
84
  }
53
85
  </style>