@dloizides/ui-tables 1.29.0 → 2.0.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 +10 -0
- package/dist/index.d.mts +29 -8
- package/dist/index.d.ts +29 -8
- package/dist/index.js +104 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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
|
@@ -24,6 +24,19 @@ interface StatCardProps {
|
|
|
24
24
|
}
|
|
25
25
|
declare const StatCard: React.MemoExoticComponent<({ label, value, testID, tone }: StatCardProps) => React.ReactElement>;
|
|
26
26
|
|
|
27
|
+
interface RowActionNone {
|
|
28
|
+
none: string;
|
|
29
|
+
}
|
|
30
|
+
interface OpensRows<T> {
|
|
31
|
+
onRowPress: (row: T) => void;
|
|
32
|
+
rowAction?: RowActionNone;
|
|
33
|
+
}
|
|
34
|
+
interface DeclaresNoRowAction<T> {
|
|
35
|
+
onRowPress?: (row: T) => void;
|
|
36
|
+
rowAction: RowActionNone;
|
|
37
|
+
}
|
|
38
|
+
type DataTableRowAction<T> = OpensRows<T> | DeclaresNoRowAction<T>;
|
|
39
|
+
|
|
27
40
|
/**
|
|
28
41
|
* The DataTable contract — a `columns + rows` grid (the shape proven in the POC and
|
|
29
42
|
* carried over unchanged; it is the right API). Every user-facing string is either
|
|
@@ -92,7 +105,7 @@ interface DataTableColumn<T> {
|
|
|
92
105
|
minWidth?: number;
|
|
93
106
|
render: (row: T) => React.ReactNode;
|
|
94
107
|
}
|
|
95
|
-
interface
|
|
108
|
+
interface DataTableBaseProps<T> {
|
|
96
109
|
columns: ReadonlyArray<DataTableColumn<T>>;
|
|
97
110
|
rows: readonly T[];
|
|
98
111
|
keyExtractor: (row: T) => string;
|
|
@@ -102,8 +115,6 @@ interface DataTableProps<T> {
|
|
|
102
115
|
zebra?: boolean;
|
|
103
116
|
/** Keep the header pinned while the body scrolls (web `position: sticky`). */
|
|
104
117
|
stickyHeader?: boolean;
|
|
105
|
-
/** Make rows pressable (GRID.md `is-click`). Enables row accessibilityRole=button. */
|
|
106
|
-
onRowPress?: (row: T) => void;
|
|
107
118
|
/** Per-row accessibility label. Falls back to the kit's `rowLabel` translation. */
|
|
108
119
|
getRowAccessibilityLabel?: (row: T) => string;
|
|
109
120
|
/**
|
|
@@ -213,6 +224,7 @@ interface DataTableProps<T> {
|
|
|
213
224
|
styleOverrides?: DataTableStyleOverrides;
|
|
214
225
|
testID?: string;
|
|
215
226
|
}
|
|
227
|
+
type DataTableProps<T> = DataTableBaseProps<T> & DataTableRowAction<T>;
|
|
216
228
|
|
|
217
229
|
/**
|
|
218
230
|
* DataTable — the shared, tokenized RN-web grid for every dloizides.com surface
|
|
@@ -389,7 +401,12 @@ interface PagerProps {
|
|
|
389
401
|
}
|
|
390
402
|
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, rowsVariant, unitLabel, unitLabelSingular, showFirstLast, responsive, stackBreakpoint, infoPrefix, boldNumbers, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
|
|
391
403
|
|
|
392
|
-
|
|
404
|
+
declare const enum PagedTableLayoutKind {
|
|
405
|
+
Toolbar = "toolbar",
|
|
406
|
+
Spaced = "spaced",
|
|
407
|
+
Footer = "footer",
|
|
408
|
+
Panel = "panel"
|
|
409
|
+
}
|
|
393
410
|
|
|
394
411
|
interface PagedTableLayoutProps {
|
|
395
412
|
/** Filter bar, shown above the pager and table. Omit for none. */
|
|
@@ -397,7 +414,7 @@ interface PagedTableLayoutProps {
|
|
|
397
414
|
pager: React.ReactNode;
|
|
398
415
|
table: React.ReactNode;
|
|
399
416
|
/** How the pager joins the table. Default `toolbar`. */
|
|
400
|
-
layout?: PagedTableLayoutKind
|
|
417
|
+
layout?: PagedTableLayoutKind | `${PagedTableLayoutKind}`;
|
|
401
418
|
testID?: string;
|
|
402
419
|
}
|
|
403
420
|
/** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
|
|
@@ -551,7 +568,7 @@ declare const TABLE_I18N: {
|
|
|
551
568
|
*/
|
|
552
569
|
|
|
553
570
|
/** The kinds of field the declarative bar can render. */
|
|
554
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'dateRange' | 'typeahead' | 'boolean';
|
|
571
|
+
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
555
572
|
/**
|
|
556
573
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
557
574
|
*
|
|
@@ -599,6 +616,10 @@ interface NumberFilterField extends FilterFieldBase {
|
|
|
599
616
|
kind: 'number';
|
|
600
617
|
placeholder?: string;
|
|
601
618
|
}
|
|
619
|
+
/** A single calendar date (`YYYY-MM-DD`, ''=unset), rendered by `ui-forms`' `DateField`. */
|
|
620
|
+
interface DateFilterField extends FilterFieldBase {
|
|
621
|
+
kind: 'date';
|
|
622
|
+
}
|
|
602
623
|
/** An inclusive from/to date range (two `YYYY-MM-DD` inputs). */
|
|
603
624
|
interface DateRangeFilterField extends FilterFieldBase {
|
|
604
625
|
kind: 'dateRange';
|
|
@@ -626,7 +647,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
626
647
|
kind: 'boolean';
|
|
627
648
|
}
|
|
628
649
|
/** The discriminated union of every declarative filter field. */
|
|
629
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
650
|
+
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
630
651
|
|
|
631
652
|
/**
|
|
632
653
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -984,4 +1005,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
984
1005
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
985
1006
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
986
1007
|
|
|
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,
|
|
1008
|
+
export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableBaseProps, type DataTableColumn, type DataTableProps, type DataTableRowAction, type DataTableStyleOverrides, type DateFilterField, 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, type RowActionNone, 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
|
@@ -24,6 +24,19 @@ interface StatCardProps {
|
|
|
24
24
|
}
|
|
25
25
|
declare const StatCard: React.MemoExoticComponent<({ label, value, testID, tone }: StatCardProps) => React.ReactElement>;
|
|
26
26
|
|
|
27
|
+
interface RowActionNone {
|
|
28
|
+
none: string;
|
|
29
|
+
}
|
|
30
|
+
interface OpensRows<T> {
|
|
31
|
+
onRowPress: (row: T) => void;
|
|
32
|
+
rowAction?: RowActionNone;
|
|
33
|
+
}
|
|
34
|
+
interface DeclaresNoRowAction<T> {
|
|
35
|
+
onRowPress?: (row: T) => void;
|
|
36
|
+
rowAction: RowActionNone;
|
|
37
|
+
}
|
|
38
|
+
type DataTableRowAction<T> = OpensRows<T> | DeclaresNoRowAction<T>;
|
|
39
|
+
|
|
27
40
|
/**
|
|
28
41
|
* The DataTable contract — a `columns + rows` grid (the shape proven in the POC and
|
|
29
42
|
* carried over unchanged; it is the right API). Every user-facing string is either
|
|
@@ -92,7 +105,7 @@ interface DataTableColumn<T> {
|
|
|
92
105
|
minWidth?: number;
|
|
93
106
|
render: (row: T) => React.ReactNode;
|
|
94
107
|
}
|
|
95
|
-
interface
|
|
108
|
+
interface DataTableBaseProps<T> {
|
|
96
109
|
columns: ReadonlyArray<DataTableColumn<T>>;
|
|
97
110
|
rows: readonly T[];
|
|
98
111
|
keyExtractor: (row: T) => string;
|
|
@@ -102,8 +115,6 @@ interface DataTableProps<T> {
|
|
|
102
115
|
zebra?: boolean;
|
|
103
116
|
/** Keep the header pinned while the body scrolls (web `position: sticky`). */
|
|
104
117
|
stickyHeader?: boolean;
|
|
105
|
-
/** Make rows pressable (GRID.md `is-click`). Enables row accessibilityRole=button. */
|
|
106
|
-
onRowPress?: (row: T) => void;
|
|
107
118
|
/** Per-row accessibility label. Falls back to the kit's `rowLabel` translation. */
|
|
108
119
|
getRowAccessibilityLabel?: (row: T) => string;
|
|
109
120
|
/**
|
|
@@ -213,6 +224,7 @@ interface DataTableProps<T> {
|
|
|
213
224
|
styleOverrides?: DataTableStyleOverrides;
|
|
214
225
|
testID?: string;
|
|
215
226
|
}
|
|
227
|
+
type DataTableProps<T> = DataTableBaseProps<T> & DataTableRowAction<T>;
|
|
216
228
|
|
|
217
229
|
/**
|
|
218
230
|
* DataTable — the shared, tokenized RN-web grid for every dloizides.com surface
|
|
@@ -389,7 +401,12 @@ interface PagerProps {
|
|
|
389
401
|
}
|
|
390
402
|
declare function Pager({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizeOptions, rowsVariant, unitLabel, unitLabelSingular, showFirstLast, responsive, stackBreakpoint, infoPrefix, boldNumbers, styleOverrides: o, testID, }: PagerProps): React.ReactElement;
|
|
391
403
|
|
|
392
|
-
|
|
404
|
+
declare const enum PagedTableLayoutKind {
|
|
405
|
+
Toolbar = "toolbar",
|
|
406
|
+
Spaced = "spaced",
|
|
407
|
+
Footer = "footer",
|
|
408
|
+
Panel = "panel"
|
|
409
|
+
}
|
|
393
410
|
|
|
394
411
|
interface PagedTableLayoutProps {
|
|
395
412
|
/** Filter bar, shown above the pager and table. Omit for none. */
|
|
@@ -397,7 +414,7 @@ interface PagedTableLayoutProps {
|
|
|
397
414
|
pager: React.ReactNode;
|
|
398
415
|
table: React.ReactNode;
|
|
399
416
|
/** How the pager joins the table. Default `toolbar`. */
|
|
400
|
-
layout?: PagedTableLayoutKind
|
|
417
|
+
layout?: PagedTableLayoutKind | `${PagedTableLayoutKind}`;
|
|
401
418
|
testID?: string;
|
|
402
419
|
}
|
|
403
420
|
/** Places a filter bar, a Pager and a DataTable as one unit with one spacing rule. */
|
|
@@ -551,7 +568,7 @@ declare const TABLE_I18N: {
|
|
|
551
568
|
*/
|
|
552
569
|
|
|
553
570
|
/** The kinds of field the declarative bar can render. */
|
|
554
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'dateRange' | 'typeahead' | 'boolean';
|
|
571
|
+
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
555
572
|
/**
|
|
556
573
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
557
574
|
*
|
|
@@ -599,6 +616,10 @@ interface NumberFilterField extends FilterFieldBase {
|
|
|
599
616
|
kind: 'number';
|
|
600
617
|
placeholder?: string;
|
|
601
618
|
}
|
|
619
|
+
/** A single calendar date (`YYYY-MM-DD`, ''=unset), rendered by `ui-forms`' `DateField`. */
|
|
620
|
+
interface DateFilterField extends FilterFieldBase {
|
|
621
|
+
kind: 'date';
|
|
622
|
+
}
|
|
602
623
|
/** An inclusive from/to date range (two `YYYY-MM-DD` inputs). */
|
|
603
624
|
interface DateRangeFilterField extends FilterFieldBase {
|
|
604
625
|
kind: 'dateRange';
|
|
@@ -626,7 +647,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
626
647
|
kind: 'boolean';
|
|
627
648
|
}
|
|
628
649
|
/** The discriminated union of every declarative filter field. */
|
|
629
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
650
|
+
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
630
651
|
|
|
631
652
|
/**
|
|
632
653
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -984,4 +1005,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
984
1005
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
985
1006
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
986
1007
|
|
|
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,
|
|
1008
|
+
export { type BooleanFilterField, CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, type DataTableBaseProps, type DataTableColumn, type DataTableProps, type DataTableRowAction, type DataTableStyleOverrides, type DateFilterField, 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, type RowActionNone, 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") {
|
|
@@ -468,6 +451,21 @@ function SelectionCheckbox({
|
|
|
468
451
|
}
|
|
469
452
|
);
|
|
470
453
|
}
|
|
454
|
+
|
|
455
|
+
// src/DataTable/rowInteraction.ts
|
|
456
|
+
var PRESSED_TINT_ALPHA = "33";
|
|
457
|
+
var HEX_RGB2 = /^#[0-9a-f]{6}$/i;
|
|
458
|
+
var FOCUS_RING_WIDTH = 2;
|
|
459
|
+
var FOCUS_RING_OFFSET = -2;
|
|
460
|
+
var POINTER = { cursor: "pointer" };
|
|
461
|
+
function rowInteractionStyle(state, tokens) {
|
|
462
|
+
const pressedTint = HEX_RGB2.test(tokens.brand) ? `${tokens.brand}${PRESSED_TINT_ALPHA}` : tokens.fallbackTint;
|
|
463
|
+
return [
|
|
464
|
+
POINTER,
|
|
465
|
+
state.pressed ? { backgroundColor: pressedTint } : null,
|
|
466
|
+
state.focused === true ? { outlineStyle: "solid", outlineWidth: FOCUS_RING_WIDTH, outlineColor: tokens.brand, outlineOffset: FOCUS_RING_OFFSET } : null
|
|
467
|
+
];
|
|
468
|
+
}
|
|
471
469
|
var TAB_INDEX_INACTIVE = -1;
|
|
472
470
|
function webKeyProps(onKeyDown) {
|
|
473
471
|
return onKeyDown === void 0 ? {} : { onKeyDown };
|
|
@@ -491,18 +489,19 @@ function TableRow({
|
|
|
491
489
|
onHoverOut,
|
|
492
490
|
selectionSlot,
|
|
493
491
|
stacked,
|
|
494
|
-
keyboard
|
|
492
|
+
keyboard,
|
|
493
|
+
interaction
|
|
495
494
|
}) {
|
|
496
495
|
const interactive = onPress !== void 0;
|
|
497
496
|
const hover = interactive ? { onHoverIn, onHoverOut } : null;
|
|
498
497
|
if (selectionSlot === void 0) {
|
|
499
|
-
return interactive ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style, testID, onPress, ...hover, ...a11y, ...focusProps(keyboard), children }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, ...a11y, ...focusProps(keyboard), children });
|
|
498
|
+
return interactive ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { style: (state) => [style, rowInteractionStyle(state, interaction)], testID, onPress, ...hover, ...a11y, ...focusProps(keyboard), children }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, ...a11y, ...focusProps(keyboard), children });
|
|
500
499
|
}
|
|
501
500
|
const contentStyle = stacked ? selectionStyles.cardContent : selectionStyles.rowContent;
|
|
502
501
|
const content = interactive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
503
502
|
reactNative.Pressable,
|
|
504
503
|
{
|
|
505
|
-
style: contentStyle,
|
|
504
|
+
style: (state) => [contentStyle, rowInteractionStyle(state, interaction)],
|
|
506
505
|
tabIndex: keyboard === void 0 ? void 0 : TAB_INDEX_INACTIVE,
|
|
507
506
|
onPress,
|
|
508
507
|
...hover,
|
|
@@ -579,6 +578,7 @@ function DataTableRow({
|
|
|
579
578
|
testID: rowID,
|
|
580
579
|
onHoverIn,
|
|
581
580
|
onHoverOut,
|
|
581
|
+
interaction: { brand: theme.palette.primary["500"], fallbackTint: colors.border },
|
|
582
582
|
onPress: pressRow,
|
|
583
583
|
children: /* @__PURE__ */ jsxRuntime.jsx(RowPressProvider, { value: pressRow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
584
584
|
RowCells,
|
|
@@ -605,11 +605,37 @@ function DataTableRow({
|
|
|
605
605
|
accessibilityRole: "summary",
|
|
606
606
|
style: [tableStyles.rowDetail, { borderTopColor: colors.border, backgroundColor: colors.background }, o?.rowDetail],
|
|
607
607
|
testID: rowDetailTestID(tableTestID, rowKey),
|
|
608
|
-
children:
|
|
608
|
+
children: renderRowDetail(row)
|
|
609
609
|
}
|
|
610
610
|
)
|
|
611
611
|
] });
|
|
612
612
|
}
|
|
613
|
+
|
|
614
|
+
// src/DataTable/PagedTableLayoutKind.ts
|
|
615
|
+
var PagedTableLayoutKind = /* @__PURE__ */ ((PagedTableLayoutKind2) => {
|
|
616
|
+
PagedTableLayoutKind2["Toolbar"] = "toolbar";
|
|
617
|
+
PagedTableLayoutKind2["Spaced"] = "spaced";
|
|
618
|
+
PagedTableLayoutKind2["Footer"] = "footer";
|
|
619
|
+
PagedTableLayoutKind2["Panel"] = "panel";
|
|
620
|
+
return PagedTableLayoutKind2;
|
|
621
|
+
})(PagedTableLayoutKind || {});
|
|
622
|
+
|
|
623
|
+
// src/DataTable/joinedFrameContext.ts
|
|
624
|
+
var SQUARE = 0;
|
|
625
|
+
var INNER_RADIUS = BORDER_RADIUS - BORDER_WIDTH;
|
|
626
|
+
var NO_OUTER_BORDER = { borderTopWidth: 0, borderRightWidth: 0, borderBottomWidth: 0, borderLeftWidth: 0 };
|
|
627
|
+
function cornerRadii(top, bottom) {
|
|
628
|
+
return { borderTopLeftRadius: top, borderTopRightRadius: top, borderBottomLeftRadius: bottom, borderBottomRightRadius: bottom };
|
|
629
|
+
}
|
|
630
|
+
var AT_FRAME_TOP = { ...NO_OUTER_BORDER, ...cornerRadii(INNER_RADIUS, SQUARE) };
|
|
631
|
+
var AT_FRAME_BOTTOM = { ...NO_OUTER_BORDER, ...cornerRadii(SQUARE, INNER_RADIUS) };
|
|
632
|
+
var JOINED_FRAME_STYLES = {
|
|
633
|
+
["toolbar" /* Toolbar */]: { wrap: AT_FRAME_BOTTOM },
|
|
634
|
+
["spaced" /* Spaced */]: null,
|
|
635
|
+
["footer" /* Footer */]: { wrap: AT_FRAME_TOP },
|
|
636
|
+
["panel" /* Panel */]: { wrap: AT_FRAME_BOTTOM, filters: AT_FRAME_TOP }
|
|
637
|
+
};
|
|
638
|
+
var JoinedFrameContext = React2.createContext(null);
|
|
613
639
|
function SelectAllBanner({
|
|
614
640
|
mode,
|
|
615
641
|
pageCount,
|
|
@@ -981,8 +1007,9 @@ function DataTable(props) {
|
|
|
981
1007
|
onRowPress
|
|
982
1008
|
}
|
|
983
1009
|
);
|
|
984
|
-
|
|
985
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1010
|
+
const detachedFromFrame = /* @__PURE__ */ jsxRuntime.jsx(JoinedFrameContext.Provider, { value: null, children: node });
|
|
1011
|
+
if (!animateRowEntrance) return /* @__PURE__ */ jsxRuntime.jsx(React2__default.default.Fragment, { children: detachedFromFrame }, key);
|
|
1012
|
+
return /* @__PURE__ */ jsxRuntime.jsx(uiMotion.FadeIn, { delay: rowEntranceDelayMs(index), testID: rowFadeTestID(testID, key), children: detachedFromFrame }, key);
|
|
986
1013
|
};
|
|
987
1014
|
const banner = /* @__PURE__ */ jsxRuntime.jsx(
|
|
988
1015
|
SelectAllBanner,
|
|
@@ -1453,28 +1480,28 @@ var PAGER_SLOT_PAD_V = 8;
|
|
|
1453
1480
|
var PAGER_IN_FRAME = { paddingHorizontal: ROW_PAD_H, paddingVertical: PAGER_SLOT_PAD_V };
|
|
1454
1481
|
var FRAME = { borderWidth: BORDER_WIDTH, borderRadius: BORDER_RADIUS };
|
|
1455
1482
|
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 } }
|
|
1483
|
+
["toolbar" /* Toolbar */]: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } },
|
|
1484
|
+
["spaced" /* Spaced */]: { filters: {}, pager: { marginTop: LAYOUT_GAP, marginBottom: LAYOUT_GAP } },
|
|
1485
|
+
["footer" /* Footer */]: { filters: { marginBottom: LAYOUT_GAP }, pager: { ...PAGER_IN_FRAME, borderTopWidth: BORDER_WIDTH } },
|
|
1486
|
+
["panel" /* Panel */]: { filters: { borderBottomWidth: BORDER_WIDTH }, pager: { ...PAGER_IN_FRAME, borderBottomWidth: BORDER_WIDTH } }
|
|
1460
1487
|
};
|
|
1461
1488
|
function PagedTableLayout({
|
|
1462
1489
|
filters,
|
|
1463
1490
|
pager,
|
|
1464
1491
|
table,
|
|
1465
|
-
layout = "toolbar"
|
|
1492
|
+
layout = "toolbar" /* Toolbar */,
|
|
1466
1493
|
testID = TABLE_TEST_IDS.pagedLayout
|
|
1467
1494
|
}) {
|
|
1468
1495
|
const { colors } = uiFeedback.useUi().theme;
|
|
1469
1496
|
const slots = SLOT_STYLES[layout];
|
|
1470
1497
|
const line = { borderColor: colors.border };
|
|
1471
1498
|
const hasFilters = filters !== void 0 && filters !== null && filters !== false;
|
|
1472
|
-
const filtersInFrame = layout === "panel"
|
|
1473
|
-
const isJoined = layout !== "spaced"
|
|
1499
|
+
const filtersInFrame = layout === "panel" /* Panel */;
|
|
1500
|
+
const isJoined = layout !== "spaced" /* Spaced */;
|
|
1474
1501
|
const filtersSlot = hasFilters ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.filters, line], testID: `${testID}-filters`, children: filters }) : null;
|
|
1475
1502
|
const pagerSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [slots.pager, line], testID: `${testID}-pager`, children: pager });
|
|
1476
1503
|
const tableSlot = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-table`, children: table });
|
|
1477
|
-
const pagerAndTable = layout === "footer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1504
|
+
const pagerAndTable = layout === "footer" /* Footer */ ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1478
1505
|
tableSlot,
|
|
1479
1506
|
pagerSlot
|
|
1480
1507
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1548,6 +1575,7 @@ var FIELD_MIN_WIDTH = {
|
|
|
1548
1575
|
select: 150,
|
|
1549
1576
|
text: 200,
|
|
1550
1577
|
number: 130,
|
|
1578
|
+
date: 160,
|
|
1551
1579
|
dateRange: 260,
|
|
1552
1580
|
typeahead: 200,
|
|
1553
1581
|
boolean: 150
|
|
@@ -1606,22 +1634,6 @@ function BooleanField({ field, barTestID, value, onChange }) {
|
|
|
1606
1634
|
)
|
|
1607
1635
|
] });
|
|
1608
1636
|
}
|
|
1609
|
-
function DateRangeField({ field, barTestID, value, onChange, onSubmit, fromLabel, toLabel }) {
|
|
1610
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1611
|
-
uiForms.DateRangeControl,
|
|
1612
|
-
{
|
|
1613
|
-
accessibilityHint: field.accessibilityHint,
|
|
1614
|
-
fromLabel: field.fromLabel ?? fromLabel,
|
|
1615
|
-
fromPlaceholder: field.fromPlaceholder,
|
|
1616
|
-
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
1617
|
-
toLabel: field.toLabel ?? toLabel,
|
|
1618
|
-
toPlaceholder: field.toPlaceholder,
|
|
1619
|
-
value,
|
|
1620
|
-
onChange,
|
|
1621
|
-
onSubmit
|
|
1622
|
-
}
|
|
1623
|
-
);
|
|
1624
|
-
}
|
|
1625
1637
|
function SelectField({ field, barTestID, value, onChange, placeholder, dropdownHint, optionHint }) {
|
|
1626
1638
|
const { t } = uiFeedback.useUi();
|
|
1627
1639
|
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
@@ -1646,6 +1658,21 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1646
1658
|
}
|
|
1647
1659
|
);
|
|
1648
1660
|
}
|
|
1661
|
+
var NO_HINT = "";
|
|
1662
|
+
function SingleDateField({ field, barTestID, value, onChange, onSubmit, containerStyle }) {
|
|
1663
|
+
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1664
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: containerStyle, testID, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1665
|
+
uiForms.DateField,
|
|
1666
|
+
{
|
|
1667
|
+
accessibilityHint: field.accessibilityHint ?? NO_HINT,
|
|
1668
|
+
label: field.label,
|
|
1669
|
+
testID: `${testID}-input`,
|
|
1670
|
+
value,
|
|
1671
|
+
onChange,
|
|
1672
|
+
onSubmit
|
|
1673
|
+
}
|
|
1674
|
+
) });
|
|
1675
|
+
}
|
|
1649
1676
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1650
1677
|
const { theme } = uiFeedback.useUi();
|
|
1651
1678
|
const { colors } = theme;
|
|
@@ -1707,11 +1734,30 @@ function asRange(value) {
|
|
|
1707
1734
|
if (typeof value === "object" && value !== null && "from" in value && "to" in value) return value;
|
|
1708
1735
|
return EMPTY_RANGE;
|
|
1709
1736
|
}
|
|
1737
|
+
function fieldContainerStyle(field) {
|
|
1738
|
+
const minWidth = field.minWidth ?? FIELD_MIN_WIDTH[field.kind];
|
|
1739
|
+
const grow = field.grow === true ? { flexGrow: GROW_FLEX } : null;
|
|
1740
|
+
return [filterStyles.fieldInBar, { minWidth: clampedMinWidth(minWidth), maxWidth: "100%" }, grow, field.style];
|
|
1741
|
+
}
|
|
1710
1742
|
function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings, renderSelect }) {
|
|
1711
1743
|
const raw = values[field.key];
|
|
1712
1744
|
if (field.kind === "boolean") {
|
|
1713
1745
|
return /* @__PURE__ */ jsxRuntime.jsx(BooleanField, { field, barTestID, value: asBool(raw), onChange: (v) => setField(field.key, v) });
|
|
1714
1746
|
}
|
|
1747
|
+
const containerStyle = fieldContainerStyle(field);
|
|
1748
|
+
if (field.kind === "date") {
|
|
1749
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1750
|
+
SingleDateField,
|
|
1751
|
+
{
|
|
1752
|
+
barTestID,
|
|
1753
|
+
containerStyle,
|
|
1754
|
+
field,
|
|
1755
|
+
value: asString(raw),
|
|
1756
|
+
onChange: (v) => setField(field.key, v),
|
|
1757
|
+
onSubmit
|
|
1758
|
+
}
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1715
1761
|
const body = (() => {
|
|
1716
1762
|
switch (field.kind) {
|
|
1717
1763
|
case "select":
|
|
@@ -1749,15 +1795,15 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1749
1795
|
);
|
|
1750
1796
|
case "dateRange":
|
|
1751
1797
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1752
|
-
|
|
1798
|
+
uiForms.DateRangeControl,
|
|
1753
1799
|
{
|
|
1754
|
-
field,
|
|
1755
|
-
|
|
1800
|
+
accessibilityHint: field.accessibilityHint,
|
|
1801
|
+
fromLabel: field.fromLabel ?? strings.fromLabel,
|
|
1802
|
+
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
1803
|
+
toLabel: field.toLabel ?? strings.toLabel,
|
|
1756
1804
|
value: asRange(raw),
|
|
1757
1805
|
onChange: (v) => setField(field.key, v),
|
|
1758
|
-
onSubmit
|
|
1759
|
-
fromLabel: strings.fromLabel,
|
|
1760
|
-
toLabel: strings.toLabel
|
|
1806
|
+
onSubmit
|
|
1761
1807
|
}
|
|
1762
1808
|
);
|
|
1763
1809
|
default:
|
|
@@ -1773,12 +1819,10 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1773
1819
|
);
|
|
1774
1820
|
}
|
|
1775
1821
|
})();
|
|
1776
|
-
const minWidth = field.minWidth ?? FIELD_MIN_WIDTH[field.kind];
|
|
1777
|
-
const grow = field.grow === true ? { flexGrow: GROW_FLEX } : null;
|
|
1778
1822
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1779
1823
|
uiForms.Field,
|
|
1780
1824
|
{
|
|
1781
|
-
containerStyle
|
|
1825
|
+
containerStyle,
|
|
1782
1826
|
label: field.label,
|
|
1783
1827
|
labelVariant: "control",
|
|
1784
1828
|
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
@@ -2107,6 +2151,7 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
|
|
|
2107
2151
|
LedgerLayout2["Feed"] = "feed";
|
|
2108
2152
|
return LedgerLayout2;
|
|
2109
2153
|
})(LedgerLayout || {});
|
|
2154
|
+
var LEDGER_ROW_ACTION_FALLBACK = { none: "status ledger caller passed no onRowPress" };
|
|
2110
2155
|
var GAP = 12;
|
|
2111
2156
|
var HEADING_FONT = 15;
|
|
2112
2157
|
var HEADING_WEIGHT = "700";
|
|
@@ -2129,6 +2174,7 @@ function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
|
|
|
2129
2174
|
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2130
2175
|
keyExtractor: ledger.keyExtractor,
|
|
2131
2176
|
onRowPress: ledger.onRowPress,
|
|
2177
|
+
rowAction: LEDGER_ROW_ACTION_FALLBACK,
|
|
2132
2178
|
renderRowDetail: ledger.renderRowDetail,
|
|
2133
2179
|
rows,
|
|
2134
2180
|
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
@@ -2183,6 +2229,7 @@ function StatusLedger(props) {
|
|
|
2183
2229
|
keyExtractor: props.keyExtractor,
|
|
2184
2230
|
loading,
|
|
2185
2231
|
onRowPress: props.onRowPress,
|
|
2232
|
+
rowAction: LEDGER_ROW_ACTION_FALLBACK,
|
|
2186
2233
|
renderRowDetail: props.renderRowDetail,
|
|
2187
2234
|
rows: view.visible,
|
|
2188
2235
|
stackBreakpoint: feed ? breakpoint : 0,
|
|
@@ -2385,6 +2432,7 @@ exports.MONTH_STATUS_GRID_TEST_ID = MONTH_STATUS_GRID_TEST_ID;
|
|
|
2385
2432
|
exports.MonthGridColumns = MonthGridColumns;
|
|
2386
2433
|
exports.MonthStatusGrid = MonthStatusGrid;
|
|
2387
2434
|
exports.PagedTableLayout = PagedTableLayout;
|
|
2435
|
+
exports.PagedTableLayoutKind = PagedTableLayoutKind;
|
|
2388
2436
|
exports.Pager = Pager;
|
|
2389
2437
|
exports.RelativeTime = RelativeTime;
|
|
2390
2438
|
exports.STATUS_LEDGER_TEST_ID = STATUS_LEDGER_TEST_ID;
|