ywana-core8 0.0.900 → 0.0.902
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/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +94 -67
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +43 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +43 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/css/theme_light.css +1 -0
- package/src/html/button.css +98 -71
- package/src/html/button.js +76 -4
- package/src/html/index.js +1 -1
package/package.json
CHANGED
package/src/css/theme_light.css
CHANGED
package/src/html/button.css
CHANGED
@@ -1,79 +1,106 @@
|
|
1
1
|
.btn {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
.btn.outlined {
|
17
|
-
color: var(--primary-color);
|
18
|
-
border: solid 1px var(--primary-color);
|
19
|
-
}
|
20
|
-
|
21
|
-
.btn.outlined.disabled {
|
22
|
-
border: solid 1px rgba(200,200,200,.3) !important;
|
23
|
-
color: rgba(100,100,100,.5) !important;
|
24
|
-
cursor: not-allowed;
|
25
|
-
}
|
2
|
+
position: relative;
|
3
|
+
padding: .2rem .5rem;
|
4
|
+
display: flex;
|
5
|
+
align-items: center;
|
6
|
+
overflow: hidden;
|
7
|
+
border-width: 0;
|
8
|
+
outline: none;
|
9
|
+
transition: background-color .3s;
|
10
|
+
display: flex;
|
11
|
+
color: var(--primary-color);
|
12
|
+
background-color: var(--paper-color);
|
13
|
+
min-height: 2.5rem;
|
14
|
+
}
|
26
15
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
.btn.outlined {
|
17
|
+
color: var(--primary-color);
|
18
|
+
border: solid 1px var(--primary-color);
|
19
|
+
}
|
31
20
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
.btn:hover, .btn:focus {
|
39
|
-
background-color: rgba(171, 171, 171, 0.3);
|
40
|
-
cursor: pointer;
|
41
|
-
}
|
21
|
+
.btn.outlined.disabled {
|
22
|
+
border: solid 1px rgba(200, 200, 200, .3) !important;
|
23
|
+
color: rgba(100, 100, 100, .5) !important;
|
24
|
+
cursor: not-allowed;
|
25
|
+
}
|
42
26
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
27
|
+
.btn.raised {
|
28
|
+
color: var(--primary-color-text);
|
29
|
+
background-color: var(--primary-color)
|
30
|
+
}
|
31
|
+
|
32
|
+
.btn.raised.disabled {
|
33
|
+
background-color: rgba(200, 200, 200, .3) !important;
|
34
|
+
color: rgba(100, 100, 100, .5) !important;
|
35
|
+
cursor: not-allowed;
|
36
|
+
}
|
37
|
+
|
38
|
+
.btn:hover,
|
39
|
+
.btn:focus {
|
40
|
+
background-color: rgba(171, 171, 171, 0.3);
|
41
|
+
cursor: pointer;
|
42
|
+
}
|
43
|
+
|
44
|
+
.btn.raised:hover,
|
45
|
+
.btn.raised:focus {
|
46
|
+
background-color: var(--primary-color-dark);
|
47
|
+
cursor: pointer;
|
48
|
+
}
|
49
|
+
|
50
|
+
.btn>* {
|
51
|
+
position: relative;
|
52
|
+
}
|
53
|
+
|
54
|
+
.btn span {
|
55
|
+
flex: 1;
|
56
|
+
display: block;
|
57
|
+
}
|
58
|
+
|
59
|
+
.btn:before {
|
60
|
+
content: "";
|
61
|
+
position: absolute;
|
62
|
+
top: 50%;
|
63
|
+
left: 50%;
|
64
|
+
display: block;
|
65
|
+
width: 0;
|
66
|
+
padding-top: 0;
|
67
|
+
border-radius: 100%;
|
68
|
+
background-color: rgba(236, 240, 241, .3);
|
69
|
+
-webkit-transform: translate(-50%, -50%);
|
70
|
+
-moz-transform: translate(-50%, -50%);
|
71
|
+
-ms-transform: translate(-50%, -50%);
|
72
|
+
-o-transform: translate(-50%, -50%);
|
73
|
+
transform: translate(-50%, -50%);
|
74
|
+
}
|
75
|
+
|
76
|
+
.btn:active:before {
|
77
|
+
width: 120%;
|
78
|
+
padding-top: 120%;
|
79
|
+
transition: width .2s ease-out, padding-top .2s ease-out;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
@keyframes rotation {
|
84
|
+
0% {
|
85
|
+
transform: rotate(0deg);
|
86
|
+
font-size: 1.3rem;
|
50
87
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
display: block;
|
88
|
+
|
89
|
+
50% {
|
90
|
+
font-size: 1.8rem;
|
55
91
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
top: 50%;
|
61
|
-
left: 50%;
|
62
|
-
display: block;
|
63
|
-
width: 0;
|
64
|
-
padding-top: 0;
|
65
|
-
border-radius: 100%;
|
66
|
-
background-color: rgba(236, 240, 241, .3);
|
67
|
-
-webkit-transform: translate(-50%, -50%);
|
68
|
-
-moz-transform: translate(-50%, -50%);
|
69
|
-
-ms-transform: translate(-50%, -50%);
|
70
|
-
-o-transform: translate(-50%, -50%);
|
71
|
-
transform: translate(-50%, -50%);
|
92
|
+
|
93
|
+
100% {
|
94
|
+
transform: rotate(359deg);
|
95
|
+
font-size: 1.3rem;
|
72
96
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
97
|
+
}
|
98
|
+
|
99
|
+
.action-btn {
|
100
|
+
&.running {
|
101
|
+
.icon {
|
102
|
+
font-weight: 600;
|
103
|
+
animation: rotation 2s linear infinite;
|
104
|
+
}
|
78
105
|
}
|
79
|
-
|
106
|
+
}
|
package/src/html/button.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React, { useEffect, useState } from 'react'
|
2
2
|
import { Icon } from './icon'
|
3
3
|
import { Text } from './text'
|
4
4
|
import './button.css'
|
@@ -6,7 +6,7 @@ import './button.css'
|
|
6
6
|
/**
|
7
7
|
* HTML Button
|
8
8
|
*/
|
9
|
-
export const Button = ({ label, icon, action, disabled = false, outlined, raised, className }) => {
|
9
|
+
export const Button = ({ label, icon, action, disabled = false, outlined, raised, className, progress = 0 }) => {
|
10
10
|
|
11
11
|
function click(event) {
|
12
12
|
if (!disabled) {
|
@@ -20,8 +20,80 @@ export const Button = ({ label, icon, action, disabled = false, outlined, raised
|
|
20
20
|
if (disabled) style = `${style} disabled`
|
21
21
|
return (
|
22
22
|
<button className={`btn ${style} ${className}`} onClick={click}>
|
23
|
-
{
|
24
|
-
<Text>{
|
23
|
+
{icon ? <Icon icon={icon} size="small" clickable action={click} /> : null}
|
24
|
+
<Text>{label}</Text>
|
25
25
|
</button>
|
26
26
|
)
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Action Button
|
31
|
+
*/
|
32
|
+
export const ActionButton = (props) => {
|
33
|
+
|
34
|
+
const { states, state, className } = props
|
35
|
+
|
36
|
+
const [_state, setState] = useState()
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
setState(state)
|
40
|
+
}, [state])
|
41
|
+
|
42
|
+
useEffect(() => {
|
43
|
+
if (states[_state] && states[_state].autoexec) execute()
|
44
|
+
}, [_state])
|
45
|
+
|
46
|
+
async function execute() {
|
47
|
+
if (states[_state]) {
|
48
|
+
const newState = await states[_state].action()
|
49
|
+
if (newState) setState(newState)
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
if (!_state) return null
|
54
|
+
const { icon, label } = states[_state]
|
55
|
+
|
56
|
+
return (
|
57
|
+
<Button {...props} icon={icon} label={label} action={execute} className={`${className} action-btn ${_state}`} />
|
58
|
+
)
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
const ActionButtonTest = (props) => {
|
63
|
+
|
64
|
+
const states = {
|
65
|
+
normal: {
|
66
|
+
icon: "add",
|
67
|
+
label: "Create Job",
|
68
|
+
action: () => {
|
69
|
+
return "running"
|
70
|
+
},
|
71
|
+
},
|
72
|
+
running: {
|
73
|
+
icon: "rotate_right",
|
74
|
+
label: "Creating Job",
|
75
|
+
autoexec: true,
|
76
|
+
action: () => {
|
77
|
+
console.log("Creating Job")
|
78
|
+
return new Promise((resolve, reject) => {
|
79
|
+
setTimeout(() => {
|
80
|
+
resolve("success")
|
81
|
+
}, 5000)
|
82
|
+
})
|
83
|
+
},
|
84
|
+
},
|
85
|
+
success: {
|
86
|
+
icon: "task_alt",
|
87
|
+
label: "Job Created"
|
88
|
+
|
89
|
+
},
|
90
|
+
error: {
|
91
|
+
icon: "error",
|
92
|
+
label: "Error"
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
return (
|
97
|
+
<ActionButton states={states} state="normal" raised/>
|
98
|
+
)
|
27
99
|
}
|
package/src/html/index.js
CHANGED