@eturnity/eturnity_reusable_components 8.34.0-EPDM-16204.1 → 8.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/main.es16.js +1 -1
- package/dist/main.es199.js +6 -4
- package/dist/main.es348.js +4 -4
- package/dist/main.es386.js +1 -1
- package/dist/main.es559.js +1 -1
- package/dist/main.es708.js +1 -1
- package/dist/main.es742.js +60 -21
- package/dist/main.es743.js +21 -60
- package/dist/main.es8.js +103 -66
- package/package.json +1 -1
- package/src/assets/svgIcons/electricity_tariff.svg +2 -2
- package/src/assets/svgIcons/suitcase.svg +2 -2
- package/src/assets/theme.js +90 -63
- package/src/components/buttons/mainButton/MainButton.stories.js +6 -0
- package/src/components/buttons/mainButton/index.vue +9 -1
- package/src/components/dropdown/Dropdown.stories.js +111 -39
- package/src/components/dropdown/defaultProps.js +7 -0
- package/src/components/dropdown/dropdown.spec.js +55 -0
- package/src/components/dropdown/index.vue +30 -21
- package/src/components/inputs/select/option/index.vue +21 -3
- package/src/components/progressBar/ProgressBar.stories.js +62 -0
- package/src/components/progressBar/defaultProps.js +5 -0
- package/src/components/progressBar/index.vue +28 -56
- package/src/components/progressBar/progressBar.spec.js +52 -0
- package/src/components/sideMenu/index.vue +23 -27
- package/src/components/tables/mainTable/index.vue +2 -1
package/src/assets/theme.js
CHANGED
|
@@ -26,8 +26,6 @@ const theme = (() => {
|
|
|
26
26
|
red2: '#de5959',
|
|
27
27
|
red3: '#FFCCCC',
|
|
28
28
|
red4: '#FF9A9A',
|
|
29
|
-
red6: '#FFEBEB',
|
|
30
|
-
red5: '#CC4545',
|
|
31
29
|
pureRed: '#ff0000',
|
|
32
30
|
darkRed: '#d00000',
|
|
33
31
|
cornellRed: '#a52019',
|
|
@@ -68,8 +66,6 @@ const theme = (() => {
|
|
|
68
66
|
purple4: '#D0D6F5',
|
|
69
67
|
purple5: '#533181',
|
|
70
68
|
purple6: '#6F20DC',
|
|
71
|
-
purple7: '#F5EEFF',
|
|
72
|
-
purple8: '#B17BFA',
|
|
73
69
|
orange: '#ffc338',
|
|
74
70
|
disabled: '#dfe1e1',
|
|
75
71
|
transparentWhite2: '#ffffff32',
|
|
@@ -184,9 +180,25 @@ const theme = (() => {
|
|
|
184
180
|
},
|
|
185
181
|
}
|
|
186
182
|
|
|
183
|
+
const chartGradients = {
|
|
184
|
+
simple: {
|
|
185
|
+
from: semanticColors.purple[500],
|
|
186
|
+
to: semanticColors.purple[400],
|
|
187
|
+
},
|
|
188
|
+
stacked: [
|
|
189
|
+
{ from: '#F5EDFF', to: '#DEC5FF' },
|
|
190
|
+
{ from: '#CAA2FF', to: '#F2E8FF' },
|
|
191
|
+
{ from: '#B987FC', to: '#904AEF' },
|
|
192
|
+
{ from: '#8B40F2', to: '#4A1394' },
|
|
193
|
+
{ from: '#6A05F2', to: '#4905A5' },
|
|
194
|
+
{ from: '#5402C3', to: '#2B0362' },
|
|
195
|
+
],
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
return {
|
|
188
199
|
colors,
|
|
189
200
|
semanticColors,
|
|
201
|
+
chartGradients,
|
|
190
202
|
fonts: {
|
|
191
203
|
mainFont: '"Figtree", sans-serif',
|
|
192
204
|
},
|
|
@@ -205,6 +217,18 @@ const theme = (() => {
|
|
|
205
217
|
boxShadow: {
|
|
206
218
|
card: '0px 2px 8px 2px rgba(0, 0, 0, 0.15)',
|
|
207
219
|
},
|
|
220
|
+
progressBar: {
|
|
221
|
+
light: {
|
|
222
|
+
fillColor: semanticColors.purple[500],
|
|
223
|
+
backgroundColor: semanticColors.grey[200],
|
|
224
|
+
labelColor: semanticColors.grey[700],
|
|
225
|
+
},
|
|
226
|
+
dark: {
|
|
227
|
+
fillColor: colors.white,
|
|
228
|
+
backgroundColor: semanticColors.grey[700],
|
|
229
|
+
labelColor: semanticColors.grey[200],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
208
232
|
mainButton: {
|
|
209
233
|
light: {
|
|
210
234
|
// theme
|
|
@@ -403,26 +427,28 @@ const theme = (() => {
|
|
|
403
427
|
borderColor: '',
|
|
404
428
|
},
|
|
405
429
|
},
|
|
406
|
-
|
|
430
|
+
},
|
|
431
|
+
protag: {
|
|
432
|
+
main: {
|
|
407
433
|
default: {
|
|
408
|
-
backgroundColor:
|
|
434
|
+
backgroundColor: semanticColors.yellow[300],
|
|
409
435
|
textColor: semanticColors.teal[800],
|
|
410
|
-
borderColor:
|
|
436
|
+
borderColor: 'transparent',
|
|
411
437
|
},
|
|
412
438
|
hover: {
|
|
413
|
-
backgroundColor: semanticColors.
|
|
439
|
+
backgroundColor: semanticColors.yellow[300],
|
|
414
440
|
textColor: semanticColors.teal[800],
|
|
415
|
-
borderColor:
|
|
441
|
+
borderColor: '',
|
|
416
442
|
},
|
|
417
443
|
active: {
|
|
418
|
-
backgroundColor: semanticColors.
|
|
444
|
+
backgroundColor: semanticColors.yellow[300],
|
|
419
445
|
textColor: semanticColors.teal[800],
|
|
420
|
-
borderColor:
|
|
446
|
+
borderColor: '',
|
|
421
447
|
},
|
|
422
448
|
disabled: {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
borderColor:
|
|
449
|
+
backgroundColor: semanticColors.yellow[300],
|
|
450
|
+
textColor: semanticColors.teal[400],
|
|
451
|
+
borderColor: '',
|
|
426
452
|
},
|
|
427
453
|
},
|
|
428
454
|
},
|
|
@@ -450,152 +476,153 @@ const theme = (() => {
|
|
|
450
476
|
},
|
|
451
477
|
},
|
|
452
478
|
},
|
|
453
|
-
|
|
479
|
+
},
|
|
480
|
+
dark: {
|
|
481
|
+
// theme
|
|
482
|
+
primary: {
|
|
483
|
+
// type
|
|
454
484
|
main: {
|
|
485
|
+
// variant: this is the default variant
|
|
455
486
|
default: {
|
|
456
|
-
backgroundColor:
|
|
487
|
+
backgroundColor: colors.white,
|
|
457
488
|
textColor: semanticColors.teal[800],
|
|
458
489
|
borderColor: '',
|
|
459
490
|
},
|
|
460
491
|
hover: {
|
|
461
|
-
backgroundColor: semanticColors.
|
|
492
|
+
backgroundColor: semanticColors.purple[100],
|
|
462
493
|
textColor: semanticColors.teal[800],
|
|
463
494
|
borderColor: '',
|
|
464
495
|
},
|
|
465
496
|
active: {
|
|
466
|
-
backgroundColor: semanticColors.
|
|
497
|
+
backgroundColor: semanticColors.purple[100],
|
|
467
498
|
textColor: semanticColors.teal[800],
|
|
468
499
|
borderColor: '',
|
|
469
500
|
},
|
|
470
501
|
disabled: {
|
|
471
|
-
|
|
472
|
-
|
|
502
|
+
textColor: semanticColors.grey[800],
|
|
503
|
+
backgroundColor: semanticColors.grey[400],
|
|
473
504
|
borderColor: '',
|
|
474
505
|
},
|
|
475
506
|
},
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
main: {
|
|
507
|
+
cancel: {
|
|
508
|
+
// variant
|
|
479
509
|
default: {
|
|
480
|
-
backgroundColor: semanticColors.
|
|
510
|
+
backgroundColor: semanticColors.red[400],
|
|
481
511
|
textColor: semanticColors.teal[800],
|
|
482
512
|
borderColor: '',
|
|
483
513
|
},
|
|
484
514
|
hover: {
|
|
485
|
-
backgroundColor: semanticColors.
|
|
515
|
+
backgroundColor: semanticColors.red[100],
|
|
486
516
|
textColor: semanticColors.teal[800],
|
|
487
517
|
borderColor: '',
|
|
488
518
|
},
|
|
489
519
|
active: {
|
|
490
|
-
backgroundColor: semanticColors.
|
|
520
|
+
backgroundColor: semanticColors.red[200],
|
|
491
521
|
textColor: semanticColors.teal[800],
|
|
492
522
|
borderColor: '',
|
|
493
523
|
},
|
|
494
524
|
disabled: {
|
|
495
|
-
backgroundColor: semanticColors.
|
|
496
|
-
textColor: semanticColors.
|
|
525
|
+
backgroundColor: semanticColors.grey[300],
|
|
526
|
+
textColor: semanticColors.grey[800],
|
|
497
527
|
borderColor: '',
|
|
498
528
|
},
|
|
499
529
|
},
|
|
500
530
|
},
|
|
501
|
-
|
|
502
|
-
dark: {
|
|
503
|
-
// theme
|
|
504
|
-
primary: {
|
|
531
|
+
secondary: {
|
|
505
532
|
// type
|
|
506
533
|
main: {
|
|
507
534
|
// variant: this is the default variant
|
|
508
535
|
default: {
|
|
509
|
-
backgroundColor:
|
|
510
|
-
textColor: semanticColors.
|
|
536
|
+
backgroundColor: semanticColors.teal[800],
|
|
537
|
+
textColor: semanticColors.purple[50],
|
|
511
538
|
borderColor: '',
|
|
512
539
|
},
|
|
513
540
|
hover: {
|
|
514
|
-
backgroundColor: semanticColors.
|
|
515
|
-
textColor: semanticColors.
|
|
541
|
+
backgroundColor: semanticColors.teal[600],
|
|
542
|
+
textColor: semanticColors.purple[50],
|
|
516
543
|
borderColor: '',
|
|
517
544
|
},
|
|
518
545
|
active: {
|
|
519
|
-
backgroundColor: semanticColors.
|
|
520
|
-
textColor: semanticColors.
|
|
546
|
+
backgroundColor: semanticColors.teal[700],
|
|
547
|
+
textColor: semanticColors.purple[50],
|
|
521
548
|
borderColor: '',
|
|
522
549
|
},
|
|
523
550
|
disabled: {
|
|
524
|
-
textColor: semanticColors.grey[
|
|
525
|
-
backgroundColor: semanticColors.grey[
|
|
551
|
+
textColor: semanticColors.grey[600],
|
|
552
|
+
backgroundColor: semanticColors.grey[500],
|
|
526
553
|
borderColor: '',
|
|
527
554
|
},
|
|
528
555
|
},
|
|
529
556
|
cancel: {
|
|
530
557
|
// variant
|
|
531
558
|
default: {
|
|
532
|
-
backgroundColor: semanticColors.red[
|
|
533
|
-
textColor: semanticColors.
|
|
559
|
+
backgroundColor: semanticColors.red[800],
|
|
560
|
+
textColor: semanticColors.red[400],
|
|
534
561
|
borderColor: '',
|
|
535
562
|
},
|
|
536
563
|
hover: {
|
|
537
|
-
backgroundColor: semanticColors.red[
|
|
538
|
-
textColor: semanticColors.
|
|
564
|
+
backgroundColor: semanticColors.red[700],
|
|
565
|
+
textColor: semanticColors.red[300],
|
|
539
566
|
borderColor: '',
|
|
540
567
|
},
|
|
541
568
|
active: {
|
|
542
|
-
backgroundColor: semanticColors.red[
|
|
543
|
-
textColor: semanticColors.
|
|
569
|
+
backgroundColor: semanticColors.red[600],
|
|
570
|
+
textColor: semanticColors.red[200],
|
|
544
571
|
borderColor: '',
|
|
545
572
|
},
|
|
546
573
|
disabled: {
|
|
547
|
-
|
|
548
|
-
|
|
574
|
+
textColor: semanticColors.grey[600],
|
|
575
|
+
backgroundColor: semanticColors.grey[500],
|
|
549
576
|
borderColor: '',
|
|
550
577
|
},
|
|
551
578
|
},
|
|
552
579
|
},
|
|
553
|
-
|
|
580
|
+
tertiary: {
|
|
554
581
|
// type
|
|
555
582
|
main: {
|
|
556
583
|
// variant: this is the default variant
|
|
557
584
|
default: {
|
|
558
|
-
backgroundColor:
|
|
585
|
+
backgroundColor: 'transparent',
|
|
559
586
|
textColor: semanticColors.purple[50],
|
|
560
|
-
borderColor:
|
|
587
|
+
borderColor: semanticColors.teal[500],
|
|
561
588
|
},
|
|
562
589
|
hover: {
|
|
563
590
|
backgroundColor: semanticColors.teal[600],
|
|
564
591
|
textColor: semanticColors.purple[50],
|
|
565
|
-
borderColor:
|
|
592
|
+
borderColor: semanticColors.teal[400],
|
|
566
593
|
},
|
|
567
594
|
active: {
|
|
568
595
|
backgroundColor: semanticColors.teal[700],
|
|
569
596
|
textColor: semanticColors.purple[50],
|
|
570
|
-
borderColor:
|
|
597
|
+
borderColor: semanticColors.teal[300],
|
|
571
598
|
},
|
|
572
599
|
disabled: {
|
|
573
600
|
textColor: semanticColors.grey[600],
|
|
574
601
|
backgroundColor: semanticColors.grey[500],
|
|
575
|
-
borderColor:
|
|
602
|
+
borderColor: semanticColors.grey[800],
|
|
576
603
|
},
|
|
577
604
|
},
|
|
578
605
|
cancel: {
|
|
579
606
|
// variant
|
|
580
607
|
default: {
|
|
581
|
-
backgroundColor: semanticColors.
|
|
608
|
+
backgroundColor: semanticColors.teal[200],
|
|
582
609
|
textColor: semanticColors.red[400],
|
|
583
|
-
borderColor:
|
|
610
|
+
borderColor: semanticColors.teal[500],
|
|
584
611
|
},
|
|
585
612
|
hover: {
|
|
586
613
|
backgroundColor: semanticColors.red[700],
|
|
587
|
-
textColor: semanticColors.red[
|
|
588
|
-
borderColor:
|
|
614
|
+
textColor: semanticColors.red[700],
|
|
615
|
+
borderColor: semanticColors.teal[400],
|
|
589
616
|
},
|
|
590
617
|
active: {
|
|
591
618
|
backgroundColor: semanticColors.red[600],
|
|
592
619
|
textColor: semanticColors.red[200],
|
|
593
|
-
borderColor:
|
|
620
|
+
borderColor: semanticColors.teal[300],
|
|
594
621
|
},
|
|
595
622
|
disabled: {
|
|
596
623
|
textColor: semanticColors.grey[600],
|
|
597
624
|
backgroundColor: semanticColors.grey[500],
|
|
598
|
-
borderColor:
|
|
625
|
+
borderColor: semanticColors.grey[800],
|
|
599
626
|
},
|
|
600
627
|
},
|
|
601
628
|
},
|
|
@@ -739,9 +766,9 @@ const theme = (() => {
|
|
|
739
766
|
iconWidth: '26px',
|
|
740
767
|
},
|
|
741
768
|
tiny: {
|
|
742
|
-
padding: '
|
|
743
|
-
fontSize: '
|
|
744
|
-
iconWidth: '
|
|
769
|
+
padding: '2px 5px',
|
|
770
|
+
fontSize: '10px',
|
|
771
|
+
iconWidth: '18px',
|
|
745
772
|
},
|
|
746
773
|
},
|
|
747
774
|
},
|
|
@@ -104,6 +104,12 @@ WithIcon.args = {
|
|
|
104
104
|
appTheme: 'light',
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
export const WithIconLast = Template.bind({})
|
|
108
|
+
WithIconLast.args = {
|
|
109
|
+
...WithIcon.args,
|
|
110
|
+
iconLast: true,
|
|
111
|
+
}
|
|
112
|
+
|
|
107
113
|
export const Disabled = Template.bind({})
|
|
108
114
|
Disabled.args = {
|
|
109
115
|
type: 'primary',
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
:variant="variant"
|
|
16
16
|
:width="width"
|
|
17
17
|
>
|
|
18
|
-
<LabelComponent :has-icon="Boolean(icon)">
|
|
18
|
+
<LabelComponent :has-icon="Boolean(icon)" :reverse-direction="iconLast">
|
|
19
19
|
<Icon
|
|
20
20
|
v-if="icon"
|
|
21
21
|
:color="getIconColor"
|
|
@@ -146,10 +146,13 @@
|
|
|
146
146
|
|
|
147
147
|
const LabelAttrs = {
|
|
148
148
|
hasIcon: Boolean,
|
|
149
|
+
reverseDirection: Boolean,
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
const LabelComponent = styled('span', LabelAttrs)`
|
|
152
153
|
display: flex;
|
|
154
|
+
flex-direction: ${(props) =>
|
|
155
|
+
props.reverseDirection ? 'row-reverse' : 'row'};
|
|
153
156
|
align-items: center;
|
|
154
157
|
justify-content: center;
|
|
155
158
|
gap: ${(props) => (props.hasIcon ? '5px' : '0')};
|
|
@@ -212,6 +215,11 @@
|
|
|
212
215
|
default: '',
|
|
213
216
|
type: String,
|
|
214
217
|
},
|
|
218
|
+
iconLast: {
|
|
219
|
+
required: false,
|
|
220
|
+
default: false,
|
|
221
|
+
type: Boolean,
|
|
222
|
+
},
|
|
215
223
|
iconAltStyle: {
|
|
216
224
|
required: false,
|
|
217
225
|
default: false,
|
|
@@ -1,53 +1,125 @@
|
|
|
1
|
+
import defaultDropdownProps from './defaultProps'
|
|
1
2
|
import Dropdown from './index.vue'
|
|
3
|
+
import theme from '@/assets/theme'
|
|
2
4
|
|
|
3
5
|
export default {
|
|
4
6
|
title: 'Dropdown',
|
|
5
7
|
component: Dropdown,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
width: {
|
|
11
|
+
description: '',
|
|
12
|
+
},
|
|
13
|
+
gap: {
|
|
14
|
+
description: 'Gap between trigger and dropdown content',
|
|
15
|
+
},
|
|
16
|
+
justify: {
|
|
17
|
+
description:
|
|
18
|
+
'Rule to allign the dropdown content relatively to the trigger',
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['right', 'left'],
|
|
21
|
+
},
|
|
22
|
+
openingMode: {
|
|
23
|
+
description:
|
|
24
|
+
'Way to open the dropdown content: eigther by clicking on trigger or hovering it',
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['hover', 'click'],
|
|
27
|
+
},
|
|
28
|
+
backgroundColor: {
|
|
29
|
+
description: 'Backbround color of dropdown content',
|
|
30
|
+
control: {
|
|
31
|
+
type: 'color',
|
|
32
|
+
presetColors: [
|
|
33
|
+
theme.colors.white,
|
|
34
|
+
theme.colors.grey3,
|
|
35
|
+
theme.colors.grey4,
|
|
36
|
+
theme.colors.red,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// slots
|
|
42
|
+
trigger: {
|
|
43
|
+
description: 'Trigger button slot',
|
|
44
|
+
},
|
|
45
|
+
dropdown: {
|
|
46
|
+
description: 'Dropdown content slot',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// To use:
|
|
52
|
+
// import Dropdown from '@eturnity/eturnity_reusable_components/src/components/dropdown'
|
|
53
|
+
// <Dropdown
|
|
54
|
+
// width="fit-content"
|
|
55
|
+
// gap="20px"
|
|
56
|
+
// justify="right"
|
|
57
|
+
// opening-mode="click"
|
|
58
|
+
// background-color="red"
|
|
59
|
+
// >
|
|
60
|
+
// <template #trigger>
|
|
61
|
+
// TRIGGER BUTTON
|
|
62
|
+
// </template>
|
|
63
|
+
// <template #dropdown>
|
|
64
|
+
// <div>
|
|
65
|
+
// <div>OPTION 1</div>
|
|
66
|
+
// <div>OPTION 2</div>
|
|
67
|
+
// </div>
|
|
68
|
+
// </template>
|
|
69
|
+
// <Dropdown/>
|
|
70
|
+
|
|
71
|
+
const Template = (args) => {
|
|
72
|
+
return {
|
|
73
|
+
components: { Dropdown },
|
|
74
|
+
setup() {
|
|
75
|
+
return { args }
|
|
76
|
+
},
|
|
77
|
+
template: `
|
|
78
|
+
<div style="margin-left: 30px;">
|
|
79
|
+
<Dropdown v-bind="args">
|
|
80
|
+
<template #trigger>
|
|
81
|
+
{{ args.trigger }}
|
|
82
|
+
</template>
|
|
83
|
+
<template #dropdown>
|
|
84
|
+
<div v-html="args.dropdown"></div>
|
|
85
|
+
</template>
|
|
86
|
+
</Dropdown>
|
|
26
87
|
</div>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// How to use:
|
|
31
|
-
//<icon
|
|
32
|
-
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
|
33
|
-
// color="red"
|
|
34
|
-
// hoveredColor="blue"
|
|
35
|
-
// size="60px" by default, this is 30px
|
|
36
|
-
// />
|
|
37
|
-
})
|
|
88
|
+
`,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
38
91
|
|
|
39
92
|
export const Default = Template.bind({})
|
|
40
93
|
Default.args = {
|
|
41
|
-
|
|
94
|
+
...defaultDropdownProps,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const DropdownWidth = Template.bind({})
|
|
98
|
+
DropdownWidth.args = {
|
|
99
|
+
...defaultDropdownProps,
|
|
100
|
+
width: 'max-content',
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const DropdownGap = Template.bind({})
|
|
104
|
+
DropdownGap.args = {
|
|
105
|
+
...defaultDropdownProps,
|
|
42
106
|
gap: '0px',
|
|
43
|
-
justify: 'left',
|
|
44
|
-
width: '150px',
|
|
45
107
|
}
|
|
46
108
|
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
gap: '20px',
|
|
109
|
+
export const DropdownJustifyRight = Template.bind({})
|
|
110
|
+
DropdownJustifyRight.args = {
|
|
111
|
+
...defaultDropdownProps,
|
|
51
112
|
justify: 'right',
|
|
52
|
-
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const DropdownOpeningModeClick = Template.bind({})
|
|
116
|
+
DropdownOpeningModeClick.args = {
|
|
117
|
+
...defaultDropdownProps,
|
|
118
|
+
openingMode: 'click',
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const DropdownBackgroundColor = Template.bind({})
|
|
122
|
+
DropdownBackgroundColor.args = {
|
|
123
|
+
...defaultDropdownProps,
|
|
124
|
+
backgroundColor: theme.colors.red,
|
|
53
125
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import RCDropdown from '@/components/dropdown'
|
|
3
|
+
import defaultProps from './defaultProps'
|
|
4
|
+
import theme from '@/assets/theme'
|
|
5
|
+
|
|
6
|
+
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
|
7
|
+
// need to mock this due to how jest handles import.meta
|
|
8
|
+
fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
|
|
9
|
+
}))
|
|
10
|
+
|
|
11
|
+
describe('dropdown/index.vue', () => {
|
|
12
|
+
it('dropdown is rendered with correct trigger text', async () => {
|
|
13
|
+
const wrapper = mount(RCDropdown, {
|
|
14
|
+
props: { ...defaultProps },
|
|
15
|
+
slots: { ...defaultProps },
|
|
16
|
+
global: {
|
|
17
|
+
provide: {
|
|
18
|
+
theme,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const dropdownTrigger = wrapper.find('[data-test-id="dropdown_trigger"]')
|
|
24
|
+
|
|
25
|
+
expect(dropdownTrigger.exists()).toBe(true)
|
|
26
|
+
expect(dropdownTrigger.text()).toContain(defaultProps.trigger)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('dropdown opens on click only', async () => {
|
|
30
|
+
const wrapper = mount(RCDropdown, {
|
|
31
|
+
props: { ...defaultProps, openingMode: 'click' },
|
|
32
|
+
slots: { ...defaultProps },
|
|
33
|
+
global: {
|
|
34
|
+
provide: {
|
|
35
|
+
theme,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const dropdownTrigger = wrapper.find('[data-test-id="dropdown_trigger"]')
|
|
41
|
+
const dropdownDropdownWrapper = wrapper.find(
|
|
42
|
+
'[data-test-id="dropdown_dropdown_wrapper"]'
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(false)
|
|
46
|
+
|
|
47
|
+
await dropdownTrigger.trigger('hover')
|
|
48
|
+
|
|
49
|
+
expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(false)
|
|
50
|
+
|
|
51
|
+
await dropdownTrigger.trigger('click')
|
|
52
|
+
|
|
53
|
+
expect(dropdownDropdownWrapper.classes('openDropdown')).toBe(true)
|
|
54
|
+
})
|
|
55
|
+
})
|