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

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 (57) hide show
  1. package/components/_helpers/table.js +2 -2
  2. package/components/_helpers/table2.js +3 -0
  3. package/components/data-list/data-list.d.ts +4 -4
  4. package/components/data-list/data-list.js +2 -2
  5. package/components/data-list/data-list.mock.d.ts +1 -1
  6. package/components/data-list/item.d.ts +1 -1
  7. package/components/data-list/selection.d.ts +1 -1
  8. package/components/data-list/selection.js +1 -1
  9. package/components/date-picker/date-picker.js +1 -1
  10. package/components/date-picker/date-popup.js +1 -1
  11. package/components/date-picker/month.d.ts +0 -2
  12. package/components/date-picker/month.js +16 -17
  13. package/components/date-picker/months.js +42 -33
  14. package/components/date-picker/years.js +60 -52
  15. package/components/global/intersection-observer-context.d.ts +26 -0
  16. package/components/global/intersection-observer-context.js +140 -0
  17. package/components/{table → legacy-table}/cell.js +1 -1
  18. package/components/{table → legacy-table}/header-cell.js +3 -3
  19. package/components/{table → legacy-table}/header.js +1 -1
  20. package/components/{table → legacy-table}/row-with-focus-sensor.js +1 -1
  21. package/components/{table → legacy-table}/row.js +1 -1
  22. package/components/{table → legacy-table}/selection.d.ts +2 -2
  23. package/components/{table → legacy-table}/selection.js +1 -1
  24. package/components/{table → legacy-table}/simple-table.js +1 -1
  25. package/components/{table → legacy-table}/smart-table.js +1 -1
  26. package/components/legacy-table/table.d.ts +109 -0
  27. package/components/legacy-table/table.js +369 -0
  28. package/components/old-browsers-message/white-list.js +2 -2
  29. package/components/style.css +1 -1
  30. package/components/table/default-item-renderer.d.ts +25 -0
  31. package/components/table/default-item-renderer.js +241 -0
  32. package/components/table/table-base.d.ts +24 -0
  33. package/components/table/table-base.js +311 -0
  34. package/components/table/table-component.d.ts +53 -0
  35. package/components/table/table-component.js +316 -0
  36. package/components/table/table-const.d.ts +8 -0
  37. package/components/table/table-const.js +11 -0
  38. package/components/table/table-virtualize.d.ts +32 -0
  39. package/components/table/table-virtualize.js +330 -0
  40. package/components/table/table.d.ts +221 -104
  41. package/components/table/table.js +18 -362
  42. package/package.json +1 -1
  43. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  44. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  45. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  46. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  47. /package/components/{table → legacy-table}/header.d.ts +0 -0
  48. /package/components/{table → legacy-table}/multitable.d.ts +0 -0
  49. /package/components/{table → legacy-table}/multitable.js +0 -0
  50. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  51. /package/components/{table → legacy-table}/row.d.ts +0 -0
  52. /package/components/{table → legacy-table}/selection-adapter.d.ts +0 -0
  53. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  54. /package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +0 -0
  55. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
  56. /package/components/{table → legacy-table}/simple-table.d.ts +0 -0
  57. /package/components/{table → legacy-table}/smart-table.d.ts +0 -0
@@ -0,0 +1,25 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ export interface DefaultItemRendererProps {
3
+ /**
4
+ * Installed on the `<tr>` element
5
+ */
6
+ ref?: React.RefObject<HTMLTableRowElement | null>;
7
+ /**
8
+ * The index of the `data` item to render
9
+ */
10
+ index: number;
11
+ /**
12
+ * Changes the highlight on hover and applies the pointer cursor.
13
+ * Note that `false` doesn't mean it cannot handle `onClick`.
14
+ */
15
+ clickable?: boolean;
16
+ /**
17
+ * A level of a nested item. Results in an indent for columns with `indent: true`.
18
+ * 0, negative and not set mean no indent.
19
+ */
20
+ level?: number;
21
+ }
22
+ /**
23
+ * @see TableProps.renderItem
24
+ */
25
+ export declare function DefaultItemRenderer<T>({ ref: userRef, index, clickable, level, className, onKeyDown, onBlur, ...restProps }: DefaultItemRendererProps & ComponentPropsWithoutRef<'tr'>): import("react").JSX.Element;
@@ -0,0 +1,241 @@
1
+ import { c } from 'react-compiler-runtime';
2
+ import { useRef, useContext, useEffect } from 'react';
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';
7
+ import { s as styles } from '../_helpers/table.js';
8
+ 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';
18
+
19
+ const INDENT_SIZE = 24;
20
+ /**
21
+ * @see TableProps.renderItem
22
+ */
23
+ function DefaultItemRenderer(t0) {
24
+ var _userRef;
25
+ const $ = c(51);
26
+ if ($[0] !== "68402cdde9f06be4c8d26ab88d5718c4da4a28557eb40dcae73e15c87a598408") {
27
+ for (let $i = 0; $i < 51; $i += 1) {
28
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
29
+ }
30
+ $[0] = "68402cdde9f06be4c8d26ab88d5718c4da4a28557eb40dcae73e15c87a598408";
31
+ }
32
+ let className;
33
+ let clickable;
34
+ let index;
35
+ let level;
36
+ let onBlur;
37
+ let onKeyDown;
38
+ let restProps;
39
+ let userRef;
40
+ if ($[1] !== t0) {
41
+ ({
42
+ ref: userRef,
43
+ index,
44
+ clickable,
45
+ level,
46
+ className,
47
+ onKeyDown,
48
+ onBlur,
49
+ ...restProps
50
+ } = t0);
51
+ $[1] = t0;
52
+ $[2] = className;
53
+ $[3] = clickable;
54
+ $[4] = index;
55
+ $[5] = level;
56
+ $[6] = onBlur;
57
+ $[7] = onKeyDown;
58
+ $[8] = restProps;
59
+ $[9] = userRef;
60
+ } else {
61
+ className = $[2];
62
+ clickable = $[3];
63
+ index = $[4];
64
+ level = $[5];
65
+ onBlur = $[6];
66
+ onKeyDown = $[7];
67
+ restProps = $[8];
68
+ userRef = $[9];
69
+ }
70
+ const selfRef = useRef(null);
71
+ const ref = (_userRef = userRef) !== null && _userRef !== void 0 ? _userRef : selfRef;
72
+ const collapseItemIntoSpacer = useContext(CollapseItemIntoSpacerContext);
73
+ let t1;
74
+ if ($[10] !== collapseItemIntoSpacer || $[11] !== ref) {
75
+ t1 = isIntersecting => {
76
+ if (ref.current && !isIntersecting) {
77
+ collapseItemIntoSpacer(ref.current.getBoundingClientRect().height);
78
+ }
79
+ };
80
+ $[10] = collapseItemIntoSpacer;
81
+ $[11] = ref;
82
+ $[12] = t1;
83
+ } else {
84
+ t1 = $[12];
85
+ }
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;
120
+ 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
+ }
137
+ };
138
+ t5 = [focused, ref];
139
+ $[22] = focused;
140
+ $[23] = ref;
141
+ $[24] = t4;
142
+ $[25] = t5;
143
+ } else {
144
+ t4 = $[24];
145
+ t5 = $[25];
146
+ }
147
+ useEffect(t4, t5);
148
+ 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;
161
+ } else {
162
+ t6 = $[30];
163
+ }
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) => {
174
+ var _column$renderCell;
175
+ 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`
179
+ } : undefined,
180
+ children: (_column$renderCell = column.renderCell?.(item, index, data)) !== null && _column$renderCell !== void 0 ? _column$renderCell : getDefaultCellValue(item, columnIndex)
181
+ }, column.key);
182
+ };
183
+ $[37] = data;
184
+ $[38] = index;
185
+ $[39] = item;
186
+ $[40] = level;
187
+ $[41] = t11;
188
+ } else {
189
+ t11 = $[41];
190
+ }
191
+ t10 = columns.map(t11);
192
+ $[31] = columns;
193
+ $[32] = data;
194
+ $[33] = index;
195
+ $[34] = item;
196
+ $[35] = level;
197
+ $[36] = t10;
198
+ } else {
199
+ t10 = $[36];
200
+ }
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,
209
+ ...restProps,
210
+ children: t10
211
+ });
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;
221
+ } else {
222
+ t11 = $[50];
223
+ }
224
+ return t11;
225
+ }
226
+ function getDefaultCellValue(item, columnIndex) {
227
+ if (Array.isArray(item)) {
228
+ var _item$columnIndex;
229
+ return String((_item$columnIndex = item[columnIndex]) !== null && _item$columnIndex !== void 0 ? _item$columnIndex : '');
230
+ }
231
+ 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 : '');
234
+ }
235
+ if (columnIndex === 0) {
236
+ return String(item);
237
+ }
238
+ return '';
239
+ }
240
+
241
+ export { DefaultItemRenderer };
@@ -0,0 +1,24 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ /**
3
+ * Include it in a column header to make the column sortable.
4
+ * Handle clicks with {@link TableProps.onSort}.
5
+ */
6
+ export declare function SortButton<T>(props: ComponentPropsWithoutRef<'button'>): import("react").JSX.Element | null;
7
+ /**
8
+ * Include it in a column header to make the column deletable.
9
+ * Beware that `column.name ?? String(column.key)` is used in the aria-label.
10
+ * Handle clicks with {@link TableProps.onColumnDelete}.
11
+ */
12
+ export declare function DeleteColumnButton<T>(props: ComponentPropsWithoutRef<'button'>): import("react").JSX.Element | null;
13
+ /**
14
+ * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
15
+ * Applies the standard row classnames.
16
+ */
17
+ export declare function TableRow(props: {
18
+ ref?: React.Ref<HTMLTableRowElement>;
19
+ } & ComponentPropsWithoutRef<'tr'>): import("react").JSX.Element;
20
+ /**
21
+ * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
22
+ * Applies the standard cell classnames, but not data-dependent `tdClassName`.
23
+ */
24
+ export declare function TableCell(props: ComponentPropsWithoutRef<'td'>): import("react").JSX.Element;
@@ -0,0 +1,311 @@
1
+ import { c } from 'react-compiler-runtime';
2
+ import { useContext } from 'react';
3
+ import classNames from 'classnames';
4
+ import unsortedIcon from '@jetbrains/icons/unsorted-12px';
5
+ import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
6
+ import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
7
+ import trashIcon from '@jetbrains/icons/trash-12px';
8
+ import Icon from '../icon/icon.js';
9
+ import { TablePropsContext, ColumnIndexContext } from './table-const.js';
10
+ import { s as styles } from '../_helpers/table.js';
11
+ import { jsx, jsxs } from 'react/jsx-runtime';
12
+ import 'util-deprecate';
13
+ import '../icon/icon.constants.js';
14
+ import '../_helpers/icon-svg.js';
15
+ import '../global/memoize.js';
16
+
17
+ function SortButton(props) {
18
+ var _column$sortOrder;
19
+ const $ = c(21);
20
+ if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
21
+ for (let $i = 0; $i < 21; $i += 1) {
22
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
23
+ }
24
+ $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
25
+ }
26
+ const tableProps = useContext(TablePropsContext);
27
+ const columnIndex = useContext(ColumnIndexContext);
28
+ const column = tableProps?.columns[columnIndex];
29
+ if (!tableProps || !column) {
30
+ return null;
31
+ }
32
+ const sortOrder = (_column$sortOrder = column.sortOrder) !== null && _column$sortOrder !== void 0 ? _column$sortOrder : "none";
33
+ const glyph = sortOrder === "none" ? unsortedIcon : sortOrder === "ascending" ? arrowUpIcon : arrowDownIcon;
34
+ let children;
35
+ let className;
36
+ let onClick;
37
+ let restProps;
38
+ if ($[1] !== props) {
39
+ ({
40
+ className,
41
+ children,
42
+ onClick,
43
+ ...restProps
44
+ } = props);
45
+ $[1] = props;
46
+ $[2] = children;
47
+ $[3] = className;
48
+ $[4] = onClick;
49
+ $[5] = restProps;
50
+ } else {
51
+ children = $[2];
52
+ className = $[3];
53
+ onClick = $[4];
54
+ restProps = $[5];
55
+ }
56
+ let t0;
57
+ if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== sortOrder || $[9] !== tableProps) {
58
+ t0 = function handleClick(e) {
59
+ onClick?.(e);
60
+ if (!e.defaultPrevented) {
61
+ const sequence = ["none", "ascending", "descending"];
62
+ const nextOrder = sequence[(sequence.indexOf(sortOrder) + 1) % sequence.length];
63
+ tableProps.onSort?.(columnIndex, nextOrder);
64
+ }
65
+ };
66
+ $[6] = columnIndex;
67
+ $[7] = onClick;
68
+ $[8] = sortOrder;
69
+ $[9] = tableProps;
70
+ $[10] = t0;
71
+ } else {
72
+ t0 = $[10];
73
+ }
74
+ const handleClick = t0;
75
+ let t1;
76
+ if ($[11] !== className) {
77
+ t1 = classNames(styles.headerButton, className);
78
+ $[11] = className;
79
+ $[12] = t1;
80
+ } else {
81
+ t1 = $[12];
82
+ }
83
+ let t2;
84
+ if ($[13] !== glyph) {
85
+ t2 = /*#__PURE__*/jsx(Icon, {
86
+ glyph: glyph,
87
+ "aria-hidden": true
88
+ });
89
+ $[13] = glyph;
90
+ $[14] = t2;
91
+ } else {
92
+ t2 = $[14];
93
+ }
94
+ let t3;
95
+ if ($[15] !== children || $[16] !== handleClick || $[17] !== restProps || $[18] !== t1 || $[19] !== t2) {
96
+ t3 = /*#__PURE__*/jsxs("button", {
97
+ type: "button",
98
+ className: t1,
99
+ onClick: handleClick,
100
+ ...restProps,
101
+ children: [children, " ", t2]
102
+ });
103
+ $[15] = children;
104
+ $[16] = handleClick;
105
+ $[17] = restProps;
106
+ $[18] = t1;
107
+ $[19] = t2;
108
+ $[20] = t3;
109
+ } else {
110
+ t3 = $[20];
111
+ }
112
+ return t3;
113
+ }
114
+ /**
115
+ * Include it in a column header to make the column deletable.
116
+ * Beware that `column.name ?? String(column.key)` is used in the aria-label.
117
+ * Handle clicks with {@link TableProps.onColumnDelete}.
118
+ */
119
+ function DeleteColumnButton(props) {
120
+ var _column$name;
121
+ const $ = c(17);
122
+ if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
123
+ for (let $i = 0; $i < 17; $i += 1) {
124
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
125
+ }
126
+ $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
127
+ }
128
+ const tableProps = useContext(TablePropsContext);
129
+ const columnIndex = useContext(ColumnIndexContext);
130
+ const column = tableProps?.columns[columnIndex];
131
+ if (!tableProps || !column) {
132
+ return null;
133
+ }
134
+ let className;
135
+ let onClick;
136
+ let restProps;
137
+ if ($[1] !== props) {
138
+ ({
139
+ className,
140
+ onClick,
141
+ ...restProps
142
+ } = props);
143
+ $[1] = props;
144
+ $[2] = className;
145
+ $[3] = onClick;
146
+ $[4] = restProps;
147
+ } else {
148
+ className = $[2];
149
+ onClick = $[3];
150
+ restProps = $[4];
151
+ }
152
+ let t0;
153
+ if ($[5] !== columnIndex || $[6] !== onClick || $[7] !== tableProps) {
154
+ t0 = function handleClick(e) {
155
+ onClick?.(e);
156
+ if (!e.defaultPrevented) {
157
+ tableProps.onColumnDelete?.(columnIndex);
158
+ }
159
+ };
160
+ $[5] = columnIndex;
161
+ $[6] = onClick;
162
+ $[7] = tableProps;
163
+ $[8] = t0;
164
+ } else {
165
+ t0 = $[8];
166
+ }
167
+ const handleClick = t0;
168
+ let t1;
169
+ if ($[9] !== className) {
170
+ t1 = classNames(styles.headerButton, styles.deleteColumnButton, className);
171
+ $[9] = className;
172
+ $[10] = t1;
173
+ } else {
174
+ t1 = $[10];
175
+ }
176
+ const t2 = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}`;
177
+ let t3;
178
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
179
+ t3 = /*#__PURE__*/jsx(Icon, {
180
+ glyph: trashIcon
181
+ });
182
+ $[11] = t3;
183
+ } else {
184
+ t3 = $[11];
185
+ }
186
+ let t4;
187
+ if ($[12] !== handleClick || $[13] !== restProps || $[14] !== t1 || $[15] !== t2) {
188
+ t4 = /*#__PURE__*/jsx("button", {
189
+ type: "button",
190
+ className: t1,
191
+ onClick: handleClick,
192
+ "aria-label": t2,
193
+ ...restProps,
194
+ children: t3
195
+ });
196
+ $[12] = handleClick;
197
+ $[13] = restProps;
198
+ $[14] = t1;
199
+ $[15] = t2;
200
+ $[16] = t4;
201
+ } else {
202
+ t4 = $[16];
203
+ }
204
+ return t4;
205
+ }
206
+ /**
207
+ * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
208
+ * Applies the standard row classnames.
209
+ */
210
+ function TableRow(props) {
211
+ const $ = c(11);
212
+ if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
213
+ for (let $i = 0; $i < 11; $i += 1) {
214
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
215
+ }
216
+ $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
217
+ }
218
+ let className;
219
+ let ref;
220
+ let restProps;
221
+ if ($[1] !== props) {
222
+ ({
223
+ ref,
224
+ className,
225
+ ...restProps
226
+ } = props);
227
+ $[1] = props;
228
+ $[2] = className;
229
+ $[3] = ref;
230
+ $[4] = restProps;
231
+ } else {
232
+ className = $[2];
233
+ ref = $[3];
234
+ restProps = $[4];
235
+ }
236
+ let t0;
237
+ if ($[5] !== className) {
238
+ t0 = classNames(styles.row, className);
239
+ $[5] = className;
240
+ $[6] = t0;
241
+ } else {
242
+ t0 = $[6];
243
+ }
244
+ const classes = t0;
245
+ let t1;
246
+ if ($[7] !== classes || $[8] !== ref || $[9] !== restProps) {
247
+ t1 = /*#__PURE__*/jsx("tr", {
248
+ ref: ref,
249
+ className: classes,
250
+ ...restProps
251
+ });
252
+ $[7] = classes;
253
+ $[8] = ref;
254
+ $[9] = restProps;
255
+ $[10] = t1;
256
+ } else {
257
+ t1 = $[10];
258
+ }
259
+ return t1;
260
+ }
261
+ /**
262
+ * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
263
+ * Applies the standard cell classnames, but not data-dependent `tdClassName`.
264
+ */
265
+ function TableCell(props) {
266
+ const $ = c(9);
267
+ if ($[0] !== "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369") {
268
+ for (let $i = 0; $i < 9; $i += 1) {
269
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
270
+ }
271
+ $[0] = "41002a734705c9c4f3ba11120213f00b7457aedaa8304bff045a817c65d54369";
272
+ }
273
+ let className;
274
+ let restProps;
275
+ if ($[1] !== props) {
276
+ ({
277
+ className,
278
+ ...restProps
279
+ } = props);
280
+ $[1] = props;
281
+ $[2] = className;
282
+ $[3] = restProps;
283
+ } else {
284
+ className = $[2];
285
+ restProps = $[3];
286
+ }
287
+ let t0;
288
+ if ($[4] !== className) {
289
+ t0 = classNames(styles.cell, className);
290
+ $[4] = className;
291
+ $[5] = t0;
292
+ } else {
293
+ t0 = $[5];
294
+ }
295
+ const classes = t0;
296
+ let t1;
297
+ if ($[6] !== classes || $[7] !== restProps) {
298
+ t1 = /*#__PURE__*/jsx("td", {
299
+ className: classes,
300
+ ...restProps
301
+ });
302
+ $[6] = classes;
303
+ $[7] = restProps;
304
+ $[8] = t1;
305
+ } else {
306
+ t1 = $[8];
307
+ }
308
+ return t1;
309
+ }
310
+
311
+ export { DeleteColumnButton, SortButton, TableCell, TableRow };
@@ -0,0 +1,53 @@
1
+ import { type ComponentPropsWithoutRef } 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
+ * Minimal usage requires the following props:
7
+ * - `data`
8
+ * - `getKey`
9
+ * - `columns`
10
+ * - `key`
11
+ * - `renderCell` (not required, but usually needed)
12
+ *
13
+ * ## Selection
14
+ *
15
+ * Following three props support the selection:
16
+ *
17
+ * - `selection`
18
+ * - `isItemClickable`
19
+ * - `DefaultItemRenderer.onClick`
20
+ *
21
+ * Only `selection` is required: you can display and modify selection your way, e.g., via
22
+ * checkboxes in cells.
23
+ *
24
+ * ## Sorting
25
+ * You need the following to support sorting:
26
+ *
27
+ * - Include `<SortButton />` in a column header
28
+ * - Set initial `Column.sortOrder` to `none`, `ascending`.
29
+ * Do not leave `undefined` for the accessibility reasons.
30
+ * - Handle `TableProps.onSort` callback in the client code. It is expected
31
+ * to update `columns`, by setting the new `sortOrder` value for
32
+ * the corresponding column, and updating the data accordingly.
33
+ *
34
+ * ## Deleting columns
35
+ * You need the following to support deleting columns:
36
+ *
37
+ * - Make sure the `column` has a proper `name` or `key` prop, which will be
38
+ * automatically included in the aria-label of `<DeleteColumnButton />`.
39
+ * - Include `<DeleteColumnButton />` in a column header
40
+ * - Handle `TableProps.onColumnDelete` callback in the client code. It is expected
41
+ * to update `columns` by removing the corresponding column.
42
+ *
43
+ * ## Row virtualization
44
+ *
45
+ * To render only rows near the viewport and replace others with spacers, use:
46
+ *
47
+ * - `virtualizeRows`
48
+ * - `scrollerRef` — required when the scrollable container is not the whole document
49
+ * - `estimateHeight` — recommended when rows are expected to be taller than
50
+ * the default height (e.g. multiline or custom content)
51
+ * - Fine-tuning props: `lookaheadPx`, `retentionMarginPx`, `minScrollAndResizeDeltaPx`
52
+ */
53
+ export default function Table<T>(props: TableProps<T> & ComponentPropsWithoutRef<'table'>): import("react").JSX.Element;