@lobehub/ui 1.3.0 → 1.4.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/es/Avatar/index.d.ts +10 -0
- package/es/Avatar/index.js +61 -0
- package/es/ContextMenu/MenuItem/icons.d.ts +4 -0
- package/es/ContextMenu/MenuItem/icons.js +73 -0
- package/es/ContextMenu/MenuItem/index.d.ts +12 -0
- package/es/ContextMenu/MenuItem/index.js +73 -0
- package/es/ContextMenu/MenuItem/style.d.ts +7 -0
- package/es/ContextMenu/MenuItem/style.js +16 -0
- package/es/ContextMenu/index.d.ts +9 -0
- package/es/ContextMenu/index.js +265 -0
- package/es/ContextMenu/style.d.ts +4 -0
- package/es/ContextMenu/style.js +12 -0
- package/es/ContextMenu/types/index.d.ts +5 -0
- package/es/ContextMenu/types/index.js +2 -0
- package/es/ContextMenu/types/menuItem.d.ts +21 -0
- package/es/ContextMenu/types/menuItem.js +1 -0
- package/es/DraggablePanel/index.d.ts +7 -1
- package/es/DraggablePanel/index.js +6 -7
- package/es/DraggablePanel/utils.d.ts +1 -1
- package/es/List/ListItem/index.d.ts +64 -0
- package/es/List/ListItem/index.js +110 -0
- package/es/List/ListItem/time.d.ts +2 -0
- package/es/List/ListItem/time.js +10 -0
- package/es/List/index.d.ts +5 -0
- package/es/List/index.js +5 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/lib/Avatar/index.d.ts +10 -0
- package/lib/Avatar/index.js +74 -0
- package/lib/ContextMenu/MenuItem/icons.d.ts +4 -0
- package/lib/ContextMenu/MenuItem/icons.js +100 -0
- package/lib/ContextMenu/MenuItem/index.d.ts +12 -0
- package/lib/ContextMenu/MenuItem/index.js +72 -0
- package/lib/ContextMenu/MenuItem/style.d.ts +7 -0
- package/lib/ContextMenu/MenuItem/style.js +94 -0
- package/lib/ContextMenu/index.d.ts +9 -0
- package/lib/ContextMenu/index.js +254 -0
- package/lib/ContextMenu/style.d.ts +4 -0
- package/lib/ContextMenu/style.js +88 -0
- package/lib/ContextMenu/types/index.d.ts +5 -0
- package/lib/ContextMenu/types/index.js +19 -0
- package/lib/ContextMenu/types/menuItem.d.ts +21 -0
- package/lib/ContextMenu/types/menuItem.js +17 -0
- package/lib/DraggablePanel/index.d.ts +7 -1
- package/lib/DraggablePanel/index.js +17 -19
- package/lib/DraggablePanel/utils.d.ts +1 -1
- package/lib/List/ListItem/index.d.ts +64 -0
- package/lib/List/ListItem/index.js +157 -0
- package/lib/List/ListItem/time.d.ts +2 -0
- package/lib/List/ListItem/time.js +50 -0
- package/lib/List/index.d.ts +5 -0
- package/lib/List/index.js +41 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +9 -0
- package/package.json +3 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/List/ListItem/index.tsx
|
|
20
|
+
var ListItem_exports = {};
|
|
21
|
+
__export(ListItem_exports, {
|
|
22
|
+
default: () => ListItem_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ListItem_exports);
|
|
25
|
+
var import_icons = require("@ant-design/icons");
|
|
26
|
+
var import_antd_style = require("antd-style");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_react_layout_kit = require("react-layout-kit");
|
|
29
|
+
var import_colorUtils = require("../../utils/colorUtils");
|
|
30
|
+
var import_time = require("./time");
|
|
31
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, cx, token }) => {
|
|
32
|
+
const textOverlay = css`
|
|
33
|
+
--overlay-background: ${token.colorBgLayout};
|
|
34
|
+
|
|
35
|
+
position: absolute;
|
|
36
|
+
z-index: 10;
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
|
|
40
|
+
width: 32px;
|
|
41
|
+
height: 44px;
|
|
42
|
+
|
|
43
|
+
background: linear-gradient(to right, transparent, var(--overlay-background));
|
|
44
|
+
`;
|
|
45
|
+
const overlayColor = (0, import_colorUtils.convertAlphaToSolid)(token.colorFillContent, token.colorBgLayout);
|
|
46
|
+
const hoverOverlay = css`
|
|
47
|
+
.${cx(textOverlay)} {
|
|
48
|
+
--overlay-background: ${overlayColor};
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
return {
|
|
52
|
+
container: css`
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
color: ${token.colorTextTertiary};
|
|
55
|
+
border-radius: 8px;
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
background: ${token.colorFillContent};
|
|
59
|
+
${hoverOverlay}
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
active: css`
|
|
63
|
+
color: ${token.colorText};
|
|
64
|
+
background: ${token.colorFillContent};
|
|
65
|
+
|
|
66
|
+
${hoverOverlay}
|
|
67
|
+
`,
|
|
68
|
+
content: css`
|
|
69
|
+
position: relative;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
flex: 1;
|
|
72
|
+
`,
|
|
73
|
+
title: css`
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
|
|
76
|
+
width: 100%;
|
|
77
|
+
|
|
78
|
+
font-size: 0.9em;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
`,
|
|
82
|
+
time: css`
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
color: ${token.colorTextPlaceholder};
|
|
85
|
+
`,
|
|
86
|
+
desc: css`
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
|
|
89
|
+
width: 100%;
|
|
90
|
+
margin-top: 2px;
|
|
91
|
+
|
|
92
|
+
font-size: 0.75em;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
`,
|
|
98
|
+
textOverlay
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
var ListItem = (0, import_react.forwardRef)(
|
|
102
|
+
({
|
|
103
|
+
active,
|
|
104
|
+
avatar,
|
|
105
|
+
loading,
|
|
106
|
+
description,
|
|
107
|
+
date,
|
|
108
|
+
title,
|
|
109
|
+
onHoverChange,
|
|
110
|
+
renderActions,
|
|
111
|
+
className,
|
|
112
|
+
style,
|
|
113
|
+
showAction,
|
|
114
|
+
classNames = {},
|
|
115
|
+
...props
|
|
116
|
+
}, ref) => {
|
|
117
|
+
const { styles, cx } = useStyles();
|
|
118
|
+
return /* @__PURE__ */ React.createElement(
|
|
119
|
+
import_react_layout_kit.Flexbox,
|
|
120
|
+
{
|
|
121
|
+
ref,
|
|
122
|
+
horizontal: true,
|
|
123
|
+
paddingBlock: 8,
|
|
124
|
+
gap: 8,
|
|
125
|
+
paddingInline: "12px 8px",
|
|
126
|
+
align: "flex-start",
|
|
127
|
+
distribution: "space-between",
|
|
128
|
+
className: cx(styles.container, active && styles.active, className),
|
|
129
|
+
style,
|
|
130
|
+
...props,
|
|
131
|
+
onMouseEnter: () => {
|
|
132
|
+
onHoverChange == null ? void 0 : onHoverChange(true);
|
|
133
|
+
},
|
|
134
|
+
onMouseLeave: () => {
|
|
135
|
+
onHoverChange == null ? void 0 : onHoverChange(false);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
avatar ?? /* @__PURE__ */ React.createElement(import_icons.MessageOutlined, { style: { marginTop: 4 } }),
|
|
139
|
+
/* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { className: styles.content }, /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, distribution: "space-between" }, /* @__PURE__ */ React.createElement("div", { className: styles.title }, title)), description && /* @__PURE__ */ React.createElement("div", { className: styles.desc }, description), /* @__PURE__ */ React.createElement("div", { className: styles.textOverlay })),
|
|
140
|
+
loading ? /* @__PURE__ */ React.createElement(import_icons.LoadingOutlined, { spin: true }) : showAction ? /* @__PURE__ */ React.createElement(
|
|
141
|
+
import_react_layout_kit.Flexbox,
|
|
142
|
+
{
|
|
143
|
+
horizontal: true,
|
|
144
|
+
gap: 4,
|
|
145
|
+
style: { display: showAction ? void 0 : "none" },
|
|
146
|
+
onClick: (e) => {
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
renderActions
|
|
151
|
+
) : date && /* @__PURE__ */ React.createElement("div", { className: cx(styles.time, classNames.time) }, (0, import_time.getChatItemTime)(date))
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
var ListItem_default = ListItem;
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/List/ListItem/time.ts
|
|
30
|
+
var time_exports = {};
|
|
31
|
+
__export(time_exports, {
|
|
32
|
+
getChatItemTime: () => getChatItemTime
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(time_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
37
|
+
import_dayjs.default.locale("zh-cn");
|
|
38
|
+
var getChatItemTime = (updateAt) => {
|
|
39
|
+
const time = (0, import_dayjs.default)(updateAt);
|
|
40
|
+
const diff = (0, import_dayjs.default)().day() - time.day();
|
|
41
|
+
if (time.isSame((0, import_dayjs.default)(), "day"))
|
|
42
|
+
return time.format("HH:mm");
|
|
43
|
+
if (diff === 1)
|
|
44
|
+
return "昨天";
|
|
45
|
+
return time.format("MM-DD");
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
getChatItemTime
|
|
50
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/List/index.ts
|
|
30
|
+
var List_exports = {};
|
|
31
|
+
__export(List_exports, {
|
|
32
|
+
default: () => List_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(List_exports);
|
|
35
|
+
var import_ListItem = __toESM(require("./ListItem"));
|
|
36
|
+
var List = {
|
|
37
|
+
Item: import_ListItem.default
|
|
38
|
+
};
|
|
39
|
+
var List_default = List;
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
|
|
2
|
+
export { default as Avatar, type AvatarProps } from './Avatar';
|
|
3
|
+
export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
|
|
2
4
|
export { default as CopyButton, type CopyButtonProps } from './CopyButton';
|
|
3
5
|
export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
|
|
4
6
|
export { default as EditableText, type EditableTextProps } from './EditableText';
|
|
5
7
|
export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
|
|
6
8
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
9
|
+
export { default as List } from './List';
|
|
7
10
|
export { default as Logo, type LogoProps } from './Logo';
|
|
8
11
|
export { default as Markdown, type MarkdownProps } from './Markdown';
|
|
9
12
|
export { default as MessageInput, type MessageInputProps } from './MessageInput';
|
package/lib/index.js
CHANGED
|
@@ -30,11 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var src_exports = {};
|
|
31
31
|
__export(src_exports, {
|
|
32
32
|
ActionIcon: () => import_ActionIcon.default,
|
|
33
|
+
Avatar: () => import_Avatar.default,
|
|
34
|
+
ContextMenu: () => import_ContextMenu.default,
|
|
33
35
|
CopyButton: () => import_CopyButton.default,
|
|
34
36
|
DraggablePanel: () => import_DraggablePanel.default,
|
|
35
37
|
EditableText: () => import_EditableText.default,
|
|
36
38
|
Highlighter: () => import_Highlighter.default,
|
|
37
39
|
Icon: () => import_Icon.default,
|
|
40
|
+
List: () => import_List.default,
|
|
38
41
|
Logo: () => import_Logo.default,
|
|
39
42
|
Markdown: () => import_Markdown.default,
|
|
40
43
|
MessageInput: () => import_MessageInput.default,
|
|
@@ -53,11 +56,14 @@ __export(src_exports, {
|
|
|
53
56
|
});
|
|
54
57
|
module.exports = __toCommonJS(src_exports);
|
|
55
58
|
var import_ActionIcon = __toESM(require("./ActionIcon"));
|
|
59
|
+
var import_Avatar = __toESM(require("./Avatar"));
|
|
60
|
+
var import_ContextMenu = __toESM(require("./ContextMenu"));
|
|
56
61
|
var import_CopyButton = __toESM(require("./CopyButton"));
|
|
57
62
|
var import_DraggablePanel = __toESM(require("./DraggablePanel"));
|
|
58
63
|
var import_EditableText = __toESM(require("./EditableText"));
|
|
59
64
|
var import_Highlighter = __toESM(require("./Highlighter"));
|
|
60
65
|
var import_Icon = __toESM(require("./Icon"));
|
|
66
|
+
var import_List = __toESM(require("./List"));
|
|
61
67
|
var import_Logo = __toESM(require("./Logo"));
|
|
62
68
|
var import_Markdown = __toESM(require("./Markdown"));
|
|
63
69
|
var import_MessageInput = __toESM(require("./MessageInput"));
|
|
@@ -73,11 +79,14 @@ var import_Tooltip = __toESM(require("./Tooltip"));
|
|
|
73
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
80
|
0 && (module.exports = {
|
|
75
81
|
ActionIcon,
|
|
82
|
+
Avatar,
|
|
83
|
+
ContextMenu,
|
|
76
84
|
CopyButton,
|
|
77
85
|
DraggablePanel,
|
|
78
86
|
EditableText,
|
|
79
87
|
Highlighter,
|
|
80
88
|
Icon,
|
|
89
|
+
List,
|
|
81
90
|
Logo,
|
|
82
91
|
Markdown,
|
|
83
92
|
MessageInput,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building chatbot web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -65,10 +65,12 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@ant-design/icons": "^5",
|
|
67
67
|
"@babel/runtime": "^7",
|
|
68
|
+
"@floating-ui/react": "^0.24",
|
|
68
69
|
"ahooks": "^3",
|
|
69
70
|
"antd-style": "^3",
|
|
70
71
|
"chroma-js": "^2",
|
|
71
72
|
"copy-to-clipboard": "^3",
|
|
73
|
+
"dayjs": "^1",
|
|
72
74
|
"leva": "^0.9.34",
|
|
73
75
|
"lodash": "^4",
|
|
74
76
|
"lucide-react": "latest",
|