optimized-react-component-library-xyz123 0.23.5 → 0.23.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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// src/components/input-components/InfoTextStandard/InfoTextStandard.tsx
|
|
2
2
|
import DOMPurify from "dompurify";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var InfoTextStandard = ({
|
|
4
|
+
var InfoTextStandard = ({ infoText, selectedValue, questionId, activatedLanguage }) => {
|
|
5
5
|
return /* @__PURE__ */ jsx(
|
|
6
6
|
"div",
|
|
7
7
|
{
|
|
8
|
-
id:
|
|
8
|
+
id: `textinfo-${questionId}-${selectedValue}`,
|
|
9
9
|
"aria-live": "polite",
|
|
10
10
|
"aria-atomic": "true",
|
|
11
|
-
children:
|
|
12
|
-
/* @__PURE__ */ jsx("h2", { className: "sr-only", children: activatedLanguage === "
|
|
11
|
+
children: infoText.length > 0 && /* @__PURE__ */ jsxs("div", { id: questionId, className: "pts-root-question pts-infoTextdStandard-container", children: [
|
|
12
|
+
/* @__PURE__ */ jsx("h2", { className: "sr-only", children: activatedLanguage === "en" ? `Information about selected alternative - ${selectedValue}` : `Information om valt alternativ - ${selectedValue}` }),
|
|
13
13
|
/* @__PURE__ */ jsx(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
id: questionId,
|
|
17
17
|
dangerouslySetInnerHTML: {
|
|
18
|
-
__html: DOMPurify.sanitize(
|
|
18
|
+
__html: DOMPurify.sanitize(infoText != null ? infoText : "")
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
)
|
|
@@ -30,25 +30,22 @@ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
30
30
|
var InputRadio = ({
|
|
31
31
|
question,
|
|
32
32
|
handleQuestionInputChange,
|
|
33
|
-
showPreview = false
|
|
33
|
+
showPreview = false,
|
|
34
|
+
activatedLanguage = "sv"
|
|
34
35
|
}) => {
|
|
35
|
-
var _a, _b, _c, _d
|
|
36
|
+
var _a, _b, _c, _d;
|
|
36
37
|
const questionId = `question-${question.id}`;
|
|
37
38
|
const groupId = `radio-group-${question.id}`;
|
|
38
39
|
const errorId = `error-${question.id}`;
|
|
40
|
+
const handleInputChange = (event) => {
|
|
41
|
+
const e = { target: { value: event.target.value } };
|
|
42
|
+
handleQuestionInputChange(e, question);
|
|
43
|
+
};
|
|
39
44
|
const languageObj = question.languageSupport[0];
|
|
40
45
|
var optionsInfoText = [];
|
|
41
46
|
if ("optionsInfoText" in languageObj) {
|
|
42
47
|
optionsInfoText = languageObj.optionsInfoText;
|
|
43
|
-
console.log(languageObj.optionsInfoText, "q", optionsInfoText, question);
|
|
44
48
|
}
|
|
45
|
-
console.log((_a = optionsInfoText.find(
|
|
46
|
-
(op) => op.value === question.answer
|
|
47
|
-
)) == null ? void 0 : _a.text, question.answer);
|
|
48
|
-
const handleInputChange = (event) => {
|
|
49
|
-
const e = { target: { value: event.target.value } };
|
|
50
|
-
handleQuestionInputChange(e, question);
|
|
51
|
-
};
|
|
52
49
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
53
50
|
!showPreview && question.visible && /* @__PURE__ */ jsxs2("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: [
|
|
54
51
|
/* @__PURE__ */ jsxs2(
|
|
@@ -63,7 +60,7 @@ var InputRadio = ({
|
|
|
63
60
|
" ",
|
|
64
61
|
question.isQuestionMandatory && /* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
65
62
|
] }),
|
|
66
|
-
(
|
|
63
|
+
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ jsxs2("div", { className: "pts-radio-option", children: [
|
|
67
64
|
/* @__PURE__ */ jsx2(
|
|
68
65
|
"input",
|
|
69
66
|
{
|
|
@@ -72,8 +69,7 @@ var InputRadio = ({
|
|
|
72
69
|
id: `${groupId}-option-${index}`,
|
|
73
70
|
value: option.value,
|
|
74
71
|
checked: question.answer === option.value,
|
|
75
|
-
onChange: handleInputChange
|
|
76
|
-
"aria-describedby": "about_" + option.value
|
|
72
|
+
onChange: handleInputChange
|
|
77
73
|
}
|
|
78
74
|
),
|
|
79
75
|
/* @__PURE__ */ jsx2("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
|
|
@@ -90,9 +86,10 @@ var InputRadio = ({
|
|
|
90
86
|
optionsInfoText.length > 0 && /* @__PURE__ */ jsx2(
|
|
91
87
|
InfoTextStandard_default,
|
|
92
88
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
questionId
|
|
89
|
+
infoText: (_c = (_b = optionsInfoText.find((op) => op.selectedValue === question.answer)) == null ? void 0 : _b.infoText) != null ? _c : "",
|
|
90
|
+
selectedValue: (_d = question.answer) != null ? _d : "",
|
|
91
|
+
questionId,
|
|
92
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
96
93
|
}
|
|
97
94
|
)
|
|
98
95
|
] }),
|