rsuite 6.0.0-canary-2025032014 → 6.0.0-canary-20250416
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 +112 -62
- package/AutoComplete/styles/index.less +1 -1
- package/Box/styles/index.css +12 -0
- package/CHANGELOG.md +24 -0
- package/Calendar/styles/index.css +11 -9
- package/Calendar/styles/index.less +3 -1
- package/Cascader/styles/index.css +112 -62
- package/CheckPicker/styles/index.css +112 -62
- package/CheckPicker/styles/index.less +1 -1
- package/CheckTree/styles/index.css +113 -63
- package/CheckTree/styles/index.less +1 -1
- package/CheckTreePicker/styles/index.css +113 -63
- package/DateInput/styles/index.css +0 -7
- package/DatePicker/styles/index.css +122 -74
- package/DatePicker/styles/index.less +5 -11
- package/DateRangeInput/styles/index.css +0 -7
- package/DateRangePicker/styles/index.css +132 -78
- package/DateRangePicker/styles/index.less +10 -4
- package/Divider/styles/index.css +2 -2
- package/Divider/styles/index.less +2 -2
- package/Grid/styles/columns.less +1 -2
- package/Grid/styles/grid-framework.less +1 -0
- package/Grid/styles/index.css +9 -4
- package/Grid/styles/row.less +2 -2
- package/Input/styles/index.css +0 -7
- package/Input/styles/index.less +0 -6
- package/Input/styles/mixin.less +0 -4
- package/InputGroup/styles/index.css +1 -1
- package/InputGroup/styles/index.less +1 -1
- package/InputNumber/styles/index.css +1 -8
- package/InputPicker/styles/index.css +121 -70
- package/InputPicker/styles/index.less +4 -4
- package/Link/package.json +7 -0
- package/Link/styles/index.css +32 -0
- package/Link/styles/index.less +39 -0
- package/Message/styles/index.css +9 -0
- package/Message/styles/index.less +11 -0
- package/MultiCascadeTree/styles/index.css +112 -62
- package/MultiCascader/styles/index.css +112 -62
- package/Nav/styles/index.css +1 -0
- package/Nav/styles/index.less +1 -0
- package/Pagination/styles/index.css +114 -64
- package/PasswordInput/package.json +7 -0
- package/PasswordInput/styles/index.css +172 -0
- package/PasswordInput/styles/index.less +1 -0
- package/PasswordStrengthMeter/package.json +7 -0
- package/PasswordStrengthMeter/styles/index.css +33 -0
- package/PasswordStrengthMeter/styles/index.less +39 -0
- package/README.md +3 -3
- package/RadioGroup/styles/index.css +1 -0
- package/RadioGroup/styles/index.less +1 -0
- package/RangeSlider/styles/index.css +76 -43
- package/Rate/styles/index.css +48 -34
- package/Rate/styles/index.less +32 -21
- package/SelectPicker/styles/index.css +112 -62
- package/SelectPicker/styles/index.less +1 -1
- package/Slider/styles/index.css +76 -43
- package/Slider/styles/index.less +95 -48
- package/Tabs/styles/index.css +1 -0
- package/TagInput/styles/index.css +152 -91
- package/TagInput/styles/index.less +1 -1
- package/TagPicker/styles/index.css +151 -90
- package/TagPicker/styles/index.less +52 -41
- package/Textarea/package.json +7 -0
- package/Textarea/styles/index.css +6 -0
- package/Textarea/styles/index.less +7 -0
- package/TimePicker/styles/index.css +122 -74
- package/TimeRangePicker/styles/index.css +132 -78
- package/Toggle/styles/index.css +146 -87
- package/Toggle/styles/index.less +66 -38
- package/Tree/styles/index.css +113 -63
- package/Tree/styles/index.less +1 -1
- package/TreePicker/styles/index.css +113 -63
- package/cjs/AutoComplete/AutoComplete.d.ts +1 -1
- package/cjs/AutoComplete/AutoComplete.js +13 -11
- package/cjs/Avatar/Avatar.d.ts +3 -4
- package/cjs/Breadcrumb/Breadcrumb.js +2 -2
- package/cjs/Breadcrumb/BreadcrumbItem.js +1 -1
- package/cjs/Button/Button.js +9 -10
- package/cjs/Calendar/CalendarProvider.js +0 -0
- package/cjs/Calendar/hooks/useCalendar.js +0 -0
- package/cjs/Carousel/Carousel.js +2 -2
- package/cjs/Cascader/Cascader.js +42 -45
- package/cjs/Cascader/useActive.d.ts +6 -4
- package/cjs/Cascader/useActive.js +10 -8
- package/cjs/CheckPicker/CheckPicker.js +38 -41
- package/cjs/CheckTreePicker/CheckTreePicker.js +20 -22
- package/cjs/CustomProvider/CustomProvider.d.ts +1 -4
- package/cjs/CustomProvider/types.d.ts +10 -2
- package/cjs/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/DatePicker/DatePicker.js +28 -25
- package/cjs/DatePicker/utils.d.ts +3 -3
- package/cjs/DatePicker/utils.js +3 -3
- package/cjs/DateRangePicker/DateRangePicker.js +39 -33
- package/cjs/DateRangePicker/utils.js +0 -0
- package/cjs/Divider/Divider.d.ts +3 -2
- package/cjs/Divider/Divider.js +2 -2
- package/cjs/Form/hooks/useFormValidate.js +0 -0
- package/cjs/Form/hooks/useSchemaModel.js +2 -54
- package/cjs/Form/utils/constructFlatSchema.d.ts +4 -0
- package/cjs/Form/utils/constructFlatSchema.js +41 -0
- package/cjs/FormControl/hooks/useField.js +0 -0
- package/cjs/FormControl/utils.js +0 -0
- package/cjs/Grid/Row.d.ts +2 -2
- package/cjs/Grid/Row.js +2 -20
- package/cjs/Grid/types.d.ts +1 -0
- package/cjs/Grid/utils/styles.d.ts +6 -0
- package/cjs/Grid/utils/styles.js +43 -0
- package/cjs/Image/Image.js +12 -11
- package/cjs/Image/hooks/useImage.d.ts +2 -0
- package/cjs/Image/hooks/useImage.js +19 -43
- package/cjs/InlineEdit/InlineEdit.js +3 -1
- package/cjs/InlineEdit/useEditState.d.ts +2 -0
- package/cjs/InlineEdit/useEditState.js +8 -0
- package/cjs/Input/Input.d.ts +3 -12
- package/cjs/Input/Input.js +12 -73
- package/cjs/InputPicker/InputPicker.js +27 -28
- package/cjs/Link/ExternalLinkIcon.d.ts +3 -0
- package/cjs/Link/ExternalLinkIcon.js +23 -0
- package/cjs/Link/Link.d.ts +14 -0
- package/cjs/Link/Link.js +52 -0
- package/cjs/Link/index.d.ts +4 -0
- package/cjs/Link/index.js +11 -0
- package/cjs/List/List.js +6 -2
- package/cjs/List/helper/useSortHelper.d.ts +7 -5
- package/cjs/List/helper/useSortHelper.js +109 -16
- package/cjs/List/helper/utils.js +14 -6
- package/cjs/MultiCascader/MultiCascader.js +40 -43
- package/cjs/Nav/NavItem.js +1 -1
- package/cjs/Nav/NavMegaMenu.d.ts +5 -0
- package/cjs/Nav/NavMegaMenu.js +5 -0
- package/cjs/Navbar/NavbarItem.js +1 -1
- package/cjs/Navbar/NavbarMegaMenu.js +1 -1
- package/cjs/PasswordInput/PasswordInput.d.ts +14 -0
- package/cjs/PasswordInput/PasswordInput.js +71 -0
- package/cjs/PasswordInput/index.d.ts +4 -0
- package/cjs/PasswordInput/index.js +11 -0
- package/cjs/PasswordStrengthMeter/PasswordStrengthMeter.d.ts +12 -0
- package/cjs/PasswordStrengthMeter/PasswordStrengthMeter.js +50 -0
- package/cjs/PasswordStrengthMeter/index.d.ts +4 -0
- package/cjs/PasswordStrengthMeter/index.js +11 -0
- package/cjs/RangeSlider/RangeSlider.js +18 -3
- package/cjs/Rate/Character.d.ts +4 -3
- package/cjs/Rate/Character.js +19 -15
- package/cjs/Rate/Rate.d.ts +10 -2
- package/cjs/Rate/Rate.js +47 -42
- package/cjs/Rate/types.d.ts +8 -0
- package/cjs/Rate/types.js +4 -0
- package/cjs/Rate/useRatingStates.d.ts +20 -0
- package/cjs/Rate/useRatingStates.js +48 -0
- package/cjs/Rate/utils.d.ts +14 -3
- package/cjs/Rate/utils.js +50 -9
- package/cjs/SelectPicker/SelectPicker.js +45 -46
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +1 -1
- package/cjs/Sidenav/SidenavItem.js +1 -1
- package/cjs/Slider/Graduated.d.ts +4 -0
- package/cjs/Slider/Graduated.js +43 -20
- package/cjs/Slider/Handle.d.ts +1 -1
- package/cjs/Slider/Handle.js +12 -12
- package/cjs/Slider/Slider.d.ts +16 -1
- package/cjs/Slider/Slider.js +7 -2
- package/cjs/Slider/useDrag.d.ts +1 -0
- package/cjs/Slider/useDrag.js +8 -3
- package/cjs/Steps/Steps.js +2 -2
- package/cjs/Tabs/Tabs.js +2 -2
- package/cjs/Textarea/Textarea.d.ts +32 -0
- package/cjs/Textarea/Textarea.js +51 -0
- package/cjs/Textarea/index.d.ts +4 -0
- package/cjs/Textarea/index.js +11 -0
- package/cjs/Timeline/Timeline.js +2 -2
- package/cjs/Toggle/Toggle.d.ts +10 -1
- package/cjs/Toggle/Toggle.js +12 -9
- package/cjs/TreePicker/TreePicker.js +18 -19
- package/cjs/index.d.ts +4 -1
- package/cjs/index.js +24 -6
- package/cjs/internals/Box/Box.d.ts +4 -0
- package/cjs/internals/Box/Box.js +1 -1
- package/cjs/internals/Box/utils.js +5 -1
- package/cjs/internals/InputBase/InputBase.d.ts +45 -0
- package/cjs/internals/InputBase/InputBase.js +96 -0
- package/cjs/internals/InputBase/index.d.ts +3 -0
- package/cjs/internals/InputBase/index.js +8 -0
- package/cjs/internals/Overlay/Modal.d.ts +1 -1
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +4 -3
- package/cjs/internals/Overlay/OverlayTrigger.js +8 -3
- package/cjs/internals/Picker/Listbox.js +7 -9
- package/cjs/internals/Picker/PickerDrawer.d.ts +8 -0
- package/cjs/internals/Picker/PickerDrawer.js +31 -0
- package/cjs/internals/Picker/PickerPopup.js +5 -3
- package/cjs/internals/Picker/PickerToggle.d.ts +1 -0
- package/cjs/internals/Picker/PickerToggle.js +10 -3
- package/cjs/internals/Picker/PickerToggleTrigger.d.ts +51 -11
- package/cjs/internals/Picker/PickerToggleTrigger.js +59 -13
- package/cjs/internals/Picker/hooks/index.d.ts +0 -1
- package/cjs/internals/Picker/hooks/index.js +2 -4
- package/cjs/internals/Picker/hooks/useCombobox.d.ts +1 -0
- package/cjs/internals/Picker/hooks/useCombobox.js +3 -1
- package/cjs/internals/Picker/index.d.ts +1 -2
- package/cjs/internals/Picker/index.js +10 -12
- package/{esm → cjs/internals}/SafeAnchor/SafeAnchor.d.ts +2 -2
- package/cjs/{SafeAnchor → internals/SafeAnchor}/SafeAnchor.js +3 -3
- package/cjs/internals/Tree/TreeView.js +3 -4
- package/cjs/internals/hooks/useRootClose.js +4 -4
- package/cjs/internals/index.d.ts +4 -0
- package/cjs/internals/index.js +13 -1
- package/cjs/internals/types/html.d.ts +2 -0
- package/cjs/internals/utils/{dom.d.ts → html/dom.d.ts} +1 -0
- package/cjs/internals/utils/{dom.js → html/dom.js} +8 -0
- package/cjs/internals/utils/{events.js → html/events.js} +0 -0
- package/cjs/internals/utils/{htmlPropsUtils.js → html/htmlPropsUtils.js} +0 -0
- package/cjs/internals/utils/html/index.d.ts +4 -0
- package/cjs/internals/utils/html/index.js +28 -0
- package/cjs/internals/utils/{safeSetSelection.js → html/safeSetSelection.js} +1 -1
- package/cjs/internals/utils/index.d.ts +3 -15
- package/cjs/internals/utils/index.js +20 -49
- package/cjs/internals/utils/{ReactChildren.d.ts → react/ReactChildren.d.ts} +2 -8
- package/cjs/internals/utils/{ReactChildren.js → react/ReactChildren.js} +5 -25
- package/cjs/internals/utils/react/ReactIs.d.ts +7 -0
- package/cjs/internals/utils/react/ReactIs.js +26 -0
- package/{esm/internals/utils → cjs/internals/utils/react}/createComponent.d.ts +2 -2
- package/cjs/internals/utils/{createComponent.js → react/createComponent.js} +3 -3
- package/cjs/internals/utils/{deprecateComponent.js → react/deprecateComponent.js} +1 -1
- package/cjs/internals/utils/{forwardRef.d.ts → react/forwardRef.d.ts} +1 -1
- package/cjs/internals/utils/react/index.d.ts +7 -0
- package/cjs/internals/utils/react/index.js +46 -0
- package/cjs/internals/utils/{mergeRefs.js → react/mergeRefs.js} +0 -0
- package/cjs/internals/utils/{getStringLength.d.ts → string/getStringLength.d.ts} +0 -1
- package/cjs/internals/utils/{getStringLength.js → string/getStringLength.js} +1 -3
- package/cjs/internals/utils/string/index.d.ts +4 -0
- package/cjs/internals/utils/string/index.js +28 -0
- package/cjs/internals/utils/{stringifyReactNode.js → string/stringifyReactNode.js} +0 -0
- package/cjs/internals/utils/{tplTransform.js → string/tplTransform.js} +0 -0
- package/cjs/locales/en_GB.js +2 -2
- package/cjs/locales/en_US.js +2 -2
- package/cjs/locales/index.js +0 -0
- package/cjs/locales/pl_PL.js +2 -3
- package/cjs/useBreakpointValue/useBreakpointValue.d.ts +6 -2
- package/cjs/useBreakpointValue/useBreakpointValue.js +9 -4
- package/cjs/useMediaQuery/breakpoints.d.ts +24 -0
- package/cjs/useMediaQuery/breakpoints.js +248 -0
- package/cjs/useMediaQuery/index.d.ts +1 -1
- package/cjs/useMediaQuery/types.d.ts +45 -0
- package/cjs/useMediaQuery/types.js +4 -0
- package/cjs/useMediaQuery/useMediaQuery.d.ts +4 -13
- package/cjs/useMediaQuery/useMediaQuery.js +30 -12
- package/cjs/useToaster/useToaster.d.ts +1 -1
- package/cjs/useToaster/useToaster.js +1 -1
- package/dist/rsuite-no-reset-rtl.css +565 -276
- 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 +565 -276
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +565 -276
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +565 -276
- package/dist/rsuite.js +508 -211
- 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/AutoComplete/AutoComplete.d.ts +1 -1
- package/esm/AutoComplete/AutoComplete.js +13 -11
- package/esm/Avatar/Avatar.d.ts +3 -4
- package/esm/Breadcrumb/Breadcrumb.js +3 -3
- package/esm/Breadcrumb/BreadcrumbItem.js +1 -1
- package/esm/Button/Button.js +10 -11
- package/esm/Calendar/CalendarProvider.js +0 -0
- package/esm/Calendar/hooks/useCalendar.js +0 -0
- package/esm/Carousel/Carousel.js +3 -3
- package/esm/Cascader/Cascader.js +43 -46
- package/esm/Cascader/useActive.d.ts +6 -4
- package/esm/Cascader/useActive.js +10 -8
- package/esm/CheckPicker/CheckPicker.js +39 -42
- package/esm/CheckTreePicker/CheckTreePicker.js +21 -23
- package/esm/CustomProvider/CustomProvider.d.ts +1 -4
- package/esm/CustomProvider/types.d.ts +10 -2
- package/esm/DatePicker/DatePicker.d.ts +1 -1
- package/esm/DatePicker/DatePicker.js +29 -26
- package/esm/DatePicker/utils.d.ts +3 -3
- package/esm/DatePicker/utils.js +4 -4
- package/esm/DateRangePicker/DateRangePicker.js +35 -29
- package/esm/DateRangePicker/utils.js +0 -0
- package/esm/Divider/Divider.d.ts +3 -2
- package/esm/Divider/Divider.js +2 -2
- package/esm/Form/hooks/useFormValidate.js +0 -0
- package/esm/Form/hooks/useSchemaModel.js +3 -55
- package/esm/Form/utils/constructFlatSchema.d.ts +4 -0
- package/esm/Form/utils/constructFlatSchema.js +37 -0
- package/esm/FormControl/hooks/useField.js +0 -0
- package/esm/FormControl/utils.js +0 -0
- package/esm/Grid/Row.d.ts +2 -2
- package/esm/Grid/Row.js +2 -20
- package/esm/Grid/types.d.ts +1 -0
- package/esm/Grid/utils/styles.d.ts +6 -0
- package/esm/Grid/utils/styles.js +37 -0
- package/esm/Image/Image.js +12 -11
- package/esm/Image/hooks/useImage.d.ts +2 -0
- package/esm/Image/hooks/useImage.js +20 -43
- package/esm/InlineEdit/InlineEdit.js +3 -1
- package/esm/InlineEdit/useEditState.d.ts +2 -0
- package/esm/InlineEdit/useEditState.js +8 -0
- package/esm/Input/Input.d.ts +3 -12
- package/esm/Input/Input.js +12 -74
- package/esm/InputPicker/InputPicker.js +28 -29
- package/esm/Link/ExternalLinkIcon.d.ts +3 -0
- package/esm/Link/ExternalLinkIcon.js +18 -0
- package/esm/Link/Link.d.ts +14 -0
- package/esm/Link/Link.js +47 -0
- package/esm/Link/index.d.ts +4 -0
- package/esm/Link/index.js +8 -0
- package/esm/List/List.js +6 -2
- package/esm/List/helper/useSortHelper.d.ts +7 -5
- package/esm/List/helper/useSortHelper.js +109 -16
- package/esm/List/helper/utils.js +14 -6
- package/esm/MultiCascader/MultiCascader.js +41 -44
- package/esm/Nav/NavItem.js +1 -1
- package/esm/Nav/NavMegaMenu.d.ts +5 -0
- package/esm/Nav/NavMegaMenu.js +5 -0
- package/esm/Navbar/NavbarItem.js +1 -1
- package/esm/Navbar/NavbarMegaMenu.js +1 -1
- package/esm/PasswordInput/PasswordInput.d.ts +14 -0
- package/esm/PasswordInput/PasswordInput.js +66 -0
- package/esm/PasswordInput/index.d.ts +4 -0
- package/esm/PasswordInput/index.js +8 -0
- package/esm/PasswordStrengthMeter/PasswordStrengthMeter.d.ts +12 -0
- package/esm/PasswordStrengthMeter/PasswordStrengthMeter.js +45 -0
- package/esm/PasswordStrengthMeter/index.d.ts +4 -0
- package/esm/PasswordStrengthMeter/index.js +8 -0
- package/esm/RangeSlider/RangeSlider.js +18 -3
- package/esm/Rate/Character.d.ts +4 -3
- package/esm/Rate/Character.js +20 -16
- package/esm/Rate/Rate.d.ts +10 -2
- package/esm/Rate/Rate.js +49 -42
- package/esm/Rate/types.d.ts +8 -0
- package/esm/Rate/types.js +2 -0
- package/esm/Rate/useRatingStates.d.ts +20 -0
- package/esm/Rate/useRatingStates.js +43 -0
- package/esm/Rate/utils.d.ts +14 -3
- package/esm/Rate/utils.js +46 -7
- package/esm/SelectPicker/SelectPicker.js +46 -47
- package/esm/Sidenav/ExpandedSidenavDropdownItem.js +1 -1
- package/esm/Sidenav/SidenavItem.js +1 -1
- package/esm/Slider/Graduated.d.ts +4 -0
- package/esm/Slider/Graduated.js +43 -20
- package/esm/Slider/Handle.d.ts +1 -1
- package/esm/Slider/Handle.js +12 -12
- package/esm/Slider/Slider.d.ts +16 -1
- package/esm/Slider/Slider.js +7 -2
- package/esm/Slider/useDrag.d.ts +1 -0
- package/esm/Slider/useDrag.js +8 -3
- package/esm/Steps/Steps.js +3 -3
- package/esm/Tabs/Tabs.js +3 -3
- package/esm/Textarea/Textarea.d.ts +32 -0
- package/esm/Textarea/Textarea.js +46 -0
- package/esm/Textarea/index.d.ts +4 -0
- package/esm/Textarea/index.js +8 -0
- package/esm/Timeline/Timeline.js +3 -3
- package/esm/Toggle/Toggle.d.ts +10 -1
- package/esm/Toggle/Toggle.js +12 -9
- package/esm/TreePicker/TreePicker.js +19 -20
- package/esm/index.d.ts +4 -1
- package/esm/index.js +4 -1
- package/esm/internals/Box/Box.d.ts +4 -0
- package/esm/internals/Box/Box.js +1 -1
- package/esm/internals/Box/utils.js +5 -1
- package/esm/internals/InputBase/InputBase.d.ts +45 -0
- package/esm/internals/InputBase/InputBase.js +89 -0
- package/esm/internals/InputBase/index.d.ts +3 -0
- package/esm/internals/InputBase/index.js +3 -0
- package/esm/internals/Overlay/Modal.d.ts +1 -1
- package/esm/internals/Overlay/OverlayTrigger.d.ts +4 -3
- package/esm/internals/Overlay/OverlayTrigger.js +8 -2
- package/esm/internals/Picker/Listbox.js +8 -10
- package/esm/internals/Picker/PickerDrawer.d.ts +8 -0
- package/esm/internals/Picker/PickerDrawer.js +26 -0
- package/esm/internals/Picker/PickerPopup.js +5 -3
- package/esm/internals/Picker/PickerToggle.d.ts +1 -0
- package/esm/internals/Picker/PickerToggle.js +10 -3
- package/esm/internals/Picker/PickerToggleTrigger.d.ts +51 -11
- package/esm/internals/Picker/PickerToggleTrigger.js +59 -12
- package/esm/internals/Picker/hooks/index.d.ts +0 -1
- package/esm/internals/Picker/hooks/index.js +1 -2
- package/esm/internals/Picker/hooks/useCombobox.d.ts +1 -0
- package/esm/internals/Picker/hooks/useCombobox.js +3 -1
- package/esm/internals/Picker/index.d.ts +1 -2
- package/esm/internals/Picker/index.js +1 -2
- package/{cjs → esm/internals}/SafeAnchor/SafeAnchor.d.ts +2 -2
- package/esm/{SafeAnchor → internals/SafeAnchor}/SafeAnchor.js +3 -3
- package/esm/internals/Tree/TreeView.js +4 -5
- package/esm/internals/hooks/useRootClose.js +1 -1
- package/esm/internals/index.d.ts +4 -0
- package/esm/internals/index.js +5 -0
- package/esm/internals/types/html.d.ts +2 -0
- package/esm/internals/utils/{dom.d.ts → html/dom.d.ts} +1 -0
- package/esm/internals/utils/{dom.js → html/dom.js} +7 -0
- package/esm/internals/utils/{events.js → html/events.js} +0 -0
- package/esm/internals/utils/{htmlPropsUtils.js → html/htmlPropsUtils.js} +0 -0
- package/esm/internals/utils/html/index.d.ts +4 -0
- package/esm/internals/utils/html/index.js +5 -0
- package/esm/internals/utils/{safeSetSelection.js → html/safeSetSelection.js} +1 -1
- package/esm/internals/utils/index.d.ts +3 -15
- package/esm/internals/utils/index.js +3 -14
- package/esm/internals/utils/{ReactChildren.d.ts → react/ReactChildren.d.ts} +2 -8
- package/esm/internals/utils/{ReactChildren.js → react/ReactChildren.js} +3 -21
- package/esm/internals/utils/react/ReactIs.d.ts +7 -0
- package/esm/internals/utils/react/ReactIs.js +22 -0
- package/{cjs/internals/utils → esm/internals/utils/react}/createComponent.d.ts +2 -2
- package/esm/internals/utils/{createComponent.js → react/createComponent.js} +3 -3
- package/esm/internals/utils/{deprecateComponent.js → react/deprecateComponent.js} +1 -1
- package/esm/internals/utils/{forwardRef.d.ts → react/forwardRef.d.ts} +1 -1
- package/esm/internals/utils/react/index.d.ts +7 -0
- package/esm/internals/utils/react/index.js +8 -0
- package/esm/internals/utils/{mergeRefs.js → react/mergeRefs.js} +0 -0
- package/esm/internals/utils/{getStringLength.d.ts → string/getStringLength.d.ts} +0 -1
- package/esm/internals/utils/{getStringLength.js → string/getStringLength.js} +1 -2
- package/esm/internals/utils/string/index.d.ts +4 -0
- package/esm/internals/utils/string/index.js +5 -0
- package/esm/internals/utils/{stringifyReactNode.js → string/stringifyReactNode.js} +0 -0
- package/esm/internals/utils/{tplTransform.js → string/tplTransform.js} +0 -0
- package/esm/locales/en_GB.js +2 -2
- package/esm/locales/en_US.js +2 -2
- package/esm/locales/index.js +0 -0
- package/esm/locales/pl_PL.js +1 -1
- package/esm/useBreakpointValue/useBreakpointValue.d.ts +6 -2
- package/esm/useBreakpointValue/useBreakpointValue.js +9 -4
- package/esm/useMediaQuery/breakpoints.d.ts +24 -0
- package/esm/useMediaQuery/breakpoints.js +244 -0
- package/esm/useMediaQuery/index.d.ts +1 -1
- package/esm/useMediaQuery/types.d.ts +45 -0
- package/esm/useMediaQuery/types.js +2 -0
- package/esm/useMediaQuery/useMediaQuery.d.ts +4 -13
- package/esm/useMediaQuery/useMediaQuery.js +29 -11
- package/esm/useToaster/useToaster.d.ts +1 -1
- package/esm/useToaster/useToaster.js +1 -1
- package/internals/Box/styles/index.less +4 -0
- package/internals/Picker/styles/index.less +105 -23
- package/internals/Picker/styles/mixin.less +6 -6
- package/package.json +3 -2
- package/styles/color-modes/dark.less +2 -2
- package/styles/color-modes/high-contrast.less +2 -2
- package/styles/color-modes/light.less +2 -2
- package/styles/index.less +3 -0
- package/styles/root.less +2 -0
- package/styles/variables.less +0 -24
- package/SafeAnchor/package.json +0 -7
- package/cjs/Form/hooks/useFormClassNames.d.ts +0 -5
- package/cjs/Form/hooks/useFormClassNames.js +0 -29
- package/cjs/internals/Picker/hooks/usePickerClassName.d.ts +0 -19
- package/cjs/internals/Picker/hooks/usePickerClassName.js +0 -45
- package/esm/Form/hooks/useFormClassNames.d.ts +0 -5
- package/esm/Form/hooks/useFormClassNames.js +0 -25
- package/esm/internals/Picker/hooks/usePickerClassName.d.ts +0 -19
- package/esm/internals/Picker/hooks/usePickerClassName.js +0 -40
- /package/cjs/{SafeAnchor → internals/SafeAnchor}/index.d.ts +0 -0
- /package/cjs/{SafeAnchor → internals/SafeAnchor}/index.js +0 -0
- /package/cjs/internals/utils/{events.d.ts → html/events.d.ts} +0 -0
- /package/cjs/internals/utils/{htmlPropsUtils.d.ts → html/htmlPropsUtils.d.ts} +0 -0
- /package/cjs/internals/utils/{safeSetSelection.d.ts → html/safeSetSelection.d.ts} +0 -0
- /package/cjs/internals/utils/{deprecateComponent.d.ts → react/deprecateComponent.d.ts} +0 -0
- /package/cjs/internals/utils/{forwardRef.js → react/forwardRef.js} +0 -0
- /package/cjs/internals/utils/{getDOMNode.d.ts → react/getDOMNode.d.ts} +0 -0
- /package/cjs/internals/utils/{getDOMNode.js → react/getDOMNode.js} +0 -0
- /package/cjs/internals/utils/{mergeRefs.d.ts → react/mergeRefs.d.ts} +0 -0
- /package/cjs/internals/utils/{getSafeRegExpString.d.ts → string/getSafeRegExpString.d.ts} +0 -0
- /package/cjs/internals/utils/{getSafeRegExpString.js → string/getSafeRegExpString.js} +0 -0
- /package/cjs/internals/utils/{stringifyReactNode.d.ts → string/stringifyReactNode.d.ts} +0 -0
- /package/cjs/internals/utils/{tplTransform.d.ts → string/tplTransform.d.ts} +0 -0
- /package/esm/{SafeAnchor → internals/SafeAnchor}/index.d.ts +0 -0
- /package/esm/{SafeAnchor → internals/SafeAnchor}/index.js +0 -0
- /package/esm/internals/utils/{events.d.ts → html/events.d.ts} +0 -0
- /package/esm/internals/utils/{htmlPropsUtils.d.ts → html/htmlPropsUtils.d.ts} +0 -0
- /package/esm/internals/utils/{safeSetSelection.d.ts → html/safeSetSelection.d.ts} +0 -0
- /package/esm/internals/utils/{deprecateComponent.d.ts → react/deprecateComponent.d.ts} +0 -0
- /package/esm/internals/utils/{forwardRef.js → react/forwardRef.js} +0 -0
- /package/esm/internals/utils/{getDOMNode.d.ts → react/getDOMNode.d.ts} +0 -0
- /package/esm/internals/utils/{getDOMNode.js → react/getDOMNode.js} +0 -0
- /package/esm/internals/utils/{mergeRefs.d.ts → react/mergeRefs.d.ts} +0 -0
- /package/esm/internals/utils/{getSafeRegExpString.d.ts → string/getSafeRegExpString.d.ts} +0 -0
- /package/esm/internals/utils/{getSafeRegExpString.js → string/getSafeRegExpString.js} +0 -0
- /package/esm/internals/utils/{stringifyReactNode.d.ts → string/stringifyReactNode.d.ts} +0 -0
- /package/esm/internals/utils/{tplTransform.d.ts → string/tplTransform.d.ts} +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* Capitalize the first letter of a string
|
|
4
|
+
*/
|
|
5
|
+
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Adjust max-width value to avoid breakpoint overlapping
|
|
9
|
+
*/
|
|
10
|
+
function adjustMaxWidth(value) {
|
|
11
|
+
// Extract numeric part and unit
|
|
12
|
+
const match = value.match(/^([\d.]+)(\w+)$/);
|
|
13
|
+
if (!match) return value;
|
|
14
|
+
const [, numStr, unit] = match;
|
|
15
|
+
const num = parseFloat(numStr);
|
|
16
|
+
|
|
17
|
+
// If value is 0, don't adjust
|
|
18
|
+
if (num === 0) return value;
|
|
19
|
+
|
|
20
|
+
// Subtract a small value to avoid overlap
|
|
21
|
+
const adjustedNum = num - 0.01;
|
|
22
|
+
return `${adjustedNum}${unit}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create media query string
|
|
27
|
+
*/
|
|
28
|
+
function createMediaQuery(options) {
|
|
29
|
+
const {
|
|
30
|
+
min,
|
|
31
|
+
max
|
|
32
|
+
} = options;
|
|
33
|
+
if (!min && !max) return '';
|
|
34
|
+
const conditions = [];
|
|
35
|
+
if (min) conditions.push(`(min-width: ${min})`);
|
|
36
|
+
if (max) conditions.push(`(max-width: ${max})`);
|
|
37
|
+
return conditions.join(' and ');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Create traditional media query map compatible with previous versions
|
|
42
|
+
*/
|
|
43
|
+
function createLegacyMediaQueryMap(breakpoints) {
|
|
44
|
+
const entries = Object.entries(breakpoints);
|
|
45
|
+
const result = {};
|
|
46
|
+
|
|
47
|
+
// Special case for xs
|
|
48
|
+
const xsValue = breakpoints.xs;
|
|
49
|
+
if (xsValue) {
|
|
50
|
+
// For xs, use max-width of the next breakpoint minus 0.01
|
|
51
|
+
const nextBreakpoint = entries.find(_ref => {
|
|
52
|
+
let [key] = _ref;
|
|
53
|
+
return key === 'sm';
|
|
54
|
+
});
|
|
55
|
+
if (nextBreakpoint) {
|
|
56
|
+
result.xs = `(max-width: ${adjustMaxWidth(nextBreakpoint[1])})`;
|
|
57
|
+
} else {
|
|
58
|
+
result.xs = `(min-width: ${xsValue})`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// For all other breakpoints, use min-width
|
|
63
|
+
entries.forEach(_ref2 => {
|
|
64
|
+
let [key, value] = _ref2;
|
|
65
|
+
if (key !== 'xs') {
|
|
66
|
+
result[key] = `(min-width: ${value})`;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Create breakpoint system
|
|
74
|
+
*
|
|
75
|
+
* This function takes a breakpoint map and returns an enhanced breakpoint system
|
|
76
|
+
* that provides various media queries for responsive design.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const breakpoints = createBreakpoints({
|
|
81
|
+
* xs: '0px',
|
|
82
|
+
* sm: '576px',
|
|
83
|
+
* md: '768px',
|
|
84
|
+
* lg: '992px',
|
|
85
|
+
* xl: '1200px'
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // Using breakpoints
|
|
89
|
+
* breakpoints.up('md'); // '(min-width: 768px)'
|
|
90
|
+
* breakpoints.down('lg'); // '(max-width: 991.99px)'
|
|
91
|
+
* breakpoints.between('sm', 'lg'); // '(min-width: 576px) and (max-width: 991.99px)'
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function createBreakpoints(breakpoints) {
|
|
95
|
+
// Sort breakpoints by value
|
|
96
|
+
const sortedEntries = Object.entries(breakpoints).sort((a, b) => {
|
|
97
|
+
const valueA = parseInt(a[1].replace(/[^\d]/g, ''), 10);
|
|
98
|
+
const valueB = parseInt(b[1].replace(/[^\d]/g, ''), 10);
|
|
99
|
+
return valueA - valueB;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Create breakpoint entries with min and max values
|
|
103
|
+
const breakpointEntries = sortedEntries.map((_ref3, index) => {
|
|
104
|
+
let [name, value] = _ref3;
|
|
105
|
+
let max = null;
|
|
106
|
+
|
|
107
|
+
// If not the last breakpoint, use the next breakpoint's value minus 0.01 as the current max
|
|
108
|
+
if (index < sortedEntries.length - 1) {
|
|
109
|
+
max = adjustMaxWidth(sortedEntries[index + 1][1]);
|
|
110
|
+
}
|
|
111
|
+
return [name, {
|
|
112
|
+
name,
|
|
113
|
+
min: value,
|
|
114
|
+
max
|
|
115
|
+
}];
|
|
116
|
+
});
|
|
117
|
+
const entries = Object.fromEntries(breakpointEntries);
|
|
118
|
+
|
|
119
|
+
// Get breakpoint entry by name
|
|
120
|
+
function getEntry(name) {
|
|
121
|
+
return entries[name];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Generate all possible breakpoint conditions
|
|
125
|
+
function generateConditions() {
|
|
126
|
+
const conditions = {};
|
|
127
|
+
const breakpointNames = Object.keys(entries);
|
|
128
|
+
|
|
129
|
+
// Create basic conditions for each breakpoint
|
|
130
|
+
breakpointNames.forEach(name => {
|
|
131
|
+
const entry = getEntry(name);
|
|
132
|
+
|
|
133
|
+
// Up condition (min-width)
|
|
134
|
+
conditions[name] = createMediaQuery({
|
|
135
|
+
min: entry.min === null ? undefined : entry.min
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Down condition (max-width)
|
|
139
|
+
conditions[`${name}Down`] = createMediaQuery({
|
|
140
|
+
max: entry.min !== null ? entry.min === '0px' ? entry.min : adjustMaxWidth(entry.min) : undefined
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Only condition (min-width and max-width)
|
|
144
|
+
conditions[`${name}Only`] = createMediaQuery({
|
|
145
|
+
min: entry.min === null ? undefined : entry.min,
|
|
146
|
+
max: entry.max === null ? undefined : entry.max
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Create range conditions
|
|
151
|
+
for (let i = 0; i < breakpointNames.length; i++) {
|
|
152
|
+
for (let j = i + 1; j < breakpointNames.length; j++) {
|
|
153
|
+
const minName = breakpointNames[i];
|
|
154
|
+
const maxName = breakpointNames[j];
|
|
155
|
+
const minEntry = getEntry(minName);
|
|
156
|
+
const maxEntry = getEntry(maxName);
|
|
157
|
+
conditions[`${minName}To${capitalize(maxName)}`] = createMediaQuery({
|
|
158
|
+
min: minEntry.min === null ? undefined : minEntry.min,
|
|
159
|
+
max: maxEntry.min !== null ? maxEntry.min === '0px' ? maxEntry.min : adjustMaxWidth(maxEntry.min) : undefined
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return conditions;
|
|
164
|
+
}
|
|
165
|
+
const conditions = generateConditions();
|
|
166
|
+
|
|
167
|
+
// Create legacy media query map for backward compatibility
|
|
168
|
+
const legacyMap = createLegacyMediaQueryMap(breakpoints);
|
|
169
|
+
|
|
170
|
+
// Get condition by key
|
|
171
|
+
function getCondition(key) {
|
|
172
|
+
return conditions[key] || '';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Get all breakpoint keys
|
|
176
|
+
function keys() {
|
|
177
|
+
return ['base', ...Object.keys(entries)];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Create up media query (min-width)
|
|
181
|
+
function up(name) {
|
|
182
|
+
const entry = getEntry(name);
|
|
183
|
+
return createMediaQuery({
|
|
184
|
+
min: entry.min === null ? undefined : entry.min
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Create down media query (max-width)
|
|
189
|
+
function down(name) {
|
|
190
|
+
const entry = getEntry(name);
|
|
191
|
+
return createMediaQuery({
|
|
192
|
+
max: entry.min !== null ? entry.min === '0px' ? entry.min : adjustMaxWidth(entry.min) : undefined
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Create only media query (min-width and max-width)
|
|
197
|
+
function only(name) {
|
|
198
|
+
const entry = getEntry(name);
|
|
199
|
+
return createMediaQuery({
|
|
200
|
+
min: entry.min === null ? undefined : entry.min,
|
|
201
|
+
max: entry.max === null ? undefined : entry.max
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Create between media query
|
|
206
|
+
function between(minName, maxName) {
|
|
207
|
+
const minEntry = getEntry(minName);
|
|
208
|
+
const maxEntry = getEntry(maxName);
|
|
209
|
+
return createMediaQuery({
|
|
210
|
+
min: minEntry.min === null ? undefined : minEntry.min,
|
|
211
|
+
max: maxEntry.min !== null ? maxEntry.min === '0px' ? maxEntry.min : adjustMaxWidth(maxEntry.min) : undefined
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Create a combined media query map that merges legacy map with enhanced conditions
|
|
216
|
+
function createMediaQueryMap() {
|
|
217
|
+
// Start with legacy map for backward compatibility
|
|
218
|
+
const mediaQueryMap = {
|
|
219
|
+
...legacyMap
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Add enhanced conditions, excluding any keys that would override legacy map
|
|
223
|
+
const breakpointKeys = Object.keys(legacyMap);
|
|
224
|
+
Object.entries(conditions).forEach(_ref4 => {
|
|
225
|
+
let [key, value] = _ref4;
|
|
226
|
+
if (!breakpointKeys.includes(key)) {
|
|
227
|
+
mediaQueryMap[key] = value;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return mediaQueryMap;
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
values: Object.values(entries),
|
|
234
|
+
only,
|
|
235
|
+
keys,
|
|
236
|
+
conditions,
|
|
237
|
+
getCondition,
|
|
238
|
+
up,
|
|
239
|
+
down,
|
|
240
|
+
between,
|
|
241
|
+
legacyMap,
|
|
242
|
+
createMediaQueryMap
|
|
243
|
+
};
|
|
244
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breakpoint map with breakpoint names as keys and size values as values
|
|
3
|
+
*/
|
|
4
|
+
export interface BreakpointMap {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Media query map with breakpoint names as keys and media query strings as values
|
|
9
|
+
*/
|
|
10
|
+
export interface MediaQueryMap {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The type of the query parameter.
|
|
15
|
+
*/
|
|
16
|
+
export type Query = string;
|
|
17
|
+
/**
|
|
18
|
+
* Breakpoint entry with name, min and max values
|
|
19
|
+
*/
|
|
20
|
+
export interface BreakpointEntry {
|
|
21
|
+
name: string;
|
|
22
|
+
min: string | null;
|
|
23
|
+
max: string | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Map of breakpoint condition names to media query strings
|
|
27
|
+
*/
|
|
28
|
+
export interface BreakpointConditions {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Result of createBreakpoints function
|
|
33
|
+
*/
|
|
34
|
+
export interface BreakpointSystem {
|
|
35
|
+
values: BreakpointEntry[];
|
|
36
|
+
only: (name: string) => string;
|
|
37
|
+
keys: () => string[];
|
|
38
|
+
conditions: BreakpointConditions;
|
|
39
|
+
getCondition: (key: string) => string;
|
|
40
|
+
up: (name: string) => string;
|
|
41
|
+
down: (name: string) => string;
|
|
42
|
+
between: (minName: string, maxName: string) => string;
|
|
43
|
+
legacyMap: MediaQueryMap;
|
|
44
|
+
createMediaQueryMap: () => MediaQueryMap;
|
|
45
|
+
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
xs: string;
|
|
3
|
-
sm: string;
|
|
4
|
-
md: string;
|
|
5
|
-
lg: string;
|
|
6
|
-
xl: string;
|
|
7
|
-
xxl: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* The type of the query parameter.
|
|
11
|
-
*/
|
|
12
|
-
export type Query = string | keyof typeof mediaQuerySizeMap;
|
|
1
|
+
import type { Query } from './types';
|
|
13
2
|
/**
|
|
14
3
|
* React hook that tracks state of a CSS media query
|
|
15
4
|
* @version 5.48.0
|
|
16
5
|
* @unstable Please note that this API is not stable and may change in the future.
|
|
17
6
|
* @see https://rsuitejs.com/components/use-media-query
|
|
7
|
+
* @param query - The media query string or array of query strings
|
|
8
|
+
* @param enabled - Whether to enable the media query, defaults to true
|
|
18
9
|
*/
|
|
19
|
-
export declare function useMediaQuery(query: Query | Query[]): boolean[];
|
|
10
|
+
export declare function useMediaQuery(query: Query | Query[], enabled?: boolean): boolean[];
|
|
20
11
|
export default useMediaQuery;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useSyncExternalStore, useCallback, useRef, useMemo } from 'react';
|
|
3
2
|
import canUseDOM from 'dom-lib/canUseDOM';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { useSyncExternalStore, useCallback, useRef, useMemo } from 'react';
|
|
4
|
+
import { createBreakpoints } from "./breakpoints.js";
|
|
5
|
+
// Basic breakpoint values definition
|
|
6
|
+
const breakpointValues = {
|
|
7
|
+
xs: '0px',
|
|
8
|
+
sm: '576px',
|
|
9
|
+
md: '768px',
|
|
10
|
+
lg: '992px',
|
|
11
|
+
xl: '1200px',
|
|
12
|
+
xxl: '1400px',
|
|
13
|
+
'2xl': '1400px'
|
|
11
14
|
};
|
|
12
15
|
|
|
16
|
+
// Create enhanced breakpoint system
|
|
17
|
+
const breakpointSystem = createBreakpoints(breakpointValues);
|
|
18
|
+
|
|
19
|
+
// Create media query map that combines legacy breakpoints with enhanced conditions
|
|
20
|
+
const mediaQuerySizeMap = breakpointSystem.createMediaQueryMap();
|
|
21
|
+
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
23
|
+
* Create a MediaQueryList object or a mock for server-side rendering
|
|
15
24
|
*/
|
|
16
|
-
|
|
17
25
|
const matchMedia = query => {
|
|
18
26
|
if (canUseDOM) {
|
|
19
27
|
return window.matchMedia(query);
|
|
@@ -29,10 +37,20 @@ const matchMedia = query => {
|
|
|
29
37
|
* @version 5.48.0
|
|
30
38
|
* @unstable Please note that this API is not stable and may change in the future.
|
|
31
39
|
* @see https://rsuitejs.com/components/use-media-query
|
|
40
|
+
* @param query - The media query string or array of query strings
|
|
41
|
+
* @param enabled - Whether to enable the media query, defaults to true
|
|
32
42
|
*/
|
|
33
|
-
export function useMediaQuery(query) {
|
|
43
|
+
export function useMediaQuery(query, enabled) {
|
|
44
|
+
if (enabled === void 0) {
|
|
45
|
+
enabled = true;
|
|
46
|
+
}
|
|
34
47
|
const queries = Array.isArray(query) ? query : [query];
|
|
35
48
|
const mediaQueries = useMemo(() => queries.map(query => mediaQuerySizeMap[query] || query), [...queries]);
|
|
49
|
+
|
|
50
|
+
// If not enabled, we don't need to set up any media queries
|
|
51
|
+
if (!enabled) {
|
|
52
|
+
return queries.map(() => false);
|
|
53
|
+
}
|
|
36
54
|
const mediaQueryArray = useRef(mediaQueries.map(query => matchMedia(query).matches));
|
|
37
55
|
const subscribe = useCallback(callback => {
|
|
38
56
|
const list = mediaQueries.map(query => matchMedia(query));
|
|
@@ -5,7 +5,7 @@ import { ToastContainerProps } from '../toaster/ToastContainer';
|
|
|
5
5
|
* It is often used with the Message and Notification components.
|
|
6
6
|
* @returns toaster { push, remove, clear }
|
|
7
7
|
*
|
|
8
|
-
* @see https://rsuitejs.com/components/
|
|
8
|
+
* @see https://rsuitejs.com/components/toaster/
|
|
9
9
|
*/
|
|
10
10
|
declare const useToaster: () => {
|
|
11
11
|
/**
|
|
@@ -9,7 +9,7 @@ import { CustomContext } from "../CustomProvider/CustomProvider.js";
|
|
|
9
9
|
* It is often used with the Message and Notification components.
|
|
10
10
|
* @returns toaster { push, remove, clear }
|
|
11
11
|
*
|
|
12
|
-
* @see https://rsuitejs.com/components/
|
|
12
|
+
* @see https://rsuitejs.com/components/toaster/
|
|
13
13
|
*/
|
|
14
14
|
const useToaster = () => {
|
|
15
15
|
const {
|
|
@@ -25,19 +25,16 @@
|
|
|
25
25
|
--rs-picker-toggle-border-width: 1px;
|
|
26
26
|
--rs-picker-toggle-bg: var(--rs-input-bg);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
vertical-align: middle;
|
|
32
|
-
max-width: 100%;
|
|
33
|
-
}
|
|
28
|
+
display: inline-block;
|
|
29
|
+
vertical-align: middle;
|
|
30
|
+
max-width: 100%;
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
&[data-block='true'] {
|
|
36
33
|
display: block;
|
|
37
34
|
width: 100%;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
&[data-disabled='true'] {
|
|
41
38
|
cursor: not-allowed;
|
|
42
39
|
|
|
43
40
|
.rs-picker-toggle-value,
|
|
@@ -60,11 +57,6 @@
|
|
|
60
57
|
color: var(--rs-picker-value);
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
&-countable &-toggle-value {
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
60
|
&-value-list {
|
|
69
61
|
flex: 0 1 auto;
|
|
70
62
|
.ellipsis-basic();
|
|
@@ -74,13 +66,14 @@
|
|
|
74
66
|
margin-inline: var(--rs-picker-value-count-margin);
|
|
75
67
|
background-color: var(--rs-picker-count-bg);
|
|
76
68
|
color: var(--rs-picker-count-text);
|
|
69
|
+
flex-shrink: 0;
|
|
77
70
|
}
|
|
78
71
|
|
|
79
72
|
&-value-separator {
|
|
80
73
|
margin: 0 var(--rs-spacing) 0 0;
|
|
81
74
|
}
|
|
82
75
|
|
|
83
|
-
&:not(
|
|
76
|
+
&:not([data-disabled='true']):hover,
|
|
84
77
|
&.rs-picker-focused {
|
|
85
78
|
border-color: var(--rs-input-focus-border);
|
|
86
79
|
}
|
|
@@ -127,6 +120,7 @@
|
|
|
127
120
|
--rs-picker-popup-shadow: var(--rs-shadow-md);
|
|
128
121
|
--rs-picker-popup-position-x: var(--rs-position-x);
|
|
129
122
|
--rs-picker-popup-position-y: var(--rs-position-y);
|
|
123
|
+
--rs-picker-min-width: 0;
|
|
130
124
|
|
|
131
125
|
position: absolute;
|
|
132
126
|
top: var(--rs-picker-popup-position-y);
|
|
@@ -141,6 +135,7 @@
|
|
|
141
135
|
background-color: var(--rs-bg-overlay);
|
|
142
136
|
box-shadow: var(--rs-picker-popup-shadow);
|
|
143
137
|
padding-block: var(--rs-picker-popup-border-radius);
|
|
138
|
+
min-width: var(--rs-picker-min-width);
|
|
144
139
|
|
|
145
140
|
.high-contrast-mode({
|
|
146
141
|
border: 1px solid var(--rs-border-primary);
|
|
@@ -175,14 +170,62 @@
|
|
|
175
170
|
color: var(--rs-text-secondary);
|
|
176
171
|
cursor: default;
|
|
177
172
|
}
|
|
173
|
+
|
|
174
|
+
.rs-picker-listbox {
|
|
175
|
+
max-height: var(--rs-picker-listbox-max-height);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Responsive popup
|
|
179
|
+
&[data-breakpoint='xs'] {
|
|
180
|
+
min-width: unset;
|
|
181
|
+
width: 100%;
|
|
182
|
+
height: 100%;
|
|
183
|
+
overflow: auto;
|
|
184
|
+
|
|
185
|
+
.rs-picker-listbox {
|
|
186
|
+
height: unset;
|
|
187
|
+
max-height: unset;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.rs-tree,
|
|
191
|
+
.rs-check-tree {
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
&-view {
|
|
195
|
+
max-height: unset;
|
|
196
|
+
flex: 1 1 auto;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.rs-calendar-table {
|
|
201
|
+
width: 100%;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.rs-picker-box {
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
flex: 1;
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&.rs-picker-popup-date,
|
|
213
|
+
.rs-picker-daterange-panel-only-time {
|
|
214
|
+
.rs-calendar {
|
|
215
|
+
height: 348px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
178
219
|
}
|
|
179
220
|
|
|
180
221
|
.rs-picker-toggle {
|
|
222
|
+
--rs-badge-one-char-size: 18px;
|
|
223
|
+
|
|
181
224
|
.picker-default-toggle();
|
|
182
225
|
.picker-subtle-toggle();
|
|
183
226
|
|
|
184
227
|
&-label {
|
|
185
|
-
color: var(--rs-text-
|
|
228
|
+
color: var(--rs-text-secondary);
|
|
186
229
|
}
|
|
187
230
|
|
|
188
231
|
.rs-picker-toggle-stack {
|
|
@@ -226,7 +269,8 @@
|
|
|
226
269
|
opacity: 0;
|
|
227
270
|
}
|
|
228
271
|
|
|
229
|
-
.rs-picker-default
|
|
272
|
+
.rs-picker[data-variant='default'],
|
|
273
|
+
& {
|
|
230
274
|
transition: @picker-transition;
|
|
231
275
|
|
|
232
276
|
.high-contrast-mode({
|
|
@@ -234,7 +278,8 @@
|
|
|
234
278
|
});
|
|
235
279
|
}
|
|
236
280
|
|
|
237
|
-
.rs-picker-default
|
|
281
|
+
.rs-picker[data-variant='default'],
|
|
282
|
+
:not([data-disabled='true']) & {
|
|
238
283
|
&:hover,
|
|
239
284
|
&:focus,
|
|
240
285
|
&-active {
|
|
@@ -242,7 +287,7 @@
|
|
|
242
287
|
}
|
|
243
288
|
}
|
|
244
289
|
|
|
245
|
-
.rs-picker-subtle & {
|
|
290
|
+
.rs-picker[data-variant='subtle'] & {
|
|
246
291
|
.rs-btn-subtle();
|
|
247
292
|
|
|
248
293
|
transition: none;
|
|
@@ -252,6 +297,43 @@
|
|
|
252
297
|
color: var(--rs-btn-subtle-hover-text);
|
|
253
298
|
}
|
|
254
299
|
}
|
|
300
|
+
|
|
301
|
+
&[data-size='lg'] {
|
|
302
|
+
--rs-badge-one-char-size: 20px;
|
|
303
|
+
.rs-picker-clean {
|
|
304
|
+
.rs-icon {
|
|
305
|
+
width: 16px;
|
|
306
|
+
height: 16px;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
&[data-size='md'] {
|
|
312
|
+
--rs-badge-one-char-size: 18px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&[data-size='sm'] {
|
|
316
|
+
--rs-badge-one-char-size: 16px;
|
|
317
|
+
.rs-picker-clean {
|
|
318
|
+
height: 18px;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&[data-size='xs'] {
|
|
323
|
+
--rs-badge-one-char-size: 14px;
|
|
324
|
+
.rs-picker-clean {
|
|
325
|
+
height: 18px;
|
|
326
|
+
.rs-icon {
|
|
327
|
+
width: 12px;
|
|
328
|
+
height: 12px;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
&[data-countable='true'] &-value {
|
|
334
|
+
display: flex;
|
|
335
|
+
align-items: center;
|
|
336
|
+
}
|
|
255
337
|
}
|
|
256
338
|
|
|
257
339
|
.rs-picker-toggle.rs-btn {
|
|
@@ -292,19 +374,19 @@
|
|
|
292
374
|
}
|
|
293
375
|
|
|
294
376
|
// Make sure styles the same with <Input>
|
|
295
|
-
.rs-picker-default,
|
|
377
|
+
.rs-picker[data-variant='default'],
|
|
296
378
|
.rs-picker-input {
|
|
297
379
|
.rs-btn,
|
|
298
380
|
.rs-picker-toggle {
|
|
299
381
|
background-color: var(--rs-picker-toggle-bg);
|
|
300
382
|
}
|
|
301
383
|
|
|
302
|
-
|
|
384
|
+
&[data-disabled='true'] {
|
|
303
385
|
--rs-picker-toggle-bg: var(--rs-input-disabled-bg);
|
|
304
|
-
}
|
|
305
386
|
|
|
306
|
-
|
|
307
|
-
|
|
387
|
+
.rs-input-group {
|
|
388
|
+
pointer-events: none;
|
|
389
|
+
}
|
|
308
390
|
}
|
|
309
391
|
}
|
|
310
392
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@import '../../../Dropdown/styles/mixin.less';
|
|
4
4
|
|
|
5
5
|
// Picker Menu items common styles
|
|
6
|
-
.picker-
|
|
6
|
+
.picker-listbox-reset() {
|
|
7
7
|
overflow-y: auto;
|
|
8
8
|
|
|
9
9
|
ul {
|
|
@@ -91,16 +91,16 @@
|
|
|
91
91
|
|
|
92
92
|
// Default picker toggle
|
|
93
93
|
.picker-default-toggle() {
|
|
94
|
-
|
|
94
|
+
[data-variant='default'] & {
|
|
95
95
|
color: var(--rs-text-primary);
|
|
96
96
|
border: var(--rs-picker-toggle-border-width) solid var(--rs-border-primary);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
[data-disabled='true'] & {
|
|
100
100
|
cursor: @cursor-disabled;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
[data-variant='default']:not([data-disabled='true']) {
|
|
104
104
|
&:hover,
|
|
105
105
|
&:focus {
|
|
106
106
|
border-color: var(--rs-input-focus-border);
|
|
@@ -110,12 +110,12 @@
|
|
|
110
110
|
|
|
111
111
|
// Subtle picker toggle
|
|
112
112
|
.picker-subtle-toggle {
|
|
113
|
-
.rs-picker-subtle & {
|
|
113
|
+
.rs-picker[data-variant='subtle'] & {
|
|
114
114
|
--rs-picker-toggle-border-width: 0px;
|
|
115
115
|
.dropdown-toggle();
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.rs-picker-subtle
|
|
118
|
+
.rs-picker[data-variant='subtle'][data-disabled='true'] & {
|
|
119
119
|
cursor: @cursor-disabled;
|
|
120
120
|
|
|
121
121
|
&:hover,
|