@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.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +80 -53
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/bundle/hooks/useLocalStorage.d.ts +1 -0
- package/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +13 -0
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
- package/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/dist/ui-kit/FormField/getField.js +2 -0
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +1 -0
- package/lib/hooks/useLocalStorage.d.ts +1 -0
- package/lib/hooks/useLocalStorage.js +10 -0
- package/lib/hooks/useLocalStorage.js.map +1 -0
- package/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
- package/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/lib/ui-kit/FormField/getField.js +2 -0
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +80 -53
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/bundle/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/bundle/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/dist/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/dist/hooks/useLocalStorage.js +13 -0
- package/mobile/dist/hooks/useLocalStorage.js.map +1 -0
- package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/mobile/dist/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/mobile/dist/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js +26 -0
- package/mobile/dist/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/getField.js +2 -0
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +3 -5
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/lib/hooks/useLocalStorage.d.ts +1 -0
- package/mobile/lib/hooks/useLocalStorage.js +10 -0
- package/mobile/lib/hooks/useLocalStorage.js.map +1 -0
- package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js +2 -1
- package/mobile/lib/ui-kit/Checkbox/CheckboxGroup.js.map +1 -1
- package/mobile/lib/ui-kit/Checkbox/CheckboxProps.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js +24 -0
- package/mobile/lib/ui-kit/FormField/Fields/ConsentToAllDocsField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/getField.js +2 -0
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
- package/mobile/src/hooks/useLocalStorage.ts +17 -0
- package/mobile/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
- package/mobile/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
- package/mobile/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
- package/mobile/src/ui-kit/FormField/getField.tsx +2 -0
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +6 -856
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +8 -10
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +7 -10
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +3 -9
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +2 -1
- package/src/hooks/useLocalStorage.ts +17 -0
- package/src/ui-kit/Checkbox/CheckboxGroup.tsx +7 -1
- package/src/ui-kit/Checkbox/CheckboxProps.ts +1 -1
- package/src/ui-kit/FormField/Fields/ConsentToAllDocsField.tsx +29 -0
- package/src/ui-kit/FormField/getField.tsx +2 -0
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
package/bundle/bundle.umd.js
CHANGED
|
@@ -1494,6 +1494,7 @@
|
|
|
1494
1494
|
localities: defaultValidator,
|
|
1495
1495
|
consentDataProcessing: agreementValidator,
|
|
1496
1496
|
annualRevenue: defaultValidator,
|
|
1497
|
+
consentToAllDocs: agreementValidator,
|
|
1497
1498
|
};
|
|
1498
1499
|
const getObjectValidator = (inputs) => {
|
|
1499
1500
|
const requiredInputs = getNamesFromInput(inputs.filter((_) => ('required' in _ ? _.required : false)));
|
|
@@ -1699,6 +1700,78 @@
|
|
|
1699
1700
|
|
|
1700
1701
|
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 })));
|
|
1701
1702
|
|
|
1703
|
+
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
1704
|
+
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
1705
|
+
const onToggle = useCallback(() => {
|
|
1706
|
+
setIsUnfolded((_) => !_);
|
|
1707
|
+
}, []);
|
|
1708
|
+
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
1709
|
+
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
1710
|
+
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
1711
|
+
});
|
|
1712
|
+
|
|
1713
|
+
function useResizeObserver(callback, deps) {
|
|
1714
|
+
const ref = useRef(null);
|
|
1715
|
+
useEffect(() => {
|
|
1716
|
+
const element = ref?.current;
|
|
1717
|
+
if (!element) {
|
|
1718
|
+
return undefined;
|
|
1719
|
+
}
|
|
1720
|
+
const observer = new ResizeObserver((entries) => {
|
|
1721
|
+
callback(element, entries[0]);
|
|
1722
|
+
});
|
|
1723
|
+
observer.observe(element);
|
|
1724
|
+
return () => {
|
|
1725
|
+
observer.disconnect();
|
|
1726
|
+
};
|
|
1727
|
+
}, [callback, ...deps]);
|
|
1728
|
+
return ref;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
1732
|
+
const containerRef = useRef(null);
|
|
1733
|
+
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
1734
|
+
if (containerRef.current) {
|
|
1735
|
+
containerRef.current.style.maxHeight = isUnfolded
|
|
1736
|
+
? `${childrenWrapperEl.scrollHeight}px`
|
|
1737
|
+
: '';
|
|
1738
|
+
}
|
|
1739
|
+
}, [isUnfolded]);
|
|
1740
|
+
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 }) }));
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
const CheckboxGroup = JSX(({ className, items = [], ...props }) => {
|
|
1744
|
+
const isChecked = items.every((_) => _?.value);
|
|
1745
|
+
const handleGeneralToggle = (value) => {
|
|
1746
|
+
for (const item of items) {
|
|
1747
|
+
item?.onChange && item.onChange(value);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
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 })) }) }));
|
|
1751
|
+
});
|
|
1752
|
+
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" }) })] }));
|
|
1753
|
+
|
|
1754
|
+
const items = [
|
|
1755
|
+
{
|
|
1756
|
+
field: 'processPersonalDataLeadFlg',
|
|
1757
|
+
text: 'Согласие на обработку персональных данных',
|
|
1758
|
+
required: true,
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
field: 'consentOtherFlg',
|
|
1762
|
+
text: 'Согласие на информирование о продуктах и услугах Банка',
|
|
1763
|
+
required: true,
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
field: 'consentProviderFlg',
|
|
1767
|
+
text: 'Согласие об использовании простой электронной подписи',
|
|
1768
|
+
required: true,
|
|
1769
|
+
},
|
|
1770
|
+
{ field: 'consentPfrFlg', text: 'Согласие на запрос в ПФР Открыты по субботам', required: true },
|
|
1771
|
+
{ field: 'consentPhotoFlg', text: 'Прочие согласия (согласие на фотографирование)' },
|
|
1772
|
+
];
|
|
1773
|
+
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 })) })));
|
|
1774
|
+
|
|
1702
1775
|
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) })));
|
|
1703
1776
|
|
|
1704
1777
|
const FeedbackTypeField = JSX(({ field }) => {
|
|
@@ -1878,6 +1951,7 @@
|
|
|
1878
1951
|
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') })),
|
|
1879
1952
|
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') })),
|
|
1880
1953
|
secondaryPhone: jsx(SecondaryPhoneField, { field: field }),
|
|
1954
|
+
сonsentToAllDocs: jsx(ConsentToAllDocsField, { field: field }),
|
|
1881
1955
|
};
|
|
1882
1956
|
return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name] }, String(i))) : null;
|
|
1883
1957
|
};
|
|
@@ -2027,12 +2101,12 @@
|
|
|
2027
2101
|
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
2028
2102
|
};
|
|
2029
2103
|
|
|
2030
|
-
const Footnote
|
|
2104
|
+
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] })));
|
|
2031
2105
|
|
|
2032
2106
|
const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
2033
2107
|
|
|
2034
2108
|
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
2035
|
-
const renderAgreementSubmit
|
|
2109
|
+
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)] }));
|
|
2036
2110
|
|
|
2037
2111
|
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" })] })] })] }));
|
|
2038
2112
|
|
|
@@ -2070,7 +2144,7 @@
|
|
|
2070
2144
|
reset();
|
|
2071
2145
|
}
|
|
2072
2146
|
}, [responseType]);
|
|
2073
|
-
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
|
|
2147
|
+
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] }));
|
|
2074
2148
|
});
|
|
2075
2149
|
const getFilteredInputs = (inputs, data) => inputs
|
|
2076
2150
|
.filter((_) => _)
|
|
@@ -2127,18 +2201,12 @@
|
|
|
2127
2201
|
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
2128
2202
|
};
|
|
2129
2203
|
|
|
2130
|
-
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] })));
|
|
2131
|
-
|
|
2132
2204
|
const renderSubmitButton = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
2133
2205
|
|
|
2134
|
-
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
|
|
2135
|
-
? renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)
|
|
2136
|
-
: null] }), renderSubmitButton(button)] }));
|
|
2137
|
-
|
|
2138
2206
|
const API = LeadServiceAPI();
|
|
2139
2207
|
const ApplicationLeadForm = JSX(
|
|
2140
2208
|
// eslint-disable-next-line max-lines-per-function
|
|
2141
|
-
({ className, title, typeForm = '', sections = [], button,
|
|
2209
|
+
({ className, title, typeForm = '', sections = [], button, endpoint, ...rest }) => {
|
|
2142
2210
|
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
2143
2211
|
const initialFormState = getInitialFormState(inputs, typeForm);
|
|
2144
2212
|
const [responseType, setResponseType] = useState('');
|
|
@@ -2157,14 +2225,13 @@
|
|
|
2157
2225
|
return status;
|
|
2158
2226
|
}, []);
|
|
2159
2227
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
2160
|
-
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
2161
2228
|
useEffect(() => {
|
|
2162
2229
|
if (responseType === 'OK') {
|
|
2163
2230
|
setResponseType('');
|
|
2164
2231
|
reset();
|
|
2165
2232
|
}
|
|
2166
2233
|
}, [responseType]);
|
|
2167
|
-
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}`))),
|
|
2234
|
+
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)] }) }));
|
|
2168
2235
|
});
|
|
2169
2236
|
|
|
2170
2237
|
const NotFound = JSX(({ title, description }) => {
|
|
@@ -2458,46 +2525,6 @@
|
|
|
2458
2525
|
return (jsx(DefaultFoldButton, { icon: icons[Number(isUnfolded)], label: labels[Number(isUnfolded)], onClick: onToggle }));
|
|
2459
2526
|
};
|
|
2460
2527
|
|
|
2461
|
-
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2462
|
-
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2463
|
-
const onToggle = useCallback(() => {
|
|
2464
|
-
setIsUnfolded((_) => !_);
|
|
2465
|
-
}, []);
|
|
2466
|
-
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2467
|
-
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2468
|
-
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2469
|
-
});
|
|
2470
|
-
|
|
2471
|
-
function useResizeObserver(callback, deps) {
|
|
2472
|
-
const ref = useRef(null);
|
|
2473
|
-
useEffect(() => {
|
|
2474
|
-
const element = ref?.current;
|
|
2475
|
-
if (!element) {
|
|
2476
|
-
return undefined;
|
|
2477
|
-
}
|
|
2478
|
-
const observer = new ResizeObserver((entries) => {
|
|
2479
|
-
callback(element, entries[0]);
|
|
2480
|
-
});
|
|
2481
|
-
observer.observe(element);
|
|
2482
|
-
return () => {
|
|
2483
|
-
observer.disconnect();
|
|
2484
|
-
};
|
|
2485
|
-
}, [callback, ...deps]);
|
|
2486
|
-
return ref;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2490
|
-
const containerRef = useRef(null);
|
|
2491
|
-
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2492
|
-
if (containerRef.current) {
|
|
2493
|
-
containerRef.current.style.maxHeight = isUnfolded
|
|
2494
|
-
? `${childrenWrapperEl.scrollHeight}px`
|
|
2495
|
-
: '';
|
|
2496
|
-
}
|
|
2497
|
-
}, [isUnfolded]);
|
|
2498
|
-
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 }) }));
|
|
2499
|
-
});
|
|
2500
|
-
|
|
2501
2528
|
const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
2502
2529
|
const resultsGridStyle = 'space-y-px lg:space-y-0 lg:grid lg:grid-cols-12 gap-2xs';
|
|
2503
2530
|
const renderGridBlocks = ({ topItemsCount = 0, label = '', block, blocksToRender = [], ...rest }) => {
|
|
@@ -6656,7 +6683,7 @@
|
|
|
6656
6683
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6657
6684
|
});
|
|
6658
6685
|
|
|
6659
|
-
const packageVersion = "0.14.
|
|
6686
|
+
const packageVersion = "0.14.570";
|
|
6660
6687
|
|
|
6661
6688
|
exports.Blocks = Blocks;
|
|
6662
6689
|
exports.ContentPage = ContentPage;
|