@eturnity/eturnity_reusable_components 1.2.26-EPDM-5784 → 1.2.26-EPDM-3412.1

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/babel.config.js CHANGED
@@ -2,4 +2,4 @@ module.exports = {
2
2
  presets: [
3
3
  '@vue/cli-plugin-babel/preset'
4
4
  ]
5
- }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.26-EPDM-5784",
3
+ "version": "1.2.26-EPDM-3412.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -2,80 +2,61 @@
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
4
  <br />
5
- <!-- <modal backdrop="dark" :isLoading="false" :isOpen="false"> -->
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
- <row-container>
35
- <div v-for="(item, index) in markersArray" :key="item.index">
36
- <project-marker
37
- :activeLanguage="'en-us'"
38
- :markerData="item"
39
- :isLimitedPartner="false"
40
- :isGroupSupport="false"
41
- :isEditable="true"
42
- :gettext="gettext"
43
- :date="'23.07.2022'"
44
- @editHandler="consoleLog('edit index ' + index)"
45
- @deleteHandler="consoleLog('delete id ' + item.id)"
46
- />
47
- </div>
48
- </row-container>
49
- <br />
50
- <iconCollection />
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
13
+ size="10px"
14
+ alignArrow="right"
15
+ text="infoText ceci est le text"
16
+ ></info-text>
17
+ </InputAnnexContainer>
18
+ </input-number>
19
+ <input-number
20
+ :value="inputValue"
21
+ @input-change="inputValue = $event"
22
+ inputWidth="250px"
23
+ slotSize="50%"
24
+ :isError="true"
25
+ ><InputAnnexContainer>
26
+ <span>123m2</span>
27
+ <info-text
28
+ :style="{ 'justify-self': 'end' }"
29
+ size="12px"
30
+ alignArrow="center"
31
+ text="infoText ceci est le text"
32
+ >This is the tooltip text</info-text
33
+ >
34
+ </InputAnnexContainer>
35
+ </input-number>
51
36
  <br />
52
- <toggle
53
- @on-toggle-change="onInputChange($event)"
54
- :isChecked="inputValue"
55
- label="My Label Text"
56
- infoTextMessage="This is my test message"
57
- infoTextAlign="right"
58
- labelAlign="right"
59
- :disabled="false"
60
- />
61
- <br /> -->
62
- <iconCollection />
37
+
38
+ <p>InputText</p>
63
39
  <input-text
64
- placeholder="Enter distance"
40
+ placeholder="Company name"
65
41
  :value="inputValue"
66
- @input-change="onInputChange($event)"
67
- type="password"
42
+ :isError="true"
43
+ errorMessage="This is my error message"
44
+ infoTextAlign="right"
45
+ infoTextMessage="My info message"
46
+ label="Question 5"
47
+ alignItems="vertical"
48
+ inputWidth="250px"
49
+ minWidth="100px"
68
50
  />
69
51
  <br />
70
- <!-- <page-subtitle text="My Subtitle" infoText="My info Text" />
71
- <spinner size="30px" />
72
- <checkbox
73
- label="Do you accept the Terms?"
74
- :isChecked="true"
75
- size="small"
76
- :isDisabled="false"
77
- /> -->
78
- <!-- <external-button text="Click me!" minWidth="500px" /> -->
52
+ <input-number
53
+ :value="num"
54
+ @input-change="num = $event"
55
+ unitName="t"
56
+ id="biebie"
57
+ test="koko"
58
+ @keydown="keydownHandler"
59
+ />
79
60
  </page-container>
80
61
  </ThemeProvider>
81
62
  </template>
@@ -84,17 +65,8 @@
84
65
  import { ThemeProvider } from 'vue-styled-components'
85
66
  import theme from './assets/theme'
86
67
  import styled from 'vue-styled-components'
87
- // import MainTable from '@/components/tables/mainTable'
88
- // import ThreeDots from '@/components/threeDots'
89
- // import Toggle from '@/components/inputs/toggle'
68
+ import InputNumber from '@/components/inputs/inputNumber'
90
69
  import InputText from '@/components/inputs/inputText'
91
- // import Checkbox from '@/components/inputs/checkbox'
92
- // import PageSubtitle from '@/components/pageSubtitle'
93
- // import Spinner from '@/components/spinner'
94
- // import ExternalButton from '@/components/buttons/externalButton'
95
- // import ProjectMarker from '@/components/projectMarker'
96
- import iconCollection from '@/components/icon/iconCollection'
97
- // import Modal from '@/components/modals/modal'
98
70
  // import TableDropdown from "@/components/tableDropdown"
99
71
 
100
72
  const PageContainer = styled.div`
@@ -112,21 +84,12 @@ export default {
112
84
  components: {
113
85
  ThemeProvider,
114
86
  PageContainer,
115
- // MainTable,
116
- // ThreeDots,
117
- // Toggle,
118
- InputText,
119
- // PageSubtitle,
120
- // Spinner,
121
- // Checkbox,
122
- // ExternalButton,
123
- // Modal,
124
- // ProjectMarker,
125
- iconCollection
126
- // RowContainer
87
+ InputNumber,
88
+ InputText
127
89
  },
128
90
  data() {
129
91
  return {
92
+ num: 42,
130
93
  inputValue: null,
131
94
  checkedOption: 'button_1',
132
95
  question: {
@@ -252,11 +215,8 @@ export default {
252
215
  }
253
216
  },
254
217
  methods: {
255
- consoleLog(data) {
256
- console.log(data)
257
- },
258
- gettext(string) {
259
- return string.toUpperCase()
218
+ keydownHandler(e) {
219
+ console.log('test', e)
260
220
  },
261
221
  getTheme() {
262
222
  return theme
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <component-wrapper>
3
+ <text-overlay>
4
+ <slot></slot>
5
+ </text-overlay>
6
+ </component-wrapper>
7
+ </template>
8
+
9
+ <script>
10
+ // import ErrorMessage from "@eturnity/eturnity_reusable_components/src/components/errorMessage"
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: 10;
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>
@@ -1,35 +1,26 @@
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" 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
- >
32
- {{ text }}
18
+ :width="width"
19
+ :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
20
+ :alignArrow="alignArrow"
21
+ :iconSize="size"
22
+ ><slot />
23
+ <span v-html="text"></span>
33
24
  </text-overlay>
34
25
  </icon-wrapper>
35
26
  </component-wrapper>
@@ -44,22 +35,31 @@
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 = {
43
+ iconSize: String,
44
+ borderColor: String,
45
+ alignArrow: String,
46
+ alignText: String,
47
+ width: String,
48
+ halfComputedTextInfoWidth: Number
49
+ }
50
+ const TextOverlay = styled('div', textAttrs)`
56
51
  position: absolute;
57
- top: 26px;
58
- right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
- left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
52
+ top: ${(props) => 'calc(' + props.iconSize + ' + 15px)'};
53
+ ${(props) =>
54
+ props.alignArrow === 'left'
55
+ ? 'left: calc(' + props.iconSize + ' /2 - 18px)'
56
+ : props.alignArrow === 'center'
57
+ ? 'left: calc((-' + props.width + ' + ' + props.iconSize + ') /2 + 2px)'
58
+ : 'right: calc(' + props.iconSize + ' /2 - 17px)'};
59
+ text-align: ${(props) => props.alignText};
60
60
  background: ${(props) => props.theme.colors.black};
61
61
  padding: 10px;
62
- width: max-content;
62
+ width: ${(props) => props.width};
63
63
  max-width: 400px;
64
64
  font-size: 13px;
65
65
  font-weight: 400;
@@ -68,32 +68,37 @@ const TextOverlay = styled("div", textAttrs)`
68
68
  color: ${(props) => props.theme.colors.white};
69
69
 
70
70
  :before {
71
- content: "";
71
+ content: '';
72
72
  background-color: ${(props) => props.theme.colors.black};
73
73
  position: absolute;
74
74
  top: 2px;
75
- right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
- left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
75
+ ${(props) =>
76
+ props.alignArrow === 'left'
77
+ ? 'left:40px;'
78
+ : props.alignArrow == 'center'
79
+ ? 'left: calc(50% + 19px);'
80
+ : 'right:-13px;'};
77
81
  height: 8px;
78
82
  width: 8px;
79
83
  transform-origin: center center;
80
84
  transform: translate(-2em, -0.5em) rotate(45deg);
81
85
  }
86
+
87
+ span a {
88
+ color: #2cc0eb;
89
+ }
82
90
  `
83
91
 
84
92
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
85
- const IconImg = styled("div", iconAttrs)`
86
- cursor: pointer;
87
- height: ${(props) => props.size + "px"};
88
93
 
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
- }
94
+ const IconWrapper = styled('div', iconAttrs)`
95
+ position: relative;
96
+ top: 1px;
97
+ height: ${(props) => props.size};
98
+ `
99
+ const IconImg = styled('div', iconAttrs)`
100
+ cursor: pointer;
101
+ height: ${(props) => props.size};
97
102
  `
98
103
 
99
104
  const ComponentWrapper = styled.div`
@@ -101,38 +106,51 @@ const ComponentWrapper = styled.div`
101
106
  `
102
107
 
103
108
  export default {
104
- name: "info-text",
109
+ name: 'info-text',
105
110
  components: {
106
111
  IconWrapper,
107
112
  TextOverlay,
108
113
  ComponentWrapper,
109
114
  IconImg,
115
+ icon
110
116
  },
111
117
  props: {
112
118
  text: {
113
- required: true,
119
+ required: false
114
120
  },
115
121
  borderColor: {
116
122
  required: false,
117
- default: null,
123
+ default: null
118
124
  },
119
125
  size: {
120
126
  required: false,
121
- default: "20",
127
+ default: '14px'
122
128
  },
123
129
  alignText: {
124
130
  required: false,
125
- default: "left", // "left" or "right"
131
+ default: 'left' // "left" or "right"
132
+ },
133
+ alignArrow: {
134
+ required: false,
135
+ default: 'center'
126
136
  },
137
+ openTrigger: {
138
+ required: false,
139
+ default: 'onClick'
140
+ },
141
+ width: {
142
+ required: false,
143
+ default: '165px'
144
+ }
127
145
  },
128
146
  methods: {
129
147
  toggleShowInfo() {
130
148
  this.showInfo = !this.showInfo
131
149
 
132
150
  if (this.showInfo) {
133
- document.addEventListener("click", this.clickOutside)
151
+ document.addEventListener('click', this.clickOutside)
134
152
  } else {
135
- document.removeEventListener("click", this.clickOutside)
153
+ document.removeEventListener('click', this.clickOutside)
136
154
  }
137
155
  },
138
156
  clickOutside(event) {
@@ -140,12 +158,24 @@ export default {
140
158
  return
141
159
  }
142
160
  this.toggleShowInfo()
143
- },
161
+ }
144
162
  },
145
163
  data() {
146
164
  return {
147
- showInfo: false,
165
+ showInfo: false
148
166
  }
149
167
  },
168
+ computed: {
169
+ iconColor() {
170
+ return this.isActive
171
+ ? this.borderColor
172
+ ? this.borderColor
173
+ : theme.colors.secondary
174
+ : theme.colors.mediumGray
175
+ },
176
+ halfComputedTextInfoWidth() {
177
+ return parseInt(this.width) / 2
178
+ }
179
+ }
150
180
  }
151
181
  </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,17 +8,19 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="13"
11
+ size="14px"
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"
23
+ :inputHeight="inputHeight"
22
24
  :minWidth="minWidth"
23
25
  :value="formatWithCurrency(value)"
24
26
  @blur="onInputBlur($event)"
@@ -30,14 +32,25 @@
30
32
  :textAlign="textAlign"
31
33
  :fontSize="fontSize"
32
34
  :fontColor="fontColor"
33
- :borderColor="borderColor"
35
+ v-on="$listeners"
36
+ :hasSlot="hasSlot"
37
+ :slotSize="slotSize"
34
38
  />
39
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
40
+ <slot></slot>
41
+ </slot-container>
42
+
35
43
  <unit-container
36
- v-if="unitName && showLinearUnitName"
44
+ v-if="unitName && showLinearUnitName && !hasSlot"
37
45
  :hasLength="!!textInput.length"
38
46
  :isError="isError"
39
47
  >{{ unitName }}</unit-container
40
48
  >
49
+ <icon
50
+ v-if="(isError || inputIcon) && !showLinearUnitName"
51
+ :class="inputIconImageClass"
52
+ :src="isError ? warningIcon : inputIconImage"
53
+ />
41
54
  </input-wrapper>
42
55
  <error-message v-if="isError">{{ errorMessage }}</error-message>
43
56
  </container>
@@ -75,11 +88,8 @@ import {
75
88
  numberToString
76
89
  } from '../../../helpers/numberConverter'
77
90
  import InfoText from '../../infoText'
78
-
79
- const Container = styled.div`
80
- width: 100%;
81
- position: relative;
82
- `
91
+ import ErrorMessage from '../../errorMessage'
92
+ import warningIcon from '../../../assets/icons/error_icon.png'
83
93
 
84
94
  const inputProps = {
85
95
  isError: Boolean,
@@ -90,16 +100,33 @@ const inputProps = {
90
100
  noBorder: Boolean,
91
101
  textAlign: String,
92
102
  fontSize: String,
93
- borderColor: String,
94
- fontColor: String
103
+ fontColor: String,
104
+ hasSlot: Boolean,
105
+ slotSize: String,
106
+ inputHeight: String
95
107
  }
108
+
109
+ const Container = styled('div', inputProps)`
110
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
111
+ position: relative;
112
+ `
113
+
96
114
  const InputContainer = styled('input', inputProps)`
97
115
  border: ${(props) =>
98
- props.noBorder
116
+ props.isError
117
+ ? '1px solid ' + props.theme.colors.red
118
+ : props.noBorder
99
119
  ? 'none'
100
- : `1px solid ${props.isError ? props.theme.colors.red : props.borderColor ? props.borderColor : props.theme.colors.mediumGray}`};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
120
+ : '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'};
103
130
  border-radius: 4px;
104
131
  text-align: ${(props) => props.textAlign};
105
132
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -115,7 +142,7 @@ const InputContainer = styled('input', inputProps)`
115
142
  background-color: ${(props) =>
116
143
  props.isDisabled ? props.theme.colors.grey5 : '#fff'};
117
144
  box-sizing: border-box;
118
-
145
+ max-height: ${(props) => props.inputHeight};
119
146
  &::placeholder {
120
147
  color: ${(props) =>
121
148
  props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
@@ -125,6 +152,15 @@ const InputContainer = styled('input', inputProps)`
125
152
  outline: none;
126
153
  }
127
154
  `
155
+ const IconProps = {
156
+ inputIconHeight: String
157
+ }
158
+
159
+ const Icon = styled('img', IconProps)`
160
+ position: absolute;
161
+ right: 10px;
162
+ top: 2px;
163
+ `
128
164
 
129
165
  const InputWrapper = styled.span`
130
166
  position: relative;
@@ -142,6 +178,7 @@ const UnitContainer = styled('span', inputProps)`
142
178
  right: 10px;
143
179
  top: 0;
144
180
  padding-left: 10px;
181
+ text-align: right;
145
182
  color: ${(props) =>
146
183
  props.isError
147
184
  ? props.theme.colors.red
@@ -150,11 +187,27 @@ const UnitContainer = styled('span', inputProps)`
150
187
  : props.theme.colors.mediumGray};
151
188
  `
152
189
 
153
- const ErrorMessage = styled.div`
154
- font-size: 14px;
155
- color: ${(props) => props.theme.colors.red};
190
+ const SlotContainer = styled('span', inputProps)`
191
+ text-align: right;
192
+ border-left: 1px solid
193
+ ${(props) =>
194
+ props.isError
195
+ ? props.theme.colors.red
196
+ : props.hasLength
197
+ ? props.theme.colors.black
198
+ : props.theme.colors.mediumGray};
156
199
  position: absolute;
157
- top: calc(100% + 1px);
200
+ width: ${(props) =>
201
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
202
+ right: 10px;
203
+ top: 0;
204
+ padding-left: 10px;
205
+ color: ${(props) =>
206
+ props.isError
207
+ ? props.theme.colors.red
208
+ : props.hasLength
209
+ ? props.theme.colors.black
210
+ : props.theme.colors.mediumGray};
158
211
  `
159
212
 
160
213
  const LabelWrapper = styled.div`
@@ -178,12 +231,16 @@ export default {
178
231
  ErrorMessage,
179
232
  LabelWrapper,
180
233
  LabelText,
181
- InfoText
234
+ InfoText,
235
+ Icon,
236
+ SlotContainer
182
237
  },
238
+ inheritAttrs: false,
183
239
  data() {
184
240
  return {
185
241
  textInput: '',
186
- isFocused: false
242
+ isFocused: false,
243
+ warningIcon: warningIcon
187
244
  }
188
245
  },
189
246
  props: {
@@ -203,6 +260,10 @@ export default {
203
260
  required: false,
204
261
  default: null
205
262
  },
263
+ inputHeight: {
264
+ required: false,
265
+ default: null
266
+ },
206
267
  value: {
207
268
  required: true,
208
269
  default: null
@@ -253,7 +314,7 @@ export default {
253
314
  },
254
315
  labelInfoAlign: {
255
316
  required: false,
256
- default: 'right'
317
+ default: 'left'
257
318
  },
258
319
  minNumber: {
259
320
  required: false,
@@ -263,18 +324,44 @@ export default {
263
324
  required: false,
264
325
  default: null
265
326
  },
266
- borderColor: {
267
- required: false,
268
- default: null
269
- },
270
327
  numberToStringEnabled: {
271
328
  required: false,
272
329
  default: true
330
+ },
331
+ inputIcon: {
332
+ require: false,
333
+ type: Boolean,
334
+ default: false
335
+ },
336
+ inputIconImage: {
337
+ require: false,
338
+ type: String,
339
+ default: ''
340
+ },
341
+ inputIconImageClass: {
342
+ require: false,
343
+ type: Array,
344
+ default: () => []
345
+ },
346
+ slotSize: {
347
+ required: false
348
+ }
349
+ },
350
+ computed: {
351
+ displayedPlaceholder() {
352
+ if (this.placeholder) return this.placeholder
353
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
354
+ },
355
+ hasSlot() {
356
+ return !!this.$slots.default
357
+ },
358
+ computedSlotSize() {
359
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
273
360
  }
274
361
  },
275
362
  methods: {
276
363
  onChangeHandler(event) {
277
- if (isNaN(event)) {
364
+ if (isNaN(event) || event == '') {
278
365
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
279
366
  }
280
367
  this.$emit('input-change', event)
@@ -309,6 +396,8 @@ export default {
309
396
  value: evaluated,
310
397
  numberPrecision: this.numberPrecision
311
398
  })
399
+ } else if (typeof evaluated === 'number') {
400
+ evaluated = evaluated.toFixed(this.numberPrecision)
312
401
  }
313
402
  return evaluated
314
403
  },
@@ -325,8 +414,8 @@ export default {
325
414
  })
326
415
  }
327
416
  let adjustedMinValue =
328
- value && value.length
329
- ? value
417
+ evaluatedInput && evaluatedInput.length
418
+ ? evaluatedInput
330
419
  : this.minNumber || this.minNumber === 0
331
420
  ? this.minNumber
332
421
  : ''
@@ -340,6 +429,7 @@ export default {
340
429
  this.$nextTick(() => {
341
430
  this.$refs.inputField1.$el.select()
342
431
  })
432
+ this.$emit('input-focus')
343
433
  },
344
434
  formatWithCurrency(value) {
345
435
  let adjustedMinValue =
@@ -356,6 +446,7 @@ export default {
356
446
  })
357
447
  : adjustedMinValue
358
448
  let unit = this.showLinearUnitName ? '' : this.unitName
449
+ //return input + ' ' + unit
359
450
  return input + ' ' + unit
360
451
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
361
452
  return ''
@@ -10,38 +10,40 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- :size="fontSize ? fontSize : '16'"
13
+ :size="fontSize ? fontSize : '16px'"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-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>
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 }}</error-message>
45
+ </input-error-wrapper>
43
46
  </input-wrapper>
44
- <error-message v-if="isError">{{ errorMessage }}</error-message>
45
47
  </container>
46
48
  </template>
47
49
 
@@ -49,6 +51,7 @@
49
51
  import styled from 'vue-styled-components'
50
52
  import InfoText from '../../infoText'
51
53
  import Icon from '../../icon'
54
+ import ErrorMessage from '../../errorMessage'
52
55
 
53
56
  const Container = styled.div`
54
57
  width: 100%;
@@ -69,6 +72,13 @@ const LabelWrapper = styled.div`
69
72
  justify-content: start;
70
73
  `
71
74
 
75
+ const InputErrorWrapper = styled.div`
76
+ display: inline-grid;
77
+ grid-template-row: auto auto;
78
+ grid-gap: 0px;
79
+ align-items: center;
80
+ `
81
+
72
82
  const inputProps = {
73
83
  isError: Boolean,
74
84
  inputWidth: String,
@@ -97,7 +107,11 @@ const InputContainer = styled('input', inputProps)`
97
107
  position: relative;
98
108
  font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
99
109
  color: ${(props) =>
100
- props.isError ? props.theme.colors.red : props.theme.colors.black};
110
+ props.isError
111
+ ? props.theme.colors.red
112
+ : props.isDisabled
113
+ ? props.theme.colors.grey2
114
+ : props.theme.colors.black};
101
115
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
102
116
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
103
117
  box-sizing: border-box; // to allow width of 100% with padding
@@ -126,13 +140,6 @@ const InputWrapper = styled('div', inputAttrs)`
126
140
  props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
127
141
  `
128
142
 
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
-
136
143
  const IconAttrs = { size: String }
137
144
  const IconWrapper = styled('div', IconAttrs)`
138
145
  position: absolute;
@@ -175,7 +182,8 @@ export default {
175
182
  LabelWrapper,
176
183
  Icon,
177
184
  IconWrapper,
178
- IconContainer
185
+ IconContainer,
186
+ InputErrorWrapper
179
187
  },
180
188
  data() {
181
189
  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="16" />
15
+ <info-text v-if="item.infoText" :text="item.infoText" size="16px" />
16
16
  </label-container>
17
17
  <image-container v-if="item.img">
18
18
  <radio-image :src="item.img" />
@@ -26,7 +26,7 @@
26
26
  // :disabled="true"
27
27
  // inputWidth="250px"
28
28
  // />
29
- import styled from "vue-styled-components"
29
+ import styled from 'vue-styled-components'
30
30
 
31
31
  const Container = styled.div`
32
32
  width: 100%;
@@ -34,15 +34,15 @@ const Container = styled.div`
34
34
  `
35
35
 
36
36
  const inputAttrs = { isDisabled: Boolean, inputWidth: String }
37
- const InputContainer = styled("input", inputAttrs)`
37
+ const InputContainer = styled('input', inputAttrs)`
38
38
  border: 1px solid ${(props) => props.theme.colors.mediumGray};
39
39
  padding: 11px 30px 11px 10px;
40
40
  border-radius: 4px;
41
- font-size: 16px;
41
+ font-size: 13px;
42
42
  color: ${(props) => props.theme.colors.black};
43
- width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
43
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
44
44
  box-sizing: border-box;
45
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
45
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
46
46
  background: ${(props) => props.theme.colors.white} !important;
47
47
  &::placeholder {
48
48
  color: ${(props) => props.theme.colors.darkGray};
@@ -65,33 +65,33 @@ const InputWrapper = styled.span`
65
65
  `
66
66
 
67
67
  export default {
68
- name: "search-input",
68
+ name: 'search-input',
69
69
  components: {
70
70
  InputContainer,
71
71
  InputWrapper,
72
- Container,
72
+ Container
73
73
  },
74
74
  props: {
75
75
  value: {
76
- required: true,
76
+ required: true
77
77
  },
78
78
  disabled: {
79
79
  required: false,
80
- default: false,
80
+ default: false
81
81
  },
82
82
  placeholder: {
83
83
  required: false,
84
- default: "",
84
+ default: ''
85
85
  },
86
86
  inputWidth: {
87
87
  required: false,
88
- default: null,
89
- },
88
+ default: null
89
+ }
90
90
  },
91
91
  methods: {
92
92
  onChangeHandler(event) {
93
- this.$emit("on-change", event)
94
- },
95
- },
93
+ this.$emit('on-change', event)
94
+ }
95
+ }
96
96
  }
97
97
  </script>
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="16"
13
+ size="16px"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
@@ -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>
@@ -44,6 +45,7 @@
44
45
  // label="Question 5"
45
46
  // alignItems="horizontal" // horizontal, vertical
46
47
  // :isDisabled="true"
48
+ // . fontSize="13px"
47
49
  // />
48
50
  import styled from 'vue-styled-components'
49
51
  import InfoText from '../../infoText'
@@ -175,6 +177,10 @@ export default {
175
177
  inputWidth: {
176
178
  required: false,
177
179
  default: null
180
+ },
181
+ resize: {
182
+ required: false,
183
+ default: 'none'
178
184
  }
179
185
  },
180
186
  methods: {
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="14"
13
+ size="14px"
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="14"
49
+ size="14px"
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="14"
9
+ size="14px"
10
10
  borderColor="#ccc"
11
11
  :alignText="alignInfoText"
12
12
  />
@@ -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
@@ -91,6 +94,7 @@ export const numberToString = ({ value, numberPrecision }) => {
91
94
  ? 'fr-fr'
92
95
  : localStorage.getItem('lang')
93
96
  : 'en-US'
97
+ value=parseFloat(value)
94
98
  return value.toLocaleString(selectedLang, {
95
99
  minimumFractionDigits: numberPrecision,
96
100
  maximumFractionDigits: numberPrecision