@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/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: colors.textSecondary }], children: label }),
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
  }
@@ -211,6 +227,7 @@ var tableStyles = StyleSheet.create({
211
227
  headCell: { fontSize: HEAD_FONT, fontWeight: "600", letterSpacing: HEAD_LETTER_SPACING, textTransform: "uppercase" },
212
228
  row: { flexDirection: "row", columnGap: COLUMN_GAP, alignItems: "center", paddingHorizontal: ROW_PAD_H, paddingVertical: ROW_PAD_V, borderTopWidth: BORDER_WIDTH },
213
229
  cell: { fontSize: CELL_FONT, fontWeight: "400" },
230
+ desktopCellContent: { maxWidth: FULL_WIDTH },
214
231
  numCell: { fontVariant: ["tabular-nums"], textAlign: "right" },
215
232
  state: { paddingVertical: STATE_PAD_V, alignItems: "center" },
216
233
  stateText: { fontSize: STATE_FONT },
@@ -338,7 +355,7 @@ function DesktopCell({ column, row, textColor, testID, styleOverrides, inGrid })
338
355
  ],
339
356
  testID,
340
357
  ...inGrid === true ? { role: "cell" } : null,
341
- children: cellContent(column, row, textColor, styleOverrides)
358
+ children: /* @__PURE__ */ jsx(View, { style: tableStyles.desktopCellContent, children: cellContent(column, row, textColor, styleOverrides) })
342
359
  }
343
360
  );
344
361
  }
@@ -2265,6 +2282,6 @@ var MonthStatusGrid = ({
2265
2282
  ] }, row[0]?.id)) });
2266
2283
  };
2267
2284
 
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 };
2285
+ 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
2286
  //# sourceMappingURL=index.mjs.map
2270
2287
  //# sourceMappingURL=index.mjs.map