optimized-react-component-library-xyz123 0.1.98 → 0.1.100
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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +58 -12
- package/dist/index.mjs +53 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -480,6 +480,17 @@ declare const focusElement: (target: string | HTMLElement | null) => void;
|
|
|
480
480
|
*/
|
|
481
481
|
declare const getIdsGroupCheckValidationTypes: (validationType?: string[]) => number[];
|
|
482
482
|
|
|
483
|
+
/**
|
|
484
|
+
* Hook som hanterar öppning och stängning av en laddningsmodal baserat på formulärets status.
|
|
485
|
+
* @param formStatus Den aktuella statusen för formuläret ('loading', 'success', 'failed', etc.).
|
|
486
|
+
* @param handleModalOpen Funktion för att öppna modalen.
|
|
487
|
+
* @param handleModalClose Funktion för att stänga modalen.
|
|
488
|
+
* @param mainSelector CSS-selektorn för huvudinnehållet som ska fokuseras efter modal stängs.
|
|
489
|
+
*/
|
|
490
|
+
declare const useFormStatusModal: (formStatus: string, handleModalOpen: () => void, handleModalClose: () => void, mainSelector?: string) => void;
|
|
491
|
+
|
|
492
|
+
declare const usePTSPageTitle: ({ formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle, }: any) => any;
|
|
493
|
+
|
|
483
494
|
declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
484
495
|
|
|
485
496
|
declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
@@ -586,4 +597,4 @@ interface CookieBannerProps {
|
|
|
586
597
|
|
|
587
598
|
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
588
599
|
|
|
589
|
-
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, focusElement, getIdsGroupCheckValidationTypes, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent };
|
|
600
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, focusElement, getIdsGroupCheckValidationTypes, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent, useFormStatusModal, usePTSPageTitle };
|
package/dist/index.d.ts
CHANGED
|
@@ -480,6 +480,17 @@ declare const focusElement: (target: string | HTMLElement | null) => void;
|
|
|
480
480
|
*/
|
|
481
481
|
declare const getIdsGroupCheckValidationTypes: (validationType?: string[]) => number[];
|
|
482
482
|
|
|
483
|
+
/**
|
|
484
|
+
* Hook som hanterar öppning och stängning av en laddningsmodal baserat på formulärets status.
|
|
485
|
+
* @param formStatus Den aktuella statusen för formuläret ('loading', 'success', 'failed', etc.).
|
|
486
|
+
* @param handleModalOpen Funktion för att öppna modalen.
|
|
487
|
+
* @param handleModalClose Funktion för att stänga modalen.
|
|
488
|
+
* @param mainSelector CSS-selektorn för huvudinnehållet som ska fokuseras efter modal stängs.
|
|
489
|
+
*/
|
|
490
|
+
declare const useFormStatusModal: (formStatus: string, handleModalOpen: () => void, handleModalClose: () => void, mainSelector?: string) => void;
|
|
491
|
+
|
|
492
|
+
declare const usePTSPageTitle: ({ formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle, }: any) => any;
|
|
493
|
+
|
|
483
494
|
declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
484
495
|
|
|
485
496
|
declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
|
|
@@ -586,4 +597,4 @@ interface CookieBannerProps {
|
|
|
586
597
|
|
|
587
598
|
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
588
599
|
|
|
589
|
-
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, focusElement, getIdsGroupCheckValidationTypes, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent };
|
|
600
|
+
export { AddFiles as AddFilesStandard, CookieBanner, type CookieConsentConfig, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, type LanguageSupportConfig, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList, createCookieConsent, createLanguageSlice, createQuestionsSlice, focusElement, getIdsGroupCheckValidationTypes, isScriptLoaded, makeLanguageSelectors, makeQuestionsSelectors, removeScriptById, toggleScriptByConsent, useFormStatusModal, usePTSPageTitle };
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,9 @@ __export(index_exports, {
|
|
|
69
69
|
makeLanguageSelectors: () => makeLanguageSelectors,
|
|
70
70
|
makeQuestionsSelectors: () => makeQuestionsSelectors,
|
|
71
71
|
removeScriptById: () => removeScriptById,
|
|
72
|
-
toggleScriptByConsent: () => toggleScriptByConsent
|
|
72
|
+
toggleScriptByConsent: () => toggleScriptByConsent,
|
|
73
|
+
useFormStatusModal: () => useFormStatusModal,
|
|
74
|
+
usePTSPageTitle: () => usePTSPageTitle
|
|
73
75
|
});
|
|
74
76
|
module.exports = __toCommonJS(index_exports);
|
|
75
77
|
|
|
@@ -1921,6 +1923,48 @@ var getIdsGroupCheckValidationTypes = (validationType) => {
|
|
|
1921
1923
|
return Array.from(new Set(ids));
|
|
1922
1924
|
};
|
|
1923
1925
|
|
|
1926
|
+
// src/NewHelpMethodsStandard/useFormStatusModal/useFormStatusModal.ts
|
|
1927
|
+
var React7 = __toESM(require("react"));
|
|
1928
|
+
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
1929
|
+
React7.useEffect(() => {
|
|
1930
|
+
if (formStatus === "loading") {
|
|
1931
|
+
handleModalOpen();
|
|
1932
|
+
}
|
|
1933
|
+
if (formStatus === "success" || formStatus === "failed") {
|
|
1934
|
+
setTimeout(() => {
|
|
1935
|
+
handleModalClose();
|
|
1936
|
+
}, 1050);
|
|
1937
|
+
const main = document.querySelector(mainSelector);
|
|
1938
|
+
if (main) main.focus();
|
|
1939
|
+
}
|
|
1940
|
+
}, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
// src/NewHelpMethodsStandard/usePTSPageTitle/usePTSPageTitle.ts
|
|
1944
|
+
var import_react8 = require("react");
|
|
1945
|
+
var usePTSPageTitle = ({
|
|
1946
|
+
formStatus,
|
|
1947
|
+
activeStep,
|
|
1948
|
+
applicationContent,
|
|
1949
|
+
thankYouBlock,
|
|
1950
|
+
steps,
|
|
1951
|
+
fallbackTitle = "PTS e-tj\xE4nst"
|
|
1952
|
+
}) => {
|
|
1953
|
+
const computedTitle = (0, import_react8.useMemo)(() => {
|
|
1954
|
+
var _a, _b, _c, _d;
|
|
1955
|
+
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
1956
|
+
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
1957
|
+
const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
|
|
1958
|
+
if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
|
|
1959
|
+
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
1960
|
+
return stepTitle || baseTitle || fallbackTitle;
|
|
1961
|
+
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
1962
|
+
(0, import_react8.useEffect)(() => {
|
|
1963
|
+
document.title = computedTitle;
|
|
1964
|
+
}, [computedTitle]);
|
|
1965
|
+
return computedTitle;
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1924
1968
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
1925
1969
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1926
1970
|
var RenderQuestion = ({
|
|
@@ -1973,7 +2017,7 @@ var RenderQuestion = ({
|
|
|
1973
2017
|
var RenderQuestion_default = RenderQuestion;
|
|
1974
2018
|
|
|
1975
2019
|
// src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
|
|
1976
|
-
var
|
|
2020
|
+
var import_react9 = __toESM(require("react"));
|
|
1977
2021
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1978
2022
|
var RenderQuestionGroup = ({
|
|
1979
2023
|
questionArray,
|
|
@@ -1985,7 +2029,7 @@ var RenderQuestionGroup = ({
|
|
|
1985
2029
|
AddQuestionDisplayed,
|
|
1986
2030
|
hideValidationMessage
|
|
1987
2031
|
}) => {
|
|
1988
|
-
|
|
2032
|
+
import_react9.default.useEffect(() => {
|
|
1989
2033
|
questionArray.forEach((question) => {
|
|
1990
2034
|
if (question.visible && !question.isDisplayed) {
|
|
1991
2035
|
AddQuestionDisplayed(question);
|
|
@@ -1993,7 +2037,7 @@ var RenderQuestionGroup = ({
|
|
|
1993
2037
|
});
|
|
1994
2038
|
}, [questionArray]);
|
|
1995
2039
|
const questions = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: questionArray.map((question, index) => {
|
|
1996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react9.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1997
2041
|
RenderQuestion_default,
|
|
1998
2042
|
{
|
|
1999
2043
|
question,
|
|
@@ -2036,7 +2080,7 @@ var RenderQuestionGroup = ({
|
|
|
2036
2080
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "pts-root-question-group-div", children: questions });
|
|
2037
2081
|
case "none":
|
|
2038
2082
|
default:
|
|
2039
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react9.default.Fragment, { children: questions });
|
|
2040
2084
|
}
|
|
2041
2085
|
};
|
|
2042
2086
|
var RenderQuestionGroup_default = RenderQuestionGroup;
|
|
@@ -2680,7 +2724,7 @@ var Header = ({
|
|
|
2680
2724
|
var HeaderStandard_default = Header;
|
|
2681
2725
|
|
|
2682
2726
|
// src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
|
|
2683
|
-
var
|
|
2727
|
+
var import_react10 = require("react");
|
|
2684
2728
|
var import_dompurify4 = __toESM(require("dompurify"));
|
|
2685
2729
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2686
2730
|
var cleanText = (text) => import_dompurify4.default.sanitize(text, { ADD_ATTR: ["target", "class"] });
|
|
@@ -2694,7 +2738,7 @@ var InfoOnly = ({
|
|
|
2694
2738
|
tabIndex = -1,
|
|
2695
2739
|
activatedLanguage = "sv"
|
|
2696
2740
|
}) => {
|
|
2697
|
-
(0,
|
|
2741
|
+
(0, import_react10.useEffect)(() => {
|
|
2698
2742
|
handleSeenText(questionObject);
|
|
2699
2743
|
}, []);
|
|
2700
2744
|
const handleSeenText = (questionObject2) => {
|
|
@@ -2753,7 +2797,7 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
|
|
|
2753
2797
|
var ModalStandard_default = Modal;
|
|
2754
2798
|
|
|
2755
2799
|
// src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
2756
|
-
var
|
|
2800
|
+
var import_react11 = require("react");
|
|
2757
2801
|
var import_dompurify5 = __toESM(require("dompurify"));
|
|
2758
2802
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2759
2803
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
@@ -2762,7 +2806,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
2762
2806
|
{
|
|
2763
2807
|
className: "pts-textHeadlineAndBody-container",
|
|
2764
2808
|
children: [
|
|
2765
|
-
data.headline && (0,
|
|
2809
|
+
data.headline && (0, import_react11.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
2766
2810
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(data.body) } }),
|
|
2767
2811
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2768
2812
|
"a",
|
|
@@ -2998,14 +3042,14 @@ var StepperButtons = ({
|
|
|
2998
3042
|
var StepperButtonsStandard_default = StepperButtons;
|
|
2999
3043
|
|
|
3000
3044
|
// src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
|
|
3001
|
-
var
|
|
3045
|
+
var import_react12 = __toESM(require("react"));
|
|
3002
3046
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3003
3047
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
3004
3048
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
3005
3049
|
const isActive = step.step === activeStep;
|
|
3006
3050
|
const lastElement = arraySteps.length;
|
|
3007
3051
|
const isDone = step.step < activeStep;
|
|
3008
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react12.default.Fragment, { children: [
|
|
3009
3053
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
3010
3054
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3011
3055
|
"div",
|
|
@@ -3220,5 +3264,7 @@ var CookieBanner_default = CookieBanner;
|
|
|
3220
3264
|
makeLanguageSelectors,
|
|
3221
3265
|
makeQuestionsSelectors,
|
|
3222
3266
|
removeScriptById,
|
|
3223
|
-
toggleScriptByConsent
|
|
3267
|
+
toggleScriptByConsent,
|
|
3268
|
+
useFormStatusModal,
|
|
3269
|
+
usePTSPageTitle
|
|
3224
3270
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1849,6 +1849,48 @@ var getIdsGroupCheckValidationTypes = (validationType) => {
|
|
|
1849
1849
|
return Array.from(new Set(ids));
|
|
1850
1850
|
};
|
|
1851
1851
|
|
|
1852
|
+
// src/NewHelpMethodsStandard/useFormStatusModal/useFormStatusModal.ts
|
|
1853
|
+
import * as React7 from "react";
|
|
1854
|
+
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
1855
|
+
React7.useEffect(() => {
|
|
1856
|
+
if (formStatus === "loading") {
|
|
1857
|
+
handleModalOpen();
|
|
1858
|
+
}
|
|
1859
|
+
if (formStatus === "success" || formStatus === "failed") {
|
|
1860
|
+
setTimeout(() => {
|
|
1861
|
+
handleModalClose();
|
|
1862
|
+
}, 1050);
|
|
1863
|
+
const main = document.querySelector(mainSelector);
|
|
1864
|
+
if (main) main.focus();
|
|
1865
|
+
}
|
|
1866
|
+
}, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
// src/NewHelpMethodsStandard/usePTSPageTitle/usePTSPageTitle.ts
|
|
1870
|
+
import { useMemo, useEffect as useEffect7 } from "react";
|
|
1871
|
+
var usePTSPageTitle = ({
|
|
1872
|
+
formStatus,
|
|
1873
|
+
activeStep,
|
|
1874
|
+
applicationContent,
|
|
1875
|
+
thankYouBlock,
|
|
1876
|
+
steps,
|
|
1877
|
+
fallbackTitle = "PTS e-tj\xE4nst"
|
|
1878
|
+
}) => {
|
|
1879
|
+
const computedTitle = useMemo(() => {
|
|
1880
|
+
var _a, _b, _c, _d;
|
|
1881
|
+
const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
|
|
1882
|
+
const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
|
|
1883
|
+
const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
|
|
1884
|
+
if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
|
|
1885
|
+
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
1886
|
+
return stepTitle || baseTitle || fallbackTitle;
|
|
1887
|
+
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
1888
|
+
useEffect7(() => {
|
|
1889
|
+
document.title = computedTitle;
|
|
1890
|
+
}, [computedTitle]);
|
|
1891
|
+
return computedTitle;
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1852
1894
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
1853
1895
|
import { Fragment as Fragment12, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1854
1896
|
var RenderQuestion = ({
|
|
@@ -1901,7 +1943,7 @@ var RenderQuestion = ({
|
|
|
1901
1943
|
var RenderQuestion_default = RenderQuestion;
|
|
1902
1944
|
|
|
1903
1945
|
// src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
|
|
1904
|
-
import
|
|
1946
|
+
import React8 from "react";
|
|
1905
1947
|
import { Fragment as Fragment13, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1906
1948
|
var RenderQuestionGroup = ({
|
|
1907
1949
|
questionArray,
|
|
@@ -1913,7 +1955,7 @@ var RenderQuestionGroup = ({
|
|
|
1913
1955
|
AddQuestionDisplayed,
|
|
1914
1956
|
hideValidationMessage
|
|
1915
1957
|
}) => {
|
|
1916
|
-
|
|
1958
|
+
React8.useEffect(() => {
|
|
1917
1959
|
questionArray.forEach((question) => {
|
|
1918
1960
|
if (question.visible && !question.isDisplayed) {
|
|
1919
1961
|
AddQuestionDisplayed(question);
|
|
@@ -1921,7 +1963,7 @@ var RenderQuestionGroup = ({
|
|
|
1921
1963
|
});
|
|
1922
1964
|
}, [questionArray]);
|
|
1923
1965
|
const questions = /* @__PURE__ */ jsx13(Fragment13, { children: questionArray.map((question, index) => {
|
|
1924
|
-
return /* @__PURE__ */ jsx13(
|
|
1966
|
+
return /* @__PURE__ */ jsx13(React8.Fragment, { children: /* @__PURE__ */ jsx13(
|
|
1925
1967
|
RenderQuestion_default,
|
|
1926
1968
|
{
|
|
1927
1969
|
question,
|
|
@@ -1964,7 +2006,7 @@ var RenderQuestionGroup = ({
|
|
|
1964
2006
|
return /* @__PURE__ */ jsx13("div", { className: "pts-root-question-group-div", children: questions });
|
|
1965
2007
|
case "none":
|
|
1966
2008
|
default:
|
|
1967
|
-
return /* @__PURE__ */ jsx13(
|
|
2009
|
+
return /* @__PURE__ */ jsx13(React8.Fragment, { children: questions });
|
|
1968
2010
|
}
|
|
1969
2011
|
};
|
|
1970
2012
|
var RenderQuestionGroup_default = RenderQuestionGroup;
|
|
@@ -2608,7 +2650,7 @@ var Header = ({
|
|
|
2608
2650
|
var HeaderStandard_default = Header;
|
|
2609
2651
|
|
|
2610
2652
|
// src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
|
|
2611
|
-
import { useEffect as
|
|
2653
|
+
import { useEffect as useEffect8 } from "react";
|
|
2612
2654
|
import DOMPurify4 from "dompurify";
|
|
2613
2655
|
import { Fragment as Fragment14, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2614
2656
|
var cleanText = (text) => DOMPurify4.sanitize(text, { ADD_ATTR: ["target", "class"] });
|
|
@@ -2622,7 +2664,7 @@ var InfoOnly = ({
|
|
|
2622
2664
|
tabIndex = -1,
|
|
2623
2665
|
activatedLanguage = "sv"
|
|
2624
2666
|
}) => {
|
|
2625
|
-
|
|
2667
|
+
useEffect8(() => {
|
|
2626
2668
|
handleSeenText(questionObject);
|
|
2627
2669
|
}, []);
|
|
2628
2670
|
const handleSeenText = (questionObject2) => {
|
|
@@ -2926,14 +2968,14 @@ var StepperButtons = ({
|
|
|
2926
2968
|
var StepperButtonsStandard_default = StepperButtons;
|
|
2927
2969
|
|
|
2928
2970
|
// src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
|
|
2929
|
-
import
|
|
2971
|
+
import React11 from "react";
|
|
2930
2972
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2931
2973
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
2932
2974
|
return /* @__PURE__ */ jsx25("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
2933
2975
|
const isActive = step.step === activeStep;
|
|
2934
2976
|
const lastElement = arraySteps.length;
|
|
2935
2977
|
const isDone = step.step < activeStep;
|
|
2936
|
-
return /* @__PURE__ */ jsxs21(
|
|
2978
|
+
return /* @__PURE__ */ jsxs21(React11.Fragment, { children: [
|
|
2937
2979
|
/* @__PURE__ */ jsxs21("div", { className: "pts-stepper-step", children: [
|
|
2938
2980
|
/* @__PURE__ */ jsx25(
|
|
2939
2981
|
"div",
|
|
@@ -3147,5 +3189,7 @@ export {
|
|
|
3147
3189
|
makeLanguageSelectors,
|
|
3148
3190
|
makeQuestionsSelectors,
|
|
3149
3191
|
removeScriptById,
|
|
3150
|
-
toggleScriptByConsent
|
|
3192
|
+
toggleScriptByConsent,
|
|
3193
|
+
useFormStatusModal,
|
|
3194
|
+
usePTSPageTitle
|
|
3151
3195
|
};
|
package/package.json
CHANGED