@redneckz/wildless-cms-uni-blocks 0.14.874 → 0.14.875

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 (31) hide show
  1. package/bundle/bundle.umd.js +50 -48
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  4. package/dist/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  5. package/dist/ui-kit/FormField/Fields/ApplicationDateField.js +7 -0
  6. package/dist/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
  7. package/dist/ui-kit/FormField/getField.js +2 -2
  8. package/dist/ui-kit/FormField/getField.js.map +1 -1
  9. package/lib/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  10. package/lib/ui-kit/FormField/Fields/ApplicationDateField.js +5 -0
  11. package/lib/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
  12. package/lib/ui-kit/FormField/getField.js +2 -2
  13. package/lib/ui-kit/FormField/getField.js.map +1 -1
  14. package/mobile/bundle/bundle.umd.js +50 -48
  15. package/mobile/bundle/bundle.umd.min.js +1 -1
  16. package/mobile/bundle/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  17. package/mobile/dist/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  18. package/mobile/dist/ui-kit/FormField/Fields/ApplicationDateField.js +7 -0
  19. package/mobile/dist/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
  20. package/mobile/dist/ui-kit/FormField/getField.js +2 -2
  21. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  22. package/mobile/lib/ui-kit/FormField/Fields/ApplicationDateField.d.ts +2 -0
  23. package/mobile/lib/ui-kit/FormField/Fields/ApplicationDateField.js +5 -0
  24. package/mobile/lib/ui-kit/FormField/Fields/ApplicationDateField.js.map +1 -0
  25. package/mobile/lib/ui-kit/FormField/getField.js +2 -2
  26. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  27. package/mobile/src/ui-kit/FormField/Fields/ApplicationDateField.tsx +7 -0
  28. package/mobile/src/ui-kit/FormField/getField.tsx +2 -4
  29. package/package.json +1 -1
  30. package/src/ui-kit/FormField/Fields/ApplicationDateField.tsx +7 -0
  31. package/src/ui-kit/FormField/getField.tsx +2 -4
@@ -1244,35 +1244,10 @@
1244
1244
 
1245
1245
  const getConsentDataProcessing = (inputs) => inputs?.find((_) => _?.name === 'consentDataProcessing');
1246
1246
 
1247
- function useEventListener(target, type, listener, options) {
1248
- useEffect(() => {
1249
- if (!target || !listener) {
1250
- return;
1251
- }
1252
- target.addEventListener(type, listener, options);
1253
- return () => {
1254
- target.removeEventListener(type, listener, options);
1255
- };
1256
- }, [target, type, listener]);
1257
- }
1258
-
1259
- function useOutsideClick(onClick) {
1260
- const targetRef = useRef(null);
1261
- const handleClickOutside = useCallback((event) => {
1262
- if (targetRef && targetRef.current && event.target instanceof Node && !targetRef.current.contains(event.target)) {
1263
- onClick();
1264
- }
1265
- }, [onClick]);
1266
- useEventListener(globalThis.document, 'click', handleClickOutside);
1267
- return targetRef;
1268
- }
1269
-
1270
1247
  // TODO Базовая функицональность всех Control - надо вынести и привязать к required флагу
1271
1248
  const getRequiredLabel = ({ label, errors }) => label && errors ? `${label}*` : label;
1272
1249
 
1273
- const noop = () => {
1274
- // Do nothing
1275
- };
1250
+ const renderErrorText = (error) => (jsx("div", { className: "h-6", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null }));
1276
1251
 
1277
1252
  const inputValidStyle = 'border border-solid outline-none border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text rounded';
1278
1253
 
@@ -1300,28 +1275,30 @@
1300
1275
  });
1301
1276
  const defaultStyle$1 = 'w-full border rounded-md text-primary-text outline-none p-m';
1302
1277
 
1303
- const renderErrorText = (error) => (jsx("div", { className: "h-6", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null }));
1304
-
1305
- const InputWrapper = JSX(({ className, label, value = '', error, errors, type, isInteger, placeholder, maxLength, inputRef, isOpen, onOpen, onClose, onChange = noop, ...rest }) => {
1306
- const popupRef = useOutsideClick(onClose);
1307
- const handleChange = useCallback((v) => {
1308
- const isOverMax = maxLength && v.length > maxLength;
1309
- !isOpen && onOpen();
1310
- if (!isOverMax) {
1311
- onChange(normalizeInteger(v, isInteger));
1312
- }
1313
- }, [isOpen, onChange]);
1314
- return (jsxs("div", { className: style('shrink-0 w-full', className), ref: popupRef, onBlur: onClose, onFocus: onOpen, children: [jsx("div", { ref: inputRef, children: jsx(Input, { type: type || 'text', "aria-label": label, label: getRequiredLabel({ label, errors }), valid: Boolean(!error), onChange: handleChange, placeholder: getPlaceholder({ placeholder, errors, label }), value: value, ...rest }) }), renderErrorText(error)] }));
1315
- });
1316
- const normalizeInteger = (val = '', isInteger = false) => isInteger && val ? val.replace(/[^\d]+/g, '') : val;
1317
- const getPlaceholder = ({ placeholder, errors, label }) => errors && !label ? `${placeholder}*` : placeholder;
1278
+ const formatOption = (_) => _?.text || _?.key || '';
1318
1279
 
1319
- const InputControl = JSX((props) => {
1320
- const [isOpen, { setFalse: close, setTrue: open }] = useBool();
1321
- return jsx(InputWrapper, { isOpen: isOpen, onOpen: open, onClose: close, ...props });
1322
- });
1280
+ function useEventListener(target, type, listener, options) {
1281
+ useEffect(() => {
1282
+ if (!target || !listener) {
1283
+ return;
1284
+ }
1285
+ target.addEventListener(type, listener, options);
1286
+ return () => {
1287
+ target.removeEventListener(type, listener, options);
1288
+ };
1289
+ }, [target, type, listener]);
1290
+ }
1323
1291
 
1324
- const formatOption = (_) => _?.text || _?.key || '';
1292
+ function useOutsideClick(onClick) {
1293
+ const targetRef = useRef(null);
1294
+ const handleClickOutside = useCallback((event) => {
1295
+ if (targetRef && targetRef.current && event.target instanceof Node && !targetRef.current.contains(event.target)) {
1296
+ onClick();
1297
+ }
1298
+ }, [onClick]);
1299
+ useEventListener(globalThis.document, 'click', handleClickOutside);
1300
+ return targetRef;
1301
+ }
1325
1302
 
1326
1303
  const usePopupManager = () => useEmitterWithActions(defaultEventBus.emitter, 'popup');
1327
1304
 
@@ -1594,8 +1571,33 @@
1594
1571
  const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
1595
1572
  const AmountField = JSX(({ field, input }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field(input?.name ?? '') })));
1596
1573
 
1574
+ const noop = () => {
1575
+ // Do nothing
1576
+ };
1577
+
1578
+ const InputWrapper = JSX(({ className, label, value = '', error, errors, type, isInteger, placeholder, maxLength, inputRef, isOpen, onOpen, onClose, onChange = noop, ...rest }) => {
1579
+ const popupRef = useOutsideClick(onClose);
1580
+ const handleChange = useCallback((v) => {
1581
+ const isOverMax = maxLength && v.length > maxLength;
1582
+ !isOpen && onOpen();
1583
+ if (!isOverMax) {
1584
+ onChange(normalizeInteger(v, isInteger));
1585
+ }
1586
+ }, [isOpen, onChange]);
1587
+ return (jsxs("div", { className: style('shrink-0 w-full', className), ref: popupRef, onBlur: onClose, onFocus: onOpen, children: [jsx("div", { ref: inputRef, children: jsx(Input, { type: type || 'text', "aria-label": label, label: getRequiredLabel({ label, errors }), valid: Boolean(!error), onChange: handleChange, placeholder: getPlaceholder({ placeholder, errors, label }), value: value, ...rest }) }), renderErrorText(error)] }));
1588
+ });
1589
+ const normalizeInteger = (val = '', isInteger = false) => isInteger && val ? val.replace(/[^\d]+/g, '') : val;
1590
+ const getPlaceholder = ({ placeholder, errors, label }) => errors && !label ? `${placeholder}*` : placeholder;
1591
+
1592
+ const InputControl = JSX((props) => {
1593
+ const [isOpen, { setFalse: close, setTrue: open }] = useBool();
1594
+ return jsx(InputWrapper, { isOpen: isOpen, onOpen: open, onClose: close, ...props });
1595
+ });
1596
+
1597
1597
  const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...field(input?.name ?? '') })));
1598
1598
 
1599
+ const ApplicationDateField = JSX(({ field, input }) => (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(input?.name ?? '') })));
1600
+
1599
1601
  const CLIENT_KEY = 'client';
1600
1602
  const REPRESENTATIVE_KEY = 'representative';
1601
1603
  const APPLIER_TYPES = [
@@ -2238,7 +2240,7 @@
2238
2240
  serviceDirection: ServiceDirectionField,
2239
2241
  bankEmpolee: BankEmpoleeField,
2240
2242
  secondaryPhone: SecondaryPhoneField,
2241
- applicationDate: (props) => (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", ...props })),
2243
+ applicationDate: ApplicationDateField,
2242
2244
  region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
2243
2245
  consentToReceiveMaterials: ConsentToReceiveMaterialsField,
2244
2246
  sufferedFrom: SufferedFromField,
@@ -11177,7 +11179,7 @@
11177
11179
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
11178
11180
  });
11179
11181
 
11180
- const packageVersion = "0.14.873";
11182
+ const packageVersion = "0.14.874";
11181
11183
 
11182
11184
  exports.Blocks = Blocks;
11183
11185
  exports.ContentPage = ContentPage;