@mozaic-ds/vue 0.20.0-beta.6 → 0.21.1

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.20.0-beta.6",
3
+ "version": "0.21.1",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -18,7 +18,7 @@ export { MHero } from './hero';
18
18
  export { MIcon } from './icon';
19
19
  export { MLayer } from './layer';
20
20
  export { MLink } from './link';
21
- export { MListBox, MListBoxOptions } from './listbox';
21
+ export { MListBox, MListBoxActions } from './listbox';
22
22
  export { MLoader } from './loader';
23
23
  export { MModal } from './modal';
24
24
  export { MNotification } from './notification';
@@ -16,14 +16,15 @@
16
16
  aria-labelledby="listbox"
17
17
  >
18
18
  <ul
19
- v-for="(list, index) in listItems"
20
- :key="`${list}-${index}`"
19
+ v-for="(list, i) in listItems"
20
+ :key="`list${i}`"
21
21
  class="mc-listbox-options__list"
22
22
  >
23
23
  <li
24
- v-for="item in list"
25
- :key="item.id"
24
+ v-for="(item, j) in list"
25
+ :key="`item${j}`"
26
26
  class="mc-listbox-options__tile"
27
+ :class="{ 'is-disabled': item.disabled }"
27
28
  >
28
29
  <m-icon
29
30
  v-if="item.icon"
@@ -35,9 +36,10 @@
35
36
  :is="item.href ? 'a' : 'button'"
36
37
  :href="item.href ? item.href : null"
37
38
  :type="item.href ? null : 'button'"
39
+ :disabled="item.disabled ? true : null"
38
40
  class="mc-listbox-options__item"
39
- :class="{ 'is-danger': item.danger }"
40
- @click.self="$emit('update:itemSelected', item)"
41
+ :class="{ 'is-danger': item.danger, 'is-disabled': item.disabled }"
42
+ @click.self="onClickItem(item, i, j)"
41
43
  >
42
44
  {{ item.text }}
43
45
  </component>
@@ -51,7 +53,7 @@
51
53
  import MIcon from '../icon/MIcon.vue';
52
54
 
53
55
  export default {
54
- name: 'MListBoxOptions',
56
+ name: 'MListBoxActions',
55
57
 
56
58
  components: {
57
59
  MIcon,
@@ -116,6 +118,13 @@ export default {
116
118
  onClickOutside() {
117
119
  this.isOpen = false;
118
120
  },
121
+ onClickItem(item, listIndex, itemIndex) {
122
+ const valToEmit = Object.assign(
123
+ { listIndex: listIndex, itemIndex: itemIndex },
124
+ item
125
+ );
126
+ this.$emit('update:itemSelected', valToEmit);
127
+ },
119
128
  },
120
129
  };
121
130
  </script>
@@ -197,6 +206,17 @@ export default {
197
206
  &:hover {
198
207
  background-color: #eeedea;
199
208
  }
209
+
210
+ &.is-disabled {
211
+ background-color: $color-grey-200;
212
+
213
+ &,
214
+ .mc-listbox-options__item {
215
+ color: $color-grey-600;
216
+ cursor: not-allowed;
217
+ pointer-events: none;
218
+ }
219
+ }
200
220
  }
201
221
 
202
222
  &__item {
@@ -1,12 +1,12 @@
1
1
  import MListBox from './MListBox.vue';
2
- import MListBoxOptions from './MListBoxOptions.vue';
2
+ import MListBoxActions from './MListBoxActions.vue';
3
3
 
4
4
  MListBox.install = function (Vue) {
5
5
  Vue.component(MListBox.name, MListBox);
6
6
  };
7
7
 
8
- MListBoxOptions.install = function (Vue) {
9
- Vue.component(MListBoxOptions.name, MListBoxOptions);
8
+ MListBoxActions.install = function (Vue) {
9
+ Vue.component(MListBoxActions.name, MListBoxActions);
10
10
  };
11
11
 
12
- export { MListBox, MListBoxOptions };
12
+ export { MListBox, MListBoxActions };
@@ -80,6 +80,7 @@
80
80
  @keydown.backspace="
81
81
  (event) => (formatOnBlur ? null : backspaceFunction(event))
82
82
  "
83
+ v-on="$listeners"
83
84
  />
84
85
  </div>
85
86
  </template>
@@ -10,6 +10,7 @@
10
10
  :disabled="currentValue === valuemin"
11
11
  :size="small ? 's' : null"
12
12
  tabindex="-1"
13
+ type="button"
13
14
  @click="decrement()"
14
15
  />
15
16
 
@@ -28,6 +29,7 @@
28
29
  role="spinbutton"
29
30
  @input="handle"
30
31
  @keypress="integerOnly && formatValue($event)"
32
+ v-on="$listeners"
31
33
  />
32
34
 
33
35
  <m-button
@@ -40,6 +42,7 @@
40
42
  :disabled="currentValue === valuemax"
41
43
  :size="small ? 's' : null"
42
44
  tabindex="-1"
45
+ type="button"
43
46
  @click="increment()"
44
47
  />
45
48
  </div>
@@ -1,28 +1,58 @@
1
1
  <template>
2
- <nav class='mc-stepper' :class="{ 'mc-stepper--compact': compact, 'mc-stepper--shrinked': steps.length > 3}"
3
- :aria-label='accessibilityLabels.stepperDescription'>
4
- <ol class='mc-stepper__list'>
2
+ <nav
3
+ class="mc-stepper"
4
+ :class="{
5
+ 'mc-stepper--compact': compact,
6
+ 'mc-stepper--shrinked': steps.length > 3,
7
+ }"
8
+ :aria-label="accessibilityLabels.stepperDescription"
9
+ >
10
+ <ol class="mc-stepper__list">
5
11
  <li
6
- v-for='(step, idx) in steps'
7
- :key='`mc-stepper__item-${idx}`'
8
- class='mc-stepper__item'
12
+ v-for="(step, idx) in steps"
13
+ :key="`mc-stepper__item-${idx}`"
14
+ class="mc-stepper__item"
9
15
  :class="{
10
16
  'mc-stepper__item--validated': isStepValidated(idx),
11
17
  'mc-stepper__item--current': step.isCurrent,
12
18
  }"
13
19
  :aria-current="step.isCurrent ? 'step' : false"
14
- :aria-label='stepDescription(step,idx)'
15
- :style='`--steps: ${ steps.length }; --current: ${ idx +1 };`'
20
+ :aria-label="stepDescription(step, idx)"
21
+ :style="`--steps: ${steps.length}; --current: ${idx + 1};`"
16
22
  @click="isStepValidated(idx) && $emit('step-changed', step)"
17
23
  >
18
- <div class='mc-stepper__indicator' aria-hidden='true'>
19
- <m-icon v-if='isStepValidated(idx)' name='NotificationAvailable16' class='mc-stepper__icon' />
20
- <span v-else-if='step.isCurrent'>{{ idx + 1 }}</span>
21
- </div>
22
- <div class='mc-stepper__detail'>
23
- <span class='mc-stepper__title'>{{ idx + 1 }} / {{ steps.length }}</span>
24
- <span class='mc-stepper__label'>{{ step.label }}</span>
25
- </div>
24
+ <a v-if="step.href" :href="step.href" class="mc-stepper__link">
25
+ <div class="mc-stepper__indicator" aria-hidden="true">
26
+ <m-icon
27
+ v-if="isStepValidated(idx)"
28
+ name="NotificationAvailable16"
29
+ class="mc-stepper__icon"
30
+ />
31
+ <span v-else-if="step.isCurrent">{{ idx + 1 }}</span>
32
+ </div>
33
+ <div class="mc-stepper__detail">
34
+ <span class="mc-stepper__title"
35
+ >{{ idx + 1 }} / {{ steps.length }}</span
36
+ >
37
+ <span class="mc-stepper__label">{{ step.label }}</span>
38
+ </div>
39
+ </a>
40
+ <template v-else>
41
+ <div class="mc-stepper__indicator" aria-hidden="true">
42
+ <m-icon
43
+ v-if="isStepValidated(idx)"
44
+ name="NotificationAvailable16"
45
+ class="mc-stepper__icon"
46
+ />
47
+ <span v-else-if="step.isCurrent">{{ idx + 1 }}</span>
48
+ </div>
49
+ <div class="mc-stepper__detail">
50
+ <span class="mc-stepper__title"
51
+ >{{ idx + 1 }} / {{ steps.length }}</span
52
+ >
53
+ <span class="mc-stepper__label">{{ step.label }}</span>
54
+ </div>
55
+ </template>
26
56
  </li>
27
57
  </ol>
28
58
  </nav>
@@ -34,37 +64,48 @@ import MIcon from '../icon/MIcon.vue';
34
64
  export default {
35
65
  name: 'MStepper',
36
66
  components: {
37
- MIcon
67
+ MIcon,
38
68
  },
39
69
  props: {
40
70
  steps: {
41
71
  type: Array,
42
- required: true
72
+ required: true,
43
73
  },
44
74
  compact: {
45
75
  type: Boolean,
46
- default: false
76
+ default: false,
47
77
  },
48
78
  accessibilityLabels: {
49
79
  type: Object,
50
- required: true
51
- }
80
+ required: true,
81
+ },
52
82
  },
53
83
  methods: {
54
84
  isStepValidated(index) {
55
- return index < this.steps.findIndex(step => step.isCurrent);
85
+ return index < this.steps.findIndex((step) => step.isCurrent);
56
86
  },
57
87
  stepDescription(step, index) {
58
- return '#' + (index + 1) + ' ' + step.label + ', ' + this.stepStateLabel(step,index);
88
+ return (
89
+ '#' +
90
+ (index + 1) +
91
+ ' ' +
92
+ step.label +
93
+ ', ' +
94
+ this.stepStateLabel(step, index)
95
+ );
59
96
  },
60
97
  stepStateLabel(step, index) {
61
- return this.isStepValidated(index) ? this.accessibilityLabels.validatedLabel : step.isCurrent ? this.accessibilityLabels.currentLabel : this.accessibilityLabels.disabledLabel;
62
- }
63
- }
98
+ return this.isStepValidated(index)
99
+ ? this.accessibilityLabels.validatedLabel
100
+ : step.isCurrent
101
+ ? this.accessibilityLabels.currentLabel
102
+ : this.accessibilityLabels.disabledLabel;
103
+ },
104
+ },
64
105
  };
65
106
  </script>
66
107
 
67
- <style lang='scss' scoped>
108
+ <style lang="scss" scoped>
68
109
  @import 'settings-tools/_all-settings';
69
110
  @import 'components/_c.stepper';
70
111
  </style>
package/src/index.js CHANGED
@@ -37,7 +37,7 @@ export { MHero } from './components/hero';
37
37
  export { MIcon } from './components/icon';
38
38
  export { MLayer } from './components/layer';
39
39
  export { MLink } from './components/link';
40
- export { MListBox, MListBoxOptions } from './components/listbox';
40
+ export { MListBox, MListBoxActions } from './components/listbox';
41
41
  export { MLoader } from './components/loader';
42
42
  export { MModal } from './components/modal';
43
43
  export { MNotification } from './components/notification';
package/types/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare module '@mozaic-ds/vue' {
24
24
  const MLayer: VueConstructor;
25
25
  const MLink: VueConstructor;
26
26
  const MListBox: VueConstructor;
27
- const MListBoxOptions: VueConstructor;
27
+ const MListBoxActions: VueConstructor;
28
28
  const MLoader: VueConstructor;
29
29
  const MModal: VueConstructor;
30
30
  const MNotification: VueConstructor;
@@ -72,7 +72,7 @@ declare module '@mozaic-ds/vue' {
72
72
  MLayer,
73
73
  MLink,
74
74
  MListBox,
75
- MListBoxOptions,
75
+ MListBoxActions,
76
76
  MLoader,
77
77
  MModal,
78
78
  MNotification,