@eturnity/eturnity_reusable_components 7.18.0-qa-dev03.0 → 7.20.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 (54) hide show
  1. package/.storybook/preview.js +1 -1
  2. package/package.json +19 -23
  3. package/src/App.vue +2 -2
  4. package/src/assets/svgIcons/split.svg +88 -6
  5. package/src/components/addNewButton/index.vue +5 -3
  6. package/src/components/buttons/buttonIcon/index.vue +1 -1
  7. package/src/components/buttons/closeButton/index.vue +1 -1
  8. package/src/components/buttons/mainButton/index.vue +6 -1
  9. package/src/components/card/index.vue +25 -24
  10. package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
  11. package/src/components/deleteIcon/index.vue +47 -30
  12. package/src/components/draggableInputHandle/index.vue +24 -25
  13. package/src/components/dropdown/index.vue +129 -110
  14. package/src/components/errorMessage/index.vue +10 -5
  15. package/src/components/filter/filterSettings.vue +59 -97
  16. package/src/components/filter/index.vue +3 -3
  17. package/src/components/filter/parentDropdown.vue +2 -2
  18. package/src/components/icon/iconCache.js +23 -0
  19. package/src/components/icon/iconCollection.vue +2 -2
  20. package/src/components/icon/index.vue +67 -75
  21. package/src/components/iconWrapper/index.vue +1 -4
  22. package/src/components/infoCard/index.vue +2 -3
  23. package/src/components/infoText/index.vue +1 -1
  24. package/src/components/inputs/checkbox/index.vue +21 -6
  25. package/src/components/inputs/inputNumber/index.vue +10 -10
  26. package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
  27. package/src/components/inputs/inputText/index.vue +3 -3
  28. package/src/components/inputs/radioButton/index.vue +1 -1
  29. package/src/components/inputs/searchInput/index.vue +28 -11
  30. package/src/components/inputs/select/index.vue +244 -57
  31. package/src/components/inputs/select/option/index.vue +43 -12
  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 +27 -31
  37. package/src/components/modals/modal/index.vue +2 -6
  38. package/src/components/navigationTabs/index.vue +27 -20
  39. package/src/components/pageSubtitle/index.vue +1 -1
  40. package/src/components/pageTitle/index.vue +4 -4
  41. package/src/components/pagination/index.vue +3 -3
  42. package/src/components/progressBar/index.vue +1 -1
  43. package/src/components/projectMarker/index.vue +16 -9
  44. package/src/components/sideMenu/index.vue +1 -1
  45. package/src/components/spinner/index.vue +7 -11
  46. package/src/components/tableDropdown/index.vue +35 -45
  47. package/src/components/tables/mainTable/exampleNested.vue +1 -1
  48. package/src/components/tables/mainTable/index.vue +10 -9
  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 +95 -100
  52. package/src/main.js +4 -11
  53. package/src/assets/svgIcons/anchor.svg +0 -18
  54. package/src/assets/svgIcons/flatten_roof.svg +0 -20
@@ -1,20 +1,13 @@
1
1
  <template>
2
- <Wrapper :isDisabled="disabled" :size="size" :cursor="cursor">
3
- <icon-image
4
- :disabled="disabled"
5
- :size="size"
6
- :color="color"
7
- :hoveredColor="hoveredColor"
8
- :backgroundColor="backgroundColor"
9
- v-html="
10
- require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
11
- "
12
- ></icon-image>
13
- <striked-line v-if="isStriked" :color="color" :disabled="disabled" :hoveredColor="hoveredColor"></striked-line>
14
- </Wrapper>
2
+ <wrapper>
3
+ <icon-image>
4
+ <i v-html="icon.html" />
5
+ </icon-image>
6
+ <striked-line v-if="isStriked"></striked-line>
7
+ </wrapper>
15
8
  </template>
16
9
 
17
- <script>
10
+ <script setup>
18
11
  // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
19
12
  // How to use:
20
13
  //<icon
@@ -26,40 +19,71 @@
26
19
  // isStriked = "true"
27
20
  // />
28
21
 
29
- import styled from 'vue-styled-components'
22
+ import { onMounted, reactive, watch } from 'vue'
23
+ import styled from 'vue3-styled-components'
24
+ import { fetchIcon } from './iconCache'
30
25
 
31
- const wrapperAttrs = { isDisabled: Boolean, size: String, cursor: String }
32
- const Wrapper = styled('div', wrapperAttrs)`
26
+ const props = defineProps({
27
+ disabled: {
28
+ required: false,
29
+ default: false
30
+ },
31
+ name: {
32
+ required: true
33
+ },
34
+ color: {
35
+ required: false
36
+ },
37
+ hoveredColor: {
38
+ required: false
39
+ },
40
+ size: {
41
+ required: false,
42
+ default: '30px'
43
+ },
44
+ cursor: {
45
+ required: false,
46
+ default: null
47
+ },
48
+ isStriked: {
49
+ required: false,
50
+ default: false
51
+ }
52
+ })
53
+
54
+ const Wrapper = styled('div')`
33
55
  display: flex;
34
56
  position: relative;
35
57
  align-content: center;
36
58
  justify-content: center;
37
- width: ${(props) => props.size};
38
- height: ${(props) => props.size};
39
- min-width: ${(props) => props.size};
40
- min-height: ${(props) => props.size};
41
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : props.cursor)};
59
+ width: ${props.size};
60
+ height: ${props.size};
61
+ min-width: ${props.size};
62
+ min-height: ${props.size};
63
+ cursor: ${props.disabled ? 'not-allowed' : props.cursor};
42
64
  line-height: 0;
43
65
  `
44
-
45
- const strikedAttrs = { isDisabled: Boolean, color: String, hoveredColor: String }
46
- const strikedLine = styled('div', strikedAttrs)`
66
+ const strikedAttrs = {
67
+ isDisabled: Boolean,
68
+ color: String,
69
+ hoveredColor: String
70
+ }
71
+ const StrikedLine = styled.div`
47
72
  display: flex;
48
73
  position: absolute;
49
- bottom:0;
50
- left:0;
74
+ bottom: 0;
75
+ left: 0;
51
76
  align-content: center;
52
77
  justify-content: center;
53
78
  width: 143%;
54
- height:8%;
55
- background-color: ${(props)=>props.theme.colors[props.color] || props.color};
79
+ height: 8%;
80
+ background-color: ${({ theme }) => theme.colors[props.color] || props.color};
56
81
  min-height: 0;
57
82
  line-height: 0;
58
83
  transform-origin: 0% 100%;
59
84
  transform: rotate(-45deg);
60
85
  `
61
- const IconImageProps = { color: String, hoveredColor: String, size: String, backgroundColor: String}
62
- const IconImage = styled('div', IconImageProps)`
86
+ const IconImage = styled.div`
63
87
  width: 100%;
64
88
  svg {
65
89
  width: 100%;
@@ -68,56 +92,24 @@ const IconImage = styled('div', IconImageProps)`
68
92
  padding: ${(props) => props.backgroundColor ? '3px' : '0'};
69
93
  }
70
94
  svg path {
71
- ${(props) =>
72
- props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
95
+ ${({ theme }) =>
96
+ props.color && `fill: ${theme.colors[props.color] || props.color};`}
73
97
  }
74
98
  &:hover > svg path {
75
- ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
99
+ ${props.hoveredColor && `fill: ${props.hoveredColor};`}
76
100
  }
77
101
  &:hover + div {
78
- background-color: ${(props)=>props.hoveredColor};
102
+ background-color: ${props.hoveredColor};
79
103
  }
80
104
  `
81
105
 
82
- export default {
83
- name: 'icon',
84
- components: {
85
- IconImage,
86
- Wrapper,
87
- strikedLine
88
- },
89
- props: {
90
- disabled: {
91
- required: false,
92
- default: false
93
- },
94
- name: {
95
- required: true
96
- },
97
- color: {
98
- required: false
99
- },
100
- backgroundColor: {
101
- required: false
102
- },
103
- hoveredColor: {
104
- required: false
105
- },
106
- size: {
107
- required: false,
108
- default: '30px'
109
- },
110
- cursor: {
111
- required: false,
112
- default: null
113
- },
114
- isStriked: {
115
- required: false,
116
- default: false
117
- }
118
- },
119
- data() {
120
- return {}
121
- }
106
+ const icon = reactive({ html: '' })
107
+
108
+ const loadSvg = async () => {
109
+ icon.html = await fetchIcon(props.name.toLowerCase())
122
110
  }
111
+
112
+ onMounted(() => loadSvg())
113
+
114
+ watch(() => props.name, loadSvg)
123
115
  </script>
@@ -42,7 +42,7 @@
42
42
  // size="60px" by default, this is 30px
43
43
  // />
44
44
 
45
- import styled from 'vue-styled-components'
45
+ import styled from 'vue3-styled-components'
46
46
  import icon from '../icon'
47
47
  const wrapperAttrs = {
48
48
  color: String,
@@ -148,9 +148,6 @@ export default {
148
148
  required: false,
149
149
  default: false
150
150
  }
151
- },
152
- data() {
153
- return {}
154
151
  }
155
152
  }
156
153
  </script>
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script>
11
- import styled from 'vue-styled-components'
11
+ import styled from 'vue3-styled-components'
12
12
  import Icon from '../icon'
13
13
 
14
14
  const InfoContainer = styled.div`
@@ -24,7 +24,6 @@ const TextContainer = styled.div`
24
24
  width: 100%;
25
25
  `
26
26
 
27
-
28
27
  export default {
29
28
  name: 'InfoCard',
30
29
  components: {
@@ -33,4 +32,4 @@ export default {
33
32
  TextContainer
34
33
  }
35
34
  }
36
- </script>
35
+ </script>
@@ -30,7 +30,7 @@
30
30
  // alignArrow="right" // which side the arrow should be on
31
31
  // />
32
32
  import theme from '../../assets/theme.js'
33
- import styled from 'vue-styled-components'
33
+ import styled from 'vue3-styled-components'
34
34
  import icon from '../icon'
35
35
 
36
36
  const textAttrs = {
@@ -3,7 +3,7 @@
3
3
  <container
4
4
  :checkColor="checkColor"
5
5
  :size="size"
6
- :hasLabel="!!label.length"
6
+ :hasLabel="hasLabel"
7
7
  :backgroundColor="backgroundColor"
8
8
  :isChecked="isChecked"
9
9
  :isDisabled="isDisabled"
@@ -14,10 +14,10 @@
14
14
  :data-id="dataId"
15
15
  @change="onChangeHandler(!isChecked)"
16
16
  />
17
- <div>
17
+ <check-wrapper :hasLabel="hasLabel">
18
18
  <span class="checkmark"></span>
19
- </div>
20
- <label-text v-if="!!label.length">{{ label }}</label-text>
19
+ </check-wrapper>
20
+ <label-text v-if="hasLabel">{{ label }}</label-text>
21
21
  </container>
22
22
  </component-wrapper>
23
23
  </template>
@@ -34,12 +34,21 @@
34
34
  // backgroundColor="red"
35
35
  // :isDisabled="true"
36
36
  // />
37
- import styled from 'vue-styled-components'
37
+ import styled from 'vue3-styled-components'
38
38
 
39
39
  const ComponentWrapper = styled.div`
40
40
  min-height: 18px;
41
41
  `
42
42
 
43
+ const CheckWrapper = styled('div', { hasLabel: Boolean })`
44
+ ${(props) =>
45
+ props.hasLabel &&
46
+ `
47
+ display: flex;
48
+ align-items: center;
49
+ `}
50
+ `
51
+
43
52
  const containerAttrs = {
44
53
  checkColor: String,
45
54
  size: String,
@@ -145,7 +154,8 @@ export default {
145
154
  ComponentWrapper,
146
155
  Container,
147
156
  InputCheckbox,
148
- LabelText
157
+ LabelText,
158
+ CheckWrapper
149
159
  },
150
160
  props: {
151
161
  label: {
@@ -175,6 +185,11 @@ export default {
175
185
  default: ''
176
186
  }
177
187
  },
188
+ computed: {
189
+ hasLabel() {
190
+ return !!this.label.length
191
+ }
192
+ },
178
193
  methods: {
179
194
  onChangeHandler(value) {
180
195
  if (this.isDisabled) {
@@ -47,7 +47,6 @@
47
47
  :fontSize="fontSize"
48
48
  :fontColor="fontColor"
49
49
  :backgroundColor="backgroundColor"
50
- v-on="$listeners"
51
50
  :hasSlot="hasSlot"
52
51
  :hasLabelSlot="hasLabelSlot"
53
52
  :slotSize="slotSize"
@@ -101,7 +100,7 @@
101
100
  // >
102
101
  //<template name=label><img>....</template>
103
102
  //</inputNumber>
104
- import styled from 'vue-styled-components'
103
+ import styled from 'vue3-styled-components'
105
104
  import {
106
105
  stringToNumber,
107
106
  numberToString
@@ -488,9 +487,10 @@ export default {
488
487
  // Need to return an integer rather than a string
489
488
  this.$emit('input-change', event)
490
489
  },
491
- onEvaluateCode(val) {
490
+ onEvaluateCode(event) {
492
491
  // function to perform math on the code
493
492
  // filter the string in case of any malicious content
493
+ const val = event.target.value
494
494
  let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
495
495
  filtered = filtered.split(/([-+*/()])/)
496
496
  let formatted = filtered.map((item) => {
@@ -548,19 +548,19 @@ export default {
548
548
  }
549
549
  return array
550
550
  },
551
- onInput(value) {
551
+ onInput(event) {
552
552
  if (this.isBlurred) {
553
553
  this.isBlurred = false
554
554
  return
555
555
  }
556
- if (value === '' && this.isFocused) {
556
+ if (event.target.value === '') {
557
557
  this.$emit('on-input', '')
558
558
  }
559
559
  let evaluatedVal
560
560
  try {
561
- evaluatedVal = this.onEvaluateCode(value)
561
+ evaluatedVal = this.onEvaluateCode(event)
562
562
  } finally {
563
- if (evaluatedVal && this.isFocused && this.value != evaluatedVal) {
563
+ if (evaluatedVal) {
564
564
  this.$emit('on-input', evaluatedVal)
565
565
  }
566
566
  }
@@ -570,7 +570,7 @@ export default {
570
570
  // setting isBlurred so we don't trigger onInput as well
571
571
  this.isBlurred = true
572
572
  let value = e.target.value
573
- let evaluatedInput = this.onEvaluateCode(value)
573
+ let evaluatedInput = this.onEvaluateCode(e)
574
574
  this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
575
575
  if ((evaluatedInput && value.length) || this.minNumber !== null) {
576
576
  this.textInput = numberToString({
@@ -646,10 +646,10 @@ export default {
646
646
  }
647
647
  },
648
648
  initInteraction(e) {
649
- this.focusInput()
650
- e.preventDefault()
651
649
  window.addEventListener('mousemove', this.interact, false)
652
650
  window.addEventListener('mouseup', this.stopInteract, false)
651
+ e.preventDefault()
652
+ this.focusInput()
653
653
  },
654
654
  interact(e) {
655
655
  e.preventDefault()
@@ -44,7 +44,7 @@
44
44
  // number_max_allowed: 10,
45
45
  // unit_short_name: "cm",
46
46
  // },
47
- import styled from "vue-styled-components"
47
+ import styled from "vue3-styled-components"
48
48
  import {
49
49
  stringToNumber,
50
50
  numberToString,
@@ -66,7 +66,7 @@
66
66
  </template>
67
67
 
68
68
  <script>
69
- import styled from 'vue-styled-components'
69
+ import styled from 'vue3-styled-components'
70
70
  import InfoText from '../../infoText'
71
71
  import Icon from '../../icon'
72
72
  import ErrorMessage from '../../errorMessage'
@@ -332,8 +332,8 @@ export default {
332
332
  this.$emit('on-enter-click')
333
333
  this.$refs.inputElement.$el.blur()
334
334
  },
335
- onChangeHandler($event) {
336
- this.$emit('input-change', $event)
335
+ onChangeHandler(event) {
336
+ this.$emit('input-change', event.target.value)
337
337
  },
338
338
  onInputBlur($event) {
339
339
  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 'vue-styled-components'
63
+ import styled from 'vue3-styled-components'
64
64
  import Modal from '../../modals/modal'
65
65
  import InfoText from '../../infoText'
66
66
 
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <container :inputWidth="inputWidth">
3
- <input-wrapper>
3
+ <input-wrapper :iconPosition="iconPosition" :iconColor="iconColor">
4
+ <SearchIconSvg class="search-icn" />
4
5
  <input-container
5
6
  ref="inputElement"
6
7
  :placeholder="placeholder"
@@ -13,10 +14,6 @@
13
14
  :hasFocus="hasFocus"
14
15
  :data-id="dataId"
15
16
  />
16
- <img
17
- class="search-icn"
18
- :src="require('../../../assets/icons/search_icon_black.svg')"
19
- />
20
17
  </input-wrapper>
21
18
  </container>
22
19
  </template>
@@ -32,8 +29,11 @@
32
29
  // @on-change="function($event)"
33
30
  // :isFilter="true" // to set the height at 30px
34
31
  // data-id="test-data-id"
32
+ // iconPosition="left"
33
+ // iconColor="grey2"
35
34
  // />
36
- import styled from 'vue-styled-components'
35
+ import styled from 'vue3-styled-components'
36
+ import SearchIconSvg from '../../../assets/icons/search_icon_black.svg'
37
37
 
38
38
  const inputAttrs = {
39
39
  isDisabled: Boolean,
@@ -68,11 +68,18 @@ const InputContainer = styled('input', inputAttrs)`
68
68
  const InputWrapper = styled.span`
69
69
  position: relative;
70
70
 
71
- img {
71
+ svg {
72
72
  position: absolute;
73
- right: 10px;
74
- top: 50%;
75
73
  transform: translateY(-50%);
74
+ top: 50%;
75
+ ${(props) => (props.iconPosition === 'right' ? 'right' : 'left')}: 10px;
76
+
77
+ path {
78
+ fill: ${(props) =>
79
+ props.theme.colors[props.iconColor]
80
+ ? props.theme.colors[props.iconColor]
81
+ : props.iconColor};
82
+ }
76
83
  }
77
84
  `
78
85
 
@@ -81,7 +88,8 @@ export default {
81
88
  components: {
82
89
  InputContainer,
83
90
  InputWrapper,
84
- Container
91
+ Container,
92
+ SearchIconSvg
85
93
  },
86
94
  props: {
87
95
  value: {
@@ -110,11 +118,20 @@ export default {
110
118
  dataId: {
111
119
  required: false,
112
120
  default: ''
121
+ },
122
+ iconPosition: {
123
+ type: String,
124
+ default: 'right'
125
+ },
126
+ iconColor: {
127
+ type: String,
128
+ default: 'black'
113
129
  }
114
130
  },
131
+ emits: ['on-change'],
115
132
  methods: {
116
133
  onChangeHandler(event) {
117
- this.$emit('on-change', event)
134
+ this.$emit('on-change', event.target.value)
118
135
  },
119
136
  focusInputElement() {
120
137
  this.$nextTick(() => {