@copilotkit/react-textarea 1.3.14-fix-handle-execute-agent-error.0 → 1.3.14

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 (53) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/dist/{chunk-UGEKMSRR.mjs → chunk-2VMZ5ZWT.mjs} +5 -1
  3. package/dist/chunk-2VMZ5ZWT.mjs.map +1 -0
  4. package/dist/{chunk-4AMCUMC7.mjs → chunk-4XXU5BSA.mjs} +4 -3
  5. package/dist/{chunk-4AMCUMC7.mjs.map → chunk-4XXU5BSA.mjs.map} +1 -1
  6. package/dist/{chunk-224UKA7C.mjs → chunk-7L6GIHDM.mjs} +2 -1
  7. package/dist/{chunk-224UKA7C.mjs.map → chunk-7L6GIHDM.mjs.map} +1 -1
  8. package/dist/{chunk-I3SPIGAI.mjs → chunk-ABYCGF77.mjs} +2 -2
  9. package/dist/{chunk-CF5GISTC.mjs → chunk-HDBI2WN5.mjs} +2 -2
  10. package/dist/chunk-HDBI2WN5.mjs.map +1 -0
  11. package/dist/{chunk-2FAXLWPD.mjs → chunk-OTBX4FPZ.mjs} +2 -2
  12. package/dist/{chunk-J62KUPFZ.mjs → chunk-PZYM7K4Y.mjs} +4 -3
  13. package/dist/{chunk-J62KUPFZ.mjs.map → chunk-PZYM7K4Y.mjs.map} +1 -1
  14. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +8 -1
  15. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
  16. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +6 -6
  17. package/dist/components/base-copilot-textarea/render-element.js +1 -0
  18. package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
  19. package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
  20. package/dist/components/copilot-textarea/copilot-textarea.js +8 -1
  21. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
  22. package/dist/components/copilot-textarea/copilot-textarea.mjs +7 -7
  23. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +1 -1
  24. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
  25. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
  26. package/dist/components/hovering-toolbar/hovering-toolbar.js +6 -1
  27. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
  28. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +4 -4
  29. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +4 -0
  30. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
  31. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +1 -1
  32. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +4 -0
  33. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
  34. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +2 -2
  35. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +4 -0
  36. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
  37. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +2 -2
  38. package/dist/components/index.js +8 -1
  39. package/dist/components/index.js.map +1 -1
  40. package/dist/components/index.mjs +7 -7
  41. package/dist/index.js +8 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +7 -7
  44. package/package.json +7 -7
  45. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +1 -0
  46. package/src/components/base-copilot-textarea/render-element.tsx +1 -0
  47. package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +1 -1
  48. package/src/components/hovering-toolbar/hovering-toolbar.tsx +1 -0
  49. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +4 -0
  50. package/dist/chunk-CF5GISTC.mjs.map +0 -1
  51. package/dist/chunk-UGEKMSRR.mjs.map +0 -1
  52. /package/dist/{chunk-I3SPIGAI.mjs.map → chunk-ABYCGF77.mjs.map} +0 -0
  53. /package/dist/{chunk-2FAXLWPD.mjs.map → chunk-OTBX4FPZ.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import "./chunk-WADHCMPK.mjs";
4
4
  import "./chunk-MMVDU6DF.mjs";
5
5
  import {
6
6
  CopilotTextarea
7
- } from "./chunk-2FAXLWPD.mjs";
7
+ } from "./chunk-OTBX4FPZ.mjs";
8
8
  import "./chunk-VPGMB7K3.mjs";
9
9
  import "./chunk-BG4GF6PP.mjs";
10
10
  import "./chunk-RUV6NBIF.mjs";
@@ -16,7 +16,7 @@ import "./chunk-MCNXIA4Q.mjs";
16
16
  import "./chunk-GUZIMGGZ.mjs";
17
17
  import {
18
18
  BaseCopilotTextarea
19
- } from "./chunk-J62KUPFZ.mjs";
19
+ } from "./chunk-PZYM7K4Y.mjs";
20
20
  import "./chunk-2C7O2EVM.mjs";
21
21
  import "./chunk-GQN2HYFJ.mjs";
22
22
  import "./chunk-23Q6A46J.mjs";
@@ -27,16 +27,16 @@ import "./chunk-QJNFNPWH.mjs";
27
27
  import "./chunk-5UNJXFUO.mjs";
28
28
  import "./chunk-LQ2OWQU7.mjs";
29
29
  import "./chunk-7LSRNPNI.mjs";
30
- import "./chunk-4AMCUMC7.mjs";
30
+ import "./chunk-4XXU5BSA.mjs";
31
31
  import "./chunk-L7VVZH4Q.mjs";
32
- import "./chunk-I3SPIGAI.mjs";
33
- import "./chunk-UGEKMSRR.mjs";
32
+ import "./chunk-ABYCGF77.mjs";
33
+ import "./chunk-2VMZ5ZWT.mjs";
34
34
  import "./chunk-KMVGEY7Q.mjs";
35
35
  import "./chunk-3PQ7GSFE.mjs";
36
36
  import "./chunk-4PDYALMP.mjs";
37
37
  import "./chunk-D47EKHIF.mjs";
38
38
  import "./chunk-LYB4B6MK.mjs";
39
- import "./chunk-CF5GISTC.mjs";
39
+ import "./chunk-HDBI2WN5.mjs";
40
40
  import "./chunk-WGWQRALG.mjs";
41
41
  import "./chunk-VSVQZUPW.mjs";
42
42
  import "./chunk-I72DKFHD.mjs";
@@ -46,7 +46,7 @@ import "./chunk-WJHSY5T6.mjs";
46
46
  import {
47
47
  defaultBaseAutosuggestionsConfig
48
48
  } from "./chunk-4CVSOOJY.mjs";
49
- import "./chunk-224UKA7C.mjs";
49
+ import "./chunk-7L6GIHDM.mjs";
50
50
  import "./chunk-XW3ICO4S.mjs";
51
51
  import "./chunk-IU3WTXLQ.mjs";
52
52
  import "./chunk-H4VKQGVU.mjs";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.3.14-fix-handle-execute-agent-error.0",
12
+ "version": "1.3.14",
13
13
  "sideEffects": [
14
14
  "**/*.css"
15
15
  ],
@@ -43,9 +43,9 @@
43
43
  "ts-jest": "^29.1.1",
44
44
  "tsup": "^6.7.0",
45
45
  "typescript": "^5.2.3",
46
- "eslint-config-custom": "1.3.14-fix-handle-execute-agent-error.0",
47
- "tailwind-config": "1.3.14-fix-handle-execute-agent-error.0",
48
- "tsconfig": "1.3.14-fix-handle-execute-agent-error.0"
46
+ "eslint-config-custom": "1.3.14",
47
+ "tailwind-config": "1.3.14",
48
+ "tsconfig": "1.3.14"
49
49
  },
50
50
  "dependencies": {
51
51
  "@emotion/css": "^11.11.2",
@@ -67,9 +67,9 @@
67
67
  "slate-history": "^0.93.0",
68
68
  "slate-react": "^0.98.1",
69
69
  "tailwind-merge": "^1.13.2",
70
- "@copilotkit/react-core": "1.3.14-fix-handle-execute-agent-error.0",
71
- "@copilotkit/runtime-client-gql": "1.3.14-fix-handle-execute-agent-error.0",
72
- "@copilotkit/shared": "1.3.14-fix-handle-execute-agent-error.0"
70
+ "@copilotkit/react-core": "1.3.14",
71
+ "@copilotkit/runtime-client-gql": "1.3.14",
72
+ "@copilotkit/shared": "1.3.14"
73
73
  },
74
74
  "keywords": [
75
75
  "copilotkit",
@@ -276,6 +276,7 @@ const BaseCopilotTextareaWithHoveringContext = React.forwardRef(
276
276
  onTouchStart={(event) => {
277
277
  onTouchStartHandlerForAutocomplete(event); // forward the event for internal use
278
278
  }}
279
+ data-testid="copilot-textarea-editable"
279
280
  className={moddedClassName}
280
281
  onBlur={(ev) => {
281
282
  // clear autocompletion on blur
@@ -29,6 +29,7 @@ const SuggestionElement = (
29
29
  style={{
30
30
  ...props.suggestionsStyle,
31
31
  }}
32
+ data-testid="suggestion"
32
33
  contentEditable={false}
33
34
  >
34
35
  {props.children /* https://github.com/ianstormtaylor/slate/issues/3930 */}
@@ -58,7 +58,7 @@ export const Menu = React.forwardRef(
58
58
  return (
59
59
  <div
60
60
  {...props}
61
- data-test-id="menu"
61
+ data-testid="menu"
62
62
  ref={ref as Ref<HTMLDivElement>}
63
63
  className={cx(
64
64
  className,
@@ -112,6 +112,7 @@ export const HoveringToolbar = (props: HoveringToolbarProps) => {
112
112
  (props.hoverMenuClassname ||
113
113
  "p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700")
114
114
  }
115
+ data-testid="hovering-toolbar"
115
116
  >
116
117
  {isDisplayed && selection && (
117
118
  <HoveringInsertionPromptBox
@@ -165,6 +165,7 @@ export const HoveringInsertionPromptBoxCore = ({
165
165
  <Label className="">{adjustmentLabel}</Label>
166
166
  <div className="relative w-full flex items-center">
167
167
  <textarea
168
+ data-testid="adjustment-prompt"
168
169
  disabled={suggestionIsLoading}
169
170
  ref={adjustmentTextAreaRef}
170
171
  value={adjustmentPrompt}
@@ -189,6 +190,7 @@ export const HoveringInsertionPromptBoxCore = ({
189
190
  <button
190
191
  onClick={beginGeneratingAdjustment}
191
192
  className="absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center"
193
+ data-testid="generate-button"
192
194
  >
193
195
  <i className="material-icons">arrow_forward</i>
194
196
  </button>
@@ -216,6 +218,7 @@ export const HoveringInsertionPromptBoxCore = ({
216
218
  </div>
217
219
  </div>
218
220
  <textarea
221
+ data-testid="suggestion-result"
219
222
  ref={suggestionTextAreaRef}
220
223
  value={editSuggestion}
221
224
  disabled={suggestionIsLoading}
@@ -229,6 +232,7 @@ export const HoveringInsertionPromptBoxCore = ({
229
232
  const SubmitComponent = (
230
233
  <div className="flex w-full gap-4 justify-start">
231
234
  <Button
235
+ data-testid="insert-button"
232
236
  className=" bg-green-700 text-white"
233
237
  onClick={() => {
234
238
  performInsertion(editSuggestion);
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/hovering-toolbar/hovering-toolbar-components.tsx"],"sourcesContent":["import { css, cx } from \"@emotion/css\";\nimport React, { PropsWithChildren, Ref } from \"react\";\nimport ReactDOM from \"react-dom\";\n\ninterface BaseProps {\n className: string;\n [key: string]: unknown;\n}\n\nexport const Button = React.forwardRef(\n (\n {\n className,\n active,\n reversed,\n ...props\n }: PropsWithChildren<\n {\n active: boolean;\n reversed: boolean;\n } & BaseProps\n >,\n ref: Ref<HTMLSpanElement | null>,\n ) => (\n <span\n {...props}\n ref={ref as Ref<HTMLSpanElement>}\n className={cx(\n className,\n css`\n cursor: pointer;\n color: ${reversed ? (active ? \"white\" : \"#aaa\") : active ? \"black\" : \"#ccc\"};\n `,\n )}\n />\n ),\n);\n\nexport const Icon = React.forwardRef(\n ({ className, ...props }: PropsWithChildren<BaseProps>, ref: Ref<HTMLSpanElement | null>) => (\n <span\n {...props}\n ref={ref as Ref<HTMLSpanElement>}\n className={cx(\n \"material-icons\",\n className,\n css`\n font-size: 18px;\n vertical-align: text-bottom;\n `,\n )}\n />\n ),\n);\n\nexport const Menu = React.forwardRef(\n ({ className, ...props }: PropsWithChildren<BaseProps>, ref: Ref<HTMLDivElement | null>) => {\n return (\n <div\n {...props}\n data-test-id=\"menu\"\n ref={ref as Ref<HTMLDivElement>}\n className={cx(\n className,\n css`\n & > * {\n display: inline-block;\n }\n\n & > * + * {\n margin-left: 15px;\n }\n `,\n )}\n />\n );\n },\n);\nexport const Portal = ({ children }: { children: React.ReactNode }) => {\n return typeof document === \"object\" ? ReactDOM.createPortal(children, document.body) : null;\n};\n\nexport const Toolbar = React.forwardRef(\n ({ className, ...props }: PropsWithChildren<BaseProps>, ref?: Ref<HTMLDivElement>) => (\n <Menu\n {...props}\n ref={ref}\n className={cx(\n className,\n css`\n position: relative;\n padding: 1px 18px 17px;\n margin: 0 -20px;\n border-bottom: 2px solid #eee;\n margin-bottom: 20px;\n `,\n )}\n />\n ),\n);\n"],"mappings":";;;;;;;AAAA,SAAS,KAAK,UAAU;AACxB,OAAO,WAAuC;AAC9C,OAAO,cAAc;AAsBjB;AAfG,IAAM,SAAS,MAAM;AAAA,EAC1B,CACE,IAWA,QACA;AAZA,iBACE;AAAA;AAAA,MACA;AAAA,MACA;AAAA,IAdN,IAWI,IAIK,kBAJL,IAIK;AAAA,MAHH;AAAA,MACA;AAAA,MACA;AAAA;AAUF;AAAA,MAAC;AAAA,uCACK,QADL;AAAA,QAEC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA;AAAA,mBAEW,WAAY,SAAS,UAAU,SAAU,SAAS,UAAU;AAAA;AAAA,QAEzE;AAAA;AAAA,IACF;AAAA;AAEJ;AAEO,IAAM,OAAO,MAAM;AAAA,EACxB,CAAC,IAAuD,QAAkC;AAAzF,iBAAE,YAvCL,IAuCG,IAAgB,kBAAhB,IAAgB,CAAd;AACD;AAAA,MAAC;AAAA,uCACK,QADL;AAAA,QAEC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA;AAAA;AAAA;AAAA,QAIF;AAAA;AAAA,IACF;AAAA;AAEJ;AAEO,IAAM,OAAO,MAAM;AAAA,EACxB,CAAC,IAAuD,QAAoC;AAA3F,iBAAE,YAxDL,IAwDG,IAAgB,kBAAhB,IAAgB,CAAd;AACD,WACE;AAAA,MAAC;AAAA,uCACK,QADL;AAAA,QAEC,gBAAa;AAAA,QACb;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QASF;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACO,IAAM,SAAS,CAAC,EAAE,SAAS,MAAqC;AACrE,SAAO,OAAO,aAAa,WAAW,SAAS,aAAa,UAAU,SAAS,IAAI,IAAI;AACzF;AAEO,IAAM,UAAU,MAAM;AAAA,EAC3B,CAAC,IAAuD,QAA2B;AAAlF,iBAAE,YAnFL,IAmFG,IAAgB,kBAAhB,IAAgB,CAAd;AACD;AAAA,MAAC;AAAA,uCACK,QADL;AAAA,QAEC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOF;AAAA;AAAA,IACF;AAAA;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx"],"sourcesContent":["import useAutosizeTextArea from \"../../../hooks/misc/use-autosize-textarea\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n} from \"../../../types/base/autosuggestions-bare-function\";\nimport { SourceSearchBox } from \"../../source-search-box/source-search-box\";\nimport { DocumentPointer, useCopilotContext } from \"@copilotkit/react-core\";\nimport { Button } from \"../../ui/button\";\nimport { Label } from \"../../ui/label\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { streamPromiseFlatten } from \"../../../lib/stream-promise-flatten\";\nimport { IncludedFilesPreview } from \"./included-files-preview\";\nimport { useHoveringEditorContext } from \"../hovering-editor-provider\";\n\nexport type SuggestionState = {\n editorState: EditingEditorState;\n};\n\nexport interface HoveringInsertionPromptBoxCoreProps {\n state: SuggestionState;\n performInsertion: (insertedText: string) => void;\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n contextCategories: string[];\n}\n\nexport const HoveringInsertionPromptBoxCore = ({\n performInsertion,\n state,\n insertionOrEditingFunction,\n contextCategories,\n}: HoveringInsertionPromptBoxCoreProps) => {\n const { getDocumentsContext } = useCopilotContext();\n\n const [editSuggestion, setEditSuggestion] = useState<string>(\"\");\n const [suggestionIsLoading, setSuggestionIsLoading] = useState<boolean>(false);\n\n const [adjustmentPrompt, setAdjustmentPrompt] = useState<string>(\"\");\n\n const [generatingSuggestion, setGeneratingSuggestion] = useState<ReadableStream<string> | null>(\n null,\n );\n\n const adjustmentTextAreaRef = useRef<HTMLTextAreaElement>(null);\n const suggestionTextAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [filePointers, setFilePointers] = useState<DocumentPointer[]>([]);\n\n const [suggestedFiles, setSuggestedFiles] = useState<DocumentPointer[]>([]);\n useEffect(() => {\n setSuggestedFiles(getDocumentsContext(contextCategories));\n }, [contextCategories, getDocumentsContext]);\n\n useAutosizeTextArea(suggestionTextAreaRef, editSuggestion || \"\");\n useAutosizeTextArea(adjustmentTextAreaRef, adjustmentPrompt || \"\");\n\n // initially focus on the adjustment prompt text area\n useEffect(() => {\n adjustmentTextAreaRef.current?.focus();\n }, []);\n\n // continuously read the generating suggestion stream and update the edit suggestion\n useEffect(() => {\n // if no generating suggestion, do nothing\n if (!generatingSuggestion) {\n return;\n }\n\n // Check if the stream is already locked (i.e. already reading from it)\n if (generatingSuggestion.locked) {\n return;\n }\n\n // reset the edit suggestion\n setEditSuggestion(\"\");\n\n // read the generating suggestion stream and continuously update the edit suggestion\n const reader = generatingSuggestion.getReader();\n const read = async () => {\n setSuggestionIsLoading(true);\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n setEditSuggestion((prev) => {\n const newSuggestion = prev + value;\n\n // Scroll to the bottom of the textarea. We call this here to make sure scroll-to-bottom is synchronous with the state update.\n if (suggestionTextAreaRef.current) {\n suggestionTextAreaRef.current.scrollTop = suggestionTextAreaRef.current.scrollHeight;\n }\n return newSuggestion;\n });\n }\n\n setSuggestionIsLoading(false);\n };\n read();\n\n return () => {\n // release the lock if the reader is not closed on unmount\n const releaseLockIfNotClosed = async () => {\n try {\n await reader.closed;\n } catch {\n reader.releaseLock();\n }\n };\n\n releaseLockIfNotClosed();\n };\n }, [generatingSuggestion]);\n\n // generate an adjustment to the completed text, based on the adjustment prompt\n const beginGeneratingAdjustment = useCallback(async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n // editor state includes the text being edited, and the text before/after the selection\n // if the current edit suggestion is not empty, then use *it* as the \"selected text\" - instead of the editor state's selected text\n let modificationState = state.editorState;\n if (editSuggestion !== \"\") {\n modificationState.selectedText = editSuggestion;\n }\n\n // generate the adjustment suggestion\n const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(\n modificationState,\n adjustmentPrompt,\n filePointers,\n new AbortController().signal,\n );\n const adjustmentSuggestionTextStream = streamPromiseFlatten(\n adjustmentSuggestionTextStreamPromise,\n );\n\n setGeneratingSuggestion(adjustmentSuggestionTextStream);\n }, [\n adjustmentPrompt,\n editSuggestion,\n state.editorState,\n insertionOrEditingFunction,\n filePointers,\n ]);\n\n const isLoading = suggestionIsLoading;\n\n const textToEdit = editSuggestion || state.editorState.selectedText;\n const adjustmentLabel =\n textToEdit === \"\"\n ? \"Describe the text you want to insert\"\n : \"Describe adjustments to the suggested text\";\n const placeholder =\n textToEdit === \"\"\n ? \"e.g. 'summarize the client's top 3 pain-points from @CallTranscript'\"\n : \"e.g. 'make it more formal', 'be more specific', ...\";\n\n const { setIsDisplayed } = useHoveringEditorContext();\n\n const AdjustmentPromptComponent = (\n <>\n <Label className=\"\">{adjustmentLabel}</Label>\n <div className=\"relative w-full flex items-center\">\n <textarea\n disabled={suggestionIsLoading}\n ref={adjustmentTextAreaRef}\n value={adjustmentPrompt}\n onChange={(e) => setAdjustmentPrompt(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && e.shiftKey) {\n e.preventDefault();\n setAdjustmentPrompt(adjustmentPrompt + \"\\n\");\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n beginGeneratingAdjustment();\n } else if (e.key == \"Escape\") {\n e.preventDefault();\n setIsDisplayed(false);\n }\n }}\n placeholder={placeholder}\n style={{ minHeight: \"3rem\" }}\n className=\"w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]\"\n rows={1}\n />\n <button\n onClick={beginGeneratingAdjustment}\n className=\"absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center\"\n >\n <i className=\"material-icons\">arrow_forward</i>\n </button>\n </div>\n </>\n );\n\n const SuggestionComponent = (\n <>\n <div className=\"flex justify-between items-end w-full\">\n <Label className=\"mt-4\">Suggested:</Label>\n <div className=\"ml-auto\">\n {isLoading && (\n <div className=\"flex justify-center items-center\">\n <div\n 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]\"\n role=\"status\"\n >\n <span className=\"!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]\">\n Loading...\n </span>\n </div>\n </div>\n )}\n </div>\n </div>\n <textarea\n ref={suggestionTextAreaRef}\n value={editSuggestion}\n disabled={suggestionIsLoading}\n onChange={(e) => setEditSuggestion(e.target.value)}\n className=\"w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50\"\n style={{ overflow: \"auto\", maxHeight: \"10em\" }}\n />\n </>\n );\n\n const SubmitComponent = (\n <div className=\"flex w-full gap-4 justify-start\">\n <Button\n className=\" bg-green-700 text-white\"\n onClick={() => {\n performInsertion(editSuggestion);\n }}\n >\n Insert <i className=\"material-icons\">check</i>\n </Button>\n </div>\n );\n\n // show source search if the last word in the adjustment prompt BEGINS with an @\n const sourceSearchCandidate = adjustmentPrompt.split(\" \").pop();\n // if the candidate is @someCandidate, then 'someCandidate', otherwise undefined\n const sourceSearchWord = sourceSearchCandidate?.startsWith(\"@\")\n ? sourceSearchCandidate.slice(1)\n : undefined;\n\n return (\n <div className=\"w-full flex flex-col items-start relative gap-2\">\n {AdjustmentPromptComponent}\n {filePointers.length > 0 && (\n <IncludedFilesPreview includedFiles={filePointers} setIncludedFiles={setFilePointers} />\n )}\n {sourceSearchWord !== undefined && (\n <SourceSearchBox\n searchTerm={sourceSearchWord}\n suggestedFiles={suggestedFiles}\n onSelectedFile={(filePointer) => {\n setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), \"\"));\n setFilePointers((prev) => [...prev, filePointer]);\n\n // focus back on the adjustment prompt, and move the cursor to the end\n adjustmentTextAreaRef.current?.focus();\n }}\n />\n )}\n {generatingSuggestion ? SuggestionComponent : null}\n {generatingSuggestion ? SubmitComponent : null}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAA0B,yBAAyB;AAGnD,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AA0JrD,mBACE,KACA,YAFF;AAzIG,IAAM,iCAAiC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2C;AACzC,QAAM,EAAE,oBAAoB,IAAI,kBAAkB;AAElD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiB,EAAE;AAC/D,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAkB,KAAK;AAE7E,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAiB,EAAE;AAEnE,QAAM,CAAC,sBAAsB,uBAAuB,IAAI;AAAA,IACtD;AAAA,EACF;AAEA,QAAM,wBAAwB,OAA4B,IAAI;AAC9D,QAAM,wBAAwB,OAA4B,IAAI;AAE9D,QAAM,CAAC,cAAc,eAAe,IAAI,SAA4B,CAAC,CAAC;AAEtE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAA4B,CAAC,C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