@eturnity/eturnity_reusable_components 1.2.26-EPDM-3412.5 → 1.2.27

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.
@@ -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,19 +8,17 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="14px"
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
- :inputHeight="inputHeight"
24
22
  :minWidth="minWidth"
25
23
  :value="formatWithCurrency(value)"
26
24
  @blur="onInputBlur($event)"
@@ -32,25 +30,13 @@
32
30
  :textAlign="textAlign"
33
31
  :fontSize="fontSize"
34
32
  :fontColor="fontColor"
35
- v-on="$listeners"
36
- :hasSlot="hasSlot"
37
- :slotSize="slotSize"
38
33
  />
39
- <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
40
- <slot></slot>
41
- </slot-container>
42
-
43
34
  <unit-container
44
- v-if="unitName && showLinearUnitName && !hasSlot"
35
+ v-if="unitName && showLinearUnitName"
45
36
  :hasLength="!!textInput.length"
46
37
  :isError="isError"
47
38
  >{{ unitName }}</unit-container
48
39
  >
49
- <icon
50
- v-if="(isError || inputIcon) && !showLinearUnitName"
51
- :class="inputIconImageClass"
52
- :src="isError ? warningIcon : inputIconImage"
53
- />
54
40
  </input-wrapper>
55
41
  <error-message v-if="isError">{{ errorMessage }}</error-message>
56
42
  </container>
@@ -88,8 +74,11 @@ import {
88
74
  numberToString
89
75
  } from '../../../helpers/numberConverter'
90
76
  import InfoText from '../../infoText'
91
- import ErrorMessage from '../../errorMessage'
92
- import warningIcon from '../../../assets/icons/error_icon.png'
77
+
78
+ const Container = styled.div`
79
+ width: 100%;
80
+ position: relative;
81
+ `
93
82
 
94
83
  const inputProps = {
95
84
  isError: Boolean,
@@ -100,17 +89,8 @@ const inputProps = {
100
89
  noBorder: Boolean,
101
90
  textAlign: String,
102
91
  fontSize: String,
103
- fontColor: String,
104
- hasSlot: Boolean,
105
- slotSize: String,
106
- inputHeight: String
92
+ fontColor: String
107
93
  }
108
-
109
- const Container = styled('div', inputProps)`
110
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
111
- position: relative;
112
- `
113
-
114
94
  const InputContainer = styled('input', inputProps)`
115
95
  border: ${(props) =>
116
96
  props.isError
@@ -118,24 +98,15 @@ const InputContainer = styled('input', inputProps)`
118
98
  : props.noBorder
119
99
  ? 'none'
120
100
  : '1px solid ' + props.theme.colors.mediumGray};
121
- padding-top: 11px;
122
- padding-bottom: 11px;
123
- padding-left: 10px;
124
- padding-right: ${(props) =>
125
- props.slotSize
126
- ? 'calc(' + props.slotSize + ' + 10px)'
127
- : props.hasUnit
128
- ? '40px'
129
- : '5px'};
101
+ padding: ${(props) =>
102
+ props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
130
103
  border-radius: 4px;
131
104
  text-align: ${(props) => props.textAlign};
132
105
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
133
106
  font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
134
107
  color: ${(props) =>
135
108
  props.isError
136
- ? props.theme.colors.grey6
137
- : props.isDisabled
138
- ? props.theme.colors.grey2
109
+ ? props.theme.colors.red
139
110
  : props.fontColor
140
111
  ? props.fontColor + ' !important'
141
112
  : props.theme.colors.black};
@@ -144,7 +115,7 @@ const InputContainer = styled('input', inputProps)`
144
115
  background-color: ${(props) =>
145
116
  props.isDisabled ? props.theme.colors.grey5 : '#fff'};
146
117
  box-sizing: border-box;
147
- max-height: ${(props) => props.inputHeight};
118
+
148
119
  &::placeholder {
149
120
  color: ${(props) =>
150
121
  props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
@@ -154,15 +125,6 @@ const InputContainer = styled('input', inputProps)`
154
125
  outline: none;
155
126
  }
156
127
  `
157
- const IconProps = {
158
- inputIconHeight: String
159
- }
160
-
161
- const Icon = styled('img', IconProps)`
162
- position: absolute;
163
- right: 10px;
164
- top: 2px;
165
- `
166
128
 
167
129
  const InputWrapper = styled.span`
168
130
  position: relative;
@@ -180,7 +142,6 @@ const UnitContainer = styled('span', inputProps)`
180
142
  right: 10px;
181
143
  top: 0;
182
144
  padding-left: 10px;
183
- text-align: right;
184
145
  color: ${(props) =>
185
146
  props.isError
186
147
  ? props.theme.colors.red
@@ -189,27 +150,11 @@ const UnitContainer = styled('span', inputProps)`
189
150
  : props.theme.colors.mediumGray};
190
151
  `
191
152
 
192
- const SlotContainer = styled('span', inputProps)`
193
- text-align: right;
194
- border-left: 1px solid
195
- ${(props) =>
196
- props.isError
197
- ? props.theme.colors.red
198
- : props.hasLength
199
- ? props.theme.colors.black
200
- : props.theme.colors.mediumGray};
153
+ const ErrorMessage = styled.div`
154
+ font-size: 14px;
155
+ color: ${(props) => props.theme.colors.red};
201
156
  position: absolute;
202
- width: ${(props) =>
203
- props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
204
- right: 10px;
205
- top: 0;
206
- padding-left: 10px;
207
- color: ${(props) =>
208
- props.isError
209
- ? props.theme.colors.red
210
- : props.hasLength
211
- ? props.theme.colors.black
212
- : props.theme.colors.mediumGray};
157
+ top: calc(100% + 1px);
213
158
  `
214
159
 
215
160
  const LabelWrapper = styled.div`
@@ -219,9 +164,8 @@ const LabelWrapper = styled.div`
219
164
  `
220
165
 
221
166
  const LabelText = styled.div`
167
+ font-weight: bold;
222
168
  font-size: 13px;
223
- color: ${(props) => props.theme.colors.eturnityGrey};
224
- font-weight: 700;
225
169
  `
226
170
 
227
171
  export default {
@@ -234,16 +178,12 @@ export default {
234
178
  ErrorMessage,
235
179
  LabelWrapper,
236
180
  LabelText,
237
- InfoText,
238
- Icon,
239
- SlotContainer
181
+ InfoText
240
182
  },
241
- inheritAttrs: false,
242
183
  data() {
243
184
  return {
244
185
  textInput: '',
245
- isFocused: false,
246
- warningIcon: warningIcon
186
+ isFocused: false
247
187
  }
248
188
  },
249
189
  props: {
@@ -263,10 +203,6 @@ export default {
263
203
  required: false,
264
204
  default: null
265
205
  },
266
- inputHeight: {
267
- required: false,
268
- default: null
269
- },
270
206
  value: {
271
207
  required: true,
272
208
  default: null
@@ -317,7 +253,7 @@ export default {
317
253
  },
318
254
  labelInfoAlign: {
319
255
  required: false,
320
- default: 'left'
256
+ default: 'right'
321
257
  },
322
258
  minNumber: {
323
259
  required: false,
@@ -330,50 +266,13 @@ export default {
330
266
  numberToStringEnabled: {
331
267
  required: false,
332
268
  default: true
333
- },
334
- inputIcon: {
335
- require: false,
336
- type: Boolean,
337
- default: false
338
- },
339
- inputIconImage: {
340
- require: false,
341
- type: String,
342
- default: ''
343
- },
344
- allowNegative: {
345
- required: false,
346
- default: true
347
- },
348
- inputIconImageClass: {
349
- require: false,
350
- type: Array,
351
- default: () => []
352
- },
353
- slotSize: {
354
- required: false
355
- }
356
- },
357
- computed: {
358
- displayedPlaceholder() {
359
- if (this.placeholder) return this.placeholder
360
- return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
361
- },
362
- hasSlot() {
363
- return !!this.$slots.default
364
- },
365
- computedSlotSize() {
366
- return this.slotSize || this.$slots['default'][0].elm.clientWidth
367
269
  }
368
270
  },
369
271
  methods: {
370
272
  onChangeHandler(event) {
371
- if (isNaN(event) || event == '') {
273
+ if (isNaN(event)) {
372
274
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
373
275
  }
374
- if (!this.allowNegative) {
375
- event = Math.abs(event)
376
- }
377
276
  this.$emit('input-change', event)
378
277
  },
379
278
  onEvaluateCode(val) {
@@ -406,8 +305,6 @@ export default {
406
305
  value: evaluated,
407
306
  numberPrecision: this.numberPrecision
408
307
  })
409
- } else if (typeof evaluated === 'number') {
410
- evaluated = evaluated.toFixed(this.numberPrecision)
411
308
  }
412
309
  return evaluated
413
310
  },
@@ -424,8 +321,8 @@ export default {
424
321
  })
425
322
  }
426
323
  let adjustedMinValue =
427
- evaluatedInput && evaluatedInput.length
428
- ? evaluatedInput
324
+ value && value.length
325
+ ? value
429
326
  : this.minNumber || this.minNumber === 0
430
327
  ? this.minNumber
431
328
  : ''
@@ -439,7 +336,6 @@ export default {
439
336
  this.$nextTick(() => {
440
337
  this.$refs.inputField1.$el.select()
441
338
  })
442
- this.$emit('input-focus')
443
339
  },
444
340
  formatWithCurrency(value) {
445
341
  let adjustedMinValue =
@@ -456,7 +352,6 @@ export default {
456
352
  })
457
353
  : adjustedMinValue
458
354
  let unit = this.showLinearUnitName ? '' : this.unitName
459
- //return input + ' ' + unit
460
355
  return input + ' ' + unit
461
356
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
462
357
  return ''
@@ -10,42 +10,38 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- :size="fontSize ? fontSize : '16px'"
13
+ :size="fontSize ? fontSize : '16'"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
17
- <input-error-wrapper>
18
- <icon-container>
19
- <input-container
20
- :placeholder="placeholder"
21
- :isError="isError"
22
- :inputWidth="inputWidth"
23
- :minWidth="minWidth"
24
- :value="value"
25
- @input="onChangeHandler"
26
- :noBorder="noBorder"
27
- :disabled="disabled"
28
- :isDisabled="disabled"
29
- :fontSize="fontSize"
30
- :inputType="inputType"
31
- :type="inputTypeData"
32
- />
33
- <icon-wrapper
34
- v-if="inputType === 'password' && !isError"
35
- @click="toggleShowPassword()"
36
- size="20px"
37
- >
38
- <icon name="current_variant" size="20px" />
39
- </icon-wrapper>
40
- <icon-wrapper v-if="isError" size="16px">
41
- <icon name="warning" size="16px" cursor="default" />
42
- </icon-wrapper>
43
- </icon-container>
44
- <error-message v-if="isError && errorMessage">{{
45
- errorMessage
46
- }}</error-message>
47
- </input-error-wrapper>
17
+ <icon-container>
18
+ <input-container
19
+ :placeholder="placeholder"
20
+ :isError="isError"
21
+ :inputWidth="inputWidth"
22
+ :minWidth="minWidth"
23
+ :value="value"
24
+ @input="onChangeHandler"
25
+ :noBorder="noBorder"
26
+ :disabled="disabled"
27
+ :isDisabled="disabled"
28
+ :fontSize="fontSize"
29
+ :inputType="inputType"
30
+ :type="inputTypeData"
31
+ />
32
+ <icon-wrapper
33
+ v-if="inputType === 'password' && !isError"
34
+ @click="toggleShowPassword()"
35
+ size="20px"
36
+ >
37
+ <icon name="current_variant" size="20px" />
38
+ </icon-wrapper>
39
+ <icon-wrapper v-if="isError" size="16px">
40
+ <icon name="warning" size="16px" cursor="default" />
41
+ </icon-wrapper>
42
+ </icon-container>
48
43
  </input-wrapper>
44
+ <error-message v-if="isError">{{ errorMessage }}</error-message>
49
45
  </container>
50
46
  </template>
51
47
 
@@ -53,7 +49,6 @@
53
49
  import styled from 'vue-styled-components'
54
50
  import InfoText from '../../infoText'
55
51
  import Icon from '../../icon'
56
- import ErrorMessage from '../../errorMessage'
57
52
 
58
53
  const Container = styled.div`
59
54
  width: 100%;
@@ -62,9 +57,8 @@ const Container = styled.div`
62
57
 
63
58
  const labelAttrs = { fontSize: String }
64
59
  const InputLabel = styled('div', labelAttrs)`
65
- color: ${(props) => props.theme.colors.eturnityGrey};
60
+ font-weight: bold;
66
61
  font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
67
- font-weight: 700;
68
62
  `
69
63
 
70
64
  const LabelWrapper = styled.div`
@@ -75,13 +69,6 @@ const LabelWrapper = styled.div`
75
69
  justify-content: start;
76
70
  `
77
71
 
78
- const InputErrorWrapper = styled.div`
79
- display: inline-grid;
80
- grid-template-row: auto auto;
81
- grid-gap: 0px;
82
- align-items: center;
83
- `
84
-
85
72
  const inputProps = {
86
73
  isError: Boolean,
87
74
  inputWidth: String,
@@ -110,11 +97,7 @@ const InputContainer = styled('input', inputProps)`
110
97
  position: relative;
111
98
  font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
112
99
  color: ${(props) =>
113
- props.isError
114
- ? props.theme.colors.grey6
115
- : props.isDisabled
116
- ? props.theme.colors.grey2
117
- : props.theme.colors.black};
100
+ props.isError ? props.theme.colors.red : props.theme.colors.black};
118
101
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
119
102
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
120
103
  box-sizing: border-box; // to allow width of 100% with padding
@@ -143,6 +126,13 @@ const InputWrapper = styled('div', inputAttrs)`
143
126
  props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
144
127
  `
145
128
 
129
+ const ErrorMessage = styled.div`
130
+ font-size: 14px;
131
+ color: ${(props) => props.theme.colors.red};
132
+ position: absolute;
133
+ top: calc(100% + 1px);
134
+ `
135
+
146
136
  const IconAttrs = { size: String }
147
137
  const IconWrapper = styled('div', IconAttrs)`
148
138
  position: absolute;
@@ -185,8 +175,7 @@ export default {
185
175
  LabelWrapper,
186
176
  Icon,
187
177
  IconWrapper,
188
- IconContainer,
189
- InputErrorWrapper
178
+ IconContainer
190
179
  },
191
180
  data() {
192
181
  return {
@@ -12,7 +12,7 @@
12
12
  />
13
13
  <span class="checkmark"></span>
14
14
  <label-text :isDisabled="item.disabled">{{ item.label }}</label-text>
15
- <info-text v-if="item.infoText" :text="item.infoText" size="16px" />
15
+ <info-text v-if="item.infoText" :text="item.infoText" size="16" />
16
16
  </label-container>
17
17
  <image-container v-if="item.img">
18
18
  <radio-image :src="item.img" />
@@ -25,9 +25,8 @@
25
25
  // :value="companyName"
26
26
  // :disabled="true"
27
27
  // inputWidth="250px"
28
- // @on-change="function($event)"
29
28
  // />
30
- import styled from 'vue-styled-components'
29
+ import styled from "vue-styled-components"
31
30
 
32
31
  const Container = styled.div`
33
32
  width: 100%;
@@ -35,15 +34,15 @@ const Container = styled.div`
35
34
  `
36
35
 
37
36
  const inputAttrs = { isDisabled: Boolean, inputWidth: String }
38
- const InputContainer = styled('input', inputAttrs)`
37
+ const InputContainer = styled("input", inputAttrs)`
39
38
  border: 1px solid ${(props) => props.theme.colors.mediumGray};
40
39
  padding: 11px 30px 11px 10px;
41
40
  border-radius: 4px;
42
- font-size: 13px;
41
+ font-size: 16px;
43
42
  color: ${(props) => props.theme.colors.black};
44
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
43
+ width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
45
44
  box-sizing: border-box;
46
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
45
+ cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
47
46
  background: ${(props) => props.theme.colors.white} !important;
48
47
  &::placeholder {
49
48
  color: ${(props) => props.theme.colors.darkGray};
@@ -66,33 +65,33 @@ const InputWrapper = styled.span`
66
65
  `
67
66
 
68
67
  export default {
69
- name: 'search-input',
68
+ name: "search-input",
70
69
  components: {
71
70
  InputContainer,
72
71
  InputWrapper,
73
- Container
72
+ Container,
74
73
  },
75
74
  props: {
76
75
  value: {
77
- required: true
76
+ required: true,
78
77
  },
79
78
  disabled: {
80
79
  required: false,
81
- default: false
80
+ default: false,
82
81
  },
83
82
  placeholder: {
84
83
  required: false,
85
- default: ''
84
+ default: "",
86
85
  },
87
86
  inputWidth: {
88
87
  required: false,
89
- default: null
90
- }
88
+ default: null,
89
+ },
91
90
  },
92
91
  methods: {
93
92
  onChangeHandler(event) {
94
- this.$emit('on-change', event)
95
- }
96
- }
93
+ this.$emit("on-change", event)
94
+ },
95
+ },
97
96
  }
98
97
  </script>
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="16px"
13
+ size="16"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
@@ -23,7 +23,6 @@
23
23
  :disabled="isDisabled"
24
24
  :fontSize="fontSize"
25
25
  @input="onChangeHandler"
26
- :resize="resize"
27
26
  />
28
27
  </input-wrapper>
29
28
  <error-message v-if="isError && errorText">{{ errorText }}</error-message>
@@ -45,11 +44,9 @@
45
44
  // label="Question 5"
46
45
  // alignItems="horizontal" // horizontal, vertical
47
46
  // :isDisabled="true"
48
- // . fontSize="13px"
49
47
  // />
50
48
  import styled from 'vue-styled-components'
51
49
  import InfoText from '../../infoText'
52
- import ErrorMessage from '../../errorMessage'
53
50
 
54
51
  const containerProps = { inputWidth: String }
55
52
  const Container = styled('div', containerProps)`
@@ -110,6 +107,13 @@ const InputWrapper = styled('div', inputAttrs)`
110
107
  : 'auto 1fr'};
111
108
  `
112
109
 
110
+ const ErrorMessage = styled.div`
111
+ font-size: 14px;
112
+ color: ${(props) => props.theme.colors.red};
113
+ position: absolute;
114
+ top: calc(100% + 1px);
115
+ `
116
+
113
117
  const labelAttrs = { fontSize: String }
114
118
  const InputLabel = styled('div', labelAttrs)`
115
119
  font-weight: bold;
@@ -171,10 +175,6 @@ export default {
171
175
  inputWidth: {
172
176
  required: false,
173
177
  default: null
174
- },
175
- resize: {
176
- required: false,
177
- default: 'none'
178
178
  }
179
179
  },
180
180
  methods: {
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="14px"
13
+ size="14"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-container>
@@ -46,7 +46,7 @@
46
46
  v-if="infoTextMessage"
47
47
  :text="infoTextMessage"
48
48
  borderColor="#ccc"
49
- size="14px"
49
+ size="14"
50
50
  :alignText="infoTextAlign"
51
51
  />
52
52
  </label-container>
@@ -6,7 +6,7 @@
6
6
  <info-text
7
7
  :text="infoText"
8
8
  v-if="!!infoText"
9
- size="14px"
9
+ size="14"
10
10
  borderColor="#ccc"
11
11
  :alignText="alignInfoText"
12
12
  />