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/Panel/Panel.js
CHANGED
|
@@ -6,8 +6,7 @@ import PanelBody from "./PanelBody.js";
|
|
|
6
6
|
import useExpanded from "./hooks/useExpanded.js";
|
|
7
7
|
import Box from "../internals/Box/index.js";
|
|
8
8
|
import { forwardRef } from "../internals/utils/index.js";
|
|
9
|
-
import { useStyles, useUniqueId, useEventCallback } from "../internals/hooks/index.js";
|
|
10
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
9
|
+
import { useStyles, useCustom, useUniqueId, useEventCallback } from "../internals/hooks/index.js";
|
|
11
10
|
import { PanelGroupContext } from "../PanelGroup/index.js";
|
|
12
11
|
/**
|
|
13
12
|
* The `Panel` component is used to display content that can be collapsed.
|
|
@@ -3,8 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import { forwardRef } from "../internals/utils/index.js";
|
|
6
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
7
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
6
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
8
7
|
export const PanelGroupContext = /*#__PURE__*/React.createContext({});
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -5,6 +5,10 @@ export interface PasswordInputProps extends Omit<InputProps, 'type' | 'plaintext
|
|
|
5
5
|
visible?: boolean;
|
|
6
6
|
/** Default visibility state of the password */
|
|
7
7
|
defaultVisible?: boolean;
|
|
8
|
+
/** The icon element to display before the input field */
|
|
9
|
+
startIcon?: React.ReactNode;
|
|
10
|
+
/** The icon element to display after the input field */
|
|
11
|
+
endIcon?: React.ReactNode;
|
|
8
12
|
/** Custom icon for visibility toggle */
|
|
9
13
|
renderVisibilityIcon?: (visible: boolean) => React.ReactNode;
|
|
10
14
|
/** Callback function triggered when the password visibility changes */
|
|
@@ -6,8 +6,7 @@ import InputGroup from "../InputGroup/index.js";
|
|
|
6
6
|
import EyeCloseIcon from '@rsuite/icons/EyeClose';
|
|
7
7
|
import VisibleIcon from '@rsuite/icons/Visible';
|
|
8
8
|
import { forwardRef } from "../internals/utils/index.js";
|
|
9
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
10
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
9
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
11
10
|
const PasswordInput = forwardRef((props, ref) => {
|
|
12
11
|
const {
|
|
13
12
|
propsWithDefaults
|
|
@@ -25,6 +24,8 @@ const PasswordInput = forwardRef((props, ref) => {
|
|
|
25
24
|
name,
|
|
26
25
|
readOnly,
|
|
27
26
|
inputRef,
|
|
27
|
+
startIcon,
|
|
28
|
+
endIcon,
|
|
28
29
|
onChange,
|
|
29
30
|
onVisibleChange,
|
|
30
31
|
renderVisibilityIcon,
|
|
@@ -45,7 +46,7 @@ const PasswordInput = forwardRef((props, ref) => {
|
|
|
45
46
|
ref: ref,
|
|
46
47
|
size: size,
|
|
47
48
|
className: classes
|
|
48
|
-
}, rest), /*#__PURE__*/React.createElement(Input, {
|
|
49
|
+
}, rest), startIcon && /*#__PURE__*/React.createElement(InputGroup.Addon, null, startIcon), /*#__PURE__*/React.createElement(Input, {
|
|
49
50
|
type: visible ? 'text' : 'password',
|
|
50
51
|
value: value,
|
|
51
52
|
defaultValue: defaultValue,
|
|
@@ -56,7 +57,7 @@ const PasswordInput = forwardRef((props, ref) => {
|
|
|
56
57
|
name: name,
|
|
57
58
|
id: id,
|
|
58
59
|
inputRef: inputRef
|
|
59
|
-
}), /*#__PURE__*/React.createElement(InputGroup.Button, {
|
|
60
|
+
}), endIcon ? /*#__PURE__*/React.createElement(InputGroup.Addon, null, endIcon) : /*#__PURE__*/React.createElement(InputGroup.Button, {
|
|
60
61
|
tabIndex: -1,
|
|
61
62
|
onClick: handleToggleVisibility,
|
|
62
63
|
"aria-label": "Toggle password visibility"
|
|
@@ -4,8 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import Text from "../Text/index.js";
|
|
6
6
|
import { forwardRef } from "../internals/utils/index.js";
|
|
7
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
7
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
9
8
|
const PasswordStrengthMeter = forwardRef((props, ref) => {
|
|
10
9
|
const {
|
|
11
10
|
propsWithDefaults
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BoxProps } from '../internals/Box';
|
|
2
|
+
import type { BasicSize } from '../internals/types';
|
|
3
|
+
export interface PinInputProps extends BoxProps {
|
|
4
|
+
/** Whether input fields are attached (no gap between) */
|
|
5
|
+
attached?: boolean;
|
|
6
|
+
/** Whether to auto-focus the first input on mount */
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
/** Type of allowed input: number, alphabetic, alphanumeric, or custom regex */
|
|
9
|
+
type?: 'number' | 'alphabetic' | 'alphanumeric' | RegExp;
|
|
10
|
+
/** Default PIN value */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** Whether to disable PIN input */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Number of PIN digits */
|
|
15
|
+
length?: number;
|
|
16
|
+
/** Whether to mask PIN input (like password) */
|
|
17
|
+
mask?: boolean;
|
|
18
|
+
/** Name for form submission */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Whether to optimize for one-time password (OTP) input */
|
|
21
|
+
otp?: boolean;
|
|
22
|
+
/** Placeholder for input fields */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Whether the input is read-only */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/** Input size */
|
|
27
|
+
size?: BasicSize;
|
|
28
|
+
/** PIN value */
|
|
29
|
+
value?: string;
|
|
30
|
+
/** Callback function when PIN input is completed */
|
|
31
|
+
onComplete?: (value: string) => void;
|
|
32
|
+
/** Callback function when PIN value changes */
|
|
33
|
+
onChange?: (value: string) => void;
|
|
34
|
+
}
|
|
35
|
+
declare const PinInput: import("../internals/types").InternalRefForwardingComponent<"div", PinInputProps, never> & Record<string, never>;
|
|
36
|
+
export default PinInput;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Input from "../Input/index.js";
|
|
5
|
+
import usePinInputRefs from "./hooks/usePinInputRefs.js";
|
|
6
|
+
import usePinValue from "./hooks/usePinValue.js";
|
|
7
|
+
import { Box } from "../internals/Box/index.js";
|
|
8
|
+
import { HStack } from "../Stack/index.js";
|
|
9
|
+
import { forwardRef } from "../internals/utils/index.js";
|
|
10
|
+
import { useStyles, useCustom, useEventCallback } from "../internals/hooks/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Map `type` prop to regex for allowed keys
|
|
13
|
+
*/
|
|
14
|
+
function getAllowedKeys(type) {
|
|
15
|
+
if (type instanceof RegExp) {
|
|
16
|
+
return type;
|
|
17
|
+
}
|
|
18
|
+
switch (type) {
|
|
19
|
+
case 'alphabetic':
|
|
20
|
+
return /[A-Za-z]/;
|
|
21
|
+
case 'alphanumeric':
|
|
22
|
+
return /[A-Za-z0-9]/;
|
|
23
|
+
default:
|
|
24
|
+
// number and any other fallback
|
|
25
|
+
return /\d/;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const PinInput = forwardRef((props, ref) => {
|
|
29
|
+
const {
|
|
30
|
+
propsWithDefaults
|
|
31
|
+
} = useCustom('PinInput', props);
|
|
32
|
+
const {
|
|
33
|
+
type = 'number',
|
|
34
|
+
as,
|
|
35
|
+
autoFocus,
|
|
36
|
+
attached,
|
|
37
|
+
className,
|
|
38
|
+
classPrefix = 'pin-input',
|
|
39
|
+
defaultValue = '',
|
|
40
|
+
disabled,
|
|
41
|
+
length = 4,
|
|
42
|
+
mask,
|
|
43
|
+
name,
|
|
44
|
+
otp,
|
|
45
|
+
placeholder,
|
|
46
|
+
readOnly,
|
|
47
|
+
size = 'md',
|
|
48
|
+
value: controlValue,
|
|
49
|
+
onChange,
|
|
50
|
+
onComplete,
|
|
51
|
+
...rest
|
|
52
|
+
} = propsWithDefaults;
|
|
53
|
+
|
|
54
|
+
// Regex for filtering input chars based on type prop
|
|
55
|
+
const allowedKeys = getAllowedKeys(type);
|
|
56
|
+
|
|
57
|
+
// Determine inputMode based on type prop
|
|
58
|
+
const inputModeValue = type === 'number' ? 'numeric' : 'text';
|
|
59
|
+
|
|
60
|
+
// Determine input type attribute based on type prop and mask
|
|
61
|
+
const inputTypeValue = mask ? 'password' : type === 'number' ? 'tel' : 'text';
|
|
62
|
+
const {
|
|
63
|
+
withPrefix,
|
|
64
|
+
prefix,
|
|
65
|
+
merge
|
|
66
|
+
} = useStyles(classPrefix);
|
|
67
|
+
|
|
68
|
+
// Use our custom hook for handling input refs and focus behavior
|
|
69
|
+
const {
|
|
70
|
+
focusInput,
|
|
71
|
+
focusNextInput,
|
|
72
|
+
focusPrevInput,
|
|
73
|
+
getRefSetter
|
|
74
|
+
} = usePinInputRefs(length, autoFocus);
|
|
75
|
+
|
|
76
|
+
// Use our custom hook for managing PIN values
|
|
77
|
+
const {
|
|
78
|
+
valueArray,
|
|
79
|
+
setDigit,
|
|
80
|
+
clearDigit,
|
|
81
|
+
updateValue
|
|
82
|
+
} = usePinValue(controlValue, defaultValue, length, onChange, onComplete);
|
|
83
|
+
|
|
84
|
+
// Handle input change
|
|
85
|
+
const handleInputChange = useEventCallback((inputValue, e, index) => {
|
|
86
|
+
// Safety check for event object
|
|
87
|
+
if (!e || !e.target) return;
|
|
88
|
+
|
|
89
|
+
// For single character input, use it directly
|
|
90
|
+
// For longer input (like paste or browser autofill), take the last character
|
|
91
|
+
const char = inputValue.length > 0 ? inputValue.charAt(inputValue.length - 1) : '';
|
|
92
|
+
|
|
93
|
+
// Filter by allowedKeys if provided
|
|
94
|
+
if (!allowedKeys.test(char)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Always allow overwriting the current value
|
|
99
|
+
// Update the value using our hook
|
|
100
|
+
setDigit(index, char);
|
|
101
|
+
|
|
102
|
+
// Focus the next input if we have a character and there's a next input
|
|
103
|
+
if (char && index < length - 1) {
|
|
104
|
+
// Use setTimeout to ensure the focus happens after the current event cycle
|
|
105
|
+
focusNextInput(index);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// If this is the last input and a character was entered, keep focus on it
|
|
109
|
+
if (char && index === length - 1) {
|
|
110
|
+
focusInput(index);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Handle key down
|
|
115
|
+
const handleKeyDown = useEventCallback((e, index) => {
|
|
116
|
+
// Safety check for event object
|
|
117
|
+
if (!e) return;
|
|
118
|
+
const target = e.target;
|
|
119
|
+
const inputValue = (target === null || target === void 0 ? void 0 : target.value) || '';
|
|
120
|
+
|
|
121
|
+
// Handle backspace
|
|
122
|
+
if (e.key === 'Backspace') {
|
|
123
|
+
if (inputValue === '') {
|
|
124
|
+
// Focus the previous input if the current one is empty
|
|
125
|
+
if (index > 0) {
|
|
126
|
+
clearDigit(index - 1);
|
|
127
|
+
focusPrevInput(index);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
// Clear the current input but keep focus on it
|
|
131
|
+
clearDigit(index);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Handle arrow keys
|
|
135
|
+
else if (e.key === 'ArrowLeft') {
|
|
136
|
+
focusPrevInput(index);
|
|
137
|
+
} else if (e.key === 'ArrowRight') {
|
|
138
|
+
focusNextInput(index);
|
|
139
|
+
}
|
|
140
|
+
// Allow only keys matching allowedKeys
|
|
141
|
+
else if (allowedKeys.test(e.key)) {
|
|
142
|
+
setDigit(index, e.key);
|
|
143
|
+
|
|
144
|
+
// Move focus to the next input if there is one
|
|
145
|
+
if (index < length - 1) {
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
focusNextInput(index);
|
|
148
|
+
}, 10);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Handle paste
|
|
154
|
+
const handlePaste = useEventCallback((e, index) => {
|
|
155
|
+
if (disabled || readOnly) return;
|
|
156
|
+
|
|
157
|
+
// Safety check for event object
|
|
158
|
+
if (!e || !e.clipboardData) return;
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
const pastedData = e.clipboardData.getData('text') || '';
|
|
161
|
+
|
|
162
|
+
// Filter pasted data by allowedKeys
|
|
163
|
+
const filteredData = pastedData.split('').filter(ch => allowedKeys.test(ch)).join('');
|
|
164
|
+
if (filteredData) {
|
|
165
|
+
// Create a new value with pasted characters
|
|
166
|
+
const newValueArray = [...valueArray];
|
|
167
|
+
for (let i = 0; i < filteredData.length && index + i < length; i++) {
|
|
168
|
+
newValueArray[index + i] = filteredData[i];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Update value with our hook
|
|
172
|
+
updateValue(newValueArray.join(''));
|
|
173
|
+
|
|
174
|
+
// Focus the input after the last pasted character or the last input
|
|
175
|
+
// Use setTimeout to ensure focus happens after DOM updates
|
|
176
|
+
const nextIndex = Math.min(index + filteredData.length, length - 1);
|
|
177
|
+
setTimeout(() => {
|
|
178
|
+
focusInput(nextIndex);
|
|
179
|
+
}, 10);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const classes = merge(className, withPrefix({
|
|
183
|
+
attached
|
|
184
|
+
}));
|
|
185
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
186
|
+
as: as,
|
|
187
|
+
ref: ref,
|
|
188
|
+
className: classes
|
|
189
|
+
}, rest), /*#__PURE__*/React.createElement("input", {
|
|
190
|
+
type: "hidden",
|
|
191
|
+
value: valueArray.join(''),
|
|
192
|
+
name: name,
|
|
193
|
+
"aria-label": "Pin input"
|
|
194
|
+
}), /*#__PURE__*/React.createElement(HStack, {
|
|
195
|
+
spacing: attached ? 0 : 8
|
|
196
|
+
}, Array.from({
|
|
197
|
+
length
|
|
198
|
+
}).map((_, index) => /*#__PURE__*/React.createElement(Input, {
|
|
199
|
+
key: index,
|
|
200
|
+
className: prefix('segment', {
|
|
201
|
+
masked: mask
|
|
202
|
+
}),
|
|
203
|
+
size: size,
|
|
204
|
+
value: valueArray[index] || '',
|
|
205
|
+
onChange: (v, e) => handleInputChange(v, e, index),
|
|
206
|
+
onKeyDown: e => handleKeyDown(e, index),
|
|
207
|
+
onPaste: e => handlePaste(e, index),
|
|
208
|
+
disabled: disabled,
|
|
209
|
+
readOnly: readOnly,
|
|
210
|
+
maxLength: 1,
|
|
211
|
+
autoComplete: otp ? 'one-time-code' : 'off',
|
|
212
|
+
inputMode: inputModeValue,
|
|
213
|
+
placeholder: placeholder,
|
|
214
|
+
type: inputTypeValue,
|
|
215
|
+
ref: getRefSetter(index)
|
|
216
|
+
}))));
|
|
217
|
+
});
|
|
218
|
+
PinInput.displayName = 'PinInput';
|
|
219
|
+
export default PinInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* A hook that manages the refs and focus behavior for a PIN input component
|
|
4
|
+
*/
|
|
5
|
+
export declare const usePinInputRefs: (length: number, autoFocus?: boolean) => {
|
|
6
|
+
inputRefs: import("react").RefObject<(HTMLInputElement | null)[]>;
|
|
7
|
+
focusInput: (index: number) => boolean;
|
|
8
|
+
focusNextInput: (currentIndex: number) => boolean;
|
|
9
|
+
focusPrevInput: (currentIndex: number) => boolean;
|
|
10
|
+
getRefSetter: (index: number) => (el: HTMLInputElement | null) => void;
|
|
11
|
+
};
|
|
12
|
+
export default usePinInputRefs;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A hook that manages the refs and focus behavior for a PIN input component
|
|
6
|
+
*/
|
|
7
|
+
export const usePinInputRefs = (length, autoFocus) => {
|
|
8
|
+
// Create ref to store input elements
|
|
9
|
+
const inputRefs = useRef([]);
|
|
10
|
+
|
|
11
|
+
// Initialize the refs array when length changes
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
inputRefs.current = inputRefs.current.slice(0, length);
|
|
14
|
+
}, [length]);
|
|
15
|
+
|
|
16
|
+
// Auto focus the first input on mount if autoFocus is true
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (autoFocus && inputRefs.current[0]) {
|
|
19
|
+
var _inputRefs$current$;
|
|
20
|
+
(_inputRefs$current$ = inputRefs.current[0]) === null || _inputRefs$current$ === void 0 || _inputRefs$current$.focus();
|
|
21
|
+
}
|
|
22
|
+
}, [autoFocus]);
|
|
23
|
+
|
|
24
|
+
// Focus a specific input by index
|
|
25
|
+
const focusInput = useCallback(index => {
|
|
26
|
+
if (index >= 0 && index < length && inputRefs.current[index]) {
|
|
27
|
+
var _inputRefs$current$in;
|
|
28
|
+
(_inputRefs$current$in = inputRefs.current[index]) === null || _inputRefs$current$in === void 0 || _inputRefs$current$in.focus();
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}, [length]);
|
|
33
|
+
|
|
34
|
+
// Focus the next input
|
|
35
|
+
const focusNextInput = useCallback(currentIndex => {
|
|
36
|
+
return focusInput(currentIndex + 1);
|
|
37
|
+
}, [focusInput]);
|
|
38
|
+
|
|
39
|
+
// Focus the previous input
|
|
40
|
+
const focusPrevInput = useCallback(currentIndex => {
|
|
41
|
+
return focusInput(currentIndex - 1);
|
|
42
|
+
}, [focusInput]);
|
|
43
|
+
|
|
44
|
+
// Get ref setter for an input
|
|
45
|
+
const getRefSetter = useCallback(index => {
|
|
46
|
+
return el => {
|
|
47
|
+
inputRefs.current[index] = el;
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
return {
|
|
51
|
+
inputRefs,
|
|
52
|
+
focusInput,
|
|
53
|
+
focusNextInput,
|
|
54
|
+
focusPrevInput,
|
|
55
|
+
getRefSetter
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export default usePinInputRefs;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for managing pin input value
|
|
3
|
+
* - Handles controlled/uncontrolled value
|
|
4
|
+
* - Normalizes value to array format
|
|
5
|
+
* - Manages array updates and modifications
|
|
6
|
+
*/
|
|
7
|
+
export declare const usePinValue: (controlValue: string | undefined, defaultValue: string, length: number, onChange?: ((value: string) => void) | undefined, onComplete?: ((value: string) => void) | undefined) => {
|
|
8
|
+
value: string;
|
|
9
|
+
valueArray: string[];
|
|
10
|
+
setDigit: (index: number, digit: string) => void;
|
|
11
|
+
clearDigit: (index: number) => void;
|
|
12
|
+
updateValue: (newValue: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export default usePinValue;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useControlled } from "../../internals/hooks/index.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook for managing pin input value
|
|
7
|
+
* - Handles controlled/uncontrolled value
|
|
8
|
+
* - Normalizes value to array format
|
|
9
|
+
* - Manages array updates and modifications
|
|
10
|
+
*/
|
|
11
|
+
export const usePinValue = (controlValue, defaultValue, length, onChange, onComplete) => {
|
|
12
|
+
// Use controlled pattern for value management
|
|
13
|
+
const [value, setValue] = useControlled(controlValue, defaultValue);
|
|
14
|
+
|
|
15
|
+
// Convert string value to array of characters
|
|
16
|
+
const valueArray = useMemo(() => {
|
|
17
|
+
// Ensure value is a string and split it into an array of characters
|
|
18
|
+
const valueString = value || '';
|
|
19
|
+
const chars = valueString.split('');
|
|
20
|
+
|
|
21
|
+
// Pad the array with empty strings if needed
|
|
22
|
+
while (chars.length < length) {
|
|
23
|
+
chars.push('');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Trim the array if it's too long
|
|
27
|
+
if (chars.length > length) {
|
|
28
|
+
chars.length = length;
|
|
29
|
+
}
|
|
30
|
+
return chars;
|
|
31
|
+
}, [value, length]);
|
|
32
|
+
|
|
33
|
+
// Update specific digit at index
|
|
34
|
+
const setDigit = (index, digit) => {
|
|
35
|
+
if (index < 0 || index >= length) return;
|
|
36
|
+
const newValueArray = [...valueArray];
|
|
37
|
+
newValueArray[index] = digit;
|
|
38
|
+
updateValue(newValueArray.join(''));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Clear specific digit at index
|
|
42
|
+
const clearDigit = index => {
|
|
43
|
+
if (index < 0 || index >= length) return;
|
|
44
|
+
const newValueArray = [...valueArray];
|
|
45
|
+
newValueArray[index] = '';
|
|
46
|
+
updateValue(newValueArray.join(''));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Set entire value at once
|
|
50
|
+
const updateValue = newValue => {
|
|
51
|
+
// Filter out any extra characters beyond length
|
|
52
|
+
const filteredValue = newValue.slice(0, length);
|
|
53
|
+
setValue(filteredValue);
|
|
54
|
+
onChange === null || onChange === void 0 || onChange(filteredValue);
|
|
55
|
+
|
|
56
|
+
// Call onComplete if the value is complete
|
|
57
|
+
if (filteredValue.length === length) {
|
|
58
|
+
onComplete === null || onComplete === void 0 || onComplete(filteredValue);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
value,
|
|
63
|
+
valueArray,
|
|
64
|
+
setDigit,
|
|
65
|
+
clearDigit,
|
|
66
|
+
updateValue
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export default usePinValue;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
6
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
5
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
7
6
|
import { forwardRef, getCssValue, mergeStyles } from "../internals/utils/index.js";
|
|
8
7
|
/**
|
|
9
8
|
* The `Placeholder.Graph` component is used to display the loading state of the block.
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
6
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
5
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
7
6
|
import { forwardRef, getCssValue, mergeStyles } from "../internals/utils/index.js";
|
|
8
7
|
/**
|
|
9
8
|
* The `Placeholder.Grid` component is used to display the loading state of the block.
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
6
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
5
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
7
6
|
import { forwardRef, mergeStyles, getCssValue } from "../internals/utils/index.js";
|
|
8
7
|
/**
|
|
9
8
|
* The `Placeholder.Paragraph` component is used to display the loading state of the block.
|
package/esm/Popover/Popover.js
CHANGED
|
@@ -4,8 +4,7 @@ import React, { useMemo } from 'react';
|
|
|
4
4
|
import Heading from "../Heading/index.js";
|
|
5
5
|
import Box from "../internals/Box/index.js";
|
|
6
6
|
import { forwardRef, mergeStyles } from "../internals/utils/index.js";
|
|
7
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
7
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
9
8
|
/**
|
|
10
9
|
* The `Popover` component is used to display a popup window for a target component.
|
|
11
10
|
* @see https://rsuitejs.com/components/popover
|
|
@@ -4,8 +4,7 @@ import React, { useCallback } from 'react';
|
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import { PROGRESS_STATUS_ICON } from "../internals/constants/statusIcons.js";
|
|
6
6
|
import { forwardRef } from "../internals/utils/index.js";
|
|
7
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
7
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
9
8
|
/**
|
|
10
9
|
* The `Progress.Circle` component is used to display the progress of current operation.
|
|
11
10
|
* @see https://rsuitejs.com/components/progress/#circle
|
|
@@ -4,8 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import { PROGRESS_STATUS_ICON } from "../internals/constants/statusIcons.js";
|
|
6
6
|
import { forwardRef } from "../internals/utils/index.js";
|
|
7
|
-
import { useStyles } from "../internals/hooks/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
7
|
+
import { useStyles, useCustom } from "../internals/hooks/index.js";
|
|
9
8
|
/**
|
|
10
9
|
* The `Progress.Line` component is used to display the progress of current operation.
|
|
11
10
|
* @see https://rsuitejs.com/components/progress/#line
|
package/esm/Radio/Radio.js
CHANGED
|
@@ -3,9 +3,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import { RadioContext } from "../RadioGroup/RadioGroup.js";
|
|
6
|
-
import { useStyles, useControlled, useEventCallback, useUniqueId } from "../internals/hooks/index.js";
|
|
6
|
+
import { useStyles, useCustom, useControlled, useEventCallback, useUniqueId } from "../internals/hooks/index.js";
|
|
7
7
|
import { forwardRef, partitionHTMLProps } from "../internals/utils/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
9
8
|
/**
|
|
10
9
|
* The `Radio` component is a simple radio button.
|
|
11
10
|
* @see https://rsuitejs.com/components/radio
|
|
@@ -4,8 +4,7 @@ import React, { useMemo } from 'react';
|
|
|
4
4
|
import Box from "../internals/Box/index.js";
|
|
5
5
|
import Plaintext from "../internals/Plaintext/index.js";
|
|
6
6
|
import { forwardRef } from "../internals/utils/index.js";
|
|
7
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
7
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
9
8
|
export const RadioContext = /*#__PURE__*/React.createContext(void 0);
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -5,8 +5,7 @@ import CheckIcon from '@rsuite/icons/Check';
|
|
|
5
5
|
import Box from "../internals/Box/index.js";
|
|
6
6
|
import { RadioTileContext } from "../RadioTileGroup/RadioTileGroup.js";
|
|
7
7
|
import { forwardRef, partitionHTMLProps } from "../internals/utils/index.js";
|
|
8
|
-
import { useStyles, useControlled, useUniqueId } from "../internals/hooks/index.js";
|
|
9
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
8
|
+
import { useStyles, useCustom, useControlled, useUniqueId } from "../internals/hooks/index.js";
|
|
10
9
|
/**
|
|
11
10
|
* A series of selectable tile components that behave like Radio.
|
|
12
11
|
* @version 5.35.0
|
|
@@ -3,9 +3,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import React, { useCallback, useMemo } from 'react';
|
|
4
4
|
import Stack from "../Stack/index.js";
|
|
5
5
|
import Box from "../internals/Box/index.js";
|
|
6
|
-
import { useStyles, useControlled } from "../internals/hooks/index.js";
|
|
6
|
+
import { useStyles, useCustom, useControlled } from "../internals/hooks/index.js";
|
|
7
7
|
import { forwardRef } from "../internals/utils/index.js";
|
|
8
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
9
8
|
export const RadioTileContext = /*#__PURE__*/React.createContext({});
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -10,9 +10,8 @@ import Graduated from "../Slider/Graduated.js";
|
|
|
10
10
|
import Plaintext from "../internals/Plaintext/index.js";
|
|
11
11
|
import Box from "../internals/Box/index.js";
|
|
12
12
|
import { forwardRef } from "../internals/utils/index.js";
|
|
13
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
13
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
14
14
|
import { precisionMath, checkValue, getPosition } from "../Slider/utils.js";
|
|
15
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
16
15
|
const defaultDefaultValue = [0, 0];
|
|
17
16
|
|
|
18
17
|
/**
|
package/esm/Rate/Rate.js
CHANGED
|
@@ -7,11 +7,10 @@ import Character from "./Character.js";
|
|
|
7
7
|
import Plaintext from "../internals/Plaintext/index.js";
|
|
8
8
|
import StyledBox from "../internals/StyledBox/index.js";
|
|
9
9
|
import { KEY_VALUES } from "../internals/constants/index.js";
|
|
10
|
-
import { useControlled, useStyles, useEventCallback } from "../internals/hooks/index.js";
|
|
10
|
+
import { useControlled, useStyles, useCustom, useEventCallback } from "../internals/hooks/index.js";
|
|
11
11
|
import { forwardRef, shallowEqualArray, mergeStyles } from "../internals/utils/index.js";
|
|
12
12
|
import { transformStarStatusToValue, getFractionalValue } from "./utils.js";
|
|
13
13
|
import { useRatingStates } from "./useRatingStates.js";
|
|
14
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
15
14
|
/**
|
|
16
15
|
* The `Rate` component is used for rating. It can be used to evaluate the quality of the content.
|
|
17
16
|
* @see https://rsuitejs.com/components/rate/
|
|
@@ -5,10 +5,9 @@ import pick from 'lodash/pick';
|
|
|
5
5
|
import isNil from 'lodash/isNil';
|
|
6
6
|
import isFunction from 'lodash/isFunction';
|
|
7
7
|
import SearchBox from "../internals/SearchBox/index.js";
|
|
8
|
-
import { useStyles, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
8
|
+
import { useStyles, useCustom, useControlled, useEventCallback } from "../internals/hooks/index.js";
|
|
9
9
|
import { forwardRef, createChainedFunction, mergeRefs, shallowEqual, getDataGroupBy } from "../internals/utils/index.js";
|
|
10
10
|
import { Listbox, ListItem, PickerToggle, PickerToggleTrigger, PickerPopup, useFocusItemValue, useSearch, useToggleKeyDownEvent, usePickerRef, triggerPropKeys } from "../internals/Picker/index.js";
|
|
11
|
-
import { useCustom } from "../CustomProvider/index.js";
|
|
12
11
|
const emptyArray = [];
|
|
13
12
|
/**
|
|
14
13
|
* The `SelectPicker` component is used to select an item from a list of data.
|