@lobehub/ui 2.15.2 → 2.15.4

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.
@@ -224,12 +224,16 @@ var DraggableSideNav = /*#__PURE__*/memo(function (_ref2) {
224
224
  }, [isExpand, isAnimating, isResizing]);
225
225
 
226
226
  // 处理外部 width prop 变化
227
+ // width 表示展开时的宽度,实际显示宽度根据 isExpand 状态决定
227
228
  useEffect(function () {
228
229
  if (width !== undefined && !isResizing && !isAnimating) {
229
- setInternalWidth(width);
230
+ // 更新展开宽度记录
231
+ setExpandedWidth(width);
232
+ // 根据当前状态设置实际宽度
230
233
  if (isExpand) {
231
- setExpandedWidth(width);
234
+ setInternalWidth(width);
232
235
  }
236
+ // 如果是折叠状态,保持 minWidth,不改变 internalWidth
233
237
  }
234
238
  }, [width, isResizing, isAnimating, isExpand]);
235
239
 
@@ -142,7 +142,9 @@ export interface DraggableSideNavProps extends Omit<DivProps, 'children' | 'onSe
142
142
  header?: CSSProperties;
143
143
  };
144
144
  /**
145
- * Current width (controlled)
145
+ * Expanded width (controlled)
146
+ * This represents the width when expanded, not the current displayed width
147
+ * The actual displayed width will be `width` when expanded, or `minWidth` when collapsed
146
148
  */
147
149
  width?: number;
148
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.15.2",
3
+ "version": "2.15.4",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",