@mozaic-ds/vue 1.0.0-rc.0 → 1.0.0-rc.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.
Files changed (41) hide show
  1. package/README.md +10 -8
  2. package/dist/mozaic-vue.adeo.css +45 -43
  3. package/dist/mozaic-vue.adeo.umd.js +11694 -22360
  4. package/dist/mozaic-vue.common.js +11694 -22360
  5. package/dist/mozaic-vue.common.js.map +1 -1
  6. package/dist/mozaic-vue.css +1 -1
  7. package/dist/mozaic-vue.umd.js +11694 -22360
  8. package/dist/mozaic-vue.umd.js.map +1 -1
  9. package/dist/mozaic-vue.umd.min.js +2 -2
  10. package/dist/mozaic-vue.umd.min.js.map +1 -1
  11. package/package.json +23 -22
  12. package/src/components/autocomplete/MAutocomplete.vue +294 -111
  13. package/src/components/checkbox/MCheckboxGroup.vue +8 -0
  14. package/src/components/dropdown/MDropdown.vue +317 -0
  15. package/src/components/dropdown/index.js +7 -0
  16. package/src/components/flag/MFlag.vue +1 -1
  17. package/src/components/icon/MIcon.vue +18 -2
  18. package/src/components/index.js +2 -1
  19. package/src/components/link/MLink.vue +14 -3
  20. package/src/components/listbox/MListBox.vue +97 -57
  21. package/src/components/listbox/MListBoxActions.vue +251 -0
  22. package/src/components/listbox/index.js +6 -1
  23. package/src/components/passwordinput/MPasswordInput.vue +1 -0
  24. package/src/components/phonenumber/MPhoneNumber.vue +11 -3
  25. package/src/components/quantityselector/MQuantitySelector.vue +15 -2
  26. package/src/components/ratingstars/MStarsInput.vue +1 -0
  27. package/src/components/stepper/MStepper.vue +68 -27
  28. package/src/components/tabs/MTab.vue +73 -59
  29. package/src/components/textarea/MTextArea.vue +1 -0
  30. package/src/components/textinput/MTextInputField.vue +1 -1
  31. package/src/index.js +2 -1
  32. package/src/tokens/adeo/android/colors.xml +183 -126
  33. package/src/tokens/adeo/css/_variables.scss +183 -126
  34. package/src/tokens/adeo/css/root.scss +80 -23
  35. package/src/tokens/adeo/ios/StyleDictionaryColor.h +60 -3
  36. package/src/tokens/adeo/ios/StyleDictionaryColor.m +187 -130
  37. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +183 -126
  38. package/src/tokens/adeo/js/tokens.js +183 -126
  39. package/src/tokens/adeo/js/tokensObject.js +1570 -283
  40. package/src/tokens/adeo/scss/_tokens.scss +342 -128
  41. package/types/index.d.ts +4 -0
@@ -13,26 +13,33 @@
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__element"
22
+ :class="setLinkClass(tab)"
23
+ active-class="mc-tabs__element--selected"
24
+ >
25
+ <span class="mc-tabs__text">{{ tab.text }}</span>
26
+ </component>
16
27
  <component
17
28
  :is="tab.href ? (tab.disabled ? 'span' : 'a') : 'button'"
29
+ v-else
18
30
  :id="tab.id"
19
31
  ref="tab"
20
32
  :href="tab.href ? (!tab.disabled ? tab.href : null) : null"
21
33
  :type="!tab.href ? 'button' : null"
22
34
  :disabled="!tab.href && tab.disabled ? true : null"
23
- class="mc-tabs__link"
35
+ class="mc-tabs__element"
24
36
  role="tab"
25
37
  :aria-selected="tab.active ? 'true' : 'false'"
26
- :class="setActiveClass(tab)"
27
- @click="
28
- manageTabs(
29
- $event.target,
30
- $event,
31
- Object.assign({ index: index }, tab)
32
- )
33
- "
38
+ :class="setLinkClass(tab)"
39
+ v-bind="tab.attrs"
40
+ @click="onTabClicked($event, tab, index)"
34
41
  >
35
- {{ tab.text }}
42
+ <span class="mc-tabs__text">{{ tab.text }}</span>
36
43
  </component>
37
44
  </li>
38
45
  </ul>
@@ -82,38 +89,41 @@ export default {
82
89
  },
83
90
  activeIndex: {
84
91
  type: Number,
85
- default: 0,
92
+ default: null,
86
93
  },
87
94
  },
88
95
 
89
96
  data() {
90
97
  return {
91
98
  tablist: null,
99
+ localActiveIndex: null,
92
100
  };
93
101
  },
94
102
 
95
103
  computed: {
96
104
  setClasses() {
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;
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-divider': !this.shadow,
110
+ };
107
111
  },
108
112
  },
109
113
 
110
114
  watch: {
111
115
  activeIndex(newValue) {
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
- }
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
+ },
117
127
  },
118
128
 
119
129
  mounted: function () {
@@ -122,17 +132,16 @@ export default {
122
132
  this.tablist = this.$refs.tablist;
123
133
 
124
134
  if (this.activeIndex) {
125
- const tab = this.getTabFromIndex(this.activeIndex);
126
- if (tab) {
127
- this.manageTabs(tab);
128
- }
135
+ this.localActiveIndex = this.activeIndex;
129
136
  } else {
130
- const isActive = this.tabs.some((tab) =>
131
- Object.prototype.hasOwnProperty.call(tab, 'active')
137
+ const isActive = this.tabs.some(
138
+ (tab) =>
139
+ Object.prototype.hasOwnProperty.call(tab, 'active') &&
140
+ tab.active === true
132
141
  );
142
+
133
143
  if (!isActive) {
134
- const firstTab = this.tablist.querySelector('.mc-tabs__link');
135
- this.manageTabs(firstTab);
144
+ this.localActiveIndex = 0;
136
145
  }
137
146
  }
138
147
  }
@@ -140,40 +149,45 @@ export default {
140
149
  },
141
150
 
142
151
  methods: {
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;
152
+ setLinkClass: function (tab) {
153
+ return {
154
+ 'mc-tabs__element--selected': tab.active,
155
+ 'mc-tabs__element--disabled': tab.disabled,
156
+ };
155
157
  },
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
-
164
- this.tablist.querySelectorAll('.mc-tabs__link').forEach((el) => {
165
- el.classList.remove('mc-tabs__link--selected');
158
+ setTabState(tab) {
159
+ this.tablist.querySelectorAll('.mc-tabs__element').forEach((el) => {
160
+ el.classList.remove('mc-tabs__element--selected');
166
161
  el.setAttribute('aria-selected', 'false');
167
162
  });
168
163
 
169
- el.classList.add('mc-tabs__link--selected');
170
- el.setAttribute('aria-selected', 'true');
164
+ tab.classList.add('mc-tabs__element--selected');
165
+ tab.setAttribute('aria-selected', 'true');
171
166
  },
172
167
  getTabFromIndex: function (index) {
173
- if (this.tablist && this.tablist.children[index] && this.tablist.children[index].children[0]) {
168
+ if (
169
+ this.tablist &&
170
+ this.tablist.children[index] &&
171
+ this.tablist.children[index].children[0]
172
+ ) {
174
173
  return this.tablist.children[index].children[0];
175
174
  }
176
175
  },
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(
186
+ 'tab-clicked',
187
+ e.currentTarget,
188
+ Object.assign({ index: index }, tab)
189
+ );
190
+ },
177
191
  },
178
192
  };
179
193
  </script>
@@ -7,6 +7,7 @@
7
7
  ]"
8
8
  :aria-invalid="isInvalid"
9
9
  :value="value"
10
+ spellcheck="false"
10
11
  v-on="inputListeners"
11
12
  />
12
13
  </template>
@@ -6,7 +6,7 @@
6
6
  :class="setClasses"
7
7
  :aria-invalid="isInvalid"
8
8
  :value="value"
9
- @input="$emit('input', $event.target.value)"
9
+ spellcheck="false"
10
10
  v-on="inputListeners"
11
11
  />
12
12
  </template>
package/src/index.js CHANGED
@@ -31,13 +31,14 @@ export { MCard } from './components/card/';
31
31
  export { MCheckbox, MCheckboxGroup } from './components/checkbox/';
32
32
  export { MDataTable, MDataTableHeader } from './components/datatable';
33
33
  export { MField } from './components/field';
34
+ export { MDropdown } from './components/dropdown';
34
35
  export { MFileUploader } from './components/fileuploader';
35
36
  export { MFlag } from './components/flag';
36
37
  export { MHero } from './components/hero';
37
38
  export { MIcon } from './components/icon';
38
39
  export { MLayer } from './components/layer';
39
40
  export { MLink } from './components/link';
40
- export { MListBox } from './components/listbox';
41
+ export { MListBox, MListBoxActions } from './components/listbox';
41
42
  export { MLoader } from './components/loader';
42
43
  export { MModal } from './components/modal';
43
44
  export { MNotification } from './components/notification';