@primer/react 0.0.0-20260326183142 → 0.0.0-20260326201657

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 (107) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/dist/ActionBar/ActionBar.d.ts +1 -1
  3. package/dist/ActionBar/index.d.ts +1 -1
  4. package/dist/ActionList/LinkItem.d.ts +6 -3
  5. package/dist/ActionList/LinkItem.d.ts.map +1 -1
  6. package/dist/ActionList/LinkItem.js +42 -87
  7. package/dist/ActionList/index.d.ts +25 -1
  8. package/dist/ActionList/index.d.ts.map +1 -1
  9. package/dist/ActionMenu/{ActionMenu-53493541.css → ActionMenu-58362ca7.css} +2 -2
  10. package/dist/ActionMenu/ActionMenu-58362ca7.css.map +1 -0
  11. package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
  12. package/dist/ActionMenu/ActionMenu.js +5 -2
  13. package/dist/ActionMenu/ActionMenu.module.css.js +1 -1
  14. package/dist/Banner/Banner.js +1 -1
  15. package/dist/Breadcrumbs/Breadcrumbs.d.ts +23 -8
  16. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  17. package/dist/Breadcrumbs/Breadcrumbs.js +27 -65
  18. package/dist/Button/{ButtonBase-6659abcf.css → ButtonBase-4da3fa22.css} +2 -2
  19. package/dist/Button/ButtonBase-4da3fa22.css.map +1 -0
  20. package/dist/Button/ButtonBase.js +1 -1
  21. package/dist/Button/ButtonBase.module.css.js +2 -2
  22. package/dist/Button/types.d.ts +1 -1
  23. package/dist/Button/types.d.ts.map +1 -1
  24. package/dist/Details/Details.js +1 -1
  25. package/dist/Dialog/{Dialog-2de477b3.css → Dialog-b577691f.css} +2 -2
  26. package/dist/Dialog/Dialog-b577691f.css.map +1 -0
  27. package/dist/Dialog/Dialog.d.ts.map +1 -1
  28. package/dist/Dialog/Dialog.js +29 -1
  29. package/dist/Dialog/Dialog.module.css.js +1 -1
  30. package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -1
  31. package/dist/FilteredActionList/FilteredActionList-6808e67a.css +2 -0
  32. package/dist/FilteredActionList/FilteredActionList-6808e67a.css.map +1 -0
  33. package/dist/FilteredActionList/FilteredActionList.module.css.js +1 -1
  34. package/dist/Link/{Link-968346ff.css → Link-ba423096.css} +2 -2
  35. package/dist/Link/Link-ba423096.css.map +1 -0
  36. package/dist/Link/Link.js +2 -1
  37. package/dist/Link/Link.module.css.js +1 -1
  38. package/dist/NavList/NavList.d.ts +20 -3
  39. package/dist/NavList/NavList.d.ts.map +1 -1
  40. package/dist/NavList/NavList.js +50 -124
  41. package/dist/Overlay/{Overlay-2e0ce8db.css → Overlay-f81a131d.css} +2 -2
  42. package/dist/Overlay/Overlay-f81a131d.css.map +1 -0
  43. package/dist/Overlay/Overlay.d.ts.map +1 -1
  44. package/dist/Overlay/Overlay.js +35 -22
  45. package/dist/Overlay/Overlay.module.css.js +1 -1
  46. package/dist/SelectPanel/SelectPanel.d.ts +2 -2
  47. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  48. package/dist/SelectPanel/SelectPanel.js +2 -0
  49. package/dist/Timeline/Timeline-4d67684a.css +2 -0
  50. package/dist/Timeline/Timeline-4d67684a.css.map +1 -0
  51. package/dist/Timeline/Timeline.d.ts +1 -1
  52. package/dist/Timeline/Timeline.d.ts.map +1 -1
  53. package/dist/Timeline/Timeline.js +27 -14
  54. package/dist/Timeline/Timeline.module.css.js +1 -1
  55. package/dist/TooltipV2/{Tooltip-fcb90d9c.css → Tooltip-dd983e5b.css} +2 -2
  56. package/dist/TooltipV2/Tooltip-dd983e5b.css.map +1 -0
  57. package/dist/TooltipV2/Tooltip.d.ts +1 -1
  58. package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
  59. package/dist/TooltipV2/Tooltip.js +17 -11
  60. package/dist/TooltipV2/Tooltip.module.css.js +2 -2
  61. package/dist/hooks/index.d.ts +1 -0
  62. package/dist/hooks/index.d.ts.map +1 -1
  63. package/dist/hooks/useMergedRefs.d.ts +51 -0
  64. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  65. package/dist/hooks/useMergedRefs.js +86 -0
  66. package/dist/hooks/useProvidedRefOrCreate.d.ts +12 -0
  67. package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
  68. package/dist/hooks/useProvidedRefOrCreate.js +12 -0
  69. package/dist/hooks/useRefObjectAsForwardedRef.d.ts +12 -0
  70. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  71. package/dist/hooks/useRefObjectAsForwardedRef.js +12 -0
  72. package/dist/index.d.ts +1 -3
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +1 -2
  75. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts.map +1 -1
  76. package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +17 -8
  77. package/generated/components.json +20 -6
  78. package/generated/hooks.json +22 -0
  79. package/package.json +8 -7
  80. package/dist/ActionMenu/ActionMenu-53493541.css.map +0 -1
  81. package/dist/Button/ButtonBase-6659abcf.css.map +0 -1
  82. package/dist/Dialog/Dialog-2de477b3.css.map +0 -1
  83. package/dist/FilteredActionList/FilteredActionList-02db90c6.css +0 -2
  84. package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +0 -1
  85. package/dist/IndexTable/IndexTable-5e45cbdd.css +0 -2
  86. package/dist/IndexTable/IndexTable-5e45cbdd.css.map +0 -1
  87. package/dist/IndexTable/IndexTable.d.ts +0 -166
  88. package/dist/IndexTable/IndexTable.d.ts.map +0 -1
  89. package/dist/IndexTable/IndexTable.js +0 -1693
  90. package/dist/IndexTable/IndexTable.module.css.js +0 -5
  91. package/dist/IndexTable/IndexTableContext.d.ts +0 -21
  92. package/dist/IndexTable/IndexTableContext.d.ts.map +0 -1
  93. package/dist/IndexTable/IndexTableContext.js +0 -16
  94. package/dist/IndexTable/index.d.ts +0 -33
  95. package/dist/IndexTable/index.d.ts.map +0 -1
  96. package/dist/IndexTable/index.js +0 -34
  97. package/dist/IndexTable/useSelection.d.ts +0 -32
  98. package/dist/IndexTable/useSelection.d.ts.map +0 -1
  99. package/dist/IndexTable/useSelection.js +0 -151
  100. package/dist/Link/Link-968346ff.css.map +0 -1
  101. package/dist/Overlay/Overlay-2e0ce8db.css.map +0 -1
  102. package/dist/Timeline/Timeline-19bef8c5.css +0 -2
  103. package/dist/Timeline/Timeline-19bef8c5.css.map +0 -1
  104. package/dist/TooltipV2/Tooltip-fcb90d9c.css.map +0 -1
  105. package/dist/internal/hooks/useMergedRefs.d.ts +0 -2
  106. package/dist/internal/hooks/useMergedRefs.d.ts.map +0 -1
  107. package/dist/internal/hooks/useMergedRefs.js +0 -16
@@ -1,1693 +0,0 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { ChevronRightIcon } from '@primer/octicons-react';
3
- import { clsx } from 'clsx';
4
- import React, { useState, useRef, useContext, createContext } from 'react';
5
- import VisuallyHidden from '../_VisuallyHidden.js';
6
- import { Table, TableRow, TableCell, TableSortHeader, TableHeader, TableBody, TableHead } from '../DataTable/Table.js';
7
- export { TableActions as IndexTableActions, TableContainer as IndexTableContainer, TableDivider as IndexTableDivider, TableSubtitle as IndexTableSubtitle, TableTitle as IndexTableTitle } from '../DataTable/Table.js';
8
- import { useIndexTableContext, IndexTableContext } from './IndexTableContext.js';
9
- import { useSelection } from './useSelection.js';
10
- import classes from './IndexTable.module.css.js';
11
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
- import { Tooltip } from '../TooltipV2/Tooltip.js';
13
- import Checkbox from '../Checkbox/Checkbox.js';
14
- import Avatar from '../Avatar/Avatar.js';
15
- import { SkeletonText } from '../SkeletonText/SkeletonText.js';
16
- import AvatarStack from '../AvatarStack/AvatarStack.js';
17
-
18
- const IndexTableTreeContext = /*#__PURE__*/createContext({
19
- isExpanded: () => false,
20
- toggle: () => {},
21
- registerDefault: () => {}
22
- });
23
- const TreeRowContext = /*#__PURE__*/createContext(null);
24
- const TreeDepthContext = /*#__PURE__*/createContext(0);
25
-
26
- // ----------------------------------------------------------------------------
27
- // IndexTable
28
- // ----------------------------------------------------------------------------
29
-
30
- const emptyRowIds = [];
31
- const IndexTableRoot = /*#__PURE__*/React.forwardRef(function IndexTableRoot(t0, ref) {
32
- var _onSelectionChange, _renderRowActions, _columnVisibility, _onColumnVisibilityCh;
33
- const $ = c(44);
34
- let children;
35
- let columnVisibility;
36
- let onColumnVisibilityChange;
37
- let onSelectionChange;
38
- let renderRowActions;
39
- let selectedRowIds;
40
- let t1;
41
- let t2;
42
- let t3;
43
- let t4;
44
- let tableProps;
45
- if ($[0] !== t0) {
46
- ({
47
- selectable: t1,
48
- selectedRowIds,
49
- onSelectionChange,
50
- rowIds: t2,
51
- loading: t3,
52
- renderRowActions,
53
- columnVisibility,
54
- onColumnVisibilityChange,
55
- animated: t4,
56
- children,
57
- ...tableProps
58
- } = t0);
59
- $[0] = t0;
60
- $[1] = children;
61
- $[2] = columnVisibility;
62
- $[3] = onColumnVisibilityChange;
63
- $[4] = onSelectionChange;
64
- $[5] = renderRowActions;
65
- $[6] = selectedRowIds;
66
- $[7] = t1;
67
- $[8] = t2;
68
- $[9] = t3;
69
- $[10] = t4;
70
- $[11] = tableProps;
71
- } else {
72
- children = $[1];
73
- columnVisibility = $[2];
74
- onColumnVisibilityChange = $[3];
75
- onSelectionChange = $[4];
76
- renderRowActions = $[5];
77
- selectedRowIds = $[6];
78
- t1 = $[7];
79
- t2 = $[8];
80
- t3 = $[9];
81
- t4 = $[10];
82
- tableProps = $[11];
83
- }
84
- const selectable = t1 === undefined ? false : t1;
85
- const rowIds = t2 === undefined ? emptyRowIds : t2;
86
- const loading = t3 === undefined ? false : t3;
87
- const animated = t4 === undefined ? false : t4;
88
- let t5;
89
- if ($[12] !== selectedRowIds) {
90
- var _selectedRowIds;
91
- t5 = (_selectedRowIds = selectedRowIds) !== null && _selectedRowIds !== void 0 ? _selectedRowIds : new Set();
92
- $[12] = selectedRowIds;
93
- $[13] = t5;
94
- } else {
95
- t5 = $[13];
96
- }
97
- const t6 = (_onSelectionChange = onSelectionChange) !== null && _onSelectionChange !== void 0 ? _onSelectionChange : _temp;
98
- let t7;
99
- if ($[14] !== rowIds || $[15] !== t5 || $[16] !== t6) {
100
- t7 = {
101
- selectedRowIds: t5,
102
- onSelectionChange: t6,
103
- rowIds
104
- };
105
- $[14] = rowIds;
106
- $[15] = t5;
107
- $[16] = t6;
108
- $[17] = t7;
109
- } else {
110
- t7 = $[17];
111
- }
112
- const selection = useSelection(t7);
113
- const t8 = selectable ? selection : null;
114
- const t9 = (_renderRowActions = renderRowActions) !== null && _renderRowActions !== void 0 ? _renderRowActions : null;
115
- const t10 = (_columnVisibility = columnVisibility) !== null && _columnVisibility !== void 0 ? _columnVisibility : null;
116
- const t11 = (_onColumnVisibilityCh = onColumnVisibilityChange) !== null && _onColumnVisibilityCh !== void 0 ? _onColumnVisibilityCh : null;
117
- let t12;
118
- if ($[18] !== animated || $[19] !== loading || $[20] !== selectable || $[21] !== t10 || $[22] !== t11 || $[23] !== t8 || $[24] !== t9) {
119
- t12 = {
120
- selectable,
121
- selection: t8,
122
- loading,
123
- renderRowActions: t9,
124
- columnVisibility: t10,
125
- onColumnVisibilityChange: t11,
126
- animated
127
- };
128
- $[18] = animated;
129
- $[19] = loading;
130
- $[20] = selectable;
131
- $[21] = t10;
132
- $[22] = t11;
133
- $[23] = t8;
134
- $[24] = t9;
135
- $[25] = t12;
136
- } else {
137
- t12 = $[25];
138
- }
139
- const contextValue = t12;
140
- let t13;
141
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
142
- t13 = {};
143
- $[26] = t13;
144
- } else {
145
- t13 = $[26];
146
- }
147
- const [expandedRows, setExpandedRows] = useState(t13);
148
- let t14;
149
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
150
- t14 = {};
151
- $[27] = t14;
152
- } else {
153
- t14 = $[27];
154
- }
155
- const defaultsRef = useRef(t14);
156
- let t15;
157
- if ($[28] !== expandedRows) {
158
- t15 = id => {
159
- var _defaultsRef$current$;
160
- if (id in expandedRows) {
161
- var _expandedRows$id;
162
- return (_expandedRows$id = expandedRows[id]) !== null && _expandedRows$id !== void 0 ? _expandedRows$id : false;
163
- }
164
- return (_defaultsRef$current$ = defaultsRef.current[id]) !== null && _defaultsRef$current$ !== void 0 ? _defaultsRef$current$ : false;
165
- };
166
- $[28] = expandedRows;
167
- $[29] = t15;
168
- } else {
169
- t15 = $[29];
170
- }
171
- let t16;
172
- let t17;
173
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
174
- t16 = id_0 => {
175
- setExpandedRows(prev => {
176
- var _ref, _prev$id_;
177
- return {
178
- ...prev,
179
- [id_0]: !((_ref = (_prev$id_ = prev[id_0]) !== null && _prev$id_ !== void 0 ? _prev$id_ : defaultsRef.current[id_0]) !== null && _ref !== void 0 ? _ref : false)
180
- };
181
- });
182
- };
183
- t17 = (id_1, defaultExpanded) => {
184
- defaultsRef.current[id_1] = defaultExpanded;
185
- };
186
- $[30] = t16;
187
- $[31] = t17;
188
- } else {
189
- t16 = $[30];
190
- t17 = $[31];
191
- }
192
- let t18;
193
- if ($[32] !== t15) {
194
- t18 = {
195
- isExpanded: t15,
196
- toggle: t16,
197
- registerDefault: t17
198
- };
199
- $[32] = t15;
200
- $[33] = t18;
201
- } else {
202
- t18 = $[33];
203
- }
204
- const treeContextValue = t18;
205
- let t19;
206
- if ($[34] !== children || $[35] !== ref || $[36] !== tableProps) {
207
- t19 = /*#__PURE__*/jsx(Table, {
208
- ...tableProps,
209
- ref: ref,
210
- children: children
211
- });
212
- $[34] = children;
213
- $[35] = ref;
214
- $[36] = tableProps;
215
- $[37] = t19;
216
- } else {
217
- t19 = $[37];
218
- }
219
- let t20;
220
- if ($[38] !== t19 || $[39] !== treeContextValue) {
221
- t20 = /*#__PURE__*/jsx(IndexTableTreeContext.Provider, {
222
- value: treeContextValue,
223
- children: t19
224
- });
225
- $[38] = t19;
226
- $[39] = treeContextValue;
227
- $[40] = t20;
228
- } else {
229
- t20 = $[40];
230
- }
231
- let t21;
232
- if ($[41] !== contextValue || $[42] !== t20) {
233
- t21 = /*#__PURE__*/jsx(IndexTableContext.Provider, {
234
- value: contextValue,
235
- children: t20
236
- });
237
- $[41] = contextValue;
238
- $[42] = t20;
239
- $[43] = t21;
240
- } else {
241
- t21 = $[43];
242
- }
243
- return t21;
244
- });
245
-
246
- // ----------------------------------------------------------------------------
247
- // IndexTableHead
248
- // ----------------------------------------------------------------------------
249
-
250
- function IndexTableHead(t0) {
251
- const $ = c(6);
252
- let children;
253
- let rest;
254
- if ($[0] !== t0) {
255
- ({
256
- children,
257
- ...rest
258
- } = t0);
259
- $[0] = t0;
260
- $[1] = children;
261
- $[2] = rest;
262
- } else {
263
- children = $[1];
264
- rest = $[2];
265
- }
266
- let t1;
267
- if ($[3] !== children || $[4] !== rest) {
268
- t1 = /*#__PURE__*/jsx(TableHead, {
269
- ...rest,
270
- children: children
271
- });
272
- $[3] = children;
273
- $[4] = rest;
274
- $[5] = t1;
275
- } else {
276
- t1 = $[5];
277
- }
278
- return t1;
279
- }
280
-
281
- // ----------------------------------------------------------------------------
282
- // IndexTableBody
283
- // ----------------------------------------------------------------------------
284
-
285
- function IndexTableBody(t0) {
286
- const $ = c(6);
287
- let children;
288
- let rest;
289
- if ($[0] !== t0) {
290
- ({
291
- children,
292
- ...rest
293
- } = t0);
294
- $[0] = t0;
295
- $[1] = children;
296
- $[2] = rest;
297
- } else {
298
- children = $[1];
299
- rest = $[2];
300
- }
301
- let t1;
302
- if ($[3] !== children || $[4] !== rest) {
303
- t1 = /*#__PURE__*/jsx(TableBody, {
304
- ...rest,
305
- children: children
306
- });
307
- $[3] = children;
308
- $[4] = rest;
309
- $[5] = t1;
310
- } else {
311
- t1 = $[5];
312
- }
313
- return t1;
314
- }
315
-
316
- // ----------------------------------------------------------------------------
317
- // IndexTableRow
318
- // ----------------------------------------------------------------------------
319
-
320
- function IndexTableRowInner(t0) {
321
- const $ = c(25);
322
- const {
323
- id,
324
- href,
325
- children,
326
- ...rest
327
- } = t0;
328
- const {
329
- selectable,
330
- selection,
331
- renderRowActions
332
- } = useIndexTableContext();
333
- const isSelected = id ? selection === null || selection === void 0 ? void 0 : selection.isSelected(id) : false;
334
- const depth = useContext(TreeDepthContext);
335
- let t1;
336
- if ($[0] !== href) {
337
- t1 = event => {
338
- if (!href) {
339
- return;
340
- }
341
- if (event.defaultPrevented || event.button !== 0) {
342
- return;
343
- }
344
- const target = event.target;
345
- if (target instanceof Element) {
346
- const interactive = target.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"link\"], [tabindex]:not([tabindex=\"-1\"])");
347
- if (interactive && event.currentTarget.contains(interactive)) {
348
- return;
349
- }
350
- }
351
- const sel = window.getSelection();
352
- if (sel && !sel.isCollapsed && sel.toString().trim().length > 0) {
353
- return;
354
- }
355
- window.location.href = href;
356
- };
357
- $[0] = href;
358
- $[1] = t1;
359
- } else {
360
- t1 = $[1];
361
- }
362
- const handleRowClick = t1;
363
- let t2;
364
- if ($[2] !== href) {
365
- t2 = event_0 => {
366
- if (!href || event_0.button !== 1) {
367
- return;
368
- }
369
- const target_0 = event_0.target;
370
- if (target_0 instanceof Element) {
371
- const interactive_0 = target_0.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"link\"]");
372
- if (interactive_0 && event_0.currentTarget.contains(interactive_0)) {
373
- return;
374
- }
375
- }
376
- window.open(href, "_blank", "noopener");
377
- };
378
- $[2] = href;
379
- $[3] = t2;
380
- } else {
381
- t2 = $[3];
382
- }
383
- const handleAuxClick = t2;
384
- let t3;
385
- if ($[4] !== children || $[5] !== depth) {
386
- t3 = depth > 0 ? React.Children.map(children, _temp2) : children;
387
- $[4] = children;
388
- $[5] = depth;
389
- $[6] = t3;
390
- } else {
391
- t3 = $[6];
392
- }
393
- const processedChildren = t3;
394
- const T0 = TableRow;
395
- const t4 = isSelected || undefined;
396
- const t5 = clsx(rest.className, isSelected && classes.IndexTableRowSelected, href && classes.IndexTableRowLinked);
397
- const t6 = href ? handleRowClick : rest.onClick;
398
- const t7 = href ? handleAuxClick : undefined;
399
- let t8;
400
- if ($[7] !== id || $[8] !== isSelected || $[9] !== selectable || $[10] !== selection) {
401
- t8 = selectable && id ? /*#__PURE__*/jsx(TableCell, {
402
- className: classes.IndexTableCheckboxCell,
403
- children: /*#__PURE__*/jsx(Checkbox, {
404
- value: id,
405
- checked: isSelected,
406
- onChange: () => selection === null || selection === void 0 ? void 0 : selection.toggleRow(id),
407
- "aria-label": `Select row ${id}`
408
- })
409
- }) : null;
410
- $[7] = id;
411
- $[8] = isSelected;
412
- $[9] = selectable;
413
- $[10] = selection;
414
- $[11] = t8;
415
- } else {
416
- t8 = $[11];
417
- }
418
- let t9;
419
- if ($[12] !== id || $[13] !== renderRowActions) {
420
- t9 = renderRowActions && id ? /*#__PURE__*/jsx(IndexTableRowActions, {
421
- children: renderRowActions(id)
422
- }) : null;
423
- $[12] = id;
424
- $[13] = renderRowActions;
425
- $[14] = t9;
426
- } else {
427
- t9 = $[14];
428
- }
429
- let t10;
430
- if ($[15] !== T0 || $[16] !== processedChildren || $[17] !== rest || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7 || $[22] !== t8 || $[23] !== t9) {
431
- t10 = /*#__PURE__*/jsxs(T0, {
432
- ...rest,
433
- "data-selected": t4,
434
- className: t5,
435
- onClick: t6,
436
- onAuxClick: t7,
437
- children: [t8, processedChildren, t9]
438
- });
439
- $[15] = T0;
440
- $[16] = processedChildren;
441
- $[17] = rest;
442
- $[18] = t4;
443
- $[19] = t5;
444
- $[20] = t6;
445
- $[21] = t7;
446
- $[22] = t8;
447
- $[23] = t9;
448
- $[24] = t10;
449
- } else {
450
- t10 = $[24];
451
- }
452
- return t10;
453
- }
454
- function _temp2(child, index) {
455
- if (index === 0 && /*#__PURE__*/React.isValidElement(child)) {
456
- return /*#__PURE__*/React.cloneElement(child, {
457
- className: clsx(child.props.className, classes.IndexTableTreeIndentedCell)
458
- });
459
- }
460
- return child;
461
- }
462
- const IndexTableRow = /*#__PURE__*/React.memo(IndexTableRowInner);
463
- IndexTableRow.displayName = 'IndexTableRow';
464
-
465
- // ----------------------------------------------------------------------------
466
- // IndexTableHeaderRow — header-specific row with "select all" checkbox
467
- // ----------------------------------------------------------------------------
468
-
469
- function IndexTableHeaderRow(t0) {
470
- const $ = c(13);
471
- let children;
472
- let rest;
473
- if ($[0] !== t0) {
474
- ({
475
- children,
476
- ...rest
477
- } = t0);
478
- $[0] = t0;
479
- $[1] = children;
480
- $[2] = rest;
481
- } else {
482
- children = $[1];
483
- rest = $[2];
484
- }
485
- const {
486
- selectable,
487
- selection,
488
- renderRowActions
489
- } = useIndexTableContext();
490
- let t1;
491
- if ($[3] !== selectable || $[4] !== selection) {
492
- var _selection$allSelecte, _selection$someSelect;
493
- t1 = selectable ? /*#__PURE__*/jsx(TableHeader, {
494
- className: classes.IndexTableCheckboxCell,
495
- children: /*#__PURE__*/jsx(Checkbox, {
496
- checked: (_selection$allSelecte = selection === null || selection === void 0 ? void 0 : selection.allSelected) !== null && _selection$allSelecte !== void 0 ? _selection$allSelecte : false,
497
- indeterminate: (_selection$someSelect = selection === null || selection === void 0 ? void 0 : selection.someSelected) !== null && _selection$someSelect !== void 0 ? _selection$someSelect : false,
498
- onChange: () => selection === null || selection === void 0 ? void 0 : selection.toggleAll(),
499
- "aria-label": "Select all rows"
500
- })
501
- }) : null;
502
- $[3] = selectable;
503
- $[4] = selection;
504
- $[5] = t1;
505
- } else {
506
- t1 = $[5];
507
- }
508
- let t2;
509
- if ($[6] !== renderRowActions) {
510
- t2 = renderRowActions ? /*#__PURE__*/jsx(TableHeader, {
511
- className: classes.IndexTableRowActionsHeaderCell,
512
- children: /*#__PURE__*/jsx(VisuallyHidden, {
513
- children: "Actions"
514
- })
515
- }) : null;
516
- $[6] = renderRowActions;
517
- $[7] = t2;
518
- } else {
519
- t2 = $[7];
520
- }
521
- let t3;
522
- if ($[8] !== children || $[9] !== rest || $[10] !== t1 || $[11] !== t2) {
523
- t3 = /*#__PURE__*/jsxs(TableRow, {
524
- ...rest,
525
- children: [t1, children, t2]
526
- });
527
- $[8] = children;
528
- $[9] = rest;
529
- $[10] = t1;
530
- $[11] = t2;
531
- $[12] = t3;
532
- } else {
533
- t3 = $[12];
534
- }
535
- return t3;
536
- }
537
-
538
- // ----------------------------------------------------------------------------
539
- // IndexTableHeader
540
- // ----------------------------------------------------------------------------
541
-
542
- function IndexTableHeader(props) {
543
- const $ = c(2);
544
- let t0;
545
- if ($[0] !== props) {
546
- t0 = /*#__PURE__*/jsx(TableHeader, {
547
- ...props
548
- });
549
- $[0] = props;
550
- $[1] = t0;
551
- } else {
552
- t0 = $[1];
553
- }
554
- return t0;
555
- }
556
-
557
- // ----------------------------------------------------------------------------
558
- // IndexTableSortHeader
559
- // ----------------------------------------------------------------------------
560
-
561
- function IndexTableSortHeader(t0) {
562
- const $ = c(8);
563
- let direction;
564
- let onToggleSort;
565
- let rest;
566
- if ($[0] !== t0) {
567
- ({
568
- direction,
569
- onToggleSort,
570
- ...rest
571
- } = t0);
572
- $[0] = t0;
573
- $[1] = direction;
574
- $[2] = onToggleSort;
575
- $[3] = rest;
576
- } else {
577
- direction = $[1];
578
- onToggleSort = $[2];
579
- rest = $[3];
580
- }
581
- let t1;
582
- if ($[4] !== direction || $[5] !== onToggleSort || $[6] !== rest) {
583
- t1 = /*#__PURE__*/jsx(TableSortHeader, {
584
- ...rest,
585
- direction: direction,
586
- onToggleSort: onToggleSort
587
- });
588
- $[4] = direction;
589
- $[5] = onToggleSort;
590
- $[6] = rest;
591
- $[7] = t1;
592
- } else {
593
- t1 = $[7];
594
- }
595
- return t1;
596
- }
597
-
598
- // ----------------------------------------------------------------------------
599
- // IndexTableCell
600
- // ----------------------------------------------------------------------------
601
-
602
- function IndexTableCell(props) {
603
- const $ = c(2);
604
- let t0;
605
- if ($[0] !== props) {
606
- t0 = /*#__PURE__*/jsx(TableCell, {
607
- ...props
608
- });
609
- $[0] = props;
610
- $[1] = t0;
611
- } else {
612
- t0 = $[1];
613
- }
614
- return t0;
615
- }
616
-
617
- // ----------------------------------------------------------------------------
618
- // BulkActions — visible only when items are selected
619
- // ----------------------------------------------------------------------------
620
-
621
- function IndexTableBulkActions(t0) {
622
- var _selection$selectedCo;
623
- const $ = c(29);
624
- const {
625
- children,
626
- actions
627
- } = t0;
628
- const {
629
- selection
630
- } = useIndexTableContext();
631
- const count = (_selection$selectedCo = selection === null || selection === void 0 ? void 0 : selection.selectedCount) !== null && _selection$selectedCo !== void 0 ? _selection$selectedCo : 0;
632
- if (count === 0) {
633
- return null;
634
- }
635
- let t1;
636
- if ($[0] !== (selection === null || selection === void 0 ? void 0 : selection.selectedRowIds)) {
637
- var _selection$selectedRo;
638
- t1 = (_selection$selectedRo = selection === null || selection === void 0 ? void 0 : selection.selectedRowIds) !== null && _selection$selectedRo !== void 0 ? _selection$selectedRo : new Set();
639
- $[0] = selection === null || selection === void 0 ? void 0 : selection.selectedRowIds;
640
- $[1] = t1;
641
- } else {
642
- t1 = $[1];
643
- }
644
- const selectedIds = t1;
645
- let t2;
646
- let t3;
647
- let t4;
648
- let t5;
649
- let t6;
650
- let t7;
651
- let t8;
652
- let t9;
653
- if ($[2] !== actions || $[3] !== children || $[4] !== count || $[5] !== selectedIds) {
654
- var _actions$filter$slice, _actions$filter;
655
- const promotedActions = (_actions$filter$slice = actions === null || actions === void 0 ? void 0 : actions.filter(_temp3).slice(0, 2)) !== null && _actions$filter$slice !== void 0 ? _actions$filter$slice : [];
656
- const overflowActions = (_actions$filter = actions === null || actions === void 0 ? void 0 : actions.filter(a_0 => !promotedActions.includes(a_0))) !== null && _actions$filter !== void 0 ? _actions$filter : [];
657
- t6 = classes.IndexTableBulkActions;
658
- t7 = "toolbar";
659
- t8 = `Bulk actions, ${count} items selected`;
660
- if ($[14] !== count) {
661
- t9 = /*#__PURE__*/jsxs("span", {
662
- className: classes.IndexTableBulkActionsCount,
663
- children: [count, " selected"]
664
- });
665
- $[14] = count;
666
- $[15] = t9;
667
- } else {
668
- t9 = $[15];
669
- }
670
- t2 = classes.IndexTableBulkActionsItems;
671
- t3 = children;
672
- let t10;
673
- if ($[16] !== selectedIds) {
674
- t10 = action => /*#__PURE__*/jsx("button", {
675
- type: "button",
676
- className: clsx(classes.IndexTableBulkActionButton, action.variant === "danger" && classes.IndexTableBulkActionButtonDanger),
677
- onClick: () => action.onAction(selectedIds),
678
- children: action.label
679
- }, action.key);
680
- $[16] = selectedIds;
681
- $[17] = t10;
682
- } else {
683
- t10 = $[17];
684
- }
685
- t4 = promotedActions.map(t10);
686
- t5 = overflowActions.length > 0 && /*#__PURE__*/jsxs("details", {
687
- className: classes.IndexTableBulkActionsOverflow,
688
- children: [/*#__PURE__*/jsx("summary", {
689
- className: classes.IndexTableBulkActionsOverflowTrigger,
690
- "aria-label": "More actions",
691
- children: "\u2026"
692
- }), /*#__PURE__*/jsx("div", {
693
- className: classes.IndexTableBulkActionsOverflowMenu,
694
- children: overflowActions.map(action_0 => /*#__PURE__*/jsx("button", {
695
- type: "button",
696
- className: clsx(classes.IndexTableBulkActionsOverflowItem, action_0.variant === "danger" && classes.IndexTableBulkActionButtonDanger),
697
- onClick: () => action_0.onAction(selectedIds),
698
- children: action_0.label
699
- }, action_0.key))
700
- })]
701
- });
702
- $[2] = actions;
703
- $[3] = children;
704
- $[4] = count;
705
- $[5] = selectedIds;
706
- $[6] = t2;
707
- $[7] = t3;
708
- $[8] = t4;
709
- $[9] = t5;
710
- $[10] = t6;
711
- $[11] = t7;
712
- $[12] = t8;
713
- $[13] = t9;
714
- } else {
715
- t2 = $[6];
716
- t3 = $[7];
717
- t4 = $[8];
718
- t5 = $[9];
719
- t6 = $[10];
720
- t7 = $[11];
721
- t8 = $[12];
722
- t9 = $[13];
723
- }
724
- let t10;
725
- if ($[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5) {
726
- t10 = /*#__PURE__*/jsxs("div", {
727
- className: t2,
728
- children: [t3, t4, t5]
729
- });
730
- $[18] = t2;
731
- $[19] = t3;
732
- $[20] = t4;
733
- $[21] = t5;
734
- $[22] = t10;
735
- } else {
736
- t10 = $[22];
737
- }
738
- let t11;
739
- if ($[23] !== t10 || $[24] !== t6 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
740
- t11 = /*#__PURE__*/jsxs("div", {
741
- className: t6,
742
- role: t7,
743
- "aria-label": t8,
744
- children: [t9, t10]
745
- });
746
- $[23] = t10;
747
- $[24] = t6;
748
- $[25] = t7;
749
- $[26] = t8;
750
- $[27] = t9;
751
- $[28] = t11;
752
- } else {
753
- t11 = $[28];
754
- }
755
- return t11;
756
- }
757
-
758
- // ----------------------------------------------------------------------------
759
- // IndexTableTreeRow — expandable category/group row
760
- // ----------------------------------------------------------------------------
761
- function _temp3(a) {
762
- return a.promoted;
763
- }
764
- function IndexTableTreeRowInner(t0) {
765
- const $ = c(26);
766
- const {
767
- id,
768
- childRowIds,
769
- defaultExpanded: t1,
770
- children,
771
- ...rest
772
- } = t0;
773
- const defaultExpanded = t1 === undefined ? false : t1;
774
- const {
775
- selectable,
776
- selection,
777
- renderRowActions
778
- } = useIndexTableContext();
779
- const tree = useContext(IndexTableTreeContext);
780
- tree.registerDefault(id, defaultExpanded);
781
- let t2;
782
- if ($[0] !== id || $[1] !== tree) {
783
- t2 = tree.isExpanded(id);
784
- $[0] = id;
785
- $[1] = tree;
786
- $[2] = t2;
787
- } else {
788
- t2 = $[2];
789
- }
790
- const expanded = t2;
791
- const allChildrenSelected = selectable ? childRowIds.length > 0 && childRowIds.every(cid => selection === null || selection === void 0 ? void 0 : selection.isSelected(cid)) : false;
792
- const someChildrenSelected = selectable ? !allChildrenSelected && childRowIds.some(cid_0 => selection === null || selection === void 0 ? void 0 : selection.isSelected(cid_0)) : false;
793
- const handleToggleChildren = () => {
794
- if (!selection) {
795
- return;
796
- }
797
- if (allChildrenSelected) {
798
- selection.deselectRows(childRowIds);
799
- } else {
800
- selection.selectRows(childRowIds);
801
- }
802
- };
803
- let t3;
804
- if ($[3] !== childRowIds || $[4] !== id) {
805
- t3 = {
806
- id,
807
- childRowIds
808
- };
809
- $[3] = childRowIds;
810
- $[4] = id;
811
- $[5] = t3;
812
- } else {
813
- t3 = $[5];
814
- }
815
- const treeRowContextValue = t3;
816
- const t4 = TreeRowContext;
817
- const T0 = TableRow;
818
- const t5 = expanded || undefined;
819
- const t6 = clsx(rest.className, classes.IndexTableTreeRow, allChildrenSelected && classes.IndexTableRowSelected);
820
- let t7;
821
- if ($[6] !== allChildrenSelected || $[7] !== handleToggleChildren || $[8] !== selectable || $[9] !== someChildrenSelected) {
822
- t7 = selectable ? /*#__PURE__*/jsx(TableCell, {
823
- className: classes.IndexTableCheckboxCell,
824
- children: /*#__PURE__*/jsx(Checkbox, {
825
- checked: allChildrenSelected,
826
- indeterminate: someChildrenSelected,
827
- onChange: handleToggleChildren,
828
- "aria-label": "Select all items in group"
829
- })
830
- }) : null;
831
- $[6] = allChildrenSelected;
832
- $[7] = handleToggleChildren;
833
- $[8] = selectable;
834
- $[9] = someChildrenSelected;
835
- $[10] = t7;
836
- } else {
837
- t7 = $[10];
838
- }
839
- let t8;
840
- if ($[11] !== id || $[12] !== renderRowActions) {
841
- t8 = renderRowActions ? /*#__PURE__*/jsx(TableCell, {
842
- className: classes.IndexTableRowActionsCell,
843
- children: /*#__PURE__*/jsx("div", {
844
- className: classes.IndexTableRowActionsContent,
845
- children: renderRowActions(id)
846
- })
847
- }) : null;
848
- $[11] = id;
849
- $[12] = renderRowActions;
850
- $[13] = t8;
851
- } else {
852
- t8 = $[13];
853
- }
854
- let t9;
855
- if ($[14] !== T0 || $[15] !== children || $[16] !== rest || $[17] !== t5 || $[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
856
- t9 = /*#__PURE__*/jsxs(T0, {
857
- ...rest,
858
- "data-expanded": t5,
859
- className: t6,
860
- children: [t7, children, t8]
861
- });
862
- $[14] = T0;
863
- $[15] = children;
864
- $[16] = rest;
865
- $[17] = t5;
866
- $[18] = t6;
867
- $[19] = t7;
868
- $[20] = t8;
869
- $[21] = t9;
870
- } else {
871
- t9 = $[21];
872
- }
873
- let t10;
874
- if ($[22] !== t4.Provider || $[23] !== t9 || $[24] !== treeRowContextValue) {
875
- t10 = /*#__PURE__*/jsx(t4.Provider, {
876
- value: treeRowContextValue,
877
- children: t9
878
- });
879
- $[22] = t4.Provider;
880
- $[23] = t9;
881
- $[24] = treeRowContextValue;
882
- $[25] = t10;
883
- } else {
884
- t10 = $[25];
885
- }
886
- return t10;
887
- }
888
- const IndexTableTreeRow = /*#__PURE__*/React.memo(IndexTableTreeRowInner);
889
- IndexTableTreeRow.displayName = 'IndexTableTreeRow';
890
-
891
- // ----------------------------------------------------------------------------
892
- // IndexTableTreeSubRows — conditionally renders children when parent is expanded
893
- // ----------------------------------------------------------------------------
894
-
895
- function IndexTableTreeSubRows(t0) {
896
- const $ = c(21);
897
- const {
898
- parentId,
899
- children
900
- } = t0;
901
- const tree = useContext(IndexTableTreeContext);
902
- const {
903
- animated
904
- } = useIndexTableContext();
905
- let T0;
906
- let expanded;
907
- let t1;
908
- let t2;
909
- let t3;
910
- if ($[0] !== animated || $[1] !== children || $[2] !== parentId || $[3] !== tree) {
911
- t3 = Symbol.for("react.early_return_sentinel");
912
- bb0: {
913
- expanded = tree.isExpanded(parentId);
914
- if (!animated) {
915
- if (!expanded) {
916
- t3 = null;
917
- break bb0;
918
- }
919
- let t4;
920
- if ($[9] !== children) {
921
- t4 = /*#__PURE__*/jsx(TreeDepthContext.Provider, {
922
- value: 1,
923
- children: children
924
- });
925
- $[9] = children;
926
- $[10] = t4;
927
- } else {
928
- t4 = $[10];
929
- }
930
- t3 = t4;
931
- break bb0;
932
- }
933
- T0 = TreeDepthContext.Provider;
934
- t2 = 1;
935
- t1 = clsx(classes.IndexTableTreeSubRowsWrapper, expanded && classes.IndexTableTreeSubRowsExpanded);
936
- }
937
- $[0] = animated;
938
- $[1] = children;
939
- $[2] = parentId;
940
- $[3] = tree;
941
- $[4] = T0;
942
- $[5] = expanded;
943
- $[6] = t1;
944
- $[7] = t2;
945
- $[8] = t3;
946
- } else {
947
- T0 = $[4];
948
- expanded = $[5];
949
- t1 = $[6];
950
- t2 = $[7];
951
- t3 = $[8];
952
- }
953
- if (t3 !== Symbol.for("react.early_return_sentinel")) {
954
- return t3;
955
- }
956
- const t4 = !expanded;
957
- let t5;
958
- if ($[11] !== children) {
959
- t5 = /*#__PURE__*/jsx("div", {
960
- className: classes.IndexTableTreeSubRowsInner,
961
- children: children
962
- });
963
- $[11] = children;
964
- $[12] = t5;
965
- } else {
966
- t5 = $[12];
967
- }
968
- let t6;
969
- if ($[13] !== t1 || $[14] !== t4 || $[15] !== t5) {
970
- t6 = /*#__PURE__*/jsx("div", {
971
- className: t1,
972
- "aria-hidden": t4,
973
- children: t5
974
- });
975
- $[13] = t1;
976
- $[14] = t4;
977
- $[15] = t5;
978
- $[16] = t6;
979
- } else {
980
- t6 = $[16];
981
- }
982
- let t7;
983
- if ($[17] !== T0 || $[18] !== t2 || $[19] !== t6) {
984
- t7 = /*#__PURE__*/jsx(T0, {
985
- value: t2,
986
- children: t6
987
- });
988
- $[17] = T0;
989
- $[18] = t2;
990
- $[19] = t6;
991
- $[20] = t7;
992
- } else {
993
- t7 = $[20];
994
- }
995
- return t7;
996
- }
997
-
998
- // ----------------------------------------------------------------------------
999
- // IndexTableTreeToggle — chevron toggle placed by consumer inside TreeRow cells
1000
- // ----------------------------------------------------------------------------
1001
-
1002
- function IndexTableTreeToggle(props) {
1003
- const $ = c(20);
1004
- const treeRow = useContext(TreeRowContext);
1005
- const tree = useContext(IndexTableTreeContext);
1006
- const {
1007
- animated
1008
- } = useIndexTableContext();
1009
- if (!treeRow) {
1010
- throw new Error("IndexTable.TreeToggle must be used inside an IndexTable.TreeRow");
1011
- }
1012
- let expanded;
1013
- let t0;
1014
- let t1;
1015
- let t2;
1016
- if ($[0] !== animated || $[1] !== props || $[2] !== tree || $[3] !== treeRow.id) {
1017
- expanded = tree.isExpanded(treeRow.id);
1018
- t0 = props;
1019
- t1 = "button";
1020
- t2 = clsx(classes.IndexTableTreeToggleButton, animated && classes.IndexTableTreeToggleAnimated, expanded && classes.IndexTableTreeToggleExpanded, props.className);
1021
- $[0] = animated;
1022
- $[1] = props;
1023
- $[2] = tree;
1024
- $[3] = treeRow.id;
1025
- $[4] = expanded;
1026
- $[5] = t0;
1027
- $[6] = t1;
1028
- $[7] = t2;
1029
- } else {
1030
- expanded = $[4];
1031
- t0 = $[5];
1032
- t1 = $[6];
1033
- t2 = $[7];
1034
- }
1035
- let t3;
1036
- if ($[8] !== props || $[9] !== tree || $[10] !== treeRow.id) {
1037
- t3 = e => {
1038
- var _props$onClick;
1039
- tree.toggle(treeRow.id);
1040
- (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, e);
1041
- };
1042
- $[8] = props;
1043
- $[9] = tree;
1044
- $[10] = treeRow.id;
1045
- $[11] = t3;
1046
- } else {
1047
- t3 = $[11];
1048
- }
1049
- const t4 = expanded ? "Collapse group" : "Expand group";
1050
- let t5;
1051
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1052
- t5 = /*#__PURE__*/jsx(ChevronRightIcon, {
1053
- size: 16
1054
- });
1055
- $[12] = t5;
1056
- } else {
1057
- t5 = $[12];
1058
- }
1059
- let t6;
1060
- if ($[13] !== expanded || $[14] !== t0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
1061
- t6 = /*#__PURE__*/jsx("button", {
1062
- ...t0,
1063
- type: t1,
1064
- className: t2,
1065
- onClick: t3,
1066
- "aria-expanded": expanded,
1067
- "aria-label": t4,
1068
- children: t5
1069
- });
1070
- $[13] = expanded;
1071
- $[14] = t0;
1072
- $[15] = t1;
1073
- $[16] = t2;
1074
- $[17] = t3;
1075
- $[18] = t4;
1076
- $[19] = t6;
1077
- } else {
1078
- t6 = $[19];
1079
- }
1080
- return t6;
1081
- }
1082
-
1083
- // Convenience function to get selection in consumer code
1084
- function useIndexTableSelection() {
1085
- const {
1086
- selection
1087
- } = useIndexTableContext();
1088
- if (!selection) {
1089
- throw new Error("useIndexTableSelection must be used within a selectable IndexTable");
1090
- }
1091
- return selection;
1092
- }
1093
-
1094
- // ----------------------------------------------------------------------------
1095
- // IndexTableLoadingRows — skeleton rows shown during loading
1096
- // ----------------------------------------------------------------------------
1097
-
1098
- function IndexTableLoadingRows(t0) {
1099
- const $ = c(5);
1100
- const {
1101
- rows: t1,
1102
- columns
1103
- } = t0;
1104
- const rows = t1 === undefined ? 5 : t1;
1105
- const {
1106
- selectable
1107
- } = useIndexTableContext();
1108
- const totalColumns = selectable ? columns + 1 : columns;
1109
- let t2;
1110
- if ($[0] !== rows) {
1111
- t2 = Array.from({
1112
- length: rows
1113
- });
1114
- $[0] = rows;
1115
- $[1] = t2;
1116
- } else {
1117
- t2 = $[1];
1118
- }
1119
- let t3;
1120
- if ($[2] !== t2 || $[3] !== totalColumns) {
1121
- t3 = /*#__PURE__*/jsx(Fragment, {
1122
- children: t2.map((_, rowIndex) => /*#__PURE__*/jsx(TableRow, {
1123
- className: classes.IndexTableSkeletonRow,
1124
- children: Array.from({
1125
- length: totalColumns
1126
- }).map(_temp4)
1127
- }, `skeleton-row-${rowIndex}`))
1128
- });
1129
- $[2] = t2;
1130
- $[3] = totalColumns;
1131
- $[4] = t3;
1132
- } else {
1133
- t3 = $[4];
1134
- }
1135
- return t3;
1136
- }
1137
-
1138
- // ----------------------------------------------------------------------------
1139
- // IndexTableRowActions — sticky cell rendered at the end of a row
1140
- // ----------------------------------------------------------------------------
1141
- function _temp4(__0, colIndex) {
1142
- return /*#__PURE__*/jsxs(TableCell, {
1143
- className: classes.IndexTableSkeletonCell,
1144
- children: [/*#__PURE__*/jsx(VisuallyHidden, {
1145
- children: "Loading"
1146
- }), /*#__PURE__*/jsx(SkeletonText, {})]
1147
- }, `skeleton-cell-${colIndex}`);
1148
- }
1149
- _temp4.displayName = "_temp4";
1150
- function IndexTableRowActions(t0) {
1151
- const $ = c(2);
1152
- const {
1153
- children
1154
- } = t0;
1155
- let t1;
1156
- if ($[0] !== children) {
1157
- t1 = /*#__PURE__*/jsx(TableCell, {
1158
- className: classes.IndexTableRowActionsCell,
1159
- children: /*#__PURE__*/jsx("div", {
1160
- className: classes.IndexTableRowActionsContent,
1161
- children: children
1162
- })
1163
- });
1164
- $[0] = children;
1165
- $[1] = t1;
1166
- } else {
1167
- t1 = $[1];
1168
- }
1169
- return t1;
1170
- }
1171
-
1172
- // ----------------------------------------------------------------------------
1173
- // IndexTableRowLink — wraps first cell content in a navigable link
1174
- // ----------------------------------------------------------------------------
1175
-
1176
- function IndexTableRowLink(t0) {
1177
- const $ = c(4);
1178
- const {
1179
- href,
1180
- "aria-label": ariaLabel,
1181
- children
1182
- } = t0;
1183
- let t1;
1184
- if ($[0] !== ariaLabel || $[1] !== children || $[2] !== href) {
1185
- t1 = /*#__PURE__*/jsx("a", {
1186
- href: href,
1187
- className: classes.IndexTableRowLinkAnchor,
1188
- "data-primary-link": "true",
1189
- "aria-label": ariaLabel,
1190
- children: children
1191
- });
1192
- $[0] = ariaLabel;
1193
- $[1] = children;
1194
- $[2] = href;
1195
- $[3] = t1;
1196
- } else {
1197
- t1 = $[3];
1198
- }
1199
- return t1;
1200
- }
1201
-
1202
- // ----------------------------------------------------------------------------
1203
- // IndexTableColumnVisibility — helper hook for column visibility
1204
- // ----------------------------------------------------------------------------
1205
-
1206
- function useIndexTableColumnVisibility() {
1207
- const $ = c(12);
1208
- const {
1209
- columnVisibility,
1210
- onColumnVisibilityChange
1211
- } = useIndexTableContext();
1212
- let t0;
1213
- if ($[0] !== columnVisibility) {
1214
- t0 = columnId => {
1215
- if (!columnVisibility) {
1216
- return true;
1217
- }
1218
- return columnVisibility[columnId] !== false;
1219
- };
1220
- $[0] = columnVisibility;
1221
- $[1] = t0;
1222
- } else {
1223
- t0 = $[1];
1224
- }
1225
- const isColumnVisible = t0;
1226
- let t1;
1227
- if ($[2] !== columnVisibility || $[3] !== onColumnVisibilityChange) {
1228
- t1 = columnId_0 => {
1229
- if (!onColumnVisibilityChange || !columnVisibility) {
1230
- return;
1231
- }
1232
- onColumnVisibilityChange({
1233
- ...columnVisibility,
1234
- [columnId_0]: columnVisibility[columnId_0] === false
1235
- });
1236
- };
1237
- $[2] = columnVisibility;
1238
- $[3] = onColumnVisibilityChange;
1239
- $[4] = t1;
1240
- } else {
1241
- t1 = $[4];
1242
- }
1243
- const toggleColumn = t1;
1244
- let t2;
1245
- if ($[5] !== columnVisibility || $[6] !== onColumnVisibilityChange) {
1246
- t2 = (columnId_1, visible) => {
1247
- if (!onColumnVisibilityChange) {
1248
- return;
1249
- }
1250
- onColumnVisibilityChange({
1251
- ...(columnVisibility !== null && columnVisibility !== void 0 ? columnVisibility : {}),
1252
- [columnId_1]: visible
1253
- });
1254
- };
1255
- $[5] = columnVisibility;
1256
- $[6] = onColumnVisibilityChange;
1257
- $[7] = t2;
1258
- } else {
1259
- t2 = $[7];
1260
- }
1261
- const setColumnVisible = t2;
1262
- let t3;
1263
- if ($[8] !== isColumnVisible || $[9] !== setColumnVisible || $[10] !== toggleColumn) {
1264
- t3 = {
1265
- isColumnVisible,
1266
- toggleColumn,
1267
- setColumnVisible
1268
- };
1269
- $[8] = isColumnVisible;
1270
- $[9] = setColumnVisible;
1271
- $[10] = toggleColumn;
1272
- $[11] = t3;
1273
- } else {
1274
- t3 = $[11];
1275
- }
1276
- return t3;
1277
- }
1278
-
1279
- // ----------------------------------------------------------------------------
1280
- // IndexTableColumnVisibilityMenu — dropdown to toggle column visibility
1281
- // ----------------------------------------------------------------------------
1282
-
1283
- function IndexTableColumnVisibilityMenu(t0) {
1284
- const $ = c(21);
1285
- const {
1286
- columns,
1287
- "aria-label": t1,
1288
- children
1289
- } = t0;
1290
- const ariaLabel = t1 === undefined ? "Toggle column visibility" : t1;
1291
- const {
1292
- columnVisibility,
1293
- onColumnVisibilityChange
1294
- } = useIndexTableContext();
1295
- let t2;
1296
- if ($[0] !== columnVisibility) {
1297
- t2 = id => {
1298
- if (!columnVisibility) {
1299
- return true;
1300
- }
1301
- return columnVisibility[id] !== false;
1302
- };
1303
- $[0] = columnVisibility;
1304
- $[1] = t2;
1305
- } else {
1306
- t2 = $[1];
1307
- }
1308
- const isVisible = t2;
1309
- let t3;
1310
- if ($[2] !== columnVisibility || $[3] !== isVisible || $[4] !== onColumnVisibilityChange) {
1311
- t3 = id_0 => {
1312
- if (!onColumnVisibilityChange) {
1313
- return;
1314
- }
1315
- onColumnVisibilityChange({
1316
- ...(columnVisibility !== null && columnVisibility !== void 0 ? columnVisibility : {}),
1317
- [id_0]: !isVisible(id_0)
1318
- });
1319
- };
1320
- $[2] = columnVisibility;
1321
- $[3] = isVisible;
1322
- $[4] = onColumnVisibilityChange;
1323
- $[5] = t3;
1324
- } else {
1325
- t3 = $[5];
1326
- }
1327
- const handleToggle = t3;
1328
- const t4 = children !== null && children !== void 0 ? children : "Columns";
1329
- let t5;
1330
- if ($[6] !== ariaLabel || $[7] !== t4) {
1331
- t5 = /*#__PURE__*/jsx("summary", {
1332
- className: classes.IndexTableColumnVisibilityTrigger,
1333
- "aria-label": ariaLabel,
1334
- children: t4
1335
- });
1336
- $[6] = ariaLabel;
1337
- $[7] = t4;
1338
- $[8] = t5;
1339
- } else {
1340
- t5 = $[8];
1341
- }
1342
- let t6;
1343
- if ($[9] !== columns || $[10] !== handleToggle || $[11] !== isVisible) {
1344
- let t7;
1345
- if ($[13] !== handleToggle || $[14] !== isVisible) {
1346
- t7 = col => /*#__PURE__*/jsxs("label", {
1347
- className: classes.IndexTableColumnVisibilityItem,
1348
- children: [/*#__PURE__*/jsx(Checkbox, {
1349
- checked: isVisible(col.id),
1350
- onChange: () => handleToggle(col.id)
1351
- }), /*#__PURE__*/jsx("span", {
1352
- children: col.label
1353
- })]
1354
- }, col.id);
1355
- $[13] = handleToggle;
1356
- $[14] = isVisible;
1357
- $[15] = t7;
1358
- } else {
1359
- t7 = $[15];
1360
- }
1361
- t6 = columns.map(t7);
1362
- $[9] = columns;
1363
- $[10] = handleToggle;
1364
- $[11] = isVisible;
1365
- $[12] = t6;
1366
- } else {
1367
- t6 = $[12];
1368
- }
1369
- let t7;
1370
- if ($[16] !== t6) {
1371
- t7 = /*#__PURE__*/jsx("div", {
1372
- className: classes.IndexTableColumnVisibilityPopover,
1373
- children: t6
1374
- });
1375
- $[16] = t6;
1376
- $[17] = t7;
1377
- } else {
1378
- t7 = $[17];
1379
- }
1380
- let t8;
1381
- if ($[18] !== t5 || $[19] !== t7) {
1382
- t8 = /*#__PURE__*/jsxs("details", {
1383
- className: classes.IndexTableColumnVisibilityMenu,
1384
- children: [t5, t7]
1385
- });
1386
- $[18] = t5;
1387
- $[19] = t7;
1388
- $[20] = t8;
1389
- } else {
1390
- t8 = $[20];
1391
- }
1392
- return t8;
1393
- }
1394
-
1395
- // ----------------------------------------------------------------------------
1396
- // IndexTableScrollContainer — scrollable wrapper with fade edges
1397
- // ----------------------------------------------------------------------------
1398
-
1399
- function IndexTableScrollContainer(t0) {
1400
- const $ = c(23);
1401
- let children;
1402
- let className;
1403
- let rest;
1404
- let t1;
1405
- if ($[0] !== t0) {
1406
- ({
1407
- "aria-label": t1,
1408
- children,
1409
- className,
1410
- ...rest
1411
- } = t0);
1412
- $[0] = t0;
1413
- $[1] = children;
1414
- $[2] = className;
1415
- $[3] = rest;
1416
- $[4] = t1;
1417
- } else {
1418
- children = $[1];
1419
- className = $[2];
1420
- rest = $[3];
1421
- t1 = $[4];
1422
- }
1423
- const ariaLabel = t1 === undefined ? "Scrollable table" : t1;
1424
- const scrollRef = useRef(null);
1425
- const [showLeftFade, setShowLeftFade] = useState(false);
1426
- const [showRightFade, setShowRightFade] = useState(false);
1427
- let t2;
1428
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1429
- t2 = () => {
1430
- const el = scrollRef.current;
1431
- if (!el) {
1432
- return;
1433
- }
1434
- setShowLeftFade(el.scrollLeft > 0);
1435
- setShowRightFade(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
1436
- };
1437
- $[5] = t2;
1438
- } else {
1439
- t2 = $[5];
1440
- }
1441
- const updateFades = t2;
1442
- let t3;
1443
- let t4;
1444
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1445
- t3 = () => {
1446
- updateFades();
1447
- const el_0 = scrollRef.current;
1448
- if (!el_0) {
1449
- return;
1450
- }
1451
- const observer = new ResizeObserver(updateFades);
1452
- observer.observe(el_0);
1453
- return () => observer.disconnect();
1454
- };
1455
- t4 = [updateFades];
1456
- $[6] = t3;
1457
- $[7] = t4;
1458
- } else {
1459
- t3 = $[6];
1460
- t4 = $[7];
1461
- }
1462
- React.useEffect(t3, t4);
1463
- let t5;
1464
- if ($[8] !== className) {
1465
- t5 = clsx(classes.IndexTableScrollContainer, className);
1466
- $[8] = className;
1467
- $[9] = t5;
1468
- } else {
1469
- t5 = $[9];
1470
- }
1471
- let t6;
1472
- if ($[10] !== showLeftFade) {
1473
- t6 = showLeftFade && /*#__PURE__*/jsx("div", {
1474
- className: classes.IndexTableScrollFadeLeft,
1475
- "aria-hidden": "true"
1476
- });
1477
- $[10] = showLeftFade;
1478
- $[11] = t6;
1479
- } else {
1480
- t6 = $[11];
1481
- }
1482
- let t7;
1483
- if ($[12] !== showRightFade) {
1484
- t7 = showRightFade && /*#__PURE__*/jsx("div", {
1485
- className: classes.IndexTableScrollFadeRight,
1486
- "aria-hidden": "true"
1487
- });
1488
- $[12] = showRightFade;
1489
- $[13] = t7;
1490
- } else {
1491
- t7 = $[13];
1492
- }
1493
- let t8;
1494
- if ($[14] !== ariaLabel || $[15] !== children) {
1495
- t8 = /*#__PURE__*/jsx("div", {
1496
- ref: scrollRef,
1497
- className: classes.IndexTableScrollViewport,
1498
- role: "region",
1499
- "aria-label": ariaLabel,
1500
- tabIndex: 0,
1501
- onScroll: updateFades,
1502
- children: children
1503
- });
1504
- $[14] = ariaLabel;
1505
- $[15] = children;
1506
- $[16] = t8;
1507
- } else {
1508
- t8 = $[16];
1509
- }
1510
- let t9;
1511
- if ($[17] !== rest || $[18] !== t5 || $[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
1512
- t9 = /*#__PURE__*/jsxs("div", {
1513
- ...rest,
1514
- className: t5,
1515
- children: [t6, t7, t8]
1516
- });
1517
- $[17] = rest;
1518
- $[18] = t5;
1519
- $[19] = t6;
1520
- $[20] = t7;
1521
- $[21] = t8;
1522
- $[22] = t9;
1523
- } else {
1524
- t9 = $[22];
1525
- }
1526
- return t9;
1527
- }
1528
-
1529
- // ----------------------------------------------------------------------------
1530
- // Specialized cells
1531
- // ----------------------------------------------------------------------------
1532
-
1533
- /** Status indicator dot for table cells */
1534
- function IndexTableStatusCell(t0) {
1535
- const $ = c(6);
1536
- const {
1537
- variant,
1538
- label
1539
- } = t0;
1540
- let t1;
1541
- if ($[0] !== label) {
1542
- t1 = /*#__PURE__*/jsx(VisuallyHidden, {
1543
- children: label
1544
- });
1545
- $[0] = label;
1546
- $[1] = t1;
1547
- } else {
1548
- t1 = $[1];
1549
- }
1550
- let t2;
1551
- if ($[2] !== label || $[3] !== t1 || $[4] !== variant) {
1552
- t2 = /*#__PURE__*/jsx("span", {
1553
- className: classes.IndexTableStatusDot,
1554
- "data-variant": variant,
1555
- role: "status",
1556
- "aria-label": label,
1557
- children: t1
1558
- });
1559
- $[2] = label;
1560
- $[3] = t1;
1561
- $[4] = variant;
1562
- $[5] = t2;
1563
- } else {
1564
- t2 = $[5];
1565
- }
1566
- return t2;
1567
- }
1568
- /** Stacked avatars cell for displaying multiple assignees */
1569
- function IndexTableAvatarStackCell(t0) {
1570
- const $ = c(17);
1571
- const {
1572
- avatars,
1573
- max: t1
1574
- } = t0;
1575
- const max = t1 === undefined ? 3 : t1;
1576
- if (avatars.length === 0) {
1577
- return null;
1578
- }
1579
- let T0;
1580
- let remaining;
1581
- let t2;
1582
- let t3;
1583
- if ($[0] !== avatars || $[1] !== max) {
1584
- const visible = avatars.slice(0, max);
1585
- remaining = avatars.length - max;
1586
- t3 = classes.IndexTableAvatarStackCell;
1587
- T0 = AvatarStack;
1588
- t2 = visible.map(_temp5);
1589
- $[0] = avatars;
1590
- $[1] = max;
1591
- $[2] = T0;
1592
- $[3] = remaining;
1593
- $[4] = t2;
1594
- $[5] = t3;
1595
- } else {
1596
- T0 = $[2];
1597
- remaining = $[3];
1598
- t2 = $[4];
1599
- t3 = $[5];
1600
- }
1601
- let t4;
1602
- if ($[6] !== T0 || $[7] !== t2) {
1603
- t4 = /*#__PURE__*/jsx(T0, {
1604
- children: t2
1605
- });
1606
- $[6] = T0;
1607
- $[7] = t2;
1608
- $[8] = t4;
1609
- } else {
1610
- t4 = $[8];
1611
- }
1612
- let t5;
1613
- if ($[9] !== avatars || $[10] !== max || $[11] !== remaining) {
1614
- t5 = remaining > 0 && /*#__PURE__*/jsx(Tooltip, {
1615
- text: avatars.slice(max).map(_temp6).join(", "),
1616
- children: /*#__PURE__*/jsxs("span", {
1617
- className: classes.IndexTableAvatarOverflowCount,
1618
- children: ["+", remaining]
1619
- })
1620
- });
1621
- $[9] = avatars;
1622
- $[10] = max;
1623
- $[11] = remaining;
1624
- $[12] = t5;
1625
- } else {
1626
- t5 = $[12];
1627
- }
1628
- let t6;
1629
- if ($[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
1630
- t6 = /*#__PURE__*/jsxs("div", {
1631
- className: t3,
1632
- children: [t4, t5]
1633
- });
1634
- $[13] = t3;
1635
- $[14] = t4;
1636
- $[15] = t5;
1637
- $[16] = t6;
1638
- } else {
1639
- t6 = $[16];
1640
- }
1641
- return t6;
1642
- }
1643
- function _temp6(a) {
1644
- return a.alt;
1645
- }
1646
- function _temp5(avatar, i) {
1647
- return /*#__PURE__*/jsx(Tooltip, {
1648
- text: avatar.alt,
1649
- children: /*#__PURE__*/jsx(Avatar, {
1650
- src: avatar.src,
1651
- alt: avatar.alt,
1652
- size: 20
1653
- })
1654
- }, i);
1655
- }
1656
- _temp5.displayName = "_temp5";
1657
- /** Icon cell with optional status indicator */
1658
- function IndexTableIconCell(t0) {
1659
- const $ = c(5);
1660
- const {
1661
- icon,
1662
- status
1663
- } = t0;
1664
- let t1;
1665
- if ($[0] !== status) {
1666
- t1 = status && /*#__PURE__*/jsx(IndexTableStatusCell, {
1667
- variant: status.variant,
1668
- label: status.label
1669
- });
1670
- $[0] = status;
1671
- $[1] = t1;
1672
- } else {
1673
- t1 = $[1];
1674
- }
1675
- let t2;
1676
- if ($[2] !== icon || $[3] !== t1) {
1677
- t2 = /*#__PURE__*/jsxs("div", {
1678
- className: classes.IndexTableIconCell,
1679
- children: [icon, t1]
1680
- });
1681
- $[2] = icon;
1682
- $[3] = t1;
1683
- $[4] = t2;
1684
- } else {
1685
- t2 = $[4];
1686
- }
1687
- return t2;
1688
- }
1689
-
1690
- // Re-export types from DataTable primitives
1691
- function _temp() {}
1692
-
1693
- export { IndexTableAvatarStackCell, IndexTableBody, IndexTableBulkActions, IndexTableCell, IndexTableColumnVisibilityMenu, IndexTableHead, IndexTableHeader, IndexTableHeaderRow, IndexTableIconCell, IndexTableLoadingRows, IndexTableRoot, IndexTableRow, IndexTableRowActions, IndexTableRowLink, IndexTableScrollContainer, IndexTableSortHeader, IndexTableStatusCell, IndexTableTreeRow, IndexTableTreeSubRows, IndexTableTreeToggle, useIndexTableColumnVisibility, useIndexTableSelection };