@timbal-ai/timbal-react 0.5.4 → 0.6.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/README.md +128 -4
- package/dist/app.cjs +5311 -0
- package/dist/app.d.cts +29 -0
- package/dist/app.d.ts +29 -0
- package/dist/app.esm.js +81 -0
- package/dist/chart-artifact-C71dk4xI.d.ts +329 -0
- package/dist/chart-artifact-CPEpOmtV.d.cts +329 -0
- package/dist/chat-CWtQWDtJ.d.cts +650 -0
- package/dist/chat-CWtQWDtJ.d.ts +650 -0
- package/dist/chat.cjs +4162 -0
- package/dist/chat.d.cts +13 -0
- package/dist/chat.d.ts +13 -0
- package/dist/chat.esm.js +51 -0
- package/dist/chunk-4TCJQSIX.esm.js +565 -0
- package/dist/chunk-IYENDIRY.esm.js +119 -0
- package/dist/chunk-KC5QLVUG.esm.js +22 -0
- package/dist/chunk-M4V6Q6XO.esm.js +1082 -0
- package/dist/chunk-OFHLFNJH.esm.js +138 -0
- package/dist/chunk-OVHR7J3J.esm.js +1574 -0
- package/dist/chunk-WLTW56MC.esm.js +66 -0
- package/dist/chunk-YJQLLFKP.esm.js +3672 -0
- package/dist/index.cjs +1823 -359
- package/dist/index.d.cts +15 -931
- package/dist/index.d.ts +15 -931
- package/dist/index.esm.js +187 -5578
- package/dist/layout-B9VayJhZ.d.cts +75 -0
- package/dist/layout-CQWngNQ7.d.ts +75 -0
- package/dist/studio.cjs +5734 -0
- package/dist/studio.d.cts +15 -0
- package/dist/studio.d.ts +15 -0
- package/dist/studio.esm.js +27 -0
- package/dist/styles.css +52 -2
- package/dist/timbal-v2-button-F4-z7m33.d.cts +40 -0
- package/dist/timbal-v2-button-F4-z7m33.d.ts +40 -0
- package/dist/ui.cjs +720 -0
- package/dist/ui.d.cts +74 -0
- package/dist/ui.d.ts +74 -0
- package/dist/ui.esm.js +44 -0
- package/dist/welcome--80i_O0p.d.cts +190 -0
- package/dist/welcome-BOizSp5h.d.ts +190 -0
- package/package.json +35 -3
- package/scripts/dev-linked.mjs +66 -0
- package/vite/local-dev.d.ts +4 -0
- package/vite/local-dev.mjs +71 -0
package/dist/ui.d.cts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ElementType, ReactNode, FC } from 'react';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
import { Tooltip as Tooltip$1, Avatar as Avatar$1, Dialog as Dialog$1 } from 'radix-ui';
|
|
7
|
+
export { a as TimbalV2Button } from './timbal-v2-button-F4-z7m33.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Layout-only variants for consumers that compose `buttonVariants` directly.
|
|
11
|
+
* Fill / border / shadow come from `button-tokens` via `TimbalV2Button`.
|
|
12
|
+
*/
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "secondary" | "ghost" | "destructive" | "link" | "default" | "outline" | null | undefined;
|
|
15
|
+
size?: "xs" | "sm" | "lg" | "default" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof Tooltip$1.Provider>): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof Tooltip$1.Root>): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof Tooltip$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
|
|
27
|
+
size?: "default" | "sm" | "lg";
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
38
|
+
showCloseButton?: boolean;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface TextShimmerProps {
|
|
43
|
+
children: string;
|
|
44
|
+
as?: ElementType;
|
|
45
|
+
className?: string;
|
|
46
|
+
duration?: number;
|
|
47
|
+
spread?: number;
|
|
48
|
+
}
|
|
49
|
+
declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
|
|
50
|
+
|
|
51
|
+
interface PillSegmentedTab {
|
|
52
|
+
key: string;
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface PillSegmentedTabsProps {
|
|
57
|
+
value: string;
|
|
58
|
+
onChange: (key: string) => void;
|
|
59
|
+
tabs: PillSegmentedTab[];
|
|
60
|
+
className?: string;
|
|
61
|
+
/** `flush` — Studio topbar / dashboard tabs (Build/Manage). */
|
|
62
|
+
trackVariant?: "default" | "flush";
|
|
63
|
+
/** Unique per instance when multiple controls share a page (motion layout). */
|
|
64
|
+
layoutId?: string;
|
|
65
|
+
"aria-label"?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pill-in-pill segmented control — same visual language as timbal-platform
|
|
69
|
+
* `WorkshopPillSegmentedTabs` (Build/Manage, Home Builder tabs).
|
|
70
|
+
*/
|
|
71
|
+
declare const PillSegmentedTabs: FC<PillSegmentedTabsProps>;
|
|
72
|
+
declare const MemoPillSegmentedTabs: React.NamedExoticComponent<PillSegmentedTabsProps>;
|
|
73
|
+
|
|
74
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, MemoPillSegmentedTabs, type PillSegmentedTab, PillSegmentedTabs, type PillSegmentedTabsProps, Shimmer, type TextShimmerProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ElementType, ReactNode, FC } from 'react';
|
|
5
|
+
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
import { Tooltip as Tooltip$1, Avatar as Avatar$1, Dialog as Dialog$1 } from 'radix-ui';
|
|
7
|
+
export { a as TimbalV2Button } from './timbal-v2-button-F4-z7m33.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Layout-only variants for consumers that compose `buttonVariants` directly.
|
|
11
|
+
* Fill / border / shadow come from `button-tokens` via `TimbalV2Button`.
|
|
12
|
+
*/
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "secondary" | "ghost" | "destructive" | "link" | "default" | "outline" | null | undefined;
|
|
15
|
+
size?: "xs" | "sm" | "lg" | "default" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof Tooltip$1.Provider>): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof Tooltip$1.Root>): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof Tooltip$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
|
|
27
|
+
size?: "default" | "sm" | "lg";
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
38
|
+
showCloseButton?: boolean;
|
|
39
|
+
}): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
interface TextShimmerProps {
|
|
43
|
+
children: string;
|
|
44
|
+
as?: ElementType;
|
|
45
|
+
className?: string;
|
|
46
|
+
duration?: number;
|
|
47
|
+
spread?: number;
|
|
48
|
+
}
|
|
49
|
+
declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
|
|
50
|
+
|
|
51
|
+
interface PillSegmentedTab {
|
|
52
|
+
key: string;
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface PillSegmentedTabsProps {
|
|
57
|
+
value: string;
|
|
58
|
+
onChange: (key: string) => void;
|
|
59
|
+
tabs: PillSegmentedTab[];
|
|
60
|
+
className?: string;
|
|
61
|
+
/** `flush` — Studio topbar / dashboard tabs (Build/Manage). */
|
|
62
|
+
trackVariant?: "default" | "flush";
|
|
63
|
+
/** Unique per instance when multiple controls share a page (motion layout). */
|
|
64
|
+
layoutId?: string;
|
|
65
|
+
"aria-label"?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pill-in-pill segmented control — same visual language as timbal-platform
|
|
69
|
+
* `WorkshopPillSegmentedTabs` (Build/Manage, Home Builder tabs).
|
|
70
|
+
*/
|
|
71
|
+
declare const PillSegmentedTabs: FC<PillSegmentedTabsProps>;
|
|
72
|
+
declare const MemoPillSegmentedTabs: React.NamedExoticComponent<PillSegmentedTabsProps>;
|
|
73
|
+
|
|
74
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, MemoPillSegmentedTabs, type PillSegmentedTab, PillSegmentedTabs, type PillSegmentedTabsProps, Shimmer, type TextShimmerProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
package/dist/ui.esm.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MemoPillSegmentedTabs,
|
|
3
|
+
PillSegmentedTabs
|
|
4
|
+
} from "./chunk-IYENDIRY.esm.js";
|
|
5
|
+
import {
|
|
6
|
+
Avatar,
|
|
7
|
+
AvatarFallback,
|
|
8
|
+
AvatarImage,
|
|
9
|
+
Button,
|
|
10
|
+
Dialog,
|
|
11
|
+
DialogClose,
|
|
12
|
+
DialogContent,
|
|
13
|
+
DialogOverlay,
|
|
14
|
+
DialogPortal,
|
|
15
|
+
DialogTitle,
|
|
16
|
+
DialogTrigger,
|
|
17
|
+
Shimmer,
|
|
18
|
+
TimbalV2Button,
|
|
19
|
+
Tooltip,
|
|
20
|
+
TooltipContent,
|
|
21
|
+
TooltipProvider,
|
|
22
|
+
TooltipTrigger
|
|
23
|
+
} from "./chunk-4TCJQSIX.esm.js";
|
|
24
|
+
export {
|
|
25
|
+
Avatar,
|
|
26
|
+
AvatarFallback,
|
|
27
|
+
AvatarImage,
|
|
28
|
+
Button,
|
|
29
|
+
Dialog,
|
|
30
|
+
DialogClose,
|
|
31
|
+
DialogContent,
|
|
32
|
+
DialogOverlay,
|
|
33
|
+
DialogPortal,
|
|
34
|
+
DialogTitle,
|
|
35
|
+
DialogTrigger,
|
|
36
|
+
MemoPillSegmentedTabs,
|
|
37
|
+
PillSegmentedTabs,
|
|
38
|
+
Shimmer,
|
|
39
|
+
TimbalV2Button,
|
|
40
|
+
Tooltip,
|
|
41
|
+
TooltipContent,
|
|
42
|
+
TooltipProvider,
|
|
43
|
+
TooltipTrigger
|
|
44
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { b as TimbalChatProps, u as ThreadWelcomeProps } from './chat-CWtQWDtJ.cjs';
|
|
3
|
+
import { WorkforceItem } from '@timbal-ai/timbal-sdk';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
interface TimbalChatShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
7
|
+
/**
|
|
8
|
+
* Pre-selected workforce id. When omitted, the shell fetches the workforce
|
|
9
|
+
* list from `{baseUrl}/workforce` and picks the first agent automatically.
|
|
10
|
+
*/
|
|
11
|
+
workforceId?: string;
|
|
12
|
+
/** Branding rendered at the start of the header (logo, etc). */
|
|
13
|
+
brand?: ReactNode;
|
|
14
|
+
/** Extra content rendered at the end of the header (theme toggle, logout). */
|
|
15
|
+
headerActions?: ReactNode;
|
|
16
|
+
/** Hide the built-in workforce selector. Default: false. */
|
|
17
|
+
hideWorkforceSelector?: boolean;
|
|
18
|
+
/** Class for the outer flex container. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Class for the header bar. */
|
|
21
|
+
headerClassName?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Drop-in shell that wraps `TimbalChat` with the Studio playground chrome:
|
|
25
|
+
* floating topbar with brand + workforce selector + actions, soft gradient
|
|
26
|
+
* background, and the chat thread filling the remaining vertical space.
|
|
27
|
+
*
|
|
28
|
+
* Falls back to picking the first available workforce when `workforceId`
|
|
29
|
+
* isn't supplied.
|
|
30
|
+
*/
|
|
31
|
+
declare const TimbalChatShell: FC<TimbalChatShellProps>;
|
|
32
|
+
|
|
33
|
+
interface TimbalStudioShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
34
|
+
/**
|
|
35
|
+
* Pin the chat to a specific workforce. When omitted, the shell fetches
|
|
36
|
+
* the workforce list via `useWorkforces()` and lets the sidebar drive
|
|
37
|
+
* selection.
|
|
38
|
+
*/
|
|
39
|
+
workforceId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Pre-loaded workforce list. When omitted, the shell fetches it.
|
|
42
|
+
* Useful for stories / SSR / preview environments.
|
|
43
|
+
*/
|
|
44
|
+
workforces?: WorkforceItem[];
|
|
45
|
+
/** Custom fetch for the workforce list (mock fetch in preview mode). */
|
|
46
|
+
workforcesFetch?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
47
|
+
/** Base URL for the workforce list. Default: `/api`. */
|
|
48
|
+
workforcesBaseUrl?: string;
|
|
49
|
+
/** Brand mark rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
50
|
+
brand?: ReactNode;
|
|
51
|
+
/** Extra actions rendered at the right of the floating top bar. */
|
|
52
|
+
headerActions?: ReactNode;
|
|
53
|
+
/** Nodes rendered at the left of the floating top bar (after the menu button). */
|
|
54
|
+
headerStart?: ReactNode;
|
|
55
|
+
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
56
|
+
defaultCollapsed?: boolean;
|
|
57
|
+
/** localStorage key for persisting the collapse state. Default set. */
|
|
58
|
+
persistKey?: string | null;
|
|
59
|
+
/** Pixel breakpoint below which the sidebar becomes a drawer. Default 768. */
|
|
60
|
+
mobileBreakpointPx?: number;
|
|
61
|
+
/** Caption shown in the sidebar footer when no user is signed in. */
|
|
62
|
+
sidebarEmptyCaption?: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Opinionated Timbal studio layout — floating sidebar with workforce picker,
|
|
66
|
+
* top bar with optional mode toggle / actions, and a `<TimbalChat />` filling
|
|
67
|
+
* the rest. Manages collapse state, mobile drawer, and workforce selection
|
|
68
|
+
* out of the box. For more control compose `StudioSidebar` + `TimbalChat`
|
|
69
|
+
* directly.
|
|
70
|
+
*/
|
|
71
|
+
declare const TimbalStudioShell: FC<TimbalStudioShellProps>;
|
|
72
|
+
|
|
73
|
+
interface StudioSidebarProps {
|
|
74
|
+
/**
|
|
75
|
+
* Workforces to display. When omitted, the sidebar fetches them via the
|
|
76
|
+
* shared `useWorkforces()` hook.
|
|
77
|
+
*/
|
|
78
|
+
workforces?: WorkforceItem[];
|
|
79
|
+
selectedId?: string;
|
|
80
|
+
onSelect?: (id: string) => void;
|
|
81
|
+
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
82
|
+
defaultCollapsed?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* localStorage key for persisting the collapse state. Pass `null` to
|
|
85
|
+
* disable persistence. Default: `"timbal-studio-sidebar-collapsed"`.
|
|
86
|
+
*/
|
|
87
|
+
persistKey?: string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Pixel breakpoint below which the sidebar becomes a drawer.
|
|
90
|
+
* Default: 768.
|
|
91
|
+
*/
|
|
92
|
+
mobileBreakpointPx?: number;
|
|
93
|
+
/** Brand element rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
94
|
+
brand?: ReactNode;
|
|
95
|
+
/** Caption shown in the footer when no user is signed in. */
|
|
96
|
+
emptyCaption?: string | null;
|
|
97
|
+
/** External control over the mobile drawer (used by `TimbalStudioShell`). */
|
|
98
|
+
mobileOpen?: boolean;
|
|
99
|
+
onMobileOpenChange?: (open: boolean) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Notified with the sidebar inset width (px) whenever collapse state changes.
|
|
102
|
+
* Use to inset a sibling main column. `AppShell` wires this automatically.
|
|
103
|
+
*/
|
|
104
|
+
onInsetChange?: (insetPx: number) => void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Floating, collapsible workforce sidebar. Manages its own collapse state
|
|
108
|
+
* (persisted to localStorage by default) and mobile drawer behaviour. For
|
|
109
|
+
* a fully composed shell with the chat already wired use
|
|
110
|
+
* `TimbalStudioShell`.
|
|
111
|
+
*/
|
|
112
|
+
declare const StudioSidebar: FC<StudioSidebarProps>;
|
|
113
|
+
|
|
114
|
+
interface TimbalMarkProps {
|
|
115
|
+
className?: string;
|
|
116
|
+
/** Square size in CSS pixels (matches `--studio-chrome-pill-height` at 40). */
|
|
117
|
+
size?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Override the symbol shown inside the shader. Defaults to the embedded
|
|
120
|
+
* Timbal mark — pass any image URL or data URI to brand the chat with
|
|
121
|
+
* your own logo while keeping the liquid-metal motion.
|
|
122
|
+
*/
|
|
123
|
+
src?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Timbal mark rendered with the Paper Design LiquidMetal shader.
|
|
127
|
+
*
|
|
128
|
+
* The Timbal symbol is embedded as a data URI so the library works without
|
|
129
|
+
* the consumer having to host the asset. Pass `src` to use a custom logo.
|
|
130
|
+
*/
|
|
131
|
+
declare function TimbalMark({ className, size, src, }: TimbalMarkProps): react_jsx_runtime.JSX.Element;
|
|
132
|
+
|
|
133
|
+
type ModeToggleTheme = "light" | "dark" | "system";
|
|
134
|
+
interface ModeToggleProps {
|
|
135
|
+
/**
|
|
136
|
+
* Current theme. When omitted, the toggle reads from / writes to the
|
|
137
|
+
* `.dark` class on `<html>` directly — useful for apps that don't have
|
|
138
|
+
* a theme manager yet.
|
|
139
|
+
*/
|
|
140
|
+
theme?: ModeToggleTheme | string;
|
|
141
|
+
/** Called when the user clicks the toggle. */
|
|
142
|
+
setTheme?: (theme: ModeToggleTheme) => void;
|
|
143
|
+
className?: string;
|
|
144
|
+
/** ARIA label / tooltip. Default: "Toggle theme". */
|
|
145
|
+
label?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Sun/moon theme toggle styled to sit in the studio top bar.
|
|
149
|
+
*
|
|
150
|
+
* Two integration modes:
|
|
151
|
+
*
|
|
152
|
+
* 1. Pass `theme` + `setTheme` (e.g. from `next-themes`'s `useTheme`).
|
|
153
|
+
* The component is then fully controlled.
|
|
154
|
+
* 2. Omit both. The toggle reads the current state from `.dark` on
|
|
155
|
+
* `<html>` and flips it on click. Good enough for prototypes and
|
|
156
|
+
* cases where there is no theme manager.
|
|
157
|
+
*/
|
|
158
|
+
declare const ModeToggle: FC<ModeToggleProps>;
|
|
159
|
+
|
|
160
|
+
/** Studio navigation mode — mirrors timbal-platform `STUDIO_NAV_MODE`. */
|
|
161
|
+
declare const STUDIO_NAV_MODE: {
|
|
162
|
+
readonly BUILD: "build";
|
|
163
|
+
readonly OPERATE: "operate";
|
|
164
|
+
};
|
|
165
|
+
type StudioNavMode = (typeof STUDIO_NAV_MODE)[keyof typeof STUDIO_NAV_MODE];
|
|
166
|
+
interface StudioModeSwitchProps {
|
|
167
|
+
value: StudioNavMode;
|
|
168
|
+
onChange: (mode: StudioNavMode) => void;
|
|
169
|
+
className?: string;
|
|
170
|
+
buildLabel?: string;
|
|
171
|
+
manageLabel?: string;
|
|
172
|
+
"aria-label"?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Build / Manage pill switch — same control as timbal-platform `StudioModeSwitch`.
|
|
176
|
+
*/
|
|
177
|
+
declare const StudioModeSwitch: FC<StudioModeSwitchProps>;
|
|
178
|
+
|
|
179
|
+
interface StudioWelcomeProps extends ThreadWelcomeProps {
|
|
180
|
+
/** Override the brand mark rendered above the heading. */
|
|
181
|
+
icon?: ReactNode;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Welcome screen with the staggered Timbal mark + heading + subheading.
|
|
185
|
+
* Drop in as the `components.Welcome` slot of `<Thread />` /
|
|
186
|
+
* `<TimbalChat />` to replace the default sparkle illustration.
|
|
187
|
+
*/
|
|
188
|
+
declare const StudioWelcome: FC<StudioWelcomeProps>;
|
|
189
|
+
|
|
190
|
+
export { ModeToggle as M, STUDIO_NAV_MODE as S, TimbalChatShell as T, type ModeToggleProps as a, type ModeToggleTheme as b, StudioModeSwitch as c, type StudioModeSwitchProps as d, type StudioNavMode as e, StudioSidebar as f, type StudioSidebarProps as g, StudioWelcome as h, type StudioWelcomeProps as i, type TimbalChatShellProps as j, TimbalMark as k, type TimbalMarkProps as l, TimbalStudioShell as m, type TimbalStudioShellProps as n };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { b as TimbalChatProps, u as ThreadWelcomeProps } from './chat-CWtQWDtJ.js';
|
|
3
|
+
import { WorkforceItem } from '@timbal-ai/timbal-sdk';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
interface TimbalChatShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
7
|
+
/**
|
|
8
|
+
* Pre-selected workforce id. When omitted, the shell fetches the workforce
|
|
9
|
+
* list from `{baseUrl}/workforce` and picks the first agent automatically.
|
|
10
|
+
*/
|
|
11
|
+
workforceId?: string;
|
|
12
|
+
/** Branding rendered at the start of the header (logo, etc). */
|
|
13
|
+
brand?: ReactNode;
|
|
14
|
+
/** Extra content rendered at the end of the header (theme toggle, logout). */
|
|
15
|
+
headerActions?: ReactNode;
|
|
16
|
+
/** Hide the built-in workforce selector. Default: false. */
|
|
17
|
+
hideWorkforceSelector?: boolean;
|
|
18
|
+
/** Class for the outer flex container. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Class for the header bar. */
|
|
21
|
+
headerClassName?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Drop-in shell that wraps `TimbalChat` with the Studio playground chrome:
|
|
25
|
+
* floating topbar with brand + workforce selector + actions, soft gradient
|
|
26
|
+
* background, and the chat thread filling the remaining vertical space.
|
|
27
|
+
*
|
|
28
|
+
* Falls back to picking the first available workforce when `workforceId`
|
|
29
|
+
* isn't supplied.
|
|
30
|
+
*/
|
|
31
|
+
declare const TimbalChatShell: FC<TimbalChatShellProps>;
|
|
32
|
+
|
|
33
|
+
interface TimbalStudioShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
34
|
+
/**
|
|
35
|
+
* Pin the chat to a specific workforce. When omitted, the shell fetches
|
|
36
|
+
* the workforce list via `useWorkforces()` and lets the sidebar drive
|
|
37
|
+
* selection.
|
|
38
|
+
*/
|
|
39
|
+
workforceId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Pre-loaded workforce list. When omitted, the shell fetches it.
|
|
42
|
+
* Useful for stories / SSR / preview environments.
|
|
43
|
+
*/
|
|
44
|
+
workforces?: WorkforceItem[];
|
|
45
|
+
/** Custom fetch for the workforce list (mock fetch in preview mode). */
|
|
46
|
+
workforcesFetch?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
47
|
+
/** Base URL for the workforce list. Default: `/api`. */
|
|
48
|
+
workforcesBaseUrl?: string;
|
|
49
|
+
/** Brand mark rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
50
|
+
brand?: ReactNode;
|
|
51
|
+
/** Extra actions rendered at the right of the floating top bar. */
|
|
52
|
+
headerActions?: ReactNode;
|
|
53
|
+
/** Nodes rendered at the left of the floating top bar (after the menu button). */
|
|
54
|
+
headerStart?: ReactNode;
|
|
55
|
+
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
56
|
+
defaultCollapsed?: boolean;
|
|
57
|
+
/** localStorage key for persisting the collapse state. Default set. */
|
|
58
|
+
persistKey?: string | null;
|
|
59
|
+
/** Pixel breakpoint below which the sidebar becomes a drawer. Default 768. */
|
|
60
|
+
mobileBreakpointPx?: number;
|
|
61
|
+
/** Caption shown in the sidebar footer when no user is signed in. */
|
|
62
|
+
sidebarEmptyCaption?: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Opinionated Timbal studio layout — floating sidebar with workforce picker,
|
|
66
|
+
* top bar with optional mode toggle / actions, and a `<TimbalChat />` filling
|
|
67
|
+
* the rest. Manages collapse state, mobile drawer, and workforce selection
|
|
68
|
+
* out of the box. For more control compose `StudioSidebar` + `TimbalChat`
|
|
69
|
+
* directly.
|
|
70
|
+
*/
|
|
71
|
+
declare const TimbalStudioShell: FC<TimbalStudioShellProps>;
|
|
72
|
+
|
|
73
|
+
interface StudioSidebarProps {
|
|
74
|
+
/**
|
|
75
|
+
* Workforces to display. When omitted, the sidebar fetches them via the
|
|
76
|
+
* shared `useWorkforces()` hook.
|
|
77
|
+
*/
|
|
78
|
+
workforces?: WorkforceItem[];
|
|
79
|
+
selectedId?: string;
|
|
80
|
+
onSelect?: (id: string) => void;
|
|
81
|
+
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
82
|
+
defaultCollapsed?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* localStorage key for persisting the collapse state. Pass `null` to
|
|
85
|
+
* disable persistence. Default: `"timbal-studio-sidebar-collapsed"`.
|
|
86
|
+
*/
|
|
87
|
+
persistKey?: string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Pixel breakpoint below which the sidebar becomes a drawer.
|
|
90
|
+
* Default: 768.
|
|
91
|
+
*/
|
|
92
|
+
mobileBreakpointPx?: number;
|
|
93
|
+
/** Brand element rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
94
|
+
brand?: ReactNode;
|
|
95
|
+
/** Caption shown in the footer when no user is signed in. */
|
|
96
|
+
emptyCaption?: string | null;
|
|
97
|
+
/** External control over the mobile drawer (used by `TimbalStudioShell`). */
|
|
98
|
+
mobileOpen?: boolean;
|
|
99
|
+
onMobileOpenChange?: (open: boolean) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Notified with the sidebar inset width (px) whenever collapse state changes.
|
|
102
|
+
* Use to inset a sibling main column. `AppShell` wires this automatically.
|
|
103
|
+
*/
|
|
104
|
+
onInsetChange?: (insetPx: number) => void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Floating, collapsible workforce sidebar. Manages its own collapse state
|
|
108
|
+
* (persisted to localStorage by default) and mobile drawer behaviour. For
|
|
109
|
+
* a fully composed shell with the chat already wired use
|
|
110
|
+
* `TimbalStudioShell`.
|
|
111
|
+
*/
|
|
112
|
+
declare const StudioSidebar: FC<StudioSidebarProps>;
|
|
113
|
+
|
|
114
|
+
interface TimbalMarkProps {
|
|
115
|
+
className?: string;
|
|
116
|
+
/** Square size in CSS pixels (matches `--studio-chrome-pill-height` at 40). */
|
|
117
|
+
size?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Override the symbol shown inside the shader. Defaults to the embedded
|
|
120
|
+
* Timbal mark — pass any image URL or data URI to brand the chat with
|
|
121
|
+
* your own logo while keeping the liquid-metal motion.
|
|
122
|
+
*/
|
|
123
|
+
src?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Timbal mark rendered with the Paper Design LiquidMetal shader.
|
|
127
|
+
*
|
|
128
|
+
* The Timbal symbol is embedded as a data URI so the library works without
|
|
129
|
+
* the consumer having to host the asset. Pass `src` to use a custom logo.
|
|
130
|
+
*/
|
|
131
|
+
declare function TimbalMark({ className, size, src, }: TimbalMarkProps): react_jsx_runtime.JSX.Element;
|
|
132
|
+
|
|
133
|
+
type ModeToggleTheme = "light" | "dark" | "system";
|
|
134
|
+
interface ModeToggleProps {
|
|
135
|
+
/**
|
|
136
|
+
* Current theme. When omitted, the toggle reads from / writes to the
|
|
137
|
+
* `.dark` class on `<html>` directly — useful for apps that don't have
|
|
138
|
+
* a theme manager yet.
|
|
139
|
+
*/
|
|
140
|
+
theme?: ModeToggleTheme | string;
|
|
141
|
+
/** Called when the user clicks the toggle. */
|
|
142
|
+
setTheme?: (theme: ModeToggleTheme) => void;
|
|
143
|
+
className?: string;
|
|
144
|
+
/** ARIA label / tooltip. Default: "Toggle theme". */
|
|
145
|
+
label?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Sun/moon theme toggle styled to sit in the studio top bar.
|
|
149
|
+
*
|
|
150
|
+
* Two integration modes:
|
|
151
|
+
*
|
|
152
|
+
* 1. Pass `theme` + `setTheme` (e.g. from `next-themes`'s `useTheme`).
|
|
153
|
+
* The component is then fully controlled.
|
|
154
|
+
* 2. Omit both. The toggle reads the current state from `.dark` on
|
|
155
|
+
* `<html>` and flips it on click. Good enough for prototypes and
|
|
156
|
+
* cases where there is no theme manager.
|
|
157
|
+
*/
|
|
158
|
+
declare const ModeToggle: FC<ModeToggleProps>;
|
|
159
|
+
|
|
160
|
+
/** Studio navigation mode — mirrors timbal-platform `STUDIO_NAV_MODE`. */
|
|
161
|
+
declare const STUDIO_NAV_MODE: {
|
|
162
|
+
readonly BUILD: "build";
|
|
163
|
+
readonly OPERATE: "operate";
|
|
164
|
+
};
|
|
165
|
+
type StudioNavMode = (typeof STUDIO_NAV_MODE)[keyof typeof STUDIO_NAV_MODE];
|
|
166
|
+
interface StudioModeSwitchProps {
|
|
167
|
+
value: StudioNavMode;
|
|
168
|
+
onChange: (mode: StudioNavMode) => void;
|
|
169
|
+
className?: string;
|
|
170
|
+
buildLabel?: string;
|
|
171
|
+
manageLabel?: string;
|
|
172
|
+
"aria-label"?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Build / Manage pill switch — same control as timbal-platform `StudioModeSwitch`.
|
|
176
|
+
*/
|
|
177
|
+
declare const StudioModeSwitch: FC<StudioModeSwitchProps>;
|
|
178
|
+
|
|
179
|
+
interface StudioWelcomeProps extends ThreadWelcomeProps {
|
|
180
|
+
/** Override the brand mark rendered above the heading. */
|
|
181
|
+
icon?: ReactNode;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Welcome screen with the staggered Timbal mark + heading + subheading.
|
|
185
|
+
* Drop in as the `components.Welcome` slot of `<Thread />` /
|
|
186
|
+
* `<TimbalChat />` to replace the default sparkle illustration.
|
|
187
|
+
*/
|
|
188
|
+
declare const StudioWelcome: FC<StudioWelcomeProps>;
|
|
189
|
+
|
|
190
|
+
export { ModeToggle as M, STUDIO_NAV_MODE as S, TimbalChatShell as T, type ModeToggleProps as a, type ModeToggleTheme as b, StudioModeSwitch as c, type StudioModeSwitchProps as d, type StudioNavMode as e, StudioSidebar as f, type StudioSidebarProps as g, StudioWelcome as h, type StudioWelcomeProps as i, type TimbalChatShellProps as j, TimbalMark as k, type TimbalMarkProps as l, TimbalStudioShell as m, type TimbalStudioShellProps as n };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timbal-ai/timbal-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "React components and runtime for building Timbal chat
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "React components and runtime for building Timbal chat and studio apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -12,10 +12,36 @@
|
|
|
12
12
|
"import": "./dist/index.esm.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
15
|
+
"./chat": {
|
|
16
|
+
"types": "./dist/chat.d.ts",
|
|
17
|
+
"import": "./dist/chat.esm.js",
|
|
18
|
+
"require": "./dist/chat.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./studio": {
|
|
21
|
+
"types": "./dist/studio.d.ts",
|
|
22
|
+
"import": "./dist/studio.esm.js",
|
|
23
|
+
"require": "./dist/studio.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./ui": {
|
|
26
|
+
"types": "./dist/ui.d.ts",
|
|
27
|
+
"import": "./dist/ui.esm.js",
|
|
28
|
+
"require": "./dist/ui.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./app": {
|
|
31
|
+
"types": "./dist/app.d.ts",
|
|
32
|
+
"import": "./dist/app.esm.js",
|
|
33
|
+
"require": "./dist/app.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./styles.css": "./dist/styles.css",
|
|
36
|
+
"./vite": {
|
|
37
|
+
"types": "./vite/local-dev.d.ts",
|
|
38
|
+
"import": "./vite/local-dev.mjs"
|
|
39
|
+
}
|
|
16
40
|
},
|
|
17
41
|
"files": [
|
|
18
42
|
"dist",
|
|
43
|
+
"vite",
|
|
44
|
+
"scripts/dev-linked.mjs",
|
|
19
45
|
"README.md",
|
|
20
46
|
"LICENSE"
|
|
21
47
|
],
|
|
@@ -26,6 +52,11 @@
|
|
|
26
52
|
"test": "bun test",
|
|
27
53
|
"test:watch": "bun test --watch",
|
|
28
54
|
"typecheck": "tsc --noEmit",
|
|
55
|
+
"check:boundaries": "depcruise src --config .dependency-cruiser.cjs",
|
|
56
|
+
"check:bundle": "bun run build && node scripts/check-bundle-sizes.mjs",
|
|
57
|
+
"example:install": "npm install --prefix examples/mock-ui && npm install --prefix examples/app-kit",
|
|
58
|
+
"example:mock": "node scripts/dev-linked.mjs examples/mock-ui vite",
|
|
59
|
+
"example:app": "node scripts/dev-linked.mjs examples/app-kit vite",
|
|
29
60
|
"prepublishOnly": "bun run build && bun run typecheck"
|
|
30
61
|
},
|
|
31
62
|
"peerDependencies": {
|
|
@@ -65,6 +96,7 @@
|
|
|
65
96
|
"happy-dom": "^20.8.9",
|
|
66
97
|
"react": "^19.2.0",
|
|
67
98
|
"react-dom": "^19.2.0",
|
|
99
|
+
"dependency-cruiser": "^16.10.4",
|
|
68
100
|
"tsup": "^8.5.0",
|
|
69
101
|
"typescript": "~5.8.3"
|
|
70
102
|
},
|