@redneckz/wildless-cms-uni-blocks 0.14.569 → 0.14.571

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.
Files changed (107) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +80 -53
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  5. package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  6. package/bundle/hooks/useLocalStorage.d.ts +1 -0
  7. package/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  8. package/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  9. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  10. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  11. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  12. package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  13. package/dist/hooks/useLocalStorage.d.ts +1 -0
  14. package/dist/hooks/useLocalStorage.js +13 -0
  15. package/dist/hooks/useLocalStorage.js.map +1 -0
  16. package/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  17. package/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  18. package/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  19. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  20. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
  21. package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  22. package/dist/ui-kit/FormField/getField.js +2 -0
  23. package/dist/ui-kit/FormField/getField.js.map +1 -1
  24. package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  25. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  26. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  27. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  28. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  29. package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  30. package/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +1 -0
  31. package/lib/hooks/useLocalStorage.d.ts +1 -0
  32. package/lib/hooks/useLocalStorage.js +10 -0
  33. package/lib/hooks/useLocalStorage.js.map +1 -0
  34. package/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  35. package/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  36. package/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  37. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  38. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
  39. package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  40. package/lib/ui-kit/FormField/getField.js +2 -0
  41. package/lib/ui-kit/FormField/getField.js.map +1 -1
  42. package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  43. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  44. package/mobile/bundle/bundle.umd.js +80 -53
  45. package/mobile/bundle/bundle.umd.min.js +1 -1
  46. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  47. package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  48. package/mobile/bundle/hooks/useLocalStorage.d.ts +1 -0
  49. package/mobile/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  50. package/mobile/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  51. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  52. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  53. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  54. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  55. package/mobile/dist/hooks/useLocalStorage.d.ts +1 -0
  56. package/mobile/dist/hooks/useLocalStorage.js +13 -0
  57. package/mobile/dist/hooks/useLocalStorage.js.map +1 -0
  58. package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  59. package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  60. package/mobile/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  61. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  62. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
  63. package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  64. package/mobile/dist/ui-kit/FormField/getField.js +2 -0
  65. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  66. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  67. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  68. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
  69. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
  70. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  71. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
  72. package/mobile/lib/hooks/useLocalStorage.d.ts +1 -0
  73. package/mobile/lib/hooks/useLocalStorage.js +10 -0
  74. package/mobile/lib/hooks/useLocalStorage.js.map +1 -0
  75. package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
  76. package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
  77. package/mobile/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
  78. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
  79. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
  80. package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
  81. package/mobile/lib/ui-kit/FormField/getField.js +2 -0
  82. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  83. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  84. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  85. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  86. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
  87. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
  88. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
  89. package/mobile/src/hooks/useLocalStorage.ts +17 -0
  90. package/mobile/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
  91. package/mobile/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
  92. package/mobile/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
  93. package/mobile/src/ui-kit/FormField/getField.tsx +2 -0
  94. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
  95. package/package.json +1 -1
  96. package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  97. package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
  98. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +8 -10
  99. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +7 -10
  100. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
  101. package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
  102. package/src/hooks/useLocalStorage.ts +17 -0
  103. package/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
  104. package/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
  105. package/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
  106. package/src/ui-kit/FormField/getField.tsx +2 -0
  107. package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
@@ -1502,6 +1502,7 @@
1502
1502
  localities: defaultValidator,
1503
1503
  consentDataProcessing: agreementValidator,
1504
1504
  annualRevenue: defaultValidator,
1505
+ consentToAllDocs: agreementValidator,
1505
1506
  };
1506
1507
  const getObjectValidator = (inputs) => {
1507
1508
  const requiredInputs = getNamesFromInput(inputs.filter((_) => ('required' in _ ? _.required : false)));
@@ -1707,6 +1708,78 @@
1707
1708
 
1708
1709
  const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
1709
1710
 
1711
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
1712
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
1713
+ const onToggle = useCallback(() => {
1714
+ setIsUnfolded((_) => !_);
1715
+ }, []);
1716
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
1717
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
1718
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
1719
+ });
1720
+
1721
+ function useResizeObserver(callback, deps) {
1722
+ const ref = useRef(null);
1723
+ useEffect(() => {
1724
+ const element = ref?.current;
1725
+ if (!element) {
1726
+ return undefined;
1727
+ }
1728
+ const observer = new ResizeObserver((entries) => {
1729
+ callback(element, entries[0]);
1730
+ });
1731
+ observer.observe(element);
1732
+ return () => {
1733
+ observer.disconnect();
1734
+ };
1735
+ }, [callback, ...deps]);
1736
+ return ref;
1737
+ }
1738
+
1739
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
1740
+ const containerRef = useRef(null);
1741
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
1742
+ if (containerRef.current) {
1743
+ containerRef.current.style.maxHeight = isUnfolded
1744
+ ? `${childrenWrapperEl.scrollHeight}px`
1745
+ : '';
1746
+ }
1747
+ }, [isUnfolded]);
1748
+ return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
1749
+ });
1750
+
1751
+ const CheckboxGroup = JSX(({ className, items = [], ...props }) => {
1752
+ const isChecked = items.every((_) => _?.value);
1753
+ const handleGeneralToggle = (value) => {
1754
+ for (const item of items) {
1755
+ item?.onChange && item.onChange(value);
1756
+ }
1757
+ };
1758
+ return (jsx("div", { className: style('w-full', className), children: jsx(Foldable, { isFoldButtonOnTop: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col gap-lg pl-2xl py-xs", children: items.map(Checkbox) })), renderFoldButton: renderGeneralCheckbox(jsx(CheckboxWithError, { required: true, value: isChecked, onChange: handleGeneralToggle, ...props })) }) }));
1759
+ });
1760
+ const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-center", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "p-m", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
1761
+
1762
+ const items = [
1763
+ {
1764
+ field: 'processPersonalDataLeadFlg',
1765
+ text: 'Согласие на обработку персональных данных',
1766
+ required: true,
1767
+ },
1768
+ {
1769
+ field: 'consentOtherFlg',
1770
+ text: 'Согласие на информирование о продуктах и услугах Банка',
1771
+ required: true,
1772
+ },
1773
+ {
1774
+ field: 'consentProviderFlg',
1775
+ text: 'Согласие об использовании простой электронной подписи',
1776
+ required: true,
1777
+ },
1778
+ { field: 'consentPfrFlg', text: 'Согласие на запрос в ПФР Открыты по субботам', required: true },
1779
+ { field: 'consentPhotoFlg', text: 'Прочие согласия (согласие на фотографирование)' },
1780
+ ];
1781
+ const ConsentToAllDocsField = JSX(({ field }) => (jsx(CheckboxGroup, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0438\u0435 \u043D\u0430 \u0432\u0441\u0435 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B", items: items.map((_) => ({ ...field(_.field), text: _.text, required: _.required })) })));
1782
+
1710
1783
  const FeedbackMethodField = JSX(({ field }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...withValidator(field('feedbackMethod'), validatorObj.feedbackMethod) })));
1711
1784
 
1712
1785
  const FeedbackTypeField = JSX(({ field }) => {
@@ -1886,6 +1959,7 @@
1886
1959
  bankEmpolee: (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })),
1887
1960
  applicationDate: (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...field('applicationDate') })),
1888
1961
  secondaryPhone: jsx(SecondaryPhoneField, { field: field }),
1962
+ сonsentToAllDocs: jsx(ConsentToAllDocsField, { field: field }),
1889
1963
  };
1890
1964
  return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name] }, String(i))) : null;
1891
1965
  };
@@ -2035,12 +2109,12 @@
2035
2109
  return { ...formState, typeForm: { key: typeForm, text: '' } };
2036
2110
  };
2037
2111
 
2038
- const Footnote$1 = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
2112
+ const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
2039
2113
 
2040
2114
  const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
2041
2115
 
2042
2116
  const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
2043
- const renderAgreementSubmit$1 = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote$1, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote$1, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
2117
+ const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
2044
2118
 
2045
2119
  const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
2046
2120
 
@@ -2078,7 +2152,7 @@
2078
2152
  reset();
2079
2153
  }
2080
2154
  }, [responseType]);
2081
- return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit$1(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
2155
+ return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
2082
2156
  });
2083
2157
  const getFilteredInputs = (inputs, data) => inputs
2084
2158
  .filter((_) => _)
@@ -2135,18 +2209,12 @@
2135
2209
  return { ...formState, typeForm: { key: typeForm, text: '' } };
2136
2210
  };
2137
2211
 
2138
- const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
2139
-
2140
2212
  const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
2141
2213
 
2142
- const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), consentDataProcessing
2143
- ? renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)
2144
- : null] }), renderSubmitButton(button)] }));
2145
-
2146
2214
  const API = LeadServiceAPI();
2147
2215
  const ApplicationLeadForm = JSX(
2148
2216
  // eslint-disable-next-line max-lines-per-function
2149
- ({ className, title, typeForm = '', sections = [], button, link, endpoint, ...rest }) => {
2217
+ ({ className, title, typeForm = '', sections = [], button, endpoint, ...rest }) => {
2150
2218
  const inputs = (sections?.flatMap((_) => _?.inputs) || []);
2151
2219
  const initialFormState = getInitialFormState(inputs, typeForm);
2152
2220
  const [responseType, setResponseType] = useState('');
@@ -2165,14 +2233,13 @@
2165
2233
  return status;
2166
2234
  }, []);
2167
2235
  const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
2168
- const fieldName = getConsentDataProcessing(inputs)?.name;
2169
2236
  useEffect(() => {
2170
2237
  if (responseType === 'OK') {
2171
2238
  setResponseType('');
2172
2239
  reset();
2173
2240
  }
2174
2241
  }, [responseType]);
2175
- return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }) }));
2242
+ return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderSubmitButton(button)] }) }));
2176
2243
  });
2177
2244
 
2178
2245
  const NotFound = JSX(({ title, description }) => {
@@ -2466,46 +2533,6 @@
2466
2533
  return (jsx(DefaultFoldButton, { icon: icons[Number(isUnfolded)], label: labels[Number(isUnfolded)], onClick: onToggle }));
2467
2534
  };
2468
2535
 
2469
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2470
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2471
- const onToggle = useCallback(() => {
2472
- setIsUnfolded((_) => !_);
2473
- }, []);
2474
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2475
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2476
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2477
- });
2478
-
2479
- function useResizeObserver(callback, deps) {
2480
- const ref = useRef(null);
2481
- useEffect(() => {
2482
- const element = ref?.current;
2483
- if (!element) {
2484
- return undefined;
2485
- }
2486
- const observer = new ResizeObserver((entries) => {
2487
- callback(element, entries[0]);
2488
- });
2489
- observer.observe(element);
2490
- return () => {
2491
- observer.disconnect();
2492
- };
2493
- }, [callback, ...deps]);
2494
- return ref;
2495
- }
2496
-
2497
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2498
- const containerRef = useRef(null);
2499
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2500
- if (containerRef.current) {
2501
- containerRef.current.style.maxHeight = isUnfolded
2502
- ? `${childrenWrapperEl.scrollHeight}px`
2503
- : '';
2504
- }
2505
- }, [isUnfolded]);
2506
- return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
2507
- });
2508
-
2509
2536
  const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2510
2537
  const resultsGridStyle = 'space-y-px lg:space-y-0 lg:grid lg:grid-cols-12 gap-2xs';
2511
2538
  const renderGridBlocks = ({ topItemsCount = 0, label = '', block, blocksToRender = [], ...rest }) => {
@@ -6284,7 +6311,7 @@
6284
6311
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6285
6312
  });
6286
6313
 
6287
- const packageVersion = "0.14.568";
6314
+ const packageVersion = "0.14.570";
6288
6315
 
6289
6316
  exports.Blocks = Blocks;
6290
6317
  exports.ContentPage = ContentPage;