// @subframe/sync-disable -- local fix: render `label`, `value`, `percentage` and // `comparisonText` whenever they are present instead of when they are truthy. The // generated `{value ? … : null}` guards drop the number `0` and the empty string, // so every card whose metric was legitimately zero rendered as a headline with a // bare trend arrow and no figure at all (admin audit 2026-07-26: /health, // /system, /sales/tasks/today, /sales/contacts, /sales/calls, /sales/bookings, // /accounts/billing). /* * Documentation: * Stats Card — https://app.subframe.com/f023064a5ca0/library?component=Stats+Card_63f809c7-22ef-47f8-9fb9-0f33b252be3f */ import React from "react"; import { FeatherArrowRight } from "@subframe/core"; import { FeatherDollarSign } from "@subframe/core"; import { FeatherTrendingDown } from "@subframe/core"; import { FeatherTrendingUp } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; /** * A slot is rendered when it carries visible content. The number `0` does — it * is a legitimate metric — while `undefined`, `null`, `false` and the empty * string do not. Call sites pass `percentage=""` to opt out of that slot, so an * empty string must stay unrendered rather than produce an empty element. */ function hasContent(node: React.ReactNode): boolean { return node !== undefined && node !== null && node !== false && node !== ""; } export interface StatsCardRootProps extends React.HTMLAttributes { trend?: "positive" | "negative" | "neutral"; label?: React.ReactNode; value?: React.ReactNode; percentage?: React.ReactNode; comparisonText?: React.ReactNode; icon?: React.ReactNode; highContrastText?: boolean; className?: string; } const StatsCardRoot = React.forwardRef( function StatsCardRoot( { trend = "positive", label, value, percentage, comparisonText, icon = , highContrastText = false, className, ...otherProps }: StatsCardRootProps, ref ) { return (
{hasContent(label) ? ( {label} ) : null} {icon ? ( {icon} ) : null}
{hasContent(value) ? ( {value} ) : null}
{hasContent(percentage) ? ( {percentage} ) : null}
{hasContent(comparisonText) ? ( {comparisonText} ) : null}
); } ); export const StatsCard = StatsCardRoot;