rsuite 5.2.4 → 5.3.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/Avatar/styles/index.less +2 -2
- package/AvatarGroup/package.json +7 -0
- package/AvatarGroup/styles/index.less +19 -0
- package/ButtonGroup/styles/index.less +0 -18
- package/CHANGELOG.md +15 -0
- package/CheckTreePicker/styles/index.less +14 -1
- package/TreePicker/styles/index.less +10 -0
- package/cjs/@types/common.d.ts +9 -8
- package/cjs/@types/utils.d.ts +12 -0
- package/cjs/Affix/Affix.js +5 -5
- package/cjs/Animation/Transition.d.ts +21 -12
- package/cjs/Animation/Transition.js +4 -1
- package/cjs/AutoComplete/AutoComplete.js +1 -1
- package/cjs/AutoComplete/utils.d.ts +1 -1
- package/cjs/Avatar/Avatar.js +10 -3
- package/cjs/AvatarGroup/AvatarGroup.d.ts +15 -0
- package/cjs/AvatarGroup/AvatarGroup.js +71 -0
- package/cjs/AvatarGroup/index.d.ts +3 -0
- package/cjs/AvatarGroup/index.js +11 -0
- package/cjs/Breadcrumb/Breadcrumb.js +1 -1
- package/cjs/Button/Button.js +8 -2
- package/cjs/ButtonGroup/ButtonGroup.js +8 -2
- package/cjs/ButtonGroup/ButtonGroupContext.d.ts +7 -0
- package/cjs/ButtonGroup/ButtonGroupContext.js +13 -0
- package/cjs/ButtonGroup/index.d.ts +2 -0
- package/cjs/ButtonGroup/index.js +3 -0
- package/cjs/Calendar/Calendar.d.ts +4 -4
- package/cjs/Calendar/Calendar.js +5 -2
- package/cjs/Calendar/CalendarContext.js +1 -1
- package/cjs/Calendar/TableRow.js +1 -1
- package/cjs/Calendar/TimeDropdown.js +6 -5
- package/cjs/Calendar/types.d.ts +2 -2
- package/cjs/Calendar/useCalendarDate.d.ts +2 -2
- package/cjs/Carousel/Carousel.d.ts +1 -1
- package/cjs/Carousel/Carousel.js +1 -1
- package/cjs/Cascader/Cascader.d.ts +1 -1
- package/cjs/Cascader/Cascader.js +10 -10
- package/cjs/Cascader/DropdownMenu.d.ts +5 -4
- package/cjs/Cascader/utils.d.ts +3 -3
- package/cjs/CheckPicker/CheckPicker.js +4 -4
- package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/cjs/CheckTreePicker/CheckTreeNode.js +7 -9
- package/cjs/CheckTreePicker/CheckTreePicker.js +29 -25
- package/cjs/CheckTreePicker/utils.d.ts +3 -1
- package/cjs/CheckTreePicker/utils.js +12 -10
- package/cjs/Checkbox/Checkbox.d.ts +1 -1
- package/cjs/CustomProvider/CustomProvider.d.ts +31 -57
- package/cjs/DOMHelper/index.d.ts +12 -12
- package/cjs/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker.js +15 -9
- package/cjs/DatePicker/Toolbar.d.ts +12 -9
- package/cjs/DatePicker/Toolbar.js +6 -8
- package/cjs/DatePicker/types.d.ts +4 -4
- package/cjs/DatePicker/utils.d.ts +4 -3
- package/cjs/DateRangePicker/Calendar.d.ts +8 -7
- package/cjs/DateRangePicker/Calendar.js +1 -1
- package/cjs/DateRangePicker/DateRangePicker.d.ts +6 -6
- package/cjs/DateRangePicker/DateRangePicker.js +105 -108
- package/cjs/DateRangePicker/types.d.ts +2 -1
- package/cjs/DateRangePicker/utils.d.ts +6 -6
- package/cjs/DateRangePicker/utils.js +7 -2
- package/cjs/Disclosure/Disclosure.js +4 -2
- package/cjs/Disclosure/DisclosureButton.js +9 -7
- package/cjs/Disclosure/DisclosureContent.js +4 -6
- package/cjs/Disclosure/DisclosureContext.d.ts +2 -2
- package/cjs/Disclosure/useDisclosureContext.d.ts +2 -0
- package/cjs/Disclosure/useDisclosureContext.js +20 -0
- package/cjs/Dropdown/Dropdown.d.ts +1 -1
- package/cjs/Dropdown/DropdownContext.d.ts +2 -2
- package/cjs/Dropdown/DropdownItem.js +1 -1
- package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
- package/cjs/Dropdown/DropdownState.d.ts +1 -1
- package/cjs/Dropdown/DropdownToggle.js +2 -1
- package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/cjs/Form/Form.js +1 -1
- package/cjs/Form/FormContext.d.ts +1 -1
- package/cjs/FormControl/FormControl.d.ts +1 -1
- package/cjs/FormControl/FormControl.js +5 -4
- package/cjs/FormGroup/FormGroup.d.ts +1 -1
- package/cjs/Input/Input.d.ts +3 -2
- package/cjs/InputGroup/InputGroup.d.ts +1 -1
- package/cjs/InputNumber/InputNumber.js +6 -2
- package/cjs/InputPicker/InputAutosize.js +4 -4
- package/cjs/InputPicker/InputPicker.d.ts +2 -2
- package/cjs/InputPicker/InputPicker.js +15 -10
- package/cjs/List/ListContext.d.ts +1 -1
- package/cjs/List/ListContext.js +8 -1
- package/cjs/List/helper/AutoScroller.js +4 -2
- package/cjs/List/helper/useManager.d.ts +3 -3
- package/cjs/List/helper/useManager.js +1 -1
- package/cjs/List/helper/useSortHelper.d.ts +3 -3
- package/cjs/List/helper/useSortHelper.js +6 -4
- package/cjs/List/helper/utils.d.ts +2 -2
- package/cjs/MaskedInput/TextMask.d.ts +5 -5
- package/cjs/MaskedInput/adjustCaretPosition.d.ts +6 -6
- package/cjs/MaskedInput/conformToMask.js +5 -4
- package/cjs/MaskedInput/createTextMaskInputElement.d.ts +2 -2
- package/cjs/MaskedInput/utilities.d.ts +1 -1
- package/cjs/Menu/Menu.js +14 -7
- package/cjs/Menu/MenuContext.d.ts +1 -1
- package/cjs/Menu/MenuItem.d.ts +1 -1
- package/cjs/Menu/MenuItem.js +19 -15
- package/cjs/Menu/Menubar.js +8 -8
- package/cjs/Menu/useMenu.js +17 -7
- package/cjs/Modal/Modal.js +12 -6
- package/cjs/Modal/ModalContext.d.ts +2 -2
- package/cjs/Modal/utils.d.ts +1 -1
- package/cjs/Modal/utils.js +3 -5
- package/cjs/MultiCascader/DropdownMenu.d.ts +4 -4
- package/cjs/MultiCascader/MultiCascader.js +6 -6
- package/cjs/MultiCascader/utils.d.ts +14 -14
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/NavContext.d.ts +1 -1
- package/cjs/Nav/NavItem.d.ts +1 -1
- package/cjs/Navbar/Navbar.js +1 -1
- package/cjs/Navbar/NavbarItem.d.ts +1 -1
- package/cjs/Overlay/Modal.d.ts +2 -2
- package/cjs/Overlay/Modal.js +41 -31
- package/cjs/Overlay/ModalManager.d.ts +17 -8
- package/cjs/Overlay/ModalManager.js +11 -20
- package/cjs/Overlay/Overlay.d.ts +2 -2
- package/cjs/Overlay/Overlay.js +1 -1
- package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
- package/cjs/Overlay/OverlayTrigger.js +14 -6
- package/cjs/Overlay/Position.d.ts +3 -3
- package/cjs/Overlay/Position.js +14 -8
- package/cjs/Overlay/positionUtils.d.ts +1 -1
- package/cjs/Overlay/positionUtils.js +8 -8
- package/cjs/Pagination/Pagination.d.ts +1 -1
- package/cjs/Pagination/PaginationButton.d.ts +3 -3
- package/cjs/Pagination/PaginationGroup.js +5 -3
- package/cjs/Panel/Panel.d.ts +1 -1
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/PanelGroup/PanelGroup.d.ts +2 -2
- package/cjs/Picker/DropdownMenu.d.ts +8 -5
- package/cjs/Picker/DropdownMenu.js +5 -5
- package/cjs/Picker/PickerOverlay.js +4 -3
- package/cjs/Picker/PickerToggle.js +4 -3
- package/cjs/Picker/PickerToggleTrigger.d.ts +2 -6
- package/cjs/Picker/SearchBar.d.ts +1 -1
- package/cjs/Picker/SelectedElement.js +2 -1
- package/cjs/Picker/propTypes.d.ts +2 -2
- package/cjs/Picker/utils.d.ts +13 -13
- package/cjs/Picker/utils.js +22 -18
- package/cjs/Placeholder/PlaceholderGrid.js +1 -1
- package/cjs/Plaintext/Plaintext.js +2 -1
- package/cjs/Radio/Radio.d.ts +1 -1
- package/cjs/RadioGroup/RadioGroup.d.ts +2 -2
- package/cjs/RadioGroup/RadioGroup.js +1 -1
- package/cjs/RangeSlider/RangeSlider.d.ts +2 -2
- package/cjs/RangeSlider/RangeSlider.js +6 -4
- package/cjs/Rate/Character.js +4 -2
- package/cjs/Rate/Rate.js +2 -1
- package/cjs/Ripple/Ripple.js +1 -1
- package/cjs/SelectPicker/SelectPicker.js +4 -4
- package/cjs/Sidenav/Node.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.d.ts +4 -4
- package/cjs/Sidenav/Sidenav.js +5 -2
- package/cjs/Sidenav/SidenavDropdown.js +11 -8
- package/cjs/Sidenav/SidenavDropdownItem.js +10 -5
- package/cjs/Sidenav/SidenavDropdownMenu.js +9 -5
- package/cjs/Sidenav/SidenavItem.d.ts +1 -1
- package/cjs/Sidenav/SidenavItem.js +4 -0
- package/cjs/Slider/Graduated.d.ts +5 -5
- package/cjs/Slider/Handle.d.ts +1 -1
- package/cjs/Slider/Handle.js +10 -6
- package/cjs/Slider/Mark.d.ts +1 -1
- package/cjs/Slider/Slider.d.ts +1 -1
- package/cjs/Slider/Slider.js +2 -2
- package/cjs/Slider/utils.d.ts +2 -1
- package/cjs/Slider/utils.js +4 -5
- package/cjs/Steps/StepItem.js +2 -2
- package/cjs/TagInput/index.js +1 -1
- package/cjs/Toggle/Toggle.js +1 -1
- package/cjs/Tree/Tree.d.ts +3 -1
- package/cjs/TreePicker/TreeNode.js +6 -8
- package/cjs/TreePicker/TreePicker.js +31 -25
- package/cjs/Uploader/UploadFileItem.d.ts +1 -1
- package/cjs/Uploader/UploadFileItem.js +2 -2
- package/cjs/Uploader/UploadTrigger.d.ts +1 -1
- package/cjs/Uploader/UploadTrigger.js +2 -3
- package/cjs/Uploader/Uploader.d.ts +5 -5
- package/cjs/Uploader/Uploader.js +1 -2
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +5 -1
- package/cjs/locales/index.d.ts +3 -3
- package/cjs/toaster/ToastContainer.d.ts +1 -1
- package/cjs/toaster/ToastContainer.js +1 -1
- package/cjs/toaster/toaster.js +3 -1
- package/cjs/utils/BrowserDetection.js +1 -1
- package/cjs/utils/ReactChildren.d.ts +2 -2
- package/cjs/utils/ajaxUpload.d.ts +1 -1
- package/cjs/utils/ajaxUpload.js +5 -4
- package/cjs/utils/appendTooltip.d.ts +1 -1
- package/cjs/utils/constants.d.ts +4 -4
- package/cjs/utils/createChainedFunction.d.ts +1 -1
- package/cjs/utils/getDataGroupBy.d.ts +1 -1
- package/cjs/utils/mergeRefs.d.ts +2 -2
- package/cjs/utils/previewFile.d.ts +1 -1
- package/cjs/utils/propTypeChecker.d.ts +6 -2
- package/cjs/utils/propTypeChecker.js +7 -6
- package/cjs/utils/reactToString.d.ts +2 -1
- package/cjs/utils/statusIcons.d.ts +1 -1
- package/cjs/utils/stringToObject.d.ts +1 -1
- package/cjs/utils/treeUtils.d.ts +32 -29
- package/cjs/utils/treeUtils.js +46 -23
- package/cjs/utils/useControlled.d.ts +6 -1
- package/cjs/utils/useControlled.js +0 -8
- package/cjs/utils/useCustom.js +6 -4
- package/cjs/utils/useFocus.d.ts +2 -2
- package/cjs/utils/usePortal.d.ts +1 -1
- package/cjs/utils/useRootClose.d.ts +2 -2
- package/cjs/utils/useTimeout.d.ts +1 -1
- package/cjs/utils/useTimeout.js +5 -3
- package/dist/rsuite-rtl.css +40 -159
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +40 -159
- package/dist/rsuite.js +146 -102
- 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.d.ts +9 -8
- package/esm/@types/utils.d.ts +12 -0
- package/esm/Affix/Affix.js +5 -5
- package/esm/Animation/Transition.d.ts +21 -12
- package/esm/Animation/Transition.js +4 -1
- package/esm/AutoComplete/AutoComplete.js +1 -1
- package/esm/AutoComplete/utils.d.ts +1 -1
- package/esm/Avatar/Avatar.js +7 -3
- package/esm/AvatarGroup/AvatarGroup.d.ts +15 -0
- package/esm/AvatarGroup/AvatarGroup.js +54 -0
- package/esm/AvatarGroup/index.d.ts +3 -0
- package/esm/AvatarGroup/index.js +2 -0
- package/esm/Breadcrumb/Breadcrumb.js +1 -1
- package/esm/Button/Button.js +6 -2
- package/esm/ButtonGroup/ButtonGroup.js +7 -2
- package/esm/ButtonGroup/ButtonGroupContext.d.ts +7 -0
- package/esm/ButtonGroup/ButtonGroupContext.js +3 -0
- package/esm/ButtonGroup/index.d.ts +2 -0
- package/esm/ButtonGroup/index.js +2 -0
- package/esm/Calendar/Calendar.d.ts +4 -4
- package/esm/Calendar/Calendar.js +5 -2
- package/esm/Calendar/CalendarContext.js +1 -1
- package/esm/Calendar/TableRow.js +1 -1
- package/esm/Calendar/TimeDropdown.js +5 -4
- package/esm/Calendar/types.d.ts +2 -2
- package/esm/Calendar/useCalendarDate.d.ts +2 -2
- package/esm/Carousel/Carousel.d.ts +1 -1
- package/esm/Carousel/Carousel.js +1 -1
- package/esm/Cascader/Cascader.d.ts +1 -1
- package/esm/Cascader/Cascader.js +10 -10
- package/esm/Cascader/DropdownMenu.d.ts +5 -4
- package/esm/Cascader/utils.d.ts +3 -3
- package/esm/CheckPicker/CheckPicker.js +4 -4
- package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/esm/CheckTreePicker/CheckTreeNode.js +4 -7
- package/esm/CheckTreePicker/CheckTreePicker.js +28 -23
- package/esm/CheckTreePicker/utils.d.ts +3 -1
- package/esm/CheckTreePicker/utils.js +12 -10
- package/esm/Checkbox/Checkbox.d.ts +1 -1
- package/esm/CustomProvider/CustomProvider.d.ts +31 -57
- package/esm/DOMHelper/index.d.ts +12 -12
- package/esm/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker.js +14 -9
- package/esm/DatePicker/Toolbar.d.ts +12 -9
- package/esm/DatePicker/Toolbar.js +6 -8
- package/esm/DatePicker/types.d.ts +4 -4
- package/esm/DatePicker/utils.d.ts +4 -3
- package/esm/DateRangePicker/Calendar.d.ts +8 -7
- package/esm/DateRangePicker/Calendar.js +1 -1
- package/esm/DateRangePicker/DateRangePicker.d.ts +6 -6
- package/esm/DateRangePicker/DateRangePicker.js +105 -108
- package/esm/DateRangePicker/types.d.ts +2 -1
- package/esm/DateRangePicker/utils.d.ts +6 -6
- package/esm/DateRangePicker/utils.js +6 -2
- package/esm/Disclosure/Disclosure.js +4 -2
- package/esm/Disclosure/DisclosureButton.js +8 -7
- package/esm/Disclosure/DisclosureContent.js +5 -7
- package/esm/Disclosure/DisclosureContext.d.ts +2 -2
- package/esm/Disclosure/useDisclosureContext.d.ts +2 -0
- package/esm/Disclosure/useDisclosureContext.js +11 -0
- package/esm/Dropdown/Dropdown.d.ts +1 -1
- package/esm/Dropdown/DropdownContext.d.ts +2 -2
- package/esm/Dropdown/DropdownItem.js +1 -1
- package/esm/Dropdown/DropdownMenu.d.ts +3 -3
- package/esm/Dropdown/DropdownState.d.ts +1 -1
- package/esm/Dropdown/DropdownToggle.js +2 -1
- package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
- package/esm/Form/Form.js +1 -1
- package/esm/Form/FormContext.d.ts +1 -1
- package/esm/FormControl/FormControl.d.ts +1 -1
- package/esm/FormControl/FormControl.js +5 -4
- package/esm/FormGroup/FormGroup.d.ts +1 -1
- package/esm/Input/Input.d.ts +3 -2
- package/esm/InputGroup/InputGroup.d.ts +1 -1
- package/esm/InputNumber/InputNumber.js +6 -2
- package/esm/InputPicker/InputAutosize.js +4 -4
- package/esm/InputPicker/InputPicker.d.ts +2 -2
- package/esm/InputPicker/InputPicker.js +15 -10
- package/esm/List/ListContext.d.ts +1 -1
- package/esm/List/ListContext.js +7 -1
- package/esm/List/helper/AutoScroller.js +4 -2
- package/esm/List/helper/useManager.d.ts +3 -3
- package/esm/List/helper/useManager.js +1 -1
- package/esm/List/helper/useSortHelper.d.ts +3 -3
- package/esm/List/helper/useSortHelper.js +6 -4
- package/esm/List/helper/utils.d.ts +2 -2
- package/esm/MaskedInput/TextMask.d.ts +5 -5
- package/esm/MaskedInput/adjustCaretPosition.d.ts +6 -6
- package/esm/MaskedInput/conformToMask.js +5 -4
- package/esm/MaskedInput/createTextMaskInputElement.d.ts +2 -2
- package/esm/MaskedInput/utilities.d.ts +1 -1
- package/esm/Menu/Menu.js +13 -7
- package/esm/Menu/MenuContext.d.ts +1 -1
- package/esm/Menu/MenuItem.d.ts +1 -1
- package/esm/Menu/MenuItem.js +18 -15
- package/esm/Menu/Menubar.js +7 -8
- package/esm/Menu/useMenu.js +17 -7
- package/esm/Modal/Modal.js +12 -6
- package/esm/Modal/ModalContext.d.ts +2 -2
- package/esm/Modal/utils.d.ts +1 -1
- package/esm/Modal/utils.js +3 -5
- package/esm/MultiCascader/DropdownMenu.d.ts +4 -4
- package/esm/MultiCascader/MultiCascader.js +6 -6
- package/esm/MultiCascader/utils.d.ts +14 -14
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/NavContext.d.ts +1 -1
- package/esm/Nav/NavItem.d.ts +1 -1
- package/esm/Navbar/Navbar.js +1 -1
- package/esm/Navbar/NavbarItem.d.ts +1 -1
- package/esm/Overlay/Modal.d.ts +2 -2
- package/esm/Overlay/Modal.js +42 -32
- package/esm/Overlay/ModalManager.d.ts +17 -8
- package/esm/Overlay/ModalManager.js +11 -20
- package/esm/Overlay/Overlay.d.ts +2 -2
- package/esm/Overlay/Overlay.js +1 -1
- package/esm/Overlay/OverlayTrigger.d.ts +11 -11
- package/esm/Overlay/OverlayTrigger.js +14 -6
- package/esm/Overlay/Position.d.ts +3 -3
- package/esm/Overlay/Position.js +14 -8
- package/esm/Overlay/positionUtils.d.ts +1 -1
- package/esm/Overlay/positionUtils.js +6 -6
- package/esm/Pagination/Pagination.d.ts +1 -1
- package/esm/Pagination/PaginationButton.d.ts +3 -3
- package/esm/Pagination/PaginationGroup.js +5 -3
- package/esm/Panel/Panel.d.ts +1 -1
- package/esm/Panel/Panel.js +2 -2
- package/esm/PanelGroup/PanelGroup.d.ts +2 -2
- package/esm/Picker/DropdownMenu.d.ts +8 -5
- package/esm/Picker/DropdownMenu.js +5 -5
- package/esm/Picker/PickerOverlay.js +4 -3
- package/esm/Picker/PickerToggle.js +4 -3
- package/esm/Picker/PickerToggleTrigger.d.ts +2 -6
- package/esm/Picker/SearchBar.d.ts +1 -1
- package/esm/Picker/SelectedElement.js +2 -1
- package/esm/Picker/propTypes.d.ts +2 -2
- package/esm/Picker/utils.d.ts +13 -13
- package/esm/Picker/utils.js +21 -18
- package/esm/Placeholder/PlaceholderGrid.js +1 -1
- package/esm/Plaintext/Plaintext.js +2 -1
- package/esm/Radio/Radio.d.ts +1 -1
- package/esm/RadioGroup/RadioGroup.d.ts +2 -2
- package/esm/RadioGroup/RadioGroup.js +1 -1
- package/esm/RangeSlider/RangeSlider.d.ts +2 -2
- package/esm/RangeSlider/RangeSlider.js +5 -4
- package/esm/Rate/Character.js +3 -2
- package/esm/Rate/Rate.js +2 -1
- package/esm/Ripple/Ripple.js +1 -1
- package/esm/SelectPicker/SelectPicker.js +4 -4
- package/esm/Sidenav/Node.d.ts +1 -1
- package/esm/Sidenav/Sidenav.d.ts +4 -4
- package/esm/Sidenav/Sidenav.js +5 -2
- package/esm/Sidenav/SidenavDropdown.js +11 -7
- package/esm/Sidenav/SidenavDropdownItem.js +11 -5
- package/esm/Sidenav/SidenavDropdownMenu.js +9 -5
- package/esm/Sidenav/SidenavItem.d.ts +1 -1
- package/esm/Sidenav/SidenavItem.js +4 -0
- package/esm/Slider/Graduated.d.ts +5 -5
- package/esm/Slider/Handle.d.ts +1 -1
- package/esm/Slider/Handle.js +10 -6
- package/esm/Slider/Mark.d.ts +1 -1
- package/esm/Slider/Slider.d.ts +1 -1
- package/esm/Slider/Slider.js +2 -2
- package/esm/Slider/utils.d.ts +2 -1
- package/esm/Slider/utils.js +5 -2
- package/esm/Steps/StepItem.js +2 -2
- package/esm/TagInput/index.js +1 -1
- package/esm/Toggle/Toggle.js +1 -1
- package/esm/Tree/Tree.d.ts +3 -1
- package/esm/TreePicker/TreeNode.js +4 -7
- package/esm/TreePicker/TreePicker.js +30 -23
- package/esm/Uploader/UploadFileItem.d.ts +1 -1
- package/esm/Uploader/UploadFileItem.js +2 -2
- package/esm/Uploader/UploadTrigger.d.ts +1 -1
- package/esm/Uploader/UploadTrigger.js +2 -3
- package/esm/Uploader/Uploader.d.ts +5 -5
- package/esm/Uploader/Uploader.js +1 -2
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/locales/index.d.ts +3 -3
- package/esm/toaster/ToastContainer.d.ts +1 -1
- package/esm/toaster/ToastContainer.js +1 -1
- package/esm/toaster/toaster.js +3 -1
- package/esm/utils/BrowserDetection.js +1 -1
- package/esm/utils/ReactChildren.d.ts +2 -2
- package/esm/utils/ajaxUpload.d.ts +1 -1
- package/esm/utils/ajaxUpload.js +5 -4
- package/esm/utils/appendTooltip.d.ts +1 -1
- package/esm/utils/constants.d.ts +4 -4
- package/esm/utils/createChainedFunction.d.ts +1 -1
- package/esm/utils/getDataGroupBy.d.ts +1 -1
- package/esm/utils/mergeRefs.d.ts +2 -2
- package/esm/utils/previewFile.d.ts +1 -1
- package/esm/utils/propTypeChecker.d.ts +6 -2
- package/esm/utils/propTypeChecker.js +7 -6
- package/esm/utils/reactToString.d.ts +2 -1
- package/esm/utils/statusIcons.d.ts +1 -1
- package/esm/utils/stringToObject.d.ts +1 -1
- package/esm/utils/treeUtils.d.ts +32 -29
- package/esm/utils/treeUtils.js +45 -21
- package/esm/utils/useControlled.d.ts +6 -1
- package/esm/utils/useControlled.js +0 -8
- package/esm/utils/useCustom.js +6 -4
- package/esm/utils/useFocus.d.ts +2 -2
- package/esm/utils/usePortal.d.ts +1 -1
- package/esm/utils/useRootClose.d.ts +2 -2
- package/esm/utils/useTimeout.d.ts +1 -1
- package/esm/utils/useTimeout.js +5 -3
- package/package.json +2 -2
- package/styles/index.less +1 -0
package/esm/Menu/MenuItem.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
3
4
|
import useUniqueId from '../utils/useUniqueId';
|
|
4
5
|
import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
|
|
5
6
|
|
|
@@ -7,22 +8,24 @@ import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
|
|
|
7
8
|
* Headless ARIA `menuitem`
|
|
8
9
|
*/
|
|
9
10
|
function MenuItem(props) {
|
|
10
|
-
var _menuState$items$menu;
|
|
11
|
-
|
|
12
11
|
var children = props.children,
|
|
13
|
-
selected = props.selected,
|
|
14
|
-
|
|
12
|
+
_props$selected = props.selected,
|
|
13
|
+
selected = _props$selected === void 0 ? false : _props$selected,
|
|
14
|
+
_props$disabled = props.disabled,
|
|
15
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
15
16
|
onActivate = props.onActivate;
|
|
16
|
-
var menuitemRef = useRef();
|
|
17
|
+
var menuitemRef = useRef(null);
|
|
17
18
|
var menuitemId = useUniqueId('menuitem-');
|
|
18
|
-
var menu = useContext(MenuContext);
|
|
19
|
+
var menu = useContext(MenuContext);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
if (!menu) {
|
|
22
|
+
throw new Error('<MenuItem> must be rendered within a <Menu>');
|
|
23
|
+
}
|
|
23
24
|
|
|
25
|
+
var menuState = menu[0],
|
|
26
|
+
dispatch = menu[1]; // Whether this menuitem has focus (indicated by `aria-activedescendant` from parent menu)
|
|
24
27
|
|
|
25
|
-
var hasFocus = (
|
|
28
|
+
var hasFocus = !isNil(menuitemRef.current) && !isNil(menuState.activeItemIndex) && menuState.items[menuState.activeItemIndex].element === menuitemRef.current;
|
|
26
29
|
var handleClick = useCallback(function (event) {
|
|
27
30
|
if (disabled) {
|
|
28
31
|
return;
|
|
@@ -32,17 +35,17 @@ function MenuItem(props) {
|
|
|
32
35
|
}, [disabled, onActivate]); // Gain/release focus on mousedown in `menubar`
|
|
33
36
|
|
|
34
37
|
var handleMouseDown = useCallback(function () {
|
|
35
|
-
if (!hasFocus) {
|
|
38
|
+
if (!isNil(menuitemRef.current) && !hasFocus) {
|
|
36
39
|
dispatch({
|
|
37
40
|
type: MenuActionTypes.MoveFocus,
|
|
38
41
|
to: MoveFocusTo.Specific,
|
|
39
42
|
id: menuitemRef.current.id
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
|
-
}, [
|
|
45
|
+
}, [dispatch]); // Gain/release focus on mouseenter/mouseleave in `menu`
|
|
43
46
|
|
|
44
47
|
var handleMouseMove = useCallback(function () {
|
|
45
|
-
if (!hasFocus) {
|
|
48
|
+
if (!isNil(menuitemRef.current) && !hasFocus) {
|
|
46
49
|
dispatch({
|
|
47
50
|
type: MenuActionTypes.MoveFocus,
|
|
48
51
|
to: MoveFocusTo.Specific,
|
|
@@ -58,7 +61,7 @@ function MenuItem(props) {
|
|
|
58
61
|
}, [dispatch]);
|
|
59
62
|
useEffect(function () {
|
|
60
63
|
var menuitemElement = menuitemRef.current;
|
|
61
|
-
dispatch
|
|
64
|
+
dispatch({
|
|
62
65
|
type: MenuActionTypes.RegisterItem,
|
|
63
66
|
element: menuitemElement,
|
|
64
67
|
props: {
|
|
@@ -66,7 +69,7 @@ function MenuItem(props) {
|
|
|
66
69
|
}
|
|
67
70
|
});
|
|
68
71
|
return function () {
|
|
69
|
-
dispatch
|
|
72
|
+
dispatch({
|
|
70
73
|
type: MenuActionTypes.UnregisterItem,
|
|
71
74
|
id: menuitemElement.id
|
|
72
75
|
});
|
package/esm/Menu/Menubar.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// Headless ARIA `menubar`
|
|
2
2
|
import React, { useCallback, useRef } from 'react';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
3
4
|
import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
|
|
4
5
|
import { KEY_VALUES, useCustom } from '../utils';
|
|
5
6
|
import { isFocusEntering, isFocusLeaving } from '../utils/events';
|
|
6
7
|
import useMenu from './useMenu';
|
|
7
8
|
export default function Menubar(_ref) {
|
|
8
|
-
var _items$activeItemInde;
|
|
9
|
-
|
|
10
9
|
var _ref$vertical = _ref.vertical,
|
|
11
10
|
vertical = _ref$vertical === void 0 ? false : _ref$vertical,
|
|
12
11
|
children = _ref.children,
|
|
@@ -18,7 +17,7 @@ export default function Menubar(_ref) {
|
|
|
18
17
|
items = _menubar$.items,
|
|
19
18
|
activeItemIndex = _menubar$.activeItemIndex,
|
|
20
19
|
dispatch = menubar[1];
|
|
21
|
-
var menubarElementRef = useRef();
|
|
20
|
+
var menubarElementRef = useRef(null);
|
|
22
21
|
var onFocus = useCallback(function (event) {
|
|
23
22
|
// Focus moves inside Menubar
|
|
24
23
|
if (isFocusEntering(event)) {
|
|
@@ -44,7 +43,7 @@ export default function Menubar(_ref) {
|
|
|
44
43
|
rtl = _useCustom.rtl;
|
|
45
44
|
|
|
46
45
|
var onKeyDown = useCallback(function (event) {
|
|
47
|
-
var
|
|
46
|
+
var activeItemElement = isNil(activeItemIndex) ? null : items[activeItemIndex].element;
|
|
48
47
|
|
|
49
48
|
switch (true) {
|
|
50
49
|
case !vertical && !rtl && event.key === KEY_VALUES.RIGHT:
|
|
@@ -90,10 +89,10 @@ export default function Menubar(_ref) {
|
|
|
90
89
|
case !vertical && event.key === KEY_VALUES.DOWN:
|
|
91
90
|
case vertical && !rtl && event.key === KEY_VALUES.RIGHT:
|
|
92
91
|
case vertical && rtl && event.key === KEY_VALUES.LEFT:
|
|
93
|
-
if ((
|
|
92
|
+
if ((activeItemElement === null || activeItemElement === void 0 ? void 0 : activeItemElement.getAttribute('aria-haspopup')) === 'menu') {
|
|
94
93
|
event.preventDefault();
|
|
95
94
|
event.stopPropagation();
|
|
96
|
-
|
|
95
|
+
activeItemElement.click();
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
break;
|
|
@@ -102,7 +101,7 @@ export default function Menubar(_ref) {
|
|
|
102
101
|
case event.key === KEY_VALUES.SPACE:
|
|
103
102
|
event.preventDefault();
|
|
104
103
|
event.stopPropagation();
|
|
105
|
-
|
|
104
|
+
activeItemElement === null || activeItemElement === void 0 ? void 0 : activeItemElement.click();
|
|
106
105
|
break;
|
|
107
106
|
}
|
|
108
107
|
}, [rtl, items, activeItemIndex, dispatch, vertical]); // Only used for handling click events bubbling from children
|
|
@@ -124,7 +123,7 @@ export default function Menubar(_ref) {
|
|
|
124
123
|
onBlur: onBlur,
|
|
125
124
|
onKeyDown: onKeyDown,
|
|
126
125
|
onClick: onClick,
|
|
127
|
-
'aria-activedescendant': (
|
|
126
|
+
'aria-activedescendant': isNil(activeItemIndex) ? undefined : items[activeItemIndex].element.id,
|
|
128
127
|
'aria-orientation': vertical ? 'vertical' : undefined // implicitly set 'horizontal'
|
|
129
128
|
|
|
130
129
|
}, menubarElementRef));
|
package/esm/Menu/useMenu.js
CHANGED
|
@@ -43,8 +43,10 @@ export function menuReducer(state, action) {
|
|
|
43
43
|
|
|
44
44
|
switch (action.to) {
|
|
45
45
|
case MoveFocusTo.Next:
|
|
46
|
-
for (var i =
|
|
47
|
-
|
|
46
|
+
for (var i = activeItemIndex === null ? 0 : activeItemIndex + 1; i < items.length; i++) {
|
|
47
|
+
var _items$i$props;
|
|
48
|
+
|
|
49
|
+
if (!((_items$i$props = items[i].props) !== null && _items$i$props !== void 0 && _items$i$props.disabled)) {
|
|
48
50
|
nextActiveItemIndex = i;
|
|
49
51
|
break;
|
|
50
52
|
}
|
|
@@ -53,8 +55,10 @@ export function menuReducer(state, action) {
|
|
|
53
55
|
break;
|
|
54
56
|
|
|
55
57
|
case MoveFocusTo.Prev:
|
|
56
|
-
for (var _i =
|
|
57
|
-
|
|
58
|
+
for (var _i = activeItemIndex === null ? items.length - 1 : activeItemIndex - 1; _i >= 0; _i--) {
|
|
59
|
+
var _items$_i$props;
|
|
60
|
+
|
|
61
|
+
if (!((_items$_i$props = items[_i].props) !== null && _items$_i$props !== void 0 && _items$_i$props.disabled)) {
|
|
58
62
|
nextActiveItemIndex = _i;
|
|
59
63
|
break;
|
|
60
64
|
}
|
|
@@ -64,7 +68,9 @@ export function menuReducer(state, action) {
|
|
|
64
68
|
|
|
65
69
|
case MoveFocusTo.First:
|
|
66
70
|
for (var _i2 = 0; _i2 < items.length; _i2++) {
|
|
67
|
-
|
|
71
|
+
var _items$_i2$props;
|
|
72
|
+
|
|
73
|
+
if (!((_items$_i2$props = items[_i2].props) !== null && _items$_i2$props !== void 0 && _items$_i2$props.disabled)) {
|
|
68
74
|
nextActiveItemIndex = _i2;
|
|
69
75
|
break;
|
|
70
76
|
}
|
|
@@ -74,7 +80,9 @@ export function menuReducer(state, action) {
|
|
|
74
80
|
|
|
75
81
|
case MoveFocusTo.Last:
|
|
76
82
|
for (var _i3 = items.length - 1; _i3 >= 0; _i3--) {
|
|
77
|
-
|
|
83
|
+
var _items$_i3$props;
|
|
84
|
+
|
|
85
|
+
if (!((_items$_i3$props = items[_i3].props) !== null && _items$_i3$props !== void 0 && _items$_i3$props.disabled)) {
|
|
78
86
|
nextActiveItemIndex = _i3;
|
|
79
87
|
break;
|
|
80
88
|
}
|
|
@@ -84,7 +92,9 @@ export function menuReducer(state, action) {
|
|
|
84
92
|
|
|
85
93
|
case MoveFocusTo.Specific:
|
|
86
94
|
for (var _i4 = 0; _i4 < items.length; _i4++) {
|
|
87
|
-
|
|
95
|
+
var _items$_i4$props;
|
|
96
|
+
|
|
97
|
+
if (items[_i4].element.id === action.id && !((_items$_i4$props = items[_i4].props) !== null && _items$_i4$props !== void 0 && _items$_i4$props.disabled)) {
|
|
88
98
|
nextActiveItemIndex = _i4;
|
|
89
99
|
break;
|
|
90
100
|
}
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -8,7 +8,7 @@ import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react'
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import pick from 'lodash/pick';
|
|
10
10
|
import on from 'dom-lib/on';
|
|
11
|
-
import
|
|
11
|
+
import getAnimationEnd from 'dom-lib/getAnimationEnd';
|
|
12
12
|
import BaseModal, { modalPropTypes } from '../Overlay/Modal';
|
|
13
13
|
import Bounce from '../Animation/Bounce';
|
|
14
14
|
import { useClassNames, mergeRefs, SIZE } from '../utils';
|
|
@@ -43,7 +43,8 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
43
|
animationTimeout = _props$animationTimeo === void 0 ? 300 : _props$animationTimeo,
|
|
44
44
|
_props$overflow = props.overflow,
|
|
45
45
|
overflow = _props$overflow === void 0 ? true : _props$overflow,
|
|
46
|
-
drawer = props.drawer,
|
|
46
|
+
_props$drawer = props.drawer,
|
|
47
|
+
drawer = _props$drawer === void 0 ? false : _props$drawer,
|
|
47
48
|
onClose = props.onClose,
|
|
48
49
|
onEntered = props.onEntered,
|
|
49
50
|
onEntering = props.onEntering,
|
|
@@ -66,7 +67,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
67
|
var classes = merge(className, prefix(size, {
|
|
67
68
|
full: full
|
|
68
69
|
}));
|
|
69
|
-
var dialogRef = useRef();
|
|
70
|
+
var dialogRef = useRef(null);
|
|
70
71
|
var transitionEndListener = useRef(); // The style of the Modal body will be updated with the size of the window or container.
|
|
71
72
|
|
|
72
73
|
var _useBodyStyles = useBodyStyles(dialogRef, {
|
|
@@ -98,9 +99,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
98
99
|
// When the value of `backdrop` is `static`, a jitter animation will be added to the dialog when clicked.
|
|
99
100
|
if (backdrop === 'static') {
|
|
100
101
|
setShake(true);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
|
|
103
|
+
if (!transitionEndListener.current && dialogRef.current) {
|
|
104
|
+
//fix: https://github.com/rsuite/rsuite/blob/a93d13c14fb20cc58204babe3331d3c3da3fe1fd/src/Modal/styles/index.less#L59
|
|
105
|
+
transitionEndListener.current = on(dialogRef.current, getAnimationEnd(), function () {
|
|
106
|
+
setShake(false);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
104
109
|
}
|
|
105
110
|
}, [backdrop]);
|
|
106
111
|
var handleExited = useCallback(function (node) {
|
|
@@ -109,6 +114,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
109
114
|
onExited === null || onExited === void 0 ? void 0 : onExited(node);
|
|
110
115
|
onDestroyEvents();
|
|
111
116
|
(_transitionEndListene = transitionEndListener.current) === null || _transitionEndListene === void 0 ? void 0 : _transitionEndListene.off();
|
|
117
|
+
transitionEndListener.current = null;
|
|
112
118
|
}, [onDestroyEvents, onExited]);
|
|
113
119
|
var handleEntered = useCallback(function (node) {
|
|
114
120
|
onEntered === null || onEntered === void 0 ? void 0 : onEntered(node);
|
|
@@ -3,10 +3,10 @@ export interface ModalContextProps {
|
|
|
3
3
|
/** ID of the dialog element */
|
|
4
4
|
dialogId: string;
|
|
5
5
|
/** Pass the close event callback to the header close button. */
|
|
6
|
-
onModalClose
|
|
6
|
+
onModalClose?: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
7
7
|
/** Pass the latest style to body. */
|
|
8
8
|
getBodyStyles?: () => React.CSSProperties;
|
|
9
9
|
/** Whether this Modal is a Drawer */
|
|
10
10
|
isDrawer: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const ModalContext: React.Context<ModalContextProps>;
|
|
12
|
+
export declare const ModalContext: React.Context<ModalContextProps | null>;
|
package/esm/Modal/utils.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export declare const useBodyStyles: (ref: React.RefObject<HTMLElement>, options:
|
|
|
3
3
|
overflow: boolean;
|
|
4
4
|
drawer: boolean;
|
|
5
5
|
prefix: (...classes: any) => string;
|
|
6
|
-
}) => [import("react").CSSProperties, (entering?: boolean) => void, () => void];
|
|
6
|
+
}) => [import("react").CSSProperties, (entering?: boolean | undefined) => void, () => void];
|
package/esm/Modal/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ export var useBodyStyles = function useBodyStyles(ref, options) {
|
|
|
11
11
|
drawer = options.drawer,
|
|
12
12
|
prefix = options.prefix;
|
|
13
13
|
var windowResizeListener = useRef();
|
|
14
|
-
var contentElement = useRef();
|
|
14
|
+
var contentElement = useRef(null);
|
|
15
15
|
var contentElementResizeObserver = useRef();
|
|
16
16
|
var updateBodyStyles = useCallback(function (_event, entering) {
|
|
17
17
|
var dialog = ref.current;
|
|
@@ -48,10 +48,8 @@ export var useBodyStyles = function useBodyStyles(ref, options) {
|
|
|
48
48
|
}, []);
|
|
49
49
|
var onChangeBodyStyles = useCallback(function (entering) {
|
|
50
50
|
if (overflow && !drawer) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
updateBodyStyles(null, entering);
|
|
54
|
-
contentElement.current = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("." + prefix('content'));
|
|
51
|
+
updateBodyStyles(undefined, entering);
|
|
52
|
+
contentElement.current = ref.current.querySelector("." + prefix('content'));
|
|
55
53
|
windowResizeListener.current = on(window, 'resize', updateBodyStyles);
|
|
56
54
|
contentElementResizeObserver.current = new ResizeObserver(function () {
|
|
57
55
|
return updateBodyStyles();
|
|
@@ -3,15 +3,15 @@ import { ItemDataType, WithAsProps, RsRefForwardingComponent } from '../@types/c
|
|
|
3
3
|
import { ValueType } from './MultiCascader';
|
|
4
4
|
export interface DropdownMenuProps extends WithAsProps {
|
|
5
5
|
disabledItemValues: ValueType;
|
|
6
|
-
value
|
|
6
|
+
value: ValueType;
|
|
7
7
|
childrenKey: string;
|
|
8
8
|
valueKey: string;
|
|
9
9
|
labelKey: string;
|
|
10
|
-
menuWidth
|
|
11
|
-
menuHeight
|
|
10
|
+
menuWidth?: number;
|
|
11
|
+
menuHeight?: number | string;
|
|
12
12
|
cascade?: boolean;
|
|
13
13
|
cascadeData: ItemDataType[][];
|
|
14
|
-
cascadePaths
|
|
14
|
+
cascadePaths?: ItemDataType[];
|
|
15
15
|
uncheckableItemValues: ValueType;
|
|
16
16
|
renderMenuItem?: (itemLabel: React.MouseEventHandler, item: ItemDataType) => React.ReactNode;
|
|
17
17
|
renderMenu?: (children: ItemDataType[], menu: React.ReactNode, parentNode?: ItemDataType, layer?: number) => React.ReactNode;
|
|
@@ -113,10 +113,10 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
113
113
|
selectedPaths = _useState2[0],
|
|
114
114
|
setSelectedPaths = _useState2[1];
|
|
115
115
|
|
|
116
|
-
var triggerRef = useRef();
|
|
117
|
-
var overlayRef = useRef();
|
|
118
|
-
var targetRef = useRef();
|
|
119
|
-
var searchInputRef = useRef();
|
|
116
|
+
var triggerRef = useRef(null);
|
|
117
|
+
var overlayRef = useRef(null);
|
|
118
|
+
var targetRef = useRef(null);
|
|
119
|
+
var searchInputRef = useRef(null);
|
|
120
120
|
usePublicMethods(ref, {
|
|
121
121
|
triggerRef: triggerRef,
|
|
122
122
|
overlayRef: overlayRef,
|
|
@@ -164,7 +164,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
164
164
|
*/
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
var hasValue = selectedItems.length > 0 || (valueProp === null || valueProp === void 0 ? void 0 : valueProp.length) > 0 && isFunction(renderValue);
|
|
167
|
+
var hasValue = selectedItems.length > 0 || Number(valueProp === null || valueProp === void 0 ? void 0 : valueProp.length) > 0 && isFunction(renderValue);
|
|
168
168
|
|
|
169
169
|
var _useClassNames = useClassNames(classPrefix),
|
|
170
170
|
prefix = _useClassNames.prefix,
|
|
@@ -446,7 +446,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
if (hasValue && isFunction(renderValue)) {
|
|
449
|
-
selectedElement = renderValue(value.length ? value : valueProp, selectedItems, selectedElement); // If renderValue returns null or undefined, hasValue is false.
|
|
449
|
+
selectedElement = renderValue(value.length ? value : valueProp !== null && valueProp !== void 0 ? valueProp : [], selectedItems, selectedElement); // If renderValue returns null or undefined, hasValue is false.
|
|
450
450
|
|
|
451
451
|
if (isNil(selectedElement)) {
|
|
452
452
|
hasValue = false;
|
|
@@ -5,34 +5,34 @@ export interface ItemType extends ItemDataType {
|
|
|
5
5
|
parent?: ItemType;
|
|
6
6
|
}
|
|
7
7
|
interface ItemKeys {
|
|
8
|
-
valueKey
|
|
9
|
-
labelKey
|
|
10
|
-
childrenKey
|
|
8
|
+
valueKey: string;
|
|
9
|
+
labelKey: string;
|
|
10
|
+
childrenKey: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get all parents of a node
|
|
14
14
|
* @param node
|
|
15
15
|
*/
|
|
16
|
-
export declare const getParents: (node: ItemType) =>
|
|
16
|
+
export declare const getParents: (node: ItemType) => ItemType[];
|
|
17
17
|
/**
|
|
18
18
|
* Check if any child nodes are selected.
|
|
19
19
|
* @param node
|
|
20
20
|
* @param value
|
|
21
21
|
* @param itemKeys
|
|
22
22
|
*/
|
|
23
|
-
export declare const isSomeChildChecked: (node: ItemDataType, value: ValueType, itemKeys: ItemKeys) => any;
|
|
23
|
+
export declare const isSomeChildChecked: (node: ItemDataType, value: ValueType, itemKeys: Omit<ItemKeys, 'labelKey'>) => any;
|
|
24
24
|
/**
|
|
25
25
|
* Check if the parent is selected.
|
|
26
26
|
* @param node
|
|
27
27
|
* @param value
|
|
28
28
|
* @param itemKeys
|
|
29
29
|
*/
|
|
30
|
-
export declare const isSomeParentChecked: (node: ItemDataType, value: ValueType, itemKeys: ItemKeys) => any;
|
|
31
|
-
export declare const getOtherItemValuesByUnselectChild: (itemNode: ItemType, value: any, itemKeys: ItemKeys) =>
|
|
30
|
+
export declare const isSomeParentChecked: (node: ItemDataType, value: ValueType, itemKeys: Pick<ItemKeys, 'valueKey'>) => any;
|
|
31
|
+
export declare const getOtherItemValuesByUnselectChild: <T>(itemNode: ItemType, value: any, itemKeys: Omit<ItemKeys, 'labelKey'>) => T[];
|
|
32
32
|
/**
|
|
33
33
|
* Remove the values of all children.
|
|
34
34
|
*/
|
|
35
|
-
export declare const removeAllChildrenValue: (value:
|
|
35
|
+
export declare const removeAllChildrenValue: <T>(value: T[], item: ItemType, itemKeys: Omit<ItemKeys, 'labelKey'>) => T[] | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* A hook to flatten tree structure data
|
|
38
38
|
* @param data
|
|
@@ -56,12 +56,12 @@ export declare function useColumnData(flattenData: ItemType[]): {
|
|
|
56
56
|
* @param props
|
|
57
57
|
* @param flattenData
|
|
58
58
|
*/
|
|
59
|
-
export declare function useCascadeValue(props: Partial<MultiCascaderProps
|
|
60
|
-
value:
|
|
61
|
-
setValue: import("react").Dispatch<import("react").SetStateAction<
|
|
62
|
-
splitValue: (item: ItemType, checked: boolean, value:
|
|
63
|
-
value:
|
|
64
|
-
removedValue:
|
|
59
|
+
export declare function useCascadeValue<T>(props: Partial<MultiCascaderProps<T[]>> & ItemKeys, flattenData: ItemType[]): {
|
|
60
|
+
value: T[];
|
|
61
|
+
setValue: import("react").Dispatch<import("react").SetStateAction<T[]>>;
|
|
62
|
+
splitValue: (item: ItemType, checked: boolean, value: T[]) => {
|
|
63
|
+
value: T[];
|
|
64
|
+
removedValue: T[];
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
export {};
|
package/esm/Nav/Nav.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface NavProps<T = any> extends WithAsProps, Omit<React.HTMLAttribute
|
|
|
16
16
|
/** Active key, corresponding to eventkey in <Nav.item>. */
|
|
17
17
|
activeKey?: T;
|
|
18
18
|
/** Callback function triggered after selection */
|
|
19
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
19
|
+
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
20
20
|
}
|
|
21
21
|
interface NavComponent extends RsRefForwardingComponent<'div', NavProps> {
|
|
22
22
|
Dropdown: typeof Dropdown;
|
package/esm/Nav/NavContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface NavContextProps {
|
|
3
3
|
activeKey: string | null;
|
|
4
|
-
onSelect
|
|
4
|
+
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
5
5
|
}
|
|
6
6
|
declare const NavContext: React.Context<NavContextProps>;
|
|
7
7
|
export default NavContext;
|
package/esm/Nav/NavItem.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface NavItemProps<T = string> extends WithAsProps, Omit<React.HTMLAt
|
|
|
17
17
|
/** Providing a `href` will render an `<a>` element */
|
|
18
18
|
href?: string;
|
|
19
19
|
/** Select the callback function that the event triggers. */
|
|
20
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
20
|
+
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* The <Nav.Item> API
|
package/esm/Navbar/Navbar.js
CHANGED
|
@@ -5,7 +5,7 @@ import NavbarBody from './NavbarBody';
|
|
|
5
5
|
import NavbarHeader from './NavbarHeader';
|
|
6
6
|
import NavbarBrand from './NavbarBrand';
|
|
7
7
|
import { useClassNames } from '../utils';
|
|
8
|
-
export var NavbarContext = /*#__PURE__*/React.createContext(
|
|
8
|
+
export var NavbarContext = /*#__PURE__*/React.createContext(false);
|
|
9
9
|
var Navbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
10
10
|
var className = props.className,
|
|
11
11
|
_props$as = props.as,
|
|
@@ -13,7 +13,7 @@ export interface NavItemProps<T = string> extends WithAsProps, Omit<React.HTMLAt
|
|
|
13
13
|
/** Providing a `href` will render an `<a>` element */
|
|
14
14
|
href?: string;
|
|
15
15
|
/** Select the callback function that the event triggers. */
|
|
16
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
16
|
+
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
17
17
|
}
|
|
18
18
|
declare const NavbarItem: RsRefForwardingComponent<'a', NavItemProps>;
|
|
19
19
|
export default NavbarItem;
|
package/esm/Overlay/Modal.d.ts
CHANGED
|
@@ -44,8 +44,8 @@ interface ModalProps extends BaseModalProps {
|
|
|
44
44
|
containerClassName?: string;
|
|
45
45
|
backdropTransitionTimeout?: number;
|
|
46
46
|
dialogTransitionTimeout?: number;
|
|
47
|
-
transition
|
|
48
|
-
|
|
47
|
+
transition?: React.ElementType;
|
|
48
|
+
onEsc?: React.KeyboardEventHandler;
|
|
49
49
|
onBackdropClick?: React.MouseEventHandler;
|
|
50
50
|
}
|
|
51
51
|
declare const Modal: RsRefForwardingComponent<'div', ModalProps>;
|
package/esm/Overlay/Modal.js
CHANGED
|
@@ -10,7 +10,7 @@ import on from 'dom-lib/on';
|
|
|
10
10
|
import ModalManager from './ModalManager';
|
|
11
11
|
import Fade from '../Animation/Fade';
|
|
12
12
|
import { animationPropTypes } from '../Animation/utils';
|
|
13
|
-
import { mergeRefs,
|
|
13
|
+
import { mergeRefs, usePortal, createChainedFunction, useWillUnmount, KEY_VALUES } from '../utils';
|
|
14
14
|
var manager;
|
|
15
15
|
|
|
16
16
|
function getManager() {
|
|
@@ -25,6 +25,12 @@ var useModalManager = function useModalManager() {
|
|
|
25
25
|
backdrop: null
|
|
26
26
|
});
|
|
27
27
|
return {
|
|
28
|
+
get dialog() {
|
|
29
|
+
var _modal$current;
|
|
30
|
+
|
|
31
|
+
return (_modal$current = modal.current) === null || _modal$current === void 0 ? void 0 : _modal$current.dialog;
|
|
32
|
+
},
|
|
33
|
+
|
|
28
34
|
add: function add(containerElement, containerClassName) {
|
|
29
35
|
return modalManager.add(modal.current, containerElement, containerClassName);
|
|
30
36
|
},
|
|
@@ -67,7 +73,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
67
73
|
_props$autoFocus = props.autoFocus,
|
|
68
74
|
autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
|
|
69
75
|
onBackdropClick = props.onBackdropClick,
|
|
70
|
-
|
|
76
|
+
onEsc = props.onEsc,
|
|
71
77
|
onExit = props.onExit,
|
|
72
78
|
onExiting = props.onExiting,
|
|
73
79
|
onExited = props.onExited,
|
|
@@ -76,7 +82,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
76
82
|
onEntered = props.onEntered,
|
|
77
83
|
onClose = props.onClose,
|
|
78
84
|
onOpen = props.onOpen,
|
|
79
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onBackdropClick", "
|
|
85
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onBackdropClick", "onEsc", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
|
|
80
86
|
|
|
81
87
|
var _useState = useState(!open),
|
|
82
88
|
exited = _useState[0],
|
|
@@ -96,19 +102,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
var mountModal = open || Transition && !exited;
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
onEscapeKeyUp === null || onEscapeKeyUp === void 0 ? void 0 : onEscapeKeyUp(event);
|
|
105
|
+
var lastFocus = useRef(null);
|
|
106
|
+
var handleDocumentKeyDown = useCallback(function (event) {
|
|
107
|
+
if (keyboard && event.key === KEY_VALUES.ESC && modal.isTopModal()) {
|
|
108
|
+
onEsc === null || onEsc === void 0 ? void 0 : onEsc(event);
|
|
104
109
|
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
105
110
|
}
|
|
106
|
-
}, [keyboard, modal,
|
|
107
|
-
var checkForFocus = useCallback(function () {
|
|
108
|
-
if (canUseDOM) {
|
|
109
|
-
lastFocus.current = document.activeElement;
|
|
110
|
-
}
|
|
111
|
-
}, []);
|
|
111
|
+
}, [keyboard, modal, onEsc, onClose]);
|
|
112
112
|
var restoreLastFocus = useCallback(function () {
|
|
113
113
|
if (lastFocus.current) {
|
|
114
114
|
var _lastFocus$current$fo, _lastFocus$current;
|
|
@@ -117,21 +117,18 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
117
117
|
lastFocus.current = null;
|
|
118
118
|
}
|
|
119
119
|
}, []);
|
|
120
|
-
var getDialogElement = useCallback(function () {
|
|
121
|
-
return getDOMNode(rootRef.current);
|
|
122
|
-
}, []);
|
|
123
120
|
var handleEnforceFocus = useCallback(function () {
|
|
124
121
|
if (!enforceFocus || !modal.isTopModal()) {
|
|
125
122
|
return;
|
|
126
123
|
}
|
|
127
124
|
|
|
128
125
|
var currentActiveElement = document.activeElement;
|
|
129
|
-
var dialog =
|
|
126
|
+
var dialog = modal.dialog;
|
|
130
127
|
|
|
131
128
|
if (dialog && dialog !== currentActiveElement && !contains(dialog, currentActiveElement)) {
|
|
132
129
|
dialog.focus();
|
|
133
130
|
}
|
|
134
|
-
}, [enforceFocus,
|
|
131
|
+
}, [enforceFocus, modal]);
|
|
135
132
|
var handleBackdropClick = useCallback(function (event) {
|
|
136
133
|
if (event.target !== event.currentTarget) {
|
|
137
134
|
return;
|
|
@@ -143,27 +140,40 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
143
140
|
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
144
141
|
}
|
|
145
142
|
}, [backdrop, onBackdropClick, onClose]);
|
|
146
|
-
var
|
|
147
|
-
var
|
|
143
|
+
var documentKeyDownListener = useRef();
|
|
144
|
+
var documentFocusListener = useRef();
|
|
148
145
|
var handleOpen = useCallback(function () {
|
|
149
|
-
var dialog = getDialogElement();
|
|
150
146
|
var containerElement = getContainer(container, document.body);
|
|
151
147
|
modal.add(containerElement, containerClassName);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
|
|
149
|
+
if (!documentKeyDownListener.current) {
|
|
150
|
+
documentKeyDownListener.current = on(document, 'keydown', handleDocumentKeyDown);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!documentFocusListener.current) {
|
|
154
|
+
documentFocusListener.current = on(document, 'focus', handleEnforceFocus, true);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (canUseDOM) {
|
|
158
|
+
lastFocus.current = document.activeElement;
|
|
159
|
+
}
|
|
156
160
|
|
|
157
161
|
if (autoFocus) {
|
|
158
|
-
|
|
162
|
+
var _modal$dialog;
|
|
163
|
+
|
|
164
|
+
(_modal$dialog = modal.dialog) === null || _modal$dialog === void 0 ? void 0 : _modal$dialog.focus();
|
|
159
165
|
}
|
|
160
|
-
|
|
166
|
+
|
|
167
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
168
|
+
}, [autoFocus, container, containerClassName, handleDocumentKeyDown, handleEnforceFocus, modal, onOpen]);
|
|
161
169
|
var handleClose = useCallback(function () {
|
|
162
|
-
var
|
|
170
|
+
var _documentKeyDownListe, _documentFocusListene;
|
|
163
171
|
|
|
164
172
|
modal.remove();
|
|
165
|
-
(
|
|
166
|
-
|
|
173
|
+
(_documentKeyDownListe = documentKeyDownListener.current) === null || _documentKeyDownListe === void 0 ? void 0 : _documentKeyDownListe.off();
|
|
174
|
+
documentKeyDownListener.current = null;
|
|
175
|
+
(_documentFocusListene = documentFocusListener.current) === null || _documentFocusListene === void 0 ? void 0 : _documentFocusListene.off();
|
|
176
|
+
documentFocusListener.current = null;
|
|
167
177
|
restoreLastFocus();
|
|
168
178
|
}, [modal, restoreLastFocus]);
|
|
169
179
|
useEffect(function () {
|
|
@@ -264,7 +274,7 @@ Modal.propTypes = _extends({}, animationPropTypes, modalPropTypes, {
|
|
|
264
274
|
dialogTransitionTimeout: PropTypes.number,
|
|
265
275
|
backdropTransitionTimeout: PropTypes.number,
|
|
266
276
|
transition: PropTypes.any,
|
|
267
|
-
|
|
277
|
+
onEsc: PropTypes.func,
|
|
268
278
|
onBackdropClick: PropTypes.func
|
|
269
279
|
});
|
|
270
280
|
export default Modal;
|