rsuite 4.8.5 → 4.8.9

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 (270) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/rsuite.js +21 -21
  3. package/dist/rsuite.min.js +1 -1
  4. package/dist/rsuite.min.js.map +1 -1
  5. package/dist/styles/rsuite-dark-rtl.css +46 -52
  6. package/dist/styles/rsuite-dark-rtl.min.css +1 -1
  7. package/dist/styles/rsuite-dark-rtl.min.css.map +1 -1
  8. package/dist/styles/rsuite-dark.css +46 -52
  9. package/dist/styles/rsuite-dark.min.css +1 -1
  10. package/dist/styles/rsuite-dark.min.css.map +1 -1
  11. package/dist/styles/rsuite-default-rtl.css +46 -52
  12. package/dist/styles/rsuite-default-rtl.min.css +1 -1
  13. package/dist/styles/rsuite-default-rtl.min.css.map +1 -1
  14. package/dist/styles/rsuite-default.css +46 -52
  15. package/dist/styles/rsuite-default.min.css +1 -1
  16. package/dist/styles/rsuite-default.min.css.map +1 -1
  17. package/es/Alert/styles/common.less +1 -1
  18. package/es/AutoComplete/styles/common.less +3 -3
  19. package/es/Avatar/styles/common.less +5 -5
  20. package/es/Avatar/styles/mixin.less +1 -1
  21. package/es/Button/styles/common.less +6 -6
  22. package/es/Button/styles/mixin.less +17 -17
  23. package/es/ButtonGroup/styles/common.less +5 -5
  24. package/es/Calendar/styles/common.less +14 -14
  25. package/es/Carousel/styles/common.less +1 -1
  26. package/es/Cascader/Cascader.js +2 -1
  27. package/es/Cascader/styles/common.less +4 -4
  28. package/es/CheckPicker/CheckPicker.js +2 -1
  29. package/es/CheckPicker/styles/common.less +2 -2
  30. package/es/CheckTreePicker/CheckTreePicker.js +2 -1
  31. package/es/CheckTreePicker/styles/common.less +5 -5
  32. package/es/Checkbox/styles/common.less +3 -3
  33. package/es/Checkbox/styles/mixin.less +1 -1
  34. package/es/DatePicker/DatePicker.js +2 -1
  35. package/es/DatePicker/styles/common.less +1 -1
  36. package/es/DateRangePicker/DateRangePicker.js +2 -1
  37. package/es/Drawer/styles/common.less +5 -5
  38. package/es/Dropdown/Dropdown.js +13 -4
  39. package/es/Dropdown/styles/common.less +3 -3
  40. package/es/FlexboxGrid/styles/common.less +1 -1
  41. package/es/Form/styles/common.less +2 -1
  42. package/es/Form/styles/mixin.less +4 -4
  43. package/es/FormControl/styles/common.less +0 -1
  44. package/es/FormGroup/styles/common.less +1 -1
  45. package/es/Grid/styles/common.less +1 -1
  46. package/es/Grid/styles/mixin.less +2 -2
  47. package/es/HelpBlock/styles/common.less +1 -1
  48. package/es/IconButton/styles/common.less +16 -14
  49. package/es/Input/styles/common.less +6 -10
  50. package/es/InputGroup/styles/common.less +1 -1
  51. package/es/InputNumber/styles/mixin.less +2 -2
  52. package/es/InputPicker/InputAutosize.js +11 -6
  53. package/es/InputPicker/styles/common.less +4 -4
  54. package/es/Loader/styles/common.less +3 -3
  55. package/es/Loader/styles/mixin.less +2 -2
  56. package/es/Message/styles/common.less +3 -3
  57. package/es/Modal/BaseModal.js +1 -1
  58. package/es/Modal/Modal.js +5 -5
  59. package/es/Modal/ModalDialog.js +3 -1
  60. package/es/Modal/styles/common.less +5 -5
  61. package/es/MultiCascader/MultiCascader.js +2 -1
  62. package/es/MultiCascader/styles/common.less +1 -1
  63. package/es/Nav/styles/common.less +2 -2
  64. package/es/Navbar/styles/common.less +2 -2
  65. package/es/Notification/styles/common.less +4 -4
  66. package/es/Overlay/Overlay.js +1 -1
  67. package/es/Pagination/styles/common.less +2 -2
  68. package/es/Pagination/styles/mixin.less +6 -7
  69. package/es/Panel/Panel.js +0 -1
  70. package/es/Panel/styles/common.less +1 -1
  71. package/es/Picker/DropdownMenu.js +3 -1
  72. package/es/Picker/propTypes.js +1 -1
  73. package/es/Picker/styles/common.less +28 -28
  74. package/es/Picker/styles/mixin.less +3 -3
  75. package/es/Popover/styles/common.less +4 -4
  76. package/es/Progress/styles/common.less +5 -5
  77. package/es/Radio/styles/common.less +5 -5
  78. package/es/Rate/styles/common.less +2 -2
  79. package/es/SelectPicker/SelectPicker.js +2 -1
  80. package/es/SelectPicker/styles/common.less +4 -4
  81. package/es/Sidenav/styles/common.less +3 -3
  82. package/es/Slider/styles/common.less +9 -9
  83. package/es/Steps/styles/common.less +13 -13
  84. package/es/Table/styles/common.less +6 -10
  85. package/es/Tag/styles/common.less +2 -2
  86. package/es/TagPicker/styles/common.less +4 -4
  87. package/es/Timeline/styles/common.less +5 -5
  88. package/es/Timeline/styles/mixin.less +1 -1
  89. package/es/Toggle/styles/mixin.less +5 -5
  90. package/es/Tooltip/styles/common.less +4 -4
  91. package/es/TreePicker/TreePicker.js +2 -1
  92. package/es/TreePicker/styles/common.less +3 -3
  93. package/es/Uploader/styles/common.less +17 -17
  94. package/es/styles/mixins/utilities.less +1 -1
  95. package/es/styles/variables.less +58 -48
  96. package/es/utils/index.js +2 -1
  97. package/lib/Alert/styles/common.less +1 -1
  98. package/lib/AutoComplete/styles/common.less +3 -3
  99. package/lib/Avatar/styles/common.less +5 -5
  100. package/lib/Avatar/styles/mixin.less +1 -1
  101. package/lib/Button/styles/common.less +6 -6
  102. package/lib/Button/styles/mixin.less +17 -17
  103. package/lib/ButtonGroup/styles/common.less +5 -5
  104. package/lib/Calendar/styles/common.less +14 -14
  105. package/lib/Carousel/styles/common.less +1 -1
  106. package/lib/Cascader/Cascader.js +2 -1
  107. package/lib/Cascader/styles/common.less +4 -4
  108. package/lib/CheckPicker/CheckPicker.js +2 -1
  109. package/lib/CheckPicker/styles/common.less +2 -2
  110. package/lib/CheckTreePicker/CheckTreePicker.js +2 -1
  111. package/lib/CheckTreePicker/styles/common.less +5 -5
  112. package/lib/Checkbox/styles/common.less +3 -3
  113. package/lib/Checkbox/styles/mixin.less +1 -1
  114. package/lib/DatePicker/DatePicker.js +2 -1
  115. package/lib/DatePicker/styles/common.less +1 -1
  116. package/lib/DateRangePicker/DateRangePicker.js +2 -1
  117. package/lib/Drawer/styles/common.less +5 -5
  118. package/lib/Dropdown/Dropdown.js +13 -3
  119. package/lib/Dropdown/styles/common.less +3 -3
  120. package/lib/FlexboxGrid/styles/common.less +1 -1
  121. package/lib/Form/styles/common.less +2 -1
  122. package/lib/Form/styles/mixin.less +4 -4
  123. package/lib/FormControl/styles/common.less +0 -1
  124. package/lib/FormGroup/styles/common.less +1 -1
  125. package/lib/Grid/styles/common.less +1 -1
  126. package/lib/Grid/styles/mixin.less +2 -2
  127. package/lib/HelpBlock/styles/common.less +1 -1
  128. package/lib/IconButton/styles/common.less +16 -14
  129. package/lib/Input/styles/common.less +6 -10
  130. package/lib/InputGroup/styles/common.less +1 -1
  131. package/lib/InputNumber/styles/mixin.less +2 -2
  132. package/lib/InputPicker/InputAutosize.js +11 -6
  133. package/lib/InputPicker/styles/common.less +4 -4
  134. package/lib/Loader/styles/common.less +3 -3
  135. package/lib/Loader/styles/mixin.less +2 -2
  136. package/lib/Message/styles/common.less +3 -3
  137. package/lib/Modal/BaseModal.js +1 -1
  138. package/lib/Modal/Modal.js +5 -5
  139. package/lib/Modal/ModalDialog.js +3 -1
  140. package/lib/Modal/styles/common.less +5 -5
  141. package/lib/MultiCascader/MultiCascader.js +2 -1
  142. package/lib/MultiCascader/styles/common.less +1 -1
  143. package/lib/Nav/styles/common.less +2 -2
  144. package/lib/Navbar/styles/common.less +2 -2
  145. package/lib/Notification/styles/common.less +4 -4
  146. package/lib/Overlay/Overlay.js +1 -1
  147. package/lib/Pagination/styles/common.less +2 -2
  148. package/lib/Pagination/styles/mixin.less +6 -7
  149. package/lib/Panel/Panel.js +0 -1
  150. package/lib/Panel/styles/common.less +1 -1
  151. package/lib/Picker/DropdownMenu.js +3 -1
  152. package/lib/Picker/propTypes.js +1 -1
  153. package/lib/Picker/styles/common.less +28 -28
  154. package/lib/Picker/styles/mixin.less +3 -3
  155. package/lib/Popover/styles/common.less +4 -4
  156. package/lib/Progress/styles/common.less +5 -5
  157. package/lib/Radio/styles/common.less +5 -5
  158. package/lib/Rate/styles/common.less +2 -2
  159. package/lib/SelectPicker/SelectPicker.js +2 -1
  160. package/lib/SelectPicker/styles/common.less +4 -4
  161. package/lib/Sidenav/styles/common.less +3 -3
  162. package/lib/Slider/styles/common.less +9 -9
  163. package/lib/Steps/styles/common.less +13 -13
  164. package/lib/Table/styles/common.less +6 -10
  165. package/lib/Tag/styles/common.less +2 -2
  166. package/lib/TagPicker/styles/common.less +4 -4
  167. package/lib/Timeline/styles/common.less +5 -5
  168. package/lib/Timeline/styles/mixin.less +1 -1
  169. package/lib/Toggle/styles/mixin.less +5 -5
  170. package/lib/Tooltip/styles/common.less +4 -4
  171. package/lib/TreePicker/TreePicker.js +2 -1
  172. package/lib/TreePicker/styles/common.less +3 -3
  173. package/lib/Uploader/styles/common.less +17 -17
  174. package/lib/styles/mixins/utilities.less +1 -1
  175. package/lib/styles/variables.less +58 -48
  176. package/lib/utils/index.js +7 -2
  177. package/package.json +7 -5
  178. package/src/Alert/styles/common.less +1 -1
  179. package/src/AutoComplete/styles/common.less +3 -3
  180. package/src/Avatar/styles/common.less +5 -5
  181. package/src/Avatar/styles/mixin.less +1 -1
  182. package/src/Button/styles/common.less +6 -6
  183. package/src/Button/styles/mixin.less +17 -17
  184. package/src/ButtonGroup/styles/common.less +5 -5
  185. package/src/Calendar/styles/common.less +14 -14
  186. package/src/Carousel/styles/common.less +1 -1
  187. package/src/Cascader/Cascader.tsx +1 -0
  188. package/src/Cascader/styles/common.less +4 -4
  189. package/src/Cascader/test/CascaderSpec.js +1 -0
  190. package/src/CheckPicker/CheckPicker.tsx +1 -0
  191. package/src/CheckPicker/styles/common.less +2 -2
  192. package/src/CheckPicker/test/CheckPickerSpec.js +1 -0
  193. package/src/CheckTreePicker/CheckTreePicker.tsx +1 -0
  194. package/src/CheckTreePicker/styles/common.less +5 -5
  195. package/src/CheckTreePicker/test/CheckTreePickerSpec.js +1 -0
  196. package/src/Checkbox/styles/common.less +3 -3
  197. package/src/Checkbox/styles/mixin.less +1 -1
  198. package/src/DatePicker/DatePicker.tsx +1 -0
  199. package/src/DatePicker/styles/common.less +1 -1
  200. package/src/DatePicker/test/DatePickerSpec.js +1 -0
  201. package/src/DateRangePicker/DateRangePicker.tsx +1 -0
  202. package/src/DateRangePicker/test/DateRangePickerSpec.js +1 -0
  203. package/src/Drawer/styles/common.less +5 -5
  204. package/src/Drawer/test/DrawerSpec.js +14 -0
  205. package/src/Dropdown/Dropdown.tsx +20 -6
  206. package/src/Dropdown/styles/common.less +3 -3
  207. package/src/FlexboxGrid/styles/common.less +1 -1
  208. package/src/Form/styles/common.less +2 -1
  209. package/src/Form/styles/mixin.less +4 -4
  210. package/src/FormControl/styles/common.less +0 -1
  211. package/src/FormGroup/styles/common.less +1 -1
  212. package/src/Grid/styles/common.less +1 -1
  213. package/src/Grid/styles/mixin.less +2 -2
  214. package/src/HelpBlock/styles/common.less +1 -1
  215. package/src/IconButton/styles/common.less +16 -14
  216. package/src/Input/styles/common.less +6 -10
  217. package/src/Input/test/InputStylesSpec.js +0 -8
  218. package/src/InputGroup/styles/common.less +1 -1
  219. package/src/InputNumber/styles/mixin.less +2 -2
  220. package/src/InputPicker/InputAutosize.tsx +15 -10
  221. package/src/InputPicker/styles/common.less +4 -4
  222. package/src/Loader/styles/common.less +3 -3
  223. package/src/Loader/styles/mixin.less +2 -2
  224. package/src/Message/styles/common.less +3 -3
  225. package/src/Modal/BaseModal.tsx +1 -6
  226. package/src/Modal/Modal.tsx +5 -5
  227. package/src/Modal/ModalDialog.tsx +3 -1
  228. package/src/Modal/styles/common.less +5 -5
  229. package/src/Modal/test/ModalSpec.js +13 -0
  230. package/src/MultiCascader/MultiCascader.tsx +1 -0
  231. package/src/MultiCascader/styles/common.less +1 -1
  232. package/src/MultiCascader/test/MultiCascaderSpec.js +1 -0
  233. package/src/Nav/styles/common.less +2 -2
  234. package/src/Navbar/styles/common.less +2 -2
  235. package/src/Notification/styles/common.less +4 -4
  236. package/src/Overlay/Overlay.tsx +1 -1
  237. package/src/Pagination/styles/common.less +2 -2
  238. package/src/Pagination/styles/mixin.less +6 -7
  239. package/src/Panel/Panel.tsx +0 -1
  240. package/src/Panel/styles/common.less +1 -1
  241. package/src/Picker/DropdownMenu.tsx +3 -1
  242. package/src/Picker/propTypes.ts +1 -1
  243. package/src/Picker/styles/common.less +28 -28
  244. package/src/Picker/styles/mixin.less +3 -3
  245. package/src/Picker/test/DropdownMenuSpec.js +21 -0
  246. package/src/Popover/styles/common.less +4 -4
  247. package/src/Popover/test/PopoverStylesSpec.js +1 -1
  248. package/src/Progress/styles/common.less +5 -5
  249. package/src/Radio/styles/common.less +5 -5
  250. package/src/Rate/styles/common.less +2 -2
  251. package/src/SelectPicker/SelectPicker.tsx +1 -0
  252. package/src/SelectPicker/styles/common.less +4 -4
  253. package/src/SelectPicker/test/SelectPickerSpec.js +1 -0
  254. package/src/Sidenav/styles/common.less +3 -3
  255. package/src/Slider/styles/common.less +9 -9
  256. package/src/Steps/styles/common.less +13 -13
  257. package/src/Table/styles/common.less +6 -10
  258. package/src/Tag/styles/common.less +2 -2
  259. package/src/TagPicker/styles/common.less +4 -4
  260. package/src/Timeline/styles/common.less +5 -5
  261. package/src/Timeline/styles/mixin.less +1 -1
  262. package/src/Toggle/styles/mixin.less +5 -5
  263. package/src/Tooltip/styles/common.less +4 -4
  264. package/src/TreePicker/TreePicker.tsx +1 -0
  265. package/src/TreePicker/styles/common.less +3 -3
  266. package/src/TreePicker/test/TreePickerSpec.js +1 -0
  267. package/src/Uploader/styles/common.less +17 -17
  268. package/src/styles/mixins/utilities.less +1 -1
  269. package/src/styles/variables.less +58 -48
  270. package/src/utils/index.ts +1 -0
@@ -3,9 +3,10 @@ import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import _ from 'lodash';
5
5
  import { setStatic } from 'recompose';
6
+ import { contains } from 'dom-lib';
7
+
6
8
  import RootCloseWrapper from '../Overlay/RootCloseWrapper';
7
9
  import shallowEqual from '../utils/shallowEqual';
8
-
9
10
  import DropdownToggle from './DropdownToggle';
10
11
  import DropdownMenu from './DropdownMenu';
11
12
  import DropdownMenuItem from './DropdownMenuItem';
@@ -15,7 +16,8 @@ import {
15
16
  isOneOf,
16
17
  getUnhandledProps,
17
18
  defaultProps,
18
- placementPolyfill
19
+ placementPolyfill,
20
+ getDOMNode
19
21
  } from '../utils';
20
22
  import { SidenavContext } from '../Sidenav/Sidenav';
21
23
  import { PLACEMENT_8 } from '../constants';
@@ -72,12 +74,13 @@ class Dropdown extends React.Component<DropdownProps, DropdownState> {
72
74
  trigger: 'click',
73
75
  tabIndex: 0
74
76
  };
75
-
77
+ rootRef: React.RefObject<any>;
76
78
  constructor(props: DropdownProps) {
77
79
  super(props);
78
80
  this.state = {
79
81
  open: props.open
80
82
  };
83
+ this.rootRef = React.createRef();
81
84
  }
82
85
 
83
86
  getOpen() {
@@ -99,8 +102,13 @@ class Dropdown extends React.Component<DropdownProps, DropdownState> {
99
102
  };
100
103
 
101
104
  handleRootClose = (event: React.SyntheticEvent) => {
102
- event.preventDefault();
103
- event.stopPropagation();
105
+ // Prevent the event from bubbling when closing the overlay is triggered by its own element.
106
+ // fix#1435
107
+ if (contains(getDOMNode(this.rootRef.current), event.target)) {
108
+ event.preventDefault();
109
+ event.stopPropagation();
110
+ }
111
+
104
112
  this.setState({ open: false });
105
113
  this.props.onToggle?.(false);
106
114
  this.props.onClose?.();
@@ -250,7 +258,13 @@ class Dropdown extends React.Component<DropdownProps, DropdownState> {
250
258
  });
251
259
 
252
260
  return (
253
- <Component {...dropdownProps} style={style} className={classes} role="menu">
261
+ <Component
262
+ ref={this.rootRef}
263
+ {...dropdownProps}
264
+ style={style}
265
+ className={classes}
266
+ role="menu"
267
+ >
254
268
  {menu}
255
269
  {toggle}
256
270
  </Component>
@@ -6,7 +6,7 @@
6
6
  // --------------------------------------------------
7
7
 
8
8
  .@{ns}dropdown-toggle-caret {
9
- .dropdown-toggle-caret-common;
9
+ .dropdown-toggle-caret-common();
10
10
  .set-dropdown-caret(~'@{ns}dropdown');
11
11
  }
12
12
 
@@ -86,12 +86,12 @@
86
86
  }
87
87
 
88
88
  .@{ns}dropdown-toggle {
89
- .dropdown-toggle-size;
89
+ .dropdown-toggle-size();
90
90
 
91
91
  &,
92
92
  &.@{ns}btn {
93
93
  // Force set style even if has `.btn`.
94
- .dropdown-toggle;
94
+ .dropdown-toggle();
95
95
  }
96
96
  }
97
97
 
@@ -59,4 +59,4 @@
59
59
  }
60
60
 
61
61
  // Generate the flex grid.
62
- .make-flex-box-grid;
62
+ .make-flex-box-grid();
@@ -6,7 +6,7 @@
6
6
  .@{ns}form-inline {
7
7
  > *,
8
8
  > .@{ns}btn {
9
- margin-right: 30px;
9
+ margin-right: 20px;
10
10
  margin-bottom: 24px;
11
11
  vertical-align: top;
12
12
  }
@@ -14,6 +14,7 @@
14
14
  .rs-control-label {
15
15
  vertical-align: top;
16
16
  margin-bottom: auto;
17
+ margin-right: @control-label-margin-right;
17
18
  margin-top: @padding-base-vertical;
18
19
  display: inline-block;
19
20
  }
@@ -7,7 +7,7 @@
7
7
  border: @input-border-width solid @input-border;
8
8
  transition: @input-transition;
9
9
  border-radius: @border-radius-base;
10
- .input-base;
10
+ .input-base();
11
11
 
12
12
  // Placeholder
13
13
  &::placeholder {
@@ -81,7 +81,7 @@
81
81
  }
82
82
 
83
83
  .input-base() {
84
- .input-md;
84
+ .input-md();
85
85
  }
86
86
 
87
87
  .reset-input-group-addon-size(@size-name) {
@@ -90,7 +90,7 @@
90
90
  @width: @@padding-horizontal-name * 2 - @input-border-width*2 + @font-size-base;
91
91
  @padding-horizontal: (@width - @font-size-base)/2;
92
92
 
93
- width: @width;
93
+ min-width: @width;
94
94
  padding-left: @padding-horizontal;
95
95
  padding-right: @padding-horizontal;
96
96
  }
@@ -123,7 +123,7 @@
123
123
  padding-right: @@add-on-padding;
124
124
  }
125
125
 
126
- &.@{ns}input-group:not(.@{ns}input-group-inside) {
126
+ &.@{ns}input-group {
127
127
  > .@{ns}input {
128
128
  height: @useable-height;
129
129
  }
@@ -63,7 +63,6 @@
63
63
  .@{ns}form-inline .@{ns}form-group {
64
64
  .@{ns}form-control-wrapper {
65
65
  display: inline-block;
66
- margin-left: @form-control-margin-left;
67
66
  }
68
67
 
69
68
  // Form control wrapper behind Screen only dom no need margin left.
@@ -37,7 +37,7 @@
37
37
  // labels on the left and inputs on the right.
38
38
 
39
39
  .@{ns}form-horizontal .@{ns}form-group {
40
- .clearfix;
40
+ .clearfix();
41
41
 
42
42
  .@{ns}control-label {
43
43
  float: left;
@@ -76,4 +76,4 @@
76
76
  // Hiddens
77
77
  //
78
78
  // All hidden styles.
79
- .make-hidden;
79
+ .make-hidden();
@@ -8,14 +8,14 @@
8
8
  margin-left: auto;
9
9
  padding-left: floor((@gutter / 2));
10
10
  padding-right: ceil((@gutter / 2));
11
- .clearfix;
11
+ .clearfix();
12
12
  }
13
13
 
14
14
  // Creates a wrapper for a series of columns
15
15
  .make-row(@gutter: @grid-gutter-width) {
16
16
  margin-left: ceil((@gutter / -2));
17
17
  margin-right: floor((@gutter / -2));
18
- .clearfix;
18
+ .clearfix();
19
19
  }
20
20
 
21
21
  // Generate the extra small columns
@@ -20,7 +20,7 @@
20
20
  margin-top: @padding-base-vertical;
21
21
 
22
22
  .@{ns}icon::before {
23
- .icon-font;
23
+ .icon-font();
24
24
 
25
25
  content: @icon-help-o;
26
26
  }
@@ -13,23 +13,25 @@
13
13
  .@{ns}btn-default {
14
14
  .btn-icon-with-text(@btn-icon-with-text-bg);
15
15
 
16
- &:focus {
17
- .btn-icon-with-text(@btn-icon-with-text-focus-bg);
18
- }
19
-
20
- &:hover {
21
- .btn-icon-with-text(@btn-icon-with-text-hover-bg);
22
- }
16
+ &:not(.@{ns}btn-disabled) {
17
+ &:focus {
18
+ .btn-icon-with-text(@btn-icon-with-text-focus-bg);
19
+ }
23
20
 
24
- &:active,
25
- &.@{ns}btn-active,
26
- .@{ns}open > .@{ns}dropdown-toggle& {
27
- .btn-icon-with-text(@btn-icon-with-text-active-bg);
21
+ &:hover {
22
+ .btn-icon-with-text(@btn-icon-with-text-hover-bg);
23
+ }
28
24
 
29
- &:hover,
30
- &:focus,
31
- &.focus {
25
+ &:active,
26
+ &.@{ns}btn-active,
27
+ .@{ns}open > .@{ns}dropdown-toggle& {
32
28
  .btn-icon-with-text(@btn-icon-with-text-active-bg);
29
+
30
+ &:hover,
31
+ &:focus,
32
+ &.focus {
33
+ .btn-icon-with-text(@btn-icon-with-text-active-bg);
34
+ }
33
35
  }
34
36
  }
35
37
  }
@@ -7,28 +7,24 @@
7
7
 
8
8
  // Common form controls
9
9
  .@{ns}input {
10
- .default-input;
10
+ .default-input();
11
11
 
12
12
  // Reset height for `textarea`
13
13
  textarea& {
14
- resize: none;
15
- // Set textarea valid size
16
- min-width: 300px;
17
- min-height: 76px;
18
- max-width: 100%;
19
- max-height: 200px;
14
+ overflow: auto;
15
+ resize: vertical;
20
16
  }
21
17
  }
22
18
 
23
19
  // Form control sizing
24
20
  .@{ns}input-xs {
25
- .input-xs;
21
+ .input-xs();
26
22
  }
27
23
 
28
24
  .@{ns}input-lg {
29
- .input-lg;
25
+ .input-lg();
30
26
  }
31
27
 
32
28
  .@{ns}input-sm {
33
- .input-sm;
29
+ .input-sm();
34
30
  }
@@ -13,12 +13,4 @@ describe('Input styles', () => {
13
13
  inChrome &&
14
14
  assert.equal(getStyle(dom, 'border'), `1px solid ${toRGB('#e5e5ea')}`, 'Input border');
15
15
  });
16
-
17
- it('Textarea should render the correct styles', () => {
18
- const instanceRef = React.createRef();
19
- ReactDOM.render(<Input ref={instanceRef} componentClass="textarea" />, createTestContainer());
20
- const dom = getDOMNode(instanceRef.current);
21
- assert.equal(getStyle(dom, 'minWidth'), '300px', 'Textarea min-width');
22
- assert.equal(getStyle(dom, 'minHeight'), '76px', 'Textarea min-height');
23
- });
24
16
  });
@@ -131,7 +131,7 @@
131
131
  }
132
132
 
133
133
  .@{ns}input-group-btn {
134
- .btn-subtle;
134
+ .btn-subtle();
135
135
 
136
136
  color: @input-color;
137
137
  position: absolute;
@@ -1,11 +1,11 @@
1
1
  .input-touchspin(@size) {
2
2
  @size-name: ~'input-height-@{size}';
3
- @height: (@@size-name - 2px) / 2;
3
+ @height: ((@@size-name - 2px) / 2);
4
4
 
5
5
  height: @height;
6
6
 
7
7
  > .@{ns}icon {
8
8
  height: @height;
9
- line-height: unit(@height / @number-input-touchspin-font-size);
9
+ line-height: unit((@height / @number-input-touchspin-font-size));
10
10
  }
11
11
  }
@@ -36,6 +36,7 @@ export interface InputAutosizeProps {
36
36
  }
37
37
 
38
38
  interface InputAutosizeState {
39
+ inputId: string;
39
40
  inputWidth: number;
40
41
  }
41
42
 
@@ -54,12 +55,7 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
54
55
  onAutosize: PropTypes.func
55
56
  };
56
57
  static defaultProps = {
57
- minWidth: 1,
58
- inputId:
59
- '_' +
60
- Math.random()
61
- .toString(36)
62
- .substr(2, 12)
58
+ minWidth: 1
63
59
  };
64
60
 
65
61
  inputRef: React.RefObject<any>;
@@ -69,6 +65,11 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
69
65
  constructor(props) {
70
66
  super(props);
71
67
  this.state = {
68
+ inputId:
69
+ '_' +
70
+ Math.random()
71
+ .toString(36)
72
+ .substr(2, 12),
72
73
  inputWidth: props.minWidth
73
74
  };
74
75
 
@@ -81,6 +82,10 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
81
82
  return this.inputRef.current;
82
83
  }
83
84
 
85
+ getInputId = () => {
86
+ return this.props.inputId || this.state.inputId;
87
+ };
88
+
84
89
  componentDidMount() {
85
90
  this.copyInputStyles();
86
91
  this.updateInputWidth();
@@ -135,7 +140,7 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
135
140
  }
136
141
 
137
142
  renderStyles() {
138
- const { inputId } = this.props;
143
+ const inputId = this.getInputId();
139
144
  return isIE() ? (
140
145
  <style
141
146
  dangerouslySetInnerHTML={{
@@ -153,10 +158,10 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
153
158
  className,
154
159
  placeholder,
155
160
  inputClassName,
156
- inputStyle,
157
- inputId
161
+ inputStyle
158
162
  } = this.props;
159
163
 
164
+ const inputId = this.getInputId();
160
165
  const sizerValue = [defaultValue, value, ''].reduce((previousValue, currentValue) => {
161
166
  if (previousValue !== null && previousValue !== undefined) {
162
167
  return previousValue;
@@ -178,7 +183,7 @@ class InputAutosize extends React.Component<InputAutosizeProps, InputAutosizeSta
178
183
  const [htmlInputProps] = partitionHTMLProps(this.props);
179
184
 
180
185
  htmlInputProps.className = inputClassName;
181
- htmlInputProps.id = inputId;
186
+ htmlInputProps.id = inputId || inputId;
182
187
  htmlInputProps.style = nextInputStyle;
183
188
 
184
189
  return (
@@ -29,7 +29,7 @@
29
29
  position: absolute !important;
30
30
  }
31
31
 
32
- .input-picker-input-sizes;
32
+ .input-picker-input-sizes();
33
33
 
34
34
  .@{ns}picker-toggle.@{ns}btn-xs ~ .@{ns}picker-tag-wrapper .@{ns}tag {
35
35
  padding-top: 0;
@@ -43,10 +43,10 @@
43
43
  }
44
44
 
45
45
  .@{ns}picker-tag-wrapper {
46
- padding-right: @dropdown-toggle-padding-right;
46
+ margin-right: @dropdown-toggle-padding-right;
47
47
 
48
48
  .@{ns}picker-cleanable & {
49
- padding-right: @dropdown-toggle-padding-right + @picker-toggle-clean-width;
49
+ margin-right: @dropdown-toggle-padding-right + @picker-toggle-clean-width;
50
50
  }
51
51
  }
52
52
 
@@ -55,7 +55,7 @@
55
55
  width: 100%;
56
56
 
57
57
  &-input {
58
- .input-md;
58
+ .input-md();
59
59
 
60
60
  .@{tag-picker} & {
61
61
  font-size: @font-size-base;
@@ -2,7 +2,7 @@
2
2
  @import 'mixin';
3
3
 
4
4
  .@{ns}loader {
5
- .clearfix;
5
+ .clearfix();
6
6
  .loader-size(@loader-default-diameter, @loader-default-content-font-size);
7
7
 
8
8
  height: @loader-default-diameter;
@@ -14,7 +14,7 @@
14
14
  display: inline-block;
15
15
  float: left;
16
16
 
17
- .loader-spin;
17
+ .loader-spin();
18
18
  }
19
19
 
20
20
  //Loader spin
@@ -57,7 +57,7 @@
57
57
  }
58
58
 
59
59
  .@{ns}loader-content {
60
- line-height: unit(@line-height-computed / @loader-default-content-font-size);
60
+ line-height: unit((@line-height-computed / @loader-default-content-font-size));
61
61
  text-align: center;
62
62
  }
63
63
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  &-content {
19
19
  font-size: @font-size;
20
- line-height: unit(@diameter / @font-size);
20
+ line-height: unit((@diameter / @font-size));
21
21
  }
22
22
 
23
23
  &-vertical & {
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  &-vertical &-content {
28
- line-height: unit(@line-height-computed / @font-size);
28
+ line-height: unit((@line-height-computed / @font-size));
29
29
  }
30
30
  }
31
31
  }
@@ -40,7 +40,7 @@
40
40
  h5 {
41
41
  margin-top: 0;
42
42
  margin-bottom: 0;
43
- .ellipsis;
43
+ .ellipsis();
44
44
 
45
45
  // When title and description all exist , additional a margin
46
46
  & + .@{ns}message-description {
@@ -63,7 +63,7 @@
63
63
  // Header
64
64
  .@{ns}message-header {
65
65
  color: @message-header-color;
66
- line-height: unit(round(@message-icon-large-size / @message-title-size, 16));
66
+ line-height: unit((round(@message-icon-large-size / @message-title-size, 16)));
67
67
  }
68
68
 
69
69
  // Description
@@ -97,7 +97,7 @@
97
97
  border: none;
98
98
  outline: none !important;
99
99
 
100
- .icon-font;
100
+ .icon-font();
101
101
 
102
102
  &::before {
103
103
  content: @default-close-btn-content;
@@ -269,12 +269,7 @@ class BaseModal extends React.Component<BaseModalProps, BaseModalState> {
269
269
 
270
270
  return (
271
271
  <Portal ref={this.setMountNodeRef} container={container}>
272
- <div
273
- ref={this.modalNodeRef}
274
- role={rest.role || 'dialog'}
275
- style={style}
276
- className={className}
277
- >
272
+ <div ref={this.modalNodeRef} role={rest.role} style={style} className={className}>
278
273
  {backdrop && this.renderBackdrop()}
279
274
  <RefHolder ref={this.dialogRef}>{dialog}</RefHolder>
280
275
  </div>
@@ -94,7 +94,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
94
94
  this.destroyEvent();
95
95
  }
96
96
 
97
- getBodyStylesByDialog(dialogElement?: HTMLElement) {
97
+ getBodyStylesByDialog(dialogElement?: HTMLElement, entering?: boolean) {
98
98
  const { overflow, drawer } = this.props;
99
99
  const node = dialogElement || this.dialogElement;
100
100
  const scrollHeight = node ? node.scrollHeight : 0;
@@ -127,7 +127,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
127
127
  /**
128
128
  * Header height + Footer height + Dialog margin
129
129
  */
130
- const excludeHeight = headerHeight + footerHeight + 60;
130
+ const excludeHeight = headerHeight + footerHeight + (entering ? 76 : 60);
131
131
  const bodyHeight = getHeight(window) - excludeHeight;
132
132
  const maxHeight = scrollHeight >= bodyHeight ? bodyHeight : scrollHeight;
133
133
  bodyStyles.maxHeight = maxHeight;
@@ -155,7 +155,7 @@ class Modal extends React.Component<ModalProps, ModalState> {
155
155
  bindElementResize(this.contentElement, this.handleResize);
156
156
  };
157
157
  handleShowing = () => {
158
- this.updateModalStyles(this.dialogElement);
158
+ this.updateModalStyles(this.dialogElement, true);
159
159
  };
160
160
  handleHide = () => {
161
161
  this.destroyEvent();
@@ -179,8 +179,8 @@ class Modal extends React.Component<ModalProps, ModalState> {
179
179
  }
180
180
  }
181
181
 
182
- updateModalStyles(dialogElement: HTMLElement) {
183
- this.setState({ bodyStyles: this.getBodyStylesByDialog(dialogElement) });
182
+ updateModalStyles(dialogElement: HTMLElement, entering?: boolean) {
183
+ this.setState({ bodyStyles: this.getBodyStylesByDialog(dialogElement, entering) });
184
184
  }
185
185
 
186
186
  addPrefix = (name: string) => prefix(this.props.classPrefix)(name);
@@ -14,7 +14,9 @@ export const modalDialogPropTypes = {
14
14
  style: PropTypes.object,
15
15
  dialogStyle: PropTypes.object,
16
16
  children: PropTypes.node,
17
- dialogRef: refType
17
+ dialogRef: refType,
18
+ id: PropTypes.string,
19
+ 'aria-labelledby': PropTypes.string
18
20
  };
19
21
 
20
22
  class ModalDialog extends React.Component<ModalDialogProps> {
@@ -94,18 +94,18 @@
94
94
  // Modal header
95
95
  // Top section of the modal w/ title and dismiss
96
96
  .@{ns}modal-header {
97
- .clearfix;
97
+ .clearfix();
98
98
 
99
99
  padding-right: @line-height-computed;
100
100
 
101
101
  .@{ns}modal-title {
102
102
  font-size: @modal-title-font-size;
103
- line-height: unit(@line-height-computed / @modal-title-font-size);
103
+ line-height: unit((@line-height-computed / @modal-title-font-size));
104
104
  width: 100%;
105
105
  display: block;
106
106
  color: @modal-title-color;
107
107
  margin: 0;
108
- .ellipsis;
108
+ .ellipsis();
109
109
  }
110
110
  }
111
111
 
@@ -128,7 +128,7 @@
128
128
  border-style: none;
129
129
 
130
130
  &::before {
131
- .icon-font;
131
+ .icon-font();
132
132
 
133
133
  content: @default-close-btn-content;
134
134
  }
@@ -159,7 +159,7 @@
159
159
  .@{ns}modal-footer {
160
160
  text-align: right; // right align buttons
161
161
  border-top: none;
162
- .clearfix; // clear it in case folks use .pull-* classes on buttons
162
+ .clearfix(); // clear it in case folks use .pull-* classes on buttons
163
163
 
164
164
  // Properly space out buttons
165
165
  .@{ns}btn + .@{ns}btn {
@@ -5,6 +5,19 @@ import { getInstance } from '@test/testUtils';
5
5
  import Modal from '../Modal';
6
6
 
7
7
  describe('Modal', () => {
8
+ it('Should render exactly one element with dialog role', () => {
9
+ const instance = getInstance(
10
+ <Modal show>
11
+ <p>message</p>
12
+ </Modal>
13
+ );
14
+
15
+ assert.notOk(
16
+ instance.modalRef.current.getDialogElement().parentNode.closest('[role="dialog"]')
17
+ );
18
+ assert.equal(instance.modalRef.current.getDialogElement().getAttribute('role'), 'dialog');
19
+ });
20
+
8
21
  it('Should render the modal content', () => {
9
22
  const instance = getInstance(
10
23
  <Modal show>
@@ -536,6 +536,7 @@ class MultiCascader extends React.Component<MultiCascaderProps, MultiCascaderSta
536
536
  cleanable={cleanable && !disabled}
537
537
  hasValue={hasValue}
538
538
  active={this.state.active}
539
+ aria-disabled={disabled}
539
540
  >
540
541
  {selectedElement || locale.placeholder}
541
542
  </PickerToggle>
@@ -17,7 +17,7 @@
17
17
  &-menu .@{ns}check-item.@{ns}check-item-focus,
18
18
  &-menu .@{ns}check-item.@{ns}checkbox-checked {
19
19
  .@{ns}checkbox-checker > label {
20
- .picker-item-active;
20
+ .picker-item-active();
21
21
  }
22
22
  }
23
23
 
@@ -108,6 +108,7 @@ describe('MultiCascader', () => {
108
108
  const instance = getDOMNode(<Dropdown disabled />);
109
109
 
110
110
  assert.ok(instance.className.match(/\bdisabled\b/));
111
+ assert.equal(instance.querySelector('[role=combobox]').getAttribute('aria-disabled'), 'true');
111
112
  });
112
113
 
113
114
  it('Should be inline', () => {
@@ -49,9 +49,9 @@
49
49
  cursor: pointer;
50
50
  color: @nav-item-font-default-color;
51
51
  transition: @nav-item-transition;
52
- .ellipsis-basic;
52
+ .ellipsis-basic();
53
53
 
54
- .safari-border-radius-overflow-hidden;
54
+ .safari-border-radius-overflow-hidden();
55
55
 
56
56
  > .@{ns}icon {
57
57
  margin-right: @nav-item-icon-spacing;