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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/components/_helpers/alert.js +3 -0
  2. package/components/_helpers/caption.js +1 -1
  3. package/components/_helpers/header.js +1 -1
  4. package/components/_helpers/heading.js +2 -2
  5. package/components/_helpers/table.js +1 -1
  6. package/components/_helpers/theme.js +1 -1
  7. package/components/alert/alert-actions.d.ts +4 -0
  8. package/components/alert/alert-actions.js +51 -0
  9. package/components/alert/alert-heading.d.ts +4 -0
  10. package/components/alert/alert-heading.js +62 -0
  11. package/components/alert/alert.d.ts +14 -1
  12. package/components/alert/alert.js +44 -26
  13. package/components/alert-service/alert-service.d.ts +2 -1
  14. package/components/alert-service/alert-service.js +15 -5
  15. package/components/auth/auth-core.d.ts +5 -9
  16. package/components/auth/auth-core.js +71 -17
  17. package/components/auth/auth.js +7 -1
  18. package/components/auth/down-notification.js +7 -1
  19. package/components/auth/iframe-flow.js +1 -1
  20. package/components/auth/storage.js +7 -1
  21. package/components/checkbox/checkbox.d.ts +1 -1
  22. package/components/clipboard/clipboard.js +7 -1
  23. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  24. package/components/collapsible-group/collapsible-group.js +382 -0
  25. package/components/components/util-stories.js +63 -1
  26. package/components/data-list/data-list.js +1 -1
  27. package/components/data-list/title.js +1 -1
  28. package/components/date-picker/consts.d.ts +1 -0
  29. package/components/date-picker/date-input.js +3 -2
  30. package/components/date-picker/date-popup.js +3 -3
  31. package/components/dropdown-menu/dropdown-menu.js +6 -6
  32. package/components/editable-heading/editable-heading.js +122 -109
  33. package/components/expand/collapsible-group.d.ts +8 -20
  34. package/components/expand/collapsible-group.js +34 -365
  35. package/components/global/compose-refs.d.ts +2 -1
  36. package/components/global/compose-refs.js +44 -8
  37. package/components/global/focus-sensor-hoc.js +1 -0
  38. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  39. package/components/global/focus-with-temporary-tabindex.js +23 -0
  40. package/components/global/intersection-observer-context.d.ts +29 -9
  41. package/components/global/intersection-observer-context.js +50 -52
  42. package/components/global/is-within-interactive-element.d.ts +6 -0
  43. package/components/global/is-within-interactive-element.js +11 -0
  44. package/components/global/is-within-navigable-element.d.ts +6 -0
  45. package/components/global/is-within-navigable-element.js +11 -0
  46. package/components/global/parse-css-duration.d.ts +5 -0
  47. package/components/global/parse-css-duration.js +14 -0
  48. package/components/global/rerender-hoc.js +1 -0
  49. package/components/global/schedule-with-cleanup.d.ts +12 -0
  50. package/components/global/schedule-with-cleanup.js +36 -0
  51. package/components/global/table-selection.js +1 -1
  52. package/components/global/theme.js +1 -1
  53. package/components/header/header.js +8 -2
  54. package/components/header/smart-profile.js +7 -1
  55. package/components/heading/heading.js +3 -3
  56. package/components/http/http.d.ts +2 -2
  57. package/components/http/http.js +2 -2
  58. package/components/i18n/i18n.d.ts +1 -0
  59. package/components/i18n/i18n.js +2 -0
  60. package/components/input/input.d.ts +1 -1
  61. package/components/internal/reorder-animation-context.js +159 -0
  62. package/components/internal/reorder-handle.js +750 -0
  63. package/components/internal/reorder-layout-context.js +141 -0
  64. package/components/internal/table-header.js +685 -0
  65. package/components/{table/table-virtualize.js → internal/virtualization.js} +123 -84
  66. package/components/legacy-table/header-cell.js +2 -2
  67. package/components/legacy-table/row-with-focus-sensor.js +1 -1
  68. package/components/legacy-table/row.d.ts +1 -1
  69. package/components/legacy-table/simple-table.js +1 -1
  70. package/components/legacy-table/smart-table.js +1 -1
  71. package/components/legacy-table/table.js +1 -1
  72. package/components/markdown/markdown.js +2 -2
  73. package/components/message/message.js +1 -1
  74. package/components/old-browsers-message/white-list.js +2 -2
  75. package/components/popup/popup.d.ts +2 -0
  76. package/components/popup/popup.js +5 -1
  77. package/components/select/select-popup.d.ts +1 -1
  78. package/components/select/select.d.ts +1 -1
  79. package/components/storage/storage-local.js +7 -1
  80. package/components/storage/storage.js +7 -1
  81. package/components/style.css +1 -1
  82. package/components/table/default-item-renderer.d.ts +29 -10
  83. package/components/table/default-item-renderer.js +151 -93
  84. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  85. package/components/table/internal/reorder-handle.d.ts +9 -0
  86. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  87. package/components/table/internal/table-header.d.ts +1 -0
  88. package/components/table/internal/virtualization.d.ts +41 -0
  89. package/components/table/item-virtualization.d.ts +37 -0
  90. package/components/table/item-virtualization.js +73 -0
  91. package/components/table/reorder-animation.d.ts +37 -0
  92. package/components/table/reorder-animation.js +18 -0
  93. package/components/table/reorder-item-layout.d.ts +32 -0
  94. package/components/table/reorder-item-layout.js +57 -0
  95. package/components/table/table-const.d.ts +8 -6
  96. package/components/table/table-const.js +8 -6
  97. package/components/table/table-primitives.d.ts +52 -16
  98. package/components/table/table-primitives.js +64 -207
  99. package/components/table/table-props.d.ts +304 -0
  100. package/components/table/table-props.js +1 -0
  101. package/components/table/table.d.ts +231 -209
  102. package/components/table/table.js +365 -17
  103. package/components/tooltip/tooltip.js +1 -1
  104. package/components/user-agreement/service.js +13 -7
  105. package/components/user-card/card.js +7 -1
  106. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  107. package/components/user-card/smart-user-card-tooltip.js +7 -1
  108. package/components/user-card/tooltip.js +7 -1
  109. package/components/user-card/user-card.js +7 -1
  110. package/components/util-stories.d.ts +26 -0
  111. package/package.json +3 -3
  112. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  113. package/components/date-picker/use-intersection-observer.js +0 -93
  114. package/components/global/composeRefs.d.ts +0 -6
  115. package/components/global/composeRefs.js +0 -9
  116. package/components/table/table-component.d.ts +0 -80
  117. package/components/table/table-component.js +0 -290
  118. package/components/table/table-row-focus.d.ts +0 -4
  119. package/components/table/table-row-focus.js +0 -41
  120. package/components/table/table-virtualize.d.ts +0 -32
@@ -0,0 +1,685 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { use, useState, useRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
5
+ import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
6
+ import settingsIcon from '@jetbrains/icons/settings-12px';
7
+ import trashIcon from '@jetbrains/icons/trash-12px';
8
+ import sortableIcon from '@jetbrains/icons/unsorted-12px';
9
+ import { TablePropsContext } from '../table/table-const.js';
10
+ import Icon from '../icon/icon.js';
11
+ import { isWithinInteractiveElement } from '../global/is-within-interactive-element.js';
12
+ import { ReorderHandle } from './reorder-handle.js';
13
+ import { ReorderAnimationContext } from './reorder-animation-context.js';
14
+ import { useReorderLayoutContextValue, ReorderLayoutContext } from './reorder-layout-context.js';
15
+ import { useReorderItemLayout } from '../table/reorder-item-layout.js';
16
+ import { s as styles } from '../_helpers/table.js';
17
+ import { jsx, jsxs } from 'react/jsx-runtime';
18
+ import 'util-deprecate';
19
+ import '../icon/icon.constants.js';
20
+ import '../_helpers/icon-svg.js';
21
+ import '../global/memoize.js';
22
+ import '@jetbrains/icons/drag-12px';
23
+ import '../global/compose-refs.js';
24
+ import 'memoize-one';
25
+ import '../global/parse-css-duration.js';
26
+ import '../global/schedule-with-cleanup.js';
27
+
28
+ function TableHeader() {
29
+ const $ = c(30);
30
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
31
+ for (let $i = 0; $i < 30; $i += 1) {
32
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
33
+ }
34
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
35
+ }
36
+ const {
37
+ columns,
38
+ noHeader,
39
+ stickyHeader,
40
+ columnEditing,
41
+ onColumnEditingRequest,
42
+ theadClassName,
43
+ theadTrClassName
44
+ } = use(TablePropsContext);
45
+ const [localColumnEditing, setLocalColumnEditing] = useState(false);
46
+ const effectiveColumnEditing = columnEditing !== null && columnEditing !== void 0 ? columnEditing : localColumnEditing;
47
+ let t0;
48
+ if ($[1] !== columnEditing || $[2] !== localColumnEditing || $[3] !== onColumnEditingRequest) {
49
+ t0 = source => {
50
+ let newColumnEditing;
51
+ if (columnEditing == null) {
52
+ newColumnEditing = !localColumnEditing;
53
+ setLocalColumnEditing(newColumnEditing);
54
+ } else {
55
+ newColumnEditing = !columnEditing;
56
+ }
57
+ onColumnEditingRequest?.(newColumnEditing, source);
58
+ };
59
+ $[1] = columnEditing;
60
+ $[2] = localColumnEditing;
61
+ $[3] = onColumnEditingRequest;
62
+ $[4] = t0;
63
+ } else {
64
+ t0 = $[4];
65
+ }
66
+ const toggleColumnEditing = t0;
67
+ let t1;
68
+ if ($[5] !== toggleColumnEditing) {
69
+ t1 = e => {
70
+ if (window.matchMedia("(hover: none)").matches && !isWithinInteractiveElement(e.target)) {
71
+ toggleColumnEditing("header");
72
+ }
73
+ };
74
+ $[5] = toggleColumnEditing;
75
+ $[6] = t1;
76
+ } else {
77
+ t1 = $[6];
78
+ }
79
+ const handleTheadClick = t1;
80
+ let t2;
81
+ if ($[7] !== toggleColumnEditing) {
82
+ t2 = () => {
83
+ toggleColumnEditing("edit-button");
84
+ };
85
+ $[7] = toggleColumnEditing;
86
+ $[8] = t2;
87
+ } else {
88
+ t2 = $[8];
89
+ }
90
+ const handleEditColumnsButtonClick = t2;
91
+ const reorderContextValue = useReorderLayoutContextValue();
92
+ if (noHeader) {
93
+ return null;
94
+ }
95
+ const t3 = effectiveColumnEditing && styles.theadColumnEditing;
96
+ const t4 = stickyHeader && styles.stickyHeader;
97
+ let t5;
98
+ if ($[9] !== t3 || $[10] !== t4 || $[11] !== theadClassName) {
99
+ t5 = classNames(theadClassName, t3, t4);
100
+ $[9] = t3;
101
+ $[10] = t4;
102
+ $[11] = theadClassName;
103
+ $[12] = t5;
104
+ } else {
105
+ t5 = $[12];
106
+ }
107
+ let t6;
108
+ if ($[13] !== columns || $[14] !== effectiveColumnEditing || $[15] !== handleEditColumnsButtonClick) {
109
+ let t7;
110
+ if ($[17] !== effectiveColumnEditing || $[18] !== handleEditColumnsButtonClick) {
111
+ t7 = (column, columnIndex) => /*#__PURE__*/jsx(TableHeaderCell, {
112
+ columnIndex: columnIndex,
113
+ columnEditing: effectiveColumnEditing,
114
+ handleEditColumnsButtonClick: handleEditColumnsButtonClick
115
+ }, column.key);
116
+ $[17] = effectiveColumnEditing;
117
+ $[18] = handleEditColumnsButtonClick;
118
+ $[19] = t7;
119
+ } else {
120
+ t7 = $[19];
121
+ }
122
+ t6 = columns.map(t7);
123
+ $[13] = columns;
124
+ $[14] = effectiveColumnEditing;
125
+ $[15] = handleEditColumnsButtonClick;
126
+ $[16] = t6;
127
+ } else {
128
+ t6 = $[16];
129
+ }
130
+ let t7;
131
+ if ($[20] !== reorderContextValue || $[21] !== t6) {
132
+ t7 = /*#__PURE__*/jsx(ReorderLayoutContext, {
133
+ value: reorderContextValue,
134
+ children: t6
135
+ });
136
+ $[20] = reorderContextValue;
137
+ $[21] = t6;
138
+ $[22] = t7;
139
+ } else {
140
+ t7 = $[22];
141
+ }
142
+ let t8;
143
+ if ($[23] !== t7 || $[24] !== theadTrClassName) {
144
+ t8 = /*#__PURE__*/jsx("tr", {
145
+ className: theadTrClassName,
146
+ children: t7
147
+ });
148
+ $[23] = t7;
149
+ $[24] = theadTrClassName;
150
+ $[25] = t8;
151
+ } else {
152
+ t8 = $[25];
153
+ }
154
+ let t9;
155
+ if ($[26] !== handleTheadClick || $[27] !== t5 || $[28] !== t8) {
156
+ t9 = /*#__PURE__*/jsx("thead", {
157
+ className: t5,
158
+ onClick: handleTheadClick,
159
+ children: t8
160
+ });
161
+ $[26] = handleTheadClick;
162
+ $[27] = t5;
163
+ $[28] = t8;
164
+ $[29] = t9;
165
+ } else {
166
+ t9 = $[29];
167
+ }
168
+ return t9;
169
+ }
170
+ function TableHeaderCell(t0) {
171
+ const $ = c(43);
172
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
173
+ for (let $i = 0; $i < 43; $i += 1) {
174
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
175
+ }
176
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
177
+ }
178
+ const {
179
+ columnIndex,
180
+ columnEditing,
181
+ handleEditColumnsButtonClick
182
+ } = t0;
183
+ const ref = useRef(null);
184
+ const {
185
+ columns,
186
+ columnEditButton
187
+ } = use(TablePropsContext);
188
+ const {
189
+ key,
190
+ name,
191
+ renderHeader,
192
+ sortOrder,
193
+ deletable,
194
+ canReorder,
195
+ thClassName
196
+ } = columns[columnIndex];
197
+ const {
198
+ reorderAnimation
199
+ } = use(ReorderAnimationContext);
200
+ let t1;
201
+ if ($[1] !== key || $[2] !== name || $[3] !== renderHeader) {
202
+ t1 = renderHeader ? renderHeader() : name !== null && name !== void 0 ? name : String(key);
203
+ $[1] = key;
204
+ $[2] = name;
205
+ $[3] = renderHeader;
206
+ $[4] = t1;
207
+ } else {
208
+ t1 = $[4];
209
+ }
210
+ const children = t1;
211
+ let t2;
212
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
213
+ t2 = () => {
214
+ var _r$left, _r$right;
215
+ const r = ref.current?.getBoundingClientRect();
216
+ return {
217
+ start: (_r$left = r?.left) !== null && _r$left !== void 0 ? _r$left : 0,
218
+ end: (_r$right = r?.right) !== null && _r$right !== void 0 ? _r$right : 0
219
+ };
220
+ };
221
+ $[5] = t2;
222
+ } else {
223
+ t2 = $[5];
224
+ }
225
+ let t3;
226
+ if ($[6] !== columnIndex) {
227
+ t3 = {
228
+ index: columnIndex,
229
+ getBounds: t2
230
+ };
231
+ $[6] = columnIndex;
232
+ $[7] = t3;
233
+ } else {
234
+ t3 = $[7];
235
+ }
236
+ useReorderItemLayout(t3);
237
+ const t4 = reorderAnimation?.direction === "columns" && reorderAnimation.index === columnIndex && reorderAnimation.className;
238
+ let t5;
239
+ if ($[8] !== t4 || $[9] !== thClassName) {
240
+ t5 = classNames(styles.headerCell, t4, thClassName);
241
+ $[8] = t4;
242
+ $[9] = thClassName;
243
+ $[10] = t5;
244
+ } else {
245
+ t5 = $[10];
246
+ }
247
+ let t6;
248
+ if ($[11] !== canReorder || $[12] !== columnIndex) {
249
+ t6 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandle, {
250
+ columnIndex: columnIndex
251
+ });
252
+ $[11] = canReorder;
253
+ $[12] = columnIndex;
254
+ $[13] = t6;
255
+ } else {
256
+ t6 = $[13];
257
+ }
258
+ let t7;
259
+ if ($[14] !== children || $[15] !== columnIndex || $[16] !== sortOrder) {
260
+ t7 = sortOrder ? /*#__PURE__*/jsx(SortButton, {
261
+ columnIndex: columnIndex,
262
+ "aria-description": `Sort order: ${sortOrder}`,
263
+ children: children
264
+ }) : children;
265
+ $[14] = children;
266
+ $[15] = columnIndex;
267
+ $[16] = sortOrder;
268
+ $[17] = t7;
269
+ } else {
270
+ t7 = $[17];
271
+ }
272
+ let t8;
273
+ if ($[18] !== canReorder) {
274
+ t8 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandleMirror, {});
275
+ $[18] = canReorder;
276
+ $[19] = t8;
277
+ } else {
278
+ t8 = $[19];
279
+ }
280
+ let t9;
281
+ if ($[20] !== t6 || $[21] !== t7 || $[22] !== t8) {
282
+ t9 = /*#__PURE__*/jsxs("div", {
283
+ className: styles.sortAndHeader,
284
+ children: [t6, t7, t8]
285
+ });
286
+ $[20] = t6;
287
+ $[21] = t7;
288
+ $[22] = t8;
289
+ $[23] = t9;
290
+ } else {
291
+ t9 = $[23];
292
+ }
293
+ let t10;
294
+ if ($[24] !== columnIndex || $[25] !== deletable) {
295
+ t10 = deletable && /*#__PURE__*/jsx(DeleteColumnButton, {
296
+ columnIndex: columnIndex
297
+ });
298
+ $[24] = columnIndex;
299
+ $[25] = deletable;
300
+ $[26] = t10;
301
+ } else {
302
+ t10 = $[26];
303
+ }
304
+ let t11;
305
+ if ($[27] !== columnEditButton || $[28] !== columnEditing || $[29] !== columnIndex || $[30] !== columns.length || $[31] !== handleEditColumnsButtonClick) {
306
+ t11 = columnIndex === columns.length - 1 && columnEditButton && /*#__PURE__*/jsx(EditColumnsButton, {
307
+ columnEditing: columnEditing,
308
+ onClick: handleEditColumnsButtonClick
309
+ });
310
+ $[27] = columnEditButton;
311
+ $[28] = columnEditing;
312
+ $[29] = columnIndex;
313
+ $[30] = columns.length;
314
+ $[31] = handleEditColumnsButtonClick;
315
+ $[32] = t11;
316
+ } else {
317
+ t11 = $[32];
318
+ }
319
+ let t12;
320
+ if ($[33] !== t10 || $[34] !== t11) {
321
+ t12 = /*#__PURE__*/jsxs("div", {
322
+ className: styles.rightButtons,
323
+ children: [t10, t11]
324
+ });
325
+ $[33] = t10;
326
+ $[34] = t11;
327
+ $[35] = t12;
328
+ } else {
329
+ t12 = $[35];
330
+ }
331
+ let t13;
332
+ if ($[36] !== t12 || $[37] !== t9) {
333
+ t13 = /*#__PURE__*/jsxs("div", {
334
+ className: styles.headerCellInnerWrapper,
335
+ children: [t9, t12]
336
+ });
337
+ $[36] = t12;
338
+ $[37] = t9;
339
+ $[38] = t13;
340
+ } else {
341
+ t13 = $[38];
342
+ }
343
+ let t14;
344
+ if ($[39] !== sortOrder || $[40] !== t13 || $[41] !== t5) {
345
+ t14 = /*#__PURE__*/jsx("th", {
346
+ ref: ref,
347
+ className: t5,
348
+ scope: "col",
349
+ "aria-sort": sortOrder,
350
+ children: t13
351
+ });
352
+ $[39] = sortOrder;
353
+ $[40] = t13;
354
+ $[41] = t5;
355
+ $[42] = t14;
356
+ } else {
357
+ t14 = $[42];
358
+ }
359
+ return t14;
360
+ }
361
+ function SortButton(t0) {
362
+ const $ = c(22);
363
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
364
+ for (let $i = 0; $i < 22; $i += 1) {
365
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
366
+ }
367
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
368
+ }
369
+ let children;
370
+ let className;
371
+ let columnIndex;
372
+ let onClick;
373
+ let restProps;
374
+ if ($[1] !== t0) {
375
+ ({
376
+ columnIndex,
377
+ className,
378
+ children,
379
+ onClick,
380
+ ...restProps
381
+ } = t0);
382
+ $[1] = t0;
383
+ $[2] = children;
384
+ $[3] = className;
385
+ $[4] = columnIndex;
386
+ $[5] = onClick;
387
+ $[6] = restProps;
388
+ } else {
389
+ children = $[2];
390
+ className = $[3];
391
+ columnIndex = $[4];
392
+ onClick = $[5];
393
+ restProps = $[6];
394
+ }
395
+ const tableProps = use(TablePropsContext);
396
+ const column = tableProps?.columns[columnIndex];
397
+ const sortOrder = column?.sortOrder;
398
+ const glyph = sortOrder === "none" ? sortableIcon : sortOrder === "ascending" ? arrowUpIcon : sortOrder === "descending" ? arrowDownIcon : undefined;
399
+ let t1;
400
+ if ($[7] !== columnIndex || $[8] !== onClick || $[9] !== sortOrder || $[10] !== tableProps) {
401
+ t1 = e => {
402
+ onClick?.(e);
403
+ if (!e.defaultPrevented) {
404
+ const nextOrder = sortOrder === "ascending" ? "descending" : sortOrder === "descending" ? "none" : "ascending";
405
+ tableProps.onSort?.(columnIndex, nextOrder, tableProps.columns);
406
+ }
407
+ };
408
+ $[7] = columnIndex;
409
+ $[8] = onClick;
410
+ $[9] = sortOrder;
411
+ $[10] = tableProps;
412
+ $[11] = t1;
413
+ } else {
414
+ t1 = $[11];
415
+ }
416
+ const handleClick = t1;
417
+ if (!tableProps || !column) {
418
+ return null;
419
+ }
420
+ let t2;
421
+ if ($[12] !== className) {
422
+ t2 = classNames(styles.tableButton, className);
423
+ $[12] = className;
424
+ $[13] = t2;
425
+ } else {
426
+ t2 = $[13];
427
+ }
428
+ let t3;
429
+ if ($[14] !== glyph) {
430
+ t3 = /*#__PURE__*/jsx(Icon, {
431
+ glyph: glyph,
432
+ "aria-hidden": true
433
+ });
434
+ $[14] = glyph;
435
+ $[15] = t3;
436
+ } else {
437
+ t3 = $[15];
438
+ }
439
+ let t4;
440
+ if ($[16] !== children || $[17] !== handleClick || $[18] !== restProps || $[19] !== t2 || $[20] !== t3) {
441
+ t4 = /*#__PURE__*/jsxs("button", {
442
+ type: "button",
443
+ className: t2,
444
+ onClick: handleClick,
445
+ ...restProps,
446
+ children: [children, " ", t3]
447
+ });
448
+ $[16] = children;
449
+ $[17] = handleClick;
450
+ $[18] = restProps;
451
+ $[19] = t2;
452
+ $[20] = t3;
453
+ $[21] = t4;
454
+ } else {
455
+ t4 = $[21];
456
+ }
457
+ return t4;
458
+ }
459
+ function DeleteColumnButton(t0) {
460
+ var _column$name;
461
+ const $ = c(18);
462
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
463
+ for (let $i = 0; $i < 18; $i += 1) {
464
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
465
+ }
466
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
467
+ }
468
+ let className;
469
+ let columnIndex;
470
+ let onClick;
471
+ let restProps;
472
+ if ($[1] !== t0) {
473
+ ({
474
+ columnIndex,
475
+ className,
476
+ onClick,
477
+ ...restProps
478
+ } = t0);
479
+ $[1] = t0;
480
+ $[2] = className;
481
+ $[3] = columnIndex;
482
+ $[4] = onClick;
483
+ $[5] = restProps;
484
+ } else {
485
+ className = $[2];
486
+ columnIndex = $[3];
487
+ onClick = $[4];
488
+ restProps = $[5];
489
+ }
490
+ const tableProps = use(TablePropsContext);
491
+ const column = tableProps?.columns[columnIndex];
492
+ let t1;
493
+ if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== tableProps) {
494
+ t1 = e => {
495
+ onClick?.(e);
496
+ if (!e.defaultPrevented) {
497
+ const columns = tableProps.columns;
498
+ tableProps.onColumnDelete?.(columns[columnIndex], columnIndex, columns);
499
+ }
500
+ };
501
+ $[6] = columnIndex;
502
+ $[7] = onClick;
503
+ $[8] = tableProps;
504
+ $[9] = t1;
505
+ } else {
506
+ t1 = $[9];
507
+ }
508
+ const handleClick = t1;
509
+ if (!tableProps || !column) {
510
+ return null;
511
+ }
512
+ const hint = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}.`;
513
+ let t2;
514
+ if ($[10] !== className) {
515
+ t2 = classNames(styles.tableButton, styles.deleteColumnButton, className);
516
+ $[10] = className;
517
+ $[11] = t2;
518
+ } else {
519
+ t2 = $[11];
520
+ }
521
+ let t3;
522
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
523
+ t3 = /*#__PURE__*/jsx(Icon, {
524
+ glyph: trashIcon,
525
+ "aria-hidden": "true"
526
+ });
527
+ $[12] = t3;
528
+ } else {
529
+ t3 = $[12];
530
+ }
531
+ let t4;
532
+ if ($[13] !== handleClick || $[14] !== hint || $[15] !== restProps || $[16] !== t2) {
533
+ t4 = /*#__PURE__*/jsx("button", {
534
+ type: "button",
535
+ className: t2,
536
+ onClick: handleClick,
537
+ "aria-label": hint,
538
+ title: hint,
539
+ ...restProps,
540
+ children: t3
541
+ });
542
+ $[13] = handleClick;
543
+ $[14] = hint;
544
+ $[15] = restProps;
545
+ $[16] = t2;
546
+ $[17] = t4;
547
+ } else {
548
+ t4 = $[17];
549
+ }
550
+ return t4;
551
+ }
552
+ function EditColumnsButton(t0) {
553
+ const $ = c(14);
554
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
555
+ for (let $i = 0; $i < 14; $i += 1) {
556
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
557
+ }
558
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
559
+ }
560
+ let columnEditing;
561
+ let hint;
562
+ let restProps;
563
+ let t1;
564
+ let t2;
565
+ if ($[1] !== t0) {
566
+ const {
567
+ columnEditing: t3,
568
+ ...props
569
+ } = t0;
570
+ columnEditing = t3;
571
+ const {
572
+ className,
573
+ ...t4
574
+ } = props;
575
+ restProps = t4;
576
+ hint = columnEditing ? "Hide column controls." : "Show column controls.";
577
+ t1 = "button";
578
+ t2 = classNames(styles.tableButton, styles.editColumnsButton, className);
579
+ $[1] = t0;
580
+ $[2] = columnEditing;
581
+ $[3] = hint;
582
+ $[4] = restProps;
583
+ $[5] = t1;
584
+ $[6] = t2;
585
+ } else {
586
+ columnEditing = $[2];
587
+ hint = $[3];
588
+ restProps = $[4];
589
+ t1 = $[5];
590
+ t2 = $[6];
591
+ }
592
+ let t3;
593
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
594
+ t3 = /*#__PURE__*/jsx(Icon, {
595
+ glyph: settingsIcon,
596
+ "aria-hidden": "true"
597
+ });
598
+ $[7] = t3;
599
+ } else {
600
+ t3 = $[7];
601
+ }
602
+ let t4;
603
+ if ($[8] !== columnEditing || $[9] !== hint || $[10] !== restProps || $[11] !== t1 || $[12] !== t2) {
604
+ t4 = /*#__PURE__*/jsx("button", {
605
+ type: t1,
606
+ className: t2,
607
+ "aria-pressed": columnEditing,
608
+ "aria-label": hint,
609
+ title: hint,
610
+ ...restProps,
611
+ children: t3
612
+ });
613
+ $[8] = columnEditing;
614
+ $[9] = hint;
615
+ $[10] = restProps;
616
+ $[11] = t1;
617
+ $[12] = t2;
618
+ $[13] = t4;
619
+ } else {
620
+ t4 = $[13];
621
+ }
622
+ return t4;
623
+ }
624
+ function ColumnReorderHandle(t0) {
625
+ const $ = c(7);
626
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
627
+ for (let $i = 0; $i < 7; $i += 1) {
628
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
629
+ }
630
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
631
+ }
632
+ let columnIndex;
633
+ let restProps;
634
+ if ($[1] !== t0) {
635
+ ({
636
+ columnIndex,
637
+ ...restProps
638
+ } = t0);
639
+ $[1] = t0;
640
+ $[2] = columnIndex;
641
+ $[3] = restProps;
642
+ } else {
643
+ columnIndex = $[2];
644
+ restProps = $[3];
645
+ }
646
+ let t1;
647
+ if ($[4] !== columnIndex || $[5] !== restProps) {
648
+ t1 = /*#__PURE__*/jsx(ReorderHandle, {
649
+ direction: "columns",
650
+ index: columnIndex,
651
+ ...restProps
652
+ });
653
+ $[4] = columnIndex;
654
+ $[5] = restProps;
655
+ $[6] = t1;
656
+ } else {
657
+ t1 = $[6];
658
+ }
659
+ return t1;
660
+ }
661
+ /**
662
+ * Reserves the space for the reorder handle and prevents layout shift when the handle appears on hover.
663
+ */
664
+ function ColumnReorderHandleMirror() {
665
+ const $ = c(2);
666
+ if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
667
+ for (let $i = 0; $i < 2; $i += 1) {
668
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
669
+ }
670
+ $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
671
+ }
672
+ let t0;
673
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
674
+ t0 = /*#__PURE__*/jsx("span", {
675
+ className: styles.columnReorderHandleMirror,
676
+ "aria-hidden": "true"
677
+ });
678
+ $[1] = t0;
679
+ } else {
680
+ t0 = $[1];
681
+ }
682
+ return t0;
683
+ }
684
+
685
+ export { TableHeader };