@pdf-viewer/react 1.1.0 → 1.1.1-beta.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 (90) hide show
  1. package/dist/Container-44b8ad45.js +38 -0
  2. package/dist/RPDefaultLayout-79c7577a.js +2907 -0
  3. package/dist/assets/Button.css +1 -1
  4. package/dist/assets/Container.css +1 -1
  5. package/dist/assets/MenuItem.css +1 -1
  6. package/dist/assets/Popover.css +1 -0
  7. package/dist/assets/RPDefaultLayout.css +1 -1
  8. package/dist/components/RPConfig.js +344 -322
  9. package/dist/components/RPController.js +38 -35
  10. package/dist/components/RPDropFileZone.js +23 -22
  11. package/dist/components/RPPages.js +3 -2
  12. package/dist/components/RPProvider.js +1 -1
  13. package/dist/components/layout/Container.js +1 -1
  14. package/dist/components/layout/RPDefaultLayout.js +2 -2
  15. package/dist/components/layout/sidebar/RPSidebar.js +3 -2
  16. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  17. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  18. package/dist/components/layout/toolbar/DarkModeTool.js +22 -21
  19. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  20. package/dist/components/layout/toolbar/DocumentProperties.js +15 -14
  21. package/dist/components/layout/toolbar/FileDownloadTool.js +3 -2
  22. package/dist/components/layout/toolbar/FileUploadTool.js +20 -22
  23. package/dist/components/layout/toolbar/FullScreenTool.js +40 -34
  24. package/dist/components/layout/toolbar/MenuItem.js +7 -7
  25. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  26. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  27. package/dist/components/layout/toolbar/OtherTool.js +4 -3
  28. package/dist/components/layout/toolbar/Paginate.js +3 -2
  29. package/dist/components/layout/toolbar/PrintTool.js +3 -2
  30. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  31. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  32. package/dist/components/layout/toolbar/RotateTool.js +27 -26
  33. package/dist/components/layout/toolbar/ScrollModeTool.js +43 -42
  34. package/dist/components/layout/toolbar/SearchTool.js +5 -3
  35. package/dist/components/layout/toolbar/SelectionModeTool.js +31 -30
  36. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  37. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  38. package/dist/components/page/AnnotationLayer.js +3 -2
  39. package/dist/components/page/CanvasLayer.js +3 -2
  40. package/dist/components/page/DualPage.js +1 -1
  41. package/dist/components/page/RPPage.js +3 -2
  42. package/dist/components/page/SinglePage.js +1 -1
  43. package/dist/components/page/TextLayer.js +3 -2
  44. package/dist/components/ui/Button.js +10 -10
  45. package/dist/components/ui/Checkbox.js +92 -252
  46. package/dist/components/ui/DropDown.js +1 -1
  47. package/dist/components/ui/LoadingIndicator.js +3 -2
  48. package/dist/components/ui/Popover.js +3060 -0
  49. package/dist/components/ui/RPTooltip.js +331 -855
  50. package/dist/contexts/LocalizationContext.js +38 -0
  51. package/dist/contexts/PaginationContext.js +3 -3
  52. package/dist/contexts/PrintContext.js +1 -1
  53. package/dist/contexts/SearchContext.js +1 -1
  54. package/dist/contexts/ThumbnailsContext.js +1 -1
  55. package/dist/floating-ui.react-dom-88a86594.js +1447 -0
  56. package/dist/index-48ca3f30.js +307 -0
  57. package/dist/index-4ba3ab9a.js +1877 -0
  58. package/dist/main.js +14 -13
  59. package/dist/th_TH-2fba4a89.js +388 -0
  60. package/dist/types/components/ui/Popover.d.ts +9 -0
  61. package/dist/types/components/ui/RPTooltip.d.ts +3 -2
  62. package/dist/types/contexts/LocalizationContext.d.ts +5 -0
  63. package/dist/types/contexts/PaginationContext.d.ts +2 -2
  64. package/dist/types/locales/en_US.json.d.ts +80 -0
  65. package/dist/types/locales/it_IT.json.d.ts +80 -0
  66. package/dist/types/locales/pt_PT.json.d.ts +80 -0
  67. package/dist/types/locales/th_TH.json.d.ts +80 -0
  68. package/dist/types/locales/zh_CN.json.d.ts +80 -0
  69. package/dist/types/main.d.ts +1 -1
  70. package/dist/types/utils/hooks/useLocalization.d.ts +10 -0
  71. package/dist/types/utils/hooks/useScrollToPage.d.ts +1 -1
  72. package/dist/types/utils/smoothScrollTo.d.ts +2 -0
  73. package/dist/types/utils/types.d.ts +92 -77
  74. package/dist/utils/hooks/useFileDownload.js +3 -2
  75. package/dist/utils/hooks/useLicense.js +32 -40
  76. package/dist/utils/hooks/useLocalization.js +25 -0
  77. package/dist/utils/hooks/usePaginate.js +3 -2
  78. package/dist/utils/hooks/usePrint.js +3 -2
  79. package/dist/utils/hooks/useScrollToPage.js +4 -2
  80. package/dist/utils/hooks/useSearch.js +3 -2
  81. package/dist/utils/hooks/useThumbnail.js +3 -2
  82. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  83. package/dist/utils/smoothScrollTo.js +18 -0
  84. package/dist/utils/types.js +17 -8
  85. package/package.json +2 -1
  86. package/dist/Container-fdb0a71f.js +0 -38
  87. package/dist/RPDefaultLayout-651c2426.js +0 -2832
  88. package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
  89. package/dist/index-316854c1.js +0 -2299
  90. package/dist/index-71898eb9.js +0 -139
@@ -0,0 +1,80 @@
1
+ declare const _default: {
2
+ "searchButtonTooltip": "Pesquisar no documento",
3
+ "searchInputPlaceholder": "Pressione Enter para pesquisar",
4
+ "searchPrevTooltip": "Correspondência anterior",
5
+ "searchNextTooltip": "Correspondência seguinte",
6
+ "searchCloseButtonTooltip": "Fechar",
7
+ "searchMatchCaseLabel": "Diferenciar maiúsculas/minúsculas",
8
+ "searchMatchCaseTooltip": "Pesquisar texto com distinção de maiúsculas/minúsculas",
9
+ "searchWholeWordsLabel": "Palavra inteira",
10
+ "searchWholeWordsTooltip": "Pesquisar palavras exatas sem distinção de maiúsculas/minúsculas",
11
+ "previousPageTooltip": "Página anterior",
12
+ "nextPageTooltip": "Próxima página",
13
+ "zoomOutTooltip": "Reduzir",
14
+ "zoomInTooltip": "Ampliar",
15
+ "zoomSelectTooltip": "Selecionar nível de zoom",
16
+ "zoomActualSize": "Tamanho real",
17
+ "zoomPageFit": "Ajustar à página",
18
+ "zoomPageWidth": "Largura da página",
19
+ "themeEnableDarkTooltip": "Ativar tema escuro",
20
+ "themeEnableLightTooltip": "Ativar tema claro",
21
+ "openLocalFileLabel": "Abrir arquivo",
22
+ "openLocalFileTooltip": "Abrir arquivo",
23
+ "downloadFileLabel": "Baixar arquivo",
24
+ "downloadFileTooltip": "Baixar arquivo",
25
+ "printLabel": "Imprimir",
26
+ "printTooltip": "Imprimir",
27
+ "printLoadingMessage": "Preparando documento",
28
+ "printCancelLabel": "Cancelar",
29
+ "fullScreenLabel": "Tela inteira",
30
+ "fullScreenTooltip": "Tela inteira",
31
+ "moreOptionTooltip": "Mais opções",
32
+ "firstPageLabel": "Primeira página",
33
+ "firstPageTooltip": "Ir para a primeira página",
34
+ "lastPageLabel": "Última página",
35
+ "lastPageTooltip": "Ir para a última página",
36
+ "rotateClockwiseLabel": "Girar no sentido horário",
37
+ "rotateClockwiseTooltip": "Girar no sentido horário",
38
+ "rotateCounterclockwiseLabel": "Girar no sentido anti-horário",
39
+ "rotateCounterclockwiseTooltip": "Girar no sentido anti-horário",
40
+ "textSelectionLabel": "Ferramenta de seleção de texto",
41
+ "textSelectionTooltip": "Ativar ferramenta de seleção de texto",
42
+ "handToolLabel": "Ferramenta de mão",
43
+ "handToolTooltip": "Ativar ferramenta de mão",
44
+ "documentPropertiesLabel": "Propriedades do documento",
45
+ "documentPropertiesTooltip": "Ver propriedades do documento",
46
+ "pageScrollingLabel": "Rolagem página",
47
+ "pageScrollingTooltip": "Ativar rolagem de página",
48
+ "verticalScrollingLabel": "Rolagem vertical",
49
+ "verticalScrollingTooltip": "Ativar rolagem vertical",
50
+ "horizontalLabel": "Rolagem horizontal",
51
+ "horizontalTooltip": "Ativar rolagem horizontal",
52
+ "wrappedScrollingLabel": "Rolagem envolvida",
53
+ "wrappedScrollingTooltip": "Ativar rolagem envolvente",
54
+ "singlePageLabel": "Página única",
55
+ "singlePageTooltip": "Ativar página única",
56
+ "dualPageLabel": "Página dupla",
57
+ "dualPageTooltip": "Ativar página dupla",
58
+ "propertiesFilenameLabel": "Nome do arquivo",
59
+ "propertiesFileSizeLabel": "Tamanho do arquivo",
60
+ "propertiesTitleLabel": "Título",
61
+ "propertiesAuthorLabel": "Autor",
62
+ "propertiesSubjectLabel": "Assunto",
63
+ "propertiesKeywordLabel": "Palavras-chave",
64
+ "propertiesCreatorLabel": "Criador",
65
+ "propertiesCreateOnLabel": "Criado em",
66
+ "propertiesModifiedOnLabel": "Modificado em",
67
+ "propertiesPDFProducerLabel": "Produtor do PDF",
68
+ "propertiesPDFVersionLabel": "Versão do PDF",
69
+ "propertiesPageCountLabel": "Número de páginas",
70
+ "thumbnailTooltip": "Miniatura",
71
+ "passwordModalTitle": "Senha necessária",
72
+ "passwordModalMessage": "Este documento é protegido por senha. Por favor, insira uma senha para abrir o arquivo.",
73
+ "passwordPlaceholder": "Insira a senha",
74
+ "passwordConfirmLabel": "Enviar",
75
+ "passwordError": "Senha incorreta",
76
+ "dragDropFileMessage": "Arraste e solte o arquivo PDF aqui"
77
+ }
78
+ ;
79
+
80
+ export default _default;
@@ -0,0 +1,80 @@
1
+ declare const _default: {
2
+ "searchButtonTooltip": "ค้นหาในเอกสาร",
3
+ "searchInputPlaceholder": "กรอกคำค้นหา",
4
+ "searchPrevTooltip": "ผลการค้นหาก่อนหน้า",
5
+ "searchNextTooltip": "ผลการค้นหาถัดไป",
6
+ "searchCloseButtonTooltip": "ปิด",
7
+ "searchMatchCaseLabel": "ข้อความที่มีคำ",
8
+ "searchMatchCaseTooltip": "ค้นหาข้อความที่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
9
+ "searchWholeWordsLabel": "ทั้งคำ",
10
+ "searchWholeWordsTooltip": "ค้นหาคำที่ตรงตัวไม่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
11
+ "previousPageTooltip": "หน้าก่อนหน้า",
12
+ "nextPageTooltip": "หน้าถัดไป",
13
+ "zoomOutTooltip": "ย่อ",
14
+ "zoomInTooltip": "ขยาย",
15
+ "zoomSelectTooltip": "เลือกระดับซูม",
16
+ "zoomActualSize": "ขนาดจริง",
17
+ "zoomPageFit": "พอดีหน้า",
18
+ "zoomPageWidth": "พอดีความกว้าง",
19
+ "themeEnableDarkTooltip": "เปิดโหมดมืด",
20
+ "themeEnableLightTooltip": "เปิดโหมดสว่าง",
21
+ "openLocalFileLabel": "เปิดไฟล์",
22
+ "openLocalFileTooltip": "เปิดไฟล์",
23
+ "downloadFileLabel": "ดาวน์โหลดเอกสาร",
24
+ "downloadFileTooltip": "ดาวน์โหลดเอกสาร",
25
+ "printLabel": "พิมพ์",
26
+ "printTooltip": "พิมพ์",
27
+ "printLoadingMessage": "เตรียมเอกสาร",
28
+ "printCancelLabel": "ยกเลิก",
29
+ "fullScreenLabel": "เต็มจอ",
30
+ "fullScreenTooltip": "เต็มจอ",
31
+ "moreOptionTooltip": "ตัวเลือกเพิ่มเติม",
32
+ "firstPageLabel": "หน้าแรก",
33
+ "firstPageTooltip": "ไปที่หน้าแรก",
34
+ "lastPageLabel": "หน้าสุดท้าย",
35
+ "lastPageTooltip": "ไปที่หน้าสุดท้าย",
36
+ "rotateClockwiseLabel": "หมุนตามเข็มนาฬิกา",
37
+ "rotateClockwiseTooltip": "หมุนตามเข็มนาฬิกา",
38
+ "rotateCounterclockwiseLabel": "หมุนทวนเข็มนาฬิกา",
39
+ "rotateCounterclockwiseTooltip": "หมุนทวนเข็มนาฬิกา",
40
+ "textSelectionLabel": "เครื่องมือเลือกข้อความ",
41
+ "textSelectionTooltip": "เปิดใช้การเลือกข้อความ",
42
+ "handToolLabel": "เครื่องมือแฮนด์ทูล",
43
+ "handToolTooltip": "เปิดใช้แฮนด์ทูล",
44
+ "documentPropertiesLabel": "คุณสมบัติของเอกสาร",
45
+ "documentPropertiesTooltip": "ดูคุณสมบัติของเอกสาร",
46
+ "pageScrollingLabel": "การเลื่อนภายในหน้า",
47
+ "pageScrollingTooltip": "เปิดใช้การเลื่อนภายในหน้า",
48
+ "verticalScrollingLabel": "การเลื่อนแนวตั้ง",
49
+ "verticalScrollingTooltip": "เปิดใช้การเลื่อนแนวตั้ง",
50
+ "horizontalLabel": "การเลื่อนแนวนอน",
51
+ "horizontalTooltip": "เปิดใช้การเลื่อนแนวนอน",
52
+ "wrappedScrollingLabel": "การเลื่อนแบบแรพ",
53
+ "wrappedScrollingTooltip": "เปิดใช้การเลื่อนแบบแรพ",
54
+ "singlePageLabel": "หน้าเดี่ยว",
55
+ "singlePageTooltip": "เปิดใช้หน้าเดี่ยว",
56
+ "dualPageLabel": "หน้าคู่",
57
+ "dualPageTooltip": "เปิดใช้หน้าคู่",
58
+ "propertiesFilenameLabel": "ชื่อเอกสาร",
59
+ "propertiesFileSizeLabel": "ขนาดเอกสาร",
60
+ "propertiesTitleLabel": "ชื่อเรื่อง",
61
+ "propertiesAuthorLabel": "ผู้เขียน",
62
+ "propertiesSubjectLabel": "หัวข้อ",
63
+ "propertiesKeywordLabel": "คำสำคัญ",
64
+ "propertiesCreatorLabel": "ผู้สร้าง",
65
+ "propertiesCreateOnLabel": "วันที่สร้าง",
66
+ "propertiesModifiedOnLabel": "วันที่แก้ไข",
67
+ "propertiesPDFProducerLabel": "ผู้ผลิต PDF",
68
+ "propertiesPDFVersionLabel": "เวอร์ชัน PDF",
69
+ "propertiesPageCountLabel": "จำนวนหน้า",
70
+ "thumbnailTooltip": "ภาพย่อ",
71
+ "passwordModalTitle": "กรุณากรอกรหัสผ่าน",
72
+ "passwordModalMessage": "เอกสารนี้ได้รับการป้องกันด้วยรหัสผ่าน กรุณาใส่รหัสผ่านเพื่อเปิดไฟล์",
73
+ "passwordPlaceholder": "กรอกรหัสผ่าน",
74
+ "passwordConfirmLabel": "ส่ง",
75
+ "passwordError": "รหัสผ่านไม่ถูกต้อง",
76
+ "dragDropFileMessage": "ลากและวางไฟล์ PDF ที่นี่"
77
+ }
78
+ ;
79
+
80
+ export default _default;
@@ -0,0 +1,80 @@
1
+ declare const _default: {
2
+ "searchButtonTooltip": "搜索文件",
3
+ "searchInputPlaceholder": "输入搜索词",
4
+ "searchPrevTooltip": "上一条",
5
+ "searchNextTooltip": "下一条",
6
+ "searchCloseButtonTooltip": "关闭",
7
+ "searchMatchCaseLabel": "区分大小写",
8
+ "searchMatchCaseTooltip": "搜索区分大小写",
9
+ "searchWholeWordsLabel": "全字匹配",
10
+ "searchWholeWordsTooltip": "搜索完全匹配",
11
+ "previousPageTooltip": "上一页",
12
+ "nextPageTooltip": "下一页",
13
+ "zoomOutTooltip": "放大",
14
+ "zoomInTooltip": "缩小",
15
+ "zoomSelectTooltip": "选择缩放级别",
16
+ "zoomActualSize": "实际大小",
17
+ "zoomPageFit": "适合页面",
18
+ "zoomPageWidth": "页面宽度",
19
+ "themeEnableDarkTooltip": "切换到深色模式",
20
+ "themeEnableLightTooltip": "切换到浅色模式",
21
+ "openLocalFileLabel": "打开文件",
22
+ "openLocalFileTooltip": "打开文件",
23
+ "downloadFileLabel": "下载文件",
24
+ "downloadFileTooltip": "下载文件",
25
+ "printLabel": "打印",
26
+ "printTooltip": "打印",
27
+ "printLoadingMessage": "准备文件",
28
+ "printCancelLabel": "取消",
29
+ "fullScreenLabel": "全屏",
30
+ "fullScreenTooltip": "全屏",
31
+ "moreOptionTooltip": "更多选项",
32
+ "firstPageLabel": "第一页",
33
+ "firstPageTooltip": "跳转到第一页",
34
+ "lastPageLabel": "最后一页",
35
+ "lastPageTooltip": "跳转到最后一页",
36
+ "rotateClockwiseLabel": "顺时针旋转",
37
+ "rotateClockwiseTooltip": "顺时针旋转",
38
+ "rotateCounterclockwiseLabel": "逆时针旋转",
39
+ "rotateCounterclockwiseTooltip": "逆时针旋转",
40
+ "textSelectionLabel": "文本选择工具",
41
+ "textSelectionTooltip": "启用文本选择工具",
42
+ "handToolLabel": "手型工具",
43
+ "handToolTooltip": "启用手型工具",
44
+ "documentPropertiesLabel": "文件属性",
45
+ "documentPropertiesTooltip": "查看文件属性",
46
+ "pageScrollingLabel": "页面滚动",
47
+ "pageScrollingTooltip": "启用页面滚动",
48
+ "verticalScrollingLabel": "垂直滚动",
49
+ "verticalScrollingTooltip": "启用垂直滚动",
50
+ "horizontalLabel": "水平滚动",
51
+ "horizontalTooltip": "启用水平滚动",
52
+ "wrappedScrollingLabel": "环绕滚动",
53
+ "wrappedScrollingTooltip": "启用环绕滚动",
54
+ "singlePageLabel": "单页面视图",
55
+ "singlePageTooltip": "启用单页视图",
56
+ "dualPageLabel": "双页面视图",
57
+ "dualPageTooltip": "启用双页视图",
58
+ "propertiesFilenameLabel": "文件名称",
59
+ "propertiesFileSizeLabel": "文件大小",
60
+ "propertiesTitleLabel": "标题",
61
+ "propertiesAuthorLabel": "作者",
62
+ "propertiesSubjectLabel": "主题",
63
+ "propertiesKeywordLabel": "关键字",
64
+ "propertiesCreatorLabel": "创建者",
65
+ "propertiesCreateOnLabel": "创建于",
66
+ "propertiesModifiedOnLabel": "修改于",
67
+ "propertiesPDFProducerLabel": "PDF 制作程序 ",
68
+ "propertiesPDFVersionLabel": "PDF版本",
69
+ "propertiesPageCountLabel": "页数",
70
+ "thumbnailTooltip": "缩略图",
71
+ "passwordModalTitle": "需要密码",
72
+ "passwordModalMessage": "此文件受密码保护。请输入密码以打开文件。",
73
+ "passwordPlaceholder": "输入密码",
74
+ "passwordConfirmLabel": "提交",
75
+ "passwordError": "密码错误",
76
+ "dragDropFileMessage": "将PDF文件拖放到这里"
77
+ }
78
+ ;
79
+
80
+ export default _default;
@@ -20,4 +20,4 @@ export { usePdfProperties } from './utils/hooks/usePdfProperties';
20
20
  export { useFullScreenContext } from './contexts/FullScreenContext';
21
21
  export { type PDFDocumentProxy } from 'pdfjs-dist';
22
22
  export type { CharacterMap, DarkModeProps, DownloadToolProps, FullScreenToolProps, Localization, MatchValue, OpenFileToolProps, PageNavigationToolProps, PdfPage, PdfProperties, PreparePrintProgress, PrintToolProps, RPConfigProps, RPThemeProps, RPProviderProps, RPLayoutProps, RPIcons, RPSlots, SearchOptions, SetPageResult, ScrollModeProps, ThumbnailToolProps, ViewModeProps, ZoomProps } from './utils/types';
23
- export { ViewMode, ScrollMode, ZoomLevel } from './utils/types';
23
+ export { ViewMode, ScrollMode, ZoomLevel, Locales } from './utils/types';
@@ -0,0 +1,10 @@
1
+ import { Dispatch } from 'react';
2
+ import { Localization, LocalizationMap } from '../types';
3
+ interface LocalizationProps {
4
+ locale: string;
5
+ setLocale: Dispatch<React.SetStateAction<string>>;
6
+ localeMessages: Localization;
7
+ addLocalization: (value: LocalizationMap) => void;
8
+ }
9
+ export declare const useLocalization: (initialLocal: string) => LocalizationProps;
10
+ export {};
@@ -1,3 +1,3 @@
1
1
  export declare const useScrollToPage: () => {
2
- scrollToPage: (page: number) => void;
2
+ scrollToPage: (page: number) => Promise<void>;
3
3
  };
@@ -0,0 +1,2 @@
1
+ import { ScrollPosition } from './types';
2
+ export declare function smoothScrollTo(element: HTMLElement, targetPosition: ScrollPosition, onCompleted?: () => void): void;
@@ -55,81 +55,81 @@ export declare enum ZoomLevel {
55
55
  PAGE_WIDTH = "Width"
56
56
  }
57
57
  export type Localization = {
58
- searchButtonTooltip: string;
59
- searchInputPlaceholder: string;
60
- searchPrevTooltip: string;
61
- searchNextTooltip: string;
62
- searchCloseButtonTooltip: string;
63
- searchMatchCaseLabel: string;
64
- searchMatchCaseTooltip: string;
65
- searchWholeWordsLabel: string;
66
- searchWholeWordsTooltip: string;
67
- previousPageTooltip: string;
68
- nextPageTooltip: string;
69
- zoomOutTooltip: string;
70
- zoomInTooltip: string;
71
- zoomSelectTooltip: string;
72
- zoomActualSize: string;
73
- zoomPageFit: string;
74
- zoomPageWidth: string;
75
- themeEnableDarkTooltip: string;
76
- themeEnableLightTooltip: string;
77
- openLocalFileLabel: string;
78
- openLocalFileTooltip: string;
79
- downloadFileLabel: string;
80
- downloadFileTooltip: string;
81
- printLabel: string;
82
- printTooltip: string;
83
- printLoadingMessage: string;
84
- printCancelLabel: string;
85
- fullScreenLabel: string;
86
- fullScreenTooltip: string;
87
- moreOptionTooltip: string;
88
- firstPageLabel: string;
89
- firstPageTooltip: string;
90
- lastPageLabel: string;
91
- lastPageTooltip: string;
92
- rotateClockwiseLabel: string;
93
- rotateClockwiseTooltip: string;
94
- rotateCounterclockwiseLabel: string;
95
- rotateCounterclockwiseTooltip: string;
96
- textSelectionLabel: string;
97
- textSelectionTooltip: string;
98
- handToolLabel: string;
99
- handToolTooltip: string;
100
- pageScrollingLabel: string;
101
- pageScrollingTooltip: string;
102
- verticalScrollingLabel: string;
103
- verticalScrollingTooltip: string;
104
- horizontalLabel: string;
105
- horizontalTooltip: string;
106
- wrappedScrollingLabel: string;
107
- wrappedScrollingTooltip: string;
108
- singlePageLabel: string;
109
- singlePageTooltip: string;
110
- dualPageLabel: string;
111
- dualPageTooltip: string;
112
- documentPropertiesLabel: string;
113
- documentPropertiesTooltip: string;
114
- propertiesFilenameLabel: string;
115
- propertiesFileSizeLabel: string;
116
- propertiesTitleLabel: string;
117
- propertiesAuthorLabel: string;
118
- propertiesSubjectLabel: string;
119
- propertiesKeywordLabel: string;
120
- propertiesCreatorLabel: string;
121
- propertiesCreateOnLabel: string;
122
- propertiesModifiedOnLabel: string;
123
- propertiesPDFProducerLabel: string;
124
- propertiesPDFVersionLabel: string;
125
- propertiesPageCountLabel: string;
126
- thumbnailTooltip: string;
127
- passwordModalTitle: string;
128
- passwordModalMessage: string;
129
- passwordPlaceholder: string;
130
- passwordConfirmLabel: string;
131
- passwordError: string;
132
- dragDropFileMessage: string;
58
+ searchButtonTooltip?: string;
59
+ searchInputPlaceholder?: string;
60
+ searchPrevTooltip?: string;
61
+ searchNextTooltip?: string;
62
+ searchCloseButtonTooltip?: string;
63
+ searchMatchCaseLabel?: string;
64
+ searchMatchCaseTooltip?: string;
65
+ searchWholeWordsLabel?: string;
66
+ searchWholeWordsTooltip?: string;
67
+ previousPageTooltip?: string;
68
+ nextPageTooltip?: string;
69
+ zoomOutTooltip?: string;
70
+ zoomInTooltip?: string;
71
+ zoomSelectTooltip?: string;
72
+ zoomActualSize?: string;
73
+ zoomPageFit?: string;
74
+ zoomPageWidth?: string;
75
+ themeEnableDarkTooltip?: string;
76
+ themeEnableLightTooltip?: string;
77
+ openLocalFileLabel?: string;
78
+ openLocalFileTooltip?: string;
79
+ downloadFileLabel?: string;
80
+ downloadFileTooltip?: string;
81
+ printLabel?: string;
82
+ printTooltip?: string;
83
+ printLoadingMessage?: string;
84
+ printCancelLabel?: string;
85
+ fullScreenLabel?: string;
86
+ fullScreenTooltip?: string;
87
+ moreOptionTooltip?: string;
88
+ firstPageLabel?: string;
89
+ firstPageTooltip?: string;
90
+ lastPageLabel?: string;
91
+ lastPageTooltip?: string;
92
+ rotateClockwiseLabel?: string;
93
+ rotateClockwiseTooltip?: string;
94
+ rotateCounterclockwiseLabel?: string;
95
+ rotateCounterclockwiseTooltip?: string;
96
+ textSelectionLabel?: string;
97
+ textSelectionTooltip?: string;
98
+ handToolLabel?: string;
99
+ handToolTooltip?: string;
100
+ pageScrollingLabel?: string;
101
+ pageScrollingTooltip?: string;
102
+ verticalScrollingLabel?: string;
103
+ verticalScrollingTooltip?: string;
104
+ horizontalLabel?: string;
105
+ horizontalTooltip?: string;
106
+ wrappedScrollingLabel?: string;
107
+ wrappedScrollingTooltip?: string;
108
+ singlePageLabel?: string;
109
+ singlePageTooltip?: string;
110
+ dualPageLabel?: string;
111
+ dualPageTooltip?: string;
112
+ documentPropertiesLabel?: string;
113
+ documentPropertiesTooltip?: string;
114
+ propertiesFilenameLabel?: string;
115
+ propertiesFileSizeLabel?: string;
116
+ propertiesTitleLabel?: string;
117
+ propertiesAuthorLabel?: string;
118
+ propertiesSubjectLabel?: string;
119
+ propertiesKeywordLabel?: string;
120
+ propertiesCreatorLabel?: string;
121
+ propertiesCreateOnLabel?: string;
122
+ propertiesModifiedOnLabel?: string;
123
+ propertiesPDFProducerLabel?: string;
124
+ propertiesPDFVersionLabel?: string;
125
+ propertiesPageCountLabel?: string;
126
+ thumbnailTooltip?: string;
127
+ passwordModalTitle?: string;
128
+ passwordModalMessage?: string;
129
+ passwordPlaceholder?: string;
130
+ passwordConfirmLabel?: string;
131
+ passwordError?: string;
132
+ dragDropFileMessage?: string;
133
133
  };
134
134
  interface Attachment {
135
135
  content: Uint8Array;
@@ -233,7 +233,7 @@ export interface SetPageResult {
233
233
  export interface PageControl {
234
234
  focusedPage: number;
235
235
  setFocusedPage: (page: number | string) => void;
236
- goToPage: (page: number | string) => SetPageResult;
236
+ goToPage: (page: number | string) => Promise<SetPageResult>;
237
237
  totalPages: number;
238
238
  setTotalPages: (page: number) => void;
239
239
  nextPage: () => void;
@@ -285,7 +285,7 @@ export interface PageNavigationToolProps {
285
285
  nextPage: () => void;
286
286
  prevPage: () => void;
287
287
  changePage: (page: number) => void;
288
- goToPage: (page: number) => SetPageResult;
288
+ goToPage: (page: number) => Promise<SetPageResult>;
289
289
  }
290
290
  export interface PreparePrintProgress {
291
291
  loadedPages: number;
@@ -427,9 +427,12 @@ export interface RPProviderProps extends PropsWithChildren, LoadPDFOptions, RPCo
427
427
  workerUrl?: string;
428
428
  characterMap?: CharacterMap;
429
429
  }
430
+ export type LocalizationMap = Record<string, Localization>;
430
431
  export interface RPControllerProps extends PropsWithChildren, DarkModeProviderProps, RotateProviderProps, LayerProviderProps, ZoomProviderProps, PageProviderProps, ScrollModeProps {
431
432
  initialSearch?: string;
432
433
  initialThumbnailsVisible?: boolean;
434
+ locale?: string;
435
+ localization?: LocalizationMap;
433
436
  }
434
437
  export interface RPConfigProps extends Omit<ConfigContextType, 'workerUrlAdded'>, RPThemeContextType, PropsWithChildren {
435
438
  workerUrl?: string;
@@ -568,4 +571,16 @@ export interface LoadPDFOptions {
568
571
  onLoadError?: (error: any) => void;
569
572
  onLoaded?: (pdfDocument: PDFDocumentProxy) => void;
570
573
  }
574
+ export interface ScrollPosition {
575
+ left: number;
576
+ top: number;
577
+ }
578
+ export declare const Locales: LocalizationMap;
579
+ export interface LocalizationContextType {
580
+ localeMessages?: Localization;
581
+ }
582
+ export interface LocalizationProps {
583
+ locale?: string;
584
+ localization?: LocalizationMap;
585
+ }
571
586
  export {};
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../../contexts/RPDocumentContext.js";
3
3
  import "react";
4
- import { c as v } from "../../RPDefaultLayout-651c2426.js";
4
+ import { c as y } from "../../RPDefaultLayout-79c7577a.js";
5
5
  import "../../contexts/DarkModeContext.js";
6
6
  import "../../contexts/RotationContext.js";
7
7
  import "../../contexts/LayerContext.js";
@@ -18,10 +18,11 @@ import "../../contexts/FileInputContext.js";
18
18
  import "../../contexts/DropFileZoneContext.js";
19
19
  import "../../contexts/LayoutContainerContext.js";
20
20
  import "../../contexts/DimensionPagesContext.js";
21
+ import "../../contexts/LocalizationContext.js";
21
22
  import "../../components/RPConfig.js";
22
23
  import "../../contexts/ThemeContext.js";
23
24
  import "../../components/RPDropFileZone.js";
24
25
  import "../../contexts/ToolbarComponentContext.js";
25
26
  export {
26
- v as useFileDownload
27
+ y as useFileDownload
27
28
  };
@@ -1,82 +1,74 @@
1
- import { useState as g, useCallback as h, useEffect as E } from "react";
1
+ import { useState as E, useCallback as g, useEffect as v } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const A = /* @__PURE__ */ new Date("2025-03-14T08:20:25.620Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
3
+ const b = /* @__PURE__ */ new Date("2025-03-20T03:33:53.371Z"), d = "Please visit https://www.react-pdf.dev/license-management/ to generate a new license key.", o = {
4
4
  invalidLicense: `You are currently using without a valid license. ${d}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
6
  expired: `Your license key has expired. ${d}`,
7
7
  exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
8
8
  invalidSignature: "Invalid license key: Signature mismatch"
9
9
  };
10
- function b(r) {
11
- const t = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), i = atob(t), n = new Uint8Array(i.length);
12
- for (let e = 0; e < i.length; e++)
13
- n[e] = i.charCodeAt(e);
10
+ function y(r) {
11
+ const i = r.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), t = atob(i), n = new Uint8Array(t.length);
12
+ for (let e = 0; e < t.length; e++)
13
+ n[e] = t.charCodeAt(e);
14
14
  return n.buffer;
15
15
  }
16
- function L(r) {
17
- const t = atob(r), i = new Uint8Array(t.length);
18
- for (let n = 0; n < t.length; n++)
19
- i[n] = t.charCodeAt(n);
20
- return i.buffer;
16
+ function A(r) {
17
+ const i = atob(r), t = new Uint8Array(i.length);
18
+ for (let n = 0; n < i.length; n++)
19
+ t[n] = i.charCodeAt(n);
20
+ return t.buffer;
21
21
  }
22
- async function S(r, t = "SHA-256") {
22
+ async function I(r, i = "SHA-256") {
23
23
  try {
24
- const { data: i, signature: n } = JSON.parse(atob(r)), e = b(`-----BEGIN PUBLIC KEY-----
25
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx
26
- gr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b
27
- HLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y
28
- Bm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W
29
- vXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD
30
- vzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR
31
- kwIDAQAB
32
- -----END PUBLIC KEY-----`), a = await window.crypto.subtle.importKey(
24
+ const { data: t, signature: n } = JSON.parse(atob(r)), e = y("-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyrIi83Zr5AKaWO6zbZmXqv3McVhtnPOnWCiFgf5xeaglLzEwMiXo3gALaPoBp5Q0WPOSBE9GTqwOyQUgpDNSBuQ0cjOzQdFM3GPnKSqQThZJfjUmD9egMZDmfhcpFGPybUoicoIEFQOdX2vMFUfn6yjRsyvbK6UPTombYl785V8dXNnnIHa4tQC1JSaSe/bhG3e/6kbQCy9VJ23242q9WJpx9c2sZ+bmyI0r9Zx0PfqcDJzDfKn45v96EtxGhV16OZhqkbj4ljiJ/mfqfCkxybkm9nvxz0hAwcEftQaxl/0cZ1RxtsRcL+V3msLsmGcs9nPqAuXecbfg9QVCi/+miwIDAQAB-----END PUBLIC KEY-----"), a = await window.crypto.subtle.importKey(
33
25
  "spki",
34
26
  // str2ab(publicKeyContent), // Convert PEM string to ArrayBuffer
35
27
  e,
36
- { name: "RSA-PSS", hash: t },
28
+ { name: "RSA-PSS", hash: i },
37
29
  !0,
38
30
  ["verify"]
39
31
  );
40
32
  if (!await window.crypto.subtle.verify(
41
33
  { name: "RSA-PSS", saltLength: 32 },
42
34
  a,
43
- L(n),
35
+ A(n),
44
36
  // Convert signature to ArrayBuffer
45
- new TextEncoder().encode(atob(i))
37
+ new TextEncoder().encode(atob(t))
46
38
  ))
47
39
  throw new Error(o.invalidSignature);
48
- return JSON.parse(atob(i));
40
+ return JSON.parse(atob(t));
49
41
  } catch {
50
42
  throw new Error(o.invalidLicense);
51
43
  }
52
44
  }
53
- const I = (r, t) => r === "specific" ? t === window.location.host : window.location.host.includes(t), c = {
45
+ const L = (r, i) => r === "specific" ? i === window.location.host : window.location.host.includes(i), c = {
54
46
  isValid: !0,
55
47
  invalidatedMessage: o.invalidLicense,
56
48
  type: void 0
57
- }, N = (r) => {
58
- const [t, i] = g(c), n = h(async () => {
49
+ }, T = (r) => {
50
+ const [i, t] = E(c), n = g(async () => {
59
51
  if (!r)
60
- throw i(c), new Error("License is missing");
52
+ throw t(c), new Error("License is missing");
61
53
  try {
62
- const e = await S(r);
54
+ const e = await I(r);
63
55
  l.debug(">>> validatedLicense", e);
64
- const { avu: a, exp: s, dmt: m, dm: p, t: w } = e;
56
+ const { avu: a, exp: s, dmt: m, dm: f, t: w } = e;
65
57
  if (!s)
66
58
  throw new Error("License is missing expiration timestamp");
67
59
  if (s > Number.MAX_SAFE_INTEGER / 1e3)
68
60
  throw new Error("Invalid expiration timestamp: value too large");
69
- const v = new Date(s * 1e3), f = (/* @__PURE__ */ new Date()).getTime();
70
- if (v.getTime() < f)
61
+ const h = new Date(s * 1e3), p = (/* @__PURE__ */ new Date()).getTime();
62
+ if (h.getTime() < p)
71
63
  throw new Error(o.expired);
72
64
  if (!a)
73
65
  throw new Error("License is missing available until version timestamp");
74
66
  if (a > Number.MAX_SAFE_INTEGER / 1e3)
75
67
  throw new Error("Invalid available until version timestamp: value too large");
76
68
  const u = new Date(a * 1e3);
77
- if (l.debug("availableUntilTimestamp", u), u.getTime() < A.getTime())
69
+ if (l.debug("availableUntilTimestamp", u), u.getTime() < b.getTime())
78
70
  throw new Error(o.exceededVersion);
79
- if (!I(m, p))
71
+ if (!L(m, f))
80
72
  throw new Error(o.mismatchedDomain);
81
73
  return {
82
74
  isValid: !0,
@@ -87,21 +79,21 @@ const I = (r, t) => r === "specific" ? t === window.location.host : window.locat
87
79
  return l.warn(e.message), { ...c, invalidatedMessage: e.message };
88
80
  }
89
81
  }, [r]);
90
- return E(() => {
82
+ return v(() => {
91
83
  n().then(({ isValid: e, type: a, invalidatedMessage: s }) => {
92
- i({
84
+ t({
93
85
  isValid: e,
94
86
  type: a,
95
87
  invalidatedMessage: s
96
88
  });
97
89
  }).catch((e) => {
98
- throw i({
90
+ throw t({
99
91
  ...c,
100
92
  isValid: !1
101
93
  }), e;
102
94
  });
103
- }, [n]), t;
95
+ }, [n]), i;
104
96
  };
105
97
  export {
106
- N as useLicense
98
+ T as useLicense
107
99
  };