rsuite 5.4.0 → 5.4.4

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.
Files changed (139) hide show
  1. package/Button/styles/index.less +1 -5
  2. package/CHANGELOG.md +38 -0
  3. package/CheckTreePicker/styles/index.less +1 -1
  4. package/Drawer/styles/index.less +3 -0
  5. package/Dropdown/styles/index.less +6 -22
  6. package/Dropdown/styles/mixin.less +0 -2
  7. package/Modal/styles/index.less +23 -22
  8. package/Navbar/styles/index.less +20 -8
  9. package/README.md +1 -1
  10. package/Sidenav/styles/index.less +8 -2
  11. package/cjs/Affix/Affix.js +3 -1
  12. package/cjs/AvatarGroup/AvatarGroup.js +9 -4
  13. package/cjs/ButtonGroup/ButtonGroup.js +9 -4
  14. package/cjs/Calendar/Calendar.js +21 -20
  15. package/cjs/Calendar/Header.js +1 -3
  16. package/cjs/Calendar/Table.js +1 -1
  17. package/cjs/Calendar/TableRow.js +12 -7
  18. package/cjs/Calendar/View.js +9 -5
  19. package/cjs/Calendar/useCalendarDate.d.ts +1 -1
  20. package/cjs/Calendar/useCalendarDate.js +1 -1
  21. package/cjs/Carousel/Carousel.js +7 -1
  22. package/cjs/Cascader/Cascader.js +13 -2
  23. package/cjs/CheckPicker/CheckPicker.d.ts +5 -2
  24. package/cjs/CheckPicker/test/CheckPicker.test.js +8 -0
  25. package/cjs/CheckTree/index.js +9 -4
  26. package/cjs/CheckTreePicker/CheckTreePicker.js +1 -1
  27. package/cjs/CheckTreePicker/utils.js +1 -1
  28. package/cjs/Container/Container.js +6 -3
  29. package/cjs/CustomProvider/CustomProvider.d.ts +14 -14
  30. package/cjs/CustomProvider/CustomProvider.js +4 -3
  31. package/cjs/DatePicker/DatePicker.d.ts +1 -1
  32. package/cjs/DatePicker/DatePicker.js +5 -5
  33. package/cjs/DateRangePicker/DateRangePicker.js +3 -3
  34. package/cjs/Disclosure/Disclosure.d.ts +8 -5
  35. package/cjs/Disclosure/Disclosure.js +51 -11
  36. package/cjs/Disclosure/DisclosureButton.d.ts +2 -2
  37. package/cjs/Disclosure/DisclosureContext.d.ts +6 -1
  38. package/cjs/Dropdown/Dropdown.js +1 -1
  39. package/cjs/Dropdown/DropdownItem.js +9 -10
  40. package/cjs/Dropdown/DropdownMenu.js +78 -26
  41. package/cjs/FormGroup/FormGroup.js +9 -4
  42. package/cjs/Menu/MenuItem.js +1 -1
  43. package/cjs/Modal/Modal.js +34 -22
  44. package/cjs/Modal/utils.js +16 -8
  45. package/cjs/MultiCascader/MultiCascader.js +6 -3
  46. package/cjs/Nav/Nav.js +10 -15
  47. package/cjs/Nav/NavItem.js +3 -1
  48. package/cjs/Navbar/index.d.ts +1 -0
  49. package/cjs/Navbar/index.js +4 -3
  50. package/cjs/Overlay/Modal.js +18 -32
  51. package/cjs/PanelGroup/PanelGroup.js +8 -5
  52. package/cjs/Picker/DropdownMenu.js +5 -0
  53. package/cjs/Picker/PickerToggle.js +2 -4
  54. package/cjs/SelectPicker/SelectPicker.d.ts +5 -2
  55. package/cjs/SelectPicker/test/SelectPicker.test.js +8 -0
  56. package/cjs/Toggle/Toggle.js +2 -1
  57. package/cjs/Tree/Tree.js +9 -4
  58. package/cjs/Uploader/UploadFileItem.d.ts +1 -1
  59. package/cjs/Uploader/UploadFileItem.js +1 -1
  60. package/cjs/Uploader/Uploader.js +3 -0
  61. package/cjs/utils/index.d.ts +1 -0
  62. package/cjs/utils/index.js +7 -2
  63. package/cjs/utils/propTypeChecker.d.ts +2 -6
  64. package/cjs/utils/propTypeChecker.js +7 -59
  65. package/cjs/utils/useClickOutside.js +6 -2
  66. package/cjs/utils/useMount.d.ts +2 -0
  67. package/cjs/utils/useMount.js +19 -0
  68. package/dist/rsuite-rtl.css +336 -180
  69. package/dist/rsuite-rtl.min.css +1 -1
  70. package/dist/rsuite-rtl.min.css.map +1 -1
  71. package/dist/rsuite.css +336 -180
  72. package/dist/rsuite.js +67 -45
  73. package/dist/rsuite.js.map +1 -1
  74. package/dist/rsuite.min.css +1 -1
  75. package/dist/rsuite.min.css.map +1 -1
  76. package/dist/rsuite.min.js +1 -1
  77. package/dist/rsuite.min.js.map +1 -1
  78. package/esm/Affix/Affix.js +4 -2
  79. package/esm/AvatarGroup/AvatarGroup.js +7 -4
  80. package/esm/ButtonGroup/ButtonGroup.js +7 -4
  81. package/esm/Calendar/Calendar.js +22 -21
  82. package/esm/Calendar/Header.js +1 -3
  83. package/esm/Calendar/Table.js +1 -1
  84. package/esm/Calendar/TableRow.js +13 -8
  85. package/esm/Calendar/View.js +10 -6
  86. package/esm/Calendar/useCalendarDate.d.ts +1 -1
  87. package/esm/Calendar/useCalendarDate.js +1 -1
  88. package/esm/Carousel/Carousel.js +9 -3
  89. package/esm/Cascader/Cascader.js +13 -2
  90. package/esm/CheckPicker/CheckPicker.d.ts +5 -2
  91. package/esm/CheckPicker/test/CheckPicker.test.js +7 -0
  92. package/esm/CheckTree/index.js +7 -4
  93. package/esm/CheckTreePicker/CheckTreePicker.js +1 -1
  94. package/esm/CheckTreePicker/utils.js +1 -1
  95. package/esm/Container/Container.js +7 -4
  96. package/esm/CustomProvider/CustomProvider.d.ts +14 -14
  97. package/esm/CustomProvider/CustomProvider.js +2 -2
  98. package/esm/DatePicker/DatePicker.d.ts +1 -1
  99. package/esm/DatePicker/DatePicker.js +5 -4
  100. package/esm/DateRangePicker/DateRangePicker.js +3 -3
  101. package/esm/Disclosure/Disclosure.d.ts +8 -5
  102. package/esm/Disclosure/Disclosure.js +52 -13
  103. package/esm/Disclosure/DisclosureButton.d.ts +2 -2
  104. package/esm/Disclosure/DisclosureContext.d.ts +6 -1
  105. package/esm/Dropdown/Dropdown.js +1 -1
  106. package/esm/Dropdown/DropdownItem.js +9 -9
  107. package/esm/Dropdown/DropdownMenu.js +79 -27
  108. package/esm/FormGroup/FormGroup.js +7 -4
  109. package/esm/Menu/MenuItem.js +1 -1
  110. package/esm/Modal/Modal.js +36 -24
  111. package/esm/Modal/utils.js +16 -8
  112. package/esm/MultiCascader/MultiCascader.js +6 -3
  113. package/esm/Nav/Nav.js +11 -16
  114. package/esm/Nav/NavItem.js +3 -1
  115. package/esm/Navbar/index.d.ts +1 -0
  116. package/esm/Navbar/index.js +1 -0
  117. package/esm/Overlay/Modal.js +19 -33
  118. package/esm/PanelGroup/PanelGroup.js +9 -6
  119. package/esm/Picker/DropdownMenu.js +5 -0
  120. package/esm/Picker/PickerToggle.js +2 -4
  121. package/esm/SelectPicker/SelectPicker.d.ts +5 -2
  122. package/esm/SelectPicker/test/SelectPicker.test.js +7 -0
  123. package/esm/Toggle/Toggle.js +2 -1
  124. package/esm/Tree/Tree.js +7 -4
  125. package/esm/Uploader/UploadFileItem.d.ts +1 -1
  126. package/esm/Uploader/UploadFileItem.js +1 -1
  127. package/esm/Uploader/Uploader.js +4 -1
  128. package/esm/utils/index.d.ts +1 -0
  129. package/esm/utils/index.js +2 -1
  130. package/esm/utils/propTypeChecker.d.ts +2 -6
  131. package/esm/utils/propTypeChecker.js +7 -59
  132. package/esm/utils/useClickOutside.js +6 -2
  133. package/esm/utils/useMount.d.ts +2 -0
  134. package/esm/utils/useMount.js +13 -0
  135. package/package.json +2 -2
  136. package/styles/color-modes/dark.less +1 -0
  137. package/styles/color-modes/high-contrast.less +1 -0
  138. package/styles/color-modes/light.less +1 -0
  139. package/styles/mixins/utilities.less +17 -5
package/esm/Nav/Nav.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useContext } from 'react';
3
+ import React, { useContext, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import NavItem from './NavItem';
6
6
  import Dropdown from '../Dropdown';
@@ -55,14 +55,17 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
55
55
  onSelectFromSidenav = _ref$onSelect === void 0 ? onSelectProp : _ref$onSelect;
56
56
 
57
57
  var activeKey = activeKeyProp !== null && activeKeyProp !== void 0 ? activeKeyProp : activeKeyFromSidenav;
58
+ var contextValue = useMemo(function () {
59
+ return {
60
+ withinNav: true,
61
+ activeKey: activeKey,
62
+ onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
63
+ };
64
+ }, [activeKey, onSelectFromSidenav, onSelectProp]);
58
65
 
59
66
  if (sidenav !== null && sidenav !== void 0 && sidenav.expanded) {
60
67
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
61
- value: {
62
- withinNav: true,
63
- activeKey: activeKey,
64
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
65
- }
68
+ value: contextValue
66
69
  }, /*#__PURE__*/React.createElement("ul", _extends({
67
70
  ref: ref,
68
71
  className: classes
@@ -73,11 +76,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
73
76
 
74
77
  if (sidenav) {
75
78
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
76
- value: {
77
- withinNav: true,
78
- activeKey: activeKey,
79
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
80
- }
79
+ value: contextValue
81
80
  }, /*#__PURE__*/React.createElement(Menubar, {
82
81
  vertical: !!sidenav
83
82
  }, function (menubar, ref) {
@@ -90,11 +89,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
90
89
  }
91
90
 
92
91
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
93
- value: {
94
- withinNav: true,
95
- activeKey: activeKey,
96
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
97
- }
92
+ value: contextValue
98
93
  }, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
99
94
  ref: menubarRef,
100
95
  className: classes
@@ -83,7 +83,9 @@ var NavItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
83
83
  }
84
84
 
85
85
  if (navbar) {
86
- return /*#__PURE__*/React.createElement(NavbarItem, props);
86
+ return /*#__PURE__*/React.createElement(NavbarItem, _extends({
87
+ ref: ref
88
+ }, props));
87
89
  }
88
90
 
89
91
  return /*#__PURE__*/React.createElement(Component, _extends({
@@ -3,4 +3,5 @@ export type { NavbarProps } from './Navbar';
3
3
  export type { NavbarBodyProps } from './NavbarBody';
4
4
  export type { NavbarHeaderProps } from './NavbarHeader';
5
5
  export type { NavbarBrandProps } from './NavbarBrand';
6
+ export { NavbarContext } from './Navbar';
6
7
  export default Navbar;
@@ -1,2 +1,3 @@
1
1
  import Navbar from './Navbar';
2
+ export { NavbarContext } from './Navbar';
2
3
  export default Navbar;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useRef, useEffect, useState, useCallback } from 'react';
3
+ import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classNames from 'classnames';
6
6
  import contains from 'dom-lib/contains';
@@ -72,7 +72,6 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
72
72
  open = props.open,
73
73
  _props$autoFocus = props.autoFocus,
74
74
  autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
75
- onBackdropClick = props.onBackdropClick,
76
75
  onEsc = props.onEsc,
77
76
  onExit = props.onExit,
78
77
  onExiting = props.onExiting,
@@ -82,7 +81,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
82
81
  onEntered = props.onEntered,
83
82
  onClose = props.onClose,
84
83
  onOpen = props.onOpen,
85
- rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onBackdropClick", "onEsc", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
84
+ rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onEsc", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
86
85
 
87
86
  var _useState = useState(!open),
88
87
  exited = _useState[0],
@@ -139,17 +138,6 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
139
138
 
140
139
  handleFocusDialog();
141
140
  });
142
- var handleBackdropClick = useEventCallback(function (event) {
143
- if (event.target !== event.currentTarget) {
144
- return;
145
- }
146
-
147
- onBackdropClick === null || onBackdropClick === void 0 ? void 0 : onBackdropClick(event);
148
-
149
- if (backdrop === true) {
150
- onClose === null || onClose === void 0 ? void 0 : onClose(event);
151
- }
152
- });
153
141
  var documentKeyDownListener = useRef();
154
142
  var documentFocusListener = useRef();
155
143
  var handleOpen = useEventCallback(function () {
@@ -202,17 +190,19 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
202
190
  var handleExited = useCallback(function () {
203
191
  setExited(true);
204
192
  }, []);
193
+ var contextValue = useMemo(function () {
194
+ return {
195
+ overlayContainer: function overlayContainer() {
196
+ return modal.dialog;
197
+ }
198
+ };
199
+ }, [modal.dialog]);
205
200
 
206
201
  if (!mountModal) {
207
202
  return null;
208
203
  }
209
204
 
210
205
  var renderBackdrop = function renderBackdrop() {
211
- var backdropPorps = {
212
- style: backdropStyle,
213
- onClick: handleBackdropClick
214
- };
215
-
216
206
  if (Transition) {
217
207
  return /*#__PURE__*/React.createElement(Fade, {
218
208
  transitionAppear: true,
@@ -224,18 +214,19 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
224
214
 
225
215
  return /*#__PURE__*/React.createElement("div", _extends({
226
216
  "aria-hidden": true
227
- }, rest, backdropPorps, {
217
+ }, rest, {
218
+ style: backdropStyle,
228
219
  ref: mergeRefs(modal.setBackdropRef, ref),
229
220
  className: classNames(backdropClassName, className)
230
221
  }));
231
222
  });
232
223
  }
233
224
 
234
- return /*#__PURE__*/React.createElement("div", _extends({
235
- "aria-hidden": true
236
- }, backdropPorps, {
225
+ return /*#__PURE__*/React.createElement("div", {
226
+ "aria-hidden": true,
227
+ style: backdropStyle,
237
228
  className: backdropClassName
238
- }));
229
+ });
239
230
  };
240
231
 
241
232
  var dialogElement = Transition ? /*#__PURE__*/React.createElement(Transition, _extends({}, animationProps, {
@@ -251,17 +242,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
251
242
  onEntered: onEntered
252
243
  }), children) : children;
253
244
  return /*#__PURE__*/React.createElement(OverlayContext.Provider, {
254
- value: {
255
- overlayContainer: function overlayContainer() {
256
- return modal.dialog;
257
- }
258
- }
259
- }, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
245
+ value: contextValue
246
+ }, /*#__PURE__*/React.createElement(Portal, null, backdrop && renderBackdrop(), /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
260
247
  ref: mergeRefs(modal.setDialogRef, ref),
261
248
  style: style,
262
249
  className: className,
263
250
  tabIndex: -1
264
- }), backdrop && renderBackdrop(), dialogElement)));
251
+ }), dialogElement)));
265
252
  });
266
253
  export var modalPropTypes = {
267
254
  as: PropTypes.elementType,
@@ -286,7 +273,6 @@ Modal.propTypes = _extends({}, animationPropTypes, modalPropTypes, {
286
273
  dialogTransitionTimeout: PropTypes.number,
287
274
  backdropTransitionTimeout: PropTypes.number,
288
275
  transition: PropTypes.any,
289
- onEsc: PropTypes.func,
290
- onBackdropClick: PropTypes.func
276
+ onEsc: PropTypes.func
291
277
  });
292
278
  export default Modal;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useCallback } from 'react';
3
+ import React, { useCallback, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { useClassNames, useControlled } from '../utils';
6
6
  export var PanelGroupContext = /*#__PURE__*/React.createContext({});
@@ -34,16 +34,19 @@ var PanelGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
34
34
  setActiveKey(activeKey);
35
35
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(activeKey, event);
36
36
  }, [onSelect, setActiveKey]);
37
+ var contextValue = useMemo(function () {
38
+ return {
39
+ accordion: accordion,
40
+ activeKey: activeKey,
41
+ onGroupSelect: handleSelect
42
+ };
43
+ }, [accordion, activeKey, handleSelect]);
37
44
  return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
38
45
  ref: ref,
39
46
  role: accordion ? 'tablist' : undefined,
40
47
  className: classes
41
48
  }), /*#__PURE__*/React.createElement(PanelGroupContext.Provider, {
42
- value: {
43
- accordion: accordion,
44
- activeKey: activeKey,
45
- onGroupSelect: handleSelect
46
- }
49
+ value: contextValue
47
50
  }, children));
48
51
  });
49
52
  PanelGroup.displayName = 'PanelGroup';
@@ -99,6 +99,11 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
99
99
 
100
100
  useEffect(function () {
101
101
  var container = menuBodyContainerRef.current;
102
+
103
+ if (!container) {
104
+ return;
105
+ }
106
+
102
107
  var activeItem = container.querySelector("." + prefix('item-focus'));
103
108
 
104
109
  if (!activeItem) {
@@ -90,11 +90,9 @@ var PickerToggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
90
90
  }
91
91
  }, [input, onFocus]);
92
92
  var handleBlur = useCallback(function (event) {
93
- if (document.activeElement !== inputRef.current) {
94
- var _inputRef$current2;
95
-
93
+ if (inputRef.current && document.activeElement !== inputRef.current) {
96
94
  setActive(false);
97
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
95
+ inputRef.current.blur();
98
96
  }
99
97
 
100
98
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { Ref } from 'react';
2
2
  import { PickerLocale } from '../locales';
3
+ import { PickerInstance } from '../Picker';
3
4
  import { FormControlPickerProps, ItemDataType } from '../@types/common';
4
5
  import { ListProps } from 'react-virtualized/dist/commonjs/List';
5
6
  export interface SelectProps<T> {
@@ -42,7 +43,9 @@ export interface MultipleSelectProps<T> extends Omit<SelectProps<T>, 'renderValu
42
43
  export interface SelectPickerProps<T> extends FormControlPickerProps<T, PickerLocale, ItemDataType<T>>, SelectProps<T> {
43
44
  }
44
45
  export interface SelectPickerComponent {
45
- <T>(props: SelectPickerProps<T>): JSX.Element | null;
46
+ <T>(props: SelectPickerProps<T> & {
47
+ ref?: Ref<PickerInstance>;
48
+ }): JSX.Element | null;
46
49
  displayName?: string;
47
50
  propTypes?: React.WeakValidationMap<SelectPickerProps<any>>;
48
51
  }
@@ -49,4 +49,11 @@ React.createElement(SelectPicker, {
49
49
  onChange: function onChange(newValue) {
50
50
  expectType(newValue);
51
51
  }
52
+ });
53
+ var pickerRef = /*#__PURE__*/React.createRef();
54
+
55
+ /*#__PURE__*/
56
+ React.createElement(SelectPicker, {
57
+ ref: pickerRef,
58
+ data: []
52
59
  });
@@ -66,7 +66,8 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
66
  }, rest), /*#__PURE__*/React.createElement("input", {
67
67
  ref: inputRef,
68
68
  type: "checkbox",
69
- checked: checked,
69
+ checked: checkedProp,
70
+ defaultChecked: defaultChecked,
70
71
  disabled: disabled,
71
72
  readOnly: readOnly,
72
73
  onChange: handleInputChange,
package/esm/Tree/Tree.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import React from 'react';
2
+ import React, { useMemo } from 'react';
3
3
  import TreePicker from '../TreePicker';
4
4
  import TreeContext from './TreeContext';
5
5
 
@@ -15,10 +15,13 @@ export var TREE_NODE_DROP_POSITION;
15
15
  })(TREE_NODE_DROP_POSITION || (TREE_NODE_DROP_POSITION = {}));
16
16
 
17
17
  var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
18
- return /*#__PURE__*/React.createElement(TreeContext.Provider, {
19
- value: {
18
+ var contextValue = useMemo(function () {
19
+ return {
20
20
  inline: true
21
- }
21
+ };
22
+ }, []);
23
+ return /*#__PURE__*/React.createElement(TreeContext.Provider, {
24
+ value: contextValue
22
25
  }, /*#__PURE__*/React.createElement(TreePicker, _extends({
23
26
  ref: ref
24
27
  }, props)));
@@ -4,7 +4,7 @@ import { UploaderLocale } from '../locales';
4
4
  import { WithAsProps } from '../@types/common';
5
5
  export interface UploadFileItemProps extends WithAsProps {
6
6
  file: FileType;
7
- listType: 'text' | 'picture-text' | 'picture';
7
+ listType?: 'text' | 'picture-text' | 'picture';
8
8
  disabled?: boolean;
9
9
  className?: string;
10
10
  maxPreviewFileSize?: number;
@@ -276,7 +276,7 @@ UploadFileItem.displayName = 'UploadFileItem';
276
276
  UploadFileItem.propTypes = {
277
277
  locale: PropTypes.any,
278
278
  file: PropTypes.object.isRequired,
279
- listType: PropTypes.oneOf(['text', 'picture-text', 'picture']).isRequired,
279
+ listType: PropTypes.oneOf(['text', 'picture-text', 'picture']),
280
280
  disabled: PropTypes.bool,
281
281
  className: PropTypes.string,
282
282
  maxPreviewFileSize: PropTypes.number,
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import find from 'lodash/find';
6
6
  import FileItem from './UploadFileItem';
7
7
  import UploadTrigger from './UploadTrigger';
8
- import { ajaxUpload, useClassNames, useCustom, guid } from '../utils';
8
+ import { ajaxUpload, useClassNames, useCustom, guid, useWillUnmount } from '../utils';
9
9
  import Plaintext from '../Plaintext';
10
10
 
11
11
  var getFiles = function getFiles(event) {
@@ -83,6 +83,9 @@ var useFileList = function useFileList(defaultFileList) {
83
83
  (_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);
84
84
  fileListUpdateCallback.current = null;
85
85
  }, [fileList]);
86
+ useWillUnmount(function () {
87
+ fileListUpdateCallback.current = null;
88
+ });
86
89
  var dispatchCallback = useCallback(function (action, callback) {
87
90
  dispatch(action);
88
91
  fileListUpdateCallback.current = callback;
@@ -40,3 +40,4 @@ export { default as useUpdatedRef } from './useUpdatedRef';
40
40
  export { default as useWillUnmount } from './useWillUnmount';
41
41
  export { default as useUpdateEffect } from './useUpdateEffect';
42
42
  export { default as useIsMounted } from './useIsMounted';
43
+ export { default as useMount } from './useMount';
@@ -42,4 +42,5 @@ export { default as useEventCallback } from './useEventCallback';
42
42
  export { default as useUpdatedRef } from './useUpdatedRef';
43
43
  export { default as useWillUnmount } from './useWillUnmount';
44
44
  export { default as useUpdateEffect } from './useUpdateEffect';
45
- export { default as useIsMounted } from './useIsMounted';
45
+ export { default as useIsMounted } from './useIsMounted';
46
+ export { default as useMount } from './useMount';
@@ -1,7 +1,3 @@
1
- import PropTypes, { Requireable, Validator } from 'prop-types';
2
- declare type ExtractValue<T extends ReadonlyArray<Validator<any>>> = {
3
- [K in keyof T]: T[K] extends Validator<infer V> ? V : never;
4
- };
5
- export declare function tupleType<T extends readonly Validator<any>[]>(...types: T): Requireable<ExtractValue<T>>;
1
+ import PropTypes from 'prop-types';
2
+ export declare function tupleType<T>(...typeCheckers: any[]): PropTypes.Requireable<T>;
6
3
  export declare const refType: PropTypes.Requireable<any>;
7
- export {};
@@ -1,69 +1,17 @@
1
1
  import PropTypes from 'prop-types';
2
- var ANONYMOUS = '';
3
-
4
- function createChainableTypeChecker(validate) {
5
- function checkType(isRequired, props, propName, componentName, location, propFullName) {
6
- componentName = componentName || ANONYMOUS;
7
- propFullName = propFullName || propName;
8
-
9
- if (props[propName] == null) {
10
- if (isRequired) {
11
- if (props[propName] === null) {
12
- return new Error('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
13
- }
14
-
15
- return new Error('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
16
- }
17
-
18
- return null;
19
- } else {
20
- return validate(props, propName, componentName, location, propFullName);
21
- }
22
- }
23
-
24
- var chainedCheckType = Object.assign(checkType.bind(null, false), {
25
- isRequired: checkType.bind(null, true)
26
- });
27
- return chainedCheckType;
28
- }
29
-
30
2
  export function tupleType() {
31
- for (var _len = arguments.length, types = new Array(_len), _key = 0; _key < _len; _key++) {
32
- types[_key] = arguments[_key];
3
+ for (var _len = arguments.length, typeCheckers = new Array(_len), _key = 0; _key < _len; _key++) {
4
+ typeCheckers[_key] = arguments[_key];
33
5
  }
34
6
 
35
- return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
36
- var value = props[propName];
37
-
38
- if (!location) {
39
- location = 'prop';
40
- }
41
-
42
- if (!propFullName) {
43
- propFullName = propName;
44
- }
45
-
46
- if (!Array.isArray(value)) {
47
- return new Error("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`, expected " + types.length + "-element array");
48
- }
49
-
50
- if (value.length === 0) {
51
- return null;
52
- }
53
-
54
- if (value.length !== types.length) {
55
- return new Error("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`, expected " + types.length + "-element array, got array of length " + value.length);
56
- }
57
-
58
- for (var i = 0; i < value.length; ++i) {
59
- var error = types[i](value, String(i), componentName, 'element', propFullName + "[" + i + "]");
7
+ return PropTypes.arrayOf(function (value, index) {
8
+ var _typeCheckers$index;
60
9
 
61
- if (error) {
62
- return error;
63
- }
10
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
11
+ rest[_key2 - 2] = arguments[_key2];
64
12
  }
65
13
 
66
- return null;
14
+ return (_typeCheckers$index = typeCheckers[index]).call.apply(_typeCheckers$index, [PropTypes, value, index].concat(rest));
67
15
  });
68
16
  }
69
17
  export var refType = PropTypes.oneOfType([PropTypes.func, PropTypes.any]);
@@ -13,8 +13,12 @@ export default function useClickOutside(_ref) {
13
13
  useEffect(function () {
14
14
  if (enabled) {
15
15
  var eventHandler = function eventHandler(event) {
16
- if (isOutsideRef.current(event)) {
17
- handleRef.current(event);
16
+ var _isOutsideRef$current;
17
+
18
+ if ((_isOutsideRef$current = isOutsideRef.current) !== null && _isOutsideRef$current !== void 0 && _isOutsideRef$current.call(isOutsideRef, event)) {
19
+ var _handleRef$current;
20
+
21
+ (_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 ? void 0 : _handleRef$current.call(handleRef, event);
18
22
  }
19
23
  };
20
24
 
@@ -0,0 +1,2 @@
1
+ declare const useMount: (callback: () => void) => void;
2
+ export default useMount;
@@ -0,0 +1,13 @@
1
+ import { useEffect, useRef } from 'react';
2
+
3
+ var useMount = function useMount(callback) {
4
+ var mountRef = useRef(callback);
5
+ mountRef.current = callback;
6
+ useEffect(function () {
7
+ var _mountRef$current;
8
+
9
+ (_mountRef$current = mountRef.current) === null || _mountRef$current === void 0 ? void 0 : _mountRef$current.call(mountRef);
10
+ }, []);
11
+ };
12
+
13
+ export default useMount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.4.0",
3
+ "version": "5.4.4",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -37,7 +37,7 @@
37
37
  "lodash": "^4.17.11",
38
38
  "prop-types": "^15.7.2",
39
39
  "react-virtualized": "^9.22.3",
40
- "rsuite-table": "^5.2.2",
40
+ "rsuite-table": "^5.3.1",
41
41
  "schema-typed": "^2.0.2"
42
42
  },
43
43
  "peerDependencies": {
@@ -27,6 +27,7 @@
27
27
  --rs-bg-active: @H700;
28
28
  --rs-bg-backdrop: fade(@B900, 80%);
29
29
  --rs-state-hover-bg: @B600;
30
+ --rs-color-focus-ring: 0 0 0 3px fade(@H500, 25%);
30
31
  --rs-state-focus-shadow: 0 0 0 3px fade(@H500, 25%);
31
32
  --rs-state-focus-outline: 3px solid fade(@H500, 25%);
32
33
  --rs-shadow-overlay: 0 4px 4px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 0, 0, 0.06);
@@ -27,6 +27,7 @@
27
27
  --rs-bg-active: @H500;
28
28
  --rs-bg-backdrop: fade(@B900, 80%);
29
29
  --rs-state-hover-bg: @B600;
30
+ --rs-color-focus-ring: @B000;
30
31
  --rs-state-focus-shadow: 0 0 0 3px @B900, 0 0 0 5px @B000;
31
32
  --rs-state-focus-shadow-slim: 0 0 0 2px @B000;
32
33
  --rs-state-focus-outline: 3px solid fade(@H500, 25%);
@@ -34,6 +34,7 @@
34
34
  --rs-bg-active: @H500;
35
35
  --rs-bg-backdrop: fade(@B900, 30%);
36
36
  --rs-state-hover-bg: @H050;
37
+ --rs-color-focus-ring: fade(@H500, 25%);
37
38
  --rs-state-focus-shadow: 0 0 0 3px fade(@H500, 25%);
38
39
  --rs-state-focus-outline: 3px solid fade(@H500, 25%);
39
40
  --rs-shadow-overlay: 0 4px 4px rgba(0, 0, 0, 0.12), 0 0 10px rgba(0, 0, 0, 0.06);
@@ -122,26 +122,38 @@
122
122
 
123
123
  // Useful when adding focus ring to an element
124
124
  .with-focus-ring() {
125
- &:focus {
125
+ &:focus-visible {
126
126
  .focus-ring();
127
127
  }
128
128
  }
129
129
 
130
130
  // Useful when appending the ring into an existing :focus rule
131
131
  .focus-ring() {
132
- box-shadow: var(--rs-state-focus-shadow);
132
+ outline: 3px solid var(--rs-color-focus-ring);
133
+ // box-shadow: var(--rs-state-focus-shadow);
134
+
135
+ .high-contrast-mode({
136
+ outline-offset: 2px;
137
+ });
133
138
  }
134
139
 
135
140
  .focus-ring(slim) {
136
- box-shadow: var(--rs-state-focus-shadow-slim);
141
+ .focus-ring();
142
+
143
+ outline-width: 2px;
144
+ outline-offset: 0;
137
145
  }
138
146
 
139
147
  .focus-ring(inset) {
140
- box-shadow: inset var(--rs-state-focus-shadow);
148
+ .focus-ring();
149
+
150
+ outline-offset: -3px;
141
151
  }
142
152
 
143
153
  .focus-ring(slim-inset) {
144
- box-shadow: inset var(--rs-state-focus-shadow-slim);
154
+ .focus-ring(inset);
155
+
156
+ outline-width: 2px;
145
157
  }
146
158
 
147
159
  .focus-ring(outline) {