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.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -83,21 +83,21 @@ module.exports = __toCommonJS(index_exports);
|
|
|
83
83
|
// src/components/input-components/InfoTextStandard/InfoTextStandard.tsx
|
|
84
84
|
var import_dompurify = __toESM(require("dompurify"));
|
|
85
85
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
86
|
-
var InfoTextStandard = ({
|
|
86
|
+
var InfoTextStandard = ({ infoText, selectedValue, questionId, activatedLanguage }) => {
|
|
87
87
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
88
|
"div",
|
|
89
89
|
{
|
|
90
|
-
id:
|
|
90
|
+
id: `textinfo-${questionId}-${selectedValue}`,
|
|
91
91
|
"aria-live": "polite",
|
|
92
92
|
"aria-atomic": "true",
|
|
93
|
-
children:
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "sr-only", children: activatedLanguage === "
|
|
93
|
+
children: infoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { id: questionId, className: "pts-root-question pts-infoTextdStandard-container", children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "sr-only", children: activatedLanguage === "en" ? `Information about selected alternative - ${selectedValue}` : `Information om valt alternativ - ${selectedValue}` }),
|
|
95
95
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
98
|
id: questionId,
|
|
99
99
|
dangerouslySetInnerHTML: {
|
|
100
|
-
__html: import_dompurify.default.sanitize(
|
|
100
|
+
__html: import_dompurify.default.sanitize(infoText != null ? infoText : "")
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
)
|
|
@@ -112,25 +112,22 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
112
112
|
var InputRadio = ({
|
|
113
113
|
question,
|
|
114
114
|
handleQuestionInputChange,
|
|
115
|
-
showPreview = false
|
|
115
|
+
showPreview = false,
|
|
116
|
+
activatedLanguage = "sv"
|
|
116
117
|
}) => {
|
|
117
|
-
var _a, _b, _c, _d
|
|
118
|
+
var _a, _b, _c, _d;
|
|
118
119
|
const questionId = `question-${question.id}`;
|
|
119
120
|
const groupId = `radio-group-${question.id}`;
|
|
120
121
|
const errorId = `error-${question.id}`;
|
|
122
|
+
const handleInputChange = (event) => {
|
|
123
|
+
const e = { target: { value: event.target.value } };
|
|
124
|
+
handleQuestionInputChange(e, question);
|
|
125
|
+
};
|
|
121
126
|
const languageObj = question.languageSupport[0];
|
|
122
127
|
var optionsInfoText = [];
|
|
123
128
|
if ("optionsInfoText" in languageObj) {
|
|
124
129
|
optionsInfoText = languageObj.optionsInfoText;
|
|
125
|
-
console.log(languageObj.optionsInfoText, "q", optionsInfoText, question);
|
|
126
130
|
}
|
|
127
|
-
console.log((_a = optionsInfoText.find(
|
|
128
|
-
(op) => op.value === question.answer
|
|
129
|
-
)) == null ? void 0 : _a.text, question.answer);
|
|
130
|
-
const handleInputChange = (event) => {
|
|
131
|
-
const e = { target: { value: event.target.value } };
|
|
132
|
-
handleQuestionInputChange(e, question);
|
|
133
|
-
};
|
|
134
131
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
135
132
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: [
|
|
136
133
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -145,7 +142,7 @@ var InputRadio = ({
|
|
|
145
142
|
" ",
|
|
146
143
|
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
147
144
|
] }),
|
|
148
|
-
(
|
|
145
|
+
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-radio-option", children: [
|
|
149
146
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
150
147
|
"input",
|
|
151
148
|
{
|
|
@@ -154,8 +151,7 @@ var InputRadio = ({
|
|
|
154
151
|
id: `${groupId}-option-${index}`,
|
|
155
152
|
value: option.value,
|
|
156
153
|
checked: question.answer === option.value,
|
|
157
|
-
onChange: handleInputChange
|
|
158
|
-
"aria-describedby": "about_" + option.value
|
|
154
|
+
onChange: handleInputChange
|
|
159
155
|
}
|
|
160
156
|
),
|
|
161
157
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
|
|
@@ -172,9 +168,10 @@ var InputRadio = ({
|
|
|
172
168
|
optionsInfoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
173
169
|
InfoTextStandard_default,
|
|
174
170
|
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
questionId
|
|
171
|
+
infoText: (_c = (_b = optionsInfoText.find((op) => op.selectedValue === question.answer)) == null ? void 0 : _b.infoText) != null ? _c : "",
|
|
172
|
+
selectedValue: (_d = question.answer) != null ? _d : "",
|
|
173
|
+
questionId,
|
|
174
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
178
175
|
}
|
|
179
176
|
)
|
|
180
177
|
] }),
|