optimized-react-component-library-xyz123 0.1.161 → 0.1.162
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/questions.css +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -167,7 +167,7 @@ interface SingleCheckboxProps {
|
|
|
167
167
|
activatedLanguage?: string;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
declare const
|
|
170
|
+
declare const SingleCheckbox: FC<SingleCheckboxProps>;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* Kontrollerar om en fråga har ett valideringsfel baserat på dess egenskaper och valideringstyper.
|
|
@@ -844,4 +844,4 @@ interface FormStatusMessagesProps {
|
|
|
844
844
|
*/
|
|
845
845
|
declare const FormStatusMessagesScreenReader: React$1.FC<FormStatusMessagesProps>;
|
|
846
846
|
|
|
847
|
-
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, EditPreviewLink as EditPreviewLinkStandard, Footer as FooterStandard, FormStatusMessagesScreenReader, Header as HeaderStandard, type IApplicationContent, type IFormState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, QuestionGroup, QuestionRenderer, InputRadio as RadioMultipleStandard,
|
|
847
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, EditPreviewLink as EditPreviewLinkStandard, Footer as FooterStandard, FormStatusMessagesScreenReader, Header as HeaderStandard, type IApplicationContent, type IFormState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, QuestionGroup, QuestionRenderer, InputRadio as RadioMultipleStandard, SingleCheckbox as SingleCheckboxStandard, SkipLink as SkipLinkStandard, StartApplicationButton, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextBody, TextFieldStandard, ValidationErrorSummaryList, buildStepCategoryGroupQuestionStructure, createApiDataObject, createCookieConsent, createFormSlice, createGlobalLanguageSlice, createGlobalLanguageSlice as createLanguageSlice, createFormSlice as createQuestionsSlice, findVisibleQuestionsWithValidationErrors, focusElement, getGroupCheckIds, hasQuestionValidationError, isQuestionDependencySatisfied, isScriptLoaded, makeFormSelectors, makeglobalLanguageSelectors as makeLanguageSelectors, makeFormSelectors as makeQuestionsSelectors, makeglobalLanguageSelectors, preparePreviewData, removeScriptById, toggleScriptByConsent, updateQuestionsAndCategoriesVisibilityAndErrors, useCookieConsent, useFormStatusModal, useInputMethodDetection, usePTSPageTitle };
|
package/dist/index.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ interface SingleCheckboxProps {
|
|
|
167
167
|
activatedLanguage?: string;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
declare const
|
|
170
|
+
declare const SingleCheckbox: FC<SingleCheckboxProps>;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* Kontrollerar om en fråga har ett valideringsfel baserat på dess egenskaper och valideringstyper.
|
|
@@ -844,4 +844,4 @@ interface FormStatusMessagesProps {
|
|
|
844
844
|
*/
|
|
845
845
|
declare const FormStatusMessagesScreenReader: React$1.FC<FormStatusMessagesProps>;
|
|
846
846
|
|
|
847
|
-
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, EditPreviewLink as EditPreviewLinkStandard, Footer as FooterStandard, FormStatusMessagesScreenReader, Header as HeaderStandard, type IApplicationContent, type IFormState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, QuestionGroup, QuestionRenderer, InputRadio as RadioMultipleStandard,
|
|
847
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, EditPreviewLink as EditPreviewLinkStandard, Footer as FooterStandard, FormStatusMessagesScreenReader, Header as HeaderStandard, type IApplicationContent, type IFormState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, QuestionGroup, QuestionRenderer, InputRadio as RadioMultipleStandard, SingleCheckbox as SingleCheckboxStandard, SkipLink as SkipLinkStandard, StartApplicationButton, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextBody, TextFieldStandard, ValidationErrorSummaryList, buildStepCategoryGroupQuestionStructure, createApiDataObject, createCookieConsent, createFormSlice, createGlobalLanguageSlice, createGlobalLanguageSlice as createLanguageSlice, createFormSlice as createQuestionsSlice, findVisibleQuestionsWithValidationErrors, focusElement, getGroupCheckIds, hasQuestionValidationError, isQuestionDependencySatisfied, isScriptLoaded, makeFormSelectors, makeglobalLanguageSelectors as makeLanguageSelectors, makeFormSelectors as makeQuestionsSelectors, makeglobalLanguageSelectors, preparePreviewData, removeScriptById, toggleScriptByConsent, updateQuestionsAndCategoriesVisibilityAndErrors, useCookieConsent, useFormStatusModal, useInputMethodDetection, usePTSPageTitle };
|
package/dist/index.js
CHANGED
|
@@ -1006,7 +1006,7 @@ var PreviewAddFiles = ({
|
|
|
1006
1006
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1007
1007
|
var import_react7 = require("react");
|
|
1008
1008
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1009
|
-
var
|
|
1009
|
+
var SingleCheckbox = ({
|
|
1010
1010
|
question,
|
|
1011
1011
|
handleQuestionInputChange,
|
|
1012
1012
|
showPreview = false,
|
|
@@ -1018,14 +1018,21 @@ var SingleCheckboxes = ({
|
|
|
1018
1018
|
const aboutId = `about-${question.id}`;
|
|
1019
1019
|
const errorId = `error-${question.id}`;
|
|
1020
1020
|
const [checked, setChecked] = (0, import_react7.useState)(false);
|
|
1021
|
+
(0, import_react7.useEffect)(() => {
|
|
1022
|
+
if (question.answer && question.answer === "true") {
|
|
1023
|
+
setChecked(true);
|
|
1024
|
+
} else {
|
|
1025
|
+
setChecked(false);
|
|
1026
|
+
}
|
|
1027
|
+
}, [question.answer]);
|
|
1021
1028
|
const handleInputChange = (event) => {
|
|
1022
|
-
let answer = checked ? question.questionLabel : "";
|
|
1023
1029
|
setChecked(event.target.checked);
|
|
1030
|
+
let answer = event.target.checked ? "true" : "false";
|
|
1024
1031
|
const e = { target: { value: answer } };
|
|
1025
1032
|
handleQuestionInputChange(e, question);
|
|
1026
1033
|
};
|
|
1027
1034
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1028
|
-
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime11.
|
|
1035
|
+
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { id: questionId, className: "pts-root-question pts-singleCheckbox-container", children: [
|
|
1029
1036
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1030
1037
|
"input",
|
|
1031
1038
|
{
|
|
@@ -1044,7 +1051,7 @@ var SingleCheckboxes = ({
|
|
|
1044
1051
|
"aria-errormessage": question.hasValidationError ? errorId : void 0
|
|
1045
1052
|
}
|
|
1046
1053
|
),
|
|
1047
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `${
|
|
1054
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `${inputId}`, children: question.questionLabel }),
|
|
1048
1055
|
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" }),
|
|
1049
1056
|
" ",
|
|
1050
1057
|
question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -1062,13 +1069,13 @@ var SingleCheckboxes = ({
|
|
|
1062
1069
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
1063
1070
|
] }),
|
|
1064
1071
|
" "
|
|
1065
|
-
] })
|
|
1072
|
+
] }),
|
|
1066
1073
|
" ",
|
|
1067
|
-
showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1074
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewSingleCheckbox, { activatedLanguage, question })
|
|
1068
1075
|
] });
|
|
1069
1076
|
};
|
|
1070
|
-
var SingleCheckboxStandard_default =
|
|
1071
|
-
var
|
|
1077
|
+
var SingleCheckboxStandard_default = SingleCheckbox;
|
|
1078
|
+
var PreviewSingleCheckbox = ({
|
|
1072
1079
|
question,
|
|
1073
1080
|
activatedLanguage
|
|
1074
1081
|
}) => {
|
|
@@ -1076,12 +1083,12 @@ var PreviewSingleCheckboxes = ({
|
|
|
1076
1083
|
const previewId = `preview-${question.id}`;
|
|
1077
1084
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1078
1085
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
1079
|
-
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.
|
|
1086
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.questionLabel }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1080
1087
|
"dd",
|
|
1081
1088
|
{
|
|
1082
1089
|
className: "pts-singleCheckbox-preview pts-root-answer no-answer-preview-page",
|
|
1083
1090
|
id: `answer-${previewId}`,
|
|
1084
|
-
children: activatedLanguage === "
|
|
1091
|
+
children: question.answer === "false" ? activatedLanguage === "sv" ? "Nej" : "No" : activatedLanguage === "sv" ? "Ja" : "Yes"
|
|
1085
1092
|
}
|
|
1086
1093
|
)
|
|
1087
1094
|
] });
|
|
@@ -1807,14 +1814,6 @@ var QuestionRenderer = ({
|
|
|
1807
1814
|
showPreview
|
|
1808
1815
|
}
|
|
1809
1816
|
),
|
|
1810
|
-
question.questionType === "SingleCheckboxStandard" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1811
|
-
SingleCheckboxStandard_default,
|
|
1812
|
-
{
|
|
1813
|
-
question,
|
|
1814
|
-
handleQuestionInputChange,
|
|
1815
|
-
showPreview
|
|
1816
|
-
}
|
|
1817
|
-
),
|
|
1818
1817
|
question.questionType === "TextField" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1819
1818
|
TextFieldStandard_default,
|
|
1820
1819
|
{
|
|
@@ -1834,6 +1833,15 @@ var QuestionRenderer = ({
|
|
|
1834
1833
|
visible: question.visible
|
|
1835
1834
|
}
|
|
1836
1835
|
),
|
|
1836
|
+
question.questionType === "SingleCheckbox" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1837
|
+
SingleCheckboxStandard_default,
|
|
1838
|
+
{
|
|
1839
|
+
question,
|
|
1840
|
+
handleQuestionInputChange,
|
|
1841
|
+
showPreview,
|
|
1842
|
+
activatedLanguage
|
|
1843
|
+
}
|
|
1844
|
+
),
|
|
1837
1845
|
question.questionType === "Checkbox" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1838
1846
|
MultipleCheckboxesStandard_default,
|
|
1839
1847
|
{
|