research-agent-ui 0.1.77 → 0.1.78
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/README.md +19 -1
- package/dist/components/ChatConversation/MessageBubble/FollowUpSuggestions.stories.d.ts +13 -0
- package/dist/components/ChatConversation/MessageBubble/UserMessageHeader.stories.d.ts +19 -0
- package/dist/components/FileUpload/FilePreviewCard.stories.d.ts +15 -0
- package/dist/components/MessageComposer/PastedContentCard.stories.d.ts +10 -0
- package/dist/components/SearchResults/SearchProgressIndicator.stories.d.ts +15 -0
- package/dist/index.cjs +14 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +441 -424
- package/dist/lib/utils.d.ts +5 -0
- package/dist/stories/mocks.d.ts +16 -0
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<br />
|
|
3
3
|
<a href="https://www.npmjs.com/package/research-agent-ui"><img src="https://img.shields.io/npm/dm/research-agent-ui.svg" alt="NPM Monthly Downloads"></a>
|
|
4
4
|
<a href="https://www.npmjs.com/package/research-agent-ui"><img src="https://img.shields.io/npm/v/research-agent-ui.svg" alt="npm version"></a>
|
|
5
|
-
<a href="https://bundlephobia.com/package/research-agent-ui"><img src="https://img.shields.io/bundlephobia/minzip/research-agent-ui" alt="Size"></a>
|
|
5
|
+
<a href="https://bundlephobia.com/package/research-agent-ui"><img src="https://img.shields.io/bundlephobia/minzip/research-agent-ui" alt="Size"></a>
|
|
6
6
|
<a href="https://discord.gg/SJdBqBz3tV">
|
|
7
7
|
<img src="https://img.shields.io/discord/1110227955554209923.svg?label=Chat&logo=Discord&colorB=7289da&style=flat"
|
|
8
8
|
alt="Join Discord" />
|
|
@@ -68,6 +68,24 @@ function App() {
|
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
## Storybook
|
|
72
|
+
|
|
73
|
+
Individual UI pieces can be browsed in isolation with [Storybook](https://storybook.js.org/).
|
|
74
|
+
Stories render against **mock data only** (see `src/stories/mocks.ts`) — no API,
|
|
75
|
+
auth session, or chat backend is required, so you can develop and review the
|
|
76
|
+
chat components (message header with timestamp/copy/edit actions, search
|
|
77
|
+
progress, follow-up suggestions, file & pasted-content cards) on their own.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# from packages/research-agent-ui
|
|
81
|
+
bun run storybook # dev server on http://localhost:6006
|
|
82
|
+
bun run build-storybook # static build → storybook-static/
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
A light/dark toggle in the toolbar switches between the two token palettes
|
|
86
|
+
(mirrored from the host app's `globals.css` in `.storybook/preview.css`). Add
|
|
87
|
+
new stories next to their component as `*.stories.tsx`.
|
|
88
|
+
|
|
71
89
|
## API Routes (`research-agent-ui/api`)
|
|
72
90
|
|
|
73
91
|
All 25 Next.js route handlers are exported from the `research-agent-ui/api`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import FollowUpSuggestions from './FollowUpSuggestions';
|
|
3
|
+
/**
|
|
4
|
+
* `FollowUpSuggestions` renders the assistant's suggested next questions as
|
|
5
|
+
* clickable chips (keyboard shortcuts 1–5 also trigger them).
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof FollowUpSuggestions>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof FollowUpSuggestions>;
|
|
10
|
+
/** Three follow-up suggestions on the last message in the thread. */
|
|
11
|
+
export declare const Default: Story;
|
|
12
|
+
/** Many suggestions — only the first five are keyboard-shortcut enabled. */
|
|
13
|
+
export declare const ManySuggestions: Story;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import UserMessageHeader from './UserMessageHeader';
|
|
3
|
+
/**
|
|
4
|
+
* `UserMessageHeader` renders the user's question as a collapsible heading with
|
|
5
|
+
* a timestamp (e.g. `12:29 PM`) and copy / edit-and-resubmit actions.
|
|
6
|
+
*
|
|
7
|
+
* The header is a controlled component, so the wrapper below wires up the
|
|
8
|
+
* `isExpanded`, `isEditing`, `editText`, and `copiedUserMsg` state that the
|
|
9
|
+
* parent `ChatMessageBubble` normally owns.
|
|
10
|
+
*/
|
|
11
|
+
declare const meta: Meta<typeof UserMessageHeader>;
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof UserMessageHeader>;
|
|
14
|
+
/** Default: expanded header with the 12:29 PM timestamp, copy and edit icons. */
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
/** Long question that wraps and clamps across lines. */
|
|
17
|
+
export declare const LongQuestion: Story;
|
|
18
|
+
/** Copied state — the clipboard icon flips to a green check. */
|
|
19
|
+
export declare const CopiedState: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { FilePreviewCard } from './FilePreviewCard';
|
|
3
|
+
/**
|
|
4
|
+
* `FilePreviewCard` is the thumbnail shown for each file attached to a message —
|
|
5
|
+
* an image preview or a file-type icon with name and size, plus upload status.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof FilePreviewCard>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof FilePreviewCard>;
|
|
10
|
+
/** Non-image file: shows the file-type icon, name, and size. */
|
|
11
|
+
export declare const Document: Story;
|
|
12
|
+
/** Image file: shows the generated preview with a size badge. */
|
|
13
|
+
export declare const Image: Story;
|
|
14
|
+
/** Upload in progress. */
|
|
15
|
+
export declare const Uploading: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { PastedContentCard } from './PastedContentCard';
|
|
3
|
+
/**
|
|
4
|
+
* `PastedContentCard` appears in the composer's attachment tray when a large
|
|
5
|
+
* block of text (>300 chars) is pasted into the chat input.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof PastedContentCard>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof PastedContentCard>;
|
|
10
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import SearchProgressIndicator from './SearchProgressIndicator';
|
|
3
|
+
/**
|
|
4
|
+
* `SearchProgressIndicator` shows the live web/academic/news queries the agent
|
|
5
|
+
* runs while researching, with per-query running / done status.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof SearchProgressIndicator>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof SearchProgressIndicator>;
|
|
10
|
+
/** Mid-search: some queries done, one still running. */
|
|
11
|
+
export declare const Searching: Story;
|
|
12
|
+
/** All queries completed. */
|
|
13
|
+
export declare const Completed: Story;
|
|
14
|
+
/** A single query in flight. */
|
|
15
|
+
export declare const SingleQuery: Story;
|