@dloizides/ui-tables 1.29.0 → 1.29.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.29.1
4
+
5
+ ### Changed
6
+
7
+ - `PagedTableLayoutKind` is now a `const enum` exported like `LedgerLayout`, with the same four values. The `layout` prop also accepts the string values, so `isolatedModules` consumers keep writing `layout="spaced"`. D-PAGER-3 "Layout type is a const enum" in PAGER-SPACE-1 "Shared pager touches the content above and below it".
8
+
9
+ ### Fixed
10
+
11
+ - `DataTable`: a table or filter bar rendered inside a row (column render, row detail, or a modal opened from one) keeps its own border under a joined `PagedTableLayout`.
12
+
3
13
  ## 1.29.0
4
14
 
5
15
  ### Added
package/dist/index.d.mts CHANGED
@@ -389,7 +389,12 @@ interface PagerProps {
389
389
  }
390
390
  declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, rowsVariant, unitLabel, unitLabelSingular, showFirstLast, responsive, stackBreakpoint, infoPrefix, boldNumbers, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
391
391
 
392
- type PagedTableLayoutKind = 'toolbar' | 'spaced' | 'footer' | 'panel';
392
+ declare const enum PagedTableLayoutKind {
393
+ Toolbar = "toolbar",
394
+ Spaced = "spaced",
395
+ Footer = "footer",
396
+ Panel = "panel"
397
+ }
393
398
 
394
399
  interface PagedTableLayoutProps {
395
400
  /** Filter bar, shown above the pager and table. Omit for none. */
@@ -397,7 +402,7 @@ interface PagedTableLayoutProps {
397
402
  pager: React.ReactNode;
398
403
  table: React.ReactNode;
399
404
  /** How the pager joins the table. Default `toolbar`. */
400
- layout?: PagedTableLayoutKind;
405
+ layout?: PagedTableLayoutKind | `${PagedTableLayoutKind}`;
401
406
  testID?: string;
402
407
  }
403
408
  /** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
@@ -984,4 +989,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
984
989
  /** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
985
990
  declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
986
991
 
987
- export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, type DateRangeFilterField, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type NumberFilterField, type PagedRows, PagedTableLayout, type PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
992
+ export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, type DateRangeFilterField, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type NumberFilterField, type PagedRows, PagedTableLayout, PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
package/dist/index.d.ts CHANGED
@@ -389,7 +389,12 @@ interface PagerProps {
389
389
  }
390
390
  declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, rowsVariant, unitLabel, unitLabelSingular, showFirstLast, responsive, stackBreakpoint, infoPrefix, boldNumbers, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
391
391
 
392
- type PagedTableLayoutKind = 'toolbar' | 'spaced' | 'footer' | 'panel';
392
+ declare const enum PagedTableLayoutKind {
393
+ Toolbar = "toolbar",
394
+ Spaced = "spaced",
395
+ Footer = "footer",
396
+ Panel = "panel"
397
+ }
393
398
 
394
399
  interface PagedTableLayoutProps {
395
400
  /** Filter bar, shown above the pager and table. Omit for none. */
@@ -397,7 +402,7 @@ interface PagedTableLayoutProps {
397
402
  pager: React.ReactNode;
398
403
  table: React.ReactNode;
399
404
  /** How the pager joins the table. Default `toolbar`. */
400
- layout?: PagedTableLayoutKind;
405
+ layout?: PagedTableLayoutKind | `${PagedTableLayoutKind}`;
401
406
  testID?: string;
402
407
  }
403
408
  /** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
@@ -984,4 +989,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
984
989
  /** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
985
990
  declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
986
991
 
987
- export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, type DateRangeFilterField, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type NumberFilterField, type PagedRows, PagedTableLayout, type PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
992
+ export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableColumn, type DataTableProps, type DataTableStyleOverrides, type DateRangeFilterField, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type NumberFilterField, type PagedRows, PagedTableLayout, PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
package/dist/index.js CHANGED
@@ -333,23 +333,6 @@ var chromeStyles = reactNative.StyleSheet.create({
333
333
  sizeOption: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: MENU_OPT_PAD_V },
334
334
  sizeOptionText: { fontSize: CONTROL_FONT, fontVariant: ["tabular-nums"] }
335
335
  });
336
-
337
- // src/DataTable/joinedFrameContext.ts
338
- var SQUARE = 0;
339
- var INNER_RADIUS = BORDER_RADIUS - BORDER_WIDTH;
340
- var NO_OUTER_BORDER = { borderTopWidth: 0, borderRightWidth: 0, borderBottomWidth: 0, borderLeftWidth: 0 };
341
- function cornerRadii(top, bottom) {
342
- return { borderTopLeftRadius: top, borderTopRightRadius: top, borderBottomLeftRadius: bottom, borderBottomRightRadius: bottom };
343
- }
344
- var AT_FRAME_TOP = { ...NO_OUTER_BORDER, ...cornerRadii(INNER_RADIUS, SQUARE) };
345
- var AT_FRAME_BOTTOM = { ...NO_OUTER_BORDER, ...cornerRadii(SQUARE, INNER_RADIUS) };
346
- var JOINED_FRAME_STYLES = {
347
- toolbar: { wrap: AT_FRAME_BOTTOM },
348
- spaced: null,
349
- footer: { wrap: AT_FRAME_TOP },
350
- panel: { wrap: AT_FRAME_BOTTOM, filters: AT_FRAME_TOP }
351
- };
352
- var JoinedFrameContext = React2.createContext(null);
353
336
  function cellContent(column, row, textColor, overrides) {
354
337
  const content = column.render(row);
355
338
  if (typeof content === "string" || typeof content === "number") {
@@ -605,11 +588,37 @@ function DataTableRow({
605
588
  accessibilityRole: "summary",
606
589
  style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
607
590
  testID: rowDetailTestID(tableTestID, rowKey),
608
- children: /* @__PURE__ */ jsxRuntime.jsx(JoinedFrameContext.Provider, { value: null, children: renderRowDetail(row) })
591
+ children: renderRowDetail(row)
609
592
  }
610
593
  )
611
594
  ] });
612
595
  }
596
+
597
+ // src/DataTable/PagedTableLayoutKind.ts
598
+ var PagedTableLayoutKind = /* @__PURE__ */ ((PagedTableLayoutKind2) => {
599
+ PagedTableLayoutKind2["Toolbar"] = "toolbar";
600
+ PagedTableLayoutKind2["Spaced"] = "spaced";
601
+ PagedTableLayoutKind2["Footer"] = "footer";
602
+ PagedTableLayoutKind2["Panel"] = "panel";
603
+ return PagedTableLayoutKind2;
604
+ })(PagedTableLayoutKind || {});
605
+
606
+ // src/DataTable/joinedFrameContext.ts
607
+ var SQUARE = 0;
608
+ var INNER_RADIUS = BORDER_RADIUS - BORDER_WIDTH;
609
+ var NO_OUTER_BORDER = { borderTopWidth: 0, borderRightWidth: 0, borderBottomWidth: 0, borderLeftWidth: 0 };
610
+ function cornerRadii(top, bottom) {
611
+ return { borderTopLeftRadius: top, borderTopRightRadius: top, borderBottomLeftRadius: bottom, borderBottomRightRadius: bottom };
612
+ }
613
+ var AT_FRAME_TOP = { ...NO_OUTER_BORDER, ...cornerRadii(INNER_RADIUS, SQUARE) };
614
+ var AT_FRAME_BOTTOM = { ...NO_OUTER_BORDER, ...cornerRadii(SQUARE, INNER_RADIUS) };
615
+ var JOINED_FRAME_STYLES = {
616
+ ["toolbar" /* Toolbar */]: { wrap: AT_FRAME_BOTTOM },
617
+ ["spaced" /* Spaced */]: null,
618
+ ["footer" /* Footer */]: { wrap: AT_FRAME_TOP },
619
+ ["panel" /* Panel */]: { wrap: AT_FRAME_BOTTOM, filters: AT_FRAME_TOP }
620
+ };
621
+ var JoinedFrameContext = React2.createContext(null);
613
622
  function SelectAllBanner({
614
623
  mode,
615
624
  pageCount,
@@ -981,8 +990,9 @@ function DataTable(props) {
981
990
  onRowPress
982
991
  }
983
992
  );
984
- if (!animateRowEntrance) return /* @__PURE__ */ jsxRuntime.jsx(React2__default.default.Fragment, { children: node }, key);
985
- return /* @__PURE__ */ jsxRuntime.jsx(uiMotion.FadeIn, { delay: rowEntranceDelayMs(index), testID: rowFadeTestID(testID, key), children: node }, key);
993
+ const detachedFromFrame = /* @__PURE__ */ jsxRuntime.jsx(JoinedFrameContext.Provider, { value: null, children: node });
994
+ if (!animateRowEntrance) return /* @__PURE__ */ jsxRuntime.jsx(React2__default.default.Fragment, { children: detachedFromFrame }, key);
995
+ return /* @__PURE__ */ jsxRuntime.jsx(uiMotion.FadeIn, { delay: rowEntranceDelayMs(index), testID: rowFadeTestID(testID, key), children: detachedFromFrame }, key);
986
996
  };
987
997
  const banner = /* @__PURE__ */ jsxRuntime.jsx(
988
998
  SelectAllBanner,
@@ -1453,28 +1463,28 @@ var PAGER_SLOT_PAD_V = 8;
1453
1463
  var PAGER_IN_FRAME = { paddingHorizontal: ROW_PAD_H, paddingVertical: PAGER_SLOT_PAD_V };
1454
1464
  var FRAME = { borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS };
1455
1465
  var SLOT_STYLES = {
1456
- toolbar: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } },
1457
- spaced: { filters: {}, pager: { marginTop: LAYOUT_GAP, marginBottom: LAYOUT_GAP } },
1458
- footer: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderTopWidth: BORDER_WIDTH } },
1459
- panel: { filters: { borderBottomWidth: BORDER_WIDTH }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } }
1466
+ ["toolbar" /* Toolbar */]: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } },
1467
+ ["spaced" /* Spaced */]: { filters: {}, pager: { marginTop: LAYOUT_GAP, marginBottom: LAYOUT_GAP } },
1468
+ ["footer" /* Footer */]: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderTopWidth: BORDER_WIDTH } },
1469
+ ["panel" /* Panel */]: { filters: { borderBottomWidth: BORDER_WIDTH }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } }
1460
1470
  };
1461
1471
  function PagedTableLayout({
1462
1472
  filters,
1463
1473
  pager,
1464
1474
  table,
1465
- layout = "toolbar",
1475
+ layout = "toolbar" /* Toolbar */,
1466
1476
  testID = TABLE_TEST_IDS.pagedLayout
1467
1477
  }) {
1468
1478
  const { colors } = uiFeedback.useUi().theme;
1469
1479
  const slots = SLOT_STYLES[layout];
1470
1480
  const line = { borderColor: colors.border };
1471
1481
  const hasFilters = filters !== void 0 && filters !== null && filters !== false;
1472
- const filtersInFrame = layout === "panel";
1473
- const isJoined = layout !== "spaced";
1482
+ const filtersInFrame = layout === "panel" /* Panel */;
1483
+ const isJoined = layout !== "spaced" /* Spaced */;
1474
1484
  const filtersSlot = hasFilters ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.filters, line], testID: `${testID}-filters`, children: filters }) : null;
1475
1485
  const pagerSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.pager, line], testID: `${testID}-pager`, children: pager });
1476
1486
  const tableSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-table`, children: table });
1477
- const pagerAndTable = layout === "footer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1487
+ const pagerAndTable = layout === "footer" /* Footer */ ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1478
1488
  tableSlot,
1479
1489
  pagerSlot
1480
1490
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -2385,6 +2395,7 @@ exports.MONTH_STATUS_GRID_TEST_ID = MONTH_STATUS_GRID_TEST_ID;
2385
2395
  exports.MonthGridColumns = MonthGridColumns;
2386
2396
  exports.MonthStatusGrid = MonthStatusGrid;
2387
2397
  exports.PagedTableLayout = PagedTableLayout;
2398
+ exports.PagedTableLayoutKind = PagedTableLayoutKind;
2388
2399
  exports.Pager = Pager;
2389
2400
  exports.RelativeTime = RelativeTime;
2390
2401
  exports.STATUS_LEDGER_TEST_ID = STATUS_LEDGER_TEST_ID;