@eturnity/eturnity_reusable_components 1.2.48-EPDM-5846 → 1.2.48-EPDM-5846.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.48-EPDM-5846",
3
+ "version": "1.2.48-EPDM-5846.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -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 ? '18px auto' : '18px')};
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
@@ -21,16 +21,17 @@
21
21
  />
22
22
  </label-wrapper>
23
23
  <div>
24
- <selectButton
24
+ <selectButton
25
25
  ref="select"
26
26
  @click="toggleDropdown"
27
- :isActive="isActive"
27
+ :isDropdownOpen="isDropdownOpen"
28
28
  :selectHeight="selectHeight"
29
29
  :bgColor="buttonBgColor || colorMode=='dark'?'transparentBlack1':'white'"
30
30
  :fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
31
+ :hasError="hasError"
31
32
  @keydown.native="onKeyDown"
32
33
  >
33
- <inputText
34
+ <inputText
34
35
  v-if="isSearchBarVisible"
35
36
  ref="searchInput"
36
37
  tabindex="0"
@@ -38,7 +39,7 @@
38
39
  :inputHeight="selectHeight"
39
40
  backgroundColor="transparent"
40
41
  :fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
41
- :value="textSearch"
42
+ :value="textSearch"
42
43
  @keydown.stop="onKeyDown"
43
44
  @input-change="searchChange" />
44
45
  <div v-else>
@@ -49,7 +50,7 @@
49
50
  </Caret>
50
51
  </selectButton>
51
52
  <DropdownWrapper>
52
- <selectDropdown
53
+ <selectDropdown
53
54
  ref="dropdown"
54
55
  v-show="isDropdownOpen"
55
56
  :hoveredIndex="hoveredIndex"
@@ -64,13 +65,13 @@
64
65
  </selectDropdown>
65
66
  </DropdownWrapper>
66
67
  </div>
67
- </input-wrapper>
68
+ </input-wrapper>
68
69
  </Container>
69
70
  </template>
70
-
71
+
71
72
  <script>
72
73
  //How to use it
73
- // <Select
74
+ // <Select
74
75
  // hoverDropdown="true"
75
76
  // selectWidth="100%"
76
77
  // optionWidth="50%"
@@ -86,13 +87,13 @@
86
87
  // <Option value="3">value three</Option>
87
88
  // <Option value="4">value four</Option>
88
89
  // </template>
89
- // </Select>
90
-
90
+ // </Select>
91
+
91
92
  import styled from 'vue-styled-components'
92
93
  import InfoText from '../../infoText'
93
94
  import icon from '../../icon'
94
95
  import inputText from '../inputText'
95
-
96
+
96
97
  const caretAttrs={isUp:Boolean}
97
98
  const Caret=styled('div', caretAttrs)`
98
99
  position:absolute;
@@ -100,7 +101,7 @@
100
101
  align-items:center;
101
102
  height:100%;
102
103
  right:15px;
103
- top:-2px
104
+ top:-2px;
104
105
  transform: ${props=>!props.isUp?"rotate(180deg)":""};
105
106
  transform-origin: center;
106
107
  `
@@ -124,11 +125,16 @@ const LabelWrapper = styled.div`
124
125
  align-items: center;
125
126
  justify-content: start;
126
127
  `
127
- const selectButtonAttrs={bgColor:String,fontColor:String,isActive:Boolean,selectHeight:String}
128
+ const selectButtonAttrs={
129
+ bgColor: String,
130
+ fontColor: String,
131
+ hasError: Boolean,
132
+ selectHeight: String,
133
+ isDropdownOpen: Boolean
134
+ }
128
135
  const selectButton = styled('div',selectButtonAttrs)`
129
136
  position:relative;
130
137
  box-sizing: border-box;
131
- border:1px solid red;
132
138
  border-radius:4px;
133
139
  padding:0px 10px;
134
140
  text-align:left;
@@ -138,7 +144,7 @@ const selectButton = styled('div',selectButtonAttrs)`
138
144
  grid-template-columns:auto 40px;
139
145
  align-items: center;
140
146
  max-height:${props=>props.selectHeight};
141
- border:1px solid ${(props)=>props.theme.colors.grey4}
147
+ border:1px solid ${(props) => props.hasError && !props.isDropdownOpen ? props.theme.colors.red : props.theme.colors.grey4}
142
148
  background-color:${(props) => props.theme.colors[props.bgColor]?props.theme.colors[props.bgColor]:props.bgColor};
143
149
  color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
144
150
  `
@@ -182,7 +188,7 @@ const InputWrapper = styled('div', inputAttrs)`
182
188
  `
183
189
  export default {
184
190
  name: 'RCselect',
185
-
191
+
186
192
  props: {
187
193
  value:{
188
194
  required:false,
@@ -247,12 +253,16 @@ const InputWrapper = styled('div', inputAttrs)`
247
253
  required:false,
248
254
  default:true
249
255
  },
256
+ hasError: {
257
+ required: false,
258
+ default: false
259
+ },
250
260
  isAutoSearch:{
251
261
  required:false,
252
262
  default:true
253
263
  }
254
264
  },
255
-
265
+
256
266
  components: {
257
267
  selectButton,
258
268
  selectDropdown,
@@ -266,7 +276,7 @@ const InputWrapper = styled('div', inputAttrs)`
266
276
  Caret,
267
277
  inputText
268
278
  },
269
-
279
+
270
280
  data() {
271
281
  return {
272
282
  selectedValue: null,
@@ -293,10 +303,10 @@ const InputWrapper = styled('div', inputAttrs)`
293
303
  },
294
304
  toggleDropdown(){
295
305
  if(this.isSearchBarVisible){return}
296
- this.isDropdownOpen=!this.isDropdownOpen
306
+ this.isDropdownOpen=!this.isDropdownOpen
297
307
  },
298
308
  toggleCaretDropdown(){
299
- this.isDropdownOpen=!this.isDropdownOpen
309
+ this.isDropdownOpen=!this.isDropdownOpen
300
310
  },
301
311
  openDropdown(){
302
312
  this.focus()
@@ -356,7 +366,7 @@ const InputWrapper = styled('div', inputAttrs)`
356
366
  const optionHoveredComponent=this.$refs.dropdown.$children[(this.hoveredIndex-1+this.optionLength)%this.optionLength]
357
367
  this.optionSelected(optionHoveredComponent.$el.dataset.value)
358
368
  }
359
-
369
+
360
370
  },
361
371
  onArrowPress(dir){
362
372
  this.hoveredIndex=((this.hoveredIndex+dir+this.optionLength-1)%this.optionLength)+1
@@ -382,6 +392,7 @@ const InputWrapper = styled('div', inputAttrs)`
382
392
  this.selectedValue=val
383
393
  },
384
394
  isDropdownOpen(val){
395
+ this.$emit('is-dropdown-open', val)
385
396
  if(val){
386
397
  setTimeout(()=>{
387
398
  this.isClickOutsideActive=true
@@ -398,4 +409,3 @@ const InputWrapper = styled('div', inputAttrs)`
398
409
  }
399
410
  }
400
411
  </script>
401
-