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.mjs CHANGED
@@ -693,12 +693,12 @@ var FilesUploadStandard_default = FilesUpload;
693
693
 
694
694
  // src/NewInputComponentStandard/AddFilesStandard/AddFilesStandard.tsx
695
695
  import { useCallback, useEffect as useEffect5, useState as useState5 } from "react";
696
- import clsx4 from "clsx";
696
+ import clsx5 from "clsx";
697
697
 
698
698
  // src/NewInputComponentStandard/AddFilesStandard/DropFilesStandard.tsx
699
699
  import { useDropzone } from "react-dropzone";
700
700
  import { Fragment as Fragment6, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
701
- var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r", language }) => {
701
+ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r" }) => {
702
702
  const onDrop = FilesSelected;
703
703
  const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, noKeyboard: true });
704
704
  const handleFileExplorer = (event) => {
@@ -719,22 +719,34 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
719
719
  }
720
720
  )
721
721
  ] }),
722
- isDragActive ? /* @__PURE__ */ jsx6("b", { className: "dropFilesNowText", children: language === "sv" ? "Sl\xE4pp filerna, nu ...!" : "Drop files here!" }) : /* @__PURE__ */ jsxs6("div", { className: "DropZone-label-container", children: [
723
- /* @__PURE__ */ jsx6(
722
+ isDragActive ? /* @__PURE__ */ jsx6("b", { className: "dropFilesNowText", children: "Sl\xE4pp filerna, nu ...!" }) : /* @__PURE__ */ jsxs6(Fragment6, { children: [
723
+ /* @__PURE__ */ jsxs6(
724
724
  "svg",
725
725
  {
726
+ "aria-hidden": "true",
726
727
  xmlns: "http://www.w3.org/2000/svg",
727
- width: "2.4rem",
728
- height: "2.4rem",
729
- viewBox: "0 0 7 15",
730
- fill: "#fff",
731
- children: /* @__PURE__ */ jsx6(
732
- "path",
733
- {
734
- d: "M0 2.5C0 1.83696 0.263392 1.20107 0.732233 0.732233C1.20107 0.263392 1.83696 0 2.5 0C3.16304 0 3.79893 0.263392 4.26777 0.732233C4.73661 1.20107 5 1.83696 5 2.5V11.5C5 11.8978 4.84196 12.2794 4.56066 12.5607C4.27936 12.842 3.89782 13 3.5 13C3.10218 13 2.72064 12.842 2.43934 12.5607C2.15804 12.2794 2 11.8978 2 11.5V4.5C2 4.36739 2.05268 4.24021 2.14645 4.14645C2.24021 4.05268 2.36739 4 2.5 4C2.63261 4 2.75979 4.05268 2.85355 4.14645C2.94732 4.24021 3 4.36739 3 4.5V11.5C3 11.6326 3.05268 11.7598 3.14645 11.8536C3.24021 11.9473 3.36739 12 3.5 12C3.63261 12 3.75979 11.9473 3.85355 11.8536C3.94732 11.7598 4 11.6326 4 11.5V2.5C4 2.30302 3.9612 2.10796 3.88582 1.92597C3.81044 1.74399 3.69995 1.57863 3.56066 1.43934C3.42137 1.30005 3.25601 1.18956 3.07403 1.11418C2.89204 1.0388 2.69698 1 2.5 1C2.30302 1 2.10796 1.0388 1.92597 1.11418C1.74399 1.18956 1.57863 1.30005 1.43934 1.43934C1.30005 1.57863 1.18956 1.74399 1.11418 1.92597C1.0388 2.10796 1 2.30302 1 2.5V11.5C1 12.163 1.26339 12.7989 1.73223 13.2678C2.20107 13.7366 2.83696 14 3.5 14C4.16304 14 4.79893 13.7366 5.26777 13.2678C5.73661 12.7989 6 12.163 6 11.5V4.5C6 4.36739 6.05268 4.24021 6.14645 4.14645C6.24021 4.05268 6.36739 4 6.5 4C6.63261 4 6.75979 4.05268 6.85355 4.14645C6.94732 4.24021 7 4.36739 7 4.5V11.5C7 12.4283 6.63125 13.3185 5.97487 13.9749C5.3185 14.6313 4.42826 15 3.5 15C2.57174 15 1.6815 14.6313 1.02513 13.9749C0.368749 13.3185 0 12.4283 0 11.5V2.5Z",
735
- fill: "#fff"
736
- }
737
- )
728
+ width: "72",
729
+ height: "48",
730
+ viewBox: "0 0 72 48",
731
+ fill: "none",
732
+ children: [
733
+ /* @__PURE__ */ jsx6("g", { clipPath: "url(#clip0_247_596)", children: /* @__PURE__ */ jsx6(
734
+ "path",
735
+ {
736
+ 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",
737
+ fill: "#6E3282"
738
+ }
739
+ ) }),
740
+ /* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6("clipPath", { id: "clip0_247_596", children: /* @__PURE__ */ jsx6(
741
+ "rect",
742
+ {
743
+ width: "72",
744
+ height: "47.1064",
745
+ fill: "white",
746
+ transform: "translate(0 0.446777)"
747
+ }
748
+ ) }) })
749
+ ]
738
750
  }
739
751
  ),
740
752
  /* @__PURE__ */ jsx6("p", { className: "dropFilesText", children: DropFilesText })
@@ -870,6 +882,7 @@ var Indicator = (filename) => {
870
882
  var IndicatorStandard_default = Indicator;
871
883
 
872
884
  // src/NewInputComponentStandard/AddFilesStandard/SelectedFilesStandard.tsx
885
+ import clsx4 from "clsx";
873
886
  import { Fragment as Fragment10, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
874
887
  var SelectedFiles = ({
875
888
  questionObject,
@@ -911,57 +924,53 @@ var SelectedFiles = ({
911
924
  };
912
925
  const windowWidth = useWindowWidth();
913
926
  return /* @__PURE__ */ jsxs8(Fragment10, { children: [
914
- /* @__PURE__ */ jsx10("div", { children: errorMessageAddingFile.length > 0 && /* @__PURE__ */ jsxs8("div", { className: "pts-errorSummary-container pts-addFile-error-container", children: [
915
- /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "errorDot", children: "!" }),
916
- /* @__PURE__ */ jsx10("div", { className: "addFile-error-list-container", children: /* @__PURE__ */ jsxs8(
917
- "ul",
918
- {
919
- "aria-hidden": true,
920
- className: "fileListUnorderedList",
921
- id: "errorSummary-ul",
922
- children: [
923
- " ",
924
- errorMessageAddingFile.map((errorObj, index) => {
925
- const errorFileName = errorObj.FileName;
926
- let mobileFirstFileName = errorObj.FileName.split(".").shift();
927
- mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
928
- const fileType = errorObj.FileName.split(".").pop();
929
- mobileFirstFileName = mobileFirstFileName + "." + fileType;
930
- return /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(React5.Fragment, { children: /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs8("div", { className: "fileInList", children: [
931
- /* @__PURE__ */ jsx10(Row, { children: /* @__PURE__ */ jsx10(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx10("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx10("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
932
- /* @__PURE__ */ jsx10(Row, { children: /* @__PURE__ */ jsx10(
933
- Col,
934
- {
935
- style: {
936
- width: "100%",
937
- color: "#8e0039"
938
- },
939
- className: "errorMessageAddingFile",
940
- ...activatedLanguage === "sv" ? {
941
- "aria-label": `${errorFileName} ${errorObj.svMessage}`
942
- } : {
943
- "aria-label": `${errorFileName} ${errorObj.enMessage}`
944
- },
945
- children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
946
- }
947
- ) })
948
- ] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
949
- })
950
- ]
951
- }
952
- ) }),
953
- /* @__PURE__ */ jsx10("div", { className: "addFile-error-close-button", children: /* @__PURE__ */ jsx10(
954
- "button",
955
- {
956
- className: "selectedFilesLinkButton error-close",
957
- onClick: () => {
958
- removeError();
959
- },
960
- "aria-label": activatedLanguage === "sv" ? `St\xE4ng felmeddelandet` : `Close error message`,
961
- children: activatedLanguage === "sv" ? "St\xE4ng" : "Close"
962
- }
963
- ) })
964
- ] }) }),
927
+ /* @__PURE__ */ jsxs8("div", { children: [
928
+ errorMessageAddingFile.length > 0 && /* @__PURE__ */ jsxs8("ul", { "aria-hidden": true, className: "fileListUnorderedList", children: [
929
+ " ",
930
+ errorMessageAddingFile.map((errorObj, index) => {
931
+ const errorFileName = errorObj.FileName;
932
+ let mobileFirstFileName = errorObj.FileName.split(".").shift();
933
+ mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
934
+ const fileType = errorObj.FileName.split(".").pop();
935
+ mobileFirstFileName = mobileFirstFileName + "." + fileType;
936
+ return /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(React5.Fragment, { children: /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs8("div", { className: "fileInList", children: [
937
+ /* @__PURE__ */ jsxs8(Row, { children: [
938
+ /* @__PURE__ */ jsx10(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx10(
939
+ "span",
940
+ {
941
+ "aria-hidden": "true",
942
+ className: clsx4("uploadedDot", "uploadFailed"),
943
+ children: "!"
944
+ }
945
+ ) }),
946
+ /* @__PURE__ */ jsx10(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx10("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx10("span", { className: "desktopFileName", children: errorObj.FileName }) }),
947
+ /* @__PURE__ */ jsx10(Col, { className: "lastCol" })
948
+ ] }),
949
+ /* @__PURE__ */ jsx10(Row, { children: /* @__PURE__ */ jsx10(
950
+ Col,
951
+ {
952
+ style: {
953
+ width: "100%",
954
+ color: "#8e0039"
955
+ },
956
+ className: "errorMessageAddingFile",
957
+ ...activatedLanguage === "sv" ? {
958
+ "aria-label": `${errorFileName} ${errorObj.svMessage}`
959
+ } : {
960
+ "aria-label": `${errorFileName} ${errorObj.enMessage}`
961
+ },
962
+ children: activatedLanguage === "sv" ? errorObj.svMessage : errorObj.enMessage
963
+ }
964
+ ) }),
965
+ /* @__PURE__ */ jsx10(Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ jsx10(Col, { className: "makeSpace" }) })
966
+ ] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
967
+ })
968
+ ] }),
969
+ errorMessageAddingFile.length > 0 && /* @__PURE__ */ jsxs8("button", { onClick: removeUploadErrors, className: "errorMessageAddingFile", children: [
970
+ /* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "errorDot", children: "X" }),
971
+ /* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Ta bort felmeddelande f\xF6r uppladdning av filer" })
972
+ ] })
973
+ ] }),
965
974
  questionObject.files.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
966
975
  const indicatorfileName = file.FileName;
967
976
  let mobileFirstFileName = file.FileName.split(".").shift();
@@ -969,7 +978,7 @@ var SelectedFiles = ({
969
978
  const fileType = file.FileName.split(".").pop();
970
979
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
971
980
  return /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(React5.Fragment, { children: /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs8("div", { className: "fileInList", children: [
972
- /* @__PURE__ */ jsxs8(Row, { className: "fileItem", children: [
981
+ /* @__PURE__ */ jsxs8(Row, { children: [
973
982
  /* @__PURE__ */ jsx10(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx10(
974
983
  "svg",
975
984
  {
@@ -1183,13 +1192,10 @@ var AddFiles = ({
1183
1192
  const removeFileFromNumberOfFiles = (newCount) => {
1184
1193
  setNumberOfFiles(newCount);
1185
1194
  };
1186
- const removeOneError = (errorIndex) => {
1195
+ const removeError = (errorIndex) => {
1187
1196
  let newErrors = errorMessageAddingFile.filter((e, index) => index !== errorIndex);
1188
1197
  setErrorMessageAddingFile(newErrors);
1189
1198
  };
1190
- const removeError = () => {
1191
- setErrorMessageAddingFile([]);
1192
- };
1193
1199
  const handleRemoveErrors = () => {
1194
1200
  setErrorMessageAddingFile([]);
1195
1201
  };
@@ -1199,7 +1205,7 @@ var AddFiles = ({
1199
1205
  "p",
1200
1206
  {
1201
1207
  id: aboutId,
1202
- className: clsx4(
1208
+ className: clsx5(
1203
1209
  "addFilesMandatory",
1204
1210
  questionObject.hasValidationError ? " error" : ""
1205
1211
  ),
@@ -1233,7 +1239,7 @@ var AddFiles = ({
1233
1239
  removeUploadErrors: handleRemoveErrors
1234
1240
  }
1235
1241
  ),
1236
- /* @__PURE__ */ jsx11(DropFilesStandard_default, { FilesSelected: onDrop, DropFilesText: dropFilesText, language: activatedLanguage }),
1242
+ /* @__PURE__ */ jsx11(DropFilesStandard_default, { FilesSelected: onDrop, DropFilesText: dropFilesText }),
1237
1243
  /* @__PURE__ */ jsx11(
1238
1244
  SelectedFilesStandard_default,
1239
1245
  {
@@ -1483,6 +1489,271 @@ function groupQuestionsByStepCategoryGroup(questions, steps, validationErrorsLis
1483
1489
  }
1484
1490
  var GroupQuestionsByStepCategoryGroup_default = groupQuestionsByStepCategoryGroup;
1485
1491
 
1492
+ // src/NewHelpMethodsStandard/ApplicationContentSlice/applicationContentSlice.ts
1493
+ import { createSlice, createSelector } from "@reduxjs/toolkit";
1494
+ var pickLang = (cfg, lang) => {
1495
+ var _a;
1496
+ return (_a = cfg.languageSupport.find((l) => l.language === lang)) != null ? _a : cfg.languageSupport[0];
1497
+ };
1498
+ var createLanguageSlice = (initialConfig, options) => {
1499
+ var _a;
1500
+ const name = (_a = options == null ? void 0 : options.name) != null ? _a : "applicationContent";
1501
+ const initialLang = pickLang(initialConfig, initialConfig.activatedLanguage);
1502
+ const initialState = {
1503
+ activatedLanguage: initialConfig.activatedLanguage,
1504
+ languageSupport: initialConfig.languageSupport,
1505
+ languageSupportLoaded: true,
1506
+ backButton: initialLang.backButton,
1507
+ forwardButton: initialLang.forwardButton,
1508
+ sendButton: initialLang.sendButton
1509
+ };
1510
+ const slice = createSlice({
1511
+ name,
1512
+ initialState,
1513
+ reducers: {
1514
+ setActivatedLanguage: (state, action) => {
1515
+ state.activatedLanguage = action.payload;
1516
+ const lang = pickLang(
1517
+ { activatedLanguage: state.activatedLanguage, languageSupport: state.languageSupport },
1518
+ action.payload
1519
+ );
1520
+ state.backButton = lang.backButton;
1521
+ state.forwardButton = lang.forwardButton;
1522
+ state.sendButton = lang.sendButton;
1523
+ },
1524
+ setLabelsFromLanguageEntry: (state, action) => {
1525
+ state.backButton = action.payload.backButton;
1526
+ state.forwardButton = action.payload.forwardButton;
1527
+ state.sendButton = action.payload.sendButton;
1528
+ },
1529
+ replaceLanguageSupport: (state, action) => {
1530
+ state.languageSupport = action.payload.languageSupport;
1531
+ state.activatedLanguage = action.payload.activatedLanguage;
1532
+ const lang = pickLang(action.payload, action.payload.activatedLanguage);
1533
+ state.backButton = lang.backButton;
1534
+ state.forwardButton = lang.forwardButton;
1535
+ state.sendButton = lang.sendButton;
1536
+ state.languageSupportLoaded = true;
1537
+ }
1538
+ }
1539
+ });
1540
+ return slice;
1541
+ };
1542
+ var makeLanguageSelectors = (selectSlice) => {
1543
+ const selectState = selectSlice;
1544
+ const selectActivatedLanguage = (state) => selectState(state).activatedLanguage;
1545
+ const selectLanguageSupportLoaded = (state) => selectState(state).languageSupportLoaded;
1546
+ const selectLanguageSupport = (state) => selectState(state).languageSupport;
1547
+ const selectOverallContentState = (state) => selectState(state);
1548
+ const selectOverallContentFromLanguageSupport = createSelector(
1549
+ [selectState, (_, activatedLanguage) => activatedLanguage],
1550
+ (applicationContent, activatedLanguage) => {
1551
+ const match = applicationContent.languageSupport.find(
1552
+ (l) => l.language === activatedLanguage
1553
+ );
1554
+ if (!match) return { ...applicationContent };
1555
+ return {
1556
+ ...applicationContent,
1557
+ backButton: match.backButton,
1558
+ forwardButton: match.forwardButton,
1559
+ sendButton: match.sendButton
1560
+ };
1561
+ }
1562
+ );
1563
+ return {
1564
+ selectActivatedLanguage,
1565
+ selectLanguageSupportLoaded,
1566
+ selectLanguageSupport,
1567
+ selectOverallContentState,
1568
+ selectOverallContentFromLanguageSupport
1569
+ };
1570
+ };
1571
+
1572
+ // src/NewHelpMethodsStandard/QuestionSlice/questionSlice.ts
1573
+ import {
1574
+ createSlice as createSlice2,
1575
+ createSelector as createSelector2
1576
+ } from "@reduxjs/toolkit";
1577
+ var createQuestionsSlice = (initialState, options) => {
1578
+ var _a;
1579
+ const slice = createSlice2({
1580
+ name: (_a = options == null ? void 0 : options.name) != null ? _a : "Form",
1581
+ initialState,
1582
+ reducers: {
1583
+ AddApplicationContentFromLanguageSupport: (state, action) => {
1584
+ state.applicationContent = action.payload;
1585
+ state.questionsLoaded = true;
1586
+ },
1587
+ AddStepsFromLanguageSupport: (state, action) => {
1588
+ state.steps = action.payload;
1589
+ },
1590
+ AddQuestionsFromLanguageSupport: (state, action) => {
1591
+ state.questions = action.payload;
1592
+ },
1593
+ AddAnswer: (state, action) => {
1594
+ state.questions = state.questions.map((qObject) => {
1595
+ if (qObject.id === action.payload.id) {
1596
+ return {
1597
+ ...qObject,
1598
+ answer: action.payload.answer
1599
+ };
1600
+ }
1601
+ return qObject;
1602
+ });
1603
+ },
1604
+ AddFiles: (state, action) => {
1605
+ state.questions = state.questions.map((qObject) => {
1606
+ if (qObject.id === action.payload.id) {
1607
+ return {
1608
+ ...qObject,
1609
+ files: action.payload.files
1610
+ };
1611
+ }
1612
+ return qObject;
1613
+ });
1614
+ },
1615
+ RemoveAllQuestionsDisplayedInStep: (state, action) => {
1616
+ const { activeStep } = action.payload;
1617
+ state.questions = state.questions.map((qObject) => {
1618
+ if (qObject.step >= activeStep) {
1619
+ return {
1620
+ ...qObject,
1621
+ isDisplayed: false
1622
+ };
1623
+ }
1624
+ return qObject;
1625
+ });
1626
+ },
1627
+ AddQuestionDisplayed: (state, action) => {
1628
+ state.questions = state.questions.map((qObject) => {
1629
+ if (qObject.id === action.payload.id) {
1630
+ return {
1631
+ ...qObject,
1632
+ isDisplayed: action.payload.isDisplayed
1633
+ };
1634
+ }
1635
+ return qObject;
1636
+ });
1637
+ },
1638
+ RemoveAllAnswersForward: (state, action) => {
1639
+ state.questions = state.questions.map((qObject) => {
1640
+ let questionExistInLinkedToQuestion = false;
1641
+ if (qObject.dependsOnOtherQuestion !== void 0) {
1642
+ questionExistInLinkedToQuestion = qObject.dependsOnOtherQuestion.some(
1643
+ (innerArray) => innerArray.some((item) => item.LinkedToQuestionId === action.payload.id)
1644
+ );
1645
+ }
1646
+ const shouldClear = qObject.id > action.payload.id && !qObject.isDisplayed && qObject.dependsOnOtherQuestion !== void 0 && questionExistInLinkedToQuestion;
1647
+ if (shouldClear) {
1648
+ return {
1649
+ ...qObject,
1650
+ answer: ""
1651
+ };
1652
+ }
1653
+ return qObject;
1654
+ });
1655
+ }
1656
+ },
1657
+ extraReducers: (builder) => {
1658
+ if (options == null ? void 0 : options.extraReducers) {
1659
+ options.extraReducers(builder);
1660
+ }
1661
+ }
1662
+ });
1663
+ return slice;
1664
+ };
1665
+ var makeQuestionsSelectors = (selectSlice) => {
1666
+ const selectStateQuestion = (state) => selectSlice(state);
1667
+ const selectIsQuestionLoaded = (state) => selectSlice(state).questionsLoaded;
1668
+ const selectApplicationContentFromLanguageSupport = createSelector2(
1669
+ [
1670
+ (state) => selectSlice(state).applicationContent,
1671
+ (_, activatedLanguage) => activatedLanguage
1672
+ ],
1673
+ (applicationContent, activatedLanguage) => {
1674
+ var _a;
1675
+ const languageSupport = (_a = applicationContent == null ? void 0 : applicationContent.languageSupport) == null ? void 0 : _a.find(
1676
+ (lang) => lang.language === activatedLanguage
1677
+ );
1678
+ if (!languageSupport) {
1679
+ return {
1680
+ mainHeadline: "",
1681
+ ingressBody: "",
1682
+ linksForMoreInfo: [],
1683
+ pageTitle: "",
1684
+ textblocks: []
1685
+ };
1686
+ }
1687
+ return {
1688
+ mainHeadline: languageSupport.mainHeadline,
1689
+ ingressBody: languageSupport.ingressBody,
1690
+ linksForMoreInfo: languageSupport.linksForMoreInfo,
1691
+ pageTitle: languageSupport.pageTitle,
1692
+ textblocks: languageSupport.textblocks,
1693
+ languageSupport: applicationContent == null ? void 0 : applicationContent.languageSupport
1694
+ };
1695
+ }
1696
+ );
1697
+ const selectStepFromLanguageSupport = createSelector2(
1698
+ [
1699
+ (state) => selectSlice(state).steps,
1700
+ (_, activatedLanguage) => activatedLanguage
1701
+ ],
1702
+ (steps, activatedLanguage) => {
1703
+ return steps.map((stepperObject) => {
1704
+ let languageSupport = stepperObject.languageSupport.find(
1705
+ (lang) => lang.language === activatedLanguage
1706
+ );
1707
+ if (!languageSupport) {
1708
+ languageSupport = {};
1709
+ }
1710
+ return {
1711
+ ...stepperObject,
1712
+ stepHeadline: languageSupport.stepHeadline,
1713
+ stepDescription: languageSupport.stepDescription,
1714
+ shortNameInStepper: languageSupport.shortNameInStepper,
1715
+ shortNameInPreview: languageSupport.shortNameInPreview,
1716
+ pageTitle: languageSupport.pageTitle
1717
+ };
1718
+ });
1719
+ }
1720
+ );
1721
+ const selectQuestionFromLanguageSupport = createSelector2(
1722
+ [
1723
+ (state) => selectSlice(state).questions,
1724
+ (_, activatedLanguage) => activatedLanguage
1725
+ ],
1726
+ (questions, activatedLanguage) => {
1727
+ return questions.map((qObject) => {
1728
+ let languageSupport = qObject.languageSupport.find(
1729
+ (lang) => lang.language === activatedLanguage
1730
+ );
1731
+ if (!languageSupport) {
1732
+ languageSupport = {};
1733
+ }
1734
+ return {
1735
+ ...qObject,
1736
+ categoryLabel: languageSupport.categoryLabel,
1737
+ categoryDescription: languageSupport.categoryDescription,
1738
+ questionLabel: languageSupport.questionLabel,
1739
+ previewLabel: languageSupport.previewLabel,
1740
+ aboutText: languageSupport.aboutText,
1741
+ options: languageSupport.options,
1742
+ validationDefaultMessesege: languageSupport.validationDefaultMessesege,
1743
+ validationSummaryLabel: languageSupport.validationSummaryLabel
1744
+ };
1745
+ });
1746
+ }
1747
+ );
1748
+ return {
1749
+ selectStateQuestion,
1750
+ selectIsQuestionLoaded,
1751
+ selectApplicationContentFromLanguageSupport,
1752
+ selectStepFromLanguageSupport,
1753
+ selectQuestionFromLanguageSupport
1754
+ };
1755
+ };
1756
+
1486
1757
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
1487
1758
  import { Fragment as Fragment12, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1488
1759
  var RenderQuestion = ({
@@ -1578,7 +1849,7 @@ var RenderQuestionGroup = ({
1578
1849
  "aria-describedby": questionArray[0].hasValidationError ? `${questionArray[0].id}-error` : void 0,
1579
1850
  children: [
1580
1851
  legend && /* @__PURE__ */ jsxs11("legend", { children: [
1581
- /* @__PURE__ */ jsx13("span", { className: "pts-legend", children: legend }),
1852
+ /* @__PURE__ */ jsx13("span", { children: legend }),
1582
1853
  questionArray[0].hasValidationError && /* @__PURE__ */ jsxs11("span", { className: "sr-only", children: [
1583
1854
  "Valideringsfel. ",
1584
1855
  questionArray[0].validationDefaultMessesege
@@ -2771,5 +3042,9 @@ export {
2771
3042
  TextFieldStandard_default as TextFieldStandard,
2772
3043
  TextHeadlineAndBodyStandard_default as TextHeadlineAndBodyStandard,
2773
3044
  ValidationCheckAllVisibleQuestion_default as ValidationCheckAllVisibleQuestion,
2774
- ValidationErrorSummaryList_default as ValidationErrorSummaryList
3045
+ ValidationErrorSummaryList_default as ValidationErrorSummaryList,
3046
+ createLanguageSlice,
3047
+ createQuestionsSlice,
3048
+ makeLanguageSelectors,
3049
+ makeQuestionsSelectors
2775
3050
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optimized-react-component-library-xyz123",
3
- "version": "0.1.92",
3
+ "version": "0.1.94",
4
4
  "description": "A modern React component library using TypeScript with React 19 support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -66,6 +66,7 @@
66
66
  "vitest": "^2.0.0"
67
67
  },
68
68
  "dependencies": {
69
+ "@reduxjs/toolkit": "^2.10.1",
69
70
  "clsx": "^2.1.1",
70
71
  "date-fns": "^4.1.0",
71
72
  "dompurify": "^3.2.6",
@@ -155,6 +155,15 @@ fieldset {
155
155
  margin-bottom: 3.6rem;
156
156
  }
157
157
 
158
+ .pts-root-question legend {
159
+ font-family: Arial;
160
+ font-size: 1.6rem;
161
+ font-style: normal;
162
+ font-weight: 400;
163
+ line-height: 20px;
164
+ margin-bottom: 0.8rem;
165
+ }
166
+
158
167
  .pts-root-question legend,
159
168
  .pts-root-question label,
160
169
  .pts-radio-option {
@@ -163,14 +172,6 @@ fieldset {
163
172
  cursor: pointer;
164
173
  margin-bottom: 0.6rem;
165
174
  }
166
- .pts-root-question legend {
167
- font-family: Arial;
168
- font-size: 1.6rem;
169
- font-style: normal;
170
- font-weight: 400;
171
- line-height: 20px;
172
- margin: 0.8rem 0 0.8rem 0;
173
- }
174
175
 
175
176
  .pts-root-about {
176
177
  font-size: 1.4rem;
@@ -1497,20 +1498,6 @@ dd {
1497
1498
  opacity: 0.9;
1498
1499
  cursor: copy;
1499
1500
  }
1500
-
1501
- .DropZone-label-container{
1502
- display: flex;
1503
- }
1504
-
1505
- .DropZone svg {
1506
- border-radius: 50%;
1507
- background: var(--purple-purple-900-primary, #6E3282);
1508
- border: 2px solid #6E3282;
1509
- margin-top: 17px;
1510
- margin-right: 16px;
1511
- }
1512
-
1513
-
1514
1501
  .ClipboardLink {
1515
1502
  display: block;
1516
1503
  position: relative;
@@ -1524,8 +1511,6 @@ dd {
1524
1511
  cursor: pointer;
1525
1512
  }
1526
1513
 
1527
-
1528
-
1529
1514
  /* SelectedFiles.tsx */
1530
1515
 
1531
1516
  .makeTopSpace {
@@ -1593,7 +1578,7 @@ dd {
1593
1578
  }
1594
1579
 
1595
1580
  .fileInListContainer {
1596
- /* max-width: 624px;*/
1581
+ max-width: 624px;
1597
1582
  }
1598
1583
 
1599
1584
  .fileListUnorderedList {
@@ -1626,11 +1611,6 @@ dd {
1626
1611
  justify-content: flex-end;
1627
1612
  }
1628
1613
 
1629
- .fileItem{
1630
- display: grid;
1631
- grid-template-columns: 1fr 90% 1fr;
1632
- }
1633
-
1634
1614
  .fileInList .makeSpace {
1635
1615
  border-bottom: 1px solid #747474;
1636
1616
  /* margin-top: 24px; */
@@ -1727,20 +1707,18 @@ dd {
1727
1707
  }
1728
1708
 
1729
1709
  .uploadedDot {
1730
- border-radius: 17px;
1731
- background: var(--red-green-green, #008e55);
1732
- display: flex;
1733
- width: 1rem;
1734
- height: 1rem;
1735
- padding: 4px;
1736
- margin: 0 8px 10px 0;
1737
- }
1738
-
1739
- .uploadedDot svg{
1740
- width: 1rem;
1741
- height: 1rem;
1710
+ border-radius: 17px;
1711
+ background: var(--red-green-green, #008e55);
1712
+ display: flex;
1713
+ width: 16px;
1714
+ height: 16px;
1715
+ padding: 10px;
1716
+ flex-direction: column;
1717
+ justify-content: center;
1718
+ align-items: center;
1719
+ gap: 10px;
1720
+ flex-shrink: 0;
1742
1721
  }
1743
-
1744
1722
  .uploadedDot.uploadFailed {
1745
1723
  background: var(--red-green-red, #8e0039);
1746
1724
 
@@ -1962,32 +1940,6 @@ dd {
1962
1940
  margin-bottom: 0px;
1963
1941
  }
1964
1942
 
1965
- .pts-addFile-error-container{
1966
- display: inline-flex;
1967
- width: 100%;
1968
- }
1969
- .pts-addFile-error-container li{
1970
- display: flex;
1971
- cursor: none;
1972
- padding: 0 20px 1.6rem 0;
1973
- width: 100%;
1974
- margin-bottom: 1.6rem;
1975
- }
1976
- .desktopFileName {
1977
- display: block;
1978
- margin-bottom: 0.6rem;
1979
- }
1980
-
1981
- .error-close{
1982
- color: #8E0039;
1983
- font-weight: 400;
1984
- line-height: 24px;
1985
- background: #fff;
1986
- border: none;
1987
- cursor: pointer;
1988
- font-size: 1.6rem;
1989
- }
1990
-
1991
1943
  /* preview */
1992
1944
 
1993
1945
  /* .addFilesPreviewContainer {