ywana-core8 0.0.350 → 0.0.353

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.350",
3
+ "version": "0.0.353",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "react-dom": "^17.0.2"
30
30
  },
31
31
  "dependencies": {
32
+ "crypto-js": "^4.1.1",
32
33
  "deep-equal": "^2.0.5",
33
34
  "material-design-icons-iconfont": "^6.1.1",
34
35
  "moment": "^2.29.1",
package/src/html/menu.css CHANGED
@@ -1,9 +1,9 @@
1
1
  .menu-icon {
2
- position: relative;
3
- width: 3rem;
2
+ position: relative;
3
+ width: 3rem;
4
4
  }
5
5
 
6
- .menu-icon>.overlay {
6
+ .menu-icon > .overlay {
7
7
  position: fixed;
8
8
  top: 0px;
9
9
  left: 0px;
@@ -13,70 +13,78 @@
13
13
  background-color: transparent;
14
14
  }
15
15
 
16
- .menu-icon>menu {
17
- z-index: 6;
18
- position: absolute;
19
- top: 3rem;
20
- left: 0px;
21
- margin: 0;
22
- border: solid 1px var(--divider-color);
23
- background-color: var(--paper-color);
24
- padding: 0;
25
- min-width: 7rem;
26
- max-width: 14rem;
27
- max-height: 50vh;
28
- overflow: auto;
29
- box-shadow: var(--shadow1);
16
+ .menu-icon > menu {
17
+ z-index: 6;
18
+ position: absolute;
19
+ top: 3rem;
20
+ left: 0px;
21
+ margin: 0;
22
+ border: solid 1px var(--divider-color);
23
+ background-color: var(--paper-color);
24
+ padding: 0;
25
+ min-width: 7rem;
26
+ max-width: 14rem;
27
+ max-height: 50vh;
28
+ overflow: auto;
29
+ box-shadow: var(--shadow1);
30
30
  }
31
31
 
32
- .menu-icon>menu.alignRight {
33
- left:unset;
34
- right: 0px;
35
- }
32
+ .menu-icon > menu.alignRight {
33
+ left: unset;
34
+ right: 0px;
35
+ }
36
36
 
37
- .menu-icon>menu ul {
38
- list-style: none;
39
- margin: 0;
40
- padding: .5rem 0;
41
- cursor: pointer;
42
- }
43
-
44
- .menu-icon>menu li {
45
- min-height: 3rem;
46
- padding: 0 .5rem;
47
-
48
- display: flex;
49
- align-items: center;
50
- }
51
-
52
- .menu-icon>menu li:hover {
53
- background-color: var(--primary-color-lighter);
54
- }
37
+ .menu-icon > menu ul {
38
+ list-style: none;
39
+ margin: 0;
40
+ padding: 0.5rem 0;
41
+ cursor: pointer;
42
+ }
55
43
 
56
- .menu-item {
57
- flex: 1;
58
- display: flex;
59
- align-items: center;
60
- }
44
+ .menu-icon > menu li {
45
+ min-height: 3rem;
46
+ padding: 0 0.5rem;
47
+ display: flex;
48
+ align-items: center;
49
+ }
61
50
 
62
- .menu-item>.icon {
63
- color: var(--text-color-light)
64
- }
51
+ .menu-icon > menu li:hover {
52
+ background-color: var(--primary-color-lighter);
53
+ }
65
54
 
66
- .menu-item>label {
67
- flex: 1;
68
- white-space: nowrap;
69
- padding: 0 .5rem 0 0;
70
- color: var(--text-color);
71
- font-size: .9rem;
72
- }
55
+ .menu-item {
56
+ flex: 1;
57
+ display: flex;
58
+ align-items: center;
59
+ cursor: pointer;
60
+ }
73
61
 
74
- .menu-item>.meta {
75
- color: var(--text-color-lighter)
62
+ .menu-item > .icon {
63
+ color: var(--text-color-light);
64
+ cursor: pointer;
65
+ }
66
+
67
+ .menu-item > label {
68
+ flex: 1;
69
+ white-space: nowrap;
70
+ padding: 0 0.5rem 0 0;
71
+ color: var(--text-color);
72
+ font-size: 0.9rem;
73
+ cursor: pointer;
74
+ }
75
+
76
+ .menu-item.disabled > label,
77
+ .menu-item.disabled > .icon {
78
+ color: var(--text-color-lighter);
79
+ cursor: initial;
80
+ }
81
+
82
+ .menu-item > .meta {
83
+ color: var(--text-color-lighter);
76
84
  }
77
85
 
78
86
  .menu-separator {
79
87
  min-height: 0px !important;
80
88
  height: 1px;
81
89
  border-top: solid 1px var(--divider-color);
82
- }
90
+ }
package/src/html/menu.js CHANGED
@@ -52,15 +52,19 @@ export const MenuIcon = (props) => {
52
52
  */
53
53
  export const MenuItem = (props) => {
54
54
 
55
- const { id, icon, label, meta, onSelect } = props
55
+ const { id, icon, label, meta, disabled=false, onSelect } = props
56
56
  const [open, setOpen] = useContext(MenuContext)
57
57
 
58
58
  function select() {
59
- if (onSelect) onSelect()
60
- setOpen(false)
59
+ if (!disabled) {
60
+ if (onSelect) onSelect()
61
+ setOpen(false)
62
+ }
61
63
  }
64
+
65
+ const style = disabled ? "disabled" : ""
62
66
  return (
63
- <li className="menu-item" onClick={select}>
67
+ <li className={`menu-item ${style}`} onClick={select}>
64
68
  {icon ? <Icon icon={icon} /> : null}
65
69
  <label>{label}</label>
66
70
  {meta ? <div className="meta">{meta}</div> : null}
@@ -0,0 +1,31 @@
1
+ import React, { useState } from 'react'
2
+ import { Button, TextField } from '../html'
3
+ import sha256 from 'crypto-js/sha256';
4
+ import hmacSHA512 from 'crypto-js/hmac-sha512';
5
+ import Base64 from 'crypto-js/enc-base64';
6
+
7
+ const TokenTest = (prop) => {
8
+
9
+ const [text, setText] = useState()
10
+ const [hash, setHash] = useState()
11
+ const [decripted, setDecripted] = useState()
12
+
13
+ function encryptData(data, iv, key) {
14
+
15
+ }
16
+
17
+
18
+ function decryptData(encrypted, iv, key) {
19
+
20
+ }
21
+
22
+ return (
23
+ <>
24
+ <TextField label="Text" onChange={(id, value) => setText(value)}></TextField>
25
+ <Button label="ENCRYPT" action={encryptData}></Button>
26
+ <TextField label="Encrypted" value={encripted}></TextField>
27
+ <Button label="DECRYPT" action={decryptData}></Button>
28
+ <TextField label="Decrypted" value={decripted} />
29
+ </>
30
+ )
31
+ }
@@ -14,7 +14,11 @@ export const Dialog = (props) => {
14
14
  const { icon, title = "Dialog", children, onAction, actions, className, eventPropagation = false } = props
15
15
 
16
16
  function close() {
17
- site.closeDialog()
17
+ if (className === "prompt") {
18
+ site.closePromptDialog()
19
+ } else {
20
+ site.closeDialog()
21
+ }
18
22
  }
19
23
 
20
24
  function prevent(e) {
@@ -25,7 +25,7 @@ const Page1 = (props) => {
25
25
 
26
26
  const site = useContext(SiteContext)
27
27
  useEffect(() => {
28
- site.notify({ title: "Notification 1", body: "Lorem ipsum dolor sit amet"})
28
+ site.notify({ title: "Notification 1", body: "Lorem ipsum dolor sit amet" })
29
29
  }, [])
30
30
 
31
31
  return (
@@ -41,7 +41,7 @@ const Page1 = (props) => {
41
41
  const Page2 = (props) => {
42
42
 
43
43
  const site = useContext(SiteContext)
44
-
44
+
45
45
  function prompt() {
46
46
  const actions = (
47
47
  <Fragment>
@@ -50,14 +50,13 @@ const Page2 = (props) => {
50
50
  )
51
51
  site.openPromptDialog(<Dialog className="prompt" actions={actions} >PROMPT</Dialog>)
52
52
  }
53
-
53
+
54
54
  function openDialog() {
55
-
56
- const actions = (
57
- <Fragment>
58
- <Button label="CLOSE" action={() => site.closeDialog()} />
59
- </Fragment>
60
- )
55
+ const actions = (
56
+ <Fragment>
57
+ <Button label="CLOSE" action={() => site.closeDialog()} />
58
+ </Fragment>
59
+ )
61
60
  site.openDialog(
62
61
  <Dialog actions={actions}>
63
62
  <main>