optimized-react-component-library-xyz123 0.1.98 → 0.1.99

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 CHANGED
@@ -480,6 +480,15 @@ 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
+
483
492
  declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
484
493
 
485
494
  declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
@@ -586,4 +595,4 @@ interface CookieBannerProps {
586
595
 
587
596
  declare const CookieBanner: React.FC<CookieBannerProps>;
588
597
 
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 };
598
+ 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 };
package/dist/index.d.ts CHANGED
@@ -480,6 +480,15 @@ 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
+
483
492
  declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
484
493
 
485
494
  declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
@@ -586,4 +595,4 @@ interface CookieBannerProps {
586
595
 
587
596
  declare const CookieBanner: React.FC<CookieBannerProps>;
588
597
 
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 };
598
+ 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 };
package/dist/index.js CHANGED
@@ -69,7 +69,8 @@ __export(index_exports, {
69
69
  makeLanguageSelectors: () => makeLanguageSelectors,
70
70
  makeQuestionsSelectors: () => makeQuestionsSelectors,
71
71
  removeScriptById: () => removeScriptById,
72
- toggleScriptByConsent: () => toggleScriptByConsent
72
+ toggleScriptByConsent: () => toggleScriptByConsent,
73
+ useFormStatusModal: () => useFormStatusModal
73
74
  });
74
75
  module.exports = __toCommonJS(index_exports);
75
76
 
@@ -1921,6 +1922,23 @@ var getIdsGroupCheckValidationTypes = (validationType) => {
1921
1922
  return Array.from(new Set(ids));
1922
1923
  };
1923
1924
 
1925
+ // src/NewHelpMethodsStandard/LoadingModalHandler/loadingModalHandler.ts
1926
+ var React7 = __toESM(require("react"));
1927
+ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
1928
+ React7.useEffect(() => {
1929
+ if (formStatus === "loading") {
1930
+ handleModalOpen();
1931
+ }
1932
+ if (formStatus === "success" || formStatus === "failed") {
1933
+ setTimeout(() => {
1934
+ handleModalClose();
1935
+ }, 1050);
1936
+ const main = document.querySelector(mainSelector);
1937
+ if (main) main.focus();
1938
+ }
1939
+ }, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
1940
+ };
1941
+
1924
1942
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
1925
1943
  var import_jsx_runtime12 = require("react/jsx-runtime");
1926
1944
  var RenderQuestion = ({
@@ -3220,5 +3238,6 @@ var CookieBanner_default = CookieBanner;
3220
3238
  makeLanguageSelectors,
3221
3239
  makeQuestionsSelectors,
3222
3240
  removeScriptById,
3223
- toggleScriptByConsent
3241
+ toggleScriptByConsent,
3242
+ useFormStatusModal
3224
3243
  });
package/dist/index.mjs CHANGED
@@ -1849,6 +1849,23 @@ var getIdsGroupCheckValidationTypes = (validationType) => {
1849
1849
  return Array.from(new Set(ids));
1850
1850
  };
1851
1851
 
1852
+ // src/NewHelpMethodsStandard/LoadingModalHandler/loadingModalHandler.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
+
1852
1869
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
1853
1870
  import { Fragment as Fragment12, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1854
1871
  var RenderQuestion = ({
@@ -1901,7 +1918,7 @@ var RenderQuestion = ({
1901
1918
  var RenderQuestion_default = RenderQuestion;
1902
1919
 
1903
1920
  // src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
1904
- import React7 from "react";
1921
+ import React8 from "react";
1905
1922
  import { Fragment as Fragment13, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1906
1923
  var RenderQuestionGroup = ({
1907
1924
  questionArray,
@@ -1913,7 +1930,7 @@ var RenderQuestionGroup = ({
1913
1930
  AddQuestionDisplayed,
1914
1931
  hideValidationMessage
1915
1932
  }) => {
1916
- React7.useEffect(() => {
1933
+ React8.useEffect(() => {
1917
1934
  questionArray.forEach((question) => {
1918
1935
  if (question.visible && !question.isDisplayed) {
1919
1936
  AddQuestionDisplayed(question);
@@ -1921,7 +1938,7 @@ var RenderQuestionGroup = ({
1921
1938
  });
1922
1939
  }, [questionArray]);
1923
1940
  const questions = /* @__PURE__ */ jsx13(Fragment13, { children: questionArray.map((question, index) => {
1924
- return /* @__PURE__ */ jsx13(React7.Fragment, { children: /* @__PURE__ */ jsx13(
1941
+ return /* @__PURE__ */ jsx13(React8.Fragment, { children: /* @__PURE__ */ jsx13(
1925
1942
  RenderQuestion_default,
1926
1943
  {
1927
1944
  question,
@@ -1964,7 +1981,7 @@ var RenderQuestionGroup = ({
1964
1981
  return /* @__PURE__ */ jsx13("div", { className: "pts-root-question-group-div", children: questions });
1965
1982
  case "none":
1966
1983
  default:
1967
- return /* @__PURE__ */ jsx13(React7.Fragment, { children: questions });
1984
+ return /* @__PURE__ */ jsx13(React8.Fragment, { children: questions });
1968
1985
  }
1969
1986
  };
1970
1987
  var RenderQuestionGroup_default = RenderQuestionGroup;
@@ -2608,7 +2625,7 @@ var Header = ({
2608
2625
  var HeaderStandard_default = Header;
2609
2626
 
2610
2627
  // src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
2611
- import { useEffect as useEffect6 } from "react";
2628
+ import { useEffect as useEffect7 } from "react";
2612
2629
  import DOMPurify4 from "dompurify";
2613
2630
  import { Fragment as Fragment14, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2614
2631
  var cleanText = (text) => DOMPurify4.sanitize(text, { ADD_ATTR: ["target", "class"] });
@@ -2622,7 +2639,7 @@ var InfoOnly = ({
2622
2639
  tabIndex = -1,
2623
2640
  activatedLanguage = "sv"
2624
2641
  }) => {
2625
- useEffect6(() => {
2642
+ useEffect7(() => {
2626
2643
  handleSeenText(questionObject);
2627
2644
  }, []);
2628
2645
  const handleSeenText = (questionObject2) => {
@@ -2926,14 +2943,14 @@ var StepperButtons = ({
2926
2943
  var StepperButtonsStandard_default = StepperButtons;
2927
2944
 
2928
2945
  // src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
2929
- import React10 from "react";
2946
+ import React11 from "react";
2930
2947
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
2931
2948
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
2932
2949
  return /* @__PURE__ */ jsx25("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
2933
2950
  const isActive = step.step === activeStep;
2934
2951
  const lastElement = arraySteps.length;
2935
2952
  const isDone = step.step < activeStep;
2936
- return /* @__PURE__ */ jsxs21(React10.Fragment, { children: [
2953
+ return /* @__PURE__ */ jsxs21(React11.Fragment, { children: [
2937
2954
  /* @__PURE__ */ jsxs21("div", { className: "pts-stepper-step", children: [
2938
2955
  /* @__PURE__ */ jsx25(
2939
2956
  "div",
@@ -3147,5 +3164,6 @@ export {
3147
3164
  makeLanguageSelectors,
3148
3165
  makeQuestionsSelectors,
3149
3166
  removeScriptById,
3150
- toggleScriptByConsent
3167
+ toggleScriptByConsent,
3168
+ useFormStatusModal
3151
3169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optimized-react-component-library-xyz123",
3
- "version": "0.1.98",
3
+ "version": "0.1.99",
4
4
  "description": "A modern React component library using TypeScript with React 19 support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",