@eturnity/eturnity_reusable_components 7.8.6-EPDM-7951.0 → 7.10.0-EPDM-10163.0

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.
Files changed (52) hide show
  1. package/.storybook/preview.js +1 -1
  2. package/package.json +23 -18
  3. package/src/App.vue +2 -2
  4. package/src/assets/svgIcons/expand.svg +1 -0
  5. package/src/assets/svgIcons/split.svg +45 -0
  6. package/src/assets/theme.js +2 -0
  7. package/src/components/addNewButton/index.vue +3 -5
  8. package/src/components/buttons/buttonIcon/index.vue +1 -1
  9. package/src/components/buttons/closeButton/index.vue +1 -1
  10. package/src/components/buttons/mainButton/index.vue +1 -6
  11. package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
  12. package/src/components/deleteIcon/index.vue +21 -25
  13. package/src/components/draggableInputHandle/index.vue +25 -24
  14. package/src/components/dropdown/index.vue +110 -129
  15. package/src/components/errorMessage/index.vue +1 -1
  16. package/src/components/filter/filterSettings.vue +97 -55
  17. package/src/components/filter/index.vue +3 -3
  18. package/src/components/filter/parentDropdown.vue +2 -2
  19. package/src/components/icon/iconCollection.vue +2 -2
  20. package/src/components/icon/index.vue +55 -57
  21. package/src/components/iconWrapper/index.vue +5 -2
  22. package/src/components/infoCard/index.vue +3 -2
  23. package/src/components/infoText/index.vue +6 -2
  24. package/src/components/inputs/checkbox/index.vue +6 -21
  25. package/src/components/inputs/inputNumber/index.vue +12 -8
  26. package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
  27. package/src/components/inputs/inputText/index.vue +8 -3
  28. package/src/components/inputs/radioButton/index.vue +1 -1
  29. package/src/components/inputs/searchInput/index.vue +8 -7
  30. package/src/components/inputs/select/index.vue +72 -213
  31. package/src/components/inputs/select/option/index.vue +5 -5
  32. package/src/components/inputs/slider/index.vue +16 -16
  33. package/src/components/inputs/switchField/index.vue +2 -2
  34. package/src/components/inputs/textAreaInput/index.vue +1 -1
  35. package/src/components/inputs/toggle/index.vue +2 -2
  36. package/src/components/label/index.vue +32 -27
  37. package/src/components/modals/modal/index.vue +8 -13
  38. package/src/components/navigationTabs/index.vue +30 -37
  39. package/src/components/pageSubtitle/index.vue +1 -1
  40. package/src/components/pageTitle/index.vue +19 -20
  41. package/src/components/pagination/index.vue +1 -1
  42. package/src/components/progressBar/index.vue +1 -1
  43. package/src/components/projectMarker/index.vue +7 -10
  44. package/src/components/sideMenu/index.vue +1 -1
  45. package/src/components/spinner/index.vue +11 -6
  46. package/src/components/tableDropdown/index.vue +26 -21
  47. package/src/components/tables/mainTable/exampleNested.vue +1 -1
  48. package/src/components/tables/mainTable/index.vue +1 -2
  49. package/src/components/tables/viewTable/index.vue +2 -2
  50. package/src/components/threeDots/index.vue +1 -1
  51. package/src/components/videoThumbnail/index.vue +100 -95
  52. package/src/main.js +11 -4
@@ -44,7 +44,7 @@
44
44
  // number_max_allowed: 10,
45
45
  // unit_short_name: "cm",
46
46
  // },
47
- import styled from "vue3-styled-components"
47
+ import styled from "vue-styled-components"
48
48
  import {
49
49
  stringToNumber,
50
50
  numberToString,
@@ -34,6 +34,7 @@
34
34
  :value="value"
35
35
  @input="onChangeHandler"
36
36
  @blur="onInputBlur"
37
+ @keyup.enter="onEnterPress"
37
38
  :noBorder="noBorder"
38
39
  :disabled="disabled"
39
40
  :isDisabled="disabled"
@@ -66,7 +67,7 @@
66
67
  </template>
67
68
 
68
69
  <script>
69
- import styled from 'vue3-styled-components'
70
+ import styled from 'vue-styled-components'
70
71
  import InfoText from '../../infoText'
71
72
  import Icon from '../../icon'
72
73
  import ErrorMessage from '../../errorMessage'
@@ -328,8 +329,12 @@ export default {
328
329
  }
329
330
  },
330
331
  methods: {
331
- onChangeHandler(event) {
332
- this.$emit('input-change', event.target.value)
332
+ onEnterPress(event){
333
+ this.$emit('on-enter-click')
334
+ this.$refs.inputElement.$el.blur()
335
+ },
336
+ onChangeHandler($event) {
337
+ this.$emit('input-change', $event)
333
338
  },
334
339
  onInputBlur($event) {
335
340
  this.$emit('input-blur', $event.target.value)
@@ -60,7 +60,7 @@
60
60
  // { label: 'Button 4', value: 'button_4', disabled: true }
61
61
  // ]
62
62
 
63
- import styled from 'vue3-styled-components'
63
+ import styled from 'vue-styled-components'
64
64
  import Modal from '../../modals/modal'
65
65
  import InfoText from '../../infoText'
66
66
 
@@ -13,7 +13,10 @@
13
13
  :hasFocus="hasFocus"
14
14
  :data-id="dataId"
15
15
  />
16
- <SearchIconSvg class="search-icn" />
16
+ <img
17
+ class="search-icn"
18
+ :src="require('../../../assets/icons/search_icon_black.svg')"
19
+ />
17
20
  </input-wrapper>
18
21
  </container>
19
22
  </template>
@@ -30,8 +33,7 @@
30
33
  // :isFilter="true" // to set the height at 30px
31
34
  // data-id="test-data-id"
32
35
  // />
33
- import styled from 'vue3-styled-components'
34
- import SearchIconSvg from '../../../assets/icons/search_icon_black.svg'
36
+ import styled from 'vue-styled-components'
35
37
 
36
38
  const inputAttrs = {
37
39
  isDisabled: Boolean,
@@ -66,7 +68,7 @@ const InputContainer = styled('input', inputAttrs)`
66
68
  const InputWrapper = styled.span`
67
69
  position: relative;
68
70
 
69
- svg {
71
+ img {
70
72
  position: absolute;
71
73
  right: 10px;
72
74
  top: 50%;
@@ -79,8 +81,7 @@ export default {
79
81
  components: {
80
82
  InputContainer,
81
83
  InputWrapper,
82
- Container,
83
- SearchIconSvg
84
+ Container
84
85
  },
85
86
  props: {
86
87
  value: {
@@ -113,7 +114,7 @@ export default {
113
114
  },
114
115
  methods: {
115
116
  onChangeHandler(event) {
116
- this.$emit('on-change', event.target.value)
117
+ this.$emit('on-change', event)
117
118
  },
118
119
  focusInputElement() {
119
120
  this.$nextTick(() => {
@@ -30,9 +30,7 @@
30
30
  <select-button-wrapper :disabled="disabled">
31
31
  <selectButton
32
32
  ref="select"
33
- class="select-button"
34
33
  @click="toggleDropdown"
35
- :selectWidth="selectWidth"
36
34
  :selectHeight="selectHeight"
37
35
  :height="height"
38
36
  :selectMinHeight="selectMinHeight"
@@ -43,17 +41,14 @@
43
41
  buttonFontColor || colorMode == 'dark' ? 'white' : 'black'
44
42
  "
45
43
  :hasError="hasError"
46
- :hasNoPadding="isSearchBarVisible || !hasSelectButtonPadding"
44
+ :isSearchBarVisible="isSearchBarVisible"
47
45
  :disabled="disabled"
48
- @keydown="onKeyDown"
46
+ @keydown.native="onKeyDown"
49
47
  :showBorder="showBorder"
50
48
  :data-id="dataId"
51
49
  :isDraggable="isDraggable"
52
- >
53
- <draggableInputHandle
54
- v-if="isDraggable && !isSearchBarVisible"
55
- :height="selectHeight"
56
- />
50
+ >
51
+ <draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
57
52
  <inputText
58
53
  v-if="isSearchBarVisible"
59
54
  ref="searchInput"
@@ -68,9 +63,9 @@
68
63
  :value="textSearch"
69
64
  @keydown.stop="onKeyDown"
70
65
  @input-change="searchChange"
71
- @click.stop
66
+ @click.native.stop
72
67
  />
73
- <selector :selectWidth="selectWidth" v-else>
68
+ <selector v-else>
74
69
  <slot name="selector" :selectedValue="selectedValue"></slot>
75
70
  </selector>
76
71
  <Caret @click.stop="toggleCaretDropdown">
@@ -96,33 +91,26 @@
96
91
  />
97
92
  </Caret>
98
93
  </selectButton>
99
- <DropdownWrapper ref="dropdownWrapperRef">
100
- <Teleport to="#portal-target">
101
- <selectDropdown
102
- ref="dropdown"
103
- v-show="isSelectDropdownShown"
104
- :dropdownPosition="dropdownPosition"
105
- :hoveredIndex="hoveredIndex"
106
- :hoveredValue="hoveredValue"
107
- :isActive="isActive"
108
- :optionWidth="getOptionWidth"
109
- :hoveredBgColor="
110
- colorMode == 'dark' ? '#000000' : dropdownBgColor
111
- "
112
- :bgColor="
113
- dropdownBgColor || colorMode == 'dark' ? 'black' : 'white'
114
- "
115
- :fontColor="
116
- dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
117
- "
118
- :fontSize="fontSize"
119
- :selectedValue="selectedValue"
120
- @option-selected="optionSelected"
121
- @option-hovered="optionHovered"
122
- >
123
- <slot name="dropdown"></slot>
124
- </selectDropdown>
125
- </Teleport>
94
+ <DropdownWrapper>
95
+ <selectDropdown
96
+ ref="dropdown"
97
+ v-show="isDropdownOpen"
98
+ :hoveredIndex="hoveredIndex"
99
+ :hoveredValue="hoveredValue"
100
+ :isActive="isActive"
101
+ :optionWidth="optionWidth"
102
+ :hoveredBgColor="colorMode == 'dark' ? '#000000' : dropdownBgColor"
103
+ :bgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
104
+ :fontColor="
105
+ dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
106
+ "
107
+ :selectedValue="selectedValue"
108
+ @option-selected="optionSelected"
109
+ @option-hovered="optionHovered"
110
+ @mouseleave="optionLeave"
111
+ >
112
+ <slot name="dropdown"></slot>
113
+ </selectDropdown>
126
114
  </DropdownWrapper>
127
115
  </select-button-wrapper>
128
116
  </input-wrapper>
@@ -137,9 +125,8 @@
137
125
  // optionWidth="50%"
138
126
  // label="that is a label"
139
127
  // alignItems="vertical"
140
- // label-data-id="test-label-data-id"
128
+ // label-data-id="test-label0data-id"
141
129
  // data-id="test-data-id"
142
- // :hasSelectButtonPadding="false"
143
130
  // >
144
131
  // <template #selector="{selectedValue}">
145
132
  // value selected: {{selectedValue}}
@@ -152,8 +139,7 @@
152
139
  // </template>
153
140
  // </Select>
154
141
 
155
- import { Teleport } from 'vue'
156
- import styled from 'vue3-styled-components'
142
+ import styled from 'vue-styled-components'
157
143
  import InfoText from '../../infoText'
158
144
  import icon from '../../icon'
159
145
  import inputText from '../inputText'
@@ -166,18 +152,13 @@ const Caret = styled.div`
166
152
  width: 30px;
167
153
  min-width: 30px;
168
154
  height: 100%;
155
+ align-items: stretch
169
156
  cursor: pointer;
170
157
  margin-left: auto;
171
158
  `
172
159
 
173
- const Selector = styled('div', { selectWidth: String })`
174
- max-width: ${(props) =>
175
- props.selectWidth
176
- ? props.selectWidth
177
- : '100%'}; // set to same width as the select
178
- white-space: nowrap;
179
- text-overflow: ellipsis;
180
- overflow: hidden;
160
+ const Selector = styled.div`
161
+ width: 100%;
181
162
  `
182
163
 
183
164
  const labelAttrs = { fontSize: String, fontColor: String }
@@ -186,16 +167,13 @@ const InputLabel = styled('div', labelAttrs)`
186
167
  props.theme.colors[props.fontColor]
187
168
  ? props.theme.colors[props.fontColor]
188
169
  : props.fontColor};
189
- font-size: ${(props) => props.fontSize};
170
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
190
171
  font-weight: 700;
191
172
  `
192
173
  const optionalLabel = styled.span`
193
174
  font-weight: 300;
194
175
  `
195
- const inputProps = {
196
- selectWidth: String,
197
- optionWidth: String
198
- }
176
+ const inputProps = { selectWidth: String, optionWidth: String }
199
177
  const Container = styled('div', inputProps)`
200
178
  width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
201
179
  position: relative;
@@ -222,22 +200,19 @@ const selectButtonAttrs = {
222
200
  hasError: Boolean,
223
201
  disabled: Boolean,
224
202
  selectHeight: String,
225
- selectWidth: String,
226
203
  height: String,
227
204
  selectMinHeight: String,
228
- hasNoPadding: Boolean,
205
+ isSearchBarVisible: Boolean,
229
206
  showBorder: Boolean,
230
- isDraggable: Boolean
207
+ isDraggable: Boolean,
231
208
  }
232
209
  const selectButton = styled('div', selectButtonAttrs)`
233
210
  position: relative;
234
211
  box-sizing: border-box;
235
212
  border-radius: 4px;
236
- padding-left: ${(props) =>
237
- props.hasNoPadding ? '0' : props.isDraggable ? '30px' : '15px'};
213
+ padding-left:${(props) => (props.isSearchBarVisible ? '0' : props.isDraggable?'30px':'15px')};
238
214
  text-align: left;
239
215
  border-radius: 4px;
240
- max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
241
216
  min-height: ${(props) =>
242
217
  props.selectHeight
243
218
  ? props.selectHeight
@@ -248,7 +223,7 @@ const selectButton = styled('div', selectButtonAttrs)`
248
223
  : '36px'};
249
224
  display: flex;
250
225
  align-items: center;
251
- height: ${(props) => props.selectHeight};
226
+ max-height: ${(props) => props.selectHeight};
252
227
  ${({ showBorder, theme, hasError }) =>
253
228
  showBorder &&
254
229
  `
@@ -266,10 +241,8 @@ const selectButton = styled('div', selectButtonAttrs)`
266
241
  : props.fontColor};
267
242
  ${(props) => (props.disabled ? 'pointer-events: none' : '')};
268
243
  overflow: hidden;
269
- & > .handle {
270
- border-right: ${(props) =>
271
- props.hasError ? props.theme.colors.red : props.theme.colors.grey4}
272
- 1px solid;
244
+ & >.handle{
245
+ border-right:${(props) =>props.hasError ? props.theme.colors.red : props.theme.colors.grey4} 1px solid;
273
246
  }
274
247
  `
275
248
  const selectDropdownAttrs = {
@@ -279,17 +252,14 @@ const selectDropdownAttrs = {
279
252
  selectWidth: String,
280
253
  optionWidth: String,
281
254
  hoveredIndex: Number,
282
- fontSize: String,
283
- dropdownPosition: Object,
284
255
  hoveredValue: Number | String,
285
256
  selectedValue: Number | String
286
257
  }
287
258
  const selectDropdown = styled('div', selectDropdownAttrs)`
288
259
  box-sizing: border-box;
289
- z-index:${(props) => (props.isActive ? '2' : '99999')};
290
- position: absolute;
291
- top: ${(props) => props.dropdownPosition?.top}px;
292
- left: ${(props) => props.dropdownPosition?.left}px;
260
+ z-index:${(props) => (props.isActive ? '2' : '1')};
261
+ position:absolute;
262
+ top:5px;
293
263
  border:1px solid ${(props) => props.theme.colors.grey4}
294
264
  border-radius:4px;
295
265
  display: flex;
@@ -297,7 +267,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
297
267
  align-items: flex-start;
298
268
  padding: 0px;
299
269
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
300
- width: ${(props) => props.optionWidth};
270
+ width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
301
271
  background-color:${(props) =>
302
272
  props.theme.colors[props.bgColor]
303
273
  ? props.theme.colors[props.bgColor]
@@ -314,9 +284,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
314
284
  ? props.theme.colors[props.hoveredBgColor]
315
285
  : props.hoveredBgColor};
316
286
  }
317
- font-size: ${(props) => props.fontSize}
318
287
  `
319
- selectDropdown.emits = ['option-hovered', 'option-selected']
320
288
  const DropdownWrapper = styled('div')`
321
289
  position: relative;
322
290
  `
@@ -329,10 +297,6 @@ const InputWrapper = styled('div', inputAttrs)`
329
297
  grid-template-columns: ${(props) =>
330
298
  props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
331
299
  `
332
-
333
- const DROPDOWN_HEIGHT_OFFSET = 4
334
- const DROPDOWN_TOP_OFFSET = 21
335
-
336
300
  export default {
337
301
  name: 'RCselect',
338
302
 
@@ -343,7 +307,7 @@ export default {
343
307
  },
344
308
  fontSize: {
345
309
  required: false,
346
- default: '13px'
310
+ default: null
347
311
  },
348
312
  label: {
349
313
  required: false
@@ -446,10 +410,6 @@ export default {
446
410
  type: String,
447
411
  default: ''
448
412
  },
449
- hasSelectButtonPadding: {
450
- type: Boolean,
451
- default: true
452
- },
453
413
  isDraggable: {
454
414
  type: Boolean,
455
415
  default: false
@@ -471,7 +431,6 @@ export default {
471
431
  Caret,
472
432
  Selector,
473
433
  inputText,
474
- Teleport,
475
434
  draggableInputHandle
476
435
  },
477
436
 
@@ -482,38 +441,23 @@ export default {
482
441
  isActive: false,
483
442
  textSearch: '',
484
443
  hoveredIndex: 0,
485
- isClickOutsideActive: false,
486
- dropdownPosition: {
487
- left: null,
488
- top: null
489
- },
490
- dropdownWidth: null,
491
- hoveredValue: null
444
+ hoveredValue: null,
445
+ isClickOutsideActive: false
492
446
  }
493
447
  },
494
448
  mounted() {
495
- this.observeDropdownHeight()
496
- this.observeSelectWidth()
497
- window.addEventListener('resize', this.handleSetDropdownOffet)
498
- },
499
- beforeMount() {
500
449
  this.selectedValue = this.value
501
450
  document.addEventListener('click', this.clickOutside)
502
- this.getDropdownPosition()
503
- window.removeEventListener('resize', this.handleSetDropdownOffet)
504
- if (this.dropdownResizeObserver) this.dropdownResizeObserver.disconnect()
505
- if (this.selectResizeObserver) this.selectResizeObserver.disconnect()
506
451
  },
507
- unmounted() {
452
+ beforeDestroy() {
508
453
  document.removeEventListener('click', this.clickOutside)
509
454
  },
510
455
  methods: {
511
456
  focus() {
512
457
  this.isActive = true
513
458
  },
514
- blur(e) {
459
+ blur() {
515
460
  this.isActive = false
516
- this.$emit('blur', e)
517
461
  },
518
462
  toggleDropdown() {
519
463
  this.isDropdownOpen = !this.isDropdownOpen
@@ -529,9 +473,6 @@ export default {
529
473
  this.blur()
530
474
  this.isDropdownOpen = false
531
475
  },
532
- clearSearch() {
533
- this.textSearch = ''
534
- },
535
476
  optionSelected(e) {
536
477
  this.selectedValue = e
537
478
  this.closeDropdown()
@@ -560,15 +501,15 @@ export default {
560
501
  searchChange(value) {
561
502
  this.textSearch = value
562
503
  this.$emit('search-change', value)
563
- const dropdownChildren = [...this.$refs.dropdown.$el.children]
564
- dropdownChildren.forEach((el) => {
565
- if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
566
- el.style.display = 'none'
567
-
568
- return
569
- }
570
- el.style.display = 'inherit'
571
- })
504
+ this.$refs.dropdown.$children
505
+ .map((component) => component.$el)
506
+ .forEach((el) => {
507
+ if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
508
+ el.style.display = 'none'
509
+ } else {
510
+ el.style.display = 'inherit'
511
+ }
512
+ })
572
513
  },
573
514
  onSelectSlotClick() {
574
515
  this.toggleDropdown()
@@ -581,7 +522,6 @@ export default {
581
522
  if (
582
523
  this.$refs.select.$el == event.target ||
583
524
  this.$refs.select.$el.contains(event.target) ||
584
- event.target.id === 'more-button' ||
585
525
  event.target.parentNode === dropdownRef.$el
586
526
  ) {
587
527
  return
@@ -595,92 +535,13 @@ export default {
595
535
  } else if (e.key == 'ArrowUp') {
596
536
  this.onArrowPress(-1)
597
537
  } else if (e.key == 'Enter') {
598
- const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
599
- (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
600
- ]
538
+ const optionHoveredComponent =
539
+ this.$refs.dropdown.$children[
540
+ (this.hoveredIndex - 1 + this.optionLength) % this.optionLength
541
+ ]
601
542
  this.optionSelected(optionHoveredComponent.$el.dataset.value)
602
543
  }
603
544
  },
604
- // If some part of the dropdown menu is outside viewport of the bottom of the screen,
605
- // we need to offset it and display it at the top of the select dropdown instead
606
- async getDropdownPosition() {
607
- if (
608
- !this.$refs.dropdownWrapperRef ||
609
- !this.$refs.select ||
610
- !this.$refs.dropdown
611
- ) {
612
- return
613
- }
614
- await this.$nextTick()
615
- const isDisplayedAtBottom = await this.generateDropdownPosition()
616
- await this.$nextTick()
617
- // If the dropdown menu is going to be displayed at the bottom,
618
- // we need reverify its position after a dom update (nextTick)
619
- if (isDisplayedAtBottom) this.generateDropdownPosition()
620
- },
621
- async generateDropdownPosition() {
622
- const isDropdownNotCompletelyVisible =
623
- await this.isBottomOfDropdownOutOfViewport()
624
- const dropdownWrapperEl = this.$refs.dropdownWrapperRef.$el
625
- const selectButtonHeight = this.$refs.select.$el.clientHeight
626
- const dropdownHeight = this.$refs.dropdown.$el.clientHeight
627
- const dropdownWrapperRelativeHeight =
628
- dropdownWrapperEl.getBoundingClientRect().top +
629
- window.scrollY +
630
- DROPDOWN_HEIGHT_OFFSET
631
-
632
- const top = isDropdownNotCompletelyVisible
633
- ? dropdownWrapperRelativeHeight
634
- : dropdownWrapperRelativeHeight -
635
- dropdownHeight -
636
- selectButtonHeight -
637
- DROPDOWN_TOP_OFFSET
638
- const left = this.dropdownPosition.left
639
- ? this.dropdownPosition.left
640
- : dropdownWrapperEl.getBoundingClientRect().left + window.scrollX
641
-
642
- this.dropdownPosition = { left: Math.floor(left), top: Math.floor(top) }
643
-
644
- return isDropdownNotCompletelyVisible
645
- },
646
- async isBottomOfDropdownOutOfViewport() {
647
- if (!this.$refs.dropdown) {
648
- return false
649
- }
650
- await this.$nextTick()
651
- const rect = this.$refs.dropdown.$el.getBoundingClientRect()
652
- const windowHeight =
653
- window.innerHeight || document.documentElement.clientHeight
654
-
655
- // using Math.floor because the offsets may contain decimals we are not going to consider here
656
- return Math.floor(rect.top) + Math.floor(rect.height) <= windowHeight
657
- },
658
- observeDropdownHeight() {
659
- if (!this.$refs.dropdown) return
660
- this.dropdownResizeObserver = new ResizeObserver(() => {
661
- this.$nextTick(() => this.getDropdownPosition())
662
- })
663
- this.dropdownResizeObserver.observe(this.$refs.dropdown.$el)
664
- },
665
- handleSetDropdownOffet() {
666
- if (!this.$refs.select) return
667
- this.dropdownPosition.left = Math.floor(
668
- this.$refs.select.$el.getBoundingClientRect().left
669
- )
670
- this.getDropdownWidth()
671
- },
672
- observeSelectWidth() {
673
- if (!this.$refs.select) return
674
- this.selectResizeObserver = new ResizeObserver(() =>
675
- this.$nextTick(() => this.getDropdownWidth())
676
- )
677
- this.selectResizeObserver.observe(this.$refs.dropdown.$el)
678
- },
679
- async getDropdownWidth() {
680
- if (!this.$refs.select) return
681
- await this.$nextTick()
682
- this.dropdownWidth = `${this.$refs.select.$el.clientWidth}px`
683
- },
684
545
  onArrowPress(dir) {
685
546
  let newHoveredElem
686
547
  const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
@@ -703,36 +564,34 @@ export default {
703
564
  computed: {
704
565
  optionLength() {
705
566
  if (this.isDropdownOpen) {
706
- return this.$refs.dropdown.$el.childElementCount
567
+ // this filterRef is needed to check for the # of children on Filter dropdowns
568
+ const filterRef =
569
+ this.$refs.dropdown.$children &&
570
+ this.$refs.dropdown.$children.length > 1
571
+ ? this.$refs.dropdown.$children
572
+ : this.$refs.dropdown.$children[0].$children
573
+ ? this.$refs.dropdown.$children[0].$children
574
+ : this.$refs.dropdown.$children
575
+ return filterRef.length
707
576
  } else {
708
577
  return 0
709
578
  }
710
579
  },
711
580
  isSearchBarVisible() {
712
581
  return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
713
- },
714
- getOptionWidth() {
715
- if (this.optionWidth) return this.optionWidth
716
-
717
- return this.dropdownWidth
718
- },
719
- isSelectDropdownShown() {
720
- return this.isDropdownOpen && this.dropdownPosition.left !== null
721
582
  }
722
583
  },
723
584
  watch: {
724
585
  value(val) {
725
586
  this.selectedValue = val
726
587
  },
727
- async isDropdownOpen(val) {
588
+ isDropdownOpen(val) {
589
+ this.$emit('is-dropdown-open', val)
728
590
  if (val) {
729
591
  setTimeout(() => {
730
592
  this.isClickOutsideActive = true
731
593
  }, 10)
732
- await this.$nextTick()
733
- this.handleSetDropdownOffet()
734
594
  } else {
735
- this.dropdownPosition.left = null
736
595
  setTimeout(() => {
737
596
  this.isClickOutsideActive = false
738
597
  }, 10)
@@ -22,7 +22,7 @@
22
22
  <script>
23
23
  // import selectButton from './selectButton'
24
24
  // import selectDropdown from './selectDropDown'
25
- import styled from 'vue3-styled-components'
25
+ import styled from 'vue-styled-components'
26
26
  const optionProps = {
27
27
  isDisabled: Boolean,
28
28
  hoveredBgColor: String,
@@ -59,7 +59,7 @@ const optionContainer = styled('div', optionProps)`
59
59
 
60
60
  export default {
61
61
  name: 'RCoption',
62
- emits: ['option-hovered', 'option-selected'],
62
+
63
63
  props: {
64
64
  value: {
65
65
  required: true
@@ -73,7 +73,7 @@ export default {
73
73
  },
74
74
  cursorType: {
75
75
  required: false,
76
- default: 'pointer'
76
+ default: 'cursor'
77
77
  },
78
78
  backgroundColor: {
79
79
  required: false,
@@ -94,12 +94,12 @@ export default {
94
94
  return {}
95
95
  },
96
96
  methods: {
97
- clickHandler(e) {
97
+ clickHandler() {
98
98
  if (this.isDisabled) {
99
99
  // prevent emitter if the option is disabled
100
100
  return
101
101
  } else {
102
- this.$parent.$emit('option-selected', this.value, e)
102
+ this.$parent.$emit('option-selected', this.value)
103
103
  }
104
104
  },
105
105
  hoverHandler() {