agentic-ui-kit 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +241 -2
- package/dist/core.js +1 -0
- package/dist/index.js +2875 -0
- package/dist/sse-BA_ebMcH.js +408 -0
- package/dist/styles.css +3 -0
- package/dist/tailwind.css +350 -0
- package/dist/types/core/src/blocks.d.ts +22 -0
- package/dist/types/core/src/events.d.ts +75 -0
- package/dist/types/core/src/index.d.ts +7 -0
- package/dist/types/core/src/partial-json.d.ts +7 -0
- package/dist/types/core/src/reduce.d.ts +33 -0
- package/dist/types/core/src/sse.d.ts +8 -0
- package/dist/types/core/src/types.d.ts +171 -0
- package/dist/types/react/src/components/activity-group.d.ts +13 -0
- package/dist/types/react/src/components/approval-card.d.ts +11 -0
- package/dist/types/react/src/components/attachments.d.ts +78 -0
- package/dist/types/react/src/components/chat-header.d.ts +30 -0
- package/dist/types/react/src/components/chat-list.d.ts +47 -0
- package/dist/types/react/src/components/composer.d.ts +45 -0
- package/dist/types/react/src/components/context-panel.d.ts +13 -0
- package/dist/types/react/src/components/markdown.d.ts +8 -0
- package/dist/types/react/src/components/message-list.d.ts +18 -0
- package/dist/types/react/src/components/messages.d.ts +33 -0
- package/dist/types/react/src/components/model-picker.d.ts +16 -0
- package/dist/types/react/src/components/token-counter.d.ts +16 -0
- package/dist/types/react/src/components/tools.d.ts +68 -0
- package/dist/types/react/src/components/word-fade.d.ts +19 -0
- package/dist/types/react/src/core.d.ts +1 -0
- package/dist/types/react/src/hooks/agent.d.ts +86 -0
- package/dist/types/react/src/hooks/sidebar-state.d.ts +18 -0
- package/dist/types/react/src/hooks/smooth-text.d.ts +9 -0
- package/dist/types/react/src/hooks/sse-transport.d.ts +15 -0
- package/dist/types/react/src/hooks/use-chat.d.ts +68 -0
- package/dist/types/react/src/index.d.ts +57 -0
- package/dist/types/react/src/primitives/appearance.d.ts +38 -0
- package/dist/types/react/src/primitives/badge.d.ts +15 -0
- package/dist/types/react/src/primitives/button.d.ts +32 -0
- package/dist/types/react/src/primitives/caret.d.ts +4 -0
- package/dist/types/react/src/primitives/chat-theme.d.ts +22 -0
- package/dist/types/react/src/primitives/code-block.d.ts +13 -0
- package/dist/types/react/src/primitives/context-menu.d.ts +13 -0
- package/dist/types/react/src/primitives/disclosure.d.ts +16 -0
- package/dist/types/react/src/primitives/highlight.d.ts +13 -0
- package/dist/types/react/src/primitives/menu.d.ts +52 -0
- package/dist/types/react/src/primitives/overlay.d.ts +21 -0
- package/dist/types/react/src/primitives/panel.d.ts +19 -0
- package/dist/types/react/src/primitives/tooltip.d.ts +10 -0
- package/dist/types/react/src/views/app-shell.d.ts +20 -0
- package/dist/types/react/src/views/chat-view.d.ts +51 -0
- package/dist/types/react/src/views/sidebar.d.ts +38 -0
- package/package.json +80 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export { Button, IconButton } from "./primitives/button";
|
|
2
|
+
export type { ButtonProps, IconButtonProps } from "./primitives/button";
|
|
3
|
+
export { Badge } from "./primitives/badge";
|
|
4
|
+
export type { BadgeProps } from "./primitives/badge";
|
|
5
|
+
export { Tooltip } from "./primitives/tooltip";
|
|
6
|
+
export { Caret } from "./primitives/caret";
|
|
7
|
+
export { Disclosure } from "./primitives/disclosure";
|
|
8
|
+
export { Popover, Menu, MenuItem, MenuSearch, MenuSection, MenuSeparator, MenuNote, MenuTrigger, SubmenuTrigger } from "./primitives/menu";
|
|
9
|
+
export { ContextMenu } from "./primitives/context-menu";
|
|
10
|
+
export type { ContextMenuProps } from "./primitives/context-menu";
|
|
11
|
+
export { Modal, Drawer } from "./primitives/overlay";
|
|
12
|
+
export type { ModalProps, DrawerProps } from "./primitives/overlay";
|
|
13
|
+
export { Panel } from "./primitives/panel";
|
|
14
|
+
export type { PanelProps } from "./primitives/panel";
|
|
15
|
+
export { CodeBlock } from "./primitives/code-block";
|
|
16
|
+
export { ChatTheme } from "./primitives/chat-theme";
|
|
17
|
+
export type { ChatThemeProps } from "./primitives/chat-theme";
|
|
18
|
+
export type { CodeThemes, ChatMotion } from "./primitives/appearance";
|
|
19
|
+
export { useChat, userMessage } from "./hooks/use-chat";
|
|
20
|
+
export type { Transport, SendRequest, SendOptions, UseChat, UseChatOptions, PendingApproval } from "./hooks/use-chat";
|
|
21
|
+
export { sseTransport, type SseTransportOptions, type SseRequestBody } from "./hooks/sse-transport";
|
|
22
|
+
export { AgentProvider, AgentRegistry, useAgentRegistry, useAgentSnapshot, useAgentTool, useAgentContext } from "./hooks/agent";
|
|
23
|
+
export type { AgentTool, ToolContext, ToolSpec, JsonSchema } from "./hooks/agent";
|
|
24
|
+
export { useSmoothText } from "./hooks/smooth-text";
|
|
25
|
+
export { useSidebar, useMediaQuery, DRAWER_QUERY } from "./hooks/sidebar-state";
|
|
26
|
+
export { UserMessage, AssistantMessage, formatRelativeTime, messageText } from "./components/messages";
|
|
27
|
+
export type { UserMessageProps, AssistantMessageProps, Feedback } from "./components/messages";
|
|
28
|
+
export { Markdown } from "./components/markdown";
|
|
29
|
+
export type { MarkdownProps } from "./components/markdown";
|
|
30
|
+
export { ActivityGroup } from "./components/activity-group";
|
|
31
|
+
export type { ActivityGroupProps } from "./components/activity-group";
|
|
32
|
+
export { ToolViewsProvider, useToolView, useToolViews, activityLabel, activityHeading, commandTool, webSearchTool, memoryTool, defaultToolViews, formatDuration, useChatTool, } from "./components/tools";
|
|
33
|
+
export type { ToolView, ToolViews, SearchResult, ChatTool } from "./components/tools";
|
|
34
|
+
export { ApprovalCard } from "./components/approval-card";
|
|
35
|
+
export type { ApprovalCardProps } from "./components/approval-card";
|
|
36
|
+
export { TokenCounter, useCountUp, formatTokens } from "./components/token-counter";
|
|
37
|
+
export type { TokenCounterProps } from "./components/token-counter";
|
|
38
|
+
export { ContextPanel } from "./components/context-panel";
|
|
39
|
+
export type { ContextPanelProps } from "./components/context-panel";
|
|
40
|
+
export { Composer, AttachButton } from "./components/composer";
|
|
41
|
+
export type { ComposerProps, AttachButtonProps } from "./components/composer";
|
|
42
|
+
export { ModelPicker } from "./components/model-picker";
|
|
43
|
+
export type { ModelPickerProps } from "./components/model-picker";
|
|
44
|
+
export { useAttachments, AttachmentCard, AttachmentRow, PastedTextDialog } from "./components/attachments";
|
|
45
|
+
export type { DraftAttachment, UploadResult, UseAttachments, UseAttachmentsOptions, AttachmentCardData, AttachmentCardProps, AttachmentRowProps, PastedTextDialogProps, } from "./components/attachments";
|
|
46
|
+
export { MessageList } from "./components/message-list";
|
|
47
|
+
export type { MessageListProps } from "./components/message-list";
|
|
48
|
+
export { ChatHeader, ChatTitleMenu } from "./components/chat-header";
|
|
49
|
+
export type { ChatHeaderProps, ChatTitleMenuProps } from "./components/chat-header";
|
|
50
|
+
export { ChatList } from "./components/chat-list";
|
|
51
|
+
export type { ChatListProps, ChatListSection, ChatListItem, ChatSummary, ProjectSummary } from "./components/chat-list";
|
|
52
|
+
export { ChatView, EmptyState } from "./views/chat-view";
|
|
53
|
+
export type { ChatViewProps, EmptyStateProps, Density } from "./views/chat-view";
|
|
54
|
+
export { AppShell, SidebarToggle } from "./views/app-shell";
|
|
55
|
+
export type { AppShellProps, SidebarToggleProps } from "./views/app-shell";
|
|
56
|
+
export { Sidebar, SidebarItem, SidebarUser } from "./views/sidebar";
|
|
57
|
+
export type { SidebarProps, SidebarItemProps, SidebarUserProps } from "./views/sidebar";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Shiki theme ids (any bundled theme: "dracula", "catppuccin-latte", "github-dark", ...). */
|
|
3
|
+
export interface CodeThemes {
|
|
4
|
+
/** Theme used where the chat theme's color-scheme is light. Default "github-light". */
|
|
5
|
+
light?: string;
|
|
6
|
+
/** Theme used where the color-scheme is dark. Default "one-dark-pro". */
|
|
7
|
+
dark?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Where a boxed code block gets its background: "kit" uses `--chat-code-bg` (default, so existing hosts do
|
|
10
|
+
* not change); "theme" uses the Shiki theme's own background and text color.
|
|
11
|
+
*/
|
|
12
|
+
background?: "kit" | "theme";
|
|
13
|
+
}
|
|
14
|
+
/** "system" follows the OS reduced-motion setting; "reduce" always reduces; "full" keeps animations. */
|
|
15
|
+
export type ChatMotion = "system" | "reduce" | "full";
|
|
16
|
+
export declare const DEFAULT_CODE_THEMES: {
|
|
17
|
+
readonly light: "github-light";
|
|
18
|
+
readonly dark: "one-dark-pro";
|
|
19
|
+
};
|
|
20
|
+
interface Appearance {
|
|
21
|
+
codeThemes?: CodeThemes | undefined;
|
|
22
|
+
motion?: ChatMotion | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare function AppearanceProvider({ codeThemes, motion, children }: Appearance & {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function useCodeThemes(): CodeThemes;
|
|
28
|
+
/**
|
|
29
|
+
* Whether motion should be reduced, for a given `motion` setting. "system" also honors
|
|
30
|
+
* `data-chat-motion` on <html> (for hosts that do not use ChatTheme), then the OS media query.
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldReduceMotion(motion?: ChatMotion): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a function that tells, at call time, whether JS-driven animation (text streaming, counters)
|
|
35
|
+
* should be skipped. Call it inside effects. The CSS side uses the same setting through `data-chat-motion`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useReducedMotion(): () => boolean;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
declare const tones: {
|
|
3
|
+
/** Outlined, e.g. "Recommended". */
|
|
4
|
+
outline: string;
|
|
5
|
+
/** Amber, e.g. "5.5× or more usage". */
|
|
6
|
+
warning: string;
|
|
7
|
+
};
|
|
8
|
+
export interface BadgeProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
tone?: keyof typeof tones;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function Badge({ children, tone, icon, className }: BadgeProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps as AriaButtonProps } from "react-aria-components";
|
|
3
|
+
declare const variants: {
|
|
4
|
+
/** Plain text button, highlights on hover. Sidebar rows, header buttons. */
|
|
5
|
+
ghost: string;
|
|
6
|
+
/** Filled with the surface color, e.g. the selected Chat/Cowork toggle. */
|
|
7
|
+
subtle: string;
|
|
8
|
+
/** The send button. */
|
|
9
|
+
primary: string;
|
|
10
|
+
};
|
|
11
|
+
declare const sizes: {
|
|
12
|
+
sm: string;
|
|
13
|
+
md: string;
|
|
14
|
+
};
|
|
15
|
+
export interface ButtonProps extends Omit<AriaButtonProps, "className"> {
|
|
16
|
+
variant?: keyof typeof variants;
|
|
17
|
+
size?: keyof typeof sizes;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function Button({ variant, size, className, ...props }: ButtonProps): import("react").JSX.Element;
|
|
21
|
+
export interface IconButtonProps extends Omit<AriaButtonProps, "className" | "children"> {
|
|
22
|
+
/** Accessible name, also shown as the tooltip. */
|
|
23
|
+
label: string;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
variant?: keyof typeof variants;
|
|
26
|
+
size?: "sm" | "md";
|
|
27
|
+
/** Show the label as a tooltip on hover. On by default. */
|
|
28
|
+
tooltip?: boolean;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function IconButton({ label, variant, size, tooltip, className, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ChatMotion, type CodeThemes } from "./appearance";
|
|
3
|
+
export interface ChatThemeProps {
|
|
4
|
+
/** Value for `data-chat-theme`, matched by the host's theme CSS. */
|
|
5
|
+
theme?: string;
|
|
6
|
+
/** Shiki themes for code blocks and Markdown fences, e.g. `{ light: "catppuccin-latte", dark: "dracula" }`. */
|
|
7
|
+
codeThemes?: CodeThemes;
|
|
8
|
+
/**
|
|
9
|
+
* "system" (default) follows the OS reduced-motion setting; "reduce" applies the reduced rules even without
|
|
10
|
+
* it; "full" keeps animations even with it. An app that does not use ChatTheme can put
|
|
11
|
+
* `data-chat-motion="reduce"` (or "full") on <html> instead: the CSS and the JS checks both honor it.
|
|
12
|
+
*/
|
|
13
|
+
motion?: ChatMotion;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Applies a chat theme to part of a page. Menus, tooltips and dialogs opened inside render into this
|
|
19
|
+
* element instead of `<body>`, so they get the same theme. An app themed as a whole (variables on
|
|
20
|
+
* `:root`) does not need it for colors, but still uses it for `codeThemes` and `motion`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ChatTheme({ theme, codeThemes, motion, children, className }: ChatThemeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface CodeBlockProps {
|
|
3
|
+
code: string;
|
|
4
|
+
/** Language for highlighting ("bash", "tsx"). Unknown or missing languages show plain text. */
|
|
5
|
+
language?: string;
|
|
6
|
+
/** Small caption above the code. Defaults to the language. Pass "" for none. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** "boxed" for code in a message (bordered box); "plain" inside tool details. */
|
|
9
|
+
variant?: "boxed" | "plain";
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Monospace code with Shiki highlighting, scrolling past a fixed height. */
|
|
13
|
+
export declare function CodeBlock({ code, language, label, variant, className }: CodeBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface ContextMenuProps {
|
|
3
|
+
/** A `<Menu>`; it opens at the pointer. */
|
|
4
|
+
menu: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Opens `menu` at the pointer on right-click, or at the focused element with the Menu key or Shift+F10.
|
|
10
|
+
* Long-press opens it where the browser fires `contextmenu` for touch (Android); give touch users a
|
|
11
|
+
* visible "…" button as well.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ContextMenu({ menu, children, className }: ContextMenuProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type DisclosureProps as AriaDisclosureProps } from "react-aria-components";
|
|
3
|
+
export interface DisclosureProps extends Omit<AriaDisclosureProps, "className" | "children"> {
|
|
4
|
+
/** The always-visible row. A small caret follows it, pointing right when closed and down when open. */
|
|
5
|
+
summary: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
summaryClassName?: string;
|
|
9
|
+
panelClassName?: string;
|
|
10
|
+
/** "caret": small triangle after the label (default). "chevron": chevron before it, for list sections. */
|
|
11
|
+
indicator?: "caret" | "chevron";
|
|
12
|
+
/** Content at the far right of the summary row, e.g. a count. */
|
|
13
|
+
trailing?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A row that expands to show more, like "Recalled memory ▸". */
|
|
16
|
+
export declare function Disclosure({ summary, children, className, summaryClassName, panelClassName, indicator, trailing, ...props }: DisclosureProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ThemedToken } from "shiki";
|
|
2
|
+
/** Highlighted lines of tokens, plus the themes' own background and text color as CSS variables. */
|
|
3
|
+
export interface Highlighted {
|
|
4
|
+
lines: ThemedToken[][];
|
|
5
|
+
/** `--shiki-light-bg`, `--shiki-dark-bg`, `--shiki-light` and `--shiki-dark` for the block itself. */
|
|
6
|
+
vars: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Highlights `code` in the background, with the themes from the nearest ChatTheme. Returns the latest
|
|
10
|
+
* finished result, so streaming code keeps its colors while the next version is highlighted instead of
|
|
11
|
+
* flashing back to plain text; a theme change re-highlights.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useHighlight(code: string, language: string | undefined): Highlighted | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type MenuItemProps as AriaMenuItemProps, type MenuProps as AriaMenuProps, type PopoverProps as AriaPopoverProps, type Key, type Selection } from "react-aria-components";
|
|
3
|
+
export { MenuTrigger, SubmenuTrigger } from "react-aria-components";
|
|
4
|
+
export interface MenuSearchProps {
|
|
5
|
+
placeholder: string;
|
|
6
|
+
/** A `Menu`; its items are filtered by what the user types. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Controlled search text, e.g. to offer "Create <text>". */
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/** A search box above a menu that filters its items, like "Search or create a project". */
|
|
13
|
+
export declare function MenuSearch({ placeholder, children, value, onChange }: MenuSearchProps): import("react").JSX.Element;
|
|
14
|
+
export interface PopoverProps extends Omit<AriaPopoverProps, "className"> {
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Floating panel for menus and pickers: surface color, rounded, soft shadow, fades in. */
|
|
18
|
+
export declare function Popover({ className, offset, ...props }: PopoverProps): import("react").JSX.Element;
|
|
19
|
+
export interface MenuProps<T> extends Omit<AriaMenuProps<T>, "className"> {
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function Menu<T extends object>({ className, ...props }: MenuProps<T>): import("react").JSX.Element;
|
|
23
|
+
export interface MenuItemProps extends Omit<AriaMenuItemProps, "className" | "children"> {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
icon?: ReactNode;
|
|
26
|
+
/** Second line under the label ("For complex work and everyday tasks"). */
|
|
27
|
+
description?: ReactNode;
|
|
28
|
+
/** Right-aligned detail: the current value of a submenu ("Medium") or a badge. */
|
|
29
|
+
detail?: ReactNode;
|
|
30
|
+
/** Keyboard shortcut shown on the right ("⌘U", "P"). */
|
|
31
|
+
shortcut?: string;
|
|
32
|
+
/** "danger" colors the item red, for Delete. */
|
|
33
|
+
tone?: "default" | "danger";
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function MenuItem({ children, icon, description, detail, shortcut, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
37
|
+
export interface MenuSectionProps {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
title?: ReactNode;
|
|
40
|
+
/** A section can hold its own selection, e.g. the model list above action items. */
|
|
41
|
+
selectionMode?: "single" | "multiple";
|
|
42
|
+
selectedKeys?: Iterable<Key>;
|
|
43
|
+
defaultSelectedKeys?: Iterable<Key>;
|
|
44
|
+
onSelectionChange?: (keys: Selection) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare function MenuSection({ title, children, ...selection }: MenuSectionProps): import("react").JSX.Element;
|
|
47
|
+
export declare function MenuSeparator(): import("react").JSX.Element;
|
|
48
|
+
/** Explanatory text inside a menu, above or below the items. Not focusable. */
|
|
49
|
+
export declare function MenuNote({ children, className }: {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
className?: string;
|
|
52
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface OverlayProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
/** Accessible name when there is no visible `title`. */
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalProps extends OverlayProps {
|
|
11
|
+
/** Heading at the top, also the dialog's accessible name. */
|
|
12
|
+
title?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** A centered dialog over a dimmed page. Escape and clicking outside close it; focus stays inside. */
|
|
15
|
+
export declare function Modal({ isOpen, onOpenChange, title, children, className, ...props }: ModalProps): import("react").JSX.Element;
|
|
16
|
+
export interface DrawerProps extends OverlayProps {
|
|
17
|
+
side?: "left" | "right";
|
|
18
|
+
}
|
|
19
|
+
/** A panel sliding in from the side over a dimmed page, e.g. the sidebar on phones. */
|
|
20
|
+
export declare function Drawer({ isOpen, onOpenChange, side, children, className, ...props }: DrawerProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface PanelProps {
|
|
3
|
+
/** Header text; the header is left out when neither `title` nor `actions` is set. */
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
/** Right side of the header, e.g. expand and close buttons. */
|
|
6
|
+
actions?: ReactNode;
|
|
7
|
+
/** Pinned under the body. */
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** "card": bordered and rounded, for grids and docks. "flush": no frame, for a pane that fills a column. */
|
|
11
|
+
variant?: "card" | "flush";
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A titled region that fills its container and lets the body scroll: a dock panel, an agent pane in a
|
|
17
|
+
* grid, a settings card. A `ChatView` placed in the body sizes itself to the panel.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Panel({ title, actions, footer, children, variant, className, ...props }: PanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { type TooltipProps as AriaTooltipProps } from "react-aria-components";
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
/** A focusable element, usually a Button or IconButton. */
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
placement?: AriaTooltipProps["placement"];
|
|
8
|
+
delay?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function Tooltip({ content, children, placement, delay }: TooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface AppShellProps {
|
|
3
|
+
sidebar: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Defaults to collapsed below 1024px. */
|
|
6
|
+
defaultCollapsed?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A page with a sidebar: pinned and collapsible to an icon rail from tablet width up, a drawer over the
|
|
11
|
+
* content on phones. Children get `useSidebar()` and `<SidebarToggle>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function AppShell({ sidebar, children, defaultCollapsed, className }: AppShellProps): import("react").JSX.Element;
|
|
14
|
+
export interface SidebarToggleProps {
|
|
15
|
+
/** Render only when the sidebar is a drawer, e.g. in the chat header. */
|
|
16
|
+
drawerOnly?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Opens the drawer on phones, collapses / expands the pinned sidebar elsewhere. */
|
|
20
|
+
export declare function SidebarToggle({ drawerOnly, className }: SidebarToggleProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Message, Part } from "../../../core/src/index.js";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { PendingApproval } from "../hooks/use-chat";
|
|
4
|
+
import { type ComposerProps } from "../components/composer";
|
|
5
|
+
import type { Feedback } from "../components/messages";
|
|
6
|
+
export type Density = "full" | "panel" | "inline";
|
|
7
|
+
export interface ChatViewProps {
|
|
8
|
+
messages: Message[];
|
|
9
|
+
busy?: boolean;
|
|
10
|
+
onSend: (text: string) => void;
|
|
11
|
+
onStop?: () => void;
|
|
12
|
+
/** Tool calls waiting on the user (`useChat().approvals`); the first shows above the composer. */
|
|
13
|
+
approvals?: PendingApproval[];
|
|
14
|
+
onApprove?: (partId: string, granted: boolean) => void;
|
|
15
|
+
onRetry?: (assistantId: string) => void;
|
|
16
|
+
onEdit?: (userId: string) => void;
|
|
17
|
+
onFeedback?: (assistantId: string, feedback: Feedback) => void;
|
|
18
|
+
renderPart?: (part: Part) => ReactNode;
|
|
19
|
+
/** Usually a `<ChatHeader>`. */
|
|
20
|
+
header?: ReactNode;
|
|
21
|
+
/** Passed to the composer: toolbar slots, placeholder, controlled text. */
|
|
22
|
+
composer?: Partial<Omit<ComposerProps, "onSubmit" | "onStop" | "busy">>;
|
|
23
|
+
/**
|
|
24
|
+
* Shown instead of the list while there are no messages; gets the centered composer to place, e.g.
|
|
25
|
+
* `(composer) => <EmptyState greeting="Good evening">{composer}</EmptyState>`. Defaults to the composer.
|
|
26
|
+
*/
|
|
27
|
+
emptyState?: (composer: ReactNode) => ReactNode;
|
|
28
|
+
/** Small print under the composer. */
|
|
29
|
+
disclaimer?: ReactNode;
|
|
30
|
+
/** "full": a page. "panel": a docked side panel. "inline": a small area inside a form. */
|
|
31
|
+
density?: Density;
|
|
32
|
+
/** Width of the message column, e.g. "48rem". Users can change it in settings. */
|
|
33
|
+
contentWidth?: string;
|
|
34
|
+
/** Padding beside the message column, e.g. "1.5rem". */
|
|
35
|
+
contentPadding?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A whole chat: header, the conversation, the docked composer. An empty chat shows `emptyState`. */
|
|
39
|
+
export declare function ChatView({ messages, busy, onSend, onStop, approvals, onApprove, onRetry, onEdit, onFeedback, renderPart, header, composer, emptyState, disclaimer, density, contentWidth, contentPadding, className, }: ChatViewProps): import("react").JSX.Element;
|
|
40
|
+
export interface EmptyStateProps {
|
|
41
|
+
/** "Good evening, Alex". */
|
|
42
|
+
greeting: ReactNode;
|
|
43
|
+
/** Mark left of the greeting, e.g. a logo. */
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
/** The centered composer. */
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
/** Under the composer, e.g. suggestion chips. */
|
|
48
|
+
footer?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/** A new chat: greeting over a centered composer. */
|
|
51
|
+
export declare function EmptyState({ greeting, icon, children, footer }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface SidebarProps {
|
|
3
|
+
/** Name or logo at the top left; hidden when collapsed. */
|
|
4
|
+
brand?: ReactNode;
|
|
5
|
+
/** Buttons at the top right next to the collapse toggle, e.g. a mode switch. */
|
|
6
|
+
headerActions?: ReactNode;
|
|
7
|
+
/** Fixed items under the header: New chat, Search, Projects… (`SidebarItem`s). */
|
|
8
|
+
nav?: ReactNode;
|
|
9
|
+
/** The scrolling middle, usually `ChatList`. Hidden when collapsed. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** Bottom, usually `SidebarUser`. */
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** The claude.ai sidebar frame. Collapses to an icon rail inside `AppShell`; a drawer on phones. */
|
|
16
|
+
export declare function Sidebar({ brand, headerActions, nav, children, footer, className }: SidebarProps): import("react").JSX.Element;
|
|
17
|
+
export interface SidebarItemProps {
|
|
18
|
+
icon: ReactNode;
|
|
19
|
+
label: string;
|
|
20
|
+
onPress?: () => void;
|
|
21
|
+
href?: string;
|
|
22
|
+
active?: boolean;
|
|
23
|
+
/** Shown on the right, e.g. "⌘K". */
|
|
24
|
+
shortcut?: string;
|
|
25
|
+
}
|
|
26
|
+
/** A nav row: icon and label; just the icon with a tooltip when collapsed. Closes the drawer when picked. */
|
|
27
|
+
export declare function SidebarItem({ icon, label, onPress, href, active, shortcut }: SidebarItemProps): import("react").JSX.Element;
|
|
28
|
+
export interface SidebarUserProps {
|
|
29
|
+
name: string;
|
|
30
|
+
/** Second line, e.g. the plan. */
|
|
31
|
+
detail?: ReactNode;
|
|
32
|
+
/** Image URL; initials otherwise. */
|
|
33
|
+
avatarUrl?: string;
|
|
34
|
+
/** Opens upward from the row, e.g. settings and log out. */
|
|
35
|
+
menu?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/** The account row at the bottom: avatar, name, plan, and a menu. */
|
|
38
|
+
export declare function SidebarUser({ name, detail, avatarUrl, menu }: SidebarUserProps): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-ui-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "React UI kit for LLM chat and agentic apps: streaming messages, tool calls, approvals, themable with CSS variables.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/bushshrub/agentic-ui-kit.git",
|
|
10
|
+
"directory": "packages/react"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"react",
|
|
14
|
+
"llm",
|
|
15
|
+
"chat",
|
|
16
|
+
"ai",
|
|
17
|
+
"agent",
|
|
18
|
+
"ui-kit",
|
|
19
|
+
"tool-calls",
|
|
20
|
+
"streaming"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/types/react/src/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./core": {
|
|
28
|
+
"types": "./dist/types/react/src/core.d.ts",
|
|
29
|
+
"import": "./dist/core.js"
|
|
30
|
+
},
|
|
31
|
+
"./styles.css": "./dist/styles.css",
|
|
32
|
+
"./tailwind.css": "./dist/tailwind.css",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"sideEffects": [
|
|
39
|
+
"*.css"
|
|
40
|
+
],
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^19",
|
|
43
|
+
"react-dom": "^19"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"react": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"react-dom": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@streamdown/code": "^2.0.0",
|
|
55
|
+
"@streamdown/math": "^1.0.3",
|
|
56
|
+
"clsx": "^2.1.1",
|
|
57
|
+
"katex": "0.16.47",
|
|
58
|
+
"lucide-react": "1.69.0",
|
|
59
|
+
"react-aria": "3.53.1",
|
|
60
|
+
"react-aria-components": "1.22.1",
|
|
61
|
+
"shiki": "4.6.0",
|
|
62
|
+
"streamdown": "2.7.1"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@tailwindcss/cli": "^4.3.4",
|
|
66
|
+
"@testing-library/react": "16.3.3",
|
|
67
|
+
"@testing-library/user-event": "^14.6.8",
|
|
68
|
+
"@types/node": "^26.6.6",
|
|
69
|
+
"@types/react": "^19.3.0",
|
|
70
|
+
"@types/react-dom": "^19.3.0",
|
|
71
|
+
"jsdom": "31.0.0",
|
|
72
|
+
"react": "^19.3.1",
|
|
73
|
+
"react-dom": "^19.3.1",
|
|
74
|
+
"tailwindcss": "4.3.4",
|
|
75
|
+
"tsdown": "^0.23.5",
|
|
76
|
+
"@agentic-ui-kit/core": "0.0.0"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "node build.mjs",
|
|
80
|
+
"typecheck": "tsc -p .",
|
|
81
|
+
"test": "vitest run"
|
|
82
|
+
}
|
|
6
83
|
}
|