@lobehub/ui 2.18.2 → 2.18.3

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.
@@ -34,8 +34,7 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
34
34
  userStyle = _ref.style,
35
35
  _ref$accordion = _ref.accordion,
36
36
  accordion = _ref$accordion === void 0 ? false : _ref$accordion,
37
- _ref$defaultExpandedK = _ref.defaultExpandedKeys,
38
- defaultExpandedKeys = _ref$defaultExpandedK === void 0 ? [] : _ref$defaultExpandedK,
37
+ defaultExpandedKeys = _ref.defaultExpandedKeys,
39
38
  expandedKeysProp = _ref.expandedKeys,
40
39
  onExpandedChange = _ref.onExpandedChange,
41
40
  _ref$variant = _ref.variant,
@@ -58,7 +57,18 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
58
57
  var _useStyles = useStyles(),
59
58
  cx = _useStyles.cx,
60
59
  styles = _useStyles.styles;
61
- var _useMergeState = useMergeState(defaultExpandedKeys, {
60
+
61
+ // Convert children to array and filter valid elements
62
+ var validChildren = Children.toArray(children).filter(isValidElement);
63
+
64
+ // Collect all item keys
65
+ var allItemKeys = validChildren.map(function (child, index) {
66
+ return child.props.itemKey || index;
67
+ });
68
+
69
+ // If defaultExpandedKeys or expandedKeys is undefined, expand all items by default
70
+ var initialExpandedKeys = defaultExpandedKeys !== null && defaultExpandedKeys !== void 0 ? defaultExpandedKeys : allItemKeys;
71
+ var _useMergeState = useMergeState(initialExpandedKeys, {
62
72
  onChange: onExpandedChange,
63
73
  value: expandedKeysProp
64
74
  }),
@@ -92,9 +102,6 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
92
102
  showDivider: showDivider,
93
103
  variant: variant
94
104
  };
95
-
96
- // Convert children to array and filter valid elements
97
- var validChildren = Children.toArray(children).filter(isValidElement);
98
105
  var content = /*#__PURE__*/_jsx(_Fragment, {
99
106
  children: validChildren.map(function (child, index) {
100
107
  // Extract itemKey from child props to use as React key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.18.2",
3
+ "version": "2.18.3",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",