@magicgol/polyjuice 0.33.7 → 0.34.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.7",
3
+ "version": "0.34.1",
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');
@@ -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,15 @@
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
6
+ class="mg-selection-box-curtain h-50 w-100 position-fixed"
7
+ @click="onClickOutside"
8
+ ></div>
9
+ <div class="mg-selection-box-content fixed-bottom px-3 py-2">
10
+ <div class="d-flex flex-column bg-white rounded w-100 h-100 px-3 py-2">
11
+ <div class="mg-selection-box-title text-uppercase text-center"><slot></slot></div>
12
+ <div><slot name="summary"></slot></div>
13
+ <div class="flex-fill" v-if="expanded"><slot name="detail"></slot></div>
8
14
  <div class="d-flex align-items-center mt-2">
9
15
  <div class="w-50 text-center">
10
16
  <slot name="cancel"></slot>
@@ -23,30 +29,75 @@
23
29
  export default {
24
30
  name: 'mg-selection-box',
25
31
 
32
+ props: {
33
+ expanded: {
34
+ type: Boolean,
35
+ default: false
36
+ }
37
+ },
38
+
26
39
  computed: {
27
40
  classes() {
28
41
  return {
29
42
  'mg-selection-box': true,
43
+ 'mg-selection-box--expanded': this.expanded === true,
30
44
  };
31
- },
45
+ }
46
+ },
47
+
48
+ watch: {
49
+ expanded (value) {
50
+ if (value) {
51
+ document.body.classList.add('overflow-hidden');
52
+ } else {
53
+ document.body.classList.remove('overflow-hidden');
54
+ }
55
+ }
32
56
  },
57
+
58
+ methods: {
59
+ onClickOutside () {
60
+ this.$emit('click-outside');
61
+ }
62
+ }
33
63
  };
34
64
  </script>
35
65
 
36
66
  <style lang="scss">
37
67
  .mg-selection-box {
68
+ &-curtain {
69
+ left: 0;
70
+ top: 0;
71
+ }
72
+
38
73
  &-shadow {
39
74
  height: 7.5rem;
40
75
  }
41
76
 
77
+ &-title {
78
+ font-size: 0.8125rem;
79
+ font-weight: 500;
80
+ }
81
+
42
82
  &-content {
43
83
  bottom: 0;
44
84
 
45
85
  > div {
46
86
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.3);
47
87
  font-family: 'Ubuntu', sans-serif;
48
- font-size: 0.8125rem;
49
- font-weight: 500;
88
+ }
89
+ }
90
+
91
+ &--expanded {
92
+ background-color: rgba(0, 0, 0, 0.7);
93
+ height: 100%;
94
+ left: 0;
95
+ position: fixed;
96
+ top: 0;
97
+ width: 100%;
98
+
99
+ .mg-selection-box-content {
100
+ height: 50%;
50
101
  }
51
102
  }
52
103
  }