@sybilion/uilib 1.2.15 → 1.2.17
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/dist/esm/components/ui/Chat/Chat.js +4 -3
- package/dist/esm/components/ui/Chat/Chat.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatChrome/ChatChrome.js +20 -3
- package/dist/esm/components/ui/Chat/ChatChrome/ChatChrome.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatEmptyState/ChatEmptyState.js +3 -2
- package/dist/esm/components/ui/Chat/ChatEmptyState/ChatEmptyState.styl.js +1 -1
- package/dist/esm/components/ui/Chat/ChatEmptyState/icons/sparkles.svg.js +77 -0
- package/dist/esm/components/ui/Chat/ChatPrompt/ChatPrompt.js +3 -13
- package/dist/esm/components/ui/Chat/ChatPrompt/ChatPrompt.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.js +14 -3
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.styl.js +7 -0
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +2 -1
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +2 -15
- package/dist/esm/components/ui/Page/AppShell/AppShell.styl.js +1 -1
- package/dist/esm/components/ui/Page/PageContent/PageContent.styl.js +1 -1
- package/dist/esm/types/src/components/ui/Chat/Chat.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/Chat.types.d.ts +3 -2
- package/dist/esm/types/src/components/ui/Chat/ChatChrome/ChatChrome.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatChrome/ChatChrome.types.d.ts +0 -1
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.d.ts +2 -1
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chat/ChatPrompt/ChatPrompt.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSelector.d.ts +2 -1
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.d.ts +4 -1
- package/package.json +1 -6
- package/src/components/ui/Chat/Chat.styl +10 -0
- package/src/components/ui/Chat/Chat.styl.d.ts +1 -0
- package/src/components/ui/Chat/Chat.tsx +14 -1
- package/src/components/ui/Chat/Chat.types.ts +3 -2
- package/src/components/ui/Chat/ChatChrome/ChatChrome.styl +10 -12
- package/src/components/ui/Chat/ChatChrome/ChatChrome.styl.d.ts +1 -3
- package/src/components/ui/Chat/ChatChrome/ChatChrome.tsx +24 -5
- package/src/components/ui/Chat/ChatChrome/ChatChrome.types.ts +0 -1
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.styl +5 -5
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.tsx +10 -3
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.ts +2 -0
- package/src/components/ui/Chat/ChatEmptyState/icons/sparkles.svg +22 -0
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl +0 -19
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl.d.ts +0 -2
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.tsx +1 -26
- package/src/components/ui/Chat/ChatSheet/ChatSelector.styl +24 -0
- package/src/components/ui/Chat/ChatSheet/ChatSelector.styl.d.ts +10 -0
- package/src/components/ui/Chat/ChatSheet/ChatSelector.tsx +59 -21
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +2 -0
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +5 -16
- package/src/components/ui/Page/AppShell/AppShell.styl +2 -0
- package/src/components/ui/Page/PageContent/PageContent.styl +0 -1
- package/src/docs/docsHeaderActions.tsx +8 -0
- package/src/docs/index.tsx +3 -1
- package/src/docs/pages/ChatPage.tsx +93 -42
- package/dist/standalone/vite-sybilion-standalone-dev.d.ts +0 -13
- package/dist/standalone/vite-sybilion-standalone-dev.js +0 -49
- package/src/standalone/vite-sybilion-standalone-dev.ts +0 -65
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { ChatPresets } from './ChatPresets/ChatPresets.js';
|
|
4
4
|
import S from './Chat.styl.js';
|
|
5
5
|
import { ChatEmptyState } from './ChatEmptyState/ChatEmptyState.js';
|
|
6
6
|
import { ChatMessage } from './ChatMessage/ChatMessage.js';
|
|
7
7
|
import { ChatPrompt } from './ChatPrompt/ChatPrompt.js';
|
|
8
|
+
import { ChatSelector } from './ChatSheet/ChatSelector.js';
|
|
8
9
|
|
|
9
|
-
function Chat({ children, className, isEmpty, ...props }) {
|
|
10
|
-
return (
|
|
10
|
+
function Chat({ children, className, isEmpty, scopeId, onChatDeleted, ...props }) {
|
|
11
|
+
return (jsxs("div", { className: cn(S.root, className, isEmpty && S.isEmpty), ...props, children: [scopeId ? (jsx("div", { className: S.header, children: jsx(ChatSelector, { id: scopeId, onChatDeleted: onChatDeleted }) })) : null, children] }));
|
|
11
12
|
}
|
|
12
13
|
Chat.Prompt = ChatPrompt;
|
|
13
14
|
Chat.Message = ChatMessage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Chat_root__IWt99{display:flex;flex-direction:column;height:100
|
|
4
|
-
var S = {"root":"Chat_root__IWt99","isEmpty":"Chat_isEmpty__b4ViB"};
|
|
3
|
+
var css_248z = ".Chat_root__IWt99{background-color:var(--background);display:flex;flex-direction:column;height:100%;min-height:0}.Chat_header__ZjwP-{align-items:center;display:flex;flex-shrink:0;min-height:64px;padding:var(--p-2) var(--p-6) 0}.Chat_isEmpty__b4ViB{padding-bottom:170px}";
|
|
4
|
+
var S = {"root":"Chat_root__IWt99","header":"Chat_header__ZjwP-","isEmpty":"Chat_isEmpty__b4ViB"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { displayLabelForBranchKeyFromMessages, humanizeBranchKey } from '../ChatMessage/presetScript.js';
|
|
4
5
|
import { TextShimmer } from '../../TextShimmer/TextShimmer.js';
|
|
5
6
|
import { Scroll } from '@homecode/ui';
|
|
@@ -10,8 +11,24 @@ import SidebarStem from '../../Sidebar/Sidebar.styl.js';
|
|
|
10
11
|
import { Chat } from '../Chat.js';
|
|
11
12
|
import S from './ChatChrome.styl.js';
|
|
12
13
|
|
|
13
|
-
function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, scriptContinueLabel, onScriptContinue, renderMessageChart, showBranchActionsRow, showSyntheticBranchButtons, unusedBranchKeys, isScriptComplete, onGenerateDashboard, generatingDashboard, onGenerateDashboardClick, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, promptPrefill,
|
|
14
|
-
|
|
14
|
+
function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, scriptContinueLabel, onScriptContinue, renderMessageChart, showBranchActionsRow, showSyntheticBranchButtons, unusedBranchKeys, isScriptComplete, onGenerateDashboard, generatingDashboard, onGenerateDashboardClick, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, promptPrefill, footerClassName, emptyState, }) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (isEmpty)
|
|
17
|
+
return;
|
|
18
|
+
const scrollToBottom = () => {
|
|
19
|
+
const inner = scrollRef.current?.innerElem;
|
|
20
|
+
if (inner) {
|
|
21
|
+
inner.scrollTo({
|
|
22
|
+
top: inner.scrollHeight + 1000,
|
|
23
|
+
behavior: 'smooth',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const inner = scrollRef.current?.innerElem;
|
|
28
|
+
if (inner)
|
|
29
|
+
setTimeout(scrollToBottom, 100);
|
|
30
|
+
}, [isEmpty, messages.length]);
|
|
31
|
+
return (jsxs("div", { className: S.root, children: [showResizeHandle && resizeHandle ? (jsx(PanelResizeHandle, { edge: "leading", isActive: resizeHandle.isActive, startWidthPx: resizeHandle.startWidthPx, getShellWidth: resizeHandle.getShellWidth, onDragWidth: resizeHandle.onDragWidth, onDragComplete: resizeHandle.onDragComplete, className: cn(SidebarStem.sidebarResizeHandle, S.chatResizeHandle) })) : null, jsx("div", { className: S.panelHeader, children: onClose ? (jsx(Button, { type: "button", variant: "ghost", icon: true, className: S.panelClose, "aria-label": "Close chat", onClick: onClose, children: jsx(X, { className: "size-4" }) })) : null }), jsx("div", { className: S.content, children: jsxs(Chat, { isEmpty: isEmpty, scopeId: effectiveScopeId, onChatDeleted: onChatDeleted, children: [isEmpty ? (jsxs(Fragment, { children: [jsx(Chat.EmptyState, { ...emptyState }), renderPresets('fixed')] })) : (jsx("div", { className: S.scrollWrapper, children: jsxs(Scroll, { y: true, yScrollbarClassName: S.scrollbar, className: S.scroll, innerClassName: S.scrollInner, offset: { y: { before: 56, after: 180 } }, fadeSize: "m", autoHide: true, ref: scrollRef, children: [messages.map((msg, index, arr) => {
|
|
15
32
|
const isLast = index === arr.length - 1;
|
|
16
33
|
return (jsx(Chat.Message, { role: msg.role, text: msg.text, onQuickReply: onQuickReply, suppressedQuickReplyKeys: suppressedQuickReplyKeys, quickReplyDisabled: isLoading, isLastMessage: isLast, scriptContinue: isLast && scriptContinueLabel
|
|
17
34
|
? { label: scriptContinueLabel }
|
|
@@ -25,7 +42,7 @@ function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPr
|
|
|
25
42
|
})
|
|
26
43
|
: null, isScriptComplete &&
|
|
27
44
|
onGenerateDashboard &&
|
|
28
|
-
!generatingDashboard ? (jsxs(Button, { type: "button", variant: "default", size: "lg", disabled: isLoading, onClick: onGenerateDashboardClick, children: [jsx(ChartLineIcon, {}), "Generate Dashboard"] })) : null] })), showInlinePresets && renderPresets('inline'), isLoading && isLastMessageFromUser && (jsx(TextShimmer, { duration: 1, spread: 5, className: S.loader, children: "Thinking..." }))] }) })), jsx("div", { className: cn(S.footer, footerClassName), children: jsx(Chat.Prompt, {
|
|
45
|
+
!generatingDashboard ? (jsxs(Button, { type: "button", variant: "default", size: "lg", disabled: isLoading, onClick: onGenerateDashboardClick, children: [jsx(ChartLineIcon, {}), "Generate Dashboard"] })) : null] })), showInlinePresets && renderPresets('inline'), isLoading && isLastMessageFromUser && (jsx(TextShimmer, { duration: 1, spread: 5, className: S.loader, children: "Thinking..." }))] }) })), jsx("div", { className: cn(S.footer, footerClassName), children: jsx(Chat.Prompt, { onSubmit: onPromptSubmit, disabled: isLoading, prefillMessage: promptPrefill ?? undefined }) })] }) })] }));
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
export { ChatChrome };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.
|
|
4
|
-
var S = {"
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatChrome_root__oh4Ay{border-radius:var(--p-4);display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;position:relative}.ChatChrome_chatResizeHandle__epfiT{background-color:var(--page-color);border-radius:2.5px;height:calc(100vh + 200px);left:0;opacity:0;position:absolute;right:auto;top:-200px;touch-action:none;transition:opacity .15s ease-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5px;z-index:30}.ChatChrome_chatResizeHandle__epfiT:before{left:0;right:auto}.ChatChrome_panelHeader__Hkfit{align-items:center;display:flex;flex-shrink:0;justify-content:flex-end;min-height:70px;padding:var(--p-2) var(--p-3);position:absolute;width:100%;z-index:100}.ChatChrome_panelClose__DbKxz{flex-shrink:0}.ChatChrome_content__5qFEi{display:flex;flex:1;flex-direction:column;min-height:0;position:relative}.ChatChrome_scrollWrapper__m4HMu{flex:1;min-height:0;position:relative}.ChatChrome_scroll__oCxoJ{align-items:flex-end;height:100%;max-height:100%;max-width:100%;padding-bottom:var(--p-2);position:absolute;width:100%;z-index:3}.ChatChrome_scrollbar__Hu0aG{right:0!important}.ChatChrome_scrollInner__K9hIy{min-height:100%;padding-top:var(--p-10)}.ChatChrome_scrollInner__K9hIy:after{content:\"\";display:block;height:170px}.ChatChrome_footer__a5Bpp{backdrop-filter:blur(30px);background-color:var(--background-alpha-800);border-top:1px solid var(--border);bottom:0;box-shadow:0 0 20px 16px var(--background);display:flex;flex-direction:column;position:absolute;width:100%;z-index:50}.ChatChrome_loader__9-lnf{color:var(--muted-foreground);margin:var(--p-2) var(--p-6) var(--p-10)}.ChatChrome_branchRow__NMDNv{display:flex;flex-wrap:wrap;gap:8px;margin-top:var(--p-6);padding:0 var(--p-6);width:100%}.ChatChrome_branchBtnWrap__aOSVP{display:inline-flex;vertical-align:middle}";
|
|
4
|
+
var S = {"root":"ChatChrome_root__oh4Ay","chatResizeHandle":"ChatChrome_chatResizeHandle__epfiT","panelHeader":"ChatChrome_panelHeader__Hkfit","panelClose":"ChatChrome_panelClose__DbKxz","content":"ChatChrome_content__5qFEi","scrollWrapper":"ChatChrome_scrollWrapper__m4HMu","scroll":"ChatChrome_scroll__oCxoJ","scrollbar":"ChatChrome_scrollbar__Hu0aG","scrollInner":"ChatChrome_scrollInner__K9hIy","footer":"ChatChrome_footer__a5Bpp","loader":"ChatChrome_loader__9-lnf","branchRow":"ChatChrome_branchRow__NMDNv","branchBtnWrap":"ChatChrome_branchBtnWrap__aOSVP"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import S from './ChatEmptyState.styl.js';
|
|
3
|
+
import SparklesIcon from './icons/sparkles.svg.js';
|
|
3
4
|
|
|
4
|
-
function ChatEmptyState({ icon, title, description, }) {
|
|
5
|
-
return (jsxs("div", { className: S.root, children: [icon && jsx("div", { className: S.icon, children: icon }), title && jsx("h2", { children: title }), description && jsx("p", { children: description })] }));
|
|
5
|
+
function ChatEmptyState({ icon = jsx(SparklesIcon, {}), title = 'Start a conversation', description, additionalContent, children, }) {
|
|
6
|
+
return (jsxs("div", { className: S.root, children: [icon && jsx("div", { className: S.icon, children: icon }), title && jsx("h2", { children: title }), description && jsx("p", { children: description }), additionalContent, children] }));
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export { ChatEmptyState };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".ChatEmptyState_root__j1n-C{align-items:center;display:flex;flex:1;flex-direction:column;gap:var(--p-
|
|
3
|
+
var css_248z = ".ChatEmptyState_root__j1n-C{align-items:center;display:flex;flex:1;flex-direction:column;gap:var(--p-10);justify-content:center;padding:var(--p-6);text-align:center;text-size:var(--text-sm);color:var(--text-secondary)}.ChatEmptyState_icon__YSDgv,.ChatEmptyState_icon__YSDgv>svg{height:32px;width:32px}";
|
|
4
4
|
var S = {"root":"ChatEmptyState_root__j1n-C","icon":"ChatEmptyState_icon__YSDgv"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
var _path, _path2, _path3, _defs;
|
|
4
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
|
+
var SvgSparkles = function SvgSparkles(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
7
|
+
viewBox: "0 0 32 32",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
11
|
+
d: "M13.084 21.205 12 25l-1.084-3.795a6 6 0 0 0-4.121-4.12L3 16l3.795-1.084a6 6 0 0 0 4.12-4.121L12 7l1.084 3.795a6 6 0 0 0 4.121 4.12L21 16l-3.795 1.084a6 6 0 0 0-4.12 4.121Z",
|
|
12
|
+
stroke: "url(#sparkles_svg__a)",
|
|
13
|
+
strokeWidth: 1.33,
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round"
|
|
16
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M24.345 11.62 24 13l-.345-1.38a4.5 4.5 0 0 0-3.274-3.275L19 8l1.38-.345a4.5 4.5 0 0 0 3.275-3.274L24 3l.345 1.38a4.5 4.5 0 0 0 3.274 3.275L29 8l-1.38.345a4.5 4.5 0 0 0-3.275 3.274Z",
|
|
18
|
+
stroke: "url(#sparkles_svg__b)",
|
|
19
|
+
strokeWidth: 1.33,
|
|
20
|
+
strokeLinecap: "round",
|
|
21
|
+
strokeLinejoin: "round"
|
|
22
|
+
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M22.526 27.423 22 29l-.526-1.577a3 3 0 0 0-1.897-1.897L18 25l1.577-.526a3 3 0 0 0 1.897-1.897L22 21l.526 1.577a3 3 0 0 0 1.897 1.897L26 25l-1.577.526a3 3 0 0 0-1.897 1.897Z",
|
|
24
|
+
stroke: "url(#sparkles_svg__c)",
|
|
25
|
+
strokeWidth: 1.33,
|
|
26
|
+
strokeLinecap: "round",
|
|
27
|
+
strokeLinejoin: "round"
|
|
28
|
+
})), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
29
|
+
id: "sparkles_svg__a",
|
|
30
|
+
x1: 3,
|
|
31
|
+
y1: 16,
|
|
32
|
+
x2: 29,
|
|
33
|
+
y2: 16,
|
|
34
|
+
gradientUnits: "userSpaceOnUse"
|
|
35
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
36
|
+
stopColor: "#19BFE9"
|
|
37
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
38
|
+
offset: 0.673,
|
|
39
|
+
stopColor: "#C670E8"
|
|
40
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
41
|
+
offset: 1,
|
|
42
|
+
stopColor: "#DA62AB"
|
|
43
|
+
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
44
|
+
id: "sparkles_svg__b",
|
|
45
|
+
x1: 3,
|
|
46
|
+
y1: 16,
|
|
47
|
+
x2: 29,
|
|
48
|
+
y2: 16,
|
|
49
|
+
gradientUnits: "userSpaceOnUse"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
51
|
+
stopColor: "#19BFE9"
|
|
52
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
53
|
+
offset: 0.673,
|
|
54
|
+
stopColor: "#C670E8"
|
|
55
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
56
|
+
offset: 1,
|
|
57
|
+
stopColor: "#DA62AB"
|
|
58
|
+
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
59
|
+
id: "sparkles_svg__c",
|
|
60
|
+
x1: 3,
|
|
61
|
+
y1: 16,
|
|
62
|
+
x2: 29,
|
|
63
|
+
y2: 16,
|
|
64
|
+
gradientUnits: "userSpaceOnUse"
|
|
65
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
66
|
+
stopColor: "#19BFE9"
|
|
67
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
68
|
+
offset: 0.673,
|
|
69
|
+
stopColor: "#C670E8"
|
|
70
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
71
|
+
offset: 1,
|
|
72
|
+
stopColor: "#DA62AB"
|
|
73
|
+
})))));
|
|
74
|
+
};
|
|
75
|
+
var SparklesIcon = SvgSparkles;
|
|
76
|
+
|
|
77
|
+
export { SparklesIcon as default };
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
|
-
import { ChatSelector } from '../ChatSheet/ChatSelector.js';
|
|
5
|
-
import { useChatsForScopeId } from '../../../../contexts/chat-context.js';
|
|
6
4
|
import useEvent from '../../../../hooks/useEvent.js';
|
|
7
|
-
import { SendHorizontalIcon
|
|
5
|
+
import { SendHorizontalIcon } from 'lucide-react';
|
|
8
6
|
import { Button } from '../../Button/Button.js';
|
|
9
7
|
import { Input } from '../../Input/Input.js';
|
|
10
8
|
import S from './ChatPrompt.styl.js';
|
|
11
9
|
|
|
12
|
-
function ChatPrompt({ onSubmit, placeholder, className, footer,
|
|
10
|
+
function ChatPrompt({ onSubmit, placeholder, className, footer, prefillMessage, }) {
|
|
13
11
|
const [message, setMessage] = useState('');
|
|
14
|
-
const { currentChatId, deleteChat, chats } = useChatsForScopeId(id);
|
|
15
12
|
useEffect(() => {
|
|
16
13
|
if (prefillMessage != null && prefillMessage !== '') {
|
|
17
14
|
setMessage(prefillMessage);
|
|
18
15
|
}
|
|
19
16
|
}, [prefillMessage]);
|
|
20
|
-
const handleDeleteChat = () => {
|
|
21
|
-
if (!currentChatId)
|
|
22
|
-
return;
|
|
23
|
-
const sid = currentChatId;
|
|
24
|
-
deleteChat(sid);
|
|
25
|
-
onChatDeleted?.(sid);
|
|
26
|
-
};
|
|
27
17
|
const handleSubmit = (e) => {
|
|
28
18
|
const trimmedMessage = message.trim();
|
|
29
19
|
if (trimmedMessage) {
|
|
@@ -42,7 +32,7 @@ function ChatPrompt({ onSubmit, placeholder, className, footer, id, onChatDelete
|
|
|
42
32
|
}
|
|
43
33
|
},
|
|
44
34
|
});
|
|
45
|
-
return (jsxs("form", { onSubmit: handleSubmit, className: cn(S.root, className), children: [jsx(Input, { type: "textarea", value: message, onChange: e => setMessage(e.target.value), placeholder: placeholder || 'Type a message...', className: cn(S.input) }), jsxs("div", { className: S.actions, children: [jsx(Button, { type: "submit", size: "sm", disabled: !message.trim(), children: jsx(SendHorizontalIcon, { size: 16 }) }), jsx("div", { className: S.notice, children: "Forecast Assistant can make mistakes." })
|
|
35
|
+
return (jsxs("form", { onSubmit: handleSubmit, className: cn(S.root, className), children: [jsx(Input, { type: "textarea", value: message, onChange: e => setMessage(e.target.value), placeholder: placeholder || 'Type a message...', className: cn(S.input) }), jsxs("div", { className: S.actions, children: [jsx(Button, { type: "submit", size: "sm", disabled: !message.trim(), children: jsx(SendHorizontalIcon, { size: 16 }) }), jsx("div", { className: S.notice, children: "Forecast Assistant can make mistakes." })] }), footer] }));
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
export { ChatPrompt };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatPrompt_root__5G5bq{align-items:center;display:flex;flex-direction:column;gap:var(--p-2);padding:var(--p-6);position:relative}.ChatPrompt_input__QPKBV{border:none;border-radius:0!important;flex:1;min-height:70px;padding:0!important;resize:none}.ChatPrompt_input__QPKBV,.ChatPrompt_input__QPKBV:focus{box-shadow:none!important}.ChatPrompt_actions__pUtB-{align-items:center;display:flex;flex-direction:row-reverse;gap:var(--p-2);justify-content:space-between;width:100%}.ChatPrompt_actions__pUtB->button:focus{box-shadow:0 0 0 2px var(--brand-color-500)!important}.ChatPrompt_actions__pUtB->button:first-child{border:none;position:relative;transition:all .2s}.ChatPrompt_actions__pUtB->button:first-child:focus{transform:scale(1.2)}.ChatPrompt_actions__pUtB->button:first-child:before{bottom:-100%;content:\"\";left:-100%;position:absolute;right:-100%;top:-100%}.ChatPrompt_actions__pUtB- .ChatPrompt_attachButton__gi-qF{background-color:var(--page-color);box-shadow:0 0 20px var(--background)}.
|
|
4
|
-
var S = {"root":"ChatPrompt_root__5G5bq","input":"ChatPrompt_input__QPKBV","actions":"ChatPrompt_actions__pUtB-","attachButton":"ChatPrompt_attachButton__gi-qF","
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatPrompt_root__5G5bq{align-items:center;display:flex;flex-direction:column;gap:var(--p-2);padding:var(--p-6);position:relative}.ChatPrompt_input__QPKBV{border:none;border-radius:0!important;flex:1;min-height:70px;padding:0!important;resize:none}.ChatPrompt_input__QPKBV,.ChatPrompt_input__QPKBV:focus{box-shadow:none!important}.ChatPrompt_actions__pUtB-{align-items:center;display:flex;flex-direction:row-reverse;gap:var(--p-2);justify-content:space-between;width:100%}.ChatPrompt_actions__pUtB->button:focus{box-shadow:0 0 0 2px var(--brand-color-500)!important}.ChatPrompt_actions__pUtB->button:first-child{border:none;position:relative;transition:all .2s}.ChatPrompt_actions__pUtB->button:first-child:focus{transform:scale(1.2)}.ChatPrompt_actions__pUtB->button:first-child:before{bottom:-100%;content:\"\";left:-100%;position:absolute;right:-100%;top:-100%}.ChatPrompt_actions__pUtB- .ChatPrompt_attachButton__gi-qF{background-color:var(--page-color);box-shadow:0 0 20px var(--background)}.ChatPrompt_notice__B-RyW{color:var(--muted-foreground);font-size:var(--text-xs);text-align:center;width:100%}@media (max-width:768px){.ChatPrompt_notice__B-RyW{font-size:10px}}";
|
|
4
|
+
var S = {"root":"ChatPrompt_root__5G5bq","input":"ChatPrompt_input__QPKBV","actions":"ChatPrompt_actions__pUtB-","attachButton":"ChatPrompt_attachButton__gi-qF","notice":"ChatPrompt_notice__B-RyW"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
2
3
|
import { useChatsForScopeId } from '../../../../contexts/chat-context.js';
|
|
4
|
+
import { Trash2Icon } from 'lucide-react';
|
|
5
|
+
import { Button } from '../../Button/Button.js';
|
|
3
6
|
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../../Select/Select.js';
|
|
7
|
+
import S from './ChatSelector.styl.js';
|
|
4
8
|
|
|
5
|
-
function ChatSelector({ id, className }) {
|
|
6
|
-
const { chats, currentChatId, setCurrentChatId, newChat } = useChatsForScopeId(id);
|
|
9
|
+
function ChatSelector({ id, className, onChatDeleted, }) {
|
|
10
|
+
const { chats, currentChatId, setCurrentChatId, newChat, deleteChat } = useChatsForScopeId(id);
|
|
7
11
|
const handleValueChange = (value) => {
|
|
8
12
|
if (value === 'new') {
|
|
9
13
|
newChat();
|
|
@@ -12,6 +16,13 @@ function ChatSelector({ id, className }) {
|
|
|
12
16
|
setCurrentChatId(value);
|
|
13
17
|
}
|
|
14
18
|
};
|
|
19
|
+
const handleDeleteChat = () => {
|
|
20
|
+
if (!currentChatId)
|
|
21
|
+
return;
|
|
22
|
+
const sid = currentChatId;
|
|
23
|
+
deleteChat(sid);
|
|
24
|
+
onChatDeleted?.(sid);
|
|
25
|
+
};
|
|
15
26
|
const getChatDisplayName = (chat) => {
|
|
16
27
|
if (chat.name) {
|
|
17
28
|
return chat.name;
|
|
@@ -23,7 +34,7 @@ function ChatSelector({ id, className }) {
|
|
|
23
34
|
}
|
|
24
35
|
return `Chat ${chat.session_id}`;
|
|
25
36
|
};
|
|
26
|
-
return (jsxs(Select, { value: currentChatId?.toString() ?? '', onValueChange: handleValueChange, children: [jsx(SelectTrigger, { size: "sm", className: className, children: jsx(SelectValue, { placeholder: "Select chat" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "new", children: "+ New Chat" }), chats.map(chat => (jsx(SelectItem, { value: chat.session_id.toString(), selected: chat.session_id === currentChatId, children: getChatDisplayName(chat) }, chat.session_id)))] })] }));
|
|
37
|
+
return (jsxs("div", { className: S.wrapper, children: [jsx("div", { className: S.selectGrow, children: jsxs(Select, { variant: "clear", value: currentChatId?.toString() ?? '', onValueChange: handleValueChange, children: [jsx(SelectTrigger, { size: "sm", className: className ? cn(S.selectTrigger, className) : S.selectTrigger, children: jsx(SelectValue, { placeholder: "Select chat" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "new", children: "+ New Chat" }), chats.map(chat => (jsx(SelectItem, { value: chat.session_id.toString(), selected: chat.session_id === currentChatId, children: getChatDisplayName(chat) }, chat.session_id)))] })] }) }), jsx(Button, { type: "button", variant: "ghost", size: "sm", className: S.deleteBtn, "aria-label": "Delete chat", disabled: !currentChatId || chats.length === 0, onClick: handleDeleteChat, children: jsx(Trash2Icon, { size: 16 }) })] }));
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
export { ChatSelector };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from 'style-inject';
|
|
2
|
+
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatSelector_wrapper__8Z4wN{align-items:center;display:flex;gap:var(--p-2);min-width:200px;z-index:1000}.ChatSelector_selectGrow__bGR0A{flex:1;min-width:0}.ChatSelector_selectTrigger__DASfc{width:100%}.ChatSelector_deleteBtn__oJ-9b{border-radius:50px;flex-shrink:0;opacity:.3}.ChatSelector_wrapper__8Z4wN:hover .ChatSelector_deleteBtn__oJ-9b{opacity:1}";
|
|
4
|
+
var S = {"wrapper":"ChatSelector_wrapper__8Z4wN","selectGrow":"ChatSelector_selectGrow__bGR0A","selectTrigger":"ChatSelector_selectTrigger__DASfc","deleteBtn":"ChatSelector_deleteBtn__oJ-9b"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -4,7 +4,7 @@ import { Button } from '../../Button/Button.js';
|
|
|
4
4
|
import { ChatChrome } from '../ChatChrome/ChatChrome.js';
|
|
5
5
|
import { useChatPanelChromeModel } from './useChatPanelChromeModel.js';
|
|
6
6
|
|
|
7
|
-
function ChatSheet({ triggerLabel = 'Open Chat', triggerAriaLabel, actionsRef, renderTrigger, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, inline = false, }) {
|
|
7
|
+
function ChatSheet({ triggerLabel = 'Open Chat', triggerAriaLabel, actionsRef, renderTrigger, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, emptyState, inline = false, }) {
|
|
8
8
|
const model = useChatPanelChromeModel({
|
|
9
9
|
embedAsPage: inline,
|
|
10
10
|
presets,
|
|
@@ -13,6 +13,7 @@ function ChatSheet({ triggerLabel = 'Open Chat', triggerAriaLabel, actionsRef, r
|
|
|
13
13
|
onScriptComplete,
|
|
14
14
|
onGenerateDashboard,
|
|
15
15
|
renderMessageChart,
|
|
16
|
+
emptyState,
|
|
16
17
|
});
|
|
17
18
|
if (actionsRef) {
|
|
18
19
|
actionsRef.current = {
|
|
@@ -21,7 +21,7 @@ const CHAT_NAV_COLLAPSE_BREAKPOINT_PX = 1400;
|
|
|
21
21
|
const CHAT_QUERY_PARAM = 'chat';
|
|
22
22
|
const CHAT_OPEN_VALUE = 'open';
|
|
23
23
|
const PROMPT_QUERY_PARAM = 'prompt';
|
|
24
|
-
function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, }) {
|
|
24
|
+
function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, emptyState, }) {
|
|
25
25
|
const effectiveScopeId = scopeId ?? NO_SCOPE_FALLBACK;
|
|
26
26
|
const isMobile = useIsMobile();
|
|
27
27
|
const { chatPanelContainer, isOpen: sidebarNavOpen, setOpen: setSidebarNavOpen, chatWidthPx, setChatWidthPx, getShellWidth, setChatPanelOpen, } = useSidebar();
|
|
@@ -117,20 +117,6 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
117
117
|
clearUsedScriptBranchKeysForChat,
|
|
118
118
|
clearIntakeForChat,
|
|
119
119
|
]);
|
|
120
|
-
const scrollToBottom = () => {
|
|
121
|
-
const inner = scrollRef.current?.innerElem;
|
|
122
|
-
if (inner) {
|
|
123
|
-
inner.scrollTo({
|
|
124
|
-
top: inner.scrollHeight + 1000,
|
|
125
|
-
behavior: 'smooth',
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const inner = scrollRef.current?.innerElem;
|
|
131
|
-
if (inner)
|
|
132
|
-
setTimeout(scrollToBottom, 100);
|
|
133
|
-
}, [chat?.messages.length]);
|
|
134
120
|
const onOpenChange = (open) => {
|
|
135
121
|
if (embedAsPage) {
|
|
136
122
|
return;
|
|
@@ -785,6 +771,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
785
771
|
onPromptSubmit: handlePromptSubmit,
|
|
786
772
|
onChatDeleted: endLocalDemoFlow,
|
|
787
773
|
promptPrefill: promptLinkPrefill,
|
|
774
|
+
emptyState,
|
|
788
775
|
};
|
|
789
776
|
const toggleOpen = () => onOpenChange(!isOpen);
|
|
790
777
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.AppShell_root__ONlNK{display:grid;flex:1;grid-template-areas:\"main\";grid-template-columns:1fr;min-height:0;min-height:100%;width:100%}@media (min-width:768px){.AppShell_root__ONlNK{grid-template-areas:\"sidebar main\";grid-template-columns:var(--sidebar-width) 1fr}[data-slot=sidebar-wrapper][data-state=collapsed] .AppShell_root__ONlNK{grid-template-columns:0 1fr}}.AppShell_mainColumn__Emn1p{display:flex;flex:1;flex-direction:column;grid-area:main;min-height:0;min-width:0}[data-slot=sidebar-wrapper][data-state=collapsed] .AppShell_mainColumn__Emn1p{margin-left:var(--p-3)}.AppShell_mainBody__IoVuy{background-color:var(--page-color);border-radius:var(--p-4);flex:1;min-width:0;padding-bottom:var(--page-y-padding)}";
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.AppShell_root__ONlNK{display:grid;flex:1;grid-template-areas:\"main\";grid-template-columns:1fr;min-height:0;min-height:100%;width:100%}@media (min-width:768px){.AppShell_root__ONlNK{grid-template-areas:\"sidebar main\";grid-template-columns:var(--sidebar-width) 1fr}[data-slot=sidebar-wrapper][data-state=collapsed] .AppShell_root__ONlNK{grid-template-columns:0 1fr}}.AppShell_mainColumn__Emn1p{display:flex;flex:1;flex-direction:column;grid-area:main;min-height:0;min-width:0}[data-slot=sidebar-wrapper][data-state=collapsed] .AppShell_mainColumn__Emn1p{margin-left:var(--p-3)}.AppShell_mainBody__IoVuy{background-color:var(--page-color);border-radius:var(--p-4);display:flex;flex:1;flex-direction:column;min-width:0;padding-bottom:var(--page-y-padding)}";
|
|
4
4
|
var S = {"root":"AppShell_root__ONlNK","mainColumn":"AppShell_mainColumn__Emn1p","mainBody":"AppShell_mainBody__IoVuy"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.PageContent_root__caExB{display:flex;flex:1;flex-direction:column;max-width:var(--page-width);min-height:0;
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.PageContent_root__caExB{display:flex;flex:1;flex-direction:column;max-width:var(--page-width);min-height:0;width:100%}.PageContent_section__Wve-w{display:flex;flex-direction:column;min-height:0;padding-left:var(--page-x-padding);padding-right:var(--page-x-padding)}.PageContent_grow__Nkfqk{flex-grow:1}";
|
|
4
4
|
var S = {"root":"PageContent_root__caExB","section":"PageContent_section__Wve-w","grow":"PageContent_grow__Nkfqk"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@ import type { ChatProps } from './Chat.types';
|
|
|
3
3
|
import { ChatEmptyState } from './ChatEmptyState/ChatEmptyState';
|
|
4
4
|
import { ChatMessage } from './ChatMessage';
|
|
5
5
|
import { ChatPrompt } from './ChatPrompt';
|
|
6
|
-
export declare function Chat({ children, className, isEmpty, ...props }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function Chat({ children, className, isEmpty, scopeId, onChatDeleted, ...props }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare namespace Chat {
|
|
8
8
|
var Prompt: typeof ChatPrompt;
|
|
9
9
|
var Message: typeof ChatMessage;
|
|
@@ -46,13 +46,11 @@ export type ScriptCompletePayload = {
|
|
|
46
46
|
};
|
|
47
47
|
export interface ChatPromptProps {
|
|
48
48
|
className?: string;
|
|
49
|
-
id: string;
|
|
50
49
|
onSubmit: (message: string) => void;
|
|
51
50
|
placeholder?: string;
|
|
52
51
|
presets?: ChatPreset[];
|
|
53
52
|
disabled?: boolean;
|
|
54
53
|
footer?: ReactNode;
|
|
55
|
-
onChatDeleted?: (sessionId: string) => void;
|
|
56
54
|
/** Deep link `?prompt=` — one-shot composer pre-fill (see useChatPanelChromeModel). */
|
|
57
55
|
prefillMessage?: string | null;
|
|
58
56
|
}
|
|
@@ -77,4 +75,7 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
77
75
|
children: ReactNode;
|
|
78
76
|
className?: string;
|
|
79
77
|
isEmpty?: boolean;
|
|
78
|
+
/** Chat context scope; when set, header shows chat selector + delete. */
|
|
79
|
+
scopeId?: string;
|
|
80
|
+
onChatDeleted?: (sessionId: string) => void;
|
|
80
81
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChatChromeProps } from './ChatChrome.types';
|
|
2
|
-
export declare function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, scriptContinueLabel, onScriptContinue, renderMessageChart, showBranchActionsRow, showSyntheticBranchButtons, unusedBranchKeys, isScriptComplete, onGenerateDashboard, generatingDashboard, onGenerateDashboardClick, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, promptPrefill,
|
|
2
|
+
export declare function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, scriptContinueLabel, onScriptContinue, renderMessageChart, showBranchActionsRow, showSyntheticBranchButtons, unusedBranchKeys, isScriptComplete, onGenerateDashboard, generatingDashboard, onGenerateDashboardClick, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, promptPrefill, footerClassName, emptyState, }: ChatChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -39,7 +39,6 @@ export interface ChatChromeProps {
|
|
|
39
39
|
onChatDeleted: (sessionId: string) => void;
|
|
40
40
|
/** `?prompt=` deep link text for one-shot composer pre-fill. */
|
|
41
41
|
promptPrefill?: string | null;
|
|
42
|
-
variant?: 'default' | 'sidebar';
|
|
43
42
|
footerClassName?: string;
|
|
44
43
|
emptyState?: ChatEmptyStateProps;
|
|
45
44
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
1
2
|
import type { ChatEmptyStateProps } from './ChatEmptyState.types';
|
|
2
|
-
export declare function ChatEmptyState({ icon, title, description, }: ChatEmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ChatEmptyState({ icon, title, description, additionalContent, children, }: PropsWithChildren<ChatEmptyStateProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChatPromptProps } from '../Chat.types';
|
|
2
|
-
export declare function ChatPrompt({ onSubmit, placeholder, className, footer,
|
|
2
|
+
export declare function ChatPrompt({ onSubmit, placeholder, className, footer, prefillMessage, }: ChatPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface ChatSelectorProps {
|
|
2
2
|
id: string;
|
|
3
3
|
className?: string;
|
|
4
|
+
onChatDeleted?: (sessionId: string) => void;
|
|
4
5
|
}
|
|
5
|
-
export declare function ChatSelector({ id, className }: ChatSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function ChatSelector({ id, className, onChatDeleted, }: ChatSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,4 +19,4 @@ export interface ChatSheetProps extends Omit<UseChatPanelChromeModelInput, 'embe
|
|
|
19
19
|
*/
|
|
20
20
|
inline?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export declare function ChatSheet({ triggerLabel, triggerAriaLabel, actionsRef, renderTrigger, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, inline, }: ChatSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function ChatSheet({ triggerLabel, triggerAriaLabel, actionsRef, renderTrigger, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, emptyState, inline, }: ChatSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChatPreset, type ScriptCompletePayload } from '#uilib/components/ui/Chat/Chat.types';
|
|
2
2
|
import type { ChatChromeProps } from '../ChatChrome';
|
|
3
|
+
import type { ChatEmptyStateProps } from '../ChatEmptyState/ChatEmptyState.types';
|
|
3
4
|
export type UseChatPanelChromeModelInput = {
|
|
4
5
|
/** When true, skip sidebar chat slot, URL `?chat=`, and portal behavior (e.g. page main content). */
|
|
5
6
|
embedAsPage: boolean;
|
|
@@ -13,6 +14,8 @@ export type UseChatPanelChromeModelInput = {
|
|
|
13
14
|
onGenerateDashboard?: (transcript: string) => void | Promise<void>;
|
|
14
15
|
/** Renders `[CHART]` tokens in assistant messages. */
|
|
15
16
|
renderMessageChart?: () => React.ReactNode;
|
|
17
|
+
/** Forwarded to `ChatChrome` when the thread is empty. */
|
|
18
|
+
emptyState?: ChatEmptyStateProps;
|
|
16
19
|
};
|
|
17
20
|
export type UseChatPanelChromeModelResult = {
|
|
18
21
|
chromeProps: ChatChromeProps;
|
|
@@ -22,4 +25,4 @@ export type UseChatPanelChromeModelResult = {
|
|
|
22
25
|
newChat: () => void;
|
|
23
26
|
chatPanelContainer: HTMLElement | null;
|
|
24
27
|
};
|
|
25
|
-
export declare function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, }: UseChatPanelChromeModelInput): UseChatPanelChromeModelResult;
|
|
28
|
+
export declare function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, onGenerateDashboard, renderMessageChart, emptyState, }: UseChatPanelChromeModelInput): UseChatPanelChromeModelResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybilion/uilib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "Sybilion Design System — React UI components (Webpack + Stylus)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -35,11 +35,6 @@
|
|
|
35
35
|
"default": "./dist/esm/hooks/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./src/*": "./src/*",
|
|
38
|
-
"./vite-standalone-dev": {
|
|
39
|
-
"types": "./dist/standalone/vite-sybilion-standalone-dev.d.ts",
|
|
40
|
-
"import": "./dist/standalone/vite-sybilion-standalone-dev.js",
|
|
41
|
-
"default": "./dist/standalone/vite-sybilion-standalone-dev.js"
|
|
42
|
-
},
|
|
43
38
|
"./logo.svg": "./src/assets/logo.svg"
|
|
44
39
|
},
|
|
45
40
|
"files": [
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
display flex
|
|
3
3
|
flex-direction column
|
|
4
4
|
height 100%
|
|
5
|
+
min-height 0
|
|
6
|
+
// max-height 100vh
|
|
7
|
+
background-color var(--background)
|
|
8
|
+
|
|
9
|
+
.header
|
|
10
|
+
flex-shrink 0
|
|
11
|
+
display flex
|
|
12
|
+
align-items center
|
|
13
|
+
min-height 64px
|
|
14
|
+
padding var(--p-2) var(--p-6) 0
|
|
5
15
|
|
|
6
16
|
.isEmpty
|
|
7
17
|
padding-bottom 170px // goes under prompt
|
|
@@ -7,10 +7,23 @@ import type { ChatProps } from './Chat.types';
|
|
|
7
7
|
import { ChatEmptyState } from './ChatEmptyState/ChatEmptyState';
|
|
8
8
|
import { ChatMessage } from './ChatMessage';
|
|
9
9
|
import { ChatPrompt } from './ChatPrompt';
|
|
10
|
+
import { ChatSelector } from './ChatSheet/ChatSelector';
|
|
10
11
|
|
|
11
|
-
export function Chat({
|
|
12
|
+
export function Chat({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
isEmpty,
|
|
16
|
+
scopeId,
|
|
17
|
+
onChatDeleted,
|
|
18
|
+
...props
|
|
19
|
+
}: ChatProps) {
|
|
12
20
|
return (
|
|
13
21
|
<div className={cn(S.root, className, isEmpty && S.isEmpty)} {...props}>
|
|
22
|
+
{scopeId ? (
|
|
23
|
+
<div className={S.header}>
|
|
24
|
+
<ChatSelector id={scopeId} onChatDeleted={onChatDeleted} />
|
|
25
|
+
</div>
|
|
26
|
+
) : null}
|
|
14
27
|
{children}
|
|
15
28
|
</div>
|
|
16
29
|
);
|
|
@@ -54,13 +54,11 @@ export type ScriptCompletePayload = {
|
|
|
54
54
|
|
|
55
55
|
export interface ChatPromptProps {
|
|
56
56
|
className?: string;
|
|
57
|
-
id: string;
|
|
58
57
|
onSubmit: (message: string) => void;
|
|
59
58
|
placeholder?: string;
|
|
60
59
|
presets?: ChatPreset[];
|
|
61
60
|
disabled?: boolean;
|
|
62
61
|
footer?: ReactNode;
|
|
63
|
-
onChatDeleted?: (sessionId: string) => void;
|
|
64
62
|
/** Deep link `?prompt=` — one-shot composer pre-fill (see useChatPanelChromeModel). */
|
|
65
63
|
prefillMessage?: string | null;
|
|
66
64
|
}
|
|
@@ -85,4 +83,7 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
85
83
|
children: ReactNode;
|
|
86
84
|
className?: string;
|
|
87
85
|
isEmpty?: boolean;
|
|
86
|
+
/** Chat context scope; when set, header shows chat selector + delete. */
|
|
87
|
+
scopeId?: string;
|
|
88
|
+
onChatDeleted?: (sessionId: string) => void;
|
|
88
89
|
}
|