optimized-react-component-library-xyz123 0.1.92 → 0.1.94
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 +226 -1
- package/dist/index.d.ts +226 -1
- package/dist/index.js +352 -76
- package/dist/index.mjs +350 -75
- package/package.json +2 -1
- package/src/css/styles.css +21 -69
package/dist/index.js
CHANGED
|
@@ -59,7 +59,11 @@ __export(index_exports, {
|
|
|
59
59
|
TextFieldStandard: () => TextFieldStandard_default,
|
|
60
60
|
TextHeadlineAndBodyStandard: () => TextHeadlineAndBodyStandard_default,
|
|
61
61
|
ValidationCheckAllVisibleQuestion: () => ValidationCheckAllVisibleQuestion_default,
|
|
62
|
-
ValidationErrorSummaryList: () => ValidationErrorSummaryList_default
|
|
62
|
+
ValidationErrorSummaryList: () => ValidationErrorSummaryList_default,
|
|
63
|
+
createLanguageSlice: () => createLanguageSlice,
|
|
64
|
+
createQuestionsSlice: () => createQuestionsSlice,
|
|
65
|
+
makeLanguageSelectors: () => makeLanguageSelectors,
|
|
66
|
+
makeQuestionsSelectors: () => makeQuestionsSelectors
|
|
63
67
|
});
|
|
64
68
|
module.exports = __toCommonJS(index_exports);
|
|
65
69
|
|
|
@@ -758,12 +762,12 @@ var FilesUploadStandard_default = FilesUpload;
|
|
|
758
762
|
|
|
759
763
|
// src/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.tsx
|
|
760
764
|
var import_react7 = require("react");
|
|
761
|
-
var
|
|
765
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
762
766
|
|
|
763
767
|
// src/NewInputComponentStandard/AddFilesStandard/DropFilesStandard.tsx
|
|
764
768
|
var import_react_dropzone = require("react-dropzone");
|
|
765
769
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
766
|
-
var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r"
|
|
770
|
+
var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r" }) => {
|
|
767
771
|
const onDrop = FilesSelected;
|
|
768
772
|
const { getRootProps, getInputProps, isDragActive } = (0, import_react_dropzone.useDropzone)({ onDrop, noKeyboard: true });
|
|
769
773
|
const handleFileExplorer = (event) => {
|
|
@@ -784,22 +788,34 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
784
788
|
}
|
|
785
789
|
)
|
|
786
790
|
] }),
|
|
787
|
-
isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { className: "dropFilesNowText", children:
|
|
788
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
791
|
+
isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { className: "dropFilesNowText", children: "Sl\xE4pp filerna, nu ...!" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
789
793
|
"svg",
|
|
790
794
|
{
|
|
795
|
+
"aria-hidden": "true",
|
|
791
796
|
xmlns: "http://www.w3.org/2000/svg",
|
|
792
|
-
width: "
|
|
793
|
-
height: "
|
|
794
|
-
viewBox: "0 0
|
|
795
|
-
fill: "
|
|
796
|
-
children:
|
|
797
|
-
"
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
797
|
+
width: "72",
|
|
798
|
+
height: "48",
|
|
799
|
+
viewBox: "0 0 72 48",
|
|
800
|
+
fill: "none",
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("g", { clipPath: "url(#clip0_247_596)", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
803
|
+
"path",
|
|
804
|
+
{
|
|
805
|
+
d: "M66.6084 23.0844C64.6397 21.6247 62.2209 20.5531 59.6672 19.9752C59.2479 19.8808 58.8641 19.6692 58.5605 19.3649C58.257 19.0606 58.0463 18.6763 57.953 18.2567C56.8561 13.37 54.495 9.1794 51.0244 6.00409C46.9898 2.30706 41.6545 0.273621 36 0.273621C31.0289 0.273621 26.4375 1.83174 22.7292 4.78065C20.216 6.78238 18.193 9.33154 16.8145 12.2338C16.6651 12.5513 16.4434 12.8295 16.1672 13.0461C15.8911 13.2627 15.5681 13.4117 15.2241 13.4811C11.4623 14.2405 8.06625 15.8535 5.47312 18.1386C1.89281 21.3027 0 25.5088 0 30.3111C0 35.1655 2.03766 39.5924 5.73609 42.793C9.26859 45.8431 14.0245 47.5236 19.125 47.5236H33.75V25.956L28.5905 31.1155C28.3751 31.3309 28.1182 31.5003 27.8354 31.6134C27.5525 31.7266 27.2497 31.7811 26.9452 31.7738C26.6406 31.7664 26.3408 31.6973 26.0638 31.5706C25.7867 31.4439 25.5383 31.2623 25.3336 31.0367C24.518 30.141 24.5967 28.7446 25.4531 27.8881L34.4095 18.9331C34.8314 18.5115 35.4035 18.2747 36 18.2747C36.5965 18.2747 37.1686 18.5115 37.5905 18.9331L46.5469 27.8853C47.43 28.7699 47.4806 30.2197 46.6017 31.107C46.3932 31.3176 46.1451 31.485 45.8718 31.5994C45.5984 31.7139 45.3051 31.7732 45.0088 31.774C44.7124 31.7748 44.4188 31.717 44.1449 31.604C43.8709 31.491 43.622 31.325 43.4123 31.1155L38.25 25.956V47.5236H55.6875C60.0947 47.5236 64.1124 46.2861 67.0008 44.0403C70.2717 41.495 72 37.8528 72 33.5174C72 29.3071 70.1353 25.6972 66.6084 23.0844Z",
|
|
806
|
+
fill: "#6E3282"
|
|
807
|
+
}
|
|
808
|
+
) }),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("clipPath", { id: "clip0_247_596", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
810
|
+
"rect",
|
|
811
|
+
{
|
|
812
|
+
width: "72",
|
|
813
|
+
height: "47.1064",
|
|
814
|
+
fill: "white",
|
|
815
|
+
transform: "translate(0 0.446777)"
|
|
816
|
+
}
|
|
817
|
+
) }) })
|
|
818
|
+
]
|
|
803
819
|
}
|
|
804
820
|
),
|
|
805
821
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "dropFilesText", children: DropFilesText })
|
|
@@ -935,6 +951,7 @@ var Indicator = (filename) => {
|
|
|
935
951
|
var IndicatorStandard_default = Indicator;
|
|
936
952
|
|
|
937
953
|
// src/NewInputComponentStandard/AddFilesStandard/SelectedFilesStandard.tsx
|
|
954
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
938
955
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
939
956
|
var SelectedFiles = ({
|
|
940
957
|
questionObject,
|
|
@@ -976,57 +993,53 @@ var SelectedFiles = ({
|
|
|
976
993
|
};
|
|
977
994
|
const windowWidth = useWindowWidth();
|
|
978
995
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
979
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
980
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
"
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
children: activatedLanguage === "sv" ? "St\xE4ng" : "Close"
|
|
1027
|
-
}
|
|
1028
|
-
) })
|
|
1029
|
-
] }) }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
997
|
+
errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { "aria-hidden": true, className: "fileListUnorderedList", children: [
|
|
998
|
+
" ",
|
|
999
|
+
errorMessageAddingFile.map((errorObj, index) => {
|
|
1000
|
+
const errorFileName = errorObj.FileName;
|
|
1001
|
+
let mobileFirstFileName = errorObj.FileName.split(".").shift();
|
|
1002
|
+
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
1003
|
+
const fileType = errorObj.FileName.split(".").pop();
|
|
1004
|
+
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
1005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fileInList", children: [
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap.Row, { children: [
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1008
|
+
"span",
|
|
1009
|
+
{
|
|
1010
|
+
"aria-hidden": "true",
|
|
1011
|
+
className: (0, import_clsx4.default)("uploadedDot", "uploadFailed"),
|
|
1012
|
+
children: "!"
|
|
1013
|
+
}
|
|
1014
|
+
) }),
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "lastCol" })
|
|
1017
|
+
] }),
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1019
|
+
import_react_bootstrap.Col,
|
|
1020
|
+
{
|
|
1021
|
+
style: {
|
|
1022
|
+
width: "100%",
|
|
1023
|
+
color: "#8e0039"
|
|
1024
|
+
},
|
|
1025
|
+
className: "errorMessageAddingFile",
|
|
1026
|
+
...activatedLanguage === "sv" ? {
|
|
1027
|
+
"aria-label": `${errorFileName} ${errorObj.svMessage}`
|
|
1028
|
+
} : {
|
|
1029
|
+
"aria-label": `${errorFileName} ${errorObj.enMessage}`
|
|
1030
|
+
},
|
|
1031
|
+
children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
|
|
1032
|
+
}
|
|
1033
|
+
) }),
|
|
1034
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { className: "makeSpace" }) })
|
|
1035
|
+
] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
|
|
1036
|
+
})
|
|
1037
|
+
] }),
|
|
1038
|
+
errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { onClick: removeUploadErrors, className: "errorMessageAddingFile", children: [
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "X" }),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Ta bort felmeddelande f\xF6r uppladdning av filer" })
|
|
1041
|
+
] })
|
|
1042
|
+
] }),
|
|
1030
1043
|
questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
1031
1044
|
const indicatorfileName = file.FileName;
|
|
1032
1045
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
@@ -1034,7 +1047,7 @@ var SelectedFiles = ({
|
|
|
1034
1047
|
const fileType = file.FileName.split(".").pop();
|
|
1035
1048
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
1036
1049
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "fileInList", children: [
|
|
1037
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap.Row, {
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_bootstrap.Row, { children: [
|
|
1038
1051
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1039
1052
|
"svg",
|
|
1040
1053
|
{
|
|
@@ -1248,13 +1261,10 @@ var AddFiles = ({
|
|
|
1248
1261
|
const removeFileFromNumberOfFiles = (newCount) => {
|
|
1249
1262
|
setNumberOfFiles(newCount);
|
|
1250
1263
|
};
|
|
1251
|
-
const
|
|
1264
|
+
const removeError = (errorIndex) => {
|
|
1252
1265
|
let newErrors = errorMessageAddingFile.filter((e, index) => index !== errorIndex);
|
|
1253
1266
|
setErrorMessageAddingFile(newErrors);
|
|
1254
1267
|
};
|
|
1255
|
-
const removeError = () => {
|
|
1256
|
-
setErrorMessageAddingFile([]);
|
|
1257
|
-
};
|
|
1258
1268
|
const handleRemoveErrors = () => {
|
|
1259
1269
|
setErrorMessageAddingFile([]);
|
|
1260
1270
|
};
|
|
@@ -1264,7 +1274,7 @@ var AddFiles = ({
|
|
|
1264
1274
|
"p",
|
|
1265
1275
|
{
|
|
1266
1276
|
id: aboutId,
|
|
1267
|
-
className: (0,
|
|
1277
|
+
className: (0, import_clsx5.default)(
|
|
1268
1278
|
"addFilesMandatory",
|
|
1269
1279
|
questionObject.hasValidationError ? " error" : ""
|
|
1270
1280
|
),
|
|
@@ -1298,7 +1308,7 @@ var AddFiles = ({
|
|
|
1298
1308
|
removeUploadErrors: handleRemoveErrors
|
|
1299
1309
|
}
|
|
1300
1310
|
),
|
|
1301
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropFilesStandard_default, { FilesSelected: onDrop, DropFilesText: dropFilesText
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropFilesStandard_default, { FilesSelected: onDrop, DropFilesText: dropFilesText }),
|
|
1302
1312
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1303
1313
|
SelectedFilesStandard_default,
|
|
1304
1314
|
{
|
|
@@ -1548,6 +1558,268 @@ function groupQuestionsByStepCategoryGroup(questions, steps, validationErrorsLis
|
|
|
1548
1558
|
}
|
|
1549
1559
|
var GroupQuestionsByStepCategoryGroup_default = groupQuestionsByStepCategoryGroup;
|
|
1550
1560
|
|
|
1561
|
+
// src/NewHelpMethodsStandard/ApplicationContentSlice/applicationContentSlice.ts
|
|
1562
|
+
var import_toolkit = require("@reduxjs/toolkit");
|
|
1563
|
+
var pickLang = (cfg, lang) => {
|
|
1564
|
+
var _a;
|
|
1565
|
+
return (_a = cfg.languageSupport.find((l) => l.language === lang)) != null ? _a : cfg.languageSupport[0];
|
|
1566
|
+
};
|
|
1567
|
+
var createLanguageSlice = (initialConfig, options) => {
|
|
1568
|
+
var _a;
|
|
1569
|
+
const name = (_a = options == null ? void 0 : options.name) != null ? _a : "applicationContent";
|
|
1570
|
+
const initialLang = pickLang(initialConfig, initialConfig.activatedLanguage);
|
|
1571
|
+
const initialState = {
|
|
1572
|
+
activatedLanguage: initialConfig.activatedLanguage,
|
|
1573
|
+
languageSupport: initialConfig.languageSupport,
|
|
1574
|
+
languageSupportLoaded: true,
|
|
1575
|
+
backButton: initialLang.backButton,
|
|
1576
|
+
forwardButton: initialLang.forwardButton,
|
|
1577
|
+
sendButton: initialLang.sendButton
|
|
1578
|
+
};
|
|
1579
|
+
const slice = (0, import_toolkit.createSlice)({
|
|
1580
|
+
name,
|
|
1581
|
+
initialState,
|
|
1582
|
+
reducers: {
|
|
1583
|
+
setActivatedLanguage: (state, action) => {
|
|
1584
|
+
state.activatedLanguage = action.payload;
|
|
1585
|
+
const lang = pickLang(
|
|
1586
|
+
{ activatedLanguage: state.activatedLanguage, languageSupport: state.languageSupport },
|
|
1587
|
+
action.payload
|
|
1588
|
+
);
|
|
1589
|
+
state.backButton = lang.backButton;
|
|
1590
|
+
state.forwardButton = lang.forwardButton;
|
|
1591
|
+
state.sendButton = lang.sendButton;
|
|
1592
|
+
},
|
|
1593
|
+
setLabelsFromLanguageEntry: (state, action) => {
|
|
1594
|
+
state.backButton = action.payload.backButton;
|
|
1595
|
+
state.forwardButton = action.payload.forwardButton;
|
|
1596
|
+
state.sendButton = action.payload.sendButton;
|
|
1597
|
+
},
|
|
1598
|
+
replaceLanguageSupport: (state, action) => {
|
|
1599
|
+
state.languageSupport = action.payload.languageSupport;
|
|
1600
|
+
state.activatedLanguage = action.payload.activatedLanguage;
|
|
1601
|
+
const lang = pickLang(action.payload, action.payload.activatedLanguage);
|
|
1602
|
+
state.backButton = lang.backButton;
|
|
1603
|
+
state.forwardButton = lang.forwardButton;
|
|
1604
|
+
state.sendButton = lang.sendButton;
|
|
1605
|
+
state.languageSupportLoaded = true;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
return slice;
|
|
1610
|
+
};
|
|
1611
|
+
var makeLanguageSelectors = (selectSlice) => {
|
|
1612
|
+
const selectState = selectSlice;
|
|
1613
|
+
const selectActivatedLanguage = (state) => selectState(state).activatedLanguage;
|
|
1614
|
+
const selectLanguageSupportLoaded = (state) => selectState(state).languageSupportLoaded;
|
|
1615
|
+
const selectLanguageSupport = (state) => selectState(state).languageSupport;
|
|
1616
|
+
const selectOverallContentState = (state) => selectState(state);
|
|
1617
|
+
const selectOverallContentFromLanguageSupport = (0, import_toolkit.createSelector)(
|
|
1618
|
+
[selectState, (_, activatedLanguage) => activatedLanguage],
|
|
1619
|
+
(applicationContent, activatedLanguage) => {
|
|
1620
|
+
const match = applicationContent.languageSupport.find(
|
|
1621
|
+
(l) => l.language === activatedLanguage
|
|
1622
|
+
);
|
|
1623
|
+
if (!match) return { ...applicationContent };
|
|
1624
|
+
return {
|
|
1625
|
+
...applicationContent,
|
|
1626
|
+
backButton: match.backButton,
|
|
1627
|
+
forwardButton: match.forwardButton,
|
|
1628
|
+
sendButton: match.sendButton
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
);
|
|
1632
|
+
return {
|
|
1633
|
+
selectActivatedLanguage,
|
|
1634
|
+
selectLanguageSupportLoaded,
|
|
1635
|
+
selectLanguageSupport,
|
|
1636
|
+
selectOverallContentState,
|
|
1637
|
+
selectOverallContentFromLanguageSupport
|
|
1638
|
+
};
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
// src/NewHelpMethodsStandard/QuestionSlice/questionSlice.ts
|
|
1642
|
+
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
1643
|
+
var createQuestionsSlice = (initialState, options) => {
|
|
1644
|
+
var _a;
|
|
1645
|
+
const slice = (0, import_toolkit2.createSlice)({
|
|
1646
|
+
name: (_a = options == null ? void 0 : options.name) != null ? _a : "Form",
|
|
1647
|
+
initialState,
|
|
1648
|
+
reducers: {
|
|
1649
|
+
AddApplicationContentFromLanguageSupport: (state, action) => {
|
|
1650
|
+
state.applicationContent = action.payload;
|
|
1651
|
+
state.questionsLoaded = true;
|
|
1652
|
+
},
|
|
1653
|
+
AddStepsFromLanguageSupport: (state, action) => {
|
|
1654
|
+
state.steps = action.payload;
|
|
1655
|
+
},
|
|
1656
|
+
AddQuestionsFromLanguageSupport: (state, action) => {
|
|
1657
|
+
state.questions = action.payload;
|
|
1658
|
+
},
|
|
1659
|
+
AddAnswer: (state, action) => {
|
|
1660
|
+
state.questions = state.questions.map((qObject) => {
|
|
1661
|
+
if (qObject.id === action.payload.id) {
|
|
1662
|
+
return {
|
|
1663
|
+
...qObject,
|
|
1664
|
+
answer: action.payload.answer
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
return qObject;
|
|
1668
|
+
});
|
|
1669
|
+
},
|
|
1670
|
+
AddFiles: (state, action) => {
|
|
1671
|
+
state.questions = state.questions.map((qObject) => {
|
|
1672
|
+
if (qObject.id === action.payload.id) {
|
|
1673
|
+
return {
|
|
1674
|
+
...qObject,
|
|
1675
|
+
files: action.payload.files
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
return qObject;
|
|
1679
|
+
});
|
|
1680
|
+
},
|
|
1681
|
+
RemoveAllQuestionsDisplayedInStep: (state, action) => {
|
|
1682
|
+
const { activeStep } = action.payload;
|
|
1683
|
+
state.questions = state.questions.map((qObject) => {
|
|
1684
|
+
if (qObject.step >= activeStep) {
|
|
1685
|
+
return {
|
|
1686
|
+
...qObject,
|
|
1687
|
+
isDisplayed: false
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
return qObject;
|
|
1691
|
+
});
|
|
1692
|
+
},
|
|
1693
|
+
AddQuestionDisplayed: (state, action) => {
|
|
1694
|
+
state.questions = state.questions.map((qObject) => {
|
|
1695
|
+
if (qObject.id === action.payload.id) {
|
|
1696
|
+
return {
|
|
1697
|
+
...qObject,
|
|
1698
|
+
isDisplayed: action.payload.isDisplayed
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
return qObject;
|
|
1702
|
+
});
|
|
1703
|
+
},
|
|
1704
|
+
RemoveAllAnswersForward: (state, action) => {
|
|
1705
|
+
state.questions = state.questions.map((qObject) => {
|
|
1706
|
+
let questionExistInLinkedToQuestion = false;
|
|
1707
|
+
if (qObject.dependsOnOtherQuestion !== void 0) {
|
|
1708
|
+
questionExistInLinkedToQuestion = qObject.dependsOnOtherQuestion.some(
|
|
1709
|
+
(innerArray) => innerArray.some((item) => item.LinkedToQuestionId === action.payload.id)
|
|
1710
|
+
);
|
|
1711
|
+
}
|
|
1712
|
+
const shouldClear = qObject.id > action.payload.id && !qObject.isDisplayed && qObject.dependsOnOtherQuestion !== void 0 && questionExistInLinkedToQuestion;
|
|
1713
|
+
if (shouldClear) {
|
|
1714
|
+
return {
|
|
1715
|
+
...qObject,
|
|
1716
|
+
answer: ""
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
return qObject;
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
extraReducers: (builder) => {
|
|
1724
|
+
if (options == null ? void 0 : options.extraReducers) {
|
|
1725
|
+
options.extraReducers(builder);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
return slice;
|
|
1730
|
+
};
|
|
1731
|
+
var makeQuestionsSelectors = (selectSlice) => {
|
|
1732
|
+
const selectStateQuestion = (state) => selectSlice(state);
|
|
1733
|
+
const selectIsQuestionLoaded = (state) => selectSlice(state).questionsLoaded;
|
|
1734
|
+
const selectApplicationContentFromLanguageSupport = (0, import_toolkit2.createSelector)(
|
|
1735
|
+
[
|
|
1736
|
+
(state) => selectSlice(state).applicationContent,
|
|
1737
|
+
(_, activatedLanguage) => activatedLanguage
|
|
1738
|
+
],
|
|
1739
|
+
(applicationContent, activatedLanguage) => {
|
|
1740
|
+
var _a;
|
|
1741
|
+
const languageSupport = (_a = applicationContent == null ? void 0 : applicationContent.languageSupport) == null ? void 0 : _a.find(
|
|
1742
|
+
(lang) => lang.language === activatedLanguage
|
|
1743
|
+
);
|
|
1744
|
+
if (!languageSupport) {
|
|
1745
|
+
return {
|
|
1746
|
+
mainHeadline: "",
|
|
1747
|
+
ingressBody: "",
|
|
1748
|
+
linksForMoreInfo: [],
|
|
1749
|
+
pageTitle: "",
|
|
1750
|
+
textblocks: []
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
return {
|
|
1754
|
+
mainHeadline: languageSupport.mainHeadline,
|
|
1755
|
+
ingressBody: languageSupport.ingressBody,
|
|
1756
|
+
linksForMoreInfo: languageSupport.linksForMoreInfo,
|
|
1757
|
+
pageTitle: languageSupport.pageTitle,
|
|
1758
|
+
textblocks: languageSupport.textblocks,
|
|
1759
|
+
languageSupport: applicationContent == null ? void 0 : applicationContent.languageSupport
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
const selectStepFromLanguageSupport = (0, import_toolkit2.createSelector)(
|
|
1764
|
+
[
|
|
1765
|
+
(state) => selectSlice(state).steps,
|
|
1766
|
+
(_, activatedLanguage) => activatedLanguage
|
|
1767
|
+
],
|
|
1768
|
+
(steps, activatedLanguage) => {
|
|
1769
|
+
return steps.map((stepperObject) => {
|
|
1770
|
+
let languageSupport = stepperObject.languageSupport.find(
|
|
1771
|
+
(lang) => lang.language === activatedLanguage
|
|
1772
|
+
);
|
|
1773
|
+
if (!languageSupport) {
|
|
1774
|
+
languageSupport = {};
|
|
1775
|
+
}
|
|
1776
|
+
return {
|
|
1777
|
+
...stepperObject,
|
|
1778
|
+
stepHeadline: languageSupport.stepHeadline,
|
|
1779
|
+
stepDescription: languageSupport.stepDescription,
|
|
1780
|
+
shortNameInStepper: languageSupport.shortNameInStepper,
|
|
1781
|
+
shortNameInPreview: languageSupport.shortNameInPreview,
|
|
1782
|
+
pageTitle: languageSupport.pageTitle
|
|
1783
|
+
};
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
const selectQuestionFromLanguageSupport = (0, import_toolkit2.createSelector)(
|
|
1788
|
+
[
|
|
1789
|
+
(state) => selectSlice(state).questions,
|
|
1790
|
+
(_, activatedLanguage) => activatedLanguage
|
|
1791
|
+
],
|
|
1792
|
+
(questions, activatedLanguage) => {
|
|
1793
|
+
return questions.map((qObject) => {
|
|
1794
|
+
let languageSupport = qObject.languageSupport.find(
|
|
1795
|
+
(lang) => lang.language === activatedLanguage
|
|
1796
|
+
);
|
|
1797
|
+
if (!languageSupport) {
|
|
1798
|
+
languageSupport = {};
|
|
1799
|
+
}
|
|
1800
|
+
return {
|
|
1801
|
+
...qObject,
|
|
1802
|
+
categoryLabel: languageSupport.categoryLabel,
|
|
1803
|
+
categoryDescription: languageSupport.categoryDescription,
|
|
1804
|
+
questionLabel: languageSupport.questionLabel,
|
|
1805
|
+
previewLabel: languageSupport.previewLabel,
|
|
1806
|
+
aboutText: languageSupport.aboutText,
|
|
1807
|
+
options: languageSupport.options,
|
|
1808
|
+
validationDefaultMessesege: languageSupport.validationDefaultMessesege,
|
|
1809
|
+
validationSummaryLabel: languageSupport.validationSummaryLabel
|
|
1810
|
+
};
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
);
|
|
1814
|
+
return {
|
|
1815
|
+
selectStateQuestion,
|
|
1816
|
+
selectIsQuestionLoaded,
|
|
1817
|
+
selectApplicationContentFromLanguageSupport,
|
|
1818
|
+
selectStepFromLanguageSupport,
|
|
1819
|
+
selectQuestionFromLanguageSupport
|
|
1820
|
+
};
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1551
1823
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
1552
1824
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1553
1825
|
var RenderQuestion = ({
|
|
@@ -1643,7 +1915,7 @@ var RenderQuestionGroup = ({
|
|
|
1643
1915
|
"aria-describedby": questionArray[0].hasValidationError ? `${questionArray[0].id}-error` : void 0,
|
|
1644
1916
|
children: [
|
|
1645
1917
|
legend && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("legend", { children: [
|
|
1646
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: legend }),
|
|
1647
1919
|
questionArray[0].hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "sr-only", children: [
|
|
1648
1920
|
"Valideringsfel. ",
|
|
1649
1921
|
questionArray[0].validationDefaultMessesege
|
|
@@ -2837,5 +3109,9 @@ var CookieBanner_default = CookieBanner;
|
|
|
2837
3109
|
TextFieldStandard,
|
|
2838
3110
|
TextHeadlineAndBodyStandard,
|
|
2839
3111
|
ValidationCheckAllVisibleQuestion,
|
|
2840
|
-
ValidationErrorSummaryList
|
|
3112
|
+
ValidationErrorSummaryList,
|
|
3113
|
+
createLanguageSlice,
|
|
3114
|
+
createQuestionsSlice,
|
|
3115
|
+
makeLanguageSelectors,
|
|
3116
|
+
makeQuestionsSelectors
|
|
2841
3117
|
});
|