@enso-ui/switch 1.0.17 → 2.0.0
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 +13 -12
- package/src/bulma/VueSwitch.vue +8 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enso-ui/switch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Vue Switch",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,18 +21,19 @@
|
|
|
21
21
|
"url": "https://github.com/enso-ui/switch/issues"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/enso-ui/switch#readme",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"bulma": "^0.9.0",
|
|
26
|
+
"vue": "^3.0"
|
|
27
|
+
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@vue/
|
|
29
|
+
"@vue/cli-plugin-babel": "5.0.0-beta.6",
|
|
30
|
+
"@vue/cli-plugin-eslint": "5.0.0-beta.6",
|
|
31
|
+
"@vue/eslint-config-airbnb": "^5.0.0",
|
|
32
|
+
"autoprefixer": "^9.6.1",
|
|
26
33
|
"babel-eslint": "^10.0.1",
|
|
27
|
-
"cross-env": "^
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"eslint-
|
|
30
|
-
"
|
|
31
|
-
"node-sass": "^4.11.0",
|
|
32
|
-
"webpack-cli": "^3.2.1"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"bulma": "^0.8.0",
|
|
36
|
-
"vue": "^2.5.16"
|
|
34
|
+
"cross-env": "^6.0.0",
|
|
35
|
+
"eslint": "^7.0",
|
|
36
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
37
|
+
"eslint-plugin-vue": "^8.0.0"
|
|
37
38
|
}
|
|
38
39
|
}
|
package/src/bulma/VueSwitch.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<label class="vue-switch">
|
|
3
3
|
<input class="checkbox"
|
|
4
4
|
type="checkbox"
|
|
5
|
-
|
|
5
|
+
:value="value"
|
|
6
6
|
@click.stop
|
|
7
7
|
@keydown.prevent.enter="toggle"
|
|
8
8
|
@keydown.space="toggle"
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
<label class="control-switch"
|
|
12
12
|
:class="[{ 'checked': value, 'disabled': disabled || readonly }]"
|
|
13
13
|
@click="toggle"/>
|
|
14
|
-
<label class="control-label"
|
|
14
|
+
<label class="control-label"
|
|
15
|
+
@click="toggle">
|
|
15
16
|
<slot/>
|
|
16
17
|
</label>
|
|
17
18
|
</label>
|
|
@@ -37,20 +38,10 @@ export default {
|
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
|
|
40
|
-
data: v => ({
|
|
41
|
-
checked: v.value,
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
watch: {
|
|
45
|
-
value(value) {
|
|
46
|
-
this.checked = value;
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
|
|
50
41
|
methods: {
|
|
51
42
|
toggle() {
|
|
52
43
|
if (!this.disabled && !this.readonly) {
|
|
53
|
-
this.$emit('input', !this.
|
|
44
|
+
this.$emit('input', !this.value);
|
|
54
45
|
}
|
|
55
46
|
},
|
|
56
47
|
},
|
|
@@ -91,8 +82,7 @@ export default {
|
|
|
91
82
|
align-items: center;
|
|
92
83
|
justify-content: center;
|
|
93
84
|
|
|
94
|
-
&:before,
|
|
95
|
-
&:after {
|
|
85
|
+
&:before, &:after {
|
|
96
86
|
content: ' ';
|
|
97
87
|
position: absolute;
|
|
98
88
|
top: 0;
|
|
@@ -115,9 +105,11 @@ export default {
|
|
|
115
105
|
&.checked {
|
|
116
106
|
border-color: #4a4a4a;
|
|
117
107
|
background-color: #4a4a4a;
|
|
108
|
+
|
|
118
109
|
&:before {
|
|
119
110
|
transform: scale(0);
|
|
120
111
|
}
|
|
112
|
+
|
|
121
113
|
&:after {
|
|
122
114
|
transform: translateX(calc(0.7 * var(--height)));
|
|
123
115
|
}
|
|
@@ -142,4 +134,4 @@ export default {
|
|
|
142
134
|
--height: 1.5rem;
|
|
143
135
|
}
|
|
144
136
|
}
|
|
145
|
-
</style>
|
|
137
|
+
</style>
|