@lobehub/ui 2.13.8 → 2.14.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.
@@ -11,7 +11,7 @@ export var useStyles = createStyles(function (_ref) {
11
11
  filled: stylish.variantFilledWithoutHover,
12
12
  loading: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n color: #fff;\n background: ", ";\n "])), token.colorBgMask),
13
13
  outlined: stylish.variantOutlinedWithoutHover,
14
- root: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: transparent;\n &.", "-avatar {\n user-select: none;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n\n border: none;\n\n .", "-avatar-string {\n transform: none !important;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n padding: 0;\n\n font-size: inherit;\n font-weight: bolder;\n line-height: 1;\n color: inherit;\n }\n }\n "])), prefixCls, prefixCls),
14
+ root: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: none;\n background: transparent;\n &.", "-avatar {\n user-select: none;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n\n border: none;\n\n .", "-avatar-string {\n transform: none !important;\n\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n padding: 0;\n\n font-size: inherit;\n font-weight: bolder;\n line-height: 1;\n color: inherit;\n }\n }\n "])), prefixCls, prefixCls),
15
15
  shadow: stylish.shadow
16
16
  };
17
17
  });
@@ -49,6 +49,10 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
49
49
  placement = _ref$placement === void 0 ? 'right' : _ref$placement,
50
50
  resize = _ref.resize,
51
51
  style = _ref.style,
52
+ _ref$showBorder = _ref.showBorder,
53
+ showBorder = _ref$showBorder === void 0 ? true : _ref$showBorder,
54
+ _ref$showHandleHighli = _ref.showHandleHighlight,
55
+ showHandleHighlight = _ref$showHandleHighli === void 0 ? false : _ref$showHandleHighli,
52
56
  _ref$showHandleWideAr = _ref.showHandleWideArea,
53
57
  showHandleWideArea = _ref$showHandleWideAr === void 0 ? DEFAULT_SHOW_HANDLE_WIDE_AREA : _ref$showHandleWideAr,
54
58
  size = _ref.size,
@@ -85,6 +89,7 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
85
89
  }, [direction, placement]);
86
90
  var _useStyles = useStyles({
87
91
  headerHeight: headerHeight,
92
+ showBorder: showBorder,
88
93
  showHandleWideArea: showHandleWideArea
89
94
  }),
90
95
  styles = _useStyles.styles,
@@ -307,9 +312,9 @@ var DraggablePanel = /*#__PURE__*/memo(function (_ref) {
307
312
  var inner = /*#__PURE__*/_jsx(Resizable, _objectSpread(_objectSpread({}, sizeProps), {}, {
308
313
  className: cx(styles.panel, classNames === null || classNames === void 0 ? void 0 : classNames.content),
309
314
  enable: canResizing ? resizing : undefined,
310
- handleClasses: canResizing ? _defineProperty({}, reversePlacement(internalPlacement), handleVariants({
315
+ handleClasses: canResizing ? _defineProperty({}, reversePlacement(internalPlacement), cx(handleVariants({
311
316
  placement: reversePlacement(internalPlacement)
312
- })) : {},
317
+ }), showHandleHighlight && styles.handleHighlight)) : {},
313
318
  onResize: handleResize,
314
319
  onResizeStart: handleResizeStart,
315
320
  onResizeStop: handleResizeStop,
@@ -1,5 +1,6 @@
1
1
  export declare const useStyles: (props?: {
2
2
  headerHeight: number;
3
+ showBorder: boolean;
3
4
  showHandleWideArea: boolean;
4
5
  } | undefined) => import("antd-style").ReturnStyles<{
5
6
  fixed: import("antd-style").SerializedStyles;
@@ -12,6 +13,7 @@ export declare const useStyles: (props?: {
12
13
  toggleRight: string;
13
14
  toggleRoot: string;
14
15
  toggleTop: string;
16
+ handleHighlight: import("antd-style").SerializedStyles;
15
17
  handleBottom: string;
16
18
  handleLeft: string;
17
19
  handleRight: string;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25;
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -19,15 +19,16 @@ export var useStyles = createStyles(function (_ref, _ref2) {
19
19
  token = _ref.token,
20
20
  stylish = _ref.stylish;
21
21
  var headerHeight = _ref2.headerHeight,
22
+ showBorder = _ref2.showBorder,
22
23
  showHandleWideArea = _ref2.showHandleWideArea;
23
24
  var prefix = "".concat(prefixCls, "-draggable-panel");
24
25
 
25
26
  // Base styles
26
27
  var borderStyles = {
27
- borderBottom: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-block-end-width: 1px;\n "]))),
28
- borderLeft: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-inline-start-width: 1px;\n "]))),
29
- borderRight: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-inline-end-width: 1px;\n "]))),
30
- borderTop: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-block-start-width: 1px;\n "])))
28
+ borderBottom: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-block-end-width: ", ";\n "])), showBorder ? '1px' : '0'),
29
+ borderLeft: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-inline-start-width: ", ";\n "])), showBorder ? '1px' : '0'),
30
+ borderRight: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-inline-end-width: ", ";\n "])), showBorder ? '1px' : '0'),
31
+ borderTop: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-block-start-width: ", ";\n "])), showBorder ? '1px' : '0')
31
32
  };
32
33
 
33
34
  // Position styles
@@ -40,32 +41,35 @@ export var useStyles = createStyles(function (_ref, _ref2) {
40
41
  };
41
42
 
42
43
  // Handle styles
43
- var handleBaseStyle = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n z-index: 50;\n transition: all 0.2s ", ";\n }\n\n &:hover,\n &:active {\n &::before {\n background: ", " !important;\n }\n }\n "])), token.motionEaseOut, token.colorPrimary);
44
+ var handleBaseStyle = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n z-index: 50;\n transition: all 0.2s ", ";\n }\n "])), token.motionEaseOut);
45
+ var handleHighlightStyle = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n &:hover {\n &::before {\n background: ", ";\n box-shadow: 0 0 8px ", "40;\n }\n }\n\n &:active {\n &::before {\n background: ", " !important;\n }\n }\n "])), token.colorPrimary, token.colorPrimary, token.colorPrimary);
44
46
  var handleStyles = {
45
- handleBottom: cx("".concat(prefix, "-bottom-handle"), css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n &::before {\n inset-block-end: 50%;\n width: 100%;\n height: 2px;\n }\n "])))),
46
- handleLeft: cx("".concat(prefix, "-left-handle"), css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n &::before {\n inset-inline-start: 50%;\n width: 2px;\n height: 100%;\n }\n "])))),
47
- handleRight: cx("".concat(prefix, "-right-handle"), css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n &::before {\n inset-inline-end: 50%;\n width: 2px;\n height: 100%;\n }\n "])))),
47
+ handleBottom: cx("".concat(prefix, "-bottom-handle"), css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n &::before {\n inset-block-end: 50%;\n width: 100%;\n height: 2px;\n }\n "])))),
48
+ handleLeft: cx("".concat(prefix, "-left-handle"), css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n &::before {\n inset-inline-start: 50%;\n width: 2px;\n height: 100%;\n }\n "])))),
49
+ handleRight: cx("".concat(prefix, "-right-handle"), css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n &::before {\n inset-inline-end: 50%;\n width: 2px;\n height: 100%;\n }\n "])))),
48
50
  handleRoot: handleBaseStyle,
49
- handleTop: cx("".concat(prefix, "-top-handle"), css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n &::before {\n inset-block-start: 50%;\n width: 100%;\n height: 2px;\n }\n "]))))
51
+ handleTop: cx("".concat(prefix, "-top-handle"), css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n &::before {\n inset-block-start: 50%;\n width: 100%;\n height: 2px;\n }\n "]))))
50
52
  };
51
53
 
52
54
  // Toggle styles
53
- var toggleBaseStyle = cx("".concat(prefix, "-toggle"), css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n pointer-events: ", ";\n\n position: absolute;\n z-index: 10;\n\n opacity: 0;\n\n transition: all 0.2s ", ";\n\n &:hover,\n &:active {\n opacity: 1 !important;\n }\n\n > div {\n ", ";\n pointer-events: all;\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n transition: all 0.2s ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n "])), showHandleWideArea ? 'all' : 'none', token.motionEaseOut, stylish.variantFilled, token.colorTextTertiary, token.motionEaseOut, token.colorTextSecondary, token.colorText));
55
+ var toggleBaseStyle = cx("".concat(prefix, "-toggle"), css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n pointer-events: ", ";\n\n position: absolute;\n z-index: 10;\n\n opacity: 0;\n\n transition: all 0.2s ", ";\n\n &:hover,\n &:active {\n opacity: 1 !important;\n }\n\n > div {\n ", ";\n pointer-events: all;\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n transition: all 0.2s ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n "])), showHandleWideArea ? 'all' : 'none', token.motionEaseOut, stylish.variantFilled, token.colorTextTertiary, token.motionEaseOut, token.colorTextSecondary, token.colorText));
54
56
  var toggleStyles = {
55
- toggleBottom: cx("".concat(prefix, "-toggle-bottom"), css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n inset-block-end: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n inset-inline-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-inline-start: -20px;\n border-radius: 0 0 4px 4px;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleShort)),
56
- toggleLeft: cx("".concat(prefix, "-toggle-left"), css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n inset-inline-start: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -20px;\n border-radius: 4px 0 0 4px;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength)),
57
- toggleRight: cx("".concat(prefix, "-toggle-right"), css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n inset-inline-end: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -20px;\n border-radius: 0 4px 4px 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength)),
57
+ toggleBottom: cx("".concat(prefix, "-toggle-bottom"), css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n inset-block-end: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n inset-inline-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-inline-start: -20px;\n border-radius: 0 0 4px 4px;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleShort)),
58
+ toggleLeft: cx("".concat(prefix, "-toggle-left"), css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n inset-inline-start: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -20px;\n border-radius: 4px 0 0 4px;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength)),
59
+ toggleRight: cx("".concat(prefix, "-toggle-right"), css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n inset-inline-end: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -20px;\n border-radius: 0 4px 4px 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength)),
58
60
  toggleRoot: toggleBaseStyle,
59
- toggleTop: cx("".concat(prefix, "-toggle-top"), css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n inset-block-start: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n inset-inline-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-inline-start: -20px;\n border-radius: 4px 4px 0 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleShort))
61
+ toggleTop: cx("".concat(prefix, "-toggle-top"), css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n inset-block-start: -", "px;\n width: 100%;\n height: ", "px;\n\n > div {\n inset-inline-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-inline-start: -20px;\n border-radius: 4px 4px 0 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleShort))
60
62
  };
61
63
 
62
64
  // Additional component styles
63
65
  var componentStyles = {
64
- fixed: css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n position: relative;\n "]))),
65
- fullscreen: css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n position: absolute;\n inset-block: ", "px 0;\n inset-inline: 0;\n\n width: 100%;\n height: calc(100% - ", "px);\n\n background: ", ";\n "])), headerHeight, headerHeight, token.colorBgContainerSecondary),
66
- handlerIcon: css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n transition: all 0.2s ", ";\n "])), token.motionEaseOut),
67
- panel: cx("".concat(prefix, "-fixed"), css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n overflow: hidden;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut)),
68
- root: cx(prefix, css(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n border: 0 solid ", ";\n\n &:hover {\n > .", "-toggle {\n opacity: 1;\n }\n }\n "])), token.colorBorderSecondary, prefix))
66
+ fixed: css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n position: relative;\n "]))),
67
+ fullscreen: css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n position: absolute;\n inset-block: ", "px 0;\n inset-inline: 0;\n\n width: 100%;\n height: calc(100% - ", "px);\n\n background: ", ";\n "])), headerHeight, headerHeight, token.colorBgContainerSecondary),
68
+ handlerIcon: css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n transition: all 0.2s ", ";\n "])), token.motionEaseOut),
69
+ panel: cx("".concat(prefix, "-fixed"), css(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n overflow: hidden;\n transition: all 0.2s ", ";\n "])), token.motionEaseOut)),
70
+ root: cx(prefix, css(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n border: 0 solid ", ";\n\n &:hover {\n > .", "-toggle {\n opacity: 1;\n }\n }\n "])), token.colorBorderSecondary, prefix))
69
71
  };
70
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, borderStyles), floatPositions), handleStyles), toggleStyles), componentStyles);
72
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, borderStyles), floatPositions), handleStyles), {}, {
73
+ handleHighlight: handleHighlightStyle
74
+ }, toggleStyles), componentStyles);
71
75
  });
@@ -26,6 +26,12 @@ export interface DraggablePanelProps extends DivProps {
26
26
  pin?: boolean;
27
27
  placement: PlacementType;
28
28
  resize?: RndProps['enableResizing'];
29
+ /**
30
+ * Whether to show border
31
+ * @default true
32
+ */
33
+ showBorder?: boolean;
34
+ showHandleHighlight?: boolean;
29
35
  showHandleWhenCollapsed?: boolean;
30
36
  showHandleWideArea?: boolean;
31
37
  size?: Partial<Size>;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { DraggableSideNavProps } from './type';
3
+ declare const DraggableSideNav: import("react").NamedExoticComponent<DraggableSideNavProps>;
4
+ export default DraggableSideNav;
@@ -0,0 +1,420 @@
1
+ 'use client';
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _excluded = ["animation", "children", "className", "classNames", "collapsed", "defaultCollapsed", "defaultSize", "footer", "header", "maxWidth", "minWidth", "onCollapsedChange", "onSizeChange", "onSizeDragging", "placement", "resizable", "showBorder", "showHandle", "showHandleWhenCollapsed", "showHandleHighlight", "size", "styles"];
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
+ import { useHover } from 'ahooks';
19
+ import { AnimatePresence, motion } from 'framer-motion';
20
+ import { ChevronLeft, ChevronRight } from 'lucide-react';
21
+ import { Resizable } from 're-resizable';
22
+ import { memo, useEffect, useMemo, useRef, useState } from 'react';
23
+ import { Center, Flexbox } from 'react-layout-kit';
24
+ import useControlledState from 'use-merge-value';
25
+ import Icon from "../Icon";
26
+ import { useStyles } from "./style";
27
+ import { jsx as _jsx } from "react/jsx-runtime";
28
+ import { jsxs as _jsxs } from "react/jsx-runtime";
29
+ var DEFAULT_MIN_WIDTH = 64; // 最小宽度即折叠宽度
30
+ var DEFAULT_COLLAPSED = false;
31
+ var DEFAULT_EXPANDED_WIDTH = 280;
32
+
33
+ // Animation variants generator based on fade and blur settings
34
+ var getAnimationVariants = function getAnimationVariants(fade, blur) {
35
+ var enterProps = {
36
+ transition: {
37
+ duration: 0.3,
38
+ ease: [0.22, 1, 0.36, 1]
39
+ }
40
+ };
41
+ var exitProps = {
42
+ transition: {
43
+ duration: 0.2,
44
+ ease: [0.4, 0, 1, 1]
45
+ }
46
+ };
47
+ if (fade) {
48
+ enterProps.opacity = 1;
49
+ exitProps.opacity = 0;
50
+ }
51
+ if (blur) {
52
+ enterProps.filter = 'blur(0px)';
53
+ exitProps.filter = 'blur(4px)';
54
+ }
55
+ return {
56
+ enter: enterProps,
57
+ exit: exitProps
58
+ };
59
+ };
60
+
61
+ // Wrapper component for content animation
62
+ var AnimationWrapper = /*#__PURE__*/memo(function (_ref) {
63
+ var blur = _ref.blur,
64
+ children = _ref.children,
65
+ collapsed = _ref.collapsed,
66
+ enabled = _ref.enabled,
67
+ fade = _ref.fade,
68
+ id = _ref.id;
69
+ if (!enabled) return children;
70
+ var variants = getAnimationVariants(fade, blur);
71
+ return /*#__PURE__*/_jsx(AnimatePresence, {
72
+ initial: false,
73
+ mode: "wait",
74
+ children: /*#__PURE__*/_jsx(motion.div, {
75
+ animate: "enter",
76
+ exit: "exit",
77
+ initial: "exit",
78
+ variants: variants,
79
+ children: children
80
+ }, "".concat(id, "-").concat(collapsed ? 'collapsed' : 'expanded'))
81
+ });
82
+ });
83
+ AnimationWrapper.displayName = 'AnimationWrapper';
84
+ var DraggableSideNav = /*#__PURE__*/memo(function (_ref2) {
85
+ var _animation$blur, _animation$fade, _animation$blur2, _animation$fade2, _animation$blur3, _animation$fade3;
86
+ var animation = _ref2.animation,
87
+ children = _ref2.children,
88
+ className = _ref2.className,
89
+ classNames = _ref2.classNames,
90
+ collapsed = _ref2.collapsed,
91
+ _ref2$defaultCollapse = _ref2.defaultCollapsed,
92
+ defaultCollapsed = _ref2$defaultCollapse === void 0 ? DEFAULT_COLLAPSED : _ref2$defaultCollapse,
93
+ defaultSize = _ref2.defaultSize,
94
+ footer = _ref2.footer,
95
+ header = _ref2.header,
96
+ maxWidth = _ref2.maxWidth,
97
+ _ref2$minWidth = _ref2.minWidth,
98
+ minWidth = _ref2$minWidth === void 0 ? DEFAULT_MIN_WIDTH : _ref2$minWidth,
99
+ onCollapsedChange = _ref2.onCollapsedChange,
100
+ onSizeChange = _ref2.onSizeChange,
101
+ onSizeDragging = _ref2.onSizeDragging,
102
+ _ref2$placement = _ref2.placement,
103
+ placement = _ref2$placement === void 0 ? 'left' : _ref2$placement,
104
+ _ref2$resizable = _ref2.resizable,
105
+ resizable = _ref2$resizable === void 0 ? true : _ref2$resizable,
106
+ _ref2$showBorder = _ref2.showBorder,
107
+ showBorder = _ref2$showBorder === void 0 ? true : _ref2$showBorder,
108
+ _ref2$showHandle = _ref2.showHandle,
109
+ showHandle = _ref2$showHandle === void 0 ? true : _ref2$showHandle,
110
+ _ref2$showHandleWhenC = _ref2.showHandleWhenCollapsed,
111
+ showHandleWhenCollapsed = _ref2$showHandleWhenC === void 0 ? false : _ref2$showHandleWhenC,
112
+ _ref2$showHandleHighl = _ref2.showHandleHighlight,
113
+ showHandleHighlight = _ref2$showHandleHighl === void 0 ? false : _ref2$showHandleHighl,
114
+ size = _ref2.size,
115
+ customStyles = _ref2.styles,
116
+ rest = _objectWithoutProperties(_ref2, _excluded);
117
+ var _useStyles = useStyles({
118
+ showBorder: showBorder
119
+ }),
120
+ styles = _useStyles.styles,
121
+ cx = _useStyles.cx;
122
+ var ref = useRef(null);
123
+ var isHovering = useHover(ref);
124
+ var _useControlledState = useControlledState(defaultCollapsed, {
125
+ onChange: onCollapsedChange,
126
+ value: collapsed
127
+ }),
128
+ _useControlledState2 = _slicedToArray(_useControlledState, 2),
129
+ isCollapsed = _useControlledState2[0],
130
+ setIsCollapsed = _useControlledState2[1];
131
+ var _useState = useState(false),
132
+ _useState2 = _slicedToArray(_useState, 2),
133
+ isResizing = _useState2[0],
134
+ setIsResizing = _useState2[1];
135
+ var _useState3 = useState(false),
136
+ _useState4 = _slicedToArray(_useState3, 2),
137
+ isAnimating = _useState4[0],
138
+ setIsAnimating = _useState4[1];
139
+
140
+ // 内部宽度状态,用于平滑动画
141
+ var _useState5 = useState(isCollapsed ? minWidth : (defaultSize === null || defaultSize === void 0 ? void 0 : defaultSize.width) || DEFAULT_EXPANDED_WIDTH),
142
+ _useState6 = _slicedToArray(_useState5, 2),
143
+ internalWidth = _useState6[0],
144
+ setInternalWidth = _useState6[1];
145
+
146
+ // 记住展开时的宽度
147
+ var _useState7 = useState((defaultSize === null || defaultSize === void 0 ? void 0 : defaultSize.width) || DEFAULT_EXPANDED_WIDTH),
148
+ _useState8 = _slicedToArray(_useState7, 2),
149
+ expandedWidth = _useState8[0],
150
+ setExpandedWidth = _useState8[1];
151
+
152
+ // 用于渲染的 collapsed 状态 - 延迟切换以匹配动画时机
153
+ var _useState9 = useState(isCollapsed),
154
+ _useState10 = _slicedToArray(_useState9, 2),
155
+ renderCollapsed = _useState10[0],
156
+ setRenderCollapsed = _useState10[1];
157
+
158
+ // 计算折叠阈值:展开最小宽度和折叠宽度的中间值
159
+ var collapseThreshold = useMemo(function () {
160
+ return minWidth + (expandedWidth - minWidth) / 3;
161
+ }, [minWidth, expandedWidth]);
162
+
163
+ // Toggle collapse state with smooth animation
164
+ var toggleCollapse = function toggleCollapse() {
165
+ setIsAnimating(true);
166
+ setIsCollapsed(!isCollapsed);
167
+
168
+ // 动画完成后重置状态 - 与宽度动画时长一致
169
+ setTimeout(function () {
170
+ setIsAnimating(false);
171
+ }, 400);
172
+ };
173
+
174
+ // 处理折叠状态变化时的宽度动画和内容切换时机
175
+ useEffect(function () {
176
+ if (isAnimating) {
177
+ // 使用 requestAnimationFrame 确保动画平滑
178
+ requestAnimationFrame(function () {
179
+ if (isCollapsed) {
180
+ setInternalWidth(minWidth);
181
+ // 折叠动画:延迟切换内容,在动画接近结束时才切换(300ms,略早于动画结束)
182
+ setTimeout(function () {
183
+ setRenderCollapsed(true);
184
+ }, 300);
185
+ } else {
186
+ // 展开动画:立即切换内容(先切换内容,再开始宽度动画)
187
+ setRenderCollapsed(false);
188
+ setInternalWidth(expandedWidth);
189
+ }
190
+ });
191
+ }
192
+ }, [isCollapsed, isAnimating, minWidth, expandedWidth]);
193
+
194
+ // 同步非动画期间的 renderCollapsed 状态(如拖拽)
195
+ useEffect(function () {
196
+ if (!isAnimating && !isResizing) {
197
+ setRenderCollapsed(isCollapsed);
198
+ }
199
+ }, [isCollapsed, isAnimating, isResizing]);
200
+
201
+ // 处理外部 size prop 变化
202
+ useEffect(function () {
203
+ if (size !== null && size !== void 0 && size.width && !isResizing && !isAnimating) {
204
+ var width = typeof size.width === 'string' ? parseInt(size.width) : size.width;
205
+ setInternalWidth(width);
206
+ if (!isCollapsed) {
207
+ setExpandedWidth(width);
208
+ }
209
+ }
210
+ }, [size === null || size === void 0 ? void 0 : size.width, isResizing, isAnimating, isCollapsed]);
211
+
212
+ // 计算当前的 children(支持函数和静态值)- 使用 renderCollapsed 而不是 isCollapsed
213
+ var currentChildren = useMemo(function () {
214
+ return typeof children === 'function' ? children(renderCollapsed) : children;
215
+ }, [children, renderCollapsed]);
216
+
217
+ // 计算当前的 header(支持函数和静态值)- 使用 renderCollapsed 而不是 isCollapsed
218
+ var currentHeader = useMemo(function () {
219
+ return typeof header === 'function' ? header(renderCollapsed) : header;
220
+ }, [header, renderCollapsed]);
221
+
222
+ // 计算当前的 footer(支持函数和静态值)- 使用 renderCollapsed 而不是 isCollapsed
223
+ var currentFooter = useMemo(function () {
224
+ return typeof footer === 'function' ? footer(renderCollapsed) : footer;
225
+ }, [footer, renderCollapsed]);
226
+
227
+ // Handle resize
228
+ var handleResize = function handleResize(_, _direction, reference_, delta) {
229
+ var currentWidth = reference_.offsetWidth;
230
+ setInternalWidth(currentWidth);
231
+ onSizeDragging === null || onSizeDragging === void 0 || onSizeDragging(delta, {
232
+ height: reference_.style.height,
233
+ width: reference_.style.width
234
+ });
235
+ };
236
+ var handleResizeStart = function handleResizeStart() {
237
+ setIsResizing(true);
238
+ };
239
+ var handleResizeStop = function handleResizeStop(_, _direction, reference_, delta) {
240
+ setIsResizing(false);
241
+ var currentWidth = reference_.offsetWidth;
242
+
243
+ // 根据拖拽后的宽度决定是折叠还是展开
244
+ if (currentWidth <= minWidth) {
245
+ // 拖拽到最小宽度,保持折叠
246
+ setIsAnimating(true);
247
+ setIsCollapsed(true);
248
+ setInternalWidth(minWidth);
249
+ setTimeout(function () {
250
+ return setIsAnimating(false);
251
+ }, 400);
252
+ } else if (currentWidth < collapseThreshold) {
253
+ // 拖拽到阈值以下,自动折叠
254
+ setIsAnimating(true);
255
+ setIsCollapsed(true);
256
+ setInternalWidth(minWidth);
257
+ setTimeout(function () {
258
+ return setIsAnimating(false);
259
+ }, 400);
260
+ } else if (isCollapsed && currentWidth > minWidth) {
261
+ // 从折叠状态拖拽出来,自动展开
262
+ setIsAnimating(true);
263
+ setIsCollapsed(false);
264
+ setExpandedWidth(currentWidth);
265
+ setInternalWidth(currentWidth);
266
+ setTimeout(function () {
267
+ return setIsAnimating(false);
268
+ }, 400);
269
+ } else if (!isCollapsed) {
270
+ // 展开状态下正常拖拽,记住宽度
271
+ setExpandedWidth(currentWidth);
272
+ setInternalWidth(currentWidth);
273
+ }
274
+ onSizeChange === null || onSizeChange === void 0 || onSizeChange(delta, {
275
+ height: reference_.style.height,
276
+ width: reference_.style.width
277
+ });
278
+ };
279
+
280
+ // Arrow icon based on placement and collapse state
281
+ var ArrowIcon = useMemo(function () {
282
+ if (placement === 'left') {
283
+ // 左侧:折叠时箭头向右(展开方向),展开时箭头向左(折叠方向)
284
+ return ChevronLeft;
285
+ }
286
+ // 右侧:折叠时箭头向左(展开方向),展开时箭头向右(折叠方向)
287
+ return ChevronRight;
288
+ }, [placement]);
289
+
290
+ // Toggle handle with smooth transitions
291
+ var handle = showHandle && /*#__PURE__*/_jsx(motion.div, {
292
+ animate: {
293
+ opacity: isCollapsed && showHandleWhenCollapsed ? 1 : isHovering ? 1 : 0,
294
+ scale: isHovering ? 1.05 : 1
295
+ },
296
+ className: cx(styles.toggleRoot, placement === 'left' ? styles.toggleLeft : styles.toggleRight),
297
+ style: {
298
+ display: 'flex'
299
+ },
300
+ transition: {
301
+ duration: 0.25,
302
+ ease: [0.22, 1, 0.36, 1]
303
+ },
304
+ children: /*#__PURE__*/_jsx(Center, {
305
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.handle,
306
+ onClick: toggleCollapse,
307
+ style: _objectSpread(_objectSpread({}, customStyles === null || customStyles === void 0 ? void 0 : customStyles.handle), {}, {
308
+ cursor: 'pointer',
309
+ transition: 'transform 0.2s ease-out'
310
+ }),
311
+ children: /*#__PURE__*/_jsx(motion.div, {
312
+ animate: {
313
+ rotate: isCollapsed ? 180 : 0
314
+ },
315
+ transition: {
316
+ duration: 0.3,
317
+ ease: [0.22, 1, 0.36, 1]
318
+ },
319
+ children: /*#__PURE__*/_jsx(Icon, {
320
+ className: styles.handlerIcon,
321
+ icon: ArrowIcon,
322
+ size: 16
323
+ })
324
+ })
325
+ })
326
+ });
327
+
328
+ // Size configuration - 使用内部宽度状态
329
+ var sizeConfig = useMemo(function () {
330
+ return {
331
+ maxWidth: maxWidth,
332
+ minWidth: minWidth,
333
+ size: {
334
+ height: '100%',
335
+ width: internalWidth
336
+ }
337
+ };
338
+ }, [internalWidth, minWidth, maxWidth]);
339
+
340
+ // Resize enable configuration - 始终允许拖拽
341
+ var resizeEnable = useMemo(function () {
342
+ if (!resizable) {
343
+ return {
344
+ bottom: false,
345
+ bottomLeft: false,
346
+ bottomRight: false,
347
+ left: false,
348
+ right: false,
349
+ top: false,
350
+ topLeft: false,
351
+ topRight: false
352
+ };
353
+ }
354
+ return {
355
+ bottom: false,
356
+ bottomLeft: false,
357
+ bottomRight: false,
358
+ left: placement === 'right',
359
+ right: placement === 'left',
360
+ top: false,
361
+ topLeft: false,
362
+ topRight: false
363
+ };
364
+ }, [resizable, placement]);
365
+ return /*#__PURE__*/_jsx("aside", {
366
+ ref: ref,
367
+ children: /*#__PURE__*/_jsxs(Resizable, _objectSpread(_objectSpread({}, sizeConfig), {}, {
368
+ className: cx(styles.container, classNames === null || classNames === void 0 ? void 0 : classNames.container, className),
369
+ enable: resizeEnable,
370
+ handleClasses: _defineProperty({}, placement === 'left' ? 'right' : 'left', cx(styles.resizeHandle, showHandleHighlight && styles.resizeHandleHighlight, placement === 'left' ? styles.resizeHandleLeft : styles.resizeHandleRight)),
371
+ onResize: handleResize,
372
+ onResizeStart: handleResizeStart,
373
+ onResizeStop: handleResizeStop,
374
+ style: _objectSpread(_objectSpread(_objectSpread({}, customStyles === null || customStyles === void 0 ? void 0 : customStyles.container), rest.style), {}, {
375
+ // 拖拽时不要动画,点击 handle 时有流畅的弹性动画
376
+ transition: isResizing ? 'none' : isAnimating ? 'width 0.4s cubic-bezier(0.22, 1, 0.36, 1)' : 'none'
377
+ }),
378
+ children: [handle, /*#__PURE__*/_jsxs(Flexbox, {
379
+ className: cx(styles.contentContainer, styles.menuOverride, classNames === null || classNames === void 0 ? void 0 : classNames.content),
380
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.content,
381
+ children: [currentHeader && /*#__PURE__*/_jsx("div", {
382
+ className: cx(styles.header, classNames === null || classNames === void 0 ? void 0 : classNames.header),
383
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.header,
384
+ children: /*#__PURE__*/_jsx(AnimationWrapper, {
385
+ blur: (_animation$blur = animation === null || animation === void 0 ? void 0 : animation.blur) !== null && _animation$blur !== void 0 ? _animation$blur : false,
386
+ collapsed: renderCollapsed,
387
+ enabled: animation === null || animation === void 0 ? void 0 : animation.header,
388
+ fade: (_animation$fade = animation === null || animation === void 0 ? void 0 : animation.fade) !== null && _animation$fade !== void 0 ? _animation$fade : true,
389
+ id: "header",
390
+ children: currentHeader
391
+ })
392
+ }), /*#__PURE__*/_jsx("div", {
393
+ className: cx(styles.body, classNames === null || classNames === void 0 ? void 0 : classNames.body),
394
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.body,
395
+ children: /*#__PURE__*/_jsx(AnimationWrapper, {
396
+ blur: (_animation$blur2 = animation === null || animation === void 0 ? void 0 : animation.blur) !== null && _animation$blur2 !== void 0 ? _animation$blur2 : false,
397
+ collapsed: renderCollapsed,
398
+ enabled: animation === null || animation === void 0 ? void 0 : animation.body,
399
+ fade: (_animation$fade2 = animation === null || animation === void 0 ? void 0 : animation.fade) !== null && _animation$fade2 !== void 0 ? _animation$fade2 : true,
400
+ id: "body",
401
+ children: currentChildren
402
+ })
403
+ }), currentFooter && /*#__PURE__*/_jsx("div", {
404
+ className: cx(styles.footer, classNames === null || classNames === void 0 ? void 0 : classNames.footer),
405
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.footer,
406
+ children: /*#__PURE__*/_jsx(AnimationWrapper, {
407
+ blur: (_animation$blur3 = animation === null || animation === void 0 ? void 0 : animation.blur) !== null && _animation$blur3 !== void 0 ? _animation$blur3 : false,
408
+ collapsed: renderCollapsed,
409
+ enabled: animation === null || animation === void 0 ? void 0 : animation.footer,
410
+ fade: (_animation$fade3 = animation === null || animation === void 0 ? void 0 : animation.fade) !== null && _animation$fade3 !== void 0 ? _animation$fade3 : true,
411
+ id: "footer",
412
+ children: currentFooter
413
+ })
414
+ })]
415
+ })]
416
+ }))
417
+ });
418
+ });
419
+ DraggableSideNav.displayName = 'DraggableSideNav';
420
+ export default DraggableSideNav;
@@ -0,0 +1,2 @@
1
+ export { default } from './DraggableSideNav';
2
+ export type * from './type';
@@ -0,0 +1 @@
1
+ export { default } from "./DraggableSideNav";
@@ -0,0 +1,18 @@
1
+ export declare const useStyles: (props?: {
2
+ showBorder: boolean;
3
+ } | undefined) => import("antd-style").ReturnStyles<{
4
+ body: import("antd-style").SerializedStyles;
5
+ container: import("antd-style").SerializedStyles;
6
+ contentContainer: import("antd-style").SerializedStyles;
7
+ footer: import("antd-style").SerializedStyles;
8
+ handlerIcon: import("antd-style").SerializedStyles;
9
+ header: import("antd-style").SerializedStyles;
10
+ menuOverride: import("antd-style").SerializedStyles;
11
+ resizeHandle: import("antd-style").SerializedStyles;
12
+ resizeHandleHighlight: import("antd-style").SerializedStyles;
13
+ resizeHandleLeft: import("antd-style").SerializedStyles;
14
+ resizeHandleRight: import("antd-style").SerializedStyles;
15
+ toggleLeft: import("antd-style").SerializedStyles;
16
+ toggleRight: import("antd-style").SerializedStyles;
17
+ toggleRoot: import("antd-style").SerializedStyles;
18
+ }>;
@@ -0,0 +1,33 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { createStyles } from 'antd-style';
4
+
5
+ // Layout constants (aligned with DraggablePanel)
6
+ var LAYOUT = {
7
+ offset: 16,
8
+ toggleLength: 40,
9
+ toggleShort: 16
10
+ };
11
+ export var useStyles = createStyles(function (_ref, _ref2) {
12
+ var css = _ref.css,
13
+ token = _ref.token,
14
+ stylish = _ref.stylish,
15
+ prefixCls = _ref.prefixCls;
16
+ var showBorder = _ref2.showBorder;
17
+ return {
18
+ body: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n /* Smooth scroll behavior */\n scroll-behavior: smooth;\n overflow: hidden auto;\n flex: 1;\n\n /* Better scrollbar styling */\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: 3px;\n background: ", ";\n\n &:hover {\n background: ", ";\n }\n }\n "])), token.colorBorderSecondary, token.colorBorder),
19
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\n /* Width transition controlled by inline style */\n\n /* Ensure smooth animations */\n will-change: width;\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n height: 100%;\n "]))),
20
+ contentContainer: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: flex;\n flex-direction: column;\n\n height: 100%;\n border-inline-end: ", " solid ", ";\n\n background: ", ";\n "])), showBorder ? '1px' : '0', token.colorBorderSecondary, token.colorBgLayout),
21
+ footer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n "]))),
22
+ handlerIcon: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n /* Icon transitions are now handled by framer-motion */\n display: flex;\n align-items: center;\n justify-content: center;\n "]))),
23
+ header: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n "]))),
24
+ menuOverride: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .", "-menu {\n .", "-menu-item {\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: center;\n\n height: unset;\n min-height: 36px;\n padding-block: 4px;\n padding-inline: 8px !important;\n }\n\n .", "-menu-item-group-title {\n overflow: hidden;\n padding-inline: 8px;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .", "-menu-item-icon {\n position: absolute;\n inset-inline-start: 0;\n\n display: flex !important;\n flex: none;\n align-items: center;\n justify-content: center;\n\n width: 36px;\n height: 36px;\n }\n\n .", "-menu-title-content {\n overflow: hidden;\n flex: 1;\n\n margin: 0 !important;\n padding-inline-start: 36px;\n\n line-height: 1.5;\n }\n\n &.", "-menu-inline-collapsed {\n .ant-menu-title-content {\n display: none;\n width: 0;\n opacity: 0;\n }\n\n .", "-menu-item {\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 36px !important;\n height: 36px !important;\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls, prefixCls),
25
+ resizeHandle: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n cursor: col-resize;\n\n position: absolute;\n z-index: 1;\n inset-block: 0 0;\n\n width: 8px;\n\n transition: background-color 0.2s ease;\n\n &::after {\n content: '';\n\n position: absolute;\n inset-block: 0;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n\n width: 2px;\n\n background: transparent;\n\n transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);\n }\n "]))),
26
+ resizeHandleHighlight: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n &:hover {\n &::after {\n width: 3px;\n background: ", ";\n box-shadow: 0 0 8px ", "40;\n }\n }\n\n &:active {\n &::after {\n background: ", ";\n }\n }\n "])), token.colorPrimary, token.colorPrimary, token.colorPrimaryActive),
27
+ resizeHandleLeft: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n inset-inline-end: -4px;\n "]))),
28
+ resizeHandleRight: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n inset-inline-start: -4px;\n "]))),
29
+ toggleLeft: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n inset-inline-end: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n border-radius: 0 4px 4px 0; /* \u5DE6\u4FA7\u9762\u677F\uFF0Chandle \u5728\u53F3\u8FB9\uFF0C\u53F3\u4FA7\u5706\u89D2 */\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2),
30
+ toggleRight: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n inset-inline-start: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n border-radius: 4px 0 0 4px; /* \u53F3\u4FA7\u9762\u677F\uFF0Chandle \u5728\u5DE6\u8FB9\uFF0C\u5DE6\u4FA7\u5706\u89D2 */\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2),
31
+ toggleRoot: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n\n /* Smooth transitions for all states */\n transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1);\n\n &:has(> div) {\n pointer-events: all;\n }\n\n > div {\n ", ";\n pointer-events: all;\n cursor: pointer;\n\n position: absolute;\n\n color: ", ";\n\n /* Enhanced transitions with backdrop blur */\n transition:\n color 0.2s ", ",\n transform 0.2s ", ",\n box-shadow 0.2s ", ";\n\n backdrop-filter: blur(8px);\n\n &:hover {\n color: ", ";\n box-shadow:\n 0 2px 8px rgba(0, 0, 0, 8%),\n 0 0 0 1px ", ";\n }\n\n &:active {\n transform: scale(0.95);\n color: ", ";\n }\n }\n "])), stylish.variantFilled, token.colorTextTertiary, token.motionEaseOut, token.motionEaseOut, token.motionEaseOut, token.colorTextSecondary, token.colorBorderSecondary, token.colorText)
32
+ };
33
+ });
@@ -0,0 +1,141 @@
1
+ import type { NumberSize, Size } from 're-resizable';
2
+ import type { CSSProperties, ReactNode } from 'react';
3
+ import type { DivProps } from "../types";
4
+ export interface DraggableSideNavProps extends Omit<DivProps, 'children' | 'onSelect'> {
5
+ /**
6
+ * Animation configuration for content transitions
7
+ * @default { fade: true, blur: false, header: false, body: false, footer: false }
8
+ */
9
+ animation?: {
10
+ /**
11
+ * Enable blur effect during transitions
12
+ * @default false
13
+ */
14
+ blur?: boolean;
15
+ /**
16
+ * Enable animation for body section
17
+ * @default false
18
+ */
19
+ body?: boolean;
20
+ /**
21
+ * Enable fade effect during transitions
22
+ * @default true
23
+ */
24
+ fade?: boolean;
25
+ /**
26
+ * Enable animation for footer section
27
+ * @default false
28
+ */
29
+ footer?: boolean;
30
+ /**
31
+ * Enable animation for header section
32
+ * @default false
33
+ */
34
+ header?: boolean;
35
+ };
36
+ /**
37
+ * Body content (main content area)
38
+ * Can be a static element or a function that receives collapsed state
39
+ */
40
+ children: ReactNode | ((collapsed: boolean) => ReactNode);
41
+ /**
42
+ * Classnames for internal components
43
+ */
44
+ classNames?: {
45
+ body?: string;
46
+ container?: string;
47
+ content?: string;
48
+ footer?: string;
49
+ handle?: string;
50
+ header?: string;
51
+ };
52
+ /**
53
+ * Whether the panel is collapsed (controlled)
54
+ */
55
+ collapsed?: boolean;
56
+ /**
57
+ * Whether the panel is collapsed by default
58
+ * @default false
59
+ */
60
+ defaultCollapsed?: boolean;
61
+ /**
62
+ * Default width when expanded
63
+ */
64
+ defaultSize?: Partial<Size>;
65
+ /**
66
+ * Footer content
67
+ * Can be a static element or a function that receives collapsed state
68
+ */
69
+ footer?: ReactNode | ((collapsed: boolean) => ReactNode);
70
+ /**
71
+ * Header content
72
+ * Can be a static element or a function that receives collapsed state
73
+ */
74
+ header?: ReactNode | ((collapsed: boolean) => ReactNode);
75
+ /**
76
+ * Maximum width
77
+ */
78
+ maxWidth?: number;
79
+ /**
80
+ * Minimum width (also the collapsed width)
81
+ * @default 64
82
+ */
83
+ minWidth?: number;
84
+ /**
85
+ * Callback when collapse state changes
86
+ */
87
+ onCollapsedChange?: (collapsed: boolean) => void;
88
+ /**
89
+ * Callback when menu item is selected
90
+ */
91
+ onSelect?: (key: string) => void;
92
+ /**
93
+ * Callback when size changes
94
+ */
95
+ onSizeChange?: (delta: NumberSize, size?: Size) => void;
96
+ /**
97
+ * Callback when actively resizing
98
+ */
99
+ onSizeDragging?: (delta: NumberSize, size?: Size) => void;
100
+ /**
101
+ * Placement of the side nav
102
+ * @default 'left'
103
+ */
104
+ placement?: 'left' | 'right';
105
+ /**
106
+ * Whether to enable resizing
107
+ * @default true
108
+ */
109
+ resizable?: boolean;
110
+ /**
111
+ * Whether to show border
112
+ * @default true
113
+ */
114
+ showBorder?: boolean;
115
+ /**
116
+ * Whether to show handle for toggling
117
+ * @default true
118
+ */
119
+ showHandle?: boolean;
120
+ showHandleHighlight?: boolean;
121
+ /**
122
+ * Whether to show handle when collapsed
123
+ * @default false
124
+ */
125
+ showHandleWhenCollapsed?: boolean;
126
+ /**
127
+ * Current size (controlled)
128
+ */
129
+ size?: Partial<Size>;
130
+ /**
131
+ * Custom styles
132
+ */
133
+ styles?: {
134
+ body?: CSSProperties;
135
+ container?: CSSProperties;
136
+ content?: CSSProperties;
137
+ footer?: CSSProperties;
138
+ handle?: CSSProperties;
139
+ header?: CSSProperties;
140
+ };
141
+ }
@@ -0,0 +1 @@
1
+ export {};
package/es/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { default as CopyButton, type CopyButtonProps } from './CopyButton';
14
14
  export { default as DatePicker, type DatePickerProps } from './DatePicker';
15
15
  export { default as DownloadButton, type DownloadButtonProps } from './DownloadButton';
16
16
  export { default as DraggablePanel, DraggablePanelBody, type DraggablePanelBodyProps, DraggablePanelContainer, type DraggablePanelContainerProps, DraggablePanelFooter, type DraggablePanelFooterProps, DraggablePanelHeader, type DraggablePanelHeaderProps, type DraggablePanelProps, } from './DraggablePanel';
17
+ export { default as DraggableSideNav, type DraggableSideNavProps } from './DraggableSideNav';
17
18
  export { default as Drawer, type DrawerProps } from './Drawer';
18
19
  export { default as Dropdown, type DropdownMenuItemType, type DropdownProps } from './Dropdown';
19
20
  export { default as EditableText, type EditableTextProps } from './EditableText';
package/es/index.js CHANGED
@@ -14,6 +14,7 @@ export { default as CopyButton } from "./CopyButton";
14
14
  export { default as DatePicker } from "./DatePicker";
15
15
  export { default as DownloadButton } from "./DownloadButton";
16
16
  export { default as DraggablePanel, DraggablePanelBody, DraggablePanelContainer, DraggablePanelFooter, DraggablePanelHeader } from "./DraggablePanel";
17
+ export { default as DraggableSideNav } from "./DraggableSideNav";
17
18
  export { default as Drawer } from "./Drawer";
18
19
  export { default as Dropdown } from "./Dropdown";
19
20
  export { default as EditableText } from "./EditableText";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.13.8",
3
+ "version": "2.14.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",