@eturnity/eturnity_reusable_components 1.2.14 → 1.2.15-QA03-2092022.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.14",
3
+ "version": "1.2.15-QA03-2092022.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -13,7 +13,8 @@
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"
16
+ "vue-styled-components": "^1.6.0",
17
+ "html-loader": "^0.5.5"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@storybook/addon-actions": "^6.2.8",
@@ -28,8 +29,7 @@
28
29
  "babel-eslint": "^10.1.0",
29
30
  "eslint": "^6.7.2",
30
31
  "eslint-plugin-vue": "^6.2.2",
31
- "vue-template-compiler": "^2.6.11",
32
- "html-loader": "^0.5.5"
32
+ "vue-template-compiler": "^2.6.11"
33
33
  },
34
34
  "eslintConfig": {
35
35
  "root": true,
package/src/App.vue CHANGED
@@ -1,18 +1,20 @@
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
4
+ <br />
5
+ <modal backdrop="dark" :isLoading="false" :isOpen="true">
6
+ <main-table titleText="My Table">
7
+ <thead>
8
+ <tr>
9
+ <th>Column 1</th>
10
+ <th>Column 2</th>
11
+ <th>Column 3</th>
12
+ <div />
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <tr>
17
+ <!-- <table-dropdown
16
18
  :colSpan="3"
17
19
  :tableItems="getDropdownValues()"
18
20
  @toggle-dropdown-open="toggleDropdownOpen()"
@@ -21,14 +23,14 @@
21
23
  :optionItems="itemOptions"
22
24
  :optionsDisplay="['display_name', 'company_item_number', 'model']"
23
25
  /> -->
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 />
26
+ <td>Test</td>
27
+ <div class="icons-container">
28
+ <three-dots :options="listOptions" :isLoading="false" />
29
+ </div>
30
+ </tr>
31
+ </tbody>
32
+ </main-table>
33
+ </modal>
32
34
  <br />
33
35
  <toggle
34
36
  @on-toggle-change="onInputChange($event)"
@@ -41,34 +43,13 @@
41
43
  />
42
44
  <br />
43
45
  <input-number
44
- placeholder="Enter distance"
45
- :numberPrecision="2"
46
- :value="inputValue"
47
- @input-change="onInputChange($event)"
46
+ :value="num"
47
+ @input-change="num = $event"
48
+ unitName="t"
49
+ id="biebie"
50
+ test="koko"
51
+ @keydown="keydownHandler"
48
52
  />
49
- <br />
50
- <page-subtitle text="My Subtitle" infoText="My info Text" />
51
- <spinner size="30px" />
52
- <checkbox
53
- label="Do you accept the Terms?"
54
- :isChecked="true"
55
- size="small"
56
- :isDisabled="false"
57
- />
58
- <external-button text="Click me!" minWidth="500px" />
59
- <icon name="Battery" />
60
- <icon name="Bubble" color="red" hoveredColor="blue" size="60px" />
61
- <icon name="Call" color="red" hoveredColor="blue" size="60px" />
62
- <icon name="Camera" color="yellow" hoveredColor="green" size="60px" />
63
- <icon name="House" color="red" hoveredColor="blue" size="20px" />
64
- <icon name="House" color="red" hoveredColor="blue" size="40px" />
65
- <icon name="House" color="red" hoveredColor="blue" size="80px" />
66
- <icon name="House" color="red" hoveredColor="blue" size="120px" />
67
- <icon name="Area_Active" color="red" hoveredColor="blue" size="150px" />
68
- <icon name="Area_Active" color="red" hoveredColor="blue" size="120px" />
69
- <icon name="Area_Active" color="red" hoveredColor="blue" size="80px" />
70
- <icon name="Area_Active" color="red" hoveredColor="blue" size="40px" />
71
- <collection />
72
53
  </page-container>
73
54
  </ThemeProvider>
74
55
  </template>
@@ -85,8 +66,7 @@ import Checkbox from '@/components/inputs/checkbox'
85
66
  import PageSubtitle from '@/components/pageSubtitle'
86
67
  import Spinner from '@/components/spinner'
87
68
  import ExternalButton from '@/components/buttons/externalButton'
88
- import icon from '@/components/icon'
89
- import collection from '@/components/icons/iconCollection'
69
+ import Modal from '@/components/modals/modal'
90
70
  // import TableDropdown from "@/components/tableDropdown"
91
71
 
92
72
  const PageContainer = styled.div`
@@ -106,12 +86,11 @@ export default {
106
86
  Spinner,
107
87
  Checkbox,
108
88
  ExternalButton,
109
- collection,
110
- icon
111
- // TableDropdown,
89
+ Modal
112
90
  },
113
91
  data() {
114
92
  return {
93
+ num: 42,
115
94
  inputValue: null,
116
95
  checkedOption: 'button_1',
117
96
  question: {
@@ -170,6 +149,9 @@ export default {
170
149
  }
171
150
  },
172
151
  methods: {
152
+ keydownHandler(e) {
153
+ console.log('test', e)
154
+ },
173
155
  getTheme() {
174
156
  return theme
175
157
  },
@@ -14,9 +14,10 @@
14
14
  </label-wrapper>
15
15
  <input-wrapper>
16
16
  <input-container
17
+ v-bind="$attrs"
17
18
  ref="inputField1"
18
19
  :hasUnit="unitName && !!unitName.length"
19
- :placeholder="placeholder"
20
+ :placeholder="displayedPlaceholder"
20
21
  :isError="isError"
21
22
  :inputWidth="inputWidth"
22
23
  :minWidth="minWidth"
@@ -30,6 +31,7 @@
30
31
  :textAlign="textAlign"
31
32
  :fontSize="fontSize"
32
33
  :fontColor="fontColor"
34
+ v-on="$listeners"
33
35
  />
34
36
  <unit-container
35
37
  v-if="unitName && showLinearUnitName"
@@ -68,12 +70,12 @@
68
70
  // :minNumber="0"
69
71
  // fontColor="blue"
70
72
  // />
71
- import styled from "vue-styled-components"
73
+ import styled from 'vue-styled-components'
72
74
  import {
73
75
  stringToNumber,
74
- numberToString,
75
- } from "../../../helpers/numberConverter"
76
- import InfoText from "../../infoText"
76
+ numberToString
77
+ } from '../../../helpers/numberConverter'
78
+ import InfoText from '../../infoText'
77
79
 
78
80
  const Container = styled.div`
79
81
  width: 100%;
@@ -89,31 +91,31 @@ const inputProps = {
89
91
  noBorder: Boolean,
90
92
  textAlign: String,
91
93
  fontSize: String,
92
- fontColor: String,
94
+ fontColor: String
93
95
  }
94
- const InputContainer = styled("input", inputProps)`
96
+ const InputContainer = styled('input', inputProps)`
95
97
  border: ${(props) =>
96
98
  props.isError
97
- ? "1px solid " + props.theme.colors.red
99
+ ? '1px solid ' + props.theme.colors.red
98
100
  : props.noBorder
99
- ? "none"
100
- : "1px solid " + props.theme.colors.mediumGray};
101
+ ? 'none'
102
+ : '1px solid ' + props.theme.colors.mediumGray};
101
103
  padding: ${(props) =>
102
- props.hasUnit ? "11px 40px 11px 10px" : "11px 5px 11px 10px"};
104
+ props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
103
105
  border-radius: 4px;
104
106
  text-align: ${(props) => props.textAlign};
105
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
106
- font-size: ${(props) => (props.fontSize ? props.fontSize : "13px")};
107
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
108
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
107
109
  color: ${(props) =>
108
110
  props.isError
109
111
  ? props.theme.colors.red
110
112
  : props.fontColor
111
- ? props.fontColor + " !important"
113
+ ? props.fontColor + ' !important'
112
114
  : props.theme.colors.black};
113
- width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
114
- min-width: ${(props) => (props.minWidth ? props.minWidth : "unset")};
115
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
116
+ min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
115
117
  background-color: ${(props) =>
116
- props.isDisabled ? props.theme.colors.grey5 : "#fff"};
118
+ props.isDisabled ? props.theme.colors.grey5 : '#fff'};
117
119
  box-sizing: border-box;
118
120
 
119
121
  &::placeholder {
@@ -130,7 +132,7 @@ const InputWrapper = styled.span`
130
132
  position: relative;
131
133
  `
132
134
 
133
- const UnitContainer = styled("span", inputProps)`
135
+ const UnitContainer = styled('span', inputProps)`
134
136
  border-left: 1px solid
135
137
  ${(props) =>
136
138
  props.isError
@@ -169,7 +171,7 @@ const LabelText = styled.div`
169
171
  `
170
172
 
171
173
  export default {
172
- name: "input-number",
174
+ name: 'input-number',
173
175
  components: {
174
176
  Container,
175
177
  InputContainer,
@@ -178,131 +180,138 @@ export default {
178
180
  ErrorMessage,
179
181
  LabelWrapper,
180
182
  LabelText,
181
- InfoText,
183
+ InfoText
182
184
  },
185
+ inheritAttrs: false,
183
186
  data() {
184
187
  return {
185
- textInput: "",
186
- isFocused: false,
188
+ textInput: '',
189
+ isFocused: false
190
+ }
191
+ },
192
+ computed: {
193
+ displayedPlaceholder() {
194
+ if (this.placeholder) return this.placeholder
195
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
187
196
  }
188
197
  },
189
198
  props: {
190
199
  placeholder: {
191
200
  required: false,
192
- default: "",
201
+ default: ''
193
202
  },
194
203
  isError: {
195
204
  required: false,
196
- default: false,
205
+ default: false
197
206
  },
198
207
  inputWidth: {
199
208
  required: false,
200
- default: null,
209
+ default: null
201
210
  },
202
211
  minWidth: {
203
212
  required: false,
204
- default: null,
213
+ default: null
205
214
  },
206
215
  value: {
207
216
  required: true,
208
- default: null,
217
+ default: null
209
218
  },
210
219
  clearInput: {
211
220
  required: false,
212
- default: false,
221
+ default: false
213
222
  },
214
223
  errorMessage: {
215
224
  required: false,
216
- default: "Please insert a correct number",
225
+ default: 'Please insert a correct number'
217
226
  },
218
227
  numberPrecision: {
219
228
  required: false,
220
- default: 0,
229
+ default: 0
221
230
  },
222
231
  unitName: {
223
232
  required: false,
224
- default: "",
233
+ default: ''
225
234
  },
226
235
  showLinearUnitName: {
227
236
  required: false,
228
- default: false,
237
+ default: false
229
238
  },
230
239
  disabled: {
231
240
  required: false,
232
- default: false,
241
+ default: false
233
242
  },
234
243
  noBorder: {
235
244
  required: false,
236
- default: false,
245
+ default: false
237
246
  },
238
247
  textAlign: {
239
248
  required: false,
240
- default: "left",
249
+ default: 'left'
241
250
  },
242
251
  fontSize: {
243
252
  required: false,
244
- default: "13px",
253
+ default: '13px'
245
254
  },
246
255
  labelText: {
247
256
  required: false,
248
- default: null,
257
+ default: null
249
258
  },
250
259
  labelInfoText: {
251
260
  required: false,
252
- default: null,
261
+ default: null
253
262
  },
254
263
  labelInfoAlign: {
255
264
  required: false,
256
- default: "right",
265
+ default: 'right'
257
266
  },
258
267
  minNumber: {
259
268
  required: false,
260
- default: null,
269
+ default: null
261
270
  },
262
271
  fontColor: {
263
272
  required: false,
264
- default: null,
273
+ default: null
265
274
  },
266
275
  numberToStringEnabled: {
267
276
  required: false,
268
- default: true,
269
- },
277
+ default: true
278
+ }
270
279
  },
271
280
  methods: {
272
281
  onChangeHandler(event) {
273
282
  if (isNaN(event)) {
274
283
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
284
  }
276
- this.$emit("input-change", event)
285
+ this.$emit('input-change', event)
277
286
  },
278
287
  onEvaluateCode(val) {
279
288
  // function to perform math on the code
280
289
  // filter the string in case of any malicious content
281
- let filtered = val.replace(/[^-()\d/*+.,]/g, "")
290
+ let filtered = val.replace(/[^-()\d/*+.,]/g, '')
282
291
  filtered = filtered.split(/([-+*/()])/)
283
292
  let formatted = filtered.map((item) => {
284
293
  if (
285
- item === "+" ||
286
- item === "-" ||
287
- item === "*" ||
288
- item === "/" ||
289
- item === "(" ||
290
- item === ")" ||
291
- item === ""
294
+ item === '+' ||
295
+ item === '-' ||
296
+ item === '*' ||
297
+ item === '/' ||
298
+ item === '(' ||
299
+ item === ')' ||
300
+ item === ''
292
301
  ) {
293
302
  return item
294
303
  } else {
295
304
  let num = stringToNumber({
296
305
  value: item,
297
- numberPrecision: false,
306
+ numberPrecision: false
298
307
  })
299
308
  return num
300
309
  }
301
310
  })
302
- let evaluated = eval(formatted.join(""))
311
+ let evaluated = eval(formatted.join('')) || ''
303
312
  evaluated = stringToNumber({
304
313
  value: evaluated,
305
- numberPrecision: this.numberPrecision,
314
+ numberPrecision: this.numberPrecision
306
315
  })
307
316
  return evaluated
308
317
  },
@@ -315,7 +324,7 @@ export default {
315
324
  this.textInput = numberToString({
316
325
  value:
317
326
  evaluatedInput && value.length ? evaluatedInput : this.minNumber,
318
- numberPrecision: this.numberPrecision,
327
+ numberPrecision: this.numberPrecision
319
328
  })
320
329
  }
321
330
  let adjustedMinValue =
@@ -323,8 +332,8 @@ export default {
323
332
  ? value
324
333
  : this.minNumber || this.minNumber === 0
325
334
  ? this.minNumber
326
- : ""
327
- this.$emit("input-blur", adjustedMinValue)
335
+ : ''
336
+ this.$emit('input-blur', adjustedMinValue)
328
337
  },
329
338
  focusInput() {
330
339
  if (this.disabled) {
@@ -341,38 +350,38 @@ export default {
341
350
  ? value
342
351
  : this.minNumber || this.minNumber === 0
343
352
  ? this.minNumber
344
- : ""
353
+ : ''
345
354
  if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
346
355
  let input = this.numberToStringEnabled
347
356
  ? numberToString({
348
357
  value: adjustedMinValue,
349
- numberPrecision: this.numberPrecision,
358
+ numberPrecision: this.numberPrecision
350
359
  })
351
360
  : adjustedMinValue
352
- let unit = this.showLinearUnitName ? "" : this.unitName
353
- return input + " " + unit
361
+ let unit = this.showLinearUnitName ? '' : this.unitName
362
+ return input + ' ' + unit
354
363
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
355
- return ""
364
+ return ''
356
365
  } else {
357
366
  return this.numberToStringEnabled
358
367
  ? numberToString({
359
368
  value: adjustedMinValue,
360
- numberPrecision: this.numberPrecision,
369
+ numberPrecision: this.numberPrecision
361
370
  })
362
371
  : adjustedMinValue
363
372
  }
364
- },
373
+ }
365
374
  },
366
375
  created() {
367
376
  if (this.value) {
368
377
  this.textInput = numberToString({
369
378
  value: this.value,
370
- numberPrecision: this.numberPrecision,
379
+ numberPrecision: this.numberPrecision
371
380
  })
372
381
  } else if (this.minNumber !== null) {
373
382
  this.textInput = numberToString({
374
383
  value: this.minNumber,
375
- numberPrecision: this.numberPrecision,
384
+ numberPrecision: this.numberPrecision
376
385
  })
377
386
  }
378
387
  },
@@ -380,9 +389,9 @@ export default {
380
389
  clearInput: function (value) {
381
390
  if (value) {
382
391
  // If the value is typed, then we should clear the textInput on Continue
383
- this.textInput = ""
392
+ this.textInput = ''
384
393
  }
385
- },
386
- },
394
+ }
395
+ }
387
396
  }
388
- </script>
397
+ </script>
@@ -3,15 +3,18 @@
3
3
  :isOpen="isOpen"
4
4
  :class="{ visible: isOpen, hidden: !isOpen }"
5
5
  @click.native="onOutsideClose()"
6
+ :backdrop="backdrop"
6
7
  >
7
8
  <modal-container @click.stop>
8
- <spinner v-if="isLoading" size="50px" :fullWidth="true" />
9
+ <spinner v-if="isLoading" size="50px" :limitedToModal="true" />
10
+ <content-container :visible="!isLoading">
11
+ <slot />
12
+ </content-container>
9
13
  <close-button
10
14
  v-if="!hideClose"
11
15
  @click.native="onCloseModal()"
12
16
  class="close"
13
17
  />
14
- <slot />
15
18
  </modal-container>
16
19
  </page-wrapper>
17
20
  </template>
@@ -28,7 +31,12 @@ import styled from 'vue-styled-components'
28
31
  import CloseButton from '../../buttons/closeButton'
29
32
  import Spinner from '../../spinner'
30
33
 
31
- const pageAttrs = { isOpen: Boolean }
34
+ const contentAttrs = { visible: Boolean }
35
+ const ContentContainer = styled('div', contentAttrs)`
36
+ visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
37
+ `
38
+
39
+ const pageAttrs = { isOpen: Boolean, backdrop: String }
32
40
  const PageWrapper = styled('div', pageAttrs)`
33
41
  position: fixed;
34
42
  display: grid;
@@ -36,7 +44,10 @@ const PageWrapper = styled('div', pageAttrs)`
36
44
  left: 0;
37
45
  width: 100%;
38
46
  height: 100%;
39
- background-color: rgba(255, 255, 255, 0.9);
47
+ background-color: ${(props) =>
48
+ props.backdrop == 'dark'
49
+ ? 'rgba(0, 0, 0, 0.4)'
50
+ : 'rgba(255, 255, 255, 0.9)'};
40
51
  z-index: 99999;
41
52
  overflow: auto;
42
53
 
@@ -98,7 +109,8 @@ export default {
98
109
  PageWrapper,
99
110
  ModalContainer,
100
111
  CloseButton,
101
- Spinner
112
+ Spinner,
113
+ ContentContainer
102
114
  },
103
115
  props: {
104
116
  isOpen: {
@@ -116,6 +128,10 @@ export default {
116
128
  hideClose: {
117
129
  required: false,
118
130
  default: false
131
+ },
132
+ backdrop: {
133
+ required: false,
134
+ default: 'white'
119
135
  }
120
136
  },
121
137
  methods: {
@@ -135,4 +151,4 @@ export default {
135
151
  }
136
152
  }
137
153
  }
138
- </script>
154
+ </script>
@@ -26,5 +26,6 @@ export const Default = Template.bind({
26
26
  preventOutsideClose: true,
27
27
  isLoading: false,
28
28
  hideClose: false,
29
- });
29
+ backdrop: 'dark',
30
+ })
30
31
  Default.args = {};
@@ -7,7 +7,7 @@
7
7
  />
8
8
  </container>
9
9
  </spinner-container>
10
- <container v-else>
10
+ <container v-else :limitedToModal="limitedToModal">
11
11
  <spinner-wrapper
12
12
  :size="size"
13
13
  :src="require('../../assets/icons/black_spinner.svg')"
@@ -18,7 +18,7 @@
18
18
  <script>
19
19
  // import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
20
20
  // <spinner size="30px" />
21
- import styled from "vue-styled-components"
21
+ import styled from 'vue-styled-components'
22
22
 
23
23
  const SpinnerContainer = styled.div`
24
24
  position: fixed;
@@ -32,34 +32,41 @@ const SpinnerContainer = styled.div`
32
32
  justify-items: center;
33
33
  z-index: 100;
34
34
  `
35
-
36
- const Container = styled.div`
35
+ const containerAttrs = { limitedToModal: Boolean }
36
+ const Container = styled('div', containerAttrs)`
37
37
  display: grid;
38
38
  align-items: center;
39
39
  justify-items: center;
40
+ position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
41
+ height: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
42
+ width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
40
43
  `
41
44
 
42
45
  const spinnerAttrs = { size: String }
43
- const SpinnerWrapper = styled("img", spinnerAttrs)`
44
- width: ${(props) => (props.size ? props.size : "60px")};
46
+ const SpinnerWrapper = styled('img', spinnerAttrs)`
47
+ width: ${(props) => (props.size ? props.size : '60px')};
45
48
  `
46
49
 
47
50
  export default {
48
- name: "spinner",
51
+ name: 'spinner',
49
52
  components: {
50
53
  Container,
51
54
  SpinnerWrapper,
52
- SpinnerContainer,
55
+ SpinnerContainer
53
56
  },
54
57
  props: {
55
58
  fullWidth: {
56
59
  required: false,
57
- default: false,
60
+ default: false
58
61
  },
59
- size: {
62
+ limitedToModal: {
60
63
  required: false,
61
- default: null,
64
+ default: false
62
65
  },
63
- },
66
+ size: {
67
+ required: false,
68
+ default: null
69
+ }
70
+ }
64
71
  }
65
- </script>
72
+ </script>