optimized-react-component-library-xyz123 3.2.0 → 3.2.1
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/index.d.mts +1713 -20
- package/dist/index.d.ts +1713 -20
- package/dist/index.js +86 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -16
package/dist/index.js
CHANGED
|
@@ -710,7 +710,7 @@ var ExploreFiles = ({
|
|
|
710
710
|
var _a;
|
|
711
711
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
712
712
|
};
|
|
713
|
-
|
|
713
|
+
const addFilesInfoText = numberOfFiles > 0 ? activatedLanguage === "sv" ? `${numberOfFiles} filer valda (max ${allowedNumberOfFiles})` : `${numberOfFiles} files chosed (max ${allowedNumberOfFiles})` : activatedLanguage === "sv" ? "Ingen fil vald" : "No file chosen";
|
|
714
714
|
const ariaLabelText = `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`;
|
|
715
715
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "inputContainer", children: [
|
|
716
716
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -768,7 +768,7 @@ var ExploreFiles = ({
|
|
|
768
768
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
769
769
|
|
|
770
770
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
771
|
-
var import_react8 =
|
|
771
|
+
var import_react8 = require("react");
|
|
772
772
|
var import_react_bootstrap = require("react-bootstrap");
|
|
773
773
|
|
|
774
774
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
@@ -798,7 +798,7 @@ var SelectedFiles = ({
|
|
|
798
798
|
}) => {
|
|
799
799
|
const theDiv = (0, import_react8.useRef)(null);
|
|
800
800
|
const remove = (file) => {
|
|
801
|
-
|
|
801
|
+
const newFiles = questionObject.files.filter((f) => f !== file);
|
|
802
802
|
const newCountOfFiles = newFiles.length;
|
|
803
803
|
setNumberOfFiles(newCountOfFiles);
|
|
804
804
|
let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
|
|
@@ -832,7 +832,7 @@ var SelectedFiles = ({
|
|
|
832
832
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
833
833
|
const fileType = errorObj.FileName.split(".").pop();
|
|
834
834
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
835
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileInList", children: [
|
|
836
836
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
837
837
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
838
838
|
import_react_bootstrap.Col,
|
|
@@ -846,7 +846,7 @@ var SelectedFiles = ({
|
|
|
846
846
|
children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
|
|
847
847
|
}
|
|
848
848
|
) })
|
|
849
|
-
] }
|
|
849
|
+
] }) }) }) }) }, `error-${errorObj.FileName}-${index}`);
|
|
850
850
|
})
|
|
851
851
|
] }) }),
|
|
852
852
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "addFile-error-close-button", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -879,60 +879,67 @@ var SelectedFiles = ({
|
|
|
879
879
|
}
|
|
880
880
|
) })
|
|
881
881
|
] }) }),
|
|
882
|
-
questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
fill: "none",
|
|
898
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
899
|
-
"path",
|
|
882
|
+
questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
883
|
+
"ul",
|
|
884
|
+
{
|
|
885
|
+
className: "fileListUnorderedList",
|
|
886
|
+
"aria-label": activatedLanguage === "en" ? "Uploaded files" : "Uppladdade filer",
|
|
887
|
+
children: questionObject.files.map((file, index) => {
|
|
888
|
+
const indicatorfileName = file.FileName;
|
|
889
|
+
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
890
|
+
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
891
|
+
const fileType = file.FileName.split(".").pop();
|
|
892
|
+
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileInList", children: [
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fileItem", children: [
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
896
|
+
"svg",
|
|
900
897
|
{
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
898
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
899
|
+
width: "8",
|
|
900
|
+
height: "8",
|
|
901
|
+
viewBox: "0 0 8 8",
|
|
902
|
+
fill: "none",
|
|
903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
904
|
+
"path",
|
|
905
|
+
{
|
|
906
|
+
d: "M1 4.65913L2.8 6.45913L7 1.35913",
|
|
907
|
+
stroke: "white",
|
|
908
|
+
strokeWidth: "1.5",
|
|
909
|
+
strokeLinecap: "round"
|
|
910
|
+
}
|
|
911
|
+
)
|
|
905
912
|
}
|
|
906
|
-
)
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
913
|
+
) }) }),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "mobileFirstFileName", children: [
|
|
915
|
+
mobileFirstFileName,
|
|
916
|
+
" (",
|
|
917
|
+
Math.ceil(file.FileSize / (1024 * 1024)),
|
|
918
|
+
" ",
|
|
919
|
+
"MB)"
|
|
920
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "desktopFileName", children: [
|
|
921
|
+
file.FileName,
|
|
922
|
+
" (",
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "fileSizeText", children: file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(1)} MB` }),
|
|
924
|
+
" ",
|
|
925
|
+
")"
|
|
926
|
+
] }) }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { className: "lastCol", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
928
|
+
"button",
|
|
929
|
+
{
|
|
930
|
+
className: "selectedFilesLinkButton",
|
|
931
|
+
onClick: () => remove(file),
|
|
932
|
+
"aria-label": activatedLanguage === "sv" ? `Radera ${indicatorfileName}` : `Delete ${indicatorfileName}`,
|
|
933
|
+
children: activatedLanguage === "sv" ? "Radera" : "Delete"
|
|
934
|
+
}
|
|
935
|
+
) })
|
|
936
|
+
] }),
|
|
937
|
+
showIndicator && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { style: { width: "100%", padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IndicatorStandard_default, { filename: indicatorfileName }) }) }),
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap.Col, { className: "makeSpace" }) })
|
|
939
|
+
] }, index) }) }) }) }, `file-${file.FileName}-${index}`);
|
|
940
|
+
})
|
|
941
|
+
}
|
|
942
|
+
),
|
|
936
943
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref: theDiv, className: "pts-clipboard-container" })
|
|
937
944
|
] });
|
|
938
945
|
};
|
|
@@ -1103,7 +1110,7 @@ var AddFiles = ({
|
|
|
1103
1110
|
setNumberOfFiles(newCount);
|
|
1104
1111
|
};
|
|
1105
1112
|
const removeOneError = (errorIndex) => {
|
|
1106
|
-
|
|
1113
|
+
const newErrors = errorMessageAddingFile.filter((e, index) => index !== errorIndex);
|
|
1107
1114
|
setErrorMessageAddingFile(newErrors);
|
|
1108
1115
|
};
|
|
1109
1116
|
const removeError = () => {
|
|
@@ -1229,7 +1236,7 @@ var SingleCheckbox = ({
|
|
|
1229
1236
|
}, [question.answer]);
|
|
1230
1237
|
const handleInputChange = (event) => {
|
|
1231
1238
|
setChecked(event.target.checked);
|
|
1232
|
-
|
|
1239
|
+
const answer = event.target.checked ? "true" : "false";
|
|
1233
1240
|
const e = { target: { value: answer } };
|
|
1234
1241
|
handleQuestionInputChange(e, question);
|
|
1235
1242
|
};
|
|
@@ -2282,7 +2289,7 @@ var RadioWithInfo = ({
|
|
|
2282
2289
|
children: [
|
|
2283
2290
|
groupedOptionArray.map((group, g_index) => {
|
|
2284
2291
|
var _a2;
|
|
2285
|
-
|
|
2292
|
+
const subId = "subheading-" + g_index;
|
|
2286
2293
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react13.default.Fragment, { children: [
|
|
2287
2294
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2288
2295
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
@@ -2302,7 +2309,8 @@ var RadioWithInfo = ({
|
|
|
2302
2309
|
questionIsMandatory: (_c2 = question.isQuestionMandatory) != null ? _c2 : false,
|
|
2303
2310
|
optionText: (_e = (_d = group.items.find((optionInfo) => optionInfo.value === option.value)) == null ? void 0 : _d.info) != null ? _e : "",
|
|
2304
2311
|
activatedLanguage
|
|
2305
|
-
}
|
|
2312
|
+
},
|
|
2313
|
+
questionId + groupId + index
|
|
2306
2314
|
);
|
|
2307
2315
|
}) })
|
|
2308
2316
|
] }, subId);
|
|
@@ -3342,6 +3350,13 @@ var QuestionGroup = ({
|
|
|
3342
3350
|
markQuestionAsDisplayed
|
|
3343
3351
|
}) => {
|
|
3344
3352
|
var _a, _b, _c;
|
|
3353
|
+
(0, import_react17.useEffect)(() => {
|
|
3354
|
+
questions.forEach((question) => {
|
|
3355
|
+
if (question.visible && !question.isDisplayed) {
|
|
3356
|
+
markQuestionAsDisplayed(question);
|
|
3357
|
+
}
|
|
3358
|
+
});
|
|
3359
|
+
}, [questions]);
|
|
3345
3360
|
if (!questions || questions.length === 0) {
|
|
3346
3361
|
return null;
|
|
3347
3362
|
}
|
|
@@ -3350,13 +3365,6 @@ var QuestionGroup = ({
|
|
|
3350
3365
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3351
3366
|
(e) => e.startsWith("groupCheck-")
|
|
3352
3367
|
);
|
|
3353
|
-
(0, import_react17.useEffect)(() => {
|
|
3354
|
-
questions.forEach((question) => {
|
|
3355
|
-
if (question.visible && !question.isDisplayed) {
|
|
3356
|
-
markQuestionAsDisplayed(question);
|
|
3357
|
-
}
|
|
3358
|
-
});
|
|
3359
|
-
}, [questions]);
|
|
3360
3368
|
const groupQuestions = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: questions.map((question, index) => {
|
|
3361
3369
|
var _a2;
|
|
3362
3370
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -4041,7 +4049,7 @@ var Navigation = ({
|
|
|
4041
4049
|
activatedLanguage = "sv",
|
|
4042
4050
|
menuLinks = [],
|
|
4043
4051
|
openButtonRef = null,
|
|
4044
|
-
linkComponent: LinkComponent =
|
|
4052
|
+
linkComponent: LinkComponent = "a",
|
|
4045
4053
|
navigationCloseFocusId,
|
|
4046
4054
|
activePath = null
|
|
4047
4055
|
}) => {
|
|
@@ -4055,7 +4063,11 @@ var Navigation = ({
|
|
|
4055
4063
|
const handleMenuClick = (typeOfInteraction) => {
|
|
4056
4064
|
var _a, _b;
|
|
4057
4065
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
4058
|
-
typeOfInteraction === "close"
|
|
4066
|
+
if (typeOfInteraction === "close") {
|
|
4067
|
+
(_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus();
|
|
4068
|
+
} else if (navigationCloseFocusId) {
|
|
4069
|
+
(_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus();
|
|
4070
|
+
}
|
|
4059
4071
|
};
|
|
4060
4072
|
(0, import_react18.useEffect)(() => {
|
|
4061
4073
|
var _a, _b;
|
|
@@ -4269,7 +4281,7 @@ var NavigationHeader = ({
|
|
|
4269
4281
|
menuLinks = void 0,
|
|
4270
4282
|
SetActivatedLanguage = () => {
|
|
4271
4283
|
},
|
|
4272
|
-
linkComponent: LinkComponent =
|
|
4284
|
+
linkComponent: LinkComponent = "a",
|
|
4273
4285
|
noLogoLink = false,
|
|
4274
4286
|
navigationCloseFocusId,
|
|
4275
4287
|
activePath = null
|
|
@@ -4474,7 +4486,6 @@ var LinkStandard = ({
|
|
|
4474
4486
|
}) => {
|
|
4475
4487
|
let iconClass = "";
|
|
4476
4488
|
const excelExtensions = ["xls", "xlsx", "xlsm", "xlsb", "xltx", "xltm", "xlam", "csv"];
|
|
4477
|
-
let linkTitle = title;
|
|
4478
4489
|
const getFileExtension = (url2) => {
|
|
4479
4490
|
const match = url2.match(/\.([a-zA-Z0-9]+)(?=$|\?|#)/);
|
|
4480
4491
|
return match ? match[1] : null;
|
|
@@ -4496,7 +4507,7 @@ var LinkStandard = ({
|
|
|
4496
4507
|
}
|
|
4497
4508
|
}
|
|
4498
4509
|
}
|
|
4499
|
-
linkTitle = fileExtension !== null ? `${title} (${fileExtension})` : title;
|
|
4510
|
+
const linkTitle = fileExtension !== null ? `${title} (${fileExtension})` : title;
|
|
4500
4511
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pts-standard-link", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
4501
4512
|
LinkComponent,
|
|
4502
4513
|
{
|
|
@@ -4554,7 +4565,8 @@ var Collapse = ({
|
|
|
4554
4565
|
customClass = ""
|
|
4555
4566
|
}) => {
|
|
4556
4567
|
const [isOpen, setIsOpen] = (0, import_react22.useState)(defaultOpen);
|
|
4557
|
-
const
|
|
4568
|
+
const generatedId = (0, import_react22.useId)();
|
|
4569
|
+
const uniqueId = id != null ? id : generatedId;
|
|
4558
4570
|
const contentId = `${uniqueId}-content`;
|
|
4559
4571
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
4560
4572
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj" : "Hide";
|