optimized-react-component-library-xyz123 2.8.19 → 2.8.21
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 +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +49 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2208,28 +2208,60 @@ var getInfoTextConnectionList = (questionLanguageSupport, language) => {
|
|
|
2208
2208
|
var _a, _b;
|
|
2209
2209
|
return (_b = (_a = questionLanguageSupport.find((item) => (item == null ? void 0 : item.language) === language)) == null ? void 0 : _a.optionsInfoText) != null ? _b : [];
|
|
2210
2210
|
};
|
|
2211
|
+
var setOptionTextBodyProps = (question, activatedLanguage, questionId, errorId) => {
|
|
2212
|
+
var _a, _b, _c, _d;
|
|
2213
|
+
const infoTextId = `infotext-${questionId}`;
|
|
2214
|
+
const optionsInfoText = getInfoTextConnectionList(
|
|
2215
|
+
question.languageSupport,
|
|
2216
|
+
activatedLanguage
|
|
2217
|
+
);
|
|
2218
|
+
const selectedInfo = optionsInfoText.find(
|
|
2219
|
+
(option) => option.selectedValue === question.answer
|
|
2220
|
+
);
|
|
2221
|
+
const selectedLabel = (_c = (_b = (_a = question.options) == null ? void 0 : _a.find(
|
|
2222
|
+
(option) => option.value === question.answer
|
|
2223
|
+
)) == null ? void 0 : _b.label) != null ? _c : "";
|
|
2224
|
+
const hasOptionInfoText = !!(selectedInfo == null ? void 0 : selectedInfo.infoText);
|
|
2225
|
+
const describedBy = [
|
|
2226
|
+
question.hasValidationError ? errorId : null,
|
|
2227
|
+
hasOptionInfoText ? infoTextId : null
|
|
2228
|
+
].filter(Boolean).join(" ");
|
|
2229
|
+
return {
|
|
2230
|
+
describedBy,
|
|
2231
|
+
hasOptionInfoText,
|
|
2232
|
+
props: {
|
|
2233
|
+
optionInfoText: (_d = selectedInfo == null ? void 0 : selectedInfo.infoText) != null ? _d : "",
|
|
2234
|
+
selectedLabel,
|
|
2235
|
+
questionOptionTextId: infoTextId,
|
|
2236
|
+
activatedLanguage,
|
|
2237
|
+
hasOptionInfoText: true
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
};
|
|
2211
2241
|
var OptionTextBody = ({
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2242
|
+
optionInfoText,
|
|
2243
|
+
selectedLabel,
|
|
2244
|
+
questionOptionTextId,
|
|
2215
2245
|
activatedLanguage,
|
|
2216
|
-
|
|
2246
|
+
hasOptionInfoText = false
|
|
2217
2247
|
// hideStepperButtons = false
|
|
2218
2248
|
}) => {
|
|
2219
2249
|
return /* @__PURE__ */ jsx22(Fragment15, { children: /* @__PURE__ */ jsx22(
|
|
2220
2250
|
"div",
|
|
2221
2251
|
{
|
|
2222
|
-
...
|
|
2223
|
-
id: `${
|
|
2224
|
-
"aria-live": "polite",
|
|
2252
|
+
...hasOptionInfoText && {
|
|
2253
|
+
id: `${questionOptionTextId}`,
|
|
2225
2254
|
"aria-atomic": "true"
|
|
2226
2255
|
},
|
|
2227
|
-
children:
|
|
2228
|
-
/* @__PURE__ */
|
|
2256
|
+
children: optionInfoText.length > 0 && /* @__PURE__ */ jsxs18("div", { id: questionOptionTextId + "-placeholder", className: "pts-root-question pts-optionTextBody-container", children: [
|
|
2257
|
+
/* @__PURE__ */ jsxs18("span", { className: "sr-only", children: [
|
|
2258
|
+
selectedLabel,
|
|
2259
|
+
`${activatedLanguage === "en" ? `More information about this option` : `Mer information om detta val`}.`
|
|
2260
|
+
] }),
|
|
2229
2261
|
/* @__PURE__ */ jsx22(
|
|
2230
2262
|
TextBody_default,
|
|
2231
2263
|
{
|
|
2232
|
-
data: { alertInText:
|
|
2264
|
+
data: { alertInText: optionInfoText }
|
|
2233
2265
|
}
|
|
2234
2266
|
)
|
|
2235
2267
|
] })
|
|
@@ -2246,19 +2278,15 @@ var CustomDropdownStandard = ({
|
|
|
2246
2278
|
showPreview = false,
|
|
2247
2279
|
activatedLanguage = "sv"
|
|
2248
2280
|
}) => {
|
|
2249
|
-
var _a, _b, _c
|
|
2281
|
+
var _a, _b, _c;
|
|
2250
2282
|
const questionId = `question-${question.id}`;
|
|
2251
2283
|
const selectId = `select-${question.id}`;
|
|
2252
2284
|
const errorId = `error-${question.id}`;
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
);
|
|
2258
|
-
const describedBy = [
|
|
2259
|
-
question.hasValidationError ? errorId : null,
|
|
2260
|
-
hasInfoText ? infoTextId : null
|
|
2261
|
-
].filter(Boolean).join(" ");
|
|
2285
|
+
const {
|
|
2286
|
+
describedBy,
|
|
2287
|
+
hasOptionInfoText,
|
|
2288
|
+
props: optionTextProps
|
|
2289
|
+
} = setOptionTextBodyProps(question, activatedLanguage, questionId, errorId);
|
|
2262
2290
|
const handleInputChange = (event) => {
|
|
2263
2291
|
const e = { target: { value: event.target.value } };
|
|
2264
2292
|
handleQuestionInputChange(e, question);
|
|
@@ -2297,16 +2325,7 @@ var CustomDropdownStandard = ({
|
|
|
2297
2325
|
activatedLanguage
|
|
2298
2326
|
}
|
|
2299
2327
|
),
|
|
2300
|
-
|
|
2301
|
-
OptionTextBody_default,
|
|
2302
|
-
{
|
|
2303
|
-
infoText: (_e = (_d = optionsInfoText.find((optionI) => optionI.selectedValue === question.answer)) == null ? void 0 : _d.infoText) != null ? _e : "",
|
|
2304
|
-
selectedValue: (_f = question.answer) != null ? _f : "",
|
|
2305
|
-
TextQuestionId: infoTextId,
|
|
2306
|
-
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
|
|
2307
|
-
connectedToSelect: true
|
|
2308
|
-
}
|
|
2309
|
-
)
|
|
2328
|
+
hasOptionInfoText && /* @__PURE__ */ jsx23(OptionTextBody_default, { ...optionTextProps })
|
|
2310
2329
|
] }),
|
|
2311
2330
|
showPreview && /* @__PURE__ */ jsx23(PreviewDropdown, { question })
|
|
2312
2331
|
] });
|