@eturnity/eturnity_reusable_components 1.2.53 → 1.2.55
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/components/inputs/checkbox/index.vue +1 -1
- package/src/components/inputs/select/index.vue +77 -46
- package/src/components/inputs/select/option/index.vue +6 -7
- package/src/components/inputs/textAreaInput/index.vue +35 -28
- package/src/components/tables/mainTable/index.vue +3 -1
package/package.json
CHANGED
@@ -49,7 +49,7 @@ const containerAttrs = {
|
|
49
49
|
}
|
50
50
|
const Container = styled('label', containerAttrs)`
|
51
51
|
display: grid;
|
52
|
-
grid-template-columns: ${(props) => (props.hasLabel ? '
|
52
|
+
grid-template-columns: ${(props) => (props.hasLabel ? '16px auto' : '16px')};
|
53
53
|
grid-gap: 16px;
|
54
54
|
align-content: center;
|
55
55
|
color: ${(props) => props.theme.colors.black};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<template>
|
2
|
-
<Container
|
3
|
-
:selectWidth="selectWidth"
|
2
|
+
<Container
|
3
|
+
:selectWidth="selectWidth"
|
4
4
|
@mouseenter="mouseEnterHandler"
|
5
5
|
@mouseleave="mouseLeaveHandler"
|
6
6
|
>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
:alignItems="alignItems"
|
10
10
|
>
|
11
11
|
<label-wrapper v-if="label" >
|
12
|
-
<input-label
|
12
|
+
<input-label
|
13
13
|
:fontColor="labelFontColor || colorMode=='dark'?'white':'eturnityGrey'"
|
14
14
|
:fontSize="fontSize">{{ label }}</input-label>
|
15
15
|
<info-text
|
@@ -20,36 +20,39 @@
|
|
20
20
|
:alignText="infoTextAlign"
|
21
21
|
/>
|
22
22
|
</label-wrapper>
|
23
|
-
<
|
24
|
-
<selectButton
|
23
|
+
<select-button-wrapper :disabled="disabled">
|
24
|
+
<selectButton
|
25
25
|
ref="select"
|
26
26
|
@click="toggleDropdown"
|
27
|
-
:isActive="isActive"
|
28
27
|
:selectHeight="selectHeight"
|
29
28
|
:bgColor="buttonBgColor || colorMode=='dark'?'transparentBlack1':'white'"
|
30
29
|
:fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
|
30
|
+
:hasError="hasError"
|
31
|
+
:isSearchBarVisible="isSearchBarVisible"
|
32
|
+
:disabled="disabled"
|
31
33
|
@keydown.native="onKeyDown"
|
32
34
|
>
|
33
|
-
<inputText
|
35
|
+
<inputText
|
34
36
|
v-if="isSearchBarVisible"
|
35
37
|
ref="searchInput"
|
36
38
|
tabindex="0"
|
37
39
|
:noBorder="true"
|
38
|
-
:
|
40
|
+
:fontSize="fontSize"
|
39
41
|
backgroundColor="transparent"
|
40
42
|
:fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
|
41
|
-
:value="textSearch"
|
43
|
+
:value="textSearch"
|
42
44
|
@keydown.stop="onKeyDown"
|
43
45
|
@input-change="searchChange" />
|
44
|
-
<
|
46
|
+
<selector v-else>
|
45
47
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
46
|
-
</
|
47
|
-
<Caret
|
48
|
-
<icon name="arrow_up" size="12px" :color="caretColor || colorMode=='dark'?'white':'transparentBlack1'"/>
|
48
|
+
</selector>
|
49
|
+
<Caret @click.stop="toggleCaretDropdown" >
|
50
|
+
<icon v-if="isDropdownOpen" name="arrow_up" size="12px" :color="caretColor || colorMode=='dark'?'white':'transparentBlack1'"/>
|
51
|
+
<icon v-else name="arrow_down" size="12px" :color="caretColor || colorMode=='dark'?'white':'transparentBlack1'"/>
|
49
52
|
</Caret>
|
50
53
|
</selectButton>
|
51
54
|
<DropdownWrapper>
|
52
|
-
<selectDropdown
|
55
|
+
<selectDropdown
|
53
56
|
ref="dropdown"
|
54
57
|
v-show="isDropdownOpen"
|
55
58
|
:hoveredIndex="hoveredIndex"
|
@@ -63,14 +66,14 @@
|
|
63
66
|
<slot name="dropdown"></slot>
|
64
67
|
</selectDropdown>
|
65
68
|
</DropdownWrapper>
|
66
|
-
</
|
67
|
-
</input-wrapper>
|
69
|
+
</select-button-wrapper>
|
70
|
+
</input-wrapper>
|
68
71
|
</Container>
|
69
72
|
</template>
|
70
|
-
|
73
|
+
|
71
74
|
<script>
|
72
75
|
//How to use it
|
73
|
-
// <Select
|
76
|
+
// <Select
|
74
77
|
// hoverDropdown="true"
|
75
78
|
// selectWidth="100%"
|
76
79
|
// optionWidth="50%"
|
@@ -86,24 +89,28 @@
|
|
86
89
|
// <Option value="3">value three</Option>
|
87
90
|
// <Option value="4">value four</Option>
|
88
91
|
// </template>
|
89
|
-
// </Select>
|
90
|
-
|
92
|
+
// </Select>
|
93
|
+
|
91
94
|
import styled from 'vue-styled-components'
|
92
95
|
import InfoText from '../../infoText'
|
93
96
|
import icon from '../../icon'
|
94
97
|
import inputText from '../inputText'
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
top
|
104
|
-
|
105
|
-
|
106
|
-
|
98
|
+
|
99
|
+
const Caret = styled.div`
|
100
|
+
display: flex;
|
101
|
+
align-items: center;
|
102
|
+
justify-content: center;
|
103
|
+
width: 30px;
|
104
|
+
min-width: 30px;
|
105
|
+
height: 100%;
|
106
|
+
padding-top: 5px;
|
107
|
+
cursor: pointer;
|
108
|
+
margin-left: auto;
|
109
|
+
`
|
110
|
+
|
111
|
+
const Selector = styled.div`
|
112
|
+
width: 100%;
|
113
|
+
`
|
107
114
|
|
108
115
|
const labelAttrs = { fontSize: String }
|
109
116
|
const InputLabel = styled('div', labelAttrs)`
|
@@ -124,23 +131,37 @@ const LabelWrapper = styled.div`
|
|
124
131
|
align-items: center;
|
125
132
|
justify-content: start;
|
126
133
|
`
|
127
|
-
|
134
|
+
|
135
|
+
const SelectButtonWrapperAttrs = {
|
136
|
+
disabled: Boolean
|
137
|
+
}
|
138
|
+
const SelectButtonWrapper = styled('div', SelectButtonWrapperAttrs)`
|
139
|
+
${(props) => props.disabled ? 'cursor: not-allowed' : '' };
|
140
|
+
`
|
141
|
+
|
142
|
+
const selectButtonAttrs={
|
143
|
+
bgColor: String,
|
144
|
+
fontColor: String,
|
145
|
+
hasError: Boolean,
|
146
|
+
disabled: Boolean,
|
147
|
+
selectHeight: String,
|
148
|
+
isSearchBarVisible: Boolean
|
149
|
+
}
|
128
150
|
const selectButton = styled('div',selectButtonAttrs)`
|
129
151
|
position:relative;
|
130
152
|
box-sizing: border-box;
|
131
|
-
border:1px solid red;
|
132
153
|
border-radius:4px;
|
133
|
-
padding:0px 10px;
|
154
|
+
padding: ${(props) => props.isSearchBarVisible ? '0 10px 0 0' : '0px 10px' };
|
134
155
|
text-align:left;
|
135
156
|
border-radius:4px;
|
136
157
|
min-height:36px;
|
137
|
-
display:
|
138
|
-
grid-template-columns:auto 40px;
|
158
|
+
display: flex;
|
139
159
|
align-items: center;
|
140
160
|
max-height:${props=>props.selectHeight};
|
141
|
-
border:1px solid ${(props)=>props.theme.colors.grey4}
|
142
|
-
background-color:${(props) => props.theme.colors[props.bgColor]?props.theme.colors[props.bgColor]:props.bgColor};
|
161
|
+
border:1px solid ${(props) => props.hasError ? props.theme.colors.red : props.theme.colors.grey4}
|
162
|
+
background-color:${(props) => props.disabled ? props.theme.colors.grey5 : props.theme.colors[props.bgColor] ? props.theme.colors[props.bgColor] : props.bgColor};
|
143
163
|
color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
|
164
|
+
${(props) => props.disabled ? 'pointer-events: none' : '' };
|
144
165
|
`
|
145
166
|
const selectDropdownAttrs={bgColor:String,fontColor:String,selectWidth: String, optionWidth: String,hoveredIndex:Number,selectedValue:Number | String}
|
146
167
|
const selectDropdown = styled('div',selectDropdownAttrs)`
|
@@ -182,7 +203,7 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
182
203
|
`
|
183
204
|
export default {
|
184
205
|
name: 'RCselect',
|
185
|
-
|
206
|
+
|
186
207
|
props: {
|
187
208
|
value:{
|
188
209
|
required:false,
|
@@ -247,14 +268,23 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
247
268
|
required:false,
|
248
269
|
default:true
|
249
270
|
},
|
271
|
+
hasError: {
|
272
|
+
required: false,
|
273
|
+
default: false
|
274
|
+
},
|
275
|
+
disabled: {
|
276
|
+
required: false,
|
277
|
+
default: false
|
278
|
+
},
|
250
279
|
isAutoSearch:{
|
251
280
|
required:false,
|
252
281
|
default:true
|
253
282
|
}
|
254
283
|
},
|
255
|
-
|
284
|
+
|
256
285
|
components: {
|
257
286
|
selectButton,
|
287
|
+
SelectButtonWrapper,
|
258
288
|
selectDropdown,
|
259
289
|
Container,
|
260
290
|
InputLabel,
|
@@ -264,9 +294,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
264
294
|
DropdownWrapper,
|
265
295
|
icon,
|
266
296
|
Caret,
|
297
|
+
Selector,
|
267
298
|
inputText
|
268
299
|
},
|
269
|
-
|
300
|
+
|
270
301
|
data() {
|
271
302
|
return {
|
272
303
|
selectedValue: null,
|
@@ -293,10 +324,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
293
324
|
},
|
294
325
|
toggleDropdown(){
|
295
326
|
if(this.isSearchBarVisible){return}
|
296
|
-
this.isDropdownOpen=!this.isDropdownOpen
|
327
|
+
this.isDropdownOpen=!this.isDropdownOpen
|
297
328
|
},
|
298
329
|
toggleCaretDropdown(){
|
299
|
-
this.isDropdownOpen=!this.isDropdownOpen
|
330
|
+
this.isDropdownOpen=!this.isDropdownOpen
|
300
331
|
},
|
301
332
|
openDropdown(){
|
302
333
|
this.focus()
|
@@ -356,7 +387,7 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
356
387
|
const optionHoveredComponent=this.$refs.dropdown.$children[(this.hoveredIndex-1+this.optionLength)%this.optionLength]
|
357
388
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
358
389
|
}
|
359
|
-
|
390
|
+
|
360
391
|
},
|
361
392
|
onArrowPress(dir){
|
362
393
|
this.hoveredIndex=((this.hoveredIndex+dir+this.optionLength-1)%this.optionLength)+1
|
@@ -382,6 +413,7 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
382
413
|
this.selectedValue=val
|
383
414
|
},
|
384
415
|
isDropdownOpen(val){
|
416
|
+
this.$emit('is-dropdown-open', val)
|
385
417
|
if(val){
|
386
418
|
setTimeout(()=>{
|
387
419
|
this.isClickOutsideActive=true
|
@@ -398,4 +430,3 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
398
430
|
}
|
399
431
|
}
|
400
432
|
</script>
|
401
|
-
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<slot></slot>
|
4
4
|
</optionContainer>
|
5
5
|
</template>
|
6
|
-
|
6
|
+
|
7
7
|
<script>
|
8
8
|
// import selectButton from './selectButton'
|
9
9
|
// import selectDropdown from './selectDropDown'
|
@@ -15,7 +15,7 @@
|
|
15
15
|
flex-direction: row;
|
16
16
|
justify-content: space-between;
|
17
17
|
align-items: center;
|
18
|
-
padding: 12px
|
18
|
+
padding: 12px 10px;
|
19
19
|
gap: 14px;
|
20
20
|
width:100%;
|
21
21
|
box-sizing:inherit;
|
@@ -23,10 +23,10 @@
|
|
23
23
|
background-color:${(props) => props.theme.colors[props.hoveredBgColor]?props.theme.colors[props.hoveredBgColor]:props.hoveredBgColor};
|
24
24
|
}
|
25
25
|
`
|
26
|
-
|
26
|
+
|
27
27
|
export default {
|
28
28
|
name: 'RCoption',
|
29
|
-
|
29
|
+
|
30
30
|
props: {
|
31
31
|
value: {
|
32
32
|
required: true
|
@@ -39,9 +39,9 @@
|
|
39
39
|
default:'light'
|
40
40
|
}
|
41
41
|
},
|
42
|
-
|
42
|
+
|
43
43
|
components: {optionContainer},
|
44
|
-
|
44
|
+
|
45
45
|
data() {
|
46
46
|
return {}
|
47
47
|
},
|
@@ -57,4 +57,3 @@
|
|
57
57
|
}
|
58
58
|
}
|
59
59
|
</script>
|
60
|
-
|
@@ -15,16 +15,20 @@
|
|
15
15
|
/>
|
16
16
|
</label-wrapper>
|
17
17
|
<input-container
|
18
|
-
:placeholder="placeholder"
|
19
|
-
:isError="isError"
|
20
|
-
:rows="rowHeight"
|
21
|
-
:value="value"
|
22
18
|
:inputWidth="inputWidth"
|
23
|
-
:
|
19
|
+
:isError="isError"
|
24
20
|
:fontSize="fontSize"
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
:disabled="isDisabled"
|
22
|
+
>
|
23
|
+
<textarea
|
24
|
+
:placeholder="placeholder"
|
25
|
+
:rows="rowHeight"
|
26
|
+
:value="value"
|
27
|
+
:disabled="isDisabled"
|
28
|
+
@input="onChangeHandler"
|
29
|
+
:resize="resize"
|
30
|
+
/>
|
31
|
+
</input-container>
|
28
32
|
</input-wrapper>
|
29
33
|
<error-message v-if="isError && errorText">{{ errorText }}</error-message>
|
30
34
|
</container>
|
@@ -71,27 +75,30 @@ const inputProps = {
|
|
71
75
|
fontSize: String,
|
72
76
|
inputWidth: String
|
73
77
|
}
|
74
|
-
const InputContainer = styled('textarea', inputProps)`
|
75
|
-
border: ${(props) =>
|
76
|
-
props.isError
|
77
|
-
? '1px solid ' + props.theme.colors.red
|
78
|
-
: '1px solid ' + props.theme.colors.grey4};
|
79
|
-
padding: ${(props) =>
|
80
|
-
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
81
|
-
border-radius: 4px;
|
82
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
|
83
|
-
color: ${(props) => props.theme.colors.black};
|
84
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
85
|
-
max-width: 100%;
|
86
|
-
box-sizing: border-box; // to allow width of 100% with padding
|
87
|
-
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'inherit')};
|
88
78
|
|
89
|
-
|
90
|
-
|
91
|
-
|
79
|
+
const InputContainer = styled('div', inputProps)`
|
80
|
+
textarea {
|
81
|
+
border: ${(props) =>
|
82
|
+
props.isError
|
83
|
+
? '1px solid ' + props.theme.colors.red
|
84
|
+
: '1px solid ' + props.theme.colors.grey4};
|
85
|
+
padding: ${(props) =>
|
86
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
87
|
+
border-radius: 4px;
|
88
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
|
89
|
+
color: ${(props) => props.theme.colors.black};
|
90
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
91
|
+
max-width: 100%;
|
92
|
+
box-sizing: border-box; // to allow width of 100% with padding
|
93
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'inherit')};
|
92
94
|
|
93
|
-
|
94
|
-
|
95
|
+
&::placeholder {
|
96
|
+
color: ${(props) => props.theme.colors.grey2};
|
97
|
+
}
|
98
|
+
|
99
|
+
&:focus {
|
100
|
+
outline: none;
|
101
|
+
}
|
95
102
|
}
|
96
103
|
`
|
97
104
|
|
@@ -181,7 +188,7 @@ export default {
|
|
181
188
|
if (this.isDisabled) {
|
182
189
|
return
|
183
190
|
}
|
184
|
-
this.$emit('input-change', $event)
|
191
|
+
this.$emit('input-change', $event.target.value)
|
185
192
|
}
|
186
193
|
}
|
187
194
|
}
|