@sfperusacdev/sf-ui 0.2.7 → 0.2.8

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.
@@ -0,0 +1,14 @@
1
+ export type ChartLegendItem = {
2
+ label: string;
3
+ /** Color CSS (token o hex), el mismo de la serie del gráfico. */
4
+ color: string;
5
+ };
6
+ export type ChartLegendProps = {
7
+ items: ChartLegendItem[];
8
+ className?: string;
9
+ };
10
+ /**
11
+ * Leyenda compacta en una línea, para la cabecera de una tarjeta (`DashboardCard.headerAction`) cuando el gráfico va
12
+ * con `showLegend={false}`: deja el alto del gráfico para los datos.
13
+ */
14
+ export declare const ChartLegend: ({ items, className }: ChartLegendProps) => import("react").JSX.Element;
@@ -1,5 +1,7 @@
1
1
  export { Chart } from './Chart';
2
2
  export type { ChartProps } from './Chart';
3
+ export { ChartLegend } from './ChartLegend';
4
+ export type { ChartLegendItem, ChartLegendProps } from './ChartLegend';
3
5
  export { Sparkline } from './Sparkline';
4
6
  export { DiagnosticRadar } from './DiagnosticRadar';
5
7
  export { DeviationBand } from './DeviationBand';
@@ -29,6 +29,11 @@ export type DashboardPageFrameProps = {
29
29
  error?: string | null;
30
30
  /** Hay consultas en curso: el botón «Aplicar» gira y el chip de estado cuenta los segundos. */
31
31
  loading?: boolean;
32
+ /**
33
+ * Lo que se ve todavía es del rango anterior mientras llega el nuevo: el contenido se atenúa y no responde a clics
34
+ * (para no abrir detalles viejos), pero la página se sigue desplazando y no vuelve arriba.
35
+ */
36
+ stale?: boolean;
32
37
  /** Momento (epoch ms) del dato más antiguo en pantalla; alimenta el chip «datos de las HH:MM». */
33
38
  updatedAt?: number | null;
34
39
  /** El corte es el día de hoy: el chip dice «datos en vivo». */
@@ -53,4 +58,4 @@ export type DashboardPageFrameProps = {
53
58
  * botón de actualizar y el filtro de rango de fechas con borrador y validación. Los hijos van dentro de
54
59
  * `DashboardLayout`, así que `DashboardBoard` encaja directamente.
55
60
  */
56
- export declare const DashboardPageFrame: ({ title, subtitle, mode, range, onApply, fromLabel, toLabel, dayLabel, compareFieldLabel, validate, error, loading, updatedAt, live, cutoffLabel, onRefresh, refreshLabel, compareLabel, pendingLabel, applyLabel, filterAriaLabel, slowAfterSeconds, className, children, }: DashboardPageFrameProps) => import("react").JSX.Element;
61
+ export declare const DashboardPageFrame: ({ title, subtitle, mode, range, onApply, fromLabel, toLabel, dayLabel, compareFieldLabel, validate, error, loading, stale, updatedAt, live, cutoffLabel, onRefresh, refreshLabel, compareLabel, pendingLabel, applyLabel, filterAriaLabel, slowAfterSeconds, className, children, }: DashboardPageFrameProps) => import("react").JSX.Element;
@@ -14,6 +14,13 @@ export type DonutBreakdownProps = {
14
14
  strokeWidth?: number;
15
15
  /** Leyenda con nombre, cantidad y porcentaje debajo del donut. Por defecto `true`. */
16
16
  showLegend?: boolean;
17
+ /**
18
+ * `list` (por defecto): una fila por segmento. `stat`: la cantidad en grande y, debajo, «nombre · porcentaje»;
19
+ * para una dona que ocupa la tarjeta, con pocos segmentos.
20
+ */
21
+ legendVariant?: "list" | "stat";
22
+ /** Texto del porcentaje de cada segmento en la leyenda (recibe la fracción 0–1). Por defecto, entero: «51%». */
23
+ formatPct?: (fraction: number) => string;
17
24
  className?: string;
18
25
  };
19
26
  /**
@@ -22,4 +29,4 @@ export type DonutBreakdownProps = {
22
29
  * cómo se reparte un total entre categorías. SVG puro, mismo patrón de arcos que `DonutGauge`,
23
30
  * sin dependencia nueva.
24
31
  */
25
- export declare const DonutBreakdown: ({ segments, centerValue, centerLabel, size, strokeWidth, showLegend, className, }: DonutBreakdownProps) => import("react").JSX.Element;
32
+ export declare const DonutBreakdown: ({ segments, centerValue, centerLabel, size, strokeWidth, showLegend, legendVariant, formatPct, className, }: DonutBreakdownProps) => import("react").JSX.Element;
@@ -1,7 +1,12 @@
1
- /** Columna del panel de detalle: `key` indexa la fila ya aplanada (ver `DetailPanel.rowMapper`). */
1
+ /**
2
+ * Columna del panel de detalle: `key` indexa la fila ya aplanada (ver `DetailPanel.rowMapper`). `exportKey`, si se
3
+ * da, es el campo que se escribe en el Excel en lugar de `key`: sirve para mostrar un resumen en pantalla y el dato
4
+ * completo al exportar (p. ej. «25 días: 01–03/09, … y 2 tramos más» en pantalla, todos los tramos en el Excel).
5
+ */
2
6
  export type DetailColumn = {
3
7
  key: string;
4
8
  header: string;
9
+ exportKey?: string;
5
10
  };
6
11
  /** Un caso distinto dentro de la misma cifra: su pestaña, la acción que se sugiere y sus filas. */
7
12
  export type DetailGroup<Row> = {
@@ -16,7 +16,7 @@ export type CalendarDayBadge = {
16
16
  count: number;
17
17
  variant?: CalendarBadgeVariant;
18
18
  };
19
- export type DonutGaugeSize = "xs" | "sm" | "md" | "lg";
19
+ export type DonutGaugeSize = "xs" | "sm" | "md" | "lg" | "xl";
20
20
  export type DashboardCardVariant = "default" | "accent" | "critical" | "warning" | "success";
21
21
  /** Estado del contenido de `DashboardCard`. "idle" (por defecto) = renderiza `children` tal cual (acabado
22
22
  * actual). Precedencia cuando se combinan por error del consumidor: "error" > "loading" > "empty" > "idle". */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfperusacdev/sf-ui",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "SF UI — librería de componentes React (inputs, tablas, hooks) para aplicaciones SF Perú.",
5
5
  "type": "module",
6
6
  "main": "./dist/sf-ui.umd.cjs",