optimized-react-component-library-xyz123 2.15.1 → 3.0.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.mjs CHANGED
@@ -289,6 +289,7 @@ var PreviewCheckboxGroup = ({
289
289
  };
290
290
 
291
291
  // src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
292
+ import { useState as useState3 } from "react";
292
293
  import DOMPurify from "dompurify";
293
294
  import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
294
295
  var InputTextarea = ({
@@ -302,12 +303,17 @@ var InputTextarea = ({
302
303
  const inputId = `textarea-${question.id}`;
303
304
  const aboutId = `about-${question.id}`;
304
305
  const errorId = `error-${question.id}`;
306
+ const [localAnswer, setLocalAnswer] = useState3(question.answer);
305
307
  const defaultMaxLength = 1e3;
306
308
  const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
307
309
  const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
308
310
  const isTooLong = answerLength > maxLength;
309
311
  const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
310
312
  const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
313
+ const onChange = (e) => {
314
+ setLocalAnswer(e.target.value);
315
+ handleQuestionInputChange(e, question);
316
+ };
311
317
  return /* @__PURE__ */ jsxs5(Fragment4, { children: [
312
318
  !showPreview && question.visible && /* @__PURE__ */ jsxs5(
313
319
  "div",
@@ -334,8 +340,8 @@ var InputTextarea = ({
334
340
  "textarea",
335
341
  {
336
342
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
337
- onChange: (e) => handleQuestionInputChange(e, question),
338
- value: question.answer,
343
+ onChange: (e) => onChange(e),
344
+ value: localAnswer,
339
345
  required: question.isQuestionMandatory,
340
346
  "aria-required": question.isQuestionMandatory,
341
347
  "aria-invalid": question.hasValidationError,
@@ -495,7 +501,7 @@ var PreviewTextField = ({
495
501
  };
496
502
 
497
503
  // src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
498
- import { useCallback, useEffect as useEffect5, useState as useState5 } from "react";
504
+ import { useCallback, useEffect as useEffect5, useState as useState6 } from "react";
499
505
  import clsx3 from "clsx";
500
506
 
501
507
  // src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
@@ -551,15 +557,15 @@ import { useRef } from "react";
551
557
  import clsx from "clsx";
552
558
 
553
559
  // src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
554
- import React from "react";
560
+ import React2 from "react";
555
561
  import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
556
562
  var ScreenReaderErrors = ({
557
563
  errorMessageAddingFile,
558
564
  activatedLanguage
559
565
  }) => {
560
- const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React.useState(false);
561
- const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React.useState("");
562
- React.useEffect(() => {
566
+ const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React2.useState(false);
567
+ const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React2.useState("");
568
+ React2.useEffect(() => {
563
569
  if (errorMessageAddingFile.length > 0) {
564
570
  let errorMessages = "";
565
571
  errorMessages += errorMessageAddingFile.length;
@@ -659,16 +665,16 @@ var ExploreFiles = ({
659
665
  var ExploreFilesStandard_default = ExploreFiles;
660
666
 
661
667
  // src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
662
- import React4, { useEffect as useEffect4, useState as useState4, useRef as useRef2 } from "react";
668
+ import React5, { useEffect as useEffect4, useState as useState5, useRef as useRef2 } from "react";
663
669
  import { Col, Row } from "react-bootstrap";
664
670
 
665
671
  // src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
666
- import { useState as useState3 } from "react";
672
+ import { useState as useState4 } from "react";
667
673
  import clsx2 from "clsx";
668
674
  import { Fragment as Fragment9, jsx as jsx10 } from "react/jsx-runtime";
669
675
  var Indicator = (filename) => {
670
- const [uploadPercentage, setUploadPercentage] = useState3(0);
671
- const [uploadDone, setUploadDone] = useState3(false);
676
+ const [uploadPercentage, setUploadPercentage] = useState4(0);
677
+ const [uploadDone, setUploadDone] = useState4(false);
672
678
  return /* @__PURE__ */ jsx10(Fragment9, { children: /* @__PURE__ */ jsx10("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
673
679
  };
674
680
  var IndicatorStandard_default = Indicator;
@@ -699,7 +705,7 @@ var SelectedFiles = ({
699
705
  removeFile(newCountOfFiles);
700
706
  };
701
707
  const useWindowWidth = () => {
702
- const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
708
+ const [windowWidth2, setWindowWidth] = useState5(window.innerWidth);
703
709
  useEffect4(() => {
704
710
  const handleResize = () => {
705
711
  setWindowWidth(window.innerWidth);
@@ -723,7 +729,7 @@ var SelectedFiles = ({
723
729
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
724
730
  const fileType = errorObj.FileName.split(".").pop();
725
731
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
726
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
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: [
727
733
  /* @__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 }) }) }),
728
734
  /* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
729
735
  Col,
@@ -776,7 +782,7 @@ var SelectedFiles = ({
776
782
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
777
783
  const fileType = file.FileName.split(".").pop();
778
784
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
779
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
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: [
780
786
  /* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
781
787
  /* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
782
788
  "svg",
@@ -869,11 +875,11 @@ var AddFiles = ({
869
875
  const errorId = `error-${questionObject.id}`;
870
876
  const labelId = `label-${questionObject.id}`;
871
877
  const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
872
- const [numberOfFiles, setNumberOfFiles] = useState5(0);
873
- const [totalFileSize, setTotalFileSize] = useState5(0);
874
- const [errorMessageAddingFile, setErrorMessageAddingFile] = useState5([]);
875
- const [newFiles, setNewFiles] = useState5([]);
876
- const [dropFilesText, setDropFilesText] = useState5("Dra och sl\xE4pp dina filer h\xE4r");
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");
877
883
  useEffect5(() => {
878
884
  if (activatedLanguage === "sv") {
879
885
  setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
@@ -1096,7 +1102,7 @@ var PreviewAddFiles = ({
1096
1102
  };
1097
1103
 
1098
1104
  // src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
1099
- import { useEffect as useEffect6, useState as useState6 } from "react";
1105
+ import { useEffect as useEffect6, useState as useState7 } from "react";
1100
1106
  import DOMPurify3 from "dompurify";
1101
1107
  import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1102
1108
  var SingleCheckbox = ({
@@ -1110,7 +1116,7 @@ var SingleCheckbox = ({
1110
1116
  const inputId = `checkbox-${question.id}`;
1111
1117
  const aboutId = `about-${question.id}`;
1112
1118
  const errorId = `error-${question.id}`;
1113
- const [checked, setChecked] = useState6(false);
1119
+ const [checked, setChecked] = useState7(false);
1114
1120
  useEffect6(() => {
1115
1121
  if (question.answer && question.answer === "true") {
1116
1122
  setChecked(true);
@@ -2039,10 +2045,10 @@ var InputInfoOnly = ({
2039
2045
  var InfoOnlyStandard_default = InputInfoOnly;
2040
2046
 
2041
2047
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
2042
- import React7 from "react";
2048
+ import React8 from "react";
2043
2049
 
2044
2050
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
2045
- import { useEffect as useEffect7, useState as useState7 } from "react";
2051
+ import { useEffect as useEffect7, useState as useState8 } from "react";
2046
2052
  import DOMPurify7 from "dompurify";
2047
2053
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
2048
2054
  var RadioCollapseItem = ({
@@ -2058,7 +2064,7 @@ var RadioCollapseItem = ({
2058
2064
  activatedLanguage = "sv",
2059
2065
  initialOpen = false
2060
2066
  }) => {
2061
- const [isOpen, setIsOpen] = useState7(initialOpen);
2067
+ const [isOpen, setIsOpen] = useState8(initialOpen);
2062
2068
  const contentId = `${questionId}-content-${index}`;
2063
2069
  const buttonId = `${questionId}-button-${index}`;
2064
2070
  const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
@@ -2174,7 +2180,7 @@ var RadioWithInfo = ({
2174
2180
  groupedOptionArray.map((group, g_index) => {
2175
2181
  var _a2;
2176
2182
  let subId = "subheading-" + g_index;
2177
- return /* @__PURE__ */ jsxs17(React7.Fragment, { children: [
2183
+ return /* @__PURE__ */ jsxs17(React8.Fragment, { children: [
2178
2184
  /* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
2179
2185
  /* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
2180
2186
  var _a3, _b2, _c2, _d, _e;
@@ -3000,9 +3006,9 @@ var getGroupCheckIds = (validationType) => {
3000
3006
  var getGroupCheckIds_default = getGroupCheckIds;
3001
3007
 
3002
3008
  // src/hooks/useFormStatusModal/useFormStatusModal.ts
3003
- import * as React8 from "react";
3009
+ import * as React9 from "react";
3004
3010
  var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
3005
- React8.useEffect(() => {
3011
+ React9.useEffect(() => {
3006
3012
  if (formStatus === "loading") {
3007
3013
  handleModalOpen();
3008
3014
  }
@@ -3066,7 +3072,7 @@ var useInputMethodDetection = ({
3066
3072
  };
3067
3073
 
3068
3074
  // src/hooks/useCookieConsent/useCookieConsent.ts
3069
- import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "react";
3075
+ import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState9 } from "react";
3070
3076
  var useCookieConsent = ({
3071
3077
  cookieName,
3072
3078
  choiceKey,
@@ -3087,7 +3093,7 @@ var useCookieConsent = ({
3087
3093
  }),
3088
3094
  [cookieName, choiceKey, expiryYears]
3089
3095
  );
3090
- const [showBanner, setShowBanner] = useState8(false);
3096
+ const [showBanner, setShowBanner] = useState9(false);
3091
3097
  const handleCookieStateChange = useCallback2(() => {
3092
3098
  const cookiesNowAccepted = areCookiesAccepted();
3093
3099
  if (onConsentChange) {
@@ -3474,7 +3480,7 @@ var Footer = ({
3474
3480
  className: "pts-footer-button pts-secondary-button",
3475
3481
  children: [
3476
3482
  /* @__PURE__ */ jsx27("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens cookie banner)" : "PTS Kakor (\xF6ppnar kakbanner)" }),
3477
- /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "secondary_icon", children: /* @__PURE__ */ jsx27(Cookie_icon, {}) }),
3483
+ /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "cookie_icon", children: /* @__PURE__ */ jsx27(Cookie_icon, {}) }),
3478
3484
  /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
3479
3485
  ]
3480
3486
  }
@@ -3923,10 +3929,10 @@ var Header = ({
3923
3929
  var HeaderStandard_default = Header;
3924
3930
 
3925
3931
  // src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
3926
- import { useRef as useRef4, useState as useState11 } from "react";
3932
+ import { useRef as useRef4, useState as useState12 } from "react";
3927
3933
 
3928
3934
  // src/components/layout/NavigationStandard/NavigationStandard.tsx
3929
- import { useEffect as useEffect13, useState as useState9, useRef as useRef3 } from "react";
3935
+ import { useEffect as useEffect13, useState as useState10, useRef as useRef3 } from "react";
3930
3936
  import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
3931
3937
  var Navigation = ({
3932
3938
  setIsMenyOpen,
@@ -3941,7 +3947,7 @@ var Navigation = ({
3941
3947
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3942
3948
  const navRef = useRef3(null);
3943
3949
  const firstVisitRef = useRef3(true);
3944
- const [openSubMenu, setOpenSubMenu] = useState9(null);
3950
+ const [openSubMenu, setOpenSubMenu] = useState10(null);
3945
3951
  const handleSubMenu = (label) => {
3946
3952
  setOpenSubMenu(openSubMenu === label ? null : label);
3947
3953
  };
@@ -4012,7 +4018,7 @@ var Navigation = ({
4012
4018
  }
4013
4019
  return "\xD6ppna undermeny f\xF6r " + label["sv"];
4014
4020
  };
4015
- const [instruction, setInstruction] = useState9("");
4021
+ const [instruction, setInstruction] = useState10("");
4016
4022
  useEffect13(() => {
4017
4023
  if (firstVisitRef.current) {
4018
4024
  firstVisitRef.current = false;
@@ -4102,7 +4108,7 @@ var Navigation = ({
4102
4108
  var NavigationStandard_default = Navigation;
4103
4109
 
4104
4110
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4105
- import { useState as useState10 } from "react";
4111
+ import { useState as useState11 } from "react";
4106
4112
 
4107
4113
  // src/components/layout/SearchBarStandard/Icons.tsx
4108
4114
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
@@ -4126,7 +4132,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
4126
4132
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4127
4133
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
4128
4134
  var SearchBar = ({ activatedLanguage = "sv" }) => {
4129
- const [searchTerm, setSearchTerm] = useState10("");
4135
+ const [searchTerm, setSearchTerm] = useState11("");
4130
4136
  const handleSearch = () => {
4131
4137
  console.log("S\xF6kt efter:", searchTerm);
4132
4138
  };
@@ -4180,7 +4186,7 @@ var NavigationHeader = ({
4180
4186
  if (activatedLanguage === "sv") return "English";
4181
4187
  else return "Svenska";
4182
4188
  };
4183
- const [isMenuOpen, setIsMenuOpen] = useState11(false);
4189
+ const [isMenuOpen, setIsMenuOpen] = useState12(false);
4184
4190
  const menuButtonFocusRef = useRef4(null);
4185
4191
  const handleMenuClick = () => {
4186
4192
  setIsMenuOpen((prev) => !prev);
@@ -4195,7 +4201,7 @@ var NavigationHeader = ({
4195
4201
  const getMenuIcon = () => {
4196
4202
  return isMenuOpen ? /* @__PURE__ */ jsx33(CloseIcon, {}) : /* @__PURE__ */ jsx33(MenuIcon, {});
4197
4203
  };
4198
- const [isSearchOpen, setIsSearchOpen] = useState11(false);
4204
+ const [isSearchOpen, setIsSearchOpen] = useState12(false);
4199
4205
  const handleSearchClick = () => {
4200
4206
  if (!isSearchOpen) {
4201
4207
  setIsSearchOpen(true);
@@ -4436,7 +4442,7 @@ var LinkList = ({
4436
4442
  var LinkListStandard_default = LinkList;
4437
4443
 
4438
4444
  // src/components/layout/CollapseStandard/CollapseStandard.tsx
4439
- import { useState as useState12, useId as useId2 } from "react";
4445
+ import { useState as useState13, useId as useId2 } from "react";
4440
4446
  import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
4441
4447
  var Collapse = ({
4442
4448
  title,
@@ -4446,7 +4452,7 @@ var Collapse = ({
4446
4452
  activatedLanguage = "sv",
4447
4453
  customClass = ""
4448
4454
  }) => {
4449
- const [isOpen, setIsOpen] = useState12(defaultOpen);
4455
+ const [isOpen, setIsOpen] = useState13(defaultOpen);
4450
4456
  const uniqueId = id != null ? id : useId2();
4451
4457
  const contentId = `${uniqueId}-content`;
4452
4458
  const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
@@ -4561,14 +4567,14 @@ var StepperButtons = ({
4561
4567
  var StepperButtonsStandard_default = StepperButtons;
4562
4568
 
4563
4569
  // src/components/stepper/StepperStandard/StepperStandard.tsx
4564
- import React11 from "react";
4570
+ import React12 from "react";
4565
4571
  import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
4566
4572
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
4567
4573
  return /* @__PURE__ */ jsx42("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
4568
4574
  const isActive = step.step === activeStep;
4569
4575
  const lastElement = arraySteps.length;
4570
4576
  const isDone = step.step < activeStep;
4571
- return /* @__PURE__ */ jsxs34(React11.Fragment, { children: [
4577
+ return /* @__PURE__ */ jsxs34(React12.Fragment, { children: [
4572
4578
  /* @__PURE__ */ jsxs34("div", { className: "pts-stepper-step", children: [
4573
4579
  /* @__PURE__ */ jsx42(
4574
4580
  "div",