indicator-ui 0.1.8 → 0.1.9

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/dist/index.js CHANGED
@@ -62262,7 +62262,7 @@ var _Dropdown = function _Dropdown(props, ref) {
62262
62262
  }
62263
62263
  };
62264
62264
  var getItemProps = function getItemProps(curItem) {
62265
- if ((0,_lib__WEBPACK_IMPORTED_MODULE_3__.isObject)(curItem) && 'value' in curItem) {
62265
+ if ((0,_lib__WEBPACK_IMPORTED_MODULE_3__.isObject)(curItem)) {
62266
62266
  return curItem;
62267
62267
  } else {
62268
62268
  return {
@@ -66274,7 +66274,7 @@ __webpack_require__.r(__webpack_exports__);
66274
66274
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
66275
66275
  /* harmony export */ });
66276
66276
  // extracted by mini-css-extract-plugin
66277
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({"selectField":"SelectField-module__selectField___p9S2j","modalWindowWrapper":"SelectField-module__modalWindowWrapper___i4_Uy","modalWindow":"SelectField-module__modalWindow___JVZ8d","selectModalWindow":"SelectField-module__selectModalWindow___w55Pm","show-animation":"SelectField-module__show-animation___Ee3LS","selectFieldOptionsItem":"SelectField-module__selectFieldOptionsItem___hQMC7","label":"SelectField-module__label___Orjua","active":"SelectField-module__active___a3j2T"});
66277
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({"selectField":"SelectField-module__selectField___p9S2j"});
66278
66278
 
66279
66279
  /***/ }),
66280
66280
 
@@ -66388,7 +66388,9 @@ function SelectField(_ref) {
66388
66388
  onBlur = _ref.onBlur,
66389
66389
  pagination = _ref.pagination,
66390
66390
  _onFocus = _ref.onFocus,
66391
- isActiveItem = _ref.isActiveItem;
66391
+ isActiveItem = _ref.isActiveItem,
66392
+ _ref$position = _ref.position,
66393
+ position = _ref$position === void 0 ? 'absolute' : _ref$position;
66392
66394
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false),
66393
66395
  _useState2 = _slicedToArray(_useState, 2),
66394
66396
  isFocus = _useState2[0],
@@ -66397,19 +66399,27 @@ function SelectField(_ref) {
66397
66399
  _useState4 = _slicedToArray(_useState3, 2),
66398
66400
  searchingString = _useState4[0],
66399
66401
  setSearchingString = _useState4[1];
66400
- var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false),
66401
- _useState6 = _slicedToArray(_useState5, 2),
66402
- isShowModalWindow = _useState6[0],
66403
- setIsShowModalWindow = _useState6[1];
66404
66402
  var requestPromiseRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(undefined);
66405
66403
  // Кэширование выбранных options
66406
66404
  var optionsCacheRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(options);
66407
- var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options),
66408
- _useState8 = _slicedToArray(_useState7, 2),
66409
- optionsState = _useState8[0],
66410
- setOptionsState = _useState8[1];
66405
+ var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options),
66406
+ _useState6 = _slicedToArray(_useState5, 2),
66407
+ optionsState = _useState6[0],
66408
+ setOptionsState = _useState6[1];
66411
66409
  var inputRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
66412
66410
  var searchingTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
66411
+ var targetRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
66412
+ var modalRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
66413
+ var _useModal = (0,_hooks__WEBPACK_IMPORTED_MODULE_2__.useModal)(modalRef, {
66414
+ targetRef: targetRef,
66415
+ position: position,
66416
+ animeType: 'dropdown'
66417
+ }),
66418
+ getIsShow = _useModal.getIsShow,
66419
+ open = _useModal.open,
66420
+ close = _useModal.close,
66421
+ switching = _useModal.switching,
66422
+ isShow = _useModal.isShow;
66413
66423
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
66414
66424
  // Установка значения при required
66415
66425
  var firstOptions = optionsState === null || optionsState === void 0 ? void 0 : optionsState[0];
@@ -66471,7 +66481,7 @@ function SelectField(_ref) {
66471
66481
  onChange === null || onChange === void 0 || onChange(resValues);
66472
66482
  } else {
66473
66483
  onChange === null || onChange === void 0 || onChange(resValues[resValues.length - 1]);
66474
- setIsShowModalWindow(false);
66484
+ close();
66475
66485
  onBlur === null || onBlur === void 0 || onBlur();
66476
66486
  }
66477
66487
  };
@@ -66593,22 +66603,20 @@ function SelectField(_ref) {
66593
66603
  onChange: search,
66594
66604
  disabled: disabled,
66595
66605
  onFocus: function onFocus() {
66596
- setIsShowModalWindow(true);
66606
+ if (!getIsShow()) {
66607
+ open();
66608
+ }
66597
66609
  setIsFocus(true);
66598
66610
  _onFocus === null || _onFocus === void 0 || _onFocus();
66599
66611
  },
66600
66612
  onBlur: function onBlur() {
66601
66613
  return setIsFocus(false);
66602
66614
  },
66603
- onDropdownClick: function onDropdownClick() {
66604
- return setIsShowModalWindow(function (prevState) {
66605
- return !prevState;
66606
- });
66607
- },
66615
+ onDropdownClick: switching,
66608
66616
  isError: isError,
66609
66617
  placeholder: placeholder,
66610
66618
  dropdown: true,
66611
- dropdownState: isShowModalWindow,
66619
+ dropdownState: isShow,
66612
66620
  ref: inputRef
66613
66621
  });
66614
66622
  }
@@ -66619,37 +66627,21 @@ function SelectField(_ref) {
66619
66627
  placeholder: placeholder,
66620
66628
  notInput: true,
66621
66629
  onFocus: _onFocus,
66622
- onClick: function onClick() {
66623
- return setIsShowModalWindow(function (prevState) {
66624
- return !prevState;
66625
- });
66626
- },
66630
+ onClick: switching,
66627
66631
  dropdown: true,
66628
- dropdownState: isShowModalWindow,
66632
+ dropdownState: isShow,
66629
66633
  ref: inputRef
66630
66634
  });
66631
66635
  };
66632
66636
  return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
66633
66637
  className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.selectField,
66634
- children: [getViewField(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", {
66635
- className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindowWrapper,
66636
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.ModalWindowWrapper, {
66637
- isShow: isShowModalWindow,
66638
- setIsShow: function setIsShow(newValue) {
66639
- if (newValue === false) {
66640
- onBlur === null || onBlur === void 0 || onBlur();
66641
- }
66642
- setIsShowModalWindow(newValue);
66643
- },
66644
- additionElements: [inputRef.current],
66645
- className: _styles__WEBPACK_IMPORTED_MODULE_7__.SelectFieldStyle.modalWindow,
66646
- children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.Dropdown, {
66647
- items: getOptionsItems(),
66648
- onScrollBottom: onScrollToBottom,
66649
- onClick: handleClick,
66650
- isActive: isActive
66651
- })
66652
- })
66638
+ ref: targetRef,
66639
+ children: [getViewField(), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_ui__WEBPACK_IMPORTED_MODULE_3__.Dropdown, {
66640
+ items: getOptionsItems(),
66641
+ onScrollBottom: onScrollToBottom,
66642
+ onClick: handleClick,
66643
+ isActive: isActive,
66644
+ ref: modalRef
66653
66645
  })]
66654
66646
  });
66655
66647
  }