@eturnity/eturnity_reusable_components 1.0.72 → 1.0.76

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.72",
3
+ "version": "1.0.76",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -7,15 +7,27 @@
7
7
  <th>Column 1</th>
8
8
  <th>Column 2</th>
9
9
  <th>Column 3</th>
10
- <th>Column 4</th>
11
10
  <div />
12
11
  </tr>
13
12
  </thead>
14
13
  <tbody>
15
14
  <tr>
16
15
  <td class="text">Body 2</td>
17
- <td class="text">Body 3</td>
18
- <td class="text">Body 4</td>
16
+ <td>
17
+ <toggle
18
+ @on-toggle-change="onInputChange($event)"
19
+ :isChecked="isChecked"
20
+ labelAlign="right"
21
+ />
22
+ </td>
23
+ <td>
24
+ <toggle
25
+ @on-toggle-change="onInputChange($event)"
26
+ :isChecked="isChecked"
27
+ labelAlign="right"
28
+ :disabled="true"
29
+ />
30
+ </td>
19
31
  <div class="icons-container">
20
32
  <three-dots :options="listOptions" :isLoading="false" />
21
33
  </div>
@@ -24,19 +36,13 @@
24
36
  </main-table>
25
37
  <br />
26
38
  <br />
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>
39
+ <toggle
40
+ @on-toggle-change="onInputChange($event)"
41
+ :isChecked="isChecked"
42
+ label="My Label Text"
43
+ labelAlign="right"
44
+ :disabled="true"
45
+ />
40
46
  </page-container>
41
47
  </ThemeProvider>
42
48
  </template>
@@ -47,17 +53,12 @@ import theme from "./assets/theme"
47
53
  import styled from "vue-styled-components"
48
54
  import MainTable from "@/components/tables/mainTable"
49
55
  import ThreeDots from "@/components/threeDots"
50
- import InputNumber from "@/components/inputs/inputNumber"
56
+ import Toggle from "@/components/inputs/toggle"
51
57
 
52
58
  const PageContainer = styled.div`
53
59
  padding: 40px;
54
60
  `
55
61
 
56
- const InputWrapper = styled.div`
57
- height: 36px;
58
- width: 180px;
59
- `
60
-
61
62
  export default {
62
63
  name: "App",
63
64
  components: {
@@ -65,8 +66,7 @@ export default {
65
66
  PageContainer,
66
67
  MainTable,
67
68
  ThreeDots,
68
- InputNumber,
69
- InputWrapper,
69
+ Toggle,
70
70
  },
71
71
  data() {
72
72
  return {
@@ -132,7 +132,7 @@ export default {
132
132
  return theme
133
133
  },
134
134
  onInputChange(event) {
135
- this.inputValue = event
135
+ this.isChecked = event
136
136
  },
137
137
  },
138
138
  }
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="5 5 30 30">
2
2
  <defs>
3
3
  <style>
4
4
  .cls-1 {
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="5 5 30 30">
2
2
  <defs>
3
3
  <style>
4
4
  .cls-1 {
@@ -12,12 +12,14 @@ const theme = {
12
12
  white: "#fff",
13
13
  blue: "#48a2d0",
14
14
  red: "#ff7e7e",
15
- disabled: "#c4c4c4",
16
15
  blue1: "#e4efff",
16
+ grey1: "#666",
17
+ grey2: "#c4c4c4",
17
18
  grey3: "#b2b9c5",
18
19
  grey4: "#ebeef4",
19
20
  grey5: "#fafafa",
20
21
  green: "#99db0c",
22
+ disabled: "#dfe1e1",
21
23
  },
22
24
  screen: {
23
25
  mobileSmall: "345px",
@@ -1,55 +1,44 @@
1
1
  <template>
2
- <wrapper>
3
- <icon :color="color" />
2
+ <wrapper @mouseover="isHovered = true" @mouseleave="isHovered = false">
3
+ <icon-image
4
+ v-if="isHovered"
5
+ :src="require('../../assets/icons/delete_icon.svg')"
6
+ />
7
+ <icon-image
8
+ v-else
9
+ :src="require('../../assets/icons/delete_icon_gray.svg')"
10
+ />
4
11
  </wrapper>
5
12
  </template>
6
13
 
7
14
  <script>
8
15
  // To use:
9
- // <delete-icon
10
- // color="gray" // red is default
11
- // />
16
+ // <delete-icon />
12
17
  import styled from "vue-styled-components"
13
18
 
14
19
  const Wrapper = styled.div`
15
- width: 100%;
16
- height: 100%;
17
- min-height: 40px;
18
- display: flex;
19
- align-items: center;
20
- justify-content: center;
21
- `
22
-
23
- const iconAttrs = { color: String }
24
- const Icon = styled("span", iconAttrs)`
25
20
  width: 30px;
26
21
  height: 30px;
27
- background-position: center;
28
22
  cursor: pointer;
29
- background-image: ${(props) =>
30
- props.color === "red"
31
- ? `url(${require("../../assets/icons/delete_icon.svg")})`
32
- : props.color === "gray"
33
- ? `url(${require("../../assets/icons/delete_icon_gray.svg")})`
34
- : `url(${require("../../assets/icons/delete_icon.svg")})`};
23
+ `
35
24
 
25
+ const IconImage = styled.img`
36
26
  &:hover {
37
- background-image: ${() =>
38
- `url(${require("../../assets/icons/delete_icon.svg")})`};
27
+ background-color: ${(props) => props.theme.colors.grey5};
28
+ border-radius: 4px;
39
29
  }
40
30
  `
41
31
 
42
32
  export default {
43
33
  name: "delete-icon",
44
34
  components: {
45
- Icon,
46
35
  Wrapper,
36
+ IconImage,
47
37
  },
48
- props: {
49
- color: {
50
- required: false,
51
- default: "red", // red, gray
52
- },
38
+ data() {
39
+ return {
40
+ isHovered: false,
41
+ }
53
42
  },
54
43
  }
55
44
  </script>
@@ -1,24 +1,23 @@
1
1
  <template>
2
2
  <container>
3
- <flex-wrapper :size="size">
4
- <label-text
5
- v-if="labelAlign === 'left'"
6
- :size="size"
7
- @click="onToggleChange"
8
- >{{ label }}</label-text
9
- >
3
+ <flex-wrapper :size="size" :disabled="disabled" @click="onToggleChange">
4
+ <label-text v-if="labelAlign === 'left'" :size="size">{{
5
+ label
6
+ }}</label-text>
10
7
  <toggle-wrapper
11
8
  role="checkbox"
12
9
  :checked="isChecked"
13
10
  :size="size"
14
11
  tabindex="0"
15
- @click="onToggleChange"
16
12
  @keydown.space.prevent="onToggleChange"
17
13
  :disabled="disabled"
14
+ :backgroundColor="backgroundColor"
15
+ :isChecked="isChecked"
18
16
  >
19
17
  <toggle-background
20
18
  :backgroundColor="backgroundColor"
21
19
  :isChecked="isChecked"
20
+ :disabled="disabled"
22
21
  />
23
22
  <toggle-dot
24
23
  :isChecked="isChecked"
@@ -58,7 +57,7 @@ const Container = styled.div`
58
57
  display: inline-block;
59
58
  `
60
59
 
61
- const flexAttrs = { size: String }
60
+ const flexAttrs = { size: String, disabled: Boolean }
62
61
  const FlexWrapper = styled("div", flexAttrs)`
63
62
  display: grid;
64
63
  grid-template-columns: auto 1fr;
@@ -69,9 +68,16 @@ const FlexWrapper = styled("div", flexAttrs)`
69
68
  ? "10px"
70
69
  : "20px"};
71
70
  align-items: center;
71
+ cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
72
72
  `
73
73
 
74
- const toggleAttrs = { size: String, fontColor: String, disabled: Boolean }
74
+ const toggleAttrs = {
75
+ size: String,
76
+ fontColor: String,
77
+ disabled: Boolean,
78
+ backgroundColor: String,
79
+ isChecked: Boolean,
80
+ }
75
81
  const LabelText = styled("div", toggleAttrs)`
76
82
  color: ${(props) =>
77
83
  props.fontColor ? props.fontColor : props.theme.colors.darkGray};
@@ -85,6 +91,14 @@ const LabelText = styled("div", toggleAttrs)`
85
91
 
86
92
  const ToggleWrapper = styled("span", toggleAttrs)`
87
93
  display: inline-block;
94
+ border: ${(props) =>
95
+ props.disabled
96
+ ? "1px solid " + props.theme.colors.disabled
97
+ : props.isChecked
98
+ ? props.backgroundColor
99
+ ? "1px solid " + props.backgroundColor
100
+ : "1px solid " + props.theme.colors.green
101
+ : "1px solid " + props.theme.colors.grey3}
88
102
  position: relative;
89
103
  cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
90
104
  width: ${(props) =>
@@ -97,7 +111,7 @@ const ToggleWrapper = styled("span", toggleAttrs)`
97
111
  props.size === "medium"
98
112
  ? "24px"
99
113
  : props.size === "small"
100
- ? "16px"
114
+ ? "14px"
101
115
  : "24px"};
102
116
  border-radius: 9px;
103
117
 
@@ -111,14 +125,20 @@ const ToggleWrapper = styled("span", toggleAttrs)`
111
125
  }
112
126
  `
113
127
 
114
- const backgroundAttrs = { backgroundColor: String, isChecked: Boolean }
128
+ const backgroundAttrs = {
129
+ backgroundColor: String,
130
+ isChecked: Boolean,
131
+ disabled: Boolean,
132
+ }
115
133
  const ToggleBackground = styled("span", backgroundAttrs)`
116
134
  display: inline-block;
117
135
  border-radius: 100px;
118
136
  height: 100%;
119
137
  width: 100%;
120
138
  background-color: ${(props) =>
121
- props.isChecked
139
+ props.disabled
140
+ ? props.theme.colors.grey5
141
+ : props.isChecked
122
142
  ? props.backgroundColor
123
143
  ? props.backgroundColor
124
144
  : props.theme.colors.green
@@ -146,9 +166,9 @@ const ToggleDot = styled("span", toggleProps)`
146
166
  : props.size === "small"
147
167
  ? "10px"
148
168
  : "14px"};
149
- left: 4px
169
+ left: 3px
150
170
  bottom: ${(props) =>
151
- props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
171
+ props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
152
172
  background-color: ${(props) =>
153
173
  props.disabled
154
174
  ? props.theme.colors.disabled
@@ -164,7 +184,7 @@ const ToggleDot = styled("span", toggleProps)`
164
184
  ? props.size === "medium"
165
185
  ? "translateX(25px)"
166
186
  : props.size === "small"
167
- ? "translateX(10px)"
187
+ ? "translateX(13px)"
168
188
  : "translateX(25px)"
169
189
  : "translateX(0)"};
170
190
 
@@ -116,6 +116,14 @@ import Spinner from "../spinner"
116
116
  const PageContainer = styled.div`
117
117
  display: grid;
118
118
  align-items: center;
119
+ justify-items: center;
120
+ width: 30px;
121
+ height: 30px;
122
+
123
+ &:hover {
124
+ background-color: ${(props) => props.theme.colors.grey5};
125
+ border-radius: 4px;
126
+ }
119
127
  `
120
128
 
121
129
  const ButtonContainer = styled.div`
@@ -128,13 +136,6 @@ const ButtonContainer = styled.div`
128
136
  // This is the dot color
129
137
  background-color: #263238;
130
138
  }
131
-
132
- &:hover {
133
- div {
134
- // Dot color on hover
135
- background-color: ${(props) => props.theme.colors.grey3};
136
- }
137
- }
138
139
  `
139
140
 
140
141
  const DotItem = styled.div`