@eturnity/eturnity_reusable_components 8.19.0 → 8.19.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 +1 -1
- package/src/assets/svgIcons/add_plus.svg +4 -0
- package/src/assets/svgIcons/order.svg +3 -0
- package/src/components/buttons/mainButton/MainButton.stories.js +13 -0
- package/src/components/buttons/mainButton/index.vue +35 -0
- package/src/components/inputs/inputText/index.vue +19 -4
- package/src/components/inputs/select/index.vue +28 -4
- package/src/components/paginationV2/index.vue +175 -0
- package/src/components/tabsHeader/index.vue +43 -13
- package/src/helpers/toLocaleNumber.js +11 -0
package/package.json
CHANGED
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4H14V6H2V4ZM2 8V12H14V8H2ZM1 4C1 3.44772 1.44772 3 2 3H14C14.5523 3 15 3.44772 15 4V12C15 12.5523 14.5523 13 14 13H2C1.44772 13 1 12.5523 1 12V4Z" fill="#263238"/>
|
3
|
+
</svg>
|
@@ -4,6 +4,9 @@ export default {
|
|
4
4
|
title: 'MainButton',
|
5
5
|
component: MainButton,
|
6
6
|
tags: ['autodocs'],
|
7
|
+
parameters: {
|
8
|
+
layout: 'centered',
|
9
|
+
},
|
7
10
|
}
|
8
11
|
|
9
12
|
export const DefaultButton = {
|
@@ -49,3 +52,13 @@ export const IconButton = {
|
|
49
52
|
customColor: '#fdb813',
|
50
53
|
},
|
51
54
|
}
|
55
|
+
|
56
|
+
export const IconAltDesignButton = {
|
57
|
+
args: {
|
58
|
+
text: 'Click me',
|
59
|
+
icon: 'bell',
|
60
|
+
type: 'primary',
|
61
|
+
iconAltStyle: true,
|
62
|
+
iconAltStyleColor: '#f2f2f2',
|
63
|
+
},
|
64
|
+
}
|
@@ -90,6 +90,7 @@
|
|
90
90
|
${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
|
91
91
|
${(props) => (props.noWrap ? `white-space: nowrap;` : '')};
|
92
92
|
height: ${(props) => props.height};
|
93
|
+
line-height: 1;
|
93
94
|
|
94
95
|
&:hover {
|
95
96
|
background-color: ${(props) =>
|
@@ -110,6 +111,30 @@
|
|
110
111
|
}
|
111
112
|
`
|
112
113
|
|
114
|
+
const AltAttrs = {
|
115
|
+
altStyle: Boolean,
|
116
|
+
color: String,
|
117
|
+
}
|
118
|
+
|
119
|
+
const IconContainer = styled('div', AltAttrs)`
|
120
|
+
background-color: ${(props) =>
|
121
|
+
props.color ? props.color : props.theme.colors.transparentWhite1};
|
122
|
+
padding: 7px;
|
123
|
+
height: 100%;
|
124
|
+
width: 30%;
|
125
|
+
justify-content: center;
|
126
|
+
display: flex;
|
127
|
+
align-items: center;
|
128
|
+
border-radius: 4px 0 0 4px;
|
129
|
+
color: ${(props) => props.theme.colors.white};
|
130
|
+
all: ${(props) => (props.altStyle ? '' : 'unset')};
|
131
|
+
`
|
132
|
+
|
133
|
+
const TextContainer = styled('span', AltAttrs)`
|
134
|
+
padding: ${(props) => (props.altStyle ? '7px' : '0')};
|
135
|
+
all: ${(props) => (props.altStyle ? '' : 'unset')};
|
136
|
+
`
|
137
|
+
|
113
138
|
const LabelAttrs = {
|
114
139
|
hasIcon: Boolean,
|
115
140
|
}
|
@@ -155,6 +180,16 @@
|
|
155
180
|
default: '',
|
156
181
|
type: String,
|
157
182
|
},
|
183
|
+
iconAltStyle: {
|
184
|
+
required: false,
|
185
|
+
default: false,
|
186
|
+
type: Boolean,
|
187
|
+
},
|
188
|
+
iconAltStyleColor: {
|
189
|
+
required: false,
|
190
|
+
default: null,
|
191
|
+
type: String,
|
192
|
+
},
|
158
193
|
text: {
|
159
194
|
required: true,
|
160
195
|
type: String,
|
@@ -68,7 +68,17 @@
|
|
68
68
|
<Icon name="current_variant" size="20px" />
|
69
69
|
</IconWrapper>
|
70
70
|
<IconWrapper v-if="hasError" data-test-id="error_wrapper" size="16px">
|
71
|
-
<
|
71
|
+
<InfoText
|
72
|
+
v-if="infoErrorMessage != ''"
|
73
|
+
:align-arrow="infoTextAlign"
|
74
|
+
:app-theme="appTheme"
|
75
|
+
button-type="error"
|
76
|
+
data-test-id="info_text_message"
|
77
|
+
icon-name="warning"
|
78
|
+
:size="fontSize ? fontSize : '16px'"
|
79
|
+
:text="infoErrorMessage"
|
80
|
+
/>
|
81
|
+
<Icon v-else cursor="default" name="warning" size="16px" />
|
72
82
|
</IconWrapper>
|
73
83
|
<IconWrapper
|
74
84
|
v-if="iconName && !hasError && inputType !== 'password'"
|
@@ -148,10 +158,10 @@
|
|
148
158
|
}
|
149
159
|
const InputContainer = styled('input', inputProps)`
|
150
160
|
border: ${(props) =>
|
151
|
-
props.
|
152
|
-
? '1px solid ' + props.theme.colors.red
|
153
|
-
: props.noBorder
|
161
|
+
props.noBorder
|
154
162
|
? 'none'
|
163
|
+
: props.isError
|
164
|
+
? '1px solid ' + props.theme.colors.red
|
155
165
|
: props.borderColor
|
156
166
|
? props.theme.colors[props.borderColor]
|
157
167
|
? '1px solid ' + props.theme.colors[props.borderColor]
|
@@ -410,6 +420,11 @@
|
|
410
420
|
default: '',
|
411
421
|
type: String,
|
412
422
|
},
|
423
|
+
infoErrorMessage: {
|
424
|
+
required: false,
|
425
|
+
default: '',
|
426
|
+
type: String,
|
427
|
+
},
|
413
428
|
},
|
414
429
|
data() {
|
415
430
|
return {
|
@@ -8,7 +8,9 @@
|
|
8
8
|
<InputWrapper
|
9
9
|
:align-items="alignItems"
|
10
10
|
:has-label="!!label && label.length > 0"
|
11
|
+
:min-width="minWidth"
|
11
12
|
:no-relative="noRelative"
|
13
|
+
:text-center="textCenter"
|
12
14
|
>
|
13
15
|
<LabelWrapper
|
14
16
|
v-if="label"
|
@@ -43,7 +45,9 @@
|
|
43
45
|
<SelectButton
|
44
46
|
ref="select"
|
45
47
|
:bg-color="
|
46
|
-
buttonBgColor
|
48
|
+
buttonBgColor
|
49
|
+
? buttonBgColor
|
50
|
+
: colorMode == 'dark'
|
47
51
|
? 'transparentBlack1'
|
48
52
|
: colorMode == 'transparent'
|
49
53
|
? 'transparent'
|
@@ -72,6 +76,7 @@
|
|
72
76
|
:show-border="showBorder"
|
73
77
|
:show-disabled-background="showDisabledBackground"
|
74
78
|
:table-padding-left="tablePaddingLeft"
|
79
|
+
:text-center="textCenter"
|
75
80
|
@click="toggleDropdown"
|
76
81
|
@keydown="onKeyDown"
|
77
82
|
>
|
@@ -109,7 +114,12 @@
|
|
109
114
|
>
|
110
115
|
<slot name="selector" :selected-value="selectedValue"></slot>
|
111
116
|
</Selector>
|
112
|
-
<Caret
|
117
|
+
<Caret
|
118
|
+
v-if="showCaret"
|
119
|
+
class="caret_dropdown"
|
120
|
+
:color-mode="colorMode"
|
121
|
+
@click.stop="toggleCaretDropdown"
|
122
|
+
>
|
113
123
|
<Icon
|
114
124
|
v-if="isDropdownOpen"
|
115
125
|
:color="
|
@@ -284,11 +294,13 @@
|
|
284
294
|
selectWidth: String,
|
285
295
|
optionWidth: String,
|
286
296
|
noRelative: Boolean,
|
297
|
+
textCenter: Boolean,
|
287
298
|
}
|
288
299
|
const Container = styled('div', inputProps)`
|
289
300
|
width: ${(props) => props.selectWidth};
|
290
301
|
position: ${(props) => (props.noRelative ? 'static' : 'relative')};
|
291
302
|
display: inline-block;
|
303
|
+
text-align: ${(props) => (props.textCenter ? 'center' : 'left')};
|
292
304
|
`
|
293
305
|
|
294
306
|
const LabelWrapperAttrs = { infoTextMessage: Boolean }
|
@@ -325,6 +337,7 @@
|
|
325
337
|
showDisabledBackground: Boolean,
|
326
338
|
colorMode: String,
|
327
339
|
isSearchBarVisible: Boolean,
|
340
|
+
textCenter: Boolean,
|
328
341
|
}
|
329
342
|
const SelectButton = styled('div', selectButtonAttrs)`
|
330
343
|
position: ${(props) => (props.noRelative ? 'static' : 'relative')};
|
@@ -345,7 +358,7 @@
|
|
345
358
|
? props.tablePaddingLeft
|
346
359
|
: props.paddingLeft
|
347
360
|
}`};
|
348
|
-
text-align: left;
|
361
|
+
text-align: ${(props) => (props.textCenter ? 'center' : 'left')};
|
349
362
|
min-height: ${(props) =>
|
350
363
|
props.selectHeight
|
351
364
|
? props.selectHeight
|
@@ -373,7 +386,7 @@
|
|
373
386
|
? props.theme.colors.grey5
|
374
387
|
: props.theme.colors[props.bgColor]
|
375
388
|
? props.theme.colors[props.bgColor]
|
376
|
-
: props.bgColor};
|
389
|
+
: props.bgColor} !important;
|
377
390
|
color: ${(props) =>
|
378
391
|
props.colorMode === 'transparent'
|
379
392
|
? props.theme.colors.white
|
@@ -454,6 +467,7 @@
|
|
454
467
|
const inputAttrs = {
|
455
468
|
alignItems: String,
|
456
469
|
hasLabel: Boolean,
|
470
|
+
minWidth: String,
|
457
471
|
noRelative: Boolean,
|
458
472
|
}
|
459
473
|
const InputWrapper = styled('div', inputAttrs)`
|
@@ -661,6 +675,16 @@
|
|
661
675
|
type: String,
|
662
676
|
required: false,
|
663
677
|
},
|
678
|
+
showCaret: {
|
679
|
+
type: Boolean,
|
680
|
+
required: false,
|
681
|
+
default: true,
|
682
|
+
},
|
683
|
+
textCenter: {
|
684
|
+
type: Boolean,
|
685
|
+
required: false,
|
686
|
+
default: false,
|
687
|
+
},
|
664
688
|
isFixedDropdownPosition: {
|
665
689
|
type: Boolean,
|
666
690
|
required: false,
|
@@ -0,0 +1,175 @@
|
|
1
|
+
<template>
|
2
|
+
<!-- Check, if pages more than 1 -->
|
3
|
+
<PaginationWrapper v-if="paginationParams.pages > 1">
|
4
|
+
<PaginationLink v-if="paginationParams.previous" @click="fetchPage(1)">
|
5
|
+
<ArrowIconContainer>
|
6
|
+
<RCIcon name="start_of_the_list" size="14px" />
|
7
|
+
</ArrowIconContainer>
|
8
|
+
</PaginationLink>
|
9
|
+
|
10
|
+
<PaginationLink
|
11
|
+
v-if="paginationParams.previous"
|
12
|
+
@click="fetchPage(paginationParams.previous)"
|
13
|
+
>
|
14
|
+
<ArrowIconContainer>
|
15
|
+
<RCIcon name="arrow_left" size="14px" />
|
16
|
+
</ArrowIconContainer>
|
17
|
+
</PaginationLink>
|
18
|
+
|
19
|
+
<!-- Current block -->
|
20
|
+
<SelectWrapper>
|
21
|
+
<RCSelect
|
22
|
+
:button-font-color="getTheme.colors.gray1"
|
23
|
+
:dropdown-font-color="getTheme.colors.gray1"
|
24
|
+
font-size="14px"
|
25
|
+
:has-select-button-padding="false"
|
26
|
+
:is-auto-search="false"
|
27
|
+
:is-searchable="false"
|
28
|
+
:label-font-color="getTheme.colors.gray1"
|
29
|
+
left-padding="0px"
|
30
|
+
min-width="0px"
|
31
|
+
no-border
|
32
|
+
:no-max-width="true"
|
33
|
+
option-width="75px"
|
34
|
+
select-width="100%"
|
35
|
+
:show-border="false"
|
36
|
+
:show-caret="false"
|
37
|
+
text-center
|
38
|
+
:value="currentPage"
|
39
|
+
@input-change="fetchPage($event)"
|
40
|
+
>
|
41
|
+
<template #selector>
|
42
|
+
<SelectText>
|
43
|
+
{{ currentPage }} of {{ paginationParams.pages }}
|
44
|
+
</SelectText>
|
45
|
+
</template>
|
46
|
+
<template #dropdown>
|
47
|
+
<RCOption
|
48
|
+
v-for="number in paginationNumbers()"
|
49
|
+
:key="number"
|
50
|
+
text-center
|
51
|
+
:value="number"
|
52
|
+
>
|
53
|
+
{{ number }}
|
54
|
+
</RCOption>
|
55
|
+
</template>
|
56
|
+
</RCSelect>
|
57
|
+
</SelectWrapper>
|
58
|
+
|
59
|
+
<!-- Forward button -->
|
60
|
+
<PaginationLink
|
61
|
+
v-if="paginationParams.next"
|
62
|
+
@click="fetchPage(paginationParams.next)"
|
63
|
+
>
|
64
|
+
<ArrowIconContainer>
|
65
|
+
<RCIcon name="arrow_right" size="14px" />
|
66
|
+
</ArrowIconContainer>
|
67
|
+
</PaginationLink>
|
68
|
+
<PaginationLink
|
69
|
+
v-if="paginationParams.next"
|
70
|
+
@click="fetchPage(paginationParams.pages)"
|
71
|
+
>
|
72
|
+
<ArrowIconContainer>
|
73
|
+
<RCIcon name="end_of_the_list" size="14px" />
|
74
|
+
</ArrowIconContainer>
|
75
|
+
</PaginationLink>
|
76
|
+
</PaginationWrapper>
|
77
|
+
</template>
|
78
|
+
|
79
|
+
<script>
|
80
|
+
import styled from 'vue3-styled-components'
|
81
|
+
import RCIcon from '../icon'
|
82
|
+
import RCSelect from '../inputs/select'
|
83
|
+
import RCOption from '../inputs/select/option'
|
84
|
+
import theme from '@/assets/theme.js'
|
85
|
+
|
86
|
+
const PaginationWrapper = styled.nav`
|
87
|
+
gap: 5px;
|
88
|
+
font-size: 13px;
|
89
|
+
display: flex;
|
90
|
+
flex-wrap: wrap;
|
91
|
+
justify-content: flex-end;
|
92
|
+
align-items: center;
|
93
|
+
`
|
94
|
+
const PaginationLink = styled.div`
|
95
|
+
display: flex;
|
96
|
+
padding: 0px 5px;
|
97
|
+
margin: 0 2px;
|
98
|
+
text-align: center;
|
99
|
+
border-radius: 3px;
|
100
|
+
white-space: nowrap;
|
101
|
+
cursor: pointer;
|
102
|
+
color: ${(props) => props.theme.colors.brightBlue};
|
103
|
+
|
104
|
+
&.active {
|
105
|
+
color: ${(props) => props.theme.colors.white};
|
106
|
+
background-color: ${(props) => props.theme.colors.brightBlue};
|
107
|
+
padding: 7px 12px;
|
108
|
+
border-radius: 4px;
|
109
|
+
}
|
110
|
+
`
|
111
|
+
const ArrowIconContainer = styled.div`
|
112
|
+
display: flex;
|
113
|
+
align-items: center;
|
114
|
+
`
|
115
|
+
|
116
|
+
const SelectText = styled.div`
|
117
|
+
font-size: 14px;
|
118
|
+
color: ${(props) => props.theme.colors.grey1};
|
119
|
+
`
|
120
|
+
|
121
|
+
const SelectWrapper = styled.div`
|
122
|
+
display: flex;
|
123
|
+
align-items: center;
|
124
|
+
width: 75px;
|
125
|
+
`
|
126
|
+
|
127
|
+
export default {
|
128
|
+
name: 'PaginationV2',
|
129
|
+
components: {
|
130
|
+
PaginationWrapper,
|
131
|
+
PaginationLink,
|
132
|
+
RCIcon,
|
133
|
+
RCSelect,
|
134
|
+
RCOption,
|
135
|
+
SelectWrapper,
|
136
|
+
SelectText,
|
137
|
+
ArrowIconContainer,
|
138
|
+
},
|
139
|
+
props: {
|
140
|
+
fetchPage: {
|
141
|
+
type: Function,
|
142
|
+
required: true,
|
143
|
+
},
|
144
|
+
currentPage: {
|
145
|
+
type: Number,
|
146
|
+
required: true,
|
147
|
+
},
|
148
|
+
paginationParams: {
|
149
|
+
type: Object,
|
150
|
+
required: true,
|
151
|
+
},
|
152
|
+
},
|
153
|
+
data() {
|
154
|
+
return {
|
155
|
+
selectedValue: this.currentPage,
|
156
|
+
}
|
157
|
+
},
|
158
|
+
computed: {
|
159
|
+
getTheme() {
|
160
|
+
return theme
|
161
|
+
},
|
162
|
+
},
|
163
|
+
methods: {
|
164
|
+
getNewProjects(num) {
|
165
|
+
this.$emit('on-pagination-change', num)
|
166
|
+
},
|
167
|
+
paginationNumbers() {
|
168
|
+
return Array.from(
|
169
|
+
{ length: this.paginationParams.pages },
|
170
|
+
(_, i) => i + 1
|
171
|
+
)
|
172
|
+
},
|
173
|
+
},
|
174
|
+
}
|
175
|
+
</script>
|
@@ -4,10 +4,15 @@
|
|
4
4
|
<TabItem
|
5
5
|
v-for="item in tabsData"
|
6
6
|
:key="item.id"
|
7
|
+
:full-size="fullSize"
|
7
8
|
:is-active="activeTab === item.id"
|
8
9
|
@click="onTabClick({ id: item.id })"
|
9
10
|
>
|
10
|
-
<
|
11
|
+
<NameContainer>
|
12
|
+
<div>{{ item.text }}</div>
|
13
|
+
<DotIcon v-if="item.subText" :is-active="activeTab === item.id" />
|
14
|
+
<SubText v-if="item.subText">{{ item.subText }}</SubText>
|
15
|
+
</NameContainer>
|
11
16
|
<RCIcon v-if="item.hasError" name="warning" size="14px" />
|
12
17
|
</TabItem>
|
13
18
|
</TabsContainer>
|
@@ -35,34 +40,51 @@
|
|
35
40
|
import styled from 'vue3-styled-components'
|
36
41
|
import RCIcon from '../icon'
|
37
42
|
|
43
|
+
const NameContainer = styled.div`
|
44
|
+
display: flex;
|
45
|
+
align-items: center;
|
46
|
+
justify-content: center;
|
47
|
+
gap: 8px;
|
48
|
+
`
|
49
|
+
|
50
|
+
const DotIconAttrs = { isActive: Boolean }
|
51
|
+
const DotIcon = styled('div', DotIconAttrs)`
|
52
|
+
width: 4px;
|
53
|
+
height: 4px;
|
54
|
+
border-radius: 100%;
|
55
|
+
background-color: ${(props) =>
|
56
|
+
props.isActive ? props.theme.colors.purple6 : props.theme.colors.black};
|
57
|
+
`
|
58
|
+
|
59
|
+
const SubText = styled.div`
|
60
|
+
font-size: 12px;
|
61
|
+
color: ${(props) => props.theme.colors.black};
|
62
|
+
`
|
63
|
+
|
38
64
|
const PageContainer = styled.div``
|
39
65
|
|
40
66
|
const TabsContainer = styled.div`
|
41
67
|
display: flex;
|
42
68
|
cursor: pointer;
|
43
69
|
width: 100%;
|
70
|
+
|
71
|
+
border-bottom: 1px solid ${(props) => props.theme.colors.purple7};
|
44
72
|
`
|
45
73
|
|
46
|
-
const TabAttrs = { isActive: Boolean }
|
74
|
+
const TabAttrs = { isActive: Boolean, fullSize: Boolean }
|
47
75
|
const TabItem = styled('div', TabAttrs)`
|
48
76
|
display: flex;
|
49
77
|
align-items: center;
|
50
78
|
justify-content: center;
|
51
79
|
gap: 8px;
|
52
|
-
padding: 10px
|
80
|
+
padding: 10px 25px;
|
53
81
|
font-size: 14px;
|
54
|
-
font-weight:
|
55
|
-
background-color: ${(props) =>
|
56
|
-
props.isActive ? props.theme.colors.secondary : props.theme.colors.white};
|
82
|
+
font-weight: 400;
|
57
83
|
color: ${(props) =>
|
58
|
-
props.isActive
|
59
|
-
? props.theme.colors.brightBlue
|
60
|
-
: props.theme.colors.black};
|
84
|
+
props.isActive ? props.theme.colors.purple6 : props.theme.colors.black};
|
61
85
|
border-bottom: ${(props) =>
|
62
|
-
props.isActive
|
63
|
-
|
64
|
-
: '1px solid' + props.theme.colors.grey4};
|
65
|
-
flex-grow: 1;
|
86
|
+
props.isActive ? '1px solid' + props.theme.colors.purple6 : 'unset'};
|
87
|
+
flex-grow: ${(props) => (props.fullSize ? 1 : 0)};
|
66
88
|
`
|
67
89
|
|
68
90
|
export default {
|
@@ -70,7 +92,10 @@
|
|
70
92
|
components: {
|
71
93
|
PageContainer,
|
72
94
|
TabsContainer,
|
95
|
+
NameContainer,
|
73
96
|
TabItem,
|
97
|
+
SubText,
|
98
|
+
DotIcon,
|
74
99
|
RCIcon,
|
75
100
|
},
|
76
101
|
props: {
|
@@ -82,7 +107,12 @@
|
|
82
107
|
required: true,
|
83
108
|
type: Number,
|
84
109
|
},
|
110
|
+
fullSize: {
|
111
|
+
type: Boolean,
|
112
|
+
default: true,
|
113
|
+
},
|
85
114
|
},
|
115
|
+
emits: ['on-tab-change'],
|
86
116
|
methods: {
|
87
117
|
onTabClick({ id }) {
|
88
118
|
if (id === this.activeTab) {
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { langForLocaleString } from './translateLang'
|
2
|
+
|
3
|
+
export const toLocaleNumber = (value, digit = 0) => {
|
4
|
+
if (isNaN(value)) {
|
5
|
+
return '-'
|
6
|
+
}
|
7
|
+
return new Intl.NumberFormat(langForLocaleString(), {
|
8
|
+
minimumFractionDigits: digit,
|
9
|
+
maximumFractionDigits: digit,
|
10
|
+
}).format(value)
|
11
|
+
}
|