@dmsi/wedgekit-react 0.0.171 → 0.0.173
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-GCBW2LDM.js → chunk-REGRTR2Y.js} +6 -4
- package/dist/{chunk-OJX75MY2.js → chunk-TB7VTSDP.js} +20 -9
- package/dist/{chunk-6A54FL75.js → chunk-ZSKLCKIR.js} +13 -1
- package/dist/components/DataGridCell.cjs +20 -9
- package/dist/components/DataGridCell.js +1 -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/index.cjs +213 -181
- package/dist/components/index.js +194 -173
- package/dist/index.css +8 -0
- package/package.json +1 -1
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +1 -1
- package/src/components/DataGrid/PinnedColumns.tsx +19 -6
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +7 -2
- package/src/components/DataGrid/index.tsx +38 -9
- package/src/components/DataGridCell.tsx +16 -4
- package/src/components/Modal.tsx +5 -2
- package/src/components/ModalHeader.tsx +10 -1
- package/src/components/PDFViewer.tsx +86 -15
|
@@ -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 = {
|