rsuite 5.53.0 → 5.53.1
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 +10 -0
- package/cjs/Carousel/Carousel.js +1 -1
- package/cjs/DateRangePicker/DateRangePicker.js +1 -1
- package/cjs/Nav/Nav.js +1 -2
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/Stack/Stack.js +2 -2
- package/cjs/Steps/Steps.js +1 -1
- package/cjs/Tabs/Tabs.d.ts +1 -1
- package/cjs/Timeline/Timeline.js +1 -1
- package/cjs/utils/ReactChildren.d.ts +2 -2
- package/cjs/utils/ReactChildren.js +12 -9
- package/dist/rsuite.js +9 -9
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Carousel/Carousel.js +1 -1
- package/esm/DateRangePicker/DateRangePicker.js +1 -1
- package/esm/Nav/Nav.js +1 -2
- package/esm/Panel/Panel.js +2 -2
- package/esm/Stack/Stack.js +3 -3
- package/esm/Steps/Steps.js +1 -1
- package/esm/Tabs/Tabs.d.ts +1 -1
- package/esm/Timeline/Timeline.js +1 -1
- package/esm/utils/ReactChildren.d.ts +2 -2
- package/esm/utils/ReactChildren.js +12 -9
- package/package.json +1 -1
package/esm/Carousel/Carousel.js
CHANGED
|
@@ -91,7 +91,7 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
91
91
|
var uniqueId = useMemo(function () {
|
|
92
92
|
return guid();
|
|
93
93
|
}, []);
|
|
94
|
-
var items =
|
|
94
|
+
var items = ReactChildren.map(children, function (child, index) {
|
|
95
95
|
var _extends2;
|
|
96
96
|
if (!child) {
|
|
97
97
|
return;
|
|
@@ -622,7 +622,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
622
622
|
disabledShortcut: disabledShortcutButton,
|
|
623
623
|
onShortcutClick: handleShortcutPageDate,
|
|
624
624
|
"data-testid": "daterange-predefined-side"
|
|
625
|
-
}), /*#__PURE__*/React.createElement(
|
|
625
|
+
}), /*#__PURE__*/React.createElement(Stack.Item, null, /*#__PURE__*/React.createElement("div", {
|
|
626
626
|
className: prefix('daterange-content')
|
|
627
627
|
}, showHeader && /*#__PURE__*/React.createElement("div", {
|
|
628
628
|
className: prefix('daterange-header'),
|
package/esm/Nav/Nav.js
CHANGED
|
@@ -62,8 +62,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
62
62
|
}));
|
|
63
63
|
var _ref = sidenav || {},
|
|
64
64
|
activeKeyFromSidenav = _ref.activeKey,
|
|
65
|
-
|
|
66
|
-
onSelectFromSidenav = _ref$onSelect === void 0 ? onSelectProp : _ref$onSelect;
|
|
65
|
+
onSelectFromSidenav = _ref.onSelect;
|
|
67
66
|
var _useControlled = useControlled(activeKeyProp !== null && activeKeyProp !== void 0 ? activeKeyProp : activeKeyFromSidenav, defaultActiveKey),
|
|
68
67
|
activeKey = _useControlled[0],
|
|
69
68
|
setActiveKey = _useControlled[1];
|
package/esm/Panel/Panel.js
CHANGED
|
@@ -75,14 +75,14 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
75
75
|
onGroupSelect === null || onGroupSelect === void 0 ? void 0 : onGroupSelect(eventKey, event);
|
|
76
76
|
setExpanded(!expanded);
|
|
77
77
|
});
|
|
78
|
-
var renderBody =
|
|
78
|
+
var renderBody = function renderBody(bodyProps) {
|
|
79
79
|
var classes = prefix('body', {
|
|
80
80
|
'body-fill': bodyFill
|
|
81
81
|
});
|
|
82
82
|
return /*#__PURE__*/React.createElement("div", _extends({}, bodyProps, {
|
|
83
83
|
className: classes
|
|
84
84
|
}), children);
|
|
85
|
-
}
|
|
85
|
+
};
|
|
86
86
|
var renderCollapsibleBody = function renderCollapsibleBody() {
|
|
87
87
|
return /*#__PURE__*/React.createElement(Collapse, {
|
|
88
88
|
in: expanded,
|
package/esm/Stack/Stack.js
CHANGED
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useClassNames, useCustom, isSupportFlexGap } from '../utils';
|
|
6
|
+
import { useClassNames, useCustom, isSupportFlexGap, ReactChildren } from '../utils';
|
|
7
7
|
import { oneOf } from '../internals/propTypes';
|
|
8
8
|
import StackItem from './StackItem';
|
|
9
9
|
/**
|
|
@@ -53,12 +53,12 @@ var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
53
53
|
* toArray remove undefined, null and boolean
|
|
54
54
|
*/
|
|
55
55
|
var filterChildren = React.Children.toArray(children);
|
|
56
|
-
var count = filterChildren
|
|
56
|
+
var count = ReactChildren.count(filterChildren);
|
|
57
57
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
58
58
|
ref: ref,
|
|
59
59
|
className: classes,
|
|
60
60
|
style: styles
|
|
61
|
-
}),
|
|
61
|
+
}), ReactChildren.map(filterChildren, function (child, index) {
|
|
62
62
|
var childNode = childrenRenderMode === 'wrap' && child.type !== StackItem ? /*#__PURE__*/React.createElement(StackItem, {
|
|
63
63
|
key: index,
|
|
64
64
|
className: prefix('item'),
|
package/esm/Steps/Steps.js
CHANGED
|
@@ -35,7 +35,7 @@ var Steps = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
35
35
|
vertical: vertical,
|
|
36
36
|
horizontal: !vertical
|
|
37
37
|
}));
|
|
38
|
-
var count =
|
|
38
|
+
var count = ReactChildren.count(children);
|
|
39
39
|
var items = ReactChildren.mapCloneElement(children, function (item, index) {
|
|
40
40
|
var itemStyles = {
|
|
41
41
|
flexBasis: index < count - 1 ? 100 / (count - 1) + "%" : undefined,
|
package/esm/Tabs/Tabs.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface TabsProps extends WithAsProps {
|
|
|
35
35
|
* @param event
|
|
36
36
|
* @returns
|
|
37
37
|
*/
|
|
38
|
-
onSelect?: (eventKey: string, event: React.
|
|
38
|
+
onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
|
|
39
39
|
}
|
|
40
40
|
interface TabsComponent extends RsRefForwardingComponent<'div', TabsProps> {
|
|
41
41
|
Tab: typeof Tab;
|
package/esm/Timeline/Timeline.js
CHANGED
|
@@ -28,7 +28,7 @@ var Timeline = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
28
28
|
var _useClassNames = useClassNames(classPrefix),
|
|
29
29
|
merge = _useClassNames.merge,
|
|
30
30
|
withClassPrefix = _useClassNames.withClassPrefix;
|
|
31
|
-
var count =
|
|
31
|
+
var count = ReactChildren.count(children);
|
|
32
32
|
var withTime = some(React.Children.toArray(children), function (item) {
|
|
33
33
|
var _item$props;
|
|
34
34
|
return item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.time;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare function find(children: React.ReactNode, func: any, context?: any): React.ReactNode;
|
|
3
|
-
export declare function map(children: React.ReactNode, func: any, context?: any): any;
|
|
4
|
-
export declare function mapCloneElement(children: React.ReactNode, func: any, context?: any): any;
|
|
3
|
+
export declare function map(children: React.ReactNode, func: any, context?: any): any[];
|
|
4
|
+
export declare function mapCloneElement(children: React.ReactNode, func: any, context?: any): any[];
|
|
5
5
|
export declare function count(children: React.ReactNode): number;
|
|
6
6
|
declare function some(children: React.ReactNode, func: any, context?: any): boolean;
|
|
7
7
|
declare const _default: {
|
|
@@ -9,14 +9,19 @@ function typeOf(object) {
|
|
|
9
9
|
function isFragment(children) {
|
|
10
10
|
return React.Children.count(children) === 1 && typeOf(children) === Symbol.for('react.fragment');
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
function flatChildren(children) {
|
|
13
|
+
return React.Children.toArray(React.Children.map(children, function (child) {
|
|
14
|
+
if (isFragment(child)) {
|
|
15
|
+
var _child$props;
|
|
16
|
+
return React.Children.toArray(((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children) || []);
|
|
17
|
+
}
|
|
18
|
+
return child;
|
|
19
|
+
}));
|
|
15
20
|
}
|
|
16
21
|
export function find(children, func, context) {
|
|
17
22
|
var index = 0;
|
|
18
23
|
var result;
|
|
19
|
-
React.Children.forEach(
|
|
24
|
+
React.Children.forEach(flatChildren(children), function (child) {
|
|
20
25
|
if (result) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
@@ -29,7 +34,7 @@ export function find(children, func, context) {
|
|
|
29
34
|
}
|
|
30
35
|
export function map(children, func, context) {
|
|
31
36
|
var index = 0;
|
|
32
|
-
return React.Children.map(
|
|
37
|
+
return React.Children.map(flatChildren(children), function (child) {
|
|
33
38
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
34
39
|
return child;
|
|
35
40
|
}
|
|
@@ -46,14 +51,12 @@ export function mapCloneElement(children, func, context) {
|
|
|
46
51
|
}, context);
|
|
47
52
|
}
|
|
48
53
|
export function count(children) {
|
|
49
|
-
return React.Children.count(
|
|
50
|
-
return child;
|
|
51
|
-
}) : children);
|
|
54
|
+
return React.Children.count(flatChildren(children));
|
|
52
55
|
}
|
|
53
56
|
function some(children, func, context) {
|
|
54
57
|
var index = 0;
|
|
55
58
|
var result = false;
|
|
56
|
-
React.Children.forEach(
|
|
59
|
+
React.Children.forEach(flatChildren(children), function (child) {
|
|
57
60
|
if (result) {
|
|
58
61
|
return;
|
|
59
62
|
}
|