@eturnity/eturnity_reusable_components 1.2.28 → 1.2.29

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