@sfperusacdev/sf-ui 0.1.39 → 0.2.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.
@@ -3,7 +3,13 @@ import { IconType } from 'react-icons';
3
3
  import { AggregationFn } from '@tanstack/react-table';
4
4
  import { AsyncStateStore } from './asyncStateStore';
5
5
  import { CustomTableController } from './customTableController';
6
- export type TableHeaderVariant = "default" | "brand";
6
+ /**
7
+ * Skin del `<thead>` del CustomTable. Los 4 variants nuevos (`soft`, `neon`,
8
+ * `premium`, `matrix`) hacen match visual 1:1 con los variants del
9
+ * `Pagination`, así toda la tabla queda coherente arriba y abajo.
10
+ * Todos se apoyan en tokens `--sf-*` para reaccionar al tema activo.
11
+ */
12
+ export type TableHeaderVariant = "default" | "brand" | "soft" | "neon" | "premium" | "matrix";
7
13
  type BuiltInAggregation = "sum" | "min" | "max" | "mean" | "median" | "unique" | "uniqueCount" | "count";
8
14
  type TableAggregation = BuiltInAggregation | AggregationFn<unknown>;
9
15
  type CustomColumn<TData> = {
@@ -0,0 +1,52 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Piel visual del paginador. Todas usan los tokens del ecosistema (`--sf-*`),
4
+ * así que reaccionan al cambio de tema (Referencia / Agro / ERP / Dark).
5
+ *
6
+ * - `classic` outlines definidos, look enterprise clásico.
7
+ * - `soft` sin borders duros, chips flotantes con sombra y glow suave en el activo.
8
+ * - `neon` fondo oscuro, outlines luminosos y glow del acento en el activo.
9
+ * - `premium` degradado (--sf-accent + --sf-navy) con backdrop-blur; look "IA".
10
+ * - `matrix` fondo oscuro con acento verde saturado; look operacional/dashboard.
11
+ */
12
+ export type PaginationVariant = "classic" | "soft" | "neon" | "premium" | "matrix";
13
+ export interface PaginationProps {
14
+ /** Total de registros sin paginar. */
15
+ totalItems: number;
16
+ /** Página actual (base 1). */
17
+ page: number;
18
+ /** Cantidad de registros por página. */
19
+ pageSize: number;
20
+ /** Opciones para el selector "Mostrar N registros por página". */
21
+ pageSizeOptions?: number[];
22
+ /** Callback cuando cambia la página (base 1). */
23
+ onPageChange: (page: number) => void;
24
+ /** Callback cuando cambia el tamaño de página. */
25
+ onPageSizeChange: (size: number) => void;
26
+ /**
27
+ * Cuántos números de página mostrar a cada lado del actual antes de
28
+ * poner elipsis. Default: 1 (ej: `1 … 4 [5] 6 … 20`).
29
+ */
30
+ siblingCount?: number;
31
+ /** Muestra u oculta el input "Ir a la página". Default: true. */
32
+ showGoToPage?: boolean;
33
+ /** Muestra u oculta los botones « / ». Default: true. */
34
+ showFirstLast?: boolean;
35
+ /** Piel visual. Default: "classic". */
36
+ variant?: PaginationVariant;
37
+ /** Traducciones (en caso de reusar fuera de es). */
38
+ labels?: Partial<PaginationLabels>;
39
+ /** id opcional para tests / a11y. */
40
+ id?: string;
41
+ }
42
+ export interface PaginationLabels {
43
+ showing: (from: number, to: number, total: number) => string;
44
+ previous: string;
45
+ next: string;
46
+ showPerPage: (size: number) => string;
47
+ goToPage: string;
48
+ go: string;
49
+ first: string;
50
+ last: string;
51
+ }
52
+ export declare const Pagination: React.FC<PaginationProps>;
@@ -4,6 +4,8 @@ export { AsyncCustomTable } from './AsyncCustomTable';
4
4
  export type { AsyncCustomTableProps } from './AsyncCustomTable';
5
5
  export { PaginationRangeInput } from './PaginationRangeInput';
6
6
  export type { PaginationRangeData } from './PaginationRangeInput';
7
+ export { Pagination } from './Pagination';
8
+ export type { PaginationProps, PaginationLabels } from './Pagination';
7
9
  export { TableFiltersPanel } from './TableFiltersPanel';
8
10
  export { TableSortingPanel } from './TableSortingPanel';
9
11
  export { createLocalStorageAsyncStateStore } from './asyncStateStore';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfperusacdev/sf-ui",
3
- "version": "0.1.39",
3
+ "version": "0.2.0",
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",