@eturnity/eturnity_reusable_components 1.0.61 → 1.0.65

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.0.61",
3
+ "version": "1.0.65",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -24,12 +24,19 @@
24
24
  </main-table>
25
25
  <br />
26
26
  <br />
27
- <toggle
28
- @on-toggle-change="onInputChange($event)"
29
- :isChecked="inputValue"
30
- label="My Label Text"
31
- labelAlign="right"
32
- />
27
+ <input-wrapper>
28
+ <input-number
29
+ placeholder="Enter Value"
30
+ unitName="kWh"
31
+ :value="inputValue"
32
+ @input-change="onInputChange($event)"
33
+ textAlign="left"
34
+ fontSize="13px"
35
+ labelText="Number of Modules"
36
+ labelInfoText="Here is some information for you..."
37
+ :disabled="true"
38
+ />
39
+ </input-wrapper>
33
40
  </page-container>
34
41
  </ThemeProvider>
35
42
  </template>
@@ -40,12 +47,17 @@ import theme from "./assets/theme"
40
47
  import styled from "vue-styled-components"
41
48
  import MainTable from "@/components/tables/mainTable"
42
49
  import ThreeDots from "@/components/threeDots"
43
- import Toggle from "@/components/inputs/toggle"
50
+ import InputNumber from "@/components/inputs/inputNumber"
44
51
 
45
52
  const PageContainer = styled.div`
46
53
  padding: 40px;
47
54
  `
48
55
 
56
+ const InputWrapper = styled.div`
57
+ height: 36px;
58
+ width: 180px;
59
+ `
60
+
49
61
  export default {
50
62
  name: "App",
51
63
  components: {
@@ -53,11 +65,12 @@ export default {
53
65
  PageContainer,
54
66
  MainTable,
55
67
  ThreeDots,
56
- Toggle,
68
+ InputNumber,
69
+ InputWrapper,
57
70
  },
58
71
  data() {
59
72
  return {
60
- inputValue: true,
73
+ inputValue: 10,
61
74
  checkedOption: "button_1",
62
75
  question: {
63
76
  number_format_precision: 4,
@@ -6,6 +6,8 @@
6
6
  :size="size"
7
7
  :borderColor="borderColor"
8
8
  @click.prevent="toggleShowInfo()"
9
+ @mouseenter="toggleShowInfo()"
10
+ @mouseleave="toggleShowInfo()"
9
11
  >
10
12
  <svg
11
13
  class="img-icon"
@@ -52,35 +54,28 @@ const IconWrapper = styled.div`
52
54
  const textAttrs = { borderColor: String, alignText: String }
53
55
  const TextOverlay = styled("div", textAttrs)`
54
56
  position: absolute;
55
- top: 34px;
57
+ top: 26px;
56
58
  right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
57
59
  left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
58
- background: #fff;
59
- border: 1px solid
60
- ${(props) =>
61
- props.borderColor ? props.borderColor : props.theme.colors.secondary};
62
- padding: 16px;
60
+ background: ${(props) => props.theme.colors.black};
61
+ padding: 10px;
63
62
  width: max-content;
64
63
  max-width: 400px;
65
- font-size: 14px;
64
+ font-size: 13px;
66
65
  font-weight: 400;
67
66
  border-radius: 4px;
68
67
  z-index: 99;
69
- color: ${(props) => props.theme.colors.black};
68
+ color: ${(props) => props.theme.colors.white};
70
69
 
71
70
  :before {
72
71
  content: "";
73
- background-color: #fff;
72
+ background-color: ${(props) => props.theme.colors.black};
74
73
  position: absolute;
75
74
  top: 2px;
76
75
  right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
77
76
  left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
78
77
  height: 8px;
79
78
  width: 8px;
80
- border: 1px solid
81
- ${(props) =>
82
- props.borderColor ? props.borderColor : props.theme.colors.secondary};
83
- border-width: 1px 0 0 1px;
84
79
  transform-origin: center center;
85
80
  transform: translate(-2em, -0.5em) rotate(45deg);
86
81
  }
@@ -1,5 +1,17 @@
1
1
  <template>
2
2
  <container>
3
+ <label-wrapper v-if="labelText">
4
+ <label-text>
5
+ {{ labelText }}
6
+ </label-text>
7
+ <info-text
8
+ v-if="labelInfoText"
9
+ :text="labelInfoText"
10
+ borderColor="#ccc"
11
+ size="13"
12
+ :alignText="labelInfoAlign"
13
+ />
14
+ </label-wrapper>
3
15
  <input-wrapper>
4
16
  <input-container
5
17
  :hasUnit="unitName && !!unitName.length"
@@ -15,6 +27,7 @@
15
27
  :isDisabled="disabled"
16
28
  :noBorder="noBorder"
17
29
  :textAlign="textAlign"
30
+ :fontSize="fontSize"
18
31
  />
19
32
  <unit-container
20
33
  v-if="unitName && showLinearUnitName"
@@ -28,7 +41,7 @@
28
41
  </template>
29
42
 
30
43
  <script>
31
- // import InputNumberQuestion from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumberQuestion"
44
+ // import InputNumber from "@eturnity/eturnity_reusable_components/src/components/inputs/inputNumber"
32
45
  //This component should be used for questions with input fields only
33
46
  //How to use:
34
47
  // <input-number
@@ -37,7 +50,6 @@
37
50
  // inputWidth="150px" //by default, this is 100%
38
51
  // :numberPrecision="3"
39
52
  // unitName="pc"
40
- // :numberPrecision="4"
41
53
  // :value="inputValue" //required -- String
42
54
  // @input-change="onInputChange($event)" //required
43
55
  // @on-enter-click="onInputSubmit()"
@@ -46,12 +58,17 @@
46
58
  // :noBorder="true"
47
59
  // textAlign="left" // "left, right, center"
48
60
  // :showLinearUnitName="true"
61
+ // fontSize="13px"
62
+ // labelText="Number of Modules"
63
+ // labelInfoText="Here is some information for you..."
64
+ // labelInfoAlign="left"
49
65
  // />
50
66
  import styled from "vue-styled-components"
51
67
  import {
52
68
  stringToNumber,
53
69
  numberToString,
54
70
  } from "../../../helpers/numberConverter"
71
+ import InfoText from "../../infoText"
55
72
 
56
73
  const Container = styled.div`
57
74
  width: 100%;
@@ -66,6 +83,7 @@ const inputProps = {
66
83
  isDisabled: Boolean,
67
84
  noBorder: Boolean,
68
85
  textAlign: String,
86
+ fontSize: String,
69
87
  }
70
88
  const InputContainer = styled("input", inputProps)`
71
89
  border: ${(props) =>
@@ -81,7 +99,7 @@ const InputContainer = styled("input", inputProps)`
81
99
  border-radius: 4px;
82
100
  text-align: ${(props) => props.textAlign};
83
101
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
84
- font-size: 16px;
102
+ font-size: ${(props) => (props.fontSize ? props.fontSize : "13px")};
85
103
  color: ${(props) =>
86
104
  props.isError ? props.theme.colors.red : props.theme.colors.black};
87
105
  width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
@@ -89,7 +107,7 @@ const InputContainer = styled("input", inputProps)`
89
107
  props.isDisabled
90
108
  ? props.theme.colors.grey5 + " !important"
91
109
  : "#fff !important"};
92
- box-sizing: border-box;
110
+ box-sizing: border-box;
93
111
 
94
112
  &::placeholder {
95
113
  color: ${(props) =>
@@ -131,6 +149,17 @@ const ErrorMessage = styled.div`
131
149
  padding-top: 16px;
132
150
  `
133
151
 
152
+ const LabelWrapper = styled.div`
153
+ display: flex;
154
+ gap: 10px;
155
+ margin-bottom: 8px;
156
+ `
157
+
158
+ const LabelText = styled.div`
159
+ font-weight: bold;
160
+ font-size: 13px;
161
+ `
162
+
134
163
  export default {
135
164
  name: "input-number",
136
165
  components: {
@@ -139,6 +168,9 @@ export default {
139
168
  InputWrapper,
140
169
  UnitContainer,
141
170
  ErrorMessage,
171
+ LabelWrapper,
172
+ LabelText,
173
+ InfoText,
142
174
  },
143
175
  data() {
144
176
  return {
@@ -195,6 +227,22 @@ export default {
195
227
  required: false,
196
228
  default: "left",
197
229
  },
230
+ fontSize: {
231
+ required: false,
232
+ default: "13px",
233
+ },
234
+ labelText: {
235
+ required: false,
236
+ default: null,
237
+ },
238
+ labelInfoText: {
239
+ required: false,
240
+ default: null,
241
+ },
242
+ labelInfoAlign: {
243
+ required: false,
244
+ default: "right",
245
+ },
198
246
  },
199
247
  methods: {
200
248
  onChangeHandler(event) {
@@ -100,12 +100,14 @@ const TableContainer = styled.table`
100
100
  }
101
101
 
102
102
  td {
103
- padding: 7px 10px;
103
+ padding: 7px 15px;
104
104
  border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
105
105
 
106
106
  &.empty {
107
107
  height: 100px;
108
108
  text-align: center;
109
+ cursor: default;
110
+ background-color: #fff !important;
109
111
  }
110
112
 
111
113
  &.no-border {
@@ -184,7 +186,7 @@ const TableContainer = styled.table`
184
186
  }
185
187
 
186
188
  .text {
187
- padding: 10px 0 10px 18px;
189
+ padding: 10px 15px 10px 15px;
188
190
  color: ${(props) => props.theme.colors.black};
189
191
  }
190
192