optimized-react-component-library-xyz123 2.12.4 → 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.d.mts CHANGED
@@ -823,6 +823,8 @@ declare const CookieBanner: React$1.FC<CookieBannerProps>;
823
823
 
824
824
  interface FooterProps {
825
825
  activatedLanguage?: string;
826
+ appUsesCookies?: boolean;
827
+ openCookieBanner?: () => void;
826
828
  }
827
829
 
828
830
  declare const Footer: FC<FooterProps>;
package/dist/index.d.ts CHANGED
@@ -823,6 +823,8 @@ declare const CookieBanner: React$1.FC<CookieBannerProps>;
823
823
 
824
824
  interface FooterProps {
825
825
  activatedLanguage?: string;
826
+ appUsesCookies?: boolean;
827
+ openCookieBanner?: () => void;
826
828
  }
827
829
 
828
830
  declare const Footer: FC<FooterProps>;
package/dist/index.js CHANGED
@@ -112,22 +112,6 @@ var ValidationMessage = ({
112
112
  };
113
113
  var ValidationMessage_default = ValidationMessage;
114
114
 
115
- // src/helpers/setPreviewAnswerLabel/setPreviewAnswerLabel.ts
116
- var setPreviewAnswerLabel = (question, activatedLanguage) => {
117
- var _a;
118
- if ((question == null ? void 0 : question.answer) && question.answer.length > 0) {
119
- const language = question.languageSupport.find((lang) => lang.language === activatedLanguage);
120
- if (language && setPreviewAnswerLabel.length > 0) {
121
- const answerOption = language.options.find(
122
- (option) => option.value === question.answer
123
- );
124
- return (_a = answerOption.label) != null ? _a : "";
125
- }
126
- }
127
- return "";
128
- };
129
- var setPreviewAnswerLabel_default = setPreviewAnswerLabel;
130
-
131
115
  // src/components/input-components/RadioMultipleStandard/RadioMultipleStandard.tsx
132
116
  var import_jsx_runtime2 = require("react/jsx-runtime");
133
117
  var InputRadio = ({
@@ -191,10 +175,9 @@ var RadioMultipleStandard_default = InputRadio;
191
175
  var PreviewRadio = ({ question, activatedLanguage }) => {
192
176
  var _a, _b;
193
177
  const previewId = `preview-${question.id}`;
194
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
195
178
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
196
179
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
197
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: questionAnswer.length > 0 ? questionAnswer : question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
180
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
198
181
  "dd",
199
182
  {
200
183
  className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
@@ -2283,14 +2266,13 @@ var RadioWithInfo = ({
2283
2266
  ]
2284
2267
  }
2285
2268
  ) }),
2286
- showPreview && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewRadio2, { question, activatedLanguage })
2269
+ showPreview && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PreviewRadio2, { question })
2287
2270
  ] });
2288
2271
  };
2289
2272
  var RadioMultipleWithInfo2Standard_default = RadioWithInfo;
2290
- var PreviewRadio2 = ({ question, activatedLanguage }) => {
2273
+ var PreviewRadio2 = ({ question }) => {
2291
2274
  var _a, _b;
2292
2275
  const previewId = `preview-${question.id}`;
2293
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2294
2276
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2295
2277
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
2296
2278
  ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -2298,7 +2280,7 @@ var PreviewRadio2 = ({ question, activatedLanguage }) => {
2298
2280
  {
2299
2281
  className: "pts-radioMultipleWithInfo2-preview pts-root-answer",
2300
2282
  id: `answer-${previewId}`,
2301
- children: questionAnswer.length > 0 ? questionAnswer : question.answer
2283
+ children: question.answer
2302
2284
  }
2303
2285
  ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2304
2286
  "dd",
@@ -2437,17 +2419,16 @@ var CustomDropdownStandard = ({
2437
2419
  ),
2438
2420
  hasOptionInfoText && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(OptionTextBody_default, { ...optionTextProps })
2439
2421
  ] }),
2440
- showPreview && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PreviewDropdown, { question, activatedLanguage })
2422
+ showPreview && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PreviewDropdown, { question })
2441
2423
  ] });
2442
2424
  };
2443
2425
  var DropdownStandard_default = CustomDropdownStandard;
2444
- var PreviewDropdown = ({ question, activatedLanguage }) => {
2426
+ var PreviewDropdown = ({ question, activatedLanguage = "sv" }) => {
2445
2427
  var _a, _b;
2446
2428
  const previewId = `preview-${question.id}`;
2447
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2448
2429
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2449
2430
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
2450
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dd", { className: "pts-dropdown-preview pts-root-answer", id: `answer-${previewId}`, children: questionAnswer.length > 0 ? questionAnswer : question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2431
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("dd", { className: "pts-dropdown-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2451
2432
  "dd",
2452
2433
  {
2453
2434
  className: "pts-dropdown-preview pts-root-answer no-answer-preview-page",
@@ -3203,8 +3184,7 @@ var QuestionRenderer = ({
3203
3184
  {
3204
3185
  question,
3205
3186
  handleQuestionInputChange,
3206
- showPreview,
3207
- activatedLanguage
3187
+ showPreview
3208
3188
  }
3209
3189
  ),
3210
3190
  question.questionType === "RadioWithInfo" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
@@ -3212,8 +3192,7 @@ var QuestionRenderer = ({
3212
3192
  {
3213
3193
  question,
3214
3194
  handleQuestionInputChange,
3215
- showPreview,
3216
- activatedLanguage
3195
+ showPreview
3217
3196
  }
3218
3197
  ),
3219
3198
  question.questionType === "TextField" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
@@ -3267,8 +3246,7 @@ var QuestionRenderer = ({
3267
3246
  {
3268
3247
  question,
3269
3248
  handleQuestionInputChange,
3270
- showPreview,
3271
- activatedLanguage
3249
+ showPreview
3272
3250
  }
3273
3251
  ),
3274
3252
  question.questionType === "InfoOnly" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
@@ -3462,7 +3440,7 @@ var CookieBanner_default = CookieBanner;
3462
3440
 
3463
3441
  // src/components/layout/FooterStandard/FooterStandard.tsx
3464
3442
  var import_jsx_runtime27 = require("react/jsx-runtime");
3465
- var Footer = ({ activatedLanguage = "sv" }) => {
3443
+ var Footer = ({ activatedLanguage = "sv", appUsesCookies = false, openCookieBanner }) => {
3466
3444
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("footer", { className: "pts-footer-container", children: [
3467
3445
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "pts-footer-slogan-text-container", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "pts-footer-slogan-text", children: activatedLanguage === "sv" ? "S\xE4ker och tillg\xE4nglig kommunikation f\xF6r Sverige" : "Secure and accessible communication for Sweden" }) }),
3468
3446
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "pts-footer-content", children: [
@@ -3531,7 +3509,19 @@ var Footer = ({ activatedLanguage = "sv" }) => {
3531
3509
  ]
3532
3510
  }
3533
3511
  ) }),
3534
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3512
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: appUsesCookies ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3513
+ "button",
3514
+ {
3515
+ type: "button",
3516
+ "aria-controls": "cookie-banner",
3517
+ onClick: openCookieBanner,
3518
+ className: "pts-footer-button",
3519
+ children: [
3520
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens cookie banner)" : "PTS Kakor (\xF6ppnar kakbanner)" }),
3521
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
3522
+ ]
3523
+ }
3524
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3535
3525
  "a",
3536
3526
  {
3537
3527
  href: activatedLanguage === "en" ? "https://pts.se/en/cookies-eservices" : "https://www.pts.se/kakor-etjanster",