@mozaic-ds/vue 0.37.0 → 0.37.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/dist/mozaic-vue.adeo.css +11 -10
- package/dist/mozaic-vue.adeo.umd.js +868 -524
- package/dist/mozaic-vue.common.js +868 -524
- package/dist/mozaic-vue.common.js.map +1 -1
- package/dist/mozaic-vue.css +1 -1
- package/dist/mozaic-vue.umd.js +868 -524
- 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/checkbox/MCheckboxGroup.vue +6 -0
- package/src/components/header/index.js +1 -1
- package/src/components/index.js +2 -0
- package/src/components/kpi/MKpi.vue +40 -30
- package/src/index.js +2 -1
- package/types/index.d.ts +4 -0
- package/src/components/header/composable/useScrollDirection.js +0 -61
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -15,8 +15,10 @@ export { MField } from './field';
|
|
|
15
15
|
export { MDropdown } from './dropdown';
|
|
16
16
|
export { MFileUploader } from './fileuploader';
|
|
17
17
|
export { MFlag } from './flag';
|
|
18
|
+
export { MHeader } from './header';
|
|
18
19
|
export { MHero } from './hero';
|
|
19
20
|
export { MIcon } from './icon';
|
|
21
|
+
export { MKpi } from './kpi';
|
|
20
22
|
export { MLayer } from './layer';
|
|
21
23
|
export { MLink } from './link';
|
|
22
24
|
export { MListBox, MListBoxActions } from './listbox';
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="mc-kpi" :class="classObject">
|
|
3
|
-
<span v-if="
|
|
3
|
+
<span v-if="labelOutsideContent" class="mc-kpi__label">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</span>
|
|
4
6
|
<div class="mc-kpi__content">
|
|
5
|
-
<div class="mc-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
<div class="mc-kpi__main">
|
|
8
|
+
<span v-if="!labelOutsideContent" class="mc-kpi__label">
|
|
9
|
+
{{ label }}
|
|
10
|
+
</span>
|
|
11
|
+
<span class="mc-kpi__value">{{ value }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div v-if="icon || detail" class="mc-kpi__aside">
|
|
14
|
+
<span v-if="detail" class="mc-kpi__detail">
|
|
8
15
|
{{ detail }}
|
|
9
16
|
</span>
|
|
10
17
|
<MIcon v-if="icon" :name="icon" class="mc-kpi__icon" color="black" />
|
|
@@ -64,6 +71,9 @@ export default {
|
|
|
64
71
|
[`mc-kpi--${this.type}`]: this.type,
|
|
65
72
|
};
|
|
66
73
|
},
|
|
74
|
+
labelOutsideContent() {
|
|
75
|
+
return this.label && this.getSize !== 'large';
|
|
76
|
+
},
|
|
67
77
|
},
|
|
68
78
|
};
|
|
69
79
|
</script>
|
|
@@ -137,15 +147,19 @@ $color-kpi-text: var(
|
|
|
137
147
|
display: flex;
|
|
138
148
|
}
|
|
139
149
|
|
|
140
|
-
//
|
|
150
|
+
// main
|
|
151
|
+
&__main {
|
|
152
|
+
align-items: center;
|
|
153
|
+
display: flex;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
141
157
|
&__value {
|
|
142
158
|
@include set-font-scale('04', 'm');
|
|
143
159
|
@include set-font-weight('semi-bold');
|
|
144
|
-
|
|
145
|
-
text-align: center;
|
|
146
160
|
}
|
|
147
161
|
|
|
148
|
-
&
|
|
162
|
+
&__aside {
|
|
149
163
|
align-items: center;
|
|
150
164
|
background-color: $color-grey-000;
|
|
151
165
|
color: $color-font-dark;
|
|
@@ -153,7 +167,7 @@ $color-kpi-text: var(
|
|
|
153
167
|
justify-content: center;
|
|
154
168
|
}
|
|
155
169
|
|
|
156
|
-
&
|
|
170
|
+
&__detail {
|
|
157
171
|
@include set-font-scale('04', 'm');
|
|
158
172
|
}
|
|
159
173
|
|
|
@@ -170,13 +184,13 @@ $color-kpi-text: var(
|
|
|
170
184
|
gap: $mu050;
|
|
171
185
|
}
|
|
172
186
|
|
|
173
|
-
&
|
|
187
|
+
&__main {
|
|
174
188
|
@include set-kpi-container();
|
|
175
189
|
|
|
176
190
|
padding: px-to-rem(3) px-to-rem(7);
|
|
177
191
|
}
|
|
178
192
|
|
|
179
|
-
&
|
|
193
|
+
&__aside {
|
|
180
194
|
background-color: transparent;
|
|
181
195
|
}
|
|
182
196
|
}
|
|
@@ -194,14 +208,16 @@ $color-kpi-text: var(
|
|
|
194
208
|
@include set-kpi-container();
|
|
195
209
|
}
|
|
196
210
|
|
|
211
|
+
&__main {
|
|
212
|
+
flex-grow: 1;
|
|
213
|
+
padding: $mu050 $mu050 $mu050 px-to-rem(7);
|
|
214
|
+
}
|
|
215
|
+
|
|
197
216
|
&__value {
|
|
198
217
|
@include set-font-scale('05', 'm');
|
|
199
|
-
|
|
200
|
-
padding: $mu050 $mu050 $mu050 px-to-rem(7);
|
|
201
|
-
flex-grow: 1;
|
|
202
218
|
}
|
|
203
219
|
|
|
204
|
-
&
|
|
220
|
+
&__aside {
|
|
205
221
|
padding-left: $mu075;
|
|
206
222
|
padding-right: px-to-rem(11);
|
|
207
223
|
}
|
|
@@ -213,31 +229,25 @@ $color-kpi-text: var(
|
|
|
213
229
|
@include set-kpi-container();
|
|
214
230
|
|
|
215
231
|
#{$parent} {
|
|
216
|
-
&
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
padding-left: px-to-rem(15);
|
|
232
|
+
&__content {
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
width: 100%;
|
|
220
235
|
}
|
|
221
236
|
|
|
222
|
-
&
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
padding-top: $mu100;
|
|
226
|
-
text-align: center;
|
|
237
|
+
&__main {
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
padding: $mu100 px-to-rem(15);
|
|
227
240
|
}
|
|
228
241
|
|
|
229
|
-
&
|
|
230
|
-
|
|
231
|
-
width: 100%;
|
|
242
|
+
&__label {
|
|
243
|
+
@include set-font-scale('05', 'm');
|
|
232
244
|
}
|
|
233
245
|
|
|
234
246
|
&__value {
|
|
235
247
|
@include set-font-scale('09', 'm');
|
|
236
|
-
|
|
237
|
-
padding-bottom: $mu100;
|
|
238
248
|
}
|
|
239
249
|
|
|
240
|
-
&
|
|
250
|
+
&__aside {
|
|
241
251
|
min-height: px-to-rem(47);
|
|
242
252
|
padding-right: px-to-rem(11);
|
|
243
253
|
padding-left: px-to-rem(11);
|
package/src/index.js
CHANGED
|
@@ -34,8 +34,10 @@ export { MField } from './components/field';
|
|
|
34
34
|
export { MDropdown } from './components/dropdown';
|
|
35
35
|
export { MFileUploader } from './components/fileuploader';
|
|
36
36
|
export { MFlag } from './components/flag';
|
|
37
|
+
export { MHeader } from './components/header';
|
|
37
38
|
export { MHero } from './components/hero';
|
|
38
39
|
export { MIcon } from './components/icon';
|
|
40
|
+
export { MKpi } from './components/kpi';
|
|
39
41
|
export { MLayer } from './components/layer';
|
|
40
42
|
export { MLink } from './components/link';
|
|
41
43
|
export { MListBox, MListBoxActions } from './components/listbox';
|
|
@@ -61,4 +63,3 @@ export { MTextArea } from './components/textarea';
|
|
|
61
63
|
export { MTextInput } from './components/textinput';
|
|
62
64
|
export { MToggle } from './components/toggle';
|
|
63
65
|
export { MTooltip } from './components/tooltip';
|
|
64
|
-
export { MKpi } from './components/kpi';
|
package/types/index.d.ts
CHANGED
|
@@ -19,9 +19,11 @@ declare module '@mozaic-ds/vue' {
|
|
|
19
19
|
const MDropdown: VueConstructor;
|
|
20
20
|
const MField: VueConstructor;
|
|
21
21
|
const MFileUploader: VueConstructor;
|
|
22
|
+
const MHeader: VueConstructor;
|
|
22
23
|
const MFlag: VueConstructor;
|
|
23
24
|
const MHero: VueConstructor;
|
|
24
25
|
const MIcon: VueConstructor;
|
|
26
|
+
const MKpi: VueConstructor;
|
|
25
27
|
const MLayer: VueConstructor;
|
|
26
28
|
const MLink: VueConstructor;
|
|
27
29
|
const MListBox: VueConstructor;
|
|
@@ -68,9 +70,11 @@ declare module '@mozaic-ds/vue' {
|
|
|
68
70
|
MDropdown,
|
|
69
71
|
MField,
|
|
70
72
|
MFileUploader,
|
|
73
|
+
MHeader,
|
|
71
74
|
MFlag,
|
|
72
75
|
MHero,
|
|
73
76
|
MIcon,
|
|
77
|
+
MKpi,
|
|
74
78
|
MLayer,
|
|
75
79
|
MLink,
|
|
76
80
|
MListBox,
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { unrefElement } from '@vueuse/core';
|
|
2
|
-
import { computed, onBeforeUnmount, reactive, watch } from 'vue';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get information about scrolling animation.
|
|
6
|
-
* @param header @type {Ref<HTMLElement | undefined>} The header element ref.
|
|
7
|
-
* @param isAnimate @type {Ref<boolean>} The computed property indicate if animation is active.
|
|
8
|
-
* @returns Information about scrolling.
|
|
9
|
-
*/
|
|
10
|
-
export function useScrollDirection(header, isAnimate) {
|
|
11
|
-
let originalScrollPos = 0;
|
|
12
|
-
|
|
13
|
-
const state = reactive({
|
|
14
|
-
direction: undefined
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const direction = computed(() => state.direction);
|
|
18
|
-
|
|
19
|
-
function onScroll(e) {
|
|
20
|
-
const element = unrefElement(header);
|
|
21
|
-
|
|
22
|
-
if (element) {
|
|
23
|
-
const container = element.parentElement;
|
|
24
|
-
|
|
25
|
-
if (container && e.target === container) {
|
|
26
|
-
const currentScrollPos = container.scrollTop;
|
|
27
|
-
|
|
28
|
-
if (currentScrollPos <= element.offsetHeight) {
|
|
29
|
-
state.direction = undefined;
|
|
30
|
-
} else if (currentScrollPos < originalScrollPos) {
|
|
31
|
-
state.direction = 'up';
|
|
32
|
-
} else {
|
|
33
|
-
state.direction = 'down';
|
|
34
|
-
}
|
|
35
|
-
originalScrollPos = currentScrollPos;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
watch(
|
|
41
|
-
() => isAnimate.value,
|
|
42
|
-
() => {
|
|
43
|
-
if (isAnimate.value) {
|
|
44
|
-
window.addEventListener('scroll', onScroll, { capture: true });
|
|
45
|
-
} else {
|
|
46
|
-
window.removeEventListener('scroll', onScroll, { capture: true });
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{ immediate: true }
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
onBeforeUnmount(() => {
|
|
53
|
-
if (isAnimate.value) {
|
|
54
|
-
window.removeEventListener('scroll', onScroll, { capture: true });
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
direction
|
|
60
|
-
};
|
|
61
|
-
}
|