rsuite 5.37.2 → 5.37.4

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.
@@ -502,9 +502,6 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
502
502
  (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.open();
503
503
  }
504
504
  }, [readOnly]);
505
- var handleBlur = useCallback(function () {
506
- setOpen(false);
507
- }, []);
508
505
  var handleEnter = useCallback(function () {
509
506
  focusInput();
510
507
  setOpen(true);
@@ -742,7 +739,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
742
739
  }, tagElements, displaySearchInput && /*#__PURE__*/React.createElement(InputSearch, _extends({}, inputProps, {
743
740
  tabIndex: tabIndex,
744
741
  readOnly: readOnly,
745
- onBlur: createChainedFunction(handleBlur, onBlur),
742
+ onBlur: onBlur,
746
743
  onFocus: createChainedFunction(handleFocus, onFocus),
747
744
  inputRef: inputRef,
748
745
  onChange: handleSearch,
@@ -230,7 +230,7 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
230
230
  }, [enterable, open, handleOpen]);
231
231
  var handleDelayedClose = useCallback(function () {
232
232
  if (!enterable) {
233
- handleClose();
233
+ return handleClose();
234
234
  }
235
235
 
236
236
  isOnTrigger.current = false;
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import React, { useState, useImperativeHandle, useCallback } from 'react';
2
+ import React, { useState, useImperativeHandle, useCallback, useMemo } from 'react';
3
3
  import kebabCase from 'lodash/kebabCase';
4
4
  import trim from 'lodash/trim';
5
5
  import isFunction from 'lodash/isFunction';
@@ -522,24 +522,17 @@ export function useSearch(data, props) {
522
522
  }
523
523
 
524
524
  return shouldDisplay(checkValue, _keyword);
525
- }, [labelKey, searchBy, searchKeyword]); // TODO-Doma
526
- // filteredData should be derived from data and searchKeyword
527
- // This redundant state might be here for preventing callback firing multiple times
528
- // Find out if this is the case and remove this state if possible
529
-
530
- var _useState5 = useState(function () {
525
+ }, [labelKey, searchBy, searchKeyword]);
526
+ var filteredData = useMemo(function () {
531
527
  return data.filter(function (item) {
532
- return checkShouldDisplay(item);
528
+ return checkShouldDisplay(item, searchKeyword);
533
529
  });
534
- }),
535
- filteredData = _useState5[0],
536
- setFilteredData = _useState5[1];
530
+ }, [checkShouldDisplay, data, searchKeyword]);
537
531
 
538
532
  var handleSearch = function handleSearch(searchKeyword, event) {
539
533
  var filteredData = data.filter(function (item) {
540
534
  return checkShouldDisplay(item, searchKeyword);
541
535
  });
542
- setFilteredData(filteredData);
543
536
  setSearchKeyword(searchKeyword);
544
537
  callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);
545
538
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.37.2",
3
+ "version": "5.37.4",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",