@arbidocs/react 0.3.172 → 0.3.173

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.cts CHANGED
@@ -3058,8 +3058,16 @@ interface VoiceNoteRecorderProps {
3058
3058
  /** External saving state, e.g. while the host's onSave promise is
3059
3059
  * pending — disables actions and shows a spinner on Save. */
3060
3060
  isSaving?: boolean;
3061
+ /**
3062
+ * Optional: called once with the finished recording as soon as it stops,
3063
+ * to produce a quick rough transcript shown inline during review. Purely
3064
+ * client-side and ephemeral — it's never uploaded and has no bearing on
3065
+ * what onSave receives; a host with real (e.g. diarized) transcription as
3066
+ * part of its normal document processing can skip this prop entirely.
3067
+ */
3068
+ transcribe?: (blob: Blob) => Promise<string>;
3061
3069
  }
3062
- declare function VoiceNoteRecorder({ onSave, onDiscard, onError, title, isSaving, }: VoiceNoteRecorderProps): React$1.JSX.Element;
3070
+ declare function VoiceNoteRecorder({ onSave, onDiscard, onError, title, isSaving, transcribe, }: VoiceNoteRecorderProps): React$1.JSX.Element;
3063
3071
 
3064
3072
  /** Formats a duration in milliseconds as "mm:ss", clamped to non-negative. */
3065
3073
  declare function formatElapsed(ms: number): string;
package/dist/index.d.ts CHANGED
@@ -3058,8 +3058,16 @@ interface VoiceNoteRecorderProps {
3058
3058
  /** External saving state, e.g. while the host's onSave promise is
3059
3059
  * pending — disables actions and shows a spinner on Save. */
3060
3060
  isSaving?: boolean;
3061
+ /**
3062
+ * Optional: called once with the finished recording as soon as it stops,
3063
+ * to produce a quick rough transcript shown inline during review. Purely
3064
+ * client-side and ephemeral — it's never uploaded and has no bearing on
3065
+ * what onSave receives; a host with real (e.g. diarized) transcription as
3066
+ * part of its normal document processing can skip this prop entirely.
3067
+ */
3068
+ transcribe?: (blob: Blob) => Promise<string>;
3061
3069
  }
3062
- declare function VoiceNoteRecorder({ onSave, onDiscard, onError, title, isSaving, }: VoiceNoteRecorderProps): React$1.JSX.Element;
3070
+ declare function VoiceNoteRecorder({ onSave, onDiscard, onError, title, isSaving, transcribe, }: VoiceNoteRecorderProps): React$1.JSX.Element;
3063
3071
 
3064
3072
  /** Formats a duration in milliseconds as "mm:ss", clamped to non-negative. */
3065
3073
  declare function formatElapsed(ms: number): string;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { cn, Avatar, AvatarFallback, AvatarImage, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, AiMarkdown, Card, Button, Badge, MarkdownRenderer, Input, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, ScrollArea, DropdownMenuItem, Textarea, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DropdownMenuLabel, DropdownMenuSeparator, Checkbox } from './chunk-PAJGQHFM.js';
2
- export { AiMarkdown, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, MarkdownRenderer, MarkdownStreamingContext, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, markdownBaseComponents, splitMarkdownBlocks, toggleVariants } from './chunk-PAJGQHFM.js';
3
1
  import { useArbi, ArbiProvider, AudioViewer } from './chunk-Q6XAXIT3.js';
4
2
  export { ArbiProvider, useArbi } from './chunk-Q6XAXIT3.js';
3
+ import { cn, Avatar, AvatarFallback, AvatarImage, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, AiMarkdown, Card, Button, Badge, MarkdownRenderer, Input, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, ScrollArea, DropdownMenuItem, Textarea, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DropdownMenuLabel, DropdownMenuSeparator, Checkbox } from './chunk-PAJGQHFM.js';
4
+ export { AiMarkdown, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, MarkdownRenderer, MarkdownStreamingContext, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, markdownBaseComponents, splitMarkdownBlocks, toggleVariants } from './chunk-PAJGQHFM.js';
5
5
  import React2, { memo, useState, createContext, forwardRef, useMemo, useCallback, useId, useRef, useContext, useEffect, Fragment as Fragment$1 } from 'react';
6
6
  import { useQuery, useMutation, useQueries, QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -7381,12 +7381,34 @@ function VoiceNoteRecorder({
7381
7381
  onDiscard,
7382
7382
  onError,
7383
7383
  title = "Voice note",
7384
- isSaving = false
7384
+ isSaving = false,
7385
+ transcribe
7385
7386
  }) {
7386
7387
  const recorder = useAudioRecorder();
7388
+ const [transcript, setTranscript] = useState(null);
7389
+ const [isTranscribing, setIsTranscribing] = useState(false);
7387
7390
  useEffect(() => {
7388
7391
  if (recorder.error) onError?.(recorder.error);
7389
7392
  }, [recorder.error]);
7393
+ useEffect(() => {
7394
+ if (recorder.state !== "stopped" || !recorder.blob) {
7395
+ setTranscript(null);
7396
+ setIsTranscribing(false);
7397
+ return;
7398
+ }
7399
+ if (!transcribe) return;
7400
+ let cancelled = false;
7401
+ setIsTranscribing(true);
7402
+ transcribe(recorder.blob).then((text) => {
7403
+ if (!cancelled) setTranscript(text);
7404
+ }).catch(() => {
7405
+ }).finally(() => {
7406
+ if (!cancelled) setIsTranscribing(false);
7407
+ });
7408
+ return () => {
7409
+ cancelled = true;
7410
+ };
7411
+ }, [recorder.state, recorder.blob]);
7390
7412
  const handleSave = () => {
7391
7413
  if (!recorder.blob) return;
7392
7414
  void onSave(recorder.blob, recorder.mimeType);
@@ -7449,6 +7471,20 @@ function VoiceNoteRecorder({
7449
7471
  ] }),
7450
7472
  recorder.state === "stopped" && recorder.blob && /* @__PURE__ */ jsxs(Fragment, { children: [
7451
7473
  /* @__PURE__ */ jsx("div", { className: "w-full max-w-md", children: /* @__PURE__ */ jsx(AudioViewer, { blob: recorder.blob, title }) }),
7474
+ (isTranscribing || transcript) && /* @__PURE__ */ jsx(
7475
+ "div",
7476
+ {
7477
+ className: "w-full max-w-md rounded-md border border-border bg-muted/30 p-3 text-sm text-muted-foreground",
7478
+ "data-testid": "voice-note-rough-transcript",
7479
+ children: isTranscribing ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
7480
+ /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
7481
+ "Transcribing\u2026"
7482
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
7483
+ /* @__PURE__ */ jsx("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide", children: "Rough transcript" }),
7484
+ /* @__PURE__ */ jsx("p", { children: transcript })
7485
+ ] })
7486
+ }
7487
+ ),
7452
7488
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
7453
7489
  /* @__PURE__ */ jsxs(
7454
7490
  Button,