@jetbrains/ring-ui-built 8.0.0-beta.12 → 8.0.0-beta.14

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.
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { use, useState, useRef } from 'react';
2
+ import { use, useState, useRef, useId } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import arrowDownIcon from '@jetbrains/icons/arrow-12px-down';
5
5
  import arrowUpIcon from '@jetbrains/icons/arrow-12px-up';
@@ -13,6 +13,7 @@ import { ReorderHandle } from './reorder-handle.js';
13
13
  import { ReorderAnimationContext } from './reorder-animation-context.js';
14
14
  import { useReorderLayoutContextValue, ReorderLayoutContext } from './reorder-layout-context.js';
15
15
  import { useReorderItemLayout } from '../table/reorder-item-layout.js';
16
+ import { ColumnResizeHandle } from '../column-resize/column-resize-handle.js';
16
17
  import { s as styles } from '../_helpers/table.js';
17
18
  import { jsx, jsxs } from 'react/jsx-runtime';
18
19
  import 'util-deprecate';
@@ -23,15 +24,20 @@ import '@jetbrains/icons/drag-12px';
23
24
  import '../global/compose-refs.js';
24
25
  import 'memoize-one';
25
26
  import '../global/parse-css-duration.js';
27
+ import './drag-auto-scroll.js';
28
+ import './column-indicator-vertical-span.js';
26
29
  import '../global/schedule-with-cleanup.js';
30
+ import 'react-dom';
31
+ import '../column-resize/column-sizing-context.js';
32
+ import '../column-resize/column-resize-drag.js';
27
33
 
28
34
  function TableHeader() {
29
35
  const $ = c(30);
30
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
36
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
31
37
  for (let $i = 0; $i < 30; $i += 1) {
32
38
  $[$i] = Symbol.for("react.memo_cache_sentinel");
33
39
  }
34
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
40
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
35
41
  }
36
42
  const {
37
43
  columns,
@@ -168,12 +174,12 @@ function TableHeader() {
168
174
  return t9;
169
175
  }
170
176
  function TableHeaderCell(t0) {
171
- const $ = c(43);
172
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
173
- for (let $i = 0; $i < 43; $i += 1) {
177
+ const $ = c(53);
178
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
179
+ for (let $i = 0; $i < 53; $i += 1) {
174
180
  $[$i] = Symbol.for("react.memo_cache_sentinel");
175
181
  }
176
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
182
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
177
183
  }
178
184
  const {
179
185
  columnIndex,
@@ -181,10 +187,12 @@ function TableHeaderCell(t0) {
181
187
  handleEditColumnsButtonClick
182
188
  } = t0;
183
189
  const ref = useRef(null);
190
+ const labelId = useId();
184
191
  const {
185
192
  columns,
186
193
  columnEditButton
187
194
  } = use(TablePropsContext);
195
+ const column = columns[columnIndex];
188
196
  const {
189
197
  key,
190
198
  name,
@@ -192,8 +200,9 @@ function TableHeaderCell(t0) {
192
200
  sortOrder,
193
201
  deletable,
194
202
  canReorder,
203
+ resizable,
195
204
  thClassName
196
- } = columns[columnIndex];
205
+ } = column;
197
206
  const {
198
207
  reorderAnimation
199
208
  } = use(ReorderAnimationContext);
@@ -207,10 +216,22 @@ function TableHeaderCell(t0) {
207
216
  } else {
208
217
  t1 = $[4];
209
218
  }
210
- const children = t1;
211
219
  let t2;
212
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
213
- t2 = () => {
220
+ if ($[5] !== labelId || $[6] !== t1) {
221
+ t2 = /*#__PURE__*/jsx("span", {
222
+ id: labelId,
223
+ children: t1
224
+ });
225
+ $[5] = labelId;
226
+ $[6] = t1;
227
+ $[7] = t2;
228
+ } else {
229
+ t2 = $[7];
230
+ }
231
+ const children = t2;
232
+ let t3;
233
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
234
+ t3 = () => {
214
235
  var _r$left, _r$right;
215
236
  const r = ref.current?.getBoundingClientRect();
216
237
  return {
@@ -218,153 +239,171 @@ function TableHeaderCell(t0) {
218
239
  end: (_r$right = r?.right) !== null && _r$right !== void 0 ? _r$right : 0
219
240
  };
220
241
  };
221
- $[5] = t2;
242
+ $[8] = t3;
222
243
  } else {
223
- t2 = $[5];
244
+ t3 = $[8];
224
245
  }
225
- let t3;
226
- if ($[6] !== columnIndex) {
227
- t3 = {
246
+ let t4;
247
+ if ($[9] !== columnIndex) {
248
+ t4 = {
228
249
  index: columnIndex,
229
- getBounds: t2
250
+ getBounds: t3
230
251
  };
231
- $[6] = columnIndex;
232
- $[7] = t3;
252
+ $[9] = columnIndex;
253
+ $[10] = t4;
233
254
  } else {
234
- t3 = $[7];
255
+ t4 = $[10];
235
256
  }
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;
257
+ useReorderItemLayout(t4);
258
+ const t5 = resizable && styles.resizableHeaderCell;
259
+ const t6 = reorderAnimation?.direction === "columns" && reorderAnimation.index === columnIndex && reorderAnimation.className;
260
+ let t7;
261
+ if ($[11] !== t5 || $[12] !== t6 || $[13] !== thClassName) {
262
+ t7 = classNames(styles.headerCell, t5, t6, thClassName);
263
+ $[11] = t5;
264
+ $[12] = t6;
265
+ $[13] = thClassName;
266
+ $[14] = t7;
244
267
  } else {
245
- t5 = $[10];
268
+ t7 = $[14];
246
269
  }
247
- let t6;
248
- if ($[11] !== canReorder || $[12] !== columnIndex) {
249
- t6 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandle, {
270
+ let t8;
271
+ if ($[15] !== canReorder || $[16] !== columnIndex) {
272
+ t8 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandle, {
250
273
  columnIndex: columnIndex
251
274
  });
252
- $[11] = canReorder;
253
- $[12] = columnIndex;
254
- $[13] = t6;
275
+ $[15] = canReorder;
276
+ $[16] = columnIndex;
277
+ $[17] = t8;
255
278
  } else {
256
- t6 = $[13];
279
+ t8 = $[17];
257
280
  }
258
- let t7;
259
- if ($[14] !== children || $[15] !== columnIndex || $[16] !== sortOrder) {
260
- t7 = sortOrder ? /*#__PURE__*/jsx(SortButton, {
281
+ let t9;
282
+ if ($[18] !== children || $[19] !== columnIndex || $[20] !== sortOrder) {
283
+ t9 = sortOrder ? /*#__PURE__*/jsx(SortButton, {
261
284
  columnIndex: columnIndex,
262
285
  "aria-description": `Sort order: ${sortOrder}`,
263
286
  children: children
264
287
  }) : children;
265
- $[14] = children;
266
- $[15] = columnIndex;
267
- $[16] = sortOrder;
268
- $[17] = t7;
288
+ $[18] = children;
289
+ $[19] = columnIndex;
290
+ $[20] = sortOrder;
291
+ $[21] = t9;
269
292
  } else {
270
- t7 = $[17];
293
+ t9 = $[21];
271
294
  }
272
- let t8;
273
- if ($[18] !== canReorder) {
274
- t8 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandleMirror, {});
275
- $[18] = canReorder;
276
- $[19] = t8;
295
+ let t10;
296
+ if ($[22] !== canReorder) {
297
+ t10 = canReorder && /*#__PURE__*/jsx(ColumnReorderHandleMirror, {});
298
+ $[22] = canReorder;
299
+ $[23] = t10;
277
300
  } else {
278
- t8 = $[19];
301
+ t10 = $[23];
279
302
  }
280
- let t9;
281
- if ($[20] !== t6 || $[21] !== t7 || $[22] !== t8) {
282
- t9 = /*#__PURE__*/jsxs("div", {
303
+ let t11;
304
+ if ($[24] !== t10 || $[25] !== t8 || $[26] !== t9) {
305
+ t11 = /*#__PURE__*/jsxs("div", {
283
306
  className: styles.sortAndHeader,
284
- children: [t6, t7, t8]
307
+ children: [t8, t9, t10]
285
308
  });
286
- $[20] = t6;
287
- $[21] = t7;
288
- $[22] = t8;
289
- $[23] = t9;
309
+ $[24] = t10;
310
+ $[25] = t8;
311
+ $[26] = t9;
312
+ $[27] = t11;
290
313
  } else {
291
- t9 = $[23];
314
+ t11 = $[27];
292
315
  }
293
- let t10;
294
- if ($[24] !== columnIndex || $[25] !== deletable) {
295
- t10 = deletable && /*#__PURE__*/jsx(DeleteColumnButton, {
316
+ let t12;
317
+ if ($[28] !== columnIndex || $[29] !== deletable) {
318
+ t12 = deletable && /*#__PURE__*/jsx(DeleteColumnButton, {
296
319
  columnIndex: columnIndex
297
320
  });
298
- $[24] = columnIndex;
299
- $[25] = deletable;
300
- $[26] = t10;
321
+ $[28] = columnIndex;
322
+ $[29] = deletable;
323
+ $[30] = t12;
301
324
  } else {
302
- t10 = $[26];
325
+ t12 = $[30];
303
326
  }
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, {
327
+ let t13;
328
+ if ($[31] !== columnEditButton || $[32] !== columnEditing || $[33] !== columnIndex || $[34] !== columns.length || $[35] !== handleEditColumnsButtonClick) {
329
+ t13 = columnIndex === columns.length - 1 && columnEditButton && /*#__PURE__*/jsx(EditColumnsButton, {
307
330
  columnEditing: columnEditing,
308
331
  onClick: handleEditColumnsButtonClick
309
332
  });
310
- $[27] = columnEditButton;
311
- $[28] = columnEditing;
312
- $[29] = columnIndex;
313
- $[30] = columns.length;
314
- $[31] = handleEditColumnsButtonClick;
315
- $[32] = t11;
333
+ $[31] = columnEditButton;
334
+ $[32] = columnEditing;
335
+ $[33] = columnIndex;
336
+ $[34] = columns.length;
337
+ $[35] = handleEditColumnsButtonClick;
338
+ $[36] = t13;
316
339
  } else {
317
- t11 = $[32];
340
+ t13 = $[36];
318
341
  }
319
- let t12;
320
- if ($[33] !== t10 || $[34] !== t11) {
321
- t12 = /*#__PURE__*/jsxs("div", {
342
+ let t14;
343
+ if ($[37] !== t12 || $[38] !== t13) {
344
+ t14 = /*#__PURE__*/jsxs("div", {
322
345
  className: styles.rightButtons,
323
- children: [t10, t11]
346
+ children: [t12, t13]
324
347
  });
325
- $[33] = t10;
326
- $[34] = t11;
327
- $[35] = t12;
348
+ $[37] = t12;
349
+ $[38] = t13;
350
+ $[39] = t14;
328
351
  } else {
329
- t12 = $[35];
352
+ t14 = $[39];
330
353
  }
331
- let t13;
332
- if ($[36] !== t12 || $[37] !== t9) {
333
- t13 = /*#__PURE__*/jsxs("div", {
354
+ let t15;
355
+ if ($[40] !== t11 || $[41] !== t14) {
356
+ t15 = /*#__PURE__*/jsxs("div", {
334
357
  className: styles.headerCellInnerWrapper,
335
- children: [t9, t12]
358
+ children: [t11, t14]
336
359
  });
337
- $[36] = t12;
338
- $[37] = t9;
339
- $[38] = t13;
360
+ $[40] = t11;
361
+ $[41] = t14;
362
+ $[42] = t15;
340
363
  } else {
341
- t13 = $[38];
364
+ t15 = $[42];
342
365
  }
343
- let t14;
344
- if ($[39] !== sortOrder || $[40] !== t13 || $[41] !== t5) {
345
- t14 = /*#__PURE__*/jsx("th", {
366
+ let t16;
367
+ if ($[43] !== column || $[44] !== columnIndex || $[45] !== resizable) {
368
+ t16 = resizable && /*#__PURE__*/jsx(ColumnResizeHandle, {
369
+ column: column,
370
+ columnIndex: columnIndex
371
+ });
372
+ $[43] = column;
373
+ $[44] = columnIndex;
374
+ $[45] = resizable;
375
+ $[46] = t16;
376
+ } else {
377
+ t16 = $[46];
378
+ }
379
+ let t17;
380
+ if ($[47] !== labelId || $[48] !== sortOrder || $[49] !== t15 || $[50] !== t16 || $[51] !== t7) {
381
+ t17 = /*#__PURE__*/jsxs("th", {
346
382
  ref: ref,
347
- className: t5,
383
+ className: t7,
348
384
  scope: "col",
349
385
  "aria-sort": sortOrder,
350
- children: t13
386
+ "aria-labelledby": labelId,
387
+ children: [t15, t16]
351
388
  });
352
- $[39] = sortOrder;
353
- $[40] = t13;
354
- $[41] = t5;
355
- $[42] = t14;
389
+ $[47] = labelId;
390
+ $[48] = sortOrder;
391
+ $[49] = t15;
392
+ $[50] = t16;
393
+ $[51] = t7;
394
+ $[52] = t17;
356
395
  } else {
357
- t14 = $[42];
396
+ t17 = $[52];
358
397
  }
359
- return t14;
398
+ return t17;
360
399
  }
361
400
  function SortButton(t0) {
362
401
  const $ = c(22);
363
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
402
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
364
403
  for (let $i = 0; $i < 22; $i += 1) {
365
404
  $[$i] = Symbol.for("react.memo_cache_sentinel");
366
405
  }
367
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
406
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
368
407
  }
369
408
  let children;
370
409
  let className;
@@ -459,11 +498,11 @@ function SortButton(t0) {
459
498
  function DeleteColumnButton(t0) {
460
499
  var _column$name;
461
500
  const $ = c(18);
462
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
501
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
463
502
  for (let $i = 0; $i < 18; $i += 1) {
464
503
  $[$i] = Symbol.for("react.memo_cache_sentinel");
465
504
  }
466
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
505
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
467
506
  }
468
507
  let className;
469
508
  let columnIndex;
@@ -551,11 +590,11 @@ function DeleteColumnButton(t0) {
551
590
  }
552
591
  function EditColumnsButton(t0) {
553
592
  const $ = c(14);
554
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
593
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
555
594
  for (let $i = 0; $i < 14; $i += 1) {
556
595
  $[$i] = Symbol.for("react.memo_cache_sentinel");
557
596
  }
558
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
597
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
559
598
  }
560
599
  let columnEditing;
561
600
  let hint;
@@ -623,11 +662,11 @@ function EditColumnsButton(t0) {
623
662
  }
624
663
  function ColumnReorderHandle(t0) {
625
664
  const $ = c(7);
626
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
665
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
627
666
  for (let $i = 0; $i < 7; $i += 1) {
628
667
  $[$i] = Symbol.for("react.memo_cache_sentinel");
629
668
  }
630
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
669
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
631
670
  }
632
671
  let columnIndex;
633
672
  let restProps;
@@ -663,11 +702,11 @@ function ColumnReorderHandle(t0) {
663
702
  */
664
703
  function ColumnReorderHandleMirror() {
665
704
  const $ = c(2);
666
- if ($[0] !== "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d") {
705
+ if ($[0] !== "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df") {
667
706
  for (let $i = 0; $i < 2; $i += 1) {
668
707
  $[$i] = Symbol.for("react.memo_cache_sentinel");
669
708
  }
670
- $[0] = "b3c0ce09616b10368937eafd2419f39baff21b41a15b2e7de8de6c88d493b96d";
709
+ $[0] = "d2be4026b6c8a643afb512c3eea0cb78b5cab4ec2be6d006114b8dac105ad6df";
671
710
  }
672
711
  let t0;
673
712
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {