rsuite 6.0.0-canary-20250416 → 6.0.0-canary-20250424
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/FormControl/FormControl.js +1 -2
- 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/cjs/{InputNumber/InputNumber.d.ts → 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 +2 -0
- package/cjs/index.js +12 -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/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 +333 -223
- 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/FormControl/FormControl.js +1 -2
- 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/esm/{InputNumber/InputNumber.d.ts → 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 +2 -0
- package/esm/index.js +2 -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/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/cjs/CustomProvider/types.d.ts +0 -234
- package/cjs/InputNumber/InputNumber.js +0 -300
- package/esm/CustomProvider/types.d.ts +0 -234
- 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/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
|
@@ -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,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.useNumberInputValue = useNumberInputValue;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
9
|
+
function useNumberInputValue(params) {
|
|
10
|
+
const {
|
|
11
|
+
value,
|
|
12
|
+
isFocused,
|
|
13
|
+
formatter,
|
|
14
|
+
decimalSeparator
|
|
15
|
+
} = params;
|
|
16
|
+
const replaceDecimalSeparator = (0, _react.useCallback)(val => {
|
|
17
|
+
if (decimalSeparator && val != null) {
|
|
18
|
+
return val.toString().replace('.', decimalSeparator);
|
|
19
|
+
}
|
|
20
|
+
return val;
|
|
21
|
+
}, [decimalSeparator]);
|
|
22
|
+
return (0, _react.useMemo)(() => {
|
|
23
|
+
if ((0, _isNil.default)(value)) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
if (isFocused) {
|
|
27
|
+
return replaceDecimalSeparator(value);
|
|
28
|
+
}
|
|
29
|
+
if (formatter) {
|
|
30
|
+
return formatter(value);
|
|
31
|
+
}
|
|
32
|
+
return replaceDecimalSeparator(value);
|
|
33
|
+
}, [formatter, isFocused, replaceDecimalSeparator, value]);
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.useWheelHandler = useWheelHandler;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _on = _interopRequireDefault(require("dom-lib/on"));
|
|
9
|
+
/**
|
|
10
|
+
* Attach wheel listener to inputRef.
|
|
11
|
+
*/
|
|
12
|
+
function useWheelHandler(inputRef, handleWheel, scrollable) {
|
|
13
|
+
(0, _react.useEffect)(() => {
|
|
14
|
+
let wheelListener;
|
|
15
|
+
if (inputRef.current) {
|
|
16
|
+
wheelListener = (0, _on.default)(inputRef.current, 'wheel', handleWheel, {
|
|
17
|
+
passive: false
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return () => {
|
|
21
|
+
var _wheelListener;
|
|
22
|
+
(_wheelListener = wheelListener) === null || _wheelListener === void 0 || _wheelListener.off();
|
|
23
|
+
};
|
|
24
|
+
}, [inputRef, handleWheel, scrollable]);
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _NumberInput = _interopRequireDefault(require("./NumberInput"));
|
|
8
|
+
exports.NumberInput = _NumberInput.default;
|
|
9
|
+
// export types
|
|
10
|
+
// export components
|
|
11
|
+
var _default = exports.default = _NumberInput.default;
|
|
@@ -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,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.clampValue = clampValue;
|
|
7
|
+
exports.decimals = decimals;
|
|
8
|
+
exports.valueReachesMax = valueReachesMax;
|
|
9
|
+
exports.valueReachesMin = valueReachesMin;
|
|
10
|
+
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
11
|
+
/**
|
|
12
|
+
* Clamp a value within min/max and handle NaN as empty string.
|
|
13
|
+
*/
|
|
14
|
+
function clampValue(value, min, max) {
|
|
15
|
+
const num = typeof value === 'string' ? parseFloat(value) : value;
|
|
16
|
+
if (Number.isNaN(num)) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
let result = num;
|
|
20
|
+
if (typeof max !== 'undefined' && result > max) {
|
|
21
|
+
result = max;
|
|
22
|
+
}
|
|
23
|
+
if (typeof min !== 'undefined' && result < min) {
|
|
24
|
+
result = min;
|
|
25
|
+
}
|
|
26
|
+
return result.toString();
|
|
27
|
+
}
|
|
28
|
+
function isNumber(value) {
|
|
29
|
+
return /(^-?|^\+?|^\d?)\d*\.\d+$/.test(value + '');
|
|
30
|
+
}
|
|
31
|
+
function getDecimalLength(value) {
|
|
32
|
+
if (isNumber(value)) {
|
|
33
|
+
return value.toString().split('.')[1].length;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
function decimals() {
|
|
38
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
+
values[_key] = arguments[_key];
|
|
40
|
+
}
|
|
41
|
+
const lengths = values.map(getDecimalLength);
|
|
42
|
+
return Math.max(...lengths);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Disable the upper limit of the number.
|
|
47
|
+
* @param value
|
|
48
|
+
* @param max
|
|
49
|
+
*/
|
|
50
|
+
function valueReachesMax(value, max) {
|
|
51
|
+
if (!(0, _isNil.default)(value)) {
|
|
52
|
+
return +value >= max;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Disable the lower limit of the number.
|
|
59
|
+
* @param value
|
|
60
|
+
* @param min
|
|
61
|
+
*/
|
|
62
|
+
function valueReachesMin(value, min) {
|
|
63
|
+
if (!(0, _isNil.default)(value)) {
|
|
64
|
+
return +value <= min;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
@@ -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
|
}
|
|
@@ -15,7 +15,6 @@ var _PaginationButton = _interopRequireDefault(require("./PaginationButton"));
|
|
|
15
15
|
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
16
16
|
var _utils = require("../internals/utils");
|
|
17
17
|
var _hooks = require("../internals/hooks");
|
|
18
|
-
var _CustomProvider = require("../CustomProvider");
|
|
19
18
|
const icons = {
|
|
20
19
|
more: /*#__PURE__*/_react.default.createElement(_More.default, null),
|
|
21
20
|
first: /*#__PURE__*/_react.default.createElement(_PageTop.default, null),
|
|
@@ -31,7 +30,7 @@ const icons = {
|
|
|
31
30
|
const Pagination = (0, _utils.forwardRef)((props, ref) => {
|
|
32
31
|
const {
|
|
33
32
|
propsWithDefaults
|
|
34
|
-
} = (0,
|
|
33
|
+
} = (0, _hooks.useCustom)('Pagination', props);
|
|
35
34
|
const {
|
|
36
35
|
as,
|
|
37
36
|
className,
|
|
@@ -14,7 +14,6 @@ var _LimitPicker = _interopRequireDefault(require("./LimitPicker"));
|
|
|
14
14
|
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
15
15
|
var _hooks = require("../internals/hooks");
|
|
16
16
|
var _utils = require("../internals/utils");
|
|
17
|
-
var _CustomProvider = require("../CustomProvider");
|
|
18
17
|
/**
|
|
19
18
|
* The layout of the paging component.
|
|
20
19
|
*/
|
|
@@ -61,7 +60,7 @@ const PaginationGroup = (0, _utils.forwardRef)((props, ref) => {
|
|
|
61
60
|
const classes = merge(className, withPrefix(size));
|
|
62
61
|
const {
|
|
63
62
|
getLocale
|
|
64
|
-
} = (0,
|
|
63
|
+
} = (0, _hooks.useCustom)();
|
|
65
64
|
const locale = getLocale('Pagination', localeProp);
|
|
66
65
|
const handleInputBlur = (0, _hooks.useEventCallback)(event => {
|
|
67
66
|
const value = parseInt(event.target.value);
|
package/cjs/Panel/Panel.js
CHANGED
|
@@ -12,7 +12,6 @@ var _useExpanded = _interopRequireDefault(require("./hooks/useExpanded"));
|
|
|
12
12
|
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
13
13
|
var _utils = require("../internals/utils");
|
|
14
14
|
var _hooks = require("../internals/hooks");
|
|
15
|
-
var _CustomProvider = require("../CustomProvider");
|
|
16
15
|
var _PanelGroup = require("../PanelGroup");
|
|
17
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -23,7 +22,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
23
22
|
const Panel = (0, _utils.forwardRef)((props, ref) => {
|
|
24
23
|
const {
|
|
25
24
|
propsWithDefaults
|
|
26
|
-
} = (0,
|
|
25
|
+
} = (0, _hooks.useCustom)('Panel', props);
|
|
27
26
|
const {
|
|
28
27
|
as,
|
|
29
28
|
bodyFill,
|
|
@@ -9,7 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
10
10
|
var _utils = require("../internals/utils");
|
|
11
11
|
var _hooks = require("../internals/hooks");
|
|
12
|
-
var _CustomProvider = require("../CustomProvider");
|
|
13
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
14
|
const PanelGroupContext = exports.PanelGroupContext = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -21,7 +20,7 @@ const PanelGroupContext = exports.PanelGroupContext = /*#__PURE__*/_react.defaul
|
|
|
21
20
|
const PanelGroup = (0, _utils.forwardRef)((props, ref) => {
|
|
22
21
|
const {
|
|
23
22
|
propsWithDefaults
|
|
24
|
-
} = (0,
|
|
23
|
+
} = (0, _hooks.useCustom)('PanelGroup', props);
|
|
25
24
|
const {
|
|
26
25
|
as,
|
|
27
26
|
accordion,
|
|
@@ -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 */
|
|
@@ -12,11 +12,10 @@ var _EyeClose = _interopRequireDefault(require("@rsuite/icons/EyeClose"));
|
|
|
12
12
|
var _Visible = _interopRequireDefault(require("@rsuite/icons/Visible"));
|
|
13
13
|
var _utils = require("../internals/utils");
|
|
14
14
|
var _hooks = require("../internals/hooks");
|
|
15
|
-
var _CustomProvider = require("../CustomProvider");
|
|
16
15
|
const PasswordInput = (0, _utils.forwardRef)((props, ref) => {
|
|
17
16
|
const {
|
|
18
17
|
propsWithDefaults
|
|
19
|
-
} = (0,
|
|
18
|
+
} = (0, _hooks.useCustom)('PasswordInput', props);
|
|
20
19
|
const {
|
|
21
20
|
classPrefix = 'password-input',
|
|
22
21
|
className,
|
|
@@ -30,6 +29,8 @@ const PasswordInput = (0, _utils.forwardRef)((props, ref) => {
|
|
|
30
29
|
name,
|
|
31
30
|
readOnly,
|
|
32
31
|
inputRef,
|
|
32
|
+
startIcon,
|
|
33
|
+
endIcon,
|
|
33
34
|
onChange,
|
|
34
35
|
onVisibleChange,
|
|
35
36
|
renderVisibilityIcon,
|
|
@@ -50,7 +51,7 @@ const PasswordInput = (0, _utils.forwardRef)((props, ref) => {
|
|
|
50
51
|
ref: ref,
|
|
51
52
|
size: size,
|
|
52
53
|
className: classes
|
|
53
|
-
}, rest), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
54
|
+
}, rest), startIcon && /*#__PURE__*/_react.default.createElement(_InputGroup.default.Addon, null, startIcon), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
54
55
|
type: visible ? 'text' : 'password',
|
|
55
56
|
value: value,
|
|
56
57
|
defaultValue: defaultValue,
|
|
@@ -61,7 +62,7 @@ const PasswordInput = (0, _utils.forwardRef)((props, ref) => {
|
|
|
61
62
|
name: name,
|
|
62
63
|
id: id,
|
|
63
64
|
inputRef: inputRef
|
|
64
|
-
}), /*#__PURE__*/_react.default.createElement(_InputGroup.default.Button, {
|
|
65
|
+
}), endIcon ? /*#__PURE__*/_react.default.createElement(_InputGroup.default.Addon, null, endIcon) : /*#__PURE__*/_react.default.createElement(_InputGroup.default.Button, {
|
|
65
66
|
tabIndex: -1,
|
|
66
67
|
onClick: handleToggleVisibility,
|
|
67
68
|
"aria-label": "Toggle password visibility"
|
|
@@ -10,11 +10,10 @@ var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
|
10
10
|
var _Text = _interopRequireDefault(require("../Text"));
|
|
11
11
|
var _utils = require("../internals/utils");
|
|
12
12
|
var _hooks = require("../internals/hooks");
|
|
13
|
-
var _CustomProvider = require("../CustomProvider");
|
|
14
13
|
const PasswordStrengthMeter = (0, _utils.forwardRef)((props, ref) => {
|
|
15
14
|
const {
|
|
16
15
|
propsWithDefaults
|
|
17
|
-
} = (0,
|
|
16
|
+
} = (0, _hooks.useCustom)('PasswordStrengthMeter', props);
|
|
18
17
|
const {
|
|
19
18
|
classPrefix = 'password-strength-meter',
|
|
20
19
|
className,
|
|
@@ -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,224 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
|
10
|
+
var _usePinInputRefs = _interopRequireDefault(require("./hooks/usePinInputRefs"));
|
|
11
|
+
var _usePinValue = _interopRequireDefault(require("./hooks/usePinValue"));
|
|
12
|
+
var _Box = require("../internals/Box");
|
|
13
|
+
var _Stack = require("../Stack");
|
|
14
|
+
var _utils = require("../internals/utils");
|
|
15
|
+
var _hooks = require("../internals/hooks");
|
|
16
|
+
/**
|
|
17
|
+
* Map `type` prop to regex for allowed keys
|
|
18
|
+
*/
|
|
19
|
+
function getAllowedKeys(type) {
|
|
20
|
+
if (type instanceof RegExp) {
|
|
21
|
+
return type;
|
|
22
|
+
}
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 'alphabetic':
|
|
25
|
+
return /[A-Za-z]/;
|
|
26
|
+
case 'alphanumeric':
|
|
27
|
+
return /[A-Za-z0-9]/;
|
|
28
|
+
default:
|
|
29
|
+
// number and any other fallback
|
|
30
|
+
return /\d/;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const PinInput = (0, _utils.forwardRef)((props, ref) => {
|
|
34
|
+
const {
|
|
35
|
+
propsWithDefaults
|
|
36
|
+
} = (0, _hooks.useCustom)('PinInput', props);
|
|
37
|
+
const {
|
|
38
|
+
type = 'number',
|
|
39
|
+
as,
|
|
40
|
+
autoFocus,
|
|
41
|
+
attached,
|
|
42
|
+
className,
|
|
43
|
+
classPrefix = 'pin-input',
|
|
44
|
+
defaultValue = '',
|
|
45
|
+
disabled,
|
|
46
|
+
length = 4,
|
|
47
|
+
mask,
|
|
48
|
+
name,
|
|
49
|
+
otp,
|
|
50
|
+
placeholder,
|
|
51
|
+
readOnly,
|
|
52
|
+
size = 'md',
|
|
53
|
+
value: controlValue,
|
|
54
|
+
onChange,
|
|
55
|
+
onComplete,
|
|
56
|
+
...rest
|
|
57
|
+
} = propsWithDefaults;
|
|
58
|
+
|
|
59
|
+
// Regex for filtering input chars based on type prop
|
|
60
|
+
const allowedKeys = getAllowedKeys(type);
|
|
61
|
+
|
|
62
|
+
// Determine inputMode based on type prop
|
|
63
|
+
const inputModeValue = type === 'number' ? 'numeric' : 'text';
|
|
64
|
+
|
|
65
|
+
// Determine input type attribute based on type prop and mask
|
|
66
|
+
const inputTypeValue = mask ? 'password' : type === 'number' ? 'tel' : 'text';
|
|
67
|
+
const {
|
|
68
|
+
withPrefix,
|
|
69
|
+
prefix,
|
|
70
|
+
merge
|
|
71
|
+
} = (0, _hooks.useStyles)(classPrefix);
|
|
72
|
+
|
|
73
|
+
// Use our custom hook for handling input refs and focus behavior
|
|
74
|
+
const {
|
|
75
|
+
focusInput,
|
|
76
|
+
focusNextInput,
|
|
77
|
+
focusPrevInput,
|
|
78
|
+
getRefSetter
|
|
79
|
+
} = (0, _usePinInputRefs.default)(length, autoFocus);
|
|
80
|
+
|
|
81
|
+
// Use our custom hook for managing PIN values
|
|
82
|
+
const {
|
|
83
|
+
valueArray,
|
|
84
|
+
setDigit,
|
|
85
|
+
clearDigit,
|
|
86
|
+
updateValue
|
|
87
|
+
} = (0, _usePinValue.default)(controlValue, defaultValue, length, onChange, onComplete);
|
|
88
|
+
|
|
89
|
+
// Handle input change
|
|
90
|
+
const handleInputChange = (0, _hooks.useEventCallback)((inputValue, e, index) => {
|
|
91
|
+
// Safety check for event object
|
|
92
|
+
if (!e || !e.target) return;
|
|
93
|
+
|
|
94
|
+
// For single character input, use it directly
|
|
95
|
+
// For longer input (like paste or browser autofill), take the last character
|
|
96
|
+
const char = inputValue.length > 0 ? inputValue.charAt(inputValue.length - 1) : '';
|
|
97
|
+
|
|
98
|
+
// Filter by allowedKeys if provided
|
|
99
|
+
if (!allowedKeys.test(char)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Always allow overwriting the current value
|
|
104
|
+
// Update the value using our hook
|
|
105
|
+
setDigit(index, char);
|
|
106
|
+
|
|
107
|
+
// Focus the next input if we have a character and there's a next input
|
|
108
|
+
if (char && index < length - 1) {
|
|
109
|
+
// Use setTimeout to ensure the focus happens after the current event cycle
|
|
110
|
+
focusNextInput(index);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// If this is the last input and a character was entered, keep focus on it
|
|
114
|
+
if (char && index === length - 1) {
|
|
115
|
+
focusInput(index);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Handle key down
|
|
120
|
+
const handleKeyDown = (0, _hooks.useEventCallback)((e, index) => {
|
|
121
|
+
// Safety check for event object
|
|
122
|
+
if (!e) return;
|
|
123
|
+
const target = e.target;
|
|
124
|
+
const inputValue = (target === null || target === void 0 ? void 0 : target.value) || '';
|
|
125
|
+
|
|
126
|
+
// Handle backspace
|
|
127
|
+
if (e.key === 'Backspace') {
|
|
128
|
+
if (inputValue === '') {
|
|
129
|
+
// Focus the previous input if the current one is empty
|
|
130
|
+
if (index > 0) {
|
|
131
|
+
clearDigit(index - 1);
|
|
132
|
+
focusPrevInput(index);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
// Clear the current input but keep focus on it
|
|
136
|
+
clearDigit(index);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Handle arrow keys
|
|
140
|
+
else if (e.key === 'ArrowLeft') {
|
|
141
|
+
focusPrevInput(index);
|
|
142
|
+
} else if (e.key === 'ArrowRight') {
|
|
143
|
+
focusNextInput(index);
|
|
144
|
+
}
|
|
145
|
+
// Allow only keys matching allowedKeys
|
|
146
|
+
else if (allowedKeys.test(e.key)) {
|
|
147
|
+
setDigit(index, e.key);
|
|
148
|
+
|
|
149
|
+
// Move focus to the next input if there is one
|
|
150
|
+
if (index < length - 1) {
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
focusNextInput(index);
|
|
153
|
+
}, 10);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Handle paste
|
|
159
|
+
const handlePaste = (0, _hooks.useEventCallback)((e, index) => {
|
|
160
|
+
if (disabled || readOnly) return;
|
|
161
|
+
|
|
162
|
+
// Safety check for event object
|
|
163
|
+
if (!e || !e.clipboardData) return;
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
const pastedData = e.clipboardData.getData('text') || '';
|
|
166
|
+
|
|
167
|
+
// Filter pasted data by allowedKeys
|
|
168
|
+
const filteredData = pastedData.split('').filter(ch => allowedKeys.test(ch)).join('');
|
|
169
|
+
if (filteredData) {
|
|
170
|
+
// Create a new value with pasted characters
|
|
171
|
+
const newValueArray = [...valueArray];
|
|
172
|
+
for (let i = 0; i < filteredData.length && index + i < length; i++) {
|
|
173
|
+
newValueArray[index + i] = filteredData[i];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Update value with our hook
|
|
177
|
+
updateValue(newValueArray.join(''));
|
|
178
|
+
|
|
179
|
+
// Focus the input after the last pasted character or the last input
|
|
180
|
+
// Use setTimeout to ensure focus happens after DOM updates
|
|
181
|
+
const nextIndex = Math.min(index + filteredData.length, length - 1);
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
focusInput(nextIndex);
|
|
184
|
+
}, 10);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
const classes = merge(className, withPrefix({
|
|
188
|
+
attached
|
|
189
|
+
}));
|
|
190
|
+
return /*#__PURE__*/_react.default.createElement(_Box.Box, (0, _extends2.default)({
|
|
191
|
+
as: as,
|
|
192
|
+
ref: ref,
|
|
193
|
+
className: classes
|
|
194
|
+
}, rest), /*#__PURE__*/_react.default.createElement("input", {
|
|
195
|
+
type: "hidden",
|
|
196
|
+
value: valueArray.join(''),
|
|
197
|
+
name: name,
|
|
198
|
+
"aria-label": "Pin input"
|
|
199
|
+
}), /*#__PURE__*/_react.default.createElement(_Stack.HStack, {
|
|
200
|
+
spacing: attached ? 0 : 8
|
|
201
|
+
}, Array.from({
|
|
202
|
+
length
|
|
203
|
+
}).map((_, index) => /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
204
|
+
key: index,
|
|
205
|
+
className: prefix('segment', {
|
|
206
|
+
masked: mask
|
|
207
|
+
}),
|
|
208
|
+
size: size,
|
|
209
|
+
value: valueArray[index] || '',
|
|
210
|
+
onChange: (v, e) => handleInputChange(v, e, index),
|
|
211
|
+
onKeyDown: e => handleKeyDown(e, index),
|
|
212
|
+
onPaste: e => handlePaste(e, index),
|
|
213
|
+
disabled: disabled,
|
|
214
|
+
readOnly: readOnly,
|
|
215
|
+
maxLength: 1,
|
|
216
|
+
autoComplete: otp ? 'one-time-code' : 'off',
|
|
217
|
+
inputMode: inputModeValue,
|
|
218
|
+
placeholder: placeholder,
|
|
219
|
+
type: inputTypeValue,
|
|
220
|
+
ref: getRefSetter(index)
|
|
221
|
+
}))));
|
|
222
|
+
});
|
|
223
|
+
PinInput.displayName = 'PinInput';
|
|
224
|
+
var _default = exports.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;
|