@lobehub/ui 1.170.5 → 1.170.6
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/es/Drawer/index.d.ts +6 -0
- package/es/Drawer/index.js +17 -9
- package/package.json +1 -1
package/es/Drawer/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type DrawerProps as AntdDrawerProps } from 'antd';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { type ActionIconProps } from "../ActionIcon";
|
|
3
4
|
export interface DrawerProps extends Omit<AntdDrawerProps, 'styles' | 'classNames'> {
|
|
4
5
|
classNames?: AntdDrawerProps['classNames'] & {
|
|
5
6
|
bodyContent?: string;
|
|
6
7
|
extra?: string;
|
|
8
|
+
sidebar?: string;
|
|
9
|
+
sidebarContent?: string;
|
|
7
10
|
title?: string;
|
|
8
11
|
};
|
|
12
|
+
closeIconProps?: ActionIconProps;
|
|
9
13
|
containerMaxWidth?: number;
|
|
10
14
|
noHeader?: boolean;
|
|
11
15
|
sidebar?: ReactNode;
|
|
@@ -13,6 +17,8 @@ export interface DrawerProps extends Omit<AntdDrawerProps, 'styles' | 'className
|
|
|
13
17
|
styles?: AntdDrawerProps['styles'] & {
|
|
14
18
|
bodyContent?: CSSProperties;
|
|
15
19
|
extra?: CSSProperties;
|
|
20
|
+
sidebar?: CSSProperties;
|
|
21
|
+
sidebarContent?: CSSProperties;
|
|
16
22
|
title?: CSSProperties;
|
|
17
23
|
};
|
|
18
24
|
}
|
package/es/Drawer/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
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 = ["onClose", "containerMaxWidth", "classNames", "title", "placement", "styles", "children", "height", "width", "extra", "noHeader", "sidebarWidth", "sidebar"];
|
|
4
|
+
var _excluded = ["onClose", "containerMaxWidth", "classNames", "title", "placement", "styles", "children", "height", "width", "extra", "closeIconProps", "noHeader", "sidebarWidth", "sidebar", "closeIcon"];
|
|
5
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
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
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; }
|
|
@@ -30,10 +30,12 @@ var Drawer = /*#__PURE__*/memo(function (_ref) {
|
|
|
30
30
|
height = _ref.height,
|
|
31
31
|
width = _ref.width,
|
|
32
32
|
extra = _ref.extra,
|
|
33
|
+
closeIconProps = _ref.closeIconProps,
|
|
33
34
|
noHeader = _ref.noHeader,
|
|
34
35
|
_ref$sidebarWidth = _ref.sidebarWidth,
|
|
35
36
|
sidebarWidth = _ref$sidebarWidth === void 0 ? 280 : _ref$sidebarWidth,
|
|
36
37
|
sidebar = _ref.sidebar,
|
|
38
|
+
closeIcon = _ref.closeIcon,
|
|
37
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
40
|
var theme = useTheme();
|
|
39
41
|
var headerBorder = useMemo(function () {
|
|
@@ -80,11 +82,11 @@ var Drawer = /*#__PURE__*/memo(function (_ref) {
|
|
|
80
82
|
right: 4,
|
|
81
83
|
top: 4
|
|
82
84
|
}, styles === null || styles === void 0 ? void 0 : styles.extra),
|
|
83
|
-
children: [extra, /*#__PURE__*/_jsx(ActionIcon, {
|
|
85
|
+
children: [extra, closeIcon || /*#__PURE__*/_jsx(ActionIcon, _objectSpread({
|
|
84
86
|
icon: XIcon,
|
|
85
87
|
onClick: onClose,
|
|
86
88
|
size: 'site'
|
|
87
|
-
})]
|
|
89
|
+
}, closeIconProps))]
|
|
88
90
|
});
|
|
89
91
|
return /*#__PURE__*/_jsx(AntdDrawer, _objectSpread(_objectSpread({
|
|
90
92
|
classNames: classNames,
|
|
@@ -140,23 +142,29 @@ var Drawer = /*#__PURE__*/memo(function (_ref) {
|
|
|
140
142
|
}, styles === null || styles === void 0 ? void 0 : styles.bodyContent),
|
|
141
143
|
children: [noHeader && extraNode, sidebar ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
142
144
|
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
145
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.sidebar,
|
|
143
146
|
paddingBlock: 12,
|
|
144
147
|
paddingInline: 16,
|
|
145
|
-
style: {
|
|
148
|
+
style: _objectSpread({
|
|
146
149
|
background: theme.colorBgContainer,
|
|
147
150
|
borderRight: "1px solid ".concat(theme.colorBorderSecondary),
|
|
148
|
-
height: '100%'
|
|
149
|
-
|
|
151
|
+
height: '100%',
|
|
152
|
+
overflowX: 'hidden',
|
|
153
|
+
overflowY: 'auto'
|
|
154
|
+
}, styles === null || styles === void 0 ? void 0 : styles.sidebar),
|
|
150
155
|
width: sidebarWidth,
|
|
151
156
|
children: sidebar
|
|
152
157
|
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
158
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.sidebarContent,
|
|
153
159
|
flex: 1,
|
|
154
160
|
paddingBlock: 12,
|
|
155
161
|
paddingInline: 16,
|
|
156
|
-
style: {
|
|
162
|
+
style: _objectSpread({
|
|
157
163
|
background: theme.colorBgLayout,
|
|
158
|
-
height: '100%'
|
|
159
|
-
|
|
164
|
+
height: '100%',
|
|
165
|
+
overflowX: 'hidden',
|
|
166
|
+
overflowY: 'auto'
|
|
167
|
+
}, styles === null || styles === void 0 ? void 0 : styles.sidebarContent),
|
|
160
168
|
children: children
|
|
161
169
|
})]
|
|
162
170
|
}) : children]
|