@eturnity/eturnity_reusable_components 1.2.19-dev03.2 → 1.2.19-v.5.45.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/App.vue +53 -75
- package/src/assets/svgIcons/{duplicate-3.svg → bookmaker.svg} +0 -0
- package/src/assets/svgIcons/cross.svg +4 -0
- package/src/assets/svgIcons/obstacle_tool.svg +1 -1
- package/src/assets/svgIcons/transfer.svg +4 -0
- package/src/assets/theme.js +0 -2
- package/src/components/icon/index.vue +19 -11
- package/src/components/infoText/index.vue +53 -68
- package/src/components/inputs/inputNumber/index.vue +21 -107
- package/src/components/inputs/inputText/index.vue +10 -12
- package/src/components/inputs/radioButton/index.vue +32 -39
- package/src/components/inputs/searchInput/index.vue +2 -1
- package/src/components/inputs/textAreaInput/index.vue +2 -7
- package/src/components/inputs/toggle/index.vue +2 -2
- package/src/components/pageSubtitle/index.vue +8 -4
- package/src/components/pageTitle/index.vue +12 -4
- package/src/components/projectMarker/index.vue +285 -0
- package/src/components/tables/mainTable/index.vue +8 -3
- package/src/helpers/numberConverter.js +0 -3
- package/src/main.js +2 -0
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/assets/svgIcons/margin_tool.svg +0 -4
- package/src/assets/svgIcons/redo.svg +0 -6
- package/src/assets/svgIcons/undo.svg +0 -6
- package/src/components/errorMessage/index.vue +0 -62
- package/src/components/iconWrapper/index.vue +0 -111
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<page-container :withDate="!!date">
|
|
3
|
+
<marker-container
|
|
4
|
+
v-if="markerData"
|
|
5
|
+
:backgroundColor="markerData.color"
|
|
6
|
+
:hasIcon="!!iconName"
|
|
7
|
+
:isEditionAllowed="editionAllowed"
|
|
8
|
+
:isActive="activated"
|
|
9
|
+
:cursor="cursor"
|
|
10
|
+
@click.native="editionAllowed
|
|
11
|
+
? activated = !activated
|
|
12
|
+
: ''
|
|
13
|
+
"
|
|
14
|
+
>
|
|
15
|
+
<icon
|
|
16
|
+
v-if="!!iconName"
|
|
17
|
+
:name="iconName"
|
|
18
|
+
color="white"
|
|
19
|
+
size="10px"
|
|
20
|
+
:cursor="cursor"
|
|
21
|
+
/>
|
|
22
|
+
<span>{{ markerData.translations[activeLanguage].name }}</span>
|
|
23
|
+
<dot-wrapper
|
|
24
|
+
v-if="editionAllowed"
|
|
25
|
+
class="dotContainer"
|
|
26
|
+
>
|
|
27
|
+
<dot-icon />
|
|
28
|
+
<dot-icon />
|
|
29
|
+
<dot-icon />
|
|
30
|
+
</dot-wrapper>
|
|
31
|
+
<edit-container
|
|
32
|
+
v-if="activated"
|
|
33
|
+
v-click-outside="clickOutsideActionHandler"
|
|
34
|
+
>
|
|
35
|
+
<edit-item @click.native="deleteModalOpened = !deleteModalOpened">
|
|
36
|
+
<delete-icon />
|
|
37
|
+
<div>{{ $gettext('Delete') }}</div>
|
|
38
|
+
</edit-item>
|
|
39
|
+
<edit-item @click.native="onEditClick">
|
|
40
|
+
<icon-container>
|
|
41
|
+
<icon
|
|
42
|
+
name="edit_button"
|
|
43
|
+
size="14px"
|
|
44
|
+
/>
|
|
45
|
+
</icon-container>
|
|
46
|
+
<div>{{ $gettext('Edit') }}</div>
|
|
47
|
+
</edit-item>
|
|
48
|
+
</edit-container>
|
|
49
|
+
</marker-container>
|
|
50
|
+
<date v-if="!!date">
|
|
51
|
+
{{ date }}
|
|
52
|
+
</date>
|
|
53
|
+
<modal
|
|
54
|
+
:isOpen="deleteModalOpened"
|
|
55
|
+
@on-close="closeDeleteModal"
|
|
56
|
+
:preventOutsideClose="true"
|
|
57
|
+
>
|
|
58
|
+
<modal-container>
|
|
59
|
+
<page-title :text="$gettext('delete_confirm_text')" />
|
|
60
|
+
<page-subtitle :text="$gettext('delete_confirm_subtext')" />
|
|
61
|
+
<cta-container>
|
|
62
|
+
<main-button
|
|
63
|
+
@click.native="onDelete"
|
|
64
|
+
:text="$gettext('Delete')"
|
|
65
|
+
/>
|
|
66
|
+
<main-button
|
|
67
|
+
type="cancel"
|
|
68
|
+
@click.native="closeDeleteModal"
|
|
69
|
+
:text="$gettext('Cancel')"
|
|
70
|
+
/>
|
|
71
|
+
</cta-container>
|
|
72
|
+
</modal-container>
|
|
73
|
+
</modal>
|
|
74
|
+
</page-container>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
// import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/projectMarker"
|
|
79
|
+
// To use:
|
|
80
|
+
// <project-marker
|
|
81
|
+
// :activeLanguage="'en-us'"
|
|
82
|
+
// :markerData="{"choice":"sold","translations":{"en-us":{"name":"Sold"}}","color":"#000"}"
|
|
83
|
+
// :isLimitedPartner="false"
|
|
84
|
+
// :isGroupSupport="false"
|
|
85
|
+
// :isEditable='false'
|
|
86
|
+
// :date="'23.07.2022'"
|
|
87
|
+
// @editHandler="onMarkerEdit($event)"
|
|
88
|
+
// @deleteHandler="onMarkerDelete($event)"
|
|
89
|
+
// />
|
|
90
|
+
|
|
91
|
+
import styled from "vue-styled-components"
|
|
92
|
+
import Icon from "../icon"
|
|
93
|
+
import Modal from '../modals/modal'
|
|
94
|
+
import PageTitle from '../pageTitle'
|
|
95
|
+
import DeleteIcon from '../deleteIcon'
|
|
96
|
+
import PageSubtitle from '../pageSubtitle'
|
|
97
|
+
import MainButton from '../buttons/mainButton'
|
|
98
|
+
|
|
99
|
+
const PageContainerAttrs = {
|
|
100
|
+
withDate: Boolean
|
|
101
|
+
}
|
|
102
|
+
const PageContainer = styled('div', PageContainerAttrs)`
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 10px;
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
line-height: 14px;
|
|
108
|
+
`
|
|
109
|
+
|
|
110
|
+
const ModalContainer = styled.div`
|
|
111
|
+
padding: 40px;
|
|
112
|
+
min-width: 500px;
|
|
113
|
+
`
|
|
114
|
+
|
|
115
|
+
const CtaContainer = styled.div`
|
|
116
|
+
display: flex;
|
|
117
|
+
gap: 20px;
|
|
118
|
+
margin-top: 30px;
|
|
119
|
+
`
|
|
120
|
+
|
|
121
|
+
const MarkerAttrs = {
|
|
122
|
+
backgroundColor: String,
|
|
123
|
+
hasIcon: Boolean,
|
|
124
|
+
isEditionAllowed: Boolean,
|
|
125
|
+
isActive: Boolean,
|
|
126
|
+
cursor: String
|
|
127
|
+
}
|
|
128
|
+
const MarkerContainer = styled('div', MarkerAttrs)`
|
|
129
|
+
display: grid;
|
|
130
|
+
grid-template-columns: ${(props) =>
|
|
131
|
+
props.hasIcon || props.isEditionAllowed ? 'auto 1fr' : '1fr'};
|
|
132
|
+
grid-gap: 5px;
|
|
133
|
+
position: relative;
|
|
134
|
+
align-items: center;
|
|
135
|
+
padding: 2px 7px;
|
|
136
|
+
color: ${(props) => props.theme.colors.white};
|
|
137
|
+
background-color: ${(props) =>
|
|
138
|
+
props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
cursor: ${(props) => props.isEditionAllowed ? 'pointer' : props.cursor};
|
|
142
|
+
|
|
143
|
+
.dotContainer {
|
|
144
|
+
display: ${(props) => (props.isActive ? 'flex' : 'none')};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:hover {
|
|
148
|
+
.dotContainer {
|
|
149
|
+
display: flex;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`
|
|
153
|
+
|
|
154
|
+
const DotWrapper = styled.div`
|
|
155
|
+
display: flex;
|
|
156
|
+
gap: 2px;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
`
|
|
159
|
+
|
|
160
|
+
const DotIcon = styled.div`
|
|
161
|
+
width: 4px;
|
|
162
|
+
height: 4px;
|
|
163
|
+
border-radius: 100%;
|
|
164
|
+
background-color: ${(props) => props.theme.colors.white};
|
|
165
|
+
`
|
|
166
|
+
|
|
167
|
+
const EditContainer = styled.div`
|
|
168
|
+
position: absolute;
|
|
169
|
+
z-index: 99;
|
|
170
|
+
top: 22px;
|
|
171
|
+
display: grid;
|
|
172
|
+
background-color: ${(props) => props.theme.colors.white};
|
|
173
|
+
border: 1px solid ${(props) => props.theme.colors.grey4};
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
`
|
|
178
|
+
|
|
179
|
+
const EditItem = styled.div`
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 12px;
|
|
183
|
+
color: ${(props) => props.theme.colors.black};
|
|
184
|
+
font-size: 13px;
|
|
185
|
+
padding: 4px 18px;
|
|
186
|
+
|
|
187
|
+
&:hover {
|
|
188
|
+
background-color: ${(props) => props.theme.colors.grey5};
|
|
189
|
+
}
|
|
190
|
+
`
|
|
191
|
+
|
|
192
|
+
const IconContainer = styled.div`
|
|
193
|
+
padding: 8px;
|
|
194
|
+
line-height: 0;
|
|
195
|
+
`
|
|
196
|
+
|
|
197
|
+
const Date = styled.div``
|
|
198
|
+
|
|
199
|
+
export default {
|
|
200
|
+
name: "project-marker",
|
|
201
|
+
components: {
|
|
202
|
+
PageContainer,
|
|
203
|
+
MarkerContainer,
|
|
204
|
+
DotWrapper,
|
|
205
|
+
DotIcon,
|
|
206
|
+
EditContainer,
|
|
207
|
+
EditItem,
|
|
208
|
+
DeleteIcon,
|
|
209
|
+
IconContainer,
|
|
210
|
+
Icon,
|
|
211
|
+
Modal,
|
|
212
|
+
ModalContainer,
|
|
213
|
+
CtaContainer,
|
|
214
|
+
PageTitle,
|
|
215
|
+
PageSubtitle,
|
|
216
|
+
MainButton,
|
|
217
|
+
Date
|
|
218
|
+
},
|
|
219
|
+
props: {
|
|
220
|
+
markerData: {
|
|
221
|
+
required: true
|
|
222
|
+
},
|
|
223
|
+
activeLanguage: {
|
|
224
|
+
required: true
|
|
225
|
+
},
|
|
226
|
+
date: {
|
|
227
|
+
required: false,
|
|
228
|
+
default: null
|
|
229
|
+
},
|
|
230
|
+
isEditable: {
|
|
231
|
+
required: false,
|
|
232
|
+
default: false
|
|
233
|
+
},
|
|
234
|
+
isGroupSupport: {
|
|
235
|
+
required: false,
|
|
236
|
+
default: false
|
|
237
|
+
},
|
|
238
|
+
isLimitedPartner: {
|
|
239
|
+
required: false,
|
|
240
|
+
default: false
|
|
241
|
+
},
|
|
242
|
+
cursor: {
|
|
243
|
+
required: false,
|
|
244
|
+
default: 'default'
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
data() {
|
|
248
|
+
return {
|
|
249
|
+
activated: false,
|
|
250
|
+
deleteModalOpened: false
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
computed: {
|
|
254
|
+
editionAllowed() {
|
|
255
|
+
return (this.markerData.can_be_deleted && (!this.isLimitedPartner || this.isGroupSupport)) && this.isEditable
|
|
256
|
+
},
|
|
257
|
+
iconName() {
|
|
258
|
+
if (this.markerData.choice === 'sold') {
|
|
259
|
+
return 'all_good'
|
|
260
|
+
} else if (this.markerData.choice === 'lost') {
|
|
261
|
+
return 'cross'
|
|
262
|
+
} else if (this.markerData.choice === 'transferred') {
|
|
263
|
+
return 'transfer'
|
|
264
|
+
} else {
|
|
265
|
+
return ''
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
methods: {
|
|
270
|
+
clickOutsideActionHandler() {
|
|
271
|
+
this.activated = false
|
|
272
|
+
},
|
|
273
|
+
closeDeleteModal() {
|
|
274
|
+
this.deleteModalOpened = false
|
|
275
|
+
},
|
|
276
|
+
onEditClick() {
|
|
277
|
+
this.$emit("editHandler")
|
|
278
|
+
},
|
|
279
|
+
onDelete() {
|
|
280
|
+
this.closeDeleteModal()
|
|
281
|
+
this.$emit("deleteHandler")
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</script>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<spinner-wrapper v-if="isLoading">
|
|
9
9
|
<spinner />
|
|
10
10
|
</spinner-wrapper>
|
|
11
|
-
<table-container v-else>
|
|
11
|
+
<table-container v-else :cellPaddings="cellPaddings">
|
|
12
12
|
<slot />
|
|
13
13
|
</table-container>
|
|
14
14
|
</table-wrapper>
|
|
@@ -63,7 +63,8 @@ const SpinnerWrapper = styled.div`
|
|
|
63
63
|
justify-items: center;
|
|
64
64
|
`
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const containerAttrs = { cellPaddings: String }
|
|
67
|
+
const TableContainer = styled("table", containerAttrs)`
|
|
67
68
|
width: 100%;
|
|
68
69
|
border-collapse: collapse;
|
|
69
70
|
border: none;
|
|
@@ -114,7 +115,7 @@ const TableContainer = styled.table`
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
td {
|
|
117
|
-
padding: 6px 6px 7px 4px;
|
|
118
|
+
padding: ${(props) => props.cellPaddings ? props.cellPaddings : "6px 6px 7px 4px" };
|
|
118
119
|
border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
|
|
119
120
|
|
|
120
121
|
&.empty {
|
|
@@ -352,6 +353,10 @@ export default {
|
|
|
352
353
|
required: false,
|
|
353
354
|
default: true,
|
|
354
355
|
},
|
|
356
|
+
cellPaddings: {
|
|
357
|
+
required: false,
|
|
358
|
+
default: '',
|
|
359
|
+
},
|
|
355
360
|
isLoading: {
|
|
356
361
|
required: false,
|
|
357
362
|
default: false,
|
|
@@ -4,9 +4,6 @@ export const stringToNumber = ({
|
|
|
4
4
|
allowNegative
|
|
5
5
|
}) => {
|
|
6
6
|
// This is for saving. It converts our input string to a readable number
|
|
7
|
-
if (value === undefined) {
|
|
8
|
-
value = ''
|
|
9
|
-
}
|
|
10
7
|
let newVal = value.toString()
|
|
11
8
|
const selectedLang = localStorage.getItem('lang')
|
|
12
9
|
// The first replace will replace not allowed characters with a blank
|
package/src/main.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import Vue from "vue"
|
|
2
2
|
import App from "./App.vue"
|
|
3
3
|
import VueCompositionAPI from "@vue/composition-api"
|
|
4
|
+
import vClickOutside from 'v-click-outside'
|
|
4
5
|
|
|
5
6
|
Vue.config.productionTip = false
|
|
6
7
|
|
|
7
8
|
Vue.use(VueCompositionAPI)
|
|
9
|
+
Vue.use(vClickOutside)
|
|
8
10
|
|
|
9
11
|
new Vue({
|
|
10
12
|
render: (h) => h(App),
|
|
Binary file
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect x="0.75" y="0.75" width="12.5" height="12.5" stroke="white" stroke-width="1.5"/>
|
|
3
|
-
<rect x="4.5" y="4.5" width="5" height="5" stroke="white" stroke-width="1.5"/>
|
|
4
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M4.51904 2H10.519V4H4.51904V2Z" fill="#555D61"/>
|
|
3
|
-
<path d="M4.51904 8H8.51904V10H4.51904V8Z" fill="#555D61"/>
|
|
4
|
-
<path d="M10.519 5.92321L13.4807 2.96161L10.519 0L10.519 5.92321Z" fill="#555D61"/>
|
|
5
|
-
<path d="M7.98391 8C7.29229 9.1956 5.99961 10 4.51904 10C2.3099 10 0.519043 8.20914 0.519043 6C0.519043 3.79086 2.3099 2 4.51904 2C5.99961 2 7.2923 2.8044 7.98391 4H4.51904C3.41447 4 2.51904 4.89543 2.51904 6C2.51904 7.10457 3.41447 8 4.51904 8H7.98391Z" fill="#555D61"/>
|
|
6
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M9.48096 2H3.48096V4H9.48096V2Z" fill="white"/>
|
|
3
|
-
<path d="M9.48096 8H5.48096V10H9.48096V8Z" fill="white"/>
|
|
4
|
-
<path d="M3.48096 5.92321L0.519349 2.96161L3.48096 0L3.48096 5.92321Z" fill="white"/>
|
|
5
|
-
<path d="M6.01609 8C6.70771 9.1956 8.00039 10 9.48096 10C11.6901 10 13.481 8.20914 13.481 6C13.481 3.79086 11.6901 2 9.48096 2C8.00039 2 6.7077 2.8044 6.01609 4H9.48096C10.5855 4 11.481 4.89543 11.481 6C11.481 7.10457 10.5855 8 9.48096 8H6.01609Z" fill="white"/>
|
|
6
|
-
</svg>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component-wrapper>
|
|
3
|
-
<text-overlay>
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</text-overlay>
|
|
6
|
-
</component-wrapper>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
// import InfoText from "@eturnity/eturnity_reusable_components/src/components/infoText"
|
|
11
|
-
//To use:
|
|
12
|
-
// <error-message
|
|
13
|
-
// alignText="right" // default is left
|
|
14
|
-
// />
|
|
15
|
-
|
|
16
|
-
import styled from 'vue-styled-components'
|
|
17
|
-
|
|
18
|
-
const TextOverlay = styled.div`
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: calc(100% + 13px);
|
|
21
|
-
background: ${(props) => props.theme.colors.red};
|
|
22
|
-
padding: 10px;
|
|
23
|
-
width: max-content;
|
|
24
|
-
max-width: 100%;
|
|
25
|
-
min-width: 200px;
|
|
26
|
-
font-size: 11px;
|
|
27
|
-
font-weight: 400;
|
|
28
|
-
border-radius: 4px;
|
|
29
|
-
font-family: 'Lato-Bold', Arial;
|
|
30
|
-
z-index: 99;
|
|
31
|
-
color: ${(props) => props.theme.colors.white};
|
|
32
|
-
|
|
33
|
-
:before {
|
|
34
|
-
content: '';
|
|
35
|
-
background-color: ${(props) => props.theme.colors.red};
|
|
36
|
-
position: absolute;
|
|
37
|
-
top: 2px;
|
|
38
|
-
left: 40px;
|
|
39
|
-
height: 11px;
|
|
40
|
-
width: 11px;
|
|
41
|
-
transform-origin: center center;
|
|
42
|
-
transform: translate(-2em, -0.5em) rotate(45deg);
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
const ComponentWrapper = styled.div`
|
|
47
|
-
display: block;
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
name: 'info-text',
|
|
52
|
-
components: {
|
|
53
|
-
TextOverlay,
|
|
54
|
-
ComponentWrapper
|
|
55
|
-
},
|
|
56
|
-
props: {},
|
|
57
|
-
methods: {},
|
|
58
|
-
data() {
|
|
59
|
-
return {}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Wrapper
|
|
3
|
-
:disabled="disabled"
|
|
4
|
-
:size="size"
|
|
5
|
-
:backgroundColor="backgroundColor"
|
|
6
|
-
:borderRadius="borderRadius"
|
|
7
|
-
:hoveredBackgroundColor="hoveredBackgroundColor">
|
|
8
|
-
<icon :disabled="disabled"
|
|
9
|
-
:size="iconSize"
|
|
10
|
-
:name="name"
|
|
11
|
-
:color="iconColor"
|
|
12
|
-
:hoveredColor="hoveredIconColor" />
|
|
13
|
-
<caret v-if="hasCaret">
|
|
14
|
-
<iconWrapper :disabled="disabled"
|
|
15
|
-
size="8px"
|
|
16
|
-
name="arrow_down"
|
|
17
|
-
:iconColor="iconColor"
|
|
18
|
-
:hoveredBackgroundColor="hoveredIconColor"
|
|
19
|
-
borderRadius="1px"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
</caret>
|
|
23
|
-
</Wrapper>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
|
28
|
-
// How to use:
|
|
29
|
-
//<icon
|
|
30
|
-
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
|
31
|
-
// color="red"
|
|
32
|
-
// hoveredColor="blue"
|
|
33
|
-
// size="60px" by default, this is 30px
|
|
34
|
-
// />
|
|
35
|
-
|
|
36
|
-
import styled from 'vue-styled-components'
|
|
37
|
-
import icon from '../icon'
|
|
38
|
-
const wrapperAttrs = { borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
|
|
39
|
-
const Wrapper = styled('div', wrapperAttrs)`
|
|
40
|
-
position:relative;
|
|
41
|
-
display: inline-flex;
|
|
42
|
-
width: ${(props) => props.size};
|
|
43
|
-
height: ${(props) => props.size};
|
|
44
|
-
justify-content:center;
|
|
45
|
-
align-items:center;
|
|
46
|
-
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
|
47
|
-
background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
|
48
|
-
border-radius: ${(props) => props.borderRadius};
|
|
49
|
-
|
|
50
|
-
&:hover{
|
|
51
|
-
background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
|
|
52
|
-
}
|
|
53
|
-
`
|
|
54
|
-
const caret=styled.div`
|
|
55
|
-
position:absolute;
|
|
56
|
-
bottom:3px;
|
|
57
|
-
right:2px;
|
|
58
|
-
height:10px;
|
|
59
|
-
`
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
name: 'iconWrapper',
|
|
63
|
-
components: {
|
|
64
|
-
Wrapper,
|
|
65
|
-
icon,
|
|
66
|
-
caret
|
|
67
|
-
},
|
|
68
|
-
props: {
|
|
69
|
-
disabled: {
|
|
70
|
-
required: false,
|
|
71
|
-
default: false
|
|
72
|
-
},
|
|
73
|
-
name: {
|
|
74
|
-
required: true
|
|
75
|
-
},
|
|
76
|
-
iconColor: {
|
|
77
|
-
required: false,
|
|
78
|
-
default: 'white'
|
|
79
|
-
},
|
|
80
|
-
hoveredIconColor: {
|
|
81
|
-
required: false
|
|
82
|
-
},
|
|
83
|
-
backgroundColor: {
|
|
84
|
-
required: false,
|
|
85
|
-
},
|
|
86
|
-
hoveredBackgroundColor: {
|
|
87
|
-
required: false,
|
|
88
|
-
default:"transparentWhite1"
|
|
89
|
-
},
|
|
90
|
-
size: {
|
|
91
|
-
required: false,
|
|
92
|
-
default: '32px'
|
|
93
|
-
},
|
|
94
|
-
iconSize:{
|
|
95
|
-
required: false,
|
|
96
|
-
default:'18px'
|
|
97
|
-
},
|
|
98
|
-
hasCaret:{
|
|
99
|
-
required: false,
|
|
100
|
-
default: false
|
|
101
|
-
},
|
|
102
|
-
borderRadius:{
|
|
103
|
-
required:false,
|
|
104
|
-
default:'6px'
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
data() {
|
|
108
|
-
return {}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
</script>
|