rsuite 5.36.0 → 5.37.1

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/rsuite.js CHANGED
@@ -2952,7 +2952,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
2952
2952
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2953
2953
 
2954
2954
  "use strict";
2955
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = exports.InputPickerContext = void 0;\n\nvar _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _isUndefined = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isNil = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _remove = _interopRequireDefault(__webpack_require__(/*! lodash/remove */ \"./node_modules/lodash/remove.js\"));\n\nvar _clone = _interopRequireDefault(__webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\"));\n\nvar _isArray = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _pick = _interopRequireDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\n\nvar _getWidth = _interopRequireDefault(__webpack_require__(/*! dom-lib/getWidth */ \"./node_modules/dom-lib/esm/getWidth.js\"));\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _getDataGroupBy = __webpack_require__(/*! ../utils/getDataGroupBy */ \"./src/utils/getDataGroupBy.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _Tag = _interopRequireDefault(__webpack_require__(/*! ../Tag */ \"./src/Tag/index.tsx\"));\n\nvar _InputAutosize = _interopRequireDefault(__webpack_require__(/*! ./InputAutosize */ \"./src/InputPicker/InputAutosize.tsx\"));\n\nvar _InputSearch = _interopRequireDefault(__webpack_require__(/*! ./InputSearch */ \"./src/InputPicker/InputSearch.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/InputPicker/InputPicker.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2,\n _templateObject3,\n _templateObject4,\n _templateObject5;\n\nvar InputPickerContext = /*#__PURE__*/_react.default.createContext({\n tagProps: {},\n trigger: 'Enter'\n});\n\nexports.InputPickerContext = InputPickerContext;\n\nvar InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _merge;\n\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$appearance = props.appearance,\n appearance = _props$appearance === void 0 ? 'default' : _props$appearance,\n _props$cleanable = props.cleanable,\n cleanable = _props$cleanable === void 0 ? true : _props$cleanable,\n _props$cacheData = props.cacheData,\n cacheData = _props$cacheData === void 0 ? [] : _props$cacheData,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker' : _props$classPrefix,\n _props$data = props.data,\n controlledData = _props$data === void 0 ? [] : _props$data,\n disabled = props.disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n defaultValue = props.defaultValue,\n _props$defaultOpen = props.defaultOpen,\n defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,\n _props$disabledItemVa = props.disabledItemValues,\n disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,\n overrideLocale = props.locale,\n toggleAs = props.toggleAs,\n style = props.style,\n _props$searchable = props.searchable,\n searchable = _props$searchable === void 0 ? true : _props$searchable,\n controlledOpen = props.open,\n placeholder = props.placeholder,\n groupBy = props.groupBy,\n menuClassName = props.menuClassName,\n menuStyle = props.menuStyle,\n _props$menuAutoWidth = props.menuAutoWidth,\n menuAutoWidth = _props$menuAutoWidth === void 0 ? true : _props$menuAutoWidth,\n _props$menuMaxHeight = props.menuMaxHeight,\n menuMaxHeight = _props$menuMaxHeight === void 0 ? 320 : _props$menuMaxHeight,\n creatable = props.creatable,\n valueProp = props.value,\n _props$valueKey = props.valueKey,\n valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,\n virtualized = props.virtualized,\n _props$labelKey = props.labelKey,\n labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,\n listProps = props.listProps,\n id = props.id,\n tabIndex = props.tabIndex,\n sort = props.sort,\n renderMenu = props.renderMenu,\n renderExtraFooter = props.renderExtraFooter,\n renderValue = props.renderValue,\n renderMenuItem = props.renderMenuItem,\n renderMenuGroup = props.renderMenuGroup,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onExit = props.onExit,\n onExited = props.onExited,\n onChange = props.onChange,\n onClean = props.onClean,\n onCreate = props.onCreate,\n onSearch = props.onSearch,\n onSelect = props.onSelect,\n onOpen = props.onOpen,\n onClose = props.onClose,\n onBlur = props.onBlur,\n onFocus = props.onFocus,\n searchBy = props.searchBy,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"appearance\", \"cleanable\", \"cacheData\", \"classPrefix\", \"data\", \"disabled\", \"readOnly\", \"plaintext\", \"defaultValue\", \"defaultOpen\", \"disabledItemValues\", \"locale\", \"toggleAs\", \"style\", \"searchable\", \"open\", \"placeholder\", \"groupBy\", \"menuClassName\", \"menuStyle\", \"menuAutoWidth\", \"menuMaxHeight\", \"creatable\", \"value\", \"valueKey\", \"virtualized\", \"labelKey\", \"listProps\", \"id\", \"tabIndex\", \"sort\", \"renderMenu\", \"renderExtraFooter\", \"renderValue\", \"renderMenuItem\", \"renderMenuGroup\", \"onEnter\", \"onEntered\", \"onExit\", \"onExited\", \"onChange\", \"onClean\", \"onCreate\", \"onSearch\", \"onSelect\", \"onOpen\", \"onClose\", \"onBlur\", \"onFocus\", \"searchBy\", \"placement\"]);\n\n var _useContext = (0, _react.useContext)(InputPickerContext),\n multi = _useContext.multi,\n tagProps = _useContext.tagProps,\n trigger = _useContext.trigger,\n disabledOptions = _useContext.disabledOptions;\n\n if (groupBy === valueKey || groupBy === labelKey) {\n throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');\n }\n\n var overlayRef = (0, _react.useRef)(null);\n var targetRef = (0, _react.useRef)(null);\n var triggerRef = (0, _react.useRef)(null);\n var inputRef = (0, _react.useRef)();\n var listRef = (0, _react.useRef)(null);\n\n var _useCustom = (0, _utils.useCustom)(['Picker', 'InputPicker'], overrideLocale),\n locale = _useCustom.locale;\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n prefix = _useClassNames.prefix,\n merge = _useClassNames.merge;\n\n var _useState = (0, _react.useState)(controlledData),\n uncontrolledData = _useState[0],\n setData = _useState[1];\n\n var _useState2 = (0, _react.useState)(100),\n maxWidth = _useState2[0],\n setMaxWidth = _useState2[1];\n\n var _useState3 = (0, _react.useState)([]),\n newData = _useState3[0],\n setNewData = _useState3[1];\n\n var _useState4 = (0, _react.useState)(defaultOpen),\n uncontrolledOpen = _useState4[0],\n setOpen = _useState4[1];\n\n var open = (0, _isUndefined.default)(controlledOpen) ? uncontrolledOpen : controlledOpen;\n var getAllData = (0, _react.useCallback)(function () {\n return [].concat(uncontrolledData, newData);\n }, [uncontrolledData, newData]);\n var getAllDataAndCache = (0, _react.useCallback)(function () {\n return [].concat(getAllData(), cacheData);\n }, [getAllData, cacheData]);\n\n var _useControlled = (0, _utils.useControlled)(valueProp, multi ? defaultValue || [] : defaultValue),\n value = _useControlled[0],\n setValue = _useControlled[1],\n isControlled = _useControlled[2];\n\n var cloneValue = (0, _react.useCallback)(function () {\n return multi ? (0, _clone.default)(value) || [] : value;\n }, [multi, value]);\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.close();\n }, [triggerRef]); // Used to hover the focuse item when trigger `onKeydown`\n\n var _useFocusItemValue = (0, _Picker.useFocusItemValue)(multi ? value === null || value === void 0 ? void 0 : value[0] : value, {\n data: getAllDataAndCache(),\n valueKey: valueKey,\n target: function target() {\n return overlayRef.current;\n }\n }),\n focusItemValue = _useFocusItemValue.focusItemValue,\n setFocusItemValue = _useFocusItemValue.setFocusItemValue,\n onKeyDown = _useFocusItemValue.onKeyDown;\n\n var handleSearchCallback = (0, _react.useCallback)(function (searchKeyword, filteredData, event) {\n var _filteredData$;\n\n // The first option after filtering is the focus.\n setFocusItemValue(disabledOptions ? searchKeyword : (filteredData === null || filteredData === void 0 ? void 0 : (_filteredData$ = filteredData[0]) === null || _filteredData$ === void 0 ? void 0 : _filteredData$[valueKey]) || searchKeyword);\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchKeyword, event);\n }, [disabledOptions, setFocusItemValue, valueKey, onSearch]); // Use search keywords to filter options.\n\n var _useSearch = (0, _Picker.useSearch)({\n labelKey: labelKey,\n data: getAllData(),\n searchBy: searchBy,\n callback: handleSearchCallback\n }),\n searchKeyword = _useSearch.searchKeyword,\n setSearchKeyword = _useSearch.setSearchKeyword,\n checkShouldDisplay = _useSearch.checkShouldDisplay,\n handleSearch = _useSearch.handleSearch; // Update the state when the data in props changes\n\n\n (0, _react.useEffect)(function () {\n if (controlledData && !(0, _shallowEqual.default)(controlledData, uncontrolledData)) {\n var _controlledData$;\n\n setData(controlledData);\n setNewData([]);\n setFocusItemValue(controlledData === null || controlledData === void 0 ? void 0 : (_controlledData$ = controlledData[0]) === null || _controlledData$ === void 0 ? void 0 : _controlledData$[valueKey]);\n }\n }, [setFocusItemValue, controlledData, uncontrolledData, valueKey]);\n (0, _react.useEffect)(function () {\n var _triggerRef$current2;\n\n // In multiple selection, you need to set a maximum width for the input.\n if ((_triggerRef$current2 = triggerRef.current) !== null && _triggerRef$current2 !== void 0 && _triggerRef$current2.root) {\n setMaxWidth((0, _getWidth.default)(triggerRef.current.root));\n }\n }, []); // Update the position of the menu when the search keyword and value change\n\n (0, _react.useEffect)(function () {\n var _triggerRef$current3, _triggerRef$current3$;\n\n (_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 ? void 0 : (_triggerRef$current3$ = _triggerRef$current3.updatePosition) === null || _triggerRef$current3$ === void 0 ? void 0 : _triggerRef$current3$.call(_triggerRef$current3);\n }, [searchKeyword, value]);\n\n var getDateItem = function getDateItem(value) {\n // Find active `MenuItem` by `value`\n var allData = getAllDataAndCache();\n var activeItem = allData.find(function (item) {\n return (0, _shallowEqual.default)(item[valueKey], value);\n });\n var itemNode = placeholder;\n\n if (activeItem !== null && activeItem !== void 0 && activeItem[labelKey]) {\n itemNode = activeItem === null || activeItem === void 0 ? void 0 : activeItem[labelKey];\n }\n\n return {\n isValid: !!activeItem,\n activeItem: activeItem,\n itemNode: itemNode\n };\n };\n\n var getInput = (0, _react.useCallback)(function () {\n var _inputRef$current;\n\n return multi ? (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.input : inputRef.current;\n }, [inputRef, multi]);\n var focusInput = (0, _react.useCallback)(function () {\n var _getInput;\n\n return (_getInput = getInput()) === null || _getInput === void 0 ? void 0 : _getInput.focus();\n }, [getInput]);\n var blurInput = (0, _react.useCallback)(function () {\n var _getInput2;\n\n return (_getInput2 = getInput()) === null || _getInput2 === void 0 ? void 0 : _getInput2.blur();\n }, [getInput]);\n /**\n * Convert the string of the newly created option into an object.\n */\n\n var createOption = (0, _react.useCallback)(function (value) {\n var _ref2;\n\n if (groupBy) {\n var _ref;\n\n return _ref = {\n create: true\n }, _ref[groupBy] = locale === null || locale === void 0 ? void 0 : locale.newItem, _ref[valueKey] = value, _ref[labelKey] = value, _ref;\n }\n\n return _ref2 = {\n create: true\n }, _ref2[valueKey] = value, _ref2[labelKey] = value, _ref2;\n }, [groupBy, valueKey, labelKey, locale]);\n var handleChange = (0, _react.useCallback)(function (value, event) {\n onChange === null || onChange === void 0 ? void 0 : onChange(value, event);\n }, [onChange]);\n var handleRemoveItemByTag = (0, _react.useCallback)(function (tag, event) {\n event.stopPropagation();\n var val = cloneValue();\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, tag);\n });\n setValue(val);\n handleChange(val, event);\n }, [setValue, cloneValue, handleChange]);\n var handleSelect = (0, _react.useCallback)(function (value, item, event) {\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(value, item, event);\n\n if (creatable && item.create) {\n delete item.create;\n onCreate === null || onCreate === void 0 ? void 0 : onCreate(value, item, event);\n setNewData(newData.concat(item));\n }\n }, [creatable, newData, onSelect, onCreate]);\n /**\n * Callback triggered by single selection\n * @param value\n * @param item\n * @param event\n */\n\n var handleSelectItem = function handleSelectItem(value, item, event) {\n setValue(value);\n setFocusItemValue(value);\n setSearchKeyword('');\n handleSelect(value, item, event);\n handleChange(value, event);\n handleClose();\n };\n /**\n * Callback triggered by multiple selection\n * @param nextItemValue\n * @param item\n * @param event\n * @param checked\n */\n\n\n var handleCheckTag = function handleCheckTag(nextItemValue, item, event, checked) {\n var val = cloneValue();\n\n if (checked) {\n val.push(nextItemValue);\n } else {\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, nextItemValue);\n });\n }\n\n setValue(val);\n setSearchKeyword('');\n setFocusItemValue(nextItemValue);\n handleSelect(val, item, event);\n handleChange(val, event);\n focusInput();\n };\n\n var handleTagKeyPress = (0, _react.useCallback)(function (event) {\n // When composing, ignore the keypress event.\n if (event.nativeEvent.isComposing) {\n return;\n }\n\n var val = cloneValue();\n var data = getAllData();\n\n if (!focusItemValue || !data) {\n return;\n } // If the value is disabled in this option, it is returned.\n\n\n if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {\n return item === focusItemValue;\n })) {\n return;\n }\n\n if (!val.some(function (v) {\n return (0, _shallowEqual.default)(v, focusItemValue);\n })) {\n val.push(focusItemValue);\n } else if (!disabledOptions) {\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, focusItemValue);\n });\n }\n\n var focusItem = data.find(function (item) {\n return (0, _shallowEqual.default)(item === null || item === void 0 ? void 0 : item[valueKey], focusItemValue);\n });\n\n if (!focusItem) {\n focusItem = createOption(focusItemValue);\n }\n\n setValue(val);\n setSearchKeyword('');\n handleSelect(val, focusItem, event);\n handleChange(val, event);\n }, [cloneValue, getAllData, focusItemValue, disabledItemValues, disabledOptions, setValue, setSearchKeyword, handleSelect, handleChange, valueKey, createOption]);\n var handleMenuItemKeyPress = (0, _react.useCallback)(function (event) {\n if (!focusItemValue || !controlledData) {\n return;\n } // If the value is disabled in this option, it is returned.\n\n\n if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {\n return item === focusItemValue;\n })) {\n return;\n } // Find active `MenuItem` by `value`\n\n\n var allData = getAllData();\n var focusItem = allData.find(function (item) {\n return (0, _shallowEqual.default)(item[valueKey], focusItemValue);\n }); // FIXME Bad state flow\n\n if (!focusItem && focusItemValue === searchKeyword) {\n focusItem = createOption(searchKeyword);\n }\n\n setValue(focusItemValue);\n setSearchKeyword('');\n\n if (focusItem) {\n handleSelect(focusItemValue, focusItem, event);\n }\n\n handleChange(focusItemValue, event);\n handleClose();\n }, [setValue, disabledItemValues, controlledData, focusItemValue, valueKey, searchKeyword, handleClose, setSearchKeyword, createOption, getAllData, handleChange, handleSelect]);\n (0, _Picker.usePublicMethods)(ref, {\n triggerRef: triggerRef,\n overlayRef: overlayRef,\n targetRef: targetRef,\n listRef: listRef\n });\n /**\n * Remove the last item, after pressing the back key on the keyboard.\n * @param event\n */\n\n var removeLastItem = (0, _react.useCallback)(function (event) {\n var target = event === null || event === void 0 ? void 0 : event.target;\n\n if ((target === null || target === void 0 ? void 0 : target.tagName) !== 'INPUT') {\n focusInput();\n return;\n }\n\n if ((target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' && target !== null && target !== void 0 && target.value) {\n return;\n }\n\n var val = cloneValue();\n val.pop();\n setValue(val);\n handleChange(val, event);\n }, [setValue, focusInput, handleChange, cloneValue]);\n var handleClean = (0, _react.useCallback)(function (event) {\n if (disabled || searchKeyword !== '') {\n return;\n }\n\n setValue(null);\n setFocusItemValue(null);\n setSearchKeyword('');\n\n if (multi) {\n handleChange([], event);\n } else {\n handleChange(null, event);\n }\n\n onClean === null || onClean === void 0 ? void 0 : onClean(event);\n }, [disabled, searchKeyword, setValue, setFocusItemValue, setSearchKeyword, multi, onClean, handleChange]);\n var events = {\n onMenuPressBackspace: multi ? removeLastItem : handleClean,\n onMenuKeyDown: onKeyDown,\n onMenuPressEnter: undefined,\n onKeyDown: undefined\n };\n var handleKeyPress = (0, _react.useCallback)(function (event) {\n // When typing a space, create a tag.\n if ((0, _utils.isOneOf)('Space', trigger) && event.key === _utils.KEY_VALUES.SPACE) {\n handleTagKeyPress(event);\n event.preventDefault();\n } // When typing a comma, create a tag.\n\n\n if ((0, _utils.isOneOf)('Comma', trigger) && event.key === _utils.KEY_VALUES.COMMA) {\n handleTagKeyPress(event);\n event.preventDefault();\n }\n }, [handleTagKeyPress, trigger]);\n\n if (multi) {\n if ((0, _utils.isOneOf)('Enter', trigger)) {\n events.onMenuPressEnter = handleTagKeyPress;\n }\n\n if (creatable) {\n events.onKeyDown = handleKeyPress;\n }\n } else {\n events.onMenuPressEnter = handleMenuItemKeyPress;\n }\n\n var onPickerKeyDown = (0, _Picker.useToggleKeyDownEvent)((0, _extends2.default)({\n triggerRef: triggerRef,\n targetRef: targetRef,\n overlayRef: overlayRef\n }, events, rest));\n var handleExited = (0, _react.useCallback)(function () {\n setFocusItemValue(multi ? value === null || value === void 0 ? void 0 : value[0] : value);\n setSearchKeyword('');\n onClose === null || onClose === void 0 ? void 0 : onClose();\n }, [setFocusItemValue, setSearchKeyword, onClose, value, multi]);\n var handleFocus = (0, _react.useCallback)(function () {\n if (!readOnly) {\n var _triggerRef$current4;\n\n setOpen(true);\n (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.open();\n }\n }, [readOnly]);\n var handleBlur = (0, _react.useCallback)(function () {\n setOpen(false);\n }, []);\n var handleEnter = (0, _react.useCallback)(function () {\n focusInput();\n setOpen(true);\n }, [focusInput]);\n var handleExit = (0, _react.useCallback)(function () {\n blurInput();\n setOpen(false);\n }, [blurInput]);\n\n var renderDropdownMenuItem = function renderDropdownMenuItem(label, item) {\n // 'Create option \"{0}\"' => Create option \"xxxxx\"\n var newLabel = item.create ? /*#__PURE__*/_react.default.createElement(\"span\", {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 597,\n columnNumber: 9\n }\n }, (0, _utils.tplTransform)(locale.createOption, label)) : label;\n return renderMenuItem ? renderMenuItem(newLabel, item) : newLabel;\n };\n\n var checkValue = function checkValue() {\n if (multi) {\n return {\n isValid: false,\n itemNode: null\n };\n }\n\n var dataItem = getDateItem(value);\n var itemNode = dataItem.itemNode;\n\n if (!(0, _isNil.default)(value) && (0, _isFunction.default)(renderValue)) {\n itemNode = renderValue(value, dataItem.activeItem, itemNode);\n }\n\n return {\n isValid: dataItem.isValid,\n itemNode: itemNode\n };\n };\n\n var renderMultiValue = function renderMultiValue() {\n if (!multi) {\n return null;\n }\n\n var _tagProps$closable = tagProps.closable,\n closable = _tagProps$closable === void 0 ? true : _tagProps$closable,\n onClose = tagProps.onClose,\n tagRest = (0, _objectWithoutPropertiesLoose2.default)(tagProps, [\"closable\", \"onClose\"]);\n var tags = value || [];\n var items = [];\n var tagElements = tags.map(function (tag) {\n var _getDateItem = getDateItem(tag),\n isValid = _getDateItem.isValid,\n itemNode = _getDateItem.itemNode,\n activeItem = _getDateItem.activeItem;\n\n items.push(activeItem);\n\n if (!isValid) {\n return null;\n }\n\n return /*#__PURE__*/_react.default.createElement(_Tag.default, (0, _extends2.default)({}, tagRest, {\n key: tag,\n size: rest.size === 'lg' ? 'lg' : rest.size === 'xs' ? 'sm' : 'md',\n closable: !disabled && closable && !readOnly && !plaintext,\n title: typeof itemNode === 'string' ? itemNode : undefined,\n onClose: (0, _utils.createChainedFunction)(handleRemoveItemByTag.bind(null, tag), onClose),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 642,\n columnNumber: 13\n }\n }), itemNode);\n }).filter(function (item) {\n return item !== null;\n });\n\n if ((tags.length > 0 || isControlled) && (0, _isFunction.default)(renderValue)) {\n return renderValue(value, items, tagElements);\n }\n\n return tagElements;\n };\n\n var renderDropdownMenu = function renderDropdownMenu(positionProps, speakerRef) {\n var left = positionProps.left,\n top = positionProps.top,\n className = positionProps.className;\n var menuClassPrefix = multi ? 'picker-check-menu' : 'picker-select-menu';\n var classes = merge(className, menuClassName, prefix(multi ? 'check-menu' : 'select-menu'));\n var styles = (0, _extends2.default)({}, menuStyle, {\n left: left,\n top: top\n });\n var items = (0, _treeUtils.filterNodesOfTree)(getAllData(), checkShouldDisplay);\n\n if (creatable && searchKeyword && !items.find(function (item) {\n return item[valueKey] === searchKeyword;\n })) {\n items = [].concat(items, [createOption(searchKeyword)]);\n } // Create a tree structure data when set `groupBy`\n\n\n if (groupBy) {\n items = (0, _getDataGroupBy.getDataGroupBy)(items, groupBy, sort);\n } else if (typeof sort === 'function') {\n items = items.sort(sort(false));\n }\n\n if (disabledOptions) {\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerOverlay, {\n ref: (0, _utils.mergeRefs)(overlayRef, speakerRef),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 683,\n columnNumber: 16\n }\n });\n }\n\n var menu = items.length ? /*#__PURE__*/_react.default.createElement(_Picker.DropdownMenu, {\n id: id ? id + \"-listbox\" : undefined,\n listProps: listProps,\n listRef: listRef,\n disabledItemValues: disabledItemValues,\n valueKey: valueKey,\n labelKey: labelKey,\n classPrefix: menuClassPrefix,\n dropdownMenuItemClassPrefix: multi ? undefined : menuClassPrefix + \"-item\",\n dropdownMenuItemAs: multi ? _Picker.DropdownMenuCheckItem : _Picker.DropdownMenuItem,\n activeItemValues: multi ? value : [value],\n focusItemValue: focusItemValue,\n maxHeight: menuMaxHeight,\n data: items // FIXME-Doma\n // `group` is redundant so long as `groupBy` exists\n ,\n group: !(0, _isUndefined.default)(groupBy),\n groupBy: groupBy,\n onSelect: multi ? handleCheckTag : handleSelectItem // fixme don't use any\n ,\n renderMenuGroup: renderMenuGroup,\n renderMenuItem: renderDropdownMenuItem,\n virtualized: virtualized,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 687,\n columnNumber: 9\n }\n }) : /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"none\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 711,\n columnNumber: 9\n }\n }, locale === null || locale === void 0 ? void 0 : locale.noResultsText);\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerOverlay, {\n ref: (0, _utils.mergeRefs)(overlayRef, speakerRef),\n autoWidth: menuAutoWidth,\n className: classes,\n style: styles,\n target: triggerRef,\n onKeyDown: onPickerKeyDown,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 715,\n columnNumber: 9\n }\n }, renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n var _checkValue = checkValue(),\n isValid = _checkValue.isValid,\n itemNode = _checkValue.itemNode;\n\n var tagElements = renderMultiValue();\n /**\n * 1.Have a value and the value is valid.\n * 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value.\n * 3.If renderValue returns null or undefined, hasValue is false.\n */\n\n var hasSingleValue = !(0, _isNil.default)(value) && (0, _isFunction.default)(renderValue) && !(0, _isNil.default)(itemNode);\n var hasMultiValue = (0, _isArray.default)(value) && value.length > 0 && (0, _isFunction.default)(renderValue) && !(0, _isNil.default)(tagElements);\n var hasValue = multi ? !!(tagElements !== null && tagElements !== void 0 && tagElements.length) || hasMultiValue : isValid || hasSingleValue;\n\n var _usePickerClassName = (0, _Picker.usePickerClassName)((0, _extends2.default)({}, props, {\n classPrefix: classPrefix,\n appearance: appearance,\n hasValue: hasValue,\n name: 'input',\n cleanable: cleanable\n })),\n pickerClasses = _usePickerClassName[0],\n usedClassNamePropKeys = _usePickerClassName[1];\n\n var classes = merge(pickerClasses, (_merge = {}, _merge[prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"tag\"])))] = multi, _merge[prefix(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)([\"focused\"])))] = open, _merge[prefix(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)([\"disabled-options\"])))] = disabledOptions, _merge));\n var searching = !!searchKeyword && open;\n var displaySearchInput = searchable && !disabled;\n var inputProps = multi ? {\n inputStyle: {\n maxWidth: maxWidth - 63\n },\n as: _InputAutosize.default\n } : {\n as: 'input'\n };\n\n if (plaintext) {\n var plaintextProps = {}; // TagPicker has -6px margin-left on the plaintext wrapper\n // for fixing margin-left on tags from 2nd line on\n\n if (multi && hasValue) {\n plaintextProps.style = {\n marginLeft: -6\n };\n }\n\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, (0, _extends2.default)({\n localeKey: \"notSelected\",\n ref: targetRef\n }, plaintextProps, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 775,\n columnNumber: 9\n }\n }), itemNode || (tagElements !== null && tagElements !== void 0 && tagElements.length ? tagElements : null) || placeholder);\n }\n\n var placeholderNode = placeholder || (disabledOptions ? null : locale === null || locale === void 0 ? void 0 : locale.placeholder);\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: (0, _pick.default)(props, _Picker.pickTriggerPropKeys),\n ref: triggerRef,\n trigger: \"active\",\n onEnter: (0, _utils.createChainedFunction)(handleEnter, onEnter),\n onEntered: (0, _utils.createChainedFunction)(onEntered, onOpen),\n onExit: (0, _utils.createChainedFunction)(handleExit, onExit),\n onExited: (0, _utils.createChainedFunction)(handleExited, onExited),\n speaker: renderDropdownMenu,\n placement: placement,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 784,\n columnNumber: 7\n }\n }, /*#__PURE__*/_react.default.createElement(Component, {\n className: classes,\n style: style,\n onClick: focusInput,\n onKeyDown: onPickerKeyDown,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 795,\n columnNumber: 9\n }\n }, /*#__PURE__*/_react.default.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, (0, _omit.default)(rest, [].concat(_Picker.omitTriggerPropKeys, usedClassNamePropKeys)), {\n id: id,\n appearance: appearance,\n readOnly: readOnly,\n plaintext: plaintext,\n ref: targetRef,\n as: toggleAs,\n tabIndex: undefined,\n onClean: handleClean,\n cleanable: cleanable && !disabled,\n hasValue: hasValue,\n active: open,\n disabled: disabled,\n placement: placement,\n inputValue: value,\n caret: !disabledOptions,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 801,\n columnNumber: 11\n }\n }), searching || multi && hasValue ? null : itemNode || placeholderNode), !(!multi && disabled) && /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)([\"tag-wrapper\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 823,\n columnNumber: 13\n }\n }, tagElements, displaySearchInput && /*#__PURE__*/_react.default.createElement(_InputSearch.default, (0, _extends2.default)({}, inputProps, {\n tabIndex: tabIndex,\n readOnly: readOnly,\n onBlur: (0, _utils.createChainedFunction)(handleBlur, onBlur),\n onFocus: (0, _utils.createChainedFunction)(handleFocus, onFocus),\n inputRef: inputRef,\n onChange: handleSearch,\n value: open ? searchKeyword : '',\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 826,\n columnNumber: 17\n }\n })))));\n});\n\nInputPicker.displayName = 'InputPicker';\nInputPicker.propTypes = (0, _extends2.default)({}, _Picker.listPickerPropTypes, {\n locale: _propTypes.default.any,\n appearance: _propTypes.default.oneOf(['default', 'subtle']),\n cacheData: _propTypes.default.array,\n menuAutoWidth: _propTypes.default.bool,\n menuMaxHeight: _propTypes.default.number,\n searchable: _propTypes.default.bool,\n creatable: _propTypes.default.bool,\n groupBy: _propTypes.default.any,\n sort: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderMenuItem: _propTypes.default.func,\n renderMenuGroup: _propTypes.default.func,\n onCreate: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onGroupTitleClick: _propTypes.default.func,\n onSearch: _propTypes.default.func,\n virtualized: _propTypes.default.bool,\n searchBy: _propTypes.default.func\n});\nvar _default = InputPicker;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/InputPicker/InputPicker.tsx?");
2955
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = exports.InputPickerContext = void 0;\n\nvar _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _isUndefined = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isNil = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _remove = _interopRequireDefault(__webpack_require__(/*! lodash/remove */ \"./node_modules/lodash/remove.js\"));\n\nvar _clone = _interopRequireDefault(__webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\"));\n\nvar _isArray = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _pick = _interopRequireDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\n\nvar _getWidth = _interopRequireDefault(__webpack_require__(/*! dom-lib/getWidth */ \"./node_modules/dom-lib/esm/getWidth.js\"));\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _getDataGroupBy = __webpack_require__(/*! ../utils/getDataGroupBy */ \"./src/utils/getDataGroupBy.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _Tag = _interopRequireDefault(__webpack_require__(/*! ../Tag */ \"./src/Tag/index.tsx\"));\n\nvar _InputAutosize = _interopRequireDefault(__webpack_require__(/*! ./InputAutosize */ \"./src/InputPicker/InputAutosize.tsx\"));\n\nvar _InputSearch = _interopRequireDefault(__webpack_require__(/*! ./InputSearch */ \"./src/InputPicker/InputSearch.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/InputPicker/InputPicker.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2,\n _templateObject3,\n _templateObject4,\n _templateObject5;\n\nvar InputPickerContext = /*#__PURE__*/_react.default.createContext({\n tagProps: {},\n trigger: 'Enter'\n});\n\nexports.InputPickerContext = InputPickerContext;\n\nvar InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _merge;\n\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$appearance = props.appearance,\n appearance = _props$appearance === void 0 ? 'default' : _props$appearance,\n _props$cleanable = props.cleanable,\n cleanable = _props$cleanable === void 0 ? true : _props$cleanable,\n _props$cacheData = props.cacheData,\n cacheData = _props$cacheData === void 0 ? [] : _props$cacheData,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker' : _props$classPrefix,\n _props$data = props.data,\n controlledData = _props$data === void 0 ? [] : _props$data,\n disabled = props.disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n defaultValue = props.defaultValue,\n _props$defaultOpen = props.defaultOpen,\n defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,\n _props$disabledItemVa = props.disabledItemValues,\n disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,\n overrideLocale = props.locale,\n toggleAs = props.toggleAs,\n style = props.style,\n _props$searchable = props.searchable,\n searchable = _props$searchable === void 0 ? true : _props$searchable,\n controlledOpen = props.open,\n placeholder = props.placeholder,\n groupBy = props.groupBy,\n menuClassName = props.menuClassName,\n menuStyle = props.menuStyle,\n _props$menuAutoWidth = props.menuAutoWidth,\n menuAutoWidth = _props$menuAutoWidth === void 0 ? true : _props$menuAutoWidth,\n _props$menuMaxHeight = props.menuMaxHeight,\n menuMaxHeight = _props$menuMaxHeight === void 0 ? 320 : _props$menuMaxHeight,\n creatable = props.creatable,\n shouldDisplayCreateOption = props.shouldDisplayCreateOption,\n valueProp = props.value,\n _props$valueKey = props.valueKey,\n valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,\n virtualized = props.virtualized,\n _props$labelKey = props.labelKey,\n labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,\n listProps = props.listProps,\n id = props.id,\n tabIndex = props.tabIndex,\n sort = props.sort,\n renderMenu = props.renderMenu,\n renderExtraFooter = props.renderExtraFooter,\n renderValue = props.renderValue,\n renderMenuItem = props.renderMenuItem,\n renderMenuGroup = props.renderMenuGroup,\n onEnter = props.onEnter,\n onEntered = props.onEntered,\n onExit = props.onExit,\n onExited = props.onExited,\n onChange = props.onChange,\n onClean = props.onClean,\n onCreate = props.onCreate,\n onSearch = props.onSearch,\n onSelect = props.onSelect,\n onOpen = props.onOpen,\n onClose = props.onClose,\n onBlur = props.onBlur,\n onFocus = props.onFocus,\n searchBy = props.searchBy,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"appearance\", \"cleanable\", \"cacheData\", \"classPrefix\", \"data\", \"disabled\", \"readOnly\", \"plaintext\", \"defaultValue\", \"defaultOpen\", \"disabledItemValues\", \"locale\", \"toggleAs\", \"style\", \"searchable\", \"open\", \"placeholder\", \"groupBy\", \"menuClassName\", \"menuStyle\", \"menuAutoWidth\", \"menuMaxHeight\", \"creatable\", \"shouldDisplayCreateOption\", \"value\", \"valueKey\", \"virtualized\", \"labelKey\", \"listProps\", \"id\", \"tabIndex\", \"sort\", \"renderMenu\", \"renderExtraFooter\", \"renderValue\", \"renderMenuItem\", \"renderMenuGroup\", \"onEnter\", \"onEntered\", \"onExit\", \"onExited\", \"onChange\", \"onClean\", \"onCreate\", \"onSearch\", \"onSelect\", \"onOpen\", \"onClose\", \"onBlur\", \"onFocus\", \"searchBy\", \"placement\"]);\n\n var _useContext = (0, _react.useContext)(InputPickerContext),\n multi = _useContext.multi,\n tagProps = _useContext.tagProps,\n trigger = _useContext.trigger,\n disabledOptions = _useContext.disabledOptions;\n\n if (groupBy === valueKey || groupBy === labelKey) {\n throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');\n }\n\n var overlayRef = (0, _react.useRef)(null);\n var targetRef = (0, _react.useRef)(null);\n var triggerRef = (0, _react.useRef)(null);\n var inputRef = (0, _react.useRef)();\n var listRef = (0, _react.useRef)(null);\n\n var _useCustom = (0, _utils.useCustom)(['Picker', 'InputPicker'], overrideLocale),\n locale = _useCustom.locale;\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n prefix = _useClassNames.prefix,\n merge = _useClassNames.merge;\n\n var _useState = (0, _react.useState)(controlledData),\n uncontrolledData = _useState[0],\n setData = _useState[1];\n\n var _useState2 = (0, _react.useState)(100),\n maxWidth = _useState2[0],\n setMaxWidth = _useState2[1];\n\n var _useState3 = (0, _react.useState)([]),\n newData = _useState3[0],\n setNewData = _useState3[1];\n\n var _useState4 = (0, _react.useState)(defaultOpen),\n uncontrolledOpen = _useState4[0],\n setOpen = _useState4[1];\n\n var open = (0, _isUndefined.default)(controlledOpen) ? uncontrolledOpen : controlledOpen;\n var getAllData = (0, _react.useCallback)(function () {\n return [].concat(uncontrolledData, newData);\n }, [uncontrolledData, newData]);\n var getAllDataAndCache = (0, _react.useCallback)(function () {\n return [].concat(getAllData(), cacheData);\n }, [getAllData, cacheData]);\n\n var _useControlled = (0, _utils.useControlled)(valueProp, multi ? defaultValue || [] : defaultValue),\n value = _useControlled[0],\n setValue = _useControlled[1],\n isControlled = _useControlled[2];\n\n var cloneValue = (0, _react.useCallback)(function () {\n return multi ? (0, _clone.default)(value) || [] : value;\n }, [multi, value]);\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.close();\n }, [triggerRef]); // Used to hover the focuse item when trigger `onKeydown`\n\n var _useFocusItemValue = (0, _Picker.useFocusItemValue)(multi ? value === null || value === void 0 ? void 0 : value[0] : value, {\n data: getAllDataAndCache(),\n valueKey: valueKey,\n target: function target() {\n return overlayRef.current;\n }\n }),\n focusItemValue = _useFocusItemValue.focusItemValue,\n setFocusItemValue = _useFocusItemValue.setFocusItemValue,\n onKeyDown = _useFocusItemValue.onKeyDown;\n\n var handleSearchCallback = (0, _react.useCallback)(function (searchKeyword, filteredData, event) {\n var _filteredData$;\n\n // The first option after filtering is the focus.\n setFocusItemValue(disabledOptions ? searchKeyword : (filteredData === null || filteredData === void 0 ? void 0 : (_filteredData$ = filteredData[0]) === null || _filteredData$ === void 0 ? void 0 : _filteredData$[valueKey]) || searchKeyword);\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchKeyword, event);\n }, [disabledOptions, setFocusItemValue, valueKey, onSearch]); // Use search keywords to filter options.\n\n var _useSearch = (0, _Picker.useSearch)({\n labelKey: labelKey,\n data: getAllData(),\n searchBy: searchBy,\n callback: handleSearchCallback\n }),\n searchKeyword = _useSearch.searchKeyword,\n setSearchKeyword = _useSearch.setSearchKeyword,\n checkShouldDisplay = _useSearch.checkShouldDisplay,\n handleSearch = _useSearch.handleSearch; // Update the state when the data in props changes\n\n\n (0, _react.useEffect)(function () {\n if (controlledData && !(0, _shallowEqual.default)(controlledData, uncontrolledData)) {\n var _controlledData$;\n\n setData(controlledData);\n setNewData([]);\n setFocusItemValue(controlledData === null || controlledData === void 0 ? void 0 : (_controlledData$ = controlledData[0]) === null || _controlledData$ === void 0 ? void 0 : _controlledData$[valueKey]);\n }\n }, [setFocusItemValue, controlledData, uncontrolledData, valueKey]);\n (0, _react.useEffect)(function () {\n var _triggerRef$current2;\n\n // In multiple selection, you need to set a maximum width for the input.\n if ((_triggerRef$current2 = triggerRef.current) !== null && _triggerRef$current2 !== void 0 && _triggerRef$current2.root) {\n setMaxWidth((0, _getWidth.default)(triggerRef.current.root));\n }\n }, []); // Update the position of the menu when the search keyword and value change\n\n (0, _react.useEffect)(function () {\n var _triggerRef$current3, _triggerRef$current3$;\n\n (_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 ? void 0 : (_triggerRef$current3$ = _triggerRef$current3.updatePosition) === null || _triggerRef$current3$ === void 0 ? void 0 : _triggerRef$current3$.call(_triggerRef$current3);\n }, [searchKeyword, value]);\n\n var getDateItem = function getDateItem(value) {\n // Find active `MenuItem` by `value`\n var allData = getAllDataAndCache();\n var activeItem = allData.find(function (item) {\n return (0, _shallowEqual.default)(item[valueKey], value);\n });\n var itemNode = placeholder;\n\n if (activeItem !== null && activeItem !== void 0 && activeItem[labelKey]) {\n itemNode = activeItem === null || activeItem === void 0 ? void 0 : activeItem[labelKey];\n }\n\n return {\n isValid: !!activeItem,\n activeItem: activeItem,\n itemNode: itemNode\n };\n };\n\n var getInput = (0, _react.useCallback)(function () {\n var _inputRef$current;\n\n return multi ? (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.input : inputRef.current;\n }, [inputRef, multi]);\n var focusInput = (0, _react.useCallback)(function () {\n var _getInput;\n\n return (_getInput = getInput()) === null || _getInput === void 0 ? void 0 : _getInput.focus();\n }, [getInput]);\n var blurInput = (0, _react.useCallback)(function () {\n var _getInput2;\n\n return (_getInput2 = getInput()) === null || _getInput2 === void 0 ? void 0 : _getInput2.blur();\n }, [getInput]);\n /**\n * Convert the string of the newly created option into an object.\n */\n\n var createOption = (0, _react.useCallback)(function (value) {\n var _ref2;\n\n if (groupBy) {\n var _ref;\n\n return _ref = {\n create: true\n }, _ref[groupBy] = locale === null || locale === void 0 ? void 0 : locale.newItem, _ref[valueKey] = value, _ref[labelKey] = value, _ref;\n }\n\n return _ref2 = {\n create: true\n }, _ref2[valueKey] = value, _ref2[labelKey] = value, _ref2;\n }, [groupBy, valueKey, labelKey, locale]);\n var handleChange = (0, _react.useCallback)(function (value, event) {\n onChange === null || onChange === void 0 ? void 0 : onChange(value, event);\n }, [onChange]);\n var handleRemoveItemByTag = (0, _react.useCallback)(function (tag, event) {\n event.stopPropagation();\n var val = cloneValue();\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, tag);\n });\n setValue(val);\n handleChange(val, event);\n }, [setValue, cloneValue, handleChange]);\n var handleSelect = (0, _react.useCallback)(function (value, item, event) {\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(value, item, event);\n\n if (creatable && item.create) {\n delete item.create;\n onCreate === null || onCreate === void 0 ? void 0 : onCreate(value, item, event);\n setNewData(newData.concat(item));\n }\n }, [creatable, newData, onSelect, onCreate]);\n /**\n * Callback triggered by single selection\n * @param value\n * @param item\n * @param event\n */\n\n var handleSelectItem = function handleSelectItem(value, item, event) {\n setValue(value);\n setFocusItemValue(value);\n setSearchKeyword('');\n handleSelect(value, item, event);\n handleChange(value, event);\n handleClose();\n };\n /**\n * Callback triggered by multiple selection\n * @param nextItemValue\n * @param item\n * @param event\n * @param checked\n */\n\n\n var handleCheckTag = function handleCheckTag(nextItemValue, item, event, checked) {\n var val = cloneValue();\n\n if (checked) {\n val.push(nextItemValue);\n } else {\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, nextItemValue);\n });\n }\n\n setValue(val);\n setSearchKeyword('');\n setFocusItemValue(nextItemValue);\n handleSelect(val, item, event);\n handleChange(val, event);\n focusInput();\n };\n\n var handleTagKeyPress = (0, _react.useCallback)(function (event) {\n // When composing, ignore the keypress event.\n if (event.nativeEvent.isComposing) {\n return;\n }\n\n var val = cloneValue();\n var data = getAllData();\n\n if (!focusItemValue || !data) {\n return;\n } // If the value is disabled in this option, it is returned.\n\n\n if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {\n return item === focusItemValue;\n })) {\n return;\n }\n\n if (!val.some(function (v) {\n return (0, _shallowEqual.default)(v, focusItemValue);\n })) {\n val.push(focusItemValue);\n } else if (!disabledOptions) {\n (0, _remove.default)(val, function (itemVal) {\n return (0, _shallowEqual.default)(itemVal, focusItemValue);\n });\n }\n\n var focusItem = data.find(function (item) {\n return (0, _shallowEqual.default)(item === null || item === void 0 ? void 0 : item[valueKey], focusItemValue);\n });\n\n if (!focusItem) {\n focusItem = createOption(focusItemValue);\n }\n\n setValue(val);\n setSearchKeyword('');\n handleSelect(val, focusItem, event);\n handleChange(val, event);\n }, [cloneValue, getAllData, focusItemValue, disabledItemValues, disabledOptions, setValue, setSearchKeyword, handleSelect, handleChange, valueKey, createOption]);\n var handleMenuItemKeyPress = (0, _react.useCallback)(function (event) {\n if (!focusItemValue || !controlledData) {\n return;\n } // If the value is disabled in this option, it is returned.\n\n\n if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {\n return item === focusItemValue;\n })) {\n return;\n } // Find active `MenuItem` by `value`\n\n\n var allData = getAllData();\n var focusItem = allData.find(function (item) {\n return (0, _shallowEqual.default)(item[valueKey], focusItemValue);\n }); // FIXME Bad state flow\n\n if (!focusItem && focusItemValue === searchKeyword) {\n focusItem = createOption(searchKeyword);\n }\n\n setValue(focusItemValue);\n setSearchKeyword('');\n\n if (focusItem) {\n handleSelect(focusItemValue, focusItem, event);\n }\n\n handleChange(focusItemValue, event);\n handleClose();\n }, [setValue, disabledItemValues, controlledData, focusItemValue, valueKey, searchKeyword, handleClose, setSearchKeyword, createOption, getAllData, handleChange, handleSelect]);\n (0, _Picker.usePublicMethods)(ref, {\n triggerRef: triggerRef,\n overlayRef: overlayRef,\n targetRef: targetRef,\n listRef: listRef\n });\n /**\n * Remove the last item, after pressing the back key on the keyboard.\n * @param event\n */\n\n var removeLastItem = (0, _react.useCallback)(function (event) {\n var target = event === null || event === void 0 ? void 0 : event.target;\n\n if ((target === null || target === void 0 ? void 0 : target.tagName) !== 'INPUT') {\n focusInput();\n return;\n }\n\n if ((target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' && target !== null && target !== void 0 && target.value) {\n return;\n }\n\n var val = cloneValue();\n val.pop();\n setValue(val);\n handleChange(val, event);\n }, [setValue, focusInput, handleChange, cloneValue]);\n var handleClean = (0, _react.useCallback)(function (event) {\n if (disabled || searchKeyword !== '') {\n return;\n }\n\n setValue(null);\n setFocusItemValue(null);\n setSearchKeyword('');\n\n if (multi) {\n handleChange([], event);\n } else {\n handleChange(null, event);\n }\n\n onClean === null || onClean === void 0 ? void 0 : onClean(event);\n }, [disabled, searchKeyword, setValue, setFocusItemValue, setSearchKeyword, multi, onClean, handleChange]);\n var events = {\n onMenuPressBackspace: multi ? removeLastItem : handleClean,\n onMenuKeyDown: onKeyDown,\n onMenuPressEnter: undefined,\n onKeyDown: undefined\n };\n var handleKeyPress = (0, _react.useCallback)(function (event) {\n // When typing a space, create a tag.\n if ((0, _utils.isOneOf)('Space', trigger) && event.key === _utils.KEY_VALUES.SPACE) {\n handleTagKeyPress(event);\n event.preventDefault();\n } // When typing a comma, create a tag.\n\n\n if ((0, _utils.isOneOf)('Comma', trigger) && event.key === _utils.KEY_VALUES.COMMA) {\n handleTagKeyPress(event);\n event.preventDefault();\n }\n }, [handleTagKeyPress, trigger]);\n\n if (multi) {\n if ((0, _utils.isOneOf)('Enter', trigger)) {\n events.onMenuPressEnter = handleTagKeyPress;\n }\n\n if (creatable) {\n events.onKeyDown = handleKeyPress;\n }\n } else {\n events.onMenuPressEnter = handleMenuItemKeyPress;\n }\n\n var onPickerKeyDown = (0, _Picker.useToggleKeyDownEvent)((0, _extends2.default)({\n triggerRef: triggerRef,\n targetRef: targetRef,\n overlayRef: overlayRef\n }, events, rest));\n var handleExited = (0, _react.useCallback)(function () {\n setFocusItemValue(multi ? value === null || value === void 0 ? void 0 : value[0] : value);\n setSearchKeyword('');\n onClose === null || onClose === void 0 ? void 0 : onClose();\n }, [setFocusItemValue, setSearchKeyword, onClose, value, multi]);\n var handleFocus = (0, _react.useCallback)(function () {\n if (!readOnly) {\n var _triggerRef$current4;\n\n setOpen(true);\n (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.open();\n }\n }, [readOnly]);\n var handleBlur = (0, _react.useCallback)(function () {\n setOpen(false);\n }, []);\n var handleEnter = (0, _react.useCallback)(function () {\n focusInput();\n setOpen(true);\n }, [focusInput]);\n var handleExit = (0, _react.useCallback)(function () {\n blurInput();\n setOpen(false);\n }, [blurInput]);\n\n var renderDropdownMenuItem = function renderDropdownMenuItem(label, item) {\n // 'Create option \"{0}\"' => Create option \"xxxxx\"\n var newLabel = item.create ? /*#__PURE__*/_react.default.createElement(\"span\", {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 612,\n columnNumber: 9\n }\n }, (0, _utils.tplTransform)(locale.createOption, label)) : label;\n return renderMenuItem ? renderMenuItem(newLabel, item) : newLabel;\n };\n\n var checkValue = function checkValue() {\n if (multi) {\n return {\n isValid: false,\n itemNode: null\n };\n }\n\n var dataItem = getDateItem(value);\n var itemNode = dataItem.itemNode;\n\n if (!(0, _isNil.default)(value) && (0, _isFunction.default)(renderValue)) {\n itemNode = renderValue(value, dataItem.activeItem, itemNode);\n }\n\n return {\n isValid: dataItem.isValid,\n itemNode: itemNode\n };\n };\n\n var renderMultiValue = function renderMultiValue() {\n if (!multi) {\n return null;\n }\n\n var _tagProps$closable = tagProps.closable,\n closable = _tagProps$closable === void 0 ? true : _tagProps$closable,\n onClose = tagProps.onClose,\n tagRest = (0, _objectWithoutPropertiesLoose2.default)(tagProps, [\"closable\", \"onClose\"]);\n var tags = value || [];\n var items = [];\n var tagElements = tags.map(function (tag) {\n var _getDateItem = getDateItem(tag),\n isValid = _getDateItem.isValid,\n itemNode = _getDateItem.itemNode,\n activeItem = _getDateItem.activeItem;\n\n items.push(activeItem);\n\n if (!isValid) {\n return null;\n }\n\n return /*#__PURE__*/_react.default.createElement(_Tag.default, (0, _extends2.default)({}, tagRest, {\n key: tag,\n size: rest.size === 'lg' ? 'lg' : rest.size === 'xs' ? 'sm' : 'md',\n closable: !disabled && closable && !readOnly && !plaintext,\n title: typeof itemNode === 'string' ? itemNode : undefined,\n onClose: (0, _utils.createChainedFunction)(handleRemoveItemByTag.bind(null, tag), onClose),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 657,\n columnNumber: 13\n }\n }), itemNode);\n }).filter(function (item) {\n return item !== null;\n });\n\n if ((tags.length > 0 || isControlled) && (0, _isFunction.default)(renderValue)) {\n return renderValue(value, items, tagElements);\n }\n\n return tagElements;\n };\n\n var renderDropdownMenu = function renderDropdownMenu(positionProps, speakerRef) {\n var left = positionProps.left,\n top = positionProps.top,\n className = positionProps.className;\n var menuClassPrefix = multi ? 'picker-check-menu' : 'picker-select-menu';\n var classes = merge(className, menuClassName, prefix(multi ? 'check-menu' : 'select-menu'));\n var styles = (0, _extends2.default)({}, menuStyle, {\n left: left,\n top: top\n });\n var items = (0, _treeUtils.filterNodesOfTree)(getAllData(), checkShouldDisplay);\n\n if (creatable && (typeof shouldDisplayCreateOption === 'function' ? shouldDisplayCreateOption(searchKeyword, items) : searchKeyword && !items.find(function (item) {\n return item[valueKey] === searchKeyword;\n }))) {\n items = [].concat(items, [createOption(searchKeyword)]);\n } // Create a tree structure data when set `groupBy`\n\n\n if (groupBy) {\n items = (0, _getDataGroupBy.getDataGroupBy)(items, groupBy, sort);\n } else if (typeof sort === 'function') {\n items = items.sort(sort(false));\n }\n\n if (disabledOptions) {\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerOverlay, {\n ref: (0, _utils.mergeRefs)(overlayRef, speakerRef),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 703,\n columnNumber: 16\n }\n });\n }\n\n var menu = items.length ? /*#__PURE__*/_react.default.createElement(_Picker.DropdownMenu, {\n id: id ? id + \"-listbox\" : undefined,\n listProps: listProps,\n listRef: listRef,\n disabledItemValues: disabledItemValues,\n valueKey: valueKey,\n labelKey: labelKey,\n classPrefix: menuClassPrefix,\n dropdownMenuItemClassPrefix: multi ? undefined : menuClassPrefix + \"-item\",\n dropdownMenuItemAs: multi ? _Picker.DropdownMenuCheckItem : _Picker.DropdownMenuItem,\n activeItemValues: multi ? value : [value],\n focusItemValue: focusItemValue,\n maxHeight: menuMaxHeight,\n data: items // FIXME-Doma\n // `group` is redundant so long as `groupBy` exists\n ,\n group: !(0, _isUndefined.default)(groupBy),\n groupBy: groupBy,\n onSelect: multi ? handleCheckTag : handleSelectItem // fixme don't use any\n ,\n renderMenuGroup: renderMenuGroup,\n renderMenuItem: renderDropdownMenuItem,\n virtualized: virtualized,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 707,\n columnNumber: 9\n }\n }) : /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"none\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 731,\n columnNumber: 9\n }\n }, locale === null || locale === void 0 ? void 0 : locale.noResultsText);\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerOverlay, {\n ref: (0, _utils.mergeRefs)(overlayRef, speakerRef),\n autoWidth: menuAutoWidth,\n className: classes,\n style: styles,\n target: triggerRef,\n onKeyDown: onPickerKeyDown,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 735,\n columnNumber: 9\n }\n }, renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n var _checkValue = checkValue(),\n isValid = _checkValue.isValid,\n itemNode = _checkValue.itemNode;\n\n var tagElements = renderMultiValue();\n /**\n * 1.Have a value and the value is valid.\n * 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value.\n * 3.If renderValue returns null or undefined, hasValue is false.\n */\n\n var hasSingleValue = !(0, _isNil.default)(value) && (0, _isFunction.default)(renderValue) && !(0, _isNil.default)(itemNode);\n var hasMultiValue = (0, _isArray.default)(value) && value.length > 0 && (0, _isFunction.default)(renderValue) && !(0, _isNil.default)(tagElements);\n var hasValue = multi ? !!(tagElements !== null && tagElements !== void 0 && tagElements.length) || hasMultiValue : isValid || hasSingleValue;\n\n var _usePickerClassName = (0, _Picker.usePickerClassName)((0, _extends2.default)({}, props, {\n classPrefix: classPrefix,\n appearance: appearance,\n hasValue: hasValue,\n name: 'input',\n cleanable: cleanable\n })),\n pickerClasses = _usePickerClassName[0],\n usedClassNamePropKeys = _usePickerClassName[1];\n\n var classes = merge(pickerClasses, (_merge = {}, _merge[prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"tag\"])))] = multi, _merge[prefix(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)([\"focused\"])))] = open, _merge[prefix(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)([\"disabled-options\"])))] = disabledOptions, _merge));\n var searching = !!searchKeyword && open;\n var displaySearchInput = searchable && !disabled;\n var inputProps = multi ? {\n inputStyle: {\n maxWidth: maxWidth - 63\n },\n as: _InputAutosize.default\n } : {\n as: 'input'\n };\n\n if (plaintext) {\n var plaintextProps = {}; // TagPicker has -6px margin-left on the plaintext wrapper\n // for fixing margin-left on tags from 2nd line on\n\n if (multi && hasValue) {\n plaintextProps.style = {\n marginLeft: -6\n };\n }\n\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, (0, _extends2.default)({\n localeKey: \"notSelected\",\n ref: targetRef\n }, plaintextProps, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 795,\n columnNumber: 9\n }\n }), itemNode || (tagElements !== null && tagElements !== void 0 && tagElements.length ? tagElements : null) || placeholder);\n }\n\n var placeholderNode = placeholder || (disabledOptions ? null : locale === null || locale === void 0 ? void 0 : locale.placeholder);\n return /*#__PURE__*/_react.default.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: (0, _pick.default)(props, _Picker.pickTriggerPropKeys),\n ref: triggerRef,\n trigger: \"active\",\n onEnter: (0, _utils.createChainedFunction)(handleEnter, onEnter),\n onEntered: (0, _utils.createChainedFunction)(onEntered, onOpen),\n onExit: (0, _utils.createChainedFunction)(handleExit, onExit),\n onExited: (0, _utils.createChainedFunction)(handleExited, onExited),\n speaker: renderDropdownMenu,\n placement: placement,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 804,\n columnNumber: 7\n }\n }, /*#__PURE__*/_react.default.createElement(Component, {\n className: classes,\n style: style,\n onClick: focusInput,\n onKeyDown: onPickerKeyDown,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 815,\n columnNumber: 9\n }\n }, /*#__PURE__*/_react.default.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, (0, _omit.default)(rest, [].concat(_Picker.omitTriggerPropKeys, usedClassNamePropKeys)), {\n id: id,\n appearance: appearance,\n readOnly: readOnly,\n plaintext: plaintext,\n ref: targetRef,\n as: toggleAs,\n tabIndex: undefined,\n onClean: handleClean,\n cleanable: cleanable && !disabled,\n hasValue: hasValue,\n active: open,\n disabled: disabled,\n placement: placement,\n inputValue: value,\n caret: !disabledOptions,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 821,\n columnNumber: 11\n }\n }), searching || multi && hasValue ? null : itemNode || placeholderNode), !(!multi && disabled) && /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)([\"tag-wrapper\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 843,\n columnNumber: 13\n }\n }, tagElements, displaySearchInput && /*#__PURE__*/_react.default.createElement(_InputSearch.default, (0, _extends2.default)({}, inputProps, {\n tabIndex: tabIndex,\n readOnly: readOnly,\n onBlur: (0, _utils.createChainedFunction)(handleBlur, onBlur),\n onFocus: (0, _utils.createChainedFunction)(handleFocus, onFocus),\n inputRef: inputRef,\n onChange: handleSearch,\n value: open ? searchKeyword : '',\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 846,\n columnNumber: 17\n }\n })))));\n});\n\nInputPicker.displayName = 'InputPicker';\nInputPicker.propTypes = (0, _extends2.default)({}, _Picker.listPickerPropTypes, {\n locale: _propTypes.default.any,\n appearance: _propTypes.default.oneOf(['default', 'subtle']),\n cacheData: _propTypes.default.array,\n menuAutoWidth: _propTypes.default.bool,\n menuMaxHeight: _propTypes.default.number,\n searchable: _propTypes.default.bool,\n creatable: _propTypes.default.bool,\n groupBy: _propTypes.default.any,\n sort: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderMenuItem: _propTypes.default.func,\n renderMenuGroup: _propTypes.default.func,\n onCreate: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onGroupTitleClick: _propTypes.default.func,\n onSearch: _propTypes.default.func,\n virtualized: _propTypes.default.bool,\n searchBy: _propTypes.default.func\n});\nvar _default = InputPicker;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/InputPicker/InputPicker.tsx?");
2956
2956
 
2957
2957
  /***/ }),
2958
2958
 
@@ -3843,7 +3843,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
3843
3843
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3844
3844
 
3845
3845
  "use strict";
3846
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nvar _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _debounce = _interopRequireDefault(__webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\"));\n\nvar _ToggleButton = _interopRequireDefault(__webpack_require__(/*! ./ToggleButton */ \"./src/Picker/ToggleButton.tsx\"));\n\nvar _CloseButton = _interopRequireDefault(__webpack_require__(/*! ../CloseButton */ \"./src/CloseButton/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _useToggleCaret = _interopRequireDefault(__webpack_require__(/*! ../utils/useToggleCaret */ \"./src/utils/useToggleCaret.tsx\"));\n\nvar _TextMask = _interopRequireDefault(__webpack_require__(/*! ../MaskedInput/TextMask */ \"./src/MaskedInput/TextMask.tsx\"));\n\nvar _deprecatePropType = _interopRequireDefault(__webpack_require__(/*! ../utils/deprecatePropType */ \"./src/utils/deprecatePropType.ts\"));\n\nvar _Loader = _interopRequireDefault(__webpack_require__(/*! ../Loader */ \"./src/Loader/index.tsx\"));\n\nvar _Stack = _interopRequireDefault(__webpack_require__(/*! ../Stack */ \"./src/Stack/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Picker/PickerToggle.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2;\n\nvar defaultInputMask = [];\n\nvar PickerToggle = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var activeProp = props.active,\n _props$as = props.as,\n Component = _props$as === void 0 ? _ToggleButton.default : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker-toggle' : _props$classPrefix,\n children = props.children,\n _props$caret = props.caret,\n caret = _props$caret === void 0 ? true : _props$caret,\n className = props.className,\n disabled = props.disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n hasValue = props.hasValue,\n editable = props.editable,\n _props$loading = props.loading,\n loading = _props$loading === void 0 ? false : _props$loading,\n cleanableProp = props.cleanable,\n _props$tabIndex = props.tabIndex,\n tabIndexProp = _props$tabIndex === void 0 ? editable ? -1 : 0 : _props$tabIndex,\n id = props.id,\n value = props.value,\n inputPlaceholder = props.inputPlaceholder,\n inputValueProp = props.inputValue,\n _props$inputMask = props.inputMask,\n inputMask = _props$inputMask === void 0 ? defaultInputMask : _props$inputMask,\n onInputChange = props.onInputChange,\n onInputPressEnter = props.onInputPressEnter,\n onInputBlur = props.onInputBlur,\n onInputFocus = props.onInputFocus,\n onClean = props.onClean,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,\n caretComponent = props.caretComponent,\n _props$caretAs = props.caretAs,\n caretAs = _props$caretAs === void 0 ? caretComponent : _props$caretAs,\n label = props.label,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"active\", \"as\", \"classPrefix\", \"children\", \"caret\", \"className\", \"disabled\", \"readOnly\", \"plaintext\", \"hasValue\", \"editable\", \"loading\", \"cleanable\", \"tabIndex\", \"id\", \"value\", \"inputPlaceholder\", \"inputValue\", \"inputMask\", \"onInputChange\", \"onInputPressEnter\", \"onInputBlur\", \"onInputFocus\", \"onClean\", \"onFocus\", \"onBlur\", \"placement\", \"caretComponent\", \"caretAs\", \"label\"]);\n var inputRef = (0, _react.useRef)(null);\n var comboboxRef = (0, _react.useRef)(null);\n\n var _useState = (0, _react.useState)(false),\n activeState = _useState[0],\n setActive = _useState[1];\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix;\n\n var getInputValue = (0, _react.useCallback)(function () {\n return typeof inputValueProp === 'undefined' ? Array.isArray(value) ? value.join(',') : value : inputValueProp;\n }, [inputValueProp, value]);\n\n var _useState2 = (0, _react.useState)(getInputValue),\n inputValue = _useState2[0],\n setInputValue = _useState2[1];\n\n (0, _react.useEffect)(function () {\n if (comboboxRef.current) {\n var _value = getInputValue();\n\n setInputValue(_value);\n }\n }, [getInputValue]);\n var classes = merge(className, withClassPrefix({\n active: activeProp || activeState\n }));\n var handleFocus = (0, _react.useCallback)(function (event) {\n if (!loading) {\n setActive(true);\n }\n\n if (editable) {\n // Avoid firing the onFocus event twice when DatePicker and DateRangePicker allow keyboard input.\n if (event.target === inputRef.current) {\n onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);\n } // Force the input to be focused and editable.\n\n\n if (document.activeElement === comboboxRef.current) {\n var _inputRef$current;\n\n (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();\n }\n } else {\n onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);\n }\n }, [editable, loading, onFocus]);\n var handleBlur = (0, _react.useCallback)(function (event) {\n if (inputRef.current && !editable) {\n setActive(false);\n } // When activeElement is an input, it remains active.\n\n\n if (editable && inputRef.current && document.activeElement !== inputRef.current) {\n setActive(false);\n }\n\n onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);\n }, [editable, onBlur]);\n\n var handleInputBlur = function handleInputBlur(event) {\n setInputValue(getInputValue());\n onInputBlur === null || onInputBlur === void 0 ? void 0 : onInputBlur(event);\n };\n\n var handleClean = (0, _react.useCallback)(function (event) {\n var _inputRef$current2, _comboboxRef$current;\n\n event.stopPropagation();\n onClean === null || onClean === void 0 ? void 0 : onClean(event); // When the value is cleared, the current component is still in focus.\n\n editable ? (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus() : (_comboboxRef$current = comboboxRef.current) === null || _comboboxRef$current === void 0 ? void 0 : _comboboxRef$current.focus();\n }, [editable, onClean]);\n var handleInputChange = (0, _react.useCallback)(function (event) {\n var _event$target;\n\n var value = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value;\n setInputValue(value);\n onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(value, event);\n }, [onInputChange]);\n var handleInputKeyDown = (0, _react.useCallback)(function (event) {\n if (editable && event.key === _utils.KEY_VALUES.ENTER) {\n onInputPressEnter === null || onInputPressEnter === void 0 ? void 0 : onInputPressEnter(event);\n }\n }, [onInputPressEnter, editable]);\n var renderInput = (0, _react.useCallback)(function (ref, props) {\n return /*#__PURE__*/_react.default.createElement(\"input\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(inputRef, ref),\n style: {\n pointerEvents: editable ? undefined : 'none'\n }\n }, props, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 190,\n columnNumber: 9\n }\n }));\n }, [editable]);\n var ToggleCaret = (0, _useToggleCaret.default)(placement);\n var Caret = caretAs !== null && caretAs !== void 0 ? caretAs : ToggleCaret;\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n ref: ref,\n localeKey: \"notSelected\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 204,\n columnNumber: 9\n }\n }, hasValue ? children : null);\n }\n\n var showCleanButton = cleanableProp && hasValue && !readOnly; // When the component is read-only or disabled, the input is not interactive.\n\n var inputFocused = readOnly || disabled ? false : editable && activeState;\n var tabIndex = disabled ? undefined : tabIndexProp;\n return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": activeProp,\n \"aria-disabled\": disabled,\n \"aria-owns\": id ? id + \"-listbox\" : undefined\n }, rest, {\n ref: (0, _utils.mergeRefs)(comboboxRef, ref),\n disabled: disabled,\n tabIndex: tabIndex,\n className: classes,\n onFocus: !disabled ? handleFocus : null // The debounce is set to 200 to solve the flicker caused by the switch between input and div.\n ,\n onBlur: !disabled ? (0, _debounce.default)(handleBlur, 200) : null,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 218,\n columnNumber: 7\n }\n }), /*#__PURE__*/_react.default.createElement(_Stack.default, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 233,\n columnNumber: 9\n }\n }, label && /*#__PURE__*/_react.default.createElement(_Stack.default.Item, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 235,\n columnNumber: 13\n }\n }, /*#__PURE__*/_react.default.createElement(\"span\", {\n className: prefix('label'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 236,\n columnNumber: 15\n }\n }, label)), /*#__PURE__*/_react.default.createElement(_Stack.default.Item, {\n grow: 1,\n style: {\n overflow: 'hidden'\n },\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 239,\n columnNumber: 11\n }\n }, loading ? /*#__PURE__*/_react.default.createElement(_Loader.default, {\n style: {\n display: 'block',\n padding: '1px 0'\n },\n \"data-testid\": \"spinner\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 241,\n columnNumber: 15\n }\n }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextMask.default, {\n mask: inputMask,\n value: Array.isArray(inputValue) ? inputValue.toString() : inputValue,\n onBlur: handleInputBlur,\n onFocus: onInputFocus,\n onChange: handleInputChange,\n onKeyDown: handleInputKeyDown,\n id: id,\n \"aria-hidden\": !inputFocused,\n readOnly: !inputFocused,\n disabled: disabled,\n \"aria-controls\": id ? id + \"-listbox\" : undefined,\n tabIndex: editable ? 0 : -1,\n className: prefix('textbox', {\n 'read-only': !inputFocused\n }),\n placeholder: inputPlaceholder,\n render: renderInput,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 244,\n columnNumber: 17\n }\n }), children ? /*#__PURE__*/_react.default.createElement(\"span\", {\n className: prefix(hasValue ? 'value' : 'placeholder'),\n \"aria-placeholder\": typeof children === 'string' ? children : undefined,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 262,\n columnNumber: 19\n }\n }, children) : null)), showCleanButton && /*#__PURE__*/_react.default.createElement(_CloseButton.default, {\n className: prefix(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"clean\"]))),\n tabIndex: -1,\n locale: {\n closeLabel: 'Clear'\n },\n onClick: handleClean,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 273,\n columnNumber: 13\n }\n }), caret && !showCleanButton && /*#__PURE__*/_react.default.createElement(Caret, {\n className: prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"caret\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 280,\n columnNumber: 41\n }\n })));\n});\n\nPickerToggle.displayName = 'PickerToggle';\nPickerToggle.propTypes = {\n classPrefix: _propTypes.default.string,\n hasValue: _propTypes.default.bool,\n cleanable: _propTypes.default.bool,\n className: _propTypes.default.string,\n children: _propTypes.default.node,\n caret: _propTypes.default.bool,\n as: _propTypes.default.elementType,\n onClean: _propTypes.default.func,\n active: _propTypes.default.bool,\n readOnly: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n plaintext: _propTypes.default.bool,\n caretComponent: (0, _deprecatePropType.default)(_propTypes.default.elementType, 'Use `caretAs` instead.'),\n caretAs: _propTypes.default.elementType\n};\nvar _default = PickerToggle;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/Picker/PickerToggle.tsx?");
3846
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nvar _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _debounce = _interopRequireDefault(__webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\"));\n\nvar _ToggleButton = _interopRequireDefault(__webpack_require__(/*! ./ToggleButton */ \"./src/Picker/ToggleButton.tsx\"));\n\nvar _CloseButton = _interopRequireDefault(__webpack_require__(/*! ../CloseButton */ \"./src/CloseButton/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _useToggleCaret = _interopRequireDefault(__webpack_require__(/*! ../utils/useToggleCaret */ \"./src/utils/useToggleCaret.tsx\"));\n\nvar _TextMask = _interopRequireDefault(__webpack_require__(/*! ../MaskedInput/TextMask */ \"./src/MaskedInput/TextMask.tsx\"));\n\nvar _deprecatePropType = _interopRequireDefault(__webpack_require__(/*! ../utils/deprecatePropType */ \"./src/utils/deprecatePropType.ts\"));\n\nvar _Loader = _interopRequireDefault(__webpack_require__(/*! ../Loader */ \"./src/Loader/index.tsx\"));\n\nvar _Stack = _interopRequireDefault(__webpack_require__(/*! ../Stack */ \"./src/Stack/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Picker/PickerToggle.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2;\n\nvar defaultInputMask = [];\n\nvar PickerToggle = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var activeProp = props.active,\n _props$as = props.as,\n Component = _props$as === void 0 ? _ToggleButton.default : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker-toggle' : _props$classPrefix,\n children = props.children,\n _props$caret = props.caret,\n caret = _props$caret === void 0 ? true : _props$caret,\n className = props.className,\n disabled = props.disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n hasValue = props.hasValue,\n editable = props.editable,\n _props$loading = props.loading,\n loading = _props$loading === void 0 ? false : _props$loading,\n cleanableProp = props.cleanable,\n _props$tabIndex = props.tabIndex,\n tabIndexProp = _props$tabIndex === void 0 ? editable ? -1 : 0 : _props$tabIndex,\n id = props.id,\n value = props.value,\n inputPlaceholder = props.inputPlaceholder,\n inputValueProp = props.inputValue,\n _props$inputMask = props.inputMask,\n inputMask = _props$inputMask === void 0 ? defaultInputMask : _props$inputMask,\n onInputChange = props.onInputChange,\n onInputPressEnter = props.onInputPressEnter,\n onInputBlur = props.onInputBlur,\n onInputFocus = props.onInputFocus,\n onClean = props.onClean,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n _props$placement = props.placement,\n placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,\n caretComponent = props.caretComponent,\n _props$caretAs = props.caretAs,\n caretAs = _props$caretAs === void 0 ? caretComponent : _props$caretAs,\n label = props.label,\n name = props.name,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"active\", \"as\", \"classPrefix\", \"children\", \"caret\", \"className\", \"disabled\", \"readOnly\", \"plaintext\", \"hasValue\", \"editable\", \"loading\", \"cleanable\", \"tabIndex\", \"id\", \"value\", \"inputPlaceholder\", \"inputValue\", \"inputMask\", \"onInputChange\", \"onInputPressEnter\", \"onInputBlur\", \"onInputFocus\", \"onClean\", \"onFocus\", \"onBlur\", \"placement\", \"caretComponent\", \"caretAs\", \"label\", \"name\"]);\n var inputRef = (0, _react.useRef)(null);\n var comboboxRef = (0, _react.useRef)(null);\n\n var _useState = (0, _react.useState)(false),\n activeState = _useState[0],\n setActive = _useState[1];\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix;\n\n var getInputValue = (0, _react.useCallback)(function () {\n return typeof inputValueProp === 'undefined' ? Array.isArray(value) ? value.join(',') : value : inputValueProp;\n }, [inputValueProp, value]);\n\n var _useState2 = (0, _react.useState)(getInputValue),\n inputValue = _useState2[0],\n setInputValue = _useState2[1];\n\n (0, _react.useEffect)(function () {\n if (comboboxRef.current) {\n var _value = getInputValue();\n\n setInputValue(_value);\n }\n }, [getInputValue]);\n var classes = merge(className, withClassPrefix({\n active: activeProp || activeState\n }));\n var handleFocus = (0, _react.useCallback)(function (event) {\n if (!loading) {\n setActive(true);\n }\n\n if (editable) {\n // Avoid firing the onFocus event twice when DatePicker and DateRangePicker allow keyboard input.\n if (event.target === inputRef.current) {\n onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);\n } // Force the input to be focused and editable.\n\n\n if (document.activeElement === comboboxRef.current) {\n var _inputRef$current;\n\n (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();\n }\n } else {\n onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);\n }\n }, [editable, loading, onFocus]);\n var handleBlur = (0, _react.useCallback)(function (event) {\n if (inputRef.current && !editable) {\n setActive(false);\n } // When activeElement is an input, it remains active.\n\n\n if (editable && inputRef.current && document.activeElement !== inputRef.current) {\n setActive(false);\n }\n\n onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);\n }, [editable, onBlur]);\n\n var handleInputBlur = function handleInputBlur(event) {\n setInputValue(getInputValue());\n onInputBlur === null || onInputBlur === void 0 ? void 0 : onInputBlur(event);\n };\n\n var handleClean = (0, _react.useCallback)(function (event) {\n var _inputRef$current2, _comboboxRef$current;\n\n event.stopPropagation();\n onClean === null || onClean === void 0 ? void 0 : onClean(event); // When the value is cleared, the current component is still in focus.\n\n editable ? (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus() : (_comboboxRef$current = comboboxRef.current) === null || _comboboxRef$current === void 0 ? void 0 : _comboboxRef$current.focus();\n }, [editable, onClean]);\n var handleInputChange = (0, _react.useCallback)(function (event) {\n var _event$target;\n\n var value = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value;\n setInputValue(value);\n onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(value, event);\n }, [onInputChange]);\n var handleInputKeyDown = (0, _react.useCallback)(function (event) {\n if (editable && event.key === _utils.KEY_VALUES.ENTER) {\n onInputPressEnter === null || onInputPressEnter === void 0 ? void 0 : onInputPressEnter(event);\n }\n }, [onInputPressEnter, editable]);\n var renderInput = (0, _react.useCallback)(function (ref, props) {\n return /*#__PURE__*/_react.default.createElement(\"input\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(inputRef, ref),\n name: name,\n style: {\n pointerEvents: editable ? undefined : 'none'\n }\n }, props, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 192,\n columnNumber: 9\n }\n }));\n }, [editable, name]);\n var ToggleCaret = (0, _useToggleCaret.default)(placement);\n var Caret = caretAs !== null && caretAs !== void 0 ? caretAs : ToggleCaret;\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n ref: ref,\n localeKey: \"notSelected\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 207,\n columnNumber: 9\n }\n }, hasValue ? children : null);\n }\n\n var showCleanButton = cleanableProp && hasValue && !readOnly; // When the component is read-only or disabled, the input is not interactive.\n\n var inputFocused = readOnly || disabled ? false : editable && activeState;\n var tabIndex = disabled ? undefined : tabIndexProp;\n return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": activeProp,\n \"aria-disabled\": disabled,\n \"aria-owns\": id ? id + \"-listbox\" : undefined\n }, rest, {\n ref: (0, _utils.mergeRefs)(comboboxRef, ref),\n disabled: disabled,\n tabIndex: tabIndex,\n className: classes,\n onFocus: !disabled ? handleFocus : null // The debounce is set to 200 to solve the flicker caused by the switch between input and div.\n ,\n onBlur: !disabled ? (0, _debounce.default)(handleBlur, 200) : null,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 221,\n columnNumber: 7\n }\n }), /*#__PURE__*/_react.default.createElement(_Stack.default, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 236,\n columnNumber: 9\n }\n }, label && /*#__PURE__*/_react.default.createElement(_Stack.default.Item, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 238,\n columnNumber: 13\n }\n }, /*#__PURE__*/_react.default.createElement(\"span\", {\n className: prefix('label'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 239,\n columnNumber: 15\n }\n }, label)), /*#__PURE__*/_react.default.createElement(_Stack.default.Item, {\n grow: 1,\n style: {\n overflow: 'hidden'\n },\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 242,\n columnNumber: 11\n }\n }, loading ? /*#__PURE__*/_react.default.createElement(_Loader.default, {\n style: {\n display: 'block',\n padding: '1px 0'\n },\n \"data-testid\": \"spinner\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 244,\n columnNumber: 15\n }\n }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextMask.default, {\n mask: inputMask,\n value: Array.isArray(inputValue) ? inputValue.toString() : inputValue,\n onBlur: handleInputBlur,\n onFocus: onInputFocus,\n onChange: handleInputChange,\n onKeyDown: handleInputKeyDown,\n id: id,\n \"aria-hidden\": !inputFocused,\n readOnly: !inputFocused,\n disabled: disabled,\n \"aria-controls\": id ? id + \"-listbox\" : undefined,\n tabIndex: editable ? 0 : -1,\n className: prefix('textbox', {\n 'read-only': !inputFocused\n }),\n placeholder: inputPlaceholder,\n render: renderInput,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 247,\n columnNumber: 17\n }\n }), children ? /*#__PURE__*/_react.default.createElement(\"span\", {\n className: prefix(hasValue ? 'value' : 'placeholder'),\n \"aria-placeholder\": typeof children === 'string' ? children : undefined,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 265,\n columnNumber: 19\n }\n }, children) : null)), showCleanButton && /*#__PURE__*/_react.default.createElement(_CloseButton.default, {\n className: prefix(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"clean\"]))),\n tabIndex: -1,\n locale: {\n closeLabel: 'Clear'\n },\n onClick: handleClean,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 276,\n columnNumber: 13\n }\n }), caret && !showCleanButton && /*#__PURE__*/_react.default.createElement(Caret, {\n className: prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"caret\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 283,\n columnNumber: 41\n }\n })));\n});\n\nPickerToggle.displayName = 'PickerToggle';\nPickerToggle.propTypes = {\n classPrefix: _propTypes.default.string,\n hasValue: _propTypes.default.bool,\n cleanable: _propTypes.default.bool,\n className: _propTypes.default.string,\n children: _propTypes.default.node,\n caret: _propTypes.default.bool,\n as: _propTypes.default.elementType,\n onClean: _propTypes.default.func,\n active: _propTypes.default.bool,\n readOnly: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n plaintext: _propTypes.default.bool,\n caretComponent: (0, _deprecatePropType.default)(_propTypes.default.elementType, 'Use `caretAs` instead.'),\n caretAs: _propTypes.default.elementType\n};\nvar _default = PickerToggle;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/Picker/PickerToggle.tsx?");
3847
3847
 
3848
3848
  /***/ }),
3849
3849
 
@@ -3920,7 +3920,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
3920
3920
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3921
3921
 
3922
3922
  "use strict";
3923
- eval("\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.createConcatChildrenFunction = createConcatChildrenFunction;\nexports.shouldDisplay = shouldDisplay;\nexports.usePickerClassName = usePickerClassName;\nexports.onMenuKeyDown = onMenuKeyDown;\nexports.useSearch = useSearch;\nexports.usePublicMethods = usePublicMethods;\nexports.useToggleKeyDownEvent = exports.useFocusItemValue = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _kebabCase = _interopRequireDefault(__webpack_require__(/*! lodash/kebabCase */ \"./node_modules/lodash/kebabCase.js\"));\n\nvar _trim = _interopRequireDefault(__webpack_require__(/*! lodash/trim */ \"./node_modules/lodash/trim.js\"));\n\nvar _isFunction = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isUndefined = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _domLib = __webpack_require__(/*! dom-lib */ \"./node_modules/dom-lib/esm/index.js\");\n\nvar defaultNodeKeys = {\n valueKey: 'value',\n childrenKey: 'children'\n};\n\nfunction createConcatChildrenFunction(node, nodeValue, nodeKeys) {\n if (nodeKeys === void 0) {\n nodeKeys = defaultNodeKeys;\n }\n\n var _nodeKeys = nodeKeys,\n valueKey = _nodeKeys.valueKey,\n childrenKey = _nodeKeys.childrenKey;\n return function (data, children) {\n if (nodeValue) {\n node = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return nodeValue === item[valueKey];\n });\n }\n\n node[childrenKey] = children;\n return data.concat([]);\n };\n}\n\nfunction shouldDisplay(label, searchKeyword) {\n if (!(0, _trim.default)(searchKeyword)) {\n return true;\n }\n\n var keyword = searchKeyword.toLocaleLowerCase();\n\n if (typeof label === 'string' || typeof label === 'number') {\n return (\"\" + label).toLocaleLowerCase().indexOf(keyword) >= 0;\n } else if ( /*#__PURE__*/_react.default.isValidElement(label)) {\n var nodes = (0, _utils.reactToString)(label);\n return nodes.join('').toLocaleLowerCase().indexOf(keyword) >= 0;\n }\n\n return false;\n}\n\n/**\n * The className of the assembled Toggle is on the Picker.\n */\nfunction usePickerClassName(props) {\n var _withClassPrefix;\n\n var name = props.name,\n classPrefix = props.classPrefix,\n className = props.className,\n placement = props.placement,\n appearance = props.appearance,\n cleanable = props.cleanable,\n block = props.block,\n disabled = props.disabled,\n countable = props.countable,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n hasValue = props.hasValue,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"name\", \"classPrefix\", \"className\", \"placement\", \"appearance\", \"cleanable\", \"block\", \"disabled\", \"countable\", \"readOnly\", \"plaintext\", \"hasValue\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge;\n\n var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix[\"placement-\" + (0, _kebabCase.default)((0, _utils.placementPolyfill)(placement))] = placement, _withClassPrefix['read-only'] = readOnly, _withClassPrefix['has-value'] = hasValue, _withClassPrefix.cleanable = cleanable, _withClassPrefix.block = block, _withClassPrefix.disabled = disabled, _withClassPrefix.countable = countable, _withClassPrefix.plaintext = plaintext, _withClassPrefix)));\n var usedClassNamePropKeys = Object.keys((0, _omit.default)(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext'])));\n return [classes, usedClassNamePropKeys];\n}\n\n/**\n * Handling keyboard events...\n * @param event Keyboard event object\n * @param events Event callback functions\n */\nfunction onMenuKeyDown(event, events) {\n var down = events.down,\n up = events.up,\n enter = events.enter,\n del = events.del,\n esc = events.esc,\n right = events.right,\n left = events.left;\n\n switch (event.key) {\n // down\n case _utils.KEY_VALUES.DOWN:\n down === null || down === void 0 ? void 0 : down(event);\n event.preventDefault();\n break;\n // up\n\n case _utils.KEY_VALUES.UP:\n up === null || up === void 0 ? void 0 : up(event);\n event.preventDefault();\n break;\n // enter\n\n case _utils.KEY_VALUES.ENTER:\n enter === null || enter === void 0 ? void 0 : enter(event);\n event.preventDefault();\n break;\n // delete\n\n case _utils.KEY_VALUES.BACKSPACE:\n del === null || del === void 0 ? void 0 : del(event);\n break;\n // esc | tab\n\n case _utils.KEY_VALUES.ESC:\n case _utils.KEY_VALUES.TAB:\n esc === null || esc === void 0 ? void 0 : esc(event);\n break;\n // left arrow\n\n case _utils.KEY_VALUES.LEFT:\n left === null || left === void 0 ? void 0 : left(event);\n break;\n // right arrow\n\n case _utils.KEY_VALUES.RIGHT:\n right === null || right === void 0 ? void 0 : right(event);\n break;\n\n default:\n }\n}\n\n/**\n * Checks if the element has a vertical scrollbar.\n */\nfunction hasVerticalScroll(element) {\n var scrollHeight = element.scrollHeight,\n clientHeight = element.clientHeight;\n return scrollHeight > clientHeight;\n}\n/**\n * Checks if the element is within the visible area of the container\n */\n\n\nfunction isVisible(element, container, direction) {\n if (!hasVerticalScroll(container)) {\n return true;\n }\n\n var _element$getBoundingC = element.getBoundingClientRect(),\n top = _element$getBoundingC.top,\n bottom = _element$getBoundingC.bottom,\n height = _element$getBoundingC.height;\n\n var _container$getBoundin = container.getBoundingClientRect(),\n containerTop = _container$getBoundin.top,\n containerBottom = _container$getBoundin.bottom;\n\n if (direction === 'top') {\n return top + height > containerTop;\n }\n\n return bottom - height < containerBottom;\n}\n\nfunction scrollTo(container, direction, step) {\n var scrollTop = container.scrollTop;\n container.scrollTop = direction === 'top' ? scrollTop - step : scrollTop + step;\n}\n/**\n * A hook that manages the focus state of the option.\n * @param defaultFocusItemValue\n * @param props\n */\n\n\nvar useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props) {\n var _props$valueKey = props.valueKey,\n valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,\n _props$focusableQuery = props.focusableQueryKey,\n focusableQueryKey = _props$focusableQuery === void 0 ? '[data-key][aria-disabled=\"false\"]' : _props$focusableQuery,\n _props$defaultLayer = props.defaultLayer,\n defaultLayer = _props$defaultLayer === void 0 ? 0 : _props$defaultLayer,\n data = props.data,\n target = props.target,\n rtl = props.rtl,\n callback = props.callback,\n _props$getParent = props.getParent,\n getParent = _props$getParent === void 0 ? function (item) {\n return item === null || item === void 0 ? void 0 : item.parent;\n } : _props$getParent;\n\n var _useState = (0, _react.useState)(defaultFocusItemValue),\n focusItemValue = _useState[0],\n setFocusItemValue = _useState[1];\n\n var _useState2 = (0, _react.useState)(defaultLayer),\n layer = _useState2[0],\n setLayer = _useState2[1];\n\n var _useState3 = (0, _react.useState)([]),\n keys = _useState3[0],\n setKeys = _useState3[1];\n\n var getScrollContainer = (0, _react.useCallback)(function () {\n var menu = (0, _isFunction.default)(target) ? target() : target; // For Cascader and MutiCascader\n\n var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector(\"[data-layer=\\\"\" + layer + \"\\\"]\");\n\n if (subMenu) {\n return subMenu;\n } // For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker\n\n\n return menu === null || menu === void 0 ? void 0 : menu.querySelector('[role=\"listbox\"]');\n }, [layer, target]);\n /**\n * Get the elements visible in all options.\n */\n\n var getFocusableMenuItems = (0, _react.useCallback)(function () {\n if (!target) {\n return [];\n }\n\n var currentKeys = keys;\n\n if (layer < 1) {\n var popup = (0, _isFunction.default)(target) ? target() : target;\n var rootMenu = popup === null || popup === void 0 ? void 0 : popup.querySelector('[data-layer=\"0\"]');\n\n if (rootMenu) {\n var _rootMenu$querySelect;\n\n currentKeys = Array.from((_rootMenu$querySelect = rootMenu.querySelectorAll(focusableQueryKey)) !== null && _rootMenu$querySelect !== void 0 ? _rootMenu$querySelect : []).map(function (item) {\n var _item$dataset;\n\n return (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.key;\n });\n } else {\n var _popup$querySelectorA;\n\n currentKeys = Array.from((_popup$querySelectorA = popup === null || popup === void 0 ? void 0 : popup.querySelectorAll(focusableQueryKey)) !== null && _popup$querySelectorA !== void 0 ? _popup$querySelectorA : []).map(function (item) {\n var _item$dataset2;\n\n return (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.key;\n });\n }\n } // 1. It is necessary to traverse the `keys` instead of `data` here to preserve the order of the array.\n // 2. The values ​​in `keys` are all string, so the corresponding value of `data` should also be converted to string\n\n\n return currentKeys.map(function (key) {\n return (0, _find.default)(data, function (i) {\n return \"\" + i[valueKey] === key;\n });\n });\n }, [data, focusableQueryKey, keys, target, valueKey, layer]);\n /**\n * Get the index of the focus item.\n */\n\n var findFocusItemIndex = (0, _react.useCallback)(function (callback) {\n var items = getFocusableMenuItems();\n\n for (var i = 0; i < items.length; i += 1) {\n var _items$i;\n\n if ((0, _utils.shallowEqual)(focusItemValue, (_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i[valueKey])) {\n callback(items, i);\n return;\n }\n }\n\n callback(items, -1);\n }, [focusItemValue, getFocusableMenuItems, valueKey]);\n var scrollListItem = (0, _react.useCallback)(function (direction, itemValue, willOverflow) {\n var container = getScrollContainer();\n var item = container === null || container === void 0 ? void 0 : container.querySelector(\"[data-key=\\\"\" + itemValue + \"\\\"]\");\n\n if (willOverflow && container) {\n var scrollHeight = container.scrollHeight,\n clientHeight = container.clientHeight;\n container.scrollTop = direction === 'top' ? scrollHeight - clientHeight : 0;\n return;\n }\n\n if (item && container) {\n if (!isVisible(item, container, direction)) {\n var height = (0, _domLib.getHeight)(item);\n scrollTo(container, direction, height);\n }\n }\n }, [getScrollContainer]);\n var focusNextMenuItem = (0, _react.useCallback)(function (event) {\n findFocusItemIndex(function (items, index) {\n var willOverflow = index + 2 > items.length;\n var nextIndex = willOverflow ? 0 : index + 1;\n var focusItem = items[nextIndex];\n\n if (!(0, _isUndefined.default)(focusItem)) {\n setFocusItemValue(focusItem[valueKey]);\n callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);\n scrollListItem('bottom', focusItem[valueKey], willOverflow);\n }\n });\n }, [callback, findFocusItemIndex, scrollListItem, valueKey]);\n var focusPrevMenuItem = (0, _react.useCallback)(function (event) {\n findFocusItemIndex(function (items, index) {\n var willOverflow = index === 0;\n var nextIndex = willOverflow ? items.length - 1 : index - 1;\n var focusItem = items[nextIndex];\n\n if (!(0, _isUndefined.default)(focusItem)) {\n setFocusItemValue(focusItem[valueKey]);\n callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);\n scrollListItem('top', focusItem[valueKey], willOverflow);\n }\n });\n }, [callback, findFocusItemIndex, scrollListItem, valueKey]);\n var getSubMenuKeys = (0, _react.useCallback)(function (nextLayer) {\n var menu = (0, _isFunction.default)(target) ? target() : target;\n var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector(\"[data-layer=\\\"\" + nextLayer + \"\\\"]\");\n\n if (subMenu) {\n var _Array$from;\n\n return (_Array$from = Array.from(subMenu.querySelectorAll(focusableQueryKey))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(function (item) {\n var _item$dataset3;\n\n return (_item$dataset3 = item.dataset) === null || _item$dataset3 === void 0 ? void 0 : _item$dataset3.key;\n });\n }\n\n return null;\n }, [focusableQueryKey, target]);\n var focusNextLevelMenu = (0, _react.useCallback)(function (event) {\n var nextLayer = layer + 1;\n var nextKeys = getSubMenuKeys(nextLayer);\n\n if (nextKeys) {\n setKeys(nextKeys);\n setLayer(nextLayer);\n setFocusItemValue(nextKeys[0]);\n callback === null || callback === void 0 ? void 0 : callback(nextKeys[0], event);\n }\n }, [callback, getSubMenuKeys, layer]);\n var focusPrevLevelMenu = (0, _react.useCallback)(function (event) {\n var nextLayer = layer - 1;\n var nextKeys = getSubMenuKeys(nextLayer);\n\n if (nextKeys) {\n var _getParent;\n\n setKeys(nextKeys);\n setLayer(nextLayer);\n var focusItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return item[valueKey] === focusItemValue;\n });\n var parentItemValue = (_getParent = getParent(focusItem)) === null || _getParent === void 0 ? void 0 : _getParent[valueKey];\n\n if (parentItemValue) {\n setFocusItemValue(parentItemValue);\n callback === null || callback === void 0 ? void 0 : callback(parentItemValue, event);\n }\n }\n }, [callback, data, focusItemValue, getParent, getSubMenuKeys, layer, valueKey]);\n var handleKeyDown = (0, _react.useCallback)(function (event) {\n var _onMenuKeyDown;\n\n onMenuKeyDown(event, (_onMenuKeyDown = {\n down: focusNextMenuItem,\n up: focusPrevMenuItem\n }, _onMenuKeyDown[rtl ? 'left' : 'right'] = focusNextLevelMenu, _onMenuKeyDown[rtl ? 'right' : 'left'] = focusPrevLevelMenu, _onMenuKeyDown));\n }, [focusNextLevelMenu, focusNextMenuItem, focusPrevLevelMenu, focusPrevMenuItem, rtl]);\n return {\n focusItemValue: focusItemValue,\n setFocusItemValue: setFocusItemValue,\n layer: layer,\n setLayer: setLayer,\n keys: keys,\n setKeys: setKeys,\n onKeyDown: handleKeyDown\n };\n};\n\nexports.useFocusItemValue = useFocusItemValue;\n\n/**\n * A hook to control the toggle keyboard operation\n * @param props\n */\nvar useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {\n var _props$toggle = props.toggle,\n toggle = _props$toggle === void 0 ? true : _props$toggle,\n triggerRef = props.triggerRef,\n targetRef = props.targetRef,\n overlayRef = props.overlayRef,\n searchInputRef = props.searchInputRef,\n active = props.active,\n readOnly = props.readOnly,\n disabled = props.disabled,\n onExit = props.onExit,\n onOpen = props.onOpen,\n onClose = props.onClose,\n onKeyDown = props.onKeyDown,\n onMenuKeyDown = props.onMenuKeyDown,\n onMenuPressEnter = props.onMenuPressEnter,\n onMenuPressBackspace = props.onMenuPressBackspace;\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current, _triggerRef$current$c;\n\n (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$c = _triggerRef$current.close) === null || _triggerRef$current$c === void 0 ? void 0 : _triggerRef$current$c.call(_triggerRef$current);\n onClose === null || onClose === void 0 ? void 0 : onClose();\n }, [onClose, triggerRef]);\n var handleOpen = (0, _react.useCallback)(function () {\n var _triggerRef$current2, _triggerRef$current2$;\n\n (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : (_triggerRef$current2$ = _triggerRef$current2.open) === null || _triggerRef$current2$ === void 0 ? void 0 : _triggerRef$current2$.call(_triggerRef$current2);\n onOpen === null || onOpen === void 0 ? void 0 : onOpen();\n }, [onOpen, triggerRef]);\n var handleToggleDropdown = (0, _react.useCallback)(function () {\n if (active) {\n handleClose();\n return;\n }\n\n handleOpen();\n }, [active, handleOpen, handleClose]);\n var onToggle = (0, _react.useCallback)(function (event) {\n // Keyboard events should not be processed when readOnly and disabled are set.\n if (readOnly || disabled) {\n return;\n }\n\n if (event.target === (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current)) {\n // enter\n if (toggle && event.key === _utils.KEY_VALUES.ENTER) {\n handleToggleDropdown();\n } // delete\n\n\n if (event.key === _utils.KEY_VALUES.BACKSPACE) {\n onExit === null || onExit === void 0 ? void 0 : onExit(event);\n }\n }\n\n if (overlayRef !== null && overlayRef !== void 0 && overlayRef.current) {\n // The keyboard operation callback on the menu.\n onMenuKeyDown === null || onMenuKeyDown === void 0 ? void 0 : onMenuKeyDown(event);\n\n if (event.key === _utils.KEY_VALUES.ENTER) {\n onMenuPressEnter === null || onMenuPressEnter === void 0 ? void 0 : onMenuPressEnter(event);\n }\n /**\n * There is no callback when typing the Backspace key in the search box.\n * The default is to remove search keywords\n */\n\n\n if (event.key === _utils.KEY_VALUES.BACKSPACE && event.target !== (searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current)) {\n onMenuPressBackspace === null || onMenuPressBackspace === void 0 ? void 0 : onMenuPressBackspace(event);\n } // The search box gets focus when typing characters and numbers.\n\n\n if (event.key.length === 1 && /\\w/.test(event.key)) {\n var _event$target;\n\n // Exclude Input\n // eg: <SelectPicker renderExtraFooter={() => <Input />} />\n if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName) !== 'INPUT') {\n var _searchInputRef$curre;\n\n searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();\n }\n }\n }\n\n if (event.key === _utils.KEY_VALUES.ESC || event.key === _utils.KEY_VALUES.TAB) {\n handleClose();\n } // Native event callback\n\n\n onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);\n }, [readOnly, disabled, targetRef, overlayRef, onKeyDown, toggle, handleToggleDropdown, onExit, onMenuKeyDown, searchInputRef, onMenuPressEnter, onMenuPressBackspace, handleClose]);\n return onToggle;\n};\n\nexports.useToggleKeyDownEvent = useToggleKeyDownEvent;\n\n/**\n * A hook that handles search filter options\n * @param props\n */\nfunction useSearch(props) {\n var labelKey = props.labelKey,\n data = props.data,\n searchBy = props.searchBy,\n callback = props.callback; // Use search keywords to filter options.\n\n var _useState4 = (0, _react.useState)(''),\n searchKeyword = _useState4[0],\n setSearchKeyword = _useState4[1];\n /**\n * Index of keyword in `label`\n * @param {node} label\n */\n\n\n var checkShouldDisplay = (0, _react.useCallback)(function (item, keyword) {\n var label = item === null || item === void 0 ? void 0 : item[labelKey];\n\n var _keyword = (0, _isUndefined.default)(keyword) ? searchKeyword : keyword;\n\n if (typeof searchBy === 'function') {\n return searchBy(_keyword, label, item);\n }\n\n return shouldDisplay(label, _keyword);\n }, [labelKey, searchBy, searchKeyword]);\n var updateFilteredData = (0, _react.useCallback)(function (nextData) {\n setFilteredData((0, _treeUtils.filterNodesOfTree)(nextData, function (item) {\n return checkShouldDisplay(item);\n }));\n }, [checkShouldDisplay]);\n\n var _useState5 = (0, _react.useState)((0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return checkShouldDisplay(item);\n })),\n filteredData = _useState5[0],\n setFilteredData = _useState5[1];\n\n var handleSearch = function handleSearch(searchKeyword, event) {\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return checkShouldDisplay(item, searchKeyword);\n });\n setFilteredData(filteredData);\n setSearchKeyword(searchKeyword);\n callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);\n };\n\n return {\n searchKeyword: searchKeyword,\n filteredData: filteredData,\n updateFilteredData: updateFilteredData,\n setSearchKeyword: setSearchKeyword,\n checkShouldDisplay: checkShouldDisplay,\n handleSearch: handleSearch\n };\n}\n\n/**\n * A hook of the exposed method of Picker\n */\nfunction usePublicMethods(ref, parmas) {\n var triggerRef = parmas.triggerRef,\n overlayRef = parmas.overlayRef,\n targetRef = parmas.targetRef,\n rootRef = parmas.rootRef,\n listRef = parmas.listRef,\n inline = parmas.inline;\n var handleOpen = (0, _react.useCallback)(function () {\n var _triggerRef$current3;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 ? void 0 : _triggerRef$current3.open();\n }, [triggerRef]);\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current4;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.close();\n }, [triggerRef]);\n var handleUpdatePosition = (0, _react.useCallback)(function () {\n var _triggerRef$current5;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current5 = triggerRef.current) === null || _triggerRef$current5 === void 0 ? void 0 : _triggerRef$current5.updatePosition();\n }, [triggerRef]);\n (0, _react.useImperativeHandle)(ref, function () {\n // Tree and CheckTree\n if (inline) {\n return {\n get root() {\n var _triggerRef$current$r, _triggerRef$current6;\n\n return rootRef !== null && rootRef !== void 0 && rootRef.current ? rootRef === null || rootRef === void 0 ? void 0 : rootRef.current : (_triggerRef$current$r = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current6 = triggerRef.current) === null || _triggerRef$current6 === void 0 ? void 0 : _triggerRef$current6.root) !== null && _triggerRef$current$r !== void 0 ? _triggerRef$current$r : null;\n },\n\n get list() {\n if (!(listRef !== null && listRef !== void 0 && listRef.current)) {\n throw new Error('The list is not found, please set `virtualized` for the component.');\n }\n\n return listRef === null || listRef === void 0 ? void 0 : listRef.current;\n }\n\n };\n }\n\n return {\n get root() {\n var _ref, _triggerRef$current7;\n\n return (_ref = (rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) || (triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current7 = triggerRef.current) === null || _triggerRef$current7 === void 0 ? void 0 : _triggerRef$current7.root)) !== null && _ref !== void 0 ? _ref : null;\n },\n\n get overlay() {\n var _overlayRef$current;\n\n if (!(overlayRef !== null && overlayRef !== void 0 && overlayRef.current)) {\n throw new Error('The overlay is not found. Please confirm whether the picker is open.');\n }\n\n return (_overlayRef$current = overlayRef === null || overlayRef === void 0 ? void 0 : overlayRef.current) !== null && _overlayRef$current !== void 0 ? _overlayRef$current : null;\n },\n\n get target() {\n var _targetRef$current;\n\n return (_targetRef$current = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) !== null && _targetRef$current !== void 0 ? _targetRef$current : null;\n },\n\n get list() {\n if (!(listRef !== null && listRef !== void 0 && listRef.current)) {\n throw new Error(\"\\n The list is not found.\\n 1.Please set virtualized for the component.\\n 2.Please confirm whether the picker is open.\\n \");\n }\n\n return listRef === null || listRef === void 0 ? void 0 : listRef.current;\n },\n\n updatePosition: handleUpdatePosition,\n open: handleOpen,\n close: handleClose\n };\n });\n}\n\n//# sourceURL=webpack://rsuite/./src/Picker/utils.ts?");
3923
+ eval("\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.createConcatChildrenFunction = createConcatChildrenFunction;\nexports.shouldDisplay = shouldDisplay;\nexports.usePickerClassName = usePickerClassName;\nexports.onMenuKeyDown = onMenuKeyDown;\nexports.useSearch = useSearch;\nexports.usePublicMethods = usePublicMethods;\nexports.useToggleKeyDownEvent = exports.useFocusItemValue = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _kebabCase = _interopRequireDefault(__webpack_require__(/*! lodash/kebabCase */ \"./node_modules/lodash/kebabCase.js\"));\n\nvar _trim = _interopRequireDefault(__webpack_require__(/*! lodash/trim */ \"./node_modules/lodash/trim.js\"));\n\nvar _isFunction = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isUndefined = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _domLib = __webpack_require__(/*! dom-lib */ \"./node_modules/dom-lib/esm/index.js\");\n\nvar defaultNodeKeys = {\n valueKey: 'value',\n childrenKey: 'children'\n};\n\nfunction createConcatChildrenFunction(node, nodeValue, nodeKeys) {\n if (nodeKeys === void 0) {\n nodeKeys = defaultNodeKeys;\n }\n\n var _nodeKeys = nodeKeys,\n valueKey = _nodeKeys.valueKey,\n childrenKey = _nodeKeys.childrenKey;\n return function (data, children) {\n if (nodeValue) {\n node = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return nodeValue === item[valueKey];\n });\n }\n\n node[childrenKey] = children;\n return data.concat([]);\n };\n}\n\nfunction shouldDisplay(label, searchKeyword) {\n if (!(0, _trim.default)(searchKeyword)) {\n return true;\n }\n\n var keyword = searchKeyword.toLocaleLowerCase();\n\n if (typeof label === 'string' || typeof label === 'number') {\n return (\"\" + label).toLocaleLowerCase().indexOf(keyword) >= 0;\n } else if ( /*#__PURE__*/_react.default.isValidElement(label)) {\n var nodes = (0, _utils.reactToString)(label);\n return nodes.join('').toLocaleLowerCase().indexOf(keyword) >= 0;\n }\n\n return false;\n}\n\n/**\n * The className of the assembled Toggle is on the Picker.\n */\nfunction usePickerClassName(props) {\n var _withClassPrefix;\n\n var name = props.name,\n classPrefix = props.classPrefix,\n className = props.className,\n placement = props.placement,\n appearance = props.appearance,\n cleanable = props.cleanable,\n block = props.block,\n disabled = props.disabled,\n countable = props.countable,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n hasValue = props.hasValue,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"name\", \"classPrefix\", \"className\", \"placement\", \"appearance\", \"cleanable\", \"block\", \"disabled\", \"countable\", \"readOnly\", \"plaintext\", \"hasValue\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge;\n\n var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix[\"placement-\" + (0, _kebabCase.default)((0, _utils.placementPolyfill)(placement))] = placement, _withClassPrefix['read-only'] = readOnly, _withClassPrefix['has-value'] = hasValue, _withClassPrefix.cleanable = cleanable, _withClassPrefix.block = block, _withClassPrefix.disabled = disabled, _withClassPrefix.countable = countable, _withClassPrefix.plaintext = plaintext, _withClassPrefix))); // Those props that're used for composing the className\n\n var usedClassNamePropKeys = Object.keys((0, _omit.default)(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext', 'name'])));\n return [classes, usedClassNamePropKeys];\n}\n\n/**\n * Handling keyboard events...\n * @param event Keyboard event object\n * @param events Event callback functions\n */\nfunction onMenuKeyDown(event, events) {\n var down = events.down,\n up = events.up,\n enter = events.enter,\n del = events.del,\n esc = events.esc,\n right = events.right,\n left = events.left;\n\n switch (event.key) {\n // down\n case _utils.KEY_VALUES.DOWN:\n down === null || down === void 0 ? void 0 : down(event);\n event.preventDefault();\n break;\n // up\n\n case _utils.KEY_VALUES.UP:\n up === null || up === void 0 ? void 0 : up(event);\n event.preventDefault();\n break;\n // enter\n\n case _utils.KEY_VALUES.ENTER:\n enter === null || enter === void 0 ? void 0 : enter(event);\n event.preventDefault();\n break;\n // delete\n\n case _utils.KEY_VALUES.BACKSPACE:\n del === null || del === void 0 ? void 0 : del(event);\n break;\n // esc | tab\n\n case _utils.KEY_VALUES.ESC:\n case _utils.KEY_VALUES.TAB:\n esc === null || esc === void 0 ? void 0 : esc(event);\n break;\n // left arrow\n\n case _utils.KEY_VALUES.LEFT:\n left === null || left === void 0 ? void 0 : left(event);\n break;\n // right arrow\n\n case _utils.KEY_VALUES.RIGHT:\n right === null || right === void 0 ? void 0 : right(event);\n break;\n\n default:\n }\n}\n\n/**\n * Checks if the element has a vertical scrollbar.\n */\nfunction hasVerticalScroll(element) {\n var scrollHeight = element.scrollHeight,\n clientHeight = element.clientHeight;\n return scrollHeight > clientHeight;\n}\n/**\n * Checks if the element is within the visible area of the container\n */\n\n\nfunction isVisible(element, container, direction) {\n if (!hasVerticalScroll(container)) {\n return true;\n }\n\n var _element$getBoundingC = element.getBoundingClientRect(),\n top = _element$getBoundingC.top,\n bottom = _element$getBoundingC.bottom,\n height = _element$getBoundingC.height;\n\n var _container$getBoundin = container.getBoundingClientRect(),\n containerTop = _container$getBoundin.top,\n containerBottom = _container$getBoundin.bottom;\n\n if (direction === 'top') {\n return top + height > containerTop;\n }\n\n return bottom - height < containerBottom;\n}\n\nfunction scrollTo(container, direction, step) {\n var scrollTop = container.scrollTop;\n container.scrollTop = direction === 'top' ? scrollTop - step : scrollTop + step;\n}\n/**\n * A hook that manages the focus state of the option.\n * @param defaultFocusItemValue\n * @param props\n */\n\n\nvar useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props) {\n var _props$valueKey = props.valueKey,\n valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,\n _props$focusableQuery = props.focusableQueryKey,\n focusableQueryKey = _props$focusableQuery === void 0 ? '[data-key][aria-disabled=\"false\"]' : _props$focusableQuery,\n _props$defaultLayer = props.defaultLayer,\n defaultLayer = _props$defaultLayer === void 0 ? 0 : _props$defaultLayer,\n data = props.data,\n target = props.target,\n rtl = props.rtl,\n callback = props.callback,\n _props$getParent = props.getParent,\n getParent = _props$getParent === void 0 ? function (item) {\n return item === null || item === void 0 ? void 0 : item.parent;\n } : _props$getParent;\n\n var _useState = (0, _react.useState)(defaultFocusItemValue),\n focusItemValue = _useState[0],\n setFocusItemValue = _useState[1];\n\n var _useState2 = (0, _react.useState)(defaultLayer),\n layer = _useState2[0],\n setLayer = _useState2[1];\n\n var _useState3 = (0, _react.useState)([]),\n keys = _useState3[0],\n setKeys = _useState3[1];\n\n var getScrollContainer = (0, _react.useCallback)(function () {\n var menu = (0, _isFunction.default)(target) ? target() : target; // For Cascader and MutiCascader\n\n var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector(\"[data-layer=\\\"\" + layer + \"\\\"]\");\n\n if (subMenu) {\n return subMenu;\n } // For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker\n\n\n return menu === null || menu === void 0 ? void 0 : menu.querySelector('[role=\"listbox\"]');\n }, [layer, target]);\n /**\n * Get the elements visible in all options.\n */\n\n var getFocusableMenuItems = (0, _react.useCallback)(function () {\n if (!target) {\n return [];\n }\n\n var currentKeys = keys;\n\n if (layer < 1) {\n var popup = (0, _isFunction.default)(target) ? target() : target;\n var rootMenu = popup === null || popup === void 0 ? void 0 : popup.querySelector('[data-layer=\"0\"]');\n\n if (rootMenu) {\n var _rootMenu$querySelect;\n\n currentKeys = Array.from((_rootMenu$querySelect = rootMenu.querySelectorAll(focusableQueryKey)) !== null && _rootMenu$querySelect !== void 0 ? _rootMenu$querySelect : []).map(function (item) {\n var _item$dataset;\n\n return (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.key;\n });\n } else {\n var _popup$querySelectorA;\n\n currentKeys = Array.from((_popup$querySelectorA = popup === null || popup === void 0 ? void 0 : popup.querySelectorAll(focusableQueryKey)) !== null && _popup$querySelectorA !== void 0 ? _popup$querySelectorA : []).map(function (item) {\n var _item$dataset2;\n\n return (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.key;\n });\n }\n } // 1. It is necessary to traverse the `keys` instead of `data` here to preserve the order of the array.\n // 2. The values ​​in `keys` are all string, so the corresponding value of `data` should also be converted to string\n\n\n return currentKeys.map(function (key) {\n return (0, _find.default)(data, function (i) {\n return \"\" + i[valueKey] === key;\n });\n });\n }, [data, focusableQueryKey, keys, target, valueKey, layer]);\n /**\n * Get the index of the focus item.\n */\n\n var findFocusItemIndex = (0, _react.useCallback)(function (callback) {\n var items = getFocusableMenuItems();\n\n for (var i = 0; i < items.length; i += 1) {\n var _items$i;\n\n if ((0, _utils.shallowEqual)(focusItemValue, (_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i[valueKey])) {\n callback(items, i);\n return;\n }\n }\n\n callback(items, -1);\n }, [focusItemValue, getFocusableMenuItems, valueKey]);\n var scrollListItem = (0, _react.useCallback)(function (direction, itemValue, willOverflow) {\n var container = getScrollContainer();\n var item = container === null || container === void 0 ? void 0 : container.querySelector(\"[data-key=\\\"\" + itemValue + \"\\\"]\");\n\n if (willOverflow && container) {\n var scrollHeight = container.scrollHeight,\n clientHeight = container.clientHeight;\n container.scrollTop = direction === 'top' ? scrollHeight - clientHeight : 0;\n return;\n }\n\n if (item && container) {\n if (!isVisible(item, container, direction)) {\n var height = (0, _domLib.getHeight)(item);\n scrollTo(container, direction, height);\n }\n }\n }, [getScrollContainer]);\n var focusNextMenuItem = (0, _react.useCallback)(function (event) {\n findFocusItemIndex(function (items, index) {\n var willOverflow = index + 2 > items.length;\n var nextIndex = willOverflow ? 0 : index + 1;\n var focusItem = items[nextIndex];\n\n if (!(0, _isUndefined.default)(focusItem)) {\n setFocusItemValue(focusItem[valueKey]);\n callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);\n scrollListItem('bottom', focusItem[valueKey], willOverflow);\n }\n });\n }, [callback, findFocusItemIndex, scrollListItem, valueKey]);\n var focusPrevMenuItem = (0, _react.useCallback)(function (event) {\n findFocusItemIndex(function (items, index) {\n var willOverflow = index === 0;\n var nextIndex = willOverflow ? items.length - 1 : index - 1;\n var focusItem = items[nextIndex];\n\n if (!(0, _isUndefined.default)(focusItem)) {\n setFocusItemValue(focusItem[valueKey]);\n callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);\n scrollListItem('top', focusItem[valueKey], willOverflow);\n }\n });\n }, [callback, findFocusItemIndex, scrollListItem, valueKey]);\n var getSubMenuKeys = (0, _react.useCallback)(function (nextLayer) {\n var menu = (0, _isFunction.default)(target) ? target() : target;\n var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector(\"[data-layer=\\\"\" + nextLayer + \"\\\"]\");\n\n if (subMenu) {\n var _Array$from;\n\n return (_Array$from = Array.from(subMenu.querySelectorAll(focusableQueryKey))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(function (item) {\n var _item$dataset3;\n\n return (_item$dataset3 = item.dataset) === null || _item$dataset3 === void 0 ? void 0 : _item$dataset3.key;\n });\n }\n\n return null;\n }, [focusableQueryKey, target]);\n var focusNextLevelMenu = (0, _react.useCallback)(function (event) {\n var nextLayer = layer + 1;\n var nextKeys = getSubMenuKeys(nextLayer);\n\n if (nextKeys) {\n setKeys(nextKeys);\n setLayer(nextLayer);\n setFocusItemValue(nextKeys[0]);\n callback === null || callback === void 0 ? void 0 : callback(nextKeys[0], event);\n }\n }, [callback, getSubMenuKeys, layer]);\n var focusPrevLevelMenu = (0, _react.useCallback)(function (event) {\n var nextLayer = layer - 1;\n var nextKeys = getSubMenuKeys(nextLayer);\n\n if (nextKeys) {\n var _getParent;\n\n setKeys(nextKeys);\n setLayer(nextLayer);\n var focusItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return item[valueKey] === focusItemValue;\n });\n var parentItemValue = (_getParent = getParent(focusItem)) === null || _getParent === void 0 ? void 0 : _getParent[valueKey];\n\n if (parentItemValue) {\n setFocusItemValue(parentItemValue);\n callback === null || callback === void 0 ? void 0 : callback(parentItemValue, event);\n }\n }\n }, [callback, data, focusItemValue, getParent, getSubMenuKeys, layer, valueKey]);\n var handleKeyDown = (0, _react.useCallback)(function (event) {\n var _onMenuKeyDown;\n\n onMenuKeyDown(event, (_onMenuKeyDown = {\n down: focusNextMenuItem,\n up: focusPrevMenuItem\n }, _onMenuKeyDown[rtl ? 'left' : 'right'] = focusNextLevelMenu, _onMenuKeyDown[rtl ? 'right' : 'left'] = focusPrevLevelMenu, _onMenuKeyDown));\n }, [focusNextLevelMenu, focusNextMenuItem, focusPrevLevelMenu, focusPrevMenuItem, rtl]);\n return {\n focusItemValue: focusItemValue,\n setFocusItemValue: setFocusItemValue,\n layer: layer,\n setLayer: setLayer,\n keys: keys,\n setKeys: setKeys,\n onKeyDown: handleKeyDown\n };\n};\n\nexports.useFocusItemValue = useFocusItemValue;\n\n/**\n * A hook to control the toggle keyboard operation\n * @param props\n */\nvar useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {\n var _props$toggle = props.toggle,\n toggle = _props$toggle === void 0 ? true : _props$toggle,\n triggerRef = props.triggerRef,\n targetRef = props.targetRef,\n overlayRef = props.overlayRef,\n searchInputRef = props.searchInputRef,\n active = props.active,\n readOnly = props.readOnly,\n disabled = props.disabled,\n onExit = props.onExit,\n onOpen = props.onOpen,\n onClose = props.onClose,\n onKeyDown = props.onKeyDown,\n onMenuKeyDown = props.onMenuKeyDown,\n onMenuPressEnter = props.onMenuPressEnter,\n onMenuPressBackspace = props.onMenuPressBackspace;\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current, _triggerRef$current$c;\n\n (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$c = _triggerRef$current.close) === null || _triggerRef$current$c === void 0 ? void 0 : _triggerRef$current$c.call(_triggerRef$current);\n onClose === null || onClose === void 0 ? void 0 : onClose();\n }, [onClose, triggerRef]);\n var handleOpen = (0, _react.useCallback)(function () {\n var _triggerRef$current2, _triggerRef$current2$;\n\n (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : (_triggerRef$current2$ = _triggerRef$current2.open) === null || _triggerRef$current2$ === void 0 ? void 0 : _triggerRef$current2$.call(_triggerRef$current2);\n onOpen === null || onOpen === void 0 ? void 0 : onOpen();\n }, [onOpen, triggerRef]);\n var handleToggleDropdown = (0, _react.useCallback)(function () {\n if (active) {\n handleClose();\n return;\n }\n\n handleOpen();\n }, [active, handleOpen, handleClose]);\n var onToggle = (0, _react.useCallback)(function (event) {\n // Keyboard events should not be processed when readOnly and disabled are set.\n if (readOnly || disabled) {\n return;\n }\n\n if (event.target === (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current)) {\n // enter\n if (toggle && event.key === _utils.KEY_VALUES.ENTER) {\n handleToggleDropdown();\n } // delete\n\n\n if (event.key === _utils.KEY_VALUES.BACKSPACE) {\n onExit === null || onExit === void 0 ? void 0 : onExit(event);\n }\n }\n\n if (overlayRef !== null && overlayRef !== void 0 && overlayRef.current) {\n // The keyboard operation callback on the menu.\n onMenuKeyDown === null || onMenuKeyDown === void 0 ? void 0 : onMenuKeyDown(event);\n\n if (event.key === _utils.KEY_VALUES.ENTER) {\n onMenuPressEnter === null || onMenuPressEnter === void 0 ? void 0 : onMenuPressEnter(event);\n }\n /**\n * There is no callback when typing the Backspace key in the search box.\n * The default is to remove search keywords\n */\n\n\n if (event.key === _utils.KEY_VALUES.BACKSPACE && event.target !== (searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current)) {\n onMenuPressBackspace === null || onMenuPressBackspace === void 0 ? void 0 : onMenuPressBackspace(event);\n } // The search box gets focus when typing characters and numbers.\n\n\n if (event.key.length === 1 && /\\w/.test(event.key)) {\n var _event$target;\n\n // Exclude Input\n // eg: <SelectPicker renderExtraFooter={() => <Input />} />\n if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName) !== 'INPUT') {\n var _searchInputRef$curre;\n\n searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();\n }\n }\n }\n\n if (event.key === _utils.KEY_VALUES.ESC || event.key === _utils.KEY_VALUES.TAB) {\n handleClose();\n } // Native event callback\n\n\n onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);\n }, [readOnly, disabled, targetRef, overlayRef, onKeyDown, toggle, handleToggleDropdown, onExit, onMenuKeyDown, searchInputRef, onMenuPressEnter, onMenuPressBackspace, handleClose]);\n return onToggle;\n};\n\nexports.useToggleKeyDownEvent = useToggleKeyDownEvent;\n\n/**\n * A hook that handles search filter options\n * @param props\n */\nfunction useSearch(props) {\n var labelKey = props.labelKey,\n data = props.data,\n searchBy = props.searchBy,\n callback = props.callback; // Use search keywords to filter options.\n\n var _useState4 = (0, _react.useState)(''),\n searchKeyword = _useState4[0],\n setSearchKeyword = _useState4[1];\n /**\n * Index of keyword in `label`\n * @param {node} label\n */\n\n\n var checkShouldDisplay = (0, _react.useCallback)(function (item, keyword) {\n var label = item === null || item === void 0 ? void 0 : item[labelKey];\n\n var _keyword = (0, _isUndefined.default)(keyword) ? searchKeyword : keyword;\n\n if (typeof searchBy === 'function') {\n return searchBy(_keyword, label, item);\n }\n\n return shouldDisplay(label, _keyword);\n }, [labelKey, searchBy, searchKeyword]);\n var updateFilteredData = (0, _react.useCallback)(function (nextData) {\n setFilteredData((0, _treeUtils.filterNodesOfTree)(nextData, function (item) {\n return checkShouldDisplay(item);\n }));\n }, [checkShouldDisplay]);\n\n var _useState5 = (0, _react.useState)((0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return checkShouldDisplay(item);\n })),\n filteredData = _useState5[0],\n setFilteredData = _useState5[1];\n\n var handleSearch = function handleSearch(searchKeyword, event) {\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return checkShouldDisplay(item, searchKeyword);\n });\n setFilteredData(filteredData);\n setSearchKeyword(searchKeyword);\n callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);\n };\n\n return {\n searchKeyword: searchKeyword,\n filteredData: filteredData,\n updateFilteredData: updateFilteredData,\n setSearchKeyword: setSearchKeyword,\n checkShouldDisplay: checkShouldDisplay,\n handleSearch: handleSearch\n };\n}\n\n/**\n * A hook of the exposed method of Picker\n */\nfunction usePublicMethods(ref, parmas) {\n var triggerRef = parmas.triggerRef,\n overlayRef = parmas.overlayRef,\n targetRef = parmas.targetRef,\n rootRef = parmas.rootRef,\n listRef = parmas.listRef,\n inline = parmas.inline;\n var handleOpen = (0, _react.useCallback)(function () {\n var _triggerRef$current3;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 ? void 0 : _triggerRef$current3.open();\n }, [triggerRef]);\n var handleClose = (0, _react.useCallback)(function () {\n var _triggerRef$current4;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.close();\n }, [triggerRef]);\n var handleUpdatePosition = (0, _react.useCallback)(function () {\n var _triggerRef$current5;\n\n triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current5 = triggerRef.current) === null || _triggerRef$current5 === void 0 ? void 0 : _triggerRef$current5.updatePosition();\n }, [triggerRef]);\n (0, _react.useImperativeHandle)(ref, function () {\n // Tree and CheckTree\n if (inline) {\n return {\n get root() {\n var _triggerRef$current$r, _triggerRef$current6;\n\n return rootRef !== null && rootRef !== void 0 && rootRef.current ? rootRef === null || rootRef === void 0 ? void 0 : rootRef.current : (_triggerRef$current$r = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current6 = triggerRef.current) === null || _triggerRef$current6 === void 0 ? void 0 : _triggerRef$current6.root) !== null && _triggerRef$current$r !== void 0 ? _triggerRef$current$r : null;\n },\n\n get list() {\n if (!(listRef !== null && listRef !== void 0 && listRef.current)) {\n throw new Error('The list is not found, please set `virtualized` for the component.');\n }\n\n return listRef === null || listRef === void 0 ? void 0 : listRef.current;\n }\n\n };\n }\n\n return {\n get root() {\n var _ref, _triggerRef$current7;\n\n return (_ref = (rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) || (triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current7 = triggerRef.current) === null || _triggerRef$current7 === void 0 ? void 0 : _triggerRef$current7.root)) !== null && _ref !== void 0 ? _ref : null;\n },\n\n get overlay() {\n var _overlayRef$current;\n\n if (!(overlayRef !== null && overlayRef !== void 0 && overlayRef.current)) {\n throw new Error('The overlay is not found. Please confirm whether the picker is open.');\n }\n\n return (_overlayRef$current = overlayRef === null || overlayRef === void 0 ? void 0 : overlayRef.current) !== null && _overlayRef$current !== void 0 ? _overlayRef$current : null;\n },\n\n get target() {\n var _targetRef$current;\n\n return (_targetRef$current = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) !== null && _targetRef$current !== void 0 ? _targetRef$current : null;\n },\n\n get list() {\n if (!(listRef !== null && listRef !== void 0 && listRef.current)) {\n throw new Error(\"\\n The list is not found.\\n 1.Please set virtualized for the component.\\n 2.Please confirm whether the picker is open.\\n \");\n }\n\n return listRef === null || listRef === void 0 ? void 0 : listRef.current;\n },\n\n updatePosition: handleUpdatePosition,\n open: handleOpen,\n close: handleClose\n };\n });\n}\n\n//# sourceURL=webpack://rsuite/./src/Picker/utils.ts?");
3924
3924
 
3925
3925
  /***/ }),
3926
3926
 
@@ -4921,7 +4921,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
4921
4921
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
4922
4922
 
4923
4923
  "use strict";
4924
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _UploadFileItem = _interopRequireDefault(__webpack_require__(/*! ./UploadFileItem */ \"./src/Uploader/UploadFileItem.tsx\"));\n\nvar _UploadTrigger = _interopRequireDefault(__webpack_require__(/*! ./UploadTrigger */ \"./src/Uploader/UploadTrigger.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Uploader/Uploader.tsx\",\n _this = void 0;\n\nvar getFiles = function getFiles(event) {\n if (typeof (event === null || event === void 0 ? void 0 : event['dataTransfer']) === 'object') {\n var _event$dataTransfer;\n\n return event === null || event === void 0 ? void 0 : (_event$dataTransfer = event['dataTransfer']) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.files;\n }\n\n if (event.target) {\n return event.target['files'];\n }\n\n return [];\n};\n\nvar createFile = function createFile(file) {\n var fileKey = file.fileKey;\n return (0, _extends2.default)({}, file, {\n fileKey: fileKey || (0, _utils.guid)(),\n progress: 0\n });\n};\n\nfunction fileListReducer(files, action) {\n var _action$files;\n\n switch (action.type) {\n // Add one or more files\n case 'push':\n return [].concat(files, action.files);\n // Remove a file by `fileKey`\n\n case 'remove':\n return files.filter(function (f) {\n return f.fileKey !== action.fileKey;\n });\n // Update a file\n\n case 'updateFile':\n return files.map(function (file) {\n return file.fileKey === action.file.fileKey ? action.file : file;\n });\n // Initialization file list\n\n case 'init':\n return ((_action$files = action.files) === null || _action$files === void 0 ? void 0 : _action$files.map(function (file) {\n // The state of the file needs to be preserved when the `fileList` is controlled.\n return files.find(function (f) {\n return f.fileKey === file.fileKey;\n }) || createFile(file);\n })) || [];\n\n default:\n throw new Error();\n }\n}\n\nvar useFileList = function useFileList(defaultFileList) {\n if (defaultFileList === void 0) {\n defaultFileList = [];\n }\n\n var fileListRef = (0, _react.useRef)(defaultFileList.map(createFile));\n var fileListUpdateCallback = (0, _react.useRef)();\n\n var _useReducer = (0, _react.useReducer)(fileListReducer, fileListRef.current),\n fileList = _useReducer[0],\n dispatch = _useReducer[1];\n\n fileListRef.current = fileList;\n (0, _react.useEffect)(function () {\n var _fileListUpdateCallba;\n\n (_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);\n fileListUpdateCallback.current = null;\n }, [fileList]);\n (0, _utils.useWillUnmount)(function () {\n fileListUpdateCallback.current = null;\n });\n var dispatchCallback = (0, _react.useCallback)(function (action, callback) {\n dispatch(action);\n fileListUpdateCallback.current = callback;\n }, []);\n return [fileListRef, dispatchCallback];\n};\n\nvar Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'uploader' : _props$classPrefix,\n className = props.className,\n _props$listType = props.listType,\n listType = _props$listType === void 0 ? 'text' : _props$listType,\n defaultFileList = props.defaultFileList,\n fileListProp = props.fileList,\n _props$fileListVisibl = props.fileListVisible,\n fileListVisible = _props$fileListVisibl === void 0 ? true : _props$fileListVisibl,\n localeProp = props.locale,\n style = props.style,\n draggable = props.draggable,\n _props$name = props.name,\n name = _props$name === void 0 ? 'file' : _props$name,\n _props$multiple = props.multiple,\n multiple = _props$multiple === void 0 ? false : _props$multiple,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n accept = props.accept,\n children = props.children,\n toggleAs = props.toggleAs,\n _props$removable = props.removable,\n removable = _props$removable === void 0 ? true : _props$removable,\n disabledFileItem = props.disabledFileItem,\n maxPreviewFileSize = props.maxPreviewFileSize,\n _props$method = props.method,\n method = _props$method === void 0 ? 'POST' : _props$method,\n _props$autoUpload = props.autoUpload,\n autoUpload = _props$autoUpload === void 0 ? true : _props$autoUpload,\n action = props.action,\n headers = props.headers,\n _props$withCredential = props.withCredentials,\n withCredentials = _props$withCredential === void 0 ? false : _props$withCredential,\n disableMultipart = props.disableMultipart,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 0 : _props$timeout,\n _props$data = props.data,\n data = _props$data === void 0 ? {} : _props$data,\n onRemove = props.onRemove,\n onUpload = props.onUpload,\n shouldUpload = props.shouldUpload,\n shouldQueueUpdate = props.shouldQueueUpdate,\n renderFileInfo = props.renderFileInfo,\n renderThumbnail = props.renderThumbnail,\n onPreview = props.onPreview,\n onChange = props.onChange,\n onSuccess = props.onSuccess,\n onError = props.onError,\n onProgress = props.onProgress,\n onReupload = props.onReupload,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"classPrefix\", \"className\", \"listType\", \"defaultFileList\", \"fileList\", \"fileListVisible\", \"locale\", \"style\", \"draggable\", \"name\", \"multiple\", \"disabled\", \"readOnly\", \"plaintext\", \"accept\", \"children\", \"toggleAs\", \"removable\", \"disabledFileItem\", \"maxPreviewFileSize\", \"method\", \"autoUpload\", \"action\", \"headers\", \"withCredentials\", \"disableMultipart\", \"timeout\", \"data\", \"onRemove\", \"onUpload\", \"shouldUpload\", \"shouldQueueUpdate\", \"renderFileInfo\", \"renderThumbnail\", \"onPreview\", \"onChange\", \"onSuccess\", \"onError\", \"onProgress\", \"onReupload\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n withClassPrefix = _useClassNames.withClassPrefix,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix(listType, {\n draggable: draggable\n }));\n\n var _useCustom = (0, _utils.useCustom)('Uploader', localeProp),\n locale = _useCustom.locale;\n\n var rootRef = (0, _react.useRef)();\n var xhrs = (0, _react.useRef)({});\n var trigger = (0, _react.useRef)();\n\n var _useFileList = useFileList(fileListProp || defaultFileList),\n fileList = _useFileList[0],\n dispatch = _useFileList[1];\n\n (0, _react.useEffect)(function () {\n if (typeof fileListProp !== 'undefined') {\n // Force reset fileList in reducer, when `fileListProp` is updated\n dispatch({\n type: 'init',\n files: fileListProp\n });\n }\n }, [dispatch, fileListProp]);\n var updateFileStatus = (0, _react.useCallback)(function (nextFile) {\n dispatch({\n type: 'updateFile',\n file: nextFile\n });\n }, [dispatch]);\n /**\n * Clear the value in input.\n */\n\n var cleanInputValue = (0, _react.useCallback)(function () {\n var _trigger$current;\n\n (_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : _trigger$current.clearInput();\n }, []);\n /**\n * Callback for successful file upload.\n * @param file\n * @param response\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadSuccess = (0, _react.useCallback)(function (file, response, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'finished',\n progress: 100\n });\n updateFileStatus(nextFile);\n onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, nextFile, event, xhr);\n }, [onSuccess, updateFileStatus]);\n /**\n * Callback for file upload error.\n * @param file\n * @param status\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadError = (0, _react.useCallback)(function (file, status, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'error'\n });\n updateFileStatus(nextFile);\n onError === null || onError === void 0 ? void 0 : onError(status, nextFile, event, xhr);\n }, [onError, updateFileStatus]);\n /**\n * Callback for file upload progress update.\n * @param file\n * @param percent\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadProgress = (0, _react.useCallback)(function (file, percent, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'uploading',\n progress: percent\n });\n updateFileStatus(nextFile);\n onProgress === null || onProgress === void 0 ? void 0 : onProgress(percent, nextFile, event, xhr);\n }, [onProgress, updateFileStatus]);\n /**\n * Upload a single file.\n * @param file\n */\n\n var handleUploadFile = (0, _react.useCallback)(function (file) {\n var _ajaxUpload = (0, _utils.ajaxUpload)({\n name: name,\n timeout: timeout,\n headers: headers,\n data: data,\n method: method,\n withCredentials: withCredentials,\n disableMultipart: disableMultipart,\n file: file.blobFile,\n url: action,\n onError: handleAjaxUploadError.bind(null, file),\n onSuccess: handleAjaxUploadSuccess.bind(null, file),\n onProgress: handleAjaxUploadProgress.bind(null, file)\n }),\n xhr = _ajaxUpload.xhr,\n uploadData = _ajaxUpload.data;\n\n updateFileStatus((0, _extends2.default)({}, file, {\n status: 'uploading'\n }));\n\n if (file.fileKey) {\n xhrs.current[file.fileKey] = xhr;\n }\n\n onUpload === null || onUpload === void 0 ? void 0 : onUpload(file, uploadData, xhr);\n }, [name, timeout, headers, data, method, withCredentials, disableMultipart, action, handleAjaxUploadError, handleAjaxUploadSuccess, handleAjaxUploadProgress, updateFileStatus, onUpload]);\n var handleAjaxUpload = (0, _react.useCallback)(function () {\n fileList.current.forEach(function (file) {\n var checkState = shouldUpload === null || shouldUpload === void 0 ? void 0 : shouldUpload(file);\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n if (res) {\n handleUploadFile(file);\n }\n });\n return;\n } else if (checkState === false) {\n return;\n }\n\n if (file.status === 'inited') {\n handleUploadFile(file);\n }\n });\n cleanInputValue();\n }, [cleanInputValue, fileList, handleUploadFile, shouldUpload]);\n\n var handleUploadTriggerChange = function handleUploadTriggerChange(event) {\n var files = getFiles(event);\n var newFileList = [];\n Array.from(files).forEach(function (file) {\n newFileList.push({\n blobFile: file,\n name: file.name,\n status: 'inited',\n fileKey: (0, _utils.guid)()\n });\n });\n var nextFileList = [].concat(fileList.current, newFileList);\n var checkState = shouldQueueUpdate === null || shouldQueueUpdate === void 0 ? void 0 : shouldQueueUpdate(nextFileList, newFileList);\n\n if (checkState === false) {\n cleanInputValue();\n return;\n }\n\n var upload = function upload() {\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n dispatch({\n type: 'push',\n files: newFileList\n }, function () {\n autoUpload && handleAjaxUpload();\n });\n };\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n res && upload();\n });\n return;\n }\n\n upload();\n };\n\n var handleRemoveFile = function handleRemoveFile(fileKey) {\n var _xhrs$current, _xhrs$current$file$fi;\n\n var file = (0, _find.default)(fileList.current, function (f) {\n return f.fileKey === fileKey;\n });\n var nextFileList = fileList.current.filter(function (f) {\n return f.fileKey !== fileKey;\n });\n\n if (((_xhrs$current = xhrs.current) === null || _xhrs$current === void 0 ? void 0 : (_xhrs$current$file$fi = _xhrs$current[file.fileKey]) === null || _xhrs$current$file$fi === void 0 ? void 0 : _xhrs$current$file$fi.readyState) !== 4) {\n var _xhrs$current$file$fi2;\n\n (_xhrs$current$file$fi2 = xhrs.current[file.fileKey]) === null || _xhrs$current$file$fi2 === void 0 ? void 0 : _xhrs$current$file$fi2.abort();\n }\n\n dispatch({\n type: 'remove',\n fileKey: fileKey\n });\n onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n cleanInputValue();\n };\n\n var handleReupload = function handleReupload(file) {\n autoUpload && handleUploadFile(file);\n onReupload === null || onReupload === void 0 ? void 0 : onReupload(file);\n }; // public API\n\n\n var start = function start(file) {\n if (file) {\n handleUploadFile(file);\n return;\n }\n\n handleAjaxUpload();\n };\n\n (0, _react.useImperativeHandle)(ref, function () {\n return {\n root: rootRef.current,\n start: start\n };\n });\n var renderList = [/*#__PURE__*/_react.default.createElement(_UploadTrigger.default, (0, _extends2.default)({}, rest, {\n locale: locale,\n name: name,\n key: \"trigger\",\n multiple: multiple,\n draggable: draggable,\n disabled: disabled,\n readOnly: readOnly,\n accept: accept,\n ref: trigger,\n onChange: handleUploadTriggerChange,\n as: toggleAs,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 526,\n columnNumber: 5\n }\n }), children)];\n\n if (fileListVisible) {\n renderList.push( /*#__PURE__*/_react.default.createElement(\"div\", {\n key: \"items\",\n className: prefix('file-items'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 546,\n columnNumber: 7\n }\n }, fileList.current.map(function (file, index) {\n return /*#__PURE__*/_react.default.createElement(_UploadFileItem.default, {\n locale: locale,\n key: file.fileKey || index,\n file: file,\n maxPreviewFileSize: maxPreviewFileSize,\n listType: listType,\n disabled: disabledFileItem,\n onPreview: onPreview,\n onReupload: handleReupload,\n onCancel: handleRemoveFile,\n renderFileInfo: renderFileInfo,\n renderThumbnail: renderThumbnail,\n removable: removable && !readOnly && !plaintext,\n allowReupload: !readOnly && !plaintext,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 548,\n columnNumber: 11\n }\n });\n })));\n }\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n localeKey: \"notUploaded\",\n className: withClassPrefix(listType),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 570,\n columnNumber: 7\n }\n }, fileList.current.length ? renderList[1] : null);\n }\n\n if (listType === 'picture') {\n renderList.reverse();\n }\n\n return /*#__PURE__*/_react.default.createElement(Component, {\n ref: rootRef,\n className: classes,\n style: style,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 581,\n columnNumber: 5\n }\n }, renderList);\n});\n\nUploader.displayName = 'Uploader';\nUploader.propTypes = {\n action: _propTypes.default.string.isRequired,\n accept: _propTypes.default.string,\n autoUpload: _propTypes.default.bool,\n children: _propTypes.default.node,\n className: _propTypes.default.string,\n classPrefix: _propTypes.default.string,\n defaultFileList: _propTypes.default.array,\n fileList: _propTypes.default.array,\n data: _propTypes.default.object,\n multiple: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n disabledFileItem: _propTypes.default.bool,\n name: _propTypes.default.string,\n timeout: _propTypes.default.number,\n withCredentials: _propTypes.default.bool,\n headers: _propTypes.default.object,\n locale: _propTypes.default.any,\n listType: _propTypes.default.oneOf(['text', 'picture-text', 'picture']),\n shouldQueueUpdate: _propTypes.default.func,\n shouldUpload: _propTypes.default.func,\n onChange: _propTypes.default.func,\n onUpload: _propTypes.default.func,\n onReupload: _propTypes.default.func,\n onPreview: _propTypes.default.func,\n onError: _propTypes.default.func,\n onSuccess: _propTypes.default.func,\n onProgress: _propTypes.default.func,\n onRemove: _propTypes.default.func,\n maxPreviewFileSize: _propTypes.default.number,\n method: _propTypes.default.string,\n style: _propTypes.default.object,\n renderFileInfo: _propTypes.default.func,\n renderThumbnail: _propTypes.default.func,\n removable: _propTypes.default.bool,\n fileListVisible: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n disableMultipart: _propTypes.default.bool\n};\nvar _default = Uploader;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/Uploader/Uploader.tsx?");
4924
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _UploadFileItem = _interopRequireDefault(__webpack_require__(/*! ./UploadFileItem */ \"./src/Uploader/UploadFileItem.tsx\"));\n\nvar _UploadTrigger = _interopRequireDefault(__webpack_require__(/*! ./UploadTrigger */ \"./src/Uploader/UploadTrigger.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Uploader/Uploader.tsx\",\n _this = void 0;\n\nvar getFiles = function getFiles(event) {\n if (typeof (event === null || event === void 0 ? void 0 : event['dataTransfer']) === 'object') {\n var _event$dataTransfer;\n\n return event === null || event === void 0 ? void 0 : (_event$dataTransfer = event['dataTransfer']) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.files;\n }\n\n if (event.target) {\n return event.target['files'];\n }\n\n return [];\n};\n\nvar createFile = function createFile(file) {\n var fileKey = file.fileKey;\n return (0, _extends2.default)({}, file, {\n fileKey: fileKey || (0, _utils.guid)(),\n progress: 0\n });\n};\n\nfunction fileListReducer(files, action) {\n var _action$files;\n\n switch (action.type) {\n // Add one or more files\n case 'push':\n return [].concat(files, action.files);\n // Remove a file by `fileKey`\n\n case 'remove':\n return files.filter(function (f) {\n return f.fileKey !== action.fileKey;\n });\n // Update a file\n\n case 'updateFile':\n return files.map(function (file) {\n return file.fileKey === action.file.fileKey ? action.file : file;\n });\n // Initialization file list\n\n case 'init':\n return ((_action$files = action.files) === null || _action$files === void 0 ? void 0 : _action$files.map(function (file) {\n // The state of the file needs to be preserved when the `fileList` is controlled.\n return files.find(function (f) {\n return f.fileKey === file.fileKey;\n }) || createFile(file);\n })) || [];\n\n default:\n throw new Error();\n }\n}\n\nvar useFileList = function useFileList(defaultFileList) {\n if (defaultFileList === void 0) {\n defaultFileList = [];\n }\n\n var fileListRef = (0, _react.useRef)(defaultFileList.map(createFile));\n var fileListUpdateCallback = (0, _react.useRef)();\n\n var _useReducer = (0, _react.useReducer)(fileListReducer, fileListRef.current),\n fileList = _useReducer[0],\n dispatch = _useReducer[1];\n\n fileListRef.current = fileList;\n (0, _react.useEffect)(function () {\n var _fileListUpdateCallba;\n\n (_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);\n fileListUpdateCallback.current = null;\n }, [fileList]);\n (0, _utils.useWillUnmount)(function () {\n fileListUpdateCallback.current = null;\n });\n var dispatchCallback = (0, _react.useCallback)(function (action, callback) {\n dispatch(action);\n fileListUpdateCallback.current = callback;\n }, []);\n return [fileListRef, dispatchCallback];\n};\n\nvar Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'uploader' : _props$classPrefix,\n className = props.className,\n _props$listType = props.listType,\n listType = _props$listType === void 0 ? 'text' : _props$listType,\n defaultFileList = props.defaultFileList,\n fileListProp = props.fileList,\n _props$fileListVisibl = props.fileListVisible,\n fileListVisible = _props$fileListVisibl === void 0 ? true : _props$fileListVisibl,\n localeProp = props.locale,\n style = props.style,\n draggable = props.draggable,\n _props$name = props.name,\n name = _props$name === void 0 ? 'file' : _props$name,\n _props$multiple = props.multiple,\n multiple = _props$multiple === void 0 ? false : _props$multiple,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n accept = props.accept,\n children = props.children,\n toggleAs = props.toggleAs,\n _props$removable = props.removable,\n removable = _props$removable === void 0 ? true : _props$removable,\n disabledFileItem = props.disabledFileItem,\n maxPreviewFileSize = props.maxPreviewFileSize,\n _props$method = props.method,\n method = _props$method === void 0 ? 'POST' : _props$method,\n _props$autoUpload = props.autoUpload,\n autoUpload = _props$autoUpload === void 0 ? true : _props$autoUpload,\n action = props.action,\n headers = props.headers,\n _props$withCredential = props.withCredentials,\n withCredentials = _props$withCredential === void 0 ? false : _props$withCredential,\n disableMultipart = props.disableMultipart,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 0 : _props$timeout,\n _props$data = props.data,\n data = _props$data === void 0 ? {} : _props$data,\n onRemove = props.onRemove,\n onUpload = props.onUpload,\n shouldUpload = props.shouldUpload,\n shouldQueueUpdate = props.shouldQueueUpdate,\n renderFileInfo = props.renderFileInfo,\n renderThumbnail = props.renderThumbnail,\n onPreview = props.onPreview,\n onChange = props.onChange,\n onSuccess = props.onSuccess,\n onError = props.onError,\n onProgress = props.onProgress,\n onReupload = props.onReupload,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"classPrefix\", \"className\", \"listType\", \"defaultFileList\", \"fileList\", \"fileListVisible\", \"locale\", \"style\", \"draggable\", \"name\", \"multiple\", \"disabled\", \"readOnly\", \"plaintext\", \"accept\", \"children\", \"toggleAs\", \"removable\", \"disabledFileItem\", \"maxPreviewFileSize\", \"method\", \"autoUpload\", \"action\", \"headers\", \"withCredentials\", \"disableMultipart\", \"timeout\", \"data\", \"onRemove\", \"onUpload\", \"shouldUpload\", \"shouldQueueUpdate\", \"renderFileInfo\", \"renderThumbnail\", \"onPreview\", \"onChange\", \"onSuccess\", \"onError\", \"onProgress\", \"onReupload\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n withClassPrefix = _useClassNames.withClassPrefix,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix(listType, {\n draggable: draggable\n }));\n\n var _useCustom = (0, _utils.useCustom)('Uploader', localeProp),\n locale = _useCustom.locale;\n\n var rootRef = (0, _react.useRef)();\n var xhrs = (0, _react.useRef)({});\n var trigger = (0, _react.useRef)();\n\n var _useFileList = useFileList(fileListProp || defaultFileList),\n fileList = _useFileList[0],\n dispatch = _useFileList[1];\n\n (0, _react.useEffect)(function () {\n if (typeof fileListProp !== 'undefined') {\n // Force reset fileList in reducer, when `fileListProp` is updated\n dispatch({\n type: 'init',\n files: fileListProp\n });\n }\n }, [dispatch, fileListProp]);\n var updateFileStatus = (0, _react.useCallback)(function (nextFile) {\n dispatch({\n type: 'updateFile',\n file: nextFile\n });\n }, [dispatch]);\n /**\n * Clear the value in input.\n */\n\n var cleanInputValue = (0, _react.useCallback)(function () {\n var _trigger$current;\n\n (_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : _trigger$current.clearInput();\n }, []);\n /**\n * Callback for successful file upload.\n * @param file\n * @param response\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadSuccess = (0, _react.useCallback)(function (file, response, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'finished',\n progress: 100\n });\n updateFileStatus(nextFile);\n onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, nextFile, event, xhr);\n }, [onSuccess, updateFileStatus]);\n /**\n * Callback for file upload error.\n * @param file\n * @param status\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadError = (0, _react.useCallback)(function (file, status, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'error'\n });\n updateFileStatus(nextFile);\n onError === null || onError === void 0 ? void 0 : onError(status, nextFile, event, xhr);\n }, [onError, updateFileStatus]);\n /**\n * Callback for file upload progress update.\n * @param file\n * @param percent\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadProgress = (0, _react.useCallback)(function (file, percent, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'uploading',\n progress: percent\n });\n updateFileStatus(nextFile);\n onProgress === null || onProgress === void 0 ? void 0 : onProgress(percent, nextFile, event, xhr);\n }, [onProgress, updateFileStatus]);\n /**\n * Upload a single file.\n * @param file\n */\n\n var handleUploadFile = (0, _react.useCallback)(function (file) {\n var _ajaxUpload = (0, _utils.ajaxUpload)({\n name: name,\n timeout: timeout,\n headers: headers,\n data: data,\n method: method,\n withCredentials: withCredentials,\n disableMultipart: disableMultipart,\n file: file.blobFile,\n url: action,\n onError: handleAjaxUploadError.bind(null, file),\n onSuccess: handleAjaxUploadSuccess.bind(null, file),\n onProgress: handleAjaxUploadProgress.bind(null, file)\n }),\n xhr = _ajaxUpload.xhr,\n uploadData = _ajaxUpload.data;\n\n updateFileStatus((0, _extends2.default)({}, file, {\n status: 'uploading'\n }));\n\n if (file.fileKey) {\n xhrs.current[file.fileKey] = xhr;\n }\n\n onUpload === null || onUpload === void 0 ? void 0 : onUpload(file, uploadData, xhr);\n }, [name, timeout, headers, data, method, withCredentials, disableMultipart, action, handleAjaxUploadError, handleAjaxUploadSuccess, handleAjaxUploadProgress, updateFileStatus, onUpload]);\n var handleAjaxUpload = (0, _react.useCallback)(function () {\n fileList.current.forEach(function (file) {\n var checkState = shouldUpload === null || shouldUpload === void 0 ? void 0 : shouldUpload(file);\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n if (res) {\n handleUploadFile(file);\n }\n });\n return;\n } else if (checkState === false) {\n return;\n }\n\n if (file.status === 'inited') {\n handleUploadFile(file);\n }\n });\n cleanInputValue();\n }, [cleanInputValue, fileList, handleUploadFile, shouldUpload]);\n\n var handleUploadTriggerChange = function handleUploadTriggerChange(event) {\n var files = getFiles(event);\n var newFileList = [];\n Array.from(files).forEach(function (file) {\n newFileList.push({\n blobFile: file,\n name: file.name,\n status: 'inited',\n fileKey: (0, _utils.guid)()\n });\n });\n var nextFileList = [].concat(fileList.current, newFileList);\n var checkState = shouldQueueUpdate === null || shouldQueueUpdate === void 0 ? void 0 : shouldQueueUpdate(nextFileList, newFileList);\n\n if (checkState === false) {\n cleanInputValue();\n return;\n }\n\n var upload = function upload() {\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n dispatch({\n type: 'push',\n files: newFileList\n }, function () {\n autoUpload && handleAjaxUpload();\n });\n };\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n res && upload();\n });\n return;\n }\n\n upload();\n };\n\n var handleRemoveFile = function handleRemoveFile(fileKey) {\n var _xhrs$current, _xhrs$current$file$fi;\n\n var file = (0, _find.default)(fileList.current, function (f) {\n return f.fileKey === fileKey;\n });\n var nextFileList = fileList.current.filter(function (f) {\n return f.fileKey !== fileKey;\n });\n\n if (((_xhrs$current = xhrs.current) === null || _xhrs$current === void 0 ? void 0 : (_xhrs$current$file$fi = _xhrs$current[file.fileKey]) === null || _xhrs$current$file$fi === void 0 ? void 0 : _xhrs$current$file$fi.readyState) !== 4) {\n var _xhrs$current$file$fi2;\n\n (_xhrs$current$file$fi2 = xhrs.current[file.fileKey]) === null || _xhrs$current$file$fi2 === void 0 ? void 0 : _xhrs$current$file$fi2.abort();\n }\n\n dispatch({\n type: 'remove',\n fileKey: fileKey\n });\n onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n cleanInputValue();\n };\n\n var handleReupload = function handleReupload(file) {\n autoUpload && handleUploadFile(file);\n onReupload === null || onReupload === void 0 ? void 0 : onReupload(file);\n }; // public API\n\n\n var start = function start(file) {\n if (file) {\n handleUploadFile(file);\n return;\n }\n\n handleAjaxUpload();\n };\n\n (0, _react.useImperativeHandle)(ref, function () {\n return {\n root: rootRef.current,\n start: start\n };\n });\n var renderList = [/*#__PURE__*/_react.default.createElement(_UploadTrigger.default, (0, _extends2.default)({}, rest, {\n locale: locale,\n name: name,\n key: \"trigger\",\n multiple: multiple,\n draggable: draggable,\n disabled: disabled,\n readOnly: readOnly,\n accept: accept,\n ref: trigger,\n onChange: handleUploadTriggerChange,\n as: toggleAs,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 532,\n columnNumber: 5\n }\n }), children)];\n\n if (fileListVisible) {\n renderList.push( /*#__PURE__*/_react.default.createElement(\"div\", {\n key: \"items\",\n className: prefix('file-items'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 552,\n columnNumber: 7\n }\n }, fileList.current.map(function (file, index) {\n return /*#__PURE__*/_react.default.createElement(_UploadFileItem.default, {\n locale: locale,\n key: file.fileKey || index,\n file: file,\n maxPreviewFileSize: maxPreviewFileSize,\n listType: listType,\n disabled: disabledFileItem,\n onPreview: onPreview,\n onReupload: handleReupload,\n onCancel: handleRemoveFile,\n renderFileInfo: renderFileInfo,\n renderThumbnail: renderThumbnail,\n removable: removable && !readOnly && !plaintext,\n allowReupload: !readOnly && !plaintext,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 554,\n columnNumber: 11\n }\n });\n })));\n }\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n localeKey: \"notUploaded\",\n className: withClassPrefix(listType),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 576,\n columnNumber: 7\n }\n }, fileList.current.length ? renderList[1] : null);\n }\n\n if (listType === 'picture') {\n renderList.reverse();\n }\n\n return /*#__PURE__*/_react.default.createElement(Component, {\n ref: rootRef,\n className: classes,\n style: style,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 587,\n columnNumber: 5\n }\n }, renderList);\n});\n\nUploader.displayName = 'Uploader';\nUploader.propTypes = {\n action: _propTypes.default.string.isRequired,\n accept: _propTypes.default.string,\n autoUpload: _propTypes.default.bool,\n children: _propTypes.default.node,\n className: _propTypes.default.string,\n classPrefix: _propTypes.default.string,\n defaultFileList: _propTypes.default.array,\n fileList: _propTypes.default.array,\n data: _propTypes.default.object,\n multiple: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n disabledFileItem: _propTypes.default.bool,\n name: _propTypes.default.string,\n timeout: _propTypes.default.number,\n withCredentials: _propTypes.default.bool,\n headers: _propTypes.default.object,\n locale: _propTypes.default.any,\n listType: _propTypes.default.oneOf(['text', 'picture-text', 'picture']),\n shouldQueueUpdate: _propTypes.default.func,\n shouldUpload: _propTypes.default.func,\n onChange: _propTypes.default.func,\n onUpload: _propTypes.default.func,\n onReupload: _propTypes.default.func,\n onPreview: _propTypes.default.func,\n onError: _propTypes.default.func,\n onSuccess: _propTypes.default.func,\n onProgress: _propTypes.default.func,\n onRemove: _propTypes.default.func,\n maxPreviewFileSize: _propTypes.default.number,\n method: _propTypes.default.string,\n style: _propTypes.default.object,\n renderFileInfo: _propTypes.default.func,\n renderThumbnail: _propTypes.default.func,\n removable: _propTypes.default.bool,\n fileListVisible: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n disableMultipart: _propTypes.default.bool\n};\nvar _default = Uploader;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://rsuite/./src/Uploader/Uploader.tsx?");
4925
4925
 
4926
4926
  /***/ }),
4927
4927
 
@@ -10062,7 +10062,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac
10062
10062
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10063
10063
 
10064
10064
  "use strict";
10065
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/addClass */ \"./node_modules/dom-lib/esm/addClass.js\");\n/* harmony import */ var dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/removeClass */ \"./node_modules/dom-lib/esm/removeClass.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _useControlled__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./useControlled */ \"./node_modules/rsuite-table/es/utils/useControlled.js\");\n/* harmony import */ var _getTableColumns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./getTableColumns */ \"./node_modules/rsuite-table/es/utils/getTableColumns.js\");\n/* harmony import */ var _getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./getTotalByColumns */ \"./node_modules/rsuite-table/es/utils/getTotalByColumns.js\");\n/* harmony import */ var _getColumnProps__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./getColumnProps */ \"./node_modules/rsuite-table/es/utils/getColumnProps.js\");\n/* harmony import */ var _useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./useUpdateEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateEffect.js\");\n/* harmony import */ var _flushSync__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./flushSync */ \"./node_modules/rsuite-table/es/utils/flushSync.js\");\n/* harmony import */ var _useMount__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./useMount */ \"./node_modules/rsuite-table/es/utils/useMount.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Attach rendering-related attributes to all cells of the form and cache them.\n * @param props\n * @returns\n */\nvar useCellDescriptor = function useCellDescriptor(props) {\n var children = props.children,\n rtl = props.rtl,\n mouseAreaRef = props.mouseAreaRef,\n tableRef = props.tableRef,\n minScrollX = props.minScrollX,\n scrollX = props.scrollX,\n tableWidth = props.tableWidth,\n headerHeight = props.headerHeight,\n showHeader = props.showHeader,\n sortTypeProp = props.sortType,\n defaultSortType = props.defaultSortType,\n sortColumn = props.sortColumn,\n rowHeight = props.rowHeight,\n onSortColumn = props.onSortColumn,\n onHeaderCellResize = props.onHeaderCellResize,\n prefix = props.prefix;\n\n var _useControlled = (0,_useControlled__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(sortTypeProp, defaultSortType),\n sortType = _useControlled[0],\n setSortType = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(),\n cacheData = _useState[0],\n setCacheData = _useState[1];\n\n var clearCache = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {\n setCacheData(null);\n }, []);\n var setColumnResizing = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (resizing) {\n if (!tableRef.current) {\n return;\n }\n\n if (resizing) {\n (0,dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(tableRef.current, prefix('column-resizing'));\n } else {\n (0,dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(tableRef.current, prefix('column-resizing'));\n }\n }, [prefix, tableRef]);\n var columnWidths = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)({});\n (0,_useMount__WEBPACK_IMPORTED_MODULE_14__[\"default\"])(function () {\n // As the cells are cached before the table width is updated, it is necessary to clear the cache again. fix: #430\n clearCache();\n });\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__[\"default\"])(function () {\n clearCache();\n }, [children, sortColumn, sortType, tableWidth.current, scrollX.current, minScrollX.current]);\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__[\"default\"])(function () {\n columnWidths.current = {};\n }, [children]);\n var handleColumnResizeEnd = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (columnWidth, _cursorDelta, dataKey, index) {\n columnWidths.current[dataKey + \"_\" + index + \"_width\"] = columnWidth;\n setColumnResizing(false);\n\n if (mouseAreaRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(mouseAreaRef.current, {\n display: 'none'\n });\n } // fix: https://github.com/rsuite/rsuite-table/issues/398\n\n\n (0,_flushSync__WEBPACK_IMPORTED_MODULE_13__[\"default\"])(function () {\n return clearCache();\n });\n onHeaderCellResize === null || onHeaderCellResize === void 0 ? void 0 : onHeaderCellResize(columnWidth, dataKey);\n }, [clearCache, mouseAreaRef, onHeaderCellResize, setColumnResizing]);\n var handleColumnResizeMove = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (rtl) {\n mouseAreaLeft += minScrollX.current + _constants__WEBPACK_IMPORTED_MODULE_7__.SCROLLBAR_WIDTH;\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (rtl ? -scrollX.current : scrollX.current);\n }\n\n if (mouseAreaRef.current) {\n var _addStyle;\n\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n }\n }, [minScrollX, mouseAreaRef, rtl, scrollX]);\n var handleColumnResizeStart = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n setColumnResizing(true);\n handleColumnResizeMove(width, left, fixed);\n }, [handleColumnResizeMove, setColumnResizing]);\n var handleSortColumn = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (dataKey) {\n var nextSortType = sortType;\n\n if (sortColumn === dataKey) {\n nextSortType = sortType === _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC ? _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.DESC : _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC;\n setSortType(nextSortType);\n }\n\n onSortColumn === null || onSortColumn === void 0 ? void 0 : onSortColumn(dataKey, nextSortType);\n }, [onSortColumn, setSortType, sortColumn, sortType]);\n\n if (cacheData) {\n return cacheData;\n }\n\n var hasCustomTreeCol = false;\n var left = 0; // Cell left margin\n\n var headerCells = []; // Table header cell\n\n var bodyCells = []; // Table body cell\n\n if (!children) {\n var _cacheCell = {\n columns: [],\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n setCacheData(_cacheCell);\n return _cacheCell;\n }\n\n var columns = (0,_getTableColumns__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(children);\n var count = columns.length;\n\n var _getTotalByColumns = (0,_getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__[\"default\"])(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n react__WEBPACK_IMPORTED_MODULE_1___default().Children.forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().isValidElement(column)) {\n var _columnWidths$current;\n\n var columnChildren = column.props.children;\n var columnProps = (0,_getColumnProps__WEBPACK_IMPORTED_MODULE_11__[\"default\"])(column);\n var _width = columnProps.width,\n resizable = columnProps.resizable,\n flexGrow = columnProps.flexGrow,\n minWidth = columnProps.minWidth,\n onResize = columnProps.onResize,\n treeCol = columnProps.treeCol;\n\n if (treeCol) {\n hasCustomTreeCol = true;\n }\n\n if (resizable && flexGrow) {\n console.warn(\"Cannot set 'resizable' and 'flexGrow' together in <Column>, column index: \" + index);\n }\n\n if (columnChildren.length !== 2) {\n throw new Error(\"Component <HeaderCell> and <Cell> is required, column index: \" + index + \" \");\n }\n\n var headerCell = columnChildren[0];\n var cell = columnChildren[1];\n var cellWidth = ((_columnWidths$current = columnWidths.current) === null || _columnWidths$current === void 0 ? void 0 : _columnWidths$current[cell.props.dataKey + \"_\" + index + \"_width\"]) || _width || 0;\n\n if (tableWidth.current && flexGrow && totalFlexGrow) {\n cellWidth = Math.max((tableWidth.current - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n }\n\n var cellProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, lodash_omit__WEBPACK_IMPORTED_MODULE_5___default()(columnProps, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: cellWidth,\n height: typeof rowHeight === 'function' ? rowHeight() : rowHeight,\n firstColumn: index === 0,\n lastColumn: index === count - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // Resizable column\n // `index` is used to define the serial number when dragging the column width\n index: index,\n dataKey: cell.props.dataKey,\n isHeaderCell: true,\n minWidth: columnProps.minWidth,\n sortable: columnProps.sortable,\n onSortColumn: handleSortColumn,\n sortType: sortType,\n sortColumn: sortColumn,\n flexGrow: flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_6___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: handleColumnResizeEnd,\n onColumnResizeStart: handleColumnResizeStart,\n onColumnResizeMove: handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(headerCell, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(cell, cellProps));\n left += cellWidth;\n }\n });\n var cacheCell = {\n columns: columns,\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n setCacheData(cacheCell);\n return cacheCell;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useCellDescriptor);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useCellDescriptor.js?");
10065
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/addClass */ \"./node_modules/dom-lib/esm/addClass.js\");\n/* harmony import */ var dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/removeClass */ \"./node_modules/dom-lib/esm/removeClass.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _useControlled__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./useControlled */ \"./node_modules/rsuite-table/es/utils/useControlled.js\");\n/* harmony import */ var _getTableColumns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./getTableColumns */ \"./node_modules/rsuite-table/es/utils/getTableColumns.js\");\n/* harmony import */ var _getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./getTotalByColumns */ \"./node_modules/rsuite-table/es/utils/getTotalByColumns.js\");\n/* harmony import */ var _getColumnProps__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./getColumnProps */ \"./node_modules/rsuite-table/es/utils/getColumnProps.js\");\n/* harmony import */ var _useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./useUpdateEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateEffect.js\");\n/* harmony import */ var _flushSync__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./flushSync */ \"./node_modules/rsuite-table/es/utils/flushSync.js\");\n/* harmony import */ var _useMount__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./useMount */ \"./node_modules/rsuite-table/es/utils/useMount.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Attach rendering-related attributes to all cells of the form and cache them.\n * @param props\n * @returns\n */\nvar useCellDescriptor = function useCellDescriptor(props) {\n var children = props.children,\n rtl = props.rtl,\n mouseAreaRef = props.mouseAreaRef,\n tableRef = props.tableRef,\n minScrollX = props.minScrollX,\n scrollX = props.scrollX,\n tableWidth = props.tableWidth,\n headerHeight = props.headerHeight,\n showHeader = props.showHeader,\n sortTypeProp = props.sortType,\n defaultSortType = props.defaultSortType,\n sortColumn = props.sortColumn,\n rowHeight = props.rowHeight,\n onSortColumn = props.onSortColumn,\n onHeaderCellResize = props.onHeaderCellResize,\n prefix = props.prefix;\n\n var _useControlled = (0,_useControlled__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(sortTypeProp, defaultSortType),\n sortType = _useControlled[0],\n setSortType = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(),\n cacheData = _useState[0],\n setCacheData = _useState[1];\n\n var clearCache = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {\n setCacheData(null);\n }, []);\n var setColumnResizing = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (resizing) {\n if (!tableRef.current) {\n return;\n }\n\n if (resizing) {\n (0,dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(tableRef.current, prefix('column-resizing'));\n } else {\n (0,dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(tableRef.current, prefix('column-resizing'));\n }\n }, [prefix, tableRef]);\n var columnWidths = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)({});\n (0,_useMount__WEBPACK_IMPORTED_MODULE_14__[\"default\"])(function () {\n // As the cells are cached before the table width is updated, it is necessary to clear the cache again. fix: #430\n clearCache();\n });\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__[\"default\"])(function () {\n clearCache();\n }, [children, sortColumn, sortType, tableWidth.current, scrollX.current, minScrollX.current]);\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_12__[\"default\"])(function () {\n columnWidths.current = {};\n }, [children]);\n var handleColumnResizeEnd = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (columnWidth, _cursorDelta, dataKey, index) {\n columnWidths.current[dataKey + \"_\" + index + \"_width\"] = columnWidth;\n setColumnResizing(false);\n\n if (mouseAreaRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(mouseAreaRef.current, {\n display: 'none'\n });\n } // fix: https://github.com/rsuite/rsuite-table/issues/398\n\n\n (0,_flushSync__WEBPACK_IMPORTED_MODULE_13__[\"default\"])(function () {\n return clearCache();\n });\n onHeaderCellResize === null || onHeaderCellResize === void 0 ? void 0 : onHeaderCellResize(columnWidth, dataKey);\n }, [clearCache, mouseAreaRef, onHeaderCellResize, setColumnResizing]);\n var handleColumnResizeMove = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (rtl) {\n mouseAreaLeft += minScrollX.current + _constants__WEBPACK_IMPORTED_MODULE_7__.SCROLLBAR_WIDTH;\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (rtl ? -scrollX.current : scrollX.current);\n }\n\n if (mouseAreaRef.current) {\n var _addStyle;\n\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n }\n }, [minScrollX, mouseAreaRef, rtl, scrollX]);\n var handleColumnResizeStart = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n setColumnResizing(true);\n handleColumnResizeMove(width, left, fixed);\n }, [handleColumnResizeMove, setColumnResizing]);\n var handleSortColumn = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (dataKey) {\n var nextSortType = sortType;\n\n if (sortColumn === dataKey) {\n nextSortType = sortType === _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC ? _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.DESC : _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC;\n setSortType(nextSortType);\n }\n\n onSortColumn === null || onSortColumn === void 0 ? void 0 : onSortColumn(dataKey, nextSortType);\n }, [onSortColumn, setSortType, sortColumn, sortType]);\n\n if (cacheData) {\n return cacheData;\n }\n\n var hasCustomTreeCol = false;\n var left = 0; // Cell left margin\n\n var headerCells = []; // Table header cell\n\n var bodyCells = []; // Table body cell\n\n if (!children) {\n var _cacheCell = {\n columns: [],\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n setCacheData(_cacheCell);\n return _cacheCell;\n }\n\n var columns = (0,_getTableColumns__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(children);\n var count = columns.length;\n\n var _getTotalByColumns = (0,_getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__[\"default\"])(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n react__WEBPACK_IMPORTED_MODULE_1___default().Children.forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().isValidElement(column)) {\n var _columnWidths$current;\n\n var columnChildren = column.props.children;\n var columnProps = (0,_getColumnProps__WEBPACK_IMPORTED_MODULE_11__[\"default\"])(column);\n var _width = columnProps.width,\n resizable = columnProps.resizable,\n flexGrow = columnProps.flexGrow,\n minWidth = columnProps.minWidth,\n onResize = columnProps.onResize,\n treeCol = columnProps.treeCol;\n\n if (treeCol) {\n hasCustomTreeCol = true;\n }\n\n if (columnChildren.length !== 2) {\n throw new Error(\"Component <HeaderCell> and <Cell> is required, column index: \" + index + \" \");\n }\n\n var headerCell = columnChildren[0];\n var cell = columnChildren[1];\n var currentWidth = (_columnWidths$current = columnWidths.current) === null || _columnWidths$current === void 0 ? void 0 : _columnWidths$current[cell.props.dataKey + \"_\" + index + \"_width\"];\n var cellWidth = currentWidth || _width || 0;\n\n if (tableWidth.current && flexGrow && totalFlexGrow) {\n var grewWidth = Math.max((tableWidth.current - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n /**\n * resizable = false, width will be recalc when table render.\n * resizable = true, only first render will use grewWidth.\n */\n\n cellWidth = resizable ? currentWidth || grewWidth : grewWidth;\n }\n\n var cellProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, lodash_omit__WEBPACK_IMPORTED_MODULE_5___default()(columnProps, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: cellWidth,\n height: typeof rowHeight === 'function' ? rowHeight() : rowHeight,\n firstColumn: index === 0,\n lastColumn: index === count - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // Resizable column\n // `index` is used to define the serial number when dragging the column width\n index: index,\n dataKey: cell.props.dataKey,\n isHeaderCell: true,\n minWidth: columnProps.minWidth,\n sortable: columnProps.sortable,\n onSortColumn: handleSortColumn,\n sortType: sortType,\n sortColumn: sortColumn,\n flexGrow: resizable ? undefined : flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_6___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: handleColumnResizeEnd,\n onColumnResizeStart: handleColumnResizeStart,\n onColumnResizeMove: handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(headerCell, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(cell, cellProps));\n left += cellWidth;\n }\n });\n var cacheCell = {\n columns: columns,\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n setCacheData(cacheCell);\n return cacheCell;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useCellDescriptor);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useCellDescriptor.js?");
10066
10066
 
10067
10067
  /***/ }),
10068
10068