rsuite 5.28.3 → 5.30.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/CHANGELOG.md +15 -0
- package/cjs/Affix/Affix.d.ts +5 -3
- package/cjs/Affix/Affix.js +33 -11
- package/cjs/Calendar/CalendarHeader.js +12 -3
- package/cjs/Cascader/Cascader.js +1 -1
- package/cjs/DatePicker/DatePicker.d.ts +34 -3
- package/cjs/DatePicker/DatePicker.js +38 -16
- package/cjs/DateRangePicker/DateRangePicker.d.ts +9 -1
- package/cjs/DateRangePicker/DateRangePicker.js +58 -39
- package/cjs/DateRangePicker/DateRangePickerContext.d.ts +7 -0
- package/cjs/DateRangePicker/DateRangePickerContext.js +19 -0
- package/cjs/Overlay/Modal.js +5 -5
- package/cjs/Overlay/OverlayTrigger.js +3 -2
- package/cjs/utils/dateUtils.d.ts +1 -0
- package/cjs/utils/dateUtils.js +10 -3
- package/cjs/utils/deprecatePropType.d.ts +5 -0
- package/cjs/utils/deprecatePropType.js +5 -0
- package/cjs/utils/usePortal.js +9 -12
- package/dist/rsuite-no-reset-rtl.css +16690 -0
- package/dist/rsuite-no-reset-rtl.min.css +2 -0
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -0
- package/dist/rsuite-no-reset.css +16714 -0
- package/dist/rsuite-no-reset.min.css +2 -0
- package/dist/rsuite-no-reset.min.css.map +1 -0
- package/dist/rsuite.js +21 -10
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Affix/Affix.d.ts +5 -3
- package/esm/Affix/Affix.js +32 -11
- package/esm/Calendar/CalendarHeader.js +11 -3
- package/esm/Cascader/Cascader.js +1 -1
- package/esm/DatePicker/DatePicker.d.ts +34 -3
- package/esm/DatePicker/DatePicker.js +37 -16
- package/esm/DateRangePicker/DateRangePicker.d.ts +9 -1
- package/esm/DateRangePicker/DateRangePicker.js +56 -39
- package/esm/DateRangePicker/DateRangePickerContext.d.ts +7 -0
- package/esm/DateRangePicker/DateRangePickerContext.js +6 -0
- package/esm/Overlay/Modal.js +5 -4
- package/esm/Overlay/OverlayTrigger.js +3 -2
- package/esm/utils/dateUtils.d.ts +1 -0
- package/esm/utils/dateUtils.js +10 -3
- package/esm/utils/deprecatePropType.d.ts +5 -0
- package/esm/utils/deprecatePropType.js +5 -0
- package/esm/utils/usePortal.js +10 -13
- package/package.json +1 -1
|
@@ -98,7 +98,8 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
98
98
|
var _usePortal = usePortal({
|
|
99
99
|
container: container
|
|
100
100
|
}),
|
|
101
|
-
Portal = _usePortal.Portal
|
|
101
|
+
Portal = _usePortal.Portal,
|
|
102
|
+
containerElement = _usePortal.target;
|
|
102
103
|
|
|
103
104
|
var triggerRef = useRef();
|
|
104
105
|
var overlayRef = useRef();
|
|
@@ -345,7 +346,7 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
345
346
|
}) : undefined,
|
|
346
347
|
onExited: createChainedFunction(followCursor ? handleExited : undefined, onExited),
|
|
347
348
|
placement: placement,
|
|
348
|
-
container:
|
|
349
|
+
container: containerElement,
|
|
349
350
|
open: open
|
|
350
351
|
});
|
|
351
352
|
|
package/esm/utils/dateUtils.d.ts
CHANGED
package/esm/utils/dateUtils.js
CHANGED
|
@@ -57,15 +57,21 @@ function validTime(calendarProps, date) {
|
|
|
57
57
|
|
|
58
58
|
return Object.keys(calendarProps).some(function (key) {
|
|
59
59
|
if (/(Hours)/.test(key)) {
|
|
60
|
-
|
|
60
|
+
var _calendarProps$key;
|
|
61
|
+
|
|
62
|
+
return (_calendarProps$key = calendarProps[key]) === null || _calendarProps$key === void 0 ? void 0 : _calendarProps$key.call(calendarProps, getHours(date), date);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
if (/(Minutes)/.test(key)) {
|
|
64
|
-
|
|
66
|
+
var _calendarProps$key2;
|
|
67
|
+
|
|
68
|
+
return (_calendarProps$key2 = calendarProps[key]) === null || _calendarProps$key2 === void 0 ? void 0 : _calendarProps$key2.call(calendarProps, getMinutes(date), date);
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
if (/(Seconds)/.test(key)) {
|
|
68
|
-
|
|
72
|
+
var _calendarProps$key3;
|
|
73
|
+
|
|
74
|
+
return (_calendarProps$key3 = calendarProps[key]) === null || _calendarProps$key3 === void 0 ? void 0 : _calendarProps$key3.call(calendarProps, getSeconds(date), date);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
return false;
|
|
@@ -73,6 +79,7 @@ function validTime(calendarProps, date) {
|
|
|
73
79
|
}
|
|
74
80
|
/**
|
|
75
81
|
* Verify that the time is valid.
|
|
82
|
+
*
|
|
76
83
|
* @param props
|
|
77
84
|
* @param date
|
|
78
85
|
*/
|
|
@@ -7,5 +7,10 @@ import * as PropTypes from 'prop-types';
|
|
|
7
7
|
export default function deprecatePropType<T extends PropTypes.Validator<any>>(propType: T, explanation?: string): typeof propType;
|
|
8
8
|
/**
|
|
9
9
|
* Prints deprecation message when user uses a deprecated prop
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* deprecatePropTypeNew(PropTypes.bool, 'Use Dropdown.Separator component instead.')
|
|
14
|
+
*
|
|
10
15
|
*/
|
|
11
16
|
export declare function deprecatePropTypeNew<T extends PropTypes.Validator<any>>(propType: T, explanation?: string): typeof propType;
|
|
@@ -23,6 +23,11 @@ export default function deprecatePropType(propType, explanation) {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Prints deprecation message when user uses a deprecated prop
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
*
|
|
29
|
+
* deprecatePropTypeNew(PropTypes.bool, 'Use Dropdown.Separator component instead.')
|
|
30
|
+
*
|
|
26
31
|
*/
|
|
27
32
|
|
|
28
33
|
export function deprecatePropTypeNew(propType, explanation) {
|
package/esm/utils/usePortal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useState, useCallback, useMemo } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import canUseDOM from 'dom-lib/canUseDOM';
|
|
5
5
|
var MountedPortal = /*#__PURE__*/React.memo(function (_ref) {
|
|
@@ -30,24 +30,21 @@ function usePortal(props) {
|
|
|
30
30
|
container = _props.container,
|
|
31
31
|
_props$waitMount = _props.waitMount,
|
|
32
32
|
waitMount = _props$waitMount === void 0 ? false : _props$waitMount;
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var parentElement = containerElement || document.body;
|
|
38
|
-
rootElemRef.current = parentElement;
|
|
39
|
-
}, [rootElemRef, container]);
|
|
33
|
+
var containerElement = typeof container === 'function' ? container() : container;
|
|
34
|
+
var rootElement = useMemo(function () {
|
|
35
|
+
return canUseDOM ? containerElement || document.body : null;
|
|
36
|
+
}, [containerElement]);
|
|
40
37
|
var Portal = useCallback(function (_ref2) {
|
|
41
38
|
var children = _ref2.children;
|
|
42
|
-
return
|
|
43
|
-
}, []);
|
|
39
|
+
return rootElement != null ? /*#__PURE__*/createPortal(children, rootElement) : null;
|
|
40
|
+
}, [rootElement]);
|
|
44
41
|
var WaitMountPortal = useCallback(function (props) {
|
|
45
42
|
return /*#__PURE__*/React.createElement(MountedPortal, _extends({
|
|
46
|
-
container:
|
|
43
|
+
container: rootElement
|
|
47
44
|
}, props));
|
|
48
|
-
}, []);
|
|
45
|
+
}, [rootElement]);
|
|
49
46
|
return {
|
|
50
|
-
target:
|
|
47
|
+
target: rootElement,
|
|
51
48
|
Portal: waitMount ? WaitMountPortal : Portal
|
|
52
49
|
};
|
|
53
50
|
}
|