@dloizides/ui-tables 1.28.0 → 1.29.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 +12 -0
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +89 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.29.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `PagedTableLayout`: `filters`, `pager` and `table` slots placed as one unit, with a `layout` of `toolbar` (default), `spaced`, `footer` or `panel`. Joined layouts share one frame; a `DataTable` or `FilterBar` inside drops its own outer border automatically, even behind a local wrapper component. A bare `Pager` is unchanged. PAGER-SPACE-1 "Shared pager touches the content above and below it".
|
|
8
|
+
|
|
9
|
+
## 1.28.1
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `Filters` text and number fields: `accessibilityHint` now reaches the DOM input on react-native-web as `aria-describedby` pointing at a visually hidden node (`useA11y` from `@dloizides/a11y`, now a direct dependency). FINREG-CRM-ORG-1 "CRM organization column, filter and search".
|
|
14
|
+
|
|
3
15
|
## 1.28.0
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/dist/index.d.mts
CHANGED
|
@@ -389,6 +389,20 @@ 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';
|
|
393
|
+
|
|
394
|
+
interface PagedTableLayoutProps {
|
|
395
|
+
/** Filter bar, shown above the pager and table. Omit for none. */
|
|
396
|
+
filters?: React.ReactNode;
|
|
397
|
+
pager: React.ReactNode;
|
|
398
|
+
table: React.ReactNode;
|
|
399
|
+
/** How the pager joins the table. Default `toolbar`. */
|
|
400
|
+
layout?: PagedTableLayoutKind;
|
|
401
|
+
testID?: string;
|
|
402
|
+
}
|
|
403
|
+
/** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
|
|
404
|
+
declare function PagedTableLayout({ filters, pager, table, layout, testID, }: PagedTableLayoutProps): React.ReactElement;
|
|
405
|
+
|
|
392
406
|
/**
|
|
393
407
|
* Shared constants for the DataTable family (DataTable / FilterBar / Pager).
|
|
394
408
|
* Keeps every literal (test ids, i18n keys, layout numbers) in one place so the
|
|
@@ -426,6 +440,7 @@ declare const TABLE_TEST_IDS: {
|
|
|
426
440
|
/** Suffix of the banner's action: `${tableTestID}-select-banner-action`. */
|
|
427
441
|
readonly selectBannerActionSuffix: "select-banner-action";
|
|
428
442
|
readonly filterBar: "ui-filters";
|
|
443
|
+
readonly pagedLayout: "ui-paged-table-layout";
|
|
429
444
|
readonly results: "ui-results";
|
|
430
445
|
readonly pager: "ui-pager";
|
|
431
446
|
readonly pagerInfo: "ui-pager-info";
|
|
@@ -969,4 +984,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
969
984
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
970
985
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
971
986
|
|
|
972
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -389,6 +389,20 @@ 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';
|
|
393
|
+
|
|
394
|
+
interface PagedTableLayoutProps {
|
|
395
|
+
/** Filter bar, shown above the pager and table. Omit for none. */
|
|
396
|
+
filters?: React.ReactNode;
|
|
397
|
+
pager: React.ReactNode;
|
|
398
|
+
table: React.ReactNode;
|
|
399
|
+
/** How the pager joins the table. Default `toolbar`. */
|
|
400
|
+
layout?: PagedTableLayoutKind;
|
|
401
|
+
testID?: string;
|
|
402
|
+
}
|
|
403
|
+
/** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
|
|
404
|
+
declare function PagedTableLayout({ filters, pager, table, layout, testID, }: PagedTableLayoutProps): React.ReactElement;
|
|
405
|
+
|
|
392
406
|
/**
|
|
393
407
|
* Shared constants for the DataTable family (DataTable / FilterBar / Pager).
|
|
394
408
|
* Keeps every literal (test ids, i18n keys, layout numbers) in one place so the
|
|
@@ -426,6 +440,7 @@ declare const TABLE_TEST_IDS: {
|
|
|
426
440
|
/** Suffix of the banner's action: `${tableTestID}-select-banner-action`. */
|
|
427
441
|
readonly selectBannerActionSuffix: "select-banner-action";
|
|
428
442
|
readonly filterBar: "ui-filters";
|
|
443
|
+
readonly pagedLayout: "ui-paged-table-layout";
|
|
429
444
|
readonly results: "ui-results";
|
|
430
445
|
readonly pager: "ui-pager";
|
|
431
446
|
readonly pagerInfo: "ui-pager-info";
|
|
@@ -969,4 +984,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
969
984
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
970
985
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
971
986
|
|
|
972
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var uiMotion = require('@dloizides/ui-motion');
|
|
|
8
8
|
var designTokens = require('@dloizides/design-tokens');
|
|
9
9
|
var reactDom = require('react-dom');
|
|
10
10
|
var uiForms = require('@dloizides/ui-forms');
|
|
11
|
+
var a11y = require('@dloizides/a11y');
|
|
11
12
|
|
|
12
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
|
|
@@ -39,6 +40,7 @@ var TABLE_TEST_IDS = {
|
|
|
39
40
|
/** Suffix of the banner's action: `${tableTestID}-select-banner-action`. */
|
|
40
41
|
selectBannerActionSuffix: "select-banner-action",
|
|
41
42
|
filterBar: "ui-filters",
|
|
43
|
+
pagedLayout: "ui-paged-table-layout",
|
|
42
44
|
results: "ui-results",
|
|
43
45
|
pager: "ui-pager",
|
|
44
46
|
pagerInfo: "ui-pager-info",
|
|
@@ -331,6 +333,23 @@ var chromeStyles = reactNative.StyleSheet.create({
|
|
|
331
333
|
sizeOption: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: CONTROL_PAD_H, paddingVertical: MENU_OPT_PAD_V },
|
|
332
334
|
sizeOptionText: { fontSize: CONTROL_FONT, fontVariant: ["tabular-nums"] }
|
|
333
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);
|
|
334
353
|
function cellContent(column, row, textColor, overrides) {
|
|
335
354
|
const content = column.render(row);
|
|
336
355
|
if (typeof content === "string" || typeof content === "number") {
|
|
@@ -586,7 +605,7 @@ function DataTableRow({
|
|
|
586
605
|
accessibilityRole: "summary",
|
|
587
606
|
style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
|
|
588
607
|
testID: rowDetailTestID(tableTestID, rowKey),
|
|
589
|
-
children: renderRowDetail(row)
|
|
608
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(JoinedFrameContext.Provider, { value: null, children: renderRowDetail(row) })
|
|
590
609
|
}
|
|
591
610
|
)
|
|
592
611
|
] });
|
|
@@ -900,6 +919,7 @@ function DataTable(props) {
|
|
|
900
919
|
const { width } = reactNative.useWindowDimensions();
|
|
901
920
|
const stacked = width < stackBreakpoint;
|
|
902
921
|
const frame = { backgroundColor: colors.surface, borderColor: colors.border };
|
|
922
|
+
const joined = React2.useContext(JoinedFrameContext);
|
|
903
923
|
const interactive = onRowPress !== void 0;
|
|
904
924
|
const [hoveredKey, setHoveredKey] = React2.useState(void 0);
|
|
905
925
|
const hoverTint = softBrandTint(theme.palette.primary["500"]) ?? colors.background;
|
|
@@ -934,7 +954,7 @@ function DataTable(props) {
|
|
|
934
954
|
[rowTint, zebra, colors.background]
|
|
935
955
|
);
|
|
936
956
|
const rowBg = (row, index, key) => interactive && hoveredKey === key ? hoverTint : rowBackground(row, index);
|
|
937
|
-
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 }) }) });
|
|
957
|
+
const stateView = (label) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [tableStyles.wrap, frame, joined?.wrap, 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 }) }) });
|
|
938
958
|
if (rows.length === 0) {
|
|
939
959
|
return stateView(loading ? loadingLabel ?? t(TABLE_I18N.loading) : emptyLabel ?? t(TABLE_I18N.empty));
|
|
940
960
|
}
|
|
@@ -977,7 +997,7 @@ function DataTable(props) {
|
|
|
977
997
|
}
|
|
978
998
|
);
|
|
979
999
|
if (stacked) {
|
|
980
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, o?.wrap], testID, "aria-busy": loading, children: [
|
|
1000
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [tableStyles.wrap, frame, joined?.wrap, o?.wrap], testID, "aria-busy": loading, children: [
|
|
981
1001
|
banner,
|
|
982
1002
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: tableStyles.headSentinel, testID: TABLE_TEST_IDS.head, "aria-hidden": true }),
|
|
983
1003
|
rows.map((row, i) => {
|
|
@@ -998,7 +1018,7 @@ function DataTable(props) {
|
|
|
998
1018
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
999
1019
|
reactNative.View,
|
|
1000
1020
|
{
|
|
1001
|
-
style: [tableStyles.wrap, frame, o?.wrap],
|
|
1021
|
+
style: [tableStyles.wrap, frame, joined?.wrap, o?.wrap],
|
|
1002
1022
|
testID,
|
|
1003
1023
|
"aria-busy": loading,
|
|
1004
1024
|
...keyboardNavigation ? { role: "grid" } : null,
|
|
@@ -1034,8 +1054,9 @@ function FilterBar({
|
|
|
1034
1054
|
}) {
|
|
1035
1055
|
const { theme, t } = uiFeedback.useUi();
|
|
1036
1056
|
const { colors } = theme;
|
|
1057
|
+
const joined = React2.useContext(JoinedFrameContext);
|
|
1037
1058
|
const word = resultsLabel ?? t(TABLE_I18N.results);
|
|
1038
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [chromeStyles.filters, { backgroundColor: colors.surface, borderColor: colors.border }, o?.filters], testID, children: [
|
|
1059
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [chromeStyles.filters, { backgroundColor: colors.surface, borderColor: colors.border }, joined?.filters, o?.filters], testID, children: [
|
|
1039
1060
|
children,
|
|
1040
1061
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [chromeStyles.filtersSpacer, o?.filtersSpacer] }),
|
|
1041
1062
|
typeof resultsCount === "number" && // Live region: announce the new count when filters change the result set (WCAG 4.1.3).
|
|
@@ -1427,6 +1448,47 @@ function Pager({
|
|
|
1427
1448
|
)
|
|
1428
1449
|
] });
|
|
1429
1450
|
}
|
|
1451
|
+
var LAYOUT_GAP = 12;
|
|
1452
|
+
var PAGER_SLOT_PAD_V = 8;
|
|
1453
|
+
var PAGER_IN_FRAME = { paddingHorizontal: ROW_PAD_H, paddingVertical: PAGER_SLOT_PAD_V };
|
|
1454
|
+
var FRAME = { borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS };
|
|
1455
|
+
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 } }
|
|
1460
|
+
};
|
|
1461
|
+
function PagedTableLayout({
|
|
1462
|
+
filters,
|
|
1463
|
+
pager,
|
|
1464
|
+
table,
|
|
1465
|
+
layout = "toolbar",
|
|
1466
|
+
testID = TABLE_TEST_IDS.pagedLayout
|
|
1467
|
+
}) {
|
|
1468
|
+
const { colors } = uiFeedback.useUi().theme;
|
|
1469
|
+
const slots = SLOT_STYLES[layout];
|
|
1470
|
+
const line = { borderColor: colors.border };
|
|
1471
|
+
const hasFilters = filters !== void 0 && filters !== null && filters !== false;
|
|
1472
|
+
const filtersInFrame = layout === "panel";
|
|
1473
|
+
const isJoined = layout !== "spaced";
|
|
1474
|
+
const filtersSlot = hasFilters ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.filters, line], testID: `${testID}-filters`, children: filters }) : null;
|
|
1475
|
+
const pagerSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.pager, line], testID: `${testID}-pager`, children: pager });
|
|
1476
|
+
const tableSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-table`, children: table });
|
|
1477
|
+
const pagerAndTable = layout === "footer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1478
|
+
tableSlot,
|
|
1479
|
+
pagerSlot
|
|
1480
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1481
|
+
pagerSlot,
|
|
1482
|
+
tableSlot
|
|
1483
|
+
] });
|
|
1484
|
+
return /* @__PURE__ */ jsxRuntime.jsx(JoinedFrameContext.Provider, { value: JOINED_FRAME_STYLES[layout], children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { testID, children: [
|
|
1485
|
+
filtersInFrame ? null : filtersSlot,
|
|
1486
|
+
isJoined ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [FRAME, line, { backgroundColor: colors.surface }], testID: `${testID}-frame`, children: [
|
|
1487
|
+
filtersInFrame ? filtersSlot : null,
|
|
1488
|
+
pagerAndTable
|
|
1489
|
+
] }) : pagerAndTable
|
|
1490
|
+
] }) });
|
|
1491
|
+
}
|
|
1430
1492
|
var FIELD_GAP = 4;
|
|
1431
1493
|
var SWITCH_ROW_GAP = 8;
|
|
1432
1494
|
var ACTION_PAD_H = 14;
|
|
@@ -1588,21 +1650,27 @@ function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
|
1588
1650
|
const { theme } = uiFeedback.useUi();
|
|
1589
1651
|
const { colors } = theme;
|
|
1590
1652
|
const isNumber = field.kind === "number";
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1653
|
+
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1654
|
+
label: field.label,
|
|
1655
|
+
hint: field.accessibilityHint,
|
|
1656
|
+
testID: `${field.testID ?? fieldTestID(barTestID, field.key)}-input`
|
|
1657
|
+
});
|
|
1658
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1659
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1660
|
+
reactNative.TextInput,
|
|
1661
|
+
{
|
|
1662
|
+
...a11yProps,
|
|
1663
|
+
keyboardType: isNumber ? "numeric" : "default",
|
|
1664
|
+
placeholder: field.placeholder,
|
|
1665
|
+
placeholderTextColor: colors.textSecondary,
|
|
1666
|
+
value,
|
|
1667
|
+
onChangeText: onChange,
|
|
1668
|
+
onSubmitEditing: onSubmit,
|
|
1669
|
+
style: [uiForms.controlStyles.input, { borderColor: colors.border, backgroundColor: colors.surface, color: colors.text }]
|
|
1670
|
+
}
|
|
1671
|
+
),
|
|
1672
|
+
hintNode
|
|
1673
|
+
] });
|
|
1606
1674
|
}
|
|
1607
1675
|
function TypeaheadField({ field, barTestID, value, onChange, onSubmit, optionHint }) {
|
|
1608
1676
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2316,6 +2384,7 @@ exports.LedgerLayout = LedgerLayout;
|
|
|
2316
2384
|
exports.MONTH_STATUS_GRID_TEST_ID = MONTH_STATUS_GRID_TEST_ID;
|
|
2317
2385
|
exports.MonthGridColumns = MonthGridColumns;
|
|
2318
2386
|
exports.MonthStatusGrid = MonthStatusGrid;
|
|
2387
|
+
exports.PagedTableLayout = PagedTableLayout;
|
|
2319
2388
|
exports.Pager = Pager;
|
|
2320
2389
|
exports.RelativeTime = RelativeTime;
|
|
2321
2390
|
exports.STATUS_LEDGER_TEST_ID = STATUS_LEDGER_TEST_ID;
|