@sybilion/uilib 1.2.16 → 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/ChatEmptyState/ChatEmptyState.js +2 -2
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +2 -1
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +2 -1
- package/dist/esm/components/ui/Page/PageContent/PageContent.styl.js +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.d.ts +2 -0
- 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 -1
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.tsx +2 -0
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.ts +2 -0
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +2 -0
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +5 -0
- package/src/components/ui/Page/PageContent/PageContent.styl +0 -1
- package/src/docs/docsHeaderActions.tsx +8 -0
- package/src/docs/pages/ChatPage.tsx +3 -0
|
@@ -2,8 +2,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import S from './ChatEmptyState.styl.js';
|
|
3
3
|
import SparklesIcon from './icons/sparkles.svg.js';
|
|
4
4
|
|
|
5
|
-
function ChatEmptyState({ icon = jsx(SparklesIcon, {}), title = 'Start a conversation', description, 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 }), children] }));
|
|
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] }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { ChatEmptyState };
|
|
@@ -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();
|
|
@@ -771,6 +771,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
771
771
|
onPromptSubmit: handlePromptSubmit,
|
|
772
772
|
onChatDeleted: endLocalDemoFlow,
|
|
773
773
|
promptPrefill: promptLinkPrefill,
|
|
774
|
+
emptyState,
|
|
774
775
|
};
|
|
775
776
|
const toggleOpen = () => onOpenChange(!isOpen);
|
|
776
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)}}.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
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import type { ChatEmptyStateProps } from './ChatEmptyState.types';
|
|
3
|
-
export declare function ChatEmptyState({ icon, title, description, children, }: PropsWithChildren<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;
|
|
@@ -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
|
@@ -8,6 +8,7 @@ export function ChatEmptyState({
|
|
|
8
8
|
icon = <SparklesIcon />,
|
|
9
9
|
title = 'Start a conversation',
|
|
10
10
|
description,
|
|
11
|
+
additionalContent,
|
|
11
12
|
children,
|
|
12
13
|
}: PropsWithChildren<ChatEmptyStateProps>) {
|
|
13
14
|
return (
|
|
@@ -15,6 +16,7 @@ export function ChatEmptyState({
|
|
|
15
16
|
{icon && <div className={S.icon}>{icon}</div>}
|
|
16
17
|
{title && <h2>{title}</h2>}
|
|
17
18
|
{description && <p>{description}</p>}
|
|
19
|
+
{additionalContent}
|
|
18
20
|
{children}
|
|
19
21
|
</div>
|
|
20
22
|
);
|
|
@@ -43,6 +43,7 @@ export function ChatSheet({
|
|
|
43
43
|
onScriptComplete,
|
|
44
44
|
onGenerateDashboard,
|
|
45
45
|
renderMessageChart,
|
|
46
|
+
emptyState,
|
|
46
47
|
inline = false,
|
|
47
48
|
}: ChatSheetProps) {
|
|
48
49
|
const model = useChatPanelChromeModel({
|
|
@@ -53,6 +54,7 @@ export function ChatSheet({
|
|
|
53
54
|
onScriptComplete,
|
|
54
55
|
onGenerateDashboard,
|
|
55
56
|
renderMessageChart,
|
|
57
|
+
emptyState,
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
if (actionsRef) {
|
|
@@ -34,6 +34,7 @@ import { ScrollRef } from '@homecode/ui';
|
|
|
34
34
|
import { useSidebar } from '../../Sidebar/Sidebar';
|
|
35
35
|
import { Chat } from '../Chat';
|
|
36
36
|
import type { ChatChromeProps } from '../ChatChrome';
|
|
37
|
+
import type { ChatEmptyStateProps } from '../ChatEmptyState/ChatEmptyState.types';
|
|
37
38
|
|
|
38
39
|
export type UseChatPanelChromeModelInput = {
|
|
39
40
|
/** When true, skip sidebar chat slot, URL `?chat=`, and portal behavior (e.g. page main content). */
|
|
@@ -48,6 +49,8 @@ export type UseChatPanelChromeModelInput = {
|
|
|
48
49
|
onGenerateDashboard?: (transcript: string) => void | Promise<void>;
|
|
49
50
|
/** Renders `[CHART]` tokens in assistant messages. */
|
|
50
51
|
renderMessageChart?: () => React.ReactNode;
|
|
52
|
+
/** Forwarded to `ChatChrome` when the thread is empty. */
|
|
53
|
+
emptyState?: ChatEmptyStateProps;
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
export type UseChatPanelChromeModelResult = {
|
|
@@ -92,6 +95,7 @@ export function useChatPanelChromeModel({
|
|
|
92
95
|
onScriptComplete,
|
|
93
96
|
onGenerateDashboard,
|
|
94
97
|
renderMessageChart,
|
|
98
|
+
emptyState,
|
|
95
99
|
}: UseChatPanelChromeModelInput): UseChatPanelChromeModelResult {
|
|
96
100
|
const effectiveScopeId = scopeId ?? NO_SCOPE_FALLBACK;
|
|
97
101
|
const isMobile = useIsMobile();
|
|
@@ -993,6 +997,7 @@ export function useChatPanelChromeModel({
|
|
|
993
997
|
onPromptSubmit: handlePromptSubmit,
|
|
994
998
|
onChatDeleted: endLocalDemoFlow,
|
|
995
999
|
promptPrefill: promptLinkPrefill,
|
|
1000
|
+
emptyState,
|
|
996
1001
|
};
|
|
997
1002
|
|
|
998
1003
|
const toggleOpen = () => onOpenChange(!isOpen);
|
|
@@ -13,6 +13,14 @@ export function DocsHeaderActions() {
|
|
|
13
13
|
</>
|
|
14
14
|
}
|
|
15
15
|
scopeId={DOCS_CHAT_SCOPE_ID}
|
|
16
|
+
emptyState={{
|
|
17
|
+
title: 'Start a conversation',
|
|
18
|
+
description:
|
|
19
|
+
'Send a message below. This demo appends a canned reply after a short delay.',
|
|
20
|
+
additionalContent: (
|
|
21
|
+
<p>Optional empty-state slot via additionalContent.</p>
|
|
22
|
+
),
|
|
23
|
+
}}
|
|
16
24
|
/>
|
|
17
25
|
);
|
|
18
26
|
}
|
|
@@ -101,6 +101,9 @@ export default function ChatPage() {
|
|
|
101
101
|
title: 'Start a conversation',
|
|
102
102
|
description:
|
|
103
103
|
'Send a message below. This demo appends a canned reply after a short delay.',
|
|
104
|
+
additionalContent: (
|
|
105
|
+
<p>Optional empty-state slot via additionalContent.</p>
|
|
106
|
+
),
|
|
104
107
|
}}
|
|
105
108
|
/>
|
|
106
109
|
</PageContentSection>
|