npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@giosg/reporting-metric-card

v2.1.6

Published

Reusable metric card visualization components

Readme

@giosg/reporting-metric-card

Reusable metric card visualization components for displaying analytics data.

Installation

npm install @giosg/reporting-metric-card

Usage

LineMetricCard

A complete line chart component with card wrapper and title included.

import { LineMetricCard } from '@giosg/reporting-metric-card';
import type { LineChartVisualizationData } from '@giosg/reporting-metric-card';

const data: LineChartVisualizationData = {
    current_period: {
        change: '15.50',
        total: 1234,
        daily: [
            { date: '2024-01-01', value: 100, week: 1, month: 1, year: 2024 },
            { date: '2024-01-02', value: 120, week: 1, month: 1, year: 2024 },
            // ... more daily data
        ],
    },
    previous_period_1: {
        change: '10.20',
        total: 1050,
        daily: [
            /* ... */
        ],
    },
    previous_period_2: {
        change: '5.30',
        total: 950,
        daily: [
            /* ... */
        ],
    },
};

function MyComponent() {
    return <LineMetricCard title="Total Conversations" unit="numeric" data={data} />;
}

Compact Mode

Display a minimal version without statistics and overlays:

<LineMetricCard title="Total Conversations" unit="numeric" data={data} compact={true} />

Props

LineMetricCard

  • title: string - The title displayed in the card header
  • unit: 'numeric' | 'time' | 'percentage' - The unit type for value formatting
  • data: LineChartVisualizationData - The chart data with current and previous periods
  • compact: boolean (optional) - Display a compact version without overlays and stats. Default: false

Data Structure

The component expects data in a specific format with three periods:

interface LineChartVisualizationData {
    current_period: LineChartPeriodData;
    previous_period_1: LineChartPeriodData;
    previous_period_2: LineChartPeriodData;
}

interface LineChartPeriodData {
    change: string; // Percentage change (e.g., "15.50")
    total: number; // Total value for the period
    daily: Array<{
        date: string; // ISO format YYYY-MM-DD
        value: number;
        week: number; // ISO week number
        month: number; // Month number
        year: number; // Full year
    }>;
}

Peer Dependencies

This package requires the following peer dependencies:

  • react ^18.0.0
  • react-dom ^18.0.0
  • @emotion/react ^11.0.0
  • @emotion/styled ^11.0.0
  • moment ^2.29.0
  • recharts ^2.0.0

License

UNLICENSED