@dloizides/ui-tables 1.9.1 → 1.10.0

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.
package/dist/index.js CHANGED
@@ -1,15 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var React2 = require('react');
3
+ var react = require('react');
4
4
  var reactNative = require('react-native');
5
5
  var uiFeedback = require('@dloizides/ui-feedback');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var reactDom = require('react-dom');
8
8
 
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
- var React2__default = /*#__PURE__*/_interopDefault(React2);
12
-
13
9
  // src/StatCard/StatCard.tsx
14
10
  var CARD_PADDING = 16;
15
11
  var CARD_BORDER_RADIUS = 12;
@@ -33,7 +29,7 @@ var styles = reactNative.StyleSheet.create({
33
29
  lineHeight: VALUE_LINE_HEIGHT
34
30
  }
35
31
  });
36
- var StatCard = React2.memo(({ label, value, testID }) => {
32
+ var StatCard = react.memo(({ label, value, testID }) => {
37
33
  const { theme, t } = uiFeedback.useUi();
38
34
  const { colors } = theme;
39
35
  const formattedValue = value.toLocaleString();
@@ -53,6 +49,70 @@ var StatCard = React2.memo(({ label, value, testID }) => {
53
49
  );
54
50
  });
55
51
  StatCard.displayName = "StatCard";
52
+
53
+ // src/DataTable/constants.ts
54
+ var CARD_STACK_BREAKPOINT = 640;
55
+ var DEFAULT_PAGE_SIZE_OPTIONS = [25, 50, 100, 200];
56
+ var TABLE_TEST_IDS = {
57
+ root: "ui-data-table",
58
+ head: "ui-data-table-head",
59
+ /** Infix of a row's test id: `${tableTestID}-row-${key}`. */
60
+ rowInfix: "row",
61
+ /** Infix of an expanded row's detail panel: `${tableTestID}-row-detail-${key}`. */
62
+ rowDetailInfix: "row-detail",
63
+ /** Infix of a row's select checkbox: `${tableTestID}-select-${key}`. */
64
+ rowSelectInfix: "select",
65
+ /** Suffix of the header (select-all-on-page) checkbox: `${tableTestID}-select-all`. */
66
+ selectAllSuffix: "select-all",
67
+ /** Suffix of the select-all-matching banner: `${tableTestID}-select-banner`. */
68
+ selectBannerSuffix: "select-banner",
69
+ /** Suffix of the banner's action: `${tableTestID}-select-banner-action`. */
70
+ selectBannerActionSuffix: "select-banner-action",
71
+ filterBar: "ui-filters",
72
+ results: "ui-results",
73
+ pager: "ui-pager",
74
+ pagerInfo: "ui-pager-info",
75
+ pagerPrev: "ui-pager-prev",
76
+ pagerNext: "ui-pager-next"
77
+ };
78
+ var rowTestID = (tableTestID, key) => `${tableTestID}-${TABLE_TEST_IDS.rowInfix}-${key}`;
79
+ var rowDetailTestID = (tableTestID, key) => `${tableTestID}-${TABLE_TEST_IDS.rowDetailInfix}-${key}`;
80
+ var rowSelectTestID = (tableTestID, key) => `${tableTestID}-${TABLE_TEST_IDS.rowSelectInfix}-${key}`;
81
+ var selectAllTestID = (tableTestID) => `${tableTestID}-${TABLE_TEST_IDS.selectAllSuffix}`;
82
+ var TABLE_I18N = {
83
+ loading: "uiTables.loading",
84
+ empty: "uiTables.empty",
85
+ rowLabel: "uiTables.rowLabel",
86
+ rowHint: "uiTables.rowHint",
87
+ /** Accessible name of the full-width detail panel under an expanded row. */
88
+ rowDetail: "uiTables.rowDetail",
89
+ /** Accessible name of a row's select checkbox. */
90
+ selectRow: "uiTables.select.row",
91
+ selectRowHint: "uiTables.select.rowHint",
92
+ /** Accessible name of the header (select-all-on-page) checkbox. */
93
+ selectAll: "uiTables.select.all",
94
+ selectAllHint: "uiTables.select.allHint",
95
+ /** Banner, offer state: "All {{p1}} rows on this page are selected." */
96
+ selectPageSelected: "uiTables.select.pageSelected",
97
+ /** Banner, offer action: "Select all {{p1}} matching this filter". */
98
+ selectAllMatching: "uiTables.select.allMatching",
99
+ selectAllMatchingHint: "uiTables.select.allMatchingHint",
100
+ /** Banner, active state: "All {{p1}} rows matching this filter are selected." */
101
+ selectMatchingSelected: "uiTables.select.matchingSelected",
102
+ /** Banner, active action: "Clear selection". */
103
+ selectClear: "uiTables.select.clear",
104
+ selectClearHint: "uiTables.select.clearHint",
105
+ results: "uiTables.results",
106
+ pagerInfo: "uiTables.pager.info",
107
+ pagerPrev: "uiTables.pager.prev",
108
+ pagerNext: "uiTables.pager.next",
109
+ pagerPrevHint: "uiTables.pager.prevHint",
110
+ pagerNextHint: "uiTables.pager.nextHint",
111
+ pagerRows: "uiTables.pager.rows",
112
+ pagerRowsOptionHint: "uiTables.pager.rowsOptionHint",
113
+ /** Accessible hint for the dropdown-variant rows-per-page trigger button. */
114
+ pagerRowsTriggerHint: "uiTables.pager.rowsTriggerHint"
115
+ };
56
116
  var BORDER_WIDTH = 1;
57
117
  var BORDER_RADIUS = 12;
58
118
  var COLUMN_GAP = 16;
@@ -84,6 +144,14 @@ var HEAD_LETTER_SPACING = 0.4;
84
144
  var LABEL_LETTER_SPACING = 0.3;
85
145
  var STICKY_Z = 2;
86
146
  var FULL_WIDTH = "100%";
147
+ var SELECT_COL_WIDTH = 20;
148
+ var CHECKBOX_SIZE = 18;
149
+ var CHECKBOX_RADIUS = 4;
150
+ var CHECKBOX_GLYPH_FONT = 11;
151
+ var CHECKBOX_GLYPH_LINE = 13;
152
+ var BANNER_PAD_V = 8;
153
+ var BANNER_FONT = 13;
154
+ var BANNER_GAP = 6;
87
155
  var STICKY_WEB_STYLE = {
88
156
  position: "sticky",
89
157
  top: 0,
@@ -114,6 +182,40 @@ var tableStyles = reactNative.StyleSheet.create({
114
182
  cardLabel: { fontSize: HEAD_FONT, fontWeight: "600", textTransform: "uppercase", letterSpacing: LABEL_LETTER_SPACING },
115
183
  cardValue: { flexShrink: 1, alignItems: "flex-end" }
116
184
  });
185
+ var selectionStyles = reactNative.StyleSheet.create({
186
+ /** The fixed-width gutter holding the checkbox, in both the header and every row. */
187
+ selectCell: { width: SELECT_COL_WIDTH, alignItems: "flex-start", justifyContent: "center" },
188
+ /** The checkbox's pressable area (the hit target is grown further with `hitSlop`). */
189
+ checkboxHit: { alignItems: "center", justifyContent: "center" },
190
+ checkbox: {
191
+ width: CHECKBOX_SIZE,
192
+ height: CHECKBOX_SIZE,
193
+ borderRadius: CHECKBOX_RADIUS,
194
+ borderWidth: BORDER_WIDTH,
195
+ alignItems: "center",
196
+ justifyContent: "center"
197
+ },
198
+ checkboxGlyph: { fontSize: CHECKBOX_GLYPH_FONT, lineHeight: CHECKBOX_GLYPH_LINE, fontWeight: "700" },
199
+ /**
200
+ * The cells of a SELECTABLE row, wrapped so the checkbox can sit OUTSIDE the pressable
201
+ * area. `flex: 1` so the cells still claim the row minus the checkbox gutter.
202
+ */
203
+ rowContent: { flex: 1, flexDirection: "row", columnGap: COLUMN_GAP, alignItems: "center" },
204
+ /** The same, for the card-stack: a card's lines are a column, not a row. */
205
+ cardContent: { flex: 1 },
206
+ /** The select-all-matching banner, spanning the table above the header. */
207
+ banner: {
208
+ flexDirection: "row",
209
+ flexWrap: "wrap",
210
+ alignItems: "center",
211
+ justifyContent: "center",
212
+ gap: BANNER_GAP,
213
+ paddingHorizontal: ROW_PAD_H,
214
+ paddingVertical: BANNER_PAD_V
215
+ },
216
+ bannerText: { fontSize: BANNER_FONT },
217
+ bannerAction: { fontSize: BANNER_FONT, fontWeight: "700", textDecorationLine: "underline" }
218
+ });
117
219
  var chromeStyles = reactNative.StyleSheet.create({
118
220
  filters: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-end", columnGap: COLUMN_GAP, rowGap: PAGER_GAP, borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS, paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V },
119
221
  filtersSpacer: { flexGrow: 1 },
@@ -160,7 +262,7 @@ function cellContent(column, row, textColor, overrides) {
160
262
  }
161
263
  return content;
162
264
  }
163
- function DesktopCell({ column, row, textColor, testID, styleOverrides }) {
265
+ function DesktopCell({ column, row, textColor, testID, styleOverrides, inGrid }) {
164
266
  return /* @__PURE__ */ jsxRuntime.jsx(
165
267
  reactNative.View,
166
268
  {
@@ -169,49 +271,504 @@ function DesktopCell({ column, row, textColor, testID, styleOverrides }) {
169
271
  styleOverrides?.cellWrap
170
272
  ],
171
273
  testID,
274
+ ...inGrid === true ? { role: "cell" } : null,
172
275
  children: cellContent(column, row, textColor, styleOverrides)
173
276
  }
174
277
  );
175
278
  }
279
+ function RowCells({
280
+ columns,
281
+ row,
282
+ stacked,
283
+ inGrid,
284
+ rowTestID: rowTestID2,
285
+ textColor,
286
+ labelColor,
287
+ styleOverrides: o
288
+ }) {
289
+ if (stacked) {
290
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.cardLine, o?.cardLine], children: [
291
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [tableStyles.cardLabel, { color: labelColor }, o?.cardLabel], children: col.header }),
292
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.cardValue, o?.cardValue], children: cellContent(col, row, textColor, o) })
293
+ ] }, col.key)) });
294
+ }
295
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
296
+ DesktopCell,
297
+ {
298
+ column: col,
299
+ inGrid,
300
+ row,
301
+ styleOverrides: o,
302
+ testID: `${rowTestID2}-${col.key}`,
303
+ textColor
304
+ },
305
+ col.key
306
+ )) });
307
+ }
308
+ var CHECK_GLYPH = "\u2713";
309
+ var MIXED_GLYPH = "\u2013";
310
+ var CHECKBOX_HIT_SLOP = { top: 12, bottom: 12, left: 12, right: 12 };
311
+ var TRANSPARENT = "transparent";
312
+ function toCheckedValue(state) {
313
+ if (state === "all" /* All */) return true;
314
+ return state === "some" /* Some */ ? "mixed" : false;
315
+ }
316
+ function toGlyph(state) {
317
+ if (state === "all" /* All */) return CHECK_GLYPH;
318
+ return state === "some" /* Some */ ? MIXED_GLYPH : void 0;
319
+ }
320
+ function SelectionCheckbox({
321
+ state,
322
+ label,
323
+ hint,
324
+ onToggle,
325
+ brandColor,
326
+ borderColor,
327
+ surfaceColor,
328
+ testID
329
+ }) {
330
+ const checked = toCheckedValue(state);
331
+ const glyph = toGlyph(state);
332
+ const filled = state !== "none" /* None */;
333
+ return /* @__PURE__ */ jsxRuntime.jsx(
334
+ reactNative.Pressable,
335
+ {
336
+ accessibilityHint: hint,
337
+ accessibilityLabel: label,
338
+ accessibilityRole: "checkbox",
339
+ accessibilityState: { checked },
340
+ "aria-checked": checked,
341
+ hitSlop: CHECKBOX_HIT_SLOP,
342
+ style: selectionStyles.checkboxHit,
343
+ testID,
344
+ onPress: onToggle,
345
+ children: /* @__PURE__ */ jsxRuntime.jsx(
346
+ reactNative.View,
347
+ {
348
+ style: [
349
+ selectionStyles.checkbox,
350
+ { borderColor: filled ? brandColor : borderColor, backgroundColor: filled ? brandColor : TRANSPARENT }
351
+ ],
352
+ children: glyph === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [selectionStyles.checkboxGlyph, { color: surfaceColor }], children: glyph })
353
+ }
354
+ )
355
+ }
356
+ );
357
+ }
358
+ var TAB_INDEX_INACTIVE = -1;
359
+ function webKeyProps(onKeyDown) {
360
+ return onKeyDown === void 0 ? {} : { onKeyDown };
361
+ }
362
+ function focusProps(keyboard) {
363
+ if (keyboard === void 0) return {};
364
+ return {
365
+ tabIndex: keyboard.tabIndex,
366
+ onFocus: keyboard.onFocus,
367
+ ref: (node) => keyboard.registerNode(node),
368
+ ...webKeyProps(keyboard.onKeyDown)
369
+ };
370
+ }
371
+ function TableRow({
372
+ testID,
373
+ style,
374
+ children,
375
+ a11y,
376
+ onPress,
377
+ onHoverIn,
378
+ onHoverOut,
379
+ selectionSlot,
380
+ stacked,
381
+ keyboard
382
+ }) {
383
+ const interactive = onPress !== void 0;
384
+ const hover = interactive ? { onHoverIn, onHoverOut } : null;
385
+ if (selectionSlot === void 0) {
386
+ return interactive ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style, testID, onPress, ...hover, ...a11y, ...focusProps(keyboard), children }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, ...a11y, ...focusProps(keyboard), children });
387
+ }
388
+ const contentStyle = stacked ? selectionStyles.cardContent : selectionStyles.rowContent;
389
+ const content = interactive ? /* @__PURE__ */ jsxRuntime.jsx(
390
+ reactNative.Pressable,
391
+ {
392
+ style: contentStyle,
393
+ tabIndex: keyboard === void 0 ? void 0 : TAB_INDEX_INACTIVE,
394
+ onPress,
395
+ ...hover,
396
+ children
397
+ }
398
+ ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: contentStyle, children });
399
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style, testID, ...a11y, ...focusProps(keyboard), children: [
400
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: selectionStyles.selectCell, children: selectionSlot }),
401
+ content
402
+ ] });
403
+ }
404
+ function DataTableRow({
405
+ row,
406
+ rowKey,
407
+ style,
408
+ columns,
409
+ stacked,
410
+ tableTestID,
411
+ selection,
412
+ keyboardNavigation,
413
+ roving,
414
+ onRowPress,
415
+ getRowAccessibilityLabel,
416
+ renderRowDetail,
417
+ expanded,
418
+ onHoverIn,
419
+ onHoverOut,
420
+ styleOverrides: o
421
+ }) {
422
+ const { theme, t } = uiFeedback.useUi();
423
+ const { colors } = theme;
424
+ const rowID = rowTestID(tableTestID, rowKey);
425
+ const isExpandable = renderRowDetail !== void 0;
426
+ const { selectable } = selection;
427
+ const isSelected = selectable && selection.isSelected(rowKey);
428
+ const a11y = {
429
+ accessibilityLabel: getRowAccessibilityLabel?.(row) ?? t(TABLE_I18N.rowLabel),
430
+ accessibilityHint: t(TABLE_I18N.rowHint),
431
+ accessibilityRole: onRowPress ? "button" : "text",
432
+ ...isExpandable || selectable ? { accessibilityState: { ...isExpandable ? { expanded } : null, ...selectable ? { selected: isSelected } : null } } : null,
433
+ ...isExpandable ? { "aria-expanded": expanded } : null,
434
+ ...selectable ? { "aria-selected": isSelected } : null,
435
+ // A navigable table is a real grid, so its rows are grid rows — selectable or not.
436
+ // `role` wins over `accessibilityRole` on RNW.
437
+ ...keyboardNavigation ? { role: "row" } : null
438
+ };
439
+ const rowNode = /* @__PURE__ */ jsxRuntime.jsx(
440
+ TableRow,
441
+ {
442
+ a11y,
443
+ keyboard: keyboardNavigation ? {
444
+ tabIndex: roving.tabIndexFor(rowKey),
445
+ onKeyDown: roving.keyDownFor(rowKey),
446
+ onFocus: () => roving.onRowFocus(rowKey),
447
+ registerNode: (node) => roving.registerRow(rowKey, node)
448
+ } : void 0,
449
+ selectionSlot: selectable ? /* @__PURE__ */ jsxRuntime.jsx(
450
+ SelectionCheckbox,
451
+ {
452
+ borderColor: colors.border,
453
+ brandColor: theme.palette.primary["500"],
454
+ hint: t(TABLE_I18N.selectRowHint),
455
+ label: getRowAccessibilityLabel?.(row) ?? t(TABLE_I18N.selectRow),
456
+ state: isSelected ? "all" /* All */ : "none" /* None */,
457
+ surfaceColor: colors.surface,
458
+ testID: rowSelectTestID(tableTestID, rowKey),
459
+ onToggle: () => selection.toggleRow(rowKey)
460
+ }
461
+ ) : void 0,
462
+ stacked,
463
+ style,
464
+ testID: rowID,
465
+ onHoverIn,
466
+ onHoverOut,
467
+ onPress: onRowPress === void 0 ? void 0 : () => onRowPress(row),
468
+ children: /* @__PURE__ */ jsxRuntime.jsx(
469
+ RowCells,
470
+ {
471
+ columns,
472
+ inGrid: keyboardNavigation,
473
+ labelColor: colors.textSecondary,
474
+ row,
475
+ rowTestID: rowID,
476
+ stacked,
477
+ styleOverrides: o,
478
+ textColor: colors.text
479
+ }
480
+ )
481
+ }
482
+ );
483
+ if (!isExpandable || !expanded) return rowNode;
484
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
485
+ rowNode,
486
+ /* @__PURE__ */ jsxRuntime.jsx(
487
+ reactNative.View,
488
+ {
489
+ accessibilityLabel: t(TABLE_I18N.rowDetail),
490
+ accessibilityRole: "summary",
491
+ style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
492
+ testID: rowDetailTestID(tableTestID, rowKey),
493
+ children: renderRowDetail(row)
494
+ }
495
+ )
496
+ ] });
497
+ }
498
+ function SelectAllBanner({
499
+ mode,
500
+ pageCount,
501
+ matchingCount,
502
+ onAction,
503
+ testID,
504
+ actionTestID,
505
+ styleOverride
506
+ }) {
507
+ const { theme, t } = uiFeedback.useUi();
508
+ const { colors, palette } = theme;
509
+ if (mode === "hidden" /* Hidden */) return null;
510
+ const active = mode === "active" /* Active */;
511
+ const message = active ? t(TABLE_I18N.selectMatchingSelected, matchingCount.toLocaleString()) : t(TABLE_I18N.selectPageSelected, pageCount.toLocaleString());
512
+ const actionLabel = active ? t(TABLE_I18N.selectClear) : t(TABLE_I18N.selectAllMatching, matchingCount.toLocaleString());
513
+ const actionHint = active ? t(TABLE_I18N.selectClearHint) : t(TABLE_I18N.selectAllMatchingHint);
514
+ return /* @__PURE__ */ jsxRuntime.jsxs(
515
+ reactNative.View,
516
+ {
517
+ accessibilityLiveRegion: "polite",
518
+ style: [selectionStyles.banner, { backgroundColor: colors.background }, styleOverride],
519
+ testID,
520
+ children: [
521
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [selectionStyles.bannerText, { color: colors.textSecondary }], children: message }),
522
+ /* @__PURE__ */ jsxRuntime.jsx(
523
+ reactNative.Pressable,
524
+ {
525
+ accessibilityHint: actionHint,
526
+ accessibilityLabel: actionLabel,
527
+ accessibilityRole: "button",
528
+ testID: actionTestID,
529
+ onPress: onAction,
530
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [selectionStyles.bannerAction, { color: palette.primary["500"] }], children: actionLabel })
531
+ }
532
+ )
533
+ ]
534
+ }
535
+ );
536
+ }
537
+ function TableHeader({ columns, stickyHeader, selection, inGrid, styleOverrides: o }) {
538
+ const { theme, t } = uiFeedback.useUi();
539
+ const { colors } = theme;
540
+ return /* @__PURE__ */ jsxRuntime.jsxs(
541
+ reactNative.View,
542
+ {
543
+ style: [tableStyles.headRow, { backgroundColor: colors.background }, stickyHeader ? STICKY_HEADER_STYLE : null, o?.headRow],
544
+ testID: TABLE_TEST_IDS.head,
545
+ ...inGrid ? { role: "row" } : null,
546
+ children: [
547
+ selection === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [selectionStyles.selectCell, o?.selectCell], children: /* @__PURE__ */ jsxRuntime.jsx(
548
+ SelectionCheckbox,
549
+ {
550
+ borderColor: colors.border,
551
+ brandColor: theme.palette.primary["500"],
552
+ hint: t(TABLE_I18N.selectAllHint),
553
+ label: t(TABLE_I18N.selectAll),
554
+ state: selection.state,
555
+ surfaceColor: colors.surface,
556
+ testID: selection.testID,
557
+ onToggle: selection.onToggleAll
558
+ }
559
+ ) }),
560
+ columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
561
+ reactNative.Text,
562
+ {
563
+ style: [tableStyles.headCell, { color: colors.textSecondary, flex: col.weight ?? 1, textAlign: col.numeric ? "right" : "left" }, o?.headCell],
564
+ ...inGrid ? { role: "columnheader" } : null,
565
+ children: col.header
566
+ },
567
+ col.key
568
+ ))
569
+ ]
570
+ }
571
+ );
572
+ }
176
573
 
177
- // src/DataTable/constants.ts
178
- var CARD_STACK_BREAKPOINT = 640;
179
- var DEFAULT_PAGE_SIZE_OPTIONS = [25, 50, 100, 200];
180
- var TABLE_TEST_IDS = {
181
- root: "ui-data-table",
182
- head: "ui-data-table-head",
183
- /** Infix of a row's test id: `${tableTestID}-row-${key}`. */
184
- rowInfix: "row",
185
- /** Infix of an expanded row's detail panel: `${tableTestID}-row-detail-${key}`. */
186
- rowDetailInfix: "row-detail",
187
- filterBar: "ui-filters",
188
- results: "ui-results",
189
- pager: "ui-pager",
190
- pagerInfo: "ui-pager-info",
191
- pagerPrev: "ui-pager-prev",
192
- pagerNext: "ui-pager-next"
193
- };
194
- var rowTestID = (tableTestID, key) => `${tableTestID}-${TABLE_TEST_IDS.rowInfix}-${key}`;
195
- var rowDetailTestID = (tableTestID, key) => `${tableTestID}-${TABLE_TEST_IDS.rowDetailInfix}-${key}`;
196
- var TABLE_I18N = {
197
- loading: "uiTables.loading",
198
- empty: "uiTables.empty",
199
- rowLabel: "uiTables.rowLabel",
200
- rowHint: "uiTables.rowHint",
201
- /** Accessible name of the full-width detail panel under an expanded row. */
202
- rowDetail: "uiTables.rowDetail",
203
- results: "uiTables.results",
204
- pagerInfo: "uiTables.pager.info",
205
- pagerPrev: "uiTables.pager.prev",
206
- pagerNext: "uiTables.pager.next",
207
- pagerPrevHint: "uiTables.pager.prevHint",
208
- pagerNextHint: "uiTables.pager.nextHint",
209
- pagerRows: "uiTables.pager.rows",
210
- pagerRowsOptionHint: "uiTables.pager.rowsOptionHint",
211
- /** Accessible hint for the dropdown-variant rows-per-page trigger button. */
212
- pagerRowsTriggerHint: "uiTables.pager.rowsTriggerHint"
213
- };
574
+ // src/DataTable/rowNav.ts
575
+ var FIRST_INDEX = 0;
576
+ var ONE_ROW = 1;
577
+ var NOT_FOUND = -1;
578
+ function toRowNavAction(key) {
579
+ switch (key) {
580
+ case "ArrowDown":
581
+ return "next" /* Next */;
582
+ case "ArrowUp":
583
+ return "prev" /* Prev */;
584
+ case "Home":
585
+ return "first" /* First */;
586
+ case "End":
587
+ return "last" /* Last */;
588
+ case " ":
589
+ case "Spacebar":
590
+ return "toggle" /* Toggle */;
591
+ case "Enter":
592
+ return "activate" /* Activate */;
593
+ default:
594
+ return void 0;
595
+ }
596
+ }
597
+ function nextRowIndex(currentIndex, action, rowCount) {
598
+ if (rowCount === FIRST_INDEX) return void 0;
599
+ const lastIndex = rowCount - ONE_ROW;
600
+ switch (action) {
601
+ case "next" /* Next */:
602
+ return Math.min(currentIndex + ONE_ROW, lastIndex);
603
+ case "prev" /* Prev */:
604
+ return Math.max(currentIndex - ONE_ROW, FIRST_INDEX);
605
+ case "first" /* First */:
606
+ return FIRST_INDEX;
607
+ case "last" /* Last */:
608
+ return lastIndex;
609
+ default:
610
+ return void 0;
611
+ }
612
+ }
613
+ function resolveTabbableKey(rowKeys, focusedKey) {
614
+ if (rowKeys.length === FIRST_INDEX) return void 0;
615
+ if (focusedKey !== void 0 && rowKeys.includes(focusedKey)) return focusedKey;
616
+ return rowKeys[FIRST_INDEX];
617
+ }
618
+ function focusedRowIndex(rowKeys, focusedKey) {
619
+ const index = focusedKey === void 0 ? NOT_FOUND : rowKeys.indexOf(focusedKey);
620
+ return index === NOT_FOUND ? FIRST_INDEX : index;
621
+ }
622
+
623
+ // src/DataTable/useRovingFocus.ts
624
+ var TAB_INDEX_ACTIVE = 0;
625
+ var TAB_INDEX_INACTIVE2 = -1;
626
+ var IS_WEB = reactNative.Platform.OS === "web";
627
+ function useRovingFocus({ rowKeys, enabled, onToggleKey, onActivateKey }) {
628
+ const [focusedKey, setFocusedKey] = react.useState(void 0);
629
+ const nodes = react.useRef(/* @__PURE__ */ new Map());
630
+ const tabbableKey = enabled ? resolveTabbableKey(rowKeys, focusedKey) : void 0;
631
+ const registerRow = react.useCallback((key, node) => {
632
+ if (node === null || node === void 0) {
633
+ nodes.current.delete(key);
634
+ return;
635
+ }
636
+ nodes.current.set(key, node);
637
+ }, []);
638
+ const focusRow = react.useCallback((key) => {
639
+ setFocusedKey(key);
640
+ nodes.current.get(key)?.focus?.();
641
+ }, []);
642
+ const handleKey = react.useCallback(
643
+ (event, key) => {
644
+ const action = toRowNavAction(event.key);
645
+ if (action === void 0) return;
646
+ if (action === "toggle" /* Toggle */) {
647
+ if (onToggleKey === void 0) return;
648
+ event.preventDefault();
649
+ onToggleKey(key);
650
+ return;
651
+ }
652
+ if (action === "activate" /* Activate */) {
653
+ if (onActivateKey === void 0) return;
654
+ event.preventDefault();
655
+ onActivateKey(key);
656
+ return;
657
+ }
658
+ const target = nextRowIndex(focusedRowIndex(rowKeys, key), action, rowKeys.length);
659
+ if (target === void 0) return;
660
+ const targetKey = rowKeys[target];
661
+ if (targetKey === void 0) return;
662
+ event.preventDefault();
663
+ focusRow(targetKey);
664
+ },
665
+ [rowKeys, onToggleKey, onActivateKey, focusRow]
666
+ );
667
+ const keyDownFor = react.useCallback(
668
+ (key) => {
669
+ if (!enabled || !IS_WEB) return void 0;
670
+ return (event) => handleKey(event, key);
671
+ },
672
+ [enabled, handleKey]
673
+ );
674
+ const tabIndexFor = react.useCallback(
675
+ (key) => key === tabbableKey ? TAB_INDEX_ACTIVE : TAB_INDEX_INACTIVE2,
676
+ [tabbableKey]
677
+ );
678
+ const onRowFocus = react.useCallback((key) => setFocusedKey(key), []);
679
+ return { tabIndexFor, registerRow, onRowFocus, keyDownFor };
680
+ }
681
+
682
+ // src/DataTable/selection.ts
683
+ var NONE = 0;
684
+ function toggleSelectedKey(selectedKeys, key) {
685
+ return selectedKeys.includes(key) ? selectedKeys.filter((selected) => selected !== key) : [...selectedKeys, key];
686
+ }
687
+ function countSelectedOnPage(selectedKeys, pageKeys) {
688
+ return pageKeys.filter((key) => selectedKeys.includes(key)).length;
689
+ }
690
+ function resolveHeaderCheckboxState(selectedKeys, pageKeys) {
691
+ if (pageKeys.length === NONE) return "none" /* None */;
692
+ const selectedOnPage = countSelectedOnPage(selectedKeys, pageKeys);
693
+ if (selectedOnPage === NONE) return "none" /* None */;
694
+ return selectedOnPage === pageKeys.length ? "all" /* All */ : "some" /* Some */;
695
+ }
696
+ function toggleAllOnPage(selectedKeys, pageKeys) {
697
+ const state = resolveHeaderCheckboxState(selectedKeys, pageKeys);
698
+ if (state === "all" /* All */) return selectedKeys.filter((key) => !pageKeys.includes(key));
699
+ const merged = [...selectedKeys];
700
+ pageKeys.forEach((key) => {
701
+ if (!merged.includes(key)) merged.push(key);
702
+ });
703
+ return merged;
704
+ }
705
+ function resolveSelectAllBannerMode(headerState, allMatchingSelected, pageCount, matchingCount) {
706
+ if (allMatchingSelected) return "active" /* Active */;
707
+ const pageFullySelected = headerState === "all" /* All */ && pageCount > NONE;
708
+ const moreBeyondThisPage = matchingCount > pageCount;
709
+ return pageFullySelected && moreBeyondThisPage ? "offer" /* Offer */ : "hidden" /* Hidden */;
710
+ }
711
+ function isRowSelected(selectedKeys, key, allMatchingSelected) {
712
+ return allMatchingSelected || selectedKeys.includes(key);
713
+ }
714
+
715
+ // src/DataTable/useTableSelection.ts
716
+ var NO_KEYS = [];
717
+ var NO_MATCHES = 0;
718
+ function useTableSelection({
719
+ pageKeys,
720
+ selectedRowKeys,
721
+ onSelectionChange,
722
+ matchingCount,
723
+ allMatchingSelected,
724
+ onSelectAllMatchingChange
725
+ }) {
726
+ const selectable = onSelectionChange !== void 0;
727
+ const selected = selectedRowKeys ?? NO_KEYS;
728
+ const allMatching = allMatchingSelected ?? false;
729
+ const matching = matchingCount ?? NO_MATCHES;
730
+ const pageHeaderState = react.useMemo(
731
+ () => resolveHeaderCheckboxState(selected, pageKeys),
732
+ [selected, pageKeys]
733
+ );
734
+ const headerState = allMatching ? "all" /* All */ : pageHeaderState;
735
+ const bannerMode = react.useMemo(
736
+ () => onSelectAllMatchingChange === void 0 ? "hidden" /* Hidden */ : resolveSelectAllBannerMode(pageHeaderState, allMatching, pageKeys.length, matching),
737
+ [onSelectAllMatchingChange, pageHeaderState, allMatching, pageKeys.length, matching]
738
+ );
739
+ const isSelected = react.useCallback(
740
+ (key) => isRowSelected(selected, key, allMatching),
741
+ [selected, allMatching]
742
+ );
743
+ const toggleRow = react.useCallback(
744
+ (key) => {
745
+ if (allMatching) {
746
+ onSelectAllMatchingChange?.(false);
747
+ onSelectionChange?.(toggleSelectedKey(pageKeys, key));
748
+ return;
749
+ }
750
+ onSelectionChange?.(toggleSelectedKey(selected, key));
751
+ },
752
+ [allMatching, onSelectAllMatchingChange, onSelectionChange, pageKeys, selected]
753
+ );
754
+ const toggleAll = react.useCallback(() => {
755
+ if (allMatching) {
756
+ onSelectAllMatchingChange?.(false);
757
+ onSelectionChange?.(NO_KEYS);
758
+ return;
759
+ }
760
+ onSelectionChange?.(toggleAllOnPage(selected, pageKeys));
761
+ }, [allMatching, onSelectAllMatchingChange, onSelectionChange, selected, pageKeys]);
762
+ const toggleAllMatching = react.useCallback(() => {
763
+ const next = !allMatching;
764
+ onSelectAllMatchingChange?.(next);
765
+ if (!next) onSelectionChange?.(NO_KEYS);
766
+ }, [allMatching, onSelectAllMatchingChange, onSelectionChange]);
767
+ return { selectable, headerState, bannerMode, isSelected, toggleRow, toggleAll, toggleAllMatching, matchingCount: matching };
768
+ }
214
769
  var FIRST_ROW_INDEX = 0;
770
+ var EVEN = 0;
771
+ var ZEBRA_MODULUS = 2;
215
772
  function DataTable(props) {
216
773
  const {
217
774
  columns,
@@ -228,6 +785,12 @@ function DataTable(props) {
228
785
  renderRowDetail,
229
786
  expandedRowKeys,
230
787
  styleOverrides: o,
788
+ selectedRowKeys,
789
+ onSelectionChange,
790
+ matchingCount,
791
+ allMatchingSelected,
792
+ onSelectAllMatchingChange,
793
+ keyboardNavigation = false,
231
794
  stackBreakpoint = CARD_STACK_BREAKPOINT,
232
795
  testID = TABLE_TEST_IDS.root
233
796
  } = props;
@@ -237,113 +800,120 @@ function DataTable(props) {
237
800
  const stacked = width < stackBreakpoint;
238
801
  const frame = { backgroundColor: colors.surface, borderColor: colors.border };
239
802
  const interactive = onRowPress !== void 0;
240
- const [hoveredKey, setHoveredKey] = React2.useState(void 0);
803
+ const [hoveredKey, setHoveredKey] = react.useState(void 0);
241
804
  const hoverTint = softBrandTint(theme.palette.primary["500"]) ?? colors.background;
242
- const rowBackground = React2.useCallback(
805
+ const rowKeys = react.useMemo(() => rows.map(keyExtractor), [rows, keyExtractor]);
806
+ const selection = useTableSelection({
807
+ pageKeys: rowKeys,
808
+ selectedRowKeys,
809
+ onSelectionChange,
810
+ matchingCount,
811
+ allMatchingSelected,
812
+ onSelectAllMatchingChange
813
+ });
814
+ const activateKey = react.useCallback(
815
+ (key) => {
816
+ const row = rows[rowKeys.indexOf(key)];
817
+ if (row !== void 0) onRowPress?.(row);
818
+ },
819
+ [rowKeys, rows, onRowPress]
820
+ );
821
+ const roving = useRovingFocus({
822
+ rowKeys,
823
+ enabled: keyboardNavigation,
824
+ onToggleKey: selection.selectable ? selection.toggleRow : void 0,
825
+ onActivateKey: interactive ? activateKey : void 0
826
+ });
827
+ const rowBackground = react.useCallback(
243
828
  (row, index) => {
244
829
  const tint = rowTint?.(row);
245
830
  if (tint) return tint;
246
- return zebra && index % 2 === 1 ? colors.background : void 0;
831
+ return zebra && index % ZEBRA_MODULUS !== EVEN ? colors.background : void 0;
247
832
  },
248
833
  [rowTint, zebra, colors.background]
249
834
  );
250
835
  const rowBg = (row, index, key) => interactive && hoveredKey === key ? hoverTint : rowBackground(row, index);
251
- const hoverHandlers = (key) => interactive ? {
252
- onHoverIn: () => setHoveredKey(key),
253
- onHoverOut: () => setHoveredKey((current) => current === key ? void 0 : current)
254
- } : void 0;
255
836
  const stateView = (label) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.state, o?.state], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [tableStyles.stateText, { color: colors.textSecondary }, o?.stateText], children: label }) }) });
256
837
  if (loading) return stateView(loadingLabel ?? t(TABLE_I18N.loading));
257
838
  if (rows.length === 0) return stateView(emptyLabel ?? t(TABLE_I18N.empty));
258
- const rowID = (key) => rowTestID(testID, key);
259
- const isExpandable = renderRowDetail !== void 0;
260
- const isExpanded = (key) => isExpandable && (expandedRowKeys?.includes(key) ?? false);
261
- const rowA11y = (row, key) => ({
262
- accessibilityLabel: getRowAccessibilityLabel?.(row) ?? t(TABLE_I18N.rowLabel),
263
- accessibilityHint: t(TABLE_I18N.rowHint),
264
- accessibilityRole: onRowPress ? "button" : "text",
265
- // Only an expandable table announces expanded/collapsed — a plain table's rows
266
- // keep exactly the props they had before this feature existed.
267
- ...isExpandable ? { accessibilityState: { expanded: isExpanded(key) }, "aria-expanded": isExpanded(key) } : null
268
- });
269
- const withRowDetail = (rowNode, row, key) => {
270
- if (!isExpandable || !isExpanded(key)) return rowNode;
271
- return /* @__PURE__ */ jsxRuntime.jsxs(React2__default.default.Fragment, { children: [
272
- rowNode,
273
- /* @__PURE__ */ jsxRuntime.jsx(
274
- reactNative.View,
275
- {
276
- accessibilityLabel: t(TABLE_I18N.rowDetail),
277
- accessibilityRole: "summary",
278
- style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
279
- testID: rowDetailTestID(testID, key),
280
- children: renderRowDetail(row)
281
- }
282
- )
283
- ] }, key);
284
- };
839
+ const renderRow = (row, key, style) => /* @__PURE__ */ jsxRuntime.jsx(
840
+ DataTableRow,
841
+ {
842
+ columns,
843
+ expanded: expandedRowKeys?.includes(key) ?? false,
844
+ getRowAccessibilityLabel,
845
+ keyboardNavigation,
846
+ renderRowDetail,
847
+ roving,
848
+ row,
849
+ rowKey: key,
850
+ selection,
851
+ stacked,
852
+ style,
853
+ styleOverrides: o,
854
+ tableTestID: testID,
855
+ onHoverIn: () => setHoveredKey(key),
856
+ onHoverOut: () => setHoveredKey((current) => current === key ? void 0 : current),
857
+ onRowPress
858
+ },
859
+ key
860
+ );
861
+ const banner = /* @__PURE__ */ jsxRuntime.jsx(
862
+ SelectAllBanner,
863
+ {
864
+ actionTestID: `${testID}-${TABLE_TEST_IDS.selectBannerActionSuffix}`,
865
+ matchingCount: selection.matchingCount,
866
+ mode: selection.bannerMode,
867
+ pageCount: rows.length,
868
+ styleOverride: o?.selectBanner,
869
+ testID: `${testID}-${TABLE_TEST_IDS.selectBannerSuffix}`,
870
+ onAction: selection.toggleAllMatching
871
+ }
872
+ );
285
873
  if (stacked) {
286
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: rows.map((row, i) => {
287
- const key = keyExtractor(row);
288
- const bg = rowBg(row, i, key);
289
- return withRowDetail(
290
- /* @__PURE__ */ jsxRuntime.jsx(
291
- reactNative.Pressable,
292
- {
293
- testID: rowID(key),
294
- onPress: onRowPress ? () => onRowPress(row) : void 0,
295
- ...hoverHandlers(key),
296
- ...rowA11y(row, key),
297
- style: [tableStyles.card, { borderTopColor: colors.border }, i === FIRST_ROW_INDEX ? { borderTopWidth: 0 } : null, bg ? { backgroundColor: bg } : null, o?.card],
298
- children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.cardLine, o?.cardLine], children: [
299
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [tableStyles.cardLabel, { color: colors.textSecondary }, o?.cardLabel], children: col.header }),
300
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.cardValue, o?.cardValue], children: cellContent(col, row, colors.text, o) })
301
- ] }, col.key))
302
- },
303
- key
304
- ),
305
- row,
306
- key
307
- );
308
- }) });
874
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: [
875
+ banner,
876
+ rows.map((row, i) => {
877
+ const key = rowKeys[i] ?? keyExtractor(row);
878
+ const bg = rowBg(row, i, key);
879
+ return renderRow(row, key, [
880
+ tableStyles.card,
881
+ { borderTopColor: colors.border },
882
+ i === FIRST_ROW_INDEX ? { borderTopWidth: 0 } : null,
883
+ // A selectable card puts the checkbox beside its lines, so the card becomes a row.
884
+ selection.selectable ? selectionStyles.rowContent : null,
885
+ bg ? { backgroundColor: bg } : null,
886
+ o?.card
887
+ ]);
888
+ })
889
+ ] });
309
890
  }
310
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: [
311
- /* @__PURE__ */ jsxRuntime.jsx(
312
- reactNative.View,
313
- {
314
- testID: TABLE_TEST_IDS.head,
315
- style: [tableStyles.headRow, { backgroundColor: colors.background }, stickyHeader ? STICKY_HEADER_STYLE : null, o?.headRow],
316
- children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
317
- reactNative.Text,
318
- {
319
- style: [tableStyles.headCell, { color: colors.textSecondary, flex: col.weight ?? 1, textAlign: col.numeric ? "right" : "left" }, o?.headCell],
320
- children: col.header
321
- },
322
- col.key
323
- ))
324
- }
325
- ),
326
- rows.map((row, i) => {
327
- const key = keyExtractor(row);
328
- const bg = rowBg(row, i, key);
329
- return withRowDetail(
891
+ return /* @__PURE__ */ jsxRuntime.jsxs(
892
+ reactNative.View,
893
+ {
894
+ style: [tableStyles.wrap, frame, o?.wrap],
895
+ testID,
896
+ ...keyboardNavigation ? { role: "grid" } : null,
897
+ children: [
898
+ banner,
330
899
  /* @__PURE__ */ jsxRuntime.jsx(
331
- reactNative.Pressable,
900
+ TableHeader,
332
901
  {
333
- testID: rowID(key),
334
- onPress: onRowPress ? () => onRowPress(row) : void 0,
335
- ...hoverHandlers(key),
336
- ...rowA11y(row, key),
337
- style: [tableStyles.row, { borderTopColor: colors.border }, bg ? { backgroundColor: bg } : null, o?.row],
338
- children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(DesktopCell, { column: col, row, textColor: colors.text, testID: `${rowID(key)}-${col.key}`, styleOverrides: o }, col.key))
339
- },
340
- key
902
+ columns,
903
+ inGrid: keyboardNavigation,
904
+ selection: selection.selectable ? { state: selection.headerState, onToggleAll: selection.toggleAll, testID: selectAllTestID(testID) } : void 0,
905
+ stickyHeader,
906
+ styleOverrides: o
907
+ }
341
908
  ),
342
- row,
343
- key
344
- );
345
- })
346
- ] });
909
+ rows.map((row, i) => {
910
+ const key = rowKeys[i] ?? keyExtractor(row);
911
+ const bg = rowBg(row, i, key);
912
+ return renderRow(row, key, [tableStyles.row, { borderTopColor: colors.border }, bg ? { backgroundColor: bg } : null, o?.row]);
913
+ })
914
+ ]
915
+ }
916
+ );
347
917
  }
348
918
  var RESULTS_COUNT_WEIGHT = "700";
349
919
  function FilterBar({
@@ -379,11 +949,11 @@ function FilterBar({
379
949
  }
380
950
  var CHEVRON_DOWN = "\u25BE";
381
951
  var CHEVRON_UP = "\u25B4";
382
- var IS_WEB = reactNative.Platform.OS === "web";
952
+ var IS_WEB2 = reactNative.Platform.OS === "web";
383
953
  var MENU_TOP_GAP2 = 4;
384
954
  var VIEWPORT_EDGE = 0;
385
955
  function readTriggerRect(anchorRef) {
386
- if (!IS_WEB) return null;
956
+ if (!IS_WEB2) return null;
387
957
  const node = anchorRef.current;
388
958
  if (node === null || typeof node.getBoundingClientRect !== "function") return null;
389
959
  const r = node.getBoundingClientRect();
@@ -399,9 +969,9 @@ function buildWebFixedStyle(rect, viewportWidth) {
399
969
  };
400
970
  }
401
971
  function useTriggerRect(anchorRef, isOpen) {
402
- const [rect, setRect] = React2.useState(null);
403
- React2.useLayoutEffect(() => {
404
- if (!IS_WEB || !isOpen) return void 0;
972
+ const [rect, setRect] = react.useState(null);
973
+ react.useLayoutEffect(() => {
974
+ if (!IS_WEB2 || !isOpen) return void 0;
405
975
  const measure = () => {
406
976
  setRect(readTriggerRect(anchorRef));
407
977
  };
@@ -416,8 +986,8 @@ function useTriggerRect(anchorRef, isOpen) {
416
986
  return rect;
417
987
  }
418
988
  function useDismissOnOutside(anchorRef, menuRef, isOpen, onClose) {
419
- React2.useEffect(() => {
420
- if (!IS_WEB || !isOpen) return void 0;
989
+ react.useEffect(() => {
990
+ if (!IS_WEB2 || !isOpen) return void 0;
421
991
  const onMouseDown = (event) => {
422
992
  const anchorNode = anchorRef.current;
423
993
  const menuNode = menuRef.current;
@@ -452,16 +1022,16 @@ function SizeDropdown({
452
1022
  triggerStyle,
453
1023
  triggerTextStyle
454
1024
  }) {
455
- const anchorRef = React2.useRef(null);
456
- const menuRef = React2.useRef(null);
457
- const [isOpen, setIsOpen] = React2.useState(false);
458
- const close = React2.useCallback(() => {
1025
+ const anchorRef = react.useRef(null);
1026
+ const menuRef = react.useRef(null);
1027
+ const [isOpen, setIsOpen] = react.useState(false);
1028
+ const close = react.useCallback(() => {
459
1029
  setIsOpen(false);
460
1030
  }, []);
461
- const toggle = React2.useCallback(() => {
1031
+ const toggle = react.useCallback(() => {
462
1032
  setIsOpen((prev) => !prev);
463
1033
  }, []);
464
- const select = React2.useCallback(
1034
+ const select = react.useCallback(
465
1035
  (size) => {
466
1036
  onPageSizeChange(size);
467
1037
  setIsOpen(false);
@@ -470,7 +1040,7 @@ function SizeDropdown({
470
1040
  );
471
1041
  const rect = useTriggerRect(anchorRef, isOpen);
472
1042
  useDismissOnOutside(anchorRef, menuRef, isOpen, close);
473
- const webFixedStyle = IS_WEB && rect !== null ? buildWebFixedStyle(rect, window.innerWidth) : null;
1043
+ const webFixedStyle = IS_WEB2 && rect !== null ? buildWebFixedStyle(rect, window.innerWidth) : null;
474
1044
  const menu = /* @__PURE__ */ jsxRuntime.jsx(
475
1045
  reactNative.View,
476
1046
  {
@@ -515,14 +1085,14 @@ function SizeDropdown({
515
1085
  ]
516
1086
  }
517
1087
  ),
518
- isOpen ? IS_WEB ? reactDom.createPortal(menu, document.body) : menu : null
1088
+ isOpen ? IS_WEB2 ? reactDom.createPortal(menu, document.body) : menu : null
519
1089
  ] });
520
1090
  }
521
1091
  var FIRST_PAGE = 1;
522
1092
  var EN_DASH = "\u2013";
523
1093
  var DISABLED_OPACITY = 0.4;
524
1094
  var FULL_OPACITY = 1;
525
- var TRANSPARENT = "transparent";
1095
+ var TRANSPARENT2 = "transparent";
526
1096
  var BOLD = "700";
527
1097
  var PAGER_HIT_SLOP = { top: 10, bottom: 10 };
528
1098
  function NavButton({ label, hint, disabled, onPress, color, border, testID, styleOverrides: o }) {
@@ -619,7 +1189,7 @@ function Pager({
619
1189
  accessibilityState: { selected: active },
620
1190
  hitSlop: PAGER_HIT_SLOP,
621
1191
  onPress: () => onPageSizeChange(size),
622
- style: [chromeStyles.sizePill, { borderColor: active ? brand : colors.border, backgroundColor: active ? brand : TRANSPARENT }, o?.sizePill],
1192
+ style: [chromeStyles.sizePill, { borderColor: active ? brand : colors.border, backgroundColor: active ? brand : TRANSPARENT2 }, o?.sizePill],
623
1193
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [chromeStyles.sizePillText, { color: active ? colors.surface : colors.textSecondary }, o?.sizePillText], children: size })
624
1194
  },
625
1195
  size
@@ -664,6 +1234,8 @@ exports.StatCard = StatCard;
664
1234
  exports.TABLE_I18N = TABLE_I18N;
665
1235
  exports.TABLE_TEST_IDS = TABLE_TEST_IDS;
666
1236
  exports.rowDetailTestID = rowDetailTestID;
1237
+ exports.rowSelectTestID = rowSelectTestID;
667
1238
  exports.rowTestID = rowTestID;
1239
+ exports.selectAllTestID = selectAllTestID;
668
1240
  //# sourceMappingURL=index.js.map
669
1241
  //# sourceMappingURL=index.js.map