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.
- package/CHANGELOG.md +49 -0
- package/dist/rsuite.js +21 -21
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/dist/styles/rsuite-dark-rtl.css +46 -52
- package/dist/styles/rsuite-dark-rtl.min.css +1 -1
- package/dist/styles/rsuite-dark-rtl.min.css.map +1 -1
- package/dist/styles/rsuite-dark.css +46 -52
- package/dist/styles/rsuite-dark.min.css +1 -1
- package/dist/styles/rsuite-dark.min.css.map +1 -1
- package/dist/styles/rsuite-default-rtl.css +46 -52
- package/dist/styles/rsuite-default-rtl.min.css +1 -1
- package/dist/styles/rsuite-default-rtl.min.css.map +1 -1
- package/dist/styles/rsuite-default.css +46 -52
- package/dist/styles/rsuite-default.min.css +1 -1
- package/dist/styles/rsuite-default.min.css.map +1 -1
- package/es/Alert/styles/common.less +1 -1
- package/es/AutoComplete/styles/common.less +3 -3
- package/es/Avatar/styles/common.less +5 -5
- package/es/Avatar/styles/mixin.less +1 -1
- package/es/Button/styles/common.less +6 -6
- package/es/Button/styles/mixin.less +17 -17
- package/es/ButtonGroup/styles/common.less +5 -5
- package/es/Calendar/styles/common.less +14 -14
- package/es/Carousel/styles/common.less +1 -1
- package/es/Cascader/Cascader.js +2 -1
- package/es/Cascader/styles/common.less +4 -4
- package/es/CheckPicker/CheckPicker.js +2 -1
- package/es/CheckPicker/styles/common.less +2 -2
- package/es/CheckTreePicker/CheckTreePicker.js +2 -1
- package/es/CheckTreePicker/styles/common.less +5 -5
- package/es/Checkbox/styles/common.less +3 -3
- package/es/Checkbox/styles/mixin.less +1 -1
- package/es/DatePicker/DatePicker.js +2 -1
- package/es/DatePicker/styles/common.less +1 -1
- package/es/DateRangePicker/DateRangePicker.js +2 -1
- package/es/Drawer/styles/common.less +5 -5
- package/es/Dropdown/Dropdown.js +13 -4
- package/es/Dropdown/styles/common.less +3 -3
- package/es/FlexboxGrid/styles/common.less +1 -1
- package/es/Form/styles/common.less +2 -1
- package/es/Form/styles/mixin.less +4 -4
- package/es/FormControl/styles/common.less +0 -1
- package/es/FormGroup/styles/common.less +1 -1
- package/es/Grid/styles/common.less +1 -1
- package/es/Grid/styles/mixin.less +2 -2
- package/es/HelpBlock/styles/common.less +1 -1
- package/es/IconButton/styles/common.less +16 -14
- package/es/Input/styles/common.less +6 -10
- package/es/InputGroup/styles/common.less +1 -1
- package/es/InputNumber/styles/mixin.less +2 -2
- package/es/InputPicker/InputAutosize.js +11 -6
- package/es/InputPicker/styles/common.less +4 -4
- package/es/Loader/styles/common.less +3 -3
- package/es/Loader/styles/mixin.less +2 -2
- package/es/Message/styles/common.less +3 -3
- package/es/Modal/BaseModal.js +1 -1
- package/es/Modal/Modal.js +5 -5
- package/es/Modal/ModalDialog.js +3 -1
- package/es/Modal/styles/common.less +5 -5
- package/es/MultiCascader/MultiCascader.js +2 -1
- package/es/MultiCascader/styles/common.less +1 -1
- package/es/Nav/styles/common.less +2 -2
- package/es/Navbar/styles/common.less +2 -2
- package/es/Notification/styles/common.less +4 -4
- package/es/Overlay/Overlay.js +1 -1
- package/es/Pagination/styles/common.less +2 -2
- package/es/Pagination/styles/mixin.less +6 -7
- package/es/Panel/Panel.js +0 -1
- package/es/Panel/styles/common.less +1 -1
- package/es/Picker/DropdownMenu.js +3 -1
- package/es/Picker/propTypes.js +1 -1
- package/es/Picker/styles/common.less +28 -28
- package/es/Picker/styles/mixin.less +3 -3
- package/es/Popover/styles/common.less +4 -4
- package/es/Progress/styles/common.less +5 -5
- package/es/Radio/styles/common.less +5 -5
- package/es/Rate/styles/common.less +2 -2
- package/es/SelectPicker/SelectPicker.js +2 -1
- package/es/SelectPicker/styles/common.less +4 -4
- package/es/Sidenav/styles/common.less +3 -3
- package/es/Slider/styles/common.less +9 -9
- package/es/Steps/styles/common.less +13 -13
- package/es/Table/styles/common.less +6 -10
- package/es/Tag/styles/common.less +2 -2
- package/es/TagPicker/styles/common.less +4 -4
- package/es/Timeline/styles/common.less +5 -5
- package/es/Timeline/styles/mixin.less +1 -1
- package/es/Toggle/styles/mixin.less +5 -5
- package/es/Tooltip/styles/common.less +4 -4
- package/es/TreePicker/TreePicker.js +2 -1
- package/es/TreePicker/styles/common.less +3 -3
- package/es/Uploader/styles/common.less +17 -17
- package/es/styles/mixins/utilities.less +1 -1
- package/es/styles/variables.less +58 -48
- package/es/utils/index.js +2 -1
- package/lib/Alert/styles/common.less +1 -1
- package/lib/AutoComplete/styles/common.less +3 -3
- package/lib/Avatar/styles/common.less +5 -5
- package/lib/Avatar/styles/mixin.less +1 -1
- package/lib/Button/styles/common.less +6 -6
- package/lib/Button/styles/mixin.less +17 -17
- package/lib/ButtonGroup/styles/common.less +5 -5
- package/lib/Calendar/styles/common.less +14 -14
- package/lib/Carousel/styles/common.less +1 -1
- package/lib/Cascader/Cascader.js +2 -1
- package/lib/Cascader/styles/common.less +4 -4
- package/lib/CheckPicker/CheckPicker.js +2 -1
- package/lib/CheckPicker/styles/common.less +2 -2
- package/lib/CheckTreePicker/CheckTreePicker.js +2 -1
- package/lib/CheckTreePicker/styles/common.less +5 -5
- package/lib/Checkbox/styles/common.less +3 -3
- package/lib/Checkbox/styles/mixin.less +1 -1
- package/lib/DatePicker/DatePicker.js +2 -1
- package/lib/DatePicker/styles/common.less +1 -1
- package/lib/DateRangePicker/DateRangePicker.js +2 -1
- package/lib/Drawer/styles/common.less +5 -5
- package/lib/Dropdown/Dropdown.js +13 -3
- package/lib/Dropdown/styles/common.less +3 -3
- package/lib/FlexboxGrid/styles/common.less +1 -1
- package/lib/Form/styles/common.less +2 -1
- package/lib/Form/styles/mixin.less +4 -4
- package/lib/FormControl/styles/common.less +0 -1
- package/lib/FormGroup/styles/common.less +1 -1
- package/lib/Grid/styles/common.less +1 -1
- package/lib/Grid/styles/mixin.less +2 -2
- package/lib/HelpBlock/styles/common.less +1 -1
- package/lib/IconButton/styles/common.less +16 -14
- package/lib/Input/styles/common.less +6 -10
- package/lib/InputGroup/styles/common.less +1 -1
- package/lib/InputNumber/styles/mixin.less +2 -2
- package/lib/InputPicker/InputAutosize.js +11 -6
- package/lib/InputPicker/styles/common.less +4 -4
- package/lib/Loader/styles/common.less +3 -3
- package/lib/Loader/styles/mixin.less +2 -2
- package/lib/Message/styles/common.less +3 -3
- package/lib/Modal/BaseModal.js +1 -1
- package/lib/Modal/Modal.js +5 -5
- package/lib/Modal/ModalDialog.js +3 -1
- package/lib/Modal/styles/common.less +5 -5
- package/lib/MultiCascader/MultiCascader.js +2 -1
- package/lib/MultiCascader/styles/common.less +1 -1
- package/lib/Nav/styles/common.less +2 -2
- package/lib/Navbar/styles/common.less +2 -2
- package/lib/Notification/styles/common.less +4 -4
- package/lib/Overlay/Overlay.js +1 -1
- package/lib/Pagination/styles/common.less +2 -2
- package/lib/Pagination/styles/mixin.less +6 -7
- package/lib/Panel/Panel.js +0 -1
- package/lib/Panel/styles/common.less +1 -1
- package/lib/Picker/DropdownMenu.js +3 -1
- package/lib/Picker/propTypes.js +1 -1
- package/lib/Picker/styles/common.less +28 -28
- package/lib/Picker/styles/mixin.less +3 -3
- package/lib/Popover/styles/common.less +4 -4
- package/lib/Progress/styles/common.less +5 -5
- package/lib/Radio/styles/common.less +5 -5
- package/lib/Rate/styles/common.less +2 -2
- package/lib/SelectPicker/SelectPicker.js +2 -1
- package/lib/SelectPicker/styles/common.less +4 -4
- package/lib/Sidenav/styles/common.less +3 -3
- package/lib/Slider/styles/common.less +9 -9
- package/lib/Steps/styles/common.less +13 -13
- package/lib/Table/styles/common.less +6 -10
- package/lib/Tag/styles/common.less +2 -2
- package/lib/TagPicker/styles/common.less +4 -4
- package/lib/Timeline/styles/common.less +5 -5
- package/lib/Timeline/styles/mixin.less +1 -1
- package/lib/Toggle/styles/mixin.less +5 -5
- package/lib/Tooltip/styles/common.less +4 -4
- package/lib/TreePicker/TreePicker.js +2 -1
- package/lib/TreePicker/styles/common.less +3 -3
- package/lib/Uploader/styles/common.less +17 -17
- package/lib/styles/mixins/utilities.less +1 -1
- package/lib/styles/variables.less +58 -48
- package/lib/utils/index.js +7 -2
- package/package.json +7 -5
- package/src/Alert/styles/common.less +1 -1
- package/src/AutoComplete/styles/common.less +3 -3
- package/src/Avatar/styles/common.less +5 -5
- package/src/Avatar/styles/mixin.less +1 -1
- package/src/Button/styles/common.less +6 -6
- package/src/Button/styles/mixin.less +17 -17
- package/src/ButtonGroup/styles/common.less +5 -5
- package/src/Calendar/styles/common.less +14 -14
- package/src/Carousel/styles/common.less +1 -1
- package/src/Cascader/Cascader.tsx +1 -0
- package/src/Cascader/styles/common.less +4 -4
- package/src/Cascader/test/CascaderSpec.js +1 -0
- package/src/CheckPicker/CheckPicker.tsx +1 -0
- package/src/CheckPicker/styles/common.less +2 -2
- package/src/CheckPicker/test/CheckPickerSpec.js +1 -0
- package/src/CheckTreePicker/CheckTreePicker.tsx +1 -0
- package/src/CheckTreePicker/styles/common.less +5 -5
- package/src/CheckTreePicker/test/CheckTreePickerSpec.js +1 -0
- package/src/Checkbox/styles/common.less +3 -3
- package/src/Checkbox/styles/mixin.less +1 -1
- package/src/DatePicker/DatePicker.tsx +1 -0
- package/src/DatePicker/styles/common.less +1 -1
- package/src/DatePicker/test/DatePickerSpec.js +1 -0
- package/src/DateRangePicker/DateRangePicker.tsx +1 -0
- package/src/DateRangePicker/test/DateRangePickerSpec.js +1 -0
- package/src/Drawer/styles/common.less +5 -5
- package/src/Drawer/test/DrawerSpec.js +14 -0
- package/src/Dropdown/Dropdown.tsx +20 -6
- package/src/Dropdown/styles/common.less +3 -3
- package/src/FlexboxGrid/styles/common.less +1 -1
- package/src/Form/styles/common.less +2 -1
- package/src/Form/styles/mixin.less +4 -4
- package/src/FormControl/styles/common.less +0 -1
- package/src/FormGroup/styles/common.less +1 -1
- package/src/Grid/styles/common.less +1 -1
- package/src/Grid/styles/mixin.less +2 -2
- package/src/HelpBlock/styles/common.less +1 -1
- package/src/IconButton/styles/common.less +16 -14
- package/src/Input/styles/common.less +6 -10
- package/src/Input/test/InputStylesSpec.js +0 -8
- package/src/InputGroup/styles/common.less +1 -1
- package/src/InputNumber/styles/mixin.less +2 -2
- package/src/InputPicker/InputAutosize.tsx +15 -10
- package/src/InputPicker/styles/common.less +4 -4
- package/src/Loader/styles/common.less +3 -3
- package/src/Loader/styles/mixin.less +2 -2
- package/src/Message/styles/common.less +3 -3
- package/src/Modal/BaseModal.tsx +1 -6
- package/src/Modal/Modal.tsx +5 -5
- package/src/Modal/ModalDialog.tsx +3 -1
- package/src/Modal/styles/common.less +5 -5
- package/src/Modal/test/ModalSpec.js +13 -0
- package/src/MultiCascader/MultiCascader.tsx +1 -0
- package/src/MultiCascader/styles/common.less +1 -1
- package/src/MultiCascader/test/MultiCascaderSpec.js +1 -0
- package/src/Nav/styles/common.less +2 -2
- package/src/Navbar/styles/common.less +2 -2
- package/src/Notification/styles/common.less +4 -4
- package/src/Overlay/Overlay.tsx +1 -1
- package/src/Pagination/styles/common.less +2 -2
- package/src/Pagination/styles/mixin.less +6 -7
- package/src/Panel/Panel.tsx +0 -1
- package/src/Panel/styles/common.less +1 -1
- package/src/Picker/DropdownMenu.tsx +3 -1
- package/src/Picker/propTypes.ts +1 -1
- package/src/Picker/styles/common.less +28 -28
- package/src/Picker/styles/mixin.less +3 -3
- package/src/Picker/test/DropdownMenuSpec.js +21 -0
- package/src/Popover/styles/common.less +4 -4
- package/src/Popover/test/PopoverStylesSpec.js +1 -1
- package/src/Progress/styles/common.less +5 -5
- package/src/Radio/styles/common.less +5 -5
- package/src/Rate/styles/common.less +2 -2
- package/src/SelectPicker/SelectPicker.tsx +1 -0
- package/src/SelectPicker/styles/common.less +4 -4
- package/src/SelectPicker/test/SelectPickerSpec.js +1 -0
- package/src/Sidenav/styles/common.less +3 -3
- package/src/Slider/styles/common.less +9 -9
- package/src/Steps/styles/common.less +13 -13
- package/src/Table/styles/common.less +6 -10
- package/src/Tag/styles/common.less +2 -2
- package/src/TagPicker/styles/common.less +4 -4
- package/src/Timeline/styles/common.less +5 -5
- package/src/Timeline/styles/mixin.less +1 -1
- package/src/Toggle/styles/mixin.less +5 -5
- package/src/Tooltip/styles/common.less +4 -4
- package/src/TreePicker/TreePicker.tsx +1 -0
- package/src/TreePicker/styles/common.less +3 -3
- package/src/TreePicker/test/TreePickerSpec.js +1 -0
- package/src/Uploader/styles/common.less +17 -17
- package/src/styles/mixins/utilities.less +1 -1
- package/src/styles/variables.less +58 -48
- 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.
|
|
103
|
-
|
|
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
|
|
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
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.@{ns}form-inline {
|
|
7
7
|
> *,
|
|
8
8
|
> .@{ns}btn {
|
|
9
|
-
margin-right:
|
|
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
|
|
126
|
+
&.@{ns}input-group {
|
|
127
127
|
> .@{ns}input {
|
|
128
128
|
height: @useable-height;
|
|
129
129
|
}
|
|
@@ -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
|
|
@@ -13,23 +13,25 @@
|
|
|
13
13
|
.@{ns}btn-default {
|
|
14
14
|
.btn-icon-with-text(@btn-icon-with-text-bg);
|
|
15
15
|
|
|
16
|
-
&:
|
|
17
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
&:
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
});
|
|
@@ -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
|
|
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
|
-
|
|
46
|
+
margin-right: @dropdown-toggle-padding-right;
|
|
47
47
|
|
|
48
48
|
.@{ns}picker-cleanable & {
|
|
49
|
-
|
|
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;
|
package/src/Modal/BaseModal.tsx
CHANGED
|
@@ -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>
|
package/src/Modal/Modal.tsx
CHANGED
|
@@ -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>
|
|
@@ -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;
|