@rubenpazch/image-viewer 0.0.0-stage → 1.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.
- package/README.md +42 -2
- package/dist/ImageViewer.d.ts +85 -0
- package/dist/ImageViewer.d.ts.map +1 -0
- package/dist/index.cjs.js +803 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +798 -0
- package/package.json +56 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ImageViewerItem {
|
|
4
|
+
/** Identificador estable (clave de React). Si falta, se usa la posición. */
|
|
5
|
+
id?: string | number;
|
|
6
|
+
/**
|
|
7
|
+
* URL de la imagen. Si todavía no está (p. ej. se pide con la sesión y se
|
|
8
|
+
* convierte en `blob:`), se muestra "Cargando…" hasta que llegue.
|
|
9
|
+
*/
|
|
10
|
+
src?: string;
|
|
11
|
+
/** Texto de la imagen: título en la barra y texto alternativo. */
|
|
12
|
+
caption: string;
|
|
13
|
+
/** `"error"` muestra el aviso de que no se pudo cargar. */
|
|
14
|
+
status?: "loading" | "error";
|
|
15
|
+
}
|
|
16
|
+
interface ImageViewerLabels {
|
|
17
|
+
/** Nombre del diálogo, con `{name}` (el `caption`). */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Contador con `{current}` y `{total}`. */
|
|
20
|
+
counter: string;
|
|
21
|
+
close: string;
|
|
22
|
+
download: string;
|
|
23
|
+
openInNewTab: string;
|
|
24
|
+
zoomIn: string;
|
|
25
|
+
zoomOut: string;
|
|
26
|
+
reset: string;
|
|
27
|
+
previous: string;
|
|
28
|
+
next: string;
|
|
29
|
+
loading: string;
|
|
30
|
+
loadFailed: string;
|
|
31
|
+
hintTouch: string;
|
|
32
|
+
hintMouse: string;
|
|
33
|
+
}
|
|
34
|
+
/** Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos. */
|
|
35
|
+
declare const DEFAULT_IMAGE_VIEWER_LABELS: ImageViewerLabels;
|
|
36
|
+
interface ImageViewerProps {
|
|
37
|
+
/** Imágenes que se pueden recorrer. */
|
|
38
|
+
images: ImageViewerItem[];
|
|
39
|
+
/** Imagen con la que abre (no controlado). */
|
|
40
|
+
initialIndex?: number;
|
|
41
|
+
/** Imagen visible (controlado). Úsalo junto con `onIndexChange`. */
|
|
42
|
+
index?: number;
|
|
43
|
+
/** Se llama al cambiar de imagen (flechas, teclado o deslizar). */
|
|
44
|
+
onIndexChange?: (index: number) => void;
|
|
45
|
+
/** Cierra el visor (botón, Escape). */
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
/** Muestra "Descargar" y recibe la imagen visible. */
|
|
48
|
+
onDownload?: (image: ImageViewerItem, index: number) => void;
|
|
49
|
+
/** Muestra "Abrir en una pestaña nueva" (solo en pantallas anchas). */
|
|
50
|
+
onOpenInNewTab?: (image: ImageViewerItem, index: number) => void;
|
|
51
|
+
/** Textos de la interfaz; por defecto en español. */
|
|
52
|
+
labels?: Partial<ImageViewerLabels>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Visor de imágenes a pantalla completa con zoom, para mouse y pantalla táctil:
|
|
56
|
+
* botones (+, −, 100 %), rueda del mouse, pellizco con dos dedos, doble clic o
|
|
57
|
+
* doble toque, arrastrar para moverse cuando está ampliada y deslizar para
|
|
58
|
+
* cambiar de imagen. Teclado: ← → cambian de imagen, + − hacen zoom, 0
|
|
59
|
+
* restablece y Escape cierra (sin llegar a lo que está debajo, como un Drawer).
|
|
60
|
+
*/
|
|
61
|
+
declare const ImageViewer: React.FC<ImageViewerProps>;
|
|
62
|
+
|
|
63
|
+
export { DEFAULT_IMAGE_VIEWER_LABELS, ImageViewer as default };
|
|
64
|
+
export type { ImageViewerItem, ImageViewerLabels, ImageViewerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACrE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
|