optimized-react-component-library-xyz123 2.8.20 → 2.8.22
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +57 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/questions.css +0 -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
|
-
|
|
928
|
+
optionInfoText: string;
|
|
929
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
|
-
|
|
928
|
+
optionInfoText: string;
|
|
929
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
|
@@ -1985,9 +1985,12 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
|
1985
1985
|
var AlertInTextStandard = ({ content = "" }) => {
|
|
1986
1986
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "pts-alertInText-container", children: [
|
|
1987
1987
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "pts-alertInText-left", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlertInTextIcon, {}) }),
|
|
1988
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "pts-alertInText-right", role: "note", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1989
|
-
|
|
1990
|
-
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "pts-alertInText-right", role: "note", children: /<\/?[a-z][\s\S]*>/i.test(content) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1989
|
+
"div",
|
|
1990
|
+
{
|
|
1991
|
+
dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(content) }
|
|
1992
|
+
}
|
|
1993
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: content }) })
|
|
1991
1994
|
] });
|
|
1992
1995
|
};
|
|
1993
1996
|
var AlertInTextStandard_default = AlertInTextStandard;
|
|
@@ -2296,28 +2299,60 @@ var getInfoTextConnectionList = (questionLanguageSupport, language) => {
|
|
|
2296
2299
|
var _a, _b;
|
|
2297
2300
|
return (_b = (_a = questionLanguageSupport.find((item) => (item == null ? void 0 : item.language) === language)) == null ? void 0 : _a.optionsInfoText) != null ? _b : [];
|
|
2298
2301
|
};
|
|
2302
|
+
var setOptionTextBodyProps = (question, activatedLanguage, questionId, errorId) => {
|
|
2303
|
+
var _a, _b, _c, _d;
|
|
2304
|
+
const infoTextId = `infotext-${questionId}`;
|
|
2305
|
+
const optionsInfoText = getInfoTextConnectionList(
|
|
2306
|
+
question.languageSupport,
|
|
2307
|
+
activatedLanguage
|
|
2308
|
+
);
|
|
2309
|
+
const selectedInfo = optionsInfoText.find(
|
|
2310
|
+
(option) => option.selectedValue === question.answer
|
|
2311
|
+
);
|
|
2312
|
+
const selectedLabel = (_c = (_b = (_a = question.options) == null ? void 0 : _a.find(
|
|
2313
|
+
(option) => option.value === question.answer
|
|
2314
|
+
)) == null ? void 0 : _b.label) != null ? _c : "";
|
|
2315
|
+
const hasOptionInfoText = !!(selectedInfo == null ? void 0 : selectedInfo.infoText);
|
|
2316
|
+
const describedBy = [
|
|
2317
|
+
question.hasValidationError ? errorId : null,
|
|
2318
|
+
hasOptionInfoText ? infoTextId : null
|
|
2319
|
+
].filter(Boolean).join(" ");
|
|
2320
|
+
return {
|
|
2321
|
+
describedBy,
|
|
2322
|
+
hasOptionInfoText,
|
|
2323
|
+
props: {
|
|
2324
|
+
optionInfoText: (_d = selectedInfo == null ? void 0 : selectedInfo.infoText) != null ? _d : "",
|
|
2325
|
+
selectedLabel,
|
|
2326
|
+
questionOptionTextId: infoTextId,
|
|
2327
|
+
activatedLanguage,
|
|
2328
|
+
hasOptionInfoText: true
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2331
|
+
};
|
|
2299
2332
|
var OptionTextBody = ({
|
|
2300
|
-
|
|
2333
|
+
optionInfoText,
|
|
2301
2334
|
selectedLabel,
|
|
2302
|
-
|
|
2335
|
+
questionOptionTextId,
|
|
2303
2336
|
activatedLanguage,
|
|
2304
|
-
|
|
2337
|
+
hasOptionInfoText = false
|
|
2305
2338
|
// hideStepperButtons = false
|
|
2306
2339
|
}) => {
|
|
2307
2340
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2308
2341
|
"div",
|
|
2309
2342
|
{
|
|
2310
|
-
...
|
|
2311
|
-
id: `${
|
|
2312
|
-
//"aria-live": {liveMode},
|
|
2343
|
+
...hasOptionInfoText && {
|
|
2344
|
+
id: `${questionOptionTextId}`,
|
|
2313
2345
|
"aria-atomic": "true"
|
|
2314
2346
|
},
|
|
2315
|
-
children:
|
|
2316
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.
|
|
2347
|
+
children: optionInfoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { id: questionOptionTextId + "-placeholder", className: "pts-optionTextBody-container", children: [
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "sr-only", children: [
|
|
2349
|
+
selectedLabel,
|
|
2350
|
+
`${activatedLanguage === "en" ? `More information about this option` : `Mer information om detta val`}.`
|
|
2351
|
+
] }),
|
|
2317
2352
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2318
2353
|
TextBody_default,
|
|
2319
2354
|
{
|
|
2320
|
-
data: { alertInText:
|
|
2355
|
+
data: { alertInText: optionInfoText }
|
|
2321
2356
|
}
|
|
2322
2357
|
)
|
|
2323
2358
|
] })
|
|
@@ -2334,19 +2369,15 @@ var CustomDropdownStandard = ({
|
|
|
2334
2369
|
showPreview = false,
|
|
2335
2370
|
activatedLanguage = "sv"
|
|
2336
2371
|
}) => {
|
|
2337
|
-
var _a, _b, _c
|
|
2372
|
+
var _a, _b, _c;
|
|
2338
2373
|
const questionId = `question-${question.id}`;
|
|
2339
2374
|
const selectId = `select-${question.id}`;
|
|
2340
2375
|
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(" ");
|
|
2376
|
+
const {
|
|
2377
|
+
describedBy,
|
|
2378
|
+
hasOptionInfoText,
|
|
2379
|
+
props: optionTextProps
|
|
2380
|
+
} = setOptionTextBodyProps(question, activatedLanguage, questionId, errorId);
|
|
2350
2381
|
const handleInputChange = (event) => {
|
|
2351
2382
|
const e = { target: { value: event.target.value } };
|
|
2352
2383
|
handleQuestionInputChange(e, question);
|
|
@@ -2368,6 +2399,7 @@ var CustomDropdownStandard = ({
|
|
|
2368
2399
|
"aria-required": question.isQuestionMandatory,
|
|
2369
2400
|
"aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
|
|
2370
2401
|
"aria-describedby": describedBy || void 0,
|
|
2402
|
+
className: describedBy === errorId ? "pts-root-question-input-error-border" : "",
|
|
2371
2403
|
children: [
|
|
2372
2404
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", children: activatedLanguage === "en" ? "Select an option" : "V\xE4lj alternativ" }),
|
|
2373
2405
|
(_a = question.options) == null ? void 0 : _a.map((option, index) => {
|
|
@@ -2385,16 +2417,7 @@ var CustomDropdownStandard = ({
|
|
|
2385
2417
|
activatedLanguage
|
|
2386
2418
|
}
|
|
2387
2419
|
),
|
|
2388
|
-
|
|
2389
|
-
OptionTextBody_default,
|
|
2390
|
-
{
|
|
2391
|
-
infoText: (_e = (_d = optionsInfoText.find((optionI) => optionI.selectedValue === question.answer)) == null ? void 0 : _d.infoText) != null ? _e : "",
|
|
2392
|
-
selectedLabel: (_h = (_g = (_f = question.options) == null ? void 0 : _f.find((option) => option.value === question.answer)) == null ? void 0 : _g.label) != null ? _h : "",
|
|
2393
|
-
TextQuestionId: infoTextId,
|
|
2394
|
-
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv",
|
|
2395
|
-
connectedToSelect: true
|
|
2396
|
-
}
|
|
2397
|
-
)
|
|
2420
|
+
hasOptionInfoText && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(OptionTextBody_default, { ...optionTextProps })
|
|
2398
2421
|
] }),
|
|
2399
2422
|
showPreview && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PreviewDropdown, { question })
|
|
2400
2423
|
] });
|
|
@@ -3240,7 +3263,8 @@ var QuestionRenderer = ({
|
|
|
3240
3263
|
{
|
|
3241
3264
|
question,
|
|
3242
3265
|
handleQuestionInputChange,
|
|
3243
|
-
showPreview
|
|
3266
|
+
showPreview,
|
|
3267
|
+
activatedLanguage
|
|
3244
3268
|
}
|
|
3245
3269
|
)
|
|
3246
3270
|
] });
|