@copilotkit/react-textarea 0.29.0-alpha.1 → 0.29.0
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.
- package/.turbo/turbo-build.log +428 -428
- package/CHANGELOG.md +16 -0
- package/dist/{chunk-BBZ7AWOB.mjs → chunk-4H2O7MYQ.mjs} +2 -2
- package/dist/{chunk-AZHILHKM.mjs → chunk-DKE57EAC.mjs} +2 -2
- package/dist/{chunk-VB4VNCIQ.mjs → chunk-K7GVTNZU.mjs} +8 -1
- package/dist/chunk-K7GVTNZU.mjs.map +1 -0
- package/dist/{chunk-FP2EKU3L.mjs → chunk-LCDTIJSD.mjs} +3 -3
- package/dist/{chunk-FP2EKU3L.mjs.map → chunk-LCDTIJSD.mjs.map} +1 -1
- package/dist/{chunk-SNQEBH5I.mjs → chunk-PXALH4EC.mjs} +3 -3
- package/dist/{chunk-5J3UZV77.mjs → chunk-W3TDW7EW.mjs} +2 -2
- package/dist/{chunk-B6TKVDDY.mjs → chunk-WGFQTPTF.mjs} +5 -4
- package/dist/chunk-WGFQTPTF.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js +67 -62
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +5 -5
- package/dist/components/copilot-textarea/copilot-textarea.js +67 -62
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +7 -7
- package/dist/components/hovering-toolbar/hovering-toolbar.js +59 -55
- package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +3 -3
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +46 -32
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +2 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +49 -35
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +3 -2
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +49 -35
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +3 -2
- package/dist/components/index.js +67 -62
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -7
- package/dist/index.js +67 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/types/autosuggestions-config/autosuggestions-config.js +2 -2
- package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +2 -2
- package/dist/types/autosuggestions-config/index.js +2 -2
- package/dist/types/autosuggestions-config/index.js.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +2 -2
- package/dist/types/base/base-autosuggestions-config.d.ts +1 -1
- package/dist/types/base/base-autosuggestions-config.js +2 -2
- package/dist/types/base/base-autosuggestions-config.js.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +1 -0
- package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
- package/dist/types/base/index.js +2 -2
- package/dist/types/base/index.js.map +1 -1
- package/dist/types/base/index.mjs +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -2
- package/package.json +6 -6
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +3 -1
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +6 -0
- package/src/types/base/base-autosuggestions-config.tsx +6 -2
- package/src/types/base/base-copilot-textarea-props.tsx +1 -0
- package/dist/chunk-B6TKVDDY.mjs.map +0 -1
- package/dist/chunk-VB4VNCIQ.mjs.map +0 -1
- /package/dist/{chunk-BBZ7AWOB.mjs.map → chunk-4H2O7MYQ.mjs.map} +0 -0
- /package/dist/{chunk-AZHILHKM.mjs.map → chunk-DKE57EAC.mjs.map} +0 -0
- /package/dist/{chunk-SNQEBH5I.mjs.map → chunk-PXALH4EC.mjs.map} +0 -0
- /package/dist/{chunk-5J3UZV77.mjs.map → chunk-W3TDW7EW.mjs.map} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "../chunk-MMVDU6DF.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotTextarea
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-PXALH4EC.mjs";
|
|
5
5
|
import "../chunk-RT4UTBH3.mjs";
|
|
6
6
|
import "../chunk-QCPS6IYI.mjs";
|
|
7
7
|
import "../chunk-RUV6NBIF.mjs";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-DKE57EAC.mjs";
|
|
9
9
|
import "../chunk-4OJ3H65F.mjs";
|
|
10
10
|
import "../chunk-RKQ6RTZM.mjs";
|
|
11
11
|
import "../chunk-KDVMG3XF.mjs";
|
|
12
12
|
import {
|
|
13
13
|
BaseCopilotTextarea
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-WGFQTPTF.mjs";
|
|
15
15
|
import "../chunk-DRV2FOHZ.mjs";
|
|
16
16
|
import "../chunk-4NHVQZ67.mjs";
|
|
17
17
|
import "../chunk-VPEH6V7T.mjs";
|
|
@@ -22,10 +22,10 @@ import "../chunk-72P3KOHZ.mjs";
|
|
|
22
22
|
import "../chunk-JJLQVT7S.mjs";
|
|
23
23
|
import "../chunk-LQ2OWQU7.mjs";
|
|
24
24
|
import "../chunk-7LSRNPNI.mjs";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-W3TDW7EW.mjs";
|
|
26
26
|
import "../chunk-L7VVZH4Q.mjs";
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-4H2O7MYQ.mjs";
|
|
28
|
+
import "../chunk-K7GVTNZU.mjs";
|
|
29
29
|
import "../chunk-SX6NY5FW.mjs";
|
|
30
30
|
import "../chunk-3PQ7GSFE.mjs";
|
|
31
31
|
import "../chunk-WFTAAA7R.mjs";
|
|
@@ -38,7 +38,7 @@ import "../chunk-PTZVE6NC.mjs";
|
|
|
38
38
|
import "../chunk-2QDCE7PD.mjs";
|
|
39
39
|
import "../chunk-7SUZ6CXM.mjs";
|
|
40
40
|
import "../chunk-WJHSY5T6.mjs";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-LCDTIJSD.mjs";
|
|
42
42
|
import "../chunk-224UKA7C.mjs";
|
|
43
43
|
import "../chunk-XW3ICO4S.mjs";
|
|
44
44
|
import "../chunk-M2DR4KVB.mjs";
|
package/dist/index.js
CHANGED
|
@@ -641,8 +641,8 @@ function clearAutocompletionsFromEditor(editor) {
|
|
|
641
641
|
|
|
642
642
|
// src/types/base/base-autosuggestions-config.tsx
|
|
643
643
|
var import_react_core = require("@copilotkit/react-core");
|
|
644
|
-
var defaultShouldToggleHoveringEditorOnKeyPress = (event) => {
|
|
645
|
-
if (event.key ===
|
|
644
|
+
var defaultShouldToggleHoveringEditorOnKeyPress = (event, shortcut) => {
|
|
645
|
+
if (event.key === shortcut && event.metaKey) {
|
|
646
646
|
return true;
|
|
647
647
|
}
|
|
648
648
|
return false;
|
|
@@ -900,7 +900,7 @@ var Label = React4.forwardRef((_a, ref) => {
|
|
|
900
900
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
901
901
|
|
|
902
902
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
903
|
-
var
|
|
903
|
+
var import_react7 = require("react");
|
|
904
904
|
|
|
905
905
|
// src/lib/stream-promise-flatten.ts
|
|
906
906
|
function streamPromiseFlatten(promise) {
|
|
@@ -971,37 +971,51 @@ var FileChipPreview = ({ filePointer, onDelete }) => {
|
|
|
971
971
|
);
|
|
972
972
|
};
|
|
973
973
|
|
|
974
|
-
// src/components/hovering-toolbar/
|
|
974
|
+
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
975
|
+
var import_react6 = require("react");
|
|
975
976
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
977
|
+
var HoveringEditorContext = (0, import_react6.createContext)({
|
|
978
|
+
isDisplayed: false,
|
|
979
|
+
setIsDisplayed: () => {
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
var HoveringEditorProvider = ({ children }) => {
|
|
983
|
+
const [isDisplayed, setIsDisplayed] = (0, import_react6.useState)(false);
|
|
984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
985
|
+
};
|
|
986
|
+
var useHoveringEditorContext = () => (0, import_react6.useContext)(HoveringEditorContext);
|
|
987
|
+
|
|
988
|
+
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
989
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
976
990
|
var HoveringInsertionPromptBoxCore = ({
|
|
977
991
|
performInsertion,
|
|
978
992
|
state,
|
|
979
993
|
insertionOrEditingFunction,
|
|
980
994
|
contextCategories
|
|
981
995
|
}) => {
|
|
982
|
-
const { getDocumentsContext } = (0,
|
|
983
|
-
const [editSuggestion, setEditSuggestion] = (0,
|
|
984
|
-
const [suggestionIsLoading, setSuggestionIsLoading] = (0,
|
|
985
|
-
const [adjustmentPrompt, setAdjustmentPrompt] = (0,
|
|
986
|
-
const [generatingSuggestion, setGeneratingSuggestion] = (0,
|
|
996
|
+
const { getDocumentsContext } = (0, import_react7.useContext)(import_react_core2.CopilotContext);
|
|
997
|
+
const [editSuggestion, setEditSuggestion] = (0, import_react7.useState)("");
|
|
998
|
+
const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react7.useState)(false);
|
|
999
|
+
const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react7.useState)("");
|
|
1000
|
+
const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react7.useState)(
|
|
987
1001
|
null
|
|
988
1002
|
);
|
|
989
|
-
const adjustmentTextAreaRef = (0,
|
|
990
|
-
const suggestionTextAreaRef = (0,
|
|
991
|
-
const [filePointers, setFilePointers] = (0,
|
|
992
|
-
const [suggestedFiles, setSuggestedFiles] = (0,
|
|
993
|
-
(0,
|
|
1003
|
+
const adjustmentTextAreaRef = (0, import_react7.useRef)(null);
|
|
1004
|
+
const suggestionTextAreaRef = (0, import_react7.useRef)(null);
|
|
1005
|
+
const [filePointers, setFilePointers] = (0, import_react7.useState)([]);
|
|
1006
|
+
const [suggestedFiles, setSuggestedFiles] = (0, import_react7.useState)([]);
|
|
1007
|
+
(0, import_react7.useEffect)(() => {
|
|
994
1008
|
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
995
1009
|
}, [contextCategories, getDocumentsContext]);
|
|
996
1010
|
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
997
1011
|
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
998
|
-
(0,
|
|
1012
|
+
(0, import_react7.useEffect)(() => {
|
|
999
1013
|
setTimeout(() => {
|
|
1000
1014
|
var _a;
|
|
1001
1015
|
(_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
|
|
1002
1016
|
}, 0);
|
|
1003
1017
|
}, []);
|
|
1004
|
-
(0,
|
|
1018
|
+
(0, import_react7.useEffect)(() => {
|
|
1005
1019
|
if (!generatingSuggestion) {
|
|
1006
1020
|
return;
|
|
1007
1021
|
}
|
|
@@ -1039,7 +1053,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1039
1053
|
releaseLockIfNotClosed();
|
|
1040
1054
|
};
|
|
1041
1055
|
}, [generatingSuggestion]);
|
|
1042
|
-
const beginGeneratingAdjustment = (0,
|
|
1056
|
+
const beginGeneratingAdjustment = (0, import_react7.useCallback)(() => __async(void 0, null, function* () {
|
|
1043
1057
|
if (!adjustmentPrompt.trim()) {
|
|
1044
1058
|
return;
|
|
1045
1059
|
}
|
|
@@ -1068,10 +1082,11 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1068
1082
|
const textToEdit = editSuggestion || state.editorState.selectedText;
|
|
1069
1083
|
const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
|
|
1070
1084
|
const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
|
|
1085
|
+
const { setIsDisplayed } = useHoveringEditorContext();
|
|
1086
|
+
const AdjustmentPromptComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { className: "", children: adjustmentLabel }),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative w-full flex items-center", children: [
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1075
1090
|
"textarea",
|
|
1076
1091
|
{
|
|
1077
1092
|
disabled: suggestionIsLoading,
|
|
@@ -1085,6 +1100,9 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1085
1100
|
} else if (e.key === "Enter") {
|
|
1086
1101
|
e.preventDefault();
|
|
1087
1102
|
beginGeneratingAdjustment();
|
|
1103
|
+
} else if (e.key == "Escape") {
|
|
1104
|
+
e.preventDefault();
|
|
1105
|
+
setIsDisplayed(false);
|
|
1088
1106
|
}
|
|
1089
1107
|
},
|
|
1090
1108
|
placeholder,
|
|
@@ -1093,29 +1111,29 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1093
1111
|
rows: 1
|
|
1094
1112
|
}
|
|
1095
1113
|
),
|
|
1096
|
-
/* @__PURE__ */ (0,
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1097
1115
|
"button",
|
|
1098
1116
|
{
|
|
1099
1117
|
onClick: beginGeneratingAdjustment,
|
|
1100
1118
|
className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
|
|
1101
|
-
children: /* @__PURE__ */ (0,
|
|
1119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "material-icons", children: "arrow_forward" })
|
|
1102
1120
|
}
|
|
1103
1121
|
)
|
|
1104
1122
|
] })
|
|
1105
1123
|
] });
|
|
1106
|
-
const SuggestionComponent = /* @__PURE__ */ (0,
|
|
1107
|
-
/* @__PURE__ */ (0,
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1124
|
+
const SuggestionComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-between items-end w-full", children: [
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { className: "mt-4", children: "Suggested:" }),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "ml-auto", children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1110
1128
|
"div",
|
|
1111
1129
|
{
|
|
1112
1130
|
className: "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
1113
1131
|
role: "status",
|
|
1114
|
-
children: /* @__PURE__ */ (0,
|
|
1132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]", children: "Loading..." })
|
|
1115
1133
|
}
|
|
1116
1134
|
) }) })
|
|
1117
1135
|
] }),
|
|
1118
|
-
/* @__PURE__ */ (0,
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1119
1137
|
"textarea",
|
|
1120
1138
|
{
|
|
1121
1139
|
ref: suggestionTextAreaRef,
|
|
@@ -1127,7 +1145,7 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1127
1145
|
}
|
|
1128
1146
|
)
|
|
1129
1147
|
] });
|
|
1130
|
-
const SubmitComponent = /* @__PURE__ */ (0,
|
|
1148
|
+
const SubmitComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex w-full gap-4 justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1131
1149
|
Button,
|
|
1132
1150
|
{
|
|
1133
1151
|
className: " bg-green-700 text-white",
|
|
@@ -1136,16 +1154,16 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1136
1154
|
},
|
|
1137
1155
|
children: [
|
|
1138
1156
|
"Insert ",
|
|
1139
|
-
/* @__PURE__ */ (0,
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("i", { className: "material-icons", children: "check" })
|
|
1140
1158
|
]
|
|
1141
1159
|
}
|
|
1142
1160
|
) });
|
|
1143
1161
|
const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
|
|
1144
1162
|
const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
|
|
1145
|
-
return /* @__PURE__ */ (0,
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
|
|
1146
1164
|
AdjustmentPromptComponent,
|
|
1147
|
-
filePointers.length > 0 && /* @__PURE__ */ (0,
|
|
1148
|
-
sourceSearchWord !== void 0 && /* @__PURE__ */ (0,
|
|
1165
|
+
filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IncludedFilesPreview, { includedFiles: filePointers, setIncludedFiles: setFilePointers }),
|
|
1166
|
+
sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1149
1167
|
SourceSearchBox,
|
|
1150
1168
|
{
|
|
1151
1169
|
searchTerm: sourceSearchWord,
|
|
@@ -1164,14 +1182,14 @@ var HoveringInsertionPromptBoxCore = ({
|
|
|
1164
1182
|
};
|
|
1165
1183
|
|
|
1166
1184
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
1167
|
-
var
|
|
1185
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1168
1186
|
var HoveringInsertionPromptBox = (props) => {
|
|
1169
|
-
return /* @__PURE__ */ (0,
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1170
1188
|
"div",
|
|
1171
1189
|
{
|
|
1172
1190
|
className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
|
|
1173
1191
|
style: { width: "35rem" },
|
|
1174
|
-
children: /* @__PURE__ */ (0,
|
|
1192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1175
1193
|
HoveringInsertionPromptBoxCore,
|
|
1176
1194
|
{
|
|
1177
1195
|
state: {
|
|
@@ -1188,10 +1206,10 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
1188
1206
|
|
|
1189
1207
|
// src/components/hovering-toolbar/hovering-toolbar-components.tsx
|
|
1190
1208
|
var import_css = require("@emotion/css");
|
|
1191
|
-
var
|
|
1209
|
+
var import_react8 = __toESM(require("react"));
|
|
1192
1210
|
var import_react_dom = __toESM(require("react-dom"));
|
|
1193
|
-
var
|
|
1194
|
-
var Button2 =
|
|
1211
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1212
|
+
var Button2 = import_react8.default.forwardRef(
|
|
1195
1213
|
(_a, ref) => {
|
|
1196
1214
|
var _b = _a, {
|
|
1197
1215
|
className,
|
|
@@ -1202,7 +1220,7 @@ var Button2 = import_react7.default.forwardRef(
|
|
|
1202
1220
|
"active",
|
|
1203
1221
|
"reversed"
|
|
1204
1222
|
]);
|
|
1205
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1206
1224
|
"span",
|
|
1207
1225
|
__spreadProps(__spreadValues({}, props), {
|
|
1208
1226
|
ref,
|
|
@@ -1217,10 +1235,10 @@ var Button2 = import_react7.default.forwardRef(
|
|
|
1217
1235
|
);
|
|
1218
1236
|
}
|
|
1219
1237
|
);
|
|
1220
|
-
var Icon =
|
|
1238
|
+
var Icon = import_react8.default.forwardRef(
|
|
1221
1239
|
(_a, ref) => {
|
|
1222
1240
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1223
|
-
return /* @__PURE__ */ (0,
|
|
1241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1224
1242
|
"span",
|
|
1225
1243
|
__spreadProps(__spreadValues({}, props), {
|
|
1226
1244
|
ref,
|
|
@@ -1236,10 +1254,10 @@ var Icon = import_react7.default.forwardRef(
|
|
|
1236
1254
|
);
|
|
1237
1255
|
}
|
|
1238
1256
|
);
|
|
1239
|
-
var Menu =
|
|
1257
|
+
var Menu = import_react8.default.forwardRef(
|
|
1240
1258
|
(_a, ref) => {
|
|
1241
1259
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1242
|
-
return /* @__PURE__ */ (0,
|
|
1260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1243
1261
|
"div",
|
|
1244
1262
|
__spreadProps(__spreadValues({}, props), {
|
|
1245
1263
|
"data-test-id": "menu",
|
|
@@ -1263,10 +1281,10 @@ var Menu = import_react7.default.forwardRef(
|
|
|
1263
1281
|
var Portal = ({ children }) => {
|
|
1264
1282
|
return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
|
|
1265
1283
|
};
|
|
1266
|
-
var Toolbar =
|
|
1284
|
+
var Toolbar = import_react8.default.forwardRef(
|
|
1267
1285
|
(_a, ref) => {
|
|
1268
1286
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1269
|
-
return /* @__PURE__ */ (0,
|
|
1287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1270
1288
|
Menu,
|
|
1271
1289
|
__spreadProps(__spreadValues({}, props), {
|
|
1272
1290
|
ref,
|
|
@@ -1285,20 +1303,6 @@ var Toolbar = import_react7.default.forwardRef(
|
|
|
1285
1303
|
}
|
|
1286
1304
|
);
|
|
1287
1305
|
|
|
1288
|
-
// src/components/hovering-toolbar/hovering-editor-provider.tsx
|
|
1289
|
-
var import_react8 = require("react");
|
|
1290
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1291
|
-
var HoveringEditorContext = (0, import_react8.createContext)({
|
|
1292
|
-
isDisplayed: false,
|
|
1293
|
-
setIsDisplayed: () => {
|
|
1294
|
-
}
|
|
1295
|
-
});
|
|
1296
|
-
var HoveringEditorProvider = ({ children }) => {
|
|
1297
|
-
const [isDisplayed, setIsDisplayed] = (0, import_react8.useState)(false);
|
|
1298
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
|
|
1299
|
-
};
|
|
1300
|
-
var useHoveringEditorContext = () => (0, import_react8.useContext)(HoveringEditorContext);
|
|
1301
|
-
|
|
1302
1306
|
// src/components/hovering-toolbar/hovering-toolbar.tsx
|
|
1303
1307
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1304
1308
|
var HoveringToolbar = (props) => {
|
|
@@ -1638,7 +1642,8 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
|
|
|
1638
1642
|
);
|
|
1639
1643
|
const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
|
|
1640
1644
|
(event) => {
|
|
1641
|
-
|
|
1645
|
+
var _a2;
|
|
1646
|
+
if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
|
|
1642
1647
|
event.preventDefault();
|
|
1643
1648
|
setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
|
|
1644
1649
|
}
|