@eturnity/eturnity_reusable_components 7.8.2-EPDM-7779.0 → 7.8.2-EPDM-7779.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": "7.8.2-EPDM-7779.0",
3
+ "version": "7.8.2-EPDM-7779.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -142,23 +142,24 @@ import InfoText from '../../infoText'
142
142
  import icon from '../../icon'
143
143
  import inputText from '../inputText'
144
144
 
145
+ const CARET_WIDTH = '30px'
146
+ const PADDING = '15px'
147
+ const BORDER_WIDTH = '1px'
148
+
145
149
  const Caret = styled.div`
146
150
  display: flex;
147
151
  align-items: center;
148
152
  justify-content: center;
149
- width: 30px;
150
- min-width: 30px;
153
+ width: ${CARET_WIDTH};
154
+ min-width: ${CARET_WIDTH};
151
155
  height: 100%;
152
- align-items: stretch
156
+ align-items: stretch;
153
157
  cursor: pointer;
154
158
  margin-left: auto;
155
159
  `
156
160
 
157
161
  const Selector = styled('div', { selectWidth: String })`
158
- max-width: ${(props) =>
159
- props.selectWidth
160
- ? props.selectWidth
161
- : '100%'}; // set to same width as the select
162
+ max-width: ${(props) => `calc(${props.selectWidth} - (${CARET_WIDTH} + ${PADDING} + (${BORDER_WIDTH} * 2)))`};
162
163
  white-space: nowrap;
163
164
  text-overflow: ellipsis;
164
165
  overflow: hidden;
@@ -178,7 +179,7 @@ const optionalLabel = styled.span`
178
179
  `
179
180
  const inputProps = { selectWidth: String, optionWidth: String }
180
181
  const Container = styled('div', inputProps)`
181
- width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
182
+ width: ${(props) => props.selectWidth};
182
183
  position: relative;
183
184
  display: inline-block;
184
185
  `
@@ -212,9 +213,8 @@ const selectButton = styled('div', selectButtonAttrs)`
212
213
  position: relative;
213
214
  box-sizing: border-box;
214
215
  border-radius: 4px;
215
- padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
216
+ ${(props) => (props.isSearchBarVisible ? '' : `padding-left: ${PADDING}` )};
216
217
  text-align: left;
217
- border-radius: 4px;
218
218
  min-height: ${(props) =>
219
219
  props.selectHeight
220
220
  ? props.selectHeight
@@ -229,7 +229,7 @@ const selectButton = styled('div', selectButtonAttrs)`
229
229
  ${({ showBorder, theme, hasError }) =>
230
230
  showBorder &&
231
231
  `
232
- border:1px solid ${hasError ? theme.colors.red : theme.colors.grey4}
232
+ border: ${BORDER_WIDTH} solid ${hasError ? theme.colors.red : theme.colors.grey4}
233
233
  `}
234
234
  background-color:${(props) =>
235
235
  props.disabled
@@ -247,7 +247,6 @@ const selectDropdownAttrs = {
247
247
  hoveredBgColor: String,
248
248
  bgColor: String,
249
249
  fontColor: String,
250
- selectWidth: String,
251
250
  optionWidth: String,
252
251
  hoveredIndex: Number,
253
252
  hoveredValue: Number | String,
@@ -258,7 +257,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
258
257
  z-index:${(props) => (props.isActive ? '2' : '1')};
259
258
  position:absolute;
260
259
  top:5px;
261
- border:1px solid ${(props) => props.theme.colors.grey4}
260
+ border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
262
261
  border-radius:4px;
263
262
  display: flex;
264
263
  flex-direction: column;
@@ -325,8 +324,9 @@ export default {
325
324
  required: false
326
325
  },
327
326
  selectWidth: {
327
+ type: String,
328
328
  required: false,
329
- default: null
329
+ default: '100%'
330
330
  },
331
331
  selectHeight: {
332
332
  type: String,
@@ -552,26 +552,22 @@ export default {
552
552
  this.$refs.dropdown.$el.scrollTop = topPos
553
553
  }
554
554
  }
555
+ },
556
+ clearSearch() {
557
+ this.textSearch = ''
555
558
  }
556
559
  },
557
560
  computed: {
558
561
  optionLength() {
559
562
  if (this.isDropdownOpen) {
560
- // this filterRef is needed to check for the # of children on Filter dropdowns
561
- const filterRef =
562
- this.$refs.dropdown.$children &&
563
- this.$refs.dropdown.$children.length > 1
564
- ? this.$refs.dropdown.$children
565
- : this.$refs.dropdown.$children[0].$children
566
- ? this.$refs.dropdown.$children[0].$children
567
- : this.$refs.dropdown.$children
568
- return filterRef.length
569
- } else {
570
- return 0
563
+ return this.$refs.dropdown.$el.childElementCount
571
564
  }
565
+
566
+ return 0
572
567
  },
573
568
  isSearchBarVisible() {
574
- return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
569
+ // Removed the optionLength condition, because if there were no result/options when we searched, we still need to show the search input
570
+ return this.isSearchable && this.isDropdownOpen
575
571
  }
576
572
  },
577
573
  watch: {