@arbidocs/react 0.3.100 → 0.3.101

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,14 +1,21 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
3
  import { ArbiOptions, Arbi, SSEStreamResult, SSEStreamStartData, AgentStepEvent } from '@arbidocs/sdk/browser';
4
4
  export { AgentStepEvent, Arbi, ArbiError, ArbiOptions, ArtifactEvent, MessageMetadataPayload, OutputTokensDetails, QueryOptions, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseCreatedEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextDoneEvent, ResponseUsage, SSEStreamCallbacks, SSEStreamResult, SSEStreamStartData, UserInputRequestEvent, UserMessageEvent } from '@arbidocs/sdk/browser';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import * as _arbidocs_client from '@arbidocs/client';
7
+ import { components } from '@arbidocs/client';
8
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
9
+ import * as class_variance_authority_types from 'class-variance-authority/types';
10
+ import { VariantProps } from 'class-variance-authority';
11
+ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
12
+ import * as zustand from 'zustand';
13
+ import { ClassValue } from 'clsx';
7
14
 
8
15
  interface ArbiProviderProps extends ArbiOptions {
9
16
  children: ReactNode;
10
17
  }
11
- declare function ArbiProvider({ children, ...options }: ArbiProviderProps): react.JSX.Element;
18
+ declare function ArbiProvider({ children, ...options }: ArbiProviderProps): React.JSX.Element;
12
19
 
13
20
  interface ArbiChatTheme {
14
21
  /** Primary action color — buttons, links (default: '#00adef' ARBI cyan) */
@@ -111,6 +118,35 @@ interface ArbiChatProps {
111
118
  height?: string | number;
112
119
  }
113
120
 
121
+ /** Props for {@link ArbiChatPanel} — the provider-less embeddable panel. */
122
+ interface ArbiChatPanelProps {
123
+ /** Skip workspace selection — go straight to chat */
124
+ workspaceId?: string;
125
+ /** Customize colors and appearance */
126
+ theme?: Partial<ArbiChatTheme>;
127
+ /** Customize text labels */
128
+ labels?: ArbiChatLabels;
129
+ /** Widget width (default: '100%') */
130
+ width?: string | number;
131
+ /** Widget height (default: '100%') */
132
+ height?: string | number;
133
+ }
134
+ /**
135
+ * The ARBI chat panel **without** its own providers.
136
+ *
137
+ * Drop it inside an app that already renders `<ArbiProvider>` and a
138
+ * `<QueryClientProvider>` to reuse the host's authenticated session — no second
139
+ * login. When the ambient session is already signed in, the panel skips the
140
+ * login screen and opens straight into chat.
141
+ *
142
+ * ```tsx
143
+ * // inside your authenticated app tree
144
+ * <ArbiChatPanel workspaceId="wrk-…" theme={myTheme} />
145
+ * ```
146
+ *
147
+ * For a fully self-contained widget (its own providers + login), use {@link ArbiChat}.
148
+ */
149
+ declare function ArbiChatPanel({ workspaceId, theme: themeOverrides, labels: labelOverrides, width, height, }: ArbiChatPanelProps): React.JSX.Element;
114
150
  /**
115
151
  * Self-contained ARBI chat widget.
116
152
  *
@@ -123,7 +159,7 @@ interface ArbiChatProps {
123
159
  * <ArbiChat url="https://www.arbidocs.com" />
124
160
  * ```
125
161
  */
126
- declare function ArbiChat({ url, workspaceId, theme: themeOverrides, labels: labelOverrides, width, height, }: ArbiChatProps): react.JSX.Element;
162
+ declare function ArbiChat({ url, workspaceId, theme: themeOverrides, labels: labelOverrides, width, height, }: ArbiChatProps): React.JSX.Element;
127
163
 
128
164
  /**
129
165
  * Hook to access the Arbi instance from the nearest ArbiProvider.
@@ -341,4 +377,356 @@ declare function useHealth(options?: {
341
377
  available_models: string[];
342
378
  }>, Error>;
343
379
 
344
- export { ArbiChat, type ArbiChatLabels, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, arbiQueryKeys, useAgents, useArbi, useAssistantQuery, useConversations, useDeleteAgents, useDocuments, useHealth, useSessions, useTags, useWorkspaces };
380
+ /**
381
+ * Minimal, dependency-free tooltip — a drop-in API replacement for a Radix
382
+ * wrapper (same exports/props: Tooltip, TooltipTrigger, TooltipContent,
383
+ * TooltipProvider). Promoted verbatim from the ARBI app.
384
+ *
385
+ * It attaches the trigger via a STABLE `useCallback` ref (never setStates,
386
+ * identity never changes), so React 19 never detach/attach-thrashes.
387
+ */
388
+ type Side = 'top' | 'bottom' | 'left' | 'right';
389
+ interface TooltipProviderProps {
390
+ children?: React.ReactNode;
391
+ delayDuration?: number;
392
+ skipDelayDuration?: number;
393
+ disableHoverableContent?: boolean;
394
+ }
395
+ declare const TooltipProvider: ({ children }: TooltipProviderProps) => React.JSX.Element;
396
+ interface TooltipProps {
397
+ children: React.ReactNode;
398
+ delayDuration?: number;
399
+ }
400
+ declare function Tooltip({ children, delayDuration }: TooltipProps): React.JSX.Element;
401
+ interface TooltipTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
402
+ asChild?: boolean;
403
+ }
404
+ declare function TooltipTrigger({ asChild, children, ...props }: TooltipTriggerProps): React.JSX.Element;
405
+ interface TooltipContentProps extends React.HTMLAttributes<HTMLDivElement> {
406
+ side?: Side;
407
+ sideOffset?: number;
408
+ }
409
+ declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
410
+
411
+ declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
412
+ declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
413
+ declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
414
+
415
+ declare const badgeVariants: (props?: ({
416
+ variant?: "outline" | "default" | "secondary" | "destructive" | null | undefined;
417
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
418
+ interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
419
+ }
420
+ declare function Badge({ className, variant, ...props }: BadgeProps): React.JSX.Element;
421
+
422
+ declare const buttonVariants: (props?: ({
423
+ variant?: "link" | "outline" | "default" | "secondary" | "destructive" | "ghost" | null | undefined;
424
+ size?: "default" | "icon" | "sm" | "lg" | null | undefined;
425
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
426
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
427
+ asChild?: boolean;
428
+ }
429
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
430
+
431
+ declare const HoverCard: React.FC<HoverCardPrimitive.HoverCardProps>;
432
+ declare const HoverCardTrigger: React.ForwardRefExoticComponent<HoverCardPrimitive.HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
433
+ declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
434
+
435
+ /** PDF file icon (red). Promoted from the ARBI app for SDK reuse. */
436
+
437
+ interface IconProps$5 {
438
+ size?: number;
439
+ className?: string;
440
+ }
441
+ declare const PdfIcon: React__default.FC<IconProps$5>;
442
+
443
+ /** Audio file icon (amber). Promoted from the ARBI app for SDK reuse. */
444
+
445
+ interface IconProps$4 {
446
+ size?: number;
447
+ className?: string;
448
+ }
449
+ declare const AudIcon: React__default.FC<IconProps$4>;
450
+
451
+ /** Image file icon (violet). Promoted from the ARBI app for SDK reuse. */
452
+
453
+ interface IconProps$3 {
454
+ size?: number;
455
+ className?: string;
456
+ }
457
+ declare const ImgIcon: React__default.FC<IconProps$3>;
458
+
459
+ /** Video file icon (emerald). Promoted from the ARBI app for SDK reuse. */
460
+
461
+ interface IconProps$2 {
462
+ size?: number;
463
+ className?: string;
464
+ }
465
+ declare const VidIcon: React__default.FC<IconProps$2>;
466
+
467
+ /** Email file icon (teal). Promoted from the ARBI app for SDK reuse. */
468
+
469
+ interface IconProps$1 {
470
+ size?: number;
471
+ className?: string;
472
+ }
473
+ declare const EmlIcon: React__default.FC<IconProps$1>;
474
+
475
+ /** Generic file icon (gray, question mark). Promoted from the ARBI app. */
476
+
477
+ interface IconProps {
478
+ size?: number;
479
+ className?: string;
480
+ }
481
+ declare const FileIcon: React__default.FC<IconProps>;
482
+
483
+ /**
484
+ * File-type icon colors — the subset of the app's FILE_TYPE_COLORS used by the
485
+ * promoted file-type icons. Kept self-contained so the SDK icons render with the
486
+ * same palette as the ARBI app without depending on the app's style constants.
487
+ */
488
+ declare const FILE_TYPE_COLORS: {
489
+ pdf: string;
490
+ img: string;
491
+ vid: string;
492
+ aud: string;
493
+ eml: string;
494
+ generic: string;
495
+ white: string;
496
+ };
497
+
498
+ /**
499
+ * EntityPill Component
500
+ *
501
+ * Base component for pill-style entity displays. Provides consistent styling and
502
+ * interaction patterns. Promoted verbatim from the ARBI app (import paths only
503
+ * changed to resolve within the SDK).
504
+ *
505
+ * Pattern: [Icon] [Label] [Optional: secondary text] [MoreVertical when interactive]
506
+ */
507
+
508
+ interface EntityPillProps {
509
+ /** The icon element (Avatar, ShieldIcon, FileIcon, etc.) */
510
+ icon: React__default.ReactNode;
511
+ /** Primary label text */
512
+ label: string;
513
+ /** Optional secondary text (e.g., page notation "p.1") */
514
+ secondaryText?: React__default.ReactNode;
515
+ /** Size variant: 'sm' for compact, 'base' for tab headers */
516
+ size?: 'sm' | 'base';
517
+ /** Shape variant: 'pill' for rounded-full, 'rounded' for rounded-md */
518
+ shape?: 'pill' | 'rounded';
519
+ /** Additional CSS classes */
520
+ className?: string;
521
+ /** Max width for label truncation */
522
+ labelMaxWidth?: string;
523
+ /** When true, the pill fills its container width (`flex w-full`) and the main
524
+ * area flexes + truncates so the trailing control (⋯ menu) pins to the right
525
+ * edge — used by the documents table's Document column. Default: shrink-to-fit. */
526
+ fullWidth?: boolean;
527
+ /** When true, render the pill with the active/"viewing" highlight — a solid
528
+ * dark-navy background with light text, applied LAST so it wins over both the
529
+ * default background and the interactive hover. */
530
+ highlight?: boolean;
531
+ /** Click handler for main area (icon + label) - primary action */
532
+ onClick?: (e: React__default.MouseEvent) => void;
533
+ /** Click handler for icon only — when set, only the icon is clickable (not the label) */
534
+ onIconClick?: (e: React__default.MouseEvent) => void;
535
+ /** Click handler for MoreVertical - opens popover/menu. When provided, shows MoreVertical icon */
536
+ onMoreClick?: (e: React__default.MouseEvent) => void;
537
+ /** Custom trailing element (e.g. a ⋯ dropdown menu). Rendered in the same
538
+ * trailing zone as MoreVertical, but as-is — so it stays outside the pill's
539
+ * primary click area. Takes precedence over `onMoreClick`. */
540
+ moreContent?: React__default.ReactNode;
541
+ /** Link URL - makes the main area an anchor tag */
542
+ href?: string;
543
+ /** Whether the pill is disabled */
544
+ disabled?: boolean;
545
+ /** Tooltip for main area (describes primary action, e.g., "View document") */
546
+ tooltipContent?: React__default.ReactNode;
547
+ /** Tooltip side placement */
548
+ tooltipSide?: 'top' | 'bottom' | 'left' | 'right';
549
+ /** Test ID for testing */
550
+ 'data-testid'?: string;
551
+ }
552
+ declare const EntityPill: React__default.ForwardRefExoticComponent<EntityPillProps & React__default.RefAttributes<HTMLElement>>;
553
+
554
+ /**
555
+ * DocumentEntity Component
556
+ *
557
+ * Displays a document as a compact entity pill with file-type icon and name.
558
+ * Promoted from the ARBI app and DECOUPLED from the app store/API: it renders
559
+ * purely from the `doc` prop and optional `onClick`/`onIconClick` callbacks.
560
+ */
561
+
562
+ /** Minimal, decoupled document shape the pill needs. Structurally compatible
563
+ * with the SDK's `DocResponse` (from `useDocuments`), but no dependency on it —
564
+ * a consumer can pass any object with these fields. */
565
+ interface DocumentLike {
566
+ file_name?: string | null;
567
+ folder?: string | null;
568
+ doc_metadata?: {
569
+ title?: string | null;
570
+ } | null;
571
+ }
572
+ interface DocumentEntityProps {
573
+ doc: DocumentLike;
574
+ /** Override the default file-type icon */
575
+ icon?: React__default.ReactNode;
576
+ /** Size variant — 'sm' (default) for inline/compact contexts, 'base' for a
577
+ * larger pill (e.g. the documents grid's primary name column). */
578
+ size?: 'sm' | 'base';
579
+ /** Override default label max width */
580
+ labelMaxWidth?: string;
581
+ /** Click handler for the whole pill */
582
+ onClick?: (e: React__default.MouseEvent) => void;
583
+ /** Click handler for the icon only */
584
+ onIconClick?: (e: React__default.MouseEvent) => void;
585
+ /** When true, the file-type icon swaps to an Eye on pill hover — a cue that
586
+ * clicking opens (view) the document. */
587
+ showHoverEye?: boolean;
588
+ /** When true, the Eye is pinned on (not just hover) — marks the document that
589
+ * is currently open/being viewed. Implies the hover-swap behaviour. */
590
+ viewing?: boolean;
591
+ /** Small overlay pinned to the icon's corner (e.g. an "available offline" pip). */
592
+ iconBadge?: React__default.ReactNode;
593
+ /** Trailing control rendered outside the click area (e.g. a ⋯ actions menu). */
594
+ actions?: React__default.ReactNode;
595
+ /** When true, the pill fills the available width and the name truncates via
596
+ * CSS so the trailing ⋯ menu pins to the right edge. */
597
+ fullWidth?: boolean;
598
+ /** Override the default folder/title hover tooltip. */
599
+ tooltipContent?: React__default.ReactNode;
600
+ className?: string;
601
+ }
602
+ declare function DocumentEntity({ doc, icon, size, labelMaxWidth, onClick, onIconClick, showHoverEye, viewing, iconBadge, actions, tooltipContent, className, fullWidth, }: DocumentEntityProps): React__default.JSX.Element;
603
+
604
+ /**
605
+ * TagEntity Component
606
+ *
607
+ * Single source of truth for tag visual appearance, promoted from the ARBI app
608
+ * and DECOUPLED from the app store/API. It renders purely from the `tag` prop —
609
+ * the app-only bits (creator/updater lookup, visibility toggle, live doctag
610
+ * count from the query cache) are dropped; pass `doctagCount`/`shared` if you
611
+ * want them shown in the tooltip.
612
+ */
613
+
614
+ /** Minimal, decoupled tag shape the pill needs. */
615
+ interface TagLike {
616
+ external_id: string;
617
+ name: string;
618
+ /** Tag type discriminator — drives the icon and the tooltip's "Type" line. */
619
+ tag_type?: {
620
+ type: string;
621
+ } | null;
622
+ /** Optional explicit color; when omitted it's derived from `external_id`. */
623
+ color?: string;
624
+ /** Optional document count shown in the tooltip. */
625
+ doctag_count?: number | null;
626
+ /** Optional shared/private flag shown in the tooltip. */
627
+ shared?: boolean | null;
628
+ }
629
+ interface TagEntityProps {
630
+ tag: TagLike;
631
+ size?: 'sm' | 'md' | 'lg';
632
+ className?: string;
633
+ onClick?: (e: React__default.MouseEvent) => void;
634
+ /** Whether to show the detailed tooltip (default: true) */
635
+ showTooltip?: boolean;
636
+ }
637
+ declare function TagEntity({ tag, size, className, onClick, showTooltip, }: TagEntityProps): React__default.JSX.Element;
638
+
639
+ /**
640
+ * ProjectEntity Component
641
+ *
642
+ * Fully-rounded pill for a "project" (a.k.a. a "matter" in some consumer apps).
643
+ * The viewer's relationship to the project drives an INVERTED (solid-fill)
644
+ * colour so the kinds read at a glance:
645
+ * - your paid project → primary
646
+ * - someone else's → secondary
647
+ * - your free project → grey
648
+ * "Common" keeps the neutral, non-inverted muted pill.
649
+ *
650
+ * Promoted from the ARBI app and DECOUPLED: no store/stripe deps. The icon
651
+ * defaults to a generic `Package` glyph and can be overridden via `icon`, and
652
+ * the display text via `label` (falls back to `name`) so consumers can relabel
653
+ * a "project" as a "matter", "case", etc.
654
+ */
655
+
656
+ type ProjectRelation = 'mine' | 'other' | 'common';
657
+ interface ProjectEntityProps {
658
+ name: string;
659
+ /** Display text override (defaults to `name`) — lets a consumer relabel. */
660
+ label?: string;
661
+ /** Icon override (defaults to a generic Package glyph). */
662
+ icon?: React__default.ReactNode;
663
+ subscription?: string;
664
+ hasCollaborators?: boolean;
665
+ size?: 'sm' | 'base';
666
+ className?: string;
667
+ onClick?: (e: React__default.MouseEvent) => void;
668
+ /** Viewer's relationship to the project — drives the inverted pill colour. */
669
+ relation?: ProjectRelation;
670
+ /** Whether the given `subscription` should be treated as paid. When omitted,
671
+ * it's inferred from the `subscription` value ('active' | 'past_due' | 'dev'). */
672
+ isPaid?: boolean;
673
+ /** Hover tooltip. */
674
+ tooltipContent?: React__default.ReactNode;
675
+ }
676
+ declare function ProjectEntity({ name, label, icon, subscription, hasCollaborators, size, className, onClick, relation, isPaid, tooltipContent, }: ProjectEntityProps): React__default.JSX.Element;
677
+
678
+ /**
679
+ * DocumentTable — a reusable AG Grid (community) block that renders a
680
+ * workspace's documents using the promoted entity pills.
681
+ *
682
+ * REUSE-FIRST: this composes AG Grid + `DocumentEntity`/`TagEntity` + the shadcn
683
+ * `Badge`; it is not a bespoke table. Data comes from the SDK `useDocuments`
684
+ * hook (or an explicit `documents` prop). Selection is controlled via
685
+ * `selectedIds`/`onSelectionChange`, falling back to the SDK-owned
686
+ * `useArbiUiStore` when those props are omitted.
687
+ */
688
+
689
+ type DocResponse = components['schemas']['DocResponse'];
690
+ interface DocumentTableProps {
691
+ /** Workspace to load documents from (used when `documents` is not supplied). */
692
+ workspaceId?: string;
693
+ /** Explicit rows. When provided, `useDocuments` is not called. */
694
+ documents?: DocResponse[];
695
+ /** Called when a row (document) is opened — row click or name-pill click. */
696
+ onOpenDocument?: (id: string) => void;
697
+ /** Controlled selection (external ids). Falls back to the SDK ui store. */
698
+ selectedIds?: string[];
699
+ /** Called with the new selection (external ids). Falls back to the SDK ui store. */
700
+ onSelectionChange?: (ids: string[]) => void;
701
+ /** Grid height. Number → pixels; string passed through. Default 480. */
702
+ height?: number | string;
703
+ className?: string;
704
+ }
705
+ declare function DocumentTable({ workspaceId, documents, onOpenDocument, selectedIds, onSelectionChange, height, className, }: DocumentTableProps): React__default.JSX.Element;
706
+
707
+ /**
708
+ * SDK-owned UI store for cross-block coordination.
709
+ *
710
+ * This is a SMALL, decoupled zustand store (NOT the ARBI app's multi-slice
711
+ * store). Blocks such as `DocumentTable` use it as a fallback for selection /
712
+ * "viewing" state when the consumer does not drive that state via props.
713
+ */
714
+ interface ArbiUiState {
715
+ /** External ids of the currently selected documents. */
716
+ selectedDocIds: string[];
717
+ setSelectedDocIds: (ids: string[]) => void;
718
+ /** External id of the document currently being viewed/opened, if any. */
719
+ viewingDocId: string | null;
720
+ setViewingDocId: (id: string | null) => void;
721
+ }
722
+ declare const useArbiUiStore: zustand.UseBoundStore<zustand.StoreApi<ArbiUiState>>;
723
+
724
+ /**
725
+ * Core utility: `cn()` — merge class names with Tailwind-aware conflict
726
+ * resolution (clsx + tailwind-merge). Copied faithfully from the ARBI app so the
727
+ * promoted "lego" components style identically in a consumer app.
728
+ */
729
+
730
+ declare function cn(...inputs: ClassValue[]): string;
731
+
732
+ export { ArbiChat, type ArbiChatLabels, ArbiChatPanel, type ArbiChatPanelProps, type ArbiChatProps, type ArbiChatTheme, ArbiProvider, type ArbiProviderProps, type ArbiUiState, AudIcon, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, type ButtonProps, DocumentEntity, type DocumentEntityProps, type DocumentLike, DocumentTable, type DocumentTableProps, EmlIcon, EntityPill, FILE_TYPE_COLORS, FileIcon, HoverCard, HoverCardContent, HoverCardTrigger, ImgIcon, PdfIcon, ProjectEntity, type ProjectEntityProps, type ProjectRelation, TagEntity, type TagEntityProps, type TagLike, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VidIcon, arbiQueryKeys, badgeVariants, buttonVariants, cn, useAgents, useArbi, useArbiUiStore, useAssistantQuery, useConversations, useDeleteAgents, useDocuments, useHealth, useSessions, useTags, useWorkspaces };