@eturnity/eturnity_reusable_components 6.33.1-EPDM-7762.3 → 6.33.1-EPDM-6487.1

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": "6.33.1-EPDM-7762.3",
3
+ "version": "6.33.1-EPDM-6487.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -3,7 +3,7 @@ const theme = {
3
3
  primary: '#48a2d0',
4
4
  secondary: '#fdb813',
5
5
  tertiary: '#d5d5d5',
6
- black: '#263238',
6
+ black: '#353535',
7
7
  yellow: '#fdb813',
8
8
  darkGray: '#818181',
9
9
  gray1: '#666',
@@ -20,8 +20,8 @@ const theme = {
20
20
  grey5: '#fafafa',
21
21
  grey6: '#555d61',
22
22
  green: '#99db0c',
23
- transparentWhite1: '#ffffff32',
24
- transparentBlack1: '#263238e6',
23
+ transparentWhite1:'#ffffff32',
24
+ transparentBlack1:'#263238e6',
25
25
  disabled: '#dfe1e1',
26
26
  eturnityGrey: '#263238'
27
27
  },
@@ -311,7 +311,8 @@ export default {
311
311
  return {
312
312
  textInput: '',
313
313
  isFocused: false,
314
- warningIcon: warningIcon
314
+ warningIcon: warningIcon,
315
+ isBlurred: false
315
316
  }
316
317
  },
317
318
  props: {
@@ -488,7 +489,9 @@ export default {
488
489
  return num
489
490
  }
490
491
  })
491
- let evaluated = eval(formatted.join(''))
492
+ let evaluated
493
+ formatted = this.removeStringItemsAfterLastNumber(formatted)
494
+ evaluated = eval(formatted.join(' '))
492
495
  if (typeof evaluated === 'string') {
493
496
  evaluated = stringToNumber({
494
497
  value: evaluated,
@@ -499,7 +502,32 @@ export default {
499
502
  }
500
503
  return evaluated
501
504
  },
505
+ removeStringItemsAfterLastNumber(array) {
506
+ // fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
507
+ let lastNumberIndex = -1
508
+ // Find the index of the last number in the array
509
+ for (let i = array.length - 1; i >= 0; i--) {
510
+ if (typeof array[i] === 'number') {
511
+ lastNumberIndex = i
512
+ break
513
+ }
514
+ }
515
+ // if there are no numbers, return an empty array
516
+ if (lastNumberIndex === -1) {
517
+ return []
518
+ }
519
+ // Remove non-numeric items after the last number
520
+ if (lastNumberIndex !== -1) {
521
+ const newArray = array.slice(0, lastNumberIndex + 1)
522
+ return newArray
523
+ }
524
+ return array
525
+ },
502
526
  onInput(value) {
527
+ if (this.isBlurred) {
528
+ this.isBlurred = false
529
+ return
530
+ }
503
531
  if (value === '') {
504
532
  this.$emit('on-input', '')
505
533
  }
@@ -514,6 +542,8 @@ export default {
514
542
  },
515
543
  onInputBlur(e) {
516
544
  this.isFocused = false
545
+ // setting isBlurred so we don't trigger onInput as well
546
+ this.isBlurred = true
517
547
  let value = e.target.value
518
548
  let evaluatedInput = this.onEvaluateCode(value)
519
549
  this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
@@ -14,11 +14,9 @@
14
14
  labelFontColor || colorMode == 'dark' ? 'white' : 'eturnityGrey'
15
15
  "
16
16
  :fontSize="fontSize"
17
- >{{ label }}
18
- <optionalLabel v-if="labelOptional">
19
- ({{ $gettext('Optional') }})</optionalLabel
20
- >
21
- </input-label>
17
+ >{{ label }} <optionalLabel v-if="labelOptional"> ({{ $gettext('Optional') }})</optionalLabel>
18
+ </input-label
19
+ >
22
20
  <info-text
23
21
  v-if="infoTextMessage"
24
22
  :text="infoTextMessage"
@@ -93,7 +91,9 @@
93
91
  :hoveredIndex="hoveredIndex"
94
92
  :isActive="isActive"
95
93
  :optionWidth="optionWidth"
96
- :hoveredBgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
94
+ :bgColor="
95
+ dropdownBgColor || colorMode == 'dark' ? 'black' : 'white'
96
+ "
97
97
  :fontColor="
98
98
  dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
99
99
  "
@@ -151,7 +151,7 @@ const Selector = styled.div`
151
151
  width: 100%;
152
152
  `
153
153
 
154
- const labelAttrs = { fontSize: String, fontColor: String }
154
+ const labelAttrs = { fontSize: String }
155
155
  const InputLabel = styled('div', labelAttrs)`
156
156
  color: ${(props) =>
157
157
  props.theme.colors[props.fontColor]
@@ -162,6 +162,7 @@ const InputLabel = styled('div', labelAttrs)`
162
162
  `
163
163
  const optionalLabel = styled.span`
164
164
  font-weight: 300;
165
+
165
166
  `
166
167
  const inputProps = { selectWidth: String, optionWidth: String }
167
168
  const Container = styled('div', inputProps)`
@@ -197,10 +198,11 @@ const selectButton = styled('div', selectButtonAttrs)`
197
198
  position: relative;
198
199
  box-sizing: border-box;
199
200
  border-radius: 4px;
200
- padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
201
+ padding: ${(props) =>
202
+ props.isSearchBarVisible ? '0' : '0px 0px 0 15px'};
201
203
  text-align: left;
202
204
  border-radius: 4px;
203
- min-height: ${(props) => (props.selectHeight ? props.selectHeight : '36px')};
205
+ min-height: 36px;
204
206
  display: flex;
205
207
  align-items: center;
206
208
  max-height: ${(props) => props.selectHeight};
@@ -222,7 +224,7 @@ const selectButton = styled('div', selectButtonAttrs)`
222
224
  ${(props) => (props.disabled ? 'pointer-events: none' : '')};
223
225
  `
224
226
  const selectDropdownAttrs = {
225
- hoveredBgColor: String,
227
+ bgColor: String,
226
228
  fontColor: String,
227
229
  selectWidth: String,
228
230
  optionWidth: String,
@@ -243,20 +245,20 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
243
245
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
244
246
  width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
245
247
  background-color:${(props) =>
246
- props.theme.colors[props.hoveredBgColor]
247
- ? props.theme.colors[props.hoveredBgColor]
248
- : props.hoveredBgColor};
248
+ props.theme.colors[props.bgColor]
249
+ ? props.theme.colors[props.bgColor]
250
+ : props.bgColor};
249
251
  color:${(props) =>
250
252
  props.theme.colors[props.fontColor]
251
253
  ? props.theme.colors[props.fontColor]
252
254
  : props.fontColor};
253
255
  max-height:300px;
254
256
  overflow-y:auto;
257
+ & [data-value="${(props) => props.selectedValue}"]{
258
+ backdrop-filter: brightness(1.4);
259
+ }
255
260
  &>div:nth-child(${(props) => props.hoveredIndex}){
256
- background-color:${(props) =>
257
- props.theme.colors[props.hoveredBgColor]
258
- ? props.theme.colors[props.hoveredBgColor]
259
- : props.hoveredBgColor};
261
+ backdrop-filter: brightness(1.2);
260
262
  }
261
263
  `
262
264
  const DropdownWrapper = styled('div')`
@@ -323,8 +325,7 @@ export default {
323
325
  required: false
324
326
  },
325
327
  dropdownBgColor: {
326
- required: false,
327
- default: 'grey5'
328
+ required: false
328
329
  },
329
330
  dropdownFontColor: {
330
331
  required: false
@@ -1,68 +1,59 @@
1
1
  <template>
2
- <optionContainer
3
- :data-value="value"
4
- :hoveredBgColor="colorMode == 'dark' ? '#000000' : 'hoveredBgColor'"
5
- :backgroundColor="colorMode == 'dark' ? '#000000' : '#fff'"
6
- @click="clickHandler"
7
- @mouseover="hoverHandler"
8
- >
9
- <slot></slot>
10
- </optionContainer>
11
- </template>
2
+ <optionContainer :data-value="value" :hoveredBgColor="hoveredBgColor || colorMode=='dark'?'#000000':'grey5'" @click="clickHandler" @mouseover="hoverHandler">
3
+ <slot></slot>
4
+ </optionContainer>
5
+ </template>
12
6
 
13
- <script>
7
+ <script>
14
8
  // import selectButton from './selectButton'
15
9
  // import selectDropdown from './selectDropDown'
16
- import styled from 'vue-styled-components'
17
- const optionProps = { hoveredBgColor: String, backgroundColor: String }
18
- const optionContainer = styled('div', optionProps)`
19
- display: flex;
20
- cursor: pointer;
21
- flex-direction: row;
22
- justify-content: space-between;
23
- align-items: center;
24
- padding: 12px 10px;
25
- gap: 14px;
26
- width: 100%;
27
- background-color: ${(props) => props.backgroundColor};
28
- box-sizing: inherit;
29
- &:hover {
30
- background-color: ${(props) =>
31
- props.theme.colors[props.hoveredBgColor]
32
- ? props.theme.colors[props.hoveredBgColor]
33
- : props.hoveredBgColor};
34
- }
35
- `
10
+ import styled from 'vue-styled-components'
11
+ const optionProps={hoveredBgColor:String}
12
+ const optionContainer = styled('div',optionProps)`
13
+ display:flex;
14
+ cursor: pointer;
15
+ flex-direction: row;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+ padding: 12px 10px;
19
+ gap: 14px;
20
+ width:100%;
21
+ box-sizing:inherit;
22
+ &:hover{
23
+ background-color:${(props) => props.theme.colors[props.hoveredBgColor]?props.theme.colors[props.hoveredBgColor]:props.hoveredBgColor};
24
+ }
25
+ `
36
26
 
37
- export default {
38
- name: 'RCoption',
27
+ export default {
28
+ name: 'RCoption',
39
29
 
40
- props: {
41
- value: {
42
- required: true
43
- },
44
- hoveredBgColor: {
45
- required: false
30
+ props: {
31
+ value: {
32
+ required: true
33
+ },
34
+ hoveredBgColor:{
35
+ required:false,
36
+ },
37
+ colorMode:{
38
+ required:false,
39
+ default:'light'
40
+ }
46
41
  },
47
- colorMode: {
48
- required: false,
49
- default: 'light'
50
- }
51
- },
52
42
 
53
- components: { optionContainer },
43
+ components: {optionContainer},
54
44
 
55
- data() {
56
- return {}
57
- },
58
- methods: {
59
- clickHandler() {
60
- this.$parent.$emit('option-selected', this.value)
45
+ data() {
46
+ return {}
47
+ },
48
+ methods:{
49
+ clickHandler(){
50
+ this.$parent.$emit('option-selected',this.value)
51
+ },
52
+ hoverHandler(){
53
+ this.$parent.$emit('option-hovered',this.value)
54
+ }
61
55
  },
62
- hoverHandler() {
63
- this.$parent.$emit('option-hovered', this.value)
56
+ computed: {
64
57
  }
65
- },
66
- computed: {}
67
- }
68
- </script>
58
+ }
59
+ </script>