@eturnity/eturnity_reusable_components 1.2.19-EPDM-3412.0 → 1.2.19-EPDM-5262.6

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.19-EPDM-3412.0",
3
+ "version": "1.2.19-EPDM-5262.6",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -2,87 +2,82 @@
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
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
18
- :colSpan="3"
19
- :tableItems="getDropdownValues()"
20
- @toggle-dropdown-open="toggleDropdownOpen()"
21
- @item-selected="onItemSelected({ item: $event, index })"
22
- :isOpen="isDropdownOpen()"
23
- :optionItems="itemOptions"
24
- :optionsDisplay="['display_name', 'company_item_number', 'model']"
25
- /> -->
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>
34
- <br />
35
- <toggle
36
- @on-toggle-change="onInputChange($event)"
37
- :isChecked="inputValue"
38
- label="My Label Text"
39
- infoTextMessage="This is my test message"
40
- infoTextAlign="right"
41
- labelAlign="right"
42
- :disabled="false"
43
- />
5
+ <input-number
6
+ :value="inputValue"
7
+ @input-change="inputValue = $event"
8
+ inputWidth="250px"
9
+ slotSize="50%"
10
+ ><InputAnnexContainer>
11
+ <span>123m2</span>
12
+ <info-text size="10" alignArrow="right" text="infoText ceci est le text"></info-text>
13
+ </InputAnnexContainer>
14
+ </input-number>
15
+ <input-number
16
+ :value="inputValue"
17
+ @input-change="inputValue = $event"
18
+ inputWidth="250px"
19
+ slotSize="50%"
20
+ :isError="true"
21
+ ><InputAnnexContainer>
22
+ <span>123m2</span>
23
+ <info-text :style="{'justify-self': 'end'}" size="12" alignArrow="center" text="infoText ceci est le text">This is the tooltip text</info-text>
24
+ </InputAnnexContainer>
25
+ </input-number>
44
26
  <br />
45
-
46
- <p>InputText</p>
47
- <input-text
48
- placeholder="Company name"
49
- :value="inputValue"
50
- :isError="true"
51
- errorMessage="This is my error message"
52
- infoTextAlign="right"
53
- infoTextMessage="My info message"
54
- label="Question 5"
55
- alignItems="vertical"
56
- inputWidth="250px"
57
- minWidth="100px"
58
- />
59
- <br/>
27
+ <div :style="{ 'margin': '50px'}">
28
+ <input-number
29
+ labelText="Panel inclination"
30
+ labelInfoText="
31
+ Defines the slope of the installed panels to the horizon.
32
+ "
33
+ :value="inputValue"
34
+
35
+ />
36
+ <info-text size="100" alignArrow="center" width="360px">This is the tooltip text center</info-text>
37
+ <br /><br />
38
+ <info-text size="50" alignArrow="center" width="120px">This is the tooltip text center</info-text>
39
+ <br /><br />
40
+ <info-text size="10" alignArrow="center" width="100%">This is the tooltip text center</info-text>
41
+ <br /><br /><br /><br /><br />
42
+ <info-text size="100" alignArrow="left" width="360px">This is the tooltip text center</info-text>
43
+ <br /><br />
44
+ <info-text size="50" alignArrow="left" width="360px">This is the tooltip text center</info-text>
45
+ <br /><br />
46
+ <info-text size="10" alignArrow="left" width="360px">This is the tooltip text center</info-text>
47
+ <br /><br />
48
+ <br /><br /><br />
49
+ <info-text size="100" alignArrow="right" width="360px">This is the tooltip text center</info-text>
50
+ <br /><br />
51
+ <info-text size="50" alignArrow="right" width="360px">This is the tooltip text center</info-text>
52
+ <br /><br />
53
+ <info-text size="10" alignArrow="right" width="360px">This is the tooltip text center</info-text>
54
+ <br /><br />
55
+ </div>
60
56
  <input-number
61
- :value="num"
62
- @input-change="num = $event"
63
- unitName="t"
64
- id="biebie"
65
- test="koko"
66
- @keydown="keydownHandler"
67
- />
57
+ placeholder="Enter distance"
58
+ :numberPrecision="2"
59
+ :value="inputValue"
60
+ @input-change="onInputChange($event)"
61
+ >unit</input-number
62
+ >
63
+ <br />
68
64
  </page-container>
69
65
  </ThemeProvider>
70
66
  </template>
71
67
 
72
68
  <script>
73
- import { ThemeProvider } from "vue-styled-components"
74
- import theme from "./assets/theme"
75
- import styled from "vue-styled-components"
76
- import MainTable from "@/components/tables/mainTable"
77
- import ThreeDots from "@/components/threeDots"
78
- import Toggle from "@/components/inputs/toggle"
79
- import InputNumber from "@/components/inputs/inputNumber"
80
- import Checkbox from "@/components/inputs/checkbox"
81
- import PageSubtitle from "@/components/pageSubtitle"
82
- import Spinner from "@/components/spinner"
83
- import ExternalButton from "@/components/buttons/externalButton"
84
- import InputText from "@/components/inputs/inputText"
69
+ import { ThemeProvider } from 'vue-styled-components'
70
+ import theme from './assets/theme'
71
+ import styled from 'vue-styled-components'
72
+
73
+ import InputNumber from '@/components/inputs/inputNumber'
74
+ import infoText from '@/components/infoText'
85
75
  // import TableDropdown from "@/components/tableDropdown"
76
+ const InputAnnexContainer = styled.div`
77
+ display: grid;
78
+ grid-template-columns: auto auto;
79
+ grid-gap: 10px;
80
+ `
86
81
 
87
82
  const PageContainer = styled.div`
88
83
  padding: 40px;
@@ -93,20 +88,13 @@ export default {
93
88
  components: {
94
89
  ThemeProvider,
95
90
  PageContainer,
96
- MainTable,
97
- ThreeDots,
98
- Toggle,
99
91
  InputNumber,
100
- PageSubtitle,
101
- Spinner,
102
- Checkbox,
103
- InputText,
104
- ExternalButton,
105
- Modal,
92
+ infoText,
93
+ InputAnnexContainer
94
+ // TableDropdown,
106
95
  },
107
96
  data() {
108
97
  return {
109
- num: 42,
110
98
  inputValue: null,
111
99
  checkedOption: 'button_1',
112
100
  question: {
@@ -165,9 +153,6 @@ export default {
165
153
  }
166
154
  },
167
155
  methods: {
168
- keydownHandler(e) {
169
- console.log('test', e)
170
- },
171
156
  getTheme() {
172
157
  return theme
173
158
  },
@@ -217,8 +202,8 @@ export default {
217
202
  item = '-'
218
203
  }
219
204
  return item
220
- }
221
- }
205
+ },
206
+ },
222
207
  }
223
208
  </script>
224
209
 
@@ -1,34 +1,25 @@
1
1
  <template>
2
2
  <component-wrapper>
3
- <icon-wrapper>
3
+ <icon-wrapper :size="size">
4
4
  <icon-img
5
5
  :isActive="showInfo"
6
6
  :size="size"
7
7
  :borderColor="borderColor"
8
8
  @click.prevent="toggleShowInfo()"
9
- @mouseenter="toggleShowInfo()"
10
- @mouseleave="toggleShowInfo()"
9
+ @mouseenter="openTrigger == 'onHover' ? toggleShowInfo() : ''"
10
+ @mouseleave="openTrigger == 'onHover' ? toggleShowInfo() : ''"
11
11
  >
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>
12
+ <icon :size="size + 'px'" name="info" :color="iconColor" />
26
13
  </icon-img>
27
14
  <text-overlay
28
15
  v-if="showInfo"
29
16
  :borderColor="borderColor"
30
17
  :alignText="alignText"
31
- >
18
+ :width="width"
19
+ :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
20
+ :alignArrow="alignArrow"
21
+ :iconSize="size"
22
+ ><slot />
32
23
  {{ text }}
33
24
  </text-overlay>
34
25
  </icon-wrapper>
@@ -44,22 +35,21 @@
44
35
  // size="20"
45
36
  // alignText="right" // default is left
46
37
  // />
38
+ import theme from '@/assets/theme.js'
39
+ import styled from 'vue-styled-components'
40
+ import icon from '../icon'
47
41
 
48
- import styled from "vue-styled-components"
49
-
50
- const IconWrapper = styled.div`
51
- position: relative;
52
- `
53
-
54
- const textAttrs = { borderColor: String, alignText: String }
55
- const TextOverlay = styled("div", textAttrs)`
42
+ const textAttrs = { iconSize:Number, borderColor: String, alignArrow:String, alignText: String, width:String,halfComputedTextInfoWidth:Number }
43
+ const TextOverlay = styled('div', textAttrs)`
56
44
  position: absolute;
57
- top: 26px;
58
- right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
- left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
45
+ top: ${(props) => (parseInt(props.iconSize) + 15)}px;
46
+ ${(props) => (props.alignArrow === 'left' ? 'left: '+((props.iconSize/2)-18)+'px;' :
47
+ props.alignArrow === 'center' ? 'left: calc((-'+props.width+' + '+props.iconSize+'px)/2 - 7px);':
48
+ 'right: '+((props.iconSize/2)-17)+'px;')};
49
+ text-align: ${(props) => props.alignText};
60
50
  background: ${(props) => props.theme.colors.black};
61
51
  padding: 10px;
62
- width: max-content;
52
+ width: ${(props) => props.width };
63
53
  max-width: 400px;
64
54
  font-size: 13px;
65
55
  font-weight: 400;
@@ -68,12 +58,13 @@ const TextOverlay = styled("div", textAttrs)`
68
58
  color: ${(props) => props.theme.colors.white};
69
59
 
70
60
  :before {
71
- content: "";
61
+ content: '';
72
62
  background-color: ${(props) => props.theme.colors.black};
73
63
  position: absolute;
74
64
  top: 2px;
75
- right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
- left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
65
+ ${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
66
+ props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
67
+ 'right:-13px;')};
77
68
  height: 8px;
78
69
  width: 8px;
79
70
  transform-origin: center center;
@@ -82,18 +73,15 @@ const TextOverlay = styled("div", textAttrs)`
82
73
  `
83
74
 
84
75
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
85
- const IconImg = styled("div", iconAttrs)`
86
- cursor: pointer;
87
- height: ${(props) => props.size + "px"};
88
76
 
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
- }
77
+ const IconWrapper = styled('div', iconAttrs)`
78
+ position: relative;
79
+ top: 1px;
80
+ height: ${(props) => props.size}px;
81
+ `
82
+ const IconImg = styled('div', iconAttrs)`
83
+ cursor: pointer;
84
+ height: ${(props) => props.size}px;
97
85
  `
98
86
 
99
87
  const ComponentWrapper = styled.div`
@@ -101,38 +89,51 @@ const ComponentWrapper = styled.div`
101
89
  `
102
90
 
103
91
  export default {
104
- name: "info-text",
92
+ name: 'info-text',
105
93
  components: {
106
94
  IconWrapper,
107
95
  TextOverlay,
108
96
  ComponentWrapper,
109
97
  IconImg,
98
+ icon
110
99
  },
111
100
  props: {
112
101
  text: {
113
- required: true,
102
+ required: false,
114
103
  },
115
104
  borderColor: {
116
105
  required: false,
117
- default: null,
106
+ default: null
118
107
  },
119
108
  size: {
120
109
  required: false,
121
- default: "20",
110
+ default: '14'
122
111
  },
123
112
  alignText: {
124
113
  required: false,
125
- default: "left", // "left" or "right"
114
+ default: 'left' // "left" or "right"
115
+ },
116
+ alignArrow:{
117
+ required:false,
118
+ default:'center'
119
+ },
120
+ openTrigger:{
121
+ required:false,
122
+ default: 'onClick'
126
123
  },
124
+ width:{
125
+ required:false,
126
+ default:'165px'
127
+ }
127
128
  },
128
129
  methods: {
129
130
  toggleShowInfo() {
130
131
  this.showInfo = !this.showInfo
131
132
 
132
133
  if (this.showInfo) {
133
- document.addEventListener("click", this.clickOutside)
134
+ document.addEventListener('click', this.clickOutside)
134
135
  } else {
135
- document.removeEventListener("click", this.clickOutside)
136
+ document.removeEventListener('click', this.clickOutside)
136
137
  }
137
138
  },
138
139
  clickOutside(event) {
@@ -140,12 +141,24 @@ export default {
140
141
  return
141
142
  }
142
143
  this.toggleShowInfo()
143
- },
144
+ }
144
145
  },
145
146
  data() {
146
147
  return {
147
148
  showInfo: false,
148
149
  }
149
150
  },
151
+ computed: {
152
+ iconColor() {
153
+ return this.isActive
154
+ ? this.borderColor
155
+ ? this.borderColor
156
+ : theme.colors.secondary
157
+ : theme.colors.mediumGray
158
+ },
159
+ halfComputedTextInfoWidth() {
160
+ return parseInt(this.width)/2;
161
+ }
162
+ }
150
163
  }
151
- </script>
164
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container>
2
+ <container :inputWidth="inputWidth">
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="13"
11
+ size="14"
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,19 +30,19 @@
31
30
  :textAlign="textAlign"
32
31
  :fontSize="fontSize"
33
32
  :fontColor="fontColor"
34
- v-on="$listeners"
33
+ :hasSlot="hasSlot"
34
+ :slotSize="slotSize"
35
35
  />
36
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
37
+ <slot></slot>
38
+ </slot-container>
39
+
36
40
  <unit-container
37
- v-if="unitName && showLinearUnitName"
41
+ v-if="unitName && showLinearUnitName && !hasSlot"
38
42
  :hasLength="!!textInput.length"
39
43
  :isError="isError"
40
44
  >{{ unitName }}</unit-container
41
45
  >
42
- <icon
43
- v-if="(isError || inputIcon) && !showLinearUnitName"
44
- :class="inputIconImageClass"
45
- :src="isError ? warningIcon : inputIconImage"
46
- />
47
46
  </input-wrapper>
48
47
  <error-message v-if="isError">{{ errorMessage }}</error-message>
49
48
  </container>
@@ -81,12 +80,6 @@ import {
81
80
  numberToString
82
81
  } from '../../../helpers/numberConverter'
83
82
  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
- `
90
83
 
91
84
  const inputProps = {
92
85
  isError: Boolean,
@@ -97,8 +90,16 @@ const inputProps = {
97
90
  noBorder: Boolean,
98
91
  textAlign: String,
99
92
  fontSize: String,
100
- fontColor: String
93
+ fontColor: String,
94
+ hasSlot: Boolean,
95
+ slotSize: String
101
96
  }
97
+
98
+ const Container = styled('div', inputProps)`
99
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
100
+ position: relative;
101
+ `
102
+
102
103
  const InputContainer = styled('input', inputProps)`
103
104
  border: ${(props) =>
104
105
  props.isError
@@ -106,8 +107,15 @@ const InputContainer = styled('input', inputProps)`
106
107
  : props.noBorder
107
108
  ? 'none'
108
109
  : '1px solid ' + props.theme.colors.mediumGray};
109
- padding: ${(props) =>
110
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
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'};
111
119
  border-radius: 4px;
112
120
  text-align: ${(props) => props.textAlign};
113
121
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -133,15 +141,6 @@ const InputContainer = styled('input', inputProps)`
133
141
  outline: none;
134
142
  }
135
143
  `
136
- const IconProps = {
137
- inputIconHeight: String
138
- }
139
-
140
- const Icon = styled('img', IconProps)`
141
- position: absolute;
142
- right: 10px;
143
- top: 2px;
144
- `
145
144
 
146
145
  const InputWrapper = styled.span`
147
146
  position: relative;
@@ -159,6 +158,7 @@ const UnitContainer = styled('span', inputProps)`
159
158
  right: 10px;
160
159
  top: 0;
161
160
  padding-left: 10px;
161
+ text-align: right;
162
162
  color: ${(props) =>
163
163
  props.isError
164
164
  ? props.theme.colors.red
@@ -167,14 +167,34 @@ const UnitContainer = styled('span', inputProps)`
167
167
  : props.theme.colors.mediumGray};
168
168
  `
169
169
 
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
- // `
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
+ `
178
198
 
179
199
  const LabelWrapper = styled.div`
180
200
  display: flex;
@@ -197,21 +217,13 @@ export default {
197
217
  ErrorMessage,
198
218
  LabelWrapper,
199
219
  LabelText,
200
- InfoText,
201
- Icon
220
+ SlotContainer,
221
+ InfoText
202
222
  },
203
- inheritAttrs: false,
204
223
  data() {
205
224
  return {
206
225
  textInput: '',
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 : ''}`
226
+ isFocused: false
215
227
  }
216
228
  },
217
229
  props: {
@@ -281,7 +293,7 @@ export default {
281
293
  },
282
294
  labelInfoAlign: {
283
295
  required: false,
284
- default: 'right'
296
+ default: 'left'
285
297
  },
286
298
  minNumber: {
287
299
  required: false,
@@ -295,25 +307,21 @@ export default {
295
307
  required: false,
296
308
  default: true
297
309
  },
298
- inputIcon: {
299
- require: false,
300
- type: Boolean,
301
- default: false
302
- },
303
- inputIconImage: {
304
- require: false,
305
- type: String,
306
- default: ''
310
+ slotSize: {
311
+ required: false
312
+ }
313
+ },
314
+ computed: {
315
+ hasSlot() {
316
+ return !!this.$slots.default
307
317
  },
308
- inputIconImageClass: {
309
- require: false,
310
- type: Array,
311
- default: () => []
318
+ computedSlotSize() {
319
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
312
320
  }
313
321
  },
314
322
  methods: {
315
323
  onChangeHandler(event) {
316
- if (isNaN(event) || event=="") {
324
+ if (isNaN(event)) {
317
325
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
318
326
  }
319
327
  this.$emit('input-change', event)
@@ -379,7 +387,6 @@ export default {
379
387
  this.$nextTick(() => {
380
388
  this.$refs.inputField1.$el.select()
381
389
  })
382
- this.$emit('input-focus')
383
390
  },
384
391
  formatWithCurrency(value) {
385
392
  let adjustedMinValue =
@@ -14,7 +14,6 @@
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: {
@@ -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: {
@@ -4,6 +4,9 @@ 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
+ }
7
10
  let newVal = value.toString()
8
11
  const selectedLang = localStorage.getItem('lang')
9
12
  // The first replace will replace not allowed characters with a blank
@@ -1,62 +0,0 @@
1
- <template>
2
- <component-wrapper>
3
- <text-overlay>
4
- <slot></slot>
5
- </text-overlay>
6
- </component-wrapper>
7
- </template>
8
-
9
- <script>
10
- // import InfoText from "@eturnity/eturnity_reusable_components/src/components/infoText"
11
- //To use:
12
- // <error-message
13
- // alignText="right" // default is left
14
- // />
15
-
16
- import styled from 'vue-styled-components'
17
-
18
- const TextOverlay = styled.div`
19
- position: absolute;
20
- top: calc(100% + 13px);
21
- background: ${(props) => props.theme.colors.red};
22
- padding: 10px;
23
- width: max-content;
24
- max-width: 100%;
25
- min-width: 200px;
26
- font-size: 11px;
27
- font-weight: 400;
28
- border-radius: 4px;
29
- font-family: 'Lato-Bold', Arial;
30
- z-index: 99;
31
- color: ${(props) => props.theme.colors.white};
32
-
33
- :before {
34
- content: '';
35
- background-color: ${(props) => props.theme.colors.red};
36
- position: absolute;
37
- top: 2px;
38
- left: 40px;
39
- height: 11px;
40
- width: 11px;
41
- transform-origin: center center;
42
- transform: translate(-2em, -0.5em) rotate(45deg);
43
- }
44
- `
45
-
46
- const ComponentWrapper = styled.div`
47
- display: block;
48
- `
49
-
50
- export default {
51
- name: 'info-text',
52
- components: {
53
- TextOverlay,
54
- ComponentWrapper
55
- },
56
- props: {},
57
- methods: {},
58
- data() {
59
- return {}
60
- }
61
- }
62
- </script>