@timbal-ai/timbal-react 0.4.0 → 0.5.1

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.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { ReactNode, FC, ComponentType, Dispatch, CSSProperties, ElementType } from 'react';
3
+ import React__default, { ReactNode, FC, ComponentType, Dispatch, ElementType } from 'react';
4
4
  import { AttachmentAdapter, ToolCallMessagePartComponent } from '@assistant-ui/react';
5
- export { ActionBarMorePrimitive, ActionBarPrimitive, AssistantRuntimeProvider, AttachmentAdapter, AuiIf, ComposerPrimitive, ErrorPrimitive, MessagePartPrimitive, MessagePrimitive, ThreadPrimitive, ToolCallMessagePartComponent, useAuiState, useComposerRuntime, useMessageRuntime, useThread, useThreadRuntime } from '@assistant-ui/react';
5
+ export { ActionBarPrimitive, AssistantRuntimeProvider, AttachmentAdapter, AuiIf, ComposerPrimitive, MessagePrimitive, ThreadPrimitive, useComposerRuntime, useMessageRuntime, useThread, useThreadRuntime } from '@assistant-ui/react';
6
6
  import { WorkforceItem, Session } from '@timbal-ai/timbal-sdk';
7
7
  export { parseSSELine } from '@timbal-ai/timbal-sdk';
8
- import { SyntaxHighlighterProps } from '@assistant-ui/react-markdown';
9
8
  import * as class_variance_authority_types from 'class-variance-authority/types';
10
9
  import { VariantProps } from 'class-variance-authority';
11
10
  import { Tooltip as Tooltip$1, Avatar as Avatar$1, Dialog as Dialog$1 } from 'radix-ui';
@@ -648,6 +647,73 @@ interface TimbalChatProps extends Omit<TimbalRuntimeProviderProps, "children">,
648
647
  }
649
648
  declare function TimbalChat({ workforceId, baseUrl, fetch, attachments, attachmentsUploadUrl, attachmentsAccept, debug, ...threadProps }: TimbalChatProps): react_jsx_runtime.JSX.Element;
650
649
 
650
+ interface TimbalChatShellProps extends Omit<TimbalChatProps, "workforceId"> {
651
+ /**
652
+ * Pre-selected workforce id. When omitted, the shell fetches the workforce
653
+ * list from `{baseUrl}/workforce` and picks the first agent automatically.
654
+ */
655
+ workforceId?: string;
656
+ /** Branding rendered at the start of the header (logo, etc). */
657
+ brand?: ReactNode;
658
+ /** Extra content rendered at the end of the header (theme toggle, logout). */
659
+ headerActions?: ReactNode;
660
+ /** Hide the built-in workforce selector. Default: false. */
661
+ hideWorkforceSelector?: boolean;
662
+ /** Class for the outer flex container. */
663
+ className?: string;
664
+ /** Class for the header bar. */
665
+ headerClassName?: string;
666
+ }
667
+ /**
668
+ * Drop-in shell that wraps `TimbalChat` with the Studio playground chrome:
669
+ * floating topbar with brand + workforce selector + actions, soft gradient
670
+ * background, and the chat thread filling the remaining vertical space.
671
+ *
672
+ * Falls back to picking the first available workforce when `workforceId`
673
+ * isn't supplied.
674
+ */
675
+ declare const TimbalChatShell: FC<TimbalChatShellProps>;
676
+
677
+ interface TimbalStudioShellProps extends Omit<TimbalChatProps, "workforceId"> {
678
+ /**
679
+ * Pin the chat to a specific workforce. When omitted, the shell fetches
680
+ * the workforce list via `useWorkforces()` and lets the sidebar drive
681
+ * selection.
682
+ */
683
+ workforceId?: string;
684
+ /**
685
+ * Pre-loaded workforce list. When omitted, the shell fetches it.
686
+ * Useful for stories / SSR / preview environments.
687
+ */
688
+ workforces?: WorkforceItem[];
689
+ /** Custom fetch for the workforce list (mock fetch in preview mode). */
690
+ workforcesFetch?: (url: string, options?: RequestInit) => Promise<Response>;
691
+ /** Base URL for the workforce list. Default: `/api`. */
692
+ workforcesBaseUrl?: string;
693
+ /** Brand mark rendered in the sidebar header. Default: `<TimbalMark />`. */
694
+ brand?: ReactNode;
695
+ /** Extra actions rendered at the right of the floating top bar. */
696
+ headerActions?: ReactNode;
697
+ /** Nodes rendered at the left of the floating top bar (after the menu button). */
698
+ headerStart?: ReactNode;
699
+ /** Initial collapse state when no persisted value exists. Default: false. */
700
+ defaultCollapsed?: boolean;
701
+ /** localStorage key for persisting the collapse state. Default set. */
702
+ persistKey?: string | null;
703
+ /** Pixel breakpoint below which the sidebar becomes a drawer. Default 768. */
704
+ mobileBreakpointPx?: number;
705
+ /** Caption shown in the sidebar footer when no user is signed in. */
706
+ sidebarEmptyCaption?: string | null;
707
+ }
708
+ /**
709
+ * Opinionated Timbal studio layout — floating sidebar with workforce picker,
710
+ * top bar with optional mode toggle / actions, and a `<TimbalChat />` filling
711
+ * the rest. Manages collapse state, mobile drawer, and workforce selection
712
+ * out of the box. For more control compose `StudioSidebar` + `TimbalChat`
713
+ * directly.
714
+ */
715
+ declare const TimbalStudioShell: FC<TimbalStudioShellProps>;
716
+
651
717
  declare const MarkdownText: React.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
652
718
 
653
719
  interface ToolStatus {
@@ -660,53 +726,154 @@ declare function useToolRunning(props: {
660
726
  }): boolean;
661
727
  declare const ToolFallback: ToolCallMessagePartComponent;
662
728
 
729
+ interface WorkforceSelectorProps {
730
+ /** List of workforces to choose from. */
731
+ workforces: WorkforceItem[];
732
+ /** Currently selected workforce id. */
733
+ value: string;
734
+ /** Called when the user picks a different workforce. */
735
+ onChange: (id: string) => void;
736
+ /** Hide the selector when there's only one option. Default: true. */
737
+ hideWhenSingle?: boolean;
738
+ className?: string;
739
+ placeholder?: string;
740
+ }
663
741
  /**
664
- * Tool-row presence motion shared across the chat surface.
742
+ * Minimal headless workforce picker. Wraps a styled native `<select>` so
743
+ * the SDK doesn't need to depend on `@radix-ui/react-select`, while still
744
+ * matching the Studio chrome (gradient pill, soft border, chevron).
665
745
  *
666
- * Mirrors `timbal-platform` `StudioToolMotion.js` a soft "luxury" ease in
667
- * with optional blur, fast exit, and a grid-row collapsible body. Exit
668
- * durations stay short so the layout doesn't feel sticky when tools resolve
669
- * quickly.
746
+ * Apps that want a richer UI (search, descriptions, agent icons) can build
747
+ * their own using `useWorkforces()`.
670
748
  */
671
- declare const luxuryEase: readonly [0.16, 1, 0.3, 1];
672
- declare function toolPresenceTransition(reduced: boolean): {
673
- enter: {
674
- duration: number;
675
- ease: readonly [0.16, 1, 0.3, 1];
676
- };
677
- exit: {
678
- duration: number;
679
- ease: readonly [0.4, 0, 1, 1];
680
- };
681
- };
682
- type ToolMotionVariant = "executing" | "settled";
683
- interface ToolMotionProps {
684
- children: ReactNode;
685
- className?: string;
686
- /** Stable key for AnimatePresence swaps (e.g. `running` → `complete`). */
687
- motionKey: string;
749
+ declare const WorkforceSelector: FC<WorkforceSelectorProps>;
750
+
751
+ interface StudioSidebarProps {
752
+ /**
753
+ * Workforces to display. When omitted, the sidebar fetches them via the
754
+ * shared `useWorkforces()` hook.
755
+ */
756
+ workforces?: WorkforceItem[];
757
+ selectedId?: string;
758
+ onSelect?: (id: string) => void;
759
+ /** Initial collapse state when no persisted value exists. Default: false. */
760
+ defaultCollapsed?: boolean;
761
+ /**
762
+ * localStorage key for persisting the collapse state. Pass `null` to
763
+ * disable persistence. Default: `"timbal-studio-sidebar-collapsed"`.
764
+ */
765
+ persistKey?: string | null;
766
+ /**
767
+ * Pixel breakpoint below which the sidebar becomes a drawer.
768
+ * Default: 768.
769
+ */
770
+ mobileBreakpointPx?: number;
771
+ /** Brand element rendered in the sidebar header. Default: `<TimbalMark />`. */
772
+ brand?: ReactNode;
773
+ /** Caption shown in the footer when no user is signed in. */
774
+ emptyCaption?: string | null;
775
+ /** External control over the mobile drawer (used by `TimbalStudioShell`). */
776
+ mobileOpen?: boolean;
777
+ onMobileOpenChange?: (open: boolean) => void;
688
778
  }
689
- /** Single-shot rise-from-below for tool / artifact rows. */
690
- declare function ToolMotion({ children, className, motionKey }: ToolMotionProps): react_jsx_runtime.JSX.Element;
691
- interface ToolPresenceProps {
692
- presenceKey: string;
693
- children: ReactNode;
779
+ /**
780
+ * Floating, collapsible workforce sidebar. Manages its own collapse state
781
+ * (persisted to localStorage by default) and mobile drawer behaviour. For
782
+ * a fully composed shell with the chat already wired use
783
+ * `TimbalStudioShell`.
784
+ */
785
+ declare const StudioSidebar: FC<StudioSidebarProps>;
786
+
787
+ interface TimbalMarkProps {
694
788
  className?: string;
695
- /** Executing rows skip blur so the shimmer stays readable. */
696
- variant?: ToolMotionVariant;
789
+ /** Square size in CSS pixels (matches `--studio-chrome-pill-height` at 40). */
790
+ size?: number;
791
+ /**
792
+ * Override the symbol shown inside the shader. Defaults to the embedded
793
+ * Timbal mark — pass any image URL or data URI to brand the chat with
794
+ * your own logo while keeping the liquid-metal motion.
795
+ */
796
+ src?: string;
697
797
  }
698
- /** Wraps running ↔ complete (or other) tool states with a short crossfade. */
699
- declare function ToolPresence({ presenceKey, children, className, variant, }: ToolPresenceProps): react_jsx_runtime.JSX.Element;
700
- interface ToolBodyPresenceProps {
701
- open: boolean;
702
- children: ReactNode;
798
+ /**
799
+ * Timbal mark rendered with the Paper Design LiquidMetal shader.
800
+ *
801
+ * The Timbal symbol is embedded as a data URI so the library works without
802
+ * the consumer having to host the asset. Pass `src` to use a custom logo.
803
+ */
804
+ declare function TimbalMark({ className, size, src, }: TimbalMarkProps): react_jsx_runtime.JSX.Element;
805
+
806
+ type ModeToggleTheme = "light" | "dark" | "system";
807
+ interface ModeToggleProps {
808
+ /**
809
+ * Current theme. When omitted, the toggle reads from / writes to the
810
+ * `.dark` class on `<html>` directly — useful for apps that don't have
811
+ * a theme manager yet.
812
+ */
813
+ theme?: ModeToggleTheme | string;
814
+ /** Called when the user clicks the toggle. */
815
+ setTheme?: (theme: ModeToggleTheme) => void;
703
816
  className?: string;
817
+ /** ARIA label / tooltip. Default: "Toggle theme". */
818
+ label?: string;
819
+ }
820
+ /**
821
+ * Sun/moon theme toggle styled to sit in the studio top bar.
822
+ *
823
+ * Two integration modes:
824
+ *
825
+ * 1. Pass `theme` + `setTheme` (e.g. from `next-themes`'s `useTheme`).
826
+ * The component is then fully controlled.
827
+ * 2. Omit both. The toggle reads the current state from `.dark` on
828
+ * `<html>` and flips it on click. Good enough for prototypes and
829
+ * cases where there is no theme manager.
830
+ */
831
+ declare const ModeToggle: FC<ModeToggleProps>;
832
+
833
+ interface StudioWelcomeProps extends ThreadWelcomeProps {
834
+ /** Override the brand mark rendered above the heading. */
835
+ icon?: ReactNode;
836
+ }
837
+ /**
838
+ * Welcome screen with the staggered Timbal mark + heading + subheading.
839
+ * Drop in as the `components.Welcome` slot of `<Thread />` /
840
+ * `<TimbalChat />` to replace the default sparkle illustration.
841
+ */
842
+ declare const StudioWelcome: FC<StudioWelcomeProps>;
843
+
844
+ type FetchFn = (url: string, options?: RequestInit) => Promise<Response>;
845
+ interface UseWorkforcesOptions {
846
+ /** Base URL for API calls. Default: `/api`. */
847
+ baseUrl?: string;
848
+ /** Custom fetch (defaults to `authFetch` for token-auth flows). */
849
+ fetch?: FetchFn;
850
+ /**
851
+ * Pick the initial selected workforce. By default we prefer the first
852
+ * `type === "agent"` entry, falling back to the first item. Pass a custom
853
+ * resolver to override (e.g. remember the user's last choice).
854
+ */
855
+ pickInitial?: (items: WorkforceItem[]) => WorkforceItem | undefined;
856
+ /** When false, the hook returns an empty list and skips the network fetch. */
857
+ enabled?: boolean;
858
+ }
859
+ interface UseWorkforcesResult {
860
+ workforces: WorkforceItem[];
861
+ /** Currently selected workforce identifier (id ?? uid ?? name). */
862
+ selectedId: string;
863
+ setSelectedId: (id: string) => void;
864
+ /** The full `WorkforceItem` for `selectedId`, if any. */
865
+ selected: WorkforceItem | undefined;
866
+ isLoading: boolean;
867
+ error: Error | null;
868
+ /** Re-fetch the list. Resets `error`. */
869
+ refresh: () => Promise<void>;
704
870
  }
705
871
  /**
706
- * Expanded tool trace CSS grid row collapse for smooth contract + opacity.
707
- * Avoids `AnimatePresence` exit lag when the body closes.
872
+ * Fetch the list of workforces exposed by the blueprint API and track a
873
+ * selection. Used to power `<WorkforceSelector />` but exported separately
874
+ * so apps can drive their own UI (e.g. a sidebar tree).
708
875
  */
709
- declare function ToolBodyPresence({ open, children, className, }: ToolBodyPresenceProps): react_jsx_runtime.JSX.Element;
876
+ declare function useWorkforces(options?: UseWorkforcesOptions): UseWorkforcesResult;
710
877
 
711
878
  /**
712
879
  * Copy-paste this into a workforce agent system prompt (or append it to your
@@ -854,152 +1021,6 @@ declare const TableArtifactView: FC<{
854
1021
  artifact: TableArtifact;
855
1022
  }>;
856
1023
 
857
- declare const UserMessageAttachments: FC;
858
- declare const ComposerAttachments: FC;
859
- declare const ComposerAddAttachment: FC;
860
-
861
- /**
862
- * Timbal V2 button design tokens.
863
- *
864
- * Mirrors the `timbal-platform` design language (`TimbalV2Button`) so chat
865
- * surfaces built with the SDK feel identical to the Timbal Studio. Each record
866
- * is keyed by variant or size and ships only Tailwind utility classes — no
867
- * runtime JS — so consumers can compose them with `cn(...)` and add their own
868
- * overrides without ejecting.
869
- */
870
- type TimbalV2Variant = "primary" | "secondary" | "ghost" | "informative" | "destructive" | "link";
871
- type TimbalV2Size = "xs" | "sm" | "md" | "lg";
872
- declare const TIMBAL_V2_SIZE_HEIGHT: Record<TimbalV2Size, string>;
873
- declare const TIMBAL_V2_SIZE_ICON: Record<TimbalV2Size, string>;
874
- declare const TIMBAL_V2_SIZE_LABEL_PX: Record<TimbalV2Size, string>;
875
- /**
876
- * Absolute gradient fill layer — scoped to the `group/tbv2` group so the
877
- * hover/active states can be triggered without wrapping each button in
878
- * dedicated state classes.
879
- */
880
- declare const TIMBAL_V2_FILL: Record<TimbalV2Variant, string>;
881
- declare const TIMBAL_V2_LABEL: Record<TimbalV2Variant, string>;
882
- declare const TIMBAL_V2_BORDER: Record<TimbalV2Variant, string>;
883
- declare const TIMBAL_V2_SHADOW: Record<TimbalV2Variant, string>;
884
- /** Static pill surface — sidebars, badges, anywhere a button shape is needed without interaction. */
885
- declare const TIMBAL_V2_PILL_SURFACE = "bg-gradient-to-b from-white to-neutral-50/70 border border-neutral-200/80 shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.05)] dark:from-white/[0.05] dark:to-white/[0.025] dark:border-white/[0.08] dark:shadow-[0_1px_3px_rgba(0,0,0,0.22)]";
886
- /** Interactive secondary chrome for native controls beside v2 buttons (selects, search inputs). */
887
- declare const TIMBAL_V2_SECONDARY_CHROME = "bg-gradient-to-b from-white to-neutral-50/70 border border-neutral-200/80 shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.05)] transition-[background-color,box-shadow,border-color] duration-200 ease-in-out hover:from-neutral-50/40 hover:to-neutral-100/60 active:from-neutral-100/65 active:to-neutral-200/65 dark:from-white/[0.05] dark:to-white/[0.025] dark:border-white/[0.08] dark:shadow-[0_1px_3px_rgba(0,0,0,0.22)] dark:hover:from-white/[0.07] dark:hover:to-white/[0.045] dark:active:from-white/[0.10] dark:active:to-white/[0.07]";
888
-
889
- interface TimbalV2ButtonProps extends React.ComponentProps<"button"> {
890
- variant?: TimbalV2Variant;
891
- size?: TimbalV2Size;
892
- isIconOnly?: boolean;
893
- isLoading?: boolean;
894
- fullWidth?: boolean;
895
- /** When true, renders children as the underlying element (Radix Slot pattern). */
896
- asChild?: boolean;
897
- }
898
- /**
899
- * Canonical Timbal pill button — layered absolute-fill span + relative label
900
- * row scoped to `group/tbv2`. Mirrors `timbal-platform` `TimbalV2Button` so
901
- * chat UIs built with the SDK feel identical to the Studio.
902
- */
903
- declare const TimbalV2Button: React.ForwardRefExoticComponent<Omit<TimbalV2ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
904
-
905
- interface TooltipIconButtonProps extends Omit<TimbalV2ButtonProps, "isIconOnly"> {
906
- /** Visible tooltip + accessible label. Always required. */
907
- tooltip: string;
908
- /** Tooltip placement. Default: "bottom". */
909
- side?: "top" | "bottom" | "left" | "right";
910
- }
911
- /**
912
- * Icon-only Timbal pill button with a tooltip. Used by every chat-surface
913
- * toolbar (composer send/cancel, message action bar, scroll-to-bottom).
914
- *
915
- * Defaults to a soft `secondary` variant so it sits cleanly inside composers,
916
- * message bubbles, and the action bar. Override via `variant`.
917
- */
918
- declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
919
-
920
- declare const ShikiSyntaxHighlighter: FC<SyntaxHighlighterProps>;
921
-
922
- type FetchFn = (url: string, options?: RequestInit) => Promise<Response>;
923
- interface UseWorkforcesOptions {
924
- /** Base URL for API calls. Default: `/api`. */
925
- baseUrl?: string;
926
- /** Custom fetch (defaults to `authFetch` for token-auth flows). */
927
- fetch?: FetchFn;
928
- /**
929
- * Pick the initial selected workforce. By default we prefer the first
930
- * `type === "agent"` entry, falling back to the first item. Pass a custom
931
- * resolver to override (e.g. remember the user's last choice).
932
- */
933
- pickInitial?: (items: WorkforceItem[]) => WorkforceItem | undefined;
934
- }
935
- interface UseWorkforcesResult {
936
- workforces: WorkforceItem[];
937
- /** Currently selected workforce identifier (id ?? uid ?? name). */
938
- selectedId: string;
939
- setSelectedId: (id: string) => void;
940
- /** The full `WorkforceItem` for `selectedId`, if any. */
941
- selected: WorkforceItem | undefined;
942
- isLoading: boolean;
943
- error: Error | null;
944
- /** Re-fetch the list. Resets `error`. */
945
- refresh: () => Promise<void>;
946
- }
947
- /**
948
- * Fetch the list of workforces exposed by the blueprint API and track a
949
- * selection. Used to power `<WorkforceSelector />` but exported separately
950
- * so apps can drive their own UI (e.g. a sidebar tree).
951
- */
952
- declare function useWorkforces(options?: UseWorkforcesOptions): UseWorkforcesResult;
953
-
954
- interface WorkforceSelectorProps {
955
- /** List of workforces to choose from. */
956
- workforces: WorkforceItem[];
957
- /** Currently selected workforce id. */
958
- value: string;
959
- /** Called when the user picks a different workforce. */
960
- onChange: (id: string) => void;
961
- /** Hide the selector when there's only one option. Default: true. */
962
- hideWhenSingle?: boolean;
963
- className?: string;
964
- placeholder?: string;
965
- }
966
- /**
967
- * Minimal headless workforce picker. Wraps a styled native `<select>` so
968
- * the SDK doesn't need to depend on `@radix-ui/react-select`, while still
969
- * matching the Studio chrome (gradient pill, soft border, chevron).
970
- *
971
- * Apps that want a richer UI (search, descriptions, agent icons) can build
972
- * their own using `useWorkforces()`.
973
- */
974
- declare const WorkforceSelector: FC<WorkforceSelectorProps>;
975
-
976
- interface TimbalChatShellProps extends Omit<TimbalChatProps, "workforceId"> {
977
- /**
978
- * Pre-selected workforce id. When omitted, the shell fetches the workforce
979
- * list from `{baseUrl}/workforce` and picks the first agent automatically.
980
- */
981
- workforceId?: string;
982
- /** Branding rendered at the start of the header (logo, etc). */
983
- brand?: ReactNode;
984
- /** Extra content rendered at the end of the header (theme toggle, logout). */
985
- headerActions?: ReactNode;
986
- /** Hide the built-in workforce selector. Default: false. */
987
- hideWorkforceSelector?: boolean;
988
- /** Class for the outer flex container. */
989
- className?: string;
990
- /** Class for the header bar. */
991
- headerClassName?: string;
992
- }
993
- /**
994
- * Drop-in shell that wraps `TimbalChat` with the Studio playground chrome:
995
- * floating topbar with brand + workforce selector + actions, soft gradient
996
- * background, and the chat thread filling the remaining vertical space.
997
- *
998
- * Falls back to picking the first available workforce when `workforceId`
999
- * isn't supplied.
1000
- */
1001
- declare const TimbalChatShell: FC<TimbalChatShellProps>;
1002
-
1003
1024
  interface SessionContextType {
1004
1025
  user: Session | null;
1005
1026
  loading: boolean;
@@ -1008,6 +1029,12 @@ interface SessionContextType {
1008
1029
  logout: () => void;
1009
1030
  }
1010
1031
  declare const useSession: () => SessionContextType;
1032
+ /**
1033
+ * Read the session without throwing when no `SessionProvider` is present.
1034
+ * Returns `null` when auth is not wired into the tree — useful for surfaces
1035
+ * (e.g. sidebar footers) that should gracefully render without auth.
1036
+ */
1037
+ declare const useOptionalSession: () => SessionContextType | null;
1011
1038
  interface SessionProviderProps {
1012
1039
  children: React__default.ReactNode;
1013
1040
  /** When false, session is always null and loading is false. Default: true */
@@ -1032,65 +1059,6 @@ declare const refreshAccessToken: () => Promise<boolean>;
1032
1059
  declare const authFetch: (url: string, options?: RequestInit) => Promise<Response>;
1033
1060
  declare const fetchCurrentUser: () => Promise<Session | null>;
1034
1061
 
1035
- /**
1036
- * Shared chrome class names + CSS variables for Timbal chat surfaces.
1037
- *
1038
- * These mirror `timbal-platform` `studioChrome.js` so the SDK ships the same
1039
- * design language out of the box. Class consts are pure strings (no runtime
1040
- * cost) and can be composed with `cn(...)` from `../utils`.
1041
- */
1042
-
1043
- declare const STUDIO_TOPBAR_GAP = "0.5rem";
1044
- declare const STUDIO_TOPBAR_HEIGHT = "3rem";
1045
- declare const STUDIO_PILL_HEIGHT = "2.5rem";
1046
- declare const STUDIO_SIDEBAR_GAP = "0.5rem";
1047
- declare const STUDIO_SIDEBAR_WIDTH = "3rem";
1048
- declare const STUDIO_INSET_LEFT = "calc(0.5rem + 3rem)";
1049
- /**
1050
- * Style object to spread on the chat shell root. Exposes the CSS variables
1051
- * referenced by topbar/sidebar helper classes so layouts stay self-contained.
1052
- */
1053
- declare const studioChromeShellStyle: CSSProperties;
1054
- declare const studioTopbarPillHeightClass = "h-[var(--studio-chrome-pill-height)] min-h-[var(--studio-chrome-pill-height)]";
1055
- declare const studioTopbarIconPillClass = "shrink-0 flex-none size-[var(--studio-chrome-pill-height)] min-h-[var(--studio-chrome-pill-height)] min-w-[var(--studio-chrome-pill-height)]";
1056
- /** Soft playground gradient behind the message column. */
1057
- declare const studioPlaygroundGradientClass = "bg-gradient-to-b from-neutral-200/60 via-neutral-100/30 to-background dark:from-zinc-800 dark:via-zinc-900 dark:to-zinc-950";
1058
- /** Composer outer shell — rounded surface with focus-within affordances. */
1059
- declare const studioComposeInputShellClass = "flex w-full flex-col rounded-2xl border border-neutral-200/60 bg-background shadow-lg shadow-black/5 outline-none transition-[box-shadow,border-color] focus-within:border-neutral-400/80 focus-within:ring-2 focus-within:ring-foreground/5 focus-within:shadow-xl focus-within:shadow-black/10 dark:border-white/12 dark:bg-zinc-900 dark:shadow-black/20 dark:focus-within:border-white/22 dark:focus-within:ring-0";
1060
- /** Resting pill surface — sidebars, badges. */
1061
- declare const studioPillSurfaceClass = "bg-gradient-to-b from-white to-neutral-50/70 border border-neutral-200/80 shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.05)] dark:from-white/[0.05] dark:to-white/[0.025] dark:border-white/[0.08] dark:shadow-[0_1px_3px_rgba(0,0,0,0.22)]";
1062
- /** Interactive secondary chrome — select triggers, search shells. */
1063
- declare const studioSecondaryChromeClass = "bg-gradient-to-b from-white to-neutral-50/70 border border-neutral-200/80 shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.05)] transition-[background-color,box-shadow,border-color] duration-200 ease-in-out hover:from-neutral-50/40 hover:to-neutral-100/60 active:from-neutral-100/65 active:to-neutral-200/65 dark:from-white/[0.05] dark:to-white/[0.025] dark:border-white/[0.08] dark:shadow-[0_1px_3px_rgba(0,0,0,0.22)] dark:hover:from-white/[0.07] dark:hover:to-white/[0.045] dark:active:from-white/[0.10] dark:active:to-white/[0.07]";
1064
- /**
1065
- * Solid integration-card surface — used for in-thread tool / artifact cards
1066
- * so they read on the playground gradient.
1067
- */
1068
- declare const studioIntegrationSurfaceSolid = "bg-white bg-gradient-to-b from-white to-neutral-50/70 shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.05)] dark:bg-zinc-900 dark:from-white/[0.05] dark:to-white/[0.025] dark:shadow-[0_1px_3px_rgba(0,0,0,0.22)]";
1069
- declare const studioIntegrationBorder = "border border-neutral-200/80 dark:border-white/[0.08]";
1070
- declare const studioIntegrationCardClass: string;
1071
- declare const studioIntegrationIconTileClass: string;
1072
- /**
1073
- * Full-width selectable row — used by `Suggestions` and any settings-style
1074
- * list cards. Mirrors `roleListRowSurfaceClass` in timbal-platform.
1075
- */
1076
- declare const studioListRowButtonClass: string;
1077
- /** Compose tool drawer / trace payload well — opaque so JSON reads on the gradient. */
1078
- declare const studioComposerIoWellClass: string;
1079
- /** Collapsible tool-call card shell. */
1080
- declare const studioToolCardShellClass: string;
1081
- declare const studioTimelineRowButtonClass = "group flex w-full min-w-0 cursor-pointer items-center justify-start rounded-md border-0 bg-transparent py-1 text-left shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/15 focus-visible:ring-offset-2";
1082
- declare const studioTimelineTextClass = "text-xs font-normal leading-snug";
1083
- declare const studioTimelineActionClass: string;
1084
- /** Shimmer action word — text-transparent inherits its colour from the bg clip. */
1085
- declare const studioTimelineShimmerActionClass: string;
1086
- declare const studioTimelineDetailClass: string;
1087
- declare function studioTimelineChevronClass(expanded: boolean): string;
1088
- /** Padding for the expanded payload under a timeline toggle. */
1089
- declare const studioTimelineBodyPadClass = "flex flex-col gap-2 pt-0.5 pb-0.5";
1090
- declare const studioArtifactShellClass: string;
1091
- declare const studioQuestionOptionClass = "flex w-full items-center gap-2 rounded-lg border border-transparent px-2 py-1.5 text-left text-sm transition-[background-color,border-color,box-shadow] duration-200 hover:bg-neutral-100/80 dark:hover:bg-white/[0.05] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/15 focus-visible:ring-offset-2";
1092
- declare const studioQuestionOptionSelectedClass: string;
1093
-
1094
1062
  declare const buttonVariants: (props?: ({
1095
1063
  variant?: "default" | "outline" | "ghost" | "secondary" | "destructive" | "link" | null | undefined;
1096
1064
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
@@ -1129,6 +1097,47 @@ interface TextShimmerProps {
1129
1097
  }
1130
1098
  declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
1131
1099
 
1100
+ /**
1101
+ * Timbal V2 button design tokens.
1102
+ *
1103
+ * Mirrors the `timbal-platform` design language (`TimbalV2Button`) so chat
1104
+ * surfaces built with the SDK feel identical to the Timbal Studio. Each record
1105
+ * is keyed by variant or size and ships only Tailwind utility classes — no
1106
+ * runtime JS — so consumers can compose them with `cn(...)` and add their own
1107
+ * overrides without ejecting.
1108
+ *
1109
+ * Every colour is resolved through semantic CSS variables defined in
1110
+ * `styles.css`. There are NO hardcoded palette literals — light/dark mode
1111
+ * flips by swapping the variable values, not by toggling Tailwind classes.
1112
+ */
1113
+ type TimbalV2Variant = "primary" | "secondary" | "ghost" | "informative" | "destructive" | "link";
1114
+ type TimbalV2Size = "xs" | "sm" | "md" | "lg";
1115
+
1116
+ interface TimbalV2ButtonProps extends React.ComponentProps<"button"> {
1117
+ variant?: TimbalV2Variant;
1118
+ size?: TimbalV2Size;
1119
+ isIconOnly?: boolean;
1120
+ isLoading?: boolean;
1121
+ fullWidth?: boolean;
1122
+ /** When true, renders children as the underlying element (Radix Slot pattern). */
1123
+ asChild?: boolean;
1124
+ }
1125
+
1126
+ interface TooltipIconButtonProps extends Omit<TimbalV2ButtonProps, "isIconOnly"> {
1127
+ /** Visible tooltip + accessible label. Always required. */
1128
+ tooltip: string;
1129
+ /** Tooltip placement. Default: "bottom". */
1130
+ side?: "top" | "bottom" | "left" | "right";
1131
+ }
1132
+ /**
1133
+ * Icon-only Timbal pill button with a tooltip. Used by every chat-surface
1134
+ * toolbar (composer send/cancel, message action bar, scroll-to-bottom).
1135
+ *
1136
+ * Defaults to a soft `secondary` variant so it sits cleanly inside composers,
1137
+ * message bubbles, and the action bar. Override via `variant`.
1138
+ */
1139
+ declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
1140
+
1132
1141
  declare function cn(...inputs: ClassValue[]): string;
1133
1142
 
1134
- export { ARTIFACT_AGENT_INSTRUCTIONS, ARTIFACT_FENCE_LANGUAGES, type AnyArtifact, ArtifactCard, type ArtifactRegistry, ArtifactRegistryProvider, type ArtifactRenderer, type ArtifactRendererProps, ArtifactView, AuthGuard, Avatar, AvatarFallback, AvatarImage, Button, type ChartArtifact, ChartArtifactView, type ChatAttachment, type ChatMessage, Composer, ComposerAddAttachment, ComposerAttachments, type ComposerProps, type ContentPart, type CreateDefaultAttachmentAdapterOptions, type CreateUploadAttachmentAdapterOptions, DEFAULT_UPLOAD_ACCEPT, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type HtmlArtifact, HtmlArtifactView, type JsonArtifact, JsonArtifactView, type MarkdownArtifactMatch, type MarkdownSegment, MarkdownText, type QuestionArtifact, QuestionArtifactView, type QuestionOption, type ResolveAttachmentAdapterOptions, STUDIO_INSET_LEFT, STUDIO_PILL_HEIGHT, STUDIO_SIDEBAR_GAP, STUDIO_SIDEBAR_WIDTH, STUDIO_TOPBAR_GAP, STUDIO_TOPBAR_HEIGHT, type SendOptions, SessionProvider, Shimmer, Suggestions, type SuggestionsComponent, type SuggestionsSlotProps, type SuggestionsSource, ShikiSyntaxHighlighter as SyntaxHighlighter, TIMBAL_V2_BORDER, TIMBAL_V2_FILL, TIMBAL_V2_LABEL, TIMBAL_V2_PILL_SURFACE, TIMBAL_V2_SECONDARY_CHROME, TIMBAL_V2_SHADOW, TIMBAL_V2_SIZE_HEIGHT, TIMBAL_V2_SIZE_ICON, TIMBAL_V2_SIZE_LABEL_PX, type TableArtifact, TableArtifactView, type TextContentPart, type TextShimmerProps, type ThinkingContentPart, Thread, type ThreadArtifactsConfig, type ThreadComponents, type ThreadProps, type ThreadSuggestion, type ThreadSuggestionsProps, type ThreadWelcomeConfig, type ThreadWelcomeProps, type TimbalArtifact, type TimbalAttachmentsConfig, type TimbalAttachmentsProp, TimbalChat, type TimbalChatProps, TimbalChatShell, type TimbalChatShellProps, TimbalRuntimeProvider, type TimbalRuntimeProviderProps, type TimbalStreamApi, TimbalV2Button, type TimbalV2ButtonProps, type TimbalV2Size, type TimbalV2Variant, ToolArtifactFallback, ToolBodyPresence, type ToolCallContentPart, ToolFallback, ToolMotion, type ToolMotionVariant, ToolPresence, Tooltip, TooltipContent, TooltipIconButton, type TooltipIconButtonProps, TooltipProvider, TooltipTrigger, type UiAction, type UiArtifact, UiArtifactView, UiCustomNodeRegistryProvider, type UiEventEnvelope, UiEventProvider, type UiNode, UiNodeView, type UploadFetchFn, type UseTimbalStreamOptions, type UseWorkforcesOptions, type UseWorkforcesResult, UserMessageAttachments, WorkforceSelector, type WorkforceSelectorProps, authFetch, buttonVariants, clearTokens, cn, createDefaultAttachmentAdapter, createUploadAttachmentAdapter, defaultArtifactRenderers, fetchCurrentUser, findMarkdownArtifacts, getAccessToken, getPath, getRefreshToken, isArtifact, isArtifactFenceLanguage, isUiBinding, luxuryEase, parseArtifactFromToolResult, refreshAccessToken, resolveAttachmentAdapter, resolveBindable, setAccessToken, setPath, setRefreshToken, splitMarkdownByArtifacts, studioArtifactShellClass, studioChromeShellStyle, studioComposeInputShellClass, studioComposerIoWellClass, studioIntegrationBorder, studioIntegrationCardClass, studioIntegrationIconTileClass, studioIntegrationSurfaceSolid, studioListRowButtonClass, studioPillSurfaceClass, studioPlaygroundGradientClass, studioQuestionOptionClass, studioQuestionOptionSelectedClass, studioSecondaryChromeClass, studioTimelineActionClass, studioTimelineBodyPadClass, studioTimelineChevronClass, studioTimelineDetailClass, studioTimelineRowButtonClass, studioTimelineShimmerActionClass, studioTimelineTextClass, studioToolCardShellClass, studioTopbarIconPillClass, studioTopbarPillHeightClass, toolPresenceTransition, useArtifactRegistry, useResolvedSuggestions, useSession, useTimbalRuntime, useTimbalStream, useToolRunning, useUiCustomNodeRegistry, useUiDispatch, useUiEventEmitter, useUiState, useWorkforces };
1143
+ export { ARTIFACT_AGENT_INSTRUCTIONS, ARTIFACT_FENCE_LANGUAGES, type AnyArtifact, ArtifactCard, type ArtifactRegistry, ArtifactRegistryProvider, type ArtifactRenderer, type ArtifactRendererProps, ArtifactView, AuthGuard, Avatar, AvatarFallback, AvatarImage, Button, type ChartArtifact, ChartArtifactView, type ChatAttachment, type ChatMessage, Composer, type ComposerProps, type ContentPart, type CreateDefaultAttachmentAdapterOptions, type CreateUploadAttachmentAdapterOptions, DEFAULT_UPLOAD_ACCEPT, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type HtmlArtifact, HtmlArtifactView, type JsonArtifact, JsonArtifactView, type MarkdownArtifactMatch, type MarkdownSegment, MarkdownText, ModeToggle, type ModeToggleProps, type ModeToggleTheme, type QuestionArtifact, QuestionArtifactView, type QuestionOption, type ResolveAttachmentAdapterOptions, type SendOptions, SessionProvider, Shimmer, StudioSidebar, type StudioSidebarProps, StudioWelcome, type StudioWelcomeProps, Suggestions, type SuggestionsComponent, type SuggestionsSlotProps, type SuggestionsSource, type TableArtifact, TableArtifactView, type TextContentPart, type TextShimmerProps, type ThinkingContentPart, Thread, type ThreadArtifactsConfig, type ThreadComponents, type ThreadProps, type ThreadSuggestion, type ThreadSuggestionsProps, type ThreadWelcomeConfig, type ThreadWelcomeProps, type TimbalArtifact, type TimbalAttachmentsConfig, type TimbalAttachmentsProp, TimbalChat, type TimbalChatProps, TimbalChatShell, type TimbalChatShellProps, TimbalMark, type TimbalMarkProps, TimbalRuntimeProvider, type TimbalRuntimeProviderProps, type TimbalStreamApi, TimbalStudioShell, type TimbalStudioShellProps, ToolArtifactFallback, type ToolCallContentPart, ToolFallback, Tooltip, TooltipContent, TooltipIconButton, type TooltipIconButtonProps, TooltipProvider, TooltipTrigger, type UiAction, type UiArtifact, UiArtifactView, UiCustomNodeRegistryProvider, type UiEventEnvelope, UiEventProvider, type UiNode, UiNodeView, type UploadFetchFn, type UseTimbalStreamOptions, type UseWorkforcesOptions, type UseWorkforcesResult, WorkforceSelector, type WorkforceSelectorProps, authFetch, clearTokens, cn, createDefaultAttachmentAdapter, createUploadAttachmentAdapter, defaultArtifactRenderers, fetchCurrentUser, findMarkdownArtifacts, getAccessToken, getPath, getRefreshToken, isArtifact, isArtifactFenceLanguage, isUiBinding, parseArtifactFromToolResult, refreshAccessToken, resolveAttachmentAdapter, resolveBindable, setAccessToken, setPath, setRefreshToken, splitMarkdownByArtifacts, useArtifactRegistry, useOptionalSession, useResolvedSuggestions, useSession, useTimbalRuntime, useTimbalStream, useToolRunning, useUiCustomNodeRegistry, useUiDispatch, useUiEventEmitter, useUiState, useWorkforces };