@dmsi/wedgekit-react 0.0.203 → 0.0.205
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-F6YFWBVV.js → chunk-2B5T4NCT.js} +2 -2
- package/dist/{chunk-ESTHTAR5.js → chunk-2JRZCC2K.js} +2 -2
- package/dist/{chunk-PMBEIP24.js → chunk-2WRRRPEB.js} +2 -2
- package/dist/{chunk-XH65MD2C.js → chunk-33W2KSCB.js} +3 -3
- package/dist/{chunk-C4JGTH6G.js → chunk-47KTDBGA.js} +2 -2
- package/dist/{chunk-4T3DRGLF.js → chunk-7W4I2NK3.js} +3 -3
- package/dist/{chunk-MJKBQSNI.js → chunk-A5ROZWIH.js} +3 -3
- package/dist/{chunk-WSS2DFTP.js → chunk-ARC7FOL2.js} +4 -4
- package/dist/{chunk-ORMEWXMH.js → chunk-BBZEL7EG.js} +22 -1
- package/dist/{chunk-NW2C4DL4.js → chunk-BHJNYWQG.js} +2 -2
- package/dist/{chunk-N6JVLYEE.js → chunk-BOWQUDUU.js} +1 -1
- package/dist/{chunk-HVI3CL7Y.js → chunk-CJELWEO2.js} +1 -1
- package/dist/{chunk-JWCT72WR.js → chunk-CJVTFYI4.js} +1 -1
- package/dist/{chunk-WFQEE2OO.js → chunk-E3UOI2D2.js} +3 -3
- package/dist/{chunk-LM5MKBPM.js → chunk-ED7FXZRX.js} +4 -4
- package/dist/{chunk-ZGFQN47L.js → chunk-FYW64H7N.js} +3 -3
- package/dist/{chunk-CYZL57LH.js → chunk-KGVKHWUK.js} +1 -1
- package/dist/{chunk-EUXB3XKL.js → chunk-LPQ4QMAV.js} +1 -1
- package/dist/{chunk-AZ7LVLOK.js → chunk-REOLWEZG.js} +1 -1
- package/dist/{chunk-SDQPZQTI.js → chunk-RXPS5GVE.js} +6 -6
- package/dist/{chunk-4XA32LKR.js → chunk-SE5DM2IJ.js} +2 -2
- package/dist/{chunk-FKMKHLQH.js → chunk-SK742QNF.js} +1 -1
- package/dist/{chunk-4LXG6QNT.js → chunk-TJWGFGWX.js} +1 -1
- package/dist/{chunk-NKUETCDA.js → chunk-UAPWR2KE.js} +1 -1
- package/dist/{chunk-AEDQLVKH.js → chunk-WE55TGZZ.js} +1 -1
- package/dist/{chunk-QBIEU25R.js → chunk-WKWNBR53.js} +1 -1
- package/dist/{chunk-OZKCUKBS.js → chunk-WXHRJSDG.js} +4 -4
- package/dist/{chunk-I6GEUF6Y.js → chunk-XQILVD56.js} +1 -1
- package/dist/components/AccessChangerTabItem.js +3 -3
- package/dist/components/Accordion.js +6 -6
- package/dist/components/Breadcrumbs.js +3 -3
- package/dist/components/Button.js +2 -2
- package/dist/components/CalendarRange.js +3 -3
- package/dist/components/Caption.js +129 -5
- package/dist/components/Card.js +2 -2
- package/dist/components/Checkbox.js +4 -4
- package/dist/components/ContentTab.js +3 -3
- package/dist/components/ContentTabs.js +3 -3
- package/dist/components/DMSiLogo.js +1 -1
- package/dist/components/DataGridCell.js +10 -10
- package/dist/components/DataTable.js +1 -1
- package/dist/components/DateInput.js +5 -5
- package/dist/components/DateRangeInput.js +5 -5
- package/dist/components/DebugJson.js +1 -1
- package/dist/components/Display.js +2 -2
- package/dist/components/EditingContext.js +1 -1
- package/dist/components/FilterGroup.js +10 -10
- package/dist/components/FullViewportBox.js +1 -1
- package/dist/components/Grid.js +1 -1
- package/dist/components/Heading.js +2 -2
- package/dist/components/HorizontalDivider.js +1 -1
- package/dist/components/Icon.js +2 -2
- package/dist/components/Input.js +4 -4
- package/dist/components/InputGroup.js +2 -2
- package/dist/components/Label.js +2 -2
- package/dist/components/Link.js +2 -2
- package/dist/components/List.js +1 -1
- package/dist/components/LiveChatComponent.js +1 -1
- package/dist/components/LoadingScrim.js +1 -1
- package/dist/components/LogoAgilityTopBar.js +1 -1
- package/dist/components/LogoDMSiTopBar.js +2 -2
- package/dist/components/LogoMillworkTopBar.js +1 -1
- package/dist/components/MainBar.js +1 -1
- package/dist/components/Menu.js +3 -3
- package/dist/components/MenuOption.js +5 -5
- package/dist/components/MobileDataGrid.js +6 -6
- package/dist/components/Modal.js +7 -7
- package/dist/components/ModalButtons.js +4 -4
- package/dist/components/ModalContent.js +1 -1
- package/dist/components/ModalHeader.js +5 -5
- package/dist/components/ModalScrim.js +1 -1
- package/dist/components/NavigationTab.js +4 -4
- package/dist/components/NavigationTabs.js +4 -4
- package/dist/components/NestedMenu.js +5 -5
- package/dist/components/Notification.js +6 -6
- package/dist/components/OptionPill.js +5 -5
- package/dist/components/PDFViewer.cjs +112 -225
- package/dist/components/PDFViewer.js +75 -90
- package/dist/components/Paragraph.js +2 -2
- package/dist/components/Password.js +4 -4
- package/dist/components/ProjectBar.js +1 -1
- package/dist/components/Radio.js +2 -2
- package/dist/components/Search.js +5 -5
- package/dist/components/Select.js +5 -5
- package/dist/components/SideMenu.js +1 -1
- package/dist/components/SideMenuGroup.js +4 -4
- package/dist/components/SideMenuItem.js +3 -3
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Stack.js +2 -2
- package/dist/components/StatusPill.js +2 -2
- package/dist/components/Stepper.js +5 -5
- package/dist/components/Subheader.js +2 -2
- package/dist/components/Surface.js +1 -1
- package/dist/components/Swatch.js +5 -5
- package/dist/components/Textarea.js +1 -1
- package/dist/components/Theme.js +1 -1
- package/dist/components/Time.js +5 -5
- package/dist/components/Toast.js +5 -5
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/TopBar.js +2 -2
- package/dist/components/Upload.js +4 -4
- package/dist/components/WorldpayIframe.js +1 -1
- package/dist/components/index.css +0 -22
- package/dist/components/index.js +17 -17
- package/dist/components/useMenuSystem.js +2 -2
- package/dist/components/useMounted.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.css +0 -22
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/src/components/PDFViewer.tsx +61 -73
- package/dist/chunk-E7D24OHM.js +0 -134
|
@@ -56,6 +56,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
56
56
|
mod
|
|
57
57
|
));
|
|
58
58
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
59
|
+
var __async = (__this, __arguments, generator) => {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
var fulfilled = (value) => {
|
|
62
|
+
try {
|
|
63
|
+
step(generator.next(value));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
reject(e);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var rejected = (value) => {
|
|
69
|
+
try {
|
|
70
|
+
step(generator.throw(value));
|
|
71
|
+
} catch (e) {
|
|
72
|
+
reject(e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
76
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
77
|
+
});
|
|
78
|
+
};
|
|
59
79
|
|
|
60
80
|
// src/components/PDFViewer.tsx
|
|
61
81
|
var PDFViewer_exports = {};
|
|
@@ -1049,130 +1069,11 @@ var Stack = (_a) => {
|
|
|
1049
1069
|
);
|
|
1050
1070
|
};
|
|
1051
1071
|
|
|
1052
|
-
// src/components/Caption.tsx
|
|
1053
|
-
var import_clsx11 = __toESM(require("clsx"), 1);
|
|
1054
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1055
|
-
var Caption = (_a) => {
|
|
1056
|
-
var _b = _a, {
|
|
1057
|
-
className,
|
|
1058
|
-
children,
|
|
1059
|
-
as = "span",
|
|
1060
|
-
style = "default",
|
|
1061
|
-
color,
|
|
1062
|
-
align,
|
|
1063
|
-
id,
|
|
1064
|
-
testid
|
|
1065
|
-
} = _b, props = __objRest(_b, [
|
|
1066
|
-
"className",
|
|
1067
|
-
"children",
|
|
1068
|
-
"as",
|
|
1069
|
-
"style",
|
|
1070
|
-
"color",
|
|
1071
|
-
"align",
|
|
1072
|
-
"id",
|
|
1073
|
-
"testid"
|
|
1074
|
-
]);
|
|
1075
|
-
const Element = as;
|
|
1076
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { id, "data-testid": testid, className: "flex gap-1", children: [
|
|
1077
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1078
|
-
WhichIcon,
|
|
1079
|
-
{
|
|
1080
|
-
id,
|
|
1081
|
-
testid,
|
|
1082
|
-
style,
|
|
1083
|
-
size: 16,
|
|
1084
|
-
className: "mt-[3px] desktop:mt-0"
|
|
1085
|
-
}
|
|
1086
|
-
),
|
|
1087
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1088
|
-
Element,
|
|
1089
|
-
__spreadProps(__spreadValues({
|
|
1090
|
-
id: id ? `${id}-text` : void 0,
|
|
1091
|
-
"data-testid": testid ? `${testid}-text` : void 0,
|
|
1092
|
-
className: (0, import_clsx11.default)(
|
|
1093
|
-
typography.caption.replace("text-text-primary-normal", ""),
|
|
1094
|
-
(style === "default" || style === "info") && "text-text-secondary-normal",
|
|
1095
|
-
style === "success" && "text-text-success-normal",
|
|
1096
|
-
style === "warning" && "text-text-warning-normal",
|
|
1097
|
-
style === "error" && "text-text-critical-normal",
|
|
1098
|
-
align === "left" && "text-left",
|
|
1099
|
-
align === "center" && "text-center",
|
|
1100
|
-
align === "right" && "text-right",
|
|
1101
|
-
className
|
|
1102
|
-
)
|
|
1103
|
-
}, props), {
|
|
1104
|
-
style: {
|
|
1105
|
-
color: color ? `var(--color-${color})` : void 0
|
|
1106
|
-
},
|
|
1107
|
-
children
|
|
1108
|
-
})
|
|
1109
|
-
)
|
|
1110
|
-
] });
|
|
1111
|
-
};
|
|
1112
|
-
var WhichIcon = ({
|
|
1113
|
-
style,
|
|
1114
|
-
size,
|
|
1115
|
-
className,
|
|
1116
|
-
id,
|
|
1117
|
-
testid
|
|
1118
|
-
}) => {
|
|
1119
|
-
if (style === "success") {
|
|
1120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-icon-success-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1121
|
-
Icon,
|
|
1122
|
-
{
|
|
1123
|
-
id: id ? `${id}-icon` : void 0,
|
|
1124
|
-
testid: testid ? `${testid}-icon` : void 0,
|
|
1125
|
-
className,
|
|
1126
|
-
name: "check_circle",
|
|
1127
|
-
size
|
|
1128
|
-
}
|
|
1129
|
-
) });
|
|
1130
|
-
}
|
|
1131
|
-
if (style === "warning") {
|
|
1132
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-icon-warning-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1133
|
-
Icon,
|
|
1134
|
-
{
|
|
1135
|
-
id: id ? `${id}-icon` : void 0,
|
|
1136
|
-
testid: testid ? `${testid}-icon` : void 0,
|
|
1137
|
-
className,
|
|
1138
|
-
name: "warning",
|
|
1139
|
-
size
|
|
1140
|
-
}
|
|
1141
|
-
) });
|
|
1142
|
-
}
|
|
1143
|
-
if (style === "error") {
|
|
1144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-icon-critical-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1145
|
-
Icon,
|
|
1146
|
-
{
|
|
1147
|
-
id: id ? `${id}-icon` : void 0,
|
|
1148
|
-
testid: testid ? `${testid}-icon` : void 0,
|
|
1149
|
-
className,
|
|
1150
|
-
name: "info",
|
|
1151
|
-
size
|
|
1152
|
-
}
|
|
1153
|
-
) });
|
|
1154
|
-
}
|
|
1155
|
-
if (style === "info") {
|
|
1156
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1157
|
-
Icon,
|
|
1158
|
-
{
|
|
1159
|
-
id: id ? `${id}-icon` : void 0,
|
|
1160
|
-
testid: testid ? `${testid}-icon` : void 0,
|
|
1161
|
-
className,
|
|
1162
|
-
name: "info",
|
|
1163
|
-
size
|
|
1164
|
-
}
|
|
1165
|
-
) });
|
|
1166
|
-
}
|
|
1167
|
-
return null;
|
|
1168
|
-
};
|
|
1169
|
-
Caption.displayName = "Caption";
|
|
1170
|
-
|
|
1171
1072
|
// src/components/Spinner.tsx
|
|
1172
|
-
var
|
|
1073
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1173
1074
|
var Spinner = ({ size = "small", testid }) => {
|
|
1174
1075
|
const dimension = size === "large" ? 48 : 24;
|
|
1175
|
-
return /* @__PURE__ */ (0,
|
|
1076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1176
1077
|
"svg",
|
|
1177
1078
|
{
|
|
1178
1079
|
"data-testid": testid,
|
|
@@ -1184,7 +1085,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1184
1085
|
className: "animate-spin",
|
|
1185
1086
|
"aria-label": "Loading",
|
|
1186
1087
|
children: [
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1188
1089
|
"animate",
|
|
1189
1090
|
{
|
|
1190
1091
|
attributeName: "opacity",
|
|
@@ -1195,7 +1096,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1195
1096
|
repeatCount: "indefinite"
|
|
1196
1097
|
}
|
|
1197
1098
|
) }),
|
|
1198
|
-
/* @__PURE__ */ (0,
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1199
1100
|
"animate",
|
|
1200
1101
|
{
|
|
1201
1102
|
attributeName: "opacity",
|
|
@@ -1206,7 +1107,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1206
1107
|
repeatCount: "indefinite"
|
|
1207
1108
|
}
|
|
1208
1109
|
) }),
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1210
1111
|
"animate",
|
|
1211
1112
|
{
|
|
1212
1113
|
attributeName: "opacity",
|
|
@@ -1217,7 +1118,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1217
1118
|
repeatCount: "indefinite"
|
|
1218
1119
|
}
|
|
1219
1120
|
) }),
|
|
1220
|
-
/* @__PURE__ */ (0,
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1221
1122
|
"animate",
|
|
1222
1123
|
{
|
|
1223
1124
|
attributeName: "opacity",
|
|
@@ -1228,7 +1129,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1228
1129
|
repeatCount: "indefinite"
|
|
1229
1130
|
}
|
|
1230
1131
|
) }),
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1232
1133
|
"animate",
|
|
1233
1134
|
{
|
|
1234
1135
|
attributeName: "opacity",
|
|
@@ -1239,7 +1140,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1239
1140
|
repeatCount: "indefinite"
|
|
1240
1141
|
}
|
|
1241
1142
|
) }),
|
|
1242
|
-
/* @__PURE__ */ (0,
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1243
1144
|
"animate",
|
|
1244
1145
|
{
|
|
1245
1146
|
attributeName: "opacity",
|
|
@@ -1250,7 +1151,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1250
1151
|
repeatCount: "indefinite"
|
|
1251
1152
|
}
|
|
1252
1153
|
) }),
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1254
1155
|
"animate",
|
|
1255
1156
|
{
|
|
1256
1157
|
attributeName: "opacity",
|
|
@@ -1261,7 +1162,7 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1261
1162
|
repeatCount: "indefinite"
|
|
1262
1163
|
}
|
|
1263
1164
|
) }),
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1265
1166
|
"animate",
|
|
1266
1167
|
{
|
|
1267
1168
|
attributeName: "opacity",
|
|
@@ -1279,8 +1180,8 @@ var Spinner = ({ size = "small", testid }) => {
|
|
|
1279
1180
|
Spinner.displayName = "Spinner";
|
|
1280
1181
|
|
|
1281
1182
|
// src/components/Paragraph.tsx
|
|
1282
|
-
var
|
|
1283
|
-
var
|
|
1183
|
+
var import_clsx11 = __toESM(require("clsx"), 1);
|
|
1184
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1284
1185
|
var Paragraph = (_a) => {
|
|
1285
1186
|
var _b = _a, {
|
|
1286
1187
|
className,
|
|
@@ -1306,13 +1207,13 @@ var Paragraph = (_a) => {
|
|
|
1306
1207
|
"testid"
|
|
1307
1208
|
]);
|
|
1308
1209
|
const Element = as;
|
|
1309
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1310
1211
|
Element,
|
|
1311
1212
|
__spreadProps(__spreadValues({
|
|
1312
1213
|
id,
|
|
1313
1214
|
"data-testid": testid
|
|
1314
1215
|
}, props), {
|
|
1315
|
-
className: (0,
|
|
1216
|
+
className: (0, import_clsx11.default)(
|
|
1316
1217
|
typography.paragraph,
|
|
1317
1218
|
className,
|
|
1318
1219
|
padded && componentPaddingXUsingComponentGap,
|
|
@@ -1332,7 +1233,7 @@ var Paragraph = (_a) => {
|
|
|
1332
1233
|
Paragraph.displayName = "Paragraph";
|
|
1333
1234
|
|
|
1334
1235
|
// src/components/PDFViewer.tsx
|
|
1335
|
-
var
|
|
1236
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1336
1237
|
function PDFViewer(props) {
|
|
1337
1238
|
const { isOpen, onClose, encodedPdfs, customActions, testid } = props;
|
|
1338
1239
|
const [currentIndex, setCurrentIndex] = (0, import_react6.useState)(0);
|
|
@@ -1368,14 +1269,14 @@ function PDFViewer(props) {
|
|
|
1368
1269
|
setIsDownloading(false);
|
|
1369
1270
|
onClose();
|
|
1370
1271
|
}
|
|
1371
|
-
return /* @__PURE__ */ (0,
|
|
1272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1372
1273
|
Modal,
|
|
1373
1274
|
{
|
|
1374
1275
|
testid,
|
|
1375
1276
|
open: isOpen,
|
|
1376
1277
|
onClose: handleClose,
|
|
1377
1278
|
showButtons: !!encodedPdfs.length,
|
|
1378
|
-
customActions: !!encodedPdfs.length && /* @__PURE__ */ (0,
|
|
1279
|
+
customActions: !!encodedPdfs.length && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1379
1280
|
PdfNavigation,
|
|
1380
1281
|
{
|
|
1381
1282
|
testid,
|
|
@@ -1392,7 +1293,7 @@ function PDFViewer(props) {
|
|
|
1392
1293
|
size: "large",
|
|
1393
1294
|
fixedHeightScrolling: true,
|
|
1394
1295
|
headerIconAlign: "right",
|
|
1395
|
-
headerIcon: /* @__PURE__ */ (0,
|
|
1296
|
+
headerIcon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1396
1297
|
DownloadIcon,
|
|
1397
1298
|
{
|
|
1398
1299
|
testid: testid ? `${testid}-download-icon` : void 0,
|
|
@@ -1401,10 +1302,7 @@ function PDFViewer(props) {
|
|
|
1401
1302
|
}
|
|
1402
1303
|
),
|
|
1403
1304
|
className: "!max-w-fit",
|
|
1404
|
-
children: /* @__PURE__ */ (0,
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PDFElement, { testid, b64: encodedPdfs[currentIndex].base64 }),
|
|
1406
|
-
!!encodedPdfs[currentIndex].fileName && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Paragraph, { children: encodedPdfs[currentIndex].fileName.endsWith(".pdf") ? encodedPdfs[currentIndex].fileName : `${encodedPdfs[currentIndex].fileName}.pdf` })
|
|
1407
|
-
] })
|
|
1305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Stack, { sizing: "layout", items: "center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PDFElement, { testid, b64: encodedPdfs[currentIndex].base64 }) })
|
|
1408
1306
|
}
|
|
1409
1307
|
);
|
|
1410
1308
|
}
|
|
@@ -1413,28 +1311,36 @@ function DownloadIcon({
|
|
|
1413
1311
|
isDownloading,
|
|
1414
1312
|
testid
|
|
1415
1313
|
}) {
|
|
1416
|
-
return /* @__PURE__ */ (0,
|
|
1314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1417
1315
|
Button,
|
|
1418
1316
|
{
|
|
1419
1317
|
testid,
|
|
1420
1318
|
iconOnly: true,
|
|
1421
1319
|
variant: "tertiary",
|
|
1422
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
1320
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: isDownloading ? "cached" : "download" }),
|
|
1423
1321
|
onClick
|
|
1424
1322
|
}
|
|
1425
1323
|
);
|
|
1426
1324
|
}
|
|
1427
1325
|
function PDFElement({ b64, testid }) {
|
|
1428
|
-
const [page, setPage] = (0, import_react6.useState)(1);
|
|
1429
1326
|
const canvasRef = (0, import_react6.useRef)(null);
|
|
1327
|
+
const [pages, setPages] = (0, import_react6.useState)([]);
|
|
1328
|
+
(0, import_react6.useEffect)(() => {
|
|
1329
|
+
setPages([]);
|
|
1330
|
+
}, [b64]);
|
|
1430
1331
|
const { pdfDocument } = (0, import_react_pdf.usePdf)({
|
|
1431
1332
|
file: `data:application/pdf;base64,${b64}`,
|
|
1432
1333
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
1433
|
-
page,
|
|
1334
|
+
page: 1,
|
|
1434
1335
|
canvasRef,
|
|
1435
|
-
scale: 1.1
|
|
1336
|
+
scale: 1.1,
|
|
1337
|
+
onDocumentLoadSuccess: (pdf) => __async(null, null, function* () {
|
|
1338
|
+
if (pdf.numPages === 1) return;
|
|
1339
|
+
const pages2 = yield renderPages(pdf, testid || "pdf-viewer");
|
|
1340
|
+
setPages(pages2);
|
|
1341
|
+
})
|
|
1436
1342
|
});
|
|
1437
|
-
return /* @__PURE__ */ (0,
|
|
1343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1438
1344
|
"div",
|
|
1439
1345
|
{
|
|
1440
1346
|
className: "flex flex-col space-y-4 ",
|
|
@@ -1442,81 +1348,33 @@ function PDFElement({ b64, testid }) {
|
|
|
1442
1348
|
minHeight: 871,
|
|
1443
1349
|
minWidth: 654
|
|
1444
1350
|
},
|
|
1445
|
-
children: [
|
|
1446
|
-
|
|
1351
|
+
children: !!pdfDocument && !!b64 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Stack, { sizing: "layout-group", children: [
|
|
1352
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex justify-center border border-border-primary-normal", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1447
1353
|
"canvas",
|
|
1448
1354
|
{
|
|
1449
1355
|
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
1450
1356
|
ref: canvasRef
|
|
1451
1357
|
}
|
|
1452
|
-
)
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
justify: "center",
|
|
1456
|
-
items: "center",
|
|
1457
|
-
height: "full",
|
|
1458
|
-
flexGrow: 1,
|
|
1459
|
-
"data-testid": testid ? `${testid}-pdf-loading` : void 0,
|
|
1460
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Spinner, { size: "large" })
|
|
1461
|
-
}
|
|
1462
|
-
),
|
|
1463
|
-
(pdfDocument == null ? void 0 : pdfDocument.numPages) && pdfDocument.numPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1464
|
-
"ul",
|
|
1358
|
+
) }),
|
|
1359
|
+
pages.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1360
|
+
"div",
|
|
1465
1361
|
{
|
|
1466
|
-
className: "flex
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
"data-testid": testid ? `${testid}-pdf-pagination-text` : void 0,
|
|
1483
|
-
className: "text-label-desktop text-text-primary-normal",
|
|
1484
|
-
children: [
|
|
1485
|
-
"Page",
|
|
1486
|
-
" ",
|
|
1487
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1488
|
-
"span",
|
|
1489
|
-
{
|
|
1490
|
-
"data-testid": testid ? `${testid}-pdf-pagination-page-${page}` : void 0,
|
|
1491
|
-
children: page
|
|
1492
|
-
}
|
|
1493
|
-
),
|
|
1494
|
-
" ",
|
|
1495
|
-
"of",
|
|
1496
|
-
" ",
|
|
1497
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1498
|
-
"span",
|
|
1499
|
-
{
|
|
1500
|
-
"data-testid": testid ? `${testid}-pdf-pagination-total-page-${pdfDocument.numPages}` : void 0,
|
|
1501
|
-
children: pdfDocument.numPages
|
|
1502
|
-
}
|
|
1503
|
-
)
|
|
1504
|
-
]
|
|
1505
|
-
}
|
|
1506
|
-
),
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { className: "next", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1508
|
-
"button",
|
|
1509
|
-
{
|
|
1510
|
-
"data-testid": testid ? `${testid}-pdf-pagination-next-button` : void 0,
|
|
1511
|
-
disabled: page === pdfDocument.numPages,
|
|
1512
|
-
onClick: () => setPage(page + 1),
|
|
1513
|
-
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" })
|
|
1514
|
-
}
|
|
1515
|
-
) })
|
|
1516
|
-
]
|
|
1517
|
-
}
|
|
1518
|
-
)
|
|
1519
|
-
]
|
|
1362
|
+
className: "flex justify-center border border-border-primary-normal",
|
|
1363
|
+
children: page
|
|
1364
|
+
},
|
|
1365
|
+
`${testid}-pdf-page-${index}`
|
|
1366
|
+
))
|
|
1367
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1368
|
+
Stack,
|
|
1369
|
+
{
|
|
1370
|
+
justify: "center",
|
|
1371
|
+
items: "center",
|
|
1372
|
+
height: "full",
|
|
1373
|
+
flexGrow: 1,
|
|
1374
|
+
"data-testid": testid ? `${testid}-pdf-loading` : void 0,
|
|
1375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Spinner, { size: "large" })
|
|
1376
|
+
}
|
|
1377
|
+
)
|
|
1520
1378
|
}
|
|
1521
1379
|
);
|
|
1522
1380
|
}
|
|
@@ -1531,7 +1389,7 @@ function PdfNavigation({
|
|
|
1531
1389
|
testid,
|
|
1532
1390
|
fileName
|
|
1533
1391
|
}) {
|
|
1534
|
-
return /* @__PURE__ */ (0,
|
|
1392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1535
1393
|
Stack,
|
|
1536
1394
|
{
|
|
1537
1395
|
horizontal: true,
|
|
@@ -1540,41 +1398,70 @@ function PdfNavigation({
|
|
|
1540
1398
|
sizing: "layout-group",
|
|
1541
1399
|
testid: testid ? `${testid}-pdf-navigation` : void 0,
|
|
1542
1400
|
children: [
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Stack, { horizontal: true, items: "center", children: [
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1545
1403
|
Button,
|
|
1546
1404
|
{
|
|
1547
1405
|
iconOnly: true,
|
|
1548
1406
|
variant: "tertiary",
|
|
1549
1407
|
onClick: onPrev,
|
|
1550
|
-
leftIcon: /* @__PURE__ */ (0,
|
|
1408
|
+
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "chevron_backward" }),
|
|
1551
1409
|
disabled: disablePrev,
|
|
1552
1410
|
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
1553
1411
|
}
|
|
1554
1412
|
),
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1413
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Heading3, { className: "text-text-primary-normal whitespace-nowrap", children: [
|
|
1556
1414
|
currentIndex + 1,
|
|
1557
1415
|
" / ",
|
|
1558
1416
|
total
|
|
1559
1417
|
] }),
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1561
1419
|
Button,
|
|
1562
1420
|
{
|
|
1563
1421
|
iconOnly: true,
|
|
1564
1422
|
variant: "tertiary",
|
|
1565
1423
|
onClick: onNext,
|
|
1566
|
-
rightIcon: /* @__PURE__ */ (0,
|
|
1424
|
+
rightIcon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "chevron_forward" }),
|
|
1567
1425
|
disabled: disableNext,
|
|
1568
1426
|
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
1569
1427
|
}
|
|
1570
1428
|
),
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Paragraph, { children: (fileName == null ? void 0 : fileName.endsWith(".pdf")) ? fileName : `${fileName}.pdf` })
|
|
1572
1430
|
] }),
|
|
1573
|
-
extraActions && /* @__PURE__ */ (0,
|
|
1431
|
+
extraActions && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-2", children: extraActions })
|
|
1574
1432
|
]
|
|
1575
1433
|
}
|
|
1576
1434
|
) });
|
|
1577
1435
|
}
|
|
1436
|
+
function renderPages(pdf, testid) {
|
|
1437
|
+
const pagesPromises = Array.from(
|
|
1438
|
+
// Skip the first page as it is already rendered
|
|
1439
|
+
{ length: pdf.numPages - 1 },
|
|
1440
|
+
(_, i) => __async(null, null, function* () {
|
|
1441
|
+
const page = yield pdf.getPage(i + 2);
|
|
1442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1443
|
+
"canvas",
|
|
1444
|
+
{
|
|
1445
|
+
ref: (el) => {
|
|
1446
|
+
if (el) {
|
|
1447
|
+
const ctx = el.getContext("2d");
|
|
1448
|
+
el.width = page.getViewport({ scale: 1.1 }).width;
|
|
1449
|
+
el.height = page.getViewport({ scale: 1.1 }).height;
|
|
1450
|
+
if (ctx) {
|
|
1451
|
+
page.render({
|
|
1452
|
+
canvasContext: ctx,
|
|
1453
|
+
viewport: page.getViewport({ scale: 1.1 })
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
`${testid}-pdf_page_${page.pageNumber}`
|
|
1460
|
+
);
|
|
1461
|
+
})
|
|
1462
|
+
);
|
|
1463
|
+
return Promise.all(pagesPromises);
|
|
1464
|
+
}
|
|
1578
1465
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1579
1466
|
0 && (module.exports = {
|
|
1580
1467
|
PDFViewer
|