@stack-spot/ai-chat-widget 1.28.1-beta.2 → 1.28.1

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 (83) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/app-metadata.json +3 -3
  3. package/dist/components/AdaptiveTextArea.js +1 -1
  4. package/dist/components/AdaptiveTextArea.js.map +1 -1
  5. package/dist/components/AgentCard/dictionary.d.ts +2 -4
  6. package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
  7. package/dist/components/AgentCard/dictionary.js +2 -4
  8. package/dist/components/AgentCard/dictionary.js.map +1 -1
  9. package/dist/components/Selector/index.d.ts +2 -2
  10. package/dist/components/Selector/index.d.ts.map +1 -1
  11. package/dist/components/Selector/index.js +3 -3
  12. package/dist/components/Selector/index.js.map +1 -1
  13. package/dist/components/Selector/styled.d.ts +1 -1
  14. package/dist/components/Selector/styled.d.ts.map +1 -1
  15. package/dist/components/Selector/styled.js +1 -1
  16. package/dist/components/Selector/styled.js.map +1 -1
  17. package/dist/state/types.d.ts +1 -1
  18. package/dist/state/types.d.ts.map +1 -1
  19. package/dist/utils/tools.d.ts +2 -2
  20. package/dist/utils/tools.d.ts.map +1 -1
  21. package/dist/utils/tools.js +6 -3
  22. package/dist/utils/tools.js.map +1 -1
  23. package/dist/views/Agents/AgentDescription.d.ts +9 -2
  24. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  25. package/dist/views/Agents/AgentDescription.js +9 -11
  26. package/dist/views/Agents/AgentDescription.js.map +1 -1
  27. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  28. package/dist/views/Agents/AgentsPanel.js +11 -11
  29. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  30. package/dist/views/Agents/AgentsTab.d.ts +2 -2
  31. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  32. package/dist/views/Agents/AgentsTab.js +6 -6
  33. package/dist/views/Agents/AgentsTab.js.map +1 -1
  34. package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
  35. package/dist/views/Agents/useAgentFavorites.js +4 -4
  36. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  37. package/dist/views/Chat/ChatMessage.js +3 -3
  38. package/dist/views/Chat/ChatMessage.js.map +1 -1
  39. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  40. package/dist/views/ChatHistory/HistoryItem.js +5 -8
  41. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  42. package/dist/views/ChatHistory/utils.d.ts +6 -0
  43. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  44. package/dist/views/ChatHistory/utils.js +16 -1
  45. package/dist/views/ChatHistory/utils.js.map +1 -1
  46. package/dist/views/Home/CustomAgent.js +3 -3
  47. package/dist/views/Home/CustomAgent.js.map +1 -1
  48. package/dist/views/MessageInput/AgentSelector.js +4 -4
  49. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  50. package/dist/views/MessageInput/ButtonAgent.js +2 -2
  51. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  52. package/dist/views/MessageInput/styled.d.ts +1 -1
  53. package/dist/views/MessageInput/styled.js +1 -1
  54. package/dist/views/Tools.js +3 -3
  55. package/dist/views/Tools.js.map +1 -1
  56. package/dist/views/Workspaces/WorkspacesTab.js +1 -1
  57. package/package.json +2 -2
  58. package/src/app-metadata.json +3 -3
  59. package/src/components/AdaptiveTextArea.tsx +1 -1
  60. package/src/components/AgentCard/dictionary.ts +2 -4
  61. package/src/components/Selector/index.tsx +6 -5
  62. package/src/components/Selector/styled.ts +2 -2
  63. package/src/layout.css +0 -17
  64. package/src/state/types.ts +1 -1
  65. package/src/utils/tools.ts +7 -5
  66. package/src/utils/upload/UploadManager.ts +23 -32
  67. package/src/views/Agents/AgentDescription.tsx +25 -19
  68. package/src/views/Agents/AgentsPanel.tsx +12 -11
  69. package/src/views/Agents/AgentsTab.tsx +17 -12
  70. package/src/views/Agents/useAgentFavorites.ts +4 -4
  71. package/src/views/Chat/ChatMessage.tsx +3 -3
  72. package/src/views/ChatHistory/HistoryItem.tsx +5 -10
  73. package/src/views/ChatHistory/utils.ts +18 -1
  74. package/src/views/Home/CustomAgent.tsx +4 -4
  75. package/src/views/MessageInput/AgentSelector.tsx +4 -4
  76. package/src/views/MessageInput/ButtonAgent.tsx +2 -2
  77. package/src/views/MessageInput/dictionary.ts +0 -9
  78. package/src/views/MessageInput/index.tsx +1 -15
  79. package/src/views/MessageInput/styled.ts +1 -1
  80. package/src/views/Tools.tsx +3 -4
  81. package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
  82. package/src/utils/upload/use-paste-upload.tsx +0 -30
  83. package/src/views/MessageInput/UploadDragNDrop.tsx +0 -83
@@ -1,30 +0,0 @@
1
- import { useEffect } from 'react'
2
-
3
- interface UsePasteUploadProps {
4
- textAreaRef: React.RefObject<HTMLTextAreaElement>,
5
- onUploadFiles: (files: File[]) => void,
6
- enabled?: boolean,
7
- }
8
-
9
- export const usePasteUpload = ({
10
- textAreaRef,
11
- onUploadFiles,
12
- enabled = true,
13
- }: UsePasteUploadProps) => {
14
- useEffect(() => {
15
- const textarea = textAreaRef.current
16
- if (!textarea || !enabled) return
17
-
18
- const handlePaste = (e: ClipboardEvent) => {
19
- if (e.clipboardData?.files?.length) {
20
- onUploadFiles(Array.from(e.clipboardData.files))
21
- e.preventDefault()
22
- }
23
- }
24
-
25
- textarea.addEventListener('paste', handlePaste)
26
- return () => {
27
- textarea.removeEventListener('paste', handlePaste)
28
- }
29
- }, [onUploadFiles, textAreaRef, enabled])
30
- }
@@ -1,83 +0,0 @@
1
- import { IconBox } from '@citric/core'
2
- import { Document } from '@citric/icons'
3
- import { DragEvent, useCallback, useEffect, useState } from 'react'
4
- import { useCurrentChat } from '../../context/hooks'
5
- import { useMessageInputDictionary } from './dictionary'
6
-
7
- export function useUploadDragDrop(containerSelector: string = '.chat-container') {
8
- const [isDragging, setIsDragging] = useState(false)
9
- const chat = useCurrentChat()
10
-
11
- const handleDrop = useCallback((e: DragEvent) => {
12
- e.preventDefault()
13
- e.stopPropagation()
14
- setIsDragging(false)
15
- if (e.dataTransfer?.files?.length) {
16
- chat.uploadManager.add(Array.from(e.dataTransfer.files))
17
- }
18
- }, [chat])
19
-
20
- const handleDragLeave = useCallback((e: DragEvent) => {
21
- e.preventDefault()
22
- if (e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {
23
- setIsDragging(false)
24
- }
25
- }, [])
26
-
27
- useEffect(() => {
28
- const container = document.querySelector(containerSelector) as HTMLDivElement | null
29
- if (!container) return
30
-
31
- const nativeHandleDragEnter = (e: Event) => {
32
- e.preventDefault()
33
- setIsDragging(true)
34
- }
35
-
36
- container.addEventListener('dragenter', nativeHandleDragEnter)
37
- return () => {
38
- container.removeEventListener('dragenter', nativeHandleDragEnter)
39
- }
40
- }, [containerSelector])
41
-
42
- return {
43
- isDragging,
44
- handleDrop,
45
- handleDragLeave,
46
- }
47
- }
48
-
49
- interface UploadDragNDropProps {
50
- isDragging?: boolean,
51
- onDrop?: (e: DragEvent) => void,
52
- onDragLeave?: (e: DragEvent) => void,
53
- }
54
-
55
- export const UploadDragNDrop = ({ isDragging, onDrop, onDragLeave }: UploadDragNDropProps) => {
56
- const t = useMessageInputDictionary()
57
-
58
- if (!isDragging) return null
59
-
60
- return (
61
- <div
62
- className="upload-drag-drop"
63
- data-active={isDragging}
64
- role="dialog"
65
- aria-modal="true"
66
- aria-labelledby="upload-drag-drop-title"
67
- aria-describedby="upload-drag-drop-description"
68
- onDrop={onDrop}
69
- onDragLeave={onDragLeave}
70
- onDragOver={e => {
71
- e.preventDefault()
72
- e.stopPropagation()
73
- }}
74
- tabIndex={-1}
75
- >
76
- <IconBox size="lg" aria-hidden={true}>
77
- <Document />
78
- </IconBox>
79
- <h2 id="upload-drag-drop-title">{t.uploadDragDropTitle}</h2>
80
- <p id="upload-drag-drop-description">{t.uploadDragDropDescription}</p>
81
- </div>
82
- )
83
- }