@eturnity/eturnity_reusable_components 1.2.19-EPDM-5262.5 → 1.2.19-EPDM-3412.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.
@@ -33,7 +33,7 @@
33
33
  // backgroundColor="red"
34
34
  // :isDisabled="true"
35
35
  // />
36
- import styled from "vue-styled-components"
36
+ import styled from 'vue-styled-components'
37
37
 
38
38
  const ComponentWrapper = styled.div`
39
39
  min-height: 18px;
@@ -45,34 +45,33 @@ const containerAttrs = {
45
45
  hasLabel: Boolean,
46
46
  backgroundColor: String,
47
47
  isChecked: Boolean,
48
- isDisabled: Boolean,
48
+ isDisabled: Boolean
49
49
  }
50
- const Container = styled("label", containerAttrs)`
50
+ const Container = styled('label', containerAttrs)`
51
51
  display: grid;
52
- grid-template-columns: ${(props) => (props.hasLabel ? "18px auto" : "18px")};
52
+ grid-template-columns: ${(props) => (props.hasLabel ? '18px auto' : '18px')};
53
53
  grid-gap: 16px;
54
54
  align-content: center;
55
- /* align-items: center; */
56
55
  color: ${(props) => props.theme.colors.black};
57
56
  position: relative;
58
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
57
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
59
58
  font-size: 16px;
60
59
  user-select: none;
61
60
 
62
61
  .checkmark {
63
62
  position: absolute;
64
63
  height: ${(props) =>
65
- props.size === "medium"
66
- ? "25px"
67
- : props.size === "small"
68
- ? "16px"
69
- : "25px"};
64
+ props.size === 'medium'
65
+ ? '25px'
66
+ : props.size === 'small'
67
+ ? '16px'
68
+ : '25px'};
70
69
  width: ${(props) =>
71
- props.size === "medium"
72
- ? "25px"
73
- : props.size === "small"
74
- ? "16px"
75
- : "25px"};
70
+ props.size === 'medium'
71
+ ? '25px'
72
+ : props.size === 'small'
73
+ ? '16px'
74
+ : '25px'};
76
75
  background-color: ${(props) =>
77
76
  props.isChecked
78
77
  ? props.backgroundColor
@@ -80,7 +79,7 @@ const Container = styled("label", containerAttrs)`
80
79
  : props.theme.colors.green
81
80
  : props.isDisabled
82
81
  ? props.theme.colors.lightGray
83
- : "#fff"};
82
+ : '#fff'};
84
83
  border-radius: 4px;
85
84
  border: 1px solid
86
85
  ${(props) =>
@@ -91,34 +90,34 @@ const Container = styled("label", containerAttrs)`
91
90
  : props.theme.colors.mediumGray};
92
91
 
93
92
  &:after {
94
- content: "";
93
+ content: '';
95
94
  position: absolute;
96
- display: ${(props) => (props.isChecked ? "block" : "none")};
95
+ display: ${(props) => (props.isChecked ? 'block' : 'none')};
97
96
  }
98
97
  }
99
98
 
100
99
  .checkmark:after {
101
100
  left: ${(props) =>
102
- props.size === "medium" ? "9px" : props.size === "small" ? "5px" : "9px"};
101
+ props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
103
102
  top: ${(props) =>
104
- props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
103
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
105
104
  width: ${(props) =>
106
- props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
105
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
107
106
  height: ${(props) =>
108
- props.size === "medium"
109
- ? "10px"
110
- : props.size === "small"
111
- ? "6px"
112
- : "10px"};
107
+ props.size === 'medium'
108
+ ? '10px'
109
+ : props.size === 'small'
110
+ ? '6px'
111
+ : '10px'};
113
112
  border: solid
114
113
  ${(props) =>
115
114
  props.checkColor ? props.checkColor : props.theme.colors.white};
116
115
  border-width: ${(props) =>
117
- props.size === "medium"
118
- ? "0 3px 3px 0"
119
- : props.size === "small"
120
- ? "0 2px 2px 0"
121
- : "0 3px 3px 0"};
116
+ props.size === 'medium'
117
+ ? '0 3px 3px 0'
118
+ : props.size === 'small'
119
+ ? '0 2px 2px 0'
120
+ : '0 3px 3px 0'};
122
121
  transform: rotate(45deg);
123
122
  }
124
123
  `
@@ -135,49 +134,49 @@ const InputCheckbox = styled.input`
135
134
  const LabelText = styled.div`
136
135
  font-size: 13px;
137
136
  display: grid;
138
- align-items: center;
137
+ align-items: flex-start;
139
138
  min-height: 18px;
140
139
  `
141
140
 
142
141
  export default {
143
- name: "checkbox",
142
+ name: 'checkbox',
144
143
  components: {
145
144
  ComponentWrapper,
146
145
  Container,
147
146
  InputCheckbox,
148
- LabelText,
147
+ LabelText
149
148
  },
150
149
  props: {
151
150
  label: {
152
151
  required: false,
153
- default: "",
152
+ default: ''
154
153
  },
155
154
  isChecked: {
156
155
  required: true,
157
- default: false,
156
+ default: false
158
157
  },
159
158
  checkColor: {
160
- required: false,
159
+ required: false
161
160
  },
162
161
  size: {
163
162
  required: false,
164
- default: "medium", // small, medium
163
+ default: 'medium' // small, medium
165
164
  },
166
165
  backgroundColor: {
167
- required: false,
166
+ required: false
168
167
  },
169
168
  isDisabled: {
170
169
  required: false,
171
- default: false,
172
- },
170
+ default: false
171
+ }
173
172
  },
174
173
  methods: {
175
174
  onChangeHandler(value) {
176
175
  if (this.isDisabled) {
177
176
  return
178
177
  }
179
- this.$emit("on-event-handler", value)
180
- },
181
- },
178
+ this.$emit('on-event-handler', value)
179
+ }
180
+ }
182
181
  }
183
182
  </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,15 +8,16 @@
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"
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,19 +31,19 @@
30
31
  :textAlign="textAlign"
31
32
  :fontSize="fontSize"
32
33
  :fontColor="fontColor"
33
- :hasSlot="hasSlot"
34
- :slotSize="slotSize"
34
+ v-on="$listeners"
35
35
  />
36
- <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
37
- <slot></slot>
38
- </slot-container>
39
-
40
36
  <unit-container
41
- v-if="unitName && showLinearUnitName && !hasSlot"
37
+ v-if="unitName && showLinearUnitName"
42
38
  :hasLength="!!textInput.length"
43
39
  :isError="isError"
44
40
  >{{ unitName }}</unit-container
45
41
  >
42
+ <icon
43
+ v-if="(isError || inputIcon) && !showLinearUnitName"
44
+ :class="inputIconImageClass"
45
+ :src="isError ? warningIcon : inputIconImage"
46
+ />
46
47
  </input-wrapper>
47
48
  <error-message v-if="isError">{{ errorMessage }}</error-message>
48
49
  </container>
@@ -80,6 +81,12 @@ import {
80
81
  numberToString
81
82
  } from '../../../helpers/numberConverter'
82
83
  import InfoText from '../../infoText'
84
+ import ErrorMessage from '../../errorMessage'
85
+ import warningIcon from '../../../assets/icons/error_icon.png'
86
+ const Container = styled.div`
87
+ width: 100%;
88
+ position: relative;
89
+ `
83
90
 
84
91
  const inputProps = {
85
92
  isError: Boolean,
@@ -90,16 +97,8 @@ const inputProps = {
90
97
  noBorder: Boolean,
91
98
  textAlign: String,
92
99
  fontSize: String,
93
- fontColor: String,
94
- hasSlot: Boolean,
95
- slotSize: String
100
+ fontColor: String
96
101
  }
97
-
98
- const Container = styled('div', inputProps)`
99
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
100
- position: relative;
101
- `
102
-
103
102
  const InputContainer = styled('input', inputProps)`
104
103
  border: ${(props) =>
105
104
  props.isError
@@ -107,15 +106,8 @@ const InputContainer = styled('input', inputProps)`
107
106
  : props.noBorder
108
107
  ? 'none'
109
108
  : '1px solid ' + props.theme.colors.mediumGray};
110
- padding-top: 11px;
111
- padding-bottom: 11px;
112
- padding-left: 10px;
113
- padding-right: ${(props) =>
114
- props.slotSize
115
- ? 'calc(' + props.slotSize + ' + 10px)'
116
- : props.hasUnit
117
- ? '40px'
118
- : '5px'};
109
+ padding: ${(props) =>
110
+ props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
119
111
  border-radius: 4px;
120
112
  text-align: ${(props) => props.textAlign};
121
113
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -141,6 +133,15 @@ const InputContainer = styled('input', inputProps)`
141
133
  outline: none;
142
134
  }
143
135
  `
136
+ const IconProps = {
137
+ inputIconHeight: String
138
+ }
139
+
140
+ const Icon = styled('img', IconProps)`
141
+ position: absolute;
142
+ right: 10px;
143
+ top: 2px;
144
+ `
144
145
 
145
146
  const InputWrapper = styled.span`
146
147
  position: relative;
@@ -158,7 +159,6 @@ const UnitContainer = styled('span', inputProps)`
158
159
  right: 10px;
159
160
  top: 0;
160
161
  padding-left: 10px;
161
- text-align: right;
162
162
  color: ${(props) =>
163
163
  props.isError
164
164
  ? props.theme.colors.red
@@ -167,34 +167,14 @@ const UnitContainer = styled('span', inputProps)`
167
167
  : props.theme.colors.mediumGray};
168
168
  `
169
169
 
170
- const SlotContainer = styled('span', inputProps)`
171
- text-align: right;
172
- border-left: 1px solid
173
- ${(props) =>
174
- props.isError
175
- ? props.theme.colors.red
176
- : props.hasLength
177
- ? props.theme.colors.black
178
- : props.theme.colors.mediumGray};
179
- position: absolute;
180
- width: ${(props) =>
181
- props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
182
- right: 10px;
183
- top: 0;
184
- padding-left: 10px;
185
- color: ${(props) =>
186
- props.isError
187
- ? props.theme.colors.red
188
- : props.hasLength
189
- ? props.theme.colors.black
190
- : props.theme.colors.mediumGray};
191
- `
192
- const ErrorMessage = styled.div`
193
- font-size: 14px;
194
- color: ${(props) => props.theme.colors.red};
195
- position: absolute;
196
- top: calc(100% + 1px);
197
- `
170
+ // const ErrorMessage = styled.div`
171
+ // margin-top: 5px;
172
+ // line-height: 1;
173
+ // text-transform: none;
174
+ // font-size: 10px;
175
+ // color: ${(props) => props.theme.colors.red};
176
+ // position: absolute;
177
+ // `
198
178
 
199
179
  const LabelWrapper = styled.div`
200
180
  display: flex;
@@ -217,13 +197,21 @@ export default {
217
197
  ErrorMessage,
218
198
  LabelWrapper,
219
199
  LabelText,
220
- SlotContainer,
221
- InfoText
200
+ InfoText,
201
+ Icon
222
202
  },
203
+ inheritAttrs: false,
223
204
  data() {
224
205
  return {
225
206
  textInput: '',
226
- isFocused: false
207
+ isFocused: false,
208
+ warningIcon: warningIcon
209
+ }
210
+ },
211
+ computed: {
212
+ displayedPlaceholder() {
213
+ if (this.placeholder) return this.placeholder
214
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
227
215
  }
228
216
  },
229
217
  props: {
@@ -293,7 +281,7 @@ export default {
293
281
  },
294
282
  labelInfoAlign: {
295
283
  required: false,
296
- default: 'left'
284
+ default: 'right'
297
285
  },
298
286
  minNumber: {
299
287
  required: false,
@@ -307,21 +295,25 @@ export default {
307
295
  required: false,
308
296
  default: true
309
297
  },
310
- slotSize: {
311
- required: false
312
- }
313
- },
314
- computed: {
315
- hasSlot() {
316
- return !!this.$slots.default
298
+ inputIcon: {
299
+ require: false,
300
+ type: Boolean,
301
+ default: false
302
+ },
303
+ inputIconImage: {
304
+ require: false,
305
+ type: String,
306
+ default: ''
317
307
  },
318
- computedSlotSize() {
319
- return this.slotSize || this.$slots['default'][0].elm.clientWidth
308
+ inputIconImageClass: {
309
+ require: false,
310
+ type: Array,
311
+ default: () => []
320
312
  }
321
313
  },
322
314
  methods: {
323
315
  onChangeHandler(event) {
324
- if (isNaN(event)) {
316
+ if (isNaN(event) || event=="") {
325
317
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
326
318
  }
327
319
  this.$emit('input-change', event)
@@ -351,10 +343,12 @@ export default {
351
343
  }
352
344
  })
353
345
  let evaluated = eval(formatted.join(''))
354
- evaluated = stringToNumber({
355
- value: evaluated,
356
- numberPrecision: this.numberPrecision
357
- })
346
+ if (typeof evaluated === 'string') {
347
+ evaluated = stringToNumber({
348
+ value: evaluated,
349
+ numberPrecision: this.numberPrecision
350
+ })
351
+ }
358
352
  return evaluated
359
353
  },
360
354
  onInputBlur(e) {
@@ -385,6 +379,7 @@ export default {
385
379
  this.$nextTick(() => {
386
380
  this.$refs.inputField1.$el.select()
387
381
  })
382
+ this.$emit('input-focus')
388
383
  },
389
384
  formatWithCurrency(value) {
390
385
  let adjustedMinValue =
@@ -14,6 +14,7 @@
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
17
+ <input-error-wrapper>
17
18
  <input-container
18
19
  :placeholder="placeholder"
19
20
  :isError="isError"
@@ -26,20 +27,27 @@
26
27
  :isDisabled="disabled"
27
28
  :fontSize="fontSize"
28
29
  />
30
+ <error-message v-if="isError">{{ errorMessage }}</error-message>
31
+ </input-error-wrapper>
29
32
  </input-wrapper>
30
- <error-message v-if="isError">{{ errorMessage }}</error-message>
31
33
  </container>
32
34
  </template>
33
35
 
34
36
  <script>
35
37
  import styled from "vue-styled-components"
36
38
  import InfoText from "../../infoText"
39
+ import ErrorMessage from '../../errorMessage'
37
40
 
38
41
  const Container = styled.div`
39
42
  width: 100%;
40
43
  position: relative;
41
44
  `
42
-
45
+ const InputErrorWrapper = styled.div`
46
+ display: inline-grid;
47
+ grid-template-row: auto auto;
48
+ grid-gap: 0px;
49
+ align-items: center;
50
+ `
43
51
  const labelAttrs = { fontSize: String }
44
52
  const InputLabel = styled("div", labelAttrs)`
45
53
  font-weight: bold;
@@ -104,13 +112,6 @@ const InputWrapper = styled("div", inputAttrs)`
104
112
  props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
105
113
  `
106
114
 
107
- const ErrorMessage = styled.div`
108
- font-size: 14px;
109
- color: ${(props) => props.theme.colors.red};
110
- position: absolute;
111
- top: calc(100% + 1px);
112
- `
113
-
114
115
  export default {
115
116
  // import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
116
117
  // To use:
@@ -136,6 +137,7 @@ export default {
136
137
  ErrorMessage,
137
138
  InfoText,
138
139
  InputLabel,
140
+ InputErrorWrapper,
139
141
  LabelWrapper,
140
142
  },
141
143
  props: {
@@ -23,6 +23,7 @@
23
23
  :disabled="isDisabled"
24
24
  :fontSize="fontSize"
25
25
  @input="onChangeHandler"
26
+ :resize="resize"
26
27
  />
27
28
  </input-wrapper>
28
29
  <error-message v-if="isError && errorText">{{ errorText }}</error-message>
@@ -174,7 +175,11 @@ export default {
174
175
  },
175
176
  inputWidth: {
176
177
  required: false,
177
- default: null
178
+ default: null,
179
+ },
180
+ resize:{
181
+ required:false,
182
+ default: "none"
178
183
  }
179
184
  },
180
185
  methods: {
@@ -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>