kui-crm 0.0.41 → 0.0.43

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/cjs/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
6
+ var React = require('react');
7
7
  var mobxReact = require('mobx-react');
8
8
  var reactHookForm = require('react-hook-form');
9
9
  var kuiComplex = require('kui-complex');
@@ -14,7 +14,7 @@ var axios = require('axios');
14
14
  var kuiBasic = require('kui-basic');
15
15
  var _ = require('lodash');
16
16
  var styled = require('@emotion/styled');
17
- var react$1 = require('@emotion/react');
17
+ var react = require('@emotion/react');
18
18
  var reactRouterDom = require('react-router-dom');
19
19
  var yup$1 = require('@hookform/resolvers/yup');
20
20
  var yup = require('yup');
@@ -44,6 +44,7 @@ function _interopNamespace(e) {
44
44
  return Object.freeze(n);
45
45
  }
46
46
 
47
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
47
48
  var to__default = /*#__PURE__*/_interopDefaultLegacy(to);
48
49
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
49
50
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
@@ -330,14 +331,14 @@ var CitiesStore = /** @class */ (function () {
330
331
  }());
331
332
 
332
333
  var useAutocomplete = function (filter, paginator, fetchAll, defaultFilter, withoutRequest) {
333
- react.useEffect(function () {
334
+ React.useEffect(function () {
334
335
  if (defaultFilter)
335
336
  filter.updateFilterQuery(defaultFilter);
336
337
  filter.updateSearchQuery("");
337
338
  paginator.clearOffset();
338
339
  paginator.startFetching();
339
340
  }, []);
340
- react.useEffect(function () {
341
+ React.useEffect(function () {
341
342
  if (paginator.isFetching && !paginator.isFinishPage && !withoutRequest) {
342
343
  fetchAll();
343
344
  }
@@ -367,9 +368,9 @@ var useAutocomplete = function (filter, paginator, fetchAll, defaultFilter, with
367
368
 
368
369
  function CityAutocomplete(props) {
369
370
  var form = props.form, name = props.name, label = props.label, onSelect = props.onSelect, regionName = props.regionName, otherProps = __rest(props, ["form", "name", "label", "onSelect", "regionName"]);
370
- var citiesStoreRef = react.useRef(new CitiesStore());
371
- var _a = react.useState(false), isMounted = _a[0], setIsMounted = _a[1];
372
- var inputRef = react.useRef(null);
371
+ var citiesStoreRef = React.useRef(new CitiesStore());
372
+ var _a = React.useState(false), isMounted = _a[0], setIsMounted = _a[1];
373
+ var inputRef = React.useRef(null);
373
374
  var _b = citiesStoreRef.current, cities = _b.cities, fetchCities = _b.fetchCities, paginator = _b.paginator, filter = _b.filter, loader = _b.loader;
374
375
  var isLoading = loader.isLoading;
375
376
  var region = reactHookForm.useWatch({
@@ -383,7 +384,7 @@ function CityAutocomplete(props) {
383
384
  if (onSelect)
384
385
  onSelect(item);
385
386
  };
386
- react.useEffect(function () {
387
+ React.useEffect(function () {
387
388
  if (isMounted && inputRef.current) {
388
389
  form.setValue("".concat(name, ".id"), null);
389
390
  form.setValue("".concat(name, ".name"), null);
@@ -437,7 +438,7 @@ var CountriesStore = /** @class */ (function () {
437
438
 
438
439
  function CountryAutocomplete(props) {
439
440
  var form = props.form, name = props.name, label = props.label, defaultFilter = props.defaultFilter, onSelect = props.onSelect, otherProps = __rest(props, ["form", "name", "label", "defaultFilter", "onSelect"]);
440
- var countriesStoreRef = react.useRef(new CountriesStore());
441
+ var countriesStoreRef = React.useRef(new CountriesStore());
441
442
  var _a = countriesStoreRef.current, countries = _a.countries, fetchCountries = _a.fetchCountries, paginator = _a.paginator, filter = _a.filter, loader = _a.loader;
442
443
  var isLoading = loader.isLoading;
443
444
  var _b = useAutocomplete(filter, paginator, fetchCountries, defaultFilter), onSearchItem = _b.onSearchItem, onScrollEnd = _b.onScrollEnd;
@@ -457,7 +458,7 @@ var CountryAutocomplete$1 = mobxReact.observer(CountryAutocomplete);
457
458
 
458
459
  function InputFileWithVisibility(props) {
459
460
  var form = props.form, name = props.name, defaultVisibility = props.defaultVisibility, disabled = props.disabled, inputProps = __rest(props, ["form", "name", "defaultVisibility", "disabled"]);
460
- var _a = react.useState(false), mounted = _a[0], setMounted = _a[1];
461
+ var _a = React.useState(false), mounted = _a[0], setMounted = _a[1];
461
462
  var file = reactHookForm.useWatch({ control: form.control, name: "".concat(name, ".file") });
462
463
  var tenant = reactHookForm.useWatch({
463
464
  control: form.control,
@@ -476,13 +477,13 @@ function InputFileWithVisibility(props) {
476
477
  form.setValue("".concat(name, ".landlord"), visibilitySettings.landlord);
477
478
  form.setValue("".concat(name, ".tenant"), visibilitySettings.tenant);
478
479
  };
479
- react.useEffect(function () {
480
+ React.useEffect(function () {
480
481
  if (typeof landlord === "boolean" && typeof tenant === "boolean") {
481
482
  var visibility = kuiComplex.getVisibility({ landlord: landlord, tenant: tenant });
482
483
  form.setValue("".concat(name, ".visibility"), visibility);
483
484
  }
484
485
  }, [landlord, tenant]);
485
- react.useEffect(function () {
486
+ React.useEffect(function () {
486
487
  var defaultValue = form.getValues(name);
487
488
  if (defaultValue && "filesStore" in defaultValue) {
488
489
  form.setValue("".concat(name, ".file"), __assign(__assign({}, defaultValue), { filesStore: null }));
@@ -557,9 +558,9 @@ var RegionsStore = /** @class */ (function () {
557
558
 
558
559
  function RegionAutocomplete(props) {
559
560
  var form = props.form, name = props.name, label = props.label, onSelect = props.onSelect, countryName = props.countryName, otherProps = __rest(props, ["form", "name", "label", "onSelect", "countryName"]);
560
- var regionsStoreRef = react.useRef(new RegionsStore());
561
- var _a = react.useState(false), isMounted = _a[0], setIsMounted = _a[1];
562
- var inputRef = react.useRef(null);
561
+ var regionsStoreRef = React.useRef(new RegionsStore());
562
+ var _a = React.useState(false), isMounted = _a[0], setIsMounted = _a[1];
563
+ var inputRef = React.useRef(null);
563
564
  var _b = regionsStoreRef.current, regions = _b.regions, fetchRegions = _b.fetchRegions, paginator = _b.paginator, filter = _b.filter, loader = _b.loader;
564
565
  var isLoading = loader.isLoading;
565
566
  var country = reactHookForm.useWatch({
@@ -573,7 +574,7 @@ function RegionAutocomplete(props) {
573
574
  if (onSelect)
574
575
  onSelect(item);
575
576
  };
576
- react.useEffect(function () {
577
+ React.useEffect(function () {
577
578
  if (isMounted && inputRef.current) {
578
579
  form.setValue("".concat(name, ".id"), null);
579
580
  form.setValue("".concat(name, ".name"), null);
@@ -596,8 +597,8 @@ RegionAutocomplete.defaultProps = {
596
597
  var RegionAutocomplete$1 = mobxReact.observer(RegionAutocomplete);
597
598
 
598
599
  var usePortalPosition = function (portalParentRef) {
599
- var _a = react.useState(null), coords = _a[0], setCoords = _a[1];
600
- react.useEffect(function () {
600
+ var _a = React.useState(null), coords = _a[0], setCoords = _a[1];
601
+ React.useEffect(function () {
601
602
  if (!portalParentRef.current) {
602
603
  return;
603
604
  }
@@ -616,7 +617,7 @@ var usePortalPosition = function (portalParentRef) {
616
617
  };
617
618
 
618
619
  var useFetchPage = function (paginator, fetchAll, deps) {
619
- react.useEffect(function () {
620
+ React.useEffect(function () {
620
621
  if ((paginator === null || paginator === void 0 ? void 0 : paginator.isFetching) && !(paginator === null || paginator === void 0 ? void 0 : paginator.isFinishPage) && fetchAll) {
621
622
  fetchAll();
622
623
  }
@@ -624,7 +625,7 @@ var useFetchPage = function (paginator, fetchAll, deps) {
624
625
  paginator === null || paginator === void 0 ? void 0 : paginator.stopFetching();
625
626
  }
626
627
  }, [paginator, paginator === null || paginator === void 0 ? void 0 : paginator.isFetching]);
627
- react.useEffect(function () { return function () {
628
+ React.useEffect(function () { return function () {
628
629
  paginator === null || paginator === void 0 ? void 0 : paginator.clearOffset();
629
630
  paginator === null || paginator === void 0 ? void 0 : paginator.startFetching();
630
631
  }; }, deps || []);
@@ -639,7 +640,7 @@ var useScrollWithBottomSpacing = function (spacingToBottom, delay, callback, ele
639
640
  callback();
640
641
  }
641
642
  };
642
- react.useEffect(function () {
643
+ React.useEffect(function () {
643
644
  var throttle = ___default["default"].throttle(handleScroll, delay);
644
645
  var target = (element === null || element === void 0 ? void 0 : element.current) || document;
645
646
  target.addEventListener("scroll", throttle);
@@ -675,8 +676,8 @@ function SquarePreviewImage(_a) {
675
676
  return (jsxRuntime.jsx(StyledWrapper$8, __assign({ size: size || "lg" }, other, { children: imageSrc ? (jsxRuntime.jsx(StyledImage$1, { src: imageSrc, alt: "preview image" })) : (jsxRuntime.jsx(StyledNameWrapper, __assign({ alignItems: "center", justify: "center" }, { children: jsxRuntime.jsx(kuiBasic.Heading, __assign({ size: size === "sm" ? "h4" : "h1", colorGroup: "brand", color: "main" }, { children: formattedName !== null && formattedName !== void 0 ? formattedName : "?" })) }))) })));
676
677
  }
677
678
  var previewSizesStyles = {
678
- lg: react$1.css(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "], ["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "]))),
679
- sm: react$1.css(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "], ["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "]))),
679
+ lg: react.css(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "], ["\n width: 88px;\n height: 88px;\n border-radius: 16px;\n "]))),
680
+ sm: react.css(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "], ["\n width: 32px;\n height: 32px;\n border-radius: 8px;\n "]))),
680
681
  };
681
682
  var StyledImage$1 = styled__default["default"].img(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n"], ["\n width: 100%;\n height: 100%;\n display: block;\n object-fit: cover;\n"])));
682
683
  var StyledWrapper$8 = styled__default["default"].div(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["\n overflow: hidden;\n ", ";\n"], ["\n overflow: hidden;\n ", ";\n"])), function (_a) {
@@ -848,8 +849,8 @@ var createParentNode$1 = function () {
848
849
  };
849
850
  function ErrorPopup(_a) {
850
851
  var label = _a.label, onClose = _a.onClose;
851
- var isHoverRef = react.useRef(false);
852
- var _b = react.useState(true), open = _b[0], setOpen = _b[1];
852
+ var isHoverRef = React.useRef(false);
853
+ var _b = React.useState(true), open = _b[0], setOpen = _b[1];
853
854
  var startHover = function () {
854
855
  isHoverRef.current = true;
855
856
  };
@@ -867,7 +868,7 @@ function ErrorPopup(_a) {
867
868
  isHoverRef.current = false;
868
869
  handleClose();
869
870
  };
870
- react.useEffect(function () {
871
+ React.useEffect(function () {
871
872
  var timeoutId;
872
873
  if (open) {
873
874
  timeoutId = setTimeout(checkIsHoverAndClose, timeout);
@@ -881,9 +882,9 @@ function ErrorPopup(_a) {
881
882
  return null;
882
883
  }
883
884
  var parentNode = document.querySelector(".".concat(parentClassName$1)) || createParentNode$1();
884
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react$1.Global, { styles: containerCSS$1 }), reactDom.createPortal(jsxRuntime.jsx(StyledWrapper$6, __assign({ onMouseEnter: startHover, onMouseLeave: handleMouseLeave, className: "KUI-ErrorPopup", container: true, alignItems: "center" }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", weight: 600, color: "zero" }, { children: jsxRuntime.jsx(StyledContent, { children: label ? "Error in ".concat(label) : "Error" }) })) })), parentNode)] }));
885
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Global, { styles: containerCSS$1 }), reactDom.createPortal(jsxRuntime.jsx(StyledWrapper$6, __assign({ onMouseEnter: startHover, onMouseLeave: handleMouseLeave, className: "KUI-ErrorPopup", container: true, alignItems: "center" }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", weight: 600, color: "zero" }, { children: jsxRuntime.jsx(StyledContent, { children: label ? "Error in ".concat(label) : "Error" }) })) })), parentNode)] }));
885
886
  }
886
- var containerCSS$1 = react$1.css(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
887
+ var containerCSS$1 = react.css(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-ErrorPopup_container {\n display: flex;\n position: fixed;\n top: 120px;\n justify-content: center;\n flex-direction: column;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
887
888
  var StyledWrapper$6 = styled__default["default"](kuiBasic.Grid)(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n height: 46px;\n border-radius: 12px;\n background: rgba(25, 25, 25, 0.8);\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n padding: 0 24px;\n margin-bottom: 16px;\n width: max-content;\n &:last-child {\n margin-bottom: 0;\n }\n"], ["\n height: 46px;\n border-radius: 12px;\n background: rgba(25, 25, 25, 0.8);\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n padding: 0 24px;\n margin-bottom: 16px;\n width: max-content;\n &:last-child {\n margin-bottom: 0;\n }\n"])));
888
889
  var StyledContent = styled__default["default"].pre(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n margin: 0;\n padding: 0;\n"], ["\n margin: 0;\n padding: 0;\n"])));
889
890
  var templateObject_1$h, templateObject_2$9, templateObject_3$8;
@@ -897,7 +898,7 @@ var createParentNode = function () {
897
898
  };
898
899
  function LoaderPopup(_a) {
899
900
  var label = _a.label, onClose = _a.onClose;
900
- var _b = react.useState(true), isOpen = _b[0], setIsOpen = _b[1];
901
+ var _b = React.useState(true), isOpen = _b[0], setIsOpen = _b[1];
901
902
  if (!isOpen) {
902
903
  return null;
903
904
  }
@@ -908,9 +909,9 @@ function LoaderPopup(_a) {
908
909
  }
909
910
  };
910
911
  var parentNode = document.querySelector(".".concat(parentClassName)) || createParentNode();
911
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react$1.Global, { styles: containerCSS }), reactDom.createPortal(jsxRuntime.jsxs(StyledWrapper$5, __assign({ className: "KUI-LoadingPopup", container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(StyledLoader, {}), jsxRuntime.jsxs(StyledCaption$1, __assign({ size: "xs", weight: 600, color: "zero" }, { children: ["Loading ", label] })), jsxRuntime.jsx(CloseIconWrapper, __assign({ onClick: handleClose }, { children: jsxRuntime.jsx(kuiIcon.CrossWithCircleIcon, {}) }))] })), parentNode)] }));
912
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Global, { styles: containerCSS }), reactDom.createPortal(jsxRuntime.jsxs(StyledWrapper$5, __assign({ className: "KUI-LoadingPopup", container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(StyledLoader, {}), jsxRuntime.jsxs(StyledCaption$1, __assign({ size: "xs", weight: 600, color: "zero" }, { children: ["Loading ", label] })), jsxRuntime.jsx(CloseIconWrapper, __assign({ onClick: handleClose }, { children: jsxRuntime.jsx(kuiIcon.CrossWithCircleIcon, {}) }))] })), parentNode)] }));
912
913
  }
913
- var containerCSS = react$1.css(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
914
+ var containerCSS = react.css(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"], ["\n body {\n position: relative;\n }\n .KUI-LoadingPopup_container {\n display: flex;\n flex-direction: column-reverse;\n position: fixed;\n bottom: 56px;\n justify-content: center;\n width: 100%;\n align-items: center;\n z-index: 10000;\n }\n"])));
914
915
  var StyledWrapper$5 = styled__default["default"](kuiBasic.Grid)(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n height: 48px;\n border-radius: 66px;\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n background: rgba(25, 25, 25, 0.8);\n padding: 4px 12px 4px 8px;\n margin-top: 16px;\n width: max-content;\n min-width: 247px;\n &:last-child {\n margin-top: 0;\n }\n"], ["\n height: 48px;\n border-radius: 66px;\n box-shadow: 0px 26px 34px rgba(0, 0, 0, 0.1);\n background: rgba(25, 25, 25, 0.8);\n padding: 4px 12px 4px 8px;\n margin-top: 16px;\n width: max-content;\n min-width: 247px;\n &:last-child {\n margin-top: 0;\n }\n"])));
915
916
  var StyledCaption$1 = styled__default["default"](kuiBasic.Caption)(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["\n padding: 0 14px;\n"], ["\n padding: 0 14px;\n"])));
916
917
  var StyledLoader = styled__default["default"](kuiBasic.CircularProgress)(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n color: #f1f1f1;\n width: 28px !important;\n height: 28px !important;\n"], ["\n color: #f1f1f1;\n width: 28px !important;\n height: 28px !important;\n"])));
@@ -919,7 +920,7 @@ var templateObject_1$g, templateObject_2$8, templateObject_3$7, templateObject_4
919
920
 
920
921
  function LoaderState(_a) {
921
922
  var loader = _a.loader, onlyError = _a.onlyError;
922
- react.useEffect(function () { return function () {
923
+ React.useEffect(function () { return function () {
923
924
  loader === null || loader === void 0 ? void 0 : loader.cleanError();
924
925
  if (!onlyError)
925
926
  loader === null || loader === void 0 ? void 0 : loader.endLoading();
@@ -931,10 +932,10 @@ var LoaderState$1 = mobxReact.observer(LoaderState);
931
932
  var name = "inn";
932
933
  var CompanyInnAutocomplete = function (props) {
933
934
  var form = props.form, otherProps = __rest(props, ["form"]);
934
- var loaderRef = react.useRef(new kuiUtils.Loader());
935
+ var loaderRef = React.useRef(new kuiUtils.Loader());
935
936
  var loader = loaderRef.current;
936
- var _a = react.useState(""), searchQuery = _a[0], setSearchQuery = _a[1];
937
- var _b = react.useState([]), companies = _b[0], setCompanies = _b[1];
937
+ var _a = React.useState(""), searchQuery = _a[0], setSearchQuery = _a[1];
938
+ var _b = React.useState([]), companies = _b[0], setCompanies = _b[1];
938
939
  var updateFormFields = function (company) {
939
940
  if (company) {
940
941
  form.setValue("inn", company.inn);
@@ -988,9 +989,9 @@ var CompanyInnAutocomplete$1 = mobxReact.observer(CompanyInnAutocomplete);
988
989
 
989
990
  function MapComponent(props) {
990
991
  var center = props.center, zoom = props.zoom, withMarker = props.withMarker, setMapProp = props.setMap;
991
- var _a = react.useState(null), map = _a[0], setMap = _a[1];
992
- var ref = react.useRef(null);
993
- react.useEffect(function () {
992
+ var _a = React.useState(null), map = _a[0], setMap = _a[1];
993
+ var ref = React.useRef(null);
994
+ React.useEffect(function () {
994
995
  if (ref.current) {
995
996
  var createdMap = new window.google.maps.Map(ref.current, {
996
997
  center: center,
@@ -1003,7 +1004,7 @@ function MapComponent(props) {
1003
1004
  setMapProp(createdMap);
1004
1005
  }
1005
1006
  }, [center, zoom]);
1006
- react.useEffect(function () {
1007
+ React.useEffect(function () {
1007
1008
  if (withMarker && map) {
1008
1009
  // eslint-disable-next-line no-new
1009
1010
  new window.google.maps.Marker({
@@ -1012,7 +1013,7 @@ function MapComponent(props) {
1012
1013
  map: map,
1013
1014
  });
1014
1015
  }
1015
- }, [withMarker, map]);
1016
+ }, [withMarker, center, map]);
1016
1017
  return jsxRuntime$1.jsx("div", { ref: ref, id: "map", css: { height: "100%" } });
1017
1018
  }
1018
1019
  MapComponent.defaultProps = {
@@ -1025,8 +1026,8 @@ var MapComponent$1 = mobxReact.observer(MapComponent);
1025
1026
  function ModalWithMap(props) {
1026
1027
  var _this = this;
1027
1028
  var place = props.place, onSave = props.onSave, handleClose = props.handleClose, open = props.open, disabled = props.disabled;
1028
- var _a = react.useState(null), map = _a[0], setMap = _a[1];
1029
- var markerRef = react.useRef(null);
1029
+ var _a = React.useState(null), map = _a[0], setMap = _a[1];
1030
+ var markerRef = React.useRef(null);
1030
1031
  var form = reactHookForm.useForm();
1031
1032
  var addNewMarker = function (position) {
1032
1033
  if (!map) {
@@ -1071,7 +1072,7 @@ function ModalWithMap(props) {
1071
1072
  onSave(addressAutoComplete);
1072
1073
  handleClose();
1073
1074
  };
1074
- react.useEffect(function () {
1075
+ React.useEffect(function () {
1075
1076
  var _a;
1076
1077
  if (map) {
1077
1078
  form.setValue("mapAddress.address", place === null || place === void 0 ? void 0 : place.formatted_address);
@@ -1080,7 +1081,7 @@ function ModalWithMap(props) {
1080
1081
  }
1081
1082
  }
1082
1083
  }, [place, map]);
1083
- react.useEffect(function () {
1084
+ React.useEffect(function () {
1084
1085
  if (map && !disabled)
1085
1086
  map.addListener("click", addPlace);
1086
1087
  return function () { return map === null || map === void 0 ? void 0 : map.unbindAll(); };
@@ -1113,8 +1114,8 @@ function InputWithMap(_a) {
1113
1114
  var buttonOffset = 12;
1114
1115
  function PreviewImageCard(props) {
1115
1116
  var url = props.url, onDelete = props.onDelete, onClick = props.onClick, index = props.index, disabled = props.disabled, otherProps = __rest(props, ["url", "onDelete", "onClick", "index", "disabled"]);
1116
- var _a = react.useState(0), closeButtonOpacity = _a[0], setCloseButtonOpacity = _a[1];
1117
- var cardRef = react.useRef(null);
1117
+ var _a = React.useState(0), closeButtonOpacity = _a[0], setCloseButtonOpacity = _a[1];
1118
+ var cardRef = React.useRef(null);
1118
1119
  var coords = usePortalPosition(cardRef);
1119
1120
  var closeButtonStyles = {
1120
1121
  right: coords ? coords.right - buttonOffset : 0,
@@ -1162,7 +1163,7 @@ function FileUploaderWithPreview(props) {
1162
1163
  var filePreviewURL = field.value
1163
1164
  ? getFilePreviewURL(field.value)
1164
1165
  : null;
1165
- var _c = react.useState(filePreviewURL), filePreview = _c[0], setFilePreview = _c[1];
1166
+ var _c = React.useState(filePreviewURL), filePreview = _c[0], setFilePreview = _c[1];
1166
1167
  var formRegister = form.register(name);
1167
1168
  var handleChange = function (e) {
1168
1169
  var _a;
@@ -1476,7 +1477,7 @@ var CompaniesStore = /** @class */ (function () {
1476
1477
  function CompanyAutocomplete(props) {
1477
1478
  var _this = this;
1478
1479
  var form = props.form, name = props.name, label = props.label, handleSelect = props.handleSelect, forApartment = props.forApartment, otherProps = __rest(props, ["form", "name", "label", "handleSelect", "forApartment"]);
1479
- var companiesStore = react.useRef(new CompaniesStore());
1480
+ var companiesStore = React.useRef(new CompaniesStore());
1480
1481
  var _a = companiesStore.current, companies = _a.companies, paginator = _a.paginator, fetchAll = _a.fetchAll, loader = _a.loader, filter = _a.filter;
1481
1482
  var logo = reactHookForm.useWatch({
1482
1483
  control: form.control,
@@ -1514,7 +1515,7 @@ function CompanyAutocomplete(props) {
1514
1515
  }
1515
1516
  });
1516
1517
  }); };
1517
- react.useEffect(function () {
1518
+ React.useEffect(function () {
1518
1519
  if (forApartment) {
1519
1520
  filter.updateFilterQuery("&for_apartment=".concat(forApartment));
1520
1521
  }
@@ -1641,17 +1642,17 @@ var FillingTagsStore = /** @class */ (function () {
1641
1642
  function FillingTagsAutocomplete(_a) {
1642
1643
  var _this = this;
1643
1644
  var form = _a.form, name = _a.name, label = _a.label, type = _a.type; _a.defaultValue; var otherProps = __rest(_a, ["form", "name", "label", "type", "defaultValue"]);
1644
- var tagsStoreRef = react.useRef(new FillingTagsStore());
1645
+ var tagsStoreRef = React.useRef(new FillingTagsStore());
1645
1646
  var tagsStore = tagsStoreRef.current;
1646
1647
  var filteredTags = tagsStore.filteredTags, fetchTags = tagsStore.fetchTags, loader = tagsStore.loader, filter = tagsStore.filter;
1647
- react.useEffect(function () {
1648
+ React.useEffect(function () {
1648
1649
  filter.updateSearchQuery("");
1649
1650
  }, []);
1650
1651
  var onSelectItem = function (item) {
1651
1652
  form.setValue("".concat(name, ".id"), item === null || item === void 0 ? void 0 : item.id);
1652
1653
  form.setValue("".concat(name, ".name"), item === null || item === void 0 ? void 0 : item.name, { shouldValidate: true });
1653
1654
  };
1654
- react.useEffect(function () {
1655
+ React.useEffect(function () {
1655
1656
  fetchTags(type);
1656
1657
  }, [type]);
1657
1658
  var onSearchItem = function (value) {
@@ -1761,7 +1762,7 @@ var getPartialPayerFields = function (mainPayer, refundFromRef, variant, utility
1761
1762
  },
1762
1763
  ]; };
1763
1764
 
1764
- var InputSelect = react.forwardRef(function (_a, ref) {
1765
+ var InputSelect = React.forwardRef(function (_a, ref) {
1765
1766
  var form = _a.form, inputProps = __rest(_a, ["form"]);
1766
1767
  return form ? (jsxRuntime.jsx(kuiComplex.InputSelectWithController, __assign({ ref: ref, form: form }, inputProps))) : (jsxRuntime.jsx(kuiComplex.InputSelect, __assign({ ref: ref, form: form }, inputProps)));
1767
1768
  });
@@ -1776,8 +1777,8 @@ var PartialPayer = function (props) {
1776
1777
  "".concat(name, ".refundFrom"),
1777
1778
  ],
1778
1779
  }), payerType = _a[0], mainPayer = _a[1], refundFrom = _a[2];
1779
- var refundFromRef = react.useRef(null);
1780
- react.useEffect(function () {
1780
+ var refundFromRef = React.useRef(null);
1781
+ React.useEffect(function () {
1781
1782
  if (payerType && payerType !== "partial") {
1782
1783
  form.setValue("".concat(name, ".refundFrom"), payerType);
1783
1784
  form.setValue("".concat(name, ".mainPayer"), null);
@@ -1785,16 +1786,16 @@ var PartialPayer = function (props) {
1785
1786
  form.setValue("".concat(name, ".partType"), null);
1786
1787
  }
1787
1788
  }, [payerType]);
1788
- react.useEffect(function () {
1789
+ React.useEffect(function () {
1789
1790
  if (mainPayer === refundFrom && refundFromRef.current) {
1790
1791
  form.setValue("".concat(name, ".refundFrom"), null);
1791
1792
  refundFromRef.current.value = "";
1792
1793
  }
1793
1794
  }, [mainPayer]);
1794
- react.useEffect(function () {
1795
+ React.useEffect(function () {
1795
1796
  return form.setValue("".concat(name, ".utilityType"), utilityType);
1796
1797
  }, [utilityType]);
1797
- react.useEffect(function () {
1798
+ React.useEffect(function () {
1798
1799
  if (!form.formState.isDirty) {
1799
1800
  var main = form.getValues("".concat(name, ".mainPayer"));
1800
1801
  var rest = form.getValues("".concat(name, ".refundFrom"));
@@ -1970,9 +1971,9 @@ var DistrictsStore = /** @class */ (function () {
1970
1971
 
1971
1972
  function DistrictAutocomplete(props) {
1972
1973
  var form = props.form, name = props.name, label = props.label, onSelect = props.onSelect, cityName = props.cityName, otherProps = __rest(props, ["form", "name", "label", "onSelect", "cityName"]);
1973
- var districtsStoreRef = react.useRef(new DistrictsStore());
1974
- var _a = react.useState(false), isMounted = _a[0], setIsMounted = _a[1];
1975
- var inputRef = react.useRef(null);
1974
+ var districtsStoreRef = React.useRef(new DistrictsStore());
1975
+ var _a = React.useState(false), isMounted = _a[0], setIsMounted = _a[1];
1976
+ var inputRef = React.useRef(null);
1976
1977
  var _b = districtsStoreRef.current, districts = _b.districts, fetchDistricts = _b.fetchDistricts, paginator = _b.paginator, filter = _b.filter, loader = _b.loader;
1977
1978
  var isLoading = loader.isLoading;
1978
1979
  var city = reactHookForm.useWatch({
@@ -1986,7 +1987,7 @@ function DistrictAutocomplete(props) {
1986
1987
  if (onSelect)
1987
1988
  onSelect(item);
1988
1989
  };
1989
- react.useEffect(function () {
1990
+ React.useEffect(function () {
1990
1991
  if (isMounted && inputRef.current) {
1991
1992
  form.setValue("".concat(name, ".id"), null);
1992
1993
  form.setValue("".concat(name, ".name"), null);
@@ -2050,7 +2051,7 @@ function TariffReplacementFields(_a) {
2050
2051
  var addTariff = function () {
2051
2052
  append({ name: "" });
2052
2053
  };
2053
- react.useEffect(function () {
2054
+ React.useEffect(function () {
2054
2055
  if (fields.length > 0)
2055
2056
  setReplaceable(true);
2056
2057
  else
@@ -2209,8 +2210,8 @@ var renderFieldsByResource = function (resource, isReplaceable, handleSubmit, cr
2209
2210
  function TariffCreationForm(props) {
2210
2211
  var _this = this;
2211
2212
  var handleClose = props.handleClose, creationForm = props.creationForm, createTariff = props.createTariff, defaultResource = props.defaultResource;
2212
- var _a = react.useState(defaultResource), resource = _a[0], setResource = _a[1];
2213
- var _b = react.useState(false), isReplaceable = _b[0], setReplaceable = _b[1];
2213
+ var _a = React.useState(defaultResource), resource = _a[0], setResource = _a[1];
2214
+ var _b = React.useState(false), isReplaceable = _b[0], setReplaceable = _b[1];
2214
2215
  var handleSubmit = function (data) { return __awaiter(_this, void 0, void 0, function () {
2215
2216
  return __generator(this, function (_a) {
2216
2217
  switch (_a.label) {
@@ -2243,10 +2244,10 @@ function TariffCreationModal(props) {
2243
2244
  function TariffGroupAutocomplete(props) {
2244
2245
  var _this = this;
2245
2246
  var form = props.form, name = props.name, label = props.label, resource = props.resource, filterQuery = props.filter, filterRequired = props.filterRequired, otherProps = __rest(props, ["form", "name", "label", "resource", "filter", "filterRequired"]);
2246
- var tariffsStoreRef = react.useRef(new TariffsLiteStore());
2247
+ var tariffsStoreRef = React.useRef(new TariffsLiteStore());
2247
2248
  var tariffsStore = tariffsStoreRef.current;
2248
2249
  var tariffs = tariffsStore.tariffs, paginator = tariffsStore.paginator, fetchAll = tariffsStore.fetchAll, loader = tariffsStore.loader, filter = tariffsStore.filter;
2249
- var fetchAllByResource = react.useCallback(function () {
2250
+ var fetchAllByResource = React.useCallback(function () {
2250
2251
  if (filterRequired ? filter.filterQuery : true) {
2251
2252
  fetchAll(resource);
2252
2253
  }
@@ -2270,7 +2271,7 @@ function TariffGroupAutocomplete(props) {
2270
2271
  }
2271
2272
  });
2272
2273
  }); };
2273
- react.useEffect(function () {
2274
+ React.useEffect(function () {
2274
2275
  filter.updateFilterQuery(filterQuery);
2275
2276
  }, [filterQuery]);
2276
2277
  return (jsxRuntime.jsx(kuiComplex.InputWithAutocomplete, __assign({ renderOption: function (option) { return (jsxRuntime.jsx(kuiComplex.AutocompleteOption, { label: option.name })); }, options: tariffs, isLoading: loader.isLoading, label: label, form: form, name: "".concat(name, ".name"), hideName: "".concat(name, ".id"), onSelectItem: onSelectItem, onSearchItem: onSearchItem, handleScrollEnd: onScrollEnd, creatingLabel: "Add new tariff group", renderCreatingModal: function (modalProps) { return (jsxRuntime.jsx(TariffCreationModal, __assign({ creationForm: tariffsStore.creationForm, createTariff: onCreate, defaultResource: resource }, modalProps))); } }, otherProps)));
@@ -2390,7 +2391,7 @@ function ReplaceableCountersBlock(_a) {
2390
2391
  else
2391
2392
  setIsReplaceable(false);
2392
2393
  };
2393
- react.useEffect(function () { return function () { return setIsReplaceable(false); }; });
2394
+ React.useEffect(function () { return function () { return setIsReplaceable(false); }; });
2394
2395
  return (jsxRuntime$1.jsx(kuiComplex.RadioGroupWithLabel, { isSquare: true, fullWidth: true, title: "Replacement meter", direction: "vertical", form: form, name: "replaceableCounter", options: options, defaultValue: "none", "data-testid": "replaceable_counters", onChange: handleChange }));
2395
2396
  }
2396
2397
  var ReplaceableCountersBlock$1 = mobxReact.observer(ReplaceableCountersBlock);
@@ -2400,7 +2401,7 @@ function MeterFeaturesFields(props) {
2400
2401
  var handleSubmit = props.handleSubmit, renderMeterType = props.renderMeterType, withLastValue = props.withLastValue, setIsReplaceable = props.setIsReplaceable;
2401
2402
  var operatingAccount = props.operatingAccount, administrativeCompany = props.administrativeCompany, apartmentId = props.apartmentId, withPassport = props.withPassport;
2402
2403
  var formBottomProps = props.formBottomProps, defaultValues = props.defaultValues, withNextCheck = props.withNextCheck;
2403
- var _a = react.useState(false), disableOperatingAccount = _a[0], setDisableOperatingAccount = _a[1];
2404
+ var _a = React.useState(false), disableOperatingAccount = _a[0], setDisableOperatingAccount = _a[1];
2404
2405
  var withMeterType = resource === "water" || resource === "electricity";
2405
2406
  var tariffFilter = "".concat(apartmentId ? "&for_apartment=".concat(apartmentId) : "").concat(withMeterType && meterType ? "&type=".concat(meterType) : "");
2406
2407
  var handleCompanyChange = function (company) {
@@ -2428,14 +2429,14 @@ function MeterFeaturesFields(props) {
2428
2429
  .filter(function (field) { return field.type === "number"; })
2429
2430
  .map(function (field) { return field.name; });
2430
2431
  var meterFeaturesFieldsSchema = getMeterFeaturesFieldsSchema(valueFieldsName, !!maxMeters && Number(replacements === null || replacements === void 0 ? void 0 : replacements.length) >= Number(maxMeters));
2431
- var form = react.useMemo(function () {
2432
+ var form = React.useMemo(function () {
2432
2433
  return reactHookForm.useForm({
2433
2434
  resolver: yup$1.yupResolver(meterFeaturesFieldsSchema),
2434
2435
  defaultValues: __assign({ operationalAccountNumber: operatingAccount }, defaultValues),
2435
2436
  values: defaultValues,
2436
2437
  });
2437
2438
  }, [meterFeaturesFieldsSchema]);
2438
- react.useEffect(function () {
2439
+ React.useEffect(function () {
2439
2440
  if (!replacements || (replacements === null || replacements === void 0 ? void 0 : replacements.length) === 0) {
2440
2441
  form.setValue("replaceableCounter", "");
2441
2442
  }
@@ -2453,12 +2454,12 @@ function MeterTypeRadioGroup(props) {
2453
2454
 
2454
2455
  function MeterFeaturesForm(props) {
2455
2456
  var formStore = props.formStore, handleSubmit = props.handleSubmit, resource = props.resource, maxMeters = props.maxMeters, handleMeterTypeChange = props.handleMeterTypeChange, defaultValues = props.defaultValues, other = __rest(props, ["formStore", "handleSubmit", "resource", "maxMeters", "handleMeterTypeChange", "defaultValues"]);
2456
- var _a = react.useState(false), isReplaceable = _a[0], setIsReplaceable = _a[1];
2457
+ var _a = React.useState(false), isReplaceable = _a[0], setIsReplaceable = _a[1];
2457
2458
  var withMeterType = (resource === "water" && maxMeters !== 1) || resource === "electricity";
2458
2459
  var defaultType = resource === "water" ? "cold" : "T1";
2459
2460
  var defaultMeterType = withMeterType ? defaultType : null;
2460
- var _b = react.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.type) || defaultMeterType), meterType = _b[0], setMeterType = _b[1];
2461
- react.useEffect(function () {
2461
+ var _b = React.useState((defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.type) || defaultMeterType), meterType = _b[0], setMeterType = _b[1];
2462
+ React.useEffect(function () {
2462
2463
  if (handleMeterTypeChange) {
2463
2464
  handleMeterTypeChange(meterType);
2464
2465
  }
@@ -2498,7 +2499,7 @@ var SignInPage = function (props) {
2498
2499
  var handleSubmit = props.handleSubmit, isLoading = props.isLoading, err = props.err;
2499
2500
  return (jsxRuntime.jsxs(StyledWrapper$1, { children: [jsxRuntime.jsx(StyledBackground, { src: img }), jsxRuntime.jsx(StyledContainer, { children: jsxRuntime.jsx(StyledCardWrapper, __assign({ container: true, alignItems: "center" }, { children: jsxRuntime.jsxs(StyledCard, { children: [jsxRuntime.jsx(kuiBasic.Box, __assign({ mb: 4 }, { children: jsxRuntime.jsx(kuiIcon.MaroomIcon, { width: 143, height: 32 }) })), jsxRuntime.jsx(kuiBasic.Box, __assign({ mb: 1 }, { children: jsxRuntime.jsx(kuiBasic.Heading, { children: "Welcome" }) })), isLoading ? (jsxRuntime.jsx(kuiComplex.Loading, { height: "65%" })) : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ErrorBlock, __assign({ mb: 1 }, { children: jsxRuntime.jsx(kuiBasic.Caption, __assign({ weight: 600 }, { children: err && "Вы ввели неверные данные" })) })), jsxRuntime.jsx(SignInForm, { onSubmit: handleSubmit })] }))] }) })) })] }));
2500
2501
  };
2501
- var index = mobxReact.observer(SignInPage);
2502
+ var index$1 = mobxReact.observer(SignInPage);
2502
2503
  var StyledWrapper$1 = styled__default["default"].div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n height: 100vh;\n width: 100vw;\n position: relative;\n"], ["\n height: 100vh;\n width: 100vw;\n position: relative;\n"])));
2503
2504
  var StyledBackground = styled__default["default"].img(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n object-position: bottom center;\n object-fit: cover;\n"], ["\n height: 100%;\n width: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n object-position: bottom center;\n object-fit: cover;\n"])));
2504
2505
  var StyledCard = styled__default["default"].div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n background: ", ";\n border-radius: 16px;\n box-shadow: 0px 0px 1px rgba(10, 31, 68, 0.1),\n 0px 26px 26px rgba(10, 31, 68, 0.12);\n width: 496px;\n height: 512px;\n padding: 64px 48px;\n box-sizing: border-box;\n z-index: 1;\n @media (max-width: 960px) {\n width: 100%;\n padding: 32px 24px;\n height: 455px;\n }\n"], ["\n background: ", ";\n border-radius: 16px;\n box-shadow: 0px 0px 1px rgba(10, 31, 68, 0.1),\n 0px 26px 26px rgba(10, 31, 68, 0.12);\n width: 496px;\n height: 512px;\n padding: 64px 48px;\n box-sizing: border-box;\n z-index: 1;\n @media (max-width: 960px) {\n width: 100%;\n padding: 32px 24px;\n height: 455px;\n }\n"])), kuiBasic.theme.palette.grey.zero);
@@ -2519,12 +2520,12 @@ var templateObject_1$1;
2519
2520
 
2520
2521
  function CopyButton(_a) {
2521
2522
  var text = _a.text, otherProps = __rest(_a, ["text"]);
2522
- var _b = react.useState(false), isCopied = _b[0], setIsCopied = _b[1];
2523
+ var _b = React.useState(false), isCopied = _b[0], setIsCopied = _b[1];
2523
2524
  var handleClick = function () {
2524
2525
  kuiUtils.copyInfo(text);
2525
2526
  setIsCopied(true);
2526
2527
  };
2527
- react.useEffect(function () {
2528
+ React.useEffect(function () {
2528
2529
  var intervalId;
2529
2530
  if (isCopied) {
2530
2531
  var timeout = setTimeout(function () {
@@ -2545,6 +2546,13 @@ var CardWrapper = styled__default["default"].div(templateObject_3 || (templateOb
2545
2546
  var Wrapper = styled__default["default"](kuiBasic.Grid)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: auto;\n position: relative;\n"], ["\n width: auto;\n position: relative;\n"])));
2546
2547
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
2547
2548
 
2549
+ function MultistepForm(props) {
2550
+ var form = props.form, children = props.children, stepShift = props.stepShift;
2551
+ var childrenList = React__default["default"].Children.toArray(children);
2552
+ return jsxRuntime.jsx("div", { children: childrenList[form.step - (1 + (stepShift || 0))] });
2553
+ }
2554
+ var index = mobxReact.observer(MultistepForm);
2555
+
2548
2556
  var getFillingInfoFields = function (withType, type, setType) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], kuiUtils.addToArrayByCondition(withType, {
2549
2557
  label: "Filling type",
2550
2558
  name: "type",
@@ -2868,6 +2876,7 @@ exports.MeterFeaturesForm = MeterFeaturesForm;
2868
2876
  exports.MeterTypeRadioGroup = MeterTypeRadioGroup;
2869
2877
  exports.Modal = Modal;
2870
2878
  exports.ModalWithMap = ModalWithMap$1;
2879
+ exports.MultistepForm = index;
2871
2880
  exports.OpenMapButton = OpenMapButton;
2872
2881
  exports.ParkingTypesValues = ParkingTypesValues;
2873
2882
  exports.PartialPayer = PartialPayer;
@@ -2881,7 +2890,7 @@ exports.ReplaceableCountersBlock = ReplaceableCountersBlock$1;
2881
2890
  exports.ResourceValues = ResourceValues;
2882
2891
  exports.RoomTypeValues = RoomTypeValues;
2883
2892
  exports.RoomTypesValues = RoomTypesValues;
2884
- exports.SignInPage = index;
2893
+ exports.SignInPage = index$1;
2885
2894
  exports.SquarePreviewImage = SquarePreviewImage;
2886
2895
  exports.TVTypesValues = TVTypesValues;
2887
2896
  exports.TableBottomLoading = TableBottomLoading;