@sybilion/uilib 1.3.81 → 1.3.82
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/ChatChrome/ChatChrome.js +6 -4
- package/dist/esm/components/ui/Chat/ChatChrome/ChatChrome.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatPresets/ChatPresets.js +2 -2
- package/dist/esm/components/ui/Chat/ChatPresets/ChatPresets.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +2 -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 +6 -1
- package/dist/esm/types/src/components/ui/Chat/ChatChrome/index.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatPresets/ChatPresets.d.ts +3 -1
- package/dist/esm/types/src/components/ui/Chat/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/ui/Chat/ChatChrome/ChatChrome.styl +22 -4
- package/src/components/ui/Chat/ChatChrome/ChatChrome.styl.d.ts +4 -0
- package/src/components/ui/Chat/ChatChrome/ChatChrome.tsx +18 -9
- package/src/components/ui/Chat/ChatChrome/ChatChrome.types.ts +11 -1
- package/src/components/ui/Chat/ChatChrome/index.ts +1 -0
- package/src/components/ui/Chat/ChatPresets/ChatPresets.styl +2 -1
- package/src/components/ui/Chat/ChatPresets/ChatPresets.styl.d.ts +1 -0
- package/src/components/ui/Chat/ChatPresets/ChatPresets.tsx +10 -1
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +6 -2
- package/src/components/ui/Chat/index.ts +1 -0
- package/src/docs/pages/ChartAreaInteractivePage.tsx +7 -8
- package/src/docs/pages/ChatAttachmentsDropzonePage.tsx +1 -0
- package/src/docs/pages/ChatComposerPrefillPage.tsx +1 -0
- package/src/docs/pages/ChatPage.tsx +1 -1
- package/src/docs/pages/ChatSlashCommandsPage.tsx +1 -0
- package/src/docs/pages/ChatUserCsvAttachmentPage.tsx +1 -0
|
@@ -15,7 +15,7 @@ import { filterToTextAttachments, isAttachmentsDropzoneEnabled, buildAcceptAttr
|
|
|
15
15
|
import { extractChatAttachmentItems } from '../chatAttachmentExtract.js';
|
|
16
16
|
import S from './ChatChrome.styl.js';
|
|
17
17
|
|
|
18
|
-
function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, loadingLabel, scriptContinueLabel, onScriptContinue, renderMessageChart, renderSystemMessage, showSyntheticBranchButtons, unusedBranchKeys, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, onNewChat, promptPrefill, footerClassName, emptyState, allowedAttachments, allowPdfAttachments = false, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, promptPlaceholder, hideChatSelector = false, }) {
|
|
18
|
+
function ChatChrome({ variant = 'default', showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, loadingLabel, scriptContinueLabel, onScriptContinue, renderMessageChart, renderSystemMessage, showSyntheticBranchButtons, unusedBranchKeys, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, onNewChat, promptPrefill, footerClassName, emptyState, allowedAttachments, allowPdfAttachments = false, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, promptPlaceholder, hideChatSelector = false, }) {
|
|
19
19
|
const filteredAllowedAttachments = useMemo(() => filterToTextAttachments(allowedAttachments), [allowedAttachments]);
|
|
20
20
|
const attachmentsDropzoneEnabled = isAttachmentsDropzoneEnabled(allowedAttachments, allowPdfAttachments);
|
|
21
21
|
const attachmentAccept = useMemo(() => buildAcceptAttr(filteredAllowedAttachments, allowPdfAttachments), [filteredAllowedAttachments, allowPdfAttachments]);
|
|
@@ -76,7 +76,8 @@ function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPr
|
|
|
76
76
|
showInlinePresets,
|
|
77
77
|
showSyntheticBranchButtons,
|
|
78
78
|
]);
|
|
79
|
-
|
|
79
|
+
const isClean = variant === 'clean';
|
|
80
|
+
return (jsxs("div", { className: cn(S.root, isClean && S.rootClean), 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 }), jsxs("div", { className: S.content, children: [attachmentsDropzoneEnabled ? (jsx(DropZone, { accept: attachmentAccept, label: "Drop text files to attach", multiple: true, ghost: true, overlayScope: "container", disabled: promptDisabled, className: S.attachmentDropzone, onFiles: handleAttachmentFiles })) : null, jsxs(Chat, { className: isClean ? S.chatClean : undefined, isEmpty: isEmpty, scopeId: effectiveScopeId, onChatDeleted: onChatDeleted, onNewChat: onNewChat, hideChatSelector: hideChatSelector, children: [isEmpty ? (jsx("div", { className: S.emptyBody, children: jsx(Chat.EmptyState, { ...emptyState }) })) : (jsx("div", { className: S.scrollWrapper, children: jsxs(Scroll, { y: true, yScrollbarClassName: S.scrollbar, className: S.scroll, innerClassName: S.scrollInner, offset: { y: { before: 56, after: 24 } }, fadeSize: "m", autoHide: true, ref: scrollRef, children: [messages.map((msg, index, arr) => {
|
|
80
81
|
const isLast = index === arr.length - 1;
|
|
81
82
|
return (jsx(Chat.Message, { message: msg, role: msg.role, text: msg.text, inProgress: msg.inProgress, userTextFileAttachments: msg.userTextFileAttachments, onQuickReply: onQuickReply, suppressedQuickReplyKeys: suppressedQuickReplyKeys, quickReplyDisabled: isLoading, quickReplyHidden: Boolean(loadingLabel), isLastMessage: isLast, scriptContinue: isLast && scriptContinueLabel
|
|
82
83
|
? { label: scriptContinueLabel }
|
|
@@ -87,9 +88,10 @@ function ChatChrome({ showResizeHandle, resizeHandle, onClose, isEmpty, renderPr
|
|
|
87
88
|
const label = displayLabelForBranchKeyFromMessages(key, messages) ??
|
|
88
89
|
humanizeBranchKey(key);
|
|
89
90
|
return (jsx("span", { className: S.branchBtnWrap, children: jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: isLoading, onClick: () => onQuickReply(key, label), children: [jsx(PaperPlaneRightIcon, {}), label] }) }, key));
|
|
90
|
-
}) })) : null, showInlinePresets &&
|
|
91
|
+
}) })) : null, showInlinePresets &&
|
|
92
|
+
renderPresets('inline', { variant }), isLoading &&
|
|
91
93
|
!hasInProgressSystemMessage &&
|
|
92
|
-
(isLastMessageFromUser || loadingLabel) && (jsx(TextShimmer, { duration: 1, spread: 5, className: S.loader, children: loadingLabel ?? 'Thinking...' }))] }) })), isEmpty ? (jsx("div", { className: S.fixedPresets, children: renderPresets('fixed') })) : null,
|
|
94
|
+
(isLastMessageFromUser || loadingLabel) && (jsx(TextShimmer, { duration: 1, spread: 5, className: S.loader, children: loadingLabel ?? 'Thinking...' }))] }) })), isEmpty ? (jsx("div", { className: S.fixedPresets, children: renderPresets('fixed', { variant }) })) : null, isEmpty ? (jsx("div", { className: S.notice, children: "Forecast Assistant can make mistakes." })) : null, jsx("div", { className: cn(S.footer, isClean && S.footerClean, footerClassName), children: jsx(Chat.Prompt, { className: isClean ? S.promptClean : undefined, onSubmit: handlePromptSubmitWithAttachments, disabled: promptDisabled, attachments: pendingAttachments, onRemoveAttachment: handleRemoveAttachment, prefillMessage: promptPrefill ?? undefined, placeholder: promptPlaceholder, slashCommandItems: slashCommandItems, onSlashItemCommand: onSlashItemCommand, attachmentAccept: attachmentsDropzoneEnabled ? attachmentAccept : undefined, onAttachmentFiles: attachmentsDropzoneEnabled ? handleAttachmentFiles : undefined }) })] })] })] }));
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
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)}}.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_attachmentDropzone__OC8UI{inset:0;position:absolute;z-index:200}.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_emptyBody__f2NE8{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden}.ChatChrome_emptyBody__f2NE8>*{flex:1;min-height:0;overflow:auto}.ChatChrome_footer__a5Bpp{backdrop-filter:blur(30px);background-color:var(--background-alpha-800);border-top:1px solid var(--border);box-shadow:0 8px 24px 0 var(--background);display:flex;flex-direction:column;flex-shrink:0;position:relative;width:100%;z-index:50}.ChatChrome_fixedPresets__bONhR{flex-shrink:0;position:relative;width:100%;z-index:10}.ChatChrome_notice__JACIw{color:var(--muted-foreground);font-size:var(--text-xs);
|
|
4
|
-
var S = {"root":"ChatChrome_root__oh4Ay","chatResizeHandle":"ChatChrome_chatResizeHandle__epfiT","panelHeader":"ChatChrome_panelHeader__Hkfit","panelClose":"ChatChrome_panelClose__DbKxz","content":"ChatChrome_content__5qFEi","attachmentDropzone":"ChatChrome_attachmentDropzone__OC8UI","scrollWrapper":"ChatChrome_scrollWrapper__m4HMu","scroll":"ChatChrome_scroll__oCxoJ","scrollbar":"ChatChrome_scrollbar__Hu0aG","scrollInner":"ChatChrome_scrollInner__K9hIy","emptyBody":"ChatChrome_emptyBody__f2NE8","footer":"ChatChrome_footer__a5Bpp","fixedPresets":"ChatChrome_fixedPresets__bONhR","notice":"ChatChrome_notice__JACIw","loader":"ChatChrome_loader__9-lnf","branchRow":"ChatChrome_branchRow__NMDNv","branchBtnWrap":"ChatChrome_branchBtnWrap__aOSVP"};
|
|
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_rootClean__WXM91{border-radius:0}.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_chatClean__hM9yS{background-color:transparent}.ChatChrome_attachmentDropzone__OC8UI{inset:0;position:absolute;z-index:200}.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_emptyBody__f2NE8{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden}.ChatChrome_emptyBody__f2NE8>*{flex:1;min-height:0;overflow:auto}.ChatChrome_footer__a5Bpp{backdrop-filter:blur(30px);background-color:var(--background-alpha-800);border-top:1px solid var(--border);box-shadow:0 8px 24px 0 var(--background);display:flex;flex-direction:column;flex-shrink:0;position:relative;width:100%;z-index:50}.ChatChrome_footerClean__xRDdB{backdrop-filter:none;background-color:transparent;border-top:none;border:1px solid var(--border);border-radius:var(--p-4);box-shadow:none}.ChatChrome_promptClean__Hv43Z{background-color:var(--background);border-radius:inherit}.ChatChrome_fixedPresets__bONhR,.ChatChrome_notice__JACIw{flex-shrink:0;position:relative;width:100%;z-index:10}.ChatChrome_notice__JACIw{color:var(--muted-foreground);font-size:var(--text-xs);margin-bottom:var(--p-1);pointer-events:none;text-align:center}@media (max-width:768px){.ChatChrome_notice__JACIw{font-size:10px}}.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","rootClean":"ChatChrome_rootClean__WXM91","chatResizeHandle":"ChatChrome_chatResizeHandle__epfiT","panelHeader":"ChatChrome_panelHeader__Hkfit","panelClose":"ChatChrome_panelClose__DbKxz","content":"ChatChrome_content__5qFEi","chatClean":"ChatChrome_chatClean__hM9yS","attachmentDropzone":"ChatChrome_attachmentDropzone__OC8UI","scrollWrapper":"ChatChrome_scrollWrapper__m4HMu","scroll":"ChatChrome_scroll__oCxoJ","scrollbar":"ChatChrome_scrollbar__Hu0aG","scrollInner":"ChatChrome_scrollInner__K9hIy","emptyBody":"ChatChrome_emptyBody__f2NE8","footer":"ChatChrome_footer__a5Bpp","footerClean":"ChatChrome_footerClean__xRDdB","promptClean":"ChatChrome_promptClean__Hv43Z","fixedPresets":"ChatChrome_fixedPresets__bONhR","notice":"ChatChrome_notice__JACIw","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 };
|
|
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react';
|
|
|
4
4
|
import { Button } from '../../Button/Button.js';
|
|
5
5
|
import S from './ChatPresets.styl.js';
|
|
6
6
|
|
|
7
|
-
function ChatPresets({ chatId, items, usedItemIds = [], layout = 'fixed', onSelect, onItemUsed, }) {
|
|
7
|
+
function ChatPresets({ chatId, items, usedItemIds = [], layout = 'fixed', variant = 'default', onSelect, onItemUsed, }) {
|
|
8
8
|
const [localUsedItems, setLocalUsedItems] = useState([]);
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
setLocalUsedItems([]);
|
|
@@ -13,7 +13,7 @@ function ChatPresets({ chatId, items, usedItemIds = [], layout = 'fixed', onSele
|
|
|
13
13
|
const availableItems = items.filter(item => !usedItems.includes(item.id));
|
|
14
14
|
if (availableItems.length === 0)
|
|
15
15
|
return null;
|
|
16
|
-
return (jsx("div", { className: layout === 'inline' ? S.inlineRoot : S.root, children: jsx("div", { className: cn(S.inner, layout === 'inline' && S.innerInline), children: availableItems.map(preset => (jsx(Button, { type: "button", variant: "outline", size: "sm", className: cn(S.item), onClick: () => {
|
|
16
|
+
return (jsx("div", { className: layout === 'inline' ? S.inlineRoot : S.root, children: jsx("div", { className: cn(S.inner, layout === 'inline' && S.innerInline, variant === 'clean' && S.innerClean), children: availableItems.map(preset => (jsx(Button, { type: "button", variant: "outline", size: "sm", className: cn(S.item), onClick: () => {
|
|
17
17
|
onSelect?.(preset);
|
|
18
18
|
onItemUsed?.(preset.id);
|
|
19
19
|
setLocalUsedItems(prev => [...prev, preset.id]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".ChatPresets_root__Cj42o{flex-shrink:0;position:relative;width:100%}.ChatPresets_inlineRoot__WXVnu{margin-top:var(--p-6);position:relative;width:100%}.ChatPresets_inner__h14-q{background-color:var(--background);display:flex;flex-wrap:wrap;gap:8px;min-width:0;padding:var(--p-2) var(--p-6) var(--p-3)}.ChatPresets_innerInline__iPM2b{background-color:transparent}.ChatPresets_item__LfX5b{flex:0 1 auto;font-size:var(--text-xs);height:auto;line-height:1.4;max-width:min(300px,100%);min-height:auto;min-width:0;overflow-wrap:anywhere;padding:var(--p-3);text-align:left;white-space:break-spaces!important}";
|
|
4
|
-
var S = {"root":"ChatPresets_root__Cj42o","inlineRoot":"ChatPresets_inlineRoot__WXVnu","inner":"ChatPresets_inner__h14-q","innerInline":"ChatPresets_innerInline__iPM2b","item":"ChatPresets_item__LfX5b"};
|
|
3
|
+
var css_248z = ".ChatPresets_root__Cj42o{flex-shrink:0;position:relative;width:100%}.ChatPresets_inlineRoot__WXVnu{margin-top:var(--p-6);position:relative;width:100%}.ChatPresets_inner__h14-q{background-color:var(--background);display:flex;flex-wrap:wrap;gap:8px;min-width:0;padding:var(--p-2) var(--p-6) var(--p-3)}.ChatPresets_innerClean__U-sL0,.ChatPresets_innerInline__iPM2b{background-color:transparent}.ChatPresets_item__LfX5b{flex:0 1 auto;font-size:var(--text-xs);height:auto;line-height:1.4;max-width:min(300px,100%);min-height:auto;min-width:0;overflow-wrap:anywhere;padding:var(--p-3);text-align:left;white-space:break-spaces!important}";
|
|
4
|
+
var S = {"root":"ChatPresets_root__Cj42o","inlineRoot":"ChatPresets_inlineRoot__WXVnu","inner":"ChatPresets_inner__h14-q","innerInline":"ChatPresets_innerInline__iPM2b","innerClean":"ChatPresets_innerClean__U-sL0","item":"ChatPresets_item__LfX5b"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -813,10 +813,10 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
813
813
|
sidebarWidthPx,
|
|
814
814
|
chatWidthPx,
|
|
815
815
|
]);
|
|
816
|
-
const renderPresets = (layout = 'fixed') => {
|
|
816
|
+
const renderPresets = (layout = 'fixed', options) => {
|
|
817
817
|
if (!presetsWithFreeform?.length)
|
|
818
818
|
return null;
|
|
819
|
-
return (jsx(Chat.Presets, { chatId: currentChatId ?? '', items: presetsWithFreeform, layout: layout, usedItemIds: usedPresetIds, onSelect: preset => {
|
|
819
|
+
return (jsx(Chat.Presets, { chatId: currentChatId ?? '', items: presetsWithFreeform, layout: layout, variant: options?.variant, usedItemIds: usedPresetIds, onSelect: preset => {
|
|
820
820
|
void submitPreset(preset);
|
|
821
821
|
} }));
|
|
822
822
|
};
|
|
@@ -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, loadingLabel, scriptContinueLabel, onScriptContinue, renderMessageChart, renderSystemMessage, showSyntheticBranchButtons, unusedBranchKeys, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, onNewChat, promptPrefill, footerClassName, emptyState, allowedAttachments, allowPdfAttachments, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, promptPlaceholder, hideChatSelector, }: ChatChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function ChatChrome({ variant, showResizeHandle, resizeHandle, onClose, isEmpty, renderPresets, messages, onQuickReply, suppressedQuickReplyKeys, isLoading, loadingLabel, scriptContinueLabel, onScriptContinue, renderMessageChart, renderSystemMessage, showSyntheticBranchButtons, unusedBranchKeys, showInlinePresets, isLastMessageFromUser, scrollRef, effectiveScopeId, onPromptSubmit, onChatDeleted, onNewChat, promptPrefill, footerClassName, emptyState, allowedAttachments, allowPdfAttachments, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, promptPlaceholder, hideChatSelector, }: ChatChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,12 +12,17 @@ export type ChatChromeResizeHandleConfig = {
|
|
|
12
12
|
onDragComplete: (finalRawPx: number) => void;
|
|
13
13
|
};
|
|
14
14
|
export type { ChatAttachmentDropItem };
|
|
15
|
+
export type ChatChromeVariant = 'default' | 'clean';
|
|
16
|
+
export type ChatPresetsRenderOptions = {
|
|
17
|
+
variant?: ChatChromeVariant;
|
|
18
|
+
};
|
|
15
19
|
export interface ChatChromeProps {
|
|
20
|
+
variant?: ChatChromeVariant;
|
|
16
21
|
showResizeHandle: boolean;
|
|
17
22
|
resizeHandle: ChatChromeResizeHandleConfig | undefined;
|
|
18
23
|
onClose: (() => void) | undefined;
|
|
19
24
|
isEmpty: boolean;
|
|
20
|
-
renderPresets: (layout: ChatPresetsLayout) => React.ReactNode;
|
|
25
|
+
renderPresets: (layout: ChatPresetsLayout, options?: ChatPresetsRenderOptions) => React.ReactNode;
|
|
21
26
|
/** Message list for the scroll area; use `[]` when empty. */
|
|
22
27
|
messages: Message[];
|
|
23
28
|
onQuickReply: (branchKey: string, displayLabel: string) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ChatChrome } from './ChatChrome';
|
|
2
|
-
export type { ChatAttachmentDropItem, ChatChromeProps, ChatChromeResizeHandleConfig, } from './ChatChrome.types';
|
|
2
|
+
export type { ChatAttachmentDropItem, ChatChromeProps, ChatChromeResizeHandleConfig, ChatChromeVariant, } from './ChatChrome.types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChatChromeVariant } from '../ChatChrome/ChatChrome.types';
|
|
1
2
|
import type { ChatPreset } from '../Chat.types';
|
|
2
3
|
export type ChatPresetsLayout = 'fixed' | 'inline';
|
|
3
4
|
export interface ChatPresetsProps {
|
|
@@ -5,7 +6,8 @@ export interface ChatPresetsProps {
|
|
|
5
6
|
items: ChatPreset[];
|
|
6
7
|
usedItemIds?: string[];
|
|
7
8
|
layout?: ChatPresetsLayout;
|
|
9
|
+
variant?: ChatChromeVariant;
|
|
8
10
|
onSelect?: (preset: ChatPreset) => void;
|
|
9
11
|
onItemUsed?: (id: string) => void;
|
|
10
12
|
}
|
|
11
|
-
export declare function ChatPresets({ chatId, items, usedItemIds, layout, onSelect, onItemUsed, }: ChatPresetsProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function ChatPresets({ chatId, items, usedItemIds, layout, variant, onSelect, onItemUsed, }: ChatPresetsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Chat } from './Chat';
|
|
2
2
|
export { formatChatTranscript, usedPresetIdsFromMessages, } from './chat-preset-utils';
|
|
3
3
|
export { ChatChrome } from './ChatChrome';
|
|
4
|
-
export type { ChatChromeProps, ChatChromeResizeHandleConfig, } from './ChatChrome';
|
|
4
|
+
export type { ChatChromeProps, ChatChromeResizeHandleConfig, ChatChromeVariant, } from './ChatChrome';
|
|
5
5
|
export { TEXT_ATTACHMENT_ACCEPT_PARTS, filterToTextAttachments, } from './chatAttachmentAccept';
|
|
6
6
|
export { buildChatSendMessagePayload, displayTextFromSendPayload, normalizeUserTextFileAttachments, } from './buildChatSendMessagePayload';
|
|
7
7
|
export { sanitizeAttachmentFilename } from './sanitizeAttachmentFilename';
|
package/package.json
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
overflow hidden
|
|
10
10
|
border-radius var(--p-4)
|
|
11
11
|
|
|
12
|
+
.rootClean
|
|
13
|
+
border-radius 0
|
|
14
|
+
|
|
12
15
|
.chatResizeHandle
|
|
13
16
|
position: absolute;
|
|
14
17
|
// top 0 !important
|
|
@@ -57,6 +60,9 @@
|
|
|
57
60
|
flex-direction column
|
|
58
61
|
position relative
|
|
59
62
|
|
|
63
|
+
.chatClean
|
|
64
|
+
background-color transparent
|
|
65
|
+
|
|
60
66
|
.attachmentDropzone
|
|
61
67
|
position absolute
|
|
62
68
|
inset 0
|
|
@@ -111,6 +117,18 @@
|
|
|
111
117
|
border-top 1px solid var(--border)
|
|
112
118
|
box-shadow 0 8px 24px 0 var(--background)
|
|
113
119
|
|
|
120
|
+
.footerClean
|
|
121
|
+
backdrop-filter none
|
|
122
|
+
background-color transparent
|
|
123
|
+
border-top none
|
|
124
|
+
box-shadow none
|
|
125
|
+
border 1px solid var(--border)
|
|
126
|
+
border-radius var(--p-4)
|
|
127
|
+
|
|
128
|
+
.promptClean
|
|
129
|
+
background-color var(--background)
|
|
130
|
+
border-radius inherit
|
|
131
|
+
|
|
114
132
|
.fixedPresets
|
|
115
133
|
position relative
|
|
116
134
|
z-index 10
|
|
@@ -118,10 +136,10 @@
|
|
|
118
136
|
width 100%
|
|
119
137
|
|
|
120
138
|
.notice
|
|
121
|
-
position
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
139
|
+
position relative
|
|
140
|
+
z-index 10
|
|
141
|
+
flex-shrink 0
|
|
142
|
+
width 100%
|
|
125
143
|
margin-bottom var(--p-1)
|
|
126
144
|
|
|
127
145
|
font-size var(--text-xs)
|
|
@@ -4,16 +4,20 @@ interface CssExports {
|
|
|
4
4
|
'attachmentDropzone': string;
|
|
5
5
|
'branchBtnWrap': string;
|
|
6
6
|
'branchRow': string;
|
|
7
|
+
'chatClean': string;
|
|
7
8
|
'chatResizeHandle': string;
|
|
8
9
|
'content': string;
|
|
9
10
|
'emptyBody': string;
|
|
10
11
|
'fixedPresets': string;
|
|
11
12
|
'footer': string;
|
|
13
|
+
'footerClean': string;
|
|
12
14
|
'loader': string;
|
|
13
15
|
'notice': string;
|
|
14
16
|
'panelClose': string;
|
|
15
17
|
'panelHeader': string;
|
|
18
|
+
'promptClean': string;
|
|
16
19
|
'root': string;
|
|
20
|
+
'rootClean': string;
|
|
17
21
|
'scroll': string;
|
|
18
22
|
'scrollInner': string;
|
|
19
23
|
'scrollWrapper': string;
|
|
@@ -25,6 +25,7 @@ import S from './ChatChrome.styl';
|
|
|
25
25
|
import type { ChatChromeProps } from './ChatChrome.types';
|
|
26
26
|
|
|
27
27
|
export function ChatChrome({
|
|
28
|
+
variant = 'default',
|
|
28
29
|
showResizeHandle,
|
|
29
30
|
resizeHandle,
|
|
30
31
|
onClose,
|
|
@@ -150,8 +151,10 @@ export function ChatChrome({
|
|
|
150
151
|
showSyntheticBranchButtons,
|
|
151
152
|
]);
|
|
152
153
|
|
|
154
|
+
const isClean = variant === 'clean';
|
|
155
|
+
|
|
153
156
|
return (
|
|
154
|
-
<div className={S.root}>
|
|
157
|
+
<div className={cn(S.root, isClean && S.rootClean)}>
|
|
155
158
|
{showResizeHandle && resizeHandle ? (
|
|
156
159
|
<PanelResizeHandle
|
|
157
160
|
edge="leading"
|
|
@@ -191,6 +194,7 @@ export function ChatChrome({
|
|
|
191
194
|
/>
|
|
192
195
|
) : null}
|
|
193
196
|
<Chat
|
|
197
|
+
className={isClean ? S.chatClean : undefined}
|
|
194
198
|
isEmpty={isEmpty}
|
|
195
199
|
scopeId={effectiveScopeId}
|
|
196
200
|
onChatDeleted={onChatDeleted}
|
|
@@ -268,7 +272,8 @@ export function ChatChrome({
|
|
|
268
272
|
</div>
|
|
269
273
|
) : null}
|
|
270
274
|
|
|
271
|
-
{showInlinePresets &&
|
|
275
|
+
{showInlinePresets &&
|
|
276
|
+
renderPresets('inline', { variant })}
|
|
272
277
|
|
|
273
278
|
{isLoading &&
|
|
274
279
|
!hasInProgressSystemMessage &&
|
|
@@ -282,16 +287,20 @@ export function ChatChrome({
|
|
|
282
287
|
)}
|
|
283
288
|
|
|
284
289
|
{isEmpty ? (
|
|
285
|
-
<div className={S.fixedPresets}>
|
|
290
|
+
<div className={S.fixedPresets}>
|
|
291
|
+
{renderPresets('fixed', { variant })}
|
|
292
|
+
</div>
|
|
293
|
+
) : null}
|
|
294
|
+
|
|
295
|
+
{isEmpty ? (
|
|
296
|
+
<div className={S.notice}>
|
|
297
|
+
Forecast Assistant can make mistakes.
|
|
298
|
+
</div>
|
|
286
299
|
) : null}
|
|
287
300
|
|
|
288
|
-
<div className={cn(S.footer, footerClassName)}>
|
|
289
|
-
{isEmpty ? (
|
|
290
|
-
<div className={S.notice}>
|
|
291
|
-
Forecast Assistant can make mistakes.
|
|
292
|
-
</div>
|
|
293
|
-
) : null}
|
|
301
|
+
<div className={cn(S.footer, isClean && S.footerClean, footerClassName)}>
|
|
294
302
|
<Chat.Prompt
|
|
303
|
+
className={isClean ? S.promptClean : undefined}
|
|
295
304
|
onSubmit={handlePromptSubmitWithAttachments}
|
|
296
305
|
disabled={promptDisabled}
|
|
297
306
|
attachments={pendingAttachments}
|
|
@@ -22,12 +22,22 @@ export type ChatChromeResizeHandleConfig = {
|
|
|
22
22
|
|
|
23
23
|
export type { ChatAttachmentDropItem };
|
|
24
24
|
|
|
25
|
+
export type ChatChromeVariant = 'default' | 'clean';
|
|
26
|
+
|
|
27
|
+
export type ChatPresetsRenderOptions = {
|
|
28
|
+
variant?: ChatChromeVariant;
|
|
29
|
+
};
|
|
30
|
+
|
|
25
31
|
export interface ChatChromeProps {
|
|
32
|
+
variant?: ChatChromeVariant;
|
|
26
33
|
showResizeHandle: boolean;
|
|
27
34
|
resizeHandle: ChatChromeResizeHandleConfig | undefined;
|
|
28
35
|
onClose: (() => void) | undefined;
|
|
29
36
|
isEmpty: boolean;
|
|
30
|
-
renderPresets: (
|
|
37
|
+
renderPresets: (
|
|
38
|
+
layout: ChatPresetsLayout,
|
|
39
|
+
options?: ChatPresetsRenderOptions,
|
|
40
|
+
) => React.ReactNode;
|
|
31
41
|
/** Message list for the scroll area; use `[]` when empty. */
|
|
32
42
|
messages: Message[];
|
|
33
43
|
onQuickReply: (branchKey: string, displayLabel: string) => void;
|
|
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { Button } from '#uilib/components/ui/Button';
|
|
5
5
|
|
|
6
|
+
import type { ChatChromeVariant } from '../ChatChrome/ChatChrome.types';
|
|
6
7
|
import type { ChatPreset } from '../Chat.types';
|
|
7
8
|
import S from './ChatPresets.styl';
|
|
8
9
|
|
|
@@ -13,6 +14,7 @@ export interface ChatPresetsProps {
|
|
|
13
14
|
items: ChatPreset[];
|
|
14
15
|
usedItemIds?: string[];
|
|
15
16
|
layout?: ChatPresetsLayout;
|
|
17
|
+
variant?: ChatChromeVariant;
|
|
16
18
|
onSelect?: (preset: ChatPreset) => void;
|
|
17
19
|
onItemUsed?: (id: string) => void;
|
|
18
20
|
}
|
|
@@ -22,6 +24,7 @@ export function ChatPresets({
|
|
|
22
24
|
items,
|
|
23
25
|
usedItemIds = [],
|
|
24
26
|
layout = 'fixed',
|
|
27
|
+
variant = 'default',
|
|
25
28
|
onSelect,
|
|
26
29
|
onItemUsed,
|
|
27
30
|
}: ChatPresetsProps) {
|
|
@@ -38,7 +41,13 @@ export function ChatPresets({
|
|
|
38
41
|
|
|
39
42
|
return (
|
|
40
43
|
<div className={layout === 'inline' ? S.inlineRoot : S.root}>
|
|
41
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
className={cn(
|
|
46
|
+
S.inner,
|
|
47
|
+
layout === 'inline' && S.innerInline,
|
|
48
|
+
variant === 'clean' && S.innerClean,
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
42
51
|
{availableItems.map(preset => (
|
|
43
52
|
<Button
|
|
44
53
|
key={preset.id}
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from '../../Sidebar/Sidebar';
|
|
52
52
|
import { Chat } from '../Chat';
|
|
53
53
|
import type { ChatChromeProps } from '../ChatChrome';
|
|
54
|
-
import type { ChatAttachmentDropItem } from '../ChatChrome/ChatChrome.types';
|
|
54
|
+
import type { ChatAttachmentDropItem, ChatPresetsRenderOptions } from '../ChatChrome/ChatChrome.types';
|
|
55
55
|
import type { ChatEmptyStateConfig } from '../ChatEmptyState/ChatEmptyState.types';
|
|
56
56
|
import type { ChatEmptyStateProps } from '../ChatEmptyState/ChatEmptyState.types';
|
|
57
57
|
import {
|
|
@@ -1106,7 +1106,10 @@ export function useChatPanelChromeModel({
|
|
|
1106
1106
|
chatWidthPx,
|
|
1107
1107
|
]);
|
|
1108
1108
|
|
|
1109
|
-
const renderPresets = (
|
|
1109
|
+
const renderPresets = (
|
|
1110
|
+
layout: ChatPresetsLayout = 'fixed',
|
|
1111
|
+
options?: ChatPresetsRenderOptions,
|
|
1112
|
+
) => {
|
|
1110
1113
|
if (!presetsWithFreeform?.length) return null;
|
|
1111
1114
|
|
|
1112
1115
|
return (
|
|
@@ -1114,6 +1117,7 @@ export function useChatPanelChromeModel({
|
|
|
1114
1117
|
chatId={currentChatId ?? ''}
|
|
1115
1118
|
items={presetsWithFreeform}
|
|
1116
1119
|
layout={layout}
|
|
1120
|
+
variant={options?.variant}
|
|
1117
1121
|
usedItemIds={usedPresetIds}
|
|
1118
1122
|
onSelect={preset => {
|
|
1119
1123
|
void submitPreset(preset);
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ChartAreaInteractive } from '#uilib/components/ui/ChartAreaInteractive';
|
|
4
1
|
import type {
|
|
5
2
|
ChartDataPoint,
|
|
6
3
|
OverlayMode,
|
|
7
4
|
} from '#uilib/components/ui/ChartAreaInteractive/ChartAreaInteractive.types';
|
|
5
|
+
import { Tabs, TabsList, TabsTrigger } from '#uilib/components/ui/Tabs';
|
|
6
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
9
|
+
import { ChartAreaInteractive } from '#uilib/components/ui/ChartAreaInteractive';
|
|
10
|
+
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
11
|
+
import type { ForecastData } from '#uilib/types/forecast-data';
|
|
8
12
|
import { ForecastItemData } from '#uilib/components/ui/ChartAreaInteractive/ChartLines';
|
|
9
13
|
import { Label } from '#uilib/components/ui/Label';
|
|
10
14
|
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
11
15
|
import { Switch } from '#uilib/components/ui/Switch';
|
|
12
|
-
import { Tabs, TabsList, TabsTrigger } from '#uilib/components/ui/Tabs';
|
|
13
16
|
import { useTheme } from '#uilib/contexts/theme-context';
|
|
14
|
-
import type { ForecastData } from '#uilib/types/forecast-data';
|
|
15
|
-
|
|
16
|
-
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
17
|
-
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
18
17
|
|
|
19
18
|
const DEMO_FORECAST_ID = 1;
|
|
20
19
|
|