@zextras/carbonio-ui-preview 1.2.2 → 1.2.4
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 +62 -0
- package/THIRDPARTIES +388 -0
- package/lib/constants/index.js +2 -5
- package/lib/constants/index.js.map +1 -1
- package/lib/index.d.ts +9 -6
- package/lib/index.js +11 -22
- package/lib/index.js.map +1 -1
- package/lib/preview/FocusWithin.d.ts +5 -0
- package/lib/preview/FocusWithin.js +26 -57
- package/lib/preview/FocusWithin.js.map +1 -1
- package/lib/preview/FocusWithin.module.css +13 -0
- package/lib/preview/Header.d.ts +37 -4
- package/lib/preview/Header.js +17 -38
- package/lib/preview/Header.js.map +1 -1
- package/lib/preview/Header.module.css +37 -0
- package/lib/preview/ImagePreview.d.ts +7 -47
- package/lib/preview/ImagePreview.js +17 -96
- package/lib/preview/ImagePreview.js.map +1 -1
- package/lib/preview/ImagePreview.module.css +29 -0
- package/lib/preview/Navigator.d.ts +1 -0
- package/lib/preview/Navigator.js +7 -21
- package/lib/preview/Navigator.js.map +1 -1
- package/lib/preview/Navigator.module.css +18 -0
- package/lib/preview/PageController.d.ts +8 -0
- package/lib/preview/PageController.js +29 -67
- package/lib/preview/PageController.js.map +1 -1
- package/lib/preview/PageController.module.css +19 -0
- package/lib/preview/PdfPreview.d.ts +21 -69
- package/lib/preview/PdfPreview.js +79 -161
- package/lib/preview/PdfPreview.js.map +1 -1
- package/lib/preview/PdfPreview.module.css +46 -0
- package/lib/preview/PreviewCriteriaAlternativeContent.d.ts +13 -1
- package/lib/preview/PreviewCriteriaAlternativeContent.js +22 -55
- package/lib/preview/PreviewCriteriaAlternativeContent.js.map +1 -1
- package/lib/preview/PreviewCriteriaAlternativeContent.module.css +15 -0
- package/lib/preview/PreviewManager.d.ts +38 -15
- package/lib/preview/PreviewManager.js +40 -74
- package/lib/preview/PreviewManager.js.map +1 -1
- package/lib/preview/PreviewNavigator.d.ts +42 -0
- package/lib/preview/PreviewNavigator.js +29 -0
- package/lib/preview/PreviewNavigator.js.map +1 -0
- package/lib/preview/PreviewNavigator.module.css +43 -0
- package/lib/preview/PreviewWrapper.d.ts +14 -8
- package/lib/preview/PreviewWrapper.js +12 -24
- package/lib/preview/PreviewWrapper.js.map +1 -1
- package/lib/preview/ZoomController.d.ts +1 -0
- package/lib/preview/ZoomController.js +11 -52
- package/lib/preview/ZoomController.js.map +1 -1
- package/lib/preview/ZoomController.module.css +18 -0
- package/lib/preview/usePageScrollController.js +18 -22
- package/lib/preview/usePageScrollController.js.map +1 -1
- package/lib/preview/useZoom.js +31 -39
- package/lib/preview/useZoom.js.map +1 -1
- package/lib/types/utils.d.ts +4 -0
- package/lib/types/utils.js +2 -0
- package/lib/types/utils.js.map +1 -0
- package/lib/utils/utils.js +5 -9
- package/lib/utils/utils.js.map +1 -1
- package/package.json +55 -44
- package/lib/preview/StyledComponents.d.ts +0 -2
- package/lib/preview/StyledComponents.js +0 -21
- package/lib/preview/StyledComponents.js.map +0 -1
- package/lib/utils/type-utils.d.ts +0 -3
- package/lib/utils/type-utils.js +0 -3
- package/lib/utils/type-utils.js.map +0 -1
- package/lib-esm/constants/index.d.ts +0 -2
- package/lib-esm/constants/index.js +0 -8
- package/lib-esm/constants/index.js.map +0 -1
- package/lib-esm/index.d.ts +0 -6
- package/lib-esm/index.js +0 -12
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/preview/FocusWithin.d.ts +0 -7
- package/lib-esm/preview/FocusWithin.js +0 -57
- package/lib-esm/preview/FocusWithin.js.map +0 -1
- package/lib-esm/preview/Header.d.ts +0 -29
- package/lib-esm/preview/Header.js +0 -39
- package/lib-esm/preview/Header.js.map +0 -1
- package/lib-esm/preview/ImagePreview.d.ts +0 -50
- package/lib-esm/preview/ImagePreview.js +0 -105
- package/lib-esm/preview/ImagePreview.js.map +0 -1
- package/lib-esm/preview/Navigator.d.ts +0 -5
- package/lib-esm/preview/Navigator.js +0 -21
- package/lib-esm/preview/Navigator.js.map +0 -1
- package/lib-esm/preview/PageController.d.ts +0 -8
- package/lib-esm/preview/PageController.js +0 -82
- package/lib-esm/preview/PageController.js.map +0 -1
- package/lib-esm/preview/PdfPreview.d.ts +0 -89
- package/lib-esm/preview/PdfPreview.js +0 -280
- package/lib-esm/preview/PdfPreview.js.map +0 -1
- package/lib-esm/preview/PreviewCriteriaAlternativeContent.d.ts +0 -13
- package/lib-esm/preview/PreviewCriteriaAlternativeContent.js +0 -42
- package/lib-esm/preview/PreviewCriteriaAlternativeContent.js.map +0 -1
- package/lib-esm/preview/PreviewManager.d.ts +0 -19
- package/lib-esm/preview/PreviewManager.js +0 -108
- package/lib-esm/preview/PreviewManager.js.map +0 -1
- package/lib-esm/preview/PreviewWrapper.d.ts +0 -9
- package/lib-esm/preview/PreviewWrapper.js +0 -36
- package/lib-esm/preview/PreviewWrapper.js.map +0 -1
- package/lib-esm/preview/StyledComponents.d.ts +0 -2
- package/lib-esm/preview/StyledComponents.js +0 -15
- package/lib-esm/preview/StyledComponents.js.map +0 -1
- package/lib-esm/preview/ZoomController.d.ts +0 -17
- package/lib-esm/preview/ZoomController.js +0 -28
- package/lib-esm/preview/ZoomController.js.map +0 -1
- package/lib-esm/preview/usePageScrollController.d.ts +0 -4
- package/lib-esm/preview/usePageScrollController.js +0 -67
- package/lib-esm/preview/usePageScrollController.js.map +0 -1
- package/lib-esm/preview/useZoom.d.ts +0 -13
- package/lib-esm/preview/useZoom.js +0 -78
- package/lib-esm/preview/useZoom.js.map +0 -1
- package/lib-esm/utils/type-utils.d.ts +0 -3
- package/lib-esm/utils/type-utils.js +0 -2
- package/lib-esm/utils/type-utils.js.map +0 -1
- package/lib-esm/utils/utils.d.ts +0 -1
- package/lib-esm/utils/utils.js +0 -18
- package/lib-esm/utils/utils.js.map +0 -1
package/lib/preview/Navigator.js
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.Navigator = void 0;
|
|
11
1
|
/*
|
|
12
2
|
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
13
3
|
*
|
|
14
4
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
15
5
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var children = _a.children;
|
|
24
|
-
return (react_1.default.createElement(StyledContainer, { onClick: function (ev) { return ev.stopPropagation(); } }, children));
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useTheme } from '@zextras/carbonio-design-system';
|
|
8
|
+
import styles from './Navigator.module.css';
|
|
9
|
+
/** Container for the current preview actions (zoom, page) */
|
|
10
|
+
export const Navigator = ({ children }) => {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
return (React.createElement("div", { className: styles.styledContainer, style: { backgroundColor: theme.palette.gray0.regular }, onClick: (ev) => ev.stopPropagation() }, children));
|
|
25
13
|
};
|
|
26
|
-
exports.Navigator = Navigator;
|
|
27
|
-
var templateObject_1;
|
|
28
14
|
//# sourceMappingURL=Navigator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/preview/Navigator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/preview/Navigator.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAM5C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,EAAqB,EAAE;IAC5E,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,OAAO,CACN,6BACC,SAAS,EAAE,MAAM,CAAC,eAAe,EACjC,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EACvD,OAAO,EAAE,CAAC,EAAE,EAAQ,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,IAE1C,QAAQ,CACJ,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.styledContainer {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
position: absolute;
|
|
12
|
+
z-index: 1;
|
|
13
|
+
bottom: 1rem;
|
|
14
|
+
align-self: center;
|
|
15
|
+
border-radius: 0.25rem;
|
|
16
|
+
gap: 1rem;
|
|
17
|
+
padding: 0.5rem 1rem;
|
|
18
|
+
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface PageControllerProps {
|
|
3
|
+
/** Label for the page input */
|
|
3
4
|
pageLabel?: string;
|
|
5
|
+
/** Current page number */
|
|
4
6
|
currentPage: number;
|
|
7
|
+
/** Total number of pages */
|
|
5
8
|
pagesNumber: number;
|
|
9
|
+
/** Callback fired to set a new current page */
|
|
6
10
|
onPageChange: (newPage: number) => void;
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a controller for the current page.
|
|
14
|
+
* It defines a minimum set of boundaries for the validation of the user input.
|
|
15
|
+
*/
|
|
8
16
|
export declare const PageController: ({ pageLabel, currentPage, pagesNumber, onPageChange }: PageControllerProps) => React.JSX.Element;
|
|
@@ -1,77 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
-
if (mod && mod.__esModule) return mod;
|
|
24
|
-
var result = {};
|
|
25
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
-
__setModuleDefault(result, mod);
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.PageController = void 0;
|
|
34
1
|
/*
|
|
35
2
|
* SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
|
|
36
3
|
*
|
|
37
4
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
38
5
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var StyledInput = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tbackground-color: inherit;\n\tborder: none;\n\toutline: none;\n\tmin-width: 0.5rem;\n\tfont-family: inherit;\n\tfont-size: ", ";\n\tcolor: ", ";\n\ttext-align: center;\n\tpadding: 0;\n\t&:hover,\n\t&:focus {\n\t\ttext-decoration: underline;\n\t}\n"], ["\n\tbackground-color: inherit;\n\tborder: none;\n\toutline: none;\n\tmin-width: 0.5rem;\n\tfont-family: inherit;\n\tfont-size: ", ";\n\tcolor: ", ";\n\ttext-align: center;\n\tpadding: 0;\n\t&:hover,\n\t&:focus {\n\t\ttext-decoration: underline;\n\t}\n"])), function (_a) {
|
|
43
|
-
var theme = _a.theme, $size = _a.$size;
|
|
44
|
-
return theme.sizes.font[$size];
|
|
45
|
-
}, function (_a) {
|
|
46
|
-
var $color = _a.$color, theme = _a.theme;
|
|
47
|
-
return (0, carbonio_design_system_1.getColor)($color, theme);
|
|
48
|
-
});
|
|
6
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
import { Text, getColor, Container, useTheme } from '@zextras/carbonio-design-system';
|
|
8
|
+
import styles from './PageController.module.css';
|
|
49
9
|
function isInt(value) {
|
|
50
|
-
|
|
10
|
+
const x = parseInt(value, 10);
|
|
51
11
|
// compare number with string by removing leading zeros
|
|
52
|
-
return
|
|
12
|
+
return `${x}` === value.replace(/^0+/, '').trim();
|
|
53
13
|
}
|
|
54
14
|
function resizeInput(ev) {
|
|
55
|
-
|
|
56
|
-
inputEl.style.width =
|
|
15
|
+
const inputEl = ev.currentTarget;
|
|
16
|
+
inputEl.style.width = `${inputEl.value.length}ch`;
|
|
57
17
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Render a controller for the current page.
|
|
20
|
+
* It defines a minimum set of boundaries for the validation of the user input.
|
|
21
|
+
*/
|
|
22
|
+
export const PageController = ({ pageLabel = 'Page', currentPage, pagesNumber, onPageChange }) => {
|
|
23
|
+
const inputRef = useRef(null);
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
const setInputValue = useCallback((value) => {
|
|
62
26
|
if (inputRef.current) {
|
|
63
|
-
inputRef.current.value =
|
|
64
|
-
inputRef.current.style.width =
|
|
27
|
+
inputRef.current.value = `${value}`;
|
|
28
|
+
inputRef.current.style.width = `${inputRef.current.value.length}ch`;
|
|
65
29
|
}
|
|
66
30
|
}, []);
|
|
67
|
-
|
|
31
|
+
useEffect(() => {
|
|
68
32
|
setInputValue(currentPage);
|
|
69
33
|
}, [currentPage, setInputValue]);
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
const onConfirm = useCallback((e) => {
|
|
35
|
+
const inputElement = e.currentTarget;
|
|
72
36
|
if (inputElement) {
|
|
73
|
-
|
|
74
|
-
|
|
37
|
+
const newValue = inputElement.value;
|
|
38
|
+
const newPage = isInt(newValue) && Number(newValue);
|
|
75
39
|
if (newPage !== false && newPage > 0 && newPage <= pagesNumber) {
|
|
76
40
|
setInputValue(newPage);
|
|
77
41
|
onPageChange(newPage);
|
|
@@ -81,10 +45,10 @@ var PageController = function (_a) {
|
|
|
81
45
|
}
|
|
82
46
|
}
|
|
83
47
|
}, [currentPage, onPageChange, pagesNumber, setInputValue]);
|
|
84
|
-
|
|
48
|
+
const onBlur = useCallback((e) => {
|
|
85
49
|
onConfirm(e);
|
|
86
50
|
}, [onConfirm]);
|
|
87
|
-
|
|
51
|
+
const onKeyDown = useCallback((e) => {
|
|
88
52
|
if (e.key === 'Escape' ||
|
|
89
53
|
e.key === 'ArrowRight' ||
|
|
90
54
|
e.key === 'ArrowLeft' ||
|
|
@@ -101,12 +65,10 @@ var PageController = function (_a) {
|
|
|
101
65
|
e.currentTarget.blur();
|
|
102
66
|
}
|
|
103
67
|
}, [onConfirm]);
|
|
104
|
-
return (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
68
|
+
return (React.createElement(Container, { orientation: "horizontal", gap: "0.5rem", crossAlignment: "baseline", width: 'fit' },
|
|
69
|
+
React.createElement(Text, { size: "small", color: "gray6" }, pageLabel),
|
|
70
|
+
React.createElement("input", { className: styles.styledInput, style: { color: getColor('gray6', theme), fontSize: theme.sizes.font.small }, onBlur: onBlur, onKeyDown: onKeyDown, onInput: resizeInput, ref: inputRef, "aria-label": "current page" }),
|
|
71
|
+
React.createElement(Text, { size: "small", color: "gray6" }, "/"),
|
|
72
|
+
React.createElement(Text, { size: "small", color: "gray6" }, pagesNumber)));
|
|
109
73
|
};
|
|
110
|
-
exports.PageController = PageController;
|
|
111
|
-
var templateObject_1;
|
|
112
74
|
//# sourceMappingURL=PageController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageController.js","sourceRoot":"","sources":["../../src/preview/PageController.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageController.js","sourceRoot":"","sources":["../../src/preview/PageController.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEtF,OAAO,MAAM,MAAM,6BAA6B,CAAC;AAajD,SAAS,KAAK,CAAC,KAAa;IAC3B,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,EA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AAO,CACN,oBAAC,SAAS,IAAC,WAAW,EAAC,YAAY,EAAC,GAAG,EAAC,QAAQ,EAAC,cAAc,EAAC,UAAU,EAAC,KAAK,EAAE,KAAK;QACtF,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,OAAO,IAC9B,SAAS,CACJ;QACP,+BACC,SAAS,EAAE,MAAM,CAAC,WAAW,EAC7B,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAC5E,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,QAAQ,gBACF,cAAc,GACxB;QACF,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,OAAO,QAEzB;QACP,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,OAAO,IAC9B,WAAW,CACN,CACI,CACZ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2024 Zextras <https://www.zextras.com>
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: AGPL-3.0-only
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.styledInput {
|
|
8
|
+
background-color: inherit;
|
|
9
|
+
border: none;
|
|
10
|
+
outline: none;
|
|
11
|
+
min-width: 0.5rem;
|
|
12
|
+
font-family: inherit;
|
|
13
|
+
text-align: center;
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.styledInput:hover, .styledInput:focus {
|
|
18
|
+
text-decoration: underline;
|
|
19
|
+
}
|
|
@@ -1,89 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import 'react-pdf/dist/
|
|
3
|
-
import 'react-pdf/dist/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Left Action for the preview */
|
|
9
|
-
closeAction?: MakeOptional<HeaderAction, 'onClick'>;
|
|
10
|
-
/**
|
|
11
|
-
* HTML node where to insert the Portal's children.
|
|
12
|
-
* The default value is 'window.top.document'.
|
|
13
|
-
* */
|
|
14
|
-
container?: Element;
|
|
15
|
-
/** Flag to disable the Portal implementation */
|
|
16
|
-
disablePortal?: boolean;
|
|
17
|
-
/** Flag to show or hide Portal's content */
|
|
18
|
-
show: boolean;
|
|
19
|
-
/** preview source */
|
|
2
|
+
import 'react-pdf/dist/Page/TextLayer.css';
|
|
3
|
+
import 'react-pdf/dist/Page/AnnotationLayer.css';
|
|
4
|
+
import { PreviewCriteriaAlternativeContentProps } from './PreviewCriteriaAlternativeContent.js';
|
|
5
|
+
import { PreviewNavigatorProps } from './PreviewNavigator.js';
|
|
6
|
+
export interface PdfPreviewProps extends Omit<PreviewNavigatorProps, 'onOverlayClick'>, Omit<PreviewCriteriaAlternativeContentProps, 'downloadSrc'> {
|
|
7
|
+
/** Preview source */
|
|
20
8
|
src: string | File | Blob | ArrayBuffer;
|
|
21
9
|
/** Whether force cache */
|
|
22
10
|
forceCache?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
onClose: (e: React.SyntheticEvent | KeyboardEvent) => void;
|
|
25
|
-
/** use fallback content if you don't want to view the pdf for some reason; content can be customizable with customContent */
|
|
11
|
+
/** Use fallback content if you don't want to view the pdf for some reason; content can be customizable with customContent */
|
|
26
12
|
useFallback?: boolean;
|
|
27
|
-
/**
|
|
13
|
+
/** Custom component for the fallback */
|
|
28
14
|
customContent?: React.ReactElement;
|
|
29
15
|
/** Whether a text layer should be rendered */
|
|
30
16
|
renderTextLayer?: boolean;
|
|
31
17
|
/** Whether the annotation layer should be rendered */
|
|
32
18
|
renderAnnotationLayer?: boolean;
|
|
19
|
+
/** Label for the zoom out action */
|
|
33
20
|
zoomOutLabel?: string;
|
|
21
|
+
/** Label shown when the zoom is at its minimum */
|
|
34
22
|
lowerLimitReachedLabel?: string;
|
|
23
|
+
/** Label for the reset zoom action */
|
|
35
24
|
resetZoomLabel?: string;
|
|
25
|
+
/** Label for the fit to width zoom action */
|
|
36
26
|
fitToWidthLabel?: string;
|
|
27
|
+
/** Label for the zoom in action */
|
|
37
28
|
zoomInLabel?: string;
|
|
29
|
+
/** Label shown when the zoom is at its maximum */
|
|
38
30
|
upperLimitReachedLabel?: string;
|
|
39
|
-
/**
|
|
40
|
-
onNextPreview?: (e: React.SyntheticEvent | KeyboardEvent) => void;
|
|
41
|
-
/** Callback */
|
|
42
|
-
onPreviousPreview?: (e: React.SyntheticEvent | KeyboardEvent) => void;
|
|
31
|
+
/** Label for the page controller */
|
|
43
32
|
pageLabel?: string;
|
|
33
|
+
/** Label shown when the preview cannot be shown */
|
|
44
34
|
errorLabel?: string;
|
|
35
|
+
/** Label shown while the preview is loading */
|
|
45
36
|
loadingLabel?: string;
|
|
37
|
+
/** Label for the print action */
|
|
46
38
|
printActionTooltipLabel?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
closeAction?: MakeOptional<HeaderAction, "onClick"> | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* HTML node where to insert the Portal's children.
|
|
53
|
-
* The default value is 'window.top.document'.
|
|
54
|
-
* */
|
|
55
|
-
container?: Element | undefined;
|
|
56
|
-
/** Flag to disable the Portal implementation */
|
|
57
|
-
disablePortal?: boolean | undefined;
|
|
58
|
-
/** Flag to show or hide Portal's content */
|
|
59
|
-
show: boolean;
|
|
60
|
-
/** preview source */
|
|
61
|
-
src: string | File | Blob | ArrayBuffer;
|
|
62
|
-
/** Whether force cache */
|
|
63
|
-
forceCache?: boolean | undefined;
|
|
64
|
-
/** Callback to hide the preview */
|
|
65
|
-
onClose: (e: React.SyntheticEvent | KeyboardEvent) => void;
|
|
66
|
-
/** use fallback content if you don't want to view the pdf for some reason; content can be customizable with customContent */
|
|
67
|
-
useFallback?: boolean | undefined;
|
|
68
|
-
/** CustomContent */
|
|
69
|
-
customContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
70
|
-
/** Whether a text layer should be rendered */
|
|
71
|
-
renderTextLayer?: boolean | undefined;
|
|
72
|
-
/** Whether the annotation layer should be rendered */
|
|
73
|
-
renderAnnotationLayer?: boolean | undefined;
|
|
74
|
-
zoomOutLabel?: string | undefined;
|
|
75
|
-
lowerLimitReachedLabel?: string | undefined;
|
|
76
|
-
resetZoomLabel?: string | undefined;
|
|
77
|
-
fitToWidthLabel?: string | undefined;
|
|
78
|
-
zoomInLabel?: string | undefined;
|
|
79
|
-
upperLimitReachedLabel?: string | undefined;
|
|
80
|
-
/** Callback */
|
|
81
|
-
onNextPreview?: ((e: React.SyntheticEvent | KeyboardEvent) => void) | undefined;
|
|
82
|
-
/** Callback */
|
|
83
|
-
onPreviousPreview?: ((e: React.SyntheticEvent | KeyboardEvent) => void) | undefined;
|
|
84
|
-
pageLabel?: string | undefined;
|
|
85
|
-
errorLabel?: string | undefined;
|
|
86
|
-
loadingLabel?: string | undefined;
|
|
87
|
-
printActionTooltipLabel?: string | undefined;
|
|
88
|
-
} & Omit<PreviewCriteriaAlternativeContentProps, "downloadSrc"> & React.RefAttributes<HTMLDivElement>>;
|
|
89
|
-
export { PdfPreview, PdfPreviewProps };
|
|
39
|
+
}
|
|
40
|
+
/** Main component for the preview of a pdf */
|
|
41
|
+
export declare const PdfPreview: React.ForwardRefExoticComponent<PdfPreviewProps & React.RefAttributes<HTMLDivElement>>;
|