@eturnity/eturnity_reusable_components 7.51.3-EPDM-12810.0 → 7.51.3-EPDM-12810.2
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 +2 -3
- package/src/assets/gifs/spinner.gif +0 -0
- package/src/assets/svgIcons/bell_alt.svg +5 -3
- package/src/assets/svgIcons/checkmark.svg +3 -0
- package/src/assets/svgIcons/collapse_all.svg +4 -0
- package/src/assets/svgIcons/expand_all.svg +4 -0
- package/src/assets/svgIcons/export_document.svg +3 -0
- package/src/assets/svgIcons/hybrid.svg +4 -0
- package/src/assets/svgIcons/module.svg +3 -0
- package/src/assets/svgIcons/move_down.svg +3 -0
- package/src/assets/svgIcons/move_up.svg +3 -0
- package/src/assets/svgIcons/optimizer.svg +6 -0
- package/src/assets/svgIcons/string_design.svg +5 -0
- package/src/assets/svgIcons/string_directions.svg +10 -0
- package/src/components/banner/notificationBanner/index.vue +131 -0
- package/src/components/buttons/buttonIcon/index.vue +4 -2
- package/src/components/buttons/mainButton/index.vue +16 -2
- package/src/components/card/index.vue +1 -1
- package/src/components/icon/Icons.stories.js +9 -19
- package/src/components/icon/icon.spec.js +66 -0
- package/src/components/icon/iconCollection.vue +4 -3
- package/src/components/icon/index.vue +9 -2
- package/src/components/infoText/index.vue +210 -74
- package/src/components/inputs/checkbox/index.vue +19 -8
- package/src/components/inputs/inputNumber/index.vue +202 -12
- package/src/components/inputs/inputText/index.vue +36 -2
- package/src/components/inputs/radioButton/index.vue +27 -6
- package/src/components/inputs/select/index.vue +68 -24
- package/src/components/inputs/select/option/index.vue +11 -2
- package/src/components/label/index.vue +1 -2
- package/src/components/markerItem/index.vue +8 -1
- package/src/components/spinner/index.vue +11 -0
- package/src/components/spinnerGif/index.vue +98 -0
- package/src/components/stringDesign/DropdownMenu/index.vue +983 -0
- package/src/components/tableDropdown/index.vue +51 -20
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eturnity/eturnity_reusable_components",
|
3
|
-
"version": "7.51.3-EPDM-12810.
|
3
|
+
"version": "7.51.3-EPDM-12810.2",
|
4
4
|
"files": [
|
5
5
|
"dist",
|
6
6
|
"src"
|
@@ -16,8 +16,7 @@
|
|
16
16
|
"build-storybook": "storybook build",
|
17
17
|
"prettier": "prettier --write 'src/**/*.{js,vue}'",
|
18
18
|
"test": "jest",
|
19
|
-
"test-coverage": "jest --coverage"
|
20
|
-
"prepublishOnly": "npm run test"
|
19
|
+
"test-coverage": "jest --coverage"
|
21
20
|
},
|
22
21
|
"dependencies": {
|
23
22
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
Binary file
|
@@ -1,3 +1,5 @@
|
|
1
|
-
<svg width="
|
2
|
-
<path
|
3
|
-
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12.75C5.5 13.4404 6.17157 14 7 14C7.82843 14 8.5 13.4404 8.5 12.75H5.5Z" fill="white"/>
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1.25C8 0.559644 7.55228 -3.91405e-08 7 -8.74228e-08C6.44772 -1.35705e-07 6 0.559644 6 1.25L8 1.25Z" fill="white"/>
|
4
|
+
<path d="M7 1C4.79086 1 3 2.64162 3 4.66667V6.55904C3 8.11545 2.54599 9.63806 1.69361 10.9403L1 12H13L12.3064 10.9403C11.454 9.63806 11 8.11545 11 6.55904V4.66667C11 2.64162 9.20914 1 7 1Z" fill="white"/>
|
5
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M17.0686 17.0686C20.9771 13.1601 20.9771 6.83992 17.0686 2.93139C13.1601 -0.977131 6.83992 -0.977131 2.93139 2.93139C-0.977131 6.83992 -0.977131 13.1601 2.93139 17.0686C6.83992 20.9771 13.1601 20.9771 17.0686 17.0686ZM6.42412 8.50312L8.66944 10.7484L13.5759 5.842L15.3222 7.58836L10.4158 12.4948L8.66944 14.158L6.92308 12.4948L4.67775 10.2495L6.42412 8.50312Z" fill="white"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.99998 1.20459L11.3818 4.49095L10.6182 5.50914L6.99998 2.7955L3.3818 5.50914L2.61816 4.49095L6.99998 1.20459Z" fill="#263238"/>
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.99998 12.7954L11.3818 9.50905L10.6182 8.49086L6.99998 11.2045L3.3818 8.49086L2.61816 9.50905L6.99998 12.7954Z" fill="#263238"/>
|
4
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M0.75 0H8.33405L11.7467 3.41264V6.7202H10.5248V4.88741H6.85927V1.22185H1.97185V12.2185H5.63741V13.4404H0.75V0ZM8.08112 1.47478V3.66556H10.2719L8.08112 1.47478ZM10.5554 7.99581L13.5233 10.9979L10.5554 14L9.68664 13.141L11.2017 11.6088H6.85805V10.387H11.2017L9.68664 8.85477L10.5554 7.99581Z" fill="#0D0D0D"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.22998 11.8962H10.5006H12.2505V10.1463V8.97906H14.0004V5.47917H12.2505V4.31283V2.56289V2.55151H10.5006V2.56289H8.58218L7.76617 4.31283H10.5006V10.1463H5.04599L4.22998 11.8962Z" fill="white"/>
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.2622 4.79738C6.91629 4.63687 6.53076 4.54729 6.12431 4.54729C4.63054 4.54729 3.41919 5.75796 3.41919 7.25241C3.41919 8.33588 4.05591 9.26984 4.97534 9.70158L7.2622 4.79738ZM5.44786 3.11681C5.44786 3.49042 5.7507 3.79326 6.12431 3.79326C6.49793 3.79326 6.80077 3.49042 6.80077 3.11681V1.76459C6.80077 1.39097 6.49793 1.08813 6.12431 1.08813C5.7507 1.08813 5.44786 1.39097 5.44786 1.76459V3.11681ZM2.02818 7.88939H0.675962C0.302349 7.88939 -0.000488281 7.58655 -0.000488281 7.21294C-0.000488281 6.83932 0.302349 6.53649 0.675962 6.53649H2.02818C2.4018 6.53649 2.70463 6.83932 2.70463 7.21294C2.70463 7.58655 2.4018 7.88939 2.02818 7.88939ZM3.7057 10.5877L2.74955 11.5439C2.4855 11.8079 2.05745 11.8079 1.7934 11.5439C1.52935 11.2798 1.52935 10.8518 1.7934 10.5877L2.74955 9.63155C3.0136 9.36751 3.44165 9.36751 3.7057 9.63155C3.96975 9.8956 3.96975 10.3237 3.7057 10.5877ZM2.74955 4.79432L1.7934 3.83817C1.52935 3.57412 1.52935 3.14607 1.7934 2.88202C2.05745 2.61797 2.4855 2.61797 2.74955 2.88202L3.7057 3.83817C3.96975 4.10222 3.96975 4.53027 3.7057 4.79432C3.44165 5.05837 3.0136 5.05837 2.74955 4.79432Z" fill="white"/>
|
4
|
+
</svg>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0722 3.6H1.6V10.4H11.0722L7.87332 7.60217L7.18484 7L7.87332 6.39783L11.0722 3.6ZM12.4 9.43572V4.56428L9.61516 7L12.4 9.43572ZM0 2H1.6H12.4H14V3.6V10.4V12H12.4H1.6H0V10.4V3.6V2Z" fill="white"/>
|
3
|
+
</svg>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<rect x="3.11079" y="3.10981" width="7.77778" height="7.77778" stroke="white" stroke-width="1.55556"/>
|
3
|
+
<line x1="3.72749" y1="10.3387" x2="10.7275" y2="3.3387" stroke="white" stroke-width="1.55556"/>
|
4
|
+
<line x1="-0.000366211" y1="7.05425" x2="2.99963" y2="7.05425" stroke="white" stroke-width="1.55556"/>
|
5
|
+
<line x1="10.9994" y1="6.99957" x2="13.9994" y2="6.99957" stroke="white" stroke-width="1.55556"/>
|
6
|
+
</svg>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M2.85714 1.92857C2.85714 2.71755 2.21755 3.35714 1.42857 3.35714C0.639593 3.35714 0 2.71755 0 1.92857C0 1.13959 0.639593 0.5 1.42857 0.5C2.21755 0.5 2.85714 1.13959 2.85714 1.92857Z" fill="white"/>
|
3
|
+
<path d="M10 9.07143C10 9.86041 9.36041 10.5 8.57143 10.5C7.78245 10.5 7.14286 9.86041 7.14286 9.07143C7.14286 8.28245 7.78245 7.64286 8.57143 7.64286C9.36041 7.64286 10 8.28245 10 9.07143Z" fill="white"/>
|
4
|
+
<path d="M5.71429 3C5.71429 2.40827 6.19398 1.92857 6.78571 1.92857C7.37745 1.92857 7.85714 2.40827 7.85714 3V6.21429H9.28571V3C9.28571 1.61929 8.16643 0.5 6.78571 0.5C5.405 0.5 4.28571 1.61929 4.28571 3V8C4.28571 8.59173 3.80602 9.07143 3.21429 9.07143C2.62255 9.07143 2.14286 8.59173 2.14286 8V4.78571H0.714286V8C0.714286 9.38071 1.83357 10.5 3.21429 10.5C4.595 10.5 5.71429 9.38071 5.71429 8V3Z" fill="white"/>
|
5
|
+
</svg>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<svg width="30" height="30" viewBox="8 8 14 14" fill="#263238" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<g clip-path="url(#clip0_908_47480)" fill="#263238">
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 19.75V8.5H9.5V19.75C9.5 20.1642 9.83579 20.5 10.25 20.5C10.6642 20.5 11 20.1642 11 19.75V10.25C11 9.2835 11.7835 8.5 12.75 8.5C13.7165 8.5 14.5 9.2835 14.5 10.25V21.5H13.5V10.25C13.5 9.83579 13.1642 9.5 12.75 9.5C12.3358 9.5 12 9.83579 12 10.25V19.75C12 20.7165 11.2165 21.5 10.25 21.5C9.2835 21.5 8.5 20.7165 8.5 19.75ZM20 9.5H15.5V8.5H20C20.8284 8.5 21.5 9.17157 21.5 10C21.5 10.8284 20.8284 11.5 20 11.5H17C16.7239 11.5 16.5 11.7239 16.5 12C16.5 12.2761 16.7239 12.5 17 12.5H20C20.8284 12.5 21.5 13.1716 21.5 14C21.5 14.8284 20.8284 15.5 20 15.5H17C16.7239 15.5 16.5 15.7239 16.5 16C16.5 16.2761 16.7239 16.5 17 16.5H20C20.8284 16.5 21.5 17.1716 21.5 18C21.5 18.8284 20.8284 19.5 20 19.5H17C16.7239 19.5 16.5 19.7239 16.5 20C16.5 20.2761 16.7239 20.5 17 20.5H21.5V21.5H17C16.1716 21.5 15.5 20.8284 15.5 20C15.5 19.1716 16.1716 18.5 17 18.5H20C20.2761 18.5 20.5 18.2761 20.5 18C20.5 17.7239 20.2761 17.5 20 17.5H17C16.1716 17.5 15.5 16.8284 15.5 16C15.5 15.1716 16.1716 14.5 17 14.5H20C20.2761 14.5 20.5 14.2761 20.5 14C20.5 13.7239 20.2761 13.5 20 13.5H17C16.1716 13.5 15.5 12.8284 15.5 12C15.5 11.1716 16.1716 10.5 17 10.5H20C20.2761 10.5 20.5 10.2761 20.5 10C20.5 9.72386 20.2761 9.5 20 9.5Z" fill="white"/>
|
4
|
+
</g>
|
5
|
+
<defs>
|
6
|
+
<clipPath id="clip0_908_47480">
|
7
|
+
<rect width="14" height="14" fill="white" transform="translate(8 8)"/>
|
8
|
+
</clipPath>
|
9
|
+
</defs>
|
10
|
+
</svg>
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<template>
|
2
|
+
<PageContainer v-if="showBanner">
|
3
|
+
<BannerContainer
|
4
|
+
:background-color="backgroundColor"
|
5
|
+
:text-color="textColor"
|
6
|
+
>
|
7
|
+
<IconContainer>
|
8
|
+
<RCIcon color="white" :name="iconName" size="20px" />
|
9
|
+
</IconContainer>
|
10
|
+
<TextContainer>
|
11
|
+
<TextContent>
|
12
|
+
{{ mainText }}
|
13
|
+
</TextContent>
|
14
|
+
</TextContainer>
|
15
|
+
<ButtonContainer>
|
16
|
+
<MainButton
|
17
|
+
:custom-color="theme.colors.white"
|
18
|
+
:font-color="theme.colors.black"
|
19
|
+
:text="buttonText"
|
20
|
+
@click="$emit('on-button-click')"
|
21
|
+
/>
|
22
|
+
</ButtonContainer>
|
23
|
+
</BannerContainer>
|
24
|
+
</PageContainer>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
// import NotificationBanner from "@eturnity/eturnity_reusable_components/src/components/banner/notificationBanner"
|
29
|
+
import styled from 'vue3-styled-components'
|
30
|
+
import RCIcon from '../../icon'
|
31
|
+
import MainButton from '../../buttons/mainButton'
|
32
|
+
import theme from '@/assets/theme'
|
33
|
+
|
34
|
+
const PageContainer = styled.div`
|
35
|
+
position: fixed;
|
36
|
+
bottom: 24px;
|
37
|
+
left: 50%;
|
38
|
+
transform: translateX(-50%);
|
39
|
+
z-index: 999999;
|
40
|
+
`
|
41
|
+
|
42
|
+
const bannerAttrs = { backgroundColor: String, textColor: String }
|
43
|
+
const BannerContainer = styled('div', bannerAttrs)`
|
44
|
+
display: grid;
|
45
|
+
grid-template-columns: auto 1fr auto;
|
46
|
+
gap: 20px;
|
47
|
+
padding: 10px 20px;
|
48
|
+
border-radius: 4px;
|
49
|
+
align-items: center;
|
50
|
+
justify-content: center;
|
51
|
+
background-color: ${(props) => props.theme.colors[props.backgroundColor]};
|
52
|
+
color: ${(props) => props.theme.colors[props.textColor]};
|
53
|
+
font-size: 14px;
|
54
|
+
`
|
55
|
+
|
56
|
+
const IconContainer = styled.div``
|
57
|
+
|
58
|
+
const TextContainer = styled.div``
|
59
|
+
|
60
|
+
const TextContent = styled.div`
|
61
|
+
line-height: 150%;
|
62
|
+
`
|
63
|
+
|
64
|
+
const ButtonContainer = styled.div`
|
65
|
+
display: flex;
|
66
|
+
gap: 20px;
|
67
|
+
align-items: center;
|
68
|
+
justify-content: center;
|
69
|
+
`
|
70
|
+
|
71
|
+
export default {
|
72
|
+
name: 'NotificationBanner',
|
73
|
+
components: {
|
74
|
+
PageContainer,
|
75
|
+
BannerContainer,
|
76
|
+
RCIcon,
|
77
|
+
IconContainer,
|
78
|
+
TextContainer,
|
79
|
+
TextContent,
|
80
|
+
ButtonContainer,
|
81
|
+
MainButton,
|
82
|
+
},
|
83
|
+
props: {
|
84
|
+
backgroundColor: {
|
85
|
+
type: String,
|
86
|
+
default: 'green',
|
87
|
+
required: false,
|
88
|
+
},
|
89
|
+
textColor: {
|
90
|
+
type: String,
|
91
|
+
default: 'white',
|
92
|
+
required: false,
|
93
|
+
},
|
94
|
+
iconName: {
|
95
|
+
type: String,
|
96
|
+
default: 'checkmark',
|
97
|
+
required: false,
|
98
|
+
},
|
99
|
+
mainText: {
|
100
|
+
type: String,
|
101
|
+
required: true,
|
102
|
+
},
|
103
|
+
buttonText: {
|
104
|
+
type: String,
|
105
|
+
required: true,
|
106
|
+
},
|
107
|
+
isOpen: {
|
108
|
+
type: Boolean,
|
109
|
+
default: false,
|
110
|
+
required: true,
|
111
|
+
},
|
112
|
+
},
|
113
|
+
data() {
|
114
|
+
return {
|
115
|
+
theme,
|
116
|
+
showBanner: false,
|
117
|
+
}
|
118
|
+
},
|
119
|
+
watch: {
|
120
|
+
isOpen(newVal) {
|
121
|
+
if (newVal) {
|
122
|
+
this.showBanner = true
|
123
|
+
setTimeout(() => {
|
124
|
+
this.showBanner = false
|
125
|
+
this.$emit('on-close')
|
126
|
+
}, 10000)
|
127
|
+
}
|
128
|
+
},
|
129
|
+
},
|
130
|
+
}
|
131
|
+
</script>
|
@@ -52,7 +52,9 @@
|
|
52
52
|
props.isDisabled
|
53
53
|
? props.theme.colors.disabled
|
54
54
|
: props.customColor
|
55
|
-
? props.customColor
|
55
|
+
? props.theme.colors[props.customColor]
|
56
|
+
? props.theme.colors[props.customColor]
|
57
|
+
: props.customColor
|
56
58
|
: props.theme.colors.yellow};
|
57
59
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
58
60
|
user-select: none;
|
@@ -81,7 +83,7 @@
|
|
81
83
|
display: flex;
|
82
84
|
align-items: center;
|
83
85
|
justify-content: center;
|
84
|
-
padding: 0
|
86
|
+
padding: 0 14px;
|
85
87
|
`
|
86
88
|
|
87
89
|
const IconContainerAttrs = {
|
@@ -5,6 +5,7 @@
|
|
5
5
|
:custom-color="customColor"
|
6
6
|
:data-id="dataId"
|
7
7
|
:font-color="fontColor"
|
8
|
+
:height="height"
|
8
9
|
:is-disabled="isDisabled"
|
9
10
|
:min-width="minWidth"
|
10
11
|
:no-wrap="noWrap"
|
@@ -43,12 +44,19 @@
|
|
43
44
|
customColor: String,
|
44
45
|
fontColor: String,
|
45
46
|
noWrap: Boolean,
|
47
|
+
height: String,
|
46
48
|
}
|
47
49
|
const ButtonContainer = styled('div', ButtonAttrs)`
|
50
|
+
display: flex;
|
51
|
+
justify-content: center;
|
48
52
|
padding: 7px 15px;
|
49
|
-
font-size:
|
53
|
+
font-size: 14px;
|
50
54
|
color: ${(props) =>
|
51
|
-
props.
|
55
|
+
props.isDisabled
|
56
|
+
? props.theme.colors.white
|
57
|
+
: props.fontColor
|
58
|
+
? props.fontColor
|
59
|
+
: props.theme.colors.white};
|
52
60
|
background-color: ${(props) =>
|
53
61
|
props.isDisabled
|
54
62
|
? props.theme.colors.disabled
|
@@ -67,6 +75,7 @@
|
|
67
75
|
user-select: none;
|
68
76
|
${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
|
69
77
|
${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
|
78
|
+
height: ${(props) => props.height};
|
70
79
|
|
71
80
|
&:hover {
|
72
81
|
opacity: ${(props) => (props.isDisabled ? '1' : '0.8')};
|
@@ -141,6 +150,11 @@
|
|
141
150
|
default: null,
|
142
151
|
type: String,
|
143
152
|
},
|
153
|
+
height: {
|
154
|
+
required: false,
|
155
|
+
default: 'auto',
|
156
|
+
type: String,
|
157
|
+
},
|
144
158
|
id: {
|
145
159
|
required: false,
|
146
160
|
default: null,
|
@@ -3,24 +3,14 @@ import IconCollection from './iconCollection.vue'
|
|
3
3
|
export default {
|
4
4
|
title: 'icon',
|
5
5
|
component: IconCollection,
|
6
|
-
// argTypes: {},
|
7
6
|
}
|
8
7
|
|
9
|
-
const Template = (args
|
10
|
-
// Components used in your story `template` are defined in the `components` object
|
8
|
+
const Template = (args) => ({
|
11
9
|
components: { IconCollection },
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
17
|
-
// How to use:
|
18
|
-
//<icon
|
19
|
-
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
20
|
-
// color="red"
|
21
|
-
// hoveredColor="blue"
|
22
|
-
// size="60px" by default, this is 30px
|
23
|
-
// />
|
10
|
+
setup() {
|
11
|
+
return { args }
|
12
|
+
},
|
13
|
+
template: '<IconCollection v-bind="args" />',
|
24
14
|
})
|
25
15
|
|
26
16
|
export const Default = Template.bind({})
|
@@ -28,14 +18,14 @@ Default.args = {
|
|
28
18
|
size: '30px',
|
29
19
|
}
|
30
20
|
|
31
|
-
export const
|
32
|
-
|
21
|
+
export const WithColor = Template.bind({})
|
22
|
+
WithColor.args = {
|
33
23
|
size: '30px',
|
34
24
|
color: 'red',
|
35
25
|
hoveredColor: 'crimson',
|
36
26
|
}
|
37
27
|
|
38
|
-
export const
|
39
|
-
|
28
|
+
export const Large = Template.bind({})
|
29
|
+
Large.args = {
|
40
30
|
size: '60px',
|
41
31
|
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
2
|
+
import RCIcon from '@/components/icon'
|
3
|
+
import theme from '@/assets/theme'
|
4
|
+
import 'jest-styled-components'
|
5
|
+
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
6
|
+
fetchIcon: jest.fn(() => Promise.resolve('mocked-icon-url.svg')),
|
7
|
+
}))
|
8
|
+
|
9
|
+
describe('RCIcon.vue', () => {
|
10
|
+
it('renders icon with default props', async () => {
|
11
|
+
const wrapper = mount(RCIcon, {
|
12
|
+
props: { name: 'House' },
|
13
|
+
global: {
|
14
|
+
provide: {
|
15
|
+
theme,
|
16
|
+
},
|
17
|
+
},
|
18
|
+
})
|
19
|
+
|
20
|
+
const iconWrapper = wrapper.find('[data-test-id="icon_wrapper"]')
|
21
|
+
const iconImage = wrapper.find('[data-test-id="icon_image"]')
|
22
|
+
|
23
|
+
expect(iconWrapper.exists()).toBe(true)
|
24
|
+
expect(iconImage.exists()).toBe(true)
|
25
|
+
expect(wrapper.props('size')).toBe('30px')
|
26
|
+
})
|
27
|
+
|
28
|
+
it('renders striked line when isStriked is true', async () => {
|
29
|
+
const wrapper = mount(RCIcon, {
|
30
|
+
props: {
|
31
|
+
name: 'House',
|
32
|
+
isStriked: true,
|
33
|
+
color: 'red',
|
34
|
+
},
|
35
|
+
global: {
|
36
|
+
provide: {
|
37
|
+
theme,
|
38
|
+
},
|
39
|
+
},
|
40
|
+
})
|
41
|
+
|
42
|
+
const strikedLine = wrapper.find('[data-test-id="icon_striked_line"]')
|
43
|
+
expect(strikedLine.exists()).toBe(true)
|
44
|
+
})
|
45
|
+
|
46
|
+
it('applies correct styling based on props', async () => {
|
47
|
+
const wrapper = mount(RCIcon, {
|
48
|
+
props: {
|
49
|
+
name: 'House',
|
50
|
+
size: '60px',
|
51
|
+
color: 'red',
|
52
|
+
hoveredColor: 'blue',
|
53
|
+
backgroundColor: 'yellow',
|
54
|
+
},
|
55
|
+
global: {
|
56
|
+
provide: {
|
57
|
+
theme,
|
58
|
+
},
|
59
|
+
},
|
60
|
+
})
|
61
|
+
|
62
|
+
const iconImage = wrapper.find('[data-test-id="icon_image"]')
|
63
|
+
expect(iconImage.exists()).toBe(true)
|
64
|
+
// Add assertions for styling if needed
|
65
|
+
})
|
66
|
+
})
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<Wrapper>
|
3
3
|
<IconWrapper v-for="iconItem in iconList" :key="iconItem.name">
|
4
4
|
<div>
|
5
|
+
color:{{ color }}
|
5
6
|
<RCIcon
|
6
7
|
:color="color"
|
7
8
|
:hovered-color="hoveredColor"
|
@@ -39,9 +40,9 @@
|
|
39
40
|
name: 'CollectionComponent',
|
40
41
|
components: { RCIcon, IconWrapper, Wrapper },
|
41
42
|
props: {
|
42
|
-
size: { required: false },
|
43
|
-
color: { required: false },
|
44
|
-
hoveredColor: { required: false },
|
43
|
+
size: { required: false, type: String, default: '30px' },
|
44
|
+
color: { required: false, type: String, default: 'white' },
|
45
|
+
hoveredColor: { required: false, type: String, default: 'grey' },
|
45
46
|
},
|
46
47
|
data() {
|
47
48
|
return {
|
@@ -1,12 +1,18 @@
|
|
1
1
|
<template>
|
2
|
-
<Wrapper
|
2
|
+
<Wrapper
|
3
|
+
:cursor="cursor"
|
4
|
+
data-test-id="icon_wrapper"
|
5
|
+
:disabled="disabled"
|
6
|
+
:size="size"
|
7
|
+
>
|
3
8
|
<IconImage
|
4
9
|
:animation="animation"
|
5
10
|
:background-color="backgroundColor"
|
6
11
|
:color="color"
|
12
|
+
data-test-id="icon_image"
|
7
13
|
:hovered-color="hoveredColor"
|
8
14
|
>
|
9
|
-
<i v-html="icon.html"></i>
|
15
|
+
<i data-test-id="icon_svg" v-html="icon.html"></i>
|
10
16
|
</IconImage>
|
11
17
|
<StrikedLine
|
12
18
|
v-if="isStriked"
|
@@ -42,6 +48,7 @@
|
|
42
48
|
},
|
43
49
|
name: {
|
44
50
|
required: true,
|
51
|
+
type: String,
|
45
52
|
},
|
46
53
|
color: {
|
47
54
|
required: false,
|