@jetbrains/ring-ui-built 8.0.0-beta.3 → 8.0.0-beta.5

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 (120) hide show
  1. package/components/_helpers/alert.js +3 -0
  2. package/components/_helpers/caption.js +1 -1
  3. package/components/_helpers/header.js +1 -1
  4. package/components/_helpers/heading.js +2 -2
  5. package/components/_helpers/table.js +1 -1
  6. package/components/_helpers/theme.js +1 -1
  7. package/components/alert/alert-actions.d.ts +4 -0
  8. package/components/alert/alert-actions.js +51 -0
  9. package/components/alert/alert-heading.d.ts +4 -0
  10. package/components/alert/alert-heading.js +62 -0
  11. package/components/alert/alert.d.ts +14 -1
  12. package/components/alert/alert.js +44 -26
  13. package/components/alert-service/alert-service.d.ts +2 -1
  14. package/components/alert-service/alert-service.js +15 -5
  15. package/components/auth/auth-core.d.ts +5 -9
  16. package/components/auth/auth-core.js +71 -17
  17. package/components/auth/auth.js +7 -1
  18. package/components/auth/down-notification.js +7 -1
  19. package/components/auth/iframe-flow.js +1 -1
  20. package/components/auth/storage.js +7 -1
  21. package/components/checkbox/checkbox.d.ts +1 -1
  22. package/components/clipboard/clipboard.js +7 -1
  23. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  24. package/components/collapsible-group/collapsible-group.js +382 -0
  25. package/components/components/util-stories.js +63 -1
  26. package/components/data-list/data-list.js +1 -1
  27. package/components/data-list/title.js +1 -1
  28. package/components/date-picker/consts.d.ts +1 -0
  29. package/components/date-picker/date-input.js +3 -2
  30. package/components/date-picker/date-popup.js +3 -3
  31. package/components/dropdown-menu/dropdown-menu.js +6 -6
  32. package/components/editable-heading/editable-heading.js +122 -109
  33. package/components/expand/collapsible-group.d.ts +8 -20
  34. package/components/expand/collapsible-group.js +34 -365
  35. package/components/global/compose-refs.d.ts +2 -1
  36. package/components/global/compose-refs.js +44 -8
  37. package/components/global/focus-sensor-hoc.js +1 -0
  38. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  39. package/components/global/focus-with-temporary-tabindex.js +23 -0
  40. package/components/global/intersection-observer-context.d.ts +29 -9
  41. package/components/global/intersection-observer-context.js +50 -52
  42. package/components/global/is-within-interactive-element.d.ts +6 -0
  43. package/components/global/is-within-interactive-element.js +11 -0
  44. package/components/global/is-within-navigable-element.d.ts +6 -0
  45. package/components/global/is-within-navigable-element.js +11 -0
  46. package/components/global/parse-css-duration.d.ts +5 -0
  47. package/components/global/parse-css-duration.js +14 -0
  48. package/components/global/rerender-hoc.js +1 -0
  49. package/components/global/schedule-with-cleanup.d.ts +12 -0
  50. package/components/global/schedule-with-cleanup.js +36 -0
  51. package/components/global/table-selection.js +1 -1
  52. package/components/global/theme.js +1 -1
  53. package/components/header/header.js +8 -2
  54. package/components/header/smart-profile.js +7 -1
  55. package/components/heading/heading.js +3 -3
  56. package/components/http/http.d.ts +2 -2
  57. package/components/http/http.js +2 -2
  58. package/components/i18n/i18n.d.ts +1 -0
  59. package/components/i18n/i18n.js +2 -0
  60. package/components/input/input.d.ts +1 -1
  61. package/components/internal/reorder-animation-context.js +159 -0
  62. package/components/internal/reorder-handle.js +750 -0
  63. package/components/internal/reorder-layout-context.js +141 -0
  64. package/components/internal/table-header.js +685 -0
  65. package/components/{table/table-virtualize.js → internal/virtualization.js} +123 -84
  66. package/components/legacy-table/header-cell.js +2 -2
  67. package/components/legacy-table/row-with-focus-sensor.js +1 -1
  68. package/components/legacy-table/row.d.ts +1 -1
  69. package/components/legacy-table/simple-table.js +1 -1
  70. package/components/legacy-table/smart-table.js +1 -1
  71. package/components/legacy-table/table.js +1 -1
  72. package/components/markdown/markdown.js +2 -2
  73. package/components/message/message.js +1 -1
  74. package/components/old-browsers-message/white-list.js +2 -2
  75. package/components/popup/popup.d.ts +2 -0
  76. package/components/popup/popup.js +5 -1
  77. package/components/select/select-popup.d.ts +1 -1
  78. package/components/select/select.d.ts +1 -1
  79. package/components/storage/storage-local.js +7 -1
  80. package/components/storage/storage.js +7 -1
  81. package/components/style.css +1 -1
  82. package/components/table/default-item-renderer.d.ts +29 -10
  83. package/components/table/default-item-renderer.js +151 -93
  84. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  85. package/components/table/internal/reorder-handle.d.ts +9 -0
  86. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  87. package/components/table/internal/table-header.d.ts +1 -0
  88. package/components/table/internal/virtualization.d.ts +41 -0
  89. package/components/table/item-virtualization.d.ts +37 -0
  90. package/components/table/item-virtualization.js +73 -0
  91. package/components/table/reorder-animation.d.ts +37 -0
  92. package/components/table/reorder-animation.js +18 -0
  93. package/components/table/reorder-item-layout.d.ts +32 -0
  94. package/components/table/reorder-item-layout.js +57 -0
  95. package/components/table/table-const.d.ts +8 -6
  96. package/components/table/table-const.js +8 -6
  97. package/components/table/table-primitives.d.ts +52 -16
  98. package/components/table/table-primitives.js +64 -207
  99. package/components/table/table-props.d.ts +304 -0
  100. package/components/table/table-props.js +1 -0
  101. package/components/table/table.d.ts +231 -209
  102. package/components/table/table.js +365 -17
  103. package/components/tooltip/tooltip.js +1 -1
  104. package/components/user-agreement/service.js +13 -7
  105. package/components/user-card/card.js +7 -1
  106. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  107. package/components/user-card/smart-user-card-tooltip.js +7 -1
  108. package/components/user-card/tooltip.js +7 -1
  109. package/components/user-card/user-card.js +7 -1
  110. package/components/util-stories.d.ts +26 -0
  111. package/package.json +3 -3
  112. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  113. package/components/date-picker/use-intersection-observer.js +0 -93
  114. package/components/global/composeRefs.d.ts +0 -6
  115. package/components/global/composeRefs.js +0 -9
  116. package/components/table/table-component.d.ts +0 -80
  117. package/components/table/table-component.js +0 -290
  118. package/components/table/table-row-focus.d.ts +0 -4
  119. package/components/table/table-row-focus.js +0 -41
  120. package/components/table/table-virtualize.d.ts +0 -32
@@ -5,13 +5,10 @@ export interface DefaultItemRendererProps {
5
5
  */
6
6
  index: number;
7
7
  /**
8
- * If true, the row will be focusable with up/down arrow keys.
8
+ * If `true`, the row will be focusable with up/down arrow keys.
9
9
  * Focus is implemented using the
10
10
  * ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
11
11
  * technique, that is, only the focused row has `tabIndex={0}`.
12
- *
13
- * To focus the row on click or other user interaction, add e.g. `onClick()`
14
- * and invoke `focusRow(e.currentTarget)` imported from `table-row-focus.ts`.
15
12
  */
16
13
  keyboardFocusable?: boolean;
17
14
  /**
@@ -20,17 +17,39 @@ export interface DefaultItemRendererProps {
20
17
  */
21
18
  clickable?: boolean;
22
19
  /**
23
- * If true, the row is highlighted as selected, that is, with the
24
- * a different background color.
20
+ * If `true`, the row is highlighted as selected with a different background color.
25
21
  */
26
22
  selected?: boolean;
27
23
  /**
28
- * A level of a nested item. Results in an indent for columns with `indent: true`.
29
- * 0, negative values, and an unset value mean no indent.
24
+ * The nesting level of an item. Applies an indent for columns with
25
+ * `Column.indent` set to `true`. `0`, negative values, and an unset value
26
+ * mean no indent.
30
27
  */
31
28
  level?: number;
29
+ /**
30
+ * When set to `true`, does not control item virtualization.
31
+ * Useful when you include `DefaultItemRenderer` as a part of a custom row renderer,
32
+ * and track the visibility yourself.
33
+ */
34
+ noItemVirtualization?: boolean;
35
+ /**
36
+ * When set to `true`, does not report the item's boundaries to the reorder system.
37
+ * Useful when you include `DefaultItemRenderer` as a part of a custom row renderer
38
+ * that registers boundaries itself.
39
+ */
40
+ noReorderLayout?: boolean;
32
41
  }
33
42
  /**
34
- * @see TableProps.renderItem
43
+ * Standard component for rendering a table row.
44
+ *
45
+ * Renders an item using the table's column definitions and lets you
46
+ * configure item-scoped behavior such as selection, keyboard navigation,
47
+ * event handlers, `className`, and `ref`.
48
+ *
49
+ * Note that row-level click and keyboard handlers are not discoverable
50
+ * by assistive technologies. Make sure that any functionality relying on
51
+ * them (such as selection or expand/collapse) is also available through
52
+ * accessible controls, such as checkboxes or buttons with accessible
53
+ * labels.
35
54
  */
36
- export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;
55
+ export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, noItemVirtualization, noReorderLayout, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;
@@ -1,40 +1,43 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { useRef, use } from 'react';
3
3
  import classNames from 'classnames';
4
- import { mergeRefs } from 'react-merge-refs';
5
- import { CollapseItemIntoSpacerContext, TablePropsContext } from './table-const.js';
6
- import { useIsIntersectingListener } from '../global/intersection-observer-context.js';
4
+ import { TablePropsContext } from './table-const.js';
5
+ import { useComposedRef } from '../global/compose-refs.js';
6
+ import { useItemVirtualization } from './item-virtualization.js';
7
7
  import { TableRow, TableCell } from './table-primitives.js';
8
+ import { ReorderAnimationContext } from '../internal/reorder-animation-context.js';
9
+ import { useReorderItemLayout } from './reorder-item-layout.js';
8
10
  import { s as styles } from '../_helpers/table.js';
9
11
  import { jsx } from 'react/jsx-runtime';
10
- import '@jetbrains/icons/unsorted-12px';
11
- import '@jetbrains/icons/arrow-12px-down';
12
- import '@jetbrains/icons/arrow-12px-up';
13
- import '@jetbrains/icons/trash-12px';
12
+ import 'memoize-one';
13
+ import '../internal/virtualization.js';
14
+ import '../global/intersection-observer-context.js';
15
+ import '../global/schedule-with-cleanup.js';
16
+ import '../internal/reorder-handle.js';
17
+ import '@jetbrains/icons/drag-12px';
14
18
  import '../icon/icon.js';
15
19
  import 'util-deprecate';
16
20
  import '../icon/icon.constants.js';
17
21
  import '../_helpers/icon-svg.js';
18
22
  import '../global/memoize.js';
19
- import './table-row-focus.js';
23
+ import '../global/parse-css-duration.js';
24
+ import '../internal/reorder-layout-context.js';
20
25
 
21
- const INDENT_SIZE = 24;
22
- /**
23
- * @see TableProps.renderItem
24
- */
25
26
  function DefaultItemRenderer(t0) {
26
- const $ = c(35);
27
- if ($[0] !== "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c") {
28
- for (let $i = 0; $i < 35; $i += 1) {
27
+ const $ = c(47);
28
+ if ($[0] !== "bc245d0d0a3699b5ab0d750beda2a663dcc05f6d122b039db369f77f976f7ee8") {
29
+ for (let $i = 0; $i < 47; $i += 1) {
29
30
  $[$i] = Symbol.for("react.memo_cache_sentinel");
30
31
  }
31
- $[0] = "550d56d2b4709142d4ace07b800bfd11367b60c980b981f1e1be21c6b691222c";
32
+ $[0] = "bc245d0d0a3699b5ab0d750beda2a663dcc05f6d122b039db369f77f976f7ee8";
32
33
  }
33
34
  let className;
34
35
  let clickable;
35
36
  let index;
36
37
  let keyboardFocusable;
37
38
  let level;
39
+ let noItemVirtualization;
40
+ let noReorderLayout;
38
41
  let restProps;
39
42
  let selected;
40
43
  let userRef;
@@ -45,6 +48,8 @@ function DefaultItemRenderer(t0) {
45
48
  clickable,
46
49
  selected,
47
50
  level,
51
+ noItemVirtualization,
52
+ noReorderLayout,
48
53
  ref: userRef,
49
54
  className,
50
55
  ...restProps
@@ -55,123 +60,176 @@ function DefaultItemRenderer(t0) {
55
60
  $[4] = index;
56
61
  $[5] = keyboardFocusable;
57
62
  $[6] = level;
58
- $[7] = restProps;
59
- $[8] = selected;
60
- $[9] = userRef;
63
+ $[7] = noItemVirtualization;
64
+ $[8] = noReorderLayout;
65
+ $[9] = restProps;
66
+ $[10] = selected;
67
+ $[11] = userRef;
61
68
  } else {
62
69
  className = $[2];
63
70
  clickable = $[3];
64
71
  index = $[4];
65
72
  keyboardFocusable = $[5];
66
73
  level = $[6];
67
- restProps = $[7];
68
- selected = $[8];
69
- userRef = $[9];
74
+ noItemVirtualization = $[7];
75
+ noReorderLayout = $[8];
76
+ restProps = $[9];
77
+ selected = $[10];
78
+ userRef = $[11];
70
79
  }
71
80
  const localRef = useRef(null);
72
- const collapseItemIntoSpacer = use(CollapseItemIntoSpacerContext);
81
+ const composedRef = useComposedRef(userRef, localRef);
73
82
  let t1;
74
- if ($[10] !== collapseItemIntoSpacer) {
75
- t1 = isIntersecting => {
76
- if (localRef.current && !isIntersecting) {
77
- collapseItemIntoSpacer(localRef.current.getBoundingClientRect().height);
78
- }
83
+ if ($[12] !== noItemVirtualization) {
84
+ t1 = (t2, _i, t3) => {
85
+ const [isIntersecting] = t2;
86
+ const [element] = t3;
87
+ return isIntersecting === false && !noItemVirtualization && element?.isConnected && !element.contains(document.activeElement) && !element.previousElementSibling?.contains(document.activeElement) && !element.nextElementSibling?.contains(document.activeElement) ? element.getBoundingClientRect().height : undefined;
79
88
  };
80
- $[10] = collapseItemIntoSpacer;
81
- $[11] = t1;
89
+ $[12] = noItemVirtualization;
90
+ $[13] = t1;
82
91
  } else {
83
- t1 = $[11];
92
+ t1 = $[13];
84
93
  }
85
- useIsIntersectingListener(localRef, t1);
94
+ const t2 = t1;
95
+ let t3;
96
+ if ($[14] !== index || $[15] !== t2) {
97
+ t3 = {
98
+ index,
99
+ refs: localRef,
100
+ onIntersectionChange: t2
101
+ };
102
+ $[14] = index;
103
+ $[15] = t2;
104
+ $[16] = t3;
105
+ } else {
106
+ t3 = $[16];
107
+ }
108
+ useItemVirtualization(t3);
109
+ let t4;
110
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
111
+ t4 = () => {
112
+ var _r$top, _r$bottom;
113
+ const r = localRef.current?.getBoundingClientRect();
114
+ return {
115
+ start: (_r$top = r?.top) !== null && _r$top !== void 0 ? _r$top : 0,
116
+ end: (_r$bottom = r?.bottom) !== null && _r$bottom !== void 0 ? _r$bottom : 0
117
+ };
118
+ };
119
+ $[17] = t4;
120
+ } else {
121
+ t4 = $[17];
122
+ }
123
+ let t5;
124
+ if ($[18] !== index || $[19] !== noReorderLayout) {
125
+ t5 = {
126
+ disabled: noReorderLayout,
127
+ index,
128
+ getBounds: t4
129
+ };
130
+ $[18] = index;
131
+ $[19] = noReorderLayout;
132
+ $[20] = t5;
133
+ } else {
134
+ t5 = $[20];
135
+ }
136
+ useReorderItemLayout(t5);
86
137
  const tableProps = use(TablePropsContext);
87
138
  if (!tableProps) {
88
139
  return null;
89
140
  }
141
+ const {
142
+ reorderAnimation
143
+ } = use(ReorderAnimationContext);
144
+ const isAnimatedItem = reorderAnimation?.direction === "items" && reorderAnimation.index === index;
145
+ const animatedColumnIndex = reorderAnimation?.direction === "columns" ? reorderAnimation.index : undefined;
146
+ const animateClassName = reorderAnimation?.className;
90
147
  const {
91
148
  data,
92
149
  columns
93
150
  } = tableProps;
94
151
  const item = data[index];
95
- let t2;
96
- if ($[12] !== userRef) {
97
- t2 = mergeRefs([userRef, localRef]);
98
- $[12] = userRef;
99
- $[13] = t2;
100
- } else {
101
- t2 = $[13];
102
- }
103
- const t3 = clickable && styles.clickableRow;
104
- const t4 = selected && styles.selectedRow;
105
- let t5;
106
- if ($[14] !== className || $[15] !== t3 || $[16] !== t4) {
107
- t5 = classNames(className, t3, t4);
108
- $[14] = className;
109
- $[15] = t3;
110
- $[16] = t4;
111
- $[17] = t5;
152
+ const t6 = clickable && styles.clickableRow;
153
+ const t7 = selected && styles.selectedRow;
154
+ const t8 = isAnimatedItem && animateClassName;
155
+ let t9;
156
+ if ($[21] !== className || $[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
157
+ t9 = classNames(className, t6, t7, t8);
158
+ $[21] = className;
159
+ $[22] = t6;
160
+ $[23] = t7;
161
+ $[24] = t8;
162
+ $[25] = t9;
112
163
  } else {
113
- t5 = $[17];
164
+ t9 = $[25];
114
165
  }
115
- let t6;
116
- if ($[18] !== columns || $[19] !== data || $[20] !== index || $[21] !== item || $[22] !== level) {
117
- let t7;
118
- if ($[24] !== data || $[25] !== index || $[26] !== item || $[27] !== level) {
119
- t7 = (column, columnIndex) => {
166
+ let t10;
167
+ if ($[26] !== animateClassName || $[27] !== animatedColumnIndex || $[28] !== columns || $[29] !== data || $[30] !== index || $[31] !== item || $[32] !== level) {
168
+ let t11;
169
+ if ($[34] !== animateClassName || $[35] !== animatedColumnIndex || $[36] !== data || $[37] !== index || $[38] !== item || $[39] !== level) {
170
+ t11 = (column, columnIndex) => {
120
171
  var _column$renderCell;
172
+ const {
173
+ key,
174
+ tdClassName,
175
+ indent
176
+ } = column;
121
177
  return /*#__PURE__*/jsx(TableCell, {
122
- className: column.tdClassName?.(item, index, data),
123
- style: column.indent && level != null && level > 0 ? {
124
- paddingInlineStart: `${level * INDENT_SIZE}px`
178
+ className: classNames(columnIndex === animatedColumnIndex && animateClassName, typeof tdClassName === "function" ? tdClassName(item, index, data) : tdClassName),
179
+ style: indent && level != null && level > 0 ? {
180
+ paddingInlineStart: `${level * 24}px`
125
181
  } : undefined,
126
- children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
127
- }, column.key);
182
+ children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex, key)
183
+ }, key);
128
184
  };
129
- $[24] = data;
130
- $[25] = index;
131
- $[26] = item;
132
- $[27] = level;
133
- $[28] = t7;
185
+ $[34] = animateClassName;
186
+ $[35] = animatedColumnIndex;
187
+ $[36] = data;
188
+ $[37] = index;
189
+ $[38] = item;
190
+ $[39] = level;
191
+ $[40] = t11;
134
192
  } else {
135
- t7 = $[28];
193
+ t11 = $[40];
136
194
  }
137
- t6 = columns.map(t7);
138
- $[18] = columns;
139
- $[19] = data;
140
- $[20] = index;
141
- $[21] = item;
142
- $[22] = level;
143
- $[23] = t6;
195
+ t10 = columns.map(t11);
196
+ $[26] = animateClassName;
197
+ $[27] = animatedColumnIndex;
198
+ $[28] = columns;
199
+ $[29] = data;
200
+ $[30] = index;
201
+ $[31] = item;
202
+ $[32] = level;
203
+ $[33] = t10;
144
204
  } else {
145
- t6 = $[23];
205
+ t10 = $[33];
146
206
  }
147
- let t7;
148
- if ($[29] !== keyboardFocusable || $[30] !== restProps || $[31] !== t2 || $[32] !== t5 || $[33] !== t6) {
149
- t7 = /*#__PURE__*/jsx(TableRow, {
150
- ref: t2,
207
+ let t11;
208
+ if ($[41] !== composedRef || $[42] !== keyboardFocusable || $[43] !== restProps || $[44] !== t10 || $[45] !== t9) {
209
+ t11 = /*#__PURE__*/jsx(TableRow, {
210
+ ref: composedRef,
151
211
  keyboardFocusable: keyboardFocusable,
152
- className: t5,
212
+ className: t9,
153
213
  ...restProps,
154
- children: t6
214
+ children: t10
155
215
  });
156
- $[29] = keyboardFocusable;
157
- $[30] = restProps;
158
- $[31] = t2;
159
- $[32] = t5;
160
- $[33] = t6;
161
- $[34] = t7;
216
+ $[41] = composedRef;
217
+ $[42] = keyboardFocusable;
218
+ $[43] = restProps;
219
+ $[44] = t10;
220
+ $[45] = t9;
221
+ $[46] = t11;
162
222
  } else {
163
- t7 = $[34];
223
+ t11 = $[46];
164
224
  }
165
- return t7;
225
+ return t11;
166
226
  }
167
- function getDefaultCellValue(item, columnIndex) {
227
+ function getDefaultCellValue(item, columnIndex, columnKey) {
168
228
  if (Array.isArray(item)) {
169
- var _item$columnIndex;
170
- return String((_item$columnIndex = item[columnIndex]) !== null && _item$columnIndex !== void 0 ? _item$columnIndex : '');
229
+ return String(item[columnIndex]);
171
230
  }
172
231
  if (item !== null && typeof item === 'object') {
173
- var _Object$values$column;
174
- return String((_Object$values$column = Object.values(item)[columnIndex]) !== null && _Object$values$column !== void 0 ? _Object$values$column : '');
232
+ return String(item[String(columnKey)]);
175
233
  }
176
234
  if (columnIndex === 0) {
177
235
  return String(item);
@@ -0,0 +1,21 @@
1
+ import { type RefObject } from 'react';
2
+ import type { Column } from '../table-props';
3
+ import type { ReorderAnimation } from '../reorder-animation';
4
+ export interface ReorderSpec {
5
+ direction: 'columns' | 'items';
6
+ fromIndex: number;
7
+ insertionIndex: number;
8
+ }
9
+ interface ReorderAnimationContextValue {
10
+ reorderAnimation: ReorderAnimation | null;
11
+ expectReorder: (reorderSpec: ReorderSpec) => void;
12
+ }
13
+ export declare const ReorderAnimationContext: import("react").Context<ReorderAnimationContextValue>;
14
+ export declare function useReorderAnimationContextValue<T>({ noColumnReorderAnimation, noItemReorderAnimation, tableRef, data, columns, }: {
15
+ noColumnReorderAnimation: boolean | undefined;
16
+ noItemReorderAnimation: boolean | undefined;
17
+ tableRef: RefObject<HTMLTableElement | null>;
18
+ data: readonly T[];
19
+ columns: readonly Column<T>[];
20
+ }): ReorderAnimationContextValue;
21
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type ComponentPropsWithRef } from 'react';
2
+ import type { DragState } from '../table-primitives';
3
+ export declare function ReorderHandle<T>({ direction, index, noDragFrame, noHandleTranslate, onUserDrag, ref: userRef, className, onKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, ...restProps }: {
4
+ direction: 'columns' | 'items';
5
+ index: number;
6
+ noDragFrame?: boolean;
7
+ noHandleTranslate?: boolean;
8
+ onUserDrag?: (state: DragState) => void;
9
+ } & ComponentPropsWithRef<'button'>): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ interface ItemBounds {
2
+ start: number;
3
+ end: number;
4
+ }
5
+ export interface InsertionPoint {
6
+ itemIndex: number;
7
+ after: boolean;
8
+ }
9
+ interface ReorderLayoutContextValue {
10
+ registerReorderItem(index: number, getBounds: () => ItemBounds): () => void;
11
+ getItemBounds(index: number): ItemBounds | undefined;
12
+ getClosestInsertionPoint(clientOffset: number, canReorder: (insertionIndex: number) => boolean): InsertionPoint | undefined;
13
+ }
14
+ export declare const ReorderLayoutContext: import("react").Context<ReorderLayoutContextValue>;
15
+ export declare function useReorderLayoutContextValue(): ReorderLayoutContextValue;
16
+ export {};
@@ -0,0 +1 @@
1
+ export declare function TableHeader<T>(): import("react").JSX.Element | null;
@@ -0,0 +1,41 @@
1
+ import { type RefObject } from 'react';
2
+ import { type IntersectionObserverHandle } from '../../global/intersection-observer-context';
3
+ export type VirtualItem = MaterializedItem | Spacer;
4
+ interface MaterializedItem {
5
+ type: 'materialized';
6
+ index: number;
7
+ }
8
+ interface Spacer {
9
+ type: 'spacer';
10
+ from: number;
11
+ to: number;
12
+ height: number;
13
+ key: string;
14
+ }
15
+ type CollapseItemIntoSpacerCallback = (index: number, height: number) => void;
16
+ interface VirtualizationContextValue {
17
+ intersectionObserverHandle: IntersectionObserverHandle;
18
+ collapseItemIntoSpacer: CollapseItemIntoSpacerCallback;
19
+ }
20
+ export declare const VirtualizationContext: import("react").Context<VirtualizationContextValue>;
21
+ export declare function useVirtualItems<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
22
+ enabled: boolean;
23
+ data: readonly T[];
24
+ scrollerRef: RefObject<HTMLElement | null> | undefined;
25
+ tableRef: RefObject<HTMLTableElement | null>;
26
+ estimateHeight: (item: T, index: number, items: readonly T[]) => number;
27
+ lookaheadPx: number;
28
+ retentionMarginPx: number;
29
+ minScrollAndResizeDeltaPx: number;
30
+ }): {
31
+ virtualItems: VirtualItem[];
32
+ virtualizationContextValue: {
33
+ intersectionObserverHandle: IntersectionObserverHandle;
34
+ collapseItemIntoSpacer: (index: number, height: number) => void;
35
+ };
36
+ };
37
+ export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
38
+ spacer: Spacer;
39
+ colSpan: number;
40
+ }): import("react").JSX.Element;
41
+ export {};
@@ -0,0 +1,37 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Use in an item renderer to control item virtualization.
4
+ */
5
+ export declare function useItemVirtualization({ index, refs, onIntersectionChange, }: {
6
+ /**
7
+ * Index of the item.
8
+ */
9
+ index: number;
10
+ /**
11
+ * One or more elements representing this item.
12
+ *
13
+ * When multiple elements are provided, the virtualization callback receives
14
+ * the intersection state of all of them.
15
+ *
16
+ * If you pass multiple refs, pass a stable array reference to avoid restarting
17
+ * observation on every render — for example, memoize it with `useMemo()`,
18
+ * unless you use the React Compiler.
19
+ */
20
+ refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[];
21
+ /**
22
+ * Invoked when the `isIntersecting` state of the observed elements changes.
23
+ * Pass a stable function reference to avoid restarting observation on every render —
24
+ * for example, wrap it with `useCallback()`, unless you use the React Compiler.
25
+ *
26
+ * @param intersectionStates - Current intersection state of every observed element.
27
+ * Entries are initially `undefined` until the corresponding element
28
+ * has been reported by `IntersectionObserver`.
29
+ * @param changedIndex - Index of the element whose intersection state changed.
30
+ * @param elements - The observed elements. Note that some elements may
31
+ * already be disconnected from the DOM when this callback is invoked.
32
+ * Use additional checks like `element.isConnected`.
33
+ * @returns Return the height of an item to collapse the item into spacer,
34
+ * or `undefined` to keep the item rendered.
35
+ */
36
+ onIntersectionChange: (intersectionStates: (boolean | undefined)[], changedIndex: number, elements: (Element | null)[]) => number | undefined;
37
+ }): void;
@@ -0,0 +1,73 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use, useEffect } from 'react';
3
+ import { VirtualizationContext } from '../internal/virtualization.js';
4
+ import '../global/intersection-observer-context.js';
5
+ import '../global/schedule-with-cleanup.js';
6
+ import '../_helpers/table.js';
7
+ import 'react/jsx-runtime';
8
+
9
+ /**
10
+ * Use in an item renderer to control item virtualization.
11
+ */
12
+ function useItemVirtualization(t0) {
13
+ const $ = c(8);
14
+ if ($[0] !== "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec") {
15
+ for (let $i = 0; $i < 8; $i += 1) {
16
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
17
+ }
18
+ $[0] = "28d3fc0a1c743c2e72a27a83caad5b78c5438f38b7abdd065da2a832e4f9fcec";
19
+ }
20
+ const {
21
+ index,
22
+ refs,
23
+ onIntersectionChange
24
+ } = t0;
25
+ const {
26
+ intersectionObserverHandle,
27
+ collapseItemIntoSpacer
28
+ } = use(VirtualizationContext);
29
+ let t1;
30
+ let t2;
31
+ if ($[1] !== collapseItemIntoSpacer || $[2] !== index || $[3] !== intersectionObserverHandle || $[4] !== onIntersectionChange || $[5] !== refs) {
32
+ t1 = () => {
33
+ const intersectionStates = Array.isArray(refs) ? refs.map(_temp) : [undefined];
34
+ const elements = Array.isArray(refs) ? refs.map(_temp2) : [refs.current];
35
+ const cleanups = [];
36
+ elements.forEach((element, elementIndex) => {
37
+ if (!element) {
38
+ return;
39
+ }
40
+ const cleanup = intersectionObserverHandle.observe(element, isIntersecting => {
41
+ intersectionStates[elementIndex] = isIntersecting;
42
+ const height = onIntersectionChange(intersectionStates, elementIndex, elements);
43
+ if (height != null) {
44
+ collapseItemIntoSpacer(index, height);
45
+ }
46
+ });
47
+ cleanups.push(cleanup);
48
+ });
49
+ return () => cleanups.forEach(_temp3);
50
+ };
51
+ t2 = [collapseItemIntoSpacer, intersectionObserverHandle, index, onIntersectionChange, refs];
52
+ $[1] = collapseItemIntoSpacer;
53
+ $[2] = index;
54
+ $[3] = intersectionObserverHandle;
55
+ $[4] = onIntersectionChange;
56
+ $[5] = refs;
57
+ $[6] = t1;
58
+ $[7] = t2;
59
+ } else {
60
+ t1 = $[6];
61
+ t2 = $[7];
62
+ }
63
+ useEffect(t1, t2);
64
+ }
65
+ function _temp3(cleanup_0) {
66
+ return cleanup_0();
67
+ }
68
+ function _temp2(r) {
69
+ return r.current;
70
+ }
71
+ function _temp() {}
72
+
73
+ export { useItemVirtualization };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Information about a column or item currently being animated after reorder.
3
+ *
4
+ * Available through {@link useReorderAnimation} to allow custom cell
5
+ * renderers to animate reordered columns and items consistently with the default
6
+ * table renderer.
7
+ */
8
+ export interface ReorderAnimation {
9
+ /**
10
+ * What is animated: columns or items (rows).
11
+ */
12
+ direction: 'columns' | 'items';
13
+ /**
14
+ * Index of the column or item being animated.
15
+ */
16
+ index: number;
17
+ /**
18
+ * Current animation phase.
19
+ */
20
+ phase: 'initial' | 'fade-out';
21
+ /**
22
+ * CSS class to apply to the animated row, cell, or another element used to
23
+ * render the animation on this phase.
24
+ *
25
+ * The class sets `background-color` and `transition`. If your custom styles
26
+ * also define `transition` on the same element, they may conflict with the
27
+ * animation.
28
+ */
29
+ className: string;
30
+ }
31
+ /**
32
+ * Provides information about the currently animated column or item after reorder.
33
+ *
34
+ * Use in a custom cell renderer to animate reordered columns and items
35
+ * consistently with the default table renderer.
36
+ */
37
+ export declare function useReorderAnimation(): ReorderAnimation | null;
@@ -0,0 +1,18 @@
1
+ import { use } from 'react';
2
+ import { ReorderAnimationContext } from '../internal/reorder-animation-context.js';
3
+ import 'react/compiler-runtime';
4
+ import '../global/parse-css-duration.js';
5
+ import '../global/schedule-with-cleanup.js';
6
+ import '../_helpers/table.js';
7
+
8
+ /**
9
+ * Provides information about the currently animated column or item after reorder.
10
+ *
11
+ * Use in a custom cell renderer to animate reordered columns and items
12
+ * consistently with the default table renderer.
13
+ */
14
+ function useReorderAnimation() {
15
+ return use(ReorderAnimationContext).reorderAnimation;
16
+ }
17
+
18
+ export { useReorderAnimation };