@dloizides/ui-tables 1.21.1 → 1.22.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.22.0
4
+
5
+ **`StatusLedger` opens a row's detail inline, under the row (JOBS-INLINE-1 "Ledger run history opens under its row").**
6
+
7
+ New optional `renderRowDetail(row)` + controlled `expandedRowKey` on `StatusLedger`, passed to the
8
+ `DataTable` in the wide table and in both narrow "needs a look" sections, so the detail sits
9
+ directly under the pressed row or card. The expanded row carries `aria-expanded`; the detail region
10
+ is named by `getRowAccessibilityLabel`. `DataTable` gains `getRowDetailAccessibilityLabel` (defaults
11
+ to the generic `uiTables.rowDetail`). Additive, nothing existing changes.
12
+
3
13
  ## 1.21.0
4
14
 
5
15
  **New `StatusLedger` (JOBS-UX-1 "Jobs page: one clear, consistent view of every job and source").**
package/dist/index.d.mts CHANGED
@@ -102,6 +102,8 @@ interface DataTableProps<T> {
102
102
  * Omit for a plain table (nothing about the row rendering changes).
103
103
  */
104
104
  renderRowDetail?: (row: T) => React.ReactNode;
105
+ /** Accessible name of a row's detail panel; defaults to the generic `uiTables.rowDetail`. */
106
+ getRowDetailAccessibilityLabel?: (row: T) => string;
105
107
  /**
106
108
  * Keys (as produced by `keyExtractor`) of the rows currently expanded. Expansion
107
109
  * is CONTROLLED by the caller: own the state, toggle it from `onRowPress`. The
@@ -839,6 +841,10 @@ interface StatusLedgerProps<T> {
839
841
  getRowAccessibilityLabel?: (row: T) => string;
840
842
  onRowPress?: (row: T) => void;
841
843
  renderActions?: (row: T) => React.ReactNode;
844
+ /** Renders a detail region directly under the expanded row (table and card layouts); labelled by `getRowAccessibilityLabel`. */
845
+ renderRowDetail?: (row: T) => React.ReactNode;
846
+ /** Key of the expanded row (CONTROLLED: toggle it from `onRowPress`); `null`/omitted = none. */
847
+ expandedRowKey?: string | null;
842
848
  toneColors?: ToneColors;
843
849
  layout?: LedgerLayout;
844
850
  breakpoint?: number;
package/dist/index.d.ts CHANGED
@@ -102,6 +102,8 @@ interface DataTableProps<T> {
102
102
  * Omit for a plain table (nothing about the row rendering changes).
103
103
  */
104
104
  renderRowDetail?: (row: T) => React.ReactNode;
105
+ /** Accessible name of a row's detail panel; defaults to the generic `uiTables.rowDetail`. */
106
+ getRowDetailAccessibilityLabel?: (row: T) => string;
105
107
  /**
106
108
  * Keys (as produced by `keyExtractor`) of the rows currently expanded. Expansion
107
109
  * is CONTROLLED by the caller: own the state, toggle it from `onRowPress`. The
@@ -839,6 +841,10 @@ interface StatusLedgerProps<T> {
839
841
  getRowAccessibilityLabel?: (row: T) => string;
840
842
  onRowPress?: (row: T) => void;
841
843
  renderActions?: (row: T) => React.ReactNode;
844
+ /** Renders a detail region directly under the expanded row (table and card layouts); labelled by `getRowAccessibilityLabel`. */
845
+ renderRowDetail?: (row: T) => React.ReactNode;
846
+ /** Key of the expanded row (CONTROLLED: toggle it from `onRowPress`); `null`/omitted = none. */
847
+ expandedRowKey?: string | null;
842
848
  toneColors?: ToneColors;
843
849
  layout?: LedgerLayout;
844
850
  breakpoint?: number;
package/dist/index.js CHANGED
@@ -488,6 +488,7 @@ function DataTableRow({
488
488
  onRowPress,
489
489
  getRowAccessibilityLabel,
490
490
  renderRowDetail,
491
+ getRowDetailAccessibilityLabel,
491
492
  expanded,
492
493
  onHoverIn,
493
494
  onHoverOut,
@@ -560,7 +561,7 @@ function DataTableRow({
560
561
  /* @__PURE__ */ jsxRuntime.jsx(
561
562
  reactNative.View,
562
563
  {
563
- accessibilityLabel: t(TABLE_I18N.rowDetail),
564
+ accessibilityLabel: getRowDetailAccessibilityLabel?.(row) ?? t(TABLE_I18N.rowDetail),
564
565
  accessibilityRole: "summary",
565
566
  style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
566
567
  testID: rowDetailTestID(tableTestID, rowKey),
@@ -858,6 +859,7 @@ function DataTable(props) {
858
859
  loadingLabel,
859
860
  emptyLabel,
860
861
  renderRowDetail,
862
+ getRowDetailAccessibilityLabel,
861
863
  expandedRowKeys,
862
864
  styleOverrides: o,
863
865
  selectedRowKeys,
@@ -922,6 +924,7 @@ function DataTable(props) {
922
924
  columns,
923
925
  expanded: expandedRowKeys?.includes(key) ?? false,
924
926
  getRowAccessibilityLabel,
927
+ getRowDetailAccessibilityLabel,
925
928
  keyboardNavigation,
926
929
  renderRowDetail,
927
930
  roving,
@@ -2015,6 +2018,7 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
2015
2018
  var GAP = 12;
2016
2019
  var HEADING_FONT = 15;
2017
2020
  var HEADING_WEIGHT = "700";
2021
+ var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
2018
2022
  var styles3 = reactNative.StyleSheet.create({
2019
2023
  root: { gap: GAP },
2020
2024
  heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
@@ -2028,9 +2032,12 @@ function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
2028
2032
  DataTable,
2029
2033
  {
2030
2034
  columns,
2035
+ expandedRowKeys: expandedKeys(ledger.expandedRowKey),
2031
2036
  getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
2037
+ getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
2032
2038
  keyExtractor: ledger.keyExtractor,
2033
2039
  onRowPress: ledger.onRowPress,
2040
+ renderRowDetail: ledger.renderRowDetail,
2034
2041
  rows,
2035
2042
  stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
2036
2043
  testID: `${testID}-table`
@@ -2078,10 +2085,13 @@ function StatusLedger(props) {
2078
2085
  {
2079
2086
  columns: view.tableColumns,
2080
2087
  emptyLabel: labels.empty,
2088
+ expandedRowKeys: expandedKeys(props.expandedRowKey),
2081
2089
  getRowAccessibilityLabel: props.getRowAccessibilityLabel,
2090
+ getRowDetailAccessibilityLabel: props.getRowAccessibilityLabel,
2082
2091
  keyExtractor: props.keyExtractor,
2083
2092
  loading,
2084
2093
  onRowPress: props.onRowPress,
2094
+ renderRowDetail: props.renderRowDetail,
2085
2095
  rows: view.visible,
2086
2096
  stackBreakpoint: feed ? breakpoint : 0,
2087
2097
  testID: `${testID}-table`