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
package/esm/Picker/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
3
|
import React, { useState, useImperativeHandle, useCallback, useMemo } from 'react';
|
|
3
4
|
import kebabCase from 'lodash/kebabCase';
|
|
@@ -17,17 +18,15 @@ export function createConcatChildrenFunction(node, nodeValue, nodeKeys) {
|
|
|
17
18
|
if (nodeKeys === void 0) {
|
|
18
19
|
nodeKeys = defaultNodeKeys;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
21
|
var _nodeKeys = nodeKeys,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
valueKey = _nodeKeys.valueKey,
|
|
23
|
+
childrenKey = _nodeKeys.childrenKey;
|
|
24
24
|
return function (data, children) {
|
|
25
25
|
if (nodeValue) {
|
|
26
26
|
node = findNodeOfTree(data, function (item) {
|
|
27
27
|
return nodeValue === item[valueKey];
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
node[childrenKey] = children;
|
|
32
31
|
return data.concat([]);
|
|
33
32
|
};
|
|
@@ -36,49 +35,42 @@ export function shouldDisplay(label, searchKeyword) {
|
|
|
36
35
|
if (!trim(searchKeyword)) {
|
|
37
36
|
return true;
|
|
38
37
|
}
|
|
39
|
-
|
|
40
38
|
var keyword = searchKeyword.toLocaleLowerCase();
|
|
41
|
-
|
|
42
39
|
if (typeof label === 'string' || typeof label === 'number') {
|
|
43
40
|
return ("" + label).toLocaleLowerCase().indexOf(keyword) >= 0;
|
|
44
41
|
} else if ( /*#__PURE__*/React.isValidElement(label)) {
|
|
45
42
|
var nodes = reactToString(label);
|
|
46
43
|
return nodes.join('').toLocaleLowerCase().indexOf(keyword) >= 0;
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
return false;
|
|
50
46
|
}
|
|
51
|
-
|
|
52
47
|
/**
|
|
53
48
|
* The className of the assembled Toggle is on the Picker.
|
|
54
49
|
*/
|
|
55
50
|
export function usePickerClassName(props) {
|
|
56
51
|
var _withClassPrefix;
|
|
57
|
-
|
|
58
52
|
var name = props.name,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
classPrefix = props.classPrefix,
|
|
54
|
+
className = props.className,
|
|
55
|
+
placement = props.placement,
|
|
56
|
+
appearance = props.appearance,
|
|
57
|
+
cleanable = props.cleanable,
|
|
58
|
+
block = props.block,
|
|
59
|
+
disabled = props.disabled,
|
|
60
|
+
countable = props.countable,
|
|
61
|
+
readOnly = props.readOnly,
|
|
62
|
+
plaintext = props.plaintext,
|
|
63
|
+
hasValue = props.hasValue,
|
|
64
|
+
rest = _objectWithoutPropertiesLoose(props, ["name", "classPrefix", "className", "placement", "appearance", "cleanable", "block", "disabled", "countable", "readOnly", "plaintext", "hasValue"]);
|
|
72
65
|
var _useClassNames = useClassNames(classPrefix),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(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
|
|
66
|
+
withClassPrefix = _useClassNames.withClassPrefix,
|
|
67
|
+
merge = _useClassNames.merge;
|
|
68
|
+
var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(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)));
|
|
77
69
|
|
|
70
|
+
// Those props that're used for composing the className
|
|
78
71
|
var usedClassNamePropKeys = Object.keys(omit(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext', 'name'])));
|
|
79
72
|
return [classes, usedClassNamePropKeys];
|
|
80
73
|
}
|
|
81
|
-
|
|
82
74
|
/**
|
|
83
75
|
* Handling keyboard events...
|
|
84
76
|
* @param event Keyboard event object
|
|
@@ -86,13 +78,12 @@ export function usePickerClassName(props) {
|
|
|
86
78
|
*/
|
|
87
79
|
export function onMenuKeyDown(event, events) {
|
|
88
80
|
var down = events.down,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
81
|
+
up = events.up,
|
|
82
|
+
enter = events.enter,
|
|
83
|
+
del = events.del,
|
|
84
|
+
esc = events.esc,
|
|
85
|
+
right = events.right,
|
|
86
|
+
left = events.left;
|
|
96
87
|
switch (event.key) {
|
|
97
88
|
// down
|
|
98
89
|
case KEY_VALUES.DOWN:
|
|
@@ -100,199 +91,168 @@ export function onMenuKeyDown(event, events) {
|
|
|
100
91
|
event.preventDefault();
|
|
101
92
|
break;
|
|
102
93
|
// up
|
|
103
|
-
|
|
104
94
|
case KEY_VALUES.UP:
|
|
105
95
|
up === null || up === void 0 ? void 0 : up(event);
|
|
106
96
|
event.preventDefault();
|
|
107
97
|
break;
|
|
108
98
|
// enter
|
|
109
|
-
|
|
110
99
|
case KEY_VALUES.ENTER:
|
|
111
100
|
enter === null || enter === void 0 ? void 0 : enter(event);
|
|
112
101
|
event.preventDefault();
|
|
113
102
|
break;
|
|
114
103
|
// delete
|
|
115
|
-
|
|
116
104
|
case KEY_VALUES.BACKSPACE:
|
|
117
105
|
del === null || del === void 0 ? void 0 : del(event);
|
|
118
106
|
break;
|
|
119
107
|
// esc | tab
|
|
120
|
-
|
|
121
108
|
case KEY_VALUES.ESC:
|
|
122
109
|
case KEY_VALUES.TAB:
|
|
123
110
|
esc === null || esc === void 0 ? void 0 : esc(event);
|
|
124
111
|
break;
|
|
125
112
|
// left arrow
|
|
126
|
-
|
|
127
113
|
case KEY_VALUES.LEFT:
|
|
128
114
|
left === null || left === void 0 ? void 0 : left(event);
|
|
129
115
|
break;
|
|
130
116
|
// right arrow
|
|
131
|
-
|
|
132
117
|
case KEY_VALUES.RIGHT:
|
|
133
118
|
right === null || right === void 0 ? void 0 : right(event);
|
|
134
119
|
break;
|
|
135
|
-
|
|
136
120
|
default:
|
|
137
121
|
}
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
/**
|
|
141
124
|
* Checks if the element has a vertical scrollbar.
|
|
142
125
|
*/
|
|
143
126
|
function hasVerticalScroll(element) {
|
|
144
127
|
var scrollHeight = element.scrollHeight,
|
|
145
|
-
|
|
128
|
+
clientHeight = element.clientHeight;
|
|
146
129
|
return scrollHeight > clientHeight;
|
|
147
130
|
}
|
|
131
|
+
|
|
148
132
|
/**
|
|
149
133
|
* Checks if the element is within the visible area of the container
|
|
150
134
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
135
|
function isVisible(element, container, direction) {
|
|
154
136
|
if (!hasVerticalScroll(container)) {
|
|
155
137
|
return true;
|
|
156
138
|
}
|
|
157
|
-
|
|
158
139
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
140
|
+
top = _element$getBoundingC.top,
|
|
141
|
+
bottom = _element$getBoundingC.bottom,
|
|
142
|
+
height = _element$getBoundingC.height;
|
|
163
143
|
var _container$getBoundin = container.getBoundingClientRect(),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
144
|
+
containerTop = _container$getBoundin.top,
|
|
145
|
+
containerBottom = _container$getBoundin.bottom;
|
|
167
146
|
if (direction === 'top') {
|
|
168
147
|
return top + height > containerTop;
|
|
169
148
|
}
|
|
170
|
-
|
|
171
149
|
return bottom - height < containerBottom;
|
|
172
150
|
}
|
|
173
|
-
|
|
174
151
|
function scrollTo(container, direction, step) {
|
|
175
152
|
var scrollTop = container.scrollTop;
|
|
176
153
|
container.scrollTop = direction === 'top' ? scrollTop - step : scrollTop + step;
|
|
177
154
|
}
|
|
155
|
+
|
|
178
156
|
/**
|
|
179
157
|
* A hook that manages the focus state of the option.
|
|
180
158
|
* @param defaultFocusItemValue
|
|
181
159
|
* @param props
|
|
182
160
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
161
|
export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props) {
|
|
186
162
|
var _props$valueKey = props.valueKey,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
163
|
+
valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
|
|
164
|
+
_props$focusableQuery = props.focusableQueryKey,
|
|
165
|
+
focusableQueryKey = _props$focusableQuery === void 0 ? '[data-key][aria-disabled="false"]' : _props$focusableQuery,
|
|
166
|
+
_props$defaultLayer = props.defaultLayer,
|
|
167
|
+
defaultLayer = _props$defaultLayer === void 0 ? 0 : _props$defaultLayer,
|
|
168
|
+
data = props.data,
|
|
169
|
+
target = props.target,
|
|
170
|
+
rtl = props.rtl,
|
|
171
|
+
callback = props.callback,
|
|
172
|
+
_props$getParent = props.getParent,
|
|
173
|
+
getParent = _props$getParent === void 0 ? function (item) {
|
|
174
|
+
return item === null || item === void 0 ? void 0 : item.parent;
|
|
175
|
+
} : _props$getParent;
|
|
201
176
|
var _useState = useState(defaultFocusItemValue),
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
177
|
+
focusItemValue = _useState[0],
|
|
178
|
+
setFocusItemValue = _useState[1];
|
|
205
179
|
var _useState2 = useState(defaultLayer),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
180
|
+
layer = _useState2[0],
|
|
181
|
+
setLayer = _useState2[1];
|
|
209
182
|
var _useState3 = useState([]),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
183
|
+
keys = _useState3[0],
|
|
184
|
+
setKeys = _useState3[1];
|
|
213
185
|
var getScrollContainer = useCallback(function () {
|
|
214
|
-
var menu = isFunction(target) ? target() : target;
|
|
186
|
+
var menu = isFunction(target) ? target() : target;
|
|
215
187
|
|
|
188
|
+
// For Cascader and MutiCascader
|
|
216
189
|
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + layer + "\"]");
|
|
217
|
-
|
|
218
190
|
if (subMenu) {
|
|
219
191
|
return subMenu;
|
|
220
|
-
}
|
|
221
|
-
|
|
192
|
+
}
|
|
222
193
|
|
|
194
|
+
// For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker
|
|
223
195
|
return menu === null || menu === void 0 ? void 0 : menu.querySelector('[role="listbox"]');
|
|
224
196
|
}, [layer, target]);
|
|
197
|
+
|
|
225
198
|
/**
|
|
226
199
|
* Get the elements visible in all options.
|
|
227
200
|
*/
|
|
228
|
-
|
|
229
201
|
var getFocusableMenuItems = useCallback(function () {
|
|
230
202
|
if (!target) {
|
|
231
203
|
return [];
|
|
232
204
|
}
|
|
233
|
-
|
|
234
205
|
var currentKeys = keys;
|
|
235
|
-
|
|
236
206
|
if (layer < 1) {
|
|
237
207
|
var popup = isFunction(target) ? target() : target;
|
|
238
208
|
var rootMenu = popup === null || popup === void 0 ? void 0 : popup.querySelector('[data-layer="0"]');
|
|
239
|
-
|
|
240
209
|
if (rootMenu) {
|
|
241
210
|
var _rootMenu$querySelect;
|
|
242
|
-
|
|
243
211
|
currentKeys = Array.from((_rootMenu$querySelect = rootMenu.querySelectorAll(focusableQueryKey)) !== null && _rootMenu$querySelect !== void 0 ? _rootMenu$querySelect : []).map(function (item) {
|
|
244
212
|
var _item$dataset;
|
|
245
|
-
|
|
246
213
|
return (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.key;
|
|
247
214
|
});
|
|
248
215
|
} else {
|
|
249
216
|
var _popup$querySelectorA;
|
|
250
|
-
|
|
251
217
|
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) {
|
|
252
218
|
var _item$dataset2;
|
|
253
|
-
|
|
254
219
|
return (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.key;
|
|
255
220
|
});
|
|
256
221
|
}
|
|
257
|
-
}
|
|
258
|
-
// 2. The values in `keys` are all string, so the corresponding value of `data` should also be converted to string
|
|
259
|
-
|
|
222
|
+
}
|
|
260
223
|
|
|
224
|
+
// 1. It is necessary to traverse the `keys` instead of `data` here to preserve the order of the array.
|
|
225
|
+
// 2. The values in `keys` are all string, so the corresponding value of `data` should also be converted to string
|
|
261
226
|
return currentKeys.map(function (key) {
|
|
262
227
|
return find(data, function (i) {
|
|
263
228
|
return "" + i[valueKey] === key;
|
|
264
229
|
});
|
|
265
230
|
});
|
|
266
231
|
}, [data, focusableQueryKey, keys, target, valueKey, layer]);
|
|
232
|
+
|
|
267
233
|
/**
|
|
268
234
|
* Get the index of the focus item.
|
|
269
235
|
*/
|
|
270
|
-
|
|
271
236
|
var findFocusItemIndex = useCallback(function (callback) {
|
|
272
237
|
var items = getFocusableMenuItems();
|
|
273
|
-
|
|
274
238
|
for (var i = 0; i < items.length; i += 1) {
|
|
275
239
|
var _items$i;
|
|
276
|
-
|
|
277
240
|
if (shallowEqual(focusItemValue, (_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i[valueKey])) {
|
|
278
241
|
callback(items, i);
|
|
279
242
|
return;
|
|
280
243
|
}
|
|
281
244
|
}
|
|
282
|
-
|
|
283
245
|
callback(items, -1);
|
|
284
246
|
}, [focusItemValue, getFocusableMenuItems, valueKey]);
|
|
285
247
|
var scrollListItem = useCallback(function (direction, itemValue, willOverflow) {
|
|
286
248
|
var container = getScrollContainer();
|
|
287
249
|
var item = container === null || container === void 0 ? void 0 : container.querySelector("[data-key=\"" + itemValue + "\"]");
|
|
288
|
-
|
|
289
250
|
if (willOverflow && container) {
|
|
290
251
|
var scrollHeight = container.scrollHeight,
|
|
291
|
-
|
|
252
|
+
clientHeight = container.clientHeight;
|
|
292
253
|
container.scrollTop = direction === 'top' ? scrollHeight - clientHeight : 0;
|
|
293
254
|
return;
|
|
294
255
|
}
|
|
295
|
-
|
|
296
256
|
if (item && container) {
|
|
297
257
|
if (!isVisible(item, container, direction)) {
|
|
298
258
|
var height = getHeight(item);
|
|
@@ -305,7 +265,6 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
305
265
|
var willOverflow = index + 2 > items.length;
|
|
306
266
|
var nextIndex = willOverflow ? 0 : index + 1;
|
|
307
267
|
var focusItem = items[nextIndex];
|
|
308
|
-
|
|
309
268
|
if (!isUndefined(focusItem)) {
|
|
310
269
|
setFocusItemValue(focusItem[valueKey]);
|
|
311
270
|
callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);
|
|
@@ -318,7 +277,6 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
318
277
|
var willOverflow = index === 0;
|
|
319
278
|
var nextIndex = willOverflow ? items.length - 1 : index - 1;
|
|
320
279
|
var focusItem = items[nextIndex];
|
|
321
|
-
|
|
322
280
|
if (!isUndefined(focusItem)) {
|
|
323
281
|
setFocusItemValue(focusItem[valueKey]);
|
|
324
282
|
callback === null || callback === void 0 ? void 0 : callback(focusItem[valueKey], event);
|
|
@@ -329,23 +287,18 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
329
287
|
var getSubMenuKeys = useCallback(function (nextLayer) {
|
|
330
288
|
var menu = isFunction(target) ? target() : target;
|
|
331
289
|
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + nextLayer + "\"]");
|
|
332
|
-
|
|
333
290
|
if (subMenu) {
|
|
334
291
|
var _Array$from;
|
|
335
|
-
|
|
336
292
|
return (_Array$from = Array.from(subMenu.querySelectorAll(focusableQueryKey))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(function (item) {
|
|
337
293
|
var _item$dataset3;
|
|
338
|
-
|
|
339
294
|
return (_item$dataset3 = item.dataset) === null || _item$dataset3 === void 0 ? void 0 : _item$dataset3.key;
|
|
340
295
|
});
|
|
341
296
|
}
|
|
342
|
-
|
|
343
297
|
return null;
|
|
344
298
|
}, [focusableQueryKey, target]);
|
|
345
299
|
var focusNextLevelMenu = useCallback(function (event) {
|
|
346
300
|
var nextLayer = layer + 1;
|
|
347
301
|
var nextKeys = getSubMenuKeys(nextLayer);
|
|
348
|
-
|
|
349
302
|
if (nextKeys) {
|
|
350
303
|
setKeys(nextKeys);
|
|
351
304
|
setLayer(nextLayer);
|
|
@@ -356,17 +309,14 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
356
309
|
var focusPrevLevelMenu = useCallback(function (event) {
|
|
357
310
|
var nextLayer = layer - 1;
|
|
358
311
|
var nextKeys = getSubMenuKeys(nextLayer);
|
|
359
|
-
|
|
360
312
|
if (nextKeys) {
|
|
361
313
|
var _getParent;
|
|
362
|
-
|
|
363
314
|
setKeys(nextKeys);
|
|
364
315
|
setLayer(nextLayer);
|
|
365
316
|
var focusItem = findNodeOfTree(data, function (item) {
|
|
366
317
|
return item[valueKey] === focusItemValue;
|
|
367
318
|
});
|
|
368
319
|
var parentItemValue = (_getParent = getParent(focusItem)) === null || _getParent === void 0 ? void 0 : _getParent[valueKey];
|
|
369
|
-
|
|
370
320
|
if (parentItemValue) {
|
|
371
321
|
setFocusItemValue(parentItemValue);
|
|
372
322
|
callback === null || callback === void 0 ? void 0 : callback(parentItemValue, event);
|
|
@@ -375,7 +325,6 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
375
325
|
}, [callback, data, focusItemValue, getParent, getSubMenuKeys, layer, valueKey]);
|
|
376
326
|
var handleKeyDown = useCallback(function (event) {
|
|
377
327
|
var _onMenuKeyDown;
|
|
378
|
-
|
|
379
328
|
onMenuKeyDown(event, (_onMenuKeyDown = {
|
|
380
329
|
down: focusNextMenuItem,
|
|
381
330
|
up: focusPrevMenuItem
|
|
@@ -391,37 +340,34 @@ export var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue,
|
|
|
391
340
|
onKeyDown: handleKeyDown
|
|
392
341
|
};
|
|
393
342
|
};
|
|
394
|
-
|
|
395
343
|
/**
|
|
396
344
|
* A hook to control the toggle keyboard operation
|
|
397
345
|
* @param props
|
|
398
346
|
*/
|
|
399
347
|
export var useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {
|
|
400
348
|
var _props$toggle = props.toggle,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
349
|
+
toggle = _props$toggle === void 0 ? true : _props$toggle,
|
|
350
|
+
triggerRef = props.triggerRef,
|
|
351
|
+
targetRef = props.targetRef,
|
|
352
|
+
overlayRef = props.overlayRef,
|
|
353
|
+
searchInputRef = props.searchInputRef,
|
|
354
|
+
active = props.active,
|
|
355
|
+
readOnly = props.readOnly,
|
|
356
|
+
disabled = props.disabled,
|
|
357
|
+
onExit = props.onExit,
|
|
358
|
+
onOpen = props.onOpen,
|
|
359
|
+
onClose = props.onClose,
|
|
360
|
+
onKeyDown = props.onKeyDown,
|
|
361
|
+
onMenuKeyDown = props.onMenuKeyDown,
|
|
362
|
+
onMenuPressEnter = props.onMenuPressEnter,
|
|
363
|
+
onMenuPressBackspace = props.onMenuPressBackspace;
|
|
416
364
|
var handleClose = useCallback(function () {
|
|
417
365
|
var _triggerRef$current, _triggerRef$current$c;
|
|
418
|
-
|
|
419
366
|
(_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);
|
|
420
367
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
421
368
|
}, [onClose, triggerRef]);
|
|
422
369
|
var handleOpen = useCallback(function () {
|
|
423
370
|
var _triggerRef$current2, _triggerRef$current2$;
|
|
424
|
-
|
|
425
371
|
(_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);
|
|
426
372
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
427
373
|
}, [onOpen, triggerRef]);
|
|
@@ -430,7 +376,6 @@ export var useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {
|
|
|
430
376
|
handleClose();
|
|
431
377
|
return;
|
|
432
378
|
}
|
|
433
|
-
|
|
434
379
|
handleOpen();
|
|
435
380
|
}, [active, handleOpen, handleClose]);
|
|
436
381
|
var onToggle = useCallback(function (event) {
|
|
@@ -438,89 +383,76 @@ export var useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {
|
|
|
438
383
|
if (readOnly || disabled) {
|
|
439
384
|
return;
|
|
440
385
|
}
|
|
441
|
-
|
|
442
386
|
if (event.target === (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current)) {
|
|
443
387
|
// enter
|
|
444
388
|
if (toggle && event.key === KEY_VALUES.ENTER) {
|
|
445
389
|
handleToggleDropdown();
|
|
446
|
-
}
|
|
447
|
-
|
|
390
|
+
}
|
|
448
391
|
|
|
392
|
+
// delete
|
|
449
393
|
if (event.key === KEY_VALUES.BACKSPACE) {
|
|
450
394
|
onExit === null || onExit === void 0 ? void 0 : onExit(event);
|
|
451
395
|
}
|
|
452
396
|
}
|
|
453
|
-
|
|
454
397
|
if (overlayRef !== null && overlayRef !== void 0 && overlayRef.current) {
|
|
455
398
|
// The keyboard operation callback on the menu.
|
|
456
399
|
onMenuKeyDown === null || onMenuKeyDown === void 0 ? void 0 : onMenuKeyDown(event);
|
|
457
|
-
|
|
458
400
|
if (event.key === KEY_VALUES.ENTER) {
|
|
459
401
|
onMenuPressEnter === null || onMenuPressEnter === void 0 ? void 0 : onMenuPressEnter(event);
|
|
460
402
|
}
|
|
403
|
+
|
|
461
404
|
/**
|
|
462
405
|
* There is no callback when typing the Backspace key in the search box.
|
|
463
406
|
* The default is to remove search keywords
|
|
464
407
|
*/
|
|
465
|
-
|
|
466
|
-
|
|
467
408
|
if (event.key === KEY_VALUES.BACKSPACE && event.target !== (searchInputRef === null || searchInputRef === void 0 ? void 0 : searchInputRef.current)) {
|
|
468
409
|
onMenuPressBackspace === null || onMenuPressBackspace === void 0 ? void 0 : onMenuPressBackspace(event);
|
|
469
|
-
}
|
|
470
|
-
|
|
410
|
+
}
|
|
471
411
|
|
|
412
|
+
// The search box gets focus when typing characters and numbers.
|
|
472
413
|
if (event.key.length === 1 && /\w/.test(event.key)) {
|
|
473
414
|
var _event$target;
|
|
474
|
-
|
|
475
415
|
// Exclude Input
|
|
476
416
|
// eg: <SelectPicker renderExtraFooter={() => <Input />} />
|
|
477
417
|
if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName) !== 'INPUT') {
|
|
478
418
|
var _searchInputRef$curre;
|
|
479
|
-
|
|
480
419
|
searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
481
420
|
}
|
|
482
421
|
}
|
|
483
422
|
}
|
|
484
|
-
|
|
485
423
|
if (event.key === KEY_VALUES.ESC || event.key === KEY_VALUES.TAB) {
|
|
486
424
|
handleClose();
|
|
487
|
-
}
|
|
488
|
-
|
|
425
|
+
}
|
|
489
426
|
|
|
427
|
+
// Native event callback
|
|
490
428
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
491
429
|
}, [readOnly, disabled, targetRef, overlayRef, onKeyDown, toggle, handleToggleDropdown, onExit, onMenuKeyDown, searchInputRef, onMenuPressEnter, onMenuPressBackspace, handleClose]);
|
|
492
430
|
return onToggle;
|
|
493
431
|
};
|
|
494
|
-
|
|
495
432
|
/**
|
|
496
433
|
* A hook that handles search filter options
|
|
497
434
|
*/
|
|
498
435
|
export function useSearch(data, props) {
|
|
499
436
|
var labelKey = props.labelKey,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
437
|
+
searchBy = props.searchBy,
|
|
438
|
+
callback = props.callback; // Use search keywords to filter options.
|
|
503
439
|
var _useState4 = useState(''),
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
440
|
+
searchKeyword = _useState4[0],
|
|
441
|
+
setSearchKeyword = _useState4[1];
|
|
507
442
|
var resetSearch = useCallback(function () {
|
|
508
443
|
setSearchKeyword('');
|
|
509
444
|
}, []);
|
|
445
|
+
|
|
510
446
|
/**
|
|
511
447
|
* Index of keyword in `label`
|
|
512
448
|
* @param {node} label
|
|
513
449
|
*/
|
|
514
|
-
|
|
515
450
|
var checkShouldDisplay = useCallback(function (item, keyword) {
|
|
516
451
|
var checkValue = typeof item === 'object' ? item === null || item === void 0 ? void 0 : item[labelKey] : String(item);
|
|
517
|
-
|
|
518
452
|
var _keyword = isUndefined(keyword) ? searchKeyword : keyword;
|
|
519
|
-
|
|
520
453
|
if (typeof searchBy === 'function') {
|
|
521
454
|
return searchBy(_keyword, checkValue, item);
|
|
522
455
|
}
|
|
523
|
-
|
|
524
456
|
return shouldDisplay(checkValue, _keyword);
|
|
525
457
|
}, [labelKey, searchBy, searchKeyword]);
|
|
526
458
|
var filteredData = useMemo(function () {
|
|
@@ -528,7 +460,6 @@ export function useSearch(data, props) {
|
|
|
528
460
|
return checkShouldDisplay(item, searchKeyword);
|
|
529
461
|
});
|
|
530
462
|
}, [checkShouldDisplay, data, searchKeyword]);
|
|
531
|
-
|
|
532
463
|
var handleSearch = function handleSearch(searchKeyword, event) {
|
|
533
464
|
var filteredData = data.filter(function (item) {
|
|
534
465
|
return checkShouldDisplay(item, searchKeyword);
|
|
@@ -536,7 +467,6 @@ export function useSearch(data, props) {
|
|
|
536
467
|
setSearchKeyword(searchKeyword);
|
|
537
468
|
callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);
|
|
538
469
|
};
|
|
539
|
-
|
|
540
470
|
return {
|
|
541
471
|
searchKeyword: searchKeyword,
|
|
542
472
|
filteredData: filteredData,
|
|
@@ -545,30 +475,26 @@ export function useSearch(data, props) {
|
|
|
545
475
|
resetSearch: resetSearch
|
|
546
476
|
};
|
|
547
477
|
}
|
|
548
|
-
|
|
549
478
|
/**
|
|
550
479
|
* A hook of the exposed method of Picker
|
|
551
480
|
*/
|
|
552
481
|
export function usePublicMethods(ref, parmas) {
|
|
553
482
|
var triggerRef = parmas.triggerRef,
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
483
|
+
overlayRef = parmas.overlayRef,
|
|
484
|
+
targetRef = parmas.targetRef,
|
|
485
|
+
rootRef = parmas.rootRef,
|
|
486
|
+
listRef = parmas.listRef,
|
|
487
|
+
inline = parmas.inline;
|
|
559
488
|
var handleOpen = useCallback(function () {
|
|
560
489
|
var _triggerRef$current3;
|
|
561
|
-
|
|
562
490
|
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 ? void 0 : _triggerRef$current3.open();
|
|
563
491
|
}, [triggerRef]);
|
|
564
492
|
var handleClose = useCallback(function () {
|
|
565
493
|
var _triggerRef$current4;
|
|
566
|
-
|
|
567
494
|
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current4 = triggerRef.current) === null || _triggerRef$current4 === void 0 ? void 0 : _triggerRef$current4.close();
|
|
568
495
|
}, [triggerRef]);
|
|
569
496
|
var handleUpdatePosition = useCallback(function () {
|
|
570
497
|
var _triggerRef$current5;
|
|
571
|
-
|
|
572
498
|
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current5 = triggerRef.current) === null || _triggerRef$current5 === void 0 ? void 0 : _triggerRef$current5.updatePosition();
|
|
573
499
|
}, [triggerRef]);
|
|
574
500
|
useImperativeHandle(ref, function () {
|
|
@@ -577,52 +503,38 @@ export function usePublicMethods(ref, parmas) {
|
|
|
577
503
|
return {
|
|
578
504
|
get root() {
|
|
579
505
|
var _triggerRef$current$r, _triggerRef$current6;
|
|
580
|
-
|
|
581
506
|
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;
|
|
582
507
|
},
|
|
583
|
-
|
|
584
508
|
get list() {
|
|
585
509
|
if (!(listRef !== null && listRef !== void 0 && listRef.current)) {
|
|
586
510
|
throw new Error('The list is not found, please set `virtualized` for the component.');
|
|
587
511
|
}
|
|
588
|
-
|
|
589
512
|
return listRef === null || listRef === void 0 ? void 0 : listRef.current;
|
|
590
513
|
}
|
|
591
|
-
|
|
592
514
|
};
|
|
593
515
|
}
|
|
594
|
-
|
|
595
516
|
return {
|
|
596
517
|
get root() {
|
|
597
518
|
var _ref, _triggerRef$current7;
|
|
598
|
-
|
|
599
519
|
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;
|
|
600
520
|
},
|
|
601
|
-
|
|
602
521
|
get overlay() {
|
|
603
522
|
var _overlayRef$current;
|
|
604
|
-
|
|
605
523
|
if (!(overlayRef !== null && overlayRef !== void 0 && overlayRef.current)) {
|
|
606
524
|
throw new Error('The overlay is not found. Please confirm whether the picker is open.');
|
|
607
525
|
}
|
|
608
|
-
|
|
609
526
|
return (_overlayRef$current = overlayRef === null || overlayRef === void 0 ? void 0 : overlayRef.current) !== null && _overlayRef$current !== void 0 ? _overlayRef$current : null;
|
|
610
527
|
},
|
|
611
|
-
|
|
612
528
|
get target() {
|
|
613
529
|
var _targetRef$current;
|
|
614
|
-
|
|
615
530
|
return (_targetRef$current = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) !== null && _targetRef$current !== void 0 ? _targetRef$current : null;
|
|
616
531
|
},
|
|
617
|
-
|
|
618
532
|
get list() {
|
|
619
533
|
if (!(listRef !== null && listRef !== void 0 && listRef.current)) {
|
|
620
534
|
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 ");
|
|
621
535
|
}
|
|
622
|
-
|
|
623
536
|
return listRef === null || listRef === void 0 ? void 0 : listRef.current;
|
|
624
537
|
},
|
|
625
|
-
|
|
626
538
|
updatePosition: handleUpdatePosition,
|
|
627
539
|
open: handleOpen,
|
|
628
540
|
close: handleClose
|