rsuite 5.0.0-beta.7 → 5.0.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/CHANGELOG.md +52 -0
- package/DatePicker/styles/index.less +6 -2
- package/Grid/styles/index.less +1 -2
- package/IconButton/styles/index.less +1 -1
- package/MultiCascader/styles/index.less +3 -0
- package/README.md +17 -11
- package/Sidenav/styles/index.less +99 -37
- package/Table/styles/index.less +8 -0
- package/Uploader/styles/index.less +10 -0
- package/cjs/@types/common.d.ts +2 -1
- package/cjs/Animation/Collapse.js +8 -8
- package/cjs/AutoComplete/AutoComplete.js +10 -14
- package/cjs/Badge/Badge.js +6 -10
- package/cjs/Breadcrumb/Breadcrumb.js +8 -12
- package/cjs/Breadcrumb/BreadcrumbItem.js +4 -8
- package/cjs/Button/Button.js +6 -10
- package/cjs/ButtonGroup/ButtonGroup.js +6 -10
- package/cjs/Calendar/Calendar.js +4 -8
- package/cjs/Calendar/CalendarPanel.js +6 -10
- package/cjs/Calendar/Header.js +4 -8
- package/cjs/Calendar/MonthDropdown.js +10 -14
- package/cjs/Calendar/MonthDropdownItem.js +6 -10
- package/cjs/Calendar/Table.js +6 -10
- package/cjs/Calendar/TableHeaderRow.js +4 -7
- package/cjs/Calendar/TableRow.js +7 -11
- package/cjs/Calendar/TimeDropdown.js +4 -8
- package/cjs/Calendar/View.js +4 -8
- package/cjs/Carousel/Carousel.js +10 -14
- package/cjs/Cascader/Cascader.js +28 -26
- package/cjs/Cascader/DropdownMenu.js +19 -21
- package/cjs/CheckPicker/CheckPicker.js +33 -29
- package/cjs/CheckTreePicker/CheckTreeNode.js +4 -6
- package/cjs/CheckTreePicker/CheckTreePicker.js +47 -35
- package/cjs/Checkbox/Checkbox.js +8 -13
- package/cjs/CheckboxGroup/CheckboxGroup.d.ts +1 -12
- package/cjs/CheckboxGroup/CheckboxGroup.js +7 -13
- package/cjs/CheckboxGroup/CheckboxGroupContext.d.ts +13 -0
- package/cjs/CheckboxGroup/CheckboxGroupContext.js +12 -0
- package/cjs/CheckboxGroup/index.d.ts +4 -3
- package/cjs/CheckboxGroup/index.js +6 -4
- package/cjs/Col/Col.js +3 -2
- package/cjs/Container/Container.js +4 -7
- package/cjs/DatePicker/DatePicker.js +23 -20
- package/cjs/DatePicker/Toolbar.js +4 -8
- package/cjs/DateRangePicker/Calendar.d.ts +2 -1
- package/cjs/DateRangePicker/Calendar.js +15 -16
- package/cjs/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/cjs/DateRangePicker/DateRangePicker.js +93 -73
- package/cjs/DateRangePicker/utils.d.ts +1 -1
- package/cjs/DateRangePicker/utils.js +9 -5
- package/cjs/Divider/Divider.js +4 -8
- package/cjs/Drawer/Drawer.js +8 -10
- package/cjs/Dropdown/Dropdown.js +39 -30
- package/cjs/Dropdown/DropdownContext.d.ts +4 -1
- package/cjs/Dropdown/DropdownItem.js +35 -12
- package/cjs/Dropdown/DropdownMenu.js +2 -6
- package/cjs/Dropdown/DropdownState.d.ts +37 -0
- package/cjs/Dropdown/DropdownState.js +66 -0
- package/cjs/Dropdown/DropdownToggle.js +4 -8
- package/cjs/FlexboxGrid/FlexboxGrid.js +8 -12
- package/cjs/FlexboxGrid/FlexboxGridItem.js +8 -12
- package/cjs/Form/Form.js +12 -16
- package/cjs/IconButton/IconButton.js +4 -8
- package/cjs/Input/Input.js +6 -10
- package/cjs/InputNumber/InputNumber.js +14 -18
- package/cjs/InputPicker/InputAutosize.js +2 -4
- package/cjs/InputPicker/InputPicker.js +32 -30
- package/cjs/List/List.js +12 -16
- package/cjs/List/ListItem.js +6 -10
- package/cjs/Loader/Loader.js +6 -10
- package/cjs/Menu/Menu.d.ts +0 -1
- package/cjs/Menu/Menu.js +3 -5
- package/cjs/Menu/MenuItem.js +1 -1
- package/cjs/Message/Message.js +8 -12
- package/cjs/Modal/Modal.d.ts +1 -10
- package/cjs/Modal/Modal.js +35 -27
- package/cjs/Modal/ModalBody.js +6 -10
- package/cjs/Modal/ModalContext.d.ts +12 -0
- package/cjs/Modal/ModalContext.js +12 -0
- package/cjs/Modal/ModalDialog.js +8 -8
- package/cjs/Modal/ModalHeader.js +8 -12
- package/cjs/Modal/ModalTitle.d.ts +3 -2
- package/cjs/Modal/ModalTitle.js +43 -4
- package/cjs/MultiCascader/DropdownMenu.js +21 -23
- package/cjs/MultiCascader/MultiCascader.js +34 -32
- package/cjs/Nav/Nav.js +6 -10
- package/cjs/Navbar/Navbar.js +6 -9
- package/cjs/Notification/Notification.js +6 -10
- package/cjs/Overlay/Modal.js +11 -18
- package/cjs/Overlay/Overlay.js +2 -5
- package/cjs/Overlay/OverlayTrigger.js +9 -9
- package/cjs/Overlay/Position.js +4 -8
- package/cjs/Pagination/Pagination.js +10 -13
- package/cjs/Pagination/PaginationButton.js +4 -8
- package/cjs/Pagination/PaginationGroup.js +11 -12
- package/cjs/Panel/Panel.js +6 -10
- package/cjs/PanelGroup/PanelGroup.js +4 -8
- package/cjs/Picker/DropdownMenu.js +2 -3
- package/cjs/Picker/DropdownMenuGroup.js +4 -8
- package/cjs/Picker/DropdownMenuItem.js +4 -8
- package/cjs/Picker/PickerToggle.js +7 -9
- package/cjs/Picker/propTypes.d.ts +2 -16
- package/cjs/Picker/propTypes.js +4 -17
- package/cjs/Picker/utils.js +13 -8
- package/cjs/Placeholder/PlaceholderGraph.js +6 -10
- package/cjs/Placeholder/PlaceholderGrid.js +12 -16
- package/cjs/Placeholder/PlaceholderParagraph.js +10 -14
- package/cjs/Popover/Popover.js +4 -8
- package/cjs/Progress/ProgressCircle.js +18 -22
- package/cjs/Progress/ProgressLine.js +8 -12
- package/cjs/Radio/Radio.js +6 -11
- package/cjs/RadioGroup/RadioGroup.js +6 -9
- package/cjs/RangeSlider/RangeSlider.js +17 -20
- package/cjs/Rate/Character.js +4 -7
- package/cjs/Rate/Rate.js +14 -18
- package/cjs/Ripple/Ripple.js +4 -8
- package/cjs/SelectPicker/SelectPicker.d.ts +1 -3
- package/cjs/SelectPicker/SelectPicker.js +31 -28
- package/cjs/Sidebar/Sidebar.js +6 -10
- package/cjs/Sidenav/Sidenav.js +8 -11
- package/cjs/Sidenav/SidenavDropdown.d.ts +6 -1
- package/cjs/Sidenav/SidenavDropdown.js +25 -20
- package/cjs/Sidenav/SidenavDropdownCollapse.js +2 -6
- package/cjs/Sidenav/SidenavDropdownItem.js +4 -8
- package/cjs/Sidenav/SidenavDropdownMenu.js +4 -8
- package/cjs/Sidenav/SidenavItem.js +4 -12
- package/cjs/Sidenav/SidenavToggle.js +4 -8
- package/cjs/Slider/Graduated.js +4 -8
- package/cjs/Slider/Handle.d.ts +2 -0
- package/cjs/Slider/Handle.js +23 -12
- package/cjs/Slider/Input.d.ts +3 -0
- package/cjs/Slider/Input.js +35 -0
- package/cjs/Slider/Mark.js +4 -8
- package/cjs/Slider/ProgressBar.js +4 -8
- package/cjs/Slider/Slider.d.ts +0 -3
- package/cjs/Slider/Slider.js +14 -22
- package/cjs/Steps/StepItem.js +4 -7
- package/cjs/Steps/Steps.js +8 -12
- package/cjs/Table/Table.d.ts +7 -7
- package/cjs/Table/Table.js +5 -5
- package/cjs/TagInput/index.js +4 -6
- package/cjs/TagPicker/index.d.ts +1 -1
- package/cjs/TagPicker/index.js +4 -6
- package/cjs/Timeline/Timeline.js +6 -11
- package/cjs/Timeline/TimelineItem.js +4 -8
- package/cjs/Toggle/Toggle.js +4 -8
- package/cjs/Tooltip/Tooltip.js +4 -8
- package/cjs/Tree/Tree.d.ts +6 -0
- package/cjs/TreePicker/TreeNode.js +4 -6
- package/cjs/TreePicker/TreePicker.js +38 -29
- package/cjs/Uploader/UploadFileItem.d.ts +2 -0
- package/cjs/Uploader/UploadFileItem.js +47 -35
- package/cjs/Uploader/UploadTrigger.js +4 -8
- package/cjs/Uploader/Uploader.d.ts +2 -0
- package/cjs/Uploader/Uploader.js +28 -29
- package/cjs/toaster/ToastContainer.js +6 -10
- package/cjs/utils/createComponent.d.ts +1 -2
- package/cjs/utils/createComponent.js +10 -13
- package/cjs/utils/dateUtils.d.ts +1 -0
- package/cjs/utils/dateUtils.js +5 -1
- package/cjs/utils/previewFile.d.ts +1 -0
- package/cjs/utils/previewFile.js +11 -0
- package/cjs/utils/useInternalId.d.ts +4 -0
- package/cjs/utils/useInternalId.js +24 -0
- package/cjs/utils/useUniqueId.d.ts +4 -2
- package/cjs/utils/useUniqueId.js +5 -3
- package/dist/rsuite-rtl.css +164 -75
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +164 -75
- package/dist/rsuite.js +377 -377
- 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/@types/common.d.ts +2 -1
- package/esm/Animation/Collapse.js +8 -8
- package/esm/AutoComplete/AutoComplete.js +11 -14
- package/esm/Badge/Badge.js +6 -9
- package/esm/Breadcrumb/Breadcrumb.js +8 -11
- package/esm/Breadcrumb/BreadcrumbItem.js +4 -7
- package/esm/Button/Button.js +6 -9
- package/esm/ButtonGroup/ButtonGroup.js +6 -9
- package/esm/Calendar/Calendar.js +4 -7
- package/esm/Calendar/CalendarPanel.js +6 -9
- package/esm/Calendar/Header.js +4 -7
- package/esm/Calendar/MonthDropdown.js +10 -13
- package/esm/Calendar/MonthDropdownItem.js +6 -9
- package/esm/Calendar/Table.js +6 -9
- package/esm/Calendar/TableHeaderRow.js +4 -7
- package/esm/Calendar/TableRow.js +7 -10
- package/esm/Calendar/TimeDropdown.js +4 -7
- package/esm/Calendar/View.js +4 -7
- package/esm/Carousel/Carousel.js +10 -13
- package/esm/Cascader/Cascader.js +28 -26
- package/esm/Cascader/DropdownMenu.js +19 -21
- package/esm/CheckPicker/CheckPicker.js +33 -29
- package/esm/CheckTreePicker/CheckTreeNode.js +4 -6
- package/esm/CheckTreePicker/CheckTreePicker.js +47 -37
- package/esm/Checkbox/Checkbox.js +8 -12
- package/esm/CheckboxGroup/CheckboxGroup.d.ts +1 -12
- package/esm/CheckboxGroup/CheckboxGroup.js +5 -8
- package/esm/CheckboxGroup/CheckboxGroupContext.d.ts +13 -0
- package/esm/CheckboxGroup/CheckboxGroupContext.js +2 -0
- package/esm/CheckboxGroup/index.d.ts +4 -3
- package/esm/CheckboxGroup/index.js +2 -2
- package/esm/Col/Col.js +3 -2
- package/esm/Container/Container.js +4 -7
- package/esm/DatePicker/DatePicker.js +23 -21
- package/esm/DatePicker/Toolbar.js +5 -8
- package/esm/DateRangePicker/Calendar.d.ts +2 -1
- package/esm/DateRangePicker/Calendar.js +15 -15
- package/esm/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/esm/DateRangePicker/DateRangePicker.js +62 -43
- package/esm/DateRangePicker/utils.d.ts +1 -1
- package/esm/DateRangePicker/utils.js +7 -3
- package/esm/Divider/Divider.js +4 -7
- package/esm/Drawer/Drawer.js +8 -9
- package/esm/Dropdown/Dropdown.js +39 -31
- package/esm/Dropdown/DropdownContext.d.ts +4 -1
- package/esm/Dropdown/DropdownItem.js +35 -14
- package/esm/Dropdown/DropdownMenu.js +3 -6
- package/esm/Dropdown/DropdownState.d.ts +37 -0
- package/esm/Dropdown/DropdownState.js +55 -0
- package/esm/Dropdown/DropdownToggle.js +4 -7
- package/esm/FlexboxGrid/FlexboxGrid.js +8 -11
- package/esm/FlexboxGrid/FlexboxGridItem.js +8 -11
- package/esm/Form/Form.js +12 -15
- package/esm/IconButton/IconButton.js +4 -7
- package/esm/Input/Input.js +6 -9
- package/esm/InputNumber/InputNumber.js +14 -17
- package/esm/InputPicker/InputAutosize.js +2 -4
- package/esm/InputPicker/InputPicker.js +32 -30
- package/esm/List/List.js +12 -15
- package/esm/List/ListItem.js +6 -9
- package/esm/Loader/Loader.js +6 -9
- package/esm/Menu/Menu.d.ts +0 -1
- package/esm/Menu/Menu.js +3 -5
- package/esm/Menu/MenuItem.js +1 -1
- package/esm/Message/Message.js +8 -11
- package/esm/Modal/Modal.d.ts +1 -10
- package/esm/Modal/Modal.js +31 -21
- package/esm/Modal/ModalBody.js +5 -8
- package/esm/Modal/ModalContext.d.ts +12 -0
- package/esm/Modal/ModalContext.js +2 -0
- package/esm/Modal/ModalDialog.js +8 -8
- package/esm/Modal/ModalHeader.js +7 -10
- package/esm/Modal/ModalTitle.d.ts +3 -2
- package/esm/Modal/ModalTitle.js +35 -4
- package/esm/MultiCascader/DropdownMenu.js +21 -23
- package/esm/MultiCascader/MultiCascader.js +34 -32
- package/esm/Nav/Nav.js +6 -9
- package/esm/Navbar/Navbar.js +6 -9
- package/esm/Notification/Notification.js +6 -9
- package/esm/Overlay/Modal.js +11 -18
- package/esm/Overlay/Overlay.js +2 -5
- package/esm/Overlay/OverlayTrigger.js +9 -9
- package/esm/Overlay/Position.js +4 -7
- package/esm/Pagination/Pagination.js +10 -13
- package/esm/Pagination/PaginationButton.js +4 -7
- package/esm/Pagination/PaginationGroup.js +10 -11
- package/esm/Panel/Panel.js +6 -9
- package/esm/PanelGroup/PanelGroup.js +4 -7
- package/esm/Picker/DropdownMenu.js +2 -3
- package/esm/Picker/DropdownMenuGroup.js +4 -7
- package/esm/Picker/DropdownMenuItem.js +4 -7
- package/esm/Picker/PickerToggle.js +7 -9
- package/esm/Picker/propTypes.d.ts +2 -16
- package/esm/Picker/propTypes.js +2 -13
- package/esm/Picker/utils.js +13 -8
- package/esm/Placeholder/PlaceholderGraph.js +6 -9
- package/esm/Placeholder/PlaceholderGrid.js +12 -15
- package/esm/Placeholder/PlaceholderParagraph.js +10 -13
- package/esm/Popover/Popover.js +4 -7
- package/esm/Progress/ProgressCircle.js +18 -21
- package/esm/Progress/ProgressLine.js +8 -11
- package/esm/Radio/Radio.js +6 -10
- package/esm/RadioGroup/RadioGroup.js +6 -9
- package/esm/RangeSlider/RangeSlider.js +17 -20
- package/esm/Rate/Character.js +4 -7
- package/esm/Rate/Rate.js +14 -17
- package/esm/Ripple/Ripple.js +4 -7
- package/esm/SelectPicker/SelectPicker.d.ts +1 -3
- package/esm/SelectPicker/SelectPicker.js +31 -28
- package/esm/Sidebar/Sidebar.js +6 -9
- package/esm/Sidenav/Sidenav.js +8 -11
- package/esm/Sidenav/SidenavDropdown.d.ts +6 -1
- package/esm/Sidenav/SidenavDropdown.js +24 -19
- package/esm/Sidenav/SidenavDropdownCollapse.js +2 -5
- package/esm/Sidenav/SidenavDropdownItem.js +5 -8
- package/esm/Sidenav/SidenavDropdownMenu.js +5 -8
- package/esm/Sidenav/SidenavItem.js +4 -10
- package/esm/Sidenav/SidenavToggle.js +4 -7
- package/esm/Slider/Graduated.js +4 -7
- package/esm/Slider/Handle.d.ts +2 -0
- package/esm/Slider/Handle.js +23 -12
- package/esm/Slider/Input.d.ts +3 -0
- package/esm/Slider/Input.js +23 -0
- package/esm/Slider/Mark.js +4 -7
- package/esm/Slider/ProgressBar.js +4 -7
- package/esm/Slider/Slider.d.ts +0 -3
- package/esm/Slider/Slider.js +14 -22
- package/esm/Steps/StepItem.js +4 -7
- package/esm/Steps/Steps.js +8 -11
- package/esm/Table/Table.d.ts +7 -7
- package/esm/Table/Table.js +5 -5
- package/esm/TagInput/index.js +4 -6
- package/esm/TagPicker/index.d.ts +1 -1
- package/esm/TagPicker/index.js +4 -6
- package/esm/Timeline/Timeline.js +6 -10
- package/esm/Timeline/TimelineItem.js +4 -7
- package/esm/Toggle/Toggle.js +5 -8
- package/esm/Tooltip/Tooltip.js +4 -7
- package/esm/Tree/Tree.d.ts +6 -0
- package/esm/TreePicker/TreeNode.js +4 -6
- package/esm/TreePicker/TreePicker.js +38 -31
- package/esm/Uploader/UploadFileItem.d.ts +2 -0
- package/esm/Uploader/UploadFileItem.js +47 -35
- package/esm/Uploader/UploadTrigger.js +4 -7
- package/esm/Uploader/Uploader.d.ts +2 -0
- package/esm/Uploader/Uploader.js +28 -28
- package/esm/toaster/ToastContainer.js +6 -9
- package/esm/utils/createComponent.d.ts +1 -2
- package/esm/utils/createComponent.js +10 -13
- package/esm/utils/dateUtils.d.ts +1 -0
- package/esm/utils/dateUtils.js +1 -0
- package/esm/utils/previewFile.d.ts +1 -0
- package/esm/utils/previewFile.js +9 -0
- package/esm/utils/useInternalId.d.ts +4 -0
- package/esm/utils/useInternalId.js +16 -0
- package/esm/utils/useUniqueId.d.ts +4 -2
- package/esm/utils/useUniqueId.js +5 -3
- package/package.json +4 -4
- package/styles/color-modes/dark.less +16 -0
- package/styles/color-modes/high-contrast.less +17 -0
- package/styles/color-modes/light.less +16 -0
- package/styles/variables.less +3 -1
|
@@ -75,19 +75,12 @@ function disableMinValue(value, min) {
|
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
var defaultProps = {
|
|
79
|
-
as: InputGroup,
|
|
80
|
-
classPrefix: 'input-number',
|
|
81
|
-
min: -Infinity,
|
|
82
|
-
max: Infinity,
|
|
83
|
-
step: 1,
|
|
84
|
-
buttonAppearance: 'subtle',
|
|
85
|
-
scrollable: true
|
|
86
|
-
};
|
|
87
78
|
var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
88
|
-
var
|
|
79
|
+
var _props$as = props.as,
|
|
80
|
+
Component = _props$as === void 0 ? InputGroup : _props$as,
|
|
89
81
|
className = props.className,
|
|
90
|
-
classPrefix = props.classPrefix,
|
|
82
|
+
_props$classPrefix = props.classPrefix,
|
|
83
|
+
classPrefix = _props$classPrefix === void 0 ? 'input-number' : _props$classPrefix,
|
|
91
84
|
disabled = props.disabled,
|
|
92
85
|
readOnly = props.readOnly,
|
|
93
86
|
plaintext = props.plaintext,
|
|
@@ -96,11 +89,16 @@ var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
96
89
|
size = props.size,
|
|
97
90
|
prefixElement = props.prefix,
|
|
98
91
|
postfix = props.postfix,
|
|
99
|
-
step = props.step,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
_props$step = props.step,
|
|
93
|
+
step = _props$step === void 0 ? 1 : _props$step,
|
|
94
|
+
_props$buttonAppearan = props.buttonAppearance,
|
|
95
|
+
buttonAppearance = _props$buttonAppearan === void 0 ? 'subtle' : _props$buttonAppearan,
|
|
96
|
+
_props$min = props.min,
|
|
97
|
+
min = _props$min === void 0 ? -Infinity : _props$min,
|
|
98
|
+
_props$max = props.max,
|
|
99
|
+
max = _props$max === void 0 ? Infinity : _props$max,
|
|
100
|
+
_props$scrollable = props.scrollable,
|
|
101
|
+
scrollable = _props$scrollable === void 0 ? true : _props$scrollable,
|
|
104
102
|
onChange = props.onChange,
|
|
105
103
|
onWheel = props.onWheel,
|
|
106
104
|
restProps = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "disabled", "readOnly", "plaintext", "value", "defaultValue", "size", "prefix", "postfix", "step", "buttonAppearance", "min", "max", "scrollable", "onChange", "onWheel"]);
|
|
@@ -246,7 +244,6 @@ var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
246
244
|
}, /*#__PURE__*/React.createElement(AngleDownIcon, null))), postfix && /*#__PURE__*/React.createElement(InputGroupAddon, null, postfix));
|
|
247
245
|
});
|
|
248
246
|
InputNumber.displayName = 'InputNumber';
|
|
249
|
-
InputNumber.defaultProps = defaultProps;
|
|
250
247
|
InputNumber.propTypes = {
|
|
251
248
|
className: PropTypes.string,
|
|
252
249
|
classPrefix: PropTypes.string,
|
|
@@ -29,7 +29,8 @@ var copyStyles = function copyStyles(styles, node) {
|
|
|
29
29
|
* @param placeholderRef
|
|
30
30
|
*/
|
|
31
31
|
var useInputWidth = function useInputWidth(props, sizerRef, placeholderRef) {
|
|
32
|
-
var minWidth = props.minWidth,
|
|
32
|
+
var _props$minWidth = props.minWidth,
|
|
33
|
+
minWidth = _props$minWidth === void 0 ? 1 : _props$minWidth,
|
|
33
34
|
placeholder = props.placeholder,
|
|
34
35
|
value = props.value,
|
|
35
36
|
onAutosize = props.onAutosize;
|
|
@@ -170,7 +171,4 @@ InputAutosize.propTypes = {
|
|
|
170
171
|
value: PropTypes.any,
|
|
171
172
|
onAutosize: PropTypes.func
|
|
172
173
|
};
|
|
173
|
-
InputAutosize.defaultProps = {
|
|
174
|
-
minWidth: 1
|
|
175
|
-
};
|
|
176
174
|
export default InputAutosize;
|
|
@@ -24,51 +24,49 @@ import Tag from '../Tag';
|
|
|
24
24
|
import InputAutosize from './InputAutosize';
|
|
25
25
|
import InputSearch from './InputSearch';
|
|
26
26
|
export var InputPickerContext = /*#__PURE__*/React.createContext({});
|
|
27
|
-
var defaultProps = {
|
|
28
|
-
as: 'div',
|
|
29
|
-
appearance: 'default',
|
|
30
|
-
cleanable: true,
|
|
31
|
-
cacheData: [],
|
|
32
|
-
classPrefix: 'picker',
|
|
33
|
-
data: [],
|
|
34
|
-
disabledItemValues: [],
|
|
35
|
-
valueKey: 'value',
|
|
36
|
-
labelKey: 'label',
|
|
37
|
-
placement: 'bottomStart',
|
|
38
|
-
searchable: true,
|
|
39
|
-
menuAutoWidth: true,
|
|
40
|
-
menuMaxHeight: 320
|
|
41
|
-
};
|
|
42
27
|
var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
43
28
|
var _merge;
|
|
44
29
|
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
var _props$as = props.as,
|
|
31
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
32
|
+
_props$appearance = props.appearance,
|
|
33
|
+
appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
|
|
34
|
+
_props$cleanable = props.cleanable,
|
|
35
|
+
cleanable = _props$cleanable === void 0 ? true : _props$cleanable,
|
|
36
|
+
_props$cacheData = props.cacheData,
|
|
37
|
+
cacheData = _props$cacheData === void 0 ? [] : _props$cacheData,
|
|
38
|
+
_props$classPrefix = props.classPrefix,
|
|
39
|
+
classPrefix = _props$classPrefix === void 0 ? 'picker' : _props$classPrefix,
|
|
40
|
+
_props$data = props.data,
|
|
41
|
+
controlledData = _props$data === void 0 ? [] : _props$data,
|
|
50
42
|
disabled = props.disabled,
|
|
51
43
|
readOnly = props.readOnly,
|
|
52
44
|
plaintext = props.plaintext,
|
|
53
45
|
defaultValue = props.defaultValue,
|
|
54
46
|
defaultOpen = props.defaultOpen,
|
|
55
|
-
|
|
47
|
+
_props$disabledItemVa = props.disabledItemValues,
|
|
48
|
+
disabledItemValues = _props$disabledItemVa === void 0 ? [] : _props$disabledItemVa,
|
|
56
49
|
overrideLocale = props.locale,
|
|
57
50
|
toggleAs = props.toggleAs,
|
|
58
51
|
style = props.style,
|
|
59
|
-
searchable = props.searchable,
|
|
52
|
+
_props$searchable = props.searchable,
|
|
53
|
+
searchable = _props$searchable === void 0 ? true : _props$searchable,
|
|
60
54
|
controlledOpen = props.open,
|
|
61
55
|
placeholder = props.placeholder,
|
|
62
56
|
groupBy = props.groupBy,
|
|
63
57
|
menuClassName = props.menuClassName,
|
|
64
58
|
menuStyle = props.menuStyle,
|
|
65
|
-
menuAutoWidth = props.menuAutoWidth,
|
|
66
|
-
|
|
59
|
+
_props$menuAutoWidth = props.menuAutoWidth,
|
|
60
|
+
menuAutoWidth = _props$menuAutoWidth === void 0 ? true : _props$menuAutoWidth,
|
|
61
|
+
_props$menuMaxHeight = props.menuMaxHeight,
|
|
62
|
+
menuMaxHeight = _props$menuMaxHeight === void 0 ? 320 : _props$menuMaxHeight,
|
|
67
63
|
creatable = props.creatable,
|
|
68
64
|
valueProp = props.value,
|
|
69
|
-
valueKey = props.valueKey,
|
|
65
|
+
_props$valueKey = props.valueKey,
|
|
66
|
+
valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
|
|
70
67
|
virtualized = props.virtualized,
|
|
71
|
-
labelKey = props.labelKey,
|
|
68
|
+
_props$labelKey = props.labelKey,
|
|
69
|
+
labelKey = _props$labelKey === void 0 ? 'label' : _props$labelKey,
|
|
72
70
|
listProps = props.listProps,
|
|
73
71
|
id = props.id,
|
|
74
72
|
tabIndex = props.tabIndex,
|
|
@@ -92,8 +90,9 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
92
90
|
onBlur = props.onBlur,
|
|
93
91
|
onFocus = props.onFocus,
|
|
94
92
|
searchBy = props.searchBy,
|
|
95
|
-
placement = props.placement,
|
|
96
|
-
|
|
93
|
+
_props$placement = props.placement,
|
|
94
|
+
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
95
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "appearance", "cleanable", "cacheData", "classPrefix", "data", "disabled", "readOnly", "plaintext", "defaultValue", "defaultOpen", "disabledItemValues", "locale", "toggleAs", "style", "searchable", "open", "placeholder", "groupBy", "menuClassName", "menuStyle", "menuAutoWidth", "menuMaxHeight", "creatable", "value", "valueKey", "virtualized", "labelKey", "listProps", "id", "tabIndex", "sort", "renderMenu", "renderExtraFooter", "renderValue", "renderMenuItem", "renderMenuGroup", "onEnter", "onEntered", "onExit", "onExited", "onChange", "onClean", "onCreate", "onSearch", "onSelect", "onOpen", "onClose", "onBlur", "onFocus", "searchBy", "placement"]);
|
|
97
96
|
|
|
98
97
|
var _useContext = useContext(InputPickerContext),
|
|
99
98
|
multi = _useContext.multi,
|
|
@@ -642,8 +641,11 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
642
641
|
var hasValue = multi ? !!(tagElements !== null && tagElements !== void 0 && tagElements.length) || hasMultiValue : isValid || hasSingleValue;
|
|
643
642
|
|
|
644
643
|
var _usePickerClassName = usePickerClassName(_extends({}, props, {
|
|
644
|
+
classPrefix: classPrefix,
|
|
645
|
+
appearance: appearance,
|
|
645
646
|
hasValue: hasValue,
|
|
646
|
-
name: 'input'
|
|
647
|
+
name: 'input',
|
|
648
|
+
cleanable: cleanable
|
|
647
649
|
})),
|
|
648
650
|
pickerClasses = _usePickerClassName[0],
|
|
649
651
|
usedClassNamePropKeys = _usePickerClassName[1];
|
|
@@ -694,6 +696,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
694
696
|
onKeyDown: onPickerKeyDown
|
|
695
697
|
}, /*#__PURE__*/React.createElement(PickerToggle, _extends({}, omit(rest, [].concat(omitTriggerPropKeys, usedClassNamePropKeys)), {
|
|
696
698
|
id: id,
|
|
699
|
+
appearance: appearance,
|
|
697
700
|
readOnly: readOnly,
|
|
698
701
|
plaintext: plaintext,
|
|
699
702
|
ref: targetRef,
|
|
@@ -720,7 +723,6 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
720
723
|
})))));
|
|
721
724
|
});
|
|
722
725
|
InputPicker.displayName = 'InputPicker';
|
|
723
|
-
InputPicker.defaultProps = defaultProps;
|
|
724
726
|
InputPicker.propTypes = _extends({}, listPickerPropTypes, {
|
|
725
727
|
locale: PropTypes.any,
|
|
726
728
|
appearance: PropTypes.oneOf(['default', 'subtle']),
|
package/esm/List/List.js
CHANGED
|
@@ -6,25 +6,23 @@ import useSortHelper from './helper/useSortHelper';
|
|
|
6
6
|
import { mergeRefs, useClassNames } from '../utils';
|
|
7
7
|
import ListContext from './ListContext';
|
|
8
8
|
import ListItem from './ListItem';
|
|
9
|
-
var defaultProps = {
|
|
10
|
-
as: 'div',
|
|
11
|
-
classPrefix: 'list',
|
|
12
|
-
size: 'md',
|
|
13
|
-
autoScroll: true,
|
|
14
|
-
pressDelay: 0,
|
|
15
|
-
transitionDuration: 300
|
|
16
|
-
};
|
|
17
9
|
var List = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
18
|
-
var
|
|
19
|
-
|
|
10
|
+
var _props$as = props.as,
|
|
11
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
12
|
+
_props$classPrefix = props.classPrefix,
|
|
13
|
+
classPrefix = _props$classPrefix === void 0 ? 'list' : _props$classPrefix,
|
|
20
14
|
className = props.className,
|
|
21
15
|
bordered = props.bordered,
|
|
22
16
|
hover = props.hover,
|
|
23
|
-
size = props.size,
|
|
17
|
+
_props$size = props.size,
|
|
18
|
+
size = _props$size === void 0 ? 'md' : _props$size,
|
|
24
19
|
sortable = props.sortable,
|
|
25
|
-
autoScroll = props.autoScroll,
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
_props$autoScroll = props.autoScroll,
|
|
21
|
+
autoScroll = _props$autoScroll === void 0 ? true : _props$autoScroll,
|
|
22
|
+
_props$pressDelay = props.pressDelay,
|
|
23
|
+
pressDelay = _props$pressDelay === void 0 ? 0 : _props$pressDelay,
|
|
24
|
+
_props$transitionDura = props.transitionDuration,
|
|
25
|
+
transitionDuration = _props$transitionDura === void 0 ? 300 : _props$transitionDura,
|
|
28
26
|
children = props.children,
|
|
29
27
|
onSort = props.onSort,
|
|
30
28
|
onSortEnd = props.onSortEnd,
|
|
@@ -77,7 +75,6 @@ var List = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
77
75
|
});
|
|
78
76
|
List.Item = ListItem;
|
|
79
77
|
List.displayName = 'List';
|
|
80
|
-
List.defaultProps = defaultProps;
|
|
81
78
|
List.propTypes = {
|
|
82
79
|
className: PropTypes.string,
|
|
83
80
|
classPrefix: PropTypes.string,
|
package/esm/List/ListItem.js
CHANGED
|
@@ -5,17 +5,15 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { useContext, useEffect, useRef } from 'react';
|
|
6
6
|
import { mergeRefs, useClassNames } from '../utils';
|
|
7
7
|
import ListContext from './ListContext';
|
|
8
|
-
var defaultProps = {
|
|
9
|
-
as: 'div',
|
|
10
|
-
classPrefix: 'list-item',
|
|
11
|
-
collection: 0
|
|
12
|
-
};
|
|
13
8
|
var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
|
-
var
|
|
9
|
+
var _props$as = props.as,
|
|
10
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
15
11
|
children = props.children,
|
|
16
12
|
className = props.className,
|
|
17
|
-
classPrefix = props.classPrefix,
|
|
18
|
-
|
|
13
|
+
_props$classPrefix = props.classPrefix,
|
|
14
|
+
classPrefix = _props$classPrefix === void 0 ? 'list-item' : _props$classPrefix,
|
|
15
|
+
_props$collection = props.collection,
|
|
16
|
+
collection = _props$collection === void 0 ? 0 : _props$collection,
|
|
19
17
|
disabled = props.disabled,
|
|
20
18
|
index = props.index,
|
|
21
19
|
rest = _objectWithoutPropertiesLoose(props, ["as", "children", "className", "classPrefix", "collection", "disabled", "index"]);
|
|
@@ -57,7 +55,6 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
57
55
|
}), children);
|
|
58
56
|
});
|
|
59
57
|
ListItem.displayName = 'ListItem';
|
|
60
|
-
ListItem.defaultProps = defaultProps;
|
|
61
58
|
ListItem.propTypes = {
|
|
62
59
|
index: PropTypes.number,
|
|
63
60
|
collection: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
package/esm/Loader/Loader.js
CHANGED
|
@@ -3,18 +3,16 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
|
-
var defaultProps = {
|
|
7
|
-
as: 'div',
|
|
8
|
-
classPrefix: 'loader',
|
|
9
|
-
speed: 'normal'
|
|
10
|
-
};
|
|
11
6
|
var Loader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
12
|
-
var
|
|
13
|
-
|
|
7
|
+
var _props$as = props.as,
|
|
8
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
9
|
+
_props$classPrefix = props.classPrefix,
|
|
10
|
+
classPrefix = _props$classPrefix === void 0 ? 'loader' : _props$classPrefix,
|
|
14
11
|
className = props.className,
|
|
15
12
|
inverse = props.inverse,
|
|
16
13
|
backdrop = props.backdrop,
|
|
17
|
-
speed = props.speed,
|
|
14
|
+
_props$speed = props.speed,
|
|
15
|
+
speed = _props$speed === void 0 ? 'normal' : _props$speed,
|
|
18
16
|
center = props.center,
|
|
19
17
|
vertical = props.vertical,
|
|
20
18
|
content = props.content,
|
|
@@ -51,7 +49,6 @@ var Loader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
49
|
}, content)));
|
|
52
50
|
});
|
|
53
51
|
Loader.displayName = 'Loader';
|
|
54
|
-
Loader.defaultProps = defaultProps;
|
|
55
52
|
Loader.propTypes = {
|
|
56
53
|
as: PropTypes.elementType,
|
|
57
54
|
className: PropTypes.string,
|
package/esm/Menu/Menu.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export interface MenuHandle {
|
|
|
29
29
|
declare function Menu(props: MenuProps & React.HTMLAttributes<HTMLUListElement>): React.ReactElement<React.HTMLAttributes<HTMLDivElement>, string | React.JSXElementConstructor<any>>;
|
|
30
30
|
declare namespace Menu {
|
|
31
31
|
var displayName: string;
|
|
32
|
-
var defaultProps: Partial<MenuProps>;
|
|
33
32
|
var propTypes: {
|
|
34
33
|
children: PropTypes.Validator<(...args: any[]) => any>;
|
|
35
34
|
};
|
package/esm/Menu/Menu.js
CHANGED
|
@@ -9,9 +9,7 @@ import useFocus from '../utils/useFocus';
|
|
|
9
9
|
import useClickOutside from '../utils/useClickOutside';
|
|
10
10
|
import { isFocusLeaving } from '../utils/events';
|
|
11
11
|
import { isFocusableElement } from '../utils/dom';
|
|
12
|
-
var
|
|
13
|
-
openMenuOn: ['click']
|
|
14
|
-
};
|
|
12
|
+
var defaultOpenMenuOn = ['click'];
|
|
15
13
|
/**
|
|
16
14
|
* Headless ARIA `menu`
|
|
17
15
|
*/
|
|
@@ -21,7 +19,8 @@ function Menu(props) {
|
|
|
21
19
|
|
|
22
20
|
var disabled = props.disabled,
|
|
23
21
|
children = props.children,
|
|
24
|
-
openMenuOn = props.openMenuOn,
|
|
22
|
+
_props$openMenuOn = props.openMenuOn,
|
|
23
|
+
openMenuOn = _props$openMenuOn === void 0 ? defaultOpenMenuOn : _props$openMenuOn,
|
|
25
24
|
menuButtonText = props.menuButtonText,
|
|
26
25
|
renderMenuButton = props.renderMenuButton,
|
|
27
26
|
renderMenuPopup = props.renderMenuPopup,
|
|
@@ -368,7 +367,6 @@ function Menu(props) {
|
|
|
368
367
|
}
|
|
369
368
|
|
|
370
369
|
Menu.displayName = 'Menu';
|
|
371
|
-
Menu.defaultProps = defaultProps;
|
|
372
370
|
Menu.propTypes = {
|
|
373
371
|
children: PropTypes.func.isRequired
|
|
374
372
|
};
|
package/esm/Menu/MenuItem.js
CHANGED
|
@@ -22,7 +22,7 @@ function MenuItem(props) {
|
|
|
22
22
|
dispatch = _ref[1]; // Whether this menuitem has focus (indicated by `aria-activedescendant` from parent menu)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var hasFocus = (menuState === null || menuState === void 0 ? void 0 : (_menuState$items$menu = menuState.items[menuState === null || menuState === void 0 ? void 0 : menuState.activeItemIndex]) === null || _menuState$items$menu === void 0 ? void 0 : _menuState$items$menu.element) === menuitemRef.current;
|
|
25
|
+
var hasFocus = (menuState === null || menuState === void 0 ? void 0 : (_menuState$items$menu = menuState.items[menuState === null || menuState === void 0 ? void 0 : menuState.activeItemIndex]) === null || _menuState$items$menu === void 0 ? void 0 : _menuState$items$menu.element) === menuitemRef.current && !!menuitemRef.current;
|
|
26
26
|
var handleClick = useCallback(function (event) {
|
|
27
27
|
if (disabled) {
|
|
28
28
|
return;
|
package/esm/Message/Message.js
CHANGED
|
@@ -8,24 +8,22 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { useClassNames, useTimeout, MESSAGE_STATUS_ICONS, STATUS } from '../utils';
|
|
10
10
|
import CloseButton from '../CloseButton';
|
|
11
|
-
var defaultProps = {
|
|
12
|
-
as: 'div',
|
|
13
|
-
classPrefix: 'message',
|
|
14
|
-
type: 'info',
|
|
15
|
-
duration: 2000
|
|
16
|
-
};
|
|
17
11
|
var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
18
12
|
var _withClassPrefix;
|
|
19
13
|
|
|
20
|
-
var
|
|
14
|
+
var _props$as = props.as,
|
|
15
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
21
16
|
className = props.className,
|
|
22
|
-
classPrefix = props.classPrefix,
|
|
17
|
+
_props$classPrefix = props.classPrefix,
|
|
18
|
+
classPrefix = _props$classPrefix === void 0 ? 'message' : _props$classPrefix,
|
|
23
19
|
children = props.children,
|
|
24
20
|
closable = props.closable,
|
|
25
|
-
duration = props.duration,
|
|
21
|
+
_props$duration = props.duration,
|
|
22
|
+
duration = _props$duration === void 0 ? 2000 : _props$duration,
|
|
26
23
|
full = props.full,
|
|
27
24
|
header = props.header,
|
|
28
|
-
type = props.type,
|
|
25
|
+
_props$type = props.type,
|
|
26
|
+
type = _props$type === void 0 ? 'info' : _props$type,
|
|
29
27
|
showIcon = props.showIcon,
|
|
30
28
|
onClose = props.onClose,
|
|
31
29
|
rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "children", "closable", "duration", "full", "header", "type", "showIcon", "onClose"]);
|
|
@@ -80,7 +78,6 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
78
|
}, children))));
|
|
81
79
|
});
|
|
82
80
|
Message.displayName = 'Message';
|
|
83
|
-
Message.defaultProps = defaultProps;
|
|
84
81
|
Message.propTypes = {
|
|
85
82
|
type: PropTypes.oneOf(STATUS),
|
|
86
83
|
className: PropTypes.string,
|
package/esm/Modal/Modal.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import ModalHeader from './ModalHeader';
|
|
|
6
6
|
import ModalTitle from './ModalTitle';
|
|
7
7
|
import ModalFooter from './ModalFooter';
|
|
8
8
|
import { TypeAttributes, RsRefForwardingComponent } from '../@types/common';
|
|
9
|
-
export interface ModalProps extends BaseModalProps {
|
|
9
|
+
export interface ModalProps extends BaseModalProps, Pick<React.HTMLAttributes<HTMLElement>, 'role' | 'id' | 'aria-labelledby' | 'aria-describedby'> {
|
|
10
10
|
/** A modal can have different sizes */
|
|
11
11
|
size?: TypeAttributes.Size;
|
|
12
12
|
/** Set the duration of the animation */
|
|
@@ -26,15 +26,6 @@ export interface ModalProps extends BaseModalProps {
|
|
|
26
26
|
/** Render Modal as Drawer */
|
|
27
27
|
drawer?: boolean;
|
|
28
28
|
}
|
|
29
|
-
export interface ModalContextProps {
|
|
30
|
-
/** Pass the close event callback to the header close button. */
|
|
31
|
-
onModalClose: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
32
|
-
/** Pass the latest style to body. */
|
|
33
|
-
getBodyStyles?: () => React.CSSProperties;
|
|
34
|
-
/** Whether this Modal is a Drawer */
|
|
35
|
-
isDrawer: boolean;
|
|
36
|
-
}
|
|
37
|
-
export declare const ModalContext: React.Context<ModalContextProps>;
|
|
38
29
|
interface ModalComponent extends RsRefForwardingComponent<'div', ModalProps> {
|
|
39
30
|
Body: typeof ModalBody;
|
|
40
31
|
Header: typeof ModalHeader;
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -11,44 +11,48 @@ import BaseModal, { modalPropTypes } from '../Overlay/Modal';
|
|
|
11
11
|
import Bounce from '../Animation/Bounce';
|
|
12
12
|
import { useClassNames, mergeRefs, SIZE } from '../utils';
|
|
13
13
|
import ModalDialog, { modalDialogPropTypes } from './ModalDialog';
|
|
14
|
+
import { ModalContext } from './ModalContext';
|
|
14
15
|
import ModalBody from './ModalBody';
|
|
15
16
|
import ModalHeader from './ModalHeader';
|
|
16
17
|
import ModalTitle from './ModalTitle';
|
|
17
18
|
import ModalFooter from './ModalFooter';
|
|
18
19
|
import helper from '../DOMHelper';
|
|
19
20
|
import { useBodyStyles } from './utils';
|
|
20
|
-
|
|
21
|
-
classPrefix: 'modal',
|
|
22
|
-
size: 'sm',
|
|
23
|
-
animation: Bounce,
|
|
24
|
-
animationTimeout: 300,
|
|
25
|
-
dialogAs: ModalDialog,
|
|
26
|
-
backdrop: true,
|
|
27
|
-
overflow: true
|
|
28
|
-
};
|
|
29
|
-
export var ModalContext = /*#__PURE__*/React.createContext(null);
|
|
21
|
+
import useUniqueId from '../utils/useUniqueId';
|
|
30
22
|
var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
31
23
|
var className = props.className,
|
|
32
24
|
children = props.children,
|
|
33
|
-
classPrefix = props.classPrefix,
|
|
25
|
+
_props$classPrefix = props.classPrefix,
|
|
26
|
+
classPrefix = _props$classPrefix === void 0 ? 'modal' : _props$classPrefix,
|
|
34
27
|
dialogClassName = props.dialogClassName,
|
|
35
28
|
backdropClassName = props.backdropClassName,
|
|
36
|
-
backdrop = props.backdrop,
|
|
29
|
+
_props$backdrop = props.backdrop,
|
|
30
|
+
backdrop = _props$backdrop === void 0 ? true : _props$backdrop,
|
|
37
31
|
dialogStyle = props.dialogStyle,
|
|
38
|
-
animation = props.animation,
|
|
32
|
+
_props$animation = props.animation,
|
|
33
|
+
animation = _props$animation === void 0 ? Bounce : _props$animation,
|
|
39
34
|
open = props.open,
|
|
40
|
-
size = props.size,
|
|
35
|
+
_props$size = props.size,
|
|
36
|
+
size = _props$size === void 0 ? 'sm' : _props$size,
|
|
41
37
|
full = props.full,
|
|
42
|
-
|
|
38
|
+
_props$dialogAs = props.dialogAs,
|
|
39
|
+
Dialog = _props$dialogAs === void 0 ? ModalDialog : _props$dialogAs,
|
|
43
40
|
animationProps = props.animationProps,
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
_props$animationTimeo = props.animationTimeout,
|
|
42
|
+
animationTimeout = _props$animationTimeo === void 0 ? 300 : _props$animationTimeo,
|
|
43
|
+
_props$overflow = props.overflow,
|
|
44
|
+
overflow = _props$overflow === void 0 ? true : _props$overflow,
|
|
46
45
|
drawer = props.drawer,
|
|
47
46
|
onClose = props.onClose,
|
|
48
47
|
onEntered = props.onEntered,
|
|
49
48
|
onEntering = props.onEntering,
|
|
50
49
|
onExited = props.onExited,
|
|
51
|
-
|
|
50
|
+
_props$role = props.role,
|
|
51
|
+
role = _props$role === void 0 ? 'dialog' : _props$role,
|
|
52
|
+
idProp = props.id,
|
|
53
|
+
ariaLabelledby = props['aria-labelledby'],
|
|
54
|
+
ariaDescribedby = props['aria-describedby'],
|
|
55
|
+
rest = _objectWithoutPropertiesLoose(props, ["className", "children", "classPrefix", "dialogClassName", "backdropClassName", "backdrop", "dialogStyle", "animation", "open", "size", "full", "dialogAs", "animationProps", "animationTimeout", "overflow", "drawer", "onClose", "onEntered", "onEntering", "onExited", "role", "id", "aria-labelledby", "aria-describedby"]);
|
|
52
56
|
|
|
53
57
|
var inClass = {
|
|
54
58
|
in: open && !animation
|
|
@@ -73,15 +77,17 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
73
77
|
onChangeBodyStyles = _useBodyStyles[1],
|
|
74
78
|
onDestroyEvents = _useBodyStyles[2];
|
|
75
79
|
|
|
80
|
+
var dialogId = useUniqueId('dialog-', idProp);
|
|
76
81
|
var modalContextValue = useMemo(function () {
|
|
77
82
|
return {
|
|
83
|
+
dialogId: dialogId,
|
|
78
84
|
onModalClose: onClose,
|
|
79
85
|
getBodyStyles: function getBodyStyles() {
|
|
80
86
|
return bodyStyles;
|
|
81
87
|
},
|
|
82
88
|
isDrawer: drawer
|
|
83
89
|
};
|
|
84
|
-
}, [onClose, bodyStyles, drawer]);
|
|
90
|
+
}, [dialogId, onClose, bodyStyles, drawer]);
|
|
85
91
|
|
|
86
92
|
var _useState = useState(false),
|
|
87
93
|
shake = _useState[0],
|
|
@@ -141,7 +147,12 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
141
147
|
var transitionClassName = transitionProps.className,
|
|
142
148
|
transitionRest = _objectWithoutPropertiesLoose(transitionProps, ["className"]);
|
|
143
149
|
|
|
144
|
-
return /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
150
|
+
return /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
151
|
+
role: role,
|
|
152
|
+
id: dialogId,
|
|
153
|
+
"aria-labelledby": ariaLabelledby !== null && ariaLabelledby !== void 0 ? ariaLabelledby : dialogId + "-title",
|
|
154
|
+
"aria-describedby": ariaDescribedby
|
|
155
|
+
}, transitionRest, pick(rest, Object.keys(modalDialogPropTypes)), {
|
|
145
156
|
ref: mergeRefs(dialogRef, transitionRef),
|
|
146
157
|
classPrefix: classPrefix,
|
|
147
158
|
className: merge(classes, transitionClassName, prefix({
|
|
@@ -158,7 +169,6 @@ Modal.Title = ModalTitle;
|
|
|
158
169
|
Modal.Footer = ModalFooter;
|
|
159
170
|
Modal.Dialog = ModalDialog;
|
|
160
171
|
Modal.displayName = 'Modal';
|
|
161
|
-
Modal.defaultProps = defaultProps;
|
|
162
172
|
Modal.propTypes = _extends({}, modalPropTypes, {
|
|
163
173
|
animation: PropTypes.any,
|
|
164
174
|
animationTimeout: PropTypes.number,
|
package/esm/Modal/ModalBody.js
CHANGED
|
@@ -3,16 +3,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
|
-
import { ModalContext } from './
|
|
6
|
+
import { ModalContext } from './ModalContext';
|
|
7
7
|
import IconButton from '../IconButton';
|
|
8
8
|
import Close from '@rsuite/icons/Close';
|
|
9
|
-
var defaultProps = {
|
|
10
|
-
as: 'div',
|
|
11
|
-
classPrefix: 'modal-body'
|
|
12
|
-
};
|
|
13
9
|
var ModalBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
14
|
-
var
|
|
15
|
-
|
|
10
|
+
var _props$as = props.as,
|
|
11
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
12
|
+
_props$classPrefix = props.classPrefix,
|
|
13
|
+
classPrefix = _props$classPrefix === void 0 ? 'modal-body' : _props$classPrefix,
|
|
16
14
|
className = props.className,
|
|
17
15
|
style = props.style,
|
|
18
16
|
children = props.children,
|
|
@@ -42,7 +40,6 @@ var ModalBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
40
|
});
|
|
43
41
|
});
|
|
44
42
|
ModalBody.displayName = 'ModalBody';
|
|
45
|
-
ModalBody.defaultProps = defaultProps;
|
|
46
43
|
ModalBody.propTypes = {
|
|
47
44
|
as: PropTypes.elementType,
|
|
48
45
|
classPrefix: PropTypes.string,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ModalContextProps {
|
|
3
|
+
/** ID of the dialog element */
|
|
4
|
+
dialogId: string;
|
|
5
|
+
/** Pass the close event callback to the header close button. */
|
|
6
|
+
onModalClose: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
7
|
+
/** Pass the latest style to body. */
|
|
8
|
+
getBodyStyles?: () => React.CSSProperties;
|
|
9
|
+
/** Whether this Modal is a Drawer */
|
|
10
|
+
isDrawer: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const ModalContext: React.Context<ModalContextProps>;
|
package/esm/Modal/ModalDialog.js
CHANGED
|
@@ -16,17 +16,15 @@ export var modalDialogPropTypes = {
|
|
|
16
16
|
dialogStyle: PropTypes.object,
|
|
17
17
|
children: PropTypes.node
|
|
18
18
|
};
|
|
19
|
-
var defaultProps = {
|
|
20
|
-
as: 'div',
|
|
21
|
-
classPrefix: 'modal'
|
|
22
|
-
};
|
|
23
19
|
var ModalDialog = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
24
|
-
var
|
|
20
|
+
var _props$as = props.as,
|
|
21
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
25
22
|
style = props.style,
|
|
26
23
|
children = props.children,
|
|
27
24
|
dialogClassName = props.dialogClassName,
|
|
28
25
|
dialogStyle = props.dialogStyle,
|
|
29
|
-
classPrefix = props.classPrefix,
|
|
26
|
+
_props$classPrefix = props.classPrefix,
|
|
27
|
+
classPrefix = _props$classPrefix === void 0 ? 'modal' : _props$classPrefix,
|
|
30
28
|
className = props.className,
|
|
31
29
|
size = props.size,
|
|
32
30
|
rest = _objectWithoutPropertiesLoose(props, ["as", "style", "children", "dialogClassName", "dialogStyle", "classPrefix", "className", "size"]);
|
|
@@ -42,7 +40,10 @@ var ModalDialog = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
40
|
|
|
43
41
|
var classes = merge(className, withClassPrefix(size));
|
|
44
42
|
var dialogClasses = merge(dialogClassName, prefix('dialog'));
|
|
45
|
-
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
43
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
44
|
+
role: "dialog",
|
|
45
|
+
"aria-modal": true
|
|
46
|
+
}, rest, {
|
|
46
47
|
ref: ref,
|
|
47
48
|
className: classes,
|
|
48
49
|
style: modalStyle
|
|
@@ -55,6 +56,5 @@ var ModalDialog = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
56
|
}, children)));
|
|
56
57
|
});
|
|
57
58
|
ModalDialog.displayName = 'ModalDialog';
|
|
58
|
-
ModalDialog.defaultProps = defaultProps;
|
|
59
59
|
ModalDialog.propTypes = modalDialogPropTypes;
|
|
60
60
|
export default ModalDialog;
|
package/esm/Modal/ModalHeader.js
CHANGED
|
@@ -3,20 +3,18 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { createChainedFunction, useClassNames } from '../utils';
|
|
6
|
-
import { ModalContext } from './
|
|
6
|
+
import { ModalContext } from './ModalContext';
|
|
7
7
|
import CloseButton from '../CloseButton';
|
|
8
8
|
import Close from '@rsuite/icons/Close';
|
|
9
9
|
import IconButton from '../IconButton';
|
|
10
|
-
var defaultProps = {
|
|
11
|
-
as: 'div',
|
|
12
|
-
closeButton: true,
|
|
13
|
-
classPrefix: 'modal-header'
|
|
14
|
-
};
|
|
15
10
|
var ModalHeader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
-
var
|
|
17
|
-
|
|
11
|
+
var _props$as = props.as,
|
|
12
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
13
|
+
_props$classPrefix = props.classPrefix,
|
|
14
|
+
classPrefix = _props$classPrefix === void 0 ? 'modal-header' : _props$classPrefix,
|
|
18
15
|
className = props.className,
|
|
19
|
-
closeButton = props.closeButton,
|
|
16
|
+
_props$closeButton = props.closeButton,
|
|
17
|
+
closeButton = _props$closeButton === void 0 ? true : _props$closeButton,
|
|
20
18
|
children = props.children,
|
|
21
19
|
onClose = props.onClose,
|
|
22
20
|
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "closeButton", "children", "onClose"]);
|
|
@@ -44,7 +42,6 @@ var ModalHeader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
44
42
|
}), closeButton && buttonElement, children);
|
|
45
43
|
});
|
|
46
44
|
ModalHeader.displayName = 'ModalHeader';
|
|
47
|
-
ModalHeader.defaultProps = defaultProps;
|
|
48
45
|
ModalHeader.propTypes = {
|
|
49
46
|
as: PropTypes.elementType,
|
|
50
47
|
classPrefix: PropTypes.string,
|