agentic-ui-kit 0.6.0 → 0.7.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/dist/index.js +643 -109
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +43 -0
- package/dist/types/react/src/components/attachments.d.ts +4 -1
- package/dist/types/react/src/components/chat-list.d.ts +4 -0
- package/dist/types/react/src/components/context-meter.d.ts +24 -0
- package/dist/types/react/src/components/context-panel.d.ts +5 -0
- package/dist/types/react/src/components/copy-field.d.ts +15 -0
- package/dist/types/react/src/components/markdown.d.ts +19 -2
- package/dist/types/react/src/components/model-picker.d.ts +6 -1
- package/dist/types/react/src/components/tools.d.ts +7 -2
- package/dist/types/react/src/hooks/sidebar-state.d.ts +6 -0
- package/dist/types/react/src/hooks/sse-transport.d.ts +7 -1
- package/dist/types/react/src/hooks/use-chat.d.ts +14 -1
- package/dist/types/react/src/index.d.ts +9 -5
- package/dist/types/react/src/primitives/button.d.ts +11 -3
- package/dist/types/react/src/primitives/cx.d.ts +3 -0
- package/dist/types/react/src/primitives/labels.d.ts +18 -0
- package/dist/types/react/src/primitives/menu.d.ts +23 -5
- package/dist/types/react/src/primitives/overlay.d.ts +13 -1
- package/dist/types/react/src/primitives/segmented-control.d.ts +29 -4
- package/dist/types/react/src/views/app-shell.d.ts +31 -3
- package/dist/types/react/src/views/chat-view.d.ts +6 -2
- package/dist/types/react/src/views/sidebar.d.ts +31 -5
- package/package.json +3 -2
|
@@ -25,6 +25,12 @@ export interface ChatLabels {
|
|
|
25
25
|
ranCommandLabel: string;
|
|
26
26
|
/** Heading phrase for command calls, lowercase: "ran a command", "ran 3 commands". */
|
|
27
27
|
ranCommands: (count: number) => string;
|
|
28
|
+
/** Approval question for the command tool, present tense. */
|
|
29
|
+
runCommandAsk: string;
|
|
30
|
+
/** Approval question for the web search tool. */
|
|
31
|
+
searchWebAsk: string;
|
|
32
|
+
/** Approval question for the page fetch tool. */
|
|
33
|
+
readPageAsk: string;
|
|
28
34
|
/** Row label of the web search tool. */
|
|
29
35
|
searchedWebLabel: string;
|
|
30
36
|
readPageLabel: string;
|
|
@@ -61,12 +67,22 @@ export interface ChatLabels {
|
|
|
61
67
|
expandSidebar: string;
|
|
62
68
|
/** Sidebar toggle, full width. */
|
|
63
69
|
collapseSidebar: string;
|
|
70
|
+
/** Accessible name of the sidebar's resize handle. */
|
|
71
|
+
resizeSidebar: string;
|
|
72
|
+
/** A label with its keyboard shortcut, e.g. "Collapse sidebar (⌘ B)". */
|
|
73
|
+
withShortcut: (label: string, keys: string) => string;
|
|
74
|
+
/** The Ctrl key's name in shortcut hints (non-Mac). */
|
|
75
|
+
ctrlKey: string;
|
|
64
76
|
/** Default title of the context panel. */
|
|
65
77
|
context: string;
|
|
66
78
|
/** Accessible name of the usage meter. */
|
|
67
79
|
contextUsed: string;
|
|
68
80
|
/** "42% used". */
|
|
69
81
|
percentUsed: (percent: number) => string;
|
|
82
|
+
/** Context meter summary, also its accessible name: "Context: 13.8k / 200k (7%)". */
|
|
83
|
+
contextSummary: (used: string, limit: string, percent: number) => string;
|
|
84
|
+
/** Context meter while the numbers are still loading. */
|
|
85
|
+
contextLoading: string;
|
|
70
86
|
/** Row for the unused part of the window. */
|
|
71
87
|
freeSpace: string;
|
|
72
88
|
/** "1.2k tokens"; `count` is already formatted. */
|
|
@@ -155,6 +171,8 @@ export interface ChatLabels {
|
|
|
155
171
|
copy: string;
|
|
156
172
|
/** Copy button right after copying. */
|
|
157
173
|
copied: string;
|
|
174
|
+
/** Accessible name of a copy field's read-only input. */
|
|
175
|
+
copyFieldLabel: string;
|
|
158
176
|
/** Retry button. */
|
|
159
177
|
retry: string;
|
|
160
178
|
/** Edit button. */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import { type MenuItemProps as AriaMenuItemProps, type MenuProps as AriaMenuProps, type PopoverProps as AriaPopoverProps, type Key, type Selection } from "react-aria-components";
|
|
3
|
-
|
|
3
|
+
import { DialogTrigger } from "react-aria-components";
|
|
4
|
+
export { MenuTrigger, SubmenuTrigger, DialogTrigger } from "react-aria-components";
|
|
5
|
+
/**
|
|
6
|
+
* Wraps a trigger button and a kit `Popover` (or `Modal`) so that pressing the button toggles it, without
|
|
7
|
+
* importing react-aria. The same component as `DialogTrigger`; use whichever name reads better.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PopoverTrigger: typeof DialogTrigger;
|
|
4
10
|
export interface MenuSearchProps {
|
|
5
11
|
placeholder: string;
|
|
6
12
|
/** A `Menu`; its items are filtered by what the user types. */
|
|
@@ -13,9 +19,19 @@ export interface MenuSearchProps {
|
|
|
13
19
|
export declare function MenuSearch({ placeholder, children, value, onChange }: MenuSearchProps): import("react").JSX.Element;
|
|
14
20
|
export interface PopoverProps extends Omit<AriaPopoverProps, "className"> {
|
|
15
21
|
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Below this viewport width (px, default 768) the popover opens as a bottom sheet over a dimmed page instead
|
|
24
|
+
* of floating at the trigger; keyboard, focus and dismissing work the same. `false` always floats. Placement
|
|
25
|
+
* props are ignored in the sheet.
|
|
26
|
+
*/
|
|
27
|
+
sheet?: number | false;
|
|
28
|
+
/** "trigger" makes the popover as wide as its trigger (react-aria's `--trigger-width`). Default "auto". */
|
|
29
|
+
width?: "auto" | "trigger";
|
|
30
|
+
/** When floating on a phone (`sheet={false}`), stretch to the viewport width. */
|
|
31
|
+
fullWidthOnPhones?: boolean;
|
|
16
32
|
}
|
|
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;
|
|
33
|
+
/** Floating panel for menus and pickers: surface color, rounded, soft shadow, fades in. On phones it's a bottom sheet. */
|
|
34
|
+
export declare function Popover({ className, offset, sheet, width, fullWidthOnPhones, children, ...props }: PopoverProps): import("react").JSX.Element;
|
|
19
35
|
export interface MenuProps<T> extends Omit<AriaMenuProps<T>, "className"> {
|
|
20
36
|
className?: string;
|
|
21
37
|
}
|
|
@@ -33,9 +49,11 @@ export interface MenuItemProps extends Omit<AriaMenuItemProps, "className" | "ch
|
|
|
33
49
|
shortcut?: string;
|
|
34
50
|
/** "danger" colors the item red, for Delete. */
|
|
35
51
|
tone?: "default" | "danger";
|
|
52
|
+
/** In a selection menu, how the selected state shows: a "check" mark (default) or an on/off "switch" for settings rows. */
|
|
53
|
+
indicator?: "check" | "switch";
|
|
36
54
|
className?: string;
|
|
37
55
|
}
|
|
38
|
-
export declare function MenuItem({ children, icon, description, descriptionPlacement, detail, shortcut, tone, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
56
|
+
export declare function MenuItem({ children, icon, description, descriptionPlacement, detail, shortcut, tone, indicator, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
39
57
|
export interface MenuSectionProps {
|
|
40
58
|
children: ReactNode;
|
|
41
59
|
title?: ReactNode;
|
|
@@ -7,12 +7,24 @@ interface OverlayProps {
|
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
|
+
declare const modalSizes: {
|
|
11
|
+
sm: string;
|
|
12
|
+
md: string;
|
|
13
|
+
lg: string;
|
|
14
|
+
xl: string;
|
|
15
|
+
/** Fills the page inside the overlay's padding. */
|
|
16
|
+
full: string;
|
|
17
|
+
};
|
|
10
18
|
export interface ModalProps extends OverlayProps {
|
|
11
19
|
/** Heading at the top, also the dialog's accessible name. */
|
|
12
20
|
title?: ReactNode;
|
|
21
|
+
/** Width of the dialog: sm 24rem, md 32rem, lg 42rem (default), xl 64rem, full fills the page. */
|
|
22
|
+
size?: keyof typeof modalSizes;
|
|
23
|
+
/** "center" (default) vertically centers the dialog; "top" puts it near the top edge, e.g. a command palette. */
|
|
24
|
+
placement?: "center" | "top";
|
|
13
25
|
}
|
|
14
26
|
/** 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;
|
|
27
|
+
export declare function Modal({ isOpen, onOpenChange, title, size, placement, children, className, ...props }: ModalProps): import("react").JSX.Element;
|
|
16
28
|
export interface DrawerProps extends OverlayProps {
|
|
17
29
|
side?: "left" | "right";
|
|
18
30
|
}
|
|
@@ -5,18 +5,43 @@ export interface SegmentedOption<T extends string = string> {
|
|
|
5
5
|
icon?: ReactNode;
|
|
6
6
|
/** Show only the icon; the label becomes its accessible name and tooltip. */
|
|
7
7
|
iconOnly?: boolean;
|
|
8
|
+
/** Disable just this option. */
|
|
9
|
+
isDisabled?: boolean;
|
|
8
10
|
}
|
|
9
|
-
|
|
11
|
+
declare const sizes: {
|
|
12
|
+
sm: {
|
|
13
|
+
button: string;
|
|
14
|
+
iconOnly: string;
|
|
15
|
+
};
|
|
16
|
+
md: {
|
|
17
|
+
button: string;
|
|
18
|
+
iconOnly: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
interface SegmentedControlBase<T extends string> {
|
|
10
22
|
/** Accessible name of the group, e.g. "Mode". */
|
|
11
23
|
label: string;
|
|
12
24
|
options: readonly SegmentedOption<T>[];
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
/** Disable the whole control. */
|
|
26
|
+
isDisabled?: boolean;
|
|
27
|
+
/** "sm" (default, 24px tall) or "md" (32px). */
|
|
28
|
+
size?: keyof typeof sizes;
|
|
15
29
|
className?: string;
|
|
16
30
|
}
|
|
31
|
+
export type SegmentedControlProps<T extends string = string> = SegmentedControlBase<T> & ({
|
|
32
|
+
/** Pressing the selected option again clears the selection: `value` may be `null` and `onChange` gets `null`. */
|
|
33
|
+
clearable?: false;
|
|
34
|
+
value: T;
|
|
35
|
+
onChange: (value: T) => void;
|
|
36
|
+
} | {
|
|
37
|
+
clearable: true;
|
|
38
|
+
value: T | null;
|
|
39
|
+
onChange: (value: T | null) => void;
|
|
40
|
+
});
|
|
17
41
|
/**
|
|
18
42
|
* One of a few options, side by side on a track, similar to claude.ai's Chat / Cowork switch. Themed with
|
|
19
43
|
* `--chat-segment-track` (default: a shade darker than the surface it sits on) and `--chat-segment-selected`
|
|
20
44
|
* (default `--chat-raised`).
|
|
21
45
|
*/
|
|
22
|
-
export declare function SegmentedControl<T extends string>({ label, options, value, onChange, className }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
46
|
+
export declare function SegmentedControl<T extends string>({ label, options, value, onChange, clearable, isDisabled, size, className }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -2,19 +2,47 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
export interface AppShellProps {
|
|
3
3
|
sidebar: ReactNode;
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
/** Defaults to collapsed below 1024px. */
|
|
5
|
+
/** Defaults to collapsed below 1024px. Only the initial value; use `collapsed` to control it. */
|
|
6
6
|
defaultCollapsed?: boolean;
|
|
7
|
+
/** Controls whether the pinned sidebar is the icon rail. Pair with `onCollapsedChange`. */
|
|
8
|
+
collapsed?: boolean;
|
|
9
|
+
/** Called with the new value when the user collapses or expands the pinned sidebar (button or shortcut). */
|
|
10
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Where the page scrolls. `"inner"` (default): the shell is exactly the window tall and `main` scrolls inside.
|
|
13
|
+
* `"window"`: the shell grows with its content, the window scrolls (sticky headers and `position: sticky` in the
|
|
14
|
+
* page keep working) and the sidebar sticks to the top at window height.
|
|
15
|
+
*/
|
|
16
|
+
scroll?: "inner" | "window";
|
|
17
|
+
/**
|
|
18
|
+
* Lets the user drag the sidebar's right edge (or use the arrow keys on it) to change its width, in px.
|
|
19
|
+
* Without it the width is `--chat-sidebar-width`.
|
|
20
|
+
*/
|
|
21
|
+
resizable?: {
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
};
|
|
25
|
+
/** Controls the width in px while `resizable`. Pair with `onWidthChange`. */
|
|
26
|
+
width?: number;
|
|
27
|
+
/** Initial width in px while `resizable`, 288 (18rem) otherwise. */
|
|
28
|
+
defaultWidth?: number;
|
|
29
|
+
/** Called with the width in px when a drag ends or a key changes it (not on every pointer move). */
|
|
30
|
+
onWidthChange?: (width: number) => void;
|
|
31
|
+
/** Keeps the width in localStorage under this key, so it survives reloads. */
|
|
32
|
+
persistKey?: string;
|
|
33
|
+
/** Cmd+B (Ctrl+B off Apple platforms) toggles the sidebar. Default true. */
|
|
34
|
+
shortcut?: boolean;
|
|
7
35
|
className?: string;
|
|
8
36
|
}
|
|
9
37
|
/**
|
|
10
38
|
* A page with a sidebar: pinned and collapsible to an icon rail from tablet width up, a drawer over the
|
|
11
39
|
* content on phones. Children get `useSidebar()` and `<SidebarToggle>`.
|
|
12
40
|
*/
|
|
13
|
-
export declare function AppShell({ sidebar, children, defaultCollapsed, className }: AppShellProps): import("react").JSX.Element;
|
|
41
|
+
export declare function AppShell({ sidebar, children, defaultCollapsed, collapsed: collapsedProp, onCollapsedChange, scroll, resizable, width: widthProp, defaultWidth, onWidthChange, persistKey, shortcut, className, }: AppShellProps): import("react").JSX.Element;
|
|
14
42
|
export interface SidebarToggleProps {
|
|
15
43
|
/** Render only when the sidebar is a drawer, e.g. in the chat header. */
|
|
16
44
|
drawerOnly?: boolean;
|
|
17
45
|
className?: string;
|
|
18
46
|
}
|
|
19
|
-
/** Opens the drawer on phones, collapses / expands the pinned sidebar elsewhere. */
|
|
47
|
+
/** Opens the drawer on phones, collapses / expands the pinned sidebar elsewhere. Its label names the shortcut, e.g. "(⌘ B)". */
|
|
20
48
|
export declare function SidebarToggle({ drawerOnly, className }: SidebarToggleProps): import("react").JSX.Element | null;
|
|
@@ -35,8 +35,12 @@ export interface ChatViewProps {
|
|
|
35
35
|
widgets?: WidgetHost;
|
|
36
36
|
/** Usually a `<ChatHeader>`. */
|
|
37
37
|
header?: ReactNode;
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Passed to the composer: toolbar slots, placeholder, controlled text. `false` shows no composer (a chat you
|
|
40
|
+
* can only read or answer through approvals and message actions): `renderComposer` is not called, the empty
|
|
41
|
+
* state gets `null` in place of the composer and nothing shows if there is none.
|
|
42
|
+
*/
|
|
43
|
+
composer?: Partial<Omit<ComposerProps, "onSubmit" | "onStop" | "busy">> | false;
|
|
40
44
|
/**
|
|
41
45
|
* Shown instead of the list while there are no messages; gets the centered composer to place, e.g.
|
|
42
46
|
* `(composer) => <EmptyState greeting="Good evening">{composer}</EmptyState>`. Defaults to the composer.
|
|
@@ -4,8 +4,10 @@ export interface SidebarProps {
|
|
|
4
4
|
brand?: ReactNode;
|
|
5
5
|
/** A logo mark left of `brand`, sized 1.25rem. It stays at the top of the collapsed rail. */
|
|
6
6
|
brandIcon?: ReactNode;
|
|
7
|
-
/** Buttons at the top right next to the collapse toggle, e.g. a mode switch. */
|
|
7
|
+
/** Buttons at the top right next to the collapse toggle, e.g. a mode switch. Hidden when collapsed; see `railActions`. */
|
|
8
8
|
headerActions?: ReactNode;
|
|
9
|
+
/** Icon-only buttons shown under the toggle on the collapsed rail, e.g. the same actions as `headerActions`. */
|
|
10
|
+
railActions?: ReactNode;
|
|
9
11
|
/** Fixed items under the header: New chat, Search, Projects… (`SidebarItem`s). */
|
|
10
12
|
nav?: ReactNode;
|
|
11
13
|
/** The scrolling middle, usually `ChatList`. Hidden when collapsed. */
|
|
@@ -15,18 +17,42 @@ export interface SidebarProps {
|
|
|
15
17
|
className?: string;
|
|
16
18
|
}
|
|
17
19
|
/** The claude.ai sidebar frame. Collapses to an icon rail inside `AppShell`; a drawer on phones. */
|
|
18
|
-
export declare function Sidebar({ brand, brandIcon, headerActions, nav, children, footer, className }: SidebarProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Sidebar({ brand, brandIcon, headerActions, railActions, nav, children, footer, className }: SidebarProps): import("react").JSX.Element;
|
|
21
|
+
export interface SidebarListProps {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The `<ul>` for `SidebarItem`s outside `Sidebar`'s `nav` slot (e.g. inside a section): no bullets, no padding. */
|
|
26
|
+
export declare function SidebarList({ children, className }: SidebarListProps): import("react").JSX.Element;
|
|
19
27
|
export interface SidebarItemProps {
|
|
20
28
|
icon: ReactNode;
|
|
21
29
|
label: string;
|
|
22
30
|
onPress?: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Renders the row as a link. For client-side navigation wrap the app in react-aria's `RouterProvider`;
|
|
33
|
+
* otherwise a press reloads the page.
|
|
34
|
+
*/
|
|
23
35
|
href?: string;
|
|
24
36
|
active?: boolean;
|
|
25
|
-
/** Shown on the right, e.g. "⌘K". */
|
|
37
|
+
/** Shown on the right on hover, e.g. "⌘K". */
|
|
26
38
|
shortcut?: string;
|
|
39
|
+
/** Always shown on the right, e.g. an unread count. On the collapsed rail it becomes a dot. */
|
|
40
|
+
badge?: ReactNode;
|
|
41
|
+
/** A second, smaller line under the label. */
|
|
42
|
+
description?: ReactNode;
|
|
43
|
+
/** Row actions (a `…` button, say), shown on hover and focus, outside the link so they can be buttons. Hidden when collapsed. */
|
|
44
|
+
trailing?: ReactNode;
|
|
45
|
+
/** Native tooltip on the row. Without it, the label shows as a tooltip only while it is cut off by `…`. */
|
|
46
|
+
title?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
/** Any `data-*` attribute goes on the row's `<li>`, e.g. `data-testid`. */
|
|
49
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
27
50
|
}
|
|
28
|
-
/**
|
|
29
|
-
|
|
51
|
+
/**
|
|
52
|
+
* A nav row: icon and label; just the icon with a tooltip when collapsed. Closes the drawer when picked.
|
|
53
|
+
* Icons are 1rem, or `--chat-sidebar-icon-size`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function SidebarItem({ icon, label, onPress, href, active, shortcut, badge, description, trailing, title, className: extra, ...rest }: SidebarItemProps): import("react").JSX.Element;
|
|
30
56
|
export interface SidebarUserProps {
|
|
31
57
|
name: string;
|
|
32
58
|
/** Second line, e.g. the plan. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "React UI kit for LLM chat and agentic apps: streaming messages, tool calls, approvals, themable with CSS variables.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"react-aria": "3.53.1",
|
|
60
60
|
"react-aria-components": "1.22.1",
|
|
61
61
|
"shiki": "4.6.0",
|
|
62
|
-
"streamdown": "2.7.1"
|
|
62
|
+
"streamdown": "2.7.1",
|
|
63
|
+
"tailwind-merge": "^3.7.0"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"@tailwindcss/cli": "^4.3.4",
|