@sybilion/uilib 1.3.51 → 1.3.53
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/ChatSheet/ChatSheet.js +1 -0
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +12 -0
- package/dist/esm/components/ui/Tooltip/Tooltip.js +2 -0
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.d.ts +2 -0
- package/package.json +3 -2
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +3 -0
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +20 -0
- package/src/components/ui/Tooltip/Tooltip.tsx +2 -0
- package/src/docs/pages/TooltipPage.tsx +31 -0
|
@@ -149,6 +149,16 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const isEmpty = isChatEmpty(chat) && !isLoading;
|
|
152
|
+
const openNewChatWithPrefill = useCallback((prompt) => {
|
|
153
|
+
const sessionId = newChat();
|
|
154
|
+
if (sessionId == null) {
|
|
155
|
+
logger.warn('Chat prefill: sign in to use the assistant.');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const trimmed = prompt.trim();
|
|
159
|
+
setPromptLinkPrefill(trimmed || null);
|
|
160
|
+
onOpenChange(true);
|
|
161
|
+
}, [newChat, onOpenChange]);
|
|
152
162
|
/**
|
|
153
163
|
* App link: `?prompt=…` — open panel, pre-fill composer, strip param (read once on mount
|
|
154
164
|
* from `location.search`). If the selected session already has messages, `newChat()` first.
|
|
@@ -401,6 +411,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
401
411
|
}
|
|
402
412
|
}
|
|
403
413
|
}
|
|
414
|
+
setPromptLinkPrefill(null);
|
|
404
415
|
try {
|
|
405
416
|
if (chatId)
|
|
406
417
|
endLocalDemoFlow(chatId);
|
|
@@ -769,6 +780,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
769
780
|
onOpenChange,
|
|
770
781
|
toggleOpen,
|
|
771
782
|
newChat,
|
|
783
|
+
openNewChatWithPrefill,
|
|
772
784
|
chatPanelContainer,
|
|
773
785
|
};
|
|
774
786
|
}
|
|
@@ -85,6 +85,7 @@ function applyOverTriggerStyles(contentEl, triggerEl) {
|
|
|
85
85
|
wrapper.style.setProperty('left', `${rect.left - paddingLeft - borderLeft}px`, 'important');
|
|
86
86
|
wrapper.style.setProperty('top', `${rect.top - paddingTop - borderTop}px`, 'important');
|
|
87
87
|
wrapper.style.setProperty('transform', 'none', 'important');
|
|
88
|
+
wrapper.style.setProperty('pointer-events', 'none');
|
|
88
89
|
wrapper.style.setProperty('min-width', '0', 'important');
|
|
89
90
|
wrapper.style.setProperty('width', `${rect.width + paddingLeft + paddingRight + borderLeft + borderRight}px`, 'important');
|
|
90
91
|
contentEl.style.width = '100%';
|
|
@@ -101,6 +102,7 @@ function clearOverTriggerStyles(contentEl) {
|
|
|
101
102
|
wrapper.style.removeProperty('left');
|
|
102
103
|
wrapper.style.removeProperty('top');
|
|
103
104
|
wrapper.style.removeProperty('transform');
|
|
105
|
+
wrapper.style.removeProperty('pointer-events');
|
|
104
106
|
wrapper.style.removeProperty('min-width');
|
|
105
107
|
wrapper.style.removeProperty('width');
|
|
106
108
|
contentEl.style.removeProperty('width');
|
|
@@ -3,6 +3,8 @@ export type ChatSheetActions = {
|
|
|
3
3
|
open: () => void;
|
|
4
4
|
/** Starts a new chat session and opens the panel (same as the new-chat keyboard shortcut). */
|
|
5
5
|
openNewChat: () => void;
|
|
6
|
+
/** Starts a new chat, opens the panel, and pre-fills the composer (user sends manually). */
|
|
7
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
6
8
|
};
|
|
7
9
|
export interface ChatSheetProps extends Omit<UseChatPanelChromeModelInput, 'embedAsPage'> {
|
|
8
10
|
title?: string;
|
|
@@ -35,6 +35,8 @@ export type UseChatPanelChromeModelResult = {
|
|
|
35
35
|
onOpenChange: (open: boolean) => void;
|
|
36
36
|
toggleOpen: () => void;
|
|
37
37
|
newChat: () => void;
|
|
38
|
+
/** New session + open panel + one-shot composer pre-fill (does not send). */
|
|
39
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
38
40
|
chatPanelContainer: HTMLElement | null;
|
|
39
41
|
};
|
|
40
42
|
export declare function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, renderMessageChart, emptyState, allowedAttachments, allowPdfAttachments, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, transformSendPayload, }: UseChatPanelChromeModelInput): UseChatPanelChromeModelResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybilion/uilib",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.53",
|
|
4
4
|
"description": "Sybilion Design System — React UI components (Webpack + Stylus)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -203,5 +203,6 @@
|
|
|
203
203
|
"webpack": "^5.75.0",
|
|
204
204
|
"webpack-cli": "^5.0.1",
|
|
205
205
|
"webpack-dev-server": "^5.2.3"
|
|
206
|
-
}
|
|
206
|
+
},
|
|
207
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
207
208
|
}
|
|
@@ -11,6 +11,8 @@ export type ChatSheetActions = {
|
|
|
11
11
|
open: () => void;
|
|
12
12
|
/** Starts a new chat session and opens the panel (same as the new-chat keyboard shortcut). */
|
|
13
13
|
openNewChat: () => void;
|
|
14
|
+
/** Starts a new chat, opens the panel, and pre-fills the composer (user sends manually). */
|
|
15
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export interface ChatSheetProps extends Omit<
|
|
@@ -74,6 +76,7 @@ export function ChatSheet({
|
|
|
74
76
|
model.newChat();
|
|
75
77
|
model.onOpenChange(true);
|
|
76
78
|
},
|
|
79
|
+
openNewChatWithPrefill: model.openNewChatWithPrefill,
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -91,6 +91,8 @@ export type UseChatPanelChromeModelResult = {
|
|
|
91
91
|
onOpenChange: (open: boolean) => void;
|
|
92
92
|
toggleOpen: () => void;
|
|
93
93
|
newChat: () => void;
|
|
94
|
+
/** New session + open panel + one-shot composer pre-fill (does not send). */
|
|
95
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
94
96
|
chatPanelContainer: HTMLElement | null;
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -312,6 +314,21 @@ export function useChatPanelChromeModel({
|
|
|
312
314
|
|
|
313
315
|
const isEmpty = isChatEmpty(chat) && !isLoading;
|
|
314
316
|
|
|
317
|
+
const openNewChatWithPrefill = useCallback(
|
|
318
|
+
(prompt: string) => {
|
|
319
|
+
const sessionId = newChat();
|
|
320
|
+
if (sessionId == null) {
|
|
321
|
+
logger.warn('Chat prefill: sign in to use the assistant.');
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const trimmed = prompt.trim();
|
|
326
|
+
setPromptLinkPrefill(trimmed || null);
|
|
327
|
+
onOpenChange(true);
|
|
328
|
+
},
|
|
329
|
+
[newChat, onOpenChange],
|
|
330
|
+
);
|
|
331
|
+
|
|
315
332
|
/**
|
|
316
333
|
* App link: `?prompt=…` — open panel, pre-fill composer, strip param (read once on mount
|
|
317
334
|
* from `location.search`). If the selected session already has messages, `newChat()` first.
|
|
@@ -606,6 +623,8 @@ export function useChatPanelChromeModel({
|
|
|
606
623
|
}
|
|
607
624
|
}
|
|
608
625
|
|
|
626
|
+
setPromptLinkPrefill(null);
|
|
627
|
+
|
|
609
628
|
try {
|
|
610
629
|
if (chatId) endLocalDemoFlow(chatId);
|
|
611
630
|
let payload = buildChatSendMessagePayload(message, stagedAttachments);
|
|
@@ -1044,6 +1063,7 @@ export function useChatPanelChromeModel({
|
|
|
1044
1063
|
onOpenChange,
|
|
1045
1064
|
toggleOpen,
|
|
1046
1065
|
newChat,
|
|
1066
|
+
openNewChatWithPrefill,
|
|
1047
1067
|
chatPanelContainer,
|
|
1048
1068
|
};
|
|
1049
1069
|
}
|
|
@@ -126,6 +126,7 @@ function applyOverTriggerStyles(
|
|
|
126
126
|
'important',
|
|
127
127
|
);
|
|
128
128
|
wrapper.style.setProperty('transform', 'none', 'important');
|
|
129
|
+
wrapper.style.setProperty('pointer-events', 'none');
|
|
129
130
|
wrapper.style.setProperty('min-width', '0', 'important');
|
|
130
131
|
wrapper.style.setProperty(
|
|
131
132
|
'width',
|
|
@@ -148,6 +149,7 @@ function clearOverTriggerStyles(contentEl: HTMLElement | null) {
|
|
|
148
149
|
wrapper.style.removeProperty('left');
|
|
149
150
|
wrapper.style.removeProperty('top');
|
|
150
151
|
wrapper.style.removeProperty('transform');
|
|
152
|
+
wrapper.style.removeProperty('pointer-events');
|
|
151
153
|
wrapper.style.removeProperty('min-width');
|
|
152
154
|
wrapper.style.removeProperty('width');
|
|
153
155
|
|
|
@@ -11,6 +11,9 @@ import { DocsHeaderActions } from '../docsHeaderActions';
|
|
|
11
11
|
|
|
12
12
|
const TOOLTIP_SIDES = ['left', 'top', 'bottom', 'right'] as const;
|
|
13
13
|
|
|
14
|
+
const LONG_TEXT =
|
|
15
|
+
'This is a long text that should overflow and show a tooltip on hover.';
|
|
16
|
+
|
|
14
17
|
export default function TooltipPage() {
|
|
15
18
|
return (
|
|
16
19
|
<>
|
|
@@ -33,6 +36,34 @@ export default function TooltipPage() {
|
|
|
33
36
|
</Tooltip>
|
|
34
37
|
))}
|
|
35
38
|
</div>
|
|
39
|
+
|
|
40
|
+
<div
|
|
41
|
+
style={{
|
|
42
|
+
display: 'inline-block',
|
|
43
|
+
padding: 'var(--p-4)',
|
|
44
|
+
marginTop: 'var(--p-4)',
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<h3>Tooltip over trigger:</h3>
|
|
48
|
+
<br />
|
|
49
|
+
<Tooltip>
|
|
50
|
+
<TooltipTrigger asChild>
|
|
51
|
+
<div
|
|
52
|
+
style={{
|
|
53
|
+
maxWidth: '200px',
|
|
54
|
+
textOverflow: 'ellipsis',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{LONG_TEXT}
|
|
60
|
+
</div>
|
|
61
|
+
</TooltipTrigger>
|
|
62
|
+
<TooltipContent side="bottom" overTrigger>
|
|
63
|
+
{LONG_TEXT}
|
|
64
|
+
</TooltipContent>
|
|
65
|
+
</Tooltip>
|
|
66
|
+
</div>
|
|
36
67
|
</PageContentSection>
|
|
37
68
|
</>
|
|
38
69
|
);
|