@eturnity/eturnity_reusable_components 7.8.2-EPDM-7779.1 → 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.1",
3
+ "version": "7.8.2-EPDM-7779.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -63,7 +63,7 @@
63
63
  @input-change="searchChange"
64
64
  @click.native.stop
65
65
  />
66
- <selector :selectWidth="selectorWidth" v-else>
66
+ <selector :selectWidth="selectWidth" v-else>
67
67
  <slot name="selector" :selectedValue="selectedValue"></slot>
68
68
  </selector>
69
69
  <Caret @click.stop="toggleCaretDropdown">
@@ -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 = 30
146
- const ELLIPSIS_WIDTH = 16
145
+ const CARET_WIDTH = '30px'
146
+ const PADDING = '15px'
147
+ const BORDER_WIDTH = '1px'
147
148
 
148
149
  const Caret = styled.div`
149
150
  display: flex;
150
151
  align-items: center;
151
152
  justify-content: center;
152
- width: ${CARET_WIDTH}px;
153
- min-width: ${CARET_WIDTH}px;
153
+ width: ${CARET_WIDTH};
154
+ min-width: ${CARET_WIDTH};
154
155
  height: 100%;
155
- align-items: stretch
156
+ align-items: stretch;
156
157
  cursor: pointer;
157
158
  margin-left: auto;
158
159
  `
159
160
 
160
161
  const Selector = styled('div', { selectWidth: String })`
161
- max-width: ${(props) => props.selectWidth};
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,
@@ -568,11 +568,6 @@ export default {
568
568
  isSearchBarVisible() {
569
569
  // Removed the optionLength condition, because if there were no result/options when we searched, we still need to show the search input
570
570
  return this.isSearchable && this.isDropdownOpen
571
- },
572
- selectorWidth() {
573
- const currentWidth = this.selectWidth ? this.selectWidth : '100%'
574
-
575
- return `calc(${currentWidth} - ${CARET_WIDTH + ELLIPSIS_WIDTH}px)`
576
571
  }
577
572
  },
578
573
  watch: {