rsuite 6.0.0-canary-20250416 → 6.0.0-canary-20250507
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/AutoComplete/styles/index.css +32 -71
- package/Button/styles/index.css +4 -6
- package/CHANGELOG.md +15 -0
- package/Calendar/styles/index.css +8 -16
- package/CascadeTree/styles/index.css +8 -16
- package/Cascader/styles/index.css +36 -79
- package/CheckPicker/styles/index.css +32 -66
- package/CheckTree/styles/index.css +34 -70
- package/CheckTreePicker/styles/index.css +34 -70
- package/Checkbox/styles/index.css +7 -9
- package/Checkbox/styles/index.less +1 -1
- package/DateInput/styles/index.css +6 -9
- package/DatePicker/styles/index.css +38 -81
- package/DateRangeInput/styles/index.css +6 -9
- package/DateRangePicker/styles/index.css +38 -81
- package/Dropdown/styles/index.css +6 -10
- package/FormControl/styles/index.css +2 -2
- package/FormControl/styles/index.less +2 -2
- package/IconButton/styles/index.css +4 -6
- package/Input/styles/index.css +6 -9
- package/Input/styles/mixin.less +2 -3
- package/InputGroup/styles/index.css +7 -13
- package/InputGroup/styles/index.less +3 -4
- package/InputNumber/styles/index.css +36 -35
- package/InputNumber/styles/index.less +1 -67
- package/InputPicker/styles/index.css +32 -71
- package/Message/styles/index.css +5 -15
- package/Message/styles/index.less +4 -3
- package/MultiCascadeTree/styles/index.css +38 -80
- package/MultiCascader/styles/index.css +38 -80
- package/Nav/styles/index.css +8 -14
- package/Navbar/styles/index.css +16 -40
- package/NumberInput/package.json +7 -0
- package/NumberInput/styles/index.css +1402 -0
- package/NumberInput/styles/index.less +74 -0
- package/{InputNumber → NumberInput}/styles/mixin.less +0 -0
- package/Pagination/styles/index.css +34 -75
- package/PasswordInput/styles/index.css +6 -9
- package/PinInput/package.json +7 -0
- package/PinInput/styles/index.css +212 -0
- package/PinInput/styles/index.less +66 -0
- package/Radio/styles/index.css +7 -9
- package/Radio/styles/index.less +1 -1
- package/RangeSlider/styles/index.css +2 -0
- package/SelectPicker/styles/index.css +32 -71
- package/Sidenav/styles/index.css +30 -67
- package/Slider/styles/index.css +2 -0
- package/Slider/styles/index.less +2 -0
- package/Stat/styles/index.css +4 -6
- package/Tabs/styles/index.css +8 -14
- package/Tag/styles/index.css +0 -15
- package/TagInput/styles/index.css +34 -72
- package/TagPicker/styles/index.css +34 -72
- package/TimePicker/styles/index.css +38 -81
- package/TimeRangePicker/styles/index.css +38 -81
- package/Toggle/styles/index.css +9 -13
- package/Toggle/styles/index.less +3 -4
- package/Tree/styles/index.css +34 -75
- package/TreePicker/styles/index.css +34 -75
- package/Uploader/styles/index.css +6 -10
- package/cjs/Accordion/Accordion.js +2 -2
- package/cjs/Affix/Affix.js +1 -2
- package/cjs/Animation/Bounce.js +1 -2
- package/cjs/Animation/Collapse.js +1 -2
- package/cjs/Animation/Fade.js +1 -2
- package/cjs/Animation/Slide.js +1 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +2 -2
- package/cjs/AutoComplete/AutoComplete.js +1 -2
- package/cjs/Avatar/Avatar.js +1 -2
- package/cjs/AvatarGroup/AvatarGroup.js +1 -2
- package/cjs/Badge/Badge.js +1 -2
- package/cjs/Breadcrumb/Breadcrumb.js +1 -2
- package/cjs/Button/Button.d.ts +2 -2
- package/cjs/Button/Button.js +1 -2
- package/cjs/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/cjs/ButtonGroup/ButtonGroup.js +1 -2
- package/cjs/ButtonToolbar/ButtonToolbar.js +1 -2
- package/cjs/Calendar/Calendar.js +4 -4
- package/cjs/Calendar/CalendarBody.js +1 -4
- package/cjs/Calendar/CalendarContainer.js +1 -1
- package/cjs/Calendar/CalendarHeader.js +3 -3
- package/cjs/Calendar/CalendarProvider.d.ts +1 -1
- package/cjs/Calendar/Grid/GridCell.js +1 -2
- package/cjs/Calendar/Grid/GridHeaderRow.js +1 -2
- package/cjs/Calendar/Grid/GridRow.d.ts +2 -0
- package/cjs/Calendar/Grid/GridRow.js +5 -4
- package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +1 -2
- package/cjs/Calendar/hooks/useCalendar.d.ts +24 -2
- package/cjs/Calendar/hooks/useCalendar.js +34 -1
- package/cjs/Card/Card.js +1 -2
- package/cjs/CardGroup/CardGroup.js +1 -2
- package/cjs/Carousel/Carousel.js +1 -2
- package/cjs/CascadeTree/CascadeTree.js +1 -2
- package/cjs/CascadeTree/SearchView.js +1 -2
- package/cjs/CascadeTree/TreeView.js +1 -2
- package/cjs/Cascader/Cascader.js +1 -2
- package/cjs/CheckPicker/CheckPicker.js +1 -2
- package/cjs/CheckTree/CheckTree.js +1 -2
- package/cjs/CheckTree/CheckTreeNode.js +1 -2
- package/cjs/CheckTree/CheckTreeView.js +1 -2
- package/cjs/CheckTreePicker/CheckTreePicker.js +1 -2
- package/cjs/Checkbox/Checkbox.js +1 -2
- package/cjs/CheckboxGroup/CheckboxGroup.js +1 -2
- package/cjs/Container/Container.js +1 -2
- package/cjs/CustomProvider/CustomProvider.d.ts +1 -271
- package/cjs/CustomProvider/CustomProvider.js +2 -3
- package/cjs/CustomProvider/index.d.ts +1 -6
- package/cjs/CustomProvider/index.js +3 -12
- package/cjs/DateInput/DateInput.js +1 -2
- package/cjs/DateInput/hooks/useDateInputState.js +2 -2
- package/cjs/DatePicker/DatePicker.js +2 -3
- package/cjs/DatePicker/hooks/useFocus.js +1 -2
- package/cjs/DateRangeInput/DateRangeInput.js +1 -2
- package/cjs/DateRangePicker/DateRangePicker.js +2 -3
- package/cjs/DateRangePicker/Header.js +3 -3
- package/cjs/DateRangePicker/utils.d.ts +1 -1
- package/cjs/DateRangePicker/utils.js +1 -1
- package/cjs/Divider/Divider.js +1 -2
- package/cjs/Drawer/Drawer.js +1 -2
- package/cjs/Dropdown/Dropdown.js +1 -2
- package/cjs/Dropdown/DropdownMenu.js +1 -2
- package/cjs/FlexboxGrid/FlexboxGrid.js +1 -2
- package/cjs/Form/Form.js +1 -2
- package/cjs/Form/FormContext.d.ts +1 -1
- package/cjs/Form/hooks/useFormValidate.js +5 -5
- package/cjs/FormControl/FormControl.js +54 -86
- package/cjs/FormControlLabel/FormControlLabel.js +1 -2
- package/cjs/FormErrorMessage/FormErrorMessage.js +1 -2
- package/cjs/FormGroup/FormGroup.js +1 -2
- package/cjs/FormHelpText/FormHelpText.js +1 -2
- package/cjs/FormStack/FormStack.js +1 -2
- package/cjs/Grid/Col.js +1 -2
- package/cjs/Grid/Grid.js +1 -2
- package/cjs/Grid/Row.js +1 -2
- package/cjs/Heading/Heading.js +1 -2
- package/cjs/Highlight/Highlight.js +2 -3
- package/cjs/IconButton/IconButton.js +1 -2
- package/cjs/Image/Image.js +2 -3
- package/cjs/InlineEdit/InlineEdit.js +1 -2
- package/cjs/Input/Input.js +3 -3
- package/cjs/InputGroup/InputGroup.js +1 -2
- package/cjs/InputNumber/index.d.ts +12 -2
- package/cjs/InputNumber/index.js +11 -4
- package/cjs/InputPicker/InputPicker.js +1 -2
- package/cjs/InputPicker/utils.d.ts +1 -1
- package/cjs/Kbd/Kbd.js +1 -2
- package/cjs/Link/Link.js +1 -2
- package/cjs/List/List.js +1 -2
- package/cjs/Loader/Loader.js +1 -2
- package/cjs/MaskedInput/MaskedInput.js +2 -2
- package/cjs/Message/Message.js +1 -2
- package/cjs/Modal/Modal.js +1 -2
- package/cjs/Modal/ModalHeader.js +1 -2
- package/cjs/MultiCascadeTree/MultiCascadeTree.js +1 -2
- package/cjs/MultiCascadeTree/SearchView.js +1 -2
- package/cjs/MultiCascadeTree/TreeView.js +1 -2
- package/cjs/MultiCascader/MultiCascader.js +1 -2
- package/cjs/Nav/Nav.js +1 -2
- package/cjs/Nav/NavDropdownMenu.js +1 -2
- package/cjs/Navbar/Navbar.d.ts +1 -1
- package/cjs/Navbar/Navbar.js +1 -2
- package/cjs/Navbar/NavbarDropdownMenu.js +1 -2
- package/cjs/Navbar/NavbarToggle.d.ts +8 -3
- package/cjs/Navbar/NavbarToggle.js +9 -14
- package/cjs/Notification/Notification.js +1 -2
- package/{esm/InputNumber/InputNumber.d.ts → cjs/NumberInput/NumberInput.d.ts} +20 -8
- package/cjs/NumberInput/NumberInput.js +162 -0
- package/cjs/NumberInput/hooks/useEvents.d.ts +22 -0
- package/cjs/NumberInput/hooks/useEvents.js +114 -0
- package/cjs/NumberInput/hooks/useNumberInputValue.d.ts +7 -0
- package/cjs/NumberInput/hooks/useNumberInputValue.js +34 -0
- package/cjs/NumberInput/hooks/useWheelHandler.d.ts +5 -0
- package/cjs/NumberInput/hooks/useWheelHandler.js +25 -0
- package/cjs/NumberInput/index.d.ts +4 -0
- package/cjs/NumberInput/index.js +11 -0
- package/cjs/NumberInput/utils/number.d.ts +17 -0
- package/cjs/NumberInput/utils/number.js +67 -0
- package/cjs/Pagination/LimitPicker.d.ts +2 -2
- package/cjs/Pagination/Pagination.d.ts +2 -2
- package/cjs/Pagination/Pagination.js +1 -2
- package/cjs/Pagination/PaginationGroup.js +1 -2
- package/cjs/Panel/Panel.js +1 -2
- package/cjs/PanelGroup/PanelGroup.js +1 -2
- package/cjs/PasswordInput/PasswordInput.d.ts +4 -0
- package/cjs/PasswordInput/PasswordInput.js +5 -4
- package/cjs/PasswordStrengthMeter/PasswordStrengthMeter.js +1 -2
- package/cjs/PinInput/PinInput.d.ts +36 -0
- package/cjs/PinInput/PinInput.js +224 -0
- package/cjs/PinInput/hooks/usePinInputRefs.d.ts +12 -0
- package/cjs/PinInput/hooks/usePinInputRefs.js +62 -0
- package/cjs/PinInput/hooks/usePinValue.d.ts +14 -0
- package/cjs/PinInput/hooks/usePinValue.js +73 -0
- package/cjs/PinInput/index.d.ts +4 -0
- package/cjs/PinInput/index.js +9 -0
- package/cjs/Placeholder/PlaceholderGraph.js +1 -2
- package/cjs/Placeholder/PlaceholderGrid.js +1 -2
- package/cjs/Placeholder/PlaceholderParagraph.js +1 -2
- package/cjs/Popover/Popover.js +1 -2
- package/cjs/Progress/ProgressCircle.js +1 -2
- package/cjs/Progress/ProgressLine.js +1 -2
- package/cjs/Radio/Radio.js +1 -2
- package/cjs/RadioGroup/RadioGroup.js +1 -2
- package/cjs/RadioTile/RadioTile.js +1 -2
- package/cjs/RadioTileGroup/RadioTileGroup.js +1 -2
- package/cjs/RangeSlider/RangeSlider.js +2 -3
- package/cjs/Rate/Rate.js +1 -2
- package/cjs/SelectPicker/SelectPicker.js +1 -2
- package/cjs/Sidebar/Sidebar.js +1 -2
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +1 -2
- package/cjs/Sidenav/Sidenav.js +1 -2
- package/cjs/Sidenav/SidenavDropdownMenu.js +1 -2
- package/cjs/Slider/Slider.d.ts +5 -1
- package/cjs/Slider/Slider.js +13 -14
- package/cjs/Stack/Stack.js +1 -2
- package/cjs/Stat/Stat.js +1 -2
- package/cjs/Stat/StatValue.js +2 -2
- package/cjs/StatGroup/StatGroup.js +1 -2
- package/cjs/Steps/Steps.js +1 -2
- package/cjs/Table/Table.js +2 -2
- package/cjs/Tabs/Tabs.js +1 -2
- package/cjs/Tag/Tag.js +1 -2
- package/cjs/TagInput/TagInput.js +2 -2
- package/cjs/TagPicker/TagPicker.js +2 -2
- package/cjs/Text/Text.js +1 -2
- package/cjs/Textarea/Textarea.js +1 -2
- package/cjs/TimePicker/TimePicker.d.ts +1 -2
- package/cjs/TimePicker/TimePicker.js +2 -2
- package/cjs/TimeRangePicker/TimeRangePicker.js +2 -2
- package/cjs/Timeline/Timeline.js +1 -2
- package/cjs/Toggle/Toggle.js +1 -2
- package/cjs/Tooltip/Tooltip.js +1 -2
- package/cjs/Tree/Tree.js +1 -2
- package/cjs/Tree/TreeNode.js +1 -2
- package/cjs/Tree/TreeNodeToggle.js +1 -2
- package/cjs/Tree/TreeView.js +1 -2
- package/cjs/Tree/hooks/useFocusTree.js +1 -2
- package/cjs/TreePicker/TreePicker.js +1 -2
- package/cjs/Uploader/Uploader.js +1 -2
- package/cjs/Whisper/Whisper.js +2 -2
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +18 -0
- package/cjs/internals/Box/index.d.ts +1 -0
- package/cjs/internals/Box/index.js +1 -0
- package/cjs/internals/Burger/Burger.d.ts +16 -0
- package/cjs/internals/Burger/Burger.js +46 -0
- package/cjs/internals/Burger/index.d.ts +4 -0
- package/cjs/internals/Burger/index.js +11 -0
- package/cjs/internals/CloseButton/CloseButton.js +1 -2
- package/cjs/internals/Menu/Menu.js +1 -2
- package/cjs/internals/Menu/Menubar.js +2 -2
- package/cjs/internals/Picker/PickerIndicator.js +1 -2
- package/cjs/internals/Picker/hooks/useCombobox.d.ts +1 -1
- package/cjs/internals/Plaintext/Plaintext.js +1 -2
- package/cjs/internals/Provider/CustomContext.d.ts +253 -0
- package/cjs/internals/Provider/CustomContext.js +8 -0
- package/cjs/internals/Provider/types.d.ts +236 -0
- package/cjs/internals/Ripple/Ripple.js +1 -2
- package/cjs/internals/SafeAnchor/SafeAnchor.js +2 -2
- package/cjs/internals/Windowing/List.js +2 -2
- package/cjs/internals/hooks/index.d.ts +1 -0
- package/cjs/internals/hooks/index.js +3 -1
- package/cjs/{CustomProvider → internals/hooks}/useCustom.d.ts +4 -4
- package/cjs/{CustomProvider → internals/hooks}/useCustom.js +5 -5
- package/cjs/internals/hooks/useStyles.js +2 -2
- package/cjs/internals/hooks/useToggleCaret.js +2 -2
- package/cjs/{CustomProvider → internals/intl}/FormattedDate.js +2 -2
- package/cjs/{CustomProvider → internals/intl}/FormattedNumber.js +2 -2
- package/cjs/internals/types/picker.d.ts +2 -2
- package/cjs/internals/types/sizes.d.ts +2 -0
- package/cjs/internals/types/sizes.js +2 -1
- package/cjs/internals/utils/date/getWeekStartDates.d.ts +0 -1
- package/cjs/internals/utils/date/getWeekStartDates.js +2 -4
- package/cjs/internals/utils/react/createComponent.js +15 -4
- package/cjs/{FormControl → useFormControl}/hooks/useField.d.ts +3 -3
- package/cjs/{FormControl → useFormControl}/hooks/useField.js +5 -6
- package/cjs/useFormControl/hooks/useRegisterModel.d.ts +2 -0
- package/cjs/{FormControl → useFormControl}/hooks/useRegisterModel.js +2 -3
- package/cjs/useFormControl/index.d.ts +4 -0
- package/cjs/useFormControl/index.js +11 -0
- package/cjs/useFormControl/useFormControl.d.ts +38 -0
- package/cjs/useFormControl/useFormControl.js +138 -0
- package/cjs/{FormControl/utils.js → useFormControl/utils/nameToPath.js} +0 -0
- package/cjs/useToaster/useToaster.js +2 -5
- package/dist/rsuite-no-reset-rtl.css +246 -265
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +246 -265
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +246 -265
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +246 -265
- package/dist/rsuite.js +389 -257
- 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/Accordion/Accordion.js +1 -1
- package/esm/Affix/Affix.js +1 -2
- package/esm/Animation/Bounce.js +1 -2
- package/esm/Animation/Collapse.js +1 -2
- package/esm/Animation/Fade.js +1 -2
- package/esm/Animation/Slide.js +1 -2
- package/esm/AutoComplete/AutoComplete.d.ts +2 -2
- package/esm/AutoComplete/AutoComplete.js +1 -2
- package/esm/Avatar/Avatar.js +1 -2
- package/esm/AvatarGroup/AvatarGroup.js +1 -2
- package/esm/Badge/Badge.js +1 -2
- package/esm/Breadcrumb/Breadcrumb.js +1 -2
- package/esm/Button/Button.d.ts +2 -2
- package/esm/Button/Button.js +1 -2
- package/esm/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/esm/ButtonGroup/ButtonGroup.js +1 -2
- package/esm/ButtonToolbar/ButtonToolbar.js +1 -2
- package/esm/Calendar/Calendar.js +3 -4
- package/esm/Calendar/CalendarBody.js +1 -4
- package/esm/Calendar/CalendarContainer.js +1 -1
- package/esm/Calendar/CalendarHeader.js +1 -1
- package/esm/Calendar/CalendarProvider.d.ts +1 -1
- package/esm/Calendar/Grid/GridCell.js +1 -2
- package/esm/Calendar/Grid/GridHeaderRow.js +1 -2
- package/esm/Calendar/Grid/GridRow.d.ts +2 -0
- package/esm/Calendar/Grid/GridRow.js +5 -4
- package/esm/Calendar/MonthDropdown/MonthDropdownItem.js +1 -2
- package/esm/Calendar/hooks/useCalendar.d.ts +24 -2
- package/esm/Calendar/hooks/useCalendar.js +35 -2
- package/esm/Card/Card.js +1 -2
- package/esm/CardGroup/CardGroup.js +1 -2
- package/esm/Carousel/Carousel.js +1 -2
- package/esm/CascadeTree/CascadeTree.js +1 -2
- package/esm/CascadeTree/SearchView.js +1 -2
- package/esm/CascadeTree/TreeView.js +1 -2
- package/esm/Cascader/Cascader.js +1 -2
- package/esm/CheckPicker/CheckPicker.js +1 -2
- package/esm/CheckTree/CheckTree.js +1 -2
- package/esm/CheckTree/CheckTreeNode.js +1 -2
- package/esm/CheckTree/CheckTreeView.js +1 -2
- package/esm/CheckTreePicker/CheckTreePicker.js +1 -2
- package/esm/Checkbox/Checkbox.js +1 -2
- package/esm/CheckboxGroup/CheckboxGroup.js +1 -2
- package/esm/Container/Container.js +1 -2
- package/esm/CustomProvider/CustomProvider.d.ts +1 -271
- package/esm/CustomProvider/CustomProvider.js +1 -1
- package/esm/CustomProvider/index.d.ts +1 -6
- package/esm/CustomProvider/index.js +0 -6
- package/esm/DateInput/DateInput.js +1 -2
- package/esm/DateInput/hooks/useDateInputState.js +1 -1
- package/esm/DatePicker/DatePicker.js +2 -3
- package/esm/DatePicker/hooks/useFocus.js +1 -2
- package/esm/DateRangeInput/DateRangeInput.js +1 -2
- package/esm/DateRangePicker/DateRangePicker.js +2 -3
- package/esm/DateRangePicker/Header.js +1 -1
- package/esm/DateRangePicker/utils.d.ts +1 -1
- package/esm/DateRangePicker/utils.js +1 -1
- package/esm/Divider/Divider.js +1 -2
- package/esm/Drawer/Drawer.js +1 -2
- package/esm/Dropdown/Dropdown.js +1 -2
- package/esm/Dropdown/DropdownMenu.js +1 -2
- package/esm/FlexboxGrid/FlexboxGrid.js +1 -2
- package/esm/Form/Form.js +1 -2
- package/esm/Form/FormContext.d.ts +1 -1
- package/esm/Form/hooks/useFormValidate.js +1 -1
- package/esm/FormControl/FormControl.js +54 -85
- package/esm/FormControlLabel/FormControlLabel.js +1 -2
- package/esm/FormErrorMessage/FormErrorMessage.js +1 -2
- package/esm/FormGroup/FormGroup.js +1 -2
- package/esm/FormHelpText/FormHelpText.js +1 -2
- package/esm/FormStack/FormStack.js +1 -2
- package/esm/Grid/Col.js +1 -2
- package/esm/Grid/Grid.js +1 -2
- package/esm/Grid/Row.js +1 -2
- package/esm/Heading/Heading.js +1 -2
- package/esm/Highlight/Highlight.js +2 -3
- package/esm/IconButton/IconButton.js +1 -2
- package/esm/Image/Image.js +2 -3
- package/esm/InlineEdit/InlineEdit.js +1 -2
- package/esm/Input/Input.js +2 -2
- package/esm/InputGroup/InputGroup.js +1 -2
- package/esm/InputNumber/index.d.ts +12 -2
- package/esm/InputNumber/index.js +8 -1
- package/esm/InputPicker/InputPicker.js +1 -2
- package/esm/InputPicker/utils.d.ts +1 -1
- package/esm/Kbd/Kbd.js +1 -2
- package/esm/Link/Link.js +1 -2
- package/esm/List/List.js +1 -2
- package/esm/Loader/Loader.js +1 -2
- package/esm/MaskedInput/MaskedInput.js +1 -1
- package/esm/Message/Message.js +1 -2
- package/esm/Modal/Modal.js +1 -2
- package/esm/Modal/ModalHeader.js +1 -2
- package/esm/MultiCascadeTree/MultiCascadeTree.js +1 -2
- package/esm/MultiCascadeTree/SearchView.js +1 -2
- package/esm/MultiCascadeTree/TreeView.js +1 -2
- package/esm/MultiCascader/MultiCascader.js +1 -2
- package/esm/Nav/Nav.js +1 -2
- package/esm/Nav/NavDropdownMenu.js +1 -2
- package/esm/Navbar/Navbar.d.ts +1 -1
- package/esm/Navbar/Navbar.js +1 -2
- package/esm/Navbar/NavbarDropdownMenu.js +1 -2
- package/esm/Navbar/NavbarToggle.d.ts +8 -3
- package/esm/Navbar/NavbarToggle.js +10 -15
- package/esm/Notification/Notification.js +1 -2
- package/{cjs/InputNumber/InputNumber.d.ts → esm/NumberInput/NumberInput.d.ts} +20 -8
- package/esm/NumberInput/NumberInput.js +157 -0
- package/esm/NumberInput/hooks/useEvents.d.ts +22 -0
- package/esm/NumberInput/hooks/useEvents.js +110 -0
- package/esm/NumberInput/hooks/useNumberInputValue.d.ts +7 -0
- package/esm/NumberInput/hooks/useNumberInputValue.js +29 -0
- package/esm/NumberInput/hooks/useWheelHandler.d.ts +5 -0
- package/esm/NumberInput/hooks/useWheelHandler.js +21 -0
- package/esm/NumberInput/index.d.ts +4 -0
- package/esm/NumberInput/index.js +8 -0
- package/esm/NumberInput/utils/number.d.ts +17 -0
- package/esm/NumberInput/utils/number.js +59 -0
- package/esm/Pagination/LimitPicker.d.ts +2 -2
- package/esm/Pagination/Pagination.d.ts +2 -2
- package/esm/Pagination/Pagination.js +1 -2
- package/esm/Pagination/PaginationGroup.js +1 -2
- package/esm/Panel/Panel.js +1 -2
- package/esm/PanelGroup/PanelGroup.js +1 -2
- package/esm/PasswordInput/PasswordInput.d.ts +4 -0
- package/esm/PasswordInput/PasswordInput.js +5 -4
- package/esm/PasswordStrengthMeter/PasswordStrengthMeter.js +1 -2
- package/esm/PinInput/PinInput.d.ts +36 -0
- package/esm/PinInput/PinInput.js +219 -0
- package/esm/PinInput/hooks/usePinInputRefs.d.ts +12 -0
- package/esm/PinInput/hooks/usePinInputRefs.js +58 -0
- package/esm/PinInput/hooks/usePinValue.d.ts +14 -0
- package/esm/PinInput/hooks/usePinValue.js +69 -0
- package/esm/PinInput/index.d.ts +4 -0
- package/esm/PinInput/index.js +4 -0
- package/esm/Placeholder/PlaceholderGraph.js +1 -2
- package/esm/Placeholder/PlaceholderGrid.js +1 -2
- package/esm/Placeholder/PlaceholderParagraph.js +1 -2
- package/esm/Popover/Popover.js +1 -2
- package/esm/Progress/ProgressCircle.js +1 -2
- package/esm/Progress/ProgressLine.js +1 -2
- package/esm/Radio/Radio.js +1 -2
- package/esm/RadioGroup/RadioGroup.js +1 -2
- package/esm/RadioTile/RadioTile.js +1 -2
- package/esm/RadioTileGroup/RadioTileGroup.js +1 -2
- package/esm/RangeSlider/RangeSlider.js +1 -2
- package/esm/Rate/Rate.js +1 -2
- package/esm/SelectPicker/SelectPicker.js +1 -2
- package/esm/Sidebar/Sidebar.js +1 -2
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +1 -2
- package/esm/Sidenav/Sidenav.js +1 -2
- package/esm/Sidenav/SidenavDropdownMenu.js +1 -2
- package/esm/Slider/Slider.d.ts +5 -1
- package/esm/Slider/Slider.js +12 -13
- package/esm/Stack/Stack.js +1 -2
- package/esm/Stat/Stat.js +1 -2
- package/esm/Stat/StatValue.js +1 -1
- package/esm/StatGroup/StatGroup.js +1 -2
- package/esm/Steps/Steps.js +1 -2
- package/esm/Table/Table.js +1 -1
- package/esm/Tabs/Tabs.js +1 -2
- package/esm/Tag/Tag.js +1 -2
- package/esm/TagInput/TagInput.js +1 -1
- package/esm/TagPicker/TagPicker.js +1 -1
- package/esm/Text/Text.js +1 -2
- package/esm/Textarea/Textarea.js +1 -2
- package/esm/TimePicker/TimePicker.d.ts +1 -2
- package/esm/TimePicker/TimePicker.js +1 -1
- package/esm/TimeRangePicker/TimeRangePicker.js +1 -1
- package/esm/Timeline/Timeline.js +1 -2
- package/esm/Toggle/Toggle.js +1 -2
- package/esm/Tooltip/Tooltip.js +1 -2
- package/esm/Tree/Tree.js +1 -2
- package/esm/Tree/TreeNode.js +1 -2
- package/esm/Tree/TreeNodeToggle.js +1 -2
- package/esm/Tree/TreeView.js +1 -2
- package/esm/Tree/hooks/useFocusTree.js +1 -2
- package/esm/TreePicker/TreePicker.js +1 -2
- package/esm/Uploader/Uploader.js +1 -2
- package/esm/Whisper/Whisper.js +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/esm/internals/Box/index.d.ts +1 -0
- package/esm/internals/Box/index.js +1 -0
- package/esm/internals/Burger/Burger.d.ts +16 -0
- package/esm/internals/Burger/Burger.js +41 -0
- package/esm/internals/Burger/index.d.ts +4 -0
- package/esm/internals/Burger/index.js +8 -0
- package/esm/internals/CloseButton/CloseButton.js +1 -2
- package/esm/internals/Menu/Menu.js +1 -1
- package/esm/internals/Menu/Menubar.js +1 -1
- package/esm/internals/Picker/PickerIndicator.js +1 -2
- package/esm/internals/Picker/hooks/useCombobox.d.ts +1 -1
- package/esm/internals/Plaintext/Plaintext.js +1 -2
- package/esm/internals/Provider/CustomContext.d.ts +253 -0
- package/esm/internals/Provider/CustomContext.js +3 -0
- package/esm/internals/Provider/types.d.ts +236 -0
- package/esm/internals/Ripple/Ripple.js +1 -2
- package/esm/internals/SafeAnchor/SafeAnchor.js +1 -1
- package/esm/internals/Windowing/List.js +1 -1
- package/esm/internals/hooks/index.d.ts +1 -0
- package/esm/internals/hooks/index.js +1 -0
- package/esm/{CustomProvider → internals/hooks}/useCustom.d.ts +4 -4
- package/esm/{CustomProvider → internals/hooks}/useCustom.js +4 -4
- package/esm/internals/hooks/useStyles.js +1 -1
- package/esm/internals/hooks/useToggleCaret.js +1 -1
- package/esm/{CustomProvider → internals/intl}/FormattedDate.js +1 -1
- package/esm/{CustomProvider → internals/intl}/FormattedNumber.js +1 -1
- package/esm/internals/types/picker.d.ts +2 -2
- package/esm/internals/types/sizes.d.ts +2 -0
- package/esm/internals/types/sizes.js +3 -1
- package/esm/internals/utils/date/getWeekStartDates.d.ts +0 -1
- package/esm/internals/utils/date/getWeekStartDates.js +2 -4
- package/esm/internals/utils/react/createComponent.js +12 -2
- package/esm/{FormControl → useFormControl}/hooks/useField.d.ts +3 -3
- package/esm/{FormControl → useFormControl}/hooks/useField.js +4 -5
- package/esm/useFormControl/hooks/useRegisterModel.d.ts +2 -0
- package/esm/{FormControl → useFormControl}/hooks/useRegisterModel.js +2 -3
- package/esm/useFormControl/index.d.ts +4 -0
- package/esm/useFormControl/index.js +8 -0
- package/esm/useFormControl/useFormControl.d.ts +38 -0
- package/esm/useFormControl/useFormControl.js +133 -0
- package/esm/{FormControl/utils.js → useFormControl/utils/nameToPath.js} +0 -0
- package/esm/useToaster/useToaster.js +1 -3
- package/internals/Burger/styles/index.less +67 -0
- package/internals/CloseButton/styles/index.less +0 -10
- package/internals/Picker/styles/index.less +13 -10
- package/internals/Picker/styles/mixin.less +3 -3
- package/package.json +3 -3
- package/styles/color-modes/dark.less +7 -10
- package/styles/color-modes/high-contrast.less +3 -6
- package/styles/color-modes/light.less +5 -8
- package/styles/index.less +3 -1
- package/styles/mixins/utilities.less +2 -5
- package/useFormControl/package.json +7 -0
- package/cjs/CustomProvider/types.d.ts +0 -234
- package/cjs/FormControl/hooks/useRegisterModel.d.ts +0 -3
- package/cjs/InputNumber/InputNumber.js +0 -300
- package/esm/CustomProvider/types.d.ts +0 -234
- package/esm/FormControl/hooks/useRegisterModel.d.ts +0 -3
- package/esm/InputNumber/InputNumber.js +0 -293
- /package/cjs/{CustomProvider → internals/Provider}/types.js +0 -0
- /package/cjs/{CustomProvider → internals/intl}/FormattedDate.d.ts +0 -0
- /package/cjs/{CustomProvider → internals/intl}/FormattedNumber.d.ts +0 -0
- /package/cjs/{FormControl/utils.d.ts → useFormControl/utils/nameToPath.d.ts} +0 -0
- /package/esm/{CustomProvider → internals/Provider}/types.js +0 -0
- /package/esm/{CustomProvider → internals/intl}/FormattedDate.d.ts +0 -0
- /package/esm/{CustomProvider → internals/intl}/FormattedNumber.d.ts +0 -0
- /package/esm/{FormControl/utils.d.ts → useFormControl/utils/nameToPath.d.ts} +0 -0
package/esm/Navbar/Navbar.js
CHANGED
|
@@ -7,8 +7,7 @@ import NavbarToggle from "./NavbarToggle.js";
|
|
|
7
7
|
import NavbarDrawer from "./NavbarDrawer.js";
|
|
8
8
|
import Box from "../internals/Box/index.js";
|
|
9
9
|
import { forwardRef } from "../internals/utils/index.js";
|
|
10
|
-
import { useStyles, useEventCallback, useUniqueId } from "../internals/hooks/index.js";
|
|
11
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
10
|
+
import { useStyles, useCustom, useEventCallback, useUniqueId } from "../internals/hooks/index.js";
|
|
12
11
|
import { NavbarContext } from "./NavbarContext.js";
|
|
13
12
|
const Subcomponents = {
|
|
14
13
|
Brand: NavbarBrand,
|
|
@@ -8,9 +8,8 @@ import PageNextIcon from '@rsuite/icons/PageNext';
|
|
|
8
8
|
import Disclosure from "../internals/Disclosure/index.js";
|
|
9
9
|
import NavContext from "../Nav/NavContext.js";
|
|
10
10
|
import { mergeRefs } from "../internals/utils/index.js";
|
|
11
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
11
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
12
12
|
import { NavbarContext } from "./NavbarContext.js";
|
|
13
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
14
13
|
/**
|
|
15
14
|
* @private this component is not supposed to be used directly
|
|
16
15
|
* Instead it's rendered by a <Nav.Menu> within a <Navbar>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
2
|
+
import { BurgerProps } from '../internals/Burger';
|
|
3
|
+
export interface NavbarToggleProps extends Omit<BurgerProps, 'onToggle'> {
|
|
4
|
+
/**
|
|
5
|
+
* Callback function that is called when the toggle is clicked.
|
|
6
|
+
*/
|
|
7
|
+
onToggle?: (open: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const NavbarToggle: React.ForwardRefExoticComponent<NavbarToggleProps & React.RefAttributes<any>>;
|
|
5
10
|
export default NavbarToggle;
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import MenuIcon from '@rsuite/icons/Menu';
|
|
4
|
+
import { Burger } from "../internals/Burger/index.js";
|
|
6
5
|
import { useEventCallback } from "../internals/hooks/index.js";
|
|
7
|
-
import {
|
|
6
|
+
import { createChainedFunction } from "../internals/utils/index.js";
|
|
8
7
|
import { NavbarContext } from "./NavbarContext.js";
|
|
9
|
-
const Toggle = createComponent({
|
|
10
|
-
name: 'NavbarToggle',
|
|
11
|
-
componentAs: IconButton,
|
|
12
|
-
componentClassPrefix: 'navbar-toggle',
|
|
13
|
-
icon: /*#__PURE__*/React.createElement(MenuIcon, null)
|
|
14
|
-
});
|
|
15
8
|
const NavbarToggle = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
16
9
|
const {
|
|
17
|
-
appearance: navbarAppearance,
|
|
18
10
|
navbarId,
|
|
19
|
-
|
|
11
|
+
open: contextOpen,
|
|
12
|
+
onToggle: onToggleContext
|
|
20
13
|
} = useContext(NavbarContext) || {};
|
|
21
14
|
const {
|
|
22
|
-
|
|
15
|
+
open,
|
|
23
16
|
onClick,
|
|
17
|
+
onToggle,
|
|
24
18
|
...rest
|
|
25
19
|
} = props;
|
|
26
20
|
const handleClick = useEventCallback(() => {
|
|
27
21
|
onToggle === null || onToggle === void 0 || onToggle(true);
|
|
22
|
+
onToggleContext === null || onToggleContext === void 0 || onToggleContext(true);
|
|
28
23
|
});
|
|
29
|
-
return /*#__PURE__*/React.createElement(
|
|
24
|
+
return /*#__PURE__*/React.createElement(Burger, _extends({
|
|
30
25
|
ref: ref,
|
|
31
|
-
appearance: appearance,
|
|
32
26
|
onClick: createChainedFunction(handleClick, onClick),
|
|
33
|
-
"aria-controls": `${navbarId}-drawer
|
|
27
|
+
"aria-controls": `${navbarId}-drawer`,
|
|
28
|
+
open: typeof open === 'boolean' ? open : contextOpen
|
|
34
29
|
}, rest));
|
|
35
30
|
});
|
|
36
31
|
NavbarToggle.displayName = 'NavbarToggle';
|
|
@@ -5,9 +5,8 @@ import useDelayedClosure from "../toaster/hooks/useDelayedClosure.js";
|
|
|
5
5
|
import CloseButton from "../internals/CloseButton/index.js";
|
|
6
6
|
import Box from "../internals/Box/index.js";
|
|
7
7
|
import { MESSAGE_STATUS_ICONS } from "../internals/constants/statusIcons.js";
|
|
8
|
-
import { useStyles, useIsMounted, useEventCallback } from "../internals/hooks/index.js";
|
|
8
|
+
import { useStyles, useCustom, useIsMounted, useEventCallback } from "../internals/hooks/index.js";
|
|
9
9
|
import { forwardRef, mergeRefs } from "../internals/utils/index.js";
|
|
10
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
11
10
|
/**
|
|
12
11
|
* The `Notification` component is used to display global messages and notifications.
|
|
13
12
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps } from '../internals/Box';
|
|
3
|
-
import type { SanitizedInputProps, FormControlBaseProps, AppearanceType,
|
|
4
|
-
export interface
|
|
3
|
+
import type { SanitizedInputProps, FormControlBaseProps, AppearanceType, BasicSize } from '../internals/types';
|
|
4
|
+
export interface NumberInputProps<T = number | string | null> extends Omit<SanitizedInputProps, 'value' | 'defaultValue' | 'prefix'>, BoxProps, FormControlBaseProps<T> {
|
|
5
5
|
/**
|
|
6
6
|
* Button can have different appearances
|
|
7
7
|
*/
|
|
@@ -41,27 +41,39 @@ export interface InputNumberProps<T = number | string | null> extends Omit<Sanit
|
|
|
41
41
|
prefix?: React.ReactNode;
|
|
42
42
|
/**
|
|
43
43
|
* Sets the element displayed on the right side of the component
|
|
44
|
+
* @deprecated Use `suffix` instead.
|
|
44
45
|
*/
|
|
45
46
|
postfix?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the element displayed on the right side of the component
|
|
49
|
+
*/
|
|
50
|
+
suffix?: React.ReactNode;
|
|
46
51
|
/**
|
|
47
52
|
* An Input can have different sizes
|
|
48
53
|
*/
|
|
49
|
-
size?:
|
|
54
|
+
size?: BasicSize;
|
|
50
55
|
/**
|
|
51
56
|
* Whether the value can be changed through the wheel event
|
|
52
57
|
*/
|
|
53
58
|
scrollable?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Show or hide control icons:
|
|
61
|
+
* - `true` (default): show default up/down buttons.
|
|
62
|
+
* - `false`: hide controls.
|
|
63
|
+
* - `(trigger) => ReactNode`: fully custom control per trigger ('up' | 'down').
|
|
64
|
+
*/
|
|
65
|
+
controls?: boolean | ((trigger: 'up' | 'down') => React.ReactNode);
|
|
54
66
|
/**
|
|
55
67
|
* Callback function when wheel event is triggered
|
|
56
68
|
*/
|
|
57
69
|
onWheel?: (event: React.WheelEvent) => void;
|
|
58
70
|
}
|
|
59
71
|
/**
|
|
60
|
-
* The `
|
|
61
|
-
* @see https://rsuitejs.com/components/input
|
|
72
|
+
* The `NumberInput` component is used to enter a numerical value.
|
|
73
|
+
* @see https://rsuitejs.com/components/number-input
|
|
62
74
|
*/
|
|
63
|
-
declare const
|
|
75
|
+
declare const NumberInput: import("../internals/types").InternalRefForwardingComponent<import("../internals/types").InternalRefForwardingComponent<"div", import("../InputGroup/InputGroup").InputGroupProps, never> & {
|
|
64
76
|
Addon: import("../internals/types").InternalRefForwardingComponent<"span", import("../InputGroup/InputGroupAddon").InputGroupAddonProps, never> & Record<string, never>;
|
|
65
77
|
Button: React.ForwardRefExoticComponent<import("../Button").ButtonProps & React.RefAttributes<any>>;
|
|
66
|
-
},
|
|
67
|
-
export default
|
|
78
|
+
}, NumberInputProps<string | number | null>, never> & Record<string, never>;
|
|
79
|
+
export default NumberInput;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ArrowUpLineIcon from '@rsuite/icons/ArrowUpLine';
|
|
5
|
+
import ArrowDownLineIcon from '@rsuite/icons/ArrowDownLine';
|
|
6
|
+
import InputGroup from "../InputGroup/InputGroup.js";
|
|
7
|
+
import InputGroupAddon from "../InputGroup/InputGroupAddon.js";
|
|
8
|
+
import Input from "../Input/index.js";
|
|
9
|
+
import Button from "../Button/index.js";
|
|
10
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
11
|
+
import { forwardRef, partitionHTMLProps, createChainedFunction } from "../internals/utils/index.js";
|
|
12
|
+
import { useNumberInputValue } from "./hooks/useNumberInputValue.js";
|
|
13
|
+
import { useEvents } from "./hooks/useEvents.js";
|
|
14
|
+
import { valueReachesMax, valueReachesMin } from "./utils/number.js";
|
|
15
|
+
/**
|
|
16
|
+
* The `NumberInput` component is used to enter a numerical value.
|
|
17
|
+
* @see https://rsuitejs.com/components/number-input
|
|
18
|
+
*/
|
|
19
|
+
const NumberInput = forwardRef((props, ref) => {
|
|
20
|
+
const {
|
|
21
|
+
propsWithDefaults
|
|
22
|
+
} = useCustom('NumberInput', props);
|
|
23
|
+
const {
|
|
24
|
+
as,
|
|
25
|
+
className,
|
|
26
|
+
classPrefix = 'number-input',
|
|
27
|
+
controls = true,
|
|
28
|
+
disabled,
|
|
29
|
+
decimalSeparator,
|
|
30
|
+
formatter,
|
|
31
|
+
readOnly,
|
|
32
|
+
plaintext,
|
|
33
|
+
value: valueProp,
|
|
34
|
+
defaultValue,
|
|
35
|
+
size,
|
|
36
|
+
prefix: prefixElement,
|
|
37
|
+
postfix,
|
|
38
|
+
suffix = postfix,
|
|
39
|
+
step = 1,
|
|
40
|
+
buttonAppearance = 'subtle',
|
|
41
|
+
min: minProp,
|
|
42
|
+
max: maxProp,
|
|
43
|
+
scrollable = true,
|
|
44
|
+
onChange,
|
|
45
|
+
onWheel,
|
|
46
|
+
onBlur: onBlurProp,
|
|
47
|
+
onFocus: onFocusProp,
|
|
48
|
+
...rest
|
|
49
|
+
} = propsWithDefaults;
|
|
50
|
+
const min = minProp !== null && minProp !== void 0 ? minProp : -Infinity;
|
|
51
|
+
const max = maxProp !== null && maxProp !== void 0 ? maxProp : Infinity;
|
|
52
|
+
const [value, setValue] = useControlled(valueProp, defaultValue);
|
|
53
|
+
const {
|
|
54
|
+
withPrefix,
|
|
55
|
+
merge,
|
|
56
|
+
prefix
|
|
57
|
+
} = useStyles(classPrefix);
|
|
58
|
+
const classes = merge(className, withPrefix());
|
|
59
|
+
const [htmlInputProps, restProps] = partitionHTMLProps(rest);
|
|
60
|
+
const onChangeValue = (currentValue, event) => {
|
|
61
|
+
if (currentValue !== value) {
|
|
62
|
+
setValue(currentValue);
|
|
63
|
+
onChange === null || onChange === void 0 || onChange(currentValue, event);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const {
|
|
67
|
+
inputRef,
|
|
68
|
+
isFocused,
|
|
69
|
+
onStepUp,
|
|
70
|
+
onStepDown,
|
|
71
|
+
onKeyDown,
|
|
72
|
+
onFocus,
|
|
73
|
+
onBlur
|
|
74
|
+
} = useEvents({
|
|
75
|
+
min: minProp,
|
|
76
|
+
max: maxProp,
|
|
77
|
+
step,
|
|
78
|
+
value,
|
|
79
|
+
scrollable,
|
|
80
|
+
disabled,
|
|
81
|
+
readOnly,
|
|
82
|
+
decimalSeparator,
|
|
83
|
+
onWheel,
|
|
84
|
+
onChangeValue
|
|
85
|
+
});
|
|
86
|
+
const handleChange = useEventCallback((value, event) => {
|
|
87
|
+
const separator = decimalSeparator || '.';
|
|
88
|
+
const escapedSeparator = separator.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
89
|
+
|
|
90
|
+
// Support both custom decimalSeparator and standard decimal point '.'
|
|
91
|
+
let regex;
|
|
92
|
+
if (separator !== '.') {
|
|
93
|
+
// Allow both the custom separator and the standard decimal point
|
|
94
|
+
regex = new RegExp(`^-?(?:\\d+)?([.${escapedSeparator}])?\\d*$`);
|
|
95
|
+
} else {
|
|
96
|
+
regex = new RegExp(`^-?(?:\\d+)?(${escapedSeparator})?\\d*$`);
|
|
97
|
+
}
|
|
98
|
+
if (!regex.test(value) && value !== '') {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
onChangeValue(value, event);
|
|
102
|
+
});
|
|
103
|
+
const inputValue = useNumberInputValue({
|
|
104
|
+
value,
|
|
105
|
+
isFocused,
|
|
106
|
+
formatter,
|
|
107
|
+
decimalSeparator
|
|
108
|
+
});
|
|
109
|
+
const input = /*#__PURE__*/React.createElement(Input, _extends({}, htmlInputProps, {
|
|
110
|
+
ref: plaintext ? ref : undefined,
|
|
111
|
+
inputRef: inputRef,
|
|
112
|
+
autoComplete: "off",
|
|
113
|
+
inputMode: "numeric",
|
|
114
|
+
step: step,
|
|
115
|
+
value: inputValue,
|
|
116
|
+
disabled: disabled,
|
|
117
|
+
readOnly: readOnly,
|
|
118
|
+
plaintext: plaintext,
|
|
119
|
+
onKeyDown: onKeyDown,
|
|
120
|
+
onChange: handleChange,
|
|
121
|
+
onBlur: createChainedFunction(onBlur, onBlurProp),
|
|
122
|
+
onFocus: createChainedFunction(onFocus, onFocusProp)
|
|
123
|
+
}));
|
|
124
|
+
if (plaintext) {
|
|
125
|
+
return input;
|
|
126
|
+
}
|
|
127
|
+
const stepUpDisabled = disabled || readOnly || valueReachesMax(value, max);
|
|
128
|
+
const stepDownDisabled = disabled || readOnly || valueReachesMin(value, min);
|
|
129
|
+
return /*#__PURE__*/React.createElement(InputGroup, _extends({
|
|
130
|
+
as: as,
|
|
131
|
+
ref: ref,
|
|
132
|
+
className: classes,
|
|
133
|
+
disabled: disabled,
|
|
134
|
+
size: size,
|
|
135
|
+
inside: true
|
|
136
|
+
}, restProps), prefixElement && /*#__PURE__*/React.createElement(InputGroupAddon, null, prefixElement), input, suffix && /*#__PURE__*/React.createElement(InputGroupAddon, null, suffix), controls && /*#__PURE__*/React.createElement("span", {
|
|
137
|
+
className: prefix('btn-group-vertical')
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
139
|
+
tabIndex: -1,
|
|
140
|
+
appearance: buttonAppearance,
|
|
141
|
+
className: prefix('touchspin-up'),
|
|
142
|
+
onClick: onStepUp,
|
|
143
|
+
disabled: stepUpDisabled,
|
|
144
|
+
"aria-label": "Increment",
|
|
145
|
+
size: size
|
|
146
|
+
}, typeof controls === 'function' ? controls('up') : /*#__PURE__*/React.createElement(ArrowUpLineIcon, null)), /*#__PURE__*/React.createElement(Button, {
|
|
147
|
+
tabIndex: -1,
|
|
148
|
+
appearance: buttonAppearance,
|
|
149
|
+
className: prefix('touchspin-down'),
|
|
150
|
+
onClick: onStepDown,
|
|
151
|
+
disabled: stepDownDisabled,
|
|
152
|
+
"aria-label": "Decrement",
|
|
153
|
+
size: size
|
|
154
|
+
}, typeof controls === 'function' ? controls('down') : /*#__PURE__*/React.createElement(ArrowDownLineIcon, null))));
|
|
155
|
+
});
|
|
156
|
+
NumberInput.displayName = 'NumberInput';
|
|
157
|
+
export default NumberInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface UseEventsParams {
|
|
3
|
+
value?: number | string | null;
|
|
4
|
+
scrollable: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
decimalSeparator?: string;
|
|
11
|
+
onChangeValue: (currentValue: number | string, event: React.SyntheticEvent) => void;
|
|
12
|
+
onWheel?: (event: React.WheelEvent<HTMLInputElement>) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function useEvents(params: UseEventsParams): {
|
|
15
|
+
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
16
|
+
isFocused: boolean;
|
|
17
|
+
onStepUp: (...args: any[]) => any;
|
|
18
|
+
onStepDown: (...args: any[]) => any;
|
|
19
|
+
onKeyDown: (...args: any[]) => any;
|
|
20
|
+
onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
onFocus: () => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRef, useState, useCallback } from 'react';
|
|
3
|
+
import { useEventCallback } from "../../internals/hooks/index.js";
|
|
4
|
+
import { KEY_VALUES } from "../../internals/constants/index.js";
|
|
5
|
+
import { clampValue, decimals } from "../utils/number.js";
|
|
6
|
+
import { useWheelHandler } from "./useWheelHandler.js";
|
|
7
|
+
export function useEvents(params) {
|
|
8
|
+
const inputRef = useRef(null);
|
|
9
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
10
|
+
const {
|
|
11
|
+
value,
|
|
12
|
+
onChangeValue,
|
|
13
|
+
scrollable,
|
|
14
|
+
disabled,
|
|
15
|
+
readOnly,
|
|
16
|
+
onWheel: onWheelProp,
|
|
17
|
+
min,
|
|
18
|
+
max,
|
|
19
|
+
step = 1,
|
|
20
|
+
decimalSeparator
|
|
21
|
+
} = params;
|
|
22
|
+
const getSafeValue = value => clampValue(value, min, max);
|
|
23
|
+
const onStepUp = useEventCallback(event => {
|
|
24
|
+
const val = +(value || 0);
|
|
25
|
+
const bit = decimals(val, step);
|
|
26
|
+
onChangeValue(getSafeValue((val + step).toFixed(bit)), event);
|
|
27
|
+
});
|
|
28
|
+
const onStepDown = useEventCallback(event => {
|
|
29
|
+
const val = +(value || 0);
|
|
30
|
+
const bit = decimals(val, step);
|
|
31
|
+
onChangeValue(getSafeValue((val - step).toFixed(bit)), event);
|
|
32
|
+
});
|
|
33
|
+
const onKeyDown = useEventCallback(event => {
|
|
34
|
+
switch (event.key) {
|
|
35
|
+
case KEY_VALUES.UP:
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
onStepUp(event);
|
|
38
|
+
break;
|
|
39
|
+
case KEY_VALUES.DOWN:
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
onStepDown(event);
|
|
42
|
+
break;
|
|
43
|
+
case KEY_VALUES.HOME:
|
|
44
|
+
if (typeof min !== 'undefined') {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
onChangeValue(getSafeValue(min), event);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case KEY_VALUES.END:
|
|
50
|
+
if (typeof max !== 'undefined') {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
onChangeValue(getSafeValue(max), event);
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const handleWheel = useEventCallback(event => {
|
|
60
|
+
if (!scrollable) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!disabled && !readOnly && event.target === document.activeElement) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
const delta = event.wheelDelta || -event.deltaY || -event.detail;
|
|
67
|
+
if (delta > 0) {
|
|
68
|
+
onStepDown(event);
|
|
69
|
+
}
|
|
70
|
+
if (delta < 0) {
|
|
71
|
+
onStepUp(event);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
onWheelProp === null || onWheelProp === void 0 || onWheelProp(event);
|
|
75
|
+
});
|
|
76
|
+
const restoreDecimalSeparator = useCallback(value => {
|
|
77
|
+
if (decimalSeparator && value) {
|
|
78
|
+
// Handle both custom decimalSeparator and standard decimal point '.'
|
|
79
|
+
if (decimalSeparator !== '.') {
|
|
80
|
+
// Create a regex that matches both the custom separator and '.'
|
|
81
|
+
const separatorRegex = new RegExp(`[${decimalSeparator.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')}.]`, 'g');
|
|
82
|
+
return value.replace(separatorRegex, '.');
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}, [decimalSeparator]);
|
|
88
|
+
const onBlur = event => {
|
|
89
|
+
var _event$target;
|
|
90
|
+
const value = restoreDecimalSeparator((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
|
|
91
|
+
const targetValue = Number.parseFloat(value);
|
|
92
|
+
onChangeValue(getSafeValue(targetValue), event);
|
|
93
|
+
setIsFocused(false);
|
|
94
|
+
};
|
|
95
|
+
const onFocus = () => {
|
|
96
|
+
setIsFocused(true);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// wheel events
|
|
100
|
+
useWheelHandler(inputRef, handleWheel, scrollable);
|
|
101
|
+
return {
|
|
102
|
+
inputRef,
|
|
103
|
+
isFocused,
|
|
104
|
+
onStepUp,
|
|
105
|
+
onStepDown,
|
|
106
|
+
onKeyDown,
|
|
107
|
+
onBlur,
|
|
108
|
+
onFocus
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface UseNumberInputValueParams {
|
|
2
|
+
value?: number | string | null;
|
|
3
|
+
isFocused: boolean;
|
|
4
|
+
formatter?: (value: number | string) => string;
|
|
5
|
+
decimalSeparator?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function useNumberInputValue(params: UseNumberInputValueParams): string | number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
4
|
+
export function useNumberInputValue(params) {
|
|
5
|
+
const {
|
|
6
|
+
value,
|
|
7
|
+
isFocused,
|
|
8
|
+
formatter,
|
|
9
|
+
decimalSeparator
|
|
10
|
+
} = params;
|
|
11
|
+
const replaceDecimalSeparator = useCallback(val => {
|
|
12
|
+
if (decimalSeparator && val != null) {
|
|
13
|
+
return val.toString().replace('.', decimalSeparator);
|
|
14
|
+
}
|
|
15
|
+
return val;
|
|
16
|
+
}, [decimalSeparator]);
|
|
17
|
+
return useMemo(() => {
|
|
18
|
+
if (isNil(value)) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
if (isFocused) {
|
|
22
|
+
return replaceDecimalSeparator(value);
|
|
23
|
+
}
|
|
24
|
+
if (formatter) {
|
|
25
|
+
return formatter(value);
|
|
26
|
+
}
|
|
27
|
+
return replaceDecimalSeparator(value);
|
|
28
|
+
}, [formatter, isFocused, replaceDecimalSeparator, value]);
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import on from 'dom-lib/on';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Attach wheel listener to inputRef.
|
|
7
|
+
*/
|
|
8
|
+
export function useWheelHandler(inputRef, handleWheel, scrollable) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let wheelListener;
|
|
11
|
+
if (inputRef.current) {
|
|
12
|
+
wheelListener = on(inputRef.current, 'wheel', handleWheel, {
|
|
13
|
+
passive: false
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return () => {
|
|
17
|
+
var _wheelListener;
|
|
18
|
+
(_wheelListener = wheelListener) === null || _wheelListener === void 0 || _wheelListener.off();
|
|
19
|
+
};
|
|
20
|
+
}, [inputRef, handleWheel, scrollable]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clamp a value within min/max and handle NaN as empty string.
|
|
3
|
+
*/
|
|
4
|
+
export declare function clampValue(value: number | string, min?: number, max?: number): string;
|
|
5
|
+
export declare function decimals(...values: number[]): number;
|
|
6
|
+
/**
|
|
7
|
+
* Disable the upper limit of the number.
|
|
8
|
+
* @param value
|
|
9
|
+
* @param max
|
|
10
|
+
*/
|
|
11
|
+
export declare function valueReachesMax(value: number | string | null | undefined, max: number): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Disable the lower limit of the number.
|
|
14
|
+
* @param value
|
|
15
|
+
* @param min
|
|
16
|
+
*/
|
|
17
|
+
export declare function valueReachesMin(value: number | string | null | undefined, min: number): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import isNil from 'lodash/isNil';
|
|
3
|
+
/**
|
|
4
|
+
* Clamp a value within min/max and handle NaN as empty string.
|
|
5
|
+
*/
|
|
6
|
+
export function clampValue(value, min, max) {
|
|
7
|
+
const num = typeof value === 'string' ? parseFloat(value) : value;
|
|
8
|
+
if (Number.isNaN(num)) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
let result = num;
|
|
12
|
+
if (typeof max !== 'undefined' && result > max) {
|
|
13
|
+
result = max;
|
|
14
|
+
}
|
|
15
|
+
if (typeof min !== 'undefined' && result < min) {
|
|
16
|
+
result = min;
|
|
17
|
+
}
|
|
18
|
+
return result.toString();
|
|
19
|
+
}
|
|
20
|
+
function isNumber(value) {
|
|
21
|
+
return /(^-?|^\+?|^\d?)\d*\.\d+$/.test(value + '');
|
|
22
|
+
}
|
|
23
|
+
function getDecimalLength(value) {
|
|
24
|
+
if (isNumber(value)) {
|
|
25
|
+
return value.toString().split('.')[1].length;
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
export function decimals() {
|
|
30
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
+
values[_key] = arguments[_key];
|
|
32
|
+
}
|
|
33
|
+
const lengths = values.map(getDecimalLength);
|
|
34
|
+
return Math.max(...lengths);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Disable the upper limit of the number.
|
|
39
|
+
* @param value
|
|
40
|
+
* @param max
|
|
41
|
+
*/
|
|
42
|
+
export function valueReachesMax(value, max) {
|
|
43
|
+
if (!isNil(value)) {
|
|
44
|
+
return +value >= max;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Disable the lower limit of the number.
|
|
51
|
+
* @param value
|
|
52
|
+
* @param min
|
|
53
|
+
*/
|
|
54
|
+
export function valueReachesMin(value, min) {
|
|
55
|
+
if (!isNil(value)) {
|
|
56
|
+
return +value <= min;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type SelectPickerProps } from '../SelectPicker';
|
|
2
2
|
import { PaginationLocale } from '../locales';
|
|
3
|
-
import type { OnChangeCallback,
|
|
3
|
+
import type { OnChangeCallback, BasicSize } from '../internals/types';
|
|
4
4
|
interface LimitPickerProps extends Omit<SelectPickerProps<any>, 'locale' | 'disabled' | 'data'> {
|
|
5
5
|
disabled?: boolean | ((eventKey: number | string) => boolean);
|
|
6
6
|
limitOptions: number[];
|
|
7
7
|
locale: PaginationLocale;
|
|
8
8
|
limit: number;
|
|
9
|
-
size?:
|
|
9
|
+
size?: BasicSize;
|
|
10
10
|
prefix: (input: string) => string;
|
|
11
11
|
onChangeLimit: OnChangeCallback<any>;
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps } from '../internals/Box';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BasicSize } from '../internals/types';
|
|
4
4
|
import type { PaginationLocale } from '../locales';
|
|
5
5
|
export interface PaginationProps extends BoxProps {
|
|
6
6
|
/** Current page number */
|
|
@@ -30,7 +30,7 @@ export interface PaginationProps extends BoxProps {
|
|
|
30
30
|
/** Custom locale */
|
|
31
31
|
locale?: PaginationLocale;
|
|
32
32
|
/** A pagination can have different sizes */
|
|
33
|
-
size?:
|
|
33
|
+
size?: BasicSize;
|
|
34
34
|
/** callback function for pagination clicked */
|
|
35
35
|
onSelect?: (eventKey: string | number, event: React.MouseEvent) => void;
|
|
36
36
|
}
|
|
@@ -9,8 +9,7 @@ import PageEndIcon from '@rsuite/icons/PageEnd';
|
|
|
9
9
|
import PaginationButton from "./PaginationButton.js";
|
|
10
10
|
import Box from "../internals/Box/index.js";
|
|
11
11
|
import { forwardRef } from "../internals/utils/index.js";
|
|
12
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
13
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
12
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
14
13
|
const icons = {
|
|
15
14
|
more: /*#__PURE__*/React.createElement(MoreIcon, null),
|
|
16
15
|
first: /*#__PURE__*/React.createElement(PageTopIcon, null),
|
|
@@ -7,9 +7,8 @@ import Divider from "../Divider/index.js";
|
|
|
7
7
|
import Input from "../Input/index.js";
|
|
8
8
|
import LimitPicker from "./LimitPicker.js";
|
|
9
9
|
import Box from "../internals/Box/index.js";
|
|
10
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
10
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
11
11
|
import { forwardRef, tplTransform } from "../internals/utils/index.js";
|
|
12
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* The layout of the paging component.
|