@copilotkit/react-ui 1.4.6 → 1.4.8-next.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +85 -8
  2. package/dist/{chunk-4T3TMQNJ.mjs → chunk-BH6PCAAL.mjs} +38 -2
  3. package/dist/chunk-BH6PCAAL.mjs.map +1 -0
  4. package/dist/{chunk-63ZKP62F.mjs → chunk-E5SSVET3.mjs} +3 -3
  5. package/dist/{chunk-4LUMV4YO.mjs → chunk-EMQEEXUB.mjs} +8 -3
  6. package/dist/chunk-EMQEEXUB.mjs.map +1 -0
  7. package/dist/{chunk-VYKDFXGS.mjs → chunk-FUDBUYBG.mjs} +2 -2
  8. package/dist/chunk-ICGZEGHQ.mjs +155 -0
  9. package/dist/chunk-ICGZEGHQ.mjs.map +1 -0
  10. package/dist/{chunk-DHGDU64D.mjs → chunk-T35X2SFE.mjs} +3 -3
  11. package/dist/{chunk-2B57NCBA.mjs → chunk-TTYR7XPN.mjs} +2 -2
  12. package/dist/{chunk-TKFQ7VQR.mjs → chunk-ZQFKJLQ6.mjs} +2 -2
  13. package/dist/components/chat/Chat.js +123 -4
  14. package/dist/components/chat/Chat.js.map +1 -1
  15. package/dist/components/chat/Chat.mjs +5 -5
  16. package/dist/components/chat/Input.js +7 -2
  17. package/dist/components/chat/Input.js.map +1 -1
  18. package/dist/components/chat/Input.mjs +1 -1
  19. package/dist/components/chat/Modal.js +123 -4
  20. package/dist/components/chat/Modal.js.map +1 -1
  21. package/dist/components/chat/Modal.mjs +6 -6
  22. package/dist/components/chat/Popup.js +123 -4
  23. package/dist/components/chat/Popup.js.map +1 -1
  24. package/dist/components/chat/Popup.mjs +7 -7
  25. package/dist/components/chat/Sidebar.js +123 -4
  26. package/dist/components/chat/Sidebar.js.map +1 -1
  27. package/dist/components/chat/Sidebar.mjs +7 -7
  28. package/dist/components/chat/index.js +123 -4
  29. package/dist/components/chat/index.js.map +1 -1
  30. package/dist/components/chat/index.mjs +8 -8
  31. package/dist/components/dev-console/console.js +116 -2
  32. package/dist/components/dev-console/console.js.map +1 -1
  33. package/dist/components/dev-console/console.mjs +3 -3
  34. package/dist/components/dev-console/index.js +116 -2
  35. package/dist/components/dev-console/index.js.map +1 -1
  36. package/dist/components/dev-console/index.mjs +3 -3
  37. package/dist/components/help-modal/icons.d.ts +4 -1
  38. package/dist/components/help-modal/icons.js +39 -2
  39. package/dist/components/help-modal/icons.js.map +1 -1
  40. package/dist/components/help-modal/icons.mjs +5 -3
  41. package/dist/components/help-modal/index.js +136 -2
  42. package/dist/components/help-modal/index.js.map +1 -1
  43. package/dist/components/help-modal/index.mjs +2 -2
  44. package/dist/components/help-modal/modal.js +136 -2
  45. package/dist/components/help-modal/modal.js.map +1 -1
  46. package/dist/components/help-modal/modal.mjs +2 -2
  47. package/dist/components/index.js +123 -4
  48. package/dist/components/index.js.map +1 -1
  49. package/dist/components/index.mjs +8 -8
  50. package/dist/index.js +123 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +8 -8
  53. package/package.json +4 -4
  54. package/src/components/chat/Input.tsx +9 -2
  55. package/src/components/help-modal/icons.tsx +28 -0
  56. package/src/components/help-modal/modal.tsx +90 -27
  57. package/dist/chunk-4LUMV4YO.mjs.map +0 -1
  58. package/dist/chunk-4T3TMQNJ.mjs.map +0 -1
  59. package/dist/chunk-WOUWNTAV.mjs +0 -72
  60. package/dist/chunk-WOUWNTAV.mjs.map +0 -1
  61. /package/dist/{chunk-63ZKP62F.mjs.map → chunk-E5SSVET3.mjs.map} +0 -0
  62. /package/dist/{chunk-VYKDFXGS.mjs.map → chunk-FUDBUYBG.mjs.map} +0 -0
  63. /package/dist/{chunk-DHGDU64D.mjs.map → chunk-T35X2SFE.mjs.map} +0 -0
  64. /package/dist/{chunk-2B57NCBA.mjs.map → chunk-TTYR7XPN.mjs.map} +0 -0
  65. /package/dist/{chunk-TKFQ7VQR.mjs.map → chunk-ZQFKJLQ6.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,35 +1,112 @@
1
1
  # ui
2
2
 
3
+ ## 1.4.8-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ea0c5d5: - fix: prevent sending empty messages via Enter key
8
+
9
+ When the input field was empty, pressing Enter would still trigger the
10
+ send() function despite the send button being correctly disabled. Added
11
+ the sendDisabled check to the onKeyDown handler to ensure consistent
12
+ validation between button and keyboard triggers.
13
+
14
+ - Added validation check to Enter key handler
15
+ - Ensures empty messages can't be sent via keyboard shortcut
16
+ - Makes behavior consistent with disabled send button state
17
+
18
+ Resolves #1129
19
+
20
+ - @copilotkit/react-core@1.4.8-next.0
21
+ - @copilotkit/runtime-client-gql@1.4.8-next.0
22
+ - @copilotkit/shared@1.4.8-next.0
23
+
24
+ ## 1.4.7
25
+
26
+ ### Patch Changes
27
+
28
+ - Fix broken build script before release
29
+ - Updated dependencies
30
+ - @copilotkit/react-core@1.4.7
31
+ - @copilotkit/runtime-client-gql@1.4.7
32
+ - @copilotkit/shared@1.4.7
33
+
3
34
  ## 1.4.6
4
35
 
5
36
  ### Patch Changes
6
37
 
7
38
  - .
8
- - Updated dependencies
9
- - @copilotkit/runtime-client-gql@1.4.6
10
- - @copilotkit/react-core@1.4.6
11
- - @copilotkit/shared@1.4.6
12
39
 
13
40
  ## 1.4.5
14
41
 
15
42
  ### Patch Changes
16
43
 
17
- - .
44
+ - testing release workflow
18
45
  - Updated dependencies
19
- - @copilotkit/runtime-client-gql@1.4.5
20
46
  - @copilotkit/react-core@1.4.5
47
+ - @copilotkit/runtime-client-gql@1.4.5
21
48
  - @copilotkit/shared@1.4.5
22
49
 
23
- ## 1.4.4
50
+ ## 1.4.5-next.0
24
51
 
25
52
  ### Patch Changes
26
53
 
27
- - .
54
+ - testing release workflow
28
55
  - Updated dependencies
56
+ - @copilotkit/react-core@1.4.5-next.0
57
+ - @copilotkit/runtime-client-gql@1.4.5-next.0
58
+ - @copilotkit/shared@1.4.5-next.0
59
+
60
+ ## 1.4.4
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [e35e6ad]
29
65
  - @copilotkit/react-core@1.4.4
30
66
  - @copilotkit/runtime-client-gql@1.4.4
31
67
  - @copilotkit/shared@1.4.4
32
68
 
69
+ ## 1.4.4-next.4
70
+
71
+ ### Patch Changes
72
+
73
+ - @copilotkit/runtime-client-gql@1.4.4-next.4
74
+ - @copilotkit/react-core@1.4.4-next.4
75
+ - @copilotkit/shared@1.4.4-next.4
76
+
77
+ ## 1.4.4-next.3
78
+
79
+ ### Patch Changes
80
+
81
+ - @copilotkit/runtime-client-gql@1.4.4-next.3
82
+ - @copilotkit/react-core@1.4.4-next.3
83
+ - @copilotkit/shared@1.4.4-next.3
84
+
85
+ ## 1.4.4-next.2
86
+
87
+ ### Patch Changes
88
+
89
+ - @copilotkit/runtime-client-gql@1.4.4-next.2
90
+ - @copilotkit/react-core@1.4.4-next.2
91
+ - @copilotkit/shared@1.4.4-next.2
92
+
93
+ ## 1.4.4-next.1
94
+
95
+ ### Patch Changes
96
+
97
+ - @copilotkit/runtime-client-gql@1.4.4-next.1
98
+ - @copilotkit/react-core@1.4.4-next.1
99
+ - @copilotkit/shared@1.4.4-next.1
100
+
101
+ ## 1.4.4-next.0
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies [e35e6ad]
106
+ - @copilotkit/react-core@1.4.4-next.0
107
+ - @copilotkit/runtime-client-gql@1.4.4-next.0
108
+ - @copilotkit/shared@1.4.4-next.0
109
+
33
110
  ## 1.4.3
34
111
 
35
112
  ### Patch Changes
@@ -37,9 +37,45 @@ var CloseIcon = () => /* @__PURE__ */ jsx(
37
37
  children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
38
38
  }
39
39
  );
40
+ var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ jsxs(
41
+ "svg",
42
+ {
43
+ style: {
44
+ animation: "copilotKitSpinAnimation 1s linear infinite",
45
+ color
46
+ },
47
+ width: "24",
48
+ height: "24",
49
+ xmlns: "http://www.w3.org/2000/svg",
50
+ fill: "none",
51
+ viewBox: "0 0 24 24",
52
+ children: [
53
+ /* @__PURE__ */ jsx(
54
+ "circle",
55
+ {
56
+ style: { opacity: 0.25 },
57
+ cx: "12",
58
+ cy: "12",
59
+ r: "10",
60
+ stroke: "currentColor",
61
+ strokeWidth: "4"
62
+ }
63
+ ),
64
+ /* @__PURE__ */ jsx(
65
+ "path",
66
+ {
67
+ style: { opacity: 0.75 },
68
+ fill: "currentColor",
69
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ );
40
75
 
41
76
  export {
42
77
  LifeBuoyIcon,
43
- CloseIcon
78
+ CloseIcon,
79
+ LoadingSpinnerIcon
44
80
  };
45
- //# sourceMappingURL=chunk-4T3TMQNJ.mjs.map
81
+ //# sourceMappingURL=chunk-BH6PCAAL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/help-modal/icons.tsx"],"sourcesContent":["import React from \"react\";\n\nexport const LifeBuoyIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy\"\n >\n <g transform=\"translate(0, -1)\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0\" />\n <path d=\"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0\" />\n <path d=\"M15 15l3.35 3.35\" />\n <path d=\"M9 15l-3.35 3.35\" />\n <path d=\"M5.65 5.65l3.35 3.35\" />\n <path d=\"M18.35 5.65l-3.35 3.35\" />\n </g>\n </svg>\n);\n\nexport const CloseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"20\"\n height=\"20\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const LoadingSpinnerIcon = ({ color = \"rgb(107 114 128)\" }: { color?: string }) => (\n <svg\n style={{\n animation: \"copilotKitSpinAnimation 1s linear infinite\",\n color,\n }}\n width=\"24\"\n height=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle\n style={{ opacity: 0.25 }}\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n ></circle>\n <path\n style={{ opacity: 0.75 }}\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n ></path>\n </svg>\n);\n"],"mappings":";AAeI,SACE,KADF;AAbG,IAAM,eAAe,MAC1B;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,WAAU;AAAA,IAEV,+BAAC,OAAE,WAAU,oBACX;AAAA,0BAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,oBAAC,UAAK,GAAE,4CAA2C;AAAA,MACnD,oBAAC,UAAK,GAAE,8CAA6C;AAAA,MACrD,oBAAC,UAAK,GAAE,oBAAmB;AAAA,MAC3B,oBAAC,UAAK,GAAE,oBAAmB;AAAA,MAC3B,oBAAC,UAAK,GAAE,wBAAuB;AAAA,MAC/B,oBAAC,UAAK,GAAE,0BAAyB;AAAA,OACnC;AAAA;AACF;AAGK,IAAM,YAAY,MACvB;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IAEP,8BAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAAA;AAC9E;AAGK,IAAM,qBAAqB,CAAC,EAAE,QAAQ,mBAAmB,MAC9D;AAAA,EAAC;AAAA;AAAA,IACC,OAAO;AAAA,MACL,WAAW;AAAA,MACX;AAAA,IACF;AAAA,IACA,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IAER;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,EAAE,SAAS,KAAK;AAAA,UACvB,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACb;AAAA,MACD;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,EAAE,SAAS,KAAK;AAAA,UACvB,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACH;AAAA;AAAA;AACH;","names":[]}
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-RQNJNK2W.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-DHGDU64D.mjs";
12
+ } from "./chunk-T35X2SFE.mjs";
13
13
  import {
14
14
  Input
15
- } from "./chunk-4LUMV4YO.mjs";
15
+ } from "./chunk-EMQEEXUB.mjs";
16
16
  import {
17
17
  Messages
18
18
  } from "./chunk-RKPANT3F.mjs";
@@ -88,4 +88,4 @@ var CopilotModal = ({
88
88
  export {
89
89
  CopilotModal
90
90
  };
91
- //# sourceMappingURL=chunk-63ZKP62F.mjs.map
91
+ //# sourceMappingURL=chunk-E5SSVET3.mjs.map
@@ -44,7 +44,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
44
44
  });
45
45
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
46
46
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
47
- const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
47
+ const canSend = () => {
48
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
49
+ };
50
+ const sendDisabled = !canSend();
48
51
  return /* @__PURE__ */ jsxs("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
49
52
  /* @__PURE__ */ jsx(
50
53
  Textarea_default,
@@ -58,7 +61,9 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
58
61
  onKeyDown: (event) => {
59
62
  if (event.key === "Enter" && !event.shiftKey) {
60
63
  event.preventDefault();
61
- send();
64
+ if (canSend()) {
65
+ send();
66
+ }
62
67
  }
63
68
  }
64
69
  }
@@ -89,4 +94,4 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
89
94
  export {
90
95
  Input
91
96
  };
92
- //# sourceMappingURL=chunk-4LUMV4YO.mjs.map
97
+ //# sourceMappingURL=chunk-EMQEEXUB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Input.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\nimport { usePushToTalk } from \"../../hooks/use-push-to-talk\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\n\nexport const Input = ({ inProgress, onSend, isVisible = false }: InputProps) => {\n const context = useChatContext();\n const copilotContext = useCopilotContext();\n\n const pushToTalkConfigured =\n copilotContext.copilotApiConfig.textToSpeechUrl !== undefined &&\n copilotContext.copilotApiConfig.transcribeAudioUrl !== undefined;\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n // Check if the clicked element is not the textarea itself\n if (event.target !== event.currentTarget) return;\n\n textareaRef.current?.focus();\n };\n\n const [text, setText] = useState(\"\");\n const send = () => {\n if (inProgress) return;\n onSend(text);\n setText(\"\");\n\n textareaRef.current?.focus();\n };\n\n useEffect(() => {\n if (isVisible) {\n textareaRef.current?.focus();\n }\n }, [isVisible]);\n\n const { pushToTalkState, setPushToTalkState } = usePushToTalk({\n sendFunction: onSend,\n inProgress,\n });\n\n const sendIcon =\n inProgress || pushToTalkState === \"transcribing\"\n ? context.icons.activityIcon\n : context.icons.sendIcon;\n const showPushToTalk =\n pushToTalkConfigured &&\n (pushToTalkState === \"idle\" || pushToTalkState === \"recording\") &&\n !inProgress;\n\n const canSend = () => {\n return !inProgress && text.trim().length > 0 && pushToTalkState === \"idle\";\n };\n\n const sendDisabled = !canSend();\n\n return (\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={true}\n maxRows={5}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n if (canSend()) {\n send();\n }\n }\n }}\n />\n <div className=\"copilotKitInputControls\">\n {showPushToTalk && (\n <button\n onClick={() =>\n setPushToTalkState(pushToTalkState === \"idle\" ? \"recording\" : \"transcribing\")\n }\n className={pushToTalkState === \"recording\" ? \"copilotKitPushToTalkRecording\" : \"\"}\n >\n {context.icons.pushToTalkIcon}\n </button>\n )}\n <button\n disabled={sendDisabled}\n onClick={send}\n data-copilotkit-in-progress={!!inProgress}\n data-testid={inProgress ? \"copilot-chat-request-in-progress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A,QACC,KAAK;AAAA,QACL,aAAa,QAAQ,OAAO;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU,CAAC,UAAU,QAAQ,MAAM,OAAO,KAAK;AAAA,QAC/C,WAAW,CAAC,UAAU;AACpB,cAAI,MAAM,QAAQ,WAAW,CAAC,MAAM,UAAU;AAC5C,kBAAM,eAAe;AACrB,gBAAI,QAAQ,GAAG;AACb,mBAAK;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,qBAAC,SAAI,WAAU,2BACZ;AAAA,wBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,MACP,mBAAmB,oBAAoB,SAAS,cAAc,cAAc;AAAA,UAE9E,WAAW,oBAAoB,cAAc,kCAAkC;AAAA,UAE9E,kBAAQ,MAAM;AAAA;AAAA,MACjB;AAAA,MAEF;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV,SAAS;AAAA,UACT,+BAA6B,CAAC,CAAC;AAAA,UAC/B,eAAa,aAAa,qCAAqC;AAAA,UAE9D;AAAA;AAAA,MACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-63ZKP62F.mjs";
3
+ } from "./chunk-E5SSVET3.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-VYKDFXGS.mjs.map
21
+ //# sourceMappingURL=chunk-FUDBUYBG.mjs.map
@@ -0,0 +1,155 @@
1
+ import {
2
+ CloseIcon,
3
+ LifeBuoyIcon,
4
+ LoadingSpinnerIcon
5
+ } from "./chunk-BH6PCAAL.mjs";
6
+ import {
7
+ __async
8
+ } from "./chunk-MRXNTQOX.mjs";
9
+
10
+ // src/components/help-modal/modal.tsx
11
+ import { useMemo, useState } from "react";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ function CopilotKitHelpModal() {
14
+ const [showHelpModal, setShowHelpModal] = useState(false);
15
+ const [issueDescription, setIssueDescription] = useState("");
16
+ const [email, setEmail] = useState("");
17
+ const [emailError, setEmailError] = useState("");
18
+ const [submitting, setSubmitting] = useState(false);
19
+ const validateEmail = (email2) => {
20
+ const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
21
+ return re.test(email2);
22
+ };
23
+ const handleSubmit = (e) => __async(this, null, function* () {
24
+ e.preventDefault();
25
+ if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
26
+ setEmailError("Please enter a valid email address");
27
+ return;
28
+ }
29
+ setSubmitting(true);
30
+ yield fetch("https://api.segment.io/v1/track", {
31
+ method: "POST",
32
+ headers: {
33
+ "Content-Type": "application/json"
34
+ },
35
+ body: JSON.stringify({
36
+ event: "oss.dev-console.help",
37
+ anonymousId: window.crypto.randomUUID(),
38
+ properties: { email, text: issueDescription },
39
+ writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
40
+ })
41
+ });
42
+ setEmailError("");
43
+ setEmail("");
44
+ setIssueDescription("");
45
+ setSubmitting(false);
46
+ setShowHelpModal(false);
47
+ });
48
+ const HelpButton = () => /* @__PURE__ */ jsx(
49
+ "button",
50
+ {
51
+ onClick: () => setShowHelpModal(true),
52
+ className: "p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
53
+ "aria-label": "Open Help",
54
+ children: /* @__PURE__ */ jsx(LifeBuoyIcon, {})
55
+ }
56
+ );
57
+ const submitButtonDisabled = useMemo(
58
+ () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
59
+ [submitting, emailError, issueDescription]
60
+ );
61
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
62
+ /* @__PURE__ */ jsx(HelpButton, {}),
63
+ showHelpModal && /* @__PURE__ */ jsx(
64
+ "div",
65
+ {
66
+ className: "fixed inset-0 flex items-center justify-center p-4",
67
+ style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
68
+ children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
69
+ /* @__PURE__ */ jsx(
70
+ "button",
71
+ {
72
+ className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
73
+ style: { top: "10px", right: "10px" },
74
+ onClick: () => setShowHelpModal(false),
75
+ "aria-label": "Close",
76
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsx("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
80
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-4", children: [
81
+ /* @__PURE__ */ jsx("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ jsx(
82
+ "a",
83
+ {
84
+ href: "https://go.copilotkit.ai/dev-console-support-discord",
85
+ target: "_blank",
86
+ rel: "noopener noreferrer",
87
+ children: "Go to Discord Support Channel (Community Support)"
88
+ }
89
+ ) }),
90
+ /* @__PURE__ */ jsx("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ jsx(
91
+ "a",
92
+ {
93
+ href: "https://go.copilotkit.ai/dev-console-support-slack",
94
+ target: "_blank",
95
+ rel: "noopener noreferrer",
96
+ children: "Apply for Priority Direct Slack Support"
97
+ }
98
+ ) })
99
+ ] }),
100
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
101
+ /* @__PURE__ */ jsxs("div", { children: [
102
+ /* @__PURE__ */ jsx("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
103
+ /* @__PURE__ */ jsx(
104
+ "textarea",
105
+ {
106
+ id: "feedback",
107
+ rows: 4,
108
+ className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
109
+ placeholder: "A Loom link / screen recording is always great!",
110
+ onChange: (e) => setIssueDescription(e.target.value),
111
+ value: issueDescription,
112
+ required: true
113
+ }
114
+ )
115
+ ] }),
116
+ /* @__PURE__ */ jsxs("div", { children: [
117
+ /* @__PURE__ */ jsx("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
118
+ /* @__PURE__ */ jsx(
119
+ "input",
120
+ {
121
+ type: "email",
122
+ id: "email",
123
+ className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
124
+ placeholder: "Enter your email for follow-up",
125
+ onChange: (e) => {
126
+ setEmail(e.target.value);
127
+ setEmailError("");
128
+ },
129
+ value: email
130
+ }
131
+ ),
132
+ emailError && /* @__PURE__ */ jsx("p", { className: "text-red-500 text-sm mt-1", children: emailError })
133
+ ] }),
134
+ /* @__PURE__ */ jsx("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ jsx(
135
+ "button",
136
+ {
137
+ type: "submit",
138
+ onClick: handleSubmit,
139
+ disabled: submitButtonDisabled,
140
+ style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
141
+ className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
142
+ children: submitting ? /* @__PURE__ */ jsx(LoadingSpinnerIcon, { color: "white" }) : "Submit"
143
+ }
144
+ ) })
145
+ ] })
146
+ ] })
147
+ }
148
+ )
149
+ ] });
150
+ }
151
+
152
+ export {
153
+ CopilotKitHelpModal
154
+ };
155
+ //# sourceMappingURL=chunk-ICGZEGHQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/help-modal/modal.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport { CloseIcon, LifeBuoyIcon, LoadingSpinnerIcon } from \"./icons\";\n\nexport function CopilotKitHelpModal() {\n const [showHelpModal, setShowHelpModal] = useState(false);\n const [issueDescription, setIssueDescription] = useState(\"\");\n const [email, setEmail] = useState(\"\");\n const [emailError, setEmailError] = useState(\"\");\n const [submitting, setSubmitting] = useState(false);\n\n const validateEmail = (email: string) => {\n const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;\n return re.test(email);\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (email?.length > 0 && !validateEmail(email)) {\n setEmailError(\"Please enter a valid email address\");\n return;\n }\n setSubmitting(true);\n\n await fetch(\"https://api.segment.io/v1/track\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n event: \"oss.dev-console.help\",\n anonymousId: window.crypto.randomUUID(),\n properties: { email, text: issueDescription },\n writeKey: \"q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW\",\n }),\n });\n\n // Reset\n setEmailError(\"\");\n setEmail(\"\");\n setIssueDescription(\"\");\n setSubmitting(false);\n setShowHelpModal(false);\n };\n\n const HelpButton = () => (\n <button\n onClick={() => setShowHelpModal(true)}\n className=\"p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500\"\n aria-label=\"Open Help\"\n >\n <LifeBuoyIcon />\n </button>\n );\n\n const submitButtonDisabled = useMemo(\n () => submitting || !!emailError || issueDescription == null || issueDescription?.length == 0,\n [submitting, emailError, issueDescription],\n );\n\n return (\n <>\n <HelpButton />\n {showHelpModal && (\n <div\n className=\"fixed inset-0 flex items-center justify-center p-4\"\n style={{ backgroundColor: \"rgba(11, 15, 26, 0.5)\", zIndex: 99 }}\n >\n <div className=\"bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative\">\n <button\n className=\"absolute text-gray-400 hover:text-gray-600 focus:outline-none\"\n style={{ top: \"10px\", right: \"10px\" }}\n onClick={() => setShowHelpModal(false)}\n aria-label=\"Close\"\n >\n <CloseIcon />\n </button>\n <div className=\"w-full flex mb-6 justify-center\">\n <h2 className=\"text-2xl font-bold\">Help Options</h2>\n </div>\n <div className=\"space-y-4 mb-4\">\n <div className=\"block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-discord\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Go to Discord Support Channel (Community Support)\n </a>\n </div>\n <div className=\"block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-slack\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Apply for Priority Direct Slack Support\n </a>\n </div>\n </div>\n <form onSubmit={handleSubmit} className=\"flex flex-col space-y-2\">\n <div>\n <label htmlFor=\"feedback\" className=\"block text-sm font-medium text-gray-700 mb-1\">\n Let us know what your issue is:\n </label>\n <textarea\n id=\"feedback\"\n rows={4}\n className=\"w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500\"\n placeholder=\"A Loom link / screen recording is always great!\"\n onChange={(e) => setIssueDescription(e.target.value)}\n value={issueDescription}\n required\n ></textarea>\n </div>\n <div>\n <label htmlFor=\"email\" className=\"block text-sm font-medium text-gray-700 mb-1\">\n Email (optional):\n </label>\n <input\n type=\"email\"\n id=\"email\"\n className={`w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? \"border-red-500\" : \"\"}`}\n placeholder=\"Enter your email for follow-up\"\n onChange={(e) => {\n setEmail(e.target.value);\n setEmailError(\"\");\n }}\n value={email}\n />\n {emailError && <p className=\"text-red-500 text-sm mt-1\">{emailError}</p>}\n </div>\n <div className=\"bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg\">\n <button\n type=\"submit\"\n onClick={handleSubmit}\n disabled={submitButtonDisabled}\n style={\n submitButtonDisabled\n ? { backgroundColor: \"rgb(216, 216, 216)\", color: \"rgb(129, 129, 129)\" }\n : undefined\n }\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none\"\n >\n {submitting ? <LoadingSpinnerIcon color=\"white\" /> : \"Submit\"}\n </button>\n </div>\n </form>\n </div>\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAgB,SAAS,gBAAgB;AAmDnC,SAUF,UAVE,KA6BM,YA7BN;AAhDC,SAAS,sBAAsB;AACpC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,EAAE;AAC3D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,gBAAgB,CAACA,WAAkB;AACvC,UAAM,KAAK;AACX,WAAO,GAAG,KAAKA,MAAK;AAAA,EACtB;AAEA,QAAM,eAAe,CAAO,MAAuB;AACjD,MAAE,eAAe;AAEjB,SAAI,+BAAO,UAAS,K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rE;AAAA,gBAEN,WAAU;AAAA,gBAET,uBAAa,oBAAC,sBAAmB,OAAM,SAAQ,IAAK;AAAA;AAAA,YACvD,GACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["email"]}
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-RJCZRKTV.mjs";
17
17
  import {
18
18
  CopilotDevConsole
19
- } from "./chunk-2B57NCBA.mjs";
19
+ } from "./chunk-TTYR7XPN.mjs";
20
20
  import {
21
21
  Input
22
- } from "./chunk-4LUMV4YO.mjs";
22
+ } from "./chunk-EMQEEXUB.mjs";
23
23
  import {
24
24
  Messages
25
25
  } from "./chunk-RKPANT3F.mjs";
@@ -198,4 +198,4 @@ export {
198
198
  WrappedCopilotChat,
199
199
  useCopilotChatLogic
200
200
  };
201
- //# sourceMappingURL=chunk-DHGDU64D.mjs.map
201
+ //# sourceMappingURL=chunk-T35X2SFE.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-4FIGRRFS.mjs";
8
8
  import {
9
9
  CopilotKitHelpModal
10
- } from "./chunk-WOUWNTAV.mjs";
10
+ } from "./chunk-ICGZEGHQ.mjs";
11
11
  import {
12
12
  CheckIcon,
13
13
  ChevronDownIcon,
@@ -229,4 +229,4 @@ export {
229
229
  CopilotDevConsole,
230
230
  DebugMenuButton
231
231
  };
232
- //# sourceMappingURL=chunk-2B57NCBA.mjs.map
232
+ //# sourceMappingURL=chunk-TTYR7XPN.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-63ZKP62F.mjs";
3
+ } from "./chunk-E5SSVET3.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
27
27
  export {
28
28
  CopilotSidebar
29
29
  };
30
- //# sourceMappingURL=chunk-TKFQ7VQR.mjs.map
30
+ //# sourceMappingURL=chunk-ZQFKJLQ6.mjs.map
@@ -739,7 +739,10 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
739
739
  });
740
740
  const sendIcon = inProgress || pushToTalkState === "transcribing" ? context.icons.activityIcon : context.icons.sendIcon;
741
741
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
742
- const sendDisabled = inProgress || text.length === 0 || pushToTalkState !== "idle";
742
+ const canSend = () => {
743
+ return !inProgress && text.trim().length > 0 && pushToTalkState === "idle";
744
+ };
745
+ const sendDisabled = !canSend();
743
746
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
744
747
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
745
748
  Textarea_default,
@@ -753,7 +756,9 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
753
756
  onKeyDown: (event) => {
754
757
  if (event.key === "Enter" && !event.shiftKey) {
755
758
  event.preventDefault();
756
- send();
759
+ if (canSend()) {
760
+ send();
761
+ }
757
762
  }
758
763
  }
759
764
  }
@@ -1796,15 +1801,79 @@ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1796
1801
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1797
1802
  }
1798
1803
  );
1804
+ var LoadingSpinnerIcon = ({ color = "rgb(107 114 128)" }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1805
+ "svg",
1806
+ {
1807
+ style: {
1808
+ animation: "copilotKitSpinAnimation 1s linear infinite",
1809
+ color
1810
+ },
1811
+ width: "24",
1812
+ height: "24",
1813
+ xmlns: "http://www.w3.org/2000/svg",
1814
+ fill: "none",
1815
+ viewBox: "0 0 24 24",
1816
+ children: [
1817
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1818
+ "circle",
1819
+ {
1820
+ style: { opacity: 0.25 },
1821
+ cx: "12",
1822
+ cy: "12",
1823
+ r: "10",
1824
+ stroke: "currentColor",
1825
+ strokeWidth: "4"
1826
+ }
1827
+ ),
1828
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1829
+ "path",
1830
+ {
1831
+ style: { opacity: 0.75 },
1832
+ fill: "currentColor",
1833
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
1834
+ }
1835
+ )
1836
+ ]
1837
+ }
1838
+ );
1799
1839
 
1800
1840
  // src/components/help-modal/modal.tsx
1801
1841
  var import_jsx_runtime16 = require("react/jsx-runtime");
1802
1842
  function CopilotKitHelpModal() {
1803
1843
  const [showHelpModal, setShowHelpModal] = (0, import_react8.useState)(false);
1804
1844
  const [issueDescription, setIssueDescription] = (0, import_react8.useState)("");
1805
- const handleSubmit = () => {
1806
- setShowHelpModal(false);
1845
+ const [email, setEmail] = (0, import_react8.useState)("");
1846
+ const [emailError, setEmailError] = (0, import_react8.useState)("");
1847
+ const [submitting, setSubmitting] = (0, import_react8.useState)(false);
1848
+ const validateEmail = (email2) => {
1849
+ const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1850
+ return re.test(email2);
1807
1851
  };
1852
+ const handleSubmit = (e) => __async(this, null, function* () {
1853
+ e.preventDefault();
1854
+ if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
1855
+ setEmailError("Please enter a valid email address");
1856
+ return;
1857
+ }
1858
+ setSubmitting(true);
1859
+ yield fetch("https://api.segment.io/v1/track", {
1860
+ method: "POST",
1861
+ headers: {
1862
+ "Content-Type": "application/json"
1863
+ },
1864
+ body: JSON.stringify({
1865
+ event: "oss.dev-console.help",
1866
+ anonymousId: window.crypto.randomUUID(),
1867
+ properties: { email, text: issueDescription },
1868
+ writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
1869
+ })
1870
+ });
1871
+ setEmailError("");
1872
+ setEmail("");
1873
+ setIssueDescription("");
1874
+ setSubmitting(false);
1875
+ setShowHelpModal(false);
1876
+ });
1808
1877
  const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1809
1878
  "button",
1810
1879
  {
@@ -1814,6 +1883,10 @@ function CopilotKitHelpModal() {
1814
1883
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LifeBuoyIcon, {})
1815
1884
  }
1816
1885
  );
1886
+ const submitButtonDisabled = (0, import_react8.useMemo)(
1887
+ () => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
1888
+ [submitting, emailError, issueDescription]
1889
+ );
1817
1890
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1818
1891
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HelpButton, {}),
1819
1892
  showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -1852,6 +1925,52 @@ function CopilotKitHelpModal() {
1852
1925
  children: "Apply for Priority Direct Slack Support"
1853
1926
  }
1854
1927
  ) })
1928
+ ] }),
1929
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
1930
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
1931
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
1932
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1933
+ "textarea",
1934
+ {
1935
+ id: "feedback",
1936
+ rows: 4,
1937
+ className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
1938
+ placeholder: "A Loom link / screen recording is always great!",
1939
+ onChange: (e) => setIssueDescription(e.target.value),
1940
+ value: issueDescription,
1941
+ required: true
1942
+ }
1943
+ )
1944
+ ] }),
1945
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
1947
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1948
+ "input",
1949
+ {
1950
+ type: "email",
1951
+ id: "email",
1952
+ className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
1953
+ placeholder: "Enter your email for follow-up",
1954
+ onChange: (e) => {
1955
+ setEmail(e.target.value);
1956
+ setEmailError("");
1957
+ },
1958
+ value: email
1959
+ }
1960
+ ),
1961
+ emailError && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
1962
+ ] }),
1963
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1964
+ "button",
1965
+ {
1966
+ type: "submit",
1967
+ onClick: handleSubmit,
1968
+ disabled: submitButtonDisabled,
1969
+ style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
1970
+ className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
1971
+ children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
1972
+ }
1973
+ ) })
1855
1974
  ] })
1856
1975
  ] })
1857
1976
  }