@dloizides/ui-tables 1.26.0 → 1.27.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 +6 -0
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,21 @@ var TABLE_I18N = {
|
|
|
105
105
|
statCardLabel: "analytics.statCardLabel",
|
|
106
106
|
statHint: "analytics.statHint"
|
|
107
107
|
};
|
|
108
|
+
|
|
109
|
+
// src/StatCard/StatTone.ts
|
|
110
|
+
var StatTone = /* @__PURE__ */ ((StatTone2) => {
|
|
111
|
+
StatTone2["Neutral"] = "neutral";
|
|
112
|
+
StatTone2["Error"] = "error";
|
|
113
|
+
StatTone2["Success"] = "success";
|
|
114
|
+
return StatTone2;
|
|
115
|
+
})(StatTone || {});
|
|
116
|
+
var TONE_STEP = "700";
|
|
117
|
+
var FALLBACK_STEP = "500";
|
|
118
|
+
function resolveStatToneColor(theme, tone) {
|
|
119
|
+
if (tone === "neutral" /* Neutral */) return theme.colors.textSecondary;
|
|
120
|
+
const scale = theme.semantic[tone];
|
|
121
|
+
return scale?.[TONE_STEP] ?? scale?.[FALLBACK_STEP] ?? theme.colors.textSecondary;
|
|
122
|
+
}
|
|
108
123
|
var CARD_PADDING = 16;
|
|
109
124
|
var CARD_BORDER_RADIUS = 12;
|
|
110
125
|
var CARD_BORDER_WIDTH = 1;
|
|
@@ -127,10 +142,11 @@ var styles = StyleSheet.create({
|
|
|
127
142
|
lineHeight: VALUE_LINE_HEIGHT
|
|
128
143
|
}
|
|
129
144
|
});
|
|
130
|
-
var StatCard = memo(({ label, value, testID }) => {
|
|
145
|
+
var StatCard = memo(({ label, value, testID, tone = "neutral" /* Neutral */ }) => {
|
|
131
146
|
const { theme, t } = useUi();
|
|
132
147
|
const { colors } = theme;
|
|
133
|
-
const formattedValue = value.toLocaleString();
|
|
148
|
+
const formattedValue = typeof value === "string" ? value : value.toLocaleString();
|
|
149
|
+
const labelColor = resolveStatToneColor(theme, tone);
|
|
134
150
|
return /* @__PURE__ */ jsxs(
|
|
135
151
|
View,
|
|
136
152
|
{
|
|
@@ -140,7 +156,7 @@ var StatCard = memo(({ label, value, testID }) => {
|
|
|
140
156
|
style: [styles.card, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
141
157
|
testID,
|
|
142
158
|
children: [
|
|
143
|
-
/* @__PURE__ */ jsx(Text, { style: [styles.label, { color:
|
|
159
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, { color: labelColor }], children: label }),
|
|
144
160
|
/* @__PURE__ */ jsx(Text, { style: [styles.value, { color: colors.text }], children: formattedValue })
|
|
145
161
|
]
|
|
146
162
|
}
|
|
@@ -2265,6 +2281,6 @@ var MonthStatusGrid = ({
|
|
|
2265
2281
|
] }, row[0]?.id)) });
|
|
2266
2282
|
};
|
|
2267
2283
|
|
|
2268
|
-
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, FilterBar, Filters, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, MonthStatusGrid, Pager, RelativeTime, STATUS_LEDGER_TEST_ID, SortDirection, StatCard, StatusLedger, StatusPill, StatusTone, TABLE_I18N, TABLE_TEST_IDS, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
|
|
2284
|
+
export { CARD_STACK_BREAKPOINT, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DataTable, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, FilterBar, Filters, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, MonthStatusGrid, Pager, RelativeTime, STATUS_LEDGER_TEST_ID, SortDirection, StatCard, StatTone, StatusLedger, StatusPill, StatusTone, TABLE_I18N, TABLE_TEST_IDS, applyTestID, clearTestID, distinctValues, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, isAttentionTone, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, useFilterDraft, usePagedRows };
|
|
2269
2285
|
//# sourceMappingURL=index.mjs.map
|
|
2270
2286
|
//# sourceMappingURL=index.mjs.map
|