rsuite 5.53.0 → 5.53.2

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.
@@ -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 = React.Children.map(children, function (child, index) {
94
+ var items = ReactChildren.map(children, function (child, index) {
95
95
  var _extends2;
96
96
  if (!child) {
97
97
  return;
@@ -130,7 +130,7 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
130
130
  var _useClassNames = useClassNames(classPrefix),
131
131
  prefix = _useClassNames.prefix,
132
132
  merge = _useClassNames.merge;
133
- var _useClassNames2 = useClassNames('check-tree'),
133
+ var _useClassNames2 = useClassNames(inline && classPrefix !== 'picker' ? classPrefix : 'check-tree'),
134
134
  checkTreePrefix = _useClassNames2.prefix,
135
135
  withCheckTreeClassPrefix = _useClassNames2.withClassPrefix;
136
136
  var _useControlled = useControlled(controlledValue, defaultValue),
@@ -602,8 +602,11 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
602
602
  }, nodeProps));
603
603
  };
604
604
  var renderCheckTree = function renderCheckTree() {
605
- var _withCheckTreeClassPr, _merge2;
606
- var classes = withCheckTreeClassPrefix((_withCheckTreeClassPr = {}, _withCheckTreeClassPr[className !== null && className !== void 0 ? className : ''] = inline, _withCheckTreeClassPr['without-children'] = !isSomeNodeHasChildren(data, childrenKey), _withCheckTreeClassPr.virtualized = virtualized, _withCheckTreeClassPr));
605
+ var _merge2, _merge3;
606
+ var classes = merge(withCheckTreeClassPrefix({
607
+ 'without-children': !isSomeNodeHasChildren(data, childrenKey),
608
+ virtualized: virtualized
609
+ }), (_merge2 = {}, _merge2[className !== null && className !== void 0 ? className : ''] = inline, _merge2));
607
610
  var formattedNodes = getFormattedNodes(renderNode);
608
611
  if (!formattedNodes.some(function (v) {
609
612
  return v !== null;
@@ -612,18 +615,25 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
612
615
  className: prefix('none')
613
616
  }, locale.noResultsText);
614
617
  }
615
- var treeNodesClass = merge(checkTreePrefix('root'), (_merge2 = {}, _merge2[checkTreePrefix('all-uncheckable')] = isEveryFirstLevelNodeUncheckable(flattenNodes, uncheckableItemValues, valueKey), _merge2));
616
- return /*#__PURE__*/React.createElement(TreeView, {
617
- ref: inline ? root : treeView,
618
+ var treeNodesClass = merge(checkTreePrefix('root'), (_merge3 = {}, _merge3[checkTreePrefix('all-uncheckable')] = isEveryFirstLevelNodeUncheckable(flattenNodes, uncheckableItemValues, valueKey), _merge3));
619
+ var treeViewProps = {
620
+ ref: treeView
621
+ };
622
+ if (inline) {
623
+ treeViewProps = _extends({
624
+ ref: root,
625
+ style: _extends({
626
+ height: height
627
+ }, style)
628
+ }, rest);
629
+ }
630
+ return /*#__PURE__*/React.createElement(TreeView, _extends({}, treeViewProps, {
618
631
  multiselectable: true,
619
632
  treeRootClassName: treeNodesClass,
620
633
  className: classes,
621
- style: inline ? _extends({
622
- height: height
623
- }, style) : {},
624
634
  onScroll: onScroll,
625
635
  onKeyDown: inline ? handleTreeKeydown : undefined
626
- }, virtualized ? /*#__PURE__*/React.createElement(AutoSizer, {
636
+ }), virtualized ? /*#__PURE__*/React.createElement(AutoSizer, {
627
637
  defaultHeight: inline ? height : menuMaxHeight,
628
638
  style: {
629
639
  width: 'auto',
@@ -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(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
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
- _ref$onSelect = _ref.onSelect,
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];
@@ -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 = useEventCallback(function (bodyProps) {
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,
@@ -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.length;
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
- }), React.Children.map(filterChildren, function (child, index) {
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'),
@@ -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 = React.Children.count(children);
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,
@@ -35,7 +35,7 @@ export interface TabsProps extends WithAsProps {
35
35
  * @param event
36
36
  * @returns
37
37
  */
38
- onSelect?: (eventKey: string, event: React.MouseEvent) => void;
38
+ onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
39
39
  }
40
40
  interface TabsComponent extends RsRefForwardingComponent<'div', TabsProps> {
41
41
  Tab: typeof Tab;
@@ -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 = React.Children.count(children);
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;
@@ -157,7 +157,7 @@ var TreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
157
157
  var _useClassNames = useClassNames(classPrefix),
158
158
  prefix = _useClassNames.prefix,
159
159
  merge = _useClassNames.merge;
160
- var _useClassNames2 = useClassNames('tree'),
160
+ var _useClassNames2 = useClassNames(inline && classPrefix !== 'picker' ? classPrefix : 'tree'),
161
161
  treePrefix = _useClassNames2.prefix,
162
162
  withTreeClassPrefix = _useClassNames2.withClassPrefix;
163
163
  var _useTreeSearch = useTreeSearch({
@@ -584,18 +584,27 @@ var TreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
584
584
  }, nodeProps));
585
585
  };
586
586
  var renderTree = function renderTree() {
587
- var _withTreeClassPrefix;
588
- var classes = withTreeClassPrefix((_withTreeClassPrefix = {}, _withTreeClassPrefix[className !== null && className !== void 0 ? className : ''] = inline, _withTreeClassPrefix.virtualized = virtualized, _withTreeClassPrefix));
587
+ var _merge2;
588
+ var classes = merge(withTreeClassPrefix({
589
+ virtualized: virtualized
590
+ }), (_merge2 = {}, _merge2[className !== null && className !== void 0 ? className : ''] = inline, _merge2));
589
591
  var formattedNodes = getFormattedNodes(renderNode);
590
- return /*#__PURE__*/React.createElement(TreeView, {
592
+ var treeViewProps = {
593
+ ref: treeView
594
+ };
595
+ if (inline) {
596
+ treeViewProps = _extends({
597
+ ref: root,
598
+ style: _extends({
599
+ height: height
600
+ }, style),
601
+ onKeyDown: handleTreeKeyDown
602
+ }, rest);
603
+ }
604
+ return /*#__PURE__*/React.createElement(TreeView, _extends({}, treeViewProps, {
591
605
  treeRootClassName: treePrefix('root'),
592
- ref: inline ? root : treeView,
593
- className: classes,
594
- style: inline ? _extends({
595
- height: height
596
- }, style) : {},
597
- onKeyDown: inline ? handleTreeKeyDown : undefined
598
- }, virtualized ? /*#__PURE__*/React.createElement(AutoSizer, {
606
+ className: classes
607
+ }), virtualized ? /*#__PURE__*/React.createElement(AutoSizer, {
599
608
  defaultHeight: inline ? height : menuMaxHeight,
600
609
  style: {
601
610
  width: 'auto',
@@ -65,7 +65,6 @@ var ListCheckItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
65
65
  onClick: handleSelectItem,
66
66
  onCheckboxClick: handleCheck
67
67
  };
68
- console.log(className, 'className');
69
68
  return /*#__PURE__*/React.createElement(Component, _extends({
70
69
  role: "option",
71
70
  "aria-selected": active,
@@ -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 getChildren(children) {
13
- var _props;
14
- return isFragment(children) ? (_props = children.props) === null || _props === void 0 ? void 0 : _props.children : children;
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(getChildren(children), function (child) {
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(getChildren(children), function (child) {
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(Array.isArray(children) ? children.filter(function (child) {
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(getChildren(children), function (child) {
59
+ React.Children.forEach(flatChildren(children), function (child) {
57
60
  if (result) {
58
61
  return;
59
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.53.0",
3
+ "version": "5.53.2",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",