@mozaic-ds/vue 0.35.1-beta.1 → 0.36.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.
@@ -0,0 +1,465 @@
1
+ <template>
2
+ <div class="mc-kpi">
3
+ <div v-if="size === 's'" class="mc-kpi-small">
4
+ <div
5
+ :class="'mc-kpi-small__value-' + [classForTheme]"
6
+ class="mc-kpi-small__value"
7
+ >
8
+ {{ value }}
9
+ </div>
10
+ <div v-if="showIcon && icon" class="mc-kpi-small__icon">
11
+ <m-icon :name="icon" />
12
+ </div>
13
+ </div>
14
+ <div v-else-if="size === 'm'" class="mc-kpi-medium">
15
+ <div class="mc-kpi-medium__data">
16
+ <div class="mc-kpi-medium__label">
17
+ {{ label }}
18
+ </div>
19
+ </div>
20
+ <div
21
+ class="mc-kpi-medium__container"
22
+ :class="'mc-kpi-medium__container-' + classForTheme"
23
+ >
24
+ <div
25
+ class="mc-kpi-medium__value"
26
+ :class="[
27
+ 'mc-kpi-medium__value-' + classForTheme,
28
+ classExpectedValueWithoutIcon,
29
+ ]"
30
+ >
31
+ {{ value }}
32
+ </div>
33
+ <div v-if="showIcon && icon" class="mc-kpi-medium__icon">
34
+ <div>
35
+ <m-icon :name="icon" />
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <div v-else class="mc-kpi-large" :class="'mc-kpi-large-' + classForTheme">
41
+ <div
42
+ class="mc-kpi-large__data"
43
+ :class="[classDetailsBarActive, 'mc-kpi-large__data-' + classForTheme]"
44
+ >
45
+ <div class="mc-kpi-large__container">
46
+ <div
47
+ class="mc-kpi-large__label"
48
+ :class="'mc-kpi-large__label-' + classForTheme"
49
+ >
50
+ {{ label }}
51
+ </div>
52
+ <div
53
+ class="mc-kpi-large__value"
54
+ :class="'mc-kpi-large__value-' + classForTheme"
55
+ >
56
+ {{ value }}
57
+ </div>
58
+ </div>
59
+ </div>
60
+ <div v-if="showDetailsBar" class="mc-kpi-large__details">
61
+ <div
62
+ v-if="showExpectedValue"
63
+ class="mc-kpi-large__expected"
64
+ :class="classExpectedValueWithoutIcon"
65
+ >
66
+ {{ expected }}
67
+ </div>
68
+ <div
69
+ v-if="showIcon && icon"
70
+ class="mc-kpi-large__icon"
71
+ :class="classIconWithoutExpectedValue"
72
+ >
73
+ <m-icon :name="icon" />
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </template>
79
+
80
+ <script>
81
+ import {
82
+ responsiveModifierValidators,
83
+ } from '../../utils/mozaicClasses';
84
+ import MIcon from '../icon/MIcon.vue';
85
+ export default {
86
+ name: 'MKpi',
87
+
88
+ components: {
89
+ MIcon,
90
+ },
91
+
92
+ props: {
93
+ label: {
94
+ type: String,
95
+ default: 'Label',
96
+ },
97
+ value: {
98
+ type: String,
99
+ default: '99.99%'
100
+ },
101
+ theme: {
102
+ type: String,
103
+ default: 'info',
104
+ },
105
+ expected: {
106
+ type: String,
107
+ default: '> 10% expected'
108
+ },
109
+ size: {
110
+ type: String,
111
+ default: 'l',
112
+ validator: (value) =>
113
+ responsiveModifierValidators(value, ['s', 'm', 'l',]),
114
+ },
115
+ icon: {
116
+ type: String,
117
+ default: 'ArrowArrowTopRight16',
118
+ },
119
+ showDetailsBar: {
120
+ type: Boolean,
121
+ default: true,
122
+ },
123
+ showExpectedValue: {
124
+ type: Boolean,
125
+ default: true,
126
+ },
127
+ showIcon: {
128
+ type: Boolean,
129
+ default: true,
130
+ },
131
+ },
132
+
133
+ computed: {
134
+ classDetailsBarActive() {
135
+ return !this.showDetailsBar ? 'mc-kpi__without-details-bar' : '';
136
+ },
137
+ classExpectedValueWithoutIcon() {
138
+ return !this.showIcon ? 'mc-kpi__without-icon' : '';
139
+ },
140
+ classIconWithoutExpectedValue() {
141
+ return !this.showExpectedValue ? 'mc-kpi__without-expected-value' : '';
142
+ },
143
+ classForTheme() {
144
+ return this.theme;
145
+ },
146
+ },
147
+
148
+ };
149
+ </script>
150
+
151
+ <style lang="scss">
152
+ @import 'settings-tools/all-settings';
153
+
154
+ .mc-kpi {
155
+
156
+ &__expected-without-icon {
157
+ width: 100% !important;
158
+ text-align: center;
159
+ border-radius: 4px 4px 4px 4px !important;
160
+ margin: 0;
161
+ }
162
+
163
+ &__icon-without-expected-value {
164
+ width: 100% !important;
165
+ text-align: center;
166
+ margin: 0;
167
+ }
168
+
169
+ &__without-details-bar {
170
+ height: 100% !important;
171
+ }
172
+
173
+ /* size S */
174
+ &-small {
175
+ display: flex;
176
+ max-width: 100px;
177
+ height: 24px;
178
+ justify-content: space-between;
179
+ align-items: center;
180
+
181
+ &__value {
182
+ height: 100%;
183
+ width: 75%;
184
+ display: flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+ font-weight: 700;
188
+ font-size: 14px;
189
+ line-height: 18px;
190
+ border-radius: 4px;
191
+ border: 1px solid $color-info-500;
192
+ background-color: $color-info-100;
193
+ color: $color-info-700;
194
+
195
+ &-info {
196
+ border: 1px solid $color-info-600;
197
+ background-color: $color-info-100;
198
+ color: $color-info-700;
199
+ }
200
+
201
+ &-success {
202
+ border: 1px solid $color-success-600;
203
+ background-color: $color-success-100;
204
+ color: $color-success-700;
205
+ }
206
+
207
+ &-danger {
208
+ border: 1px solid $color-danger-600;
209
+ background-color: $color-danger-100;
210
+ color: $color-danger-700;
211
+ }
212
+
213
+ &-neutral {
214
+ border: 1px solid $color-grey-600;
215
+ background-color: $color-grey-100;
216
+ color: $color-grey-700;
217
+ }
218
+
219
+ &-warning {
220
+ border: 1px solid $color-warning-600;
221
+ background-color: $color-warning-100;
222
+ color: $color-warning-700;
223
+ }
224
+
225
+ }
226
+
227
+ &__icon {
228
+ height: 100%;
229
+ width: 25%;
230
+ display: flex;
231
+ justify-content: end;
232
+ align-items: center;
233
+ }
234
+ }
235
+
236
+ /* size M */
237
+ &-medium {
238
+ max-width: 167px;
239
+ height: 64px;
240
+
241
+ &__container {
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: space-between;
245
+ height: 60%;
246
+ width: 100%;
247
+ border-radius: 4px;
248
+ border: 1px solid $color-info-500;
249
+
250
+ &-info {
251
+ border: 1px solid $color-info-600;
252
+ }
253
+
254
+ &-success {
255
+ border: 1px solid $color-success-600;
256
+ }
257
+
258
+ &-danger {
259
+ border: 1px solid $color-danger-600;
260
+ }
261
+
262
+ &-neutral {
263
+ border: 1px solid $color-grey-600;
264
+ }
265
+
266
+ &-warning {
267
+ border: 1px solid $color-warning-600;
268
+ }
269
+
270
+ }
271
+
272
+ &__label {
273
+ height: 40%;
274
+ font-size: 14px;
275
+ line-height: 18px;
276
+ overflow-wrap: break-word;
277
+ width: 100%;
278
+ display: inline-block;
279
+ white-space: nowrap;
280
+ overflow: hidden !important;
281
+ text-overflow: ellipsis;
282
+ }
283
+
284
+ &__value {
285
+ color: $color-info-700;
286
+ font-weight: 700;
287
+ font-size: 16px;
288
+ line-height: 22px;
289
+ height: 100%;
290
+ width: 75%;
291
+ text-align: center;
292
+ align-items: center;
293
+ display: flex;
294
+ justify-content: center;
295
+ border-radius: 4px 0px 0px 4px;
296
+ background-color: $color-info-100;
297
+
298
+ &-info {
299
+ background-color: $color-info-100;
300
+ color: $color-info-700;
301
+ }
302
+
303
+ &-success {
304
+ background-color: $color-success-100;
305
+ color: $color-success-700;
306
+ }
307
+
308
+ &-danger {
309
+ background-color: $color-danger-100;
310
+ color: $color-danger-700;
311
+ }
312
+
313
+ &-neutral {
314
+ background-color: $color-grey-100;
315
+ color: $color-grey-700;
316
+ }
317
+
318
+ &-warning {
319
+ background-color: $color-warning-100;
320
+ color: $color-warning-700;
321
+ }
322
+
323
+ }
324
+
325
+ &__icon {
326
+ width: 25%;
327
+ text-align: center;
328
+ }
329
+ }
330
+
331
+ /* size L or default */
332
+ &-large {
333
+ max-width: 167px;
334
+ height: 147px;
335
+ border-radius: 4px 4px 4px 4px;
336
+ border: 1px solid $color-info-500;
337
+
338
+ &__data {
339
+ display: flex;
340
+ align-items: center;
341
+ justify-content: center;
342
+ width: 100%;
343
+ height: 70%;
344
+ border-radius: 4px 4px 0px 0px;
345
+ background-color: $color-info-100;
346
+
347
+ &-info {
348
+ background-color: $color-info-100;
349
+ }
350
+
351
+ &-success {
352
+ background-color: $color-success-100;
353
+ }
354
+
355
+ &-danger {
356
+ background-color: $color-danger-100;
357
+ }
358
+
359
+ &-neutral {
360
+ background-color: $color-grey-100;
361
+ }
362
+
363
+ &-warning {
364
+ background-color: $color-warning-100;
365
+ }
366
+ }
367
+
368
+ &__container {
369
+ width: 100%;
370
+ text-align: center;
371
+ }
372
+
373
+ &__label {
374
+ font-weight: 400;
375
+ font-size: 16px;
376
+ line-height: 22px;
377
+ overflow-wrap: break-word;
378
+ width: 80%;
379
+ justify-content: center;
380
+ display: inline-block;
381
+ white-space: nowrap;
382
+ overflow: hidden !important;
383
+ text-overflow: ellipsis;
384
+ color: $color-info-700;
385
+ }
386
+
387
+ &__value {
388
+ overflow-wrap: break-word;
389
+ width: 80%;
390
+ font-weight: 700;
391
+ font-size: 34px;
392
+ line-height: 44px;
393
+ justify-content: center;
394
+ display: inline-block;
395
+ white-space: nowrap;
396
+ overflow: hidden !important;
397
+ text-overflow: ellipsis;
398
+ margin: 0;
399
+ color: $color-info-700;
400
+ }
401
+
402
+ &__label,
403
+ &__value {
404
+
405
+ &-info {
406
+ color: $color-info-700;
407
+ }
408
+
409
+ &-success {
410
+ color: $color-success-700;
411
+ }
412
+
413
+ &-danger {
414
+ color: $color-danger-700;
415
+ }
416
+
417
+ &-neutral {
418
+ color: $color-grey-700;
419
+ }
420
+
421
+ &-warning {
422
+ color: $color-warning-700;
423
+ }
424
+ }
425
+
426
+ &__details {
427
+ margin: 0 10px;
428
+ display: flex;
429
+ align-items: center;
430
+ justify-content: space-between;
431
+ height: 30%;
432
+ }
433
+
434
+ &__expected {
435
+ display: inline-block;
436
+ width: 80%;
437
+ white-space: nowrap;
438
+ overflow: hidden !important;
439
+ text-overflow: ellipsis;
440
+ }
441
+
442
+ &-info {
443
+ border: 1px solid $color-info-600;
444
+ }
445
+
446
+ &-success {
447
+ border: 1px solid $color-success-600;
448
+ }
449
+
450
+ &-danger {
451
+ border: 1px solid $color-danger-600;
452
+ }
453
+
454
+ &-neutral {
455
+ border: 1px solid $color-grey-600;
456
+ }
457
+
458
+ &-warning {
459
+ border: 1px solid $color-warning-600;
460
+ }
461
+
462
+ }
463
+
464
+ }
465
+ </style>
@@ -0,0 +1,7 @@
1
+ import MKpi from './MKpi.vue';
2
+
3
+ MKpi.install = function (Vue) {
4
+ Vue.component(MKpi.name, MKpi);
5
+ };
6
+
7
+ export { MKpi };
package/src/index.js CHANGED
@@ -61,3 +61,4 @@ export { MTextArea } from './components/textarea';
61
61
  export { MTextInput } from './components/textinput';
62
62
  export { MToggle } from './components/toggle';
63
63
  export { MTooltip } from './components/tooltip';
64
+ export { MKpi } from './components/kpi';