optimized-react-component-library-xyz123 2.12.3 → 2.12.6

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
@@ -24,22 +24,6 @@ var ValidationMessage = ({
24
24
  };
25
25
  var ValidationMessage_default = ValidationMessage;
26
26
 
27
- // src/helpers/setPreviewAnswerLabel/setPreviewAnswerLabel.ts
28
- var setPreviewAnswerLabel = (question, activatedLanguage) => {
29
- var _a;
30
- if ((question == null ? void 0 : question.answer) && question.answer.length > 0) {
31
- const language = question.languageSupport.find((lang) => lang.language === activatedLanguage);
32
- if (language && setPreviewAnswerLabel.length > 0) {
33
- const answerOption = language.options.find(
34
- (option) => option.value === question.answer
35
- );
36
- return (_a = answerOption.label) != null ? _a : "";
37
- }
38
- }
39
- return "";
40
- };
41
- var setPreviewAnswerLabel_default = setPreviewAnswerLabel;
42
-
43
27
  // src/components/input-components/RadioMultipleStandard/RadioMultipleStandard.tsx
44
28
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
45
29
  var InputRadio = ({
@@ -103,10 +87,9 @@ var RadioMultipleStandard_default = InputRadio;
103
87
  var PreviewRadio = ({ question, activatedLanguage }) => {
104
88
  var _a, _b;
105
89
  const previewId = `preview-${question.id}`;
106
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
107
90
  return /* @__PURE__ */ jsxs2(Fragment, { children: [
108
91
  /* @__PURE__ */ jsx2("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
109
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx2("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: questionAnswer.length > 0 ? questionAnswer : question.answer }) : /* @__PURE__ */ jsx2(
92
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx2("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ jsx2(
110
93
  "dd",
111
94
  {
112
95
  className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
@@ -2195,14 +2178,13 @@ var RadioWithInfo = ({
2195
2178
  ]
2196
2179
  }
2197
2180
  ) }),
2198
- showPreview && /* @__PURE__ */ jsx21(PreviewRadio2, { question, activatedLanguage })
2181
+ showPreview && /* @__PURE__ */ jsx21(PreviewRadio2, { question })
2199
2182
  ] });
2200
2183
  };
2201
2184
  var RadioMultipleWithInfo2Standard_default = RadioWithInfo;
2202
- var PreviewRadio2 = ({ question, activatedLanguage }) => {
2185
+ var PreviewRadio2 = ({ question }) => {
2203
2186
  var _a, _b;
2204
2187
  const previewId = `preview-${question.id}`;
2205
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2206
2188
  return /* @__PURE__ */ jsxs17(Fragment14, { children: [
2207
2189
  /* @__PURE__ */ jsx21("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
2208
2190
  ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx21(
@@ -2210,7 +2192,7 @@ var PreviewRadio2 = ({ question, activatedLanguage }) => {
2210
2192
  {
2211
2193
  className: "pts-radioMultipleWithInfo2-preview pts-root-answer",
2212
2194
  id: `answer-${previewId}`,
2213
- children: questionAnswer.length > 0 ? questionAnswer : question.answer
2195
+ children: question.answer
2214
2196
  }
2215
2197
  ) : /* @__PURE__ */ jsx21(
2216
2198
  "dd",
@@ -2349,17 +2331,16 @@ var CustomDropdownStandard = ({
2349
2331
  ),
2350
2332
  hasOptionInfoText && /* @__PURE__ */ jsx23(OptionTextBody_default, { ...optionTextProps })
2351
2333
  ] }),
2352
- showPreview && /* @__PURE__ */ jsx23(PreviewDropdown, { question, activatedLanguage })
2334
+ showPreview && /* @__PURE__ */ jsx23(PreviewDropdown, { question })
2353
2335
  ] });
2354
2336
  };
2355
2337
  var DropdownStandard_default = CustomDropdownStandard;
2356
- var PreviewDropdown = ({ question, activatedLanguage }) => {
2338
+ var PreviewDropdown = ({ question, activatedLanguage = "sv" }) => {
2357
2339
  var _a, _b;
2358
2340
  const previewId = `preview-${question.id}`;
2359
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2360
2341
  return /* @__PURE__ */ jsxs19(Fragment16, { children: [
2361
2342
  /* @__PURE__ */ jsx23("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
2362
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx23("dd", { className: "pts-dropdown-preview pts-root-answer", id: `answer-${previewId}`, children: questionAnswer.length > 0 ? questionAnswer : question.answer }) : /* @__PURE__ */ jsx23(
2343
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx23("dd", { className: "pts-dropdown-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ jsx23(
2363
2344
  "dd",
2364
2345
  {
2365
2346
  className: "pts-dropdown-preview pts-root-answer no-answer-preview-page",
@@ -3374,7 +3355,7 @@ var CookieBanner_default = CookieBanner;
3374
3355
 
3375
3356
  // src/components/layout/FooterStandard/FooterStandard.tsx
3376
3357
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
3377
- var Footer = ({ activatedLanguage = "sv" }) => {
3358
+ var Footer = ({ activatedLanguage = "sv", appUsesCookies = false, openCookieBanner }) => {
3378
3359
  return /* @__PURE__ */ jsxs23("footer", { className: "pts-footer-container", children: [
3379
3360
  /* @__PURE__ */ jsx27("div", { className: "pts-footer-slogan-text-container", children: /* @__PURE__ */ jsx27("p", { className: "pts-footer-slogan-text", children: activatedLanguage === "sv" ? "S\xE4ker och tillg\xE4nglig kommunikation f\xF6r Sverige" : "Secure and accessible communication for Sweden" }) }),
3380
3361
  /* @__PURE__ */ jsxs23("div", { className: "pts-footer-content", children: [
@@ -3443,7 +3424,19 @@ var Footer = ({ activatedLanguage = "sv" }) => {
3443
3424
  ]
3444
3425
  }
3445
3426
  ) }),
3446
- /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs23(
3427
+ /* @__PURE__ */ jsx27("li", { children: appUsesCookies ? /* @__PURE__ */ jsxs23(
3428
+ "button",
3429
+ {
3430
+ type: "button",
3431
+ "aria-controls": "cookie-banner",
3432
+ onClick: openCookieBanner,
3433
+ className: "pts-footer-button",
3434
+ children: [
3435
+ /* @__PURE__ */ jsx27("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens cookie banner)" : "PTS Kakor (\xF6ppnar kakbanner)" }),
3436
+ /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
3437
+ ]
3438
+ }
3439
+ ) : /* @__PURE__ */ jsxs23(
3447
3440
  "a",
3448
3441
  {
3449
3442
  href: activatedLanguage === "en" ? "https://pts.se/en/cookies-eservices" : "https://www.pts.se/kakor-etjanster",