@eturnity/eturnity_reusable_components 1.2.18 → 1.2.19-EPDM-5262.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.18",
3
+ "version": "1.2.19-EPDM-5262.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -2,62 +2,37 @@
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
4
  <br />
5
- <modal backdrop="dark" :isLoading="false" :isOpen="true">
6
- <main-table titleText="My Table">
7
- <thead>
8
- <tr>
9
- <th>Column 1</th>
10
- <th>Column 2</th>
11
- <th>Column 3</th>
12
- <div />
13
- </tr>
14
- </thead>
15
- <tbody>
16
- <tr>
17
- <!-- <table-dropdown
18
- :colSpan="3"
19
- :tableItems="getDropdownValues()"
20
- @toggle-dropdown-open="toggleDropdownOpen()"
21
- @item-selected="onItemSelected({ item: $event, index })"
22
- :isOpen="isDropdownOpen()"
23
- :optionItems="itemOptions"
24
- :optionsDisplay="['display_name', 'company_item_number', 'model']"
25
- /> -->
26
- <td>Test</td>
27
- <div class="icons-container">
28
- <three-dots :options="listOptions" :isLoading="false" />
29
- </div>
30
- </tr>
31
- </tbody>
32
- </main-table>
33
- </modal>
5
+ <input-number
6
+ :value="inputValue"
7
+ @input-change="inputValue = $event"
8
+ inputWidth="250px"
9
+ slotSize="50%"
10
+ ><InputAnnexContainer>
11
+ <span>123m2</span>
12
+ <info-text size="10" text="infoText ceci est le text"></info-text>
13
+ </InputAnnexContainer>
14
+ </input-number>
15
+ <input-number
16
+ :value="inputValue"
17
+ @input-change="inputValue = $event"
18
+ inputWidth="250px"
19
+ slotSize="50%"
20
+ :isError="true"
21
+ ><InputAnnexContainer>
22
+ <span>123m2</span>
23
+ <info-text size="15" text="infoText ceci est le text"></info-text>
24
+ </InputAnnexContainer>
25
+ </input-number>
34
26
  <br />
35
- <toggle
36
- @on-toggle-change="onInputChange($event)"
37
- :isChecked="inputValue"
38
- label="My Label Text"
39
- infoTextMessage="This is my test message"
40
- infoTextAlign="right"
41
- labelAlign="right"
42
- :disabled="false"
43
- />
44
27
  <br />
45
28
  <input-number
46
29
  placeholder="Enter distance"
47
30
  :numberPrecision="2"
48
31
  :value="inputValue"
49
32
  @input-change="onInputChange($event)"
50
- />
33
+ >unit</input-number
34
+ >
51
35
  <br />
52
- <page-subtitle text="My Subtitle" infoText="My info Text" />
53
- <spinner size="30px" />
54
- <checkbox
55
- label="Do you accept the Terms?"
56
- :isChecked="true"
57
- size="small"
58
- :isDisabled="false"
59
- />
60
- <external-button text="Click me!" minWidth="500px" />
61
36
  </page-container>
62
37
  </ThemeProvider>
63
38
  </template>
@@ -66,16 +41,15 @@
66
41
  import { ThemeProvider } from 'vue-styled-components'
67
42
  import theme from './assets/theme'
68
43
  import styled from 'vue-styled-components'
69
- import MainTable from '@/components/tables/mainTable'
70
- import ThreeDots from '@/components/threeDots'
71
- import Toggle from '@/components/inputs/toggle'
44
+
72
45
  import InputNumber from '@/components/inputs/inputNumber'
73
- import Checkbox from '@/components/inputs/checkbox'
74
- import PageSubtitle from '@/components/pageSubtitle'
75
- import Spinner from '@/components/spinner'
76
- import ExternalButton from '@/components/buttons/externalButton'
77
- import Modal from '@/components/modals/modal'
46
+ import infoText from '@/components/infoText'
78
47
  // import TableDropdown from "@/components/tableDropdown"
48
+ const InputAnnexContainer = styled.div`
49
+ display: grid;
50
+ grid-template-columns: auto auto;
51
+ grid-gap: 10px;
52
+ `
79
53
 
80
54
  const PageContainer = styled.div`
81
55
  padding: 40px;
@@ -86,15 +60,10 @@ export default {
86
60
  components: {
87
61
  ThemeProvider,
88
62
  PageContainer,
89
- MainTable,
90
- ThreeDots,
91
- Toggle,
92
63
  InputNumber,
93
- PageSubtitle,
94
- Spinner,
95
- Checkbox,
96
- ExternalButton,
97
- Modal,
64
+ infoText,
65
+ InputAnnexContainer
66
+ // TableDropdown,
98
67
  },
99
68
  data() {
100
69
  return {
@@ -104,7 +73,7 @@ export default {
104
73
  number_format_precision: 4,
105
74
  number_min_allowed: 0,
106
75
  number_max_allowed: 10,
107
- unit_short_name: 'cm',
76
+ unit_short_name: 'cm'
108
77
  },
109
78
  dropdownOpen: false,
110
79
  isChecked: false,
@@ -112,47 +81,47 @@ export default {
112
81
  {
113
82
  name: 'Option 1',
114
83
  value: 'option_1',
115
- disabled: true,
84
+ disabled: true
116
85
  },
117
86
  {
118
87
  name: 'Option 2',
119
- value: 'option_2',
88
+ value: 'option_2'
120
89
  },
121
90
  {
122
91
  name: 'Option 3',
123
- value: 'option_3',
92
+ value: 'option_3'
124
93
  },
125
94
  {
126
95
  name: 'Option 4',
127
- value: 'option_4',
128
- },
96
+ value: 'option_4'
97
+ }
129
98
  ],
130
99
  itemOptions: [
131
100
  {
132
101
  display_name: 'Test 1',
133
102
  company_item_number: '123',
134
103
  model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
135
- id: 1,
104
+ id: 1
136
105
  },
137
106
  {
138
107
  display_name: 'Test 2',
139
108
  company_item_number: '1234',
140
109
  model: 'BTB-123',
141
- id: 2,
110
+ id: 2
142
111
  },
143
112
  {
144
113
  display_name: 'Test 3',
145
114
  company_item_number: '12345',
146
115
  model: 'BTB-543',
147
- id: 3,
116
+ id: 3
148
117
  },
149
118
  {
150
119
  display_name: 'Test 4',
151
120
  company_item_number: '123456',
152
121
  model: 'BTB-4930',
153
- id: 4,
154
- },
155
- ],
122
+ id: 4
123
+ }
124
+ ]
156
125
  }
157
126
  },
158
127
  methods: {
@@ -177,21 +146,21 @@ export default {
177
146
  {
178
147
  value: this.getComponentInfo({
179
148
  row: this.itemOptions[0],
180
- value: 'display_name',
181
- }),
149
+ value: 'display_name'
150
+ })
182
151
  },
183
152
  {
184
153
  value: this.getComponentInfo({
185
154
  row: this.itemOptions[0],
186
- value: 'company_item_number',
187
- }),
155
+ value: 'company_item_number'
156
+ })
188
157
  },
189
158
  {
190
159
  value: this.getComponentInfo({
191
160
  row: this.itemOptions[0],
192
- value: 'model',
193
- }),
194
- },
161
+ value: 'model'
162
+ })
163
+ }
195
164
  ]
196
165
  return items
197
166
  },
@@ -205,8 +174,8 @@ export default {
205
174
  item = '-'
206
175
  }
207
176
  return item
208
- },
209
- },
177
+ }
178
+ }
210
179
  }
211
180
  </script>
212
181
 
@@ -1,34 +1,34 @@
1
1
  const theme = {
2
2
  colors: {
3
- primary: '#48a2d0',
4
- secondary: '#fdb813',
5
- tertiary: '#d5d5d5',
6
- black: '#353535',
7
- yellow: '#fdb813',
8
- darkGray: '#818181',
9
- gray1: '#666',
10
- mediumGray: '#d5d5d5',
11
- lightGray: '#f2f2f2',
12
- white: '#fff',
13
- blue: '#48a2d0',
14
- red: '#ff5656',
15
- blue1: '#e4efff',
16
- grey1: '#666',
17
- grey2: '#c4c4c4',
18
- grey3: '#b2b9c5',
19
- grey4: '#dee2eb',
20
- grey5: '#fafafa',
21
- green: '#99db0c',
22
- disabled: '#dfe1e1'
3
+ primary: "#48a2d0",
4
+ secondary: "#fdb813",
5
+ tertiary: "#d5d5d5",
6
+ black: "#353535",
7
+ yellow: "#fdb813",
8
+ darkGray: "#818181",
9
+ gray1: "#666",
10
+ mediumGray: "#d5d5d5",
11
+ lightGray: "#f2f2f2",
12
+ white: "#fff",
13
+ blue: "#48a2d0",
14
+ red: "#ff5656",
15
+ blue1: "#e4efff",
16
+ grey1: "#666",
17
+ grey2: "#c4c4c4",
18
+ grey3: "#b2b9c5",
19
+ grey4: "#ebeef4",
20
+ grey5: "#fafafa",
21
+ green: "#99db0c",
22
+ disabled: "#dfe1e1",
23
23
  },
24
24
  screen: {
25
- mobileSmall: '345px',
26
- mobile: '425px',
27
- mobileLarge: '530px',
28
- tablet: '768px',
29
- tabletLarge: '950px'
25
+ mobileSmall: "345px",
26
+ mobile: "425px",
27
+ mobileLarge: "530px",
28
+ tablet: "768px",
29
+ tabletLarge: "950px",
30
30
  },
31
- borderRadius: '4px'
31
+ borderRadius: "4px",
32
32
  }
33
33
 
34
34
  export default theme
@@ -37,8 +37,7 @@ const IconImage = styled('div', IconImageProps)`
37
37
  height: ${(props) => props.size};
38
38
  }
39
39
  svg > path {
40
- ${(props) =>
41
- props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
40
+ ${(props) => props.color && `fill: ${props.color};`}
42
41
  }
43
42
  &:hover > svg > path {
44
43
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
@@ -1,6 +1,6 @@
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"
@@ -9,20 +9,7 @@
9
9
  @mouseenter="toggleShowInfo()"
10
10
  @mouseleave="toggleShowInfo()"
11
11
  >
12
- <svg
13
- class="img-icon"
14
- :width="size"
15
- :height="size"
16
- viewBox="0 0 24 24"
17
- fill="none"
18
- xmlns="http://www.w3.org/2000/svg"
19
- >
20
- <path
21
- class="img-icon"
22
- d="M20.4853 3.51469C18.2188 1.24823 15.2053 0 12 0C8.79469 0 5.78123 1.24823 3.51469 3.51469C1.24823 5.78123 0 8.79469 0 12C0 15.2053 1.24823 18.2188 3.51469 20.4853C5.78123 22.7518 8.79469 24 12 24C15.2053 24 18.2188 22.7518 20.4853 20.4853C22.7518 18.2188 24 15.2053 24 12C24 8.79469 22.7518 5.78123 20.4853 3.51469ZM12 3.28125C13.4216 3.28125 14.5781 4.4378 14.5781 5.85938C14.5781 7.28095 13.4216 8.4375 12 8.4375C10.5784 8.4375 9.42188 7.28095 9.42188 5.85938C9.42188 4.4378 10.5784 3.28125 12 3.28125ZM15.2812 19.6875H8.71875V18.2812H10.125V11.9167H8.71875V10.5104H13.875V18.2812H15.2812V19.6875Z"
23
- fill="#D5D5D5"
24
- />
25
- </svg>
12
+ <icon :size="size + 'px'" name="info" :color="iconColor" />
26
13
  </icon-img>
27
14
  <text-overlay
28
15
  v-if="showInfo"
@@ -44,19 +31,16 @@
44
31
  // size="20"
45
32
  // alignText="right" // default is left
46
33
  // />
47
-
48
- import styled from "vue-styled-components"
49
-
50
- const IconWrapper = styled.div`
51
- position: relative;
52
- `
34
+ import theme from '@/assets/theme.js'
35
+ import styled from 'vue-styled-components'
36
+ import icon from '../icon'
53
37
 
54
38
  const textAttrs = { borderColor: String, alignText: String }
55
- const TextOverlay = styled("div", textAttrs)`
39
+ const TextOverlay = styled('div', textAttrs)`
56
40
  position: absolute;
57
41
  top: 26px;
58
- right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
- left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
42
+ right: ${(props) => (props.alignText === 'left' ? '-10px' : 'inherit')};
43
+ left: ${(props) => (props.alignText === 'left' ? 'inherit' : '-10px')};
60
44
  background: ${(props) => props.theme.colors.black};
61
45
  padding: 10px;
62
46
  width: max-content;
@@ -68,12 +52,12 @@ const TextOverlay = styled("div", textAttrs)`
68
52
  color: ${(props) => props.theme.colors.white};
69
53
 
70
54
  :before {
71
- content: "";
55
+ content: '';
72
56
  background-color: ${(props) => props.theme.colors.black};
73
57
  position: absolute;
74
58
  top: 2px;
75
- right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
- left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
59
+ right: ${(props) => (props.alignText === 'left' ? '-12px' : 'inherit')};
60
+ left: ${(props) => (props.alignText === 'left' ? 'inherit' : '40px')};
77
61
  height: 8px;
78
62
  width: 8px;
79
63
  transform-origin: center center;
@@ -82,18 +66,15 @@ const TextOverlay = styled("div", textAttrs)`
82
66
  `
83
67
 
84
68
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
85
- const IconImg = styled("div", iconAttrs)`
86
- cursor: pointer;
87
- height: ${(props) => props.size + "px"};
88
69
 
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
- }
70
+ const IconWrapper = styled('div', iconAttrs)`
71
+ position: relative;
72
+ top: 1px;
73
+ height: ${(props) => props.size}px;
74
+ `
75
+ const IconImg = styled('div', iconAttrs)`
76
+ cursor: pointer;
77
+ height: ${(props) => props.size}px;
97
78
  `
98
79
 
99
80
  const ComponentWrapper = styled.div`
@@ -101,38 +82,39 @@ const ComponentWrapper = styled.div`
101
82
  `
102
83
 
103
84
  export default {
104
- name: "info-text",
85
+ name: 'info-text',
105
86
  components: {
106
87
  IconWrapper,
107
88
  TextOverlay,
108
89
  ComponentWrapper,
109
90
  IconImg,
91
+ icon
110
92
  },
111
93
  props: {
112
94
  text: {
113
- required: true,
95
+ required: true
114
96
  },
115
97
  borderColor: {
116
98
  required: false,
117
- default: null,
99
+ default: null
118
100
  },
119
101
  size: {
120
102
  required: false,
121
- default: "20",
103
+ default: '14'
122
104
  },
123
105
  alignText: {
124
106
  required: false,
125
- default: "left", // "left" or "right"
126
- },
107
+ default: 'left' // "left" or "right"
108
+ }
127
109
  },
128
110
  methods: {
129
111
  toggleShowInfo() {
130
112
  this.showInfo = !this.showInfo
131
113
 
132
114
  if (this.showInfo) {
133
- document.addEventListener("click", this.clickOutside)
115
+ document.addEventListener('click', this.clickOutside)
134
116
  } else {
135
- document.removeEventListener("click", this.clickOutside)
117
+ document.removeEventListener('click', this.clickOutside)
136
118
  }
137
119
  },
138
120
  clickOutside(event) {
@@ -140,12 +122,21 @@ export default {
140
122
  return
141
123
  }
142
124
  this.toggleShowInfo()
143
- },
125
+ }
144
126
  },
145
127
  data() {
146
128
  return {
147
- showInfo: false,
129
+ showInfo: false
148
130
  }
149
131
  },
132
+ computed: {
133
+ iconColor() {
134
+ return this.isActive
135
+ ? this.borderColor
136
+ ? this.borderColor
137
+ : theme.colors.secondary
138
+ : theme.colors.mediumGray
139
+ }
140
+ }
150
141
  }
151
- </script>
142
+ </script>
@@ -33,7 +33,7 @@
33
33
  // backgroundColor="red"
34
34
  // :isDisabled="true"
35
35
  // />
36
- import styled from 'vue-styled-components'
36
+ import styled from "vue-styled-components"
37
37
 
38
38
  const ComponentWrapper = styled.div`
39
39
  min-height: 18px;
@@ -45,33 +45,34 @@ const containerAttrs = {
45
45
  hasLabel: Boolean,
46
46
  backgroundColor: String,
47
47
  isChecked: Boolean,
48
- isDisabled: Boolean
48
+ isDisabled: Boolean,
49
49
  }
50
- const Container = styled('label', containerAttrs)`
50
+ const Container = styled("label", containerAttrs)`
51
51
  display: grid;
52
- grid-template-columns: ${(props) => (props.hasLabel ? '18px auto' : '18px')};
52
+ grid-template-columns: ${(props) => (props.hasLabel ? "18px auto" : "18px")};
53
53
  grid-gap: 16px;
54
54
  align-content: center;
55
+ /* align-items: center; */
55
56
  color: ${(props) => props.theme.colors.black};
56
57
  position: relative;
57
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
58
+ cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
58
59
  font-size: 16px;
59
60
  user-select: none;
60
61
 
61
62
  .checkmark {
62
63
  position: absolute;
63
64
  height: ${(props) =>
64
- props.size === 'medium'
65
- ? '25px'
66
- : props.size === 'small'
67
- ? '16px'
68
- : '25px'};
65
+ props.size === "medium"
66
+ ? "25px"
67
+ : props.size === "small"
68
+ ? "16px"
69
+ : "25px"};
69
70
  width: ${(props) =>
70
- props.size === 'medium'
71
- ? '25px'
72
- : props.size === 'small'
73
- ? '16px'
74
- : '25px'};
71
+ props.size === "medium"
72
+ ? "25px"
73
+ : props.size === "small"
74
+ ? "16px"
75
+ : "25px"};
75
76
  background-color: ${(props) =>
76
77
  props.isChecked
77
78
  ? props.backgroundColor
@@ -79,7 +80,7 @@ const Container = styled('label', containerAttrs)`
79
80
  : props.theme.colors.green
80
81
  : props.isDisabled
81
82
  ? props.theme.colors.lightGray
82
- : '#fff'};
83
+ : "#fff"};
83
84
  border-radius: 4px;
84
85
  border: 1px solid
85
86
  ${(props) =>
@@ -90,34 +91,34 @@ const Container = styled('label', containerAttrs)`
90
91
  : props.theme.colors.mediumGray};
91
92
 
92
93
  &:after {
93
- content: '';
94
+ content: "";
94
95
  position: absolute;
95
- display: ${(props) => (props.isChecked ? 'block' : 'none')};
96
+ display: ${(props) => (props.isChecked ? "block" : "none")};
96
97
  }
97
98
  }
98
99
 
99
100
  .checkmark:after {
100
101
  left: ${(props) =>
101
- props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
102
+ props.size === "medium" ? "9px" : props.size === "small" ? "5px" : "9px"};
102
103
  top: ${(props) =>
103
- props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
104
+ props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
104
105
  width: ${(props) =>
105
- props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
106
+ props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
106
107
  height: ${(props) =>
107
- props.size === 'medium'
108
- ? '10px'
109
- : props.size === 'small'
110
- ? '6px'
111
- : '10px'};
108
+ props.size === "medium"
109
+ ? "10px"
110
+ : props.size === "small"
111
+ ? "6px"
112
+ : "10px"};
112
113
  border: solid
113
114
  ${(props) =>
114
115
  props.checkColor ? props.checkColor : props.theme.colors.white};
115
116
  border-width: ${(props) =>
116
- props.size === 'medium'
117
- ? '0 3px 3px 0'
118
- : props.size === 'small'
119
- ? '0 2px 2px 0'
120
- : '0 3px 3px 0'};
117
+ props.size === "medium"
118
+ ? "0 3px 3px 0"
119
+ : props.size === "small"
120
+ ? "0 2px 2px 0"
121
+ : "0 3px 3px 0"};
121
122
  transform: rotate(45deg);
122
123
  }
123
124
  `
@@ -134,49 +135,49 @@ const InputCheckbox = styled.input`
134
135
  const LabelText = styled.div`
135
136
  font-size: 13px;
136
137
  display: grid;
137
- align-items: flex-start;
138
+ align-items: center;
138
139
  min-height: 18px;
139
140
  `
140
141
 
141
142
  export default {
142
- name: 'checkbox',
143
+ name: "checkbox",
143
144
  components: {
144
145
  ComponentWrapper,
145
146
  Container,
146
147
  InputCheckbox,
147
- LabelText
148
+ LabelText,
148
149
  },
149
150
  props: {
150
151
  label: {
151
152
  required: false,
152
- default: ''
153
+ default: "",
153
154
  },
154
155
  isChecked: {
155
156
  required: true,
156
- default: false
157
+ default: false,
157
158
  },
158
159
  checkColor: {
159
- required: false
160
+ required: false,
160
161
  },
161
162
  size: {
162
163
  required: false,
163
- default: 'medium' // small, medium
164
+ default: "medium", // small, medium
164
165
  },
165
166
  backgroundColor: {
166
- required: false
167
+ required: false,
167
168
  },
168
169
  isDisabled: {
169
170
  required: false,
170
- default: false
171
- }
171
+ default: false,
172
+ },
172
173
  },
173
174
  methods: {
174
175
  onChangeHandler(value) {
175
176
  if (this.isDisabled) {
176
177
  return
177
178
  }
178
- this.$emit('on-event-handler', value)
179
- }
180
- }
179
+ this.$emit("on-event-handler", value)
180
+ },
181
+ },
181
182
  }
182
183
  </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,7 +8,7 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="13"
11
+ size="14"
12
12
  :alignText="labelInfoAlign"
13
13
  />
14
14
  </label-wrapper>
@@ -30,9 +30,15 @@
30
30
  :textAlign="textAlign"
31
31
  :fontSize="fontSize"
32
32
  :fontColor="fontColor"
33
+ :hasSlot="hasSlot"
34
+ :slotSize="slotSize"
33
35
  />
36
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
37
+ <slot></slot>
38
+ </slot-container>
39
+
34
40
  <unit-container
35
- v-if="unitName && showLinearUnitName"
41
+ v-if="unitName && showLinearUnitName && !hasSlot"
36
42
  :hasLength="!!textInput.length"
37
43
  :isError="isError"
38
44
  >{{ unitName }}</unit-container
@@ -75,11 +81,6 @@ import {
75
81
  } from '../../../helpers/numberConverter'
76
82
  import InfoText from '../../infoText'
77
83
 
78
- const Container = styled.div`
79
- width: 100%;
80
- position: relative;
81
- `
82
-
83
84
  const inputProps = {
84
85
  isError: Boolean,
85
86
  hasUnit: Boolean,
@@ -89,8 +90,16 @@ const inputProps = {
89
90
  noBorder: Boolean,
90
91
  textAlign: String,
91
92
  fontSize: String,
92
- fontColor: String
93
+ fontColor: String,
94
+ hasSlot: Boolean,
95
+ slotSize: String
93
96
  }
97
+
98
+ const Container = styled('div', inputProps)`
99
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
100
+ position: relative;
101
+ `
102
+
94
103
  const InputContainer = styled('input', inputProps)`
95
104
  border: ${(props) =>
96
105
  props.isError
@@ -98,8 +107,15 @@ const InputContainer = styled('input', inputProps)`
98
107
  : props.noBorder
99
108
  ? 'none'
100
109
  : '1px solid ' + props.theme.colors.mediumGray};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
110
+ padding-top: 11px;
111
+ padding-bottom: 11px;
112
+ padding-left: 10px;
113
+ padding-right: ${(props) =>
114
+ props.slotSize
115
+ ? 'calc(' + props.slotSize + ' + 10px)'
116
+ : props.hasUnit
117
+ ? '40px'
118
+ : '5px'};
103
119
  border-radius: 4px;
104
120
  text-align: ${(props) => props.textAlign};
105
121
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -142,6 +158,7 @@ const UnitContainer = styled('span', inputProps)`
142
158
  right: 10px;
143
159
  top: 0;
144
160
  padding-left: 10px;
161
+ text-align: right;
145
162
  color: ${(props) =>
146
163
  props.isError
147
164
  ? props.theme.colors.red
@@ -150,6 +167,28 @@ const UnitContainer = styled('span', inputProps)`
150
167
  : props.theme.colors.mediumGray};
151
168
  `
152
169
 
170
+ const SlotContainer = styled('span', inputProps)`
171
+ text-align: right;
172
+ border-left: 1px solid
173
+ ${(props) =>
174
+ props.isError
175
+ ? props.theme.colors.red
176
+ : props.hasLength
177
+ ? props.theme.colors.black
178
+ : props.theme.colors.mediumGray};
179
+ position: absolute;
180
+ width: ${(props) =>
181
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
182
+ right: 10px;
183
+ top: 0;
184
+ padding-left: 10px;
185
+ color: ${(props) =>
186
+ props.isError
187
+ ? props.theme.colors.red
188
+ : props.hasLength
189
+ ? props.theme.colors.black
190
+ : props.theme.colors.mediumGray};
191
+ `
153
192
  const ErrorMessage = styled.div`
154
193
  font-size: 14px;
155
194
  color: ${(props) => props.theme.colors.red};
@@ -178,6 +217,7 @@ export default {
178
217
  ErrorMessage,
179
218
  LabelWrapper,
180
219
  LabelText,
220
+ SlotContainer,
181
221
  InfoText
182
222
  },
183
223
  data() {
@@ -266,6 +306,18 @@ export default {
266
306
  numberToStringEnabled: {
267
307
  required: false,
268
308
  default: true
309
+ },
310
+ slotSize: {
311
+ required: false
312
+ }
313
+ },
314
+ computed: {
315
+ hasSlot() {
316
+ console.log(this.$slots.default)
317
+ return !!this.$slots.default
318
+ },
319
+ computedSlotSize() {
320
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
269
321
  }
270
322
  },
271
323
  methods: {
@@ -300,12 +352,10 @@ export default {
300
352
  }
301
353
  })
302
354
  let evaluated = eval(formatted.join(''))
303
- if (typeof evaluated === 'string') {
304
- evaluated = stringToNumber({
305
- value: evaluated,
306
- numberPrecision: this.numberPrecision
307
- })
308
- }
355
+ evaluated = stringToNumber({
356
+ value: evaluated,
357
+ numberPrecision: this.numberPrecision
358
+ })
309
359
  return evaluated
310
360
  },
311
361
  onInputBlur(e) {
@@ -387,4 +437,4 @@ export default {
387
437
  }
388
438
  }
389
439
  }
390
- </script>
440
+ </script>
@@ -3,18 +3,15 @@
3
3
  :isOpen="isOpen"
4
4
  :class="{ visible: isOpen, hidden: !isOpen }"
5
5
  @click.native="onOutsideClose()"
6
- :backdrop="backdrop"
7
6
  >
8
7
  <modal-container @click.stop>
9
- <spinner v-if="isLoading" size="50px" :limitedToModal="true" />
10
- <content-container :visible="!isLoading">
11
- <slot />
12
- </content-container>
8
+ <spinner v-if="isLoading" size="50px" :fullWidth="true" />
13
9
  <close-button
14
10
  v-if="!hideClose"
15
11
  @click.native="onCloseModal()"
16
12
  class="close"
17
13
  />
14
+ <slot />
18
15
  </modal-container>
19
16
  </page-wrapper>
20
17
  </template>
@@ -31,12 +28,7 @@ import styled from 'vue-styled-components'
31
28
  import CloseButton from '../../buttons/closeButton'
32
29
  import Spinner from '../../spinner'
33
30
 
34
- const contentAttrs = { visible: Boolean }
35
- const ContentContainer = styled('div', contentAttrs)`
36
- visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
37
- `
38
-
39
- const pageAttrs = { isOpen: Boolean, backdrop: String }
31
+ const pageAttrs = { isOpen: Boolean }
40
32
  const PageWrapper = styled('div', pageAttrs)`
41
33
  position: fixed;
42
34
  display: grid;
@@ -44,10 +36,7 @@ const PageWrapper = styled('div', pageAttrs)`
44
36
  left: 0;
45
37
  width: 100%;
46
38
  height: 100%;
47
- background-color: ${(props) =>
48
- props.backdrop == 'dark'
49
- ? 'rgba(0, 0, 0, 0.4)'
50
- : 'rgba(255, 255, 255, 0.9)'};
39
+ background-color: rgba(255, 255, 255, 0.9);
51
40
  z-index: 99999;
52
41
  overflow: auto;
53
42
 
@@ -109,8 +98,7 @@ export default {
109
98
  PageWrapper,
110
99
  ModalContainer,
111
100
  CloseButton,
112
- Spinner,
113
- ContentContainer
101
+ Spinner
114
102
  },
115
103
  props: {
116
104
  isOpen: {
@@ -128,10 +116,6 @@ export default {
128
116
  hideClose: {
129
117
  required: false,
130
118
  default: false
131
- },
132
- backdrop: {
133
- required: false,
134
- default: 'white'
135
119
  }
136
120
  },
137
121
  methods: {
@@ -151,4 +135,4 @@ export default {
151
135
  }
152
136
  }
153
137
  }
154
- </script>
138
+ </script>
@@ -26,6 +26,5 @@ export const Default = Template.bind({
26
26
  preventOutsideClose: true,
27
27
  isLoading: false,
28
28
  hideClose: false,
29
- backdrop: 'dark',
30
- })
29
+ });
31
30
  Default.args = {};
@@ -7,7 +7,7 @@
7
7
  />
8
8
  </container>
9
9
  </spinner-container>
10
- <container v-else :limitedToModal="limitedToModal">
10
+ <container v-else>
11
11
  <spinner-wrapper
12
12
  :size="size"
13
13
  :src="require('../../assets/icons/black_spinner.svg')"
@@ -18,7 +18,7 @@
18
18
  <script>
19
19
  // import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
20
20
  // <spinner size="30px" />
21
- import styled from 'vue-styled-components'
21
+ import styled from "vue-styled-components"
22
22
 
23
23
  const SpinnerContainer = styled.div`
24
24
  position: fixed;
@@ -32,41 +32,34 @@ const SpinnerContainer = styled.div`
32
32
  justify-items: center;
33
33
  z-index: 100;
34
34
  `
35
- const containerAttrs = { limitedToModal: Boolean }
36
- const Container = styled('div', containerAttrs)`
35
+
36
+ const Container = styled.div`
37
37
  display: grid;
38
38
  align-items: center;
39
39
  justify-items: center;
40
- position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
41
- height: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
42
- width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
43
40
  `
44
41
 
45
42
  const spinnerAttrs = { size: String }
46
- const SpinnerWrapper = styled('img', spinnerAttrs)`
47
- width: ${(props) => (props.size ? props.size : '60px')};
43
+ const SpinnerWrapper = styled("img", spinnerAttrs)`
44
+ width: ${(props) => (props.size ? props.size : "60px")};
48
45
  `
49
46
 
50
47
  export default {
51
- name: 'spinner',
48
+ name: "spinner",
52
49
  components: {
53
50
  Container,
54
51
  SpinnerWrapper,
55
- SpinnerContainer
52
+ SpinnerContainer,
56
53
  },
57
54
  props: {
58
55
  fullWidth: {
59
56
  required: false,
60
- default: false
61
- },
62
- limitedToModal: {
63
- required: false,
64
- default: false
57
+ default: false,
65
58
  },
66
59
  size: {
67
60
  required: false,
68
- default: null
69
- }
70
- }
61
+ default: null,
62
+ },
63
+ },
71
64
  }
72
- </script>
65
+ </script>
@@ -4,21 +4,20 @@ 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
10
13
  if (
11
14
  selectedLang === 'de-DE' ||
12
- selectedLang === 'de-de' ||
13
15
  selectedLang === 'no-no' ||
14
16
  selectedLang === 'da-dk' ||
15
17
  selectedLang === 'de-lu' ||
16
18
  selectedLang === 'de-be' ||
17
19
  selectedLang === 'es-es' ||
18
- selectedLang === 'de' ||
19
- selectedLang === 'it' ||
20
- selectedLang === 'nl-nl' ||
21
- selectedLang === 'nl-be'
20
+ selectedLang === 'de'
22
21
  ) {
23
22
  // replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
24
23
  if (allowNegative) {
@@ -46,15 +45,9 @@ export const stringToNumber = ({
46
45
  ) {
47
46
  // replace ' with blank: 1'234.56 --> 1234.56
48
47
  if (allowNegative) {
49
- newVal = newVal
50
- .replace(/[^\d-.,']/g, '')
51
- .replace(/[,\s]/, '')
52
- .replace(/['\s]/g, '')
48
+ newVal = newVal.replace(/[^\d-.,']/g, '').replace(/['\s]/g, '')
53
49
  } else {
54
- newVal = newVal
55
- .replace(/[^\d.,']/g, '')
56
- .replace(/[,\s]/, '')
57
- .replace(/['\s]/g, '')
50
+ newVal = newVal.replace(/[^\d.,']/g, '').replace(/['\s]/g, '')
58
51
  }
59
52
  } else if (
60
53
  selectedLang === 'fr-fr' ||