@lobehub/ui 1.38.4 → 1.39.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
@@ -53,7 +53,7 @@ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908
53
53
  To install Lobe UI, run the following command:
54
54
 
55
55
  ```bash
56
- pnpm add @lobehub/ui
56
+ pnpm i -S @lobehub/ui
57
57
  ```
58
58
 
59
59
  <div align="right">
@@ -54,5 +54,5 @@ export interface ActionIconProps extends DivProps {
54
54
  */
55
55
  title?: string;
56
56
  }
57
- declare const ActionIcon: import("react").NamedExoticComponent<ActionIconProps>;
57
+ declare const ActionIcon: import("react").ForwardRefExoticComponent<ActionIconProps & import("react").RefAttributes<HTMLDivElement>>;
58
58
  export default ActionIcon;
@@ -4,7 +4,7 @@ var _excluded = ["className", "active", "icon", "size", "style", "glass", "title
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 { Loader2 } from 'lucide-react';
7
- import { memo, useMemo } from 'react';
7
+ import { forwardRef, useMemo } from 'react';
8
8
  import Icon from "../Icon";
9
9
  import Spotlight from "../Spotlight";
10
10
  import Tooltip from "../Tooltip";
@@ -52,7 +52,7 @@ var calcSize = function calcSize(size) {
52
52
  borderRadius: borderRadius
53
53
  };
54
54
  };
55
- var ActionIcon = /*#__PURE__*/memo(function (_ref) {
55
+ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
56
56
  var className = _ref.className,
57
57
  active = _ref.active,
58
58
  icon = _ref.icon,
@@ -94,6 +94,7 @@ var ActionIcon = /*#__PURE__*/memo(function (_ref) {
94
94
  var actionIconBlock = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
95
95
  className: cx(styles.block, className),
96
96
  onClick: loading ? undefined : onClick,
97
+ ref: ref,
97
98
  style: _objectSpread({
98
99
  borderRadius: borderRadius,
99
100
  height: blockSize,
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { DivProps } from "../types";
3
+ export interface ChatHeaderProps extends DivProps {
4
+ gap?: {
5
+ left?: number;
6
+ right?: number;
7
+ };
8
+ left?: ReactNode;
9
+ onBackClick?: () => void;
10
+ right?: ReactNode;
11
+ showBackButton?: boolean;
12
+ }
13
+ declare const ChatHeader: import("react").NamedExoticComponent<ChatHeaderProps>;
14
+ export default ChatHeader;
@@ -0,0 +1,50 @@
1
+ import { ChevronLeft } from 'lucide-react';
2
+ import { memo } from 'react';
3
+ import { Flexbox } from 'react-layout-kit';
4
+ import ActionIcon from "../ActionIcon";
5
+ import { useStyles } from "./style";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ var ChatHeader = /*#__PURE__*/memo(function (_ref) {
9
+ var left = _ref.left,
10
+ right = _ref.right,
11
+ className = _ref.className,
12
+ style = _ref.style,
13
+ showBackButton = _ref.showBackButton,
14
+ onBackClick = _ref.onBackClick,
15
+ gap = _ref.gap;
16
+ var _useStyles = useStyles(),
17
+ cx = _useStyles.cx,
18
+ styles = _useStyles.styles;
19
+ return /*#__PURE__*/_jsxs(Flexbox, {
20
+ align: 'center',
21
+ className: cx(styles.container, className),
22
+ distribution: 'space-between',
23
+ horizontal: true,
24
+ paddingInline: 16,
25
+ style: style,
26
+ children: [/*#__PURE__*/_jsxs(Flexbox, {
27
+ align: 'center',
28
+ gap: (gap === null || gap === void 0 ? void 0 : gap.left) || 12,
29
+ horizontal: true,
30
+ children: [showBackButton && /*#__PURE__*/_jsx(ActionIcon, {
31
+ icon: ChevronLeft,
32
+ onClick: function onClick() {
33
+ return onBackClick === null || onBackClick === void 0 ? void 0 : onBackClick();
34
+ },
35
+ size: {
36
+ fontSize: 24
37
+ },
38
+ style: {
39
+ marginRight: gap !== null && gap !== void 0 && gap.left ? -gap.left / 2 : -6
40
+ }
41
+ }), left]
42
+ }), /*#__PURE__*/_jsx(Flexbox, {
43
+ align: 'center',
44
+ gap: (gap === null || gap === void 0 ? void 0 : gap.right) || 8,
45
+ horizontal: true,
46
+ children: right
47
+ })]
48
+ });
49
+ });
50
+ export default ChatHeader;
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ container: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n grid-area: header;\n height: 64px;\n border-bottom: 1px solid ", ";\n "])), token.colorSplit)
9
+ };
10
+ });
@@ -3,7 +3,7 @@ import { type CollapseProps } from 'antd';
3
3
  import { type ReactNode } from 'react';
4
4
  export interface FormGroupProps extends CollapseProps {
5
5
  children: ReactNode;
6
- icon: IconProps['icon'];
6
+ icon?: IconProps['icon'];
7
7
  title: string;
8
8
  }
9
9
  declare const FormGroup: import("react").NamedExoticComponent<FormGroupProps>;
@@ -26,7 +26,7 @@ var FormGroup = /*#__PURE__*/memo(function (_ref) {
26
26
  key: 1,
27
27
  label: /*#__PURE__*/_jsxs("div", {
28
28
  className: styles.title,
29
- children: [/*#__PURE__*/_jsx(Icon, {
29
+ children: [icon && /*#__PURE__*/_jsx(Icon, {
30
30
  icon: icon
31
31
  }), title]
32
32
  })
@@ -4,7 +4,7 @@ import { type ReactNode } from 'react';
4
4
  import { FormItemProps } from './components/FormItem';
5
5
  export interface ItemGroup {
6
6
  children: FormItemProps[];
7
- icon: LucideIcon;
7
+ icon?: LucideIcon;
8
8
  title: string;
9
9
  }
10
10
  export interface FormProps extends AntFormProps {
package/es/Form/index.js CHANGED
@@ -27,7 +27,7 @@ var Form = /*#__PURE__*/memo(function (_ref) {
27
27
  }, props), {}, {
28
28
  children: [items === null || items === void 0 ? void 0 : items.map(function (group, groupIndex) {
29
29
  return /*#__PURE__*/_jsx(FormGroup, {
30
- icon: group.icon,
30
+ icon: group === null || group === void 0 ? void 0 : group.icon,
31
31
  title: group.title,
32
32
  children: group.children.map(function (item, itemIndex) {
33
33
  return /*#__PURE__*/_jsx(FormItem, _objectSpread({
package/es/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { default as ActionIconGroup, type ActionIconGroupProps } from './ActionI
3
3
  export { default as Avatar, type AvatarProps } from './Avatar';
4
4
  export { default as Burger, type BurgerProps } from './Burger';
5
5
  export type { ChatMessage, MessageRoleType } from './Chat';
6
+ export { default as ChatHeader, type ChatHeaderProps } from './ChatHeader';
6
7
  export { default as ChatInputArea, type ChatInputAreaProps } from './ChatInputArea';
7
8
  export { default as ChatItem, type ChatItemProps } from './ChatItem';
8
9
  export { default as ChatList, type ChatListProps } from './ChatList';
package/es/index.js CHANGED
@@ -2,6 +2,7 @@ export { default as ActionIcon } from "./ActionIcon";
2
2
  export { default as ActionIconGroup } from "./ActionIconGroup";
3
3
  export { default as Avatar } from "./Avatar";
4
4
  export { default as Burger } from "./Burger";
5
+ export { default as ChatHeader } from "./ChatHeader";
5
6
  export { default as ChatInputArea } from "./ChatInputArea";
6
7
  export { default as ChatItem } from "./ChatItem";
7
8
  export { default as ChatList } from "./ChatList";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.38.4",
3
+ "version": "1.39.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",