@eturnity/eturnity_reusable_components 8.31.5-EPDM-13618.2 → 8.31.5-EPDM-15023.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/main.es8.js +0 -12
- package/package.json +1 -1
- package/src/assets/theme.js +0 -12
- package/src/components/buttons/mainButton/MainButton.stories.js +0 -6
- package/src/components/buttons/mainButton/index.vue +1 -9
- package/src/components/dropdown/Dropdown.stories.js +39 -111
- package/src/components/dropdown/index.vue +21 -30
- package/src/components/progressBar/index.vue +56 -28
- package/src/components/tables/mainTable/index.vue +1 -2
- package/src/components/dropdown/defaultProps.js +0 -7
- package/src/components/dropdown/dropdown.spec.js +0 -55
- package/src/components/progressBar/ProgressBar.stories.js +0 -62
- package/src/components/progressBar/defaultProps.js +0 -5
- package/src/components/progressBar/progressBar.spec.js +0 -52
package/dist/main.es8.js
CHANGED
@@ -226,18 +226,6 @@ const theme = (() => {
|
|
226
226
|
boxShadow: {
|
227
227
|
card: "0px 2px 8px 2px rgba(0, 0, 0, 0.15)"
|
228
228
|
},
|
229
|
-
progressBar: {
|
230
|
-
light: {
|
231
|
-
fillColor: semanticColors.purple[500],
|
232
|
-
backgroundColor: semanticColors.grey[200],
|
233
|
-
labelColor: semanticColors.grey[700]
|
234
|
-
},
|
235
|
-
dark: {
|
236
|
-
fillColor: colors.white,
|
237
|
-
backgroundColor: semanticColors.grey[700],
|
238
|
-
labelColor: semanticColors.grey[200]
|
239
|
-
}
|
240
|
-
},
|
241
229
|
mainButton: {
|
242
230
|
light: {
|
243
231
|
// theme
|
package/package.json
CHANGED
package/src/assets/theme.js
CHANGED
@@ -217,18 +217,6 @@ const theme = (() => {
|
|
217
217
|
boxShadow: {
|
218
218
|
card: '0px 2px 8px 2px rgba(0, 0, 0, 0.15)',
|
219
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
|
-
},
|
232
220
|
mainButton: {
|
233
221
|
light: {
|
234
222
|
// theme
|
@@ -104,12 +104,6 @@ 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
|
-
|
113
107
|
export const Disabled = Template.bind({})
|
114
108
|
Disabled.args = {
|
115
109
|
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)">
|
19
19
|
<Icon
|
20
20
|
v-if="icon"
|
21
21
|
:color="getIconColor"
|
@@ -146,13 +146,10 @@
|
|
146
146
|
|
147
147
|
const LabelAttrs = {
|
148
148
|
hasIcon: Boolean,
|
149
|
-
reverseDirection: Boolean,
|
150
149
|
}
|
151
150
|
|
152
151
|
const LabelComponent = styled('span', LabelAttrs)`
|
153
152
|
display: flex;
|
154
|
-
flex-direction: ${(props) =>
|
155
|
-
props.reverseDirection ? 'row-reverse' : 'row'};
|
156
153
|
align-items: center;
|
157
154
|
justify-content: center;
|
158
155
|
gap: ${(props) => (props.hasIcon ? '5px' : '0')};
|
@@ -215,11 +212,6 @@
|
|
215
212
|
default: '',
|
216
213
|
type: String,
|
217
214
|
},
|
218
|
-
iconLast: {
|
219
|
-
required: false,
|
220
|
-
default: false,
|
221
|
-
type: Boolean,
|
222
|
-
},
|
223
215
|
iconAltStyle: {
|
224
216
|
required: false,
|
225
217
|
default: false,
|
@@ -1,125 +1,53 @@
|
|
1
|
-
import defaultDropdownProps from './defaultProps'
|
2
1
|
import Dropdown from './index.vue'
|
3
|
-
import theme from '@/assets/theme'
|
4
2
|
|
5
3
|
export default {
|
6
4
|
title: 'Dropdown',
|
7
5
|
component: Dropdown,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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>
|
6
|
+
// argTypes: {},
|
7
|
+
}
|
8
|
+
|
9
|
+
const Template = (args, { argTypes }) => ({
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
11
|
+
components: { Dropdown },
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
13
|
+
props: Object.keys(argTypes),
|
14
|
+
template: `<Dropdown v-bind="$props">
|
15
|
+
<template #trigger>
|
16
|
+
trigger button
|
17
|
+
</template>
|
18
|
+
<template #dropdown>
|
19
|
+
<div>
|
20
|
+
<h3>fully customizable dropdown</h3>
|
21
|
+
<ul>
|
22
|
+
<li>item</li>
|
23
|
+
<li>item</li>
|
24
|
+
<li>item</li>
|
25
|
+
</ul>
|
87
26
|
</div>
|
88
|
-
|
89
|
-
|
90
|
-
|
27
|
+
</template>
|
28
|
+
</Dropdown>`,
|
29
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
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
|
+
})
|
91
38
|
|
92
39
|
export const Default = Template.bind({})
|
93
40
|
Default.args = {
|
94
|
-
|
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,
|
41
|
+
openingMode: 'click',
|
106
42
|
gap: '0px',
|
43
|
+
justify: 'left',
|
44
|
+
width: '150px',
|
107
45
|
}
|
108
46
|
|
109
|
-
export const
|
110
|
-
|
111
|
-
|
47
|
+
export const withHover = Template.bind({})
|
48
|
+
withHover.args = {
|
49
|
+
openingMode: 'hover',
|
50
|
+
gap: '20px',
|
112
51
|
justify: 'right',
|
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,
|
52
|
+
width: '250px',
|
125
53
|
}
|
@@ -1,26 +1,18 @@
|
|
1
1
|
<template>
|
2
|
-
<Wrapper
|
3
|
-
|
4
|
-
ref="dropdown"
|
5
|
-
:opening-mode="openingMode"
|
6
|
-
>
|
7
|
-
<WrapperButton
|
8
|
-
data-test-id="dropdown_trigger"
|
9
|
-
@click="toggleIsOpenByClick(!isOpenByClick)"
|
10
|
-
>
|
2
|
+
<Wrapper ref="dropdown" :opening-mode="openingMode">
|
3
|
+
<WrapperButton @click="isOpenByClick = !isOpenByClick">
|
11
4
|
<slot name="trigger"></slot>
|
12
5
|
</WrapperButton>
|
13
6
|
<WrapperDropdown
|
14
7
|
:background-color="backgroundColor"
|
15
8
|
class="dropdown-content"
|
16
|
-
:class="{ openDropdown: isOpenByClick && openingMode
|
17
|
-
data-test-id="dropdown_dropdown_wrapper"
|
9
|
+
:class="{ openDropdown: isOpenByClick && openingMode == 'click' }"
|
18
10
|
:justify="justify"
|
11
|
+
:position="position"
|
19
12
|
:width="width"
|
20
13
|
>
|
21
14
|
<DropdownWindow
|
22
15
|
:background-color="backgroundColor"
|
23
|
-
data-test-id="dropdown_dropdown_content"
|
24
16
|
:gap="gap"
|
25
17
|
:width="width"
|
26
18
|
>
|
@@ -31,6 +23,14 @@
|
|
31
23
|
</template>
|
32
24
|
|
33
25
|
<script>
|
26
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
27
|
+
// How to use:
|
28
|
+
//<DropdownComponent
|
29
|
+
// width="300px"
|
30
|
+
// backgroundColor="red">
|
31
|
+
|
32
|
+
// <DropdownComponent/>
|
33
|
+
|
34
34
|
import styled from 'vue3-styled-components'
|
35
35
|
|
36
36
|
const wrapperAttrs = {
|
@@ -45,11 +45,11 @@
|
|
45
45
|
position: relative;
|
46
46
|
|
47
47
|
&:hover .dropdown-content {
|
48
|
-
${(props) => (props.openingMode
|
48
|
+
${(props) => (props.openingMode == 'hover' ? 'display:block' : '')}
|
49
49
|
}
|
50
50
|
& .openDropdown {
|
51
51
|
${(props) =>
|
52
|
-
props.openingMode
|
52
|
+
props.openingMode == 'click' ? 'display:block !important' : ''}
|
53
53
|
}
|
54
54
|
`
|
55
55
|
const WrapperDropdown = styled('div', wrapperAttrs)`
|
@@ -57,7 +57,7 @@
|
|
57
57
|
display: none;
|
58
58
|
position: absolute;
|
59
59
|
z-index: 1;
|
60
|
-
${(props) => (props.justify
|
60
|
+
${(props) => (props.justify == 'right' ? 'right:0;' : '')}
|
61
61
|
`
|
62
62
|
const DropdownWindow = styled('div', wrapperAttrs)`
|
63
63
|
width: ${(props) => props.width};
|
@@ -86,27 +86,26 @@
|
|
86
86
|
props: {
|
87
87
|
width: {
|
88
88
|
required: false,
|
89
|
-
type: String,
|
90
89
|
default: '300px',
|
91
90
|
},
|
92
91
|
gap: {
|
93
92
|
required: false,
|
94
|
-
type: String,
|
95
93
|
default: '10px',
|
96
94
|
},
|
95
|
+
position: {
|
96
|
+
required: false,
|
97
|
+
default: 'bottom',
|
98
|
+
},
|
97
99
|
justify: {
|
98
100
|
required: false,
|
99
|
-
type: String,
|
100
101
|
default: 'left',
|
101
102
|
},
|
102
103
|
openingMode: {
|
103
104
|
required: false,
|
104
|
-
type: String,
|
105
105
|
default: 'hover',
|
106
106
|
},
|
107
107
|
backgroundColor: {
|
108
108
|
required: false,
|
109
|
-
type: String,
|
110
109
|
default: 'white',
|
111
110
|
},
|
112
111
|
},
|
@@ -122,26 +121,18 @@
|
|
122
121
|
document.removeEventListener('click', this.clickOutside)
|
123
122
|
},
|
124
123
|
methods: {
|
125
|
-
toggleIsOpenByClick(value) {
|
126
|
-
this.isOpenByClick = value
|
127
|
-
},
|
128
124
|
clickOutside(event) {
|
129
125
|
if (this.openingMode != 'click') return
|
130
126
|
if (
|
131
127
|
this.$refs.dropdown &&
|
132
|
-
(this.$refs.dropdown.$el
|
128
|
+
(this.$refs.dropdown.$el == event.target ||
|
133
129
|
this.$refs.dropdown.$el.contains(event.target))
|
134
130
|
) {
|
135
131
|
return
|
136
132
|
} else {
|
137
|
-
this.
|
133
|
+
this.isOpenByClick = false
|
138
134
|
}
|
139
135
|
},
|
140
136
|
},
|
141
|
-
watch: {
|
142
|
-
isOpenByClick(newVal) {
|
143
|
-
this.$emit('on-dropdown-toggle', newVal)
|
144
|
-
},
|
145
|
-
},
|
146
137
|
}
|
147
138
|
</script>
|
@@ -1,26 +1,36 @@
|
|
1
1
|
<template>
|
2
2
|
<Container>
|
3
3
|
<ProgressContainer
|
4
|
-
:
|
5
|
-
|
4
|
+
:background-color="backgroundColor"
|
5
|
+
class="progress-container"
|
6
|
+
:max-width="maxWidth"
|
7
|
+
:min-width="minWidth"
|
6
8
|
>
|
7
9
|
<ProgressFill
|
8
|
-
|
9
|
-
|
10
|
+
class="progress-bar"
|
11
|
+
:fill-color="fillColor"
|
10
12
|
:fill-progress="fillProgress"
|
11
13
|
/>
|
12
14
|
</ProgressContainer>
|
13
|
-
<LabelText
|
14
|
-
|
15
|
-
:
|
16
|
-
data-test-id="progress_bar_label"
|
17
|
-
>
|
18
|
-
{{ labelText }}
|
15
|
+
<LabelText v-if="stepNumber || labelText" class="progress-text">
|
16
|
+
{{ labelText ? labelText : '' }}
|
17
|
+
{{ stepNumber ? stepNumber : '' }}
|
19
18
|
</LabelText>
|
20
19
|
</Container>
|
21
20
|
</template>
|
22
21
|
|
23
22
|
<script>
|
23
|
+
// import ProgressBar from "@eturnity/eturnity_reusable_components/src/components/progressBar"
|
24
|
+
//To Use:
|
25
|
+
// <progress-bar
|
26
|
+
// fillColor="#000"
|
27
|
+
// backgroundColor="#888"
|
28
|
+
// minWidth="150px"
|
29
|
+
// maxWidth="100%"
|
30
|
+
// :fillProgress="50" //should be a number for percent
|
31
|
+
// stepNumber="4"
|
32
|
+
// :labelText="translate('step')"
|
33
|
+
// />
|
24
34
|
import styled from 'vue3-styled-components'
|
25
35
|
|
26
36
|
const Container = styled.div`
|
@@ -34,34 +44,34 @@
|
|
34
44
|
`
|
35
45
|
|
36
46
|
const containerProps = {
|
37
|
-
|
47
|
+
backgroundColor: String,
|
48
|
+
maxWidth: String,
|
49
|
+
minWidth: String,
|
38
50
|
}
|
39
51
|
const ProgressContainer = styled('div', containerProps)`
|
40
52
|
width: 100%;
|
53
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'auto')};
|
54
|
+
max-width: ${(props) => (props.maxWidth ? props.maxWidth : 'none')};
|
41
55
|
height: 6px;
|
42
56
|
background-color: ${(props) =>
|
43
|
-
props.
|
57
|
+
props.backgroundColor
|
58
|
+
? props.backgroundColor
|
59
|
+
: props.theme.colors.lightGray};
|
44
60
|
@media (max-width: ${(props) => props.theme.screen.mobile}) {
|
45
61
|
height: 4px;
|
46
62
|
}
|
47
63
|
`
|
48
64
|
|
49
|
-
const fillProps = {
|
50
|
-
appTheme: String,
|
51
|
-
fillProgress: String | Number,
|
52
|
-
}
|
65
|
+
const fillProps = { fillColor: String, fillProgress: String | Number }
|
53
66
|
const ProgressFill = styled('div', fillProps)`
|
54
67
|
height: 100%;
|
55
68
|
width: ${(props) => props.fillProgress + '%'};
|
56
69
|
background-color: ${(props) =>
|
57
|
-
props.
|
70
|
+
props.fillColor ? props.fillColor : props.theme.colors.secondary};
|
58
71
|
`
|
59
72
|
|
60
|
-
const
|
61
|
-
|
62
|
-
}
|
63
|
-
const LabelText = styled('div', labelTextProps)`
|
64
|
-
color: ${(props) => props.theme.progressBar[props.appTheme].labelColor};
|
73
|
+
const LabelText = styled.div`
|
74
|
+
color: ${(props) => props.theme.colors.darkGray};
|
65
75
|
font-size: 16px;
|
66
76
|
|
67
77
|
@media (max-width: ${(props) => props.theme.screen.tablet}) {
|
@@ -78,19 +88,37 @@
|
|
78
88
|
LabelText,
|
79
89
|
},
|
80
90
|
props: {
|
91
|
+
fillColor: {
|
92
|
+
required: false,
|
93
|
+
type: String,
|
94
|
+
default: null,
|
95
|
+
},
|
96
|
+
backgroundColor: {
|
97
|
+
required: false,
|
98
|
+
type: String,
|
99
|
+
default: null,
|
100
|
+
},
|
101
|
+
minWidth: {
|
102
|
+
required: false,
|
103
|
+
type: String,
|
104
|
+
default: null,
|
105
|
+
},
|
106
|
+
maxWidth: {
|
107
|
+
required: false,
|
108
|
+
type: String,
|
109
|
+
default: null,
|
110
|
+
},
|
81
111
|
fillProgress: {
|
82
112
|
required: false,
|
83
|
-
type: [String, Number],
|
84
113
|
default: 0,
|
85
114
|
},
|
86
115
|
labelText: {
|
87
116
|
required: false,
|
88
|
-
|
89
|
-
default: '',
|
117
|
+
default: null,
|
90
118
|
},
|
91
|
-
|
92
|
-
|
93
|
-
default:
|
119
|
+
stepNumber: {
|
120
|
+
required: false,
|
121
|
+
default: null,
|
94
122
|
},
|
95
123
|
},
|
96
124
|
}
|
@@ -1,55 +0,0 @@
|
|
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
|
-
})
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import defaultDropdownProps from './defaultProps'
|
2
|
-
import ProgressBar from './index.vue'
|
3
|
-
import theme from '@/assets/theme'
|
4
|
-
|
5
|
-
export default {
|
6
|
-
title: 'ProgressBar',
|
7
|
-
component: ProgressBar,
|
8
|
-
tags: ['autodocs'],
|
9
|
-
argTypes: {
|
10
|
-
fillProgress: {
|
11
|
-
description: 'Precentage of progress bar filled in with color',
|
12
|
-
},
|
13
|
-
labelText: {
|
14
|
-
description: 'Label text above the progress bar',
|
15
|
-
},
|
16
|
-
appTheme: {
|
17
|
-
description: 'App color theme',
|
18
|
-
control: 'select',
|
19
|
-
options: ['light', 'dark'],
|
20
|
-
},
|
21
|
-
},
|
22
|
-
}
|
23
|
-
|
24
|
-
// To use:
|
25
|
-
// import ProgressBar from "@eturnity/eturnity_reusable_components/src/components/progressBar"
|
26
|
-
// <ProgressBar
|
27
|
-
// :fill-progress="50"
|
28
|
-
// :label-text="some label text"
|
29
|
-
// />
|
30
|
-
|
31
|
-
const Template = (args) => {
|
32
|
-
return {
|
33
|
-
components: { ProgressBar },
|
34
|
-
setup() {
|
35
|
-
return { args }
|
36
|
-
},
|
37
|
-
provide: {
|
38
|
-
theme,
|
39
|
-
},
|
40
|
-
template: `
|
41
|
-
<ProgressBar v-bind="args"/>
|
42
|
-
`,
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
export const Default = Template.bind({})
|
47
|
-
Default.args = {
|
48
|
-
...defaultDropdownProps,
|
49
|
-
}
|
50
|
-
|
51
|
-
export const ProgressBarLabelText = Template.bind({})
|
52
|
-
ProgressBarLabelText.args = {
|
53
|
-
...defaultDropdownProps,
|
54
|
-
labelText: 'Progress Bar Label Text',
|
55
|
-
}
|
56
|
-
|
57
|
-
export const ProgressBarLabelTextAppThemeDark = Template.bind({})
|
58
|
-
ProgressBarLabelTextAppThemeDark.args = {
|
59
|
-
...defaultDropdownProps,
|
60
|
-
labelText: 'Progress Bar Label Text',
|
61
|
-
appTheme: 'dark',
|
62
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
2
|
-
import RCProgressBar from '@/components/progressBar'
|
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('progressBar/index.vue', () => {
|
12
|
-
it('progress bar is rendered with correct props', async () => {
|
13
|
-
const labelText = 'test_label_text'
|
14
|
-
|
15
|
-
const wrapper = mount(RCProgressBar, {
|
16
|
-
props: { ...defaultProps, labelText },
|
17
|
-
global: {
|
18
|
-
provide: {
|
19
|
-
theme,
|
20
|
-
},
|
21
|
-
},
|
22
|
-
})
|
23
|
-
|
24
|
-
const progressBarProgress = wrapper.find(
|
25
|
-
'[data-test-id="progress_bar_progress"]'
|
26
|
-
)
|
27
|
-
const progressBarLabel = wrapper.find('[data-test-id="progress_bar_label"]')
|
28
|
-
|
29
|
-
expect(wrapper.vm.fillProgress).toBe(defaultProps.fillProgress)
|
30
|
-
expect(progressBarProgress.exists()).toBe(true)
|
31
|
-
expect(progressBarLabel.exists()).toBe(true)
|
32
|
-
|
33
|
-
expect(progressBarLabel.text()).toContain(labelText)
|
34
|
-
})
|
35
|
-
|
36
|
-
it('progress bar progress changes', async () => {
|
37
|
-
const wrapper = mount(RCProgressBar, {
|
38
|
-
props: {},
|
39
|
-
global: {
|
40
|
-
provide: {
|
41
|
-
theme,
|
42
|
-
},
|
43
|
-
},
|
44
|
-
})
|
45
|
-
|
46
|
-
expect(wrapper.vm.fillProgress).toBe(0)
|
47
|
-
|
48
|
-
await wrapper.setProps({ fillProgress: defaultProps.fillProgress })
|
49
|
-
|
50
|
-
expect(wrapper.vm.fillProgress).toBe(defaultProps.fillProgress)
|
51
|
-
})
|
52
|
-
})
|