@mozaic-ds/vue 0.20.0 → 0.21.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.
- package/dist/mozaic-vue.adeo.css +2 -1
- package/dist/mozaic-vue.adeo.umd.js +215 -20
- package/dist/mozaic-vue.common.js +215 -20
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +215 -20
- package/dist/mozaic-vue.umd.js.map +1 -1
- package/dist/mozaic-vue.umd.min.js +2 -2
- package/dist/mozaic-vue.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/index.js +1 -1
- package/src/components/listbox/MListBoxActions.vue +244 -0
- package/src/components/listbox/index.js +6 -1
- package/src/components/phonenumber/MPhoneNumber.vue +1 -0
- package/src/components/quantityselector/MQuantitySelector.vue +1 -0
- package/src/components/stepper/MStepper.vue +68 -27
- package/src/index.js +1 -1
- package/types/index.d.ts +2 -0
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -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 } 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';
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-click-outside="onClickOutside" class="mc-listbox-options">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="mc-listbox-options__trigger"
|
|
6
|
+
@click="isOpen = !isOpen"
|
|
7
|
+
>
|
|
8
|
+
<m-icon name="DisplayOptions24" />
|
|
9
|
+
<span class="mc-listbox-options__trigger-label">{{ triggerLabel }}</span>
|
|
10
|
+
</button>
|
|
11
|
+
<div
|
|
12
|
+
ref="listbox"
|
|
13
|
+
class="mc-listbox-options__container"
|
|
14
|
+
:class="{ 'is-open': isOpen, 'align-right': position == 'right' }"
|
|
15
|
+
role="listbox"
|
|
16
|
+
aria-labelledby="listbox"
|
|
17
|
+
>
|
|
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"
|
|
27
|
+
:class="{ 'is-disabled': item.disabled }"
|
|
28
|
+
>
|
|
29
|
+
<m-icon
|
|
30
|
+
v-if="item.icon"
|
|
31
|
+
:name="item.icon"
|
|
32
|
+
class="mc-listbox-options__icon"
|
|
33
|
+
:color="item.danger ? '#C61112' : '#71706B'"
|
|
34
|
+
/>
|
|
35
|
+
<component
|
|
36
|
+
:is="item.href ? 'a' : 'button'"
|
|
37
|
+
:href="item.href ? item.href : null"
|
|
38
|
+
:type="item.href ? null : 'button'"
|
|
39
|
+
:disabled="item.href ? null : true"
|
|
40
|
+
class="mc-listbox-options__item"
|
|
41
|
+
:class="{ 'is-danger': item.danger, 'is-disabled': item.disabled }"
|
|
42
|
+
@click.self="$emit('update:itemSelected', item)"
|
|
43
|
+
>
|
|
44
|
+
{{ item.text }}
|
|
45
|
+
</component>
|
|
46
|
+
</li>
|
|
47
|
+
</ul>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import MIcon from '../icon/MIcon.vue';
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'MListBoxActions',
|
|
57
|
+
|
|
58
|
+
components: {
|
|
59
|
+
MIcon,
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
directives: {
|
|
63
|
+
'click-outside': {
|
|
64
|
+
bind(el, binding, vnode) {
|
|
65
|
+
el.clickOutsideEvent = (event) => {
|
|
66
|
+
if (!(el === event.target || el.contains(event.target))) {
|
|
67
|
+
vnode.context[binding.expression](event);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
document.body.addEventListener('click', el.clickOutsideEvent);
|
|
71
|
+
},
|
|
72
|
+
unbind(el) {
|
|
73
|
+
document.body.removeEventListener('click', el.clickOutsideEvent);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
props: {
|
|
79
|
+
open: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
position: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'left',
|
|
86
|
+
},
|
|
87
|
+
items: {
|
|
88
|
+
type: Array,
|
|
89
|
+
default: () => [],
|
|
90
|
+
},
|
|
91
|
+
triggerLabel: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: 'Display options',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
data() {
|
|
98
|
+
return {
|
|
99
|
+
isOpen: this.open,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
computed: {
|
|
104
|
+
listItems: function () {
|
|
105
|
+
const hasNestedArray = this.items.filter(Array.isArray).length;
|
|
106
|
+
|
|
107
|
+
if (hasNestedArray === 0) {
|
|
108
|
+
const listItems = [];
|
|
109
|
+
listItems.push(this.items);
|
|
110
|
+
return [this.items];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return this.items;
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
methods: {
|
|
118
|
+
onClickOutside() {
|
|
119
|
+
this.isOpen = false;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="scss">
|
|
126
|
+
@import 'settings-tools/all-settings';
|
|
127
|
+
|
|
128
|
+
.mc-listbox-options {
|
|
129
|
+
display: inline-block;
|
|
130
|
+
position: relative;
|
|
131
|
+
|
|
132
|
+
&__trigger {
|
|
133
|
+
align-items: center;
|
|
134
|
+
background: none;
|
|
135
|
+
border: none;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
display: flex;
|
|
138
|
+
height: $mu150;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
padding: 0;
|
|
141
|
+
width: $mu150;
|
|
142
|
+
|
|
143
|
+
&-label {
|
|
144
|
+
@include visually-hidden();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__container {
|
|
149
|
+
position: absolute;
|
|
150
|
+
overflow-y: auto;
|
|
151
|
+
opacity: 0;
|
|
152
|
+
visibility: hidden;
|
|
153
|
+
min-width: $mu800;
|
|
154
|
+
background-color: $color-grey-000;
|
|
155
|
+
border: 1px solid $color-grey-600;
|
|
156
|
+
border-radius: 3px;
|
|
157
|
+
|
|
158
|
+
&.is-open {
|
|
159
|
+
opacity: 1;
|
|
160
|
+
visibility: visible;
|
|
161
|
+
z-index: 11;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&.align-right {
|
|
165
|
+
transform: translateX(calc(-100% + #{$mu150}));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__list {
|
|
170
|
+
$parent: get-parent-selector(&);
|
|
171
|
+
@include unstyle-list();
|
|
172
|
+
margin: 0 auto;
|
|
173
|
+
padding: 8px 0;
|
|
174
|
+
|
|
175
|
+
&::-webkit-scrollbar {
|
|
176
|
+
background-color: $color-grey-100;
|
|
177
|
+
width: $mu025;
|
|
178
|
+
|
|
179
|
+
&-thumb {
|
|
180
|
+
background: $color-grey-600;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&:not(:last-child) {
|
|
185
|
+
border-bottom: 1px solid #bab6bc;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&__tile {
|
|
190
|
+
align-items: center;
|
|
191
|
+
color: #1e1e1c;
|
|
192
|
+
display: flex;
|
|
193
|
+
gap: $mu050;
|
|
194
|
+
min-height: $mu250;
|
|
195
|
+
padding-left: $mu075;
|
|
196
|
+
padding-right: $mu075;
|
|
197
|
+
position: relative;
|
|
198
|
+
|
|
199
|
+
&:hover {
|
|
200
|
+
background-color: #eeedea;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.is-disabled {
|
|
204
|
+
background-color: $color-grey-200;
|
|
205
|
+
|
|
206
|
+
&,
|
|
207
|
+
.mc-listbox-options__item {
|
|
208
|
+
color: $color-grey-600;
|
|
209
|
+
cursor: not-allowed;
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&__item {
|
|
216
|
+
@include set-font-scale('05', 'm');
|
|
217
|
+
|
|
218
|
+
background: none;
|
|
219
|
+
border: none;
|
|
220
|
+
color: currentColor;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
padding: 0;
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
|
|
225
|
+
&::after {
|
|
226
|
+
content: '';
|
|
227
|
+
position: absolute;
|
|
228
|
+
inset: 0;
|
|
229
|
+
z-index: 2;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&,
|
|
233
|
+
&:active,
|
|
234
|
+
&:hover,
|
|
235
|
+
&:focus {
|
|
236
|
+
text-decoration: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&.is-danger {
|
|
240
|
+
color: #c61112;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
</style>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import MListBox from './MListBox.vue';
|
|
2
|
+
import MListBoxActions from './MListBoxActions.vue';
|
|
2
3
|
|
|
3
4
|
MListBox.install = function (Vue) {
|
|
4
5
|
Vue.component(MListBox.name, MListBox);
|
|
5
6
|
};
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
MListBoxActions.install = function (Vue) {
|
|
9
|
+
Vue.component(MListBoxActions.name, MListBoxActions);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { MListBox, MListBoxActions };
|
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<nav
|
|
3
|
-
|
|
4
|
-
|
|
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=
|
|
7
|
-
:key=
|
|
8
|
-
class=
|
|
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=
|
|
15
|
-
:style=
|
|
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
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
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)
|
|
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=
|
|
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 } 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,6 +24,7 @@ declare module '@mozaic-ds/vue' {
|
|
|
24
24
|
const MLayer: VueConstructor;
|
|
25
25
|
const MLink: VueConstructor;
|
|
26
26
|
const MListBox: VueConstructor;
|
|
27
|
+
const MListBoxActions: VueConstructor;
|
|
27
28
|
const MLoader: VueConstructor;
|
|
28
29
|
const MModal: VueConstructor;
|
|
29
30
|
const MNotification: VueConstructor;
|
|
@@ -71,6 +72,7 @@ declare module '@mozaic-ds/vue' {
|
|
|
71
72
|
MLayer,
|
|
72
73
|
MLink,
|
|
73
74
|
MListBox,
|
|
75
|
+
MListBoxActions,
|
|
74
76
|
MLoader,
|
|
75
77
|
MModal,
|
|
76
78
|
MNotification,
|