@scx-js/scx-ui 0.0.1 → 0.0.2
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/index.js +44 -44
- package/package.json +29 -29
- package/scx-context-menu/index.css +50 -50
- package/scx-context-menu/index.js +65 -65
- package/scx-context-menu/index.vue +86 -86
- package/scx-drag/index.js +30 -30
- package/scx-group/index.css +65 -65
- package/scx-group/index.vue +154 -154
- package/scx-icon/index.css +3 -3
- package/scx-icon/index.vue +20 -20
- package/scx-input/index.css +39 -39
- package/scx-input/index.vue +44 -44
- package/scx-panel/index.css +47 -47
- package/scx-panel/index.vue +28 -28
- package/scx-panel/scx-panel-item.css +36 -36
- package/scx-panel/scx-panel-item.vue +22 -22
- package/scx-progress/index.css +33 -33
- package/scx-progress/index.vue +29 -29
- package/scx-switch/index.css +109 -109
- package/scx-switch/index.vue +31 -31
- package/scx-upload/helper.js +177 -177
- package/scx-upload/index.css +204 -204
- package/scx-upload/index.vue +235 -235
- package/scx-upload-list/index.css +89 -89
- package/scx-upload-list/index.vue +228 -228
- package/style/changeTheme.js +13 -13
- package/style/dark.css +59 -59
- package/style/default.css +98 -98
- package/style/normalize.css +35 -35
package/scx-panel/index.css
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
.scx-panel {
|
2
|
-
border-radius: 4px;
|
3
|
-
padding: 10px;
|
4
|
-
background: var(--scx-glass-bg);
|
5
|
-
transition: background-color 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
6
|
-
backdrop-filter: var(--scx-glass-bg-filter);
|
7
|
-
overflow: hidden;
|
8
|
-
display: flex;
|
9
|
-
flex-direction: column;
|
10
|
-
box-shadow: var(--scx-box-shadow-center);
|
11
|
-
}
|
12
|
-
|
13
|
-
/********************* vue 过渡动画 *******************/
|
14
|
-
.scx-panel-t_left-bottom-enter-active,
|
15
|
-
.scx-panel-t_left-bottom-leave-active,
|
16
|
-
.scx-panel-t_left-top-enter-active,
|
17
|
-
.scx-panel-t_left-top-leave-active,
|
18
|
-
.scx-panel-t_top-enter-active,
|
19
|
-
.scx-panel-t_top-leave-active {
|
20
|
-
opacity: 1;
|
21
|
-
transition: transform 200ms cubic-bezier(.23, 1, .32, 1), opacity 100ms cubic-bezier(.23, 1, .32, 1);
|
22
|
-
}
|
23
|
-
|
24
|
-
.scx-panel-t_left-top-enter-from,
|
25
|
-
.scx-panel-t_left-top-leave-to,
|
26
|
-
.scx-panel-t_left-bottom-enter-from,
|
27
|
-
.scx-panel-t_left-bottom-leave-to,
|
28
|
-
.scx-panel-t_top-enter-from,
|
29
|
-
.scx-panel-t_top-leave-to {
|
30
|
-
opacity: 0;
|
31
|
-
transform: scale(0.95);
|
32
|
-
}
|
33
|
-
|
34
|
-
.scx-panel-t_left-bottom-enter-active,
|
35
|
-
.scx-panel-t_left-bottom-leave-active {
|
36
|
-
transform-origin: left bottom;
|
37
|
-
}
|
38
|
-
|
39
|
-
.scx-panel-t_left-top-enter-active,
|
40
|
-
.scx-panel-t_left-top-leave-active {
|
41
|
-
transform-origin: left top;
|
42
|
-
}
|
43
|
-
|
44
|
-
.scx-panel-t_top-enter-active,
|
45
|
-
.scx-panel-t_top-leave-active {
|
46
|
-
transform-origin: top;
|
47
|
-
}
|
1
|
+
.scx-panel {
|
2
|
+
border-radius: 4px;
|
3
|
+
padding: 10px;
|
4
|
+
background: var(--scx-glass-bg);
|
5
|
+
transition: background-color 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
|
6
|
+
backdrop-filter: var(--scx-glass-bg-filter);
|
7
|
+
overflow: hidden;
|
8
|
+
display: flex;
|
9
|
+
flex-direction: column;
|
10
|
+
box-shadow: var(--scx-box-shadow-center);
|
11
|
+
}
|
12
|
+
|
13
|
+
/********************* vue 过渡动画 *******************/
|
14
|
+
.scx-panel-t_left-bottom-enter-active,
|
15
|
+
.scx-panel-t_left-bottom-leave-active,
|
16
|
+
.scx-panel-t_left-top-enter-active,
|
17
|
+
.scx-panel-t_left-top-leave-active,
|
18
|
+
.scx-panel-t_top-enter-active,
|
19
|
+
.scx-panel-t_top-leave-active {
|
20
|
+
opacity: 1;
|
21
|
+
transition: transform 200ms cubic-bezier(.23, 1, .32, 1), opacity 100ms cubic-bezier(.23, 1, .32, 1);
|
22
|
+
}
|
23
|
+
|
24
|
+
.scx-panel-t_left-top-enter-from,
|
25
|
+
.scx-panel-t_left-top-leave-to,
|
26
|
+
.scx-panel-t_left-bottom-enter-from,
|
27
|
+
.scx-panel-t_left-bottom-leave-to,
|
28
|
+
.scx-panel-t_top-enter-from,
|
29
|
+
.scx-panel-t_top-leave-to {
|
30
|
+
opacity: 0;
|
31
|
+
transform: scale(0.95);
|
32
|
+
}
|
33
|
+
|
34
|
+
.scx-panel-t_left-bottom-enter-active,
|
35
|
+
.scx-panel-t_left-bottom-leave-active {
|
36
|
+
transform-origin: left bottom;
|
37
|
+
}
|
38
|
+
|
39
|
+
.scx-panel-t_left-top-enter-active,
|
40
|
+
.scx-panel-t_left-top-leave-active {
|
41
|
+
transform-origin: left top;
|
42
|
+
}
|
43
|
+
|
44
|
+
.scx-panel-t_top-enter-active,
|
45
|
+
.scx-panel-t_top-leave-active {
|
46
|
+
transform-origin: top;
|
47
|
+
}
|
package/scx-panel/index.vue
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
<template>
|
2
|
-
<transition :name="'scx-panel-t_'+transitionType">
|
3
|
-
<div v-show="modelValue" class="scx-panel">
|
4
|
-
<slot/>
|
5
|
-
</div>
|
6
|
-
</transition>
|
7
|
-
</template>
|
8
|
-
|
9
|
-
<script>
|
10
|
-
import "./index.css";
|
11
|
-
|
12
|
-
export default {
|
13
|
-
name: "scx-panel",
|
14
|
-
props: {
|
15
|
-
modelValue: {
|
16
|
-
type: Boolean,
|
17
|
-
default: false
|
18
|
-
},
|
19
|
-
transitionType: {
|
20
|
-
type: String,
|
21
|
-
default: "left-top"
|
22
|
-
}
|
23
|
-
},
|
24
|
-
setup(props, context) {
|
25
|
-
|
26
|
-
}
|
27
|
-
};
|
28
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<transition :name="'scx-panel-t_'+transitionType">
|
3
|
+
<div v-show="modelValue" class="scx-panel">
|
4
|
+
<slot/>
|
5
|
+
</div>
|
6
|
+
</transition>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
<script>
|
10
|
+
import "./index.css";
|
11
|
+
|
12
|
+
export default {
|
13
|
+
name: "scx-panel",
|
14
|
+
props: {
|
15
|
+
modelValue: {
|
16
|
+
type: Boolean,
|
17
|
+
default: false
|
18
|
+
},
|
19
|
+
transitionType: {
|
20
|
+
type: String,
|
21
|
+
default: "left-top"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
setup(props, context) {
|
25
|
+
|
26
|
+
}
|
27
|
+
};
|
28
|
+
</script>
|
@@ -1,36 +1,36 @@
|
|
1
|
-
.scx-panel-item {
|
2
|
-
flex-shrink: 0;
|
3
|
-
height: 40px;
|
4
|
-
display: flex;
|
5
|
-
border-radius: 2px;
|
6
|
-
align-items: center;
|
7
|
-
cursor: pointer;
|
8
|
-
border: 2px solid var(--scx-panel-item_border-color);
|
9
|
-
box-sizing: border-box;
|
10
|
-
padding-left: 5px;
|
11
|
-
padding-right: 5px;
|
12
|
-
transition: all ease 100ms;
|
13
|
-
background: var(--scx-panel-item_bg);
|
14
|
-
}
|
15
|
-
|
16
|
-
.scx-panel-item:hover,
|
17
|
-
.scx-panel-item.active {
|
18
|
-
background: var(--scx-panel-item_hover-bg);
|
19
|
-
border: 2px solid var(--scx-panel-item_hover-border-color);
|
20
|
-
color: var(--scx-panel-item_hover-color);
|
21
|
-
}
|
22
|
-
|
23
|
-
.scx-panel-item > svg {
|
24
|
-
flex-shrink: 0;
|
25
|
-
margin-left: 10px;
|
26
|
-
margin-right: 10px;
|
27
|
-
fill: currentColor;
|
28
|
-
}
|
29
|
-
|
30
|
-
.scx-panel-item > span {
|
31
|
-
font-weight: 600;
|
32
|
-
padding-right: 5px;
|
33
|
-
white-space: nowrap;
|
34
|
-
overflow: hidden;
|
35
|
-
text-overflow: ellipsis;
|
36
|
-
}
|
1
|
+
.scx-panel-item {
|
2
|
+
flex-shrink: 0;
|
3
|
+
height: 40px;
|
4
|
+
display: flex;
|
5
|
+
border-radius: 2px;
|
6
|
+
align-items: center;
|
7
|
+
cursor: pointer;
|
8
|
+
border: 2px solid var(--scx-panel-item_border-color);
|
9
|
+
box-sizing: border-box;
|
10
|
+
padding-left: 5px;
|
11
|
+
padding-right: 5px;
|
12
|
+
transition: all ease 100ms;
|
13
|
+
background: var(--scx-panel-item_bg);
|
14
|
+
}
|
15
|
+
|
16
|
+
.scx-panel-item:hover,
|
17
|
+
.scx-panel-item.active {
|
18
|
+
background: var(--scx-panel-item_hover-bg);
|
19
|
+
border: 2px solid var(--scx-panel-item_hover-border-color);
|
20
|
+
color: var(--scx-panel-item_hover-color);
|
21
|
+
}
|
22
|
+
|
23
|
+
.scx-panel-item > svg {
|
24
|
+
flex-shrink: 0;
|
25
|
+
margin-left: 10px;
|
26
|
+
margin-right: 10px;
|
27
|
+
fill: currentColor;
|
28
|
+
}
|
29
|
+
|
30
|
+
.scx-panel-item > span {
|
31
|
+
font-weight: 600;
|
32
|
+
padding-right: 5px;
|
33
|
+
white-space: nowrap;
|
34
|
+
overflow: hidden;
|
35
|
+
text-overflow: ellipsis;
|
36
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
<template>
|
2
|
-
<div :class="{active}" class="scx-panel-item">
|
3
|
-
<slot/>
|
4
|
-
</div>
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
import "./scx-panel-item.css";
|
9
|
-
|
10
|
-
export default {
|
11
|
-
name: "scx-panel-item",
|
12
|
-
props: {
|
13
|
-
active: {
|
14
|
-
type: Boolean,
|
15
|
-
default: false
|
16
|
-
}
|
17
|
-
},
|
18
|
-
setup() {
|
19
|
-
|
20
|
-
}
|
21
|
-
};
|
22
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<div :class="{active}" class="scx-panel-item">
|
3
|
+
<slot/>
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import "./scx-panel-item.css";
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: "scx-panel-item",
|
12
|
+
props: {
|
13
|
+
active: {
|
14
|
+
type: Boolean,
|
15
|
+
default: false
|
16
|
+
}
|
17
|
+
},
|
18
|
+
setup() {
|
19
|
+
|
20
|
+
}
|
21
|
+
};
|
22
|
+
</script>
|
package/scx-progress/index.css
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
.scx-progress {
|
2
|
-
display: flex;
|
3
|
-
height: 1rem;
|
4
|
-
overflow: hidden;
|
5
|
-
font-size: .75rem;
|
6
|
-
background-color: #c0c0c0;
|
7
|
-
border-radius: .25rem;
|
8
|
-
}
|
9
|
-
|
10
|
-
.scx-progress-bar {
|
11
|
-
display: flex;
|
12
|
-
flex-direction: column;
|
13
|
-
justify-content: center;
|
14
|
-
color: #fff;
|
15
|
-
text-align: right;
|
16
|
-
white-space: nowrap;
|
17
|
-
background-color: #0d6efd;
|
18
|
-
transition: width .6s ease;
|
19
|
-
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
20
|
-
background-size: 1rem 1rem;
|
21
|
-
animation: 1s linear infinite scx-progress-bar-stripes;
|
22
|
-
}
|
23
|
-
|
24
|
-
.scx-progress-bar-text {
|
25
|
-
font-weight: 600;
|
26
|
-
margin: 0 5px;
|
27
|
-
}
|
28
|
-
|
29
|
-
@keyframes scx-progress-bar-stripes {
|
30
|
-
0% {
|
31
|
-
background-position-x: 1rem;
|
32
|
-
}
|
33
|
-
}
|
1
|
+
.scx-progress {
|
2
|
+
display: flex;
|
3
|
+
height: 1rem;
|
4
|
+
overflow: hidden;
|
5
|
+
font-size: .75rem;
|
6
|
+
background-color: #c0c0c0;
|
7
|
+
border-radius: .25rem;
|
8
|
+
}
|
9
|
+
|
10
|
+
.scx-progress-bar {
|
11
|
+
display: flex;
|
12
|
+
flex-direction: column;
|
13
|
+
justify-content: center;
|
14
|
+
color: #fff;
|
15
|
+
text-align: right;
|
16
|
+
white-space: nowrap;
|
17
|
+
background-color: #0d6efd;
|
18
|
+
transition: width .6s ease;
|
19
|
+
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
20
|
+
background-size: 1rem 1rem;
|
21
|
+
animation: 1s linear infinite scx-progress-bar-stripes;
|
22
|
+
}
|
23
|
+
|
24
|
+
.scx-progress-bar-text {
|
25
|
+
font-weight: 600;
|
26
|
+
margin: 0 5px;
|
27
|
+
}
|
28
|
+
|
29
|
+
@keyframes scx-progress-bar-stripes {
|
30
|
+
0% {
|
31
|
+
background-position-x: 1rem;
|
32
|
+
}
|
33
|
+
}
|
package/scx-progress/index.vue
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="scx-progress">
|
3
|
-
<div :style="{width: modelValue+'%',backgroundColor:color}" class="scx-progress-bar">
|
4
|
-
<div class="scx-progress-bar-text">{{ modelValue }} %</div>
|
5
|
-
</div>
|
6
|
-
</div>
|
7
|
-
</template>
|
8
|
-
|
9
|
-
<script>
|
10
|
-
import "./index.css";
|
11
|
-
|
12
|
-
export default {
|
13
|
-
name: "scx-progress",
|
14
|
-
props: {
|
15
|
-
modelValue: {
|
16
|
-
type: Number,
|
17
|
-
default: 0
|
18
|
-
},
|
19
|
-
color: {
|
20
|
-
type: String,
|
21
|
-
default: ""
|
22
|
-
}
|
23
|
-
}
|
24
|
-
};
|
25
|
-
</script>
|
26
|
-
|
27
|
-
<style scoped>
|
28
|
-
|
29
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div class="scx-progress">
|
3
|
+
<div :style="{width: modelValue+'%',backgroundColor:color}" class="scx-progress-bar">
|
4
|
+
<div class="scx-progress-bar-text">{{ modelValue }} %</div>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
<script>
|
10
|
+
import "./index.css";
|
11
|
+
|
12
|
+
export default {
|
13
|
+
name: "scx-progress",
|
14
|
+
props: {
|
15
|
+
modelValue: {
|
16
|
+
type: Number,
|
17
|
+
default: 0
|
18
|
+
},
|
19
|
+
color: {
|
20
|
+
type: String,
|
21
|
+
default: ""
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
</script>
|
26
|
+
|
27
|
+
<style scoped>
|
28
|
+
|
29
|
+
</style>
|
package/scx-switch/index.css
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
-
.scx-switch + .scx-switch {
|
2
|
-
margin: 2px;
|
3
|
-
}
|
4
|
-
|
5
|
-
.scx-switch {
|
6
|
-
height: 22px;
|
7
|
-
width: 44px;
|
8
|
-
border: none;
|
9
|
-
background: rgba(0, 0, 0, .25);
|
10
|
-
border-radius: 11px;
|
11
|
-
position: relative;
|
12
|
-
vertical-align: middle;
|
13
|
-
transition: background-color 150ms, box-shadow 150ms;
|
14
|
-
cursor: pointer;
|
15
|
-
padding: 0;
|
16
|
-
}
|
17
|
-
|
18
|
-
.scx-switch:hover {
|
19
|
-
box-shadow: 0 0 0 0.1rem var(--scx-text-placeholder-color);
|
20
|
-
}
|
21
|
-
|
22
|
-
.scx-switch > .scx-switch-icon {
|
23
|
-
box-shadow: rgba(0, 35, 11, 0.2) 0 2px 4px 0;
|
24
|
-
position: absolute;
|
25
|
-
top: 2px;
|
26
|
-
left: 2px;
|
27
|
-
height: 18px;
|
28
|
-
width: 18px;
|
29
|
-
background: white;
|
30
|
-
border-radius: 9px;
|
31
|
-
transition: left 150ms ease-in-out, width 200ms ease-in-out, margin-left 200ms ease-in-out;
|
32
|
-
display: flex;
|
33
|
-
justify-content: center;
|
34
|
-
align-items: center;
|
35
|
-
z-index: 1;
|
36
|
-
}
|
37
|
-
|
38
|
-
.scx-switch.scx-switch-checked {
|
39
|
-
background: var(--scx-theme);
|
40
|
-
}
|
41
|
-
|
42
|
-
.scx-switch.scx-switch-checked > .scx-switch-icon {
|
43
|
-
left: calc(100% - 18px - 2px);
|
44
|
-
}
|
45
|
-
|
46
|
-
.scx-switch.scx-switch-checked:active > .scx-switch-icon {
|
47
|
-
width: 22px;
|
48
|
-
margin-left: -4px;
|
49
|
-
}
|
50
|
-
|
51
|
-
.scx-switch:active > .scx-switch-icon {
|
52
|
-
width: 22px;
|
53
|
-
margin-left: 0;
|
54
|
-
}
|
55
|
-
|
56
|
-
.scx-switch > .scx-switch-label {
|
57
|
-
position: absolute;
|
58
|
-
top: 2px;
|
59
|
-
display: flex;
|
60
|
-
align-items: center;
|
61
|
-
right: 8px;
|
62
|
-
}
|
63
|
-
|
64
|
-
.scx-switch.scx-switch-checked > .scx-switch-label {
|
65
|
-
left: 8px;
|
66
|
-
}
|
67
|
-
|
68
|
-
.scx-switch:focus {
|
69
|
-
outline: none;
|
70
|
-
}
|
71
|
-
|
72
|
-
.scx-switch[disabled] {
|
73
|
-
cursor: not-allowed;
|
74
|
-
opacity: 0.4;
|
75
|
-
}
|
76
|
-
|
77
|
-
.scx-switch.scx-switch-checked:active {
|
78
|
-
animation: scx-switch-close-tips 1500ms infinite linear;
|
79
|
-
}
|
80
|
-
|
81
|
-
.scx-switch:active {
|
82
|
-
animation: scx-switch-open-tips 1500ms infinite linear;
|
83
|
-
}
|
84
|
-
|
85
|
-
@keyframes scx-switch-close-tips {
|
86
|
-
0% {
|
87
|
-
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
88
|
-
}
|
89
|
-
50% {
|
90
|
-
|
91
|
-
box-shadow: 0 0 0 0.2rem rgba(255, 38, 103, 0.5)
|
92
|
-
}
|
93
|
-
100% {
|
94
|
-
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
@keyframes scx-switch-open-tips {
|
99
|
-
0% {
|
100
|
-
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
101
|
-
}
|
102
|
-
50% {
|
103
|
-
|
104
|
-
box-shadow: 0 0 0 0.2rem rgba(17, 141, 47, 0.5);
|
105
|
-
}
|
106
|
-
100% {
|
107
|
-
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
108
|
-
}
|
109
|
-
}
|
1
|
+
.scx-switch + .scx-switch {
|
2
|
+
margin: 2px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.scx-switch {
|
6
|
+
height: 22px;
|
7
|
+
width: 44px;
|
8
|
+
border: none;
|
9
|
+
background: rgba(0, 0, 0, .25);
|
10
|
+
border-radius: 11px;
|
11
|
+
position: relative;
|
12
|
+
vertical-align: middle;
|
13
|
+
transition: background-color 150ms, box-shadow 150ms;
|
14
|
+
cursor: pointer;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
.scx-switch:hover {
|
19
|
+
box-shadow: 0 0 0 0.1rem var(--scx-text-placeholder-color);
|
20
|
+
}
|
21
|
+
|
22
|
+
.scx-switch > .scx-switch-icon {
|
23
|
+
box-shadow: rgba(0, 35, 11, 0.2) 0 2px 4px 0;
|
24
|
+
position: absolute;
|
25
|
+
top: 2px;
|
26
|
+
left: 2px;
|
27
|
+
height: 18px;
|
28
|
+
width: 18px;
|
29
|
+
background: white;
|
30
|
+
border-radius: 9px;
|
31
|
+
transition: left 150ms ease-in-out, width 200ms ease-in-out, margin-left 200ms ease-in-out;
|
32
|
+
display: flex;
|
33
|
+
justify-content: center;
|
34
|
+
align-items: center;
|
35
|
+
z-index: 1;
|
36
|
+
}
|
37
|
+
|
38
|
+
.scx-switch.scx-switch-checked {
|
39
|
+
background: var(--scx-theme);
|
40
|
+
}
|
41
|
+
|
42
|
+
.scx-switch.scx-switch-checked > .scx-switch-icon {
|
43
|
+
left: calc(100% - 18px - 2px);
|
44
|
+
}
|
45
|
+
|
46
|
+
.scx-switch.scx-switch-checked:active > .scx-switch-icon {
|
47
|
+
width: 22px;
|
48
|
+
margin-left: -4px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.scx-switch:active > .scx-switch-icon {
|
52
|
+
width: 22px;
|
53
|
+
margin-left: 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
.scx-switch > .scx-switch-label {
|
57
|
+
position: absolute;
|
58
|
+
top: 2px;
|
59
|
+
display: flex;
|
60
|
+
align-items: center;
|
61
|
+
right: 8px;
|
62
|
+
}
|
63
|
+
|
64
|
+
.scx-switch.scx-switch-checked > .scx-switch-label {
|
65
|
+
left: 8px;
|
66
|
+
}
|
67
|
+
|
68
|
+
.scx-switch:focus {
|
69
|
+
outline: none;
|
70
|
+
}
|
71
|
+
|
72
|
+
.scx-switch[disabled] {
|
73
|
+
cursor: not-allowed;
|
74
|
+
opacity: 0.4;
|
75
|
+
}
|
76
|
+
|
77
|
+
.scx-switch.scx-switch-checked:active {
|
78
|
+
animation: scx-switch-close-tips 1500ms infinite linear;
|
79
|
+
}
|
80
|
+
|
81
|
+
.scx-switch:active {
|
82
|
+
animation: scx-switch-open-tips 1500ms infinite linear;
|
83
|
+
}
|
84
|
+
|
85
|
+
@keyframes scx-switch-close-tips {
|
86
|
+
0% {
|
87
|
+
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
88
|
+
}
|
89
|
+
50% {
|
90
|
+
|
91
|
+
box-shadow: 0 0 0 0.2rem rgba(255, 38, 103, 0.5)
|
92
|
+
}
|
93
|
+
100% {
|
94
|
+
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
@keyframes scx-switch-open-tips {
|
99
|
+
0% {
|
100
|
+
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
101
|
+
}
|
102
|
+
50% {
|
103
|
+
|
104
|
+
box-shadow: 0 0 0 0.2rem rgba(17, 141, 47, 0.5);
|
105
|
+
}
|
106
|
+
100% {
|
107
|
+
box-shadow: 0 0 0 0.1rem rgba(99, 172, 255, 0.5);
|
108
|
+
}
|
109
|
+
}
|
package/scx-switch/index.vue
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
<template>
|
2
|
-
<button :class="{'scx-switch-checked': modelValue}" class="scx-switch" type="button" @click="changeSwitchState">
|
3
|
-
<span class="scx-switch-icon">
|
4
|
-
<slot name="icon"/>
|
5
|
-
</span>
|
6
|
-
<span class="scx-switch-label">
|
7
|
-
<slot name="label"/>
|
8
|
-
</span>
|
9
|
-
</button>
|
10
|
-
</template>
|
11
|
-
<script>
|
12
|
-
import "./index.css";
|
13
|
-
|
14
|
-
export default {
|
15
|
-
name: "scx-switch",
|
16
|
-
props: {
|
17
|
-
modelValue: Boolean,
|
18
|
-
default: false
|
19
|
-
},
|
20
|
-
emits: ["update:modelValue", "change"],
|
21
|
-
setup(props, context) {
|
22
|
-
function changeSwitchState() {
|
23
|
-
const val = !props.modelValue;
|
24
|
-
context.emit("update:modelValue", val);
|
25
|
-
context.emit("change", val);
|
26
|
-
}
|
27
|
-
|
28
|
-
return {changeSwitchState};
|
29
|
-
}
|
30
|
-
};
|
31
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<button :class="{'scx-switch-checked': modelValue}" class="scx-switch" type="button" @click="changeSwitchState">
|
3
|
+
<span class="scx-switch-icon">
|
4
|
+
<slot name="icon"/>
|
5
|
+
</span>
|
6
|
+
<span class="scx-switch-label">
|
7
|
+
<slot name="label"/>
|
8
|
+
</span>
|
9
|
+
</button>
|
10
|
+
</template>
|
11
|
+
<script>
|
12
|
+
import "./index.css";
|
13
|
+
|
14
|
+
export default {
|
15
|
+
name: "scx-switch",
|
16
|
+
props: {
|
17
|
+
modelValue: Boolean,
|
18
|
+
default: false
|
19
|
+
},
|
20
|
+
emits: ["update:modelValue", "change"],
|
21
|
+
setup(props, context) {
|
22
|
+
function changeSwitchState() {
|
23
|
+
const val = !props.modelValue;
|
24
|
+
context.emit("update:modelValue", val);
|
25
|
+
context.emit("change", val);
|
26
|
+
}
|
27
|
+
|
28
|
+
return {changeSwitchState};
|
29
|
+
}
|
30
|
+
};
|
31
|
+
</script>
|