@factorialco/f0-react 3.5.1 → 3.7.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/f0.d.ts CHANGED
@@ -44,6 +44,8 @@ import type * as echarts_2 from 'echarts';
44
44
  import { EmployeeItemProps } from './types';
45
45
  import { F0AccordionSkeletonProps } from './F0AccordionSkeleton';
46
46
  import { F0AnalyticsDashboardProps as F0AnalyticsDashboardProps_2 } from './types';
47
+ import { F0AudioPlayerCardProps as F0AudioPlayerCardProps_2 } from './types';
48
+ import { F0AudioPlayerProps as F0AudioPlayerProps_2 } from './types';
47
49
  import { F0AvatarCompanyProps as F0AvatarCompanyProps_2 } from './types';
48
50
  import { F0AvatarDateProps } from './F0AvatarDate';
49
51
  import { F0AvatarEmojiProps as F0AvatarEmojiProps_2 } from './F0AvatarEmoji';
@@ -1163,6 +1165,33 @@ export declare type AttachedFile = {
1163
1165
  errorMessage?: string;
1164
1166
  };
1165
1167
 
1168
+ export declare interface AudioPlayerControls extends AudioPlayerState {
1169
+ play: () => void;
1170
+ pause: () => void;
1171
+ toggle: () => void;
1172
+ seek: (seconds: number) => void;
1173
+ setPlaybackRate: (rate: number) => void;
1174
+ }
1175
+
1176
+ export declare interface AudioPlayerMenuAction {
1177
+ label: string;
1178
+ icon?: IconType;
1179
+ onClick: () => void;
1180
+ critical?: boolean;
1181
+ }
1182
+
1183
+ export declare const audioPlayerSizes: readonly ["sm", "md"];
1184
+
1185
+ export declare interface AudioPlayerState {
1186
+ isPlaying: boolean;
1187
+ currentTime: number;
1188
+ duration: number;
1189
+ buffered: number;
1190
+ playbackRate: number;
1191
+ isLoading: boolean;
1192
+ error: MediaError | null;
1193
+ }
1194
+
1166
1195
  /**
1167
1196
  * An item that can be passed in the `availableFormDefinitions` array.
1168
1197
  * Accepts either a plain {@link F0AiAvailableFormDefinition} or the result
@@ -1757,6 +1786,16 @@ declare type ButtonInternalProps = Pick<ActionProps, "size" | "disabled" | "clas
1757
1786
  * The aria-label of the button if not provided title or label will be used.
1758
1787
  */
1759
1788
  "aria-label"?: string;
1789
+ /**
1790
+ * Forwarded to the underlying button. Useful for buttons that toggle an
1791
+ * expandable region (e.g. a tree/graph expander).
1792
+ */
1793
+ "aria-expanded"?: boolean;
1794
+ /**
1795
+ * Forwarded to the underlying button. Use `-1` to take the button out of the
1796
+ * tab order (e.g. when a parent manages focus via roving tabindex).
1797
+ */
1798
+ tabIndex?: number;
1760
1799
  /**
1761
1800
  * The variant of the button.
1762
1801
  */
@@ -2236,7 +2275,8 @@ declare type CardInternalProps_2 = F0AiInsightCardProps & {
2236
2275
  };
2237
2276
 
2238
2277
  declare type CardMetadata = {
2239
- icon: IconType;
2278
+ /** Leading icon. Optional — when omitted the row renders just the value. */
2279
+ icon?: IconType;
2240
2280
  property: Exclude<CardMetadataProperty, {
2241
2281
  type: "file";
2242
2282
  }>;
@@ -3026,6 +3066,7 @@ declare type CollectionVisualizations<Record extends RecordType, Filters extends
3026
3066
  list: VisualizacionTypeDefinition<ListCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
3027
3067
  card: VisualizacionTypeDefinition<CardCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
3028
3068
  kanban: VisualizacionTypeDefinition<KanbanCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>>;
3069
+ graph: VisualizacionTypeDefinition<GraphCollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>, GraphVisualizationSettings>;
3029
3070
  };
3030
3071
 
3031
3072
  declare const collectionVisualizations: CollectionVisualizations<RecordType, FiltersDefinition, SortingsDefinition, SummariesDefinition, ItemActionsDefinition<RecordType>, NavigationFiltersDefinition, GroupingDefinition<RecordType>>;
@@ -3721,6 +3762,8 @@ declare type DataCollectionSourceDefinition<R extends RecordType = RecordType, F
3721
3762
  itemPreFilter?: (item: R) => boolean;
3722
3763
  /** Lanes configuration */
3723
3764
  lanes?: ReadonlyArray<Lane<Filters>>;
3765
+ /** Rich search preview shown in the shared header search (all visualizations). */
3766
+ searchPreview?: SearchPreview<R>;
3724
3767
  };
3725
3768
 
3726
3769
  /**
@@ -4298,6 +4341,15 @@ export declare const defaultTranslations: {
4298
4341
  readonly link: {
4299
4342
  readonly opensInNewTab: "opens in new tab";
4300
4343
  };
4344
+ readonly audioPlayer: {
4345
+ readonly label: "Audio player";
4346
+ readonly play: "Play";
4347
+ readonly pause: "Pause";
4348
+ readonly seek: "Seek";
4349
+ readonly options: "Recording options";
4350
+ readonly playbackSpeed: "Playback speed";
4351
+ readonly position: "{{current}} of {{total}}";
4352
+ };
4301
4353
  readonly actions: {
4302
4354
  readonly add: "Add";
4303
4355
  readonly edit: "Edit";
@@ -4421,16 +4473,18 @@ export declare const defaultTranslations: {
4421
4473
  readonly cancel: "Cancel";
4422
4474
  };
4423
4475
  readonly visualizations: {
4424
- readonly table: "Table view";
4425
- readonly editableTable: "Editable table view";
4426
- readonly card: "Card view";
4427
- readonly list: "List view";
4428
- readonly kanban: "Kanban view";
4476
+ readonly table: "Table";
4477
+ readonly editableTable: "Editable table";
4478
+ readonly card: "Card";
4479
+ readonly list: "List";
4480
+ readonly kanban: "Kanban";
4481
+ readonly graph: "Graph";
4429
4482
  readonly pagination: {
4430
4483
  readonly of: "of";
4431
4484
  };
4432
4485
  readonly settings: "{{visualizationName}} settings";
4433
4486
  readonly reset: "Reset to default";
4487
+ readonly viewSelectorLabel: "Select view";
4434
4488
  };
4435
4489
  readonly table: {
4436
4490
  readonly settings: {
@@ -4941,33 +4995,6 @@ export declare const defaultTranslations: {
4941
4995
  readonly zoomIn: "Zoom in";
4942
4996
  readonly zoomOut: "Zoom out";
4943
4997
  readonly navigation: "Graph navigation";
4944
- readonly metadataSettings: "Metadata visibility";
4945
- readonly tagTypeLabels: {
4946
- readonly person: "People";
4947
- readonly team: "Teams";
4948
- readonly company: "Companies";
4949
- readonly status: "Statuses";
4950
- readonly alert: "Alerts";
4951
- readonly balance: "Balances";
4952
- readonly dot: "Tags";
4953
- readonly raw: "Tags";
4954
- };
4955
- };
4956
- readonly search: {
4957
- readonly noResults: "No results";
4958
- };
4959
- readonly detailPanel: {
4960
- readonly details: "Details";
4961
- readonly moreActions: "More actions";
4962
- readonly resize: "Resize detail panel";
4963
- };
4964
- readonly expander: {
4965
- readonly collapse: "Collapse {{count}} items";
4966
- readonly expand: "Expand {{count}} items";
4967
- readonly expandWithParentSingular: "Expand {{parent}}, {{count}} child";
4968
- readonly expandWithParentPlural: "Expand {{parent}}, {{count}} children";
4969
- readonly collapseWithParent: "Collapse {{parent}}";
4970
- readonly collapseDefault: "Collapse children";
4971
4998
  };
4972
4999
  };
4973
5000
  readonly wizard: {
@@ -6552,6 +6579,110 @@ declare type F0AssistantMessageExtraProps = {
6552
6579
  renderMarkdown?: (content: string) => ReactNode;
6553
6580
  };
6554
6581
 
6582
+ /**
6583
+ * @experimental This is an experimental component, use it at your own risk.
6584
+ */
6585
+ export declare const F0AudioPlayer: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0AudioPlayerProps_2 & RefAttributes<HTMLDivElement>>>;
6586
+
6587
+ /**
6588
+ * @experimental This is an experimental component, use it at your own risk.
6589
+ */
6590
+ export declare const F0AudioPlayerCard: WithDataTestIdReturnType_3<ForwardRefExoticComponent<F0AudioPlayerCardProps_2 & RefAttributes<HTMLDivElement>>>;
6591
+
6592
+ export declare interface F0AudioPlayerCardProps extends F0AudioPlayerProps {
6593
+ /**
6594
+ * The title shown in the card header (e.g. "AI Call with Alex Williams").
6595
+ */
6596
+ title: string;
6597
+ /**
6598
+ * An optional subtitle shown under the title (e.g. "May 9, 2025 - 10:00am").
6599
+ */
6600
+ subtitle?: string;
6601
+ /**
6602
+ * Extra actions appended to the kebab menu below the playback-speed options
6603
+ * (after a separator) — e.g. a download or copy-link action. The kebab itself
6604
+ * is always rendered by the card.
6605
+ */
6606
+ actions?: AudioPlayerMenuAction[];
6607
+ }
6608
+
6609
+ export declare interface F0AudioPlayerProps extends WithDataTestIdProps, DataAttributes_2 {
6610
+ /**
6611
+ * The audio source URL.
6612
+ */
6613
+ src: string;
6614
+ /**
6615
+ * How much of the audio to preload.
6616
+ * @default "metadata"
6617
+ */
6618
+ preload?: "none" | "metadata" | "auto";
6619
+ /**
6620
+ * Start playing as soon as the audio is ready.
6621
+ * @default false
6622
+ */
6623
+ autoPlay?: boolean;
6624
+ /**
6625
+ * Controlled playing state. Pair with `onPlayingChange`.
6626
+ */
6627
+ playing?: boolean;
6628
+ /**
6629
+ * Initial playing state when uncontrolled.
6630
+ * @default false
6631
+ */
6632
+ defaultPlaying?: boolean;
6633
+ /**
6634
+ * Fired when the playing state changes (play or pause).
6635
+ */
6636
+ onPlayingChange?: (playing: boolean) => void;
6637
+ /**
6638
+ * Playback rates offered in the speed menu. Pass an empty array to hide the
6639
+ * speed options.
6640
+ * @default [1, 1.5, 2]
6641
+ */
6642
+ playbackRates?: number[];
6643
+ /**
6644
+ * Fired when playback starts.
6645
+ */
6646
+ onPlay?: () => void;
6647
+ /**
6648
+ * Fired when playback pauses.
6649
+ */
6650
+ onPause?: () => void;
6651
+ /**
6652
+ * Fired when the user seeks, with the target position in seconds.
6653
+ */
6654
+ onSeek?: (seconds: number) => void;
6655
+ /**
6656
+ * Fired on every time update, with the current position in seconds.
6657
+ */
6658
+ onTimeUpdate?: (seconds: number) => void;
6659
+ /**
6660
+ * Fired when playback reaches the end.
6661
+ */
6662
+ onEnded?: () => void;
6663
+ /**
6664
+ * Fired when the audio fails to load or play.
6665
+ */
6666
+ onError?: (error: MediaError | null) => void;
6667
+ /**
6668
+ * Disables all controls.
6669
+ * @default false
6670
+ */
6671
+ disabled?: boolean;
6672
+ /**
6673
+ * Accessible label for the player region.
6674
+ */
6675
+ ariaLabel?: string;
6676
+ /**
6677
+ * The size of the player.
6678
+ * @default "md"
6679
+ */
6680
+ size?: F0AudioPlayerSize;
6681
+ className?: string;
6682
+ }
6683
+
6684
+ export declare type F0AudioPlayerSize = (typeof audioPlayerSizes)[number];
6685
+
6555
6686
  export declare function F0AuraVoiceAnimation({ size, state, color, colorShift, audioTrack, themeMode, className, ref, ...props }: F0AuraVoiceAnimationProps & ComponentProps<"div"> & VariantProps<typeof F0AuraVoiceAnimationVariants>): JSX_2.Element;
6556
6687
 
6557
6688
  export declare interface F0AuraVoiceAnimationProps {
@@ -9305,6 +9436,9 @@ export declare interface F0FormValidationResult {
9305
9436
  rootError?: string;
9306
9437
  }
9307
9438
 
9439
+ /** Tag types that can be rendered in a node's metadata row. */
9440
+ declare type F0GraphNodeTagType = TagVariant["type"];
9441
+
9308
9442
  export declare const F0GridStack: WithDataTestIdReturnType_7< {
9309
9443
  ({ options, widgets, onChange, className, static: isStatic, forcePositionSync, }: F0GridStackProps_2): JSX_2.Element;
9310
9444
  displayName: string;
@@ -11048,6 +11182,8 @@ declare type FontSize = (typeof fontSizes)[number];
11048
11182
 
11049
11183
  declare const fontSizes: readonly ["sm", "md", "lg"];
11050
11184
 
11185
+ export declare const formatPlaybackTime: (seconds: number) => string;
11186
+
11051
11187
  /**
11052
11188
  * A preset formatting instruction the LLM can specify instead of a
11053
11189
  * real formatter function. The wrapper component maps these to actual
@@ -11339,6 +11475,97 @@ export declare const granularityDefinitions: {
11339
11475
 
11340
11476
  export declare type GranularityDefinitionSimple = Pick<GranularityDefinition, "toRangeString" | "toString">;
11341
11477
 
11478
+ declare type GraphCollectionProps<Record extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<Record>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<Record>> = CollectionProps<Record, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping, GraphVisualizationOptions<Record, Filters, Sortings>>;
11479
+
11480
+ /**
11481
+ * Configuration for the "graph" visualization (org-chart style).
11482
+ *
11483
+ * The hierarchy is fetched on demand from the same `dataAdapter` of the source:
11484
+ * `childrenFilters(parentId)` returns the filter that the adapter understands as
11485
+ * "the direct children of parentId" (`null` = the roots). Children are loaded
11486
+ * when a node is expanded.
11487
+ */
11488
+ declare type GraphVisualizationOptions<R extends RecordType, Filters extends FiltersDefinition, _Sortings extends SortingsDefinition> = {
11489
+ /** Primary line of text for a node. */
11490
+ title: (record: R) => string;
11491
+ /** Secondary line of text for a node. */
11492
+ subtitle?: (record: R) => string;
11493
+ /** Avatar shown on the leading side of the node pill. */
11494
+ avatar?: (record: R) => AvatarVariant;
11495
+ /** Tags rendered in the node metadata row. */
11496
+ tags?: (record: R) => TagVariant[];
11497
+ /**
11498
+ * Tag types present on the nodes. When provided, the controls bar gains a
11499
+ * toggle to show/hide each metadata type (like configuring table columns).
11500
+ */
11501
+ nodeTagTypes?: ReadonlyArray<F0GraphNodeTagType>;
11502
+ /** Friendly labels per tag type, shown in the metadata visibility toggle. */
11503
+ nodeTagTypeLabels?: Partial<Record<F0GraphNodeTagType, string>>;
11504
+ /** Tag types visible by default. Defaults to all of `nodeTagTypes`. */
11505
+ defaultVisibleTagTypes?: ReadonlyArray<F0GraphNodeTagType>;
11506
+ /** Tag types that are always visible and cannot be hidden in the settings. */
11507
+ pinnedTagTypes?: ReadonlyArray<F0GraphNodeTagType>;
11508
+ /**
11509
+ * Floating toolbar shown above a node while it is selected. Provide the
11510
+ * action buttons (e.g. `<F0Button size="sm" … />`) for the given record.
11511
+ */
11512
+ nodeActions?: (record: R) => ReactNode;
11513
+ /** Resolves a stable node id from a record. Defaults to `String(record.id)`. */
11514
+ getNodeId?: (record: R) => string;
11515
+ /** Number of children a node has. A node is expandable when this is `> 0`. */
11516
+ getChildrenCount: (record: R) => number;
11517
+ /**
11518
+ * Returns the filters that, applied to the source `dataAdapter`, fetch the
11519
+ * direct children of `parentId`. `parentId === null` must return the roots.
11520
+ */
11521
+ childrenFilters: (parentId: string | null) => Partial<FiltersState<Filters>>;
11522
+ /**
11523
+ * How many levels to load and expand on the initial render.
11524
+ * - `0`: show only the roots; every level below loads on click.
11525
+ * - `1` (default): also show the roots' direct children.
11526
+ * - `2`: also pre-load the grandchildren for a fuller first view.
11527
+ */
11528
+ defaultExpandDepth?: number;
11529
+ /**
11530
+ * Id of a node to reveal: loads its ancestor path, expands the branch and
11531
+ * centers/highlights it. Driven by the shared Data Collection search — set it
11532
+ * from `searchPreview.onSelect`.
11533
+ */
11534
+ revealNodeId?: string;
11535
+ /**
11536
+ * Resolves the ancestor path (root → … → matched node) for a node so it can
11537
+ * be revealed, returning the records in root-first order. Required for
11538
+ * revealing nodes in branches that have not been expanded yet.
11539
+ */
11540
+ loadNodePath?: (nodeId: string) => Promise<R[]>;
11541
+ /** Optional parent accessor used when linking the revealed ancestor path. */
11542
+ getParentId?: (record: R) => string | null;
11543
+ /**
11544
+ * Id of the node representing the current user. When set, a "Find me" button
11545
+ * is shown in the controls that centers the viewport on that node.
11546
+ */
11547
+ currentUserNodeId?: string;
11548
+ /** Initial zoom preset passed through to F0Graph. */
11549
+ zoomPreset?: ZoomPreset;
11550
+ /**
11551
+ * Smallest zoom the user can pan to (the zoom-out limit), passed through to
11552
+ * F0Graph. Defaults to F0Graph's own default. Raise it (e.g. `0.3`) to keep
11553
+ * the tree readable and avoid the most zoomed-out "dot" level.
11554
+ */
11555
+ minZoom?: number;
11556
+ /** Largest zoom the user can pan to (the zoom-in limit), passed through to F0Graph. */
11557
+ maxZoom?: number;
11558
+ /** Whether to render the zoom/fit controls. Defaults to `true`. */
11559
+ showControls?: boolean;
11560
+ };
11561
+
11562
+ declare type GraphVisualizationSettings = {
11563
+ /** Metadata order (tag-type ids), matching the table column settings shape. */
11564
+ order?: string[];
11565
+ /** Hidden metadata (tag-type ids). */
11566
+ hidden?: string[];
11567
+ };
11568
+
11342
11569
  export declare type GridStackReactOptions = Omit<GridStackOptions, "children">;
11343
11570
 
11344
11571
  export declare type GridStackReactSize = {
@@ -14132,6 +14359,26 @@ declare type SearchOptions = {
14132
14359
  debounceTime?: number;
14133
14360
  };
14134
14361
 
14362
+ /**
14363
+ * Optional rich search preview shown in the shared Data Collection search.
14364
+ * When provided, typing in the header search renders a results dropdown with
14365
+ * avatar + title + subtitle, consistent across every visualization. Selecting a
14366
+ * result calls `onSelect` (e.g. the graph view reveals/centers the node).
14367
+ */
14368
+ declare type SearchPreview<R extends RecordType> = {
14369
+ search: (query: string) => Promise<R[]>;
14370
+ getId: (record: R) => string;
14371
+ render: (record: R) => SearchPreviewResultData;
14372
+ onSelect: (record: R) => void;
14373
+ };
14374
+
14375
+ /** Data shown for a single row of the search preview dropdown. */
14376
+ declare type SearchPreviewResultData = {
14377
+ avatar?: AvatarVariant;
14378
+ title: string;
14379
+ subtitle?: string;
14380
+ };
14381
+
14135
14382
  declare interface SecondaryAction extends PrimaryActionButton {
14136
14383
  variant?: "outline" | "critical" | "outlinePromote" | "promote";
14137
14384
  }
@@ -15391,6 +15638,17 @@ export declare function useAiChat(): AiChatProviderReturnValue;
15391
15638
 
15392
15639
  export declare function useAiChatTranslations(): AiChatTranslations;
15393
15640
 
15641
+ export declare const useAudioPlayer: (audioRef: RefObject<HTMLAudioElement>, callbacks?: UseAudioPlayerCallbacks) => AudioPlayerControls;
15642
+
15643
+ declare interface UseAudioPlayerCallbacks {
15644
+ onPlay?: () => void;
15645
+ onPause?: () => void;
15646
+ onSeek?: (seconds: number) => void;
15647
+ onTimeUpdate?: (seconds: number) => void;
15648
+ onEnded?: () => void;
15649
+ onError?: (error: MediaError | null) => void;
15650
+ }
15651
+
15394
15652
  /**
15395
15653
  * Hook returning the canvas entity definition for `type` from the registry
15396
15654
  * supplied to `F0AiChatProvider.canvasEntities`. Returns `undefined` when no
@@ -16372,6 +16630,26 @@ export declare type ZIndexToken = "auto" | "0" | "10" | "20" | "30" | "40" | "50
16372
16630
  */
16373
16631
  declare type ZodTypeName = "ZodString" | "ZodNumber" | "ZodBoolean" | "ZodDate" | "ZodEnum" | "ZodArray" | "ZodObject" | "ZodOptional" | "ZodNullable" | "ZodDefault" | "ZodLiteral" | "ZodEffects";
16374
16632
 
16633
+ declare type ZoomPreset = keyof typeof zoomPresets;
16634
+
16635
+ declare const zoomPresets: {
16636
+ readonly default: {
16637
+ readonly detail: 0.56;
16638
+ readonly compact: 0.3;
16639
+ readonly dot: 0.18;
16640
+ };
16641
+ readonly dense: {
16642
+ readonly detail: 0.5;
16643
+ readonly compact: 0.2;
16644
+ readonly dot: 0.08;
16645
+ };
16646
+ readonly sparse: {
16647
+ readonly detail: 0.85;
16648
+ readonly compact: 0.45;
16649
+ readonly dot: 0.15;
16650
+ };
16651
+ };
16652
+
16375
16653
  export { }
16376
16654
 
16377
16655