@eturnity/eturnity_reusable_components 1.2.53 → 1.2.54

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.53",
3
+ "version": "1.2.54",
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
@@ -20,36 +20,39 @@
20
20
  :alignText="infoTextAlign"
21
21
  />
22
22
  </label-wrapper>
23
- <div>
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
- :inputHeight="selectHeight"
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
- <div v-else>
46
+ <selector v-else>
45
47
  <slot name="selector" :selectedValue="selectedValue"></slot>
46
- </div>
47
- <Caret :isUp="isDropdownOpen" @click.stop="toggleCaretDropdown" >
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
- </div>
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
- const caretAttrs={isUp:Boolean}
97
- const Caret=styled('div', caretAttrs)`
98
- position:absolute;
99
- display:flex;
100
- align-items:center;
101
- height:100%;
102
- right:15px;
103
- top:-2px
104
- transform: ${props=>!props.isUp?"rotate(180deg)":""};
105
- transform-origin: center;
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
- const selectButtonAttrs={bgColor:String,fontColor:String,isActive:Boolean,selectHeight:String}
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: grid;
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 15px;
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
-
@@ -189,7 +189,9 @@ const TableContainer = styled('table', containerAttrs)`
189
189
  }
190
190
 
191
191
  &.checkbox-header {
192
- width: 40px;
192
+ min-width: 40px;
193
+ display: flex;
194
+ gap: 10px;
193
195
  }
194
196
  }
195
197