@eturnity/eturnity_reusable_components 1.2.19-dev03.2 → 1.2.19-v.5.45.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.
@@ -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="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
22
  :minWidth="minWidth"
@@ -31,25 +30,13 @@
31
30
  :textAlign="textAlign"
32
31
  :fontSize="fontSize"
33
32
  :fontColor="fontColor"
34
- v-on="$listeners"
35
- :hasSlot="hasSlot"
36
- :slotSize="slotSize"
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
47
39
  >
48
- <icon
49
- v-if="(isError || inputIcon) && !showLinearUnitName"
50
- :class="inputIconImageClass"
51
- :src="isError ? warningIcon : inputIconImage"
52
- />
53
40
  </input-wrapper>
54
41
  <error-message v-if="isError">{{ errorMessage }}</error-message>
55
42
  </container>
@@ -87,8 +74,11 @@ import {
87
74
  numberToString
88
75
  } from '../../../helpers/numberConverter'
89
76
  import InfoText from '../../infoText'
90
- import ErrorMessage from '../../errorMessage'
91
- import warningIcon from '../../../assets/icons/error_icon.png'
77
+
78
+ const Container = styled.div`
79
+ width: 100%;
80
+ position: relative;
81
+ `
92
82
 
93
83
  const inputProps = {
94
84
  isError: Boolean,
@@ -99,16 +89,8 @@ const inputProps = {
99
89
  noBorder: Boolean,
100
90
  textAlign: String,
101
91
  fontSize: String,
102
- fontColor: String,
103
- hasSlot: Boolean,
104
- slotSize: String
92
+ fontColor: String
105
93
  }
106
-
107
- const Container = styled('div', inputProps)`
108
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
109
- position: relative;
110
- `
111
-
112
94
  const InputContainer = styled('input', inputProps)`
113
95
  border: ${(props) =>
114
96
  props.isError
@@ -116,15 +98,8 @@ const InputContainer = styled('input', inputProps)`
116
98
  : props.noBorder
117
99
  ? 'none'
118
100
  : '1px solid ' + props.theme.colors.mediumGray};
119
- padding-top: 11px;
120
- padding-bottom: 11px;
121
- padding-left: 10px;
122
- padding-right: ${(props) =>
123
- props.slotSize
124
- ? 'calc(' + props.slotSize + ' + 10px)'
125
- : props.hasUnit
126
- ? '40px'
127
- : '5px'};
101
+ padding: ${(props) =>
102
+ props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
128
103
  border-radius: 4px;
129
104
  text-align: ${(props) => props.textAlign};
130
105
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -150,15 +125,6 @@ const InputContainer = styled('input', inputProps)`
150
125
  outline: none;
151
126
  }
152
127
  `
153
- const IconProps = {
154
- inputIconHeight: String
155
- }
156
-
157
- const Icon = styled('img', IconProps)`
158
- position: absolute;
159
- right: 10px;
160
- top: 2px;
161
- `
162
128
 
163
129
  const InputWrapper = styled.span`
164
130
  position: relative;
@@ -176,7 +142,6 @@ const UnitContainer = styled('span', inputProps)`
176
142
  right: 10px;
177
143
  top: 0;
178
144
  padding-left: 10px;
179
- text-align: right;
180
145
  color: ${(props) =>
181
146
  props.isError
182
147
  ? props.theme.colors.red
@@ -185,27 +150,11 @@ const UnitContainer = styled('span', inputProps)`
185
150
  : props.theme.colors.mediumGray};
186
151
  `
187
152
 
188
- const SlotContainer = styled('span', inputProps)`
189
- text-align: right;
190
- border-left: 1px solid
191
- ${(props) =>
192
- props.isError
193
- ? props.theme.colors.red
194
- : props.hasLength
195
- ? props.theme.colors.black
196
- : props.theme.colors.mediumGray};
153
+ const ErrorMessage = styled.div`
154
+ font-size: 14px;
155
+ color: ${(props) => props.theme.colors.red};
197
156
  position: absolute;
198
- width: ${(props) =>
199
- props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
200
- right: 10px;
201
- top: 0;
202
- padding-left: 10px;
203
- color: ${(props) =>
204
- props.isError
205
- ? props.theme.colors.red
206
- : props.hasLength
207
- ? props.theme.colors.black
208
- : props.theme.colors.mediumGray};
157
+ top: calc(100% + 1px);
209
158
  `
210
159
 
211
160
  const LabelWrapper = styled.div`
@@ -229,16 +178,12 @@ export default {
229
178
  ErrorMessage,
230
179
  LabelWrapper,
231
180
  LabelText,
232
- InfoText,
233
- Icon,
234
- SlotContainer
181
+ InfoText
235
182
  },
236
- inheritAttrs: false,
237
183
  data() {
238
184
  return {
239
185
  textInput: '',
240
- isFocused: false,
241
- warningIcon: warningIcon,
186
+ isFocused: false
242
187
  }
243
188
  },
244
189
  props: {
@@ -308,7 +253,7 @@ export default {
308
253
  },
309
254
  labelInfoAlign: {
310
255
  required: false,
311
- default: 'left'
256
+ default: 'right'
312
257
  },
313
258
  minNumber: {
314
259
  required: false,
@@ -321,41 +266,11 @@ export default {
321
266
  numberToStringEnabled: {
322
267
  required: false,
323
268
  default: true
324
- },
325
- inputIcon: {
326
- require: false,
327
- type: Boolean,
328
- default: false
329
- },
330
- inputIconImage: {
331
- require: false,
332
- type: String,
333
- default: ''
334
- },
335
- inputIconImageClass: {
336
- require: false,
337
- type: Array,
338
- default: () => []
339
- },
340
- slotSize: {
341
- required: false
342
- }
343
- },
344
- computed: {
345
- displayedPlaceholder() {
346
- if (this.placeholder) return this.placeholder
347
- return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
348
- },
349
- hasSlot() {
350
- return !!this.$slots.default
351
- },
352
- computedSlotSize() {
353
- return this.slotSize || this.$slots['default'][0].elm.clientWidth
354
269
  }
355
270
  },
356
271
  methods: {
357
272
  onChangeHandler(event) {
358
- if (isNaN(event) || event=="") {
273
+ if (isNaN(event)) {
359
274
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
360
275
  }
361
276
  this.$emit('input-change', event)
@@ -421,7 +336,6 @@ export default {
421
336
  this.$nextTick(() => {
422
337
  this.$refs.inputField1.$el.select()
423
338
  })
424
- this.$emit('input-focus')
425
339
  },
426
340
  formatWithCurrency(value) {
427
341
  let adjustedMinValue =
@@ -473,4 +387,4 @@ export default {
473
387
  }
474
388
  }
475
389
  }
476
- </script>
390
+ </script>
@@ -10,11 +10,10 @@
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
17
  <input-container
19
18
  :placeholder="placeholder"
20
19
  :isError="isError"
@@ -27,27 +26,20 @@
27
26
  :isDisabled="disabled"
28
27
  :fontSize="fontSize"
29
28
  />
30
- <error-message v-if="isError">{{ errorMessage }}</error-message>
31
- </input-error-wrapper>
32
29
  </input-wrapper>
30
+ <error-message v-if="isError">{{ errorMessage }}</error-message>
33
31
  </container>
34
32
  </template>
35
33
 
36
34
  <script>
37
35
  import styled from "vue-styled-components"
38
36
  import InfoText from "../../infoText"
39
- import ErrorMessage from '../../errorMessage'
40
37
 
41
38
  const Container = styled.div`
42
39
  width: 100%;
43
40
  position: relative;
44
41
  `
45
- const InputErrorWrapper = styled.div`
46
- display: inline-grid;
47
- grid-template-row: auto auto;
48
- grid-gap: 0px;
49
- align-items: center;
50
- `
42
+
51
43
  const labelAttrs = { fontSize: String }
52
44
  const InputLabel = styled("div", labelAttrs)`
53
45
  font-weight: bold;
@@ -112,6 +104,13 @@ const InputWrapper = styled("div", inputAttrs)`
112
104
  props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
113
105
  `
114
106
 
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
+
115
114
  export default {
116
115
  // import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
117
116
  // To use:
@@ -137,7 +136,6 @@ export default {
137
136
  ErrorMessage,
138
137
  InfoText,
139
138
  InputLabel,
140
- InputErrorWrapper,
141
139
  LabelWrapper,
142
140
  },
143
141
  props: {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component-wrapper :layout="layout">
3
3
  <radio-wrapper v-for="(item, index) in options" :key="item.value">
4
- <label-container :size="size" :isDisabled="item.disabled">
4
+ <label-container :size="size" :isDisabled="item.disabled" :isChecked="selectedOption === item.value">
5
5
  <radio
6
6
  type="radio"
7
7
  :value="selectedOption"
@@ -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" />
@@ -76,14 +76,6 @@ const Radio = styled.input`
76
76
  cursor: pointer;
77
77
  height: 0;
78
78
  width: 0;
79
-
80
- &:checked ~ .checkmark {
81
- background-color: white;
82
-
83
- &:after {
84
- display: block;
85
- }
86
- }
87
79
  `
88
80
 
89
81
  const RadioWrapper = styled.div`
@@ -91,22 +83,22 @@ const RadioWrapper = styled.div`
91
83
  grid-gap: 10px;
92
84
  `
93
85
 
94
- const containerProps = { size: String, isDisabled: Boolean }
86
+ const containerProps = { size: String, isDisabled: Boolean, isChecked: Boolean }
95
87
  const LabelContainer = styled("label", containerProps)`
96
88
  display: grid;
97
89
  grid-template-columns: auto 1fr auto;
98
90
  grid-gap: 15px;
99
91
  align-items: center;
100
92
  color: ${(props) =>
101
- props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
93
+ props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
102
94
  position: relative;
103
95
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
104
96
  font-size: ${(props) =>
105
97
  props.size === "large"
106
98
  ? "16px"
107
99
  : props.size === "medium"
108
- ? "13px"
109
- : "10px"};
100
+ ? "13px"
101
+ : "10px"};
110
102
  user-select: none;
111
103
  flex: auto;
112
104
  align-self: baseline;
@@ -116,14 +108,14 @@ const LabelContainer = styled("label", containerProps)`
116
108
  props.size === "large"
117
109
  ? "23px"
118
110
  : props.size === "medium"
119
- ? "16px"
120
- : "12px"};
111
+ ? "16px"
112
+ : "12px"};
121
113
  width: ${(props) =>
122
114
  props.size === "large"
123
115
  ? "23px"
124
116
  : props.size === "medium"
125
- ? "16px"
126
- : "12px"};
117
+ ? "16px"
118
+ : "12px"};
127
119
  background-color: #fff;
128
120
  border-radius: 100%;
129
121
  border: 1px solid ${(props) => props.theme.colors.mediumGray};
@@ -133,32 +125,29 @@ const LabelContainer = styled("label", containerProps)`
133
125
 
134
126
  &:after {
135
127
  content: "";
136
- display: none;
128
+ display: ${(props) => props.isChecked ? 'block' : 'none'};
129
+ width: ${(props) =>
130
+ props.size === "large"
131
+ ? "10px"
132
+ : props.size === "medium"
133
+ ? "8px"
134
+ : "6px"};
135
+ height: ${(props) =>
136
+ props.size === "large"
137
+ ? "10px"
138
+ : props.size === "medium"
139
+ ? "8px"
140
+ : "6px"};
141
+ border-radius: 100%;
142
+ background: ${(props) => props.theme.colors.primary};
137
143
  }
138
144
  }
139
-
140
- .checkmark:after {
141
- width: ${(props) =>
142
- props.size === "large"
143
- ? "10px"
144
- : props.size === "medium"
145
- ? "8px"
146
- : "6px"};
147
- height: ${(props) =>
148
- props.size === "large"
149
- ? "10px"
150
- : props.size === "medium"
151
- ? "8px"
152
- : "6px"};
153
- border-radius: 100%;
154
- background: ${(props) => props.theme.colors.primary};
155
- }
156
145
  `
157
146
 
158
147
  const textAttrs = { isDisabled: Boolean }
159
148
  const LabelText = styled("div", textAttrs)`
160
149
  color: ${(props) =>
161
- props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
150
+ props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
162
151
  `
163
152
 
164
153
  const RadioImage = styled.img`
@@ -228,11 +217,15 @@ export default {
228
217
  required: false,
229
218
  default: "medium", // small, medium, large
230
219
  },
220
+ name: {
221
+ required: false,
222
+ default: ''
223
+ }
231
224
  },
232
225
  data() {
233
226
  return {
234
- radioName: "",
235
227
  selectedImage: null,
228
+ radioName: ''
236
229
  }
237
230
  },
238
231
  methods: {
@@ -247,7 +240,7 @@ export default {
247
240
  },
248
241
  },
249
242
  created() {
250
- this.radioName = Math.round(Math.random() * 10000)
243
+ this.radioName = this.name.length === 0 ? Math.round(Math.random() * 10000) : this.name
251
244
  },
252
245
  }
253
246
  </script>
@@ -59,7 +59,8 @@ const InputWrapper = styled.span`
59
59
  img {
60
60
  position: absolute;
61
61
  right: 10px;
62
- top: 0;
62
+ top: 50%;
63
+ transform: translateY(-50%);
63
64
  }
64
65
  `
65
66
 
@@ -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>
@@ -175,11 +174,7 @@ export default {
175
174
  },
176
175
  inputWidth: {
177
176
  required: false,
178
- default: null,
179
- },
180
- resize:{
181
- required:false,
182
- default: "none"
177
+ default: null
183
178
  }
184
179
  },
185
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>
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <subtitle-text :color="color" :hasInfoText="!!infoText">
2
+ <subtitle-text :color="color" :marginBottom="marginBottom" :hasInfoText="!!infoText">
3
3
  <span>
4
4
  {{ text }}
5
5
  </span>
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
  />
@@ -24,7 +24,7 @@
24
24
  import styled from "vue-styled-components"
25
25
  import InfoText from "../infoText"
26
26
 
27
- const textAttrs = { color: String, hasInfoText: Boolean }
27
+ const textAttrs = { color: String, hasInfoText: Boolean, marginBottom: String }
28
28
  const SubtitleText = styled("div", textAttrs)`
29
29
  display: grid;
30
30
  align-items: center;
@@ -33,7 +33,7 @@ const SubtitleText = styled("div", textAttrs)`
33
33
  props.hasInfoText ? "auto auto 1fr" : "1fr"};
34
34
  color: ${(props) => (props.color ? props.color : props.theme.colors.gray1)};
35
35
  font-size: 13px;
36
- margin-bottom: 30px;
36
+ margin-bottom: ${(props) => (props.marginBottom ? props.marginBottom : '30px')};
37
37
  line-height: 1.5;
38
38
  position: relative;
39
39
  `
@@ -59,6 +59,10 @@ export default {
59
59
  required: false,
60
60
  default: "left",
61
61
  },
62
+ marginBottom: {
63
+ required: false,
64
+ default: "30px",
65
+ }
62
66
  },
63
67
  }
64
68
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <title-text :color="color">{{ text }}</title-text>
2
+ <title-text :color="color" :fontSize="fontSize" :uppercase="uppercase">{{ text }}</title-text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -11,12 +11,12 @@
11
11
  // />
12
12
  import styled from "vue-styled-components"
13
13
 
14
- const textAttrs = { color: String }
14
+ const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
15
15
  const TitleText = styled("div", textAttrs)`
16
16
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
17
  font-weight: bold;
18
- font-size: 16px;
19
- text-transform: uppercase;
18
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
19
+ text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
20
20
  margin-bottom: 20px;
21
21
  `
22
22
 
@@ -32,6 +32,14 @@ export default {
32
32
  color: {
33
33
  required: false,
34
34
  },
35
+ fontSize: {
36
+ required: false,
37
+ default: '16px'
38
+ },
39
+ uppercase: {
40
+ required: false,
41
+ default: true
42
+ }
35
43
  },
36
44
  }
37
45
  </script>