@mozaic-ds/vue 0.13.1 → 0.14.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozaic-ds/vue",
3
- "version": "0.13.1",
3
+ "version": "0.14.2",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build ./src/index.js",
@@ -13,9 +13,9 @@
13
13
  "postinstall": "node postinstall.js"
14
14
  },
15
15
  "dependencies": {
16
- "@mozaic-ds/css-dev-tools": "^1.24.0",
17
- "@mozaic-ds/icons": "^1.20.0",
18
- "@mozaic-ds/styles": "^1.24.1",
16
+ "@mozaic-ds/css-dev-tools": "^1.26.0",
17
+ "@mozaic-ds/icons": "^1.26.0",
18
+ "@mozaic-ds/styles": "^1.26.1",
19
19
  "@mozaic-ds/web-fonts": "^1.22.0",
20
20
  "core-js": "^3.18.3",
21
21
  "libphonenumber-js": "^1.9.37",
@@ -4,7 +4,7 @@
4
4
  class="mc-card__visual"
5
5
  :class="imageratio ? `mc-card__visual--${imageratio}` : ''"
6
6
  >
7
- <img :src="imgSrc" :alt="imgAlt" class="mc-card__img" />
7
+ <img :src="imgSrc" :loading="lazy ? 'lazy' : 'eager'" :alt="imgAlt" class="mc-card__img" />
8
8
  </figure>
9
9
  <article class="mc-card__content">
10
10
  <component :is="titleTag" class="mc-card__title">
@@ -36,6 +36,10 @@ export default {
36
36
  type: String,
37
37
  required: true,
38
38
  },
39
+ lazy: {
40
+ type: Boolean,
41
+ default: false
42
+ },
39
43
  outlined: {
40
44
  type: Boolean,
41
45
  default: false,
@@ -20,6 +20,8 @@ export { MLink } from './link';
20
20
  export { MModal } from './modal';
21
21
  export { MNotification } from './notification';
22
22
  export { MOptionButton } from './optionbutton';
23
+ export { MOptionCard } from './optioncard';
24
+ export { MOptionGroup } from './optiongroup';
23
25
  export { MPagination } from './pagination';
24
26
  export { MPasswordInput } from './passwordinput';
25
27
  export { MPhoneNumber } from './phonenumber';
@@ -1,26 +1,21 @@
1
1
  <template>
2
- <div class="mc-option-group">
3
- <template v-for="(option, index) in options">
4
- <div
5
- :key="index"
6
- class="mc-option-button"
7
- :class="{ 'mc-option-button--full': option.full }"
8
- >
9
- <input
10
- :id="option.id"
11
- type="radio"
12
- class="mc-option-button__input"
13
- :name="option.name"
14
- :value="option.value"
15
- :disabled="option.disabled"
16
- :checked="checked"
17
- @change="$emit('change', $event.target.checked)"
18
- />
19
- <label :for="option.id" class="mc-option-button__label">
20
- {{ option.label }}
21
- </label>
22
- </div>
23
- </template>
2
+ <div
3
+ class="mc-option-button"
4
+ :class="{ 'mc-option-button--full': fullWidth }"
5
+ >
6
+ <input
7
+ :id="id"
8
+ type="radio"
9
+ class="mc-option-button__input"
10
+ :name="name"
11
+ :checked="checked"
12
+ :disabled="disabled"
13
+ v-bind="inputAttrs"
14
+ @change="$emit('change', $event.target.checked)"
15
+ />
16
+ <label :for="id" class="mc-option-button__label">
17
+ {{ label }}
18
+ </label>
24
19
  </div>
25
20
  </template>
26
21
 
@@ -34,14 +29,34 @@ export default {
34
29
  },
35
30
 
36
31
  props: {
37
- options: {
38
- type: Array,
32
+ id: {
33
+ type: String,
39
34
  required: true,
40
35
  },
36
+ label: {
37
+ type: String,
38
+ required: true,
39
+ },
40
+ name: {
41
+ type: String,
42
+ default: null,
43
+ },
41
44
  checked: {
42
45
  type: Boolean,
43
46
  default: false,
44
47
  },
48
+ disabled: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ fullWidth: {
53
+ type: Boolean,
54
+ default: false,
55
+ },
56
+ inputAttrs: {
57
+ type: Object,
58
+ default: () => ({}),
59
+ },
45
60
  },
46
61
  };
47
62
  </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="mc-option-card" :class="setClasses">
3
+ <input
4
+ :id="id"
5
+ :type="setType"
6
+ class="mc-option-card__input"
7
+ :class="setInputClasses"
8
+ :name="name"
9
+ :required="required"
10
+ :checked="checked"
11
+ v-bind="inputAttrs"
12
+ @change="$emit('change', $event.target.checked)"
13
+ />
14
+ <label :for="id" class="mc-option-card__label">
15
+ <span class="mc-option-card__label-text">{{ label }}</span>
16
+ </label>
17
+ <div class="mc-option-card__content">
18
+ <slot />
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: 'MOptionCard',
26
+
27
+ model: {
28
+ prop: 'checked',
29
+ event: 'change',
30
+ },
31
+
32
+ props: {
33
+ id: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ type: {
38
+ type: String,
39
+ default: 'radio',
40
+ validator: (value) => ['radio', 'checkbox'].includes(value),
41
+ },
42
+ label: {
43
+ type: String,
44
+ required: true,
45
+ },
46
+ name: {
47
+ type: String,
48
+ default: null,
49
+ },
50
+ checked: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ required: {
55
+ type: Boolean,
56
+ default: false,
57
+ },
58
+ index: {
59
+ type: Number,
60
+ default: 1,
61
+ },
62
+ centered: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ small: {
67
+ type: Boolean,
68
+ default: false,
69
+ },
70
+ noPadding: {
71
+ type: Boolean,
72
+ default: false,
73
+ },
74
+ inputAttrs: {
75
+ type: Object,
76
+ default: () => ({}),
77
+ },
78
+ },
79
+
80
+ computed: {
81
+ setType() {
82
+ return this.type === 'checkbox' ? 'checkbox' : 'radio';
83
+ },
84
+ setClasses() {
85
+ return {
86
+ 'mc-option-card--centered': this.centered,
87
+ 'mc-option-card--no-padding': this.noPadding,
88
+ 'mc-option-card--small': this.small,
89
+ };
90
+ },
91
+ setInputClasses() {
92
+ return {
93
+ 'mc-checkbox__input': this.type === 'checkbox',
94
+ 'mc-radio__input': this.type === 'radio',
95
+ };
96
+ },
97
+ },
98
+ };
99
+ </script>
100
+
101
+ <style lang="scss">
102
+ @import 'settings-tools/all-settings';
103
+ @import 'components/c.option-card';
104
+
105
+ // temporary fix
106
+ .mc-option-card {
107
+ $parent: get-parent-selector(&);
108
+
109
+ border-radius: get-border-radius('m');
110
+ cursor: pointer;
111
+ position: relative;
112
+
113
+ &__input {
114
+ @at-root input#{&} {
115
+ &:checked ~ #{$parent}__content {
116
+ button,
117
+ [href],
118
+ input,
119
+ select,
120
+ textarea,
121
+ [tabindex]:not([tabindex='-1']) {
122
+ position: relative;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ </style>
@@ -0,0 +1,7 @@
1
+ import MOptionCard from './MOptionCard.vue';
2
+
3
+ MOptionCard.install = function (Vue) {
4
+ Vue.component(MOptionCard.name, MOptionCard);
5
+ };
6
+
7
+ export { MOptionCard };
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <component :is="htmlTag" class="mc-option-group">
3
+ <slot />
4
+ </component>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MOptionGroup',
10
+
11
+ props: {
12
+ htmlTag: {
13
+ type: String,
14
+ default: 'div',
15
+ },
16
+ },
17
+ };
18
+ </script>
@@ -0,0 +1,7 @@
1
+ import MOptionGroup from './MOptionGroup.vue';
2
+
3
+ MOptionGroup.install = function (Vue) {
4
+ Vue.component(MOptionGroup.name, MOptionGroup);
5
+ };
6
+
7
+ export { MOptionGroup };
package/src/index.js CHANGED
@@ -39,6 +39,8 @@ export { MLink } from './components/link';
39
39
  export { MModal } from './components/modal';
40
40
  export { MNotification } from './components/notification';
41
41
  export { MOptionButton } from './components/optionbutton';
42
+ export { MOptionCard } from './components/optioncard';
43
+ export { MOptionGroup } from './components/optiongroup';
42
44
  export { MPagination } from './components/pagination';
43
45
  export { MPasswordInput } from './components/passwordinput';
44
46
  export { MPhoneNumber } from './components/phonenumber';
package/types/index.d.ts CHANGED
@@ -24,6 +24,8 @@ declare module '@mozaic-ds/vue' {
24
24
  const MModal: VueConstructor;
25
25
  const MNotification: VueConstructor;
26
26
  const MOptionButton: VueConstructor;
27
+ const MOptionCard: VueConstructor;
28
+ const MOptionGroup: VueConstructor;
27
29
  const MPagination: VueConstructor;
28
30
  const MPasswordInput: VueConstructor;
29
31
  const MPhoneNumber: VueConstructor;
@@ -63,6 +65,8 @@ declare module '@mozaic-ds/vue' {
63
65
  MModal,
64
66
  MNotification,
65
67
  MOptionButton,
68
+ MOptionCard,
69
+ MOptionGroup,
66
70
  MPagination,
67
71
  MPasswordInput,
68
72
  MPhoneNumber,