listpage-next 0.0.97 → 0.0.99

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,40 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ChatPage, ClientContent } from "../features/ChatClient/index.js";
3
- const request = {
4
- chat: async ()=>{},
5
- getConversations: async ()=>({
6
- list: [
7
- {
8
- id: '11',
9
- title: 'xxxxxxx'
10
- }
11
- ]
12
- }),
13
- getMessages: ()=>[
14
- {
15
- role: 'user',
16
- content: 'xxxx'
17
- },
18
- {
19
- role: 'assistant',
20
- content: 'xxxx'
21
- }
22
- ]
23
- };
24
- const Demo8 = ()=>/*#__PURE__*/ jsx(ChatPage, {
25
- request: request,
26
- render: {
27
- renderMessage (message) {
28
- return /*#__PURE__*/ jsx("div", {
29
- children: message.info.content
30
- });
31
- }
2
+ import { ChatGuidance } from "../features/ChatClient/index.js";
3
+ const Demo8 = ()=>/*#__PURE__*/ jsx(ChatGuidance, {
4
+ offset: "10%",
5
+ style: {
6
+ width: "100vw",
7
+ height: '100vh'
32
8
  },
33
- children: /*#__PURE__*/ jsx(ClientContent, {
34
- style: {
35
- height: '100%'
36
- },
37
- title: "搜索海量信息,生成研究报告"
38
- })
9
+ greetingText: "搜索海量信息,生成研究报告"
39
10
  });
40
11
  export { Demo8 };
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
2
  export interface ChatGuidanceProps {
3
+ onSubmit?: (value: string) => void;
3
4
  greetingText?: string;
4
5
  extra?: React.ReactNode;
5
- value?: string;
6
- onChange?: (value: string) => void;
7
- onSubmit?: (value: string) => void;
8
- style?: React.CSSProperties;
9
- className?: string;
10
6
  placeholder?: string;
7
+ offset?: string;
8
+ style?: React.CSSProperties;
11
9
  }
12
10
  export declare const ChatGuidance: (props: ChatGuidanceProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,28 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { ChatSender } from "../ChatSender/index.js";
4
- import { ChatGuidanceContainer, GreetingText } from "./styles.js";
3
+ import { PureChatSender } from "../ChatSender/index.js";
4
+ import { ChatGuidanceContainer, ChatGuidanceContent, GreetingText, SenderContainer } from "./styles.js";
5
+ import { Header } from "../ClientContent/Header.js";
5
6
  const ChatGuidance = (props)=>{
6
- const { greetingText, extra, style, onSubmit, className, placeholder } = props;
7
+ const { greetingText, extra, style, placeholder, offset, onSubmit } = props;
7
8
  return /*#__PURE__*/ jsxs(ChatGuidanceContainer, {
8
9
  style: style,
9
- className: className,
10
10
  children: [
11
- /*#__PURE__*/ jsx(GreetingText, {
12
- children: greetingText
13
- }),
14
- /*#__PURE__*/ jsx(ChatSender, {
15
- extra: extra,
16
- placeholder: placeholder
11
+ /*#__PURE__*/ jsx(Header, {}),
12
+ /*#__PURE__*/ jsx(ChatGuidanceContent, {
13
+ children: /*#__PURE__*/ jsxs(SenderContainer, {
14
+ offset: offset,
15
+ children: [
16
+ /*#__PURE__*/ jsx(GreetingText, {
17
+ children: greetingText
18
+ }),
19
+ /*#__PURE__*/ jsx(PureChatSender, {
20
+ extra: extra,
21
+ placeholder: placeholder,
22
+ onSubmit: onSubmit
23
+ })
24
+ ]
25
+ })
17
26
  })
18
27
  ]
19
28
  });
@@ -1,3 +1,7 @@
1
1
  export declare const GreetingText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
2
  export declare const SkillTag: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("antd").TagProps & import("react").RefAttributes<HTMLSpanElement>, never>> & string & Omit<import("antd").TagType, keyof import("react").Component<any, {}, any>>;
3
3
  export declare const ChatGuidanceContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const SenderContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
5
+ offset?: string;
6
+ }>> & string;
7
+ export declare const ChatGuidanceContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -24,8 +24,20 @@ const SkillTag = styled_components(Tag)`
24
24
  cursor: pointer;
25
25
  `;
26
26
  const ChatGuidanceContainer = styled_components.div`
27
+ width: 100%;
28
+ height: 100%;
29
+ display: flex;
30
+ flex-direction: column;
31
+ `;
32
+ const SenderContainer = styled_components.div`
33
+ position: relative;
34
+ bottom: ${(props)=>props.offset || "10%"};
35
+ `;
36
+ const ChatGuidanceContent = styled_components.div`
37
+ flex: 1;
27
38
  display: flex;
28
39
  flex-direction: column;
29
40
  align-items: center;
41
+ justify-content: center;
30
42
  `;
31
- export { ChatGuidanceContainer, GreetingText, SkillTag };
43
+ export { ChatGuidanceContainer, ChatGuidanceContent, GreetingText, SenderContainer, SkillTag };
@@ -5,3 +5,8 @@ export interface ChatSenderProps {
5
5
  className?: string;
6
6
  }
7
7
  export declare const ChatSender: (props: ChatSenderProps) => import("react/jsx-runtime").JSX.Element;
8
+ export interface PureChatSenderProps extends ChatSenderProps {
9
+ loading?: boolean;
10
+ onSubmit?: (message: string) => void;
11
+ }
12
+ export declare const PureChatSender: (props: PureChatSenderProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,11 +5,9 @@ import { ArrowUpOutlined, PauseCircleTwoTone } from "@ant-design/icons";
5
5
  import { useChatClientContext, useMessageContext } from "../../context/index.js";
6
6
  import { ChatInputBottom, ChatInputContent, ChatInputPanel } from "./styles.js";
7
7
  const ChatSender = (props)=>{
8
- const { placeholder, extra, style, className } = props;
9
8
  const { isRequesting, sendMessage } = useMessageContext();
10
- const [inputValue, setInputValue] = useState("");
11
9
  const { bubbleListRef } = useChatClientContext();
12
- const handleClick = async ()=>{
10
+ const handleClick = async (inputValue)=>{
13
11
  if (isRequesting) return;
14
12
  sendMessage({
15
13
  role: 'user',
@@ -17,13 +15,25 @@ const ChatSender = (props)=>{
17
15
  }, ()=>{
18
16
  bubbleListRef.current?.scrollToBottomWhenAtBottom('instant');
19
17
  });
20
- setInputValue("");
21
18
  bubbleListRef.current?.scrollToBottom('instant');
22
19
  };
20
+ return /*#__PURE__*/ jsx(PureChatSender, {
21
+ loading: isRequesting,
22
+ onSubmit: handleClick,
23
+ ...props
24
+ });
25
+ };
26
+ const PureChatSender = (props)=>{
27
+ const { style, className, placeholder, extra, loading, onSubmit } = props;
28
+ const [inputValue, setInputValue] = useState("");
29
+ const handleClick = async ()=>{
30
+ onSubmit?.(inputValue);
31
+ setInputValue("");
32
+ };
23
33
  const handleKeyDown = (e)=>{
24
34
  if ('Enter' === e.key && !e.shiftKey) {
25
35
  e.preventDefault();
26
- if (!isRequesting && inputValue) handleClick();
36
+ if (!loading && inputValue) handleClick();
27
37
  }
28
38
  };
29
39
  return /*#__PURE__*/ jsxs(ChatInputPanel, {
@@ -48,10 +58,10 @@ const ChatSender = (props)=>{
48
58
  type: "vertical"
49
59
  }),
50
60
  /*#__PURE__*/ jsx(Button, {
51
- disabled: !inputValue && !isRequesting,
52
- loading: isRequesting,
61
+ disabled: !inputValue && !loading,
62
+ loading: loading,
53
63
  shape: "circle",
54
- icon: isRequesting ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {}),
64
+ icon: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {}),
55
65
  type: "primary",
56
66
  variant: "filled",
57
67
  onKeyDown: handleKeyDown,
@@ -62,4 +72,4 @@ const ChatSender = (props)=>{
62
72
  ]
63
73
  });
64
74
  };
65
- export { ChatSender };
75
+ export { ChatSender, PureChatSender };
@@ -21,7 +21,5 @@ const SenderContainer = styled_components.div`
21
21
  display: flex;
22
22
  justify-content: center;
23
23
  width: 100%;
24
-
25
-
26
24
  `;
27
25
  export { Container, Content, SenderContainer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.97",
3
+ "version": "0.0.99",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",