rsuite 5.1.0 → 5.2.0
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/Button/styles/index.less +1 -1
- package/CHANGELOG.md +13 -0
- package/README.md +0 -1
- package/Slider/styles/index.less +20 -14
- package/Toggle/styles/index.less +48 -27
- package/Toggle/styles/mixin.less +16 -14
- package/cjs/@types/common.d.ts +8 -2
- package/cjs/Affix/Affix.js +3 -3
- package/cjs/Animation/Collapse.js +9 -7
- package/cjs/Animation/Transition.js +4 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +2 -2
- package/cjs/AutoComplete/AutoComplete.js +7 -4
- package/cjs/Calendar/TimeDropdown.js +5 -3
- package/cjs/Cascader/Cascader.d.ts +1 -1
- package/cjs/Cascader/DropdownMenu.js +6 -5
- package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/cjs/CheckTreePicker/CheckTreePicker.d.ts +1 -1
- package/cjs/Checkbox/Checkbox.d.ts +3 -3
- package/cjs/CheckboxGroup/CheckboxGroupContext.d.ts +1 -1
- package/cjs/DOMHelper/index.d.ts +12 -27
- package/cjs/DOMHelper/index.js +4 -3
- package/cjs/DOMHelper/isElement.d.ts +2 -0
- package/cjs/DOMHelper/isElement.js +11 -0
- package/cjs/DatePicker/DatePicker.d.ts +3 -3
- package/cjs/DateRangePicker/Calendar.d.ts +1 -1
- package/cjs/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/cjs/Disclosure/Disclosure.d.ts +1 -1
- package/cjs/Disclosure/DisclosureContext.d.ts +1 -1
- package/cjs/Dropdown/DropdownItem.d.ts +1 -1
- package/cjs/Dropdown/DropdownMenu.d.ts +2 -2
- package/cjs/Form/Form.d.ts +1 -1
- package/cjs/FormControl/FormControl.d.ts +9 -3
- package/cjs/Input/Input.d.ts +2 -1
- package/cjs/InputNumber/InputNumber.js +2 -2
- package/cjs/InputPicker/InputPicker.js +2 -2
- package/cjs/List/helper/useSortHelper.js +11 -6
- package/cjs/Menu/MenuItem.d.ts +1 -1
- package/cjs/Menu/Menubar.d.ts +1 -1
- package/cjs/Message/Message.js +13 -11
- package/cjs/Modal/Modal.js +5 -3
- package/cjs/Modal/utils.js +7 -5
- package/cjs/Notification/Notification.js +6 -3
- package/cjs/Overlay/Modal.js +14 -11
- package/cjs/Overlay/ModalManager.js +19 -7
- package/cjs/Overlay/OverlayTrigger.js +2 -2
- package/cjs/Overlay/Position.js +20 -13
- package/cjs/Overlay/positionUtils.js +16 -8
- package/cjs/Panel/Panel.d.ts +1 -1
- package/cjs/Picker/DropdownMenu.js +10 -6
- package/cjs/Picker/DropdownMenuCheckItem.d.ts +3 -3
- package/cjs/Picker/PickerOverlay.js +5 -3
- package/cjs/Picker/PickerToggle.d.ts +6 -0
- package/cjs/Picker/PickerToggle.js +9 -3
- package/cjs/Picker/SearchBar.d.ts +1 -1
- package/cjs/Picker/utils.d.ts +2 -2
- package/cjs/Radio/Radio.d.ts +1 -1
- package/cjs/RadioGroup/RadioGroup.d.ts +1 -1
- package/cjs/RangeSlider/RangeSlider.js +9 -5
- package/cjs/Rate/Character.js +2 -2
- package/cjs/Ripple/Ripple.js +6 -7
- package/cjs/Sidenav/SidenavDropdownItem.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdownMenu.d.ts +1 -1
- package/cjs/Slider/Graduated.js +1 -1
- package/cjs/Slider/Handle.js +10 -5
- package/cjs/Slider/ProgressBar.js +1 -1
- package/cjs/Slider/Slider.js +9 -5
- package/cjs/Toggle/Toggle.d.ts +3 -6
- package/cjs/Toggle/Toggle.js +32 -27
- package/cjs/Tree/Tree.d.ts +3 -3
- package/cjs/TreePicker/TreeNode.d.ts +1 -1
- package/cjs/TreePicker/TreeNode.js +2 -2
- package/cjs/TreePicker/TreePicker.d.ts +1 -1
- package/cjs/Uploader/Uploader.d.ts +4 -4
- package/cjs/locales/fa_IR.js +8 -8
- package/cjs/utils/BrowserDetection.js +1 -1
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +7 -2
- package/cjs/utils/scrollTopAnimation.js +5 -5
- package/cjs/utils/treeUtils.d.ts +2 -2
- package/cjs/utils/useEventListener.js +4 -2
- package/cjs/utils/useIsMounted.d.ts +2 -0
- package/cjs/utils/useIsMounted.js +22 -0
- package/cjs/utils/usePortal.js +2 -2
- package/cjs/utils/useRootClose.js +10 -10
- package/dist/rsuite-rtl.css +146 -116
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +146 -116
- package/dist/rsuite.js +720 -511
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +8 -2
- package/esm/Affix/Affix.js +1 -1
- package/esm/Animation/Collapse.js +2 -1
- package/esm/Animation/Transition.js +3 -2
- package/esm/AutoComplete/AutoComplete.d.ts +2 -2
- package/esm/AutoComplete/AutoComplete.js +8 -5
- package/esm/Calendar/TimeDropdown.js +2 -1
- package/esm/Cascader/Cascader.d.ts +1 -1
- package/esm/Cascader/DropdownMenu.js +4 -3
- package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
- package/esm/CheckTreePicker/CheckTreePicker.d.ts +1 -1
- package/esm/Checkbox/Checkbox.d.ts +3 -3
- package/esm/CheckboxGroup/CheckboxGroupContext.d.ts +1 -1
- package/esm/DOMHelper/index.d.ts +12 -27
- package/esm/DOMHelper/index.js +2 -3
- package/esm/DOMHelper/isElement.d.ts +2 -0
- package/esm/DOMHelper/isElement.js +5 -0
- package/esm/DatePicker/DatePicker.d.ts +3 -3
- package/esm/DateRangePicker/Calendar.d.ts +1 -1
- package/esm/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/esm/Disclosure/Disclosure.d.ts +1 -1
- package/esm/Disclosure/DisclosureContext.d.ts +1 -1
- package/esm/Dropdown/DropdownItem.d.ts +1 -1
- package/esm/Dropdown/DropdownMenu.d.ts +2 -2
- package/esm/Form/Form.d.ts +1 -1
- package/esm/FormControl/FormControl.d.ts +9 -3
- package/esm/Input/Input.d.ts +2 -1
- package/esm/InputNumber/InputNumber.js +2 -2
- package/esm/InputPicker/InputPicker.js +1 -1
- package/esm/List/helper/useSortHelper.js +8 -4
- package/esm/Menu/MenuItem.d.ts +1 -1
- package/esm/Menu/Menubar.d.ts +1 -1
- package/esm/Message/Message.js +15 -13
- package/esm/Modal/Modal.js +3 -2
- package/esm/Modal/utils.js +6 -5
- package/esm/Notification/Notification.js +7 -4
- package/esm/Overlay/Modal.js +11 -8
- package/esm/Overlay/ModalManager.js +6 -1
- package/esm/Overlay/OverlayTrigger.js +1 -1
- package/esm/Overlay/Position.js +14 -8
- package/esm/Overlay/positionUtils.js +5 -1
- package/esm/Panel/Panel.d.ts +1 -1
- package/esm/Picker/DropdownMenu.js +3 -1
- package/esm/Picker/DropdownMenuCheckItem.d.ts +3 -3
- package/esm/Picker/PickerOverlay.js +2 -1
- package/esm/Picker/PickerToggle.d.ts +6 -0
- package/esm/Picker/PickerToggle.js +8 -3
- package/esm/Picker/SearchBar.d.ts +1 -1
- package/esm/Picker/utils.d.ts +2 -2
- package/esm/Radio/Radio.d.ts +1 -1
- package/esm/RadioGroup/RadioGroup.d.ts +1 -1
- package/esm/RangeSlider/RangeSlider.js +4 -2
- package/esm/Rate/Character.js +2 -2
- package/esm/Ripple/Ripple.js +4 -3
- package/esm/Sidenav/SidenavDropdownItem.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdownMenu.d.ts +1 -1
- package/esm/Slider/Graduated.js +1 -1
- package/esm/Slider/Handle.js +5 -2
- package/esm/Slider/ProgressBar.js +1 -1
- package/esm/Slider/Slider.js +4 -2
- package/esm/Toggle/Toggle.d.ts +3 -6
- package/esm/Toggle/Toggle.js +34 -29
- package/esm/Tree/Tree.d.ts +3 -3
- package/esm/TreePicker/TreeNode.d.ts +1 -1
- package/esm/TreePicker/TreeNode.js +1 -1
- package/esm/TreePicker/TreePicker.d.ts +1 -1
- package/esm/Uploader/Uploader.d.ts +4 -4
- package/esm/locales/fa_IR.js +8 -8
- package/esm/utils/BrowserDetection.js +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +2 -1
- package/esm/utils/scrollTopAnimation.js +2 -2
- package/esm/utils/treeUtils.d.ts +2 -2
- package/esm/utils/useEventListener.js +1 -1
- package/esm/utils/useIsMounted.d.ts +2 -0
- package/esm/utils/useIsMounted.js +16 -0
- package/esm/utils/usePortal.js +2 -2
- package/esm/utils/useRootClose.js +8 -6
- package/package.json +4 -4
- package/styles/plugins/palette.js +10 -1
package/esm/@types/common.d.ts
CHANGED
|
@@ -80,12 +80,18 @@ export interface PickerBaseProps<LocaleType = any> extends WithAsProps, Animatio
|
|
|
80
80
|
/** Custom render extra footer */
|
|
81
81
|
renderExtraFooter?: () => React.ReactNode;
|
|
82
82
|
}
|
|
83
|
-
export interface FormControlBaseProps<ValueType =
|
|
83
|
+
export interface FormControlBaseProps<ValueType = React.InputHTMLAttributes<HTMLInputElement>['value']> {
|
|
84
|
+
/** Name of the form field */
|
|
85
|
+
name?: string;
|
|
84
86
|
/** Initial value */
|
|
85
87
|
defaultValue?: ValueType;
|
|
86
88
|
/** Current value of the component. Creates a controlled component */
|
|
87
89
|
value?: ValueType;
|
|
88
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Called after the value has been changed
|
|
92
|
+
* todo Override event as React.ChangeEvent in components where onChange is delegated
|
|
93
|
+
* to an underlying <input> element
|
|
94
|
+
*/
|
|
89
95
|
onChange?: (value: ValueType, event: React.SyntheticEvent) => void;
|
|
90
96
|
/** Set the component to be disabled and cannot be entered */
|
|
91
97
|
disabled?: boolean;
|
package/esm/Affix/Affix.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import
|
|
5
|
+
import getOffset from 'dom-lib/getOffset';
|
|
6
6
|
import { mergeRefs, useClassNames, useElementResize, useEventListener } from '../utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import
|
|
5
|
+
import getStyle from 'dom-lib/getStyle';
|
|
6
|
+
import addStyle from 'dom-lib/addStyle';
|
|
6
7
|
import get from 'lodash/get';
|
|
7
8
|
import capitalize from 'lodash/capitalize';
|
|
8
9
|
import Transition, { transitionPropTypes } from './Transition';
|
|
@@ -3,7 +3,8 @@ import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
6
|
+
import getTransitionEnd from 'dom-lib/getTransitionEnd';
|
|
7
|
+
import on from 'dom-lib/on';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
9
|
import isFunction from 'lodash/isFunction';
|
|
9
10
|
import omit from 'lodash/omit';
|
|
@@ -136,7 +137,7 @@ var Transition = /*#__PURE__*/function (_React$Component) {
|
|
|
136
137
|
var _this$props = this.props,
|
|
137
138
|
timeout = _this$props.timeout,
|
|
138
139
|
animation = _this$props.animation;
|
|
139
|
-
this.animationEventListener = on(node, animation ? getAnimationEnd() :
|
|
140
|
+
this.animationEventListener = on(node, animation ? getAnimationEnd() : getTransitionEnd(), this.nextCallback);
|
|
140
141
|
|
|
141
142
|
if (timeout !== null) {
|
|
142
143
|
setTimeout(this.nextCallback, timeout);
|
|
@@ -18,9 +18,9 @@ export interface AutoCompleteProps<T = ValueType> extends WithAsProps, FormContr
|
|
|
18
18
|
/** Called when a option is selected */
|
|
19
19
|
onSelect?: (value: any, item: ItemDataType, event: React.SyntheticEvent) => void;
|
|
20
20
|
/** Called on focus */
|
|
21
|
-
onFocus?:
|
|
21
|
+
onFocus?: React.FocusEventHandler;
|
|
22
22
|
/** Called on blur */
|
|
23
|
-
onBlur?:
|
|
23
|
+
onBlur?: React.FocusEventHandler;
|
|
24
24
|
/** Called on menu focus */
|
|
25
25
|
onMenuFocus?: (focusItemValue: any, event: React.KeyboardEvent) => void;
|
|
26
26
|
/** The callback triggered by keyboard events. */
|
|
@@ -4,7 +4,7 @@ import React, { useState, useRef, useCallback } from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import pick from 'lodash/pick';
|
|
6
6
|
import Input from '../Input';
|
|
7
|
-
import { useClassNames, useControlled, PLACEMENT, mergeRefs } from '../utils';
|
|
7
|
+
import { useClassNames, useControlled, PLACEMENT, mergeRefs, useIsMounted } from '../utils';
|
|
8
8
|
import { animationPropTypes } from '../Animation/utils';
|
|
9
9
|
import { PickerToggleTrigger, onMenuKeyDown, DropdownMenu, DropdownMenuItem, PickerOverlay, useFocusItemValue, usePublicMethods, pickTriggerPropKeys } from '../Picker';
|
|
10
10
|
import { transformData, shouldDisplay } from './utils';
|
|
@@ -57,7 +57,8 @@ var AutoComplete = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
57
57
|
|
|
58
58
|
var items = (datalist === null || datalist === void 0 ? void 0 : datalist.filter(shouldDisplay(filterBy, value))) || [];
|
|
59
59
|
var hasItems = items.length > 0;
|
|
60
|
-
var overlayRef = useRef(null);
|
|
60
|
+
var overlayRef = useRef(null);
|
|
61
|
+
var isMounted = useIsMounted(); // Used to hover the focuse item when trigger `onKeydown`
|
|
61
62
|
|
|
62
63
|
var _useFocusItemValue = useFocusItemValue(value, {
|
|
63
64
|
data: datalist,
|
|
@@ -117,9 +118,11 @@ var AutoComplete = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
117
118
|
};
|
|
118
119
|
|
|
119
120
|
var handleClose = useCallback(function () {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (isMounted()) {
|
|
122
|
+
setFocus(false);
|
|
123
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
124
|
+
}
|
|
125
|
+
}, [isMounted, onClose]);
|
|
123
126
|
var handleOpen = useCallback(function () {
|
|
124
127
|
setFocus(true);
|
|
125
128
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React, { useEffect, useRef } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import
|
|
5
|
+
import getPosition from 'dom-lib/getPosition';
|
|
6
|
+
import scrollTop from 'dom-lib/scrollTop';
|
|
6
7
|
import partial from 'lodash/partial';
|
|
7
8
|
import camelCase from 'lodash/camelCase';
|
|
8
9
|
import isNumber from 'lodash/isNumber';
|
|
@@ -25,7 +25,7 @@ export interface CascaderProps<T = ValueType> extends FormControlPickerProps<T,
|
|
|
25
25
|
/** Called when clean */
|
|
26
26
|
onClean?: (event: React.SyntheticEvent) => void;
|
|
27
27
|
/** Called when searching */
|
|
28
|
-
onSearch?: (searchKeyword: string, event: React.SyntheticEvent
|
|
28
|
+
onSearch?: (searchKeyword: string, event: React.SyntheticEvent) => void;
|
|
29
29
|
/** Asynchronously load the children of the tree node. */
|
|
30
30
|
getChildren?: (node: ItemDataType) => ItemDataType[] | Promise<ItemDataType[]>;
|
|
31
31
|
}
|
|
@@ -3,13 +3,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import SpinnerIcon from '@rsuite/icons/legacy/Spinner';
|
|
6
|
-
import helper from '../DOMHelper';
|
|
7
6
|
import isUndefined from 'lodash/isUndefined';
|
|
8
7
|
import isNil from 'lodash/isNil';
|
|
9
8
|
import { shallowEqual, useClassNames, mergeRefs, useCustom } from '../utils';
|
|
10
9
|
import { DropdownMenuItem } from '../Picker';
|
|
11
10
|
import AngleLeftIcon from '@rsuite/icons/legacy/AngleLeft';
|
|
12
11
|
import AngleRightIcon from '@rsuite/icons/legacy/AngleRight';
|
|
12
|
+
import getPosition from 'dom-lib/getPosition';
|
|
13
|
+
import scrollTop from 'dom-lib/scrollTop';
|
|
13
14
|
var emptyArray = [];
|
|
14
15
|
var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
16
|
var _props$as = props.as,
|
|
@@ -61,9 +62,9 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
if (activeItem) {
|
|
64
|
-
var position =
|
|
65
|
+
var position = getPosition(activeItem, column); // Let the active option scroll into view.
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
scrollTop(column, position.top);
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
}, [prefix]);
|
|
@@ -20,7 +20,7 @@ export interface CheckTreeNodeProps extends WithAsProps {
|
|
|
20
20
|
uncheckable?: boolean;
|
|
21
21
|
allUncheckable?: boolean;
|
|
22
22
|
onExpand?: (nodeData: any) => void;
|
|
23
|
-
onSelect?: (nodeData: any, event: React.SyntheticEvent
|
|
23
|
+
onSelect?: (nodeData: any, event: React.SyntheticEvent) => void;
|
|
24
24
|
onRenderTreeIcon?: (nodeData: any, expandIcon?: React.ReactNode) => React.ReactNode;
|
|
25
25
|
onRenderTreeNode?: (nodeData: any) => React.ReactNode;
|
|
26
26
|
}
|
|
@@ -14,7 +14,7 @@ export interface CheckTreePickerProps<T = ValueType> extends TreeBaseProps<T, It
|
|
|
14
14
|
/** Custom render selected items */
|
|
15
15
|
renderValue?: (value: any[], selectedItems: any[], selectedElement: React.ReactNode) => React.ReactNode;
|
|
16
16
|
/** Called when scrolling */
|
|
17
|
-
onScroll?: (event: React.SyntheticEvent
|
|
17
|
+
onScroll?: (event: React.SyntheticEvent) => void;
|
|
18
18
|
}
|
|
19
19
|
declare const CheckTreePicker: PickerComponent<CheckTreePickerProps>;
|
|
20
20
|
export default CheckTreePicker;
|
|
@@ -31,11 +31,11 @@ export interface CheckboxProps<V = ValueType> extends WithAsProps {
|
|
|
31
31
|
/** Used for the name of the form */
|
|
32
32
|
name?: string;
|
|
33
33
|
/** Called when the user attempts to change the checked state. */
|
|
34
|
-
onChange?: (value: V, checked: boolean, event: React.
|
|
34
|
+
onChange?: (value: V, checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
35
35
|
/** Called when the checkbox or label is clicked. */
|
|
36
|
-
onClick?: (event: React.SyntheticEvent
|
|
36
|
+
onClick?: (event: React.SyntheticEvent) => void;
|
|
37
37
|
/** Called when the checkbox is clicked. */
|
|
38
|
-
onCheckboxClick?: (event: React.SyntheticEvent
|
|
38
|
+
onCheckboxClick?: (event: React.SyntheticEvent) => void;
|
|
39
39
|
}
|
|
40
40
|
declare const Checkbox: RsRefForwardingComponent<'div', CheckboxProps>;
|
|
41
41
|
export default Checkbox;
|
|
@@ -8,6 +8,6 @@ export interface CheckboxGroupContextValue {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
readOnly?: boolean;
|
|
10
10
|
plaintext?: boolean;
|
|
11
|
-
onChange?: (value: any, checked: boolean, event: React.
|
|
11
|
+
onChange?: (value: any, checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
12
|
}
|
|
13
13
|
export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue>;
|
package/esm/DOMHelper/index.d.ts
CHANGED
|
@@ -2,34 +2,17 @@ import * as helpers from 'dom-lib';
|
|
|
2
2
|
export * from 'dom-lib';
|
|
3
3
|
declare const DOMHelper: {
|
|
4
4
|
isElement: (node: HTMLElement) => boolean;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end: any;
|
|
8
|
-
backfaceVisibility: string;
|
|
9
|
-
transform: string;
|
|
10
|
-
property: string;
|
|
11
|
-
timing: string;
|
|
12
|
-
delay: string;
|
|
13
|
-
duration: string;
|
|
14
|
-
};
|
|
15
|
-
translateDOMPositionXY: (style: CSSStyleDeclaration, x?: number, y?: number) => CSSStyleDeclaration;
|
|
16
|
-
getVendorPrefixedName: typeof helpers.getVendorPrefixedName;
|
|
17
|
-
BrowserSupportCore: {
|
|
18
|
-
hasCSSAnimations: () => boolean;
|
|
19
|
-
hasCSSTransforms: () => boolean;
|
|
20
|
-
hasCSS3DTransforms: () => boolean;
|
|
21
|
-
hasCSSTransitions: () => boolean;
|
|
22
|
-
};
|
|
23
|
-
DOMMouseMoveTracker: typeof helpers.DOMMouseMoveTracker;
|
|
5
|
+
on: typeof helpers.on;
|
|
6
|
+
off: typeof helpers.off;
|
|
24
7
|
WheelHandler: typeof helpers.WheelHandler;
|
|
8
|
+
DOMMouseMoveTracker: typeof helpers.DOMMouseMoveTracker;
|
|
25
9
|
addClass: (target: Element, className: string) => Element;
|
|
26
|
-
hasClass: (target: Element, className: string) => boolean;
|
|
27
10
|
removeClass: (target: Element, className: string) => Element;
|
|
11
|
+
hasClass: (target: Element, className: string) => boolean;
|
|
28
12
|
toggleClass: (target: Element, className: string) => Element;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
getComputedStyle: (node: Element) => CSSStyleDeclaration;
|
|
13
|
+
cancelAnimationFramePolyfill: typeof clearTimeout;
|
|
14
|
+
requestAnimationFramePolyfill: typeof requestAnimationFrame;
|
|
15
|
+
getAnimationEnd: typeof helpers.getAnimationEnd;
|
|
33
16
|
ownerDocument: (node: Element) => Document;
|
|
34
17
|
ownerWindow: (componentOrElement: Element) => Window;
|
|
35
18
|
getWindow: (node: any) => Window;
|
|
@@ -53,11 +36,13 @@ declare const DOMHelper: {
|
|
|
53
36
|
width: number;
|
|
54
37
|
};
|
|
55
38
|
isOverflowing: (container: Element) => boolean;
|
|
56
|
-
activeElement: (doc?: Document) => Element;
|
|
57
39
|
getScrollbarSize: (recalc?: boolean) => number | void;
|
|
58
40
|
getHeight: (node: Element | Window, client?: Element) => number;
|
|
59
41
|
getWidth: (node: Element | Window, client?: Element) => number;
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
isFocusable: typeof helpers.isFocusable;
|
|
43
|
+
getStyle: (node: Element, property?: string) => string | CSSStyleDeclaration;
|
|
44
|
+
removeStyle: (node: Element, keys: string | string[]) => void;
|
|
45
|
+
addStyle: (node: Element, property: string | import("dom-lib/esm/addStyle").CSSProperty, value?: string | number) => void;
|
|
46
|
+
translateDOMPositionXY: (style: CSSStyleDeclaration, x?: number, y?: number) => CSSStyleDeclaration;
|
|
62
47
|
};
|
|
63
48
|
export default DOMHelper;
|
package/esm/DOMHelper/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as helpers from 'dom-lib';
|
|
3
|
+
import isElement from './isElement';
|
|
3
4
|
export * from 'dom-lib';
|
|
4
5
|
|
|
5
6
|
var DOMHelper = _extends({}, helpers, {
|
|
6
|
-
isElement:
|
|
7
|
-
return (node === null || node === void 0 ? void 0 : node.nodeType) && typeof (node === null || node === void 0 ? void 0 : node.nodeName) === 'string';
|
|
8
|
-
}
|
|
7
|
+
isElement: isElement
|
|
9
8
|
});
|
|
10
9
|
|
|
11
10
|
export default DOMHelper;
|
|
@@ -41,19 +41,19 @@ export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, Form
|
|
|
41
41
|
/** Hidden seconds */
|
|
42
42
|
hideSeconds?: (second: number, date: Date) => boolean;
|
|
43
43
|
/** Called when the calendar panel date changes */
|
|
44
|
-
onChangeCalendarDate?: (date: Date, event?: React.SyntheticEvent
|
|
44
|
+
onChangeCalendarDate?: (date: Date, event?: React.SyntheticEvent) => void;
|
|
45
45
|
/** Called when opening the month view */
|
|
46
46
|
onToggleMonthDropdown?: (toggle: boolean) => void;
|
|
47
47
|
/** Called when opening the time view */
|
|
48
48
|
onToggleTimeDropdown?: (toggle: boolean) => void;
|
|
49
49
|
/** Called when the option is selected */
|
|
50
|
-
onSelect?: (date: Date, event?: React.SyntheticEvent
|
|
50
|
+
onSelect?: (date: Date, event?: React.SyntheticEvent) => void;
|
|
51
51
|
/** Called after the prev month */
|
|
52
52
|
onPrevMonth?: (date: Date) => void;
|
|
53
53
|
/** Called after the next month */
|
|
54
54
|
onNextMonth?: (date: Date) => void;
|
|
55
55
|
/** Called after clicking the OK button */
|
|
56
|
-
onOk?: (date: Date, event: React.SyntheticEvent
|
|
56
|
+
onOk?: (date: Date, event: React.SyntheticEvent) => void;
|
|
57
57
|
/** Called when clean */
|
|
58
58
|
onClean?: (event: React.MouseEvent) => void;
|
|
59
59
|
/** Custom render value */
|
|
@@ -16,7 +16,7 @@ export interface CalendarProps extends WithAsProps, Omit<CalendarCoreProps, Omit
|
|
|
16
16
|
onChangeCalendarDate?: (index: number, date: Date) => void;
|
|
17
17
|
onChangeCalendarTime?: (index: number, date: Date) => void;
|
|
18
18
|
onMouseMove?: (date: Date) => void;
|
|
19
|
-
onSelect?: (date: Date, event?: React.SyntheticEvent
|
|
19
|
+
onSelect?: (date: Date, event?: React.SyntheticEvent) => void;
|
|
20
20
|
showOneCalendar?: boolean;
|
|
21
21
|
showWeekNumbers?: boolean;
|
|
22
22
|
value?: ValueType;
|
|
@@ -26,9 +26,9 @@ export interface DateRangePickerProps extends PickerBaseProps, FormControlBasePr
|
|
|
26
26
|
/** Disabled date */
|
|
27
27
|
disabledDate?: DisabledDateFunction;
|
|
28
28
|
/** Called when the option is selected */
|
|
29
|
-
onSelect?: (date: Date, event?: React.SyntheticEvent
|
|
29
|
+
onSelect?: (date: Date, event?: React.SyntheticEvent) => void;
|
|
30
30
|
/** Called after clicking the OK button */
|
|
31
|
-
onOk?: (date: ValueType, event: React.SyntheticEvent
|
|
31
|
+
onOk?: (date: ValueType, event: React.SyntheticEvent) => void;
|
|
32
32
|
/** Called when clean */
|
|
33
33
|
onClean?: (event: React.MouseEvent) => void;
|
|
34
34
|
/** Custom render value */
|
|
@@ -12,7 +12,7 @@ export interface DisclosureProps {
|
|
|
12
12
|
defaultOpen?: boolean;
|
|
13
13
|
hideOnClickOutside?: boolean;
|
|
14
14
|
/** Callback when disclosure button is being activated to update the open state */
|
|
15
|
-
onToggle?: (open: boolean, event: React.SyntheticEvent
|
|
15
|
+
onToggle?: (open: boolean, event: React.SyntheticEvent) => void;
|
|
16
16
|
}
|
|
17
17
|
declare function Disclosure(props: DisclosureProps): JSX.Element;
|
|
18
18
|
declare namespace Disclosure {
|
|
@@ -13,7 +13,7 @@ export declare type DisclosureContextProps = [
|
|
|
13
13
|
DisclosureState,
|
|
14
14
|
Dispatch<DisclosureAction>,
|
|
15
15
|
{
|
|
16
|
-
onToggle: (open: boolean, event?: React.SyntheticEvent
|
|
16
|
+
onToggle: (open: boolean, event?: React.SyntheticEvent) => void;
|
|
17
17
|
}
|
|
18
18
|
];
|
|
19
19
|
declare const DisclosureContext: React.Context<DisclosureContextProps>;
|
|
@@ -32,7 +32,7 @@ export interface DropdownMenuItemProps<T = any> extends WithAsProps, Omit<React.
|
|
|
32
32
|
*/
|
|
33
33
|
open?: boolean;
|
|
34
34
|
/** Select the callback function for the current option */
|
|
35
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent
|
|
35
|
+
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* The <Dropdown.Item> API
|
|
@@ -19,8 +19,8 @@ export interface DropdownMenuProps<T = string> extends StandardProps {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
activeKey?: T;
|
|
21
21
|
trigger?: 'hover' | 'click';
|
|
22
|
-
onSelect?: (eventKey: T, event: React.SyntheticEvent
|
|
23
|
-
onToggle?: (eventKey: T, event: React.SyntheticEvent
|
|
22
|
+
onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
23
|
+
onToggle?: (eventKey: T, event: React.SyntheticEvent) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* The <Dropdown.Menu> API
|
package/esm/Form/Form.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface FormProps<T = Record<string, any>, errorMsgType = any, E = {
|
|
|
33
33
|
/** The error message comes from context */
|
|
34
34
|
errorFromContext?: boolean;
|
|
35
35
|
/** Callback fired when data changing */
|
|
36
|
-
onChange?: (formValue: T, event: React.SyntheticEvent
|
|
36
|
+
onChange?: (formValue: T, event: React.SyntheticEvent) => void;
|
|
37
37
|
/** Callback fired when error checking */
|
|
38
38
|
onError?: (formError: E) => void;
|
|
39
39
|
/** Callback fired when data cheking */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Input from '../Input';
|
|
3
|
+
import { TypeAttributes, FormControlBaseProps, WithAsProps } from '../@types/common';
|
|
3
4
|
/**
|
|
4
5
|
* Props that FormControl passes to its accepter
|
|
5
6
|
*/
|
|
@@ -12,7 +13,7 @@ export interface FormControlProps<P = any, ValueType = any> extends WithAsProps,
|
|
|
12
13
|
/** Value */
|
|
13
14
|
value?: ValueType;
|
|
14
15
|
/** Callback fired when data changing */
|
|
15
|
-
onChange?(value: ValueType, event: React.SyntheticEvent
|
|
16
|
+
onChange?(value: ValueType, event: React.SyntheticEvent): void;
|
|
16
17
|
/** The data validation trigger type, and it wiill overrides the setting on <Form> */
|
|
17
18
|
checkTrigger?: TypeAttributes.CheckTrigger;
|
|
18
19
|
/** Show error messages */
|
|
@@ -28,5 +29,10 @@ export interface FormControlProps<P = any, ValueType = any> extends WithAsProps,
|
|
|
28
29
|
/** Asynchronous check value */
|
|
29
30
|
checkAsync?: boolean;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
interface FormControlComponent extends React.FC<FormControlProps> {
|
|
33
|
+
<Accepter extends React.ElementType = typeof Input>(props: FormControlProps & {
|
|
34
|
+
accepter?: Accepter;
|
|
35
|
+
} & React.ComponentPropsWithRef<Accepter>): React.ReactElement;
|
|
36
|
+
}
|
|
37
|
+
declare const FormControl: FormControlComponent;
|
|
32
38
|
export default FormControl;
|
package/esm/Input/Input.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { WithAsProps, RsRefForwardingComponent, TypeAttributes, FormControlBaseP
|
|
|
3
3
|
export interface LocaleType {
|
|
4
4
|
unfilled: string;
|
|
5
5
|
}
|
|
6
|
-
export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'>, FormControlBaseProps
|
|
6
|
+
export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'>, FormControlBaseProps {
|
|
7
7
|
/** The HTML input type */
|
|
8
8
|
type?: string;
|
|
9
9
|
/** The HTML input id */
|
|
@@ -12,6 +12,7 @@ export interface InputProps extends WithAsProps, Omit<React.InputHTMLAttributes<
|
|
|
12
12
|
size?: TypeAttributes.Size;
|
|
13
13
|
/** Ref of input element */
|
|
14
14
|
inputRef?: React.Ref<any>;
|
|
15
|
+
onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
16
|
/** Called on press enter */
|
|
16
17
|
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
17
18
|
}
|
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import isNil from 'lodash/isNil';
|
|
6
6
|
import AngleUpIcon from '@rsuite/icons/legacy/AngleUp';
|
|
7
7
|
import AngleDownIcon from '@rsuite/icons/legacy/AngleDown';
|
|
8
|
-
import
|
|
8
|
+
import on from 'dom-lib/on';
|
|
9
9
|
import InputGroup from '../InputGroup/InputGroup';
|
|
10
10
|
import InputGroupAddon from '../InputGroup/InputGroupAddon';
|
|
11
11
|
import Input from '../Input';
|
|
@@ -195,7 +195,7 @@ var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
195
195
|
var wheelListener;
|
|
196
196
|
|
|
197
197
|
if (inputRef.current && scrollable) {
|
|
198
|
-
wheelListener =
|
|
198
|
+
wheelListener = on(inputRef.current, 'wheel', handleWheel, {
|
|
199
199
|
passive: false
|
|
200
200
|
});
|
|
201
201
|
}
|
|
@@ -14,7 +14,7 @@ import clone from 'lodash/clone';
|
|
|
14
14
|
import isArray from 'lodash/isArray';
|
|
15
15
|
import omit from 'lodash/omit';
|
|
16
16
|
import pick from 'lodash/pick';
|
|
17
|
-
import
|
|
17
|
+
import getWidth from 'dom-lib/getWidth';
|
|
18
18
|
import shallowEqual from '../utils/shallowEqual';
|
|
19
19
|
import { filterNodesOfTree } from '../utils/treeUtils';
|
|
20
20
|
import Plaintext from '../Plaintext';
|
|
@@ -4,10 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import on from 'dom-lib/on';
|
|
8
8
|
import { useCallback, useRef, useState } from 'react';
|
|
9
9
|
import AutoScroller from './AutoScroller';
|
|
10
10
|
import { closestNode, getEdgeOffset, getScrollingParent, isContainInteractiveElement, setInlineStyles, setTransitionDuration, setTranslate3d } from './utils';
|
|
11
|
+
import { useIsMounted } from '../../utils';
|
|
11
12
|
import useManager from './useManager';
|
|
12
13
|
|
|
13
14
|
var useSortHelper = function useSortHelper(config) {
|
|
@@ -30,14 +31,16 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
30
31
|
listItemRegister = _useManager.listItemRegister,
|
|
31
32
|
getManagedItem = _useManager.getManagedItem,
|
|
32
33
|
getOrderedItems = _useManager.getOrderedItems;
|
|
34
|
+
|
|
35
|
+
var isMounted = useIsMounted();
|
|
33
36
|
/**
|
|
34
37
|
* start dragging
|
|
35
38
|
* */
|
|
36
39
|
|
|
37
|
-
|
|
38
40
|
var handlePress = useCallback(function (mouseDownEvent, targetNode, curManagedItem) {
|
|
39
41
|
var _activeNodeHelper;
|
|
40
42
|
|
|
43
|
+
if (!isMounted()) return;
|
|
41
44
|
var listItemBaseClassName = targetNode.classList[0]; // get list item base className
|
|
42
45
|
|
|
43
46
|
var helperElementClass = listItemBaseClassName + "-helper";
|
|
@@ -217,7 +220,8 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
217
220
|
setTimeout(function () {
|
|
218
221
|
var _activeNodeHelper2, _activeNodeHelper2$pa;
|
|
219
222
|
|
|
220
|
-
// Remove the helper from the DOM
|
|
223
|
+
if (!isMounted()) return; // Remove the helper from the DOM
|
|
224
|
+
|
|
221
225
|
(_activeNodeHelper2 = activeNodeHelper) === null || _activeNodeHelper2 === void 0 ? void 0 : (_activeNodeHelper2$pa = _activeNodeHelper2.parentNode) === null || _activeNodeHelper2$pa === void 0 ? void 0 : _activeNodeHelper2$pa.removeChild(activeNodeHelper);
|
|
222
226
|
activeNodeHelper = null; // Remove redundant styles
|
|
223
227
|
|
|
@@ -260,7 +264,7 @@ var useSortHelper = function useSortHelper(config) {
|
|
|
260
264
|
oldIndex: activeNodeOldIndex,
|
|
261
265
|
newIndex: activeNodeNextIndex
|
|
262
266
|
}, mouseDownEvent.nativeEvent);
|
|
263
|
-
}, [autoScroll, getOrderedItems, onSort, onSortEnd, onSortMove, onSortStart, transitionDuration]);
|
|
267
|
+
}, [autoScroll, getOrderedItems, isMounted, onSort, onSortEnd, onSortMove, onSortStart, transitionDuration]);
|
|
264
268
|
/**
|
|
265
269
|
* Determine whether to start dragging
|
|
266
270
|
* */
|
package/esm/Menu/MenuItem.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface MenuItemProps {
|
|
|
8
8
|
/** Render prop */
|
|
9
9
|
children: (menuitem: React.LiHTMLAttributes<HTMLLIElement> & MenuitemRenderProps, ref: React.Ref<HTMLLIElement>) => React.ReactElement;
|
|
10
10
|
/** Callback when menuitem is being activated */
|
|
11
|
-
onActivate?: (event: React.SyntheticEvent
|
|
11
|
+
onActivate?: (event: React.SyntheticEvent) => void;
|
|
12
12
|
}
|
|
13
13
|
export interface MenuitemRenderProps {
|
|
14
14
|
selected: boolean;
|
package/esm/Menu/Menubar.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export interface MenubarProps {
|
|
|
5
5
|
/** Render prop */
|
|
6
6
|
children: (menubar: React.HTMLAttributes<HTMLUListElement>, ref: React.Ref<HTMLUListElement>) => React.ReactElement;
|
|
7
7
|
/** Callback triggered when an item is being activated */
|
|
8
|
-
onActivateItem?: (event: React.SyntheticEvent
|
|
8
|
+
onActivateItem?: (event: React.SyntheticEvent) => void;
|
|
9
9
|
}
|
|
10
10
|
export default function Menubar({ vertical, children, onActivateItem }: MenubarProps): JSX.Element;
|
package/esm/Message/Message.js
CHANGED
|
@@ -4,9 +4,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
6
6
|
|
|
7
|
-
import React, { useState } from 'react';
|
|
7
|
+
import React, { useState, useCallback } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { useClassNames, useTimeout, MESSAGE_STATUS_ICONS, STATUS } from '../utils';
|
|
9
|
+
import { useClassNames, useTimeout, MESSAGE_STATUS_ICONS, STATUS, useIsMounted } from '../utils';
|
|
10
10
|
import CloseButton from '../CloseButton';
|
|
11
11
|
var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
12
12
|
var _withClassPrefix;
|
|
@@ -35,12 +35,24 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
35
35
|
var _useClassNames = useClassNames(classPrefix),
|
|
36
36
|
withClassPrefix = _useClassNames.withClassPrefix,
|
|
37
37
|
merge = _useClassNames.merge,
|
|
38
|
-
prefix = _useClassNames.prefix;
|
|
38
|
+
prefix = _useClassNames.prefix;
|
|
39
39
|
|
|
40
|
+
var isMounted = useIsMounted(); // Timed close message
|
|
40
41
|
|
|
41
42
|
var _useTimeout = useTimeout(onClose, duration, duration > 0),
|
|
42
43
|
clear = _useTimeout.clear;
|
|
43
44
|
|
|
45
|
+
var handleClose = useCallback(function (event) {
|
|
46
|
+
setDisplay('hiding');
|
|
47
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
48
|
+
clear();
|
|
49
|
+
setTimeout(function () {
|
|
50
|
+
if (isMounted()) {
|
|
51
|
+
setDisplay('hide');
|
|
52
|
+
}
|
|
53
|
+
}, 1000);
|
|
54
|
+
}, [clear, isMounted, onClose]);
|
|
55
|
+
|
|
44
56
|
if (display === 'hide') {
|
|
45
57
|
return null;
|
|
46
58
|
}
|
|
@@ -48,16 +60,6 @@ var Message = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
48
60
|
var classes = merge(className, withClassPrefix(type, display, (_withClassPrefix = {
|
|
49
61
|
full: full
|
|
50
62
|
}, _withClassPrefix['has-title'] = header, _withClassPrefix['has-icon'] = showIcon, _withClassPrefix)));
|
|
51
|
-
|
|
52
|
-
var handleClose = function handleClose(event) {
|
|
53
|
-
setDisplay('hiding');
|
|
54
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
55
|
-
clear();
|
|
56
|
-
setTimeout(function () {
|
|
57
|
-
setDisplay('hide');
|
|
58
|
-
}, 1000);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
63
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
62
64
|
role: "alert"
|
|
63
65
|
}, rest, {
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -7,6 +7,8 @@ var _templateObject, _templateObject2;
|
|
|
7
7
|
import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import pick from 'lodash/pick';
|
|
10
|
+
import on from 'dom-lib/on';
|
|
11
|
+
import getTransitionEnd from 'dom-lib/getTransitionEnd';
|
|
10
12
|
import BaseModal, { modalPropTypes } from '../Overlay/Modal';
|
|
11
13
|
import Bounce from '../Animation/Bounce';
|
|
12
14
|
import { useClassNames, mergeRefs, SIZE } from '../utils';
|
|
@@ -16,7 +18,6 @@ import ModalBody from './ModalBody';
|
|
|
16
18
|
import ModalHeader from './ModalHeader';
|
|
17
19
|
import ModalTitle from './ModalTitle';
|
|
18
20
|
import ModalFooter from './ModalFooter';
|
|
19
|
-
import helper from '../DOMHelper';
|
|
20
21
|
import { useBodyStyles } from './utils';
|
|
21
22
|
import useUniqueId from '../utils/useUniqueId';
|
|
22
23
|
var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -97,7 +98,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
97
98
|
// When the value of `backdrop` is `static`, a jitter animation will be added to the dialog when clicked.
|
|
98
99
|
if (backdrop === 'static') {
|
|
99
100
|
setShake(true);
|
|
100
|
-
transitionEndListener.current =
|
|
101
|
+
transitionEndListener.current = on(dialogRef.current, getTransitionEnd(), function () {
|
|
101
102
|
setShake(false);
|
|
102
103
|
});
|
|
103
104
|
}
|