@eturnity/eturnity_reusable_components 1.0.73 → 1.0.77

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.73",
3
+ "version": "1.0.77",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -13,8 +13,21 @@
13
13
  <tbody>
14
14
  <tr>
15
15
  <td class="text">Body 2</td>
16
- <td class="text">Body 3</td>
17
- <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>
18
31
  <div class="icons-container">
19
32
  <three-dots :options="listOptions" :isLoading="false" />
20
33
  </div>
@@ -23,22 +36,13 @@
23
36
  </main-table>
24
37
  <br />
25
38
  <br />
26
- <input-wrapper>
27
- <input-number
28
- placeholder="Enter Value"
29
- unitName="kWh"
30
- :value="inputValue"
31
- @input-change="onInputChange($event)"
32
- textAlign="left"
33
- fontSize="13px"
34
- labelText="Number of Modules"
35
- labelInfoText="Here is some information for you..."
36
- :disabled="true"
37
- />
38
- </input-wrapper>
39
- <br />
40
- <br />
41
- <delete-icon />
39
+ <toggle
40
+ @on-toggle-change="onInputChange($event)"
41
+ :isChecked="isChecked"
42
+ label="My Label Text"
43
+ labelAlign="right"
44
+ :disabled="true"
45
+ />
42
46
  </page-container>
43
47
  </ThemeProvider>
44
48
  </template>
@@ -49,18 +53,12 @@ import theme from "./assets/theme"
49
53
  import styled from "vue-styled-components"
50
54
  import MainTable from "@/components/tables/mainTable"
51
55
  import ThreeDots from "@/components/threeDots"
52
- import InputNumber from "@/components/inputs/inputNumber"
53
- import DeleteIcon from "@/components/deleteIcon"
56
+ import Toggle from "@/components/inputs/toggle"
54
57
 
55
58
  const PageContainer = styled.div`
56
59
  padding: 40px;
57
60
  `
58
61
 
59
- const InputWrapper = styled.div`
60
- height: 36px;
61
- width: 180px;
62
- `
63
-
64
62
  export default {
65
63
  name: "App",
66
64
  components: {
@@ -68,9 +66,7 @@ export default {
68
66
  PageContainer,
69
67
  MainTable,
70
68
  ThreeDots,
71
- InputNumber,
72
- InputWrapper,
73
- DeleteIcon,
69
+ Toggle,
74
70
  },
75
71
  data() {
76
72
  return {
@@ -136,7 +132,7 @@ export default {
136
132
  return theme
137
133
  },
138
134
  onInputChange(event) {
139
- this.inputValue = event
135
+ this.isChecked = event
140
136
  },
141
137
  },
142
138
  }
@@ -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,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) =>
@@ -111,14 +125,21 @@ 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
- display: inline-block;
134
+ /* display: inline-block; */
135
+ display: block;
117
136
  border-radius: 100px;
118
137
  height: 100%;
119
138
  width: 100%;
120
139
  background-color: ${(props) =>
121
- props.isChecked
140
+ props.disabled
141
+ ? props.theme.colors.grey5
142
+ : props.isChecked
122
143
  ? props.backgroundColor
123
144
  ? props.backgroundColor
124
145
  : props.theme.colors.green
@@ -146,9 +167,9 @@ const ToggleDot = styled("span", toggleProps)`
146
167
  : props.size === "small"
147
168
  ? "10px"
148
169
  : "14px"};
149
- left: 4px
170
+ left: 3px
150
171
  bottom: ${(props) =>
151
- props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
172
+ props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
152
173
  background-color: ${(props) =>
153
174
  props.disabled
154
175
  ? props.theme.colors.disabled
@@ -164,7 +185,7 @@ const ToggleDot = styled("span", toggleProps)`
164
185
  ? props.size === "medium"
165
186
  ? "translateX(25px)"
166
187
  : props.size === "small"
167
- ? "translateX(10px)"
188
+ ? "translateX(13px)"
168
189
  : "translateX(25px)"
169
190
  : "translateX(0)"};
170
191