tango-ui-cw 0.2.6 → 0.2.7

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.
Files changed (38) hide show
  1. package/dist/index.js +256 -15
  2. package/dist/index.mjs +26118 -1301
  3. package/package.json +13 -14
  4. package/src/component/CSSFab/useTangoStyle.jsx +0 -182
  5. package/src/component/MaterialButton/MaterialButton.module.css +0 -64
  6. package/src/component/MaterialButton/index.jsx +0 -70
  7. package/src/component/MaterialInput/MaterialInput.module.css +0 -37
  8. package/src/component/MaterialInput/index.jsx +0 -35
  9. package/src/component/TButton/TButton.module.css +0 -184
  10. package/src/component/TButton/index.jsx +0 -81
  11. package/src/component/TColorPicker/TColorPicker.module.css +0 -24
  12. package/src/component/TColorPicker/index.jsx +0 -107
  13. package/src/component/TDate/index.jsx +0 -145
  14. package/src/component/TDatePicker/TDatePicker.module.css +0 -12
  15. package/src/component/TDatePicker/index.jsx +0 -72
  16. package/src/component/TDrawer/TDrawer.module.css +0 -203
  17. package/src/component/TDrawer/index.jsx +0 -80
  18. package/src/component/TInput/TInput.module.css +0 -67
  19. package/src/component/TInput/index.jsx +0 -94
  20. package/src/component/TLayout/TLayout.css +0 -88
  21. package/src/component/TLayout/index.jsx +0 -76
  22. package/src/component/TLine/TLine.module.css +0 -52
  23. package/src/component/TLine/index.jsx +0 -47
  24. package/src/component/TMark/TMark.module.css +0 -6
  25. package/src/component/TMark/index.jsx +0 -68
  26. package/src/component/TModal/TModal.module.css +0 -109
  27. package/src/component/TModal/index.jsx +0 -75
  28. package/src/component/TNotice/TNotice.module.css +0 -50
  29. package/src/component/TNotice/index.jsx +0 -37
  30. package/src/component/TNotice/useNotice.jsx +0 -53
  31. package/src/component/TSearch/TSearch.module.css +0 -80
  32. package/src/component/TSearch/index.jsx +0 -86
  33. package/src/component/TSpace/TSpace.module.css +0 -43
  34. package/src/component/TSpace/index.jsx +0 -60
  35. package/src/component/TTable/TTable.module.css +0 -26
  36. package/src/component/TTable/index.jsx +0 -72
  37. package/src/component/TTooltip/TTooltip.module.css +0 -66
  38. package/src/component/TTooltip/index.jsx +0 -33
@@ -1,53 +0,0 @@
1
- import { createRoot } from "react-dom/client"; // 使用 React 18 的 createRoot
2
- import ClayNotice from "./index"; // 引入 ClayNotice 组件
3
- import successIcon from "../../assets/Notice/成功.png";
4
- import failIcon from "../../assets/Notice/失败.png";
5
- import cautionIcon from "../../assets/Notice/警告.png";
6
-
7
- // 创建全局通知容器
8
- let root; // 用于缓存 React 根实例
9
-
10
- export function useNotice() {
11
- // 初始化通知容器
12
- const initializeContainer = () => {
13
- let container = document.getElementById("notification-container");
14
- if (!container) {
15
- container = document.createElement("div");
16
- container.id = "notification-container";
17
- document.body.appendChild(container);
18
- }
19
-
20
- if (!root) {
21
- root = createRoot(container); // 仅初始化一次 createRoot
22
- }
23
-
24
- return container;
25
- };
26
-
27
- // 通知生成函数
28
- const addNotice = (type, message) => {
29
- initializeContainer(); // 确保容器已初始化
30
-
31
- const iconMap = {
32
- success: successIcon,
33
- fail: failIcon,
34
- caution: cautionIcon,
35
- };
36
-
37
- const icon = iconMap[type] || successIcon;
38
-
39
- // 创建通知组件
40
- const notice = (
41
- <ClayNotice key={Date.now()} type={type} icon={icon} message={message} />
42
- );
43
-
44
- // 渲染通知
45
- root.render(notice);
46
- };
47
-
48
- return {
49
- success: (message) => addNotice("success", message),
50
- fail: (message) => addNotice("fail", message),
51
- caution: (message) => addNotice("caution", message),
52
- };
53
- }
@@ -1,80 +0,0 @@
1
- .searchContainer {
2
- position: relative;
3
- }
4
-
5
- .searchInput {
6
- width: 300px;
7
- border-radius: 8px;
8
- border: 1px solid #ccc;
9
- padding: 8px 12px;
10
- font-size: 14px;
11
- color: black;
12
- outline: none;
13
- transition: all 0.3s ease;
14
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
15
- background-color: #fff;
16
- }
17
-
18
- .searchInput:hover {
19
- border-color: #888;
20
- }
21
-
22
- .searchInput:focus {
23
- border-color: #4caf50;
24
- box-shadow: 0 0 5px rgba(0, 120, 212, 0.5);
25
- }
26
-
27
- .searchInput_small {
28
- height: 32px;
29
- font-size: 12px;
30
- padding: 6px 10px;
31
- }
32
-
33
- .searchInput_medium {
34
- height: 40px;
35
- font-size: 14px;
36
- }
37
-
38
- .searchInput_large {
39
- height: 48px;
40
- font-size: 16px;
41
- padding: 10px 14px;
42
- }
43
-
44
- .searchInput_huge {
45
- height: 56px;
46
- font-size: 18px;
47
- padding: 12px 16px;
48
- }
49
-
50
- .searchInputDisabled {
51
- background-color: #f5f5f5;
52
- color: #999;
53
- border-color: #ddd;
54
- cursor: not-allowed;
55
- box-shadow: none;
56
- }
57
-
58
- .searchButton {
59
- position: absolute;
60
- right: 10px;
61
- top: 50%;
62
- transform: translateY(-50%);
63
- font-family: Arial, sans-serif;
64
- border: none;
65
- cursor: pointer;
66
- padding: 4px 8px;
67
- border-radius: 6px;
68
- transition: all 0.3s;
69
- letter-spacing: 2px;
70
- background: #4caf50;
71
- color: white;
72
- }
73
-
74
- .searchButton:hover {
75
- transition: 0.3s;
76
- animation: btn-content 1s;
77
- outline: 0.1em solid transparent;
78
- outline-offset: 0.2em;
79
- box-shadow: 0 0 5px #4caf50;
80
- }
@@ -1,86 +0,0 @@
1
- import React, { useRef } from "react";
2
- import PropTypes from "prop-types";
3
- import styles from "./TSearch.module.css";
4
-
5
- export default function Search(props) {
6
- const {
7
- size = "medium",
8
- sx = {},
9
- style: userStyle = {},
10
- className: userClassName = "", // 允许用户自定义 className
11
- onSearch,
12
- value,
13
- defaultValue = "",
14
- disabled = false,
15
- placeholder = "",
16
- path = "",
17
- } = props;
18
-
19
- const inputRef = useRef(null);
20
-
21
- const className = `${styles.searchInput} ${styles[`searchInput_${size}`]} ${
22
- disabled ? styles.searchInputDisabled : ""
23
- } ${userClassName}`;
24
-
25
- const combinedStyle = { ...sx, ...userStyle };
26
- const isControlled = value !== undefined && onSearch !== undefined;
27
-
28
- return (
29
- <div className={styles.searchContainer} style={{ width: 300 }}>
30
- <input
31
- className={className}
32
- style={combinedStyle}
33
- ref={!isControlled ? inputRef : undefined}
34
- onKeyDown={(e) =>
35
- e.key === "Enter" &&
36
- onSearch(isControlled ? value : inputRef.current.value)
37
- }
38
- value={isControlled ? value : undefined}
39
- defaultValue={!isControlled ? defaultValue : undefined}
40
- disabled={disabled}
41
- placeholder={placeholder}
42
- />
43
- <button
44
- className={styles.searchButton}
45
- onClick={() => onSearch(isControlled ? value : inputRef.current.value)}
46
- >
47
- {path ? (
48
- <img
49
- src={path}
50
- alt="search-icon"
51
- style={{ width: 16, height: 16, marginTop: 2, marginBottom: -3 }}
52
- />
53
- ) : (
54
- "搜索"
55
- )}
56
- </button>
57
- </div>
58
- );
59
- };
60
-
61
- Search.propTypes = {
62
- size: PropTypes.oneOf(["small", "medium", "large", "huge"]),
63
- sx: PropTypes.object,
64
- style: PropTypes.object,
65
- onSearch: PropTypes.func.isRequired,
66
- className: PropTypes.string,
67
- value: PropTypes.string,
68
- defaultValue: PropTypes.string,
69
- disabled: PropTypes.bool,
70
- placeholder: PropTypes.string,
71
- path: PropTypes.string,
72
- };
73
-
74
- Search.defaultProps = {
75
- size: "medium",
76
- sx: {},
77
- style: {},
78
- onSearch: () => {},
79
- className: "",
80
- value: undefined,
81
- defaultValue: "",
82
- disabled: false,
83
- placeholder: "请输入内容",
84
- path: "",
85
- };
86
-
@@ -1,43 +0,0 @@
1
- .space,
2
- .space_default {
3
- width: auto;
4
- height: auto;
5
- }
6
-
7
- .space_inline {
8
- display: inline-block;
9
- }
10
-
11
- .space_fixed {
12
- position: fixed;
13
- }
14
-
15
- .space_absolute {
16
- position: absolute;
17
- }
18
-
19
- .space_relative {
20
- position: relative;
21
- }
22
-
23
- .space_circle {
24
- border-radius: 50%;
25
- }
26
-
27
- .space_triangle {
28
- width: 0;
29
- height: 0;
30
- border-left: 50px solid transparent;
31
- border-right: 50px solid transparent;
32
- border-bottom: 100px solid #4caf50;
33
- }
34
-
35
- .space_halfCircle {
36
- width: 100px;
37
- height: 50px;
38
- background: #4caf50;
39
- border-top-left-radius: 100px;
40
- border-top-right-radius: 100px;
41
- border-bottom-left-radius: 0;
42
- border-bottom-right-radius: 0;
43
- }
@@ -1,60 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import styles from "./TSpace.module.css";
4
- import { useTangoStyle } from "../CSSFab/useTangoStyle";
5
-
6
- const Space = React.forwardRef((props, ref) => {
7
- const {
8
- sx = {},
9
- style: userStyle = {},
10
- className: userClassName = "",
11
- onClick,
12
- children,
13
- type = "default",
14
- } = props;
15
-
16
- const className = `${styles.space} ${styles[`space_${type}`] || ""} ${userClassName}`;
17
- const sxStyle = useTangoStyle(sx);
18
- const combinedStyle = { ...sxStyle, ...userStyle };
19
-
20
- return (
21
- <div
22
- ref={ref}
23
- style={combinedStyle}
24
- onClick={onClick}
25
- className={className}
26
- >
27
- {children}
28
- </div>
29
- );
30
- });
31
-
32
- // 定义 PropTypes
33
- Space.propTypes = {
34
- type: PropTypes.oneOf([
35
- "default",
36
- "inline",
37
- "circle",
38
- "triangle",
39
- "halfCircle",
40
- "fixed",
41
- "absolute",
42
- "relative",
43
- ]),
44
- sx: PropTypes.object,
45
- style: PropTypes.object,
46
- onClick: PropTypes.func,
47
- className: PropTypes.string,
48
- children: PropTypes.node.isRequired,
49
- };
50
-
51
- // 默认属性
52
- Space.defaultProps = {
53
- type: "default",
54
- sx: {},
55
- style: {},
56
- onClick: () => {},
57
- className: "",
58
- };
59
-
60
- export { Space }; // 使用命名导出
@@ -1,26 +0,0 @@
1
- .wrapper {
2
- overflow-x: auto;
3
- }
4
-
5
- .table {
6
- width: 100%;
7
- border-collapse: collapse;
8
- font-size: 14px;
9
- color: #333;
10
- }
11
-
12
- .thead {
13
- background-color: #4caf50;
14
- color: white;
15
- }
16
-
17
- .table th,
18
- .table td {
19
- border: 1px solid #ddd;
20
- padding: 10px;
21
- text-align: left;
22
- }
23
-
24
- .table tbody tr:hover {
25
- background-color: #f1f1f1;
26
- }
@@ -1,72 +0,0 @@
1
- import PropTypes from "prop-types";
2
- import { useTangoStyle } from "../CSSFab/useTangoStyle";
3
- import styles from "./TTable.module.css";
4
-
5
- export default function Table({
6
- dataSource,
7
- columns,
8
- sx = {},
9
- style = {},
10
- className = "",
11
- }) {
12
- const sxStyle = useTangoStyle(sx);
13
- const combinedStyle = { ...sxStyle, ...style };
14
-
15
- return (
16
- <div
17
- className={`${styles.wrapper} ${className}`}
18
- style={{
19
- ...combinedStyle,
20
- borderRadius: combinedStyle.borderRadius || 0,
21
- overflow: "hidden",
22
- border: "1px solid #ddd",
23
- }}
24
- >
25
- <table className={styles.table}>
26
- <thead className={styles.thead}>
27
- <tr>
28
- {columns?.map((col) => (
29
- <th key={col.key || col.dataIndex}>{col.title}</th>
30
- ))}
31
- </tr>
32
- </thead>
33
- <tbody>
34
- {dataSource.map((row) => (
35
- <tr key={row.key}>
36
- {columns.map((col) => (
37
- <td key={col.key || col.dataIndex}>
38
- {col.render
39
- ? col.render(row[col.dataIndex], row, dataSource.indexOf(row))
40
- : row[col.dataIndex]}
41
- </td>
42
- ))}
43
- </tr>
44
- ))}
45
- </tbody>
46
- </table>
47
- </div>
48
- );
49
- };
50
-
51
- Table.propTypes = {
52
- dataSource: PropTypes.array.isRequired,
53
- columns: PropTypes.arrayOf(
54
- PropTypes.shape({
55
- title: PropTypes.string.isRequired,
56
- dataIndex: PropTypes.string.isRequired,
57
- key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
58
- render: PropTypes.func,
59
- })
60
- ).isRequired,
61
- sx: PropTypes.object,
62
- style: PropTypes.object,
63
- className: PropTypes.string,
64
- };
65
-
66
- Table.defaultProps = {
67
- dataSource: [],
68
- sx: {},
69
- style: {},
70
- className: "",
71
- };
72
-
@@ -1,66 +0,0 @@
1
- .tooltipWrapper {
2
- position: relative;
3
- display: inline-block;
4
- }
5
-
6
- .tooltip {
7
- position: absolute;
8
- padding: 8px 15px;
9
- font-size: 16px;
10
- color: white;
11
- background-color: black;
12
- border-radius: 8px;
13
- white-space: nowrap;
14
- z-index: 999;
15
- box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
16
- }
17
-
18
- /* 添加 Tooltip 的倒三角 */
19
- .tooltip::after {
20
- content: "";
21
- position: absolute;
22
- border-width: 8px;
23
- border-style: solid;
24
- }
25
-
26
- /* Placement 样式:top */
27
- .tooltipTop .tooltip {
28
- bottom: 130%;
29
- left: 50%;
30
- transform: translateX(-50%);
31
- margin-bottom: 8px;
32
- }
33
- .tooltipTop .tooltip::after {
34
- top: 100%;
35
- left: 50%;
36
- transform: translateX(-50%);
37
- border-color: black transparent transparent transparent;
38
- }
39
-
40
- /* Placement 样式:bottom */
41
- .tooltipBottom .tooltip {
42
- top: 130%;
43
- left: 50%;
44
- transform: translateX(-50%);
45
- margin-top: 8px;
46
- }
47
- .tooltipBottom .tooltip::after {
48
- bottom: 100%;
49
- left: 50%;
50
- transform: translateX(-50%);
51
- border-color: transparent transparent black transparent;
52
- }
53
-
54
- /* Placement 样式:right */
55
- .tooltipRight .tooltip {
56
- top: 50%;
57
- left: 110%;
58
- transform: translateY(-50%);
59
- margin-left: 8px;
60
- }
61
- .tooltipRight .tooltip::after {
62
- top: 50%;
63
- left: -8px;
64
- transform: translateY(-50%);
65
- border-color: transparent black transparent transparent;
66
- }
@@ -1,33 +0,0 @@
1
- import React, { useState } from "react";
2
- import PropTypes from "prop-types";
3
- import styles from "./TTooltip.module.css";
4
-
5
- export default function Tooltip({ children, tooltipText, placement = "top" }) {
6
- const [hovered, setHovered] = useState(false);
7
-
8
- return (
9
- <div
10
- className={`${styles.tooltipWrapper} ${styles[`tooltip${placement[0].toUpperCase() + placement.slice(1)}`]}`}
11
- onMouseEnter={() => setHovered(true)}
12
- onMouseLeave={() => setHovered(false)}
13
- >
14
- {children}
15
- {hovered && (
16
- <div className={styles.tooltip}>
17
- {tooltipText}
18
- </div>
19
- )}
20
- </div>
21
- );
22
- };
23
-
24
- Tooltip.propTypes = {
25
- children: PropTypes.node.isRequired,
26
- tooltipText: PropTypes.string.isRequired,
27
- placement: PropTypes.oneOf(["top", "bottom", "right"]),
28
- };
29
-
30
- Tooltip.defaultProps = {
31
- placement: "top",
32
- };
33
-