rsuite 5.62.1 → 5.63.0-alpha.2
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/AccordionPanel/package.json +7 -0
- package/Animation/styles/animation.less +0 -0
- package/Animation/styles/mixin.less +0 -0
- package/Badge/styles/index.css +0 -0
- package/Badge/styles/index.less +0 -0
- package/Bounce/package.json +7 -0
- package/Breadcrumb/styles/index.css +0 -0
- package/Breadcrumb/styles/index.less +0 -0
- package/BreadcrumbItem/package.json +7 -0
- package/ButtonGroup/styles/index.css +0 -0
- package/ButtonGroup/styles/index.less +0 -0
- package/CHANGELOG.md +16 -0
- package/Carousel/styles/index.css +0 -0
- package/Carousel/styles/index.less +0 -0
- package/Collapse/package.json +7 -0
- package/Container/styles/index.css +0 -0
- package/Container/styles/index.less +0 -0
- package/Content/styles/index.css +0 -0
- package/Content/styles/index.less +0 -0
- package/DatePicker/styles/mixin.less +0 -0
- package/Divider/styles/index.css +0 -0
- package/Divider/styles/index.less +0 -0
- package/Drawer/styles/mixin.less +0 -0
- package/DrawerActions/package.json +7 -0
- package/DrawerBody/package.json +7 -0
- package/DrawerFooter/package.json +7 -0
- package/DrawerHeader/package.json +7 -0
- package/DrawerTitle/package.json +7 -0
- package/DropdownItem/package.json +7 -0
- package/DropdownMenu/package.json +7 -0
- package/DropdownSeparator/package.json +7 -0
- package/Fade/package.json +7 -0
- package/FlexboxGrid/styles/index.css +0 -0
- package/FlexboxGrid/styles/index.less +0 -0
- package/FlexboxGridItem/package.json +7 -0
- package/Footer/styles/index.css +0 -0
- package/Footer/styles/index.less +0 -0
- package/Form/styles/index.css +0 -0
- package/Form/styles/index.less +0 -0
- package/FormControl/styles/index.css +0 -0
- package/FormControl/styles/index.less +0 -0
- package/FormControlLabel/styles/index.css +0 -0
- package/FormControlLabel/styles/index.less +0 -0
- package/FormErrorMessage/styles/animation.less +0 -0
- package/FormErrorMessage/styles/index.css +0 -0
- package/FormErrorMessage/styles/index.less +0 -0
- package/FormHelpText/styles/index.css +0 -0
- package/FormHelpText/styles/index.less +0 -0
- package/Grid/styles/grid-framework.less +0 -0
- package/Grid/styles/mixin.less +0 -0
- package/Header/styles/index.css +0 -0
- package/Header/styles/index.less +0 -0
- package/IconButton/styles/index.css +0 -0
- package/IconButton/styles/index.less +0 -0
- package/Input/styles/index.css +0 -0
- package/Input/styles/index.less +0 -0
- package/InputGroupAddon/package.json +7 -0
- package/InputGroupButton/package.json +7 -0
- package/InputNumber/styles/index.css +0 -0
- package/InputNumber/styles/index.less +0 -0
- package/InputNumber/styles/mixin.less +0 -0
- package/List/styles/index.css +0 -0
- package/List/styles/index.less +0 -0
- package/ListItem/package.json +7 -0
- package/Loader/styles/index.css +0 -0
- package/Loader/styles/index.less +0 -0
- package/Modal/styles/animation.less +0 -0
- package/Modal/styles/mixin.less +0 -0
- package/ModalBody/package.json +7 -0
- package/ModalDialog/package.json +7 -0
- package/ModalFooter/package.json +7 -0
- package/ModalHeader/package.json +7 -0
- package/ModalTitle/package.json +7 -0
- package/NavItem/package.json +7 -0
- package/NavMenu/package.json +7 -0
- package/NavbarBrand/package.json +7 -0
- package/Notification/styles/mixin.less +0 -0
- package/Pagination/styles/mixin.less +0 -0
- package/PanelGroup/styles/index.css +0 -0
- package/PanelGroup/styles/index.less +0 -0
- package/PlaceholderGraph/package.json +7 -0
- package/PlaceholderGrid/package.json +7 -0
- package/PlaceholderParagraph/package.json +7 -0
- package/Popover/styles/mixins.less +0 -0
- package/Progress/styles/animation.less +0 -0
- package/Progress/styles/index.css +0 -0
- package/Progress/styles/index.less +0 -0
- package/ProgressCircle/package.json +7 -0
- package/ProgressLine/package.json +7 -0
- package/README.md +2 -2
- package/Radio/styles/mixin.less +0 -0
- package/Row/styles/index.css +0 -0
- package/Row/styles/index.less +0 -0
- package/Sidebar/styles/index.css +0 -0
- package/Sidebar/styles/index.less +0 -0
- package/Sidenav/styles/mixin.less +0 -0
- package/SidenavBody/package.json +7 -0
- package/SidenavHeader/package.json +7 -0
- package/SidenavToggle/package.json +7 -0
- package/Slide/package.json +7 -0
- package/Stack/styles/index.css +0 -0
- package/Stack/styles/index.less +0 -0
- package/StackItem/package.json +7 -0
- package/StepItem/package.json +7 -0
- package/Tab/package.json +7 -0
- package/Table/styles/index.css +0 -0
- package/Table/styles/index.less +0 -0
- package/Table/styles/mixin.less +0 -0
- package/TableCell/package.json +7 -0
- package/TableColumn/package.json +7 -0
- package/TableColumnGroup/package.json +7 -0
- package/TableHeaderCell/package.json +7 -0
- package/Timeline/styles/mixin.less +0 -0
- package/TimelineItem/package.json +7 -0
- package/Toggle/styles/index.css +126 -0
- package/Toggle/styles/index.less +18 -0
- package/Toggle/styles/mixin.less +19 -4
- package/Tooltip/styles/index.css +0 -0
- package/Tooltip/styles/index.less +0 -0
- package/Tooltip/styles/mixins.less +0 -0
- package/Transition/package.json +7 -0
- package/Uploader/styles/mixin.less +0 -0
- package/cjs/Accordion/Accordion.d.ts +2 -2
- package/cjs/Accordion/Accordion.js +2 -2
- package/cjs/Accordion/AccordionPanel.d.ts +2 -0
- package/cjs/Accordion/AccordionPanel.js +8 -0
- package/cjs/Affix/index.js +0 -0
- package/cjs/Animation/index.js +0 -0
- package/cjs/Animation/utils.js +0 -0
- package/cjs/AutoComplete/index.js +0 -0
- package/cjs/Avatar/index.js +0 -0
- package/cjs/AvatarGroup/index.js +0 -0
- package/cjs/Badge/index.js +0 -0
- package/cjs/Breadcrumb/index.js +0 -0
- package/cjs/Button/index.js +0 -0
- package/cjs/ButtonGroup/index.js +0 -0
- package/cjs/ButtonToolbar/index.js +0 -0
- package/cjs/Calendar/CalendarContext.js +0 -0
- package/cjs/Calendar/index.js +0 -0
- package/cjs/Calendar/useCalendarState.js +0 -0
- package/cjs/Carousel/index.js +0 -0
- package/cjs/Cascader/index.js +0 -0
- package/cjs/CheckPicker/index.js +0 -0
- package/cjs/CheckTreePicker/index.js +0 -0
- package/cjs/Checkbox/index.js +0 -0
- package/cjs/CheckboxGroup/CheckboxGroupContext.js +0 -0
- package/cjs/CheckboxGroup/index.js +0 -0
- package/cjs/Col/index.js +0 -0
- package/cjs/Container/index.js +0 -0
- package/cjs/Content/index.js +0 -0
- package/cjs/CustomProvider/index.js +0 -0
- package/cjs/DOMHelper/isElement.js +0 -0
- package/cjs/Divider/index.js +0 -0
- package/cjs/Drawer/Drawer.d.ts +7 -7
- package/cjs/Drawer/Drawer.js +16 -46
- package/cjs/Drawer/DrawerActions.d.ts +4 -0
- package/cjs/Drawer/DrawerActions.js +10 -0
- package/cjs/Drawer/DrawerBody.d.ts +4 -0
- package/cjs/Drawer/DrawerBody.js +17 -0
- package/cjs/Drawer/DrawerFooter.d.ts +4 -0
- package/cjs/Drawer/DrawerFooter.js +17 -0
- package/cjs/Drawer/DrawerHeader.d.ts +4 -0
- package/cjs/Drawer/DrawerHeader.js +17 -0
- package/cjs/Drawer/DrawerTitle.d.ts +4 -0
- package/cjs/Drawer/DrawerTitle.js +17 -0
- package/cjs/Drawer/index.js +0 -0
- package/cjs/Dropdown/DropdownContext.js +0 -0
- package/cjs/Dropdown/DropdownState.js +0 -0
- package/cjs/Dropdown/index.js +0 -0
- package/cjs/Dropdown/useRenderDropdownItem.js +0 -0
- package/cjs/FlexboxGrid/index.js +0 -0
- package/cjs/Footer/index.js +0 -0
- package/cjs/Form/Form.js +0 -1
- package/cjs/FormControl/index.js +0 -0
- package/cjs/FormControlLabel/index.js +0 -0
- package/cjs/FormErrorMessage/index.js +0 -0
- package/cjs/FormHelpText/index.js +0 -0
- package/cjs/Grid/index.js +0 -0
- package/cjs/Header/index.js +0 -0
- package/cjs/IconButton/index.js +0 -0
- package/cjs/Input/index.js +0 -0
- package/cjs/InputGroup/index.js +0 -0
- package/cjs/InputNumber/index.js +0 -0
- package/cjs/List/helper/AutoScroller.js +0 -0
- package/cjs/List/index.js +0 -0
- package/cjs/Loader/index.js +0 -0
- package/cjs/MaskedInput/adjustCaretPosition.js +0 -0
- package/cjs/MaskedInput/conformToMask.js +0 -0
- package/cjs/MaskedInput/index.js +0 -0
- package/cjs/MaskedInput/types.js +0 -0
- package/cjs/MaskedInput/utilities.js +0 -0
- package/cjs/Message/index.js +0 -0
- package/cjs/MultiCascader/index.js +0 -0
- package/cjs/Nav/NavContext.js +0 -0
- package/cjs/Nav/index.js +0 -0
- package/cjs/Navbar/index.js +0 -0
- package/cjs/Notification/index.js +0 -0
- package/cjs/Pagination/index.js +0 -0
- package/cjs/Panel/index.js +0 -0
- package/cjs/PanelGroup/index.js +0 -0
- package/cjs/Placeholder/index.js +0 -0
- package/cjs/Popover/index.js +0 -0
- package/cjs/Progress/index.js +0 -0
- package/cjs/Radio/index.js +0 -0
- package/cjs/RadioGroup/index.js +0 -0
- package/cjs/RangeSlider/index.js +0 -0
- package/cjs/Rate/index.js +0 -0
- package/cjs/Rate/utils.js +0 -0
- package/cjs/Row/index.js +0 -0
- package/cjs/SafeAnchor/index.js +0 -0
- package/cjs/Schema/index.js +0 -0
- package/cjs/SelectPicker/index.js +0 -0
- package/cjs/Sidebar/index.js +0 -0
- package/cjs/Sidenav/Node.js +0 -0
- package/cjs/Sidenav/index.js +0 -0
- package/cjs/Slider/Input.js +0 -0
- package/cjs/Slider/index.js +0 -0
- package/cjs/Stack/index.js +0 -0
- package/cjs/Steps/index.js +0 -0
- package/cjs/Table/Table.d.ts +3 -2
- package/cjs/Table/Table.js +8 -4
- package/cjs/Table/TableCell.d.ts +2 -0
- package/cjs/Table/TableCell.js +7 -0
- package/cjs/Table/TableColumn.d.ts +2 -0
- package/cjs/Table/TableColumn.js +7 -0
- package/cjs/Table/TableColumnGroup.d.ts +2 -0
- package/cjs/Table/TableColumnGroup.js +7 -0
- package/cjs/Table/TableHeaderCell.d.ts +2 -0
- package/cjs/Table/TableHeaderCell.js +7 -0
- package/cjs/Tag/index.js +0 -0
- package/cjs/TagGroup/index.js +0 -0
- package/cjs/Timeline/index.js +0 -0
- package/cjs/Toggle/Toggle.d.ts +38 -12
- package/cjs/Toggle/Toggle.js +18 -7
- package/cjs/Toggle/index.js +0 -0
- package/cjs/Tooltip/index.js +0 -0
- package/cjs/Tree/index.js +0 -0
- package/cjs/TreePicker/index.js +0 -0
- package/cjs/Uploader/index.js +0 -0
- package/cjs/Whisper/index.js +0 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -1
- package/cjs/locales/en_GB.js +0 -0
- package/cjs/toaster/ToastContext.js +0 -0
- package/cjs/useBreakpointValue/index.d.ts +2 -0
- package/cjs/useBreakpointValue/index.js +8 -0
- package/cjs/useBreakpointValue/useBreakpointValue.d.ts +22 -0
- package/cjs/useBreakpointValue/useBreakpointValue.js +31 -0
- package/cjs/useMediaQuery/index.d.ts +1 -0
- package/cjs/useMediaQuery/useMediaQuery.d.ts +7 -4
- package/cjs/useMediaQuery/useMediaQuery.js +18 -11
- package/dist/rsuite-no-reset-rtl.css +84 -0
- 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 +84 -0
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +84 -0
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +84 -0
- package/dist/rsuite.js +348 -216
- 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.d.ts +2 -2
- package/esm/Accordion/Accordion.js +2 -2
- package/esm/Accordion/AccordionPanel.d.ts +2 -0
- package/esm/Accordion/AccordionPanel.js +3 -0
- package/esm/Affix/index.js +0 -0
- package/esm/Animation/index.js +0 -0
- package/esm/Animation/utils.js +0 -0
- package/esm/AutoComplete/index.js +0 -0
- package/esm/Avatar/index.js +0 -0
- package/esm/AvatarGroup/index.js +0 -0
- package/esm/Badge/index.js +0 -0
- package/esm/Breadcrumb/index.js +0 -0
- package/esm/Button/index.js +0 -0
- package/esm/ButtonGroup/index.js +0 -0
- package/esm/ButtonToolbar/index.js +0 -0
- package/esm/Calendar/CalendarContext.js +0 -0
- package/esm/Calendar/index.js +0 -0
- package/esm/Calendar/useCalendarState.js +0 -0
- package/esm/Carousel/index.js +0 -0
- package/esm/Cascader/index.js +0 -0
- package/esm/CheckPicker/index.js +0 -0
- package/esm/CheckTreePicker/index.js +0 -0
- package/esm/Checkbox/index.js +0 -0
- package/esm/CheckboxGroup/CheckboxGroupContext.js +0 -0
- package/esm/CheckboxGroup/index.js +0 -0
- package/esm/Col/index.js +0 -0
- package/esm/Container/index.js +0 -0
- package/esm/Content/index.js +0 -0
- package/esm/CustomProvider/index.js +0 -0
- package/esm/DOMHelper/isElement.js +0 -0
- package/esm/Divider/index.js +0 -0
- package/esm/Drawer/Drawer.d.ts +7 -7
- package/esm/Drawer/Drawer.js +6 -36
- package/esm/Drawer/DrawerActions.d.ts +4 -0
- package/esm/Drawer/DrawerActions.js +6 -0
- package/esm/Drawer/DrawerBody.d.ts +4 -0
- package/esm/Drawer/DrawerBody.js +12 -0
- package/esm/Drawer/DrawerFooter.d.ts +4 -0
- package/esm/Drawer/DrawerFooter.js +12 -0
- package/esm/Drawer/DrawerHeader.d.ts +4 -0
- package/esm/Drawer/DrawerHeader.js +12 -0
- package/esm/Drawer/DrawerTitle.d.ts +4 -0
- package/esm/Drawer/DrawerTitle.js +12 -0
- package/esm/Drawer/index.js +0 -0
- package/esm/Dropdown/DropdownContext.js +0 -0
- package/esm/Dropdown/DropdownState.js +0 -0
- package/esm/Dropdown/index.js +0 -0
- package/esm/Dropdown/useRenderDropdownItem.js +0 -0
- package/esm/FlexboxGrid/index.js +0 -0
- package/esm/Footer/index.js +0 -0
- package/esm/Form/Form.js +0 -1
- package/esm/FormControl/index.js +0 -0
- package/esm/FormControlLabel/index.js +0 -0
- package/esm/FormErrorMessage/index.js +0 -0
- package/esm/FormHelpText/index.js +0 -0
- package/esm/Grid/index.js +0 -0
- package/esm/Header/index.js +0 -0
- package/esm/IconButton/index.js +0 -0
- package/esm/Input/index.js +0 -0
- package/esm/InputGroup/index.js +0 -0
- package/esm/InputNumber/index.js +0 -0
- package/esm/List/helper/AutoScroller.js +0 -0
- package/esm/List/index.js +0 -0
- package/esm/Loader/index.js +0 -0
- package/esm/MaskedInput/adjustCaretPosition.js +0 -0
- package/esm/MaskedInput/conformToMask.js +0 -0
- package/esm/MaskedInput/index.js +0 -0
- package/esm/MaskedInput/types.js +0 -0
- package/esm/MaskedInput/utilities.js +0 -0
- package/esm/Message/index.js +0 -0
- package/esm/MultiCascader/index.js +0 -0
- package/esm/Nav/NavContext.js +0 -0
- package/esm/Nav/index.js +0 -0
- package/esm/Navbar/index.js +0 -0
- package/esm/Notification/index.js +0 -0
- package/esm/Pagination/index.js +0 -0
- package/esm/Panel/index.js +0 -0
- package/esm/PanelGroup/index.js +0 -0
- package/esm/Placeholder/index.js +0 -0
- package/esm/Popover/index.js +0 -0
- package/esm/Progress/index.js +0 -0
- package/esm/Radio/index.js +0 -0
- package/esm/RadioGroup/index.js +0 -0
- package/esm/RangeSlider/index.js +0 -0
- package/esm/Rate/index.js +0 -0
- package/esm/Rate/utils.js +0 -0
- package/esm/Row/index.js +0 -0
- package/esm/SafeAnchor/index.js +0 -0
- package/esm/Schema/index.js +0 -0
- package/esm/SelectPicker/index.js +0 -0
- package/esm/Sidebar/index.js +0 -0
- package/esm/Sidenav/Node.js +0 -0
- package/esm/Sidenav/index.js +0 -0
- package/esm/Slider/Input.js +0 -0
- package/esm/Slider/index.js +0 -0
- package/esm/Stack/index.js +0 -0
- package/esm/Steps/index.js +0 -0
- package/esm/Table/Table.d.ts +3 -2
- package/esm/Table/Table.js +9 -5
- package/esm/Table/TableCell.d.ts +2 -0
- package/esm/Table/TableCell.js +3 -0
- package/esm/Table/TableColumn.d.ts +2 -0
- package/esm/Table/TableColumn.js +3 -0
- package/esm/Table/TableColumnGroup.d.ts +2 -0
- package/esm/Table/TableColumnGroup.js +3 -0
- package/esm/Table/TableHeaderCell.d.ts +2 -0
- package/esm/Table/TableHeaderCell.js +3 -0
- package/esm/Tag/index.js +0 -0
- package/esm/TagGroup/index.js +0 -0
- package/esm/Timeline/index.js +0 -0
- package/esm/Toggle/Toggle.d.ts +38 -12
- package/esm/Toggle/Toggle.js +20 -9
- package/esm/Toggle/index.js +0 -0
- package/esm/Tooltip/index.js +0 -0
- package/esm/Tree/index.js +0 -0
- package/esm/TreePicker/index.js +0 -0
- package/esm/Uploader/index.js +0 -0
- package/esm/Whisper/index.js +0 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +4 -1
- package/esm/locales/en_GB.js +0 -0
- package/esm/toaster/ToastContext.js +0 -0
- package/esm/useBreakpointValue/index.d.ts +2 -0
- package/esm/useBreakpointValue/index.js +3 -0
- package/esm/useBreakpointValue/useBreakpointValue.d.ts +22 -0
- package/esm/useBreakpointValue/useBreakpointValue.js +25 -0
- package/esm/useMediaQuery/index.d.ts +1 -0
- package/esm/useMediaQuery/useMediaQuery.d.ts +7 -4
- package/esm/useMediaQuery/useMediaQuery.js +17 -10
- package/package.json +1 -1
- package/styles/color-modes.less +0 -0
- package/styles/colors/dark.less +0 -0
- package/styles/colors/high-contrast.less +0 -0
- package/styles/colors/light.less +0 -0
- package/styles/common.less +0 -0
- package/styles/mixins/color-modes.less +0 -0
- package/styles/mixins/hacks.less +0 -0
- package/styles/mixins/menu.less +0 -0
- package/styles/mixins/utilities.less +0 -0
- package/styles/plugins/palette.js +0 -0
- package/styles/scaffolding.less +0 -0
- package/styles/typography.less +0 -0
- package/toaster/styles/animation.less +0 -0
- package/useBreakpointValue/package.json +7 -0
- package/internals/package.json +0 -7
package/esm/Toggle/Toggle.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
-
var _excluded = ["as", "disabled", "readOnly", "loading", "plaintext", "className", "checkedChildren", "unCheckedChildren", "classPrefix", "checked", "defaultChecked", "size", "locale", "onChange"];
|
|
5
|
-
import React, {
|
|
4
|
+
var _excluded = ["as", "disabled", "readOnly", "loading", "plaintext", "children", "className", "color", "checkedChildren", "unCheckedChildren", "classPrefix", "checked", "defaultChecked", "size", "locale", "onChange"];
|
|
5
|
+
import React, { useRef } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { useClassNames, useControlled, useCustom } from "../internals/hooks/index.js";
|
|
7
|
+
import { useClassNames, useControlled, useCustom, useUniqueId, useEventCallback } from "../internals/hooks/index.js";
|
|
8
8
|
import { partitionHTMLProps } from "../internals/utils/index.js";
|
|
9
9
|
import { oneOf } from "../internals/propTypes/index.js";
|
|
10
10
|
import Plaintext from "../internals/Plaintext/index.js";
|
|
@@ -22,7 +22,9 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22
22
|
_props$loading = props.loading,
|
|
23
23
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
24
24
|
plaintext = props.plaintext,
|
|
25
|
+
children = props.children,
|
|
25
26
|
className = props.className,
|
|
27
|
+
color = props.color,
|
|
26
28
|
checkedChildren = props.checkedChildren,
|
|
27
29
|
unCheckedChildren = props.unCheckedChildren,
|
|
28
30
|
_props$classPrefix = props.classPrefix,
|
|
@@ -43,24 +45,27 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
45
|
merge = _useClassNames.merge,
|
|
44
46
|
withClassPrefix = _useClassNames.withClassPrefix,
|
|
45
47
|
prefix = _useClassNames.prefix;
|
|
46
|
-
var classes = merge(className, withClassPrefix(size, {
|
|
48
|
+
var classes = merge(className, withClassPrefix(size, color, {
|
|
47
49
|
checked: checked,
|
|
48
50
|
disabled: disabled,
|
|
49
51
|
loading: loading
|
|
50
52
|
}));
|
|
51
53
|
var inner = checked ? checkedChildren : unCheckedChildren;
|
|
52
54
|
var label = checked ? locale.on : locale.off;
|
|
55
|
+
var labelId = useUniqueId('rs-label');
|
|
56
|
+
var innerId = inner ? labelId + '-inner' : undefined;
|
|
57
|
+
var labelledby = children ? labelId : innerId;
|
|
53
58
|
var _partitionHTMLProps = partitionHTMLProps(rest),
|
|
54
59
|
htmlInputProps = _partitionHTMLProps[0],
|
|
55
60
|
restProps = _partitionHTMLProps[1];
|
|
56
|
-
var handleInputChange =
|
|
61
|
+
var handleInputChange = useEventCallback(function (e) {
|
|
57
62
|
if (disabled || readOnly || loading) {
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
60
65
|
var checked = e.target.checked;
|
|
61
66
|
setChecked(checked);
|
|
62
67
|
onChange === null || onChange === void 0 ? void 0 : onChange(checked, e);
|
|
63
|
-
}
|
|
68
|
+
});
|
|
64
69
|
if (plaintext) {
|
|
65
70
|
return /*#__PURE__*/React.createElement(Plaintext, null, inner || label);
|
|
66
71
|
}
|
|
@@ -79,15 +84,20 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
79
84
|
role: "switch",
|
|
80
85
|
"aria-checked": checked,
|
|
81
86
|
"aria-disabled": disabled,
|
|
82
|
-
"aria-
|
|
87
|
+
"aria-labelledby": labelledby,
|
|
88
|
+
"aria-label": labelledby ? undefined : label,
|
|
83
89
|
"aria-busy": loading || undefined
|
|
84
90
|
})), /*#__PURE__*/React.createElement(Component, {
|
|
85
91
|
className: prefix('presentation')
|
|
86
92
|
}, /*#__PURE__*/React.createElement("span", {
|
|
87
|
-
className: prefix('inner')
|
|
93
|
+
className: prefix('inner'),
|
|
94
|
+
id: innerId
|
|
88
95
|
}, inner), loading && /*#__PURE__*/React.createElement(Loader, {
|
|
89
96
|
className: prefix('loader')
|
|
90
|
-
}))
|
|
97
|
+
})), children && /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
className: prefix('label'),
|
|
99
|
+
id: labelId
|
|
100
|
+
}, children));
|
|
91
101
|
});
|
|
92
102
|
Toggle.displayName = 'Toggle';
|
|
93
103
|
Toggle.propTypes = {
|
|
@@ -101,6 +111,7 @@ Toggle.propTypes = {
|
|
|
101
111
|
loading: PropTypes.bool,
|
|
102
112
|
classPrefix: PropTypes.string,
|
|
103
113
|
className: PropTypes.string,
|
|
114
|
+
children: PropTypes.node,
|
|
104
115
|
onChange: PropTypes.func,
|
|
105
116
|
as: PropTypes.elementType,
|
|
106
117
|
size: oneOf(['sm', 'md', 'lg']),
|
package/esm/Toggle/index.js
CHANGED
|
File without changes
|
package/esm/Tooltip/index.js
CHANGED
|
File without changes
|
package/esm/Tree/index.js
CHANGED
|
File without changes
|
package/esm/TreePicker/index.js
CHANGED
|
File without changes
|
package/esm/Uploader/index.js
CHANGED
|
File without changes
|
package/esm/Whisper/index.js
CHANGED
|
File without changes
|
package/esm/index.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ export type { CustomProviderProps } from './CustomProvider';
|
|
|
180
180
|
export type { Locale, CalendarLocale, PlaintextLocale, PaginationLocale, TableLocale, DatePickerLocale, DateRangePickerLocale, PickerLocale, InputPickerLocale, UploaderLocale, BreadcrumbLocale, ToggleLocale } from './locales';
|
|
181
181
|
export type { PickerHandle } from './internals/Picker';
|
|
182
182
|
export { default as useMediaQuery } from './useMediaQuery';
|
|
183
|
+
export { default as useBreakpointValue } from './useBreakpointValue';
|
|
183
184
|
export { default as VisuallyHidden } from './VisuallyHidden';
|
|
184
185
|
export type { VisuallyHiddenProps } from './VisuallyHidden';
|
|
185
186
|
export { default as Tabs } from './Tabs';
|
package/esm/index.js
CHANGED
|
@@ -105,14 +105,17 @@ export { default as Sidebar } from "./Sidebar/index.js";
|
|
|
105
105
|
export { default as Footer } from "./Footer/index.js";
|
|
106
106
|
export { default as Divider } from "./Divider/index.js";
|
|
107
107
|
export { default as Stack } from "./Stack/index.js";
|
|
108
|
-
// Utils
|
|
108
|
+
// Utils
|
|
109
109
|
// --------------------------------------------------------
|
|
110
110
|
export { default as Schema } from "./Schema/index.js";
|
|
111
111
|
export { default as Animation } from "./Animation/index.js";
|
|
112
112
|
export { default as DOMHelper } from "./DOMHelper/index.js";
|
|
113
113
|
export { default as Affix } from "./Affix/index.js";
|
|
114
114
|
export { default as CustomProvider } from "./CustomProvider/index.js";
|
|
115
|
+
// Hooks
|
|
116
|
+
|
|
115
117
|
export { default as useMediaQuery } from "./useMediaQuery/index.js";
|
|
118
|
+
export { default as useBreakpointValue } from "./useBreakpointValue/index.js";
|
|
116
119
|
|
|
117
120
|
// Disclosure
|
|
118
121
|
// --------------------------------------------------------
|
package/esm/locales/en_GB.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Query } from '../useMediaQuery';
|
|
2
|
+
interface UseBreakpointValueOptions<T = any> {
|
|
3
|
+
/**
|
|
4
|
+
* The default value to return if no screen size matches.
|
|
5
|
+
*/
|
|
6
|
+
defaultValue: T;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A React Hook that returns different values based on different screen sizes in responsive design.
|
|
10
|
+
* @version 5.63.0
|
|
11
|
+
* @unstable Please note that this API is not stable and may change in the future.
|
|
12
|
+
* @see https://rsuitejs.com/components/use-breakpoint-value
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const fontSize = useBreakpointValue({ sm: "14px", lg: "24px" }, { defaultValue: "16px" });
|
|
17
|
+
* const direction = useBreakpointValue({ sm: 'row' }, { defaultValue:'column' });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare function useBreakpointValue<T = any>(breakpoints: Record<Query, T>, options?: UseBreakpointValueOptions<T>): T | undefined;
|
|
22
|
+
export default useBreakpointValue;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import useMediaQuery from "../useMediaQuery/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* A React Hook that returns different values based on different screen sizes in responsive design.
|
|
5
|
+
* @version 5.63.0
|
|
6
|
+
* @unstable Please note that this API is not stable and may change in the future.
|
|
7
|
+
* @see https://rsuitejs.com/components/use-breakpoint-value
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const fontSize = useBreakpointValue({ sm: "14px", lg: "24px" }, { defaultValue: "16px" });
|
|
12
|
+
* const direction = useBreakpointValue({ sm: 'row' }, { defaultValue:'column' });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export function useBreakpointValue(breakpoints, options) {
|
|
17
|
+
var _ref = options || {},
|
|
18
|
+
defaultValue = _ref.defaultValue;
|
|
19
|
+
var keys = Object.keys(breakpoints);
|
|
20
|
+
var values = Object.values(breakpoints);
|
|
21
|
+
var matches = useMediaQuery(keys);
|
|
22
|
+
var index = matches.indexOf(true);
|
|
23
|
+
return index !== -1 ? values[index] : defaultValue;
|
|
24
|
+
}
|
|
25
|
+
export default useBreakpointValue;
|
|
@@ -6,18 +6,21 @@ export declare const mediaQuerySizeMap: {
|
|
|
6
6
|
xl: string;
|
|
7
7
|
xxl: string;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* The type of the query parameter.
|
|
11
|
+
*/
|
|
12
|
+
export type Query = string | keyof typeof mediaQuerySizeMap;
|
|
9
13
|
/**
|
|
10
14
|
* React hook that tracks state of a CSS media query.
|
|
11
|
-
* @deprecated Use useMediaQuery instead.
|
|
12
|
-
*
|
|
13
15
|
* @see https://rsuitejs.com/components/use-media-query
|
|
14
16
|
*/
|
|
15
|
-
export declare function
|
|
17
|
+
export declare function useMediaQueryOld(query: Query | Query[]): boolean[];
|
|
16
18
|
/**
|
|
17
19
|
* React hook that tracks state of a CSS media query
|
|
18
20
|
* @version 5.48.0
|
|
21
|
+
* @unstable Please note that this API is not stable and may change in the future.
|
|
19
22
|
* @see https://rsuitejs.com/components/use-media-query
|
|
20
23
|
*/
|
|
21
|
-
export declare function useMediaQuery(query:
|
|
24
|
+
export declare function useMediaQuery(query: Query | Query[]): boolean[];
|
|
22
25
|
declare const _default: typeof useMediaQuery;
|
|
23
26
|
export default _default;
|
|
@@ -11,6 +11,11 @@ export var mediaQuerySizeMap = {
|
|
|
11
11
|
xl: '(min-width: 1200px)',
|
|
12
12
|
xxl: '(min-width: 1400px)'
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The type of the query parameter.
|
|
17
|
+
*/
|
|
18
|
+
|
|
14
19
|
var matchMedia = function matchMedia(query) {
|
|
15
20
|
if (canUseDOM) {
|
|
16
21
|
return window.matchMedia(query);
|
|
@@ -23,11 +28,9 @@ var matchMedia = function matchMedia(query) {
|
|
|
23
28
|
|
|
24
29
|
/**
|
|
25
30
|
* React hook that tracks state of a CSS media query.
|
|
26
|
-
* @deprecated Use useMediaQuery instead.
|
|
27
|
-
*
|
|
28
31
|
* @see https://rsuitejs.com/components/use-media-query
|
|
29
32
|
*/
|
|
30
|
-
export function
|
|
33
|
+
export function useMediaQueryOld(query) {
|
|
31
34
|
var queries = Array.isArray(query) ? query : [query];
|
|
32
35
|
var mediaQueries = queries.map(function (query) {
|
|
33
36
|
return mediaQuerySizeMap[query] || query;
|
|
@@ -69,6 +72,7 @@ export function useMediaQueryLegacy(query) {
|
|
|
69
72
|
/**
|
|
70
73
|
* React hook that tracks state of a CSS media query
|
|
71
74
|
* @version 5.48.0
|
|
75
|
+
* @unstable Please note that this API is not stable and may change in the future.
|
|
72
76
|
* @see https://rsuitejs.com/components/use-media-query
|
|
73
77
|
*/
|
|
74
78
|
export function useMediaQuery(query) {
|
|
@@ -89,7 +93,10 @@ export function useMediaQuery(query) {
|
|
|
89
93
|
return item.media === event.media;
|
|
90
94
|
});
|
|
91
95
|
if (index !== -1) {
|
|
92
|
-
|
|
96
|
+
// The store snapshot returned by getSnapshot must be immutable. So we need to create a new array.
|
|
97
|
+
var nextMediaQueryArray = mediaQueryArray.current.slice();
|
|
98
|
+
nextMediaQueryArray[index] = event.matches;
|
|
99
|
+
mediaQueryArray.current = nextMediaQueryArray;
|
|
93
100
|
}
|
|
94
101
|
callback();
|
|
95
102
|
};
|
|
@@ -102,12 +109,12 @@ export function useMediaQuery(query) {
|
|
|
102
109
|
});
|
|
103
110
|
};
|
|
104
111
|
}, [mediaQueries]);
|
|
105
|
-
var getSnapshot = function
|
|
112
|
+
var getSnapshot = useCallback(function () {
|
|
106
113
|
return mediaQueryArray.current;
|
|
107
|
-
};
|
|
108
|
-
var getServerSnapshot = function
|
|
109
|
-
|
|
110
|
-
};
|
|
114
|
+
}, []);
|
|
115
|
+
var getServerSnapshot = useCallback(function () {
|
|
116
|
+
return mediaQueryArray.current;
|
|
117
|
+
}, []);
|
|
111
118
|
return (_React$useSyncExterna = React['useSyncExternalStore']) === null || _React$useSyncExterna === void 0 ? void 0 : _React$useSyncExterna.call(React, subscribe, getSnapshot, getServerSnapshot);
|
|
112
119
|
}
|
|
113
|
-
export default typeof React['useSyncExternalStore'] === 'function' ? useMediaQuery :
|
|
120
|
+
export default typeof React['useSyncExternalStore'] === 'function' ? useMediaQuery : useMediaQueryOld;
|
package/package.json
CHANGED
package/styles/color-modes.less
CHANGED
|
File without changes
|
package/styles/colors/dark.less
CHANGED
|
File without changes
|
|
File without changes
|
package/styles/colors/light.less
CHANGED
|
File without changes
|
package/styles/common.less
CHANGED
|
File without changes
|
|
File without changes
|
package/styles/mixins/hacks.less
CHANGED
|
File without changes
|
package/styles/mixins/menu.less
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/styles/scaffolding.less
CHANGED
|
File without changes
|
package/styles/typography.less
CHANGED
|
File without changes
|
|
File without changes
|