@eturnity/eturnity_reusable_components 1.1.60 → 1.1.63
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
package/src/App.vue
CHANGED
|
@@ -32,10 +32,12 @@
|
|
|
32
32
|
<br />
|
|
33
33
|
<toggle
|
|
34
34
|
@on-toggle-change="onInputChange($event)"
|
|
35
|
-
:isChecked="
|
|
35
|
+
:isChecked="inputValue"
|
|
36
36
|
label="My Label Text"
|
|
37
|
+
infoTextMessage="This is my test message"
|
|
38
|
+
infoTextAlign="right"
|
|
37
39
|
labelAlign="right"
|
|
38
|
-
:disabled="
|
|
40
|
+
:disabled="false"
|
|
39
41
|
/>
|
|
40
42
|
<br />
|
|
41
43
|
<input-number
|
|
@@ -47,6 +49,12 @@
|
|
|
47
49
|
<br />
|
|
48
50
|
<page-subtitle text="My Subtitle" infoText="My info Text" />
|
|
49
51
|
<spinner size="30px" />
|
|
52
|
+
<checkbox
|
|
53
|
+
label="Do you accept the Terms?"
|
|
54
|
+
:isChecked="true"
|
|
55
|
+
size="small"
|
|
56
|
+
:isDisabled="false"
|
|
57
|
+
/>
|
|
50
58
|
</page-container>
|
|
51
59
|
</ThemeProvider>
|
|
52
60
|
</template>
|
|
@@ -59,6 +67,7 @@ import MainTable from "@/components/tables/mainTable"
|
|
|
59
67
|
import ThreeDots from "@/components/threeDots"
|
|
60
68
|
import Toggle from "@/components/inputs/toggle"
|
|
61
69
|
import InputNumber from "@/components/inputs/inputNumber"
|
|
70
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
62
71
|
import PageSubtitle from "@/components/pageSubtitle"
|
|
63
72
|
import Spinner from "@/components/spinner"
|
|
64
73
|
// import TableDropdown from "@/components/tableDropdown"
|
|
@@ -78,6 +87,7 @@ export default {
|
|
|
78
87
|
InputNumber,
|
|
79
88
|
PageSubtitle,
|
|
80
89
|
Spinner,
|
|
90
|
+
Checkbox,
|
|
81
91
|
// TableDropdown,
|
|
82
92
|
},
|
|
83
93
|
data() {
|
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
:backgroundColor="backgroundColor"
|
|
8
8
|
:isChecked="isChecked"
|
|
9
9
|
:isDisabled="isDisabled"
|
|
10
|
-
|
|
10
|
+
>
|
|
11
11
|
<input-checkbox
|
|
12
12
|
type="checkbox"
|
|
13
13
|
:checked="isChecked"
|
|
14
14
|
@change="onChangeHandler(!isChecked)"
|
|
15
15
|
/>
|
|
16
|
-
<
|
|
16
|
+
<div>
|
|
17
|
+
<span class="checkmark"></span>
|
|
18
|
+
</div>
|
|
19
|
+
<label-text v-if="!!label.length">{{ label }}</label-text>
|
|
17
20
|
</container>
|
|
18
21
|
</component-wrapper>
|
|
19
22
|
</template>
|
|
@@ -34,6 +37,7 @@ import styled from "vue-styled-components"
|
|
|
34
37
|
|
|
35
38
|
const ComponentWrapper = styled.div`
|
|
36
39
|
display: inline-block;
|
|
40
|
+
min-height: 18px;
|
|
37
41
|
`
|
|
38
42
|
|
|
39
43
|
const containerAttrs = {
|
|
@@ -46,20 +50,18 @@ const containerAttrs = {
|
|
|
46
50
|
}
|
|
47
51
|
const Container = styled("label", containerAttrs)`
|
|
48
52
|
display: grid;
|
|
49
|
-
|
|
53
|
+
grid-template-columns: ${(props) => (props.hasLabel ? "18px auto" : "18px")};
|
|
54
|
+
grid-gap: 16px;
|
|
50
55
|
align-content: center;
|
|
56
|
+
/* align-items: center; */
|
|
51
57
|
color: ${(props) => props.theme.colors.black};
|
|
52
58
|
position: relative;
|
|
53
|
-
/* padding-left: 42px; */
|
|
54
|
-
margin-bottom: 12px;
|
|
55
59
|
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
|
|
56
60
|
font-size: 16px;
|
|
57
61
|
user-select: none;
|
|
58
62
|
|
|
59
63
|
.checkmark {
|
|
60
64
|
position: absolute;
|
|
61
|
-
top: 0;
|
|
62
|
-
left: 0;
|
|
63
65
|
height: ${(props) =>
|
|
64
66
|
props.size === "medium"
|
|
65
67
|
? "25px"
|
|
@@ -131,12 +133,20 @@ const InputCheckbox = styled.input`
|
|
|
131
133
|
width: 0;
|
|
132
134
|
`
|
|
133
135
|
|
|
136
|
+
const LabelText = styled.div`
|
|
137
|
+
font-size: 13px;
|
|
138
|
+
display: grid;
|
|
139
|
+
align-items: center;
|
|
140
|
+
min-height: 18px;
|
|
141
|
+
`
|
|
142
|
+
|
|
134
143
|
export default {
|
|
135
144
|
name: "checkbox",
|
|
136
145
|
components: {
|
|
137
146
|
ComponentWrapper,
|
|
138
147
|
Container,
|
|
139
148
|
InputCheckbox,
|
|
149
|
+
LabelText,
|
|
140
150
|
},
|
|
141
151
|
props: {
|
|
142
152
|
label: {
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<container>
|
|
3
3
|
<flex-wrapper :size="size" :disabled="disabled" @click="onToggleChange">
|
|
4
|
-
<label-
|
|
5
|
-
label
|
|
6
|
-
|
|
4
|
+
<label-container
|
|
5
|
+
v-if="label && labelAlign === 'left'"
|
|
6
|
+
:hasInfoMessage="!!infoTextMessage"
|
|
7
|
+
>
|
|
8
|
+
<label-text :size="size">{{ label }}</label-text>
|
|
9
|
+
<info-text
|
|
10
|
+
v-if="infoTextMessage"
|
|
11
|
+
:text="infoTextMessage"
|
|
12
|
+
borderColor="#ccc"
|
|
13
|
+
size="14"
|
|
14
|
+
:alignText="infoTextAlign"
|
|
15
|
+
/>
|
|
16
|
+
</label-container>
|
|
7
17
|
<toggle-wrapper
|
|
8
18
|
role="checkbox"
|
|
9
19
|
:checked="isChecked"
|
|
@@ -26,12 +36,19 @@
|
|
|
26
36
|
:disabled="disabled"
|
|
27
37
|
/>
|
|
28
38
|
</toggle-wrapper>
|
|
29
|
-
<label-
|
|
30
|
-
v-if="labelAlign === 'right'"
|
|
31
|
-
:
|
|
32
|
-
:fontColor="fontColor"
|
|
33
|
-
>{{ label }}</label-text
|
|
39
|
+
<label-container
|
|
40
|
+
v-if="label && labelAlign === 'right'"
|
|
41
|
+
:hasInfoMessage="!!infoTextMessage"
|
|
34
42
|
>
|
|
43
|
+
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
|
44
|
+
<info-text
|
|
45
|
+
v-if="infoTextMessage"
|
|
46
|
+
:text="infoTextMessage"
|
|
47
|
+
borderColor="#ccc"
|
|
48
|
+
size="14"
|
|
49
|
+
:alignText="infoTextAlign"
|
|
50
|
+
/>
|
|
51
|
+
</label-container>
|
|
35
52
|
</flex-wrapper>
|
|
36
53
|
</container>
|
|
37
54
|
</template>
|
|
@@ -49,9 +66,12 @@
|
|
|
49
66
|
// labelAlign="right"
|
|
50
67
|
// fontColor="black"
|
|
51
68
|
// :disabled="true"
|
|
69
|
+
// infoTextAlign="right" // left by default
|
|
70
|
+
// infoTextMessage="My info message"
|
|
52
71
|
// />
|
|
53
72
|
|
|
54
73
|
import styled from "vue-styled-components"
|
|
74
|
+
import InfoText from "../../infoText"
|
|
55
75
|
|
|
56
76
|
const Container = styled.div`
|
|
57
77
|
display: inline-block;
|
|
@@ -131,7 +151,6 @@ const backgroundAttrs = {
|
|
|
131
151
|
disabled: Boolean,
|
|
132
152
|
}
|
|
133
153
|
const ToggleBackground = styled("span", backgroundAttrs)`
|
|
134
|
-
/* display: inline-block; */
|
|
135
154
|
display: block;
|
|
136
155
|
border-radius: 100px;
|
|
137
156
|
height: 100%;
|
|
@@ -198,6 +217,15 @@ const ToggleDot = styled("span", toggleProps)`
|
|
|
198
217
|
}
|
|
199
218
|
`
|
|
200
219
|
|
|
220
|
+
const labelAttrs = { hasInfoMessage: Boolean }
|
|
221
|
+
const LabelContainer = styled("div", labelAttrs)`
|
|
222
|
+
display: inline-grid;
|
|
223
|
+
grid-template-columns: ${(props) =>
|
|
224
|
+
props.hasInfoMessage ? "auto 1fr" : "auto"};
|
|
225
|
+
grid-gap: 12px;
|
|
226
|
+
align-items: center;
|
|
227
|
+
`
|
|
228
|
+
|
|
201
229
|
export default {
|
|
202
230
|
name: "toggle",
|
|
203
231
|
components: {
|
|
@@ -207,6 +235,8 @@ export default {
|
|
|
207
235
|
ToggleWrapper,
|
|
208
236
|
FlexWrapper,
|
|
209
237
|
LabelText,
|
|
238
|
+
InfoText,
|
|
239
|
+
LabelContainer,
|
|
210
240
|
},
|
|
211
241
|
props: {
|
|
212
242
|
label: {
|
|
@@ -238,6 +268,12 @@ export default {
|
|
|
238
268
|
required: false,
|
|
239
269
|
default: false,
|
|
240
270
|
},
|
|
271
|
+
infoTextMessage: {
|
|
272
|
+
required: false,
|
|
273
|
+
},
|
|
274
|
+
infoTextAlign: {
|
|
275
|
+
required: false,
|
|
276
|
+
},
|
|
241
277
|
},
|
|
242
278
|
methods: {
|
|
243
279
|
onToggleChange() {
|