rsuite 5.2.1 → 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/Button/styles/index.less +6 -0
- package/ButtonGroup/styles/index.less +0 -18
- package/CHANGELOG.md +49 -0
- package/CheckTreePicker/styles/index.less +14 -1
- package/PanelGroup/styles/index.less +12 -12
- package/Table/styles/index.less +0 -4
- 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 +2 -2
- 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 +34 -27
- 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/CheckboxGroup/CheckboxGroup.js +2 -2
- 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 +9 -7
- package/cjs/DateRangePicker/Calendar.js +27 -6
- package/cjs/DateRangePicker/DateRangePicker.d.ts +8 -6
- package/cjs/DateRangePicker/DateRangePicker.js +126 -107
- 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 +3 -2
- 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 +16 -11
- 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/MaskedInput.d.ts +5 -42
- package/cjs/MaskedInput/MaskedInput.js +9 -63
- package/cjs/MaskedInput/TextMask.d.ts +43 -0
- package/cjs/MaskedInput/TextMask.js +80 -0
- 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 +60 -41
- package/cjs/Menu/MenuContext.d.ts +1 -1
- package/cjs/Menu/MenuItem.d.ts +1 -1
- package/cjs/Menu/MenuItem.js +31 -23
- 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 +12 -15
- 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 +21 -12
- 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 +11 -8
- 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/VirtualizedList.d.ts +29 -2
- package/cjs/Picker/propTypes.d.ts +2 -2
- package/cjs/Picker/utils.d.ts +17 -25
- package/cjs/Picker/utils.js +71 -46
- 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 +3 -3
- 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 +5 -2
- 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 +36 -27
- 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/useElementResize.d.ts +1 -1
- package/cjs/utils/useElementResize.js +11 -6
- 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 +85 -165
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +85 -165
- package/dist/rsuite.js +468 -445
- 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.LICENSE.txt +9 -0
- 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 +2 -2
- 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 +33 -25
- 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/CheckboxGroup/CheckboxGroup.js +2 -2
- 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 +9 -7
- package/esm/DateRangePicker/Calendar.js +28 -6
- package/esm/DateRangePicker/DateRangePicker.d.ts +8 -6
- package/esm/DateRangePicker/DateRangePicker.js +124 -107
- 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 +3 -2
- 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 +16 -11
- 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/MaskedInput.d.ts +5 -42
- package/esm/MaskedInput/MaskedInput.js +9 -63
- package/esm/MaskedInput/TextMask.d.ts +43 -0
- package/esm/MaskedInput/TextMask.js +67 -0
- 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 +59 -43
- package/esm/Menu/MenuContext.d.ts +1 -1
- package/esm/Menu/MenuItem.d.ts +1 -1
- package/esm/Menu/MenuItem.js +30 -23
- 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 +11 -12
- 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 +20 -11
- 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 +11 -8
- 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/VirtualizedList.d.ts +29 -2
- package/esm/Picker/propTypes.d.ts +2 -2
- package/esm/Picker/utils.d.ts +17 -25
- package/esm/Picker/utils.js +70 -46
- 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 +3 -3
- 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 +4 -2
- 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 +35 -25
- 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/useElementResize.d.ts +1 -1
- package/esm/utils/useElementResize.js +12 -5
- 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 +4 -4
- package/styles/index.less +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import DisclosureContext from './DisclosureContext';
|
|
3
|
+
export default function useDisclosureContext(component) {
|
|
4
|
+
var context = useContext(DisclosureContext);
|
|
5
|
+
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error("<" + component + "> component must be rendered within a <Disclosure>");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
@@ -45,7 +45,7 @@ export interface DropdownProps<T = any> extends WithAsProps, Omit<React.HTMLAttr
|
|
|
45
45
|
/** Callback function for menu state switching */
|
|
46
46
|
onToggle?: (open?: boolean) => void;
|
|
47
47
|
/** Selected callback function */
|
|
48
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
48
|
+
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
49
49
|
}
|
|
50
50
|
export interface DropdownComponent extends RsRefForwardingComponent<'div', DropdownProps> {
|
|
51
51
|
Item: typeof DropdownItem;
|
|
@@ -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;
|
|
@@ -61,7 +61,7 @@ var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
61
|
dispatchDisclosure = _ref[1];
|
|
62
62
|
|
|
63
63
|
var handleClickNavbarDropdownItem = useCallback(function (event) {
|
|
64
|
-
dispatchDisclosure({
|
|
64
|
+
dispatchDisclosure === null || dispatchDisclosure === void 0 ? void 0 : dispatchDisclosure({
|
|
65
65
|
type: DisclosureActionTypes.Hide
|
|
66
66
|
});
|
|
67
67
|
handleSelectItem === null || handleSelectItem === void 0 ? void 0 : handleSelectItem(event);
|
|
@@ -108,7 +108,8 @@ var DropdownItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
108
108
|
if (panel) {
|
|
109
109
|
return renderDropdownItem(_extends({
|
|
110
110
|
ref: ref,
|
|
111
|
-
className: merge(prefix('panel'), className)
|
|
111
|
+
className: merge(prefix('panel'), className),
|
|
112
|
+
children: children
|
|
112
113
|
}, restProps));
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -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 {};
|
|
@@ -16,7 +16,8 @@ var DropdownToggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
16
16
|
children = props.children,
|
|
17
17
|
icon = props.icon,
|
|
18
18
|
noCaret = props.noCaret,
|
|
19
|
-
placement = props.placement,
|
|
19
|
+
_props$placement = props.placement,
|
|
20
|
+
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
20
21
|
rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "renderToggle", "children", "icon", "noCaret", "placement"]);
|
|
21
22
|
|
|
22
23
|
var sidenav = useContext(SidenavContext);
|
|
@@ -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/esm/Form/Form.js
CHANGED
|
@@ -233,7 +233,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
233
233
|
setFormValue(nextFormValue);
|
|
234
234
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextFormValue, event);
|
|
235
235
|
}, [onChange, getFormValue]);
|
|
236
|
-
var rootRef = useRef();
|
|
236
|
+
var rootRef = useRef(null);
|
|
237
237
|
var formContextValue = useMemo(function () {
|
|
238
238
|
return {
|
|
239
239
|
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;
|
|
@@ -53,7 +53,8 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
53
53
|
disabled = _props$disabled === void 0 ? disabledContext : _props$disabled,
|
|
54
54
|
onChange = props.onChange,
|
|
55
55
|
onBlur = props.onBlur,
|
|
56
|
-
|
|
56
|
+
defaultValue = props.defaultValue,
|
|
57
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "accepter", "classPrefix", "className", "checkAsync", "checkTrigger", "errorPlacement", "errorMessage", "name", "value", "readOnly", "plaintext", "disabled", "onChange", "onBlur", "defaultValue"]);
|
|
57
58
|
|
|
58
59
|
var _useContext2 = useContext(FormGroupContext),
|
|
59
60
|
controlId = _useContext2.controlId;
|
|
@@ -103,12 +104,12 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
103
104
|
var nextFormValue = _extends({}, formValue, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
104
105
|
|
|
105
106
|
if (checkAsync) {
|
|
106
|
-
return model.checkForFieldAsync(name, nextFormValue).then(function (checkResult) {
|
|
107
|
+
return model === null || model === void 0 ? void 0 : model.checkForFieldAsync(name, nextFormValue).then(function (checkResult) {
|
|
107
108
|
return callbackEvents(checkResult);
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
return Promise.resolve(callbackEvents(model.checkForField(name, nextFormValue)));
|
|
112
|
+
return Promise.resolve(callbackEvents(model === null || model === void 0 ? void 0 : model.checkForField(name, nextFormValue)));
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
var messageNode = null;
|
|
@@ -142,7 +143,7 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
142
143
|
name: name,
|
|
143
144
|
onChange: handleFieldChange,
|
|
144
145
|
onBlur: handleFieldBlur,
|
|
145
|
-
defaultValue: formDefaultValue[name],
|
|
146
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : formDefaultValue[name],
|
|
146
147
|
value: val
|
|
147
148
|
})), /*#__PURE__*/React.createElement(FormErrorMessage, {
|
|
148
149
|
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/esm/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;
|
|
@@ -107,11 +107,15 @@ var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
107
107
|
value = _useControlled[0],
|
|
108
108
|
setValue = _useControlled[1];
|
|
109
109
|
|
|
110
|
-
var _useState = useState(
|
|
110
|
+
var _useState = useState(function () {
|
|
111
|
+
return disableMaxValue(value, max);
|
|
112
|
+
}),
|
|
111
113
|
disabledUpButton = _useState[0],
|
|
112
114
|
setDisabledUpButton = _useState[1];
|
|
113
115
|
|
|
114
|
-
var _useState2 = useState(
|
|
116
|
+
var _useState2 = useState(function () {
|
|
117
|
+
return disableMinValue(value, min);
|
|
118
|
+
}),
|
|
115
119
|
disabledDownButton = _useState2[0],
|
|
116
120
|
setDisabledDownButton = _useState2[1];
|
|
117
121
|
|
|
@@ -78,10 +78,10 @@ var InputAutosize = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
78
78
|
_props$inputId = props.inputId,
|
|
79
79
|
inputId = _props$inputId === void 0 ? uniqueId : _props$inputId,
|
|
80
80
|
tabIndex = props.tabIndex;
|
|
81
|
-
var rootRef = useRef();
|
|
82
|
-
var inputRef = useRef();
|
|
83
|
-
var sizerRef = useRef();
|
|
84
|
-
var placeholderRef = useRef();
|
|
81
|
+
var rootRef = useRef(null);
|
|
82
|
+
var inputRef = useRef(null);
|
|
83
|
+
var sizerRef = useRef(null);
|
|
84
|
+
var placeholderRef = useRef(null);
|
|
85
85
|
useImperativeHandle(ref, function () {
|
|
86
86
|
return {
|
|
87
87
|
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
|
*/
|
|
@@ -23,7 +23,10 @@ import { DropdownMenu, DropdownMenuItem, DropdownMenuCheckItem, PickerToggle, Pi
|
|
|
23
23
|
import Tag from '../Tag';
|
|
24
24
|
import InputAutosize from './InputAutosize';
|
|
25
25
|
import InputSearch from './InputSearch';
|
|
26
|
-
export var InputPickerContext = /*#__PURE__*/React.createContext({
|
|
26
|
+
export var InputPickerContext = /*#__PURE__*/React.createContext({
|
|
27
|
+
tagProps: {},
|
|
28
|
+
trigger: 'Enter'
|
|
29
|
+
});
|
|
27
30
|
var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
28
31
|
var _merge;
|
|
29
32
|
|
|
@@ -43,7 +46,8 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
46
|
readOnly = props.readOnly,
|
|
44
47
|
plaintext = props.plaintext,
|
|
45
48
|
defaultValue = props.defaultValue,
|
|
46
|
-
defaultOpen = props.defaultOpen,
|
|
49
|
+
_props$defaultOpen = props.defaultOpen,
|
|
50
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
47
51
|
_props$disabledItemVa = props.disabledItemValues,
|
|
48
52
|
disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
|
|
49
53
|
overrideLocale = props.locale,
|
|
@@ -104,9 +108,9 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
104
108
|
throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
var overlayRef = useRef();
|
|
108
|
-
var targetRef = useRef();
|
|
109
|
-
var triggerRef = useRef();
|
|
111
|
+
var overlayRef = useRef(null);
|
|
112
|
+
var targetRef = useRef(null);
|
|
113
|
+
var triggerRef = useRef(null);
|
|
110
114
|
var inputRef = useRef();
|
|
111
115
|
|
|
112
116
|
var _useCustom = useCustom(['Picker', 'InputPicker'], overrideLocale),
|
|
@@ -433,8 +437,8 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
433
437
|
var events = {
|
|
434
438
|
onMenuPressBackspace: multi ? removeLastItem : handleClean,
|
|
435
439
|
onMenuKeyDown: onKeyDown,
|
|
436
|
-
onMenuPressEnter:
|
|
437
|
-
onKeyDown:
|
|
440
|
+
onMenuPressEnter: undefined,
|
|
441
|
+
onKeyDown: undefined
|
|
438
442
|
};
|
|
439
443
|
var handleKeyPress = useCallback(function (event) {
|
|
440
444
|
// When typing a space, create a tag.
|
|
@@ -494,7 +498,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
494
498
|
|
|
495
499
|
var renderDropdownMenuItem = function renderDropdownMenuItem(label, item) {
|
|
496
500
|
// 'Create option "{0}"' => Create option "xxxxx"
|
|
497
|
-
var newLabel = item.create ? /*#__PURE__*/React.createElement("span", null, tplTransform(locale
|
|
501
|
+
var newLabel = item.create ? /*#__PURE__*/React.createElement("span", null, tplTransform(locale.createOption, label)) : label;
|
|
498
502
|
return renderMenuItem ? renderMenuItem(newLabel, item) : newLabel;
|
|
499
503
|
};
|
|
500
504
|
|
|
@@ -608,7 +612,8 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
608
612
|
maxHeight: menuMaxHeight,
|
|
609
613
|
data: items,
|
|
610
614
|
group: !isUndefined(groupBy),
|
|
611
|
-
onSelect: multi ? handleCheckTag : handleSelectItem
|
|
615
|
+
onSelect: multi ? handleCheckTag : handleSelectItem // fixme don't use any
|
|
616
|
+
,
|
|
612
617
|
renderMenuGroup: renderMenuGroup,
|
|
613
618
|
renderMenuItem: renderDropdownMenuItem,
|
|
614
619
|
virtualized: virtualized
|
|
@@ -666,7 +671,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
666
671
|
var plaintextProps = {}; // TagPicker has -6px margin-left on the plaintext wrapper
|
|
667
672
|
// for fixing margin-left on tags from 2nd line on
|
|
668
673
|
|
|
669
|
-
if (multi) {
|
|
674
|
+
if (multi && hasValue) {
|
|
670
675
|
plaintextProps.style = {
|
|
671
676
|
marginLeft: -6
|
|
672
677
|
};
|
|
@@ -701,7 +706,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
701
706
|
plaintext: plaintext,
|
|
702
707
|
ref: targetRef,
|
|
703
708
|
as: toggleAs,
|
|
704
|
-
tabIndex:
|
|
709
|
+
tabIndex: undefined,
|
|
705
710
|
onClean: handleClean,
|
|
706
711
|
cleanable: cleanable && !disabled,
|
|
707
712
|
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/esm/List/ListContext.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import noop from 'lodash/noop';
|
|
2
3
|
var ListContext = /*#__PURE__*/React.createContext({
|
|
3
4
|
bordered: false,
|
|
4
|
-
size: 'md'
|
|
5
|
+
size: 'md',
|
|
6
|
+
register: function register() {
|
|
7
|
+
return {
|
|
8
|
+
unregister: noop
|
|
9
|
+
};
|
|
10
|
+
}
|
|
5
11
|
});
|
|
6
12
|
export default ListContext;
|
|
@@ -17,8 +17,10 @@ var AutoScroller = /*#__PURE__*/function () {
|
|
|
17
17
|
var _proto = AutoScroller.prototype;
|
|
18
18
|
|
|
19
19
|
_proto.clear = function clear() {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
if (this.interval !== null) {
|
|
21
|
+
clearInterval(this.interval);
|
|
22
|
+
this.interval = null;
|
|
23
|
+
}
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
_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;
|
|
@@ -31,7 +31,7 @@ var useManager = function useManager() {
|
|
|
31
31
|
}, []);
|
|
32
32
|
var getOrderedItems = useCallback(function (collection) {
|
|
33
33
|
return collection != null ? [].concat(collectionMapRef.current[collection]).sort(function (nodeInfo1, nodeInfo2) {
|
|
34
|
-
return nodeInfo1.info.index - nodeInfo2.info.index;
|
|
34
|
+
return Number(nodeInfo1.info.index) - Number(nodeInfo2.info.index);
|
|
35
35
|
}) : [];
|
|
36
36
|
}, []);
|
|
37
37
|
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
|
};
|
|
@@ -38,7 +38,7 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
38
38
|
* */
|
|
39
39
|
|
|
40
40
|
var handlePress = useCallback(function (mouseDownEvent, targetNode, curManagedItem) {
|
|
41
|
-
var _activeNodeHelper;
|
|
41
|
+
var _curManagedItem$info$, _curManagedItem$info$2, _activeNodeHelper;
|
|
42
42
|
|
|
43
43
|
if (!isMounted()) return;
|
|
44
44
|
var listItemBaseClassName = targetNode.classList[0]; // get list item base className
|
|
@@ -48,8 +48,8 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
48
48
|
|
|
49
49
|
var containerElement = containerRef.current;
|
|
50
50
|
var activeNode = curManagedItem.node;
|
|
51
|
-
var activeNodeOldIndex = curManagedItem.info.index;
|
|
52
|
-
var activeNodeNextIndex = curManagedItem.info.index;
|
|
51
|
+
var activeNodeOldIndex = (_curManagedItem$info$ = curManagedItem.info.index) !== null && _curManagedItem$info$ !== void 0 ? _curManagedItem$info$ : 0;
|
|
52
|
+
var activeNodeNextIndex = (_curManagedItem$info$2 = curManagedItem.info.index) !== null && _curManagedItem$info$2 !== void 0 ? _curManagedItem$info$2 : 0;
|
|
53
53
|
var activeNodeHolderTranslate = {
|
|
54
54
|
x: 0,
|
|
55
55
|
y: 0
|
|
@@ -120,8 +120,10 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
120
120
|
var activeNodeHeight = parseFloat(activeNodeStyle.height) || 0;
|
|
121
121
|
|
|
122
122
|
for (var i = 0, len = listItemManagerRefs.length; i < len; i++) {
|
|
123
|
+
var _listItemManagerRefs$;
|
|
124
|
+
|
|
123
125
|
var currentNode = listItemManagerRefs[i].node;
|
|
124
|
-
var currentNodeIndex = listItemManagerRefs[i].info.index;
|
|
126
|
+
var currentNodeIndex = (_listItemManagerRefs$ = listItemManagerRefs[i].info.index) !== null && _listItemManagerRefs$ !== void 0 ? _listItemManagerRefs$ : 0;
|
|
125
127
|
var offsetY = activeNodeBoundingClientRect.height > currentNode.offsetHeight ? currentNode.offsetHeight / 2 : activeNodeBoundingClientRect.height / 2;
|
|
126
128
|
var translate = {
|
|
127
129
|
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;
|
|
@@ -1,43 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface TextMaskProps {
|
|
7
|
-
/**
|
|
8
|
-
* `guide` is a boolean that tells the component whether to be in guide or no guide mode.
|
|
9
|
-
*/
|
|
10
|
-
guide?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* `mask` is an array or a function that defines how the user input is going to be masked.
|
|
13
|
-
*/
|
|
14
|
-
mask?: MaskType | MaskFunctionType | boolean;
|
|
15
|
-
/**
|
|
16
|
-
* `showMask` is a boolean that tells the Text Mask component to display the mask as a placeholder
|
|
17
|
-
* in place of the regular placeholder when the input element value is empty.
|
|
18
|
-
*/
|
|
19
|
-
showMask?: boolean;
|
|
20
|
-
/** The placeholder character represents the fillable spot in the mask. The default placeholder character is underscore, _. */
|
|
21
|
-
placeholderChar?: string;
|
|
22
|
-
/** `keepCharPositions` changes the general behavior of the Text Mask component. */
|
|
23
|
-
keepCharPositions?: boolean;
|
|
24
|
-
/** You can provide a `pipe` function that will give you the opportunity to modify the conformed value before it is displayed on the screen. */
|
|
25
|
-
pipe?: (conformedValue: string, config: ConfigType) => string;
|
|
26
|
-
}
|
|
27
|
-
export declare type MaskedInputProps = TextMaskProps & React.HTMLAttributes<HTMLInputElement> & {
|
|
28
|
-
/** Custom rendering DOM */
|
|
29
|
-
render?: (ref: React.Ref<HTMLInputElement>, props: React.HTMLAttributes<HTMLInputElement>) => any;
|
|
30
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
value?: string | number;
|
|
32
|
-
readOnly?: boolean;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
};
|
|
35
|
-
declare const MaskedInput: React.ForwardRefExoticComponent<TextMaskProps & React.HTMLAttributes<HTMLInputElement> & {
|
|
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;
|
|
42
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
1
|
+
import { InputProps } from '../Input';
|
|
2
|
+
import type { TextMaskProps } from './TextMask';
|
|
3
|
+
import { RsRefForwardingComponent } from '../@types/common';
|
|
4
|
+
export declare type MaskedInputProps = Omit<TextMaskProps, 'onChange'> & Omit<InputProps, 'type'>;
|
|
5
|
+
declare const MaskedInput: RsRefForwardingComponent<'input', MaskedInputProps>;
|
|
43
6
|
export default MaskedInput;
|
|
@@ -1,67 +1,13 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import React
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import createTextMaskInputElement from './createTextMaskInputElement';
|
|
7
|
-
import { mergeRefs } from '../utils';
|
|
8
|
-
/**
|
|
9
|
-
* https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#guide
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
var defaultRender = function defaultRender(ref, props) {
|
|
13
|
-
return /*#__PURE__*/React.createElement("input", _extends({
|
|
14
|
-
ref: ref
|
|
15
|
-
}, props));
|
|
16
|
-
};
|
|
17
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import TextMask from './TextMask';
|
|
4
|
+
import Input from '../Input';
|
|
18
5
|
var MaskedInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
19
|
-
var
|
|
20
|
-
_props$
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
pipe = props.pipe,
|
|
26
|
-
_props$render = props.render,
|
|
27
|
-
render = _props$render === void 0 ? defaultRender : _props$render,
|
|
28
|
-
onChange = props.onChange,
|
|
29
|
-
rest = _objectWithoutPropertiesLoose(props, ["mask", "guide", "placeholderChar", "value", "showMask", "pipe", "render", "onChange"]);
|
|
30
|
-
|
|
31
|
-
var inputRef = useRef(null);
|
|
32
|
-
var textMaskInputElement = useRef();
|
|
33
|
-
var initTextMask = useCallback(function () {
|
|
34
|
-
var _textMaskInputElement;
|
|
35
|
-
|
|
36
|
-
textMaskInputElement.current = createTextMaskInputElement(_extends({
|
|
37
|
-
inputElement: inputRef.current
|
|
38
|
-
}, props));
|
|
39
|
-
(_textMaskInputElement = textMaskInputElement.current) === null || _textMaskInputElement === void 0 ? void 0 : _textMaskInputElement.update(value);
|
|
40
|
-
}, [props, value]);
|
|
41
|
-
var handleChange = useCallback(function (event) {
|
|
42
|
-
var _textMaskInputElement2;
|
|
43
|
-
|
|
44
|
-
(_textMaskInputElement2 = textMaskInputElement.current) === null || _textMaskInputElement2 === void 0 ? void 0 : _textMaskInputElement2.update();
|
|
45
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
46
|
-
}, [onChange]);
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
initTextMask();
|
|
49
|
-
}, [guide, placeholderChar, showMask, pipe, mask, value, initTextMask]);
|
|
50
|
-
return render(mergeRefs(inputRef, ref), _extends({
|
|
51
|
-
onChange: handleChange,
|
|
52
|
-
defaultValue: value
|
|
53
|
-
}, omit(rest, ['keepCharPositions'])));
|
|
6
|
+
var _props$as = props.as,
|
|
7
|
+
inputAs = _props$as === void 0 ? TextMask : _props$as;
|
|
8
|
+
return /*#__PURE__*/React.createElement(Input, _extends({}, props, {
|
|
9
|
+
as: inputAs,
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
54
12
|
});
|
|
55
|
-
MaskedInput.displayName = 'MaskedInput';
|
|
56
|
-
MaskedInput.propTypes = {
|
|
57
|
-
render: PropTypes.func,
|
|
58
|
-
onChange: PropTypes.func,
|
|
59
|
-
mask: PropTypes.oneOfType([PropTypes.array, PropTypes.func, PropTypes.bool]).isRequired,
|
|
60
|
-
guide: PropTypes.bool,
|
|
61
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
62
|
-
pipe: PropTypes.func,
|
|
63
|
-
placeholderChar: PropTypes.string,
|
|
64
|
-
keepCharPositions: PropTypes.bool,
|
|
65
|
-
showMask: PropTypes.bool
|
|
66
|
-
};
|
|
67
13
|
export default MaskedInput;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MaskType, MaskFunctionType, ConfigType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#guide
|
|
5
|
+
*/
|
|
6
|
+
interface TextMaskBaseProps {
|
|
7
|
+
/**
|
|
8
|
+
* `guide` is a boolean that tells the component whether to be in guide or no guide mode.
|
|
9
|
+
*/
|
|
10
|
+
guide?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* `mask` is an array or a function that defines how the user input is going to be masked.
|
|
13
|
+
*/
|
|
14
|
+
mask?: MaskType | MaskFunctionType | boolean;
|
|
15
|
+
/**
|
|
16
|
+
* `showMask` is a boolean that tells the Text Mask component to display the mask as a placeholder
|
|
17
|
+
* in place of the regular placeholder when the input element value is empty.
|
|
18
|
+
*/
|
|
19
|
+
showMask?: boolean;
|
|
20
|
+
/** The placeholder character represents the fillable spot in the mask. The default placeholder character is underscore, _. */
|
|
21
|
+
placeholderChar?: string;
|
|
22
|
+
/** `keepCharPositions` changes the general behavior of the Text Mask component. */
|
|
23
|
+
keepCharPositions?: boolean;
|
|
24
|
+
/** You can provide a `pipe` function that will give you the opportunity to modify the conformed value before it is displayed on the screen. */
|
|
25
|
+
pipe?: (conformedValue: string, config: ConfigType) => string;
|
|
26
|
+
}
|
|
27
|
+
export declare type TextMaskProps = TextMaskBaseProps & React.HTMLAttributes<HTMLInputElement> & {
|
|
28
|
+
/** Custom rendering DOM */
|
|
29
|
+
render?: (ref: React.Ref<HTMLInputElement>, props: React.HTMLAttributes<HTMLInputElement>) => any;
|
|
30
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
+
value?: string | number;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
declare const TextMask: React.ForwardRefExoticComponent<TextMaskBaseProps & React.HTMLAttributes<HTMLInputElement> & {
|
|
36
|
+
/** Custom rendering DOM */
|
|
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
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
export default TextMask;
|