rsuite 5.39.0 → 5.41.0
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/CHANGELOG.md +26 -0
- package/Navbar/styles/index.less +1 -1
- package/SelectPicker/styles/index.less +4 -8
- package/cjs/@types/common.js +1 -0
- package/cjs/@types/utils.js +12 -2
- package/cjs/Affix/Affix.js +39 -59
- package/cjs/Affix/index.js +1 -3
- package/cjs/Animation/Bounce.js +4 -13
- package/cjs/Animation/Collapse.js +19 -40
- package/cjs/Animation/Fade.js +6 -15
- package/cjs/Animation/Slide.js +6 -15
- package/cjs/Animation/Transition.js +16 -83
- package/cjs/Animation/index.js +1 -7
- package/cjs/Animation/utils.js +1 -6
- package/cjs/AutoComplete/AutoComplete.js +55 -90
- package/cjs/AutoComplete/index.js +1 -3
- package/cjs/AutoComplete/utils.js +1 -9
- package/cjs/Avatar/Avatar.js +18 -32
- package/cjs/Avatar/index.js +1 -3
- package/cjs/AvatarGroup/AvatarGroup.js +13 -27
- package/cjs/AvatarGroup/index.js +1 -3
- package/cjs/Badge/Badge.js +14 -27
- package/cjs/Badge/index.js +1 -3
- package/cjs/Breadcrumb/Breadcrumb.js +19 -41
- package/cjs/Breadcrumb/BreadcrumbItem.js +14 -26
- package/cjs/Breadcrumb/index.js +1 -3
- package/cjs/Button/Button.js +22 -40
- package/cjs/Button/index.js +1 -3
- package/cjs/ButtonGroup/ButtonGroup.js +15 -26
- package/cjs/ButtonGroup/ButtonGroupContext.js +1 -4
- package/cjs/ButtonGroup/index.js +1 -4
- package/cjs/ButtonToolbar/ButtonToolbar.js +10 -20
- package/cjs/ButtonToolbar/index.js +1 -3
- package/cjs/Calendar/Calendar.js +24 -43
- package/cjs/Calendar/CalendarBody.js +14 -28
- package/cjs/Calendar/CalendarContainer.js +46 -69
- package/cjs/Calendar/CalendarContext.js +1 -6
- package/cjs/Calendar/CalendarHeader.js +32 -59
- package/cjs/Calendar/MonthDropdown.js +22 -45
- package/cjs/Calendar/MonthDropdownItem.js +16 -31
- package/cjs/Calendar/Table.js +10 -21
- package/cjs/Calendar/TableHeaderRow.js +11 -25
- package/cjs/Calendar/TableRow.js +35 -66
- package/cjs/Calendar/TimeDropdown.js +24 -64
- package/cjs/Calendar/index.js +1 -8
- package/cjs/Calendar/types.js +1 -0
- package/cjs/Calendar/useCalendarDate.js +3 -13
- package/cjs/Calendar/useCalendarState.js +3 -8
- package/cjs/Carousel/Carousel.js +40 -65
- package/cjs/Carousel/index.js +1 -3
- package/cjs/Cascader/Cascader.js +126 -197
- package/cjs/Cascader/DropdownMenu.js +33 -65
- package/cjs/Cascader/index.js +1 -3
- package/cjs/Cascader/utils.js +13 -24
- package/cjs/CheckPicker/CheckPicker.js +105 -156
- package/cjs/CheckPicker/index.js +1 -3
- package/cjs/CheckTree/index.js +1 -8
- package/cjs/CheckTreePicker/CheckTreeNode.js +28 -54
- package/cjs/CheckTreePicker/CheckTreePicker.js +166 -248
- package/cjs/CheckTreePicker/index.js +1 -3
- package/cjs/CheckTreePicker/utils.d.ts +1 -1
- package/cjs/CheckTreePicker/utils.js +14 -54
- package/cjs/Checkbox/Checkbox.js +48 -77
- package/cjs/Checkbox/index.js +1 -3
- package/cjs/CheckboxGroup/CheckboxGroup.js +20 -38
- package/cjs/CheckboxGroup/CheckboxGroupContext.js +1 -4
- package/cjs/CheckboxGroup/index.js +1 -4
- package/cjs/CloseButton/CloseButton.js +10 -20
- package/cjs/CloseButton/index.js +1 -3
- package/cjs/Col/Col.js +10 -23
- package/cjs/Col/index.js +1 -3
- package/cjs/Container/Container.js +11 -24
- package/cjs/Container/index.js +1 -3
- package/cjs/Content/Content.js +1 -3
- package/cjs/Content/index.js +1 -3
- package/cjs/CustomProvider/CustomProvider.js +13 -28
- package/cjs/CustomProvider/FormattedDate.js +3 -9
- package/cjs/CustomProvider/index.js +1 -6
- package/cjs/DOMHelper/index.js +1 -7
- package/cjs/DOMHelper/isElement.js +1 -2
- package/cjs/DatePicker/DatePicker.js +108 -161
- package/cjs/DatePicker/PredefinedRanges.js +12 -29
- package/cjs/DatePicker/Toolbar.js +20 -36
- package/cjs/DatePicker/index.js +1 -3
- package/cjs/DatePicker/types.js +1 -0
- package/cjs/DatePicker/utils.js +5 -13
- package/cjs/DateRangePicker/Calendar.js +18 -28
- package/cjs/DateRangePicker/DateRangePicker.js +128 -207
- package/cjs/DateRangePicker/DateRangePickerContext.js +1 -6
- package/cjs/DateRangePicker/disabledDateUtils.js +9 -32
- package/cjs/DateRangePicker/index.js +1 -3
- package/cjs/DateRangePicker/types.js +1 -0
- package/cjs/DateRangePicker/utils.js +7 -20
- package/cjs/Disclosure/Disclosure.js +14 -34
- package/cjs/Disclosure/DisclosureButton.js +4 -12
- package/cjs/Disclosure/DisclosureContent.js +1 -5
- package/cjs/Disclosure/DisclosureContext.js +1 -6
- package/cjs/Disclosure/index.js +1 -3
- package/cjs/Disclosure/useDisclosureContext.js +1 -6
- package/cjs/Divider/Divider.js +11 -20
- package/cjs/Divider/index.js +1 -3
- package/cjs/Drawer/Drawer.js +10 -27
- package/cjs/Drawer/index.js +1 -3
- package/cjs/Dropdown/Dropdown.js +35 -68
- package/cjs/Dropdown/DropdownContext.js +1 -4
- package/cjs/Dropdown/DropdownItem.js +22 -49
- package/cjs/Dropdown/DropdownMenu.js +36 -63
- package/cjs/Dropdown/DropdownSeparator.js +8 -17
- package/cjs/Dropdown/DropdownState.js +1 -10
- package/cjs/Dropdown/DropdownToggle.js +17 -29
- package/cjs/Dropdown/index.js +1 -3
- package/cjs/Dropdown/useRenderDropdownItem.js +1 -5
- package/cjs/FlexboxGrid/FlexboxGrid.js +12 -22
- package/cjs/FlexboxGrid/FlexboxGridItem.js +12 -22
- package/cjs/FlexboxGrid/index.js +1 -3
- package/cjs/Footer/Footer.js +1 -3
- package/cjs/Footer/index.js +1 -3
- package/cjs/Form/Form.js +36 -76
- package/cjs/Form/FormContext.js +1 -8
- package/cjs/Form/index.js +1 -4
- package/cjs/Form/useFormClassNames.js +11 -14
- package/cjs/Form/useSchemaModel.js +2 -6
- package/cjs/FormControl/FormControl.js +50 -82
- package/cjs/FormControl/index.js +1 -3
- package/cjs/FormControl/useRegisterModel.js +1 -3
- package/cjs/FormControlLabel/FormControlLabel.js +10 -22
- package/cjs/FormControlLabel/index.js +1 -3
- package/cjs/FormErrorMessage/FormErrorMessage.js +12 -27
- package/cjs/FormErrorMessage/index.js +1 -3
- package/cjs/FormGroup/FormGroup.js +9 -21
- package/cjs/FormGroup/index.js +1 -3
- package/cjs/FormHelpText/FormHelpText.js +11 -28
- package/cjs/FormHelpText/index.js +1 -3
- package/cjs/Grid/Grid.js +10 -19
- package/cjs/Grid/index.js +1 -3
- package/cjs/Header/Header.js +1 -3
- package/cjs/Header/index.js +1 -3
- package/cjs/IconButton/IconButton.js +11 -21
- package/cjs/IconButton/index.js +1 -3
- package/cjs/Input/Input.js +26 -43
- package/cjs/Input/index.js +1 -3
- package/cjs/InputGroup/InputGroup.js +23 -39
- package/cjs/InputGroup/InputGroupAddon.js +9 -18
- package/cjs/InputGroup/InputGroupButton.js +7 -17
- package/cjs/InputGroup/index.js +1 -3
- package/cjs/InputNumber/InputNumber.js +42 -88
- package/cjs/InputNumber/index.js +1 -3
- package/cjs/InputPicker/InputAutosize.js +17 -42
- package/cjs/InputPicker/InputPicker.js +149 -250
- package/cjs/InputPicker/InputSearch.js +15 -28
- package/cjs/InputPicker/index.js +1 -3
- package/cjs/List/List.js +37 -51
- package/cjs/List/ListContext.js +1 -5
- package/cjs/List/ListItem.js +26 -40
- package/cjs/List/helper/AutoScroller.js +11 -21
- package/cjs/List/helper/useManager.js +1 -8
- package/cjs/List/helper/useSortHelper.js +58 -82
- package/cjs/List/helper/utils.js +6 -19
- package/cjs/List/index.js +1 -3
- package/cjs/Loader/Loader.js +17 -26
- package/cjs/Loader/index.js +1 -3
- package/cjs/MaskedInput/MaskedInput.js +2 -8
- package/cjs/MaskedInput/TextMask.js +14 -23
- package/cjs/MaskedInput/adjustCaretPosition.js +99 -70
- package/cjs/MaskedInput/conformToMask.js +79 -73
- package/cjs/MaskedInput/createTextMaskInputElement.js +65 -71
- package/cjs/MaskedInput/index.js +1 -3
- package/cjs/MaskedInput/types.js +1 -0
- package/cjs/MaskedInput/utilities.js +1 -8
- package/cjs/Menu/Menu.js +35 -79
- package/cjs/Menu/MenuContext.js +1 -8
- package/cjs/Menu/MenuItem.js +15 -26
- package/cjs/Menu/Menubar.js +13 -32
- package/cjs/Menu/index.js +1 -3
- package/cjs/Menu/useMenu.js +5 -34
- package/cjs/Message/Message.js +23 -45
- package/cjs/Message/index.js +1 -3
- package/cjs/Modal/Modal.js +70 -91
- package/cjs/Modal/ModalBody.js +11 -25
- package/cjs/Modal/ModalContext.js +1 -4
- package/cjs/Modal/ModalDialog.js +14 -26
- package/cjs/Modal/ModalFooter.js +1 -3
- package/cjs/Modal/ModalHeader.js +14 -29
- package/cjs/Modal/ModalTitle.js +9 -20
- package/cjs/Modal/index.js +1 -3
- package/cjs/Modal/utils.js +8 -19
- package/cjs/MultiCascader/DropdownMenu.js +38 -64
- package/cjs/MultiCascader/MultiCascader.js +129 -192
- package/cjs/MultiCascader/index.js +1 -3
- package/cjs/MultiCascader/utils.js +44 -106
- package/cjs/Nav/Nav.js +27 -69
- package/cjs/Nav/NavContext.js +1 -4
- package/cjs/Nav/NavDropdown.js +28 -60
- package/cjs/Nav/NavDropdownItem.js +20 -42
- package/cjs/Nav/NavDropdownMenu.js +26 -54
- package/cjs/Nav/NavDropdownToggle.js +12 -26
- package/cjs/Nav/NavItem.js +20 -39
- package/cjs/Nav/NavMenu.js +2 -28
- package/cjs/Nav/index.js +1 -3
- package/cjs/Navbar/Navbar.js +10 -23
- package/cjs/Navbar/NavbarBody.js +1 -6
- package/cjs/Navbar/NavbarBrand.js +1 -3
- package/cjs/Navbar/NavbarDropdown.js +25 -49
- package/cjs/Navbar/NavbarDropdownItem.js +18 -44
- package/cjs/Navbar/NavbarDropdownMenu.js +22 -51
- package/cjs/Navbar/NavbarDropdownToggle.js +12 -25
- package/cjs/Navbar/NavbarHeader.js +1 -6
- package/cjs/Navbar/NavbarItem.js +19 -35
- package/cjs/Navbar/index.js +1 -3
- package/cjs/Notification/Notification.js +20 -43
- package/cjs/Notification/index.js +1 -3
- package/cjs/Overlay/Modal.js +40 -79
- package/cjs/Overlay/ModalManager.js +1 -26
- package/cjs/Overlay/Overlay.js +28 -50
- package/cjs/Overlay/OverlayContext.js +1 -4
- package/cjs/Overlay/OverlayTrigger.js +67 -116
- package/cjs/Overlay/Position.js +25 -64
- package/cjs/Overlay/index.js +1 -3
- package/cjs/Overlay/positionUtils.js +25 -86
- package/cjs/Pagination/Pagination.js +30 -70
- package/cjs/Pagination/PaginationButton.js +15 -29
- package/cjs/Pagination/PaginationGroup.js +38 -63
- package/cjs/Pagination/index.js +1 -3
- package/cjs/Panel/Panel.js +37 -61
- package/cjs/Panel/index.js +1 -3
- package/cjs/PanelGroup/PanelGroup.js +16 -29
- package/cjs/PanelGroup/index.js +1 -3
- package/cjs/Picker/DropdownMenu.js +50 -93
- package/cjs/Picker/DropdownMenuCheckItem.js +22 -33
- package/cjs/Picker/DropdownMenuGroup.js +10 -22
- package/cjs/Picker/DropdownMenuItem.js +15 -26
- package/cjs/Picker/PickerOverlay.js +12 -28
- package/cjs/Picker/PickerToggle.js +57 -89
- package/cjs/Picker/PickerToggleTrigger.js +8 -19
- package/cjs/Picker/SearchBar.js +14 -26
- package/cjs/Picker/SelectedElement.js +9 -17
- package/cjs/Picker/ToggleButton.js +1 -6
- package/cjs/Picker/index.js +1 -24
- package/cjs/Picker/propTypes.js +1 -7
- package/cjs/Picker/types.js +1 -0
- package/cjs/Picker/utils.js +94 -200
- package/cjs/Placeholder/Placeholder.js +1 -5
- package/cjs/Placeholder/PlaceholderGraph.js +13 -22
- package/cjs/Placeholder/PlaceholderGrid.js +18 -34
- package/cjs/Placeholder/PlaceholderParagraph.js +17 -29
- package/cjs/Placeholder/index.js +1 -3
- package/cjs/Plaintext/Plaintext.js +14 -23
- package/cjs/Plaintext/index.js +1 -3
- package/cjs/Popover/Popover.js +16 -27
- package/cjs/Popover/index.js +1 -3
- package/cjs/Progress/Progress.js +1 -4
- package/cjs/Progress/ProgressCircle.js +30 -47
- package/cjs/Progress/ProgressLine.js +19 -29
- package/cjs/Progress/index.js +1 -3
- package/cjs/Radio/Radio.js +42 -62
- package/cjs/Radio/index.js +1 -3
- package/cjs/RadioGroup/RadioGroup.js +22 -37
- package/cjs/RadioGroup/index.js +1 -3
- package/cjs/RadioTile/RadioTile.js +30 -47
- package/cjs/RadioTile/index.js +1 -3
- package/cjs/RadioTileGroup/RadioTileGroup.js +17 -32
- package/cjs/RadioTileGroup/index.js +1 -3
- package/cjs/RangeSlider/RangeSlider.js +63 -104
- package/cjs/RangeSlider/index.js +1 -3
- package/cjs/Rate/Character.js +16 -31
- package/cjs/Rate/Rate.js +35 -62
- package/cjs/Rate/index.js +1 -3
- package/cjs/Rate/utils.js +1 -6
- package/cjs/Ripple/Ripple.js +16 -40
- package/cjs/Ripple/index.js +1 -3
- package/cjs/Row/Row.js +11 -22
- package/cjs/Row/index.js +1 -3
- package/cjs/SafeAnchor/SafeAnchor.js +8 -19
- package/cjs/SafeAnchor/index.js +1 -3
- package/cjs/Schema/Schema.js +1 -2
- package/cjs/Schema/index.js +1 -3
- package/cjs/SelectPicker/SelectPicker.js +136 -170
- package/cjs/SelectPicker/index.js +1 -3
- package/cjs/Sidebar/Sidebar.js +13 -26
- package/cjs/Sidebar/index.js +1 -3
- package/cjs/Sidenav/ExpandedSidenavDropdown.js +32 -54
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +19 -41
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +22 -46
- package/cjs/Sidenav/Node.js +1 -12
- package/cjs/Sidenav/Sidenav.js +22 -45
- package/cjs/Sidenav/SidenavBody.js +1 -3
- package/cjs/Sidenav/SidenavDropdown.js +39 -70
- package/cjs/Sidenav/SidenavDropdownCollapse.js +9 -22
- package/cjs/Sidenav/SidenavDropdownItem.js +19 -45
- package/cjs/Sidenav/SidenavDropdownMenu.js +26 -54
- package/cjs/Sidenav/SidenavDropdownToggle.js +12 -25
- package/cjs/Sidenav/SidenavHeader.js +1 -3
- package/cjs/Sidenav/SidenavItem.js +27 -55
- package/cjs/Sidenav/SidenavToggle.js +11 -31
- package/cjs/Sidenav/index.js +1 -3
- package/cjs/Slider/Graduated.js +14 -29
- package/cjs/Slider/Handle.js +27 -52
- package/cjs/Slider/Input.js +2 -8
- package/cjs/Slider/Mark.js +11 -20
- package/cjs/Slider/ProgressBar.js +14 -23
- package/cjs/Slider/Slider.js +51 -84
- package/cjs/Slider/index.js +1 -3
- package/cjs/Slider/utils.js +1 -6
- package/cjs/Stack/Stack.js +22 -35
- package/cjs/Stack/StackItem.js +11 -17
- package/cjs/Stack/index.js +1 -3
- package/cjs/Steps/StepItem.js +16 -32
- package/cjs/Steps/Steps.js +18 -32
- package/cjs/Steps/index.js +1 -3
- package/cjs/Table/Table.js +6 -16
- package/cjs/Table/index.js +1 -3
- package/cjs/Tag/Tag.js +16 -28
- package/cjs/Tag/index.js +1 -3
- package/cjs/TagGroup/TagGroup.js +1 -3
- package/cjs/TagGroup/index.js +1 -3
- package/cjs/TagInput/index.js +7 -14
- package/cjs/TagPicker/index.js +5 -12
- package/cjs/Timeline/Timeline.js +14 -29
- package/cjs/Timeline/TimelineItem.js +14 -23
- package/cjs/Timeline/index.js +1 -3
- package/cjs/Toggle/Toggle.js +26 -45
- package/cjs/Toggle/index.js +1 -3
- package/cjs/Tooltip/Tooltip.js +13 -22
- package/cjs/Tooltip/index.js +1 -3
- package/cjs/Tree/Tree.js +1 -10
- package/cjs/Tree/TreeContext.js +1 -4
- package/cjs/Tree/index.js +1 -3
- package/cjs/TreePicker/TreeNode.js +37 -60
- package/cjs/TreePicker/TreePicker.js +155 -231
- package/cjs/TreePicker/index.js +1 -3
- package/cjs/Uploader/UploadFileItem.js +37 -82
- package/cjs/Uploader/UploadTrigger.js +24 -46
- package/cjs/Uploader/Uploader.js +89 -141
- package/cjs/Uploader/index.js +1 -3
- package/cjs/Whisper/Whisper.js +8 -20
- package/cjs/Whisper/index.js +1 -3
- package/cjs/Windowing/AutoSizer.js +13 -33
- package/cjs/Windowing/List.d.ts +2 -2
- package/cjs/Windowing/List.js +6 -22
- package/cjs/Windowing/index.js +1 -7
- package/cjs/index.js +1 -164
- package/cjs/locales/ar_EG.js +1 -4
- package/cjs/locales/da_DK.js +1 -5
- package/cjs/locales/de_DE.js +1 -5
- package/cjs/locales/default.js +1 -5
- package/cjs/locales/en_GB.js +1 -3
- package/cjs/locales/en_US.js +1 -4
- package/cjs/locales/es_AR.js +1 -5
- package/cjs/locales/es_ES.js +1 -5
- package/cjs/locales/fa_IR.js +1 -4
- package/cjs/locales/fi_FI.js +1 -5
- package/cjs/locales/fr_FR.js +1 -4
- package/cjs/locales/hu_HU.js +1 -5
- package/cjs/locales/index.js +1 -47
- package/cjs/locales/it_IT.js +1 -5
- package/cjs/locales/ja_JP.js +1 -5
- package/cjs/locales/kk_KZ.js +1 -4
- package/cjs/locales/ko_KR.js +1 -5
- package/cjs/locales/ne_NP.js +1 -5
- package/cjs/locales/nl_NL.js +1 -4
- package/cjs/locales/pt_BR.js +1 -4
- package/cjs/locales/ru_RU.js +1 -4
- package/cjs/locales/sv_SE.js +1 -5
- package/cjs/locales/tr_TR.js +1 -4
- package/cjs/locales/zh_CN.js +1 -4
- package/cjs/locales/zh_TW.js +1 -4
- package/cjs/toaster/ToastContainer.js +29 -52
- package/cjs/toaster/ToastContext.js +1 -4
- package/cjs/toaster/index.js +1 -4
- package/cjs/toaster/toaster.js +4 -27
- package/cjs/toaster/useToaster.js +2 -8
- package/cjs/utils/BrowserDetection.js +7 -24
- package/cjs/utils/ReactChildren.js +2 -19
- package/cjs/utils/ajaxUpload.js +15 -33
- package/cjs/utils/appendTooltip.js +3 -9
- package/cjs/utils/attachParent.js +1 -1
- package/cjs/utils/clone.js +1 -2
- package/cjs/utils/composeFunctions.js +1 -3
- package/cjs/utils/constants.js +3 -8
- package/cjs/utils/createChainedFunction.js +2 -6
- package/cjs/utils/createComponent.js +12 -24
- package/cjs/utils/dateUtils.js +7 -121
- package/cjs/utils/deprecateComponent.js +1 -8
- package/cjs/utils/deprecatePropType.js +2 -9
- package/cjs/utils/dom.js +3 -2
- package/cjs/utils/events.js +2 -3
- package/cjs/utils/getDOMNode.js +16 -9
- package/cjs/utils/getDataGroupBy.d.ts +0 -23
- package/cjs/utils/getDataGroupBy.js +5 -44
- package/cjs/utils/getSafeRegExpString.js +1 -1
- package/cjs/utils/guid.js +1 -1
- package/cjs/utils/htmlPropsUtils.js +23 -20
- package/cjs/utils/index.js +1 -86
- package/cjs/utils/isOneOf.js +1 -2
- package/cjs/utils/mergeRefs.js +1 -2
- package/cjs/utils/placementPolyfill.js +2 -5
- package/cjs/utils/prefix.js +4 -15
- package/cjs/utils/previewFile.js +1 -6
- package/cjs/utils/propTypeChecker.js +1 -8
- package/cjs/utils/reactToString.js +1 -5
- package/cjs/utils/render.js +3 -10
- package/cjs/utils/scrollTopAnimation.js +1 -9
- package/cjs/utils/shallowEqual.js +8 -14
- package/cjs/utils/shallowEqualArray.js +1 -7
- package/cjs/utils/statusIcons.js +1 -9
- package/cjs/utils/stringToObject.js +1 -7
- package/cjs/utils/tplTransform.js +2 -7
- package/cjs/utils/treeUtils.d.ts +1 -1
- package/cjs/utils/treeUtils.js +119 -334
- package/cjs/utils/useClassNames.js +9 -15
- package/cjs/utils/useClickOutside.js +4 -8
- package/cjs/utils/useControlled.js +11 -7
- package/cjs/utils/useCustom.js +12 -25
- package/cjs/utils/useElementResize.js +1 -6
- package/cjs/utils/useEnsuredRef.js +1 -4
- package/cjs/utils/useEventCallback.js +1 -4
- package/cjs/utils/useEventListener.js +1 -5
- package/cjs/utils/useFocus.js +5 -6
- package/cjs/utils/useInternalId.js +1 -6
- package/cjs/utils/useIsMounted.js +1 -3
- package/cjs/utils/useMap.js +5 -7
- package/cjs/utils/useMount.js +1 -4
- package/cjs/utils/usePortal.js +7 -20
- package/cjs/utils/useRootClose.js +9 -19
- package/cjs/utils/useTimeout.js +3 -8
- package/cjs/utils/useToggleCaret.js +2 -14
- package/cjs/utils/useUniqueId.js +2 -9
- package/cjs/utils/useUpdateEffect.js +3 -5
- package/cjs/utils/useUpdatedRef.js +1 -2
- package/cjs/utils/useWillUnmount.js +3 -5
- package/cjs/utils/warnOnce.js +2 -2
- package/dist/rsuite-no-reset-rtl.css +23 -25
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +23 -25
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +23 -25
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +23 -25
- package/dist/rsuite.js +407 -440
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.js +1 -0
- package/esm/@types/utils.js +14 -2
- package/esm/Affix/Affix.js +39 -50
- package/esm/Affix/index.js +1 -0
- package/esm/Animation/Bounce.js +4 -5
- package/esm/Animation/Collapse.js +19 -26
- package/esm/Animation/Fade.js +6 -7
- package/esm/Animation/Slide.js +6 -7
- package/esm/Animation/Transition.js +16 -69
- package/esm/Animation/index.js +1 -0
- package/esm/Animation/utils.js +1 -2
- package/esm/AutoComplete/AutoComplete.js +55 -75
- package/esm/AutoComplete/index.js +1 -0
- package/esm/AutoComplete/utils.js +1 -4
- package/esm/Avatar/Avatar.js +18 -22
- package/esm/Avatar/index.js +1 -0
- package/esm/AvatarGroup/AvatarGroup.js +13 -16
- package/esm/AvatarGroup/index.js +1 -0
- package/esm/Badge/Badge.js +14 -19
- package/esm/Badge/index.js +1 -0
- package/esm/Breadcrumb/Breadcrumb.js +19 -30
- package/esm/Breadcrumb/BreadcrumbItem.js +14 -17
- package/esm/Breadcrumb/index.js +1 -0
- package/esm/Button/Button.js +22 -28
- package/esm/Button/index.js +1 -0
- package/esm/ButtonGroup/ButtonGroup.js +15 -16
- package/esm/ButtonGroup/ButtonGroupContext.js +1 -0
- package/esm/ButtonGroup/index.js +1 -0
- package/esm/ButtonToolbar/ButtonToolbar.js +10 -12
- package/esm/ButtonToolbar/index.js +1 -0
- package/esm/Calendar/Calendar.js +24 -29
- package/esm/Calendar/CalendarBody.js +14 -18
- package/esm/Calendar/CalendarContainer.js +46 -51
- package/esm/Calendar/CalendarContext.js +1 -0
- package/esm/Calendar/CalendarHeader.js +32 -41
- package/esm/Calendar/MonthDropdown.js +22 -27
- package/esm/Calendar/MonthDropdownItem.js +16 -20
- package/esm/Calendar/Table.js +10 -11
- package/esm/Calendar/TableHeaderRow.js +11 -15
- package/esm/Calendar/TableRow.js +36 -50
- package/esm/Calendar/TimeDropdown.js +24 -48
- package/esm/Calendar/index.js +1 -0
- package/esm/Calendar/types.js +1 -0
- package/esm/Calendar/useCalendarDate.js +3 -11
- package/esm/Calendar/useCalendarState.js +3 -6
- package/esm/Carousel/Carousel.js +40 -52
- package/esm/Carousel/index.js +1 -0
- package/esm/Cascader/Cascader.js +126 -178
- package/esm/Cascader/DropdownMenu.js +33 -45
- package/esm/Cascader/index.js +1 -0
- package/esm/Cascader/utils.js +13 -22
- package/esm/CheckPicker/CheckPicker.js +105 -139
- package/esm/CheckPicker/index.js +1 -0
- package/esm/CheckTree/index.js +1 -0
- package/esm/CheckTreePicker/CheckTreeNode.js +28 -44
- package/esm/CheckTreePicker/CheckTreePicker.js +166 -233
- package/esm/CheckTreePicker/index.js +1 -0
- package/esm/CheckTreePicker/utils.d.ts +1 -1
- package/esm/CheckTreePicker/utils.js +14 -37
- package/esm/Checkbox/Checkbox.js +48 -66
- package/esm/Checkbox/index.js +1 -0
- package/esm/CheckboxGroup/CheckboxGroup.js +20 -25
- package/esm/CheckboxGroup/CheckboxGroupContext.js +1 -0
- package/esm/CheckboxGroup/index.js +1 -0
- package/esm/CloseButton/CloseButton.js +10 -13
- package/esm/CloseButton/index.js +1 -0
- package/esm/Col/Col.js +10 -13
- package/esm/Col/index.js +1 -0
- package/esm/Container/Container.js +11 -13
- package/esm/Container/index.js +1 -0
- package/esm/Content/Content.js +1 -1
- package/esm/Content/index.js +1 -0
- package/esm/CustomProvider/CustomProvider.js +13 -16
- package/esm/CustomProvider/FormattedDate.js +3 -6
- package/esm/CustomProvider/index.js +1 -0
- package/esm/DOMHelper/index.js +1 -2
- package/esm/DOMHelper/isElement.js +1 -1
- package/esm/DatePicker/DatePicker.js +108 -131
- package/esm/DatePicker/PredefinedRanges.js +12 -19
- package/esm/DatePicker/Toolbar.js +20 -26
- package/esm/DatePicker/index.js +1 -0
- package/esm/DatePicker/types.js +1 -0
- package/esm/DatePicker/utils.js +5 -8
- package/esm/DateRangePicker/Calendar.js +18 -18
- package/esm/DateRangePicker/DateRangePicker.js +128 -184
- package/esm/DateRangePicker/DateRangePickerContext.js +1 -0
- package/esm/DateRangePicker/disabledDateUtils.js +9 -24
- package/esm/DateRangePicker/index.js +1 -0
- package/esm/DateRangePicker/types.js +1 -0
- package/esm/DateRangePicker/utils.js +7 -12
- package/esm/Disclosure/Disclosure.js +13 -24
- package/esm/Disclosure/DisclosureButton.js +4 -7
- package/esm/Disclosure/DisclosureContent.js +1 -2
- package/esm/Disclosure/DisclosureContext.js +1 -2
- package/esm/Disclosure/index.js +1 -0
- package/esm/Disclosure/useDisclosureContext.js +1 -2
- package/esm/Divider/Divider.js +11 -12
- package/esm/Divider/index.js +1 -0
- package/esm/Drawer/Drawer.js +10 -11
- package/esm/Drawer/index.js +1 -0
- package/esm/Dropdown/Dropdown.js +35 -50
- package/esm/Dropdown/DropdownContext.js +1 -0
- package/esm/Dropdown/DropdownItem.js +22 -31
- package/esm/Dropdown/DropdownMenu.js +36 -49
- package/esm/Dropdown/DropdownSeparator.js +8 -10
- package/esm/Dropdown/DropdownState.js +1 -7
- package/esm/Dropdown/DropdownToggle.js +17 -17
- package/esm/Dropdown/index.js +1 -0
- package/esm/Dropdown/useRenderDropdownItem.js +1 -2
- package/esm/FlexboxGrid/FlexboxGrid.js +12 -13
- package/esm/FlexboxGrid/FlexboxGridItem.js +12 -14
- package/esm/FlexboxGrid/index.js +1 -0
- package/esm/Footer/Footer.js +1 -0
- package/esm/Footer/index.js +1 -0
- package/esm/Form/Form.js +36 -63
- package/esm/Form/FormContext.js +1 -0
- package/esm/Form/index.js +1 -0
- package/esm/Form/useFormClassNames.js +11 -13
- package/esm/Form/useSchemaModel.js +2 -4
- package/esm/FormControl/FormControl.js +48 -68
- package/esm/FormControl/index.js +1 -0
- package/esm/FormControl/useRegisterModel.js +1 -2
- package/esm/FormControlLabel/FormControlLabel.js +10 -12
- package/esm/FormControlLabel/index.js +1 -0
- package/esm/FormErrorMessage/FormErrorMessage.js +12 -18
- package/esm/FormErrorMessage/index.js +1 -0
- package/esm/FormGroup/FormGroup.js +9 -10
- package/esm/FormGroup/index.js +1 -0
- package/esm/FormHelpText/FormHelpText.js +11 -15
- package/esm/FormHelpText/index.js +1 -0
- package/esm/Grid/Grid.js +10 -11
- package/esm/Grid/index.js +1 -0
- package/esm/Header/Header.js +1 -0
- package/esm/Header/index.js +1 -0
- package/esm/IconButton/IconButton.js +11 -12
- package/esm/IconButton/index.js +1 -0
- package/esm/Input/Input.js +26 -32
- package/esm/Input/index.js +1 -0
- package/esm/InputGroup/InputGroup.js +23 -26
- package/esm/InputGroup/InputGroupAddon.js +9 -10
- package/esm/InputGroup/InputGroupButton.js +7 -9
- package/esm/InputGroup/index.js +1 -0
- package/esm/InputNumber/InputNumber.js +42 -72
- package/esm/InputNumber/index.js +1 -0
- package/esm/InputPicker/InputAutosize.js +17 -37
- package/esm/InputPicker/InputPicker.js +149 -225
- package/esm/InputPicker/InputSearch.js +15 -20
- package/esm/InputPicker/index.js +1 -0
- package/esm/List/List.js +37 -39
- package/esm/List/ListContext.js +1 -0
- package/esm/List/ListItem.js +26 -30
- package/esm/List/helper/AutoScroller.js +11 -21
- package/esm/List/helper/useManager.js +1 -6
- package/esm/List/helper/useSortHelper.js +58 -74
- package/esm/List/helper/utils.js +6 -11
- package/esm/List/index.js +1 -0
- package/esm/Loader/Loader.js +17 -19
- package/esm/Loader/index.js +1 -0
- package/esm/MaskedInput/MaskedInput.js +2 -1
- package/esm/MaskedInput/TextMask.js +12 -14
- package/esm/MaskedInput/adjustCaretPosition.js +99 -69
- package/esm/MaskedInput/conformToMask.js +79 -70
- package/esm/MaskedInput/createTextMaskInputElement.js +65 -62
- package/esm/MaskedInput/index.js +1 -0
- package/esm/MaskedInput/types.js +1 -0
- package/esm/MaskedInput/utilities.js +1 -6
- package/esm/Menu/Menu.js +35 -66
- package/esm/Menu/MenuContext.js +1 -4
- package/esm/Menu/MenuItem.js +15 -19
- package/esm/Menu/Menubar.js +13 -23
- package/esm/Menu/index.js +1 -0
- package/esm/Menu/useMenu.js +4 -27
- package/esm/Message/Message.js +23 -34
- package/esm/Message/index.js +1 -0
- package/esm/Modal/Modal.js +70 -69
- package/esm/Modal/ModalBody.js +11 -13
- package/esm/Modal/ModalContext.js +1 -0
- package/esm/Modal/ModalDialog.js +14 -18
- package/esm/Modal/ModalFooter.js +1 -0
- package/esm/Modal/ModalHeader.js +14 -16
- package/esm/Modal/ModalTitle.js +9 -10
- package/esm/Modal/index.js +1 -0
- package/esm/Modal/utils.js +8 -12
- package/esm/MultiCascader/DropdownMenu.js +38 -48
- package/esm/MultiCascader/MultiCascader.js +129 -174
- package/esm/MultiCascader/index.js +1 -0
- package/esm/MultiCascader/utils.js +44 -87
- package/esm/Nav/Nav.js +27 -45
- package/esm/Nav/NavContext.js +1 -0
- package/esm/Nav/NavDropdown.js +28 -44
- package/esm/Nav/NavDropdownItem.js +20 -31
- package/esm/Nav/NavDropdownMenu.js +26 -42
- package/esm/Nav/NavDropdownToggle.js +12 -15
- package/esm/Nav/NavItem.js +20 -28
- package/esm/Nav/NavMenu.js +2 -13
- package/esm/Nav/index.js +1 -0
- package/esm/Navbar/Navbar.js +10 -11
- package/esm/Navbar/NavbarBody.js +1 -0
- package/esm/Navbar/NavbarBrand.js +1 -0
- package/esm/Navbar/NavbarDropdown.js +25 -33
- package/esm/Navbar/NavbarDropdownItem.js +18 -30
- package/esm/Navbar/NavbarDropdownMenu.js +22 -37
- package/esm/Navbar/NavbarDropdownToggle.js +12 -14
- package/esm/Navbar/NavbarHeader.js +1 -0
- package/esm/Navbar/NavbarItem.js +19 -23
- package/esm/Navbar/index.js +1 -0
- package/esm/Notification/Notification.js +20 -32
- package/esm/Notification/index.js +1 -0
- package/esm/Overlay/Modal.js +40 -64
- package/esm/Overlay/ModalManager.js +1 -19
- package/esm/Overlay/Overlay.js +28 -37
- package/esm/Overlay/OverlayContext.js +1 -0
- package/esm/Overlay/OverlayTrigger.js +68 -101
- package/esm/Overlay/Position.js +25 -47
- package/esm/Overlay/index.js +1 -0
- package/esm/Overlay/positionUtils.js +25 -73
- package/esm/Pagination/Pagination.js +30 -55
- package/esm/Pagination/PaginationButton.js +15 -19
- package/esm/Pagination/PaginationGroup.js +38 -49
- package/esm/Pagination/index.js +1 -0
- package/esm/Panel/Panel.js +37 -49
- package/esm/Panel/index.js +1 -0
- package/esm/PanelGroup/PanelGroup.js +16 -18
- package/esm/PanelGroup/index.js +1 -0
- package/esm/Picker/DropdownMenu.js +50 -72
- package/esm/Picker/DropdownMenuCheckItem.js +22 -24
- package/esm/Picker/DropdownMenuGroup.js +10 -13
- package/esm/Picker/DropdownMenuItem.js +15 -18
- package/esm/Picker/PickerOverlay.js +12 -17
- package/esm/Picker/PickerToggle.js +57 -71
- package/esm/Picker/PickerToggleTrigger.js +8 -10
- package/esm/Picker/SearchBar.js +14 -15
- package/esm/Picker/SelectedElement.js +9 -14
- package/esm/Picker/ToggleButton.js +1 -0
- package/esm/Picker/index.js +1 -0
- package/esm/Picker/propTypes.js +1 -1
- package/esm/Picker/types.js +1 -0
- package/esm/Picker/utils.js +94 -182
- package/esm/Placeholder/Placeholder.js +1 -0
- package/esm/Placeholder/PlaceholderGraph.js +13 -16
- package/esm/Placeholder/PlaceholderGrid.js +18 -25
- package/esm/Placeholder/PlaceholderParagraph.js +17 -20
- package/esm/Placeholder/index.js +1 -0
- package/esm/Plaintext/Plaintext.js +14 -17
- package/esm/Plaintext/index.js +1 -0
- package/esm/Popover/Popover.js +16 -21
- package/esm/Popover/index.js +1 -0
- package/esm/Progress/Progress.js +1 -0
- package/esm/Progress/ProgressCircle.js +30 -39
- package/esm/Progress/ProgressLine.js +19 -21
- package/esm/Progress/index.js +1 -0
- package/esm/Radio/Radio.js +42 -52
- package/esm/Radio/index.js +1 -0
- package/esm/RadioGroup/RadioGroup.js +22 -25
- package/esm/RadioGroup/index.js +1 -0
- package/esm/RadioTile/RadioTile.js +30 -34
- package/esm/RadioTile/index.js +1 -0
- package/esm/RadioTileGroup/RadioTileGroup.js +17 -20
- package/esm/RadioTileGroup/index.js +1 -0
- package/esm/RangeSlider/RangeSlider.js +63 -86
- package/esm/RangeSlider/index.js +1 -0
- package/esm/Rate/Character.js +16 -21
- package/esm/Rate/Rate.js +35 -48
- package/esm/Rate/index.js +1 -0
- package/esm/Rate/utils.js +1 -2
- package/esm/Ripple/Ripple.js +16 -30
- package/esm/Ripple/index.js +1 -0
- package/esm/Row/Row.js +11 -14
- package/esm/Row/index.js +1 -0
- package/esm/SafeAnchor/SafeAnchor.js +8 -13
- package/esm/SafeAnchor/index.js +1 -0
- package/esm/Schema/Schema.js +1 -0
- package/esm/Schema/index.js +1 -0
- package/esm/SelectPicker/SelectPicker.js +137 -157
- package/esm/SelectPicker/index.js +1 -0
- package/esm/Sidebar/Sidebar.js +13 -18
- package/esm/Sidebar/index.js +1 -0
- package/esm/Sidenav/ExpandedSidenavDropdown.js +32 -35
- package/esm/Sidenav/ExpandedSidenavDropdownItem.js +19 -27
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +22 -29
- package/esm/Sidenav/Node.js +1 -10
- package/esm/Sidenav/Sidenav.js +22 -28
- package/esm/Sidenav/SidenavBody.js +1 -0
- package/esm/Sidenav/SidenavDropdown.js +39 -52
- package/esm/Sidenav/SidenavDropdownCollapse.js +9 -13
- package/esm/Sidenav/SidenavDropdownItem.js +19 -31
- package/esm/Sidenav/SidenavDropdownMenu.js +26 -41
- package/esm/Sidenav/SidenavDropdownToggle.js +12 -14
- package/esm/Sidenav/SidenavHeader.js +1 -0
- package/esm/Sidenav/SidenavItem.js +27 -37
- package/esm/Sidenav/SidenavToggle.js +11 -18
- package/esm/Sidenav/index.js +1 -0
- package/esm/Slider/Graduated.js +14 -21
- package/esm/Slider/Handle.js +27 -39
- package/esm/Slider/Input.js +2 -2
- package/esm/Slider/Mark.js +11 -14
- package/esm/Slider/ProgressBar.js +14 -18
- package/esm/Slider/Slider.js +51 -67
- package/esm/Slider/index.js +1 -0
- package/esm/Slider/utils.js +1 -5
- package/esm/Stack/Stack.js +22 -27
- package/esm/Stack/StackItem.js +11 -11
- package/esm/Stack/index.js +1 -0
- package/esm/Steps/StepItem.js +16 -22
- package/esm/Steps/Steps.js +18 -22
- package/esm/Steps/index.js +1 -0
- package/esm/Table/Table.js +6 -7
- package/esm/Table/index.js +1 -0
- package/esm/Tag/Tag.js +16 -19
- package/esm/Tag/index.js +1 -0
- package/esm/TagGroup/TagGroup.js +1 -0
- package/esm/TagGroup/index.js +1 -0
- package/esm/TagInput/index.js +7 -7
- package/esm/TagPicker/index.js +5 -5
- package/esm/Timeline/Timeline.js +14 -19
- package/esm/Timeline/TimelineItem.js +14 -15
- package/esm/Timeline/index.js +1 -0
- package/esm/Toggle/Toggle.js +26 -35
- package/esm/Toggle/index.js +1 -0
- package/esm/Tooltip/Tooltip.js +13 -16
- package/esm/Tooltip/index.js +1 -0
- package/esm/Tree/Tree.js +1 -3
- package/esm/Tree/TreeContext.js +1 -0
- package/esm/Tree/index.js +1 -0
- package/esm/TreePicker/TreeNode.js +37 -49
- package/esm/TreePicker/TreePicker.js +155 -218
- package/esm/TreePicker/index.js +1 -0
- package/esm/Uploader/UploadFileItem.js +37 -68
- package/esm/Uploader/UploadTrigger.js +24 -38
- package/esm/Uploader/Uploader.js +90 -132
- package/esm/Uploader/index.js +1 -0
- package/esm/Whisper/Whisper.js +8 -10
- package/esm/Whisper/index.js +1 -0
- package/esm/Windowing/AutoSizer.js +13 -24
- package/esm/Windowing/List.d.ts +2 -2
- package/esm/Windowing/List.js +6 -15
- package/esm/Windowing/index.js +1 -0
- package/esm/index.js +3 -0
- package/esm/locales/ar_EG.js +1 -0
- package/esm/locales/da_DK.js +1 -1
- package/esm/locales/de_DE.js +1 -1
- package/esm/locales/default.js +1 -1
- package/esm/locales/en_GB.js +1 -0
- package/esm/locales/en_US.js +1 -0
- package/esm/locales/es_AR.js +1 -1
- package/esm/locales/es_ES.js +1 -1
- package/esm/locales/fa_IR.js +1 -0
- package/esm/locales/fi_FI.js +1 -1
- package/esm/locales/fr_FR.js +1 -0
- package/esm/locales/hu_HU.js +1 -1
- package/esm/locales/index.js +1 -0
- package/esm/locales/it_IT.js +1 -1
- package/esm/locales/ja_JP.js +1 -1
- package/esm/locales/kk_KZ.js +1 -0
- package/esm/locales/ko_KR.js +1 -1
- package/esm/locales/ne_NP.js +1 -1
- package/esm/locales/nl_NL.js +1 -0
- package/esm/locales/pt_BR.js +1 -0
- package/esm/locales/ru_RU.js +1 -0
- package/esm/locales/sv_SE.js +1 -1
- package/esm/locales/tr_TR.js +1 -0
- package/esm/locales/zh_CN.js +1 -0
- package/esm/locales/zh_TW.js +1 -0
- package/esm/toaster/ToastContainer.js +29 -42
- package/esm/toaster/ToastContext.js +1 -0
- package/esm/toaster/index.js +1 -0
- package/esm/toaster/toaster.js +4 -22
- package/esm/toaster/useToaster.js +3 -5
- package/esm/utils/BrowserDetection.js +9 -9
- package/esm/utils/ReactChildren.js +2 -8
- package/esm/utils/ajaxUpload.js +15 -32
- package/esm/utils/appendTooltip.js +3 -3
- package/esm/utils/attachParent.js +1 -0
- package/esm/utils/clone.js +1 -1
- package/esm/utils/composeFunctions.js +1 -1
- package/esm/utils/constants.js +4 -7
- package/esm/utils/createChainedFunction.js +2 -5
- package/esm/utils/createComponent.js +12 -16
- package/esm/utils/dateUtils.js +7 -23
- package/esm/utils/deprecateComponent.js +2 -2
- package/esm/utils/deprecatePropType.js +4 -6
- package/esm/utils/dom.js +3 -1
- package/esm/utils/events.js +2 -1
- package/esm/utils/getDOMNode.js +15 -8
- package/esm/utils/getDataGroupBy.d.ts +0 -23
- package/esm/utils/getDataGroupBy.js +5 -39
- package/esm/utils/getSafeRegExpString.js +1 -0
- package/esm/utils/guid.js +1 -0
- package/esm/utils/htmlPropsUtils.js +23 -14
- package/esm/utils/index.js +2 -1
- package/esm/utils/isOneOf.js +1 -1
- package/esm/utils/mergeRefs.js +1 -1
- package/esm/utils/placementPolyfill.js +2 -4
- package/esm/utils/prefix.js +4 -4
- package/esm/utils/previewFile.js +1 -3
- package/esm/utils/propTypeChecker.js +1 -3
- package/esm/utils/reactToString.js +1 -2
- package/esm/utils/render.js +3 -5
- package/esm/utils/scrollTopAnimation.js +1 -5
- package/esm/utils/shallowEqual.js +8 -13
- package/esm/utils/shallowEqualArray.js +1 -5
- package/esm/utils/statusIcons.js +1 -0
- package/esm/utils/stringToObject.js +3 -4
- package/esm/utils/tplTransform.js +2 -4
- package/esm/utils/treeUtils.d.ts +1 -1
- package/esm/utils/treeUtils.js +120 -272
- package/esm/utils/useClassNames.js +9 -9
- package/esm/utils/useClickOutside.js +4 -6
- package/esm/utils/useControlled.js +12 -6
- package/esm/utils/useCustom.js +12 -20
- package/esm/utils/useElementResize.js +2 -4
- package/esm/utils/useEnsuredRef.js +2 -3
- package/esm/utils/useEventCallback.js +2 -3
- package/esm/utils/useEventListener.js +2 -2
- package/esm/utils/useFocus.js +5 -4
- package/esm/utils/useInternalId.js +2 -3
- package/esm/utils/useIsMounted.js +1 -2
- package/esm/utils/useMap.js +5 -5
- package/esm/utils/useMount.js +1 -3
- package/esm/utils/usePortal.js +7 -13
- package/esm/utils/useRootClose.js +9 -13
- package/esm/utils/useTimeout.js +3 -7
- package/esm/utils/useToggleCaret.js +2 -7
- package/esm/utils/useUniqueId.js +2 -4
- package/esm/utils/useUpdateEffect.js +3 -4
- package/esm/utils/useUpdatedRef.js +2 -1
- package/esm/utils/useWillUnmount.js +4 -2
- package/esm/utils/warnOnce.js +2 -2
- package/package.json +2 -2
- package/styles/color-modes/light.less +4 -4
- package/styles/mixins/listbox.less +0 -2
- package/cjs/SelectPicker/Listbox.d.ts +0 -34
- package/cjs/SelectPicker/Listbox.js +0 -263
- package/cjs/SelectPicker/ListboxOption.d.ts +0 -11
- package/cjs/SelectPicker/ListboxOption.js +0 -50
- package/cjs/SelectPicker/ListboxOptionGroup.d.ts +0 -9
- package/cjs/SelectPicker/ListboxOptionGroup.js +0 -69
- package/esm/SelectPicker/Listbox.d.ts +0 -34
- package/esm/SelectPicker/Listbox.js +0 -240
- package/esm/SelectPicker/ListboxOption.d.ts +0 -11
- package/esm/SelectPicker/ListboxOption.js +0 -37
- package/esm/SelectPicker/ListboxOptionGroup.d.ts +0 -9
- package/esm/SelectPicker/ListboxOptionGroup.js +0 -53
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
-
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
6
|
-
|
|
7
6
|
import React, { useState, useRef, useEffect, useCallback, useContext } from 'react';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
8
|
import isUndefined from 'lodash/isUndefined';
|
|
@@ -30,115 +29,104 @@ export var InputPickerContext = /*#__PURE__*/React.createContext({
|
|
|
30
29
|
});
|
|
31
30
|
var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
32
31
|
var _merge;
|
|
33
|
-
|
|
34
32
|
var _props$as = props.as,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
33
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
34
|
+
_props$appearance = props.appearance,
|
|
35
|
+
appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
|
|
36
|
+
_props$cleanable = props.cleanable,
|
|
37
|
+
cleanable = _props$cleanable === void 0 ? true : _props$cleanable,
|
|
38
|
+
_props$cacheData = props.cacheData,
|
|
39
|
+
cacheData = _props$cacheData === void 0 ? [] : _props$cacheData,
|
|
40
|
+
_props$classPrefix = props.classPrefix,
|
|
41
|
+
classPrefix = _props$classPrefix === void 0 ? 'picker' : _props$classPrefix,
|
|
42
|
+
_props$data = props.data,
|
|
43
|
+
controlledData = _props$data === void 0 ? [] : _props$data,
|
|
44
|
+
disabled = props.disabled,
|
|
45
|
+
readOnly = props.readOnly,
|
|
46
|
+
plaintext = props.plaintext,
|
|
47
|
+
defaultValue = props.defaultValue,
|
|
48
|
+
_props$defaultOpen = props.defaultOpen,
|
|
49
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
50
|
+
_props$disabledItemVa = props.disabledItemValues,
|
|
51
|
+
disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
|
|
52
|
+
overrideLocale = props.locale,
|
|
53
|
+
toggleAs = props.toggleAs,
|
|
54
|
+
style = props.style,
|
|
55
|
+
_props$searchable = props.searchable,
|
|
56
|
+
searchable = _props$searchable === void 0 ? true : _props$searchable,
|
|
57
|
+
controlledOpen = props.open,
|
|
58
|
+
placeholder = props.placeholder,
|
|
59
|
+
groupBy = props.groupBy,
|
|
60
|
+
menuClassName = props.menuClassName,
|
|
61
|
+
menuStyle = props.menuStyle,
|
|
62
|
+
_props$menuAutoWidth = props.menuAutoWidth,
|
|
63
|
+
menuAutoWidth = _props$menuAutoWidth === void 0 ? true : _props$menuAutoWidth,
|
|
64
|
+
_props$menuMaxHeight = props.menuMaxHeight,
|
|
65
|
+
menuMaxHeight = _props$menuMaxHeight === void 0 ? 320 : _props$menuMaxHeight,
|
|
66
|
+
creatable = props.creatable,
|
|
67
|
+
shouldDisplayCreateOption = props.shouldDisplayCreateOption,
|
|
68
|
+
valueProp = props.value,
|
|
69
|
+
_props$valueKey = props.valueKey,
|
|
70
|
+
valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
|
|
71
|
+
virtualized = props.virtualized,
|
|
72
|
+
_props$labelKey = props.labelKey,
|
|
73
|
+
labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,
|
|
74
|
+
listProps = props.listProps,
|
|
75
|
+
id = props.id,
|
|
76
|
+
tabIndex = props.tabIndex,
|
|
77
|
+
sort = props.sort,
|
|
78
|
+
renderMenu = props.renderMenu,
|
|
79
|
+
renderExtraFooter = props.renderExtraFooter,
|
|
80
|
+
renderValue = props.renderValue,
|
|
81
|
+
renderMenuItem = props.renderMenuItem,
|
|
82
|
+
renderMenuGroup = props.renderMenuGroup,
|
|
83
|
+
onEnter = props.onEnter,
|
|
84
|
+
onEntered = props.onEntered,
|
|
85
|
+
onExit = props.onExit,
|
|
86
|
+
onExited = props.onExited,
|
|
87
|
+
onChange = props.onChange,
|
|
88
|
+
onClean = props.onClean,
|
|
89
|
+
onCreate = props.onCreate,
|
|
90
|
+
onSearch = props.onSearch,
|
|
91
|
+
onSelect = props.onSelect,
|
|
92
|
+
onOpen = props.onOpen,
|
|
93
|
+
onClose = props.onClose,
|
|
94
|
+
onBlur = props.onBlur,
|
|
95
|
+
onFocus = props.onFocus,
|
|
96
|
+
searchBy = props.searchBy,
|
|
97
|
+
_props$placement = props.placement,
|
|
98
|
+
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
99
|
+
rest = _objectWithoutPropertiesLoose(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"]);
|
|
103
100
|
var _useContext = useContext(InputPickerContext),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
multi = _useContext.multi,
|
|
102
|
+
tagProps = _useContext.tagProps,
|
|
103
|
+
trigger = _useContext.trigger,
|
|
104
|
+
disabledOptions = _useContext.disabledOptions;
|
|
109
105
|
if (groupBy === valueKey || groupBy === labelKey) {
|
|
110
106
|
throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');
|
|
111
107
|
}
|
|
112
|
-
|
|
113
108
|
var overlayRef = useRef(null);
|
|
114
109
|
var targetRef = useRef(null);
|
|
115
110
|
var triggerRef = useRef(null);
|
|
116
111
|
var inputRef = useRef();
|
|
117
112
|
var listRef = useRef(null);
|
|
118
|
-
|
|
119
113
|
var _useCustom = useCustom(['Picker', 'InputPicker'], overrideLocale),
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
locale = _useCustom.locale;
|
|
122
115
|
var _useClassNames = useClassNames(classPrefix),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
prefix = _useClassNames.prefix,
|
|
117
|
+
merge = _useClassNames.merge;
|
|
126
118
|
var _useState = useState(controlledData),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
119
|
+
uncontrolledData = _useState[0],
|
|
120
|
+
setData = _useState[1];
|
|
130
121
|
var _useState2 = useState(100),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
maxWidth = _useState2[0],
|
|
123
|
+
setMaxWidth = _useState2[1];
|
|
134
124
|
var _useState3 = useState([]),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
newData = _useState3[0],
|
|
126
|
+
setNewData = _useState3[1];
|
|
138
127
|
var _useState4 = useState(defaultOpen),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
uncontrolledOpen = _useState4[0],
|
|
129
|
+
setOpen = _useState4[1];
|
|
142
130
|
var open = isUndefined(controlledOpen) ? uncontrolledOpen : controlledOpen;
|
|
143
131
|
var getAllData = useCallback(function () {
|
|
144
132
|
return [].concat(uncontrolledData, newData);
|
|
@@ -146,55 +134,49 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
134
|
var getAllDataAndCache = useCallback(function () {
|
|
147
135
|
return [].concat(getAllData(), cacheData);
|
|
148
136
|
}, [getAllData, cacheData]);
|
|
149
|
-
|
|
150
137
|
var _useControlled = useControlled(valueProp, multi ? defaultValue || [] : defaultValue),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
138
|
+
value = _useControlled[0],
|
|
139
|
+
setValue = _useControlled[1],
|
|
140
|
+
isControlled = _useControlled[2];
|
|
155
141
|
var cloneValue = useCallback(function () {
|
|
156
142
|
return multi ? clone(value) || [] : value;
|
|
157
143
|
}, [multi, value]);
|
|
158
144
|
var handleClose = useCallback(function () {
|
|
159
145
|
var _triggerRef$current;
|
|
160
|
-
|
|
161
146
|
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.close();
|
|
162
|
-
}, [triggerRef]);
|
|
147
|
+
}, [triggerRef]);
|
|
163
148
|
|
|
149
|
+
// Used to hover the focuse item when trigger `onKeydown`
|
|
164
150
|
var _useFocusItemValue = useFocusItemValue(multi ? value === null || value === void 0 ? void 0 : value[0] : value, {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
151
|
+
data: getAllDataAndCache(),
|
|
152
|
+
valueKey: valueKey,
|
|
153
|
+
target: function target() {
|
|
154
|
+
return overlayRef.current;
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
focusItemValue = _useFocusItemValue.focusItemValue,
|
|
158
|
+
setFocusItemValue = _useFocusItemValue.setFocusItemValue,
|
|
159
|
+
onKeyDown = _useFocusItemValue.onKeyDown;
|
|
175
160
|
var handleSearchCallback = useCallback(function (searchKeyword, filteredData, event) {
|
|
176
161
|
var _filteredData$;
|
|
177
|
-
|
|
178
162
|
// The first option after filtering is the focus.
|
|
179
163
|
setFocusItemValue(disabledOptions ? searchKeyword : (filteredData === null || filteredData === void 0 ? void 0 : (_filteredData$ = filteredData[0]) === null || _filteredData$ === void 0 ? void 0 : _filteredData$[valueKey]) || searchKeyword);
|
|
180
164
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchKeyword, event);
|
|
181
|
-
}, [disabledOptions, setFocusItemValue, valueKey, onSearch]);
|
|
165
|
+
}, [disabledOptions, setFocusItemValue, valueKey, onSearch]);
|
|
182
166
|
|
|
167
|
+
// Use search keywords to filter options.
|
|
183
168
|
var _useSearch = useSearch(getAllData(), {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
169
|
+
labelKey: labelKey,
|
|
170
|
+
searchBy: searchBy,
|
|
171
|
+
callback: handleSearchCallback
|
|
172
|
+
}),
|
|
173
|
+
searchKeyword = _useSearch.searchKeyword,
|
|
174
|
+
resetSearch = _useSearch.resetSearch,
|
|
175
|
+
checkShouldDisplay = _useSearch.checkShouldDisplay,
|
|
176
|
+
handleSearch = _useSearch.handleSearch; // Update the state when the data in props changes
|
|
194
177
|
useEffect(function () {
|
|
195
178
|
if (controlledData && !shallowEqual(controlledData, uncontrolledData)) {
|
|
196
179
|
var _controlledData$;
|
|
197
|
-
|
|
198
180
|
setData(controlledData);
|
|
199
181
|
setNewData([]);
|
|
200
182
|
setFocusItemValue(controlledData === null || controlledData === void 0 ? void 0 : (_controlledData$ = controlledData[0]) === null || _controlledData$ === void 0 ? void 0 : _controlledData$[valueKey]);
|
|
@@ -202,19 +184,17 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
202
184
|
}, [setFocusItemValue, controlledData, uncontrolledData, valueKey]);
|
|
203
185
|
useEffect(function () {
|
|
204
186
|
var _triggerRef$current2;
|
|
205
|
-
|
|
206
187
|
// In multiple selection, you need to set a maximum width for the input.
|
|
207
188
|
if ((_triggerRef$current2 = triggerRef.current) !== null && _triggerRef$current2 !== void 0 && _triggerRef$current2.root) {
|
|
208
189
|
setMaxWidth(getWidth(triggerRef.current.root));
|
|
209
190
|
}
|
|
210
|
-
}, []);
|
|
191
|
+
}, []);
|
|
211
192
|
|
|
193
|
+
// Update the position of the menu when the search keyword and value change
|
|
212
194
|
useEffect(function () {
|
|
213
195
|
var _triggerRef$current3, _triggerRef$current3$;
|
|
214
|
-
|
|
215
196
|
(_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);
|
|
216
197
|
}, [searchKeyword, value]);
|
|
217
|
-
|
|
218
198
|
var getDateItem = function getDateItem(value) {
|
|
219
199
|
// Find active `MenuItem` by `value`
|
|
220
200
|
var allData = getAllDataAndCache();
|
|
@@ -222,48 +202,39 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
222
202
|
return shallowEqual(item[valueKey], value);
|
|
223
203
|
});
|
|
224
204
|
var itemNode = placeholder;
|
|
225
|
-
|
|
226
205
|
if (activeItem !== null && activeItem !== void 0 && activeItem[labelKey]) {
|
|
227
206
|
itemNode = activeItem === null || activeItem === void 0 ? void 0 : activeItem[labelKey];
|
|
228
207
|
}
|
|
229
|
-
|
|
230
208
|
return {
|
|
231
209
|
isValid: !!activeItem,
|
|
232
210
|
activeItem: activeItem,
|
|
233
211
|
itemNode: itemNode
|
|
234
212
|
};
|
|
235
213
|
};
|
|
236
|
-
|
|
237
214
|
var getInput = useCallback(function () {
|
|
238
215
|
var _inputRef$current;
|
|
239
|
-
|
|
240
216
|
return multi ? (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.input : inputRef.current;
|
|
241
217
|
}, [inputRef, multi]);
|
|
242
218
|
var focusInput = useCallback(function () {
|
|
243
219
|
var _getInput;
|
|
244
|
-
|
|
245
220
|
return (_getInput = getInput()) === null || _getInput === void 0 ? void 0 : _getInput.focus();
|
|
246
221
|
}, [getInput]);
|
|
247
222
|
var blurInput = useCallback(function () {
|
|
248
223
|
var _getInput2;
|
|
249
|
-
|
|
250
224
|
return (_getInput2 = getInput()) === null || _getInput2 === void 0 ? void 0 : _getInput2.blur();
|
|
251
225
|
}, [getInput]);
|
|
226
|
+
|
|
252
227
|
/**
|
|
253
228
|
* Convert the string of the newly created option into an object.
|
|
254
229
|
*/
|
|
255
|
-
|
|
256
230
|
var createOption = useCallback(function (value) {
|
|
257
231
|
var _ref2;
|
|
258
|
-
|
|
259
232
|
if (groupBy) {
|
|
260
233
|
var _ref;
|
|
261
|
-
|
|
262
234
|
return _ref = {
|
|
263
235
|
create: true
|
|
264
236
|
}, _ref[groupBy] = locale === null || locale === void 0 ? void 0 : locale.newItem, _ref[valueKey] = value, _ref[labelKey] = value, _ref;
|
|
265
237
|
}
|
|
266
|
-
|
|
267
238
|
return _ref2 = {
|
|
268
239
|
create: true
|
|
269
240
|
}, _ref2[valueKey] = value, _ref2[labelKey] = value, _ref2;
|
|
@@ -282,20 +253,19 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
282
253
|
}, [setValue, cloneValue, handleChange]);
|
|
283
254
|
var handleSelect = useCallback(function (value, item, event) {
|
|
284
255
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(value, item, event);
|
|
285
|
-
|
|
286
256
|
if (creatable && item.create) {
|
|
287
257
|
delete item.create;
|
|
288
258
|
onCreate === null || onCreate === void 0 ? void 0 : onCreate(value, item, event);
|
|
289
259
|
setNewData(newData.concat(item));
|
|
290
260
|
}
|
|
291
261
|
}, [creatable, newData, onSelect, onCreate]);
|
|
262
|
+
|
|
292
263
|
/**
|
|
293
264
|
* Callback triggered by single selection
|
|
294
265
|
* @param value
|
|
295
266
|
* @param item
|
|
296
267
|
* @param event
|
|
297
268
|
*/
|
|
298
|
-
|
|
299
269
|
var handleSelectItem = function handleSelectItem(value, item, event) {
|
|
300
270
|
setValue(value);
|
|
301
271
|
setFocusItemValue(value);
|
|
@@ -304,6 +274,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
304
274
|
handleChange(value, event);
|
|
305
275
|
handleClose();
|
|
306
276
|
};
|
|
277
|
+
|
|
307
278
|
/**
|
|
308
279
|
* Callback triggered by multiple selection
|
|
309
280
|
* @param nextItemValue
|
|
@@ -311,11 +282,8 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
311
282
|
* @param event
|
|
312
283
|
* @param checked
|
|
313
284
|
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
285
|
var handleCheckTag = function handleCheckTag(nextItemValue, item, event, checked) {
|
|
317
286
|
var val = cloneValue();
|
|
318
|
-
|
|
319
287
|
if (checked) {
|
|
320
288
|
val.push(nextItemValue);
|
|
321
289
|
} else {
|
|
@@ -323,7 +291,6 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
323
291
|
return shallowEqual(itemVal, nextItemValue);
|
|
324
292
|
});
|
|
325
293
|
}
|
|
326
|
-
|
|
327
294
|
setValue(val);
|
|
328
295
|
resetSearch();
|
|
329
296
|
setFocusItemValue(nextItemValue);
|
|
@@ -331,27 +298,23 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
331
298
|
handleChange(val, event);
|
|
332
299
|
focusInput();
|
|
333
300
|
};
|
|
334
|
-
|
|
335
301
|
var handleTagKeyPress = useCallback(function (event) {
|
|
336
302
|
// When composing, ignore the keypress event.
|
|
337
303
|
if (event.nativeEvent.isComposing) {
|
|
338
304
|
return;
|
|
339
305
|
}
|
|
340
|
-
|
|
341
306
|
var val = cloneValue();
|
|
342
307
|
var data = getAllData();
|
|
343
|
-
|
|
344
308
|
if (!focusItemValue || !data) {
|
|
345
309
|
return;
|
|
346
|
-
}
|
|
347
|
-
|
|
310
|
+
}
|
|
348
311
|
|
|
312
|
+
// If the value is disabled in this option, it is returned.
|
|
349
313
|
if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {
|
|
350
314
|
return item === focusItemValue;
|
|
351
315
|
})) {
|
|
352
316
|
return;
|
|
353
317
|
}
|
|
354
|
-
|
|
355
318
|
if (!val.some(function (v) {
|
|
356
319
|
return shallowEqual(v, focusItemValue);
|
|
357
320
|
})) {
|
|
@@ -361,15 +324,12 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
361
324
|
return shallowEqual(itemVal, focusItemValue);
|
|
362
325
|
});
|
|
363
326
|
}
|
|
364
|
-
|
|
365
327
|
var focusItem = data.find(function (item) {
|
|
366
328
|
return shallowEqual(item === null || item === void 0 ? void 0 : item[valueKey], focusItemValue);
|
|
367
329
|
});
|
|
368
|
-
|
|
369
330
|
if (!focusItem) {
|
|
370
331
|
focusItem = createOption(focusItemValue);
|
|
371
332
|
}
|
|
372
|
-
|
|
373
333
|
setValue(val);
|
|
374
334
|
resetSearch();
|
|
375
335
|
handleSelect(val, focusItem, event);
|
|
@@ -378,32 +338,30 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
378
338
|
var handleMenuItemKeyPress = useCallback(function (event) {
|
|
379
339
|
if (!focusItemValue || !controlledData) {
|
|
380
340
|
return;
|
|
381
|
-
}
|
|
382
|
-
|
|
341
|
+
}
|
|
383
342
|
|
|
343
|
+
// If the value is disabled in this option, it is returned.
|
|
384
344
|
if (disabledItemValues !== null && disabledItemValues !== void 0 && disabledItemValues.some(function (item) {
|
|
385
345
|
return item === focusItemValue;
|
|
386
346
|
})) {
|
|
387
347
|
return;
|
|
388
|
-
}
|
|
389
|
-
|
|
348
|
+
}
|
|
390
349
|
|
|
350
|
+
// Find active `MenuItem` by `value`
|
|
391
351
|
var allData = getAllData();
|
|
392
352
|
var focusItem = allData.find(function (item) {
|
|
393
353
|
return shallowEqual(item[valueKey], focusItemValue);
|
|
394
|
-
});
|
|
354
|
+
});
|
|
395
355
|
|
|
356
|
+
// FIXME Bad state flow
|
|
396
357
|
if (!focusItem && focusItemValue === searchKeyword) {
|
|
397
358
|
focusItem = createOption(searchKeyword);
|
|
398
359
|
}
|
|
399
|
-
|
|
400
360
|
setValue(focusItemValue);
|
|
401
361
|
resetSearch();
|
|
402
|
-
|
|
403
362
|
if (focusItem) {
|
|
404
363
|
handleSelect(focusItemValue, focusItem, event);
|
|
405
364
|
}
|
|
406
|
-
|
|
407
365
|
handleChange(focusItemValue, event);
|
|
408
366
|
handleClose();
|
|
409
367
|
}, [setValue, disabledItemValues, controlledData, focusItemValue, valueKey, searchKeyword, handleClose, resetSearch, createOption, getAllData, handleChange, handleSelect]);
|
|
@@ -413,23 +371,20 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
413
371
|
targetRef: targetRef,
|
|
414
372
|
listRef: listRef
|
|
415
373
|
});
|
|
374
|
+
|
|
416
375
|
/**
|
|
417
376
|
* Remove the last item, after pressing the back key on the keyboard.
|
|
418
377
|
* @param event
|
|
419
378
|
*/
|
|
420
|
-
|
|
421
379
|
var removeLastItem = useCallback(function (event) {
|
|
422
380
|
var target = event === null || event === void 0 ? void 0 : event.target;
|
|
423
|
-
|
|
424
381
|
if ((target === null || target === void 0 ? void 0 : target.tagName) !== 'INPUT') {
|
|
425
382
|
focusInput();
|
|
426
383
|
return;
|
|
427
384
|
}
|
|
428
|
-
|
|
429
385
|
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' && target !== null && target !== void 0 && target.value) {
|
|
430
386
|
return;
|
|
431
387
|
}
|
|
432
|
-
|
|
433
388
|
var val = cloneValue();
|
|
434
389
|
val.pop();
|
|
435
390
|
setValue(val);
|
|
@@ -439,17 +394,14 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
439
394
|
if (disabled || searchKeyword !== '') {
|
|
440
395
|
return;
|
|
441
396
|
}
|
|
442
|
-
|
|
443
397
|
setValue(null);
|
|
444
398
|
setFocusItemValue(null);
|
|
445
399
|
resetSearch();
|
|
446
|
-
|
|
447
400
|
if (multi) {
|
|
448
401
|
handleChange([], event);
|
|
449
402
|
} else {
|
|
450
403
|
handleChange(null, event);
|
|
451
404
|
}
|
|
452
|
-
|
|
453
405
|
onClean === null || onClean === void 0 ? void 0 : onClean(event);
|
|
454
406
|
}, [disabled, searchKeyword, setValue, setFocusItemValue, resetSearch, multi, onClean, handleChange]);
|
|
455
407
|
var events = {
|
|
@@ -463,27 +415,24 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
463
415
|
if (isOneOf('Space', trigger) && event.key === KEY_VALUES.SPACE) {
|
|
464
416
|
handleTagKeyPress(event);
|
|
465
417
|
event.preventDefault();
|
|
466
|
-
}
|
|
467
|
-
|
|
418
|
+
}
|
|
468
419
|
|
|
420
|
+
// When typing a comma, create a tag.
|
|
469
421
|
if (isOneOf('Comma', trigger) && event.key === KEY_VALUES.COMMA) {
|
|
470
422
|
handleTagKeyPress(event);
|
|
471
423
|
event.preventDefault();
|
|
472
424
|
}
|
|
473
425
|
}, [handleTagKeyPress, trigger]);
|
|
474
|
-
|
|
475
426
|
if (multi) {
|
|
476
427
|
if (isOneOf('Enter', trigger)) {
|
|
477
428
|
events.onMenuPressEnter = handleTagKeyPress;
|
|
478
429
|
}
|
|
479
|
-
|
|
480
430
|
if (creatable) {
|
|
481
431
|
events.onKeyDown = handleKeyPress;
|
|
482
432
|
}
|
|
483
433
|
} else {
|
|
484
434
|
events.onMenuPressEnter = handleMenuItemKeyPress;
|
|
485
435
|
}
|
|
486
|
-
|
|
487
436
|
var onPickerKeyDown = useToggleKeyDownEvent(_extends({
|
|
488
437
|
triggerRef: triggerRef,
|
|
489
438
|
targetRef: targetRef,
|
|
@@ -497,7 +446,6 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
497
446
|
var handleFocus = useCallback(function () {
|
|
498
447
|
if (!readOnly) {
|
|
499
448
|
var _triggerRef$current4;
|
|
500
|
-
|
|
501
449
|
setOpen(true);
|
|
502
450
|
(_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.open();
|
|
503
451
|
}
|
|
@@ -510,13 +458,11 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
510
458
|
blurInput();
|
|
511
459
|
setOpen(false);
|
|
512
460
|
}, [blurInput]);
|
|
513
|
-
|
|
514
461
|
var renderDropdownMenuItem = function renderDropdownMenuItem(label, item) {
|
|
515
462
|
// 'Create option "{0}"' => Create option "xxxxx"
|
|
516
463
|
var newLabel = item.create ? /*#__PURE__*/React.createElement("span", null, tplTransform(locale.createOption, label)) : label;
|
|
517
464
|
return renderMenuItem ? renderMenuItem(newLabel, item) : newLabel;
|
|
518
465
|
};
|
|
519
|
-
|
|
520
466
|
var checkValue = function checkValue() {
|
|
521
467
|
if (multi) {
|
|
522
468
|
return {
|
|
@@ -524,44 +470,35 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
524
470
|
itemNode: null
|
|
525
471
|
};
|
|
526
472
|
}
|
|
527
|
-
|
|
528
473
|
var dataItem = getDateItem(value);
|
|
529
474
|
var itemNode = dataItem.itemNode;
|
|
530
|
-
|
|
531
475
|
if (!isNil(value) && isFunction(renderValue)) {
|
|
532
476
|
itemNode = renderValue(value, dataItem.activeItem, itemNode);
|
|
533
477
|
}
|
|
534
|
-
|
|
535
478
|
return {
|
|
536
479
|
isValid: dataItem.isValid,
|
|
537
480
|
itemNode: itemNode
|
|
538
481
|
};
|
|
539
482
|
};
|
|
540
|
-
|
|
541
483
|
var renderMultiValue = function renderMultiValue() {
|
|
542
484
|
if (!multi) {
|
|
543
485
|
return null;
|
|
544
486
|
}
|
|
545
|
-
|
|
546
487
|
var _tagProps$closable = tagProps.closable,
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
488
|
+
closable = _tagProps$closable === void 0 ? true : _tagProps$closable,
|
|
489
|
+
onClose = tagProps.onClose,
|
|
490
|
+
tagRest = _objectWithoutPropertiesLoose(tagProps, ["closable", "onClose"]);
|
|
551
491
|
var tags = value || [];
|
|
552
492
|
var items = [];
|
|
553
493
|
var tagElements = tags.map(function (tag) {
|
|
554
494
|
var _getDateItem = getDateItem(tag),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
495
|
+
isValid = _getDateItem.isValid,
|
|
496
|
+
itemNode = _getDateItem.itemNode,
|
|
497
|
+
activeItem = _getDateItem.activeItem;
|
|
559
498
|
items.push(activeItem);
|
|
560
|
-
|
|
561
499
|
if (!isValid) {
|
|
562
500
|
return null;
|
|
563
501
|
}
|
|
564
|
-
|
|
565
502
|
return /*#__PURE__*/React.createElement(Tag, _extends({}, tagRest, {
|
|
566
503
|
key: tag,
|
|
567
504
|
size: rest.size === 'lg' ? 'lg' : rest.size === 'xs' ? 'sm' : 'md',
|
|
@@ -572,47 +509,39 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
572
509
|
}).filter(function (item) {
|
|
573
510
|
return item !== null;
|
|
574
511
|
});
|
|
575
|
-
|
|
576
512
|
if ((tags.length > 0 || isControlled) && isFunction(renderValue)) {
|
|
577
513
|
return renderValue(value, items, tagElements);
|
|
578
514
|
}
|
|
579
|
-
|
|
580
515
|
return tagElements;
|
|
581
516
|
};
|
|
582
|
-
|
|
583
517
|
var renderDropdownMenu = function renderDropdownMenu(positionProps, speakerRef) {
|
|
584
518
|
var left = positionProps.left,
|
|
585
|
-
|
|
586
|
-
|
|
519
|
+
top = positionProps.top,
|
|
520
|
+
className = positionProps.className;
|
|
587
521
|
var menuClassPrefix = multi ? 'picker-check-menu' : 'picker-select-menu';
|
|
588
522
|
var classes = merge(className, menuClassName, prefix(multi ? 'check-menu' : 'select-menu'));
|
|
589
|
-
|
|
590
523
|
var styles = _extends({}, menuStyle, {
|
|
591
524
|
left: left,
|
|
592
525
|
top: top
|
|
593
526
|
});
|
|
594
|
-
|
|
595
527
|
var items = filterNodesOfTree(getAllData(), checkShouldDisplay);
|
|
596
|
-
|
|
597
528
|
if (creatable && (typeof shouldDisplayCreateOption === 'function' ? shouldDisplayCreateOption(searchKeyword, items) : searchKeyword && !items.find(function (item) {
|
|
598
529
|
return item[valueKey] === searchKeyword;
|
|
599
530
|
}))) {
|
|
600
531
|
items = [].concat(items, [createOption(searchKeyword)]);
|
|
601
|
-
}
|
|
602
|
-
|
|
532
|
+
}
|
|
603
533
|
|
|
534
|
+
// Create a tree structure data when set `groupBy`
|
|
604
535
|
if (groupBy) {
|
|
605
536
|
items = getDataGroupBy(items, groupBy, sort);
|
|
606
537
|
} else if (typeof sort === 'function') {
|
|
607
538
|
items = items.sort(sort(false));
|
|
608
539
|
}
|
|
609
|
-
|
|
610
540
|
if (disabledOptions) {
|
|
611
541
|
return /*#__PURE__*/React.createElement(PickerOverlay, {
|
|
612
542
|
ref: mergeRefs(overlayRef, speakerRef)
|
|
613
543
|
});
|
|
614
544
|
}
|
|
615
|
-
|
|
616
545
|
var menu = items.length ? /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
617
546
|
id: id ? id + "-listbox" : undefined,
|
|
618
547
|
listProps: listProps,
|
|
@@ -626,7 +555,8 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
626
555
|
activeItemValues: multi ? value : [value],
|
|
627
556
|
focusItemValue: focusItemValue,
|
|
628
557
|
maxHeight: menuMaxHeight,
|
|
629
|
-
data: items
|
|
558
|
+
data: items
|
|
559
|
+
// FIXME-Doma
|
|
630
560
|
// `group` is redundant so long as `groupBy` exists
|
|
631
561
|
,
|
|
632
562
|
group: !isUndefined(groupBy),
|
|
@@ -648,32 +578,28 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
648
578
|
onKeyDown: onPickerKeyDown
|
|
649
579
|
}, renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());
|
|
650
580
|
};
|
|
651
|
-
|
|
652
581
|
var _checkValue = checkValue(),
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
582
|
+
isValid = _checkValue.isValid,
|
|
583
|
+
itemNode = _checkValue.itemNode;
|
|
656
584
|
var tagElements = renderMultiValue();
|
|
585
|
+
|
|
657
586
|
/**
|
|
658
587
|
* 1.Have a value and the value is valid.
|
|
659
588
|
* 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value.
|
|
660
589
|
* 3.If renderValue returns null or undefined, hasValue is false.
|
|
661
590
|
*/
|
|
662
|
-
|
|
663
591
|
var hasSingleValue = !isNil(value) && isFunction(renderValue) && !isNil(itemNode);
|
|
664
592
|
var hasMultiValue = isArray(value) && value.length > 0 && isFunction(renderValue) && !isNil(tagElements);
|
|
665
593
|
var hasValue = multi ? !!(tagElements !== null && tagElements !== void 0 && tagElements.length) || hasMultiValue : isValid || hasSingleValue;
|
|
666
|
-
|
|
667
594
|
var _usePickerClassName = usePickerClassName(_extends({}, props, {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
595
|
+
classPrefix: classPrefix,
|
|
596
|
+
appearance: appearance,
|
|
597
|
+
hasValue: hasValue,
|
|
598
|
+
name: 'input',
|
|
599
|
+
cleanable: cleanable
|
|
600
|
+
})),
|
|
601
|
+
pickerClasses = _usePickerClassName[0],
|
|
602
|
+
usedClassNamePropKeys = _usePickerClassName[1];
|
|
677
603
|
var classes = merge(pickerClasses, (_merge = {}, _merge[prefix(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["tag"])))] = multi, _merge[prefix(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["focused"])))] = open, _merge[prefix(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["disabled-options"])))] = disabledOptions, _merge));
|
|
678
604
|
var searching = !!searchKeyword && open;
|
|
679
605
|
var displaySearchInput = searchable && !disabled;
|
|
@@ -685,23 +611,21 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
685
611
|
} : {
|
|
686
612
|
as: 'input'
|
|
687
613
|
};
|
|
688
|
-
|
|
689
614
|
if (plaintext) {
|
|
690
|
-
var plaintextProps = {};
|
|
691
|
-
// for fixing margin-left on tags from 2nd line on
|
|
615
|
+
var plaintextProps = {};
|
|
692
616
|
|
|
617
|
+
// TagPicker has -6px margin-left on the plaintext wrapper
|
|
618
|
+
// for fixing margin-left on tags from 2nd line on
|
|
693
619
|
if (multi && hasValue) {
|
|
694
620
|
plaintextProps.style = {
|
|
695
621
|
marginLeft: -6
|
|
696
622
|
};
|
|
697
623
|
}
|
|
698
|
-
|
|
699
624
|
return /*#__PURE__*/React.createElement(Plaintext, _extends({
|
|
700
625
|
localeKey: "notSelected",
|
|
701
626
|
ref: targetRef
|
|
702
627
|
}, plaintextProps), itemNode || (tagElements !== null && tagElements !== void 0 && tagElements.length ? tagElements : null) || placeholder);
|
|
703
628
|
}
|
|
704
|
-
|
|
705
629
|
var placeholderNode = placeholder || (disabledOptions ? null : locale === null || locale === void 0 ? void 0 : locale.placeholder);
|
|
706
630
|
return /*#__PURE__*/React.createElement(PickerToggleTrigger, {
|
|
707
631
|
pickerProps: pick(props, pickTriggerPropKeys),
|