@lobehub/ui 1.72.5 → 1.72.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.
@@ -40,6 +40,7 @@ export interface ChatInputAreaProps extends ActionProps, TextAreaProps {
40
40
  * @param value - The current value of the input area
41
41
  */
42
42
  onSend?: (value: string) => void;
43
+ onStop?: () => void;
43
44
  /**
44
45
  * @description Placeholder text for the input area
45
46
  * @default 'Type something to chat...'
@@ -51,6 +52,7 @@ export interface ChatInputAreaProps extends ActionProps, TextAreaProps {
51
52
  style?: CSSProperties;
52
53
  text?: {
53
54
  send?: string;
55
+ stop?: string;
54
56
  };
55
57
  /**
56
58
  * @description Additional class name for the textarea element
@@ -1,14 +1,15 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "textareaId", "actionsRight"];
4
+ var _excluded = ["text", "textareaClassName", "style", "textareaStyle", "minHeight", "className", "actions", "footer", "expand", "placeholder", "onExpandChange", "onSend", "defaultValue", "loading", "disabled", "onInputChange", "onPressEnter", "onCompositionStart", "onCompositionEnd", "onBlur", "onChange", "textareaId", "actionsRight", "onStop"];
5
5
  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; }
6
6
  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; }
7
7
  import { Button } from 'antd';
8
+ import { Loader2 } from 'lucide-react';
8
9
  import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
10
+ import Icon from "../Icon";
9
11
  import { TextArea } from "../Input";
10
12
  import Action from "./Action";
11
- import InputHighlight from "./InputHighlight";
12
13
  import { useStyles } from "./style";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -29,7 +30,8 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
30
  onSend = _ref.onSend,
30
31
  _ref$defaultValue = _ref.defaultValue,
31
32
  defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
32
- loading = _ref.loading,
33
+ _ref$loading = _ref.loading,
34
+ loading = _ref$loading === void 0 ? false : _ref$loading,
33
35
  disabled = _ref.disabled,
34
36
  onInputChange = _ref.onInputChange,
35
37
  _onPressEnter = _ref.onPressEnter,
@@ -40,6 +42,7 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
40
42
  _ref$textareaId = _ref.textareaId,
41
43
  textareaId = _ref$textareaId === void 0 ? 'lobe-chat-input-area' : _ref$textareaId,
42
44
  actionsRight = _ref.actionsRight,
45
+ onStop = _ref.onStop,
43
46
  props = _objectWithoutProperties(_ref, _excluded);
44
47
  var _useStyles = useStyles(),
45
48
  cx = _useStyles.cx,
@@ -50,7 +53,7 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
50
53
  value = _useState2[0],
51
54
  setValue = _useState2[1];
52
55
  var handleSend = useCallback(function () {
53
- if (disabled) return;
56
+ if (loading && disabled) return;
54
57
  if (onSend) onSend(value);
55
58
  setValue('');
56
59
  }, [disabled, value]);
@@ -67,12 +70,9 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
67
70
  actionsRight: actionsRight,
68
71
  expand: expand,
69
72
  onExpandChange: onExpandChange
70
- }), /*#__PURE__*/_jsxs("div", {
73
+ }), /*#__PURE__*/_jsx("div", {
71
74
  className: styles.textareaContainer,
72
- children: [/*#__PURE__*/_jsx(InputHighlight, {
73
- target: textareaId,
74
- value: value
75
- }), /*#__PURE__*/_jsx(TextArea, _objectSpread(_objectSpread({
75
+ children: /*#__PURE__*/_jsx(TextArea, _objectSpread(_objectSpread({
76
76
  className: cx(styles.textarea, textareaClassName),
77
77
  defaultValue: defaultValue,
78
78
  id: textareaId,
@@ -106,14 +106,21 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
106
106
  resize: false,
107
107
  type: "pure",
108
108
  value: value
109
- }))]
109
+ }))
110
110
  }), /*#__PURE__*/_jsxs("div", {
111
111
  className: styles.footerBar,
112
- children: [footer, /*#__PURE__*/_jsx(Button, {
112
+ children: [footer, loading ? /*#__PURE__*/_jsx(Button, {
113
+ disabled: disabled,
114
+ icon: loading && /*#__PURE__*/_jsx(Icon, {
115
+ icon: Loader2,
116
+ spin: true
117
+ }),
118
+ onClick: onStop,
119
+ children: (text === null || text === void 0 ? void 0 : text.stop) || 'Stop'
120
+ }) : /*#__PURE__*/_jsx(Button, {
113
121
  disabled: disabled,
114
- loading: loading,
115
122
  onClick: handleSend,
116
- type: "primary",
123
+ type: 'primary',
117
124
  children: (text === null || text === void 0 ? void 0 : text.send) || 'Send'
118
125
  })]
119
126
  })]
@@ -4,7 +4,6 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
4
4
  actionsRight: import("antd-style").SerializedStyles;
5
5
  container: import("antd-style").SerializedStyles;
6
6
  footerBar: import("antd-style").SerializedStyles;
7
- highlight: import("antd-style").SerializedStyles;
8
7
  textarea: import("antd-style").SerializedStyles;
9
8
  textareaContainer: import("antd-style").SerializedStyles;
10
9
  }>;
@@ -1,17 +1,15 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref) {
5
- var css = _ref.css,
6
- token = _ref.token;
5
+ var css = _ref.css;
7
6
  return {
8
7
  actionLeft: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n gap: 4px;\n align-items: center;\n justify-content: flex-start;\n "]))),
9
8
  actionsBar: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex: none;\n align-items: center;\n justify-content: space-between;\n\n padding: 0 16px;\n "]))),
10
9
  actionsRight: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0;\n gap: 4px;\n align-items: center;\n justify-content: flex-end;\n "]))),
11
10
  container: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n height: 100%;\n padding: 12px 0 16px;\n "]))),
12
11
  footerBar: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex: none;\n gap: 8px;\n align-items: center;\n justify-content: flex-end;\n\n padding: 0 24px;\n "]))),
13
- highlight: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n inset: 0;\n\n overflow-x: hidden;\n overflow-y: auto;\n\n padding: 0 24px;\n\n .shiki {\n margin: 0;\n }\n\n pre {\n font-family: ", " !important;\n line-height: 1.5;\n color: ", ";\n word-wrap: break-word;\n white-space: pre-wrap;\n }\n "])), token.fontFamilyCode, token.colorSuccess),
14
- textarea: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 100% !important;\n padding: 0 24px;\n\n font-family: ", " !important;\n line-height: 1.5;\n color: transparent;\n\n caret-color: ", ";\n "])), token.fontFamilyCode, token.colorText),
15
- textareaContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n flex: 1;\n "])))
12
+ textarea: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: 100% !important;\n padding: 0 24px;\n line-height: 1.5;\n "]))),
13
+ textareaContainer: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n flex: 1;\n "])))
16
14
  };
17
15
  });
@@ -24,7 +24,7 @@ var Loading = /*#__PURE__*/memo(function (_ref) {
24
24
  styles = _useStyles.styles;
25
25
  var content = /*#__PURE__*/_jsx(EditableMessage, {
26
26
  classNames: {
27
- input: styles.editingInput
27
+ textarea: styles.editingInput
28
28
  },
29
29
  editButtonSize: 'small',
30
30
  editing: editing,
@@ -24,7 +24,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
24
24
  avatarGroupContainer: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), avatarSize),
25
25
  container: cx(type === 'pure' && pureContainerStylish, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex-direction: ", ";\n gap: 12px;\n align-items: flex-start;\n justify-content: revert;\n\n width: 100%;\n padding: 12px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='chat-item-actions'] {\n display: flex;\n }\n\n time,\n div[role='chat-item-actions'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='chat-item-actions'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n "])), placement === 'left' ? 'row' : 'row-reverse', token.motionEaseOut)),
26
26
  editingContainer: cx(css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 8px 12px 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
27
- editingInput: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n min-height: 32px;\n "]))),
27
+ editingInput: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n min-width: 800px !important;\n "]))),
28
28
  loading: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", ";\n bottom: 0;\n left: ", ";\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), placement === 'left' ? '-4px' : 'unset', placement === 'right' ? '-4px' : 'unset', token.colorBgLayout, token.colorPrimary),
29
29
  message: cx(typeStylish, css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n position: relative;\n "])))),
30
30
  messageContainer: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: ", ";\n "])), placement === 'left' ? 'flex-start' : 'flex-end'),
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
+ import { type MessageInputProps } from "../MessageInput";
2
3
  import { type MessageModalProps } from "../MessageModal";
3
4
  export interface EditableMessageProps {
4
5
  /**
@@ -13,13 +14,15 @@ export interface EditableMessageProps {
13
14
  * @title The class name for the Markdown component
14
15
  */
15
16
  markdown?: string;
17
+ textarea?: string;
16
18
  };
17
- editButtonSize?: 'small' | 'middle';
19
+ editButtonSize?: MessageInputProps['editButtonSize'];
18
20
  /**
19
21
  * @title Whether the component is in edit mode or not
20
22
  * @default false
21
23
  */
22
24
  editing?: boolean;
25
+ height?: number;
23
26
  /**
24
27
  * @title Callback function when the value changes
25
28
  * @param value - The new value
@@ -1,4 +1,7 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ 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; }
4
+ 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; }
2
5
  import { memo } from 'react';
3
6
  import useControlledState from 'use-merge-value';
4
7
  import Markdown from "../Markdown";
@@ -21,6 +24,7 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
21
24
  _ref$showEditWhenEmpt = _ref.showEditWhenEmpty,
22
25
  showEditWhenEmpty = _ref$showEditWhenEmpt === void 0 ? false : _ref$showEditWhenEmpt,
23
26
  styles = _ref.styles,
27
+ height = _ref.height,
24
28
  editButtonSize = _ref.editButtonSize,
25
29
  text = _ref.text;
26
30
  var _useControlledState = useControlledState(false, {
@@ -37,10 +41,14 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
37
41
  _useControlledState4 = _slicedToArray(_useControlledState3, 2),
38
42
  expand = _useControlledState4[0],
39
43
  setExpand = _useControlledState4[1];
40
- return !value && showEditWhenEmpty ? /*#__PURE__*/_jsx(MessageInput, {
44
+ var input = /*#__PURE__*/_jsx(MessageInput, {
41
45
  className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
46
+ classNames: {
47
+ textarea: classNames === null || classNames === void 0 ? void 0 : classNames.textarea
48
+ },
42
49
  defaultValue: value,
43
50
  editButtonSize: editButtonSize,
51
+ height: height,
44
52
  onCancel: function onCancel() {
45
53
  return setTyping(false);
46
54
  },
@@ -51,24 +59,16 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
51
59
  placeholder: placeholder,
52
60
  style: styles === null || styles === void 0 ? void 0 : styles.input,
53
61
  text: text
54
- }) : /*#__PURE__*/_jsxs(_Fragment, {
55
- children: [!expand && isEdit ? /*#__PURE__*/_jsx(MessageInput, {
56
- className: classNames === null || classNames === void 0 ? void 0 : classNames.input,
57
- defaultValue: value,
58
- editButtonSize: editButtonSize,
59
- onCancel: function onCancel() {
60
- return setTyping(false);
61
- },
62
- onConfirm: function onConfirm(text) {
63
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
64
- setTyping(false);
65
- },
66
- placeholder: placeholder,
67
- style: styles === null || styles === void 0 ? void 0 : styles.input,
68
- text: text
69
- }) : /*#__PURE__*/_jsx(Markdown, {
62
+ });
63
+ if (!value && showEditWhenEmpty) return input;
64
+ return /*#__PURE__*/_jsxs(_Fragment, {
65
+ children: [!expand && isEdit ? input : /*#__PURE__*/_jsx(Markdown, {
70
66
  className: classNames === null || classNames === void 0 ? void 0 : classNames.markdown,
71
- style: styles === null || styles === void 0 ? void 0 : styles.markdown,
67
+ style: _objectSpread({
68
+ height: height,
69
+ overflowX: 'hidden',
70
+ overflowY: 'auto'
71
+ }, styles === null || styles === void 0 ? void 0 : styles.markdown),
72
72
  children: value || placeholder
73
73
  }), /*#__PURE__*/_jsx(MessageModal, {
74
74
  editing: isEdit,
package/es/Input/style.js CHANGED
@@ -9,6 +9,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
9
9
  var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n transition:\n background-color 100ms ", ",\n border-color 200ms ", ";\n\n &:hover {\n background-color: ", ";\n }\n\n &:focus {\n border-color: ", ";\n }\n\n &.ant-input-affix-wrapper-focused {\n border-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, token.motionEaseOut, token.motionEaseOut, token.colorFillTertiary, token.colorTextQuaternary, token.colorTextQuaternary);
10
10
  return {
11
11
  input: cx(type !== 'pure' && typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n height: ", ";\n padding: ", ";\n\n input {\n background: transparent;\n }\n "])), type === 'pure' ? 'unset' : '36px', type === 'pure' ? '0' : '0 12px')),
12
- textarea: cx(type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n padding: ", ";\n\n textarea {\n background: transparent;\n }\n "])), type === 'pure' ? '0' : '8px 12px'))
12
+ textarea: cx(type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n max-width: 100%;\n padding: ", ";\n border-radius: ", ";\n\n textarea {\n background: transparent;\n }\n "])), type === 'pure' ? '0' : '8px 12px', type === 'pure' ? '0' : "".concat(token.borderRadius, "px")))
13
13
  };
14
14
  });
@@ -7,11 +7,12 @@ export interface MessageInputProps extends DivProps {
7
7
  * @description Additional className to apply to the component.
8
8
  */
9
9
  className?: string;
10
+ classNames?: TextAreaProps['classNames'];
10
11
  /**
11
12
  * @description The default value of the input box.
12
13
  */
13
14
  defaultValue?: string;
14
- editButtonSize?: 'small' | 'middle';
15
+ editButtonSize?: ButtonProps['size'];
15
16
  height?: number | string;
16
17
  /**
17
18
  * @description Callback function triggered when user clicks on the cancel button.
@@ -1,13 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["text", "type", "onCancel", "defaultValue", "onConfirm", "renderButtons", "textareaStyle", "textareaClassname", "placeholder", "height", "editButtonSize"];
4
+ var _excluded = ["text", "type", "onCancel", "defaultValue", "onConfirm", "renderButtons", "textareaStyle", "textareaClassname", "placeholder", "style", "editButtonSize", "classNames"];
5
5
  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; }
6
6
  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; }
7
7
  import { Button } from 'antd';
8
8
  import { memo, useState } from 'react';
9
9
  import { Flexbox } from 'react-layout-kit';
10
- import CodeEditor from "../CodeEditor";
10
+ import { TextArea } from "../Input";
11
11
  import { useStyles } from "./style";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -24,10 +24,10 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
24
24
  textareaClassname = _ref.textareaClassname,
25
25
  _ref$placeholder = _ref.placeholder,
26
26
  placeholder = _ref$placeholder === void 0 ? 'Type something...' : _ref$placeholder,
27
- _ref$height = _ref.height,
28
- height = _ref$height === void 0 ? 'fit-content' : _ref$height,
27
+ style = _ref.style,
29
28
  _ref$editButtonSize = _ref.editButtonSize,
30
29
  editButtonSize = _ref$editButtonSize === void 0 ? 'middle' : _ref$editButtonSize,
30
+ classNames = _ref.classNames,
31
31
  props = _objectWithoutProperties(_ref, _excluded);
32
32
  var _useState = useState(defaultValue || ''),
33
33
  _useState2 = _slicedToArray(_useState, 2),
@@ -36,32 +36,29 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
36
36
  var _useStyles = useStyles(),
37
37
  cx = _useStyles.cx,
38
38
  styles = _useStyles.styles;
39
- return /*#__PURE__*/_jsxs(Flexbox, {
40
- gap: 8,
41
- children: [/*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
42
- gap: 8,
43
- style: {
44
- flex: 1,
45
- width: '100%'
46
- }
47
- }, props), {}, {
48
- children: /*#__PURE__*/_jsx(CodeEditor, {
49
- className: cx(styles, textareaClassname),
50
- language: "md",
51
- onValueChange: function onValueChange(value) {
52
- setRole(value);
53
- },
54
- placeholder: placeholder,
55
- resize: false,
56
- style: _objectSpread({
57
- height: height,
58
- minHeight: '100%'
59
- }, textareaStyle),
60
- textareaClassName: cx(styles, textareaClassname),
61
- type: type,
62
- value: temporarySystemRole
63
- })
64
- })), /*#__PURE__*/_jsx(Flexbox, {
39
+ return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
40
+ gap: 16,
41
+ style: _objectSpread({
42
+ flex: 1,
43
+ width: '100%'
44
+ }, style)
45
+ }, props), {}, {
46
+ children: [/*#__PURE__*/_jsx(TextArea, {
47
+ autoSize: true,
48
+ className: cx(styles, textareaClassname),
49
+ classNames: classNames,
50
+ onBlur: function onBlur(e) {
51
+ return setRole(e.target.value);
52
+ },
53
+ onChange: function onChange(e) {
54
+ return setRole(e.target.value);
55
+ },
56
+ placeholder: placeholder,
57
+ resize: false,
58
+ style: textareaStyle,
59
+ type: type,
60
+ value: temporarySystemRole
61
+ }), /*#__PURE__*/_jsx(Flexbox, {
65
62
  direction: 'horizontal-reverse',
66
63
  gap: 8,
67
64
  children: renderButtons ? renderButtons(temporarySystemRole).map(function (buttonProps, index) {
@@ -83,6 +80,6 @@ var MessageInput = /*#__PURE__*/memo(function (_ref) {
83
80
  })]
84
81
  })
85
82
  })]
86
- });
83
+ }));
87
84
  });
88
85
  export default MessageInput;
@@ -3,5 +3,5 @@ var _templateObject;
3
3
  import { createStyles } from 'antd-style';
4
4
  export var useStyles = createStyles(function (_ref) {
5
5
  var css = _ref.css;
6
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 14px;\n line-height: 1.8;\n "])));
6
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n height: 100%;\n font-size: 14px;\n line-height: 1.8;\n "])));
7
7
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.72.5",
3
+ "version": "1.72.7",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface InputHighlightProps {
3
- target: string;
4
- value: string;
5
- }
6
- declare const InputHighlight: import("react").NamedExoticComponent<InputHighlightProps>;
7
- export default InputHighlight;
@@ -1,39 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { useScroll, useSize } from 'ahooks';
3
- import { memo, useEffect, useRef, useState } from 'react';
4
- import { SyntaxHighlighter } from "../Highlighter";
5
- import { useStyles } from "./style";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- var InputHighlight = /*#__PURE__*/memo(function (_ref) {
8
- var value = _ref.value,
9
- target = _ref.target;
10
- var ref = useRef(null);
11
- var _useState = useState(),
12
- _useState2 = _slicedToArray(_useState, 2),
13
- nativeTextarea = _useState2[0],
14
- setNativeTextarea = _useState2[1];
15
- var _useStyles = useStyles(),
16
- styles = _useStyles.styles;
17
- useEffect(function () {
18
- if (!nativeTextarea) setNativeTextarea(document.querySelector("#".concat(target)));
19
- }, []);
20
- var size = useSize(nativeTextarea);
21
- var scroll = useScroll(nativeTextarea);
22
- useEffect(function () {
23
- ref.current.scroll(0, (scroll === null || scroll === void 0 ? void 0 : scroll.top) || 0);
24
- }, [scroll === null || scroll === void 0 ? void 0 : scroll.top]);
25
- return /*#__PURE__*/_jsx("div", {
26
- className: styles.highlight,
27
- "data-code-type": "highlighter",
28
- ref: ref,
29
- style: {
30
- height: size === null || size === void 0 ? void 0 : size.height,
31
- width: size === null || size === void 0 ? void 0 : size.width
32
- },
33
- children: /*#__PURE__*/_jsx(SyntaxHighlighter, {
34
- language: "markdown",
35
- children: value.trim()
36
- })
37
- });
38
- });
39
- export default InputHighlight;