@eturnity/eturnity_reusable_components 1.2.26-EPDM-2942.1 → 1.2.26-EPDM-3412.4

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-2942.1",
3
+ "version": "1.2.26-EPDM-3412.4",
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
@@ -6,7 +6,6 @@
6
6
  >
7
7
  <icon-image
8
8
  v-if="isHovered && !isDisabled"
9
- :hoverBg="hoverBg"
10
9
  :src="require('../../assets/icons/delete_icon.svg')"
11
10
  />
12
11
  <icon-image
@@ -28,10 +27,9 @@ const Wrapper = styled("div", wrapperAttrs)`
28
27
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
29
28
  `
30
29
 
31
- const IconImageAttrs = { hoverBg: String }
32
- const IconImage = styled('img', IconImageAttrs)`
30
+ const IconImage = styled.img`
33
31
  &:hover {
34
- background-color: ${(props) => props.hoverBg ? props.hoverBg : props.theme.colors.grey5};
32
+ background-color: ${(props) => props.theme.colors.grey5};
35
33
  border-radius: 4px;
36
34
  }
37
35
  `
@@ -47,10 +45,6 @@ export default {
47
45
  required: false,
48
46
  default: false,
49
47
  },
50
- hoverBg: {
51
- required: false,
52
- default: '',
53
- }
54
48
  },
55
49
  data() {
56
50
  return {
@@ -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,8 +100,17 @@ 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
@@ -98,8 +118,15 @@ const InputContainer = styled('input', inputProps)`
98
118
  : props.noBorder
99
119
  ? 'none'
100
120
  : '1px solid ' + props.theme.colors.mediumGray};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
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,
@@ -266,13 +327,50 @@ export default {
266
327
  numberToStringEnabled: {
267
328
  required: false,
268
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
+ allowNegative: {
342
+ required: false,
343
+ default: true
344
+ },
345
+ inputIconImageClass: {
346
+ require: false,
347
+ type: Array,
348
+ default: () => []
349
+ },
350
+ slotSize: {
351
+ required: false
352
+ }
353
+ },
354
+ computed: {
355
+ displayedPlaceholder() {
356
+ if (this.placeholder) return this.placeholder
357
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
358
+ },
359
+ hasSlot() {
360
+ return !!this.$slots.default
361
+ },
362
+ computedSlotSize() {
363
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
269
364
  }
270
365
  },
271
366
  methods: {
272
367
  onChangeHandler(event) {
273
- if (isNaN(event)) {
368
+ if (isNaN(event) || event == '') {
274
369
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
370
  }
371
+ if (!this.allowNegative) {
372
+ event = Math.abs(event)
373
+ }
276
374
  this.$emit('input-change', event)
277
375
  },
278
376
  onEvaluateCode(val) {
@@ -305,6 +403,8 @@ export default {
305
403
  value: evaluated,
306
404
  numberPrecision: this.numberPrecision
307
405
  })
406
+ } else if (typeof evaluated === 'number') {
407
+ evaluated = evaluated.toFixed(this.numberPrecision)
308
408
  }
309
409
  return evaluated
310
410
  },
@@ -321,8 +421,8 @@ export default {
321
421
  })
322
422
  }
323
423
  let adjustedMinValue =
324
- value && value.length
325
- ? value
424
+ evaluatedInput && evaluatedInput.length
425
+ ? evaluatedInput
326
426
  : this.minNumber || this.minNumber === 0
327
427
  ? this.minNumber
328
428
  : ''
@@ -336,6 +436,7 @@ export default {
336
436
  this.$nextTick(() => {
337
437
  this.$refs.inputField1.$el.select()
338
438
  })
439
+ this.$emit('input-focus')
339
440
  },
340
441
  formatWithCurrency(value) {
341
442
  let adjustedMinValue =
@@ -352,6 +453,7 @@ export default {
352
453
  })
353
454
  : adjustedMinValue
354
455
  let unit = this.showLinearUnitName ? '' : this.unitName
456
+ //return input + ' ' + unit
355
457
  return input + ' ' + unit
356
458
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
357
459
  return ''
@@ -10,38 +10,42 @@
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">{{
45
+ errorMessage
46
+ }}</error-message>
47
+ </input-error-wrapper>
43
48
  </input-wrapper>
44
- <error-message v-if="isError">{{ errorMessage }}</error-message>
45
49
  </container>
46
50
  </template>
47
51
 
@@ -49,6 +53,7 @@
49
53
  import styled from 'vue-styled-components'
50
54
  import InfoText from '../../infoText'
51
55
  import Icon from '../../icon'
56
+ import ErrorMessage from '../../errorMessage'
52
57
 
53
58
  const Container = styled.div`
54
59
  width: 100%;
@@ -69,6 +74,13 @@ const LabelWrapper = styled.div`
69
74
  justify-content: start;
70
75
  `
71
76
 
77
+ const InputErrorWrapper = styled.div`
78
+ display: inline-grid;
79
+ grid-template-row: auto auto;
80
+ grid-gap: 0px;
81
+ align-items: center;
82
+ `
83
+
72
84
  const inputProps = {
73
85
  isError: Boolean,
74
86
  inputWidth: String,
@@ -97,7 +109,11 @@ const InputContainer = styled('input', inputProps)`
97
109
  position: relative;
98
110
  font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
99
111
  color: ${(props) =>
100
- props.isError ? props.theme.colors.red : props.theme.colors.black};
112
+ props.isError
113
+ ? props.theme.colors.red
114
+ : props.isDisabled
115
+ ? props.theme.colors.grey2
116
+ : props.theme.colors.black};
101
117
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
102
118
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
103
119
  box-sizing: border-box; // to allow width of 100% with padding
@@ -126,13 +142,6 @@ const InputWrapper = styled('div', inputAttrs)`
126
142
  props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
127
143
  `
128
144
 
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
145
  const IconAttrs = { size: String }
137
146
  const IconWrapper = styled('div', IconAttrs)`
138
147
  position: absolute;
@@ -175,7 +184,8 @@ export default {
175
184
  LabelWrapper,
176
185
  Icon,
177
186
  IconWrapper,
178
- IconContainer
187
+ IconContainer,
188
+ InputErrorWrapper
179
189
  },
180
190
  data() {
181
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)`
@@ -107,13 +110,6 @@ const InputWrapper = styled('div', inputAttrs)`
107
110
  : 'auto 1fr'};
108
111
  `
109
112
 
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
113
  const labelAttrs = { fontSize: String }
118
114
  const InputLabel = styled('div', labelAttrs)`
119
115
  font-weight: bold;
@@ -175,6 +171,10 @@ export default {
175
171
  inputWidth: {
176
172
  required: false,
177
173
  default: null
174
+ },
175
+ resize: {
176
+ required: false,
177
+ default: 'none'
178
178
  }
179
179
  },
180
180
  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