@proveanything/smartlinks-utils-ui 0.10.9 → 0.11.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.
@@ -770,6 +770,17 @@ interface ItemColumn<TData = unknown> {
770
770
  width?: string;
771
771
  /** Right-align the cell (numeric columns). */
772
772
  align?: 'left' | 'right' | 'center';
773
+ /**
774
+ * When supplied, the column header becomes clickable and toggles
775
+ * asc → desc → none on the loaded records. The framework sorts
776
+ * client-side over whatever pages have been fetched; if more pages
777
+ * exist a small "Sorting first N — Load more for full set" hint is
778
+ * shown above the table so admins know they're sorting a subset.
779
+ *
780
+ * Return a primitive (`string` / `number` / `Date` / `boolean`) — the
781
+ * framework handles nulls (always sorted last) and stable ordering.
782
+ */
783
+ sortBy?: (record: RecordSummary<TData>) => string | number | Date | boolean | null | undefined;
773
784
  }
774
785
  /**
775
786
  * Context passed to right-pane item-view slot renderers.
@@ -1008,6 +1019,15 @@ interface RailConfig<TData = unknown> {
1008
1019
  onGroupExpanded?: (key: string) => void;
1009
1020
  /** Visual density. Default `comfortable`. */
1010
1021
  density?: 'comfortable' | 'compact';
1022
+ /**
1023
+ * Page size requested from the SDK for the records-driven rail
1024
+ * (Rules / Global / All tabs). Default 100. Raise for apps that
1025
+ * routinely have hundreds of rule-targeted records and want fewer
1026
+ * "Load more" clicks; lower to reduce initial payload on large
1027
+ * collections. The footer remains visible whenever more pages exist
1028
+ * so admins always have a path to record N+1.
1029
+ */
1030
+ pageSize?: number;
1011
1031
  }
1012
1032
  interface EditorPreviewConfig<TData = unknown> {
1013
1033
  /**
@@ -1077,6 +1097,26 @@ interface ItemsConfig<TData = unknown> {
1077
1097
  * `{ ...base, label: rec.data?.headline ?? base.label }`).
1078
1098
  */
1079
1099
  toSummary?: (rec: AppRecord, base: RecordSummary<TData>) => RecordSummary<TData>;
1100
+ /**
1101
+ * Page size requested from the SDK for the right-pane item list (and
1102
+ * the sibling rail, since both share `useCollectionItems`). Default
1103
+ * 100. Raise for apps where a single scope routinely holds hundreds
1104
+ * of items (votes, attestations, ledger entries) so admins don't
1105
+ * have to "Load more" on every visit. The footer always renders when
1106
+ * more pages exist — the goal is to never silently truncate.
1107
+ */
1108
+ pageSize?: number;
1109
+ /**
1110
+ * Optional projector returning extra strings to include in the
1111
+ * built-in item-list search match. The framework always searches
1112
+ * `label` + `subtitle`; this hook lets hosts add fields that aren't
1113
+ * on the summary (e.g. body text, tags, internal codes).
1114
+ *
1115
+ * Set `searchable: false` to disable the search box entirely.
1116
+ */
1117
+ searchableFields?: (record: RecordSummary<TData>) => Array<string | undefined | null>;
1118
+ /** Disable the built-in search input. Default `true` (enabled). */
1119
+ searchable?: boolean;
1080
1120
  }
1081
1121
  interface UnsavedConfig<TData = unknown> {
1082
1122
  /**
@@ -2082,9 +2122,25 @@ declare const useScopeCounts: (args: UseScopeCountsArgs) => UseScopeCountsResult
2082
2122
  /** React Query key factory for cache invalidation from save/delete sites. */
2083
2123
  declare const scopeCountsQueryKey: (collectionId: string, appId: string, recordType?: string) => (string | null)[];
2084
2124
 
2085
- declare const useIntroDismissed: (SL: SmartLinksSDK, collectionId: string, appId: string, recordType?: string) => {
2125
+ /**
2126
+ * Records-admin intro dismiss state. Thin shim over the library-level
2127
+ * `useIntroState` so the shell shares one persistence model with every
2128
+ * other admin app:
2129
+ *
2130
+ * • Global "show inline help" preference on the user record
2131
+ * (`SL.userAppData('prefs').showHints`) — flipped once, applies
2132
+ * everywhere. When `false` the intro is collapsed by default but the
2133
+ * `?` reopen button is still rendered.
2134
+ * • Per-browser, per-app temporary dismiss in `localStorage`
2135
+ * (`sl:intro-dismissed:${appId}[:recordType]`).
2136
+ *
2137
+ * `collectionId` is no longer used (the old per-collection persistence on
2138
+ * `appConfiguration._meta.introDismissed` was removed) but kept in the
2139
+ * signature for back-compat with existing callers.
2140
+ */
2141
+ declare const useIntroDismissed: (SL: SmartLinksSDK, _collectionId: string, appId: string, recordType?: string) => {
2086
2142
  dismissed: boolean;
2087
- dismiss: () => Promise<void>;
2143
+ dismiss: () => void;
2088
2144
  undismiss: () => void;
2089
2145
  };
2090
2146
 
@@ -2444,9 +2500,25 @@ interface Props$5<T> {
2444
2500
  onCopy?: () => void;
2445
2501
  onDuplicate?: () => void;
2446
2502
  } | null;
2503
+ /**
2504
+ * Optional projector returning extra strings to include in the search
2505
+ * match. Framework always searches `label` + `subtitle`.
2506
+ */
2507
+ searchableFields?: (record: RecordSummary<T>) => Array<string | undefined | null>;
2508
+ /** Disable the search box. Default `true`. */
2509
+ searchable?: boolean;
2510
+ /**
2511
+ * Pagination — when the underlying `useCollectionItems` reports more
2512
+ * pages, the list renders a footer with "Showing X of Y · Load more"
2513
+ * so admins always have a path to record N+1.
2514
+ */
2515
+ total?: number;
2516
+ hasNextPage?: boolean;
2517
+ isFetchingNextPage?: boolean;
2518
+ onLoadMore?: () => void;
2447
2519
  i18n: RecordsAdminI18n;
2448
2520
  }
2449
- declare function ItemListView<T>({ items, isLoading, error, ctx, itemNoun, ruleSummary, view, views, onViewChange, renderItemList, renderItemCard, renderItemEmpty, itemColumns, cardSize, rowActions, rowClipboard, i18n, }: Props$5<T>): react_jsx_runtime.JSX.Element;
2521
+ declare function ItemListView<T>({ items, isLoading, error, ctx, itemNoun, ruleSummary, view, views, onViewChange, renderItemList, renderItemCard, renderItemEmpty, itemColumns, cardSize, rowActions, rowClipboard, searchableFields, searchable, total, hasNextPage, isFetchingNextPage, onLoadMore, i18n, }: Props$5<T>): react_jsx_runtime.JSX.Element;
2450
2522
 
2451
2523
  interface Props$4 {
2452
2524
  options: ItemView[];
@@ -2456,12 +2528,23 @@ interface Props$4 {
2456
2528
  }
2457
2529
  declare const ItemViewSwitcher: ({ options, value, onChange, i18n }: Props$4) => react_jsx_runtime.JSX.Element | null;
2458
2530
 
2531
+ type SortDir = 'asc' | 'desc' | null;
2532
+ interface SortState {
2533
+ key: string | null;
2534
+ dir: SortDir;
2535
+ }
2459
2536
  interface Props$3<T> {
2460
2537
  items: RecordSummary<T>[];
2461
2538
  columns?: ItemColumn<T>[];
2462
2539
  selectedId?: string;
2463
2540
  onOpen: (itemId: string) => void;
2464
2541
  onDelete: (itemId: string) => void;
2542
+ /** Current sort state (controlled by ItemListView). */
2543
+ sort?: SortState;
2544
+ /** Toggle sort for a given column key (asc → desc → none). */
2545
+ onToggleSort?: (key: string) => void;
2546
+ /** Sort key + direction for the fallback (label / updated) columns. */
2547
+ fallbackSortKey?: 'label' | 'updated';
2465
2548
  /** Host-supplied per-record menu actions for each row's `…` kebab. */
2466
2549
  rowActions?: (record: RecordSummary<T>) => RecordAction[] | null | undefined;
2467
2550
  /** Per-record Copy / Duplicate wiring from the shell clipboard. */
@@ -2471,7 +2554,7 @@ interface Props$3<T> {
2471
2554
  } | null;
2472
2555
  i18n: Pick<RecordsAdminI18n, 'itemColumnLabel' | 'itemColumnUpdated' | 'itemActions' | 'delete'>;
2473
2556
  }
2474
- declare function DefaultItemTable<T>({ items, columns, selectedId, onOpen, onDelete, rowActions, rowClipboard, i18n, }: Props$3<T>): react_jsx_runtime.JSX.Element;
2557
+ declare function DefaultItemTable<T>({ items, columns, selectedId, onOpen, onDelete, sort, onToggleSort, rowActions, rowClipboard, i18n, }: Props$3<T>): react_jsx_runtime.JSX.Element;
2475
2558
 
2476
2559
  interface Props$2<T> {
2477
2560
  items: RecordSummary<T>[];
@@ -2548,9 +2631,14 @@ interface Props<T> {
2548
2631
  dirtyKeys?: ReadonlySet<string>;
2549
2632
  /** Subset of `dirtyKeys` whose last save attempt failed. */
2550
2633
  errorKeys?: ReadonlySet<string>;
2634
+ /** Pagination passthrough from `useCollectionItems`. */
2635
+ total?: number;
2636
+ hasNextPage?: boolean;
2637
+ isFetchingNextPage?: boolean;
2638
+ onLoadMore?: () => void;
2551
2639
  i18n: Pick<RecordsAdminI18n, 'backToScopes' | 'siblingsHeading' | 'noItemsTitle' | 'noItemsBody' | 'backToList' | 'newItem'>;
2552
2640
  }
2553
- declare function SiblingRail<T>({ items, selectedItemId, isLoading, error, onBack, onSelect, contextKind, contextSummary, onCreate, itemNoun, dirtyKeys, errorKeys, i18n, }: Props<T>): react_jsx_runtime.JSX.Element;
2641
+ declare function SiblingRail<T>({ items, selectedItemId, isLoading, error, onBack, onSelect, contextKind, contextSummary, onCreate, itemNoun, dirtyKeys, errorKeys, i18n, total, hasNextPage, isFetchingNextPage, onLoadMore, }: Props<T>): react_jsx_runtime.JSX.Element;
2554
2642
 
2555
2643
  interface ClipboardEntry<T = unknown> {
2556
2644
  value: T;