@nicorp/nui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -220,6 +220,13 @@ export declare const ChartTooltip: typeof Tooltip_2;
220
220
 
221
221
  export declare const ChatBubble: React_2.ForwardRefExoticComponent<ChatBubbleProps & React_2.RefAttributes<HTMLDivElement>>;
222
222
 
223
+ export declare const ChatBubbleActions: React_2.ForwardRefExoticComponent<ChatBubbleActionsProps & React_2.RefAttributes<HTMLDivElement>>;
224
+
225
+ export declare interface ChatBubbleActionsProps extends React_2.HTMLAttributes<HTMLDivElement> {
226
+ /** Show always or on hover @default "hover" */
227
+ visibility?: "always" | "hover";
228
+ }
229
+
223
230
  export declare const ChatBubbleAvatar: React_2.ForwardRefExoticComponent<ChatBubbleAvatarProps & React_2.RefAttributes<HTMLDivElement>>;
224
231
 
225
232
  export declare interface ChatBubbleAvatarProps extends React_2.HTMLAttributes<HTMLDivElement> {
@@ -232,6 +239,8 @@ export declare const ChatBubbleMessage: React_2.ForwardRefExoticComponent<ChatBu
232
239
  export declare interface ChatBubbleMessageProps extends React_2.HTMLAttributes<HTMLDivElement> {
233
240
  variant?: "sent" | "received";
234
241
  isLoading?: boolean;
242
+ /** Delivery status indicator */
243
+ status?: "sending" | "sent" | "delivered" | "read" | "error";
235
244
  }
236
245
 
237
246
  export declare interface ChatBubbleProps extends React_2.HTMLAttributes<HTMLDivElement> {
@@ -248,6 +257,44 @@ export declare const ChatContainer: React_2.ForwardRefExoticComponent<ChatContai
248
257
  export declare interface ChatContainerProps extends React_2.HTMLAttributes<HTMLDivElement> {
249
258
  }
250
259
 
260
+ export declare const ChatFollowUp: React_2.ForwardRefExoticComponent<ChatFollowUpProps & React_2.RefAttributes<HTMLDivElement>>;
261
+
262
+ export declare interface ChatFollowUpProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
263
+ /** The question AI is asking */
264
+ question: string;
265
+ /** Answer options to display as buttons */
266
+ options: FollowUpOption[];
267
+ /** Called when user picks an option */
268
+ onSelect?: (optionId: string, label: string) => void;
269
+ /** Currently selected option id (disables further selection) */
270
+ selected?: string;
271
+ /** Allow user to type a custom answer @default false */
272
+ allowFreeText?: boolean;
273
+ /** Called when user submits free-text answer */
274
+ onFreeTextSubmit?: (text: string) => void;
275
+ /** Grid columns for options @default 1 */
276
+ columns?: 1 | 2;
277
+ }
278
+
279
+ export declare const ChatHeader: React_2.ForwardRefExoticComponent<ChatHeaderProps & React_2.RefAttributes<HTMLDivElement>>;
280
+
281
+ export declare interface ChatHeaderProps extends React_2.HTMLAttributes<HTMLDivElement> {
282
+ /** Chat title */
283
+ title?: string;
284
+ /** Model name to display */
285
+ model?: string;
286
+ /** Model icon (emoji or URL) */
287
+ modelIcon?: string;
288
+ /** Connection/typing status */
289
+ status?: "online" | "offline" | "typing";
290
+ /** Clear conversation handler */
291
+ onClear?: () => void;
292
+ /** Settings handler */
293
+ onSettings?: () => void;
294
+ /** Back button handler (mobile) */
295
+ onBack?: () => void;
296
+ }
297
+
251
298
  export declare const ChatInput: React_2.ForwardRefExoticComponent<ChatInputProps & React_2.RefAttributes<HTMLDivElement>>;
252
299
 
253
300
  export declare interface ChatInputProps {
@@ -256,6 +303,22 @@ export declare interface ChatInputProps {
256
303
  disabled?: boolean;
257
304
  isLoading?: boolean;
258
305
  showAttach?: boolean;
306
+ /** Handler for file attachment — triggers hidden file input */
307
+ onAttach?: (files: FileList) => void;
308
+ /** Accept attribute for file input @default "*" */
309
+ acceptFiles?: string;
310
+ /** Stop/cancel handler — shows stop button instead of spinner when loading */
311
+ onStop?: () => void;
312
+ /** Controlled mode value */
313
+ value?: string;
314
+ /** Controlled mode change handler */
315
+ onChange?: (value: string) => void;
316
+ /** Content rendered above the textarea (e.g. ModelSelector, ChatModeSelector) */
317
+ headerSlot?: React_2.ReactNode;
318
+ /** Content rendered below the textarea (e.g. FilePreview, char counter) */
319
+ footerSlot?: React_2.ReactNode;
320
+ /** Max character length — shows counter when set */
321
+ maxLength?: number;
259
322
  className?: string;
260
323
  }
261
324
 
@@ -266,8 +329,133 @@ export declare interface ChatListProps extends React_2.HTMLAttributes<HTMLDivEle
266
329
  autoScroll?: boolean;
267
330
  }
268
331
 
332
+ export declare const ChatMessage: React_2.ForwardRefExoticComponent<ChatMessageProps & React_2.RefAttributes<HTMLDivElement>>;
333
+
334
+ export declare interface ChatMessageAction {
335
+ type: "copy" | "retry" | "edit" | "like" | "dislike" | "share";
336
+ handler?: () => void;
337
+ }
338
+
339
+ export declare interface ChatMessageCitation {
340
+ index: number;
341
+ title: string;
342
+ url: string;
343
+ snippet?: string;
344
+ }
345
+
346
+ export declare interface ChatMessageFollowUp {
347
+ question: string;
348
+ options: {
349
+ id: string;
350
+ label: string;
351
+ description?: string;
352
+ }[];
353
+ selected?: string;
354
+ allowFreeText?: boolean;
355
+ }
356
+
357
+ export declare interface ChatMessageProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'content'> {
358
+ /** Message direction */
359
+ variant?: "sent" | "received";
360
+ /** Avatar image URL */
361
+ avatar?: string;
362
+ /** Avatar fallback text */
363
+ avatarFallback?: string;
364
+ /** Message content */
365
+ content?: React_2.ReactNode;
366
+ /** Timestamp text (e.g. "2:30 PM") */
367
+ timestamp?: string;
368
+ /** Loading state (bouncing dots) */
369
+ isLoading?: boolean;
370
+ /** Message delivery status */
371
+ status?: "sending" | "sent" | "delivered" | "read" | "error";
372
+ /** Action buttons to show */
373
+ actions?: ("copy" | "retry" | "edit" | "like" | "dislike" | "share")[];
374
+ /** Raw text content for copy action */
375
+ textContent?: string;
376
+ /** Like/dislike state */
377
+ likeState?: "liked" | "disliked" | null;
378
+ /** Action handlers */
379
+ onCopy?: () => void;
380
+ onRetry?: () => void;
381
+ onEdit?: () => void;
382
+ onLike?: () => void;
383
+ onDislike?: () => void;
384
+ onShare?: () => void;
385
+ /** Follow-up question */
386
+ followUp?: ChatMessageFollowUp;
387
+ onFollowUpSelect?: (optionId: string, label: string) => void;
388
+ onFollowUpFreeText?: (text: string) => void;
389
+ /** Reasoning/thinking block */
390
+ reasoning?: ChatMessageReasoning;
391
+ /** Tool calls */
392
+ toolCalls?: ChatMessageToolCall[];
393
+ /** Source citations */
394
+ citations?: ChatMessageCitation[];
395
+ }
396
+
397
+ export declare interface ChatMessageReasoning {
398
+ content: string;
399
+ isThinking?: boolean;
400
+ duration?: number;
401
+ }
402
+
403
+ export declare interface ChatMessageToolCall {
404
+ name: string;
405
+ args?: Record<string, unknown>;
406
+ result?: string;
407
+ status: "running" | "success" | "error";
408
+ error?: string;
409
+ }
410
+
411
+ export declare const ChatModeSelector: React_2.ForwardRefExoticComponent<ChatModeSelectorProps & React_2.RefAttributes<HTMLDivElement>>;
412
+
413
+ export declare interface ChatModeSelectorProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onChange"> {
414
+ modes: ModeOption[];
415
+ value?: string;
416
+ onChange?: (modeId: string) => void;
417
+ /** Visual size @default "default" */
418
+ size?: "sm" | "default";
419
+ }
420
+
421
+ export declare const ChatToolCall: React_2.ForwardRefExoticComponent<ChatToolCallProps & React_2.RefAttributes<HTMLDivElement>>;
422
+
423
+ export declare interface ChatToolCallProps extends React_2.HTMLAttributes<HTMLDivElement> {
424
+ /** Tool/function name */
425
+ name: string;
426
+ /** Arguments passed to the tool */
427
+ args?: Record<string, unknown>;
428
+ /** Result from the tool */
429
+ result?: string;
430
+ /** Call status */
431
+ status: "running" | "success" | "error";
432
+ /** Error message (when status=error) */
433
+ error?: string;
434
+ /** Start in open state @default false */
435
+ defaultOpen?: boolean;
436
+ }
437
+
269
438
  export declare const Checkbox: React_2.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
270
439
 
440
+ export declare interface Citation {
441
+ /** Citation index (displayed as [1], [2], etc.) */
442
+ index: number;
443
+ /** Source title */
444
+ title: string;
445
+ /** Source URL */
446
+ url: string;
447
+ /** Optional text snippet from source */
448
+ snippet?: string;
449
+ /** Favicon or icon URL */
450
+ favicon?: string;
451
+ }
452
+
453
+ export declare const CitationBadge: React_2.ForwardRefExoticComponent<CitationBadgeProps & React_2.RefAttributes<HTMLButtonElement>>;
454
+
455
+ export declare interface CitationBadgeProps extends React_2.HTMLAttributes<HTMLButtonElement> {
456
+ citation: Citation;
457
+ }
458
+
271
459
  export declare function cn(...inputs: ClassValue[]): string;
272
460
 
273
461
  export declare function Code({ className, ...props }: CodeProps): JSX_2.Element;
@@ -453,6 +641,28 @@ export declare const ContextMenuSubTrigger: React_2.ForwardRefExoticComponent<Om
453
641
 
454
642
  export declare const ContextMenuTrigger: React_2.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuTriggerProps & React_2.RefAttributes<HTMLSpanElement>>;
455
643
 
644
+ export declare interface Conversation {
645
+ id: string;
646
+ title: string;
647
+ lastMessage?: string;
648
+ updatedAt: Date;
649
+ model?: string;
650
+ icon?: string;
651
+ }
652
+
653
+ export declare const ConversationList: React_2.ForwardRefExoticComponent<ConversationListProps & React_2.RefAttributes<HTMLDivElement>>;
654
+
655
+ export declare interface ConversationListProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onSelect"> {
656
+ conversations: Conversation[];
657
+ activeId?: string;
658
+ onSelect?: (id: string) => void;
659
+ onNew?: () => void;
660
+ onDelete?: (id: string) => void;
661
+ onRename?: (id: string, title: string) => void;
662
+ /** Show search input @default true */
663
+ showSearch?: boolean;
664
+ }
665
+
456
666
  export declare const CopyInput: React_2.ForwardRefExoticComponent<CopyInputProps & React_2.RefAttributes<HTMLInputElement>>;
457
667
 
458
668
  declare interface CopyInputProps extends React_2.InputHTMLAttributes<HTMLInputElement> {
@@ -561,6 +771,29 @@ export declare interface EmptyStateProps {
561
771
  className?: string;
562
772
  }
563
773
 
774
+ export declare interface FileItem {
775
+ id?: string;
776
+ name: string;
777
+ /** Size in bytes */
778
+ size: number;
779
+ /** MIME type */
780
+ type: string;
781
+ /** URL for preview (images) or download */
782
+ url?: string;
783
+ /** Thumbnail URL (optional, for images) */
784
+ thumbnail?: string;
785
+ }
786
+
787
+ export declare const FilePreview: React_2.ForwardRefExoticComponent<FilePreviewProps & React_2.RefAttributes<HTMLDivElement>>;
788
+
789
+ export declare interface FilePreviewProps extends React_2.HTMLAttributes<HTMLDivElement> {
790
+ files: FileItem[];
791
+ /** Remove handler — shows X button when provided */
792
+ onRemove?: (index: number) => void;
793
+ /** Display variant @default "compact" */
794
+ variant?: "compact" | "grid";
795
+ }
796
+
564
797
  export declare function FileUpload({ accept, maxSize, multiple, onUpload, disabled, className, }: FileUploadProps): JSX_2.Element;
565
798
 
566
799
  export declare interface FileUploadProps {
@@ -582,6 +815,12 @@ export declare interface FlexProps extends React_2.HTMLAttributes<HTMLDivElement
582
815
  gap?: number | string;
583
816
  }
584
817
 
818
+ export declare interface FollowUpOption {
819
+ id: string;
820
+ label: string;
821
+ description?: string;
822
+ }
823
+
585
824
  export declare const Grid: React_2.ForwardRefExoticComponent<GridProps & React_2.RefAttributes<HTMLDivElement>>;
586
825
 
587
826
  export declare interface GridProps extends React_2.HTMLAttributes<HTMLDivElement> {
@@ -648,6 +887,27 @@ export declare interface MarkdownRendererProps extends React_2.HTMLAttributes<HT
648
887
  streaming?: boolean;
649
888
  }
650
889
 
890
+ export declare const MessageActions: React_2.ForwardRefExoticComponent<MessageActionsProps & React_2.RefAttributes<HTMLDivElement>>;
891
+
892
+ export declare interface MessageActionsProps extends React_2.HTMLAttributes<HTMLDivElement> {
893
+ /** Which actions to show @default ["copy"] */
894
+ actions?: MessageActionType[];
895
+ /** Text content to copy (for copy action) */
896
+ content?: string;
897
+ /** Current like state */
898
+ likeState?: "liked" | "disliked" | null;
899
+ onCopy?: () => void;
900
+ onRetry?: () => void;
901
+ onEdit?: () => void;
902
+ onLike?: () => void;
903
+ onDislike?: () => void;
904
+ onShare?: () => void;
905
+ /** Show always or only on hover @default "hover" */
906
+ visibility?: "always" | "hover";
907
+ }
908
+
909
+ export declare type MessageActionType = "copy" | "retry" | "edit" | "like" | "dislike" | "share";
910
+
651
911
  export declare function MetricCard({ title, value, description, trend, trendLabel, icon, className, ...props }: MetricCardProps): JSX_2.Element;
652
912
 
653
913
  declare interface MetricCardProps extends React_2.HTMLAttributes<HTMLDivElement> {
@@ -659,6 +919,46 @@ declare interface MetricCardProps extends React_2.HTMLAttributes<HTMLDivElement>
659
919
  icon?: React_2.ReactNode;
660
920
  }
661
921
 
922
+ export declare interface ModelOption {
923
+ /** Unique model identifier, e.g. "gpt-4o" */
924
+ id: string;
925
+ /** Display name, e.g. "GPT-4o" */
926
+ name: string;
927
+ /** Provider name, e.g. "OpenAI" */
928
+ provider?: string;
929
+ /** Description shown below name */
930
+ description?: string;
931
+ /** Small icon URL or emoji */
932
+ icon?: string;
933
+ /** Capability badges, e.g. ["Fast", "Vision", "128K"] */
934
+ badges?: string[];
935
+ /** Whether the model is disabled / unavailable */
936
+ disabled?: boolean;
937
+ }
938
+
939
+ export declare const ModelSelector: React_2.ForwardRefExoticComponent<ModelSelectorProps & React_2.RefAttributes<HTMLDivElement>>;
940
+
941
+ export declare interface ModelSelectorProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onChange"> {
942
+ /** Available models */
943
+ models: ModelOption[];
944
+ /** Currently selected model id */
945
+ value?: string;
946
+ /** Called when user selects a model */
947
+ onChange?: (modelId: string) => void;
948
+ /** Placeholder when nothing selected @default "Select model" */
949
+ placeholder?: string;
950
+ /** Compact mode — only icon + name in trigger @default false */
951
+ compact?: boolean;
952
+ }
953
+
954
+ export declare interface ModeOption {
955
+ id: string;
956
+ label: string;
957
+ /** Emoji or short icon text */
958
+ icon?: string;
959
+ description?: string;
960
+ }
961
+
662
962
  export declare function ModeToggle({ className }: {
663
963
  className?: string;
664
964
  }): JSX_2.Element;
@@ -792,6 +1092,21 @@ export declare const RadioGroup: React_2.ForwardRefExoticComponent<Omit<RadioGro
792
1092
 
793
1093
  export declare const RadioGroupItem: React_2.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
794
1094
 
1095
+ export declare const ReasoningBlock: React_2.ForwardRefExoticComponent<ReasoningBlockProps & React_2.RefAttributes<HTMLDivElement>>;
1096
+
1097
+ export declare interface ReasoningBlockProps extends React_2.HTMLAttributes<HTMLDivElement> {
1098
+ /** Reasoning/thinking content (plain text or markdown) */
1099
+ content: string;
1100
+ /** Whether the AI is still thinking @default false */
1101
+ isThinking?: boolean;
1102
+ /** Duration in seconds (shown in header) */
1103
+ duration?: number;
1104
+ /** Start in open state @default false */
1105
+ defaultOpen?: boolean;
1106
+ /** Custom title @default "Reasoning" */
1107
+ title?: string;
1108
+ }
1109
+
795
1110
  export declare const ScrollArea: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & {
796
1111
  orientation?: ScrollAreaOrientation;
797
1112
  } & React_2.RefAttributes<HTMLDivElement>>;
@@ -877,6 +1192,14 @@ export declare function Skeleton({ className, ...props }: React.HTMLAttributes<H
877
1192
 
878
1193
  export declare const Slider: React_2.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React_2.RefAttributes<HTMLSpanElement>, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
879
1194
 
1195
+ export declare const SourceCitation: React_2.ForwardRefExoticComponent<SourceCitationProps & React_2.RefAttributes<HTMLDivElement>>;
1196
+
1197
+ export declare interface SourceCitationProps extends React_2.HTMLAttributes<HTMLDivElement> {
1198
+ citations: Citation[];
1199
+ /** Display style @default "footer" */
1200
+ variant?: "inline" | "footer";
1201
+ }
1202
+
880
1203
  export declare interface StackProps extends React_2.HTMLAttributes<HTMLDivElement> {
881
1204
  spacing?: number | string;
882
1205
  align?: "start" | "end" | "center" | "stretch";
@@ -906,6 +1229,21 @@ export declare interface StepProps {
906
1229
  description?: string;
907
1230
  }
908
1231
 
1232
+ export declare const StreamingText: React_2.ForwardRefExoticComponent<StreamingTextProps & React_2.RefAttributes<HTMLSpanElement>>;
1233
+
1234
+ export declare interface StreamingTextProps extends React_2.HTMLAttributes<HTMLSpanElement> {
1235
+ /** Full text to render character-by-character */
1236
+ text: string;
1237
+ /** Characters per frame (~60fps) @default 2 */
1238
+ speed?: number;
1239
+ /** Called when typing animation finishes */
1240
+ onComplete?: () => void;
1241
+ /** Show blinking cursor at end @default true */
1242
+ cursor?: boolean;
1243
+ /** Skip animation and show full text immediately @default false */
1244
+ immediate?: boolean;
1245
+ }
1246
+
909
1247
  export declare const Switch: React_2.ForwardRefExoticComponent<Omit<SwitchPrimitive.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
910
1248
 
911
1249
  export declare const Table: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableElement> & React_2.RefAttributes<HTMLTableElement>>;