@eturnity/eturnity_reusable_components 7.48.1-EPDM-12680.11 → 7.48.1-dev-14.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/package.json +3 -2
- package/src/assets/theme.js +1 -0
- package/src/components/buttons/buttonIcon/index.vue +1 -3
- package/src/components/buttons/mainButton/index.vue +0 -10
- package/src/components/icon/index.vue +0 -1
- package/src/components/infoCard/InfoCard.stories.js +170 -0
- package/src/components/infoCard/defaultProps.js +7 -0
- package/src/components/infoCard/index.vue +107 -22
- package/src/components/infoCard/infoCard.spec.js +64 -0
- package/src/components/infoText/index.vue +125 -289
- package/src/components/inputs/inputNumber/index.vue +11 -185
- package/src/components/inputs/inputText/index.vue +2 -23
- package/src/components/inputs/radioButton/defaultProps.js +0 -2
- package/src/components/inputs/radioButton/index.vue +6 -27
- package/src/components/inputs/radioButton/radioButton.spec.js +62 -99
- package/src/components/inputs/select/index.vue +29 -69
- package/src/components/inputs/select/option/index.vue +2 -11
- package/src/components/markerItem/index.vue +1 -8
- package/src/components/modals/modal/index.vue +9 -3
- package/src/components/sideMenu/index.vue +12 -3
- package/src/components/spinner/index.vue +0 -11
- package/src/components/tables/mainTable/index.vue +12 -4
- package/src/assets/svgIcons/collapse_all.svg +0 -4
- package/src/assets/svgIcons/hybrid.svg +0 -4
- package/src/assets/svgIcons/module.svg +0 -3
- package/src/assets/svgIcons/move_down.svg +0 -3
- package/src/assets/svgIcons/move_up.svg +0 -3
- package/src/assets/svgIcons/optimizer.svg +0 -6
- package/src/assets/svgIcons/string_design.svg +0 -5
- package/src/components/infoText/placeholder.vue +0 -225
- package/src/components/stringDesign/DropdownMenu/index.vue +0 -715
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eturnity/eturnity_reusable_components",
|
3
|
-
"version": "7.48.1-
|
3
|
+
"version": "7.48.1-dev-14.0",
|
4
4
|
"files": [
|
5
5
|
"dist",
|
6
6
|
"src"
|
@@ -16,7 +16,8 @@
|
|
16
16
|
"build-storybook": "storybook build",
|
17
17
|
"prettier": "prettier --write 'src/**/*.{js,vue}'",
|
18
18
|
"test": "jest",
|
19
|
-
"test-coverage": "jest --coverage"
|
19
|
+
"test-coverage": "jest --coverage",
|
20
|
+
"prepublishOnly": "npm run test"
|
20
21
|
},
|
21
22
|
"dependencies": {
|
22
23
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
package/src/assets/theme.js
CHANGED
@@ -52,9 +52,7 @@
|
|
52
52
|
props.isDisabled
|
53
53
|
? props.theme.colors.disabled
|
54
54
|
: props.customColor
|
55
|
-
? props.
|
56
|
-
? props.theme.colors[props.customColor]
|
57
|
-
: props.customColor
|
55
|
+
? props.customColor
|
58
56
|
: props.theme.colors.yellow};
|
59
57
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
60
58
|
user-select: none;
|
@@ -5,7 +5,6 @@
|
|
5
5
|
:custom-color="customColor"
|
6
6
|
:data-id="dataId"
|
7
7
|
:font-color="fontColor"
|
8
|
-
:height="height"
|
9
8
|
:is-disabled="isDisabled"
|
10
9
|
:min-width="minWidth"
|
11
10
|
:no-wrap="noWrap"
|
@@ -44,11 +43,8 @@
|
|
44
43
|
customColor: String,
|
45
44
|
fontColor: String,
|
46
45
|
noWrap: Boolean,
|
47
|
-
height: String,
|
48
46
|
}
|
49
47
|
const ButtonContainer = styled('div', ButtonAttrs)`
|
50
|
-
display: flex;
|
51
|
-
justify-content: center;
|
52
48
|
padding: 7px 15px;
|
53
49
|
font-size: 13px;
|
54
50
|
color: ${(props) =>
|
@@ -71,7 +67,6 @@
|
|
71
67
|
user-select: none;
|
72
68
|
${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
|
73
69
|
${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
|
74
|
-
height: ${(props) => props.height};
|
75
70
|
|
76
71
|
&:hover {
|
77
72
|
opacity: ${(props) => (props.isDisabled ? '1' : '0.8')};
|
@@ -141,11 +136,6 @@
|
|
141
136
|
default: null,
|
142
137
|
type: String,
|
143
138
|
},
|
144
|
-
height: {
|
145
|
-
required: false,
|
146
|
-
default: 'auto',
|
147
|
-
type: String,
|
148
|
-
},
|
149
139
|
id: {
|
150
140
|
required: false,
|
151
141
|
default: null,
|
@@ -0,0 +1,170 @@
|
|
1
|
+
import defaultInfoCardProps from './defaultProps'
|
2
|
+
import InfoCard from './index.vue'
|
3
|
+
import theme from '@/assets/theme'
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'InfoCard',
|
7
|
+
component: InfoCard,
|
8
|
+
tags: ['autodocs'],
|
9
|
+
argTypes: {
|
10
|
+
type: {
|
11
|
+
description: 'Defines preset styles',
|
12
|
+
control: 'select',
|
13
|
+
options: ['info', 'warning'],
|
14
|
+
},
|
15
|
+
minWidth: {
|
16
|
+
description: '',
|
17
|
+
},
|
18
|
+
color: {
|
19
|
+
description: 'Color of the text (can overwrite preset styles)',
|
20
|
+
control: {
|
21
|
+
type: 'color',
|
22
|
+
presetColors: [
|
23
|
+
theme.colors.grey3,
|
24
|
+
theme.colors.grey4,
|
25
|
+
theme.colors.red,
|
26
|
+
],
|
27
|
+
},
|
28
|
+
},
|
29
|
+
iconColor: {
|
30
|
+
description: 'Color of the icon (can overwrite preset styles)',
|
31
|
+
control: {
|
32
|
+
type: 'color',
|
33
|
+
presetColors: [
|
34
|
+
theme.colors.grey3,
|
35
|
+
theme.colors.grey4,
|
36
|
+
theme.colors.red,
|
37
|
+
],
|
38
|
+
},
|
39
|
+
},
|
40
|
+
alignItems: {
|
41
|
+
description: 'Icon and text alignment (can overwrite preset styles)',
|
42
|
+
control: 'select',
|
43
|
+
options: ['flex-start', 'flex-end', 'center'],
|
44
|
+
},
|
45
|
+
padding: {
|
46
|
+
description: 'Info card padding (can overwrite preset styles)',
|
47
|
+
},
|
48
|
+
borderColor: {
|
49
|
+
description: 'Info card border color (can overwrite preset styles)',
|
50
|
+
control: {
|
51
|
+
type: 'color',
|
52
|
+
presetColors: [
|
53
|
+
theme.colors.grey3,
|
54
|
+
theme.colors.grey4,
|
55
|
+
theme.colors.red,
|
56
|
+
],
|
57
|
+
},
|
58
|
+
},
|
59
|
+
borderStyle: {
|
60
|
+
description: 'Info card border style (can overwrite preset styles)',
|
61
|
+
control: 'select',
|
62
|
+
options: ['dashed', 'dotted', 'inset', 'dashed solid', 'none'],
|
63
|
+
},
|
64
|
+
|
65
|
+
// info card content slot
|
66
|
+
default: {
|
67
|
+
description: 'Info card slot content',
|
68
|
+
},
|
69
|
+
},
|
70
|
+
}
|
71
|
+
|
72
|
+
// To use:
|
73
|
+
// <InfoCard
|
74
|
+
// type="warning"
|
75
|
+
// min-width="auto'
|
76
|
+
// color="red"
|
77
|
+
// align-items="center"
|
78
|
+
// padding="100px"
|
79
|
+
// border-color="red"
|
80
|
+
// border-style="solid"
|
81
|
+
// >
|
82
|
+
// Some Text
|
83
|
+
// </InfoCard>
|
84
|
+
// all props after "min-width" are used to overwrite the preset styles set by "type"
|
85
|
+
|
86
|
+
const Template = (args) => {
|
87
|
+
return {
|
88
|
+
components: { InfoCard },
|
89
|
+
setup() {
|
90
|
+
return { args }
|
91
|
+
},
|
92
|
+
template: `
|
93
|
+
<InfoCard v-bind="args">
|
94
|
+
{{ args.default }}
|
95
|
+
</InfoCard>
|
96
|
+
`,
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
export const Default = Template.bind({})
|
101
|
+
Default.args = {
|
102
|
+
...defaultInfoCardProps,
|
103
|
+
}
|
104
|
+
|
105
|
+
export const InfoCardTypeWarning = Template.bind({})
|
106
|
+
InfoCardTypeWarning.args = {
|
107
|
+
...defaultInfoCardProps,
|
108
|
+
type: 'warning',
|
109
|
+
}
|
110
|
+
|
111
|
+
export const InfoCardTypeErrorMinor = Template.bind({})
|
112
|
+
InfoCardTypeErrorMinor.args = {
|
113
|
+
...defaultInfoCardProps,
|
114
|
+
type: 'error_minor',
|
115
|
+
}
|
116
|
+
|
117
|
+
export const InfoCardTypeInfoMinWidth = Template.bind({})
|
118
|
+
InfoCardTypeInfoMinWidth.args = {
|
119
|
+
...defaultInfoCardProps,
|
120
|
+
|
121
|
+
minWidth: '250px',
|
122
|
+
}
|
123
|
+
|
124
|
+
export const InfoCardTypeInfoColorOverwritten = Template.bind({})
|
125
|
+
InfoCardTypeInfoColorOverwritten.args = {
|
126
|
+
...defaultInfoCardProps,
|
127
|
+
|
128
|
+
color: theme.colors.green,
|
129
|
+
}
|
130
|
+
|
131
|
+
export const InfoCardTypeInfoIconColorOverwritten = Template.bind({})
|
132
|
+
InfoCardTypeInfoIconColorOverwritten.args = {
|
133
|
+
...defaultInfoCardProps,
|
134
|
+
|
135
|
+
iconColor: theme.colors.green,
|
136
|
+
}
|
137
|
+
|
138
|
+
export const InfoCardTypeWarningAlignItemsOverwritten = Template.bind({})
|
139
|
+
InfoCardTypeWarningAlignItemsOverwritten.args = {
|
140
|
+
...defaultInfoCardProps,
|
141
|
+
type: 'warning',
|
142
|
+
default:
|
143
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
144
|
+
|
145
|
+
alignItems: 'center',
|
146
|
+
}
|
147
|
+
|
148
|
+
export const InfoCardTypeWarningPaddingOverwritten = Template.bind({})
|
149
|
+
InfoCardTypeWarningPaddingOverwritten.args = {
|
150
|
+
...defaultInfoCardProps,
|
151
|
+
type: 'warning',
|
152
|
+
|
153
|
+
padding: '50px',
|
154
|
+
}
|
155
|
+
|
156
|
+
export const InfoCardTypeErrorMinorBorderColorOverwritten = Template.bind({})
|
157
|
+
InfoCardTypeErrorMinorBorderColorOverwritten.args = {
|
158
|
+
...defaultInfoCardProps,
|
159
|
+
type: 'error_minor',
|
160
|
+
|
161
|
+
borderColor: theme.colors.green,
|
162
|
+
}
|
163
|
+
|
164
|
+
export const InfoCardTypeErrorMinorBorderStyleOverwritten = Template.bind({})
|
165
|
+
InfoCardTypeErrorMinorBorderStyleOverwritten.args = {
|
166
|
+
...defaultInfoCardProps,
|
167
|
+
type: 'error_minor',
|
168
|
+
|
169
|
+
borderStyle: 'solid none',
|
170
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
const defaultInfoCardProps = {
|
2
|
+
// info card content slot
|
3
|
+
default:
|
4
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
5
|
+
}
|
6
|
+
|
7
|
+
export default defaultInfoCardProps
|
@@ -1,11 +1,21 @@
|
|
1
1
|
<template>
|
2
2
|
<InfoContainer
|
3
|
-
|
3
|
+
:align-items="alignItems"
|
4
4
|
:border-color="borderColor"
|
5
|
-
:
|
5
|
+
:border-style="borderStyle"
|
6
|
+
:color="color"
|
7
|
+
data-test-id="info_card_wrapper"
|
8
|
+
:min-width="minWidth"
|
9
|
+
:padding="padding"
|
10
|
+
:preset-styles="presetStyles"
|
6
11
|
>
|
7
|
-
<RCIcon
|
8
|
-
|
12
|
+
<RCIcon
|
13
|
+
:color="iconColor ? iconColor : presetStyles.iconColor"
|
14
|
+
data-test-id="info_card_icon"
|
15
|
+
name="info"
|
16
|
+
size="24px"
|
17
|
+
/>
|
18
|
+
<TextContainer data-test-id="info_card_text_container">
|
9
19
|
<slot></slot>
|
10
20
|
</TextContainer>
|
11
21
|
</InfoContainer>
|
@@ -13,26 +23,37 @@
|
|
13
23
|
|
14
24
|
<script>
|
15
25
|
import styled from 'vue3-styled-components'
|
26
|
+
import theme from '../../assets/theme.js'
|
16
27
|
import RCIcon from '../icon'
|
17
|
-
|
18
|
-
|
19
|
-
|
28
|
+
|
29
|
+
const infoContainerAttrs = {
|
30
|
+
minWidth: String,
|
31
|
+
color: String,
|
32
|
+
alignItems: String,
|
33
|
+
padding: String,
|
20
34
|
borderColor: String,
|
35
|
+
borderStyle: String,
|
36
|
+
presetStyles: Object,
|
21
37
|
}
|
22
|
-
const InfoContainer = styled('div',
|
38
|
+
const InfoContainer = styled('div', infoContainerAttrs)`
|
23
39
|
display: flex;
|
40
|
+
align-items: ${(props) =>
|
41
|
+
props.alignItems ? props.alignItems : props.presetStyles.alignItems};
|
24
42
|
gap: 15px;
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
? props.theme.colors[props.borderColor]
|
30
|
-
: props.borderColor};
|
31
|
-
background-color: ${(props) =>
|
32
|
-
props.theme.colors[props.backgroundColor]
|
33
|
-
? props.theme.colors[props.backgroundColor]
|
34
|
-
: props.backgroundColor};
|
43
|
+
min-width: ${(props) => props.minWidth};
|
44
|
+
padding: ${(props) =>
|
45
|
+
props.padding ? props.padding : props.presetStyles.padding};
|
46
|
+
color: ${(props) => (props.color ? props.color : props.presetStyles.color)};
|
35
47
|
border-radius: 4px;
|
48
|
+
background-color: ${(props) =>
|
49
|
+
props.backgroundColor
|
50
|
+
? props.backgroundColor
|
51
|
+
: props.presetStyles.backgroundColor};
|
52
|
+
border-width: ${(props) => props.presetStyles.borderWidth};
|
53
|
+
border-style: ${(props) =>
|
54
|
+
props.borderStyle ? props.borderStyle : props.presetStyles.borderStyle};
|
55
|
+
border-color: ${(props) =>
|
56
|
+
props.borderColor ? props.borderColor : props.presetStyles.borderColor};
|
36
57
|
`
|
37
58
|
|
38
59
|
const TextContainer = styled.div`
|
@@ -48,19 +69,83 @@
|
|
48
69
|
TextContainer,
|
49
70
|
},
|
50
71
|
props: {
|
72
|
+
type: {
|
73
|
+
required: false,
|
74
|
+
type: String,
|
75
|
+
default: 'info',
|
76
|
+
},
|
77
|
+
minWidth: {
|
78
|
+
required: false,
|
79
|
+
type: String,
|
80
|
+
default: '',
|
81
|
+
},
|
82
|
+
iconColor: {
|
83
|
+
required: false,
|
84
|
+
type: String,
|
85
|
+
default: '',
|
86
|
+
},
|
51
87
|
color: {
|
52
88
|
required: false,
|
89
|
+
type: String,
|
90
|
+
default: '',
|
53
91
|
},
|
54
|
-
|
92
|
+
alignItems: {
|
55
93
|
required: false,
|
94
|
+
type: String,
|
95
|
+
default: '',
|
56
96
|
},
|
57
|
-
|
97
|
+
padding: {
|
58
98
|
required: false,
|
59
|
-
|
99
|
+
type: String,
|
100
|
+
default: '',
|
60
101
|
},
|
61
102
|
borderColor: {
|
62
103
|
required: false,
|
63
|
-
|
104
|
+
type: String,
|
105
|
+
default: '',
|
106
|
+
},
|
107
|
+
borderStyle: {
|
108
|
+
required: false,
|
109
|
+
type: String,
|
110
|
+
default: '',
|
111
|
+
},
|
112
|
+
},
|
113
|
+
computed: {
|
114
|
+
isInfo() {
|
115
|
+
// this property is used for tests
|
116
|
+
return this.type === 'info'
|
117
|
+
},
|
118
|
+
isWarning() {
|
119
|
+
return this.type === 'warning'
|
120
|
+
},
|
121
|
+
isErrorMinor() {
|
122
|
+
return this.type === 'error_minor'
|
123
|
+
},
|
124
|
+
presetStyles() {
|
125
|
+
// the types that doesn't have explicit border anyway have it transparent
|
126
|
+
// to avoid flickering in case the same info card would switch the types
|
127
|
+
let stylesCollection = {
|
128
|
+
alignItems: 'flex-start',
|
129
|
+
padding: '20px',
|
130
|
+
borderWidth: '1px',
|
131
|
+
borderStyle: 'solid',
|
132
|
+
borderColor: 'transparent',
|
133
|
+
}
|
134
|
+
|
135
|
+
if (this.isWarning) {
|
136
|
+
stylesCollection.color = theme.colors.white
|
137
|
+
stylesCollection.backgroundColor = theme.colors.yellow
|
138
|
+
stylesCollection.iconColor = theme.colors.white
|
139
|
+
} else if (this.isErrorMinor) {
|
140
|
+
stylesCollection.borderStyle = 'dashed'
|
141
|
+
stylesCollection.borderColor = theme.colors.pureRed
|
142
|
+
stylesCollection.iconColor = theme.colors.pureRed
|
143
|
+
} else {
|
144
|
+
stylesCollection.borderStyle = 'dashed'
|
145
|
+
stylesCollection.borderColor = theme.colors.grey4
|
146
|
+
}
|
147
|
+
|
148
|
+
return stylesCollection
|
64
149
|
},
|
65
150
|
},
|
66
151
|
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
2
|
+
import RCInfoCard from '@/components/infoCard'
|
3
|
+
import RCIcon from '@/components/icon'
|
4
|
+
import defaultInfoCardProps from './defaultProps'
|
5
|
+
import theme from '@/assets/theme'
|
6
|
+
|
7
|
+
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
8
|
+
// need to mock this due to how jest handles import.meta
|
9
|
+
fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
|
10
|
+
}))
|
11
|
+
|
12
|
+
describe('RCInfoCard.vue', () => {
|
13
|
+
it('info card is rendered with icon and correct text', async () => {
|
14
|
+
const wrapper = mount(RCInfoCard, {
|
15
|
+
props: { ...defaultInfoCardProps },
|
16
|
+
slots: {
|
17
|
+
default: defaultInfoCardProps.default,
|
18
|
+
},
|
19
|
+
global: {
|
20
|
+
provide: {
|
21
|
+
theme,
|
22
|
+
},
|
23
|
+
},
|
24
|
+
})
|
25
|
+
|
26
|
+
const iconComponent = wrapper.findComponent(RCIcon)
|
27
|
+
const infoCardText = wrapper.find(
|
28
|
+
'[data-test-id="info_card_text_container"]'
|
29
|
+
)
|
30
|
+
|
31
|
+
expect(iconComponent.exists()).toBe(true)
|
32
|
+
expect(infoCardText.exists()).toBe(true)
|
33
|
+
expect(infoCardText.text()).toContain(defaultInfoCardProps.default)
|
34
|
+
}),
|
35
|
+
it('info card rendered with type info have correct computed values', async () => {
|
36
|
+
const wrapper = mount(RCInfoCard, {
|
37
|
+
props: { ...defaultInfoCardProps },
|
38
|
+
slots: {
|
39
|
+
default: defaultInfoCardProps.default,
|
40
|
+
},
|
41
|
+
global: {
|
42
|
+
provide: {
|
43
|
+
theme,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
})
|
47
|
+
|
48
|
+
expect(wrapper.vm.isInfo).toBe(true)
|
49
|
+
expect(wrapper.vm.isWarning).toBe(false)
|
50
|
+
expect(wrapper.vm.isErrorMinor).toBe(false)
|
51
|
+
|
52
|
+
await wrapper.setProps({ type: 'warning' })
|
53
|
+
|
54
|
+
expect(wrapper.vm.isInfo).toBe(false)
|
55
|
+
expect(wrapper.vm.isWarning).toBe(true)
|
56
|
+
expect(wrapper.vm.isErrorMinor).toBe(false)
|
57
|
+
|
58
|
+
await wrapper.setProps({ type: 'error_minor' })
|
59
|
+
|
60
|
+
expect(wrapper.vm.isInfo).toBe(false)
|
61
|
+
expect(wrapper.vm.isWarning).toBe(false)
|
62
|
+
expect(wrapper.vm.isErrorMinor).toBe(true)
|
63
|
+
})
|
64
|
+
})
|