asma-ui-core 3.47.4 → 3.49.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.
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Renders only the rows in view, for lists long enough that mounting all of them is the bottleneck.
4
+ *
5
+ * Lives here rather than in each consumer because `@tanstack/react-virtual` is already a dependency
6
+ * of this package (the table's column virtualizer uses it), and because the mechanism is the part
7
+ * that gets copied wrong: the spacer must carry the *full* scroll height or the scrollbar lies, rows
8
+ * must be positioned rather than laid out, and each row needs `measureElement` or variable heights
9
+ * drift. Encapsulating it keeps the virtualizer an implementation detail of this package instead of a
10
+ * dependency every app adds for itself.
11
+ *
12
+ * **This virtualizes RENDERING, not loading.** Every item must already be in memory — `items` is the
13
+ * complete list. A consumer that also wants to fetch lazily needs its own windowing on top, and
14
+ * should think hard about whether partial data still satisfies its own invariants.
15
+ *
16
+ * Variable row heights work without configuration: `estimatedItemHeight` only seeds the first paint,
17
+ * after which real heights are measured.
18
+ */
19
+ export interface VirtualizedListProps<TItem> {
20
+ items: readonly TItem[];
21
+ /** Stable identity per row. Index-based keys would remount rows on reorder and lose focus. */
22
+ getItemKey: (item: TItem, index: number) => string;
23
+ renderItem: (item: TItem, index: number) => ReactNode;
24
+ /** First-paint estimate only; real heights are measured after mount. Defaults to 48. */
25
+ estimatedItemHeight?: number;
26
+ /** Rows kept mounted beyond the viewport, so scrolling does not reveal blank space. Defaults to 8. */
27
+ overscan?: number;
28
+ /** Applied to the scroll container — give it a bounded height, or nothing can scroll. */
29
+ className?: string;
30
+ dataTest?: string;
31
+ /** Rendered instead of the list when `items` is empty. */
32
+ emptyState?: ReactNode;
33
+ }
34
+ export declare function VirtualizedList<TItem>({ className, dataTest, emptyState, estimatedItemHeight, getItemKey, items, overscan, renderItem, }: VirtualizedListProps<TItem>): React.ReactElement | null;
@@ -0,0 +1 @@
1
+ export * from './VirtualizedList';
@@ -3,6 +3,7 @@ export * from './components/data-display/badge';
3
3
  export * from './components/data-display/chip';
4
4
  export * from './components/data-display/interactive-chip';
5
5
  export * from './components/data-display/tooltip';
6
+ export * from './components/data-display/virtualized-list';
6
7
  export * from './components/icons';
7
8
  export * from './components/data-display/typography';
8
9
  export * from './components/data-display/form-label';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.47.4",
6
+ "version": "3.49.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",