@eturnity/eturnity_reusable_components 1.2.18 → 1.2.19-3d-master.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.18",
3
+ "version": "1.2.19-3d-master.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -2,6 +2,9 @@
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
4
  <br />
5
+ <<<<<<< HEAD
6
+ =======
7
+ <iconWrapper name="bell"/>
5
8
  <modal backdrop="dark" :isLoading="false" :isOpen="true">
6
9
  <main-table titleText="My Table">
7
10
  <thead>
@@ -42,32 +45,77 @@
42
45
  :disabled="false"
43
46
  />
44
47
  <br />
48
+ >>>>>>> EPDM-5448
45
49
  <input-number
46
- placeholder="Enter distance"
47
- :numberPrecision="2"
48
50
  :value="inputValue"
49
- @input-change="onInputChange($event)"
50
- />
51
+ @input-change="inputValue = $event"
52
+ inputWidth="250px"
53
+ slotSize="50%"
54
+ ><InputAnnexContainer>
55
+ <span>123m2</span>
56
+ <info-text size="10px" alignArrow="right" text="infoText ceci est le text"></info-text>
57
+ </InputAnnexContainer>
58
+ </input-number>
59
+ <input-number
60
+ :value="inputValue"
61
+ @input-change="inputValue = $event"
62
+ inputWidth="250px"
63
+ slotSize="50%"
64
+ :isError="true"
65
+ ><InputAnnexContainer>
66
+ <span>123m2</span>
67
+ <info-text :style="{'justify-self': 'end'}" size="12px" alignArrow="center" text="infoText ceci est le text">This is the tooltip text</info-text>
68
+ </InputAnnexContainer>
69
+ </input-number>
51
70
  <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"
71
+
72
+ <p>InputText</p>
73
+ <input-text
74
+ placeholder="Company name"
75
+ :value="inputValue"
76
+ :isError="true"
77
+ errorMessage="This is my error message"
78
+ infoTextAlign="right"
79
+ infoTextMessage="My info message"
80
+ label="Question 5"
81
+ alignItems="vertical"
82
+ inputWidth="250px"
83
+ minWidth="100px"
84
+ />
85
+ <br/>
86
+ <input-number
87
+ :value="num"
88
+ @input-change="num = $event"
89
+ unitName="t"
90
+ id="biebie"
91
+ test="koko"
92
+ @keydown="keydownHandler"
59
93
  />
60
- <external-button text="Click me!" minWidth="500px" />
61
94
  </page-container>
62
95
  </ThemeProvider>
63
96
  </template>
64
97
 
65
98
  <script>
99
+ <<<<<<< HEAD
100
+ import { ThemeProvider } from "vue-styled-components"
101
+ import theme from "./assets/theme"
102
+ import styled from "vue-styled-components"
103
+ import MainTable from "@/components/tables/mainTable"
104
+ import ThreeDots from "@/components/threeDots"
105
+ import Toggle from "@/components/inputs/toggle"
106
+ import InputNumber from "@/components/inputs/inputNumber"
107
+ import Checkbox from "@/components/inputs/checkbox"
108
+ import PageSubtitle from "@/components/pageSubtitle"
109
+ import Spinner from "@/components/spinner"
110
+ import ExternalButton from "@/components/buttons/externalButton"
111
+ import InputText from "@/components/inputs/inputText"
112
+ =======
66
113
  import { ThemeProvider } from 'vue-styled-components'
67
114
  import theme from './assets/theme'
68
115
  import styled from 'vue-styled-components'
69
116
  import MainTable from '@/components/tables/mainTable'
70
117
  import ThreeDots from '@/components/threeDots'
118
+ import iconWrapper from '@/components/iconWrapper'
71
119
  import Toggle from '@/components/inputs/toggle'
72
120
  import InputNumber from '@/components/inputs/inputNumber'
73
121
  import Checkbox from '@/components/inputs/checkbox'
@@ -75,7 +123,13 @@ import PageSubtitle from '@/components/pageSubtitle'
75
123
  import Spinner from '@/components/spinner'
76
124
  import ExternalButton from '@/components/buttons/externalButton'
77
125
  import Modal from '@/components/modals/modal'
126
+ >>>>>>> EPDM-5448
78
127
  // import TableDropdown from "@/components/tableDropdown"
128
+ const InputAnnexContainer = styled.div`
129
+ display: grid;
130
+ grid-template-columns: auto auto;
131
+ grid-gap: 10px;
132
+ `
79
133
 
80
134
  const PageContainer = styled.div`
81
135
  padding: 40px;
@@ -86,18 +140,18 @@ export default {
86
140
  components: {
87
141
  ThemeProvider,
88
142
  PageContainer,
89
- MainTable,
90
- ThreeDots,
91
- Toggle,
92
143
  InputNumber,
93
144
  PageSubtitle,
94
145
  Spinner,
95
146
  Checkbox,
147
+ InputText,
96
148
  ExternalButton,
149
+ iconWrapper,
97
150
  Modal,
98
151
  },
99
152
  data() {
100
153
  return {
154
+ num: 42,
101
155
  inputValue: null,
102
156
  checkedOption: 'button_1',
103
157
  question: {
@@ -156,6 +210,9 @@ export default {
156
210
  }
157
211
  },
158
212
  methods: {
213
+ keydownHandler(e) {
214
+ console.log('test', e)
215
+ },
159
216
  getTheme() {
160
217
  return theme
161
218
  },
@@ -205,8 +262,8 @@ export default {
205
262
  item = '-'
206
263
  }
207
264
  return item
208
- },
209
- },
265
+ }
266
+ }
210
267
  }
211
268
  </script>
212
269
 
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="0.75" y="0.75" width="12.5" height="12.5" stroke="white" stroke-width="1.5"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="0.75" y="0.75" width="12.5" height="12.5" stroke="white" stroke-width="1.5"/>
3
+ <rect x="4.5" y="4.5" width="5" height="5" stroke="white" stroke-width="1.5"/>
4
+ </svg>
@@ -1,4 +1,4 @@
1
- <svg fill="none" height="23" viewbox="6 12 34 23" width="34" xmlns="http://www.w3.org/2000/svg">
1
+ <svg fill="none" height="16" viewbox="12 12 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
2
2
  <mask height="14" id="mask0_6458_86453" maskunits="userSpaceOnUse" style="mask-type:alpha" width="14" x="13" y="13">
3
3
  <rect fill="#FF5656" height="14" width="14" x="13" y="13"></rect>
4
4
  </mask>
@@ -0,0 +1,6 @@
1
+ <svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M4.51904 2H10.519V4H4.51904V2Z" fill="#555D61"/>
3
+ <path d="M4.51904 8H8.51904V10H4.51904V8Z" fill="#555D61"/>
4
+ <path d="M10.519 5.92321L13.4807 2.96161L10.519 0L10.519 5.92321Z" fill="#555D61"/>
5
+ <path d="M7.98391 8C7.29229 9.1956 5.99961 10 4.51904 10C2.3099 10 0.519043 8.20914 0.519043 6C0.519043 3.79086 2.3099 2 4.51904 2C5.99961 2 7.2923 2.8044 7.98391 4H4.51904C3.41447 4 2.51904 4.89543 2.51904 6C2.51904 7.10457 3.41447 8 4.51904 8H7.98391Z" fill="#555D61"/>
6
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 10 L7 0 L14 10" fill="none" stroke="white" stroke-width="1.5"/>
3
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9.48096 2H3.48096V4H9.48096V2Z" fill="white"/>
3
+ <path d="M9.48096 8H5.48096V10H9.48096V8Z" fill="white"/>
4
+ <path d="M3.48096 5.92321L0.519349 2.96161L3.48096 0L3.48096 5.92321Z" fill="white"/>
5
+ <path d="M6.01609 8C6.70771 9.1956 8.00039 10 9.48096 10C11.6901 10 13.481 8.20914 13.481 6C13.481 3.79086 11.6901 2 9.48096 2C8.00039 2 6.7077 2.8044 6.01609 4H9.48096C10.5855 4 11.481 4.89543 11.481 6C11.481 7.10457 10.5855 8 9.48096 8H6.01609Z" fill="white"/>
6
+ </svg>
@@ -19,6 +19,8 @@ const theme = {
19
19
  grey4: '#dee2eb',
20
20
  grey5: '#fafafa',
21
21
  green: '#99db0c',
22
+ transparentWhite1:'#ffffff32',
23
+ transparentBlack1:'#263238e6',
22
24
  disabled: '#dfe1e1'
23
25
  },
24
26
  screen: {
@@ -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 InfoText from "@eturnity/eturnity_reusable_components/src/components/infoText"
11
+ //To use:
12
+ // <error-message
13
+ // alignText="right" // default is left
14
+ // />
15
+
16
+ import styled from 'vue-styled-components'
17
+
18
+ const TextOverlay = styled.div`
19
+ position: absolute;
20
+ top: calc(100% + 13px);
21
+ background: ${(props) => props.theme.colors.red};
22
+ padding: 10px;
23
+ width: max-content;
24
+ max-width: 100%;
25
+ min-width: 200px;
26
+ font-size: 11px;
27
+ font-weight: 400;
28
+ border-radius: 4px;
29
+ font-family: 'Lato-Bold', Arial;
30
+ z-index: 99;
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,6 +1,6 @@
1
1
  <template>
2
- <wrapper :isDisabled="isDisabled" :size="size">
3
2
  <icon-image
3
+ :disabled="disabled"
4
4
  :size="size"
5
5
  :color="color"
6
6
  :hoveredColor="hoveredColor"
@@ -8,7 +8,6 @@
8
8
  require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
9
9
  "
10
10
  ></icon-image>
11
- </wrapper>
12
11
  </template>
13
12
 
14
13
  <script>
@@ -23,18 +22,17 @@
23
22
 
24
23
  import styled from 'vue-styled-components'
25
24
 
26
- const wrapperAttrs = { isDisabled: Boolean, size: String }
27
- const Wrapper = styled('div', wrapperAttrs)`
28
- display: inline-block;
25
+ const IconImageProps = { color: String, hoveredColor: String, size: String ,disabled:Boolean}
26
+ const IconImage = styled('div', IconImageProps)`
27
+ display: inline-flex;
29
28
  width: ${(props) => props.size};
30
29
  height: ${(props) => props.size};
31
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
32
- `
33
- const IconImageProps = { color: String, hoveredColor: String, size: String }
34
- const IconImage = styled('div', IconImageProps)`
30
+ justify-content:center;
31
+ align-items:center;
32
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
35
33
  svg {
36
- width: ${(props) => props.size};
37
- height: ${(props) => props.size};
34
+ width: 100%;
35
+ height: 100%;
38
36
  }
39
37
  svg > path {
40
38
  ${(props) =>
@@ -48,11 +46,10 @@ const IconImage = styled('div', IconImageProps)`
48
46
  export default {
49
47
  name: 'icon',
50
48
  components: {
51
- Wrapper,
52
49
  IconImage
53
50
  },
54
51
  props: {
55
- isDisabled: {
52
+ disabled: {
56
53
  required: false,
57
54
  default: false
58
55
  },
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <Wrapper
3
+ :disabled="disabled"
4
+ :size="size"
5
+ :backgroundColor="backgroundColor"
6
+ :borderRadius="borderRadius"
7
+ :hoveredBackgroundColor="hoveredBackgroundColor"
8
+ :isHovered="isHovered"
9
+ >
10
+ <icon :disabled="disabled"
11
+ :size="iconSize"
12
+ :name="name"
13
+ :color="iconColor"
14
+ :hoveredColor="hoveredIconColor" />
15
+ <caret v-if="hasCaret">
16
+ <iconWrapper :disabled="disabled"
17
+ size="10px"
18
+ name="arrow_down"
19
+ :iconColor="iconColor"
20
+ :hoveredBackgroundColor="hoveredIconColor"
21
+ borderRadius="1px"
22
+ />
23
+ </caret>
24
+ </Wrapper>
25
+ </template>
26
+
27
+ <script>
28
+ // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
29
+ // How to use:
30
+ //<icon
31
+ // name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
32
+ // color="red"
33
+ // hoveredColor="blue"
34
+ // size="60px" by default, this is 30px
35
+ // />
36
+
37
+ import styled from 'vue-styled-components'
38
+ import icon from '../icon'
39
+ const wrapperAttrs = { isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
40
+ const Wrapper = styled('div', wrapperAttrs)`
41
+ position:relative;
42
+ display: inline-flex;
43
+ width: ${(props) => props.size};
44
+ height: ${(props) => props.size};
45
+ justify-content:center;
46
+ align-items:center;
47
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
48
+ background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
49
+ border-radius: ${(props) => props.borderRadius};
50
+ ${(props)=>(props.isHovered ? 'background-color:'+props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor : "")};
51
+ &:hover{
52
+ background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
53
+ }
54
+ `
55
+ const caret=styled.div`
56
+ position:absolute;
57
+ bottom:3px;
58
+ right:2px;
59
+ height:10px;
60
+ `
61
+
62
+ export default {
63
+ name: 'iconWrapper',
64
+ components: {
65
+ Wrapper,
66
+ icon,
67
+ caret
68
+ },
69
+ props: {
70
+ disabled: {
71
+ required: false,
72
+ default: false
73
+ },
74
+ name: {
75
+ required: true
76
+ },
77
+ iconColor: {
78
+ required: false,
79
+ default: 'white'
80
+ },
81
+ hoveredIconColor: {
82
+ required: false
83
+ },
84
+ backgroundColor: {
85
+ required: false,
86
+ },
87
+ hoveredBackgroundColor: {
88
+ required: false,
89
+ default:"transparentWhite1"
90
+ },
91
+ size: {
92
+ required: false,
93
+ default: '32px'
94
+ },
95
+ iconSize:{
96
+ required: false,
97
+ default:'18px'
98
+ },
99
+ hasCaret:{
100
+ required: false,
101
+ default: false
102
+ },
103
+ borderRadius:{
104
+ required:false,
105
+ default:'6px'
106
+ },
107
+ isHovered:{
108
+ required:false,
109
+ default:false
110
+ }
111
+ },
112
+ data() {
113
+ return {}
114
+ }
115
+ }
116
+ </script>
@@ -1,34 +1,25 @@
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
- >
18
+ :width="width"
19
+ :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
20
+ :alignArrow="alignArrow"
21
+ :iconSize="size"
22
+ ><slot />
32
23
  {{ text }}
33
24
  </text-overlay>
34
25
  </icon-wrapper>
@@ -44,22 +35,23 @@
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 = { iconSize:String, borderColor: String, alignArrow:String, alignText: String, width:String,halfComputedTextInfoWidth:Number }
43
+ const TextOverlay = styled('div', textAttrs)`
56
44
  position: absolute;
57
- top: 26px;
58
- right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
- left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
45
+ top: ${(props) => 'calc('+props.iconSize+' + 15px)'};
46
+ ${(props) => (props.alignArrow === 'left'
47
+ ? 'left: calc('+props.iconSize+' /2 - 18px)'
48
+ : props.alignArrow === 'center'
49
+ ? 'left: calc((-'+props.width+' + '+props.iconSize+') /2 + 2px)'
50
+ : 'right: calc('+props.iconSize+' /2 - 17px)')};
51
+ text-align: ${(props) => props.alignText};
60
52
  background: ${(props) => props.theme.colors.black};
61
53
  padding: 10px;
62
- width: max-content;
54
+ width: ${(props) => props.width };
63
55
  max-width: 400px;
64
56
  font-size: 13px;
65
57
  font-weight: 400;
@@ -68,12 +60,13 @@ const TextOverlay = styled("div", textAttrs)`
68
60
  color: ${(props) => props.theme.colors.white};
69
61
 
70
62
  :before {
71
- content: "";
63
+ content: '';
72
64
  background-color: ${(props) => props.theme.colors.black};
73
65
  position: absolute;
74
66
  top: 2px;
75
- right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
- left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
67
+ ${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
68
+ props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
69
+ 'right:-13px;')};
77
70
  height: 8px;
78
71
  width: 8px;
79
72
  transform-origin: center center;
@@ -82,18 +75,15 @@ const TextOverlay = styled("div", textAttrs)`
82
75
  `
83
76
 
84
77
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
85
- const IconImg = styled("div", iconAttrs)`
86
- cursor: pointer;
87
- height: ${(props) => props.size + "px"};
88
78
 
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
- }
79
+ const IconWrapper = styled('div', iconAttrs)`
80
+ position: relative;
81
+ top: 1px;
82
+ height: ${(props) => props.size};
83
+ `
84
+ const IconImg = styled('div', iconAttrs)`
85
+ cursor: pointer;
86
+ height: ${(props) => props.size};
97
87
  `
98
88
 
99
89
  const ComponentWrapper = styled.div`
@@ -101,38 +91,51 @@ const ComponentWrapper = styled.div`
101
91
  `
102
92
 
103
93
  export default {
104
- name: "info-text",
94
+ name: 'info-text',
105
95
  components: {
106
96
  IconWrapper,
107
97
  TextOverlay,
108
98
  ComponentWrapper,
109
99
  IconImg,
100
+ icon
110
101
  },
111
102
  props: {
112
103
  text: {
113
- required: true,
104
+ required: false,
114
105
  },
115
106
  borderColor: {
116
107
  required: false,
117
- default: null,
108
+ default: null
118
109
  },
119
110
  size: {
120
111
  required: false,
121
- default: "20",
112
+ default: '14px'
122
113
  },
123
114
  alignText: {
124
115
  required: false,
125
- default: "left", // "left" or "right"
116
+ default: 'left' // "left" or "right"
117
+ },
118
+ alignArrow:{
119
+ required:false,
120
+ default:'center'
121
+ },
122
+ openTrigger:{
123
+ required:false,
124
+ default: 'onClick'
126
125
  },
126
+ width:{
127
+ required:false,
128
+ default:'165px'
129
+ }
127
130
  },
128
131
  methods: {
129
132
  toggleShowInfo() {
130
133
  this.showInfo = !this.showInfo
131
134
 
132
135
  if (this.showInfo) {
133
- document.addEventListener("click", this.clickOutside)
136
+ document.addEventListener('click', this.clickOutside)
134
137
  } else {
135
- document.removeEventListener("click", this.clickOutside)
138
+ document.removeEventListener('click', this.clickOutside)
136
139
  }
137
140
  },
138
141
  clickOutside(event) {
@@ -140,12 +143,24 @@ export default {
140
143
  return
141
144
  }
142
145
  this.toggleShowInfo()
143
- },
146
+ }
144
147
  },
145
148
  data() {
146
149
  return {
147
150
  showInfo: false,
148
151
  }
149
152
  },
153
+ computed: {
154
+ iconColor() {
155
+ return this.isActive
156
+ ? this.borderColor
157
+ ? this.borderColor
158
+ : theme.colors.secondary
159
+ : theme.colors.mediumGray
160
+ },
161
+ halfComputedTextInfoWidth() {
162
+ return parseInt(this.width)/2;
163
+ }
164
+ }
150
165
  }
151
- </script>
166
+ </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,15 +8,16 @@
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"
22
23
  :minWidth="minWidth"
@@ -30,13 +31,25 @@
30
31
  :textAlign="textAlign"
31
32
  :fontSize="fontSize"
32
33
  :fontColor="fontColor"
34
+ v-on="$listeners"
35
+ :hasSlot="hasSlot"
36
+ :slotSize="slotSize"
33
37
  />
38
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
39
+ <slot></slot>
40
+ </slot-container>
41
+
34
42
  <unit-container
35
- v-if="unitName && showLinearUnitName"
43
+ v-if="unitName && showLinearUnitName && !hasSlot"
36
44
  :hasLength="!!textInput.length"
37
45
  :isError="isError"
38
46
  >{{ unitName }}</unit-container
39
47
  >
48
+ <icon
49
+ v-if="(isError || inputIcon) && !showLinearUnitName"
50
+ :class="inputIconImageClass"
51
+ :src="isError ? warningIcon : inputIconImage"
52
+ />
40
53
  </input-wrapper>
41
54
  <error-message v-if="isError">{{ errorMessage }}</error-message>
42
55
  </container>
@@ -74,11 +87,8 @@ import {
74
87
  numberToString
75
88
  } from '../../../helpers/numberConverter'
76
89
  import InfoText from '../../infoText'
77
-
78
- const Container = styled.div`
79
- width: 100%;
80
- position: relative;
81
- `
90
+ import ErrorMessage from '../../errorMessage'
91
+ import warningIcon from '../../../assets/icons/error_icon.png'
82
92
 
83
93
  const inputProps = {
84
94
  isError: Boolean,
@@ -89,8 +99,16 @@ const inputProps = {
89
99
  noBorder: Boolean,
90
100
  textAlign: String,
91
101
  fontSize: String,
92
- fontColor: String
102
+ fontColor: String,
103
+ hasSlot: Boolean,
104
+ slotSize: String
93
105
  }
106
+
107
+ const Container = styled('div', inputProps)`
108
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
109
+ position: relative;
110
+ `
111
+
94
112
  const InputContainer = styled('input', inputProps)`
95
113
  border: ${(props) =>
96
114
  props.isError
@@ -98,8 +116,15 @@ const InputContainer = styled('input', inputProps)`
98
116
  : props.noBorder
99
117
  ? 'none'
100
118
  : '1px solid ' + props.theme.colors.mediumGray};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
119
+ padding-top: 11px;
120
+ padding-bottom: 11px;
121
+ padding-left: 10px;
122
+ padding-right: ${(props) =>
123
+ props.slotSize
124
+ ? 'calc(' + props.slotSize + ' + 10px)'
125
+ : props.hasUnit
126
+ ? '40px'
127
+ : '5px'};
103
128
  border-radius: 4px;
104
129
  text-align: ${(props) => props.textAlign};
105
130
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -125,6 +150,15 @@ const InputContainer = styled('input', inputProps)`
125
150
  outline: none;
126
151
  }
127
152
  `
153
+ const IconProps = {
154
+ inputIconHeight: String
155
+ }
156
+
157
+ const Icon = styled('img', IconProps)`
158
+ position: absolute;
159
+ right: 10px;
160
+ top: 2px;
161
+ `
128
162
 
129
163
  const InputWrapper = styled.span`
130
164
  position: relative;
@@ -142,6 +176,7 @@ const UnitContainer = styled('span', inputProps)`
142
176
  right: 10px;
143
177
  top: 0;
144
178
  padding-left: 10px;
179
+ text-align: right;
145
180
  color: ${(props) =>
146
181
  props.isError
147
182
  ? props.theme.colors.red
@@ -150,11 +185,27 @@ const UnitContainer = styled('span', inputProps)`
150
185
  : props.theme.colors.mediumGray};
151
186
  `
152
187
 
153
- const ErrorMessage = styled.div`
154
- font-size: 14px;
155
- color: ${(props) => props.theme.colors.red};
188
+ const SlotContainer = styled('span', inputProps)`
189
+ text-align: right;
190
+ border-left: 1px solid
191
+ ${(props) =>
192
+ props.isError
193
+ ? props.theme.colors.red
194
+ : props.hasLength
195
+ ? props.theme.colors.black
196
+ : props.theme.colors.mediumGray};
156
197
  position: absolute;
157
- top: calc(100% + 1px);
198
+ width: ${(props) =>
199
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
200
+ right: 10px;
201
+ top: 0;
202
+ padding-left: 10px;
203
+ color: ${(props) =>
204
+ props.isError
205
+ ? props.theme.colors.red
206
+ : props.hasLength
207
+ ? props.theme.colors.black
208
+ : props.theme.colors.mediumGray};
158
209
  `
159
210
 
160
211
  const LabelWrapper = styled.div`
@@ -178,12 +229,16 @@ export default {
178
229
  ErrorMessage,
179
230
  LabelWrapper,
180
231
  LabelText,
181
- InfoText
232
+ InfoText,
233
+ Icon,
234
+ SlotContainer
182
235
  },
236
+ inheritAttrs: false,
183
237
  data() {
184
238
  return {
185
239
  textInput: '',
186
- isFocused: false
240
+ isFocused: false,
241
+ warningIcon: warningIcon,
187
242
  }
188
243
  },
189
244
  props: {
@@ -253,7 +308,7 @@ export default {
253
308
  },
254
309
  labelInfoAlign: {
255
310
  required: false,
256
- default: 'right'
311
+ default: 'left'
257
312
  },
258
313
  minNumber: {
259
314
  required: false,
@@ -266,11 +321,41 @@ export default {
266
321
  numberToStringEnabled: {
267
322
  required: false,
268
323
  default: true
324
+ },
325
+ inputIcon: {
326
+ require: false,
327
+ type: Boolean,
328
+ default: false
329
+ },
330
+ inputIconImage: {
331
+ require: false,
332
+ type: String,
333
+ default: ''
334
+ },
335
+ inputIconImageClass: {
336
+ require: false,
337
+ type: Array,
338
+ default: () => []
339
+ },
340
+ slotSize: {
341
+ required: false
342
+ }
343
+ },
344
+ computed: {
345
+ displayedPlaceholder() {
346
+ if (this.placeholder) return this.placeholder
347
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
348
+ },
349
+ hasSlot() {
350
+ return !!this.$slots.default
351
+ },
352
+ computedSlotSize() {
353
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
269
354
  }
270
355
  },
271
356
  methods: {
272
357
  onChangeHandler(event) {
273
- if (isNaN(event)) {
358
+ if (isNaN(event) || event=="") {
274
359
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
360
  }
276
361
  this.$emit('input-change', event)
@@ -336,6 +421,7 @@ export default {
336
421
  this.$nextTick(() => {
337
422
  this.$refs.inputField1.$el.select()
338
423
  })
424
+ this.$emit('input-focus')
339
425
  },
340
426
  formatWithCurrency(value) {
341
427
  let adjustedMinValue =
@@ -387,4 +473,4 @@ export default {
387
473
  }
388
474
  }
389
475
  }
390
- </script>
476
+ </script>
@@ -10,10 +10,11 @@
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
+ <input-error-wrapper>
17
18
  <input-container
18
19
  :placeholder="placeholder"
19
20
  :isError="isError"
@@ -26,20 +27,27 @@
26
27
  :isDisabled="disabled"
27
28
  :fontSize="fontSize"
28
29
  />
30
+ <error-message v-if="isError">{{ errorMessage }}</error-message>
31
+ </input-error-wrapper>
29
32
  </input-wrapper>
30
- <error-message v-if="isError">{{ errorMessage }}</error-message>
31
33
  </container>
32
34
  </template>
33
35
 
34
36
  <script>
35
37
  import styled from "vue-styled-components"
36
38
  import InfoText from "../../infoText"
39
+ import ErrorMessage from '../../errorMessage'
37
40
 
38
41
  const Container = styled.div`
39
42
  width: 100%;
40
43
  position: relative;
41
44
  `
42
-
45
+ const InputErrorWrapper = styled.div`
46
+ display: inline-grid;
47
+ grid-template-row: auto auto;
48
+ grid-gap: 0px;
49
+ align-items: center;
50
+ `
43
51
  const labelAttrs = { fontSize: String }
44
52
  const InputLabel = styled("div", labelAttrs)`
45
53
  font-weight: bold;
@@ -104,13 +112,6 @@ const InputWrapper = styled("div", inputAttrs)`
104
112
  props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
105
113
  `
106
114
 
107
- const ErrorMessage = styled.div`
108
- font-size: 14px;
109
- color: ${(props) => props.theme.colors.red};
110
- position: absolute;
111
- top: calc(100% + 1px);
112
- `
113
-
114
115
  export default {
115
116
  // import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
116
117
  // To use:
@@ -136,6 +137,7 @@ export default {
136
137
  ErrorMessage,
137
138
  InfoText,
138
139
  InputLabel,
140
+ InputErrorWrapper,
139
141
  LabelWrapper,
140
142
  },
141
143
  props: {
@@ -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" />
@@ -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>
@@ -174,7 +175,11 @@ export default {
174
175
  },
175
176
  inputWidth: {
176
177
  required: false,
177
- default: null
178
+ default: null,
179
+ },
180
+ resize:{
181
+ required:false,
182
+ default: "none"
178
183
  }
179
184
  },
180
185
  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