rsuite 5.2.4 → 5.4.2
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 +61 -0
- package/CheckTreePicker/styles/index.less +14 -1
- package/Dropdown/styles/index.less +4 -3
- package/Modal/styles/index.less +23 -22
- package/Nav/styles/index.less +1 -0
- package/Navbar/styles/index.less +19 -5
- package/Radio/styles/index.less +6 -0
- package/Sidenav/styles/index.less +2 -2
- package/Stack/package.json +7 -0
- package/Stack/styles/index.less +5 -0
- package/TreePicker/styles/index.less +10 -14
- package/cjs/@types/common.d.ts +13 -12
- package/cjs/@types/utils.d.ts +12 -0
- package/cjs/Affix/Affix.js +8 -6
- 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 +76 -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 +14 -3
- 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 +26 -22
- package/cjs/Calendar/CalendarContext.js +1 -1
- package/cjs/Calendar/Header.js +1 -3
- package/cjs/Calendar/Table.js +1 -1
- package/cjs/Calendar/TableRow.js +13 -8
- package/cjs/Calendar/TimeDropdown.js +6 -5
- package/cjs/Calendar/View.js +9 -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 +10 -10
- package/cjs/CheckPicker/CheckPicker.d.ts +9 -4
- package/cjs/CheckPicker/CheckPicker.js +4 -4
- package/cjs/CheckPicker/test/CheckPicker.test.d.ts +1 -0
- package/cjs/CheckPicker/test/CheckPicker.test.js +76 -0
- package/cjs/CheckTree/index.js +6 -5
- 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/Container/Container.js +6 -3
- 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 +19 -11
- 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 +112 -111
- 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.d.ts +8 -5
- package/cjs/Disclosure/Disclosure.js +55 -13
- package/cjs/Disclosure/DisclosureButton.d.ts +2 -2
- package/cjs/Disclosure/DisclosureButton.js +9 -7
- package/cjs/Disclosure/DisclosureContent.js +4 -6
- package/cjs/Disclosure/DisclosureContext.d.ts +8 -3
- 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/Dropdown.js +1 -1
- package/cjs/Dropdown/DropdownContext.d.ts +2 -2
- package/cjs/Dropdown/DropdownItem.js +10 -11
- package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
- package/cjs/Dropdown/DropdownMenu.js +81 -23
- package/cjs/Dropdown/DropdownState.d.ts +1 -1
- package/cjs/Dropdown/DropdownToggle.js +10 -2
- 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/FormGroup/FormGroup.js +9 -4
- 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 +39 -21
- 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 +17 -17
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/Nav.js +10 -12
- package/cjs/Nav/NavContext.d.ts +7 -1
- package/cjs/Nav/NavContext.js +1 -0
- 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/Navbar/index.d.ts +1 -0
- package/cjs/Navbar/index.js +4 -3
- package/cjs/Overlay/Modal.d.ts +2 -2
- package/cjs/Overlay/Modal.js +71 -63
- package/cjs/Overlay/ModalManager.d.ts +17 -8
- package/cjs/Overlay/ModalManager.js +11 -20
- package/cjs/Overlay/Overlay.d.ts +3 -3
- package/cjs/Overlay/Overlay.js +8 -2
- package/cjs/Overlay/OverlayContext.d.ts +6 -0
- package/cjs/Overlay/OverlayContext.js +14 -0
- package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
- package/cjs/Overlay/OverlayTrigger.js +21 -7
- package/cjs/Overlay/Position.d.ts +4 -4
- 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/PanelGroup/PanelGroup.js +8 -5
- 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 +5 -7
- package/cjs/Picker/propTypes.js +4 -3
- package/cjs/Picker/utils.d.ts +11 -11
- 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.d.ts +12 -5
- package/cjs/SelectPicker/SelectPicker.js +8 -8
- package/cjs/SelectPicker/index.d.ts +1 -1
- package/cjs/SelectPicker/test/SelectPicker.test.d.ts +1 -0
- package/cjs/SelectPicker/test/SelectPicker.test.js +62 -0
- 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/Stack/Stack.d.ts +26 -0
- package/cjs/Stack/Stack.js +86 -0
- package/cjs/Stack/index.d.ts +3 -0
- package/cjs/Stack/index.js +11 -0
- package/cjs/Steps/StepItem.js +1 -1
- package/cjs/TagInput/index.js +1 -1
- package/cjs/Toggle/Toggle.js +5 -4
- package/cjs/Tree/Tree.d.ts +3 -2
- package/cjs/Tree/Tree.js +6 -5
- package/cjs/Tree/TreeContext.d.ts +0 -1
- package/cjs/TreePicker/TreeNode.js +7 -22
- package/cjs/TreePicker/TreePicker.js +32 -52
- 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 +6 -2
- package/cjs/index.js +13 -5
- 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/index.d.ts +1 -0
- package/cjs/utils/index.js +7 -2
- 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 +35 -32
- 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/useMount.d.ts +2 -0
- package/cjs/utils/useMount.js +19 -0
- package/cjs/utils/usePortal.d.ts +2 -2
- 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 +95 -210
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +95 -210
- package/dist/rsuite.js +214 -115
- 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 +13 -12
- package/esm/@types/utils.d.ts +12 -0
- package/esm/Affix/Affix.js +9 -7
- 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 +57 -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 +11 -3
- 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 +27 -23
- package/esm/Calendar/CalendarContext.js +1 -1
- package/esm/Calendar/Header.js +1 -3
- package/esm/Calendar/Table.js +1 -1
- package/esm/Calendar/TableRow.js +14 -9
- package/esm/Calendar/TimeDropdown.js +5 -4
- package/esm/Calendar/View.js +10 -6
- 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 +10 -10
- package/esm/CheckPicker/CheckPicker.d.ts +9 -4
- package/esm/CheckPicker/CheckPicker.js +4 -4
- package/esm/CheckPicker/test/CheckPicker.test.d.ts +1 -0
- package/esm/CheckPicker/test/CheckPicker.test.js +64 -0
- package/esm/CheckTree/index.js +7 -6
- 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/Container/Container.js +7 -4
- 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 +18 -11
- 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 +112 -111
- 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.d.ts +8 -5
- package/esm/Disclosure/Disclosure.js +56 -15
- package/esm/Disclosure/DisclosureButton.d.ts +2 -2
- package/esm/Disclosure/DisclosureButton.js +8 -7
- package/esm/Disclosure/DisclosureContent.js +5 -7
- package/esm/Disclosure/DisclosureContext.d.ts +8 -3
- 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/Dropdown.js +1 -1
- package/esm/Dropdown/DropdownContext.d.ts +2 -2
- package/esm/Dropdown/DropdownItem.js +10 -10
- package/esm/Dropdown/DropdownMenu.d.ts +3 -3
- package/esm/Dropdown/DropdownMenu.js +82 -24
- package/esm/Dropdown/DropdownState.d.ts +1 -1
- package/esm/Dropdown/DropdownToggle.js +9 -2
- 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/FormGroup/FormGroup.js +7 -4
- 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 +41 -23
- 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 +17 -17
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/Nav.js +11 -13
- package/esm/Nav/NavContext.d.ts +7 -1
- package/esm/Nav/NavContext.js +1 -0
- 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/Navbar/index.d.ts +1 -0
- package/esm/Navbar/index.js +1 -0
- package/esm/Overlay/Modal.d.ts +2 -2
- package/esm/Overlay/Modal.js +72 -64
- package/esm/Overlay/ModalManager.d.ts +17 -8
- package/esm/Overlay/ModalManager.js +11 -20
- package/esm/Overlay/Overlay.d.ts +3 -3
- package/esm/Overlay/Overlay.js +8 -3
- package/esm/Overlay/OverlayContext.d.ts +6 -0
- package/esm/Overlay/OverlayContext.js +4 -0
- package/esm/Overlay/OverlayTrigger.d.ts +11 -11
- package/esm/Overlay/OverlayTrigger.js +21 -8
- package/esm/Overlay/Position.d.ts +4 -4
- 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/PanelGroup/PanelGroup.js +9 -6
- 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 +5 -7
- package/esm/Picker/propTypes.js +4 -3
- package/esm/Picker/utils.d.ts +11 -11
- 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.d.ts +12 -5
- package/esm/SelectPicker/SelectPicker.js +8 -8
- package/esm/SelectPicker/index.d.ts +1 -1
- package/esm/SelectPicker/test/SelectPicker.test.d.ts +1 -0
- package/esm/SelectPicker/test/SelectPicker.test.js +52 -0
- 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/Stack/Stack.d.ts +26 -0
- package/esm/Stack/Stack.js +71 -0
- package/esm/Stack/index.d.ts +3 -0
- package/esm/Stack/index.js +2 -0
- package/esm/Steps/StepItem.js +1 -1
- package/esm/TagInput/index.js +1 -1
- package/esm/Toggle/Toggle.js +5 -4
- package/esm/Tree/Tree.d.ts +3 -2
- package/esm/Tree/Tree.js +7 -6
- package/esm/Tree/TreeContext.d.ts +0 -1
- package/esm/TreePicker/TreeNode.js +6 -21
- package/esm/TreePicker/TreePicker.js +31 -50
- 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 +6 -2
- package/esm/index.js +3 -1
- 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/index.d.ts +1 -0
- package/esm/utils/index.js +2 -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 +35 -32
- 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/useMount.d.ts +2 -0
- package/esm/utils/useMount.js +13 -0
- package/esm/utils/usePortal.d.ts +2 -2
- 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 +2 -0
package/esm/Overlay/Modal.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
3
|
+
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import canUseDOM from 'dom-lib/canUseDOM';
|
|
7
6
|
import contains from 'dom-lib/contains';
|
|
8
7
|
import getContainer from 'dom-lib/getContainer';
|
|
9
8
|
import on from 'dom-lib/on';
|
|
10
9
|
import ModalManager from './ModalManager';
|
|
11
10
|
import Fade from '../Animation/Fade';
|
|
12
11
|
import { animationPropTypes } from '../Animation/utils';
|
|
13
|
-
import { mergeRefs,
|
|
12
|
+
import { mergeRefs, usePortal, createChainedFunction, useWillUnmount, useEventCallback, KEY_VALUES } from '../utils';
|
|
13
|
+
import OverlayContext from './OverlayContext';
|
|
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
|
},
|
|
@@ -66,8 +72,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
72
|
open = props.open,
|
|
67
73
|
_props$autoFocus = props.autoFocus,
|
|
68
74
|
autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
|
|
69
|
-
|
|
70
|
-
onEscapeKeyUp = props.onEscapeKeyUp,
|
|
75
|
+
onEsc = props.onEsc,
|
|
71
76
|
onExit = props.onExit,
|
|
72
77
|
onExiting = props.onExiting,
|
|
73
78
|
onExited = props.onExited,
|
|
@@ -76,7 +81,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
76
81
|
onEntered = props.onEntered,
|
|
77
82
|
onClose = props.onClose,
|
|
78
83
|
onOpen = props.onOpen,
|
|
79
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "
|
|
84
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onEsc", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
|
|
80
85
|
|
|
81
86
|
var _useState = useState(!open),
|
|
82
87
|
exited = _useState[0],
|
|
@@ -96,19 +101,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
var mountModal = open || Transition && !exited;
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
onEscapeKeyUp === null || onEscapeKeyUp === void 0 ? void 0 : onEscapeKeyUp(event);
|
|
104
|
+
var lastFocus = useRef(null);
|
|
105
|
+
var handleDocumentKeyDown = useEventCallback(function (event) {
|
|
106
|
+
if (keyboard && event.key === KEY_VALUES.ESC && modal.isTopModal()) {
|
|
107
|
+
onEsc === null || onEsc === void 0 ? void 0 : onEsc(event);
|
|
104
108
|
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
105
109
|
}
|
|
106
|
-
}
|
|
107
|
-
var checkForFocus = useCallback(function () {
|
|
108
|
-
if (canUseDOM) {
|
|
109
|
-
lastFocus.current = document.activeElement;
|
|
110
|
-
}
|
|
111
|
-
}, []);
|
|
110
|
+
});
|
|
112
111
|
var restoreLastFocus = useCallback(function () {
|
|
113
112
|
if (lastFocus.current) {
|
|
114
113
|
var _lastFocus$current$fo, _lastFocus$current;
|
|
@@ -117,55 +116,60 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
117
116
|
lastFocus.current = null;
|
|
118
117
|
}
|
|
119
118
|
}, []);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
119
|
+
/**
|
|
120
|
+
* Determines if the currently focused element is inside the dialog,
|
|
121
|
+
* and if not, returns the focus to the dialog.
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
127
124
|
|
|
125
|
+
var handleFocusDialog = useEventCallback(function (onBeforeFocusCallback) {
|
|
128
126
|
var currentActiveElement = document.activeElement;
|
|
129
|
-
var dialog =
|
|
127
|
+
var dialog = modal.dialog;
|
|
130
128
|
|
|
131
|
-
if (dialog &&
|
|
129
|
+
if (dialog && currentActiveElement && !contains(dialog, currentActiveElement)) {
|
|
130
|
+
onBeforeFocusCallback === null || onBeforeFocusCallback === void 0 ? void 0 : onBeforeFocusCallback();
|
|
132
131
|
dialog.focus();
|
|
133
132
|
}
|
|
134
|
-
}
|
|
135
|
-
var
|
|
136
|
-
if (
|
|
133
|
+
});
|
|
134
|
+
var handleEnforceFocus = useEventCallback(function () {
|
|
135
|
+
if (!enforceFocus || !modal.isTopModal()) {
|
|
137
136
|
return;
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, [backdrop, onBackdropClick, onClose]);
|
|
146
|
-
var documentKeyupListener = useRef();
|
|
147
|
-
var docusinListener = useRef();
|
|
148
|
-
var handleOpen = useCallback(function () {
|
|
149
|
-
var dialog = getDialogElement();
|
|
139
|
+
handleFocusDialog();
|
|
140
|
+
});
|
|
141
|
+
var documentKeyDownListener = useRef();
|
|
142
|
+
var documentFocusListener = useRef();
|
|
143
|
+
var handleOpen = useEventCallback(function () {
|
|
150
144
|
var containerElement = getContainer(container, document.body);
|
|
151
145
|
modal.add(containerElement, containerClassName);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
|
|
147
|
+
if (!documentKeyDownListener.current) {
|
|
148
|
+
documentKeyDownListener.current = on(document, 'keydown', handleDocumentKeyDown);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (!documentFocusListener.current) {
|
|
152
|
+
documentFocusListener.current = on(document, 'focus', handleEnforceFocus, true);
|
|
153
|
+
}
|
|
156
154
|
|
|
157
155
|
if (autoFocus) {
|
|
158
|
-
|
|
156
|
+
handleFocusDialog(function () {
|
|
157
|
+
lastFocus.current = document.activeElement;
|
|
158
|
+
});
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
|
|
161
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
162
|
+
});
|
|
163
|
+
var handleClose = useEventCallback(function () {
|
|
164
|
+
var _documentKeyDownListe, _documentFocusListene;
|
|
163
165
|
|
|
164
166
|
modal.remove();
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
+
(_documentKeyDownListe = documentKeyDownListener.current) === null || _documentKeyDownListe === void 0 ? void 0 : _documentKeyDownListe.off();
|
|
168
|
+
documentKeyDownListener.current = null;
|
|
169
|
+
(_documentFocusListene = documentFocusListener.current) === null || _documentFocusListene === void 0 ? void 0 : _documentFocusListene.off();
|
|
170
|
+
documentFocusListener.current = null;
|
|
167
171
|
restoreLastFocus();
|
|
168
|
-
}
|
|
172
|
+
});
|
|
169
173
|
useEffect(function () {
|
|
170
174
|
if (!open) {
|
|
171
175
|
return;
|
|
@@ -186,17 +190,19 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
186
190
|
var handleExited = useCallback(function () {
|
|
187
191
|
setExited(true);
|
|
188
192
|
}, []);
|
|
193
|
+
var contextValue = useMemo(function () {
|
|
194
|
+
return {
|
|
195
|
+
overlayContainer: function overlayContainer() {
|
|
196
|
+
return modal.dialog;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}, [modal.dialog]);
|
|
189
200
|
|
|
190
201
|
if (!mountModal) {
|
|
191
202
|
return null;
|
|
192
203
|
}
|
|
193
204
|
|
|
194
205
|
var renderBackdrop = function renderBackdrop() {
|
|
195
|
-
var backdropPorps = {
|
|
196
|
-
style: backdropStyle,
|
|
197
|
-
onClick: handleBackdropClick
|
|
198
|
-
};
|
|
199
|
-
|
|
200
206
|
if (Transition) {
|
|
201
207
|
return /*#__PURE__*/React.createElement(Fade, {
|
|
202
208
|
transitionAppear: true,
|
|
@@ -208,18 +214,19 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
208
214
|
|
|
209
215
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
210
216
|
"aria-hidden": true
|
|
211
|
-
}, rest,
|
|
217
|
+
}, rest, {
|
|
218
|
+
style: backdropStyle,
|
|
212
219
|
ref: mergeRefs(modal.setBackdropRef, ref),
|
|
213
220
|
className: classNames(backdropClassName, className)
|
|
214
221
|
}));
|
|
215
222
|
});
|
|
216
223
|
}
|
|
217
224
|
|
|
218
|
-
return /*#__PURE__*/React.createElement("div",
|
|
219
|
-
"aria-hidden": true
|
|
220
|
-
|
|
225
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
226
|
+
"aria-hidden": true,
|
|
227
|
+
style: backdropStyle,
|
|
221
228
|
className: backdropClassName
|
|
222
|
-
})
|
|
229
|
+
});
|
|
223
230
|
};
|
|
224
231
|
|
|
225
232
|
var dialogElement = Transition ? /*#__PURE__*/React.createElement(Transition, _extends({}, animationProps, {
|
|
@@ -234,12 +241,14 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
234
241
|
onEntering: onEntering,
|
|
235
242
|
onEntered: onEntered
|
|
236
243
|
}), children) : children;
|
|
237
|
-
return /*#__PURE__*/React.createElement(
|
|
244
|
+
return /*#__PURE__*/React.createElement(OverlayContext.Provider, {
|
|
245
|
+
value: contextValue
|
|
246
|
+
}, /*#__PURE__*/React.createElement(Portal, null, backdrop && renderBackdrop(), /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
238
247
|
ref: mergeRefs(modal.setDialogRef, ref),
|
|
239
248
|
style: style,
|
|
240
249
|
className: className,
|
|
241
250
|
tabIndex: -1
|
|
242
|
-
}),
|
|
251
|
+
}), dialogElement)));
|
|
243
252
|
});
|
|
244
253
|
export var modalPropTypes = {
|
|
245
254
|
as: PropTypes.elementType,
|
|
@@ -264,7 +273,6 @@ Modal.propTypes = _extends({}, animationPropTypes, modalPropTypes, {
|
|
|
264
273
|
dialogTransitionTimeout: PropTypes.number,
|
|
265
274
|
backdropTransitionTimeout: PropTypes.number,
|
|
266
275
|
transition: PropTypes.any,
|
|
267
|
-
|
|
268
|
-
onBackdropClick: PropTypes.func
|
|
276
|
+
onEsc: PropTypes.func
|
|
269
277
|
});
|
|
270
278
|
export default Modal;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ModalInstance {
|
|
3
|
+
dialog: HTMLElement | null;
|
|
4
|
+
backdrop: HTMLElement | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ContainerState {
|
|
7
|
+
classes: string[];
|
|
8
|
+
modals: ModalInstance[];
|
|
9
|
+
style: React.CSSProperties;
|
|
10
|
+
overflowing: boolean;
|
|
11
|
+
}
|
|
1
12
|
declare class ModalManager {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
remove(modal: any): void;
|
|
9
|
-
isTopModal(modal: any): boolean;
|
|
13
|
+
modals: ModalInstance[];
|
|
14
|
+
containers: HTMLElement[];
|
|
15
|
+
data: ContainerState[];
|
|
16
|
+
add(modal: ModalInstance, container: HTMLElement, className?: string): number;
|
|
17
|
+
remove(modal: ModalInstance): void;
|
|
18
|
+
isTopModal(modal: ModalInstance): boolean;
|
|
10
19
|
}
|
|
11
20
|
export default ModalManager;
|
|
@@ -25,16 +25,7 @@ function findContainer(data, modal) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var ModalManager = /*#__PURE__*/function () {
|
|
28
|
-
function ModalManager(
|
|
29
|
-
if (hideSiblingNodes === void 0) {
|
|
30
|
-
hideSiblingNodes = true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
this.hideSiblingNodes = null;
|
|
34
|
-
this.modals = [];
|
|
35
|
-
this.containers = [];
|
|
36
|
-
this.data = [];
|
|
37
|
-
this.hideSiblingNodes = hideSiblingNodes;
|
|
28
|
+
function ModalManager() {
|
|
38
29
|
this.modals = [];
|
|
39
30
|
this.containers = [];
|
|
40
31
|
this.data = [];
|
|
@@ -58,7 +49,7 @@ var ModalManager = /*#__PURE__*/function () {
|
|
|
58
49
|
return modalIndex;
|
|
59
50
|
}
|
|
60
51
|
|
|
61
|
-
var
|
|
52
|
+
var containerState = {
|
|
62
53
|
modals: [modal],
|
|
63
54
|
classes: className ? className.split(/\s+/) : [],
|
|
64
55
|
style: {
|
|
@@ -68,7 +59,7 @@ var ModalManager = /*#__PURE__*/function () {
|
|
|
68
59
|
overflowing: isOverflowing(container)
|
|
69
60
|
};
|
|
70
61
|
|
|
71
|
-
if (
|
|
62
|
+
if (containerState.overflowing) {
|
|
72
63
|
var paddingRight = parseInt(getStyle(container, 'paddingRight') || 0, 10);
|
|
73
64
|
var barSize = getScrollbarSize();
|
|
74
65
|
addStyle(container, {
|
|
@@ -76,9 +67,9 @@ var ModalManager = /*#__PURE__*/function () {
|
|
|
76
67
|
});
|
|
77
68
|
}
|
|
78
69
|
|
|
79
|
-
|
|
70
|
+
containerState.classes.forEach(addClass.bind(null, container));
|
|
80
71
|
this.containers.push(container);
|
|
81
|
-
this.data.push(
|
|
72
|
+
this.data.push(containerState);
|
|
82
73
|
return modalIndex;
|
|
83
74
|
};
|
|
84
75
|
|
|
@@ -90,16 +81,16 @@ var ModalManager = /*#__PURE__*/function () {
|
|
|
90
81
|
}
|
|
91
82
|
|
|
92
83
|
var containerIndex = findContainer(this.data, modal);
|
|
93
|
-
var
|
|
84
|
+
var containerState = this.data[containerIndex];
|
|
94
85
|
var container = this.containers[containerIndex];
|
|
95
|
-
|
|
86
|
+
containerState.modals.splice(containerState.modals.indexOf(modal), 1);
|
|
96
87
|
this.modals.splice(modalIndex, 1);
|
|
97
88
|
|
|
98
|
-
if (
|
|
99
|
-
Object.keys(
|
|
100
|
-
return container.style[key] =
|
|
89
|
+
if (containerState.modals.length === 0) {
|
|
90
|
+
Object.keys(containerState.style).forEach(function (key) {
|
|
91
|
+
return container.style[key] = containerState.style[key];
|
|
101
92
|
});
|
|
102
|
-
|
|
93
|
+
containerState.classes.forEach(removeClass.bind(null, container));
|
|
103
94
|
this.containers.splice(containerIndex, 1);
|
|
104
95
|
this.data.splice(containerIndex, 1);
|
|
105
96
|
}
|
package/esm/Overlay/Overlay.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { TypeAttributes, AnimationEventProps } from '../@types/common';
|
|
4
4
|
export interface OverlayProps extends AnimationEventProps {
|
|
5
|
-
container?: HTMLElement | (() => HTMLElement);
|
|
6
|
-
children
|
|
5
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
6
|
+
children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
|
|
7
7
|
childrenProps?: React.HTMLAttributes<HTMLElement>;
|
|
8
8
|
className?: string;
|
|
9
9
|
containerPadding?: number;
|
|
@@ -13,7 +13,7 @@ export interface OverlayProps extends AnimationEventProps {
|
|
|
13
13
|
rootClose?: boolean;
|
|
14
14
|
transition?: React.ElementType;
|
|
15
15
|
triggerTarget?: React.RefObject<any>;
|
|
16
|
-
onClose?:
|
|
16
|
+
onClose?: React.ReactEventHandler;
|
|
17
17
|
}
|
|
18
18
|
export declare const overlayPropTypes: {
|
|
19
19
|
container: PropTypes.Requireable<any>;
|
package/esm/Overlay/Overlay.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { useState, useRef, useCallback } from 'react';
|
|
2
|
+
import React, { useState, useRef, useCallback, useContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import Position from './Position';
|
|
6
6
|
import { mergeRefs, useRootClose } from '../utils';
|
|
7
7
|
import Fade from '../Animation/Fade';
|
|
8
|
+
import OverlayContext from './OverlayContext';
|
|
8
9
|
export var overlayPropTypes = {
|
|
9
10
|
container: PropTypes.any,
|
|
10
11
|
children: PropTypes.any,
|
|
@@ -26,7 +27,11 @@ export var overlayPropTypes = {
|
|
|
26
27
|
onExited: PropTypes.func
|
|
27
28
|
};
|
|
28
29
|
var Overlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
29
|
-
var
|
|
30
|
+
var _useContext = useContext(OverlayContext),
|
|
31
|
+
overlayContainer = _useContext.overlayContainer;
|
|
32
|
+
|
|
33
|
+
var _props$container = props.container,
|
|
34
|
+
container = _props$container === void 0 ? overlayContainer : _props$container,
|
|
30
35
|
containerPadding = props.containerPadding,
|
|
31
36
|
placement = props.placement,
|
|
32
37
|
rootClose = props.rootClose,
|
|
@@ -49,7 +54,7 @@ var Overlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
49
54
|
exited = _useState[0],
|
|
50
55
|
setExited = _useState[1];
|
|
51
56
|
|
|
52
|
-
var overlayTarget = useRef();
|
|
57
|
+
var overlayTarget = useRef(null);
|
|
53
58
|
|
|
54
59
|
if (open) {
|
|
55
60
|
if (exited) setExited(false);
|
|
@@ -17,7 +17,7 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
|
|
|
17
17
|
/** Container padding */
|
|
18
18
|
containerPadding?: number;
|
|
19
19
|
/** display element */
|
|
20
|
-
speaker
|
|
20
|
+
speaker: React.ReactElement | ((props: any, ref: React.RefObject<any>) => React.ReactElement);
|
|
21
21
|
/** Prevent floating element overflow */
|
|
22
22
|
preventOverflow?: boolean;
|
|
23
23
|
/** Opern overlay */
|
|
@@ -27,7 +27,7 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
|
|
|
27
27
|
/** Whether mouse is allowed to enter the floating layer of popover, whose default value is false. */
|
|
28
28
|
enterable?: boolean;
|
|
29
29
|
/** For the monitored component, the event will be bound to this component. */
|
|
30
|
-
children
|
|
30
|
+
children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
|
|
31
31
|
/** Whether to allow clicking document to close the overlay */
|
|
32
32
|
rootClose?: boolean;
|
|
33
33
|
/** Once disabled, the event cannot be triggered. */
|
|
@@ -39,27 +39,27 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
|
|
|
39
39
|
/** Set the `id` on `<Overlay>` and `aria-describedby` on `<OverlayTrigger>` */
|
|
40
40
|
controlId?: string;
|
|
41
41
|
/** Lose Focus callback function */
|
|
42
|
-
onBlur?:
|
|
42
|
+
onBlur?: React.FocusEventHandler;
|
|
43
43
|
/** Click on the callback function */
|
|
44
|
-
onClick?:
|
|
44
|
+
onClick?: React.MouseEventHandler;
|
|
45
45
|
/** RightClick on the callback function */
|
|
46
46
|
onContextMenu?: React.MouseEventHandler;
|
|
47
47
|
/** Callback function to get focus */
|
|
48
|
-
onFocus?:
|
|
48
|
+
onFocus?: React.FocusEventHandler;
|
|
49
49
|
/** Mouse leave callback function */
|
|
50
|
-
onMouseOut?:
|
|
50
|
+
onMouseOut?: React.MouseEventHandler;
|
|
51
51
|
/** Mouse over callback function */
|
|
52
|
-
onMouseOver?:
|
|
52
|
+
onMouseOver?: React.MouseEventHandler;
|
|
53
53
|
/** Callback fired when open component */
|
|
54
54
|
onOpen?: () => void;
|
|
55
55
|
/** Callback fired when close component */
|
|
56
56
|
onClose?: () => void;
|
|
57
57
|
}
|
|
58
58
|
export interface OverlayTriggerInstance {
|
|
59
|
-
root:
|
|
60
|
-
updatePosition
|
|
61
|
-
open
|
|
62
|
-
close
|
|
59
|
+
root: HTMLElement;
|
|
60
|
+
updatePosition: () => void;
|
|
61
|
+
open: () => void;
|
|
62
|
+
close: () => void;
|
|
63
63
|
}
|
|
64
64
|
declare const OverlayTrigger: React.ForwardRefExoticComponent<OverlayTriggerProps & React.RefAttributes<unknown>>;
|
|
65
65
|
export default OverlayTrigger;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import _isUndefined from "lodash/isUndefined";
|
|
4
|
-
import React, { useRef, useEffect, useImperativeHandle, useCallback } from 'react';
|
|
4
|
+
import React, { useRef, useEffect, useImperativeHandle, useCallback, useContext } from 'react';
|
|
5
5
|
import get from 'lodash/get';
|
|
6
6
|
import isNil from 'lodash/isNil';
|
|
7
7
|
import contains from 'dom-lib/contains';
|
|
8
8
|
import Overlay from './Overlay';
|
|
9
9
|
import { createChainedFunction, usePortal, useControlled } from '../utils';
|
|
10
10
|
import isOneOf from '../utils/isOneOf';
|
|
11
|
+
import OverlayContext from './OverlayContext';
|
|
11
12
|
|
|
12
13
|
function mergeEvents(events, props) {
|
|
13
14
|
if (events === void 0) {
|
|
@@ -47,8 +48,12 @@ function onMouseEventHandler(handler, event, delay) {
|
|
|
47
48
|
|
|
48
49
|
var defaultTrigger = ['hover', 'focus'];
|
|
49
50
|
var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
51
|
+
var _useContext = useContext(OverlayContext),
|
|
52
|
+
overlayContainer = _useContext.overlayContainer;
|
|
53
|
+
|
|
50
54
|
var children = props.children,
|
|
51
|
-
container = props.container,
|
|
55
|
+
_props$container = props.container,
|
|
56
|
+
container = _props$container === void 0 ? overlayContainer : _props$container,
|
|
52
57
|
controlId = props.controlId,
|
|
53
58
|
defaultOpen = props.defaultOpen,
|
|
54
59
|
_props$trigger = props.trigger,
|
|
@@ -90,8 +95,8 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
90
95
|
// In order to keep the overlay open, a timer is used to delay the closing.
|
|
91
96
|
|
|
92
97
|
|
|
93
|
-
var delayOpenTimer = useRef();
|
|
94
|
-
var delayCloseTimer = useRef();
|
|
98
|
+
var delayOpenTimer = useRef(null);
|
|
99
|
+
var delayCloseTimer = useRef(null);
|
|
95
100
|
var delayOpen = isNil(delayOpenProp) ? delay : delayOpenProp;
|
|
96
101
|
var delayClose = isNil(delayCloseProp) ? delay : delayCloseProp; // Whether the cursor is on the overlay
|
|
97
102
|
|
|
@@ -100,8 +105,13 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
100
105
|
var isOnTrigger = useRef(false);
|
|
101
106
|
useEffect(function () {
|
|
102
107
|
return function () {
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if (!isNil(delayOpenTimer.current)) {
|
|
109
|
+
clearTimeout(delayOpenTimer.current);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!isNil(delayCloseTimer.current)) {
|
|
113
|
+
clearTimeout(delayCloseTimer.current);
|
|
114
|
+
}
|
|
105
115
|
};
|
|
106
116
|
}, []);
|
|
107
117
|
var handleOpen = useCallback(function (delay) {
|
|
@@ -207,8 +217,11 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
207
217
|
}
|
|
208
218
|
|
|
209
219
|
delayCloseTimer.current = setTimeout(function () {
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
if (!isNil(delayCloseTimer.current)) {
|
|
221
|
+
clearTimeout(delayCloseTimer.current);
|
|
222
|
+
delayCloseTimer.current = null;
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
handleCloseWhenLeave();
|
|
213
226
|
}, 200);
|
|
214
227
|
}, [enterable, open, handleClose, handleCloseWhenLeave]);
|
|
@@ -2,13 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { TypeAttributes } from '../@types/common';
|
|
3
3
|
export interface PositionChildProps {
|
|
4
4
|
className: string;
|
|
5
|
-
left
|
|
6
|
-
top
|
|
5
|
+
left?: number;
|
|
6
|
+
top?: number;
|
|
7
7
|
}
|
|
8
8
|
export interface PositionProps {
|
|
9
|
-
children
|
|
9
|
+
children: (props: PositionChildProps, ref: any) => React.ReactElement;
|
|
10
10
|
className?: string;
|
|
11
|
-
container?: HTMLElement | (() => HTMLElement);
|
|
11
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
12
12
|
containerPadding?: number;
|
|
13
13
|
placement?: TypeAttributes.Placement;
|
|
14
14
|
preventOverflow?: boolean;
|
package/esm/Overlay/Position.js
CHANGED
|
@@ -16,13 +16,14 @@ import { useUpdateEffect } from '../utils';
|
|
|
16
16
|
var usePosition = function usePosition(props, ref) {
|
|
17
17
|
var _props$placement = props.placement,
|
|
18
18
|
placement = _props$placement === void 0 ? 'right' : _props$placement,
|
|
19
|
-
|
|
19
|
+
_props$preventOverflo = props.preventOverflow,
|
|
20
|
+
preventOverflow = _props$preventOverflo === void 0 ? false : _props$preventOverflo,
|
|
20
21
|
_props$containerPaddi = props.containerPadding,
|
|
21
22
|
containerPadding = _props$containerPaddi === void 0 ? 0 : _props$containerPaddi,
|
|
22
23
|
container = props.container,
|
|
23
24
|
triggerTarget = props.triggerTarget;
|
|
24
|
-
var containerRef = useRef();
|
|
25
|
-
var lastTargetRef = useRef();
|
|
25
|
+
var containerRef = useRef(null);
|
|
26
|
+
var lastTargetRef = useRef(null);
|
|
26
27
|
var overlayResizeObserver = useRef();
|
|
27
28
|
var defaultPosition = {
|
|
28
29
|
positionLeft: 0,
|
|
@@ -68,8 +69,9 @@ var usePosition = function usePosition(props, ref) {
|
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
var overlay = getDOMNode(ref.current);
|
|
72
|
-
|
|
72
|
+
var overlay = getDOMNode(ref.current); // fixme dom-lib getContainer incorrect type
|
|
73
|
+
|
|
74
|
+
var containerElement = getContainer(typeof container === 'function' ? container() : container !== null && container !== void 0 ? container : null, ownerDocument(ref.current).body);
|
|
73
75
|
var posi = utils.calcOverlayPosition(overlay, targetElement, containerElement);
|
|
74
76
|
|
|
75
77
|
if (forceUpdateDOM && overlay) {
|
|
@@ -77,7 +79,11 @@ var usePosition = function usePosition(props, ref) {
|
|
|
77
79
|
|
|
78
80
|
var preClassName = overlay === null || overlay === void 0 ? void 0 : (_overlay$className = overlay.className) === null || _overlay$className === void 0 ? void 0 : (_overlay$className$ma = _overlay$className.match(/(placement-\S+)/)) === null || _overlay$className$ma === void 0 ? void 0 : _overlay$className$ma[0];
|
|
79
81
|
removeClass(overlay, preClassName);
|
|
80
|
-
|
|
82
|
+
|
|
83
|
+
if (posi.positionClassName) {
|
|
84
|
+
addClass(overlay, posi.positionClassName);
|
|
85
|
+
}
|
|
86
|
+
|
|
81
87
|
addStyle(overlay, {
|
|
82
88
|
left: posi.positionLeft + "px",
|
|
83
89
|
top: posi.positionTop + "px"
|
|
@@ -134,7 +140,7 @@ var usePosition = function usePosition(props, ref) {
|
|
|
134
140
|
var Position = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
135
141
|
var children = props.children,
|
|
136
142
|
className = props.className;
|
|
137
|
-
var childRef = React.useRef();
|
|
143
|
+
var childRef = React.useRef(null);
|
|
138
144
|
|
|
139
145
|
var _usePosition = usePosition(props, childRef),
|
|
140
146
|
position = _usePosition[0],
|
|
@@ -171,7 +177,7 @@ var Position = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
171
177
|
Position.displayName = 'Position';
|
|
172
178
|
Position.propTypes = {
|
|
173
179
|
className: PropTypes.string,
|
|
174
|
-
children: PropTypes.func,
|
|
180
|
+
children: PropTypes.func.isRequired,
|
|
175
181
|
container: PropTypes.oneOfType([PropTypes.func, PropTypes.any]),
|
|
176
182
|
containerPadding: PropTypes.number,
|
|
177
183
|
placement: PropTypes.any,
|
|
@@ -29,7 +29,7 @@ declare const _default: (props: UtilProps) => {
|
|
|
29
29
|
left: number;
|
|
30
30
|
height: number;
|
|
31
31
|
width: number;
|
|
32
|
-
};
|
|
32
|
+
} | null;
|
|
33
33
|
calcAutoPlacement(targetOffset: any, container: any, overlay: any): any;
|
|
34
34
|
calcOverlayPosition(overlayNode: any, target: any, container: any): PositionType;
|
|
35
35
|
};
|
|
@@ -29,10 +29,10 @@ function getContainerDimensions(containerNode) {
|
|
|
29
29
|
scrollY = scrollTop(ownerDocument(containerNode).documentElement) || scrollTop(containerNode);
|
|
30
30
|
scrollX = scrollLeft(ownerDocument(containerNode).documentElement) || scrollLeft(containerNode);
|
|
31
31
|
} else {
|
|
32
|
-
var
|
|
32
|
+
var _ref = getOffset(containerNode);
|
|
33
33
|
|
|
34
|
-
width =
|
|
35
|
-
height =
|
|
34
|
+
width = _ref.width;
|
|
35
|
+
height = _ref.height;
|
|
36
36
|
scrollY = scrollTop(containerNode);
|
|
37
37
|
scrollX = scrollLeft(containerNode);
|
|
38
38
|
}
|
|
@@ -197,9 +197,9 @@ export default (function (props) {
|
|
|
197
197
|
calcOverlayPosition: function calcOverlayPosition(overlayNode, target, container) {
|
|
198
198
|
var childOffset = this.getPosition(target, container);
|
|
199
199
|
|
|
200
|
-
var
|
|
201
|
-
overlayHeight =
|
|
202
|
-
overlayWidth =
|
|
200
|
+
var _ref2 = getOffset(overlayNode),
|
|
201
|
+
overlayHeight = _ref2.height,
|
|
202
|
+
overlayWidth = _ref2.width;
|
|
203
203
|
|
|
204
204
|
var top = childOffset.top,
|
|
205
205
|
left = childOffset.left;
|