@dloizides/ui-tables 1.14.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/CHANGELOG.md +68 -0
- package/README.md +14 -4
- package/dist/index.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +33 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 =
|
|
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 =
|
|
153
|
-
var
|
|
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
|
-
|
|
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: {
|
|
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) =>
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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,
|
|
@@ -860,8 +878,9 @@ function DataTable(props) {
|
|
|
860
878
|
);
|
|
861
879
|
const rowBg = (row, index, key) => interactive && hoveredKey === key ? hoverTint : rowBackground(row, index);
|
|
862
880
|
const stateView = (label) => /* @__PURE__ */ jsx(View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: /* @__PURE__ */ jsx(View, { style: [tableStyles.state, o?.state], children: /* @__PURE__ */ jsx(Text, { style: [tableStyles.stateText, { color: colors.textSecondary }, o?.stateText], children: label }) }) });
|
|
863
|
-
if (
|
|
864
|
-
|
|
881
|
+
if (rows.length === 0) {
|
|
882
|
+
return stateView(loading ? loadingLabel ?? t(TABLE_I18N.loading) : emptyLabel ?? t(TABLE_I18N.empty));
|
|
883
|
+
}
|
|
865
884
|
const renderRow = (row, key, style) => /* @__PURE__ */ jsx(
|
|
866
885
|
DataTableRow,
|
|
867
886
|
{
|
|
@@ -897,8 +916,9 @@ function DataTable(props) {
|
|
|
897
916
|
}
|
|
898
917
|
);
|
|
899
918
|
if (stacked) {
|
|
900
|
-
return /* @__PURE__ */ jsxs(View, { style: [tableStyles.wrap, frame, o?.wrap], testID, children: [
|
|
919
|
+
return /* @__PURE__ */ jsxs(View, { style: [tableStyles.wrap, frame, o?.wrap], testID, "aria-busy": loading, children: [
|
|
901
920
|
banner,
|
|
921
|
+
/* @__PURE__ */ jsx(View, { style: tableStyles.headSentinel, testID: TABLE_TEST_IDS.head, "aria-hidden": true }),
|
|
902
922
|
rows.map((row, i) => {
|
|
903
923
|
const key = rowKeys[i] ?? keyExtractor(row);
|
|
904
924
|
const bg = rowBg(row, i, key);
|
|
@@ -919,6 +939,7 @@ function DataTable(props) {
|
|
|
919
939
|
{
|
|
920
940
|
style: [tableStyles.wrap, frame, o?.wrap],
|
|
921
941
|
testID,
|
|
942
|
+
"aria-busy": loading,
|
|
922
943
|
...keyboardNavigation ? { role: "grid" } : null,
|
|
923
944
|
children: [
|
|
924
945
|
banner,
|