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

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 (189) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/icon-svg.js +1 -1
  4. package/components/_helpers/legacy-table.js +3 -0
  5. package/components/_helpers/tab-link.js +1 -1
  6. package/components/_helpers/table.js +2 -2
  7. package/components/_helpers/theme.js +49 -37
  8. package/components/alert/alert.js +1 -1
  9. package/components/alert-service/alert-service.js +1 -1
  10. package/components/auth/auth-core.js +1 -1
  11. package/components/auth/auth.js +1 -1
  12. package/components/auth/down-notification.js +1 -1
  13. package/components/auth/iframe-flow.js +1 -1
  14. package/components/auth/storage.js +1 -1
  15. package/components/auth-dialog/auth-dialog.js +1 -1
  16. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  17. package/components/avatar/avatar-info.js +1 -1
  18. package/components/avatar/avatar.js +1 -1
  19. package/components/avatar/fallback-avatar.js +1 -1
  20. package/components/avatar-stack/avatar-stack.js +1 -1
  21. package/components/banner/banner.js +1 -1
  22. package/components/button/button.js +1 -1
  23. package/components/button-group/button-group.js +1 -1
  24. package/components/checkbox/checkbox.js +1 -1
  25. package/components/clipboard/clipboard.js +1 -1
  26. package/components/collapse/collapse-content.js +5 -5
  27. package/components/collapse/collapse-control.js +5 -5
  28. package/components/collapse/collapse.js +4 -4
  29. package/components/confirm/confirm.js +1 -1
  30. package/components/confirm-service/confirm-service.js +2 -2
  31. package/components/contenteditable/contenteditable.js +1 -1
  32. package/components/control-help/control-help.js +1 -1
  33. package/components/control-label/control-label.js +1 -1
  34. package/components/data-list/data-list.d.ts +4 -4
  35. package/components/data-list/data-list.js +3 -3
  36. package/components/data-list/data-list.mock.d.ts +1 -1
  37. package/components/data-list/data-list.mock.js +1 -1
  38. package/components/data-list/item.d.ts +1 -1
  39. package/components/data-list/item.js +1 -1
  40. package/components/data-list/selection.d.ts +1 -1
  41. package/components/data-list/selection.js +2 -2
  42. package/components/data-list/title.js +1 -1
  43. package/components/date-picker/date-input.js +1 -1
  44. package/components/date-picker/date-picker.js +2 -3
  45. package/components/date-picker/date-popup.js +2 -3
  46. package/components/date-picker/month-names.js +1 -1
  47. package/components/date-picker/month-slider.js +1 -1
  48. package/components/date-picker/month.d.ts +0 -2
  49. package/components/date-picker/month.js +17 -18
  50. package/components/date-picker/months.js +43 -35
  51. package/components/date-picker/use-intersection-observer.js +1 -1
  52. package/components/date-picker/use-scroll-behavior.js +45 -44
  53. package/components/date-picker/weekdays.js +1 -1
  54. package/components/date-picker/years.js +61 -54
  55. package/components/dialog/dialog.d.ts +2 -2
  56. package/components/dialog/dialog.js +3 -3
  57. package/components/dropdown/anchor.js +1 -1
  58. package/components/dropdown/dropdown.js +1 -1
  59. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  60. package/components/dropdown-menu/dropdown-menu.js +62 -57
  61. package/components/editable-heading/editable-heading.d.ts +1 -2
  62. package/components/editable-heading/editable-heading.js +13 -12
  63. package/components/error-bubble/error-bubble.js +1 -1
  64. package/components/error-message/error-message.js +1 -1
  65. package/components/expand/collapsible-group.d.ts +5 -1
  66. package/components/expand/collapsible-group.js +15 -14
  67. package/components/footer/footer.js +1 -1
  68. package/components/global/create-stateful-context.js +11 -11
  69. package/components/global/intersection-observer-context.d.ts +26 -0
  70. package/components/global/intersection-observer-context.js +140 -0
  71. package/components/global/rerender-hoc.d.ts +4 -2
  72. package/components/global/rerender-hoc.js +10 -24
  73. package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
  74. package/components/{table/selection.js → global/table-selection.js} +4 -4
  75. package/components/global/theme.d.ts +4 -3
  76. package/components/global/theme.js +1 -1
  77. package/components/header/header-icon.js +1 -1
  78. package/components/header/header.js +1 -1
  79. package/components/header/links.js +1 -1
  80. package/components/header/logo.js +1 -1
  81. package/components/header/profile.js +1 -1
  82. package/components/header/services.js +1 -1
  83. package/components/header/smart-profile.js +1 -1
  84. package/components/header/smart-services.js +1 -1
  85. package/components/heading/heading.js +1 -1
  86. package/components/i18n/i18n-context.js +4 -4
  87. package/components/icon/icon-svg.js +1 -1
  88. package/components/icon/icon.js +1 -1
  89. package/components/icon/index.js +1 -1
  90. package/components/input/input.js +1 -1
  91. package/components/island/adaptive-island-hoc.js +3 -3
  92. package/components/island/content.d.ts +7 -2
  93. package/components/island/content.js +27 -18
  94. package/components/island/header.js +1 -1
  95. package/components/island/island.js +1 -1
  96. package/components/{table → legacy-table}/cell.js +1 -1
  97. package/components/{table → legacy-table}/header-cell.js +4 -4
  98. package/components/{table → legacy-table}/header.js +2 -2
  99. package/components/{table → legacy-table}/multitable.d.ts +1 -1
  100. package/components/{table → legacy-table}/row-with-focus-sensor.js +2 -2
  101. package/components/{table → legacy-table}/row.js +4 -4
  102. package/components/legacy-table/selection-adapter.d.ts +6 -0
  103. package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
  104. package/components/{table → legacy-table}/simple-table.d.ts +2 -2
  105. package/components/{table → legacy-table}/simple-table.js +4 -4
  106. package/components/{table → legacy-table}/smart-table.d.ts +5 -5
  107. package/components/{table → legacy-table}/smart-table.js +5 -5
  108. package/components/legacy-table/table.d.ts +109 -0
  109. package/components/legacy-table/table.js +369 -0
  110. package/components/list/list-item.js +1 -1
  111. package/components/list/list-users-groups-source.js +1 -1
  112. package/components/list/list.js +1 -1
  113. package/components/login-dialog/login-dialog.js +1 -1
  114. package/components/login-dialog/service.js +2 -2
  115. package/components/message/message.js +1 -1
  116. package/components/old-browsers-message/white-list.js +2 -2
  117. package/components/pager/pager.js +1 -1
  118. package/components/popup/popup.js +1 -1
  119. package/components/popup/popup.target.d.ts +3 -2
  120. package/components/popup/popup.target.js +32 -28
  121. package/components/popup-menu/popup-menu.js +1 -1
  122. package/components/query-assist/query-assist-suggestions.js +1 -1
  123. package/components/query-assist/query-assist.d.ts +3 -1
  124. package/components/query-assist/query-assist.js +2 -2
  125. package/components/radio/radio-item.d.ts +3 -3
  126. package/components/radio/radio-item.js +32 -18
  127. package/components/radio/radio.d.ts +2 -2
  128. package/components/radio/radio.js +2 -2
  129. package/components/scrollable-section/scrollable-section.js +1 -1
  130. package/components/select/chevron-button.js +1 -1
  131. package/components/select/select-filter.js +1 -1
  132. package/components/select/select-popup.js +1 -1
  133. package/components/select/select.d.ts +3 -1
  134. package/components/select/select.js +1 -1
  135. package/components/slider/slider.js +100 -96
  136. package/components/storage/storage-local.js +1 -1
  137. package/components/storage/storage.js +1 -1
  138. package/components/style.css +1 -1
  139. package/components/tab-trap/tab-trap.d.ts +3 -3
  140. package/components/tab-trap/tab-trap.js +83 -80
  141. package/components/table/default-item-renderer.d.ts +36 -0
  142. package/components/table/default-item-renderer.js +182 -0
  143. package/components/table/table-component.d.ts +80 -0
  144. package/components/table/table-component.js +290 -0
  145. package/components/table/table-const.d.ts +8 -0
  146. package/components/table/table-const.js +11 -0
  147. package/components/table/table-primitives.d.ts +28 -0
  148. package/components/table/table-primitives.js +323 -0
  149. package/components/table/table-row-focus.d.ts +4 -0
  150. package/components/table/table-row-focus.js +41 -0
  151. package/components/table/table-virtualize.d.ts +32 -0
  152. package/components/table/table-virtualize.js +329 -0
  153. package/components/table/table.d.ts +206 -104
  154. package/components/table/table.js +19 -362
  155. package/components/tabs/collapsible-more.js +1 -1
  156. package/components/tabs/collapsible-tab.js +1 -1
  157. package/components/tabs/collapsible-tabs.js +1 -1
  158. package/components/tabs/dumb-tabs.js +1 -1
  159. package/components/tabs/smart-tabs.js +1 -1
  160. package/components/tabs/tab-link.js +1 -1
  161. package/components/tabs/tabs.js +1 -1
  162. package/components/tag/tag.js +1 -1
  163. package/components/tags-input/tags-input.d.ts +3 -1
  164. package/components/tags-input/tags-input.js +1 -1
  165. package/components/tags-list/tags-list.js +1 -1
  166. package/components/toggle/toggle.js +1 -1
  167. package/components/tooltip/tooltip.js +2 -2
  168. package/components/upload/upload.d.ts +4 -3
  169. package/components/upload/upload.js +7 -29
  170. package/components/user-agreement/service.js +2 -2
  171. package/components/user-agreement/user-agreement.js +1 -1
  172. package/components/user-card/card.js +1 -1
  173. package/components/user-card/smart-user-card-tooltip.js +1 -1
  174. package/components/user-card/tooltip.js +1 -1
  175. package/components/user-card/user-card.js +1 -1
  176. package/package.json +6 -6
  177. package/components/global/use-event-callback.d.ts +0 -1
  178. package/components/global/use-event-callback.js +0 -44
  179. package/components/table/selection-adapter.d.ts +0 -6
  180. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  181. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  182. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  183. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  184. /package/components/{table → legacy-table}/header.d.ts +0 -0
  185. /package/components/{table → legacy-table}/multitable.js +0 -0
  186. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  187. /package/components/{table → legacy-table}/row.d.ts +0 -0
  188. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  189. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
@@ -0,0 +1,290 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { mergeRefs } from 'react-merge-refs';
5
+ import { IntersectionObserverContext } from '../global/intersection-observer-context.js';
6
+ import { useTableVirtualize, SpacerRow } from './table-virtualize.js';
7
+ import { DefaultItemRenderer } from './default-item-renderer.js';
8
+ import { TablePropsContext, CollapseItemIntoSpacerContext, defaultMinScrollAndResizeDeltaPx, defaultLookaheadPx, defaultRetentionMarginPx, ColumnIndexContext, defaultRowHeight } from './table-const.js';
9
+ import { onBlurCaptureTbody, onKeyDownTbody } from './table-row-focus.js';
10
+ import { s as styles } from '../_helpers/table.js';
11
+ import { jsx, jsxs } from 'react/jsx-runtime';
12
+ import './table-primitives.js';
13
+ import '@jetbrains/icons/unsorted-12px';
14
+ import '@jetbrains/icons/arrow-12px-down';
15
+ import '@jetbrains/icons/arrow-12px-up';
16
+ import '@jetbrains/icons/trash-12px';
17
+ import '../icon/icon.js';
18
+ import 'util-deprecate';
19
+ import '../icon/icon.constants.js';
20
+ import '../_helpers/icon-svg.js';
21
+ import '../global/memoize.js';
22
+
23
+ function Table(props) {
24
+ const $ = c(56);
25
+ if ($[0] !== "9306af42aa8ad63ab7b8766f741b6ce2a028dd9b7f320f9f4ee30c0e95ec844f") {
26
+ for (let $i = 0; $i < 56; $i += 1) {
27
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
28
+ }
29
+ $[0] = "9306af42aa8ad63ab7b8766f741b6ce2a028dd9b7f320f9f4ee30c0e95ec844f";
30
+ }
31
+ let className;
32
+ let columns;
33
+ let data;
34
+ let getKey;
35
+ let noHeader;
36
+ let renderItem;
37
+ let restProps;
38
+ let scrollerRef;
39
+ let t0;
40
+ let t1;
41
+ let t2;
42
+ let t3;
43
+ let t4;
44
+ let tbodyClassName;
45
+ let theadClassName;
46
+ let theadTrClassName;
47
+ let userRef;
48
+ if ($[1] !== props) {
49
+ const {
50
+ data: t5,
51
+ columns: t6,
52
+ getKey: t7,
53
+ noHeader: t8,
54
+ onItemMove,
55
+ onSort,
56
+ onColumnDelete,
57
+ onColumnMove,
58
+ renderItem: t9,
59
+ virtualizeRows: t10,
60
+ scrollerRef: t11,
61
+ estimateHeight: t12,
62
+ lookaheadPx: t13,
63
+ retentionMarginPx: t14,
64
+ minScrollAndResizeDeltaPx: t15,
65
+ columnEditButton,
66
+ theadClassName: t16,
67
+ theadTrClassName: t17,
68
+ tbodyClassName: t18,
69
+ ref: t19,
70
+ className: t20,
71
+ ...t21
72
+ } = props;
73
+ data = t5;
74
+ columns = t6;
75
+ getKey = t7;
76
+ noHeader = t8;
77
+ renderItem = t9;
78
+ t0 = t10;
79
+ scrollerRef = t11;
80
+ t1 = t12;
81
+ t2 = t13;
82
+ t3 = t14;
83
+ t4 = t15;
84
+ theadClassName = t16;
85
+ theadTrClassName = t17;
86
+ tbodyClassName = t18;
87
+ userRef = t19;
88
+ className = t20;
89
+ restProps = t21;
90
+ $[1] = props;
91
+ $[2] = className;
92
+ $[3] = columns;
93
+ $[4] = data;
94
+ $[5] = getKey;
95
+ $[6] = noHeader;
96
+ $[7] = renderItem;
97
+ $[8] = restProps;
98
+ $[9] = scrollerRef;
99
+ $[10] = t0;
100
+ $[11] = t1;
101
+ $[12] = t2;
102
+ $[13] = t3;
103
+ $[14] = t4;
104
+ $[15] = tbodyClassName;
105
+ $[16] = theadClassName;
106
+ $[17] = theadTrClassName;
107
+ $[18] = userRef;
108
+ } else {
109
+ className = $[2];
110
+ columns = $[3];
111
+ data = $[4];
112
+ getKey = $[5];
113
+ noHeader = $[6];
114
+ renderItem = $[7];
115
+ restProps = $[8];
116
+ scrollerRef = $[9];
117
+ t0 = $[10];
118
+ t1 = $[11];
119
+ t2 = $[12];
120
+ t3 = $[13];
121
+ t4 = $[14];
122
+ tbodyClassName = $[15];
123
+ theadClassName = $[16];
124
+ theadTrClassName = $[17];
125
+ userRef = $[18];
126
+ }
127
+ const virtualizeRows = t0 === undefined ? false : t0;
128
+ const estimateHeight = t1 === undefined ? _temp : t1;
129
+ const lookaheadPx = t2 === undefined ? defaultLookaheadPx : t2;
130
+ const retentionMarginPx = t3 === undefined ? defaultRetentionMarginPx : t3;
131
+ const minScrollAndResizeDeltaPx = t4 === undefined ? defaultMinScrollAndResizeDeltaPx : t4;
132
+ const localRef = useRef(null);
133
+ const {
134
+ virtualItems,
135
+ intersectionObserverHandle,
136
+ collapseItemIntoSpacer
137
+ } = useTableVirtualize({
138
+ enabled: virtualizeRows,
139
+ data,
140
+ scrollerRef,
141
+ tableRef: localRef,
142
+ estimateHeight,
143
+ lookaheadPx,
144
+ retentionMarginPx,
145
+ minScrollAndResizeDeltaPx
146
+ });
147
+ const T0 = TablePropsContext;
148
+ const T1 = IntersectionObserverContext;
149
+ let t5;
150
+ if ($[19] !== className) {
151
+ t5 = classNames(styles.table, className);
152
+ $[19] = className;
153
+ $[20] = t5;
154
+ } else {
155
+ t5 = $[20];
156
+ }
157
+ const t6 = mergeRefs([userRef, localRef]);
158
+ let t7;
159
+ if ($[21] !== columns || $[22] !== noHeader || $[23] !== theadClassName || $[24] !== theadTrClassName) {
160
+ t7 = !noHeader && /*#__PURE__*/jsx("thead", {
161
+ className: theadClassName,
162
+ children: /*#__PURE__*/jsx("tr", {
163
+ className: classNames(styles.headerRow, theadTrClassName),
164
+ children: columns.map(_temp2)
165
+ })
166
+ });
167
+ $[21] = columns;
168
+ $[22] = noHeader;
169
+ $[23] = theadClassName;
170
+ $[24] = theadTrClassName;
171
+ $[25] = t7;
172
+ } else {
173
+ t7 = $[25];
174
+ }
175
+ let t8;
176
+ if ($[26] !== collapseItemIntoSpacer || $[27] !== columns || $[28] !== data || $[29] !== getKey || $[30] !== renderItem || $[31] !== virtualItems) {
177
+ let t9;
178
+ if ($[33] !== collapseItemIntoSpacer || $[34] !== columns || $[35] !== data || $[36] !== getKey || $[37] !== renderItem) {
179
+ t9 = virtualItem => {
180
+ if (virtualItem.type === "spacer") {
181
+ return /*#__PURE__*/jsx(SpacerRow, {
182
+ spacer: virtualItem,
183
+ colSpan: columns.length
184
+ }, virtualItem.key);
185
+ }
186
+ const index = virtualItem.index;
187
+ const item = data[index];
188
+ const key = getKey(item, index, data);
189
+ return /*#__PURE__*/jsx(CollapseItemIntoSpacerContext, {
190
+ value: height => collapseItemIntoSpacer(index, height),
191
+ children: renderItem ? renderItem(item, index, data) : /*#__PURE__*/jsx(DefaultItemRenderer, {
192
+ index: index
193
+ })
194
+ }, key);
195
+ };
196
+ $[33] = collapseItemIntoSpacer;
197
+ $[34] = columns;
198
+ $[35] = data;
199
+ $[36] = getKey;
200
+ $[37] = renderItem;
201
+ $[38] = t9;
202
+ } else {
203
+ t9 = $[38];
204
+ }
205
+ t8 = virtualItems.map(t9);
206
+ $[26] = collapseItemIntoSpacer;
207
+ $[27] = columns;
208
+ $[28] = data;
209
+ $[29] = getKey;
210
+ $[30] = renderItem;
211
+ $[31] = virtualItems;
212
+ $[32] = t8;
213
+ } else {
214
+ t8 = $[32];
215
+ }
216
+ let t9;
217
+ if ($[39] !== t8 || $[40] !== tbodyClassName) {
218
+ t9 = /*#__PURE__*/jsx("tbody", {
219
+ className: tbodyClassName,
220
+ onKeyDown: onKeyDownTbody,
221
+ onBlurCapture: onBlurCaptureTbody,
222
+ children: t8
223
+ });
224
+ $[39] = t8;
225
+ $[40] = tbodyClassName;
226
+ $[41] = t9;
227
+ } else {
228
+ t9 = $[41];
229
+ }
230
+ let t10;
231
+ if ($[42] !== restProps || $[43] !== t5 || $[44] !== t6 || $[45] !== t7 || $[46] !== t9) {
232
+ t10 = /*#__PURE__*/jsxs("table", {
233
+ className: t5,
234
+ ref: t6,
235
+ ...restProps,
236
+ children: [t7, t9]
237
+ });
238
+ $[42] = restProps;
239
+ $[43] = t5;
240
+ $[44] = t6;
241
+ $[45] = t7;
242
+ $[46] = t9;
243
+ $[47] = t10;
244
+ } else {
245
+ t10 = $[47];
246
+ }
247
+ let t11;
248
+ if ($[48] !== T1 || $[49] !== intersectionObserverHandle || $[50] !== t10) {
249
+ t11 = /*#__PURE__*/jsx(T1, {
250
+ value: intersectionObserverHandle,
251
+ children: t10
252
+ });
253
+ $[48] = T1;
254
+ $[49] = intersectionObserverHandle;
255
+ $[50] = t10;
256
+ $[51] = t11;
257
+ } else {
258
+ t11 = $[51];
259
+ }
260
+ let t12;
261
+ if ($[52] !== T0 || $[53] !== props || $[54] !== t11) {
262
+ t12 = /*#__PURE__*/jsx(T0, {
263
+ value: props,
264
+ children: t11
265
+ });
266
+ $[52] = T0;
267
+ $[53] = props;
268
+ $[54] = t11;
269
+ $[55] = t12;
270
+ } else {
271
+ t12 = $[55];
272
+ }
273
+ return t12;
274
+ }
275
+ function _temp2(column, columnIndex) {
276
+ var _ref, _column$renderHeader;
277
+ return /*#__PURE__*/jsx("th", {
278
+ className: classNames(styles.headerCell, column.thClassName),
279
+ "aria-sort": column.sortOrder,
280
+ children: /*#__PURE__*/jsx(ColumnIndexContext, {
281
+ value: columnIndex,
282
+ children: (_ref = (_column$renderHeader = column.renderHeader?.()) !== null && _column$renderHeader !== void 0 ? _column$renderHeader : column.name) !== null && _ref !== void 0 ? _ref : String(column.key)
283
+ })
284
+ }, column.key);
285
+ }
286
+ function _temp() {
287
+ return defaultRowHeight;
288
+ }
289
+
290
+ export { Table as default };
@@ -0,0 +1,8 @@
1
+ import type { TableProps } from './table';
2
+ 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>;
5
+ export declare const defaultRowHeight = 37;
6
+ export declare const defaultLookaheadPx = 400;
7
+ export declare const defaultRetentionMarginPx = 450;
8
+ export declare const defaultMinScrollAndResizeDeltaPx = 50;
@@ -0,0 +1,11 @@
1
+ import { createContext } from 'react';
2
+
3
+ const TablePropsContext = /*#__PURE__*/createContext(null);
4
+ const ColumnIndexContext = /*#__PURE__*/createContext(-1);
5
+ const CollapseItemIntoSpacerContext = /*#__PURE__*/createContext(() => {});
6
+ const defaultRowHeight = 37;
7
+ const defaultLookaheadPx = 400;
8
+ const defaultRetentionMarginPx = 450;
9
+ const defaultMinScrollAndResizeDeltaPx = 50;
10
+
11
+ export { CollapseItemIntoSpacerContext, ColumnIndexContext, TablePropsContext, defaultLookaheadPx, defaultMinScrollAndResizeDeltaPx, defaultRetentionMarginPx, defaultRowHeight };
@@ -0,0 +1,28 @@
1
+ import { type ComponentPropsWithRef } 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>({ className, children, onClick, ...restProps }: ComponentPropsWithRef<'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>({ className, onClick, ...restProps }: ComponentPropsWithRef<'button'>): import("react").JSX.Element | null;
13
+ export interface TableRowProps {
14
+ /**
15
+ * @see DefaultItemRendererProps.keyboardFocusable
16
+ */
17
+ keyboardFocusable?: boolean;
18
+ }
19
+ /**
20
+ * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
21
+ * Applies the standard row classnames.
22
+ */
23
+ export declare function TableRow(props: TableRowProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element;
24
+ /**
25
+ * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
26
+ * Applies the standard cell classnames, but not data-dependent `tdClassName`.
27
+ */
28
+ export declare function TableCell(props: ComponentPropsWithRef<'td'>): import("react").JSX.Element;
@@ -0,0 +1,323 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use } 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 { keyboardFocusableAttrName } from './table-row-focus.js';
11
+ import { s as styles } from '../_helpers/table.js';
12
+ import { jsx, jsxs } from 'react/jsx-runtime';
13
+ import 'util-deprecate';
14
+ import '../icon/icon.constants.js';
15
+ import '../_helpers/icon-svg.js';
16
+ import '../global/memoize.js';
17
+
18
+ function SortButton(t0) {
19
+ var _column$sortOrder;
20
+ const $ = c(21);
21
+ if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
22
+ for (let $i = 0; $i < 21; $i += 1) {
23
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
24
+ }
25
+ $[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
26
+ }
27
+ let children;
28
+ let className;
29
+ let onClick;
30
+ let restProps;
31
+ if ($[1] !== t0) {
32
+ ({
33
+ className,
34
+ children,
35
+ onClick,
36
+ ...restProps
37
+ } = t0);
38
+ $[1] = t0;
39
+ $[2] = children;
40
+ $[3] = className;
41
+ $[4] = onClick;
42
+ $[5] = restProps;
43
+ } else {
44
+ children = $[2];
45
+ className = $[3];
46
+ onClick = $[4];
47
+ restProps = $[5];
48
+ }
49
+ const tableProps = use(TablePropsContext);
50
+ const columnIndex = use(ColumnIndexContext);
51
+ const column = tableProps?.columns[columnIndex];
52
+ const sortOrder = (_column$sortOrder = column?.sortOrder) !== null && _column$sortOrder !== void 0 ? _column$sortOrder : "none";
53
+ const glyph = sortOrder === "none" ? unsortedIcon : sortOrder === "ascending" ? arrowUpIcon : arrowDownIcon;
54
+ let t1;
55
+ if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== sortOrder || $[9] !== tableProps) {
56
+ t1 = e => {
57
+ onClick?.(e);
58
+ if (!e.defaultPrevented) {
59
+ const sequence = ["none", "ascending", "descending"];
60
+ const nextOrder = sequence[(sequence.indexOf(sortOrder) + 1) % sequence.length];
61
+ tableProps.onSort?.(columnIndex, nextOrder, tableProps.columns);
62
+ }
63
+ };
64
+ $[6] = columnIndex;
65
+ $[7] = onClick;
66
+ $[8] = sortOrder;
67
+ $[9] = tableProps;
68
+ $[10] = t1;
69
+ } else {
70
+ t1 = $[10];
71
+ }
72
+ const handleClick = t1;
73
+ if (!tableProps || !column) {
74
+ return null;
75
+ }
76
+ let t2;
77
+ if ($[11] !== className) {
78
+ t2 = classNames(styles.headerButton, className);
79
+ $[11] = className;
80
+ $[12] = t2;
81
+ } else {
82
+ t2 = $[12];
83
+ }
84
+ let t3;
85
+ if ($[13] !== glyph) {
86
+ t3 = /*#__PURE__*/jsx(Icon, {
87
+ glyph: glyph,
88
+ "aria-hidden": true
89
+ });
90
+ $[13] = glyph;
91
+ $[14] = t3;
92
+ } else {
93
+ t3 = $[14];
94
+ }
95
+ let t4;
96
+ if ($[15] !== children || $[16] !== handleClick || $[17] !== restProps || $[18] !== t2 || $[19] !== t3) {
97
+ t4 = /*#__PURE__*/jsxs("button", {
98
+ type: "button",
99
+ className: t2,
100
+ onClick: handleClick,
101
+ ...restProps,
102
+ children: [children, " ", t3]
103
+ });
104
+ $[15] = children;
105
+ $[16] = handleClick;
106
+ $[17] = restProps;
107
+ $[18] = t2;
108
+ $[19] = t3;
109
+ $[20] = t4;
110
+ } else {
111
+ t4 = $[20];
112
+ }
113
+ return t4;
114
+ }
115
+ /**
116
+ * Include it in a column header to make the column deletable.
117
+ * Beware that `column.name ?? String(column.key)` is used in the aria-label.
118
+ * Handle clicks with {@link TableProps.onColumnDelete}.
119
+ */
120
+ function DeleteColumnButton(t0) {
121
+ var _column$name;
122
+ const $ = c(17);
123
+ if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
124
+ for (let $i = 0; $i < 17; $i += 1) {
125
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
126
+ }
127
+ $[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
128
+ }
129
+ let className;
130
+ let onClick;
131
+ let restProps;
132
+ if ($[1] !== t0) {
133
+ ({
134
+ className,
135
+ onClick,
136
+ ...restProps
137
+ } = t0);
138
+ $[1] = t0;
139
+ $[2] = className;
140
+ $[3] = onClick;
141
+ $[4] = restProps;
142
+ } else {
143
+ className = $[2];
144
+ onClick = $[3];
145
+ restProps = $[4];
146
+ }
147
+ const tableProps = use(TablePropsContext);
148
+ const columnIndex = use(ColumnIndexContext);
149
+ const column = tableProps?.columns[columnIndex];
150
+ let t1;
151
+ if ($[5] !== columnIndex || $[6] !== onClick || $[7] !== tableProps) {
152
+ t1 = e => {
153
+ onClick?.(e);
154
+ if (!e.defaultPrevented) {
155
+ tableProps.onColumnDelete?.(columnIndex, tableProps.columns);
156
+ }
157
+ };
158
+ $[5] = columnIndex;
159
+ $[6] = onClick;
160
+ $[7] = tableProps;
161
+ $[8] = t1;
162
+ } else {
163
+ t1 = $[8];
164
+ }
165
+ const handleClick = t1;
166
+ if (!tableProps || !column) {
167
+ return null;
168
+ }
169
+ let t2;
170
+ if ($[9] !== className) {
171
+ t2 = classNames(styles.headerButton, styles.deleteColumnButton, className);
172
+ $[9] = className;
173
+ $[10] = t2;
174
+ } else {
175
+ t2 = $[10];
176
+ }
177
+ const t3 = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}`;
178
+ let t4;
179
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
180
+ t4 = /*#__PURE__*/jsx(Icon, {
181
+ glyph: trashIcon
182
+ });
183
+ $[11] = t4;
184
+ } else {
185
+ t4 = $[11];
186
+ }
187
+ let t5;
188
+ if ($[12] !== handleClick || $[13] !== restProps || $[14] !== t2 || $[15] !== t3) {
189
+ t5 = /*#__PURE__*/jsx("button", {
190
+ type: "button",
191
+ className: t2,
192
+ onClick: handleClick,
193
+ "aria-label": t3,
194
+ ...restProps,
195
+ children: t4
196
+ });
197
+ $[12] = handleClick;
198
+ $[13] = restProps;
199
+ $[14] = t2;
200
+ $[15] = t3;
201
+ $[16] = t5;
202
+ } else {
203
+ t5 = $[16];
204
+ }
205
+ return t5;
206
+ }
207
+ /**
208
+ * A helper `<tr>` component for a custom {@link TableProps.renderItem} implementations.
209
+ * Applies the standard row classnames.
210
+ */
211
+ function TableRow(props) {
212
+ const $ = c(13);
213
+ if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
214
+ for (let $i = 0; $i < 13; $i += 1) {
215
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
216
+ }
217
+ $[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
218
+ }
219
+ let className;
220
+ let keyboardFocusable;
221
+ let restProps;
222
+ if ($[1] !== props) {
223
+ ({
224
+ keyboardFocusable,
225
+ className,
226
+ ...restProps
227
+ } = props);
228
+ $[1] = props;
229
+ $[2] = className;
230
+ $[3] = keyboardFocusable;
231
+ $[4] = restProps;
232
+ } else {
233
+ className = $[2];
234
+ keyboardFocusable = $[3];
235
+ restProps = $[4];
236
+ }
237
+ let t0;
238
+ if ($[5] !== className) {
239
+ t0 = classNames(styles.row, className);
240
+ $[5] = className;
241
+ $[6] = t0;
242
+ } else {
243
+ t0 = $[6];
244
+ }
245
+ const classes = t0;
246
+ let t1;
247
+ if ($[7] !== keyboardFocusable || $[8] !== restProps) {
248
+ t1 = keyboardFocusable ? {
249
+ [keyboardFocusableAttrName]: "",
250
+ ...restProps
251
+ } : restProps;
252
+ $[7] = keyboardFocusable;
253
+ $[8] = restProps;
254
+ $[9] = t1;
255
+ } else {
256
+ t1 = $[9];
257
+ }
258
+ const trRestProps = t1;
259
+ let t2;
260
+ if ($[10] !== classes || $[11] !== trRestProps) {
261
+ t2 = /*#__PURE__*/jsx("tr", {
262
+ className: classes,
263
+ ...trRestProps
264
+ });
265
+ $[10] = classes;
266
+ $[11] = trRestProps;
267
+ $[12] = t2;
268
+ } else {
269
+ t2 = $[12];
270
+ }
271
+ return t2;
272
+ }
273
+ /**
274
+ * A helper `<td>` component for a custom {@link TableProps.renderItem} implementations.
275
+ * Applies the standard cell classnames, but not data-dependent `tdClassName`.
276
+ */
277
+ function TableCell(props) {
278
+ const $ = c(9);
279
+ if ($[0] !== "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6") {
280
+ for (let $i = 0; $i < 9; $i += 1) {
281
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
282
+ }
283
+ $[0] = "a3c4e3796f16ce90212b13068ef9cd73f05ae49747114b4d67f34019d7274ef6";
284
+ }
285
+ let className;
286
+ let restProps;
287
+ if ($[1] !== props) {
288
+ ({
289
+ className,
290
+ ...restProps
291
+ } = props);
292
+ $[1] = props;
293
+ $[2] = className;
294
+ $[3] = restProps;
295
+ } else {
296
+ className = $[2];
297
+ restProps = $[3];
298
+ }
299
+ let t0;
300
+ if ($[4] !== className) {
301
+ t0 = classNames(styles.cell, className);
302
+ $[4] = className;
303
+ $[5] = t0;
304
+ } else {
305
+ t0 = $[5];
306
+ }
307
+ const classes = t0;
308
+ let t1;
309
+ if ($[6] !== classes || $[7] !== restProps) {
310
+ t1 = /*#__PURE__*/jsx("td", {
311
+ className: classes,
312
+ ...restProps
313
+ });
314
+ $[6] = classes;
315
+ $[7] = restProps;
316
+ $[8] = t1;
317
+ } else {
318
+ t1 = $[8];
319
+ }
320
+ return t1;
321
+ }
322
+
323
+ export { DeleteColumnButton, SortButton, TableCell, TableRow };
@@ -0,0 +1,4 @@
1
+ export declare const keyboardFocusableAttrName = "data-keyboard-focusable";
2
+ export declare function focusRow(row: HTMLTableRowElement): void;
3
+ export declare function onKeyDownTbody(e: React.KeyboardEvent<HTMLTableSectionElement>): void;
4
+ export declare function onBlurCaptureTbody(e: React.FocusEvent<HTMLTableSectionElement>): void;
@@ -0,0 +1,41 @@
1
+ const keyboardFocusableAttrName = 'data-keyboard-focusable';
2
+ const temporaryTabIndexAttrName = 'data-temporary-tabindex';
3
+ function focusRow(row) {
4
+ if (!row.hasAttribute('tabindex')) {
5
+ row.tabIndex = 0;
6
+ row.setAttribute(temporaryTabIndexAttrName, '');
7
+ }
8
+ row.focus();
9
+ }
10
+ function onKeyDownTbody(e) {
11
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') {
12
+ return;
13
+ }
14
+ const tbody = e.currentTarget;
15
+ const currentRow = e.target.closest('tr');
16
+ if (!(currentRow instanceof HTMLTableRowElement) || currentRow.parentElement !== tbody) {
17
+ return;
18
+ }
19
+ let candidate = currentRow;
20
+ while (candidate) {
21
+ candidate = e.key === 'ArrowUp' ? candidate.previousElementSibling : candidate.nextElementSibling;
22
+ if (candidate?.hasAttribute(keyboardFocusableAttrName)) {
23
+ focusRow(candidate);
24
+ e.preventDefault();
25
+ return;
26
+ }
27
+ }
28
+ }
29
+ function onBlurCaptureTbody(e) {
30
+ const tbody = e.currentTarget;
31
+ if (!(e.target instanceof HTMLTableRowElement) || e.target.parentElement !== tbody) {
32
+ return;
33
+ }
34
+ const row = e.target;
35
+ if (row.hasAttribute(temporaryTabIndexAttrName)) {
36
+ row.removeAttribute('tabindex');
37
+ row.removeAttribute(temporaryTabIndexAttrName);
38
+ }
39
+ }
40
+
41
+ export { focusRow, keyboardFocusableAttrName, onBlurCaptureTbody, onKeyDownTbody };