optimized-react-component-library-xyz123 0.26.5 → 0.26.7

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 CHANGED
@@ -118,7 +118,6 @@ interface RadioProps {
118
118
  question: IQuestion;
119
119
  handleQuestionInputChange: any;
120
120
  showPreview?: boolean;
121
- activatedLanguage?: string;
122
121
  }
123
122
 
124
123
  declare const InputRadio: FC<RadioProps>;
@@ -728,7 +727,6 @@ interface CookieBannerProps {
728
727
  onClose?: () => void;
729
728
  acceptCookies: () => void;
730
729
  rejectCookies: () => void;
731
- activatedLanguage?: string;
732
730
  }
733
731
 
734
732
  declare const CookieBanner: React$1.FC<CookieBannerProps>;
@@ -754,10 +752,7 @@ interface ModalProps {
754
752
 
755
753
  declare const Modal: FC<ModalProps>;
756
754
 
757
- type SkipLinkProps = {
758
- activatedLanguage?: string;
759
- };
760
- declare const SkipLink: FC<SkipLinkProps>;
755
+ declare const SkipLink: FC;
761
756
 
762
757
  interface PrincipleOfPublicityProps {
763
758
  activatedLanguage?: string;
@@ -783,7 +778,6 @@ interface StartApplicationButtonProps {
783
778
  onClick: (event: React$1.MouseEvent<HTMLButtonElement>) => void;
784
779
  label?: string;
785
780
  className?: string;
786
- activatedLanguage?: string;
787
781
  }
788
782
  /**
789
783
  * En standardiserad knapp för att starta e-tjänsten.
@@ -791,7 +785,6 @@ interface StartApplicationButtonProps {
791
785
  * @param {Function} onClick - Funktion som körs när användaren klickar på knappen.
792
786
  * @param {string} label - Text som visas på knappen.
793
787
  * @param {string} className - Extra CSS-klasser för knappen.
794
- * @param {string} activatedLanguage - Aktiverat språk.
795
788
  */
796
789
  declare const StartApplicationButton: React$1.FC<StartApplicationButtonProps>;
797
790
 
@@ -852,14 +845,12 @@ declare const ValidationErrorSummaryList: React$1.FC<ValidationErrorSummaryListP
852
845
 
853
846
  interface FormStatusMessagesProps {
854
847
  formStatus: string;
855
- activatedLanguage?: string;
856
848
  }
857
849
  /**
858
850
  * Visar ett error-meddelande om formuläret misslyckas att skicka in, dvs. status är
859
851
  * failed. Läser upp att formuläret laddas för skärmläsare när status är loading.
860
852
  *
861
853
  * @param {string} formStatus Nuvarande status för formuläret.
862
- * @param {string} [activatedLanguage='sv'] Den aktiverade språkkoden (default är svenska).
863
854
  *
864
855
  */
865
856
  declare const FormStatusMessagesScreenReader: React$1.FC<FormStatusMessagesProps>;
package/dist/index.d.ts CHANGED
@@ -118,7 +118,6 @@ interface RadioProps {
118
118
  question: IQuestion;
119
119
  handleQuestionInputChange: any;
120
120
  showPreview?: boolean;
121
- activatedLanguage?: string;
122
121
  }
123
122
 
124
123
  declare const InputRadio: FC<RadioProps>;
@@ -728,7 +727,6 @@ interface CookieBannerProps {
728
727
  onClose?: () => void;
729
728
  acceptCookies: () => void;
730
729
  rejectCookies: () => void;
731
- activatedLanguage?: string;
732
730
  }
733
731
 
734
732
  declare const CookieBanner: React$1.FC<CookieBannerProps>;
@@ -754,10 +752,7 @@ interface ModalProps {
754
752
 
755
753
  declare const Modal: FC<ModalProps>;
756
754
 
757
- type SkipLinkProps = {
758
- activatedLanguage?: string;
759
- };
760
- declare const SkipLink: FC<SkipLinkProps>;
755
+ declare const SkipLink: FC;
761
756
 
762
757
  interface PrincipleOfPublicityProps {
763
758
  activatedLanguage?: string;
@@ -783,7 +778,6 @@ interface StartApplicationButtonProps {
783
778
  onClick: (event: React$1.MouseEvent<HTMLButtonElement>) => void;
784
779
  label?: string;
785
780
  className?: string;
786
- activatedLanguage?: string;
787
781
  }
788
782
  /**
789
783
  * En standardiserad knapp för att starta e-tjänsten.
@@ -791,7 +785,6 @@ interface StartApplicationButtonProps {
791
785
  * @param {Function} onClick - Funktion som körs när användaren klickar på knappen.
792
786
  * @param {string} label - Text som visas på knappen.
793
787
  * @param {string} className - Extra CSS-klasser för knappen.
794
- * @param {string} activatedLanguage - Aktiverat språk.
795
788
  */
796
789
  declare const StartApplicationButton: React$1.FC<StartApplicationButtonProps>;
797
790
 
@@ -852,14 +845,12 @@ declare const ValidationErrorSummaryList: React$1.FC<ValidationErrorSummaryListP
852
845
 
853
846
  interface FormStatusMessagesProps {
854
847
  formStatus: string;
855
- activatedLanguage?: string;
856
848
  }
857
849
  /**
858
850
  * Visar ett error-meddelande om formuläret misslyckas att skicka in, dvs. status är
859
851
  * failed. Läser upp att formuläret laddas för skärmläsare när status är loading.
860
852
  *
861
853
  * @param {string} formStatus Nuvarande status för formuläret.
862
- * @param {string} [activatedLanguage='sv'] Den aktiverade språkkoden (default är svenska).
863
854
  *
864
855
  */
865
856
  declare const FormStatusMessagesScreenReader: React$1.FC<FormStatusMessagesProps>;
package/dist/index.js CHANGED
@@ -85,8 +85,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
85
85
  var InputRadio = ({
86
86
  question,
87
87
  handleQuestionInputChange,
88
- showPreview = false,
89
- activatedLanguage = "sv"
88
+ showPreview = false
90
89
  }) => {
91
90
  var _a;
92
91
  const questionId = `question-${question.id}`;
@@ -132,11 +131,11 @@ var InputRadio = ({
132
131
  ]
133
132
  }
134
133
  ) }),
135
- showPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreviewRadio, { question, activatedLanguage })
134
+ showPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreviewRadio, { question })
136
135
  ] });
137
136
  };
138
137
  var RadioMultipleStandard_default = InputRadio;
139
- var PreviewRadio = ({ question, activatedLanguage }) => {
138
+ var PreviewRadio = ({ question }) => {
140
139
  var _a, _b;
141
140
  const previewId = `preview-${question.id}`;
142
141
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
@@ -146,7 +145,7 @@ var PreviewRadio = ({ question, activatedLanguage }) => {
146
145
  {
147
146
  className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
148
147
  id: `answer-${previewId}`,
149
- children: activatedLanguage === "en" ? "No answer" : "Inget svar"
148
+ children: "Inget svar"
150
149
  }
151
150
  )
152
151
  ] });
@@ -168,17 +167,17 @@ var MultipleCheckboxes = ({
168
167
  var _a2;
169
168
  const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
170
169
  var _a3;
171
- return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
172
- }).map((option) => option.id)) || [];
170
+ return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
171
+ }).map((option) => option.label)) || [];
173
172
  console.log("Initial values:", initialValues);
174
173
  setCheckedValues(initialValues);
175
174
  }, [question.answer, question.options]);
176
- const handleInputChange = (event, optionId) => {
175
+ const handleInputChange = (event, optionValue) => {
177
176
  let updatedValues = [...checkedValues];
178
- if (updatedValues.includes(optionId)) {
179
- updatedValues = updatedValues.filter((val) => val !== optionId);
177
+ if (updatedValues.includes(optionValue)) {
178
+ updatedValues = updatedValues.filter((val) => val !== optionValue);
180
179
  } else {
181
- updatedValues.push(optionId);
180
+ updatedValues.push(optionValue);
182
181
  }
183
182
  setCheckedValues(updatedValues);
184
183
  const e = { target: { value: updatedValues.toString() } };
@@ -200,9 +199,9 @@ var MultipleCheckboxes = ({
200
199
  type: "checkbox",
201
200
  name: `${question.id}-option`,
202
201
  id: `${question.id}-option-${index}`,
203
- value: option.id,
204
- checked: checkedValues.includes(option.id),
205
- onChange: (e) => handleInputChange(e, option.id),
202
+ value: option.label,
203
+ checked: checkedValues.includes(option.label),
204
+ onChange: (e) => handleInputChange(e, option.label),
206
205
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
207
206
  }
208
207
  ),
@@ -224,7 +223,7 @@ var PrevieMultipleCheckboxes = ({
224
223
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
225
224
  question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: question.options[0].label }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
226
225
  var _a2;
227
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
226
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
228
227
  }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
229
228
  " "
230
229
  ] });
@@ -784,7 +783,7 @@ var SelectedFiles = ({
784
783
  }
785
784
  ) })
786
785
  ] }) }),
787
- questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "fileListUnorderedList", "aria-label": activatedLanguage === "en" ? "Uploaded files" : "Uppladdade filer", children: questionObject.files.map((file, index) => {
786
+ questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
788
787
  const indicatorfileName = file.FileName;
789
788
  let mobileFirstFileName = file.FileName.split(".").shift();
790
789
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
@@ -1279,7 +1278,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
1279
1278
  let translatedAnswer = question.answer;
1280
1279
  if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
1281
1280
  const answerNormalized = normalize(question.answer);
1282
- const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.id))).map((option) => `^${option.id}^`);
1281
+ const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.label))).map((option) => `^${option.id}^`);
1283
1282
  if (matchingIds.length > 0) {
1284
1283
  translatedAnswer = matchingIds.join(",");
1285
1284
  }
@@ -2070,8 +2069,7 @@ var CookieBanner = ({
2070
2069
  onCookieStateChange,
2071
2070
  onClose,
2072
2071
  acceptCookies,
2073
- rejectCookies,
2074
- activatedLanguage = "sv"
2072
+ rejectCookies
2075
2073
  }) => {
2076
2074
  if (!visible) return null;
2077
2075
  const handleCookieChoice = (accepted) => {
@@ -2098,13 +2096,8 @@ var CookieBanner = ({
2098
2096
  id: "cookie-banner",
2099
2097
  tabIndex: -1,
2100
2098
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "content", children: [
2101
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h3", { id: "cookie-banner-title", children: [
2102
- " ",
2103
- activatedLanguage === "en" ? "Cookies" : "Kakor (cookies)"
2104
- ] }),
2105
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { id: "cookie-banner-description", children: activatedLanguage === "en" ? `PTS would like to use a web analytics cookie in order to continuously improve pts.se. Do you consent? You can change your choice at any time. To withdraw your consent, click on \u201CCookies\u201D at the bottom of the website.` : `PTS skulle vilja anv\xE4nda en statistikkaka i syfte att l\xF6pande f\xF6rb\xE4ttra webbplatsen.
2106
- Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt
2107
- samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen.` }),
2099
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { id: "cookie-banner-title", children: "Kakor (cookies)" }),
2100
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { id: "cookie-banner-description", children: "PTS skulle vilja anv\xE4nda en statistikkaka i syfte att l\xF6pande f\xF6rb\xE4ttra webbplatsen. Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen." }),
2108
2101
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "pts-cookieBanner-Links", children: [
2109
2102
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2110
2103
  "svg",
@@ -2133,13 +2126,13 @@ var CookieBanner = ({
2133
2126
  href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
2134
2127
  target: "_blank",
2135
2128
  rel: "noopener noreferrer",
2136
- children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2129
+ children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2137
2130
  }
2138
2131
  )
2139
2132
  ] }),
2140
2133
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "pts-cookieBanner-Buttons", children: [
2141
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { onClick: () => handleCookieChoice(true), children: activatedLanguage === "en" ? "Yes, I consent" : "Ja, jag samtycker" }),
2142
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { onClick: () => handleCookieChoice(false), children: activatedLanguage === "en" ? "No, I do not consent" : "Nej, jag samtycker inte" })
2134
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
2135
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
2143
2136
  ] })
2144
2137
  ] })
2145
2138
  }
@@ -2687,9 +2680,9 @@ var ModalStandard_default = Modal;
2687
2680
 
2688
2681
  // src/components/layout/SkipLinkStandard/SkipLinkStandard.tsx
2689
2682
  var import_jsx_runtime20 = require("react/jsx-runtime");
2690
- var SkipLink = ({ activatedLanguage = "sv" }) => {
2683
+ var SkipLink = () => {
2691
2684
  function scrollToMainContent() {
2692
- const container = document.getElementById(`pts-main-service-headline`);
2685
+ const container = document.getElementById(`main-content`);
2693
2686
  if (container) {
2694
2687
  container.scrollIntoView({ behavior: "smooth", block: "center" });
2695
2688
  container.focus();
@@ -2703,7 +2696,7 @@ var SkipLink = ({ activatedLanguage = "sv" }) => {
2703
2696
  e.preventDefault();
2704
2697
  scrollToMainContent();
2705
2698
  },
2706
- children: activatedLanguage === "en" ? "Skip to main content" : "Till huvudinneh\xE5ll"
2699
+ children: "Till huvudinneh\xE5ll"
2707
2700
  }
2708
2701
  ) });
2709
2702
  };
@@ -2935,18 +2928,16 @@ var EditPreviewLinkStandard_default = EditPreviewLink;
2935
2928
  var import_jsx_runtime25 = require("react/jsx-runtime");
2936
2929
  var StartApplicationButton = ({
2937
2930
  onClick,
2938
- label,
2939
- className = "",
2940
- activatedLanguage = "sv"
2931
+ label = "Starta e-tj\xE4nsten",
2932
+ className = ""
2941
2933
  }) => {
2942
- const defaultLabel = activatedLanguage === "en" ? "Start e-service" : "Starta e-tj\xE4nsten";
2943
2934
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2944
2935
  "button",
2945
2936
  {
2946
2937
  type: "button",
2947
2938
  className: `pts-forwardButton pts-start-applicationButton ${className}`,
2948
2939
  onClick,
2949
- children: label || defaultLabel
2940
+ children: label
2950
2941
  }
2951
2942
  );
2952
2943
  };
@@ -3105,10 +3096,10 @@ var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
3105
3096
 
3106
3097
  // src/components/validation-and-status/FormStatusMessagesScreenReader/FormStatusMessagesScreenReader.tsx
3107
3098
  var import_jsx_runtime29 = require("react/jsx-runtime");
3108
- var FormStatusMessagesScreenReader = ({ formStatus, activatedLanguage = "sv" }) => {
3099
+ var FormStatusMessagesScreenReader = ({ formStatus }) => {
3109
3100
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
3110
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pts-root-mandatoryAsterisk", children: activatedLanguage === "en" ? "Something went wrong, please try again later or contact us!" : "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
3111
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? activatedLanguage === "en" ? "Your case is being registered. Please do not refresh or close the page." : "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
3101
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pts-root-mandatoryAsterisk", children: "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
3112
3103
  ] });
3113
3104
  };
3114
3105
  var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;