@mozaic-ds/vue 0.23.0 → 1.0.0-beta.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.
Files changed (36) hide show
  1. package/dist/mozaic-vue.adeo.css +43 -43
  2. package/dist/mozaic-vue.adeo.umd.js +1319 -3718
  3. package/dist/mozaic-vue.common.js +1319 -3718
  4. package/dist/mozaic-vue.common.js.map +1 -1
  5. package/dist/mozaic-vue.css +1 -1
  6. package/dist/mozaic-vue.umd.js +1321 -3720
  7. package/dist/mozaic-vue.umd.js.map +1 -1
  8. package/dist/mozaic-vue.umd.min.js +2 -2
  9. package/dist/mozaic-vue.umd.min.js.map +1 -1
  10. package/package.json +4 -4
  11. package/src/components/autocomplete/MAutocomplete.vue +93 -151
  12. package/src/components/checkbox/MCheckboxGroup.vue +0 -8
  13. package/src/components/datatable/MDataTable.vue +162 -290
  14. package/src/components/datatable/MDataTableTop.vue +35 -0
  15. package/src/components/icon/MIcon.vue +2 -18
  16. package/src/components/index.js +1 -1
  17. package/src/components/listbox/MListBox.vue +41 -213
  18. package/src/components/listbox/index.js +1 -6
  19. package/src/components/phonenumber/MPhoneNumber.vue +2 -5
  20. package/src/components/quantityselector/MQuantitySelector.vue +2 -10
  21. package/src/components/ratingstars/MStarsInput.vue +0 -1
  22. package/src/components/stepper/MStepper.vue +27 -68
  23. package/src/components/tabs/MTab.vue +55 -65
  24. package/src/components/textinput/MTextInputField.vue +1 -0
  25. package/src/index.js +1 -1
  26. package/src/tokens/adeo/android/colors.xml +166 -209
  27. package/src/tokens/adeo/css/_variables.scss +166 -209
  28. package/src/tokens/adeo/css/root.scss +46 -89
  29. package/src/tokens/adeo/ios/StyleDictionaryColor.h +5 -48
  30. package/src/tokens/adeo/ios/StyleDictionaryColor.m +171 -214
  31. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +166 -209
  32. package/src/tokens/adeo/js/tokens.js +166 -209
  33. package/src/tokens/adeo/js/tokensObject.js +310 -1285
  34. package/src/tokens/adeo/scss/_tokens.scss +174 -344
  35. package/types/index.d.ts +0 -2
  36. package/src/components/listbox/MListBoxActions.vue +0 -251
@@ -13,20 +13,8 @@
13
13
  class="mc-tabs__item"
14
14
  role="presentation"
15
15
  >
16
- <component
17
- :is="`${tab.router}`"
18
- v-if="tab.router"
19
- v-bind="tab.attrs"
20
- :to="tab.to"
21
- class="mc-tabs__link"
22
- :class="setLinkClass(tab)"
23
- active-class="mc-tabs__link--selected"
24
- >
25
- {{ tab.text }}
26
- </component>
27
16
  <component
28
17
  :is="tab.href ? (tab.disabled ? 'span' : 'a') : 'button'"
29
- v-else
30
18
  :id="tab.id"
31
19
  ref="tab"
32
20
  :href="tab.href ? (!tab.disabled ? tab.href : null) : null"
@@ -35,9 +23,14 @@
35
23
  class="mc-tabs__link"
36
24
  role="tab"
37
25
  :aria-selected="tab.active ? 'true' : 'false'"
38
- :class="setLinkClass(tab)"
39
- v-bind="tab.attrs"
40
- @click="onTabClicked($event, tab, index)"
26
+ :class="setActiveClass(tab)"
27
+ @click="
28
+ manageTabs(
29
+ $event.target,
30
+ $event,
31
+ Object.assign({ index: index }, tab)
32
+ )
33
+ "
41
34
  >
42
35
  {{ tab.text }}
43
36
  </component>
@@ -89,41 +82,38 @@ export default {
89
82
  },
90
83
  activeIndex: {
91
84
  type: Number,
92
- default: null,
85
+ default: 0,
93
86
  },
94
87
  },
95
88
 
96
89
  data() {
97
90
  return {
98
91
  tablist: null,
99
- localActiveIndex: null,
100
92
  };
101
93
  },
102
94
 
103
95
  computed: {
104
96
  setClasses() {
105
- return {
106
- 'mc-tabs--full': this.align === 'full',
107
- 'mc-tabs--full-centered': this.align === 'centered',
108
- 'mc-tabs--dropdown': this.type === 'dropdown',
109
- 'mc-tabs--no-shadow': !this.shadow,
110
- };
97
+ const classes = [
98
+ {
99
+ 'mc-tabs--full': this.align === 'full',
100
+ 'mc-tabs--full-centered': this.align === 'centered',
101
+ 'mc-tabs--dropdown': this.type === 'dropdown',
102
+ 'mc-tabs--no-shadow': !this.shadow,
103
+ },
104
+ ];
105
+
106
+ return classes;
111
107
  },
112
108
  },
113
109
 
114
110
  watch: {
115
111
  activeIndex(newValue) {
116
- this.localActiveIndex = newValue;
117
- },
118
- localActiveIndex: {
119
- handler: function (newValue) {
120
- const selectedTab = this.getTabFromIndex(newValue);
121
- if (selectedTab) {
122
- this.setTabState(selectedTab);
123
- }
124
- },
125
- immediate: true,
126
- },
112
+ const tab = this.getTabFromIndex(newValue);
113
+ if (tab && this.tabs[newValue]) {
114
+ this.manageTabs(tab, null, Object.assign({index: newValue}, this.tabs[newValue]));
115
+ }
116
+ }
127
117
  },
128
118
 
129
119
  mounted: function () {
@@ -132,16 +122,17 @@ export default {
132
122
  this.tablist = this.$refs.tablist;
133
123
 
134
124
  if (this.activeIndex) {
135
- this.localActiveIndex = this.activeIndex;
125
+ const tab = this.getTabFromIndex(this.activeIndex);
126
+ if (tab) {
127
+ this.manageTabs(tab);
128
+ }
136
129
  } else {
137
- const isActive = this.tabs.some(
138
- (tab) =>
139
- Object.prototype.hasOwnProperty.call(tab, 'active') &&
140
- tab.active === true
130
+ const isActive = this.tabs.some((tab) =>
131
+ Object.prototype.hasOwnProperty.call(tab, 'active')
141
132
  );
142
-
143
133
  if (!isActive) {
144
- this.localActiveIndex = 0;
134
+ const firstTab = this.tablist.querySelector('.mc-tabs__link');
135
+ this.manageTabs(firstTab);
145
136
  }
146
137
  }
147
138
  }
@@ -149,41 +140,40 @@ export default {
149
140
  },
150
141
 
151
142
  methods: {
152
- setLinkClass: function (tab) {
153
- return {
154
- 'mc-tabs__link--selected': tab.active,
155
- 'mc-tabs__link--disabled': tab.disabled,
156
- };
143
+ setActiveClass: function (tab) {
144
+ const tabClasses = [];
145
+
146
+ if (tab.active) {
147
+ tabClasses.push('mc-tabs__link--selected');
148
+ }
149
+
150
+ if (tab.disabled) {
151
+ tabClasses.push('mc-tabs__link--disabled');
152
+ }
153
+
154
+ return tabClasses;
157
155
  },
158
- setTabState(tab) {
156
+ manageTabs: function (el, e, tab) {
157
+ if (tab && tab.disabled) {
158
+ return;
159
+ }
160
+ if (e) {
161
+ this.$emit('tab-clicked', e.target, tab);
162
+ }
163
+
159
164
  this.tablist.querySelectorAll('.mc-tabs__link').forEach((el) => {
160
165
  el.classList.remove('mc-tabs__link--selected');
161
166
  el.setAttribute('aria-selected', 'false');
162
167
  });
163
168
 
164
- tab.classList.add('mc-tabs__link--selected');
165
- tab.setAttribute('aria-selected', 'true');
169
+ el.classList.add('mc-tabs__link--selected');
170
+ el.setAttribute('aria-selected', 'true');
166
171
  },
167
172
  getTabFromIndex: function (index) {
168
- if (
169
- this.tablist &&
170
- this.tablist.children[index] &&
171
- this.tablist.children[index].children[0]
172
- ) {
173
+ if (this.tablist && this.tablist.children[index] && this.tablist.children[index].children[0]) {
173
174
  return this.tablist.children[index].children[0];
174
175
  }
175
176
  },
176
- onTabClicked(e, tab, index) {
177
- if (tab && tab.disabled) {
178
- return;
179
- }
180
-
181
- if (typeof this.activeIndex !== 'number') {
182
- this.localActiveIndex = index;
183
- }
184
-
185
- this.$emit('tab-clicked', e.target, Object.assign({ index: index }, tab));
186
- },
187
177
  },
188
178
  };
189
179
  </script>
@@ -6,6 +6,7 @@
6
6
  :class="setClasses"
7
7
  :aria-invalid="isInvalid"
8
8
  :value="value"
9
+ @input="$emit('input', $event.target.value)"
9
10
  v-on="inputListeners"
10
11
  />
11
12
  </template>
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, MListBoxActions } from './components/listbox';
40
+ export { MListBox } from './components/listbox';
41
41
  export { MLoader } from './components/loader';
42
42
  export { MModal } from './components/modal';
43
43
  export { MNotification } from './components/notification';