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