@dloizides/ui-tables 1.25.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/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
  }
@@ -2240,6 +2256,7 @@ var MonthStatusGrid = ({
2240
2256
  selectedId = null,
2241
2257
  columns = 12 /* Twelve */,
2242
2258
  accessibilityLabel,
2259
+ accessibilityHint,
2243
2260
  cellHint,
2244
2261
  testID = MONTH_STATUS_GRID_TEST_ID
2245
2262
  }) => {
@@ -2248,7 +2265,7 @@ var MonthStatusGrid = ({
2248
2265
  const fitted = fitMonthGridColumns(columns, measuredWidth ?? windowWidth, GRID_GAP);
2249
2266
  const rows = useMemo(() => chunkIntoRows(cells, fitted), [cells, fitted]);
2250
2267
  const onLayout = (event) => setMeasuredWidth(event.nativeEvent.layout.width);
2251
- return /* @__PURE__ */ jsx(View, { accessibilityLabel, onLayout, role: "group", style: styles5.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxs(View, { style: styles5.row, testID: `${testID}-row`, children: [
2268
+ return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style: styles5.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxs(View, { style: styles5.row, testID: `${testID}-row`, children: [
2252
2269
  row.map((cell) => /* @__PURE__ */ jsx(
2253
2270
  GridCell,
2254
2271
  {
@@ -2264,6 +2281,6 @@ var MonthStatusGrid = ({
2264
2281
  ] }, row[0]?.id)) });
2265
2282
  };
2266
2283
 
2267
- 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 };
2268
2285
  //# sourceMappingURL=index.mjs.map
2269
2286
  //# sourceMappingURL=index.mjs.map