rsuite 4.10.2 → 4.10.6

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 (129) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/rsuite.js +75 -158
  3. package/dist/rsuite.min.js +10 -2
  4. package/dist/rsuite.min.js.map +1 -1
  5. package/es/AutoComplete/AutoComplete.js +1 -1
  6. package/es/Avatar/Avatar.js +1 -2
  7. package/es/Breadcrumb/Breadcrumb.js +1 -2
  8. package/es/Button/Button.js +1 -2
  9. package/es/ButtonGroup/ButtonGroup.js +1 -2
  10. package/es/Calendar/TimeDropdown.js +3 -3
  11. package/es/Cascader/Cascader.js +23 -6
  12. package/es/Drawer/index.js +1 -2
  13. package/es/Dropdown/Dropdown.js +1 -2
  14. package/es/FlexboxGrid/FlexboxGrid.js +1 -2
  15. package/es/FormGroup/FormGroup.js +1 -2
  16. package/es/Input/Input.js +1 -2
  17. package/es/InputGroup/InputGroup.js +1 -2
  18. package/es/IntlProvider/withLocale.js +1 -1
  19. package/es/List/List.js +1 -2
  20. package/es/List/ListItem.js +1 -2
  21. package/es/Loader/Loader.js +1 -2
  22. package/es/Modal/BaseModal.js +24 -4
  23. package/es/Modal/Modal.js +1 -2
  24. package/es/Modal/ModalDialog.js +2 -2
  25. package/es/MultiCascader/MultiCascader.js +14 -1
  26. package/es/Nav/Nav.js +1 -2
  27. package/es/Navbar/Navbar.js +1 -2
  28. package/es/Pagination/Pagination.js +1 -2
  29. package/es/Rate/Rate.js +1 -2
  30. package/es/Sidenav/Sidenav.js +1 -2
  31. package/es/Slider/Slider.d.ts +4 -11
  32. package/es/Steps/Steps.js +1 -2
  33. package/es/Table/Table.js +1 -2
  34. package/es/Table/TablePagination.js +1 -2
  35. package/es/Tag/Tag.js +1 -2
  36. package/es/TagPicker/index.js +1 -2
  37. package/es/Timeline/Timeline.js +1 -2
  38. package/es/Timeline/TimelineItem.js +1 -2
  39. package/es/Toggle/Toggle.js +1 -2
  40. package/es/Uploader/Uploader.js +2 -3
  41. package/es/utils/defaultProps.js +1 -1
  42. package/es/utils/index.js +1 -0
  43. package/es/utils/recompose.js +42 -0
  44. package/es/utils/withStyleProps.js +1 -1
  45. package/lib/AutoComplete/AutoComplete.js +2 -4
  46. package/lib/Avatar/Avatar.js +1 -3
  47. package/lib/Breadcrumb/Breadcrumb.js +1 -3
  48. package/lib/Button/Button.js +1 -3
  49. package/lib/ButtonGroup/ButtonGroup.js +1 -3
  50. package/lib/Calendar/TimeDropdown.js +3 -3
  51. package/lib/Cascader/Cascader.js +23 -6
  52. package/lib/Drawer/index.js +4 -6
  53. package/lib/Dropdown/Dropdown.js +2 -4
  54. package/lib/FlexboxGrid/FlexboxGrid.js +1 -3
  55. package/lib/FormGroup/FormGroup.js +1 -3
  56. package/lib/Input/Input.js +1 -3
  57. package/lib/InputGroup/InputGroup.js +3 -5
  58. package/lib/IntlProvider/withLocale.js +3 -3
  59. package/lib/List/List.js +1 -3
  60. package/lib/List/ListItem.js +1 -3
  61. package/lib/Loader/Loader.js +1 -3
  62. package/lib/Modal/BaseModal.js +24 -4
  63. package/lib/Modal/Modal.js +5 -7
  64. package/lib/Modal/ModalDialog.js +2 -3
  65. package/lib/MultiCascader/MultiCascader.js +14 -1
  66. package/lib/Nav/Nav.js +1 -3
  67. package/lib/Navbar/Navbar.js +2 -4
  68. package/lib/Pagination/Pagination.js +1 -3
  69. package/lib/Rate/Rate.js +1 -3
  70. package/lib/Sidenav/Sidenav.js +3 -5
  71. package/lib/Slider/Slider.d.ts +4 -11
  72. package/lib/Steps/Steps.js +1 -3
  73. package/lib/Table/Table.js +6 -8
  74. package/lib/Table/TablePagination.js +1 -3
  75. package/lib/Tag/Tag.js +1 -3
  76. package/lib/TagPicker/index.js +1 -3
  77. package/lib/Timeline/Timeline.js +1 -3
  78. package/lib/Timeline/TimelineItem.js +1 -3
  79. package/lib/Toggle/Toggle.js +1 -3
  80. package/lib/Uploader/Uploader.js +2 -4
  81. package/lib/utils/defaultProps.js +1 -1
  82. package/lib/utils/index.js +8 -0
  83. package/lib/utils/recompose.js +57 -0
  84. package/lib/utils/withStyleProps.js +1 -1
  85. package/package.json +5 -6
  86. package/src/AutoComplete/AutoComplete.tsx +1 -1
  87. package/src/Avatar/Avatar.tsx +1 -2
  88. package/src/Breadcrumb/Breadcrumb.tsx +1 -2
  89. package/src/Button/Button.tsx +8 -2
  90. package/src/ButtonGroup/ButtonGroup.tsx +1 -2
  91. package/src/Calendar/TimeDropdown.tsx +2 -3
  92. package/src/Cascader/Cascader.tsx +24 -5
  93. package/src/Cascader/test/CascaderSpec.js +56 -1
  94. package/src/DatePicker/test/DatePickerSpec.js +20 -0
  95. package/src/Drawer/index.tsx +1 -3
  96. package/src/Dropdown/Dropdown.tsx +1 -1
  97. package/src/FlexboxGrid/FlexboxGrid.tsx +1 -2
  98. package/src/FormGroup/FormGroup.tsx +1 -2
  99. package/src/Input/Input.tsx +1 -1
  100. package/src/InputGroup/InputGroup.tsx +1 -2
  101. package/src/IntlProvider/withLocale.tsx +1 -1
  102. package/src/List/List.tsx +1 -2
  103. package/src/List/ListItem.tsx +1 -2
  104. package/src/Loader/Loader.tsx +1 -2
  105. package/src/Modal/BaseModal.tsx +26 -4
  106. package/src/Modal/Modal.tsx +1 -2
  107. package/src/Modal/ModalDialog.tsx +2 -2
  108. package/src/Modal/test/ModalSpec.js +5 -0
  109. package/src/MultiCascader/MultiCascader.tsx +17 -1
  110. package/src/Nav/Nav.tsx +1 -1
  111. package/src/Navbar/Navbar.tsx +1 -2
  112. package/src/Pagination/Pagination.tsx +1 -2
  113. package/src/Rate/Rate.tsx +1 -2
  114. package/src/Sidenav/Sidenav.tsx +1 -2
  115. package/src/Slider/Slider.d.ts +4 -11
  116. package/src/Steps/Steps.tsx +1 -2
  117. package/src/Table/Table.tsx +1 -2
  118. package/src/Table/TablePagination.tsx +1 -2
  119. package/src/Tag/Tag.tsx +1 -2
  120. package/src/TagPicker/index.tsx +1 -3
  121. package/src/Timeline/Timeline.tsx +1 -2
  122. package/src/Timeline/TimelineItem.tsx +1 -2
  123. package/src/Toggle/Toggle.tsx +1 -2
  124. package/src/Uploader/Uploader.tsx +2 -3
  125. package/src/utils/defaultProps.ts +1 -1
  126. package/src/utils/index.ts +1 -0
  127. package/src/utils/recompose.ts +52 -0
  128. package/src/utils/test/recomposeSpec.js +107 -0
  129. package/src/utils/withStyleProps.tsx +1 -1
@@ -69,9 +69,11 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
69
69
  }
70
70
  };
71
71
 
72
+ toggleRef: React.RefObject<any>;
72
73
  triggerRef: React.RefObject<any>;
73
74
  containerRef: React.RefObject<any>;
74
75
  positionRef: React.RefObject<any>;
76
+ menuWrapperRef: React.RefObject<any>;
75
77
  menuContainerRef: React.RefObject<any>;
76
78
  isControlled: boolean;
77
79
 
@@ -97,20 +99,22 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
97
99
  this.state = {
98
100
  ...initState,
99
101
  ...getDerivedStateForCascade(props, initState),
100
- flattenData: flattenTree(props.data)
102
+ flattenData: flattenTree(props.data, props.childrenKey)
101
103
  };
102
104
 
103
105
  this.isControlled = !_.isUndefined(props.value);
104
106
  this.triggerRef = React.createRef();
105
107
  this.containerRef = React.createRef();
106
108
  this.positionRef = React.createRef();
109
+ this.toggleRef = React.createRef();
107
110
 
108
111
  // for test
112
+ this.menuWrapperRef = React.createRef();
109
113
  this.menuContainerRef = React.createRef();
110
114
  }
111
115
 
112
116
  static getDerivedStateFromProps(nextProps, prevState) {
113
- const { value, data, labelKey, valueKey } = nextProps;
117
+ const { value, data, labelKey, valueKey, childrenKey } = nextProps;
114
118
  if (data !== prevState.data) {
115
119
  // First get the value of the clicked node `selectNodeValue`, and then get the new `newChildren`.
116
120
  const selectNodeValue = prevState?.selectNode?.[valueKey];
@@ -127,13 +131,13 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
127
131
  newChildren.map(item => stringToObject(item, labelKey, valueKey))
128
132
  ),
129
133
  data,
130
- flattenData: flattenTree(data)
134
+ flattenData: flattenTree(data, childrenKey)
131
135
  };
132
136
  }
133
137
 
134
138
  return {
135
139
  ...getDerivedStateForCascade(nextProps, prevState),
136
- flattenData: flattenTree(data),
140
+ flattenData: flattenTree(data, childrenKey),
137
141
  data
138
142
  };
139
143
  }
@@ -397,6 +401,14 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
397
401
  return items;
398
402
  }
399
403
 
404
+ getPositionInstance = () => {
405
+ return this.positionRef.current;
406
+ };
407
+
408
+ getToggleInstance = () => {
409
+ return this.toggleRef.current;
410
+ };
411
+
400
412
  renderSearchResultPanel() {
401
413
  const { locale } = this.props;
402
414
  const { searchKeyword } = this.state;
@@ -439,7 +451,13 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
439
451
  );
440
452
 
441
453
  return (
442
- <MenuWrapper className={classes} style={menuStyle}>
454
+ <MenuWrapper
455
+ ref={this.menuWrapperRef}
456
+ className={classes}
457
+ style={menuStyle}
458
+ getToggleInstance={this.getToggleInstance}
459
+ getPositionInstance={this.getPositionInstance}
460
+ >
443
461
  {searchable && (
444
462
  <SearchBar
445
463
  placeholder={locale.searchPlaceholder}
@@ -538,6 +556,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
538
556
  >
539
557
  <PickerToggle
540
558
  {...unhandled}
559
+ ref={this.toggleRef}
541
560
  componentClass={toggleComponentClass}
542
561
  onClean={createChainedFunction(this.handleClean, onClean)}
543
562
  cleanable={cleanable && !disabled}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import ReactTestUtils from 'react-dom/test-utils';
2
+ import ReactTestUtils, { act } from 'react-dom/test-utils';
3
3
  import Cascader from '../Cascader';
4
4
  import Button from '../../Button';
5
5
  import { getDOMNode, getInstance } from '@test/testUtils';
@@ -214,4 +214,59 @@ describe('Cascader', () => {
214
214
  assert.equal(instance2.querySelector('.rs-picker-toggle-placeholder').innerText, 'Select');
215
215
  assert.equal(instance3.querySelector('.rs-picker-toggle-placeholder').innerText, 'Select');
216
216
  });
217
+
218
+ it('Should show search items with childrenKey', () => {
219
+ const itemsWithChildrenKey = {
220
+ childrenKey: 'sub',
221
+ data: [
222
+ {
223
+ value: 't',
224
+ label: 't'
225
+ },
226
+ {
227
+ value: 'h',
228
+ label: 'h'
229
+ },
230
+ {
231
+ value: 'g',
232
+ label: 'g',
233
+ sub: [
234
+ {
235
+ value: 'g-m',
236
+ label: 'g-m'
237
+ },
238
+ {
239
+ value: 'g-b',
240
+ label: 'g-b'
241
+ }
242
+ ]
243
+ }
244
+ ]
245
+ };
246
+
247
+ const instance = getInstance(
248
+ <Cascader
249
+ defaultOpen
250
+ data={itemsWithChildrenKey.data}
251
+ childrenKey={itemsWithChildrenKey.childrenKey}
252
+ />
253
+ );
254
+
255
+ const overlay = getDOMNode(instance.menuWrapperRef.current);
256
+
257
+ ReactTestUtils.act(() => {
258
+ const input = overlay.querySelector('.rs-picker-search-bar-input');
259
+
260
+ ReactTestUtils.Simulate.focus(input);
261
+
262
+ input.value = 'g';
263
+ ReactTestUtils.Simulate.change(input);
264
+ });
265
+
266
+ ReactTestUtils.act(() => {
267
+ const searchResult = overlay.querySelectorAll('.rs-picker-cascader-row');
268
+
269
+ assert.equal(searchResult.length, 2);
270
+ });
271
+ });
217
272
  });
@@ -293,4 +293,24 @@ describe('DatePicker', () => {
293
293
  );
294
294
  assert.equal(picker.querySelector('.rs-calendar-time-dropdown-column li').innerText, '12');
295
295
  });
296
+
297
+ it('Should keep AM PM unchanged', () => {
298
+ const instance = getInstance(
299
+ <DatePicker
300
+ value={parse('2017-08-14 13:00:00')}
301
+ format="hh:mm:ss A"
302
+ defaultOpen
303
+ showMeridian
304
+ />
305
+ );
306
+
307
+ const picker = instance.menuContainerRef.current;
308
+
309
+ assert.equal(picker.querySelector('.rs-calendar-header-title-time').innerText, '01:00:00');
310
+
311
+ ReactTestUtils.Simulate.click(picker.querySelector('.rs-calendar-time-dropdown-cell'));
312
+
313
+ assert.equal(picker.querySelector('.rs-calendar-header-meridian').innerText, 'PM');
314
+ assert.equal(picker.querySelector('.rs-calendar-header-title-time').innerText, '12:00:00');
315
+ });
296
316
  });
@@ -1,6 +1,4 @@
1
- import { setStatic, setDisplayName } from 'recompose';
2
-
3
- import { defaultProps } from '../utils';
1
+ import { setStatic, setDisplayName, defaultProps } from '../utils';
4
2
  import Drawer from './Drawer';
5
3
  import ModalBody from '../Modal/ModalBody';
6
4
  import ModalHeader from '../Modal/ModalHeader';
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import _ from 'lodash';
5
- import { setStatic } from 'recompose';
6
5
  import { contains } from 'dom-lib';
7
6
 
8
7
  import RootCloseWrapper from '../Overlay/RootCloseWrapper';
@@ -11,6 +10,7 @@ import DropdownToggle from './DropdownToggle';
11
10
  import DropdownMenu from './DropdownMenu';
12
11
  import DropdownMenuItem from './DropdownMenuItem';
13
12
  import {
13
+ setStatic,
14
14
  createChainedFunction,
15
15
  prefix,
16
16
  isOneOf,
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { setStatic } from 'recompose';
5
4
 
6
- import { defaultProps, prefix } from '../utils';
5
+ import { setStatic, defaultProps, prefix } from '../utils';
7
6
  import FlexboxGridItem from './FlexboxGridItem';
8
7
  import { FlexboxGridProps } from './FlexboxGrid.d';
9
8
 
@@ -2,8 +2,7 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import _ from 'lodash';
5
- import { compose } from 'recompose';
6
- import { withStyleProps, defaultProps, prefix, createContext } from '../utils';
5
+ import { compose, withStyleProps, defaultProps, prefix, createContext } from '../utils';
7
6
  import { FormGroupProps } from './FormGroup.d';
8
7
 
9
8
  export const FormGroupContext = createContext(null);
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
  import _ from 'lodash';
6
5
 
7
6
  import {
7
+ compose,
8
8
  withStyleProps,
9
9
  defaultProps,
10
10
  createChainedFunction,
@@ -1,10 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { setStatic, compose } from 'recompose';
5
4
  import InputGroupAddon from './InputGroupAddon';
6
5
  import InputGroupButton from './InputGroupButton';
7
- import { prefix, withStyleProps, defaultProps, createContext } from '../utils';
6
+ import { setStatic, compose, prefix, withStyleProps, defaultProps, createContext } from '../utils';
8
7
  import { InputGroupProps } from './InputGroup.d';
9
8
 
10
9
  export const InputGroupContext = createContext(null);
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import _ from 'lodash';
3
- import { setDisplayName, wrapDisplayName } from 'recompose';
3
+ import { setDisplayName, wrapDisplayName } from '../utils';
4
4
  import format from 'date-fns/format';
5
5
  import defaultLocale from './locales/default';
6
6
  import extendReactStatics from '../utils/extendReactStatics';
package/src/List/List.tsx CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { setStatic } from 'recompose';
4
3
  import classNames from 'classnames';
5
4
  import { on } from 'dom-lib';
6
5
  import {
@@ -12,7 +11,7 @@ import {
12
11
  getEdgeOffset,
13
12
  getScrollingParent
14
13
  } from './utils';
15
- import { prefix, defaultProps, getUnhandledProps } from '../utils';
14
+ import { setStatic, prefix, defaultProps, getUnhandledProps } from '../utils';
16
15
  import ListItem from './ListItem';
17
16
  import { ListProps } from './List.d';
18
17
  import Manager from './Manager';
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { setDisplayName } from 'recompose';
4
3
  import classNames from 'classnames';
5
- import { defaultProps, getUnhandledProps, prefix } from '../utils';
4
+ import { setDisplayName, defaultProps, getUnhandledProps, prefix } from '../utils';
6
5
  import ListContext from './ListContext';
7
6
  import { ListItemProps } from './ListItem.d';
8
7
  import { ManagerRef } from './Manager';
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
 
6
- import { withStyleProps, defaultProps, prefix } from '../utils';
5
+ import { compose, withStyleProps, defaultProps, prefix } from '../utils';
7
6
  import { LoaderProps } from './Loader.d';
8
7
 
9
8
  class Loader extends React.Component<LoaderProps> {
@@ -50,6 +50,7 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
50
50
  lastFocus = null;
51
51
  onDocumentKeyupListener = null;
52
52
  onFocusinListener = null;
53
+ _isMounted = null;
53
54
 
54
55
  constructor(props: BaseModalProps) {
55
56
  super(props);
@@ -59,6 +60,7 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
59
60
  this.dialogRef = React.createRef();
60
61
  }
61
62
  componentDidMount() {
63
+ this._isMounted = true;
62
64
  if (this.props.show) {
63
65
  this.onShow();
64
66
  }
@@ -95,6 +97,8 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
95
97
  componentWillUnmount() {
96
98
  const { show, transition } = this.props;
97
99
 
100
+ this._isMounted = false;
101
+
98
102
  if (show || (transition && !this.state.exited)) {
99
103
  this.onHide();
100
104
  }
@@ -173,14 +177,28 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
173
177
  enforceFocus = () => {
174
178
  const { enforceFocus } = this.props;
175
179
 
176
- if (!enforceFocus || !this.isTopModal()) {
180
+ if (!enforceFocus || !this._isMounted || !this.isTopModal()) {
181
+ return;
182
+ }
183
+
184
+ const currentActiveElement = activeElement(ownerDocument(this));
185
+ const modal = this.getDialogElement();
186
+
187
+ if (modal && modal !== currentActiveElement && !contains(modal, currentActiveElement)) {
188
+ modal.focus();
189
+ }
190
+ };
191
+
192
+ handlePortalRendered = () => {
193
+ if (!this.props.autoFocus) {
177
194
  return;
178
195
  }
179
196
 
180
- const active = activeElement(ownerDocument(this));
181
197
  const modal = this.getDialogElement();
198
+ const currentActiveElement = activeElement(ownerDocument(this));
182
199
 
183
- if (modal && modal !== active && !contains(modal, active)) {
200
+ if (modal && modal !== currentActiveElement && !contains(modal, currentActiveElement)) {
201
+ this.lastFocus = currentActiveElement;
184
202
  modal.focus();
185
203
  }
186
204
  };
@@ -268,7 +286,11 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
268
286
  }
269
287
 
270
288
  return (
271
- <Portal ref={this.setMountNodeRef} container={container}>
289
+ <Portal
290
+ ref={this.setMountNodeRef}
291
+ container={container}
292
+ onRendered={this.handlePortalRendered}
293
+ >
272
294
  <div ref={this.modalNodeRef} role={rest.role} style={style} className={className}>
273
295
  {backdrop && this.renderBackdrop()}
274
296
  <RefHolder ref={this.dialogRef}>{dialog}</RefHolder>
@@ -2,12 +2,11 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import _ from 'lodash';
5
- import { setStatic } from 'recompose';
6
5
  import bindElementResize, { unbind as unbindElementResize } from 'element-resize-event';
7
6
  import BaseModal from './BaseModal';
8
7
  import Bounce from '../Animation/Bounce';
9
8
  import { on, getHeight } from 'dom-lib';
10
- import { prefix, defaultProps, createChainedFunction } from '../utils';
9
+ import { setStatic, prefix, defaultProps, createChainedFunction } from '../utils';
11
10
  import ModalDialog, { modalDialogPropTypes } from './ModalDialog';
12
11
  import ModalBody from './ModalBody';
13
12
  import ModalHeader from './ModalHeader';
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
 
6
- import { withStyleProps, defaultProps, prefix, refType } from '../utils';
5
+ import { compose, withStyleProps, defaultProps, prefix, refType } from '../utils';
7
6
  import { ModalDialogProps } from './ModalDialog.d';
8
7
  import mergeRefs from '../utils/mergeRefs';
9
8
 
@@ -54,6 +53,7 @@ class ModalDialog extends React.Component<ModalDialogProps> {
54
53
  {...props}
55
54
  title={null}
56
55
  role="dialog"
56
+ tabIndex={-1}
57
57
  ref={mergeRefs(this.bindHtmlRef, dialogRef)}
58
58
  className={classNames(classPrefix, className)}
59
59
  style={modalStyle}
@@ -124,4 +124,9 @@ describe('Modal', () => {
124
124
  const instance = getInstance(<Modal classPrefix="custom-prefix" show />);
125
125
  assert.ok(instance.dialogElement.className.match(/\bcustom-prefix\b/));
126
126
  });
127
+
128
+ it('Should be forced to focus on Modal', () => {
129
+ const instance = getInstance(<Modal className="custom" show />);
130
+ assert.equal(instance.dialogElement, document.activeElement);
131
+ });
127
132
  });
@@ -80,6 +80,8 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
80
80
  menuContainerRef: React.RefObject<any>;
81
81
  positionRef: React.RefObject<any>;
82
82
  triggerRef: React.RefObject<any>;
83
+ toggleRef: React.RefObject<any>;
84
+
83
85
  constructor(props) {
84
86
  super(props);
85
87
 
@@ -115,6 +117,7 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
115
117
  this.menuContainerRef = React.createRef();
116
118
  this.positionRef = React.createRef();
117
119
  this.triggerRef = React.createRef();
120
+ this.toggleRef = React.createRef();
118
121
  }
119
122
 
120
123
  static getCascadeState(nextProps: MultiCascaderProps, flattenData: any[], nextValue?: any[]) {
@@ -321,6 +324,13 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
321
324
  }
322
325
  return items;
323
326
  }
327
+ getPositionInstance = () => {
328
+ return this.positionRef.current;
329
+ };
330
+
331
+ getToggleInstance = () => {
332
+ return this.toggleRef.current;
333
+ };
324
334
 
325
335
  renderSearchRow = (item: any, key: number) => {
326
336
  const { labelKey, valueKey, cascade, disabledItemValues = [] } = this.props;
@@ -422,7 +432,12 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
422
432
  const menuProps = _.pick(this.props, Object.keys(dropdownMenuPropTypes));
423
433
 
424
434
  return (
425
- <MenuWrapper className={classes} style={menuStyle}>
435
+ <MenuWrapper
436
+ className={classes}
437
+ style={menuStyle}
438
+ getToggleInstance={this.getToggleInstance}
439
+ getPositionInstance={this.getPositionInstance}
440
+ >
426
441
  {searchable && (
427
442
  <SearchBar
428
443
  placeholder={locale.searchPlaceholder}
@@ -533,6 +548,7 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
533
548
  >
534
549
  <PickerToggle
535
550
  {...unhandled}
551
+ ref={this.toggleRef}
536
552
  componentClass={toggleComponentClass}
537
553
  onClean={createChainedFunction(this.handleClean, onClean)}
538
554
  cleanable={cleanable && !disabled}
package/src/Nav/Nav.tsx CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { setStatic } from 'recompose';
5
4
  import shallowEqual from '../utils/shallowEqual';
6
5
 
7
6
  import NavItem from './NavItem';
8
7
  import {
8
+ setStatic,
9
9
  prefix,
10
10
  getUnhandledProps,
11
11
  defaultProps,
@@ -1,10 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { setStatic } from 'recompose';
5
4
  import NavbarBody from './NavbarBody';
6
5
  import NavbarHeader from './NavbarHeader';
7
- import { prefix, defaultProps, createContext } from '../utils';
6
+ import { setStatic, prefix, defaultProps, createContext } from '../utils';
8
7
  import { NavbarProps } from './Navbar.d';
9
8
 
10
9
  export const NavbarContext = createContext(null);
@@ -1,12 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
  import PaginationButton from './PaginationButton';
6
5
  import SafeAnchor from '../SafeAnchor';
7
6
  import Icon from '../Icon';
8
7
 
9
- import { withStyleProps, defaultProps, getUnhandledProps } from '../utils';
8
+ import { compose, withStyleProps, defaultProps, getUnhandledProps } from '../utils';
10
9
  import { PAGINATION_ICON_NAMES } from '../constants';
11
10
  import { PaginationProps } from './Pagination.d';
12
11
 
package/src/Rate/Rate.tsx CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
 
6
- import { defaultProps, prefix, getUnhandledProps, withStyleProps } from '../utils';
5
+ import { compose, defaultProps, prefix, getUnhandledProps, withStyleProps } from '../utils';
7
6
  import { transformValueToCharacterMap, transformCharacterMapToValue } from './utils';
8
7
  import shallowEqualArray from '../utils/shallowEqualArray';
9
8
  import Icon from '../Icon';
@@ -1,14 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { setStatic } from 'recompose';
5
4
  import Transition from '../Animation/Transition';
6
5
  import shallowEqual from '../utils/shallowEqual';
7
6
  import _ from 'lodash';
8
7
  import SidenavBody from './SidenavBody';
9
8
  import SidenavHeader from './SidenavHeader';
10
9
  import SidenavToggle from './SidenavToggle';
11
- import { prefix, defaultProps, getUnhandledProps, createContext } from '../utils';
10
+ import { setStatic, prefix, defaultProps, getUnhandledProps, createContext } from '../utils';
12
11
  import { SidenavProps } from './Sidenav.d';
13
12
 
14
13
  export const SidenavContext = createContext(null);
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
- import { StandardProps } from '../@types/common';
2
+ import { StandardProps, FormControlBaseProps } from '../@types/common';
3
3
 
4
- export interface SliderProps<ValueType = number> extends StandardProps {
4
+ export interface SliderProps<ValueType = number>
5
+ extends StandardProps,
6
+ FormControlBaseProps<ValueType> {
5
7
  /** Minimum value of sliding range */
6
8
  min?: number;
7
9
 
@@ -11,12 +13,6 @@ export interface SliderProps<ValueType = number> extends StandardProps {
11
13
  /** Slide the value of one step */
12
14
  step?: number;
13
15
 
14
- /** Value (Controlled) */
15
- value?: ValueType;
16
-
17
- /** Default value */
18
- defaultValue?: ValueType;
19
-
20
16
  /** A css class to apply to the Handle node. */
21
17
  handleClassName?: string;
22
18
 
@@ -44,9 +40,6 @@ export interface SliderProps<ValueType = number> extends StandardProps {
44
40
  /** Vertical Slide */
45
41
  vertical?: boolean;
46
42
 
47
- /** Callback function that changes data */
48
- onChange?: (value: ValueType, event: React.MouseEvent) => void;
49
-
50
43
  /** Customize labels on the render ruler */
51
44
  renderMark?: (mark: number) => React.ReactNode;
52
45
  }
@@ -2,10 +2,9 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import _ from 'lodash';
4
4
  import classNames from 'classnames';
5
- import { setStatic } from 'recompose';
6
5
 
7
6
  import StepItem from './StepItem';
8
- import { prefix, defaultProps, ReactChildren, isIE10 } from '../utils';
7
+ import { setStatic, prefix, defaultProps, ReactChildren, isIE10 } from '../utils';
9
8
  import { StepsProps } from './Steps.d';
10
9
 
11
10
  class Steps extends React.Component<StepsProps> {
@@ -1,7 +1,6 @@
1
- import { setStatic, compose } from 'recompose';
2
1
  import { Table, Column, Cell, HeaderCell, ColumnGroup } from 'rsuite-table';
3
2
 
4
- import { defaultProps } from '../utils';
3
+ import { setStatic, compose, defaultProps } from '../utils';
5
4
  import withLocale from '../IntlProvider/withLocale';
6
5
  import TablePagination from './TablePagination';
7
6
 
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { compose } from 'recompose';
5
4
 
6
5
  import Pagination from '../Pagination';
7
6
  import SelectPicker from '../SelectPicker';
8
7
  import Divider from '../Divider';
9
8
 
10
- import { prefix, tplTransform, getUnhandledProps, defaultProps } from '../utils';
9
+ import { compose, prefix, tplTransform, getUnhandledProps, defaultProps } from '../utils';
11
10
  import withLocale from '../IntlProvider/withLocale';
12
11
  import { TablePaginationProps } from './TablePagination.d';
13
12
 
package/src/Tag/Tag.tsx CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
- import { compose } from 'recompose';
5
- import { prefix, withStyleProps, defaultProps } from '../utils';
4
+ import { compose, prefix, withStyleProps, defaultProps } from '../utils';
6
5
  import { TagProps } from './Tag.d';
7
6
 
8
7
  class Tag extends React.Component<TagProps> {
@@ -1,6 +1,4 @@
1
- import { compose } from 'recompose';
2
-
3
- import { defaultProps } from '../utils';
1
+ import { compose, defaultProps } from '../utils';
4
2
  import InputPicker from '../InputPicker/InputPicker';
5
3
  import withLocale from '../IntlProvider/withLocale';
6
4
 
@@ -2,10 +2,9 @@ import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import _ from 'lodash';
5
- import { setStatic } from 'recompose';
6
5
 
7
6
  import TimelineItem from './TimelineItem';
8
- import { defaultProps, prefix, ReactChildren } from '../utils';
7
+ import { setStatic, defaultProps, prefix, ReactChildren } from '../utils';
9
8
  import { TimelineProps } from './Timeline.d';
10
9
 
11
10
  class Timeline extends React.Component<TimelineProps> {