@eturnity/eturnity_reusable_components 1.2.16-QA03-23092022.4 → 1.2.17

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": "1.2.16-QA03-23092022.4",
3
+ "version": "1.2.17",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -13,8 +13,7 @@
13
13
  "@vueform/slider": "1.0.5",
14
14
  "core-js": "^3.6.5",
15
15
  "vue": "^2.6.11",
16
- "vue-styled-components": "^1.6.0",
17
- "html-loader": "^0.5.5"
16
+ "vue-styled-components": "^1.6.0"
18
17
  },
19
18
  "devDependencies": {
20
19
  "@storybook/addon-actions": "^6.2.8",
@@ -29,7 +28,8 @@
29
28
  "babel-eslint": "^10.1.0",
30
29
  "eslint": "^6.7.2",
31
30
  "eslint-plugin-vue": "^6.2.2",
32
- "vue-template-compiler": "^2.6.11"
31
+ "vue-template-compiler": "^2.6.11",
32
+ "html-loader": "^0.5.5"
33
33
  },
34
34
  "eslintConfig": {
35
35
  "root": true,
package/src/App.vue CHANGED
@@ -1,14 +1,57 @@
1
1
  <template>
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
+ <main-table titleText="My Table">
5
+ <thead>
6
+ <tr>
7
+ <th>Column 1</th>
8
+ <th>Column 2</th>
9
+ <th>Column 3</th>
10
+ <div />
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <tr>
15
+ <!-- <table-dropdown
16
+ :colSpan="3"
17
+ :tableItems="getDropdownValues()"
18
+ @toggle-dropdown-open="toggleDropdownOpen()"
19
+ @item-selected="onItemSelected({ item: $event, index })"
20
+ :isOpen="isDropdownOpen()"
21
+ :optionItems="itemOptions"
22
+ :optionsDisplay="['display_name', 'company_item_number', 'model']"
23
+ /> -->
24
+ <td>Test</td>
25
+ <div class="icons-container">
26
+ <three-dots :options="listOptions" :isLoading="false" />
27
+ </div>
28
+ </tr>
29
+ </tbody>
30
+ </main-table>
31
+ <br />
32
+ <br />
33
+ <toggle
34
+ @on-toggle-change="onInputChange($event)"
35
+ :isChecked="inputValue"
36
+ label="My Label Text"
37
+ infoTextMessage="This is my test message"
38
+ infoTextAlign="right"
39
+ labelAlign="right"
40
+ :disabled="false"
41
+ />
42
+ <br />
4
43
  <input-number
5
- :value="num"
6
- @input-change="num = $event"
7
- unitName="t"
8
- id="biebie"
9
- test="koko"
10
- @keydown="keydownHandler"
44
+ placeholder="Enter distance"
45
+ :numberPrecision="2"
46
+ :value="inputValue"
47
+ @input-change="onInputChange($event)"
11
48
  />
49
+ <br />
50
+
51
+ <icon name="info" color="red" size="50px" />
52
+ <icon name="info" color="#F00" size="50px" />
53
+ <icon name="info" color="blue1" size="50px" />
54
+ <icon name="info" color="#00F" size="50px" />
12
55
  </page-container>
13
56
  </ThemeProvider>
14
57
  </template>
@@ -17,6 +60,7 @@
17
60
  import { ThemeProvider } from 'vue-styled-components'
18
61
  import theme from './assets/theme'
19
62
  import styled from 'vue-styled-components'
63
+ import icon from '@/components/icon'
20
64
  import InputNumber from '@/components/inputs/inputNumber'
21
65
 
22
66
  const PageContainer = styled.div`
@@ -28,12 +72,11 @@ export default {
28
72
  components: {
29
73
  ThemeProvider,
30
74
  PageContainer,
31
- InputNumber
32
- // TableDropdown,
75
+ InputNumber,
76
+ icon
33
77
  },
34
78
  data() {
35
79
  return {
36
- num: 42,
37
80
  inputValue: null,
38
81
  checkedOption: 'button_1',
39
82
  question: {
@@ -92,9 +135,6 @@ export default {
92
135
  }
93
136
  },
94
137
  methods: {
95
- keydownHandler(e) {
96
- console.log('test', e)
97
- },
98
138
  getTheme() {
99
139
  return theme
100
140
  },
@@ -155,4 +195,4 @@ body {
155
195
  height: 100%;
156
196
  margin: 0;
157
197
  }
158
- </style>
198
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <wrapper :size="size">
2
+ <wrapper :isDisabled="isDisabled" :size="size">
3
3
  <icon-image
4
4
  :size="size"
5
5
  :color="color"
@@ -23,11 +23,12 @@
23
23
 
24
24
  import styled from 'vue-styled-components'
25
25
 
26
- const wrapperAttrs = { size: String }
26
+ const wrapperAttrs = { isDisabled: Boolean, size: String }
27
27
  const Wrapper = styled('div', wrapperAttrs)`
28
28
  display: inline-block;
29
29
  width: ${(props) => props.size};
30
30
  height: ${(props) => props.size};
31
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
31
32
  `
32
33
  const IconImageProps = { color: String, hoveredColor: String, size: String }
33
34
  const IconImage = styled('div', IconImageProps)`
@@ -51,6 +52,10 @@ export default {
51
52
  IconImage
52
53
  },
53
54
  props: {
55
+ isDisabled: {
56
+ required: false,
57
+ default: false
58
+ },
54
59
  name: {
55
60
  required: true
56
61
  },
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component-wrapper>
3
- <icon-wrapper :size="size">
3
+ <icon-wrapper>
4
4
  <icon-img
5
5
  :isActive="showInfo"
6
6
  :size="size"
@@ -9,7 +9,20 @@
9
9
  @mouseenter="toggleShowInfo()"
10
10
  @mouseleave="toggleShowInfo()"
11
11
  >
12
- <icon :size="size + 'px'" name="info" :color="iconColor" />
12
+ <svg
13
+ class="img-icon"
14
+ :width="size"
15
+ :height="size"
16
+ viewBox="0 0 24 24"
17
+ fill="none"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ >
20
+ <path
21
+ class="img-icon"
22
+ d="M20.4853 3.51469C18.2188 1.24823 15.2053 0 12 0C8.79469 0 5.78123 1.24823 3.51469 3.51469C1.24823 5.78123 0 8.79469 0 12C0 15.2053 1.24823 18.2188 3.51469 20.4853C5.78123 22.7518 8.79469 24 12 24C15.2053 24 18.2188 22.7518 20.4853 20.4853C22.7518 18.2188 24 15.2053 24 12C24 8.79469 22.7518 5.78123 20.4853 3.51469ZM12 3.28125C13.4216 3.28125 14.5781 4.4378 14.5781 5.85938C14.5781 7.28095 13.4216 8.4375 12 8.4375C10.5784 8.4375 9.42188 7.28095 9.42188 5.85938C9.42188 4.4378 10.5784 3.28125 12 3.28125ZM15.2812 19.6875H8.71875V18.2812H10.125V11.9167H8.71875V10.5104H13.875V18.2812H15.2812V19.6875Z"
23
+ fill="#D5D5D5"
24
+ />
25
+ </svg>
13
26
  </icon-img>
14
27
  <text-overlay
15
28
  v-if="showInfo"
@@ -31,16 +44,19 @@
31
44
  // size="20"
32
45
  // alignText="right" // default is left
33
46
  // />
34
- import theme from '@/assets/theme.js'
35
- import styled from 'vue-styled-components'
36
- import icon from '../icon'
47
+
48
+ import styled from "vue-styled-components"
49
+
50
+ const IconWrapper = styled.div`
51
+ position: relative;
52
+ `
37
53
 
38
54
  const textAttrs = { borderColor: String, alignText: String }
39
- const TextOverlay = styled('div', textAttrs)`
55
+ const TextOverlay = styled("div", textAttrs)`
40
56
  position: absolute;
41
57
  top: 26px;
42
- right: ${(props) => (props.alignText === 'left' ? '-10px' : 'inherit')};
43
- left: ${(props) => (props.alignText === 'left' ? 'inherit' : '-10px')};
58
+ right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
+ left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
44
60
  background: ${(props) => props.theme.colors.black};
45
61
  padding: 10px;
46
62
  width: max-content;
@@ -52,12 +68,12 @@ const TextOverlay = styled('div', textAttrs)`
52
68
  color: ${(props) => props.theme.colors.white};
53
69
 
54
70
  :before {
55
- content: '';
71
+ content: "";
56
72
  background-color: ${(props) => props.theme.colors.black};
57
73
  position: absolute;
58
74
  top: 2px;
59
- right: ${(props) => (props.alignText === 'left' ? '-12px' : 'inherit')};
60
- left: ${(props) => (props.alignText === 'left' ? 'inherit' : '40px')};
75
+ right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
+ left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
61
77
  height: 8px;
62
78
  width: 8px;
63
79
  transform-origin: center center;
@@ -66,15 +82,18 @@ const TextOverlay = styled('div', textAttrs)`
66
82
  `
67
83
 
68
84
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
69
-
70
- const IconWrapper = styled('div', iconAttrs)`
71
- position: relative;
72
- top: 1px;
73
- height: ${(props) => props.size}px;
74
- `
75
- const IconImg = styled('div', iconAttrs)`
85
+ const IconImg = styled("div", iconAttrs)`
76
86
  cursor: pointer;
77
- height: ${(props) => props.size}px;
87
+ height: ${(props) => props.size + "px"};
88
+
89
+ .img-icon {
90
+ fill: ${(props) =>
91
+ props.isActive
92
+ ? props.borderColor
93
+ ? props.borderColor
94
+ : props.theme.colors.secondary
95
+ : props.theme.colors.mediumGray};
96
+ }
78
97
  `
79
98
 
80
99
  const ComponentWrapper = styled.div`
@@ -82,39 +101,38 @@ const ComponentWrapper = styled.div`
82
101
  `
83
102
 
84
103
  export default {
85
- name: 'info-text',
104
+ name: "info-text",
86
105
  components: {
87
106
  IconWrapper,
88
107
  TextOverlay,
89
108
  ComponentWrapper,
90
109
  IconImg,
91
- icon
92
110
  },
93
111
  props: {
94
112
  text: {
95
- required: true
113
+ required: true,
96
114
  },
97
115
  borderColor: {
98
116
  required: false,
99
- default: null
117
+ default: null,
100
118
  },
101
119
  size: {
102
120
  required: false,
103
- default: '14'
121
+ default: "20",
104
122
  },
105
123
  alignText: {
106
124
  required: false,
107
- default: 'left' // "left" or "right"
108
- }
125
+ default: "left", // "left" or "right"
126
+ },
109
127
  },
110
128
  methods: {
111
129
  toggleShowInfo() {
112
130
  this.showInfo = !this.showInfo
113
131
 
114
132
  if (this.showInfo) {
115
- document.addEventListener('click', this.clickOutside)
133
+ document.addEventListener("click", this.clickOutside)
116
134
  } else {
117
- document.removeEventListener('click', this.clickOutside)
135
+ document.removeEventListener("click", this.clickOutside)
118
136
  }
119
137
  },
120
138
  clickOutside(event) {
@@ -122,21 +140,12 @@ export default {
122
140
  return
123
141
  }
124
142
  this.toggleShowInfo()
125
- }
143
+ },
126
144
  },
127
145
  data() {
128
146
  return {
129
- showInfo: false
147
+ showInfo: false,
130
148
  }
131
149
  },
132
- computed: {
133
- iconColor() {
134
- return this.isActive
135
- ? this.borderColor
136
- ? this.borderColor
137
- : theme.colors.secondary
138
- : theme.colors.mediumGray
139
- }
140
- }
141
150
  }
142
- </script>
151
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container :inputWidth="inputWidth">
2
+ <container>
3
3
  <label-wrapper v-if="labelText">
4
4
  <label-text>
5
5
  {{ labelText }}
@@ -8,16 +8,15 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="14"
11
+ size="13"
12
12
  :alignText="labelInfoAlign"
13
13
  />
14
14
  </label-wrapper>
15
15
  <input-wrapper>
16
16
  <input-container
17
- v-bind="$attrs"
18
17
  ref="inputField1"
19
18
  :hasUnit="unitName && !!unitName.length"
20
- :placeholder="displayedPlaceholder"
19
+ :placeholder="placeholder"
21
20
  :isError="isError"
22
21
  :inputWidth="inputWidth"
23
22
  :minWidth="minWidth"
@@ -31,16 +30,9 @@
31
30
  :textAlign="textAlign"
32
31
  :fontSize="fontSize"
33
32
  :fontColor="fontColor"
34
- :hasSlot="hasSlot"
35
- :slotSize="slotSize"
36
- v-on="$listeners"
37
33
  />
38
- <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
39
- <slot></slot>
40
- </slot-container>
41
-
42
34
  <unit-container
43
- v-if="unitName && showLinearUnitName && !hasSlot"
35
+ v-if="unitName && showLinearUnitName"
44
36
  :hasLength="!!textInput.length"
45
37
  :isError="isError"
46
38
  >{{ unitName }}</unit-container
@@ -83,6 +75,11 @@ import {
83
75
  } from '../../../helpers/numberConverter'
84
76
  import InfoText from '../../infoText'
85
77
 
78
+ const Container = styled.div`
79
+ width: 100%;
80
+ position: relative;
81
+ `
82
+
86
83
  const inputProps = {
87
84
  isError: Boolean,
88
85
  hasUnit: Boolean,
@@ -92,16 +89,8 @@ const inputProps = {
92
89
  noBorder: Boolean,
93
90
  textAlign: String,
94
91
  fontSize: String,
95
- fontColor: String,
96
- hasSlot: Boolean,
97
- slotSize: String
92
+ fontColor: String
98
93
  }
99
-
100
- const Container = styled('div', inputProps)`
101
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
102
- position: relative;
103
- `
104
-
105
94
  const InputContainer = styled('input', inputProps)`
106
95
  border: ${(props) =>
107
96
  props.isError
@@ -109,15 +98,8 @@ const InputContainer = styled('input', inputProps)`
109
98
  : props.noBorder
110
99
  ? 'none'
111
100
  : '1px solid ' + props.theme.colors.mediumGray};
112
- padding-top: 11px;
113
- padding-bottom: 11px;
114
- padding-left: 10px;
115
- padding-right: ${(props) =>
116
- props.slotSize
117
- ? 'calc(' + props.slotSize + ' + 10px)'
118
- : props.hasUnit
119
- ? '40px'
120
- : '5px'};
101
+ padding: ${(props) =>
102
+ props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
121
103
  border-radius: 4px;
122
104
  text-align: ${(props) => props.textAlign};
123
105
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -160,7 +142,6 @@ const UnitContainer = styled('span', inputProps)`
160
142
  right: 10px;
161
143
  top: 0;
162
144
  padding-left: 10px;
163
- text-align: right;
164
145
  color: ${(props) =>
165
146
  props.isError
166
147
  ? props.theme.colors.red
@@ -169,28 +150,6 @@ const UnitContainer = styled('span', inputProps)`
169
150
  : props.theme.colors.mediumGray};
170
151
  `
171
152
 
172
- const SlotContainer = styled('span', inputProps)`
173
- text-align: right;
174
- border-left: 1px solid
175
- ${(props) =>
176
- props.isError
177
- ? props.theme.colors.red
178
- : props.hasLength
179
- ? props.theme.colors.black
180
- : props.theme.colors.mediumGray};
181
- position: absolute;
182
- width: ${(props) =>
183
- props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
184
- right: 10px;
185
- top: 0;
186
- padding-left: 10px;
187
- color: ${(props) =>
188
- props.isError
189
- ? props.theme.colors.red
190
- : props.hasLength
191
- ? props.theme.colors.black
192
- : props.theme.colors.mediumGray};
193
- `
194
153
  const ErrorMessage = styled.div`
195
154
  font-size: 14px;
196
155
  color: ${(props) => props.theme.colors.red};
@@ -219,10 +178,8 @@ export default {
219
178
  ErrorMessage,
220
179
  LabelWrapper,
221
180
  LabelText,
222
- SlotContainer,
223
181
  InfoText
224
182
  },
225
- inheritAttrs: false,
226
183
  data() {
227
184
  return {
228
185
  textInput: '',
@@ -309,22 +266,6 @@ export default {
309
266
  numberToStringEnabled: {
310
267
  required: false,
311
268
  default: true
312
- },
313
- slotSize: {
314
- required: false
315
- }
316
- },
317
- computed: {
318
- hasSlot() {
319
- console.log(this.$slots.default)
320
- return !!this.$slots.default
321
- },
322
- computedSlotSize() {
323
- return this.slotSize || this.$slots['default'][0].elm.clientWidth
324
- },
325
- displayedPlaceholder() {
326
- if (this.placeholder) return this.placeholder
327
- return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
328
269
  }
329
270
  },
330
271
  methods: {
@@ -358,11 +299,13 @@ export default {
358
299
  return num
359
300
  }
360
301
  })
361
- let evaluated = eval(formatted.join('')) || ''
362
- evaluated = stringToNumber({
363
- value: evaluated,
364
- numberPrecision: this.numberPrecision
365
- })
302
+ let evaluated = eval(formatted.join(''))
303
+ if (typeof evaluated === 'string') {
304
+ evaluated = stringToNumber({
305
+ value: evaluated,
306
+ numberPrecision: this.numberPrecision
307
+ })
308
+ }
366
309
  return evaluated
367
310
  },
368
311
  onInputBlur(e) {
@@ -444,4 +387,4 @@ export default {
444
387
  }
445
388
  }
446
389
  }
447
- </script>
390
+ </script>
@@ -4,20 +4,21 @@ export const stringToNumber = ({
4
4
  allowNegative
5
5
  }) => {
6
6
  // This is for saving. It converts our input string to a readable number
7
- if (value === undefined) {
8
- value = ''
9
- }
10
7
  let newVal = value.toString()
11
8
  const selectedLang = localStorage.getItem('lang')
12
9
  // The first replace will replace not allowed characters with a blank
13
10
  if (
14
11
  selectedLang === 'de-DE' ||
12
+ selectedLang === 'de-de' ||
15
13
  selectedLang === 'no-no' ||
16
14
  selectedLang === 'da-dk' ||
17
15
  selectedLang === 'de-lu' ||
18
16
  selectedLang === 'de-be' ||
19
17
  selectedLang === 'es-es' ||
20
- selectedLang === 'de'
18
+ selectedLang === 'de' ||
19
+ selectedLang === 'it' ||
20
+ selectedLang === 'nl-nl' ||
21
+ selectedLang === 'nl-be'
21
22
  ) {
22
23
  // replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
23
24
  if (allowNegative) {
@@ -45,9 +46,15 @@ export const stringToNumber = ({
45
46
  ) {
46
47
  // replace ' with blank: 1'234.56 --> 1234.56
47
48
  if (allowNegative) {
48
- newVal = newVal.replace(/[^\d-.,']/g, '').replace(/['\s]/g, '')
49
+ newVal = newVal
50
+ .replace(/[^\d-.,']/g, '')
51
+ .replace(/[,\s]/, '')
52
+ .replace(/['\s]/g, '')
49
53
  } else {
50
- newVal = newVal.replace(/[^\d.,']/g, '').replace(/['\s]/g, '')
54
+ newVal = newVal
55
+ .replace(/[^\d.,']/g, '')
56
+ .replace(/[,\s]/, '')
57
+ .replace(/['\s]/g, '')
51
58
  }
52
59
  } else if (
53
60
  selectedLang === 'fr-fr' ||
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M12 -1.04907e-06C14.3734 -8.41587e-07 16.6934 0.703787 18.6668 2.02236C20.6402 3.34094 22.1783 5.21509 23.0865 7.4078C23.9948 9.60051 24.2324 12.0133 23.7694 14.3411C23.3064 16.6689 22.1635 18.8071 20.4853 20.4853C18.807 22.1635 16.6688 23.3064 14.3411 23.7694C12.0133 24.2324 9.6005 23.9948 7.40779 23.0866C5.21508 22.1783 3.34093 20.6402 2.02236 18.6668C0.703782 16.6935 -6.97861e-06 14.3734 -6.77112e-06 12C-6.49289e-06 8.8174 1.26428 5.76515 3.51471 3.51472C5.76515 1.26428 8.8174 -1.32731e-06 12 -1.04907e-06ZM9.74999 19.81L14.25 19.81L14.25 10.81L9.74999 10.81L9.74999 19.81ZM12 8.69C12.445 8.69 12.88 8.55804 13.25 8.31081C13.62 8.06357 13.9084 7.71217 14.0787 7.30104C14.249 6.8899 14.2936 6.4375 14.2068 6.00105C14.1199 5.56459 13.9057 5.16368 13.591 4.84901C13.2763 4.53434 12.8754 4.32005 12.4389 4.23323C12.0025 4.14642 11.5501 4.19097 11.139 4.36127C10.7278 4.53157 10.3764 4.81996 10.1292 5.18997C9.88195 5.55998 9.74999 5.99499 9.74999 6.44C9.75079 7.03649 9.98809 7.60833 10.4099 8.03011C10.8317 8.4519 11.4035 8.68921 12 8.69Z" fill="#B2B9C5"/>
3
- </svg>