tango-ui-cw 0.0.2 → 0.2.0
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.css +1 -1
- package/dist/index.js +10 -10
- package/dist/index.mjs +1086 -849
- package/package.json +1 -1
- package/src/component/CSSFab/useTangoStyle.jsx +182 -182
- package/src/component/MaterialButton/{MaterialButton.css → MaterialButton.module.css} +64 -64
- package/src/component/MaterialButton/index.jsx +69 -58
- package/src/component/MaterialInput/{MaterialInput.css → MaterialInput.module.css} +37 -33
- package/src/component/MaterialInput/index.jsx +34 -29
- package/src/component/TButton/TButton.module.css +184 -0
- package/src/component/TButton/index.jsx +81 -74
- package/src/component/TColorPicker/{TColorPicker.css → TColorPicker.module.css} +24 -24
- package/src/component/TColorPicker/index.jsx +107 -106
- package/src/component/TDate/index.jsx +146 -148
- package/src/component/TDatePicker/TDatePicker.module.css +12 -0
- package/src/component/TDatePicker/index.jsx +72 -60
- package/src/component/TDrawer/{TDrawer.css → TDrawer.module.css} +203 -202
- package/src/component/TDrawer/index.jsx +80 -74
- package/src/component/TInput/{TInput.css → TInput.module.css} +67 -80
- package/src/component/TInput/index.jsx +95 -102
- package/src/component/TLayout/TLayout.css +88 -88
- package/src/component/TLayout/index.jsx +77 -77
- package/src/component/TLine/TLine.module.css +52 -0
- package/src/component/TLine/index.jsx +48 -57
- package/src/component/TMark/{TMark.css → TMark.module.css} +6 -6
- package/src/component/TMark/index.jsx +69 -78
- package/src/component/TModal/{TModal.css → TModal.module.css} +109 -108
- package/src/component/TModal/index.jsx +75 -69
- package/src/component/TNotice/{TNotice.css → TNotice.module.css} +50 -52
- package/src/component/TNotice/index.jsx +37 -38
- package/src/component/TNotice/useNotice.jsx +54 -54
- package/src/component/TSearch/{TSearch.css → TSearch.module.css} +80 -90
- package/src/component/TSearch/index.jsx +86 -100
- package/src/component/TSpace/TSpace.module.css +43 -0
- package/src/component/TSpace/index.jsx +60 -60
- package/src/component/TTable/{TTable.css → TTable.module.css} +26 -26
- package/src/component/TTable/index.jsx +73 -77
- package/src/component/TTooltip/TTooltip.module.css +66 -0
- package/src/component/TTooltip/index.jsx +33 -25
- package/src/component/Tango/store.js +105 -105
- package/src/component/Tools/WaterMark/WaterMark.jsx +78 -78
- package/src/component/TButton/TButton.css +0 -270
- package/src/component/TDate/TDate.css +0 -0
- package/src/component/TDatePicker/TDatePicker.css +0 -13
- package/src/component/TLine/TLine.css +0 -54
- package/src/component/TSpace/TSpace.css +0 -43
- package/src/component/TTooltip/TTooltip.css +0 -105
@@ -1,74 +1,80 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
2
|
-
import PropTypes from "prop-types";
|
3
|
-
import "./TDrawer.css";
|
4
|
-
import TButton from "../TButton
|
5
|
-
|
6
|
-
export default function Drawer(props) {
|
7
|
-
const { children, title, onText, cancelText, open, onClose, type } = props;
|
8
|
-
const [showAnimation, setShowAnimation] = useState(false);
|
9
|
-
const [closing, setClosing] = useState(false);
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
import styles from "./TDrawer.module.css";
|
4
|
+
import TButton from "../TButton";
|
5
|
+
|
6
|
+
export default function Drawer(props) {
|
7
|
+
const { children, title, onText, cancelText, open, onClose, type } = props;
|
8
|
+
const [showAnimation, setShowAnimation] = useState(false);
|
9
|
+
const [closing, setClosing] = useState(false);
|
10
|
+
|
11
|
+
useEffect(() => {
|
12
|
+
if (open) {
|
13
|
+
setShowAnimation(true);
|
14
|
+
setClosing(false);
|
15
|
+
} else if (showAnimation) {
|
16
|
+
setClosing(true);
|
17
|
+
setTimeout(() => {
|
18
|
+
setShowAnimation(false);
|
19
|
+
setClosing(false);
|
20
|
+
}, 300);
|
21
|
+
}
|
22
|
+
}, [open]);
|
23
|
+
|
24
|
+
function ok() {
|
25
|
+
if (onClose) onClose();
|
26
|
+
}
|
27
|
+
|
28
|
+
return (
|
29
|
+
<>
|
30
|
+
{showAnimation && (
|
31
|
+
<div
|
32
|
+
className={`${styles.drawerOverlay} ${
|
33
|
+
closing ? styles.fadeOut : styles.fadeIn
|
34
|
+
}`}
|
35
|
+
>
|
36
|
+
<div
|
37
|
+
className={`${styles.drawerContainer} ${
|
38
|
+
styles[`drawer${type.charAt(0).toUpperCase() + type.slice(1)}`]
|
39
|
+
} ${
|
40
|
+
closing
|
41
|
+
? styles[`comeOut${type.charAt(0).toUpperCase() + type.slice(1)}`]
|
42
|
+
: styles[`comeIn${type.charAt(0).toUpperCase() + type.slice(1)}`]
|
43
|
+
}`}
|
44
|
+
>
|
45
|
+
<div className={styles.drawerHeader}>
|
46
|
+
<h3>{title}</h3>
|
47
|
+
<div className={styles.drawerCloseBtn} onClick={onClose}></div>
|
48
|
+
</div>
|
49
|
+
<div className={styles.drawerContent}>{children}</div>
|
50
|
+
<div className={styles.drawerFooter}>
|
51
|
+
<TButton type="success" onClick={ok}>
|
52
|
+
{onText}
|
53
|
+
</TButton>
|
54
|
+
<TButton onClick={onClose}>{cancelText}</TButton>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
)}
|
59
|
+
</>
|
60
|
+
);
|
61
|
+
};
|
62
|
+
|
63
|
+
TDrawer.propTypes = {
|
64
|
+
children: PropTypes.node.isRequired,
|
65
|
+
title: PropTypes.string,
|
66
|
+
onText: PropTypes.string,
|
67
|
+
cancelText: PropTypes.string,
|
68
|
+
open: PropTypes.bool,
|
69
|
+
onClose: PropTypes.func,
|
70
|
+
type: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
71
|
+
};
|
72
|
+
|
73
|
+
TDrawer.defaultProps = {
|
74
|
+
title: "基础标题",
|
75
|
+
onText: "确定",
|
76
|
+
cancelText: "取消",
|
77
|
+
open: false,
|
78
|
+
onClose: () => {},
|
79
|
+
type: "right",
|
80
|
+
};
|
@@ -1,80 +1,67 @@
|
|
1
|
-
.input {
|
2
|
-
width: 300px;
|
3
|
-
|
4
|
-
border
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
color: #
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
}
|
69
|
-
/* .search-button {
|
70
|
-
position: absolute;
|
71
|
-
right: 10px;
|
72
|
-
top: 0%;
|
73
|
-
transform: translateY(-50%);
|
74
|
-
padding: 5px 10px;
|
75
|
-
background: #007bff;
|
76
|
-
color: #fff;
|
77
|
-
border: none;
|
78
|
-
border-radius: 4px;
|
79
|
-
cursor: pointer;
|
80
|
-
} */
|
1
|
+
.input {
|
2
|
+
width: 300px;
|
3
|
+
border-radius: 8px;
|
4
|
+
border: 1px solid #ccc;
|
5
|
+
padding: 8px 12px;
|
6
|
+
font-size: 14px;
|
7
|
+
color: black;
|
8
|
+
outline: none;
|
9
|
+
transition: all 0.3s ease;
|
10
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
11
|
+
background-color: #fff;
|
12
|
+
}
|
13
|
+
|
14
|
+
.input:hover {
|
15
|
+
border-color: #888;
|
16
|
+
}
|
17
|
+
|
18
|
+
.input:focus {
|
19
|
+
border-color: #4caf50;
|
20
|
+
box-shadow: 0 0 5px rgba(0, 120, 212, 0.5);
|
21
|
+
}
|
22
|
+
|
23
|
+
.inputSmall {
|
24
|
+
height: 32px;
|
25
|
+
font-size: 12px;
|
26
|
+
padding: 6px 10px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.inputMedium {
|
30
|
+
height: 40px;
|
31
|
+
font-size: 14px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.inputLarge {
|
35
|
+
height: 48px;
|
36
|
+
font-size: 16px;
|
37
|
+
padding: 10px 14px;
|
38
|
+
}
|
39
|
+
|
40
|
+
.inputHuge {
|
41
|
+
height: 56px;
|
42
|
+
font-size: 18px;
|
43
|
+
padding: 12px 16px;
|
44
|
+
}
|
45
|
+
|
46
|
+
.inputDisabled {
|
47
|
+
background-color: #f5f5f5;
|
48
|
+
color: #999;
|
49
|
+
border-color: #ddd;
|
50
|
+
cursor: not-allowed;
|
51
|
+
box-shadow: none;
|
52
|
+
}
|
53
|
+
|
54
|
+
.inputTextarea {
|
55
|
+
min-height: 32px;
|
56
|
+
font-size: 14px;
|
57
|
+
}
|
58
|
+
|
59
|
+
.inputError {
|
60
|
+
border-color: #d93025;
|
61
|
+
background-color: #fef2f2;
|
62
|
+
color: #d93025;
|
63
|
+
}
|
64
|
+
|
65
|
+
.inputError:focus {
|
66
|
+
box-shadow: 0 0 5px rgba(217, 48, 37, 0.5);
|
67
|
+
}
|
@@ -1,102 +1,95 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import PropTypes from "prop-types";
|
3
|
-
import "./TInput.css"; //
|
4
|
-
import { useTangoStyle } from "../CSSFab/useTangoStyle";
|
5
|
-
|
6
|
-
export default function Input(props) {
|
7
|
-
const {
|
8
|
-
type = "default",
|
9
|
-
size = "medium",
|
10
|
-
sx = {},
|
11
|
-
style: userStyle = {},
|
12
|
-
className: userClassName = "", // 允许用户自定义 className
|
13
|
-
onClick,
|
14
|
-
onChange,
|
15
|
-
value,
|
16
|
-
defaultValue = "",
|
17
|
-
disabled = false,
|
18
|
-
placeholder = "",
|
19
|
-
maxlength
|
20
|
-
} = props;
|
21
|
-
|
22
|
-
|
23
|
-
const
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
const
|
29
|
-
|
30
|
-
|
31
|
-
const combinedStyle = { ...sxStyle, ...userStyle };
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
maxLength={maxlength}
|
97
|
-
/>
|
98
|
-
)}
|
99
|
-
</div>
|
100
|
-
);
|
101
|
-
};
|
102
|
-
|
1
|
+
import React from "react";
|
2
|
+
import PropTypes from "prop-types";
|
3
|
+
import styles from "./TInput.module.css"; // 模块化 CSS
|
4
|
+
import { useTangoStyle } from "../CSSFab/useTangoStyle";
|
5
|
+
|
6
|
+
export default function Input(props) {
|
7
|
+
const {
|
8
|
+
type = "default",
|
9
|
+
size = "medium",
|
10
|
+
sx = {},
|
11
|
+
style: userStyle = {},
|
12
|
+
className: userClassName = "", // 允许用户自定义 className
|
13
|
+
onClick,
|
14
|
+
onChange,
|
15
|
+
value,
|
16
|
+
defaultValue = "",
|
17
|
+
disabled = false,
|
18
|
+
placeholder = "",
|
19
|
+
maxlength
|
20
|
+
} = props;
|
21
|
+
|
22
|
+
|
23
|
+
const isControlled = value !== undefined && onChange !== undefined;
|
24
|
+
|
25
|
+
const baseClass = styles.input;
|
26
|
+
const sizeClass = styles[`input${size.charAt(0).toUpperCase() + size.slice(1)}`] || "";
|
27
|
+
const disabledClass = disabled ? styles.inputDisabled : "";
|
28
|
+
const combinedClassName = `${baseClass} ${sizeClass} ${disabledClass} ${userClassName}`.trim();
|
29
|
+
|
30
|
+
const sxStyle = useTangoStyle(sx);
|
31
|
+
const combinedStyle = { ...sxStyle, ...userStyle };
|
32
|
+
|
33
|
+
const inputType = type === "password" ? "password" : "text";
|
34
|
+
|
35
|
+
return (
|
36
|
+
<div>
|
37
|
+
{type === "textarea" ? (
|
38
|
+
<textarea
|
39
|
+
className={combinedClassName}
|
40
|
+
style={combinedStyle}
|
41
|
+
onClick={onClick}
|
42
|
+
onChange={onChange && ((e) => onChange(e.target.value))}
|
43
|
+
value={isControlled ? value : undefined}
|
44
|
+
defaultValue={!isControlled ? defaultValue : undefined}
|
45
|
+
disabled={disabled}
|
46
|
+
placeholder={placeholder}
|
47
|
+
maxLength={maxlength}
|
48
|
+
/>
|
49
|
+
) : (
|
50
|
+
<input
|
51
|
+
className={combinedClassName}
|
52
|
+
style={combinedStyle}
|
53
|
+
type={inputType}
|
54
|
+
onClick={onClick}
|
55
|
+
onChange={onChange && ((e) => onChange(e.target.value))}
|
56
|
+
value={isControlled ? value : undefined}
|
57
|
+
defaultValue={!isControlled ? defaultValue : undefined}
|
58
|
+
disabled={disabled}
|
59
|
+
placeholder={placeholder}
|
60
|
+
maxLength={maxlength}
|
61
|
+
/>
|
62
|
+
)}
|
63
|
+
</div>
|
64
|
+
);
|
65
|
+
};
|
66
|
+
|
67
|
+
TInput.propTypes = {
|
68
|
+
type: PropTypes.oneOf(["default", "textarea", "password"]),
|
69
|
+
size: PropTypes.oneOf(["small", "medium", "large", "huge"]),
|
70
|
+
sx: PropTypes.object,
|
71
|
+
style: PropTypes.object,
|
72
|
+
onClick: PropTypes.func,
|
73
|
+
onChange: PropTypes.func,
|
74
|
+
className: PropTypes.string,
|
75
|
+
value: PropTypes.string,
|
76
|
+
defaultValue: PropTypes.string,
|
77
|
+
disabled: PropTypes.bool,
|
78
|
+
placeholder: PropTypes.string,
|
79
|
+
maxlength: PropTypes.number,
|
80
|
+
};
|
81
|
+
|
82
|
+
TInput.defaultProps = {
|
83
|
+
type: "default",
|
84
|
+
size: "medium",
|
85
|
+
sx: {},
|
86
|
+
style: {},
|
87
|
+
onClick: () => {},
|
88
|
+
className: "",
|
89
|
+
onChange: undefined,
|
90
|
+
value: undefined,
|
91
|
+
defaultValue: "",
|
92
|
+
disabled: false,
|
93
|
+
placeholder: "",
|
94
|
+
maxlength: 524288,
|
95
|
+
};
|