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

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.5",
3
+ "version": "0.20.0-beta.6",
4
4
  "description": "Vue.js implementation of Mozaic Design System",
5
5
  "author": "Adeo - Mozaic Design System",
6
6
  "scripts": {
@@ -8,32 +8,42 @@
8
8
  <m-icon name="DisplayOptions24" />
9
9
  <span class="mc-listbox-options__trigger-label">{{ triggerLabel }}</span>
10
10
  </button>
11
- <ul
12
- v-if="items.length > 0"
11
+ <div
13
12
  ref="listbox"
13
+ class="mc-listbox-options__container"
14
+ :class="{ 'is-open': isOpen, 'align-right': position == 'right' }"
14
15
  role="listbox"
15
- class="mc-listbox-options__list"
16
16
  aria-labelledby="listbox"
17
- :class="{ 'is-open': isOpen, 'align-right': position == 'right' }"
18
17
  >
19
- <li v-for="item in items" :key="item.id" class="mc-listbox-options__tile">
20
- <m-icon
21
- v-if="item.icon"
22
- :name="item.icon"
23
- class="mc-listbox-options__icon"
24
- :color="item.danger ? '#C61112' : '#71706B'"
25
- />
26
- <component
27
- :is="item.href ? 'a' : 'button'"
28
- :href="item.href ? item.href : null"
29
- :type="item.href ? null : 'button'"
30
- class="mc-listbox-options__item"
31
- :class="{ 'is-danger': item.danger }"
18
+ <ul
19
+ v-for="(list, index) in listItems"
20
+ :key="`${list}-${index}`"
21
+ class="mc-listbox-options__list"
22
+ >
23
+ <li
24
+ v-for="item in list"
25
+ :key="item.id"
26
+ class="mc-listbox-options__tile"
32
27
  >
33
- {{ item.text }}
34
- </component>
35
- </li>
36
- </ul>
28
+ <m-icon
29
+ v-if="item.icon"
30
+ :name="item.icon"
31
+ class="mc-listbox-options__icon"
32
+ :color="item.danger ? '#C61112' : '#71706B'"
33
+ />
34
+ <component
35
+ :is="item.href ? 'a' : 'button'"
36
+ :href="item.href ? item.href : null"
37
+ :type="item.href ? null : 'button'"
38
+ class="mc-listbox-options__item"
39
+ :class="{ 'is-danger': item.danger }"
40
+ @click.self="$emit('update:itemSelected', item)"
41
+ >
42
+ {{ item.text }}
43
+ </component>
44
+ </li>
45
+ </ul>
46
+ </div>
37
47
  </div>
38
48
  </template>
39
49
 
@@ -88,6 +98,20 @@ export default {
88
98
  };
89
99
  },
90
100
 
101
+ computed: {
102
+ listItems: function () {
103
+ const hasNestedArray = this.items.filter(Array.isArray).length;
104
+
105
+ if (hasNestedArray === 0) {
106
+ const listItems = [];
107
+ listItems.push(this.items);
108
+ return [this.items];
109
+ }
110
+
111
+ return this.items;
112
+ },
113
+ },
114
+
91
115
  methods: {
92
116
  onClickOutside() {
93
117
  this.isOpen = false;
@@ -119,20 +143,15 @@ export default {
119
143
  }
120
144
  }
121
145
 
122
- &__list {
123
- $parent: get-parent-selector(&);
124
- @include unstyle-list();
125
- background-color: $color-grey-000;
126
- border: 1px solid $color-grey-600;
127
- border-radius: 3px;
146
+ &__container {
128
147
  position: absolute;
129
148
  overflow-y: auto;
130
- margin-top: 5px;
131
- margin-bottom: 0;
132
- // max-height: 13.5rem;
133
- min-width: $mu800;
134
149
  opacity: 0;
135
150
  visibility: hidden;
151
+ min-width: $mu800;
152
+ background-color: $color-grey-000;
153
+ border: 1px solid $color-grey-600;
154
+ border-radius: 3px;
136
155
 
137
156
  &.is-open {
138
157
  opacity: 1;
@@ -140,6 +159,17 @@ export default {
140
159
  z-index: 11;
141
160
  }
142
161
 
162
+ &.align-right {
163
+ transform: translateX(calc(-100% + #{$mu150}));
164
+ }
165
+ }
166
+
167
+ &__list {
168
+ $parent: get-parent-selector(&);
169
+ @include unstyle-list();
170
+ margin: 0 auto;
171
+ padding: 8px 0;
172
+
143
173
  &::-webkit-scrollbar {
144
174
  background-color: $color-grey-100;
145
175
  width: $mu025;
@@ -149,8 +179,8 @@ export default {
149
179
  }
150
180
  }
151
181
 
152
- &.align-right {
153
- transform: translateX(calc(-100% + #{$mu150}));
182
+ &:not(:last-child) {
183
+ border-bottom: 1px solid #bab6bc;
154
184
  }
155
185
  }
156
186
 
@@ -177,6 +207,7 @@ export default {
177
207
  color: currentColor;
178
208
  cursor: pointer;
179
209
  padding: 0;
210
+ white-space: nowrap;
180
211
 
181
212
  &::after {
182
213
  content: '';