optimized-react-component-library-xyz123 3.0.1 → 3.0.2

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
@@ -397,6 +397,7 @@ var PreviewTextarea = ({
397
397
  };
398
398
 
399
399
  // src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
400
+ import { useState as useState4 } from "react";
400
401
  import DOMPurify2 from "dompurify";
401
402
  import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
402
403
  var TextFieldStandard = ({
@@ -410,10 +411,15 @@ var TextFieldStandard = ({
410
411
  const inputId = `textField-${question.id}`;
411
412
  const aboutId = `about-${question.id}`;
412
413
  const errorId = `error-${question.id}`;
414
+ const [localAnswer, setLocalAnswer] = useState4(question.answer);
413
415
  const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
414
416
  const maxLength = 100;
415
417
  const isTooLong = answerLength > maxLength;
416
418
  const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
419
+ const onChange = (e) => {
420
+ setLocalAnswer(e.target.value);
421
+ handleQuestionInputChange(e, question);
422
+ };
417
423
  return /* @__PURE__ */ jsxs6(Fragment5, { children: [
418
424
  !showPreview && question.visible && /* @__PURE__ */ jsxs6(
419
425
  "div",
@@ -444,8 +450,8 @@ var TextFieldStandard = ({
444
450
  inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
445
451
  name: `question-name-${question.id}`,
446
452
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
447
- onChange: (e) => handleQuestionInputChange(e, question),
448
- value: question.answer,
453
+ onChange: (e) => onChange(e),
454
+ value: localAnswer,
449
455
  id: inputId,
450
456
  disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
451
457
  required: question.isQuestionMandatory,
@@ -501,7 +507,7 @@ var PreviewTextField = ({
501
507
  };
502
508
 
503
509
  // src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
504
- import { useCallback, useEffect as useEffect5, useState as useState6 } from "react";
510
+ import { useCallback, useEffect as useEffect5, useState as useState7 } from "react";
505
511
  import clsx3 from "clsx";
506
512
 
507
513
  // src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
@@ -557,15 +563,15 @@ import { useRef } from "react";
557
563
  import clsx from "clsx";
558
564
 
559
565
  // src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
560
- import React2 from "react";
566
+ import React3 from "react";
561
567
  import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
562
568
  var ScreenReaderErrors = ({
563
569
  errorMessageAddingFile,
564
570
  activatedLanguage
565
571
  }) => {
566
- const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React2.useState(false);
567
- const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React2.useState("");
568
- React2.useEffect(() => {
572
+ const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React3.useState(false);
573
+ const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React3.useState("");
574
+ React3.useEffect(() => {
569
575
  if (errorMessageAddingFile.length > 0) {
570
576
  let errorMessages = "";
571
577
  errorMessages += errorMessageAddingFile.length;
@@ -665,16 +671,16 @@ var ExploreFiles = ({
665
671
  var ExploreFilesStandard_default = ExploreFiles;
666
672
 
667
673
  // src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
668
- import React5, { useEffect as useEffect4, useState as useState5, useRef as useRef2 } from "react";
674
+ import React6, { useEffect as useEffect4, useState as useState6, useRef as useRef2 } from "react";
669
675
  import { Col, Row } from "react-bootstrap";
670
676
 
671
677
  // src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
672
- import { useState as useState4 } from "react";
678
+ import { useState as useState5 } from "react";
673
679
  import clsx2 from "clsx";
674
680
  import { Fragment as Fragment9, jsx as jsx10 } from "react/jsx-runtime";
675
681
  var Indicator = (filename) => {
676
- const [uploadPercentage, setUploadPercentage] = useState4(0);
677
- const [uploadDone, setUploadDone] = useState4(false);
682
+ const [uploadPercentage, setUploadPercentage] = useState5(0);
683
+ const [uploadDone, setUploadDone] = useState5(false);
678
684
  return /* @__PURE__ */ jsx10(Fragment9, { children: /* @__PURE__ */ jsx10("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
679
685
  };
680
686
  var IndicatorStandard_default = Indicator;
@@ -705,7 +711,7 @@ var SelectedFiles = ({
705
711
  removeFile(newCountOfFiles);
706
712
  };
707
713
  const useWindowWidth = () => {
708
- const [windowWidth2, setWindowWidth] = useState5(window.innerWidth);
714
+ const [windowWidth2, setWindowWidth] = useState6(window.innerWidth);
709
715
  useEffect4(() => {
710
716
  const handleResize = () => {
711
717
  setWindowWidth(window.innerWidth);
@@ -729,7 +735,7 @@ var SelectedFiles = ({
729
735
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
730
736
  const fileType = errorObj.FileName.split(".").pop();
731
737
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
732
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React5.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
738
+ return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React6.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
733
739
  /* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx11("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx11("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
734
740
  /* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
735
741
  Col,
@@ -782,7 +788,7 @@ var SelectedFiles = ({
782
788
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
783
789
  const fileType = file.FileName.split(".").pop();
784
790
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
785
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React5.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
791
+ return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React6.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
786
792
  /* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
787
793
  /* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
788
794
  "svg",
@@ -875,11 +881,11 @@ var AddFiles = ({
875
881
  const errorId = `error-${questionObject.id}`;
876
882
  const labelId = `label-${questionObject.id}`;
877
883
  const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
878
- const [numberOfFiles, setNumberOfFiles] = useState6(0);
879
- const [totalFileSize, setTotalFileSize] = useState6(0);
880
- const [errorMessageAddingFile, setErrorMessageAddingFile] = useState6([]);
881
- const [newFiles, setNewFiles] = useState6([]);
882
- const [dropFilesText, setDropFilesText] = useState6("Dra och sl\xE4pp dina filer h\xE4r");
884
+ const [numberOfFiles, setNumberOfFiles] = useState7(0);
885
+ const [totalFileSize, setTotalFileSize] = useState7(0);
886
+ const [errorMessageAddingFile, setErrorMessageAddingFile] = useState7([]);
887
+ const [newFiles, setNewFiles] = useState7([]);
888
+ const [dropFilesText, setDropFilesText] = useState7("Dra och sl\xE4pp dina filer h\xE4r");
883
889
  useEffect5(() => {
884
890
  if (activatedLanguage === "sv") {
885
891
  setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
@@ -1102,7 +1108,7 @@ var PreviewAddFiles = ({
1102
1108
  };
1103
1109
 
1104
1110
  // src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
1105
- import { useEffect as useEffect6, useState as useState7 } from "react";
1111
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1106
1112
  import DOMPurify3 from "dompurify";
1107
1113
  import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1108
1114
  var SingleCheckbox = ({
@@ -1116,7 +1122,7 @@ var SingleCheckbox = ({
1116
1122
  const inputId = `checkbox-${question.id}`;
1117
1123
  const aboutId = `about-${question.id}`;
1118
1124
  const errorId = `error-${question.id}`;
1119
- const [checked, setChecked] = useState7(false);
1125
+ const [checked, setChecked] = useState8(false);
1120
1126
  useEffect6(() => {
1121
1127
  if (question.answer && question.answer === "true") {
1122
1128
  setChecked(true);
@@ -2045,10 +2051,10 @@ var InputInfoOnly = ({
2045
2051
  var InfoOnlyStandard_default = InputInfoOnly;
2046
2052
 
2047
2053
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
2048
- import React8 from "react";
2054
+ import React9 from "react";
2049
2055
 
2050
2056
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
2051
- import { useEffect as useEffect7, useState as useState8 } from "react";
2057
+ import { useEffect as useEffect7, useState as useState9 } from "react";
2052
2058
  import DOMPurify7 from "dompurify";
2053
2059
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
2054
2060
  var RadioCollapseItem = ({
@@ -2064,7 +2070,7 @@ var RadioCollapseItem = ({
2064
2070
  activatedLanguage = "sv",
2065
2071
  initialOpen = false
2066
2072
  }) => {
2067
- const [isOpen, setIsOpen] = useState8(initialOpen);
2073
+ const [isOpen, setIsOpen] = useState9(initialOpen);
2068
2074
  const contentId = `${questionId}-content-${index}`;
2069
2075
  const buttonId = `${questionId}-button-${index}`;
2070
2076
  const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
@@ -2180,7 +2186,7 @@ var RadioWithInfo = ({
2180
2186
  groupedOptionArray.map((group, g_index) => {
2181
2187
  var _a2;
2182
2188
  let subId = "subheading-" + g_index;
2183
- return /* @__PURE__ */ jsxs17(React8.Fragment, { children: [
2189
+ return /* @__PURE__ */ jsxs17(React9.Fragment, { children: [
2184
2190
  /* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
2185
2191
  /* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
2186
2192
  var _a3, _b2, _c2, _d, _e;
@@ -3006,9 +3012,9 @@ var getGroupCheckIds = (validationType) => {
3006
3012
  var getGroupCheckIds_default = getGroupCheckIds;
3007
3013
 
3008
3014
  // src/hooks/useFormStatusModal/useFormStatusModal.ts
3009
- import * as React9 from "react";
3015
+ import * as React10 from "react";
3010
3016
  var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
3011
- React9.useEffect(() => {
3017
+ React10.useEffect(() => {
3012
3018
  if (formStatus === "loading") {
3013
3019
  handleModalOpen();
3014
3020
  }
@@ -3072,7 +3078,7 @@ var useInputMethodDetection = ({
3072
3078
  };
3073
3079
 
3074
3080
  // src/hooks/useCookieConsent/useCookieConsent.ts
3075
- import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState9 } from "react";
3081
+ import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState10 } from "react";
3076
3082
  var useCookieConsent = ({
3077
3083
  cookieName,
3078
3084
  choiceKey,
@@ -3093,7 +3099,7 @@ var useCookieConsent = ({
3093
3099
  }),
3094
3100
  [cookieName, choiceKey, expiryYears]
3095
3101
  );
3096
- const [showBanner, setShowBanner] = useState9(false);
3102
+ const [showBanner, setShowBanner] = useState10(false);
3097
3103
  const handleCookieStateChange = useCallback2(() => {
3098
3104
  const cookiesNowAccepted = areCookiesAccepted();
3099
3105
  if (onConsentChange) {
@@ -3929,10 +3935,10 @@ var Header = ({
3929
3935
  var HeaderStandard_default = Header;
3930
3936
 
3931
3937
  // src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
3932
- import { useRef as useRef4, useState as useState12 } from "react";
3938
+ import { useRef as useRef4, useState as useState13 } from "react";
3933
3939
 
3934
3940
  // src/components/layout/NavigationStandard/NavigationStandard.tsx
3935
- import { useEffect as useEffect13, useState as useState10, useRef as useRef3 } from "react";
3941
+ import { useEffect as useEffect13, useState as useState11, useRef as useRef3 } from "react";
3936
3942
  import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
3937
3943
  var Navigation = ({
3938
3944
  setIsMenyOpen,
@@ -3947,7 +3953,7 @@ var Navigation = ({
3947
3953
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3948
3954
  const navRef = useRef3(null);
3949
3955
  const firstVisitRef = useRef3(true);
3950
- const [openSubMenu, setOpenSubMenu] = useState10(null);
3956
+ const [openSubMenu, setOpenSubMenu] = useState11(null);
3951
3957
  const handleSubMenu = (label) => {
3952
3958
  setOpenSubMenu(openSubMenu === label ? null : label);
3953
3959
  };
@@ -4018,7 +4024,7 @@ var Navigation = ({
4018
4024
  }
4019
4025
  return "\xD6ppna undermeny f\xF6r " + label["sv"];
4020
4026
  };
4021
- const [instruction, setInstruction] = useState10("");
4027
+ const [instruction, setInstruction] = useState11("");
4022
4028
  useEffect13(() => {
4023
4029
  if (firstVisitRef.current) {
4024
4030
  firstVisitRef.current = false;
@@ -4108,7 +4114,7 @@ var Navigation = ({
4108
4114
  var NavigationStandard_default = Navigation;
4109
4115
 
4110
4116
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4111
- import { useState as useState11 } from "react";
4117
+ import { useState as useState12 } from "react";
4112
4118
 
4113
4119
  // src/components/layout/SearchBarStandard/Icons.tsx
4114
4120
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
@@ -4132,7 +4138,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
4132
4138
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4133
4139
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
4134
4140
  var SearchBar = ({ activatedLanguage = "sv" }) => {
4135
- const [searchTerm, setSearchTerm] = useState11("");
4141
+ const [searchTerm, setSearchTerm] = useState12("");
4136
4142
  const handleSearch = () => {
4137
4143
  console.log("S\xF6kt efter:", searchTerm);
4138
4144
  };
@@ -4186,7 +4192,7 @@ var NavigationHeader = ({
4186
4192
  if (activatedLanguage === "sv") return "English";
4187
4193
  else return "Svenska";
4188
4194
  };
4189
- const [isMenuOpen, setIsMenuOpen] = useState12(false);
4195
+ const [isMenuOpen, setIsMenuOpen] = useState13(false);
4190
4196
  const menuButtonFocusRef = useRef4(null);
4191
4197
  const handleMenuClick = () => {
4192
4198
  setIsMenuOpen((prev) => !prev);
@@ -4201,7 +4207,7 @@ var NavigationHeader = ({
4201
4207
  const getMenuIcon = () => {
4202
4208
  return isMenuOpen ? /* @__PURE__ */ jsx33(CloseIcon, {}) : /* @__PURE__ */ jsx33(MenuIcon, {});
4203
4209
  };
4204
- const [isSearchOpen, setIsSearchOpen] = useState12(false);
4210
+ const [isSearchOpen, setIsSearchOpen] = useState13(false);
4205
4211
  const handleSearchClick = () => {
4206
4212
  if (!isSearchOpen) {
4207
4213
  setIsSearchOpen(true);
@@ -4442,7 +4448,7 @@ var LinkList = ({
4442
4448
  var LinkListStandard_default = LinkList;
4443
4449
 
4444
4450
  // src/components/layout/CollapseStandard/CollapseStandard.tsx
4445
- import { useState as useState13, useId as useId2 } from "react";
4451
+ import { useState as useState14, useId as useId2 } from "react";
4446
4452
  import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
4447
4453
  var Collapse = ({
4448
4454
  title,
@@ -4452,7 +4458,7 @@ var Collapse = ({
4452
4458
  activatedLanguage = "sv",
4453
4459
  customClass = ""
4454
4460
  }) => {
4455
- const [isOpen, setIsOpen] = useState13(defaultOpen);
4461
+ const [isOpen, setIsOpen] = useState14(defaultOpen);
4456
4462
  const uniqueId = id != null ? id : useId2();
4457
4463
  const contentId = `${uniqueId}-content`;
4458
4464
  const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
@@ -4567,14 +4573,14 @@ var StepperButtons = ({
4567
4573
  var StepperButtonsStandard_default = StepperButtons;
4568
4574
 
4569
4575
  // src/components/stepper/StepperStandard/StepperStandard.tsx
4570
- import React12 from "react";
4576
+ import React13 from "react";
4571
4577
  import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
4572
4578
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
4573
4579
  return /* @__PURE__ */ jsx42("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
4574
4580
  const isActive = step.step === activeStep;
4575
4581
  const lastElement = arraySteps.length;
4576
4582
  const isDone = step.step < activeStep;
4577
- return /* @__PURE__ */ jsxs34(React12.Fragment, { children: [
4583
+ return /* @__PURE__ */ jsxs34(React13.Fragment, { children: [
4578
4584
  /* @__PURE__ */ jsxs34("div", { className: "pts-stepper-step", children: [
4579
4585
  /* @__PURE__ */ jsx42(
4580
4586
  "div",