@eturnity/eturnity_reusable_components 1.2.15-QA03-2092022.0 → 1.2.16-QA03-23092022.0

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.15-QA03-2092022.0",
3
+ "version": "1.2.16-QA03-23092022.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -2,54 +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="10px" 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="15px" 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
- :value="num"
47
- @input-change="num = $event"
48
- unitName="t"
49
- id="biebie"
50
- test="koko"
51
- @keydown="keydownHandler"
52
- />
29
+ placeholder="Enter distance"
30
+ :numberPrecision="2"
31
+ :value="inputValue"
32
+ @input-change="onInputChange($event)"
33
+ >unit</input-number
34
+ >
35
+ <br />
53
36
  </page-container>
54
37
  </ThemeProvider>
55
38
  </template>
@@ -58,16 +41,14 @@
58
41
  import { ThemeProvider } from 'vue-styled-components'
59
42
  import theme from './assets/theme'
60
43
  import styled from 'vue-styled-components'
61
- import MainTable from '@/components/tables/mainTable'
62
- import ThreeDots from '@/components/threeDots'
63
- import Toggle from '@/components/inputs/toggle'
64
44
  import InputNumber from '@/components/inputs/inputNumber'
65
- import Checkbox from '@/components/inputs/checkbox'
66
- import PageSubtitle from '@/components/pageSubtitle'
67
- import Spinner from '@/components/spinner'
68
- import ExternalButton from '@/components/buttons/externalButton'
69
- import Modal from '@/components/modals/modal'
45
+ import infoText from '@/components/infoText'
70
46
  // import TableDropdown from "@/components/tableDropdown"
47
+ const InputAnnexContainer = styled.div`
48
+ display: grid;
49
+ grid-template-columns: auto auto;
50
+ grid-gap: 10px;
51
+ `
71
52
 
72
53
  const PageContainer = styled.div`
73
54
  padding: 40px;
@@ -78,19 +59,13 @@ export default {
78
59
  components: {
79
60
  ThemeProvider,
80
61
  PageContainer,
81
- MainTable,
82
- ThreeDots,
83
- Toggle,
84
62
  InputNumber,
85
- PageSubtitle,
86
- Spinner,
87
- Checkbox,
88
- ExternalButton,
89
- Modal
63
+ infoText,
64
+ InputAnnexContainer
65
+ // TableDropdown,
90
66
  },
91
67
  data() {
92
68
  return {
93
- num: 42,
94
69
  inputValue: null,
95
70
  checkedOption: 'button_1',
96
71
  question: {
@@ -149,9 +124,6 @@ export default {
149
124
  }
150
125
  },
151
126
  methods: {
152
- keydownHandler(e) {
153
- console.log('test', e)
154
- },
155
127
  getTheme() {
156
128
  return theme
157
129
  },
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12 -1.04907e-06C14.3734 -8.41587e-07 16.6934 0.703787 18.6668 2.02236C20.6402 3.34094 22.1783 5.21509 23.0865 7.4078C23.9948 9.60051 24.2324 12.0133 23.7694 14.3411C23.3064 16.6689 22.1635 18.8071 20.4853 20.4853C18.807 22.1635 16.6688 23.3064 14.3411 23.7694C12.0133 24.2324 9.6005 23.9948 7.40779 23.0866C5.21508 22.1783 3.34093 20.6402 2.02236 18.6668C0.703782 16.6935 -6.97861e-06 14.3734 -6.77112e-06 12C-6.49289e-06 8.8174 1.26428 5.76515 3.51471 3.51472C5.76515 1.26428 8.8174 -1.32731e-06 12 -1.04907e-06ZM9.74999 19.81L14.25 19.81L14.25 10.81L9.74999 10.81L9.74999 19.81ZM12 8.69C12.445 8.69 12.88 8.55804 13.25 8.31081C13.62 8.06357 13.9084 7.71217 14.0787 7.30104C14.249 6.8899 14.2936 6.4375 14.2068 6.00105C14.1199 5.56459 13.9057 5.16368 13.591 4.84901C13.2763 4.53434 12.8754 4.32005 12.4389 4.23323C12.0025 4.14642 11.5501 4.19097 11.139 4.36127C10.7278 4.53157 10.3764 4.81996 10.1292 5.18997C9.88195 5.55998 9.74999 5.99499 9.74999 6.44C9.75079 7.03649 9.98809 7.60833 10.4099 8.03011C10.8317 8.4519 11.4035 8.68921 12 8.69Z" fill="#B2B9C5"/>
3
+ </svg>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <wrapper :isDisabled="isDisabled" :size="size">
2
+ <wrapper :size="size">
3
3
  <icon-image
4
4
  :size="size"
5
5
  :color="color"
@@ -23,12 +23,11 @@
23
23
 
24
24
  import styled from 'vue-styled-components'
25
25
 
26
- const wrapperAttrs = { isDisabled: Boolean, size: String }
26
+ const wrapperAttrs = { size: String }
27
27
  const Wrapper = styled('div', wrapperAttrs)`
28
28
  display: inline-block;
29
29
  width: ${(props) => props.size};
30
30
  height: ${(props) => props.size};
31
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
32
31
  `
33
32
  const IconImageProps = { color: String, hoveredColor: String, size: String }
34
33
  const IconImage = styled('div', IconImageProps)`
@@ -37,7 +36,8 @@ const IconImage = styled('div', IconImageProps)`
37
36
  height: ${(props) => props.size};
38
37
  }
39
38
  svg > path {
40
- ${(props) => props.color && `fill: ${props.color};`}
39
+ ${(props) =>
40
+ props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
41
41
  }
42
42
  &:hover > svg > path {
43
43
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
@@ -51,10 +51,6 @@ export default {
51
51
  IconImage
52
52
  },
53
53
  props: {
54
- isDisabled: {
55
- required: false,
56
- default: false
57
- },
58
54
  name: {
59
55
  required: true
60
56
  },
@@ -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" 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};
74
+ `
75
+ const IconImg = styled('div', iconAttrs)`
76
+ cursor: pointer;
77
+ height: ${(props) => props.size};
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: '14px'
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,34 +45,33 @@ 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; */
56
55
  color: ${(props) => props.theme.colors.black};
57
56
  position: relative;
58
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
57
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
59
58
  font-size: 16px;
60
59
  user-select: none;
61
60
 
62
61
  .checkmark {
63
62
  position: absolute;
64
63
  height: ${(props) =>
65
- props.size === "medium"
66
- ? "25px"
67
- : props.size === "small"
68
- ? "16px"
69
- : "25px"};
64
+ props.size === 'medium'
65
+ ? '25px'
66
+ : props.size === 'small'
67
+ ? '16px'
68
+ : '25px'};
70
69
  width: ${(props) =>
71
- props.size === "medium"
72
- ? "25px"
73
- : props.size === "small"
74
- ? "16px"
75
- : "25px"};
70
+ props.size === 'medium'
71
+ ? '25px'
72
+ : props.size === 'small'
73
+ ? '16px'
74
+ : '25px'};
76
75
  background-color: ${(props) =>
77
76
  props.isChecked
78
77
  ? props.backgroundColor
@@ -80,7 +79,7 @@ const Container = styled("label", containerAttrs)`
80
79
  : props.theme.colors.green
81
80
  : props.isDisabled
82
81
  ? props.theme.colors.lightGray
83
- : "#fff"};
82
+ : '#fff'};
84
83
  border-radius: 4px;
85
84
  border: 1px solid
86
85
  ${(props) =>
@@ -91,34 +90,34 @@ const Container = styled("label", containerAttrs)`
91
90
  : props.theme.colors.mediumGray};
92
91
 
93
92
  &:after {
94
- content: "";
93
+ content: '';
95
94
  position: absolute;
96
- display: ${(props) => (props.isChecked ? "block" : "none")};
95
+ display: ${(props) => (props.isChecked ? 'block' : 'none')};
97
96
  }
98
97
  }
99
98
 
100
99
  .checkmark:after {
101
100
  left: ${(props) =>
102
- props.size === "medium" ? "9px" : props.size === "small" ? "5px" : "9px"};
101
+ props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
103
102
  top: ${(props) =>
104
- props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
103
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
105
104
  width: ${(props) =>
106
- props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
105
+ props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
107
106
  height: ${(props) =>
108
- props.size === "medium"
109
- ? "10px"
110
- : props.size === "small"
111
- ? "6px"
112
- : "10px"};
107
+ props.size === 'medium'
108
+ ? '10px'
109
+ : props.size === 'small'
110
+ ? '6px'
111
+ : '10px'};
113
112
  border: solid
114
113
  ${(props) =>
115
114
  props.checkColor ? props.checkColor : props.theme.colors.white};
116
115
  border-width: ${(props) =>
117
- props.size === "medium"
118
- ? "0 3px 3px 0"
119
- : props.size === "small"
120
- ? "0 2px 2px 0"
121
- : "0 3px 3px 0"};
116
+ props.size === 'medium'
117
+ ? '0 3px 3px 0'
118
+ : props.size === 'small'
119
+ ? '0 2px 2px 0'
120
+ : '0 3px 3px 0'};
122
121
  transform: rotate(45deg);
123
122
  }
124
123
  `
@@ -135,49 +134,49 @@ const InputCheckbox = styled.input`
135
134
  const LabelText = styled.div`
136
135
  font-size: 13px;
137
136
  display: grid;
138
- align-items: center;
137
+ align-items: flex-start;
139
138
  min-height: 18px;
140
139
  `
141
140
 
142
141
  export default {
143
- name: "checkbox",
142
+ name: 'checkbox',
144
143
  components: {
145
144
  ComponentWrapper,
146
145
  Container,
147
146
  InputCheckbox,
148
- LabelText,
147
+ LabelText
149
148
  },
150
149
  props: {
151
150
  label: {
152
151
  required: false,
153
- default: "",
152
+ default: ''
154
153
  },
155
154
  isChecked: {
156
155
  required: true,
157
- default: false,
156
+ default: false
158
157
  },
159
158
  checkColor: {
160
- required: false,
159
+ required: false
161
160
  },
162
161
  size: {
163
162
  required: false,
164
- default: "medium", // small, medium
163
+ default: 'medium' // small, medium
165
164
  },
166
165
  backgroundColor: {
167
- required: false,
166
+ required: false
168
167
  },
169
168
  isDisabled: {
170
169
  required: false,
171
- default: false,
172
- },
170
+ default: false
171
+ }
173
172
  },
174
173
  methods: {
175
174
  onChangeHandler(value) {
176
175
  if (this.isDisabled) {
177
176
  return
178
177
  }
179
- this.$emit("on-event-handler", value)
180
- },
181
- },
178
+ this.$emit('on-event-handler', value)
179
+ }
180
+ }
182
181
  }
183
182
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container>
2
+ <container :inputWidth="inputWidth">
3
3
  <label-wrapper v-if="labelText">
4
4
  <label-text>
5
5
  {{ labelText }}
@@ -8,16 +8,15 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="13"
11
+ size="14px"
12
12
  :alignText="labelInfoAlign"
13
13
  />
14
14
  </label-wrapper>
15
15
  <input-wrapper>
16
16
  <input-container
17
- v-bind="$attrs"
18
17
  ref="inputField1"
19
18
  :hasUnit="unitName && !!unitName.length"
20
- :placeholder="displayedPlaceholder"
19
+ :placeholder="placeholder"
21
20
  :isError="isError"
22
21
  :inputWidth="inputWidth"
23
22
  :minWidth="minWidth"
@@ -31,10 +30,15 @@
31
30
  :textAlign="textAlign"
32
31
  :fontSize="fontSize"
33
32
  :fontColor="fontColor"
34
- v-on="$listeners"
33
+ :hasSlot="hasSlot"
34
+ :slotSize="slotSize"
35
35
  />
36
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
37
+ <slot></slot>
38
+ </slot-container>
39
+
36
40
  <unit-container
37
- v-if="unitName && showLinearUnitName"
41
+ v-if="unitName && showLinearUnitName && !hasSlot"
38
42
  :hasLength="!!textInput.length"
39
43
  :isError="isError"
40
44
  >{{ unitName }}</unit-container
@@ -77,11 +81,6 @@ import {
77
81
  } from '../../../helpers/numberConverter'
78
82
  import InfoText from '../../infoText'
79
83
 
80
- const Container = styled.div`
81
- width: 100%;
82
- position: relative;
83
- `
84
-
85
84
  const inputProps = {
86
85
  isError: Boolean,
87
86
  hasUnit: Boolean,
@@ -91,8 +90,16 @@ const inputProps = {
91
90
  noBorder: Boolean,
92
91
  textAlign: String,
93
92
  fontSize: String,
94
- fontColor: String
93
+ fontColor: String,
94
+ hasSlot: Boolean,
95
+ slotSize: String
95
96
  }
97
+
98
+ const Container = styled('div', inputProps)`
99
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
100
+ position: relative;
101
+ `
102
+
96
103
  const InputContainer = styled('input', inputProps)`
97
104
  border: ${(props) =>
98
105
  props.isError
@@ -100,8 +107,15 @@ const InputContainer = styled('input', inputProps)`
100
107
  : props.noBorder
101
108
  ? 'none'
102
109
  : '1px solid ' + props.theme.colors.mediumGray};
103
- padding: ${(props) =>
104
- 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'};
105
119
  border-radius: 4px;
106
120
  text-align: ${(props) => props.textAlign};
107
121
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -144,6 +158,7 @@ const UnitContainer = styled('span', inputProps)`
144
158
  right: 10px;
145
159
  top: 0;
146
160
  padding-left: 10px;
161
+ text-align: right;
147
162
  color: ${(props) =>
148
163
  props.isError
149
164
  ? props.theme.colors.red
@@ -152,6 +167,28 @@ const UnitContainer = styled('span', inputProps)`
152
167
  : props.theme.colors.mediumGray};
153
168
  `
154
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
+ `
155
192
  const ErrorMessage = styled.div`
156
193
  font-size: 14px;
157
194
  color: ${(props) => props.theme.colors.red};
@@ -180,21 +217,15 @@ export default {
180
217
  ErrorMessage,
181
218
  LabelWrapper,
182
219
  LabelText,
220
+ SlotContainer,
183
221
  InfoText
184
222
  },
185
- inheritAttrs: false,
186
223
  data() {
187
224
  return {
188
225
  textInput: '',
189
226
  isFocused: false
190
227
  }
191
228
  },
192
- computed: {
193
- displayedPlaceholder() {
194
- if (this.placeholder) return this.placeholder
195
- return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
196
- }
197
- },
198
229
  props: {
199
230
  placeholder: {
200
231
  required: false,
@@ -275,6 +306,18 @@ export default {
275
306
  numberToStringEnabled: {
276
307
  required: false,
277
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
278
321
  }
279
322
  },
280
323
  methods: {
@@ -308,7 +351,7 @@ export default {
308
351
  return num
309
352
  }
310
353
  })
311
- let evaluated = eval(formatted.join('')) || ''
354
+ let evaluated = eval(formatted.join(''))
312
355
  evaluated = stringToNumber({
313
356
  value: evaluated,
314
357
  numberPrecision: this.numberPrecision
@@ -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,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