@eturnity/eturnity_reusable_components 1.2.48-EPDM-5846.1 → 1.2.48-EPDM-5846.3

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