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
|
@@ -2,9 +2,9 @@ import React, { Dispatch } from 'react';
|
|
|
2
2
|
import { DropdownAction } from './DropdownState';
|
|
3
3
|
export interface DropdownContextProps {
|
|
4
4
|
activeKey?: string;
|
|
5
|
-
onSelect
|
|
5
|
+
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
6
6
|
hasSelectedItem?: boolean;
|
|
7
7
|
dispatch?: Dispatch<DropdownAction>;
|
|
8
8
|
}
|
|
9
|
-
declare const DropdownContext: React.Context<DropdownContextProps>;
|
|
9
|
+
declare const DropdownContext: React.Context<DropdownContextProps | null>;
|
|
10
10
|
export default DropdownContext;
|
|
@@ -86,7 +86,7 @@ var DropdownItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
86
86
|
dispatchDisclosure = _ref[1];
|
|
87
87
|
|
|
88
88
|
var handleClickNavbarDropdownItem = (0, _react.useCallback)(function (event) {
|
|
89
|
-
dispatchDisclosure({
|
|
89
|
+
dispatchDisclosure === null || dispatchDisclosure === void 0 ? void 0 : dispatchDisclosure({
|
|
90
90
|
type: _DisclosureContext.DisclosureActionTypes.Hide
|
|
91
91
|
});
|
|
92
92
|
handleSelectItem === null || handleSelectItem === void 0 ? void 0 : handleSelectItem(event);
|
|
@@ -19,8 +19,8 @@ export interface DropdownMenuProps<T = string> extends StandardProps {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
activeKey?: T;
|
|
21
21
|
trigger?: 'hover' | 'click';
|
|
22
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
23
|
-
onToggle?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
22
|
+
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
23
|
+
onToggle?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* The <Dropdown.Menu> API
|
|
@@ -40,5 +40,5 @@ export interface DropdownMenuProps<T = string> extends StandardProps {
|
|
|
40
40
|
* </Dropdown.Menu>
|
|
41
41
|
* </Dropdown>
|
|
42
42
|
*/
|
|
43
|
-
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string> & Omit<React.HTMLAttributes<HTMLUListElement>, "title" | "onSelect"> & React.RefAttributes<
|
|
43
|
+
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string> & Omit<React.HTMLAttributes<HTMLUListElement>, "title" | "onSelect"> & React.RefAttributes<HTMLElement>>;
|
|
44
44
|
export default DropdownMenu;
|
|
@@ -33,5 +33,5 @@ export declare type DropdownAction = {
|
|
|
33
33
|
id: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export declare function reducer(state: DropdownState, action: DropdownAction): DropdownState;
|
|
36
|
+
export declare function reducer(state: DropdownState | undefined, action: DropdownAction): DropdownState;
|
|
37
37
|
export {};
|
|
@@ -33,7 +33,8 @@ var DropdownToggle = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
33
33
|
children = props.children,
|
|
34
34
|
icon = props.icon,
|
|
35
35
|
noCaret = props.noCaret,
|
|
36
|
-
placement = props.placement,
|
|
36
|
+
_props$placement = props.placement,
|
|
37
|
+
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
37
38
|
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "className", "classPrefix", "renderToggle", "children", "icon", "noCaret", "placement"]);
|
|
38
39
|
var sidenav = (0, _react.useContext)(_Sidenav.SidenavContext);
|
|
39
40
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function useRenderDropdownItem(Component: React.ElementType): (props: any, OverrideComponent?: React.ElementType) => JSX.Element;
|
|
2
|
+
export declare function useRenderDropdownItem(Component: React.ElementType): (props: any, OverrideComponent?: React.ElementType<any> | undefined) => JSX.Element;
|
package/cjs/Form/Form.js
CHANGED
|
@@ -250,7 +250,7 @@ var Form = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
250
250
|
setFormValue(nextFormValue);
|
|
251
251
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextFormValue, event);
|
|
252
252
|
}, [onChange, getFormValue]);
|
|
253
|
-
var rootRef = (0, _react.useRef)();
|
|
253
|
+
var rootRef = (0, _react.useRef)(null);
|
|
254
254
|
var formContextValue = (0, _react.useMemo)(function () {
|
|
255
255
|
return {
|
|
256
256
|
model: model,
|
|
@@ -19,6 +19,6 @@ export interface FormContextValue<T = Record<string, any>, errorMsgType = any, E
|
|
|
19
19
|
export declare const FormContext: React.Context<FormContextValue<Record<string, any>, any, {
|
|
20
20
|
[x: string]: any;
|
|
21
21
|
}>>;
|
|
22
|
-
export declare const FormValueContext: React.Context<Record<string, any
|
|
22
|
+
export declare const FormValueContext: React.Context<Record<string, any> | undefined>;
|
|
23
23
|
export declare const FormPlaintextContext: React.Context<boolean>;
|
|
24
24
|
export default FormContext;
|
|
@@ -32,7 +32,7 @@ export interface FormControlProps<P = any, ValueType = any> extends WithAsProps,
|
|
|
32
32
|
interface FormControlComponent extends React.FC<FormControlProps> {
|
|
33
33
|
<Accepter extends React.ElementType = typeof Input>(props: FormControlProps & {
|
|
34
34
|
accepter?: Accepter;
|
|
35
|
-
} & React.ComponentPropsWithRef<Accepter>): React.ReactElement;
|
|
35
|
+
} & React.ComponentPropsWithRef<Accepter>): React.ReactElement | null;
|
|
36
36
|
}
|
|
37
37
|
declare const FormControl: FormControlComponent;
|
|
38
38
|
export default FormControl;
|
|
@@ -68,7 +68,8 @@ var FormControl = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
68
68
|
disabled = _props$disabled === void 0 ? disabledContext : _props$disabled,
|
|
69
69
|
onChange = props.onChange,
|
|
70
70
|
onBlur = props.onBlur,
|
|
71
|
-
|
|
71
|
+
defaultValue = props.defaultValue,
|
|
72
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "accepter", "classPrefix", "className", "checkAsync", "checkTrigger", "errorPlacement", "errorMessage", "name", "value", "readOnly", "plaintext", "disabled", "onChange", "onBlur", "defaultValue"]);
|
|
72
73
|
|
|
73
74
|
var _useContext2 = (0, _react.useContext)(_FormGroup.FormGroupContext),
|
|
74
75
|
controlId = _useContext2.controlId;
|
|
@@ -118,12 +119,12 @@ var FormControl = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
118
119
|
var nextFormValue = (0, _extends3.default)({}, formValue, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
119
120
|
|
|
120
121
|
if (checkAsync) {
|
|
121
|
-
return model.checkForFieldAsync(name, nextFormValue).then(function (checkResult) {
|
|
122
|
+
return model === null || model === void 0 ? void 0 : model.checkForFieldAsync(name, nextFormValue).then(function (checkResult) {
|
|
122
123
|
return callbackEvents(checkResult);
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
return Promise.resolve(callbackEvents(model.checkForField(name, nextFormValue)));
|
|
127
|
+
return Promise.resolve(callbackEvents(model === null || model === void 0 ? void 0 : model.checkForField(name, nextFormValue)));
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
var messageNode = null;
|
|
@@ -157,7 +158,7 @@ var FormControl = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
157
158
|
name: name,
|
|
158
159
|
onChange: handleFieldChange,
|
|
159
160
|
onBlur: handleFieldBlur,
|
|
160
|
-
defaultValue: formDefaultValue[name],
|
|
161
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : formDefaultValue[name],
|
|
161
162
|
value: val
|
|
162
163
|
})), /*#__PURE__*/_react.default.createElement(_FormErrorMessage.default, {
|
|
163
164
|
id: controlId + "-error-message",
|
|
@@ -8,7 +8,7 @@ export interface FormGroupProps extends WithAsProps {
|
|
|
8
8
|
controlId?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare const FormGroupContext: React.Context<{
|
|
11
|
-
controlId?: string;
|
|
11
|
+
controlId?: string | undefined;
|
|
12
12
|
}>;
|
|
13
13
|
declare const FormGroup: RsRefForwardingComponent<'div', FormGroupProps>;
|
|
14
14
|
export default FormGroup;
|
package/cjs/Input/Input.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAsProps, RsRefForwardingComponent, TypeAttributes, FormControlBaseProps } from '../@types/common';
|
|
3
|
+
import { PrependParameters } from '../@types/utils';
|
|
3
4
|
export interface LocaleType {
|
|
4
5
|
unfilled: string;
|
|
5
6
|
}
|
|
6
|
-
export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'>, FormControlBaseProps {
|
|
7
|
+
export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'>, Omit<FormControlBaseProps, 'onChange'> {
|
|
7
8
|
/** The HTML input type */
|
|
8
9
|
type?: string;
|
|
9
10
|
/** The HTML input id */
|
|
@@ -12,7 +13,7 @@ export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<
|
|
|
12
13
|
size?: TypeAttributes.Size;
|
|
13
14
|
/** Ref of input element */
|
|
14
15
|
inputRef?: React.Ref<any>;
|
|
15
|
-
onChange?:
|
|
16
|
+
onChange?: PrependParameters<React.ChangeEventHandler<HTMLInputElement>, [value: string]>;
|
|
16
17
|
/** Called on press enter */
|
|
17
18
|
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
18
19
|
}
|
|
@@ -5,7 +5,7 @@ import { WithAsProps, TypeAttributes, RsRefForwardingComponent } from '../@types
|
|
|
5
5
|
export declare const InputGroupContext: React.Context<{
|
|
6
6
|
onFocus: () => void;
|
|
7
7
|
onBlur: () => void;
|
|
8
|
-
}>;
|
|
8
|
+
} | null>;
|
|
9
9
|
export interface InputGroupProps extends WithAsProps {
|
|
10
10
|
/** Sets the composition content internally */
|
|
11
11
|
inside?: boolean;
|
|
@@ -128,11 +128,15 @@ var InputNumber = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
128
128
|
value = _useControlled[0],
|
|
129
129
|
setValue = _useControlled[1];
|
|
130
130
|
|
|
131
|
-
var _useState = (0, _react.useState)(
|
|
131
|
+
var _useState = (0, _react.useState)(function () {
|
|
132
|
+
return disableMaxValue(value, max);
|
|
133
|
+
}),
|
|
132
134
|
disabledUpButton = _useState[0],
|
|
133
135
|
setDisabledUpButton = _useState[1];
|
|
134
136
|
|
|
135
|
-
var _useState2 = (0, _react.useState)(
|
|
137
|
+
var _useState2 = (0, _react.useState)(function () {
|
|
138
|
+
return disableMinValue(value, min);
|
|
139
|
+
}),
|
|
136
140
|
disabledDownButton = _useState2[0],
|
|
137
141
|
setDisabledDownButton = _useState2[1];
|
|
138
142
|
|
|
@@ -91,10 +91,10 @@ var InputAutosize = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
91
91
|
_props$inputId = props.inputId,
|
|
92
92
|
inputId = _props$inputId === void 0 ? uniqueId : _props$inputId,
|
|
93
93
|
tabIndex = props.tabIndex;
|
|
94
|
-
var rootRef = (0, _react.useRef)();
|
|
95
|
-
var inputRef = (0, _react.useRef)();
|
|
96
|
-
var sizerRef = (0, _react.useRef)();
|
|
97
|
-
var placeholderRef = (0, _react.useRef)();
|
|
94
|
+
var rootRef = (0, _react.useRef)(null);
|
|
95
|
+
var inputRef = (0, _react.useRef)(null);
|
|
96
|
+
var sizerRef = (0, _react.useRef)(null);
|
|
97
|
+
var placeholderRef = (0, _react.useRef)(null);
|
|
98
98
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
99
99
|
return {
|
|
100
100
|
root: rootRef.current,
|
|
@@ -9,11 +9,11 @@ export interface InputPickerContextProps {
|
|
|
9
9
|
/** Multiple selections are allowed */
|
|
10
10
|
multi?: boolean;
|
|
11
11
|
/** Tag related props. */
|
|
12
|
-
tagProps
|
|
12
|
+
tagProps: TagProps;
|
|
13
13
|
/**
|
|
14
14
|
* Set the trigger for creating tags. only valid when creatable
|
|
15
15
|
*/
|
|
16
|
-
trigger
|
|
16
|
+
trigger: TriggerType | TriggerType[];
|
|
17
17
|
/**
|
|
18
18
|
* No overlay provides options
|
|
19
19
|
*/
|
|
@@ -53,7 +53,10 @@ var _InputSearch = _interopRequireDefault(require("./InputSearch"));
|
|
|
53
53
|
|
|
54
54
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
55
55
|
|
|
56
|
-
var InputPickerContext = /*#__PURE__*/_react.default.createContext({
|
|
56
|
+
var InputPickerContext = /*#__PURE__*/_react.default.createContext({
|
|
57
|
+
tagProps: {},
|
|
58
|
+
trigger: 'Enter'
|
|
59
|
+
});
|
|
57
60
|
|
|
58
61
|
exports.InputPickerContext = InputPickerContext;
|
|
59
62
|
|
|
@@ -76,7 +79,8 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
76
79
|
readOnly = props.readOnly,
|
|
77
80
|
plaintext = props.plaintext,
|
|
78
81
|
defaultValue = props.defaultValue,
|
|
79
|
-
defaultOpen = props.defaultOpen,
|
|
82
|
+
_props$defaultOpen = props.defaultOpen,
|
|
83
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
80
84
|
_props$disabledItemVa = props.disabledItemValues,
|
|
81
85
|
disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
|
|
82
86
|
overrideLocale = props.locale,
|
|
@@ -137,9 +141,9 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
137
141
|
throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
var overlayRef = (0, _react.useRef)();
|
|
141
|
-
var targetRef = (0, _react.useRef)();
|
|
142
|
-
var triggerRef = (0, _react.useRef)();
|
|
144
|
+
var overlayRef = (0, _react.useRef)(null);
|
|
145
|
+
var targetRef = (0, _react.useRef)(null);
|
|
146
|
+
var triggerRef = (0, _react.useRef)(null);
|
|
143
147
|
var inputRef = (0, _react.useRef)();
|
|
144
148
|
|
|
145
149
|
var _useCustom = (0, _utils.useCustom)(['Picker', 'InputPicker'], overrideLocale),
|
|
@@ -466,8 +470,8 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
466
470
|
var events = {
|
|
467
471
|
onMenuPressBackspace: multi ? removeLastItem : handleClean,
|
|
468
472
|
onMenuKeyDown: onKeyDown,
|
|
469
|
-
onMenuPressEnter:
|
|
470
|
-
onKeyDown:
|
|
473
|
+
onMenuPressEnter: undefined,
|
|
474
|
+
onKeyDown: undefined
|
|
471
475
|
};
|
|
472
476
|
var handleKeyPress = (0, _react.useCallback)(function (event) {
|
|
473
477
|
// When typing a space, create a tag.
|
|
@@ -527,7 +531,7 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
527
531
|
|
|
528
532
|
var renderDropdownMenuItem = function renderDropdownMenuItem(label, item) {
|
|
529
533
|
// 'Create option "{0}"' => Create option "xxxxx"
|
|
530
|
-
var newLabel = item.create ? /*#__PURE__*/_react.default.createElement("span", null, (0, _utils.tplTransform)(locale
|
|
534
|
+
var newLabel = item.create ? /*#__PURE__*/_react.default.createElement("span", null, (0, _utils.tplTransform)(locale.createOption, label)) : label;
|
|
531
535
|
return renderMenuItem ? renderMenuItem(newLabel, item) : newLabel;
|
|
532
536
|
};
|
|
533
537
|
|
|
@@ -638,7 +642,8 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
638
642
|
maxHeight: menuMaxHeight,
|
|
639
643
|
data: items,
|
|
640
644
|
group: !(0, _isUndefined.default)(groupBy),
|
|
641
|
-
onSelect: multi ? handleCheckTag : handleSelectItem
|
|
645
|
+
onSelect: multi ? handleCheckTag : handleSelectItem // fixme don't use any
|
|
646
|
+
,
|
|
642
647
|
renderMenuGroup: renderMenuGroup,
|
|
643
648
|
renderMenuItem: renderDropdownMenuItem,
|
|
644
649
|
virtualized: virtualized
|
|
@@ -731,7 +736,7 @@ var InputPicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
731
736
|
plaintext: plaintext,
|
|
732
737
|
ref: targetRef,
|
|
733
738
|
as: toggleAs,
|
|
734
|
-
tabIndex:
|
|
739
|
+
tabIndex: undefined,
|
|
735
740
|
onClean: handleClean,
|
|
736
741
|
cleanable: cleanable && !disabled,
|
|
737
742
|
hasValue: hasValue,
|
|
@@ -4,7 +4,7 @@ import useManager from './helper/useManager';
|
|
|
4
4
|
export declare type ListContextType = {
|
|
5
5
|
bordered?: boolean;
|
|
6
6
|
size?: ListProps['size'];
|
|
7
|
-
register
|
|
7
|
+
register: ReturnType<typeof useManager>['listItemRegister'];
|
|
8
8
|
};
|
|
9
9
|
declare const ListContext: React.Context<ListContextType>;
|
|
10
10
|
export default ListContext;
|
package/cjs/List/ListContext.js
CHANGED
|
@@ -7,9 +7,16 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
11
|
+
|
|
10
12
|
var ListContext = /*#__PURE__*/_react.default.createContext({
|
|
11
13
|
bordered: false,
|
|
12
|
-
size: 'md'
|
|
14
|
+
size: 'md',
|
|
15
|
+
register: function register() {
|
|
16
|
+
return {
|
|
17
|
+
unregister: _noop.default
|
|
18
|
+
};
|
|
19
|
+
}
|
|
13
20
|
});
|
|
14
21
|
|
|
15
22
|
var _default = ListContext;
|
|
@@ -21,8 +21,10 @@ var AutoScroller = /*#__PURE__*/function () {
|
|
|
21
21
|
var _proto = AutoScroller.prototype;
|
|
22
22
|
|
|
23
23
|
_proto.clear = function clear() {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (this.interval !== null) {
|
|
25
|
+
clearInterval(this.interval);
|
|
26
|
+
this.interval = null;
|
|
27
|
+
}
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
_proto.update = function update(_ref) {
|
|
@@ -2,10 +2,10 @@ import { Offset } from '../../@types/common';
|
|
|
2
2
|
export declare type Collection = string | number;
|
|
3
3
|
export interface ManagedItem {
|
|
4
4
|
node: HTMLElement;
|
|
5
|
-
edgeOffset: Offset;
|
|
5
|
+
edgeOffset: Offset | null;
|
|
6
6
|
info: {
|
|
7
7
|
collection: Collection;
|
|
8
|
-
index
|
|
8
|
+
index?: number;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ declare const useManager: () => {
|
|
|
13
13
|
listItemRegister: (item: ManagedItem) => {
|
|
14
14
|
unregister: () => void;
|
|
15
15
|
};
|
|
16
|
-
getManagedItem: (node: HTMLElement) => ManagedItem;
|
|
16
|
+
getManagedItem: (node: HTMLElement) => ManagedItem | undefined;
|
|
17
17
|
getOrderedItems: (collection: any) => ManagedItem[];
|
|
18
18
|
};
|
|
19
19
|
export default useManager;
|
|
@@ -38,7 +38,7 @@ var useManager = function useManager() {
|
|
|
38
38
|
}, []);
|
|
39
39
|
var getOrderedItems = (0, _react.useCallback)(function (collection) {
|
|
40
40
|
return collection != null ? [].concat(collectionMapRef.current[collection]).sort(function (nodeInfo1, nodeInfo2) {
|
|
41
|
-
return nodeInfo1.info.index - nodeInfo2.info.index;
|
|
41
|
+
return Number(nodeInfo1.info.index) - Number(nodeInfo2.info.index);
|
|
42
42
|
}) : [];
|
|
43
43
|
}, []);
|
|
44
44
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
|
-
import { Collection } from './useManager';
|
|
2
|
+
import { Collection, ManagedItem } from './useManager';
|
|
3
3
|
interface MovedItemInfo {
|
|
4
4
|
collection: Collection;
|
|
5
5
|
node: HTMLElement;
|
|
@@ -18,9 +18,9 @@ export declare type SortConfig = {
|
|
|
18
18
|
declare const useSortHelper: (config: SortConfig) => {
|
|
19
19
|
handleStart: MouseEventHandler<Element>;
|
|
20
20
|
handleEnd: MouseEventHandler<Element>;
|
|
21
|
-
containerRef: import("react").
|
|
21
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
22
22
|
sorting: boolean;
|
|
23
|
-
register: (item:
|
|
23
|
+
register: (item: ManagedItem) => {
|
|
24
24
|
unregister: () => void;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -50,7 +50,7 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
50
50
|
* */
|
|
51
51
|
|
|
52
52
|
var handlePress = (0, _react.useCallback)(function (mouseDownEvent, targetNode, curManagedItem) {
|
|
53
|
-
var _activeNodeHelper;
|
|
53
|
+
var _curManagedItem$info$, _curManagedItem$info$2, _activeNodeHelper;
|
|
54
54
|
|
|
55
55
|
if (!isMounted()) return;
|
|
56
56
|
var listItemBaseClassName = targetNode.classList[0]; // get list item base className
|
|
@@ -60,8 +60,8 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
60
60
|
|
|
61
61
|
var containerElement = containerRef.current;
|
|
62
62
|
var activeNode = curManagedItem.node;
|
|
63
|
-
var activeNodeOldIndex = curManagedItem.info.index;
|
|
64
|
-
var activeNodeNextIndex = curManagedItem.info.index;
|
|
63
|
+
var activeNodeOldIndex = (_curManagedItem$info$ = curManagedItem.info.index) !== null && _curManagedItem$info$ !== void 0 ? _curManagedItem$info$ : 0;
|
|
64
|
+
var activeNodeNextIndex = (_curManagedItem$info$2 = curManagedItem.info.index) !== null && _curManagedItem$info$2 !== void 0 ? _curManagedItem$info$2 : 0;
|
|
65
65
|
var activeNodeHolderTranslate = {
|
|
66
66
|
x: 0,
|
|
67
67
|
y: 0
|
|
@@ -132,8 +132,10 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
132
132
|
var activeNodeHeight = parseFloat(activeNodeStyle.height) || 0;
|
|
133
133
|
|
|
134
134
|
for (var i = 0, len = listItemManagerRefs.length; i < len; i++) {
|
|
135
|
+
var _listItemManagerRefs$;
|
|
136
|
+
|
|
135
137
|
var currentNode = listItemManagerRefs[i].node;
|
|
136
|
-
var currentNodeIndex = listItemManagerRefs[i].info.index;
|
|
138
|
+
var currentNodeIndex = (_listItemManagerRefs$ = listItemManagerRefs[i].info.index) !== null && _listItemManagerRefs$ !== void 0 ? _listItemManagerRefs$ : 0;
|
|
137
139
|
var offsetY = activeNodeBoundingClientRect.height > currentNode.offsetHeight ? currentNode.offsetHeight / 2 : activeNodeBoundingClientRect.height / 2;
|
|
138
140
|
var translate = {
|
|
139
141
|
x: 0,
|
|
@@ -11,6 +11,6 @@ export declare function setTransitionDuration(node: HTMLElement, duration?: numb
|
|
|
11
11
|
/**
|
|
12
12
|
* find closest target node from source node
|
|
13
13
|
* */
|
|
14
|
-
export declare function closestNode(sourceNode: HTMLElement, judge: (target: HTMLElement) => boolean): HTMLElement;
|
|
14
|
+
export declare function closestNode(sourceNode: HTMLElement, judge: (target: HTMLElement) => boolean): HTMLElement | null;
|
|
15
15
|
export declare function getEdgeOffset(node: HTMLElement, parent: HTMLElement, offset?: Offset): Offset;
|
|
16
|
-
export declare function getScrollingParent(el: HTMLElement): HTMLElement;
|
|
16
|
+
export declare function getScrollingParent(el: HTMLElement): HTMLElement | null;
|
|
@@ -34,10 +34,10 @@ export declare type TextMaskProps = TextMaskBaseProps & React.HTMLAttributes<HTM
|
|
|
34
34
|
};
|
|
35
35
|
declare const TextMask: React.ForwardRefExoticComponent<TextMaskBaseProps & React.HTMLAttributes<HTMLInputElement> & {
|
|
36
36
|
/** Custom rendering DOM */
|
|
37
|
-
render?: (ref: React.Ref<HTMLInputElement>, props: React.HTMLAttributes<HTMLInputElement>) => any;
|
|
38
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
39
|
-
value?: string | number;
|
|
40
|
-
readOnly?: boolean;
|
|
41
|
-
disabled?: boolean;
|
|
37
|
+
render?: ((ref: React.Ref<HTMLInputElement>, props: React.HTMLAttributes<HTMLInputElement>) => any) | undefined;
|
|
38
|
+
onChange?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
39
|
+
value?: string | number | undefined;
|
|
40
|
+
readOnly?: boolean | undefined;
|
|
41
|
+
disabled?: boolean | undefined;
|
|
42
42
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
43
43
|
export default TextMask;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default function adjustCaretPosition({ previousConformedValue, previousPlaceholder, currentCaretPosition, conformedValue, rawValue, placeholderChar, placeholder, indexesOfPipedChars, caretTrapIndexes }: {
|
|
2
|
-
previousConformedValue?: string;
|
|
3
|
-
previousPlaceholder?: string;
|
|
4
|
-
currentCaretPosition?: number;
|
|
2
|
+
previousConformedValue?: string | undefined;
|
|
3
|
+
previousPlaceholder?: string | undefined;
|
|
4
|
+
currentCaretPosition?: number | undefined;
|
|
5
5
|
conformedValue: any;
|
|
6
6
|
rawValue: any;
|
|
7
7
|
placeholderChar: any;
|
|
8
8
|
placeholder: any;
|
|
9
|
-
indexesOfPipedChars?:
|
|
10
|
-
caretTrapIndexes?:
|
|
11
|
-
}): number;
|
|
9
|
+
indexesOfPipedChars?: string[] | undefined;
|
|
10
|
+
caretTrapIndexes?: number[] | undefined;
|
|
11
|
+
}): number | undefined;
|
|
@@ -49,7 +49,8 @@ function conformToMask(rawValue, mask, config) {
|
|
|
49
49
|
placeholderChar = _config$placeholderCh === void 0 ? _utilities.defaultPlaceholderChar : _config$placeholderCh,
|
|
50
50
|
_config$placeholder = _config.placeholder,
|
|
51
51
|
placeholder = _config$placeholder === void 0 ? (0, _utilities.convertMaskToPlaceholder)(mask, placeholderChar) : _config$placeholder,
|
|
52
|
-
|
|
52
|
+
_config$currentCaretP = _config.currentCaretPosition,
|
|
53
|
+
currentCaretPosition = _config$currentCaretP === void 0 ? 0 : _config$currentCaretP,
|
|
53
54
|
keepCharPositions = _config.keepCharPositions; // The configs below indicate that the user wants the algorithm to work in *no guide* mode
|
|
54
55
|
|
|
55
56
|
var suppressGuide = guide === false && previousConformedValue !== undefined; // Calculate lengths once for performance
|
|
@@ -130,9 +131,9 @@ function conformToMask(rawValue, mask, config) {
|
|
|
130
131
|
// or we find at least one character that we can map.
|
|
131
132
|
while (rawValueArr.length > 0) {
|
|
132
133
|
// Let's retrieve the first user character in the queue of characters we have left
|
|
133
|
-
var
|
|
134
|
-
rawValueChar =
|
|
135
|
-
isNew =
|
|
134
|
+
var _ref = rawValueArr.shift(),
|
|
135
|
+
rawValueChar = _ref.char,
|
|
136
|
+
isNew = _ref.isNew; // If the character we got from the user input is a placeholder character (which happens
|
|
136
137
|
// regularly because user input could be something like (540) 90_-____, which includes
|
|
137
138
|
// a bunch of `_` which are placeholder characters) and we are not in *no guide* mode,
|
|
138
139
|
// then we map this placeholder character to the current spot in the placeholder
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default function createTextMaskInputElement(config: any): {
|
|
2
2
|
state: {
|
|
3
|
-
previousConformedValue:
|
|
4
|
-
previousPlaceholder:
|
|
3
|
+
previousConformedValue: undefined;
|
|
4
|
+
previousPlaceholder: undefined;
|
|
5
5
|
};
|
|
6
6
|
update(rawValue: any, { inputElement, mask: providedMask, guide, pipe, placeholderChar, keepCharPositions, showMask }?: any): void;
|
|
7
7
|
};
|
|
@@ -3,5 +3,5 @@ export declare const defaultPlaceholderChar = "_";
|
|
|
3
3
|
export declare function convertMaskToPlaceholder(mask?: MaskType | MaskFunctionType, placeholderChar?: string): string;
|
|
4
4
|
export declare function processCaretTraps(mask: any): {
|
|
5
5
|
maskWithoutCaretTraps: any;
|
|
6
|
-
indexes:
|
|
6
|
+
indexes: number[];
|
|
7
7
|
};
|
package/cjs/Menu/Menu.js
CHANGED
|
@@ -13,6 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
16
|
+
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
17
|
+
|
|
16
18
|
var _MenuContext = _interopRequireWildcard(require("./MenuContext"));
|
|
17
19
|
|
|
18
20
|
var _utils = require("../utils");
|
|
@@ -45,8 +47,8 @@ function Menu(props) {
|
|
|
45
47
|
renderMenuButton = props.renderMenuButton,
|
|
46
48
|
renderMenuPopup = props.renderMenuPopup,
|
|
47
49
|
onToggleMenu = props.onToggleMenu;
|
|
48
|
-
var buttonElementRef = (0, _react.useRef)();
|
|
49
|
-
var menuElementRef = (0, _react.useRef)();
|
|
50
|
+
var buttonElementRef = (0, _react.useRef)(null);
|
|
51
|
+
var menuElementRef = (0, _react.useRef)(null);
|
|
50
52
|
var parentMenu = (0, _react.useContext)(_MenuContext.default);
|
|
51
53
|
var isSubmenu = !!parentMenu;
|
|
52
54
|
var menu = (0, _useMenu.default)();
|
|
@@ -59,7 +61,7 @@ function Menu(props) {
|
|
|
59
61
|
var _useCustom = (0, _utils.useCustom)('Menu'),
|
|
60
62
|
rtl = _useCustom.rtl;
|
|
61
63
|
|
|
62
|
-
var activeItem = (_items$activeItemInde = items[activeItemIndex]) === null || _items$activeItemInde === void 0 ? void 0 : _items$activeItemInde.element;
|
|
64
|
+
var activeItem = (0, _isNil.default)(activeItemIndex) ? null : (_items$activeItemInde = items[activeItemIndex]) === null || _items$activeItemInde === void 0 ? void 0 : _items$activeItemInde.element;
|
|
63
65
|
|
|
64
66
|
var _useFocus = (0, _useFocus2.default)(menuElementRef),
|
|
65
67
|
grabFocus = _useFocus.grab;
|
|
@@ -94,7 +96,9 @@ function Menu(props) {
|
|
|
94
96
|
onToggleMenu === null || onToggleMenu === void 0 ? void 0 : onToggleMenu(false, event);
|
|
95
97
|
|
|
96
98
|
if (returnFocusToButton) {
|
|
97
|
-
|
|
99
|
+
var _buttonElementRef$cur;
|
|
100
|
+
|
|
101
|
+
(_buttonElementRef$cur = buttonElementRef.current) === null || _buttonElementRef$cur === void 0 ? void 0 : _buttonElementRef$cur.focus({
|
|
98
102
|
preventScroll: true
|
|
99
103
|
});
|
|
100
104
|
}
|
|
@@ -109,7 +113,9 @@ function Menu(props) {
|
|
|
109
113
|
(0, _useClickOutside.default)({
|
|
110
114
|
enabled: open,
|
|
111
115
|
isOutside: function isOutside(event) {
|
|
112
|
-
|
|
116
|
+
var _buttonElementRef$cur2, _menuElementRef$curre;
|
|
117
|
+
|
|
118
|
+
return !((_buttonElementRef$cur2 = buttonElementRef.current) !== null && _buttonElementRef$cur2 !== void 0 && _buttonElementRef$cur2.contains(event.target)) && !((_menuElementRef$curre = menuElementRef.current) !== null && _menuElementRef$curre !== void 0 && _menuElementRef$curre.contains(event.target));
|
|
113
119
|
},
|
|
114
120
|
// fixme if clicking on a focusable element, don't move focus to menu button
|
|
115
121
|
handle: function handle(event) {
|
|
@@ -348,7 +354,8 @@ function Menu(props) {
|
|
|
348
354
|
});
|
|
349
355
|
var customMenuPopup = renderMenuPopup === null || renderMenuPopup === void 0 ? void 0 : renderMenuPopup((0, _extends2.default)({}, menuProps, {
|
|
350
356
|
open: open
|
|
351
|
-
}), menuElementRef);
|
|
357
|
+
}), menuElementRef); // fixme Wrong children here
|
|
358
|
+
|
|
352
359
|
var menuElement = customMenuPopup !== null && customMenuPopup !== void 0 ? customMenuPopup : /*#__PURE__*/_react.default.createElement("ul", (0, _extends2.default)({
|
|
353
360
|
ref: menuElementRef
|
|
354
361
|
}, menuProps, {
|
|
@@ -364,7 +371,7 @@ function Menu(props) {
|
|
|
364
371
|
closeMenu(e);
|
|
365
372
|
}
|
|
366
373
|
}, [disabled, closeMenu]);
|
|
367
|
-
var rootElementRef = (0, _react.useRef)();
|
|
374
|
+
var rootElementRef = (0, _react.useRef)(null);
|
|
368
375
|
var handleContainerBlur = (0, _react.useCallback)(function (event) {
|
|
369
376
|
if ((0, _events.isFocusLeaving)(event)) {
|
|
370
377
|
closeMenu(event, false);
|
package/cjs/Menu/MenuItem.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface MenuItemProps {
|
|
|
8
8
|
/** Render prop */
|
|
9
9
|
children: (menuitem: React.LiHTMLAttributes<HTMLLIElement> & MenuitemRenderProps, ref: React.Ref<HTMLLIElement>) => React.ReactElement;
|
|
10
10
|
/** Callback when menuitem is being activated */
|
|
11
|
-
onActivate?:
|
|
11
|
+
onActivate?: React.MouseEventHandler;
|
|
12
12
|
}
|
|
13
13
|
export interface MenuitemRenderProps {
|
|
14
14
|
selected: boolean;
|