optimized-react-component-library-xyz123 0.26.6 → 0.26.8
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 +1 -10
- package/dist/index.d.ts +1 -10
- package/dist/index.js +37 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -2
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
var InputRadio = ({
|
|
4
4
|
question,
|
|
5
5
|
handleQuestionInputChange,
|
|
6
|
-
showPreview = false
|
|
7
|
-
activatedLanguage = "sv"
|
|
6
|
+
showPreview = false
|
|
8
7
|
}) => {
|
|
9
8
|
var _a;
|
|
10
9
|
const questionId = `question-${question.id}`;
|
|
@@ -50,11 +49,11 @@ var InputRadio = ({
|
|
|
50
49
|
]
|
|
51
50
|
}
|
|
52
51
|
) }),
|
|
53
|
-
showPreview && /* @__PURE__ */ jsx(PreviewRadio, { question
|
|
52
|
+
showPreview && /* @__PURE__ */ jsx(PreviewRadio, { question })
|
|
54
53
|
] });
|
|
55
54
|
};
|
|
56
55
|
var RadioMultipleStandard_default = InputRadio;
|
|
57
|
-
var PreviewRadio = ({ question
|
|
56
|
+
var PreviewRadio = ({ question }) => {
|
|
58
57
|
var _a, _b;
|
|
59
58
|
const previewId = `preview-${question.id}`;
|
|
60
59
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -64,7 +63,7 @@ var PreviewRadio = ({ question, activatedLanguage }) => {
|
|
|
64
63
|
{
|
|
65
64
|
className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
|
|
66
65
|
id: `answer-${previewId}`,
|
|
67
|
-
children:
|
|
66
|
+
children: "Inget svar"
|
|
68
67
|
}
|
|
69
68
|
)
|
|
70
69
|
] });
|
|
@@ -86,17 +85,17 @@ var MultipleCheckboxes = ({
|
|
|
86
85
|
var _a2;
|
|
87
86
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
88
87
|
var _a3;
|
|
89
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
90
|
-
}).map((option) => option.
|
|
88
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
|
|
89
|
+
}).map((option) => option.label)) || [];
|
|
91
90
|
console.log("Initial values:", initialValues);
|
|
92
91
|
setCheckedValues(initialValues);
|
|
93
92
|
}, [question.answer, question.options]);
|
|
94
|
-
const handleInputChange = (event,
|
|
93
|
+
const handleInputChange = (event, optionValue) => {
|
|
95
94
|
let updatedValues = [...checkedValues];
|
|
96
|
-
if (updatedValues.includes(
|
|
97
|
-
updatedValues = updatedValues.filter((val) => val !==
|
|
95
|
+
if (updatedValues.includes(optionValue)) {
|
|
96
|
+
updatedValues = updatedValues.filter((val) => val !== optionValue);
|
|
98
97
|
} else {
|
|
99
|
-
updatedValues.push(
|
|
98
|
+
updatedValues.push(optionValue);
|
|
100
99
|
}
|
|
101
100
|
setCheckedValues(updatedValues);
|
|
102
101
|
const e = { target: { value: updatedValues.toString() } };
|
|
@@ -118,9 +117,9 @@ var MultipleCheckboxes = ({
|
|
|
118
117
|
type: "checkbox",
|
|
119
118
|
name: `${question.id}-option`,
|
|
120
119
|
id: `${question.id}-option-${index}`,
|
|
121
|
-
value: option.
|
|
122
|
-
checked: checkedValues.includes(option.
|
|
123
|
-
onChange: (e) => handleInputChange(e, option.
|
|
120
|
+
value: option.label,
|
|
121
|
+
checked: checkedValues.includes(option.label),
|
|
122
|
+
onChange: (e) => handleInputChange(e, option.label),
|
|
124
123
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
125
124
|
}
|
|
126
125
|
),
|
|
@@ -142,7 +141,7 @@ var PrevieMultipleCheckboxes = ({
|
|
|
142
141
|
/* @__PURE__ */ jsx2("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
143
142
|
question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ jsx2("dd", { children: question.options[0].label }) : /* @__PURE__ */ jsx2("dd", { children: /* @__PURE__ */ jsx2("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
|
|
144
143
|
var _a2;
|
|
145
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
144
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
|
|
146
145
|
}).map((option, index) => /* @__PURE__ */ jsx2("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ jsx2("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
|
|
147
146
|
" "
|
|
148
147
|
] });
|
|
@@ -166,8 +165,8 @@ var CheckboxGroup = ({
|
|
|
166
165
|
var _a2;
|
|
167
166
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
168
167
|
var _a3;
|
|
169
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
170
|
-
}).map((option) => option.
|
|
168
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
|
|
169
|
+
}).map((option) => option.label)) || [];
|
|
171
170
|
setCheckedValues(initialValues);
|
|
172
171
|
}, [question.answer, question.options]);
|
|
173
172
|
const handleInputChange = (event, optionValue) => {
|
|
@@ -201,9 +200,9 @@ var CheckboxGroup = ({
|
|
|
201
200
|
type: "checkbox",
|
|
202
201
|
name: `name-${question.id}`,
|
|
203
202
|
id: `${groupId}-option-${index}`,
|
|
204
|
-
value: option.
|
|
205
|
-
checked: checkedValues.includes(option.
|
|
206
|
-
onChange: (e) => handleInputChange(e, option.
|
|
203
|
+
value: option.label,
|
|
204
|
+
checked: checkedValues.includes(option.label),
|
|
205
|
+
onChange: (e) => handleInputChange(e, option.label),
|
|
207
206
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
208
207
|
}
|
|
209
208
|
),
|
|
@@ -231,7 +230,7 @@ var PreviewCheckboxGroup = ({
|
|
|
231
230
|
/* @__PURE__ */ jsx3("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
232
231
|
question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ jsx3("dd", { children: question.options[0].label }) : /* @__PURE__ */ jsx3("dd", { children: /* @__PURE__ */ jsx3("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
|
|
233
232
|
var _a2;
|
|
234
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
233
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
|
|
235
234
|
}).map((option, index) => /* @__PURE__ */ jsx3("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ jsx3("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
|
|
236
235
|
" "
|
|
237
236
|
] });
|
|
@@ -702,7 +701,7 @@ var SelectedFiles = ({
|
|
|
702
701
|
}
|
|
703
702
|
) })
|
|
704
703
|
] }) }),
|
|
705
|
-
questionObject.files.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "fileListUnorderedList", "aria-label":
|
|
704
|
+
questionObject.files.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
706
705
|
const indicatorfileName = file.FileName;
|
|
707
706
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
708
707
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
@@ -1197,7 +1196,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
|
|
|
1197
1196
|
let translatedAnswer = question.answer;
|
|
1198
1197
|
if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
|
|
1199
1198
|
const answerNormalized = normalize(question.answer);
|
|
1200
|
-
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.
|
|
1199
|
+
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.label))).map((option) => `^${option.id}^`);
|
|
1201
1200
|
if (matchingIds.length > 0) {
|
|
1202
1201
|
translatedAnswer = matchingIds.join(",");
|
|
1203
1202
|
}
|
|
@@ -1991,8 +1990,7 @@ var CookieBanner = ({
|
|
|
1991
1990
|
onCookieStateChange,
|
|
1992
1991
|
onClose,
|
|
1993
1992
|
acceptCookies,
|
|
1994
|
-
rejectCookies
|
|
1995
|
-
activatedLanguage = "sv"
|
|
1993
|
+
rejectCookies
|
|
1996
1994
|
}) => {
|
|
1997
1995
|
if (!visible) return null;
|
|
1998
1996
|
const handleCookieChoice = (accepted) => {
|
|
@@ -2019,13 +2017,8 @@ var CookieBanner = ({
|
|
|
2019
2017
|
id: "cookie-banner",
|
|
2020
2018
|
tabIndex: -1,
|
|
2021
2019
|
children: /* @__PURE__ */ jsxs13("div", { className: "content", children: [
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
|
|
2024
|
-
activatedLanguage === "en" ? "Cookies" : "Kakor (cookies)"
|
|
2025
|
-
] }),
|
|
2026
|
-
/* @__PURE__ */ jsx15("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.
|
|
2027
|
-
Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt
|
|
2028
|
-
samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen.` }),
|
|
2020
|
+
/* @__PURE__ */ jsx15("h3", { id: "cookie-banner-title", children: "Kakor (cookies)" }),
|
|
2021
|
+
/* @__PURE__ */ jsx15("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." }),
|
|
2029
2022
|
/* @__PURE__ */ jsxs13("div", { className: "pts-cookieBanner-Links", children: [
|
|
2030
2023
|
/* @__PURE__ */ jsxs13(
|
|
2031
2024
|
"svg",
|
|
@@ -2054,13 +2047,13 @@ var CookieBanner = ({
|
|
|
2054
2047
|
href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
|
|
2055
2048
|
target: "_blank",
|
|
2056
2049
|
rel: "noopener noreferrer",
|
|
2057
|
-
children:
|
|
2050
|
+
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
|
|
2058
2051
|
}
|
|
2059
2052
|
)
|
|
2060
2053
|
] }),
|
|
2061
2054
|
/* @__PURE__ */ jsxs13("div", { className: "pts-cookieBanner-Buttons", children: [
|
|
2062
|
-
/* @__PURE__ */ jsx15("button", { onClick: () => handleCookieChoice(true), children:
|
|
2063
|
-
/* @__PURE__ */ jsx15("button", { onClick: () => handleCookieChoice(false), children:
|
|
2055
|
+
/* @__PURE__ */ jsx15("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
|
|
2056
|
+
/* @__PURE__ */ jsx15("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
|
|
2064
2057
|
] })
|
|
2065
2058
|
] })
|
|
2066
2059
|
}
|
|
@@ -2608,9 +2601,9 @@ var ModalStandard_default = Modal;
|
|
|
2608
2601
|
|
|
2609
2602
|
// src/components/layout/SkipLinkStandard/SkipLinkStandard.tsx
|
|
2610
2603
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2611
|
-
var SkipLink = (
|
|
2604
|
+
var SkipLink = () => {
|
|
2612
2605
|
function scrollToMainContent() {
|
|
2613
|
-
const container = document.getElementById(`
|
|
2606
|
+
const container = document.getElementById(`main-content`);
|
|
2614
2607
|
if (container) {
|
|
2615
2608
|
container.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
2616
2609
|
container.focus();
|
|
@@ -2624,7 +2617,7 @@ var SkipLink = ({ activatedLanguage = "sv" }) => {
|
|
|
2624
2617
|
e.preventDefault();
|
|
2625
2618
|
scrollToMainContent();
|
|
2626
2619
|
},
|
|
2627
|
-
children:
|
|
2620
|
+
children: "Till huvudinneh\xE5ll"
|
|
2628
2621
|
}
|
|
2629
2622
|
) });
|
|
2630
2623
|
};
|
|
@@ -2856,18 +2849,16 @@ var EditPreviewLinkStandard_default = EditPreviewLink;
|
|
|
2856
2849
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2857
2850
|
var StartApplicationButton = ({
|
|
2858
2851
|
onClick,
|
|
2859
|
-
label,
|
|
2860
|
-
className = ""
|
|
2861
|
-
activatedLanguage = "sv"
|
|
2852
|
+
label = "Starta e-tj\xE4nsten",
|
|
2853
|
+
className = ""
|
|
2862
2854
|
}) => {
|
|
2863
|
-
const defaultLabel = activatedLanguage === "en" ? "Start e-service" : "Starta e-tj\xE4nsten";
|
|
2864
2855
|
return /* @__PURE__ */ jsx25(
|
|
2865
2856
|
"button",
|
|
2866
2857
|
{
|
|
2867
2858
|
type: "button",
|
|
2868
2859
|
className: `pts-forwardButton pts-start-applicationButton ${className}`,
|
|
2869
2860
|
onClick,
|
|
2870
|
-
children: label
|
|
2861
|
+
children: label
|
|
2871
2862
|
}
|
|
2872
2863
|
);
|
|
2873
2864
|
};
|
|
@@ -3026,10 +3017,10 @@ var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
|
|
|
3026
3017
|
|
|
3027
3018
|
// src/components/validation-and-status/FormStatusMessagesScreenReader/FormStatusMessagesScreenReader.tsx
|
|
3028
3019
|
import { Fragment as Fragment17, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3029
|
-
var FormStatusMessagesScreenReader = ({ formStatus
|
|
3020
|
+
var FormStatusMessagesScreenReader = ({ formStatus }) => {
|
|
3030
3021
|
return /* @__PURE__ */ jsxs23(Fragment17, { children: [
|
|
3031
|
-
/* @__PURE__ */ jsx29("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ jsx29("span", { className: "pts-root-mandatoryAsterisk", children:
|
|
3032
|
-
/* @__PURE__ */ jsx29("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ?
|
|
3022
|
+
/* @__PURE__ */ jsx29("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ jsx29("span", { className: "pts-root-mandatoryAsterisk", children: "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
|
|
3023
|
+
/* @__PURE__ */ jsx29("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
|
|
3033
3024
|
] });
|
|
3034
3025
|
};
|
|
3035
3026
|
var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|