optimized-react-component-library-xyz123 0.1.97 → 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
@@ -475,6 +475,20 @@ declare const removeScriptById: (id: string) => void;
475
475
  */
476
476
  declare const focusElement: (target: string | HTMLElement | null) => void;
477
477
 
478
+ /**
479
+ * Plockar ut alla id:n från validationType som börjar med "groupCheck-"
480
+ */
481
+ declare const getIdsGroupCheckValidationTypes: (validationType?: string[]) => number[];
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
+
478
492
  declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
479
493
 
480
494
  declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
@@ -581,4 +595,4 @@ interface CookieBannerProps {
581
595
 
582
596
  declare const CookieBanner: React.FC<CookieBannerProps>;
583
597
 
584
- 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, 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
@@ -475,6 +475,20 @@ declare const removeScriptById: (id: string) => void;
475
475
  */
476
476
  declare const focusElement: (target: string | HTMLElement | null) => void;
477
477
 
478
+ /**
479
+ * Plockar ut alla id:n från validationType som börjar med "groupCheck-"
480
+ */
481
+ declare const getIdsGroupCheckValidationTypes: (validationType?: string[]) => number[];
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
+
478
492
  declare const RenderQuestion: ({ question, isTouched, activatedLanguage, showPreview, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
479
493
 
480
494
  declare const RenderQuestionGroup: ({ questionArray, wrapper, legend, isTouched, activatedLanguage, showPreview, AddQuestionDisplayed, hideValidationMessage, }: any) => react_jsx_runtime.JSX.Element;
@@ -581,4 +595,4 @@ interface CookieBannerProps {
581
595
 
582
596
  declare const CookieBanner: React.FC<CookieBannerProps>;
583
597
 
584
- 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, 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
@@ -64,11 +64,13 @@ __export(index_exports, {
64
64
  createLanguageSlice: () => createLanguageSlice,
65
65
  createQuestionsSlice: () => createQuestionsSlice,
66
66
  focusElement: () => focusElement,
67
+ getIdsGroupCheckValidationTypes: () => getIdsGroupCheckValidationTypes,
67
68
  isScriptLoaded: () => isScriptLoaded,
68
69
  makeLanguageSelectors: () => makeLanguageSelectors,
69
70
  makeQuestionsSelectors: () => makeQuestionsSelectors,
70
71
  removeScriptById: () => removeScriptById,
71
- toggleScriptByConsent: () => toggleScriptByConsent
72
+ toggleScriptByConsent: () => toggleScriptByConsent,
73
+ useFormStatusModal: () => useFormStatusModal
72
74
  });
73
75
  module.exports = __toCommonJS(index_exports);
74
76
 
@@ -1913,6 +1915,30 @@ var focusElement = (target) => {
1913
1915
  element.scrollIntoView({ behavior: "smooth" });
1914
1916
  };
1915
1917
 
1918
+ // src/NewHelpMethodsStandard/GetIdsGroupCheckValidationTypes/getIdsGroupCheckValidationTypes.ts
1919
+ var getIdsGroupCheckValidationTypes = (validationType) => {
1920
+ if (!(validationType == null ? void 0 : validationType.length)) return [];
1921
+ const ids = validationType.filter((t) => t.startsWith("groupCheck-")).flatMap((t) => t.split("-").slice(1)).map((s) => Number(s)).filter((n) => Number.isFinite(n));
1922
+ return Array.from(new Set(ids));
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
+
1916
1942
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
1917
1943
  var import_jsx_runtime12 = require("react/jsx-runtime");
1918
1944
  var RenderQuestion = ({
@@ -3207,9 +3233,11 @@ var CookieBanner_default = CookieBanner;
3207
3233
  createLanguageSlice,
3208
3234
  createQuestionsSlice,
3209
3235
  focusElement,
3236
+ getIdsGroupCheckValidationTypes,
3210
3237
  isScriptLoaded,
3211
3238
  makeLanguageSelectors,
3212
3239
  makeQuestionsSelectors,
3213
3240
  removeScriptById,
3214
- toggleScriptByConsent
3241
+ toggleScriptByConsent,
3242
+ useFormStatusModal
3215
3243
  });
package/dist/index.mjs CHANGED
@@ -1842,6 +1842,30 @@ var focusElement = (target) => {
1842
1842
  element.scrollIntoView({ behavior: "smooth" });
1843
1843
  };
1844
1844
 
1845
+ // src/NewHelpMethodsStandard/GetIdsGroupCheckValidationTypes/getIdsGroupCheckValidationTypes.ts
1846
+ var getIdsGroupCheckValidationTypes = (validationType) => {
1847
+ if (!(validationType == null ? void 0 : validationType.length)) return [];
1848
+ const ids = validationType.filter((t) => t.startsWith("groupCheck-")).flatMap((t) => t.split("-").slice(1)).map((s) => Number(s)).filter((n) => Number.isFinite(n));
1849
+ return Array.from(new Set(ids));
1850
+ };
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
+
1845
1869
  // src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
1846
1870
  import { Fragment as Fragment12, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1847
1871
  var RenderQuestion = ({
@@ -1894,7 +1918,7 @@ var RenderQuestion = ({
1894
1918
  var RenderQuestion_default = RenderQuestion;
1895
1919
 
1896
1920
  // src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
1897
- import React7 from "react";
1921
+ import React8 from "react";
1898
1922
  import { Fragment as Fragment13, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1899
1923
  var RenderQuestionGroup = ({
1900
1924
  questionArray,
@@ -1906,7 +1930,7 @@ var RenderQuestionGroup = ({
1906
1930
  AddQuestionDisplayed,
1907
1931
  hideValidationMessage
1908
1932
  }) => {
1909
- React7.useEffect(() => {
1933
+ React8.useEffect(() => {
1910
1934
  questionArray.forEach((question) => {
1911
1935
  if (question.visible && !question.isDisplayed) {
1912
1936
  AddQuestionDisplayed(question);
@@ -1914,7 +1938,7 @@ var RenderQuestionGroup = ({
1914
1938
  });
1915
1939
  }, [questionArray]);
1916
1940
  const questions = /* @__PURE__ */ jsx13(Fragment13, { children: questionArray.map((question, index) => {
1917
- return /* @__PURE__ */ jsx13(React7.Fragment, { children: /* @__PURE__ */ jsx13(
1941
+ return /* @__PURE__ */ jsx13(React8.Fragment, { children: /* @__PURE__ */ jsx13(
1918
1942
  RenderQuestion_default,
1919
1943
  {
1920
1944
  question,
@@ -1957,7 +1981,7 @@ var RenderQuestionGroup = ({
1957
1981
  return /* @__PURE__ */ jsx13("div", { className: "pts-root-question-group-div", children: questions });
1958
1982
  case "none":
1959
1983
  default:
1960
- return /* @__PURE__ */ jsx13(React7.Fragment, { children: questions });
1984
+ return /* @__PURE__ */ jsx13(React8.Fragment, { children: questions });
1961
1985
  }
1962
1986
  };
1963
1987
  var RenderQuestionGroup_default = RenderQuestionGroup;
@@ -2601,7 +2625,7 @@ var Header = ({
2601
2625
  var HeaderStandard_default = Header;
2602
2626
 
2603
2627
  // src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
2604
- import { useEffect as useEffect6 } from "react";
2628
+ import { useEffect as useEffect7 } from "react";
2605
2629
  import DOMPurify4 from "dompurify";
2606
2630
  import { Fragment as Fragment14, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2607
2631
  var cleanText = (text) => DOMPurify4.sanitize(text, { ADD_ATTR: ["target", "class"] });
@@ -2615,7 +2639,7 @@ var InfoOnly = ({
2615
2639
  tabIndex = -1,
2616
2640
  activatedLanguage = "sv"
2617
2641
  }) => {
2618
- useEffect6(() => {
2642
+ useEffect7(() => {
2619
2643
  handleSeenText(questionObject);
2620
2644
  }, []);
2621
2645
  const handleSeenText = (questionObject2) => {
@@ -2919,14 +2943,14 @@ var StepperButtons = ({
2919
2943
  var StepperButtonsStandard_default = StepperButtons;
2920
2944
 
2921
2945
  // src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
2922
- import React10 from "react";
2946
+ import React11 from "react";
2923
2947
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
2924
2948
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
2925
2949
  return /* @__PURE__ */ jsx25("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
2926
2950
  const isActive = step.step === activeStep;
2927
2951
  const lastElement = arraySteps.length;
2928
2952
  const isDone = step.step < activeStep;
2929
- return /* @__PURE__ */ jsxs21(React10.Fragment, { children: [
2953
+ return /* @__PURE__ */ jsxs21(React11.Fragment, { children: [
2930
2954
  /* @__PURE__ */ jsxs21("div", { className: "pts-stepper-step", children: [
2931
2955
  /* @__PURE__ */ jsx25(
2932
2956
  "div",
@@ -3135,9 +3159,11 @@ export {
3135
3159
  createLanguageSlice,
3136
3160
  createQuestionsSlice,
3137
3161
  focusElement,
3162
+ getIdsGroupCheckValidationTypes,
3138
3163
  isScriptLoaded,
3139
3164
  makeLanguageSelectors,
3140
3165
  makeQuestionsSelectors,
3141
3166
  removeScriptById,
3142
- toggleScriptByConsent
3167
+ toggleScriptByConsent,
3168
+ useFormStatusModal
3143
3169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optimized-react-component-library-xyz123",
3
- "version": "0.1.97",
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",