listpage-next 0.0.176 → 0.0.177

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.
Files changed (25) hide show
  1. package/dist/demos/demo8.js +28 -43
  2. package/dist/features/ChatClient/components/ChatContent/ClientContentBody.d.ts +0 -2
  3. package/dist/features/ChatClient/components/ChatContent/ClientContentBody.js +3 -4
  4. package/dist/features/ChatClient/components/ChatContent/index.d.ts +0 -2
  5. package/dist/features/ChatClient/components/ChatContent/index.js +3 -4
  6. package/dist/features/ChatClient/components/ChatGuidance/index.d.ts +1 -1
  7. package/dist/features/ChatClient/components/ChatGuidance/index.js +2 -2
  8. package/dist/features/ChatClient/components/ChatGuidance/styles.js +26 -26
  9. package/dist/features/ChatClient/components/ChatPage/ChatPage.d.ts +2 -2
  10. package/dist/features/ChatClient/components/ChatPage/Sider.js +11 -11
  11. package/dist/features/ChatClient/components/ChatSender/index.d.ts +0 -6
  12. package/dist/features/ChatClient/components/ChatSender/index.js +6 -84
  13. package/dist/features/ChatClient/ui/ChatInput/hooks/useTrigger.d.ts +20 -0
  14. package/dist/features/ChatClient/ui/ChatInput/hooks/useTrigger.js +45 -0
  15. package/dist/features/ChatClient/ui/ChatInput/index.d.ts +12 -0
  16. package/dist/features/ChatClient/ui/ChatInput/index.js +73 -0
  17. package/dist/features/ChatClient/{components/ChatSender → ui/ChatInput}/styles.d.ts +0 -2
  18. package/dist/features/ChatClient/ui/ChatInput/styles.js +50 -0
  19. package/dist/features/ChatClient/ui/EditorContent/editor.d.ts +4 -4
  20. package/dist/features/ChatClient/ui/EditorContent/editor.js +28 -0
  21. package/dist/features/ChatClient/ui/EditorContent/extensions/inputSlot/component.js +12 -1
  22. package/dist/features/ChatClient/ui/index.d.ts +1 -0
  23. package/dist/features/ChatClient/ui/index.js +1 -0
  24. package/package.json +1 -1
  25. package/dist/features/ChatClient/components/ChatSender/styles.js +0 -88
@@ -1,52 +1,37 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { ChatPage, ClientContent } from "../features/ChatClient/index.js";
2
+ import { ChatInput } from "../features/ChatClient/index.js";
3
3
  import "../features/ChatClient/components/ChatPage/SimplifyChatPage.js";
4
- const request = {
5
- chat: async ()=>{},
6
- getConversations: async ()=>({
7
- list: [
8
- {
9
- id: '11',
10
- title: 'xxxxxxx'
11
- }
12
- ]
13
- }),
14
- getMessages: ()=>[
15
- {
16
- role: 'user',
17
- content: 'xxxx'
18
- },
19
- {
20
- role: 'assistant',
21
- content: 'xxxx'
22
- }
23
- ]
24
- };
4
+ import { Select } from "antd";
25
5
  const Demo8 = ()=>/*#__PURE__*/ jsx("div", {
26
6
  style: {
27
- width: 1000
7
+ height: 200,
8
+ background: 'transparent'
28
9
  },
29
- children: /*#__PURE__*/ jsx(ChatPage, {
30
- request: request,
31
- render: {
32
- renderMessage (message) {
33
- return /*#__PURE__*/ jsx("div", {
34
- children: message.info.content
35
- });
10
+ children: /*#__PURE__*/ jsx(ChatInput, {
11
+ onSubmit: console.log,
12
+ skills: [
13
+ {
14
+ label: '生成回复建议',
15
+ value: '我是一个<input-slot placeholder="[职业]">程序员</input-slot>'
36
16
  }
37
- },
38
- action: {
39
- onClickConversation: void 0,
40
- onClickNewConversation: void 0,
41
- onRenameConversation: void 0,
42
- onDeleteConversation: void 0
43
- },
44
- children: /*#__PURE__*/ jsx(ClientContent, {
45
- style: {
46
- height: '100%'
47
- },
48
- title: "搜索海量信息,生成研究报告"
49
- })
17
+ ],
18
+ actions: [
19
+ /*#__PURE__*/ jsx(Select, {
20
+ style: {
21
+ width: 130
22
+ },
23
+ options: [
24
+ {
25
+ label: 'DeepSeek V3',
26
+ value: 'DeepSeek V3'
27
+ },
28
+ {
29
+ label: 'DeepSeek R1',
30
+ value: 'DeepSeek R1'
31
+ }
32
+ ]
33
+ }, "model")
34
+ ]
50
35
  })
51
36
  });
52
37
  export { Demo8 };
@@ -3,12 +3,10 @@
3
3
  */
4
4
  import { ChatBubbleListProps } from './BubbleList';
5
5
  import { ChatSenderProps } from '../ChatSender';
6
- import { ReactNode } from 'react';
7
6
  export interface ClientContentBodyProps {
8
7
  senderProps?: ChatSenderProps;
9
8
  bubbleProps?: ChatBubbleListProps;
10
9
  style?: React.CSSProperties;
11
- sender?: ReactNode;
12
10
  }
13
11
  export declare const ClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
14
12
  export declare const SimplifyClientContentBody: (props: ClientContentBodyProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,18 +3,18 @@ import { ChatBubbleList } from "./BubbleList.js";
3
3
  import { ChatSender } from "../ChatSender/index.js";
4
4
  import { styled } from "styled-components";
5
5
  const ClientContentBody = (props)=>{
6
- const { senderProps, bubbleProps, style, sender } = props;
6
+ const { senderProps, bubbleProps, style } = props;
7
7
  return /*#__PURE__*/ jsxs(Content, {
8
8
  style: style,
9
9
  children: [
10
10
  /*#__PURE__*/ jsx(ChatBubbleList, {
11
11
  ...bubbleProps
12
12
  }),
13
- void 0 === sender ? /*#__PURE__*/ jsx(SenderContainer, {
13
+ /*#__PURE__*/ jsx(SenderContainer, {
14
14
  children: /*#__PURE__*/ jsx(ChatSender, {
15
15
  ...senderProps
16
16
  })
17
- }) : sender
17
+ })
18
18
  ]
19
19
  });
20
20
  };
@@ -27,7 +27,6 @@ const SimplifyClientContentBody = (props)=>{
27
27
  ...bubbleProps
28
28
  }),
29
29
  /*#__PURE__*/ jsx(ChatSender, {
30
- mode: "input",
31
30
  ...senderProps
32
31
  })
33
32
  ]
@@ -6,8 +6,6 @@ export interface ClientContentProps {
6
6
  className?: string;
7
7
  extra?: ReactNode;
8
8
  title?: string;
9
- header?: ReactNode;
10
- sender?: ReactNode;
11
9
  onTitleChange?: (title: string) => void;
12
10
  onClickNewConversation?: () => void;
13
11
  loading?: boolean;
@@ -7,19 +7,18 @@ import { ClientContentHeader } from "./ClientContentHeader.js";
7
7
  import { MessageProvider, useChatClientContext } from "../../context/index.js";
8
8
  import { PageLoading } from "../../../../components/PageLayout/index.js";
9
9
  const ClientContentComponent = (props)=>{
10
- const { extra, style, header, sender, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
10
+ const { extra, style, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
11
11
  return /*#__PURE__*/ jsxs(Container, {
12
12
  style: style,
13
13
  className: className,
14
14
  children: [
15
- void 0 === header ? /*#__PURE__*/ jsx(ClientContentHeader, {
15
+ /*#__PURE__*/ jsx(ClientContentHeader, {
16
16
  defaultTitle: title,
17
17
  onTitleChange: onTitleChange,
18
18
  onClickNewConversation: onClickNewConversation,
19
19
  extra: extra
20
- }) : header,
20
+ }),
21
21
  /*#__PURE__*/ jsx(ClientContentBody, {
22
- sender: sender,
23
22
  senderProps: senderProps,
24
23
  bubbleProps: bubbleProps
25
24
  })
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  export interface ChatGuidanceProps {
3
3
  onSubmit?: (value: string) => void;
4
4
  greetingText?: string;
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { PureChatSender } from "../ChatSender/index.js";
4
3
  import { ChatGuidanceContainer, ChatGuidanceContent, GreetingText, SenderContainer } from "./styles.js";
5
4
  import { ClientContentHeader } from "../ChatContent/ClientContentHeader.js";
5
+ import { ChatInput } from "../../ui/index.js";
6
6
  const ChatGuidance = (props)=>{
7
7
  const { greetingText, extra, style, placeholder, offset, onSubmit } = props;
8
8
  return /*#__PURE__*/ jsxs(ChatGuidanceContainer, {
@@ -16,7 +16,7 @@ const ChatGuidance = (props)=>{
16
16
  /*#__PURE__*/ jsx(GreetingText, {
17
17
  children: greetingText
18
18
  }),
19
- /*#__PURE__*/ jsx(PureChatSender, {
19
+ /*#__PURE__*/ jsx(ChatInput, {
20
20
  extra: extra,
21
21
  placeholder: placeholder,
22
22
  onSubmit: onSubmit
@@ -1,43 +1,43 @@
1
1
  import { Tag } from "antd";
2
2
  import styled_components from "styled-components";
3
3
  const GreetingText = styled_components.div`
4
- font-size: 32px;
5
- margin-bottom: 32px;
6
- min-height: 45px;
4
+ font-size: 32px;
5
+ margin-bottom: 32px;
6
+ min-height: 45px;
7
7
 
8
- font-family: Montserrat;
9
- position: relative;
8
+ font-family: Montserrat;
9
+ position: relative;
10
10
 
11
- color: #000000d9;
12
- font-weight: 600;
11
+ color: #000000d9;
12
+ font-weight: 600;
13
13
 
14
- margin-bottom: 32px;
15
- text-align: center;
14
+ margin-bottom: 32px;
15
+ text-align: center;
16
16
  `;
17
17
  const SkillTag = styled_components(Tag)`
18
- color: #0057ff;
19
- margin-right: 4px;
20
- padding: 2px 8px;
21
- font-weight: 600;
22
- line-height: 150%;
18
+ color: #0057ff;
19
+ margin-right: 4px;
20
+ padding: 2px 8px;
21
+ font-weight: 600;
22
+ line-height: 150%;
23
23
 
24
- cursor: pointer;
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;
27
+ width: 100%;
28
+ height: 100%;
29
+ display: flex;
30
+ flex-direction: column;
31
31
  `;
32
32
  const SenderContainer = styled_components.div`
33
- position: relative;
34
- bottom: ${(props)=>props.offset || "10%"};
33
+ position: relative;
34
+ bottom: ${(props)=>props.offset || '10%'};
35
35
  `;
36
36
  const ChatGuidanceContent = styled_components.div`
37
- flex: 1;
38
- display: flex;
39
- flex-direction: column;
40
- align-items: center;
41
- justify-content: center;
37
+ flex: 1;
38
+ display: flex;
39
+ flex-direction: column;
40
+ align-items: center;
41
+ justify-content: center;
42
42
  `;
43
43
  export { ChatGuidanceContainer, ChatGuidanceContent, GreetingText, SenderContainer, SkillTag };
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { BaseMessageInfo, ChatActionEvent, ChatRender, ChatRequest } from "../../context";
1
+ import { ReactNode } from 'react';
2
+ import { BaseMessageInfo, ChatActionEvent, ChatRender, ChatRequest } from '../../context';
3
3
  export interface ChatPageProps<SessionData = any, MessageInfo extends BaseMessageInfo = any> {
4
4
  logo?: string;
5
5
  title?: string;
@@ -34,19 +34,19 @@ const Sider = (props)=>{
34
34
  });
35
35
  };
36
36
  const SiderContainer = styled.div`
37
- width: 280px;
38
- background: #f3f4f6;
39
- border-right: .5px solid #00000014;
37
+ width: 280px;
38
+ background: #f3f4f6;
39
+ border-right: 0.5px solid #00000014;
40
40
 
41
- transition: width 0.2s ease-in-out;
42
- position: relative;
43
- overflow: hidden;
41
+ transition: width 0.2s ease-in-out;
42
+ position: relative;
43
+ overflow: hidden;
44
44
 
45
- display: flex;
46
- flex-direction: column;
47
- flex-shrink: 0;
45
+ display: flex;
46
+ flex-direction: column;
47
+ flex-shrink: 0;
48
48
 
49
- padding: 0 12px;
50
- box-sizing: border-box;
49
+ padding: 0 12px;
50
+ box-sizing: border-box;
51
51
  `;
52
52
  export { Sider };
@@ -3,11 +3,5 @@ export interface ChatSenderProps {
3
3
  placeholder?: string;
4
4
  style?: React.CSSProperties;
5
5
  className?: string;
6
- mode?: 'input' | 'textarea';
7
6
  }
8
7
  export declare const ChatSender: (props: ChatSenderProps) => import("react/jsx-runtime").JSX.Element;
9
- export interface PureChatSenderProps extends ChatSenderProps {
10
- loading?: boolean;
11
- onSubmit?: (message: string) => void;
12
- }
13
- export declare const PureChatSender: (props: PureChatSenderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,10 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
3
- import { Button, Divider, Input } from "antd";
4
- import { ArrowUpOutlined, PauseCircleTwoTone } from "@ant-design/icons";
5
- import { EditorContent } from "../../ui/index.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ChatInput } from "../../ui/index.js";
6
3
  import { useChatClientContext, useMessageContext } from "../../context/index.js";
7
- import { ChatInputBottom, ChatInputContent, ChatInputPanel, MiniChatInputContent, MiniChatInputPanel } from "./styles.js";
8
4
  const ChatSender = (props)=>{
9
5
  const { isRequesting, sendMessage } = useMessageContext();
10
6
  const { bubbleListRef } = useChatClientContext();
11
- const handleClick = async (inputValue)=>{
7
+ const onSubmit = async (inputValue)=>{
12
8
  if (isRequesting) return;
13
9
  sendMessage({
14
10
  role: 'user',
@@ -18,84 +14,10 @@ const ChatSender = (props)=>{
18
14
  });
19
15
  bubbleListRef.current?.scrollToBottom('instant');
20
16
  };
21
- return /*#__PURE__*/ jsx(PureChatSender, {
17
+ return /*#__PURE__*/ jsx(ChatInput, {
22
18
  loading: isRequesting,
23
- onSubmit: handleClick,
19
+ onSubmit: onSubmit,
24
20
  ...props
25
21
  });
26
22
  };
27
- const PureChatSender = (props)=>{
28
- const { style, className, placeholder, extra, loading, onSubmit, mode = 'textarea' } = props;
29
- const ref = useRef(null);
30
- const [inputValue, setInputValue] = useState('');
31
- const handleClick = async ()=>{
32
- onSubmit?.(inputValue);
33
- setInputValue('');
34
- ref.current?.commands.clearContent();
35
- };
36
- const handleKeyDown = (e)=>{
37
- if ('Enter' === e.key && !e.shiftKey) {
38
- e.preventDefault();
39
- if (!loading && inputValue) handleClick();
40
- }
41
- };
42
- if ('input' === mode) return /*#__PURE__*/ jsxs(MiniChatInputPanel, {
43
- style: style,
44
- className: className,
45
- children: [
46
- /*#__PURE__*/ jsx(MiniChatInputContent, {
47
- children: /*#__PURE__*/ jsx(Input.TextArea, {
48
- placeholder: placeholder,
49
- value: inputValue,
50
- onChange: (e)=>setInputValue?.(e.target.value),
51
- onKeyDown: handleKeyDown
52
- })
53
- }),
54
- /*#__PURE__*/ jsx(Button, {
55
- disabled: !inputValue && !loading,
56
- loading: loading,
57
- shape: "circle",
58
- icon: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {}),
59
- type: "primary",
60
- variant: "filled",
61
- onKeyDown: handleKeyDown,
62
- onClick: handleClick
63
- })
64
- ]
65
- });
66
- return /*#__PURE__*/ jsxs(ChatInputPanel, {
67
- style: style,
68
- className: className,
69
- children: [
70
- /*#__PURE__*/ jsx(ChatInputContent, {
71
- children: /*#__PURE__*/ jsx(EditorContent, {
72
- placeholder: placeholder,
73
- editorRef: ref,
74
- onChange: (content)=>setInputValue(content),
75
- onKeyDown: (e)=>handleKeyDown(e)
76
- })
77
- }),
78
- /*#__PURE__*/ jsxs(ChatInputBottom, {
79
- children: [
80
- extra,
81
- extra && /*#__PURE__*/ jsx(Divider, {
82
- variant: "solid",
83
- size: "large",
84
- type: "vertical"
85
- }),
86
- /*#__PURE__*/ jsx(Button, {
87
- disabled: !inputValue && !loading,
88
- loading: loading,
89
- shape: "circle",
90
- icon: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {}),
91
- type: "primary",
92
- variant: "filled",
93
- onKeyDown: handleKeyDown,
94
- onClick: handleClick
95
- })
96
- ]
97
- })
98
- ]
99
- });
100
- };
101
- export { ChatSender, PureChatSender };
23
+ export { ChatSender };
@@ -0,0 +1,20 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import type { KeyboardEvent } from 'react';
3
+ export interface TriggerOptions {
4
+ skills?: {
5
+ label: string;
6
+ value: string;
7
+ }[];
8
+ editor: Editor | null;
9
+ }
10
+ export declare function useTrigger(options: TriggerOptions): {
11
+ menu: import("antd").MenuProps & {
12
+ activeKey?: string | undefined;
13
+ };
14
+ open: boolean;
15
+ onOpenChange: (open: boolean, info: {
16
+ source: "trigger" | "menu";
17
+ }) => void;
18
+ placement: "bottom";
19
+ interceptKeyDown: (e: KeyboardEvent) => boolean | undefined;
20
+ };
@@ -0,0 +1,45 @@
1
+ import { useState } from "react";
2
+ function useTrigger(options) {
3
+ const [open, setOpen] = useState(false);
4
+ const { skills = [], editor } = options;
5
+ const menu = {
6
+ title: '技能',
7
+ items: [
8
+ {
9
+ key: 'title',
10
+ label: '常用技能',
11
+ disabled: true
12
+ },
13
+ ...skills.map((item)=>({
14
+ label: item.label,
15
+ key: item.value,
16
+ onClick: ()=>{
17
+ editor?.commands.setContent(item.value);
18
+ }
19
+ }))
20
+ ]
21
+ };
22
+ const onOpenChange = (open, info)=>{
23
+ setOpen(false);
24
+ };
25
+ const interceptKeyDown = (e)=>{
26
+ const inputValue = editor?.getText() || '';
27
+ if (inputValue.length || !skills.length) return;
28
+ if ('@' === e.key) {
29
+ e.preventDefault();
30
+ e.stopPropagation();
31
+ setOpen(true);
32
+ return true;
33
+ }
34
+ return false;
35
+ };
36
+ const placement = 'bottom';
37
+ return {
38
+ menu,
39
+ open: Boolean(skills.length) && open,
40
+ onOpenChange,
41
+ placement,
42
+ interceptKeyDown
43
+ };
44
+ }
45
+ export { useTrigger };
@@ -0,0 +1,12 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export interface ChatInputProps {
3
+ loading?: boolean;
4
+ onSubmit?: (message: string) => void;
5
+ skills?: any[];
6
+ style?: CSSProperties;
7
+ className?: string;
8
+ placeholder?: string;
9
+ extra?: ReactNode;
10
+ actions?: ReactNode;
11
+ }
12
+ export declare const ChatInput: (props: ChatInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState } from "react";
3
+ import { Button, Divider, Dropdown } from "antd";
4
+ import { ArrowUpOutlined, PauseCircleTwoTone } from "@ant-design/icons";
5
+ import { EditorContent } from "../EditorContent/index.js";
6
+ import { ChatInputBottom, ChatInputContent, ChatInputPanel } from "./styles.js";
7
+ import { useTrigger } from "./hooks/useTrigger.js";
8
+ const ChatInput = (props)=>{
9
+ const { style, className, placeholder, extra, actions, loading, onSubmit, skills = [] } = props;
10
+ const ref = useRef(null);
11
+ const [inputValue, setInputValue] = useState('');
12
+ const { interceptKeyDown, ...triggerProps } = useTrigger({
13
+ skills,
14
+ editor: ref.current
15
+ });
16
+ const handleClickSend = async ()=>{
17
+ onSubmit?.(inputValue);
18
+ setInputValue('');
19
+ ref.current?.commands.clearContent();
20
+ };
21
+ const handleKeyDown = (e)=>{
22
+ if (interceptKeyDown(e)) return;
23
+ if ('Enter' === e.key && !e.shiftKey) {
24
+ e.preventDefault();
25
+ if (!loading && inputValue) handleClickSend();
26
+ }
27
+ };
28
+ return /*#__PURE__*/ jsx(Dropdown, {
29
+ ...triggerProps,
30
+ children: /*#__PURE__*/ jsxs(ChatInputPanel, {
31
+ style: style,
32
+ className: className,
33
+ children: [
34
+ /*#__PURE__*/ jsx(ChatInputContent, {
35
+ children: /*#__PURE__*/ jsx(EditorContent, {
36
+ placeholder: placeholder,
37
+ editorRef: ref,
38
+ onChange: (content)=>setInputValue(content),
39
+ onKeyDown: (e)=>handleKeyDown(e)
40
+ })
41
+ }),
42
+ /*#__PURE__*/ jsxs(ChatInputBottom, {
43
+ children: [
44
+ /*#__PURE__*/ jsx("div", {
45
+ children: actions
46
+ }),
47
+ /*#__PURE__*/ jsxs("div", {
48
+ children: [
49
+ extra,
50
+ extra && /*#__PURE__*/ jsx(Divider, {
51
+ variant: "solid",
52
+ size: "large",
53
+ type: "vertical"
54
+ }),
55
+ /*#__PURE__*/ jsx(Button, {
56
+ type: "primary",
57
+ shape: "circle",
58
+ variant: "filled",
59
+ loading: loading,
60
+ onClick: handleClickSend,
61
+ onKeyDown: handleKeyDown,
62
+ disabled: !inputValue && !loading,
63
+ icon: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(ArrowUpOutlined, {})
64
+ })
65
+ ]
66
+ })
67
+ ]
68
+ })
69
+ ]
70
+ })
71
+ });
72
+ };
73
+ export { ChatInput };
@@ -1,5 +1,3 @@
1
1
  export declare const ChatInputPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const MiniChatInputPanel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const MiniChatInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
2
  export declare const ChatInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
3
  export declare const ChatInputBottom: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,50 @@
1
+ import { styled } from "styled-components";
2
+ const ChatInputPanel = styled.div`
3
+ position: relative;
4
+ max-height: 300px;
5
+ min-height: 120px;
6
+ padding: 12px;
7
+ border-radius: 20px;
8
+ border: 1px solid rgb(107, 164, 238);
9
+ box-shadow: 0 0 20px 0 #c8efff80;
10
+ display: flex;
11
+ flex-direction: column;
12
+
13
+ width: 800px;
14
+ `;
15
+ const ChatInputContent = styled.div`
16
+ outline: none;
17
+ border: none;
18
+ flex-grow: 1;
19
+ max-height: 220px;
20
+ flex-shrink: 1;
21
+ overflow: auto;
22
+ &:focus-visible {
23
+ outline: none;
24
+ }
25
+
26
+ .ant-input {
27
+ border: none;
28
+ outline: none;
29
+ &:hover {
30
+ border: none;
31
+ outline: none;
32
+ box-shadow: none;
33
+ }
34
+ min-height: 60px;
35
+ max-height: 220px;
36
+ resize: none;
37
+ font-size: 16px;
38
+
39
+ background-color: transparent;
40
+ box-shadow: none;
41
+ }
42
+ `;
43
+ const ChatInputBottom = styled.div`
44
+ display: flex;
45
+ justify-content: space-between;
46
+ align-items: center;
47
+
48
+ flex-shrink: 0;
49
+ `;
50
+ export { ChatInputBottom, ChatInputContent, ChatInputPanel };
@@ -1,13 +1,13 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { RefObject } from 'react';
2
+ import { RefObject, FocusEventHandler, KeyboardEventHandler } from 'react';
3
3
  export interface EditorContentProps {
4
4
  placeholder?: string;
5
5
  editorRef?: RefObject<Editor | null>;
6
- onKeyDown?: (e: KeyboardEvent) => void;
6
+ onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
7
7
  onChange?: (content: string) => void;
8
8
  handleKeyDown?: (view: any, event: KeyboardEvent) => boolean;
9
- onFocus?: (event: FocusEvent) => void;
10
- onBlur?: (event: FocusEvent) => void;
9
+ onFocus?: FocusEventHandler<HTMLDivElement>;
10
+ onBlur?: FocusEventHandler<HTMLDivElement>;
11
11
  handleCreate?: () => void;
12
12
  }
13
13
  export declare const EditorContent: (props: EditorContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -92,6 +92,34 @@ const EditorContentStyled = styled_components(EditorContent)`
92
92
  p {
93
93
  margin: 2px 0;
94
94
  }
95
+ .node-inputSlot {
96
+ display: inline-block;
97
+ font-size: 14px;
98
+ line-height: 20px;
99
+ }
100
+ .input-slot-placeholder {
101
+ user-select: none;
102
+ position: absolute;
103
+ top: 2px;
104
+ left: 4px;
105
+ pointer-events: none;
106
+ white-space: pre;
107
+ z-index: 1;
108
+ color: #98cdfd;
109
+ }
110
+ .input-slot-content {
111
+ color: #0064fa;
112
+ }
113
+ .input-slot {
114
+ display: inline-block;
115
+ background-color: #eaf5ff;
116
+ border-radius: 4px;
117
+ padding: 2px 4px;
118
+ position: relative;
119
+ margin: 2px;
120
+ font-weight: 600;
121
+ min-width: 2px;
122
+ }
95
123
  }
96
124
  `;
97
125
  export { editor_EditorContent as EditorContent };
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { NodeViewContent, NodeViewWrapper } from "@tiptap/react";
3
3
  import { useLayoutEffect, useRef, useState } from "react";
4
4
  import { strings } from "../../constants.js";
5
+ import { styled } from "styled-components";
5
6
  const component = (props)=>{
6
7
  const isEmpty = props.node.textContent === strings.ZERO_WIDTH_CHAR;
7
8
  const placeholder = props.node.attrs.placeholder || '';
@@ -36,9 +37,19 @@ const component = (props)=>{
36
37
  }),
37
38
  /*#__PURE__*/ jsx(NodeViewContent, {
38
39
  as: "div",
39
- className: "content"
40
+ className: "input-slot-content"
40
41
  })
41
42
  ]
42
43
  });
43
44
  };
45
+ styled.span``;
46
+ styled(NodeViewWrapper)`
47
+ display: inline-block;
48
+ margin: 2px;
49
+
50
+ .ant-tag {
51
+ margin: 0;
52
+ display: flex;
53
+ }
54
+ `;
44
55
  export { component as default };
@@ -1,5 +1,6 @@
1
1
  export * from './Bubble';
2
2
  export * from './ChatSplitter';
3
3
  export * from './ChatDialog';
4
+ export * from './ChatInput';
4
5
  export * from './EditorContent';
5
6
  export * from './ConversationList';
@@ -1,5 +1,6 @@
1
1
  export * from "./Bubble/index.js";
2
2
  export * from "./ChatSplitter/index.js";
3
3
  export * from "./ChatDialog/index.js";
4
+ export * from "./ChatInput/index.js";
4
5
  export * from "./EditorContent/index.js";
5
6
  export * from "./ConversationList/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.176",
3
+ "version": "0.0.177",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,88 +0,0 @@
1
- import { styled } from "styled-components";
2
- const ChatInputPanel = styled.div`
3
- position: relative;
4
- max-height: 300px;
5
- min-height: 120px;
6
- padding: 12px;
7
- border-radius: 20px;
8
- border: 1px solid rgb(107, 164, 238);
9
- box-shadow: 0 0 20px 0 #c8efff80;
10
- display: flex;
11
- flex-direction: column;
12
-
13
- width: 800px;
14
- `;
15
- const MiniChatInputPanel = styled.div`
16
- background-color: #eee;
17
- display: flex;
18
- border-radius: 20px;
19
- height: 48px;
20
- padding: 8px 16px;
21
- box-sizing: border-box;
22
- width: 100%;
23
- `;
24
- const MiniChatInputContent = styled.div`
25
- outline: none;
26
- border: none;
27
- flex-grow: 1;
28
- max-height: 220px;
29
- flex-shrink: 1;
30
- overflow: auto;
31
- &:focus-visible {
32
- outline: none;
33
- }
34
- .ant-input {
35
- border: none;
36
- outline: none;
37
- &:hover {
38
- border: none;
39
- outline: none;
40
- box-shadow: none;
41
- }
42
- min-height: 32px;
43
- max-height: 32px;
44
- line-height: 32px;
45
- resize: none;
46
- font-size: 16px;
47
- padding: 0;
48
-
49
- background-color: transparent;
50
- box-shadow: none;
51
- }
52
- `;
53
- const ChatInputContent = styled.div`
54
- outline: none;
55
- border: none;
56
- flex-grow: 1;
57
- max-height: 220px;
58
- flex-shrink: 1;
59
- overflow: auto;
60
- &:focus-visible {
61
- outline: none;
62
- }
63
-
64
- .ant-input {
65
- border: none;
66
- outline: none;
67
- &:hover {
68
- border: none;
69
- outline: none;
70
- box-shadow: none;
71
- }
72
- min-height: 60px;
73
- max-height: 220px;
74
- resize: none;
75
- font-size: 16px;
76
-
77
- background-color: transparent;
78
- box-shadow: none;
79
- }
80
- `;
81
- const ChatInputBottom = styled.div`
82
- display: flex;
83
- justify-content: flex-end;
84
- align-items: center;
85
-
86
- flex-shrink: 0;
87
- `;
88
- export { ChatInputBottom, ChatInputContent, ChatInputPanel, MiniChatInputContent, MiniChatInputPanel };