@jetbrains/ring-ui-built 8.0.0-beta.3 → 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 (82) hide show
  1. package/components/_helpers/heading.js +2 -2
  2. package/components/_helpers/table.js +1 -1
  3. package/components/_helpers/theme.js +1 -1
  4. package/components/alert/alert.js +1 -1
  5. package/components/auth/iframe-flow.js +1 -1
  6. package/components/checkbox/checkbox.d.ts +1 -1
  7. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  8. package/components/collapsible-group/collapsible-group.js +382 -0
  9. package/components/components/util-stories.js +63 -1
  10. package/components/data-list/data-list.js +1 -1
  11. package/components/data-list/title.js +1 -1
  12. package/components/date-picker/date-popup.js +3 -3
  13. package/components/dropdown-menu/dropdown-menu.js +6 -6
  14. package/components/editable-heading/editable-heading.js +122 -109
  15. package/components/expand/collapsible-group.d.ts +8 -20
  16. package/components/expand/collapsible-group.js +34 -365
  17. package/components/global/compose-refs.d.ts +2 -1
  18. package/components/global/compose-refs.js +44 -8
  19. package/components/global/focus-sensor-hoc.js +1 -0
  20. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  21. package/components/global/focus-with-temporary-tabindex.js +23 -0
  22. package/components/global/intersection-observer-context.d.ts +29 -9
  23. package/components/global/intersection-observer-context.js +50 -52
  24. package/components/global/is-within-interactive-element.d.ts +6 -0
  25. package/components/global/is-within-interactive-element.js +11 -0
  26. package/components/global/is-within-navigable-element.d.ts +6 -0
  27. package/components/global/is-within-navigable-element.js +11 -0
  28. package/components/global/parse-css-duration.d.ts +5 -0
  29. package/components/global/parse-css-duration.js +14 -0
  30. package/components/global/rerender-hoc.js +1 -0
  31. package/components/global/schedule-with-cleanup.d.ts +12 -0
  32. package/components/global/schedule-with-cleanup.js +36 -0
  33. package/components/global/table-selection.js +1 -1
  34. package/components/global/theme.js +1 -1
  35. package/components/header/header.js +1 -1
  36. package/components/heading/heading.js +3 -3
  37. package/components/input/input.d.ts +1 -1
  38. package/components/internal/column-animation.js +133 -0
  39. package/components/internal/table-header.js +1109 -0
  40. package/components/{table/table-virtualize.js → internal/virtual-items.js} +108 -84
  41. package/components/legacy-table/header-cell.js +2 -2
  42. package/components/legacy-table/row-with-focus-sensor.js +1 -1
  43. package/components/legacy-table/row.d.ts +1 -1
  44. package/components/legacy-table/simple-table.js +1 -1
  45. package/components/legacy-table/smart-table.js +1 -1
  46. package/components/legacy-table/table.js +1 -1
  47. package/components/markdown/markdown.js +2 -2
  48. package/components/message/message.js +1 -1
  49. package/components/old-browsers-message/white-list.js +2 -2
  50. package/components/popup/popup.d.ts +2 -0
  51. package/components/popup/popup.js +5 -1
  52. package/components/select/select-popup.d.ts +1 -1
  53. package/components/select/select.d.ts +1 -1
  54. package/components/style.css +1 -1
  55. package/components/table/default-item-renderer.d.ts +23 -10
  56. package/components/table/default-item-renderer.js +104 -98
  57. package/components/table/internal/column-animation.d.ts +16 -0
  58. package/components/table/internal/table-header.d.ts +4 -0
  59. package/components/table/internal/virtual-items.d.ts +34 -0
  60. package/components/table/item-virtualization.d.ts +35 -0
  61. package/components/table/item-virtualization.js +71 -0
  62. package/components/table/table-const.d.ts +40 -6
  63. package/components/table/table-const.js +15 -6
  64. package/components/table/table-primitives.d.ts +9 -16
  65. package/components/table/table-primitives.js +11 -211
  66. package/components/table/table-props.d.ts +280 -0
  67. package/components/table/table-props.js +1 -0
  68. package/components/table/table.d.ts +205 -209
  69. package/components/table/table.js +356 -15
  70. package/components/tooltip/tooltip.js +1 -1
  71. package/components/user-agreement/service.js +6 -6
  72. package/components/util-stories.d.ts +26 -0
  73. package/package.json +2 -2
  74. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  75. package/components/date-picker/use-intersection-observer.js +0 -93
  76. package/components/global/composeRefs.d.ts +0 -6
  77. package/components/global/composeRefs.js +0 -9
  78. package/components/table/table-component.d.ts +0 -80
  79. package/components/table/table-component.js +0 -290
  80. package/components/table/table-row-focus.d.ts +0 -4
  81. package/components/table/table-row-focus.js +0 -41
  82. package/components/table/table-virtualize.d.ts +0 -32
@@ -1,26 +1,367 @@
1
- import Table from './table-component.js';
2
- import 'react/compiler-runtime';
3
- import 'react';
4
- import 'classnames';
5
- import 'react-merge-refs';
6
- import '../global/intersection-observer-context.js';
7
- import './table-virtualize.js';
8
- import '../_helpers/table.js';
9
- import 'react/jsx-runtime';
10
- import './default-item-renderer.js';
11
- import './table-const.js';
12
- import './table-primitives.js';
13
- import '@jetbrains/icons/unsorted-12px';
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef, Fragment } from 'react';
3
+ import classNames from 'classnames';
4
+ import { IntersectionObserverContext } from '../global/intersection-observer-context.js';
5
+ import { useVirtualItems, SpacerRow, CollapseItemIntoSpacerContext } from '../internal/virtual-items.js';
6
+ import { DefaultItemRenderer } from './default-item-renderer.js';
7
+ import { ColumnAnimationContext, TablePropsContext, defaultRowHeight } from './table-const.js';
8
+ import { focusWithTemporaryTabIndex } from '../global/focus-with-temporary-tabindex.js';
9
+ import { useColumnAnimation } from '../internal/column-animation.js';
10
+ import { useComposedRef } from '../global/compose-refs.js';
11
+ import { TableHeader } from '../internal/table-header.js';
12
+ import { keyboardFocusableAttrName } from './table-primitives.js';
13
+ import { isWithinNavigableElement } from '../global/is-within-navigable-element.js';
14
+ import { s as styles } from '../_helpers/table.js';
15
+ import { jsxs, jsx } from 'react/jsx-runtime';
16
+ import '../global/schedule-with-cleanup.js';
17
+ import './item-virtualization.js';
18
+ import 'memoize-one';
19
+ import '../global/parse-css-duration.js';
14
20
  import '@jetbrains/icons/arrow-12px-down';
15
21
  import '@jetbrains/icons/arrow-12px-up';
22
+ import '@jetbrains/icons/drag-12px';
23
+ import '@jetbrains/icons/settings-12px';
16
24
  import '@jetbrains/icons/trash-12px';
25
+ import '@jetbrains/icons/unsorted-12px';
17
26
  import '../icon/icon.js';
18
27
  import 'util-deprecate';
19
28
  import '../icon/icon.constants.js';
20
29
  import '../_helpers/icon-svg.js';
21
30
  import '../global/memoize.js';
22
- import './table-row-focus.js';
23
-
31
+ import '../global/is-within-interactive-element.js';
24
32
 
33
+ function Table(props) {
34
+ const $ = c(67);
35
+ if ($[0] !== "1440c2302382a13607fbec3a1414b9f71b4289aa94d28f71036161709e9e4ef7") {
36
+ for (let $i = 0; $i < 67; $i += 1) {
37
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
38
+ }
39
+ $[0] = "1440c2302382a13607fbec3a1414b9f71b4289aa94d28f71036161709e9e4ef7";
40
+ }
41
+ let className;
42
+ let columns;
43
+ let data;
44
+ let getKey;
45
+ let noColumnReorderAnimation;
46
+ let renderItem;
47
+ let restProps;
48
+ let scrollerRef;
49
+ let t0;
50
+ let t1;
51
+ let t2;
52
+ let t3;
53
+ let t4;
54
+ let tbodyClassName;
55
+ let userRef;
56
+ if ($[1] !== props) {
57
+ const {
58
+ data: t5,
59
+ columns: t6,
60
+ getKey: t7,
61
+ noHeader,
62
+ stickyHeader,
63
+ onSort,
64
+ onColumnDelete,
65
+ onColumnReorder,
66
+ noColumnReorderAnimation: t8,
67
+ renderItem: t9,
68
+ virtualizeRows: t10,
69
+ scrollerRef: t11,
70
+ estimateHeight: t12,
71
+ lookaheadPx: t13,
72
+ retentionMarginPx: t14,
73
+ minScrollAndResizeDeltaPx: t15,
74
+ columnEditing,
75
+ onColumnEditingRequest,
76
+ columnEditButton,
77
+ theadClassName,
78
+ theadTrClassName,
79
+ tbodyClassName: t16,
80
+ ref: t17,
81
+ className: t18,
82
+ ...t19
83
+ } = props;
84
+ data = t5;
85
+ columns = t6;
86
+ getKey = t7;
87
+ noColumnReorderAnimation = t8;
88
+ renderItem = t9;
89
+ t0 = t10;
90
+ scrollerRef = t11;
91
+ t1 = t12;
92
+ t2 = t13;
93
+ t3 = t14;
94
+ t4 = t15;
95
+ tbodyClassName = t16;
96
+ userRef = t17;
97
+ className = t18;
98
+ restProps = t19;
99
+ $[1] = props;
100
+ $[2] = className;
101
+ $[3] = columns;
102
+ $[4] = data;
103
+ $[5] = getKey;
104
+ $[6] = noColumnReorderAnimation;
105
+ $[7] = renderItem;
106
+ $[8] = restProps;
107
+ $[9] = scrollerRef;
108
+ $[10] = t0;
109
+ $[11] = t1;
110
+ $[12] = t2;
111
+ $[13] = t3;
112
+ $[14] = t4;
113
+ $[15] = tbodyClassName;
114
+ $[16] = userRef;
115
+ } else {
116
+ className = $[2];
117
+ columns = $[3];
118
+ data = $[4];
119
+ getKey = $[5];
120
+ noColumnReorderAnimation = $[6];
121
+ renderItem = $[7];
122
+ restProps = $[8];
123
+ scrollerRef = $[9];
124
+ t0 = $[10];
125
+ t1 = $[11];
126
+ t2 = $[12];
127
+ t3 = $[13];
128
+ t4 = $[14];
129
+ tbodyClassName = $[15];
130
+ userRef = $[16];
131
+ }
132
+ const virtualizeRows = t0 === undefined ? false : t0;
133
+ const estimateHeight = t1 === undefined ? _temp : t1;
134
+ const lookaheadPx = t2 === undefined ? 400 : t2;
135
+ const retentionMarginPx = t3 === undefined ? 450 : t3;
136
+ const minScrollAndResizeDeltaPx = t4 === undefined ? 50 : t4;
137
+ const localRef = useRef(null);
138
+ let t5;
139
+ if ($[17] !== data || $[18] !== estimateHeight || $[19] !== lookaheadPx || $[20] !== minScrollAndResizeDeltaPx || $[21] !== retentionMarginPx || $[22] !== scrollerRef || $[23] !== virtualizeRows) {
140
+ t5 = {
141
+ enabled: virtualizeRows,
142
+ data,
143
+ scrollerRef,
144
+ tableRef: localRef,
145
+ estimateHeight,
146
+ lookaheadPx,
147
+ retentionMarginPx,
148
+ minScrollAndResizeDeltaPx
149
+ };
150
+ $[17] = data;
151
+ $[18] = estimateHeight;
152
+ $[19] = lookaheadPx;
153
+ $[20] = minScrollAndResizeDeltaPx;
154
+ $[21] = retentionMarginPx;
155
+ $[22] = scrollerRef;
156
+ $[23] = virtualizeRows;
157
+ $[24] = t5;
158
+ } else {
159
+ t5 = $[24];
160
+ }
161
+ const {
162
+ virtualItems,
163
+ intersectionObserverHandle,
164
+ collapseItemIntoSpacer
165
+ } = useVirtualItems(t5);
166
+ let t6;
167
+ if ($[25] !== columns || $[26] !== noColumnReorderAnimation) {
168
+ t6 = {
169
+ disabled: noColumnReorderAnimation,
170
+ tableRef: localRef,
171
+ columns
172
+ };
173
+ $[25] = columns;
174
+ $[26] = noColumnReorderAnimation;
175
+ $[27] = t6;
176
+ } else {
177
+ t6 = $[27];
178
+ }
179
+ const {
180
+ columnAnimation,
181
+ expectColumnReorder
182
+ } = useColumnAnimation(t6);
183
+ let t7;
184
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
185
+ t7 = e => {
186
+ if (e.defaultPrevented || isWithinNavigableElement(e.target)) {
187
+ return;
188
+ }
189
+ const arrowUp = e.key === "ArrowUp";
190
+ const arrowDown = e.key === "ArrowDown";
191
+ if (!arrowUp && !arrowDown) {
192
+ return;
193
+ }
194
+ const currentRow = e.target.closest("tr");
195
+ if (currentRow?.parentElement?.parentElement !== localRef.current) {
196
+ return;
197
+ }
198
+ let candidate = currentRow;
199
+ while (candidate) {
200
+ candidate = arrowUp ? candidate.previousElementSibling : candidate.nextElementSibling;
201
+ if (candidate?.hasAttribute(keyboardFocusableAttrName)) {
202
+ focusWithTemporaryTabIndex(candidate);
203
+ e.preventDefault();
204
+ return;
205
+ }
206
+ }
207
+ };
208
+ $[28] = t7;
209
+ } else {
210
+ t7 = $[28];
211
+ }
212
+ const handleRowNavigation = t7;
213
+ let t8;
214
+ if ($[29] !== className) {
215
+ t8 = classNames(styles.table, className);
216
+ $[29] = className;
217
+ $[30] = t8;
218
+ } else {
219
+ t8 = $[30];
220
+ }
221
+ const t9 = useComposedRef(userRef, localRef);
222
+ let t10;
223
+ if ($[31] !== expectColumnReorder) {
224
+ t10 = /*#__PURE__*/jsx(TableHeader, {
225
+ expectColumnReorder: expectColumnReorder
226
+ });
227
+ $[31] = expectColumnReorder;
228
+ $[32] = t10;
229
+ } else {
230
+ t10 = $[32];
231
+ }
232
+ const t11 = virtualizeRows ? virtualItems : data;
233
+ let t12;
234
+ if ($[33] !== columns || $[34] !== data || $[35] !== getKey || $[36] !== renderItem || $[37] !== t11 || $[38] !== virtualizeRows) {
235
+ let t13;
236
+ if ($[40] !== columns || $[41] !== data || $[42] !== getKey || $[43] !== renderItem || $[44] !== virtualizeRows) {
237
+ t13 = (item, index) => {
238
+ let dataItem;
239
+ let dataItemIndex;
240
+ if (virtualizeRows) {
241
+ const virtualItem = item;
242
+ if (virtualItem.type === "spacer") {
243
+ return /*#__PURE__*/jsx(SpacerRow, {
244
+ spacer: virtualItem,
245
+ colSpan: columns.length
246
+ }, virtualItem.key);
247
+ }
248
+ dataItemIndex = virtualItem.index;
249
+ if (dataItemIndex < 0 || dataItemIndex >= data.length) {
250
+ return null;
251
+ }
252
+ dataItem = data[dataItemIndex];
253
+ } else {
254
+ dataItem = item;
255
+ dataItemIndex = index;
256
+ }
257
+ return /*#__PURE__*/jsx(Fragment, {
258
+ children: renderItem ? renderItem(dataItem, dataItemIndex, data) : /*#__PURE__*/jsx(DefaultItemRenderer, {
259
+ index: dataItemIndex
260
+ })
261
+ }, getKey(dataItem, dataItemIndex, data));
262
+ };
263
+ $[40] = columns;
264
+ $[41] = data;
265
+ $[42] = getKey;
266
+ $[43] = renderItem;
267
+ $[44] = virtualizeRows;
268
+ $[45] = t13;
269
+ } else {
270
+ t13 = $[45];
271
+ }
272
+ t12 = t11.map(t13);
273
+ $[33] = columns;
274
+ $[34] = data;
275
+ $[35] = getKey;
276
+ $[36] = renderItem;
277
+ $[37] = t11;
278
+ $[38] = virtualizeRows;
279
+ $[39] = t12;
280
+ } else {
281
+ t12 = $[39];
282
+ }
283
+ let t13;
284
+ if ($[46] !== t12 || $[47] !== tbodyClassName) {
285
+ t13 = /*#__PURE__*/jsx("tbody", {
286
+ className: tbodyClassName,
287
+ onKeyDown: handleRowNavigation,
288
+ children: t12
289
+ });
290
+ $[46] = t12;
291
+ $[47] = tbodyClassName;
292
+ $[48] = t13;
293
+ } else {
294
+ t13 = $[48];
295
+ }
296
+ let t14;
297
+ if ($[49] !== collapseItemIntoSpacer || $[50] !== t13) {
298
+ t14 = /*#__PURE__*/jsx(CollapseItemIntoSpacerContext, {
299
+ value: collapseItemIntoSpacer,
300
+ children: t13
301
+ });
302
+ $[49] = collapseItemIntoSpacer;
303
+ $[50] = t13;
304
+ $[51] = t14;
305
+ } else {
306
+ t14 = $[51];
307
+ }
308
+ let t15;
309
+ if ($[52] !== intersectionObserverHandle || $[53] !== t14) {
310
+ t15 = /*#__PURE__*/jsx(IntersectionObserverContext, {
311
+ value: intersectionObserverHandle,
312
+ children: t14
313
+ });
314
+ $[52] = intersectionObserverHandle;
315
+ $[53] = t14;
316
+ $[54] = t15;
317
+ } else {
318
+ t15 = $[54];
319
+ }
320
+ let t16;
321
+ if ($[55] !== restProps || $[56] !== t10 || $[57] !== t15 || $[58] !== t8 || $[59] !== t9) {
322
+ t16 = /*#__PURE__*/jsxs("table", {
323
+ className: t8,
324
+ ref: t9,
325
+ ...restProps,
326
+ children: [t10, t15]
327
+ });
328
+ $[55] = restProps;
329
+ $[56] = t10;
330
+ $[57] = t15;
331
+ $[58] = t8;
332
+ $[59] = t9;
333
+ $[60] = t16;
334
+ } else {
335
+ t16 = $[60];
336
+ }
337
+ let t17;
338
+ if ($[61] !== columnAnimation || $[62] !== t16) {
339
+ t17 = /*#__PURE__*/jsx(ColumnAnimationContext, {
340
+ value: columnAnimation,
341
+ children: t16
342
+ });
343
+ $[61] = columnAnimation;
344
+ $[62] = t16;
345
+ $[63] = t17;
346
+ } else {
347
+ t17 = $[63];
348
+ }
349
+ let t18;
350
+ if ($[64] !== props || $[65] !== t17) {
351
+ t18 = /*#__PURE__*/jsx(TablePropsContext, {
352
+ value: props,
353
+ children: t17
354
+ });
355
+ $[64] = props;
356
+ $[65] = t17;
357
+ $[66] = t18;
358
+ } else {
359
+ t18 = $[66];
360
+ }
361
+ return t18;
362
+ }
363
+ function _temp() {
364
+ return defaultRowHeight;
365
+ }
25
366
 
26
367
  export { Table as default };
@@ -4,7 +4,7 @@ import Popup from '../popup/popup.js';
4
4
  import { Listeners } from '../global/dom.js';
5
5
  import joinDataTestAttributes from '../global/data-tests.js';
6
6
  import scheduleRAF from '../global/schedule-raf.js';
7
- import { T as Theme, b as ThemeProvider } from '../_helpers/theme.js';
7
+ import { T as Theme, a as ThemeProvider } from '../_helpers/theme.js';
8
8
  import { jsx, jsxs } from 'react/jsx-runtime';
9
9
  import 'react-dom';
10
10
  import '../global/get-uid.js';
@@ -8,13 +8,8 @@ import { ControlsHeightContext, getGlobalControlsHeight } from '../global/contro
8
8
  import UserAgreement from './user-agreement.js';
9
9
  import { jsx, jsxs } from 'react/jsx-runtime';
10
10
  import '../global/get-uid.js';
11
- import '../alert/container.js';
12
11
  import 'react';
13
- import 'react-dom';
14
12
  import 'classnames';
15
- import '../global/data-tests.js';
16
- import '../link/clickable-link.js';
17
- import '../_helpers/link.js';
18
13
  import '@jetbrains/icons/exception';
19
14
  import '@jetbrains/icons/checkmark';
20
15
  import '@jetbrains/icons/warning';
@@ -26,13 +21,18 @@ import '../_helpers/icon-svg.js';
26
21
  import 'react/compiler-runtime';
27
22
  import '../global/memoize.js';
28
23
  import '../loader-inline/loader-inline.js';
24
+ import '../global/data-tests.js';
29
25
  import '../global/dom.js';
30
26
  import '../button/button.js';
31
27
  import '@jetbrains/icons/chevron-down';
32
28
  import '@jetbrains/icons/chevron-12px-down';
29
+ import '../link/clickable-link.js';
33
30
  import '../_helpers/button.classes.js';
34
- import '../_helpers/theme.js';
35
31
  import '../global/configuration.js';
32
+ import '../_helpers/theme.js';
33
+ import '../alert/container.js';
34
+ import 'react-dom';
35
+ import '../_helpers/link.js';
36
36
  import '../dialog/dialog.js';
37
37
  import '../island/island.js';
38
38
  import '../island/adaptive-island-hoc.js';
@@ -1 +1,27 @@
1
1
  export declare const hideAddonsPanelParam = "hideAddonsPanel";
2
+ export declare function createRandom(seed: bigint): {
3
+ /**
4
+ * Fractional in [0, 1)
5
+ */
6
+ (): number;
7
+ /**
8
+ * Integer in [0, to)
9
+ */
10
+ (to: number): number;
11
+ /**
12
+ * Integer in [from, to)
13
+ */
14
+ (from: number, to: number): number;
15
+ /**
16
+ * Date in [from, to)
17
+ */
18
+ (from: Date, to: Date): Date;
19
+ /**
20
+ * Up to random n items (in random order) from the array
21
+ */
22
+ <T>(array: T[], n: number): T[];
23
+ /**
24
+ * Random item from the array
25
+ */
26
+ <T>(array: T[]): T;
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui-built",
3
- "version": "8.0.0-beta.3",
3
+ "version": "8.0.0-beta.4",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -112,7 +112,7 @@
112
112
  }
113
113
  },
114
114
  "dependencies": {
115
- "@jetbrains/icons": "^5.22.0",
115
+ "@jetbrains/icons": "^5.23.0",
116
116
  "change-case": "^4.1.1",
117
117
  "classnames": "^2.5.1",
118
118
  "combokeys": "^3.0.1",
@@ -1,6 +0,0 @@
1
- import { type RefObject } from 'react';
2
- export declare function useIntersectionObserver(containerRef: RefObject<HTMLElement | null>, scrollMargin?: number): IntersectionObserverHandle | null;
3
- export interface IntersectionObserverHandle {
4
- observeVisibility(element: Element, setVisible: (isVisible: boolean) => void): () => void;
5
- }
6
- export declare function useVisibility(handle: IntersectionObserverHandle | null, elementRef: RefObject<Element | null>): boolean;
@@ -1,93 +0,0 @@
1
- import { c } from 'react/compiler-runtime';
2
- import { useState, useEffect } from 'react';
3
-
4
- function useIntersectionObserver(containerRef, t0) {
5
- const $ = c(5);
6
- if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
7
- for (let $i = 0; $i < 5; $i += 1) {
8
- $[$i] = Symbol.for("react.memo_cache_sentinel");
9
- }
10
- $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
11
- }
12
- const scrollMargin = t0 === undefined ? 0 : t0;
13
- const [handle, setHandle] = useState(null);
14
- let t1;
15
- let t2;
16
- if ($[1] !== containerRef || $[2] !== scrollMargin) {
17
- t1 = () => {
18
- const container = containerRef.current;
19
- if (!container) {
20
- return;
21
- }
22
- const elementToSetVisible = new Map();
23
- const observer = new IntersectionObserver(entries => {
24
- for (const entry of entries) {
25
- const setVisible = elementToSetVisible.get(entry.target);
26
- setVisible?.(entry.isIntersecting);
27
- }
28
- }, {
29
- root: container,
30
- ...(scrollMargin ? {
31
- scrollMargin: `${scrollMargin}px`
32
- } : {})
33
- });
34
- setHandle({
35
- observeVisibility(element, setVisible_0) {
36
- elementToSetVisible.set(element, setVisible_0);
37
- observer.observe(element);
38
- return () => {
39
- elementToSetVisible.delete(element);
40
- observer.unobserve(element);
41
- };
42
- }
43
- });
44
- return () => {
45
- observer.disconnect();
46
- setHandle(null);
47
- };
48
- };
49
- t2 = [containerRef, scrollMargin];
50
- $[1] = containerRef;
51
- $[2] = scrollMargin;
52
- $[3] = t1;
53
- $[4] = t2;
54
- } else {
55
- t1 = $[3];
56
- t2 = $[4];
57
- }
58
- useEffect(t1, t2);
59
- return handle;
60
- }
61
- function useVisibility(handle, elementRef) {
62
- const $ = c(5);
63
- if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
64
- for (let $i = 0; $i < 5; $i += 1) {
65
- $[$i] = Symbol.for("react.memo_cache_sentinel");
66
- }
67
- $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
68
- }
69
- const [isVisible, setIsVisible] = useState(false);
70
- let t0;
71
- let t1;
72
- if ($[1] !== elementRef || $[2] !== handle) {
73
- t0 = () => {
74
- const element = elementRef.current;
75
- if (!element || !handle) {
76
- return;
77
- }
78
- return handle.observeVisibility(element, setIsVisible);
79
- };
80
- t1 = [handle, elementRef, setIsVisible];
81
- $[1] = elementRef;
82
- $[2] = handle;
83
- $[3] = t0;
84
- $[4] = t1;
85
- } else {
86
- t0 = $[3];
87
- t1 = $[4];
88
- }
89
- useEffect(t0, t1);
90
- return isVisible;
91
- }
92
-
93
- export { useIntersectionObserver, useVisibility };
@@ -1,6 +0,0 @@
1
- import { createComposedRef as _createComposedRef } from './compose-refs';
2
- /**
3
- * @deprecated Use createComposedRef from './compose-refs' instead
4
- */
5
- declare const createComposedRef: typeof _createComposedRef;
6
- export { createComposedRef };
@@ -1,9 +0,0 @@
1
- import { createComposedRef as createComposedRef$1 } from './compose-refs.js';
2
- import 'memoize-one';
3
-
4
- /**
5
- * @deprecated Use createComposedRef from './compose-refs' instead
6
- */
7
- const createComposedRef = createComposedRef$1;
8
-
9
- export { createComposedRef };
@@ -1,80 +0,0 @@
1
- import { type ComponentPropsWithRef } from 'react';
2
- import type { TableProps } from './table';
3
- /**
4
- * The new Table component. Use it instead of tables in the `legacy-table` folder.
5
- *
6
- * For every prop and component referenced here, see the corresponding docs
7
- * for detailed behavior.
8
- *
9
- * ## Minimal usage
10
- *
11
- * You need the following props:
12
- * - `data`
13
- * - `getKey`
14
- * - `columns`
15
- * - `key`
16
- * - `name` (not required but needed in most cases)
17
- * - `renderCell` (not required but needed in most cases)
18
- *
19
- * ## Selection
20
- *
21
- * Selection is handled on item level via `renderItem` (often with
22
- * `DefaultItemRenderer`) and its props:
23
- *
24
- * - `clickable`
25
- * - `selected`
26
- * - `onClick` or `onPointerUp`, etc.
27
- *
28
- * You may use the TableSelection from `global/table-selection.ts` for the selection control:
29
- *
30
- * - `selected={tableSelection.isSelected(item)}`
31
- * - `onClick={() => setTableSelection(tableSelection.toggle(item))}`
32
- *
33
- * See the stories for examples with this utility.
34
- *
35
- * Additionally, for accessibility, you will likely need a cell with a checkbox
36
- * to toggle item selection.
37
- *
38
- * ## Sorting
39
- *
40
- * You need the following to support sorting:
41
- *
42
- * - Include `<SortButton />` in a column header
43
- * - Set initial `Column.sortOrder` to `none`. Do not leave `undefined`
44
- * for accessibility reasons.
45
- * - Handle `TableProps.onSort` callback in the client code. It is expected
46
- * to update `columns` by setting the new `sortOrder` value for
47
- * the corresponding column, and updating the data accordingly.
48
- *
49
- * ## Focus
50
- *
51
- * The table supports the ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
52
- * technique to focus rows with the up/down arrow keys and, possibly, with the pointer.
53
- * To support it, use the following props of the `DefaultItemRenderer`:
54
- *
55
- * - `keyboardFocusable`
56
- * - Possibly `onClick` invoking `focusRow(e.currentTarget)`
57
- *
58
- * In your custom row renderer, use `TableRow`, which also has the `keyboardFocusable` prop.
59
- *
60
- * ## Deleting columns
61
- *
62
- * You need the following to support deleting columns:
63
- *
64
- * - Make sure the `column` has a proper `name` or `key` prop, which will be
65
- * automatically included in the aria-label of `<DeleteColumnButton />`.
66
- * - Include `<DeleteColumnButton />` in a column header
67
- * - Handle `TableProps.onColumnDelete` callback in the client code. It is expected
68
- * to update `columns` by removing the corresponding column.
69
- *
70
- * ## Row virtualization
71
- *
72
- * To render only rows near the viewport and replace others with spacers, use:
73
- *
74
- * - `virtualizeRows`
75
- * - `scrollerRef` — required when the scrollable container is not the whole document
76
- * - `estimateHeight` — recommended when rows are expected to be taller than
77
- * the default height (e.g. multiline or custom content)
78
- * - Fine-tuning props: `lookaheadPx`, `retentionMarginPx`, `minScrollAndResizeDeltaPx`
79
- */
80
- export default function Table<T>(props: TableProps<T> & ComponentPropsWithRef<'table'>): import("react").JSX.Element;