ywana-core8 0.1.80 → 0.1.82
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 +264 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +156 -48
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +264 -91
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +264 -91
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/button.js +22 -4
- package/src/html/header.js +20 -3
- package/src/html/list.css +27 -10
- package/src/html/list.example.js +336 -60
- package/src/html/list.js +56 -47
- package/src/html/table2.css +5 -5
- package/src/html/textfield.js +73 -7
- package/src/html/textfield2.css +109 -22
- package/src/html/textfield2.example.js +2 -2
- package/src/html/textfield2.js +47 -13
- package/src/html/tooltip.js +21 -3
- package/src/widgets/login/LoginBox.css +15 -11
- package/src/widgets/login/LoginBox.js +30 -7
package/src/html/tooltip.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react'
|
1
|
+
import React, { useMemo } from 'react'
|
2
2
|
import { Text } from './text'
|
3
3
|
import './tooltip.css'
|
4
4
|
|
@@ -11,11 +11,29 @@ export const Tooltip = (props) => {
|
|
11
11
|
|
12
12
|
const style = { top, left }
|
13
13
|
|
14
|
+
// Text element - support both string and React components
|
15
|
+
const textElement = useMemo(() => {
|
16
|
+
if (!text) return null
|
17
|
+
|
18
|
+
// If text is already a React element, use it directly
|
19
|
+
if (React.isValidElement(text)) {
|
20
|
+
return text
|
21
|
+
}
|
22
|
+
|
23
|
+
// If text is a string, wrap it in Text component
|
24
|
+
if (typeof text === 'string') {
|
25
|
+
return <Text>{text}</Text>
|
26
|
+
}
|
27
|
+
|
28
|
+
// Fallback for other types (convert to string)
|
29
|
+
return <Text>{String(text)}</Text>
|
30
|
+
}, [text])
|
31
|
+
|
14
32
|
return (
|
15
33
|
<div className="tooltip" >
|
16
|
-
<span className="tooltip-text" style={style}
|
34
|
+
<span className="tooltip-text" style={style}>{textElement}</span>
|
17
35
|
{props.children}
|
18
36
|
</div>
|
19
37
|
)
|
20
38
|
|
21
|
-
}
|
39
|
+
}
|
@@ -2,10 +2,11 @@
|
|
2
2
|
background-color: var(--paper-color);
|
3
3
|
}
|
4
4
|
|
5
|
-
.login-box
|
5
|
+
.login-box>main {
|
6
6
|
padding: 1rem 1rem 0 1rem;
|
7
7
|
display: flex;
|
8
8
|
flex-direction: column;
|
9
|
+
gap: 1rem
|
9
10
|
}
|
10
11
|
|
11
12
|
.login-box .message {
|
@@ -33,24 +34,26 @@
|
|
33
34
|
}
|
34
35
|
|
35
36
|
@keyframes rotation-counterclock {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
from {
|
38
|
+
transform: rotate(359deg);
|
39
|
+
}
|
40
|
+
|
41
|
+
to {
|
42
|
+
transform: rotate(0deg);
|
42
43
|
}
|
44
|
+
}
|
43
45
|
|
44
46
|
@keyframes rotation {
|
45
47
|
from {
|
46
48
|
transform: rotate(0deg);
|
47
49
|
}
|
50
|
+
|
48
51
|
to {
|
49
52
|
transform: rotate(359deg);
|
50
53
|
}
|
51
54
|
}
|
52
55
|
|
53
|
-
.login-box
|
56
|
+
.login-box>footer {
|
54
57
|
grid-area: footer;
|
55
58
|
padding: 1rem;
|
56
59
|
display: flex;
|
@@ -62,6 +65,7 @@
|
|
62
65
|
from {
|
63
66
|
opacity: 0;
|
64
67
|
}
|
68
|
+
|
65
69
|
to {
|
66
70
|
opacity: 1;
|
67
71
|
}
|
@@ -73,7 +77,7 @@
|
|
73
77
|
}
|
74
78
|
|
75
79
|
.login-box .forgot-button {
|
76
|
-
|
77
|
-
|
78
|
-
|
80
|
+
text-align: right;
|
81
|
+
font-weight: 500;
|
82
|
+
max-width: 15rem;
|
79
83
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Icon , Button, Text, TextField } from '../../html'
|
2
|
+
import { Icon , Button, Text, TextField2 as TextField } from '../../html'
|
3
3
|
import './LoginBox.css'
|
4
4
|
|
5
5
|
/**
|
6
6
|
* Login Box
|
7
7
|
*/
|
8
|
-
export const LoginBox = ({
|
8
|
+
export const LoginBox = ({
|
9
9
|
userLabel = "User", userValue = "",
|
10
10
|
passwordLabel = "Password", passwordValue = '',
|
11
11
|
loginLabel = "Log In",
|
@@ -24,23 +24,46 @@ export const LoginBox = ({
|
|
24
24
|
if (onOK && canOK()) onOK(user, forcedPwd || password)
|
25
25
|
}
|
26
26
|
|
27
|
+
// Helper function for backward compatibility
|
28
|
+
// TextField2 now supports both strings and React elements
|
27
29
|
function tx(txt) {
|
30
|
+
// For TextField2, we can pass strings directly for better performance
|
31
|
+
// But keep this function for backward compatibility with other components
|
28
32
|
return <Text>{txt}</Text>
|
29
33
|
}
|
30
34
|
|
31
|
-
function changeUser(
|
35
|
+
function changeUser(_, value) {
|
32
36
|
setUser(value)
|
33
37
|
}
|
34
|
-
|
35
|
-
function changePassword(
|
38
|
+
|
39
|
+
function changePassword(_, value) {
|
36
40
|
setPassword(value)
|
37
41
|
}
|
38
42
|
|
39
43
|
return (
|
40
44
|
<div className="login-box">
|
41
45
|
<main>
|
42
|
-
<TextField
|
43
|
-
|
46
|
+
<TextField
|
47
|
+
id="loginbox-user"
|
48
|
+
label={tx(userLabel)}
|
49
|
+
value={user}
|
50
|
+
onChange={changeUser}
|
51
|
+
onEnter={ok}
|
52
|
+
outlined
|
53
|
+
autoComplete="username"
|
54
|
+
required
|
55
|
+
/>
|
56
|
+
<TextField
|
57
|
+
id="loginbox-password"
|
58
|
+
label={tx(passwordLabel)}
|
59
|
+
value={password}
|
60
|
+
onChange={changePassword}
|
61
|
+
onEnter={ok}
|
62
|
+
type="password"
|
63
|
+
outlined
|
64
|
+
autoComplete="current-password"
|
65
|
+
required
|
66
|
+
/>
|
44
67
|
</main>
|
45
68
|
<footer>
|
46
69
|
{ loading ? <div className="load-box"><Icon icon="refresh" /></div> : null }
|