@eturnity/eturnity_reusable_components 1.0.20 → 1.0.24

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.20",
3
+ "version": "1.0.24",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -19,6 +19,11 @@
19
19
  </tr>
20
20
  </tbody>
21
21
  </main-table>
22
+ <checkbox
23
+ :isChecked="isChecked"
24
+ @on-event-handler="isChecked = $event"
25
+ size="small"
26
+ />
22
27
  </page-container>
23
28
  </ThemeProvider>
24
29
  </template>
@@ -28,6 +33,7 @@ import { ThemeProvider } from "vue-styled-components"
28
33
  import theme from "./assets/theme"
29
34
  import styled from "vue-styled-components"
30
35
  import MainTable from "@/components/tables/mainTable"
36
+ import Checkbox from "@/components/inputs/checkbox"
31
37
 
32
38
  const PageContainer = styled.div`
33
39
  padding: 40px;
@@ -39,6 +45,7 @@ export default {
39
45
  ThemeProvider,
40
46
  PageContainer,
41
47
  MainTable,
48
+ Checkbox,
42
49
  },
43
50
  data() {
44
51
  return {
@@ -50,6 +57,7 @@ export default {
50
57
  number_max_allowed: 10,
51
58
  unit_short_name: "cm",
52
59
  },
60
+ isChecked: false,
53
61
  }
54
62
  },
55
63
  methods: {
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <component-wrapper>
3
- <container :checkColor="checkColor"
3
+ <container
4
+ :checkColor="checkColor"
5
+ :size="size"
6
+ :hasLabel="!!label.length"
7
+ :backgroundColor="backgroundColor"
8
+ :isChecked="isChecked"
4
9
  >{{ label }}
5
10
  <input-checkbox
6
11
  type="checkbox"
@@ -20,6 +25,8 @@
20
25
  // :isChecked="isChecked" //required
21
26
  // @on-event-handler="onInputChange($event)" //required
22
27
  // checkColor="blue"
28
+ // size="small"
29
+ // backgroundColor="red"
23
30
  // />
24
31
  import styled from "vue-styled-components"
25
32
 
@@ -27,10 +34,16 @@ const ComponentWrapper = styled.div`
27
34
  display: inline-block;
28
35
  `
29
36
 
30
- const containerAttrs = { checkColor: String }
37
+ const containerAttrs = {
38
+ checkColor: String,
39
+ size: String,
40
+ hasLabel: Boolean,
41
+ backgroundColor: String,
42
+ isChecked: Boolean,
43
+ }
31
44
  const Container = styled("label", containerAttrs)`
32
45
  display: grid;
33
- height: 28px;
46
+ height: ${(props) => (props.hasLabel ? "28px" : "auto")};
34
47
  align-content: center;
35
48
  color: ${(props) => props.theme.colors.black};
36
49
  position: relative;
@@ -44,11 +57,32 @@ const Container = styled("label", containerAttrs)`
44
57
  position: absolute;
45
58
  top: 0;
46
59
  left: 0;
47
- height: 25px;
48
- width: 25px;
49
- background-color: #fff;
60
+ height: ${(props) =>
61
+ props.size === "medium"
62
+ ? "25px"
63
+ : props.size === "small"
64
+ ? "16px"
65
+ : "25px"};
66
+ width: ${(props) =>
67
+ props.size === "medium"
68
+ ? "25px"
69
+ : props.size === "small"
70
+ ? "16px"
71
+ : "25px"};
72
+ background-color: ${(props) =>
73
+ !props.isChecked
74
+ ? "#fff"
75
+ : props.backgroundColor
76
+ ? props.backgroundColor
77
+ : props.theme.colors.green};
50
78
  border-radius: 4px;
51
- border: 1px solid ${(props) => props.theme.colors.mediumGray};
79
+ border: 1px solid
80
+ ${(props) =>
81
+ props.isChecked
82
+ ? props.backgroundColor
83
+ ? props.backgroundColor
84
+ : props.theme.colors.green
85
+ : props.theme.colors.mediumGray};
52
86
 
53
87
  &:after {
54
88
  content: "";
@@ -58,14 +92,27 @@ const Container = styled("label", containerAttrs)`
58
92
  }
59
93
 
60
94
  .checkmark:after {
61
- left: 9px;
62
- top: 5px;
63
- width: 5px;
64
- height: 10px;
95
+ left: ${(props) =>
96
+ props.size === "medium" ? "9px" : props.size === "small" ? "5px" : "9px"};
97
+ top: ${(props) =>
98
+ props.size === "medium" ? "5px" : props.size === "small" ? "2px" : "5px"};
99
+ width: ${(props) =>
100
+ props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
101
+ height: ${(props) =>
102
+ props.size === "medium"
103
+ ? "10px"
104
+ : props.size === "small"
105
+ ? "6px"
106
+ : "10px"};
65
107
  border: solid
66
108
  ${(props) =>
67
- props.checkColor ? props.checkColor : props.theme.colors.black};
68
- border-width: 0 3px 3px 0;
109
+ props.checkColor ? props.checkColor : props.theme.colors.white};
110
+ border-width: ${(props) =>
111
+ props.size === "medium"
112
+ ? "0 3px 3px 0"
113
+ : props.size === "small"
114
+ ? "0 2px 2px 0"
115
+ : "0 3px 3px 0"};
69
116
  transform: rotate(45deg);
70
117
  }
71
118
  `
@@ -102,6 +149,13 @@ export default {
102
149
  checkColor: {
103
150
  required: false,
104
151
  },
152
+ size: {
153
+ required: false,
154
+ default: "medium", // small, medium
155
+ },
156
+ backgroundColor: {
157
+ required: false,
158
+ },
105
159
  },
106
160
  methods: {
107
161
  onChangeHandler(value) {