@sybilion/uilib 1.3.60 → 1.3.61
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/ChatPresets/ChatPresets.js +1 -1
- package/dist/esm/components/ui/Chat/ChatPresets/ChatPresets.styl.js +1 -1
- package/dist/esm/types/src/docs/chatPresets.sample.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/ui/Chat/ChatPresets/ChatPresets.styl +5 -14
- package/src/components/ui/Chat/ChatPresets/ChatPresets.tsx +2 -0
- package/src/docs/chatPresets.sample.ts +25 -0
- package/src/docs/pages/ChatSheetPage.tsx +23 -10
|
@@ -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", 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), 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,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".ChatPresets_root__Cj42o{bottom:160px;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;padding:var(--p-2) var(--p-6) var(--p-3)}.ChatPresets_innerInline__iPM2b{background-color:transparent}.ChatPresets_item__LfX5b{
|
|
3
|
+
var css_248z = ".ChatPresets_root__Cj42o{bottom:160px;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;padding:var(--p-2) var(--p-6) var(--p-3)}.ChatPresets_innerInline__iPM2b{background-color:transparent}.ChatPresets_item__LfX5b{flex-shrink:0;font-size:var(--text-xs);height:auto;line-height:1.4;max-width:300px;min-height:auto;min-width:0;overflow-wrap:anywhere;padding:var(--p-3);text-align:left;white-space:break-spaces!important}";
|
|
4
4
|
var S = {"root":"ChatPresets_root__Cj42o","inlineRoot":"ChatPresets_inlineRoot__WXVnu","inner":"ChatPresets_inner__h14-q","innerInline":"ChatPresets_innerInline__iPM2b","item":"ChatPresets_item__LfX5b"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChatPreset } from '#uilib/components/ui/Chat/Chat.types';
|
|
2
|
+
/** Sample dataset name — mirrors app dataset page chat presets. */
|
|
3
|
+
export declare const DOCS_SAMPLE_DATASET_NAME = "HDPE Spot Price";
|
|
4
|
+
export declare function getDocsDatasetPresets(datasetName?: string): ChatPreset[];
|
|
5
|
+
export declare const DOCS_DATASET_PRESETS: ChatPreset[];
|
package/package.json
CHANGED
|
@@ -20,22 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
.item
|
|
22
22
|
flex-shrink 0
|
|
23
|
+
min-width 0
|
|
23
24
|
max-width 300px
|
|
25
|
+
height auto
|
|
26
|
+
min-height auto
|
|
24
27
|
padding var(--p-3)
|
|
25
|
-
|
|
26
|
-
background none
|
|
27
|
-
border 1px solid var(--border)
|
|
28
|
-
border-radius var(--p-4)
|
|
29
|
-
cursor pointer
|
|
30
|
-
transition all 0.2s ease
|
|
31
28
|
text-align left
|
|
32
29
|
font-size var(--text-xs)
|
|
33
30
|
line-height 1.4
|
|
34
|
-
white-space break-spaces
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
&:hover
|
|
38
|
-
background var(--border) !important
|
|
39
|
-
|
|
40
|
-
:global(.dark) &
|
|
41
|
-
background-color var(--muted)
|
|
31
|
+
white-space break-spaces !important
|
|
32
|
+
overflow-wrap anywhere
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChatPreset } from '#uilib/components/ui/Chat/Chat.types';
|
|
2
|
+
|
|
3
|
+
/** Sample dataset name — mirrors app dataset page chat presets. */
|
|
4
|
+
export const DOCS_SAMPLE_DATASET_NAME = 'HDPE Spot Price';
|
|
5
|
+
|
|
6
|
+
export function getDocsDatasetPresets(
|
|
7
|
+
datasetName: string = DOCS_SAMPLE_DATASET_NAME,
|
|
8
|
+
): ChatPreset[] {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
id: '1',
|
|
12
|
+
text: `What should my planning decisions be based on the "${datasetName}" forecasts?`,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: '2',
|
|
16
|
+
text: `Explain the "${datasetName}" forecast.`,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: '3',
|
|
20
|
+
text: `What is the "${datasetName}" forecast performance?`,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const DOCS_DATASET_PRESETS = getDocsDatasetPresets();
|
|
@@ -2,11 +2,15 @@ import type { SlashCommandItem } from '#uilib/components/ui/Chat';
|
|
|
2
2
|
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
3
3
|
import { MessageSquare } from 'lucide-react';
|
|
4
4
|
|
|
5
|
+
import {
|
|
6
|
+
DOCS_DATASET_PRESETS,
|
|
7
|
+
DOCS_SAMPLE_DATASET_NAME,
|
|
8
|
+
} from '../chatPresets.sample';
|
|
5
9
|
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
6
10
|
import { DOCS_CHAT_USER_KEY } from '../docsConstants';
|
|
7
11
|
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
8
12
|
|
|
9
|
-
const DOCS_CHAT_SHEET_SCOPE_ID = `${DOCS_CHAT_USER_KEY}-docs-chat
|
|
13
|
+
const DOCS_CHAT_SHEET_SCOPE_ID = `${DOCS_CHAT_USER_KEY}-docs-dataset-chat`;
|
|
10
14
|
|
|
11
15
|
const DOCS_SAMPLE_SLASH_ITEMS: SlashCommandItem[] = [
|
|
12
16
|
{
|
|
@@ -22,24 +26,29 @@ export default function ChatSheetPage() {
|
|
|
22
26
|
<AppPageHeader
|
|
23
27
|
breadcrumbs={[{ label: 'Chat' }, { label: 'Chat sheet' }]}
|
|
24
28
|
title="Chat sheet (portal)"
|
|
25
|
-
subheader=
|
|
29
|
+
subheader={`Same integration as the app dataset page: ChatSheet in header actions with dataset-scoped presets for "${DOCS_SAMPLE_DATASET_NAME}". Panel portaled into the shell chat slot.`}
|
|
26
30
|
actions={
|
|
27
31
|
<DocsHeaderActions
|
|
28
32
|
scopeId={DOCS_CHAT_SHEET_SCOPE_ID}
|
|
29
33
|
slashCommandItems={DOCS_SAMPLE_SLASH_ITEMS}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
presets={DOCS_DATASET_PRESETS}
|
|
35
|
+
triggerLabel={<MessageSquare size={20} />}
|
|
36
|
+
triggerAriaLabel="AI Assistant"
|
|
37
|
+
emptyState={{
|
|
38
|
+
title: 'Start a conversation',
|
|
39
|
+
}}
|
|
36
40
|
/>
|
|
37
41
|
}
|
|
38
42
|
/>
|
|
39
43
|
<PageContentSection>
|
|
40
44
|
<p style={{ marginBottom: 16, fontSize: 14, lineHeight: 1.5 }}>
|
|
41
|
-
Open <strong>AI Assistant</strong> in the header.
|
|
42
|
-
|
|
45
|
+
Open <strong>AI Assistant</strong> in the header. Presets render below
|
|
46
|
+
the empty state (fixed layout) and inline after the assistant reply,
|
|
47
|
+
same as{' '}
|
|
48
|
+
<code style={{ fontSize: 13 }}>
|
|
49
|
+
presets={datasetPresets}
|
|
50
|
+
</code>{' '}
|
|
51
|
+
on the app dataset page.
|
|
43
52
|
</p>
|
|
44
53
|
<h3 style={{ marginBottom: 8, fontSize: 14, fontWeight: 600 }}>
|
|
45
54
|
Regression checklist
|
|
@@ -47,6 +56,10 @@ export default function ChatSheetPage() {
|
|
|
47
56
|
<ul
|
|
48
57
|
style={{ margin: 0, paddingLeft: 20, fontSize: 14, lineHeight: 1.6 }}
|
|
49
58
|
>
|
|
59
|
+
<li>
|
|
60
|
+
Empty chat → three outline preset chips with dataset-scoped labels
|
|
61
|
+
</li>
|
|
62
|
+
<li>Preset click → sends preset text, chip hides for that session</li>
|
|
50
63
|
<li>Plain Enter with text → submit and clear composer</li>
|
|
51
64
|
<li>
|
|
52
65
|
Plain Enter must not create empty lines with duplicated placeholders
|