@factorialco/f0-react 2.55.3 → 2.56.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/ai.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as e, F as r, a as t, e as o, f as i, c as n, d as F, I as C, P as A, b as l, u as d } from "./F0CanvasPanel-Dr0WIoJu.js";
1
+ import { D as e, F as r, a as t, e as o, f as i, c as n, d as F, I as C, P as A, b as l, u as d } from "./F0CanvasPanel-BBAGq4mG.js";
2
2
  import { defaultTranslations as m } from "./i18n-provider-defaults.js";
3
- import { A as c, C as I, h as P, t as v, v as f, x as p, n as T, j as g, r as y, y as S, q as x, s as H, k as V, e as b, g as k, l as w, F as M, i as O, a as D, p as j, m as q, o as z, b as B, f as E, w as L, c as R, d as G, u as J } from "./useChatHistory-Dkrf7Ox1.js";
3
+ import { A as c, C as I, h as P, t as v, v as f, x as p, n as T, j as g, r as y, y as S, q as x, s as H, k as V, e as b, g as k, l as w, F as M, i as O, a as D, p as j, m as q, o as z, b as B, f as E, w as L, c as R, d as G, u as J } from "./useChatHistory-CXP7hGgJ.js";
4
4
  export {
5
5
  c as AiChatTranslationsProvider,
6
6
  I as ChatSpinner,
@@ -24,6 +24,7 @@ import { CompanyCellValue as CompanyCellValue_2 } from './experimental';
24
24
  import { CompanyItemProps } from './types';
25
25
  import { ComponentProps } from 'react';
26
26
  import { CompoundCellValue } from './types/compound';
27
+ import { Context } from 'react';
27
28
  import { CountCellValue } from './types/count';
28
29
  import { CountryCellValue } from './types/country';
29
30
  import { DateCellValue } from './types/date';
@@ -80,6 +81,7 @@ import { ProgressBarCellValue } from './types/progressBar';
80
81
  import { ProgressBarCellValue as ProgressBarCellValue_2 } from './experimental';
81
82
  import { Props as Props_5 } from './types';
82
83
  import { PropsWithChildren } from 'react';
84
+ import { Provider } from 'react';
83
85
  import { RadarChartProps } from './RadarChart';
84
86
  import * as React_2 from 'react';
85
87
  import { ReactElement } from 'react';
@@ -726,6 +728,18 @@ export declare interface ApplicationFrameProps {
726
728
  children: React.ReactNode;
727
729
  }
728
730
 
731
+ /**
732
+ * The slice of persisted collection state that was actually applied to the
733
+ * data source during hydration. `sortings: null` means the user had
734
+ * explicitly cleared the sorting on the originating list.
735
+ */
736
+ export declare type AppliedCollectionState<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Grouping extends GroupingDefinition<R>> = {
737
+ filters?: FiltersState<Filters>;
738
+ sortings?: SortingsState<Sortings>;
739
+ search?: string;
740
+ grouping?: GroupingState<R, Grouping>;
741
+ };
742
+
729
743
  declare const ApprovalStep: FC<ApprovalStepProps>;
730
744
 
731
745
  declare type ApprovalStepProps = {
@@ -2534,6 +2548,10 @@ declare type DataCollectionStatusComplete<CurrentFiltersState extends FiltersSta
2534
2548
  settings?: DataCollectionSettings;
2535
2549
  };
2536
2550
 
2551
+ declare type DataCollectionStorage<CurrentFiltersState extends FiltersState<FiltersDefinition> = FiltersState<FiltersDefinition>> = {
2552
+ settings?: DataCollectionSettings;
2553
+ } & DataCollectionStatus<CurrentFiltersState>;
2554
+
2537
2555
  declare type DataCollectionStorageFeature = (typeof dataCollectionStorageFeatures)[number];
2538
2556
 
2539
2557
  /**
@@ -2705,6 +2723,8 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
2705
2723
  }) => number | undefined;
2706
2724
  };
2707
2725
 
2726
+ declare type DataSourceItemId = string | number | symbol;
2727
+
2708
2728
  declare type DateCellConfig = {
2709
2729
  /** Earliest selectable date. Dates before this are disabled in the picker. */
2710
2730
  minDate?: Date;
@@ -6785,6 +6805,27 @@ export declare type PageBasedPaginatedResponse<TRecord> = BasePaginatedResponse<
6785
6805
 
6786
6806
  export declare function PageHeader({ module, statusTag, breadcrumbs, actions, embedded, navigation, productUpdates, favorites, oneSwitchTooltip, oneSwitchAutoOpen, }: HeaderProps): JSX_2.Element;
6787
6807
 
6808
+ export declare type PageHeaderItemNavigationInput<R extends RecordType> = Pick<UseDataSourceItemNavigationReturn<R>, "previousItem" | "nextItem" | "previousItemUrl" | "nextItemUrl" | "absoluteIndex" | "totalItems" | "activeIndex">;
6809
+
6810
+ export declare const PageHeaderNavigationContext: Context<NavigationProps | null>;
6811
+
6812
+ /**
6813
+ * Provider that lets a page component inject navigation data into PageHeader
6814
+ * without needing to pass it down as a prop. PageHeader reads this context
6815
+ * only when its own `navigation` prop is undefined, so the prop always wins.
6816
+ *
6817
+ * @example
6818
+ * ```tsx
6819
+ * const { navigation } = useDataCollectionItemNavigation({ source, collectionId, activeItemId })
6820
+ * return (
6821
+ * <PageHeaderNavigationProvider value={navigation}>
6822
+ * <MyDetailPage />
6823
+ * </PageHeaderNavigationProvider>
6824
+ * )
6825
+ * ```
6826
+ */
6827
+ export declare const PageHeaderNavigationProvider: Provider<NavigationProps | null>;
6828
+
6788
6829
  export declare function PageNavigation({ previous, next, counter }: NavigationProps): JSX_2.Element;
6789
6830
 
6790
6831
  declare interface PageProps {
@@ -7469,6 +7510,45 @@ declare type SectionProps = {
7469
7510
  onItemVisible?: (id: string) => void;
7470
7511
  };
7471
7512
 
7513
+ export declare interface SeedableDefinition<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Grouping extends GroupingDefinition<R>> {
7514
+ filters?: Filters;
7515
+ sortings?: Sortings;
7516
+ search?: SearchOptions;
7517
+ grouping?: Grouping;
7518
+ }
7519
+
7520
+ /**
7521
+ * Applies a OneDataCollection's persisted state onto a data source's runtime
7522
+ * setters, validating every piece against the declared definition first so
7523
+ * stale persisted keys (schema drift, renamed filters) never reach the
7524
+ * adapter.
7525
+ *
7526
+ * - Filters: resolved per-visualization (`visualizationFilters` wins over
7527
+ * `filters`), then pruned to the keys declared in `definition.filters`.
7528
+ * - Sortings: a single `{ field, order } | null` — `null` is an explicit
7529
+ * user "clear sorting" and is applied; `undefined` keeps the defaults.
7530
+ * - Search: applied only when the definition enables search.
7531
+ * - Grouping: applied only when the persisted field is a declared groupBy —
7532
+ * grouping changes record order, and prev/next must match the list.
7533
+ *
7534
+ * Pure besides invoking the given setters. Returns what was applied, or null
7535
+ * when the storage contributed nothing.
7536
+ */
7537
+ export declare function seedFromStorage<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Grouping extends GroupingDefinition<R>>(storage: DataCollectionStorage<FiltersState<Filters>>, definition: SeedableDefinition<R, Filters, Sortings, Grouping>, target: SeedTarget<R, Filters, Sortings, Grouping>): AppliedCollectionState<R, Filters, Sortings, Grouping> | null;
7538
+
7539
+ export declare interface SeedTarget<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Grouping extends GroupingDefinition<R>> {
7540
+ setCurrentFilters: (filters: FiltersState<Filters>) => void;
7541
+ setCurrentSortings: (sortings: {
7542
+ field: keyof Sortings;
7543
+ order: "asc" | "desc";
7544
+ } | null) => void;
7545
+ setCurrentSearch: (search: string | undefined) => void;
7546
+ setCurrentGrouping: (grouping: {
7547
+ field: keyof Grouping["groupBy"];
7548
+ order?: "asc" | "desc";
7549
+ } | undefined) => void;
7550
+ }
7551
+
7472
7552
  /**
7473
7553
  * @experimental This is an experimental component use it at your own risk
7474
7554
  */
@@ -8343,6 +8423,107 @@ declare type UseDataCollectionDataReturn<R extends RecordType> = UseDataReturn<R
8343
8423
  summaries?: R;
8344
8424
  };
8345
8425
 
8426
+ /**
8427
+ * Item navigation (prev/next + counter + PageHeader wiring) fed from a
8428
+ * **declared** data collection source definition plus the `collectionId` of
8429
+ * the originating list — not from a mounted collection.
8430
+ *
8431
+ * Because it never needs the list mounted, it works on a direct link / hard
8432
+ * refresh of a detail page: the persisted filters/sortings/search the list
8433
+ * wrote through the data collection storage handler are read by
8434
+ * `collectionId`, validated against the definition, and seeded into the
8435
+ * source before the first fetch (exactly one fetch, with the right state).
8436
+ *
8437
+ * Persisted state intentionally wins over `source.currentFilters` /
8438
+ * `currentSortings`: the definition values apply on mount and the hydrated
8439
+ * state lands right after, mirroring what the user last saw on the list.
8440
+ *
8441
+ * @example
8442
+ * ```tsx
8443
+ * const { navigation } = useDataCollectionItemNavigation({
8444
+ * source: employeesSourceDefinition, // same definition the list uses
8445
+ * collectionId: "organization/employees/v1", // same id the list uses
8446
+ * activeItemId: routeParams.employeeId,
8447
+ * getItemTitle: (employee) => employee.name,
8448
+ * })
8449
+ * return (
8450
+ * <PageHeaderNavigationProvider value={navigation}>
8451
+ * <EmployeeDetailPage />
8452
+ * </PageHeaderNavigationProvider>
8453
+ * )
8454
+ * ```
8455
+ */
8456
+ export declare function useDataCollectionItemNavigation<R extends RecordType = RecordType, Filters extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Summaries extends SummariesDefinition = SummariesDefinition, ItemActions extends ItemActionsDefinition<R> = ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition = NavigationFiltersDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>>(props: UseDataCollectionItemNavigationProps<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>): UseDataCollectionItemNavigationReturn<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
8457
+
8458
+ export declare interface UseDataCollectionItemNavigationProps<R extends RecordType = RecordType, Filters extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Summaries extends SummariesDefinition = SummariesDefinition, ItemActions extends ItemActionsDefinition<R> = ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition = NavigationFiltersDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>> {
8459
+ /**
8460
+ * The declared data source definition — the same one the originating list
8461
+ * passes to `useDataCollectionSource` / `OneDataCollection`. `itemUrl`
8462
+ * comes from here unless overridden.
8463
+ */
8464
+ source: DataCollectionSourceDefinition<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
8465
+ /**
8466
+ * The `id` of the originating `OneDataCollection` (e.g.
8467
+ * `organization/employees/v1`). Its persisted filters/sortings/search are
8468
+ * read through the data collection storage handler and seeded into the
8469
+ * source, so navigation matches what the user saw on the list — even on a
8470
+ * direct link where the list was never mounted.
8471
+ */
8472
+ collectionId: string;
8473
+ /** Controlled active item ID — typically the detail route param. */
8474
+ activeItemId?: DataSourceItemId | null;
8475
+ /** Default active item ID for uncontrolled usage. */
8476
+ defaultActiveItemId?: DataSourceItemId | null;
8477
+ /** Callback fired whenever the active item changes. */
8478
+ onActiveItemChange?: (id: DataSourceItemId | null) => void;
8479
+ /** Overrides the source idProvider. */
8480
+ idProvider?: (item: R, index?: number) => DataSourceItemId;
8481
+ /** Overrides `source.itemUrl`. */
8482
+ itemUrl?: (item: R) => string | undefined;
8483
+ /** Accessible titles for the PageHeader prev/next links. */
8484
+ getItemTitle?: (item: R) => string;
8485
+ /**
8486
+ * Gates everything: while false neither the persisted state is read nor
8487
+ * any data fetched.
8488
+ * @default true
8489
+ */
8490
+ enabled?: boolean;
8491
+ /**
8492
+ * When false, skips reading the persisted collection state and fetches
8493
+ * with the definition defaults.
8494
+ * @default true
8495
+ */
8496
+ restorePersistedState?: boolean;
8497
+ /**
8498
+ * Forwarded to `useDataCollectionSource` for `dataAdapter` memoization,
8499
+ * same convention as `useDataCollectionSource(source, deps)`.
8500
+ */
8501
+ deps?: ReadonlyArray<unknown>;
8502
+ }
8503
+
8504
+ export declare interface UseDataCollectionItemNavigationReturn<R extends RecordType = RecordType, Filters extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Summaries extends SummariesDefinition = SummariesDefinition, ItemActions extends ItemActionsDefinition<R> = ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition = NavigationFiltersDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>> extends UseDataSourceItemNavigationReturn<R> {
8505
+ /** True once persisted state was applied AND the first fetch resolved. */
8506
+ isReady: boolean;
8507
+ /**
8508
+ * Render-ready PageHeader navigation. Pass it to the `navigation` prop or
8509
+ * inject it via `PageHeaderNavigationProvider`. Null while there is
8510
+ * nothing useful to render (e.g. the active item is not in the loaded
8511
+ * window on a deep direct link).
8512
+ */
8513
+ navigation: NavigationProps | null;
8514
+ /**
8515
+ * What was actually read and applied from the persisted collection state,
8516
+ * or null when nothing was (empty storage, restore disabled, read error).
8517
+ */
8518
+ appliedCollectionState: AppliedCollectionState<R, Filters, Sortings, Grouping> | null;
8519
+ /** The runtime data source created from the definition (escape hatch). */
8520
+ dataSource: DataCollectionSource<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
8521
+ /** The fetched data backing the navigation (escape hatch). */
8522
+ data: Data<R>;
8523
+ paginationInfo: PaginationInfo | null;
8524
+ isLoading: boolean;
8525
+ }
8526
+
8346
8527
  export declare const useDataCollectionSource: <R extends RecordType = RecordType, FiltersSchema extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Summaries extends SummariesDefinition = SummariesDefinition, ItemActions extends ItemActionsDefinition<R> = ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition = NavigationFiltersDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>>(source: DataCollectionSourceDefinition<R, FiltersSchema, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>, deps?: ReadonlyArray<unknown>) => DataCollectionSource<R, FiltersSchema, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>;
8347
8528
 
8348
8529
  /**
@@ -8350,6 +8531,14 @@ export declare const useDataCollectionSource: <R extends RecordType = RecordType
8350
8531
  */
8351
8532
  declare interface UseDataOptions<R extends RecordType, Filters extends FiltersDefinition> {
8352
8533
  filters?: Partial<FiltersState<Filters>>;
8534
+ /**
8535
+ * When false, suspends all data fetching: the initial fetch effect does not
8536
+ * run until `enabled` becomes true. Useful to delay the first fetch until
8537
+ * async state (e.g. persisted filters) has been applied to the source.
8538
+ * `isInitialLoading` stays true while disabled.
8539
+ * @default true
8540
+ */
8541
+ enabled?: boolean;
8353
8542
  /**
8354
8543
  * A function that is called when an error occurs during data fetching.
8355
8544
  * It is called with the error object.
@@ -8389,6 +8578,43 @@ declare interface UseDataReturn<R extends RecordType> {
8389
8578
  mergedFilters: FiltersState<FiltersDefinition>;
8390
8579
  }
8391
8580
 
8581
+ declare interface UseDataSourceItemNavigationReturn<R extends RecordType> {
8582
+ /** The currently active item ID */
8583
+ activeItemId: DataSourceItemId | null;
8584
+ /** The currently active item record, or null if not found in loaded data */
8585
+ activeItem: R | null;
8586
+ /** The active item index within the currently loaded records */
8587
+ activeIndex: number;
8588
+ /** The active item index within the full collection when it can be inferred */
8589
+ absoluteIndex: number | null;
8590
+ /** Number of records currently loaded into the datasource */
8591
+ loadedItemsCount: number;
8592
+ /** Total number of matching records when pagination exposes it */
8593
+ totalItems: number | undefined;
8594
+ /** The previous loaded item record, or null if unavailable */
8595
+ previousItem: R | null;
8596
+ /** The next loaded item record, or null if unavailable */
8597
+ nextItem: R | null;
8598
+ /** URL of the active item (derived via `itemUrl`), or null if unavailable */
8599
+ activeItemUrl: string | null;
8600
+ /** Navigate to the next item. Fetches next page if at boundary */
8601
+ goToNext: () => void;
8602
+ /** Navigate to the previous item. Fetches previous page if at boundary */
8603
+ goToPrevious: () => void;
8604
+ /** Whether there is a next item (or more pages to load) */
8605
+ hasNext: boolean;
8606
+ /** Whether there is a previous item (or previous pages to load) */
8607
+ hasPrevious: boolean;
8608
+ /** Directly set the active item ID */
8609
+ setActiveItemId: (id: DataSourceItemId | null) => void;
8610
+ /** True while waiting for a page transition to resolve the pending navigation */
8611
+ isNavigating: boolean;
8612
+ /** URL of the next loaded item (derived via `itemUrl`), or null if unavailable */
8613
+ nextItemUrl: string | null;
8614
+ /** URL of the previous loaded item (derived via `itemUrl`), or null if unavailable */
8615
+ previousItemUrl: string | null;
8616
+ }
8617
+
8392
8618
  export declare function useExportAction<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>>({ source, currentVisualization, filename, enabled, }: UseExportActionProps<R, Filters, Sortings, Summaries, ItemActions, NavigationFilters, Grouping>): SecondaryActionItem;
8393
8619
 
8394
8620
  declare interface UseExportActionProps<R extends RecordType, Filters extends FiltersDefinition, Sortings extends SortingsDefinition, Summaries extends SummariesDefinition, ItemActions extends ItemActionsDefinition<R>, NavigationFilters extends NavigationFiltersDefinition, Grouping extends GroupingDefinition<R>> {
@@ -8405,6 +8631,35 @@ export declare const useInfiniteScrollPagination: (paginationInfo: PaginationInf
8405
8631
  loadingIndicatorRef: RefObject<HTMLTableCellElement>;
8406
8632
  };
8407
8633
 
8634
+ /**
8635
+ * Converts an item-navigation result into the `NavigationProps` shape that
8636
+ * `PageHeader` accepts (directly or via `PageHeaderNavigationProvider`).
8637
+ *
8638
+ * URLs are read from `previousItemUrl` / `nextItemUrl`, which are computed by
8639
+ * the `itemUrl` option on the navigation hook. A null URL omits that link
8640
+ * (the button renders disabled). The counter is included only when both the
8641
+ * absolute position and the total are known — never a misleading `0/n`.
8642
+ *
8643
+ * Returns null when there is nothing useful to render (no input, or the
8644
+ * active item could not be located and no total is known), so it can be
8645
+ * passed straight to `PageHeaderNavigationProvider`.
8646
+ */
8647
+ export declare function usePageHeaderItemNavigation<R extends RecordType>(nav: PageHeaderItemNavigationInput<R> | null, config?: UsePageHeaderItemNavigationConfig<R>): NavigationProps | null;
8648
+
8649
+ export declare interface UsePageHeaderItemNavigationConfig<R extends RecordType> {
8650
+ /**
8651
+ * Returns a human-readable title for a navigation link. Used as the
8652
+ * accessible label on the prev/next buttons.
8653
+ */
8654
+ getItemTitle?: (item: R) => string;
8655
+ }
8656
+
8657
+ /**
8658
+ * Returns the navigation value injected by the nearest
8659
+ * `PageHeaderNavigationProvider`, or null when no provider is present.
8660
+ */
8661
+ export declare function usePageHeaderNavigation(): NavigationProps | null;
8662
+
8408
8663
  export declare interface User {
8409
8664
  id: string;
8410
8665
  fullname: string;