@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
60 lines (59 loc) • 1.61 kB
JavaScript
"use client";
import DraggablePanel from "../../base-ui/DraggablePanel/DraggablePanel.mjs";
import ChatInputAreaInner from "./components/ChatInputAreaInner.mjs";
import { styles } from "./style.mjs";
import { memo } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { cx } from "antd-style";
//#region src/chat/ChatInputArea/ChatInputArea.tsx
const ChatInputArea = memo(({ ref, className, style, classNames, expand = true, setExpand, bottomAddons, topAddons, onSizeChange, heights, onSend, ...rest }) => {
const content = /* @__PURE__ */ jsxs("section", {
className: styles.container,
style: { minHeight: heights?.minHeight },
children: [
topAddons,
/* @__PURE__ */ jsx("div", {
className: styles.textareaContainer,
children: /* @__PURE__ */ jsx(ChatInputAreaInner, {
className: styles.textarea,
ref,
style: { paddingInline: 16 },
onSend: () => {
onSend?.();
setExpand?.(false);
},
...rest
})
}),
bottomAddons
]
});
if (expand) return /* @__PURE__ */ jsx("div", {
className: cx(styles.fullscreen, className),
style: {
insetBlockStart: heights?.headerHeight ?? 0,
...style
},
children: content
});
return /* @__PURE__ */ jsx(DraggablePanel, {
className,
classNames,
maxHeight: heights?.maxHeight,
minHeight: heights?.minHeight,
placement: "bottom",
size: {
height: heights?.inputHeight,
width: "100%"
},
style: {
zIndex: 10,
...style
},
onSizeChange,
children: content
});
});
//#endregion
export { ChatInputArea as default };
//# sourceMappingURL=ChatInputArea.mjs.map