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.d.mts
CHANGED
|
@@ -925,11 +925,11 @@ interface AlertInTextProps {
|
|
|
925
925
|
declare const AlertInTextStandard: FC<AlertInTextProps>;
|
|
926
926
|
|
|
927
927
|
interface OptionTextBodyProps {
|
|
928
|
-
|
|
929
|
-
|
|
928
|
+
optionInfoText: string;
|
|
929
|
+
selectedLabel?: string;
|
|
930
930
|
activatedLanguage?: string;
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
questionOptionTextId: string;
|
|
932
|
+
hasOptionInfoText?: boolean;
|
|
933
933
|
hideStepperButtons?: boolean;
|
|
934
934
|
}
|
|
935
935
|
|
package/dist/index.d.ts
CHANGED
|
@@ -925,11 +925,11 @@ interface AlertInTextProps {
|
|
|
925
925
|
declare const AlertInTextStandard: FC<AlertInTextProps>;
|
|
926
926
|
|
|
927
927
|
interface OptionTextBodyProps {
|
|
928
|
-
|
|
929
|
-
|
|
928
|
+
optionInfoText: string;
|
|
929
|
+
selectedLabel?: string;
|
|
930
930
|
activatedLanguage?: string;
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
questionOptionTextId: string;
|
|
932
|
+
hasOptionInfoText?: boolean;
|
|
933
933
|
hideStepperButtons?: boolean;
|
|
934
934
|
}
|
|
935
935
|
|
package/dist/index.js
CHANGED
|
@@ -2296,28 +2296,60 @@ var getInfoTextConnectionList = (questionLanguageSupport, language) => {
|
|
|
2296
2296
|
var _a, _b;
|
|
2297
2297
|
return (_b = (_a = questionLanguageSupport.find((item) => (item == null ? void 0 : item.language) === language)) == null ? void 0 : _a.optionsInfoText) != null ? _b : [];
|
|
2298
2298
|
};
|
|
2299
|
+
var setOptionTextBodyProps = (question, activatedLanguage, questionId, errorId) => {
|
|
2300
|
+
var _a, _b, _c, _d;
|
|
2301
|
+
const infoTextId = `infotext-${questionId}`;
|
|
2302
|
+
const optionsInfoText = getInfoTextConnectionList(
|
|
2303
|
+
question.languageSupport,
|
|
2304
|
+
activatedLanguage
|
|
2305
|
+
);
|
|
2306
|
+
const selectedInfo = optionsInfoText.find(
|
|
2307
|
+
(option) => option.selectedValue === question.answer
|
|
2308
|
+
);
|
|
2309
|
+
const selectedLabel = (_c = (_b = (_a = question.options) == null ? void 0 : _a.find(
|
|
2310
|
+
(option) => option.value === question.answer
|
|
2311
|
+
)) == null ? void 0 : _b.label) != null ? _c : "";
|
|
2312
|
+
const hasOptionInfoText = !!(selectedInfo == null ? void 0 : selectedInfo.infoText);
|
|
2313
|
+
const describedBy = [
|
|
2314
|
+
question.hasValidationError ? errorId : null,
|
|
2315
|
+
hasOptionInfoText ? infoTextId : null
|
|
2316
|
+
].filter(Boolean).join(" ");
|
|
2317
|
+
return {
|
|
2318
|
+
describedBy,
|
|
2319
|
+
hasOptionInfoText,
|
|
2320
|
+
props: {
|
|
2321
|
+
optionInfoText: (_d = selectedInfo == null ? void 0 : selectedInfo.infoText) != null ? _d : "",
|
|
2322
|
+
selectedLabel,
|
|
2323
|
+
questionOptionTextId: infoTextId,
|
|
2324
|
+
activatedLanguage,
|
|
2325
|
+
hasOptionInfoText: true
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
};
|
|
2299
2329
|
var OptionTextBody = ({
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2330
|
+
optionInfoText,
|
|
2331
|
+
selectedLabel,
|
|
2332
|
+
questionOptionTextId,
|
|
2303
2333
|
activatedLanguage,
|
|
2304
|
-
|
|
2334
|
+
hasOptionInfoText = false
|
|
2305
2335
|
// hideStepperButtons = false
|
|
2306
2336
|
}) => {
|
|
2307
2337
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2308
2338
|
"div",
|
|
2309
2339
|
{
|
|
2310
|
-
...
|
|
2311
|
-
id: `${
|
|
2312
|
-
"aria-live": "polite",
|
|
2340
|
+
...hasOptionInfoText && {
|
|
2341
|
+
id: `${questionOptionTextId}`,
|
|
2313
2342
|
"aria-atomic": "true"
|
|
2314
2343
|
},
|
|
2315
|
-
children:
|
|
2316
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.
|
|
2344
|
+
children: optionInfoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { id: questionOptionTextId + "-placeholder", className: "pts-root-question pts-optionTextBody-container", children: [
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "sr-only", children: [
|
|
2346
|
+
selectedLabel,
|
|
2347
|
+
`${activatedLanguage === "en" ? `More information about this option` : `Mer information om detta val`}.`
|
|
2348
|
+
] }),
|
|
2317
2349
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2318
2350
|
TextBody_default,
|
|
2319
2351
|
{
|
|
2320
|
-
data: { alertInText:
|
|
2352
|
+
data: { alertInText: optionInfoText }
|
|
2321
2353
|
}
|
|
2322
2354
|
)
|
|
2323
2355
|
] })
|
|
@@ -2334,19 +2366,15 @@ var CustomDropdownStandard = ({
|
|
|
2334
2366
|
showPreview = false,
|
|
2335
2367
|
activatedLanguage = "sv"
|
|
2336
2368
|
}) => {
|
|
2337
|
-
var _a, _b, _c
|
|
2369
|
+
var _a, _b, _c;
|
|
2338
2370
|
const questionId = `question-${question.id}`;
|
|
2339
2371
|
const selectId = `select-${question.id}`;
|
|
2340
2372
|
const errorId = `error-${question.id}`;
|
|
2341
|
-
const
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
);
|
|
2346
|
-
const describedBy = [
|
|
2347
|
-
question.hasValidationError ? errorId : null,
|
|
2348
|
-
hasInfoText ? infoTextId : null
|
|
2349
|
-
].filter(Boolean).join(" ");
|
|
2373
|
+
const {
|
|
2374
|
+
describedBy,
|
|
2375
|
+
hasOptionInfoText,
|
|
2376
|
+
props: optionTextProps
|
|
2377
|
+
} = setOptionTextBodyProps(question, activatedLanguage, questionId, errorId);
|
|
2350
2378
|
const handleInputChange = (event) => {
|
|
2351
2379
|
const e = { target: { value: event.target.value } };
|
|
2352
2380
|
handleQuestionInputChange(e, question);
|
|
@@ -2385,16 +2413,7 @@ var CustomDropdownStandard = ({
|
|
|
2385
2413
|
activatedLanguage
|
|
2386
2414
|
}
|
|
2387
2415
|
),
|
|
2388
|
-
|
|
2389
|
-
OptionTextBody_default,
|
|
2390
|
-
{
|
|
2391
|
-
infoText: (_e = (_d = optionsInfoText.find((optionI) => optionI.selectedValue === question.answer)) == null ? void 0 : _d.infoText) != null ? _e : "",
|
|
2392
|
-
selectedValue: (_f = question.answer) != null ? _f : "",
|
|
2393
|
-
TextQuestionId: infoTextId,
|
|
2394
|
-
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
|
|
2395
|
-
connectedToSelect: true
|
|
2396
|
-
}
|
|
2397
|
-
)
|
|
2416
|
+
hasOptionInfoText && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(OptionTextBody_default, { ...optionTextProps })
|
|
2398
2417
|
] }),
|
|
2399
2418
|
showPreview && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PreviewDropdown, { question })
|
|
2400
2419
|
] });
|