@lobehub/ui 1.95.0 → 1.96.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/README.md CHANGED
@@ -27,7 +27,7 @@ Lobe UI is an open-source UI component library for building _AIGC_ web apps
27
27
  [![][github-issues-shield]][github-issues-link]
28
28
  [![][github-license-shield]][github-license-link]
29
29
 
30
- ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/268452017-960ab8a1-e4b7-4648-beb1-77daf4b6034a.png)
30
+ [![][banner]][vercel-link]
31
31
 
32
32
  </div>
33
33
 
@@ -52,7 +52,8 @@ Lobe UI is an open-source UI component library for building _AIGC_ web apps
52
52
 
53
53
  ## 📦 Installation
54
54
 
55
- This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
55
+ > **Important**\
56
+ > This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
56
57
 
57
58
  To install Lobe UI, run the following command:
58
59
 
@@ -82,6 +83,30 @@ const nextConfig = {
82
83
 
83
84
  </div>
84
85
 
86
+ ## 🤯 Usage
87
+
88
+ > **Note**\
89
+ > The LobeUI components are developed based on [Antd](https://ant.design/components/overview/), fully compatible with Antd components,
90
+ > and it is recommended to use [antd-style](https://ant-design.github.io/antd-style/) as the default css-in-js styling solution.
91
+
92
+ ```tsx
93
+ import { ThemeProvider, Button } from '@lobehub/ui'
94
+ import { Button } from 'antd'
95
+
96
+ export default () => (
97
+ <ThemeProvider>
98
+ <Button>Hello AIGC</Button>
99
+ </ThemeProvider>
100
+ )
101
+ ```
102
+
103
+ <div align="right">
104
+
105
+ [![][back-to-top]](#readme-top)
106
+
107
+ </div>
108
+
109
+
85
110
  ## ⌨️ Local Development
86
111
 
87
112
  You can use Github Codespaces for online development:
@@ -109,7 +134,7 @@ Contributions of all types are more than welcome, if you are interested in contr
109
134
 
110
135
  [![][pr-welcome-shield]][pr-welcome-link]
111
136
 
112
- [![][contributors-contrib]][contributors-url]
137
+ [![][contributors-contrib]][contributors-link]
113
138
 
114
139
  <div align="right">
115
140
 
@@ -138,18 +163,19 @@ Contributions of all types are more than welcome, if you are interested in contr
138
163
 
139
164
  </details>
140
165
 
141
- Copyright © 2023 [LobeHub][profile-url]. <br />
166
+ Copyright © 2023 [LobeHub][profile-link]. <br />
142
167
  This project is [MIT](./LICENSE) licensed.
143
168
 
144
169
  <!-- LINK GROUP -->
145
170
 
146
171
  [back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
172
+ [banner]: https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/268452017-960ab8a1-e4b7-4648-beb1-77daf4b6034a.png
147
173
  [bun-link]: https://bun.sh
148
174
  [bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun&style=for-the-badge
149
175
  [codespaces-link]: https://codespaces.new/lobehub/lobe-ui
150
176
  [codespaces-shield]: https://github.com/codespaces/badge.svg
151
177
  [contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-ui
152
- [contributors-url]: https://github.com/lobehub/lobe-ui/graphs/contributors
178
+ [contributors-link]: https://github.com/lobehub/lobe-ui/graphs/contributors
153
179
  [discord-link]: https://discord.gg/AYFPHvv2jT
154
180
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
155
181
  [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-ui
@@ -180,6 +206,6 @@ This project is [MIT](./LICENSE) licensed.
180
206
  [npm-release-shield]: https://img.shields.io/npm/v/@lobehub/ui?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
181
207
  [pr-welcome-link]: https://github.com/lobehub/lobe-chat/pulls
182
208
  [pr-welcome-shield]: https://img.shields.io/badge/🤯_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
183
- [profile-url]: https://github.com/lobehub
209
+ [profile-link]: https://github.com/lobehub
184
210
  [vercel-link]: https://ui.lobehub.com
185
211
  [vercel-shield]: https://img.shields.io/website?down_message=offline&label=vercel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https%3A%2F%2Fui.lobehub.com
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface HistoryDividerProps {
3
+ enable?: boolean;
4
+ text?: {
5
+ history?: string;
6
+ };
7
+ }
8
+ declare const HistoryDivider: import("react").NamedExoticComponent<HistoryDividerProps>;
9
+ export default HistoryDivider;
@@ -0,0 +1,25 @@
1
+ import { Divider } from 'antd';
2
+ import { Timer } from 'lucide-react';
3
+ import { memo } from 'react';
4
+ import Icon from "../Icon";
5
+ import Tag from "../Tag";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var HistoryDivider = /*#__PURE__*/memo(function (_ref) {
8
+ var enable = _ref.enable,
9
+ text = _ref.text;
10
+ if (!enable) return null;
11
+ return /*#__PURE__*/_jsx("div", {
12
+ style: {
13
+ padding: '0 20px'
14
+ },
15
+ children: /*#__PURE__*/_jsx(Divider, {
16
+ children: /*#__PURE__*/_jsx(Tag, {
17
+ icon: /*#__PURE__*/_jsx(Icon, {
18
+ icon: Timer
19
+ }),
20
+ children: (text === null || text === void 0 ? void 0 : text.history) || 'History Message'
21
+ })
22
+ })
23
+ });
24
+ });
25
+ export default HistoryDivider;
@@ -45,6 +45,7 @@ export interface ListItemProps {
45
45
  */
46
46
  text?: ChatItemProps['text'] & ActionsBarProps['text'] & {
47
47
  copySuccess?: string;
48
+ history?: string;
48
49
  };
49
50
  /**
50
51
  * @description 聊天列表的类型
@@ -6,6 +6,8 @@ export interface ChatListProps extends DivProps, ListItemProps {
6
6
  * @description Data of chat messages to be displayed
7
7
  */
8
8
  data: ChatMessage[];
9
+ enableHistoryCount?: boolean;
10
+ historyCount?: number;
9
11
  loadingId?: string;
10
12
  }
11
13
  export type { OnActionClick, OnMessageChange, RenderErrorMessage, RenderMessage } from './Item';
@@ -1,13 +1,16 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["onActionClick", "renderMessageExtra", "className", "data", "type", "text", "showTitle", "onMessageChange", "renderMessage", "renderErrorMessage", "loadingId", "renderItem"];
3
+ var _excluded = ["onActionClick", "renderMessageExtra", "className", "data", "type", "text", "showTitle", "onMessageChange", "renderMessage", "renderErrorMessage", "loadingId", "renderItem", "enableHistoryCount", "historyCount"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import { memo } from 'react';
7
7
  import Group from "./Group";
8
+ import HistoryDivider from "./HistoryDivider";
8
9
  import Item from "./Item";
9
10
  import { useStyles } from "./style";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
14
  var ChatList = /*#__PURE__*/memo(function (_ref) {
12
15
  var onActionClick = _ref.onActionClick,
13
16
  MessageExtra = _ref.renderMessageExtra,
@@ -22,6 +25,9 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
22
25
  renderErrorMessage = _ref.renderErrorMessage,
23
26
  loadingId = _ref.loadingId,
24
27
  renderItem = _ref.renderItem,
28
+ enableHistoryCount = _ref.enableHistoryCount,
29
+ _ref$historyCount = _ref.historyCount,
30
+ historyCount = _ref$historyCount === void 0 ? 0 : _ref$historyCount,
25
31
  props = _objectWithoutProperties(_ref, _excluded);
26
32
  var _useStyles = useStyles(),
27
33
  cx = _useStyles.cx,
@@ -29,7 +35,7 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
29
35
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
30
36
  className: cx(styles.container, className)
31
37
  }, props), {}, {
32
- children: data.map(function (item) {
38
+ children: data.map(function (item, index) {
33
39
  var _item$children;
34
40
  var props = {
35
41
  loading: loadingId === item.id,
@@ -43,15 +49,27 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
43
49
  text: text,
44
50
  type: type
45
51
  };
52
+ var historyLength = data.length;
53
+ var enableHistoryDivider = enableHistoryCount && historyLength > historyCount && historyCount === historyLength - index + 1;
46
54
  if (item.children && ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0) {
47
- return /*#__PURE__*/_jsx(Group, {
48
- data: item.children.map(function (childrenItem) {
49
- return _objectSpread(_objectSpread({}, props), childrenItem);
50
- }),
51
- meta: item.meta
52
- }, item.children[0].id);
55
+ return /*#__PURE__*/_jsxs(_Fragment, {
56
+ children: [/*#__PURE__*/_jsx(HistoryDivider, {
57
+ enable: enableHistoryDivider,
58
+ text: text
59
+ }), /*#__PURE__*/_jsx(Group, {
60
+ data: item.children.map(function (childrenItem) {
61
+ return _objectSpread(_objectSpread({}, props), childrenItem);
62
+ }),
63
+ meta: item.meta
64
+ }, item.children[0].id)]
65
+ });
53
66
  }
54
- return /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({}, props), item), item.id);
67
+ return /*#__PURE__*/_jsxs(_Fragment, {
68
+ children: [/*#__PURE__*/_jsx(HistoryDivider, {
69
+ enable: enableHistoryDivider,
70
+ text: text
71
+ }), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({}, props), item), item.id)]
72
+ });
55
73
  })
56
74
  }));
57
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.95.0",
3
+ "version": "1.96.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",