impact-nova 2.1.0-alpha.4 → 2.1.0-alpha.6

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.
Files changed (153) hide show
  1. package/dist/components/data/ag-grid-react/ag-grid-tooltip-overflow.d.ts +3 -0
  2. package/dist/components/data/ag-grid-react/ag-grid-tooltip-overflow.js +6 -0
  3. package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +15 -21
  4. package/dist/components/data/ag-grid-react/cell-renderers/date-display-renderer.js +1 -1
  5. package/dist/components/data/ag-grid-react/cell-renderers/default-text-cell-renderer.d.ts +1 -2
  6. package/dist/components/data/ag-grid-react/cell-renderers/default-text-cell-renderer.js +12 -6
  7. package/dist/components/data/ag-grid-react/cell-renderers/editors/textarea-cell-editor.js +19 -19
  8. package/dist/components/data/ag-grid-react/cell-renderers/select-display-renderer.js +1 -1
  9. package/dist/components/data/ag-grid-react/cell-renderers/switch-display-renderer.js +15 -15
  10. package/dist/components/data/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +1 -1
  11. package/dist/components/data/ag-grid-react/headers/advanced-filter/column-filter-section.js +33 -33
  12. package/dist/components/data/ag-grid-react/headers/components/header-info.js +66 -62
  13. package/dist/components/data/ag-grid-react/headers/components/info-modal.js +6 -6
  14. package/dist/components/data/ag-grid-react/headers/components/section-renderers.js +18 -18
  15. package/dist/components/data/ag-grid-react/headers/custom-header-group.js +40 -29
  16. package/dist/components/data/ag-grid-react/headers/custom-header.js +102 -98
  17. package/dist/components/data/ag-grid-react/index.d.ts +1 -1
  18. package/dist/components/data/ag-grid-react/index.js +136 -127
  19. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +7 -0
  20. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.js +6 -0
  21. package/dist/components/data/ag-grid-react/theme.js +8 -4
  22. package/dist/components/data/ag-grid-react/use-ag-grid-truncation-tooltip.d.ts +5 -0
  23. package/dist/components/data/ag-grid-react/use-ag-grid-truncation-tooltip.js +13 -0
  24. package/dist/components/data/ag-grid-react/useGridAutoSizeStrategyOnResize.js +8 -5
  25. package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +14 -0
  26. package/dist/components/data/data-table/build-column-tree-from-grid.js +95 -0
  27. package/dist/components/data/data-table/data-table-column-apply.d.ts +29 -0
  28. package/dist/components/data/data-table/data-table-column-apply.js +102 -0
  29. package/dist/components/data/data-table/data-table-column-def-pin.d.ts +25 -0
  30. package/dist/components/data/data-table/data-table-column-def-pin.js +66 -0
  31. package/dist/components/data/data-table/data-table-column-list-sync.d.ts +8 -0
  32. package/dist/components/data/data-table/data-table-column-list-sync.js +15 -0
  33. package/dist/components/data/data-table/data-table-column-list.d.ts +14 -4
  34. package/dist/components/data/data-table/data-table-column-list.js +74 -277
  35. package/dist/components/data/data-table/data-table-constants.d.ts +3 -4
  36. package/dist/components/data/data-table/data-table-context.d.ts +3 -6
  37. package/dist/components/data/data-table/data-table-context.js +21 -10
  38. package/dist/components/data/data-table/data-table-saved-views.js +26 -26
  39. package/dist/components/data/data-table/data-table-sheet-portal-store.d.ts +13 -0
  40. package/dist/components/data/data-table/data-table-sheet-portal-store.js +36 -0
  41. package/dist/components/data/data-table/data-table-sheet.d.ts +3 -6
  42. package/dist/components/data/data-table/data-table-sheet.js +4 -2
  43. package/dist/components/data/data-table/data-table-view-menu.js +40 -40
  44. package/dist/components/data/data-table/data-table.d.ts +8 -10
  45. package/dist/components/data/data-table/data-table.js +138 -111
  46. package/dist/components/data/data-table/data-table.types.d.ts +35 -0
  47. package/dist/components/data/data-table/index.js +28 -27
  48. package/dist/components/data/data-table/indicator-legend.js +6 -6
  49. package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +16 -0
  50. package/dist/components/data/data-table/use-data-table-column-list-sync.js +222 -0
  51. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.d.ts +8 -0
  52. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +72 -0
  53. package/dist/components/data/expandable-list-item/expandable-list-item-context.d.ts +13 -0
  54. package/dist/components/data/expandable-list-item/expandable-list-item-context.js +25 -0
  55. package/dist/components/data/expandable-list-item/expandable-list-item-metrics.d.ts +6 -0
  56. package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +41 -0
  57. package/dist/components/data/expandable-list-item/expandable-list-item-parts.d.ts +31 -0
  58. package/dist/components/data/expandable-list-item/expandable-list-item-parts.js +233 -0
  59. package/dist/components/data/expandable-list-item/expandable-list-item-preset.d.ts +18 -0
  60. package/dist/components/data/expandable-list-item/expandable-list-item-preset.js +133 -0
  61. package/dist/components/data/expandable-list-item/expandable-list-item.d.ts +5 -0
  62. package/dist/components/data/{expandable-sku/expandable-sku.types.d.ts → expandable-list-item/expandable-list-item.types.d.ts} +7 -7
  63. package/dist/components/data/expandable-list-item/index.d.ts +5 -0
  64. package/dist/components/data/expandable-list-item/index.js +19 -0
  65. package/dist/components/data/nested-list/components/NestedListHeader.js +11 -11
  66. package/dist/components/data/nested-list/components/SortableItem.js +2 -2
  67. package/dist/components/data-display/avatar/avatar.types.d.ts +2 -0
  68. package/dist/components/data-display/badge/badge.types.d.ts +2 -0
  69. package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +11 -11
  70. package/dist/components/data-display/calendar/calendar-month-picker-panel.js +7 -7
  71. package/dist/components/data-display/calendar/calendar-week-number-cell.js +31 -31
  72. package/dist/components/data-display/card/card.js +8 -8
  73. package/dist/components/data-display/chart/chart.types.d.ts +9 -0
  74. package/dist/components/data-display/skeleton/skeleton.js +6 -6
  75. package/dist/components/data-display/statistics-card/statistics-card.js +14 -14
  76. package/dist/components/feedback/alert-dialog/alert-dialog.js +19 -19
  77. package/dist/components/feedback/dialog/dialog.js +1 -1
  78. package/dist/components/feedback/drawer/drawer.js +18 -18
  79. package/dist/components/feedback/dropdown-menu/dropdown-menu.js +70 -57
  80. package/dist/components/feedback/popover/popover.js +1 -1
  81. package/dist/components/feedback/sheet/sheet.js +1 -1
  82. package/dist/components/feedback/tooltip/tooltip.js +22 -22
  83. package/dist/components/feedback/tooltip/tooltip.variants.js +1 -1
  84. package/dist/components/flows/command-palette/command-palette.js +104 -104
  85. package/dist/components/flows/command-palette/shortcut-settings.js +34 -34
  86. package/dist/components/flows/filter-strip/filter-tag-list.js +4 -4
  87. package/dist/components/flows/notification-panel/notification-list.js +17 -17
  88. package/dist/components/flows/notification-panel/notification-panel.js +4 -4
  89. package/dist/components/flows/notification-panel/notification-panel.types.d.ts +3 -0
  90. package/dist/components/flows/wizard/wizard.js +8 -8
  91. package/dist/components/forms/combobox/combobox.js +20 -20
  92. package/dist/components/forms/date-picker/date-picker.js +17 -17
  93. package/dist/components/forms/date-picker/date-range-picker.js +3 -3
  94. package/dist/components/forms/date-picker/month-picker.js +1 -1
  95. package/dist/components/forms/date-picker/month-range-picker.js +42 -42
  96. package/dist/components/forms/date-picker/week-picker.js +15 -15
  97. package/dist/components/forms/date-picker/week-range-picker.js +3 -3
  98. package/dist/components/forms/file-upload/file-upload.js +33 -33
  99. package/dist/components/forms/input/input.js +8 -8
  100. package/dist/components/forms/input/input.variants.js +3 -3
  101. package/dist/components/forms/select/components/SelectMenuPanel.d.ts +1 -2
  102. package/dist/components/forms/select/components/SelectMenuPanel.js +18 -20
  103. package/dist/components/forms/select/components/SelectTrigger.d.ts +9 -6
  104. package/dist/components/forms/select/components/SelectTrigger.js +120 -122
  105. package/dist/components/forms/select/components/Submenu.js +8 -8
  106. package/dist/components/forms/select/hooks/useSelectKeyboardHandlers.d.ts +1 -1
  107. package/dist/components/forms/select/hooks/useSelectValueState.d.ts +19 -0
  108. package/dist/components/forms/select/hooks/useSelectValueState.js +41 -0
  109. package/dist/components/forms/select/index.js +4 -3
  110. package/dist/components/forms/select/select.js +180 -175
  111. package/dist/components/forms/select/select.types.d.ts +3 -2
  112. package/dist/components/forms/select/select.variants.js +4 -4
  113. package/dist/components/forms/select/utils/select.d.ts +2 -1
  114. package/dist/components/forms/select/utils/select.js +47 -37
  115. package/dist/components/layout/sidebar/sidebar.d.ts +7 -50
  116. package/dist/components/layout/sidebar/sidebar.js +12 -11
  117. package/dist/components/layout/sidebar/sidebar.types.d.ts +35 -1
  118. package/dist/components/primitives/button-group/button-group.js +32 -32
  119. package/dist/components/primitives/chips/chips.variants.js +5 -5
  120. package/dist/components/primitives/empty-container/empty-container.types.d.ts +3 -0
  121. package/dist/components/primitives/kbd/kbd.variants.js +3 -3
  122. package/dist/components/primitives/stepper/stepper.js +6 -6
  123. package/dist/impact-nova-components.css +113 -7
  124. package/dist/impact-nova-tokens.scss +2 -4
  125. package/dist/impact-nova.css +1 -1
  126. package/dist/index.d.ts +1 -1
  127. package/dist/index.js +467 -433
  128. package/dist/lib/compose-refs.d.ts +8 -0
  129. package/dist/lib/compose-refs.js +14 -0
  130. package/dist/lib/primitives/field.types.d.ts +8 -2
  131. package/dist/lib/virtualized/index.d.ts +3 -0
  132. package/dist/lib/virtualized/index.js +33 -16
  133. package/dist/lib/virtualized/useVirtualizedList.d.ts +2 -0
  134. package/dist/lib/virtualized/useVirtualizedList.js +115 -109
  135. package/dist/lib/virtualized/virtualized-list-context.d.ts +12 -0
  136. package/dist/lib/virtualized/virtualized-list-context.js +21 -0
  137. package/dist/lib/virtualized/virtualized-list-parts.d.ts +51 -0
  138. package/dist/lib/virtualized/virtualized-list-parts.js +175 -0
  139. package/dist/lib/virtualized/virtualized-list-utils.d.ts +5 -0
  140. package/dist/lib/virtualized/virtualized-list-utils.js +6 -0
  141. package/dist/llms/rules/ag-grid.js +1 -1
  142. package/dist/llms/rules/installation.js +1 -1
  143. package/dist/llms/rules/migration.js +1 -1
  144. package/dist/llms/rules/real-world-patterns.js +1 -1
  145. package/dist/llms/rules/requirements.js +1 -1
  146. package/package.json +24 -15
  147. package/tailwind.config.js +1 -0
  148. package/dist/components/data/ag-grid-react/headers/components/truncated-text.d.ts +0 -15
  149. package/dist/components/data/ag-grid-react/headers/components/truncated-text.js +0 -27
  150. package/dist/components/data/expandable-sku/expandable-sku.d.ts +0 -38
  151. package/dist/components/data/expandable-sku/expandable-sku.js +0 -245
  152. package/dist/components/data/expandable-sku/index.d.ts +0 -2
  153. package/dist/components/data/expandable-sku/index.js +0 -4
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ /** Merge multiple refs into one callback ref. */
3
+ export declare function composeRefs<T>(...refs: Array<React.Ref<T> | undefined>): (node: T | null) => void;
4
+ /**
5
+ * Stable composed ref — avoids re-invoking measure / scroll refs every render
6
+ * (TanStack Virtual loops if measureElement ref identity churns).
7
+ */
8
+ export declare function useComposedRefs<T>(...refs: Array<React.Ref<T> | undefined>): (node: T | null) => void;
@@ -0,0 +1,14 @@
1
+ import * as f from "react";
2
+ function n(...e) {
3
+ return (t) => {
4
+ for (const o of e)
5
+ o && (typeof o == "function" ? o(t) : o.current = t);
6
+ };
7
+ }
8
+ function r(...e) {
9
+ return f.useCallback(n(...e), e);
10
+ }
11
+ export {
12
+ n as composeRefs,
13
+ r as useComposedRefs
14
+ };
@@ -7,15 +7,21 @@ export type ControlSize = "sm" | "md" | "lg" | "default";
7
7
  export type LabelOrientation = "top" | "left";
8
8
  /** Field chrome shared by Field wrapper and inline form controls. */
9
9
  export interface FieldChromeProps {
10
+ /** Text shown above the control so users know what to enter. */
10
11
  label?: React.ReactNode;
11
- /** Alias: `description` on Field */
12
+ /** Optional hint or validation message shown below the control. Alias: `description` on Field. */
12
13
  helperText?: React.ReactNode;
14
+ /** Where helper text appears: `absolute` floats below without pushing layout; `flow` takes page space. */
13
15
  helperTextPosition?: HelperTextPosition;
16
+ /** Label placement: `top` stacks label above control; `left` places label beside control. */
14
17
  labelOrientation?: LabelOrientation;
15
- /** Boolean drives aria-invalid; ReactNode renders error message. */
18
+ /** When true, shows red error styling. Pass a ReactNode to also render an error message. */
16
19
  error?: boolean | React.ReactNode;
20
+ /** When true, shows a required indicator (asterisk) next to the label. */
17
21
  required?: boolean;
22
+ /** When true, the control is greyed out and cannot be clicked, typed into, or focused. */
18
23
  disabled?: boolean;
24
+ /** Controls height and padding: `sm`, `md`, `lg`, or `default`. */
19
25
  size?: ControlSize;
20
26
  }
21
27
  /** Form control props mixin — extend native/Radix props with field chrome. */
@@ -7,3 +7,6 @@ export { useVirtualizedList, type UseVirtualizedListOptions, type UseVirtualized
7
7
  export { buildSectionedFlatList, type DataSectionBlock, type HeaderSectionBlock, type SectionBlock, type SectionedFlatList, type SectionedFlatRow, } from './sectioned';
8
8
  export { useDebouncedValue } from './useDebouncedValue';
9
9
  export { useDataGridVirtualRows, type DataGridVirtualRowsResult, } from './useDataGrid';
10
+ export { VirtualizedListProvider, useVirtualizedListContext, type VirtualizedListContextValue, } from './virtualized-list-context';
11
+ export { getVisibleReadyRowIds } from './virtualized-list-utils';
12
+ export { VirtualizedList, VirtualizedListShell, VirtualizedListHeader, VirtualizedListHeaderActions, VirtualizedListFooter, VirtualizedListSearch, VirtualizedListSelectAll, VirtualizedListViewport, VirtualizedListContent, VirtualizedListItem, VirtualizedListItemSkeleton, type VirtualizedListProps, type VirtualizedListContentProps, type VirtualizedListItemProps, type VirtualizedListItemSkeletonProps, type VirtualizedListSelectAllProps, type VirtualizedListViewportProps, } from './virtualized-list-parts';
@@ -1,18 +1,35 @@
1
- import { getSelectionCountsFromState as t } from "./selection-counts.js";
2
- import { useDataSource as u } from "./useDataSource.js";
3
- import { useRowState as i } from "./useRowState.js";
4
- import { useVirtualizedRows as m } from "./useVirtualizedRows.js";
5
- import { useVirtualizedList as p } from "./useVirtualizedList.js";
6
- import { buildSectionedFlatList as l } from "./sectioned.js";
7
- import { useDebouncedValue as S } from "./useDebouncedValue.js";
8
- import { useDataGridVirtualRows as n } from "./useDataGrid.js";
1
+ import { getSelectionCountsFromState as i } from "./selection-counts.js";
2
+ import { useDataSource as o } from "./useDataSource.js";
3
+ import { useRowState as s } from "./useRowState.js";
4
+ import { useVirtualizedRows as l } from "./useVirtualizedRows.js";
5
+ import { useVirtualizedList as V } from "./useVirtualizedList.js";
6
+ import { buildSectionedFlatList as L } from "./sectioned.js";
7
+ import { useDebouncedValue as p } from "./useDebouncedValue.js";
8
+ import { useDataGridVirtualRows as f } from "./useDataGrid.js";
9
+ import { VirtualizedListProvider as S, useVirtualizedListContext as c } from "./virtualized-list-context.js";
10
+ import { getVisibleReadyRowIds as R } from "./virtualized-list-utils.js";
11
+ import { VirtualizedList as C, VirtualizedListContent as D, VirtualizedListFooter as F, VirtualizedListHeader as I, VirtualizedListHeaderActions as g, VirtualizedListItem as h, VirtualizedListItemSkeleton as A, VirtualizedListSearch as H, VirtualizedListSelectAll as k, VirtualizedListShell as v, VirtualizedListViewport as y } from "./virtualized-list-parts.js";
9
12
  export {
10
- l as buildSectionedFlatList,
11
- t as getSelectionCountsFromState,
12
- n as useDataGridVirtualRows,
13
- u as useDataSource,
14
- S as useDebouncedValue,
15
- i as useRowState,
16
- p as useVirtualizedList,
17
- m as useVirtualizedRows
13
+ C as VirtualizedList,
14
+ D as VirtualizedListContent,
15
+ F as VirtualizedListFooter,
16
+ I as VirtualizedListHeader,
17
+ g as VirtualizedListHeaderActions,
18
+ h as VirtualizedListItem,
19
+ A as VirtualizedListItemSkeleton,
20
+ S as VirtualizedListProvider,
21
+ H as VirtualizedListSearch,
22
+ k as VirtualizedListSelectAll,
23
+ v as VirtualizedListShell,
24
+ y as VirtualizedListViewport,
25
+ L as buildSectionedFlatList,
26
+ i as getSelectionCountsFromState,
27
+ R as getVisibleReadyRowIds,
28
+ f as useDataGridVirtualRows,
29
+ o as useDataSource,
30
+ p as useDebouncedValue,
31
+ s as useRowState,
32
+ V as useVirtualizedList,
33
+ c as useVirtualizedListContext,
34
+ l as useVirtualizedRows
18
35
  };
@@ -35,6 +35,8 @@ export interface UseVirtualizedListResult<TData, TScrollElement extends Element
35
35
  ref: Virtualizer<TScrollElement, TItemElement>["measureElement"] | undefined;
36
36
  style: CSSProperties;
37
37
  };
38
+ /** Reset a row to its `estimateSize` after dynamic expansion collapses. */
39
+ resetRowSize: (index: number) => void;
38
40
  rowState: UseRowStateResult;
39
41
  }
40
42
  /**
@@ -1,155 +1,161 @@
1
- import { useRef as d, useEffect as M, useCallback as u } from "react";
2
- import { useDataSource as re } from "./useDataSource.js";
3
- import { useRowState as ae } from "./useRowState.js";
4
- import { useVirtualizedRows as ie } from "./useVirtualizedRows.js";
5
- function fe(T) {
1
+ import { useRef as g, useEffect as _, useCallback as d } from "react";
2
+ import { useDataSource as ie } from "./useDataSource.js";
3
+ import { useRowState as ce } from "./useRowState.js";
4
+ import { useVirtualizedRows as le } from "./useVirtualizedRows.js";
5
+ function pe($) {
6
6
  const {
7
- rowCount: l,
8
- getRowData: _,
9
- isRowLoaded: $,
10
- prefetchRange: D,
11
- getRowError: A,
12
- selectionMode: H,
13
- selectedIds: L,
14
- onSelectedIdsChange: B,
15
- defaultSelectedIds: K,
16
- selectAll: P,
17
- toggledIds: X,
18
- onSelectionStateChange: Y,
19
- defaultSelectAll: j,
20
- defaultToggledIds: q,
21
- expandedIds: F,
22
- onExpandedIdsChange: G,
23
- defaultExpandedIds: J,
24
- scrollElementRef: N,
25
- getRowId: S,
26
- estimateSize: Q,
27
- overscan: U,
28
- getItemKey: W,
29
- endReachedThreshold: g = 3,
30
- onEndReached: f,
31
- hasMore: h = !0,
32
- onChange: x,
33
- ...Z
34
- } = T, n = re({
35
- rowCount: l,
36
- getRowData: _,
37
- isRowLoaded: $,
38
- prefetchRange: D,
39
- getRowError: A
40
- }), E = ae({
41
- selectionMode: H,
42
- selectedIds: L,
43
- onSelectedIdsChange: B,
44
- defaultSelectedIds: K,
45
- selectAll: P,
46
- toggledIds: X,
47
- onSelectionStateChange: Y,
48
- defaultSelectAll: j,
49
- defaultToggledIds: q,
50
- expandedIds: F,
51
- onExpandedIdsChange: G,
52
- defaultExpandedIds: J
53
- }), z = d(l), C = d(h), b = d(g), p = d(f);
54
- M(() => {
55
- z.current = l, C.current = h, b.current = g, p.current = f;
56
- }, [l, h, g, f]);
57
- const O = u(
7
+ rowCount: u,
8
+ getRowData: D,
9
+ isRowLoaded: A,
10
+ prefetchRange: H,
11
+ getRowError: L,
12
+ selectionMode: B,
13
+ selectedIds: K,
14
+ onSelectedIdsChange: P,
15
+ defaultSelectedIds: X,
16
+ selectAll: Y,
17
+ toggledIds: j,
18
+ onSelectionStateChange: q,
19
+ defaultSelectAll: F,
20
+ defaultToggledIds: G,
21
+ expandedIds: J,
22
+ onExpandedIdsChange: N,
23
+ defaultExpandedIds: Q,
24
+ scrollElementRef: U,
25
+ getRowId: x,
26
+ estimateSize: c,
27
+ overscan: W,
28
+ getItemKey: Z,
29
+ endReachedThreshold: f = 3,
30
+ onEndReached: h,
31
+ hasMore: p = !0,
32
+ onChange: z,
33
+ ...O
34
+ } = $, n = ie({
35
+ rowCount: u,
36
+ getRowData: D,
37
+ isRowLoaded: A,
38
+ prefetchRange: H,
39
+ getRowError: L
40
+ }), E = ce({
41
+ selectionMode: B,
42
+ selectedIds: K,
43
+ onSelectedIdsChange: P,
44
+ defaultSelectedIds: X,
45
+ selectAll: Y,
46
+ toggledIds: j,
47
+ onSelectionStateChange: q,
48
+ defaultSelectAll: F,
49
+ defaultToggledIds: G,
50
+ expandedIds: J,
51
+ onExpandedIdsChange: N,
52
+ defaultExpandedIds: Q
53
+ }), C = g(u), b = g(p), y = g(f), R = g(h);
54
+ _(() => {
55
+ C.current = u, b.current = p, y.current = f, R.current = h;
56
+ }, [u, p, f, h]);
57
+ const ee = d(
58
58
  (e, o) => {
59
- if (x?.(e, o), !p.current || !C.current) return;
60
- const t = e.getVirtualItems(), s = t[t.length - 1];
61
- s && s.index >= z.current - b.current - 1 && p.current();
59
+ if (z?.(e, o), !R.current || !b.current) return;
60
+ const t = e.getVirtualItems(), r = t[t.length - 1];
61
+ r && r.index >= C.current - y.current - 1 && R.current();
62
62
  },
63
- [x]
64
- ), { virtualizer: i, virtualItems: r, totalSize: y, measureElement: R } = ie({
65
- scrollElementRef: N,
63
+ [z]
64
+ ), { virtualizer: s, virtualItems: a, totalSize: I, measureElement: m } = le({
65
+ scrollElementRef: U,
66
66
  rowCount: n.rowCount,
67
- estimateSize: Q,
68
- overscan: U,
69
- getItemKey: W,
70
- onChange: O,
71
- ...Z
72
- }), m = r[0]?.index, w = r[r.length - 1]?.index;
73
- M(() => {
74
- n.prefetchRange && (m === void 0 || w === void 0 || n.prefetchRange(m, w));
75
- }, [n, m, w]);
76
- const { isSelected: I, isExpanded: v, toggleSelect: V, toggleExpand: k } = E, ee = u(
67
+ estimateSize: c,
68
+ overscan: W,
69
+ getItemKey: Z,
70
+ onChange: ee,
71
+ ...O
72
+ }), w = a[0]?.index, S = a[a.length - 1]?.index;
73
+ _(() => {
74
+ n.prefetchRange && (w === void 0 || S === void 0 || n.prefetchRange(w, S));
75
+ }, [n, w, S]);
76
+ const { isSelected: v, isExpanded: V, toggleSelect: k, toggleExpand: M } = E, te = d(
77
77
  (e) => {
78
- const o = S(e), t = n.getRowStatus(e), s = n.getRowData(e), c = n.getRowError(e);
78
+ const o = x(e), t = n.getRowStatus(e), r = n.getRowData(e), l = n.getRowError(e);
79
79
  return {
80
80
  index: e,
81
81
  id: o,
82
- data: s,
83
- item: s,
82
+ data: r,
83
+ item: r,
84
84
  status: t,
85
- error: t === "error" ? c : void 0,
86
- isSelected: I(o),
87
- isExpanded: v(o),
88
- toggleSelect: () => V(o),
89
- toggleExpand: () => k(o)
85
+ error: t === "error" ? l : void 0,
86
+ isSelected: v(o),
87
+ isExpanded: V(o),
88
+ toggleSelect: () => k(o),
89
+ toggleExpand: () => M(o)
90
90
  };
91
91
  },
92
- [S, n, I, v, V, k]
93
- ), te = u(
92
+ [x, n, v, V, k, M]
93
+ ), oe = d(
94
94
  (e, o) => {
95
- const t = typeof e == "number" ? r.find((a) => a.index === e) : e, s = !!i.options.horizontal, c = o?.measure !== !1;
95
+ const t = typeof e == "number" ? a.find((i) => i.index === e) : e, r = !!s.options.horizontal, l = o?.measure !== !1;
96
96
  if (!t) {
97
- const a = typeof e == "number" ? e : -1;
97
+ const i = typeof e == "number" ? e : -1;
98
98
  return {
99
- key: a >= 0 ? a : "__missing__",
100
- "data-index": a >= 0 ? a : 0,
99
+ key: i >= 0 ? i : "__missing__",
100
+ "data-index": i >= 0 ? i : 0,
101
101
  ref: void 0,
102
102
  style: {}
103
103
  };
104
104
  }
105
- const ne = {
105
+ const re = {
106
106
  position: "absolute",
107
107
  top: 0,
108
108
  left: 0,
109
109
  width: "100%",
110
110
  transform: `translateY(${t.start}px)`
111
- }, se = {
111
+ }, ae = {
112
112
  position: "absolute",
113
113
  top: 0,
114
114
  left: 0,
115
115
  height: "100%",
116
116
  transform: `translateX(${t.start}px)`
117
- };
117
+ }, T = c(t.index);
118
118
  return {
119
119
  key: t.key,
120
120
  "data-index": t.index,
121
- ref: c ? R : void 0,
122
- style: s ? {
123
- ...se,
124
- // Fixed span when not measuring; dynamic width uses measureElement.
125
- ...c ? {} : { width: `${t.size}px` }
121
+ ref: l ? m : void 0,
122
+ style: r ? {
123
+ ...ae,
124
+ // Fixed span when not measuring; use estimate not cached expanded size.
125
+ ...l ? {} : { width: `${T}px` }
126
126
  } : {
127
- ...ne,
127
+ ...re,
128
128
  // Do not set fixed height when measuring — expanded rows must grow and
129
129
  // ResizeObserver can update layout so following virtual rows move down.
130
- ...c ? {} : { height: `${t.size}px` }
130
+ ...l ? {} : { height: `${T}px` }
131
131
  }
132
132
  };
133
133
  },
134
- [r, i.options.horizontal, R]
135
- ), oe = u(
134
+ [a, s.options.horizontal, m, c]
135
+ ), ne = d(
136
+ (e) => {
137
+ s.resizeItem(e, c(e));
138
+ },
139
+ [s, c]
140
+ ), se = d(
136
141
  (...e) => {
137
- i.scrollToIndex(...e);
142
+ s.scrollToIndex(...e);
138
143
  },
139
- [i]
144
+ [s]
140
145
  );
141
146
  return {
142
- virtualItems: r,
143
- totalHeight: y,
144
- totalSize: y,
145
- measureElement: R,
146
- virtualizer: i,
147
- scrollToIndex: oe,
148
- getRow: ee,
149
- getItemProps: te,
147
+ virtualItems: a,
148
+ totalHeight: I,
149
+ totalSize: I,
150
+ measureElement: m,
151
+ virtualizer: s,
152
+ scrollToIndex: se,
153
+ getRow: te,
154
+ getItemProps: oe,
155
+ resetRowSize: ne,
150
156
  rowState: E
151
157
  };
152
158
  }
153
159
  export {
154
- fe as useVirtualizedList
160
+ pe as useVirtualizedList
155
161
  };
@@ -0,0 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ import { UseVirtualizedListResult } from './useVirtualizedList';
3
+ import * as React from "react";
4
+ export interface VirtualizedListContextValue<TData = unknown> {
5
+ list: UseVirtualizedListResult<TData>;
6
+ scrollRef: RefObject<HTMLDivElement | null>;
7
+ }
8
+ export declare function VirtualizedListProvider<TData>({ value, children, }: {
9
+ value: VirtualizedListContextValue<TData>;
10
+ children: React.ReactNode;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ export declare function useVirtualizedListContext<TData = unknown>(): VirtualizedListContextValue<TData>;
@@ -0,0 +1,21 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ const r = i.createContext(null);
4
+ function u({
5
+ value: t,
6
+ children: e
7
+ }) {
8
+ return /* @__PURE__ */ o(r.Provider, { value: t, children: e });
9
+ }
10
+ function s() {
11
+ const t = i.useContext(r);
12
+ if (!t)
13
+ throw new Error(
14
+ "VirtualizedList compound parts must be used within VirtualizedList or VirtualizedListProvider."
15
+ );
16
+ return t;
17
+ }
18
+ export {
19
+ u as VirtualizedListProvider,
20
+ s as useVirtualizedListContext
21
+ };
@@ -0,0 +1,51 @@
1
+ import { VirtualItem, VirtualRowModel } from './types';
2
+ import { VirtualizedListContextValue } from './virtualized-list-context';
3
+ import { UseVirtualizedListOptions, UseVirtualizedListResult } from './useVirtualizedList';
4
+ import * as React from "react";
5
+ export declare const VirtualizedListShell: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
6
+ export type VirtualizedListProps<TData> = {
7
+ children: React.ReactNode;
8
+ className?: string;
9
+ } & ({
10
+ value: VirtualizedListContextValue<TData>;
11
+ } | (Omit<UseVirtualizedListOptions<TData>, "scrollElementRef"> & {
12
+ value?: undefined;
13
+ }));
14
+ export declare function VirtualizedList<TData>(props: VirtualizedListProps<TData>): import("react/jsx-runtime").JSX.Element;
15
+ export declare namespace VirtualizedList {
16
+ var displayName: string;
17
+ }
18
+ export declare const VirtualizedListHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
19
+ export declare const VirtualizedListHeaderActions: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
20
+ export declare const VirtualizedListFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
21
+ export declare const VirtualizedListSearch: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
22
+ export interface VirtualizedListSelectAllProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "type" | "onClick"> {
23
+ children?: React.ReactNode | ((state: {
24
+ allVisibleSelected: boolean;
25
+ }) => React.ReactNode);
26
+ /** Override visible row ids (default: loaded rows in the virtual window). */
27
+ getVisibleIds?: (list: UseVirtualizedListResult<unknown>) => string[];
28
+ }
29
+ export declare const VirtualizedListSelectAll: React.ForwardRefExoticComponent<VirtualizedListSelectAllProps & React.RefAttributes<HTMLButtonElement>>;
30
+ export interface VirtualizedListViewportProps extends React.HTMLAttributes<HTMLDivElement> {
31
+ }
32
+ export declare const VirtualizedListViewport: React.ForwardRefExoticComponent<VirtualizedListViewportProps & React.RefAttributes<HTMLDivElement>>;
33
+ export interface VirtualizedListContentProps<TData> {
34
+ children: (row: VirtualRowModel<TData>, virtualItem: VirtualItem) => React.ReactNode;
35
+ className?: string;
36
+ /** When false, row uses fixed `estimateSize` (faster for collapsed expandable rows). Default: true. */
37
+ getItemMeasure?: (row: VirtualRowModel<TData>) => boolean;
38
+ }
39
+ export declare function VirtualizedListContent<TData>({ children, className, getItemMeasure, }: VirtualizedListContentProps<TData>): import("react/jsx-runtime").JSX.Element;
40
+ export interface VirtualizedListItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
41
+ virtualItem: VirtualItem;
42
+ children: React.ReactNode;
43
+ measure?: boolean;
44
+ /** Enables collapse height reset for expandable rows. */
45
+ row?: Pick<VirtualRowModel<unknown>, "isExpanded">;
46
+ }
47
+ export declare const VirtualizedListItem: React.ForwardRefExoticComponent<VirtualizedListItemProps & React.RefAttributes<HTMLDivElement>>;
48
+ export interface VirtualizedListItemSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
49
+ children?: React.ReactNode;
50
+ }
51
+ export declare const VirtualizedListItemSkeleton: React.ForwardRefExoticComponent<VirtualizedListItemSkeletonProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,175 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import * as d from "react";
3
+ import { useRef as m, useLayoutEffect as P, useMemo as H } from "react";
4
+ import { useComposedRefs as N } from "../compose-refs.js";
5
+ import { createCompoundPart as c } from "../primitives/create-compound.js";
6
+ import { cn as p } from "../utils.js";
7
+ import { VirtualizedListProvider as R, useVirtualizedListContext as f } from "./virtualized-list-context.js";
8
+ import { getVisibleReadyRowIds as _ } from "./virtualized-list-utils.js";
9
+ import { useVirtualizedList as T } from "./useVirtualizedList.js";
10
+ const y = c("virtualized-list", {
11
+ part: "root",
12
+ displayName: "VirtualizedList",
13
+ className: "mx-auto flex w-full max-w-[420px] flex-col overflow-hidden rounded-xl border border-stroke bg-canvas-elevated shadow-sm"
14
+ });
15
+ function D({
16
+ className: t,
17
+ children: a,
18
+ ...r
19
+ }) {
20
+ const e = m(null), i = T({
21
+ ...r,
22
+ scrollElementRef: e
23
+ }), s = H(
24
+ () => ({ list: i, scrollRef: e }),
25
+ [i, e]
26
+ );
27
+ return /* @__PURE__ */ l(R, { value: s, children: /* @__PURE__ */ l(y, { className: t, children: a }) });
28
+ }
29
+ function F(t) {
30
+ if ("value" in t && t.value) {
31
+ const { value: i, className: s, children: o } = t;
32
+ return /* @__PURE__ */ l(R, { value: i, children: /* @__PURE__ */ l(y, { className: s, children: o }) });
33
+ }
34
+ const { className: a, children: r, ...e } = t;
35
+ return /* @__PURE__ */ l(D, { className: a, ...e, children: r });
36
+ }
37
+ F.displayName = "VirtualizedList";
38
+ const $ = c("virtualized-list", {
39
+ part: "header",
40
+ displayName: "VirtualizedListHeader",
41
+ className: "shrink-0 border-b border-stroke bg-canvas-elevated px-4 pb-3 pt-4"
42
+ }), ee = c("virtualized-list", {
43
+ part: "header-actions",
44
+ displayName: "VirtualizedListHeaderActions",
45
+ className: "mt-3 flex items-center gap-2"
46
+ }), te = c("virtualized-list", {
47
+ part: "footer",
48
+ displayName: "VirtualizedListFooter",
49
+ className: "shrink-0 border-t border-stroke px-4 py-2 text-xs text-content-muted"
50
+ }), ie = c("virtualized-list", {
51
+ part: "search",
52
+ displayName: "VirtualizedListSearch",
53
+ className: "min-w-0 flex-1"
54
+ }), j = d.forwardRef(({ className: t, children: a, getVisibleIds: r, ...e }, i) => {
55
+ const { list: s } = f(), o = d.useMemo(
56
+ () => r ? r(s) : _(s),
57
+ [r, s]
58
+ ), n = o.length > 0 && s.rowState.isAllSelected(o), u = typeof a == "function" ? a({ allVisibleSelected: n }) : a ?? (n ? "Deselect visible" : "Select all visible");
59
+ return /* @__PURE__ */ l(
60
+ "button",
61
+ {
62
+ ref: i,
63
+ type: "button",
64
+ "data-component": "virtualized-list-select-all",
65
+ className: p(
66
+ "shrink-0 text-sm font-medium text-brand hover:underline",
67
+ t
68
+ ),
69
+ onClick: () => s.rowState.toggleSelectAll(o),
70
+ ...e,
71
+ children: u
72
+ }
73
+ );
74
+ });
75
+ j.displayName = "VirtualizedListSelectAll";
76
+ const I = d.forwardRef(({ className: t, children: a, ...r }, e) => {
77
+ const { scrollRef: i } = f(), s = N(i, e);
78
+ return /* @__PURE__ */ l(
79
+ "div",
80
+ {
81
+ ref: s,
82
+ "data-component": "virtualized-list-viewport",
83
+ className: p("shrink-0 overflow-auto", t),
84
+ ...r,
85
+ children: a
86
+ }
87
+ );
88
+ });
89
+ I.displayName = "VirtualizedListViewport";
90
+ function se({
91
+ children: t,
92
+ className: a,
93
+ getItemMeasure: r
94
+ }) {
95
+ const { list: e } = f();
96
+ return /* @__PURE__ */ l(
97
+ "div",
98
+ {
99
+ "data-component": "virtualized-list-content",
100
+ className: p("relative w-full", a),
101
+ style: { height: e.totalHeight },
102
+ children: e.virtualItems.map((i) => {
103
+ const s = e.getRow(i.index), o = r ? r(s) : !0;
104
+ return /* @__PURE__ */ l(
105
+ b,
106
+ {
107
+ virtualItem: i,
108
+ row: s,
109
+ measure: o,
110
+ children: t(s, i)
111
+ },
112
+ String(i.key)
113
+ );
114
+ })
115
+ }
116
+ );
117
+ }
118
+ const K = 220, b = d.forwardRef(
119
+ ({ virtualItem: t, children: a, className: r, measure: e, row: i, ...s }, o) => {
120
+ const { list: n } = f(), u = m(null), x = m(i?.isExpanded), h = m(e), S = n.getItemProps(t, { measure: e }), { key: U, ref: E, style: g, ...k } = S, A = N(E, o, u);
121
+ return P(() => {
122
+ const M = x.current, L = i?.isExpanded, C = h.current, z = e !== !1, V = M === !0 && L === !1;
123
+ (V || C && !z) && n.resetRowSize(t.index);
124
+ let v;
125
+ return V && z && (v = window.setTimeout(() => {
126
+ const w = u.current;
127
+ w && n.measureElement(w);
128
+ }, K)), x.current = L, h.current = z, () => {
129
+ v !== void 0 && window.clearTimeout(v);
130
+ };
131
+ }, [i?.isExpanded, e, t.index, n]), /* @__PURE__ */ l(
132
+ "div",
133
+ {
134
+ ref: A,
135
+ "data-component": "virtualized-list-item",
136
+ style: g,
137
+ className: r,
138
+ ...k,
139
+ ...s,
140
+ children: a
141
+ }
142
+ );
143
+ }
144
+ );
145
+ b.displayName = "VirtualizedListItem";
146
+ const O = d.forwardRef(({ className: t, children: a, ...r }, e) => /* @__PURE__ */ l(
147
+ "div",
148
+ {
149
+ ref: e,
150
+ "data-component": "virtualized-list-item-skeleton",
151
+ className: p("px-3 py-2", t),
152
+ ...r,
153
+ children: a ?? /* @__PURE__ */ l(
154
+ "div",
155
+ {
156
+ className: "h-12 w-full animate-pulse rounded-md bg-muted",
157
+ "aria-hidden": !0
158
+ }
159
+ )
160
+ }
161
+ ));
162
+ O.displayName = "VirtualizedListItemSkeleton";
163
+ export {
164
+ F as VirtualizedList,
165
+ se as VirtualizedListContent,
166
+ te as VirtualizedListFooter,
167
+ $ as VirtualizedListHeader,
168
+ ee as VirtualizedListHeaderActions,
169
+ b as VirtualizedListItem,
170
+ O as VirtualizedListItemSkeleton,
171
+ ie as VirtualizedListSearch,
172
+ j as VirtualizedListSelectAll,
173
+ y as VirtualizedListShell,
174
+ I as VirtualizedListViewport
175
+ };
@@ -0,0 +1,5 @@
1
+ import { UseVirtualizedListResult } from './useVirtualizedList';
2
+ /**
3
+ * Row ids for loaded rows currently in the virtual window (excludes loading / error placeholders).
4
+ */
5
+ export declare function getVisibleReadyRowIds<TData>(list: Pick<UseVirtualizedListResult<TData>, "virtualItems" | "getRow">): string[];