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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/components/_helpers/anchor.js +1 -1
  2. package/components/_helpers/avatar-info.js +1 -1
  3. package/components/_helpers/heading.js +2 -2
  4. package/components/_helpers/icon-svg.js +1 -1
  5. package/components/_helpers/legacy-table.js +3 -0
  6. package/components/_helpers/tab-link.js +1 -1
  7. package/components/_helpers/table.js +1 -1
  8. package/components/_helpers/theme.js +50 -38
  9. package/components/alert/alert.js +2 -2
  10. package/components/alert-service/alert-service.js +1 -1
  11. package/components/auth/auth-core.js +1 -1
  12. package/components/auth/auth.js +1 -1
  13. package/components/auth/down-notification.js +1 -1
  14. package/components/auth/iframe-flow.js +2 -2
  15. package/components/auth/storage.js +1 -1
  16. package/components/auth-dialog/auth-dialog.js +1 -1
  17. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  18. package/components/avatar/avatar-info.js +1 -1
  19. package/components/avatar/avatar.js +1 -1
  20. package/components/avatar/fallback-avatar.js +1 -1
  21. package/components/avatar-stack/avatar-stack.js +1 -1
  22. package/components/banner/banner.js +1 -1
  23. package/components/button/button.js +1 -1
  24. package/components/button-group/button-group.js +1 -1
  25. package/components/checkbox/checkbox.d.ts +1 -1
  26. package/components/checkbox/checkbox.js +1 -1
  27. package/components/clipboard/clipboard.js +1 -1
  28. package/components/collapse/collapse-content.js +5 -5
  29. package/components/collapse/collapse-control.js +5 -5
  30. package/components/collapse/collapse.js +4 -4
  31. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  32. package/components/collapsible-group/collapsible-group.js +382 -0
  33. package/components/components/util-stories.js +63 -1
  34. package/components/confirm/confirm.js +1 -1
  35. package/components/confirm-service/confirm-service.js +2 -2
  36. package/components/contenteditable/contenteditable.js +1 -1
  37. package/components/control-help/control-help.js +1 -1
  38. package/components/control-label/control-label.js +1 -1
  39. package/components/data-list/data-list.d.ts +1 -1
  40. package/components/data-list/data-list.js +1 -1
  41. package/components/data-list/data-list.mock.d.ts +1 -1
  42. package/components/data-list/data-list.mock.js +1 -1
  43. package/components/data-list/item.d.ts +1 -1
  44. package/components/data-list/item.js +1 -1
  45. package/components/data-list/selection.d.ts +1 -1
  46. package/components/data-list/selection.js +2 -2
  47. package/components/data-list/title.js +1 -1
  48. package/components/date-picker/date-input.js +1 -1
  49. package/components/date-picker/date-picker.js +1 -2
  50. package/components/date-picker/date-popup.js +4 -5
  51. package/components/date-picker/month-names.js +1 -1
  52. package/components/date-picker/month-slider.js +1 -1
  53. package/components/date-picker/month.js +1 -1
  54. package/components/date-picker/months.js +4 -5
  55. package/components/date-picker/use-scroll-behavior.js +45 -44
  56. package/components/date-picker/weekdays.js +1 -1
  57. package/components/date-picker/years.js +6 -7
  58. package/components/dialog/dialog.d.ts +2 -2
  59. package/components/dialog/dialog.js +3 -3
  60. package/components/dropdown/anchor.js +1 -1
  61. package/components/dropdown/dropdown.js +1 -1
  62. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  63. package/components/dropdown-menu/dropdown-menu.js +68 -63
  64. package/components/editable-heading/editable-heading.d.ts +1 -2
  65. package/components/editable-heading/editable-heading.js +127 -113
  66. package/components/error-bubble/error-bubble.js +1 -1
  67. package/components/error-message/error-message.js +1 -1
  68. package/components/expand/collapsible-group.d.ts +8 -16
  69. package/components/expand/collapsible-group.js +34 -364
  70. package/components/footer/footer.js +1 -1
  71. package/components/global/compose-refs.d.ts +2 -1
  72. package/components/global/compose-refs.js +44 -8
  73. package/components/global/create-stateful-context.js +11 -11
  74. package/components/global/focus-sensor-hoc.js +1 -0
  75. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  76. package/components/global/focus-with-temporary-tabindex.js +23 -0
  77. package/components/global/intersection-observer-context.d.ts +31 -11
  78. package/components/global/intersection-observer-context.js +55 -57
  79. package/components/global/is-within-interactive-element.d.ts +6 -0
  80. package/components/global/is-within-interactive-element.js +11 -0
  81. package/components/global/is-within-navigable-element.d.ts +6 -0
  82. package/components/global/is-within-navigable-element.js +11 -0
  83. package/components/global/parse-css-duration.d.ts +5 -0
  84. package/components/global/parse-css-duration.js +14 -0
  85. package/components/global/rerender-hoc.d.ts +4 -2
  86. package/components/global/rerender-hoc.js +11 -24
  87. package/components/global/schedule-with-cleanup.d.ts +12 -0
  88. package/components/global/schedule-with-cleanup.js +36 -0
  89. package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
  90. package/components/{legacy-table/selection.js → global/table-selection.js} +4 -4
  91. package/components/global/theme.d.ts +4 -3
  92. package/components/global/theme.js +2 -2
  93. package/components/header/header-icon.js +1 -1
  94. package/components/header/header.js +2 -2
  95. package/components/header/links.js +1 -1
  96. package/components/header/logo.js +1 -1
  97. package/components/header/profile.js +1 -1
  98. package/components/header/services.js +1 -1
  99. package/components/header/smart-profile.js +1 -1
  100. package/components/header/smart-services.js +1 -1
  101. package/components/heading/heading.js +4 -4
  102. package/components/i18n/i18n-context.js +4 -4
  103. package/components/icon/icon-svg.js +1 -1
  104. package/components/icon/icon.js +1 -1
  105. package/components/icon/index.js +1 -1
  106. package/components/input/input.d.ts +1 -1
  107. package/components/input/input.js +1 -1
  108. package/components/internal/column-animation.js +133 -0
  109. package/components/internal/table-header.js +1109 -0
  110. package/components/internal/virtual-items.js +353 -0
  111. package/components/island/adaptive-island-hoc.js +3 -3
  112. package/components/island/content.d.ts +7 -2
  113. package/components/island/content.js +27 -18
  114. package/components/island/header.js +1 -1
  115. package/components/island/island.js +1 -1
  116. package/components/legacy-table/cell.js +1 -1
  117. package/components/legacy-table/header-cell.js +4 -4
  118. package/components/legacy-table/header.js +2 -2
  119. package/components/legacy-table/multitable.d.ts +1 -1
  120. package/components/legacy-table/row-with-focus-sensor.js +2 -2
  121. package/components/legacy-table/row.d.ts +1 -1
  122. package/components/legacy-table/row.js +4 -4
  123. package/components/legacy-table/selection-adapter.d.ts +3 -3
  124. package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
  125. package/components/legacy-table/simple-table.d.ts +2 -2
  126. package/components/legacy-table/simple-table.js +4 -4
  127. package/components/legacy-table/smart-table.d.ts +5 -5
  128. package/components/legacy-table/smart-table.js +5 -5
  129. package/components/legacy-table/table.js +2 -2
  130. package/components/list/list-item.js +1 -1
  131. package/components/list/list-users-groups-source.js +1 -1
  132. package/components/list/list.js +1 -1
  133. package/components/login-dialog/login-dialog.js +1 -1
  134. package/components/login-dialog/service.js +2 -2
  135. package/components/markdown/markdown.js +2 -2
  136. package/components/message/message.js +2 -2
  137. package/components/old-browsers-message/white-list.js +2 -2
  138. package/components/pager/pager.js +1 -1
  139. package/components/popup/popup.d.ts +2 -0
  140. package/components/popup/popup.js +6 -2
  141. package/components/popup/popup.target.d.ts +3 -2
  142. package/components/popup/popup.target.js +32 -28
  143. package/components/popup-menu/popup-menu.js +1 -1
  144. package/components/query-assist/query-assist-suggestions.js +1 -1
  145. package/components/query-assist/query-assist.d.ts +3 -1
  146. package/components/query-assist/query-assist.js +2 -2
  147. package/components/radio/radio-item.d.ts +3 -3
  148. package/components/radio/radio-item.js +32 -18
  149. package/components/radio/radio.d.ts +2 -2
  150. package/components/radio/radio.js +2 -2
  151. package/components/scrollable-section/scrollable-section.js +1 -1
  152. package/components/select/chevron-button.js +1 -1
  153. package/components/select/select-filter.js +1 -1
  154. package/components/select/select-popup.d.ts +1 -1
  155. package/components/select/select-popup.js +1 -1
  156. package/components/select/select.d.ts +4 -2
  157. package/components/select/select.js +1 -1
  158. package/components/slider/slider.js +100 -96
  159. package/components/storage/storage-local.js +1 -1
  160. package/components/storage/storage.js +1 -1
  161. package/components/style.css +1 -1
  162. package/components/tab-trap/tab-trap.d.ts +3 -3
  163. package/components/tab-trap/tab-trap.js +83 -80
  164. package/components/table/default-item-renderer.d.ts +35 -11
  165. package/components/table/default-item-renderer.js +118 -171
  166. package/components/table/internal/column-animation.d.ts +16 -0
  167. package/components/table/internal/table-header.d.ts +4 -0
  168. package/components/table/internal/virtual-items.d.ts +34 -0
  169. package/components/table/item-virtualization.d.ts +35 -0
  170. package/components/table/item-virtualization.js +71 -0
  171. package/components/table/table-const.d.ts +40 -6
  172. package/components/table/table-const.js +15 -6
  173. package/components/table/table-primitives.d.ts +21 -0
  174. package/components/table/table-primitives.js +123 -0
  175. package/components/table/table-props.d.ts +280 -0
  176. package/components/table/table-props.js +1 -0
  177. package/components/table/table.d.ts +205 -224
  178. package/components/table/table.js +356 -14
  179. package/components/tabs/collapsible-more.js +1 -1
  180. package/components/tabs/collapsible-tab.js +1 -1
  181. package/components/tabs/collapsible-tabs.js +1 -1
  182. package/components/tabs/dumb-tabs.js +1 -1
  183. package/components/tabs/smart-tabs.js +1 -1
  184. package/components/tabs/tab-link.js +1 -1
  185. package/components/tabs/tabs.js +1 -1
  186. package/components/tag/tag.js +1 -1
  187. package/components/tags-input/tags-input.d.ts +3 -1
  188. package/components/tags-input/tags-input.js +1 -1
  189. package/components/tags-list/tags-list.js +1 -1
  190. package/components/toggle/toggle.js +1 -1
  191. package/components/tooltip/tooltip.js +3 -3
  192. package/components/upload/upload.d.ts +4 -3
  193. package/components/upload/upload.js +7 -29
  194. package/components/user-agreement/service.js +8 -8
  195. package/components/user-agreement/user-agreement.js +1 -1
  196. package/components/user-card/card.js +1 -1
  197. package/components/user-card/smart-user-card-tooltip.js +1 -1
  198. package/components/user-card/tooltip.js +1 -1
  199. package/components/user-card/user-card.js +1 -1
  200. package/components/util-stories.d.ts +26 -0
  201. package/package.json +7 -7
  202. package/components/_helpers/table2.js +0 -3
  203. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  204. package/components/date-picker/use-intersection-observer.js +0 -93
  205. package/components/global/composeRefs.d.ts +0 -6
  206. package/components/global/composeRefs.js +0 -9
  207. package/components/global/use-event-callback.d.ts +0 -1
  208. package/components/global/use-event-callback.js +0 -44
  209. package/components/table/table-base.d.ts +0 -24
  210. package/components/table/table-base.js +0 -311
  211. package/components/table/table-component.d.ts +0 -53
  212. package/components/table/table-component.js +0 -316
  213. package/components/table/table-virtualize.d.ts +0 -32
  214. package/components/table/table-virtualize.js +0 -330
@@ -0,0 +1,1109 @@
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 dragIcon from '@jetbrains/icons/drag-12px';
7
+ import settingsIcon from '@jetbrains/icons/settings-12px';
8
+ import trashIcon from '@jetbrains/icons/trash-12px';
9
+ import sortableIcon from '@jetbrains/icons/unsorted-12px';
10
+ import { TablePropsContext, ColumnAnimationContext } from '../table/table-const.js';
11
+ import Icon from '../icon/icon.js';
12
+ import { useComposedRef } from '../global/compose-refs.js';
13
+ import { isWithinInteractiveElement } from '../global/is-within-interactive-element.js';
14
+ import { parseCssDuration } from '../global/parse-css-duration.js';
15
+ import { s as styles } from '../_helpers/table.js';
16
+ import { jsx, jsxs } from 'react/jsx-runtime';
17
+ import 'util-deprecate';
18
+ import '../icon/icon.constants.js';
19
+ import '../_helpers/icon-svg.js';
20
+ import '../global/memoize.js';
21
+ import 'memoize-one';
22
+
23
+ function TableHeader(t0) {
24
+ const $ = c(29);
25
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
26
+ for (let $i = 0; $i < 29; $i += 1) {
27
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
28
+ }
29
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
30
+ }
31
+ const {
32
+ expectColumnReorder
33
+ } = t0;
34
+ const {
35
+ columns,
36
+ noHeader,
37
+ stickyHeader,
38
+ columnEditing,
39
+ onColumnEditingRequest,
40
+ theadClassName,
41
+ theadTrClassName
42
+ } = use(TablePropsContext);
43
+ const [localColumnEditing, setLocalColumnEditing] = useState(false);
44
+ const effectiveColumnEditing = columnEditing !== null && columnEditing !== void 0 ? columnEditing : localColumnEditing;
45
+ let t1;
46
+ if ($[1] !== columnEditing || $[2] !== localColumnEditing || $[3] !== onColumnEditingRequest) {
47
+ t1 = source => {
48
+ let newColumnEditing;
49
+ if (columnEditing == null) {
50
+ newColumnEditing = !localColumnEditing;
51
+ setLocalColumnEditing(newColumnEditing);
52
+ } else {
53
+ newColumnEditing = !columnEditing;
54
+ }
55
+ onColumnEditingRequest?.(newColumnEditing, source);
56
+ };
57
+ $[1] = columnEditing;
58
+ $[2] = localColumnEditing;
59
+ $[3] = onColumnEditingRequest;
60
+ $[4] = t1;
61
+ } else {
62
+ t1 = $[4];
63
+ }
64
+ const toggleColumnEditing = t1;
65
+ let t2;
66
+ if ($[5] !== toggleColumnEditing) {
67
+ t2 = e => {
68
+ if (window.matchMedia("(hover: none)").matches && !isWithinInteractiveElement(e.target)) {
69
+ toggleColumnEditing("header");
70
+ }
71
+ };
72
+ $[5] = toggleColumnEditing;
73
+ $[6] = t2;
74
+ } else {
75
+ t2 = $[6];
76
+ }
77
+ const handleTheadClick = t2;
78
+ let t3;
79
+ if ($[7] !== toggleColumnEditing) {
80
+ t3 = () => {
81
+ toggleColumnEditing("edit-button");
82
+ };
83
+ $[7] = toggleColumnEditing;
84
+ $[8] = t3;
85
+ } else {
86
+ t3 = $[8];
87
+ }
88
+ const handleEditColumnsButtonClick = t3;
89
+ if (noHeader) {
90
+ return null;
91
+ }
92
+ const t4 = effectiveColumnEditing && styles.theadColumnEditing;
93
+ const t5 = stickyHeader && styles.stickyHeader;
94
+ let t6;
95
+ if ($[9] !== t4 || $[10] !== t5 || $[11] !== theadClassName) {
96
+ t6 = classNames(theadClassName, t4, t5);
97
+ $[9] = t4;
98
+ $[10] = t5;
99
+ $[11] = theadClassName;
100
+ $[12] = t6;
101
+ } else {
102
+ t6 = $[12];
103
+ }
104
+ let t7;
105
+ if ($[13] !== columns || $[14] !== effectiveColumnEditing || $[15] !== expectColumnReorder || $[16] !== handleEditColumnsButtonClick) {
106
+ let t8;
107
+ if ($[18] !== effectiveColumnEditing || $[19] !== expectColumnReorder || $[20] !== handleEditColumnsButtonClick) {
108
+ t8 = (column, columnIndex) => /*#__PURE__*/jsx(TableHeaderCell, {
109
+ columnIndex: columnIndex,
110
+ columnEditing: effectiveColumnEditing,
111
+ handleEditColumnsButtonClick: handleEditColumnsButtonClick,
112
+ expectColumnReorder: expectColumnReorder
113
+ }, column.key);
114
+ $[18] = effectiveColumnEditing;
115
+ $[19] = expectColumnReorder;
116
+ $[20] = handleEditColumnsButtonClick;
117
+ $[21] = t8;
118
+ } else {
119
+ t8 = $[21];
120
+ }
121
+ t7 = columns.map(t8);
122
+ $[13] = columns;
123
+ $[14] = effectiveColumnEditing;
124
+ $[15] = expectColumnReorder;
125
+ $[16] = handleEditColumnsButtonClick;
126
+ $[17] = t7;
127
+ } else {
128
+ t7 = $[17];
129
+ }
130
+ let t8;
131
+ if ($[22] !== t7 || $[23] !== theadTrClassName) {
132
+ t8 = /*#__PURE__*/jsx("tr", {
133
+ className: theadTrClassName,
134
+ children: t7
135
+ });
136
+ $[22] = t7;
137
+ $[23] = theadTrClassName;
138
+ $[24] = t8;
139
+ } else {
140
+ t8 = $[24];
141
+ }
142
+ let t9;
143
+ if ($[25] !== handleTheadClick || $[26] !== t6 || $[27] !== t8) {
144
+ t9 = /*#__PURE__*/jsx("thead", {
145
+ className: t6,
146
+ onClick: handleTheadClick,
147
+ children: t8
148
+ });
149
+ $[25] = handleTheadClick;
150
+ $[26] = t6;
151
+ $[27] = t8;
152
+ $[28] = t9;
153
+ } else {
154
+ t9 = $[28];
155
+ }
156
+ return t9;
157
+ }
158
+ function TableHeaderCell(t0) {
159
+ const $ = c(41);
160
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
161
+ for (let $i = 0; $i < 41; $i += 1) {
162
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
163
+ }
164
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
165
+ }
166
+ const {
167
+ columnIndex,
168
+ columnEditing,
169
+ handleEditColumnsButtonClick,
170
+ expectColumnReorder
171
+ } = t0;
172
+ const {
173
+ columns,
174
+ columnEditButton
175
+ } = use(TablePropsContext);
176
+ const {
177
+ key,
178
+ name,
179
+ renderHeader,
180
+ sortOrder,
181
+ deletable,
182
+ canReorder,
183
+ thClassName
184
+ } = columns[columnIndex];
185
+ const animatedColumn = use(ColumnAnimationContext);
186
+ let t1;
187
+ if ($[1] !== key || $[2] !== name || $[3] !== renderHeader) {
188
+ t1 = renderHeader ? renderHeader() : name !== null && name !== void 0 ? name : String(key);
189
+ $[1] = key;
190
+ $[2] = name;
191
+ $[3] = renderHeader;
192
+ $[4] = t1;
193
+ } else {
194
+ t1 = $[4];
195
+ }
196
+ const children = t1;
197
+ const t2 = animatedColumn?.columnIndex === columnIndex && animatedColumn.cellClassName;
198
+ let t3;
199
+ if ($[5] !== t2 || $[6] !== thClassName) {
200
+ t3 = classNames(styles.headerCell, t2, thClassName);
201
+ $[5] = t2;
202
+ $[6] = thClassName;
203
+ $[7] = t3;
204
+ } else {
205
+ t3 = $[7];
206
+ }
207
+ let t4;
208
+ if ($[8] !== canReorder || $[9] !== columnIndex || $[10] !== expectColumnReorder) {
209
+ t4 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandle, {
210
+ columnIndex: columnIndex,
211
+ expectColumnReorder: expectColumnReorder
212
+ });
213
+ $[8] = canReorder;
214
+ $[9] = columnIndex;
215
+ $[10] = expectColumnReorder;
216
+ $[11] = t4;
217
+ } else {
218
+ t4 = $[11];
219
+ }
220
+ let t5;
221
+ if ($[12] !== children || $[13] !== columnIndex || $[14] !== sortOrder) {
222
+ t5 = sortOrder ? /*#__PURE__*/jsx(SortButton, {
223
+ columnIndex: columnIndex,
224
+ "aria-description": `Sort order: ${sortOrder}`,
225
+ children: children
226
+ }) : children;
227
+ $[12] = children;
228
+ $[13] = columnIndex;
229
+ $[14] = sortOrder;
230
+ $[15] = t5;
231
+ } else {
232
+ t5 = $[15];
233
+ }
234
+ let t6;
235
+ if ($[16] !== canReorder) {
236
+ t6 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandleMirror, {});
237
+ $[16] = canReorder;
238
+ $[17] = t6;
239
+ } else {
240
+ t6 = $[17];
241
+ }
242
+ let t7;
243
+ if ($[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
244
+ t7 = /*#__PURE__*/jsxs("div", {
245
+ className: styles.sortAndHeader,
246
+ children: [t4, t5, t6]
247
+ });
248
+ $[18] = t4;
249
+ $[19] = t5;
250
+ $[20] = t6;
251
+ $[21] = t7;
252
+ } else {
253
+ t7 = $[21];
254
+ }
255
+ let t8;
256
+ if ($[22] !== columnIndex || $[23] !== deletable) {
257
+ t8 = deletable && /*#__PURE__*/jsx(DeleteColumnButton, {
258
+ columnIndex: columnIndex
259
+ });
260
+ $[22] = columnIndex;
261
+ $[23] = deletable;
262
+ $[24] = t8;
263
+ } else {
264
+ t8 = $[24];
265
+ }
266
+ let t9;
267
+ if ($[25] !== columnEditButton || $[26] !== columnEditing || $[27] !== columnIndex || $[28] !== columns.length || $[29] !== handleEditColumnsButtonClick) {
268
+ t9 = columnIndex === columns.length - 1 && columnEditButton && /*#__PURE__*/jsx(EditColumnsButton, {
269
+ columnEditing: columnEditing,
270
+ onClick: handleEditColumnsButtonClick
271
+ });
272
+ $[25] = columnEditButton;
273
+ $[26] = columnEditing;
274
+ $[27] = columnIndex;
275
+ $[28] = columns.length;
276
+ $[29] = handleEditColumnsButtonClick;
277
+ $[30] = t9;
278
+ } else {
279
+ t9 = $[30];
280
+ }
281
+ let t10;
282
+ if ($[31] !== t8 || $[32] !== t9) {
283
+ t10 = /*#__PURE__*/jsxs("div", {
284
+ className: styles.rightButtons,
285
+ children: [t8, t9]
286
+ });
287
+ $[31] = t8;
288
+ $[32] = t9;
289
+ $[33] = t10;
290
+ } else {
291
+ t10 = $[33];
292
+ }
293
+ let t11;
294
+ if ($[34] !== t10 || $[35] !== t7) {
295
+ t11 = /*#__PURE__*/jsxs("div", {
296
+ className: styles.headerCellInnerWrapper,
297
+ children: [t7, t10]
298
+ });
299
+ $[34] = t10;
300
+ $[35] = t7;
301
+ $[36] = t11;
302
+ } else {
303
+ t11 = $[36];
304
+ }
305
+ let t12;
306
+ if ($[37] !== sortOrder || $[38] !== t11 || $[39] !== t3) {
307
+ t12 = /*#__PURE__*/jsx("th", {
308
+ className: t3,
309
+ scope: "col",
310
+ "aria-sort": sortOrder,
311
+ children: t11
312
+ });
313
+ $[37] = sortOrder;
314
+ $[38] = t11;
315
+ $[39] = t3;
316
+ $[40] = t12;
317
+ } else {
318
+ t12 = $[40];
319
+ }
320
+ return t12;
321
+ }
322
+ function SortButton(t0) {
323
+ const $ = c(22);
324
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
325
+ for (let $i = 0; $i < 22; $i += 1) {
326
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
327
+ }
328
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
329
+ }
330
+ let children;
331
+ let className;
332
+ let columnIndex;
333
+ let onClick;
334
+ let restProps;
335
+ if ($[1] !== t0) {
336
+ ({
337
+ columnIndex,
338
+ className,
339
+ children,
340
+ onClick,
341
+ ...restProps
342
+ } = t0);
343
+ $[1] = t0;
344
+ $[2] = children;
345
+ $[3] = className;
346
+ $[4] = columnIndex;
347
+ $[5] = onClick;
348
+ $[6] = restProps;
349
+ } else {
350
+ children = $[2];
351
+ className = $[3];
352
+ columnIndex = $[4];
353
+ onClick = $[5];
354
+ restProps = $[6];
355
+ }
356
+ const tableProps = use(TablePropsContext);
357
+ const column = tableProps?.columns[columnIndex];
358
+ const sortOrder = column?.sortOrder;
359
+ const glyph = sortOrder === "none" ? sortableIcon : sortOrder === "ascending" ? arrowUpIcon : sortOrder === "descending" ? arrowDownIcon : undefined;
360
+ let t1;
361
+ if ($[7] !== columnIndex || $[8] !== onClick || $[9] !== sortOrder || $[10] !== tableProps) {
362
+ t1 = e => {
363
+ onClick?.(e);
364
+ if (!e.defaultPrevented) {
365
+ const nextOrder = sortOrder === "ascending" ? "descending" : sortOrder === "descending" ? "none" : "ascending";
366
+ tableProps.onSort?.(columnIndex, nextOrder, tableProps.columns);
367
+ }
368
+ };
369
+ $[7] = columnIndex;
370
+ $[8] = onClick;
371
+ $[9] = sortOrder;
372
+ $[10] = tableProps;
373
+ $[11] = t1;
374
+ } else {
375
+ t1 = $[11];
376
+ }
377
+ const handleClick = t1;
378
+ if (!tableProps || !column) {
379
+ return null;
380
+ }
381
+ let t2;
382
+ if ($[12] !== className) {
383
+ t2 = classNames(styles.headerButton, className);
384
+ $[12] = className;
385
+ $[13] = t2;
386
+ } else {
387
+ t2 = $[13];
388
+ }
389
+ let t3;
390
+ if ($[14] !== glyph) {
391
+ t3 = /*#__PURE__*/jsx(Icon, {
392
+ glyph: glyph,
393
+ "aria-hidden": true
394
+ });
395
+ $[14] = glyph;
396
+ $[15] = t3;
397
+ } else {
398
+ t3 = $[15];
399
+ }
400
+ let t4;
401
+ if ($[16] !== children || $[17] !== handleClick || $[18] !== restProps || $[19] !== t2 || $[20] !== t3) {
402
+ t4 = /*#__PURE__*/jsxs("button", {
403
+ type: "button",
404
+ className: t2,
405
+ onClick: handleClick,
406
+ ...restProps,
407
+ children: [children, " ", t3]
408
+ });
409
+ $[16] = children;
410
+ $[17] = handleClick;
411
+ $[18] = restProps;
412
+ $[19] = t2;
413
+ $[20] = t3;
414
+ $[21] = t4;
415
+ } else {
416
+ t4 = $[21];
417
+ }
418
+ return t4;
419
+ }
420
+ function DeleteColumnButton(t0) {
421
+ var _column$name;
422
+ const $ = c(18);
423
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
424
+ for (let $i = 0; $i < 18; $i += 1) {
425
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
426
+ }
427
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
428
+ }
429
+ let className;
430
+ let columnIndex;
431
+ let onClick;
432
+ let restProps;
433
+ if ($[1] !== t0) {
434
+ ({
435
+ columnIndex,
436
+ className,
437
+ onClick,
438
+ ...restProps
439
+ } = t0);
440
+ $[1] = t0;
441
+ $[2] = className;
442
+ $[3] = columnIndex;
443
+ $[4] = onClick;
444
+ $[5] = restProps;
445
+ } else {
446
+ className = $[2];
447
+ columnIndex = $[3];
448
+ onClick = $[4];
449
+ restProps = $[5];
450
+ }
451
+ const tableProps = use(TablePropsContext);
452
+ const column = tableProps?.columns[columnIndex];
453
+ let t1;
454
+ if ($[6] !== columnIndex || $[7] !== onClick || $[8] !== tableProps) {
455
+ t1 = e => {
456
+ onClick?.(e);
457
+ if (!e.defaultPrevented) {
458
+ tableProps.onColumnDelete?.(columnIndex, tableProps.columns);
459
+ }
460
+ };
461
+ $[6] = columnIndex;
462
+ $[7] = onClick;
463
+ $[8] = tableProps;
464
+ $[9] = t1;
465
+ } else {
466
+ t1 = $[9];
467
+ }
468
+ const handleClick = t1;
469
+ if (!tableProps || !column) {
470
+ return null;
471
+ }
472
+ const hint = `Delete column ${(_column$name = column.name) !== null && _column$name !== void 0 ? _column$name : String(column.key)}.`;
473
+ let t2;
474
+ if ($[10] !== className) {
475
+ t2 = classNames(styles.headerButton, styles.deleteColumnButton, className);
476
+ $[10] = className;
477
+ $[11] = t2;
478
+ } else {
479
+ t2 = $[11];
480
+ }
481
+ let t3;
482
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
483
+ t3 = /*#__PURE__*/jsx(Icon, {
484
+ glyph: trashIcon,
485
+ "aria-hidden": "true"
486
+ });
487
+ $[12] = t3;
488
+ } else {
489
+ t3 = $[12];
490
+ }
491
+ let t4;
492
+ if ($[13] !== handleClick || $[14] !== hint || $[15] !== restProps || $[16] !== t2) {
493
+ t4 = /*#__PURE__*/jsx("button", {
494
+ type: "button",
495
+ className: t2,
496
+ onClick: handleClick,
497
+ "aria-label": hint,
498
+ title: hint,
499
+ ...restProps,
500
+ children: t3
501
+ });
502
+ $[13] = handleClick;
503
+ $[14] = hint;
504
+ $[15] = restProps;
505
+ $[16] = t2;
506
+ $[17] = t4;
507
+ } else {
508
+ t4 = $[17];
509
+ }
510
+ return t4;
511
+ }
512
+ function EditColumnsButton(t0) {
513
+ const $ = c(14);
514
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
515
+ for (let $i = 0; $i < 14; $i += 1) {
516
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
517
+ }
518
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
519
+ }
520
+ let columnEditing;
521
+ let hint;
522
+ let restProps;
523
+ let t1;
524
+ let t2;
525
+ if ($[1] !== t0) {
526
+ const {
527
+ columnEditing: t3,
528
+ ...props
529
+ } = t0;
530
+ columnEditing = t3;
531
+ const {
532
+ className,
533
+ ...t4
534
+ } = props;
535
+ restProps = t4;
536
+ hint = columnEditing ? "Hide column controls." : "Show column controls.";
537
+ t1 = "button";
538
+ t2 = classNames(styles.headerButton, styles.editColumnsButton, className);
539
+ $[1] = t0;
540
+ $[2] = columnEditing;
541
+ $[3] = hint;
542
+ $[4] = restProps;
543
+ $[5] = t1;
544
+ $[6] = t2;
545
+ } else {
546
+ columnEditing = $[2];
547
+ hint = $[3];
548
+ restProps = $[4];
549
+ t1 = $[5];
550
+ t2 = $[6];
551
+ }
552
+ let t3;
553
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
554
+ t3 = /*#__PURE__*/jsx(Icon, {
555
+ glyph: settingsIcon,
556
+ "aria-hidden": "true"
557
+ });
558
+ $[7] = t3;
559
+ } else {
560
+ t3 = $[7];
561
+ }
562
+ let t4;
563
+ if ($[8] !== columnEditing || $[9] !== hint || $[10] !== restProps || $[11] !== t1 || $[12] !== t2) {
564
+ t4 = /*#__PURE__*/jsx("button", {
565
+ type: t1,
566
+ className: t2,
567
+ "aria-pressed": columnEditing,
568
+ "aria-label": hint,
569
+ title: hint,
570
+ ...restProps,
571
+ children: t3
572
+ });
573
+ $[8] = columnEditing;
574
+ $[9] = hint;
575
+ $[10] = restProps;
576
+ $[11] = t1;
577
+ $[12] = t2;
578
+ $[13] = t4;
579
+ } else {
580
+ t4 = $[13];
581
+ }
582
+ return t4;
583
+ }
584
+ function ColumnReorderHandle(t0) {
585
+ var _column$name2;
586
+ const $ = c(59);
587
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
588
+ for (let $i = 0; $i < 59; $i += 1) {
589
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
590
+ }
591
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
592
+ }
593
+ let className;
594
+ let columnIndex;
595
+ let expectColumnReorder;
596
+ let onKeyDown;
597
+ let onLostPointerCapture;
598
+ let onPointerCancel;
599
+ let onPointerDown;
600
+ let onPointerMove;
601
+ let onPointerUp;
602
+ let restProps;
603
+ let userRef;
604
+ if ($[1] !== t0) {
605
+ ({
606
+ columnIndex,
607
+ expectColumnReorder,
608
+ ref: userRef,
609
+ className,
610
+ onPointerDown,
611
+ onPointerMove,
612
+ onPointerUp,
613
+ onPointerCancel,
614
+ onLostPointerCapture,
615
+ onKeyDown,
616
+ ...restProps
617
+ } = t0);
618
+ $[1] = t0;
619
+ $[2] = className;
620
+ $[3] = columnIndex;
621
+ $[4] = expectColumnReorder;
622
+ $[5] = onKeyDown;
623
+ $[6] = onLostPointerCapture;
624
+ $[7] = onPointerCancel;
625
+ $[8] = onPointerDown;
626
+ $[9] = onPointerMove;
627
+ $[10] = onPointerUp;
628
+ $[11] = restProps;
629
+ $[12] = userRef;
630
+ } else {
631
+ className = $[2];
632
+ columnIndex = $[3];
633
+ expectColumnReorder = $[4];
634
+ onKeyDown = $[5];
635
+ onLostPointerCapture = $[6];
636
+ onPointerCancel = $[7];
637
+ onPointerDown = $[8];
638
+ onPointerMove = $[9];
639
+ onPointerUp = $[10];
640
+ restProps = $[11];
641
+ userRef = $[12];
642
+ }
643
+ const tableProps = use(TablePropsContext);
644
+ const column = tableProps?.columns[columnIndex];
645
+ const canReorder = column?.canReorder;
646
+ let t1;
647
+ if ($[13] !== canReorder || $[14] !== tableProps) {
648
+ t1 = index => canReorder === true || typeof canReorder === "function" && canReorder(index, tableProps.columns);
649
+ $[13] = canReorder;
650
+ $[14] = tableProps;
651
+ $[15] = t1;
652
+ } else {
653
+ t1 = $[15];
654
+ }
655
+ const canReorderCb = t1;
656
+ const localRef = useRef(null);
657
+ const composedRef = useComposedRef(localRef, userRef);
658
+ const activeDragRef = useRef(null);
659
+ const getDragFrame = _temp;
660
+ let t2;
661
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
662
+ t2 = clientX => {
663
+ const {
664
+ startColumnIndex,
665
+ startClientX,
666
+ headerTopClientY,
667
+ columnsClientX,
668
+ indicatorHeight
669
+ } = activeDragRef.current;
670
+ const {
671
+ l,
672
+ r
673
+ } = columnsClientX[startColumnIndex];
674
+ let dragFrame = getDragFrame();
675
+ if (!dragFrame) {
676
+ dragFrame = document.createElement("div");
677
+ dragFrame.className = styles.columnDragFrame;
678
+ dragFrame.style.setProperty("top", `calc(max(0px, ${headerTopClientY - 2}px))`);
679
+ dragFrame.style.setProperty("width", `${r - l}px`);
680
+ dragFrame.style.setProperty("height", indicatorHeight);
681
+ document.body.appendChild(dragFrame);
682
+ }
683
+ dragFrame.style.setProperty("left", `${l + clientX - startClientX}px`);
684
+ };
685
+ $[16] = t2;
686
+ } else {
687
+ t2 = $[16];
688
+ }
689
+ const renderDragFrame = t2;
690
+ let t3;
691
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
692
+ t3 = clientX_0 => {
693
+ if (!localRef.current || !activeDragRef.current) {
694
+ return;
695
+ }
696
+ const {
697
+ startClientX: startClientX_0
698
+ } = activeDragRef.current;
699
+ localRef.current.style.setProperty("transform", `translateX(${clientX_0 - startClientX_0}px)`);
700
+ };
701
+ $[17] = t3;
702
+ } else {
703
+ t3 = $[17];
704
+ }
705
+ const translateXButton = t3;
706
+ let t4;
707
+ if ($[18] !== canReorderCb) {
708
+ t4 = clientX_1 => {
709
+ let bestDistance = Infinity;
710
+ let index_0 = -1;
711
+ let after = false;
712
+ activeDragRef.current?.columnsClientX.forEach((t5, i) => {
713
+ const {
714
+ l: l_0,
715
+ r: r_0
716
+ } = t5;
717
+ const distanceToLeft = Math.abs(l_0 - clientX_1);
718
+ const distanceToRight = Math.abs(r_0 - clientX_1);
719
+ if (distanceToLeft < bestDistance && canReorderCb(i)) {
720
+ bestDistance = distanceToLeft;
721
+ index_0 = i;
722
+ after = false;
723
+ }
724
+ if (distanceToRight < bestDistance && canReorderCb(i + 1)) {
725
+ bestDistance = distanceToRight;
726
+ index_0 = i;
727
+ after = true;
728
+ }
729
+ });
730
+ return {
731
+ index: index_0,
732
+ after
733
+ };
734
+ };
735
+ $[18] = canReorderCb;
736
+ $[19] = t4;
737
+ } else {
738
+ t4 = $[19];
739
+ }
740
+ const getClosestInsertionPoint = t4;
741
+ const getInsertionIndicator = _temp2;
742
+ let t5;
743
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
744
+ t5 = insertionPoint => {
745
+ const {
746
+ index: index_1,
747
+ after: after_0
748
+ } = insertionPoint;
749
+ const {
750
+ headerTopClientY: headerTopClientY_0,
751
+ columnsClientX: columnsClientX_0,
752
+ indicatorHeight: indicatorHeight_0
753
+ } = activeDragRef.current;
754
+ const {
755
+ l: l_1,
756
+ r: r_1
757
+ } = columnsClientX_0[index_1];
758
+ let indicator = getInsertionIndicator();
759
+ if (!indicator) {
760
+ indicator = document.createElement("div");
761
+ indicator.className = styles.columnInsertionIndicator;
762
+ indicator.style.setProperty("top", `${headerTopClientY_0}px`);
763
+ indicator.style.setProperty("height", indicatorHeight_0);
764
+ document.body.appendChild(indicator);
765
+ }
766
+ indicator.style.setProperty("left", `${(after_0 ? r_1 : l_1) - 1}px`);
767
+ };
768
+ $[20] = t5;
769
+ } else {
770
+ t5 = $[20];
771
+ }
772
+ const renderInsertionIndicator = t5;
773
+ let t6;
774
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
775
+ t6 = () => {
776
+ if (activeDragRef.current) {
777
+ activeDragRef.current.cleanup();
778
+ activeDragRef.current = null;
779
+ }
780
+ const btn = localRef.current;
781
+ if (btn) {
782
+ btn.style.removeProperty("transform");
783
+ btn.style.removeProperty("transition");
784
+ }
785
+ getDragFrame()?.remove();
786
+ getInsertionIndicator()?.remove();
787
+ };
788
+ $[21] = t6;
789
+ } else {
790
+ t6 = $[21];
791
+ }
792
+ const cleanupDrag = t6;
793
+ let t7;
794
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
795
+ t7 = () => {
796
+ if (activeDragRef.current?.state === "is-dragging") {
797
+ activeDragRef.current.state = "ended-with-no-change";
798
+ activeDragRef.current.cleanup();
799
+ activeDragRef.current.cleanup = _temp3;
800
+ const dragFrame_0 = getDragFrame();
801
+ if (dragFrame_0) {
802
+ const {
803
+ columnsClientX: columnsClientX_1,
804
+ startColumnIndex: startColumnIndex_0
805
+ } = activeDragRef.current;
806
+ dragFrame_0.style.left = `${columnsClientX_1[startColumnIndex_0].l}px`;
807
+ dragFrame_0.style.opacity = "0";
808
+ dragFrame_0.style.transition = "left var(--ring-ease), opacity var(--ring-ease)";
809
+ }
810
+ const indicator_0 = getInsertionIndicator();
811
+ if (indicator_0) {
812
+ indicator_0.style.opacity = "0";
813
+ indicator_0.style.transition = "opacity var(--ring-ease)";
814
+ }
815
+ const btn_0 = localRef.current;
816
+ if (btn_0) {
817
+ btn_0.style.transform = "translateX(0)";
818
+ btn_0.style.transition = "transform var(--ring-ease)";
819
+ }
820
+ }
821
+ const ringEaseMs = parseCssDuration(window.getComputedStyle(document.documentElement).getPropertyValue("--ring-ease"));
822
+ setTimeout(cleanupDrag, ringEaseMs);
823
+ };
824
+ $[22] = t7;
825
+ } else {
826
+ t7 = $[22];
827
+ }
828
+ const animateNoChangeThenCleanup = t7;
829
+ let t8;
830
+ if ($[23] !== columnIndex || $[24] !== onPointerDown) {
831
+ t8 = e => {
832
+ onPointerDown?.(e);
833
+ if (e.defaultPrevented) {
834
+ return;
835
+ }
836
+ const {
837
+ clientX: startClientX_1,
838
+ pointerId,
839
+ currentTarget
840
+ } = e;
841
+ const thead = currentTarget.closest("thead");
842
+ const table = thead?.closest("table");
843
+ if (!thead || !table) {
844
+ return;
845
+ }
846
+ const headerTopClientY_1 = thead.getBoundingClientRect().top;
847
+ const columnsClientX_2 = [...thead.querySelectorAll("th")].map(_temp4);
848
+ const {
849
+ bottom
850
+ } = table.getBoundingClientRect();
851
+ const visibleTableHeight = bottom - headerTopClientY_1;
852
+ const viewportBottomRelativeToHeaderTop = window.innerHeight - headerTopClientY_1;
853
+ const indicatorHeight_1 = `min(${visibleTableHeight}px, calc(${viewportBottomRelativeToHeaderTop}px - .5rem))`;
854
+ currentTarget.setPointerCapture(pointerId);
855
+ const keydownListener = function keydownListener(keyEvent) {
856
+ if (keyEvent.key === "Escape") {
857
+ animateNoChangeThenCleanup();
858
+ keyEvent.stopPropagation();
859
+ keyEvent.preventDefault();
860
+ }
861
+ };
862
+ document.addEventListener("keydown", keydownListener);
863
+ currentTarget.style.cursor = "grabbing";
864
+ activeDragRef.current = {
865
+ state: "is-dragging",
866
+ startColumnIndex: columnIndex,
867
+ startClientX: startClientX_1,
868
+ headerTopClientY: headerTopClientY_1,
869
+ columnsClientX: columnsClientX_2,
870
+ indicatorHeight: indicatorHeight_1,
871
+ cleanup: () => {
872
+ document.removeEventListener("keydown", keydownListener);
873
+ currentTarget.releasePointerCapture(pointerId);
874
+ currentTarget.style.removeProperty("cursor");
875
+ }
876
+ };
877
+ renderDragFrame(startClientX_1);
878
+ e.preventDefault();
879
+ };
880
+ $[23] = columnIndex;
881
+ $[24] = onPointerDown;
882
+ $[25] = t8;
883
+ } else {
884
+ t8 = $[25];
885
+ }
886
+ const handlePointerDown = t8;
887
+ let t9;
888
+ if ($[26] !== getClosestInsertionPoint || $[27] !== onPointerMove) {
889
+ t9 = e_0 => {
890
+ onPointerMove?.(e_0);
891
+ if (e_0.defaultPrevented || activeDragRef.current?.state !== "is-dragging") {
892
+ return;
893
+ }
894
+ const {
895
+ clientX: clientX_2
896
+ } = e_0;
897
+ renderDragFrame(clientX_2);
898
+ translateXButton(clientX_2);
899
+ const insertionPoint_0 = getClosestInsertionPoint(clientX_2);
900
+ if (insertionPoint_0) {
901
+ renderInsertionIndicator(insertionPoint_0);
902
+ }
903
+ };
904
+ $[26] = getClosestInsertionPoint;
905
+ $[27] = onPointerMove;
906
+ $[28] = t9;
907
+ } else {
908
+ t9 = $[28];
909
+ }
910
+ const handlePointerMove = t9;
911
+ let t10;
912
+ if ($[29] !== columnIndex || $[30] !== expectColumnReorder || $[31] !== getClosestInsertionPoint || $[32] !== onPointerUp || $[33] !== tableProps) {
913
+ t10 = e_1 => {
914
+ onPointerUp?.(e_1);
915
+ if (e_1.defaultPrevented || activeDragRef.current?.state !== "is-dragging") {
916
+ return;
917
+ }
918
+ const table_0 = e_1.currentTarget.closest("table");
919
+ if (!table_0) {
920
+ cleanupDrag();
921
+ return;
922
+ }
923
+ const {
924
+ index: index_2,
925
+ after: after_1
926
+ } = getClosestInsertionPoint(e_1.clientX);
927
+ const insertionIndex = after_1 ? index_2 + 1 : index_2;
928
+ if (insertionIndex === columnIndex || insertionIndex === columnIndex + 1) {
929
+ animateNoChangeThenCleanup();
930
+ return;
931
+ }
932
+ cleanupDrag();
933
+ expectColumnReorder({
934
+ fromIndex: columnIndex,
935
+ insertionIndex
936
+ });
937
+ tableProps.onColumnReorder?.(columnIndex, insertionIndex, tableProps.columns);
938
+ };
939
+ $[29] = columnIndex;
940
+ $[30] = expectColumnReorder;
941
+ $[31] = getClosestInsertionPoint;
942
+ $[32] = onPointerUp;
943
+ $[33] = tableProps;
944
+ $[34] = t10;
945
+ } else {
946
+ t10 = $[34];
947
+ }
948
+ const handlePointerUp = t10;
949
+ let t11;
950
+ if ($[35] !== onPointerCancel) {
951
+ t11 = e_2 => {
952
+ onPointerCancel?.(e_2);
953
+ if (e_2.defaultPrevented) {
954
+ return;
955
+ }
956
+ animateNoChangeThenCleanup();
957
+ };
958
+ $[35] = onPointerCancel;
959
+ $[36] = t11;
960
+ } else {
961
+ t11 = $[36];
962
+ }
963
+ const handlePointerCancel = t11;
964
+ let t12;
965
+ if ($[37] !== onLostPointerCapture) {
966
+ t12 = e_3 => {
967
+ onLostPointerCapture?.(e_3);
968
+ if (e_3.defaultPrevented) {
969
+ return;
970
+ }
971
+ animateNoChangeThenCleanup();
972
+ };
973
+ $[37] = onLostPointerCapture;
974
+ $[38] = t12;
975
+ } else {
976
+ t12 = $[38];
977
+ }
978
+ const handleLostPointerCapture = t12;
979
+ let t13;
980
+ if ($[39] !== canReorderCb || $[40] !== columnIndex || $[41] !== expectColumnReorder || $[42] !== onKeyDown || $[43] !== tableProps) {
981
+ t13 = e_4 => {
982
+ onKeyDown?.(e_4);
983
+ if (e_4.defaultPrevented || !tableProps) {
984
+ return;
985
+ }
986
+ const left = e_4.key === "ArrowLeft";
987
+ const right = e_4.key === "ArrowRight";
988
+ if (!left && !right) {
989
+ return;
990
+ }
991
+ const initialInsertionIndex = left ? columnIndex - 1 : columnIndex + 2;
992
+ const step = left ? -1 : 1;
993
+ for (let i_0 = initialInsertionIndex; 0 <= i_0 && i_0 <= tableProps.columns.length; i_0 = i_0 + step, i_0) {
994
+ if (canReorderCb(i_0)) {
995
+ expectColumnReorder({
996
+ fromIndex: columnIndex,
997
+ insertionIndex: i_0
998
+ });
999
+ tableProps.onColumnReorder?.(columnIndex, i_0, tableProps.columns);
1000
+ e_4.preventDefault();
1001
+ return;
1002
+ }
1003
+ }
1004
+ };
1005
+ $[39] = canReorderCb;
1006
+ $[40] = columnIndex;
1007
+ $[41] = expectColumnReorder;
1008
+ $[42] = onKeyDown;
1009
+ $[43] = tableProps;
1010
+ $[44] = t13;
1011
+ } else {
1012
+ t13 = $[44];
1013
+ }
1014
+ const handleKeyDown = t13;
1015
+ if (!tableProps || !column) {
1016
+ return null;
1017
+ }
1018
+ const hint = `Reorder column ${(_column$name2 = column.name) !== null && _column$name2 !== void 0 ? _column$name2 : String(column.key)}.`;
1019
+ let t14;
1020
+ if ($[45] !== className) {
1021
+ t14 = classNames(styles.headerButton, styles.columnReorderHandle, className);
1022
+ $[45] = className;
1023
+ $[46] = t14;
1024
+ } else {
1025
+ t14 = $[46];
1026
+ }
1027
+ let t15;
1028
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
1029
+ t15 = /*#__PURE__*/jsx(Icon, {
1030
+ glyph: dragIcon,
1031
+ "aria-hidden": "true"
1032
+ });
1033
+ $[47] = t15;
1034
+ } else {
1035
+ t15 = $[47];
1036
+ }
1037
+ let t16;
1038
+ if ($[48] !== composedRef || $[49] !== handleKeyDown || $[50] !== handleLostPointerCapture || $[51] !== handlePointerCancel || $[52] !== handlePointerDown || $[53] !== handlePointerMove || $[54] !== handlePointerUp || $[55] !== hint || $[56] !== restProps || $[57] !== t14) {
1039
+ t16 = /*#__PURE__*/jsx("button", {
1040
+ ref: composedRef,
1041
+ type: "button",
1042
+ className: t14,
1043
+ "aria-label": hint,
1044
+ "aria-description": "Use Left and Right arrow keys to move the column.",
1045
+ "aria-keyshortcuts": "ArrowLeft ArrowRight",
1046
+ onKeyDown: handleKeyDown,
1047
+ onPointerDown: handlePointerDown,
1048
+ onPointerMove: handlePointerMove,
1049
+ onPointerUp: handlePointerUp,
1050
+ onPointerCancel: handlePointerCancel,
1051
+ onLostPointerCapture: handleLostPointerCapture,
1052
+ ...restProps,
1053
+ children: t15
1054
+ });
1055
+ $[48] = composedRef;
1056
+ $[49] = handleKeyDown;
1057
+ $[50] = handleLostPointerCapture;
1058
+ $[51] = handlePointerCancel;
1059
+ $[52] = handlePointerDown;
1060
+ $[53] = handlePointerMove;
1061
+ $[54] = handlePointerUp;
1062
+ $[55] = hint;
1063
+ $[56] = restProps;
1064
+ $[57] = t14;
1065
+ $[58] = t16;
1066
+ } else {
1067
+ t16 = $[58];
1068
+ }
1069
+ return t16;
1070
+ }
1071
+ /**
1072
+ * Reserves the space for the reorder handle and prevents layout shift when the handle appears on hover.
1073
+ */
1074
+ function _temp4(th) {
1075
+ const rect = th.getBoundingClientRect();
1076
+ return {
1077
+ l: rect.x,
1078
+ r: rect.x + rect.width
1079
+ };
1080
+ }
1081
+ function _temp3() {}
1082
+ function _temp2() {
1083
+ return document.body.querySelector(`.${styles.columnInsertionIndicator}`);
1084
+ }
1085
+ function _temp() {
1086
+ return document.body.querySelector(`.${styles.columnDragFrame}`);
1087
+ }
1088
+ function ColumnReorderHandleMirror() {
1089
+ const $ = c(2);
1090
+ if ($[0] !== "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a") {
1091
+ for (let $i = 0; $i < 2; $i += 1) {
1092
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
1093
+ }
1094
+ $[0] = "12be56e7e3023192524687b975ff98ec759f5dac43ff15a672ef295c41ac272a";
1095
+ }
1096
+ let t0;
1097
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1098
+ t0 = /*#__PURE__*/jsx("span", {
1099
+ className: styles.columnReorderHandleMirror,
1100
+ "aria-hidden": "true"
1101
+ });
1102
+ $[1] = t0;
1103
+ } else {
1104
+ t0 = $[1];
1105
+ }
1106
+ return t0;
1107
+ }
1108
+
1109
+ export { TableHeader };