@eturnity/eturnity_reusable_components 1.0.71 → 1.0.75
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 +1 -1
- package/src/App.vue +10 -24
- package/src/assets/icons/delete_icon.svg +1 -1
- package/src/assets/icons/delete_icon_gray.svg +1 -1
- package/src/assets/theme.js +3 -1
- package/src/components/deleteIcon/index.vue +18 -31
- package/src/components/inputs/toggle/index.vue +19 -13
- package/src/components/threeDots/index.vue +8 -7
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
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>
|
|
@@ -24,19 +23,12 @@
|
|
|
24
23
|
</main-table>
|
|
25
24
|
<br />
|
|
26
25
|
<br />
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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>
|
|
26
|
+
<toggle
|
|
27
|
+
@on-toggle-change="onInputChange($event)"
|
|
28
|
+
:isChecked="isChecked"
|
|
29
|
+
label="My Label Text"
|
|
30
|
+
labelAlign="right"
|
|
31
|
+
/>
|
|
40
32
|
</page-container>
|
|
41
33
|
</ThemeProvider>
|
|
42
34
|
</template>
|
|
@@ -47,17 +39,12 @@ import theme from "./assets/theme"
|
|
|
47
39
|
import styled from "vue-styled-components"
|
|
48
40
|
import MainTable from "@/components/tables/mainTable"
|
|
49
41
|
import ThreeDots from "@/components/threeDots"
|
|
50
|
-
import
|
|
42
|
+
import Toggle from "@/components/inputs/toggle"
|
|
51
43
|
|
|
52
44
|
const PageContainer = styled.div`
|
|
53
45
|
padding: 40px;
|
|
54
46
|
`
|
|
55
47
|
|
|
56
|
-
const InputWrapper = styled.div`
|
|
57
|
-
height: 36px;
|
|
58
|
-
width: 180px;
|
|
59
|
-
`
|
|
60
|
-
|
|
61
48
|
export default {
|
|
62
49
|
name: "App",
|
|
63
50
|
components: {
|
|
@@ -65,8 +52,7 @@ export default {
|
|
|
65
52
|
PageContainer,
|
|
66
53
|
MainTable,
|
|
67
54
|
ThreeDots,
|
|
68
|
-
|
|
69
|
-
InputWrapper,
|
|
55
|
+
Toggle,
|
|
70
56
|
},
|
|
71
57
|
data() {
|
|
72
58
|
return {
|
|
@@ -78,7 +64,7 @@ export default {
|
|
|
78
64
|
number_max_allowed: 10,
|
|
79
65
|
unit_short_name: "cm",
|
|
80
66
|
},
|
|
81
|
-
isChecked:
|
|
67
|
+
isChecked: true,
|
|
82
68
|
listOptions: [
|
|
83
69
|
{
|
|
84
70
|
name: "Option 1",
|
|
@@ -132,7 +118,7 @@ export default {
|
|
|
132
118
|
return theme
|
|
133
119
|
},
|
|
134
120
|
onInputChange(event) {
|
|
135
|
-
this.
|
|
121
|
+
this.isChecked = event
|
|
136
122
|
},
|
|
137
123
|
},
|
|
138
124
|
}
|
package/src/assets/theme.js
CHANGED
|
@@ -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,57 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<wrapper>
|
|
3
|
-
<icon
|
|
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
|
-
|
|
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
|
-
|
|
27
|
+
background-color: ${(props) => props.theme.colors.grey5};
|
|
38
28
|
border-radius: 4px;
|
|
39
|
-
background-image: ${() =>
|
|
40
|
-
`url(${require("../../assets/icons/delete_icon.svg")})`};
|
|
41
29
|
}
|
|
42
30
|
`
|
|
43
31
|
|
|
44
32
|
export default {
|
|
45
33
|
name: "delete-icon",
|
|
46
34
|
components: {
|
|
47
|
-
Icon,
|
|
48
35
|
Wrapper,
|
|
36
|
+
IconImage,
|
|
49
37
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
isHovered: false,
|
|
41
|
+
}
|
|
55
42
|
},
|
|
56
43
|
}
|
|
57
44
|
</script>
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<container>
|
|
3
|
-
<flex-wrapper :size="size">
|
|
4
|
-
<label-text
|
|
5
|
-
|
|
6
|
-
|
|
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"
|
|
18
14
|
>
|
|
19
15
|
<toggle-background
|
|
20
16
|
:backgroundColor="backgroundColor"
|
|
21
17
|
:isChecked="isChecked"
|
|
18
|
+
:disabled="disabled"
|
|
22
19
|
/>
|
|
23
20
|
<toggle-dot
|
|
24
21
|
:isChecked="isChecked"
|
|
@@ -58,7 +55,7 @@ const Container = styled.div`
|
|
|
58
55
|
display: inline-block;
|
|
59
56
|
`
|
|
60
57
|
|
|
61
|
-
const flexAttrs = { size: String }
|
|
58
|
+
const flexAttrs = { size: String, disabled: Boolean }
|
|
62
59
|
const FlexWrapper = styled("div", flexAttrs)`
|
|
63
60
|
display: grid;
|
|
64
61
|
grid-template-columns: auto 1fr;
|
|
@@ -69,6 +66,7 @@ const FlexWrapper = styled("div", flexAttrs)`
|
|
|
69
66
|
? "10px"
|
|
70
67
|
: "20px"};
|
|
71
68
|
align-items: center;
|
|
69
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
|
72
70
|
`
|
|
73
71
|
|
|
74
72
|
const toggleAttrs = { size: String, fontColor: String, disabled: Boolean }
|
|
@@ -85,6 +83,8 @@ const LabelText = styled("div", toggleAttrs)`
|
|
|
85
83
|
|
|
86
84
|
const ToggleWrapper = styled("span", toggleAttrs)`
|
|
87
85
|
display: inline-block;
|
|
86
|
+
border: ${(props) =>
|
|
87
|
+
props.disabled ? "1px solid " + props.theme.colors.disabled : "none"}
|
|
88
88
|
position: relative;
|
|
89
89
|
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
|
90
90
|
width: ${(props) =>
|
|
@@ -111,14 +111,20 @@ const ToggleWrapper = styled("span", toggleAttrs)`
|
|
|
111
111
|
}
|
|
112
112
|
`
|
|
113
113
|
|
|
114
|
-
const backgroundAttrs = {
|
|
114
|
+
const backgroundAttrs = {
|
|
115
|
+
backgroundColor: String,
|
|
116
|
+
isChecked: Boolean,
|
|
117
|
+
disabled: Boolean,
|
|
118
|
+
}
|
|
115
119
|
const ToggleBackground = styled("span", backgroundAttrs)`
|
|
116
120
|
display: inline-block;
|
|
117
121
|
border-radius: 100px;
|
|
118
122
|
height: 100%;
|
|
119
123
|
width: 100%;
|
|
120
124
|
background-color: ${(props) =>
|
|
121
|
-
props.
|
|
125
|
+
props.disabled
|
|
126
|
+
? props.theme.colors.grey5
|
|
127
|
+
: props.isChecked
|
|
122
128
|
? props.backgroundColor
|
|
123
129
|
? props.backgroundColor
|
|
124
130
|
: props.theme.colors.green
|
|
@@ -146,7 +152,7 @@ const ToggleDot = styled("span", toggleProps)`
|
|
|
146
152
|
: props.size === "small"
|
|
147
153
|
? "10px"
|
|
148
154
|
: "14px"};
|
|
149
|
-
left:
|
|
155
|
+
left: 3px
|
|
150
156
|
bottom: ${(props) =>
|
|
151
157
|
props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
|
|
152
158
|
background-color: ${(props) =>
|
|
@@ -164,7 +170,7 @@ const ToggleDot = styled("span", toggleProps)`
|
|
|
164
170
|
? props.size === "medium"
|
|
165
171
|
? "translateX(25px)"
|
|
166
172
|
: props.size === "small"
|
|
167
|
-
? "translateX(
|
|
173
|
+
? "translateX(13px)"
|
|
168
174
|
: "translateX(25px)"
|
|
169
175
|
: "translateX(0)"};
|
|
170
176
|
|
|
@@ -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`
|