@dmsi/wedgekit-react 0.0.170 → 0.0.172
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/dist/{chunk-4VTOTNKJ.js → chunk-3WNXMCZV.js} +3 -2
- package/dist/{chunk-FCREADUH.js → chunk-F6YFWBVV.js} +6 -4
- package/dist/{chunk-R7ELP5C5.js → chunk-MJKBQSNI.js} +13 -1
- package/dist/components/Modal.cjs +18 -4
- package/dist/components/Modal.js +2 -2
- package/dist/components/ModalHeader.cjs +13 -1
- package/dist/components/ModalHeader.js +1 -1
- package/dist/components/PDFViewer.cjs +221 -101
- package/dist/components/PDFViewer.js +152 -94
- package/dist/components/Tooltip.cjs +3 -2
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/index.cjs +3 -2
- package/dist/components/index.js +1 -1
- package/dist/index.css +8 -0
- package/package.json +1 -1
- package/src/components/Modal.tsx +5 -2
- package/src/components/ModalHeader.tsx +10 -1
- package/src/components/PDFViewer.tsx +86 -15
- package/src/components/Tooltip.tsx +3 -1
|
@@ -19,7 +19,8 @@ var Tooltip = ({
|
|
|
19
19
|
position = "top",
|
|
20
20
|
children,
|
|
21
21
|
showOnTruncation = false,
|
|
22
|
-
offset = 8
|
|
22
|
+
offset = 8,
|
|
23
|
+
keepHidden = false
|
|
23
24
|
}) => {
|
|
24
25
|
const ref = useRef(null);
|
|
25
26
|
const tooltipRef = useRef(null);
|
|
@@ -88,7 +89,7 @@ var Tooltip = ({
|
|
|
88
89
|
onMouseLeave: handleMouseLeave,
|
|
89
90
|
children: [
|
|
90
91
|
children,
|
|
91
|
-
isVisible && typeof document !== "undefined" && createPortal(
|
|
92
|
+
!keepHidden && isVisible && typeof document !== "undefined" && createPortal(
|
|
92
93
|
/* @__PURE__ */ jsx(
|
|
93
94
|
"div",
|
|
94
95
|
{
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-SYEJVSE4.js";
|
|
10
10
|
import {
|
|
11
11
|
ModalHeader
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MJKBQSNI.js";
|
|
13
13
|
import {
|
|
14
14
|
ModalScrim
|
|
15
15
|
} from "./chunk-ZFOANBWG.js";
|
|
@@ -97,6 +97,7 @@ var Modal = ({
|
|
|
97
97
|
showButtons = false,
|
|
98
98
|
hideCloseIcon = false,
|
|
99
99
|
headerIcon,
|
|
100
|
+
headerIconAlign,
|
|
100
101
|
fixedHeightScrolling = false,
|
|
101
102
|
customActions
|
|
102
103
|
}) => {
|
|
@@ -126,7 +127,7 @@ var Modal = ({
|
|
|
126
127
|
fadeInScale(modalRef.current);
|
|
127
128
|
bgFadeIn(bgRef.current);
|
|
128
129
|
}
|
|
129
|
-
}, [mounted, open]);
|
|
130
|
+
}, [mounted, onClose, open, wasOpen]);
|
|
130
131
|
const handleKeyDown = useCallback(
|
|
131
132
|
(e) => {
|
|
132
133
|
if (e.key === "Escape") {
|
|
@@ -136,7 +137,7 @@ var Modal = ({
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
},
|
|
139
|
-
[onClose
|
|
140
|
+
[onClose]
|
|
140
141
|
);
|
|
141
142
|
const handleClose = useCallback(() => {
|
|
142
143
|
if (onClose) {
|
|
@@ -221,7 +222,8 @@ var Modal = ({
|
|
|
221
222
|
title,
|
|
222
223
|
onClose: handleClose,
|
|
223
224
|
hideCloseIcon,
|
|
224
|
-
headerIcon
|
|
225
|
+
headerIcon,
|
|
226
|
+
headerIconAlign
|
|
225
227
|
}
|
|
226
228
|
),
|
|
227
229
|
children && /* @__PURE__ */ jsx(
|
|
@@ -19,6 +19,7 @@ var ModalHeader = ({
|
|
|
19
19
|
title,
|
|
20
20
|
hideCloseIcon,
|
|
21
21
|
headerIcon,
|
|
22
|
+
headerIconAlign,
|
|
22
23
|
onClose,
|
|
23
24
|
id,
|
|
24
25
|
testid
|
|
@@ -30,13 +31,24 @@ var ModalHeader = ({
|
|
|
30
31
|
"data-testid": testid,
|
|
31
32
|
className: clsx(
|
|
32
33
|
"flex justify-between items-center",
|
|
34
|
+
headerIconAlign === "center" && "justify-center",
|
|
35
|
+
headerIconAlign === "right" && "justify-end",
|
|
36
|
+
headerIconAlign === "left" && "justify-start",
|
|
33
37
|
layoutPaddding,
|
|
34
38
|
layoutGroupGap
|
|
35
39
|
),
|
|
36
40
|
children: [
|
|
37
41
|
/* @__PURE__ */ jsxs("div", { className: clsx("flex items-center", layoutGroupGap), children: [
|
|
38
42
|
headerIcon,
|
|
39
|
-
title && /* @__PURE__ */ jsx(
|
|
43
|
+
title && /* @__PURE__ */ jsx(
|
|
44
|
+
Heading2,
|
|
45
|
+
{
|
|
46
|
+
id: id ? `${id}-title` : void 0,
|
|
47
|
+
testid: testid ? `${testid}-title` : void 0,
|
|
48
|
+
as: "p",
|
|
49
|
+
children: title
|
|
50
|
+
}
|
|
51
|
+
)
|
|
40
52
|
] }),
|
|
41
53
|
!hideCloseIcon && /* @__PURE__ */ jsx(
|
|
42
54
|
Button,
|
|
@@ -428,6 +428,7 @@ var ModalHeader = ({
|
|
|
428
428
|
title,
|
|
429
429
|
hideCloseIcon,
|
|
430
430
|
headerIcon,
|
|
431
|
+
headerIconAlign,
|
|
431
432
|
onClose,
|
|
432
433
|
id,
|
|
433
434
|
testid
|
|
@@ -439,13 +440,24 @@ var ModalHeader = ({
|
|
|
439
440
|
"data-testid": testid,
|
|
440
441
|
className: (0, import_clsx5.default)(
|
|
441
442
|
"flex justify-between items-center",
|
|
443
|
+
headerIconAlign === "center" && "justify-center",
|
|
444
|
+
headerIconAlign === "right" && "justify-end",
|
|
445
|
+
headerIconAlign === "left" && "justify-start",
|
|
442
446
|
layoutPaddding,
|
|
443
447
|
layoutGroupGap
|
|
444
448
|
),
|
|
445
449
|
children: [
|
|
446
450
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx5.default)("flex items-center", layoutGroupGap), children: [
|
|
447
451
|
headerIcon,
|
|
448
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
452
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
453
|
+
Heading2,
|
|
454
|
+
{
|
|
455
|
+
id: id ? `${id}-title` : void 0,
|
|
456
|
+
testid: testid ? `${testid}-title` : void 0,
|
|
457
|
+
as: "p",
|
|
458
|
+
children: title
|
|
459
|
+
}
|
|
460
|
+
)
|
|
449
461
|
] }),
|
|
450
462
|
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
451
463
|
Button,
|
|
@@ -705,6 +717,7 @@ var Modal = ({
|
|
|
705
717
|
showButtons = false,
|
|
706
718
|
hideCloseIcon = false,
|
|
707
719
|
headerIcon,
|
|
720
|
+
headerIconAlign,
|
|
708
721
|
fixedHeightScrolling = false,
|
|
709
722
|
customActions
|
|
710
723
|
}) => {
|
|
@@ -734,7 +747,7 @@ var Modal = ({
|
|
|
734
747
|
fadeInScale(modalRef.current);
|
|
735
748
|
bgFadeIn(bgRef.current);
|
|
736
749
|
}
|
|
737
|
-
}, [mounted, open]);
|
|
750
|
+
}, [mounted, onClose, open, wasOpen]);
|
|
738
751
|
const handleKeyDown = (0, import_react5.useCallback)(
|
|
739
752
|
(e) => {
|
|
740
753
|
if (e.key === "Escape") {
|
|
@@ -744,7 +757,7 @@ var Modal = ({
|
|
|
744
757
|
}
|
|
745
758
|
}
|
|
746
759
|
},
|
|
747
|
-
[onClose
|
|
760
|
+
[onClose]
|
|
748
761
|
);
|
|
749
762
|
const handleClose = (0, import_react5.useCallback)(() => {
|
|
750
763
|
if (onClose) {
|
|
@@ -829,7 +842,8 @@ var Modal = ({
|
|
|
829
842
|
title,
|
|
830
843
|
onClose: handleClose,
|
|
831
844
|
hideCloseIcon,
|
|
832
|
-
headerIcon
|
|
845
|
+
headerIcon,
|
|
846
|
+
headerIconAlign
|
|
833
847
|
}
|
|
834
848
|
),
|
|
835
849
|
children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-F6YFWBVV.js";
|
|
5
5
|
import "../chunk-4RJKB7LC.js";
|
|
6
6
|
import "../chunk-C4JGTH6G.js";
|
|
7
7
|
import "../chunk-SYEJVSE4.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-MJKBQSNI.js";
|
|
9
9
|
import "../chunk-ZFOANBWG.js";
|
|
10
10
|
import "../chunk-AZ7LVLOK.js";
|
|
11
11
|
import "../chunk-WNQ53SVY.js";
|
|
@@ -425,6 +425,7 @@ var ModalHeader = ({
|
|
|
425
425
|
title,
|
|
426
426
|
hideCloseIcon,
|
|
427
427
|
headerIcon,
|
|
428
|
+
headerIconAlign,
|
|
428
429
|
onClose,
|
|
429
430
|
id,
|
|
430
431
|
testid
|
|
@@ -436,13 +437,24 @@ var ModalHeader = ({
|
|
|
436
437
|
"data-testid": testid,
|
|
437
438
|
className: (0, import_clsx5.default)(
|
|
438
439
|
"flex justify-between items-center",
|
|
440
|
+
headerIconAlign === "center" && "justify-center",
|
|
441
|
+
headerIconAlign === "right" && "justify-end",
|
|
442
|
+
headerIconAlign === "left" && "justify-start",
|
|
439
443
|
layoutPaddding,
|
|
440
444
|
layoutGroupGap
|
|
441
445
|
),
|
|
442
446
|
children: [
|
|
443
447
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx5.default)("flex items-center", layoutGroupGap), children: [
|
|
444
448
|
headerIcon,
|
|
445
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
449
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
450
|
+
Heading2,
|
|
451
|
+
{
|
|
452
|
+
id: id ? `${id}-title` : void 0,
|
|
453
|
+
testid: testid ? `${testid}-title` : void 0,
|
|
454
|
+
as: "p",
|
|
455
|
+
children: title
|
|
456
|
+
}
|
|
457
|
+
)
|
|
446
458
|
] }),
|
|
447
459
|
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
448
460
|
Button,
|
|
@@ -432,6 +432,7 @@ var ModalHeader = ({
|
|
|
432
432
|
title,
|
|
433
433
|
hideCloseIcon,
|
|
434
434
|
headerIcon,
|
|
435
|
+
headerIconAlign,
|
|
435
436
|
onClose,
|
|
436
437
|
id,
|
|
437
438
|
testid
|
|
@@ -443,13 +444,24 @@ var ModalHeader = ({
|
|
|
443
444
|
"data-testid": testid,
|
|
444
445
|
className: (0, import_clsx5.default)(
|
|
445
446
|
"flex justify-between items-center",
|
|
447
|
+
headerIconAlign === "center" && "justify-center",
|
|
448
|
+
headerIconAlign === "right" && "justify-end",
|
|
449
|
+
headerIconAlign === "left" && "justify-start",
|
|
446
450
|
layoutPaddding,
|
|
447
451
|
layoutGroupGap
|
|
448
452
|
),
|
|
449
453
|
children: [
|
|
450
454
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx5.default)("flex items-center", layoutGroupGap), children: [
|
|
451
455
|
headerIcon,
|
|
452
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
456
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
457
|
+
Heading2,
|
|
458
|
+
{
|
|
459
|
+
id: id ? `${id}-title` : void 0,
|
|
460
|
+
testid: testid ? `${testid}-title` : void 0,
|
|
461
|
+
as: "p",
|
|
462
|
+
children: title
|
|
463
|
+
}
|
|
464
|
+
)
|
|
453
465
|
] }),
|
|
454
466
|
!hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
455
467
|
Button,
|
|
@@ -709,6 +721,7 @@ var Modal = ({
|
|
|
709
721
|
showButtons = false,
|
|
710
722
|
hideCloseIcon = false,
|
|
711
723
|
headerIcon,
|
|
724
|
+
headerIconAlign,
|
|
712
725
|
fixedHeightScrolling = false,
|
|
713
726
|
customActions
|
|
714
727
|
}) => {
|
|
@@ -738,7 +751,7 @@ var Modal = ({
|
|
|
738
751
|
fadeInScale(modalRef.current);
|
|
739
752
|
bgFadeIn(bgRef.current);
|
|
740
753
|
}
|
|
741
|
-
}, [mounted, open]);
|
|
754
|
+
}, [mounted, onClose, open, wasOpen]);
|
|
742
755
|
const handleKeyDown = (0, import_react5.useCallback)(
|
|
743
756
|
(e) => {
|
|
744
757
|
if (e.key === "Escape") {
|
|
@@ -748,7 +761,7 @@ var Modal = ({
|
|
|
748
761
|
}
|
|
749
762
|
}
|
|
750
763
|
},
|
|
751
|
-
[onClose
|
|
764
|
+
[onClose]
|
|
752
765
|
);
|
|
753
766
|
const handleClose = (0, import_react5.useCallback)(() => {
|
|
754
767
|
if (onClose) {
|
|
@@ -833,7 +846,8 @@ var Modal = ({
|
|
|
833
846
|
title,
|
|
834
847
|
onClose: handleClose,
|
|
835
848
|
hideCloseIcon,
|
|
836
|
-
headerIcon
|
|
849
|
+
headerIcon,
|
|
850
|
+
headerIconAlign
|
|
837
851
|
}
|
|
838
852
|
),
|
|
839
853
|
children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -1264,8 +1278,61 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1264
1278
|
};
|
|
1265
1279
|
Spinner.displayName = "Spinner";
|
|
1266
1280
|
|
|
1267
|
-
// src/components/
|
|
1281
|
+
// src/components/Paragraph.tsx
|
|
1282
|
+
var import_clsx12 = __toESM(require("clsx"), 1);
|
|
1268
1283
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1284
|
+
var Paragraph = (_a) => {
|
|
1285
|
+
var _b = _a, {
|
|
1286
|
+
className,
|
|
1287
|
+
color,
|
|
1288
|
+
padded,
|
|
1289
|
+
align = "left",
|
|
1290
|
+
tall,
|
|
1291
|
+
addOverflow,
|
|
1292
|
+
children,
|
|
1293
|
+
as = "p",
|
|
1294
|
+
id,
|
|
1295
|
+
testid
|
|
1296
|
+
} = _b, props = __objRest(_b, [
|
|
1297
|
+
"className",
|
|
1298
|
+
"color",
|
|
1299
|
+
"padded",
|
|
1300
|
+
"align",
|
|
1301
|
+
"tall",
|
|
1302
|
+
"addOverflow",
|
|
1303
|
+
"children",
|
|
1304
|
+
"as",
|
|
1305
|
+
"id",
|
|
1306
|
+
"testid"
|
|
1307
|
+
]);
|
|
1308
|
+
const Element = as;
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1310
|
+
Element,
|
|
1311
|
+
__spreadProps(__spreadValues({
|
|
1312
|
+
id,
|
|
1313
|
+
"data-testid": testid
|
|
1314
|
+
}, props), {
|
|
1315
|
+
className: (0, import_clsx12.default)(
|
|
1316
|
+
typography.paragraph,
|
|
1317
|
+
className,
|
|
1318
|
+
padded && componentPaddingXUsingComponentGap,
|
|
1319
|
+
align === "left" && "text-left",
|
|
1320
|
+
align === "center" && "text-center",
|
|
1321
|
+
align === "right" && "text-right",
|
|
1322
|
+
tall && "!leading-6",
|
|
1323
|
+
addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
|
|
1324
|
+
),
|
|
1325
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
1326
|
+
color: color ? `var(--color-${color})` : void 0
|
|
1327
|
+
}),
|
|
1328
|
+
children
|
|
1329
|
+
})
|
|
1330
|
+
);
|
|
1331
|
+
};
|
|
1332
|
+
Paragraph.displayName = "Paragraph";
|
|
1333
|
+
|
|
1334
|
+
// src/components/PDFViewer.tsx
|
|
1335
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1269
1336
|
function PDFViewer(props) {
|
|
1270
1337
|
const { isOpen, onClose, encodedPdfs, customActions, testid } = props;
|
|
1271
1338
|
const [currentIndex, setCurrentIndex] = (0, import_react6.useState)(0);
|
|
@@ -1286,15 +1353,33 @@ function PDFViewer(props) {
|
|
|
1286
1353
|
setIsDownloading(false);
|
|
1287
1354
|
}, [currentIndex, encodedPdfs]);
|
|
1288
1355
|
if (!encodedPdfs.length) return null;
|
|
1289
|
-
|
|
1356
|
+
function handleNextFile() {
|
|
1357
|
+
if (currentIndex < encodedPdfs.length - 1) {
|
|
1358
|
+
setCurrentIndex((prev) => prev + 1);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
function handlePreviousFile() {
|
|
1362
|
+
if (currentIndex > 0) {
|
|
1363
|
+
setCurrentIndex((prev) => prev - 1);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function handleClose() {
|
|
1367
|
+
setCurrentIndex(0);
|
|
1368
|
+
setIsDownloading(false);
|
|
1369
|
+
onClose();
|
|
1370
|
+
}
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1290
1372
|
Modal,
|
|
1291
1373
|
{
|
|
1292
1374
|
testid,
|
|
1293
1375
|
open: isOpen,
|
|
1294
|
-
onClose,
|
|
1376
|
+
onClose: handleClose,
|
|
1295
1377
|
showButtons: !!customActions,
|
|
1296
1378
|
customActions,
|
|
1297
|
-
|
|
1379
|
+
size: "large",
|
|
1380
|
+
fixedHeightScrolling: true,
|
|
1381
|
+
headerIconAlign: "right",
|
|
1382
|
+
headerIcon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1298
1383
|
DownloadIcon,
|
|
1299
1384
|
{
|
|
1300
1385
|
testid: testid ? `${testid}-download-icon` : void 0,
|
|
@@ -1302,33 +1387,49 @@ function PDFViewer(props) {
|
|
|
1302
1387
|
isDownloading
|
|
1303
1388
|
}
|
|
1304
1389
|
),
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
/* @__PURE__ */ (0,
|
|
1308
|
-
|
|
1390
|
+
className: "!max-w-fit",
|
|
1391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Stack, { sizing: "layout", items: "center", children: [
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PDFElement, { testid, b64: encodedPdfs[currentIndex].base64 }),
|
|
1393
|
+
!!encodedPdfs[currentIndex].fileName && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Paragraph, { children: encodedPdfs[currentIndex].fileName.endsWith(".pdf") ? encodedPdfs[currentIndex].fileName : `${encodedPdfs[currentIndex].fileName}.pdf` }),
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1395
|
+
Stack,
|
|
1309
1396
|
{
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
requestAnimationFrame(() => {
|
|
1316
|
-
const button = e.target;
|
|
1317
|
-
button.scrollIntoView({
|
|
1318
|
-
behavior: "smooth",
|
|
1319
|
-
block: "nearest",
|
|
1320
|
-
inline: "center"
|
|
1321
|
-
});
|
|
1322
|
-
});
|
|
1323
|
-
},
|
|
1324
|
-
disabled: isDownloading || currentIndex === index || !pdf.base64,
|
|
1397
|
+
horizontal: true,
|
|
1398
|
+
overflowX: "auto",
|
|
1399
|
+
justify: "center",
|
|
1400
|
+
items: "center",
|
|
1401
|
+
sizing: "layout-group",
|
|
1325
1402
|
children: [
|
|
1326
|
-
|
|
1327
|
-
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1404
|
+
Button,
|
|
1405
|
+
{
|
|
1406
|
+
iconOnly: true,
|
|
1407
|
+
variant: "tertiary",
|
|
1408
|
+
onClick: handlePreviousFile,
|
|
1409
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "chevron_backward" }),
|
|
1410
|
+
disabled: currentIndex === 0,
|
|
1411
|
+
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
1412
|
+
}
|
|
1413
|
+
),
|
|
1414
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Heading3, { className: "text-text-primary-normal", children: [
|
|
1415
|
+
currentIndex + 1,
|
|
1416
|
+
" / ",
|
|
1417
|
+
encodedPdfs.length
|
|
1418
|
+
] }),
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1420
|
+
Button,
|
|
1421
|
+
{
|
|
1422
|
+
iconOnly: true,
|
|
1423
|
+
variant: "tertiary",
|
|
1424
|
+
onClick: handleNextFile,
|
|
1425
|
+
rightIcon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "chevron_forward" }),
|
|
1426
|
+
disabled: currentIndex === encodedPdfs.length - 1,
|
|
1427
|
+
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
1428
|
+
}
|
|
1429
|
+
)
|
|
1328
1430
|
]
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
)) })
|
|
1431
|
+
}
|
|
1432
|
+
)
|
|
1332
1433
|
] })
|
|
1333
1434
|
}
|
|
1334
1435
|
);
|
|
@@ -1338,13 +1439,13 @@ function DownloadIcon({
|
|
|
1338
1439
|
isDownloading,
|
|
1339
1440
|
testid
|
|
1340
1441
|
}) {
|
|
1341
|
-
return /* @__PURE__ */ (0,
|
|
1442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1342
1443
|
Button,
|
|
1343
1444
|
{
|
|
1344
1445
|
testid,
|
|
1345
1446
|
iconOnly: true,
|
|
1346
1447
|
variant: "tertiary",
|
|
1347
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
1448
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: isDownloading ? "cached" : "download" }),
|
|
1348
1449
|
onClick
|
|
1349
1450
|
}
|
|
1350
1451
|
);
|
|
@@ -1357,74 +1458,93 @@ function PDFElement({ b64, testid }) {
|
|
|
1357
1458
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
1358
1459
|
page,
|
|
1359
1460
|
canvasRef,
|
|
1360
|
-
scale: 1
|
|
1461
|
+
scale: 1.1
|
|
1361
1462
|
});
|
|
1362
|
-
return /* @__PURE__ */ (0,
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1464
|
+
"div",
|
|
1465
|
+
{
|
|
1466
|
+
className: "flex flex-col space-y-4 ",
|
|
1467
|
+
style: {
|
|
1468
|
+
minHeight: 871,
|
|
1469
|
+
minWidth: 654
|
|
1470
|
+
},
|
|
1471
|
+
children: [
|
|
1472
|
+
!!pdfDocument && !!b64 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1473
|
+
"canvas",
|
|
1474
|
+
{
|
|
1475
|
+
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
1476
|
+
ref: canvasRef
|
|
1477
|
+
}
|
|
1478
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1479
|
+
Stack,
|
|
1480
|
+
{
|
|
1481
|
+
justify: "center",
|
|
1482
|
+
items: "center",
|
|
1483
|
+
height: "full",
|
|
1484
|
+
flexGrow: 1,
|
|
1485
|
+
"data-testid": testid ? `${testid}-pdf-loading` : void 0,
|
|
1486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Spinner, { size: "large" })
|
|
1487
|
+
}
|
|
1488
|
+
),
|
|
1489
|
+
(pdfDocument == null ? void 0 : pdfDocument.numPages) && pdfDocument.numPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1490
|
+
"ul",
|
|
1491
|
+
{
|
|
1492
|
+
className: "flex flex-row justify-between items-center",
|
|
1493
|
+
"data-testid": testid ? `${testid}-pdf-pagination` : void 0,
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { className: "previous", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1496
|
+
"button",
|
|
1497
|
+
{
|
|
1498
|
+
"data-testid": testid ? `${testid}-pdf-pagination-previous-button` : void 0,
|
|
1499
|
+
disabled: page === 1,
|
|
1500
|
+
onClick: () => setPage(page - 1),
|
|
1501
|
+
className: "not-disabled:cursor-pointer not-disabled:hover:underline ",
|
|
1502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Previous" })
|
|
1503
|
+
}
|
|
1504
|
+
) }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1506
|
+
"li",
|
|
1507
|
+
{
|
|
1508
|
+
"data-testid": testid ? `${testid}-pdf-pagination-text` : void 0,
|
|
1509
|
+
className: "text-label-desktop text-text-primary-normal",
|
|
1510
|
+
children: [
|
|
1511
|
+
"Page",
|
|
1512
|
+
" ",
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1514
|
+
"span",
|
|
1515
|
+
{
|
|
1516
|
+
"data-testid": testid ? `${testid}-pdf-pagination-page-${page}` : void 0,
|
|
1517
|
+
children: page
|
|
1518
|
+
}
|
|
1519
|
+
),
|
|
1520
|
+
" ",
|
|
1521
|
+
"of",
|
|
1522
|
+
" ",
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1524
|
+
"span",
|
|
1525
|
+
{
|
|
1526
|
+
"data-testid": testid ? `${testid}-pdf-pagination-total-page-${pdfDocument.numPages}` : void 0,
|
|
1527
|
+
children: pdfDocument.numPages
|
|
1528
|
+
}
|
|
1529
|
+
)
|
|
1530
|
+
]
|
|
1531
|
+
}
|
|
1532
|
+
),
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { className: "next", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1534
|
+
"button",
|
|
1535
|
+
{
|
|
1536
|
+
"data-testid": testid ? `${testid}-pdf-pagination-next-button` : void 0,
|
|
1537
|
+
disabled: page === pdfDocument.numPages,
|
|
1538
|
+
onClick: () => setPage(page + 1),
|
|
1539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Next" })
|
|
1540
|
+
}
|
|
1541
|
+
) })
|
|
1542
|
+
]
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
);
|
|
1428
1548
|
}
|
|
1429
1549
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1430
1550
|
0 && (module.exports = {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-F6YFWBVV.js";
|
|
5
5
|
import "../chunk-4RJKB7LC.js";
|
|
6
6
|
import "../chunk-C4JGTH6G.js";
|
|
7
7
|
import "../chunk-SYEJVSE4.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-MJKBQSNI.js";
|
|
9
9
|
import "../chunk-ZFOANBWG.js";
|
|
10
10
|
import {
|
|
11
11
|
Spinner
|
|
12
12
|
} from "../chunk-PLMGI5K5.js";
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
Heading3
|
|
15
|
+
} from "../chunk-AZ7LVLOK.js";
|
|
14
16
|
import {
|
|
15
17
|
Caption
|
|
16
18
|
} from "../chunk-E7D24OHM.js";
|
|
@@ -19,6 +21,9 @@ import "../chunk-6LN6QT6M.js";
|
|
|
19
21
|
import {
|
|
20
22
|
Stack
|
|
21
23
|
} from "../chunk-N6JVLYEE.js";
|
|
24
|
+
import {
|
|
25
|
+
Paragraph
|
|
26
|
+
} from "../chunk-HVI3CL7Y.js";
|
|
22
27
|
import {
|
|
23
28
|
Button
|
|
24
29
|
} from "../chunk-FKMKHLQH.js";
|
|
@@ -52,14 +57,32 @@ function PDFViewer(props) {
|
|
|
52
57
|
setIsDownloading(false);
|
|
53
58
|
}, [currentIndex, encodedPdfs]);
|
|
54
59
|
if (!encodedPdfs.length) return null;
|
|
60
|
+
function handleNextFile() {
|
|
61
|
+
if (currentIndex < encodedPdfs.length - 1) {
|
|
62
|
+
setCurrentIndex((prev) => prev + 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function handlePreviousFile() {
|
|
66
|
+
if (currentIndex > 0) {
|
|
67
|
+
setCurrentIndex((prev) => prev - 1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function handleClose() {
|
|
71
|
+
setCurrentIndex(0);
|
|
72
|
+
setIsDownloading(false);
|
|
73
|
+
onClose();
|
|
74
|
+
}
|
|
55
75
|
return /* @__PURE__ */ jsx(
|
|
56
76
|
Modal,
|
|
57
77
|
{
|
|
58
78
|
testid,
|
|
59
79
|
open: isOpen,
|
|
60
|
-
onClose,
|
|
80
|
+
onClose: handleClose,
|
|
61
81
|
showButtons: !!customActions,
|
|
62
82
|
customActions,
|
|
83
|
+
size: "large",
|
|
84
|
+
fixedHeightScrolling: true,
|
|
85
|
+
headerIconAlign: "right",
|
|
63
86
|
headerIcon: /* @__PURE__ */ jsx(
|
|
64
87
|
DownloadIcon,
|
|
65
88
|
{
|
|
@@ -68,33 +91,49 @@ function PDFViewer(props) {
|
|
|
68
91
|
isDownloading
|
|
69
92
|
}
|
|
70
93
|
),
|
|
71
|
-
|
|
94
|
+
className: "!max-w-fit",
|
|
95
|
+
children: /* @__PURE__ */ jsxs(Stack, { sizing: "layout", items: "center", children: [
|
|
72
96
|
/* @__PURE__ */ jsx(PDFElement, { testid, b64: encodedPdfs[currentIndex].base64 }),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
|
|
97
|
+
!!encodedPdfs[currentIndex].fileName && /* @__PURE__ */ jsx(Paragraph, { children: encodedPdfs[currentIndex].fileName.endsWith(".pdf") ? encodedPdfs[currentIndex].fileName : `${encodedPdfs[currentIndex].fileName}.pdf` }),
|
|
98
|
+
/* @__PURE__ */ jsxs(
|
|
99
|
+
Stack,
|
|
75
100
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
requestAnimationFrame(() => {
|
|
82
|
-
const button = e.target;
|
|
83
|
-
button.scrollIntoView({
|
|
84
|
-
behavior: "smooth",
|
|
85
|
-
block: "nearest",
|
|
86
|
-
inline: "center"
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
disabled: isDownloading || currentIndex === index || !pdf.base64,
|
|
101
|
+
horizontal: true,
|
|
102
|
+
overflowX: "auto",
|
|
103
|
+
justify: "center",
|
|
104
|
+
items: "center",
|
|
105
|
+
sizing: "layout-group",
|
|
91
106
|
children: [
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Button,
|
|
109
|
+
{
|
|
110
|
+
iconOnly: true,
|
|
111
|
+
variant: "tertiary",
|
|
112
|
+
onClick: handlePreviousFile,
|
|
113
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_backward" }),
|
|
114
|
+
disabled: currentIndex === 0,
|
|
115
|
+
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsxs(Heading3, { className: "text-text-primary-normal", children: [
|
|
119
|
+
currentIndex + 1,
|
|
120
|
+
" / ",
|
|
121
|
+
encodedPdfs.length
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
Button,
|
|
125
|
+
{
|
|
126
|
+
iconOnly: true,
|
|
127
|
+
variant: "tertiary",
|
|
128
|
+
onClick: handleNextFile,
|
|
129
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_forward" }),
|
|
130
|
+
disabled: currentIndex === encodedPdfs.length - 1,
|
|
131
|
+
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
132
|
+
}
|
|
133
|
+
)
|
|
94
134
|
]
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
)) })
|
|
135
|
+
}
|
|
136
|
+
)
|
|
98
137
|
] })
|
|
99
138
|
}
|
|
100
139
|
);
|
|
@@ -123,74 +162,93 @@ function PDFElement({ b64, testid }) {
|
|
|
123
162
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
124
163
|
page,
|
|
125
164
|
canvasRef,
|
|
126
|
-
scale: 1
|
|
165
|
+
scale: 1.1
|
|
127
166
|
});
|
|
128
|
-
return /* @__PURE__ */ jsxs(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
167
|
+
return /* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: "flex flex-col space-y-4 ",
|
|
171
|
+
style: {
|
|
172
|
+
minHeight: 871,
|
|
173
|
+
minWidth: 654
|
|
174
|
+
},
|
|
175
|
+
children: [
|
|
176
|
+
!!pdfDocument && !!b64 ? /* @__PURE__ */ jsx(
|
|
177
|
+
"canvas",
|
|
178
|
+
{
|
|
179
|
+
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
180
|
+
ref: canvasRef
|
|
181
|
+
}
|
|
182
|
+
) : /* @__PURE__ */ jsx(
|
|
183
|
+
Stack,
|
|
184
|
+
{
|
|
185
|
+
justify: "center",
|
|
186
|
+
items: "center",
|
|
187
|
+
height: "full",
|
|
188
|
+
flexGrow: 1,
|
|
189
|
+
"data-testid": testid ? `${testid}-pdf-loading` : void 0,
|
|
190
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: "large" })
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
(pdfDocument == null ? void 0 : pdfDocument.numPages) && pdfDocument.numPages > 1 && /* @__PURE__ */ jsxs(
|
|
194
|
+
"ul",
|
|
195
|
+
{
|
|
196
|
+
className: "flex flex-row justify-between items-center",
|
|
197
|
+
"data-testid": testid ? `${testid}-pdf-pagination` : void 0,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx("li", { className: "previous", children: /* @__PURE__ */ jsx(
|
|
200
|
+
"button",
|
|
201
|
+
{
|
|
202
|
+
"data-testid": testid ? `${testid}-pdf-pagination-previous-button` : void 0,
|
|
203
|
+
disabled: page === 1,
|
|
204
|
+
onClick: () => setPage(page - 1),
|
|
205
|
+
className: "not-disabled:cursor-pointer not-disabled:hover:underline ",
|
|
206
|
+
children: /* @__PURE__ */ jsx(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Previous" })
|
|
207
|
+
}
|
|
208
|
+
) }),
|
|
209
|
+
/* @__PURE__ */ jsxs(
|
|
210
|
+
"li",
|
|
211
|
+
{
|
|
212
|
+
"data-testid": testid ? `${testid}-pdf-pagination-text` : void 0,
|
|
213
|
+
className: "text-label-desktop text-text-primary-normal",
|
|
214
|
+
children: [
|
|
215
|
+
"Page",
|
|
216
|
+
" ",
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
"span",
|
|
219
|
+
{
|
|
220
|
+
"data-testid": testid ? `${testid}-pdf-pagination-page-${page}` : void 0,
|
|
221
|
+
children: page
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
" ",
|
|
225
|
+
"of",
|
|
226
|
+
" ",
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
"span",
|
|
229
|
+
{
|
|
230
|
+
"data-testid": testid ? `${testid}-pdf-pagination-total-page-${pdfDocument.numPages}` : void 0,
|
|
231
|
+
children: pdfDocument.numPages
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ jsx("li", { className: "next", children: /* @__PURE__ */ jsx(
|
|
238
|
+
"button",
|
|
239
|
+
{
|
|
240
|
+
"data-testid": testid ? `${testid}-pdf-pagination-next-button` : void 0,
|
|
241
|
+
disabled: page === pdfDocument.numPages,
|
|
242
|
+
onClick: () => setPage(page + 1),
|
|
243
|
+
children: /* @__PURE__ */ jsx(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Next" })
|
|
244
|
+
}
|
|
245
|
+
) })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
);
|
|
194
252
|
}
|
|
195
253
|
export {
|
|
196
254
|
PDFViewer
|
|
@@ -173,7 +173,8 @@ var Tooltip = ({
|
|
|
173
173
|
position = "top",
|
|
174
174
|
children,
|
|
175
175
|
showOnTruncation = false,
|
|
176
|
-
offset = 8
|
|
176
|
+
offset = 8,
|
|
177
|
+
keepHidden = false
|
|
177
178
|
}) => {
|
|
178
179
|
const ref = (0, import_react.useRef)(null);
|
|
179
180
|
const tooltipRef = (0, import_react.useRef)(null);
|
|
@@ -242,7 +243,7 @@ var Tooltip = ({
|
|
|
242
243
|
onMouseLeave: handleMouseLeave,
|
|
243
244
|
children: [
|
|
244
245
|
children,
|
|
245
|
-
isVisible && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
246
|
+
!keepHidden && isVisible && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
246
247
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
248
|
"div",
|
|
248
249
|
{
|
|
@@ -3606,7 +3606,8 @@ var Tooltip = ({
|
|
|
3606
3606
|
position = "top",
|
|
3607
3607
|
children,
|
|
3608
3608
|
showOnTruncation = false,
|
|
3609
|
-
offset = 8
|
|
3609
|
+
offset = 8,
|
|
3610
|
+
keepHidden = false
|
|
3610
3611
|
}) => {
|
|
3611
3612
|
const ref = (0, import_react17.useRef)(null);
|
|
3612
3613
|
const tooltipRef = (0, import_react17.useRef)(null);
|
|
@@ -3675,7 +3676,7 @@ var Tooltip = ({
|
|
|
3675
3676
|
onMouseLeave: handleMouseLeave,
|
|
3676
3677
|
children: [
|
|
3677
3678
|
children,
|
|
3678
|
-
isVisible && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
3679
|
+
!keepHidden && isVisible && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
3679
3680
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3680
3681
|
"div",
|
|
3681
3682
|
{
|
package/dist/components/index.js
CHANGED
package/dist/index.css
CHANGED
|
@@ -843,6 +843,9 @@
|
|
|
843
843
|
.w-screen {
|
|
844
844
|
width: 100vw;
|
|
845
845
|
}
|
|
846
|
+
.\!max-w-fit {
|
|
847
|
+
max-width: fit-content !important;
|
|
848
|
+
}
|
|
846
849
|
.max-w-25 {
|
|
847
850
|
max-width: calc(var(--spacing) * 25);
|
|
848
851
|
}
|
|
@@ -2421,6 +2424,11 @@
|
|
|
2421
2424
|
cursor: pointer;
|
|
2422
2425
|
}
|
|
2423
2426
|
}
|
|
2427
|
+
.not-disabled\:text-text-primary-normal {
|
|
2428
|
+
&:not(*:disabled) {
|
|
2429
|
+
color: var(--color-text-primary-normal);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2424
2432
|
.group-hover\:block {
|
|
2425
2433
|
&:is(:where(.group):hover *) {
|
|
2426
2434
|
@media (hover: hover) {
|
package/package.json
CHANGED
package/src/components/Modal.tsx
CHANGED
|
@@ -25,6 +25,7 @@ type ModalProps = PropsWithChildren<{
|
|
|
25
25
|
showButtons?: boolean;
|
|
26
26
|
hideCloseIcon?: boolean;
|
|
27
27
|
headerIcon?: React.ReactNode;
|
|
28
|
+
headerIconAlign?: "left" | "center" | "right";
|
|
28
29
|
fixedHeightScrolling?: boolean;
|
|
29
30
|
customActions?: React.ReactNode;
|
|
30
31
|
}>;
|
|
@@ -117,6 +118,7 @@ export const Modal = ({
|
|
|
117
118
|
showButtons = false,
|
|
118
119
|
hideCloseIcon = false,
|
|
119
120
|
headerIcon,
|
|
121
|
+
headerIconAlign,
|
|
120
122
|
fixedHeightScrolling = false,
|
|
121
123
|
customActions,
|
|
122
124
|
}: ModalProps) => {
|
|
@@ -150,7 +152,7 @@ export const Modal = ({
|
|
|
150
152
|
fadeInScale(modalRef.current);
|
|
151
153
|
bgFadeIn(bgRef.current);
|
|
152
154
|
}
|
|
153
|
-
}, [mounted, open]);
|
|
155
|
+
}, [mounted, onClose, open, wasOpen]);
|
|
154
156
|
|
|
155
157
|
const handleKeyDown = useCallback(
|
|
156
158
|
(e: KeyboardEvent) => {
|
|
@@ -161,7 +163,7 @@ export const Modal = ({
|
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
165
|
},
|
|
164
|
-
[onClose
|
|
166
|
+
[onClose],
|
|
165
167
|
);
|
|
166
168
|
|
|
167
169
|
const handleClose = useCallback(() => {
|
|
@@ -259,6 +261,7 @@ export const Modal = ({
|
|
|
259
261
|
onClose={handleClose}
|
|
260
262
|
hideCloseIcon={hideCloseIcon}
|
|
261
263
|
headerIcon={headerIcon}
|
|
264
|
+
headerIconAlign={headerIconAlign}
|
|
262
265
|
/>
|
|
263
266
|
{children && (
|
|
264
267
|
<ModalContent
|
|
@@ -9,6 +9,7 @@ type ModalHeaderProps = {
|
|
|
9
9
|
title?: string;
|
|
10
10
|
hideCloseIcon?: boolean;
|
|
11
11
|
headerIcon?: React.ReactNode;
|
|
12
|
+
headerIconAlign?: "left" | "center" | "right";
|
|
12
13
|
onClose?: () => void;
|
|
13
14
|
id?: string;
|
|
14
15
|
testid?: string;
|
|
@@ -18,6 +19,7 @@ export const ModalHeader = ({
|
|
|
18
19
|
title,
|
|
19
20
|
hideCloseIcon,
|
|
20
21
|
headerIcon,
|
|
22
|
+
headerIconAlign,
|
|
21
23
|
onClose,
|
|
22
24
|
id,
|
|
23
25
|
testid,
|
|
@@ -28,6 +30,9 @@ export const ModalHeader = ({
|
|
|
28
30
|
data-testid={testid}
|
|
29
31
|
className={clsx(
|
|
30
32
|
"flex justify-between items-center",
|
|
33
|
+
headerIconAlign === "center" && "justify-center",
|
|
34
|
+
headerIconAlign === "right" && "justify-end",
|
|
35
|
+
headerIconAlign === "left" && "justify-start",
|
|
31
36
|
layoutPaddding,
|
|
32
37
|
layoutGroupGap,
|
|
33
38
|
)}
|
|
@@ -35,7 +40,11 @@ export const ModalHeader = ({
|
|
|
35
40
|
<div className={clsx("flex items-center", layoutGroupGap)}>
|
|
36
41
|
{headerIcon}
|
|
37
42
|
{title && (
|
|
38
|
-
<Heading2
|
|
43
|
+
<Heading2
|
|
44
|
+
id={id ? `${id}-title` : undefined}
|
|
45
|
+
testid={testid ? `${testid}-title` : undefined}
|
|
46
|
+
as="p"
|
|
47
|
+
>
|
|
39
48
|
{title}
|
|
40
49
|
</Heading2>
|
|
41
50
|
)}
|
|
@@ -8,6 +8,8 @@ import { Icon } from "./Icon";
|
|
|
8
8
|
import { Stack } from "./Stack";
|
|
9
9
|
import { Caption } from "./Caption";
|
|
10
10
|
import { Spinner } from "./Spinner";
|
|
11
|
+
import { Paragraph } from "./Paragraph";
|
|
12
|
+
import { Heading3 } from "./Heading";
|
|
11
13
|
|
|
12
14
|
type PDFViewerProps = {
|
|
13
15
|
isOpen: boolean;
|
|
@@ -42,13 +44,34 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
42
44
|
|
|
43
45
|
if (!encodedPdfs.length) return null;
|
|
44
46
|
|
|
47
|
+
function handleNextFile() {
|
|
48
|
+
if (currentIndex < encodedPdfs.length - 1) {
|
|
49
|
+
setCurrentIndex((prev) => prev + 1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function handlePreviousFile() {
|
|
54
|
+
if (currentIndex > 0) {
|
|
55
|
+
setCurrentIndex((prev) => prev - 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleClose() {
|
|
60
|
+
setCurrentIndex(0);
|
|
61
|
+
setIsDownloading(false);
|
|
62
|
+
onClose();
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
return (
|
|
46
66
|
<Modal
|
|
47
67
|
testid={testid}
|
|
48
68
|
open={isOpen}
|
|
49
|
-
onClose={
|
|
69
|
+
onClose={handleClose}
|
|
50
70
|
showButtons={!!customActions}
|
|
51
71
|
customActions={customActions}
|
|
72
|
+
size="large"
|
|
73
|
+
fixedHeightScrolling
|
|
74
|
+
headerIconAlign="right"
|
|
52
75
|
headerIcon={
|
|
53
76
|
<DownloadIcon
|
|
54
77
|
testid={testid ? `${testid}-download-icon` : undefined}
|
|
@@ -56,11 +79,44 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
56
79
|
isDownloading={isDownloading}
|
|
57
80
|
/>
|
|
58
81
|
}
|
|
82
|
+
className="!max-w-fit"
|
|
59
83
|
>
|
|
60
|
-
<Stack sizing="layout">
|
|
84
|
+
<Stack sizing="layout" items="center">
|
|
61
85
|
<PDFElement testid={testid} b64={encodedPdfs[currentIndex].base64} />
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
{!!encodedPdfs[currentIndex].fileName && (
|
|
87
|
+
<Paragraph>
|
|
88
|
+
{encodedPdfs[currentIndex].fileName.endsWith(".pdf")
|
|
89
|
+
? encodedPdfs[currentIndex].fileName
|
|
90
|
+
: `${encodedPdfs[currentIndex].fileName}.pdf`}
|
|
91
|
+
</Paragraph>
|
|
92
|
+
)}
|
|
93
|
+
<Stack
|
|
94
|
+
horizontal
|
|
95
|
+
overflowX="auto"
|
|
96
|
+
justify="center"
|
|
97
|
+
items="center"
|
|
98
|
+
sizing="layout-group"
|
|
99
|
+
>
|
|
100
|
+
<Button
|
|
101
|
+
iconOnly
|
|
102
|
+
variant="tertiary"
|
|
103
|
+
onClick={handlePreviousFile}
|
|
104
|
+
leftIcon={<Icon name="chevron_backward" />}
|
|
105
|
+
disabled={currentIndex === 0}
|
|
106
|
+
testid={testid ? `${testid}-pdf-file-previous-button` : undefined}
|
|
107
|
+
/>
|
|
108
|
+
<Heading3 className="text-text-primary-normal">
|
|
109
|
+
{currentIndex + 1} / {encodedPdfs.length}
|
|
110
|
+
</Heading3>
|
|
111
|
+
<Button
|
|
112
|
+
iconOnly
|
|
113
|
+
variant="tertiary"
|
|
114
|
+
onClick={handleNextFile}
|
|
115
|
+
rightIcon={<Icon name="chevron_forward" />}
|
|
116
|
+
disabled={currentIndex === encodedPdfs.length - 1}
|
|
117
|
+
testid={testid ? `${testid}-pdf-file-next-button` : undefined}
|
|
118
|
+
/>
|
|
119
|
+
{/* {encodedPdfs.map((pdf, index) => (
|
|
64
120
|
<Button
|
|
65
121
|
testid={testid ? `${testid}-${pdf.fileName}-button` : undefined}
|
|
66
122
|
variant={index === currentIndex ? "primary" : "secondary"}
|
|
@@ -84,7 +140,7 @@ export function PDFViewer(props: PDFViewerProps) {
|
|
|
84
140
|
{!pdf.base64 && <Spinner />}
|
|
85
141
|
{pdf.fileName}
|
|
86
142
|
</Button>
|
|
87
|
-
))}
|
|
143
|
+
))} */}
|
|
88
144
|
</Stack>
|
|
89
145
|
</Stack>
|
|
90
146
|
</Modal>
|
|
@@ -120,20 +176,32 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
|
|
|
120
176
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
121
177
|
page,
|
|
122
178
|
canvasRef,
|
|
123
|
-
scale: 1,
|
|
179
|
+
scale: 1.1,
|
|
124
180
|
});
|
|
125
181
|
|
|
126
182
|
return (
|
|
127
|
-
<div
|
|
128
|
-
|
|
183
|
+
<div
|
|
184
|
+
className="flex flex-col space-y-4 "
|
|
185
|
+
style={{
|
|
186
|
+
minHeight: 871,
|
|
187
|
+
minWidth: 654,
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
{!!pdfDocument && !!b64 ? (
|
|
129
191
|
<canvas
|
|
130
192
|
data-testid={testid ? `${testid}-pdf-content` : undefined}
|
|
131
193
|
ref={canvasRef}
|
|
132
194
|
/>
|
|
133
195
|
) : (
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
196
|
+
<Stack
|
|
197
|
+
justify="center"
|
|
198
|
+
items="center"
|
|
199
|
+
height="full"
|
|
200
|
+
flexGrow={1}
|
|
201
|
+
data-testid={testid ? `${testid}-pdf-loading` : undefined}
|
|
202
|
+
>
|
|
203
|
+
<Spinner size="large" />
|
|
204
|
+
</Stack>
|
|
137
205
|
)}
|
|
138
206
|
{pdfDocument?.numPages && pdfDocument.numPages > 1 && (
|
|
139
207
|
<ul
|
|
@@ -149,12 +217,14 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
|
|
|
149
217
|
onClick={() => setPage(page - 1)}
|
|
150
218
|
className="not-disabled:cursor-pointer not-disabled:hover:underline "
|
|
151
219
|
>
|
|
152
|
-
<Caption>
|
|
220
|
+
<Caption className="not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal">
|
|
221
|
+
Previous
|
|
222
|
+
</Caption>
|
|
153
223
|
</button>
|
|
154
224
|
</li>
|
|
155
225
|
<li
|
|
156
226
|
data-testid={testid ? `${testid}-pdf-pagination-text` : undefined}
|
|
157
|
-
className="text-label-desktop text-text-
|
|
227
|
+
className="text-label-desktop text-text-primary-normal"
|
|
158
228
|
>
|
|
159
229
|
Page{" "}
|
|
160
230
|
<span
|
|
@@ -182,9 +252,10 @@ function PDFElement({ b64, testid }: { b64: string; testid?: string }) {
|
|
|
182
252
|
}
|
|
183
253
|
disabled={page === pdfDocument!.numPages}
|
|
184
254
|
onClick={() => setPage(page + 1)}
|
|
185
|
-
className="not-disabled:cursor-pointer not-disabled:hover:underline "
|
|
186
255
|
>
|
|
187
|
-
<Caption>
|
|
256
|
+
<Caption className="not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal">
|
|
257
|
+
Next
|
|
258
|
+
</Caption>
|
|
188
259
|
</button>
|
|
189
260
|
</li>
|
|
190
261
|
</ul>
|
|
@@ -19,6 +19,7 @@ export type TooltipProps = PropsWithChildren<{
|
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
showOnTruncation?: boolean;
|
|
21
21
|
offset?: number;
|
|
22
|
+
keepHidden?: boolean; // for scenario where we want to keep the tooltip hidden based on a condition
|
|
22
23
|
}>;
|
|
23
24
|
|
|
24
25
|
export const Tooltip = ({
|
|
@@ -29,6 +30,7 @@ export const Tooltip = ({
|
|
|
29
30
|
children,
|
|
30
31
|
showOnTruncation = false,
|
|
31
32
|
offset = 8,
|
|
33
|
+
keepHidden = false
|
|
32
34
|
}: TooltipProps) => {
|
|
33
35
|
const ref = useRef<HTMLDivElement>(null);
|
|
34
36
|
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
@@ -109,7 +111,7 @@ export const Tooltip = ({
|
|
|
109
111
|
>
|
|
110
112
|
{children}
|
|
111
113
|
|
|
112
|
-
{isVisible &&
|
|
114
|
+
{!keepHidden && isVisible &&
|
|
113
115
|
typeof document !== "undefined" &&
|
|
114
116
|
createPortal(
|
|
115
117
|
<div
|