@lobehub/ui 1.148.0 → 1.148.1

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.
@@ -1,8 +1,10 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { ChatItemProps } from "..";
3
+ import type { MarkdownProps } from "../../Markdown";
3
4
  export interface MessageContentProps {
4
5
  editing?: ChatItemProps['editing'];
5
6
  fontSize?: number;
7
+ markdownProps?: Omit<MarkdownProps, 'className' | 'style' | 'children'>;
6
8
  message?: ReactNode;
7
9
  messageExtra?: ChatItemProps['messageExtra'];
8
10
  onChange?: ChatItemProps['onChange'];
@@ -17,7 +17,8 @@ var MessageContent = /*#__PURE__*/memo(function (_ref) {
17
17
  type = _ref.type,
18
18
  primary = _ref.primary,
19
19
  onDoubleClick = _ref.onDoubleClick,
20
- fontSize = _ref.fontSize;
20
+ fontSize = _ref.fontSize,
21
+ markdownProps = _ref.markdownProps;
21
22
  var _useStyles = useStyles({
22
23
  editing: editing,
23
24
  placement: placement,
@@ -36,6 +37,7 @@ var MessageContent = /*#__PURE__*/memo(function (_ref) {
36
37
  editing: editing,
37
38
  fontSize: fontSize,
38
39
  fullFeaturedCodeBlock: true,
40
+ markdownProps: markdownProps,
39
41
  onChange: onChange,
40
42
  onEditingChange: onEditingChange,
41
43
  openModal: mobile ? editing : undefined,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "aboveMessage", "belowMessage"];
5
+ var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "aboveMessage", "belowMessage", "markdownProps"];
6
6
  import { useResponsive } from 'antd-style';
7
7
  import { memo } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
@@ -44,6 +44,7 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
44
44
  fontSize = _ref.fontSize,
45
45
  aboveMessage = _ref.aboveMessage,
46
46
  belowMessage = _ref.belowMessage,
47
+ markdownProps = _ref.markdownProps,
47
48
  rest = _objectWithoutProperties(_ref, _excluded);
48
49
  var _useResponsive = useResponsive(),
49
50
  mobile = _useResponsive.mobile;
@@ -90,6 +91,7 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
90
91
  }) : /*#__PURE__*/_jsx(MessageContent, {
91
92
  editing: editing,
92
93
  fontSize: fontSize,
94
+ markdownProps: markdownProps,
93
95
  message: message,
94
96
  messageExtra: messageExtra,
95
97
  onChange: onChange,
@@ -3,6 +3,7 @@ import { FlexboxProps } from 'react-layout-kit';
3
3
  import { AlertProps } from "../Alert";
4
4
  import { AvatarProps } from "../Avatar";
5
5
  import { EditableMessageProps } from "../EditableMessage";
6
+ import type { MarkdownProps } from "../Markdown";
6
7
  import { DivProps, MetaData } from "../types";
7
8
  export interface ChatItemProps extends Omit<FlexboxProps, 'children' | 'onChange'> {
8
9
  aboveMessage?: ReactNode;
@@ -31,6 +32,7 @@ export interface ChatItemProps extends Omit<FlexboxProps, 'children' | 'onChange
31
32
  * @description Whether the chat item is in loading state
32
33
  */
33
34
  loading?: boolean;
35
+ markdownProps?: Omit<MarkdownProps, 'className' | 'style' | 'children'>;
34
36
  /**
35
37
  * @description The message content of the chat item
36
38
  */
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
+ import { type MarkdownProps } from "../Markdown";
2
3
  import { type MessageInputProps } from "../MessageInput";
3
4
  import { type MessageModalProps } from "../MessageModal";
4
5
  export interface EditableMessageProps {
@@ -26,6 +27,7 @@ export interface EditableMessageProps {
26
27
  fullFeaturedCodeBlock?: boolean;
27
28
  height?: MessageInputProps['height'];
28
29
  inputType?: MessageInputProps['type'];
30
+ markdownProps?: Omit<MarkdownProps, 'className' | 'style' | 'children'>;
29
31
  model?: {
30
32
  extra?: MessageModalProps['extra'];
31
33
  footer?: MessageModalProps['footer'];
@@ -29,7 +29,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
29
29
  text = _ref.text,
30
30
  fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
31
31
  model = _ref.model,
32
- fontSize = _ref.fontSize;
32
+ fontSize = _ref.fontSize,
33
+ markdownProps = _ref.markdownProps;
33
34
  var _useControlledState = useControlledState(false, {
34
35
  onChange: onEditingChange,
35
36
  value: editing
@@ -68,16 +69,17 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
68
69
  });
69
70
  if (!value && showEditWhenEmpty) return input;
70
71
  return /*#__PURE__*/_jsxs(_Fragment, {
71
- children: [!expand && isEdit ? input : /*#__PURE__*/_jsx(Markdown, {
72
+ children: [!expand && isEdit ? input : /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({
72
73
  className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
73
74
  fontSize: fontSize,
74
75
  fullFeaturedCodeBlock: fullFeaturedCodeBlock,
75
76
  style: _objectSpread({
76
77
  height: isAutoSize ? 'unset' : height
77
78
  }, stylesProps === null || stylesProps === void 0 ? void 0 : stylesProps.markdown),
78
- variant: 'chat',
79
+ variant: 'chat'
80
+ }, markdownProps), {}, {
79
81
  children: value || placeholder || ''
80
- }), expand && /*#__PURE__*/_jsx(MessageModal, {
82
+ })), expand && /*#__PURE__*/_jsx(MessageModal, {
81
83
  editing: isEdit,
82
84
  extra: model === null || model === void 0 ? void 0 : model.extra,
83
85
  footer: model === null || model === void 0 ? void 0 : model.footer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.148.0",
3
+ "version": "1.148.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",