@jetbrains/ring-ui-built 8.0.0-beta.2 → 8.0.0-beta.4

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 (214) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/heading.js +2 -2
  4. package/components/_helpers/icon-svg.js +1 -1
  5. package/components/_helpers/legacy-table.js +3 -0
  6. package/components/_helpers/tab-link.js +1 -1
  7. package/components/_helpers/table.js +1 -1
  8. package/components/_helpers/theme.js +50 -38
  9. package/components/alert/alert.js +2 -2
  10. package/components/alert-service/alert-service.js +1 -1
  11. package/components/auth/auth-core.js +1 -1
  12. package/components/auth/auth.js +1 -1
  13. package/components/auth/down-notification.js +1 -1
  14. package/components/auth/iframe-flow.js +2 -2
  15. package/components/auth/storage.js +1 -1
  16. package/components/auth-dialog/auth-dialog.js +1 -1
  17. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  18. package/components/avatar/avatar-info.js +1 -1
  19. package/components/avatar/avatar.js +1 -1
  20. package/components/avatar/fallback-avatar.js +1 -1
  21. package/components/avatar-stack/avatar-stack.js +1 -1
  22. package/components/banner/banner.js +1 -1
  23. package/components/button/button.js +1 -1
  24. package/components/button-group/button-group.js +1 -1
  25. package/components/checkbox/checkbox.d.ts +1 -1
  26. package/components/checkbox/checkbox.js +1 -1
  27. package/components/clipboard/clipboard.js +1 -1
  28. package/components/collapse/collapse-content.js +5 -5
  29. package/components/collapse/collapse-control.js +5 -5
  30. package/components/collapse/collapse.js +4 -4
  31. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  32. package/components/collapsible-group/collapsible-group.js +382 -0
  33. package/components/components/util-stories.js +63 -1
  34. package/components/confirm/confirm.js +1 -1
  35. package/components/confirm-service/confirm-service.js +2 -2
  36. package/components/contenteditable/contenteditable.js +1 -1
  37. package/components/control-help/control-help.js +1 -1
  38. package/components/control-label/control-label.js +1 -1
  39. package/components/data-list/data-list.d.ts +1 -1
  40. package/components/data-list/data-list.js +1 -1
  41. package/components/data-list/data-list.mock.d.ts +1 -1
  42. package/components/data-list/data-list.mock.js +1 -1
  43. package/components/data-list/item.d.ts +1 -1
  44. package/components/data-list/item.js +1 -1
  45. package/components/data-list/selection.d.ts +1 -1
  46. package/components/data-list/selection.js +2 -2
  47. package/components/data-list/title.js +1 -1
  48. package/components/date-picker/date-input.js +1 -1
  49. package/components/date-picker/date-picker.js +1 -2
  50. package/components/date-picker/date-popup.js +4 -5
  51. package/components/date-picker/month-names.js +1 -1
  52. package/components/date-picker/month-slider.js +1 -1
  53. package/components/date-picker/month.js +1 -1
  54. package/components/date-picker/months.js +4 -5
  55. package/components/date-picker/use-scroll-behavior.js +45 -44
  56. package/components/date-picker/weekdays.js +1 -1
  57. package/components/date-picker/years.js +6 -7
  58. package/components/dialog/dialog.d.ts +2 -2
  59. package/components/dialog/dialog.js +3 -3
  60. package/components/dropdown/anchor.js +1 -1
  61. package/components/dropdown/dropdown.js +1 -1
  62. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  63. package/components/dropdown-menu/dropdown-menu.js +68 -63
  64. package/components/editable-heading/editable-heading.d.ts +1 -2
  65. package/components/editable-heading/editable-heading.js +127 -113
  66. package/components/error-bubble/error-bubble.js +1 -1
  67. package/components/error-message/error-message.js +1 -1
  68. package/components/expand/collapsible-group.d.ts +8 -16
  69. package/components/expand/collapsible-group.js +34 -364
  70. package/components/footer/footer.js +1 -1
  71. package/components/global/compose-refs.d.ts +2 -1
  72. package/components/global/compose-refs.js +44 -8
  73. package/components/global/create-stateful-context.js +11 -11
  74. package/components/global/focus-sensor-hoc.js +1 -0
  75. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  76. package/components/global/focus-with-temporary-tabindex.js +23 -0
  77. package/components/global/intersection-observer-context.d.ts +31 -11
  78. package/components/global/intersection-observer-context.js +55 -57
  79. package/components/global/is-within-interactive-element.d.ts +6 -0
  80. package/components/global/is-within-interactive-element.js +11 -0
  81. package/components/global/is-within-navigable-element.d.ts +6 -0
  82. package/components/global/is-within-navigable-element.js +11 -0
  83. package/components/global/parse-css-duration.d.ts +5 -0
  84. package/components/global/parse-css-duration.js +14 -0
  85. package/components/global/rerender-hoc.d.ts +4 -2
  86. package/components/global/rerender-hoc.js +11 -24
  87. package/components/global/schedule-with-cleanup.d.ts +12 -0
  88. package/components/global/schedule-with-cleanup.js +36 -0
  89. package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
  90. package/components/{legacy-table/selection.js → global/table-selection.js} +4 -4
  91. package/components/global/theme.d.ts +4 -3
  92. package/components/global/theme.js +2 -2
  93. package/components/header/header-icon.js +1 -1
  94. package/components/header/header.js +2 -2
  95. package/components/header/links.js +1 -1
  96. package/components/header/logo.js +1 -1
  97. package/components/header/profile.js +1 -1
  98. package/components/header/services.js +1 -1
  99. package/components/header/smart-profile.js +1 -1
  100. package/components/header/smart-services.js +1 -1
  101. package/components/heading/heading.js +4 -4
  102. package/components/i18n/i18n-context.js +4 -4
  103. package/components/icon/icon-svg.js +1 -1
  104. package/components/icon/icon.js +1 -1
  105. package/components/icon/index.js +1 -1
  106. package/components/input/input.d.ts +1 -1
  107. package/components/input/input.js +1 -1
  108. package/components/internal/column-animation.js +133 -0
  109. package/components/internal/table-header.js +1109 -0
  110. package/components/internal/virtual-items.js +353 -0
  111. package/components/island/adaptive-island-hoc.js +3 -3
  112. package/components/island/content.d.ts +7 -2
  113. package/components/island/content.js +27 -18
  114. package/components/island/header.js +1 -1
  115. package/components/island/island.js +1 -1
  116. package/components/legacy-table/cell.js +1 -1
  117. package/components/legacy-table/header-cell.js +4 -4
  118. package/components/legacy-table/header.js +2 -2
  119. package/components/legacy-table/multitable.d.ts +1 -1
  120. package/components/legacy-table/row-with-focus-sensor.js +2 -2
  121. package/components/legacy-table/row.d.ts +1 -1
  122. package/components/legacy-table/row.js +4 -4
  123. package/components/legacy-table/selection-adapter.d.ts +3 -3
  124. package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
  125. package/components/legacy-table/simple-table.d.ts +2 -2
  126. package/components/legacy-table/simple-table.js +4 -4
  127. package/components/legacy-table/smart-table.d.ts +5 -5
  128. package/components/legacy-table/smart-table.js +5 -5
  129. package/components/legacy-table/table.js +2 -2
  130. package/components/list/list-item.js +1 -1
  131. package/components/list/list-users-groups-source.js +1 -1
  132. package/components/list/list.js +1 -1
  133. package/components/login-dialog/login-dialog.js +1 -1
  134. package/components/login-dialog/service.js +2 -2
  135. package/components/markdown/markdown.js +2 -2
  136. package/components/message/message.js +2 -2
  137. package/components/old-browsers-message/white-list.js +2 -2
  138. package/components/pager/pager.js +1 -1
  139. package/components/popup/popup.d.ts +2 -0
  140. package/components/popup/popup.js +6 -2
  141. package/components/popup/popup.target.d.ts +3 -2
  142. package/components/popup/popup.target.js +32 -28
  143. package/components/popup-menu/popup-menu.js +1 -1
  144. package/components/query-assist/query-assist-suggestions.js +1 -1
  145. package/components/query-assist/query-assist.d.ts +3 -1
  146. package/components/query-assist/query-assist.js +2 -2
  147. package/components/radio/radio-item.d.ts +3 -3
  148. package/components/radio/radio-item.js +32 -18
  149. package/components/radio/radio.d.ts +2 -2
  150. package/components/radio/radio.js +2 -2
  151. package/components/scrollable-section/scrollable-section.js +1 -1
  152. package/components/select/chevron-button.js +1 -1
  153. package/components/select/select-filter.js +1 -1
  154. package/components/select/select-popup.d.ts +1 -1
  155. package/components/select/select-popup.js +1 -1
  156. package/components/select/select.d.ts +4 -2
  157. package/components/select/select.js +1 -1
  158. package/components/slider/slider.js +100 -96
  159. package/components/storage/storage-local.js +1 -1
  160. package/components/storage/storage.js +1 -1
  161. package/components/style.css +1 -1
  162. package/components/tab-trap/tab-trap.d.ts +3 -3
  163. package/components/tab-trap/tab-trap.js +83 -80
  164. package/components/table/default-item-renderer.d.ts +35 -11
  165. package/components/table/default-item-renderer.js +118 -171
  166. package/components/table/internal/column-animation.d.ts +16 -0
  167. package/components/table/internal/table-header.d.ts +4 -0
  168. package/components/table/internal/virtual-items.d.ts +34 -0
  169. package/components/table/item-virtualization.d.ts +35 -0
  170. package/components/table/item-virtualization.js +71 -0
  171. package/components/table/table-const.d.ts +40 -6
  172. package/components/table/table-const.js +15 -6
  173. package/components/table/table-primitives.d.ts +21 -0
  174. package/components/table/table-primitives.js +123 -0
  175. package/components/table/table-props.d.ts +280 -0
  176. package/components/table/table-props.js +1 -0
  177. package/components/table/table.d.ts +205 -224
  178. package/components/table/table.js +356 -14
  179. package/components/tabs/collapsible-more.js +1 -1
  180. package/components/tabs/collapsible-tab.js +1 -1
  181. package/components/tabs/collapsible-tabs.js +1 -1
  182. package/components/tabs/dumb-tabs.js +1 -1
  183. package/components/tabs/smart-tabs.js +1 -1
  184. package/components/tabs/tab-link.js +1 -1
  185. package/components/tabs/tabs.js +1 -1
  186. package/components/tag/tag.js +1 -1
  187. package/components/tags-input/tags-input.d.ts +3 -1
  188. package/components/tags-input/tags-input.js +1 -1
  189. package/components/tags-list/tags-list.js +1 -1
  190. package/components/toggle/toggle.js +1 -1
  191. package/components/tooltip/tooltip.js +3 -3
  192. package/components/upload/upload.d.ts +4 -3
  193. package/components/upload/upload.js +7 -29
  194. package/components/user-agreement/service.js +8 -8
  195. package/components/user-agreement/user-agreement.js +1 -1
  196. package/components/user-card/card.js +1 -1
  197. package/components/user-card/smart-user-card-tooltip.js +1 -1
  198. package/components/user-card/tooltip.js +1 -1
  199. package/components/user-card/user-card.js +1 -1
  200. package/components/util-stories.d.ts +26 -0
  201. package/package.json +7 -7
  202. package/components/_helpers/table2.js +0 -3
  203. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  204. package/components/date-picker/use-intersection-observer.js +0 -93
  205. package/components/global/composeRefs.d.ts +0 -6
  206. package/components/global/composeRefs.js +0 -9
  207. package/components/global/use-event-callback.d.ts +0 -1
  208. package/components/global/use-event-callback.js +0 -44
  209. package/components/table/table-base.d.ts +0 -24
  210. package/components/table/table-base.js +0 -311
  211. package/components/table/table-component.d.ts +0 -53
  212. package/components/table/table-component.js +0 -316
  213. package/components/table/table-virtualize.d.ts +0 -32
  214. package/components/table/table-virtualize.js +0 -330
@@ -1,236 +1,183 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useRef, useContext, useEffect } from 'react';
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef, use } from 'react';
3
3
  import classNames from 'classnames';
4
- import { CollapseItemIntoSpacerContext, TablePropsContext } from './table-const.js';
5
- import { useIsIntersectingListener } from '../global/intersection-observer-context.js';
6
- import { TableRow, TableCell } from './table-base.js';
4
+ import { TablePropsContext, ColumnAnimationContext } from './table-const.js';
5
+ import { useComposedRef } from '../global/compose-refs.js';
6
+ import { useItemVirtualization } from './item-virtualization.js';
7
+ import { TableRow, TableCell } from './table-primitives.js';
7
8
  import { s as styles } from '../_helpers/table.js';
8
9
  import { jsx } from 'react/jsx-runtime';
9
- import '@jetbrains/icons/unsorted-12px';
10
- import '@jetbrains/icons/arrow-12px-down';
11
- import '@jetbrains/icons/arrow-12px-up';
12
- import '@jetbrains/icons/trash-12px';
13
- import '../icon/icon.js';
14
- import 'util-deprecate';
15
- import '../icon/icon.constants.js';
16
- import '../_helpers/icon-svg.js';
17
- import '../global/memoize.js';
10
+ import 'memoize-one';
11
+ import '../global/intersection-observer-context.js';
12
+ import '../internal/virtual-items.js';
13
+ import '../global/schedule-with-cleanup.js';
18
14
 
19
- const INDENT_SIZE = 24;
20
- /**
21
- * @see TableProps.renderItem
22
- */
23
15
  function DefaultItemRenderer(t0) {
24
- var _userRef;
25
- const $ = c(51);
26
- if ($[0] !== "68402cdde9f06be4c8d26ab88d5718c4da4a28557eb40dcae73e15c87a598408") {
27
- for (let $i = 0; $i < 51; $i += 1) {
16
+ const $ = c(39);
17
+ if ($[0] !== "814543263ebfe37ed20c6e2945771deb8a681b9bdb7c32cb1fc590d5f0122c82") {
18
+ for (let $i = 0; $i < 39; $i += 1) {
28
19
  $[$i] = Symbol.for("react.memo_cache_sentinel");
29
20
  }
30
- $[0] = "68402cdde9f06be4c8d26ab88d5718c4da4a28557eb40dcae73e15c87a598408";
21
+ $[0] = "814543263ebfe37ed20c6e2945771deb8a681b9bdb7c32cb1fc590d5f0122c82";
31
22
  }
32
23
  let className;
33
24
  let clickable;
34
25
  let index;
26
+ let keyboardFocusable;
35
27
  let level;
36
- let onBlur;
37
- let onKeyDown;
28
+ let noItemVirtualization;
38
29
  let restProps;
30
+ let selected;
39
31
  let userRef;
40
32
  if ($[1] !== t0) {
41
33
  ({
42
- ref: userRef,
43
34
  index,
35
+ keyboardFocusable,
44
36
  clickable,
37
+ selected,
45
38
  level,
39
+ noItemVirtualization,
40
+ ref: userRef,
46
41
  className,
47
- onKeyDown,
48
- onBlur,
49
42
  ...restProps
50
43
  } = t0);
51
44
  $[1] = t0;
52
45
  $[2] = className;
53
46
  $[3] = clickable;
54
47
  $[4] = index;
55
- $[5] = level;
56
- $[6] = onBlur;
57
- $[7] = onKeyDown;
48
+ $[5] = keyboardFocusable;
49
+ $[6] = level;
50
+ $[7] = noItemVirtualization;
58
51
  $[8] = restProps;
59
- $[9] = userRef;
52
+ $[9] = selected;
53
+ $[10] = userRef;
60
54
  } else {
61
55
  className = $[2];
62
56
  clickable = $[3];
63
57
  index = $[4];
64
- level = $[5];
65
- onBlur = $[6];
66
- onKeyDown = $[7];
58
+ keyboardFocusable = $[5];
59
+ level = $[6];
60
+ noItemVirtualization = $[7];
67
61
  restProps = $[8];
68
- userRef = $[9];
62
+ selected = $[9];
63
+ userRef = $[10];
69
64
  }
70
- const selfRef = useRef(null);
71
- const ref = (_userRef = userRef) !== null && _userRef !== void 0 ? _userRef : selfRef;
72
- const collapseItemIntoSpacer = useContext(CollapseItemIntoSpacerContext);
65
+ const localRef = useRef(null);
66
+ const composedRef = useComposedRef(userRef, localRef);
73
67
  let t1;
74
- if ($[10] !== collapseItemIntoSpacer || $[11] !== ref) {
75
- t1 = isIntersecting => {
76
- if (ref.current && !isIntersecting) {
77
- collapseItemIntoSpacer(ref.current.getBoundingClientRect().height);
78
- }
68
+ if ($[11] !== noItemVirtualization) {
69
+ t1 = (t2, _i, t3) => {
70
+ const [isIntersecting] = t2;
71
+ const [element] = t3;
72
+ 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
73
  };
80
- $[10] = collapseItemIntoSpacer;
81
- $[11] = ref;
74
+ $[11] = noItemVirtualization;
82
75
  $[12] = t1;
83
76
  } else {
84
77
  t1 = $[12];
85
78
  }
86
- useIsIntersectingListener(ref, t1);
87
- const {
88
- data,
89
- columns,
90
- selection,
91
- isItemKeyboardFocusable,
92
- onItemFocus
93
- } = useContext(TablePropsContext);
94
- const item = data[index];
95
- const selected = selection?.isSelected(item);
96
- let t2;
97
- if ($[13] !== data || $[14] !== index || $[15] !== isItemKeyboardFocusable || $[16] !== onItemFocus || $[17] !== onKeyDown) {
98
- t2 = function handleKeyDown(e) {
99
- onKeyDown?.(e);
100
- if (!e.defaultPrevented && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
101
- const step = e.key === "ArrowUp" ? -1 : 1;
102
- for (let i = index + step; 0 <= i && i < data.length; i = i + step, i) {
103
- if (isItemKeyboardFocusable?.(data[i], i, data)) {
104
- onItemFocus?.(data[i], i, data);
105
- break;
106
- }
107
- }
108
- }
109
- };
110
- $[13] = data;
111
- $[14] = index;
112
- $[15] = isItemKeyboardFocusable;
113
- $[16] = onItemFocus;
114
- $[17] = onKeyDown;
115
- $[18] = t2;
116
- } else {
117
- t2 = $[18];
118
- }
119
- const handleKeyDown = t2;
79
+ const t2 = t1;
120
80
  let t3;
121
- if ($[19] !== item || $[20] !== selection) {
122
- t3 = selection?.isFocused(item);
123
- $[19] = item;
124
- $[20] = selection;
125
- $[21] = t3;
126
- } else {
127
- t3 = $[21];
128
- }
129
- const focused = t3;
130
- let t4;
131
- let t5;
132
- if ($[22] !== focused || $[23] !== ref) {
133
- t4 = () => {
134
- if (focused) {
135
- ref.current?.focus();
136
- }
81
+ if ($[13] !== index || $[14] !== t2) {
82
+ t3 = {
83
+ index,
84
+ refs: localRef,
85
+ onIntersectionChange: t2
137
86
  };
138
- t5 = [focused, ref];
139
- $[22] = focused;
140
- $[23] = ref;
141
- $[24] = t4;
142
- $[25] = t5;
87
+ $[13] = index;
88
+ $[14] = t2;
89
+ $[15] = t3;
143
90
  } else {
144
- t4 = $[24];
145
- t5 = $[25];
91
+ t3 = $[15];
92
+ }
93
+ useItemVirtualization(t3);
94
+ const tableProps = use(TablePropsContext);
95
+ if (!tableProps) {
96
+ return null;
146
97
  }
147
- useEffect(t4, t5);
98
+ const animatedColumn = use(ColumnAnimationContext);
99
+ const {
100
+ data,
101
+ columns
102
+ } = tableProps;
103
+ const item = data[index];
104
+ const t4 = clickable && styles.clickableRow;
105
+ const t5 = selected && styles.selectedRow;
148
106
  let t6;
149
- if ($[26] !== data || $[27] !== focused || $[28] !== onBlur || $[29] !== onItemFocus) {
150
- t6 = function handleBlur(e_0) {
151
- onBlur?.(e_0);
152
- if (!e_0.defaultPrevented && focused) {
153
- onItemFocus?.(null, -1, data);
154
- }
155
- };
156
- $[26] = data;
157
- $[27] = focused;
158
- $[28] = onBlur;
159
- $[29] = onItemFocus;
160
- $[30] = t6;
107
+ if ($[16] !== className || $[17] !== t4 || $[18] !== t5) {
108
+ t6 = classNames(className, t4, t5);
109
+ $[16] = className;
110
+ $[17] = t4;
111
+ $[18] = t5;
112
+ $[19] = t6;
161
113
  } else {
162
- t6 = $[30];
114
+ t6 = $[19];
163
115
  }
164
- const handleBlur = t6;
165
- const T0 = TableRow;
166
- const t7 = classNames(className, clickable && styles.clickableRow, selected && styles.selectedRow);
167
- const t8 = focused ? 0 : undefined;
168
- const t9 = focused ? handleBlur : undefined;
169
- let t10;
170
- if ($[31] !== columns || $[32] !== data || $[33] !== index || $[34] !== item || $[35] !== level) {
171
- let t11;
172
- if ($[37] !== data || $[38] !== index || $[39] !== item || $[40] !== level) {
173
- t11 = (column, columnIndex) => {
116
+ let t7;
117
+ if ($[20] !== animatedColumn || $[21] !== columns || $[22] !== data || $[23] !== index || $[24] !== item || $[25] !== level) {
118
+ let t8;
119
+ if ($[27] !== animatedColumn || $[28] !== data || $[29] !== index || $[30] !== item || $[31] !== level) {
120
+ t8 = (column, columnIndex) => {
174
121
  var _column$renderCell;
122
+ const {
123
+ key,
124
+ tdClassName,
125
+ indent
126
+ } = column;
175
127
  return /*#__PURE__*/jsx(TableCell, {
176
- className: column.tdClassName?.(item, index, data),
177
- style: column.indent && level != null && level > 0 ? {
178
- paddingInlineStart: `${level * INDENT_SIZE}px`
128
+ className: classNames(columnIndex === animatedColumn?.columnIndex && animatedColumn.cellClassName, typeof tdClassName === "function" ? tdClassName(item, index, data) : tdClassName),
129
+ style: indent && level != null && level > 0 ? {
130
+ paddingInlineStart: `${level * 24}px`
179
131
  } : undefined,
180
- children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
181
- }, column.key);
132
+ children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex, key)
133
+ }, key);
182
134
  };
183
- $[37] = data;
184
- $[38] = index;
185
- $[39] = item;
186
- $[40] = level;
187
- $[41] = t11;
135
+ $[27] = animatedColumn;
136
+ $[28] = data;
137
+ $[29] = index;
138
+ $[30] = item;
139
+ $[31] = level;
140
+ $[32] = t8;
188
141
  } else {
189
- t11 = $[41];
142
+ t8 = $[32];
190
143
  }
191
- t10 = columns.map(t11);
192
- $[31] = columns;
193
- $[32] = data;
194
- $[33] = index;
195
- $[34] = item;
196
- $[35] = level;
197
- $[36] = t10;
144
+ t7 = columns.map(t8);
145
+ $[20] = animatedColumn;
146
+ $[21] = columns;
147
+ $[22] = data;
148
+ $[23] = index;
149
+ $[24] = item;
150
+ $[25] = level;
151
+ $[26] = t7;
198
152
  } else {
199
- t10 = $[36];
153
+ t7 = $[26];
200
154
  }
201
- let t11;
202
- if ($[42] !== T0 || $[43] !== handleKeyDown || $[44] !== ref || $[45] !== restProps || $[46] !== t10 || $[47] !== t7 || $[48] !== t8 || $[49] !== t9) {
203
- t11 = /*#__PURE__*/jsx(T0, {
204
- ref: ref,
205
- className: t7,
206
- onKeyDown: handleKeyDown,
207
- tabIndex: t8,
208
- onBlur: t9,
155
+ let t8;
156
+ if ($[33] !== composedRef || $[34] !== keyboardFocusable || $[35] !== restProps || $[36] !== t6 || $[37] !== t7) {
157
+ t8 = /*#__PURE__*/jsx(TableRow, {
158
+ ref: composedRef,
159
+ keyboardFocusable: keyboardFocusable,
160
+ className: t6,
209
161
  ...restProps,
210
- children: t10
162
+ children: t7
211
163
  });
212
- $[42] = T0;
213
- $[43] = handleKeyDown;
214
- $[44] = ref;
215
- $[45] = restProps;
216
- $[46] = t10;
217
- $[47] = t7;
218
- $[48] = t8;
219
- $[49] = t9;
220
- $[50] = t11;
164
+ $[33] = composedRef;
165
+ $[34] = keyboardFocusable;
166
+ $[35] = restProps;
167
+ $[36] = t6;
168
+ $[37] = t7;
169
+ $[38] = t8;
221
170
  } else {
222
- t11 = $[50];
171
+ t8 = $[38];
223
172
  }
224
- return t11;
173
+ return t8;
225
174
  }
226
- function getDefaultCellValue(item, columnIndex) {
175
+ function getDefaultCellValue(item, columnIndex, columnKey) {
227
176
  if (Array.isArray(item)) {
228
- var _item$columnIndex;
229
- return String((_item$columnIndex = item[columnIndex]) !== null && _item$columnIndex !== void 0 ? _item$columnIndex : '');
177
+ return String(item[columnIndex]);
230
178
  }
231
179
  if (item !== null && typeof item === 'object') {
232
- var _Object$values$column;
233
- return String((_Object$values$column = Object.values(item)[columnIndex]) !== null && _Object$values$column !== void 0 ? _Object$values$column : '');
180
+ return String(item[String(columnKey)]);
234
181
  }
235
182
  if (columnIndex === 0) {
236
183
  return String(item);
@@ -0,0 +1,16 @@
1
+ import { type RefObject } from 'react';
2
+ import type { Column } from '../table-props';
3
+ import type { ColumnAnimation } from '../table-const';
4
+ export interface ReorderSpec {
5
+ fromIndex: number;
6
+ insertionIndex: number;
7
+ }
8
+ export type ExpectColumnReorder = (reorderSpec: ReorderSpec) => void;
9
+ export declare function useColumnAnimation<T>({ disabled, tableRef, columns, }: {
10
+ disabled: boolean | undefined;
11
+ tableRef: RefObject<HTMLTableElement | null>;
12
+ columns: readonly Column<T>[];
13
+ }): {
14
+ columnAnimation: ColumnAnimation | null;
15
+ expectColumnReorder: ExpectColumnReorder;
16
+ };
@@ -0,0 +1,4 @@
1
+ import { type ExpectColumnReorder } from './column-animation';
2
+ export declare function TableHeader<T>({ expectColumnReorder }: {
3
+ expectColumnReorder: ExpectColumnReorder;
4
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,34 @@
1
+ import { type RefObject } from 'react';
2
+ export type VirtualItem = MaterializedItem | Spacer;
3
+ interface MaterializedItem {
4
+ type: 'materialized';
5
+ index: number;
6
+ }
7
+ interface Spacer {
8
+ type: 'spacer';
9
+ from: number;
10
+ to: number;
11
+ height: number;
12
+ key: string;
13
+ }
14
+ type CollapseItemIntoSpacerCallback = (index: number, height: number) => void;
15
+ export declare const CollapseItemIntoSpacerContext: import("react").Context<CollapseItemIntoSpacerCallback>;
16
+ export declare function useVirtualItems<T>({ enabled, data, data: { length }, scrollerRef, tableRef, estimateHeight, lookaheadPx, retentionMarginPx, minScrollAndResizeDeltaPx, }: {
17
+ enabled: boolean;
18
+ data: readonly T[];
19
+ scrollerRef: RefObject<HTMLElement | null> | undefined;
20
+ tableRef: RefObject<HTMLTableElement | null>;
21
+ estimateHeight: (item: T, index: number, items: readonly T[]) => number;
22
+ lookaheadPx: number;
23
+ retentionMarginPx: number;
24
+ minScrollAndResizeDeltaPx: number;
25
+ }): {
26
+ virtualItems: VirtualItem[];
27
+ intersectionObserverHandle: import("../../global/intersection-observer-context").IntersectionObserverHandle;
28
+ collapseItemIntoSpacer: CollapseItemIntoSpacerCallback;
29
+ };
30
+ export declare function SpacerRow({ spacer: { from, to, height }, colSpan }: {
31
+ spacer: Spacer;
32
+ colSpan: number;
33
+ }): import("react").JSX.Element;
34
+ export {};
@@ -0,0 +1,35 @@
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, memoize the array (for example with `useMemo()`)
17
+ * to avoid restarting observation on every render.
18
+ */
19
+ refs: RefObject<HTMLElement | null> | RefObject<HTMLElement | null>[];
20
+ /**
21
+ * Invoked when the `isIntersecting` state of the observed elements changes.
22
+ * Consider wrapping a callback to `useCallback()` to avoid restarting observation on every render.
23
+ *
24
+ * @param intersectionStates - Current intersection state of every observed element.
25
+ * Entries are initially `undefined` until the corresponding element
26
+ * has been reported by `IntersectionObserver`.
27
+ * @param changedIndex - Index of the element whose intersection state changed.
28
+ * @param elements - The observed elements. Note that some elements may
29
+ * already be disconnected from the DOM when this callback is invoked.
30
+ * Use additional checks like `element.isConnected`.
31
+ * @returns Return the height of an item to collapse the item into spacer,
32
+ * or `undefined` to keep the item rendered.
33
+ */
34
+ onIntersectionChange: (intersectionStates: (boolean | undefined)[], changedIndex: number, elements: (Element | null)[]) => number | undefined;
35
+ }): void;
@@ -0,0 +1,71 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use, useEffect } from 'react';
3
+ import { IntersectionObserverContext } from '../global/intersection-observer-context.js';
4
+ import { CollapseItemIntoSpacerContext } from '../internal/virtual-items.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] !== "15177a0e107705dc6d84a0fc97d3302da4c04a0058a1b771c145ee537ccae2cf") {
15
+ for (let $i = 0; $i < 8; $i += 1) {
16
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
17
+ }
18
+ $[0] = "15177a0e107705dc6d84a0fc97d3302da4c04a0058a1b771c145ee537ccae2cf";
19
+ }
20
+ const {
21
+ index,
22
+ refs,
23
+ onIntersectionChange
24
+ } = t0;
25
+ const handle = use(IntersectionObserverContext);
26
+ const collapseItemIntoSpacer = use(CollapseItemIntoSpacerContext);
27
+ let t1;
28
+ let t2;
29
+ if ($[1] !== collapseItemIntoSpacer || $[2] !== handle || $[3] !== index || $[4] !== onIntersectionChange || $[5] !== refs) {
30
+ t1 = () => {
31
+ const intersectionStates = Array.isArray(refs) ? refs.map(_temp) : [undefined];
32
+ const elements = Array.isArray(refs) ? refs.map(_temp2) : [refs.current];
33
+ const cleanups = [];
34
+ elements.forEach((element, elementIndex) => {
35
+ if (!element) {
36
+ return;
37
+ }
38
+ const cleanup = handle.observe(element, isIntersecting => {
39
+ intersectionStates[elementIndex] = isIntersecting;
40
+ const height = onIntersectionChange(intersectionStates, elementIndex, elements);
41
+ if (height != null) {
42
+ collapseItemIntoSpacer(index, height);
43
+ }
44
+ });
45
+ cleanups.push(cleanup);
46
+ });
47
+ return () => cleanups.forEach(_temp3);
48
+ };
49
+ t2 = [collapseItemIntoSpacer, handle, index, onIntersectionChange, refs];
50
+ $[1] = collapseItemIntoSpacer;
51
+ $[2] = handle;
52
+ $[3] = index;
53
+ $[4] = onIntersectionChange;
54
+ $[5] = refs;
55
+ $[6] = t1;
56
+ $[7] = t2;
57
+ } else {
58
+ t1 = $[6];
59
+ t2 = $[7];
60
+ }
61
+ useEffect(t1, t2);
62
+ }
63
+ function _temp3(cleanup_0) {
64
+ return cleanup_0();
65
+ }
66
+ function _temp2(r) {
67
+ return r.current;
68
+ }
69
+ function _temp() {}
70
+
71
+ export { useItemVirtualization };
@@ -1,8 +1,42 @@
1
- import type { TableProps } from './table';
1
+ import type { TableProps } from './table-props';
2
+ /**
3
+ * Use anywhere inside the table to get access to the props passed to it.
4
+ * Cast to `Context<TableProps<T>>` in usage place.
5
+ */
2
6
  export declare const TablePropsContext: import("react").Context<TableProps<unknown> | null>;
3
- export declare const ColumnIndexContext: import("react").Context<number>;
4
- export declare const CollapseItemIntoSpacerContext: import("react").Context<(height: number) => void>;
7
+ /**
8
+ * Information about a column reorder animation.
9
+ *
10
+ * Available through {@link ColumnAnimationContext} to allow custom cell
11
+ * renderers to animate reordered columns consistently with the default
12
+ * table renderer.
13
+ */
14
+ export interface ColumnAnimation {
15
+ /**
16
+ * Index of the column being animated.
17
+ */
18
+ columnIndex: number;
19
+ /**
20
+ * Current animation phase.
21
+ */
22
+ phase: 'initial' | 'fade-out';
23
+ /**
24
+ * CSS class to apply to the animated cell or another element used to
25
+ * render the animation.
26
+ *
27
+ * The class only defines the `background-color` and `transition`
28
+ * properties.
29
+ */
30
+ cellClassName: string;
31
+ }
32
+ /**
33
+ * Provides information about the currently animated column.
34
+ *
35
+ * Use in a custom cell renderer to animate reordered columns
36
+ * consistently with the default table renderer.
37
+ */
38
+ export declare const ColumnAnimationContext: import("react").Context<ColumnAnimation | null>;
39
+ /**
40
+ * When a row only contains unformatted single-line text, it will be exactly of this height.
41
+ */
5
42
  export declare const defaultRowHeight = 37;
6
- export declare const defaultLookaheadPx = 400;
7
- export declare const defaultRetentionMarginPx = 450;
8
- export declare const defaultMinScrollAndResizeDeltaPx = 50;
@@ -1,11 +1,20 @@
1
1
  import { createContext } from 'react';
2
2
 
3
+ /**
4
+ * Use anywhere inside the table to get access to the props passed to it.
5
+ * Cast to `Context<TableProps<T>>` in usage place.
6
+ */
3
7
  const TablePropsContext = /*#__PURE__*/createContext(null);
4
- const ColumnIndexContext = /*#__PURE__*/createContext(-1);
5
- const CollapseItemIntoSpacerContext = /*#__PURE__*/createContext(() => {});
8
+ /**
9
+ * Provides information about the currently animated column.
10
+ *
11
+ * Use in a custom cell renderer to animate reordered columns
12
+ * consistently with the default table renderer.
13
+ */
14
+ const ColumnAnimationContext = /*#__PURE__*/createContext(null);
15
+ /**
16
+ * When a row only contains unformatted single-line text, it will be exactly of this height.
17
+ */
6
18
  const defaultRowHeight = 37;
7
- const defaultLookaheadPx = 400;
8
- const defaultRetentionMarginPx = 450;
9
- const defaultMinScrollAndResizeDeltaPx = 50;
10
19
 
11
- export { CollapseItemIntoSpacerContext, ColumnIndexContext, TablePropsContext, defaultLookaheadPx, defaultMinScrollAndResizeDeltaPx, defaultRetentionMarginPx, defaultRowHeight };
20
+ export { ColumnAnimationContext, TablePropsContext, defaultRowHeight };
@@ -0,0 +1,21 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ export interface TableRowProps {
3
+ /**
4
+ * @see DefaultItemRendererProps.keyboardFocusable
5
+ */
6
+ keyboardFocusable?: boolean;
7
+ }
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare const keyboardFocusableAttrName = "data-keyboard-focusable";
12
+ /**
13
+ * A helper `<tr>` component for custom {@link TableProps.renderItem} implementations.
14
+ * Applies the standard row class names.
15
+ */
16
+ export declare function TableRow(props: TableRowProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element;
17
+ /**
18
+ * A helper `<td>` component for custom {@link TableProps.renderItem} implementations.
19
+ * Applies the standard cell class names, but not data-dependent `tdClassName`.
20
+ */
21
+ export declare function TableCell(props: ComponentPropsWithRef<'td'>): import("react").JSX.Element;