optimized-react-component-library-xyz123 2.12.4 → 2.12.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.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",
@@ -1322,6 +1305,7 @@ __export(icons_exports, {
1322
1305
  ChevronRightIcon: () => ChevronRightIcon,
1323
1306
  CloseIcon: () => CloseIcon,
1324
1307
  CollapseIcon: () => CollapseIcon,
1308
+ Cookie_icon: () => Cookie_icon,
1325
1309
  ExpandIcon: () => ExpandIcon,
1326
1310
  FileIcon: () => FileIcon,
1327
1311
  LanguageIcon: () => LanguageIcon,
@@ -1907,6 +1891,13 @@ var Logo_en = () => /* @__PURE__ */ jsxs13(
1907
1891
  ]
1908
1892
  }
1909
1893
  );
1894
+ var Cookie_icon = () => /* @__PURE__ */ jsx16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "13", height: "16", viewBox: "0 0 13 16", fill: "none", children: /* @__PURE__ */ jsx16(
1895
+ "path",
1896
+ {
1897
+ d: "M4.67907 11.2981H8.32186C8.53419 11.2981 8.71217 11.228 8.85579 11.0878C8.9994 10.9476 9.07121 10.7736 9.07121 10.5658V7.91662C9.07121 7.70938 8.9994 7.53567 8.85579 7.39549C8.71217 7.25532 8.53388 7.18523 8.32093 7.18523H8.16029V6.27892C8.16029 5.82637 8.00243 5.44572 7.68671 5.13697C7.371 4.82882 6.98131 4.67475 6.51764 4.67475C6.05398 4.67475 5.66429 4.82882 5.34857 5.13697C5.03286 5.44511 4.875 5.82576 4.875 6.27892V7.18523H4.67814C4.46581 7.18523 4.28783 7.25532 4.14421 7.39549C4.0006 7.53567 3.92879 7.70938 3.92879 7.91662V10.5658C3.92879 10.7736 4.0006 10.9476 4.14421 11.0878C4.28783 11.228 4.46612 11.2981 4.67907 11.2981ZM5.58907 7.18523V6.27892C5.58907 6.02213 5.67821 5.80673 5.8565 5.63272C6.03479 5.45871 6.25517 5.3717 6.51764 5.3717C6.78012 5.3717 7.00081 5.45871 7.17971 5.63272C7.35862 5.80673 7.44745 6.02213 7.44621 6.27892V7.18523H5.58907ZM6.2335 15.9773C6.14064 15.9622 6.05398 15.9396 5.9735 15.9094C4.14607 15.2296 2.69379 14.0768 1.61664 12.4509C0.5395 10.825 0.000619048 9.06491 0 7.17073V3.289C0 2.97844 0.0906907 2.69869 0.272072 2.44976C0.452834 2.20082 0.687143 2.02047 0.975 1.90869L5.97536 0.0960688C6.15612 0.0320229 6.331 0 6.5 0C6.669 0 6.84419 0.0320229 7.02557 0.0960688L12.025 1.90869C12.3122 2.02107 12.5465 2.20143 12.7279 2.44976C12.9093 2.69869 13 2.97844 13 3.289V7.17073C13 9.06491 12.4614 10.825 11.3843 12.4509C10.3071 14.0768 8.85486 15.2296 7.02743 15.9094C6.94633 15.9396 6.85936 15.9622 6.7665 15.9773C6.67364 15.9924 6.58481 16 6.5 16C6.41519 16 6.32636 15.9924 6.2335 15.9773ZM6.5 15.1463C8.10952 14.6478 9.44048 13.6508 10.4929 12.1554C11.5452 10.66 12.0714 8.99845 12.0714 7.17073V3.27178C12.0714 3.15577 12.0386 3.05124 11.973 2.9582C11.908 2.86515 11.8158 2.79567 11.6963 2.74975L6.69686 0.937125C6.63743 0.912957 6.57181 0.900873 6.5 0.900873C6.42819 0.900873 6.36257 0.912957 6.30314 0.937125L1.30371 2.74975C1.18424 2.79567 1.092 2.86515 1.027 2.9582C0.961381 3.05124 0.928571 3.15577 0.928571 3.27178V7.17073C0.928571 8.99845 1.45476 10.66 2.50714 12.1554C3.55952 13.6508 4.89048 14.6478 6.5 15.1463Z",
1898
+ fill: "white"
1899
+ }
1900
+ ) });
1910
1901
 
1911
1902
  // src/components/layout/AlertInTextStandard/AlertInTextStandard.tsx
1912
1903
  import DOMPurify5 from "dompurify";
@@ -2195,14 +2186,13 @@ var RadioWithInfo = ({
2195
2186
  ]
2196
2187
  }
2197
2188
  ) }),
2198
- showPreview && /* @__PURE__ */ jsx21(PreviewRadio2, { question, activatedLanguage })
2189
+ showPreview && /* @__PURE__ */ jsx21(PreviewRadio2, { question })
2199
2190
  ] });
2200
2191
  };
2201
2192
  var RadioMultipleWithInfo2Standard_default = RadioWithInfo;
2202
- var PreviewRadio2 = ({ question, activatedLanguage }) => {
2193
+ var PreviewRadio2 = ({ question }) => {
2203
2194
  var _a, _b;
2204
2195
  const previewId = `preview-${question.id}`;
2205
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2206
2196
  return /* @__PURE__ */ jsxs17(Fragment14, { children: [
2207
2197
  /* @__PURE__ */ jsx21("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
2208
2198
  ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx21(
@@ -2210,7 +2200,7 @@ var PreviewRadio2 = ({ question, activatedLanguage }) => {
2210
2200
  {
2211
2201
  className: "pts-radioMultipleWithInfo2-preview pts-root-answer",
2212
2202
  id: `answer-${previewId}`,
2213
- children: questionAnswer.length > 0 ? questionAnswer : question.answer
2203
+ children: question.answer
2214
2204
  }
2215
2205
  ) : /* @__PURE__ */ jsx21(
2216
2206
  "dd",
@@ -2349,17 +2339,16 @@ var CustomDropdownStandard = ({
2349
2339
  ),
2350
2340
  hasOptionInfoText && /* @__PURE__ */ jsx23(OptionTextBody_default, { ...optionTextProps })
2351
2341
  ] }),
2352
- showPreview && /* @__PURE__ */ jsx23(PreviewDropdown, { question, activatedLanguage })
2342
+ showPreview && /* @__PURE__ */ jsx23(PreviewDropdown, { question })
2353
2343
  ] });
2354
2344
  };
2355
2345
  var DropdownStandard_default = CustomDropdownStandard;
2356
- var PreviewDropdown = ({ question, activatedLanguage }) => {
2346
+ var PreviewDropdown = ({ question, activatedLanguage = "sv" }) => {
2357
2347
  var _a, _b;
2358
2348
  const previewId = `preview-${question.id}`;
2359
- const questionAnswer = setPreviewAnswerLabel_default(question, activatedLanguage);
2360
2349
  return /* @__PURE__ */ jsxs19(Fragment16, { children: [
2361
2350
  /* @__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(
2351
+ ((_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
2352
  "dd",
2364
2353
  {
2365
2354
  className: "pts-dropdown-preview pts-root-answer no-answer-preview-page",
@@ -3118,8 +3107,7 @@ var QuestionRenderer = ({
3118
3107
  {
3119
3108
  question,
3120
3109
  handleQuestionInputChange,
3121
- showPreview,
3122
- activatedLanguage
3110
+ showPreview
3123
3111
  }
3124
3112
  ),
3125
3113
  question.questionType === "RadioWithInfo" && /* @__PURE__ */ jsx24(
@@ -3127,8 +3115,7 @@ var QuestionRenderer = ({
3127
3115
  {
3128
3116
  question,
3129
3117
  handleQuestionInputChange,
3130
- showPreview,
3131
- activatedLanguage
3118
+ showPreview
3132
3119
  }
3133
3120
  ),
3134
3121
  question.questionType === "TextField" && /* @__PURE__ */ jsx24(
@@ -3182,8 +3169,7 @@ var QuestionRenderer = ({
3182
3169
  {
3183
3170
  question,
3184
3171
  handleQuestionInputChange,
3185
- showPreview,
3186
- activatedLanguage
3172
+ showPreview
3187
3173
  }
3188
3174
  ),
3189
3175
  question.questionType === "InfoOnly" && /* @__PURE__ */ jsx24(
@@ -3377,7 +3363,11 @@ var CookieBanner_default = CookieBanner;
3377
3363
 
3378
3364
  // src/components/layout/FooterStandard/FooterStandard.tsx
3379
3365
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
3380
- var Footer = ({ activatedLanguage = "sv" }) => {
3366
+ var Footer = ({
3367
+ activatedLanguage = "sv",
3368
+ appUsesCookies = false,
3369
+ openCookieBanner
3370
+ }) => {
3381
3371
  return /* @__PURE__ */ jsxs23("footer", { className: "pts-footer-container", children: [
3382
3372
  /* @__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" }) }),
3383
3373
  /* @__PURE__ */ jsxs23("div", { className: "pts-footer-content", children: [
@@ -3446,7 +3436,20 @@ var Footer = ({ activatedLanguage = "sv" }) => {
3446
3436
  ]
3447
3437
  }
3448
3438
  ) }),
3449
- /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs23(
3439
+ /* @__PURE__ */ jsx27("li", { children: appUsesCookies ? /* @__PURE__ */ jsxs23(
3440
+ "button",
3441
+ {
3442
+ type: "button",
3443
+ "aria-controls": "cookie-banner",
3444
+ onClick: openCookieBanner,
3445
+ className: "pts-footer-button pts-secondary-button",
3446
+ children: [
3447
+ /* @__PURE__ */ jsx27("span", { className: "sr-only", children: activatedLanguage === "en" ? "PTS Cookies (opens cookie banner)" : "PTS Kakor (\xF6ppnar kakbanner)" }),
3448
+ /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: "secondary_icon", children: /* @__PURE__ */ jsx27(Cookie_icon, {}) }),
3449
+ /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", children: activatedLanguage === "en" ? "Cookies" : "Kakor" })
3450
+ ]
3451
+ }
3452
+ ) : /* @__PURE__ */ jsxs23(
3450
3453
  "a",
3451
3454
  {
3452
3455
  href: activatedLanguage === "en" ? "https://pts.se/en/cookies-eservices" : "https://www.pts.se/kakor-etjanster",
@@ -3876,7 +3879,7 @@ var Header = ({
3876
3879
  "button",
3877
3880
  {
3878
3881
  lang: activatedLanguage === "en" ? "en" : "sv",
3879
- className: "pts-languageButton",
3882
+ className: "pts-languageButton pts-secondary-button",
3880
3883
  onClick: handleLanguageClick,
3881
3884
  children: [
3882
3885
  /* @__PURE__ */ jsx29("div", { className: "languageIcon", children: /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29(LanguageIcon2, {}) }) }),
@@ -3924,12 +3927,10 @@ var Navigation = ({
3924
3927
  setOpenSubMenu(null);
3925
3928
  return;
3926
3929
  }
3927
- const defaultOpenSubMenu = activePath == null ? null : (_b = (_a = menuLinks.find(
3928
- (link) => {
3929
- var _a2;
3930
- return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.includes(activePath));
3931
- }
3932
- )) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
3930
+ const defaultOpenSubMenu = activePath == null ? null : (_b = (_a = menuLinks.find((link) => {
3931
+ var _a2;
3932
+ return (_a2 = link.children) == null ? void 0 : _a2.some((child) => child.href.includes(activePath));
3933
+ })) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
3933
3934
  setOpenSubMenu(defaultOpenSubMenu);
3934
3935
  }, [isOpen, activePath, menuLinks, activatedLanguage]);
3935
3936
  useEffect13(() => {
@@ -4010,7 +4011,7 @@ var Navigation = ({
4010
4011
  /* @__PURE__ */ jsx30("div", { className: "pts-navigation-close-container ", id: "menu-close", children: /* @__PURE__ */ jsxs26(
4011
4012
  "button",
4012
4013
  {
4013
- className: "pts-navigation-close-button",
4014
+ className: "pts-navigation-close-button pts-secondary-button",
4014
4015
  onClick: () => handleMenuClick("close"),
4015
4016
  type: "button",
4016
4017
  children: [
@@ -4026,14 +4027,7 @@ var Navigation = ({
4026
4027
  lang: activatedLanguage,
4027
4028
  children: [
4028
4029
  /* @__PURE__ */ jsx30("div", { children: /* @__PURE__ */ jsxs26("div", { className: "pts-navigation-button", children: [
4029
- /* @__PURE__ */ jsx30("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx30("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx30(
4030
- LinkComponent,
4031
- {
4032
- onClick: () => handleMenuClick("link"),
4033
- href,
4034
- children: label[activatedLanguage]
4035
- }
4036
- ) }),
4030
+ /* @__PURE__ */ jsx30("span", { children: href && href.length === 0 ? /* @__PURE__ */ jsx30("span", { children: label[activatedLanguage] }) : /* @__PURE__ */ jsx30(LinkComponent, { onClick: () => handleMenuClick("link"), href, children: label[activatedLanguage] }) }),
4037
4031
  children && /* @__PURE__ */ jsx30(
4038
4032
  "button",
4039
4033
  {
@@ -4056,14 +4050,15 @@ var Navigation = ({
4056
4050
  className: "pts-sub-navigation-container",
4057
4051
  id: "sub-menu-" + index,
4058
4052
  role: "region",
4059
- children: /* @__PURE__ */ jsx30("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ jsx30("li", { className: "pts-sub-navigation-item", lang: activatedLanguage, children: /* @__PURE__ */ jsx30(
4060
- LinkComponent,
4053
+ children: /* @__PURE__ */ jsx30("ul", { className: "pts-sub-navigation-list", lang: activatedLanguage, children: children.map(({ label: label2, href: href2 }, index2) => /* @__PURE__ */ jsx30(
4054
+ "li",
4061
4055
  {
4062
- onClick: () => handleMenuClick("link"),
4063
- href: href2,
4064
- children: label2[activatedLanguage]
4065
- }
4066
- ) }, "nav-child-" + index2)) })
4056
+ className: "pts-sub-navigation-item",
4057
+ lang: activatedLanguage,
4058
+ children: /* @__PURE__ */ jsx30(LinkComponent, { onClick: () => handleMenuClick("link"), href: href2, children: label2[activatedLanguage] })
4059
+ },
4060
+ "nav-child-" + index2
4061
+ )) })
4067
4062
  }
4068
4063
  )
4069
4064
  ]
@@ -4130,7 +4125,7 @@ import { Fragment as Fragment21, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-
4130
4125
  var NavigationHeader = ({
4131
4126
  headline = void 0,
4132
4127
  homelink = "",
4133
- //??
4128
+ //??
4134
4129
  activatedLanguage = "sv",
4135
4130
  useLanguage = false,
4136
4131
  useNavigationMenu = true,
@@ -4204,14 +4199,23 @@ var NavigationHeader = ({
4204
4199
  ) }),
4205
4200
  /* @__PURE__ */ jsx33("div", { className: `${hasHeadline ? "pts-navigation-header-headline-container" : ""}`, children: hasHeadline && /* @__PURE__ */ jsx33("div", { className: "pts-site-headline", children: headline }) }),
4206
4201
  /* @__PURE__ */ jsx33("div", { className: "pts-navigation-header-nav-container", children: (useLanguage || useNavigationMenu || useSearch) && /* @__PURE__ */ jsxs29(Fragment21, { children: [
4207
- useSearch && !isMenuOpen && /* @__PURE__ */ jsx33(Fragment21, { children: /* @__PURE__ */ jsxs29("button", { type: "button", onClick: handleSearchClick, children: [
4208
- /* @__PURE__ */ jsx33("span", { "aria-hidden": "true", className: "pts-navigation-header-icons", children: getSearchIcon() }),
4209
- /* @__PURE__ */ jsx33("span", { className: "pts-navigation-header-button-label", children: getSearchLabel() })
4210
- ] }) }),
4202
+ useSearch && !isMenuOpen && /* @__PURE__ */ jsx33(Fragment21, { children: /* @__PURE__ */ jsxs29(
4203
+ "button",
4204
+ {
4205
+ type: "button",
4206
+ className: "pts-secondary-button",
4207
+ onClick: handleSearchClick,
4208
+ children: [
4209
+ /* @__PURE__ */ jsx33("span", { "aria-hidden": "true", className: "pts-navigation-header-icons", children: getSearchIcon() }),
4210
+ /* @__PURE__ */ jsx33("span", { className: "pts-navigation-header-button-label", children: getSearchLabel() })
4211
+ ]
4212
+ }
4213
+ ) }),
4211
4214
  useLanguage && !isMenuOpen && /* @__PURE__ */ jsxs29(
4212
4215
  "button",
4213
4216
  {
4214
4217
  type: "button",
4218
+ className: "pts-secondary-button",
4215
4219
  lang: activatedLanguage === "en" ? "en" : "sv",
4216
4220
  onClick: handleLanguageClick,
4217
4221
  "aria-label": activatedLanguage === "sv" ? "Change language to English" : "\xC4ndra spr\xE5k till svenska",
@@ -4225,12 +4229,20 @@ var NavigationHeader = ({
4225
4229
  "button",
4226
4230
  {
4227
4231
  type: "button",
4232
+ className: "pts-secondary-button",
4228
4233
  onClick: handleMenuClick,
4229
4234
  "aria-expanded": isMenuOpen,
4230
4235
  "aria-controls": "main-navigation",
4231
4236
  ref: menuButtonFocusRef,
4232
4237
  children: [
4233
- /* @__PURE__ */ jsx33("span", { "aria-hidden": "true", className: isMenuOpen ? "pts-close-icon" : "pts-open-icon", children: getMenuIcon() }),
4238
+ /* @__PURE__ */ jsx33(
4239
+ "span",
4240
+ {
4241
+ "aria-hidden": "true",
4242
+ className: isMenuOpen ? "pts-close-icon" : "pts-open-icon",
4243
+ children: getMenuIcon()
4244
+ }
4245
+ ),
4234
4246
  /* @__PURE__ */ jsx33("span", { className: "pts-navigation-header-button-label", children: getMenuLabel() })
4235
4247
  ]
4236
4248
  }