@dloizides/ui-tables 1.15.0 → 1.16.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.mjs CHANGED
@@ -9,7 +9,7 @@ export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, isUnmat
9
9
  // src/StatCard/StatCard.tsx
10
10
 
11
11
  // src/DataTable/constants.ts
12
- var CARD_STACK_BREAKPOINT = 640;
12
+ var CARD_STACK_BREAKPOINT = 768;
13
13
  var DEFAULT_PAGE_SIZE_OPTIONS = [25, 50, 100, 200];
14
14
  var TABLE_TEST_IDS = {
15
15
  root: "ui-data-table",
@@ -149,8 +149,8 @@ var STATE_PAD_V = 34;
149
149
  var HEAD_FONT = 12;
150
150
  var CELL_FONT = 14;
151
151
  var STATE_FONT = 14;
152
- var CARD_LINE_PAD_V = 3;
153
- var CARD_LINE_GAP = 12;
152
+ var CARD_LINE_PAD_V = 5;
153
+ var CARD_LABEL_GAP = 3;
154
154
  var PILL_RADIUS = 999;
155
155
  var PAGER_GAP = 8;
156
156
  var PAGER_SIZE_GAP = 6;
@@ -204,9 +204,22 @@ var tableStyles = StyleSheet.create({
204
204
  /** Full-width panel under an expanded row — spans every column (the wrap is a column flexbox). */
205
205
  rowDetail: { width: FULL_WIDTH, paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V, borderTopWidth: BORDER_WIDTH },
206
206
  card: { paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V, borderTopWidth: BORDER_WIDTH },
207
- cardLine: { flexDirection: "row", justifyContent: "space-between", alignItems: "baseline", paddingVertical: CARD_LINE_PAD_V, gap: CARD_LINE_GAP },
207
+ /**
208
+ * A card line is a VERTICAL label:value pair — the header sits ABOVE its value, both
209
+ * left-aligned, so a narrow phone column never cramps the value against the label the
210
+ * way the old `space-between` row did (an Actions cell of buttons or a long text value
211
+ * now gets the full card width). `paddingVertical` gives the stacked lines their rhythm.
212
+ */
213
+ cardLine: { flexDirection: "column", alignItems: "stretch", paddingVertical: CARD_LINE_PAD_V, gap: CARD_LABEL_GAP },
208
214
  cardLabel: { fontSize: HEAD_FONT, fontWeight: "600", textTransform: "uppercase", letterSpacing: LABEL_LETTER_SPACING },
209
- cardValue: { flexShrink: 1, alignItems: "flex-end" }
215
+ cardValue: { alignItems: "flex-start" },
216
+ /**
217
+ * A zero-footprint carrier for the `ui-data-table-head` test id in the card-stack layout
218
+ * (which has no visible header row). `display: 'none'` keeps it out of layout AND the
219
+ * accessibility tree, while the `data-testid` stays queryable — so an E2E selector that
220
+ * targets the head survives at every viewport width.
221
+ */
222
+ headSentinel: { display: "none" }
210
223
  });
211
224
  var selectionStyles = StyleSheet.create({
212
225
  /** The fixed-width gutter holding the checkbox, in both the header and every row. */
@@ -313,10 +326,15 @@ function RowCells({
313
326
  styleOverrides: o
314
327
  }) {
315
328
  if (stacked) {
316
- return /* @__PURE__ */ jsx(Fragment, { children: columns.map((col) => /* @__PURE__ */ jsxs(View, { style: [tableStyles.cardLine, o?.cardLine], children: [
317
- /* @__PURE__ */ jsx(Text, { style: [tableStyles.cardLabel, { color: labelColor }, o?.cardLabel], children: col.header }),
318
- /* @__PURE__ */ jsx(View, { style: [tableStyles.cardValue, o?.cardValue], children: cellContent(col, row, textColor, o) })
319
- ] }, col.key)) });
329
+ return /* @__PURE__ */ jsx(Fragment, { children: columns.map((col) => (
330
+ // The SAME per-cell test id the desktop cell carries (`${rowTestID}-${col.key}`),
331
+ // so an E2E selector like `${rowTestID}-${col.key}` resolves in BOTH layouts — the
332
+ // card-stack must not silently drop the hooks a wide-viewport test relies on.
333
+ /* @__PURE__ */ jsxs(View, { style: [tableStyles.cardLine, o?.cardLine], testID: `${rowTestID2}-${col.key}`, children: [
334
+ /* @__PURE__ */ jsx(Text, { style: [tableStyles.cardLabel, { color: labelColor }, o?.cardLabel], children: col.header }),
335
+ /* @__PURE__ */ jsx(View, { style: [tableStyles.cardValue, o?.cardValue], children: cellContent(col, row, textColor, o) })
336
+ ] }, col.key)
337
+ )) });
320
338
  }
321
339
  return /* @__PURE__ */ jsx(Fragment, { children: columns.map((col) => /* @__PURE__ */ jsx(
322
340
  DesktopCell,
@@ -900,6 +918,7 @@ function DataTable(props) {
900
918
  if (stacked) {
901
919
  return /* @__PURE__ */ jsxs(View, { style: [tableStyles.wrap, frame, o?.wrap], testID, "aria-busy": loading, children: [
902
920
  banner,
921
+ /* @__PURE__ */ jsx(View, { style: tableStyles.headSentinel, testID: TABLE_TEST_IDS.head, "aria-hidden": true }),
903
922
  rows.map((row, i) => {
904
923
  const key = rowKeys[i] ?? keyExtractor(row);
905
924
  const bg = rowBg(row, i, key);