ywana-core8 0.0.899 → 0.0.901

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": "ywana-core8",
3
- "version": "0.0.899",
3
+ "version": "0.0.901",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -84,4 +84,5 @@
84
84
  --shadow-top: 0px -3px 5px 0px rgba(150, 150, 150, 0.3);
85
85
 
86
86
  --curtains-closed-width: 4rem;
87
+
87
88
  }
@@ -1,79 +1,106 @@
1
1
  .btn {
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
- }
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
- .btn.raised {
28
- color: var(--primary-color-text);
29
- background-color: var(--primary-color)
30
- }
16
+ .btn.outlined {
17
+ color: var(--primary-color);
18
+ border: solid 1px var(--primary-color);
19
+ }
31
20
 
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, .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
- .btn.raised:hover, .btn.raised:focus {
44
- background-color: var(--primary-color-dark);
45
- cursor: pointer;
46
- }
47
-
48
- .btn > * {
49
- position: relative;
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
- .btn span {
53
- flex: 1;
54
- display: block;
88
+
89
+ 50% {
90
+ font-size: 1.8rem;
55
91
  }
56
-
57
- .btn:before {
58
- content: "";
59
- position: absolute;
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
- .btn:active:before {
75
- width: 120%;
76
- padding-top: 120%;
77
- transition: width .2s ease-out, padding-top .2s ease-out;
97
+ }
98
+
99
+ .action-btn {
100
+ &.running {
101
+ .icon {
102
+ font-weight: 600;
103
+ animation: rotation 2s linear infinite;
104
+ }
78
105
  }
79
-
106
+ }
@@ -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,52 @@ 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
- { icon ? <Icon icon={icon} size="small" clickable action={click} /> : null }
24
- <Text>{ label }</Text>
23
+ {icon ? <Icon icon={icon} size="small" clickable action={click} /> : null}
24
+ <Text>{label}</Text>
25
25
  </button>
26
26
  )
27
+ }
28
+
29
+ export const ActionButton = (props) => {
30
+
31
+ const { icon, state = "normal", action, className } = props
32
+ const [_state, setState] = useState("normal")
33
+
34
+ useEffect(() => {
35
+ setState(state)
36
+ }, [state])
37
+
38
+ function activate() {
39
+ setState("running")
40
+ if (action) action()
41
+ }
42
+
43
+ let actionIcon = icon
44
+
45
+ switch(_state) {
46
+ case "normal":
47
+ actionIcon = icon
48
+ break
49
+ case "running":
50
+ actionIcon = "rotate_right"
51
+ break
52
+ case "success":
53
+ actionIcon = "task_alt"
54
+ break
55
+ case "error":
56
+ actionIcon = "error"
57
+ break
58
+ }
59
+
60
+ return (
61
+ <Button {...props} icon={actionIcon} action={activate} className={`${className} action-btn ${_state}`} />
62
+ )
63
+
64
+ }
65
+
66
+ const ProgressButtonTest = (props) => {
67
+
68
+ return (
69
+ <ActionButton label="Test1" icon="add" action={() => console.log("test")} state="success" raised/>
70
+ )
27
71
  }
package/src/html/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Accordion } from './accordion'
2
- export { Button } from './button'
2
+ export { Button, ActionButton } from './button'
3
3
  export { CheckBox } from './checkbox'
4
4
  export { Chips, Chip } from './chip'
5
5
  export { Form } from './form'
package/src/html/menu.js CHANGED
@@ -54,7 +54,7 @@ export const MenuIcon = (props) => {
54
54
  */
55
55
  export const MenuItem = (props) => {
56
56
 
57
- const { id, icon, label, meta, disabled=false, onSelect } = props
57
+ const { id, icon, label, meta, disabled=false, size="normal", onSelect } = props
58
58
  const [open, setOpen] = useContext(MenuContext)
59
59
 
60
60
  function select() {
@@ -69,7 +69,7 @@ export const MenuItem = (props) => {
69
69
 
70
70
  return (
71
71
  <li className={`menu-item ${style}`} onClick={select}>
72
- {icon ? <Icon icon={icon} /> : null}
72
+ {icon ? <Icon icon={icon} size={size} /> : null}
73
73
  <label>{labelTxt}</label>
74
74
  {meta ? <div className="meta">{meta}</div> : null}
75
75
  </li>