@redneckz/wildless-cms-uni-blocks 0.14.559 → 0.14.560
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/bundle.umd.js +40 -29
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/bundle/components/ApplicationForm/NameField.d.ts +2 -0
- package/bundle/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/bundle/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/dist/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/dist/components/ApplicationForm/MiddleNameField.js +7 -0
- package/dist/components/ApplicationForm/MiddleNameField.js.map +1 -0
- package/dist/components/ApplicationForm/NameField.d.ts +2 -0
- package/dist/components/ApplicationForm/NameField.js +12 -0
- package/dist/components/ApplicationForm/NameField.js.map +1 -0
- package/dist/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/dist/components/ApplicationForm/PhoneField.js +9 -0
- package/dist/components/ApplicationForm/PhoneField.js.map +1 -0
- package/dist/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/dist/components/ApplicationForm/SurnameField.js +9 -0
- package/dist/components/ApplicationForm/SurnameField.js.map +1 -0
- package/dist/components/ApplicationForm/getField.js +8 -5
- package/dist/components/ApplicationForm/getField.js.map +1 -1
- package/lib/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/lib/components/ApplicationForm/MiddleNameField.js +5 -0
- package/lib/components/ApplicationForm/MiddleNameField.js.map +1 -0
- package/lib/components/ApplicationForm/NameField.d.ts +2 -0
- package/lib/components/ApplicationForm/NameField.js +10 -0
- package/lib/components/ApplicationForm/NameField.js.map +1 -0
- package/lib/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/lib/components/ApplicationForm/PhoneField.js +7 -0
- package/lib/components/ApplicationForm/PhoneField.js.map +1 -0
- package/lib/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/lib/components/ApplicationForm/SurnameField.js +7 -0
- package/lib/components/ApplicationForm/SurnameField.js.map +1 -0
- package/lib/components/ApplicationForm/getField.js +8 -5
- package/lib/components/ApplicationForm/getField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +40 -29
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/mobile/bundle/components/ApplicationForm/NameField.d.ts +2 -0
- package/mobile/bundle/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/mobile/bundle/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/MiddleNameField.js +7 -0
- package/mobile/dist/components/ApplicationForm/MiddleNameField.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/NameField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/NameField.js +12 -0
- package/mobile/dist/components/ApplicationForm/NameField.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/PhoneField.js +9 -0
- package/mobile/dist/components/ApplicationForm/PhoneField.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/mobile/dist/components/ApplicationForm/SurnameField.js +9 -0
- package/mobile/dist/components/ApplicationForm/SurnameField.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/getField.js +8 -5
- package/mobile/dist/components/ApplicationForm/getField.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/MiddleNameField.d.ts +2 -0
- package/mobile/lib/components/ApplicationForm/MiddleNameField.js +5 -0
- package/mobile/lib/components/ApplicationForm/MiddleNameField.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/NameField.d.ts +2 -0
- package/mobile/lib/components/ApplicationForm/NameField.js +10 -0
- package/mobile/lib/components/ApplicationForm/NameField.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/PhoneField.d.ts +2 -0
- package/mobile/lib/components/ApplicationForm/PhoneField.js +7 -0
- package/mobile/lib/components/ApplicationForm/PhoneField.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/SurnameField.d.ts +2 -0
- package/mobile/lib/components/ApplicationForm/SurnameField.js +7 -0
- package/mobile/lib/components/ApplicationForm/SurnameField.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/getField.js +8 -5
- package/mobile/lib/components/ApplicationForm/getField.js.map +1 -1
- package/mobile/src/components/ApplicationForm/MiddleNameField.tsx +7 -0
- package/mobile/src/components/ApplicationForm/NameField.tsx +18 -0
- package/mobile/src/components/ApplicationForm/PhoneField.tsx +12 -0
- package/mobile/src/components/ApplicationForm/SurnameField.tsx +12 -0
- package/mobile/src/components/ApplicationForm/getField.tsx +8 -23
- package/package.json +1 -1
- package/src/components/ApplicationForm/MiddleNameField.tsx +7 -0
- package/src/components/ApplicationForm/NameField.tsx +18 -0
- package/src/components/ApplicationForm/PhoneField.tsx +12 -0
- package/src/components/ApplicationForm/SurnameField.tsx +12 -0
- package/src/components/ApplicationForm/getField.tsx +8 -23
package/bundle/bundle.umd.js
CHANGED
|
@@ -1492,30 +1492,6 @@
|
|
|
1492
1492
|
|
|
1493
1493
|
const InputControl = JSX(({ className, label, value = '', placeholder, error, onChange, onBlur, isTextarea, type, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(Input, { type: type || 'text', "aria-label": label, label: label && rest?.errors ? `${label}*` : label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, isTextarea: isTextarea, placeholder: rest?.errors && !label ? `${placeholder}*` : placeholder }), renderErrorText(error)] })));
|
|
1494
1494
|
|
|
1495
|
-
const isPlaceholder = (_) => _ === '_';
|
|
1496
|
-
const isDigit = (_) => /\d/.test(_);
|
|
1497
|
-
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
1498
|
-
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
1499
|
-
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
1500
|
-
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
1501
|
-
function normalizePhone(phone) {
|
|
1502
|
-
const phoneNumbers = phone.replace(/\D/g, '');
|
|
1503
|
-
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
1504
|
-
const result = phonePattern.map(applyPlaceholder);
|
|
1505
|
-
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
1506
|
-
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
1510
|
-
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
1511
|
-
const handleBlur = useCallback((v) => {
|
|
1512
|
-
v === '+7 (' ? onChange && onChange('') : null;
|
|
1513
|
-
}, []);
|
|
1514
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
1515
|
-
});
|
|
1516
|
-
|
|
1517
|
-
const InputPhoneControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: rest?.errors ? `${label}*` : label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "+7 (___) ___-__-__" }), renderErrorText(error)] })));
|
|
1518
|
-
|
|
1519
1495
|
const SelectControl = JSX(({ className = '', label, error, ...rest }) => (jsxs("div", { className: className, children: [jsx(Select, { ...rest, valid: !error, label: rest?.errors ? `${label}*` : label }), renderErrorText(error)] })));
|
|
1520
1496
|
|
|
1521
1497
|
const getNamesFromInput = (inputs) => Object.values(inputs.filter((_) => _))?.map((_) => _.name);
|
|
@@ -1836,6 +1812,13 @@
|
|
|
1836
1812
|
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
1837
1813
|
});
|
|
1838
1814
|
|
|
1815
|
+
const MiddleNameField = JSX(({ field }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", ...field('middleName') })));
|
|
1816
|
+
|
|
1817
|
+
const NameField = JSX(({ field, input }) => {
|
|
1818
|
+
const { required, ...rest } = input;
|
|
1819
|
+
return (jsx(InputControl, { label: "\u0418\u043C\u044F", ...getValidation(field('name'), validatorObj.name, required), ...rest }));
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1839
1822
|
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
1840
1823
|
|
|
1841
1824
|
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
@@ -1845,6 +1828,32 @@
|
|
|
1845
1828
|
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
1846
1829
|
});
|
|
1847
1830
|
|
|
1831
|
+
const isPlaceholder = (_) => _ === '_';
|
|
1832
|
+
const isDigit = (_) => /\d/.test(_);
|
|
1833
|
+
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
1834
|
+
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
1835
|
+
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
1836
|
+
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
1837
|
+
function normalizePhone(phone) {
|
|
1838
|
+
const phoneNumbers = phone.replace(/\D/g, '');
|
|
1839
|
+
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
1840
|
+
const result = phonePattern.map(applyPlaceholder);
|
|
1841
|
+
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
1842
|
+
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
1846
|
+
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
1847
|
+
const handleBlur = useCallback((v) => {
|
|
1848
|
+
v === '+7 (' ? onChange && onChange('') : null;
|
|
1849
|
+
}, []);
|
|
1850
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
1851
|
+
});
|
|
1852
|
+
|
|
1853
|
+
const InputPhoneControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: rest?.errors ? `${label}*` : label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "+7 (___) ___-__-__" }), renderErrorText(error)] })));
|
|
1854
|
+
|
|
1855
|
+
const PhoneField = JSX(({ field, input }) => (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field('phone'), validatorObj.phone, input?.required) })));
|
|
1856
|
+
|
|
1848
1857
|
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
1849
1858
|
|
|
1850
1859
|
const ProductField = JSX(({ field }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: PRODUCT_TYPE, ...withValidator(field('product'), validatorObj.product) })));
|
|
@@ -1872,6 +1881,8 @@
|
|
|
1872
1881
|
|
|
1873
1882
|
const ServiceDirectionField = JSX(({ field }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...withValidator(field('serviceDirection'), validatorObj.serviceDirection) })));
|
|
1874
1883
|
|
|
1884
|
+
const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", ...getValidation(field('surname'), validatorObj.surname, input?.required) })));
|
|
1885
|
+
|
|
1875
1886
|
const MIN_CREDIT_TERM = 1;
|
|
1876
1887
|
const MAX_CREDIT_TERM = 180;
|
|
1877
1888
|
const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
|
|
@@ -1904,10 +1915,10 @@
|
|
|
1904
1915
|
const { required, ...rest } = input;
|
|
1905
1916
|
const isPremium = typeForm === 'ULTRASERVICE' || typeForm === 'PREMIUMSERVICE';
|
|
1906
1917
|
const InputsMap = {
|
|
1907
|
-
surname:
|
|
1908
|
-
name:
|
|
1909
|
-
middleName:
|
|
1910
|
-
phone:
|
|
1918
|
+
surname: jsx(SurnameField, { field: field, input: input }),
|
|
1919
|
+
name: jsx(NameField, { field: field, input: input }),
|
|
1920
|
+
middleName: jsx(MiddleNameField, { field: field }),
|
|
1921
|
+
phone: jsx(PhoneField, { field: field, input: input }),
|
|
1911
1922
|
email: (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest })),
|
|
1912
1923
|
fullName: (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, required), ...rest })),
|
|
1913
1924
|
inn: (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", ...getValidation(field('inn'), validatorObj.inn, required) })),
|
|
@@ -6554,7 +6565,7 @@
|
|
|
6554
6565
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6555
6566
|
});
|
|
6556
6567
|
|
|
6557
|
-
const packageVersion = "0.14.
|
|
6568
|
+
const packageVersion = "0.14.559";
|
|
6558
6569
|
|
|
6559
6570
|
exports.Blocks = Blocks;
|
|
6560
6571
|
exports.ContentPage = ContentPage;
|