@stack-spot/ai-chat-widget 1.29.0 → 1.29.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.
- package/CHANGELOG.md +7 -0
- package/dist/StackspotAIWidget.js +2 -2
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +2 -2
- package/dist/components/AdaptiveTextArea.d.ts +2 -2
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +9 -3
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +3 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +5 -6
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +0 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +0 -1
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/package.json +1 -1
- package/src/StackspotAIWidget.tsx +3 -3
- package/src/app-metadata.json +2 -2
- package/src/components/AdaptiveTextArea.tsx +14 -5
- package/src/views/MessageInput/index.tsx +4 -5
- package/src/views/MessageInput/styled.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.29.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.29.0...ai-chat-widget@v1.29.1) (2025-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* calc max height ([#200](https://github.com/stack-spot/portal-ai-chat-widget/issues/200)) ([01d69c0](https://github.com/stack-spot/portal-ai-chat-widget/commit/01d69c04848db47e55b368b1e27a27b4ad24e8a3))
|
|
9
|
+
|
|
3
10
|
## [1.29.0](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.28.1...ai-chat-widget@v1.29.0) (2025-07-03)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -36,8 +36,8 @@ export const StackspotAIWidget = ({ username, initialAgents, minimizedActions =
|
|
|
36
36
|
const features = useCurrentChatState('features');
|
|
37
37
|
return useMemo(() => (_jsx(FallbackBoundary, { children: _jsx(TooltipProvider, { children: _jsx(RightPanelProvider, { chatWindow: chatWindowRef, panel: rightPanelRef, children: _jsxs("div", { className: listToClass(['ai-chat-widget', isMinimized && 'minimized', className]), translate: "no", style: style, children: [_jsxs("div", { className: "chat-window", ref: chatWindowRef, children: [hasHeader && _jsx(_Fragment, { children: isMinimized
|
|
38
38
|
? _jsx(MinimizedHeader, { ...minimizedActions })
|
|
39
|
-
: _jsx(ChatTabSelection, {}) }), _jsxs("div", { className: "chat-container", children: [_jsxs("div", { className: "chat-content", children: [prefix, isCurrentChatEmpty
|
|
39
|
+
: _jsx(ChatTabSelection, {}) }), _jsxs("div", { className: "chat-container", ref: chatWindowRef, children: [_jsxs("div", { className: "chat-content", children: [prefix, isCurrentChatEmpty
|
|
40
40
|
? (children ?? _jsx(Home, { username: username, initialAgents: initialAgents, urlCreateAgent: urlCreateAgent }))
|
|
41
|
-
: _jsx(Chat, { username: username, beforeMessage: beforeMessage, afterMessage: afterMessage })] }), features.messageInput && _jsx(MessageInput, {})] })] }), _jsx(Stacks, {}), !isTrial && _jsx(Workspaces, {}), _jsx(KnowledgeSources, {}), _jsx(KSDocument, {}), _jsx(Agents, {}), _jsx(Editor, {}), _jsx(ChatHistory, {}), _jsx(Steps, {}), _jsx(Tools, {}), _jsx("div", { className: "chat-right-panel", ref: rightPanelRef, children: _jsx(RightPanel, {}) })] }) }) }) })), [isCurrentChatEmpty, username, isMinimized, children, initialAgents]);
|
|
41
|
+
: _jsx(Chat, { username: username, beforeMessage: beforeMessage, afterMessage: afterMessage })] }), features.messageInput && _jsx(MessageInput, { chatWindowRef: chatWindowRef })] })] }), _jsx(Stacks, {}), !isTrial && _jsx(Workspaces, {}), _jsx(KnowledgeSources, {}), _jsx(KSDocument, {}), _jsx(Agents, {}), _jsx(Editor, {}), _jsx(ChatHistory, {}), _jsx(Steps, {}), _jsx(Tools, {}), _jsx("div", { className: "chat-right-panel", ref: rightPanelRef, children: _jsx(RightPanel, {}) })] }) }) }) })), [isCurrentChatEmpty, username, isMinimized, children, initialAgents]);
|
|
42
42
|
};
|
|
43
43
|
//# sourceMappingURL=StackspotAIWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackspotAIWidget.js","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC7F,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAGrE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE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Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -10,9 +10,9 @@ interface Props extends PropsOf<typeof Textarea> {
|
|
|
10
10
|
*/
|
|
11
11
|
onResetSize?: () => void;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Reference to parent container to calculate dynamic max height
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
chatWindowRef?: React.RefObject<HTMLElement>;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* The adaptive textarea grows in height whenever needed until the maximum height is reached.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdaptiveTextArea.d.ts","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"AdaptiveTextArea.d.ts","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlC,UAAU,KAAM,SAAQ,OAAO,CAAC,OAAO,QAAQ,CAAC;IAC9C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,oHA0C3B,CAAA"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable react/display-name */
|
|
3
3
|
import { Textarea } from '@citric/core';
|
|
4
|
-
import { forwardRef, useEffect, useRef } from 'react';
|
|
4
|
+
import { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import { MIN_INPUT_HEIGHT } from '../views/MessageInput/styled.js';
|
|
5
6
|
/**
|
|
6
7
|
* The adaptive textarea grows in height whenever needed until the maximum height is reached.
|
|
7
8
|
*/
|
|
8
|
-
export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize,
|
|
9
|
+
export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize, style, chatWindowRef, ...props }, externalRef) => {
|
|
9
10
|
const localRef = useRef(null);
|
|
10
11
|
const ref = externalRef ?? localRef;
|
|
12
|
+
/**
|
|
13
|
+
* Calculates the maximum height for the textarea.
|
|
14
|
+
* Uses 30% of container height if available, otherwise falls back to MIN_INPUT_HEIGHT.
|
|
15
|
+
*/
|
|
16
|
+
const maxHeight = useMemo(() => chatWindowRef?.current?.offsetHeight ? chatWindowRef?.current?.offsetHeight * 0.3 : MIN_INPUT_HEIGHT, [chatWindowRef?.current?.offsetHeight]);
|
|
11
17
|
const handleIncreaseSize = (newHeight) => {
|
|
12
18
|
onIncreaseSize?.();
|
|
13
19
|
if (maxHeight && newHeight > maxHeight && ref.current) {
|
|
@@ -34,6 +40,6 @@ export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize
|
|
|
34
40
|
onResetSize?.();
|
|
35
41
|
}
|
|
36
42
|
}, [value, maxHeight]);
|
|
37
|
-
return _jsx(Textarea, {
|
|
43
|
+
return _jsx(Textarea, { ...props, ref: ref, value: value, style: { ...style, maxHeight } });
|
|
38
44
|
});
|
|
39
45
|
//# sourceMappingURL=AdaptiveTextArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdaptiveTextArea.js","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,OAAO,EAAE,QAAQ,EAAE,MA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AAO;YAAE,OAAM;QACxB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,CAAA;QACvC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,SAAS,IAAI,MAAM,GAAG,SAAS,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAA;YACtC,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAA;gBACxC,kBAAkB,CAAC,MAAM,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC;YACrB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAA;QACtC,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;YAC7B,WAAW,EAAE,EAAE,CAAA;QACjB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAA;IAEtB,OAAO,KAAC,QAAQ,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,GAAI,CAAA;AACxF,CAAC,CAAC,CAAA"}
|
|
@@ -3,5 +3,7 @@
|
|
|
3
3
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
4
4
|
* Commands panel for auto completing.
|
|
5
5
|
*/
|
|
6
|
-
export declare const MessageInput: (
|
|
6
|
+
export declare const MessageInput: ({ chatWindowRef }: {
|
|
7
|
+
chatWindowRef?: React.RefObject<HTMLElement>;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,YAAY,sBAAuB;IAAE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,4CAyH/F,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { interpolate } from '@stack-spot/portal-translate';
|
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { AdaptiveTextArea } from '../../components/AdaptiveTextArea.js';
|
|
6
6
|
import { ProgressBar } from '../../components/ProgressBar.js';
|
|
7
|
-
import { useCurrentChat, useCurrentChatState
|
|
7
|
+
import { useCurrentChat, useCurrentChatState } from '../../context/hooks.js';
|
|
8
8
|
import { quickCommandRegex } from '../../regex.js';
|
|
9
9
|
import { ChatEntry } from '../../state/ChatEntry.js';
|
|
10
10
|
import { checkIsTrial } from '../../utils/check-is-trial.js';
|
|
@@ -17,7 +17,7 @@ import { useUserEntryHistoryShortcut } from './chat-entry-history.js';
|
|
|
17
17
|
import { ContextBar } from './ContextBar.js';
|
|
18
18
|
import { useMessageInputDictionary } from './dictionary.js';
|
|
19
19
|
import { QuickCommandSelector } from './QuickCommandSelector.js';
|
|
20
|
-
import {
|
|
20
|
+
import { MessageInputBox } from './styled.js';
|
|
21
21
|
import { UploadBar } from './UploadBar.js';
|
|
22
22
|
import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop.js';
|
|
23
23
|
/**
|
|
@@ -25,7 +25,7 @@ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop.js';
|
|
|
25
25
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
26
26
|
* Commands panel for auto completing.
|
|
27
27
|
*/
|
|
28
|
-
export const MessageInput = () => {
|
|
28
|
+
export const MessageInput = ({ chatWindowRef }) => {
|
|
29
29
|
const t = useMessageInputDictionary();
|
|
30
30
|
const [focused, setFocused] = useState(false);
|
|
31
31
|
const [, setExpanded] = useState(true);
|
|
@@ -33,7 +33,6 @@ export const MessageInput = () => {
|
|
|
33
33
|
const chat = useCurrentChat();
|
|
34
34
|
const isLoading = useCurrentChatState('isLoading') ?? false;
|
|
35
35
|
const value = useCurrentChatState('nextMessage') ?? '';
|
|
36
|
-
const isMinimized = useWidgetState('isMinimized');
|
|
37
36
|
const textAreaRef = useRef(null);
|
|
38
37
|
const agentLabel = useCurrentChatState('agent')?.label;
|
|
39
38
|
const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut();
|
|
@@ -104,8 +103,8 @@ export const MessageInput = () => {
|
|
|
104
103
|
if (!isLoading)
|
|
105
104
|
textAreaRef.current?.focus();
|
|
106
105
|
}, [isLoading]);
|
|
107
|
-
return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { ref: textAreaRef, placeholder: agentLabel
|
|
106
|
+
return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { chatWindowRef: chatWindowRef, ref: textAreaRef, placeholder: agentLabel
|
|
108
107
|
? interpolate(t.placeholder, agentLabel)
|
|
109
|
-
: t.typing, onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true)
|
|
108
|
+
: t.typing, onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true) })] })] }), _jsx(ProgressBar, { visible: true, animate: isLoading, backgroundColor: isLoading || !focused ? theme.color.light[500] : theme.color.primary[500] }), _jsx(ContextBar, {}), chat.get('features').upload && _jsx(UploadBar, {}), _jsx(ButtonBar, { onSend: onSend, isLoading: isLoading })] }), _jsx(UploadDragNDrop, { isDragging: isDragging, onDrop: handleDrop, onDragLeave: handleDragLeave })] }));
|
|
110
109
|
};
|
|
111
110
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,cAA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,OAAO,EAAE,SAAS,EAC5C,eAAe,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,EAChG,KAAC,UAAU,KAAG,EACb,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,KAAC,SAAS,KAAG,EAC7C,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,IACnC,EAClB,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,GAAI,IAC9E,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const MAX_INPUT_HEIGHT = 200;
|
|
2
1
|
export declare const MIN_INPUT_HEIGHT = 24;
|
|
3
2
|
export declare const SelectionBarWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
3
|
export declare const MessageInputBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,mBAAmB,wOAyC/B,CAAA;AAED,eAAO,MAAM,eAAe;oBAA+B,OAAO;YAkPjE,CAAA"}
|
|
@@ -5,7 +5,6 @@ const CONTEXT_BAR_HEIGHT = 38;
|
|
|
5
5
|
const CONTEXT_BAR_DISPLACEMENT = 4;
|
|
6
6
|
const UPLOAD_BAR_HEIGHT = 60;
|
|
7
7
|
const UPLOAD_BAR_DISPLACEMENT = 4;
|
|
8
|
-
export const MAX_INPUT_HEIGHT = 200;
|
|
9
8
|
export const MIN_INPUT_HEIGHT = 24;
|
|
10
9
|
export const SelectionBarWrapper = styled.div `
|
|
11
10
|
display: inline-flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAC7B,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAClC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAC5B,MAAM,uBAAuB,GAAG,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAC7B,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAClC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAC5B,MAAM,uBAAuB,GAAG,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EA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AAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;;;;;;;;;;;;;;;;;8BAmBpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;cAStC,gBAAgB;;;;;;;;CAQ7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -83,7 +83,7 @@ export const StackspotAIWidget = (
|
|
|
83
83
|
const isCurrentChatEmpty = currentChat.length === 0
|
|
84
84
|
const isTrial = checkIsTrial()
|
|
85
85
|
const features = useCurrentChatState('features')
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
return useMemo(() => (
|
|
88
88
|
<FallbackBoundary>
|
|
89
89
|
<TooltipProvider>
|
|
@@ -97,7 +97,7 @@ export const StackspotAIWidget = (
|
|
|
97
97
|
}
|
|
98
98
|
</>
|
|
99
99
|
}
|
|
100
|
-
<div className="chat-container">
|
|
100
|
+
<div className="chat-container" ref={chatWindowRef}>
|
|
101
101
|
<div className="chat-content">
|
|
102
102
|
{prefix}
|
|
103
103
|
{isCurrentChatEmpty
|
|
@@ -105,7 +105,7 @@ export const StackspotAIWidget = (
|
|
|
105
105
|
: <Chat username={username} beforeMessage={beforeMessage} afterMessage={afterMessage} />
|
|
106
106
|
}
|
|
107
107
|
</div>
|
|
108
|
-
{features.messageInput && <MessageInput />}
|
|
108
|
+
{features.messageInput && <MessageInput chatWindowRef={chatWindowRef} />}
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
111
111
|
<Stacks />
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.29.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "1.29.1",
|
|
4
|
+
"date": "Fri Jul 04 2025 21:00:34 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
2
|
import { Textarea } from '@citric/core'
|
|
3
|
-
import { forwardRef, useEffect, useRef } from 'react'
|
|
3
|
+
import { forwardRef, useEffect, useMemo, useRef } from 'react'
|
|
4
4
|
import { PropsOf } from '../types'
|
|
5
|
+
import { MIN_INPUT_HEIGHT } from '../views/MessageInput/styled'
|
|
5
6
|
|
|
6
7
|
interface Props extends PropsOf<typeof Textarea> {
|
|
7
8
|
/**
|
|
@@ -13,20 +14,28 @@ interface Props extends PropsOf<typeof Textarea> {
|
|
|
13
14
|
*/
|
|
14
15
|
onResetSize?: () => void,
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* Reference to parent container to calculate dynamic max height
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
chatWindowRef?: React.RefObject<HTMLElement>,
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* The adaptive textarea grows in height whenever needed until the maximum height is reached.
|
|
23
24
|
*/
|
|
24
25
|
export const AdaptiveTextArea = forwardRef<HTMLTextAreaElement, Props>((
|
|
25
|
-
{ value, onIncreaseSize, onResetSize,
|
|
26
|
+
{ value, onIncreaseSize, onResetSize, style, chatWindowRef, ...props },
|
|
26
27
|
externalRef,
|
|
27
28
|
) => {
|
|
28
29
|
const localRef = useRef<HTMLTextAreaElement>(null)
|
|
29
30
|
const ref = externalRef as React.RefObject<HTMLTextAreaElement> ?? localRef
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the maximum height for the textarea.
|
|
33
|
+
* Uses 30% of container height if available, otherwise falls back to MIN_INPUT_HEIGHT.
|
|
34
|
+
*/
|
|
35
|
+
const maxHeight = useMemo(
|
|
36
|
+
() => chatWindowRef?.current?.offsetHeight ? chatWindowRef?.current?.offsetHeight * 0.3 : MIN_INPUT_HEIGHT,
|
|
37
|
+
[chatWindowRef?.current?.offsetHeight],
|
|
38
|
+
)
|
|
30
39
|
|
|
31
40
|
const handleIncreaseSize = (newHeight: number) => {
|
|
32
41
|
onIncreaseSize?.()
|
|
@@ -54,5 +63,5 @@ export const AdaptiveTextArea = forwardRef<HTMLTextAreaElement, Props>((
|
|
|
54
63
|
}
|
|
55
64
|
}, [value, maxHeight])
|
|
56
65
|
|
|
57
|
-
return <Textarea
|
|
66
|
+
return <Textarea {...props} ref={ref} value={value} style={{ ...style, maxHeight }} />
|
|
58
67
|
})
|
|
@@ -3,7 +3,7 @@ import { interpolate } from '@stack-spot/portal-translate'
|
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { AdaptiveTextArea } from '../../components/AdaptiveTextArea'
|
|
5
5
|
import { ProgressBar } from '../../components/ProgressBar'
|
|
6
|
-
import { useCurrentChat, useCurrentChatState
|
|
6
|
+
import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
|
|
7
7
|
import { quickCommandRegex } from '../../regex'
|
|
8
8
|
import { ChatEntry } from '../../state/ChatEntry'
|
|
9
9
|
import { checkIsTrial } from '../../utils/check-is-trial'
|
|
@@ -16,7 +16,7 @@ import { useUserEntryHistoryShortcut } from './chat-entry-history'
|
|
|
16
16
|
import { ContextBar } from './ContextBar'
|
|
17
17
|
import { useMessageInputDictionary } from './dictionary'
|
|
18
18
|
import { QuickCommandSelector } from './QuickCommandSelector'
|
|
19
|
-
import {
|
|
19
|
+
import { MessageInputBox } from './styled'
|
|
20
20
|
import { UploadBar } from './UploadBar'
|
|
21
21
|
import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
|
|
|
25
25
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
26
26
|
* Commands panel for auto completing.
|
|
27
27
|
*/
|
|
28
|
-
export const MessageInput = () => {
|
|
28
|
+
export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObject<HTMLElement> }) => {
|
|
29
29
|
const t = useMessageInputDictionary()
|
|
30
30
|
const [focused, setFocused] = useState(false)
|
|
31
31
|
const [, setExpanded] = useState(true)
|
|
@@ -33,7 +33,6 @@ export const MessageInput = () => {
|
|
|
33
33
|
const chat = useCurrentChat()
|
|
34
34
|
const isLoading = useCurrentChatState('isLoading') ?? false
|
|
35
35
|
const value = useCurrentChatState('nextMessage') ?? ''
|
|
36
|
-
const isMinimized = useWidgetState('isMinimized')
|
|
37
36
|
const textAreaRef = useRef<HTMLTextAreaElement>(null)
|
|
38
37
|
const agentLabel = useCurrentChatState('agent')?.label
|
|
39
38
|
const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut()
|
|
@@ -120,6 +119,7 @@ export const MessageInput = () => {
|
|
|
120
119
|
<div className={listToClass(['action-box', focused && 'focused', isLoading && 'disabled'])}>
|
|
121
120
|
<ButtonAgent />
|
|
122
121
|
<AdaptiveTextArea
|
|
122
|
+
chatWindowRef={chatWindowRef}
|
|
123
123
|
ref={textAreaRef}
|
|
124
124
|
placeholder={
|
|
125
125
|
agentLabel
|
|
@@ -134,7 +134,6 @@ export const MessageInput = () => {
|
|
|
134
134
|
onKeyUp={handleKeyUp}
|
|
135
135
|
onIncreaseSize={() => setExpanded(false)}
|
|
136
136
|
onResetSize={() => !expansionLocked.current && setExpanded(true)}
|
|
137
|
-
maxHeight={isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT}
|
|
138
137
|
/>
|
|
139
138
|
</div>
|
|
140
139
|
</div>
|