Skip to content

Commit 4010c99

Browse files
committed
split react-textarea into react-ui component
1 parent 2ebb9cd commit 4010c99

17 files changed

Lines changed: 44 additions & 39 deletions

File tree

examples/next-openai/src/app/components/vacation-notes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotTextarea } from "@copilotkit/react-textarea";
1+
import { CopilotTextarea } from "@copilotkit/react-ui";
22
import { useState } from "react";
33

44
export function VacationNotes(): JSX.Element {

examples/next-openai/src/app/copilot-textarea/page.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import {
44
CopilotProvider,
55
useMakeCopilotReadable,
66
} from "@copilotkit/react-core";
7-
import {
8-
CopilotTextarea,
9-
MinimalChatGPTMessage,
10-
} from "@copilotkit/react-textarea";
11-
import { MakeSystemPrompt } from "@copilotkit/react-textarea/dist/types/autosuggestions-config";
7+
import { CopilotTextarea, MinimalChatGPTMessage } from "@copilotkit/react-ui";
8+
import { MakeSystemPrompt } from "@copilotkit/react-ui";
129
import { useState } from "react";
1310

1411
export default function CopilotTextareaDemo(): JSX.Element {

packages/react-textarea/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"typescript": "^4.9.4"
3939
},
4040
"dependencies": {
41-
"@copilotkit/react-core": "workspace:*",
4241
"ai": "^2.1.22",
4342
"class-variance-authority": "^0.6.1",
4443
"clsx": "^1.2.1",

packages/react-textarea/src/components/copilot-textarea/base-copilot-textarea/base-copilot-textarea.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import {
99
import { Descendant, Editor } from "slate";
1010
import { Editable, Slate } from "slate-react";
1111
import { twMerge } from "tailwind-merge";
12-
import {
13-
AutosuggestionsBareFunction,
14-
useAutosuggestions,
15-
} from "../../../hooks/use-autosuggestions";
12+
import { useAutosuggestions } from "../../../hooks/use-autosuggestions";
13+
import { AutosuggestionsBareFunction } from "../../../types/autosuggestions-bare-function";
1614
import { useCopilotTextareaEditor } from "../../../hooks/use-copilot-textarea-editor";
1715
import {
1816
getFullEditorTextWithNewlines,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { BaseCopilotTextarea } from "./copilot-textarea/base-copilot-textarea/base-copilot-textarea";
2-
export { CopilotTextarea } from "./copilot-textarea/copilot-textarea";
2+
export type { BaseCopilotTextareaProps } from "./copilot-textarea/base-copilot-textarea/base-copilot-textarea";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { useMakeAutosuggestionFunction } from "./make-autosuggestions-function/use-make-standard-autosuggestions-function";
1+
export {};

packages/react-textarea/src/hooks/use-autosuggestions.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ import {
66
EditorAutocompleteState,
77
areEqual_autocompleteState,
88
} from "../types/editor-autocomplete-state";
9+
import { AutosuggestionsBareFunction } from "../types/autosuggestions-bare-function";
910

1011
export interface UseAutosuggestionsResult {
1112
currentAutocompleteSuggestion: AutosuggestionState | null;
1213
onChangeHandler: (newEditorState: EditorAutocompleteState | null) => void;
1314
onKeyDownHandler: (event: React.KeyboardEvent<HTMLDivElement>) => void;
1415
}
1516

16-
export type AutosuggestionsBareFunction = (
17-
textBefore: string,
18-
textAfter: string,
19-
abortSignal: AbortSignal
20-
) => Promise<string>;
21-
2217
export function useAutosuggestions(
2318
debounceTime: number,
2419
acceptAutosuggestionKey: string,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type AutosuggestionsBareFunction = (
2+
textBefore: string,
3+
textAfter: string,
4+
abortSignal: AbortSignal
5+
) => Promise<string>;
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
export type {
2-
AutosuggestionsConfig,
3-
MakeSystemPrompt as MakeSystemMessage,
4-
} from "./autosuggestions-config";
1+
export { defaultBaseAutosuggestionsConfig } from "./base-autosuggestions-config";
52

6-
export type { MinimalChatGPTMessage } from "./MinimalChatGPTMessage";
3+
export type { BaseAutosuggestionsConfig } from "./base-autosuggestions-config";
4+
export type { AutosuggestionsBareFunction } from "./autosuggestions-bare-function";

packages/react-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
},
4040
"dependencies": {
4141
"@copilotkit/react-core": "workspace:*",
42+
"@copilotkit/react-textarea": "workspace:*",
4243
"@heroicons/react": "^2.0.18",
4344
"@radix-ui/react-alert-dialog": "^1.0.4",
4445
"@radix-ui/react-dialog": "^1.0.4",

0 commit comments

Comments
 (0)