@dloizides/ui-tables 1.29.1 → 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/dist/index.d.mts +22 -6
- package/dist/index.d.ts +22 -6
- package/dist/index.js +65 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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
|
|
@@ -556,7 +568,7 @@ declare const TABLE_I18N: {
|
|
|
556
568
|
*/
|
|
557
569
|
|
|
558
570
|
/** The kinds of field the declarative bar can render. */
|
|
559
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'dateRange' | 'typeahead' | 'boolean';
|
|
571
|
+
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
560
572
|
/**
|
|
561
573
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
562
574
|
*
|
|
@@ -604,6 +616,10 @@ interface NumberFilterField extends FilterFieldBase {
|
|
|
604
616
|
kind: 'number';
|
|
605
617
|
placeholder?: string;
|
|
606
618
|
}
|
|
619
|
+
/** A single calendar date (`YYYY-MM-DD`, ''=unset), rendered by `ui-forms`' `DateField`. */
|
|
620
|
+
interface DateFilterField extends FilterFieldBase {
|
|
621
|
+
kind: 'date';
|
|
622
|
+
}
|
|
607
623
|
/** An inclusive from/to date range (two `YYYY-MM-DD` inputs). */
|
|
608
624
|
interface DateRangeFilterField extends FilterFieldBase {
|
|
609
625
|
kind: 'dateRange';
|
|
@@ -631,7 +647,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
631
647
|
kind: 'boolean';
|
|
632
648
|
}
|
|
633
649
|
/** The discriminated union of every declarative filter field. */
|
|
634
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
650
|
+
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
635
651
|
|
|
636
652
|
/**
|
|
637
653
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -989,4 +1005,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
989
1005
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
990
1006
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
991
1007
|
|
|
992
|
-
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, 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 };
|
|
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
|
|
@@ -556,7 +568,7 @@ declare const TABLE_I18N: {
|
|
|
556
568
|
*/
|
|
557
569
|
|
|
558
570
|
/** The kinds of field the declarative bar can render. */
|
|
559
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'dateRange' | 'typeahead' | 'boolean';
|
|
571
|
+
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
560
572
|
/**
|
|
561
573
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
562
574
|
*
|
|
@@ -604,6 +616,10 @@ interface NumberFilterField extends FilterFieldBase {
|
|
|
604
616
|
kind: 'number';
|
|
605
617
|
placeholder?: string;
|
|
606
618
|
}
|
|
619
|
+
/** A single calendar date (`YYYY-MM-DD`, ''=unset), rendered by `ui-forms`' `DateField`. */
|
|
620
|
+
interface DateFilterField extends FilterFieldBase {
|
|
621
|
+
kind: 'date';
|
|
622
|
+
}
|
|
607
623
|
/** An inclusive from/to date range (two `YYYY-MM-DD` inputs). */
|
|
608
624
|
interface DateRangeFilterField extends FilterFieldBase {
|
|
609
625
|
kind: 'dateRange';
|
|
@@ -631,7 +647,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
631
647
|
kind: 'boolean';
|
|
632
648
|
}
|
|
633
649
|
/** The discriminated union of every declarative filter field. */
|
|
634
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
650
|
+
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
635
651
|
|
|
636
652
|
/**
|
|
637
653
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -989,4 +1005,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
989
1005
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
990
1006
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
991
1007
|
|
|
992
|
-
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, 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 };
|
|
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
|
@@ -451,6 +451,21 @@ function SelectionCheckbox({
|
|
|
451
451
|
}
|
|
452
452
|
);
|
|
453
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
|
+
}
|
|
454
469
|
var TAB_INDEX_INACTIVE = -1;
|
|
455
470
|
function webKeyProps(onKeyDown) {
|
|
456
471
|
return onKeyDown === void 0 ? {} : { onKeyDown };
|
|
@@ -474,18 +489,19 @@ function TableRow({
|
|
|
474
489
|
onHoverOut,
|
|
475
490
|
selectionSlot,
|
|
476
491
|
stacked,
|
|
477
|
-
keyboard
|
|
492
|
+
keyboard,
|
|
493
|
+
interaction
|
|
478
494
|
}) {
|
|
479
495
|
const interactive = onPress !== void 0;
|
|
480
496
|
const hover = interactive ? { onHoverIn, onHoverOut } : null;
|
|
481
497
|
if (selectionSlot === void 0) {
|
|
482
|
-
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 });
|
|
483
499
|
}
|
|
484
500
|
const contentStyle = stacked ? selectionStyles.cardContent : selectionStyles.rowContent;
|
|
485
501
|
const content = interactive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
486
502
|
reactNative.Pressable,
|
|
487
503
|
{
|
|
488
|
-
style: contentStyle,
|
|
504
|
+
style: (state) => [contentStyle, rowInteractionStyle(state, interaction)],
|
|
489
505
|
tabIndex: keyboard === void 0 ? void 0 : TAB_INDEX_INACTIVE,
|
|
490
506
|
onPress,
|
|
491
507
|
...hover,
|
|
@@ -562,6 +578,7 @@ function DataTableRow({
|
|
|
562
578
|
testID: rowID,
|
|
563
579
|
onHoverIn,
|
|
564
580
|
onHoverOut,
|
|
581
|
+
interaction: { brand: theme.palette.primary["500"], fallbackTint: colors.border },
|
|
565
582
|
onPress: pressRow,
|
|
566
583
|
children: /* @__PURE__ */ jsxRuntime.jsx(RowPressProvider, { value: pressRow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
567
584
|
RowCells,
|
|
@@ -1558,6 +1575,7 @@ var FIELD_MIN_WIDTH = {
|
|
|
1558
1575
|
select: 150,
|
|
1559
1576
|
text: 200,
|
|
1560
1577
|
number: 130,
|
|
1578
|
+
date: 160,
|
|
1561
1579
|
dateRange: 260,
|
|
1562
1580
|
typeahead: 200,
|
|
1563
1581
|
boolean: 150
|
|
@@ -1616,22 +1634,6 @@ function BooleanField({ field, barTestID, value, onChange }) {
|
|
|
1616
1634
|
)
|
|
1617
1635
|
] });
|
|
1618
1636
|
}
|
|
1619
|
-
function DateRangeField({ field, barTestID, value, onChange, onSubmit, fromLabel, toLabel }) {
|
|
1620
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1621
|
-
uiForms.DateRangeControl,
|
|
1622
|
-
{
|
|
1623
|
-
accessibilityHint: field.accessibilityHint,
|
|
1624
|
-
fromLabel: field.fromLabel ?? fromLabel,
|
|
1625
|
-
fromPlaceholder: field.fromPlaceholder,
|
|
1626
|
-
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
1627
|
-
toLabel: field.toLabel ?? toLabel,
|
|
1628
|
-
toPlaceholder: field.toPlaceholder,
|
|
1629
|
-
value,
|
|
1630
|
-
onChange,
|
|
1631
|
-
onSubmit
|
|
1632
|
-
}
|
|
1633
|
-
);
|
|
1634
|
-
}
|
|
1635
1637
|
function SelectField({ field, barTestID, value, onChange, placeholder, dropdownHint, optionHint }) {
|
|
1636
1638
|
const { t } = uiFeedback.useUi();
|
|
1637
1639
|
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
@@ -1656,6 +1658,21 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1656
1658
|
}
|
|
1657
1659
|
);
|
|
1658
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
|
+
}
|
|
1659
1676
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1660
1677
|
const { theme } = uiFeedback.useUi();
|
|
1661
1678
|
const { colors } = theme;
|
|
@@ -1717,11 +1734,30 @@ function asRange(value) {
|
|
|
1717
1734
|
if (typeof value === "object" && value !== null && "from" in value && "to" in value) return value;
|
|
1718
1735
|
return EMPTY_RANGE;
|
|
1719
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
|
+
}
|
|
1720
1742
|
function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings, renderSelect }) {
|
|
1721
1743
|
const raw = values[field.key];
|
|
1722
1744
|
if (field.kind === "boolean") {
|
|
1723
1745
|
return /* @__PURE__ */ jsxRuntime.jsx(BooleanField, { field, barTestID, value: asBool(raw), onChange: (v) => setField(field.key, v) });
|
|
1724
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
|
+
}
|
|
1725
1761
|
const body = (() => {
|
|
1726
1762
|
switch (field.kind) {
|
|
1727
1763
|
case "select":
|
|
@@ -1759,15 +1795,15 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1759
1795
|
);
|
|
1760
1796
|
case "dateRange":
|
|
1761
1797
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1762
|
-
|
|
1798
|
+
uiForms.DateRangeControl,
|
|
1763
1799
|
{
|
|
1764
|
-
field,
|
|
1765
|
-
|
|
1800
|
+
accessibilityHint: field.accessibilityHint,
|
|
1801
|
+
fromLabel: field.fromLabel ?? strings.fromLabel,
|
|
1802
|
+
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
1803
|
+
toLabel: field.toLabel ?? strings.toLabel,
|
|
1766
1804
|
value: asRange(raw),
|
|
1767
1805
|
onChange: (v) => setField(field.key, v),
|
|
1768
|
-
onSubmit
|
|
1769
|
-
fromLabel: strings.fromLabel,
|
|
1770
|
-
toLabel: strings.toLabel
|
|
1806
|
+
onSubmit
|
|
1771
1807
|
}
|
|
1772
1808
|
);
|
|
1773
1809
|
default:
|
|
@@ -1783,12 +1819,10 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1783
1819
|
);
|
|
1784
1820
|
}
|
|
1785
1821
|
})();
|
|
1786
|
-
const minWidth = field.minWidth ?? FIELD_MIN_WIDTH[field.kind];
|
|
1787
|
-
const grow = field.grow === true ? { flexGrow: GROW_FLEX } : null;
|
|
1788
1822
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1789
1823
|
uiForms.Field,
|
|
1790
1824
|
{
|
|
1791
|
-
containerStyle
|
|
1825
|
+
containerStyle,
|
|
1792
1826
|
label: field.label,
|
|
1793
1827
|
labelVariant: "control",
|
|
1794
1828
|
testID: field.testID ?? fieldTestID(barTestID, field.key),
|
|
@@ -2117,6 +2151,7 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
|
|
|
2117
2151
|
LedgerLayout2["Feed"] = "feed";
|
|
2118
2152
|
return LedgerLayout2;
|
|
2119
2153
|
})(LedgerLayout || {});
|
|
2154
|
+
var LEDGER_ROW_ACTION_FALLBACK = { none: "status ledger caller passed no onRowPress" };
|
|
2120
2155
|
var GAP = 12;
|
|
2121
2156
|
var HEADING_FONT = 15;
|
|
2122
2157
|
var HEADING_WEIGHT = "700";
|
|
@@ -2139,6 +2174,7 @@ function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
|
|
|
2139
2174
|
getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
|
|
2140
2175
|
keyExtractor: ledger.keyExtractor,
|
|
2141
2176
|
onRowPress: ledger.onRowPress,
|
|
2177
|
+
rowAction: LEDGER_ROW_ACTION_FALLBACK,
|
|
2142
2178
|
renderRowDetail: ledger.renderRowDetail,
|
|
2143
2179
|
rows,
|
|
2144
2180
|
stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
|
|
@@ -2193,6 +2229,7 @@ function StatusLedger(props) {
|
|
|
2193
2229
|
keyExtractor: props.keyExtractor,
|
|
2194
2230
|
loading,
|
|
2195
2231
|
onRowPress: props.onRowPress,
|
|
2232
|
+
rowAction: LEDGER_ROW_ACTION_FALLBACK,
|
|
2196
2233
|
renderRowDetail: props.renderRowDetail,
|
|
2197
2234
|
rows: view.visible,
|
|
2198
2235
|
stackBreakpoint: feed ? breakpoint : 0,
|