@cascivo/charts 0.5.1 → 0.6.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +28 -2
  2. package/dist/index.js +1231 -1229
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1513,19 +1513,32 @@ declare function ScatterChart({
1513
1513
  visualMap,
1514
1514
  toolbox
1515
1515
  }: ScatterChartProps): import("react").JSX.Element;
1516
- interface SparklineProps {
1516
+ interface SparklineBaseProps {
1517
1517
  data: readonly number[];
1518
1518
  width?: number;
1519
1519
  height?: number;
1520
- label: string;
1521
1520
  color?: string;
1522
1521
  endDot?: boolean;
1523
1522
  }
1523
+ /**
1524
+ * Exactly one of `label` / `ariaLabel` is required — a chart with no accessible name is a
1525
+ * bug, so this stays enforced by the type. `ariaLabel` is the catalog's convention for an
1526
+ * invisible accessible name (here, the SVG `<title>`); `Sparkline` predates it and shipped
1527
+ * `label`, so both work and neither is deprecated.
1528
+ */
1529
+ type SparklineProps = SparklineBaseProps & ({
1530
+ label: string;
1531
+ ariaLabel?: never;
1532
+ } | {
1533
+ ariaLabel: string;
1534
+ label?: never;
1535
+ });
1524
1536
  declare function Sparkline({
1525
1537
  data,
1526
1538
  width,
1527
1539
  height,
1528
1540
  label,
1541
+ ariaLabel,
1529
1542
  color,
1530
1543
  endDot
1531
1544
  }: SparklineProps): import("react").JSX.Element;
@@ -1556,7 +1569,19 @@ declare function Meter({
1556
1569
  interface KpiProps {
1557
1570
  value: string | number;
1558
1571
  label: string;
1572
+ /**
1573
+ * The change to show beside the value, as a **number** — `Kpi` owns the formatting
1574
+ * (sign, arrow, colour, unit). Its sibling `Stat` takes a pre-formatted `string` and
1575
+ * leaves formatting to you; that is the whole difference between the two tiles.
1576
+ */
1559
1577
  delta?: number;
1578
+ /**
1579
+ * How to render `delta`. `'number'` (default) is locale-formatted with a sign.
1580
+ * `'percent'` treats `delta` as already being in percentage points and appends `%`
1581
+ * (`25.6` → `+25.6%`) — it does NOT multiply by 100. Pass a function for anything else;
1582
+ * it receives the raw number and owns the entire string, sign included.
1583
+ */
1584
+ deltaFormat?: 'number' | 'percent' | ((delta: number) => string);
1560
1585
  deltaLabel?: string;
1561
1586
  icon?: ReactNode;
1562
1587
  sparkline?: readonly number[];
@@ -1566,6 +1591,7 @@ declare function Kpi({
1566
1591
  value,
1567
1592
  label,
1568
1593
  delta,
1594
+ deltaFormat,
1569
1595
  deltaLabel,
1570
1596
  icon,
1571
1597
  sparkline,