@dloizides/ui-tables 1.26.0 → 1.28.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 +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.28.0
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `DataTable`: desktop cell content is bounded to its column, so a long value wraps inside the column instead of running over the next one. Applies to string, number and custom-node cells; the mobile card-stack is unchanged. A custom node that sets `numberOfLines` still truncates, which is the consumer's choice. FINREG-CRM-ORG-1 "CRM organization column, filter and search".
|
|
8
|
+
|
|
9
|
+
## 1.27.0
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `StatCard`: `value` accepts a preformatted string (shown as given; numbers still use `toLocaleString`), and an optional `tone` (`StatTone.Neutral` / `Error` / `Success`) colours the label from the theme's semantic 700 step, then 500, then `textSecondary`. `resolveStatToneColor` is exported. INVOICE-FU-9 "INVOICE-5 shared look leftovers", AC-STAT-1.
|
|
14
|
+
|
|
3
15
|
## 1.25.0
|
|
4
16
|
|
|
5
17
|
### Added
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { UiTheme } from '@dloizides/ui-feedback';
|
|
2
3
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
4
|
import { DateRangeValue, ControlOption } from '@dloizides/ui-forms';
|
|
4
5
|
export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeValue, isUnmatched, suggestOptions } from '@dloizides/ui-forms';
|
|
5
6
|
|
|
7
|
+
declare const enum StatTone {
|
|
8
|
+
Neutral = "neutral",
|
|
9
|
+
Error = "error",
|
|
10
|
+
Success = "success"
|
|
11
|
+
}
|
|
12
|
+
/** The label colour for a tone: the semantic 700 step, then 500, then textSecondary. */
|
|
13
|
+
declare function resolveStatToneColor(theme: UiTheme, tone: StatTone): string;
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
16
|
* StatCard — a single labelled metric tile (label + formatted numeric value).
|
|
8
17
|
*/
|
|
9
18
|
|
|
10
19
|
interface StatCardProps {
|
|
11
20
|
label: string;
|
|
12
|
-
value: number;
|
|
21
|
+
value: number | string;
|
|
13
22
|
testID: string;
|
|
23
|
+
tone?: StatTone;
|
|
14
24
|
}
|
|
15
|
-
declare const StatCard: React.MemoExoticComponent<({ label, value, testID }: StatCardProps) => React.ReactElement>;
|
|
25
|
+
declare const StatCard: React.MemoExoticComponent<({ label, value, testID, tone }: StatCardProps) => React.ReactElement>;
|
|
16
26
|
|
|
17
27
|
/**
|
|
18
28
|
* The DataTable contract — a `columns + rows` grid (the shape proven in the POC and
|
|
@@ -959,4 +969,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
959
969
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
960
970
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
961
971
|
|
|
962
|
-
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, 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, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { UiTheme } from '@dloizides/ui-feedback';
|
|
2
3
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
4
|
import { DateRangeValue, ControlOption } from '@dloizides/ui-forms';
|
|
4
5
|
export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeValue, isUnmatched, suggestOptions } from '@dloizides/ui-forms';
|
|
5
6
|
|
|
7
|
+
declare const enum StatTone {
|
|
8
|
+
Neutral = "neutral",
|
|
9
|
+
Error = "error",
|
|
10
|
+
Success = "success"
|
|
11
|
+
}
|
|
12
|
+
/** The label colour for a tone: the semantic 700 step, then 500, then textSecondary. */
|
|
13
|
+
declare function resolveStatToneColor(theme: UiTheme, tone: StatTone): string;
|
|
14
|
+
|
|
6
15
|
/**
|
|
7
16
|
* StatCard — a single labelled metric tile (label + formatted numeric value).
|
|
8
17
|
*/
|
|
9
18
|
|
|
10
19
|
interface StatCardProps {
|
|
11
20
|
label: string;
|
|
12
|
-
value: number;
|
|
21
|
+
value: number | string;
|
|
13
22
|
testID: string;
|
|
23
|
+
tone?: StatTone;
|
|
14
24
|
}
|
|
15
|
-
declare const StatCard: React.MemoExoticComponent<({ label, value, testID }: StatCardProps) => React.ReactElement>;
|
|
25
|
+
declare const StatCard: React.MemoExoticComponent<({ label, value, testID, tone }: StatCardProps) => React.ReactElement>;
|
|
16
26
|
|
|
17
27
|
/**
|
|
18
28
|
* The DataTable contract — a `columns + rows` grid (the shape proven in the POC and
|
|
@@ -959,4 +969,4 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
959
969
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
960
970
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
961
971
|
|
|
962
|
-
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, 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, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -110,6 +110,21 @@ var TABLE_I18N = {
|
|
|
110
110
|
statCardLabel: "analytics.statCardLabel",
|
|
111
111
|
statHint: "analytics.statHint"
|
|
112
112
|
};
|
|
113
|
+
|
|
114
|
+
// src/StatCard/StatTone.ts
|
|
115
|
+
var StatTone = /* @__PURE__ */ ((StatTone2) => {
|
|
116
|
+
StatTone2["Neutral"] = "neutral";
|
|
117
|
+
StatTone2["Error"] = "error";
|
|
118
|
+
StatTone2["Success"] = "success";
|
|
119
|
+
return StatTone2;
|
|
120
|
+
})(StatTone || {});
|
|
121
|
+
var TONE_STEP = "700";
|
|
122
|
+
var FALLBACK_STEP = "500";
|
|
123
|
+
function resolveStatToneColor(theme, tone) {
|
|
124
|
+
if (tone === "neutral" /* Neutral */) return theme.colors.textSecondary;
|
|
125
|
+
const scale = theme.semantic[tone];
|
|
126
|
+
return scale?.[TONE_STEP] ?? scale?.[FALLBACK_STEP] ?? theme.colors.textSecondary;
|
|
127
|
+
}
|
|
113
128
|
var CARD_PADDING = 16;
|
|
114
129
|
var CARD_BORDER_RADIUS = 12;
|
|
115
130
|
var CARD_BORDER_WIDTH = 1;
|
|
@@ -132,10 +147,11 @@ var styles = reactNative.StyleSheet.create({
|
|
|
132
147
|
lineHeight: VALUE_LINE_HEIGHT
|
|
133
148
|
}
|
|
134
149
|
});
|
|
135
|
-
var StatCard = React2.memo(({ label, value, testID }) => {
|
|
150
|
+
var StatCard = React2.memo(({ label, value, testID, tone = "neutral" /* Neutral */ }) => {
|
|
136
151
|
const { theme, t } = uiFeedback.useUi();
|
|
137
152
|
const { colors } = theme;
|
|
138
|
-
const formattedValue = value.toLocaleString();
|
|
153
|
+
const formattedValue = typeof value === "string" ? value : value.toLocaleString();
|
|
154
|
+
const labelColor = resolveStatToneColor(theme, tone);
|
|
139
155
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
140
156
|
reactNative.View,
|
|
141
157
|
{
|
|
@@ -145,7 +161,7 @@ var StatCard = React2.memo(({ label, value, testID }) => {
|
|
|
145
161
|
style: [styles.card, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
146
162
|
testID,
|
|
147
163
|
children: [
|
|
148
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles.label, { color:
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles.label, { color: labelColor }], children: label }),
|
|
149
165
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles.value, { color: colors.text }], children: formattedValue })
|
|
150
166
|
]
|
|
151
167
|
}
|
|
@@ -216,6 +232,7 @@ var tableStyles = reactNative.StyleSheet.create({
|
|
|
216
232
|
headCell: { fontSize: HEAD_FONT, fontWeight: "600", letterSpacing: HEAD_LETTER_SPACING, textTransform: "uppercase" },
|
|
217
233
|
row: { flexDirection: "row", columnGap: COLUMN_GAP, alignItems: "center", paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V, borderTopWidth: BORDER_WIDTH },
|
|
218
234
|
cell: { fontSize: CELL_FONT, fontWeight: "400" },
|
|
235
|
+
desktopCellContent: { maxWidth: FULL_WIDTH },
|
|
219
236
|
numCell: { fontVariant: ["tabular-nums"], textAlign: "right" },
|
|
220
237
|
state: { paddingVertical: STATE_PAD_V, alignItems: "center" },
|
|
221
238
|
stateText: { fontSize: STATE_FONT },
|
|
@@ -343,7 +360,7 @@ function DesktopCell({ column, row, textColor, testID, styleOverrides, inGrid })
|
|
|
343
360
|
],
|
|
344
361
|
testID,
|
|
345
362
|
...inGrid === true ? { role: "cell" } : null,
|
|
346
|
-
children: cellContent(column, row, textColor, styleOverrides)
|
|
363
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: tableStyles.desktopCellContent, children: cellContent(column, row, textColor, styleOverrides) })
|
|
347
364
|
}
|
|
348
365
|
);
|
|
349
366
|
}
|
|
@@ -2304,6 +2321,7 @@ exports.RelativeTime = RelativeTime;
|
|
|
2304
2321
|
exports.STATUS_LEDGER_TEST_ID = STATUS_LEDGER_TEST_ID;
|
|
2305
2322
|
exports.SortDirection = SortDirection;
|
|
2306
2323
|
exports.StatCard = StatCard;
|
|
2324
|
+
exports.StatTone = StatTone;
|
|
2307
2325
|
exports.StatusLedger = StatusLedger;
|
|
2308
2326
|
exports.StatusPill = StatusPill;
|
|
2309
2327
|
exports.StatusTone = StatusTone;
|
|
@@ -2320,6 +2338,7 @@ exports.isAttentionTone = isAttentionTone;
|
|
|
2320
2338
|
exports.ledgerSectionTestID = ledgerSectionTestID;
|
|
2321
2339
|
exports.ledgerSortDirectionTestID = ledgerSortDirectionTestID;
|
|
2322
2340
|
exports.monthCellTestID = monthCellTestID;
|
|
2341
|
+
exports.resolveStatToneColor = resolveStatToneColor;
|
|
2323
2342
|
exports.rowDetailTestID = rowDetailTestID;
|
|
2324
2343
|
exports.rowFadeTestID = rowFadeTestID;
|
|
2325
2344
|
exports.rowSelectTestID = rowSelectTestID;
|